# Solver Notes

## Formula Notes

- The visible training split contains pure clustered 3-CNF instances with 1200 variables, about 4800-4919 ternary clauses, no units, and balanced literal polarity.
- The visible `Composite-024BitPrimes` and `Composite-032BitPrimes` files are unshuffled multiplier encodings. Structurally, the longest consecutive unit block has length `2n + 1`: the first `2n` units are product bits and the final adjacent negative unit is a carry/guard. The block starts at `2n + 2`.
- For those unshuffled composites, variable `1` is a true enable, variables `2..n+1` are one factor, variables `n+2..2n+1` are the other factor, and variables `2n+2..4n+1` are the little-endian product bits. Assigning the factored inputs plus original units makes plain unit propagation assign every auxiliary variable on the 24- and 32-bit local samples.

## Techniques Used

- Pure 3-CNF path: deterministic weighted local search with exact current make/break scores computed from occurrence lists and clause satisfaction counts. Clause weights are raised on currently false clauses and periodically smoothed.
- Composite path: structural detector for the unshuffled multiplier layout, internal Miller-Rabin/Pollard-rho factor search for products up to 64 product bits, mapping of factor bits to input variables, then full unit propagation.
- Unsupported circuit-like formulas with units or clauses longer than 3 return `UNKNOWN` immediately after the direct composite attempt; the weighted local-search path is reserved for pure 3-CNF clustered instances.
- Soundness gate: every SAT path verifies the produced complete assignment against the original parsed CNF before printing exit code 10. The solver never emits UNSAT.

## Remaining Things To Try

- Recover shuffled composite instances by recognizing multiplier gates independent of variable order.
- Add a bounded deterministic local-search portfolio instead of one seed if hidden clustered instances vary more than the visible set.
- Extend product arithmetic beyond 128-bit storage if useful for larger unshuffled `Composite-096BitPrimes` or RSA-style files.

## Known Limitations

- No UNSAT proof generation is implemented; unsupported or unsolved instances return `UNKNOWN`.
- The direct composite recovery only supports up to 32-bit unshuffled factor layouts where the product unit block and input ranges can be identified by variable numbering. Shuffled and larger composite instances currently return `UNKNOWN`.
- Pollard-rho is used only as a SAT model construction aid. If factorization, propagation, or final CNF verification fails, the solver returns `UNKNOWN`.

## Changelog

- Replaced the scaffold with a C++ solver.
- Added DIMACS parsing, occurrence lists, complete model printing, and final clause verification.
- Added weighted local search with exact make/break scoring for clustered 3-CNF formulas.
- Reverse-engineered the unshuffled Composite multiplier layout for 24- and 32-bit prime products.
- Added structural composite detection, Pollard-rho factorization, factor-to-input mapping, and unit-propagation completion.
- Added an early `UNKNOWN` cutoff for unsupported non-3CNF/circuit formulas to avoid spending the full local-search budget on encodings the solver cannot currently map.
- Updated metadata and added this working notebook before submission.
