]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/unfold/lsstas_lift.ma
- degree assignment, static type assignment, iterated static type
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / unfold / lsstas_lift.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/static/ssta_lift.ma".
16 include "basic_2/unfold/lsstas.ma".
17
18 (* NAT-ITERATED STRATIFIED STATIC TYPE ASSIGNMENT FOR TERMS *****************)
19
20 (* Properties on relocation *************************************************)
21
22 lemma lsstas_lift: ∀h,g,G,l. l_liftable (llstar … (ssta h g G) l).
23 /2 width=1/ qed.
24
25 (* Inversion lemmas on relocation *******************************************)
26
27 lemma lsstas_inv_lift1: ∀h,g,G,l. l_deliftable_sn (llstar … (ssta h g G) l).
28 /3 width=5 by l_deliftable_sn_llstar, ssta_inv_lift1/ qed-.
29
30 (* Advanced inversion lemmas ************************************************)
31
32 lemma lsstas_inv_lref1: ∀h,g,G,L,U,i,l. ⦃G, L⦄ ⊢ #i •*[h, g, l+1] U →
33                         (∃∃K,V,W. ⇩[0, i] L ≡ K.ⓓV & ⦃G, K⦄ ⊢ V •*[h, g, l+1] W &
34                                   ⇧[0, i + 1] W ≡ U
35                         ) ∨
36                         (∃∃K,W,V,l0. ⇩[0, i] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W ▪[h, g] l0 &
37                                      ⦃G, K⦄ ⊢ W •*[h, g, l] V & ⇧[0, i + 1] V ≡ U
38                         ).
39 #h #g #G #L #U #i #l #H elim (lsstas_inv_step_sn … H) -H
40 #X #H #HXU elim (ssta_inv_lref1 … H) -H
41 * #K [ #V #W | #W #l0 ] #HLK [ #HVW | #HWl0 ] #HWX
42 lapply (ldrop_fwd_ldrop2 … HLK) #H0LK
43 elim (lsstas_inv_lift1 … HXU … H0LK … HWX) -H0LK -X /3 width=8/ /4 width=6/
44 qed-.
45
46 (* Advanced forward lemmas **************************************************)
47
48 lemma lsstas_fwd_correct: ∀h,g,G,L,T1,U1. ⦃G, L⦄ ⊢ T1 •[h, g] U1 →
49                           ∀T2,l. ⦃G, L⦄ ⊢ T1 •*[h, g, l] T2 →
50                           ∃U2. ⦃G, L⦄ ⊢ T2 •[h, g] U2.
51 #h #g #G #L #T1 #U1 #HTU1 #T2 #l #H @(lsstas_ind_dx … H) -l -T2 [ /2 width=3/ ] -HTU1
52 #l #T #T2 #_ #HT2 #_ -T1 -U1 -l
53 elim (ssta_fwd_correct … HT2) -T /2 width=2/
54 qed-.
55
56 (* Advanced properties ******************************************************)
57
58 lemma lsstas_total: ∀h,g,G,L,T,U. ⦃G, L⦄ ⊢ T •[h, g] U →
59                     ∀l. ∃U0. ⦃G, L⦄ ⊢ T •*[h, g, l] U0.
60 #h #g #G #L #T #U #HTU #l @(nat_ind_plus … l) -l [ /2 width=2/ ]
61 #l * #U0 #HTU0
62 elim (lsstas_fwd_correct … HTU … HTU0) -U /3 width=4/
63 qed-.
64
65 lemma lsstas_ldef: ∀h,g,G,L,K,V,i. ⇩[0, i] L ≡ K.ⓓV →
66                    ∀W,l. ⦃G, K⦄ ⊢ V •*[h, g, l+1] W →
67                    ∀U. ⇧[0, i+1] W ≡ U → ⦃G, L⦄ ⊢ #i •*[h, g, l+1] U.
68 #h #g #G #L #K #V #i #HLK #W #l #HVW #U #HWU
69 lapply (ldrop_fwd_ldrop2 … HLK)
70 elim (lsstas_inv_step_sn … HVW) -HVW #W0
71 elim (lift_total W0 0 (i+1)) /3 width=11/
72 qed.
73
74 lemma lsstas_ldec: ∀h,g,G,L,K,W,i. ⇩[0, i] L ≡ K.ⓛW → ∀l0. ⦃G, K⦄ ⊢ W ▪[h, g] l0 →
75                    ∀V,l. ⦃G, K⦄ ⊢ W •*[h, g, l] V →
76                    ∀U. ⇧[0, i+1] V ≡ U → ⦃G, L⦄ ⊢ #i •*[h, g, l+1] U.
77 #h #g #G #L #K #W #i #HLK #T #HWT #V #l #HWV #U #HVU
78 lapply (ldrop_fwd_ldrop2 … HLK) #H
79 elim (lift_total W 0 (i+1)) /3 width=11/
80 qed.
81
82 (* Properties on degree assignment for terms ********************************)
83
84 lemma lsstas_da_conf: ∀h,g,G,L,T,U,l1. ⦃G, L⦄ ⊢ T •*[h, g, l1] U →
85                       ∀l2. ⦃G, L⦄ ⊢ T ▪[h, g] l2 → ⦃G, L⦄ ⊢ U ▪[h, g] l2-l1.
86 #h #g #G #L #T #U #l1 #H @(lsstas_ind_dx … H) -U -l1 //
87 #l1 #U #U0 #_ #HU0 #IHTU #l2 #HT
88 <minus_plus /3 width=3 by ssta_da_conf/
89 qed-.