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 :=
|
|
|
|
|
zero : nat,
|
|
|
|
|
succ : nat → nat
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2014-09-17 21:39:05 +00:00
|
|
|
|
definition to_nat [coercion] (n : num) : ℕ
|
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-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
|