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_4.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:sh) (g:sd h): relation lenv ≝
22 | lsubsv_atom: lsubsv h g (⋆) (⋆)
23 | lsubsv_pair: ∀I,L1,L2,V. lsubsv h g L1 L2 →
24 lsubsv h g (L1.ⓑ{I}V) (L2.ⓑ{I}V)
25 | lsubsv_abbr: ∀L1,L2,W,V,W1,V2,l. ⦃h, L1⦄ ⊢ ⓝW.V ¡[g] → ⦃h, L2⦄ ⊢ W ¡[g] →
26 ⦃h, L1⦄ ⊢ V •[g] ⦃l+1, W1⦄ → ⦃h, L2⦄ ⊢ W •[g] ⦃l, V2⦄ →
27 lsubsv h g L1 L2 → lsubsv h g (L1.ⓓⓝW.V) (L2.ⓛW)
31 "local environment refinement (stratified native validity)"
32 'LRSubEqV h g L1 L2 = (lsubsv h g L1 L2).
34 (* Basic inversion lemmas ***************************************************)
36 fact lsubsv_inv_atom1_aux: ∀h,g,L1,L2. h ⊢ L1 ¡⊑[g] L2 → L1 = ⋆ → L2 = ⋆.
37 #h #g #L1 #L2 * -L1 -L2
39 | #I #L1 #L2 #V #_ #H destruct
40 | #L1 #L2 #W #V #V1 #V2 #l #_ #_ #_ #_ #_ #H destruct
44 lemma lsubsv_inv_atom1: ∀h,g,L2. h ⊢ ⋆ ¡⊑[g] L2 → L2 = ⋆.
45 /2 width=5 by lsubsv_inv_atom1_aux/ qed-.
47 fact lsubsv_inv_pair1_aux: ∀h,g,L1,L2. h ⊢ L1 ¡⊑[g] L2 →
48 ∀I,K1,X. L1 = K1.ⓑ{I}X →
49 (∃∃K2. h ⊢ K1 ¡⊑[g] K2 & L2 = K2.ⓑ{I}X) ∨
50 ∃∃K2,W,V,W1,V2,l. ⦃h, K1⦄ ⊢ X ¡[g] & ⦃h, K2⦄ ⊢ W ¡[g] &
51 ⦃h, K1⦄ ⊢ V •[g] ⦃l+1, W1⦄ & ⦃h, K2⦄ ⊢ W •[g] ⦃l, V2⦄ &
53 I = Abbr & L2 = K2.ⓛW & X = ⓝW.V.
54 #h #g #L1 #L2 * -L1 -L2
55 [ #J #K1 #X #H destruct
56 | #I #L1 #L2 #V #HL12 #J #K1 #X #H destruct /3 width=3/
57 | #L1 #L2 #W #V #W1 #V2 #l #HV #HW #HW1 #HV2 #HL12 #J #K1 #X #H destruct /3 width=12/
61 lemma lsubsv_inv_pair1: ∀h,g,I,K1,L2,X. h ⊢ K1.ⓑ{I}X ¡⊑[g] L2 →
62 (∃∃K2. h ⊢ K1 ¡⊑[g] K2 & L2 = K2.ⓑ{I}X) ∨
63 ∃∃K2,W,V,W1,V2,l. ⦃h, K1⦄ ⊢ X ¡[g] & ⦃h, K2⦄ ⊢ W ¡[g] &
64 ⦃h, K1⦄ ⊢ V •[g] ⦃l+1, W1⦄ & ⦃h, K2⦄ ⊢ W •[g] ⦃l, V2⦄ &
66 I = Abbr & L2 = K2.ⓛW & X = ⓝW.V.
67 /2 width=3 by lsubsv_inv_pair1_aux/ qed-.
69 fact lsubsv_inv_atom2_aux: ∀h,g,L1,L2. h ⊢ L1 ¡⊑[g] L2 → L2 = ⋆ → L1 = ⋆.
70 #h #g #L1 #L2 * -L1 -L2
72 | #I #L1 #L2 #V #_ #H destruct
73 | #L1 #L2 #W #V #V1 #V2 #l #_ #_ #_ #_ #_ #H destruct
77 lemma lsubsv_inv_atom2: ∀h,g,L1. h ⊢ L1 ¡⊑[g] ⋆ → L1 = ⋆.
78 /2 width=5 by lsubsv_inv_atom2_aux/ qed-.
80 fact lsubsv_inv_pair2_aux: ∀h,g,L1,L2. h ⊢ L1 ¡⊑[g] L2 →
81 ∀I,K2,W. L2 = K2.ⓑ{I}W →
82 (∃∃K1. h ⊢ K1 ¡⊑[g] K2 & L1 = K1.ⓑ{I}W) ∨
83 ∃∃K1,V,W1,V2,l. ⦃h, K1⦄ ⊢ ⓝW.V ¡[g] & ⦃h, K2⦄ ⊢ W ¡[g] &
84 ⦃h, K1⦄ ⊢ V •[g] ⦃l+1, W1⦄ & ⦃h, K2⦄ ⊢ W •[g] ⦃l, V2⦄ &
85 h ⊢ K1 ¡⊑[g] K2 & I = Abst & L1 = K1. ⓓⓝW.V.
86 #h #g #L1 #L2 * -L1 -L2
87 [ #J #K2 #U #H destruct
88 | #I #L1 #L2 #V #HL12 #J #K2 #U #H destruct /3 width=3/
89 | #L1 #L2 #W #V #W1 #V2 #l #HV #HW #HW1 #HV2 #HL12 #J #K2 #U #H destruct /3 width=10/
93 lemma lsubsv_inv_pair2: ∀h,g,I,L1,K2,W. h ⊢ L1 ¡⊑[g] K2.ⓑ{I}W →
94 (∃∃K1. h ⊢ K1 ¡⊑[g] K2 & L1 = K1.ⓑ{I}W) ∨
95 ∃∃K1,V,W1,V2,l. ⦃h, K1⦄ ⊢ ⓝW.V ¡[g] & ⦃h, K2⦄ ⊢ W ¡[g] &
96 ⦃h, K1⦄ ⊢ V •[g] ⦃l+1, W1⦄ & ⦃h, K2⦄ ⊢ W •[g] ⦃l, V2⦄ &
97 h ⊢ K1 ¡⊑[g] K2 & I = Abst & L1 = K1. ⓓⓝW.V.
98 /2 width=3 by lsubsv_inv_pair2_aux/ qed-.
100 (* Basic_forward lemmas *****************************************************)
102 lemma lsubsv_fwd_lsubr: ∀h,g,L1,L2. h ⊢ L1 ¡⊑[g] L2 → L1 ⊑ L2.
103 #h #g #L1 #L2 #H elim H -L1 -L2 // /2 width=1/
106 (* Basic properties *********************************************************)
108 lemma lsubsv_refl: ∀h,g,L. h ⊢ L ¡⊑[g] L.
109 #h #g #L elim L -L // /2 width=1/
112 lemma lsubsv_cprs_trans: ∀h,g,L1,L2. h ⊢ L1 ¡⊑[g] L2 →
113 ∀T1,T2. L2 ⊢ T1 ➡* T2 → L1 ⊢ T1 ➡* T2.
114 /3 width=5 by lsubsv_fwd_lsubr, lsubr_cprs_trans/