]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda_delta/basic_2/unfold/ltpss_tpss.ma
urgent partial commit ... to be fixed later ...
[helm.git] / matita / matita / contribs / lambda_delta / basic_2 / unfold / ltpss_tpss.ma
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 include "basic_2/unfold/tpss_lift.ma".
16 include "basic_2/unfold/ltpss_tps.ma".
17
18 (* PARALLEL UNFOLD ON LOCAL ENVIRONMENTS ************************************)
19
20 (* Properties concerning partial unfold on terms ****************************)
21
22 lemma ltpss_tpss_conf_ge: ∀L0,T2,U2,d2,e2. L0 ⊢ T2 [d2, e2] ▶* U2 →
23                           ∀L1,d1,e1. L0 [d1, e1] ▶* L1 → d1 + e1 ≤ d2 →
24                           L1 ⊢ T2 [d2, e2] ▶* U2.
25 #L0 #T2 #U2 #d2 #e2 #H #L1 #d1 #e1 #HL01 #Hde1d2 @(tpss_ind … H) -U2 //
26 #U #U2 #_ #HU2 #IHU
27 lapply (ltpss_tps_conf_ge … HU2 … HL01 ?) -L0 // -Hde1d2 /2 width=3/
28 qed.
29
30 (* Basic_1: was: subst1_subst1_back *)
31 lemma ltpss_tps_conf: ∀L0,T2,U2,d2,e2. L0 ⊢ T2 [d2, e2] ▶ U2 →
32                       ∀L1,d1,e1. L0 [d1, e1] ▶* L1 →
33                       ∃∃T. L1 ⊢ T2 [d2, e2] ▶ T &
34                            L1 ⊢ U2 [d1, e1] ▶* T.
35 #L0 #T2 #U2 #d2 #e2 #H elim H -L0 -T2 -U2 -d2 -e2
36 [ /2 width=3/
37 | #L0 #K0 #V0 #W0 #i2 #d2 #e2 #Hdi2 #Hide2 #HLK0 #HVW0 #L1 #d1 #e1 #HL01
38   elim (lt_or_ge i2 d1) #Hi2d1
39   [ elim (ltpss_ldrop_conf_le … HL01 … HLK0 ?) -L0 /2 width=2/ #X #H #HLK1
40     elim (ltpss_inv_tpss11 … H ?) -H /2 width=1/ #K1 #V1 #_ #HV01 #H destruct
41     lapply (ldrop_fwd_ldrop2 … HLK1) #H
42     elim (lift_total V1 0 (i2 + 1)) #W1 #HVW1
43     lapply (tpss_lift_ge … HV01 … H HVW0 … HVW1) -V0 -H // >minus_plus <plus_minus_m_m // /3 width=4/
44   | elim (lt_or_ge i2 (d1 + e1)) #Hde1i2
45     [ elim (ltpss_ldrop_conf_be … HL01 … HLK0 ? ?) -L0 // /2 width=2/ #X #H #HLK1
46       elim (ltpss_inv_tpss21 … H ?) -H /2 width=1/ #K1 #V1 #_ #HV01 #H destruct
47       lapply (ldrop_fwd_ldrop2 … HLK1) #H
48       elim (lift_total V1 0 (i2 + 1)) #W1 #HVW1
49       lapply (tpss_lift_ge … HV01 … H HVW0 … HVW1) -V0 -H // normalize #HW01
50       lapply (tpss_weak … HW01 d1 e1 ? ?) [2: /2 width=1/ |3: /3 width=4/ ] >minus_plus >commutative_plus /2 width=1/
51     | lapply (ltpss_ldrop_conf_ge … HL01 … HLK0 ?) -L0 // /3 width=4/
52     ]
53   ]
54 | #L0 #I #V2 #W2 #T2 #U2 #d2 #e2 #_ #_ #IHVW2 #IHTU2 #L1 #d1 #e1 #HL01
55   elim (IHVW2 … HL01) -IHVW2 #V #HV2 #HVW2
56   elim (IHTU2 (L1. ⓑ{I} V) (d1 + 1) e1 ?) -IHTU2 /2 width=1/ -HL01 /3 width=5/
57 | #L0 #I #V2 #W2 #T2 #U2 #d2 #e2 #_ #_ #IHVW2 #IHTU2 #L1 #d1 #e1 #HL01
58   elim (IHVW2 … HL01) -IHVW2
59   elim (IHTU2 … HL01) -IHTU2 -HL01 /3 width=5/
60 ]
61 qed.
62   
63 lemma ltpss_tpss_trans_ge: ∀L0,T2,U2,d2,e2. L0 ⊢ T2 [d2, e2] ▶* U2 →
64                            ∀L1,d1,e1. L1 [d1, e1] ▶* L0 → d1 + e1 ≤ d2 →
65                            L1 ⊢ T2 [d2, e2] ▶* U2.
66 #L0 #T2 #U2 #d2 #e2 #H #L1 #d1 #e1 #HL01 #Hde1d2 @(tpss_ind … H) -U2 //
67 #U #U2 #_ #HU2 #IHU
68 lapply (ltpss_tps_trans_ge … HU2 … HL01 ?) -L0 // -Hde1d2 /2 width=3/
69 qed.
70
71 (* Basic_1: was: subst1_subst1 *)
72 lemma ltpss_tps_trans: ∀L0,T2,U2,d2,e2. L0 ⊢ T2 [d2, e2] ▶ U2 →
73                        ∀L1,d1,e1. L1 [d1, e1] ▶* L0 →
74                        ∃∃T. L1 ⊢ T2 [d2, e2] ▶ T &
75                             L0 ⊢ T [d1, e1] ▶* U2.
76 #L0 #T2 #U2 #d2 #e2 #H elim H -L0 -T2 -U2 -d2 -e2
77 [ /2 width=3/
78 | #L0 #K0 #V0 #W0 #i2 #d2 #e2 #Hdi2 #Hide2 #HLK0 #HVW0 #L1 #d1 #e1 #HL10
79   elim (lt_or_ge i2 d1) #Hi2d1
80   [ elim (ltpss_ldrop_trans_le … HL10 … HLK0 ?) -HL10 /2 width=2/ #X #H #HLK1
81     elim (ltpss_inv_tpss12 … H ?) -H /2 width=1/ #K1 #V1 #_ #HV01 #H destruct
82     lapply (ldrop_fwd_ldrop2 … HLK0) -HLK0 #H
83     elim (lift_total V1 0 (i2 + 1)) #W1 #HVW1
84     lapply (tpss_lift_ge … HV01 … H HVW1 … HVW0) -V0 -H // >minus_plus <plus_minus_m_m /2 width=1/ /3 width=4/
85   | elim (lt_or_ge i2 (d1 + e1)) #Hde1i2
86     [ elim (ltpss_ldrop_trans_be … HL10 … HLK0 ? ?) -HL10 // /2 width=2/ #X #H #HLK1
87       elim (ltpss_inv_tpss22 … H ?) -H /2 width=1/ #K1 #V1 #_ #HV01 #H destruct
88       lapply (ldrop_fwd_ldrop2 … HLK0) -HLK0 #H
89       elim (lift_total V1 0 (i2 + 1)) #W1 #HVW1
90       lapply (tpss_lift_ge … HV01 … H HVW1 … HVW0) -V0 -H // normalize #HW01
91       lapply (tpss_weak … HW01 d1 e1 ? ?) [2: /3 width=1/ |3: /3 width=4/ ] >minus_plus >commutative_plus /2 width=1/
92     | lapply (ltpss_ldrop_trans_ge … HL10 … HLK0 ?) -HL10 -HLK0 // /3 width=4/
93     ]
94   ]
95 | #L0 #I #V2 #W2 #T2 #U2 #d2 #e2 #_ #_ #IHVW2 #IHTU2 #L1 #d1 #e1 #HL10
96   elim (IHVW2 … HL10) -IHVW2 #V #HV2 #HVW2
97   elim (IHTU2 (L1. ⓑ{I} V) (d1 + 1) e1 ?) -IHTU2 /2 width=1/ -HL10 /3 width=5/
98 | #L0 #I #V2 #W2 #T2 #U2 #d2 #e2 #_ #_ #IHVW2 #IHTU2 #L1 #d1 #e1 #HL10
99   elim (IHVW2 … HL10) -IHVW2
100   elim (IHTU2 … HL10) -IHTU2 -HL10 /3 width=5/
101 ]
102 qed.
103
104 fact ltpss_tps_trans_eq_aux: ∀Y1,X2,L1,T2,U2,d,e.
105                              L1 ⊢ T2 [d, e] ▶ U2 → ∀L0. L0 [d, e] ▶* L1 →
106                              Y1 = L1 → X2 = T2 → L0 ⊢ T2 [d, e] ▶* U2.
107 #Y1 #X2 @(cw_wf_ind … Y1 X2) -Y1 -X2 #Y1 #X2 #IH
108 #L1 #T2 #U2 #d #e * -L1 -T2 -U2 -d -e
109 [ //
110 | #L1 #K1 #V1 #W1 #i #d #e #Hdi #Hide #HLK1 #HVW1 #L0 #HL10 #H1 #H2 destruct
111   lapply (ldrop_fwd_lw … HLK1) #H1 normalize in H1;
112   elim (ltpss_ldrop_trans_be … HL10 … HLK1 ? ?) -HL10 -HLK1 // /2 width=2/ #X #H #HLK0
113   elim (ltpss_inv_tpss22 … H ?) -H /2 width=1/ #K0 #V0 #HK01 #HV01 #H destruct
114   lapply (tpss_fwd_tw … HV01) #H2
115   lapply (transitive_le (#[K1] + #[V0]) … H1) -H1 /2 width=1/ -H2 #H
116   lapply (IH … HV01 … HK01 ? ?) -IH -HV01 -HK01
117   [1,3: // |2,4: skip | normalize /2 width=1/ | /3 width=6/ ]
118 | #L #I #V1 #V2 #T1 #T2 #d #e #HV12 #HT12 #L0 #HL0 #H1 #H2 destruct
119   lapply (tps_lsubs_conf … HT12 (L. ⓑ{I} V1) ?) -HT12 /2 width=1/ #HT12
120   lapply (IH … HV12 … HL0 ? ?) -HV12 [1,3: // |2,4: skip |5: /2 width=2/ ] #HV12
121   lapply (IH … HT12 (L0. ⓑ{I} V1) ? ? ?) -IH -HT12 [1,3,5: /2 width=2/ |2,4: skip | normalize // ] -HL0 #HT12
122   lapply (tpss_lsubs_conf … HT12 (L0. ⓑ{I} V2) ?) -HT12 /2 width=1/
123 | #L #I #V1 #V2 #T1 #T2 #d #e #HV12 #HT12 #L0 #HL0 #H1 #H2 destruct
124   lapply (IH … HV12 … HL0 ? ?) -HV12 [1,3: // |2,4: skip |5: /2 width=3/ ]
125   lapply (IH … HT12 … HL0 ? ?) -IH -HT12 [1,3,5: normalize // |2,4: skip ] -HL0 /2 width=1/
126 ]
127 qed.
128
129 lemma ltps_tps_trans_eq: ∀L1,T2,U2,d,e. L1 ⊢ T2 [d, e] ▶ U2 →
130                          ∀L0. L0 [d, e] ▶ L1 → L0 ⊢ T2 [d, e] ▶* U2.
131 /2 width=5/ qed.
132
133 lemma ltps_tpss_trans_eq: ∀L0,L1,T2,U2,d,e. L0 [d, e] ▶ L1 →
134                           L1 ⊢ T2 [d, e] ▶* U2 → L0 ⊢ T2 [d, e] ▶* U2.
135 #L0 #L1 #T2 #U2 #d #e #HL01 #H @(tpss_ind … H) -U2 //
136 #U #U2 #_ #HU2 #IHU @(tpss_trans_eq … IHU) /2 width=3/
137 qed.
138 *)