@@ -58,6 +58,7 @@ data Tactic = Attack
5858 | StartUnify Name
5959 | EndUnify
6060 | Compute
61+ | Simplify
6162 | HNF_Compute
6263 | EvalIn Raw
6364 | CheckIn Raw
@@ -65,6 +66,7 @@ data Tactic = Attack
6566 | IntroTy Raw (Maybe Name)
6667 | Forall Name Raw
6768 | LetBind Name Raw Raw
69+ | ExpandLet Name Term
6870 | Rewrite Raw
6971 | Equiv Raw
7072 | PatVar Name
@@ -504,6 +506,10 @@ letbind n ty val ctxt env (Bind x (Hole t) (P _ x' _)) | x == x' =
504506 return $ Bind n (Let tyv valv) (Bind x (Hole t) (P Bound x t))
505507letbind n ty val ctxt env _ = fail "Can't let bind here"
506508
509+expandLet :: Name -> Term -> RunTactic
510+expandLet n v ctxt env tm =
511+ return $ subst n v tm
512+
507513rewrite :: Raw -> RunTactic
508514rewrite tm ctxt env (Bind x (Hole t) xp@(P _ x' _)) | x == x' =
509515 do (tmv, tmt) <- lift $ check ctxt env tm
@@ -570,6 +576,12 @@ hnf_compute ctxt env (Bind x (Hole ty) sc) =
570576 return $ Bind x (Hole ty') sc
571577hnf_compute ctxt env t = return t
572578
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
584+
573585check_in :: Raw -> RunTactic
574586check_in t ctxt env tm =
575587 do (val, valty) <- lift $ check ctxt env t
@@ -726,11 +738,13 @@ process t h = tactic (Just h) (mktac t)
726738 mktac Solve = solve
727739 mktac (StartUnify n) = start_unify n
728740 mktac Compute = compute
741+ mktac Simplify = Core.ProofState.simplify
729742 mktac HNF_Compute = hnf_compute
730743 mktac (Intro n) = intro n
731744 mktac (IntroTy ty n) = introTy ty n
732745 mktac (Forall n t) = forall n t
733746 mktac (LetBind n t v) = letbind n t v
747+ mktac (ExpandLet n b) = expandLet n b
734748 mktac (Rewrite t) = rewrite t
735749 mktac (Equiv t) = equiv t
736750 mktac (PatVar n) = patvar n