View Source SimpleSat (simple_sat v0.1.1)

A simple, dependency free boolean satisfiability solver.

This was created for folks having trouble running picosat_elixir to use as a drop-in replacement for Ash Framework, but feel free to use it in any way you see fit.

SimpleSat expects to receive a list of lists of integers, where each integer represents a variable. If the integer is negative, it represents the negation of said variable.

Additionally, SimpleSat expects to receive variables in "Conjunctive Normal Form" or CNF. This is the same interface that picosat_elixir expects. CNF is a conjunction of disjunctions. In other words, it is a list of statements that must all be true, where each statement is a list of variables where at least one must be true. For example:

# A AND (NOT A)
[[1], [-1]]

# A AND (A OR B)
[[1], [1, 2]]

# A AND B AND C
[[1], [2], [3]]

Summary

Functions

Provide a valid solution for a statement in CNF form

Functions

@spec solve([[integer()]]) :: {:ok, [integer()]} | {:error, :unsatisfiable}

Provide a valid solution for a statement in CNF form