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/relocation/llpx_sn_ldrop.ma".
16 include "basic_2/substitution/lleq.ma".
18 (* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
20 (* Advanced properties ******************************************************)
22 lemma lleq_bind_repl_O: ∀I,L1,L2,V,T. L1.ⓑ{I}V ⋕[T, 0] L2.ⓑ{I}V →
23 ∀J,W. L1 ⋕[W, 0] L2 → L1.ⓑ{J}W ⋕[T, 0] L2.ⓑ{J}W.
24 /2 width=7 by llpx_sn_bind_repl_O/ qed-.
26 lemma lleq_dec: ∀T,L1,L2,d. Decidable (L1 ⋕[T, d] L2).
27 /3 width=1 by llpx_sn_dec, eq_term_dec/ qed-.
29 lemma lleq_llpx_sn_trans: ∀R. lleq_transitive R →
30 ∀L1,L2,T,d. L1 ⋕[T, d] L2 →
31 ∀L. llpx_sn R d T L2 L → llpx_sn R d T L1 L.
32 #R #HR #L1 #L2 #T #d #H @(lleq_ind … H) -L1 -L2 -T -d
33 [1,2,5: /4 width=6 by llpx_sn_fwd_length, llpx_sn_gref, llpx_sn_skip, llpx_sn_sort, trans_eq/
34 |4: /4 width=6 by llpx_sn_fwd_length, llpx_sn_free, le_repl_sn_conf_aux, trans_eq/
35 | #I #L1 #L2 #K1 #K2 #V #d #i #Hdi #HLK1 #HLK2 #HK12 #IHK12 #L #H elim (llpx_sn_inv_lref_ge_sn … H … HLK2) -H -HLK2
36 /3 width=11 by llpx_sn_lref/
37 | #a #I #L1 #L2 #V #T #d #_ #_ #IHV #IHT #L #H elim (llpx_sn_inv_bind … H) -H
38 /3 width=1 by llpx_sn_bind/
39 | #I #L1 #L2 #V #T #d #_ #_ #IHV #IHT #L #H elim (llpx_sn_inv_flat … H) -H
40 /3 width=1 by llpx_sn_flat/
44 lemma lleq_llpx_sn_conf: ∀R. lleq_transitive R →
45 ∀L1,L2,T,d. L1 ⋕[T, d] L2 →
46 ∀L. llpx_sn R d T L1 L → llpx_sn R d T L2 L.
47 /3 width=3 by lleq_llpx_sn_trans, lleq_sym/ qed-.
49 (* Advanced inversion lemmas ************************************************)
51 lemma lleq_inv_lref_ge_dx: ∀L1,L2,d,i. L1 ⋕[#i, d] L2 → d ≤ i →
52 ∀I,K2,V. ⇩[i] L2 ≡ K2.ⓑ{I}V →
53 ∃∃K1. ⇩[i] L1 ≡ K1.ⓑ{I}V & K1 ⋕[V, 0] K2.
54 #L1 #L2 #d #i #H #Hdi #I #K2 #V #HLK2 elim (llpx_sn_inv_lref_ge_dx … H … HLK2) -L2
55 /2 width=3 by ex2_intro/
58 lemma lleq_inv_lref_ge_sn: ∀L1,L2,d,i. L1 ⋕[#i, d] L2 → d ≤ i →
59 ∀I,K1,V. ⇩[i] L1 ≡ K1.ⓑ{I}V →
60 ∃∃K2. ⇩[i] L2 ≡ K2.ⓑ{I}V & K1 ⋕[V, 0] K2.
61 #L1 #L2 #d #i #H #Hdi #I1 #K1 #V #HLK1 elim (llpx_sn_inv_lref_ge_sn … H … HLK1) -L1
62 /2 width=3 by ex2_intro/
65 lemma lleq_inv_lref_ge_bi: ∀L1,L2,d,i. L1 ⋕[#i, d] L2 → d ≤ i →
67 ⇩[i] L1 ≡ K1.ⓑ{I1}V1 → ⇩[i] L2 ≡ K2.ⓑ{I2}V2 →
68 ∧∧ I1 = I2 & K1 ⋕[V1, 0] K2 & V1 = V2.
69 /2 width=8 by llpx_sn_inv_lref_ge_bi/ qed-.
71 lemma lleq_inv_lref_ge: ∀L1,L2,d,i. L1 ⋕[#i, d] L2 → d ≤ i →
72 ∀I,K1,K2,V. ⇩[i] L1 ≡ K1.ⓑ{I}V → ⇩[i] L2 ≡ K2.ⓑ{I}V →
74 #L1 #L2 #d #i #HL12 #Hdi #I #K1 #K2 #V #HLK1 #HLK2
75 elim (lleq_inv_lref_ge_bi … HL12 … HLK1 HLK2) //
78 lemma lleq_inv_S: ∀L1,L2,T,d. L1 ⋕[T, d+1] L2 →
79 ∀I,K1,K2,V. ⇩[d] L1 ≡ K1.ⓑ{I}V → ⇩[d] L2 ≡ K2.ⓑ{I}V →
80 K1 ⋕[V, 0] K2 → L1 ⋕[T, d] L2.
81 /2 width=9 by llpx_sn_inv_S/ qed-.
83 lemma lleq_inv_bind_O: ∀a,I,L1,L2,V,T. L1 ⋕[ⓑ{a,I}V.T, 0] L2 →
84 L1 ⋕[V, 0] L2 ∧ L1.ⓑ{I}V ⋕[T, 0] L2.ⓑ{I}V.
85 /2 width=2 by llpx_sn_inv_bind_O/ qed-.
87 (* Advanced forward lemmas **************************************************)
89 lemma lleq_fwd_lref_dx: ∀L1,L2,d,i. L1 ⋕[#i, d] L2 →
90 ∀I,K2,V. ⇩[i] L2 ≡ K2.ⓑ{I}V →
92 ∃∃K1. ⇩[i] L1 ≡ K1.ⓑ{I}V & K1 ⋕[V, 0] K2 & d ≤ i.
93 #L1 #L2 #d #i #H #I #K2 #V #HLK2 elim (llpx_sn_fwd_lref_dx … H … HLK2) -L2
94 [ | * ] /3 width=3 by ex3_intro, or_intror, or_introl/
97 lemma lleq_fwd_lref_sn: ∀L1,L2,d,i. L1 ⋕[#i, d] L2 →
98 ∀I,K1,V. ⇩[i] L1 ≡ K1.ⓑ{I}V →
100 ∃∃K2. ⇩[i] L2 ≡ K2.ⓑ{I}V & K1 ⋕[V, 0] K2 & d ≤ i.
101 #L1 #L2 #d #i #H #I #K1 #V #HLK1 elim (llpx_sn_fwd_lref_sn … H … HLK1) -L1
102 [ | * ] /3 width=3 by ex3_intro, or_intror, or_introl/
105 lemma lleq_fwd_bind_O_dx: ∀a,I,L1,L2,V,T. L1 ⋕[ⓑ{a,I}V.T, 0] L2 →
106 L1.ⓑ{I}V ⋕[T, 0] L2.ⓑ{I}V.
107 /2 width=2 by llpx_sn_fwd_bind_O_dx/ qed-.
109 (* Properties on relocation *************************************************)
111 lemma lleq_lift_le: ∀K1,K2,T,dt. K1 ⋕[T, dt] K2 →
112 ∀L1,L2,d,e. ⇩[Ⓕ, d, e] L1 ≡ K1 → ⇩[Ⓕ, d, e] L2 ≡ K2 →
113 ∀U. ⇧[d, e] T ≡ U → dt ≤ d → L1 ⋕[U, dt] L2.
114 /3 width=10 by llpx_sn_lift_le, lift_mono/ qed-.
116 lemma lleq_lift_ge: ∀K1,K2,T,dt. K1 ⋕[T, dt] K2 →
117 ∀L1,L2,d,e. ⇩[Ⓕ, d, e] L1 ≡ K1 → ⇩[Ⓕ, d, e] L2 ≡ K2 →
118 ∀U. ⇧[d, e] T ≡ U → d ≤ dt → L1 ⋕[U, dt+e] L2.
119 /2 width=9 by llpx_sn_lift_ge/ qed-.
121 (* Inversion lemmas on relocation *******************************************)
123 lemma lleq_inv_lift_le: ∀L1,L2,U,dt. L1 ⋕[U, dt] L2 →
124 ∀K1,K2,d,e. ⇩[Ⓕ, d, e] L1 ≡ K1 → ⇩[Ⓕ, d, e] L2 ≡ K2 →
125 ∀T. ⇧[d, e] T ≡ U → dt ≤ d → K1 ⋕[T, dt] K2.
126 /3 width=10 by llpx_sn_inv_lift_le, ex2_intro/ qed-.
128 lemma lleq_inv_lift_be: ∀L1,L2,U,dt. L1 ⋕[U, dt] L2 →
129 ∀K1,K2,d,e. ⇩[Ⓕ, d, e] L1 ≡ K1 → ⇩[Ⓕ, d, e] L2 ≡ K2 →
130 ∀T. ⇧[d, e] T ≡ U → d ≤ dt → dt ≤ yinj d + e → K1 ⋕[T, d] K2.
131 /2 width=11 by llpx_sn_inv_lift_be/ qed-.
133 lemma lleq_inv_lift_ge: ∀L1,L2,U,dt. L1 ⋕[U, dt] L2 →
134 ∀K1,K2,d,e. ⇩[Ⓕ, d, e] L1 ≡ K1 → ⇩[Ⓕ, d, e] L2 ≡ K2 →
135 ∀T. ⇧[d, e] T ≡ U → yinj d + e ≤ dt → K1 ⋕[T, dt-e] K2.
136 /2 width=9 by llpx_sn_inv_lift_ge/ qed-.
138 (* Inversion lemmas on negated lazy quivalence for local environments *******)
140 lemma nlleq_inv_bind: ∀a,I,L1,L2,V,T,d. (L1 ⋕[ⓑ{a,I}V.T, d] L2 → ⊥) →
141 (L1 ⋕[V, d] L2 → ⊥) ∨ (L1.ⓑ{I}V ⋕[T, ⫯d] L2.ⓑ{I}V → ⊥).
142 /3 width=2 by nllpx_sn_inv_bind, eq_term_dec/ qed-.
144 lemma nlleq_inv_flat: ∀I,L1,L2,V,T,d. (L1 ⋕[ⓕ{I}V.T, d] L2 → ⊥) →
145 (L1 ⋕[V, d] L2 → ⊥) ∨ (L1 ⋕[T, d] L2 → ⊥).
146 /3 width=2 by nllpx_sn_inv_flat, eq_term_dec/ qed-.
148 lemma nlleq_inv_bind_O: ∀a,I,L1,L2,V,T. (L1 ⋕[ⓑ{a,I}V.T, 0] L2 → ⊥) →
149 (L1 ⋕[V, 0] L2 → ⊥) ∨ (L1.ⓑ{I}V ⋕[T, 0] L2.ⓑ{I}V → ⊥).
150 /3 width=2 by nllpx_sn_inv_bind_O, eq_term_dec/ qed-.