# Solver Notes

## Formula Notes

- Training instances are PEQNP bit-blasted arithmetic encodings for a balanced partition problem over 200 primary selector variables.
- A long clause over `-1 .. -200` identifies the primary selection vector. The first arithmetic block constrains exactly 100 selected items.
- The tail consists of repeated four-clause equality gadgets between two final sum bit-vectors. The bit-vector width is detected from the CNF tail rather than filenames or comments.
- Evaluating the circuit under balanced selections exposes `left_sum - right_sum`. Swapping one selected and one unselected primary recovers relative item weights.
- All observed UNSAT training instances have odd normalized total recovered weight, so the least significant bits of the two final sum vectors cannot be equal for any primary assignment.
- The low-bit contradiction lives in a small fan-in cone. Extracting clauses whose maximum variable defines a needed low-bit cone variable gives roughly 2k clauses, and a from-scratch CDCL run on that sub-CNF produces RUP clauses that also verify against the original full CNF.

## Techniques Used

- Structural detection of the primary vector and final equality gadget.
- Repeated unit propagation with the final equality temporarily excluded to evaluate the encoded arithmetic circuit.
- Recovery of relative weights from balanced swaps, avoiding comments, filenames, hashes, and memorized instances.
- Cardinality-aware bitset dynamic programming for the equal-size equal-sum partition.
- Full propagation and independent CNF clause validation before printing `SATISFIABLE`.
- Low-bit fan-in cone extraction for odd-total UNSAT cases, followed by bounded from-scratch CDCL over the extracted sub-CNF. Learned clauses are written as VeriPB `rup` constraints and checked by the broker against the original CNF.
- Full-CNF bounded CDCL remains as a fallback for unsupported DP-infeasible instances.

## Current Local Results

- Visible train split solved locally: all 8/8 instances.
- SAT training instances solved: 10, 13, 14, and 18 visible bits. Solver wall times were about 0.16s, 0.28s, 0.41s, and 3.50s respectively in this container.
- UNSAT training instances solved: 11, 16, 17, and 19 visible bits. Low-bit cone proofs used 1960, 1984, 2156, and 2120 extracted clauses respectively; solver wall times were about 0.20s, 0.28s, 0.30s, and 0.32s, and local `veripb --cnf` checks were about 0.07s to 0.12s.
- Local proof gate used for UNSAT claims: `veripb --cnf formula.cnf out.pbp`.
- Broker run `eval_20260508T185402Z_e718ba65` solved 8/8 train instances with status counts `sat: 4, unsat: 4`; reported times ranged from 0.417s to 7.601s, with no invalid, unknown, timeout, crash, or prover failures.

## Remaining Things To Try

- Improve the SAT reconstruction path if larger hidden instances have much larger recovered sums; current recovery still repeatedly propagates the full arithmetic prefix for balanced swaps.
- A cutting-planes parity proof may be even smaller than the low-bit RUP proof, but the cone RUP path is already small and verifies quickly on the visible split.
- Improve CDCL clause deletion/minimization if future low-bit cones grow substantially.

## Known Limitations

- UNSAT proof generation is specialized to odd-total low-bit contradictions. The solver only commits to UNSAT when its generated RUP proof is checkable; other unsupported DP-infeasible cases fall back to bounded full-CNF CDCL and then `UNKNOWN`.
- The detector assumes the PEQNP shape has one contiguous primary vector and a final equality suffix.
- The DP uses memory proportional to `cardinality * target_sum`; this is suitable for the observed bit widths but should be watched on larger families.
- The CDCL fallback is deliberately bounded to avoid broker hard timeouts on cases where it is not learning the right proof.

## Changelog

- Replaced the scaffold with a C++ structural model finder.
- Added CNF parsing, PEQNP tail detection, propagation-based circuit evaluation, relative weight recovery, bitset DP, divide-and-conquer reconstruction, and final model checking.
- Added normalized-total parity logging for recovered high-level instances.
- Added a bounded in-house CDCL fallback with watched literals, first-UIP learning, restarts, phase saving, and VeriPB `rup` proof emission for UNSAT cases that it can certify.
- Added `tools/recover_stats.py` as an exploratory script for inspecting recovered normalized totals.
- Updated metadata to describe the SAT DP path and bounded RUP proof fallback.
- Added low-bit fan-in cone extraction and CDCL on that sub-CNF before the full-CNF fallback; this turns the 11-, 16-, and 17-bit visible UNSAT cases from `UNKNOWN`/long search into small verified RUP proofs.
- Updated metadata and local result notes for the low-bit proof path.
- Recorded broker result `eval_20260508T185402Z_e718ba65`: 8/8 train solved, improving strongly over the listed Kissat baseline PAR-2.
