]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/etc/fpr/cfpr_cpr.etc
- extended multiple substitutions now uses bounds in ynat (ie. they
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / etc / fpr / cfpr_cpr.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/reducibility/cpr_tpss.ma".
16 include "basic_2/reducibility/cpr_cpr.ma".
17 include "basic_2/reducibility/cfpr_ltpss.ma".
18
19 (* CONTEXT-SENSITIVE PARALLEL REDUCTION ON CLOSURES *************************)
20
21 (* Advanced properties ******************************************************)
22
23 lemma fpr_all: ∀L1,L. L1 ➡ L → ∀L2,T1,T2. L ⊢ T1 ➡ T2 →
24                L ⊢ ▶* [0, |L|] L2 → ⦃L1, T1⦄ ➡ ⦃L2, T2⦄.
25 #L1 #L #H elim H -L1 -L
26 [ #L2 #T1 #T2 #HT12 #HL2
27   lapply (ltpss_sn_inv_atom1 … HL2) -HL2 #H destruct
28   lapply (cpr_inv_atom … HT12) -HT12 /2 width=1/
29 | #I #L1 #L #V1 #V #_ #HV1 #IH #X #T1 #T2 #HT12 #H
30   elim (ltpss_sn_inv_tpss21 … H ?) -H // <minus_plus_m_m #L2 #V2 #HL2 #HV2 #H destruct
31   lapply (cpr_bind_dx false … HV1 HT12) -HV1 -HT12 #HT12
32   lapply (cpr_tpss_trans … HT12 (-ⓑ{I}V2.T2) 0 (|L|) ?) -HT12 /2 width=1/ -HV2 /3 width=1/
33 ]
34 qed.
35
36 (* Advanced inversion lemmas ************************************************)
37
38 lemma cfpr_inv_all: ∀L1,L2,L0,T1,T2. L0 ⊢ ⦃L1, T1⦄ ➡ ⦃L2, T2⦄ →
39                     ∃∃L. L0 @@ L1 ➡ L0 @@ L & L0 @@ L ⊢ T1 ➡ T2 &
40                          L0 @@ L ⊢ ▶* [0, |L0| + |L|] L0 @@ L2.
41 #L1 @(lenv_ind_dx … L1) -L1
42 [ #L2 #L0 #T1 #T2 #H
43   elim (cfpr_inv_atom1 … H) -H #HT12 #H destruct /3 width=4/
44 | #I #L1 #V1 #IH #X #L0 #T1 #T2 #H
45   elim (cfpr_inv_pair1 … H) -H #L2 #V #V2 #HV1 #HV2 #HT12 #H destruct
46   elim (IH … HT12) -IH -HT12 #L #HL1 #HT12 #HL2
47   elim (ltpr_inv_append1 … HL1) -HL1 #X #Y #HX #HY #H
48   lapply (ltpr_fwd_length … HX) -HX #HX
49   elim (append_inj_dx … H ?) -H // -HX #_ #H destruct -X
50   lapply (ltpss_sn_fwd_length … HL2) >append_length >append_length #H
51   lapply (injective_plus_r … H) -H #H
52   @(ex3_intro … (⋆.ⓑ{I}V@@Y)) <append_assoc // -HT12
53   <append_assoc [ /3 width=1/ ] -HV1 -HY
54   >append_length <associative_plus
55   @(ltpss_sn_dx_trans_eq … HL2) -HL2 >H -H >commutative_plus /3 width=1/
56 ]
57 qed-.
58
59 lemma fpr_inv_all: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ➡ ⦃L2, T2⦄ →
60                    ∃∃L. L1 ➡ L & L ⊢ T1 ➡ T2 & L ⊢ ▶* [0, |L|] L2.
61 #L1 #L2 #T1 #T2 #H
62 lapply (fpr_cfpr … H) -H #H
63 elim (cfpr_inv_all … H) -H /2 width=4/
64 qed-.