Documentation

CslibFrontier.Algorithms.WordRAM.TwoSAT.Programs

End-to-end linear-time Word-RAM 2-SAT solver (solver, program) #

Proves input-fit and output-decoding specifications (Instance.inputFits_encode, decodeAnswer_answerWords, answerWords_eq_nil_iff, eval_of_decodeAnswer_eq_some) and combines clause validation, CSR implication-graph construction, Kosaraju SCC indexing, and witness extraction into solver and program, proving O(n + |φ|) execution (solver_spec, program_spec, computesListInTime_program), width-independence, and determinism.

Every word of G.encode, together with its length, fits in any word width admitting G.wordBound.

@[simp]

Decoding answerWords G recovers TwoSAT.solveFin G.n G.φ losslessly.

answerWords G is empty if and only if G.φ is either not width-at-most-2 or unsatisfiable.

Any assignment decoded from answerWords G witnesses width ≤ 2 and satisfies G.φ.

Structured standard-basis Word-RAM solver for 2-SAT.

Flat standard-basis Word-RAM 2-SAT program returning answerWords G via ExecutesList.

Structured execution of solver computes answerWords G at outAddrBase within 512 * (G.n + G.φ.length + 1) - 1 instructions.

Linear-time 2-SAT on the word RAM (O(n + |φ|)). At every word width w with Fits w G.wordBound, program halts within 512 * (G.n + G.φ.length + 1) instructions and outputs answerWords G: [] if G.φ is either not a 2-CNF or unsatisfiable, and 1 :: [(σ 0).toNat, …, (σ (n - 1)).toNat] for the canonical satisfying assignment σ otherwise.

Fixed-program Program.ComputesListInTime certificate for Word-RAM 2-SAT.