mathlib3 documentation

algebra.free

Free constructions #

THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.

Main definitions #

inductive free_magma (α : Type u) :

Free magma over a given alphabet.

Instances for free_magma
@[protected, instance]
@[protected, instance]
inductive free_add_magma (α : Type u) :

Free nonabelian additive magma over a given alphabet.

Instances for free_add_magma
@[protected, instance]
Equations
@[protected, instance]
def free_magma.has_mul {α : Type u} :
Equations
@[simp]
theorem free_magma.mul_eq {α : Type u} (x y : free_magma α) :
x.mul y = x * y
@[simp]
theorem free_add_magma.add_eq {α : Type u} (x y : free_add_magma α) :
x.add y = x + y
def free_add_magma.rec_on_add {α : Type u} {C : free_add_magma α Sort l} (x : free_add_magma α) (ih1 : Π (x : α), C (free_add_magma.of x)) (ih2 : Π (x y : free_add_magma α), C x C y C (x + y)) :
C x

Recursor for free_add_magma using x + y instead of free_add_magma.add x y.

Equations
def free_magma.rec_on_mul {α : Type u} {C : free_magma α Sort l} (x : free_magma α) (ih1 : Π (x : α), C (free_magma.of x)) (ih2 : Π (x y : free_magma α), C x C y C (x * y)) :
C x

Recursor for free_magma using x * y instead of free_magma.mul x y.

Equations
@[ext]
theorem free_add_magma.hom_ext {α : Type u} {β : Type v} [has_add β] {f g : add_hom (free_add_magma α) β} (h : f free_add_magma.of = g free_add_magma.of) :
f = g
@[ext]
theorem free_magma.hom_ext {α : Type u} {β : Type v} [has_mul β] {f g : free_magma α →ₙ* β} (h : f free_magma.of = g free_magma.of) :
f = g
def free_magma.lift_aux {α : Type u} {β : Type v} [has_mul β] (f : α β) :

Lifts a function α → β to a magma homomorphism free_magma α → β given a magma β.

Equations
def free_add_magma.lift_aux {α : Type u} {β : Type v} [has_add β] (f : α β) :

Lifts a function α → β to an additive magma homomorphism free_add_magma α → β given an additive magma β.

Equations
@[simp]
theorem free_add_magma.lift_symm_apply {α : Type u} {β : Type v} [has_add β] (F : add_hom (free_add_magma α) β) (ᾰ : α) :
@[simp]
theorem free_magma.lift_symm_apply {α : Type u} {β : Type v} [has_mul β] (F : free_magma α →ₙ* β) (ᾰ : α) :
def free_add_magma.lift {α : Type u} {β : Type v} [has_add β] :
β) add_hom (free_add_magma α) β

The universal property of the free additive magma expressing its adjointness.

Equations
def free_magma.lift {α : Type u} {β : Type v} [has_mul β] :
β) (free_magma α →ₙ* β)

The universal property of the free magma expressing its adjointness.

Equations
@[simp]
theorem free_add_magma.lift_of {α : Type u} {β : Type v} [has_add β] (f : α β) (x : α) :
@[simp]
theorem free_magma.lift_of {α : Type u} {β : Type v} [has_mul β] (f : α β) (x : α) :
@[simp]
theorem free_magma.lift_comp_of {α : Type u} {β : Type v} [has_mul β] (f : α β) :
@[simp]
theorem free_add_magma.lift_comp_of {α : Type u} {β : Type v} [has_add β] (f : α β) :
@[simp]
theorem free_magma.lift_comp_of' {α : Type u} {β : Type v} [has_mul β] (f : free_magma α →ₙ* β) :
def free_add_magma.map {α : Type u} {β : Type v} (f : α β) :

The unique additive magma homomorphism free_add_magma α → free_add_magma β that sends each of x to of (f x).

Equations
def free_magma.map {α : Type u} {β : Type v} (f : α β) :

The unique magma homomorphism free_magma α →ₙ* free_magma β that sends each of x to of (f x).

Equations
@[simp]
theorem free_add_magma.map_of {α : Type u} {β : Type v} (f : α β) (x : α) :
@[simp]
theorem free_magma.map_of {α : Type u} {β : Type v} (f : α β) (x : α) :
@[protected, instance]
Equations
@[protected]
def free_add_magma.rec_on_pure {α : Type u} {C : free_add_magma α Sort l} (x : free_add_magma α) (ih1 : Π (x : α), C (has_pure.pure x)) (ih2 : Π (x y : free_add_magma α), C x C y C (x + y)) :
C x

