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 include "basic_2/notation/relations/lrsubeqv_5.ma".
16 include "basic_2/dynamic/snv.ma".
18 (* LOCAL ENVIRONMENT REFINEMENT FOR STRATIFIED NATIVE VALIDITY **************)
20 (* Note: this is not transitive *)
21 inductive lsubsv (h) (g) (G): relation lenv ≝
22 | lsubsv_atom: lsubsv h g G (⋆) (⋆)
23 | lsubsv_pair: ∀I,L1,L2,V. lsubsv h g G L1 L2 →
24 lsubsv h g G (L1.ⓑ{I}V) (L2.ⓑ{I}V)
25 | lsubsv_abbr: ∀L1,L2,W,V,l. ⦃G, L1⦄ ⊢ W ¡[h, g] → ⦃G, L1⦄ ⊢ V ¡[h, g] →
26 scast h g l G L1 V W → ⦃G, L2⦄ ⊢ W ¡[h, g] →
27 ⦃G, L1⦄ ⊢ V ▪[h, g] l+1 → ⦃G, L2⦄ ⊢ W ▪[h, g] l →
28 lsubsv h g G L1 L2 → lsubsv h g G (L1.ⓓⓝW.V) (L2.ⓛW)
32 "local environment refinement (stratified native validity)"
33 'LRSubEqV h g G L1 L2 = (lsubsv h g G L1 L2).
35 (* Basic inversion lemmas ***************************************************)
37 fact lsubsv_inv_atom1_aux: ∀h,g,G,L1,L2. G ⊢ L1 ¡⊑[h, g] L2 → L1 = ⋆ → L2 = ⋆.
38 #h #g #G #L1 #L2 * -L1 -L2
40 | #I #L1 #L2 #V #_ #H destruct
41 | #L1 #L2 #W #V #l #_ #_ #_ #_ #_ #_ #_ #H destruct
45 lemma lsubsv_inv_atom1: ∀h,g,G,L2. G ⊢ ⋆ ¡⊑[h, g] L2 → L2 = ⋆.
46 /2 width=6 by lsubsv_inv_atom1_aux/ qed-.
48 fact lsubsv_inv_pair1_aux: ∀h,g,G,L1,L2. G ⊢ L1 ¡⊑[h, g] L2 →
49 ∀I,K1,X. L1 = K1.ⓑ{I}X →
50 (∃∃K2. G ⊢ K1 ¡⊑[h, g] K2 & L2 = K2.ⓑ{I}X) ∨
51 ∃∃K2,W,V,l. ⦃G, K1⦄ ⊢ W ¡[h, g] & ⦃G, K1⦄ ⊢ V ¡[h, g] &
52 scast h g l G K1 V W & ⦃G, K2⦄ ⊢ W ¡[h, g] &
53 ⦃G, K1⦄ ⊢ V ▪[h, g] l+1 & ⦃G, K2⦄ ⊢ W ▪[h, g] l &
55 I = Abbr & L2 = K2.ⓛW & X = ⓝW.V.
56 #h #g #G #L1 #L2 * -L1 -L2
57 [ #J #K1 #X #H destruct
58 | #I #L1 #L2 #V #HL12 #J #K1 #X #H destruct /3 width=3/
59 | #L1 #L2 #W #V #l #H1W #HV #HVW #H2W #H1l #H2l #HL12 #J #K1 #X #H destruct /3 width=13/
63 lemma lsubsv_inv_pair1: ∀h,g,I,G,K1,L2,X. G ⊢ K1.ⓑ{I}X ¡⊑[h, g] L2 →
64 (∃∃K2. G ⊢ K1 ¡⊑[h, g] K2 & L2 = K2.ⓑ{I}X) ∨
65 ∃∃K2,W,V,l. ⦃G, K1⦄ ⊢ W ¡[h, g] & ⦃G, K1⦄ ⊢ V ¡[h, g] &
66 scast h g l G K1 V W & ⦃G, K2⦄ ⊢ W ¡[h, g] &
67 ⦃G, K1⦄ ⊢ V ▪[h, g] l+1 & ⦃G, K2⦄ ⊢ W ▪[h, g] l &
69 I = Abbr & L2 = K2.ⓛW & X = ⓝW.V.
70 /2 width=3 by lsubsv_inv_pair1_aux/ qed-.
72 fact lsubsv_inv_atom2_aux: ∀h,g,G,L1,L2. G ⊢ L1 ¡⊑[h, g] L2 → L2 = ⋆ → L1 = ⋆.
73 #h #g #G #L1 #L2 * -L1 -L2
75 | #I #L1 #L2 #V #_ #H destruct
76 | #L1 #L2 #W #V #l #_ #_ #_ #_ #_ #_ #_ #H destruct
80 lemma lsubsv_inv_atom2: ∀h,g,G,L1. G ⊢ L1 ¡⊑[h, g] ⋆ → L1 = ⋆.
81 /2 width=6 by lsubsv_inv_atom2_aux/ qed-.
83 fact lsubsv_inv_pair2_aux: ∀h,g,G,L1,L2. G ⊢ L1 ¡⊑[h, g] L2 →
84 ∀I,K2,W. L2 = K2.ⓑ{I}W →
85 (∃∃K1. G ⊢ K1 ¡⊑[h, g] K2 & L1 = K1.ⓑ{I}W) ∨
86 ∃∃K1,V,l. ⦃G, K1⦄ ⊢ W ¡[h, g] & ⦃G, K1⦄ ⊢ V ¡[h, g] &
87 scast h g l G K1 V W & ⦃G, K2⦄ ⊢ W ¡[h, g] &
88 ⦃G, K1⦄ ⊢ V ▪[h, g] l+1 & ⦃G, K2⦄ ⊢ W ▪[h, g] l &
89 G ⊢ K1 ¡⊑[h, g] K2 & I = Abst & L1 = K1. ⓓⓝW.V.
90 #h #g #G #L1 #L2 * -L1 -L2
91 [ #J #K2 #U #H destruct
92 | #I #L1 #L2 #V #HL12 #J #K2 #U #H destruct /3 width=3/
93 | #L1 #L2 #W #V #l #H1W #HV #HVW #H2W #H1l #H2l #HL12 #J #K2 #U #H destruct /3 width=10/
97 lemma lsubsv_inv_pair2: ∀h,g,I,G,L1,K2,W. G ⊢ L1 ¡⊑[h, g] K2.ⓑ{I}W →
98 (∃∃K1. G ⊢ K1 ¡⊑[h, g] K2 & L1 = K1.ⓑ{I}W) ∨
99 ∃∃K1,V,l. ⦃G, K1⦄ ⊢ W ¡[h, g] & ⦃G, K1⦄ ⊢ V ¡[h, g] &
100 scast h g l G K1 V W & ⦃G, K2⦄ ⊢ W ¡[h, g] &
101 ⦃G, K1⦄ ⊢ V ▪[h, g] l+1 & ⦃G, K2⦄ ⊢ W ▪[h, g] l &
102 G ⊢ K1 ¡⊑[h, g] K2 & I = Abst & L1 = K1. ⓓⓝW.V.
103 /2 width=3 by lsubsv_inv_pair2_aux/ qed-.
105 (* Basic_forward lemmas *****************************************************)
107 lemma lsubsv_fwd_lsubr: ∀h,g,G,L1,L2. G ⊢ L1 ¡⊑[h, g] L2 → L1 ⊑ L2.
108 #h #g #G #L1 #L2 #H elim H -L1 -L2 // /2 width=1/
111 (* Basic properties *********************************************************)
113 lemma lsubsv_refl: ∀h,g,G,L. G ⊢ L ¡⊑[h, g] L.
114 #h #g #G #L elim L -L // /2 width=1/
117 lemma lsubsv_cprs_trans: ∀h,g,G,L1,L2. G ⊢ L1 ¡⊑[h, g] L2 →
118 ∀T1,T2. ⦃G, L2⦄ ⊢ T1 ➡* T2 → ⦃G, L1⦄ ⊢ T1 ➡* T2.
119 /3 width=6 by lsubsv_fwd_lsubr, lsubr_cprs_trans/