]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/etc_2A1/sta/lstas.etc
update in binaries for λδ
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / etc_2A1 / sta / lstas.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/statictypestar_6.ma".
16 include "basic_2/static/sta.ma".
17
18 (* NAT-ITERATED STATIC TYPE ASSIGNMENT FOR TERMS ****************************)
19
20 definition lstas: ∀h. genv → lenv → nat → relation term ≝
21                   λh,G,L. lstar … (sta h G L).
22
23 interpretation "nat-iterated static type assignment (term)"
24    'StaticTypeStar h G L l T U = (lstas h G L l T U).
25
26 (* Basic eliminators ********************************************************)
27
28 lemma lstas_ind_sn: ∀h,G,L,U2. ∀R:relation2 nat term.
29                     R 0 U2 → (
30                        ∀l,T,U1. ⦃G, L⦄ ⊢ T •[h] U1 → ⦃G, L⦄ ⊢ U1 •* [h, l] U2 →
31                        R l U1 → R (l+1) T
32                     ) →
33                     ∀l,T. ⦃G, L⦄ ⊢ T •*[h, l] U2 → R l T.
34 /3 width=5 by lstar_ind_l/ qed-.
35
36 lemma lstas_ind_dx: ∀h,G,L,T. ∀R:relation2 nat term.
37                     R 0 T → (
38                        ∀l,U1,U2. ⦃G, L⦄ ⊢ T •* [h, l] U1 →  ⦃G, L⦄ ⊢ U1 •[h] U2 →
39                        R l U1 → R (l+1) U2
40                     ) →
41                     ∀l,U. ⦃G, L⦄ ⊢ T •*[h, l] U → R l U.
42 /3 width=5 by lstar_ind_r/ qed-.
43
44 (* Basic inversion lemmas ***************************************************)
45
46 lemma lstas_inv_O: ∀h,G,L,T,U. ⦃G, L⦄ ⊢ T •*[h, 0] U → T = U.
47 /2 width=4 by lstar_inv_O/ qed-.
48
49 lemma lstas_inv_SO: ∀h,G,L,T,U. ⦃G, L⦄ ⊢ T •*[h, 1] U → ⦃G, L⦄ ⊢ T •[h] U.
50 /2 width=1 by lstar_inv_step/ qed-.
51
52 lemma lstas_inv_step_sn: ∀h,G,L,T1,T2,l. ⦃G, L⦄ ⊢ T1 •*[h, l+1] T2 →
53                          ∃∃T. ⦃G, L⦄ ⊢ T1 •[h] T & ⦃G, L⦄ ⊢ T •*[h, l] T2.
54 /2 width=3 by lstar_inv_S/ qed-.
55
56 lemma lstas_inv_step_dx: ∀h,G,L,T1,T2,l. ⦃G, L⦄ ⊢ T1 •*[h, l+1] T2 →
57                          ∃∃T. ⦃G, L⦄ ⊢ T1 •*[h, l] T & ⦃G, L⦄ ⊢ T •[h] T2.
58 /2 width=3 by lstar_inv_S_dx/ qed-.
59
60 lemma lstas_inv_sort1: ∀h,G,L,X,k,l. ⦃G, L⦄ ⊢ ⋆k •*[h, l] X → X = ⋆((next h)^l k).
61 #h #G #L #X #k #l #H @(lstas_ind_dx … H) -X -l //
62 #l #X #X0 #_ #H #IHX destruct
63 lapply (sta_inv_sort1 … H) -H #H destruct
64 >iter_SO //
65 qed-.
66
67 lemma lstas_inv_gref1: ∀h,G,L,X,p,l. ⦃G, L⦄ ⊢ §p •*[h, l+1] X → ⊥.
68 #h #G #L #X #p #l #H elim (lstas_inv_step_sn … H) -H
69 #U #H #HUX elim (sta_inv_gref1 … H)
70 qed-.
71
72 lemma lstas_inv_bind1: ∀h,a,I,G,L,V,T,X,l. ⦃G, L⦄ ⊢ ⓑ{a,I}V.T •*[h, l] X →
73                        ∃∃U. ⦃G, L.ⓑ{I}V⦄ ⊢ T •*[h, l] U & X = ⓑ{a,I}V.U.
74 #h #a #I #G #L #V #T #X #l #H @(lstas_ind_dx … H) -X -l /2 width=3 by ex2_intro/
75 #l #X #X0 #_ #HX0 * #U #HTU #H destruct
76 elim (sta_inv_bind1 … HX0) -HX0 #U0 #HU0 #H destruct /3 width=3 by lstar_dx, ex2_intro/
77 qed-.
78
79 lemma lstas_inv_appl1: ∀h,G,L,V,T,X,l. ⦃G, L⦄ ⊢ ⓐV.T •*[h, l] X →
80                        ∃∃U. ⦃G, L⦄ ⊢ T •*[h, l] U & X = ⓐV.U.
81 #h #G #L #V #T #X #l #H @(lstas_ind_dx … H) -X -l /2 width=3 by ex2_intro/
82 #l #X #X0 #_ #HX0 * #U #HTU #H destruct
83 elim (sta_inv_appl1 … HX0) -HX0 #U0 #HU0 #H destruct /3 width=3 by lstar_dx, ex2_intro/
84 qed-.
85
86 lemma lstas_inv_cast1: ∀h,G,L,W,T,U,l. ⦃G, L⦄ ⊢ ⓝW.T •*[h, l+1] U → ⦃G, L⦄ ⊢ T •*[h, l+1] U.
87 #h #G #L #W #T #X #l #H elim (lstas_inv_step_sn … H) -H
88 #U #H #HUX lapply (sta_inv_cast1 … H) -H /2 width=3 by lstar_S/
89 qed-.
90
91 (* Basic properties *********************************************************)
92
93 lemma lstas_refl: ∀h,G,L. reflexive … (lstas h G L 0).
94 // qed.
95
96 lemma sta_lstas: ∀h,G,L,T,U. ⦃G, L⦄ ⊢ T •[h] U → ⦃G, L⦄ ⊢ T •*[h, 1] U.
97 /2 width=1 by lstar_step/ qed.
98
99 lemma lstas_step_sn: ∀h,G,L,T1,U1,U2,l. ⦃G, L⦄ ⊢ T1 •[h] U1 → ⦃G, L⦄ ⊢ U1 •*[h, l] U2 →
100                      ⦃G, L⦄ ⊢ T1 •*[h, l+1] U2.
101 /2 width=3 by lstar_S/ qed.
102
103 lemma lstas_step_dx: ∀h,G,L,T1,T2,U2,l. ⦃G, L⦄ ⊢ T1 •*[h, l] T2 → ⦃G, L⦄ ⊢ T2 •[h] U2 →
104                      ⦃G, L⦄ ⊢ T1 •*[h, l+1] U2.
105 /2 width=3 by lstar_dx/ qed.
106
107 lemma lstas_split: ∀h,G,L. inv_ltransitive … (lstas h G L).
108 /2 width=1 by lstar_inv_ltransitive/ qed-.
109
110 lemma lstas_sort: ∀h,G,L,l,k. ⦃G, L⦄ ⊢ ⋆k •*[h, l] ⋆((next h)^l k).
111 #h #G #L #l @(nat_ind_plus … l) -l //
112 #l #IHl #k >iter_SO /2 width=3 by sta_sort, lstas_step_dx/
113 qed.
114
115 lemma lstas_bind: ∀h,I,G,L,V,T,U,l. ⦃G, L.ⓑ{I}V⦄ ⊢ T •*[h, l] U →
116                   ∀a. ⦃G, L⦄ ⊢ ⓑ{a,I}V.T •*[h, l] ⓑ{a,I}V.U.
117 #h #I #G #L #V #T #U #l #H @(lstas_ind_dx … H) -U -l /3 width=3 by sta_bind, lstar_O, lstas_step_dx/
118 qed.
119
120 lemma lstas_appl: ∀h,G,L,T,U,l. ⦃G, L⦄ ⊢ T •*[h, l] U →
121                   ∀V.⦃G, L⦄ ⊢ ⓐV.T •*[h, l] ⓐV.U.
122 #h #G #L #T #U #l #H @(lstas_ind_dx … H) -U -l /3 width=3 by sta_appl, lstar_O, lstas_step_dx/
123 qed.
124
125 lemma lstas_cast: ∀h,G,L,T,U,l. ⦃G, L⦄ ⊢ T •*[h, l+1] U →
126                   ∀W. ⦃G, L⦄ ⊢ ⓝW.T •*[h, l+1] U.
127 #h #G #L #T #U #l #H elim (lstas_inv_step_sn … H) -H /3 width=3 by sta_cast, lstas_step_sn/
128 qed.
129
130 (* Basic_1: removed theorems 7:
131             sty1_abbr sty1_appl sty1_bind sty1_cast2
132             sty1_correct sty1_lift sty1_trans
133 *)