Skip to content

Commit 9423f50

Browse files
committed
chore: update toolchain
1 parent 979ca0d commit 9423f50

8 files changed

Lines changed: 26 additions & 23 deletions

File tree

Leanwuzla.lean

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Henrik Böving
55
-/
6-
import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide
6+
import Lean.Meta.Tactic.BVDecide
77

88
open Lean.Parser.Tactic
99

@@ -25,6 +25,7 @@ open Std.Sat
2525
open Std.Tactic.BVDecide
2626
open Std.Tactic.BVDecide.Reflect
2727
open Lean.Meta
28+
open Lean.Meta.Tactic.BVDecide
2829

2930

3031
partial def toSMT (expr : BVLogicalExpr) (atomsAssignment : Std.HashMap Nat (Nat × Expr × Bool)) : String :=
@@ -116,7 +117,7 @@ where
116117
let binStr := t ++ s
117118
push "#b"
118119
push binStr
119-
| .extract start len expr => pushUnaryOp s!"(_ extract {len - 1 + start} {start})" (goBVExpr expr)
120+
| .extract start _ expr => pushUnaryOp s!"(_ extract {w - 1 + start} {start})" (goBVExpr expr)
120121
| .bin lhs op rhs =>
121122
let lhs := goBVExpr lhs
122123
let rhs := goBVExpr rhs
@@ -206,7 +207,7 @@ def bitwuzlaSuccess : String := "Bitwuzla thinks it's right but can't trust the
206207

207208
def bitwuzla (g : MVarId) (reflectionResult : ReflectionResult) (atomsAssignment : Std.HashMap Nat (Nat × Expr × Bool))
208209
(solverPath : System.FilePath) (cfg : BVDecideConfig) :
209-
MetaM (Except CounterExample UnsatProver.Result) := do
210+
MetaM (Except CounterExample (UnsatProver.Result Unit)) := do
210211
let smt := toSMT reflectionResult.bvExpr atomsAssignment
211212
trace[Meta.Tactic.bv] s!"Encoded as SMT: {smt}"
212213
let res ←
@@ -217,12 +218,12 @@ def bitwuzla (g : MVarId) (reflectionResult : ReflectionResult) (atomsAssignment
217218
smtQuery solverPath path cfg.timeout
218219
match res with
219220
| .sat .. => return .error ⟨g, {}, #[]⟩
220-
| .unsat => return .ok ⟨mkApp (mkConst ``bitwuzlaCorrect) (toExpr reflectionResult.bvExpr), ""
221+
| .unsat => return .ok ⟨mkApp (mkConst ``bitwuzlaCorrect) (toExpr reflectionResult.bvExpr), ()
221222

222223
def bvBitwuzla (g : MVarId) (solverPath : System.FilePath) (cfg : BVDecideConfig) :
223224
MetaM (Except CounterExample Unit) := do
224225
let some g ← Normalize.bvNormalize g cfg | return .ok ()
225-
let unsatProver : UnsatProver := fun g reflectionResult atomsAssignment => do
226+
let unsatProver : UnsatProver Unit := fun g reflectionResult atomsAssignment => do
226227
withTraceNode `bv (fun _ => return "Preparing LRAT reflection term") do
227228
bitwuzla g reflectionResult atomsAssignment solverPath cfg
228229
match ← closeWithBVReflection g unsatProver with

Leanwuzla/Basic.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide
1+
import Lean.Meta.Tactic.BVDecide
22

33
open Lean
44

@@ -22,7 +22,7 @@ def _root_.Lean.MVarId.introsP (mvarId : MVarId) : MetaM (Array FVarId × MVarId
2222
else
2323
mvarId.introNP n
2424

25-
open Elab.Tactic.BVDecide.Frontend in
25+
open Meta.Tactic.BVDecide in
2626
structure Context where
2727
acNf : Bool
2828
parseOnly : Bool
@@ -32,7 +32,7 @@ structure Context where
3232
disableAndFlatten : Bool
3333
disableEmbeddedConstraintSubst : Bool
3434
disableKernel : Bool
35-
solverMode : SolverMode
35+
solverMode : Elab.Tactic.BVDecide.SolverMode
3636

3737
abbrev SolverM := ReaderT Context MetaM
3838

@@ -42,7 +42,7 @@ def getParseOnly : SolverM Bool := return (← read).parseOnly
4242
def getInput : SolverM String := return (← read).input
4343
def getKernelDisabled : SolverM Bool := return (← read).disableKernel
4444

45-
def getBVDecideConfig : SolverM Elab.Tactic.BVDecide.Frontend.BVDecideConfig := do
45+
def getBVDecideConfig : SolverM Elab.Tactic.BVDecide.BVDecideConfig := do
4646
let ctx ← read
4747
return {
4848
timeout := ctx.timeout

Leanwuzla/NoKernel.lean

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import Leanwuzla.Basic
22

33
open Lean Std.Sat Std.Tactic.BVDecide
4-
open Elab.Tactic.BVDecide
5-
open Elab.Tactic.BVDecide.Frontend
4+
open Meta.Tactic.BVDecide
65

76
def runSolver (cnf : CNF Nat) (solver : System.FilePath) (lratPath : System.FilePath)
8-
(trimProofs : Bool) (timeout : Nat) (binaryProofs : Bool) (solverMode : SolverMode) :
7+
(trimProofs : Bool) (timeout : Nat) (binaryProofs : Bool) (solverMode : Elab.Tactic.BVDecide.SolverMode) :
98
CoreM (Except (Array (Bool × Nat)) (Array LRAT.IntAction)) := do
109
IO.FS.withTempFile fun cnfHandle cnfPath => do
1110
withTraceNode `sat (fun _ => return "Serializing SAT problem to DIMACS file") do

Leanwuzla/Parser.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Leanwuzla.Aux
1+
import Leanwuzla.Auxiliary
22
import Leanwuzla.Sexp
33

44
open Lean

Main.lean

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def parseSmt2File (path : System.FilePath) : MetaM Expr := do
1111
ofExcept (Parser.parseSmt2Query query)
1212

1313

14+
open Meta in
1415
open Elab in
1516
def decideSmt (type : Expr) : SolverM UInt8 := do
1617
let mv ← Meta.mkFreshExprMVar type
@@ -19,8 +20,8 @@ def decideSmt (type : Expr) : SolverM UInt8 := do
1920
try
2021
mv'.withContext $ IO.FS.withTempFile fun _ lratFile => do
2122
let cfg ← SolverM.getBVDecideConfig
22-
let ctx ← (Tactic.BVDecide.Frontend.TacticContext.new lratFile cfg).run' { declName? := `lrat }
23-
discard <| Tactic.BVDecide.Frontend.bvDecide mv' ctx
23+
let ctx ← (Tactic.BVDecide.TacticContext.new lratFile cfg).run' { declName? := `lrat }
24+
discard <| Tactic.BVDecide.bvDecide mv' ctx
2425
catch e =>
2526
-- TODO: improve handling of sat cases. This is a temporary workaround.
2627
let message ← e.toMessageData.toString
@@ -110,15 +111,15 @@ open Cli
110111

111112
open Elab.Tactic.BVDecide.Frontend
112113

113-
deriving instance Inhabited for SolverMode
114+
deriving instance Inhabited for Elab.Tactic.BVDecide.SolverMode
114115

115-
instance : ToString SolverMode where
116+
instance : ToString Elab.Tactic.BVDecide.SolverMode where
116117
toString
117118
| .proof => "proof"
118119
| .counterexample => "counterexample"
119120
| .default => "default"
120121

121-
instance : ParseableType SolverMode where
122+
instance : ParseableType Elab.Tactic.BVDecide.SolverMode where
122123
name := "SolverMode"
123124
parse?
124125
| "proof" => some .proof
@@ -131,7 +132,7 @@ unsafe def runLeanwuzlaCmd (p : Parsed) : IO UInt32 := do
131132
let context := argsToContext p
132133
Lean.initSearchPath (← Lean.findSysroot)
133134
enableInitializersExecution
134-
let env ← importModules #[`Std.Tactic.BVDecide, `Leanwuzla.Aux] {} 0 (loadExts := true)
135+
let env ← importModules #[`Std.Tactic.BVDecide, `Leanwuzla.Auxiliary] {} 0 (loadExts := true)
135136
let coreContext := { fileName := "leanwuzla", fileMap := default, options }
136137
let coreState := { env }
137138
let code ← SolverM.run parseAndDecideSmt2File context coreContext coreState
@@ -180,7 +181,7 @@ where
180181
disableAndFlatten := p.hasFlag "disableAndFlatten"
181182
disableEmbeddedConstraintSubst := p.hasFlag "disableEmbeddedConstraintSubst"
182183
disableKernel := p.hasFlag "disableKernel"
183-
solverMode := p.flag! "solverMode" |>.as! SolverMode
184+
solverMode := p.flag! "solverMode" |>.as! Elab.Tactic.BVDecide.SolverMode
184185
}
185186

