]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/etc_2A1/nta/lsubn.etc
milestone uupdate in basic_2
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / etc_2A1 / nta / lsubn.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 @{ 'CrSubEqN $h $L1 $L2 }.
18
19 notation "hvbox( h ⊢ break term 46 L1 : : ⊑ break term 46 L2 )"
20    non associative with precedence 45
21    for @{ 'CrSubEqNAlt $h $L1 $L2 }.
22
23 include "basic_2/dynamic/nta.ma".
24
25 (* LOCAL ENVIRONMENT REFINEMENT FOR NATIVE TYPE ASSIGNMENT ******************)
26
27 (* Note: may not be transitive *)
28 inductive lsubn (h:sh): relation lenv ≝
29 | lsubn_atom: lsubn h (⋆) (⋆)
30 | lsubn_pair: ∀I,L1,L2,W. lsubn h L1 L2 → lsubn h (L1. ⓑ{I} W) (L2. ⓑ{I} W)
31 | lsubn_abbr: ∀L1,L2,V,W. ⦃h, L1⦄ ⊢ V : W → ⦃h, L2⦄ ⊢ V : W →
32               lsubn h L1 L2 → lsubn h (L1. ⓓV) (L2. ⓛW)
33 .
34
35 interpretation
36   "local environment refinement (native type assigment)"
37   'CrSubEqN h L1 L2 = (lsubn h L1 L2).
38
39 (* Basic inversion lemmas ***************************************************)
40
41 fact lsubn_inv_atom1_aux: ∀h,L1,L2. h ⊢ L1 :⊑ L2 → L1 = ⋆ → L2 = ⋆.
42 #h #L1 #L2 * -L1 -L2
43 [ //
44 | #I #L1 #L2 #V #_ #H destruct
45 | #L1 #L2 #V #W #_ #_ #_ #H destruct
46 ]
47 qed.
48
49 lemma lsubn_inv_atom1: ∀h,L2. h ⊢ ⋆ :⊑ L2 → L2 = ⋆.
50 /2 width=4/ qed-.
51
52 fact lsubn_inv_pair1_aux: ∀h,L1,L2. h ⊢ L1 :⊑ L2 → ∀I,K1,V. L1 = K1. ⓑ{I} V →
53                           (∃∃K2. h ⊢ K1 :⊑ K2 & L2 = K2. ⓑ{I} V) ∨
54                           ∃∃K2,W. ⦃h, K1⦄ ⊢ V : W & ⦃h, K2⦄ ⊢ V : W &
55                                   h ⊢ K1 :⊑ K2 & L2 = K2. ⓛW & I = Abbr.
56 #h #L1 #L2 * -L1 -L2
57 [ #I #K1 #V #H destruct
58 | #J #L1 #L2 #V #HL12 #I #K1 #W #H destruct /3 width=3/
59 | #L1 #L2 #V #W #H1VW #H2VW #HL12 #I #K1 #V1 #H destruct /3 width=7/
60 ]
61 qed.
62
63 lemma lsubn_inv_pair1: ∀h,I,K1,L2,V. h ⊢ K1. ⓑ{I} V :⊑ L2 →
64                        (∃∃K2. h ⊢ K1 :⊑ K2 & L2 = K2. ⓑ{I} V) ∨
65                        ∃∃K2,W. ⦃h, K1⦄ ⊢ V : W & ⦃h, K2⦄ ⊢ V : W &
66                                h ⊢ K1 :⊑ K2 & L2 = K2. ⓛW & I = Abbr.
67 /2 width=3/ qed-.
68
69 fact lsubn_inv_atom2_aux: ∀h,L1,L2. h ⊢ L1 :⊑ L2 → L2 = ⋆ → L1 = ⋆.
70 #h #L1 #L2 * -L1 -L2
71 [ //
72 | #I #L1 #L2 #V #_ #H destruct
73 | #L1 #L2 #V #W #_ #_ #_ #H destruct
74 ]
75 qed.
76
77 lemma lsubc_inv_atom2: ∀h,L1. h ⊢ L1 :⊑ ⋆ → L1 = ⋆.
78 /2 width=4/ qed-.
79
80 fact lsubn_inv_pair2_aux: ∀h,L1,L2. h ⊢ L1 :⊑ L2 → ∀I,K2,W. L2 = K2. ⓑ{I} W →
81                           (∃∃K1. h ⊢ K1 :⊑ K2 & L1 = K1. ⓑ{I} W) ∨
82                           ∃∃K1,V. ⦃h, K1⦄ ⊢ V : W & ⦃h, K2⦄ ⊢ V : W &
83                                   h ⊢ K1 :⊑ K2 & L1 = K1. ⓓV & I = Abst.
84 #h #L1 #L2 * -L1 -L2
85 [ #I #K2 #W #H destruct
86 | #J #L1 #L2 #V #HL12 #I #K2 #W #H destruct /3 width=3/
87 | #L1 #L2 #V #W #H1VW #H2VW #HL12 #I #K2 #W2 #H destruct /3 width=7/
88 ]
89 qed.
90
91 (* Basic_1: was: csubt_gen_bind *)
92 lemma lsubn_inv_pair2: ∀h,I,L1,K2,W. h ⊢ L1 :⊑ K2. ⓑ{I} W →
93                        (∃∃K1. h ⊢ K1 :⊑ K2 & L1 = K1. ⓑ{I} W) ∨
94                        ∃∃K1,V. ⦃h, K1⦄ ⊢ V : W & ⦃h, K2⦄ ⊢ V : W &
95                                h ⊢ K1 :⊑ K2 & L1 = K1. ⓓV & I = Abst.
96 /2 width=3/ qed-.
97
98 (* Basic_forward lemmas *****************************************************)
99
100 lemma lsubn_fwd_lsubs1: ∀h,L1,L2. h ⊢ L1 :⊑ L2 → L1 ≼[0, |L1|] L2.
101 #h #L1 #L2 #H elim H -L1 -L2 // /2 width=1/
102 qed-.
103
104 lemma lsubn_fwd_lsubs2: ∀h,L1,L2. h ⊢ L1 :⊑ L2 → L1 ≼[0, |L2|] L2.
105 #h #L1 #L2 #H elim H -L1 -L2 // /2 width=1/
106 qed-.
107
108 (* Basic properties *********************************************************)
109
110 (* Basic_1: was: csubt_refl *)
111 lemma lsubn_refl: ∀h,L. h ⊢ L :⊑ L.
112 #h #L elim L -L // /2 width=1/
113 qed.
114
115 (* Basic_1: removed theorems 6:
116             csubt_gen_flat csubt_drop_flat csubt_clear_conf
117             csubt_getl_abbr csubt_getl_abst csubt_ty3_ld
118 *)