Recursor on free_add_magma using pure instead of of.

Equations
@[protected]
def free_magma.rec_on_pure {α : Type u} {C : free_magma α Sort l} (x : free_magma α) (ih1 : Π (x : α), C (has_pure.pure x)) (ih2 : Π (x y : free_magma α), C x C y C (x * y)) :
C x

Recursor on free_magma using pure instead of of.

Equations
@[simp]
theorem free_magma.map_pure {α β : Type u} (f : α β) (x : α) :
@[simp]
theorem free_add_magma.map_pure {α β : Type u} (f : α β) (x : α) :
@[simp]
theorem free_magma.map_mul' {α β : Type u} (f : α β) (x y : free_magma α) :
f <$> (x * y) = f <$> x * f <$> y
@[simp]
theorem free_add_magma.map_add' {α β : Type u} (f : α β) (x y : free_add_magma α) :
f <$> (x + y) = f <$> x + f <$> y
@[simp]
theorem free_add_magma.pure_bind {α β : Type u} (f : α free_add_magma β) (x : α) :
@[simp]
theorem free_magma.pure_bind {α β : Type u} (f : α free_magma β) (x : α) :
@[simp]
theorem free_add_magma.add_bind {α β : Type u} (f : α free_add_magma β) (x y : free_add_magma α) :
x + y >>= f = (x >>= f) + (y >>= f)
@[simp]
theorem free_magma.mul_bind {α β : Type u} (f : α free_magma β) (x y : free_magma α) :
x * y >>= f = (x >>= f) * (y >>= f)
@[simp]
theorem free_add_magma.pure_seq {α β : Type u} {f : α β} {x : free_add_magma α} :
@[simp]
theorem free_magma.pure_seq {α β : Type u} {f : α β} {x : free_magma α} :
@[simp]
theorem free_add_magma.add_seq {α β : Type u} {f g : free_add_magma β)} {x : free_add_magma α} :
f + g <*> x = (f <*> x) + (g <*> x)
@[simp]
theorem free_magma.mul_seq {α β : Type u} {f g : free_magma β)} {x : free_magma α} :
f * g <*> x = (f <*> x) * (g <*> x)
@[protected]
def free_magma.traverse {m : Type u Type u} [applicative m] {α β : Type u} (F : α m β) :

free_magma is traversable.

Equations
@[simp]
theorem free_magma.traverse_pure {α β : Type u} {m : Type u Type u} [applicative m] (F : α m β) (x : α) :
@[simp]
theorem free_add_magma.traverse_pure {α β : Type u} {m : Type u Type u} [applicative m] (F : α m β) (x : α) :
@[simp]
theorem free_add_magma.traverse_pure' {α β : Type u} {m : Type u Type u} [applicative m] (F : α m β) :
@[simp]
theorem free_magma.traverse_pure' {α β : Type u} {m : Type u Type u} [applicative m] (F : α m β) :
@[simp]
@[simp]
theorem free_magma.traverse_mul {α β : Type u} {m : Type u Type u} [applicative m] (F : α m β) (x y : free_magma α) :
@[simp]
theorem free_magma.traverse_eq {α β : Type u} {m : Type u Type u} [applicative m] (F : α m β) (x : free_magma α) :
@[simp]
theorem free_add_magma.traverse_eq {α β : Type u} {m : Type u Type u} [applicative m] (F : α m β) (x : free_add_magma α) :
@[simp]
theorem free_add_magma.add_map_seq {α : Type u} (x y : free_add_magma α) :
@[simp]
theorem free_magma.mul_map_seq {α : Type u} (x y : free_magma α) :
@[protected, instance]
Equations
@[protected, instance]
Equations
@[protected]
def free_magma.repr {α : Type u} [has_repr α] :

Representation of an element of a free magma.

Equations
@[protected]

Representation of an element of a free additive magma.

Equations
@[protected, instance]
Equations
@[protected, instance]
Equations
@[simp]
def free_magma.length {α : Type u} :

Length of an element of a free magma.

Equations
@[simp]

Length of an element of a free additive magma.

Equations
inductive add_magma.assoc_rel (α : Type u) [has_add α] :
α α Prop

Associativity relations for an additive magma.

inductive magma.assoc_rel (α : Type u) [has_mul α] :
α α Prop

Associativity relations for a magma.

def magma.assoc_quotient (α : Type u) [has_mul α] :

Semigroup quotient of a magma.

Equations
Instances for magma.assoc_quotient

Additive semigroup quotient of an additive magma.

Equations
Instances for add_magma.free_add_semigroup
theorem add_magma.free_add_semigroup.quot_mk_assoc {α : Type u} [has_add α] (x y z : α) :
quot.mk (add_magma.assoc_rel α) (x + y + z) = quot.mk (add_magma.assoc_rel α) (x + (y + z))
theorem magma.assoc_quotient.quot_mk_assoc {α : Type u} [has_mul α] (x y z : α) :
quot.mk (magma.assoc_rel α) (x * y * z) = quot.mk (magma.assoc_rel α) (x * (y * z))
theorem magma.assoc_quotient.quot_mk_assoc_left {α : Type u} [has_mul α] (x y z w : α) :
quot.mk (magma.assoc_rel α) (x * (y * z * w)) = quot.mk (magma.assoc_rel α) (x * (y * (z * w)))
theorem add_magma.free_add_semigroup.quot_mk_assoc_left {α : Type u} [has_add α] (x y z w : α) :
quot.mk (add_magma.assoc_rel α) (x + (y + z + w)) = quot.mk (add_magma.assoc_rel α) (x + (y + (z + w)))
@[protected, instance]
Equations
@[protected, instance]
Equations

Embedding from magma to its free semigroup.

Equations

Embedding from additive magma to its free additive semigroup.

Equations
@[protected]
theorem magma.assoc_quotient.induction_on {α : Type u} [has_mul α] {C : magma.assoc_quotient α Prop} (x : magma.assoc_quotient α) (ih : (x : α), C (magma.assoc_quotient.of x)) :
C x

Lifts an additive magma homomorphism α → β to an additive semigroup homomorphism add_magma.assoc_quotient α → β given an additive semigroup β.

Equations
def magma.assoc_quotient.lift {α : Type u} [has_mul α] {β : Type v} [semigroup β] :

Lifts a magma homomorphism α → β to a semigroup homomorphism magma.assoc_quotient α → β given a semigroup β.

Equations
@[simp]
theorem magma.assoc_quotient.lift_of {α : Type u} [has_mul α] {β : Type v} [semigroup β] (f : α →ₙ* β) (x : α) :

From a magma homomorphism α →ₙ* β to a semigroup homomorphism magma.assoc_quotient α →ₙ* magma.assoc_quotient β.

Equations

From an additive magma homomorphism α → β to an additive semigroup homomorphism add_magma.assoc_quotient α → add_magma.assoc_quotient β.

Equations
theorem free_add_semigroup.ext {α : Type u} (x y : free_add_semigroup α) (h : x.head = y.head) (h_1 : x.tail = y.tail) :
x = y
@[ext]
structure free_add_semigroup (α : Type u) :
  • head : α
  • tail : list α

Free additive semigroup over a given alphabet.

Instances for free_add_semigroup
theorem free_add_semigroup.ext_iff {α : Type u} (x y : free_add_semigroup α) :
x = y x.head = y.head x.tail = y.tail
theorem free_semigroup.ext {α : Type u} (x y : free_semigroup α) (h : x.head = y.head) (h_1 : x.tail = y.tail) :
x = y
@[ext]
structure free_semigroup (α : Type u) :
  • head : α
  • tail : list α

Free semigroup over a given alphabet.

Instances for free_semigroup
theorem free_semigroup.ext_iff {α : Type u} (x y : free_semigroup α) :
x = y x.head = y.head x.tail = y.tail
@[protected, instance]
Equations
@[protected, instance]
Equations
@[simp]
theorem free_semigroup.head_mul {α : Type u} (x y : free_semigroup α) :
(x * y).head = x.head
@[simp]
theorem free_add_semigroup.head_add {α : Type u} (x y : free_add_semigroup α) :
(x + y).head = x.head
@[simp]
theorem free_add_semigroup.tail_add {α : Type u} (x y : free_add_semigroup α) :
(x + y).tail = x.tail ++ y.head :: y.tail
@[simp]
theorem free_semigroup.tail_mul {α : Type u} (x y : free_semigroup α) :
(x * y).tail = x.tail ++ y.head :: y.tail
@[simp]
theorem free_add_semigroup.mk_add_mk {α : Type u} (x y : α) (L1 L2 : list α) :
{head := x, tail := L1} + {head := y, tail := L2} = {head := x, tail := L1 ++ y :: L2}
@[simp]
theorem free_semigroup.mk_mul_mk {α : Type u} (x y : α) (L1 L2 : list α) :
{head := x, tail := L1} * {head := y, tail := L2} = {head := x, tail := L1 ++ y :: L2}
def free_semigroup.of {α : Type u} (x : α) :

