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