Built with doc-gen4, running Lean4. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑Ctrl+↓to navigate, Ctrl+🖱️to focus. On Mac, use Cmdinstead of Ctrl.
/-
Copyright (c) 2019 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau

! This file was ported from Lean 3 source module algebra.free
! leanprover-community/mathlib commit 6d0adfa76594f304b4650d098273d4366edeb61b
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathlib.Algebra.Hom.Group
import Mathlib.Algebra.Hom.Equiv.Basic
import Mathlib.Control.Applicative
import Mathlib.Control.Traversable.Basic
import Mathlib.Logic.Equiv.Defs
import Mathlib.Data.List.Basic

/-!
# Free constructions

## Main definitions

* `FreeMagma α`: free magma (structure with binary operation without any axioms) over alphabet `α`,
  defined inductively, with traversable instance and decidable equality.
* `MagmaAssocQuotient α`: quotient of a magma `α` by the associativity equivalence relation.
* `FreeSemigroup α`: free semigroup over alphabet `α`, defined as a structure with two fields
  `head : α` and `tail : List α` (i.e. nonempty lists), with traversable instance and decidable
  equality.
* `FreeMagmaAssocQuotientEquiv α`: isomorphism between `MagmaAssocQuotient (FreeMagma α)` and
  `FreeSemigroup α`.
* `FreeMagma.lift`: the universal property of the free magma, expressing its adjointness.
-/

universe u v l

/-- Free nonabelian additive magma over a given alphabet. -/
inductive 
FreeAddMagma: Type u → Type u
FreeAddMagma
(
α: Type u
α
:
Type u: Type (u+1)
Type u
) :
Type u: Type (u+1)
Type u
|
of: {α : Type u} → αFreeAddMagma α
of
:
α: Type u
α
FreeAddMagma: Type u → Type u
FreeAddMagma
α: Type u
α
|
add: {α : Type u} → FreeAddMagma αFreeAddMagma αFreeAddMagma α
add
:
FreeAddMagma: Type u → Type u
FreeAddMagma
α: Type u
α
FreeAddMagma: Type u → Type u
FreeAddMagma
α: Type u
α
FreeAddMagma: Type u → Type u
FreeAddMagma
α: Type u
α
deriving
DecidableEq: Sort u → Sort (max1u)
DecidableEq
#align free_add_magma
FreeAddMagma: Type u → Type u
FreeAddMagma
compile_inductive%
FreeAddMagma: Type u → Type u
FreeAddMagma
/-- Free magma over a given alphabet. -/ @[
to_additive: Type u → Type u
to_additive
] inductive
FreeMagma: Type u → Type u
FreeMagma
(
α: Type u
α
:
Type u: Type (u+1)
Type u
) :
Type u: Type (u+1)
Type u
|
of: {α : Type u} → αFreeMagma α
of
:
α: Type u
α
FreeMagma: Type u → Type u
FreeMagma
α: Type u
α
|
mul: {α : Type u} → FreeMagma αFreeMagma αFreeMagma α
mul
:
FreeMagma: Type u → Type u
FreeMagma
α: Type u
α
FreeMagma: Type u → Type u
FreeMagma
α: Type u
α
FreeMagma: Type u → Type u
FreeMagma
α: Type u
α
deriving
DecidableEq: Sort u → Sort (max1u)
DecidableEq
#align free_magma
FreeMagma: Type u → Type u
FreeMagma
compile_inductive%
FreeMagma: Type u → Type u
FreeMagma
namespace FreeMagma variable {
α: Type u
α
:
Type u: Type (u+1)
Type u
} @[
to_additive: {α : Type u} → [inst : Inhabited α] → Inhabited (FreeAddMagma α)
to_additive
]
instance: {α : Type u} → [inst : Inhabited α] → Inhabited (FreeMagma α)
instance
[
Inhabited: Sort ?u.5896 → Sort (max1?u.5896)
Inhabited
α: Type u
α
] :
Inhabited: Sort ?u.5899 → Sort (max1?u.5899)
Inhabited
(
FreeMagma: Type ?u.5900 → Type ?u.5900
FreeMagma
α: Type u
α
) := ⟨
of: {α : Type ?u.5908} → αFreeMagma α
of
default: {α : Sort ?u.5911} → [self : Inhabited α] → α
default
⟩ @[
to_additive: {α : Type u} → Add (FreeAddMagma α)
to_additive
]
instance: {α : Type u} → Mul (FreeMagma α)
instance
:
Mul: Type ?u.6138 → Type ?u.6138
Mul
(
FreeMagma: Type ?u.6139 → Type ?u.6139
FreeMagma
α: Type u
α
) := ⟨
FreeMagma.mul: {α : Type ?u.6146} → FreeMagma αFreeMagma αFreeMagma α
FreeMagma.mul
⟩ -- Porting note: invalid attribute 'match_pattern', declaration is in an imported module -- attribute [match_pattern] Mul.mul @[
to_additive: ∀ {α : Type u} (x y : FreeAddMagma α), FreeAddMagma.add x y = x + y
to_additive
(attr := simp)] theorem
mul_eq: ∀ {α : Type u} (x y : FreeMagma α), mul x y = x * y
mul_eq
(
x: FreeMagma α
x
y: FreeMagma α
y
:
FreeMagma: Type ?u.6251 → Type ?u.6251
FreeMagma
α: Type u
α
) :
mul: {α : Type ?u.6255} → FreeMagma αFreeMagma αFreeMagma α
mul
x: FreeMagma α
x
y: FreeMagma α
y
=
x: FreeMagma α
x
*
y: FreeMagma α
y
:=
rfl: ∀ {α : Sort ?u.6316} {a : α}, a = a
rfl
#align free_magma.mul_eq
FreeMagma.mul_eq: ∀ {α : Type u} (x y : FreeMagma α), mul x y = x * y
FreeMagma.mul_eq
/- Porting note: these lemmas are autogenerated by the inductive definition and due to the existence of mul_eq not in simp normal form -/ attribute [nolint simpNF]
FreeAddMagma.add.sizeOf_spec: ∀ {α : Type u} [inst : SizeOf α] (a a_1 : FreeAddMagma α), sizeOf (FreeAddMagma.add a a_1) = 1 + sizeOf a + sizeOf a_1
FreeAddMagma.add.sizeOf_spec
attribute [nolint simpNF]
FreeMagma.mul.sizeOf_spec: ∀ {α : Type u} [inst : SizeOf α] (a a_1 : FreeMagma α), sizeOf (mul a a_1) = 1 + sizeOf a + sizeOf a_1
FreeMagma.mul.sizeOf_spec
attribute [nolint simpNF]
FreeAddMagma.add.injEq: ∀ {α : Type u} (a a_1 a_2 a_3 : FreeAddMagma α), (FreeAddMagma.add a a_1 = FreeAddMagma.add a_2 a_3) = (a = a_2 a_1 = a_3)
FreeAddMagma.add.injEq
attribute [nolint simpNF]
FreeMagma.mul.injEq: ∀ {α : Type u} (a a_1 a_2 a_3 : FreeMagma α), (mul a a_1 = mul a_2 a_3) = (a = a_2 a_1 = a_3)
FreeMagma.mul.injEq
/-- Recursor for `FreeMagma` using `x * y` instead of `FreeMagma.mul x y`. -/ @[
to_additive: {α : Type u} → {C : FreeAddMagma αSort l} → (x : FreeAddMagma α) → ((x : α) → C (FreeAddMagma.of x)) → ((x y : FreeAddMagma α) → C xC yC (x + y)) → C x
to_additive
(attr := elab_as_elim) "Recursor for `FreeAddMagma` using `x + y` instead of `FreeAddMagma.add x y`."] def
recOnMul: {α : Type u} → {C : FreeMagma αSort l} → (x : FreeMagma α) → ((x : α) → C (of x)) → ((x y : FreeMagma α) → C xC yC (x * y)) → C x
recOnMul
{
C: FreeMagma αSort l
C
:
FreeMagma: Type ?u.6359 → Type ?u.6359
FreeMagma
α: Type u
α
Sort l: Type l
Sort
Sort l: Type l
l
} (
x: FreeMagma α
x
) (
ih1: (x : α) → C (of x)
ih1
: ∀
x: ?m.6367
x
,
C: FreeMagma αSort l
C
(
of: {α : Type ?u.6370} → αFreeMagma α
of
x: ?m.6367
x
)) (
ih2: (x y : FreeMagma α) → C xC yC (x * y)
ih2
: ∀
x: ?m.6376
x
y: ?m.6379
y
,
C: FreeMagma αSort l
C
x: ?m.6376
x
C: FreeMagma αSort l
C
y: ?m.6379
y
C: FreeMagma αSort l
C
(
x: ?m.6376
x
*
y: ?m.6379
y
)) :
C: FreeMagma αSort l
C
x: ?m.6363
x
:=
FreeMagma.recOn: {α : Type ?u.6446} → {motive : FreeMagma αSort ?u.6447} → (t : FreeMagma α) → ((a : α) → motive (of a)) → ((a a_1 : FreeMagma α) → motive amotive a_1motive (mul a a_1)) → motive t
FreeMagma.recOn
x: FreeMagma α
x
ih1: (x : α) → C (of x)
ih1
ih2: (x y : FreeMagma α) → C xC yC (x * y)
ih2
#align free_magma.rec_on_mul
FreeMagma.recOnMul: {α : Type u} → {C : FreeMagma αSort l} → (x : FreeMagma α) → ((x : α) → C (of x)) → ((x y : FreeMagma α) → C xC yC (x * y)) → C x
FreeMagma.recOnMul
@[
to_additive: ∀ {α : Type u} {β : Type v} [inst : Add β] {f g : AddHom (FreeAddMagma α) β}, f FreeAddMagma.of = g FreeAddMagma.off = g
to_additive
(attr := ext 1100)] theorem
hom_ext: ∀ {α : Type u} {β : Type v} [inst : Mul β] {f g : FreeMagma α →ₙ* β}, f of = g off = g
hom_ext
{
β: Type v
β
:
Type v: Type (v+1)
Type v
} [
Mul: Type ?u.6836 → Type ?u.6836
Mul
β: Type v
β
] {f g :
FreeMagma: Type ?u.6871 → Type ?u.6871
FreeMagma
α: Type u
α
→ₙ*
β: Type v
β
} (
h: f of = g of
h
: f
of: {α : Type ?u.7108} → αFreeMagma α
of
= g
of: {α : Type ?u.7319} → αFreeMagma α
of
) : f = g := (
FunLike.ext: ∀ {F : Sort ?u.7339} {α : Sort ?u.7340} {β : αSort ?u.7338} [i : FunLike F α β] (f g : F), (∀ (x : α), f x = g x) → f = g
FunLike.ext
_: ?m.7341
_
_: ?m.7341
_
) fun
x: ?m.7382
x
recOnMul: ∀ {α : Type ?u.7385} {C : FreeMagma αSort ?u.7384} (x : FreeMagma α), (∀ (x : α), C (of x)) → (∀ (x y : FreeMagma α), C xC yC (x * y)) → C x
recOnMul
x: ?m.7382
x
(
congr_fun: ∀ {α : Sort ?u.7629} {β : αSort ?u.7628} {f g : (x : α) → β x}, f = g∀ (a : α), f a = g a
congr_fun
h: f of = g of
h
) <|

Goals accomplished! 🐙
α: Type u

β: Type v

inst✝: Mul β

f, g: FreeMagma α →ₙ* β

h: f of = g of

x: FreeMagma α


∀ (x y : FreeMagma α), f x = g xf y = g yf (x * y) = g (x * y)
α: Type u

β: Type v

inst✝: Mul β

f, g: FreeMagma α →ₙ* β

h: f of = g of

x, x✝, y✝: FreeMagma α

a✝¹: f x✝ = g x✝

a✝: f y✝ = g y✝


f (x✝ * y✝) = g (x✝ * y✝)
α: Type u

β: Type v

inst✝: Mul β

f, g: FreeMagma α →ₙ* β

h: f of = g of

x: FreeMagma α


∀ (x y : FreeMagma α), f x = g xf y = g yf (x * y) = g (x * y)
α: Type u

β: Type v

inst✝: Mul β

f, g: FreeMagma α →ₙ* β

h: f of = g of

x, x✝, y✝: FreeMagma α

a✝¹: f x✝ = g x✝

a✝: f y✝ = g y✝


f (x✝ * y✝) = g (x✝ * y✝)
α: Type u

β: Type v

inst✝: Mul β

f, g: FreeMagma α →ₙ* β

h: f of = g of

x: FreeMagma α


∀ (x y : FreeMagma α), f x = g xf y = g yf (x * y) = g (x * y)

