]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground/relocation/nstream.ma
update in ground
[helm.git] / matita / matita / contribs / lambdadelta / ground / relocation / nstream.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 "ground/notation/functions/upspoon_1.ma".
16 include "ground/lib/stream_tls.ma".
17
18 (* RELOCATION N-STREAM ******************************************************)
19
20 definition rtmap: Type[0] ≝ stream nat.
21
22 definition push: rtmap → rtmap ≝ λf. 0⨮f.
23
24 interpretation "push (nstream)" 'UpSpoon f = (push f).
25
26 definition next: rtmap → rtmap.
27 * #n #f @(↑n⨮f)
28 defined.
29
30 interpretation "next (nstream)" 'UpArrow f = (next f).
31
32 (* Basic properties *********************************************************)
33
34 lemma push_rew: ∀f. 0⨮f = ⫯f.
35 // qed.
36
37 lemma next_rew: ∀f,n. (↑n)⨮f = ↑(n⨮f).
38 // qed.
39
40 (* Basic inversion lemmas ***************************************************)
41
42 lemma injective_push: injective ? ? push.
43 #f1 #f2 normalize #H destruct //
44 qed-.
45
46 lemma discr_push_next: ∀f1,f2. ⫯f1 = ↑f2 → ⊥.
47 #f1 * #n2 #f2 normalize #H destruct
48 qed-.
49
50 lemma discr_next_push: ∀f1,f2. ↑f1 = ⫯f2 → ⊥.
51 * #n1 #f1 #f2 normalize #H destruct
52 qed-.
53
54 lemma injective_next: injective ? ? next.
55 * #n1 #f1 * #n2 #f2 normalize #H destruct //
56 qed-.
57
58 lemma push_inv_seq_sn: ∀f,g,n. n⨮g = ⫯f → 0 = n ∧ g = f.
59 #f #g #n <push_rew #H destruct /2 width=1 by conj/
60 qed-.
61
62 lemma push_inv_seq_dx: ∀f,g,n. ⫯f = n⨮g → 0 = n ∧ g = f.
63 #f #g #n <push_rew #H destruct /2 width=1 by conj/
64 qed-.
65
66 lemma next_inv_seq_sn: ∀f,g,n. n⨮g = ↑f → ∃∃m. m⨮g = f & ↑m = n.
67 * #m #f #g #n <next_rew #H destruct /2 width=3 by ex2_intro/
68 qed-.
69
70 lemma next_inv_seq_dx: ∀f,g,n. ↑f = n⨮g → ∃∃m. m⨮g = f & ↑m = n.
71 * #m #f #g #n <next_rew #H destruct /2 width=3 by ex2_intro/
72 qed-.
73
74 lemma case_prop: ∀R:predicate rtmap.
75                  (∀f. R (⫯f)) → (∀f. R (↑f)) → ∀f. R f.
76 #R #H1 #H2 * * //
77 qed-.
78
79 lemma case_type0: ∀R:rtmap→Type[0].
80                   (∀f. R (⫯f)) → (∀f. R (↑f)) → ∀f. R f.
81 #R #H1 #H2 * * //
82 qed-.
83
84 lemma iota_push: ∀R,a,b,f. a f = case_type0 R a b (⫯f).
85 // qed.
86
87 lemma iota_next: ∀R,a,b,f. b f = case_type0 R a b (↑f).
88 #R #a #b * //
89 qed.
90
91 (* Poperties with stream_tl *************************************************)
92
93 lemma tl_push: ∀f. f = ⫰⫯f.
94 // qed.
95
96 lemma tl_next: ∀f. ⫰f = ⫰↑f.
97 * // qed.