]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/static/ssta_ssta.ma
partial commit: just the components before "static" ...
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / static / ssta_ssta.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
17 (* STRATIFIED STATIC TYPE ASSIGNMENT ON TERMS *******************************)
18
19 (* Main properties **********************************************************)
20
21 (* Note: apparently this was missing in basic_1 *)
22 theorem ssta_mono: ∀h,g,L,T,U1,l1. ⦃G, L⦄ ⊢ T •[h, g] ⦃l1, U1⦄ →
23                    ∀U2,l2. ⦃G, L⦄ ⊢ T •[h, g] ⦃l2, U2⦄ → l1 = l2 ∧ U1 = U2.
24 #h #g #L #T #U1 #l1 #H elim H -L -T -U1 -l1
25 [ #L #k #l #Hkl #X #l2 #H
26   elim (ssta_inv_sort1 … H) -H #Hkl2 #H destruct
27   >(deg_mono … Hkl2 … Hkl) -g -L -l2 /2 width=1/
28 | #L #K #V #W #U1 #i #l1 #HLK #_ #HWU1 #IHVW #U2 #l2 #H
29   elim (ssta_inv_lref1 … H) -H * #K0 #V0 #W0 [2: #l0] #HLK0 #HVW0 #HW0U2
30   lapply (ldrop_mono … HLK0 … HLK) -HLK -HLK0 #H destruct
31   lapply (IHVW … HVW0) -IHVW -HVW0 * #H1 #H2 destruct
32   >(lift_mono … HWU1 … HW0U2) -W0 -U1 /2 width=1/
33 | #L #K #W #V #U1 #i #l1 #HLK #_ #HWU1 #IHWV #U2 #l2 #H
34   elim (ssta_inv_lref1 … H) -H * #K0 #W0 #V0 [2: #l0 ] #HLK0 #HWV0 #HV0U2
35   lapply (ldrop_mono … HLK0 … HLK) -HLK -HLK0 #H destruct
36   lapply (IHWV … HWV0) -IHWV -HWV0 * #H1 #H2 destruct
37   >(lift_mono … HWU1 … HV0U2) -W -U1 /2 width=1/
38 | #a #I #L #V #T #U1 #l1 #_ #IHTU1 #X #l2 #H
39   elim (ssta_inv_bind1 … H) -H #U2 #HTU2 #H destruct
40   elim (IHTU1 … HTU2) -T /3 width=1/
41 | #L #V #T #U1 #l1 #_ #IHTU1 #X #l2 #H
42   elim (ssta_inv_appl1 … H) -H #U2 #HTU2 #H destruct
43   elim (IHTU1 … HTU2) -T /3 width=1/
44 | #L #W1 #T #U1 #l1 #_ #IHTU1 #U2 #l2 #H
45   lapply (ssta_inv_cast1 … H) -H #HTU2
46   elim (IHTU1 … HTU2) -T /2 width=1/
47 ]
48 qed-.
49
50 (* Advanced inversion lemmas ************************************************)
51
52 lemma ssta_inv_refl_pos: ∀h,g,L,T,l. ⦃G, L⦄ ⊢ T •[h, g] ⦃l+1, T⦄ → ⊥.
53 #h #g #L #T #l #HTT
54 elim (ssta_fwd_correct … HTT) <minus_plus_m_m #U #HTU
55 elim (ssta_mono … HTU … HTT) -h -L #H #_ -T -U
56 elim (plus_xySz_x_false 0 l 0 ?) //
57 qed-.