]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda-delta/Basic-2/substitution/ltps_tps.ma
- confluence of context-free reduction on terms (tpr) closed!
[helm.git] / matita / matita / contribs / lambda-delta / Basic-2 / substitution / ltps_tps.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/substitution/tps_lift.ma".
16 include "Basic-2/substitution/ltps_drop.ma".
17
18 (* PARALLEL SUBSTITUTION ON LOCAL ENVIRONMENTS ******************************)
19
20 lemma ltps_tps_conf_ge: ∀L0,T2,U2,d2,e2. L0 ⊢ T2 [d2, e2] ≫ U2 →
21                         ∀L1,d1,e1. L0 [d1, e1] ≫ L1 → d1 + e1 ≤ d2 →
22                         L1 ⊢ T2 [d2, e2] ≫ U2.
23 #L0 #T2 #U2 #d2 #e2 #H elim H -H L0 T2 U2 d2 e2
24 [ //
25 | #L0 #K0 #V0 #W0 #i2 #d2 #e2 #Hdi2 #Hide2 #HLK0 #HVW0 #L1 #d1 #e1 #HL01 #Hde1d2
26   lapply (transitive_le … Hde1d2 Hdi2) -Hde1d2 #Hde1i2
27   lapply (ltps_drop_conf_ge … HL01 … HLK0 ?) -HL01 HLK0 /2/
28 | #L0 #I #V2 #W2 #T2 #U2 #d2 #e2 #_ #_ #IHVW2 #IHTU2 #L1 #d1 #e1 #HL01 #Hde1d2
29   @tps_bind [ /2/ | @IHTU2 [3: /2/ |1,2: skip | /2/ ] ] (**) (* /3/ is too slow *)
30 | /3/
31 ]
32 qed.
33
34 lemma ltps_tps_conf: ∀L0,T2,U2,d2,e2. L0 ⊢ T2 [d2, e2] ≫ U2 →
35                      ∀L1,d1,e1. L0 [d1, e1] ≫ L1 →
36                      ∃∃T. L1 ⊢ T2 [d2, e2] ≫ T &
37                           L1 ⊢ U2 [d1, e1] ≫ T.
38 #L0 #T2 #U2 #d2 #e2 #H elim H -H L0 T2 U2 d2 e2
39 [ /2/
40 | #L0 #K0 #V0 #W0 #i2 #d2 #e2 #Hdi2 #Hide2 #HLK0 #HVW0 #L1 #d1 #e1 #HL01
41   elim (lt_or_ge i2 d1) #Hi2d1
42   [ elim (ltps_drop_conf_le … HL01 … HLK0 ?) -HL01 HLK0 /2/ #X #H #HLK1
43     elim (ltps_inv_tps11 … H ?) -H [2: /2/ ] #K1 #V1 #_ #HV01 #H destruct -X;
44     lapply (drop_fwd_drop2 … HLK1) #H
45     elim (lift_total V1 0 (i2 + 1)) #W1 #HVW1
46     lapply (tps_lift_ge … HV01 … H HVW0 HVW1 ?) -H HV01 HVW0 // >arith_a2 /3/
47   | elim (lt_or_ge i2 (d1 + e1)) #Hde1i2
48     [ elim (ltps_drop_conf_be … HL01 … HLK0 ? ?) -HL01 HLK0 [2,3: /2/ ] #X #H #HLK1
49       elim (ltps_inv_tps21 … H ?) -H [2: /2/ ] #K1 #V1 #_ #HV01 #H destruct -X;
50       lapply (drop_fwd_drop2 … HLK1) #H
51       elim (lift_total V1 0 (i2 + 1)) #W1 #HVW1
52       lapply (tps_lift_ge … HV01 … H HVW0 HVW1 ?) -H HV01 HVW0 // normalize #HW01
53       lapply (tps_weak … HW01 d1 e1 ? ?) [2,3: /3/ ] >arith_i2 //
54     | lapply (ltps_drop_conf_ge … HL01 … HLK0 ?) -HL01 HLK0 /3/
55     ]
56   ]
57 | #L0 #I #V2 #W2 #T2 #U2 #d2 #e2 #_ #_ #IHVW2 #IHTU2 #L1 #d1 #e1 #HL01
58   elim (IHVW2 … HL01) -IHVW2 #V #HV2 #HVW2
59   elim (IHTU2 (L1. 𝕓{I} V) (d1 + 1) e1 ?) -IHTU2 [2: /2/ ] -HL01 /3 width=5/
60 | #L0 #I #V2 #W2 #T2 #U2 #d2 #e2 #_ #_ #IHVW2 #IHTU2 #L1 #d1 #e1 #HL01
61   elim (IHVW2 … HL01) -IHVW2;
62   elim (IHTU2 … HL01) -IHTU2 HL01 /3 width=5/
63 ]
64 qed.
65
66 lemma ltps_tps_trans_ge: ∀L0,T2,U2,d2,e2. L0 ⊢ T2 [d2, e2] ≫ U2 →
67                          ∀L1,d1,e1. L1 [d1, e1] ≫ L0 → d1 + e1 ≤ d2 →
68                          L1 ⊢ T2 [d2, e2] ≫ U2.
69 #L0 #T2 #U2 #d2 #e2 #H elim H -H L0 T2 U2 d2 e2
70 [ //
71 | #L0 #K0 #V0 #W0 #i2 #d2 #e2 #Hdi2 #Hide2 #HLK0 #HVW0 #L1 #d1 #e1 #HL10 #Hde1d2
72   lapply (transitive_le … Hde1d2 Hdi2) -Hde1d2 #Hde1i2
73   lapply (ltps_drop_trans_ge … HL10 … HLK0 ?) -HL10 HLK0 /2/
74 | #L0 #I #V2 #W2 #T2 #U2 #d2 #e2 #_ #_ #IHVW2 #IHTU2 #L1 #d1 #e1 #HL10 #Hde1d2
75   @tps_bind [ /2/ | @IHTU2 [3: /2/ |1,2: skip | /2/ ] ] (**) (* /3/ is too slow *)
76 | /3/
77 ]
78 qed.
79
80 lemma ltps_tps_trans: ∀L0,T2,U2,d2,e2. L0 ⊢ T2 [d2, e2] ≫ U2 →
81                       ∀L1,d1,e1. L1 [d1, e1] ≫ L0 →
82                       ∃∃T. L1 ⊢ T2 [d2, e2] ≫ T &
83                            L0 ⊢ T [d1, e1] ≫ U2.
84 #L0 #T2 #U2 #d2 #e2 #H elim H -H L0 T2 U2 d2 e2
85 [ /2/
86 | #L0 #K0 #V0 #W0 #i2 #d2 #e2 #Hdi2 #Hide2 #HLK0 #HVW0 #L1 #d1 #e1 #HL10
87   elim (lt_or_ge i2 d1) #Hi2d1
88   [ elim (ltps_drop_trans_le … HL10 … HLK0 ?) -HL10 /2/ #X #H #HLK1
89     elim (ltps_inv_tps12 … H ?) -H [2: /2/ ] #K1 #V1 #_ #HV01 #H destruct -X;
90     lapply (drop_fwd_drop2 … HLK0) -HLK0 #H
91     elim (lift_total V1 0 (i2 + 1)) #W1 #HVW1
92     lapply (tps_lift_ge … HV01 … H HVW1 HVW0 ?) -H HV01 HVW0 // >arith_a2 /3/
93   | elim (lt_or_ge i2 (d1 + e1)) #Hde1i2
94     [ elim (ltps_drop_trans_be … HL10 … HLK0 ? ?) -HL10 [2,3: /2/ ] #X #H #HLK1
95       elim (ltps_inv_tps22 … H ?) -H [2: /2/ ] #K1 #V1 #_ #HV01 #H destruct -X;
96       lapply (drop_fwd_drop2 … HLK0) -HLK0 #H
97       elim (lift_total V1 0 (i2 + 1)) #W1 #HVW1
98       lapply (tps_lift_ge … HV01 … H HVW1 HVW0 ?) -H HV01 HVW0 // normalize #HW01
99       lapply (tps_weak … HW01 d1 e1 ? ?) [2,3: /3/ ] >arith_i2 //
100     | lapply (ltps_drop_trans_ge … HL10 … HLK0 ?) -HL10 HLK0 /3/
101     ]
102   ]
103 | #L0 #I #V2 #W2 #T2 #U2 #d2 #e2 #_ #_ #IHVW2 #IHTU2 #L1 #d1 #e1 #HL10
104   elim (IHVW2 … HL10) -IHVW2 #V #HV2 #HVW2
105   elim (IHTU2 (L1. 𝕓{I} V) (d1 + 1) e1 ?) -IHTU2 [2: /2/ ] -HL10 /3 width=5/
106 | #L0 #I #V2 #W2 #T2 #U2 #d2 #e2 #_ #_ #IHVW2 #IHTU2 #L1 #d1 #e1 #HL10
107   elim (IHVW2 … HL10) -IHVW2;
108   elim (IHTU2 … HL10) -IHTU2 HL10 /3 width=5/
109 ]
110 qed.