2014-08-25 02:58:48 +00:00
|
|
|
import logic
|
2014-10-02 00:51:17 +00:00
|
|
|
open eq.ops
|
2014-07-25 22:03:57 +00:00
|
|
|
|
|
|
|
inductive nat : Type :=
|
2014-08-22 22:46:10 +00:00
|
|
|
zero : nat,
|
|
|
|
succ : nat → nat
|
2014-07-25 22:03:57 +00:00
|
|
|
|
2014-09-04 23:36:06 +00:00
|
|
|
namespace nat
|
2014-09-17 21:39:05 +00:00
|
|
|
definition plus (x y : nat) : nat
|
2014-09-04 22:03:59 +00:00
|
|
|
:= nat.rec x (λn r, succ r) y
|
2014-09-17 21:39:05 +00:00
|
|
|
definition to_nat [coercion] (n : num) : nat
|
2014-09-04 23:36:06 +00:00
|
|
|
:= num.rec zero (λn, pos_num.rec (succ zero) (λn r, plus r (plus r (succ zero))) (λn r, plus r r) n) n
|
2014-07-25 22:03:57 +00:00
|
|
|
definition add (x y : nat) : nat
|
|
|
|
:= plus x y
|
2014-10-02 23:20:52 +00:00
|
|
|
constant le : nat → nat → Prop
|
2014-07-25 22:03:57 +00:00
|
|
|
|
|
|
|
infixl `+`:65 := add
|
|
|
|
infix `≤`:50 := le
|
|
|
|
axiom add_one (n:nat) : n + (succ zero) = succ n
|
|
|
|
axiom add_le_right_inv {n m k : nat} (H : n + k ≤ m + k) : n ≤ m
|
|
|
|
|
|
|
|
theorem succ_le_cancel {n m : nat} (H : succ n ≤ succ m) : n ≤ m
|
|
|
|
:= add_le_right_inv (add_one m⁻¹ ▸ add_one n⁻¹ ▸ H)
|
2014-09-04 23:36:06 +00:00
|
|
|
|
|
|
|
end nat
|