Skip to content

peter-grajcar/tableaux-sat

Repository files navigation

Tableaux SAT

SAT solver based on tableaux method

Tableaux Method

Following part contains basic definitions for those unfamiliar with the tableaux method.

A tableau is a labeled binary tree. The nodes of this tree are called entries. Each entry is labeled with a signed propositions (i.e. proposition preceded by either a T or an F).

A tableau proof of a proposition A is a contradictory tableau with root entry F(A). A tableau refutation for a proposition A is a contradictory tableau with root entry T(A)

Entry E has been reduced on P if all the entries on one path through the atomic tableau with root E occur on P.

Atomic tableaux:

Tableau 1a Tableau 1b Tableau 2a Tableau 2b
Tableau 3a Tableau 3b Tableau 4a Tableau 4b
Tableau 5a Tableau 5b Tableau 6a Tableau 6b

A tableau can be constructed inductively:

  1. Every atomic tableau is a tableau
  2. If T is a tableau and E is an entry of T of maximal depth such that there is a noncontradictory path P of T on which E is unreduced, then if T' is the tableau gotten by adjoining the unique atomic tableau with root E to the end of every noncontradictory path P' of T on which E is unreduced, then T' is a tableau.

Reference:

Nerode, A., & Shore, R. A. (1997). Logic for applications. New York: Springer.

Install

To compile the sources a makefile, which is present in the repository, can be used. The executable will be placed in a build directory: build/tableaux-sat

Manual

tableaux-sat [-Tdp] [--dot] [--proof]

1. Satisfiability of a Formula

Input format: a formula must consist of valid connectives and propositional letters. a propositional letter can contain alphanumeric characters. Letters and proposition can be separated by spaces (they will be removed).

Program will output the satisfiability (SATISFIABLE or UNSATISFIABLE) on the first line and a model (if it exists).If the formula is satisfiable the next lines contain the model in following format

<propositional_letter> = <0 or 1>

If some of the propositional letters in the formula is not present in the output, it means that its value is independent. The leftmost non-contradictory branch of the tableau is taken as a model.

See an example

2. Satisfiability of a Theory

Theory mode is enabled by option -T.

Input format: Each formula is on separate line. The first line contains a formula to prove in the theory. Following line contain axioms of the theory. These axioms will be signed with T. The output is in the same format as in the first part.

See an example

3. Dot Language Output

The program will output the tableau in the dot language format when -d or --dot options are set. The output can be used with a program such as graphviz to generate an image.

Contradictory branches are marked with an astersisk *.

See an example

4. Tableaux Proofs

Proof mode can be set with options -p or --proof. In proof mode the root entry will be signed with F.

See an example

5. Connectives

Symbol Connective Priority
~ not (¬) 3
& and (∧) 2
| or (∨) 2
- if (→) 1
= iff (↔) 1

Priority can be modified using parantheses (, ).

Examples

All examples can be executed by running demo.sh.

1. Satisfiability of a Formula

$ tableaux-sat
p & ~p
UNSATISFIABLE

2. Satisfiability of a Theory

$ tableaux-sat -T
s
q - p
r - q
(r - p) - s
SATISFIABLE
q = 0
r = 0
s = 1

3. Dot Language Output

$ tableaux-sat -T --dot
p
~q
p | q
graph tableau {
        node[shape="plaintext", fontname="courier"]
        nodesep=0.4
        ranksep=0.5

        E1[label="T(p) "]
        E1 -- E2

        E2[label="T(~q) "]
        E2 -- E3

        E3[label="T(p|q) "]
        E3 -- E4

        E4[label="F(q) "]
        E4 -- E5
        //hidden node to balance the tree
        E4hidden [label="", width=.1, style=invis]
        {rank=same;E4hidden; E5; E6}
        E4 -- E4hidden[style=invis]
        E4 -- E6

        E6[label="T(q)*"]

        E5[label="T(p) "]
}

Image generated from the output by graphviz:

Example 1

Note that nodes on contradictory branches are marked by an asterisk.

4. Tableaux Proofs

$ tableaux-sat --proof
~(p | q) = (~p & ~q)
PROVABLE

Tableaux from Prevoius Examples

Tableau from example 2:

Example 1

Tableau from example 4:

Example 1

© Peter Grajcar

About

SAT solver based on tableaux method

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors