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/cpys_lift.ma".
16 include "basic_2/substitution/lleq.ma".
18 (* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
20 (* Advanced properties ******************************************************)
22 lemma lleq_skip: ∀L1,L2,d,i. yinj i < d → |L1| = |L2| → L1 ⋕[#i, d] L2.
23 #L1 #L2 #d #i #Hid #HL12 @conj // -HL12
24 #U @conj #H elim (cpys_inv_lref1 … H) -H // *
25 #I #Z #Y #X #H elim (ylt_yle_false … Hid … H)
28 lemma lleq_lref: ∀I1,I2,L1,L2,K1,K2,V,d,i. d ≤ yinj i →
29 ⇩[i] L1 ≡ K1.ⓑ{I1}V → ⇩[i] L2 ≡ K2.ⓑ{I2}V →
30 K1 ⋕[V, 0] K2 → L1 ⋕[#i, d] L2.
31 #I1 #I2 #L1 #L2 #K1 #K2 #V #d #i #Hdi #HLK1 #HLK2 * #HK12 #IH @conj [ -IH | -HK12 ]
32 [ lapply (ldrop_fwd_length … HLK1) -HLK1 #H1
33 lapply (ldrop_fwd_length … HLK2) -HLK2 #H2
34 >H1 >H2 -H1 -H2 normalize //
35 | #U @conj #H elim (cpys_inv_lref1 … H) -H // *
36 >yminus_Y_inj #I #K #X #W #_ #_ #H #HVW #HWU
37 [ letin HLK ≝ HLK1 | letin HLK ≝ HLK2 ]
38 lapply (ldrop_mono … H … HLK) -H #H destruct elim (IH W)
39 /3 width=7 by cpys_subst_Y2/
43 lemma lleq_free: ∀L1,L2,d,i. |L1| ≤ i → |L2| ≤ i → |L1| = |L2| → L1 ⋕[#i, d] L2.
44 #L1 #L2 #d #i #HL1 #HL2 #HL12 @conj // -HL12
45 #U @conj #H elim (cpys_inv_lref1 … H) -H // *
46 #I #Z #Y #X #_ #_ #H lapply (ldrop_fwd_length_lt2 … H) -H
47 #H elim (lt_refl_false i) /2 width=3 by lt_to_le_to_lt/
50 (* Properties on relocation *************************************************)
52 lemma lleq_lift_le: ∀K1,K2,T,dt. K1 ⋕[T, dt] K2 →
53 ∀L1,L2,d,e. ⇩[Ⓕ, d, e] L1 ≡ K1 → ⇩[Ⓕ, d, e] L2 ≡ K2 →
54 ∀U. ⇧[d, e] T ≡ U → dt ≤ d → L1 ⋕[U, dt] L2.
55 #K1 #K2 #T #dt * #HK12 #IHT #L1 #L2 #d #e #HLK1 #HLK2 #U #HTU #Hdtd
56 lapply (ldrop_fwd_length … HLK1) lapply (ldrop_fwd_length … HLK2)
57 #H2 #H1 @conj // -HK12 -H1 -H2 #U0 @conj #HU0
58 [ letin HLKA ≝ HLK1 letin HLKB ≝ HLK2 | letin HLKA ≝ HLK2 letin HLKB ≝ HLK1 ]
59 elim (cpys_inv_lift1_be … HU0 … HLKA … HTU) // -HU0 >yminus_Y_inj #T0 #HT0 #HTU0
60 elim (IHT T0) [ #H #_ | #_ #H ] -IHT /3 width=12 by cpys_lift_be/
63 lemma lleq_lift_ge: ∀K1,K2,T,dt. K1 ⋕[T, dt] K2 →
64 ∀L1,L2,d,e. ⇩[Ⓕ, d, e] L1 ≡ K1 → ⇩[Ⓕ, d, e] L2 ≡ K2 →
65 ∀U. ⇧[d, e] T ≡ U → d ≤ dt → L1 ⋕[U, dt+e] L2.
66 #K1 #K2 #T #dt * #HK12 #IHT #L1 #L2 #d #e #HLK1 #HLK2 #U #HTU #Hddt
67 lapply (ldrop_fwd_length … HLK1) lapply (ldrop_fwd_length … HLK2)
68 #H2 #H1 @conj // -HK12 -H1 -H2 #U0 @conj #HU0
69 [ letin HLKA ≝ HLK1 letin HLKB ≝ HLK2 | letin HLKA ≝ HLK2 letin HLKB ≝ HLK1 ]
70 elim (cpys_inv_lift1_ge … HU0 … HLKA … HTU) /2 width=1 by monotonic_yle_plus_dx/ -HU0 >yplus_minus_inj #T0 #HT0 #HTU0
71 elim (IHT T0) [ #H #_ | #_ #H ] -IHT /3 width=10 by cpys_lift_ge/
74 (* Inversion lemmas on relocation *******************************************)
76 lemma lleq_inv_lift_le: ∀L1,L2,U,dt. L1 ⋕[U, dt] L2 →
77 ∀K1,K2,d,e. ⇩[Ⓕ, d, e] L1 ≡ K1 → ⇩[Ⓕ, d, e] L2 ≡ K2 →
78 ∀T. ⇧[d, e] T ≡ U → dt ≤ d → K1 ⋕[T, dt] K2.
79 #L1 #L2 #U #dt * #HL12 #IH #K1 #K2 #d #e #HLK1 #HLK2 #T #HTU #Hdtd
80 lapply (ldrop_fwd_length_minus2 … HLK1) lapply (ldrop_fwd_length_minus2 … HLK2)
81 #H2 #H1 @conj // -HL12 -H1 -H2
82 #T0 elim (lift_total T0 d e)
83 #U0 #HTU0 elim (IH U0) -IH
85 [ letin HLKA ≝ HLK1 letin HLKB ≝ HLK2 letin H0 ≝ H12 | letin HLKA ≝ HLK2 letin HLKB ≝ HLK1 letin H0 ≝ H21 ]
86 lapply (cpys_lift_be … HT0 … HLKA … HTU … HTU0) // -HT0
87 >yplus_Y1 #HU0 elim (cpys_inv_lift1_be … (H0 HU0) … HLKB … HTU) // -L1 -L2 -U -Hdtd
88 #X #HT0 #HX lapply (lift_inj … HX … HTU0) -U0 //
91 lemma lleq_inv_lift_ge: ∀L1,L2,U,dt. L1 ⋕[U, dt] L2 →
92 ∀K1,K2,d,e. ⇩[Ⓕ, d, e] L1 ≡ K1 → ⇩[Ⓕ, d, e] L2 ≡ K2 →
93 ∀T. ⇧[d, e] T ≡ U → yinj d + e ≤ dt → K1 ⋕[T, dt-e] K2.
94 #L1 #L2 #U #dt * #HL12 #IH #K1 #K2 #d #e #HLK1 #HLK2 #T #HTU #Hdedt
95 lapply (ldrop_fwd_length_minus2 … HLK1) lapply (ldrop_fwd_length_minus2 … HLK2)
96 #H2 #H1 @conj // -HL12 -H1 -H2
97 elim (yle_inv_plus_inj2 … Hdedt) #Hddt #Hedt
98 #T0 elim (lift_total T0 d e)
99 #U0 #HTU0 elim (IH U0) -IH
101 [ letin HLKA ≝ HLK1 letin HLKB ≝ HLK2 letin H0 ≝ H12 | letin HLKA ≝ HLK2 letin HLKB ≝ HLK1 letin H0 ≝ H21 ]
102 lapply (cpys_lift_ge … HT0 … HLKA … HTU … HTU0) // -HT0 -Hddt
103 >ymax_pre_sn // #HU0 elim (cpys_inv_lift1_ge … (H0 HU0) … HLKB … HTU) // -L1 -L2 -U -Hdedt -Hedt
104 #X #HT0 #HX lapply (lift_inj … HX … HTU0) -U0 //
107 lemma lleq_inv_lift_be: ∀L1,L2,U,dt. L1 ⋕[U, dt] L2 →
108 ∀K1,K2,d,e. ⇩[Ⓕ, d, e] L1 ≡ K1 → ⇩[Ⓕ, d, e] L2 ≡ K2 →
109 ∀T. ⇧[d, e] T ≡ U → d ≤ dt → dt ≤ yinj d + e → K1 ⋕[T, d] K2.
110 #L1 #L2 #U #dt * #HL12 #IH #K1 #K2 #d #e #HLK1 #HLK2 #T #HTU #Hddt #Hdtde
111 lapply (ldrop_fwd_length_minus2 … HLK1) lapply (ldrop_fwd_length_minus2 … HLK2)
112 #H2 #H1 @conj // -HL12 -H1 -H2
113 #T0 elim (lift_total T0 d e)
114 #U0 #HTU0 elim (IH U0) -IH
116 [ letin HLKA ≝ HLK1 letin HLKB ≝ HLK2 letin H0 ≝ H12 | letin HLKA ≝ HLK2 letin HLKB ≝ HLK1 letin H0 ≝ H21 ]
117 lapply (cpys_lift_ge … HT0 … HLKA … HTU … HTU0) // -HT0
118 #HU0 lapply (cpys_weak … HU0 dt (∞) ? ?) // -HU0
120 #HU0 lapply (cpys_weak … HU0 d (∞) ? ?) // -HU0
121 #HU0 elim (cpys_inv_lift1_ge_up … HU0 … HLKB … HTU) // -L1 -L2 -U -Hddt -Hdtde
122 #X #HT0 #HX lapply (lift_inj … HX … HTU0) -U0 //