Newsgroups: comp.ai.shells
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!news.sei.cmu.edu!cis.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!swrinde!ihnp4.ucsd.edu!pacbell.com!amdahl!netcomsv!ix.netcom.com!netcom.com!ludemann
From: ludemann@netcom.com (Peter Ludemann)
Subject: Re: Why use a shell?
Message-ID: <ludemannCxA5y6.8Ix@netcom.com>
Summary: VHLLs are more flexible than shells
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
References: <36a68v$4kb@epicycle.lm.com>
Date: Fri, 7 Oct 1994 02:08:30 GMT
Lines: 52

In article <36a68v$4kb@epicycle.lm.com>, Paul Haley  <paul@haley.com> wrote:
>I agree with your example of inappropriate use of OPS5 to perform
>Monkey and Bananas, which is much more conveniently expressed using
>backward chaining.  Note that this is a result of OPS5 supporting only
>forward chaining, not of the Rete Algorithm being limited to forward
>chaining.  CLIPS suffers from the same weakness ...

Indeed.  There is an example of the RETE algorithm coded in Prolog in
Merritt's book "Building Expert Systems in Prolog".  I've always
considered the argument of forward chaining vs backward chaining a bit
of a red herring (I once attended a talk where the speaker claimed
that Prolog wasn't proper backward chaining because it could backtrack!).

It's fairly easy to do forward chaining in a "backward chaining"
language like Prolog (Merritt's book and Bratko's "Programming in
Prolog for Artificial Intelligence" both have examples).  This is
 Prolog is a *language*, not a shell; and a variety of shells can be
easily implemented on top of Prolog [if I don't like Prolog's search
strategy, I can code depth-first, breadth-first, best-first, iterative
deepening, etc. in 20-30 lines].  The converse---implementing a
language on top of a shell---is not easy (OPS5 allows escape to Lisp;
but OPS5 is not a general purpose programming language, and attempts
to use it as a general purpose language lead to the abominations such
as the Monkey and Bananas example mentioned above.

> ... The issue is whether the problem is more appropriately
>addressed using forward or backward chaining.  Other method-level
>criteria that may be relevant to a problem include monotonicity
>(which would favor Prolog) versus asynchronous environments (which
>would favor Rete).  ...

I agree that RETE-style fits very well where you have a computer
program is modeling a real world situation (as events occur, they are
asserted into the working memory; and there's no point in backtracking
once a control decision has been made by the program).  However, for
most programs, we're really interested in a provable computation (in
the sense that Dijkstra, Hoare, and Griess mean it).  RETE-style
programs are very difficult to understand as soon as they get beyond a
certain size (the classic example of this is DEC's XCON configurator,
which is a lot of work to maintain).  Logic-based systems (e.g,
Prolog, Lisp) are much easier to understand, especially when they
avoid the non-logical features of the languages (assert/retract in
Prolog, setq side-effects in Lisp, etc).

To sum up: I'd much rather have a very high level general-purpose
language (VHLL) such as Prolog, with some tools for modeling than a
shell (especially one that requires escaping to a low-level language
like C) which hasn't nearly the flexibility.  With a VHLL I'm not
committed to any particular approach; if I choose the wrong shell at
the beginning, I'm in a lot of trouble.
-- 
Peter Ludemann                      ludemann@netcom.com
