# Solver Notes

## Formula Notes

- The target family is independent-set reconfiguration.
- The original graph is the leading run of negative binary clauses over variables `1..n`.
- Shifted copies of that same edge-clause block identify the explicit configuration variables.
- The source set is encoded by negative units in the first auxiliary block `n+1..2n`.
- The target set is encoded by unit clauses on the final recovered configuration block.
- Large positive clauses and XOR-style ternary groups enforce pairwise distinct configurations and transition/difference witnesses, so the high-level problem is an exact-length simple token-jump path, not just reachability.

## Techniques Used

- Structural detector for graph size, edge set, shifted configuration blocks, source, target, `k`, and exact path length.
- For `n <= 50`, enumerate all size-`k` independent sets, build on-the-fly token-jump neighbors, compute reverse BFS distances to target, and DFS for an exact simple path.
- For queen-like medium instances (`n <= 225`, moderate `k`), use a deterministic randomized self-avoiding walk with greedy direct tails to hit the exact length.
- For queen-board instances with `k = N-1` (notably queen20), detect the board directly from the attack graph and search in the compact "missing row / missing column" state space. Tight cases use bidirectional BFS for the exact shortest path; slack cases first try a deterministic randomized detour walk.
- SAT model mapping assigns recovered configuration blocks, applies repeated unit propagation through definitional clauses, fills remaining auxiliaries false, then checks every original clause before returning exit code 10.
- An experimental from-scratch C++ CDCL/RUP proof helper is present and built as `cdcl_prover`, but it is not currently invoked by the main solver because it has not produced a verified training UNSAT proof within useful time.

## Remaining Things To Try

- Generalize the queen-board constructor beyond the `k=N-1` regime and reduce the tight-path memory footprint.
- Replace the Python queen20 bidirectional BFS with a lower-memory C++ implementation if queen20 tight-path time becomes important.
- Add specialized handling for sparse high-`k` instance families such as `Ins`/`FullIns` using complements or graph decomposition.
- Design VeriPB certificates for lower-bound UNSAT cases where source-target token distance exceeds the encoded path length.
- Replace repeated whole-CNF propagation with watched propagation for better large-instance scaling.

## Known Limitations

- No UNSAT answers are emitted; all unsupported or unproved cases return `UNKNOWN`.
- Large grids, le450, and high-cardinality instances are currently skipped or often fail path construction.
- The queen20 tight-path case is solved but uses a Python bidirectional BFS that can take roughly 50 seconds and about 500 MB RSS on the local training instance.
- The medium path constructor is heuristic, but soundness is protected by full CNF model verification.

## Changelog

- Initial scaffold replaced with a structural independent-set reconfiguration detector.
- Added `tools/profile.py` for clause-size and prefix-block analysis.
- Added exact small-state independent-set enumeration and exact simple path DFS.
- Added deterministic randomized exact-path construction for medium queen-style instances.
- Added SAT model extension via unit propagation and full CNF self-checking.
- Updated metadata and build path to use the Python solver directly.
- Added structural queen-board detection and a specialized `k=N-1` path constructor. This solves the two local queen20 SAT training instances that the parent skipped.
- Raised the in-memory parsing envelope for moderately sized `n <= 450` formulas while adding a clause-count cap so very large UNSAT candidates such as le450 and hc-square are skipped quickly instead of filling memory.
- Added an experimental C++ watched-literal CDCL proof logger (`cdcl_prover.cpp`) and build support. Local runs generated accepted RUP lemmas but did not reach a verified UNSAT proof on training candidates, so the main solver does not call it yet.
- Updated metadata for `isreconf-queen-path-8291`.
