Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Commit

Permalink
chore: workaround for missing ByteArray literals
Browse files Browse the repository at this point in the history
  • Loading branch information
hargoniX committed Aug 5, 2024
1 parent 2442dc8 commit f48d7ff
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions LeanSAT/Tactics/BVTrace.lean
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,28 @@ def evalBvTrace : Tactic := fun stx =>
match stx with
| `(tactic| bv_decide?%$tk) => do
let lratFile : System.FilePath ← getLratFileName
let cfg ← BVCheck.mkContext lratFile
let cfg := { (← BVCheck.mkContext lratFile) with trimProofs := false }
let g ← getMainGoal
let trace ← g.withContext do
g.bvDecide cfg
/-
Ideally trace.lratCert would be the `ByteArray` version of the proof already and we just write
it. This isn't yet possible so instead we do the following:
1. Produce the proof in the tactic.
2. Skip trimming it in the tactic.
3. Run trimming on the LRAT file that was produced by the SAT solver directly, emitting the
correct binary format according to `sat.binaryProofs`.
TODO: Fix this hack:
1. Introduce `ByteArray` literals to the kernel.
2. Just return the fully trimmed proof in the format desired by the configuration from `bvDecide`.
3. Write it to the file driectly.
-/
match trace.lratCert with
| none =>
let normalizeStx ← `(tactic| bv_normalize)
TryThis.addSuggestion tk normalizeStx (origSpan? := ← getRef)
| some .. =>
if cfg.trimProofs then
if sat.trimProofs.get (← getOptions) then
let lratPath := (← BVCheck.getSrcDir) / lratFile
LRAT.trimFile lratPath lratPath cfg.binaryProofs
let bvCheckStx ← `(tactic| bv_check $(quote lratFile.toString))
Expand Down

0 comments on commit f48d7ff

Please sign in to comment.