# Solver Notes

## Formula Notes

- Training comments identify the family as Martin Lester's `minimal-superpermutation` encoding. Solver behavior does not read comments.
- The formulas start with a word over `n` symbols. Supported exact shapes are `n=4,L=33` and `n=5,L=21/26`, with binary, unary, or one-hot symbol encodings.
- Unit clauses fix the first permutation to `0123` or `01234`. This is used as a structural detector after matching known variable-count shapes. There is also a conservative stripped-`n=5` fallback detector that checks prefix units and occurrence/string implication structure before trying any generalized shape.
- Remaining variables encode permutation occurrences, tree/flat coverage structure, and PB/cardinality auxiliaries.
- Some `n=4` uniqueness instances add one long clause forbidding the canonical length-33 superpermutation. These are UNSAT under the fixed first-permutation symmetry break; the solver now emits a coverage-choice RUP proof for them.

## Techniques Used

- Recover the word-variable layout from variable count plus prefix units.
- Assign constructive high-level words:
  - `012301203120132010231021302103210` for `n=4,L=33`.
  - `012340123041230142301` for `n=5,L=21`, which contains 15 distinct 5-permutation windows.
  - `01234012304123014230124301` for `n=5,L=26`, which contains 19 distinct 5-permutation windows.
  - A small deterministic portfolio of additional `n=5` high-coverage prefixes for possible nearby partial-cover lengths; every candidate still has to extend to a full CNF model and pass the independent clause checker.
- Add safe forced-false assignments for occurrence-like variables whose direct string implication is contradicted by the chosen word.
- Run a small from-scratch DPLL extender to fill coverage/PB auxiliaries, then independently check every original CNF clause before printing SAT.
- For forbidden `n=4,L=33` uniqueness formulas, branch over the 24 permutation coverage clauses and prove every occurrence choice impossible. The proof generator emits bottom-up RUP blocking clauses and finishes with an empty RUP contradiction, then VeriPB checks the proof.

## Remaining Things To Try

- Reduce the `n=4` uniqueness proof size. The current coverage-choice proof is sound and verifies, but it emits about 715k RUP clauses and a 39 MB proof per instance.
- A tree-style variable DPLL proof generator and a watched-literal CDCL/RUP prototype were tested on the forbidden `n=4` formulas. They produced much larger partial proofs and did not finish within useful short caps. The current coverage-choice proof replaces those attempts.
- Strengthen the generalized detector for unseen tree encodings if the evaluation family expands beyond the exact rows and current `n=5` fallback.
- Extract occurrence leaves directly and assign selected true occurrences to reduce the residual DPLL work further, though current local times are already very small.

## Known Limitations

- UNSAT claims are only made for detected forbidden canonical `n=4,L=33` uniqueness formulas when the coverage-choice RUP proof is fully written. If proof generation times out or shape recovery fails, the solver returns `UNKNOWN`.
- The detector is intentionally specialized to the observed generator regimes. The `n=5` fallback is conservative and returns `UNKNOWN` when shape recovery is ambiguous.
- The residual DPLL is for auxiliary extension after a constructed word, not a competitive general SAT solver.
- The older CDCL proof prototype remains in `solver.cpp` as future work scaffolding, but submitted UNSAT behavior uses the coverage-choice proof generator.

## Changelog

- Initial scaffold replaced with a C++ solver that detects binary/unary/one-hot superpermutation shapes, constructs candidate words, extends them to complete CNF assignments, and self-checks models.
- Added `tools/proto.py` as the analysis notebook/prototype used to validate structure recovery and candidate words on the train split.
- Updated metadata and build notes for broker submission.
- 2026-05-10: Rebuilt and reverified the inherited SAT path on all 37 train formulas: 29 SAT models, 8 conservative UNKNOWN returns, total local runtime under one second with a 15 second external cap per instance.
- 2026-05-10: Added structural detection for the canonical-word forbid clause and prototyped VeriPB RUP proof generation via tree DPLL and CDCL. Local proof attempts generated tens to hundreds of MB without completing quickly, so proof emission was left disabled for sound and fast submission behavior.
- 2026-05-10: Broker run `eval_20260510T011200Z_36870701` reported 31 SAT and 6 UNKNOWN on the visible train results, with no invalid models, crashes, timeouts, or proof errors. This beats the listed VBS solved count of 29/37 on solved count and is much faster on solved SAT instances.
- 2026-05-10: Added an `n=5` candidate-word portfolio and a conservative structural fallback detector for stripped `n=5` shapes. Rechecked all 37 train instances locally: 29 SAT, 8 UNKNOWN, no crashes or invalid models, total runtime under one second with a 20 second external cap.
- 2026-05-10: Retested the old CDCL UNSAT prover with word-first and occurrence-coverage-first branching on a binary `n=4` uniqueness instance. Both hit the 60 second cap without a proof, motivating the separate coverage-choice proof generator.
- 2026-05-10: Added `CoverageProof`, a dedicated RUP proof generator for forbidden `n=4,L=33` uniqueness formulas. Local tests on one-hot, unary, and binary flat/tree variants produced 714,902 learned RUP clauses, about 39 MB proof files, solver times around 74-92s, and successful `veripb --cnf` verification.
