lean2/examples/lean/ex1.lean
Leonardo de Moura 8c956280d9 chore(frontends/lean): rename setoption and setopaque commands to set::option and set::opaque
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-06 11:41:03 -08:00

35 lines
977 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.

variable N : Type
variable h : N -> N -> N
-- Specialize congruence theorem for h-applications
theorem congrh {a1 a2 b1 b2 : N} (H1 : a1 = b1) (H2 : a2 = b2) : (h a1 a2) = (h b1 b2) :=
congr (congr (refl h) H1) H2
-- Declare some variables
variable a : N
variable b : N
variable c : N
variable d : N
variable e : N
-- Add axioms stating facts about these variables
axiom H1 : (a = b ∧ b = c) (d = c ∧ a = d)
axiom H2 : b = e
-- Proof that (h a b) = (h c e)
theorem T1 : (h a b) = (h c e) :=
or::elim H1
(λ C1, congrh ((and::eliml C1) ⋈ (and::elimr C1)) H2)
(λ C2, congrh ((and::elimr C2) ⋈ (and::eliml C2)) H2)
-- We can use theorem T1 to prove other theorems
theorem T2 : (h a (h a b)) = (h a (h c e)) :=
congrh (refl a) T1
-- Display the last two objects (i.e., theorems) added to the environment
print environment 2
-- print implicit arguments
set::option lean::pp::implicit true
set::option pp::width 150
print environment 2