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 "ground/xoa/ex_2_3.ma".
16 include "ground/xoa/ex_3_2.ma".
17 include "ground/xoa/ex_3_3.ma".
18 include "ground/xoa/ex_3_4.ma".
19 include "static_2/notation/relations/lrsubeqc_2.ma".
20 include "static_2/syntax/lenv.ma".
22 (* RESTRICTED REFINEMENT FOR LOCAL ENVIRONMENTS *****************************)
24 (* Basic_2A1: just tpr_cpr and tprs_cprs require the extended lsubr_atom *)
25 (* Basic_2A1: includes: lsubr_pair *)
26 inductive lsubr: relation lenv ≝
27 | lsubr_atom: lsubr (⋆) (⋆)
28 | lsubr_bind: ∀I,L1,L2. lsubr L1 L2 → lsubr (L1.ⓘ[I]) (L2.ⓘ[I])
29 | lsubr_beta: ∀L1,L2,V,W. lsubr L1 L2 → lsubr (L1.ⓓⓝW.V) (L2.ⓛW)
30 | lsubr_unit: ∀I1,I2,L1,L2,V. lsubr L1 L2 → lsubr (L1.ⓑ[I1]V) (L2.ⓤ[I2])
34 "restricted refinement (local environment)"
35 'LRSubEqC L1 L2 = (lsubr L1 L2).
37 (* Basic properties *********************************************************)
39 lemma lsubr_refl: ∀L. L ⫃ L.
40 #L elim L -L /2 width=1 by lsubr_atom, lsubr_bind/
43 (* Basic inversion lemmas ***************************************************)
45 fact lsubr_inv_atom1_aux: ∀L1,L2. L1 ⫃ L2 → L1 = ⋆ → L2 = ⋆.
47 [ #I #L1 #L2 #_ #H destruct
48 | #L1 #L2 #V #W #_ #H destruct
49 | #I1 #I2 #L1 #L2 #V #_ #H destruct
53 lemma lsubr_inv_atom1: ∀L2. ⋆ ⫃ L2 → L2 = ⋆.
54 /2 width=3 by lsubr_inv_atom1_aux/ qed-.
56 fact lsubr_inv_bind1_aux:
57 ∀L1,L2. L1 ⫃ L2 → ∀I,K1. L1 = K1.ⓘ[I] →
58 ∨∨ ∃∃K2. K1 ⫃ K2 & L2 = K2.ⓘ[I]
59 | ∃∃K2,V,W. K1 ⫃ K2 & L2 = K2.ⓛW & I = BPair Abbr (ⓝW.V)
60 | ∃∃J1,J2,K2,V. K1 ⫃ K2 & L2 = K2.ⓤ[J2] & I = BPair J1 V.
63 | #I #L1 #L2 #HL12 #J #K1 #H destruct /3 width=3 by or3_intro0, ex2_intro/
64 | #L1 #L2 #V #W #HL12 #J #K1 #H destruct /3 width=6 by or3_intro1, ex3_3_intro/
65 | #I1 #I2 #L1 #L2 #V #HL12 #J #K1 #H destruct /3 width=4 by or3_intro2, ex3_4_intro/
69 (* Basic_2A1: uses: lsubr_inv_pair1 *)
70 lemma lsubr_inv_bind1:
71 ∀I,K1,L2. K1.ⓘ[I] ⫃ L2 →
72 ∨∨ ∃∃K2. K1 ⫃ K2 & L2 = K2.ⓘ[I]
73 | ∃∃K2,V,W. K1 ⫃ K2 & L2 = K2.ⓛW & I = BPair Abbr (ⓝW.V)
74 | ∃∃J1,J2,K2,V. K1 ⫃ K2 & L2 = K2.ⓤ[J2] & I = BPair J1 V.
75 /2 width=3 by lsubr_inv_bind1_aux/ qed-.
77 fact lsubr_inv_atom2_aux: ∀L1,L2. L1 ⫃ L2 → L2 = ⋆ → L1 = ⋆.
79 [ #I #L1 #L2 #_ #H destruct
80 | #L1 #L2 #V #W #_ #H destruct
81 | #I1 #I2 #L1 #L2 #V #_ #H destruct
85 lemma lsubr_inv_atom2: ∀L1. L1 ⫃ ⋆ → L1 = ⋆.
86 /2 width=3 by lsubr_inv_atom2_aux/ qed-.
88 fact lsubr_inv_bind2_aux:
89 ∀L1,L2. L1 ⫃ L2 → ∀I,K2. L2 = K2.ⓘ[I] →
90 ∨∨ ∃∃K1. K1 ⫃ K2 & L1 = K1.ⓘ[I]
91 | ∃∃K1,W,V. K1 ⫃ K2 & L1 = K1.ⓓⓝW.V & I = BPair Abst W
92 | ∃∃J1,J2,K1,V. K1 ⫃ K2 & L1 = K1.ⓑ[J1]V & I = BUnit J2.
95 | #I #L1 #L2 #HL12 #J #K2 #H destruct /3 width=3 by ex2_intro, or3_intro0/
96 | #L1 #L2 #V1 #V2 #HL12 #J #K2 #H destruct /3 width=6 by ex3_3_intro, or3_intro1/
97 | #I1 #I2 #L1 #L2 #V #HL12 #J #K2 #H destruct /3 width=5 by ex3_4_intro, or3_intro2/
101 lemma lsubr_inv_bind2:
102 ∀I,L1,K2. L1 ⫃ K2.ⓘ[I] →
103 ∨∨ ∃∃K1. K1 ⫃ K2 & L1 = K1.ⓘ[I]
104 | ∃∃K1,W,V. K1 ⫃ K2 & L1 = K1.ⓓⓝW.V & I = BPair Abst W
105 | ∃∃J1,J2,K1,V. K1 ⫃ K2 & L1 = K1.ⓑ[J1]V & I = BUnit J2.
106 /2 width=3 by lsubr_inv_bind2_aux/ qed-.
108 (* Advanced inversion lemmas ************************************************)
110 lemma lsubr_inv_abst1:
111 ∀K1,L2,W. K1.ⓛW ⫃ L2 →
112 ∨∨ ∃∃K2. K1 ⫃ K2 & L2 = K2.ⓛW
113 | ∃∃I2,K2. K1 ⫃ K2 & L2 = K2.ⓤ[I2].
114 #K1 #L2 #W #H elim (lsubr_inv_bind1 … H) -H *
115 /3 width=4 by ex2_2_intro, ex2_intro, or_introl, or_intror/
116 #K2 #V2 #W2 #_ #_ #H destruct
119 lemma lsubr_inv_unit1:
120 ∀I,K1,L2. K1.ⓤ[I] ⫃ L2 →
121 ∃∃K2. K1 ⫃ K2 & L2 = K2.ⓤ[I].
122 #I #K1 #L2 #H elim (lsubr_inv_bind1 … H) -H *
123 [ #K2 #HK12 #H destruct /2 width=3 by ex2_intro/
124 | #K2 #V #W #_ #_ #H destruct
125 | #J1 #J2 #K2 #V #_ #_ #H destruct
129 lemma lsubr_inv_pair2:
130 ∀I,L1,K2,W. L1 ⫃ K2.ⓑ[I]W →
131 ∨∨ ∃∃K1. K1 ⫃ K2 & L1 = K1.ⓑ[I]W
132 | ∃∃K1,V. K1 ⫃ K2 & L1 = K1.ⓓⓝW.V & I = Abst.
133 #I #L1 #K2 #W #H elim (lsubr_inv_bind2 … H) -H *
134 [ /3 width=3 by ex2_intro, or_introl/
135 | #K1 #X #V #HK12 #H1 #H2 destruct /3 width=4 by ex3_2_intro, or_intror/
136 | #J1 #J1 #K1 #V #_ #_ #H destruct
140 lemma lsubr_inv_abbr2:
141 ∀L1,K2,V. L1 ⫃ K2.ⓓV →
142 ∃∃K1. K1 ⫃ K2 & L1 = K1.ⓓV.
143 #L1 #K2 #V #H elim (lsubr_inv_pair2 … H) -H *
144 [ /2 width=3 by ex2_intro/
145 | #K1 #X #_ #_ #H destruct
149 lemma lsubr_inv_abst2:
150 ∀L1,K2,W. L1 ⫃ K2.ⓛW →
151 ∨∨ ∃∃K1. K1 ⫃ K2 & L1 = K1.ⓛW
152 | ∃∃K1,V. K1 ⫃ K2 & L1 = K1.ⓓⓝW.V.
153 #L1 #K2 #W #H elim (lsubr_inv_pair2 … H) -H *
154 /3 width=4 by ex2_2_intro, ex2_intro, or_introl, or_intror/
157 lemma lsubr_inv_unit2:
158 ∀I,L1,K2. L1 ⫃ K2.ⓤ[I] →
159 ∨∨ ∃∃K1. K1 ⫃ K2 & L1 = K1.ⓤ[I]
160 | ∃∃J,K1,V. K1 ⫃ K2 & L1 = K1.ⓑ[J]V.
161 #I #L1 #K2 #H elim (lsubr_inv_bind2 … H) -H *
162 [ /3 width=3 by ex2_intro, or_introl/
163 | #K1 #W #V #_ #_ #H destruct
164 | #J1 #J2 #K1 #V #HK12 #H1 #H2 destruct /3 width=5 by ex2_3_intro, or_intror/
168 (* Basic forward lemmas *****************************************************)
170 lemma lsubr_fwd_bind1:
171 ∀I1,K1,L2. K1.ⓘ[I1] ⫃ L2 →
172 ∃∃I2,K2. K1 ⫃ K2 & L2 = K2.ⓘ[I2].
173 #I1 #K1 #L2 #H elim (lsubr_inv_bind1 … H) -H *
174 [ #K2 #HK12 #H destruct /3 width=4 by ex2_2_intro/
175 | #K2 #W1 #V1 #HK12 #H1 #H2 destruct /3 width=4 by ex2_2_intro/
176 | #J1 #J2 #K2 #V1 #HK12 #H1 #H2 destruct /3 width=4 by ex2_2_intro/
180 lemma lsubr_fwd_bind2:
181 ∀I2,L1,K2. L1 ⫃ K2.ⓘ[I2] →
182 ∃∃I1,K1. K1 ⫃ K2 & L1 = K1.ⓘ[I1].
183 #I2 #L1 #K2 #H elim (lsubr_inv_bind2 … H) -H *
184 [ #K1 #HK12 #H destruct /3 width=4 by ex2_2_intro/
185 | #K1 #W1 #V1 #HK12 #H1 #H2 destruct /3 width=4 by ex2_2_intro/
186 | #J1 #J2 #K1 #V1 #HK12 #H1 #H2 destruct /3 width=4 by ex2_2_intro/