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