# Solver Notes

## Formula Notes

- The training split contains Buss `FmlaEquivChain` and `FmlaImplyChain`
  instances. The solver does not use filenames or comments; it detects the
  stripped DIMACS by reconstructing the generator's variable counts, clause
  counts, variable numbering, and exact clause order.
- The supported subfamily is the default equivalence-chain encoding with both
  initial and final don't-care leaves fixed. In the train split this covers
  `FmlaEquivChain_4_6_6` and `FmlaEquivChain_4_8_8`.
- For these formulas, the first leaf layer has only `f^(d/2)` true leaves and
  all other leaves are fixed false. The final layer fixes the complementary
  set true. Since equivalence swaps only permute leaf values, the true count is
  invariant and the boundary counts contradict.
- The implication-chain instances omit don't-care unit clauses. The current
  count invariant is therefore insufficient, so these are deliberately reported
  as `UNKNOWN`.

## Techniques Used

- Exact structural detector for the FmlaChain equivalence generator. The solver
  verifies every clause of the sanitized input against the reconstructed clause
  stream before emitting `UNSATISFIABLE`.
- VeriPB proof logging for a pseudo-Boolean counting invariant. For each local
  gate swap phase, a proof-by-contradiction subproof derives that the number of
  true leaves below the gate cannot increase from source to target.
- The local proof enumerates the possible involutive child matchings of a gate
  and blocks each matching under the negated count constraint. Recursive RUP
  clauses collapse the matching cases to contradiction.
- A running PB upper bound on the number of true leaves is transformed
  gate-by-gate through all phases and then contradicted with the final positive
  unit clauses.

## Remaining Things To Try

- Add a separate proof strategy for `FmlaImplyChain_3_7_7` and
  `FmlaImplyChain_3_7_8`. The likely invariant is game/strategy truth rather
  than leaf-count preservation.
- Reduce the large `f=8` proof. It currently checks locally, but the proof is
  about 417 MB because each gate logs a local matching-case PB subproof.
- Investigate whether a direct cutting-planes derivation of local count
  preservation can replace matching enumeration.

## Known Limitations

- Only exact default equivalence-chain formulas are solved. Any mismatch in
  generator parameters, clause order, don't-care policy, or implication-chain
  clause counts returns `UNKNOWN`.
- The proof is intentionally conservative and does not attempt to solve
  satisfiable formulas or unsupported unsatisfiable variants.

## Changelog

- Replaced the placeholder solver with a C++ structural detector and VeriPB
  proof generator for default FmlaEquivChain formulas.
- Added local PB count-preservation subproofs for every gate swap phase and a
  global count-bound chaining proof.
- Verified locally on generated toy formulas and on both real equivalence-chain
  train instances. The `4_6_6` proof is about 12 MB and checks in about 1s;
  the `4_8_8` proof is about 417 MB and checks in about 31s locally.
