sat

package
v1.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package sat ships a CDCL SAT solver as a Wile extension.

The solver implements watched-literal unit propagation, 1-UIP conflict analysis with clause learning, VSIDS-style activity branching, Luby restarts, and activity-based clause-database cleanup. It targets MiniSat-class competence on instances up to roughly 10k variables and 100k clauses.

The Scheme front-end at (wile algebra sat) wraps these primitives with a Tseitin transform and exposes sat?, sat-cnf?, boolean-decide-sat?, and boolean-decide-equivalent?. See memory/2026-05-30-sat-solver-design.local.md.

Index

Constants

This section is empty.

Variables

View Source
var AddToRegistry = Builder.AddToRegistry

AddToRegistry registers all sat primitives.

View Source
var Builder = registry.NewRegistryBuilder(addPrimitives)

Builder aggregates all sat registration functions.

View Source
var Extension = registry.NewDescribedExtension("sat",
	"CDCL SAT solver kernel backing (wile algebra sat). Accepts CNF as a flat vector of int literals with 0-terminated clauses; returns SAT/UNSAT plus a model on SAT, or 'unknown on conflict-budget exhaustion or ctx cancellation.",
	AddToRegistry)

Extension is the SAT solver FFI extension.

Functions

func PrimSatCNFFlat

func PrimSatCNFFlat(mc machine.CallContext) error

PrimSatCNFFlat implements (sat-cnf-flat? vec budget).

vec is a flat vector of exact integers in DIMACS CNF format (non-zero literals separated by 0 terminators). budget is either #f (unlimited) or an exact integer giving the maximum number of conflicts.

Returns #t on SAT, #f on UNSAT, or the symbol 'unknown on budget/context exhaustion.

func PrimSatCNFFlatModel

func PrimSatCNFFlatModel(mc machine.CallContext) error

PrimSatCNFFlatModel implements (sat-cnf-flat-model).

Returns the model vector from the most recent sat-cnf-flat? call that returned #t, or #f if no model is available. The vector is indexed 1..N where N is the largest variable index seen; index 0 is unused (#f).

Types

type SolverResult

type SolverResult int8

SolverResult is the outcome of one solve() call.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL