                     THE TRANSITION NET INTERPRETER.


Introduction.
=============

This program allows you to define transition networks in Prolog. The
idea behind transition networks is to think of the program as evolving
through a number of states. When the program reaches a particular state,
it obeys one or more commands. It then proceeds to one of several new
states, depending on a condition.

A transition network consists of one or more nodes. Each node represents
a particular state of execution, and its name should indicate this. Each
node has a command associated with it; this command, which is just a
Prolog goal, is obeyed once the node is reached. Finally, after the
command has been obeyed, execution transfers to another node, depending
on a condition.

So, when writing a transition network, we need to represent:

1. The node's name.

2. The Prolog goals to be obeyed on reaching that node.

3. A list of successor nodes and the conditions determining which one
    is taken.


Syntax.
=======

    < net definition > ::= < node > :: < body > .

    < node > ::= any Prolog term

    < body > ::= < arcs >
              |  < goal >
              |  < goal > < arcs >

    < goal > ::= any Prolog goal

    < arcs > ::= < arc >
              |  < arc > < arcs >

    < arc >  ::= to < node > if < condition >
                 to < node >

    < condition > ::= any Prolog goal


There are two special nodes, called 'failure' and 'success'.


Execution.
==========                    

To start running a net (having loaded it - see next section), call
    do_node( Node )

This will fail if the node doesn't exist. Otherwise, the command in
Node's body will be obeyed. If this fails, do_node will fail. Otherwise,
the conditions in first arc will be tested. If it succeeds, execution
will transfer to the corresponding node. Otherwise, the next condition
will be tested, and so on. If none of the conditions are true, do_node
will fail.

There are two special nodes, 'failure' and 'success'. Transferring to
these causes 'do_node' to fail or succeed.


Consulting a net.
=================

The predicate
    atn_reconsult( Filename )
does this. The file can contain, as well as node definitions, terms of
the form
    ?- Term.
    :- Term.
    Head :- Tail.
    Head.

The first two are treated as Prolog directives, and called immediately.
The final two are treated as clauses, and asserted. This is done in
reconsult mode, so if clauses with the same functor and arity exist,
they will be deleted.

atn_reconsult also operates in reconsult mode for node definitions. If it
encounters a definition for a node with functor and arity F, A, and the
previous term was not for the same node, it will first delete all
definitions for that functor and arity. Note that this means (as for
clauses in normal Prolog), that definitions for the same functor and
arity should be contiguous.                   


Dynamically asserting and retracting nodes.
===========================================

There are two predicates for this.

'assert_atn(T+)' takes a term representing an ATN and asserts it.                    

'retractall_atn(Node+)' takes a node term, and retracts all nodes which
match it.
