]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/delayed_updating/unwind1/unwind_eq.ma
update in delayed_updating
[helm.git] / matita / matita / contribs / lambdadelta / delayed_updating / unwind1 / 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/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".
19
20 (* UNWIND FOR PATH **********************************************************)
21
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.
24
25 interpretation
26   "extensional equivalence (unwind continuation)"
27   'RingEq A k1 k2 = (unwind_exteq A k1 k2).
28
29 (* Constructions with unwind_exteq ******************************************)
30
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 <unwind_d_empty <(tr_pap_eq_repl … Hf)
37   /2 width=1 by stream_eq_refl/
38 | <unwind_d_lcons <unwind_d_lcons
39   /5 width=1 by tr_uni_eq_repl, tr_pap_eq_repl, eq_f/ 
40 | /2 width=1 by/
41 | /3 width=1 by tr_push_eq_repl/
42 | /3 width=1 by/
43 | /3 width=1 by/
44 ]
45 qed-.
46
47 (* Advanced constructions ***************************************************)
48
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❩.
51 #A #k #f #p #l #Hk
52 @unwind_eq_repl // #g1 #g2 #p2 #Hg @Hk -Hk // (**) (* auto fail *)
53 qed.
54
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 *)
60 qed.
61
62 (* Advanced constructions with proj_path ************************************)
63
64 lemma proj_path_proper:
65       proj_path ≗ proj_path.
66 // qed.
67
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.
71
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 <unwind_d_lcons <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 //
83 ]
84 qed.
85
86 lemma unwind_path_lcons (f) (p) (l):
87       l◗▼[f]p = ▼❨(λg,p. proj_path g (l◗p)), f, p❩.
88 #f #p #l
89 >unwind_lcons_alt <unwind_path_append_sn //
90 qed.
91
92 lemma unwind_path_L_sn (f) (p):
93       (𝗟◗▼[⫯f]p) = ▼[f](𝗟◗p).
94 // qed.
95
96 lemma unwind_path_A_sn (f) (p):
97       (𝗔◗▼[f]p) = ▼[f](𝗔◗p).
98 // qed.
99
100 lemma unwind_path_S_sn (f) (p):
101       (𝗦◗▼[f]p) = ▼[f](𝗦◗p).
102 // qed.
103
104 lemma unwind_path_after_id_sn (p) (f):
105       ▼[𝐢]▼[f]p = ▼[f]p.
106 #p @(path_ind_unwind … p) -p // [ #n | #n #l #p | #p ] #IH #f
107 [ <unwind_path_d_empty //
108 | <unwind_path_d_lcons //
109 | <unwind_path_L_sn <unwind_path_L_sn //
110 ]
111 qed.