# Solver Notes

## Formula Notes

Training formulas are sanitized DIMACS 3-CNFs from the `sgen-balanced` /
`balancedsat` shape.  The four train instances have 180-210 variables and
648-739 ternary clauses.  Every variable occurs 10 or 11 times, with polarity
counts near balanced (5/5, 5/6, or 6/5).  Variable-pair reuse is almost absent:
each instance has at most two repeated unordered variable pairs across all
clauses.

The solver does not use comments, file names, hashes, or expected-result
metadata.  It detects only this sparse balanced 3-CNF structure and returns
`UNKNOWN` for formulas outside the supported range.

## Techniques Used

- Watched-literal CDCL-style search written from scratch.
- A catch-up scan over original clauses after propagation.  This is important
  for this implementation because backtracking can expose units in original
  clauses whose watched literals did not transition to false.
- First-UIP learned clauses are emitted as VeriPB `rup` steps.
- No restarts.  Restarts were much worse on this family; chronological progress
  solved all train instances.
- Aggressive deletion of unlocked non-binary learned clauses, mirrored into the
  proof with `del id ... ;`.  This was the key change that made VeriPB checking
  fast enough.
- Complete model checking before any SAT answer.  No SAT answer was observed on
  the train split.

## Local Results

Final local runs on comment-stripped training formulas:

| instance | solver result | solver time | VeriPB time |
| --- | ---: | ---: | ---: |
| bsat180-648 | UNSAT | 28.15s | 11.38s |
| bsat192-689 | UNSAT | 47.23s | 18.83s |
| bsat201-707 | UNSAT | 132.35s | 52.21s |
| bsat210-739 | UNSAT | 262.64s | 100.35s |

The strongest supplied baseline solved 2/4.  This solver solved and locally
verified 4/4 on the train split.

## Remaining Things To Try

- Better proof-core extraction.  A simple parent-closure attempt produced an
  invalid RUP proof because VeriPB propagation dependencies are broader than
  the explicit resolution parents tracked by conflict analysis.
- More principled clause deletion based on LBD or activity.  The current policy
  is intentionally simple: delete unlocked non-binary learned clauses every
  10k conflicts.
- A cleaner watched-literal implementation could remove the original-clause
  catch-up scan, but the current runtime is already below the target budget.

## Known Limitations

- This is not a general-purpose SAT solver.  The detector is intentionally
  narrow and the solver exits `UNKNOWN` for unsupported structures.
- UNSAT proof logs are still large, especially for the 210-variable instance,
  but local VeriPB verification stays well under 600 seconds after deletion.
- The solver has no UNSAT fallback proof strategy if the CDCL search times out.

## Changelog

- Replaced the placeholder solver with a structural detector for sparse
  balanced 3-CNF instances.
- Implemented a proof-logging watched-literal CDCL search with first-UIP
  learning and complete SAT model validation.
- Added original-clause catch-up propagation to avoid missed units after
  backtracking.
- Removed restarts after local testing showed no-restart search solved the
  train split much faster.
- Added VeriPB proof logging and local proof verification.
- Added aggressive learned-clause deletion and matching `del id` proof events,
  reducing proof-check time enough for all four train instances.
- Changed proof logging from in-memory buffering to streaming output during
  search after broker feedback showed one train instance could OOM while
  retaining the full proof event log.
