]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda_delta/basic_2/reducibility/tpr_tpss.ma
2b36d101879a0b7e99a52b6e7a63bd05cf4a4b92
[helm.git] / matita / matita / contribs / lambda_delta / basic_2 / reducibility / tpr_tpss.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_ltpss.ma".
16 include "basic_2/reducibility/ltpr_ldrop.ma".
17
18 (* CONTEXT-FREE PARALLEL REDUCTION ON TERMS *********************************)
19
20 (* Unfold properties ********************************************************)
21
22 (* Basic_1: was: pr0_subst1 *)
23 lemma tpr_tps_ltpr: ∀T1,T2. T1 ➡ T2 →
24                     ∀L1,d,e,U1. L1 ⊢ T1 [d, e] ▶ U1 →
25                     ∀L2. L1 ➡ L2 →
26                     ∃∃U2. U1 ➡ U2 & L2 ⊢ T2 [d, e] ▶* U2.
27 #T1 #T2 #H elim H -T1 -T2
28 [ #I #L1 #d #e #X #H
29   elim (tps_inv_atom1 … H) -H
30   [ #H destruct /2 width=3/
31   | * #K1 #V1 #i #Hdi #Hide #HLK1 #HVU1 #H #L2 #HL12 destruct
32     elim (ltpr_ldrop_conf … HLK1 … HL12) -L1 #X #HLK2 #H
33     elim (ltpr_inv_pair1 … H) -H #K2 #V2 #_ #HV12 #H destruct
34     elim (lift_total V2 0 (i+1)) #U2 #HVU2
35     lapply (tpr_lift … HV12 … HVU1 … HVU2) -V1 #HU12
36     @ex2_1_intro [2: @HU12 | skip | /3 width=4/ ] (**) (* /4 width=6/ is too slow *)
37   ]
38 | #I #V1 #V2 #T1 #T2 #_ #_ #IHV12 #IHT12 #L1 #d #e #X #H #L2 #HL12
39   elim (tps_inv_flat1 … H) -H #W1 #U1 #HVW1 #HTU1 #H destruct
40   elim (IHV12 … HVW1 … HL12) -V1
41   elim (IHT12 … HTU1 … HL12) -T1 -HL12 /3 width=5/
42 | #V1 #V2 #W #T1 #T2 #_ #_ #IHV12 #IHT12 #L1 #d #e #X #H #L2 #HL12
43   elim (tps_inv_flat1 … H) -H #VV1 #Y #HVV1 #HY #HX destruct
44   elim (tps_inv_bind1 … HY) -HY #WW #TT1 #_ #HTT1 #H destruct
45   elim (IHV12 … HVV1 … HL12) -V1 #VV2 #HVV12 #HVV2
46   elim (IHT12 … HTT1 (L2. ⓛWW) ?) -T1 /2 width=1/ -HL12 #TT2 #HTT12 #HTT2
47   lapply (tpss_lsubs_conf … HTT2 (L2. ⓓVV2) ?) -HTT2 /3 width=5/
48 | #I #V1 #V2 #T1 #T2 #U2 #HV12 #_ #HTU2 #IHV12 #IHT12 #L1 #d #e #X #H #L2 #HL12
49   elim (tps_inv_bind1 … H) -H #VV1 #TT1 #HVV1 #HTT1 #H destruct
50   elim (IHV12 … HVV1 … HL12) -V1 #VV2 #HVV12 #HVV2
51   elim (IHT12 … HTT1 (L2. ⓑ{I} VV2) ?) -T1 /2 width=1/ -HL12 #TT2 #HTT12 #HTT2
52   elim (tpss_strip_neq … HTT2 … HTU2 ?) -T2 /2 width=1/ #T2 #HTT2 #HUT2
53   lapply (tps_lsubs_conf … HTT2 (L2. ⓑ{I} V2) ?) -HTT2 /2 width=1/ #HTT2
54   elim (ltpss_tps_conf … HTT2 (L2. ⓑ{I} VV2) (d + 1) e ?) -HTT2 /2 width=1/ #W2 #HTTW2 #HTW2
55   lapply (tpss_lsubs_conf … HTTW2 (⋆. ⓑ{I} VV2) ?) -HTTW2 /2 width=1/ #HTTW2
56   lapply (tpss_tps … HTTW2) -HTTW2 #HTTW2
57   lapply (tpss_lsubs_conf … HTW2 (L2. ⓑ{I} VV2) ?) -HTW2 /2 width=1/ #HTW2
58   lapply (tpss_trans_eq … HUT2 … HTW2) -T2 /3 width=5/
59 | #V #V1 #V2 #W1 #W2 #T1 #T2 #_ #HV2 #_ #_ #IHV12 #IHW12 #IHT12 #L1 #d #e #X #H #L2 #HL12
60   elim (tps_inv_flat1 … H) -H #VV1 #Y #HVV1 #HY #HX destruct
61   elim (tps_inv_bind1 … HY) -HY #WW1 #TT1 #HWW1 #HTT1 #H destruct
62   elim (IHV12 … HVV1 … HL12) -V1 #VV2 #HVV12 #HVV2
63   elim (IHW12 … HWW1 … HL12) -W1 #WW2 #HWW12 #HWW2
64   elim (IHT12 … HTT1 (L2. ⓓWW2) ?) -T1 /2 width=1/ -HL12 #TT2 #HTT12 #HTT2
65   elim (lift_total VV2 0 1) #VV #H2VV
66   lapply (tpss_lift_ge … HVV2 (L2. ⓓWW2) … HV2 … H2VV) -V2 /2 width=1/ #HVV
67   @ex2_1_intro [2: @tpr_theta |1: skip |3: @tpss_bind [2: @tpss_flat ] ] /width=11/ (**) (* /4 width=11/ is too slow *)
68 | #V1 #TT1 #T1 #T2 #HTT1 #_ #IHT12 #L1 #d #e #X #H #L2 #HL12
69   elim (tps_inv_bind1 … H) -H #V2 #TT2 #HV12 #HTT12 #H destruct
70   elim (tps_inv_lift1_ge … HTT12 L1 … HTT1 ?) -TT1 /2 width=1/ #T2 #HT12 #HTT2
71   elim (IHT12 … HT12 … HL12) -T1 -HL12 <minus_plus_m_m /3 width=3/
72 | #V1 #T1 #T2 #_ #IHT12 #L1 #d #e #X #H #L2 #HL12
73   elim (tps_inv_flat1 … H) -H #VV1 #TT1 #HVV1 #HTT1 #H destruct
74   elim (IHT12 … HTT1 … HL12) -T1 -HL12 /3 width=3/
75 ]
76 qed.
77
78 lemma tpr_tps_bind: ∀I,V1,V2,T1,T2,U1. V1 ➡ V2 → T1 ➡ T2 →
79                     ⋆. ⓑ{I} V1 ⊢ T1 [0, 1] ▶ U1 →
80                     ∃∃U2. U1 ➡ U2 & ⋆. ⓑ{I} V2 ⊢ T2 [0, 1] ▶ U2.
81 #I #V1 #V2 #T1 #T2 #U1 #HV12 #HT12 #HTU1
82 elim (tpr_tps_ltpr … HT12 … HTU1 (⋆. ⓑ{I} V2) ?) -T1 /2 width=1/ /3 width=3/
83 qed.
84
85 lemma tpr_tpss_ltpr: ∀L1,L2. L1 ➡ L2 → ∀T1,T2. T1 ➡ T2 →
86                      ∀d,e,U1. L1 ⊢ T1 [d, e] ▶* U1 →
87                      ∃∃U2. U1 ➡ U2 & L2 ⊢ T2 [d, e] ▶* U2.
88 #L1 #L2 #HL12 #T1 #T2 #HT12 #d #e #U1 #HTU1 @(tpss_ind … HTU1) -U1
89 [ /2 width=3/
90 | -HT12 #U #U1 #_ #HU1 * #T #HUT #HT2
91   elim (tpr_tps_ltpr … HUT … HU1 … HL12) -U -HL12 #U2 #HU12 #HTU2
92   lapply (tpss_trans_eq … HT2 … HTU2) -T /2 width=3/
93 ]
94 qed.