lean2/tests/lean/run/nat_bug.lean
Leonardo de Moura 8e6324185a fix(tests/lean): adjust tests to new library structure
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-01 09:37:23 -07:00

25 lines
855 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import logic
using decidable
inductive nat : Type :=
| zero : nat
| succ : nat → nat
theorem induction_on {P : nat → Prop} (a : nat) (H1 : P zero) (H2 : ∀ (n : nat) (IH : P n), P (succ n)) : P a
:= nat_rec H1 H2 a
definition pred (n : nat) := nat_rec zero (fun m x, m) n
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)
:= induction_on n
(or_intro_left _ (refl zero))
(take m IH, or_intro_right _
(show succ m = succ (pred (succ m)), from congr2 succ (symm (pred_succ m))))
theorem zero_or_succ2 (n : nat) : n = zero n = succ (pred n)
:= @induction_on _ n
(or_intro_left _ (refl zero))
(take m IH, or_intro_right _
(show succ m = succ (pred (succ m)), from congr2 succ (symm (pred_succ m))))