Skip to content

Commit 7567f7d

Browse files
committed
Revert "chore: switch to directly invoking theory solver"
This reverts commit 537b08a.
1 parent 4911e56 commit 7567f7d

File tree

2 files changed

+8
-25
lines changed
  • src/Lean

2 files changed

+8
-25
lines changed

src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/AC.lean

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,7 @@ def CoefficientsMap.toExpr (coeff : CoefficientsMap) (op : Op) : VarStateM (Opti
232232
| some acc => some <| mkApp2 op.toExpr acc expr
233233
return acc
234234

235-
open VarStateM Lean.Meta Lean.Elab Term Grind
236-
237-
#check Grind.Arith.CommRing.check
238-
#check Grind.solve
239-
#check Grind.main
240-
235+
open VarStateM Lean.Meta Lean.Elab Term
241236

242237
/--
243238
Given two expressions `x, y` which are equal up to associativity and commutativity,
@@ -249,23 +244,11 @@ def proveEqualityByGrindCommRing (x y : Expr) : MetaM Expr := do
249244
let expectedType ← mkEq x y
250245
let mvar ← mkFreshExprMVar expectedType
251246
let config := {}
252-
let params ← Grind.mkParams config
253-
let grindComputation : GrindM Unit := do
254-
-- | TODO: get params from GrindM
255-
let goal ← Grind.mkGoal mvar.mvarId! params
256-
let success? ← Grind.Arith.CommRing.check.run goal
257-
return ()
258-
-- let go : Grind.GrindM Grind.Result := withReducible do
259-
-- let goal ← initCore mvarId params
260-
-- let failure? ← solve goal
261-
-- let issues := (← get).issues
262-
-- let result ← Grind.main mvar.mvarId! (← Grind.mkParams config) (pure ())
263-
let result ← grindComputation.run params (pure ())
264-
-- if let .some g := result.failure? then
265-
-- throwError "grind failed with leftover goal: {indentD (← g.ppState)}"
266-
-- else
267-
-- instantiateMVars mvar
268-
instantiateMVars mvar
247+
let result ← Grind.main mvar.mvarId! (← Grind.mkParams config) (pure ())
248+
if let .some g := result.failure? then
249+
throwError "grind failed with leftover goal: {indentD (← g.ppState)}"
250+
else
251+
instantiateMVars mvar
269252

270253

271254
/--

src/Lean/Meta/Tactic/Grind/Main.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private def mkCleanState (mvarId : MVarId) (params : Params) : MetaM Clean.State
9999
used := used.insert localDecl.userName
100100
return { used }
101101

102-
protected def mkGoal (mvarId : MVarId) (params : Params) : GrindM Goal := do
102+
private def mkGoal (mvarId : MVarId) (params : Params) : GrindM Goal := do
103103
let mvarId ← if params.config.clean then mvarId.exposeNames else pure mvarId
104104
let trueExpr ← getTrueExpr
105105
let falseExpr ← getFalseExpr
@@ -201,7 +201,7 @@ private def initCore (mvarId : MVarId) (params : Params) : GrindM Goal := do
201201
let mvarId ← mvarId.unfoldReducible
202202
let mvarId ← mvarId.betaReduce
203203
appendTagSuffix mvarId `grind
204-
Grind.mkGoal mvarId params
204+
mkGoal mvarId params
205205

206206
def main (mvarId : MVarId) (params : Params) (fallback : Fallback) : MetaM Result := do profileitM Exception "grind" (← getOptions) do
207207
if debug.terminalTacticsAsSorry.get (← getOptions) then

0 commit comments

Comments
 (0)