The embedding α → free_semigroup α.

Equations
@[simp]
@[simp]
theorem free_add_semigroup.of_head {α : Type u} (x : α) :
@[simp]
theorem free_semigroup.of_head {α : Type u} (x : α) :
def free_add_semigroup.of {α : Type u} (x : α) :

The embedding α → free_add_semigroup α.

Equations
@[simp]
theorem free_semigroup.of_tail {α : Type u} (x : α) :
def free_semigroup.length {α : Type u} (x : free_semigroup α) :

Length of an element of free semigroup.

Equations

Length of an element of free additive semigroup

Equations
@[simp]
theorem free_semigroup.length_mul {α : Type u} (x y : free_semigroup α) :
(x * y).length = x.length + y.length
@[simp]
theorem free_add_semigroup.length_add {α : Type u} (x y : free_add_semigroup α) :
(x + y).length = x.length + y.length
@[simp]
theorem free_semigroup.length_of {α : Type u} (x : α) :
@[simp]
theorem free_add_semigroup.length_of {α : Type u} (x : α) :
@[protected]
def free_add_semigroup.rec_on_add {α : Type u} {C : free_add_semigroup α Sort l} (x : free_add_semigroup α) (ih1 : Π (x : α), C (free_add_semigroup.of x)) (ih2 : Π (x : α) (y : free_add_semigroup α), C (free_add_semigroup.of x) C y C (free_add_semigroup.of x + y)) :
C x

Recursor for free additive semigroup using of and +.

Equations
  • x.rec_on_add ih1 ih2 = x.rec_on (λ (f : α) (s : list α), s.rec_on ih1 (λ (hd : α) (tl : list α) (ih : Π (_a : α), C {head := _a, tail := tl}) (f : α), ih2 f {head := hd, tail := tl} (ih1 f) (ih hd)) f)
@[protected]
def free_semigroup.rec_on_mul {α : Type u} {C : free_semigroup α Sort l} (x : free_semigroup α) (ih1 : Π (x : α), C (free_semigroup.of x)) (ih2 : Π (x : α) (y : free_semigroup α), C (free_semigroup.of x) C y C (free_semigroup.of x * y)) :
C x

Recursor for free semigroup using of and *.

Equations
  • x.rec_on_mul ih1 ih2 = x.rec_on (λ (f : α) (s : list α), s.rec_on ih1 (λ (hd : α) (tl : list α) (ih : Π (_a : α), C {head := _a, tail := tl}) (f : α), ih2 f {head := hd, tail := tl} (ih1 f) (ih hd)) f)
@[ext]
theorem free_semigroup.hom_ext {α : Type u} {β : Type v} [has_mul β] {f g : free_semigroup α →ₙ* β} (h : f free_semigroup.of = g free_semigroup.of) :
f = g
@[simp]
theorem free_semigroup.lift_symm_apply {α : Type u} {β : Type v} [semigroup β] (f : free_semigroup α →ₙ* β) (ᾰ : α) :
@[simp]
def free_semigroup.lift {α : Type u} {β : Type v} [semigroup β] :
β) (free_semigroup α →ₙ* β)

Lifts a function α → β to a semigroup homomorphism free_semigroup α → β given a semigroup β.

Equations
def free_add_semigroup.lift {α : Type u} {β : Type v} [add_semigroup β] :

Lifts a function α → β to an additive semigroup homomorphism free_add_semigroup α → β given an additive semigroup β.

Equations
@[simp]
theorem free_semigroup.lift_of {α : Type u} {β : Type v} [semigroup β] (f : α β) (x : α) :
@[simp]
theorem free_add_semigroup.lift_of {α : Type u} {β : Type v} [add_semigroup β] (f : α β) (x : α) :
@[simp]
theorem free_semigroup.lift_comp_of {α : Type u} {β : Type v} [semigroup β] (f : α β) :
theorem free_semigroup.lift_of_mul {α : Type u} {β : Type v} [semigroup β] (f : α β) (x : α) (y : free_semigroup α) :
def free_semigroup.map {α : Type u} {β : Type v} (f : α β) :

The unique semigroup homomorphism that sends of x to of (f x).

Equations
def free_add_semigroup.map {α : Type u} {β : Type v} (f : α β) :

The unique additive semigroup homomorphism that sends of x to of (f x).