Goals accomplished! 🐙
#align free_magma.hom_ext
FreeMagma.hom_ext: ∀ {α : Type u} {β : Type v} [inst : Mul β] {f g : FreeMagma α →ₙ* β}, f of = g off = g
FreeMagma.hom_ext
end FreeMagma /-- Lifts a function `α → β` to a magma homomorphism `FreeMagma α → β` given a magma `β`. -/ def
FreeMagma.liftAux: {α : Type u} → {β : Type v} → [inst : Mul β] → (αβ) → FreeMagma αβ
FreeMagma.liftAux
{
α: Type u
α
:
Type u: Type (u+1)
Type u
} {
β: Type v
β
:
Type v: Type (v+1)
Type v
} [
Mul: Type ?u.8132 → Type ?u.8132
Mul
β: Type v
β
] (
f: αβ
f
:
α: Type u
α
β: Type v
β
) :
FreeMagma: Type ?u.8140 → Type ?u.8140
FreeMagma
α: Type u
α
β: Type v
β
|
FreeMagma.of: {α : Type ?u.8150} → αFreeMagma α
FreeMagma.of
x: α
x
=>
f: αβ
f
x: α
x
|
x: FreeMagma α
x
*
y: FreeMagma α
y
=>
liftAux: {α : Type u} → {β : Type v} → [inst : Mul β] → (αβ) → FreeMagma αβ
liftAux
f: αβ
f
x: FreeMagma α
x
*
liftAux: {α : Type u} → {β : Type v} → [inst : Mul β] → (αβ) → FreeMagma αβ
liftAux
f: αβ
f
y: FreeMagma α
y
#align free_magma.lift_aux
FreeMagma.liftAux: {α : Type u} → {β : Type v} → [inst : Mul β] → (αβ) → FreeMagma αβ
FreeMagma.liftAux
/-- Lifts a function `α → β` to an additive magma homomorphism `FreeAddMagma α → β` given an additive magma `β`. -/ def
FreeAddMagma.liftAux: {α : Type u} → {β : Type v} → [inst : Add β] → (αβ) → FreeAddMagma αβ
FreeAddMagma.liftAux
{
α: Type u
α
:
Type u: Type (u+1)
Type u
} {
β: Type v
β
:
Type v: Type (v+1)
Type v
} [
Add: Type ?u.8696 → Type ?u.8696
Add
β: Type v
β
] (
f: αβ
f
:
α: Type u
α
β: Type v
β
) :
FreeAddMagma: Type ?u.8704 → Type ?u.8704
FreeAddMagma
α: Type u
α
β: Type v
β
|
FreeAddMagma.of: {α : Type ?u.8714} → αFreeAddMagma α
FreeAddMagma.of
x: α
x
=>
f: αβ
f
x: α
x
| x + y =>
liftAux: {α : Type u} → {β : Type v} → [inst : Add β] → (αβ) → FreeAddMagma αβ
liftAux
f: αβ
f
x +
liftAux: {α : Type u} → {β : Type v} → [inst : Add β] → (αβ) → FreeAddMagma αβ
liftAux
f: αβ
f
y #align free_add_magma.lift_aux
FreeAddMagma.liftAux: {α : Type u} → {β : Type v} → [inst : Add β] → (αβ) → FreeAddMagma αβ
FreeAddMagma.liftAux
attribute [
to_additive: {α : Type u} → {β : Type v} → [inst : Add β] → (αβ) → FreeAddMagma αβ
to_additive
existing]
FreeMagma.liftAux: {α : Type u} → {β : Type v} → [inst : Mul β] → (αβ) → FreeMagma αβ
FreeMagma.liftAux
namespace FreeMagma section lift variable {
α: Type u
α
:
Type u: Type (u+1)
Type u
} {
β: Type v
β
:
Type v: Type (v+1)
Type v
} [
Mul: Type ?u.10757 → Type ?u.10757
Mul
β: Type v
β
] (
f: αβ
f
:
α: Type u
α
β: Type v
β
) /-- The universal property of the free magma expressing its adjointness. -/ @[
to_additive: {α : Type u} → {β : Type v} → [inst : Add β] → (αβ) AddHom (FreeAddMagma α) β
to_additive
(attr := simps
symm_apply: ∀ {α : Type u} {β : Type v} [inst : Add β] (F : AddHom (FreeAddMagma α) β) (a : α), FreeAddMagma.lift.symm F a = (F FreeAddMagma.of) a
symm_apply
) "The universal property of the free additive magma expressing its adjointness."] def
lift: (αβ) (FreeMagma α →ₙ* β)
lift
: (
α: Type u
α
β: Type v
β
) ≃ (
FreeMagma: Type ?u.9899 → Type ?u.9899
FreeMagma
α: Type u
α
→ₙ*
β: Type v
β
) where toFun
f: ?m.9933
f
:= { toFun :=
liftAux: {α : Type ?u.9946} → {β : Type ?u.9945} → [inst : Mul β] → (αβ) → FreeMagma αβ
liftAux
f: ?m.9933
f
map_mul' := fun
x: ?m.9984
x
y: ?m.9987
y
rfl: ∀ {α : Sort ?u.9989} {a : α}, a = a
rfl
} invFun
F: ?m.10013
F
:=
F: ?m.10013
F
of: {α : Type ?u.10244} → αFreeMagma α
of
left_inv
f: ?m.10255
f
:=

Goals accomplished! 🐙
α: Type u

β: Type v

inst✝: Mul β

f✝, f: αβ


