# Solver Notes

## Formula Notes

The `xor_op` instances use adjacent DIMACS variable pairs. For pair `p`,
the state `x_{2p-1} != x_{2p}` is the recovered directed relation variable
`m_p`; equality means the relation is false.

Recovered high-level structure:

- 4-literal blocks over two pairs are `D,D` blocks and encode
  `~m_ab OR ~m_ba` (antisymmetry).
- 6-literal `D,D,S` blocks encode `m_ab AND m_bc -> m_ac`
  (transitivity).
- 6-literal `S,S,S` blocks encode a sparse predecessor axiom
  `m_a,v OR m_b,v OR m_c,v`.

Thus the family is a sparse ordering-principle contradiction: a finite strict
partial order cannot give every vertex a predecessor. The row-major mapping
from relation id to ordered pair `(u,v)` excluding the diagonal matches all
sampled transitivity blocks.

## Techniques Used

The solver parses sanitized DIMACS only and does not use comments, names, or
hashes. It detects the exact pair/block structure, reconstructs high-level
ordering clauses, and solves that abstraction with a proof-logging CDCL engine:

- auxiliary `$m<p>` variables are introduced with `red` definitions for pair
  disequality,
- each recovered high-level clause can be derived with a local `pbc` proof,
- learned high-level CDCL clauses are emitted as `rup` constraints over the
  `$m` variables,
- exact duplicate learned clauses and clauses already present in the recovered
  high-level formula are skipped before proof emission,
- if the high-level solver reports SAT, the assignment is mapped back to all
  DIMACS variables and the original CNF is checked before printing SAT.

Local verification on the training split:

- `xor_op_n32_d3`: solver emits UNSAT in about 133s; VeriPB verifies in about
  282s with roughly 773 MB peak memory.
- `xor_op_n34_d3`: solver emits UNSAT in about 100s; VeriPB verifies in about
  101s with roughly 570 MB peak memory.
- `xor_op_n36_d3`: current 5M-conflict cap returns `UNKNOWN` after roughly
  405s. Raising the cap to 20M reached the 600s solver timeout locally.

## Remaining Things To Try

- Replace the CDCL proof with a polynomial cutting-planes proof of the sparse
  ordering principle to shrink proofs and solve larger instances.
- Improve the high-level CDCL branching/restart policy for `n36`; the current
  fixed false phase and simple activity heuristic spend the full conflict cap.
- Investigate VeriPB order/dominance rules, which may be a better fit for
  certifying the no-minimal-element argument.

## Known Limitations

This version is sound but incomplete. It solves and locally verifies two of
the three training instances, beating the listed Kissat baseline solved count
on the train split. It still returns `UNKNOWN` when the recovered structure
does not match exactly, when a SAT model does not satisfy the original CNF, or
when the high-level CDCL proof does not reach a checkable contradiction.

## Changelog

- Recovered the adjacent-pair relation encoding and strict-ordering structure.
- Added structural detection independent of comments and filenames.
- Added auxiliary-variable and local `pbc` proof generation scaffolding.
- Capped the incomplete DPLL certificate generator and retained conservative
  `UNKNOWN` fallback to avoid invalid UNSAT claims.
- Replaced the inactive DPLL certificate path with proof-logging high-level
  CDCL and original-CNF checked SAT mapping.
- Fixed CDCL proof soundness issues around missed falsified clauses, duplicate
  literals in learned clauses, and non-root contradictory learned clauses.
- Added duplicate suppression for emitted learned clauses, cutting the n34
  proof from about 2.27M lines to about 1.14M lines.
- Added `tools/profile_xor_op.py` for structural profiling of pair ids,
  clause signatures, and predecessor graphs.
