From 8fdf459876b999dbe184196f9abd330a3c24d560 Mon Sep 17 00:00:00 2001 From: Hannes Schulze Date: Thu, 4 Dec 2025 17:14:46 +0100 Subject: implement derivable equality --- Algebra/Terms.lean | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'Algebra/Terms.lean') 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 -- cgit v1.3.1