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 "basic_2/substitution/ldrop.ma".
16 include "basic_2/unfold/gr2_minus.ma".
17 include "basic_2/unfold/lifts.ma".
19 (* GENERIC LOCAL ENVIRONMENT SLICING ****************************************)
21 inductive ldrops: list2 nat nat → relation lenv ≝
22 | ldrops_nil : ∀L. ldrops ⟠ L L
23 | ldrops_cons: ∀L1,L,L2,des,d,e.
24 ldrops des L1 L → ⇩[d,e] L ≡ L2 → ldrops ({d, e} @ des) L1 L2
27 interpretation "generic local environment slicing"
28 'RDropStar des T1 T2 = (ldrops des T1 T2).
30 (* Basic inversion lemmas ***************************************************)
32 fact ldrops_inv_nil_aux: ∀L1,L2,des. ⇩*[des] L1 ≡ L2 → des = ⟠ → L1 = L2.
33 #L1 #L2 #des * -L1 -L2 -des //
34 #L1 #L #L2 #d #e #des #_ #_ #H destruct
37 (* Basic_1: was: drop1_gen_pnil *)
38 lemma ldrops_inv_nil: ∀L1,L2. ⇩*[⟠] L1 ≡ L2 → L1 = L2.
41 fact ldrops_inv_cons_aux: ∀L1,L2,des. ⇩*[des] L1 ≡ L2 →
42 ∀d,e,tl. des = {d, e} @ tl →
43 ∃∃L. ⇩*[tl] L1 ≡ L & ⇩[d, e] L ≡ L2.
44 #L1 #L2 #des * -L1 -L2 -des
45 [ #L #d #e #tl #H destruct
46 | #L1 #L #L2 #des #d #e #HT1 #HT2 #hd #he #tl #H destruct
50 (* Basic_1: was: drop1_gen_pcons *)
51 lemma ldrops_inv_cons: ∀L1,L2,d,e,des. ⇩*[{d, e} @ des] L1 ≡ L2 →
52 ∃∃L. ⇩*[des] L1 ≡ L & ⇩[d, e] L ≡ L2.
55 lemma ldrops_inv_skip2: ∀I,des,i,des2. des ▭ i ≡ des2 →
56 ∀L1,K2,V2. ⇩*[des2] L1 ≡ K2. ⓑ{I} V2 →
57 ∃∃K1,V1,des1. des + 1 ▭ i + 1 ≡ des1 + 1 &
61 #I #des #i #des2 #H elim H -des -i -des2
63 >(ldrops_inv_nil … H) -L1 /2 width=7/
64 | #des #des2 #d #e #i #Hid #_ #IHdes2 #L1 #K2 #V2 #H
65 elim (ldrops_inv_cons … H) -H #L #HL1 #H
66 elim (ldrop_inv_skip2 … H ?) -H /2 width=1/ #K #V >minus_plus #HK2 #HV2 #H destruct
67 elim (IHdes2 … HL1) -IHdes2 -HL1 #K1 #V1 #des1 #Hdes1 #HK1 #HV1 #X destruct
68 @(ex4_3_intro … K1 V1 … ) // [3,4: /2 width=7/ | skip ]
69 normalize >plus_minus // @minuss_lt // /2 width=1/ (**) (* explicit constructors, /3 width=1/ is a bit slow *)
70 | #des #des2 #d #e #i #Hid #_ #IHdes2 #L1 #K2 #V2 #H
71 elim (IHdes2 … H) -IHdes2 -H #K1 #V1 #des1 #Hdes1 #HK1 #HV1 #X destruct
76 (* Basic properties *********************************************************)
78 (* Basic_1: was: drop1_skip_bind *)
79 lemma ldrops_skip: ∀L1,L2,des. ⇩*[des] L1 ≡ L2 → ∀V1,V2. ⇧*[des] V2 ≡ V1 →
80 ∀I. ⇩*[des + 1] L1. ⓑ{I} V1 ≡ L2. ⓑ{I} V2.
81 #L1 #L2 #des #H elim H -L1 -L2 -des
83 >(lifts_inv_nil … HV12) -HV12 //
84 | #L1 #L #L2 #des #d #e #_ #HL2 #IHL #V1 #V2 #H #I
85 elim (lifts_inv_cons … H) -H /3 width=5/
89 (* Basic_1: removed theorems 1: drop1_getl_trans