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/arith/nat_succ.ma".
16 include "ground/arith/ynat_nat.ma".
18 (* SUCCESSOR FOR NON-NEGATIVE INTEGERS WITH INFINITY ************************)
20 definition ysucc_aux (n): ynat ≝
24 definition ysucc: ynat → ynat ≝
25 ynat_bind_nat ysucc_aux (∞).
28 "successor (non-negative integers with infinity)"
29 'UpArrow x = (ysucc x).
31 (* Constructions ************************************************************)
34 lemma ysucc_inj (n): yinj_nat (↑n) = ↑(yinj_nat n).
35 @(ynat_bind_nat_inj ysucc_aux)
39 lemma ysucc_inf: ∞ = ↑(∞).
42 (* Inversions ***************************************************************)
44 (*** ysucc_inv_inj_sn *)
45 lemma eq_inv_inj_ysucc (n1) (x2):
47 ∃∃n2. yinj_nat n2 = x2 & ↑n2 = n1.
48 #n1 #x2 @(ynat_split_nat_inf … x2) -x2
49 [ /3 width=3 by eq_inv_yinj_nat_bi, ex2_intro/
50 | #H elim (eq_inv_yinj_nat_inf … H)
54 (*** ysucc_inv_inj_dx *)
55 lemma eq_inv_ysucc_inj (x1) (n2):
57 ∃∃n1. yinj_nat n1 = x1 & ↑n1 = n2.
58 /2 width=1 by eq_inv_inj_ysucc/ qed-.
60 (*** ysucc_inv_Y_sn *)
61 lemma eq_inv_inf_ysucc (x2): ∞ = ↑x2 → ∞ = x2.
62 #x2 @(ynat_split_nat_inf … x2) -x2 //
63 #n1 <ysucc_inj #H elim (eq_inv_inf_yinj_nat … H)
66 (*** ysucc_inv_Y_dx *)
67 lemma eq_inv_ysucc_inf (x1): ↑x1 = ∞ → ∞ = x1.
68 /2 width=1 by eq_inv_inf_ysucc/ qed-.
71 lemma eq_inv_ysucc_bi: injective … ysucc.
72 #x1 @(ynat_split_nat_inf … x1) -x1
73 [ #n1 #x2 <ysucc_inj #H
74 elim (eq_inv_inj_ysucc … H) -H #n2 #H1 #H2 destruct
75 <(eq_inv_nsucc_bi … H2) -H2 //
76 | #x2 #H <(eq_inv_inf_ysucc … H) -H //
80 (*** ysucc_inv_refl *)
81 lemma ysucc_inv_refl (x): x = ↑x → ∞ = x.
82 #x @(ynat_split_nat_inf … x) -x //
84 lapply (eq_inv_yinj_nat_bi … H) -H #H
85 elim (nsucc_inv_refl … H)
88 (*** ysucc_inv_O_sn *)
89 lemma eq_inv_zero_ysucc (x): 𝟎 = ↑x → ⊥.
91 elim (eq_inv_inj_ysucc (𝟎) ? H) -H #n #_ #H
92 /2 width=2 by eq_inv_zero_nsucc/
95 (*** ysucc_inv_O_dx *)
96 lemma eq_inv_ysucc_zero (x): ↑x = 𝟎 → ⊥.
97 /2 width=2 by eq_inv_zero_ysucc/ qed-.
99 (* Eliminations *************************************************************)
102 lemma ynat_ind_succ (Q:predicate …):
103 Q (𝟎) → (∀n:nat. Q (yinj_nat n) → Q (↑(yinj_nat n))) → Q (∞) → ∀x. Q x.
104 #Q #IH1 #IH2 #IH3 #x @(ynat_split_nat_inf … x) -x //
105 #n @(nat_ind_succ … n) -n /2 width=1 by/