# A Lean-checked baseline for SAT search

Orchard Math · 28 November 2026

A SAT solver asks whether there is a way to set Boolean variables so every clause is true. This baseline tries both values of each variable, stopping as soon as it finds a satisfying assignment. Lean checks that the answer is correct for every CNF formula.

Lean also checks the exact search cost on unsatisfiable formulas. With `n` distinct variables in the formula, the solver reaches all `2^n` leaves. This count measures terminal evaluations. It gives an exponential lower bound on the baseline's work on those inputs and leaves the polynomial-time 3-SAT target open.

## Checked statements

`decideCNFSAT_correct` proves that the solver returns true exactly when the input formula is satisfiable. `searchSATLeaves_unsatisfiable` proves the exact leaf count for any list covering all variables of an unsatisfiable formula. The solver itself removes duplicate variable indices before searching.

The proof follows the search. Setting a variable removes clauses it satisfies and removes its false literals from the other clauses. A formula is satisfiable exactly when at least one of its two restricted formulas is. If the original is unsatisfiable, both restricted formulas are unsatisfiable. Neither branch can short-circuit the search, so the two leaf counts add to the full binary tree's count.

Branching on Boolean variables is classical. The contribution here is a replayable Lean baseline for Orchard's 3-SAT research, with an explicit correctness theorem and a precise count of what this particular implementation does. [Davis, Logemann and Loveland, 1962](https://doi.org/10.1145/368273.368557).

## Reproduce the check

Place the two Lean source files at the paths below in a directory containing `Audit.lean` and `lean-toolchain`. Install Lean 4.33.1 through Elan. The replay uses only Lean's standard library.

```sh
export LEAN_PATH=.
lean --version
lean -DwarningAsError=true -o OrchardMath/PvsNP/Statements.olean OrchardMath/PvsNP/Statements.lean
lean -DwarningAsError=true -o OrchardMath/Complexity/SatSearch.olean OrchardMath/Complexity/SatSearch.lean
lean -DwarningAsError=true Audit.lean
```

The audit prints both statements and their axiom dependencies and compiles four concrete solver checks.
