# Solver Notes

## Formula Notes

- Variables are edges of a complete graph: the visible `p cnf` variable counts
  are triangular numbers `C(n, 2)`.
- Uniform 12-literal clauses are copies of the 3-dimensional cube `Q3`.  A
  positive clause forbids an all-false/blue cube; a negative clause forbids an
  all-true/red cube.
- The asymmetric instances have positive `Q3` clauses plus negative 4-literal
  clauses.  The 4-literal clauses are the three `C4` cycles on each 4-set.
- Any asymmetric instance on at least 9 vertices contains an induced `Q32 K9`
  restriction.  That restriction is UNSAT, so a proof for the restriction is a
  valid proof for larger asymmetric instances after variable remapping.
- The symmetric `Q3/Q3` instances match the known cube Ramsey family:
  generated `K11` and `K12` instances are SAT, while `K13` is UNSAT but still
  lacks a compact VeriPB proof path in this solver.

## Techniques Used

- DIMACS is parsed without using comments or filenames.
- SAT path: deterministic WalkSAT-style edge-color local search over the actual
  CNF clauses.  Before printing `SATISFIABLE`, the solver checks every original
  clause against the complete assignment.
- UNSAT path: for asymmetric cube/C4 instances, the solver structurally
  searches for a 9-vertex restriction and verifies every generated clause
  is present in the input CNF.  It then replays `q32k9_template.bin`, a
  compact binary template of the lexicographic `Q32 K9` RUP refutation, through
  the recovered edge-variable map.  If the template is unavailable, it falls
  back to the older incremental DPLL proof generator for the same verified
  restriction.
- Unsupported structures, unfinished searches, and symmetric hard instances
  return `UNKNOWN`.
- Recognized symmetric `Q3/Q3` instances on at least 13 vertices return
  `UNKNOWN` immediately after parsing and detection, because the available SAT
  local search cannot certify UNSAT.

## Remaining Things To Try

- Build a proof-producing route for symmetric `Q3 in K13`.  The most promising
  direction is cached RUP propagation from local `K8` table constraints or a
  certified enumeration/extension proof over the known `K12` Ramsey colorings.
- Reduce VeriPB checking time for the asymmetric template.  Solver-side proof
  generation is now fast, but the emitted text proof is still about 41 MB and
  takes roughly 12-14s to check locally.
- Add stronger symmetry breaking for the symmetric cube Ramsey instances.

## Known Limitations

- The asymmetric UNSAT shortcut assumes the standard lexicographic complete
  graph edge numbering first, then falls back to reconstructing the edge map
  from C4 co-occurrence counts.  In both cases it verifies the generated
  restriction against the actual CNF before using it.  If verification fails,
  it returns `UNKNOWN`.
- No UNSAT proof is produced for symmetric `Q3/Q3` formulas.
- The local search is incomplete; failure to find a model is never reported as
  UNSAT.
- `q32k9_template.bin` is a high-level proof template, not an instance answer:
  it is used only after the solver verifies that the selected induced K9 has
  all required positive cube clauses and negative C4 clauses in the input.

## Changelog

- Initial scaffold replaced with a C++ solver.
- Added `tools/profile.py` for DIMACS family profiling.
- Added checked WalkSAT-style SAT model construction over original clauses.
- Added asymmetric cube/C4 detector and VeriPB RUP proof logging.
- Added induced `Q32 K9` proof shortcut for asymmetric instances on 9 or more
  vertices.
- Replaced repeated full propagation in the proof search with incremental
  count-based unit propagation, reducing visible Q32 proof time to roughly 35s.
- Added C4 co-occurrence based edge-map recovery so permuted asymmetric
  instances can still use the induced `Q32 K9` refutation.
- Changed asymmetric verification to try every recovered 9-vertex subset rather
  than assuming the first nine vertices match both clause families.
- Added `q32k9_template.bin`, a 6.5 MB binary encoding of the reusable
  349201-line RUP refutation for the standard `Q32 K9` restriction.
- Replaced repeated runtime DPLL proof construction for asymmetric instances
  with mapped template replay; visible Q32 solver time dropped from about 34s
  to about 0.2-0.3s while the generated proof still verifies with VeriPB.
- Moved the asymmetric UNSAT path ahead of local search so verified UNSAT cases
  do not spend time in a SAT-only search routine.
- Added scratch tools `tools/search_q3.cpp` and `tools/cdcl_q3.cpp` for
  high-level local-search/CDCL experiments on symmetric cube instances.  The
  CDCL prototype found that raw clause learning is not enough for `K13`.
- Added early `UNKNOWN` for recognized symmetric `Q3/Q3` instances with
  `n >= 13`, avoiding a guaranteed unproductive local-search timeout when no
  proof path is available.
