--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "delayed_updating/notation/functions/uparrow_4.ma".
+include "delayed_updating/notation/functions/uparrow_2.ma".
+include "delayed_updating/syntax/path.ma".
+include "ground/relocation/tr_uni.ma".
+include "ground/relocation/tr_pap_tls.ma".
+
+(* LIFT FOR PATH ***********************************************************)
+
+definition lift_continuation (A:Type[0]) ≝
+ tr_map → path → A.
+
+rec definition lift_gen (A:Type[0]) (k:lift_continuation A) (f) (p) on p ≝
+match p with
+[ list_empty ⇒ k f (𝐞)
+| list_lcons l q ⇒
+ match l with
+ [ label_d n ⇒ lift_gen (A) (λg,p. k g (𝗱(f@❨n❩)◗p)) (⇂*[n]f) q
+ | label_m ⇒ lift_gen (A) (λg,p. k g (𝗺◗p)) f q
+ | label_L ⇒ lift_gen (A) (λg,p. k g (𝗟◗p)) (⫯f) q
+ | label_A ⇒ lift_gen (A) (λg,p. k g (𝗔◗p)) f q
+ | label_S ⇒ lift_gen (A) (λg,p. k g (𝗦◗p)) f q
+ ]
+].
+
+interpretation
+ "lift (gneric)"
+ 'UpArrow A k f p = (lift_gen A k f p).
+
+definition proj_path: lift_continuation … ≝
+ λf,p.p.
+
+definition proj_rmap: lift_continuation … ≝
+ λf,p.f.
+
+interpretation
+ "lift (path)"
+ 'UpArrow f p = (lift_gen ? proj_path f p).
+
+interpretation
+ "lift (relocation map)"
+ 'UpArrow p f = (lift_gen ? proj_rmap f p).
+
+(* Basic constructions ******************************************************)
+
+lemma lift_empty (A) (k) (f):
+ k f (𝐞) = ↑{A}❨k, f, 𝐞❩.
+// qed.
+
+lemma lift_d_sn (A) (k) (p) (n) (f):
+ ↑❨(λg,p. k g (𝗱(f@❨n❩)◗p)), ⇂*[n]f, p❩ = ↑{A}❨k, f, 𝗱n◗p❩.
+// qed.
+
+lemma lift_m_sn (A) (k) (p) (f):
+ ↑❨(λg,p. k g (𝗺◗p)), f, p❩ = ↑{A}❨k, f, 𝗺◗p❩.
+// qed.
+
+lemma lift_L_sn (A) (k) (p) (f):
+ ↑❨(λg,p. k g (𝗟◗p)), ⫯f, p❩ = ↑{A}❨k, f, 𝗟◗p❩.
+// qed.
+
+lemma lift_A_sn (A) (k) (p) (f):
+ ↑❨(λg,p. k g (𝗔◗p)), f, p❩ = ↑{A}❨k, f, 𝗔◗p❩.
+// qed.
+
+lemma lift_S_sn (A) (k) (p) (f):
+ ↑❨(λg,p. k g (𝗦◗p)), f, p❩ = ↑{A}❨k, f, 𝗦◗p❩.
+// qed.
+
+(* Basic constructions with proj_path ***************************************)
+
+lemma lift_path_empty (f):
+ (𝐞) = ↑[f]𝐞.
+// qed.
+
+(* Basic constructions with proj_rmap ***************************************)
+
+lemma lift_rmap_empty (f):
+ f = ↑[𝐞]f.
+// qed.
+
+lemma lift_rmap_d_sn (f) (p) (n):
+ ↑[p](⇂*[ninj n]f) = ↑[𝗱n◗p]f.
+// qed.
+
+lemma lift_rmap_m_sn (f) (p):
+ ↑[p]f = ↑[𝗺◗p]f.
+// qed.
+
+lemma lift_rmap_L_sn (f) (p):
+ ↑[p](⫯f) = ↑[𝗟◗p]f.
+// qed.
+
+lemma lift_rmap_A_sn (f) (p):
+ ↑[p]f = ↑[𝗔◗p]f.
+// qed.
+
+lemma lift_rmap_S_sn (f) (p):
+ ↑[p]f = ↑[𝗦◗p]f.
+// qed.
+
+(* Advanced constructions with proj_rmap and path_append ********************)
+
+lemma lift_rmap_append (p2) (p1) (f):
+ ↑[p2]↑[p1]f = ↑[p1●p2]f.
+#p2 #p1 elim p1 -p1 // * [ #n ] #p1 #IH #f //
+[ <lift_rmap_m_sn <lift_rmap_m_sn //
+| <lift_rmap_A_sn <lift_rmap_A_sn //
+| <lift_rmap_S_sn <lift_rmap_S_sn //
+]
+qed.
+
+(* Advanced constructions with proj_rmap and path_rcons *********************)
+
+lemma lift_rmap_d_dx (f) (p) (n):
+ ⇂*[ninj n](↑[p]f) = ↑[p◖𝗱n]f.
+// qed.
+
+lemma lift_rmap_m_dx (f) (p):
+ ↑[p]f = ↑[p◖𝗺]f.
+// qed.
+
+lemma lift_rmap_L_dx (f) (p):
+ (⫯↑[p]f) = ↑[p◖𝗟]f.
+// qed.
+
+lemma lift_rmap_A_dx (f) (p):
+ ↑[p]f = ↑[p◖𝗔]f.
+// qed.
+
+lemma lift_rmap_S_dx (f) (p):
+ ↑[p]f = ↑[p◖𝗦]f.
+// qed.
+
+lemma lift_rmap_pap_d_dx (f) (p) (n) (m):
+ ↑[p]f@❨m+n❩ = ↑[p◖𝗱n]f@❨m❩+↑[p]f@❨n❩.
+// qed.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "delayed_updating/substitution/lift_eq.ma".
+include "ground/relocation/tr_compose_pap.ma".
+include "ground/relocation/tr_compose_pn.ma".
+include "ground/relocation/tr_compose_tls.ma".
+
+(* LIFT FOR PATH ***********************************************************)
+
+(* Constructions with tr_after *********************************************)
+
+lemma lift_path_after (p) (f1) (f2):
+ ↑[f2]↑[f1]p = ↑[f2∘f1]p.
+#p elim p -p [| * ] // [ #n ] #p #IH #f1 #f2
+[ <lift_path_d_sn <lift_path_d_sn <lift_path_d_sn //
+| <lift_path_L_sn <lift_path_L_sn <lift_path_L_sn
+ >tr_compose_push_bi //
+]
+qed.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "delayed_updating/substitution/lift_prototerm_id.ma".
+include "delayed_updating/substitution/lift_uni.ma".
+include "delayed_updating/syntax/prototerm_constructors.ma".
+
+(* LIFT FOR PROTOTERM *******************************************************)
+
+lemma lift_iref_bi (t1) (t2) (n):
+ t1 ⇔ t2 → 𝛗n.t1 ⇔ 𝛗n.t2.
+/2 width=1 by subset_equivalence_ext_f1_bi/
+qed.
+
+lemma lift_iref_sn (f) (t:prototerm) (n:pnat):
+ (𝛗f@❨n❩.↑[⇂*[n]f]t) ⊆ ↑[f](𝛗n.t).
+#f #t #n #p * #q * #r #Hr #H1 #H2 destruct
+@(ex2_intro … (𝗱n◗𝗺◗r))
+/2 width=1 by in_comp_iref/
+qed-.
+
+lemma lift_iref_dx (f) (t) (n:pnat):
+ ↑[f](𝛗n.t) ⊆ 𝛗f@❨n❩.↑[⇂*[n]f]t.
+#f #t #n #p * #q #Hq #H0 destruct
+elim (in_comp_inv_iref … Hq) -Hq #p #H0 #Hp destruct
+/3 width=1 by in_comp_iref, in_comp_lift_bi/
+qed-.
+
+lemma lift_iref (f) (t) (n:pnat):
+ (𝛗f@❨n❩.↑[⇂*[n]f]t) ⇔ ↑[f](𝛗n.t).
+/3 width=1 by conj, lift_iref_sn, lift_iref_dx/
+qed.
+
+lemma lift_iref_uni (t) (m) (n):
+ (𝛗(n+m).t) ⇔ ↑[𝐮❨m❩](𝛗n.t).
+#t #m #n
+@(subset_eq_trans … (lift_iref …))
+<tr_uni_pap >nsucc_pnpred <tr_tls_succ_uni
+/3 width=1 by lift_iref_bi, lift_term_id/
+qed.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "delayed_updating/substitution/lift.ma".
+(*
+include "ground/relocation/tr_uni_compose.ma".
+include "ground/relocation/tr_compose_compose.ma".
+include "ground/relocation/tr_compose_eq.ma".
+*)
+include "ground/relocation/tr_pap_eq.ma".
+include "ground/relocation/tr_pn_eq.ma".
+include "ground/lib/stream_tls_eq.ma".
+
+(* LIFT FOR PATH ***********************************************************)
+
+definition lift_exteq (A): relation2 (lift_continuation A) (lift_continuation A) ≝
+ λk1,k2. ∀f1,f2,p. f1 ≗ f2 → k1 f1 p = k2 f2 p.
+
+interpretation
+ "extensional equivalence (lift continuation)"
+ 'RingEq A k1 k2 = (lift_exteq A k1 k2).
+
+(* Constructions with lift_exteq ********************************************)
+
+lemma lift_eq_repl (A) (p) (k1) (k2):
+ k1 ≗{A} k2 → stream_eq_repl … (λf1,f2. ↑❨k1, f1, p❩ = ↑❨k2, f2, p❩).
+#A #p elim p -p [| * [ #n ] #q #IH ]
+#k1 #k2 #Hk #f1 #f2 #Hf
+[ <lift_empty <lift_empty /2 width=1 by/
+| <lift_d_sn <lift_d_sn <(tr_pap_eq_repl … Hf)
+ /3 width=3 by stream_tls_eq_repl, compose_repl_fwd_sn/
+| /3 width=1 by/
+| /3 width=1 by tr_push_eq_repl/
+| /3 width=1 by/
+| /3 width=1 by/
+]
+qed-.
+
+(* Advanced constructions ***************************************************)
+
+lemma lift_lcons_alt (A) (k) (f) (p) (l): k ≗ k →
+ ↑❨λg,p2. k g (l◗p2), f, p❩ = ↑{A}❨λg,p2. k g ((l◗𝐞)●p2), f, p❩.
+#A #k #f #p #l #Hk
+@lift_eq_repl // #g1 #g2 #p2 #Hg @Hk -Hk // (**) (* auto fail *)
+qed.
+
+lemma lift_append_rcons_sn (A) (k) (f) (p1) (p) (l): k ≗ k →
+ ↑❨λg,p2. k g (p1●l◗p2), f, p❩ = ↑{A}❨λg,p2. k g (p1◖l●p2), f, p❩.
+#A #k #f #p1 #p #l #Hk
+@lift_eq_repl // #g1 #g2 #p2 #Hg
+<list_append_rcons_sn @Hk -Hk // (**) (* auto fail *)
+qed.
+
+(* Advanced constructions with proj_path ************************************)
+
+lemma proj_path_proper:
+ proj_path ≗ proj_path.
+// qed.
+
+lemma lift_path_eq_repl (p):
+ stream_eq_repl … (λf1,f2. ↑[f1]p = ↑[f2]p).
+/2 width=1 by lift_eq_repl/ qed.
+
+lemma lift_path_append_sn (p) (f) (q):
+ q●↑[f]p = ↑❨(λg,p. proj_path g (q●p)), f, p❩.
+#p elim p -p // * [ #n ] #p #IH #f #q
+[ <lift_d_sn <lift_d_sn
+| <lift_m_sn <lift_m_sn
+| <lift_L_sn <lift_L_sn
+| <lift_A_sn <lift_A_sn
+| <lift_S_sn <lift_S_sn
+]
+>lift_lcons_alt // >lift_append_rcons_sn //
+<IH <IH -IH <list_append_rcons_sn //
+qed.
+
+lemma lift_path_lcons (f) (p) (l):
+ l◗↑[f]p = ↑❨(λg,p. proj_path g (l◗p)), f, p❩.
+#f #p #l
+>lift_lcons_alt <lift_path_append_sn //
+qed.
+
+lemma lift_path_d_sn (f) (p) (n):
+ (𝗱(f@❨n❩)◗↑[⇂*[n]f]p) = ↑[f](𝗱n◗p).
+// qed.
+
+lemma lift_path_m_sn (f) (p):
+ (𝗺◗↑[f]p) = ↑[f](𝗺◗p).
+// qed.
+
+lemma lift_path_L_sn (f) (p):
+ (𝗟◗↑[⫯f]p) = ↑[f](𝗟◗p).
+// qed.
+
+lemma lift_path_A_sn (f) (p):
+ (𝗔◗↑[f]p) = ↑[f](𝗔◗p).
+// qed.
+
+lemma lift_path_S_sn (f) (p):
+ (𝗦◗↑[f]p) = ↑[f](𝗦◗p).
+// qed.
+(* COMMENT
+
+(* Advanced constructions with proj_rmap and stream_tls *********************)
+
+lemma lift_rmap_tls_d_dx (f) (p) (m) (n):
+ ⇂*[m+n]↑[p]f ≗ ⇂*[m]↑[p◖𝗱n]f.
+#f #p #m #n
+<lift_rmap_d_dx >nrplus_inj_dx
+/2 width=1 by tr_tls_compose_uni_dx/
+qed.
+*)
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "delayed_updating/substitution/lift_eq.ma".
+include "ground/relocation/tr_id_pap.ma".
+include "ground/relocation/tr_id_tls.ma".
+
+(* LIFT FOR PATH ***********************************************************)
+
+(* Constructions with tr_id ************************************************)
+
+lemma lift_path_id (p):
+ p = ↑[𝐢]p.
+#p elim p -p //
+* [ #n ] #p #IH //
+[ <lift_path_d_sn //
+| <lift_path_L_sn //
+]
+qed.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "delayed_updating/substitution/lift.ma".
+include "delayed_updating/syntax/prototerm.ma".
+include "ground/lib/subset_ext.ma".
+
+(* LIFT FOR PROTOTERM *******************************************************)
+
+interpretation
+ "lift (prototerm)"
+ 'UpArrow f t = (subset_ext_f1 ? ? (lift_gen ? proj_path f) t).
+
+(* Basic constructions ******************************************************)
+
+lemma in_comp_lift_bi (f) (p) (t):
+ p ϵ t → ↑[f]p ϵ ↑[f]t.
+/2 width=1 by subset_in_ext_f1_dx/
+qed.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "ground/lib/subset_ext_equivalence.ma".
+include "delayed_updating/substitution/lift_after.ma".
+include "delayed_updating/substitution/lift_prototerm.ma".
+
+(* LIFT FOR PROTOTERM *******************************************************)
+
+(* Constructions with subset_equivalence ************************************)
+
+lemma lift_term_eq_repl_sn (f1) (f2) (t):
+ f1 ≗ f2 → ↑[f1]t ⇔ ↑[f2]t.
+/3 width=1 by subset_equivalence_ext_f1_exteq, lift_path_eq_repl/
+qed.
+
+lemma lift_term_eq_repl_dx (f) (t1) (t2):
+ t1 ⇔ t2 → ↑[f]t1 ⇔ ↑[f]t2.
+/2 width=1 by subset_equivalence_ext_f1_bi/
+qed.
+
+lemma lift_term_after (f1) (f2) (t):
+ ↑[f2]↑[f1]t ⇔ ↑[f2∘f1]t.
+#f1 #f2 #t @subset_eq_trans
+[
+| @subset_inclusion_ext_f1_compose
+| @subset_equivalence_ext_f1_exteq /2 width=5/
+]
+qed.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "delayed_updating/substitution/lift_prototerm_eq.ma".
+include "delayed_updating/substitution/lift_id.ma".
+
+lemma lift_term_id_sn (t):
+ t ⊆ ↑[𝐢]t.
+#t #p #Hp
+>(lift_path_id p)
+/2 width=1 by in_comp_lift_bi/
+qed-.
+
+lemma lift_term_id_dx (t):
+ ↑[𝐢]t ⊆ t.
+#t #p * #q #Hq #H destruct //
+qed-.
+
+lemma lift_term_id (t):
+ t ⇔ ↑[𝐢]t.
+/3 width=2 by lift_term_id_dx, lift_term_id_sn, conj/
+qed.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "delayed_updating/substitution/lift_id.ma".
+include "ground/relocation/tr_uni_pap.ma".
+include "ground/relocation/tr_uni_tls.ma".
+
+(* LIFT FOR PATH ***********************************************************)
+
+(* Constructions with tr_uni ***********************************************)
+
+lemma lift_path_d_sn_uni (p) (m) (n):
+ (𝗱(n+m)◗p) = ↑[𝐮❨m❩](𝗱(n)◗p).
+#p #m #n
+<lift_path_d_sn <tr_uni_pap >nsucc_pnpred
+<tr_tls_succ_uni //
+qed.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "delayed_updating/unwind1/unwind.ma".
+include "delayed_updating/substitution/fsubst.ma".
+include "delayed_updating/syntax/prototerm_constructors.ma".
+include "delayed_updating/syntax/prototerm_equivalence.ma".
+include "delayed_updating/syntax/path_structure.ma".
+include "delayed_updating/syntax/path_balanced.ma".
+include "delayed_updating/syntax/path_depth.ma".
+include "delayed_updating/notation/relations/black_rightarrow_df_4.ma".
+include "ground/xoa/ex_1_2.ma".
+include "ground/xoa/and_4.ma".
+
+(* DELAYED FOCUSED REDUCTION ************************************************)
+
+definition dfr (p) (q): relation2 prototerm prototerm ≝
+ λt1,t2. ∃∃b,n.
+ let r ≝ p●𝗔◗b●𝗟◗q in
+ ∧∧ (⊗b ϵ 𝐁 ∧ 𝟎 = ❘b❘) & ↑❘q❘ = (▼[r]𝐢)@❨n❩ & r◖𝗱n ϵ t1 &
+ t1[⋔r←𝛗(n+❘b❘).(t1⋔(p◖𝗦))] ⇔ t2
+.
+
+interpretation
+ "focused balanced reduction with delayed updating (prototerm)"
+ 'BlackRightArrowDF t1 p q t2 = (dfr p q t1 t2).
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "delayed_updating/reduction/dfr.ma".
+include "delayed_updating/reduction/ifr.ma".
+include "delayed_updating/unwind1/unwind_fsubst.ma".
+include "delayed_updating/unwind1/unwind_constructors.ma".
+include "delayed_updating/unwind1/unwind_preterm_eq.ma".
+include "delayed_updating/unwind1/unwind_structure_depth.ma".
+include "delayed_updating/unwind1/unwind_depth.ma".
+include "delayed_updating/substitution/fsubst_eq.ma".
+include "delayed_updating/substitution/lift_prototerm_eq.ma".
+include "delayed_updating/syntax/prototerm_proper_constructors.ma".
+include "delayed_updating/syntax/path_structure_depth.ma".
+include "ground/relocation/tr_uni_compose.ma".
+include "ground/relocation/tr_pap_pushs.ma".
+
+(* DELAYED FOCUSED REDUCTION ************************************************)
+
+(* COMMENT
+axiom pippo (b) (q) (n):
+ ↑❘q❘ = (↑[q]𝐢)@❨n❩ →
+ ↑❘q❘+❘b❘= (↑[b●𝗟◗q]𝐢)@❨n+❘b❘❩.
+
+lemma unwind_rmap_tls_eq_id (p) (n):
+ ❘p❘ = ↑[p]𝐢@❨n❩ →
+ (𝐢) ≗ ⇂*[n]↑[p]𝐢.
+#p @(list_ind_rcons … p) -p
+[ #n <depth_empty #H destruct
+| #p * [ #m ] #IH #n
+ [ <depth_d_dx <unwind_rmap_pap_d_dx #H0
+ @(stream_eq_trans … (unwind_rmap_tls_d_dx …))
+ @(stream_eq_trans … (IH …)) -IH //
+ | /2 width=1 by/
+ | <depth_L_dx <unwind_rmap_L_dx
+ cases n -n [| #n ] #H0
+ [
+ |
+ ]
+ | /2 width=1 by/
+ | /2 width=1 by/
+ ]
+]
+
+
+(* (↑❘q❘+❘b❘=↑[b●𝗟◗q]𝐢@❨n+❘b❘❩ *)
+(* [↑[p]𝐢@❨n❩]⫯*[❘p❘]f∘⇂*[n]↑[p]𝐢) *)
+lemma unwind_rmap_tls_eq (f) (p) (n):
+ ❘p❘ = ↑[p]𝐢@❨n❩ →
+ f ≗ ⇂*[n]↑[p]f.
+#f #p #n #Hp
+@(stream_eq_canc_dx … (stream_tls_eq_repl …))
+[| @unwind_rmap_decompose | skip ]
+<tr_compose_tls <Hp
+
+@(stream_eq_canc_dx) … (unwind_rmap_decompose …))
+
+*)
+lemma dfr_unwind_id_bi (p) (q) (t1) (t2): t1 ϵ 𝐓 →
+ t1 ➡𝐝𝐟[p,q] t2 → ▼[𝐢]t1 ➡𝐟[⊗p,⊗q] ▼[𝐢]t2.
+#p #q #t1 #t2 #H0t1
+* #b #n * #Hb #Hn #Ht1 #Ht2
+@(ex1_2_intro … (⊗b) (↑❘⊗q❘)) @and4_intro
+[ //
+| //
+| lapply (in_comp_unwind_bi (𝐢) … Ht1) -Ht1 -H0t1 -Hb -Ht2
+ <unwind_path_d_empty_dx <depth_structure //
+| lapply (unwind_term_eq_repl_dx (𝐢) … Ht2) -Ht2 #Ht2
+ @(subset_eq_trans … Ht2) -t2
+ @(subset_eq_trans … (unwind_fsubst …))
+ [ (*<unwind_rmap_append <unwind_rmap_A_sn <unwind_rmap_append <unwind_rmap_L_sn *)
+ <structure_append <structure_A_sn <structure_append <structure_L_sn
+ <depth_append <depth_L_sn <depth_structure <depth_structure
+ @fsubst_eq_repl [ // ]
+ @(subset_eq_trans … (unwind_iref …))
+
+ elim Hb -Hb #Hb #H0 <H0 -H0 <nrplus_zero_dx <nplus_zero_dx <Hn
+ @(subset_eq_canc_sn … (lift_term_eq_repl_dx …))
+ [ @unwind_grafted_S /2 width=2 by ex_intro/ | skip ]
+
+(*
+ @(subset_eq_canc_sn … (unwind_term_eq_repl_dx …))
+ [ @unwind_grafted_S /2 width=2 by ex_intro/ | skip ]
+
+ @(subset_eq_trans … (unwind_term_after …))
+ @(subset_eq_canc_dx … (unwind_term_after …))
+ @unwind_term_eq_repl_sn -t1
+ @(stream_eq_trans … (tr_compose_uni_dx …))
+ lapply (Hn (𝐢)) -Hn >tr_id_unfold #Hn
+ lapply (pippo … b … Hn) -Hn #Hn
+ @tr_compose_eq_repl
+ [ <unwind_rmap_pap_le //
+ <Hn <nrplus_inj_sn //
+ |
+ ]
+*)
+ | //
+ | /2 width=2 by ex_intro/
+ | //
+ ]
+]
+
+(*
+Hn : ↑❘q❘ = ↑[p●𝗔◗b●𝗟◗q]𝐢@❨n❩
+---------------------------
+↑[𝐮❨↑❘q❘+❘b❘❩] ↑[↑[p]𝐢] t ⇔ ↑[𝐮❨↑[p●𝗔◗b●𝗟◗q]𝐢@❨n+❘b❘❩❩] t
+*)
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "delayed_updating/unwind1/unwind_prototerm.ma".
+include "delayed_updating/substitution/fsubst.ma".
+include "delayed_updating/substitution/lift_prototerm.ma".
+include "delayed_updating/syntax/prototerm_equivalence.ma".
+include "delayed_updating/syntax/path_depth.ma".
+include "delayed_updating/syntax/path_structure.ma".
+include "delayed_updating/syntax/path_balanced.ma".
+include "delayed_updating/notation/relations/black_rightarrow_f_4.ma".
+include "ground/xoa/ex_1_2.ma".
+include "ground/xoa/and_4.ma".
+
+(* IMMEDIATE FOCUSED REDUCTION ************************************************)
+
+definition ifr (p) (q): relation2 prototerm prototerm ≝
+ λt1,t2. ∃∃b,n.
+ let r ≝ p●𝗔◗b●𝗟◗q in
+ ∧∧ (⊗b ϵ 𝐁 ∧ 𝟎 = ❘b❘) & ↑❘q❘ = (▼[r]𝐢)@❨n❩ & r◖𝗱n ϵ t1 &
+ t1[⋔r←↑[𝐮❨❘b●𝗟◗q❘❩](t1⋔(p◖𝗦))] ⇔ t2
+.
+
+interpretation
+ "focused balanced reduction with immediate updating (prototerm)"
+ 'BlackRightArrowF t1 p q t2 = (ifr p q t1 t2).
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR DELAYED UPDATING ********************************************)
+
+notation "hvbox( 𝐂❨ term 46 n ❩ )"
+ non associative with precedence 70
+ for @{ 'ClassC $n }.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR DELAYED UPDATING ********************************************)
+
+notation "hvbox( ♯ break term 90 p )"
+ non associative with precedence 70
+ for @{ 'Sharp $p }.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "delayed_updating/syntax/path.ma".
+include "delayed_updating/notation/functions/class_c_1.ma".
+include "ground/lib/subset.ma".
+
+include "delayed_updating/syntax/path_depth.ma".
+include "delayed_updating/syntax/path_height.ma".
+
+(* CLOSED CONDITION FOR PATH ************************************************)
+
+axiom pcc: relation2 nat path.
+
+interpretation
+ "closed condition (path)"
+ 'ClassC n = (pcc n).
+
+(* Basic destructions *******************************************************)
+
+axiom pcc_empty:
+ (𝐞) ϵ 𝐂❨𝟎❩.
+
+axiom pcc_d (p) (d) (n:pnat):
+ p ϵ 𝐂❨d+n❩ → p◖𝗱n ϵ 𝐂❨d❩.
+
+axiom pcc_L (p) (d):
+ p ϵ 𝐂❨d❩ → p◖𝗟 ϵ 𝐂❨↑d❩.
+
+axiom pcc_A (p) (d):
+ p ϵ 𝐂❨d❩ → p◖𝗔 ϵ 𝐂❨d❩.
+
+axiom pcc_S (p) (d):
+ p ϵ 𝐂❨d❩ → p◖𝗦 ϵ 𝐂❨d❩.
+
+axiom pcc_des_gen (p) (d):
+ p ϵ 𝐂❨d❩ → d + ♯p = ❘p❘.
include "ground/arith/nat_plus.ma".
include "delayed_updating/syntax/path.ma".
-include "delayed_updating/notation/functions/hash_1.ma".
+include "delayed_updating/notation/functions/sharp_1.ma".
(* HEIGHT FOR PATH **********************************************************)
interpretation
"height (path)"
- 'Hash p = (height p).
+ 'Sharp p = (height p).
(* Basic constructions ******************************************************)
-lemma height_empty: ð\9d\9f\8e = ⧣𝐞.
+lemma height_empty: ð\9d\9f\8e = â\99¯𝐞.
// qed.
-lemma height_d_sn (q) (n): ninj n+⧣q = ⧣(𝗱n◗q).
+lemma height_d_sn (q) (n): ninj n+â\99¯q = â\99¯(𝗱n◗q).
// qed.
-lemma height_m_sn (q): ⧣q = ⧣(𝗺◗q).
+lemma height_m_sn (q): â\99¯q = â\99¯(𝗺◗q).
// qed.
-lemma height_L_sn (q): ⧣q = ⧣(𝗟◗q).
+lemma height_L_sn (q): â\99¯q = â\99¯(𝗟◗q).
// qed.
-lemma height_A_sn (q): ⧣q = ⧣(𝗔◗q).
+lemma height_A_sn (q): â\99¯q = â\99¯(𝗔◗q).
// qed.
-lemma height_S_sn (q): ⧣q = ⧣(𝗦◗q).
+lemma height_S_sn (q): â\99¯q = â\99¯(𝗦◗q).
// qed.
(* Main constructions *******************************************************)
theorem height_append (p1) (p2):
- (⧣p2+⧣p1) = ⧣(p1●p2).
+ (â\99¯p2+â\99¯p1) = â\99¯(p1●p2).
#p1 elim p1 -p1 //
* [ #n ] #p1 #IH #p2 <list_append_lcons_sn
[ <height_d_sn <height_d_sn //
(* Constructions with list_rcons ********************************************)
lemma height_d_dx (p) (n):
- (⧣p)+(ninj n) = ⧣(p◖𝗱n).
+ (â\99¯p)+(ninj n) = â\99¯(p◖𝗱n).
// qed.
lemma height_m_dx (p):
- (⧣p) = ⧣(p◖𝗺).
+ (â\99¯p) = â\99¯(p◖𝗺).
// qed.
lemma height_L_dx (p):
- (⧣p) = ⧣(p◖𝗟).
+ (â\99¯p) = â\99¯(p◖𝗟).
// qed.
lemma height_A_dx (p):
- (⧣p) = ⧣(p◖𝗔).
+ (â\99¯p) = â\99¯(p◖𝗔).
// qed.
lemma height_S_dx (p):
- (⧣p) = ⧣(p◖𝗦).
+ (â\99¯p) = â\99¯(p◖𝗦).
// qed.