@@ -225,7 +225,7 @@ Appends a new tactic syntax to a successful result.
225225Used by leaf actions to record the tactic that produced progress.
226226If `(← getConfig).trace` is `false`, it just returns `r`.
227227-/
228- def concatTactic (r : ActionResult) (mk : GrindM (TSyntax `grind) ) : GrindM ActionResult := do
228+ def concatTactic (r : ActionResult) (mk : GrindM TGrind ) : GrindM ActionResult := do
229229 if (← getConfig).trace then
230230 match r with
231231 | .closed seq =>
@@ -236,7 +236,7 @@ def concatTactic (r : ActionResult) (mk : GrindM (TSyntax `grind)) : GrindM Acti
236236 return r
237237
238238/-- Returns `.closed [← mk]` if tracing is enabled, and `.closed []` otherwise. -/
239- def closeWith (mk : GrindM (TSyntax `grind) ) : GrindM ActionResult := do
239+ def closeWith (mk : GrindM TGrind ) : GrindM ActionResult := do
240240 if (← getConfig).trace then
241241 return .closed [(← mk)]
242242 else
@@ -247,7 +247,7 @@ A terminal action which closes the goal or not.
247247This kind of action may make progress, but we only include `mkTac` into the resulting tactic sequence
248248if it closed the goal.
249249-/
250- def terminalAction (check : GoalM Bool) (mkTac : GrindM (TSyntax `grind) ) : Action := fun goal kna kp => do
250+ def terminalAction (check : GoalM Bool) (mkTac : GrindM TGrind ) : Action := fun goal kna kp => do
251251 let (progress, goal') ← GoalM.run goal check
252252 if progress then
253253 if goal'.inconsistent then
@@ -282,21 +282,26 @@ def checkSeqAt (s? : Option SavedState) (goal : Goal) (seq : List TGrind) : Grin
282282/--
283283Helper action that checks whether the resulting tactic script produced by its continuation
284284can close the original goal.
285+ If `warnOnly = true`, just generates a warning message instead of an error
285286-/
286- def checkTactic : Action := fun goal _ kp => do
287+ def checkTactic (warnOnly : Bool) : Action := fun goal _ kp => do
287288 let s ← saveStateIfTracing
288289 let r ← kp goal
289290 match r with
290291 | .closed seq =>
291292 unless (← checkSeqAt s goal seq) do
292- throwError "generated tactic cannot close the goal{indentD (← mkGrindNext seq)}\n Initial goal\n {goal.mvarId}"
293+ let m := m!"generated tactic cannot close the goal{indentD (← mkGrindNext seq)}\n Initial goal\n {goal.mvarId}"
294+ if warnOnly then
295+ logWarning m
296+ else
297+ throwError m
293298 return r
294299 | _ => return r
295300
296301/--
297302Helper action for satellite solvers that use `CheckResult`.
298303-/
299- def solverAction (check : GoalM CheckResult) (mkTac : GrindM (TSyntax `grind) ) : Action := fun goal kna kp => do
304+ def solverAction (check : GoalM CheckResult) (mkTac : GrindM TGrind ) : Action := fun goal kna kp => do
300305 let saved? ← saveStateIfTracing
301306 let (result, goal') ← GoalM.run goal check
302307 match result with
@@ -327,6 +332,24 @@ def solverAction (check : GoalM CheckResult) (mkTac : GrindM (TSyntax `grind)) :
327332 kp goal'
328333 | .closed => closeWith mkTac
329334
335+ def mbtc : Action := fun goal kna kp => do
336+ let saved? ← saveStateIfTracing
337+ let (progress, goal') ← GoalM.run goal Solvers.mbtc
338+ if progress then
339+ if (← getConfig).trace then
340+ match (← kp goal') with
341+ | .closed seq =>
342+ if (← checkSeqAt saved? goal seq) then
343+ return .closed seq
344+ else
345+ let tac ← `(grind| mbtc)
346+ return .closed (tac :: seq)
347+ | r => return r
348+ else
349+ kp goal'
350+ else
351+ kna goal'
352+
330353section
331354/-!
332355Some sanity check properties.
0 commit comments