lean2/examples/lean/ex3.lean
Leonardo de Moura 6508e63a17 feat(builtin/macros): add assume/take macros for making proof scripts more readable
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-11 18:36:37 -08:00

28 lines
No EOL
745 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 macros.
theorem my_and_comm (a b : Bool) : (a ∧ b) → (b ∧ a)
:= assume H_ab, and_intro (and_elimr H_ab) (and_eliml H_ab).
theorem my_or_comm (a b : Bool) : (a b) → (b a)
:= assume H_ab,
or_elim H_ab
(λ H_a, or_intror b H_a)
(λ H_b, or_introl H_b a).
-- (em a) is the excluded middle a ¬a
-- (mt H H_na) is Modus Tollens with
-- H : (a → b) → a)
-- H_na : ¬a
-- produces
-- ¬(a → b)
--
-- not_imp_eliml applied to
-- (MT H H_na) : ¬(a → b)
-- produces
-- a
theorem pierce (a b : Bool) : ((a → b) → a) → a
:= assume H, or_elim (em a)
(λ H_a, H_a)
(λ H_na, not_imp_eliml (mt H H_na)).
print environment 3.