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/colon_6.ma".
16 include "basic_2/notation/relations/colon_5.ma".
17 include "basic_2/notation/relations/colonstar_5.ma".
18 include "basic_2/dynamic/cnv.ma".
20 (* NATIVE TYPE ASSIGNMENT FOR TERMS *****************************************)
22 definition nta (a) (h): relation4 genv lenv term term ≝
23 λG,L,T,U. ⦃G,L⦄ ⊢ ⓝU.T ![a,h].
25 interpretation "native type assignment (term)"
26 'Colon a h G L T U = (nta a h G L T U).
28 interpretation "restricted native type assignment (term)"
29 'Colon h G L T U = (nta true h G L T U).
31 interpretation "extended native type assignment (term)"
32 'ColonStar h G L T U = (nta false h G L T U).
34 (* Basic properties *********************************************************)
36 (* Basic_1: was by definition: ty3_sort *)
37 (* Basic_2A1: was by definition: nta_sort ntaa_sort *)
38 lemma nta_sort (a) (h) (G) (L) (s): ⦃G,L⦄ ⊢ ⋆s :[a,h] ⋆(next h s).
39 #a #h #G #L #s /2 width=3 by cnv_sort, cnv_cast, cpms_sort/
42 lemma nta_bind_cnv (a) (h) (G) (K):
43 ∀V. ⦃G,K⦄ ⊢ V ![a,h] →
44 ∀I,T,U. ⦃G,K.ⓑ{I}V⦄ ⊢ T :[a,h] U →
45 ∀p. ⦃G,K⦄ ⊢ ⓑ{p,I}V.T :[a,h] ⓑ{p,I}V.U.
46 #a #h #G #K #V #HV #I #T #U #H #p
47 elim (cnv_inv_cast … H) -H #X #HU #HT #HUX #HTX
48 /3 width=5 by cnv_bind, cnv_cast, cpms_bind_dx/
51 (* Basic_2A1: was by definition: nta_cast *)
52 lemma nta_cast (a) (h) (G) (L):
53 ∀T,U. ⦃G,L⦄ ⊢ T :[a,h] U → ⦃G,L⦄ ⊢ ⓝU.T :[a,h] U.
55 elim (cnv_inv_cast … H) #X #HU #HT #HUX #HTX
56 /3 width=3 by cnv_cast, cpms_eps/
59 (* Basic_1: was by definition: ty3_cast *)
60 lemma nta_cast_old (a) (h) (G) (L):
61 ∀T0,T1. ⦃G,L⦄ ⊢ T0 :[a,h] T1 →
62 ∀T2. ⦃G,L⦄ ⊢ T1 :[a,h] T2 → ⦃G,L⦄ ⊢ ⓝT1.T0 :[a,h] ⓝT2.T1.
63 #a #h #G #L #T0 #T1 #H1 #T2 #H2
64 elim (cnv_inv_cast … H1) #X1 #_ #_ #HTX1 #HTX01
65 elim (cnv_inv_cast … H2) #X2 #_ #_ #HTX2 #HTX12
66 /3 width=3 by cnv_cast, cpms_eps/
69 (* Basic_forward lemmas *****************************************************)
71 lemma nta_fwd_cnv_sn (a) (h) (G) (L):
72 ∀T,U. ⦃G,L⦄ ⊢ T :[a,h] U → ⦃G,L⦄ ⊢ T ![a,h].
74 elim (cnv_inv_cast … H) -H #X #_ #HT #_ #_ //
77 (* Note: this is nta_fwd_correct_cnv *)
78 lemma nta_fwd_cnv_dx (a) (h) (G) (L):
79 ∀T,U. ⦃G,L⦄ ⊢ T :[a,h] U → ⦃G,L⦄ ⊢ U ![a,h].
81 elim (cnv_inv_cast … H) -H #X #HU #_ #_ #_ //
86 | nta_ldef: ∀L,K,V,W,U,i. ⇩[0, i] L ≡ K. ⓓV → nta h K V W →
87 ⇧[0, i + 1] W ≡ U → nta h L (#i) U
88 | nta_ldec: ∀L,K,W,V,U,i. ⇩[0, i] L ≡ K. ⓛW → nta h K W V →
89 ⇧[0, i + 1] W ≡ U → nta h L (#i) U
92 (* Basic properties *********************************************************)
94 lemma nta_ind_alt: ∀h. ∀R:lenv→relation term.
95 (∀L,k. R L ⋆k ⋆(next h k)) →
97 ⇩[O, i] L ≡ K.ⓓV → ⦃h, K⦄ ⊢ V : W → ⇧[O, i + 1] W ≡ U →
101 ⇩[O, i] L ≡ K.ⓛW → ⦃h, K⦄ ⊢ W : V → ⇧[O, i + 1] W ≡ U →
105 ⦃h, L⦄ ⊢ V : W → ⦃h, L.ⓑ{I}V⦄ ⊢ T : U →
106 R L V W → R (L.ⓑ{I}V) T U → R L (ⓑ{I}V.T) (ⓑ{I}V.U)
109 ⦃h, L⦄ ⊢ V : W → ⦃h, L⦄ ⊢ (ⓛW.T):(ⓛW.U) →
110 R L V W →R L (ⓛW.T) (ⓛW.U) →R L (ⓐV.ⓛW.T) (ⓐV.ⓛW.U)
113 ⦃h, L⦄ ⊢ T : U → ⦃h, L⦄ ⊢ (ⓐV.U) : W →
114 R L T U → R L (ⓐV.U) W → R L (ⓐV.T) (ⓐV.U)
117 ⦃h, L⦄ ⊢ T : U → ⦃h, L⦄ ⊢ U : W →
118 R L T U → R L U W → R L (ⓝU.T) U
121 ⦃h, L⦄ ⊢ T : U1 → L ⊢ U1 ⬌* U2 → ⦃h, L⦄ ⊢ U2 : V2 →
122 R L T U1 →R L U2 V2 →R L T U2
124 ∀L,T,U. ⦃h, L⦄ ⊢ T : U → R L T U.
125 #h #R #H1 #H2 #H3 #H4 #H5 #H6 #H7 #H8 #L #T #U #H elim (nta_ntaa … H) -L -T -U
126 // /3 width=1 by ntaa_nta/ /3 width=3 by ntaa_nta/ /3 width=4 by ntaa_nta/
127 /3 width=7 by ntaa_nta/
132 (* Basic_1: removed theorems 4:
133 ty3_getl_subst0 ty3_fsubst0 ty3_csubst0 ty3_subst0
135 (* Basic_2A1: removed theorems 2: