]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/i_dynamic/ntas_preserve.ma
53f02c04e9df382e9fcdde788c32d7bdcc7992c7
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / i_dynamic / ntas_preserve.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/rt_equivalence/cpcs_cprs.ma".
16 include "basic_2/dynamic/cnv_preserve.ma".
17 include "basic_2/i_dynamic/ntas.ma".
18
19 (* ITERATED NATIVE TYPE ASSIGNMENT FOR TERMS ********************************)
20
21 (* Properties based on preservation *****************************************)
22
23 lemma cnv_cpms_ntas (h) (a) (G) (L):
24       ∀T. ⦃G,L⦄ ⊢ T ![h,a] → ∀n,U.⦃G,L⦄ ⊢ T ➡*[n,h] U → ⦃G,L⦄ ⊢ T :*[h,a,n] U.
25 /3 width=4 by ntas_intro, cnv_cpms_trans/ qed.
26
27 (* Inversion lemmas based on preservation ***********************************)
28
29 lemma ntas_inv_plus (h) (a) (n1) (n2) (G) (L):
30       ∀T1,T2. ⦃G,L⦄ ⊢ T1 :*[h,a,n1+n2] T2 →
31       ∃∃T0. ⦃G,L⦄ ⊢ T1 :*[h,a,n1] T0 & ⦃G,L⦄ ⊢ T0 :*[h,a,n2] T2.
32 #h #a #n1 #n2 #G #L #T1 #T2 * #X0 #HT2 #HT1 #H20 #H10
33 elim (cpms_inv_plus … H10) -H10 #T0 #H10 #H00
34 lapply (cnv_cpms_trans … HT1 … H10) #HT0
35 /3 width=6 by cnv_cpms_ntas, ntas_intro, ex2_intro/
36 qed-.
37
38 lemma ntas_inv_appl_sn (h) (a) (m) (G) (L) (V) (T):
39       ∀X. ⦃G,L⦄ ⊢ ⓐV.T :*[h,a,m] X →
40       ∨∨ ∃∃n,p,W,U,U0. n ≤ m & ad a n & ⦃G,L⦄ ⊢ V :*[h,a,1] W & ⦃G,L⦄ ⊢ T :*[h,a,n] ⓛ{p}W.U0 & ⦃G,L.ⓛW⦄ ⊢ U0 :*[h,a,m-n] U & ⦃G,L⦄ ⊢ ⓐV.ⓛ{p}W.U ⬌*[h] X & ⦃G,L⦄ ⊢ X ![h,a]
41        | ∃∃n,p,W,U,U0. m ≤ n & ad a n & ⦃G,L⦄ ⊢ V :*[h,a,1] W & ⦃G,L⦄ ⊢ T :*[h,a,m] U & ⦃G,L⦄ ⊢ U :*[h,a,n-m] ⓛ{p}W.U0 & ⦃G,L⦄ ⊢ ⓐV.U ⬌*[h] X & ⦃G,L⦄ ⊢ X ![h,a].
42 #h #a #m #G #L #V #T #X
43 * #X0 #HX #HVT #HX0 #HTX0
44 elim (cnv_inv_appl … HVT) #n #p #W #U0 #Ha #HV #HT #HVW #HTU0
45 elim (le_or_ge n m) #Hnm
46 [ elim (cnv_fwd_cpms_abst_dx_le … HT … HTU0 … Hnm) #U #H #HU0
47   lapply (cpms_appl_dx … V V … H) [ // ] -H #H
48   elim (cnv_cpms_conf … HVT … HTX0 … H) -HVT -HTX0 -H <minus_n_n #X1 #HX01 #HUX1
49   lapply (cpms_trans … HX0 … HX01) -X0 #HX1
50   lapply (cprs_div … HUX1 … HX1) -X1 #HUX
51   lapply (cnv_cpms_trans … HT … HTU0) #H
52   elim (cnv_inv_bind … H) -H #_ #HU0
53   /4 width=11 by cnv_cpms_ntas, ex7_5_intro, or_introl/
54 | >(plus_minus_m_m_commutative … Hnm) in HTU0; #H
55   elim (cpms_inv_plus … H) -H #U #HTU #HU0
56   lapply (cpms_appl_dx … V V … HTU) [ // ] #H
57   elim (cnv_cpms_conf … HVT … HTX0 … H) -HVT -HTX0 -H <minus_n_n #X1 #HX01 #HUX1
58   lapply (cpms_trans … HX0 … HX01) -X0 #HX1
59   lapply (cprs_div … HUX1 … HX1) -X1 #HUX
60   /5 width=11 by cnv_cpms_ntas, cnv_cpms_trans, ex7_5_intro, or_intror/
61 ]
62 qed-.