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/computation/cprs.ma".
16 include "basic_2/computation/xprs.ma".
17 include "basic_2/equivalence/cpcs.ma".
19 (* STRATIFIED NATIVE VALIDITY FOR TERMS *************************************)
21 inductive snv (h:sh) (g:sd h): lenv → predicate term ≝
22 | snv_sort: ∀L,k. snv h g L (⋆k)
23 | snv_lref: ∀I,L,K,V,i. ⇩[0, i] L ≡ K.ⓑ{I}V → snv h g K V → snv h g L (#i)
24 | snv_bind: ∀a,I,L,V,T. snv h g L V → snv h g (L.ⓑ{I}V) T → snv h g L (ⓑ{a,I}V.T)
25 | snv_appl: ∀a,L,V,W,W0,T,U,l. snv h g L V → snv h g L T →
26 ⦃h, L⦄ ⊢ V •[g, l + 1] W → L ⊢ W ➡* W0 →
27 ⦃h, L⦄ ⊢ T ➸*[g] ⓛ{a}W0.U → snv h g L (ⓐV.T)
28 | snv_cast: ∀L,W,T,U,l. snv h g L W → snv h g L T →
29 ⦃h, L⦄ ⊢ T •[g, l + 1] U → L ⊢ U ⬌* W → snv h g L (ⓝW.T)
32 interpretation "stratified native validity (term)"
33 'NativeValid h g L T = (snv h g L T).
35 (* Basic inversion lemmas ***************************************************)
37 lemma snv_inv_bind_aux: ∀h,g,L,X. ⦃h, L⦄ ⊩ X :[g] → ∀a,I,V,T. X = ⓑ{a,I}V.T →
38 ⦃h, L⦄ ⊩ V :[g] ∧ ⦃h, L.ⓑ{I}V⦄ ⊩ T :[g].
40 [ #L #k #a #I #V #T #H destruct
41 | #I0 #L #K #V0 #i #_ #_ #a #I #V #T #H destruct
42 | #b #I0 #L #V0 #T0 #HV0 #HT0 #a #I #V #T #H destruct /2 width=1/
43 | #b #L #V0 #W0 #W00 #T0 #U0 #l #_ #_ #_ #_ #_ #a #I #V #T #H destruct
44 | #L #W0 #T0 #U0 #l #_ #_ #_ #_ #a #I #V #T #H destruct
48 lemma snv_inv_bind: ∀h,g,a,I,L,V,T. ⦃h, L⦄ ⊩ ⓑ{a,I}V.T :[g] →
49 ⦃h, L⦄ ⊩ V :[g] ∧ ⦃h, L.ⓑ{I}V⦄ ⊩ T :[g].
52 lemma snv_inv_appl_aux: ∀h,g,L,X. ⦃h, L⦄ ⊩ X :[g] → ∀V,T. X = ⓐV.T →
53 ∃∃a,W,W0,U,l. ⦃h, L⦄ ⊩ V :[g] & ⦃h, L⦄ ⊩ T :[g] &
54 ⦃h, L⦄ ⊢ V •[g, l + 1] W & L ⊢ W ➡* W0 &
55 ⦃h, L⦄ ⊢ T ➸*[g] ⓛ{a}W0.U.
57 [ #L #k #V #T #H destruct
58 | #I #L #K #V0 #i #_ #_ #V #T #H destruct
59 | #a #I #L #V0 #T0 #_ #_ #V #T #H destruct
60 | #a #L #V0 #W0 #W00 #T0 #U0 #l #HV0 #HT0 #HVW0 #HW00 #HTU0 #V #T #H destruct /2 width=8/
61 | #L #W0 #T0 #U0 #l #_ #_ #_ #_ #V #T #H destruct
65 lemma snv_inv_appl: ∀h,g,L,V,T. ⦃h, L⦄ ⊩ ⓐV.T :[g] →
66 ∃∃a,W,W0,U,l. ⦃h, L⦄ ⊩ V :[g] & ⦃h, L⦄ ⊩ T :[g] &
67 ⦃h, L⦄ ⊢ V •[g, l + 1] W & L ⊢ W ➡* W0 &
68 ⦃h, L⦄ ⊢ T ➸*[g] ⓛ{a}W0.U.