]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/delayed_updating/unwind/unwind2_rmap_head.ma
update in delayed_updating
[helm.git] / matita / matita / contribs / lambdadelta / delayed_updating / unwind / unwind2_rmap_head.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_labels.ma".
16 include "delayed_updating/unwind/xap.ma".
17 include "delayed_updating/syntax/path_head_depth.ma".
18 include "ground/arith/nat_le_plus.ma".
19
20 (* UNWIND MAP FOR PATH ******************************************************)
21
22 (* Constructions with path_head *********************************************)
23
24 lemma unwind2_rmap_head_xap_closed (f) (p) (n) (k):
25       (∃q. p = (↳[n]p)●q) → k ≤ n →
26       (▶[f]p)@❨k❩ = (▶[f]↳[n]p)@❨k❩.
27 #f #p elim p -p
28 [ #n #k * #q #Hq #Hk
29   elim (eq_inv_list_empty_append … Hq) -Hq * #_ //
30 | #l #p #IH #n @(nat_ind_succ … n) -n
31   [ #k #_ #Hk <(nle_inv_zero_dx … Hk) -k -IH
32    <path_head_zero <unwind2_rmap_empty //
33   | #n #_ #k cases l [ #m ] * #q
34     [ <path_head_d_sn <list_append_lcons_sn #Hq #Hk
35       elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
36       <unwind2_rmap_d_sn <unwind2_rmap_d_sn
37       <tr_compose_xap <tr_compose_xap
38       @IH [ /2 width=2 by ex_intro/ ] (**) (* auto too slow *)
39       @nle_trans [| @tr_uni_xap ]
40       /2 width=1 by nle_plus_bi_dx/
41     | <path_head_m_sn <list_append_lcons_sn #Hq #Hk
42       elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
43       <unwind2_rmap_m_sn <unwind2_rmap_m_sn
44       /3 width=2 by ex_intro/
45     | <path_head_L_sn <list_append_lcons_sn #Hq
46       @(nat_ind_succ … k) -k // #k #_ #Hk
47       lapply (nle_inv_succ_bi … Hk) -Hk #Hk
48       elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
49       <unwind2_rmap_L_sn <unwind2_rmap_L_sn
50       <tr_xap_push <tr_xap_push
51       /4 width=2 by ex_intro, eq_f/
52     | <path_head_A_sn <list_append_lcons_sn #Hq #Hk
53       elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
54       <unwind2_rmap_A_sn <unwind2_rmap_A_sn
55       /3 width=2 by ex_intro/
56     | <path_head_S_sn <list_append_lcons_sn #Hq #Hk
57       elim (eq_inv_list_lcons_bi ????? Hq) -Hq #_ #Hq
58       <unwind2_rmap_S_sn <unwind2_rmap_S_sn
59       /3 width=2 by ex_intro/
60     ]
61   ]
62 ]
63 qed-.
64
65 lemma unwind2_rmap_head_xap (f) (p) (n):
66       n + ♯(↳[n]p) = (▶[f]↳[n]p)@❨n❩.
67 #f #p elim p -p
68 [ #n <path_head_empty <unwind2_rmap_labels_L <height_labels_L
69   <tr_xap_pushs_le //
70 | #l #p #IH #n @(nat_ind_succ … n) -n //
71   #n #_ cases l [ #m ]
72   [ <unwind2_rmap_d_sn <path_head_d_sn <height_d_sn
73     <nplus_assoc >IH -IH <tr_compose_xap <tr_uni_xap_succ //
74   | <unwind2_rmap_m_sn <path_head_m_sn <height_m_sn //
75   | <unwind2_rmap_L_sn <path_head_L_sn <height_L_sn
76     <tr_xap_push <npred_succ //
77   | <unwind2_rmap_A_sn <path_head_A_sn <height_A_sn //
78   | <unwind2_rmap_S_sn <path_head_S_sn <height_S_sn //
79   ]
80 ]
81 qed.