1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "basic_2/unfold/tpss_tpss.ma".
16 include "basic_2/unfold/ltpss_dx_tpss.ma".
18 (* DX PARTIAL UNFOLD ON LOCAL ENVIRONMENTS **********************************)
20 (* Advanced properties ******************************************************)
22 lemma ltpss_dx_tpss_conf: ∀L0,T2,U2,d2,e2. L0 ⊢ T2 ▶* [d2, e2] U2 →
23 ∀L1,d1,e1. L0 ▶* [d1, e1] L1 →
24 ∃∃T. L1 ⊢ T2 ▶* [d2, e2] T &
25 L1 ⊢ U2 ▶* [d1, e1] T.
26 #L0 #T2 #U2 #d2 #e2 #H #L1 #d1 #e1 #HL01 @(tpss_ind … H) -U2 /2 width=3/
27 #U #U2 #_ #HU2 * #X2 #HTX2 #HUX2
28 elim (ltpss_dx_tps_conf … HU2 … HL01) -L0 #X1 #HUX1 #HU2X1
29 elim (tpss_strip_eq … HUX2 … HUX1) -U #X #HX2 #HX1
30 lapply (tpss_trans_eq … HU2X1 … HX1) -X1 /3 width=3/
33 lemma ltpss_dx_tpss_trans_down: ∀L0,L1,T2,U2,d1,e1,d2,e2. d2 + e2 ≤ d1 →
34 L1 ▶* [d1, e1] L0 → L0 ⊢ T2 ▶* [d2, e2] U2 →
35 ∃∃T. L1 ⊢ T2 ▶* [d2, e2] T & L0 ⊢ T ▶* [d1, e1] U2.
36 #L0 #L1 #T2 #U2 #d1 #e1 #d2 #e2 #Hde2d1 #HL10 #H @(tpss_ind … H) -U2
38 | #U #U2 #_ #HU2 * #T #HT2 #HTU
39 elim (tpss_strap1_down … HTU … HU2 ?) -U // #U #HTU #HU2
40 elim (ltpss_dx_tps_trans … HTU … HL10) -HTU -HL10 #X #HTX #HXU
41 lapply (tpss_trans_eq … HXU HU2) -U /3 width=3/
45 lemma ltpss_dx_tpss_trans_eq: ∀L1,T2,U2,d,e. L1 ⊢ T2 ▶* [d, e] U2 →
46 ∀L0. L0 ▶* [d, e] L1 → L0 ⊢ T2 ▶* [d, e] U2.
47 #L1 #T2 @(f2_ind … fw … L1 T2) -L1 -T2 #n #IH #L1 *
48 [ #I #Hn #W2 #d #e #H #L0 #HL01 destruct
49 elim (tpss_inv_atom1 … H) -H // *
50 #K1 #V1 #V2 #i #Hdi #Hide #HLK1 #HV12 #HVW2 #H destruct
51 lapply (ldrop_fwd_lw … HLK1) #H1 normalize in H1;
52 elim (ltpss_dx_ldrop_trans_be … HL01 … HLK1 ? ?) -HL01 -HLK1 // /2 width=2/ #X #H #HLK0
53 elim (ltpss_dx_inv_tpss22 … H ?) -H /2 width=1/ #K0 #V0 #HK01 #HV01 #H destruct
54 lapply (tpss_fwd_tw … HV01) #H2
55 lapply (transitive_le (♯{K1} + ♯{V0}) … H1) -H1 /2 width=1/ -H2 #H
56 lapply (tpss_trans_eq … HV01 HV12) -V1 #HV02
57 lapply (IH … HV02 … HK01) -IH -HV02 -HK01
58 [ normalize /2 width=1/ | /2 width=6/ ]
59 | * [ #a ] #I #V2 #T2 #Hn #X #d #e #H #L0 #HL0 destruct
60 [ elim (tpss_inv_bind1 … H) -H #W2 #U2 #HVW2 #HTU2 #H destruct
61 lapply (tpss_lsubr_trans … HTU2 (L1. ⓑ{I} V2) ?) -HTU2 /2 width=1/ #HTU2
62 lapply (IH … HVW2 … HL0) -HVW2 [ /2 width=2/ ] #HVW2
63 lapply (IH … HTU2 (L0. ⓑ{I} V2) ?) -IH -HTU2 // /2 width=2/ -HL0 #HTU2
64 lapply (tpss_lsubr_trans … HTU2 (L0. ⓑ{I} W2) ?) -HTU2 /2 width=1/
65 | elim (tpss_inv_flat1 … H) -H #W2 #U2 #HVW2 #HTU2 #H destruct
66 lapply (IH … HVW2 … HL0) -HVW2 //
67 lapply (IH … HTU2 … HL0) -IH -HTU2 // -HL0 /2 width=1/
71 lemma ltpss_dx_tps_trans_eq: ∀L0,L1,T2,U2,d,e. L0 ▶* [d, e] L1 →
72 L1 ⊢ T2 ▶ [d, e] U2 → L0 ⊢ T2 ▶* [d, e] U2.
75 (* Main properties **********************************************************)
77 theorem ltpss_dx_conf: ∀L0,L1,d1,e1. L0 ▶* [d1, e1] L1 →
78 ∀L2,d2,e2. L0 ▶* [d2, e2] L2 →
79 ∃∃L. L1 ▶* [d2, e2] L & L2 ▶* [d1, e1] L.
80 #L0 @(f_ind … lw … L0) -L0 #n #IH *
81 [ #_ #L1 #d1 #e1 #H1 #L2 #d2 #e2 #H2 -n
82 >(ltpss_dx_inv_atom1 … H1) -L1
83 >(ltpss_dx_inv_atom1 … H2) -L2 /2 width=3/
84 | #K0 #I0 #V0 #Hn #L1 #d1 #e1 #H1 #L2 #d2 #e2 #H2 destruct
85 elim (eq_or_gt d1) #Hd1 [ elim (eq_or_gt e1) #He1 ] destruct
86 [ lapply (ltpss_dx_inv_refl_O2 … H1) -H1 #H1
87 | elim (ltpss_dx_inv_tpss21 … H1 … He1) -H1 #K1 #V1 #HK01 #HV01 #H1
88 | elim (ltpss_dx_inv_tpss11 … H1 … Hd1) -H1 #K1 #V1 #HK01 #HV01 #H1
90 elim (eq_or_gt d2) #Hd2 [1,3,5: elim (eq_or_gt e2) #He2 ] destruct
91 [1,3,5: lapply (ltpss_dx_inv_refl_O2 … H2) -H2 #H2
92 |2,4,6: elim (ltpss_dx_inv_tpss21 … H2 … He2) -H2 #K2 #V2 #HK02 #HV02 #H2
93 |7,8,9: elim (ltpss_dx_inv_tpss11 … H2 … Hd2) -H2 #K2 #V2 #HK02 #HV02 #H2
96 |2,3,4,7: -IH /3 width=5/
98 elim (IH … HK01 … HK02) // -K0 #K #HK1 #HK2
99 elim (ltpss_dx_tpss_conf … HV01 … HK1) -HV01 #W1 #HW1 #HVW1
100 elim (ltpss_dx_tpss_conf … HV02 … HK2) -HV02 #W2 #HW2 #HVW2
101 elim (tpss_conf_eq … HW1 … HW2) -V0 #V #HW1 #HW2
102 lapply (tpss_trans_eq … HVW1 HW1) -W1
103 lapply (tpss_trans_eq … HVW2 HW2) -W2 /3 width=5/