(fun F => F of) ((fun f => { toFun := liftAux f, map_mul' := (_ : ∀ (x y : FreeMagma α), liftAux f (x * y) = liftAux f (x * y)) }) f) = f

Goals accomplished! 🐙
-- Porting note: replaced ext by FreeMagma.hom_ext right_inv
F: ?m.10261
F
:=
FreeMagma.hom_ext: ∀ {α : Type ?u.10264} {β : Type ?u.10263} [inst : Mul β] {f g : FreeMagma α →ₙ* β}, f of = g off = g
FreeMagma.hom_ext
(
rfl: ∀ {α : Sort ?u.10304} {a : α}, a = a
rfl
) #align free_magma.lift
FreeMagma.lift: {α : Type u} → {β : Type v} → [inst : Mul β] → (αβ) (FreeMagma α →ₙ* β)
FreeMagma.lift
@[
to_additive: ∀ {α : Type u} {β : Type v} [inst : Add β] (f : αβ) (x : α), ↑(FreeAddMagma.lift f) (FreeAddMagma.of x) = f x
to_additive
(attr := simp)] theorem
lift_of: ∀ (x : α), ↑(lift f) (of x) = f x
lift_of
(
x: ?m.10764
x
) :
lift: {α : Type ?u.10769} → {β : Type ?u.10768} → [inst : Mul β] → (αβ) (FreeMagma α →ₙ* β)
lift
f: αβ
f
(
of: {α : Type ?u.11140} → αFreeMagma α
of
x: ?m.10764
x
) =
f: αβ
f
x: ?m.10764
x
:=
rfl: ∀ {α : Sort ?u.11146} {a : α}, a = a
rfl
#align free_magma.lift_of
FreeMagma.lift_of: ∀ {α : Type u} {β : Type v} [inst : Mul β] (f : αβ) (x : α), ↑(lift f) (of x) = f x
FreeMagma.lift_of
@[
to_additive: ∀ {α : Type u} {β : Type v} [inst : Add β] (f : αβ), ↑(FreeAddMagma.lift f) FreeAddMagma.of = f
to_additive
(attr := simp)] theorem
lift_comp_of: ↑(lift f) of = f
lift_comp_of
:
lift: {α : Type ?u.11301} → {β : Type ?u.11300} → [inst : Mul β] → (αβ) (FreeMagma α →ₙ* β)
lift
f: αβ
f
of: {α : Type ?u.11674} → αFreeMagma α
of
=
f: αβ
f
:=
rfl: ∀ {α : Sort ?u.11685} {a : α}, a = a
rfl
#align free_magma.lift_comp_of
FreeMagma.lift_comp_of: ∀ {α : Type u} {β : Type v} [inst : Mul β] (f : αβ), ↑(lift f) of = f
FreeMagma.lift_comp_of
@[
to_additive: ∀ {α : Type u} {β : Type v} [inst : Add β] (f : AddHom (FreeAddMagma α) β), FreeAddMagma.lift (f FreeAddMagma.of) = f
to_additive
(attr := simp)] theorem
lift_comp_of': ∀ {α : Type u} {β : Type v} [inst : Mul β] (f : FreeMagma α →ₙ* β), lift (f of) = f
lift_comp_of'
(f :
FreeMagma: Type ?u.11841 → Type ?u.11841
FreeMagma
α: Type u
α
→ₙ*
β: Type v
β
) :
lift: {α : Type ?u.11871} → {β : Type ?u.11870} → [inst : Mul β] → (αβ) (FreeMagma α →ₙ* β)
lift
(f
of: {α : Type ?u.12228} → αFreeMagma α
of
) = f :=
lift: {α : Type ?u.12242} → {β : Type ?u.12241} → [inst : Mul β] → (αβ) (FreeMagma α →ₙ* β)
lift
.
apply_symm_apply: ∀ {α : Sort ?u.12271} {β : Sort ?u.12270} (e : α β) (x : β), e (e.symm x) = x
apply_symm_apply
f #align free_magma.lift_comp_of'
FreeMagma.lift_comp_of': ∀ {α : Type u} {β : Type v} [inst : Mul β] (f : FreeMagma α →ₙ* β), lift (f of) = f
FreeMagma.lift_comp_of'
end lift section Map variable {
α: Type u
α
:
Type u: Type (u+1)
Type u
} {
β: Type v
β
:
Type v: Type (v+1)
Type v
} (
f: αβ
f
:
α: Type u
α
β: Type v
β
) /-- The unique magma homomorphism `FreeMagma α →ₙ* FreeMagma β` that sends each `of x` to `of (f x)`. -/ @[
to_additive: {α : Type u} → {β : Type v} → (αβ) → AddHom (FreeAddMagma α) (FreeAddMagma β)
to_additive
"The unique additive magma homomorphism `FreeAddMagma α → FreeAddMagma β` that sends each `of x` to `of (f x)`."] def
map: {α : Type u} → {β : Type v} → (αβ) → FreeMagma α →ₙ* FreeMagma β
map
(
f: αβ
f
:
α: Type u
α
β: Type v
β
) :
FreeMagma: Type ?u.12444 → Type ?u.12444
FreeMagma
α: Type u
α
→ₙ*
FreeMagma: Type ?u.12445 → Type ?u.12445
FreeMagma
β: Type v
β
:=
lift: {α : Type ?u.12477} → {β : Type ?u.12476} → [inst : Mul β] → (αβ) (FreeMagma α →ₙ* β)
lift
(
of: {α : Type ?u.12610} → αFreeMagma α
of
f: αβ
f
) #align free_magma.map
FreeMagma.map: {α : Type u} → {β : Type v} → (αβ) → FreeMagma α →ₙ* FreeMagma β
FreeMagma.map
@[
to_additive: ∀ {α : Type u} {β : Type v} (f : αβ) (x : α), ↑(FreeAddMagma.map f) (FreeAddMagma.of x) = FreeAddMagma.of (f x)
to_additive
(attr := simp)] theorem
map_of: ∀ {α : Type u} {β : Type v} (f : αβ) (x : α), ↑(map f) (of x) = of (f x)
map_of
(
x: α
x
) :
map: {α : Type ?u.12995} → {β : Type ?u.12994} → (αβ) → FreeMagma α →ₙ* FreeMagma β
map
f: αβ
f
(
of: {α : Type ?u.13225} → αFreeMagma α
of
x: ?m.12990
x
) =
of: {α : Type ?u.13228} → αFreeMagma α
of
(
f: αβ
f
x: ?m.12990
x
) :=
rfl: ∀ {α : Sort ?u.13234} {a : α}, a = a
rfl
#align free_magma.map_of
FreeMagma.map_of: ∀ {α : Type u} {β : Type v} (f : αβ) (x : α), ↑(map f) (of x) = of (f x)
FreeMagma.map_of
end Map section Category variable {
α: Type u
α
β: Type u
β
:
Type u: Type (u+1)
Type u
} @[
to_additive: Monad FreeAddMagma
to_additive
]
instance: Monad FreeMagma
instance
:
Monad: (Type ?u.13345 → Type ?u.13344) → Type (max(?u.13345+1)?u.13344)
Monad
FreeMagma: Type ?u.13346 → Type ?u.13346
FreeMagma
where pure :=
of: {α : Type ?u.13402} → αFreeMagma α
of
bind
x: ?m.13495
x
f: ?m.13498
f
:=
lift: {α : Type ?u.13502} → {β : Type ?u.13501} → [inst : Mul β] → (αβ) (FreeMagma α →ₙ* β)
lift
f: ?m.13498
f
x: ?m.13495
x
/-- Recursor on `FreeMagma` using `pure` instead of `of`. -/ @[
to_additive: {α : Type u} → {C : FreeAddMagma αSort l} → (x : FreeAddMagma α) → ((x : α) → C (pure x)) → ((x y : FreeAddMagma α) → C xC yC (x + y)) → C x
to_additive
(attr := elab_as_elim) "Recursor on `FreeAddMagma` using `pure` instead of `of`."] protected def
recOnPure: {α : Type u} → {C : FreeMagma αSort l} → (x : FreeMagma α) → ((x : α) → C (pure x)) → ((x y : FreeMagma α) → C xC yC (x * y)) → C x
recOnPure
{
C: FreeMagma αSort l
C
:
FreeMagma: Type ?u.16907 → Type ?u.16907
FreeMagma
α: Type u
α
Sort l: Type l
Sort
Sort l: Type l
l
} (
x: FreeMagma α
x
) (
ih1: (x : α) → C (pure x)
ih1
: ∀
x: ?m.16915
x
,
C: FreeMagma αSort l
C
(
pure: {f : Type ?u.16919 → Type ?u.16918} → [self : Pure f] → {α : Type ?u.16919} → αf α
pure
x: ?m.16915
x
)) (
ih2: (x y : FreeMagma α) → C xC yC (x * y)
ih2
: ∀
x: ?m.16968
x
y: ?m.16971
y
,
C: FreeMagma αSort l
C
x: ?m.16968
x
C: FreeMagma αSort l
C
y: ?m.16971
y
C: FreeMagma αSort l
C
(
x: ?m.16968
x
*
y: ?m.16971
y
)) :
C: FreeMagma αSort l
C
x: ?m.16911
x
:=
FreeMagma.recOnMul: {α : Type ?u.17039} → {C : FreeMagma αSort ?u.17038} → (x : FreeMagma α) → ((x : α) → C (of x)) → ((x y : FreeMagma α) → C xC yC (x * y)) → C x
FreeMagma.recOnMul
x: FreeMagma α
x
ih1: (x : α) → C (pure x)
ih1
ih2: (x y : FreeMagma α) → C xC yC (x * y)
ih2
#align free_magma.rec_on_pure
FreeMagma.recOnPure: {α : Type u} → {C : FreeMagma αSort l} → (x : FreeMagma α) → ((x : α) → C (pure x)) → ((x y : FreeMagma α) → C xC yC (x * y)) → C x
FreeMagma.recOnPure
-- Porting note: dsimp can not prove this @[
to_additive: ∀ {α β : Type u} (f : αβ) (x : α), f <$> pure x = pure (f x)
to_additive
(attr := simp, nolint simpNF)] theorem
map_pure: ∀ {α β : Type u} (f : αβ) (x : α), f <$> pure x = pure (f x)
map_pure
(
f: αβ
f
:
α: Type u
α
β: Type u
β
) (
x: α
x
) : (
f: αβ
f
<$>
pure: {f : Type ?u.17462 → Type ?u.17461} → [self : Pure f] → {α : Type ?u.17462} → αf α
pure
x: ?m.17427
x
:
FreeMagma: Type ?u.17432 → Type ?u.17432
FreeMagma
β: Type u
β
) =
pure: {f : Type ?u.17535 → Type ?u.17534} → [self : Pure f] → {α : Type ?u.17535} → αf α
pure
(
f: αβ
f
x: ?m.17427
x
) :=
rfl: ∀ {α : Sort ?u.17566} {a : α}, a = a
rfl
#align free_magma.map_pure
FreeMagma.map_pure: ∀ {α β : Type u} (f : αβ) (x : α), f <$> pure x = pure (f x)
FreeMagma.map_pure
@[
to_additive: ∀ {α β : Type u} (f : αβ) (x y : FreeAddMagma α), f <$> (x + y) = f <$> x + f <$> y
to_additive
(attr := simp)] theorem
map_mul': ∀ (f : αβ) (x y : FreeMagma α), f <$> (x * y) = f <$> x * f <$> y
map_mul'
(
f: αβ
f
:
α: Type u
α
β: Type u
β
) (
x: FreeMagma α
x
y: FreeMagma α
y
:
FreeMagma: Type ?u.17659 → Type ?u.17659
FreeMagma
α: Type u
α
) :
f: αβ
f
<$> (
x: FreeMagma α
x
*
y: FreeMagma α
y
) =
f: αβ
f
<$>
x: FreeMagma α
x
*
f: αβ
f
<$>
y: FreeMagma α
y
:=
rfl: ∀ {α : Sort ?u.17829} {a : α}, a = a
rfl
#align free_magma.map_mul'
FreeMagma.map_mul': ∀ {α β : Type u} (f : αβ) (x y : FreeMagma α), f <$> (x * y) = f <$> x * f <$> y
FreeMagma.map_mul'
-- Porting note: dsimp can not prove this @[
to_additive: ∀ {α β : Type u} (f : αFreeAddMagma β) (x : α), pure x >>= f = f x
to_additive
(attr := simp, nolint simpNF)] theorem
pure_bind: ∀ (f : αFreeMagma β) (x : α), pure x >>= f = f x
pure_bind
(
f: αFreeMagma β
f
:
α: Type u
α
FreeMagma: Type ?u.17957 → Type ?u.17957
FreeMagma
β: Type u
β
) (
x: ?m.17960
x
) :
pure: {f : Type ?u.17971 → Type ?u.17970} → [self : Pure f] → {α : Type ?u.17971} → αf α
pure
x: ?m.17960
x
>>=
f: αFreeMagma β
f
=
f: αFreeMagma β
f
x: ?m.17960
x
:=
rfl: ∀ {α : Sort ?u.18058} {a : α}, a = a
rfl
#align free_magma.pure_bind
FreeMagma.pure_bind: ∀ {α β : Type u} (f : αFreeMagma β) (x : α), pure x >>= f = f x
FreeMagma.pure_bind
@[
to_additive: ∀ {α β : Type u} (f : αFreeAddMagma β) (x y : FreeAddMagma α), x + y >>= f = (x >>= f) + (y >>= f)
to_additive
(attr := simp)] theorem
mul_bind: ∀ (f : αFreeMagma β) (x y : FreeMagma α), x * y >>= f = (x >>= f) * (y >>= f)
mul_bind
(
f: αFreeMagma β
f
:
α: Type u
α
FreeMagma: Type ?u.18146 → Type ?u.18146
FreeMagma
β: Type u
β
) (
x: FreeMagma α
x
y: FreeMagma α
y
:
FreeMagma: Type ?u.18152 → Type ?u.18152
FreeMagma
α: Type u
α
) :
x: FreeMagma α
x
*
y: FreeMagma α
y
>>=
f: αFreeMagma β
f
= (
x: FreeMagma α
x
>>=
f: αFreeMagma β
f
) * (
y: FreeMagma α
y
>>=
f: αFreeMagma β
f
) :=
rfl: ∀ {α : Sort ?u.18304} {a : α}, a = a
rfl
#align free_magma.mul_bind
FreeMagma.mul_bind: ∀ {α β : Type u} (f : αFreeMagma β) (x y : FreeMagma α), x * y >>= f = (x >>= f) * (y >>= f)
FreeMagma.mul_bind
@[
to_additive: ∀ {α β : Type u} {f : αβ} {x : FreeAddMagma α}, (Seq.seq (pure f) fun x_1 => x) = f <$> x
to_additive
(attr := simp)] theorem
pure_seq: ∀ {α β : Type u} {f : αβ} {x : FreeMagma α}, (Seq.seq (pure f) fun x_1 => x) = f <$> x
pure_seq
{
α: Type u
α
β: Type u
β
:
Type u: Type (u+1)
Type u
} {
f: αβ
f
:
α: Type u
α
β: Type u
β
} {
x: FreeMagma α
x
:
FreeMagma: Type ?u.18438 → Type ?u.18438
FreeMagma
α: Type u
α
} :
pure: {f : Type ?u.18449 → Type ?u.18448} → [self : Pure f] → {α : Type ?u.18449} → αf α
pure
f: αβ
f
<*>
x: FreeMagma α
x
=
f: αβ
f
<$>
x: FreeMagma α
x
:=
rfl: ∀ {α : Sort ?u.18589} {a : α}, a = a
rfl
#align free_magma.pure_seq
FreeMagma.pure_seq: ∀ {α β : Type u} {f : αβ} {x : FreeMagma α}, (Seq.seq (pure f) fun x_1 => x) = f <$> x
FreeMagma.pure_seq
@[
to_additive: ∀ {α β : Type u} {f g : FreeAddMagma (αβ)} {x : FreeAddMagma α}, (Seq.seq (f + g) fun x_1 => x) = (Seq.seq f fun x_1 => x) + Seq.seq g fun x_1 => x
to_additive
(attr := simp)] theorem
mul_seq: ∀ {α β : Type u} {f g : FreeMagma (αβ)} {x : FreeMagma α}, (Seq.seq (f * g) fun x_1 => x) = (Seq.seq f fun x_1 => x) * Seq.seq g fun x_1 => x
mul_seq
{
α: Type u
α
β: Type u
β
:
Type u: Type (u+1)
Type u
} {
f: FreeMagma (αβ)
f
g: FreeMagma (αβ)
g
:
FreeMagma: Type ?u.18713 → Type ?u.18713
FreeMagma
(
α: Type u
α
β: Type u
β
)} {
x: FreeMagma α
x
:
FreeMagma: Type ?u.18719 → Type ?u.18719
FreeMagma
α: Type u
α
} :
f: FreeMagma (αβ)
f
*
g: FreeMagma (αβ)
g
<*>
x: FreeMagma α
x
= (
f: FreeMagma (αβ)
f
<*>
x: FreeMagma α
x
) * (
g: FreeMagma (αβ)
g
<*>
x: FreeMagma α
x
) :=
rfl: ∀ {α : Sort ?u.18895} {a : α}, a = a
rfl
#align free_magma.mul_seq
FreeMagma.mul_seq: ∀ {α β : Type u} {f g : FreeMagma (αβ)} {x : FreeMagma α}, (Seq.seq (f * g) fun x_1 => x) = (Seq.seq f fun x_1 => x) * Seq.seq g fun x_1 => x
FreeMagma.mul_seq
@[to_additive] instance :
LawfulMonad: (m : Type ?u.19029 → Type ?u.19028) → [inst : Monad m] → Prop
LawfulMonad
FreeMagma: Type u → Type u
FreeMagma
.{u} :=
LawfulMonad.mk': ∀ (m : Type ?u.19042 → Type ?u.19041) [inst : Monad m], (∀ {α : Type ?u.19042} (x : m α), id <$> x = x) → (∀ {α β : Type ?u.19042} (x : α) (f : αm β), pure x >>= f = f x) → (∀ {α β γ : Type ?u.19042} (x : m α) (f : αm β) (g : βm γ), x >>= f >>= g = x >>= fun x => f x >>= g) → autoParam (∀ {α β : Type ?u.19042} (x : α) (y : m β), Functor.mapConst x y = Function.const β x <$> y) _auto✝autoParam (∀ {α β : Type ?u.19042} (x : m α) (y : m β), (SeqLeft.seqLeft x fun x => y) = do let a ← x let _ ← y pure a) _auto✝¹autoParam (∀ {α β : Type ?u.19042} (x : m α) (y : m β), (SeqRight.seqRight x fun x => y) = do let _ ← x y) _auto✝²autoParam (∀ {α β : Type ?u.19042} (f : αβ) (x : m α), (do let y ← x pure (f y)) = f <$> x) _auto✝³autoParam (∀ {α β : Type ?u.19042} (f : m (αβ)) (x : m α), (do let x_1 ← f x_1 <$> x) = Seq.seq f fun x_1 => x) _auto✝⁴LawfulMonad m
LawfulMonad.mk'
(pure_bind := fun
f: ?m.19159
f
x: ?m.19162
x
rfl: ∀ {α : Sort ?u.19165} {a : α}, a = a
rfl
) (bind_assoc := fun
x: ?m.19199
x
f: ?m.19202
f
g: ?m.19206
g
FreeMagma.recOnPure: ∀ {α : Type ?u.19210} {C : FreeMagma αSort ?u.19209} (x : FreeMagma α), (∀ (x : α), C (pure x)) → (∀ (x y : FreeMagma α), C xC yC (x * y)) → C x
FreeMagma.recOnPure
x: ?m.19199
x
(fun
x: ?m.19305
x
rfl: ∀ {α : Sort ?u.19307} {a : α}, a = a
rfl
) fun
x: ?m.19407
x
y: ?m.19410
y
ih1: ?m.19413
ih1
ih2: ?m.19416
ih2

Goals accomplished! 🐙
α, β, α✝, β✝, γ✝: Type u

x✝: FreeMagma α✝

f: α✝FreeMagma β✝

g: β✝FreeMagma γ✝

x, y: FreeMagma α✝

ih1: x >>= f >>= g = x >>= fun x => f x >>= g

ih2: y >>= f >>= g = y >>= fun x => f x >>= g


x * y >>= f >>= g = x * y >>= fun x => f x >>= g
α, β, α✝, β✝, γ✝: Type u

x✝: FreeMagma α✝

f: α✝FreeMagma β✝

g: β✝FreeMagma γ✝

x, y: FreeMagma α✝

ih1: x >>= f >>= g = x >>= fun x => f x >>= g

ih2: y >>= f >>= g = y >>= fun x => f x >>= g


x * y >>= f >>= g = x * y >>= fun x => f x >>= g
α, β, α✝, β✝, γ✝: Type u

x✝: FreeMagma α✝

f: α✝FreeMagma β✝

g: β✝FreeMagma γ✝

x, y: FreeMagma α✝

ih1: x >>= f >>= g = x >>= fun x => f x >>= g

ih2: y >>= f >>= g = y >>= fun x => f x >>= g


(x >>= f) * (y >>= f) >>= g = x * y >>= fun x => f x >>= g
α, β, α✝, β✝, γ✝: Type u

x✝: FreeMagma α✝

f: α✝FreeMagma β✝

g: β✝FreeMagma γ✝

x, y: FreeMagma α✝

ih1: x >>= f >>= g = x >>= fun x => f x >>= g

ih2: y >>= f >>= g = y >>= fun x => f x >>= g


x * y >>= f >>= g = x * y >>= fun x => f x >>= g
α, β, α✝, β✝, γ✝: Type u

x✝: FreeMagma α✝

f: α✝FreeMagma β✝

g: β✝FreeMagma γ✝

x, y: FreeMagma α✝

ih1: x >>= f >>= g = x >>= fun x => f x >>= g

ih2: y >>= f >>= g = y >>= fun x => f x >>= g


(x >>= f >>= g) * (y >>= f >>= g) = x * y >>= fun x => f x >>= g
α, β, α✝, β✝, γ✝: Type u

x✝: FreeMagma α✝

f: α✝FreeMagma β✝

g: β✝FreeMagma γ✝

x, y: FreeMagma α✝

ih1: x >>= f >>= g = x >>= fun x => f x >>= g

ih2: y >>= f >>= g = y >>= fun x => f x >>= g


x * y >>= f >>= g = x * y >>= fun x => f x >>= g
α, β, α✝, β✝, γ✝: Type u

x✝: FreeMagma α✝

f: α✝FreeMagma β✝

g: β✝FreeMagma γ✝

x, y: FreeMagma α✝

ih1: x >>= f >>= g = x >>= fun x => f x >>= g

ih2: y >>= f >>= g = y >>= fun x => f x >>= g


(x >>= f >>= g) * (y >>= f >>= g) = (x >>= fun x => f x >>= g) * (y >>= fun x => f x >>= g)
α, β, α✝, β✝, γ✝: Type u

x✝: FreeMagma α✝

f: α✝FreeMagma β✝

g: β✝FreeMagma γ✝

x, y: FreeMagma α✝

ih1: x >>= f >>= g = x >>= fun x => f x >>= g

ih2: y >>= f >>= g = y >>= fun x => f x >>= g


x * y >>= f >>= g = x * y >>= fun x => f x >>= g
α, β, α✝, β✝, γ✝: Type u

x✝: FreeMagma α✝

f: α✝FreeMagma β✝

g: β✝FreeMagma γ✝

x, y: FreeMagma α✝

ih1: x >>= f >>= g = x >>= fun x => f x >>= g

ih2: y >>= f >>= g = y >>= fun x => f x >>= g


(x >>= fun x => f x >>= g) * (y >>= f >>= g) = (x >>= fun x => f x >>= g) * (y >>= fun x => f x >>= g)
α, β, α✝, β✝, γ✝: Type u

x✝: FreeMagma α✝

f: α✝FreeMagma β✝

g: β✝FreeMagma γ✝

x, y: FreeMagma α✝

ih1: x >>= f >>= g = x >>= fun x => f x >>= g

ih2: y >>= f >>= g = y >>= fun x => f x >>= g


x * y >>= f >>= g = x * y >>= fun x => f x >>= g
α, β, α✝, β✝, γ✝: Type u

x✝: FreeMagma α✝

f: α✝FreeMagma β✝

g: β✝FreeMagma γ✝

x, y: FreeMagma α✝

ih1: x >>= f >>= g = x >>= fun x => f x >>= g

ih2: y >>= f >>= g = y >>= fun x => f x >>= g


(x >>= fun x => f x >>= g) * (y >>= fun x => f x >>= g) = (x >>= fun x => f x >>= g) * (y >>= fun x => f x >>= g)

Goals accomplished! 🐙
) (id_map := fun
x: ?m.19110
x
FreeMagma.recOnPure: ∀ {α : Type ?u.19113} {C : FreeMagma αSort ?u.19112} (x : FreeMagma α), (∀ (x : α), C (pure x)) → (∀ (x y : FreeMagma α), C xC yC (x * y)) → C x
FreeMagma.recOnPure
x: ?m.19110
x
(fun
_: ?m.19271
_
rfl: ∀ {α : Sort ?u.19273} {a : α}, a = a
rfl
) fun
x: ?m.19287
x
y: ?m.19290
y
ih1: ?m.19293
ih1
ih2: ?m.19296
ih2

Goals accomplished! 🐙
α, β, α✝: Type u

x✝, x, y: FreeMagma α✝

ih1: id <$> x = x

ih2: id <$> y = y


id <$> (x * y) = x * y
α, β, α✝: Type u

x✝, x, y: FreeMagma α✝

ih1: id <$> x = x

ih2: id <$> y = y


id <$> (x * y) = x * y
α, β, α✝: Type u

x✝, x, y: FreeMagma α✝

ih1: id <$> x = x

ih2: id <$> y = y


id <$> x * id <$> y = x * y
α, β, α✝: Type u

x✝, x, y: FreeMagma α✝

ih1: id <$> x = x

ih2: id <$> y = y


id <$> (x * y) = x * y
α, β, α✝: Type u

x✝, x, y: FreeMagma α✝

ih1: id <$> x = x

ih2: id <$> y = y


x * id <$> y = x * y
α, β, α✝: Type u

x✝, x, y: FreeMagma α✝

ih1: id <$> x = x

ih2: id <$> y = y


id <$> (x * y) = x * y
α, β, α✝: Type u

x✝, x, y: FreeMagma α✝

ih1: id <$> x = x

ih2: id <$> y = y


x * y = x * y

Goals accomplished! 🐙
) end Category end FreeMagma /-- `FreeMagma` is traversable. -/ protected def
FreeMagma.traverse: {m : Type u → Type u} → [inst : Applicative m] → {α β : Type u} → (αm β) → FreeMagma αm (FreeMagma β)
FreeMagma.traverse
{
m: Type u → Type u
m
:
Type u: Type (u+1)
Type u
Type u: Type (u+1)
Type u
} [
Applicative: (Type ?u.19765 → Type ?u.19764) → Type (max(?u.19765+1)?u.19764)
Applicative
m: Type u → Type u
m
] {
α: Type u
α
β: Type u
β
:
Type u: Type (u+1)
Type u
} (
F: αm β
F
:
α: Type u
α
m: Type u → Type u
m
β: Type u
β
) :
FreeMagma: Type ?u.19780 → Type ?u.19780
FreeMagma
α: Type u
α
m: Type u → Type u
m
(
FreeMagma: Type ?u.19782 → Type ?u.19782
FreeMagma
β: Type u
β
) |
FreeMagma.of: {α : Type ?u.19792} → αFreeMagma α
FreeMagma.of
x: α
x
=>
FreeMagma.of: {α : Type ?u.19832} → αFreeMagma α
FreeMagma.of
<$>
F: αm β
F
x: α
x
|
x: FreeMagma α
x
*
y: FreeMagma α
y
=>
(· * ·): FreeMagma βFreeMagma βFreeMagma β
(· * ·)
<$>
x: FreeMagma α
x
.
traverse: {m : Type u → Type u} → [inst : Applicative m] → {α β : Type u} → (αm β) → FreeMagma αm (FreeMagma β)
traverse
F: αm β
F
<*>
y: FreeMagma α
y
.
traverse: {m : Type u → Type u} → [inst : Applicative m] → {α β : Type u} → (αm β) → FreeMagma αm (FreeMagma β)
traverse
F: αm β
F
#align free_magma.traverse
FreeMagma.traverse: {m : Type u → Type u} → [inst : Applicative m] → {α β : Type u} → (αm β) → FreeMagma αm (FreeMagma β)
FreeMagma.traverse
/-- `FreeAddMagma` is traversable. -/ protected def
FreeAddMagma.traverse: {m : Type u → Type u} → [inst : Applicative m] → {α β : Type u} → (αm β) → FreeAddMagma αm (FreeAddMagma β)
FreeAddMagma.traverse
{
m: Type u → Type u
m
:
Type u: Type (u+1)
Type u
Type u: Type (u+1)
Type u
} [
Applicative: (Type ?u.20600 → Type ?u.20599) → Type (max(?u.20600+1)?u.20599)
Applicative
m: Type u → Type u
m
] {
α: Type u
α
β: Type u
β
:
Type u: Type (u+1)
Type u
} (
F: αm β
F
:
α: Type u
α
m: Type u → Type u
m
β: Type u
β
) :
FreeAddMagma: Type ?u.20615 → Type ?u.20615
FreeAddMagma
α: Type u
α
m: Type u → Type u
m
(
FreeAddMagma: Type ?u.20617 → Type ?u.20617
FreeAddMagma
β: Type u
β
) |
FreeAddMagma.of: {α : Type ?u.20627} → αFreeAddMagma α
FreeAddMagma.of
x: α
x
=>
FreeAddMagma.of: {α : Type ?u.20667} → αFreeAddMagma α
FreeAddMagma.of
<$>
F: αm β
F
x: α
x
| x + y =>
(· + ·): FreeAddMagma βFreeAddMagma βFreeAddMagma β
(· + ·)
<$> x.
traverse: {m : Type u → Type u} → [inst : Applicative m] → {α β : Type u} → (αm β) → FreeAddMagma αm (FreeAddMagma β)
traverse
F: αm β
F
<*> y.
traverse: {m : Type u → Type u} → [inst : Applicative m] → {α β : Type u} → (αm β) → FreeAddMagma αm (FreeAddMagma β)
traverse
F: αm β
F
#align free_add_magma.traverse
FreeAddMagma.traverse: {m : Type u → Type u} → [inst : Applicative m] → {α β : Type u} → (αm β) → FreeAddMagma αm (FreeAddMagma β)
FreeAddMagma.traverse
attribute [
to_additive: {m : Type u → Type u} → [inst : Applicative m] → {α β : Type u} → (αm β) → FreeAddMagma αm (FreeAddMagma β)
to_additive
existing]
FreeMagma.traverse: {m : Type u → Type u} → [inst : Applicative m] → {α β : Type u} → (αm β) → FreeMagma αm (FreeMagma β)
FreeMagma.traverse
namespace FreeMagma variable {
α: Type u
α
:
Type u: Type (u+1)
Type u
} section Category variable {
β: Type u
β
:
Type u: Type (u+1)
Type u
} @[to_additive] instance :
Traversable: (Type ?u.21836 → Type ?u.21836) → Type (?u.21836+1)
Traversable
FreeMagma: Type ?u.21837 → Type ?u.21837
FreeMagma
:= ⟨@
FreeMagma.traverse: {m : Type ?u.21869 → Type ?u.21869} → [inst : Applicative m] → {α β : Type ?u.21869} → (αm β) → FreeMagma αm (FreeMagma β)
FreeMagma.traverse
variable {
m: Type u → Type u
m
:
Type u: Type (u+1)
Type u
Type u: Type (u+1)
Type u
} [
Applicative: (Type ?u.22245 → Type ?u.22244) → Type (max(?u.22245+1)?u.22244)
Applicative
m: Type u → Type u
m
] (
F: αm β
F
:
α: Type u
α
m: Type u → Type u
m
β: Type u
β
) @[
to_additive: ∀ {α β : Type u} {m : Type u → Type u} [inst : Applicative m] (F : αm β) (x : α), traverse F (pure x) = pure <$> F x
to_additive
(attr := simp)] theorem
traverse_pure: ∀ (x : α), traverse F (pure x) = pure <$> F x
traverse_pure
(
x: ?m.22274
x
) :
traverse: {t : Type ?u.22278 → Type ?u.22278} → [self : Traversable t] → {m : Type ?u.22278 → Type ?u.22278} → [inst : Applicative m] → {α β : Type ?u.22278} → (αm β) → t αm (t β)
traverse
F: αm β
F
(
pure: {f : Type ?u.22292 → Type ?u.22291} → [self : Pure f] → {α : Type ?u.22292} → αf α
pure
x: ?m.22274
x
:
FreeMagma: Type ?u.22290 → Type ?u.22290
FreeMagma
α: Type u
α
) =
pure: {f : Type ?u.22358 → Type ?u.22357} → [self : Pure f] → {α : Type ?u.22358} → αf α
pure
<$>
F: αm β
F
x: ?m.22274
x
:=
rfl: ∀ {α : Sort ?u.22447} {a : α}, a = a
rfl
#align free_magma.traverse_pure
FreeMagma.traverse_pure: ∀ {α β : Type u} {m : Type u → Type u} [inst : Applicative m] (F : αm β) (x : α), traverse F (pure x) = pure <$> F x
FreeMagma.traverse_pure
@[
to_additive: ∀ {α β : Type u} {m : Type u → Type u} [inst : Applicative m] (F : αm β), traverse F pure = fun x => pure <$> F x
to_additive
(attr := simp)] theorem
traverse_pure': ∀ {α β : Type u} {m : Type u → Type u} [inst : Applicative m] (F : αm β), traverse F pure = fun x => pure <$> F x
traverse_pure'
:
traverse: {t : Type ?u.22588 → Type ?u.22588} → [self : Traversable t] → {m : Type ?u.22588 → Type ?u.22588} → [inst : Applicative m] → {α β : Type ?u.22588} → (αm β) → t αm (t β)
traverse
F: αm β
F
pure: {f : Type ?u.22656 → Type ?u.22655} → [self : Pure f] → {α : Type ?u.22656} → αf α
pure
= fun
x: ?m.22708
x
↦ (
pure: {f : Type ?u.22738 → Type ?u.22737} → [self : Pure f] → {α : Type ?u.22738} → αf α
pure
<$>
F: αm β
F
x: ?m.22708
x
:
m: Type u → Type u
m
(
FreeMagma: Type ?u.22711 → Type ?u.22711
FreeMagma
β: Type u
β
)) :=
rfl: ∀ {α : Sort ?u.22860} {a : α}, a = a
rfl
#align free_magma.traverse_pure'
FreeMagma.traverse_pure': ∀ {α β : Type u} {m : Type u → Type u} [inst : Applicative m] (F : αm β), traverse F pure = fun x => pure <$> F x
FreeMagma.traverse_pure'
@[
to_additive: ∀ {α β : Type u} {m : Type u → Type u} [inst : Applicative m] (F : αm β) (x y : FreeAddMagma α), traverse F (x + y) = Seq.seq ((fun x x_1 => x + x_1) <$> traverse F x) fun x => traverse F y
to_additive
(attr := simp)] theorem
traverse_mul: ∀ (x y : FreeMagma α), traverse F (x * y) = Seq.seq ((fun x x_1 => x * x_1) <$> traverse F x) fun x => traverse F y
traverse_mul
(
x: FreeMagma α
x
y: FreeMagma α
y
:
FreeMagma: Type ?u.23007 → Type ?u.23007
FreeMagma
α: Type u
α
) :
traverse: {t : Type ?u.23011 → Type ?u.23011} → [self : Traversable t] → {m : Type ?u.23011 → Type ?u.23011} → [inst : Applicative m] → {α β : Type ?u.23011} → (αm β) → t αm (t β)
traverse
F: αm β
F
(
x: FreeMagma α
x
*
y: FreeMagma α
y
) =
(· * ·): FreeMagma βFreeMagma βFreeMagma β
(· * ·)
<$>
traverse: {t : Type ?u.23150 → Type ?u.23150} → [self : Traversable t] → {m : Type ?u.23150 → Type ?u.23150} → [inst : Applicative m] → {α β : Type ?u.23150} → (αm β) → t αm (t β)
traverse
F: αm β
F
x: FreeMagma α
x
<*>
traverse: {t : Type ?u.23211 → Type ?u.23211} → [self : Traversable t] → {m : Type ?u.23211 → Type ?u.23211} → [inst : Applicative m] → {α β : Type ?u.23211} → (αm β) → t αm (t β)
traverse
F: αm β
F
y: FreeMagma α
y
:=
rfl: ∀ {α : Sort ?u.23289} {a : α}, a = a
rfl
#align free_magma.traverse_mul
FreeMagma.traverse_mul: ∀ {α β : Type u} {m : Type u → Type u} [inst : Applicative m] (F : αm β) (x y : FreeMagma α), traverse F (x * y) = Seq.seq ((fun x x_1 => x * x_1) <$> traverse F x) fun x => traverse F y
FreeMagma.traverse_mul
@[
to_additive: ∀ {α β : Type u} {m : Type u → Type u} [inst : Applicative m] (F : αm β), Function.comp (traverse F) Add.add = fun x y => Seq.seq ((fun x x_1 => x + x_1) <$> traverse F x) fun x => traverse F y
to_additive
(attr := simp)] theorem
traverse_mul': ∀ {α β : Type u} {m : Type u → Type u} [inst : Applicative m] (F : αm β), Function.comp (traverse F) Mul.mul = fun x y => Seq.seq ((fun x x_1 => x * x_1) <$> traverse F x) fun x => traverse F y
traverse_mul'
:
Function.comp: {α : Sort ?u.23456} → {β : Sort ?u.23455} → {δ : Sort ?u.23454} → (βδ) → (αβ) → αδ
Function.comp
(
traverse: {t : Type ?u.23465 → Type ?u.23465} → [self : Traversable t] → {m : Type ?u.23465 → Type ?u.23465} → [inst : Applicative m] → {α β : Type ?u.23465} → (αm β) → t αm (t β)
traverse
F: αm β
F
) ∘ @
Mul.mul: {α : Type ?u.23540} → [self : Mul α] → ααα
Mul.mul
(
FreeMagma: Type ?u.23541 → Type ?u.23541
FreeMagma
α: Type u
α
) _ = fun
x: ?m.23569
x
y: ?m.23572
y
(· * ·): FreeMagma βFreeMagma βFreeMagma β
(· * ·)
<$>
traverse: {t : Type ?u.23633 → Type ?u.23633} → [self : Traversable t] → {m : Type ?u.23633 → Type ?u.23633} → [inst : Applicative m] → {α β : Type ?u.23633} → (αm β) → t αm (t β)
traverse
F: αm β
F
x: ?m.23569
x
<*>
traverse: {t : Type ?u.23707 → Type ?u.23707} → [self : Traversable t] → {m : Type ?u.23707 → Type ?u.23707} → [inst : Applicative m] → {α β : Type ?u.23707} → (αm β) → t αm (t β)
traverse
F: αm β
F
y: ?m.23572
y
:=
rfl: ∀ {α : Sort ?u.23893} {a : α}, a = a
rfl
#align free_magma.traverse_mul'
FreeMagma.traverse_mul': ∀ {α β : Type u} {m : Type u → Type u} [inst : Applicative m] (F : αm β), Function.comp (traverse F) Mul.mul = fun x y => Seq.seq ((fun x x_1 => x * x_1) <$> traverse F x) fun x => traverse F y
FreeMagma.traverse_mul'
@[
to_additive: ∀ {α β : Type u} {m : Type u → Type u} [inst : Applicative m] (F : αm β) (x : FreeAddMagma α), FreeAddMagma.traverse F x = traverse F x
to_additive
(attr := simp)] theorem
traverse_eq: ∀ {α β : Type u} {m : Type u → Type u} [inst : Applicative m] (F : αm β) (x : FreeMagma α), FreeMagma.traverse F x = traverse F x
traverse_eq
(
x: FreeMagma α
x
) :
FreeMagma.traverse: {m : Type ?u.24073 → Type ?u.24073} → [inst : Applicative m] → {α β : Type ?u.24073} → (αm β) → FreeMagma αm (FreeMagma β)
FreeMagma.traverse
F: αm β
F
x: ?m.24069
x
=
traverse: {t : Type ?u.24092 → Type ?u.24092} → [self : Traversable t] → {m : Type ?u.24092 → Type ?u.24092} → [inst : Applicative m] → {α β : Type ?u.24092} → (αm β) → t αm (t β)
traverse
F: αm β
F
x: ?m.24069
x
:=
rfl: ∀ {α : Sort ?u.24113} {a : α}, a = a
rfl
#align free_magma.traverse_eq
FreeMagma.traverse_eq: ∀ {α β : Type u} {m : Type u → Type u} [inst : Applicative m] (F : αm β) (x : FreeMagma α), FreeMagma.traverse F x = traverse F x
FreeMagma.traverse_eq
-- Porting note: dsimp can not prove this @[
to_additive: ∀ {α : Type u} (x y : FreeAddMagma α), (Seq.seq ((fun x x_1 => x + x_1) <$> x) fun x => y) = x + y
to_additive
(attr := simp, nolint simpNF)] theorem
mul_map_seq: ∀ {α : Type u} (x y : FreeMagma α), (Seq.seq ((fun x x_1 => x * x_1) <$> x) fun x => y) = x * y
mul_map_seq
(
x: FreeMagma α
x
y: FreeMagma α
y
:
FreeMagma: Type ?u.24220 → Type ?u.24220
FreeMagma
α: Type u
α
) : (
(· * ·): FreeMagma αFreeMagma αFreeMagma α
(· * ·)
<$>
x: FreeMagma α
x
<*>
y: FreeMagma α
y
:
Id: Type ?u.24225 → Type ?u.24225
Id
(
FreeMagma: Type ?u.24226 → Type ?u.24226
FreeMagma
α: Type u
α
)) = (
x: FreeMagma α
x
*
y: FreeMagma α
y
:
FreeMagma: Type ?u.24386 → Type ?u.24386
FreeMagma
α: Type u
α
) :=
rfl: ∀ {α : Sort ?u.24422} {a : α}, a = a
rfl
#align free_magma.mul_map_seq
FreeMagma.mul_map_seq: ∀ {α : Type u} (x y : FreeMagma α), (Seq.seq ((fun x x_1 => x * x_1) <$> x) fun x => y) = x * y
FreeMagma.mul_map_seq
@[to_additive] instance :
IsLawfulTraversable: (t : Type ?u.24536 → Type ?u.24536) → [inst : Traversable t] → Type (?u.24536+1)
IsLawfulTraversable
FreeMagma: Type u → Type u
FreeMagma
.{u} := {
instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma
instLawfulMonadFreeMagmaInstMonadFreeMagma
with id_traverse := fun
x: ?m.24604
x
FreeMagma.recOnPure: ∀ {α : Type ?u.24607} {C : FreeMagma αSort ?u.24606} (x : FreeMagma α), (∀ (x : α), C (pure x)) → (∀ (x y : FreeMagma α), C xC yC (x * y)) → C x
FreeMagma.recOnPure
x: ?m.24604
x
(fun
x: ?m.24884
x
rfl: ∀ {α : Sort ?u.24886} {a : α}, a = a
rfl
) fun
x: ?m.24914
x
y: ?m.24917
y
ih1: ?m.24920
ih1
ih2: ?m.24923
ih2

Goals accomplished! 🐙
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝: Type u

x✝, x, y: FreeMagma α✝

ih1: traverse pure x = x

ih2: traverse pure y = y


traverse pure (x * y) = x * y
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝: Type u

x✝, x, y: FreeMagma α✝

ih1: traverse pure x = x

ih2: traverse pure y = y


traverse pure (x * y) = x * y
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝: Type u

x✝, x, y: FreeMagma α✝

ih1: traverse pure x = x

ih2: traverse pure y = y


(Seq.seq ((fun x x_1 => x * x_1) <$> traverse pure x) fun x => traverse pure y) = x * y
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝: Type u

x✝, x, y: FreeMagma α✝

ih1: traverse pure x = x

ih2: traverse pure y = y


traverse pure (x * y) = x * y
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝: Type u

x✝, x, y: FreeMagma α✝

ih1: traverse pure x = x

ih2: traverse pure y = y


(Seq.seq ((fun x x_1 => x * x_1) <$> x) fun x => traverse pure y) = x * y
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝: Type u

x✝, x, y: FreeMagma α✝

ih1: traverse pure x = x

ih2: traverse pure y = y


traverse pure (x * y) = x * y
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝: Type u

x✝, x, y: FreeMagma α✝

ih1: traverse pure x = x

ih2: traverse pure y = y


(Seq.seq ((fun x x_1 => x * x_1) <$> x) fun x => y) = x * y
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝: Type u

x✝, x, y: FreeMagma α✝

ih1: traverse pure x = x

ih2: traverse pure y = y


traverse pure (x * y) = x * y
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝: Type u

x✝, x, y: FreeMagma α✝

ih1: traverse pure x = x

ih2: traverse pure y = y


x * y = x * y

Goals accomplished! 🐙
comp_traverse := fun
f: ?m.24660
f
g: ?m.24664
g
x: ?m.24668
x
FreeMagma.recOnPure: ∀ {α : Type ?u.24671} {C : FreeMagma αSort ?u.24670} (x : FreeMagma α), (∀ (x : α), C (pure x)) → (∀ (x y : FreeMagma α), C xC yC (x * y)) → C x
FreeMagma.recOnPure
x: ?m.24668
x
(fun
x: ?m.24932
x

Goals accomplished! 🐙
α, β: Type u

m: Type u → Type u

inst✝⁴: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

F✝, G✝: Type u → Type u

inst✝³: Applicative F✝

inst✝²: Applicative G✝

inst✝¹: LawfulApplicative F✝

inst✝: LawfulApplicative G✝

α✝, β✝, γ✝: Type u

f: β✝F✝ γ✝

g: α✝G✝ β✝

x✝: FreeMagma α✝

x: α✝


traverse (Functor.Comp.mk Functor.map f g) (pure x) = Functor.Comp.mk (traverse f <$> traverse g (pure x))

Goals accomplished! 🐙
) (fun
x: ?m.24938
x
y: ?m.24941
y
ih1: ?m.24944
ih1
ih2: ?m.24947
ih2

Goals accomplished! 🐙
α, β: Type u

m: Type u → Type u

inst✝⁴: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

F✝, G✝: Type u → Type u

inst✝³: Applicative F✝

inst✝²: Applicative G✝

inst✝¹: LawfulApplicative F✝

inst✝: LawfulApplicative G✝

α✝, β✝, γ✝: Type u

f: β✝F✝ γ✝

g: α✝G✝ β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (Functor.Comp.mk Functor.map f g) x = Functor.Comp.mk (traverse f <$> traverse g x)

ih2: traverse (Functor.Comp.mk Functor.map f g) y = Functor.Comp.mk (traverse f <$> traverse g y)


traverse (Functor.Comp.mk Functor.map f g) (x * y) = Functor.Comp.mk (traverse f <$> traverse g (x * y))
α, β: Type u

m: Type u → Type u

inst✝⁴: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

F✝, G✝: Type u → Type u

inst✝³: Applicative F✝

inst✝²: Applicative G✝

inst✝¹: LawfulApplicative F✝

inst✝: LawfulApplicative G✝

α✝, β✝, γ✝: Type u

f: β✝F✝ γ✝

g: α✝G✝ β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (Functor.Comp.mk Functor.map f g) x = Functor.Comp.mk (traverse f <$> traverse g x)

ih2: traverse (Functor.Comp.mk Functor.map f g) y = Functor.Comp.mk (traverse f <$> traverse g y)


traverse (Functor.Comp.mk Functor.map f g) (x * y) = Functor.Comp.mk (traverse f <$> traverse g (x * y))
α, β: Type u

m: Type u → Type u

inst✝⁴: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

F✝, G✝: Type u → Type u

inst✝³: Applicative F✝

inst✝²: Applicative G✝

inst✝¹: LawfulApplicative F✝

inst✝: LawfulApplicative G✝

α✝, β✝, γ✝: Type u

f: β✝F✝ γ✝

g: α✝G✝ β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (Functor.Comp.mk Functor.map f g) x = Functor.Comp.mk (traverse f <$> traverse g x)

ih2: traverse (Functor.Comp.mk Functor.map f g) y = Functor.Comp.mk (traverse f <$> traverse g y)


(Seq.seq ((fun x x_1 => x * x_1) <$> traverse (Functor.Comp.mk Functor.map f g) x) fun x => traverse (Functor.Comp.mk Functor.map f g) y) = Functor.Comp.mk (traverse f <$> traverse g (x * y))
α, β: Type u

m: Type u → Type u

inst✝⁴: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

F✝, G✝: Type u → Type u

inst✝³: Applicative F✝

inst✝²: Applicative G✝

inst✝¹: LawfulApplicative F✝

inst✝: LawfulApplicative G✝

α✝, β✝, γ✝: Type u

f: β✝F✝ γ✝

g: α✝G✝ β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (Functor.Comp.mk Functor.map f g) x = Functor.Comp.mk (traverse f <$> traverse g x)

ih2: traverse (Functor.Comp.mk Functor.map f g) y = Functor.Comp.mk (traverse f <$> traverse g y)


traverse (Functor.Comp.mk Functor.map f g) (x * y) = Functor.Comp.mk (traverse f <$> traverse g (x * y))
α, β: Type u

m: Type u → Type u

inst✝⁴: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

F✝, G✝: Type u → Type u

inst✝³: Applicative F✝

inst✝²: Applicative G✝

inst✝¹: LawfulApplicative F✝

inst✝: LawfulApplicative G✝

α✝, β✝, γ✝: Type u

f: β✝F✝ γ✝

g: α✝G✝ β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (Functor.Comp.mk Functor.map f g) x = Functor.Comp.mk (traverse f <$> traverse g x)

ih2: traverse (Functor.Comp.mk Functor.map f g) y = Functor.Comp.mk (traverse f <$> traverse g y)


(Seq.seq ((fun x x_1 => x * x_1) <$> Functor.Comp.mk (traverse f <$> traverse g x)) fun x => traverse (Functor.Comp.mk Functor.map f g) y) = Functor.Comp.mk (traverse f <$> traverse g (x * y))
α, β: Type u

m: Type u → Type u

inst✝⁴: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

F✝, G✝: Type u → Type u

inst✝³: Applicative F✝

inst✝²: Applicative G✝

inst✝¹: LawfulApplicative F✝

inst✝: LawfulApplicative G✝

α✝, β✝, γ✝: Type u

f: β✝F✝ γ✝

g: α✝G✝ β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (Functor.Comp.mk Functor.map f g) x = Functor.Comp.mk (traverse f <$> traverse g x)

ih2: traverse (Functor.Comp.mk Functor.map f g) y = Functor.Comp.mk (traverse f <$> traverse g y)


traverse (Functor.Comp.mk Functor.map f g) (x * y) = Functor.Comp.mk (traverse f <$> traverse g (x * y))
α, β: Type u

m: Type u → Type u

inst✝⁴: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

F✝, G✝: Type u → Type u

inst✝³: Applicative F✝

inst✝²: Applicative G✝

inst✝¹: LawfulApplicative F✝

inst✝: LawfulApplicative G✝

α✝, β✝, γ✝: Type u

f: β✝F✝ γ✝

g: α✝G✝ β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (Functor.Comp.mk Functor.map f g) x = Functor.Comp.mk (traverse f <$> traverse g x)

ih2: traverse (Functor.Comp.mk Functor.map f g) y = Functor.Comp.mk (traverse f <$> traverse g y)


(Seq.seq ((fun x x_1 => x * x_1) <$> Functor.Comp.mk (traverse f <$> traverse g x)) fun x => Functor.Comp.mk (traverse f <$> traverse g y)) = Functor.Comp.mk (traverse f <$> traverse g (x * y))
α, β: Type u

m: Type u → Type u

inst✝⁴: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

F✝, G✝: Type u → Type u

inst✝³: Applicative F✝

inst✝²: Applicative G✝

inst✝¹: LawfulApplicative F✝

inst✝: LawfulApplicative G✝

α✝, β✝, γ✝: Type u

f: β✝F✝ γ✝

g: α✝G✝ β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (Functor.Comp.mk Functor.map f g) x = Functor.Comp.mk (traverse f <$> traverse g x)

ih2: traverse (Functor.Comp.mk Functor.map f g) y = Functor.Comp.mk (traverse f <$> traverse g y)


traverse (Functor.Comp.mk Functor.map f g) (x * y) = Functor.Comp.mk (traverse f <$> traverse g (x * y))
α, β: Type u

m: Type u → Type u

inst✝⁴: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

F✝, G✝: Type u → Type u

inst✝³: Applicative F✝

inst✝²: Applicative G✝

inst✝¹: LawfulApplicative F✝

inst✝: LawfulApplicative G✝

α✝, β✝, γ✝: Type u

f: β✝F✝ γ✝

g: α✝G✝ β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (Functor.Comp.mk Functor.map f g) x = Functor.Comp.mk (traverse f <$> traverse g x)

ih2: traverse (Functor.Comp.mk Functor.map f g) y = Functor.Comp.mk (traverse f <$> traverse g y)


(Seq.seq ((fun x x_1 => x * x_1) <$> Functor.Comp.mk (traverse f <$> traverse g x)) fun x => Functor.Comp.mk (traverse f <$> traverse g y)) = Functor.Comp.mk (traverse f <$> Seq.seq ((fun x x_1 => x * x_1) <$> traverse g x) fun x => traverse g y)
α, β: Type u

m: Type u → Type u

inst✝⁴: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

F✝, G✝: Type u → Type u

inst✝³: Applicative F✝

inst✝²: Applicative G✝

inst✝¹: LawfulApplicative F✝

inst✝: LawfulApplicative G✝

α✝, β✝, γ✝: Type u

f: β✝F✝ γ✝

g: α✝G✝ β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (Functor.Comp.mk Functor.map f g) x = Functor.Comp.mk (traverse f <$> traverse g x)

ih2: traverse (Functor.Comp.mk Functor.map f g) y = Functor.Comp.mk (traverse f <$> traverse g y)


(Seq.seq ((fun x x_1 => x * x_1) <$> Functor.Comp.mk (traverse f <$> traverse g x)) fun x => Functor.Comp.mk (traverse f <$> traverse g y)) = Functor.Comp.mk (traverse f <$> Seq.seq ((fun x x_1 => x * x_1) <$> traverse g x) fun x => traverse g y)
α, β: Type u

m: Type u → Type u

inst✝⁴: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

F✝, G✝: Type u → Type u

inst✝³: Applicative F✝

inst✝²: Applicative G✝

inst✝¹: LawfulApplicative F✝

inst✝: LawfulApplicative G✝

α✝, β✝, γ✝: Type u

f: β✝F✝ γ✝

g: α✝G✝ β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (Functor.Comp.mk Functor.map f g) x = Functor.Comp.mk (traverse f <$> traverse g x)

ih2: traverse (Functor.Comp.mk Functor.map f g) y = Functor.Comp.mk (traverse f <$> traverse g y)


(Seq.seq ((fun x x_1 => x * x_1) <$> Functor.Comp.mk (traverse f <$> traverse g x)) fun x => Functor.Comp.mk (traverse f <$> traverse g y)) = Functor.Comp.mk (traverse f <$> Seq.seq ((fun x x_1 => x * x_1) <$> traverse g x) fun x => traverse g y)
α, β: Type u

m: Type u → Type u

inst✝⁴: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

F✝, G✝: Type u → Type u

inst✝³: Applicative F✝

inst✝²: Applicative G✝

inst✝¹: LawfulApplicative F✝

inst✝: LawfulApplicative G✝

α✝, β✝, γ✝: Type u

f: β✝F✝ γ✝

g: α✝G✝ β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (Functor.Comp.mk Functor.map f g) x = Functor.Comp.mk (traverse f <$> traverse g x)

ih2: traverse (Functor.Comp.mk Functor.map f g) y = Functor.Comp.mk (traverse f <$> traverse g y)


traverse (Functor.Comp.mk Functor.map f g) (x * y) = Functor.Comp.mk (traverse f <$> traverse g (x * y))

Goals accomplished! 🐙
) naturality := fun
η: ?m.24796
η
α: ?m.24799
α
β: ?m.24802
β
f: ?m.24805
f
x: ?m.24809
x
FreeMagma.recOnPure: ∀ {α : Type ?u.24812} {C : FreeMagma αSort ?u.24811} (x : FreeMagma α), (∀ (x : α), C (pure x)) → (∀ (x y : FreeMagma α), C xC yC (x * y)) → C x
FreeMagma.recOnPure
x: ?m.24809
x
(fun
x: ?m.25003
x

Goals accomplished! 🐙
α✝, β✝: Type u

m: Type u → Type u

inst✝⁴: Applicative m

F: α✝m β✝

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

F✝, G✝: Type u → Type u

inst✝³: Applicative F✝

inst✝²: Applicative G✝

inst✝¹: LawfulApplicative F✝

inst✝: LawfulApplicative G✝

η: ApplicativeTransformation F✝ G✝

α, β: Type u

f: αF✝ β

x✝: FreeMagma α

x: α


(fun {α} => ApplicativeTransformation.app η α) (traverse f (pure x)) = traverse ((fun {α} => ApplicativeTransformation.app η α) f) (pure x)

Goals accomplished! 🐙
) (fun
x: ?m.25009
x
y: ?m.25012
y
ih1: ?m.25015
ih1
ih2: ?m.25018
ih2

Goals accomplished! 🐙
α✝, β✝: Type u

m: Type u → Type u

inst✝⁴: Applicative m

F: α✝m β✝

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

F✝, G✝: Type u → Type u

inst✝³: Applicative F✝

inst✝²: Applicative G✝

inst✝¹: LawfulApplicative F✝

inst✝: LawfulApplicative G✝

η: ApplicativeTransformation F✝ G✝

α, β: Type u

f: αF✝ β

x✝, x, y: FreeMagma α

ih1: (fun {α} => ApplicativeTransformation.app η α) (traverse f x) = traverse ((fun {α} => ApplicativeTransformation.app η α) f) x

ih2: (fun {α} => ApplicativeTransformation.app η α) (traverse f y) = traverse ((fun {α} => ApplicativeTransformation.app η α) f) y


(fun {α} => ApplicativeTransformation.app η α) (traverse f (x * y)) = traverse ((fun {α} => ApplicativeTransformation.app η α) f) (x * y)

Goals accomplished! 🐙
) traverse_eq_map_id := fun
f: ?m.24737
f
x: ?m.24741
x
FreeMagma.recOnPure: ∀ {α : Type ?u.24744} {C : FreeMagma αSort ?u.24743} (x : FreeMagma α), (∀ (x : α), C (pure x)) → (∀ (x y : FreeMagma α), C xC yC (x * y)) → C x
FreeMagma.recOnPure
x: ?m.24741
x
(fun
_: ?m.24956
_
rfl: ∀ {α : Sort ?u.24958} {a : α}, a = a
rfl
) fun
x: ?m.24985
x
y: ?m.24988
y
ih1: ?m.24991
ih1
ih2: ?m.24994
ih2

Goals accomplished! 🐙
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝, β✝: Type u

f: α✝β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (pure f) x = id.mk (f <$> x)

ih2: traverse (pure f) y = id.mk (f <$> y)


traverse (pure f) (x * y) = id.mk (f <$> (x * y))
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝, β✝: Type u

f: α✝β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (pure f) x = id.mk (f <$> x)

ih2: traverse (pure f) y = id.mk (f <$> y)


traverse (pure f) (x * y) = id.mk (f <$> (x * y))
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝, β✝: Type u

f: α✝β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (pure f) x = id.mk (f <$> x)

ih2: traverse (pure f) y = id.mk (f <$> y)


(Seq.seq ((fun x x_1 => x * x_1) <$> traverse (pure f) x) fun x => traverse (pure f) y) = id.mk (f <$> (x * y))
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝, β✝: Type u

f: α✝β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (pure f) x = id.mk (f <$> x)

ih2: traverse (pure f) y = id.mk (f <$> y)


traverse (pure f) (x * y) = id.mk (f <$> (x * y))
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝, β✝: Type u

f: α✝β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (pure f) x = id.mk (f <$> x)

ih2: traverse (pure f) y = id.mk (f <$> y)


(Seq.seq ((fun x x_1 => x * x_1) <$> id.mk (f <$> x)) fun x => traverse (pure f) y) = id.mk (f <$> (x * y))
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝, β✝: Type u

f: α✝β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (pure f) x = id.mk (f <$> x)

ih2: traverse (pure f) y = id.mk (f <$> y)


traverse (pure f) (x * y) = id.mk (f <$> (x * y))
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝, β✝: Type u

f: α✝β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (pure f) x = id.mk (f <$> x)

ih2: traverse (pure f) y = id.mk (f <$> y)


(Seq.seq ((fun x x_1 => x * x_1) <$> id.mk (f <$> x)) fun x => id.mk (f <$> y)) = id.mk (f <$> (x * y))
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝, β✝: Type u

f: α✝β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (pure f) x = id.mk (f <$> x)

ih2: traverse (pure f) y = id.mk (f <$> y)


traverse (pure f) (x * y) = id.mk (f <$> (x * y))
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝, β✝: Type u

f: α✝β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (pure f) x = id.mk (f <$> x)

ih2: traverse (pure f) y = id.mk (f <$> y)


(Seq.seq ((fun x x_1 => x * x_1) <$> id.mk (f <$> x)) fun x => id.mk (f <$> y)) = id.mk (f <$> x * f <$> y)
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝, β✝: Type u

f: α✝β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (pure f) x = id.mk (f <$> x)

ih2: traverse (pure f) y = id.mk (f <$> y)


traverse (pure f) (x * y) = id.mk (f <$> (x * y))
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝, β✝: Type u

f: α✝β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (pure f) x = id.mk (f <$> x)

ih2: traverse (pure f) y = id.mk (f <$> y)


id.mk (f <$> x) * id.mk (f <$> y) = id.mk (f <$> x * f <$> y)
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝, β✝: Type u

f: α✝β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (pure f) x = id.mk (f <$> x)

ih2: traverse (pure f) y = id.mk (f <$> y)


id.mk (f <$> x) * id.mk (f <$> y) = id.mk (f <$> x * f <$> y)
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝, β✝: Type u

f: α✝β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (pure f) x = id.mk (f <$> x)

ih2: traverse (pure f) y = id.mk (f <$> y)


id.mk (f <$> x) * id.mk (f <$> y) = id.mk (f <$> x * f <$> y)
α, β: Type u

m: Type u → Type u

inst✝: Applicative m

F: αm β

src✝:= instLawfulMonadFreeMagmaInstMonadFreeMagma: LawfulMonad FreeMagma

α✝, β✝: Type u

f: α✝β✝

x✝, x, y: FreeMagma α✝

ih1: traverse (pure f) x = id.mk (f <$> x)

ih2: traverse (pure f) y = id.mk (f <$> y)


traverse (pure f) (x * y) = id.mk (f <$> (x * y))

Goals accomplished! 🐙
} end Category end FreeMagma -- Porting note: changed String to Lean.Format /-- Representation of an element of a free magma. -/ protected def
FreeMagma.repr: {α : Type u} → [inst : Repr α] → FreeMagma αLean.Format
FreeMagma.repr
{
α: Type u
α
:
Type u: Type (u+1)
Type u
} [
Repr: Type ?u.43631 → Type ?u.43631
Repr
α: Type u
α
] :
FreeMagma: Type ?u.43635 → Type ?u.43635
FreeMagma
α: Type u
α
Lean.Format: Type
Lean.Format
|
FreeMagma.of: {α : Type ?u.43643} → αFreeMagma α
FreeMagma.of
x: α
x
=>
repr: {α : Type ?u.43658} → [inst : Repr α] → αLean.Format
repr
x: α
x
|
x: FreeMagma α
x
*
y: FreeMagma α
y
=>
"( ": String
"( "
++
x: FreeMagma α
x
.
repr: {α : Type u} → [inst : Repr α] → FreeMagma αLean.Format
repr
++
" * ": String
" * "
++
y: FreeMagma α
y
.
repr: {α : Type u} → [inst : Repr α] → FreeMagma αLean.Format
repr
++
" )": String
" )"
#align free_magma.repr
FreeMagma.repr: {α : Type u} → [inst : Repr α] → FreeMagma αLean.Format
FreeMagma.repr
/-- Representation of an element of a free additive magma. -/ protected def
FreeAddMagma.repr: {α : Type u} → [inst : Repr α] → FreeAddMagma αLean.Format
FreeAddMagma.repr
{
α: Type u
α
:
Type u: Type (u+1)
Type u
} [
Repr: Type ?u.44607 → Type ?u.44607
Repr
α: Type u
α
] :
FreeAddMagma: Type ?u.44611 → Type ?u.44611
FreeAddMagma
α: Type u
α
Lean.Format: Type
Lean.Format
|
FreeAddMagma.of: {α : Type ?u.44619} → αFreeAddMagma α
FreeAddMagma.of
x: α
x
=>
repr: {α : Type ?u.44634} → [inst : Repr α] → αLean.Format
repr
x: α
x
| x + y =>
"( ": String
"( "
++ x.
repr: {α : Type u} → [inst : Repr α] → FreeAddMagma αLean.Format
repr
++
" + ": String
" + "
++ y.
repr: {α : Type u} → [inst : Repr α] → FreeAddMagma αLean.Format
repr
++
" )": String
" )"
#align free_add_magma.repr
FreeAddMagma.repr: {α : Type u} → [inst : Repr α] → FreeAddMagma αLean.Format
FreeAddMagma.repr
attribute [
to_additive: {α : Type u} → [inst : Repr α] → FreeAddMagma αLean.Format
to_additive
existing]
FreeMagma.repr: {α : Type u} → [inst : Repr α] → FreeMagma αLean.Format
FreeMagma.repr
@[
to_additive: {α : Type u} → [inst : Repr α] → Repr (FreeAddMagma α)
to_additive
]
instance: {α : Type u} → [inst : Repr α] → Repr (FreeMagma α)
instance
{
α: Type u
α
:
Type u: Type (u+1)
Type u
} [
Repr: Type ?u.45821 → Type ?u.45821
Repr
α: Type u
α
] :
Repr: Type ?u.45824 → Type ?u.45824
Repr
(
FreeMagma: Type ?u.45825 → Type ?u.45825
FreeMagma
α: Type u
α
) := ⟨fun
o: ?m.45835
o
_: ?m.45838
_
=>
FreeMagma.repr: {α : Type ?u.45840} → [inst : Repr α] → FreeMagma αLean.Format
FreeMagma.repr
o: ?m.45835
o
⟩ /-- Length of an element of a free magma. -/ def
FreeMagma.length: {α : Type u} → FreeMagma α
FreeMagma.length
{
α: Type u
α
:
Type u: Type (u+1)
Type u
} :
FreeMagma: Type ?u.45983 → Type ?u.45983
FreeMagma
α: Type u
α
: Type
|
FreeMagma.of: {α : Type ?u.45990} → αFreeMagma α
FreeMagma.of
_x: α
_x
=>
1: ?m.46006
1
|
x: FreeMagma α
x
*
y: FreeMagma α
y
=>
x: FreeMagma α
x
.
length: {α : Type u} → FreeMagma α
length
+
y: FreeMagma α
y
.
length: {α : Type u} → FreeMagma α
length
#align free_magma.length
FreeMagma.length: {α : Type u} → FreeMagma α
FreeMagma.length
/-- Length of an element of a free additive magma. -/ def
FreeAddMagma.length: {α : Type u} → FreeAddMagma α
FreeAddMagma.length
{
α: Type u
α
:
Type u: Type (u+1)
Type u
} :
FreeAddMagma: Type ?u.46419 → Type ?u.46419
FreeAddMagma
α: Type u
α
: Type
|
FreeAddMagma.of: {α : Type ?u.46426} → αFreeAddMagma α
FreeAddMagma.of
_x: α
_x
=>
1: ?m.46442
1
| x + y => x.
length: {α : Type u} → FreeAddMagma α
length
+ y.
length: {α : Type u} → FreeAddMagma α
length
#align free_add_magma.length
FreeAddMagma.length: {α : Type u} → FreeAddMagma α
FreeAddMagma.length
attribute [
to_additive: {α : Type u} → FreeAddMagma α
to_additive
existing (attr := simp)]
FreeMagma.length: {α : Type u} → FreeMagma α
FreeMagma.length
/-- Associativity relations for an additive magma. -/ inductive
AddMagma.AssocRel: (α : Type u) → [inst : Add α] → ααProp
AddMagma.AssocRel
(
α: Type u
α
:
Type u: Type (u+1)
Type u
) [
Add: Type ?u.47130 → Type ?u.47130
Add
α: Type u
α
] :
α: Type u
α
α: Type u
α
Prop: Type
Prop
|
intro: ∀ {α : Type u} [inst : Add α] (x y z : α), AssocRel α (x + y + z) (x + (y + z))
intro
: ∀
x: ?m.47144
x
y: ?m.47147
y
z: ?m.47150
z
,
AddMagma.AssocRel: (α : Type u) → [inst : Add α] → ααProp
AddMagma.AssocRel
α: Type u
α
(
x: ?m.47144
x
+
y: ?m.47147
y
+
z: ?m.47150
z
) (
x: ?m.47144
x
+ (
y: ?m.47147
y
+
z: ?m.47150
z
)) |
left: ∀ {α : Type u} [inst : Add α] (w x y z : α), AssocRel α (w + (x + y + z)) (w + (x + (y + z)))
left
: ∀
w: ?m.47282
w
x: ?m.47285
x
y: ?m.47288
y
z: ?m.47291
z
,
AddMagma.AssocRel: (α : Type u) → [inst : Add α] → ααProp
AddMagma.AssocRel
α: Type u
α
(
w: ?m.47282
w
+ (
x: ?m.47285
x
+
y: ?m.47288
y
+
z: ?m.47291
z
)) (
w: ?m.47282
w
+ (
x: ?m.47285
x
+ (
y: ?m.47288
y
+
z: ?m.47291
z
))) #align add_magma.assoc_rel
AddMagma.AssocRel: (α : Type u) → [inst : Add α] → ααProp
AddMagma.AssocRel
/-- Associativity relations for a magma. -/ @[to_additive
AddMagma.AssocRel: (α : Type u) → [inst : Add α] → ααProp
AddMagma.AssocRel
"Associativity relations for an additive magma."] inductive
Magma.AssocRel: (α : Type u) → [inst : Mul α] → ααProp
Magma.AssocRel
(
α: Type u
α
:
Type u: Type (u+1)
Type u
) [
Mul: Type ?u.47493 → Type ?u.47493
Mul
α: Type u
α
] :
α: Type u
α
α: Type u
α
Prop: Type
Prop
|
intro: ∀ {α : Type u} [inst : Mul α] (x y z : α), AssocRel α (x * y * z) (x * (y * z))
intro
: ∀
x: ?m.47507
x
y: ?m.47510
y
z: ?m.47513
z
,
Magma.AssocRel: (α : Type u) → [inst : Mul α] → ααProp
Magma.AssocRel
α: Type u
α
(
x: ?m.47507
x
*
y: ?m.47510
y
*
z: ?m.47513
z
) (
x: ?m.47507
x
* (
y: ?m.47510
y
*
z: ?m.47513
z
)) |
left: ∀ {α : Type u} [inst : Mul α] (w x y z : α), AssocRel α (w * (x * y * z)) (w * (x * (y * z)))
left
: ∀
w: ?m.47669
w
x: ?m.47672
x
y: ?m.47675
y
z: ?m.47678
z
,
Magma.AssocRel: (α : Type u) → [inst : Mul α] → ααProp
Magma.AssocRel
α: Type u
α
(
w: ?m.47669
w
* (
x: ?m.47672
x
*
y: ?m.47675
y
*
z: ?m.47678
z
)) (
w: ?m.47669
w
* (
x: ?m.47672
x
* (
y: ?m.47675
y
*
z: ?m.47678
z
))) #align magma.assoc_rel
Magma.AssocRel: (α : Type u) → [inst : Mul α] → ααProp
Magma.AssocRel
namespace Magma /-- Semigroup quotient of a magma. -/ @[to_additive
AddMagma.FreeAddSemigroup: (α : Type u) → [inst : Add α] → Type u
AddMagma.FreeAddSemigroup
"Additive semigroup quotient of an additive magma."] def
AssocQuotient: (α : Type u) → [inst : Mul α] → Type u
AssocQuotient
(
α: Type u
α
:
Type u: Type (u+1)
Type u
) [
Mul: Type ?u.47908 → Type ?u.47908
Mul
α: Type u
α
] :
Type u: Type (u+1)
Type u
:=
Quot: {α : Sort ?u.47914} → (ααProp) → Sort ?u.47914
Quot
<|
AssocRel: (α : Type ?u.47916) → [inst : Mul α] → ααProp
AssocRel
α: Type u
α
#align magma.assoc_quotient
Magma.AssocQuotient: (α : Type u) → [inst : Mul α] → Type u
Magma.AssocQuotient
namespace AssocQuotient variable {
α: Type u
α
:
Type u: Type (u+1)
Type u
} [
Mul: Type ?u.51434 → Type ?u.51434
Mul
α: Type u
α
] @[
to_additive: ∀ {α : Type u} [inst : Add α] (x y z : α), Quot.mk (AddMagma.AssocRel α) (x + y + z) = Quot.mk (AddMagma.AssocRel α) (x + (y + z))
to_additive
] theorem
quot_mk_assoc: ∀ (x y z : α), Quot.mk (AssocRel α) (x * y * z) = Quot.mk (AssocRel α) (x * (y * z))
quot_mk_assoc
(
x: α
x
y: α
y
z: α
z
:
α: Type u
α
) :
Quot.mk: {α : Sort ?u.47967} → (r : ααProp) → αQuot r
Quot.mk
(
AssocRel: (α : Type ?u.47969) → [inst : Mul α] → ααProp
AssocRel
α: Type u
α
) (
x: α
x
*
y: α
y
*
z: α
z
) =
Quot.mk: {α : Sort ?u.48062} → (r : ααProp) → αQuot r
Quot.mk
_: ?m.48063?m.48063Prop
_
(
x: α
x
* (
y: α
y
*
z: α
z
)) :=
Quot.sound: ∀ {α : Sort ?u.48157} {r : ααProp} {a b : α}, r a bQuot.mk r a = Quot.mk r b
Quot.sound
(
AssocRel.intro: ∀ {α : Type ?u.48172} [inst : Mul α] (x y z : α), AssocRel α (x * y * z) (x * (y * z))
AssocRel.intro
_: ?m.48173
_
_: ?m.48173
_
_: ?m.48173
_
) #align magma.assoc_quotient.quot_mk_assoc
Magma.AssocQuotient.quot_mk_assoc: ∀ {α : Type u} [inst : Mul α] (x y z : α), Quot.mk (AssocRel α) (x * y * z) = Quot.mk (AssocRel α) (x * (y * z))
Magma.AssocQuotient.quot_mk_assoc
@[
to_additive: ∀ {α : Type u} [inst : Add α] (x y z w : α), Quot.mk (AddMagma.AssocRel α) (x + (y + z + w)) = Quot.mk (AddMagma.AssocRel α) (x + (y + (z + w)))
to_additive
] theorem
quot_mk_assoc_left: ∀ (x y z w : α), Quot.mk (AssocRel α) (x * (y * z * w)) = Quot.mk (AssocRel α) (x * (y * (z * w)))
quot_mk_assoc_left
(
x: α
x
y: α
y
z: α
z
w: α
w
:
α: Type u
α
) :
Quot.mk: {α : Sort ?u.48252} → (r : ααProp) → αQuot r
Quot.mk
(
AssocRel: (α : Type ?u.48254) → [inst : Mul α] → ααProp
AssocRel
α: Type u
α
) (
x: α
x
* (
y: α
y
*
z: α
z
*
w: α
w
)) =
Quot.mk: {α : Sort ?u.48375} → (r : ααProp) → αQuot r
Quot.mk
_: ?m.48376?m.48376Prop
_
(
x: α
x
* (
y: α
y
* (
z: α
z
*
w: α
w
))) :=
Quot.sound: ∀ {α : Sort ?u.48499} {r : ααProp} {a b : α}, r a bQuot.mk r a = Quot.mk r b
Quot.sound
(
AssocRel.left: ∀ {α : Type ?u.48514} [inst : Mul α] (w x y z : α), AssocRel α (w * (x * y * z)) (w * (x * (y * z)))
AssocRel.left
_: ?m.48515
_
_: ?m.48515
_
_: ?m.48515
_
_: ?m.48515
_
) #align magma.assoc_quotient.quot_mk_assoc_left
Magma.AssocQuotient.quot_mk_assoc_left: ∀ {α : Type u} [inst : Mul α] (x y z w : α), Quot.mk (AssocRel α) (x * (y * z * w)) = Quot.mk (AssocRel α) (x * (y * (z * w)))
Magma.AssocQuotient.quot_mk_assoc_left
@[
to_additive: {α : Type u} → [inst : Add α] → AddSemigroup (AddMagma.FreeAddSemigroup α)
to_additive
]
instance: {α : Type u} → [inst : Mul α] → Semigroup (AssocQuotient α)
instance
:
Semigroup: Type ?u.48591 → Type ?u.48591
Semigroup
(
AssocQuotient: (α : Type ?u.48592) → [inst : Mul α] → Type ?u.48592
AssocQuotient
α: Type u
α
) where mul
x: ?m.48611
x
y: ?m.48614
y
:=

Goals accomplished! 🐙
α: Type u

inst✝: Mul α

x, y: AssocQuotient α


α: Type u

inst✝: Mul α

x, y: AssocQuotient α


refine'_1
∀ (a b₁ b₂ : α), AssocRel α b₁ b₂(fun x y => Quot.mk (AssocRel α) (x * y)) a b₁ = (fun x y => Quot.mk (AssocRel α) (x * y)) a b₂
α: Type u

inst✝: Mul α

x, y: AssocQuotient α


refine'_2
∀ (a₁ a₂ b : α), AssocRel α a₁ a₂(fun x y => Quot.mk (AssocRel α) (x * y)) a₁ b = (fun x y => Quot.mk (AssocRel α) (x * y)) a₂ b
α: Type u

inst✝: Mul α

x, y: AssocQuotient α


α: Type u

inst✝: Mul α

x, y: AssocQuotient α


refine'_1
∀ (a b₁ b₂ : α), AssocRel α b₁ b₂(fun x y => Quot.mk (AssocRel α) (x * y)) a b₁ = (fun x y => Quot.mk (AssocRel α) (x * y)) a b₂
α: Type u

inst✝: Mul α

x, y: AssocQuotient α


refine'_1
∀ (a b₁ b₂ : α), AssocRel α b₁ b₂(fun x y => Quot.mk (AssocRel α) (x * y)) a b₁ = (fun x y => Quot.mk (AssocRel α) (x * y)) a b₂
α: Type u

inst✝: Mul α

x, y: AssocQuotient α


refine'_2
∀ (a₁ a₂ b : α), AssocRel α a₁ a₂(fun x y => Quot.mk (AssocRel α) (x * y)) a₁ b = (fun x y => Quot.mk (AssocRel α) (x * y)) a₂ b
α: Type u

inst✝: Mul α

x, y: AssocQuotient α

a, c, d, e: α


refine'_1.intro
(fun x y => Quot.mk (AssocRel α) (x * y)) a (c * d * e) = (fun x y => Quot.mk (AssocRel α) (x * y)) a (c * (d * e))
α: Type u

inst✝: Mul α

x, y: AssocQuotient α

a, c, d, e, f: α


refine'_1.left
(fun x y => Quot.mk (AssocRel α) (x * y)) a (c * (d * e * f)) = (fun x y => Quot.mk (AssocRel α) (x * y)) a (c * (d * (e * f)))
α: Type u

inst✝: Mul α

x, y: AssocQuotient α


refine'_1
∀ (a b₁ b₂ : α), AssocRel α b₁ b₂(fun x y => Quot.mk (AssocRel α) (x * y)) a b₁ = (fun x y => Quot.mk (AssocRel α) (x * y)) a b₂
α: Type u

inst✝: Mul α

x, y: AssocQuotient α

a, c, d, e: α


refine'_1.intro
(fun x y => Quot.mk (AssocRel α) (x * y)) a (c * d * e) = (fun x y => Quot.mk (AssocRel α) (x * y)) a (c * (d * e))
α: Type u

inst✝: Mul α

x, y: AssocQuotient α

a, c, d, e, f: α


refine'_1.left
(fun x y => Quot.mk (AssocRel α) (x * y)) a (c * (d * e * f)) = (fun x y => Quot.mk (AssocRel α) (x * y)) a (c * (d * (e * f)))
α: Type u

inst✝: Mul α

x, y: AssocQuotient α


refine'_1
∀ (a b₁ b₂ : α), AssocRel α b₁ b₂(fun x y => Quot.mk (AssocRel α) (x * y)) a b₁ = (fun x y => Quot.mk (AssocRel α) (x * y)) a b₂
α: Type u

inst✝: Mul α

x, y: AssocQuotient α

a, c, d, e: α


refine'_1.intro
Quot.mk (AssocRel α) (a * (c * d * e)) = Quot.mk (AssocRel α) (a * (c * (d * e)))
α: Type u

inst✝: Mul α

x, y: AssocQuotient α


refine'_1
∀ (a b₁ b₂ : α), AssocRel α b₁ b₂(fun x y => Quot.mk (AssocRel α) (x * y)) a b₁ = (fun x y => Quot.mk (AssocRel α) (x * y)) a b₂
α: Type u

inst✝: Mul α

x, y: AssocQuotient α

a, c, d, e: α


refine'_1.intro
Quot.mk (AssocRel α) (a * (c * d * e)) = Quot.mk (AssocRel α) (a * (c * (d * e)))
α: Type u

inst✝: Mul α

x, y: AssocQuotient α

a, c, d, e: α


refine'_1.intro
Quot.mk (AssocRel α) (a * (c * d * e)) = Quot.mk (AssocRel α) (a * (c * (d * e)))
α: Type u

inst✝: Mul α

x, y: AssocQuotient α

a, c, d, e, f: α


refine'_1.left
Quot.mk (AssocRel α) (a * (c * (d * e *