# Solver Notes

## Formula Notes

- The visible formulas are from the `multiplier-verification` family and have a very regular shape:
  one unit clause, then six 3-CNF clauses per ITE node, then one wide miter
  clause.
- The unit variable is the constant true node. In the visible `gm16` formulas it
  is variable 33; for `gm24` it is 49; for `gm28` it is 57. This matches
  `2 * bitwidth + 1`.
- Each six-clause block is:
  `out = ITE(decision_literal, high_literal, low_literal)`.
  The decision variable is always one of the primary input variables below the
  constant variable, and children are constants, primary inputs, or already
  defined ITE nodes.
- The wide final clause is the multiplier miter output. For `sparrc` instances,
  bounded ROBDD reconstruction collapses the miter to false quickly. This now
  triggers a proof-logging CDCL pass rather than an immediate UNSAT claim.
- The visible `gm16spctrc` instance does not collapse under the bounded BDD
  orders tried here. Proving each non-constant miter root false as a CDCL
  assumption, while retaining learned RUP clauses between roots, solves it.

## Techniques Used

- Conservative structural detector for the exact ITE block encoding. If any
  check fails, the solver returns `UNKNOWN`.
- Functional reconstruction of all extension variables from primary inputs.
- Exact bounded ROBDD rebuild under several simple and interleaved variable
  orders. If the miter BDD is nonzero, a satisfying primary assignment is
  extracted and expanded to a complete CNF model.
- 64-way bit-parallel simulation with deterministic pseudo-random inputs to find
  counterexamples when exact BDD construction exceeds the node/time limit.
- Every SAT candidate is checked against every original CNF clause before the
  solver prints `s SATISFIABLE` and exits 10.
- A watched-literal CDCL implementation logs learned clauses as VeriPB `rup`
  constraints and emits UNSAT only when the proof path derives a contradiction.
  Exact-zero BDD cases use low-bit interleaved primary branching, which makes
  the visible `sparrc` proofs tiny.
- BDD-hard miter clauses use retained assumption splitting: each miter output is
  asserted as a decision assumption, CDCL learns unconditional RUP clauses, and
  the learned clauses plus final wide clause eventually derive the empty clause.
  This solves the visible `gm16spctrc` instance.

## Remaining Things To Try

- Watch broker results for larger `spctrc`/`spctlf`/`spdt*`/`spwt*` formulas.
  The retained-assumption proof solves visible `gm16spctrc`, but proof checking
  is expensive and larger variants may still time out.
- Revisit compact non-CDCL proof logging. A direct RUP tree proof from Shannon
  expansion works for small roots but expands to millions of clauses by
  mid-order output bits, so it is not currently viable.
- Investigate `red`/RAT-style proof logging for BDD-derived units. A first test
  on `x34` showed the checker asks for proofgoals corresponding to the positive
  definition clauses and the shortened wide miter clause.
- Learn better variable orders or direct algebraic proof rules for BDD-hard
  architectures. Low/high operand interleavings still exceed one million ROBDD
  nodes on visible `gm16spctrc`.
- Add a guided local-search layer over primary inputs for rare counterexamples.

## Known Limitations

- UNSAT is claimed only through the CDCL RUP proof path. Exact BDD zero alone is
  not treated as a checkable proof.
- The parser is aimed at sanitized DIMACS inputs. The evaluator strips comments,
  and the solver does not depend on comments or filenames.
- The current random search budget is finite. Hard SAT instances with very rare
  counterexamples may return `UNKNOWN`.
- The `gm16spctrc` proof is valid but verifier-heavy. Local solver time is about
  46s and local VeriPB time is about 370s for the deterministic final build.

## Changelog

- Initial scaffold replaced with a C++20 solver.
- Added ITE-family structural detection and functional model reconstruction.
- Added bounded ROBDD exact SAT extraction.
- Added 64-way bit-parallel randomized counterexample search.
- Added complete CNF self-check before SAT output.
- Updated metadata for broker submission.
- Added a watched-literal CDCL backend with VeriPB RUP proof logging for
  exact-zero BDD cases.
- Verified generated proofs locally on the visible `gm16sparrc`, `gm24sparrc`,
  and `gm28sparrc` instances.
- Shortened broker metadata description and technique list after an immediate
  intake failure on one submission attempt.
- Added high-to-low interleaved BDD order candidates.
- Changed exact-zero CDCL branching to low-bit interleaved primary inputs,
  reducing visible `sparrc` proofs to roughly 6-20 KB and solve times under
  0.4s locally.
- Added learned-clause minimization for the proof-logging CDCL backend.
- Added retained assumption splitting for BDD-hard wide miter clauses.
- Verified the visible `gm16spctrc` proof locally with VeriPB; deterministic
  final-build solve time was about 46s and proof-check time about 370s.
- Tried time-slicing retained assumption splitting across roots, but broker
  feedback showed it starved `gm16spctrc` and caused an OOM on larger `spctrc`.
  Reverted to the broker-best full-budget root order.
