fact
stringlengths
6
3.84k
type
stringclasses
11 values
library
stringclasses
32 values
imports
listlengths
1
14
filename
stringlengths
20
95
symbolic_name
stringlengths
1
90
docstring
stringlengths
7
20k
Applicative.map_seq_map (f : α → β → γ) (g : σ → β) (x : F α) (y : F σ) : f <$> x <*> g <$> y = ((· ∘ g) ∘ f) <$> x <*> y := by simp [functor_norm, Function.comp_def]
theorem
Control
[ "Mathlib.Algebra.Group.Defs", "Mathlib.Control.Functor", "Mathlib.Control.Basic" ]
Mathlib/Control/Applicative.lean
Applicative.map_seq_map
null
Applicative.pure_seq_eq_map' (f : α → β) : ((pure f : F (α → β)) <*> ·) = (f <$> ·) := by simp [functor_norm]
theorem
Control
[ "Mathlib.Algebra.Group.Defs", "Mathlib.Control.Functor", "Mathlib.Control.Basic" ]
Mathlib/Control/Applicative.lean
Applicative.pure_seq_eq_map'
null
Applicative.ext {F} : ∀ {A1 : Applicative F} {A2 : Applicative F} [@LawfulApplicative F A1] [@LawfulApplicative F A2], (∀ {α : Type u} (x : α), @Pure.pure _ A1.toPure _ x = @Pure.pure _ A2.toPure _ x) → (∀ {α β : Type u} (f : F (α → β)) (x : F α), @Seq.seq _ A1.toSeq _ _ f (fun _ => x) = @Seq.seq _ A2.toSeq _ _ f (fun _ => x)) → A1 = A2 | { toFunctor := F1, seq := s1, pure := p1, seqLeft := sl1, seqRight := sr1 }, { toFunctor := F2, seq := s2, pure := p2, seqLeft := sl2, seqRight := sr2 }, L1, L2, H1, H2 => by obtain rfl : @p1 = @p2 := by funext α x apply H1 obtain rfl : @s1 = @s2 := by funext α β f x exact H2 f (x Unit.unit) obtain ⟨seqLeft_eq1, seqRight_eq1, pure_seq1, -⟩ := L1 obtain ⟨seqLeft_eq2, seqRight_eq2, pure_seq2, -⟩ := L2 obtain rfl : F1 = F2 := by apply Functor.ext intros exact (pure_seq1 _ _).symm.trans (pure_seq2 _ _) congr <;> funext α β x y · exact (seqLeft_eq1 _ (y Unit.unit)).trans (seqLeft_eq2 _ _).symm · exact (seqRight_eq1 _ (y Unit.unit)).trans (seqRight_eq2 _ (y Unit.unit)).symm
theorem
Control
[ "Mathlib.Algebra.Group.Defs", "Mathlib.Control.Functor", "Mathlib.Control.Basic" ]
Mathlib/Control/Applicative.lean
Applicative.ext
null
map_pure (f : α → β) (x : α) : (f <$> pure x : Comp F G β) = pure (f x) := Comp.ext <| by simp
theorem
Control
[ "Mathlib.Algebra.Group.Defs", "Mathlib.Control.Functor", "Mathlib.Control.Basic" ]
Mathlib/Control/Applicative.lean
map_pure
null
seq_pure (f : Comp F G (α → β)) (x : α) : f <*> pure x = (fun g : α → β => g x) <$> f := Comp.ext <| by simp [functor_norm]
theorem
Control
[ "Mathlib.Algebra.Group.Defs", "Mathlib.Control.Functor", "Mathlib.Control.Basic" ]
Mathlib/Control/Applicative.lean
seq_pure
null
seq_assoc (x : Comp F G α) (f : Comp F G (α → β)) (g : Comp F G (β → γ)) : g <*> (f <*> x) = @Function.comp α β γ <$> g <*> f <*> x := Comp.ext <| by simp [comp_def, functor_norm]
theorem
Control
[ "Mathlib.Algebra.Group.Defs", "Mathlib.Control.Functor", "Mathlib.Control.Basic" ]
Mathlib/Control/Applicative.lean
seq_assoc
null
pure_seq_eq_map (f : α → β) (x : Comp F G α) : pure f <*> x = f <$> x := Comp.ext <| by simp [functor_norm]
theorem
Control
[ "Mathlib.Algebra.Group.Defs", "Mathlib.Control.Functor", "Mathlib.Control.Basic" ]
Mathlib/Control/Applicative.lean
pure_seq_eq_map
null
instLawfulApplicativeComp : LawfulApplicative (Comp F G) where seqLeft_eq := by intros; rfl seqRight_eq := by intros; rfl pure_seq := Comp.pure_seq_eq_map map_pure := Comp.map_pure seq_pure := Comp.seq_pure seq_assoc := Comp.seq_assoc
instance
Control
[ "Mathlib.Algebra.Group.Defs", "Mathlib.Control.Functor", "Mathlib.Control.Basic" ]
Mathlib/Control/Applicative.lean
instLawfulApplicativeComp
null
applicative_id_comp {F} [AF : Applicative F] [LawfulApplicative F] : @instApplicativeComp Id F _ _ = AF := @Applicative.ext F _ _ (instLawfulApplicativeComp (F := Id)) _ (fun _ => rfl) (fun _ _ => rfl)
theorem
Control
[ "Mathlib.Algebra.Group.Defs", "Mathlib.Control.Functor", "Mathlib.Control.Basic" ]
Mathlib/Control/Applicative.lean
applicative_id_comp
null
applicative_comp_id {F} [AF : Applicative F] [LawfulApplicative F] : @Comp.instApplicativeComp F Id _ _ = AF := @Applicative.ext F _ _ (instLawfulApplicativeComp (G := Id)) _ (fun _ => rfl) (fun f x => show id <$> f <*> x = f <*> x by rw [id_map]) open CommApplicative
theorem
Control
[ "Mathlib.Algebra.Group.Defs", "Mathlib.Control.Functor", "Mathlib.Control.Basic" ]
Mathlib/Control/Applicative.lean
applicative_comp_id
null
@[functor_norm] Comp.seq_mk {α β : Type w} {f : Type u → Type v} {g : Type w → Type u} [Applicative f] [Applicative g] (h : f (g (α → β))) (x : f (g α)) : Comp.mk h <*> Comp.mk x = Comp.mk ((· <*> ·) <$> h <*> x) := rfl
theorem
Control
[ "Mathlib.Algebra.Group.Defs", "Mathlib.Control.Functor", "Mathlib.Control.Basic" ]
Mathlib/Control/Applicative.lean
Comp.seq_mk
null
zipWithM {α₁ α₂ φ : Type u} (f : α₁ → α₂ → F φ) : ∀ (_ : List α₁) (_ : List α₂), F (List φ) | x :: xs, y :: ys => (· :: ·) <$> f x y <*> zipWithM f xs ys | _, _ => pure []
def
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
zipWithM
A generalization of `List.zipWith` which combines list elements with an `Applicative`.
zipWithM' (f : α → β → F γ) : List α → List β → F PUnit | x :: xs, y :: ys => f x y *> zipWithM' f xs ys | [], _ => pure PUnit.unit | _, [] => pure PUnit.unit variable [LawfulApplicative F] @[simp]
def
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
zipWithM'
Like `zipWithM` but evaluates the result as it traverses the lists using `*>`.
pure_id'_seq (x : F α) : (pure fun x => x) <*> x = x := pure_id_seq x @[functor_norm]
theorem
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
pure_id'_seq
null
seq_map_assoc (x : F (α → β)) (f : γ → α) (y : F γ) : x <*> f <$> y = (· ∘ f) <$> x <*> y := by simp only [← pure_seq] simp only [seq_assoc, seq_pure, ← comp_map] simp [pure_seq] rfl @[functor_norm]
theorem
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
seq_map_assoc
null
map_seq (f : β → γ) (x : F (α → β)) (y : F α) : f <$> (x <*> y) = (f ∘ ·) <$> x <*> y := by simp only [← pure_seq]; simp [seq_assoc]
theorem
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
map_seq
null
seq_bind_eq (x : m α) {g : β → m γ} {f : α → β} : f <$> x >>= g = x >>= g ∘ f := show bind (f <$> x) g = bind x (g ∘ f) by simp [Function.comp_def] @[functor_norm]
theorem
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
seq_bind_eq
null
fish_pure {α β} (f : α → m β) : f >=> pure = f := by simp +unfoldPartialApp only [(· >=> ·), functor_norm] @[functor_norm]
theorem
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
fish_pure
null
fish_pipe {α β} (f : α → m β) : pure >=> f = f := by simp +unfoldPartialApp only [(· >=> ·), functor_norm] @[functor_norm]
theorem
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
fish_pipe
null
fish_assoc {α β γ φ} (f : α → m β) (g : β → m γ) (h : γ → m φ) : (f >=> g) >=> h = f >=> g >=> h := by simp +unfoldPartialApp only [(· >=> ·), functor_norm] variable {β' γ' : Type v} variable {m' : Type v → Type w} [Monad m']
theorem
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
fish_assoc
null
List.mapAccumRM (f : α → β' → m' (β' × γ')) : β' → List α → m' (β' × List γ') | a, [] => pure (a, []) | a, x :: xs => do let (a', ys) ← List.mapAccumRM f a xs let (a'', y) ← f x a' pure (a'', y :: ys)
def
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
List.mapAccumRM
Takes a value `β` and `List α` and accumulates pairs according to a monadic function `f`. Accumulation occurs from the right (i.e., starting from the tail of the list).
List.mapAccumLM (f : β' → α → m' (β' × γ')) : β' → List α → m' (β' × List γ') | a, [] => pure (a, []) | a, x :: xs => do let (a', y) ← f a x let (a'', ys) ← List.mapAccumLM f a' xs pure (a'', y :: ys)
def
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
List.mapAccumLM
Takes a value `β` and `List α` and accumulates pairs according to a monadic function `f`. Accumulation occurs from the left (i.e., starting from the head of the list).
joinM_map_map {α β : Type u} (f : α → β) (a : m (m α)) : joinM (Functor.map f <$> a) = f <$> joinM a := by simp only [joinM, id, ← bind_pure_comp, bind_assoc, pure_bind]
theorem
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
joinM_map_map
null
joinM_map_joinM {α : Type u} (a : m (m (m α))) : joinM (joinM <$> a) = joinM (joinM a) := by simp only [joinM, id, ← bind_pure_comp, bind_assoc, pure_bind] @[simp]
theorem
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
joinM_map_joinM
null
joinM_map_pure {α : Type u} (a : m α) : joinM (pure <$> a) = a := by simp only [joinM, id, ← bind_pure_comp, bind_assoc, pure_bind, bind_pure] @[simp]
theorem
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
joinM_map_pure
null
joinM_pure {α : Type u} (a : m α) : joinM (pure a) = a := LawfulMonad.pure_bind a id
theorem
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
joinM_pure
null
succeeds {α} (x : F α) : F Bool := Functor.mapConst true x <|> pure false
def
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
succeeds
Returns `pure true` if the computation succeeds and `pure false` otherwise.
tryM {α} (x : F α) : F Unit := Functor.mapConst () x <|> pure ()
def
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
tryM
Attempts to perform the computation, but fails silently if it doesn't succeed.
try? {α} (x : F α) : F (Option α) := some <$> x <|> pure none @[simp]
def
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
try
Attempts to perform the computation, and returns `none` if it doesn't succeed.
guard_true {h : Decidable True} : @guard F _ True h = pure () := by simp [guard] @[simp]
theorem
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
guard_true
null
guard_false {h : Decidable False} : @guard F _ False h = failure := by simp [guard]
theorem
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
guard_false
null
protected bind {α β} : e ⊕ α → (α → e ⊕ β) → e ⊕ β | inl x, _ => inl x | inr x, f => f x
def
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
bind
The monadic `bind` operation for `Sum`.
CommApplicative (m : Type u → Type v) [Applicative m] : Prop extends LawfulApplicative m where /-- Computations performed first on `a : α` and then on `b : β` are equal to those performed in the reverse order. -/ commutative_prod : ∀ {α β} (a : m α) (b : m β), Prod.mk <$> a <*> b = (fun (b : β) a => (a, b)) <$> b <*> a open Functor
class
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
CommApplicative
A `CommApplicative` functor `m` is a (lawful) applicative functor which behaves identically on `α × β` and `β × α`, so computations can occur in either order.
CommApplicative.commutative_map {m : Type u → Type v} [h : Applicative m] [CommApplicative m] {α β γ} (a : m α) (b : m β) {f : α → β → γ} : f <$> a <*> b = flip f <$> b <*> a := calc f <$> a <*> b = (fun p : α × β => f p.1 p.2) <$> (Prod.mk <$> a <*> b) := by simp only [map_seq, map_map, Function.comp_def] _ = (fun b a => f a b) <$> b <*> a := by rw [@CommApplicative.commutative_prod m h] simp [map_seq, map_map] rfl
theorem
Control
[ "Mathlib.Control.Combinators", "Mathlib.Logic.Function.Defs", "Mathlib.Tactic.CasesM", "Mathlib.Tactic.Attr.Core" ]
Mathlib/Control/Basic.lean
CommApplicative.commutative_map
null
Bifunctor (F : Type u₀ → Type u₁ → Type u₂) where bimap : ∀ {α α' β β'}, (α → α') → (β → β') → F α β → F α' β' export Bifunctor (bimap)
class
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
Bifunctor
Lawless bifunctor. This typeclass only holds the data for the bimap.
LawfulBifunctor (F : Type u₀ → Type u₁ → Type u₂) [Bifunctor F] : Prop where id_bimap : ∀ {α β} (x : F α β), bimap id id x = x bimap_bimap : ∀ {α₀ α₁ α₂ β₀ β₁ β₂} (f : α₀ → α₁) (f' : α₁ → α₂) (g : β₀ → β₁) (g' : β₁ → β₂) (x : F α₀ β₀), bimap f' g' (bimap f g x) = bimap (f' ∘ f) (g' ∘ g) x export LawfulBifunctor (id_bimap bimap_bimap) attribute [higher_order bimap_id_id] id_bimap attribute [higher_order bimap_comp_bimap] bimap_bimap export LawfulBifunctor (bimap_id_id bimap_comp_bimap) variable {F : Type u₀ → Type u₁ → Type u₂} [Bifunctor F]
class
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
LawfulBifunctor
Bifunctor. This typeclass asserts that a lawless `Bifunctor` is lawful.
fst {α α' β} (f : α → α') : F α β → F α' β := bimap f id
abbrev
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
fst
Left map of a bifunctor.
snd {α β β'} (f : β → β') : F α β → F α β' := bimap id f variable [LawfulBifunctor F] @[higher_order fst_id]
abbrev
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
snd
Right map of a bifunctor.
id_fst : ∀ {α β} (x : F α β), fst id x = x := @id_bimap _ _ _ @[higher_order snd_id]
theorem
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
id_fst
null
id_snd : ∀ {α β} (x : F α β), snd id x = x := @id_bimap _ _ _ @[higher_order fst_comp_fst]
theorem
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
id_snd
null
comp_fst {α₀ α₁ α₂ β} (f : α₀ → α₁) (f' : α₁ → α₂) (x : F α₀ β) : fst f' (fst f x) = fst (f' ∘ f) x := by simp [fst, bimap_bimap] @[higher_order fst_comp_snd]
theorem
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
comp_fst
null
fst_snd {α₀ α₁ β₀ β₁} (f : α₀ → α₁) (f' : β₀ → β₁) (x : F α₀ β₀) : fst f (snd f' x) = bimap f f' x := by simp [fst, bimap_bimap] @[higher_order snd_comp_fst]
theorem
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
fst_snd
null
snd_fst {α₀ α₁ β₀ β₁} (f : α₀ → α₁) (f' : β₀ → β₁) (x : F α₀ β₀) : snd f' (fst f x) = bimap f f' x := by simp [snd, bimap_bimap] @[higher_order snd_comp_snd]
theorem
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
snd_fst
null
comp_snd {α β₀ β₁ β₂} (g : β₀ → β₁) (g' : β₁ → β₂) (x : F α β₀) : snd g' (snd g x) = snd (g' ∘ g) x := by simp [snd, bimap_bimap] attribute [functor_norm] bimap_bimap comp_snd comp_fst snd_comp_snd snd_comp_fst fst_comp_snd fst_comp_fst bimap_comp_bimap bimap_id_id fst_id snd_id
theorem
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
comp_snd
null
Prod.bifunctor : Bifunctor Prod where bimap := @Prod.map
instance
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
Prod.bifunctor
null
Prod.lawfulBifunctor : LawfulBifunctor Prod where id_bimap _ := rfl bimap_bimap _ _ _ _ _ := rfl
instance
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
Prod.lawfulBifunctor
null
Bifunctor.const : Bifunctor Const where bimap f _ := f
instance
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
Bifunctor.const
null
LawfulBifunctor.const : LawfulBifunctor Const where id_bimap _ := rfl bimap_bimap _ _ _ _ _ := rfl
instance
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
LawfulBifunctor.const
null
Bifunctor.flip : Bifunctor (flip F) where bimap {_α α' _β β'} f f' x := (bimap f' f x : F β' α')
instance
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
Bifunctor.flip
null
LawfulBifunctor.flip [LawfulBifunctor F] : LawfulBifunctor (flip F) where id_bimap := by simp [bimap, functor_norm] bimap_bimap := by simp [bimap, functor_norm]
instance
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
LawfulBifunctor.flip
null
Sum.bifunctor : Bifunctor Sum where bimap := @Sum.map
instance
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
Sum.bifunctor
null
Sum.lawfulBifunctor : LawfulBifunctor Sum where id_bimap := by aesop bimap_bimap := by aesop open Bifunctor
instance
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
Sum.lawfulBifunctor
null
Function.bicompl.bifunctor : Bifunctor (bicompl F G H) where bimap {_α α' _β β'} f f' x := (bimap (map f) (map f') x : F (G α') (H β'))
instance
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
Function.bicompl.bifunctor
null
Function.bicompl.lawfulBifunctor [LawfulFunctor G] [LawfulFunctor H] [LawfulBifunctor F] : LawfulBifunctor (bicompl F G H) := by constructor <;> intros <;> simp [bimap, map_id, map_comp_map, functor_norm]
instance
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
Function.bicompl.lawfulBifunctor
null
Function.bicompr.bifunctor : Bifunctor (bicompr G F) where bimap {_α α' _β β'} f f' x := (map (bimap f f') x : G (F α' β'))
instance
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
Function.bicompr.bifunctor
null
Function.bicompr.lawfulBifunctor [LawfulFunctor G] [LawfulBifunctor F] : LawfulBifunctor (bicompr G F) := by constructor <;> intros <;> simp [bimap, functor_norm]
instance
Control
[ "Mathlib.Control.Functor", "Mathlib.Tactic.Common" ]
Mathlib/Control/Bifunctor.lean
Function.bicompr.lawfulBifunctor
null
joinM {m : Type u → Type u} [Monad m] {α : Type u} (a : m (m α)) : m α := bind a id
def
Control
[ "Mathlib.Init" ]
Mathlib/Control/Combinators.lean
joinM
Collapses two layers of monadic structure into one, passing the effects of the inner monad through the outer.
@[deprecated "Use `if c then t` without `else` in `do` notation instead." (since := "2025-04-07")] when {m : Type → Type} [Monad m] (c : Prop) [Decidable c] (t : m Unit) : m Unit := ite c t (pure ())
def
Control
[ "Mathlib.Init" ]
Mathlib/Control/Combinators.lean
when
Executes `t` conditional on `c` holding true, doing nothing otherwise.
condM {m : Type → Type} [Monad m] {α : Type} (mbool : m Bool) (tm fm : m α) : m α := do let b ← mbool cond b tm fm set_option linter.deprecated false in
def
Control
[ "Mathlib.Init" ]
Mathlib/Control/Combinators.lean
condM
Executes `tm` or `fm` depending on whether the result of `mbool` is `true` or `false` respectively.
@[deprecated "Use `if ← c then t` without `else` in `do` notation instead." (since := "2025-04-07")] whenM {m : Type → Type} [Monad m] (c : m Bool) (t : m Unit) : m Unit := condM c t (return ())
def
Control
[ "Mathlib.Init" ]
Mathlib/Control/Combinators.lean
whenM
Executes `t` if `c` results in `true`, doing nothing otherwise.
@[deprecated List.mapM (since := "2025-04-07"), inherit_doc List.mapM] mapM := @List.mapM @[deprecated List.mapM' (since := "2025-04-07"), inherit_doc List.mapM']
def
Control
[ "Mathlib.Init" ]
Mathlib/Control/Combinators.lean
mapM
null
mapM' := @List.mapM' @[deprecated joinM (since := "2025-04-07"), inherit_doc joinM]
def
Control
[ "Mathlib.Init" ]
Mathlib/Control/Combinators.lean
mapM'
null
join := @joinM @[deprecated List.filterM (since := "2025-04-07"), inherit_doc List.filterM]
def
Control
[ "Mathlib.Init" ]
Mathlib/Control/Combinators.lean
join
null
filter := @List.filterM @[deprecated List.filterM (since := "2025-04-07"), inherit_doc List.foldlM]
def
Control
[ "Mathlib.Init" ]
Mathlib/Control/Combinators.lean
filter
null
foldl := @List.filterM @[deprecated condM (since := "2025-04-07"), inherit_doc condM]
def
Control
[ "Mathlib.Init" ]
Mathlib/Control/Combinators.lean
foldl
null
cond := @condM
def
Control
[ "Mathlib.Init" ]
Mathlib/Control/Combinators.lean
cond
null
@[deprecated "Use `_root_.sequence` instead." (since := "2025-04-07")] sequence {m : Type u → Type v} [Monad m] {α : Type u} : List (m α) → m (List α) | [] => return [] | h :: t => do let h' ← h let t' ← sequence t return (h' :: t')
def
Control
[ "Mathlib.Init" ]
Mathlib/Control/Combinators.lean
sequence
Executes a list of monadic actions in sequence, collecting the results.
@[deprecated "Use `_root_.sequence` instead." (since := "2025-04-07")] sequence' {m : Type → Type u} [Monad m] {α : Type} : List (m α) → m Unit | [] => return () | h :: t => h *> sequence' t
def
Control
[ "Mathlib.Init" ]
Mathlib/Control/Combinators.lean
sequence'
Executes a list of monadic actions in sequence, discarding the results.
@[deprecated "Use `if ... then` without `else` in `do` notation instead." (since := "2025-04-07")] whenb {m : Type → Type} [Monad m] (b : Bool) (t : m Unit) : m Unit := _root_.cond b t (return ())
def
Control
[ "Mathlib.Init" ]
Mathlib/Control/Combinators.lean
whenb
Executes `t` if `b` is `true`, doing nothing otherwise. See also `when` and `whenM`.
@[deprecated "Use `unless` in `do` notation instead." (since := "2025-04-07")] unlessb {m : Type → Type} [Monad m] (b : Bool) (t : m Unit) : m Unit := _root_.cond b (return ()) t
def
Control
[ "Mathlib.Init" ]
Mathlib/Control/Combinators.lean
unlessb
Executes `t` if `b` is `false`, doing nothing otherwise.
EquivFunctor (f : Type u₀ → Type u₁) where /-- The action of `f` on isomorphisms. -/ map : ∀ {α β}, α ≃ β → f α → f β /-- `map` of `f` preserves the identity morphism. -/ map_refl' : ∀ α, map (Equiv.refl α) = @id (f α) := by rfl /-- `map` is functorial on equivalences. -/ map_trans' : ∀ {α β γ} (k : α ≃ β) (h : β ≃ γ), map (k.trans h) = map h ∘ map k := by rfl attribute [simp] EquivFunctor.map_refl'
class
Control
[ "Mathlib.Logic.Equiv.Defs", "Mathlib.Tactic.Convert" ]
Mathlib/Control/EquivFunctor.lean
EquivFunctor
An `EquivFunctor` is only functorial with respect to equivalences. To construct an `EquivFunctor`, it suffices to supply just the function `f α → f β` from an equivalence `α ≃ β`, and then prove the functor laws. It's then a consequence that this function is part of an equivalence, provided by `EquivFunctor.mapEquiv`.
mapEquiv : f α ≃ f β where toFun := EquivFunctor.map e invFun := EquivFunctor.map e.symm left_inv x := by convert (congr_fun (EquivFunctor.map_trans' e e.symm) x).symm simp right_inv y := by convert (congr_fun (EquivFunctor.map_trans' e.symm e) y).symm simp @[simp]
def
Control
[ "Mathlib.Logic.Equiv.Defs", "Mathlib.Tactic.Convert" ]
Mathlib/Control/EquivFunctor.lean
mapEquiv
An `EquivFunctor` in fact takes every equiv to an equiv.
mapEquiv_apply (x : f α) : mapEquiv f e x = EquivFunctor.map e x := rfl
theorem
Control
[ "Mathlib.Logic.Equiv.Defs", "Mathlib.Tactic.Convert" ]
Mathlib/Control/EquivFunctor.lean
mapEquiv_apply
null
mapEquiv_symm_apply (y : f β) : (mapEquiv f e).symm y = EquivFunctor.map e.symm y := rfl @[simp]
theorem
Control
[ "Mathlib.Logic.Equiv.Defs", "Mathlib.Tactic.Convert" ]
Mathlib/Control/EquivFunctor.lean
mapEquiv_symm_apply
null
mapEquiv_refl (α) : mapEquiv f (Equiv.refl α) = Equiv.refl (f α) := by ext; simp [mapEquiv] @[simp]
theorem
Control
[ "Mathlib.Logic.Equiv.Defs", "Mathlib.Tactic.Convert" ]
Mathlib/Control/EquivFunctor.lean
mapEquiv_refl
null
mapEquiv_symm : (mapEquiv f e).symm = mapEquiv f e.symm := Equiv.ext <| mapEquiv_symm_apply f e
theorem
Control
[ "Mathlib.Logic.Equiv.Defs", "Mathlib.Tactic.Convert" ]
Mathlib/Control/EquivFunctor.lean
mapEquiv_symm
null
@[simp] mapEquiv_trans {γ : Type u₀} (ab : α ≃ β) (bc : β ≃ γ) : (mapEquiv f ab).trans (mapEquiv f bc) = mapEquiv f (ab.trans bc) := Equiv.ext fun x => by simp [mapEquiv, map_trans']
theorem
Control
[ "Mathlib.Logic.Equiv.Defs", "Mathlib.Tactic.Convert" ]
Mathlib/Control/EquivFunctor.lean
mapEquiv_trans
The composition of `mapEquiv`s is carried over the `EquivFunctor`. For plain `Functor`s, this lemma is named `map_map` when applied or `map_comp_map` when not applied.
mapEquiv.injective (f : Type u₀ → Type u₁) [Applicative f] [LawfulApplicative f] {α β : Type u₀} (h : ∀ γ, Function.Injective (pure : γ → f γ)) : Function.Injective (@EquivFunctor.mapEquiv f _ α β) := fun e₁ e₂ H => Equiv.ext fun x => h β (by simpa [EquivFunctor.map] using Equiv.congr_fun H (pure x))
theorem
Control
[ "Mathlib.Logic.Equiv.Defs", "Mathlib.Tactic.Convert" ]
Mathlib/Control/EquivFunctor.lean
mapEquiv.injective
null
Fix (α : Type*) where /-- `fix f` represents the computation of a fixed point for `f`. -/ fix : (α → α) → α
class
Control
[ "Mathlib.Data.Part", "Mathlib.Data.Nat.Find", "Mathlib.Data.Nat.Upto", "Mathlib.Data.Stream.Defs", "Mathlib.Tactic.Common" ]
Mathlib/Control/Fix.lean
Fix
`Fix α` provides a `fix` operator to define recursive computation via the fixed point of function of type `α → α`.
Fix.approx : Stream' (∀ a, Part (β a)) | 0 => ⊥ | Nat.succ i => f (Fix.approx i)
def
Control
[ "Mathlib.Data.Part", "Mathlib.Data.Nat.Find", "Mathlib.Data.Nat.Upto", "Mathlib.Data.Stream.Defs", "Mathlib.Tactic.Common" ]
Mathlib/Control/Fix.lean
Fix.approx
A series of successive, finite approximation of the fixed point of `f`, defined by `approx f n = f^[n] ⊥`. The limit of this chain is the fixed point of `f`.
fixAux {p : ℕ → Prop} (i : Nat.Upto p) (g : ∀ j : Nat.Upto p, i < j → ∀ a, Part (β a)) : ∀ a, Part (β a) := f fun x : α => (assert ¬p i.val) fun h : ¬p i.val => g (i.succ h) (Nat.lt_succ_self _) x
def
Control
[ "Mathlib.Data.Part", "Mathlib.Data.Nat.Find", "Mathlib.Data.Nat.Upto", "Mathlib.Data.Stream.Defs", "Mathlib.Tactic.Common" ]
Mathlib/Control/Fix.lean
fixAux
loop body for finding the fixed point of `f`
protected fix (x : α) : Part (β x) := (Part.assert (∃ i, (Fix.approx f i x).Dom)) fun h => WellFounded.fix.{1} (Nat.Upto.wf h) (fixAux f) Nat.Upto.zero x open Classical in
def
Control
[ "Mathlib.Data.Part", "Mathlib.Data.Nat.Find", "Mathlib.Data.Nat.Upto", "Mathlib.Data.Stream.Defs", "Mathlib.Tactic.Common" ]
Mathlib/Control/Fix.lean
fix
The least fixed point of `f`. If `f` is a continuous function (according to complete partial orders), it satisfies the equations: 1. `fix f = f (fix f)` (is a fixed point) 2. `∀ X, f X ≤ X → fix f ≤ X` (least fixed point)
protected fix_def {x : α} (h' : ∃ i, (Fix.approx f i x).Dom) : Part.fix f x = Fix.approx f (Nat.succ (Nat.find h')) x := by let p := fun i : ℕ => (Fix.approx f i x).Dom have : p (Nat.find h') := Nat.find_spec h' generalize hk : Nat.find h' = k replace hk : Nat.find h' = k + (@Upto.zero p).val := hk rw [hk] at this revert hk dsimp [Part.fix]; rw [assert_pos h']; revert this generalize Upto.zero = z; intro _this hk suffices ∀ x' hwf, WellFounded.fix hwf (fixAux f) z x' = Fix.approx f (succ k) x' from this _ _ induction k generalizing z with | zero => intro x' _ rw [Fix.approx, WellFounded.fix_eq, fixAux] congr ext x : 1 rw [assert_neg] · rfl · rw [Nat.zero_add] at _this simpa only [not_not, Coe] | succ n n_ih => intro x' _ rw [Fix.approx, WellFounded.fix_eq, fixAux] congr ext : 1 have hh : ¬(Fix.approx f z.val x).Dom := by apply Nat.find_min h' omega rw [succ_add_eq_add_succ] at _this hk rw [assert_pos hh, n_ih (Upto.succ z hh) _this hk]
theorem
Control
[ "Mathlib.Data.Part", "Mathlib.Data.Nat.Find", "Mathlib.Data.Nat.Upto", "Mathlib.Data.Stream.Defs", "Mathlib.Tactic.Common" ]
Mathlib/Control/Fix.lean
fix_def
null
fix_def' {x : α} (h' : ¬∃ i, (Fix.approx f i x).Dom) : Part.fix f x = none := by dsimp [Part.fix] rw [assert_neg h']
theorem
Control
[ "Mathlib.Data.Part", "Mathlib.Data.Nat.Find", "Mathlib.Data.Nat.Upto", "Mathlib.Data.Stream.Defs", "Mathlib.Tactic.Common" ]
Mathlib/Control/Fix.lean
fix_def'
null
hasFix : Fix (Part α) := ⟨fun f => Part.fix (fun x u => f (x u)) ()⟩
instance
Control
[ "Mathlib.Data.Part", "Mathlib.Data.Nat.Find", "Mathlib.Data.Nat.Upto", "Mathlib.Data.Stream.Defs", "Mathlib.Tactic.Common" ]
Mathlib/Control/Fix.lean
hasFix
null
Part.hasFix {β} : Fix (α → Part β) := ⟨Part.fix⟩
instance
Control
[ "Mathlib.Data.Part", "Mathlib.Data.Nat.Find", "Mathlib.Data.Nat.Upto", "Mathlib.Data.Stream.Defs", "Mathlib.Tactic.Common" ]
Mathlib/Control/Fix.lean
Part.hasFix
null
foldMap {α ω} [One ω] [Mul ω] (f : α → ω) : t α → ω := ...
def
Control
[ "Mathlib.Algebra.Group.Opposite", "Mathlib.Algebra.FreeMonoid.Basic", "Mathlib.CategoryTheory.Category.KleisliCat", "Mathlib.CategoryTheory.Endomorphism", "Mathlib.CategoryTheory.Types.Basic", "Mathlib.Control.Traversable.Instances", "Mathlib.Control.Traversable.Lemmas", "Mathlib.Tactic.AdaptationNote...
Mathlib/Control/Fold.lean
foldMap
null
foldMap_hom (α β) [Monoid α] [Monoid β] (f : α →* β) (g : γ → α) (x : t γ) : f (foldMap g x) = foldMap (f ∘ g) x := ... ``` `foldMap` uses a monoid ω to accumulate a value for every element of a data structure and `foldMap_hom` uses a monoid homomorphism to substitute the monoid used by `foldMap`. The two are sufficient to define `foldl`, `foldr` and `toList`. `toList` permits the formulation of specifications in terms of operations on lists. Each fold function can be defined using a specialized monoid. `toList` uses a free monoid represented as a list with concatenation while `foldl` uses endofunctions together with function composition. The definition through monoids uses `traverse` together with the applicative functor `const m` (where `m` is the monoid). As an implementation, `const` guarantees that no resource is spent on reconstructing the structure during traversal. A special class could be defined for `foldable`, similarly to Haskell, but the author cannot think of instances of `foldable` that are not also `Traversable`. -/ universe u v open ULift CategoryTheory MulOpposite
lemma
Control
[ "Mathlib.Algebra.Group.Opposite", "Mathlib.Algebra.FreeMonoid.Basic", "Mathlib.CategoryTheory.Category.KleisliCat", "Mathlib.CategoryTheory.Endomorphism", "Mathlib.CategoryTheory.Types.Basic", "Mathlib.Control.Traversable.Instances", "Mathlib.Control.Traversable.Lemmas", "Mathlib.Tactic.AdaptationNote...
Mathlib/Control/Fold.lean
foldMap_hom
null
Foldl (α : Type u) : Type u := (End α)ᵐᵒᵖ
abbrev
Control
[ "Mathlib.Algebra.Group.Opposite", "Mathlib.Algebra.FreeMonoid.Basic", "Mathlib.CategoryTheory.Category.KleisliCat", "Mathlib.CategoryTheory.Endomorphism", "Mathlib.CategoryTheory.Types.Basic", "Mathlib.Control.Traversable.Instances", "Mathlib.Control.Traversable.Lemmas", "Mathlib.Tactic.AdaptationNote...
Mathlib/Control/Fold.lean
Foldl
For a list, foldl f x [y₀,y₁] reduces as follows: ``` calc foldl f x [y₀,y₁] = foldl f (f x y₀) [y₁] : rfl ... = foldl f (f (f x y₀) y₁) [] : rfl ... = f (f x y₀) y₁ : rfl ``` with ``` f : α → β → α x : α [y₀,y₁] : List β ``` We can view the above as a composition of functions: ``` ... = f (f x y₀) y₁ : rfl ... = flip f y₁ (flip f y₀ x) : rfl ... = (flip f y₁ ∘ flip f y₀) x : rfl ``` We can use traverse and const to construct this composition: ``` calc const.run (traverse (fun y ↦ const.mk' (flip f y)) [y₀,y₁]) x = const.run ((::) <$> const.mk' (flip f y₀) <*> traverse (fun y ↦ const.mk' (flip f y)) [y₁]) x ... = const.run ((::) <$> const.mk' (flip f y₀) <*> ( (::) <$> const.mk' (flip f y₁) <*> traverse (fun y ↦ const.mk' (flip f y)) [] )) x ... = const.run ((::) <$> const.mk' (flip f y₀) <*> ( (::) <$> const.mk' (flip f y₁) <*> pure [] )) x ... = const.run ( ((::) <$> const.mk' (flip f y₁) <*> pure []) ∘ ((::) <$> const.mk' (flip f y₀)) ) x ... = const.run ( const.mk' (flip f y₁) ∘ const.mk' (flip f y₀) ) x ... = const.run ( flip f y₁ ∘ flip f y₀ ) x ... = f (f x y₀) y₁ ``` And this is how `const` turns a monoid into an applicative functor and how the monoid of endofunctions define `Foldl`.
Foldl.mk (f : α → α) : Foldl α := op f
def
Control
[ "Mathlib.Algebra.Group.Opposite", "Mathlib.Algebra.FreeMonoid.Basic", "Mathlib.CategoryTheory.Category.KleisliCat", "Mathlib.CategoryTheory.Endomorphism", "Mathlib.CategoryTheory.Types.Basic", "Mathlib.Control.Traversable.Instances", "Mathlib.Control.Traversable.Lemmas", "Mathlib.Tactic.AdaptationNote...
Mathlib/Control/Fold.lean
Foldl.mk
null
Foldl.get (x : Foldl α) : α → α := unop x @[simps]
def
Control
[ "Mathlib.Algebra.Group.Opposite", "Mathlib.Algebra.FreeMonoid.Basic", "Mathlib.CategoryTheory.Category.KleisliCat", "Mathlib.CategoryTheory.Endomorphism", "Mathlib.CategoryTheory.Types.Basic", "Mathlib.Control.Traversable.Instances", "Mathlib.Control.Traversable.Lemmas", "Mathlib.Tactic.AdaptationNote...
Mathlib/Control/Fold.lean
Foldl.get
null
Foldl.ofFreeMonoid (f : β → α → β) : FreeMonoid α →* Monoid.Foldl β where toFun xs := op <| flip (List.foldl f) (FreeMonoid.toList xs) map_one' := rfl map_mul' := by intros simp only [FreeMonoid.toList_mul, List.foldl_append, Function.flip_def] rfl
def
Control
[ "Mathlib.Algebra.Group.Opposite", "Mathlib.Algebra.FreeMonoid.Basic", "Mathlib.CategoryTheory.Category.KleisliCat", "Mathlib.CategoryTheory.Endomorphism", "Mathlib.CategoryTheory.Types.Basic", "Mathlib.Control.Traversable.Instances", "Mathlib.Control.Traversable.Lemmas", "Mathlib.Tactic.AdaptationNote...
Mathlib/Control/Fold.lean
Foldl.ofFreeMonoid
null
Foldr (α : Type u) : Type u := End α
abbrev
Control
[ "Mathlib.Algebra.Group.Opposite", "Mathlib.Algebra.FreeMonoid.Basic", "Mathlib.CategoryTheory.Category.KleisliCat", "Mathlib.CategoryTheory.Endomorphism", "Mathlib.CategoryTheory.Types.Basic", "Mathlib.Control.Traversable.Instances", "Mathlib.Control.Traversable.Lemmas", "Mathlib.Tactic.AdaptationNote...
Mathlib/Control/Fold.lean
Foldr
null
Foldr.mk (f : α → α) : Foldr α := f
def
Control
[ "Mathlib.Algebra.Group.Opposite", "Mathlib.Algebra.FreeMonoid.Basic", "Mathlib.CategoryTheory.Category.KleisliCat", "Mathlib.CategoryTheory.Endomorphism", "Mathlib.CategoryTheory.Types.Basic", "Mathlib.Control.Traversable.Instances", "Mathlib.Control.Traversable.Lemmas", "Mathlib.Tactic.AdaptationNote...
Mathlib/Control/Fold.lean
Foldr.mk
null
Foldr.get (x : Foldr α) : α → α := x @[simps]
def
Control
[ "Mathlib.Algebra.Group.Opposite", "Mathlib.Algebra.FreeMonoid.Basic", "Mathlib.CategoryTheory.Category.KleisliCat", "Mathlib.CategoryTheory.Endomorphism", "Mathlib.CategoryTheory.Types.Basic", "Mathlib.Control.Traversable.Instances", "Mathlib.Control.Traversable.Lemmas", "Mathlib.Tactic.AdaptationNote...
Mathlib/Control/Fold.lean
Foldr.get
null
Foldr.ofFreeMonoid (f : α → β → β) : FreeMonoid α →* Monoid.Foldr β where toFun xs := flip (List.foldr f) (FreeMonoid.toList xs) map_one' := rfl map_mul' _ _ := funext fun _ => List.foldr_append
def
Control
[ "Mathlib.Algebra.Group.Opposite", "Mathlib.Algebra.FreeMonoid.Basic", "Mathlib.CategoryTheory.Category.KleisliCat", "Mathlib.CategoryTheory.Endomorphism", "Mathlib.CategoryTheory.Types.Basic", "Mathlib.Control.Traversable.Instances", "Mathlib.Control.Traversable.Lemmas", "Mathlib.Tactic.AdaptationNote...
Mathlib/Control/Fold.lean
Foldr.ofFreeMonoid
null
foldlM (m : Type u → Type u) [Monad m] (α : Type u) : Type u := MulOpposite <| End <| KleisliCat.mk m α
abbrev
Control
[ "Mathlib.Algebra.Group.Opposite", "Mathlib.Algebra.FreeMonoid.Basic", "Mathlib.CategoryTheory.Category.KleisliCat", "Mathlib.CategoryTheory.Endomorphism", "Mathlib.CategoryTheory.Types.Basic", "Mathlib.Control.Traversable.Instances", "Mathlib.Control.Traversable.Lemmas", "Mathlib.Tactic.AdaptationNote...
Mathlib/Control/Fold.lean
foldlM
null
foldlM.mk (f : α → m α) : foldlM m α := op f
def
Control
[ "Mathlib.Algebra.Group.Opposite", "Mathlib.Algebra.FreeMonoid.Basic", "Mathlib.CategoryTheory.Category.KleisliCat", "Mathlib.CategoryTheory.Endomorphism", "Mathlib.CategoryTheory.Types.Basic", "Mathlib.Control.Traversable.Instances", "Mathlib.Control.Traversable.Lemmas", "Mathlib.Tactic.AdaptationNote...
Mathlib/Control/Fold.lean
foldlM.mk
null
foldlM.get (x : foldlM m α) : α → m α := unop x @[simps]
def
Control
[ "Mathlib.Algebra.Group.Opposite", "Mathlib.Algebra.FreeMonoid.Basic", "Mathlib.CategoryTheory.Category.KleisliCat", "Mathlib.CategoryTheory.Endomorphism", "Mathlib.CategoryTheory.Types.Basic", "Mathlib.Control.Traversable.Instances", "Mathlib.Control.Traversable.Lemmas", "Mathlib.Tactic.AdaptationNote...
Mathlib/Control/Fold.lean
foldlM.get
null
foldlM.ofFreeMonoid [LawfulMonad m] (f : β → α → m β) : FreeMonoid α →* Monoid.foldlM m β where toFun xs := op <| flip (List.foldlM f) (FreeMonoid.toList xs) map_one' := rfl map_mul' := by intros; apply unop_injective; funext; apply List.foldlM_append
def
Control
[ "Mathlib.Algebra.Group.Opposite", "Mathlib.Algebra.FreeMonoid.Basic", "Mathlib.CategoryTheory.Category.KleisliCat", "Mathlib.CategoryTheory.Endomorphism", "Mathlib.CategoryTheory.Types.Basic", "Mathlib.Control.Traversable.Instances", "Mathlib.Control.Traversable.Lemmas", "Mathlib.Tactic.AdaptationNote...
Mathlib/Control/Fold.lean
foldlM.ofFreeMonoid
null