]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/etc_2A1/sta/sta.etc
update in binaries for λδ
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / etc_2A1 / sta / sta.etc
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/notation/relations/statictype_5.ma".
16 include "basic_2/grammar/genv.ma".
17 include "basic_2/substitution/drop.ma".
18 include "basic_2/static/sh.ma".
19
20 (* STATIC TYPE ASSIGNMENT ON TERMS ******************************************)
21
22 (* activate genv *)
23 inductive sta (h:sh): relation4 genv lenv term term ≝
24 | sta_sort: ∀G,L,k. sta h G L (⋆k) (⋆(next h k))
25 | sta_ldef: ∀G,L,K,V,W,U,i. ⇩[i] L ≡ K.ⓓV → sta h G K V W →
26             ⇧[0, i + 1] W ≡ U → sta h G L (#i) U
27 | sta_ldec: ∀G,L,K,W,V,U,i. ⇩[i] L ≡ K.ⓛW → sta h G K W V →
28             ⇧[0, i + 1] W ≡ U → sta h G L (#i) U
29 | sta_bind: ∀a,I,G,L,V,T,U. sta h G (L.ⓑ{I}V) T U →
30             sta h G L (ⓑ{a,I}V.T) (ⓑ{a,I}V.U)
31 | sta_appl: ∀G,L,V,T,U. sta h G L T U → sta h G L (ⓐV.T) (ⓐV.U)
32 | sta_cast: ∀G,L,W,T,U. sta h G L T U → sta h G L (ⓝW.T) U
33 .
34
35 interpretation "static type assignment (term)"
36    'StaticType h G L T U = (sta h G L T U).
37
38 (* Basic inversion lemmas ************************************************)
39
40 fact sta_inv_sort1_aux: ∀h,G,L,T,U. ⦃G, L⦄ ⊢ T •[h] U → ∀k0. T = ⋆k0 →
41                         U = ⋆(next h k0).
42 #h #G #L #T #U * -G -L -T -U
43 [ #G #L #k #k0 #H destruct //
44 | #G #L #K #V #W #U #i #_ #_ #_ #k0 #H destruct
45 | #G #L #K #W #V #U #i #_ #_ #_ #k0 #H destruct
46 | #a #I #G #L #V #T #U #_ #k0 #H destruct
47 | #G #L #V #T #U #_ #k0 #H destruct
48 | #G #L #W #T #U #_ #k0 #H destruct
49 qed-.
50
51 (* Basic_1: was: sty0_gen_sort *)
52 lemma sta_inv_sort1: ∀h,G,L,U,k. ⦃G, L⦄ ⊢ ⋆k •[h] U → U = ⋆(next h k).
53 /2 width=5 by sta_inv_sort1_aux/ qed-.
54
55 fact sta_inv_lref1_aux: ∀h,G,L,T,U. ⦃G, L⦄ ⊢ T •[h] U → ∀j. T = #j →
56                         (∃∃K,V,W. ⇩[j] L ≡ K.ⓓV & ⦃G, K⦄ ⊢ V •[h] W &
57                                   ⇧[0, j+1] W ≡ U
58                         ) ∨
59                         (∃∃K,W,V. ⇩[j] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W •[h] V &
60                                   ⇧[0, j+1] W ≡ U
61                         ).
62 #h #G #L #T #U * -G -L -T -U
63 [ #G #L #k #j #H destruct
64 | #G #L #K #V #W #U #i #HLK #HVW #HWU #j #H destruct /3 width=6 by or_introl, ex3_3_intro/
65 | #G #L #K #W #V #U #i #HLK #HWV #HWU #j #H destruct /3 width=6 by or_intror, ex3_3_intro/
66 | #a #I #G #L #V #T #U #_ #j #H destruct
67 | #G #L #V #T #U #_ #j #H destruct
68 | #G #L #W #T #U #_ #j #H destruct
69 ]
70 qed-.
71
72 (* Basic_1: was sty0_gen_lref *)
73 lemma sta_inv_lref1: ∀h,G,L,U,i. ⦃G, L⦄ ⊢ #i •[h] U →
74                      (∃∃K,V,W. ⇩[i] L ≡ K.ⓓV & ⦃G, K⦄ ⊢ V •[h] W &
75                                ⇧[0, i+1] W ≡ U
76                      ) ∨
77                      (∃∃K,W,V. ⇩[i] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W •[h] V &
78                                ⇧[0, i+1] W ≡ U
79                      ).
80 /2 width=3 by sta_inv_lref1_aux/ qed-.
81
82 fact sta_inv_gref1_aux: ∀h,G,L,T,U. ⦃G, L⦄ ⊢ T •[h] U → ∀p0. T = §p0 → ⊥.
83 #h #G #L #T #U * -G -L -T -U
84 [ #G #L #k #p0 #H destruct
85 | #G #L #K #V #W #U #i #_ #_ #_ #p0 #H destruct
86 | #G #L #K #W #V #U #i #_ #_ #_ #p0 #H destruct
87 | #a #I #G #L #V #T #U #_ #p0 #H destruct
88 | #G #L #V #T #U #_ #p0 #H destruct
89 | #G #L #W #T #U #_ #p0 #H destruct
90 qed-.
91
92 lemma sta_inv_gref1: ∀h,G,L,U,p. ⦃G, L⦄ ⊢ §p •[h] U → ⊥.
93 /2 width=8 by sta_inv_gref1_aux/ qed-.
94
95 fact sta_inv_bind1_aux: ∀h,G,L,T,U. ⦃G, L⦄ ⊢ T •[h] U → ∀b,J,X,Y. T = ⓑ{b,J}Y.X →
96                         ∃∃Z. ⦃G, L.ⓑ{J}Y⦄ ⊢ X •[h] Z & U = ⓑ{b,J}Y.Z.
97 #h #G #L #T #U * -G -L -T -U
98 [ #G #L #k #b #J #X #Y #H destruct
99 | #G #L #K #V #W #U #i #_ #_ #_ #b #J #X #Y #H destruct
100 | #G #L #K #W #V #U #i #_ #_ #_ #b #J #X #Y #H destruct
101 | #a #I #G #L #V #T #U #HTU #b #J #X #Y #H destruct /2 width=3 by ex2_intro/
102 | #G #L #V #T #U #_ #b #J #X #Y #H destruct
103 | #G #L #W #T #U #_ #b #J #X #Y #H destruct
104 ]
105 qed-.
106
107 (* Basic_1: was: sty0_gen_bind *)
108 lemma sta_inv_bind1: ∀h,b,J,G,L,Y,X,U. ⦃G, L⦄ ⊢ ⓑ{b,J}Y.X •[h] U →
109                      ∃∃Z. ⦃G, L.ⓑ{J}Y⦄ ⊢ X •[h] Z & U = ⓑ{b,J}Y.Z.
110 /2 width=3 by sta_inv_bind1_aux/ qed-.
111
112 fact sta_inv_appl1_aux: ∀h,G,L,T,U. ⦃G, L⦄ ⊢ T •[h] U → ∀X,Y. T = ⓐY.X →
113                         ∃∃Z. ⦃G, L⦄ ⊢ X •[h] Z & U = ⓐY.Z.
114 #h #G #L #T #U * -G -L -T -U
115 [ #G #L #k #X #Y #H destruct
116 | #G #L #K #V #W #U #i #_ #_ #_ #X #Y #H destruct
117 | #G #L #K #W #V #U #i #_ #_ #_ #X #Y #H destruct
118 | #a #I #G #L #V #T #U #_ #X #Y #H destruct
119 | #G #L #V #T #U #HTU #X #Y #H destruct /2 width=3 by ex2_intro/
120 | #G #L #W #T #U #_ #X #Y #H destruct
121 ]
122 qed-.
123
124 (* Basic_1: was: sty0_gen_appl *)
125 lemma sta_inv_appl1: ∀h,G,L,Y,X,U. ⦃G, L⦄ ⊢ ⓐY.X •[h] U →
126                      ∃∃Z. ⦃G, L⦄ ⊢ X •[h] Z & U = ⓐY.Z.
127 /2 width=3 by sta_inv_appl1_aux/ qed-.
128
129 fact sta_inv_cast1_aux: ∀h,G,L,T,U. ⦃G, L⦄ ⊢ T •[h] U → ∀X,Y. T = ⓝY.X →
130                      ⦃G, L⦄ ⊢ X •[h] U.
131 #h #G #L #T #U * -G -L -T -U
132 [ #G #L #k #X #Y #H destruct
133 | #G #L #K #V #W #U #i #_ #_ #_ #X #Y #H destruct
134 | #G #L #K #W #V #U #i #_ #_ #_ #X #Y #H destruct
135 | #a #I #G #L #V #T #U #_ #X #Y #H destruct
136 | #G #L #V #T #U #_ #X #Y #H destruct
137 | #G #L #W #T #U #HTU #X #Y #H destruct //
138 ]
139 qed-.
140
141 (* Basic_1: was: sty0_gen_cast *)
142 lemma sta_inv_cast1: ∀h,G,L,X,Y,U. ⦃G, L⦄ ⊢ ⓝY.X •[h] U → ⦃G, L⦄ ⊢ X •[h] U.
143 /2 width=4 by sta_inv_cast1_aux/ qed-.