interpretation "parallel unfold (local environment)"
'PSubstStar L1 d e L2 = (ltpss d e L1 L2).
-(* Basic properties *********************************************************)
-
-lemma ltpss_tps2: ∀L1,L2,I,V1,V2,e.
- L1 ▶* [0, e] L2 → L2 ⊢ V1 ▶ [0, e] V2 →
- L1. ⓑ{I} V1 ▶* [0, e + 1] L2. ⓑ{I} V2.
-/3 width=1/ qed.
-
-lemma ltpss_tps1: ∀L1,L2,I,V1,V2,d,e.
- L1 ▶* [d, e] L2 → L2 ⊢ V1 ▶ [d, e] V2 →
- L1. ⓑ{I} V1 ▶* [d + 1, e] L2. ⓑ{I} V2.
-/3 width=1/ qed.
-
-lemma ltpss_tpss2_lt: ∀L1,L2,I,V1,V2,e.
- L1 ▶* [0, e - 1] L2 → L2 ⊢ V1 ▶* [0, e - 1] V2 →
- 0 < e → L1. ⓑ{I} V1 ▶* [0, e] L2. ⓑ{I} V2.
-#L1 #L2 #I #V1 #V2 #e #HL12 #HV12 #He
->(plus_minus_m_m e 1) /2 width=1/
-qed.
-
-lemma ltpss_tpss1_lt: ∀L1,L2,I,V1,V2,d,e.
- L1 ▶* [d - 1, e] L2 → L2 ⊢ V1 ▶* [d - 1, e] V2 →
- 0 < d → L1. ⓑ{I} V1 ▶* [d, e] L2. ⓑ{I} V2.
-#L1 #L2 #I #V1 #V2 #d #e #HL12 #HV12 #Hd
->(plus_minus_m_m d 1) /2 width=1/
-qed.
-
-lemma ltpss_tps2_lt: ∀L1,L2,I,V1,V2,e.
- L1 ▶* [0, e - 1] L2 → L2 ⊢ V1 ▶ [0, e - 1] V2 →
- 0 < e → L1. ⓑ{I} V1 ▶* [0, e] L2. ⓑ{I} V2.
-/3 width=1/ qed.
-
-lemma ltpss_tps1_lt: ∀L1,L2,I,V1,V2,d,e.
- L1 ▶* [d - 1, e] L2 → L2 ⊢ V1 ▶ [d - 1, e] V2 →
- 0 < d → L1. ⓑ{I} V1 ▶* [d, e] L2. ⓑ{I} V2.
-/3 width=1/ qed.
-
-(* Basic_1: was by definition: csubst1_refl *)
-lemma ltpss_refl: ∀L,d,e. L ▶* [d, e] L.
-#L elim L -L //
-#L #I #V #IHL * /2 width=1/ * /2 width=1/
-qed.
-
-lemma ltpss_weak: ∀L1,L2,d1,e1. L1 ▶* [d1, e1] L2 →
- ∀d2,e2. d2 ≤ d1 → d1 + e1 ≤ d2 + e2 → L1 ▶* [d2, e2] L2.
-#L1 #L2 #d1 #e1 #H elim H -L1 -L2 -d1 -e1 //
-[ #L1 #L2 #I #V1 #V2 #e1 #_ #HV12 #IHL12 #d2 #e2 #Hd2 #Hde2
- lapply (le_n_O_to_eq … Hd2) #H destruct normalize in Hde2;
- lapply (lt_to_le_to_lt 0 … Hde2) // #He2
- lapply (le_plus_to_minus_r … Hde2) -Hde2 /3 width=5/
-| #L1 #L2 #I #V1 #V2 #d1 #e1 #_ #HV12 #IHL12 #d2 #e2 #Hd21 #Hde12
- >plus_plus_comm_23 in Hde12; #Hde12
- elim (le_to_or_lt_eq 0 d2 ?) // #H destruct
- [ lapply (le_plus_to_minus_r … Hde12) -Hde12 <plus_minus // #Hde12
- lapply (le_plus_to_minus … Hd21) -Hd21 #Hd21 /3 width=5/
- | -Hd21 normalize in Hde12;
- lapply (lt_to_le_to_lt 0 … Hde12) // #He2
- lapply (le_plus_to_minus_r … Hde12) -Hde12 /3 width=5/
- ]
-]
-qed.
-
-lemma ltpss_weak_all: ∀L1,L2,d,e. L1 ▶* [d, e] L2 → L1 ▶* [0, |L2|] L2.
-#L1 #L2 #d #e #H elim H -L1 -L2 -d -e
-// /3 width=2/ /3 width=3/
-qed.
-
-(* Basic forward lemmas *****************************************************)
-
-lemma ltpss_fwd_length: ∀L1,L2,d,e. L1 ▶* [d, e] L2 → |L1| = |L2|.
-#L1 #L2 #d #e #H elim H -L1 -L2 -d -e
-normalize //
-qed-.
-
(* Basic inversion lemmas ***************************************************)
fact ltpss_inv_refl_O2_aux: ∀d,e,L1,L2. L1 ▶* [d, e] L2 → e = 0 → L1 = L2.
L1 = K1. ⓑ{I} V1.
/2 width=3/ qed-.
+(* Basic properties *********************************************************)
+
+lemma ltpss_tps2: ∀L1,L2,I,V1,V2,e.
+ L1 ▶* [0, e] L2 → L2 ⊢ V1 ▶ [0, e] V2 →
+ L1. ⓑ{I} V1 ▶* [0, e + 1] L2. ⓑ{I} V2.
+/3 width=1/ qed.
+
+lemma ltpss_tps1: ∀L1,L2,I,V1,V2,d,e.
+ L1 ▶* [d, e] L2 → L2 ⊢ V1 ▶ [d, e] V2 →
+ L1. ⓑ{I} V1 ▶* [d + 1, e] L2. ⓑ{I} V2.
+/3 width=1/ qed.
+
+lemma ltpss_tpss2_lt: ∀L1,L2,I,V1,V2,e.
+ L1 ▶* [0, e - 1] L2 → L2 ⊢ V1 ▶* [0, e - 1] V2 →
+ 0 < e → L1. ⓑ{I} V1 ▶* [0, e] L2. ⓑ{I} V2.
+#L1 #L2 #I #V1 #V2 #e #HL12 #HV12 #He
+>(plus_minus_m_m e 1) /2 width=1/
+qed.
+
+lemma ltpss_tpss1_lt: ∀L1,L2,I,V1,V2,d,e.
+ L1 ▶* [d - 1, e] L2 → L2 ⊢ V1 ▶* [d - 1, e] V2 →
+ 0 < d → L1. ⓑ{I} V1 ▶* [d, e] L2. ⓑ{I} V2.
+#L1 #L2 #I #V1 #V2 #d #e #HL12 #HV12 #Hd
+>(plus_minus_m_m d 1) /2 width=1/
+qed.
+
+lemma ltpss_tps2_lt: ∀L1,L2,I,V1,V2,e.
+ L1 ▶* [0, e - 1] L2 → L2 ⊢ V1 ▶ [0, e - 1] V2 →
+ 0 < e → L1. ⓑ{I} V1 ▶* [0, e] L2. ⓑ{I} V2.
+/3 width=1/ qed.
+
+lemma ltpss_tps1_lt: ∀L1,L2,I,V1,V2,d,e.
+ L1 ▶* [d - 1, e] L2 → L2 ⊢ V1 ▶ [d - 1, e] V2 →
+ 0 < d → L1. ⓑ{I} V1 ▶* [d, e] L2. ⓑ{I} V2.
+/3 width=1/ qed.
+
+(* Basic_1: was by definition: csubst1_refl *)
+lemma ltpss_refl: ∀L,d,e. L ▶* [d, e] L.
+#L elim L -L //
+#L #I #V #IHL * /2 width=1/ * /2 width=1/
+qed.
+
+lemma ltpss_weak: ∀L1,L2,d1,e1. L1 ▶* [d1, e1] L2 →
+ ∀d2,e2. d2 ≤ d1 → d1 + e1 ≤ d2 + e2 → L1 ▶* [d2, e2] L2.
+#L1 #L2 #d1 #e1 #H elim H -L1 -L2 -d1 -e1 //
+[ #L1 #L2 #I #V1 #V2 #e1 #_ #HV12 #IHL12 #d2 #e2 #Hd2 #Hde2
+ lapply (le_n_O_to_eq … Hd2) #H destruct normalize in Hde2;
+ lapply (lt_to_le_to_lt 0 … Hde2) // #He2
+ lapply (le_plus_to_minus_r … Hde2) -Hde2 /3 width=5/
+| #L1 #L2 #I #V1 #V2 #d1 #e1 #_ #HV12 #IHL12 #d2 #e2 #Hd21 #Hde12
+ >plus_plus_comm_23 in Hde12; #Hde12
+ elim (le_to_or_lt_eq 0 d2 ?) // #H destruct
+ [ lapply (le_plus_to_minus_r … Hde12) -Hde12 <plus_minus // #Hde12
+ lapply (le_plus_to_minus … Hd21) -Hd21 #Hd21 /3 width=5/
+ | -Hd21 normalize in Hde12;
+ lapply (lt_to_le_to_lt 0 … Hde12) // #He2
+ lapply (le_plus_to_minus_r … Hde12) -Hde12 /3 width=5/
+ ]
+]
+qed.
+
+lemma ltpss_weak_all: ∀L1,L2,d,e. L1 ▶* [d, e] L2 → L1 ▶* [0, |L2|] L2.
+#L1 #L2 #d #e #H elim H -L1 -L2 -d -e
+// /3 width=2/ /3 width=3/
+qed.
+
+fact ltpss_append_le_aux: ∀K1,K2,d,x. K1 ▶* [d, x] K2 → x = |K1| - d →
+ ∀L1,L2,e. L1 ▶* [0, e] L2 → d ≤ |K1| →
+ L1 @@ K1 ▶* [d, x + e] L2 @@ K2.
+#K1 #K2 #d #x #H elim H -K1 -K2 -d -x
+[ #d #x #H1 #L1 #L2 #e #HL12 #H2 destruct
+ lapply (le_n_O_to_eq … H2) -H2 #H destruct //
+| #K #I #V <minus_n_O normalize <plus_n_Sm #H destruct
+| #K1 #K2 #I #V1 #V2 #x #_ #HV12 <minus_n_O #IHK12 <minus_n_O #H #L1 #L2 #e #HL12 #_
+ lapply (injective_plus_l … H) -H #H destruct >plus_plus_comm_23
+ /4 width=5 by ltpss_tpss2, tpss_append, tpss_weak, monotonic_le_plus_r/ (**) (* too slow without trace *)
+| #K1 #K2 #I #V1 #V2 #d #x #_ #HV12 #IHK12 normalize <minus_le_minus_minus_comm // <minus_plus_m_m #H1 #L1 #L2 #e #HL12 #H2 destruct
+ lapply (le_plus_to_le_r … H2) -H2 #Hd
+ /4 width=5 by ltpss_tpss1, tpss_append, tpss_weak, monotonic_le_plus_r/ (**) (* too slow without trace *)
+]
+qed-.
+
+lemma ltpss_append_le: ∀K1,K2,d. K1 ▶* [d, |K1| - d] K2 →
+ ∀L1,L2,e. L1 ▶* [0, e] L2 → d ≤ |K1| →
+ L1 @@ K1 ▶* [d, |K1| - d + e] L2 @@ K2.
+/2 width=1 by ltpss_append_le_aux/ qed.
+
+lemma ltpss_append_ge: ∀K1,K2,d,e. K1 ▶* [d, e] K2 →
+ ∀L1,L2. L1 ▶* [d - |K1|, e] L2 → |K1| ≤ d →
+ L1 @@ K1 ▶* [d, e] L2 @@ K2.
+#K1 #K2 #d #e #H elim H -K1 -K2 -d -e
+[ #d #e #L1 #L2 <minus_n_O //
+| #K #I #V #L1 #L2 #_ #H
+ lapply (le_n_O_to_eq … H) -H normalize <plus_n_Sm #H destruct
+| #K1 #K2 #I #V1 #V2 #e #_ #_ #_ #L1 #L2 #_ #H
+ lapply (le_n_O_to_eq … H) -H normalize <plus_n_Sm #H destruct
+| #K1 #K2 #I #V1 #V2 #d #e #_ #HV12 #IHK12 #L1 #L2
+ normalize <minus_le_minus_minus_comm // <minus_plus_m_m #HL12 #H
+ lapply (le_plus_to_le_r … H) -H /3 width=1/
+]
+qed.
+
+(* Basic forward lemmas *****************************************************)
+
+lemma ltpss_fwd_length: ∀L1,L2,d,e. L1 ▶* [d, e] L2 → |L1| = |L2|.
+#L1 #L2 #d #e #H elim H -L1 -L2 -d -e
+normalize //
+qed-.
+(*
+lemma tps_fwd_shift1: ∀L1,L,T1,T,d,e. L ⊢ L1 @@ T1 ▶ [d, e] T →
+ ∃∃L2,T2. L @@ L1 ▶* [d + |L1|, e] L @@ L2 & T = L2 @@ T2.
+#L1 @(lenv_ind_dx … L1) -L1
+[ #L #T1 #T #d #e #_ @ex2_2_intro [3: // |4: // |1,2: skip ] (**) (* /2 width=4/ does not work *)
+| #I #L1 #V1 #IH #L #T1 #T #d #e >shift_append_assoc #H
+ elim (tps_inv_bind1 … H) -H #V2 #T2 #HV12 #HT12 #H destruct
+ elim (IH … HT12) -IH -T1 #L2 #T #HL12 #H destruct
+ <append_assoc >append_length <associative_plus
+ @(ex2_2_intro … (⋆.ⓑ{I}V2@@L2)) /2 width=4/ <append_assoc normalize
+ lapply (ltpss_tps1 L … I … HV12) -HV12 // #HV12
+ @ltpss_append_ge /2/
+(*
+
+
+ /3 width=5/
+*)
+]
+qed-.
+*)
+
(* Basic_1: removed theorems 28:
csubst0_clear_O csubst0_drop_lt csubst0_drop_gt csubst0_drop_eq
csubst0_clear_O_back csubst0_clear_S csubst0_clear_trans