]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda_delta/basic_2/dynamic/snv.ma
25b85269e64c44d17851fb01320e16dc21e3130f
[helm.git] / matita / matita / contribs / lambda_delta / basic_2 / dynamic / snv.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "basic_2/computation/cprs.ma".
16 include "basic_2/computation/xprs.ma".
17 include "basic_2/equivalence/cpcs.ma".
18
19 (* STRATIFIED NATIVE VALIDITY FOR TERMS *************************************)
20
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)
30 .
31
32 interpretation "stratified native validity (term)"
33    'NativeValid h g L T = (snv h g L T).
34
35 (* Basic inversion lemmas ***************************************************)
36
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].
39 #h #g #L #X * -L -X
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
45 ]
46 qed.
47
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].
50 /2 width=4/ qed-.
51
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.
56 #h #g #L #X * -L -X
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
62 ]
63 qed.
64
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.
69 /2 width=3/ qed-.