]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/dynamic/cnv_preserve.ma
297a86498220e60fbcbf38df9caecd7f8bbe5337
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / dynamic / cnv_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/dynamic/cnv_cpms_conf.ma".
16
17 (* CONTEXT-SENSITIVE NATIVE VALIDITY FOR TERMS ******************************)
18
19 (* Main preservation properties *********************************************)
20
21 (* Basic_2A1: uses: snv_preserve *)
22 lemma cnv_preserve (a) (h): ∀G,L,T. ⦃G,L⦄ ⊢ T ![a,h] →
23                             ∧∧ IH_cnv_cpms_conf_lpr a h G L T
24                              & IH_cnv_cpm_trans_lpr a h G L T.
25 #a #h #G #L #T #HT
26 lapply (cnv_fwd_fsb … HT) -HT #H
27 @(fsb_ind_fpbg … H) -G -L -T #G #L #T #_ #IH
28 @conj [ letin aux ≝ cnv_cpms_conf_lpr_aux | letin aux ≝ cnv_cpm_trans_lpr_aux ]
29 @(aux … G L T) // #G0 #L0 #T0 #H
30 elim (IH … H) -IH -H //
31 qed-.
32
33 theorem cnv_cpms_conf_lpr (a) (h) (G) (L) (T): IH_cnv_cpms_conf_lpr a h G L T.
34 #a #h #G #L #T #HT elim (cnv_preserve … HT) /2 width=1 by/
35 qed-.
36
37 (* Basic_2A1: uses: snv_cpr_lpr *)
38 theorem cnv_cpm_trans_lpr (a) (h) (G) (L) (T): IH_cnv_cpm_trans_lpr a h G L T.
39 #a #h #G #L #T #HT elim (cnv_preserve … HT) /2 width=2 by/
40 qed-.
41
42 (* Advanced preservation properties *****************************************)
43
44 lemma cnv_cpms_conf (a) (h) (G) (L):
45       ∀T0. ⦃G,L⦄ ⊢ T0 ![a,h] →
46       ∀n1,T1. ⦃G,L⦄ ⊢ T0 ➡*[n1,h] T1 → ∀n2,T2. ⦃G,L⦄ ⊢ T0 ➡*[n2,h] T2 →
47       ∃∃T. ⦃G,L⦄ ⊢ T1 ➡*[n2-n1,h] T & ⦃G,L⦄ ⊢ T2 ➡*[n1-n2,h] T.
48 /2 width=8 by cnv_cpms_conf_lpr/ qed-.
49
50 (* Basic_2A1: uses: snv_cprs_lpr *)
51 lemma cnv_cpms_trans_lpr (a) (h) (G) (L) (T): IH_cnv_cpms_trans_lpr a h G L T.
52 #a #h #G #L1 #T1 #HT1 #n #T2 #H
53 @(cpms_ind_dx … H) -n -T2 /3 width=6 by cnv_cpm_trans_lpr/
54 qed-.
55
56 lemma cnv_cpm_trans (a) (h) (G) (L):
57       ∀T1. ⦃G,L⦄ ⊢ T1 ![a,h] →
58       ∀n,T2. ⦃G,L⦄ ⊢ T1 ➡[n,h] T2 → ⦃G,L⦄ ⊢ T2 ![a,h].
59 /2 width=6 by cnv_cpm_trans_lpr/ qed-.
60
61 (* Note: this is the preservation property *)
62 lemma cnv_cpms_trans (a) (h) (G) (L):
63       ∀T1. ⦃G,L⦄ ⊢ T1 ![a,h] →
64       ∀n,T2. ⦃G,L⦄ ⊢ T1 ➡*[n,h] T2 → ⦃G,L⦄ ⊢ T2 ![a,h].
65 /2 width=6 by cnv_cpms_trans_lpr/ qed-.
66
67 lemma cnv_lpr_trans (a) (h) (G):
68       ∀L1,T. ⦃G,L1⦄ ⊢ T ![a,h] → ∀L2. ⦃G,L1⦄ ⊢ ➡[h] L2 → ⦃G,L2⦄ ⊢ T ![a,h].
69 /2 width=6 by cnv_cpm_trans_lpr/ qed-.
70
71 lemma cnv_lprs_trans (a) (h) (G):
72       ∀L1,T. ⦃G,L1⦄ ⊢ T ![a,h] → ∀L2. ⦃G,L1⦄ ⊢ ➡*[h] L2 → ⦃G,L2⦄ ⊢ T ![a,h].
73 #a #h #G #L1 #T #HT #L2 #H
74 @(lprs_ind_dx … H) -L2 /2 width=3 by cnv_lpr_trans/
75 qed-.
76
77 (* Advanced inversion lemmas ************************************************)
78
79 lemma cnv_inv_appl_SO (a) (h) (G) (L):
80       ∀V,T. ⦃G, L⦄ ⊢ ⓐV.T ![a, h] →
81       ∃∃n,p,W0,U0. a = Ⓣ → n = 1 & ⦃G, L⦄ ⊢ V ![a, h] & ⦃G, L⦄ ⊢ T ![a, h] &
82                    ⦃G, L⦄ ⊢ V ➡*[1, h] W0 & ⦃G, L⦄ ⊢ T ➡*[n, h] ⓛ{p}W0.U0.
83 * #h #G #L #V #T #H
84 elim (cnv_inv_appl … H) -H [ * [| #n ] | #n ] #p #W #U #Ha #HV #HT #HVW #HTU
85 [ elim (cnv_fwd_cpm_SO … (ⓛ{p}W.U))
86   [|*: /2 width=8 by cnv_cpms_trans/ ] #X #HU0
87   elim (cpm_inv_abst1 … HU0) #W0 #U0 #HW0 #_ #H0 destruct
88   lapply (cpms_step_dx … HVW … HW0) -HVW -HW0 #HVW0
89   lapply (cpms_step_dx … HTU … HU0) -HTU -HU0 #HTU0
90   /2 width=7 by ex5_4_intro/
91 | lapply (Ha ?) -Ha [ // ] #Ha
92   lapply (le_n_O_to_eq n ?) [ /3 width=1 by le_S_S_to_le/ ] -Ha #H destruct
93   /2 width=7 by ex5_4_intro/
94 | @(ex5_4_intro … HV HT HVW HTU) #H destruct
95 ]
96 qed-.