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.ma".
17 (* SUCCESSOR FOR NON-NEGATIVE INTEGERS **************************************)
19 definition npsucc (m): pnat ≝
26 "positive successor (non-negative integers)"
27 'UpArrow m = (npsucc m).
29 definition nsucc (m): nat ≝
33 "successor (non-negative integers)"
34 'UpArrow m = (nsucc m).
36 (* Basic constructions ******************************************************)
38 lemma npsucc_zero: (𝟏) = ↑𝟎.
41 lemma npsucc_inj (p): (↑p) = ↑(ninj p).
44 lemma nsucc_zero: ninj (𝟏) = ↑𝟎.
47 lemma nsucc_inj (p): ninj (↑p) = ↑(ninj p).
50 lemma npsucc_succ (n): psucc (npsucc n) = npsucc (nsucc n).
53 (* Basic eliminations *******************************************************)
56 lemma nat_ind_succ (Q:predicate …):
57 Q (𝟎) → (∀n. Q n → Q (↑n)) → ∀n. Q n.
59 #p elim p -p /2 width=1 by/
63 lemma nat_ind_2_succ (Q:relation2 …):
65 (∀m. Q m (𝟎) → Q (↑m) (𝟎)) →
66 (∀m,n. Q m n → Q (↑m) (↑n)) →
68 #Q #IH1 #IH2 #IH3 #m @(nat_ind_succ … m) -m [ // ]
69 #m #IH #n @(nat_ind_succ … n) -n /2 width=1 by/
72 (* Basic inversions *********************************************************)
74 lemma eq_inv_npsucc_bi: injective … npsucc.
75 * [| #p1 ] * [2,4: #p2 ]
76 [ 1,4: <npsucc_zero <npsucc_inj #H destruct
77 | <npsucc_inj <npsucc_inj #H destruct //
83 lemma eq_inv_nsucc_bi: injective … nsucc.
85 @eq_inv_npsucc_bi @eq_inv_ninj_bi @H
88 lemma eq_inv_nsucc_zero (m): ↑m = 𝟎 → ⊥.
89 * [ <nsucc_zero | #p <nsucc_inj ] #H destruct
92 lemma eq_inv_zero_nsucc (m): 𝟎 = ↑m → ⊥.
93 * [ <nsucc_zero | #p <nsucc_inj ] #H destruct
96 (*** succ_inv_refl_sn *)
97 lemma nsucc_inv_refl (n): n = ↑n → ⊥.
98 #n @(nat_ind_succ … n) -n
99 [ /2 width=2 by eq_inv_zero_nsucc/
100 | #n #IH #H /3 width=1 by eq_inv_nsucc_bi/