Logic for Computer Scientists/Predicate Logic/Semantic Trees

Semantic Trees

In this section we introduce the concept of semantic trees, which then can be used to proof completeness of resolution. For this we assume familiarity with the concepts of trees, binary trees and paths in trees.

Definition 15

A semantic tree for a set of clauses ${\displaystyle S}$ is a binary tree ${\displaystyle T}$ with root ${\displaystyle N_{0}}$, such that the edges are label with literals, built from elements from the Herbrand basis of ${\displaystyle S}$, such that:

• If ${\displaystyle N}$ is an inner node, its two outgoing edges are label with complementary literals ${\displaystyle A}$ and ${\displaystyle \lnot A}$.
• Every path to a node ${\displaystyle N}$ in ${\displaystyle T}$ does not contain complementary literals in ${\displaystyle I(N)}$, where ${\displaystyle I(N)}$ is the set of literals which are labels along the edges of the path.

Definition 16

A semantic tree is called complete, if every path contains every atom from the Herbrand basis either positive or negative.

Example: ${\displaystyle S=\{p(x),q(f(x))\}}$ with Herbrand basis

${\displaystyle \{p(a),q(a),p(f(a)),q(f(a)),p(f(f(a))),\ldots \}}$

Note, that for a semantic tree ${\displaystyle T}$ and a node ${\displaystyle N}$ the set ${\displaystyle I(N)}$ can be seen as an assignment of truth-values to ground atoms, as it is done in an Herbrand interpretation. Hence we call ${\displaystyle I(N)}$ a partial interpretation. A complete semantic tree corresponds to an exhaustive "enumeration" of interpretations.

Definition 17

• A node ${\displaystyle N}$ of a semantic tree ${\displaystyle T}$ is a failure node if ${\displaystyle I(N)}$ falsifies some ground instance of a clause in ${\displaystyle S}$, but ${\displaystyle I(N')}$ does not falsifiy any ground instance of a clause in ${\displaystyle S}$ for every ancestor node ${\displaystyle N'}$ of ${\displaystyle N}$.
• A semantic tree ${\displaystyle T}$ is called closed if every path contains a failure node.
• A node ${\displaystyle N}$ of a closed semantic tree is called an inference node, if both immediate descendant nodes are failure nodes.

Example: ${\displaystyle S=\{p(x),\lnot p(x)\lor q(f(x)),\lnot q(f(a))\}}$ with Herbrand basis

${\displaystyle \{p(a),q(a),p(f(a)),q(f(a)),p(f(f(a))),\ldots \}}$

Let ${\displaystyle T}$ be a complete semantic tree, than we call ${\displaystyle T'}$ the corresponding closed tree, if it is obtainable from ${\displaystyle T}$ by cutting all branches at a failure node.

Theorem 5 (Herbrand's Theorem - Version 1)

A set ${\displaystyle S}$ of clauses is unsatisfiable, iff for every complete semantic tree for ${\displaystyle S}$ there is a corresponding finite closed semantic tree.

Proof: Assume ${\displaystyle S}$ to be unsatisfiable and ${\displaystyle T}$ a complete semantic tree for ${\displaystyle S}$. For every path ${\displaystyle P}$ we have the set of labels ${\displaystyle I_{B}}$, which is an interpretation, because the tree is complete. Hence, ${\displaystyle I_{B}}$ falsifies a ground instance ${\displaystyle C'}$ of a clause ${\displaystyle C\in S}$, because ${\displaystyle S}$ is unsatisfiable. Since there are only finitely many literals in ${\displaystyle C'}$, there must be a failure node ${\displaystyle N_{B}}$ in a finite distance from the root. Since every path has such a failure node, there is a corresponding closed semantic tree ${\displaystyle T'}$, which is finite.

For the opposite direction, assume that for every complete semantic tree ${\displaystyle T}$ there is a finite closed corresponding tree ${\displaystyle T'}$. Then, every path contains a failure node, and hence, every interpretation falsifies ${\displaystyle S}$; hence ${\displaystyle S}$ is unsatisfiable.

Theorem 6 (Herbrand's Theorem - Version 2)

A set ${\displaystyle S}$ of clauses is unsatisfiable, iff there is a finite unsatisfiable set ${\displaystyle S'}$ of ground instances of clauses in ${\displaystyle S}$.

Proof: Assume ${\displaystyle S}$ to be unsatisfiable and ${\displaystyle T}$ a complete semantic tree for ${\displaystyle S}$. By Herbrand's theorem, version 1, there is a finite closed semantic tree ${\displaystyle T'}$ for ${\displaystyle S}$. Let ${\displaystyle S'}$ be the set of ground instances of clauses, which are falsified at all failure nodes of ${\displaystyle T'}$. ${\displaystyle S'}$ is finite and is falisified by every interpretation and hence unsatisfiable. The opposite direction we show by contraposition:

Note, that this version of Herbrand's theorem can be turned directly into a proof procedure: Given a set of clauses ${\displaystyle S}$, for which we want to proof unsatisfiability.

• Generate ${\displaystyle S_{1}',\ldots ,S_{n}',\ldots }$ sets of ground instances of clauses of ${\displaystyle S}$. Perform a propositional test for unsatisfiability on each of them.
• According to Herbrand's theorem, there is a finite ${\displaystyle S_{N}'}$ which is unsatisfiable, if ${\displaystyle S}$ is unsatisfiable.

Problems

Problem 10 (Predicate)

Assume the following set of clauses:

${\displaystyle M_{0}=\{\{p(x)\},\{q(x,f(x)),\lnot p(x)\},\{\lnot q(g(y),z)\}\}}$

1. Indicate (a) the Herbrand-universe and (b) the Herbrand-basis for ${\displaystyle M_{0}}$!
2. Give a closed semantic tree for ${\displaystyle M_{0}}$!

${\displaystyle \Box }$

Problem 11 (Predicate)

The following formulae ${\displaystyle F}$ and ${\displaystyle G}$ are given.

${\displaystyle F=\forall yp(y)\land \exists z\lnot p(z)}$

${\displaystyle G=r(a)\land \forall x(r(x)\to r(f(x)))}$

Give for ${\displaystyle F}$ and ${\displaystyle G}$ (a) a finate and (b) an infinite Herbrand model, or argument if this is not possible.
${\displaystyle \Box }$

Problem 12 (Predicate)

The following sets of clauses are given:

1. ${\displaystyle M_{1}={\big \{}\{p(a,x)\},\{\lnot p(y,b),q(y)\}{\big \}}}$
2. ${\displaystyle M_{2}={\big \{}\{r(x),r(f(x))\}{\big \}}}$

Give for each of them (a) a Herbrand universe, (b) Herbrand model and (c) a non-Herbrand model.
${\displaystyle \Box }$