]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/reduction/cpx_lift.ma
- degree assignment, static type assignment, iterated static type
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / reduction / cpx_lift.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/relocation/ldrop_ldrop.ma".
16 include "basic_2/relocation/fsupq.ma".
17 include "basic_2/static/ssta.ma".
18 include "basic_2/reduction/cpx.ma".
19
20 (* CONTEXT-SENSITIVE EXTENDED PARALLEL REDUCTION FOR TERMS ******************)
21
22 (* Advanced properties ******************************************************)
23
24 lemma ssta_cpx: ∀h,g,G,L,T1,T2,l. ⦃G, L⦄ ⊢ T1 •[h, g] T2 →
25                 ⦃G, L⦄ ⊢ T1 ▪[h, g] l+1 → ⦃G, L⦄ ⊢ T1 ➡[h, g] T2.
26 #h #g #G #L #T1 #T2 #l #H elim H -G -L -T1 -T2
27 [ #G #L #k #H lapply (da_inv_sort … H) -H /2 width=2/
28 | #G #L #K #V #U #W #i #HLK #_ #HWU #IHVW #H
29   elim (da_inv_lref … H) -H * #K0 #V0 [| #l0 ] #HLK0
30   lapply (ldrop_mono … HLK0 … HLK) -HLK0 #H destruct /3 width=7/
31 | #G #L #K #W #U #l0 #i #HLK #_ #HWU #H
32   elim (da_inv_lref … H) -H * #K0 #W0 [| #l1 ] #HLK0
33   lapply (ldrop_mono … HLK0 … HLK) -HLK0 #H destruct /2 width=7/
34 | #a #I #G #L #V #T #U #_ #IHTU #H lapply (da_inv_bind … H) -H /3 width=1/
35 | #G #L #V #T #U #_ #IHTU #H lapply (da_inv_flat … H) -H /3 width=1/
36 | #G #L #W #T #U #_ #IHTU #H lapply (da_inv_flat … H) -H /3 width=1/
37 ]
38 qed.
39
40 (* Relocation properties ****************************************************)
41
42 lemma cpx_lift: ∀h,g,G. l_liftable (cpx h g G).
43 #h #g #G #K #T1 #T2 #H elim H -G -K -T1 -T2
44 [ #I #G #K #L #d #e #_ #U1 #H1 #U2 #H2
45   >(lift_mono … H1 … H2) -H1 -H2 //
46 | #G #K #k #l #Hkl #L #d #e #_ #U1 #H1 #U2 #H2
47   >(lift_inv_sort1 … H1) -U1
48   >(lift_inv_sort1 … H2) -U2 /2 width=2/
49 | #I #G #K #KV #V #V2 #W2 #i #HKV #HV2 #HVW2 #IHV2 #L #d #e #HLK #U1 #H #U2 #HWU2
50   elim (lift_inv_lref1 … H) * #Hid #H destruct
51   [ elim (lift_trans_ge … HVW2 … HWU2) -W2 // <minus_plus #W2 #HVW2 #HWU2
52     elim (ldrop_trans_le … HLK … HKV) -K /2 width=2/ #X #HLK #H
53     elim (ldrop_inv_skip2 … H) -H /2 width=1/ -Hid #K #Y #HKV #HVY #H destruct /3 width=9/
54   | lapply (lift_trans_be … HVW2 … HWU2 ? ?) -W2 // /2 width=1/ >plus_plus_comm_23 #HVU2
55     lapply (ldrop_trans_ge_comm … HLK … HKV ?) -K // -Hid /3 width=7/
56   ]
57 | #a #I #G #K #V1 #V2 #T1 #T2 #_ #_ #IHV12 #IHT12 #L #d #e #HLK #U1 #H1 #U2 #H2
58   elim (lift_inv_bind1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1 destruct
59   elim (lift_inv_bind1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct /4 width=5/
60 | #I #G #K #V1 #V2 #T1 #T2 #_ #_ #IHV12 #IHT12 #L #d #e #HLK #U1 #H1 #U2 #H2
61   elim (lift_inv_flat1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1 destruct
62   elim (lift_inv_flat1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct /3 width=6/
63 | #G #K #V #T1 #T #T2 #_ #HT2 #IHT1 #L #d #e #HLK #U1 #H #U2 #HTU2
64   elim (lift_inv_bind1 … H) -H #VV1 #TT1 #HVV1 #HTT1 #H destruct
65   elim (lift_conf_O1 … HTU2 … HT2) -T2 /4 width=5/
66 | #G #K #V #T1 #T2 #_ #IHT12 #L #d #e #HLK #U1 #H #U2 #HTU2
67   elim (lift_inv_flat1 … H) -H #VV1 #TT1 #HVV1 #HTT1 #H destruct /3 width=5/
68 | #G #K #V1 #V2 #T #_ #IHV12 #L #d #e #HLK #U1 #H #U2 #HVU2
69   elim (lift_inv_flat1 … H) -H #VV1 #TT1 #HVV1 #HTT1 #H destruct /3 width=5/
70 | #a #G #K #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #IHV12 #IHW12 #IHT12 #L #d #e #HLK #X1 #HX1 #X2 #HX2
71   elim (lift_inv_flat1 … HX1) -HX1 #V0 #X #HV10 #HX #HX1 destruct
72   elim (lift_inv_bind1 … HX) -HX #W0 #T0 #HW0 #HT10 #HX destruct
73   elim (lift_inv_bind1 … HX2) -HX2 #X #T3 #HX #HT23 #HX2 destruct
74   elim (lift_inv_flat1 … HX) -HX #W3 #V3 #HW23 #HV23 #HX destruct /4 width=5/
75 | #a #G #K #V1 #V #V2 #W1 #W2 #T1 #T2 #_ #HV2 #_ #_ #IHV1 #IHW12 #IHT12 #L #d #e #HLK #X1 #HX1 #X2 #HX2
76   elim (lift_inv_flat1 … HX1) -HX1 #V0 #X #HV10 #HX #HX1 destruct
77   elim (lift_inv_bind1 … HX) -HX #W0 #T0 #HW0 #HT10 #HX destruct
78   elim (lift_inv_bind1 … HX2) -HX2 #W3 #X #HW23 #HX #HX2 destruct
79   elim (lift_inv_flat1 … HX) -HX #V3 #T3 #HV3 #HT23 #HX destruct
80   elim (lift_trans_ge … HV2 … HV3) -V2 // /4 width=5/
81 ]
82 qed.
83
84 lemma cpx_inv_lift1: ∀h,g,G. l_deliftable_sn (cpx h g G).
85 #h #g #G #L #U1 #U2 #H elim H -G -L -U1 -U2
86 [ * #G #L #i #K #d #e #_ #T1 #H
87   [ lapply (lift_inv_sort2 … H) -H #H destruct /2 width=3/
88   | elim (lift_inv_lref2 … H) -H * #Hid #H destruct /3 width=3/
89   | lapply (lift_inv_gref2 … H) -H #H destruct /2 width=3/
90   ]
91 | #G #L #k #l #Hkl #K #d #e #_ #T1 #H
92   lapply (lift_inv_sort2 … H) -H #H destruct /3 width=3/
93 | #I #G #L #LV #V #V2 #W2 #i #HLV #HV2 #HVW2 #IHV2 #K #d #e #HLK #T1 #H
94   elim (lift_inv_lref2 … H) -H * #Hid #H destruct
95   [ elim (ldrop_conf_lt … HLK … HLV) -L // #L #U #HKL #HLV #HUV
96     elim (IHV2 … HLV … HUV) -V #U2 #HUV2 #HU2
97     elim (lift_trans_le … HUV2 … HVW2) -V2 // >minus_plus <plus_minus_m_m // -Hid /3 width=9/
98   | elim (le_inv_plus_l … Hid) #Hdie #Hei
99     lapply (ldrop_conf_ge … HLK … HLV ?) -L // #HKLV
100     elim (lift_split … HVW2 d (i - e + 1)) -HVW2 [4: // |3: /2 width=1/ |2: /3 width=1/ ] -Hid -Hdie
101     #V1 #HV1 >plus_minus // <minus_minus // /2 width=1/ <minus_n_n <plus_n_O /3 width=9/
102   ]
103 | #a #I #G #L #V1 #V2 #U1 #U2 #_ #_ #IHV12 #IHU12 #K #d #e #HLK #X #H
104   elim (lift_inv_bind2 … H) -H #W1 #T1 #HWV1 #HTU1 #H destruct
105   elim (IHV12 … HLK … HWV1) -IHV12 #W2 #HW12 #HWV2
106   elim (IHU12 … HTU1) -IHU12 -HTU1 /3 width=5/
107 | #I #G #L #V1 #V2 #U1 #U2 #_ #_ #IHV12 #IHU12 #K #d #e #HLK #X #H
108   elim (lift_inv_flat2 … H) -H #W1 #T1 #HWV1 #HTU1 #H destruct
109   elim (IHV12 … HLK … HWV1) -V1
110   elim (IHU12 … HLK … HTU1) -U1 -HLK /3 width=5/
111 | #G #L #V #U1 #U #U2 #_ #HU2 #IHU1 #K #d #e #HLK #X #H
112   elim (lift_inv_bind2 … H) -H #W1 #T1 #HWV1 #HTU1 #H destruct
113   elim (IHU1 (K.ⓓW1) … HTU1) /2 width=1/ -L -U1 #T #HTU #HT1
114   elim (lift_div_le … HU2 … HTU) -U // /3 width=5/
115 | #G #L #V #U1 #U2 #_ #IHU12 #K #d #e #HLK #X #H
116   elim (lift_inv_flat2 … H) -H #W1 #T1 #HWV1 #HTU1 #H destruct
117   elim (IHU12 … HLK … HTU1) -L -U1 /3 width=3/
118 | #G #L #V1 #V2 #U1 #_ #IHV12 #K #d #e #HLK #X #H
119   elim (lift_inv_flat2 … H) -H #W1 #T1 #HWV1 #HTU1 #H destruct
120   elim (IHV12 … HLK … HWV1) -L -V1 /3 width=3/
121 | #a #G #L #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #IHV12 #IHW12 #IHT12 #K #d #e #HLK #X #HX
122   elim (lift_inv_flat2 … HX) -HX #V0 #Y #HV01 #HY #HX destruct
123   elim (lift_inv_bind2 … HY) -HY #W0 #T0 #HW01 #HT01 #HY destruct
124   elim (IHV12 … HLK … HV01) -V1 #V3 #HV32 #HV03
125   elim (IHT12 (K.ⓛW0) … HT01) -T1 /2 width=1/ #T3 #HT32 #HT03
126   elim (IHW12 … HLK … HW01) -W1 #W3 #HW32 #HW03
127   @ex2_intro [2: /3 width=2/ | skip |3: /2 width=1/ ] (**) (* /4 width=6/ is slow *)
128 | #a #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #_ #HV2 #_ #_ #IHV1 #IHW12 #IHT12 #K #d #e #HLK #X #HX
129   elim (lift_inv_flat2 … HX) -HX #V0 #Y #HV01 #HY #HX destruct
130   elim (lift_inv_bind2 … HY) -HY #W0 #T0 #HW01 #HT01 #HY destruct
131   elim (IHV1 … HLK … HV01) -V1 #V3 #HV3 #HV03
132   elim (IHT12 (K.ⓓW0) … HT01) -T1 /2 width=1/ #T3 #HT32 #HT03
133   elim (IHW12 … HLK … HW01) -W1 #W3 #HW32 #HW03
134   elim (lift_trans_le … HV3 … HV2) -V // #V #HV3 #HV2
135   @ex2_intro [2: /3 width=2/ | skip |3: /2 width=3/ ] (**) (* /4 width=5/ is slow *)
136 ]
137 qed-.
138
139 (* Properties on supclosure *************************************************)
140
141 lemma fsupq_cpx_trans: ∀h,g,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊃⸮ ⦃G2, L2, T2⦄ →
142                        ∀U2. ⦃G2, L2⦄ ⊢ T2 ➡[h, g] U2 →
143                        ∃∃U1. ⦃G1, L1⦄ ⊢ T1 ➡[h, g] U1 & ⦃G1, L1, U1⦄ ⊃⸮ ⦃G2, L2, U2⦄.
144 #h #g #G1 #G2 #L1 #L2 #T1 #T2 #H elim H -G1 -G2 -L1 -L2 -T1 -T2 [1: /2 width=3/ |3,4,5: /3 width=3/ ]
145 [ #I #G #L1 #V2 #U2 #HVU2
146   elim (lift_total U2 0 1) /4 width=9/
147 | #G1 #G2 #L1 #K1 #K2 #T1 #T2 #U1 #d #e #HLK1 #HTU1 #_ #IHT12 #U2 #HTU2
148   elim (IHT12 … HTU2) -IHT12 -HTU2 #T #HT1 #HT2
149   elim (lift_total T d e) #U #HTU
150   lapply (cpx_lift … HT1 … HLK1 … HTU1 … HTU) -HT1 -HTU1 /3 width=11/
151 ]
152 qed-.
153
154 lemma fsupq_ssta_trans: ∀h,g,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊃⸮ ⦃G2, L2, T2⦄ →
155                         ∀U2. ⦃G2, L2⦄ ⊢ T2 •[h, g] U2 →
156                         ∀l. ⦃G2, L2⦄ ⊢ T2 ▪[h, g] l+1 →
157                         ∃∃U1. ⦃G1, L1⦄ ⊢ T1 ➡[h, g] U1 & ⦃G1, L1, U1⦄ ⊃⸮ ⦃G2, L2, U2⦄.
158 /3 width=5 by fsupq_cpx_trans, ssta_cpx/ qed-.
159
160 lemma fsup_cpx_trans: ∀h,g,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊃ ⦃G2, L2, T2⦄ →
161                       ∀U2. ⦃G2, L2⦄ ⊢ T2 ➡[h, g] U2 →
162                       ∃∃U1. ⦃G1, L1⦄ ⊢ T1 ➡[h, g] U1 & ⦃G1, L1, U1⦄ ⊃⸮ ⦃G2, L2, U2⦄.
163 /3 width=3 by fsupq_cpx_trans, fsup_fsupq/ qed-.
164
165 lemma fsup_ssta_trans: ∀h,g,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊃ ⦃G2, L2, T2⦄ →
166                        ∀U2. ⦃G2, L2⦄ ⊢ T2 •[h, g] U2 →
167                        ∀l. ⦃G2, L2⦄ ⊢ T2 ▪[h, g] l+1 →
168                        ∃∃U1. ⦃G1, L1⦄ ⊢ T1 ➡[h, g] U1 & ⦃G1, L1, U1⦄ ⊃⸮ ⦃G2, L2, U2⦄.
169 /3 width=5 by fsupq_ssta_trans, fsup_fsupq/ qed-.