diff options
Diffstat (limited to 'Algebra')
| -rw-r--r-- | Algebra/Derivations.lean | 136 | ||||
| -rw-r--r-- | Algebra/Terms.lean | 23 |
2 files changed, 159 insertions, 0 deletions
diff --git a/Algebra/Derivations.lean b/Algebra/Derivations.lean index e69de29..6f81e9a 100644 --- a/Algebra/Derivations.lean +++ b/Algebra/Derivations.lean @@ -0,0 +1,136 @@ +import Mathlib +import Algebra.Terms + +namespace Algebra + +section Theories + +variable (πΈ : Type) [Infinite πΈ] [Countable πΈ] [DecidableEq πΈ] +variable (sig : Signature) + +structure Equation where + vars : Type + [vars_nominal : NominalSet πΈ vars] + [vars_orbitFinite : OrbitFinite πΈ vars] + left : Term πΈ sig vars + right : Term πΈ sig vars + +namespace Equation + +instance (eq : Equation πΈ sig) : NominalSet πΈ eq.vars := + eq.vars_nominal + +instance (eq : Equation πΈ sig) : OrbitFinite πΈ eq.vars := + eq.vars_orbitFinite + +def HasDepth + {πΈ : Type} [Infinite πΈ] [Countable πΈ] [DecidableEq πΈ] {sig : Signature} + (eq : Equation πΈ sig) (n : β) : Prop := + eq.left.HasDepth n β§ eq.right.HasDepth n + +end Equation + +def EquationAtDepth (n : β) := + { eq : Equation πΈ sig // eq.HasDepth n } + +def UniformEquation := + { eq : Equation πΈ sig // β n, eq.HasDepth n } + +structure Theory where + sig : Signature + axioms : Set (UniformEquation πΈ sig) + +end Theories + +variable {πΈ : Type} [Infinite πΈ] [Countable πΈ] [DecidableEq πΈ] +variable {sig : Signature} + +section Helpers + +def EquationAtDepth.left {n : β} (eq : EquationAtDepth πΈ sig n) : TermAtDepth πΈ sig eq.val.vars n := + β¨eq.val.left, eq.prop.leftβ© + +def EquationAtDepth.right {n : β} (eq : EquationAtDepth πΈ sig n) : TermAtDepth πΈ sig eq.val.vars n := + β¨eq.val.right, eq.prop.rightβ© + +def EquationAtDepth.mk + (X : Type) [NominalSet πΈ X] [OrbitFinite πΈ X] {n : β} (t u : TermAtDepth πΈ sig X n) : + EquationAtDepth πΈ sig n := + β¨β¨X, t.val, u.valβ©, β¨t.prop, u.propβ©β© + +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 + +end Helpers + +section DerivableEquations + +inductive Derivable (T : Theory πΈ) : {m : β} β (eq : EquationAtDepth πΈ T.sig m) β 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} : + 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} : + 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} : + (β 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} : + (β 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} : + (β 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)) + | 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 β + (β 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) + +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 := + (β (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)) := + .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 + +end DerivableEquations + +end Algebra diff --git a/Algebra/Terms.lean b/Algebra/Terms.lean index aa853a8..997dca4 100644 --- a/Algebra/Terms.lean +++ b/Algebra/Terms.lean @@ -87,6 +87,29 @@ def TermAtDepth.bound {n : β} (a : πΈ) (f : sig.bound) (args : sig.boundArgs TermAtDepth πΈ sig X (n + sig.boundDepth f) := β¨.bound a f (Subtype.val β args), by constructor; intro arg; exact (args arg).propβ© +theorem TermAtDepth.induction + {motive : {n : β} β TermAtDepth πΈ sig X n β Prop} + (var : β (x : X), motive (.var x)) + (pure : β {n : β} (f : sig.pure) (args : sig.pureArgs f β TermAtDepth πΈ sig X n), + (β x, motive (args x)) β motive (.pure f args)) + (free : β {n : β} (a : πΈ) (f : sig.free) (args : sig.freeArgs f β TermAtDepth πΈ sig X n), + (β x, motive (args x)) β motive (.free a f args)) + (bound : β {n : β} (a : πΈ) (f : sig.bound) (args : sig.boundArgs f β TermAtDepth πΈ sig X n), + (β x, motive (args x)) β motive (.bound a f args)) + : β {n : β} (t : TermAtDepth πΈ sig X n), motive t := by + intro n β¨t, htβ© + induction' t generalizing n <;> cases ht <;> expose_names + Β· exact var x + Β· let args' : sig.pureArgs f β TermAtDepth πΈ sig X k := fun x => β¨args x, h xβ© + have args_ih' : β x, motive (args' x) := fun x => args_ih x (h x) + exact pure f args' args_ih' + Β· let args' : sig.freeArgs f β TermAtDepth πΈ sig X k := fun x => β¨args x, h xβ© + have args_ih' : β x, motive (args' x) := fun x => args_ih x (h x) + exact free a f args' args_ih' + Β· let args' : sig.boundArgs f β TermAtDepth πΈ sig X k := fun x => β¨args x, h xβ© + have args_ih' : β x, motive (args' x) := fun x => args_ih x (h x) + exact bound a f args' args_ih' + end ConvenienceConstructors section Substitution |
