]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/delayed_updating/unwind/unwind2_rmap_closed.ma
update in delayed_updating
[helm.git] / matita / matita / contribs / lambdadelta / delayed_updating / unwind / unwind2_rmap_closed.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
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".
23
24 (* TAILED UNWIND FOR RELOCATION MAP *****************************************)
25
26 (* Destructions with cpp ****************************************************)
27
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
40   /2 width=2 by/
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
44   /3 width=2 by eq_f/
45 | <unwind2_rmap_A_dx <unwind2_rmap_A_dx
46   /2 width=2 by/
47 | <unwind2_rmap_S_dx <unwind2_rmap_S_dx
48   /2 width=2 by/
49 ]
50 qed-.
51
52 lemma nap_unwind2_rmap_append_closed_Lq_dx (o) (f) (p) (q) (n):
53       q ϵ 𝐂❨o,n❩ →
54       ▶[f](𝗟◗q)@§❨n❩ = ▶[f](p●𝗟◗q)@§❨n❩.
55 #o #f #p #q #n #Hq
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/
60 qed-.
61
62 lemma nap_unwind2_rmap_push_closed_depth (o) (f) (q) (n):
63       q ϵ 𝐂❨o,n❩ →
64       ♭q = ▶[⫯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 //
68 qed-.
69
70 lemma nap_unwind2_rmap_append_closed_Lq_dx_depth (o) (f) (p) (q) (n):
71       q ϵ 𝐂❨o,n❩ →
72       ♭q = ▶[f](p●𝗟◗q)@§❨n❩.
73 #o #f #p #q #n #Hq
74 <nap_unwind2_rmap_append_closed_Lq_dx //
75 /2 width=2 by nap_unwind2_rmap_push_closed_depth/
76 qed-.
77
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 //
81 #q #n #k #Ho #_ #IH
82 <unwind2_rmap_d_dx <tr_compose_xap
83 >Ho // <tr_uni_xap_succ <Ho //
84 qed-.
85
86 lemma tls_succ_plus_unwind2_rmap_push_closed (o) (f) (q) (n):
87       q ϵ 𝐂❨o,n❩ →
88       ∀m. ⇂*[m]f ≗ ⇂*[↑(m+n)]▶[⫯f]q.
89 #o #f #q #n #Hq elim Hq -q -n //
90 #q #n #k #_ #_ #IH #m
91 @(stream_eq_trans … (tls_unwind2_rmap_d_dx …))
92 >nrplus_inj_dx >nrplus_inj_sn >nsucc_unfold //
93 qed-.
94
95 lemma tls_plus_unwind2_rmap_closed_true (f) (q) (n):
96       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 //
104 qed-.
105
106 lemma tls_succ_unwind2_rmap_append_closed_Lq_dx (o) (f) (p) (q) (n):
107       q ϵ 𝐂❨o,n❩ →
108       ▶[f]p ≗ ⇂*[↑n]▶[f](p●𝗟◗q).
109 /2 width=2 by tls_succ_plus_unwind2_rmap_push_closed/
110 qed-.
111
112 lemma tls_unwind2_rmap_append_closed_true_dx (f) (p) (q) (n):
113       q ϵ 𝐂❨Ⓣ,n❩ →
114       ▶[f]p ≗ ⇂*[n]▶[f](p●q).
115 /2 width=1 by tls_plus_unwind2_rmap_closed_true/
116 qed-.
117
118 lemma nap_plus_unwind2_rmap_append_closed_Lq_dx_depth (o) (f) (p) (q) (m) (n):
119       q ϵ 𝐂❨o,n❩ →
120       ▶[f]p@❨m❩+♭q = ▶[f](p●𝗟◗q)@§❨m+n❩.
121 #o #f #p #q #m #n #Hq
122 <tr_nap_plus @eq_f2
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/
125 ]
126 qed-.
127
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 //
134 qed-.
135
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/
143 qed-.