Equations
@[simp]
theorem free_add_semigroup.map_of {α : Type u} {β : Type v} (f : α β) (x : α) :
@[simp]
theorem free_semigroup.map_of {α : Type u} {β : Type v} (f : α β) (x : α) :
@[simp]
theorem free_semigroup.length_map {α : Type u} {β : Type v} (f : α β) (x : free_semigroup α) :
@[simp]
theorem free_add_semigroup.length_map {α : Type u} {β : Type v} (f : α β) (x : free_add_semigroup α) :
def free_semigroup.rec_on_pure {α : Type u} {C : free_semigroup α Sort l} (x : free_semigroup α) (ih1 : Π (x : α), C (has_pure.pure x)) (ih2 : Π (x : α) (y : free_semigroup α), C (has_pure.pure x) C y C (has_pure.pure x * y)) :
C x

Recursor that uses pure instead of of.

Equations
def free_add_semigroup.rec_on_pure {α : Type u} {C : free_add_semigroup α Sort l} (x : free_add_semigroup α) (ih1 : Π (x : α), C (has_pure.pure x)) (ih2 : Π (x : α) (y : free_add_semigroup α), C (has_pure.pure x) C y C (has_pure.pure x + y)) :
C x

Recursor that uses pure instead of of.

Equations
@[simp]
theorem free_semigroup.map_pure {α β : Type u} (f : α β) (x : α) :
@[simp]
theorem free_add_semigroup.map_pure {α β : Type u} (f : α β) (x : α) :
@[simp]
theorem free_add_semigroup.map_add' {α β : Type u} (f : α β) (x y : free_add_semigroup α) :
f <$> (x + y) = f <$> x + f <$> y
@[simp]
theorem free_semigroup.map_mul' {α β : Type u} (f : α β) (x y : free_semigroup α) :
f <$> (x * y) = f <$> x * f <$> y
@[simp]
theorem free_add_semigroup.pure_bind {α β : Type u} (f : α free_add_semigroup β) (x : α) :
@[simp]
theorem free_semigroup.pure_bind {α β : Type u} (f : α free_semigroup β) (x : α) :
@[simp]
theorem free_add_semigroup.add_bind {α β : Type u} (f : α free_add_semigroup β) (x y : free_add_semigroup α) :
x + y >>= f = (x >>= f) + (y >>= f)
@[simp]
theorem free_semigroup.mul_bind {α β : Type u} (f : α free_semigroup β) (x y : free_semigroup α) :
x * y >>= f = (x >>= f) * (y >>= f)
@[simp]
theorem free_add_semigroup.pure_seq {α β : Type u} {f : α β} {x : free_add_semigroup α} :
@[simp]
theorem free_semigroup.pure_seq {α β : Type u} {f : α β} {x : free_semigroup α} :
@[simp]
theorem free_semigroup.mul_seq {α β : Type u} {f g : free_semigroup β)} {x : free_semigroup α} :
f * g <*> x = (f <*> x) * (g <*> x)
@[simp]
theorem free_add_semigroup.add_seq {α β : Type u} {f g : free_add_semigroup β)} {x : free_add_semigroup α} :
f + g <*> x = (f <*> x) + (g <*> x)
@[protected]
def free_add_semigroup.traverse {m : Type u Type u} [applicative m] {α β : Type u} (F : α m β) (x : free_add_semigroup α) :

free_add_semigroup is traversable.

Equations
@[protected]
def free_semigroup.traverse {m : Type u Type u} [applicative m] {α β : Type u} (F : α m β) (x : free_semigroup α) :

free_semigroup is traversable.

Equations
@[simp]
theorem free_add_semigroup.traverse_pure {α β : Type u} {m : Type u Type u} [applicative m] (F : α m β) (x : α) :
@[simp]
theorem free_semigroup.traverse_pure {α β : Type u} {m : Type u Type u} [applicative m] (F : α m β) (x : α) :
@[simp]
theorem free_add_semigroup.traverse_pure' {α β : Type u} {m : Type u Type u} [applicative m] (F : α m β) :
@[simp]
theorem free_semigroup.traverse_pure' {α β : Type u} {m : Type u Type u} [applicative m] (F : α m β) :
@[simp]
theorem free_semigroup.traverse_eq {α β : Type u} {m : Type u Type u} [applicative m] (F : α m β) (x : free_semigroup α) :
@[simp]
@[simp]
theorem free_add_semigroup.add_map_seq {α : Type u} (x y : free_add_semigroup α) :
@[simp]
theorem free_semigroup.mul_map_seq {α : Type u} (x y : free_semigroup α) :
@[protected, instance]
Equations
@[protected, instance]
Equations
@[protected, instance]
Equations