186187
unsafe def leanwuzlaCmd : Cmd := `[Cli|
@@ -202,7 +203,7 @@ unsafe def leanwuzlaCmd : Cmd := `[Cli|
202203
disableAndFlatten; "Disable the and flattening pass."
203204
disableEmbeddedConstraintSubst; "Disable the embedded constraints substitution pass."
204205
disableKernel; "Disable the Lean kernel, that is only verify the LRAT cert, no reflection proof"
205-
solverMode : SolverMode; "Select the SAT solver configuration to use (`proof`, `counterexample`, `default`)."
206+
solverMode : Elab.Tactic.BVDecide.SolverMode; "Select the SAT solver configuration to use (`proof`, `counterexample`, `default`)."
206207

207208
ARGS:
208209
input : String; "Path to the smt2 file to work on"
@@ -215,7 +216,7 @@ unsafe def leanwuzlaCmd : Cmd := `[Cli|
215216
("pthreshold", toString trace.profiler.threshold.defValue),
216217
("maxSteps", toString Lean.Meta.Simp.defaultMaxSteps),
217218
("expthreshold", toString exponentiation.threshold.defValue),
218-
("solverMode", toString SolverMode.proof)
219+
("solverMode", toString Lean.Elab.Tactic.BVDecide.SolverMode.proof)
219220
]
220221
]
221222

Test/Bitwuzla.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Authors: Henrik Böving
55
-/
66
import Leanwuzla
77

8+
#exit
9+
810
variable (a b c : Bool)
911
variable (x y z : BitVec 32)
1012

lean-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
leanprover/lean4:v4.30.0-rc2
1+
nightly-2026-06-08

0 commit comments

Comments
 (0)