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