]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/dynamic/nta_preserve_cpcs.ma
update in ground_2, static_2, basic_2, apps_2, alpha_1
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / dynamic / nta_preserve_cpcs.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/dynamic/nta_cpcs.ma".
16 include "basic_2/dynamic/nta_preserve.ma".
17
18 (* NATIVE TYPE ASSIGNMENT FOR TERMS ****************************************)
19
20 (* Properties based on type equivalence and preservation *******************)
21
22 (* Basic_1: uses: ty3_tred *)
23 lemma nta_cprs_trans (h) (a) (G) (L):
24       ∀T,U1. ❪G,L❫ ⊢ T :[h,a] U1 → ∀U2. ❪G,L❫ ⊢ U1 ➡*[h] U2 → ❪G,L❫ ⊢ T :[h,a] U2.
25 #h #a #G #L #T #U1 #H #U2 #HU12
26 /4 width=4 by nta_conv_cnv, nta_fwd_cnv_dx, cnv_cpms_trans, cpcs_cprs_dx/
27 qed-.
28
29 (* Basic_1: uses: ty3_sred_back *)
30 lemma cprs_nta_trans (h) (a) (G) (L):
31       ∀T1,U0. ❪G,L❫ ⊢ T1 :[h,a] U0 → ∀T2. ❪G,L❫ ⊢ T1 ➡*[h] T2 →
32       ∀U. ❪G,L❫ ⊢ T2 :[h,a] U →  ❪G,L❫ ⊢ T1 :[h,a] U.
33 #h #a #G #L #T1 #U0 #HT1 #T2 #HT12 #U #H
34 lapply (nta_cprs_conf … HT1 … HT12) -HT12 #HT2
35 /4 width=6 by nta_mono, nta_conv_cnv, nta_fwd_cnv_dx/
36 qed-.
37
38 lemma cprs_nta_trans_cnv (h) (a) (G) (L):
39       ∀T1. ❪G,L❫ ⊢ T1 ![h,a] → ∀T2. ❪G,L❫ ⊢ T1 ➡*[h] T2 →
40       ∀U. ❪G,L❫ ⊢ T2 :[h,a] U → ❪G,L❫ ⊢ T1 :[h,a] U.
41 #h #a #G #L #T1 #HT1 #T2 #HT12 #U #H
42 elim (cnv_nta_sn … HT1) -HT1 #U0 #HT1
43 /2 width=3 by cprs_nta_trans/
44 qed-.
45
46 (* Basic_1: uses: ty3_sconv *)
47 lemma nta_cpcs_conf (h) (a) (G) (L):
48       ∀T1,U. ❪G,L❫ ⊢ T1 :[h,a] U → ∀T2. ❪G,L❫ ⊢ T1 ⬌*[h] T2 →
49       ∀U0. ❪G,L❫ ⊢ T2 :[h,a] U0 → ❪G,L❫ ⊢ T2 :[h,a] U.
50 #h #a #G #L #T1 #U #HT1 #T2 #HT12 #U0 #HT2
51 elim (cpcs_inv_cprs … HT12) -HT12 #T0 #HT10 #HT02
52 /3 width=5 by  cprs_nta_trans, nta_cprs_conf/
53 qed-.
54
55 (* Note: type preservation by valid r-equivalence *)
56 lemma nta_cpcs_conf_cnv (h) (a) (G) (L):
57       ∀T1,U. ❪G,L❫ ⊢ T1 :[h,a] U →
58       ∀T2. ❪G,L❫ ⊢ T1 ⬌*[h] T2 → ❪G,L❫ ⊢ T2 ![h,a] → ❪G,L❫ ⊢ T2 :[h,a] U.
59 #h #a #G #L #T1 #U #HT1 #T2 #HT12 #HT2
60 elim (cnv_nta_sn … HT2) -HT2 #U0 #HT2
61 /2 width=3 by nta_cpcs_conf/
62 qed-.