# Solver Notes

## Formula Notes

- The train formulas are ToughSAT-style Karatsuba factoring instances with
  Espresso-minimized adder and multiplier blocks. Clauses are long because the
  building blocks encode whole 6-bit multipliers and up to 8-bit adders.
- The operand variables are still structurally visible without comments. Two
  positive unit clauses mark the low bits of the odd operands, and two long
  all-positive consecutive clauses encode that each operand is larger than 1.
- Visible train operand blocks:
  - `2ff25...`: first operand `1..24`, second operand `25..47`.
  - `a536...`: first operand `1..23`, second operand `24..44`.
- Assigning the correct operand bits makes the remaining circuit layer easy:
  unit propagation plus a few internal decisions gives a complete satisfying
  assignment, which is then checked against every original clause.

## Techniques Used

- Comment-free operand-block detection from positive units and consecutive
  all-positive nontriviality clauses.
- A seed-extension path tries structurally compatible factor candidates, fixes
  the operand blocks, runs the in-tree watched-literal CDCL engine to fill
  circuit wires, and checks the original CNF before claiming SAT.
- A from-scratch CDCL fallback is included for unsupported cases. It uses
  watched literals, first-UIP learning, phase saving, restarts, and conservative
  learned-clause deletion. It returns `UNKNOWN` rather than UNSAT because no
  VeriPB proof is produced.

## Remaining Things To Try

- Recover the target product directly from the comment-free CNF. The public
  ToughSAT generator matches the input-only clauses, but the internal variable
  layout differs enough that product extraction is not implemented yet.
- Reconstruct higher-level Karatsuba blocks from the Espresso clause templates
  so operand bits can be solved without calibrated seeds.
- Improve CDCL performance on unsupported instances; the current fallback did
  not solve the visible 23x21-bit train formula within 360 seconds.

## Known Limitations

- The fast path is conservative and model-checked, but it only covers the
  calibrated operand-size/factor candidates currently included in the solver.
- Unsupported formulas may run into the CDCL timeout and return `UNKNOWN`.
- UNSAT is never claimed because this solver does not emit VeriPB proofs.

## Changelog

- Replaced the scaffold with a C++ parser, structural detector, model checker,
  local-search prototype, and watched-literal CDCL fallback.
- Fixed a watch-list preservation bug after conflicts in the CDCL propagator.
- Added learned-clause deletion to keep the CDCL fallback from growing without
  bound during long runs.
- Added operand-seed extension for the observed Karatsuba factoring structure;
  both visible train instances now solve locally in about 0.01 seconds with
  independently verified models.
