]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/etc/delift/delift.etc
small improvements and corrections ...
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / etc / delift / delift.etc
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 notation "hvbox( L ⊢ break ▼ * [ term 46 d , break term 46 e ] break term 46 T1 ≡ break term 46 T2 )"
16    non associative with precedence 45
17    for @{ 'TSubst $L $T1 $d $e $T2 }.
18
19 include "basic_2/unfold/tpss.ma".
20
21 (* INVERSE BASIC TERM RELOCATION  *******************************************)
22
23 definition delift: nat → nat → lenv → relation term ≝
24                    λd,e,L,T1,T2. ∃∃T. L ⊢ T1 ▶* [d, e] T & ⇧[d, e] T2 ≡ T.
25
26 interpretation "inverse basic relocation (term)"
27    'TSubst L T1 d e T2 = (delift d e L T1 T2).
28
29 (* Basic properties *********************************************************)
30
31 lemma lift_delift: ∀T1,T2,d,e. ⇧[d, e] T1 ≡ T2 →
32                    ∀L. L ⊢ ▼*[d, e] T2 ≡ T1.
33 /2 width=3/ qed.
34
35 lemma delift_refl_O2: ∀L,T,d. L ⊢ ▼*[d, 0] T ≡ T.
36 /2 width=3/ qed.
37
38 lemma delift_lsubr_trans: ∀L1,T1,T2,d,e. L1 ⊢ ▼*[d, e] T1 ≡ T2 →
39                           ∀L2. L2 ⊑ [d, e] L1 → L2 ⊢ ▼*[d, e] T1 ≡ T2.
40 #L1 #T1 #T2 #d #e * /3 width=3/
41 qed.
42
43 lemma delift_sort: ∀L,d,e,k. L ⊢ ▼*[d, e] ⋆k ≡ ⋆k.
44 /2 width=3/ qed.
45
46 lemma delift_lref_lt: ∀L,d,e,i. i < d → L ⊢ ▼*[d, e] #i ≡ #i.
47 /3 width=3/ qed.
48
49 lemma delift_lref_ge: ∀L,d,e,i. d + e ≤ i → L ⊢ ▼*[d, e] #i ≡ #(i - e).
50 /3 width=3/ qed.
51
52 lemma delift_gref: ∀L,d,e,p. L ⊢ ▼*[d, e] §p ≡ §p.
53 /2 width=3/ qed.
54
55 lemma delift_bind: ∀a,I,L,V1,V2,T1,T2,d,e.
56                    L ⊢ ▼*[d, e] V1 ≡ V2 → L. ⓑ{I} V2 ⊢ ▼*[d+1, e] T1 ≡ T2 →
57                    L ⊢ ▼*[d, e] ⓑ{a,I} V1. T1 ≡ ⓑ{a,I} V2. T2.
58 #a #I #L #V1 #V2 #T1 #T2 #d #e * #V #HV1 #HV2 * #T #HT1 #HT2
59 lapply (tpss_lsubr_trans … HT1 (L. ⓑ{I} V) ?) -HT1 /2 width=1/ /3 width=5/
60 qed.
61
62 lemma delift_flat: ∀I,L,V1,V2,T1,T2,d,e.
63                    L ⊢ ▼*[d, e] V1 ≡ V2 → L ⊢ ▼*[d, e] T1 ≡ T2 →
64                    L ⊢ ▼*[d, e] ⓕ{I} V1. T1 ≡ ⓕ{I} V2. T2.
65 #I #L #V1 #V2 #T1 #T2 #d #e * #V #HV1 #HV2 * /3 width=5/
66 qed.
67
68 (* Basic inversion lemmas ***************************************************)
69
70 lemma delift_inv_sort1: ∀L,U2,d,e,k. L ⊢ ▼*[d, e] ⋆k ≡ U2 → U2 = ⋆k.
71 #L #U2 #d #e #k * #U #HU
72 >(tpss_inv_sort1 … HU) -HU #HU2
73 >(lift_inv_sort2 … HU2) -HU2 //
74 qed-.
75
76 lemma delift_inv_gref1: ∀L,U2,d,e,p. L ⊢ ▼*[d, e] §p ≡ U2 → U2 = §p.
77 #L #U #d #e #p * #U #HU
78 >(tpss_inv_gref1 … HU) -HU #HU2
79 >(lift_inv_gref2 … HU2) -HU2 //
80 qed-.
81
82 lemma delift_inv_bind1: ∀a,I,L,V1,T1,U2,d,e. L ⊢ ▼*[d, e] ⓑ{a,I} V1. T1 ≡ U2 →
83                         ∃∃V2,T2. L ⊢ ▼*[d, e] V1 ≡ V2 &
84                                  L. ⓑ{I} V2 ⊢ ▼*[d+1, e] T1 ≡ T2 &
85                                  U2 = ⓑ{a,I} V2. T2.
86 #a #I #L #V1 #T1 #U2 #d #e * #U #HU #HU2
87 elim (tpss_inv_bind1 … HU) -HU #V #T #HV1 #HT1 #X destruct
88 elim (lift_inv_bind2 … HU2) -HU2 #V2 #T2 #HV2 #HT2
89 lapply (tpss_lsubr_trans … HT1 (L. ⓑ{I} V2) ?) -HT1 /2 width=1/ /3 width=5/
90 qed-.
91
92 lemma delift_inv_flat1: ∀I,L,V1,T1,U2,d,e. L ⊢ ▼*[d, e] ⓕ{I} V1. T1 ≡ U2 →
93                         ∃∃V2,T2. L ⊢ ▼*[d, e] V1 ≡ V2 &
94                                  L ⊢ ▼*[d, e] T1 ≡ T2 &
95                                  U2 = ⓕ{I} V2. T2.
96 #I #L #V1 #T1 #U2 #d #e * #U #HU #HU2
97 elim (tpss_inv_flat1 … HU) -HU #V #T #HV1 #HT1 #X destruct
98 elim (lift_inv_flat2 … HU2) -HU2 /3 width=5/
99 qed-.
100
101 lemma delift_inv_refl_O2: ∀L,T1,T2,d. L ⊢ ▼*[d, 0] T1 ≡ T2 → T1 = T2.
102 #L #T1 #T2 #d * #T #HT1
103 >(tpss_inv_refl_O2 … HT1) -HT1 #HT2
104 >(lift_inv_refl_O2 … HT2) -HT2 //
105 qed-.
106
107 (* Basic forward lemmas *****************************************************)
108
109 lemma delift_fwd_tw: ∀L,T1,T2,d,e. L ⊢ ▼*[d, e] T1 ≡ T2 → ♯{T1} ≤ ♯{T2}.
110 #L #T1 #T2 #d #e * #T #HT1 #HT2
111 >(lift_fwd_tw … HT2) -T2 /2 width=4 by tpss_fwd_tw/
112 qed-.