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/static/da_da.ma".
16 include "basic_2/unfold/lstas_lstas.ma".
18 (* NAT-ITERATED STATIC TYPE ASSIGNMENT FOR TERMS ****************************)
20 (* Properties on degree assignment for terms ********************************)
22 lemma da_lstas: ∀h,o,G,L,T,d1. ⦃G, L⦄ ⊢ T ▪[h, o] d1 → ∀d2.
23 ∃∃U. ⦃G, L⦄ ⊢ T •*[h, d2] U & ⦃G, L⦄ ⊢ U ▪[h, o] d1-d2.
24 #h #o #G #L #T #d1 #H elim H -G -L -T -d1
25 [ /4 width=3 by da_sort, deg_iter, ex2_intro/
26 | #G #L #K #V #i #d1 #HLK #_ #IHV #d2
28 elim (lift_total W 0 (i+1))
29 lapply (drop_fwd_drop2 … HLK)
30 /3 width=10 by lstas_ldef, da_lift, ex2_intro/
31 | #G #L #K #W #i #d1 #HLK #HW #IHW #d2 @(nat_ind_plus … d2) -d2
32 [ elim (IHW 0) -IHW /3 width=6 by lstas_zero, da_ldec, ex2_intro/
33 | #d #_ elim (IHW d) -IHW #V
34 elim (lift_total V 0 (i+1))
35 lapply (drop_fwd_drop2 … HLK)
36 /3 width=10 by lstas_succ, da_lift, ex2_intro/
38 | #a #I #G #L #V #T #d1 #_ #IHT #d2 elim (IHT … d2) -IHT
39 /3 width=6 by lstas_bind, da_bind, ex2_intro/
40 | * #G #L #V #T #d1 #_ #IHT #d2 elim (IHT … d2) -IHT
41 /3 width=5 by lstas_appl, lstas_cast, da_flat, ex2_intro/
45 lemma lstas_da_conf: ∀h,o,G,L,T,U,d2. ⦃G, L⦄ ⊢ T •*[h, d2] U →
46 ∀d1. ⦃G, L⦄ ⊢ T ▪[h, o] d1 → ⦃G, L⦄ ⊢ U ▪[h, o] d1-d2.
47 #h #o #G #L #T #U #d2 #HTU #d1 #HT
48 elim (da_lstas … HT d2) -HT #X #HTX
49 lapply (lstas_mono … HTX … HTU) -T //
52 (* inversion lemmas on degree assignment for terms **************************)
54 lemma lstas_inv_da: ∀h,o,G,L,T,U,d2. ⦃G, L⦄ ⊢ T •*[h, d2] U →
55 ∃∃d1. ⦃G, L⦄ ⊢ T ▪[h, o] d1 & ⦃G, L⦄ ⊢ U ▪[h, o] d1-d2.
56 #h #o #G #L #T #U #d2 #H elim H -G -L -T -U -d2
57 [ #G #L #d2 #s elim (deg_total h o s) /4 width=3 by da_sort, deg_iter, ex2_intro/
58 | #G #L #K #V #W #U #i #d2 #HLK #_ #HWU *
59 lapply (drop_fwd_drop2 … HLK) /3 width=10 by da_lift, da_ldef, ex2_intro/
60 | #G #L #K #W #V #i #HLK #_ * /3 width=6 by da_ldec, ex2_intro/
61 | #G #L #K #W #V #U #i #d2 #HLK #_ #HVU *
62 lapply (drop_fwd_drop2 … HLK) /3 width=10 by da_lift, da_ldec, ex2_intro/
63 | #a #I #G #L #V #T #U #d2 #_ * /3 width=3 by da_bind, ex2_intro/
64 | #G #L #V #T #U #d2 #_ * /3 width=3 by da_flat, ex2_intro/
65 | #G #L #W #T #U #d2 #_ * /3 width=3 by da_flat, ex2_intro/
69 lemma lstas_inv_da_ge: ∀h,G,L,T,U,d2,d. ⦃G, L⦄ ⊢ T •*[h, d2] U →
70 ∃∃o,d1. ⦃G, L⦄ ⊢ T ▪[h, o] d1 & ⦃G, L⦄ ⊢ U ▪[h, o] d1-d2 & d ≤ d1.
71 #h #G #L #T #U #d2 #d #H elim H -G -L -T -U -d2
72 [ /4 width=5 by da_sort, deg_iter, ex3_2_intro/
73 | #G #L #K #V #W #U #i #d2 #HLK #_ #HWU *
74 lapply (drop_fwd_drop2 … HLK) /3 width=10 by da_lift, da_ldef, ex3_2_intro/
75 | #G #L #K #W #V #i #HLK #_ *
76 #o #d1 #HW #HV #Hd1 /4 width=6 by da_ldec, lt_to_le, le_S_S, ex3_2_intro/
77 | #G #L #K #W #V #U #i #d2 #HLK #_ #HVU *
78 lapply (drop_fwd_drop2 … HLK)
79 /4 width=10 by da_lift, da_ldec, lt_to_le, le_S_S, ex3_2_intro/
80 | #a #I #G #L #V #T #U #d2 #_ * /3 width=5 by da_bind, ex3_2_intro/
81 | #G #L #V #T #U #d2 #_ * /3 width=5 by da_flat, ex3_2_intro/
82 | #G #L #W #T #U #d2 #_ * /3 width=5 by da_flat, ex3_2_intro/
86 (* Advanced inversion lemmas ************************************************)
88 lemma lstas_inv_refl_pos: ∀h,G,L,T,d. ⦃G, L⦄ ⊢ T •*[h, d+1] T → ⊥.
89 #h #G #L #T #d2 #H elim (lstas_inv_da_ge … (d2+1) H) -H
90 #o #d1 #HT1 #HT12 #Hd21 lapply (da_mono … HT1 … HT12) -h -G -L -T
91 #H elim (discr_x_minus_xy … H) -H
92 [ #H destruct /2 width=3 by le_plus_xSy_O_false/
93 | -d1 <plus_n_Sm #H destruct