The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V33. Data structures and computation

Mathlib.Control.Bitraversable.Lemmas

18 declarations. Mathlib docs · Source

Bitraversable Lemmas

Main definitions

  • tfst - traverse on first functor argument
  • tsnd - traverse on second functor argument

Lemmas

Combination of

  • bitraverse
  • tfst
  • tsnd

with the applicatives id and comp

References

Tags

traversable bitraversable functor bifunctor applicative

abbrev Bitraversable.tfst E1 #

{t : Type u → Type u → Type u} →
  [Bitraversable t] →
    {β : Type u} → {F : Type u → Type u} → [Applicative F] → {α α' : Type u} → (α → F α') → t α β → F (t α' β)

traverse on the first functor argument

abbrev Bitraversable.tsnd E1 #

{t : Type u → Type u → Type u} →
  [Bitraversable t] →
    {β : Type u} → {F : Type u → Type u} → [Applicative F] → {α α' : Type u} → (α → F α') → t β α → F (t β α')

traverse on the second functor argument

theorem Bitraversable.id_tfst E1 #

∀ {t : Type u → Type u → Type u} [inst : Bitraversable t] [LawfulBitraversable t] {α β : Type u} (x : t α β),
  Bitraversable.tfst pure x = pure x

theorem Bitraversable.tfst_id E1 #

∀ {t : Type u → Type u → Type u} [inst : Bitraversable t] [LawfulBitraversable t] {α β : Type u},
  Bitraversable.tfst pure = pure

theorem Bitraversable.tsnd_id E1 #

∀ {t : Type u → Type u → Type u} [inst : Bitraversable t] [LawfulBitraversable t] {α β : Type u},
  Bitraversable.tsnd pure = pure

theorem Bitraversable.id_tsnd E1 #

∀ {t : Type u → Type u → Type u} [inst : Bitraversable t] [LawfulBitraversable t] {α β : Type u} (x : t α β),
  Bitraversable.tsnd pure x = pure x

theorem Bitraversable.tfst_comp_tfst E1 #

∀ {t : Type u → Type u → Type u} [inst : Bitraversable t] {F G : Type u → Type u} [inst_1 : Applicative F]
  [inst_2 : Applicative G] [LawfulBitraversable t] [LawfulApplicative F] [LawfulApplicative G] {α₀ α₁ α₂ β : Type u}
  (f : α₀ → F α₁) (f' : α₁ → G α₂),
  Functor.Comp.mk ∘ Functor.map (Bitraversable.tfst f') ∘ Bitraversable.tfst f =
    Bitraversable.tfst (Functor.Comp.mk ∘ Functor.map f' ∘ f)

theorem Bitraversable.comp_tfst E1 #

∀ {t : Type u → Type u → Type u} [inst : Bitraversable t] {F G : Type u → Type u} [inst_1 : Applicative F]
  [inst_2 : Applicative G] [LawfulBitraversable t] [LawfulApplicative F] [LawfulApplicative G] {α₀ α₁ α₂ β : Type u}
  (f : α₀ → F α₁) (f' : α₁ → G α₂) (x : t α₀ β),
  Functor.Comp.mk (Bitraversable.tfst f' <$> Bitraversable.tfst f x) =
    Bitraversable.tfst (Functor.Comp.mk ∘ Functor.map f' ∘ f) x

theorem Bitraversable.tfst_tsnd E1 #

∀ {t : Type u → Type u → Type u} [inst : Bitraversable t] {F G : Type u → Type u} [inst_1 : Applicative F]
  [inst_2 : Applicative G] [LawfulBitraversable t] [LawfulApplicative F] [LawfulApplicative G] {α₀ α₁ β₀ β₁ : Type u}
  (f : α₀ → F α₁) (f' : β₀ → G β₁) (x : t α₀ β₀),
  Functor.Comp.mk (Bitraversable.tfst f <$> Bitraversable.tsnd f' x) =
    bitraverse (Functor.Comp.mk ∘ pure ∘ f) (Functor.Comp.mk ∘ Functor.map pure ∘ f') x

theorem Bitraversable.tfst_comp_tsnd E1 #

∀ {t : Type u → Type u → Type u} [inst : Bitraversable t] {F G : Type u → Type u} [inst_1 : Applicative F]
  [inst_2 : Applicative G] [LawfulBitraversable t] [LawfulApplicative F] [LawfulApplicative G] {α₀ α₁ β₀ β₁ : Type u}
  (f : α₀ → F α₁) (f' : β₀ → G β₁),
  Functor.Comp.mk ∘ Functor.map (Bitraversable.tfst f) ∘ Bitraversable.tsnd f' =
    bitraverse (Functor.Comp.mk ∘ pure ∘ f) (Functor.Comp.mk ∘ Functor.map pure ∘ f')

theorem Bitraversable.tsnd_comp_tfst E1 #

∀ {t : Type u → Type u → Type u} [inst : Bitraversable t] {F G : Type u → Type u} [inst_1 : Applicative F]
  [inst_2 : Applicative G] [LawfulBitraversable t] [LawfulApplicative F] [LawfulApplicative G] {α₀ α₁ β₀ β₁ : Type u}
  (f : α₀ → F α₁) (f' : β₀ → G β₁),
  Functor.Comp.mk ∘ Functor.map (Bitraversable.tsnd f') ∘ Bitraversable.tfst f =
    bitraverse (Functor.Comp.mk ∘ Functor.map pure ∘ f) (Functor.Comp.mk ∘ pure ∘ f')

theorem Bitraversable.tsnd_tfst E1 #

∀ {t : Type u → Type u → Type u} [inst : Bitraversable t] {F G : Type u → Type u} [inst_1 : Applicative F]
  [inst_2 : Applicative G] [LawfulBitraversable t] [LawfulApplicative F] [LawfulApplicative G] {α₀ α₁ β₀ β₁ : Type u}
  (f : α₀ → F α₁) (f' : β₀ → G β₁) (x : t α₀ β₀),
  Functor.Comp.mk (Bitraversable.tsnd f' <$> Bitraversable.tfst f x) =
    bitraverse (Functor.Comp.mk ∘ Functor.map pure ∘ f) (Functor.Comp.mk ∘ pure ∘ f') x

theorem Bitraversable.comp_tsnd E1 #

∀ {t : Type u → Type u → Type u} [inst : Bitraversable t] {F G : Type u → Type u} [inst_1 : Applicative F]
  [inst_2 : Applicative G] [LawfulBitraversable t] [LawfulApplicative F] [LawfulApplicative G] {α β₀ β₁ β₂ : Type u}
  (g : β₀ → F β₁) (g' : β₁ → G β₂) (x : t α β₀),
  Functor.Comp.mk (Bitraversable.tsnd g' <$> Bitraversable.tsnd g x) =
    Bitraversable.tsnd (Functor.Comp.mk ∘ Functor.map g' ∘ g) x

theorem Bitraversable.tsnd_comp_tsnd E1 #

∀ {t : Type u → Type u → Type u} [inst : Bitraversable t] {F G : Type u → Type u} [inst_1 : Applicative F]
  [inst_2 : Applicative G] [LawfulBitraversable t] [LawfulApplicative F] [LawfulApplicative G] {α β₀ β₁ β₂ : Type u}
  (g : β₀ → F β₁) (g' : β₁ → G β₂),
  Functor.Comp.mk ∘ Functor.map (Bitraversable.tsnd g') ∘ Bitraversable.tsnd g =
    Bitraversable.tsnd (Functor.Comp.mk ∘ Functor.map g' ∘ g)

theorem Bitraversable.tfst_eq_fst_id E1 #

∀ {t : Type u → Type u → Type u} [inst : Bitraversable t] [LawfulBitraversable t] {α α' β : Type u} (f : α → α')
  (x : t α β), Bitraversable.tfst (pure ∘ f) x = pure (Bifunctor.fst f x)

theorem Bitraversable.tfst_eq_fst_id' E1 #

∀ {t : Type u → Type u → Type u} [inst : Bitraversable t] [LawfulBitraversable t] {α α' β : Type u} (f : α → α'),
  Bitraversable.tfst (pure ∘ f) = pure ∘ Bifunctor.fst f

theorem Bitraversable.tsnd_eq_snd_id' E1 #

∀ {t : Type u → Type u → Type u} [inst : Bitraversable t] [LawfulBitraversable t] {α β β' : Type u} (f : β → β'),
  Bitraversable.tsnd (pure ∘ f) = pure ∘ Bifunctor.snd f

theorem Bitraversable.tsnd_eq_snd_id E1 #

∀ {t : Type u → Type u → Type u} [inst : Bitraversable t] [LawfulBitraversable t] {α β β' : Type u} (f : β → β')
  (x : t α β), Bitraversable.tsnd (pure ∘ f) x = pure (Bifunctor.snd f x)