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 "ground/notation/functions/upspoon_1.ma".
16 include "ground/lib/stream.ma".
17 include "ground/arith/pnat.ma".
19 (* RELOCATION P-STREAM ******************************************************)
21 definition gr_map: Type[0] ≝ stream pnat.
23 definition gr_push: gr_map → gr_map ≝ λf. 𝟏⨮f.
25 interpretation "push (pstream)" 'UpSpoon f = (gr_push f).
27 definition gr_next: gr_map → gr_map.
31 interpretation "next (pstream)" 'UpArrow f = (gr_next f).
33 (* Basic properties *********************************************************)
35 lemma gr_push_unfold: ∀f. 𝟏⨮f = ⫯f.
38 lemma gr_next_unfold: ∀f,p. (↑p)⨮f = ↑(p⨮f).
41 (* Basic inversion lemmas ***************************************************)
43 lemma eq_inv_gr_push_bi: injective ? ? gr_push.
44 #f1 #f2 <gr_push_unfold <gr_push_unfold #H destruct //
47 lemma eq_inv_gr_push_next: ∀f1,f2. ⫯f1 = ↑f2 → ⊥.
48 #f1 * #p2 #f2 <gr_push_unfold <gr_next_unfold #H destruct
51 lemma eq_inv_gr_next_push: ∀f1,f2. ↑f1 = ⫯f2 → ⊥.
52 * #p1 #f1 #f2 <gr_next_unfold <gr_push_unfold #H destruct
55 lemma eq_inv_gr_next_bi: injective ? ? gr_next.
56 * #p1 #f1 * #p2 #f2 <gr_next_unfold <gr_next_unfold #H destruct //
59 lemma push_inv_seq_sn: ∀f,g,p. p⨮g = ⫯f → ∧∧ 𝟏 = p & g = f.
60 #f #g #p <gr_push_unfold #H destruct /2 width=1 by conj/
63 lemma push_inv_seq_dx: ∀f,g,p. ⫯f = p⨮g → ∧∧ 𝟏 = p & g = f.
64 #f #g #p <gr_push_unfold #H destruct /2 width=1 by conj/
67 lemma next_inv_seq_sn: ∀f,g,p. p⨮g = ↑f → ∃∃q. q⨮g = f & ↑q = p.
68 * #q #f #g #p <gr_next_unfold #H destruct /2 width=3 by ex2_intro/
71 lemma next_inv_seq_dx: ∀f,g,p. ↑f = p⨮g → ∃∃q. q⨮g = f & ↑q = p.
72 * #q #f #g #p <gr_next_unfold #H destruct /2 width=3 by ex2_intro/
75 lemma case_prop (Q:predicate gr_map):
76 (∀f. Q (⫯f)) → (∀f. Q (↑f)) → ∀f. Q f.
80 lemma case_type0 (Q:gr_map→Type[0]):
81 (∀f. Q (⫯f)) → (∀f. Q (↑f)) → ∀f. Q f.
85 lemma iota_push: ∀Q,a,b,f. a f = case_type0 Q a b (⫯f).
88 lemma iota_next: ∀Q,a,b,f. b f = case_type0 Q a b (↑f).