Directory UMM :Data Elmu:jurnal:O:Operations Research Letters:Vol26.Issue1.2000:

Operations Research Letters 26 (2000) 23–26
www.elsevier.com/locate/orms

Forward chaining is simple(x)
Julian Araoz
Universidad Simon Bolvar,

Res. El Aleph, 2-A, Av. Los Samanes, La Florida, Caracas 1050, Venezuela
Received 1 June 1996; received in revised form 1 August 1999

Abstract
We show that Forward Chaining in Horn Systems is merely the Simplex Algorithm, although they look completely di erent.
This di erence is similar to the one between the Simplex and Transportation Algorithms, in that the latter takes advantage
of special structure in the problem. We further show that Backward Chaining is the same as the Dual Simplex Algorithm.
c 2000 Published by Elsevier Science B.V. All rights reserved.

Keywords: Analysis of algorithms; Simplex; Knowledge bases

1. Introduction
In areas where every problem seems to need a special algorithm, time and again di erent algorithms are
found to be merely instances of the same schema. This

is good because problem solving techniques are enriched. We present a new example of this phenomenon
from the area of Expert Systems. In this area various schemes are used to represent a given knowledge
base which is then used by the system to produce new
knowledge. These operations have generally been seen
as a particular case of logical deduction and have thus
been treated logically, while search algorithms have
been used to look for new statements of truth in the
base.
An alternative point of view is that any knowledge representation model is essentially a combinatorial data structure, since it can be viewed as a
discrete set with some suitably de ned combining
rules. It follows that a deduction corresponds to a
E-mail address: araoz@usb.ve (J. Araoz)

search in such a structure. By using results from
Combinatorial Optimization, we may formulate deductive models in knowledge-based systems.
In the present paper, we deal with propositional
Horn Clauses. This is not the most general knowledge representation schema, but it is an expressive and
widely used one. A directed hypergraph-based model
for Horn Clause systems, which leads to the equivalence between logical deduction in such systems and a
linear programming problem corresponding to a generalization of

ow in networks to directed hypergraphs
has already been proposed [6].
We show that Forward Chaining in Horn Systems
is equivalent to solving a Directed Hypergraph Flow
Linear Program using the rst phase of the Simplex
Algorithm with arti cial variables. Applying Simplex
in this way we see that both algorithms behave identically. This means that Forward Chaining is none other
than the Simplex Algorithm, despite the fact that they
look completely di erent. However, this di erence
recalls that between the Bounded Simplex and the
Transportation Algorithm which takes advantage of

c 2000 Published by Elsevier Science B.V. All rights reserved.
0167-6377/00/$ - see front matter
PII: S 0 1 6 7 - 6 3 7 7 ( 9 9 ) 0 0 0 5 5 - 3

24

J. Araoz / Operations Research Letters 26 (2000) 23–26


the special structure of the problem. In the same way
Backward Chaining is the Dual Simplex Algorithm.
This is not really so strange, since the Simplex Algorithm is a search schema which traverses the vertices
along the edges of the polyhedron.

2. Paths and
ows in directed hypergraphs
Berge [2] introduced hypergraphs as a generalization of graphs, with hyperedges which are subsets
of the nodes. Thus any matrix with only zero-, or
one-valued entries is the incidence matrix of a hypergraph.
The same idea may be trivially extended to directed
graphs leading to the idea of directed hypergraphs, so
any matrix with only zero-, one- or minus-one-valued
entries is the incidence matrix of a directed hypergraph. The hyperedges are given by two sets, tail and
head. Directed hypergraphs have been used for several
applications. Most combinatorial problems and some
algorithms on directed graphs can be extended to directed hypergraphs.
A Directed Hypergraph is a pair H = (V; E) of nite sets, where V is the set of nodes and E is the set of
hyperedges. A hyperedge is an ordered and non-empty
pair e = (t(e); h(e)), of (possibly empty) disjoint subsets of nodes; t(e) is the tail of e while h(e) is its head.

Now we present a generalization of Network Flow
Problems to Directed Hypergraphs.
Let H be a Directed Hypergraph. Then a
ow F
in H is just a function of the hyperedges of H into
the non-negative real numbers. The value F(e) will
be called the
ux of the hyperedge e. A
ow F is an
integral
ow if and only if for all e in E, the
ux of e
is an integer.
The divergence function of F is a function DivF
from
real numbers de ned as: DivF (v) =
P V into the P
v∈t(e) F(e).
v∈h(e) F(e) −
Let H be a Directed Hypergraph and Y a function

