]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/i_static/tc_lfxs.ma
8e3bf8a4d32973c5308eccccb30b6c95d528cab8
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / i_static / tc_lfxs.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "ground_2/lib/star.ma".
16 include "basic_2/notation/relations/relationstarstar_4.ma".
17 include "basic_2/static/lfxs.ma".
18
19 (* ITERATED EXTENSION ON REFERRED ENTRIES OF A CONTEXT-SENSITIVE REALTION ***)
20
21 definition tc_lfxs (R): term → relation lenv ≝ LTC … (lfxs R).
22
23 interpretation "iterated extension on referred entries (local environment)"
24    'RelationStarStar R T L1 L2 = (tc_lfxs R T L1 L2).
25
26 (* Basic properties *********************************************************)
27
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 *)
31 qed-.
32
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 *)
36 qed-.
37
38 lemma tc_lfxs_atom: ∀R,I. ⋆ ⪤**[R, ⓪{I}] ⋆.
39 /2 width=1 by inj/ qed.
40
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/
45 qed.
46
47 lemma tc_lfxs_pair: ∀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_pair, tc_lfxs_step_dx, inj/
52 qed.
53
54 lemma tc_lfxs_unit: ∀R,f,I,L1,L2. 𝐈⦃f⦄ → L1 ⪤*[cext2 R, cfull, f] L2 →
55                     L1.ⓤ{I} ⪤**[R, #0] L2.ⓤ{I}.
56 /3 width=3 by lfxs_unit, inj/ qed.
57
58 lemma tc_lfxs_lref: ∀R,I,L1,L2,V1,V2,i.
59                     L1 ⪤**[R, #i] L2 → L1.ⓑ{I}V1 ⪤**[R, #⫯i] L2.ⓑ{I}V2.
60 #R #I #L1 #L2 #V1 #V2 #i #H elim H -L2
61 /3 width=4 by lfxs_lref, tc_lfxs_step_dx, inj/
62 qed.
63
64 lemma tc_lfxs_gref: ∀R,I,L1,L2,V1,V2,l.
65                     L1 ⪤**[R, §l] L2 → L1.ⓑ{I}V1 ⪤**[R, §l] L2.ⓑ{I}V2.
66 #R #I #L1 #L2 #V1 #V2 #l #H elim H -L2
67 /3 width=4 by lfxs_gref, tc_lfxs_step_dx, inj/
68 qed.
69
70 lemma tc_lfxs_sym: ∀R. lexs_frees_confluent (cext2 R) cfull →
71                    (∀L1,L2,T1,T2. R L1 T1 T2 → R L2 T2 T1) →
72                    ∀T. symmetric … (tc_lfxs R T).
73 #R #H1R #H2R #T #L1 #L2 #H elim H -L2
74 /4 width=3 by lfxs_sym, tc_lfxs_step_sn, inj/
75 qed-.
76
77 lemma tc_lfxs_co: ∀R1,R2. (∀L,T1,T2. R1 L T1 T2 → R2 L T1 T2) →
78                   ∀L1,L2,T. L1 ⪤**[R1, T] L2 → L1 ⪤**[R2, T] L2.
79 #R1 #R2 #HR #L1 #L2 #T #H elim H -L2
80 /4 width=5 by lfxs_co, tc_lfxs_step_dx, inj/
81 qed-.
82
83 (* Basic inversion lemmas ***************************************************)
84
85 (* Basic_2A1: uses: TC_lpx_sn_inv_atom1 *)
86 lemma tc_lfxs_inv_atom_sn: ∀R,I,Y2. ⋆ ⪤**[R, ⓪{I}] Y2 → Y2 = ⋆.
87 #R #I #Y2 #H elim H -Y2 /3 width=3 by inj, lfxs_inv_atom_sn/
88 qed-.
89
90 (* Basic_2A1: uses: TC_lpx_sn_inv_atom2 *)
91 lemma tc_lfxs_inv_atom_dx: ∀R,I,Y1. Y1 ⪤**[R, ⓪{I}] ⋆ → Y1 = ⋆.
92 #R #I #Y1 #H @(TC_ind_dx ??????? H) -Y1
93 /3 width=3 by inj, lfxs_inv_atom_dx/
94 qed-.
95
96 lemma tc_lfxs_inv_sort: ∀R,Y1,Y2,s. Y1 ⪤**[R, ⋆s] Y2 →
97                         ∨∨ Y1 = ⋆ ∧ Y2 = ⋆
98                          | ∃∃I1,I2,L1,L2. L1 ⪤**[R, ⋆s] L2 &
99                                           Y1 = L1.ⓘ{I1} & Y2 = L2.ⓘ{I2}.
100 #R #Y1 #Y2 #s #H elim H -Y2
101 [ #Y2 #H elim (lfxs_inv_sort … H) -H *
102   /4 width=8 by ex3_4_intro, inj, or_introl, or_intror, conj/
103 | #Y #Y2 #_ #H elim (lfxs_inv_sort … H) -H *
104   [ #H #H2 * * /3 width=7 by ex3_4_intro, or_introl, or_intror, conj/
105   | #I #I2 #L #L2 #HL2 #H #H2 * *
106     [ #H1 #H0 destruct
107     | #I1 #I0 #L1 #L0 #HL10 #H1 #H0 destruct
108       /4 width=7 by ex3_4_intro, tc_lfxs_step_dx, or_intror/
109     ]
110   ]
111
112 qed-.
113
114 lemma tc_lfxs_inv_gref: ∀R,Y1,Y2,l. Y1 ⪤**[R, §l] Y2 →
115                         ∨∨ Y1 = ⋆ ∧ Y2 = ⋆
116                          | ∃∃I1,I2,L1,L2. L1 ⪤**[R, §l] L2 &
117                                           Y1 = L1.ⓘ{I1} & Y2 = L2.ⓘ{I2}.
118 #R #Y1 #Y2 #l #H elim H -Y2
119 [ #Y2 #H elim (lfxs_inv_gref … H) -H *
120   /4 width=8 by ex3_4_intro, inj, or_introl, or_intror, conj/
121 | #Y #Y2 #_ #H elim (lfxs_inv_gref … H) -H *
122   [ #H #H2 * * /3 width=7 by ex3_4_intro, or_introl, or_intror, conj/
123   | #I #I2 #L #L2 #HL2 #H #H2 * *
124     [ #H1 #H0 destruct
125     | #I1 #I0 #L1 #L0 #HL10 #H1 #H0 destruct
126       /4 width=7 by ex3_4_intro, tc_lfxs_step_dx, or_intror/
127     ]
128   ]
129
130 qed-.
131
132 lemma tc_lfxs_inv_bind: ∀R. (∀L. reflexive … (R L)) →
133                         ∀p,I,L1,L2,V,T. L1 ⪤**[R, ⓑ{p,I}V.T] L2 →
134                         L1 ⪤**[R, V] L2 ∧ L1.ⓑ{I}V ⪤**[R, T] L2.ⓑ{I}V.
135 #R #HR #p #I #L1 #L2 #V #T #H elim H -L2
136 [ #L2 #H elim (lfxs_inv_bind … V ? H) -H /3 width=1 by inj, conj/
137 | #L #L2 #_ #H * elim (lfxs_inv_bind … V ? H) -H /3 width=3 by tc_lfxs_step_dx, conj/
138 ]
139 qed-.
140
141 lemma tc_lfxs_inv_flat: ∀R,I,L1,L2,V,T. L1 ⪤**[R, ⓕ{I}V.T] L2 →
142                         L1 ⪤**[R, V] L2 ∧ L1 ⪤**[R, T] L2.
143 #R #I #L1 #L2 #V #T #H elim H -L2
144 [ #L2 #H elim (lfxs_inv_flat … H) -H /3 width=1 by inj, conj/
145 | #L #L2 #_ #H * elim (lfxs_inv_flat … H) -H /3 width=3 by tc_lfxs_step_dx, conj/
146 ]
147 qed-.
148
149 (* Advanced inversion lemmas ************************************************)
150
151 lemma tc_lfxs_inv_sort_bind_sn: ∀R,I1,Y2,L1,s. L1.ⓘ{I1} ⪤**[R, ⋆s] Y2 →
152                                 ∃∃I2,L2. L1 ⪤**[R, ⋆s] L2 & Y2 = L2.ⓘ{I2}.
153 #R #I1 #Y2 #L1 #s #H elim (tc_lfxs_inv_sort … H) -H *
154 [ #H destruct
155 | #Z #I2 #Y1 #L2 #Hs #H1 #H2 destruct /2 width=4 by ex2_2_intro/
156 ]
157 qed-.
158
159 lemma tc_lfxs_inv_sort_bind_dx: ∀R,I2,Y1,L2,s. Y1 ⪤**[R, ⋆s] L2.ⓘ{I2} →
160                                 ∃∃I1,L1. L1 ⪤**[R, ⋆s] L2 & Y1 = L1.ⓘ{I1}.
161 #R #I2 #Y1 #L2 #s #H elim (tc_lfxs_inv_sort … H) -H *
162 [ #_ #H destruct
163 | #I1 #Z #L1 #Y2 #Hs #H1 #H2 destruct /2 width=4 by ex2_2_intro/
164 ]
165 qed-.
166
167 lemma tc_lfxs_inv_gref_bind_sn: ∀R,I1,Y2,L1,l. L1.ⓘ{I1} ⪤**[R, §l] Y2 →
168                                 ∃∃I2,L2. L1 ⪤**[R, §l] L2 & Y2 = L2.ⓘ{I2}.
169 #R #I1 #Y2 #L1 #l #H elim (tc_lfxs_inv_gref … H) -H *
170 [ #H destruct
171 | #Z #I2 #Y1 #L2 #Hl #H1 #H2 destruct /2 width=4 by ex2_2_intro/
172 ]
173 qed-.
174
175 lemma tc_lfxs_inv_gref_bind_dx: ∀R,I2,Y1,L2,l. Y1 ⪤**[R, §l] L2.ⓘ{I2} →
176                                 ∃∃I1,L1. L1 ⪤**[R, §l] L2 & Y1 = L1.ⓘ{I1}.
177 #R #I2 #Y1 #L2 #l #H elim (tc_lfxs_inv_gref … H) -H *
178 [ #_ #H destruct
179 | #I1 #Z #L1 #Y2 #Hl #H1 #H2 destruct /2 width=4 by ex2_2_intro/
180 ]
181 qed-.
182
183 (* Basic forward lemmas *****************************************************)
184
185 lemma tc_lfxs_fwd_pair_sn: ∀R,I,L1,L2,V,T. L1 ⪤**[R, ②{I}V.T] L2 → L1 ⪤**[R, V] L2.
186 #R #I #L1 #L2 #V #T #H elim H -L2
187 /3 width=5 by lfxs_fwd_pair_sn, tc_lfxs_step_dx, inj/
188 qed-.
189
190 lemma tc_lfxs_fwd_bind_dx: ∀R. (∀L. reflexive … (R L)) →
191                            ∀p,I,L1,L2,V,T. L1 ⪤**[R, ⓑ{p,I}V.T] L2 →
192                            L1.ⓑ{I}V ⪤**[R, T] L2.ⓑ{I}V.
193 #R #HR #p #I #L1 #L2 #V #T #H elim (tc_lfxs_inv_bind … H) -H //
194 qed-.
195
196 lemma tc_lfxs_fwd_flat_dx: ∀R,I,L1,L2,V,T. L1 ⪤**[R, ⓕ{I}V.T] L2 → L1 ⪤**[R, T] L2.
197 #R #I #L1 #L2 #V #T #H elim (tc_lfxs_inv_flat … H) -H //
198 qed-.
199
200 (* Basic_2A1: removed theorems 2:
201               TC_lpx_sn_inv_pair1 TC_lpx_sn_inv_pair2
202 *)