]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2A/etc/snta/lsubsn.etc
milestone update in ground_2 and basic_2A
[helm.git] / matita / matita / contribs / lambdadelta / basic_2A / etc / snta / lsubsn.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 notation "hvbox( h ⊢ break term 46 L1 : ⊑ [ ] break term 46 L2 )"
16    non associative with precedence 45
17    for @{ 'StratifiedCrSubEqN $h $L1 $L2 }.
18
19 include "basic_2/dynamic/snta.ma".
20
21 (* LOCAL ENVIRONMENT REFINEMENT FOR STRATIFIED NATIVE TYPE ASSIGNMENT *******)
22
23 (* Note: may not be transitive *)
24 inductive lsubsn (h:sh): relation lenv ≝
25 | lsubsn_atom: lsubsn h (⋆) (⋆)
26 | lsubsn_pair: ∀I,L1,L2,W. lsubsn h L1 L2 →
27                lsubsn h (L1. ⓑ{I} W) (L2. ⓑ{I} W)
28 | lsubsn_abbr: ∀L1,L2,V,W,l. ⦃h, L1⦄ ⊢ V :[l+1] W → ⦃h, L2⦄ ⊢ V :[l+1] W →
29                lsubsn h L1 L2 → lsubsn h (L1. ⓓV) (L2. ⓛW)
30 .
31
32 interpretation
33   "local environment refinement (stratified native type assigment)"
34   'StratifiedCrSubEqN h L1 L2 = (lsubsn h L1 L2).
35
36 (* Basic inversion lemmas ***************************************************)
37
38 fact lsubsn_inv_atom1_aux: ∀h,L1,L2. h ⊢ L1 :⊑[] L2 → L1 = ⋆ → L2 = ⋆.
39 #h #L1 #L2 * -L1 -L2
40 [ //
41 | #I #L1 #L2 #V #_ #H destruct
42 | #L1 #L2 #V #W #l #_ #_ #_ #H destruct
43 ]
44 qed.
45
46 lemma lsubsn_inv_atom1: ∀h,L2. h ⊢ ⋆ :⊑[] L2 → L2 = ⋆.
47 /2 width=5/ qed-.
48
49 fact lsubsn_inv_pair1_aux: ∀h,L1,L2. h ⊢ L1 :⊑[] L2 →
50                            ∀I,K1,V. L1 = K1. ⓑ{I} V →
51                            (∃∃K2. h ⊢ K1 :⊑[] K2 & L2 = K2. ⓑ{I} V) ∨
52                            ∃∃K2,W,l. ⦃h, K1⦄ ⊢ V :[l+1] W & ⦃h, K2⦄ ⊢ V :[l+1] W &
53                                      h ⊢ K1 :⊑[] K2 & L2 = K2. ⓛW & I = Abbr.
54 #h #L1 #L2 * -L1 -L2
55 [ #I #K1 #V #H destruct
56 | #J #L1 #L2 #V #HL12 #I #K1 #W #H destruct /3 width=3/
57 | #L1 #L2 #V #W #l #H1VW #H2VW #HL12 #I #K1 #V1 #H destruct /3 width=7/
58 ]
59 qed.
60
61 lemma lsubsn_inv_pair1: ∀h,I,K1,L2,V. h ⊢ K1. ⓑ{I} V :⊑[] L2 →
62                         (∃∃K2. h ⊢ K1 :⊑[] K2 & L2 = K2. ⓑ{I} V) ∨
63                         ∃∃K2,W,l. ⦃h, K1⦄ ⊢ V :[l+1] W & ⦃h, K2⦄ ⊢ V :[l+1] W &
64                                   h ⊢ K1 :⊑[] K2 & L2 = K2. ⓛW & I = Abbr.
65 /2 width=3/ qed-.
66
67 fact lsubsn_inv_atom2_aux: ∀h,L1,L2. h ⊢ L1 :⊑[] L2 → L2 = ⋆ → L1 = ⋆.
68 #h #L1 #L2 * -L1 -L2
69 [ //
70 | #I #L1 #L2 #V #_ #H destruct
71 | #L1 #L2 #V #W #l #_ #_ #_ #H destruct
72 ]
73 qed.
74
75 lemma lsubsn_inv_atom2: ∀h,L1. h ⊢ L1 :⊑[] ⋆ → L1 = ⋆.
76 /2 width=5/ qed-.
77
78 fact lsubsn_inv_pair2_aux: ∀h,L1,L2. h ⊢ L1 :⊑[] L2 →
79                            ∀I,K2,W. L2 = K2. ⓑ{I} W →
80                            (∃∃K1. h ⊢ K1 :⊑[] K2 & L1 = K1. ⓑ{I} W) ∨
81                            ∃∃K1,V,l. ⦃h, K1⦄ ⊢ V :[l+1] W & ⦃h, K2⦄ ⊢ V :[l+1] W &
82                                      h ⊢ K1 :⊑[] K2 & L1 = K1. ⓓV & I = Abst.
83 #h #L1 #L2 * -L1 -L2
84 [ #I #K2 #W #H destruct
85 | #J #L1 #L2 #V #HL12 #I #K2 #W #H destruct /3 width=3/
86 | #L1 #L2 #V #W #l #H1VW #H2VW #HL12 #I #K2 #W2 #H destruct /3 width=7/
87 ]
88 qed.
89
90 lemma lsubsn_inv_pair2: ∀h,I,L1,K2,W. h ⊢ L1 :⊑[] K2. ⓑ{I} W →
91                         (∃∃K1. h ⊢ K1 :⊑[] K2 & L1 = K1. ⓑ{I} W) ∨
92                         ∃∃K1,V,l. ⦃h, K1⦄ ⊢ V :[l+1] W & ⦃h, K2⦄ ⊢ V :[l+1] W &
93                                   h ⊢ K1 :⊑[] K2 & L1 = K1. ⓓV & I = Abst.
94 /2 width=3/ qed-.
95
96 (* Basic_forward lemmas *****************************************************)
97
98 lemma lsubsn_fwd_lsubs1: ∀h,L1,L2. h ⊢ L1 :⊑[] L2 → L1 ≼[0, |L1|] L2.
99 #h #L1 #L2 #H elim H -L1 -L2 // /2 width=1/
100 qed-.
101
102 lemma lsubsn_fwd_lsubs2: ∀h,L1,L2. h ⊢ L1 :⊑[] L2 → L1 ≼[0, |L2|] L2.
103 #h #L1 #L2 #H elim H -L1 -L2 // /2 width=1/
104 qed-.
105
106 (* Basic properties *********************************************************)
107
108 lemma lsubsn_refl: ∀h,L. h ⊢ L :⊑[] L.
109 #h #L elim L -L // /2 width=1/
110 qed.