2014-09-04 21:21:03 +00:00
|
|
|
|
----------------------------------------------------------------------------------------------------
|
|
|
|
|
-- Copyright (c) 2014 Floris van Doorn. All rights reserved.
|
|
|
|
|
-- Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
-- Author: Floris van Doorn
|
|
|
|
|
----------------------------------------------------------------------------------------------------
|
|
|
|
|
import logic
|
2014-09-04 23:36:06 +00:00
|
|
|
|
open tactic
|
2014-09-04 21:21:03 +00:00
|
|
|
|
|
2014-11-23 01:34:05 +00:00
|
|
|
|
namespace foo
|
2014-09-04 21:21:03 +00:00
|
|
|
|
inductive nat : Type :=
|
2015-02-26 01:00:10 +00:00
|
|
|
|
| zero : nat
|
|
|
|
|
| succ : nat → nat
|
2014-09-04 21:21:03 +00:00
|
|
|
|
|
|
|
|
|
notation `ℕ`:max := nat
|
|
|
|
|
|
2014-09-04 23:36:06 +00:00
|
|
|
|
namespace nat
|
2014-09-17 21:39:05 +00:00
|
|
|
|
definition plus (x y : ℕ) : ℕ
|
2014-09-04 22:03:59 +00:00
|
|
|
|
:= nat.rec x (λ n r, succ r) y
|
2014-09-04 21:21:03 +00:00
|
|
|
|
|
2015-10-14 01:35:16 +00:00
|
|
|
|
definition nat_has_zero [reducible] [instance] [priority nat.prio] : has_zero nat :=
|
|
|
|
|
has_zero.mk nat.zero
|
|
|
|
|
|
|
|
|
|
definition nat_has_one [reducible] [instance] [priority nat.prio] : has_one nat :=
|
|
|
|
|
has_one.mk (nat.succ (nat.zero))
|
|
|
|
|
|
|
|
|
|
definition nat_has_add [reducible] [instance] [priority nat.prio] : has_add nat :=
|
|
|
|
|
has_add.mk plus
|
2014-09-04 21:21:03 +00:00
|
|
|
|
|
|
|
|
|
print "=================="
|
2014-09-04 22:03:59 +00:00
|
|
|
|
theorem nat_rec_zero {P : ℕ → Type} (x : P 0) (f : ∀m, P m → P (succ m)) : nat.rec x f 0 = x :=
|
2014-09-04 23:36:06 +00:00
|
|
|
|
eq.refl _
|
|
|
|
|
end nat
|
2014-11-23 01:34:05 +00:00
|
|
|
|
end foo
|