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/unwind1/unwind.ma".
16 include "ground/relocation/tr_uni_eq.ma".
17 include "ground/relocation/tr_pap_eq.ma".
18 include "ground/relocation/tr_pn_eq.ma".
20 (* UNWIND FOR PATH **********************************************************)
22 definition unwind_exteq (A): relation2 (unwind_continuation A) (unwind_continuation A) ≝
23 λk1,k2. ∀f1,f2,p. f1 ≗ f2 → k1 f1 p = k2 f2 p.
26 "extensional equivalence (unwind continuation)"
27 'RingEq A k1 k2 = (unwind_exteq A k1 k2).
29 (* Constructions with unwind_exteq ******************************************)
31 lemma unwind_eq_repl (A) (p) (k1) (k2):
32 k1 ≗{A} k2 → stream_eq_repl … (λf1,f2. ▼❨k1, f1, p❩ = ▼❨k2, f2, p❩).
33 #A #p @(path_ind_unwind … p) -p [| #n #IH | #n #l0 #q #IH |*: #q #IH ]
34 #k1 #k2 #Hk #f1 #f2 #Hf
35 [ <unwind_empty <unwind_empty /2 width=1 by/
36 | <unwind_d_empty_sn <unwind_d_empty_sn <(tr_pap_eq_repl … Hf)
37 /2 width=1 by stream_eq_refl/
38 | <unwind_d_lcons_sn <unwind_d_lcons_sn
39 /5 width=1 by tr_uni_eq_repl, tr_pap_eq_repl, eq_f/
41 | /3 width=1 by tr_push_eq_repl/
47 (* Advanced constructions ***************************************************)
49 lemma unwind_lcons_alt (A) (k) (f) (p) (l): k ≗ k →
50 ▼❨λg,p2. k g (l◗p2), f, p❩ = ▼{A}❨λg,p2. k g ((l◗𝐞)●p2), f, p❩.
52 @unwind_eq_repl // #g1 #g2 #p2 #Hg @Hk -Hk // (**) (* auto fail *)
55 lemma unwind_append_rcons_sn (A) (k) (f) (p1) (p) (l): k ≗ k →
56 ▼❨λg,p2. k g (p1●l◗p2), f, p❩ = ▼{A}❨λg,p2. k g (p1◖l●p2), f, p❩.
57 #A #k #f #p1 #p #l #Hk
58 @unwind_eq_repl // #g1 #g2 #p2 #Hg
59 <list_append_rcons_sn @Hk -Hk // (**) (* auto fail *)
62 (* Advanced constructions with proj_path ************************************)
64 lemma proj_path_proper:
65 proj_path ≗ proj_path.
68 lemma unwind_path_eq_repl (p):
69 stream_eq_repl … (λf1,f2. ▼[f1]p = ▼[f2]p).
70 /2 width=1 by unwind_eq_repl/ qed.
72 lemma unwind_path_append_sn (p) (f) (q):
73 q●▼[f]p = ▼❨(λg,p. proj_path g (q●p)), f, p❩.
74 #p @(path_ind_unwind … p) -p // [ #n #l #p |*: #p ] #IH #f #q
75 [ <unwind_d_lcons_sn <unwind_d_lcons_sn <IH -IH //
76 | <unwind_m_sn <unwind_m_sn //
77 | <unwind_L_sn <unwind_L_sn >unwind_lcons_alt // >unwind_append_rcons_sn //
78 <IH <IH -IH <list_append_rcons_sn //
79 | <unwind_A_sn <unwind_A_sn >unwind_lcons_alt >unwind_append_rcons_sn //
80 <IH <IH -IH <list_append_rcons_sn //
81 | <unwind_S_sn <unwind_S_sn >unwind_lcons_alt >unwind_append_rcons_sn //
82 <IH <IH -IH <list_append_rcons_sn //
86 lemma unwind_path_lcons (f) (p) (l):
87 l◗▼[f]p = ▼❨(λg,p. proj_path g (l◗p)), f, p❩.
89 >unwind_lcons_alt <unwind_path_append_sn //
92 lemma unwind_path_L_sn (f) (p):
93 (𝗟◗▼[⫯f]p) = ▼[f](𝗟◗p).
96 lemma unwind_path_A_sn (f) (p):
97 (𝗔◗▼[f]p) = ▼[f](𝗔◗p).
100 lemma unwind_path_S_sn (f) (p):
101 (𝗦◗▼[f]p) = ▼[f](𝗦◗p).
104 lemma unwind_path_after_id_sn (p) (f):
106 #p @(path_ind_unwind … p) -p // [ #n | #n #l #p | #p ] #IH #f
107 [ <unwind_path_d_empty_sn //
108 | <unwind_path_d_lcons_sn //
109 | <unwind_path_L_sn <unwind_path_L_sn //