diff options
| author | Hannes Schulze <haschu0103@outlook.de> | 2025-12-03 21:22:03 +0100 |
|---|---|---|
| committer | Hannes Schulze <haschu0103@outlook.de> | 2025-12-03 21:22:03 +0100 |
| commit | 2edae587eee2ed64f66a4e4bedca6e654ad2f708 (patch) | |
| tree | caef0dde750b27cf4581808c679658d4f24a9b9d /Algebra/Term.lean | |
| parent | d7660ed1688a486b48f1c968e742ff85490e497f (diff) | |
differentiate bw substitution and uniform substitution
Diffstat (limited to 'Algebra/Term.lean')
| -rw-r--r-- | Algebra/Term.lean | 63 |
1 files changed, 44 insertions, 19 deletions
diff --git a/Algebra/Term.lean b/Algebra/Term.lean index b4d18f9..fe7e742 100644 --- a/Algebra/Term.lean +++ b/Algebra/Term.lean @@ -69,21 +69,42 @@ 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β© -def Substitution (sig : Signature) (X : Type) [NominalSet πΈ X] (Y : Type) [NominalSet πΈ Y] (l : β) := - X β TermAtDepth πΈ sig Y l +def Substitution (sig : Signature) (X : Type) [NominalSet πΈ X] (Y : Type) [NominalSet πΈ Y] := + X β Term πΈ sig Y -def Substitution.apply {l : β} (Ο : Substitution πΈ sig X Y l) : Term πΈ sig X β Term πΈ sig Y - | .var x => (Ο x).val +def Substitution.apply (Ο : Substitution πΈ sig X Y) : Term πΈ sig X β Term πΈ sig Y + | .var x => Ο x | .pure f args => .pure f (fun x => Ο.apply (args x)) | .free a f args => .free a f (fun x => Ο.apply (args x)) | .bound a f args => .bound a f (fun x => Ο.apply (args x)) -def Substitution.applyUniform {n l : β} (Ο : Substitution πΈ sig X Y l) (t : TermAtDepth πΈ sig X n) : +@[simp] lemma Substitution.apply_var {x : X} {Ο : Substitution πΈ sig X Y} : + Ο.apply πΈ (.var x) = (Ο x) := rfl + +@[simp] lemma Substitution.apply_pure + {f : sig.pure} {args : sig.pureArgs f β Term πΈ sig X} {Ο : Substitution πΈ sig X Y} : + Ο.apply πΈ (.pure f args) = .pure f (apply πΈ Ο β args) := rfl + +@[simp] lemma Substitution.apply_free + {a : πΈ} {f : sig.free} {args : sig.freeArgs f β Term πΈ sig X} {Ο : Substitution πΈ sig X Y} : + Ο.apply πΈ (.free a f args) = .free a f (apply πΈ Ο β args) := rfl + +@[simp] lemma Substitution.apply_bound + {a : πΈ} {f : sig.bound} {args : sig.boundArgs f β Term πΈ sig X} {Ο : Substitution πΈ sig X Y} : + Ο.apply πΈ (.bound a f args) = .bound a f (apply πΈ Ο β args) := rfl + +def UniformSubstitution (sig : Signature) (X : Type) [NominalSet πΈ X] (Y : Type) [NominalSet πΈ Y] (l : β) := + X β TermAtDepth πΈ sig Y l + +def UniformSubstitution.toSubstitution {l : β} (Ο : UniformSubstitution πΈ sig X Y l) : Substitution πΈ sig X Y := + fun x => (Ο x).val + +def UniformSubstitution.apply {n l : β} (Ο : UniformSubstitution πΈ sig X Y l) (t : TermAtDepth πΈ sig X n) : TermAtDepth πΈ sig Y (n + l) := - β¨Ο.apply πΈ t.val, by - suffices β t n, t.HasDepth πΈ n β (Ο.apply πΈ t).HasDepth πΈ (n + l) by + β¨Ο.toSubstitution.apply πΈ t.val, by + suffices β t n, t.HasDepth πΈ n β (Ο.toSubstitution.apply πΈ t).HasDepth πΈ (n + l) by exact this t.val n t.prop - intro t; fun_induction apply + intro t; fun_induction Substitution.apply Β· intro n h; cases h rw [Nat.zero_add] exact (Ο _).prop @@ -93,20 +114,24 @@ def Substitution.applyUniform {n l : β} (Ο : Substitution πΈ sig X Y l) (t constructor; intro arg apply ih1; exact h argβ© -@[simp] lemma Substitution.apply_var {l : β} {x : X} {Ο : Substitution πΈ sig X Y l} : - Ο.apply πΈ (.var x) = (Ο x).val := rfl +@[simp] lemma UniformSubstitution.apply_var + {x : X} {l : β} {Ο : UniformSubstitution πΈ sig X Y l} : + (Ο.apply πΈ (.var πΈ x)).val = (Ο x).val := rfl -@[simp] lemma Substitution.apply_pure - {f : sig.pure} {args : sig.pureArgs f β Term πΈ sig X} {l : β} {Ο : Substitution πΈ sig X Y l} : - Ο.apply πΈ (.pure f args) = .pure f (apply πΈ Ο β args) := rfl +@[simp] lemma UniformSubstitution.apply_pure + {n : β} {f : sig.pure} {args : sig.pureArgs f β TermAtDepth πΈ sig X n} + {l : β} {Ο : UniformSubstitution πΈ sig X Y l} : + (Ο.apply πΈ (.pure πΈ f args)).val = (TermAtDepth.pure πΈ f (apply πΈ Ο β args)).val := rfl -@[simp] lemma Substitution.apply_free - {a : πΈ} {f : sig.free} {args : sig.freeArgs f β Term πΈ sig X} {l : β} {Ο : Substitution πΈ sig X Y l} : - Ο.apply πΈ (.free a f args) = .free a f (apply πΈ Ο β args) := rfl +@[simp] lemma UniformSubstitution.apply_free + {n : β} {a : πΈ} {f : sig.free} {args : sig.freeArgs f β TermAtDepth πΈ sig X n} + {l : β} {Ο : UniformSubstitution πΈ sig X Y l} : + (Ο.apply πΈ (.free πΈ a f args)).val = (TermAtDepth.free πΈ a f (apply πΈ Ο β args)).val := rfl -@[simp] lemma Substitution.apply_bound - {a : πΈ} {f : sig.bound} {l : β} {args : sig.boundArgs f β Term πΈ sig X} {Ο : Substitution πΈ sig X Y l} : - Ο.apply πΈ (.bound a f args) = .bound a f (apply πΈ Ο β args) := rfl +@[simp] lemma UniformSubstitution.apply_bound + {n : β} {a : πΈ} {f : sig.bound} {args : sig.boundArgs f β TermAtDepth πΈ sig X n} + {l : β} {Ο : UniformSubstitution πΈ sig X Y l} : + (Ο.apply πΈ (.bound πΈ a f args)).val = (TermAtDepth.bound πΈ a f (apply πΈ Ο β args)).val := rfl private def rename (Ο : FPerm πΈ) : Term πΈ sig X β Term πΈ sig X | .var x => .var (Ο β’ x) |
