Skip to content

chore: fix acNf bug in bv_decide by switching over to grind #9309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Revert "chore: switch to directly invoking theory solver"
This reverts commit 537b08a.
  • Loading branch information
bollu committed Jul 18, 2025
commit 9975473f427b6610aac267f8666de9f270e2e7d1
29 changes: 6 additions & 23 deletions src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/AC.lean
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,7 @@ def CoefficientsMap.toExpr (coeff : CoefficientsMap) (op : Op) : VarStateM (Opti
| some acc => some <| mkApp2 op.toExpr acc expr
return acc

open VarStateM Lean.Meta Lean.Elab Term Grind

#check Grind.Arith.CommRing.check
#check Grind.solve
#check Grind.main

open VarStateM Lean.Meta Lean.Elab Term

/--
Given two expressions `x, y` which are equal up to associativity and commutativity,
Expand All @@ -245,23 +240,11 @@ def proveEqualityByGrindCommRing (x y : Expr) : MetaM Expr := do
let expectedType ← mkEq x y
let mvar ← mkFreshExprMVar expectedType
let config := {}
let params ← Grind.mkParams config
let grindComputation : GrindM Unit := do
-- | TODO: get params from GrindM
let goal ← Grind.mkGoal mvar.mvarId! params
let success? ← Grind.Arith.CommRing.check.run goal
return ()
-- let go : Grind.GrindM Grind.Result := withReducible do
-- let goal ← initCore mvarId params
-- let failure? ← solve goal
-- let issues := (← get).issues
-- let result ← Grind.main mvar.mvarId! (← Grind.mkParams config) (pure ())
let result ← grindComputation.run params (pure ())
-- if let .some g := result.failure? then
-- throwError "grind failed with leftover goal: {indentD (← g.ppState)}"
-- else
-- instantiateMVars mvar
instantiateMVars mvar
let result ← Grind.main mvar.mvarId! (← Grind.mkParams config) (pure ())
if let .some g := result.failure? then
throwError "grind failed with leftover goal: {indentD (← g.ppState)}"
else
instantiateMVars mvar


/--
Expand Down
4 changes: 2 additions & 2 deletions src/Lean/Meta/Tactic/Grind/Main.lean
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private def mkCleanState (mvarId : MVarId) (params : Params) : MetaM Clean.State
used := used.insert localDecl.userName
return { used }

protected def mkGoal (mvarId : MVarId) (params : Params) : GrindM Goal := do
private def mkGoal (mvarId : MVarId) (params : Params) : GrindM Goal := do
let mvarId ← if params.config.clean then mvarId.exposeNames else pure mvarId
let trueExpr ← getTrueExpr
let falseExpr ← getFalseExpr
Expand Down Expand Up @@ -197,7 +197,7 @@ private def initCore (mvarId : MVarId) (params : Params) : GrindM Goal := do
let mvarId ← mvarId.unfoldReducible
let mvarId ← mvarId.betaReduce
appendTagSuffix mvarId `grind
Grind.mkGoal mvarId params
mkGoal mvarId params

def main (mvarId : MVarId) (params : Params) (fallback : Fallback) : MetaM Result := do profileitM Exception "grind" (← getOptions) do
if debug.terminalTacticsAsSorry.get (← getOptions) then
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy