--- /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 46 n ] break term 70 p )"
+ non associative with precedence 70
+ for @{ 'DownArrowRight $n $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/substitution/lift_path.ma".
+include "delayed_updating/syntax/path_head.ma".
+include "ground/relocation/xap.ma".
+
+(* LIFT FOR PATH ************************************************************)
+
+(* Constructions with head for path *****************************************)
+
+lemma lift_path_head_closed (f) (p) (q) (n):
+ q = ↳[n]q →
+ ↳[↑[p●q]f@❨n❩]↑[↑[p]f]q = ↑[↑[p]f]q.
+#f #p #q elim q -q
+[ #n #H0
+ <(eq_inv_path_empty_head … H0) -H0
+ <path_head_zero //
+| #l #q #IH #n @(nat_ind_succ …n) -n [| #n #_ ]
+ [ <path_head_zero #H0 destruct
+ | cases l [ #k ]
+ [ <path_head_d_dx #H0
+ elim (eq_inv_list_lcons_bi ????? H0) -H0 #_ #H0
+ <lift_rmap_d_dx <lift_path_d_dx
+ <tr_xap_succ_nap <path_head_d_dx
+ <(IH … H0) in ⊢ (???%); -IH -H0 <tr_xap_plus //
+ | <path_head_m_dx #H0
+ elim (eq_inv_list_lcons_bi ????? H0) -H0 #_ #H0
+ <lift_rmap_m_dx <lift_path_m_dx
+ <tr_xap_succ_nap <path_head_m_dx
+ <(IH … H0) in ⊢ (???%); -IH -H0 //
+ | <path_head_L_dx #H0
+ elim (eq_inv_list_lcons_bi ????? H0) -H0 #_ #H0
+ <lift_rmap_L_dx <lift_path_L_dx
+ <tr_xap_succ_nap <path_head_L_dx
+ <(IH … H0) in ⊢ (???%); -IH -H0 //
+ | <path_head_A_dx #H0
+ elim (eq_inv_list_lcons_bi ????? H0) -H0 #_ #H0
+ <lift_rmap_A_dx <lift_path_A_dx
+ <tr_xap_succ_nap <path_head_A_dx
+ <(IH … H0) in ⊢ (???%); -IH -H0 //
+ | <path_head_S_dx #H0
+ elim (eq_inv_list_lcons_bi ????? H0) -H0 #_ #H0
+ <lift_rmap_S_dx <lift_path_S_dx
+ <tr_xap_succ_nap <path_head_S_dx
+ <(IH … H0) in ⊢ (???%); -IH -H0 //
+ ]
+ ]
+]
+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_rmap_eq.ma".
+include "delayed_updating/syntax/path_head.ma".
+include "ground/lib/stream_eq_eq.ma".
+
+(* LIFT MAP FOR PATH ********************************************************)
+
+(* Constructions with path_head *********************************************)
+
+lemma tls_plus_lift_rmap_closed (f) (q) (n) (m):
+ q = ↳[n]q →
+ ⇂*[m]f ≗ ⇂*[n+m]↑[q]f.
+#f #q elim q -q
+[ #n #m #Hq
+ <(eq_inv_path_empty_head … Hq) -n //
+| #l #q #IH #n @(nat_ind_succ … n) -n //
+ #n #_ #m cases l [ #k ]
+ [ <path_head_d_dx #Hq
+ elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq <nrplus_inj_sn
+ @(stream_eq_trans … (tls_lift_rmap_d_dx …))
+ >nrplus_inj_dx >nrplus_inj_sn >nrplus_inj_sn <nplus_plus_comm_23
+ >nsucc_unfold /2 width=1 by/
+ | <path_head_m_dx #Hq
+ elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
+ <lift_rmap_m_dx /2 width=1 by/
+ | <path_head_L_dx #Hq
+ elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
+ <lift_rmap_L_dx <nplus_succ_sn /2 width=1 by/
+ | <path_head_A_dx #Hq
+ elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
+ <lift_rmap_A_dx /2 width=2 by/
+ | <path_head_S_dx #Hq
+ elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
+ <lift_rmap_S_dx /2 width=2 by/
+ ]
+]
+qed-.
+
+lemma tls_lift_rmap_closed (f) (q) (n):
+ q = ↳[n]q →
+ f ≗ ⇂*[n]↑[q]f.
+#f #q #n #H0
+/2 width=1 by tls_plus_lift_rmap_closed/
+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/syntax/path_depth.ma".
+include "delayed_updating/syntax/path_labels.ma".
+
+(* DEPTH FOR PATH ***********************************************************)
+
+(* Constructions with labels ************************************************)
+
+lemma depth_labels_L (n):
+ n = ♭(𝗟∗∗n).
+#n @(nat_ind_succ … n) -n //
+#n #IH <labels_succ <depth_L_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/syntax/path_labels.ma".
+include "delayed_updating/notation/functions/downarrowright_2.ma".
+include "ground/arith/nat_plus.ma".
+include "ground/arith/nat_pred_succ.ma".
+
+(* HEAD FOR PATH ************************************************************)
+
+rec definition path_head (n) (p) on p: path ≝
+match n with
+[ nzero ⇒ 𝐞
+| ninj m ⇒
+ match p with
+ [ list_empty ⇒ 𝗟∗∗n
+ | list_lcons l q ⇒
+ match l with
+ [ label_d k ⇒ (path_head (n+k) q)◖l
+ | label_m ⇒ (path_head n q)◖l
+ | label_L ⇒ (path_head (↓m) q)◖l
+ | label_A ⇒ (path_head n q)◖l
+ | label_S ⇒ (path_head n q)◖l
+ ]
+ ]
+].
+
+interpretation
+ "head (path)"
+ 'DownArrowRight n p = (path_head n p).
+
+(* basic constructions ****************************************************)
+
+lemma path_head_zero (p):
+ (𝐞) = ↳[𝟎]p.
+* // qed.
+
+lemma path_head_empty (n):
+ (𝗟∗∗n) = ↳[n]𝐞.
+* // qed.
+
+lemma path_head_d_dx (p) (n) (k:pnat):
+ (↳[↑n+k]p)◖𝗱k = ↳[↑n](p◖𝗱k).
+// qed.
+
+lemma path_head_m_dx (p) (n):
+ (↳[↑n]p)◖𝗺 = ↳[↑n](p◖𝗺).
+// qed.
+
+lemma path_head_L_dx (p) (n):
+ (↳[n]p)◖𝗟 = ↳[↑n](p◖𝗟).
+#p #n
+whd in ⊢ (???%); //
+qed.
+
+lemma path_head_A_dx (p) (n):
+ (↳[↑n]p)◖𝗔 = ↳[↑n](p◖𝗔).
+// qed.
+
+lemma path_head_S_dx (p) (n):
+ (↳[↑n]p)◖𝗦 = ↳[↑n](p◖𝗦).
+// qed.
+
+(* Basic inversions *********************************************************)
+
+lemma eq_inv_path_head_zero_dx (q) (p):
+ q = ↳[𝟎]p → 𝐞 = q.
+#q * //
+qed-.
+
+lemma eq_inv_path_empty_head (p) (n):
+ (𝐞) = ↳[n]p → 𝟎 = n.
+*
+[ #n <path_head_empty #H0
+ <(eq_inv_empty_labels … H0) -n //
+| * [ #k ] #p #n @(nat_ind_succ … n) -n // #n #_
+ [ <path_head_d_dx
+ | <path_head_m_dx
+ | <path_head_L_dx
+ | <path_head_A_dx
+ | <path_head_S_dx
+ ] #H0 destruct
+]
+qed-.
+
+(* Constructions with path_append *******************************************)
+
+lemma path_head_refl_append_bi (p) (q) (m) (n):
+ p = ↳[m]p → q = ↳[n]q → p●q = ↳[n+m](p●q).
+#p #q elim q -q
+[ #m #n #Hp #H0
+ <(eq_inv_path_empty_head … H0) -n //
+| #l #q #IH #m #n #Hp
+ @(nat_ind_succ … n) -n // #n #_
+ cases l [ #k ]
+ <list_append_lcons_sn <nplus_succ_sn
+ [ <path_head_d_dx <path_head_d_dx #Hq
+ elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
+ >(IH … Hp Hq) in ⊢ (??%?); -IH -Hp -Hq
+ <nplus_plus_comm_23 //
+ | <path_head_m_dx <path_head_m_dx #Hq
+ elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
+ >(IH … Hp Hq) in ⊢ (??%?); -IH -Hp -Hq //
+ | <path_head_L_dx <path_head_L_dx #Hq
+ elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
+ >(IH … Hp Hq) in ⊢ (??%?); -IH -Hp -Hq //
+ | <path_head_A_dx <path_head_A_dx #Hq
+ elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
+ >(IH … Hp Hq) in ⊢ (??%?); -IH -Hp -Hq //
+ | <path_head_S_dx <path_head_S_dx #Hq
+ elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
+ >(IH … Hp Hq) in ⊢ (??%?); -IH -Hp -Hq //
+ ]
+qed.
+
+lemma path_head_refl_append_sn (p) (q) (n):
+ q = ↳[n]q → q = ↳[n](p●q).
+#p #q elim q -q
+[ #n #Hn <(eq_inv_path_empty_head … Hn) -Hn //
+| #l #q #IH #n @(nat_ind_succ … n) -n
+ [ #Hq | #n #_ cases l [ #k ] ]
+ [ lapply (eq_inv_path_head_zero_dx … Hq) -Hq #Hq destruct
+ | <path_head_d_dx <path_head_d_dx
+ | <path_head_m_dx <path_head_m_dx
+ | <path_head_L_dx <path_head_L_dx
+ | <path_head_A_dx <path_head_A_dx
+ | <path_head_S_dx <path_head_S_dx
+ ] #Hq
+ elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
+ /3 width=1 by eq_f/
+]
+qed-.
+
+(* Inversions with path_append **********************************************)
+
+lemma eq_inv_path_head_refl_append_sn (p) (q) (n):
+ q = ↳[n](p●q) → q = ↳[n]q.
+#p #q elim q -q
+[ #n #Hn <(eq_inv_path_empty_head … Hn) -p //
+| #l #q #IH #n @(nat_ind_succ … n) -n //
+ #n #_ cases l [ #k ]
+ [ <path_head_d_dx <path_head_d_dx
+ | <path_head_m_dx <path_head_m_dx
+ | <path_head_L_dx <path_head_L_dx
+ | <path_head_A_dx <path_head_A_dx
+ | <path_head_S_dx <path_head_S_dx
+ ] #Hq
+ elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
+ /3 width=1 by eq_f/
+]
+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/syntax/path_head.ma".
+include "delayed_updating/syntax/path_height_labels.ma".
+include "delayed_updating/syntax/path_depth_labels.ma".
+
+(* HEAD FOR PATH ************************************************************)
+
+(* Constructions with depth and height **************************************)
+
+lemma path_head_depth (p) (n):
+ n + ♯(↳[n]p) = ♭↳[n]p.
+#p elim p -p // #l #p #IH
+#n @(nat_ind_succ … n) -n // #n #_
+cases l [ #k ]
+[ <path_head_d_dx <height_d_dx <depth_d_dx <IH //
+| <path_head_m_dx <height_m_dx <depth_m_dx //
+| <path_head_L_dx <height_L_dx <depth_L_dx
+ <nplus_succ_sn //
+| <path_head_A_dx <height_A_dx <depth_A_dx //
+| <path_head_S_dx <height_S_dx <depth_S_dx //
+]
+qed-. (**) (* gets in the way with auto *)
--- /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_head_depth.ma".
+include "delayed_updating/syntax/path_structure_labels.ma".
+
+(* HEAD FOR PATH ************************************************************)
+
+(* Constructions with structure *********************************************)
+
+lemma path_head_structure_height (p) (n):
+ ⊗↳[n]p = ↳[n+♯↳[n]p]⊗p.
+#p elim p -p //
+#l #p #IH #n @(nat_ind_succ … n) -n //
+#n #_ cases l [ #k ]
+[ <height_d_dx <structure_d_dx //
+| <structure_m_dx //
+| <structure_L_dx //
+| <height_A_dx <structure_A_dx <nplus_succ_sn <path_head_A_dx //
+| <height_S_dx <structure_S_dx <nplus_succ_sn <path_head_S_dx //
+]
+qed.
+
+lemma path_head_structure_depth (p) (n):
+ ⊗↳[n]p = ↳[♭↳[n]p]⊗p.
+#p #n
+<path_head_depth //
+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/syntax/path_height.ma".
+include "delayed_updating/syntax/path_labels.ma".
+
+(* HEIGHT FOR PATH **********************************************************)
+
+(* Constructions with labels ************************************************)
+
+lemma height_labels_L (n):
+ (𝟎) = ♯(𝗟∗∗n).
+#n @(nat_ind_succ … n) -n //
+#n #IH <labels_succ <height_L_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/syntax/path.ma".
+include "delayed_updating/notation/functions/power_2.ma".
+include "ground/arith/nat_succ_iter.ma".
+
+(* *)
+
+definition labels (l) (n:nat): path ≝
+ ((list_lcons ? l)^n) (𝐞).
+
+interpretation
+ "labels (path)"
+ 'Power l n = (labels l n).
+
+(* Basic constructions ******************************************************)
+
+lemma labels_unfold (l) (n):
+ ((list_lcons ? l)^n) (𝐞) = l∗∗n.
+// qed.
+
+lemma labels_zero (l):
+ (𝐞) = l∗∗𝟎.
+// qed.
+
+lemma labels_succ (l) (n):
+ (l∗∗n)◖l = l∗∗(↑n).
+#l #n
+<labels_unfold <labels_unfold <niter_succ //
+qed.
+
+(* Basic inversions *********************************************************)
+
+lemma eq_inv_empty_labels (l) (n):
+ (𝐞) = l∗∗n → 𝟎 = n.
+#l #n @(nat_ind_succ … n) -n //
+#n #_ <labels_succ #H0 destruct
+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/syntax/path_structure.ma".
+include "delayed_updating/syntax/path_labels.ma".
+
+(* STRUCTURE FOR PATH *******************************************************)
+
+(* Constructions with labels ************************************************)
+
+lemma structure_labels_L (n):
+ (𝗟∗∗n) = ⊗(𝗟∗∗n).
+#n @(nat_ind_succ … n) -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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR DELAYED UPDATING ********************************************)
+
+notation "hvbox( a ∗∗ break b )"
+ left associative with precedence 65
+ for @{ 'Power $a $b }.
(* NOTATION FOR DELAYED UPDATING ********************************************)
-notation "hvbox( ▼[ term 46 f ] break term 70 p )"
+notation "hvbox( ▼[ break term 46 f ] break term 70 p )"
non associative with precedence 70
for @{ 'BlackDownTriangle $f $p }.
(* NOTATION FOR DELAYED UPDATING ********************************************)
-notation "hvbox( ▶[ term 46 f ] break term 70 p )"
+notation "hvbox( ▶[ break term 46 f ] break term 70 p )"
non associative with precedence 70
for @{ 'BlackRightTriangle $f $p }.
(* NOTATION FOR DELAYED UPDATING ********************************************)
-notation "hvbox( ⊗ term 70 p )"
+notation "hvbox( ⊗ break term 70 p )"
non associative with precedence 70
for @{ 'CircledTimes $p }.
(* NOTATION FOR DELAYED UPDATING ********************************************)
-notation "hvbox( 𝐂❨ term 46 n ❩ )"
+notation "hvbox( 𝐂❨ break 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( ↳[ term 46 n ] break term 70 p )"
- non associative with precedence 70
- for @{ 'DownArrowRight $n $p }.
(* NOTATION FOR DELAYED UPDATING ********************************************)
-notation "hvbox( ♭ term 70 p )"
+notation "hvbox( ♭ break term 70 p )"
non associative with precedence 70
for @{ 'Flat $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 *)
-(* *)
-(**************************************************************************)
-
-(* NOTATION FOR DELAYED UPDATING ********************************************)
-
-notation "hvbox( a ∗∗ break b )"
- left associative with precedence 65
- for @{ 'Power $a $b }.
(* NOTATION FOR DELAYED UPDATING ********************************************)
-notation "hvbox( 𝛕 break term 76 n. break term 70 t )"
+notation "hvbox( 𝛕 break term 76 n . break term 70 t )"
non associative with precedence 70
for @{ 'Tau $n $t }.
(* NOTATION FOR DELAYED UPDATING ********************************************)
-notation "hvbox( ↑[ term 46 t1 ] break term 70 t2 )"
+notation "hvbox( ↑[ break term 46 t1 ] break term 70 t2 )"
non associative with precedence 70
for @{ 'UpArrow $t1 $t2 }.
(* NOTATION FOR DELAYED UPDATING ********************************************)
-notation "hvbox( ▵ term 70 t )"
+notation "hvbox( ▵ break term 70 t )"
non associative with precedence 70
for @{ 'UpTriangle $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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR DELAYED UPDATING ********************************************)
+
+notation "hvbox( t1 ➡𝐝𝐛𝐟[ break term 46 r ] break term 46 t2 )"
+ non associative with precedence 45
+ for @{ 'BlackRightArrowDBF $t1 $r $t2 }.
(* NOTATION FOR DELAYED UPDATING ********************************************)
notation "hvbox( t1 ➡𝐝𝐟[ break term 46 r ] break term 46 t2 )"
- non associative with precedence 45
- for @{ 'BlackRightArrowDF $t1 $r $t2 }.
+ non associative with precedence 45
+ for @{ 'BlackRightArrowDF $t1 $r $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( t1 ➡𝐢𝐛𝐟[ break term 46 r ] break term 46 t2 )"
+ non associative with precedence 45
+ for @{ 'BlackRightArrowIBF $t1 $r $t2 }.
(* NOTATION FOR DELAYED UPDATING ********************************************)
notation "hvbox( t1 ➡𝐢𝐟[ break term 46 r ] break term 46 t2 )"
- non associative with precedence 45
- for @{ 'BlackRightArrowIF $t1 $r $t2 }.
+ non associative with precedence 45
+ for @{ 'BlackRightArrowIF $t1 $r $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/substitution/fsubst.ma".
+include "delayed_updating/syntax/prototerm_constructors.ma".
+include "delayed_updating/syntax/prototerm_eq.ma".
+include "delayed_updating/syntax/path_head.ma".
+include "delayed_updating/syntax/path_balanced.ma".
+include "delayed_updating/syntax/path_structure.ma".
+include "delayed_updating/notation/relations/black_rightarrow_dbf_3.ma".
+include "ground/arith/nat_rplus.ma".
+include "ground/xoa/ex_6_5.ma".
+
+(* DELAYED BALANCED FOCUSED REDUCTION ***************************************)
+
+(**) (* explicit ninj because we cannot declare the expectd type of k *)
+definition dbfr (r): relation2 prototerm prototerm ≝
+ λt1,t2.
+ ∃∃p,b,q,h,k. p●𝗔◗b●𝗟◗q = r &
+ ⊗b ϵ 𝐁 & b = ↳[h]b &
+ (𝗟◗q) = ↳[ninj k](𝗟◗q) & r◖𝗱k ϵ t1 &
+ t1[⋔r←𝛕(k+h).(t1⋔(p◖𝗦))] ⇔ t2
+.
+
+interpretation
+ "balanced focused reduction with delayed updating (prototerm)"
+ 'BlackRightArrowDBF t1 r t2 = (dbfr r 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/dbfr.ma".
+include "delayed_updating/reduction/ibfr.ma".
+
+include "delayed_updating/unwind/unwind2_constructors.ma".
+include "delayed_updating/unwind/unwind2_preterm_fsubst.ma".
+include "delayed_updating/unwind/unwind2_preterm_eq.ma".
+include "delayed_updating/unwind/unwind2_prototerm_lift.ma".
+include "delayed_updating/unwind/unwind2_rmap_head.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_head_structure.ma".
+include "delayed_updating/syntax/path_structure_depth.ma".
+
+(* DELAYED BALANCED FOCUSED REDUCTION ***************************************)
+
+(* Main destructions with ibfr **********************************************)
+
+theorem dbfr_des_ibfr (f) (t1) (t2) (r): t1 ϵ 𝐓 →
+ t1 ➡𝐝𝐛𝐟[r] t2 → ▼[f]t1 ➡𝐢𝐛𝐟[⊗r] ▼[f]t2.
+#f #t1 #t2 #r #H0t1
+* #p #b #q #h #k #Hr #Hb #Hh #H1k #Ht1 #Ht2 destruct
+@(ex6_5_intro … (⊗p) (⊗b) (⊗q) (♭b) (↑♭q))
+[ -H0t1 -Hb -Hh -H1k -Ht1 -Ht2 //
+| -H0t1 -Hh -H1k -Ht1 -Ht2 //
+| -H0t1 -Hb -Ht1 -H1k -Ht2
+ >Hh in ⊢ (??%?); >path_head_structure_depth <Hh -Hh //
+| -H0t1 -Hb -Hh -Ht1 -Ht2
+ >structure_L_sn
+ >H1k in ⊢ (??%?); >path_head_structure_depth <H1k -H1k //
+| lapply (in_comp_unwind2_path_term f … Ht1) -Ht2 -Ht1 -H0t1 -Hb -Hh
+ <unwind2_path_d_dx >list_append_rcons_dx >list_append_assoc
+ lapply (unwind2_rmap_append_pap_closed f … (p●𝗔◗b) … H1k) -H1k
+ <depth_L_sn #H2k
+ lapply (eq_inv_ninj_bi … H2k) -H2k #H2k <H2k -H2k #Ht1 //
+| lapply (unwind2_term_eq_repl_dx f … Ht2) -Ht2 #Ht2
+ lapply (path_head_refl_append_bi … Hh H1k) -Hh -H1k <nrplus_inj_sn #H1k
+ @(subset_eq_trans … Ht2) -t2
+ @(subset_eq_trans … (unwind2_term_fsubst_ppc …))
+ [ @fsubst_eq_repl [ // | // ]
+ @(subset_eq_trans … (unwind2_term_iref …))
+ @(subset_eq_canc_sn … (lift_term_eq_repl_dx …))
+ [ @unwind2_term_grafted_S /2 width=2 by ex_intro/ | skip ] -Ht1
+ @(subset_eq_trans … (lift_unwind2_term_after …))
+ @unwind2_term_eq_repl_sn
+(* Note: crux of the proof begins *)
+ <list_append_rcons_sn
+ @(stream_eq_trans … (tr_compose_uni_dx …))
+ @tr_compose_eq_repl
+ [ <unwind2_rmap_append_pap_closed //
+ <depth_append <depth_L_sn
+ <nplus_comm <nrplus_npsucc_sn <nplus_succ_sn //
+ | >unwind2_rmap_A_dx
+ /2 width=1 by tls_unwind2_rmap_closed/
+ ]
+(* Note: crux of the proof ends *)
+ | //
+ | /2 width=2 by ex_intro/
+ | //
+ ]
+]
+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/reduction/dbfr.ma".
+
+include "delayed_updating/substitution/fsubst_lift.ma".
+include "delayed_updating/substitution/fsubst_eq.ma".
+include "delayed_updating/substitution/lift_constructors.ma".
+include "delayed_updating/substitution/lift_path_head.ma".
+include "delayed_updating/substitution/lift_rmap_head.ma".
+
+(* DELAYED BALANCED FOCUSED REDUCTION ***************************************)
+
+(* Constructions with lift **************************************************)
+
+theorem dfr_lift_bi (f) (t1) (t2) (r):
+ t1 ➡𝐝𝐛𝐟[r] t2 → ↑[f]t1 ➡𝐝𝐛𝐟[↑[f]r] ↑[f]t2.
+#f #t1 #t2 #r
+* #p #q #k #Hr #H1k #Ht1 #Ht2 destruct
+@(ex4_3_intro … (↑[f]p) (↑[↑[p◖𝗔◖𝗟]f]q) ((↑[p●𝗔◗𝗟◗q]f)@⧣❨k❩))
+[ -H1k -Ht1 -Ht2 //
+| -Ht1 -Ht2
+ <lift_rmap_L_dx >lift_path_L_sn
+ <(lift_path_head_closed … H1k) in ⊢ (??%?); -H1k //
+| lapply (in_comp_lift_path_term f … Ht1) -Ht2 -Ht1 -H1k
+ <lift_path_d_dx #Ht1 //
+| lapply (lift_term_eq_repl_dx f … Ht2) -Ht2 #Ht2 -Ht1
+ @(subset_eq_trans … Ht2) -t2
+ @(subset_eq_trans … (lift_term_fsubst …))
+ @fsubst_eq_repl [ // | // ]
+ @(subset_eq_trans … (lift_term_iref …))
+ @iref_eq_repl
+ @(subset_eq_canc_sn … (lift_term_grafted_S …))
+ @lift_term_eq_repl_sn
+(* Note: crux of the proof begins *)
+ >list_append_rcons_sn in H1k; #H1k >lift_rmap_A_dx
+ /2 width=1 by tls_lift_rmap_closed/
+(* Note: crux of the proof ends *)
+]
+qed.
include "delayed_updating/syntax/prototerm_constructors.ma".
include "delayed_updating/syntax/prototerm_eq.ma".
include "delayed_updating/syntax/path_head.ma".
-include "delayed_updating/syntax/path_depth.ma".
include "delayed_updating/notation/relations/black_rightarrow_df_3.ma".
include "ground/xoa/ex_4_3.ma".
(* Constructions with lift **************************************************)
-(* ↑[↑[p◖𝗔◖𝗟]f]q *)
-
theorem dfr_lift_bi (f) (t1) (t2) (r):
t1 ➡𝐝𝐟[r] t2 → ↑[f]t1 ➡𝐝𝐟[↑[f]r] ↑[f]t2.
#f #t1 #t2 #r
--- /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/fsubst.ma".
+include "delayed_updating/substitution/lift_prototerm.ma".
+include "delayed_updating/syntax/prototerm_eq.ma".
+include "delayed_updating/syntax/path_head.ma".
+include "delayed_updating/syntax/path_balanced.ma".
+include "delayed_updating/syntax/path_structure.ma".
+include "delayed_updating/notation/relations/black_rightarrow_ibf_3.ma".
+include "ground/relocation/tr_uni.ma".
+include "ground/arith/nat_rplus.ma".
+include "ground/xoa/ex_6_5.ma".
+
+(* IMMEDIATE BALANCED FOCUSED REDUCTION *************************************)
+
+(**) (* explicit ninj because we cannot declare the expectd type of k *)
+definition ibfr (r): relation2 prototerm prototerm ≝
+ λt1,t2.
+ ∃∃p,b,q,h,k. p●𝗔◗b●𝗟◗q = r &
+ ⊗b ϵ 𝐁 & b = ↳[h]b &
+ (𝗟◗q) = ↳[ninj k](𝗟◗q) & r◖𝗱k ϵ t1 &
+ t1[⋔r←↑[𝐮❨k+h❩](t1⋔(p◖𝗦))] ⇔ t2
+.
+
+interpretation
+ "balanced focused reduction with immediate updating (prototerm)"
+ 'BlackRightArrowIBF t1 r t2 = (ibfr r 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/substitution/lift_path.ma".
+include "delayed_updating/syntax/path_closed.ma".
+include "ground/relocation/xap.ma".
+
+(* LIFT FOR PATH ************************************************************)
+
+(* Constructions with pcc ***************************************************)
+
+lemma lift_path_closed (f) (q) (n):
+ q ϵ 𝐂❨n❩ → ↑[f]q ϵ 𝐂❨↑[q]f@❨n❩❩.
+#f #q #n #Hq elim Hq -Hq //
+#q #n [ #k ] #_ #IH
+/2 width=1 by pcc_d_dx, pcc_m_dx, pcc_L_dx, pcc_A_dx, pcc_S_dx/
+qed.
+
+lemma lift_path_rmap_closed (f) (p) (q) (n):
+ q ϵ 𝐂❨n❩ → ↑[↑[p]f]q ϵ 𝐂❨↑[p●q]f@❨n❩❩.
+/2 width=1 by lift_path_closed/
+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_path.ma".
-include "delayed_updating/syntax/path_head.ma".
-include "ground/relocation/xap.ma".
-
-(* LIFT FOR PATH ************************************************************)
-
-(* Constructions with head for path *****************************************)
-
-lemma lift_path_head_closed (f) (p) (q) (n):
- q = ↳[n]q →
- ↳[↑[p●q]f@❨n❩]↑[↑[p]f]q = ↑[↑[p]f]q.
-#f #p #q elim q -q
-[ #n #H0
- <(eq_inv_path_empty_head … H0) -H0
- <path_head_zero //
-| #l #q #IH #n @(nat_ind_succ …n) -n [| #n #_ ]
- [ <path_head_zero #H0 destruct
- | cases l [ #k ]
- [ <path_head_d_dx #H0
- elim (eq_inv_list_lcons_bi ????? H0) -H0 #_ #H0
- <lift_rmap_d_dx <lift_path_d_dx
- <tr_xap_succ_nap <path_head_d_dx
- <(IH … H0) in ⊢ (???%); -IH -H0 <tr_xap_plus //
- | <path_head_m_dx #H0
- elim (eq_inv_list_lcons_bi ????? H0) -H0 #_ #H0
- <lift_rmap_m_dx <lift_path_m_dx
- <tr_xap_succ_nap <path_head_m_dx
- <(IH … H0) in ⊢ (???%); -IH -H0 //
- | <path_head_L_dx #H0
- elim (eq_inv_list_lcons_bi ????? H0) -H0 #_ #H0
- <lift_rmap_L_dx <lift_path_L_dx
- <tr_xap_succ_nap <path_head_L_dx
- <(IH … H0) in ⊢ (???%); -IH -H0 //
- | <path_head_A_dx #H0
- elim (eq_inv_list_lcons_bi ????? H0) -H0 #_ #H0
- <lift_rmap_A_dx <lift_path_A_dx
- <tr_xap_succ_nap <path_head_A_dx
- <(IH … H0) in ⊢ (???%); -IH -H0 //
- | <path_head_S_dx #H0
- elim (eq_inv_list_lcons_bi ????? H0) -H0 #_ #H0
- <lift_rmap_S_dx <lift_path_S_dx
- <tr_xap_succ_nap <path_head_S_dx
- <(IH … H0) in ⊢ (???%); -IH -H0 //
- ]
- ]
-]
-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_rmap_eq.ma".
+include "delayed_updating/syntax/path_closed.ma".
+include "ground/lib/stream_eq_eq.ma".
+
+(* LIFT MAP FOR PATH ********************************************************)
+
+(* Destructions with cpp ****************************************************)
+
+lemma tls_plus_lift_rmap_closed (f) (q) (n):
+ q ϵ 𝐂❨n❩ →
+ ∀m. ⇂*[m]f ≗ ⇂*[m+n]↑[q]f.
+#f #q #n #Hq elim Hq -q -n //
+#q #n #_ #IH #m
+<nplus_succ_dx <stream_tls_swap //
+qed-.
+
+lemma tls_lift_rmap_closed (f) (q) (n):
+ q ϵ 𝐂❨n❩ →
+ f ≗ ⇂*[n]↑[q]f.
+#f #q #n #H0
+/2 width=1 by tls_plus_lift_rmap_closed/
+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_rmap_eq.ma".
-include "delayed_updating/syntax/path_head.ma".
-include "ground/lib/stream_eq_eq.ma".
-
-(* LIFT MAP FOR PATH ********************************************************)
-
-(* Constructions with path_head *********************************************)
-
-lemma tls_plus_lift_rmap_closed (f) (q) (n) (m):
- q = ↳[n]q →
- ⇂*[m]f ≗ ⇂*[n+m]↑[q]f.
-#f #q elim q -q
-[ #n #m #Hq
- <(eq_inv_path_empty_head … Hq) -n //
-| #l #q #IH #n @(nat_ind_succ … n) -n //
- #n #_ #m cases l [ #k ]
- [ <path_head_d_dx #Hq
- elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq <nrplus_inj_sn
- @(stream_eq_trans … (tls_lift_rmap_d_dx …))
- >nrplus_inj_dx >nrplus_inj_sn >nrplus_inj_sn <nplus_plus_comm_23
- >nsucc_unfold /2 width=1 by/
- | <path_head_m_dx #Hq
- elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
- <lift_rmap_m_dx /2 width=1 by/
- | <path_head_L_dx #Hq
- elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
- <lift_rmap_L_dx <nplus_succ_sn /2 width=1 by/
- | <path_head_A_dx #Hq
- elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
- <lift_rmap_A_dx /2 width=2 by/
- | <path_head_S_dx #Hq
- elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
- <lift_rmap_S_dx /2 width=2 by/
- ]
-]
-qed-.
-
-lemma tls_lift_rmap_closed (f) (q) (n):
- q = ↳[n]q →
- f ≗ ⇂*[n]↑[q]f.
-#f #q #n #H0
-/2 width=1 by tls_plus_lift_rmap_closed/
-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/syntax/path.ma".
+include "delayed_updating/notation/functions/class_c_1.ma".
+include "ground/arith/nat_plus.ma".
+include "ground/arith/nat_pred_succ.ma".
+include "ground/lib/subset.ma".
+include "ground/generated/insert_eq_1.ma".
+
+(* CLOSED CONDITION FOR PATH ************************************************)
+
+inductive pcc: relation2 nat path ≝
+| pcc_empty:
+ pcc (𝟎) (𝐞)
+| pcc_d_dx (p) (n) (k):
+ pcc (n+ninj k) p → pcc n (p◖𝗱k)
+| pcc_m_dx (p) (n):
+ pcc n p → pcc n (p◖𝗺)
+| pcc_L_dx (p) (n):
+ pcc n p → pcc (↑n) (p◖𝗟)
+| pcc_A_dx (p) (n):
+ pcc n p → pcc n (p◖𝗔)
+| pcc_S_dx (p) (n):
+ pcc n p → pcc n (p◖𝗦)
+.
+
+interpretation
+ "closed condition (path)"
+ 'ClassC n = (pcc n).
+
+(* Basic inversions ********************************************************)
+
+lemma pcc_inv_empty (n):
+ (𝐞) ϵ 𝐂❨n❩ → 𝟎 = n.
+#n @(insert_eq_1 … (𝐞))
+#x * -n //
+#p #n [ #k ] #_ #H0 destruct
+qed-.
+
+lemma pcc_inv_d_dx (p) (n) (k):
+ p◖𝗱k ϵ 𝐂❨n❩ → p ϵ 𝐂❨n+k❩.
+#p #n #h @(insert_eq_1 … (p◖𝗱h))
+#x * -x -n
+[|*: #x #n [ #k ] #Hx ] #H0 destruct //
+qed-.
+
+lemma pcc_inv_m_dx (p) (n):
+ p◖𝗺 ϵ 𝐂❨n❩ → p ϵ 𝐂❨n❩.
+#p #n @(insert_eq_1 … (p◖𝗺))
+#x * -x -n
+[|*: #x #n [ #k ] #Hx ] #H0 destruct //
+qed-.
+
+lemma pcc_inv_L_dx (p) (n):
+ p◖𝗟 ϵ 𝐂❨n❩ →
+ ∧∧ p ϵ 𝐂❨↓n❩ & ↑↓n = n.
+#p #n @(insert_eq_1 … (p◖𝗟))
+#x * -x -n
+[|*: #x #n [ #k ] #Hx ] #H0 destruct
+<npred_succ /2 width=1 by conj/
+qed-.
+
+lemma pcc_inv_A_dx (p) (n):
+ p◖𝗔 ϵ 𝐂❨n❩ → p ϵ 𝐂❨n❩.
+#p #n @(insert_eq_1 … (p◖𝗔))
+#x * -x -n
+[|*: #x #n [ #k ] #Hx ] #H0 destruct //
+qed-.
+
+lemma pcc_inv_S_dx (p) (n):
+ p◖𝗦 ϵ 𝐂❨n❩ → p ϵ 𝐂❨n❩.
+#p #n @(insert_eq_1 … (p◖𝗦))
+#x * -x -n
+[|*: #x #n [ #k ] #Hx ] #H0 destruct //
+qed-.
+
+(* Advanced inversions ******************************************************)
+
+lemma pcc_inv_empty_succ (n):
+ (𝐞) ϵ 𝐂❨↑n❩ → ⊥.
+#n #H0
+lapply (pcc_inv_empty … H0) -H0 #H0
+/2 width=7 by eq_inv_zero_nsucc/
+qed-.
+
+lemma pcc_inv_L_dx_zero (p):
+ p◖𝗟 ϵ 𝐂❨𝟎❩ → ⊥.
+#p #H0
+elim (pcc_inv_L_dx … H0) -H0 #_ #H0
+/2 width=7 by eq_inv_nsucc_zero/
+qed-.
+
+lemma pcc_inv_L_dx_succ (p) (n):
+ p◖𝗟 ϵ 𝐂❨↑n❩ → p ϵ 𝐂❨n❩.
+#p #n #H0
+elim (pcc_inv_L_dx … H0) -H0 //
+qed-.
+
+(* Main constructions with path_append **************************************)
+
+theorem pcc_append_bi (p) (q) (m) (n):
+ p ϵ 𝐂❨m❩ → q ϵ 𝐂❨n❩ → p●q ϵ 𝐂❨m+n❩.
+#p #q #m #n #Hm #Hm elim Hm -Hm // -Hm
+#p #n [ #k ] #_ #IH [3: <nplus_succ_dx ]
+/2 width=1 by pcc_d_dx, pcc_m_dx, pcc_L_dx, pcc_A_dx, pcc_S_dx/
+qed.
+
+(* Main inversions **********************************************************)
+
+theorem ppc_mono (q) (n1):
+ q ϵ 𝐂❨n1❩ → ∀n2. q ϵ 𝐂❨n2❩ → n1 = n2.
+#q1 #n1 #Hn1 elim Hn1 -q1 -n1
+[|*: #q1 #n1 [ #k1 ] #_ #IH ] #n2 #Hn2
+[ <(pcc_inv_empty … Hn2) -n2 //
+| lapply (pcc_inv_d_dx … Hn2) -Hn2 #Hn2
+ lapply (IH … Hn2) -q1 #H0
+ /2 width=2 by eq_inv_nplus_bi_dx/
+| lapply (pcc_inv_m_dx … Hn2) -Hn2 #Hn2
+ <(IH … Hn2) -q1 -n2 //
+| elim (pcc_inv_L_dx … Hn2) -Hn2 #Hn2 #H0
+ >(IH … Hn2) -q1 //
+| lapply (pcc_inv_A_dx … Hn2) -Hn2 #Hn2
+ <(IH … Hn2) -q1 -n2 //
+| lapply (pcc_inv_S_dx … Hn2) -Hn2 #Hn2
+ <(IH … Hn2) -q1 -n2 //
+]
+qed-.
+
+theorem pcc_inj_L_sn (p1) (p2) (q1) (n):
+ q1 ϵ 𝐂❨n❩ → ∀q2. q2 ϵ 𝐂❨n❩ →
+ p1●𝗟◗q1 = p2●𝗟◗q2 → q1 = q2.
+#p1 #p2 #q1 #n #Hq1 elim Hq1 -q1 -n
+[|*: #q1 #n1 [ #k1 ] #_ #IH ] * //
+[1,3,5,7,9,11: #l2 #q2 ] #Hq2
+<list_append_lcons_sn <list_append_lcons_sn #H0
+elim (eq_inv_list_lcons_bi ????? H0) -H0 #H0 #H1 destruct
+[ elim (pcc_inv_L_dx_zero … Hq2)
+| lapply (pcc_inv_d_dx … Hq2) -Hq2 #Hq2
+ <(IH … Hq2) //
+| lapply (pcc_inv_m_dx … Hq2) -Hq2 #Hq2
+ <(IH … Hq2) //
+| lapply (pcc_inv_L_dx_succ … Hq2) -Hq2 #Hq2
+ <(IH … Hq2) //
+| lapply (pcc_inv_A_dx … Hq2) -Hq2 #Hq2
+ <(IH … Hq2) //
+| lapply (pcc_inv_S_dx … Hq2) -Hq2 #Hq2
+ <(IH … Hq2) //
+| elim (pcc_inv_empty_succ … Hq2)
+]
+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/syntax/path_closed.ma".
+include "delayed_updating/syntax/path_height.ma".
+include "delayed_updating/syntax/path_depth.ma".
+
+(* CLOSED CONDITION FOR PATH ************************************************)
+
+(* Constructions with height and depth **************************************)
+
+lemma path_closed_depth (p) (n):
+ p ϵ 𝐂❨n❩ → ♯p + n = ♭p.
+#p #n #Hn elim Hn -Hn //
+#p #n #_ #IH <nplus_succ_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/syntax/path_closed_height.ma".
+include "delayed_updating/syntax/path_structure.ma".
+
+(* CLOSED CONDITION FOR PATH ************************************************)
+
+(* Constructions with structure *********************************************)
+
+lemma path_closed_structure_height (p) (n):
+ p ϵ 𝐂❨n❩ → ⊗p ϵ 𝐂❨♯p+n❩.
+#p #n #Hn elim Hn -Hn //
+#p #n #_ #IH [ <nplus_succ_dx ]
+/2 width=1 by pcc_L_dx, pcc_A_dx, pcc_S_dx/
+qed.
+
+lemma path_closed_structure_depth (p) (n):
+ p ϵ 𝐂❨n❩ → ⊗p ϵ 𝐂❨♭p❩.
+#p #n #Hp <path_closed_depth
+/2 width=3 by path_closed_structure_height/
+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/syntax/path_depth.ma".
-include "delayed_updating/syntax/path_labels.ma".
-
-(* DEPTH FOR PATH ***********************************************************)
-
-(* Constructions with labels ************************************************)
-
-lemma depth_labels_L (n):
- n = ♭(𝗟∗∗n).
-#n @(nat_ind_succ … n) -n //
-#n #IH <labels_succ <depth_L_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/syntax/path_labels.ma".
-include "delayed_updating/notation/functions/downarrowright_2.ma".
-include "ground/arith/nat_plus.ma".
-include "ground/arith/nat_pred_succ.ma".
-
-(* HEAD FOR PATH ************************************************************)
-
-rec definition path_head (n) (p) on p: path ≝
-match n with
-[ nzero ⇒ 𝐞
-| ninj m ⇒
- match p with
- [ list_empty ⇒ 𝗟∗∗n
- | list_lcons l q ⇒
- match l with
- [ label_d k ⇒ (path_head (n+k) q)◖l
- | label_m ⇒ (path_head n q)◖l
- | label_L ⇒ (path_head (↓m) q)◖l
- | label_A ⇒ (path_head n q)◖l
- | label_S ⇒ (path_head n q)◖l
- ]
- ]
-].
-
-interpretation
- "head (path)"
- 'DownArrowRight n p = (path_head n p).
-
-(* basic constructions ****************************************************)
-
-lemma path_head_zero (p):
- (𝐞) = ↳[𝟎]p.
-* // qed.
-
-lemma path_head_empty (n):
- (𝗟∗∗n) = ↳[n]𝐞.
-* // qed.
-
-lemma path_head_d_dx (p) (n) (k:pnat):
- (↳[↑n+k]p)◖𝗱k = ↳[↑n](p◖𝗱k).
-// qed.
-
-lemma path_head_m_dx (p) (n):
- (↳[↑n]p)◖𝗺 = ↳[↑n](p◖𝗺).
-// qed.
-
-lemma path_head_L_dx (p) (n):
- (↳[n]p)◖𝗟 = ↳[↑n](p◖𝗟).
-#p #n
-whd in ⊢ (???%); //
-qed.
-
-lemma path_head_A_dx (p) (n):
- (↳[↑n]p)◖𝗔 = ↳[↑n](p◖𝗔).
-// qed.
-
-lemma path_head_S_dx (p) (n):
- (↳[↑n]p)◖𝗦 = ↳[↑n](p◖𝗦).
-// qed.
-
-(* Basic inversions *********************************************************)
-
-lemma eq_inv_path_head_zero_dx (q) (p):
- q = ↳[𝟎]p → 𝐞 = q.
-#q * //
-qed-.
-
-lemma eq_inv_path_empty_head (p) (n):
- (𝐞) = ↳[n]p → 𝟎 = n.
-*
-[ #n <path_head_empty #H0
- <(eq_inv_empty_labels … H0) -n //
-| * [ #k ] #p #n @(nat_ind_succ … n) -n // #n #_
- [ <path_head_d_dx
- | <path_head_m_dx
- | <path_head_L_dx
- | <path_head_A_dx
- | <path_head_S_dx
- ] #H0 destruct
-]
-qed-.
-
-(* Constructions with path_append *******************************************)
-
-lemma path_head_refl_append (p) (q) (n):
- q = ↳[n]q → q = ↳[n](p●q).
-#p #q elim q -q
-[ #n #Hn <(eq_inv_path_empty_head … Hn) -Hn //
-| #l #q #IH #n @(nat_ind_succ … n) -n
- [ #Hq | #n #_ cases l [ #k ] ]
- [ lapply (eq_inv_path_head_zero_dx … Hq) -Hq #Hq destruct
- | <path_head_d_dx <path_head_d_dx
- | <path_head_m_dx <path_head_m_dx
- | <path_head_L_dx <path_head_L_dx
- | <path_head_A_dx <path_head_A_dx
- | <path_head_S_dx <path_head_S_dx
- ] #Hq
- elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
- /3 width=1 by eq_f/
-]
-qed-.
-
-(* Inversions with path_append **********************************************)
-
-lemma eq_inv_path_head_refl_append (p) (q) (n):
- q = ↳[n](p●q) → q = ↳[n]q.
-#p #q elim q -q
-[ #n #Hn <(eq_inv_path_empty_head … Hn) -p //
-| #l #q #IH #n @(nat_ind_succ … n) -n //
- #n #_ cases l [ #k ]
- [ <path_head_d_dx <path_head_d_dx
- | <path_head_m_dx <path_head_m_dx
- | <path_head_L_dx <path_head_L_dx
- | <path_head_A_dx <path_head_A_dx
- | <path_head_S_dx <path_head_S_dx
- ] #Hq
- elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
- /3 width=1 by eq_f/
-]
-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/syntax/path_head.ma".
-include "delayed_updating/syntax/path_height_labels.ma".
-include "delayed_updating/syntax/path_depth_labels.ma".
-
-(* HEAD FOR PATH ************************************************************)
-
-(* Constructions with depth and height **************************************)
-
-lemma path_head_depth (p) (n):
- n + ♯(↳[n]p) = ♭↳[n]p.
-#p elim p -p // #l #p #IH
-#n @(nat_ind_succ … n) -n // #n #_
-cases l [ #k ]
-[ <path_head_d_dx <height_d_dx <depth_d_dx <IH //
-| <path_head_m_dx <height_m_dx <depth_m_dx //
-| <path_head_L_dx <height_L_dx <depth_L_dx
- <nplus_succ_sn //
-| <path_head_A_dx <height_A_dx <depth_A_dx //
-| <path_head_S_dx <height_S_dx <depth_S_dx //
-]
-qed-. (**) (* gets in the way with auto *)
+++ /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_head_depth.ma".
-include "delayed_updating/syntax/path_structure_labels.ma".
-
-(* HEAD FOR PATH ************************************************************)
-
-(* Constructions with structure *********************************************)
-
-lemma path_head_structure_height (p) (n):
- ⊗↳[n]p = ↳[n+♯↳[n]p]⊗p.
-#p elim p -p //
-#l #p #IH #n @(nat_ind_succ … n) -n //
-#n #_ cases l [ #k ]
-[ <height_d_dx <structure_d_dx //
-| <structure_m_dx //
-| <structure_L_dx //
-| <height_A_dx <structure_A_dx <nplus_succ_sn <path_head_A_dx //
-| <height_S_dx <structure_S_dx <nplus_succ_sn <path_head_S_dx //
-]
-qed.
-
-lemma path_head_structure_depth (p) (n):
- ⊗↳[n]p = ↳[♭↳[n]p]⊗p.
-#p #n
-<path_head_depth //
-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/syntax/path_height.ma".
-include "delayed_updating/syntax/path_labels.ma".
-
-(* HEIGHT FOR PATH **********************************************************)
-
-(* Constructions with labels ************************************************)
-
-lemma height_labels_L (n):
- (𝟎) = ♯(𝗟∗∗n).
-#n @(nat_ind_succ … n) -n //
-#n #IH <labels_succ <height_L_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/syntax/path.ma".
-include "delayed_updating/notation/functions/power_2.ma".
-include "ground/arith/nat_succ_iter.ma".
-
-(* *)
-
-definition labels (l) (n:nat): path ≝
- ((list_lcons ? l)^n) (𝐞).
-
-interpretation
- "labels (path)"
- 'Power l n = (labels l n).
-
-(* Basic constructions ******************************************************)
-
-lemma labels_unfold (l) (n):
- ((list_lcons ? l)^n) (𝐞) = l∗∗n.
-// qed.
-
-lemma labels_zero (l):
- (𝐞) = l∗∗𝟎.
-// qed.
-
-lemma labels_succ (l) (n):
- (l∗∗n)◖l = l∗∗(↑n).
-#l #n
-<labels_unfold <labels_unfold <niter_succ //
-qed.
-
-(* Basic inversions *********************************************************)
-
-lemma eq_inv_empty_labels (l) (n):
- (𝐞) = l∗∗n → 𝟎 = n.
-#l #n @(nat_ind_succ … n) -n //
-#n #_ <labels_succ #H0 destruct
-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/syntax/path_structure.ma".
-include "delayed_updating/syntax/path_labels.ma".
-
-(* STRUCTURE FOR PATH *******************************************************)
-
-(* Constructions with labels ************************************************)
-
-lemma structure_labels_L (n):
- (𝗟∗∗n) = ⊗(𝗟∗∗n).
-#n @(nat_ind_succ … n) -n //
-qed.
q = ↳[h]q →
♭q = ninj (▶[f](p●q)@⧣❨h❩).
#f #p #q #h #Hh
->tr_xap_ninj >(path_head_refl_append p … Hh) in ⊢ (??%?);
+>tr_xap_ninj >(path_head_refl_append_sn p … Hh) in ⊢ (??%?);
>(unwind2_rmap_head_xap_closed … Hh) -Hh
<path_head_depth //
qed.