# Logic for Computer Scientists/Predicate Logic/SATCHMO
## SATCHMO

The SATCHMO Theorem Prover was one of the first systems which used model generation, i.e. a bottom-up proof procedure. The prover was given by a small Prolog-program, which implements a tableau proof procedure. One restriction is that it requires range restricted formulae.

## Definition 30

A first order clause $A_{1}\lor \cdots \lor A_{n}\gets B_{1}\land \cdots \land B_{m}$ is called range restricted if every variable which occurs in the head $A_{1}\lor \cdots \lor A_{n}$ occurs in the body $B_{1}\land \cdots \land B_{m}$ as well.
* Convert clauses to range restricted form: $q(x)\lor p(x,y)\gets q(x)\qquad \rightsquigarrow \qquad q(X);p(X,Y)<-q(X),dom(Y)$
* assert range-restricted clauses and dom clauses in Prolog database.
* Call satisfiable:
First-Order completeness via Level-Saturation modification. This proof procedure implements Hyper Tableaux in the ground case.

## Hyper Tableau - Ground Case

All open branches consist of positive literals only Take the following clause set as an example $\{\to A,\quad \to B,\quad A\land B\to C\lor D,\quad A\land B\to E\lor D,\quad A\land C\to \}$

## Definition 31 (Literal tree, Clausal Tableau)

A literal tree is a pair $(t,\lambda )$ consisting of a finite, ordered tree $t$ and a labeling function $\lambda$ that assigns a literal to every non-root node of $t$.
The successor sequence of a node $N$ in an ordered tree $t$ is the sequence of nodes with immediate predecessor $N$, in the order given by $t$.
A (clausal) tableau $T$ of a set of clauses ${\mathcal {S}}$ is a literal tree $(t,\lambda )$ in which, for every successor sequence $N_{1},\dots ,N_{n}$ in $t$ labeled with literals $K_{1},\dots ,K_{n}$, respectively, there is a substitution $\sigma$ and a clause $\{L_{1},\dots ,L_{n}\}\in {\mathcal {S}}$ with $K_{i}=L_{i}\sigma$ for every $1\leq i\leq n$. $\{K_{1},\dots ,K_{n}\}$ is called a tableau clause and the elements of a tableau clause are called tableau literals.

## Definition 32 (Branch, Open and Closed Tableau, Selection Function)

A branch of a tableau $T$ is a sequence $N_{0},\ldots ,N_{n}$ ($n\geq 0$) of nodes in $T$ such that $N_{0}$ is the root of $T$, $N_{i}$ is the immediate predecessor of $N_{i+1}$ for $0\leq i<n$, and $N_{n}$ is a leaf of $T$. We say branch $b=N_{0},\ldots ,N_{n}$ is a prefix of branch $c$, written as $b\leq c$ or $c\geq b$, iff $c=N_{0},\ldots ,N_{n},N_{n+1},\ldots ,N_{n+k}$ for some nodes $N_{n+1},\ldots ,N_{n+k}$, $k\geq 0$. The branch literals of branch $b=N_{0},\ldots ,N_{n}$ are the set $lit(b)=\{\lambda (N_{1}),\ldots \lambda (N_{n})\}$. We find it convenient to use a branch in place where a literal set is required, and mean its branch literals. For instance, we will write expressions like $A\in b$ instead of $A\in lit(b)$.
In order to memorize the fact that a branch contains a contradiction, we allow to label a branch as either open or em closed. A tableau is closed if each of its branches is closed, otherwise it is open.
A selection function is a total function $f$ which maps an open tableau to one of its open branches. If $f(T)=b$ we also say that $b$ is selected in $T$ by $f$.
Note that branches are always finite, as tableaux are finite. Fortunately, there is no restriction on which selection function to use. For instance, one can use a selection function which always selects the "leftmost" branch.

## Definition 33 (Hyper Tableau - Ground Case)

Let $S$ be a finite set of clauses and $f$ be a selection function. Hyper tableaux for $S$ are inductively defined as follows: Initialization step: A one node literal tree is a hyper tableau for $S$. Its single branch is marked as "open".
Hyper extension step: If
* $T$ is an open hyper tableau for $S$, $f(T)=b$ (i.e. $b$ is selected in $T$ by $f$) with open leaf node $N$, and
* $C=A_{1},\ldots ,A_{m}\gets B_{1},\ldots ,B_{n}$ is a clause from $S$ ($m\geq 0$, $n\geq 0$), called extending clause in this context, and
* such that $\{B_{1},\ldots ,B_{n}\}\subseteq b$ (referred to as hyper condition)
then the literal tree $T'$ is a hyper tableau for $S$, where $T'$ is obtained from $T$ by attaching $m+n$ child nodes $M_{1},\ldots ,M_{m},N_{1},\ldots ,N_{n}$ to $b$ with respective labels
$A_{1},\ldots ,A_{m},\lnot B_{1},\ldots ,\lnot B_{n}$
and marking every new branch $(b,M_{1}),\ldots ,(b,M_{m})$ with positive leaf as "open", and marking every new branch $(b,N_{1}),\ldots ,(b,N_{n})$ with negative leaf as "closed".

## Minimal Model Reasoning

The clause set $M=\{A\lor B\gets ,\quad B\gets A\}$ obviously has two different models: $\{A,\;B\}$ and $\{B\}$. Under set inclusion these models can be compared and there are some tasks where it is appropriate to compute the (or in general a) smallest one. This is for example the case with
* Knowledge Representation, Circumscription
* Basis for default negation (GCWA)
* Applications: Deductive database updates, Diagnosis
There are basically two different methods to compute minimal models.

### Minimal Model Reasoning – Niemel¨a’s Approach

Given a set of ground clauses $M$ the methods applies a model generating procedure, e.g. hyper tableau, which is able to generate all models.
Lemma 1: For every minimal model $p$ for $M$ there is a branch with literals $p$.
Assume that $\Sigma$ is the set of atoms, which occur in the head of a clause from $M$, than the following Lemma holds.
Lemma 2: $p$ is a minimal model for $M$ iff $M\cup \{\lnot A\mid A\in \Sigma \setminus p\}\models p$
This offers a general method: Generate model candidates, and test with Lemma 2.
$p=\{A,\;B\}$ is not a minimal model in our example from above, because $M\cup \{\}\models \{A,\;B\}$ iff $M\cup \{\gets A\land B\}$ is unsatisfiable, which is not the case, hence $p$ does not correspond to a minimal model and hence the branch is closed.
$p=\{B\}$ is minimal because $M\cup \{\gets A\}\models \{B\}$ iff $M\cup \{\gets A\}\cup \{\gets B\}$ is unsatisfiable. This is the case and hence $p$ is minimal and the branch remains open.
Properties: Soundness (by Lemma 2) Completeness (by Lemma 1), space efficiency.

### Minimal Model Reasoning – Bry& Yayha‘s Approach

As an example we have the set $M=\{A\lor B\lor C\gets ,\quad B\gets A,\quad D\gets B\}$
Lemma: With complement splitting, the leftmost open branch is a minimal model for $M$.
General method: Repeat: generate minimal model $p$, add $\gets p$ to $M$. Properties: Soundness (by Lemma) Completeness as before, possibly exponentially many new clauses $\gets p$.