File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ def withTracing (x : GrindTacticM α) : GrindTacticM α := do
2020
2121def mkFinish (maxIterations : Nat) : IO Action := do
2222 let solvers ← Solvers.mkAction
23- return Action.checkTactic >> (Action.done <|> solvers <|> Action.instantiate <|> Action.splitNext).loop maxIterations
23+ let step : Action := Action.done <|> solvers <|> Action.instantiate <|> Action.splitNext <|> Action.mbtc
24+ return Action.checkTactic (warnOnly := true ) >> step.loop maxIterations
2425
2526def maxIterations := 1000 -- **TODO** : Add option
2627
Original file line number Diff line number Diff line change @@ -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
You can’t perform that action at this time.
0 commit comments