# Solver Notes

## Formula Notes

- Visible training instances are old SAT05 `pmg` and `eulcbip` crafted
  formulas from the `long-learned-clauses` family.
- `pmg` instances have 3-CNF blocks: every unordered variable triple appears
  in exactly five clauses. Interpreting those five clauses as forbidden truth
  table rows leaves three allowed assignments, which are a signed exact-1 or
  exact-2 cardinality constraint. The two binary clauses encode one XOR
  equality/inequality between two variables.
- The visible `pmg-11` and `pmg-12` instances have an inconsistent GF(2)
  shadow when each exact-cardinality block is reduced to its parity equation.
  The solver now emits a VeriPB proof for these contradictions.
- `eulcbip` blocks are mostly 4-variable groups with ten clauses, matching
  signed exact-2-of-4 constraints. The visible eulcbip-8 training instance has
  one 9-clause damaged/debugged block and is satisfiable; a focused local
  search finds a checked full CNF model quickly.

## Techniques Used

- DIMACS parsing is independent of comments and filenames.
- Structural recovery groups clauses by unordered variable set and detects
  signed exact-cardinality truth tables by enumerating polarity masks.
- A GF(2) Gaussian elimination pass recognizes exact-cardinality instances
  whose parity shadow is inconsistent and records a dependent set of equations.
- For arity-3 PMG blocks and arity-4 eulcbip exact-2-of-4 blocks, VeriPB
  proof logging derives lower and upper exact-cardinality PB constraints using
  RUP and cutting-planes division. Summing the dependent lower constraints and
  upper constraints separately, dividing by two, and adding the rounded cuts
  yields contradiction.
- SAT solving uses a deterministic focused WalkSAT-style local search written
  from scratch. It tracks satisfied-literal counts and unsatisfied clauses
  incrementally, then independently checks every original CNF clause before
  printing `SATISFIABLE`.

## Remaining Things To Try

- Improve handling of damaged/debugged instances where a block is missing one
  clause. Current code falls back to raw CNF local search; a high-level repair
  model may be more effective.
- Improve the eulcbip detector for damaged 9-clause blocks so the local search
  can bias moves at the recovered high-level constraint level instead of raw
  clauses.
- Test longer local-search runs on any satisfiable debugged variants returned
  by the broker.

## Known Limitations

- UNSAT instances are never claimed without a proof. PMG arity-3 and eulcbip
  arity-4 exact-cardinality parity contradictions are proved; damaged blocks
  that do not match the detector still return `UNKNOWN` unless local search
  finds a full model.
- The local-search path is incomplete and can miss satisfiable instances,
  especially larger eulcbip variants, although any model it prints is checked
  against the full original CNF.
- The solver intentionally does not use comments, filenames, hashes, or any
  external SAT/PB/SMT solver.

## Changelog

- Initial scaffold: placeholder solver returned `UNKNOWN`.
- Added C++ DIMACS parser, exact-cardinality block detector, GF(2) parity
  inconsistency recognizer, deterministic focused local-search SAT engine,
  full-model validation, and completed metadata/notes for first submission.
- Added VeriPB proof logging for PMG arity-3 exact-cardinality parity
  contradictions. Local `veripb --cnf` checks pass on all visible PMG
  training instances.
- Extended VeriPB proof logging to arity-4 exact-2-of-4 constraints using
  implied ternary clauses and division by 3. Verified locally on a synthetic
  eulcbip-style parity contradiction.
