Library Coq.Numbers.Natural.Abstract.NBase
First, we import all known facts about both natural numbers and integers.
From pred_0 and order facts, we can prove that 0 isn't a successor.
Next, we show that all numbers are nonnegative and recover regular
induction from the bidirectional induction on NZ
The theorems bi_induction, central_induction and the tactic nzinduct
refer to bidirectional induction, which is not useful on natural
numbers. Therefore, we define a new induction tactic for natural numbers.
We do not have to call "Declare Left Step" and "Declare Right Step"
commands again, since the data for stepl and stepr tactics is inherited
from NZ.
Ltac induct n :=
induction_maker n ltac:(
apply induction).
Theorem case_analysis :
forall A :
N.t ->
Prop,
Proper (
N.eq==>iff)
A ->
A 0 -> (
forall n,
A (
S n)) ->
forall n,
A n.
Ltac cases n :=
induction_maker n ltac:(
apply case_analysis).
Theorem neq_0 :
~ forall n,
n == 0.
Theorem neq_0_r :
forall n,
n ~= 0
<-> exists m, n == S m.
Theorem zero_or_succ :
forall n,
n == 0
\/ exists m, n == S m.
Theorem eq_pred_0 :
forall n,
P n == 0
<-> n == 0
\/ n == 1.
Theorem succ_pred :
forall n,
n ~= 0 ->
S (
P n)
== n.
Theorem pred_inj :
forall n m,
n ~= 0 ->
m ~= 0 ->
P n == P m ->
n == m.
The following induction principle is useful for reasoning about, e.g.,
Fibonacci numbers
The following is useful for reasoning about, e.g., Ackermann function