# Solver Notes

## Formula Notes

The visible training formulas are shuffled ordering-principle / greater-than
instances. The structural signature is:

- `n` long clauses of width `n-1`; these are the per-vertex "has a successor"
  clauses.
- `n choose 2` binary clauses; each pairs two row literals from distinct long
  clauses and has both literals negated relative to the row literals. These are
  antisymmetry clauses.
- Ternary clauses of the form `-edge[i][j] -edge[j][k] edge[i][k]`, i.e.
  transitivity.
- The `gt-*` instances often include `n^2` declared variables with `n` unused
  diagonal variables. The `pop*` instances use exactly `n*(n-1)` variables.
- Several shuffled instances omit one transitivity clause but remain UNSAT.

The solver depends only on these structural properties. It does not read DIMACS
comments, filenames, hashes, or baseline answers.

## Techniques Used

The detector recovers each vertex from a long clause and each directed edge
literal from the binary row pairing. It then checks the transitivity clauses
needed by the proof.

The proof is an O(n^3) VeriPB RUP derivation. For an active vertex set `S`, pick
an eliminated vertex `z`. For each remaining vertex `i`, derive the successor
clause for `i` inside `S \ {z}` from:

- the current successor clause for `z`,
- the current successor clause for `i`,
- the antisymmetry clause between `i` and `z`,
- transitivity clauses `i -> z` and `z -> j` imply `i -> j`.

Repeating this shrinks the active set to two vertices. The two derived unit
successor clauses and the original antisymmetry binary clause make the empty
constraint RUP, completing the VeriPB proof.

For formulas with missing transitivity clauses, the solver chooses an
elimination order where the missing clause's middle vertex is not eliminated
before both endpoints, so that the proof never asks VeriPB to use that missing
clause.

## Remaining Things To Try

- Reduce proof size by sharing or deleting derived constraints if verifier
  memory becomes a bottleneck on larger hidden POP instances.
- Add a more general ordering-order search if future instances omit many
  transitivity clauses.
- Support guarded ordering-principle variants if they appear; the current
  detector intentionally rejects non-plain transitivity encodings.

## Known Limitations

- Only UNSAT ordering-principle encodings with the recovered long/binary/ternary
  shape are supported.
- If a missing-transitivity pattern cannot be avoided by the current greedy
  elimination-order repair, the solver returns `UNKNOWN`.
- SAT model construction is intentionally absent because all recovered supported
  structures are refuted by the emitted proof.

## Changelog

- Initial scaffold: placeholder UNKNOWN solver.
- Added `tools/profile.py` for local CNF statistics and family inspection.
- Replaced placeholder with a C++ structural detector and VeriPB RUP proof
  generator for ordering-principle instances.
- Added missing-transitivity-aware elimination ordering for one-clause-deleted
  shuffled instances.
- Updated metadata and README to describe the recovered encoding and proof.
