--- /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/arith/pnat_plus.ma".
+include "ground/arith/nat_rplus.ma".
+
+(* RIGHT ADDITION FOR NON-NEGATIVE INTEGERS *********************************)
+
+(* Constructions with pplus *************************************************)
+
+lemma nrplus_inj_dx (p) (q):
+ p + q = p + ninj q.
+// 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/arith/nat_plus.ma".
+include "ground/lib/stream_tls.ma".
+
+(* ITERATED TAIL FOR STREAMS ************************************************)
+
+(* Constructions with nplus *************************************************)
+
+lemma stream_tls_plus (A) (n1) (n2) (t):
+ ⇂*[n1]⇂*[n2]t = ⇂*{A}[n1+n2]t.
+#A #n1 #n2 #t
+<nplus_comm @(niter_plus … t)
+qed.
include "ground/lib/stream_tls.ma".
include "ground/relocation/tr_pap.ma".
-(* COMPOSITION FOR PARTIAL RELOCATION MAPS **********************************)
+(* COMPOSITION FOR TOTAL RELOCATION MAPS ************************************)
corec definition tr_compose: tr_map → tr_map → tr_map.
#f2 * #p1 #f1
--- /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/relocation/tr_compose_pap.ma".
+include "ground/relocation/tr_compose_tls.ma".
+include "ground/relocation/tr_eq.ma".
+
+(* COMPOSITION FOR TOTAL RELOCATION MAPS ************************************)
+
+(* Main constructions *******************************************************)
+
+corec theorem tr_compose_assoc (f3) (f2) (f1):
+ (f3 ∘ f2) ∘ f1 ≗ f3 ∘ (f2 ∘ f1).
+cases f1 -f1 #p1 #f1
+cases tr_compose_unfold cases tr_compose_unfold cases tr_compose_unfold
+cases tr_compose_tls
+/2 width=1 by stream_eq_cons/
+qed.
(* *)
(**************************************************************************)
+(*
include "ground/relocation/pstream_tls.ma".
include "ground/relocation/pstream_istot.ma".
-include "ground/relocation/rtmap_after.ma".
+*)
+include "ground/arith/pnat_plus.ma".
+include "ground/relocation/pr_after.ma".
+include "ground/relocation/tr_map.ma".
(* Properties on after (specific) *********************************************)
-lemma after_O2: ∀f2,f1,f. f2 ⊚ f1 ≘ f →
- ∀p. p⨮f2 ⊚ ⫯f1 ≘ p⨮f.
+(*** after_O2 *)
+lemma tr_after_push_dx:
+ ∀f2,f1,f. 𝐭❨f2❩ ⊚ f1 ≘ 𝐭❨f❩ →
+ ∀p. 𝐭❨p⨮f2❩ ⊚ ⫯f1 ≘ 𝐭❨p⨮f❩.
#f2 #f1 #f #Hf #p elim p -p
-/2 width=7 by gr_after_refl, gr_after_next/
+/2 width=7 by pr_after_refl, pr_after_next/
qed.
-lemma after_S2: ∀f2,f1,f,p1,p. f2 ⊚ p1⨮f1 ≘ p⨮f →
- ∀p2. p2⨮f2 ⊚ ↑p1⨮f1 ≘ (p+p2)⨮f.
+(*** after_S2 *)
+lemma tr_after_next_dx:
+ ∀f2,f1,f,p1,p. 𝐭❨f2❩ ⊚ 𝐭❨p1⨮f1❩ ≘ 𝐭❨p⨮f❩ →
+ ∀p2. 𝐭❨p2⨮f2❩ ⊚ 𝐭❨↑p1⨮f1❩ ≘ 𝐭❨(p+p2)⨮f❩.
#f2 #f1 #f #p1 #p #Hf #p2 elim p2 -p2
-/2 width=7 by gr_after_next, gr_after_push/
+/2 width=7 by pr_after_next, pr_after_push/
qed.
-lemma after_apply: ∀p1,f2,f1,f.
- (⫰*[ninj p1] f2) ⊚ f1 ≘ f → f2 ⊚ p1⨮f1 ≘ f2@❨p1❩⨮f.
+include "ground/lib/stream_tls.ma".
+include "ground/relocation/tr_pap.ma".
+
+(*** after_apply *)
+lemma tr_after_pap:
+ ∀p1,f2,f1,f. 𝐭❨⇂*[ninj p1]f2❩ ⊚ 𝐭❨f1❩ ≘ 𝐭❨f❩ →
+ (𝐭❨f2❩) ⊚ 𝐭❨p1⨮f1❩ ≘ 𝐭❨f2@❨p1❩⨮f❩.
#p1 elim p1 -p1
-[ * /2 width=1 by after_O2/
+[ * /2 width=1 by tr_after_push_dx/
| #p1 #IH * #p2 #f2 >nsucc_inj <stream_tls_swap
- /3 width=1 by after_S2/
+ /3 width=1 by tr_after_next_dx/
]
qed-.
-corec lemma after_total_aux: ∀f2,f1,f. f2 ∘ f1 = f → f2 ⊚ f1 ≘ f.
+include "ground/relocation/tr_compose_pn.ma".
+
+(*** after_total_aux *)
+corec fact tr_after_total_aux:
+ ∀f2,f1,f. f2 ∘ f1 = f → 𝐭❨f2❩ ⊚ 𝐭❨f1❩ ≘ 𝐭❨f❩.
* #p2 #f2 * #p1 #f1 * #p #f cases p2 -p2
[ cases p1 -p1
- [ #H cases (compose_inv_O2 … H) -H /3 width=7 by gr_after_refl, eq_f2/
- | #p1 #H cases (compose_inv_S2 … H) -H * -p /3 width=7 by gr_after_push/
+ [ #H cases (tr_compose_inv_push_dx … H) -H /3 width=7 by pr_after_refl, eq_f2/
+ | #p1 #H cases (tr_compose_inv_succ_dx … H) -H * -p /3 width=7 by pr_after_push/
]
-| #p2 >gr_next_unfold #H cases (compose_inv_S1 … H) -H * -p >gr_next_unfold
- /3 width=5 by gr_after_next/
+| #p2 >tr_next_unfold #H cases (tr_compose_inv_next_sn … H) -H * -p
+ /3 width=5 by pr_after_next/
]
qed-.
-theorem after_total: ∀f1,f2. f2 ⊚ f1 ≘ f2 ∘ f1.
-/2 width=1 by after_total_aux/ qed.
+(*** after_total *)
+theorem tr_after_total:
+ ∀f1,f2. 𝐭❨f2❩ ⊚ 𝐭❨f1❩ ≘ 𝐭❨f2 ∘ f1❩.
+/2 width=1 by tr_after_total_aux/ qed.
(* Inversion lemmas on after (specific) ***************************************)
(p2⨮f2)@❨p1❩ = p ∧ (⫰*[↓p1]f2) ⊚ f1 ≘ f.
/3 width=3 by after_fwd_tls, after_fwd_hd, conj/ qed-.
-(* Properties on apply ******************************************************)
-
-lemma compose_apply (f2) (f1) (i): f2@❨f1@❨i❩❩ = (f2∘f1)@❨i❩.
-/4 width=6 by gr_after_des_pat, at_inv_total, sym_eq/ 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/relocation/tr_compose.ma".
+include "ground/relocation/tr_pap_tls.ma".
+
+(* COMPOSITION FOR TOTAL RELOCATION MAPS ************************************)
+
+(* Constructions with tr_pap ************************************************)
+
+(*** compose_apply *)
+lemma tr_compose_pap (i) (f1) (f2):
+ f2@❨f1@❨i❩❩ = (f2∘f1)@❨i❩.
+#i elim i -i
+[ * #p1 #f1 #f2
+ <tr_compose_unfold <tr_pap_unit <tr_pap_unit //
+| #i #IH * #p1 #f1 #f2
+ <tr_compose_unfold <tr_pap_succ <tr_pap_succ //
+]
+qed.
include "ground/relocation/tr_pap_pn.ma".
include "ground/relocation/tr_compose.ma".
-(* COMPOSITION FOR PARTIAL RELOCATION MAPS **********************************)
+(* COMPOSITION FOR TOTAL RELOCATION MAPS ************************************)
-(* Constructions with tr_push anf tr_next ***********************************)
+(* Constructions with tr_push and tr_next ***********************************)
+lemma tr_compose_push_bi (f2) (f1):
+ (⫯(f2∘f1)) = (⫯f2)∘(⫯f1).
+#f2 #f1
+<tr_compose_unfold //
+qed.
+
+lemma tr_compose_push_next (f2) (f1):
+ ↑(f2∘f1) = (⫯f2)∘(↑f1).
+#f2 * #p1 #f1
+<tr_next_unfold <tr_compose_unfold <tr_compose_unfold <tr_next_unfold
+<tr_pap_push >nsucc_inj //
+qed.
+
+(* Note: to be removed *)
(*** compose_next *)
-lemma tr_compose_next_sn (f2) (f1):
- ∀f. f2∘f1 = f → (↑f2)∘f1 = ↑f.
+fact tr_compose_next_sn_aux (f2) (f1):
+ ∀f. f2∘f1 = f → (↑f2)∘f1 = ↑f.
#f2 * #p1 #f1 #f
<tr_compose_unfold <tr_compose_unfold * -f
<tr_pap_next
/3 width=1 by compose_repl_fwd_dx/
-qed.
+qed-.
+
+lemma tr_compose_next_sn (f2) (f1):
+ ↑(f2∘f1) = (↑f2)∘f1.
+/2 width=1 by tr_compose_next_sn_aux/ qed.
-(* Inversions with tr_push anf tr_next **************************************)
+(* Inversions with tr_push and tr_next **************************************)
(*** compose_inv_O2 *)
lemma tr_compose_inv_push_dx (f2) (f1):
--- /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/relocation/tr_compose.ma".
+include "ground/lib/stream_tls_plus.ma".
+include "ground/arith/nat_plus_rplus.ma".
+include "ground/arith/nat_rplus_pplus.ma".
+
+(* COMPOSITION FOR TOTAL RELOCATION MAPS ************************************)
+
+(* Advanced constructions with stream_tls ***********************************)
+
+lemma tr_compose_tls (i) (f2) (f1):
+ (⇂*[f1@❨i❩]f2)∘⇂*[i]f1 = ⇂*[i](f2∘f1).
+#i elim i -i
+[ #f2 * #p1 #f1 //
+| #i #IH #f2 * #p1 #f1
+ >nsucc_inj <stream_tls_swap <stream_tls_swap
+ <tr_pap_succ >nrplus_inj_dx >nrplus_inj_sn
+ <tr_compose_unfold <IH -IH //
+]
+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/relocation/tr_pap.ma".
+include "ground/lib/stream_tls.ma".
+
+(* POSITIVE APPLICATION FOR TOTAL RELOCATION MAPS ***************************)
+
+(* Constructions with stream_tls ********************************************)
+
+lemma tr_pap_plus (i1) (i2) (f):
+ (⇂*[ninj i2]f)@❨i1❩+f@❨i2❩ = f@❨i1+i2❩.
+#i1 #i2 elim i2 -i2
+[ * #p #f //
+| #i #IH * #p #f
+ <pplus_succ_dx <tr_pap_succ <tr_pap_succ
+ <IH -IH >nsucc_inj //
+]
+qed.
[ { "total relocation" * } {
[ "tr_uni ( 𝐮❨?❩ )" * ]
[ "tr_id ( 𝐢 ) " "tr_id_pushs" "tr_id_pap" * ]
- [ "tr_compose ( ?∘? )" "tr_compose_pn" * ]
- [ "tr_pap ( ?@❨?❩ )" "tr_pap_eq" "tr_pap_pat" "tr_pap_pn" "tr_pap_pushs" "tr_pap_pap" * ]
+ [ "tr_compose ( ?∘? )" "tr_compose_tls" "tr_compose_pn" "tr_compose_pap" "tr_compose_compose" * ]
+ [ "tr_pap ( ?@❨?❩ )" "tr_pap_eq" "tr_pap_tls" "tr_pap_pat" "tr_pap_pn" "tr_pap_pushs" "tr_pap_pap" * ]
[ "tr_pushs ( ⫯*[?]? )" * ]
[ "tr_pn ( ⫯? ) ( ↑? )" "tr_pn_hdtl" "tr_pn_tls" * ]
[ "tr_map ( 𝐭❨?❩ )" "tr_eq" "tr_nexts" "tr_pat" "tr_ist" * ]
[ "nat_max ( ?∨? )" * ]
[ "nat_minus ( ?-? )" "nat_minus_plus" * ]
[ "nat_plus ( ?+? )" "nat_plus_pred" "nat_plus_rplus" * ]
- [ "nat_rplus ( ?+? )" "nat_rplus_succ" * ]
+ [ "nat_rplus ( ?+? )" "nat_rplus_pplus" "nat_rplus_succ" * ]
[ "nat_pred ( ↓? )" "nat_pred_succ" * ]
[ "nat_succ ( ↑? )" "nat_succ_iter" "nat_succ_tri" * ]
[ "nat ( 𝟎 )" "nat_iter ( ?^{?}? )" *"nat_tri" ]
class "yellow"
[ { "extensions to the library" * } {
[ { "streams" * } {
- [ "stream_tls ( ⇂*{?}[?]? )" "stream_tls_eq" * ]
+ [ "stream_tls ( ⇂*{?}[?]? )" "stream_tls_eq" "stream_tls_plus" * ]
[ "stream_hdtl ( ⇃{?}? ) ( ⇂{?}? )" * ]
[ "stream_eq ( ? ≗{?} ? )" "stream_eq_eq" * ]
[ "stream ( ? ⨮{?} ? )" * ]