2014-08-01 09:37:23 -07:00
|
|
|
|
import logic
|
2014-09-03 16:00:38 -07:00
|
|
|
|
open decidable
|
2014-09-04 18:41:06 -07:00
|
|
|
|
open eq
|
2014-11-22 17:34:05 -08:00
|
|
|
|
namespace experiment
|
2014-07-24 23:43:40 -07:00
|
|
|
|
inductive nat : Type :=
|
2015-02-25 17:00:10 -08:00
|
|
|
|
| zero : nat
|
|
|
|
|
| succ : nat → nat
|
2014-09-17 14:39:05 -07:00
|
|
|
|
definition refl := @eq.refl
|
2014-09-04 16:36:06 -07:00
|
|
|
|
namespace nat
|
2014-07-24 23:43:40 -07:00
|
|
|
|
|
2014-09-04 15:03:59 -07:00
|
|
|
|
definition pred (n : nat) := nat.rec zero (fun m x, m) n
|
2014-07-24 23:43:40 -07:00
|
|
|
|
theorem pred_zero : pred zero = zero := refl _
|
|
|
|
|
theorem pred_succ (n : nat) : pred (succ n) = n := refl _
|
|
|
|
|
|
|
|
|
|
theorem zero_or_succ (n : nat) : n = zero ∨ n = succ (pred n)
|
2015-02-11 12:49:27 -08:00
|
|
|
|
:= nat.induction_on n
|
2014-09-04 16:36:06 -07:00
|
|
|
|
(or.intro_left _ (refl zero))
|
|
|
|
|
(take m IH, or.intro_right _
|
2014-08-20 15:49:44 -07:00
|
|
|
|
(show succ m = succ (pred (succ m)), from congr_arg succ (symm (pred_succ m))))
|
2014-07-24 23:43:40 -07:00
|
|
|
|
|
|
|
|
|
theorem zero_or_succ2 (n : nat) : n = zero ∨ n = succ (pred n)
|
2015-02-11 12:49:27 -08:00
|
|
|
|
:= @nat.induction_on _ n
|
2014-09-04 16:36:06 -07:00
|
|
|
|
(or.intro_left _ (refl zero))
|
|
|
|
|
(take m IH, or.intro_right _
|
2014-08-20 15:49:44 -07:00
|
|
|
|
(show succ m = succ (pred (succ m)), from congr_arg succ (symm (pred_succ m))))
|
2014-09-04 16:36:06 -07:00
|
|
|
|
end nat
|
2014-11-22 17:34:05 -08:00
|
|
|
|
end experiment
|