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 "Basic_2/substitution/tps_lift.ma".
17 (* PARALLEL SUBSTITUTION ON TERMS *******************************************)
19 (* Main properties **********************************************************)
21 (* Basic_1: was: subst1_confluence_eq *)
22 theorem tps_conf_eq: ∀L,T0,T1,d1,e1. L ⊢ T0 [d1, e1] ≫ T1 →
23 ∀T2,d2,e2. L ⊢ T0 [d2, e2] ≫ T2 →
24 ∃∃T. L ⊢ T1 [d2, e2] ≫ T & L ⊢ T2 [d1, e1] ≫ T.
25 #L #T0 #T1 #d1 #e1 #H elim H -L -T0 -T1 -d1 -e1
27 | #L #K1 #V1 #T1 #i0 #d1 #e1 #Hd1 #Hde1 #HLK1 #HVT1 #T2 #d2 #e2 #H
28 elim (tps_inv_lref1 … H) -H
29 [ #HX destruct /4 width=4/
30 | -Hd1 -Hde1 * #K2 #V2 #_ #_ #HLK2 #HVT2
31 lapply (ldrop_mono … HLK1 … HLK2) -HLK1 -HLK2 #H destruct
32 >(lift_mono … HVT1 … HVT2) -HVT1 -HVT2 /2 width=3/
34 | #L #I #V0 #V1 #T0 #T1 #d1 #e1 #_ #_ #IHV01 #IHT01 #X #d2 #e2 #HX
35 elim (tps_inv_bind1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
36 lapply (tps_lsubs_conf … HT02 (L. 𝕓{I} V1) ?) -HT02 /2 width=1/ #HT02
37 elim (IHV01 … HV02) -V0 #V #HV1 #HV2
38 elim (IHT01 … HT02) -T0 #T #HT1 #HT2
39 lapply (tps_lsubs_conf … HT1 (L. 𝕓{I} V) ?) -HT1 /2 width=1/
40 lapply (tps_lsubs_conf … HT2 (L. 𝕓{I} V) ?) -HT2 /3 width=5/
41 | #L #I #V0 #V1 #T0 #T1 #d1 #e1 #_ #_ #IHV01 #IHT01 #X #d2 #e2 #HX
42 elim (tps_inv_flat1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
43 elim (IHV01 … HV02) -V0
44 elim (IHT01 … HT02) -T0 /3 width=5/
48 (* Basic_1: was: subst1_confluence_neq *)
49 theorem tps_conf_neq: ∀L1,T0,T1,d1,e1. L1 ⊢ T0 [d1, e1] ≫ T1 →
50 ∀L2,T2,d2,e2. L2 ⊢ T0 [d2, e2] ≫ T2 →
51 (d1 + e1 ≤ d2 ∨ d2 + e2 ≤ d1) →
52 ∃∃T. L2 ⊢ T1 [d2, e2] ≫ T & L1 ⊢ T2 [d1, e1] ≫ T.
53 #L1 #T0 #T1 #d1 #e1 #H elim H -L1 -T0 -T1 -d1 -e1
55 | #L1 #K1 #V1 #T1 #i0 #d1 #e1 #Hd1 #Hde1 #HLK1 #HVT1 #L2 #T2 #d2 #e2 #H1 #H2
56 elim (tps_inv_lref1 … H1) -H1
57 [ #H destruct /4 width=4/
58 | -HLK1 -HVT1 * #K2 #V2 #Hd2 #Hde2 #_ #_ elim H2 -H2 #Hded
60 lapply (transitive_le … Hded Hd2) -Hded -Hd2 #H
61 lapply (lt_to_le_to_lt … Hde1 H) -Hde1 -H #H
62 elim (lt_refl_false … H)
64 lapply (transitive_le … Hded Hd1) -Hded -Hd1 #H
65 lapply (lt_to_le_to_lt … Hde2 H) -Hde2 -H #H
66 elim (lt_refl_false … H)
69 | #L1 #I #V0 #V1 #T0 #T1 #d1 #e1 #_ #_ #IHV01 #IHT01 #L2 #X #d2 #e2 #HX #H
70 elim (tps_inv_bind1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
71 elim (IHV01 … HV02 H) -V0 #V #HV1 #HV2
72 elim (IHT01 … HT02 ?) -T0
74 lapply (tps_lsubs_conf … HT1 (L2. 𝕓{I} V) ?) -HT1 /2 width=1/
75 lapply (tps_lsubs_conf … HT2 (L1. 𝕓{I} V) ?) -HT2 /2 width=1/ /3 width=5/
76 | -HV1 -HV2 >plus_plus_comm_23 >plus_plus_comm_23 in ⊢ (? ? %); elim H -H #H
77 [ @or_introl | @or_intror ] /2 by monotonic_le_plus_l/ (**) (* /3 / is too slow *)
79 | #L1 #I #V0 #V1 #T0 #T1 #d1 #e1 #_ #_ #IHV01 #IHT01 #L2 #X #d2 #e2 #HX #H
80 elim (tps_inv_flat1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
81 elim (IHV01 … HV02 H) -V0
82 elim (IHT01 … HT02 H) -T0 -H /3 width=5/
86 (* Note: the constant 1 comes from tps_subst *)
87 (* Basic_1: was: subst1_trans *)
88 theorem tps_trans_ge: ∀L,T1,T0,d,e. L ⊢ T1 [d, e] ≫ T0 →
89 ∀T2. L ⊢ T0 [d, 1] ≫ T2 → 1 ≤ e →
91 #L #T1 #T0 #d #e #H elim H -L -T1 -T0 -d -e
92 [ #L #I #d #e #T2 #H #He
93 elim (tps_inv_atom1 … H) -H
95 | * #K #V #i #Hd2i #Hide2 #HLK #HVT2 #H destruct
96 lapply (lt_to_le_to_lt … (d + e) Hide2 ?) /2 width=4/
98 | #L #K #V #V2 #i #d #e #Hdi #Hide #HLK #HVW #T2 #HVT2 #He
99 lapply (tps_weak … HVT2 0 (i +1) ? ?) -HVT2 /2 width=1/ #HVT2
100 <(tps_inv_lift1_eq … HVT2 … HVW) -HVT2 /2 width=4/
101 | #L #I #V1 #V0 #T1 #T0 #d #e #_ #_ #IHV10 #IHT10 #X #H #He
102 elim (tps_inv_bind1 … H) -H #V2 #T2 #HV02 #HT02 #H destruct
103 lapply (tps_lsubs_conf … HT02 (L. 𝕓{I} V0) ?) -HT02 /2 width=1/ #HT02
104 lapply (IHT10 … HT02 He) -T0 #HT12
105 lapply (tps_lsubs_conf … HT12 (L. 𝕓{I} V2) ?) -HT12 /2 width=1/ /3 width=1/
106 | #L #I #V1 #V0 #T1 #T0 #d #e #_ #_ #IHV10 #IHT10 #X #H #He
107 elim (tps_inv_flat1 … H) -H #V2 #T2 #HV02 #HT02 #H destruct /3 width=1/
111 theorem tps_trans_down: ∀L,T1,T0,d1,e1. L ⊢ T1 [d1, e1] ≫ T0 →
112 ∀T2,d2,e2. L ⊢ T0 [d2, e2] ≫ T2 → d2 + e2 ≤ d1 →
113 ∃∃T. L ⊢ T1 [d2, e2] ≫ T & L ⊢ T [d1, e1] ≫ T2.
114 #L #T1 #T0 #d1 #e1 #H elim H -L -T1 -T0 -d1 -e1
116 | #L #K #V #W #i1 #d1 #e1 #Hdi1 #Hide1 #HLK #HVW #T2 #d2 #e2 #HWT2 #Hde2d1
117 lapply (transitive_le … Hde2d1 Hdi1) -Hde2d1 #Hde2i1
118 lapply (tps_weak … HWT2 0 (i1 + 1) ? ?) -HWT2 normalize /2 width=1/ -Hde2i1 #HWT2
119 <(tps_inv_lift1_eq … HWT2 … HVW) -HWT2 /4 width=4/
120 | #L #I #V1 #V0 #T1 #T0 #d1 #e1 #_ #_ #IHV10 #IHT10 #X #d2 #e2 #HX #de2d1
121 elim (tps_inv_bind1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
122 lapply (tps_lsubs_conf … HT02 (L. 𝕓{I} V0) ?) -HT02 /2 width=1/ #HT02
123 elim (IHV10 … HV02 ?) -IHV10 -HV02 // #V
124 elim (IHT10 … HT02 ?) -T0 /2 width=1/ #T #HT1 #HT2
125 lapply (tps_lsubs_conf … HT1 (L. 𝕓{I} V) ?) -HT1 /2 width=1/
126 lapply (tps_lsubs_conf … HT2 (L. 𝕓{I} V2) ?) -HT2 /2 width=1/ /3 width=6/
127 | #L #I #V1 #V0 #T1 #T0 #d1 #e1 #_ #_ #IHV10 #IHT10 #X #d2 #e2 #HX #de2d1
128 elim (tps_inv_flat1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
129 elim (IHV10 … HV02 ?) -V0 //
130 elim (IHT10 … HT02 ?) -T0 // /3 width=6/