protocol

sat_protocol

Protocol for process-backed Kissat, CaDiCaL, Glucose, and Z3 CLI solving, source generation, and result inspection.

Availability:
logtalk_load(sat(loader))
Author: Paulo Moura
Version: 1:0:0
Date: 2026-11-11
Compilation flags:
static
Dependencies:
(none)
Remarks:
(none)
Inherited public predicates:
(none)

Public predicates

solve/2

Solves a source with default options using the external SAT solver CLI and returns a collected result after cleanup. Valid sources are object(Object), terms(Statements), codes(Codes), and file(Path).

Compilation flags:
static
Template:
solve(Source,Result)
Mode and number of proofs:
solve(+compound,-compound) - one_or_error
Exceptions:
Source is not a ground term:
instantiation_error
Source is ground but not a supported source, or is object(Object) where Object does not implement sat_problem_protocol:
domain_error(sat_source,Source)
Statements is ground but not a list:
type_error(list,Statements)
A statement enumerated by the provider object is not a valid statement:
domain_error(sat_statement,Statement)
An origin enumerated by the provider object is invalid, or its origins and statements differ in length:
domain_error(sat_origins,Origins)
Codes is ground but not a list of character codes:
type_error(codes,Codes)
An element Code of the list Codes is ground but not an integer:
type_error(integer,Code)
An element Code of the list Codes is an integer but not a valid character code:
domain_error(character_code,Code)
Path is ground but not an atom:
type_error(atom,Path)
Path does not exist:
existence_error(source_sink,Path)
Path cannot be opened for reading:
permission_error(open,source_sink,Path)
A launcher argument contains a null character:
domain_error(sat_shell_argument,Argument)
The selected solver executable or a shell dependency does not exist:
existence_error(command,Command)
An owned directory cannot be found during cleanup:
existence_error(directory,Directory)
An owned file or directory cannot be removed:
permission_error(delete,source_sink,Path)
A character sequence is not valid UTF-8:
representation_error(utf_8)
A launcher operation fails:
sat_transport(Stage,Status,Details)
Solver output is invalid or inconsistent with its exit status:
sat_solver_error(Formal,Status,Diagnostics,SourceMap)

solve/3

Solves a source using solver/1, executable/1, time_limit/1, conflicts/1, decisions/1, seed/1, and witness/1 options. Repeated options use the first occurrence. Valid sources are object(Object), terms(Statements), codes(Codes), and file(Path).

Compilation flags:
static
Template:
solve(Source,Result,Options)
Mode and number of proofs:
solve(+compound,-compound,+list(compound)) - one_or_error
Exceptions:
Source is not a ground term:
instantiation_error
Source is ground but not a supported source, or is object(Object) where Object does not implement sat_problem_protocol:
domain_error(sat_source,Source)
Statements is ground but not a list:
type_error(list,Statements)
A statement enumerated by the provider object is not a valid statement:
domain_error(sat_statement,Statement)
An origin enumerated by the provider object is invalid, or its origins and statements differ in length:
domain_error(sat_origins,Origins)
Codes is ground but not a list of character codes:
type_error(codes,Codes)
An element Code of the list Codes is ground but not an integer:
type_error(integer,Code)
An element Code of the list Codes is an integer but not a valid character code:
domain_error(character_code,Code)
Path is ground but not an atom:
type_error(atom,Path)
Path does not exist:
existence_error(source_sink,Path)
Path cannot be opened for reading:
permission_error(open,source_sink,Path)
Options is a variable:
instantiation_error
Options is neither a variable nor a list:
type_error(list,Options)
An element Option of the list Options is a variable:
instantiation_error
An element Option of the list Options is neither a variable nor a compound term:
type_error(compound,Option)
An element Option of the list Options is a compound term but not a valid option:
domain_error(option,Option)
A launcher argument contains a null character:
domain_error(sat_shell_argument,Argument)
The selected solver executable or a shell dependency does not exist:
existence_error(command,Command)
An owned directory cannot be found during cleanup:
existence_error(directory,Directory)
An owned file or directory cannot be removed:
permission_error(delete,source_sink,Path)
A character sequence is not valid UTF-8:
representation_error(utf_8)
A launcher operation fails:
sat_transport(Stage,Status,Details)
Solver output is invalid or inconsistent with its exit status:
sat_solver_error(Formal,Status,Diagnostics,SourceMap)

program/1

Generates and prints DIMACS CNF source to the current output using default options, equivalent to program/2 followed by print_program/1, without invoking the solver.

