# Logic for Computer Scientists/Predicate Logic/SATCHMO

## SATCHMOEdit

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 30Edit

A first order clause ${\displaystyle 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 ${\displaystyle A_{1}\lor \cdots \lor A_{n}}$  occurs in the body ${\displaystyle B_{1}\land \cdots \land B_{m}}$  as well.

1. Convert clauses to range restricted form:
${\displaystyle q(x)\lor p(x,y)\gets q(x)\qquad \rightsquigarrow \qquad q(X);p(X,Y)<-q(X),dom(Y)}$
2. assert range-restricted clauses and dom clauses in Prolog database.
3. Call satisfiable:
kill satisfiable :-    assume(X) :- asserta(X).
(Head <- Body)            assume(X) :-
Body, not Head, !,          retract(X), !, fail.
component(HLit, Head),      component(E, (E ; _)).
assume(HLit),               component(E, (_ ; R)) :-
not false,                   !, component(E, R).
satisfiable.                component(E, E).
satisfiable.


First-Order completeness via Level-Saturation modification. This proof procedure implements Hyper Tableaux in the ground case.

## Hyper Tableau - Ground CaseEdit

All open branches consist of positive literals only Take the following clause set as an example ${\displaystyle \{\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)Edit

A literal tree is a pair ${\displaystyle (t,\lambda )}$  consisting of a finite, ordered tree ${\displaystyle t}$  and a labeling function ${\displaystyle \lambda }$  that assigns a literal to every non-root node of ${\displaystyle t}$ .

The successor sequence of a node ${\displaystyle N}$  in an ordered tree ${\displaystyle t}$  is the sequence of nodes with immediate predecessor ${\displaystyle N}$ , in the order given by ${\displaystyle t}$ .

A (clausal) tableau ${\displaystyle T}$  of a set of clauses ${\displaystyle {\mathcal {S}}}$  is a literal tree ${\displaystyle (t,\lambda )}$  in which, for every successor sequence ${\displaystyle N_{1},\dots ,N_{n}}$  in ${\displaystyle t}$  labeled with literals ${\displaystyle K_{1},\dots ,K_{n}}$ , respectively, there is a substitution ${\displaystyle \sigma }$  and a clause ${\displaystyle \{L_{1},\dots ,L_{n}\}\in {\mathcal {S}}}$  with ${\displaystyle K_{i}=L_{i}\sigma }$  for every ${\displaystyle 1\leq i\leq n}$ . ${\displaystyle \{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)Edit

A branch of a tableau ${\displaystyle T}$  is a sequence ${\displaystyle N_{0},\ldots ,N_{n}}$  (${\displaystyle n\geq 0}$ ) of nodes in ${\displaystyle T}$  such that ${\displaystyle N_{0}}$  is the root of ${\displaystyle T}$ , ${\displaystyle N_{i}}$  is the immediate predecessor of ${\displaystyle N_{i+1}}$  for ${\displaystyle 0\leq i , and ${\displaystyle N_{n}}$  is a leaf of ${\displaystyle T}$ . We say branch ${\displaystyle b=N_{0},\ldots ,N_{n}}$  is a prefix of branch ${\displaystyle c}$ , written as ${\displaystyle b\leq c}$  or ${\displaystyle c\geq b}$ , iff ${\displaystyle c=N_{0},\ldots ,N_{n},N_{n+1},\ldots ,N_{n+k}}$  for some nodes ${\displaystyle N_{n+1},\ldots ,N_{n+k}}$ , ${\displaystyle k\geq 0}$ . The branch literals of branch ${\displaystyle b=N_{0},\ldots ,N_{n}}$  are the set ${\displaystyle 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 ${\displaystyle A\in b}$  instead of ${\displaystyle 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 ${\displaystyle f}$  which maps an open tableau to one of its open branches. If ${\displaystyle f(T)=b}$  we also say that ${\displaystyle b}$  is selected in ${\displaystyle T}$  by ${\displaystyle 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)Edit

Let ${\displaystyle S}$  be a finite set of clauses and ${\displaystyle f}$  be a selection function. Hyper tableaux for ${\displaystyle S}$  are inductively defined as follows:
Initialization step: A one node literal tree is a hyper tableau for ${\displaystyle S}$ . Its single branch is marked as "open".

Hyper extension step: If

1. ${\displaystyle T}$  is an open hyper tableau for ${\displaystyle S}$ , ${\displaystyle f(T)=b}$  (i.e. ${\displaystyle b}$  is selected in ${\displaystyle T}$  by ${\displaystyle f}$ ) with open leaf node ${\displaystyle N}$ , and
2. ${\displaystyle C=A_{1},\ldots ,A_{m}\gets B_{1},\ldots ,B_{n}}$  is a clause from ${\displaystyle S}$  (${\displaystyle m\geq 0}$ , ${\displaystyle n\geq 0}$ ), called extending clause in this context, and
3. such that ${\displaystyle \{B_{1},\ldots ,B_{n}\}\subseteq b}$  (referred to as hyper condition)

then the literal tree ${\displaystyle T'}$  is a hyper tableau for ${\displaystyle S}$ , where ${\displaystyle T'}$  is obtained from ${\displaystyle T}$  by attaching ${\displaystyle m+n}$  child nodes ${\displaystyle M_{1},\ldots ,M_{m},N_{1},\ldots ,N_{n}}$  to ${\displaystyle b}$  with respective labels

${\displaystyle A_{1},\ldots ,A_{m},\lnot B_{1},\ldots ,\lnot B_{n}}$

and marking every new branch ${\displaystyle (b,M_{1}),\ldots ,(b,M_{m})}$  with positive leaf as "open", and marking every new branch ${\displaystyle (b,N_{1}),\ldots ,(b,N_{n})}$  with negative leaf as "closed".

## Minimal Model ReasoningEdit

The clause set ${\displaystyle M=\{A\lor B\gets ,\quad B\gets A\}}$  obviously has two different models: ${\displaystyle \{A,\;B\}}$  and ${\displaystyle \{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 ApproachEdit

Given a set of ground clauses ${\displaystyle 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 ${\displaystyle p}$  for ${\displaystyle M}$  there is a branch with literals ${\displaystyle p}$ .

Assume that ${\displaystyle \Sigma }$  is the set of atoms, which occur in the head of a clause from ${\displaystyle M}$ , than the following Lemma holds.

Lemma 2: ${\displaystyle p}$  is a minimal model for ${\displaystyle M}$  iff ${\displaystyle 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.

${\displaystyle p=\{A,\;B\}}$  is not a minimal model in our example from above, because ${\displaystyle M\cup \{\}\models \{A,\;B\}}$  iff ${\displaystyle M\cup \{\gets A\land B\}}$  is unsatisfiable, which is not the case, hence ${\displaystyle p}$  does not correspond to a minimal model and hence the branch is closed.

${\displaystyle p=\{B\}}$  is minimal because ${\displaystyle M\cup \{\gets A\}\models \{B\}}$  iff ${\displaystyle M\cup \{{}\gets A\}\cup \{{}\gets B\}}$  is unsatisfiable. This is the case and hence ${\displaystyle 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 ApproachEdit

As an example we have the set ${\displaystyle 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 ${\displaystyle M}$ .

General method: Repeat: generate minimal model ${\displaystyle p}$ , add ${\displaystyle {}\gets p}$  to ${\displaystyle M}$ . Properties: Soundness (by Lemma) Completeness as before, possibly exponentially many new clauses ${\displaystyle {}\gets p}$ .