@@ -388,7 +388,7 @@ elab info pattern tm = do elab' tm
388388 elab' Placeholder = do (h : hs) <- get_holes
389389 movelast h
390390 elab' (PMetavar n) = do attack; defer n; solve
391− elab' (PProof ts) = do mapM_ runTac ts
391+ elab' (PProof ts) = do mapM_ (runTac True) ts
392392 elab' (PElabError e) = fail e
393393 elab' x = fail $ "Not implemented " ++ show x
394394
@@ -422,26 +422,28 @@ collectDeferred t = return t
422422
423423-- Running tactics directly
424424
425−runTac :: PTactic -> Elab ()
426−runTac (Intro xs) = mapM_ (\x -> do attack; intro x) xs
427−runTac (Exact tm) = do elab toplevel False tm
428− solveAll
429−runTac (Refine fn imps) = do ns <- apply (Var fn) imps
430− solveAll
431−runTac (Rewrite tm) -- to elaborate tm, let bind it, then rewrite by that
432− = do attack; -- (h:_) <- get_holes
433− tyn <- unique_hole (MN 0 "rty")
434− -- start_unify h
435− claim tyn (RSet 0)
436− valn <- unique_hole (MN 0 "rval")
437− claim valn (Var tyn)
438− letn <- unique_hole (MN 0 "rewrite_rule")
439− letbind letn (Var tyn) (Var valn)
440− focus valn
441− elab toplevel False tm
442− rewrite (Var letn)
443−runTac (Focus n) = focus n
444−runTac Solve = solve
445−runTac x = fail $ "Not implemented " ++ show x
425+runTac :: Bool -> PTactic -> Elab ()
426+runTac autoSolve = runT where
427+ runT (Intro xs) = mapM_ (\x -> do attack; intro x) xs
428+ runT (Exact tm) = do elab toplevel False tm
429+ when autoSolve solveAll
430+ runT (Refine fn imps) = do ns <- apply (Var fn) imps
431+ when autoSolve solveAll
432+ runT (Rewrite tm) -- to elaborate tm, let bind it, then rewrite by that
433+ = do attack; -- (h:_) <- get_holes
434+ tyn <- unique_hole (MN 0 "rty")
435+ -- start_unify h
436+ claim tyn (RSet 0)
437+ valn <- unique_hole (MN 0 "rval")
438+ claim valn (Var tyn)
439+ letn <- unique_hole (MN 0 "rewrite_rule")
440+ letbind letn (Var tyn) (Var valn)
441+ focus valn
442+ elab toplevel False tm
443+ rewrite (Var letn)
444+ when autoSolve solveAll
445+ runT (Focus n) = focus n
446+ runT Solve = solve
447+ runT x = fail $ "Not implemented " ++ show x
446448
447449solveAll = try (do solve; solveAll) (return ())