# Solver Notes

## Formula Notes

The training formulas are normalized clique/coloring encodings. For a graph on
`n` vertices, variables are laid out as:

- `1..C(n,2)`: graph edge variables in lexicographic vertex-pair order.
- next `q*n`: clique-slot choice variables, one exactly-one block per slot.
- final `c*n`: vertex color variables, one exactly-one block per vertex.

The clauses assert that the selected `q` vertices form a clique and that the
same graph has a proper `c`-coloring. In all observed instances `q = c + 1`,
so the formula is UNSAT by the pigeonhole principle: a `(c+1)`-clique cannot
be colored with only `c` colors.

The detector does not use comments, file names, hashes, or memorized answers.
It infers `n,q,c` from the DIMACS header and then checks that the complete
expected clause set is present with the exact variable layout above. If any
check fails the solver returns `UNKNOWN`.

## Techniques Used

The solver emits a VeriPB proof rather than searching. It introduces extension
variables `z<i>_<k>` meaning "clique slot `i` has color `k`" using redundance
strengthening. From the original clauses plus those definitions it derives:

- every clique slot has at least one `z` color;
- two different clique slots cannot share the same `z` color;
- a short RUP pigeonhole refutation for `c+1` slots and `c` colors.

The proof size is polynomial in the recovered parameters. The largest local
training proof was about 33 MB and checked with VeriPB in about 13 seconds on
this container.

## Local Verification

All 12 training instances were tested by:

1. decompressing the `.cnf.xz`;
2. running `./solver formula.cnf out.pbp`;
3. checking `veripb --cnf formula.cnf out.pbp`.

Every local proof verified. Solver proof generation stayed below one second
per training instance; VeriPB checking stayed below 14 seconds per instance.

## Remaining Things To Try

- Add RUP hint lists if future hidden instances have much larger `n`, since
  that may reduce checker memory and time.
- Compress or restructure the pairwise slot-color exclusion derivation if
  proof size becomes the bottleneck.
- Extend detection only if new target instances preserve the same semantics
  but use a different variable order.

## Known Limitations

- Only the exact normalized `clqcl` layout is supported.
- The solver only proves the `q = c + 1` contradiction. Other clique/color
  parameter regimes return `UNKNOWN`.
- It intentionally does not attempt SAT solving or unsupported UNSAT proofs.

## Changelog

- Initial scaffold replaced with a C++ proof-emitting solver.
- Reverse-engineered the encoding as a graph clique plus graph coloring
  formula.
- Added a conservative full-clause detector for the normalized layout.
- Added VeriPB proof generation using extension color-slot variables and a
  pigeonhole RUP refutation.
- Locally verified all 12 training instances with `veripb --cnf`.
