]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2A/multiple/drops.ma
update in lambdadelta
[helm.git] / matita / matita / contribs / lambdadelta / basic_2A / multiple / 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_2A/notation/relations/rdropstar_3.ma".
16 include "basic_2A/notation/relations/rdropstar_4.ma".
17 include "basic_2A/substitution/drop.ma".
18 include "basic_2A/multiple/mr2_minus.ma".
19 include "basic_2A/multiple/lifts_vector.ma".
20
21 (* ITERATED LOCAL ENVIRONMENT SLICING ***************************************)
22
23 inductive drops (s:bool): list2 nat nat → relation lenv ≝
24 | drops_nil : ∀L. drops s (◊) L L
25 | drops_cons: ∀L1,L,L2,cs,l,m.
26               drops s cs L1 L → ⬇[s, l, m] L ≡ L2 → drops s ({l, m} @ cs) L1 L2
27 .
28
29 interpretation "iterated slicing (local environment) abstract"
30    'RDropStar s cs T1 T2 = (drops s cs T1 T2).
31 (*
32 interpretation "iterated slicing (local environment) general"
33    'RDropStar des T1 T2 = (drops true des T1 T2).
34 *)
35
36 definition d_liftable1: relation2 lenv term → predicate bool ≝
37                         λR,s. ∀K,T. R K T → ∀L,l,m. ⬇[s, l, m] L ≡ K →
38                         ∀U. ⬆[l, m] T ≡ U → R L U.
39
40 definition d_liftables1: relation2 lenv term → predicate bool ≝
41                          λR,s. ∀L,K,cs. ⬇*[s, cs] L ≡ K →
42                          ∀T,U. ⬆*[cs] T ≡ U → R K T → R L U.
43
44 definition d_liftables1_all: relation2 lenv term → predicate bool ≝
45                              λR,s. ∀L,K,cs. ⬇*[s, cs] L ≡ K →
46                              ∀Ts,Us. ⬆*[cs] Ts ≡ Us → 
47                              all … (R K) Ts → all … (R L) Us.
48
49 (* Basic inversion lemmas ***************************************************)
50
51 fact drops_inv_nil_aux: ∀L1,L2,s,cs. ⬇*[s, cs] L1 ≡ L2 → cs = ◊ → L1 = L2.
52 #L1 #L2 #s #cs * -L1 -L2 -cs //
53 #L1 #L #L2 #l #m #cs #_ #_ #H destruct
54 qed-.
55
56 (* Basic_1: was: drop1_gen_pnil *)
57 lemma drops_inv_nil: ∀L1,L2,s. ⬇*[s, ◊] L1 ≡ L2 → L1 = L2.
58 /2 width=4 by drops_inv_nil_aux/ qed-.
59
60 fact drops_inv_cons_aux: ∀L1,L2,s,cs. ⬇*[s, cs] L1 ≡ L2 →
61                          ∀l,m,tl. cs = {l, m} @ tl →
62                          ∃∃L. ⬇*[s, tl] L1 ≡ L & ⬇[s, l, m] L ≡ L2.
63 #L1 #L2 #s #cs * -L1 -L2 -cs
64 [ #L #l #m #tl #H destruct
65 | #L1 #L #L2 #cs #l #m #HT1 #HT2 #l0 #m0 #tl #H destruct
66   /2 width=3 by ex2_intro/
67 ]
68 qed-.
69
70 (* Basic_1: was: drop1_gen_pcons *)
71 lemma drops_inv_cons: ∀L1,L2,s,l,m,cs. ⬇*[s, {l, m} @ cs] L1 ≡ L2 →
72                       ∃∃L. ⬇*[s, cs] L1 ≡ L & ⬇[s, l, m] L ≡ L2.
73 /2 width=3 by drops_inv_cons_aux/ qed-.
74
75 lemma drops_inv_skip2: ∀I,s,cs,cs2,i. cs ▭ i ≡ cs2 →
76                        ∀L1,K2,V2. ⬇*[s, cs2] L1 ≡ K2. ⓑ{I} V2 →
77                        ∃∃K1,V1,cs1. cs + 1 ▭ i + 1 ≡ cs1 + 1 &
78                                      ⬇*[s, cs1] K1 ≡ K2 &
79                                      ⬆*[cs1] V2 ≡ V1 &
80                                      L1 = K1. ⓑ{I} V1.
81 #I #s #cs #cs2 #i #H elim H -cs -cs2 -i
82 [ #i #L1 #K2 #V2 #H
83   >(drops_inv_nil … H) -L1 /2 width=7 by lifts_nil, minuss_nil, ex4_3_intro, drops_nil/
84 | #cs #cs2 #l #m #i #Hil #_ #IHcs2 #L1 #K2 #V2 #H
85   elim (drops_inv_cons … H) -H #L #HL1 #H
86   elim (drop_inv_skip2 … H) -H /2 width=1 by lt_plus_to_minus_r/ #K #V >minus_plus #HK2 #HV2 #H destruct
87   elim (IHcs2 … HL1) -IHcs2 -HL1 #K1 #V1 #cs1 #Hcs1 #HK1 #HV1 #X destruct
88   @(ex4_3_intro … K1 V1 … ) // [3,4: /2 width=7 by lifts_cons, drops_cons/ | skip ]
89   normalize >plus_minus /3 width=1 by minuss_lt, lt_minus_to_plus/ (**) (* explicit constructors *)
90 | #cs #cs2 #l #m #i #Hil #_ #IHcs2 #L1 #K2 #V2 #H
91   elim (IHcs2 … H) -IHcs2 -H #K1 #V1 #cs1 #Hcs1 #HK1 #HV1 #X destruct
92   /4 width=7 by minuss_ge, ex4_3_intro, le_S_S/
93 ]
94 qed-.
95
96 (* Basic properties *********************************************************)
97
98 (* Basic_1: was: drop1_skip_bind *)
99 lemma drops_skip: ∀L1,L2,s,cs. ⬇*[s, cs] L1 ≡ L2 → ∀V1,V2. ⬆*[cs] V2 ≡ V1 →
100                   ∀I. ⬇*[s, cs + 1] L1.ⓑ{I}V1 ≡ L2.ⓑ{I}V2.
101 #L1 #L2 #s #cs #H elim H -L1 -L2 -cs
102 [ #L #V1 #V2 #HV12 #I
103   >(lifts_inv_nil … HV12) -HV12 //
104 | #L1 #L #L2 #cs #l #m #_ #HL2 #IHL #V1 #V2 #H #I
105   elim (lifts_inv_cons … H) -H /3 width=5 by drop_skip, drops_cons/
106 ].
107 qed.
108
109 lemma d1_liftable_liftables: ∀R,s. d_liftable1 R s → d_liftables1 R s.
110 #R #s #HR #L #K #cs #H elim H -L -K -cs
111 [ #L #T #U #H #HT <(lifts_inv_nil … H) -H //
112 | #L1 #L #L2 #cs #l #m #_ #HL2 #IHL #T2 #T1 #H #HLT2
113   elim (lifts_inv_cons … H) -H /3 width=10 by/
114 ]
115 qed.
116
117 lemma d1_liftables_liftables_all: ∀R,s. d_liftables1 R s → d_liftables1_all R s.
118 #R #s #HR #L #K #cs #HLK #Ts #Us #H elim H -Ts -Us normalize //
119 #Ts #Us #T #U #HTU #_ #IHTUs * /3 width=7 by conj/
120 qed.
121
122 (* Basic_1: removed theorems 1: drop1_getl_trans *)