]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/relocation/drops.ma
partial commit in the relocation component to move some files ...
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / relocation / drops.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 "basic_2/notation/relations/rdropstar_4.ma".
16 include "basic_2/grammar/lenv.ma".
17 include "basic_2/relocation/lifts.ma".
18
19 (* GENERAL SLICING FOR LOCAL ENVIRONMENTS ***********************************)
20
21 (* Basic_1: includes: drop_skip_bind drop1_skip_bind *)
22 (* Basic_2A1: includes: drop_atom drop_pair drop_drop drop_skip
23                         drop_refl_atom_O2 drop_drop_lt drop_skip_lt
24 *)
25 inductive drops (c:bool): rtmap → relation lenv ≝
26 | drops_atom: ∀f. (c = Ⓣ → 𝐈⦃f⦄) → drops c (f) (⋆) (⋆)
27 | drops_drop: ∀I,L1,L2,V,f. drops c f L1 L2 → drops c (⫯f) (L1.ⓑ{I}V) L2
28 | drops_skip: ∀I,L1,L2,V1,V2,f.
29               drops c f L1 L2 → ⬆*[f] V2 ≡ V1 →
30               drops c (↑f) (L1.ⓑ{I}V1) (L2.ⓑ{I}V2)
31 .
32
33 interpretation "general slicing (local environment)"
34    'RDropStar c f L1 L2 = (drops c f L1 L2).
35
36 definition d_liftable1: relation2 lenv term → predicate bool ≝
37                         λR,c. ∀L,K,f. ⬇*[c, f] L ≡ K →
38                         ∀T,U. ⬆*[f] T ≡ U → R K T → R L U.
39
40 definition d_liftable2: predicate (lenv → relation term) ≝
41                         λR. ∀K,T1,T2. R K T1 T2 → ∀L,c,f. ⬇*[c, f] L ≡ K →
42                         ∀U1. ⬆*[f] T1 ≡ U1 → 
43                         ∃∃U2. ⬆*[f] T2 ≡ U2 & R L U1 U2.
44
45 definition d_deliftable2_sn: predicate (lenv → relation term) ≝
46                              λR. ∀L,U1,U2. R L U1 U2 → ∀K,c,f. ⬇*[c, f] L ≡ K →
47                              ∀T1. ⬆*[f] T1 ≡ U1 →
48                              ∃∃T2. ⬆*[f] T2 ≡ U2 & R K T1 T2.
49
50 definition dropable_sn: predicate (rtmap → relation lenv) ≝
51                         λR. ∀L1,K1,c,f. ⬇*[c, f] L1 ≡ K1 → ∀L2,f2. R f2 L1 L2 →
52                         ∀f1. f ⊚ f1 ≡ f2 →
53                         ∃∃K2. R f1 K1 K2 & ⬇*[c, f] L2 ≡ K2.
54
55 (* Basic inversion lemmas ***************************************************)
56
57 fact drops_inv_atom1_aux: ∀X,Y,c,f. ⬇*[c, f] X ≡ Y → X = ⋆ →
58                           Y = ⋆ ∧ (c = Ⓣ → 𝐈⦃f⦄).
59 #X #Y #c #f * -X -Y -f
60 [ /3 width=1 by conj/
61 | #I #L1 #L2 #V #f #_ #H destruct
62 | #I #L1 #L2 #V1 #V2 #f #_ #_ #H destruct
63 ]
64 qed-.
65
66 (* Basic_1: includes: drop_gen_sort *)
67 (* Basic_2A1: includes: drop_inv_atom1 *)
68 lemma drops_inv_atom1: ∀Y,c,f. ⬇*[c, f] ⋆ ≡ Y → Y = ⋆ ∧ (c = Ⓣ → 𝐈⦃f⦄).
69 /2 width=3 by drops_inv_atom1_aux/ qed-.
70
71 fact drops_inv_drop1_aux: ∀X,Y,c,f. ⬇*[c, f] X ≡ Y → ∀I,K,V,g. X = K.ⓑ{I}V → f = ⫯g →
72                           ⬇*[c, g] K ≡ Y.
73 #X #Y #c #f * -X -Y -f
74 [ #f #Ht #J #K #W #g #H destruct
75 | #I #L1 #L2 #V #f #HL #J #K #W #g #H1 #H2 <(injective_next … H2) -g destruct //
76 | #I #L1 #L2 #V1 #V2 #f #_ #_ #J #K #W #g #_ #H2 elim (discr_push_next … H2)
77 ]
78 qed-.
79
80 (* Basic_1: includes: drop_gen_drop *)
81 (* Basic_2A1: includes: drop_inv_drop1_lt drop_inv_drop1 *)
82 lemma drops_inv_drop1: ∀I,K,Y,V,c,f. ⬇*[c, ⫯f] K.ⓑ{I}V ≡ Y → ⬇*[c, f] K ≡ Y.
83 /2 width=7 by drops_inv_drop1_aux/ qed-.
84
85
86 fact drops_inv_skip1_aux: ∀X,Y,c,f. ⬇*[c, f] X ≡ Y → ∀I,K1,V1,g. X = K1.ⓑ{I}V1 → f = ↑g →
87                           ∃∃K2,V2. ⬇*[c, g] K1 ≡ K2 & ⬆*[g] V2 ≡ V1 & Y = K2.ⓑ{I}V2.
88 #X #Y #c #f * -X -Y -f
89 [ #f #Ht #J #K1 #W1 #g #H destruct
90 | #I #L1 #L2 #V #f #_ #J #K1 #W1 #g #_ #H2 elim (discr_next_push … H2)
91 | #I #L1 #L2 #V1 #V2 #f #HL #HV #J #K1 #W1 #g #H1 #H2 <(injective_push … H2) -g destruct
92   /2 width=5 by ex3_2_intro/
93 ]
94 qed-.
95
96 (* Basic_1: includes: drop_gen_skip_l *)
97 (* Basic_2A1: includes: drop_inv_skip1 *)
98 lemma drops_inv_skip1: ∀I,K1,V1,Y,c,f. ⬇*[c, ↑f] K1.ⓑ{I}V1 ≡ Y →
99                        ∃∃K2,V2. ⬇*[c, f] K1 ≡ K2 & ⬆*[f] V2 ≡ V1 & Y = K2.ⓑ{I}V2.
100 /2 width=5 by drops_inv_skip1_aux/ qed-.
101
102 fact drops_inv_skip2_aux: ∀X,Y,c,f. ⬇*[c, f] X ≡ Y → ∀I,K2,V2,g. Y = K2.ⓑ{I}V2 → f = ↑g →
103                           ∃∃K1,V1. ⬇*[c, g] K1 ≡ K2 & ⬆*[g] V2 ≡ V1 & X = K1.ⓑ{I}V1.
104 #X #Y #c #f * -X -Y -f
105 [ #f #Ht #J #K2 #W2 #g #H destruct
106 | #I #L1 #L2 #V #f #_ #J #K2 #W2 #g #_ #H2 elim (discr_next_push … H2)
107 | #I #L1 #L2 #V1 #V2 #f #HL #HV #J #K2 #W2 #g #H1 #H2 <(injective_push … H2) -g destruct
108   /2 width=5 by ex3_2_intro/
109 ]
110 qed-.
111
112 (* Basic_1: includes: drop_gen_skip_r *)
113 (* Basic_2A1: includes: drop_inv_skip2 *)
114 lemma drops_inv_skip2: ∀I,X,K2,V2,c,f. ⬇*[c, ↑f] X ≡ K2.ⓑ{I}V2 →
115                        ∃∃K1,V1. ⬇*[c, f] K1 ≡ K2 & ⬆*[f] V2 ≡ V1 & X = K1.ⓑ{I}V1.
116 /2 width=5 by drops_inv_skip2_aux/ qed-.
117
118 (* Basic properties *********************************************************)
119
120 lemma drops_eq_repl_back: ∀L1,L2,c. eq_repl_back … (λf. ⬇*[c, f] L1 ≡ L2).
121 #L1 #L2 #c #f1 #H elim H -L1 -L2 -f1
122 [ /4 width=3 by drops_atom, isid_eq_repl_back/
123 | #I #L1 #L2 #V #f1 #_ #IH #f2 #H elim (eq_inv_nx … H) -H
124   /3 width=3 by drops_drop/
125 | #I #L1 #L2 #V1 #v2 #f1 #_ #HV #IH #f2 #H elim (eq_inv_px … H) -H
126   /3 width=3 by drops_skip, lifts_eq_repl_back/
127 ]
128 qed-.
129
130 lemma drops_eq_repl_fwd: ∀L1,L2,c. eq_repl_fwd … (λf. ⬇*[c, f] L1 ≡ L2).
131 #L1 #L2 #c @eq_repl_sym /2 width=3 by drops_eq_repl_back/ (**) (* full auto fails *)
132 qed-.
133
134 (* Basic_2A1: includes: drop_refl *)
135 lemma drops_refl: ∀c,L,f. 𝐈⦃f⦄ → ⬇*[c, f] L ≡ L.
136 #c #L elim L -L /2 width=1 by drops_atom/
137 #L #I #V #IHL #f #Hf elim (isid_inv_gen … Hf) -Hf
138 /3 width=1 by drops_skip, lifts_refl/
139 qed.
140
141 (* Basic_2A1: includes: drop_FT *)
142 lemma drops_TF: ∀L1,L2,f. ⬇*[Ⓣ, f] L1 ≡ L2 → ⬇*[Ⓕ, f] L1 ≡ L2.
143 #L1 #L2 #f #H elim H -L1 -L2 -f
144 /3 width=1 by drops_atom, drops_drop, drops_skip/
145 qed.
146
147 (* Basic_2A1: includes: drop_gen *)
148 lemma drops_gen: ∀L1,L2,c,f. ⬇*[Ⓣ, f] L1 ≡ L2 → ⬇*[c, f] L1 ≡ L2.
149 #L1 #L2 * /2 width=1 by drops_TF/
150 qed-.
151
152 (* Basic_2A1: includes: drop_T *)
153 lemma drops_F: ∀L1,L2,c,f. ⬇*[c, f] L1 ≡ L2 → ⬇*[Ⓕ, f] L1 ≡ L2.
154 #L1 #L2 * /2 width=1 by drops_TF/
155 qed-.
156
157 (* Basic forward lemmas *****************************************************)
158
159 fact drops_fwd_drop2_aux: ∀X,Y,c,f2. ⬇*[c, f2] X ≡ Y → ∀I,K,V. Y = K.ⓑ{I}V →
160                           ∃∃f1,f. 𝐈⦃f1⦄ & f2 ⊚ ⫯f1 ≡ f & ⬇*[c, f] X ≡ K.
161 #X #Y #c #f2 #H elim H -X -Y -f2
162 [ #f2 #Ht2 #J #K #W #H destruct
163 | #I #L1 #L2 #V #f2 #_ #IHL #J #K #W #H elim (IHL … H) -IHL
164   /3 width=7 by after_next, ex3_2_intro, drops_drop/
165 | #I #L1 #L2 #V1 #V2 #f2 #HL #_ #_ #J #K #W #H destruct
166   lapply (isid_after_dx 𝐈𝐝 … f2) /3 width=9 by after_push, ex3_2_intro, drops_drop/
167 ]
168 qed-.
169
170 (* Basic_1: includes: drop_S *)
171 (* Basic_2A1: includes: drop_fwd_drop2 *)
172 lemma drops_fwd_drop2: ∀I,X,K,V,c,f2. ⬇*[c, f2] X ≡ K.ⓑ{I}V →
173                        ∃∃f1,f. 𝐈⦃f1⦄ & f2 ⊚ ⫯f1 ≡ f & ⬇*[c, f] X ≡ K.
174 /2 width=5 by drops_fwd_drop2_aux/ qed-.
175
176 lemma drops_after_fwd_drop2: ∀I,X,K,V,c,f2. ⬇*[c, f2] X ≡ K.ⓑ{I}V →
177                              ∀f1,f. 𝐈⦃f1⦄ → f2 ⊚ ⫯f1 ≡ f → ⬇*[c, f] X ≡ K.
178 #I #X #K #V #c #f2 #H #f1 #f #Hf1 #Hf elim (drops_fwd_drop2 … H) -H
179 #g1 #g #Hg1 #Hg #HK lapply (after_mono_eq … Hg … Hf ??) -Hg -Hf
180 /3 width=5 by drops_eq_repl_back, isid_inv_eq_repl, eq_next/
181 qed-.
182
183 (* Basic_1: includes: drop_gen_refl *)
184 (* Basic_2A1: includes: drop_inv_O2 *)
185 lemma drops_fwd_isid: ∀L1,L2,c,f. ⬇*[c, f] L1 ≡ L2 → 𝐈⦃f⦄ → L1 = L2.
186 #L1 #L2 #c #f #H elim H -L1 -L2 -f //
187 [ #I #L1 #L2 #V #f #_ #_ #H elim (isid_inv_next … H) //
188 | /5 width=5 by isid_inv_push, lifts_fwd_isid, eq_f3, sym_eq/
189 ]
190 qed-.
191
192 (* Basic_2A1: removed theorems 14:
193               drops_inv_nil drops_inv_cons d1_liftable_liftables
194               drop_refl_atom_O2
195               drop_inv_O1_pair1 drop_inv_pair1 drop_inv_O1_pair2
196               drop_inv_Y1 drop_Y1 drop_O_Y drop_fwd_Y2
197               drop_fwd_length_minus2 drop_fwd_length_minus4
198 *)
199 (* Basic_1: removed theorems 53:
200             drop1_gen_pnil drop1_gen_pcons drop1_getl_trans
201             drop_ctail drop_skip_flat
202             cimp_flat_sx cimp_flat_dx cimp_bind cimp_getl_conf
203             drop_clear drop_clear_O drop_clear_S
204             clear_gen_sort clear_gen_bind clear_gen_flat clear_gen_flat_r
205             clear_gen_all clear_clear clear_mono clear_trans clear_ctail clear_cle
206             getl_ctail_clen getl_gen_tail clear_getl_trans getl_clear_trans
207             getl_clear_bind getl_clear_conf getl_dec getl_drop getl_drop_conf_lt
208             getl_drop_conf_ge getl_conf_ge_drop getl_drop_conf_rev
209             drop_getl_trans_lt drop_getl_trans_le drop_getl_trans_ge
210             getl_drop_trans getl_flt getl_gen_all getl_gen_sort getl_gen_O
211             getl_gen_S getl_gen_2 getl_gen_flat getl_gen_bind getl_conf_le
212             getl_trans getl_refl getl_head getl_flat getl_ctail getl_mono
213 *)