]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda_delta/basic_2/static/lsubss.ma
356d7fe1178536aa0ca2970ec1d28abccb0841b9
[helm.git] / matita / matita / contribs / lambda_delta / basic_2 / static / lsubss.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/static/ssta.ma".
16
17 (* LOCAL ENVIRONMENT REFINEMENT FOR STRATIFIED STATIC TYPE ASSIGNMENT *******)
18
19 (* Note: may not be transitive *)
20 inductive lsubss (h:sh) (g:sd h): relation lenv ≝
21 | lsubss_atom: lsubss h g (⋆) (⋆)
22 | lsubss_pair: ∀I,L1,L2,W. lsubss h g L1 L2 →
23                lsubss h g (L1. ⓑ{I} W) (L2. ⓑ{I} W)
24 | lsubss_abbr: ∀L1,L2,V,W,l. ⦃h, L1⦄ ⊢ V •[g, l+1] W → ⦃h, L2⦄ ⊢ V •[g, l+1] W →
25                lsubss h g L1 L2 → lsubss h g (L1. ⓓV) (L2. ⓛW)
26 .
27
28 interpretation
29   "local environment refinement (stratified static type assigment)"
30   'CrSubEqS h g L1 L2 = (lsubss h g L1 L2).
31
32 (* Basic inversion lemmas ***************************************************)
33
34 fact lsubss_inv_atom1_aux: ∀h,g,L1,L2. h ⊢ L1 •⊑[g] L2 → L1 = ⋆ → L2 = ⋆.
35 #h #g #L1 #L2 * -L1 -L2
36 [ //
37 | #I #L1 #L2 #V #_ #H destruct
38 | #L1 #L2 #V #W #l #_ #_ #_ #H destruct
39 ]
40 qed.
41
42 lemma lsubss_inv_atom1: ∀h,g,L2. h ⊢ ⋆ •⊑[g] L2 → L2 = ⋆.
43 /2 width=5/ qed-.
44
45 fact lsubss_inv_pair1_aux: ∀h,g,L1,L2. h ⊢ L1 •⊑[g] L2 →
46                            ∀I,K1,V. L1 = K1. ⓑ{I} V →
47                            (∃∃K2. h ⊢ K1 •⊑[g] K2 & L2 = K2. ⓑ{I} V) ∨
48                            ∃∃K2,W,l. ⦃h, K1⦄ ⊢ V •[g,l+1] W & ⦃h, K2⦄ ⊢ V •[g,l+1] W &
49                                      h ⊢ K1 •⊑[g] K2 & L2 = K2. ⓛW & I = Abbr.
50 #h #g #L1 #L2 * -L1 -L2
51 [ #I #K1 #V #H destruct
52 | #J #L1 #L2 #V #HL12 #I #K1 #W #H destruct /3 width=3/
53 | #L1 #L2 #V #W #l #H1VW #H2VW #HL12 #I #K1 #V1 #H destruct /3 width=7/
54 ]
55 qed.
56
57 lemma lsubss_inv_pair1: ∀h,g,I,K1,L2,V. h ⊢ K1. ⓑ{I} V •⊑[g] L2 →
58                         (∃∃K2. h ⊢ K1 •⊑[g] K2 & L2 = K2. ⓑ{I} V) ∨
59                         ∃∃K2,W,l. ⦃h, K1⦄ ⊢ V •[g,l+1] W & ⦃h, K2⦄ ⊢ V •[g,l+1] W &
60                                   h ⊢ K1 •⊑[g] K2 & L2 = K2. ⓛW & I = Abbr.
61 /2 width=3/ qed-.
62
63 fact lsubss_inv_atom2_aux: ∀h,g,L1,L2. h ⊢ L1 •⊑[g] L2 → L2 = ⋆ → L1 = ⋆.
64 #h #g #L1 #L2 * -L1 -L2
65 [ //
66 | #I #L1 #L2 #V #_ #H destruct
67 | #L1 #L2 #V #W #l #_ #_ #_ #H destruct
68 ]
69 qed.
70
71 lemma lsubss_inv_atom2: ∀h,g,L1. h ⊢ L1 •⊑[g] ⋆ → L1 = ⋆.
72 /2 width=5/ qed-.
73
74 fact lsubss_inv_pair2_aux: ∀h,g,L1,L2. h ⊢ L1 •⊑[g] L2 →
75                            ∀I,K2,W. L2 = K2. ⓑ{I} W →
76                            (∃∃K1. h ⊢ K1 •⊑[g] K2 & L1 = K1. ⓑ{I} W) ∨
77                            ∃∃K1,V,l. ⦃h, K1⦄ ⊢ V •[g,l+1] W & ⦃h, K2⦄ ⊢ V •[g,l+1] W &
78                                      h ⊢ K1 •⊑[g] K2 & L1 = K1. ⓓV & I = Abst.
79 #h #g #L1 #L2 * -L1 -L2
80 [ #I #K2 #W #H destruct
81 | #J #L1 #L2 #V #HL12 #I #K2 #W #H destruct /3 width=3/
82 | #L1 #L2 #V #W #l #H1VW #H2VW #HL12 #I #K2 #W2 #H destruct /3 width=7/
83 ]
84 qed.
85
86 lemma lsubss_inv_pair2: ∀h,g,I,L1,K2,W. h ⊢ L1 •⊑[g] K2. ⓑ{I} W →
87                         (∃∃K1. h ⊢ K1 •⊑[g] K2 & L1 = K1. ⓑ{I} W) ∨
88                         ∃∃K1,V,l. ⦃h, K1⦄ ⊢ V •[g,l+1] W & ⦃h, K2⦄ ⊢ V •[g,l+1] W &
89                                   h ⊢ K1 •⊑[g] K2 & L1 = K1. ⓓV & I = Abst.
90 /2 width=3/ qed-.
91
92 (* Basic_forward lemmas *****************************************************)
93
94 lemma lsubss_fwd_lsubs1: ∀h,g,L1,L2. h ⊢ L1 •⊑[g] L2 → L1 ≼[0, |L1|] L2.
95 #h #g #L1 #L2 #H elim H -L1 -L2 // /2 width=1/
96 qed-.
97
98 lemma lsubss_fwd_lsubs2: ∀h,g,L1,L2. h ⊢ L1 •⊑[g] L2 → L1 ≼[0, |L2|] L2.
99 #h #g #L1 #L2 #H elim H -L1 -L2 // /2 width=1/
100 qed-.
101
102 (* Basic properties *********************************************************)
103
104 lemma lsubss_refl: ∀h,g,L. h ⊢ L •⊑[g] L.
105 #h #g #L elim L -L // /2 width=1/
106 qed.