2014-08-24 19:58:48 -07:00
|
|
|
import logic
|
2014-10-01 17:51:17 -07:00
|
|
|
open eq.ops
|
2014-11-22 17:34:05 -08:00
|
|
|
namespace experiment
|
2014-07-25 15:03:57 -07:00
|
|
|
inductive nat : Type :=
|
2015-02-25 17:00:10 -08:00
|
|
|
| zero : nat
|
|
|
|
| succ : nat → nat
|
2014-07-25 15:03:57 -07:00
|
|
|
|
2014-09-04 16:36:06 -07:00
|
|
|
namespace nat
|
2014-09-17 14:39:05 -07:00
|
|
|
definition plus (x y : nat) : nat
|
2014-09-04 15:03:59 -07:00
|
|
|
:= nat.rec x (λn r, succ r) y
|
2014-09-17 14:39:05 -07:00
|
|
|
definition to_nat [coercion] (n : num) : nat
|
2014-09-04 16:36:06 -07: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 15:03:57 -07:00
|
|
|
definition add (x y : nat) : nat
|
|
|
|
:= plus x y
|
2014-10-02 16:20:52 -07:00
|
|
|
constant le : nat → nat → Prop
|
2014-07-25 15:03:57 -07:00
|
|
|
|
2014-10-21 15:27:45 -07:00
|
|
|
infixl `+` := add
|
|
|
|
infix `≤` := le
|
2014-07-25 15:03:57 -07:00
|
|
|
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
|
2015-01-27 11:37:17 -08:00
|
|
|
:= add_le_right_inv ((add_one m)⁻¹ ▸ (add_one n)⁻¹ ▸ H)
|
2014-09-04 16:36:06 -07:00
|
|
|
|
|
|
|
end nat
|
2014-11-22 17:34:05 -08:00
|
|
|
end experiment
|