summaryrefslogtreecommitdiff
path: root/Algebra/Terms.lean
diff options
context:
space:
mode:
Diffstat (limited to 'Algebra/Terms.lean')
-rw-r--r--Algebra/Terms.lean23
1 files changed, 23 insertions, 0 deletions
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