from E into the real numbers. Then the incidence matrix H = (hv; e : v ∈ V ; e ∈ E) of H is de ned by

 −1 if (v ∈ t(e));
1 if (v ∈ h(e));
hv; e =

0 otherwise
and the vector Y has components Y e = Y (e).

Note that the divergence function for vi can be calculated by multiplying ith row of the incidence matrix
 Therefore, we have H ∗ F =DivF .
of H by the vector F.
Let H be a Directed Hypergraph, V ′ and V ′′ disjoint
subsets of V , and let F be a
ow in H . Then F is a
unit
ow from V ′ into V ′′ if and only if:
(i) ∀u ∈ V ′′ (DivF (v) = 1);
(ii) ∀v ∈ V − (V ′ ∪ V ′′ ) (DivF (v) = 0):
Therefore, F is a unit

ow if and only if it is a
feasible solution to the linear program:
System 2.1.
X
X


DivF (v) =
F(e) −
F(e) = 1;




v∈h(e)
v∈t(e)





∀v ∈ V ′′


X
X
DivF (v) =
F(e) −
F(e) = 0;



v∈h(e)
v∈t(e)





∀v ∈ V \ (V ′ ∪ V ′′ );




F(e)¿0;
∀e ∈ E:
Note that System 2:1 corresponds to the Path Polyhedron from V ′ to V ′′ without the redundant inequality corresponding to V ′ .
An increasing hyperpath from s0 to sk in a Directed
Hypergraph H is a sequence of form:
s0 e1 s1 e2 s2 : : : sk−1 ek sk
satisfying:
(i)
(ii)
(iii)
(iv)

∀i
∀i
∀i
∀i

∈ {0 : : : k} (si ⊆ V );

∈ {1 : : : k} (ei ∈ E);
∈ {1 : : : k} (t(ei ) ⊆ si−1 );
∈ {1 : : : k} (si = si−1 ∪ h(ei )):

We use the name increasing hyperpath because
they correspond to the feasible solutions of System
2:1 as have been proved in [6].
3. Horn’s systems and rule hypergraphs
Even though a variety of knowledge-representation
schemes exist, perhaps the most precise and general
model is given by symbolic logic. A knowlege base
is simply a well-formed formula in a formal logic
system. It is known that any logical formula can
be translated to an equivalent one in clausular form

J. Araoz / Operations Research Letters 26 (2000) 23–26

[5]. In a propositional system a clause
is W
nothing

V
more than a statement of the form: p∈P ⇒ p′ ∈P′ ,
where P and P ′ are both sets of atomic propositions,
i.e. instances of propositional variables. A formula
is in clausular form if it is a nite conjunction of
clauses.
A particular class of clauses, very important for
the simplicity of derivations using them and for their
suitability for expressing the most knowledge, are
Horn Clauses [3] in which there is only one atomic
proposition
on the right-hand side, i.e. clauses of the
V
form: p∈P ⇒ p′ . A formula that is a nite conjunction of Horn Clauses is said to be in Horn
V Clausular
Form. Note that a clause of the form p∈P ⇒ p′ ,
where p′ ∈ P, is a tautology, so any formula in Horn
Clausular Form can be assumed to have no such
clauses.
Let P be a set of atomic propositions. Then a

Horn’s System S is a pair (P; C), where C is a set of
non-tautological Horn’s Clauses referencing only the
atomic propositions in P.
A Horn’s system is then naturally modeled by a directed hypergraph with all hyperedges having a unitary head. In this model nodes represent the atomic
propositions of the system and hyperedges represent
the clauses.
A Directed Hypergraph H is a Rule Hypergraph if
and only if:
∀e ∈ E

(|h(e)| = 1):

Any hyperedge of H will be called a rule and any
node an atom of H . Any subset of V will be an
Information State of H .
Now, we introduce a path-based concept of derivation which is equivalent to deduction in Horn Systems
[6].
Let H be a Rule Hypergraph. A derivation of d
from T in H , where d is an atom and T an information
state, is an increasing hyperpath of the form:
s0 e1 s1 e2 s2 : : : sk−1 ek sk ;
where
(i) s0 T;
(ii) d ∈ sk \T:
The hyperedge sequence of a derivation will be
called rule sequence. A rule contained in the rule sequence of a derivation is said to be applied in it. Given

25

an information state T , a rule e is said to be applicable
in T if and only if t(e) ⊆ T .
Note that the concept of derivation in rule hypergraphs corresponds to that of logical derivation with
Horn Clauses by modus ponens. If information states
are interpreted as the conjunction of the propositions
represented by its atoms, which are assumed to be
true, then a rule is applicable if its preconditions are
true, and the set of true propositions after the rule is
applied is augmented by its consequent. A rule with
consequent already in the set of true propositions is
called trivial.

