# Solver Notes

## Formula Notes

- The regular LABS instances expose variables `1..n` as spin/sequence bits.
- The first auxiliary block defines per-lag pair-product or disagreement variables; in the ordered encoding the first clause contains variable `n+1` with sequence variables `1` and `2`.
- The high-level constraint is a peak aperiodic autocorrelation bound: for spins `s_i in {-1,+1}`, each lag correlation `C_k = sum_i s_i s_{i+k}` must be within a small goal.
- Unit constraints in the cardinality network correlate with the goal and provide a rough structural estimate. The solver still validates against the full CNF rather than trusting this estimate.
- Some training files are shuffled/sc2013 or use a different `SAT_instance_N` encoding. The current detector intentionally returns `UNKNOWN` on those until their variable mapping is recovered.

## Techniques Used

- Ordered LABS structure detection from clauses, not comments or filenames.
- Specialized stochastic local search over the `n` high-level spin variables using O(n) flip updates for all autocorrelations.
- SAT-only model construction: assign the spin variables, unit-propagate the original CNF to set auxiliaries, fill remaining variables negatively, then check every original clause before returning SAT.
- No UNSAT claims are produced, avoiding proof-soundness risk while the proof strategy is undeveloped.
- Very tight inferred peak goals return `UNKNOWN` quickly because this version has no proof generator and local search would otherwise burn the full instance timeout on known-hard/unsat cases.

## Remaining Things To Try

- Recover the shuffled/sc2013 variable mapping from XOR/product signatures.
- Add a stronger LABS search such as skew-symmetric branch-and-bound or Prestwich-style focused local search for tight goals 3-5.
- Infer the exact goal from cardinality network structure instead of using a range.
- Build a VeriPB proof strategy for obviously impossible low peak-correlation goals.

## Known Limitations

- Unsupported encodings return `UNKNOWN`.
- Tight SAT goals may still be hard, but goal-3 ordered instances receive a larger search slice because they are satisfiable in the training family and close to the edge of the local-search runtime distribution.
- Completion uses repeated full-clause unit propagation; this is simple and sound but can be slow on the largest formulas.

## Changelog

- 2026-05-07: Replaced scaffold with an ordered LABS SAT-only solver. Added direct autocorrelation local search, CNF completion by unit propagation, full clause validation, metadata, and working notes.
- 2026-05-07: Added a fast `UNKNOWN` path for inferred peak goals at or below 2 on nontrivial lengths, avoiding long SAT-only searches on low-goal unsat instances.
- 2026-05-07: Increased the search slice for inferred goal-3 ordered LABS instances after broker feedback showed one satisfiable length-41 case could land just past the default slice on worker hardware.
