]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/lib/lambda-delta/substitution/subst.ma
complete reformalization of lambda-delta in matita (initial commit)
[helm.git] / matita / matita / lib / lambda-delta / substitution / subst.ma
1 (*
2     ||M||  This file is part of HELM, an Hypertextual, Electronic
3     ||A||  Library of Mathematics, developed at the Computer Science
4     ||T||  Department of the University of Bologna, Italy.
5     ||I||
6     ||T||
7     ||A||  This file is distributed under the terms of the
8     \   /  GNU General Public License Version 2
9      \ /
10       V_______________________________________________________________ *)
11
12 include "lambda-delta/language/lenv.ma".
13 include "lambda-delta/substitution/lift.ma".
14
15 (* SUBSTITUTION *************************************************************)
16
17 inductive subst: lenv → term → nat → nat → term → Prop ≝
18    | subst_sort   : ∀L,k,d,e. subst L (⋆k) d e (⋆k)
19    | subst_lref_lt: ∀L,i,d,e. i < d → subst L (#i) d e (#i)
20    | subst_lref_O : ∀L,V,e. 0 < e → subst (L. ♭Abbr V) #0 0 e V
21    | subst_lref_S : ∀L,I,V,i,T1,T2,d,e. 
22                     d ≤ i → i < d + e → subst L #i d e T1 → [1,d]↑ T1 ≡ T2 →
23                     subst (L. ♭I V) #(i + 1) (d + 1) e T2
24    | subst_lref_ge: ∀L,i,d,e. d + e ≤ i → subst L (#i) d e (#(i - e))
25    | subst_con2   : ∀L,I,V1,V2,T1,T2,d,e.
26                     subst L V1 d e V2 → subst (L. ♭I V1) T1 (d + 1) e T2 →
27                     subst L (♭I V1. T1) d e (♭I V2. T2)
28 .
29
30 interpretation "telescopic substritution" 'RSubst L T1 d e T2 = (subst L T1 d e T2).
31
32 lemma subst_lift_inv: ∀d,e,T1,T2. [d,e]↑ T1 ≡ T2 → ∀L. [d,e]← L / T2 ≡ T1.
33 #d #e #T1 #T2 #H elim H -H d e T1 T2 /2/
34 #i #d #e #Hdi #L >(minus_plus_m_m i e) in ⊢ (? ? ? ? ? %) /3/
35 qed.
36