# Solver Notes

## Formula Notes

- The family is a clique-width encoding. Training instances are named for graphs
  and a parameter `k`; comments are not needed.
- The live variables start at the smallest variable appearing in a clause. The
  prefix before that is unused in all sampled instances and has size
  `k*n^2 + n*|E|`.
- With `C = n*(n-1)/2`, the live blocks are:
  - `P`: `n*C` variables, monotone equivalence relations for components.
  - `Q`: `n*C` variables, monotone equivalence relations for label groups.
  - `R`: `n^2` representative variables for `Q` blocks.
  - `S`: `n*C` representative-pair variables inside `P` components.
  - `L`: `(k-1)*n^2` unary order variables that force at most `k` `Q` groups
    per `P` component.
- Unit clauses count to `n^2`. Initial `P` pairs are false, final `P` pairs are
  true, and the row-start `R` variables are true.
- Edge constraints can be recovered structurally from binary clauses of the
  form `P_t(edge) OR not Q_{t+1}(edge)`.

## Techniques Used

- The solver recovers `n`, `k`, block starts, and graph edges from the clause
  layout.
- It first searches for a strict linear growing-prefix derivation. If that
  mapped assignment satisfies the CNF, the model is emitted immediately.
- If exact linear detection fails, it builds a looser greedy growing-prefix
  assignment and uses it only as phase guidance for a from-scratch
  watched-literal CDCL search.
- The solver emits SAT only after independently checking every original clause.
  It never emits UNSAT because no VeriPB proof is generated.

## Local Results

- `Chvatal-k5`: SAT in about 0.2s after the structural hint path.
- `Paley13-k9`: direct strict-linear SAT model in about 0.01s.
- Most larger known-unsat-looking instances did not solve in 8-30s local
  cutoffs with the current CDCL core.

## Remaining Things To Try

- Implement a direct bottom-up k-derivation search over `P/Q` partitions rather
  than using the growing-prefix approximation.
- Add a local-search repair phase starting from the greedy structural model.
- Design a VeriPB proof strategy for obvious lower-bound UNSAT cases; current
  code deliberately returns UNKNOWN for all UNSAT outcomes.
- Improve CDCL clause database reduction and branch ordering over only live
  structural variables.

## Known Limitations

- No UNSAT proofs are produced.
- The greedy derivation is only a hint and is too restrictive for many SAT
  clique-width expressions.
- Larger UNSAT instances can consume much of the per-instance budget before
  returning UNKNOWN, though learned-clause growth is now capped to avoid OOM.

## Changelog

- Replaced the scaffold with a C++20 solver compiled by the provided Ice Lake
  build script.
- Added `tools/prototype_linear.py` for block discovery and model prototyping.
- Reverse-engineered the live clique-width variable blocks and edge-recovery
  pattern.
- Implemented a from-scratch watched-literal CDCL core with model verification.
- Added structural clique-width detection and greedy derivation phase hints.
- Added exact strict-linear derivation search and direct model mapping.
- Added a learned-clause growth cutoff to return UNKNOWN instead of OOM.
- Deepened strict-linear DFS for `n=25,k=9` and `n=25,k>=13` structural
  regimes, and replaced the failed-prefix cache with a hash set.
- Changed strict-linear DFS candidate ordering to minimize the next boundary
  neighborhood-type count instead of only using future degree.
- Updated metadata for broker submission.
