1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "lambda-delta/substitution/lift_fun.ma".
16 include "lambda-delta/substitution/lift_main.ma".
17 include "lambda-delta/substitution/drop_main.ma".
18 include "lambda-delta/reduction/pr_defs.ma".
20 lemma pr_lift: ∀L,T1,T2. L ⊢ T1 ⇒ T2 → ∀d,e,K. ↑[d,e] L ≡ K →
21 ∀U1. ↑[d,e] T1 ≡ U1 → ∀U2. ↑[d,e] T2 ≡ U2 → K ⊢ U1 ⇒ U2.
22 #L #T1 #T2 #H elim H -H L T1 T2
23 [ #L #k #d #e #K #_ #U1 #HU1 #U2 #HU2
24 lapply (lift_mono … HU1 … HU2) -HU1 #H destruct -U1;
25 lapply (lift_inv_sort1 … HU2) -HU2 #H destruct -U2 //
26 | #L #i #d #e #K #_ #U1 #HU1 #U2 #HU2
27 lapply (lift_mono … HU1 … HU2) -HU1 #H destruct -U1;
28 lapply (lift_inv_lref1 … HU2) * * #Hid #H destruct -U2 //
29 | #L #I #V1 #V2 #T1 #T2 #_ #_ #IHV12 #IHT12 #d #e #K #HKL #X1 #HX1 #X2 #HX2
30 elim (lift_inv_bind1 … HX1) -HX1 #W1 #U1 #HVW1 #HTU1 #HX1 destruct -X1;
31 elim (lift_inv_bind1 … HX2) -HX2 #W2 #U2 #HVW2 #HTU2 #HX2 destruct -X2
33 | #L #I #V1 #V2 #T1 #T2 #_ #_ #IHV12 #IHT12 #d #e #K #HKL #X1 #HX1 #X2 #HX2
34 elim (lift_inv_flat1 … HX1) -HX1 #W1 #U1 #HVW1 #HTU1 #HX1 destruct -X1;
35 elim (lift_inv_flat1 … HX2) -HX2 #W2 #U2 #HVW2 #HTU2 #HX2 destruct -X2
37 | #L #V1 #V2 #W #T1 #T2 #_ #_ #IHV12 #IHT12 #d #e #K #HKL #X1 #HX1 #X2 #HX2
38 elim (lift_inv_flat1 … HX1) -HX1 #V0 #X #HV10 #HX #HX1 destruct -X1;
39 elim (lift_inv_bind1 … HX) -HX #W0 #T0 #HW0 #HT10 #HX destruct -X;
40 elim (lift_inv_bind1 … HX2) -HX2 #V3 #T3 #HV23 #HT23 #HX2 destruct -X2
42 | #L #K0 #V1 #V2 #V0 #i #HLK0 #HV12 #HV20 #IHV12 #d #e #K #HKL #X #HX #V3 #HV03
43 lapply (lift_inv_lref1 … HX) -HX * * #Hid #H destruct -X;
45 elim (lift_trans_ge … HV20 … HV03 ?) -HV20 HV03 V0 // #V0 #HV20 #HV03
46 elim (drop_trans_le … HKL … HLK0 ?) -HKL HLK0 L /2/ #L #HKL #HLK0
47 elim (drop_inv_skip2 … HLK0 ?) -HLK0 /2/ #K1 #V #HK10 #HV #H destruct -L;
48 @pr_delta [4,6: // |1,2,3: skip |5: /2 width=5/] (**) (* /2 width=5/ *)
50 lapply (lift_trans_be … HV20 … HV03 ? ?) -HV20 HV03 V0 /2/ #HV23
51 lapply (drop_trans_ge … HKL … HLK0 ?) -HKL HLK0 L // -Hid #HKK0
54 | #L #V #V1 #V2 #W1 #W2 #T1 #T2 #_ #HV2 #_ #_ #IHV12 #IHW12 #IHT12 #d #e #K #HKL #X1 #HX1 #X2 #HX2
55 elim (lift_inv_flat1 … HX1) -HX1 #V0 #X #HV10 #HX #HX1 destruct -X1;
56 elim (lift_inv_bind1 … HX) -HX #W0 #T0 #HW0 #HT10 #HX destruct -X;
57 elim (lift_inv_bind1 … HX2) -HX2 #W3 #X #HW23 #HX #HX2 destruct -X2;
58 elim (lift_inv_flat1 … HX) -HX #V3 #T3 #HV3 #HT23 #HX destruct -X;
59 lapply (lift_trans_ge … HV2 … HV3 ?) -HV2 HV3 V // * #V #HV2 #HV3
61 | #L #V #T #T1 #T2 #HT1 #_ #IHT12 #d #e #K #HKL #X #HX #T0 #HT20
62 elim (lift_inv_bind1 … HX) -HX #V3 #T3 #_ #HT3 #HX destruct -X;
63 lapply (lift_trans_ge … HT1 … HT3 ?) -HT1 HT3 T // * #T #HT1 #HT3
64 @pr_zeta [2: // |1:skip | /2 width=5/] (**) (* /2 width=5/ *)
65 | #L #V #T1 #T2 #_ #IHT12 #d #e #K #HKL #X #HX #T #HT2
66 elim (lift_inv_flat1 … HX) -HX #V0 #T0 #_ #HT0 #HX destruct -X;
71 lemma pr_inv_lift: ∀L,T1,T2. L ⊢ T1 ⇒ T2 →
72 ∀d,e,K. ↑[d,e] K ≡ L → ∀U1. ↑[d,e] U1 ≡ T1 →
73 ∃∃U2. ↑[d,e] U2 ≡ T2 & K ⊢ U1 ⇒ U2.
74 #L #T1 #T2 #H elim H -H L T1 T2
75 [ #L #k #d #e #K #_ #U1 #HU1
76 lapply (lift_inv_sort2 … HU1) -HU1 #H destruct -U1 /2/
77 | #L #i #d #e #K #_ #U1 #HU1
78 lapply (lift_inv_lref2 … HU1) -HU1 * * #Hid #H destruct -U1 /3/
79 | #L #I #V1 #V2 #T1 #T2 #_ #_ #IHV12 #IHT12 #d #e #K #HLK #X #HX
80 elim (lift_inv_bind2 … HX) -HX #V0 #T0 #HV01 #HT01 #HX destruct -X;
81 elim (IHV12 … HLK … HV01) -IHV12 #V3 #HV32 #HV03
82 elim (IHT12 … HT01) -IHT12 HT01 [2,3: -HV32 HV03 /3/] -HLK HV01 /3 width=5/
83 | #L #I #V1 #V2 #T1 #T2 #_ #_ #IHV12 #IHT12 #d #e #K #HLK #X #HX
84 elim (lift_inv_flat2 … HX) -HX #V0 #T0 #HV01 #HT01 #HX destruct -X;
85 elim (IHV12 … HLK … HV01) -IHV12 HV01 #V3 #HV32 #HV03
86 elim (IHT12 … HLK … HT01) -IHT12 HT01 HLK /3 width=5/
87 | #L #V1 #V2 #W1 #T1 #T2 #_ #_ #IHV12 #IHT12 #d #e #K #HLK #X #HX
88 elim (lift_inv_flat2 … HX) -HX #V0 #Y #HV01 #HY #HX destruct -X;
89 elim (lift_inv_bind2 … HY) -HY #W0 #T0 #HW01 #HT01 #HY destruct -Y;
90 elim (IHV12 … HLK … HV01) -IHV12 HV01 #V3 #HV32 #HV03
91 elim (IHT12 … HT01) -IHT12 HT01
92 [3: -HV32 HV03 @(drop_skip … HLK) /2/ |2: skip ] (**) (* /3 width=5/ is too slow *)
95 | #L #K0 #V1 #V2 #V0 #i #HLK0 #HV12 #HV20 #IHV12 #d #e #K #HLK #X #HX
96 lapply (lift_inv_lref2 … HX) -HX * * #Hid #HX destruct -X;
98 elim (drop_conf_lt … HLK … HLK0 Hid) -HLK HLK0 L #L #V3 #HKL #HK0L #HV31
99 elim (IHV12 … HK0L … HV31) -IHV12 HK0L HV31 #V4 #HV42 #HV34
100 elim (lift_trans_le … HV42 … HV20 ?) -HV42 HV20 V2 // #V2 #HV42
101 >arith5 // -Hid #HV20
102 @(ex2_1_intro … V2) /2 width=6/ (**) (* /3 width=8/ is slow *)
104 lapply (drop_conf_ge … HLK … HLK0 Hid) -HLK HLK0 L #HK
105 elim (lift_free … HV20 d (i - e + 1) ? ? ?) -HV20 /2/
106 >arith3 /2/ -Hid /3 width=8/ (**) (* just /3 width=8/ is a bit slow *)
108 | #L #V #V1 #V2 #W1 #W2 #T1 #T2 #_ #HV2 #_ #_ #IHV12 #IHW12 #IHT12 #d #e #K #HLK #X #HX
109 elim (lift_inv_flat2 … HX) -HX #V0 #Y #HV01 #HY #HX destruct -X;
110 elim (lift_inv_bind2 … HY) -HY #W0 #T0 #HW01 #HT01 #HY destruct -Y;
111 elim (IHV12 ? ? ? HLK ? HV01) -IHV12 HV01 #V3 #HV32 #HV03
112 elim (IHW12 ? ? ? HLK ? HW01) -IHW12 #W3 #HW32 #HW03
113 elim (IHT12 … HT01) -IHT12 HT01
114 [3: -HV2 HV32 HV03 HW32 HW03 @(drop_skip … HLK) /2/ |2: skip ] (**) (* /3/ is too slow *)
115 -HLK HW01 #T3 #HT32 #HT03
116 elim (lift_trans_le … HV32 … HV2 ?) -HV32 HV2 V2 // #V2 #HV32 #HV2
117 @(ex2_1_intro … (𝕓{Abbr}W3.𝕗{Appl}V2.T3)) /3/ (**) (* /4/ loops *)
118 | #L #V #T #T1 #T2 #HT1 #_ #IHT12 #d #e #K #HLK #X #HX
119 elim (lift_inv_bind2 … HX) -HX #V0 #T0 #_ #HT0 #H destruct -X;
120 elim (lift_div_le … HT1 … HT0 ?) -HT1 HT0 T // #T #HT0 #HT1
121 elim (IHT12 … HLK … HT1) -IHT12 HLK HT1 /3 width=5/
122 | #L #V #T1 #T2 #_ #IHT12 #d #e #K #HLK #X #HX
123 elim (lift_inv_flat2 … HX) -HX #V0 #T0 #_ #HT01 #H destruct -X;
124 elim (IHT12 … HLK … HT01) -IHT12 HLK HT01 /3/