Skip to documentation
SLOP

tiny.smt.sat

Reference tiny.smt sat

Defined in tiny.smt.

A SAT solver that learns a new clause from each conflict it analyzes, with the types a caller builds clauses from and reads answers and evidence through.

API (17)

Types and contracts

Public types and contracts.

Namespaces

Public namespaces.

No direct callersNo direct callstiny.smtsat
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/smt/src/root.zig:95

zig
pub const sat = @import("sat/root.zig");

Source: lib/smt/src/sat/root.zig

zig
//! A SAT solver that learns a new clause from each conflict it analyzes, with the types a caller//! builds clauses from and reads answers and evidence through. A caller builds clauses from//! literals over numbered variables and asks whether they can all be true, optionally under assumed//! literals. After a no, a caller wants the assumptions the refutation used and evidence that a//! separate check can confirm on its own. Questions asked of one formula share the solver's//! clauses, and evidence describes the formula of one solve, so any later change to the clauses,//! the variables or the assumptions makes the evidence describe a formula the solver has since//! changed.//!//! [MiniSat](https://doi.org/10.1007/978-3-540-24605-3_37), by Niklas Eén and Niklas Sörensson, is//! a SAT solver that learns a clause from each conflict. The namespace keeps its way of solving://! each clause of two or more literals watches two of them, each conflict above decision level zero//! yields a learned clause, and a solve can run under assumed literals.//!//! A solve under assumptions discards every clause added during it when it completes, the clauses//! learned under those assumptions included. When no cap on learned clauses is set, a solve keeps//! every clause from before it. While a cap on learned clauses is set, every solve starts by//! removing the learned clauses over the cap, clauses from earlier solves included. For callers//! that nest questions, the solver keeps an assumption list of its own, and each push keeps a saved//! length of the assumption list that a pop returns to (an *assumption frame*). After a no under//! assumptions, the solver reports a set of assumptions that the clauses refute together//! (`Solver.lastUnsatCore`). The set can hold an assumption the no does not need in two cases: when//! the solver records a core of a single assumption, and when a conflict limit runs out while the//! solver shrinks the core, which leaves every assumption in it.//!//! After each unsatisfiable answer, the solver keeps a trace for that solve's clauses and//! assumptions: a list of clauses that ends in the empty clause. To check one clause of the trace,//! a checker assumes its literals false together with the assumptions and propagates unit clauses//! over the formula and the earlier clauses of the trace, and the clause passes when that//! propagation reaches a conflict (Reverse Unit Propagation). `Solver.lastProofArtifact` copies the//! clauses, assumptions and steps behind one unsatisfiable answer (a *proof artifact*), and//! `ProofArtifact.valid` checks that copy again without the solver. The clauses of that copy are//! every clause the solver held when the solve began, learned clauses it kept included. Adding a//! variable, a clause or an assumption, changing assumption frames, or solving again clears the//! recorded core and trace, so evidence holds only until the next change to the solver.//!//! A caller that bounds the search sets a conflict limit, and the solver then keeps each solve's//! proof steps in fixed memory sized from that limit (`ProofTrace`). A caller that bounds memory//! sets a cap on learned clauses, and the solver then keeps the learned clauses it may remove in//! fixed memory sized from that cap (`LearnedStore`). The solver analyzes each conflict in scratch//! memory that it sets aside at the start of each solve (`ConflictScratch`). The namespace holds//! the solver (`Solver`) with its literal, status, statistics, restart and proof types, and it//! re-exports `Solver`, `Literal`, `Status`, `BoolValue`, `SolveStats`, `RestartPolicy`,//! `ProofClause`, `ProofStep`, `ProofArtifact` and the three fixed memories by name. The files//! split the parts: `solver` holds the solver, `types` the value types, `store`, `trace` and//! `scratch` the three fixed memories, and a proof file the proof types.const proof = @import("proof.zig");pub const scratch = @import("scratch.zig");pub const solver = @import("solver.zig");pub const store = @import("store.zig");pub const trace = @import("trace.zig");pub const types = @import("types.zig");pub const BoolValue = types.BoolValue;pub const Literal = types.Literal;pub const ProofArtifact = proof.ProofArtifact;pub const ProofClause = proof.ProofClause;pub const ProofStep = proof.ProofStep;pub const RestartPolicy = types.RestartPolicy;pub const Solver = solver.Solver;pub const SolveStats = types.SolveStats;pub const Status = types.Status;pub const LearnedStore = @import("store.zig").Store;pub const ProofTrace = @import("trace.zig").Trace;pub const ConflictScratch = scratch.ConflictScratch;

Audit

Definitions1
Public names1
Members0
Version26.7.0
Revisiondaab053ee433