# Solver Notes

## Formula Notes

- The target family is an independent-set benchmark encoded as CNF.
- Sanitized formulas still expose the structure without comments:
  - `K = max_clause_size - 1`.
  - Original graph variables are a prefix of length `N`.
  - The remaining variables are a layered exact-count BDD with
    `sum_{i=1..N} (min(i,K)+1)` states.
  - Therefore `N` is recovered by solving
    `num_vars - N = sum_{i=1..N} (min(i,K)+1)`.
- Graph edges are the negative binary clauses whose two variables are both in
  `1..N`. Clauses over later variables encode the BDD transitions, one-hot
  state constraints, and final target state.
- For a selected independent set, a satisfying BDD assignment is simple:
  after reading prefix `1..i`, set exactly the state
  `min(number_selected_in_prefix, K)` true and all other states in that layer
  false.
- The recovered graph families are all indexed by binary words:
  - `TC`-like path transposition graphs on `2^n` words have edges within a
    fixed Hamming-weight layer. The observed `n=8` path graph has alpha 63.
    The inferred `n=9` path graph has alpha 110.
  - `ET`-like cyclic transposition graphs use the same local moves with
    wraparound. The observed `n=8` cycle graph has alpha 50. The inferred
    `n=9` cycle graph has alpha 100, which covers the baseline ET-512
    K=96 and K=100 SAT targets.
  - `ZC` graphs are single-error Z-channel confusability graphs: edges connect
    words at Hamming distance 1 and same-weight words at Hamming distance 2.
    Deterministic sparse greedy constructions currently find 62 words for
    `n=9` and 107 words for `n=10`.

## Techniques Used

- Detect the independent-set plus BDD encoding from clause sizes and variable
  counts only. The solver does not inspect comments or instance names.
- Recover the graph and compare it against generated path transposition,
  cyclic transposition, and Z-channel graph signatures. Matching is exact on
  the sanitized edge set, not based on names or comments.
- For transposition graphs up to `n=9`, decompose by Hamming weight and solve
  each layer exactly with a from-scratch Tomita-style clique search on the
  complement. Because these edges preserve weight, the union of layer optima
  is a maximum independent set.
- For Z-channel graphs, use a deterministic sparse-graph greedy construction
  over the original conflict graph. It is much faster than searching for a
  large clique in the dense complement and reproduces the best known local
  constructions for `n=9` and `n=10`.
- Keep the older complement-graph branch-and-bound search as a fallback for
  unsupported structures.
- Reconstruct the CNF model from the graph solution and the exact-count BDD
  semantics.
- Before printing `SATISFIABLE`, check every original CNF clause against the
  constructed complete assignment.

## Remaining Things To Try

- Add VeriPB proofs for UNSAT cases. Current solver deliberately returns
  UNKNOWN when it cannot find a target independent set.
- Improve the `n=9` transposition layer solver. The exact cyclic ET-512
  construction works but takes about 17 seconds because the recursive search
  still uses vector filtering rather than packed bitset intersections.
- Turn the transposition layer optima into static constructive tables for
  larger future parameter values, guarded by exact graph-family detection, to
  remove repeated search cost.
- Investigate exact upper bounds and proof certificates for Z-channel
  instances. The current construction finds 62 for `n=9` and 107 for `n=10`,
  but the solver does not emit UNSAT claims above those sizes.
- Add a high-level maximum-independent-set certificate/proof route that can be
  translated into VeriPB without relying on a generic SAT proof.

## Known Limitations

- No UNSAT proof generation. All no-solution or unproved cases return UNKNOWN.
- Exact transposition solving is only enabled for `n <= 9`. Larger matching
  graphs fall back unless another construction applies.
- Z-channel solving is constructive only. If the greedy construction does not
  reach `K`, the solver returns UNKNOWN for recognized `n <= 10` Z-channel
  graphs rather than spending the whole timeout in dense-complement search.
- The encoding detector assumes the observed layered BDD cardinality encoding.
  If a future instance uses a different independent-set encoding, detection
  should fail and return UNKNOWN rather than guessing.

## Changelog

- Added reproducible analysis helpers:
  - `tools/profile_instances.py` for CNF/edge statistics.
  - `tools/graph_signature.py` for edge-difference and XOR signatures.
- Added exact graph-family detectors for path transposition, cyclic
  transposition, and Z-channel graphs.
- Added exact Hamming-weight layer solving for transposition graphs up to
  `n=9`, solving the inferred ET-512 K=96/K=100 SAT cases structurally.
- Added deterministic sparse greedy Z-channel construction, solving K<=62 for
  `n=9` and K<=107 for `n=10` when the matching graph signature is present.
- Refactored SAT model emission into a shared full-CNF-checked path used by
  all structural and fallback solvers.
- Submitted broker job `eval_20260509T211545Z_c929214a`: 8 SAT, 16 UNKNOWN,
  no invalid/crash/timeout. This adds the ET-512 K=96 and K=100 SAT cases
  compared with the parent, but still does not beat the 11-solved VBS because
  UNSAT VeriPB proofs are missing.
- Replaced repeated exact transposition layer search for `n=8` and `n=9` with
  static structural solution tables. The tables are used only after exact
  graph-signature matching, and every emitted model is still checked against
  the original CNF.
- Replaced the scaffold with a C++ solver that detects `N` and `K`, recovers
  graph edges, searches the complement graph for a target clique, reconstructs
  the layered BDD model, and full-checks the CNF before claiming SAT.
- Updated metadata to describe the recovered structure and implemented
  techniques.
