# Solver Notes

## Formula Notes

The training formulas are sanitized cube leaves from the Boolean
Pythagorean triples problem. Comments are not needed. The remaining CNF after
the upstream cube has only same-polarity clauses:

- Adjacent ternary pairs `(a b c)` and `(-a -b -c)` encode one NAE
  hyperedge, forbidding all three remaining numbers from taking the same
  color.
- Same-polarity binary clauses are reduced triples where the third variable
  was fixed by the cube. Positive binaries forbid both endpoints being false;
  negative binaries forbid both endpoints being true.
- The train split has about 3.7k variables, 13.5k-14.5k CNF clauses, and
  roughly 6.2k-7.2k recovered NAE triples plus 100-1000 binary constraints.

All observed training instances are SAT. The solver does not attempt UNSAT
proofs.

## Techniques Used

The solver parses DIMACS and recovers the monotone NAE/binary structure
structurally from the clauses, without using comments, names, hashes, or file
identity. It then runs a deterministic stochastic-local-search portfolio over
the recovered coloring problem:

- weighted min-conflicts over violated recovered constraints;
- random-walk noise and age tie-breaking to escape shallow plateaus;
- a fixed seed portfolio chosen from local training behavior;
- a bounded focused DFS repair when the search reaches 1-4 violated
  constraints;
- full original-CNF verification before printing `s SATISFIABLE`.

If recovery fails, the search times out, or the final model does not satisfy
the original CNF, the solver prints `UNKNOWN`.

## Remaining Things To Try

- b01 remains the local hard case: many seeds reach 1-2 violated constraints
  but do not close quickly. A larger neighborhood repair or a specialized
  Kempe-chain style recoloring may finish it.
- Reconstructing the original cube assignments and number mapping might allow
  importing or generating a full 1..7824 Pythagorean coloring, but the current
  solver does not rely on that.
- Additional portfolio tuning may reduce average time; solved count is the
  current priority.

## Known Limitations

- SAT-only. UNSAT instances return `UNKNOWN`; no VeriPB proof generation is
  implemented.
- The detector is intentionally narrow: it supports the observed monotone
  Pythagorean cube encoding and returns `UNKNOWN` for mixed-polarity clauses
  or unsupported structures.
- The local search is heuristic. Soundness is protected by full CNF model
  checking, but completeness is not guaranteed.

## Changelog

- Initial scaffold: placeholder UNKNOWN solver.
- Added C++ structural detector for same-polarity NAE ternary pairs and
  same-polarity binary cube constraints.
- Added weighted min-conflicts/WalkSAT-style color repair with independent
  original-CNF verification before SAT output.
- Reduced diagnostic noise and tuned restart policy for near-solution
  plateaus.
- Added bounded focused DFS repair for states with 1-4 violated constraints.
- Added deterministic fixed-seed portfolio. Local 180 second sweep solved
  16/17 training instances; b01 remained unknown.
