]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/lib/lambda-delta/substitution/subst.ma
5989693c5059a987e6e77a8a0c0b0fee9d4c8d71
[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 (* TELESCOPIC 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 → ↑[d,1] 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_bind   : ∀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 | subst_flat   : ∀L,I,V1,V2,T1,T2,d,e.
29                  subst L V1 d e V2 → subst L T1 d e T2 →
30                  subst L (𝕗{I} V1. T1) d e (𝕗{I} V2. T2)
31 .
32
33 interpretation "telescopic substritution" 'RSubst L T1 d e T2 = (subst L T1 d e T2).
34
35 lemma subst_lift_inv: ∀d,e,T1,T2. ↑[d,e] T1 ≡ T2 → ∀L. L ⊢ ↓[d,e] T2 ≡ T1.
36 #d #e #T1 #T2 #H elim H -H d e T1 T2 /2/
37 #i #d #e #Hdi #L >(minus_plus_m_m i e) in ⊢ (? ? ? ? ? %) /3/ (**) (* use \ldots *)
38 qed.