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