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 @{ 'CrSubEqN $h $L1 $L2 }.
19 notation "hvbox( h ⊢ break term 46 L1 : : ⊑ break term 46 L2 )"
20 non associative with precedence 45
21 for @{ 'CrSubEqNAlt $h $L1 $L2 }.
23 include "basic_2/dynamic/nta.ma".
25 (* LOCAL ENVIRONMENT REFINEMENT FOR NATIVE TYPE ASSIGNMENT ******************)
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)
36 "local environment refinement (native type assigment)"
37 'CrSubEqN h L1 L2 = (lsubn h L1 L2).
39 (* Basic inversion lemmas ***************************************************)
41 fact lsubn_inv_atom1_aux: ∀h,L1,L2. h ⊢ L1 :⊑ L2 → L1 = ⋆ → L2 = ⋆.
44 | #I #L1 #L2 #V #_ #H destruct
45 | #L1 #L2 #V #W #_ #_ #_ #H destruct
49 lemma lsubn_inv_atom1: ∀h,L2. h ⊢ ⋆ :⊑ L2 → L2 = ⋆.
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.
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/
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.
69 fact lsubn_inv_atom2_aux: ∀h,L1,L2. h ⊢ L1 :⊑ L2 → L2 = ⋆ → L1 = ⋆.
72 | #I #L1 #L2 #V #_ #H destruct
73 | #L1 #L2 #V #W #_ #_ #_ #H destruct
77 lemma lsubc_inv_atom2: ∀h,L1. h ⊢ L1 :⊑ ⋆ → L1 = ⋆.
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.
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/
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.
98 (* Basic_forward lemmas *****************************************************)
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/
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/
108 (* Basic properties *********************************************************)
110 (* Basic_1: was: csubt_refl *)
111 lemma lsubn_refl: ∀h,L. h ⊢ L :⊑ L.
112 #h #L elim L -L // /2 width=1/
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