Dataset Viewer
Auto-converted to Parquet Duplicate
statement
stringlengths
1
16.5k
proof
stringlengths
0
117k
type
stringclasses
12 values
symbolic_name
stringlengths
1
16.4k
library
stringclasses
22 values
filename
stringlengths
29
118
imports
listlengths
0
20
deps
listlengths
0
22
docstring
stringclasses
234 values
source_url
stringclasses
1 value
commit
stringclasses
1 value
e : ℕ ≃ ℕ ⊕ α
Classical.choice (inferInstance : Nonempty (ℕ ≃ ℕ ⊕ α))
def
AdjoinFresh.e
Root
equational_theories/AdjoinFresh.lean
[ "Mathlib.Data.Countable.Defs", "Mathlib.Data.Sum.Basic", "Mathlib.SetTheory.Cardinal.Arithmetic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
adjoinFresh (m : ℕ) : ℕ ≃ ℕ ⊕ α
where toFun n := if n < m then .inl n else match e (n - m) with | .inl k => .inl (k + m) | .inr c => .inr c invFun | .inl k => if k < m then k else e.symm (.inl (k-m)) + m | .inr c => e.symm (.inr c) + m left_inv n := by dsimp by_cases h : n < m · simp [h] · simp [h] cases h'...
def
AdjoinFresh.adjoinFresh
Root
equational_theories/AdjoinFresh.lean
[ "Mathlib.Data.Countable.Defs", "Mathlib.Data.Sum.Basic", "Mathlib.SetTheory.Cardinal.Arithmetic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
adjoinFresh_fixed {m k: ℕ} (h : k < m) : adjoinFresh (α := α) m k = .inl k
by unfold adjoinFresh; simp [h]
theorem
AdjoinFresh.adjoinFresh_fixed
Root
equational_theories/AdjoinFresh.lean
[ "Mathlib.Data.Countable.Defs", "Mathlib.Data.Sum.Basic", "Mathlib.SetTheory.Cardinal.Arithmetic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
adjoinFresh_fixed' {m k: ℕ} (h : k < m) : (adjoinFresh (α := α ) m).symm (.inl k) = k
by unfold adjoinFresh; simp [h]
theorem
AdjoinFresh.adjoinFresh_fixed'
Root
equational_theories/AdjoinFresh.lean
[ "Mathlib.Data.Countable.Defs", "Mathlib.Data.Sum.Basic", "Mathlib.SetTheory.Cardinal.Arithmetic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution where E0 : Finset (G × G) E1 : Finset (G × G) f : G → G → G E0_subset_E1 : E0 ⊆ E1 t_mem_of_mem_E0' : ∀ x ∈ E0, (x.2, f x.1 x.2) ∈ E1 mem_2_of_mem_E0 : ∀ x ∈ E0, (x.1, f x.2 (f x.1 x.2)) ∈ E1 eq_of_mem_E0 : ∀ x ∈ E0, f x.1 (f x.2 (f x.1 x.2)) = x.2 undef_of_not_mem_E0' : ∀ x ∈ E1 \ E0, (...
structure
Asterix.PartialSolution
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.g (f : PartialSolution G) : G × G → G × G
fun (x, y) => (y, f.f x y)
abbrev
Asterix.PartialSolution.g
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.le_def {a b : PartialSolution G} : a ≤ b ↔ a.E0 ≤ b.E0 ∧ a.E1 ≤ b.E1 ∧ Set.EqOn a.f.uncurry b.f.uncurry a.E1
Iff.rfl
lemma
Asterix.PartialSolution.le_def
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.t_mem_of_mem_E0 (f : PartialSolution G) {x : G × G} (hx : x ∈ f.E0) : f.g x ∈ f.E1
f.t_mem_of_mem_E0' x hx
lemma
Asterix.PartialSolution.t_mem_of_mem_E0
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.undef_of_not_mem_E0 (f : PartialSolution G) (x : G × G) (hx : x ∉ f.E0) (hx2 : x ∈ f.E1) : f.g x ∉ f.E1
f.undef_of_not_mem_E0' x (by simp [*])
lemma
Asterix.PartialSolution.undef_of_not_mem_E0
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.move_rev_good (f : PartialSolution G) (x y : G) (z : G) (h1 : (y, x) ∉ f.E1) (h2 : (x, y) ∈ f.E1 → f.f x y ≠ x) (hz1 : ∀ x ∈ f.E1, x.2 ≠ z) (hz2 : ∀ x ∈ f.E1, f.f x.1 x.2 ≠ z) (hz3 : ∀ x ∈ f.E1, x.1 ≠ z) (hzx : z ≠ x) (hzy : z ≠ y) : PartialSolution G
let f' y' x' := if y' = y ∧ x' = x then z else if x' = z then y else f.f y' x' have f'_of_mem_E1 {a b : G} (ha : (a, b) ∈ f.E1) : f' a b = f.f a b := by dsimp [f'] rw [if_neg, if_neg] · exact hz1 _ ha · rintro ⟨rfl, rfl⟩; exact h1 ha have f'_of_mem_E0 {a b : G} (ha : (a, b) ∈ f.E0) : f' a b = f.f a ...
def
Asterix.PartialSolution.move_rev_good
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.le_move_rev_good (f : PartialSolution G) (x y : G) (z : G) (h1 : (y, x) ∉ f.E1) (h2 : (x, y) ∈ f.E1 → f.f x y ≠ x) (hz1 : ∀ x ∈ f.E1, x.2 ≠ z) (hz2 : ∀ x ∈ f.E1, f.f x.1 x.2 ≠ z) (hz3 : ∀ x ∈ f.E1, x.1 ≠ z) (hzx : z ≠ x) (hzy : z ≠ y) : f ≤ f.move_rev_good x y z h1 h2 hz1 hz2 hz3 hzx hzy
by simp only [move_rev_good, Finset.union_assoc, le_def, Finset.le_eq_subset, Finset.subset_union_left, true_and] rintro ⟨x', y'⟩ mem simp only [Function.uncurry_apply_pair] rw [if_neg, if_neg] · exact hz1 _ mem · rintro ⟨rfl, rfl⟩ exact h1 mem
lemma
Asterix.PartialSolution.le_move_rev_good
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.mem_move_rev_good (f : PartialSolution G) (x y : G) (z : G) (h1 : (y, x) ∉ f.E1) (h2 : (x, y) ∈ f.E1 → f.f x y ≠ x) (hz1 : ∀ x ∈ f.E1, x.2 ≠ z) (hz2 : ∀ x ∈ f.E1, f.f x.1 x.2 ≠ z) (hz3 : ∀ x ∈ f.E1, x.1 ≠ z) (hzx : z ≠ x) (hzy : z ≠ y) : (y, x) ∈ (f.move_rev_good x y z h1 h2 hz1 hz2 hz3 ...
by simp [move_rev_good]
lemma
Asterix.PartialSolution.mem_move_rev_good
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.mem_move_rev_good_of_app_eq (f : PartialSolution G) (x y : G) (z : G) (h1 : (y, x) ∉ f.E1) (h2 : (x, y) ∈ f.E1 → f.f x y ≠ x) (hz1 : ∀ x ∈ f.E1, x.2 ≠ z) (hz2 : ∀ x ∈ f.E1, f.f x.1 x.2 ≠ z) (hz3 : ∀ x ∈ f.E1, x.1 ≠ z) (hzx : z ≠ x) (hzy : z ≠ y) (a : G) (hbm : (a, y) ∈ f.E1) (hp : f.f a y = ...
by simp [move_rev_good, hbm, hp]
lemma
Asterix.PartialSolution.mem_move_rev_good_of_app_eq
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.move_rev_bad (f : PartialSolution G) (x y : G) (z : G) (h1 : (y, x) ∉ f.E1) (h2 : (x, y) ∈ f.E1) (h22 : f.f x y = x) (hz1 : ∀ x ∈ f.E1, x.2 ≠ z) (hz2 : ∀ x ∈ f.E1, f.f x.1 x.2 ≠ z) (hz3 : ∀ x ∈ f.E1, x.1 ≠ z) (hzx : z ≠ x) (hzy : z ≠ y) : PartialSolution G
let f' y' x' := if y' = y ∧ x' = x then z else if x' = z then y else f.f y' x' have f'_of_mem_E1 {a b : G} (ha : (a, b) ∈ f.E1) : f' a b = f.f a b := by dsimp [f'] rw [if_neg, if_neg] · exact hz1 _ ha · rintro ⟨rfl, rfl⟩ exact h1 ha have f'_of_mem_E0 {a b : G} (ha : (a, b) ∈ f.E0) : f' a b = f...
def
Asterix.PartialSolution.move_rev_bad
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.le_move_rev_bad (f : PartialSolution G) (x y : G) (z : G) (h1 : (y, x) ∉ f.E1) (h2 : (x, y) ∈ f.E1) (h22 : f.f x y = x) (hz1 : ∀ x ∈ f.E1, x.2 ≠ z) (hz2 : ∀ x ∈ f.E1, f.f x.1 x.2 ≠ z) (hz3 : ∀ x ∈ f.E1, x.1 ≠ z) (hzx : z ≠ x) (hzy : z ≠ y) : f ≤ f.move_rev_bad x y z h1 h2 h22 hz1 hz2 hz3...
by simp only [move_rev_bad, Finset.union_assoc, le_def, Finset.le_eq_subset, Finset.subset_union_left, true_and] rintro ⟨x', y'⟩ mem simp only [Function.uncurry_apply_pair] rw [if_neg, if_neg] · exact hz1 _ mem · rintro ⟨rfl, rfl⟩ exact h1 mem
lemma
Asterix.PartialSolution.le_move_rev_bad
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.mem_move_rev_bad (f : PartialSolution G) (x y : G) (z : G) (h1 : (y, x) ∉ f.E1) (h2 : (x, y) ∈ f.E1) (h22 : f.f x y = x) (hz1 : ∀ x ∈ f.E1, x.2 ≠ z) (hz2 : ∀ x ∈ f.E1, f.f x.1 x.2 ≠ z) (hz3 : ∀ x ∈ f.E1, x.1 ≠ z) (hzx : z ≠ x) (hzy : z ≠ y) : (y, x) ∈ (f.move_rev_bad x y z h1 h2 h22 hz1 ...
by simp [move_rev_bad]
lemma
Asterix.PartialSolution.mem_move_rev_bad
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.mem_move_rev_bad_of_app_eq (f : PartialSolution G) (x y : G) (z : G) (h1 : (y, x) ∉ f.E1) (h2 : (x, y) ∈ f.E1) (h22 : f.f x y = x) (hz1 : ∀ x ∈ f.E1, x.2 ≠ z) (hz2 : ∀ x ∈ f.E1, f.f x.1 x.2 ≠ z) (hz3 : ∀ x ∈ f.E1, x.1 ≠ z) (hzx : z ≠ x) (hzy : z ≠ y) (a : G) (hbm : (a, y) ∈ f.E1) (hp : f.f a...
by simp [move_rev_bad, hbm, hp]
lemma
Asterix.PartialSolution.mem_move_rev_bad_of_app_eq
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Denumerable.notMemFinset (s : Finset G) : G
Denumerable.ofNat G (Nat.find (Infinite.exists_notMem_finset (s.image Encodable.encode)))
def
Asterix.Denumerable.notMemFinset
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Denumerable.notMemFinset_prop (s : Finset G) : Denumerable.notMemFinset s ∉ s
by simp only [notMemFinset, Finset.mem_image, not_exists, not_and] intro mem have : Nat.find (Infinite.exists_notMem_finset (s.image Encodable.encode)) ∈ s.image Encodable.encode := by rw [Finset.mem_image] exact ⟨_, mem, by simp⟩ have : Nat.find (Infinite.exists_notMem_finset (s.image Encodable.encode)...
theorem
Asterix.Denumerable.notMemFinset_prop
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.move_rev_good' (f : PartialSolution G) (x y : G) (h1 : (y, x) ∉ f.E1) (h2 : (x, y) ∈ f.E1 → f.f x y ≠ x) : PartialSolution G
by -- This intentionally used `by` for data. let z : G := Denumerable.notMemFinset (f.E1.image (·.1) ∪ f.E1.image (·.2) ∪ f.E1.image (fun ⟨a, b⟩ ↦ f.f a b) ∪ {x, y}) have zp := Denumerable.notMemFinset_prop (f.E1.image (·.1) ∪ f.E1.image (·.2) ∪ f.E1.image (fun ⟨a, b⟩ ↦ f.f a b) ∪ {x, y}) change z ∉ _ at zp sim...
def
Asterix.PartialSolution.move_rev_good'
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.le_move_rev_good' (f : PartialSolution G) (x y : G) (h1 : (y, x) ∉ f.E1) (h2 : (x, y) ∈ f.E1 → f.f x y ≠ x) : f ≤ f.move_rev_good' x y h1 h2
by simp [move_rev_good', le_move_rev_good]
lemma
Asterix.PartialSolution.le_move_rev_good'
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.mem_move_rev_good' (f : PartialSolution G) (x y : G) (h1 : (y, x) ∉ f.E1) (h2 : (x, y) ∈ f.E1 → f.f x y ≠ x) : (y, x) ∈ (f.move_rev_good' x y h1 h2).E1
by simp [move_rev_good', mem_move_rev_good]
lemma
Asterix.PartialSolution.mem_move_rev_good'
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.mem_move_rev_good'_of_app_eq (f : PartialSolution G) (x y : G) (h1 : (y, x) ∉ f.E1) (h2 : (x, y) ∈ f.E1 → f.f x y ≠ x) (a : G) (hbm : (a, y) ∈ f.E1) (hp : f.f a y = x) : (a, y) ∈ (f.move_rev_good' x y h1 h2).E0
by simp [move_rev_good', mem_move_rev_good_of_app_eq, hbm, hp]
lemma
Asterix.PartialSolution.mem_move_rev_good'_of_app_eq
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.move_rev_bad' (f : PartialSolution G) (x y : G) (h1 : (y, x) ∉ f.E1) (h2 : (x, y) ∈ f.E1) (h22 : f.f x y = x) : PartialSolution G
by let z : G := Denumerable.notMemFinset (f.E1.image (·.1) ∪ f.E1.image (·.2) ∪ f.E1.image (fun ⟨a, b⟩ ↦ f.f a b) ∪ {x, y}) have zp := Denumerable.notMemFinset_prop (f.E1.image (·.1) ∪ f.E1.image (·.2) ∪ f.E1.image (fun ⟨a, b⟩ ↦ f.f a b) ∪ {x, y}) change z ∉ _ at zp simp only [Finset.union_assoc, Finset.union_i...
def
Asterix.PartialSolution.move_rev_bad'
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.le_move_rev_bad' (f : PartialSolution G) (x y : G) (h1 : (y, x) ∉ f.E1) (h2 : (x, y) ∈ f.E1) (h22 : f.f x y = x) : f ≤ f.move_rev_bad' x y h1 h2 h22
by simp [move_rev_bad', le_move_rev_bad]
lemma
Asterix.PartialSolution.le_move_rev_bad'
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.mem_move_rev_bad' (f : PartialSolution G) (x y : G) (h1 : (y, x) ∉ f.E1) (h2 : (x, y) ∈ f.E1) (h22 : f.f x y = x) : (y, x) ∈ (f.move_rev_bad' x y h1 h2 h22).E1
by simp [move_rev_bad', mem_move_rev_bad]
lemma
Asterix.PartialSolution.mem_move_rev_bad'
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.mem_move_rev_bad'_of_app_eq (f : PartialSolution G) (x y : G) (h1 : (y, x) ∉ f.E1) (h2 : (x, y) ∈ f.E1) (h22 : f.f x y = x) (a : G) (hbm : (a, y) ∈ f.E1) (hp : f.f a y = x) : (a, y) ∈ (f.move_rev_bad' x y h1 h2 h22).E0
by simp [move_rev_bad', mem_move_rev_bad_of_app_eq, hbm, hp]
lemma
Asterix.PartialSolution.mem_move_rev_bad'_of_app_eq
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.act (f : PartialSolution G) (x y : G) (h1 : (y, x) ∉ f.E1) : PartialSolution G
if h2 : (x, y) ∈ f.E1 → f.f x y ≠ x then f.move_rev_good' x y h1 h2 else f.move_rev_bad' x y h1 (by simp_all) (by simp_all)
def
Asterix.PartialSolution.act
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.le_act (f : PartialSolution G) (x y : G) (h1 : (y, x) ∉ f.E1) : f ≤ f.act x y h1
by unfold act split · apply le_move_rev_good' · apply le_move_rev_bad'
lemma
Asterix.PartialSolution.le_act
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.mem_act (f : PartialSolution G) (x y : G) (h1 : (y, x) ∉ f.E1) : (y, x) ∈ (f.act x y h1).E1
by unfold act split · apply mem_move_rev_good' · apply mem_move_rev_bad'
lemma
Asterix.PartialSolution.mem_act
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.mem_act_of_app_eq (f : PartialSolution G) (x y : G) (h1 : (y, x) ∉ f.E1) (a : G) (hbm : (a, y) ∈ f.E1) (hp : f.f a y = x) : (a, y) ∈ (f.act x y h1).E0
by unfold act split · apply mem_move_rev_good'_of_app_eq <;> assumption · apply mem_move_rev_bad'_of_app_eq <;> assumption
lemma
Asterix.PartialSolution.mem_act_of_app_eq
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.add_e1 (f : PartialSolution G) (x y : G) : PartialSolution G
if h1 : (y, x) ∈ f.E1 then f else f.act x y h1
def
Asterix.PartialSolution.add_e1
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.le_add_e1 (f : PartialSolution G) (x y : G) : f ≤ f.add_e1 x y
by unfold add_e1 split · rfl · apply le_act
lemma
Asterix.PartialSolution.le_add_e1
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.mem_add_e1 (f : PartialSolution G) (x y : G) : (y, x) ∈ (f.add_e1 x y).E1
by unfold add_e1 split · assumption · apply mem_act
lemma
Asterix.PartialSolution.mem_add_e1
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.mem_add_e1_of_app_eq (f : PartialSolution G) (x y : G) (a : G) (hbm : (a, y) ∈ f.E1) (hp : f.f a y = x) : (a, y) ∈ (f.add_e1 x y).E0
by unfold add_e1 split · by_contra! nh apply f.undef_of_not_mem_E0 _ nh hbm simpa [g, hp] · apply mem_act_of_app_eq <;> assumption
lemma
Asterix.PartialSolution.mem_add_e1_of_app_eq
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.add_e0 (f : PartialSolution G) (x y : G) : PartialSolution G
let f' := f.add_e1 x y f'.add_e1 (f'.f y x) x
def
Asterix.PartialSolution.add_e0
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.le_add_e0 (f : PartialSolution G) (x y : G) : f ≤ f.add_e0 x y
by unfold add_e0 trans f.add_e1 x y <;> apply le_add_e1
lemma
Asterix.PartialSolution.le_add_e0
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
PartialSolution.mem_add_e0 (f : PartialSolution G) (x y : G) : (y, x) ∈ (f.add_e0 x y).E0
by apply mem_add_e1_of_app_eq · apply mem_add_e1 · rfl
lemma
Asterix.PartialSolution.mem_add_e0
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
closureSeq (f : PartialSolution G) : ℕ → PartialSolution G
| 0 => f | n+1 => (closureSeq f n).add_e0 (Denumerable.ofNat (G × G) n).2 (Denumerable.ofNat (G × G) n).1
def
Asterix.closureSeq
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
closureSeq_le_closureSeq_succ (f : PartialSolution G) (n : ℕ) : closureSeq f n ≤ closureSeq f (n + 1)
PartialSolution.le_add_e0 ..
lemma
Asterix.closureSeq_le_closureSeq_succ
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
mem_closureSeq_e0 (f : PartialSolution G) (a b : G) : (a, b) ∈ (closureSeq f (Encodable.encode (a, b) + 1)).E0
by simp only [closureSeq, Denumerable.ofNat_encode] apply PartialSolution.mem_add_e0
lemma
Asterix.mem_closureSeq_e0
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
closureSeq_mono (f : PartialSolution G) : Monotone (closureSeq f)
by intro n m hnm obtain ⟨m, rfl⟩ := Nat.exists_eq_add_of_le hnm clear hnm induction m with | zero => rfl | succ m hm => exact hm.trans (closureSeq_le_closureSeq_succ ..)
lemma
Asterix.closureSeq_mono
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
le_closureSeq (f : PartialSolution G) (n : ℕ) : f ≤ closureSeq f n
closureSeq_mono f (Nat.zero_le n)
lemma
Asterix.le_closureSeq
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
closure (f : PartialSolution G) : G → G → G
fun a b ↦ (closureSeq f (Encodable.encode (a, b) + 1)).f a b
def
Asterix.closure
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
closure_eq_of_mem_e1 (f : PartialSolution G) (n : ℕ) (a b : G) (hn : (a, b) ∈ (closureSeq f n).E1) : closure f a b = (closureSeq f n).f a b
by simp only [closure] rcases le_total n (Encodable.encode (a, b) + 1) with h | h · exact (closureSeq_mono f h).2.2.symm hn · exact (closureSeq_mono f h).2.2 (PartialSolution.E0_subset_E1 _ (mem_closureSeq_e0 f a b))
lemma
Asterix.closure_eq_of_mem_e1
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
closure_prop (f : PartialSolution G) : ∀ x y, closure f x (closure f y (closure f x y)) = y
by intro x y rw [closure_eq_of_mem_e1 f (Encodable.encode (x, y) + 1) x y, closure_eq_of_mem_e1 f (Encodable.encode (x, y) + 1) y, closure_eq_of_mem_e1 f (Encodable.encode (x, y) + 1)] · exact PartialSolution.eq_of_mem_E0 _ _ (mem_closureSeq_e0 ..) · exact PartialSolution.mem_2_of_mem_E0 _ _ (mem_closur...
theorem
Asterix.closure_prop
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
initial : PartialSolution ℕ
where E0 := {(0, 0), (1, 0), (0, 1), (0, 8), (8, 8), (8, 0)} E1 := {(0, 0), (1, 0), (0, 2), (1, 3), (0, 3), (1, 1), (0, 5), (1, 6), (0, 1), (0, 8), (8, 8), (1, 8), (0, 9), (8, 0), (0, 10), (8, 10), (10, 10), (2, 0)} f a b := if a = 0 then [1, 8, 3, 4, 100, 6, 100, 100, 0, 1, 8].getD b 0 else if a = 1 ...
def
Asterix.initial
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Equation65_facts : ∃ (G : Type) (_ : Magma G), Facts G [65] [614, 817, 1426, 3862, 4065]
by use ℕ, ⟨closure initial⟩ simp only [Equation65, closure_prop, implies_true, not_forall, true_and] split_ands repeat { use 0 nth_rw 4 [closure_eq_of_mem_e1 _ 0] nth_rw 3 [closure_eq_of_mem_e1 _ 0] nth_rw 2 [closure_eq_of_mem_e1 _ 0] nth_rw 1 [closure_eq_of_mem_e1 _ 0] · decide · de...
theorem
Asterix.Equation65_facts
Root
equational_theories/Asterix.lean
[ "equational_theories.FactsSyntax", "equational_theories.EquationalResult", "Mathlib.Algebra.Order.Ring.Nat", "Mathlib.Logic.Denumerable", "Mathlib.Tactic.Recall", "equational_theories.Equations.Basic" ]
[ "Facts", "Magma" ]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
ofMatrix {n : Nat} [Inhabited (Fin n)] (table : Array (Array (Fin n))) (x y : Fin n) : Fin n
table[x.val]![y.val]!
def
ofMatrix
Root
equational_theories/CentralGroupoids.lean
[ "equational_theories.Equations.All", "equational_theories.FactsSyntax", "equational_theories.MemoFinOp", "equational_theories.DecideBang", "equational_theories.Homomorphisms", "equational_theories.SmallMagmas", "Mathlib.Tactic.Linarith", "Mathlib.Tactic.NormNum" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
MagmaA21 : Magma (Fin 3)
where op := memoFinOp (ofMatrix #[ #[0, 1, 2], #[0, 2, 1], #[0, 2, 1] ])
def
MagmaA21
Root
equational_theories/CentralGroupoids.lean
[ "equational_theories.Equations.All", "equational_theories.FactsSyntax", "equational_theories.MemoFinOp", "equational_theories.DecideBang", "equational_theories.Homomorphisms", "equational_theories.SmallMagmas", "Mathlib.Tactic.Linarith", "Mathlib.Tactic.NormNum" ]
[ "Magma", "ofMatrix" ]
A 3x3 helper magma, A21, which streamlines the full construction.
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
MagmaA2 : Magma (Fin 3 × Fin 3)
where op (p1 p2 : Fin 3 × Fin 3) : Fin 3 × Fin 3 := match p1, p2 with | (a, b), (⟨0, _⟩, _) => (MagmaA21.op a b, ⟨0, by decide⟩) | (_, b), (c, ⟨0, _⟩) => (b, MagmaA21.op b c) | (_, b), (c, _) => (b, c)
def
MagmaA2
Root
equational_theories/CentralGroupoids.lean
[ "equational_theories.Equations.All", "equational_theories.FactsSyntax", "equational_theories.MemoFinOp", "equational_theories.DecideBang", "equational_theories.Homomorphisms", "equational_theories.SmallMagmas", "Mathlib.Tactic.Linarith", "Mathlib.Tactic.NormNum" ]
[ "Magma" ]
We define Knuth's A2 here in terms of A21.
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
MagmaA2T : Magma (Fin 9)
where op := memoFinOp (ofMatrix #[ #[0, 0, 0, 1, 1, 1, 2, 2, 2], #[3, 3, 3, 5, 4, 4, 4, 5, 5], #[6, 6, 6, 8, 7, 7, 7, 8, 8], #[0, 0, 0, 1, 1, 1, 2, 2, 2], #[6, 6, 6, 5, 4, 4, 4, 5, 5], #[3, 3, 3, 8, 7, 7, 7, 8, 8], #[0, 0, 0, 1, 1, 1, 2, 2, 2], #[6, 6, 6, 5, 4, 4, 4, 5, 5], #[3, 3, 3, 8, 7, 7, 7, 8, 8]])
def
MagmaA2T
Root
equational_theories/CentralGroupoids.lean
[ "equational_theories.Equations.All", "equational_theories.FactsSyntax", "equational_theories.MemoFinOp", "equational_theories.DecideBang", "equational_theories.Homomorphisms", "equational_theories.SmallMagmas", "Mathlib.Tactic.Linarith", "Mathlib.Tactic.NormNum" ]
[ "Magma", "ofMatrix" ]
A magma isomorphic to A2, given as an optable.
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
equiv_F3xF3_F9 : (Fin 3 × Fin 3) ≃ (Fin 9)
where toFun := fun (p : Fin 3 × Fin 3) => let a := p.1.val let b := p.2.val have ha : a < 3 := p.1.isLt have hb : b < 3 := p.2.isLt have h2a : b + 3 * a < 9 := by linarith Fin.mk (b + 3 * a) h2a invFun := fun (n : Fin 9) => let a := n.val / 3 let b := n.val % 3 have ha : a < 3 :...
def
equiv_F3xF3_F9
Root
equational_theories/CentralGroupoids.lean
[ "equational_theories.Equations.All", "equational_theories.FactsSyntax", "equational_theories.MemoFinOp", "equational_theories.DecideBang", "equational_theories.Homomorphisms", "equational_theories.SmallMagmas", "Mathlib.Tactic.Linarith", "Mathlib.Tactic.NormNum" ]
[]
Fin 3 × Fin 3 is isomorphic to Fin 9 as a set.
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
equiv_MagmaA2_MagmaA2T : (Fin 3 × Fin 3) ≃◇ (Fin 9)
where toEquiv := equiv_F3xF3_F9 map_op' := by intro x y match x with | (⟨n, _⟩, ⟨m, _⟩) => match y with | (⟨k, _⟩, ⟨l, _⟩) => match n, m, k, l with | 0, 0, 0, 0 | 0, 0, 0, 1 | 0, 0, 0, 2 | 0, 0, 1, 0 | 0, 0, 1, 1 | 0, 0, 1, 2 | 0, 0, 2, 0 | 0, 0, 2, 1 | 0, 0, ...
def
equiv_MagmaA2_MagmaA2T
Root
equational_theories/CentralGroupoids.lean
[ "equational_theories.Equations.All", "equational_theories.FactsSyntax", "equational_theories.MemoFinOp", "equational_theories.DecideBang", "equational_theories.Homomorphisms", "equational_theories.SmallMagmas", "Mathlib.Tactic.Linarith", "Mathlib.Tactic.NormNum" ]
[ "equiv_F3xF3_F9" ]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
MagmaA2T.Facts : ∃ (G : Type) (_ : Magma G), Facts G [168, 1480, 1483, 1484, 1485, 1486, 1487, 2052, 2089, 2126, 2162, 2163, 2164] [3461, 3462, 3463, 3521, 3522, 3523, 3532, 3533, 3534, 3535, 3864, 3880, 3883, 3915, 3921, 3952, 3958, 3989, 3997, 4001, 4268, 4282, 4314, 4315, 4339, 4357, 4587, 4606, 4615, 4645, 4666...
⟨Fin 9, MagmaA2T, by decideFin!⟩
theorem
MagmaA2T.Facts
Root
equational_theories/CentralGroupoids.lean
[ "equational_theories.Equations.All", "equational_theories.FactsSyntax", "equational_theories.MemoFinOp", "equational_theories.DecideBang", "equational_theories.Homomorphisms", "equational_theories.SmallMagmas", "Mathlib.Tactic.Linarith", "Mathlib.Tactic.NormNum" ]
[ "Facts", "Magma", "MagmaA2T" ]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
GraphEdge where lhs : String rhs : String deriving DecidableEq, Hashable, Lean.ToJson, Lean.FromJson
structure
Closure.GraphEdge
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Edge | implication : GraphEdge → Edge | nonimplication : GraphEdge → Edge deriving DecidableEq, Hashable
inductive
Closure.Edge
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Edge.isTrue : Edge → Bool
| .implication _ => true | .nonimplication _ => false
def
Closure.Edge.isTrue
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Edge.get : Edge → GraphEdge
| .nonimplication x | .implication x => x
def
Closure.Edge.get
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Edge.lhs : Edge → String
GraphEdge.lhs ∘ get
def
Closure.Edge.lhs
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Edge.rhs : Edge → String
GraphEdge.rhs ∘ get
def
Closure.Edge.rhs
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Outcome /-- the implication has an explicit proof -/ | explicit_proof_true /-- the implication can be derived from proven theorems -/ | implicit_proof_true /-- the implication is explicitly conjectured -/ | explicit_conjecture_true /-- the implication can be derived from theorems and conjectures -/ | im...
inductive
Closure.Outcome
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Outcome.implicit_theorem : Bool → Outcome
| true => implicit_proof_true | false => implicit_proof_false
def
Closure.Outcome.implicit_theorem
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Outcome.explicit_theorem : Bool → Outcome
| true => explicit_proof_true | false => explicit_proof_false
def
Closure.Outcome.explicit_theorem
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Outcome.implicit_conjecture : Bool → Outcome
| true => implicit_conjecture_true | false => implicit_conjecture_false
def
Closure.Outcome.implicit_conjecture
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Outcome.explicit_conjecture : Bool → Outcome
| true => explicit_conjecture_true | false => explicit_conjecture_false
def
Closure.Outcome.explicit_conjecture
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Outcome.isExplicit : Outcome → Bool
| explicit_proof_true => true | implicit_proof_true => false | explicit_conjecture_true => true | implicit_conjecture_true => false | unknown => false | implicit_conjecture_false => false | explicit_conjecture_false => true | implicit_proof_false => false | explicit_proof_false => true
def
Closure.Outcome.isExplicit
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Outcome.isProven : Outcome → Bool
| explicit_proof_true => true | implicit_proof_true => true | explicit_conjecture_true => false | implicit_conjecture_true => false | unknown => false | implicit_conjecture_false => false | explicit_conjecture_false => false | implicit_proof_false => true | explicit_proof_false => true
def
Closure.Outcome.isProven
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Outcome.isTrue : Outcome → Bool
| explicit_proof_true => true | implicit_proof_true => true | explicit_conjecture_true => true | implicit_conjecture_true => true | unknown => false | implicit_conjecture_false => false | explicit_conjecture_false => false | implicit_proof_false => false | explicit_proof_false => false
def
Closure.Outcome.isTrue
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
dfs1 (graph : Array (Array Nat)) (vertex : Nat) (vis : Array Bool) (order : Array Nat) : Array Bool × Array Nat
Id.run do let mut vis1 := vis.set! vertex true let mut ord := order for v in graph[vertex]! do unless vis1[v]! do (vis1, ord) := dfs1 graph v vis1 ord pure (vis1, ord.push vertex)
def
Closure.dfs1
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
dfs2 (graph : Array (Array Nat)) (vertex : Nat) (component : Array Nat) (component_id : Nat) : Array Nat
Id.run do let mut comp := component.set! vertex component_id for v in graph[vertex]! do if component[v]! == 0 then comp := dfs2 graph v comp component_id pure comp
def
Closure.dfs2
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Bitset
Array UInt64
def
Closure.Bitset
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
This is a bitset (https://en.cppreference.com/w/cpp/utility/bitset). It represents an array of bits by directly packing them to UInt64, which makes some operations more efficient. This is also more space-efficient.
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Bitset.toArray : Bitset → Array UInt64
id
def
Closure.Bitset.toArray
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Bitset.mk (n : Nat) : Bitset
Array.replicate ((n + 63) >>> 6) 0
def
Closure.Bitset.mk
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Bitset.set (b : Bitset) (n : Nat) : Bitset
b.modify (n >>> 6) (fun x ↦ x ||| (1 <<< ((UInt64.ofNat n) &&& 63)))
def
Closure.Bitset.set
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Bitset.get (b : Bitset) (n : Nat) : Bool
(b.toArray[n >>> 6]! >>> ((UInt64.ofNat n) &&& 63)) &&& 1 != 0
def
Closure.Bitset.get
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
DenseNumbering (α : Type) [BEq α] [Hashable α] where in_order : Array α index : Std.HashMap α Nat
structure
Closure.DenseNumbering
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
DenseNumbering.size {α : Type} [BEq α] [Hashable α] (num : DenseNumbering α) : Nat
num.in_order.size
def
Closure.DenseNumbering.size
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
DenseNumbering.fromArray {α : Type} [BEq α] [Hashable α] (elts : Array α) : DenseNumbering α
let index := Std.HashMap.ofList (elts.mapIdx (fun i x => (x, i))).toList ⟨elts, index⟩
def
Closure.DenseNumbering.fromArray
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
DenseNumbering.map {α β : Type} [BEq α] [BEq β] [Hashable α] [Hashable β] (num : DenseNumbering α) (f : α → β) : DenseNumbering β
DenseNumbering.fromArray (num.in_order.map f)
def
Closure.DenseNumbering.map
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
ltEquationNames (a b : String) : Bool
assert! a.startsWith "Equation" assert! b.startsWith "Equation" let aNum := (a.toRawSubstring.drop 8).toNat?.get! let bNum := (b.toRawSubstring.drop 8).toNat?.get! aNum < bNum
def
Closure.ltEquationNames
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
equationSet (inp : Array EntryVariant) : Std.HashSet String
Id.run do let mut eqs : Std.HashSet String := {} for imp in inp do match imp with | .implication ⟨lhs, rhs, _⟩ => eqs := eqs.insert lhs eqs := eqs.insert rhs | .facts ⟨satisfied, refuted, _⟩ => for eq in satisfied ++ refuted do eqs := eqs.insert eq | .unconditional eq => ...
def
Closure.equationSet
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[ "EntryVariant" ]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
number_equations (inp : Array EntryVariant) : DenseNumbering String
-- number the equations for easier processing DenseNumbering.fromArray ((equationSet inp).toArray.qsort ltEquationNames)
def
Closure.number_equations
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[ "EntryVariant" ]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
toEdges (inp : Array EntryVariant) : Array Edge
Id.run do let eqs := number_equations inp let mut edges : Array Edge := Array.mkEmpty inp.size let mut nonimplies : Array Bitset := Array.replicate eqs.size (Bitset.mk eqs.size) for imp in inp do match imp with | .implication ⟨lhs, rhs, _⟩ => edges := edges.push (.implication ⟨lhs, rhs⟩) | .fa...
def
Closure.toEdges
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[ "EntryVariant" ]
This transforms the `Facts` in the input array to `Edge`s
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Reachability where size : Nat reachable : Array Bitset components : Array (Array Nat)
structure
Closure.Reachability
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
closure_aux (inp : Array EntryVariant) (duals: Std.HashMap Nat Nat) (eqs : DenseNumbering String) : IO Reachability
do -- construct the implication/non-implication graph let n := eqs.size let mut graph_size := 2 * n let mut graph : Array (Array Nat) := Array.replicate graph_size #[] let mut revgraph : Array (Array Nat) := Array.replicate graph_size #[] for imp in inp do match imp with | .implication imp => ...
def
Closure.closure_aux
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[ "EntryVariant" ]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
number_duals (duals: Std.HashMap String String) (eqs: DenseNumbering String)
Std.HashMap.ofList <| duals.toList.map (λ (i, j) ↦ (eqs[i]!, eqs[j]!))
def
Closure.number_duals
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
closure (inp : Array EntryVariant) (duals: Std.HashMap String String) : IO (Array Edge)
do let eqs := number_equations inp let n := eqs.size let duals := number_duals duals eqs -- extract the implications let mut ans : Array Edge := Array.mkEmpty (n*n) for ⟨x, y, is_true⟩ in ← closure_aux inp duals eqs do unless x == y do if is_true then ans := ans.push (.implication ⟨eqs.i...
def
Closure.closure
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[ "EntryVariant" ]
This computes the closure of the implications/non-implications represented by `inp`.
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
list_outcomes (res : Array Entry) (duals: Std.HashMap String String): IO (Array String × Array (Array Outcome))
do let rs := res.map (·.variant) let prs := res.filter (·.proven) |>.map (·.variant) let eqs := number_equations rs let duals := number_duals duals eqs let n := eqs.size let mut outcomes : Array (Array Outcome) := Array.replicate n (Array.replicate n .unknown) for edge in toEdges prs do outcomes := ou...
def
Closure.list_outcomes
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[ "Entry", "outcomes" ]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
outcomes_mod_equiv (inp : Array EntryVariant) (duals: Std.HashMap String String) : IO (DenseNumbering (Array String) × Array (Array (Option Bool)))
do let eqs := number_equations inp let n := eqs.size let duals := number_duals duals eqs let reachable ← closure_aux inp duals eqs let comps := reachable.components.filter (·[0]! < n) |> DenseNumbering.fromArray let mut implies : Array (Array (Option Bool)) := Array.replicate comps.size (Array.replicat...
def
Closure.outcomes_mod_equiv
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[ "EntryVariant" ]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
DualityRelation where dualEquations : Std.HashMap String String
structure
Closure.DualityRelation
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
DualityRelation.ofFile (path : String) : IO DualityRelation
do let dualsJson := Json.parse (←IO.FS.readFile path) |>.toOption.get! let mut dualEquations : Std.HashMap String String := {} for pair in dualsJson.getArr?.toOption.get! do let a := s!"Equation{pair.getArr?.toOption.get![0]!.getNat?.toOption.get!}" let b := s!"Equation{pair.getArr?.toOption.get![1]!.getN...
def
Closure.DualityRelation.ofFile
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
DualityRelation.dual (rel : DualityRelation) (imp : GraphEdge) : Option GraphEdge
if isCoreEquationName imp.lhs && isCoreEquationName imp.rhs then some ⟨rel.dualEquations.getD imp.lhs imp.lhs, rel.dualEquations.getD imp.rhs imp.rhs⟩ else none
def
Closure.DualityRelation.dual
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[ "isCoreEquationName" ]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
getStoredDualityRelations
DualityRelation.ofFile "data/duals.json"
def
Closure.getStoredDualityRelations
Root
equational_theories/Closure.lean
[ "equational_theories.EquationalResult" ]
[]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
derive.getAxioms {α} [DecidableEq α] {Γ : Ctx α} {E : MagmaLaw α} (h : Γ ⊢ E) : Finset (MagmaLaw α)
match h with | .Ax _ => {E} | .Ref => {} | .Sym h => derive.getAxioms h | .Trans h₁ h₂ => derive.getAxioms h₁ ∪ derive.getAxioms h₂ | .Subst _ h => derive.getAxioms h | .Cong h₁ h₂ => derive.getAxioms h₁ ∪ derive.getAxioms h₂
def
derive.getAxioms
Root
equational_theories/Compactness.lean
[ "Mathlib.Data.Finset.Basic", "equational_theories.Completeness" ]
[ "Ctx" ]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
ToCtx {α} (S : Finset (MagmaLaw α)) : Ctx α
S
def
ToCtx
Root
equational_theories/Compactness.lean
[ "Mathlib.Data.Finset.Basic", "equational_theories.Completeness" ]
[ "Ctx" ]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Ctx.hasSubset {α} : HasSubset (Ctx α)
Set.instHasSubset
instance
Ctx.hasSubset
Root
equational_theories/Compactness.lean
[ "Mathlib.Data.Finset.Basic", "equational_theories.Completeness" ]
[ "Ctx" ]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
derive.Weak {α} {Γ Δ : Ctx α} {E : MagmaLaw α} (inc : Γ ⊆ Δ) (h : Γ ⊢ E) : Δ ⊢ E
by cases h case Ax => refine derive.Ax (inc ?_); assumption case Ref => exact derive.Ref case Sym => apply derive.Sym ; apply derive.Weak _ <;> trivial case Trans => apply derive.Trans <;> try apply derive.Weak <;> assumption case Subst => apply derive.Subst ; apply derive.Weak <;> assumption case Cong =>...
def
derive.Weak
Root
equational_theories/Compactness.lean
[ "Mathlib.Data.Finset.Basic", "equational_theories.Completeness" ]
[ "Ctx" ]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
derive.getAxiomsEnough {α} [DecidableEq α] {Γ : Ctx α} {E : MagmaLaw α} (h : Γ ⊢ E) : ToCtx (derive.getAxioms h) ⊢ E
by cases h <;> simp [ToCtx, getAxioms] case Ax => constructor; rfl case Ref => exact derive.Ref case Sym _ _ h => exact derive.Sym (derive.getAxiomsEnough _) case Trans _ _ _ h₁ h₂ => apply derive.Trans · exact derive.Weak Set.subset_union_left (derive.getAxiomsEnough h₁) · exact derive.Weak Set.s...
def
derive.getAxiomsEnough
Root
equational_theories/Compactness.lean
[ "Mathlib.Data.Finset.Basic", "equational_theories.Completeness" ]
[ "Ctx", "ToCtx", "derive.Weak", "derive.getAxioms" ]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
Compactness {α} [DecidableEq α] {Γ : Ctx α} {E : MagmaLaw α} (h : Γ ⊧ E) : ∃ (Δ : Finset (MagmaLaw α)), Nonempty <| ToCtx Δ ⊧ E
by have ⟨h''⟩ := Completeness h exact ⟨derive.getAxioms h'', ⟨Soundness (derive.getAxiomsEnough _)⟩⟩
def
Compactness
Root
equational_theories/Compactness.lean
[ "Mathlib.Data.Finset.Basic", "equational_theories.Completeness" ]
[ "Completeness", "Ctx", "ToCtx", "derive.getAxiomsEnough" ]
https://github.com/teorth/equational_theories
3f3999d958c5e289c7f5a063479af9dac122a7a8
End of preview. Expand in Data Studio

Lean4-EquationalTheories

Structured dataset from equational_theories — Terence Tao's magma equations project.

Source

Schema

Column Type Description
statement string Declaration signature/claim with the leading keyword removed (verbatim slice); the full declaration minus its proof
proof string Verbatim proof/body, empty if the declaration has none
type string Declaration keyword
symbolic_name string Declaration identifier
library string Sub-library
filename string Repository-relative source path
imports list[string] File-level Require/Import modules
deps list[string] Intra-corpus identifiers referenced
docstring string Preceding documentation comment, empty if absent
source_url string Upstream repository
commit string Upstream commit extracted

Statistics

  • Entries: 16,120
  • With proof: 15,974 (99.1%)
  • With docstring: 253 (1.6%)
  • Libraries: 22

By type

Type Count
theorem 13,527
def 1,705
lemma 537
abbrev 141
structure 54
instance 52
inductive 51
class 30
elab 11
macro 10
axiom 1
opaque 1

Example

adjoinFresh_fixed {m k: ℕ} (h : k  < m) :
  adjoinFresh (α := α) m k = .inl k
by unfold adjoinFresh; simp [h]
  • type: theorem | symbolic_name: AdjoinFresh.adjoinFresh_fixed | equational_theories/AdjoinFresh.lean

Use

Each declaration is split into a statement (signature/claim) and a proof (body) that are disjoint and together form the complete declaration, for proof modeling, autoformalization, retrieval, and dependency analysis via deps.

Citation

@misc{lean4_equationaltheories_dataset,
  title  = {Lean4-EquationalTheories},
  author = {Norton, Charles},
  year   = {2026},
  note   = {Extracted from https://github.com/teorth/equational_theories, commit 3f3999d958c5},
  url    = {https://huggingface.co/datasets/phanerozoic/Lean4-EquationalTheories}
}
Downloads last month
77

Collection including phanerozoic/Lean4-EquationalTheories