]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/etc/lsubsv/lsubsv.etc
update in delayed_updating
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / etc / lsubsv / lsubsv.etc
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/lrsubeqv_5.ma".
16 include "basic_2/dynamic/shnv.ma".
17
18 (* LOCAL ENVIRONMENT REFINEMENT FOR STRATIFIED NATIVE VALIDITY **************)
19
20 (* Note: this is not transitive *)
21 inductive lsubsv (h) (o) (G): relation lenv ≝
22 | lsubsv_atom: lsubsv h o G (⋆) (⋆)
23 | lsubsv_pair: ∀I,L1,L2,V. lsubsv h o G L1 L2 →
24                lsubsv h o G (L1.ⓑ{I}V) (L2.ⓑ{I}V)
25 | lsubsv_beta: ∀L1,L2,W,V,d1. ⦃G, L1⦄ ⊢ ⓝW.V ¡[h, o, d1] → ⦃G, L2⦄ ⊢ W ¡[h, o] →
26                ⦃G, L1⦄ ⊢ V ▪[h, o] d1+1 → ⦃G, L2⦄ ⊢ W ▪[h, o] d1 →
27                lsubsv h o G L1 L2 → lsubsv h o G (L1.ⓓⓝW.V) (L2.ⓛW)
28 .
29
30 interpretation
31   "local environment refinement (stratified native validity)"
32   'LRSubEqV h o G L1 L2 = (lsubsv h o G L1 L2).
33
34 (* Basic inversion lemmas ***************************************************)
35
36 fact lsubsv_inv_atom1_aux: ∀h,o,G,L1,L2. G ⊢ L1 ⫃¡[h, o] L2 → L1 = ⋆ → L2 = ⋆.
37 #h #o #G #L1 #L2 * -L1 -L2
38 [ //
39 | #I #L1 #L2 #V #_ #H destruct
40 | #L1 #L2 #W #V #d1 #_ #_ #_ #_ #_ #H destruct
41 ]
42 qed-.
43
44 lemma lsubsv_inv_atom1: ∀h,o,G,L2. G ⊢ ⋆ ⫃¡[h, o] L2 → L2 = ⋆.
45 /2 width=6 by lsubsv_inv_atom1_aux/ qed-.
46
47 fact lsubsv_inv_pair1_aux: ∀h,o,G,L1,L2. G ⊢ L1 ⫃¡[h, o] L2 →
48                            ∀I,K1,X. L1 = K1.ⓑ{I}X →
49                            (∃∃K2. G ⊢ K1 ⫃¡[h, o] K2 & L2 = K2.ⓑ{I}X) ∨
50                            ∃∃K2,W,V,d1. ⦃G, K1⦄ ⊢ ⓝW.V ¡[h, o, d1] & ⦃G, K2⦄ ⊢ W ¡[h, o] &
51                                        ⦃G, K1⦄ ⊢ V ▪[h, o] d1+1 & ⦃G, K2⦄ ⊢ W ▪[h, o] d1 &
52                                         G ⊢ K1 ⫃¡[h, o] K2 &
53                                         I = Abbr & L2 = K2.ⓛW & X = ⓝW.V.
54 #h #o #G #L1 #L2 * -L1 -L2
55 [ #J #K1 #X #H destruct
56 | #I #L1 #L2 #V #HL12 #J #K1 #X #H destruct /3 width=3 by ex2_intro, or_introl/
57 | #L1 #L2 #W #V #d1 #HWV #HW #HVd1 #HWd1 #HL12 #J #K1 #X #H destruct /3 width=11 by or_intror, ex8_4_intro/
58 ]
59 qed-.
60
61 lemma lsubsv_inv_pair1: ∀h,o,I,G,K1,L2,X. G ⊢ K1.ⓑ{I}X ⫃¡[h, o] L2 →
62                         (∃∃K2. G ⊢ K1 ⫃¡[h, o] K2 & L2 = K2.ⓑ{I}X) ∨
63                         ∃∃K2,W,V,d1. ⦃G, K1⦄ ⊢ ⓝW.V ¡[h, o, d1] & ⦃G, K2⦄ ⊢ W ¡[h, o] &
64                                      ⦃G, K1⦄ ⊢ V ▪[h, o] d1+1 & ⦃G, K2⦄ ⊢ W ▪[h, o] d1 &
65                                      G ⊢ K1 ⫃¡[h, o] K2 &
66                                      I = Abbr & L2 = K2.ⓛW & X = ⓝW.V.
67 /2 width=3 by lsubsv_inv_pair1_aux/ qed-.
68
69 fact lsubsv_inv_atom2_aux: ∀h,o,G,L1,L2. G ⊢ L1 ⫃¡[h, o] L2 → L2 = ⋆ → L1 = ⋆.
70 #h #o #G #L1 #L2 * -L1 -L2
71 [ //
72 | #I #L1 #L2 #V #_ #H destruct
73 | #L1 #L2 #W #V #d1 #_ #_ #_ #_ #_ #H destruct
74 ]
75 qed-.
76
77 lemma lsubsv_inv_atom2: ∀h,o,G,L1. G ⊢ L1 ⫃¡[h, o] ⋆ → L1 = ⋆.
78 /2 width=6 by lsubsv_inv_atom2_aux/ qed-.
79
80 fact lsubsv_inv_pair2_aux: ∀h,o,G,L1,L2. G ⊢ L1 ⫃¡[h, o] L2 →
81                            ∀I,K2,W. L2 = K2.ⓑ{I}W →
82                            (∃∃K1. G ⊢ K1 ⫃¡[h, o] K2 & L1 = K1.ⓑ{I}W) ∨
83                            ∃∃K1,V,d1. ⦃G, K1⦄ ⊢ ⓝW.V ¡[h, o, d1] & ⦃G, K2⦄ ⊢ W ¡[h, o] &
84                                       ⦃G, K1⦄ ⊢ V ▪[h, o] d1+1 & ⦃G, K2⦄ ⊢ W ▪[h, o] d1 &
85                                       G ⊢ K1 ⫃¡[h, o] K2 & I = Abst & L1 = K1.ⓓⓝW.V.
86 #h #o #G #L1 #L2 * -L1 -L2
87 [ #J #K2 #U #H destruct
88 | #I #L1 #L2 #V #HL12 #J #K2 #U #H destruct /3 width=3 by ex2_intro, or_introl/
89 | #L1 #L2 #W #V #d1 #HWV #HW #HVd1 #HWd1 #HL12 #J #K2 #U #H destruct /3 width=8 by or_intror, ex7_3_intro/
90 ]
91 qed-.
92
93 lemma lsubsv_inv_pair2: ∀h,o,I,G,L1,K2,W. G ⊢ L1 ⫃¡[h, o] K2.ⓑ{I}W →
94                         (∃∃K1. G ⊢ K1 ⫃¡[h, o] K2 & L1 = K1.ⓑ{I}W) ∨
95                         ∃∃K1,V,d1. ⦃G, K1⦄ ⊢ ⓝW.V ¡[h, o, d1] & ⦃G, K2⦄ ⊢ W ¡[h, o] &
96                                    ⦃G, K1⦄ ⊢ V ▪[h, o] d1+1 & ⦃G, K2⦄ ⊢ W ▪[h, o] d1 &
97                                    G ⊢ K1 ⫃¡[h, o] K2 & I = Abst & L1 = K1.ⓓⓝW.V.
98 /2 width=3 by lsubsv_inv_pair2_aux/ qed-.
99
100 (* Basic forward lemmas *****************************************************)
101
102 lemma lsubsv_fwd_lsubr: ∀h,o,G,L1,L2. G ⊢ L1 ⫃¡[h, o] L2 → L1 ⫃ L2.
103 #h #o #G #L1 #L2 #H elim H -L1 -L2 /2 width=1 by lsubr_pair, lsubr_beta/
104 qed-.
105
106 (* Basic properties *********************************************************)
107
108 lemma lsubsv_refl: ∀h,o,G,L. G ⊢ L ⫃¡[h, o] L.
109 #h #o #G #L elim L -L /2 width=1 by lsubsv_pair/
110 qed.
111
112 lemma lsubsv_cprs_trans: ∀h,o,G,L1,L2. G ⊢ L1 ⫃¡[h, o] L2 →
113                          ∀T1,T2. ⦃G, L2⦄ ⊢ T1 ➡* T2 → ⦃G, L1⦄ ⊢ T1 ➡* T2.
114 /3 width=6 by lsubsv_fwd_lsubr, lsubr_cprs_trans/
115 qed-.
116
117 (* Note: the constant 0 cannot be generalized *)
118 lemma lsubsv_drop_O1_conf: ∀h,o,G,L1,L2. G ⊢ L1 ⫃¡[h, o] L2 →
119                            ∀K1,b,k. ⬇[b, 0, k] L1 ≘ K1 →
120                            ∃∃K2. G ⊢ K1 ⫃¡[h, o] K2 & ⬇[b, 0, k] L2 ≘ K2.
121 #h #o #G #L1 #L2 #H elim H -L1 -L2
122 [ /2 width=3 by ex2_intro/
123 | #I #L1 #L2 #V #_ #IHL12 #K1 #b #k #H
124   elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK1
125   [ destruct
126     elim (IHL12 L1 b 0) -IHL12 // #X #HL12 #H
127     <(drop_inv_O2 … H) in HL12; -H /3 width=3 by lsubsv_pair, drop_pair, ex2_intro/
128   | elim (IHL12 … HLK1) -L1 /3 width=3 by drop_drop_lt, ex2_intro/
129   ]
130 | #L1 #L2 #W #V #d1 #HWV #HW #HVd1 #HWd1 #_ #IHL12 #K1 #b #k #H
131   elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK1
132   [ destruct
133     elim (IHL12 L1 b 0) -IHL12 // #X #HL12 #H
134     <(drop_inv_O2 … H) in HL12; -H /3 width=4 by lsubsv_beta, drop_pair, ex2_intro/
135   | elim (IHL12 … HLK1) -L1 /3 width=3 by drop_drop_lt, ex2_intro/
136   ]
137 ]
138 qed-.
139
140 (* Note: the constant 0 cannot be generalized *)
141 lemma lsubsv_drop_O1_trans: ∀h,o,G,L1,L2. G ⊢ L1 ⫃¡[h, o] L2 →
142                             ∀K2,b, k. ⬇[b, 0, k] L2 ≘ K2 →
143                             ∃∃K1. G ⊢ K1 ⫃¡[h, o] K2 & ⬇[b, 0, k] L1 ≘ K1.
144 #h #o #G #L1 #L2 #H elim H -L1 -L2
145 [ /2 width=3 by ex2_intro/
146 | #I #L1 #L2 #V #_ #IHL12 #K2 #b #k #H
147   elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK2
148   [ destruct
149     elim (IHL12 L2 b 0) -IHL12 // #X #HL12 #H
150     <(drop_inv_O2 … H) in HL12; -H /3 width=3 by lsubsv_pair, drop_pair, ex2_intro/
151   | elim (IHL12 … HLK2) -L2 /3 width=3 by drop_drop_lt, ex2_intro/
152   ]
153 | #L1 #L2 #W #V #d1 #HWV #HW #HVd1 #HWd1 #_ #IHL12 #K2 #b #k #H
154   elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK2
155   [ destruct
156     elim (IHL12 L2 b 0) -IHL12 // #X #HL12 #H
157     <(drop_inv_O2 … H) in HL12; -H /3 width=4 by lsubsv_beta, drop_pair, ex2_intro/
158   | elim (IHL12 … HLK2) -L2 /3 width=3 by drop_drop_lt, ex2_intro/
159   ]
160 ]
161 qed-.