diff options
| author | Hannes Schulze <haschu0103@outlook.de> | 2025-12-04 19:05:06 +0100 |
|---|---|---|
| committer | Hannes Schulze <haschu0103@outlook.de> | 2025-12-04 19:05:06 +0100 |
| commit | da3ddb5f61bb3dae9978770a26cf276c5265a1b8 (patch) | |
| tree | 07603ff5eeb6ddffc7aa17bf3ffaa4b4f1f09317 /Algebra/Derivations.lean | |
| parent | 8fdf459876b999dbe184196f9abd330a3c24d560 (diff) | |
prove that derivable equality is an equivariant equivalence
Diffstat (limited to 'Algebra/Derivations.lean')
| -rw-r--r-- | Algebra/Derivations.lean | 147 |
1 files changed, 118 insertions, 29 deletions
diff --git a/Algebra/Derivations.lean b/Algebra/Derivations.lean index 6f81e9a..c037925 100644 --- a/Algebra/Derivations.lean +++ b/Algebra/Derivations.lean @@ -61,75 +61,164 @@ def EquationAtDepth.mk def EquationAtDepth.toUniform {n : β} (eq : EquationAtDepth πΈ sig n) : UniformEquation πΈ sig := β¨eq.val, β¨n, eq.propβ©β© -notation:50 X " β’ " lhs " β£ " rhs => EquationAtDepth.mk X lhs rhs +notation:50 X " β’ " lhs " β£ " rhs => Equation.mk X lhs rhs end Helpers section DerivableEquations -inductive Derivable (T : Theory πΈ) : {m : β} β (eq : EquationAtDepth πΈ T.sig m) β Prop +inductive Derivable (T : Theory πΈ) : (eq : Equation πΈ T.sig) β Prop | refl {X : Type} [NominalSet πΈ X] [OrbitFinite πΈ X] {x : X} : Derivable T (X β’ .var x β£ .var x) | symm {X : Type} [NominalSet πΈ X] [OrbitFinite πΈ X] - {m : β} {t u : TermAtDepth πΈ T.sig X m} : + {t u : Term πΈ T.sig X} : Derivable T (X β’ u β£ t) β Derivable T (X β’ t β£ u) | trans {X : Type} [NominalSet πΈ X] [OrbitFinite πΈ X] - {m : β} {t u v : TermAtDepth πΈ T.sig X m} : + {t u v : Term πΈ T.sig X} : Derivable T (X β’ t β£ v) β Derivable T (X β’ v β£ u) β Derivable T (X β’ t β£ u) | cong_pure {X : Type} [NominalSet πΈ X] [OrbitFinite πΈ X] - {f : T.sig.pure} {m : β} {ts us : T.sig.pureArgs f β TermAtDepth πΈ T.sig X m} : + {f : T.sig.pure} {ts us : T.sig.pureArgs f β Term πΈ T.sig X} : (β x, Derivable T (X β’ ts x β£ us x)) β Derivable T (X β’ .pure f ts β£ .pure f us) | cong_free {X : Type} [NominalSet πΈ X] [OrbitFinite πΈ X] - {a : πΈ} {f : T.sig.free} {m : β} {ts us : T.sig.freeArgs f β TermAtDepth πΈ T.sig X m} : + {a : πΈ} {f : T.sig.free} {ts us : T.sig.freeArgs f β Term πΈ T.sig X} : (β x, Derivable T (X β’ ts x β£ us x)) β Derivable T (X β’ .free a f ts β£ .free a f us) | cong_bound {X : Type} [NominalSet πΈ X] [OrbitFinite πΈ X] - {a : πΈ} {f : T.sig.bound} {m : β} {ts us : T.sig.boundArgs f β TermAtDepth πΈ T.sig X m} : + {a : πΈ} {f : T.sig.bound} {ts us : T.sig.boundArgs f β Term πΈ T.sig X} : (β x, Derivable T (X β’ ts x β£ us x)) β Derivable T (X β’ .bound a f ts β£ .bound a f us) - | ax' {X Y : Type} [NominalSet πΈ X] [OrbitFinite πΈ X] [NominalSet πΈ Y] [OrbitFinite πΈ Y] - {m : β} {r s : TermAtDepth πΈ T.sig Y m} - {l : β} {Ο : UniformSubstitution πΈ T.sig Y X l} {Ο : FPerm πΈ} : - ((Y β’ r β£ s).toUniform β T.axioms) β - (β (y : Y) (Ο : FPerm πΈ), Derivable T (X β’ Ο (Ο β’ y) β£ Ο β’ (Ο y))) β - Derivable T (X β’ Ο.apply (Ο β’ r) β£ Ο.apply (Ο β’ s)) + | ax' {X : Type} [NominalSet πΈ X] [OrbitFinite πΈ X] + {eq : UniformEquation πΈ T.sig} + {l : β} {Ο : UniformSubstitution πΈ T.sig eq.val.vars X l} {Ο : FPerm πΈ} : + (eq β T.axioms) β + (β (y : eq.val.vars) (Ο : FPerm πΈ), Derivable T (X β’ Ο.toSubstitution (Ο β’ y) β£ Ο β’ (Ο.toSubstitution y))) β + Derivable T (X β’ Ο.toSubstitution.apply (Ο β’ eq.val.left) β£ Ο.toSubstitution.apply (Ο β’ eq.val.right)) | perm {X : Type} [NominalSet πΈ X] [OrbitFinite πΈ X] - {a b : πΈ} {f : T.sig.bound} {m : β} {ts us : T.sig.boundArgs f β TermAtDepth πΈ T.sig X m} : + {a b : πΈ} {f : T.sig.bound} {ts us : T.sig.boundArgs f β Term πΈ T.sig X} : a β b β (β x, a # us x) β (β x, Derivable T (X β’ ts x β£ βΈ¨a, bβΈ© β’ us x)) β Derivable T (X β’ .bound a f ts β£ .bound b f us) +def DerivableEq (T : Theory πΈ) (X : Type) [NominalSet πΈ X] [OrbitFinite πΈ X] (n : β) : + Rel (TermAtDepth πΈ T.sig X n) (TermAtDepth πΈ T.sig X n) := + fun t u => Derivable T (X β’ t.val β£ u.val) + variable {X Y : Type} [NominalSet πΈ X] [OrbitFinite πΈ X] [NominalSet πΈ Y] [OrbitFinite πΈ Y] -def UniformSubstitution.DerivablyEquivariant - (T : Theory πΈ) {l : β} (Ο : UniformSubstitution πΈ T.sig X Y l) : Prop := +def Substitution.DerivablyEquivariant + (T : Theory πΈ) (Ο : Substitution πΈ T.sig X Y) : Prop := (β (x : X) (Ο : FPerm πΈ), Derivable T (Y β’ Ο (Ο β’ x) β£ Ο β’ Ο x)) /-- Restated ax' rule using DerivablyEquivariant in the premiss. -/ lemma Derivable.ax {T : Theory πΈ} - {m : β} {r s : TermAtDepth πΈ T.sig Y m} - {l : β} {Ο : UniformSubstitution πΈ T.sig Y X l} {Ο : FPerm πΈ} : - ((Y β’ r β£ s).toUniform β T.axioms) β - Ο.DerivablyEquivariant T β - Derivable T (X β’ Ο.apply (Ο β’ r) β£ Ο.apply (Ο β’ s)) := + {eq : UniformEquation πΈ T.sig} + {l : β} {Ο : UniformSubstitution πΈ T.sig eq.val.vars X l} {Ο : FPerm πΈ} : + (eq β T.axioms) β + Ο.toSubstitution.DerivablyEquivariant T β + Derivable T (X β’ Ο.toSubstitution.apply (Ο β’ eq.val.left) β£ Ο.toSubstitution.apply (Ο β’ eq.val.right)) := .ax' lemma Derivable.equivariant_substitution (T : Theory πΈ) - {l : β} (Ο : UniformSubstitution πΈ T.sig Y X l) (hequi : Ο.DerivablyEquivariant T) - {m : β} (t : TermAtDepth πΈ T.sig Y m) {Ο : FPerm πΈ} : - Derivable T (X β’ Ο.apply (Ο β’ t) β£ Ο β’ (Ο.apply t)) := by - induction' t using TermAtDepth.induction <;> expose_names - Β· sorry - Β· sorry - Β· sorry - Β· sorry + {l : β} (Ο : UniformSubstitution πΈ T.sig Y X l) : + Ο.toSubstitution.DerivablyEquivariant T β + β (t : Term πΈ T.sig Y) (Ο : FPerm πΈ), + Derivable T (X β’ Ο.toSubstitution.apply (Ο β’ t) β£ Ο β’ (Ο.toSubstitution.apply t)) := by + intro hequi t Ο + induction' t <;> expose_names + Β· exact hequi x Ο + Β· simp only [Term.smul_pure, Substitution.apply_pure] + apply Derivable.cong_pure + exact args_ih + Β· simp only [Term.smul_free, Substitution.apply_free] + apply Derivable.cong_free + exact args_ih + Β· simp only [Term.smul_bound, Substitution.apply_bound] + apply Derivable.cong_bound + exact args_ih + +lemma Derivable.equivariant + (T : Theory πΈ) {t u : Term πΈ T.sig X} : + β (Ο : FPerm πΈ), Derivable T (X β’ t β£ u) β Derivable T (X β’ Ο β’ t β£ Ο β’ u) := by + intro Ο + suffices β eq, Derivable T eq β Derivable T (eq.vars β’ Ο β’ eq.left β£ Ο β’ eq.right) by + exact this (X β’ t β£ u) + intro eq hderiv + induction' hderiv <;> expose_names + Β· exact .refl + Β· apply Derivable.symm + exact a_ih + Β· apply Derivable.trans + Β· exact a_ih + Β· exact a_ih_1 + Β· apply Derivable.cong_pure + exact a_ih + Β· apply Derivable.cong_free + exact a_ih + Β· apply Derivable.cong_bound + exact a_ih + Β· apply Derivable.trans (by apply Derivable.symm; apply equivariant_substitution; exact h_1) _ + apply Derivable.trans _ (by apply equivariant_substitution; exact h_1) + rw [β MulAction.mul_smul, β MulAction.mul_smul] + apply Derivable.ax + Β· exact h + Β· exact h_1 + Β· apply Derivable.perm + Β· intro hcontra + apply Ο.val.injective at hcontra + contradiction + Β· intro x + show Ο β’ a # Ο β’ (us x) + rw [β Rel.equivariant πΈ NominalSet.IsFresh] + exact h_1 x + Β· intro x + show Derivable T (X_1 β’ Ο β’ ts x β£ βΈ¨Ο a, Ο bβΈ© β’ Ο β’ us x) + rw [β MulAction.mul_smul, β FPerm.mul_swap_eq_swap_mul, MulAction.mul_smul] + exact a_ih x + +variable {T : Theory πΈ} {n : β} + +instance DerivableEq.instEquivariant : Rel.Equivariant πΈ (DerivableEq T X n) := by + constructor; intro t u + exact Derivable.equivariant T + +@[refl] +lemma DerivableEq.refl (t : TermAtDepth πΈ T.sig X n) : DerivableEq T X n t t := by + suffices β t, Derivable T (X β’ t β£ t) by exact this t.val + intro t + induction' t <;> expose_names + Β· apply Derivable.refl + Β· apply Derivable.cong_pure; assumption + Β· apply Derivable.cong_free; assumption + Β· apply Derivable.cong_bound; assumption + +@[symm] +lemma DerivableEq.symm {t u : TermAtDepth πΈ T.sig X n} : + DerivableEq T X n u t β DerivableEq T X n t u := by + intro h + apply Derivable.symm + exact h + +@[trans] +lemma DerivableEq.trans {t u v : TermAtDepth πΈ T.sig X n} : + DerivableEq T X n t v β DerivableEq T X n v u β DerivableEq T X n t u := by + intro htv hvu + apply Derivable.trans + Β· exact htv + Β· exact hvu + +instance TermAtDepth.setoid : Setoid (TermAtDepth πΈ T.sig X n) where + r := DerivableEq T X n + iseqv := + { refl := DerivableEq.refl + symm := DerivableEq.symm + trans := DerivableEq.trans } end DerivableEquations |
