# Solver Notes

## Formula Notes

- Training formulas are CBMC-style bit-blasted CNFs for trigonometric
  approximation checks. Clause streams are mostly binary/ternary with a small
  number of top-level unit assertion bits.
- Available local train sizes:
  - `lines5`: 207,780 variables, 823,923 clauses.
  - `lines17`: 231,540 variables, 923,253 clauses.
  - `taylor2`: 618,847 variables, 2,697,185 clauses.
  - `bhaskara`: 618,715 variables, 2,626,081 clauses.
  - `taylor4`: 1,067,515 variables, 4,730,117 clauses.
- Pure unit propagation only fixes a few thousand variables and does not
  refute these instances. The contradiction needs search or a higher-level
  proof of the floating-point approximation properties.

## Techniques Used

- From-scratch C++ CDCL solver. No external SAT/SMT/PB solver is called.
- Watched-literal Boolean propagation over original and learned clauses.
- First-UIP conflict analysis with VSIDS-style variable activity, phase
  saving, Luby restarts, and recursive learned-clause minimization.
- VeriPB proof logging using `rup` constraints for every learned clause and
  the final empty contradiction. SAT models are checked against original
  clauses before printing.
- Structural decision bias: formulas below 300k variables get a stronger
  low-variable bias (`5000`) because that substantially helps the line
  encodings; larger formulas use a lower bias (`1000`), which was best among
  tested Taylor2 settings.

## Local Results

- `lines5`: solved UNSAT in about 7.7s locally with a 17 MB proof. The proof
  verified with `veripb --cnf` in about 59s.
- `lines17`: solved UNSAT in about 28s locally with a 64 MB proof.
- `taylor2`: did not solve within a 585s local cap; reached 331,776 conflicts
  and returned UNKNOWN.
- `bhaskara`: did not solve within a 180s exploratory cap; proof growth was
  much heavier than Taylor2.
- Broker run `eval_20260510T181803Z_0b7ca572`: solved `lines5` and `lines17`;
  returned UNKNOWN for `taylor2`, `taylor6`, and `bhaskara`; no invalid proofs
  or crashes.
- Broker run `eval_20260510T190523Z_a68d5b1d`: solved the same two line
  instances; Taylor2 hit the outer timeout because the partial proof flush
  exceeded the internal cutoff margin. The default cutoff was reduced to 560s
  afterward to leave more exit margin.

## Experiments Tried

- Learned-clause deletion with VeriPB `del id` hints verified correctly but
  did not improve search enough to enable by default.
- Failed-literal probing on early variables reduced some conflicts but cost
  more wall time on both `lines5` and `taylor2`; it remains opt-in by
  `SOLVER_PROBE_LIMIT`.
- A binary-clause fast path changed propagation order and hurt both `lines5`
  and Taylor2, so it was reverted.
- Restart bases below the default `100` were worse on Taylor2. Initial
  all-true/all-false phase modes were also worse than polarity-score seeding.
- Solving with only one of the three small positive top-level units enabled
  did not quickly refute Taylor2; this remains an opt-in diagnostic by
  `SOLVER_TOP_UNIT_MASK`.

## Known Limitations

- This is still a CDCL proof search, not a recovered mathematical proof of the
  trigonometric assertions. It is sound but currently only strong on the line
  encodings.
- VeriPB replay is expensive even for successful line proofs because the
  original formulas are large and proof checking uses substantial memory.
- Larger Taylor/Bhaskara formulas likely need either stronger CDCL
  inprocessing or a high-level floating-point/circuit proof strategy.

## Changelog

- Replaced scaffold with a C++ CDCL/RUP solver.
- Fixed watched-literal handling for the case where both watched literals are
  false; earlier versions could emit invalid RUP clauses.
- Added heap reinsertion on backtrack, recursive clause minimization, phase
  saving, structure-biased branching, and optional tuning/probing knobs.
- Verified a minimized `lines5` proof locally with VeriPB.
- Recorded local tuning results and disabled experiments that hurt default
  performance.
- Submitted broker candidate `eval_20260510T181803Z_0b7ca572` and recorded
  result: 2 UNSAT, 3 UNKNOWN, no invalid outputs.
- Submitted broker candidate `eval_20260510T190523Z_a68d5b1d`; recorded
  result: 2 UNSAT, 2 UNKNOWN, 1 timeout; reduced internal cutoff to avoid that
  timeout mode.
