]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda_delta/basic_2/unfold/ldrops.ma
- lib: some additions
[helm.git] / matita / matita / contribs / lambda_delta / basic_2 / unfold / ldrops.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/substitution/ldrop.ma".
16 include "basic_2/unfold/gr2_minus.ma".
17 include "basic_2/unfold/lifts.ma".
18
19 (* GENERIC LOCAL ENVIRONMENT SLICING ****************************************)
20
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
25 .
26
27 interpretation "generic local environment slicing"
28    'RDropStar des T1 T2 = (ldrops des T1 T2).
29
30 (* Basic inversion lemmas ***************************************************)
31
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
35 qed.
36
37 (* Basic_1: was: drop1_gen_pnil *)
38 lemma ldrops_inv_nil: ∀L1,L2. ⇩*[⟠] L1 ≡ L2 → L1 = L2.
39 /2 width=3/ qed-.
40
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
47   /2 width=3/
48 qed.
49
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.
53 /2 width=3/ qed-.
54
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 &
58                                       ⇩*[des1] K1 ≡ K2 &
59                                       ⇧*[des1] V2 ≡ V1 &
60                                       L1 = K1. ⓑ{I} V1.
61 #I #des #i #des2 #H elim H -des -i -des2
62 [ #i #L1 #K2 #V2 #H
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
72   /4 width=7/
73 ]
74 qed-.
75
76 (* Basic properties *********************************************************)
77
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
82 [ #L #V1 #V2 #HV12 #I
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/
86 ].
87 qed.
88
89 (* Basic_1: removed theorems 1: drop1_getl_trans
90 *)