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_2/lib/star.ma".
16 include "basic_2/notation/relations/relationstarstar_4.ma".
17 include "basic_2/static/lfxs.ma".
19 (* ITERATED EXTENSION ON REFERRED ENTRIES OF A CONTEXT-SENSITIVE REALTION ***)
21 definition tc_lfxs (R): term → relation lenv ≝ LTC … (lfxs R).
23 interpretation "iterated extension on referred entries (local environment)"
24 'RelationStarStar R T L1 L2 = (tc_lfxs R T L1 L2).
26 (* Basic properties *********************************************************)
28 lemma tc_lfxs_step_dx: ∀R,L1,L,T. L1 ⦻**[R, T] L →
29 ∀L2. L ⦻*[R, T] L2 → L1 ⦻**[R, T] L2.
30 #R #L1 #L2 #T #HL1 #L2 @step @HL1 (**) (* auto fails *)
33 lemma tc_lfxs_step_sn: ∀R,L1,L,T. L1 ⦻*[R, T] L →
34 ∀L2. L ⦻**[R, T] L2 → L1 ⦻**[R, T] L2.
35 #R #L1 #L2 #T #HL1 #L2 @TC_strap @HL1 (**) (* auto fails *)
38 lemma tc_lfxs_atom: ∀R,I. ⋆ ⦻**[R, ⓪{I}] ⋆.
39 /2 width=1 by inj/ qed.
41 lemma tc_lfxs_sort: ∀R,I,L1,L2,V1,V2,s.
42 L1 ⦻**[R, ⋆s] L2 → L1.ⓑ{I}V1 ⦻**[R, ⋆s] L2.ⓑ{I}V2.
43 #R #I #L1 #L2 #V1 #V2 #s #H elim H -L2
44 /3 width=4 by lfxs_sort, tc_lfxs_step_dx, inj/
47 lemma tc_lfxs_zero: ∀R. (∀L. reflexive … (R L)) →
48 ∀I,L1,L2,V. L1 ⦻**[R, V] L2 →
49 L1.ⓑ{I}V ⦻**[R, #0] L2.ⓑ{I}V.
50 #R #HR #I #L1 #L2 #V #H elim H -L2
51 /3 width=5 by lfxs_zero, tc_lfxs_step_dx, inj/
54 lemma tc_lfxs_lref: ∀R,I,L1,L2,V1,V2,i.
55 L1 ⦻**[R, #i] L2 → L1.ⓑ{I}V1 ⦻**[R, #⫯i] L2.ⓑ{I}V2.
56 #R #I #L1 #L2 #V1 #V2 #i #H elim H -L2
57 /3 width=4 by lfxs_lref, tc_lfxs_step_dx, inj/
60 lemma tc_lfxs_gref: ∀R,I,L1,L2,V1,V2,l.
61 L1 ⦻**[R, §l] L2 → L1.ⓑ{I}V1 ⦻**[R, §l] L2.ⓑ{I}V2.
62 #R #I #L1 #L2 #V1 #V2 #l #H elim H -L2
63 /3 width=4 by lfxs_gref, tc_lfxs_step_dx, inj/
66 lemma tc_lfxs_sym: ∀R. lexs_frees_confluent R cfull →
67 (∀L1,L2,T1,T2. R L1 T1 T2 → R L2 T2 T1) →
68 ∀T. symmetric … (tc_lfxs R T).
69 #R #H1R #H2R #T #L1 #L2 #H elim H -L2
70 /4 width=3 by lfxs_sym, tc_lfxs_step_sn, inj/
73 lemma tc_lfxs_co: ∀R1,R2. (∀L,T1,T2. R1 L T1 T2 → R2 L T1 T2) →
74 ∀L1,L2,T. L1 ⦻**[R1, T] L2 → L1 ⦻**[R2, T] L2.
75 #R1 #R2 #HR #L1 #L2 #T #H elim H -L2
76 /4 width=5 by lfxs_co, tc_lfxs_step_dx, inj/
79 (* Basic inversion lemmas ***************************************************)
81 (* Basic_2A1: uses: TC_lpx_sn_inv_atom1 *)
82 lemma tc_lfxs_inv_atom_sn: ∀R,I,Y2. ⋆ ⦻**[R, ⓪{I}] Y2 → Y2 = ⋆.
83 #R #I #Y2 #H elim H -Y2 /3 width=3 by inj, lfxs_inv_atom_sn/
86 (* Basic_2A1: uses: TC_lpx_sn_inv_atom2 *)
87 lemma tc_lfxs_inv_atom_dx: ∀R,I,Y1. Y1 ⦻**[R, ⓪{I}] ⋆ → Y1 = ⋆.
88 #R #I #Y1 #H @(TC_ind_dx ??????? H) -Y1
89 /3 width=3 by inj, lfxs_inv_atom_dx/
92 lemma tc_lfxs_inv_sort: ∀R,Y1,Y2,s. Y1 ⦻**[R, ⋆s] Y2 →
94 ∃∃I,L1,L2,V1,V2. L1 ⦻**[R, ⋆s] L2 &
95 Y1 = L1.ⓑ{I}V1 & Y2 = L2.ⓑ{I}V2.
96 #R #Y1 #Y2 #s #H elim H -Y2
97 [ #Y2 #H elim (lfxs_inv_sort … H) -H *
98 /4 width=8 by ex3_5_intro, inj, or_introl, or_intror, conj/
99 | #Y #Y2 #_ #H elim (lfxs_inv_sort … H) -H *
100 [ #H #H2 * * /3 width=8 by ex3_5_intro, or_introl, or_intror, conj/
101 | #I #L #L2 #V #V2 #HL2 #H #H2 * *
103 | #I0 #L1 #L0 #V1 #V0 #HL10 #H1 #H0 destruct
104 /4 width=8 by ex3_5_intro, tc_lfxs_step_dx, or_intror/
110 lemma tc_lfxs_inv_gref: ∀R,Y1,Y2,l. Y1 ⦻**[R, §l] Y2 →
112 ∃∃I,L1,L2,V1,V2. L1 ⦻**[R, §l] L2 &
113 Y1 = L1.ⓑ{I}V1 & Y2 = L2.ⓑ{I}V2.
114 #R #Y1 #Y2 #l #H elim H -Y2
115 [ #Y2 #H elim (lfxs_inv_gref … H) -H *
116 /4 width=8 by ex3_5_intro, inj, or_introl, or_intror, conj/
117 | #Y #Y2 #_ #H elim (lfxs_inv_gref … H) -H *
118 [ #H #H2 * * /3 width=8 by ex3_5_intro, or_introl, or_intror, conj/
119 | #I #L #L2 #V #V2 #HL2 #H #H2 * *
121 | #I0 #L1 #L0 #V1 #V0 #HL10 #H1 #H0 destruct
122 /4 width=8 by ex3_5_intro, tc_lfxs_step_dx, or_intror/
128 lemma tc_lfxs_inv_bind: ∀R. (∀L. reflexive … (R L)) →
129 ∀p,I,L1,L2,V,T. L1 ⦻**[R, ⓑ{p,I}V.T] L2 →
130 L1 ⦻**[R, V] L2 ∧ L1.ⓑ{I}V ⦻**[R, T] L2.ⓑ{I}V.
131 #R #HR #p #I #L1 #L2 #V #T #H elim H -L2
132 [ #L2 #H elim (lfxs_inv_bind … V ? H) -H /3 width=1 by inj, conj/
133 | #L #L2 #_ #H * elim (lfxs_inv_bind … V ? H) -H /3 width=3 by tc_lfxs_step_dx, conj/
137 lemma tc_lfxs_inv_flat: ∀R,I,L1,L2,V,T. L1 ⦻**[R, ⓕ{I}V.T] L2 →
138 L1 ⦻**[R, V] L2 ∧ L1 ⦻**[R, T] L2.
139 #R #I #L1 #L2 #V #T #H elim H -L2
140 [ #L2 #H elim (lfxs_inv_flat … H) -H /3 width=1 by inj, conj/
141 | #L #L2 #_ #H * elim (lfxs_inv_flat … H) -H /3 width=3 by tc_lfxs_step_dx, conj/
145 (* Advanced inversion lemmas ************************************************)
147 lemma tc_lfxs_inv_sort_pair_sn: ∀R,I,Y2,L1,V1,s. L1.ⓑ{I}V1 ⦻**[R, ⋆s] Y2 →
148 ∃∃L2,V2. L1 ⦻**[R, ⋆s] L2 & Y2 = L2.ⓑ{I}V2.
149 #R #I #Y2 #L1 #V1 #s #H elim (tc_lfxs_inv_sort … H) -H *
151 | #J #Y1 #L2 #X1 #V2 #Hs #H1 #H2 destruct /2 width=4 by ex2_2_intro/
155 lemma tc_lfxs_inv_sort_pair_dx: ∀R,I,Y1,L2,V2,s. Y1 ⦻**[R, ⋆s] L2.ⓑ{I}V2 →
156 ∃∃L1,V1. L1 ⦻**[R, ⋆s] L2 & Y1 = L1.ⓑ{I}V1.
157 #R #I #Y1 #L2 #V2 #s #H elim (tc_lfxs_inv_sort … H) -H *
159 | #J #L1 #Y2 #V1 #X2 #Hs #H1 #H2 destruct /2 width=4 by ex2_2_intro/
163 lemma tc_lfxs_inv_gref_pair_sn: ∀R,I,Y2,L1,V1,l. L1.ⓑ{I}V1 ⦻**[R, §l] Y2 →
164 ∃∃L2,V2. L1 ⦻**[R, §l] L2 & Y2 = L2.ⓑ{I}V2.
165 #R #I #Y2 #L1 #V1 #l #H elim (tc_lfxs_inv_gref … H) -H *
167 | #J #Y1 #L2 #X1 #V2 #Hl #H1 #H2 destruct /2 width=4 by ex2_2_intro/
171 lemma tc_lfxs_inv_gref_pair_dx: ∀R,I,Y1,L2,V2,l. Y1 ⦻**[R, §l] L2.ⓑ{I}V2 →
172 ∃∃L1,V1. L1 ⦻**[R, §l] L2 & Y1 = L1.ⓑ{I}V1.
173 #R #I #Y1 #L2 #V2 #l #H elim (tc_lfxs_inv_gref … H) -H *
175 | #J #L1 #Y2 #V1 #X2 #Hl #H1 #H2 destruct /2 width=4 by ex2_2_intro/
179 (* Basic forward lemmas *****************************************************)
181 lemma tc_lfxs_fwd_pair_sn: ∀R,I,L1,L2,V,T. L1 ⦻**[R, ②{I}V.T] L2 → L1 ⦻**[R, V] L2.
182 #R #I #L1 #L2 #V #T #H elim H -L2
183 /3 width=5 by lfxs_fwd_pair_sn, tc_lfxs_step_dx, inj/
186 lemma tc_lfxs_fwd_bind_dx: ∀R. (∀L. reflexive … (R L)) →
187 ∀p,I,L1,L2,V,T. L1 ⦻**[R, ⓑ{p,I}V.T] L2 →
188 L1.ⓑ{I}V ⦻**[R, T] L2.ⓑ{I}V.
189 #R #HR #p #I #L1 #L2 #V #T #H elim (tc_lfxs_inv_bind … H) -H //
192 lemma tc_lfxs_fwd_flat_dx: ∀R,I,L1,L2,V,T. L1 ⦻**[R, ⓕ{I}V.T] L2 → L1 ⦻**[R, T] L2.
193 #R #I #L1 #L2 #V #T #H elim (tc_lfxs_inv_flat … H) -H //
196 (* Basic_2A1: removed theorems 2:
197 TC_lpx_sn_inv_pair1 TC_lpx_sn_inv_pair2