4. Forward chaining versus simplex
In this section we will show that the rst phase of the
Simplex Algorithm with arti cial variables applied to
any system Q of the type given in System 2:1 behaves
exactly as the Forward Chaining Algorithm. Hence
the Forward Chaining Algorithm could be considered
as a Simplex Algorithm which takes advantage of the
special structure of the problem in the same way that
the Transportation Algorithm does. First we present
the Forward Chaining Algorithm.
Algorithm 4.1. Let T be the set of true atoms and d
a given atom. Obtain a derivation of d from T if one
exits.
Step 1: s0 :=T ,
k:=0.
Step 2: While (there exists a non-trivial rule applicable in sk ) and (d 6∈ sk ) do
• Pick an applicable rule ek+1 in sk ,
• sk+1 := sk ∪ h(ek+1 ),
• k := k + 1.
Step 3: If d 6∈ sk then there is no derivation, otherwise the increasing hyperpath
s0 e1 s1 e2 s2 : : : sk−1 ek sk
is a derivation of d from T .
Theorem 4.2. Forward Chaining is a Simplex Algorithm.

26

J. Araoz / Operations Research Letters 26 (2000) 23–26

Proof. We prove the theorem by showing, using
induction, that the derivation of d from T ,
s0 e1 s1 e2 s2 : : : sk−1 ek sk
is obtained with s0 = T and at any pivoting step k we
can pivot in a column e only if it is an applicable rule
in sk−1 .
Note that, after adding the arti cal variables, the
problem is to minimize their sum. The right-hand side
are all 0 but for the one corresponding to atom d which
is 1. The algorithm ends when this variable leaves the
basis, that is, a rule with consequent d enters the basis
and hence d ∈ sk .
At any pivoting step, a variable j could enter the
basis only if its transformed cost zj − cj ¿ 0.
If we show that at any step the basis, after rearranging the columns have the shape


B O


O I
where

B

O

are the columns of the rules variables in the basis
(denoted by EB ) and

O

I

are the columns of the arti cial variables in the basis,
with O matrices of zeros of the appropriate dimensions. Let A be the basis row indices of the arti cial
variables. Then we have
X
hi; j ;
zj − cj =
i∈A

since cj =0 for the real variables, cj =1 for the arti cial
variables, and the inverse of the basis is
−1
B O


O I :

Therefore, ej could enter the basis only if zj − cj =
1. That is, it is a rule applicable in T ∪ H = s|EB |
where H = {h(e): e ∈ EB }. Hence, we have proved
the theorem.

(i) For k = 0, the basis is the identity matrix and
|EB | = 0.
(ii) At pivot step k, we have |EB | = k; sk = T ∩ H .
Since the pivot element is 1 and the others are 0
we keep the same shape of the basis.

5. Remarks
Theorem 4.2 implies that any polyhedron corresponding to a system of equations with 0; 1; −1
entries with at most one per column, non-negative
variables and non-negative right-hand side has integer vertices. This was proved independently in [4,6].
The non-negative conditions are essential for integer
vertices. It is also possible to give an explicit inverse
of any basis. The values of the variables in a solution
indicate how many times a rule is used to get the
solution in an and=or tree.
The linear program given in System 2:1 could be
modi ed changing the equal symbols to greater than or
equal symbols. Hence the equations became inequalities, but the vertices remain the same. In this case
the Dual Simplex Algorithm corresponds to Backward
Chaining.
An early version of this work was reported
in [1].

References
[1] J. Araoz, Search in Horn’s knowledge bases and the simplex
algorithm, Proceedings of PANEL’91, edited by Coordinacion
de Computacion, USB, Caracas, 1991, pp. 1273–1282.
[2] C. Berge, Graphes et Hypergraphes, 2nd Edition, Dunot, Paris,
1976.
[3] A. Horn, On sentences which are true of direct unions of
algebras, J. Symbolic Logic 16 (14) (1951).
[4] R.G. Jeroslow, Computation-oriented reductions of predicate
to propositional logic, Decision Support Systems 4 (1988)
183–197.
[5] Z. Manna, Mathematical Theory of Computation,
McGraw-Hill, New York, 1974.
[6] A. Torres, J. Araoz, Combinatorial models for searching in
knowledge bases, Acta Cient ca Venezolana 39 (1988) 387–
394.