1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "delayed_updating/unwind/unwind2_rmap_eq.ma".
16 include "delayed_updating/syntax/path_closed.ma".
17 include "delayed_updating/syntax/path_depth.ma".
18 include "ground/relocation/xap.ma".
19 include "ground/lib/stream_tls_plus.ma".
20 include "ground/lib/stream_eq_eq.ma".
21 include "ground/arith/nat_le_plus.ma".
22 include "ground/arith/nat_le_pred.ma".
24 (* TAILED UNWIND FOR RELOCATION MAP *****************************************)
26 (* Destructions with cpp ****************************************************)
28 lemma xap_le_unwind2_rmap_append_closed_dx (o) (f) (p) (q) (n):
29 q ϵ 𝐂❨o,n❩ → ∀m. m ≤ n →
30 ▶[f]q@❨m❩ = ▶[f](p●q)@❨m❩.
31 #o #f #p #q #n #Hq elim Hq -q -n
32 [|*: #q #n [ #k #_ ] #_ #IH ] #m #Hm
33 [ <(nle_inv_zero_dx … Hm) -m //
34 | <unwind2_rmap_d_dx <unwind2_rmap_d_dx
35 <tr_compose_xap <tr_compose_xap
36 @IH -IH (**) (* auto too slow *)
37 @nle_trans [| @tr_uni_xap ]
38 /2 width=1 by nle_plus_bi_dx/
39 | <unwind2_rmap_m_dx <unwind2_rmap_m_dx
41 | <unwind2_rmap_L_dx <unwind2_rmap_L_dx
42 elim (nle_inv_succ_dx … Hm) -Hm // * #Hm #H0
43 >H0 -H0 <tr_xap_push <tr_xap_push
45 | <unwind2_rmap_A_dx <unwind2_rmap_A_dx
47 | <unwind2_rmap_S_dx <unwind2_rmap_S_dx
52 lemma nap_unwind2_rmap_append_closed_Lq_dx (o) (f) (p) (q) (n):
54 ▶[f](𝗟◗q)@§❨n❩ = ▶[f](p●𝗟◗q)@§❨n❩.
56 lapply (pcc_L_sn … Hq) -Hq #Hq
57 lapply (xap_le_unwind2_rmap_append_closed_dx o f p … Hq (↑n) ?) -Hq //
58 <tr_xap_succ_nap <tr_xap_succ_nap #Hq
59 /2 width=1 by eq_inv_nsucc_bi/
62 lemma nap_unwind2_rmap_push_closed_depth (o) (f) (q) (n):
65 #o #f #q #n #Hq elim Hq -q -n
66 [|*: #q #n [ #k #_ ] #_ #IH ] //
67 <unwind2_rmap_d_dx <tr_compose_nap //
70 lemma nap_unwind2_rmap_append_closed_Lq_dx_depth (o) (f) (p) (q) (n):
72 ♭q = ▶[f](p●𝗟◗q)@§❨n❩.
74 <nap_unwind2_rmap_append_closed_Lq_dx //
75 /2 width=2 by nap_unwind2_rmap_push_closed_depth/
78 lemma xap_unwind2_rmap_append_closed_true_dx_depth (f) (p) (q) (n):
79 q ϵ 𝐂❨Ⓣ,n❩ → ♭q = ▶[f](p●q)@❨n❩.
80 #f #p #q #n #Hq elim Hq -q -n //
82 <unwind2_rmap_d_dx <tr_compose_xap
83 >Ho // <tr_uni_xap_succ <Ho //
86 lemma tls_succ_plus_unwind2_rmap_push_closed (o) (f) (q) (n):
88 ∀m. ⇂*[m]f ≗ ⇂*[↑(m+n)]▶[⫯f]q.
89 #o #f #q #n #Hq elim Hq -q -n //
91 @(stream_eq_trans … (tls_unwind2_rmap_d_dx …))
92 >nrplus_inj_dx >nrplus_inj_sn >nsucc_unfold //
95 lemma tls_plus_unwind2_rmap_closed_true (f) (q) (n):
97 ∀m. ⇂*[m]f ≗ ⇂*[m+n]▶[f]q.
98 #f #q #n #Hq elim Hq -q -n //
99 #q #n #k #Ho #_ #IH #m
100 >Ho // <nplus_succ_dx
101 @(stream_eq_trans … (tls_unwind2_rmap_d_dx …))
102 >nrplus_inj_dx >nrplus_inj_sn >nsucc_unfold
103 >nplus_succ_dx <Ho //
106 lemma tls_succ_unwind2_rmap_append_closed_Lq_dx (o) (f) (p) (q) (n):
108 ▶[f]p ≗ ⇂*[↑n]▶[f](p●𝗟◗q).
109 /2 width=2 by tls_succ_plus_unwind2_rmap_push_closed/
112 lemma tls_unwind2_rmap_append_closed_true_dx (f) (p) (q) (n):
114 ▶[f]p ≗ ⇂*[n]▶[f](p●q).
115 /2 width=1 by tls_plus_unwind2_rmap_closed_true/
118 lemma nap_plus_unwind2_rmap_append_closed_Lq_dx_depth (o) (f) (p) (q) (m) (n):
120 ▶[f]p@❨m❩+♭q = ▶[f](p●𝗟◗q)@§❨m+n❩.
121 #o #f #p #q #m #n #Hq
123 [ <(tr_xap_eq_repl … (tls_succ_unwind2_rmap_append_closed_Lq_dx …)) //
124 | /2 width=2 by nap_unwind2_rmap_append_closed_Lq_dx_depth/
128 lemma nap_plus_unwind2_rmap_append_closed_bLq_dx_depth (o) (f) (p) (b) (q) (m) (n):
129 b ϵ 𝐂❨Ⓣ,m❩ → q ϵ 𝐂❨o,n❩ →
130 ♭b+♭q = ▶[f](p●b●𝗟◗q)@§❨m+n❩.
131 #o #f #p #b #q #m #n #Hb #Hq
132 >(xap_unwind2_rmap_append_closed_true_dx_depth f p … Hb) -Hb
133 >(nap_plus_unwind2_rmap_append_closed_Lq_dx_depth … Hq) -Hq //
136 lemma tls_succ_plus_unwind2_rmap_append_closed_bLq_dx (o) (f) (p) (b) (q) (m) (n):
137 b ϵ 𝐂❨Ⓣ,m❩ → q ϵ 𝐂❨o,n❩ →
138 ▶[f]p ≗ ⇂*[↑(m+n)]▶[f](p●b●𝗟◗q).
139 #o #f #p #b #q #m #n #Hb #Hq
140 >nplus_succ_dx <stream_tls_plus >list_append_assoc
141 @(stream_eq_trans … (tls_unwind2_rmap_append_closed_true_dx … Hb)) -Hb
142 /3 width=2 by stream_tls_eq_repl, tls_succ_unwind2_rmap_append_closed_Lq_dx/