@@ -58,6 +58,7 @@ data Tactic = Attack
58 | StartUnify Name
58 | StartUnify Name
59 | EndUnify
59 | EndUnify
61 | HNF_Compute
62 | HNF_Compute
62 | EvalIn Raw
63 | EvalIn Raw
63 | CheckIn Raw
64 | CheckIn Raw
@@ -65,6 +66,7 @@ data Tactic = Attack
65 | IntroTy Raw (Maybe Name)
66 | IntroTy Raw (Maybe Name)
66 | Forall Name Raw
67 | Forall Name Raw
67 | LetBind Name Raw Raw
68 | LetBind Name Raw Raw
69+ | ExpandLet Name Term
68 | Rewrite Raw
70 | Rewrite Raw
69 | Equiv Raw
71 | Equiv Raw
70 | PatVar Name
72 | PatVar Name
@@ -504,6 +506,10 @@ letbind n ty val ctxt env (Bind x (Hole t) (P _ x' _)) | x == x' =
504 return $ Bind n (Let tyv valv) (Bind x (Hole t) (P Bound x t))
506 return $ Bind n (Let tyv valv) (Bind x (Hole t) (P Bound x t))
505letbind n ty val ctxt env _ = fail "Can't let bind here"
507letbind n ty val ctxt env _ = fail "Can't let bind here"
509+expandLet :: Name -> Term -> RunTactic
510+expandLet n v ctxt env tm =
511+ return $ subst n v tm
507rewrite :: Raw -> RunTactic
513rewrite :: Raw -> RunTactic
508rewrite tm ctxt env (Bind x (Hole t) xp@(P _ x' _)) | x == x' =
514rewrite tm ctxt env (Bind x (Hole t) xp@(P _ x' _)) | x == x' =
509 do (tmv, tmt) <- lift $ check ctxt env tm
515 do (tmv, tmt) <- lift $ check ctxt env tm
@@ -570,6 +576,12 @@ hnf_compute ctxt env (Bind x (Hole ty) sc) =
570 return $ Bind x (Hole ty') sc
576 return $ Bind x (Hole ty') sc
571hnf_compute ctxt env t = return t
577hnf_compute ctxt env t = return t
579+-- reduce let bindings only
580+simplify :: RunTactic
581+simplify ctxt env (Bind x (Hole ty) sc) =
582+ do return $ Bind x (Hole (specialise ctxt env [] ty)) sc
583+simplify ctxt env t = return t
573check_in :: Raw -> RunTactic
585check_in :: Raw -> RunTactic
574check_in t ctxt env tm =
586check_in t ctxt env tm =
575 do (val, valty) <- lift $ check ctxt env t
587 do (val, valty) <- lift $ check ctxt env t
@@ -726,11 +738,13 @@ process t h = tactic (Just h) (mktac t)
726 mktac Solve = solve
738 mktac Solve = solve
727 mktac (StartUnify n) = start_unify n
739 mktac (StartUnify n) = start_unify n
728 mktac Compute = compute
740 mktac Compute = compute
741+ mktac Simplify = Core.ProofState.simplify
729 mktac HNF_Compute = hnf_compute
742 mktac HNF_Compute = hnf_compute
730 mktac (Intro n) = intro n
743 mktac (Intro n) = intro n
731 mktac (IntroTy ty n) = introTy ty n
744 mktac (IntroTy ty n) = introTy ty n
732 mktac (Forall n t) = forall n t
745 mktac (Forall n t) = forall n t
733 mktac (LetBind n t v) = letbind n t v
746 mktac (LetBind n t v) = letbind n t v
747+ mktac (ExpandLet n b) = expandLet n b
734 mktac (Rewrite t) = rewrite t
748 mktac (Rewrite t) = rewrite t
735 mktac (Equiv t) = equiv t
749 mktac (Equiv t) = equiv t
736 mktac (PatVar n) = patvar n
750 mktac (PatVar n) = patvar n