]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/etc/lsubss/lsubss.etc
lambdadelta
[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 notation "hvbox( h ⊢ break term 46 L1 • ⊑ break [ term 46 g ] break term 46 L2 )"
16    non associative with precedence 45
17    for @{ 'CrSubEqS $h $g $L1 $L2 }.
18
19 include "basic_2/static/ssta.ma".
20 include "basic_2/computation/cprs.ma".
21 include "basic_2/equivalence/cpcs.ma".
22
23 (* LOCAL ENVIRONMENT REFINEMENT FOR STRATIFIED STATIC TYPE ASSIGNMENT *******)
24
25 (* Note: this is not transitive *)
26 inductive lsubss (h:sh) (g:sd h): relation lenv ≝
27 | lsubss_atom: lsubss h g (⋆) (⋆)
28 | lsubss_pair: ∀I,L1,L2,V. lsubss h g L1 L2 →
29                lsubss h g (L1. ⓑ{I} V) (L2. ⓑ{I} V)
30 | lsubss_abbr: ∀L1,L2,V1,V2,W1,W2,l. L1 ⊢ W1 ⬌* W2 →
31                ⦃h, L1⦄ ⊢ V1 •[g] ⦃l+1, W1⦄ → ⦃h, L2⦄ ⊢ W2 •[g] ⦃l, V2⦄ →
32                lsubss h g L1 L2 → lsubss h g (L1. ⓓV1) (L2. ⓛW2)
33 .
34
35 interpretation
36   "local environment refinement (stratified static type assigment)"
37   'CrSubEqS h g L1 L2 = (lsubss h g L1 L2).
38
39 (* Basic inversion lemmas ***************************************************)
40
41 fact lsubss_inv_atom1_aux: ∀h,g,L1,L2. h ⊢ L1 •⊑[g] L2 → L1 = ⋆ → L2 = ⋆.
42 #h #g #L1 #L2 * -L1 -L2
43 [ //
44 | #I #L1 #L2 #V #_ #H destruct
45 | #L1 #L2 #V1 #V2 #W1 #W2 #l #_ #_ #_ #_ #H destruct
46 ]
47 qed-.
48
49 lemma lsubss_inv_atom1: ∀h,g,L2. h ⊢ ⋆ •⊑[g] L2 → L2 = ⋆.
50 /2 width=5 by lsubss_inv_atom1_aux/ qed-.
51
52 fact lsubss_inv_pair1_aux: ∀h,g,L1,L2. h ⊢ L1 •⊑[g] L2 →
53                            ∀I,K1,V1. L1 = K1. ⓑ{I} V1 →
54                            (∃∃K2. h ⊢ K1 •⊑[g] K2 & L2 = K2. ⓑ{I} V1) ∨
55                            ∃∃K2,W1,W2,V2,l. ⦃h, K1⦄ ⊢ V1 •[g] ⦃l+1, W1⦄ & ⦃h, K2⦄ ⊢ W2 •[g] ⦃l, V2⦄ &
56                                             K1 ⊢ W1 ⬌* W2 & h ⊢ K1 •⊑[g] K2 & L2 = K2. ⓛW2 & I = Abbr.
57 #h #g #L1 #L2 * -L1 -L2
58 [ #J #K1 #U1 #H destruct
59 | #I #L1 #L2 #V #HL12 #J #K1 #U1 #H destruct /3 width=3/
60 | #L1 #L2 #V1 #V2 #W1 #W2 #l #HW12 #HVW1 #HWV2 #HL12 #J #K1 #U1 #H destruct /3 width=10/
61 ]
62 qed-.
63
64 lemma lsubss_inv_pair1: ∀h,g,I,K1,L2,V1. h ⊢ K1. ⓑ{I} V1 •⊑[g] L2 →
65                         (∃∃K2. h ⊢ K1 •⊑[g] K2 & L2 = K2. ⓑ{I} V1) ∨
66                         ∃∃K2,W1,W2,V2,l. ⦃h, K1⦄ ⊢ V1 •[g] ⦃l+1, W1⦄ & ⦃h, K2⦄ ⊢ W2 •[g] ⦃l, V2⦄ &
67                                          K1 ⊢ W1 ⬌* W2 & h ⊢ K1 •⊑[g] K2 & L2 = K2. ⓛW2 & I = Abbr.
68 /2 width=3 by lsubss_inv_pair1_aux/ qed-.
69
70 fact lsubss_inv_atom2_aux: ∀h,g,L1,L2. h ⊢ L1 •⊑[g] L2 → L2 = ⋆ → L1 = ⋆.
71 #h #g #L1 #L2 * -L1 -L2
72 [ //
73 | #I #L1 #L2 #V #_ #H destruct
74 | #L1 #L2 #V1 #V2 #W1 #W2 #l #_ #_ #_ #_ #H destruct
75 ]
76 qed-.
77
78 lemma lsubss_inv_atom2: ∀h,g,L1. h ⊢ L1 •⊑[g] ⋆ → L1 = ⋆.
79 /2 width=5 by lsubss_inv_atom2_aux/ qed-.
80
81 fact lsubss_inv_pair2_aux: ∀h,g,L1,L2. h ⊢ L1 •⊑[g] L2 →
82                            ∀I,K2,W2. L2 = K2. ⓑ{I} W2 →
83                            (∃∃K1. h ⊢ K1 •⊑[g] K2 & L1 = K1. ⓑ{I} W2) ∨
84                            ∃∃K1,W1,V1,V2,l. ⦃h, K1⦄ ⊢ V1 •[g] ⦃l+1, W1⦄ & ⦃h, K2⦄ ⊢ W2 •[g] ⦃l, V2⦄ &
85                                             K1 ⊢ W1 ⬌* W2 & h ⊢ K1 •⊑[g] K2 & L1 = K1. ⓓV1 & I = Abst.
86 #h #g #L1 #L2 * -L1 -L2
87 [ #J #K2 #U2 #H destruct
88 | #I #L1 #L2 #V #HL12 #J #K2 #U2 #H destruct /3 width=3/
89 | #L1 #L2 #V1 #V2 #W1 #W2 #l #HW12 #HVW1 #HWV2 #HL12 #J #K2 #U2 #H destruct /3 width=10/
90 ]
91 qed-.
92
93 lemma lsubss_inv_pair2: ∀h,g,I,L1,K2,W2. h ⊢ L1 •⊑[g] K2. ⓑ{I} W2 →
94                         (∃∃K1. h ⊢ K1 •⊑[g] K2 & L1 = K1. ⓑ{I} W2) ∨
95                         ∃∃K1,W1,V1,V2,l. ⦃h, K1⦄ ⊢ V1 •[g] ⦃l+1, W1⦄ & ⦃h, K2⦄ ⊢ W2 •[g] ⦃l, V2⦄ &
96                                          K1 ⊢ W1 ⬌* W2 & h ⊢ K1 •⊑[g] K2 & L1 = K1. ⓓV1 & I = Abst.
97 /2 width=3 by lsubss_inv_pair2_aux/ qed-.
98
99 (* Basic_forward lemmas *****************************************************)
100
101 axiom lsubss_fwd_lsubx: ∀h,g,L1,L2. h ⊢ L1 •⊑[g] L2 → L1 ⓝ⊑ L2.
102 (*
103 #h #g #L1 #L2 #H elim H -L1 -L2 // /2 width=1/
104 qed-.
105 *)
106 (* Basic properties *********************************************************)
107
108 lemma lsubss_refl: ∀h,g,L. h ⊢ L •⊑[g] L.
109 #h #g #L elim L -L // /2 width=1/
110 qed.
111
112 lemma lsubss_cprs_trans: ∀h,g,L1,L2. h ⊢ L1 •⊑[g] L2 →
113                          ∀T1,T2. L2 ⊢ T1 ➡* T2 → L1 ⊢ T1 ➡* T2.
114 /3 width=5 by lsubss_fwd_lsubx, lsubx_cprs_trans/
115 qed-.