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 "static_2/notation/relations/stareqsn_4.ma".
16 include "static_2/syntax/teqg_ext.ma".
17 include "static_2/static/rex.ma".
19 (* GENERIC EQUIVALENCE FOR LOCAL ENVIRONMENTS ON REFERRED ENTRIES ***********)
21 definition reqg (S): relation3 โฆ โ
25 "generic equivalence on selected entries (local environment)"
26 'StarEqSn S f L1 L2 = (sex (ceqg_ext S) cfull f L1 L2).
29 "generic equivalence on referred entries (local environment)"
30 'StarEqSn S T L1 L2 = (reqg S T L1 L2).
32 (* Basic properties ***********************************************************)
34 lemma frees_teqg_conf_seqg (S):
35 โf,L1,T1. L1 โข ๐
+โจT1โฉ โ f โ โT2. T1 โ[S] T2 โ
36 โL2. L1 โ[S,f] L2 โ L2 โข ๐
+โจT2โฉ โ f.
37 #S #f #L1 #T1 #H elim H -f -L1 -T1
38 [ #f #L1 #s1 #Hf #X #H1 #L2 #_
39 elim (teqg_inv_sort1 โฆ H1) -H1 #s2 #_ #H destruct
40 /2 width=3 by frees_sort/
42 >(teqg_inv_lref1 โฆ H1) -X #Y #H2
43 >(sex_inv_atom1 โฆ H2) -Y
44 /2 width=1 by frees_atom/
45 | #f #I #L1 #V1 #_ #IH #X #H1
46 >(teqg_inv_lref1 โฆ H1) -X #Y #H2
47 elim (sex_inv_next1 โฆ H2) -H2 #Z #L2 #HL12 #HZ #H destruct
48 elim (ext2_inv_pair_sn โฆ HZ) -HZ #V2 #HV12 #H destruct
49 /3 width=1 by frees_pair/
50 | #f #I #L1 #Hf #X #H1
51 >(teqg_inv_lref1 โฆ H1) -X #Y #H2
52 elim (sex_inv_next1 โฆ H2) -H2 #Z #L2 #_ #HZ #H destruct
53 >(ext2_inv_unit_sn โฆ HZ) -Z /2 width=1 by frees_unit/
54 | #f #I #L1 #i #_ #IH #X #H1
55 >(teqg_inv_lref1 โฆ H1) -X #Y #H2
56 elim (sex_inv_push1 โฆ H2) -H2 #J #L2 #HL12 #_ #H destruct
57 /3 width=1 by frees_lref/
58 | #f #L1 #l #Hf #X #H1 #L2 #_
59 >(teqg_inv_gref1 โฆ H1) -X /2 width=1 by frees_gref/
60 | #f1V #f1T #f1 #p #I #L1 #V1 #T1 #_ #_ #Hf1 #IHV #IHT #X #H1
61 elim (teqg_inv_pair1 โฆ H1) -H1 #V2 #T2 #HV12 #HT12 #H1 #L2 #HL12 destruct
62 /6 width=5 by frees_bind, sex_inv_tl, ext2_pair, sle_sex_trans, pr_sor_inv_sle_dx, pr_sor_inv_sle_sn/
63 | #f1V #f1T #f1 #I #L1 #V1 #T1 #_ #_ #Hf1 #IHV #IHT #X #H1
64 elim (teqg_inv_pair1 โฆ H1) -H1 #V2 #T2 #HV12 #HT12 #H1 #L2 #HL12 destruct
65 /5 width=5 by frees_flat, sle_sex_trans, pr_sor_inv_sle_dx, pr_sor_inv_sle_sn/
69 lemma frees_teqg_conf (S):
71 โf,L,T1. L โข ๐
+โจT1โฉ โ f โ
72 โT2. T1 โ[S] T2 โ L โข ๐
+โจT2โฉ โ f.
73 /5 width=6 by frees_teqg_conf_seqg, sex_refl, teqg_refl, ext2_refl/ qed-.
75 lemma frees_seqg_conf (S):
77 โf,L1,T. L1 โข ๐
+โจTโฉ โ f โ
78 โL2. L1 โ[S,f] L2 โ L2 โข ๐
+โจTโฉ โ f.
79 /3 width=6 by frees_teqg_conf_seqg, teqg_refl/ qed-.
81 lemma teqg_rex_conf_sn (S) (R):
83 s_r_confluent1 โฆ (ceqg S) (rex R).
84 #S #R #HS #L1 #T1 #T2 #HT12 #L2 *
85 /3 width=5 by frees_teqg_conf, ex2_intro/
88 lemma teqg_rex_div (S) (R):
89 reflexive โฆ S โ symmetric โฆ S โ
90 โT1,T2. T1 โ[S] T2 โ
91 โL1,L2. L1 โชค[R,T2] L2 โ L1 โชค[R,T1] L2.
92 /3 width=5 by teqg_rex_conf_sn, teqg_sym/ qed-.
94 lemma teqg_reqg_conf_sn (S1) (S2):
96 s_r_confluent1 โฆ (ceqg S1) (reqg S2).
97 /2 width=5 by teqg_rex_conf_sn/ qed-.
99 lemma teqg_reqg_div (S1) (S2):
100 reflexive โฆ S1 โ symmetric โฆ S1 โ
101 โT1,T2. T1 โ[S1] T2 โ
102 โL1,L2. L1 โ[S2,T2] L2 โ L1 โ[S2,T1] L2.
103 /2 width=6 by teqg_rex_div/ qed-.
106 โI. โ โ[S,โช[I]] โ.
107 /2 width=1 by rex_atom/ qed.
111 L1 โ[S,โs] L2 โ L1.โ[I1] โ[S,โs] L2.โ[I2].
112 /2 width=1 by rex_sort/ qed.
116 L1 โ[S,V1] L2 โ V1 โ[S] V2 โ L1.โ[I]V1 โ[S,#0] L2.โ[I]V2.
117 /2 width=1 by rex_pair/ qed.
120 โf,I,L1,L2. ๐โจfโฉ โ L1 โ[S,f] L2 โ
121 L1.โค[I] โ[S,#0] L2.โค[I].
122 /2 width=3 by rex_unit/ qed.
126 L1 โ[S,#i] L2 โ L1.โ[I1] โ[S,#โi] L2.โ[I2].
127 /2 width=1 by rex_lref/ qed.
131 L1 โ[S,ยงl] L2 โ L1.โ[I1] โ[S,ยงl] L2.โ[I2].
132 /2 width=1 by rex_gref/ qed.
134 lemma reqg_bind_repl_dx (S):
135 โI,I1,L1,L2.โT:term. L1.โ[I] โ[S,T] L2.โ[I1] โ
136 โI2. I โ[S] I2 โ L1.โ[I] โ[S,T] L2.โ[I2].
137 /2 width=2 by rex_bind_repl_dx/ qed-.
139 lemma reqg_co (S1) (S2):
141 โT:term. โL1,L2. L1 โ[S1,T] L2 โ L1 โ[S2,T] L2.
142 /3 width=3 by rex_co, teqg_co/ qed-.
144 (* Basic inversion lemmas ***************************************************)
146 lemma reqg_inv_atom_sn (S):
147 โY2. โT:term. โ โ[S,T] Y2 โ Y2 = โ.
148 /2 width=3 by rex_inv_atom_sn/ qed-.
150 lemma reqg_inv_atom_dx (S):
151 โY1. โT:term. Y1 โ[S,T] โ โ Y1 = โ.
152 /2 width=3 by rex_inv_atom_dx/ qed-.
154 lemma reqg_inv_zero (S):
155 โY1,Y2. Y1 โ[S,#0] Y2 โ
156 โจโจ โงโง Y1 = โ & Y2 = โ
157 | โโI,L1,L2,V1,V2. L1 โ[S,V1] L2 & V1 โ[S] V2 & Y1 = L1.โ[I]V1 & Y2 = L2.โ[I]V2
158 | โโf,I,L1,L2. ๐โจfโฉ & L1 โ[S,f] L2 & Y1 = L1.โค[I] & Y2 = L2.โค[I].
159 #S #Y1 #Y2 #H elim (rex_inv_zero โฆ H) -H *
160 /3 width=9 by or3_intro0, or3_intro1, or3_intro2, ex4_5_intro, ex4_4_intro, conj/
163 lemma reqg_inv_lref (S):
164 โY1,Y2,i. Y1 โ[S,#โi] Y2 โ
165 โจโจ โงโง Y1 = โ & Y2 = โ
166 | โโI1,I2,L1,L2. L1 โ[S,#i] L2 & Y1 = L1.โ[I1] & Y2 = L2.โ[I2].
167 /2 width=1 by rex_inv_lref/ qed-.
169 (* Basic_2A1: uses: lleq_inv_bind lleq_inv_bind_O *)
170 lemma reqg_inv_bind_refl (S):
172 โp,I,L1,L2,V,T. L1 โ[S,โ[p,I]V.T] L2 โ
173 โงโง L1 โ[S,V] L2 & L1.โ[I]V โ[S,T] L2.โ[I]V.
174 /3 width=2 by rex_inv_bind, teqg_refl/ qed-.
176 (* Basic_2A1: uses: lleq_inv_flat *)
177 lemma reqg_inv_flat (S):
178 โI,L1,L2,V,T. L1 โ[S,โ[I]V.T] L2 โ
179 โงโง L1 โ[S,V] L2 & L1 โ[S,T] L2.
180 /2 width=2 by rex_inv_flat/ qed-.
182 (* Advanced inversion lemmas ************************************************)
184 lemma reqg_inv_zero_pair_sn (S):
185 โI,Y2,L1,V1. L1.โ[I]V1 โ[S,#0] Y2 โ
186 โโL2,V2. L1 โ[S,V1] L2 & V1 โ[S] V2 & Y2 = L2.โ[I]V2.
187 /2 width=1 by rex_inv_zero_pair_sn/ qed-.
189 lemma reqg_inv_zero_pair_dx (S):
190 โI,Y1,L2,V2. Y1 โ[S,#0] L2.โ[I]V2 โ
191 โโL1,V1. L1 โ[S,V1] L2 & V1 โ[S] V2 & Y1 = L1.โ[I]V1.
192 /2 width=1 by rex_inv_zero_pair_dx/ qed-.
194 lemma reqg_inv_lref_bind_sn (S):
195 โI1,Y2,L1,i. L1.โ[I1] โ[S,#โi] Y2 โ
196 โโI2,L2. L1 โ[S,#i] L2 & Y2 = L2.โ[I2].
197 /2 width=2 by rex_inv_lref_bind_sn/ qed-.
199 lemma reqg_inv_lref_bind_dx (S):
200 โI2,Y1,L2,i. Y1 โ[S,#โi] L2.โ[I2] โ
201 โโI1,L1. L1 โ[S,#i] L2 & Y1 = L1.โ[I1].
202 /2 width=2 by rex_inv_lref_bind_dx/ qed-.
204 (* Basic forward lemmas *****************************************************)
206 lemma reqg_fwd_zero_pair (S):
208 K1.โ[I]V1 โ[S,#0] K2.โ[I]V2 โ K1 โ[S,V1] K2.
209 /2 width=3 by rex_fwd_zero_pair/ qed-.
211 (* Basic_2A1: uses: lleq_fwd_bind_sn lleq_fwd_flat_sn *)
212 lemma reqg_fwd_pair_sn (S):
213 โI,L1,L2,V,T. L1 โ[S,โก[I]V.T] L2 โ L1 โ[S,V] L2.
214 /2 width=3 by rex_fwd_pair_sn/ qed-.
216 (* Basic_2A1: uses: lleq_fwd_bind_dx lleq_fwd_bind_O_dx *)
217 lemma reqg_fwd_bind_dx (S):
220 L1 โ[S,โ[p,I]V.T] L2 โ L1.โ[I]V โ[S,T] L2.โ[I]V.
221 /3 width=2 by rex_fwd_bind_dx, teqg_refl/ qed-.
223 (* Basic_2A1: uses: lleq_fwd_flat_dx *)
224 lemma reqg_fwd_flat_dx (S):
225 โI,L1,L2,V,T. L1 โ[S,โ[I]V.T] L2 โ L1 โ[S,T] L2.
226 /2 width=3 by rex_fwd_flat_dx/ qed-.
228 lemma reqg_fwd_dx (S):
229 โI2,L1,K2. โT:term. L1 โ[S,T] K2.โ[I2] โ
230 โโI1,K1. L1 = K1.โ[I1].
231 /2 width=5 by rex_fwd_dx/ qed-.