]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground/arith/ynat_nat.ma
update in delayed_updating
[helm.git] / matita / matita / contribs / lambdadelta / ground / arith / ynat_nat.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/arith/nat.ma".
16 include "ground/arith/ynat.ma".
17
18 (* NAT-INJECTION FOR NON-NEGATIVE INTEGERS WITH INFINITY ********************)
19
20 (*** yinj *)
21 definition yinj_nat (n) ≝ match n with
22 [ nzero  ⇒ 𝟎
23 | ninj p ⇒ yinj p
24 ].
25
26 definition ynat_bind_nat: (nat → ynat) → ynat → (ynat → ynat).
27 #f #y *
28 [ @f @(𝟎)
29 | #p @f @p
30 | @y
31 ]
32 qed-.
33
34 (* Basic constructions ******************************************************)
35
36 lemma yinj_nat_zero: 𝟎 = yinj_nat (𝟎).
37 // qed.
38
39 lemma yinj_nat_inj (p): yinj p = yinj_nat (ninj p).
40 // qed.
41
42 lemma ynat_bind_nat_inj (f) (y) (n):
43       f n = ynat_bind_nat f y (yinj_nat n).
44 #f #y * // qed.
45
46 lemma ynat_bind_nat_inf (f) (y):
47       y = ynat_bind_nat f y (∞).
48 // qed.
49
50 (* Basic inversions *********************************************************)
51
52 lemma eq_inv_yinj_nat_inf (n1): yinj_nat n1 = ∞ → ⊥.
53 * [| #p1 ]
54 [ <yinj_nat_zero #H destruct
55 | <yinj_nat_inj #H destruct
56 ]
57 qed.
58
59 lemma eq_inv_inf_yinj_nat (n2): ∞ = yinj_nat n2 → ⊥.
60 /2 width=2 by eq_inv_yinj_nat_inf/ qed-.
61
62 (*** yinj_inj *)
63 lemma eq_inv_yinj_nat_bi (n1) (n2): yinj_nat n1 = yinj_nat n2 → n1 = n2.
64 * [| #p1 ] * [2,4: #p2 ]
65 [ <yinj_nat_zero <yinj_nat_inj #H destruct
66 | <yinj_nat_inj <yinj_nat_inj #H destruct //
67 | //
68 | <yinj_nat_inj <yinj_nat_zero #H destruct
69 ]
70 qed-.
71
72 (* Basic eliminations *******************************************************)
73
74 lemma ynat_split_nat_inf (Q:predicate …):
75       (∀n. Q (yinj_nat n)) → Q (∞) → ∀y. Q y.
76 #Q #H1 #H2 * //
77 qed-.