1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 notation "hvbox( h ⊢ break term 46 L1 : ⊑ [ ] break term 46 L2 )"
16 non associative with precedence 45
17 for @{ 'StratifiedCrSubEqN $h $L1 $L2 }.
19 include "basic_2/dynamic/snta.ma".
21 (* LOCAL ENVIRONMENT REFINEMENT FOR STRATIFIED NATIVE TYPE ASSIGNMENT *******)
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)
33 "local environment refinement (stratified native type assigment)"
34 'StratifiedCrSubEqN h L1 L2 = (lsubsn h L1 L2).
36 (* Basic inversion lemmas ***************************************************)
38 fact lsubsn_inv_atom1_aux: ∀h,L1,L2. h ⊢ L1 :⊑[] L2 → L1 = ⋆ → L2 = ⋆.
41 | #I #L1 #L2 #V #_ #H destruct
42 | #L1 #L2 #V #W #l #_ #_ #_ #H destruct
46 lemma lsubsn_inv_atom1: ∀h,L2. h ⊢ ⋆ :⊑[] L2 → L2 = ⋆.
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.
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/
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.
67 fact lsubsn_inv_atom2_aux: ∀h,L1,L2. h ⊢ L1 :⊑[] L2 → L2 = ⋆ → L1 = ⋆.
70 | #I #L1 #L2 #V #_ #H destruct
71 | #L1 #L2 #V #W #l #_ #_ #_ #H destruct
75 lemma lsubsn_inv_atom2: ∀h,L1. h ⊢ L1 :⊑[] ⋆ → L1 = ⋆.
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.
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/
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.
96 (* Basic_forward lemmas *****************************************************)
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/
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/
106 (* Basic properties *********************************************************)
108 lemma lsubsn_refl: ∀h,L. h ⊢ L :⊑[] L.
109 #h #L elim L -L // /2 width=1/