lean2/examples/lean/ex5.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

34 lines
No EOL
879 B
Text

import macros
scope
theorem ReflIf (A : Type)
(R : A → A → Bool)
(Symm : ∀ x y, R x y → R y x)
(Trans : ∀ x y z, R x y → R y z → R x z)
(Linked : ∀ x, ∃ y, R x y)
:
∀ x, R x x :=
take x,
obtain (w : A) (H : R x w), from (Linked x),
let L1 : R w x := Symm x w H
in Trans x w x H L1
pop_scope
scope
-- Same example again.
variable A : Type
variable R : A → A → Bool
axiom Symm {x y : A} : R x y → R y x
axiom Trans {x y z : A} : R x y → R y z → R x z
axiom Linked (x : A) : ∃ y, R x y
theorem ReflIf (x : A) : R x x :=
obtain (w : A) (H : R x w), from (Linked x),
let L1 : R w x := Symm H
in Trans H L1
end
-- Display the last two theorems
print environment 2