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/statictypestar_6.ma".
16 include "basic_2/static/ssta.ma".
18 (* ITERATED STRATIFIED STATIC TYPE ASSIGNMENT FOR TERMS *********************)
20 definition sstas: ∀h. sd h → relation4 genv lenv term term ≝
21 λh,g,G,L. star … (ssta_step h g G L).
23 interpretation "iterated stratified static type assignment (term)"
24 'StaticTypeStar h g G L T U = (sstas h g G L T U).
26 (* Basic eliminators ********************************************************)
28 lemma sstas_ind: ∀h,g,G,L,T. ∀R:predicate term.
30 ∀U1,U2,l. ⦃G, L⦄ ⊢ T •* [h, g] U1 → ⦃G, L⦄ ⊢ U1 •[h, g] ⦃l+1, U2⦄ →
33 ∀U. ⦃G, L⦄ ⊢ T •*[h, g] U → R U.
34 #h #g #G #L #T #R #IH1 #IH2 #U #H elim H -U //
35 #U1 #U2 #H * /2 width=5/
38 lemma sstas_ind_dx: ∀h,g,G,L,U2. ∀R:predicate term.
40 ∀T,U1,l. ⦃G, L⦄ ⊢ T •[h, g] ⦃l+1, U1⦄ → ⦃G, L⦄ ⊢ U1 •* [h, g] U2 →
43 ∀T. ⦃G, L⦄ ⊢ T •*[h, g] U2 → R T.
44 #h #g #G #L #U2 #R #IH1 #IH2 #T #H @(star_ind_l … T H) -T //
48 (* Basic properties *********************************************************)
50 lemma sstas_refl: ∀h,g,G,L. reflexive … (sstas h g G L).
53 lemma ssta_sstas: ∀h,g,G,L,T,U,l. ⦃G, L⦄ ⊢ T •[h, g] ⦃l+1, U⦄ → ⦃G, L⦄ ⊢ T •*[h, g] U.
54 /3 width=2 by R_to_star, ex_intro/ qed. (**) (* auto fails without trace *)
56 lemma sstas_strap1: ∀h,g,G,L,T1,T2,U2,l. ⦃G, L⦄ ⊢ T1 •*[h, g] T2 → ⦃G, L⦄ ⊢ T2 •[h, g] ⦃l+1, U2⦄ →
57 ⦃G, L⦄ ⊢ T1 •*[h, g] U2.
58 /3 width=4 by sstep, ex_intro/ (**) (* auto fails without trace *)
61 lemma sstas_strap2: ∀h,g,G,L,T1,U1,U2,l. ⦃G, L⦄ ⊢ T1 •[h, g] ⦃l+1, U1⦄ → ⦃G, L⦄ ⊢ U1 •*[h, g] U2 →
62 ⦃G, L⦄ ⊢ T1 •*[h, g] U2.
63 /3 width=3 by star_compl, ex_intro/ (**) (* auto fails without trace *)
66 (* Basic inversion lemmas ***************************************************)
68 lemma sstas_inv_bind1: ∀h,g,a,I,G,L,Y,X,U. ⦃G, L⦄ ⊢ ⓑ{a,I}Y.X •*[h, g] U →
69 ∃∃Z. ⦃G, L.ⓑ{I}Y⦄ ⊢ X •*[h, g] Z & U = ⓑ{a,I}Y.Z.
70 #h #g #a #I #G #L #Y #X #U #H @(sstas_ind … H) -U /2 width=3/
71 #T #U #l #_ #HTU * #Z #HXZ #H destruct
72 elim (ssta_inv_bind1 … HTU) -HTU #Z0 #HZ0 #H destruct /3 width=4/
75 lemma sstas_inv_appl1: ∀h,g,G,L,Y,X,U. ⦃G, L⦄ ⊢ ⓐY.X •*[h, g] U →
76 ∃∃Z. ⦃G, L⦄ ⊢ X •*[h, g] Z & U = ⓐY.Z.
77 #h #g #G #L #Y #X #U #H @(sstas_ind … H) -U /2 width=3/
78 #T #U #l #_ #HTU * #Z #HXZ #H destruct
79 elim (ssta_inv_appl1 … HTU) -HTU #Z0 #HZ0 #H destruct /3 width=4/