2014-01-05 20:05:08 +00:00
|
|
|
import Int.
|
|
|
|
definition double {A : Type} (f : A -> A) : A -> A := fun x, f (f x).
|
|
|
|
definition big {A : Type} (f : A -> A) : A -> A := (double (double (double (double (double (double (double f))))))).
|
2013-12-07 22:59:21 +00:00
|
|
|
|
2014-01-05 18:32:47 +00:00
|
|
|
(*
|
2013-12-07 22:59:21 +00:00
|
|
|
|
|
|
|
-- Tactic for trying to prove goal using Reflexivity, Congruence and available assumptions
|
2014-01-06 03:10:21 +00:00
|
|
|
local congr_tac = Repeat(OrElse(apply_tac("refl"), apply_tac("congr"), assumption_tac()))
|
2013-12-07 22:59:21 +00:00
|
|
|
|
|
|
|
-- Create an eager tactic that only tries to prove goal after unfolding everything
|
2013-12-26 23:54:53 +00:00
|
|
|
eager_tac = Then(-- unfold homogeneous equality
|
|
|
|
Try(unfold_tac("eq")),
|
2013-12-07 22:59:21 +00:00
|
|
|
-- keep unfolding defintions above and beta-reducing
|
2013-12-26 23:54:53 +00:00
|
|
|
Repeat(unfold_tac() .. Repeat(beta_tac())),
|
2013-12-07 22:59:21 +00:00
|
|
|
congr_tac)
|
|
|
|
|
|
|
|
-- The 'lazy' version tries first to prove without unfolding anything
|
2013-12-26 23:54:53 +00:00
|
|
|
lazy_tac = OrElse(Then(Try(unfold_tac("eq")), congr_tac, now_tac()),
|
2013-12-07 22:59:21 +00:00
|
|
|
eager_tac)
|
|
|
|
|
2014-01-05 18:32:47 +00:00
|
|
|
*)
|
2013-12-07 22:59:21 +00:00
|
|
|
|
2014-01-16 00:35:33 +00:00
|
|
|
exit -- temporarily disable the follwoing tests
|
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
theorem T1 (a b : Int) (f : Int -> Int) (H : a = b) : (big f a) = (big f b).
|
2013-12-26 23:54:53 +00:00
|
|
|
eager_tac.
|
2013-12-07 22:59:21 +00:00
|
|
|
done.
|
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
theorem T2 (a b : Int) (f : Int -> Int) (H : a = b) : (big f a) = (big f b).
|
2013-12-26 23:54:53 +00:00
|
|
|
lazy_tac.
|
2013-12-07 22:59:21 +00:00
|
|
|
done.
|
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
theorem T3 (a b : Int) (f : Int -> Int) (H : a = b) : (big f a) = ((double (double (double (double (double (double (double f))))))) b).
|
2013-12-26 23:54:53 +00:00
|
|
|
lazy_tac.
|
2013-12-07 22:59:21 +00:00
|
|
|
done.
|