]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/delayed_updating/unwind2/unwind_eq.ma
WIP in delayed_updating
[helm.git] / matita / matita / contribs / lambdadelta / delayed_updating / unwind2 / unwind_eq.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/unwind2/unwind.ma".
16 include "ground/relocation/tr_uni_compose.ma".
17 include "ground/relocation/tr_compose_compose.ma".
18 include "ground/relocation/tr_compose_eq.ma".
19 include "ground/relocation/tr_pn_eq.ma".
20
21 (* UNWIND FOR PATH **********************************************************)
22
23 definition unwind_exteq (A): relation2 (unwind_continuation A) (unwind_continuation A) ≝
24            λk1,k2. ∀f1,f2,p. f1 ≗ f2 → k1 f1 p = k2 f2 p.
25
26 interpretation
27   "extensional equivalence (unwind continuation)"
28   'RingEq A k1 k2 = (unwind_exteq A k1 k2).
29
30 (* Constructions with unwind_exteq ******************************************)
31
32 lemma unwind_eq_repl (A) (p) (k1) (k2):
33       k1 ≗{A} k2 → stream_eq_repl … (λf1,f2. ▼❨k1, f1, p❩ = ▼❨k2, f2, p❩).
34 #A #p @(path_ind_unwind … p) -p [| #n #IH | #n #l0 #q #IH |*: #q #IH ]
35 #k1 #k2 #Hk #f1 #f2 #Hf
36 [ <unwind_empty <unwind_empty /2 width=1 by/
37 | <unwind_d_empty_sn <unwind_d_empty_sn <(tr_pap_eq_repl … Hf)
38   /3 width=1 by tr_compose_eq_repl, stream_eq_refl/
39 | <unwind_d_lcons_sn <unwind_d_lcons_sn
40   /3 width=1 by tr_compose_eq_repl, stream_eq_refl/
41 | /2 width=1 by/
42 | /3 width=1 by tr_push_eq_repl/
43 | /3 width=1 by/
44 | /3 width=1 by/
45 ]
46 qed-.
47
48 (* Advanced constructions ***************************************************)
49
50 lemma unwind_lcons_alt (A) (k) (f) (p) (l): k ≗ k →
51       ▼❨λg,p2. k g (l◗p2), f, p❩ = ▼{A}❨λg,p2. k g ((l◗𝐞)●p2), f, p❩.
52 #A #k #f #p #l #Hk
53 @unwind_eq_repl // #g1 #g2 #p2 #Hg @Hk -Hk // (**) (* auto fail *)
54 qed.
55
56 lemma unwind_append_rcons_sn (A) (k) (f) (p1) (p) (l): k ≗ k →
57       ▼❨λg,p2. k g (p1●l◗p2), f, p❩ = ▼{A}❨λg,p2. k g (p1◖l●p2), f, p❩.
58 #A #k #f #p1 #p #l #Hk
59 @unwind_eq_repl // #g1 #g2 #p2 #Hg
60 <list_append_rcons_sn @Hk -Hk // (**) (* auto fail *)
61 qed.
62
63 (* Advanced constructions with proj_path ************************************)
64
65 lemma proj_path_proper:
66       proj_path ≗ proj_path.
67 // qed.
68
69 lemma unwind_path_eq_repl (p):
70       stream_eq_repl … (λf1,f2. ▼[f1]p = ▼[f2]p).
71 /2 width=1 by unwind_eq_repl/ qed.
72
73 lemma unwind_path_append_sn (p) (f) (q):
74       q●▼[f]p = ▼❨(λg,p. proj_path g (q●p)), f, p❩.
75 #p @(path_ind_unwind … p) -p // [ #n #l #p |*: #p ] #IH #f #q
76 [ <unwind_d_lcons_sn <unwind_d_lcons_sn <IH -IH //
77 | <unwind_m_sn <unwind_m_sn //
78 | <unwind_L_sn <unwind_L_sn >unwind_lcons_alt // >unwind_append_rcons_sn //
79   <IH <IH -IH <list_append_rcons_sn //
80 | <unwind_A_sn <unwind_A_sn >unwind_lcons_alt >unwind_append_rcons_sn //
81   <IH <IH -IH <list_append_rcons_sn //
82 | <unwind_S_sn <unwind_S_sn >unwind_lcons_alt >unwind_append_rcons_sn //
83   <IH <IH -IH <list_append_rcons_sn //
84 ]
85 qed.
86
87 lemma unwind_path_lcons (f) (p) (l):
88       l◗▼[f]p = ▼❨(λg,p. proj_path g (l◗p)), f, p❩.
89 #f #p #l
90 >unwind_lcons_alt <unwind_path_append_sn //
91 qed.
92
93 lemma unwind_path_L_sn (f) (p):
94       (𝗟◗▼[⫯f]p) = ▼[f](𝗟◗p).
95 // qed.
96
97 lemma unwind_path_A_sn (f) (p):
98       (𝗔◗▼[f]p) = ▼[f](𝗔◗p).
99 // qed.
100
101 lemma unwind_path_S_sn (f) (p):
102       (𝗦◗▼[f]p) = ▼[f](𝗦◗p).
103 // qed.
104
105 lemma unwind_path_after (p) (f1) (f2):
106       ▼[f2]▼[f1]p = ▼[f2∘f1]p.
107 #p @(path_ind_unwind … p) -p // [ #n #l #p | #p ] #IH #f1 #f2
108 [ <unwind_path_d_lcons_sn <unwind_path_d_lcons_sn
109   >(unwind_path_eq_repl … (tr_compose_assoc …)) //
110 | <unwind_path_L_sn <unwind_path_L_sn <unwind_path_L_sn
111   >tr_compose_push_bi //
112 ]
113 qed.
114
115 (* Advanced constructions with proj_rmap and stream_tls *********************)
116
117 lemma unwind_rmap_tls_d_dx (f) (p) (m) (n):
118       ⇂*[m+n]▼[p]f ≗ ⇂*[m]▼[p◖𝗱n]f.
119 #f #p #m #n
120 <unwind_rmap_d_dx >nrplus_inj_dx
121 /2 width=1 by tr_tls_compose_uni_dx/
122 qed.