Compilation flags:
static
Template:
program(Source)
Mode and number of proofs:
program(+compound) - one_or_error
Exceptions:
Source is not a ground term:
instantiation_error
Source is ground but not a supported source, or is object(Object) where Object does not implement sat_problem_protocol:
domain_error(sat_source,Source)
Statements is ground but not a list:
type_error(list,Statements)
A statement enumerated by the provider object is not a valid statement:
domain_error(sat_statement,Statement)
An origin enumerated by the provider object is invalid, or its origins and statements differ in length:
domain_error(sat_origins,Origins)
Codes is ground but not a list of character codes:
type_error(codes,Codes)
An element Code of the list Codes is ground but not an integer:
type_error(integer,Code)
An element Code of the list Codes is an integer but not a valid character code:
domain_error(character_code,Code)
Path is ground but not an atom:
type_error(atom,Path)
Path does not exist:
existence_error(source_sink,Path)
Path cannot be opened for reading:
permission_error(open,source_sink,Path)
The current output stream does not allow writing:
permission_error(output,stream,Stream)

program/2

Returns DIMACS CNF source codes from object(Object), terms(Statements), codes(Codes), or file(Path) using default options, without invoking the solver.

Compilation flags:
static
Template:
program(Source,Codes)
Mode and number of proofs:
program(+compound,-list(integer)) - one_or_error
Exceptions:
Source is not a ground term:
instantiation_error
Source is ground but not a supported source, or is object(Object) where Object does not implement sat_problem_protocol:
domain_error(sat_source,Source)
Statements is ground but not a list:
type_error(list,Statements)
A statement enumerated by the provider object is not a valid statement:
domain_error(sat_statement,Statement)
An origin enumerated by the provider object is invalid, or its origins and statements differ in length:
domain_error(sat_origins,Origins)
Codes is ground but not a list of character codes:
type_error(codes,Codes)
An element Code of the list Codes is ground but not an integer:
type_error(integer,Code)
An element Code of the list Codes is an integer but not a valid character code:
domain_error(character_code,Code)
Path is ground but not an atom:
type_error(atom,Path)
Path does not exist:
existence_error(source_sink,Path)
Path cannot be opened for reading:
permission_error(open,source_sink,Path)

program/3

Returns DIMACS CNF source codes from object(Object), terms(Statements), codes(Codes), or file(Path), using the embed_variables/1 option, without invoking the solver.

Compilation flags:
static
Template:
program(Source,Codes,Options)
Mode and number of proofs:
program(+compound,-list(integer),+list(compound)) - one_or_error
Exceptions:
Source is not a ground term:
instantiation_error
Source is ground but not a supported source, or is object(Object) where Object does not implement sat_problem_protocol:
domain_error(sat_source,Source)
Statements is ground but not a list:
type_error(list,Statements)
A statement enumerated by the provider object is not a valid statement:
domain_error(sat_statement,Statement)
An origin enumerated by the provider object is invalid, or its origins and statements differ in length:
domain_error(sat_origins,Origins)
Codes is ground but not a list of character codes:
type_error(codes,Codes)
An element Code of the list Codes is ground but not an integer:
type_error(integer,Code)
An element Code of the list Codes is an integer but not a valid character code:
domain_error(character_code,Code)
Path is ground but not an atom:
type_error(atom,Path)
Path does not exist:
existence_error(source_sink,Path)
Path cannot be opened for reading:
permission_error(open,source_sink,Path)
Options is a variable:
instantiation_error
Options is neither a variable nor a list:
type_error(list,Options)
An element Option of the list Options is a variable:
instantiation_error
An element Option of the list Options is neither a variable nor a compound term:
type_error(compound,Option)
An element Option of the list Options is a compound term but not a valid option:
domain_error(option,Option)

literal/2

Enumerates, by backtracking, the collected model literals (+Term or -Term) without starting a process. Fails when the result has no witness.

Compilation flags:
static
Template:
literal(Result,Literal)
Mode and number of proofs:
literal(+compound,-compound) - zero_or_more
Exceptions:
Result is not a ground term:
instantiation_error
Result is not a valid collected SAT solver result:
domain_error(sat_result,Result)

result_property/2

Enumerates, by backtracking, status(Status) and the stored result properties.

Compilation flags:
static
Template:
result_property(Result,Property)
Mode and number of proofs:
result_property(+compound,?compound) - zero_or_more
Exceptions:
Result is not a ground term:
instantiation_error
Result is not a valid collected SAT solver result:
domain_error(sat_result,Result)


Protected predicates

(none)

Private predicates

(none)

Operators

(none)