to

appear

in

Int

Journal

of

Expert

Systems

Research

and

Applications

JAI

Press

Dec.

Intelligent

Backtracking

in

the

Echidna

Constraint

Logic

Programming

System

William

S.

Havens

Expert

Systems

Laboratory

School

of

Computing

Science

and

Centre

for

Systems

Science

Simon

Fraser

University

Burnaby

British

Columbia

Canada

email

havens@cs.sfu.ca

Abstract

Abstract

A

new

type

of

reasoning

engine

for

model-based

expert

system

applications

is

described

which

employs

recent

advances

in

constraint

logic

programming

-LRB-

CLP

-RRB-

intelligent

backtracking

-LRB-

IB

-RRB-

and

schema

-LRB-

object-oriented

-RRB-

knowledge

representations

Constraint

reasoning

and

logic

programming

-LRB-

LP

-RRB-

have

been

recently

joined

in

the

new

field

of

CLP

There

is

keen

research

interest

and

new

CLP

languages

are

emerging

IB

techniques

using

reason

maintenance

systems

-LRB-

RMS

-RRB-

have

also

been

extensively

explored

and

adapted

to

LP

As

well

object-oriented

knowledge

structures

have

been

incorporated

into

the

LP

paradigm

All

three

of

these

capabilities

are

important

for

model-based

reasoning

systems

We

have

developed

a

new

CLP

language

called

which

supports

model-based

reasoning

using

schema

knowledge

structures

a

clausal

reasoner

based

on

SLD-resolution

constraint

solving

for

discrete

integer

and

real

variables

using

a

generalized

form

of

arc-consistency

and

complete

IB

using

a

hybrid

RMS

In

this

paper

we

describe

our

method

for

realizing

IB

within

the

Echidna

language

Introduction

Expert

system

methodology

has

been

predominantly

rule-based

The

early

successes

of

programs

such

as

MYCIN

-LRB-

Buchanan

Shortliffe

-RRB-

demonstrated

the

power

of

encoding

expert

knowledge

about

the

world

in

modular

chunks

organized

as

rules

There

is

a

strong

appeal

Echidna

is

a

small

Australian

anteater

Copyright

by

William

S.

Havens

to

this

approach

Rules

seem

to

be

a

convenient

representation

for

humans

part

of

the

natural

ontology

of

our

everyday

world

Rule

formalisms

have

been

extended

with

schemata

-LRB-

structural

knowledge

representations

-RRB-

in

order

to

make

the

inherent

organization

of

the

knowledge

explicit

Structural

representations

are

variously

characterized

but

generally

derive

from

the

early

frame

systems

proposed

by

Minsky

-LRB-

-RRB-

Most

adopt

the

programming

paradigm

of

object-oriented

languages

after

Smalltalk

-LRB-

Goldberg

Robson

-RRB-

As

well

expert

system

shells

offer

a

plethora

of

other

useful

features

The

inference

engine

may

support

either

forward

or

backward

deduction

or

a

flexible

combination

of

both

under

program

control

Some

form

of

uncertainty

calculus

is

often

included

to

facilitate

abductive

reasoning

Active

constraints

are

realized

frequently

by

using

demons

associated

with

frame

knowledge

structures

-LRB-

Bobrow

Winograd

-RRB-

All

these

capabilities

are

welcome

additions

to

the

strictly

rule-based

approach

See

Gevarter

-LRB-

-RRB-

for

a

review

of

some

commercial

expert

systems

shells

Their

sheer

number

suggests

a

maturing

of

the

technology

The

market

is

saturated

with

shells

each

such

offering

differentiated

by

particular

features

capabilities

platforms

and

price

This

kitchen

sink

approach

is

problematic

however

There

is

a

lack

of

coherence

in

their

underlying

reasoning

architectures

What

are

the

semantic

foundations

of

these

systems

A

m?lange

of

features

may

be

pragmatic

but

it

does

not

constitute

a

sound

reasoning

methodology

What

should

modern

expert

systems

be

Figure

illustrates

our

evolving

view

of

the

expert

system

paradigm

Expert

systems

are

cooperative

problem

solvers

They

employ

expert

knowledge

as

a

tool

to

assist

a

human

user

solve

a

complicated

task

They

are

usually

not

stand-alone

automatons

which

replace

humans

in

the

given

task

Consequently

we

can

identify

a

number

of

necessary

attributes

of

these

modern

systems

-RRB-

Modern

expert

systems

are

mixed-initiative

systems

There

is

a

true

peer

relationship

between

the

user

and

the

expert

system

The

relationship

is

necessarily

symmetrical

Both

of

these

agents

make

choices

establish

constraints

elaborate

hypotheses

and

retract

mistakes

-RRB-

The

cooperative

reasoning

process

is

incremental

The

user

issues

queries

to

the

expert

system

which

responds

with

some

form

of

answer

substitutions

on

success

and

the

report

of

failure

otherwise

These

answers

are

analysed

by

the

user

who

then

issues

additional

queries

and

so

forth

The

formal

notion

of

incremental

queries

in

LP

has

been

studied

-LRB-

vanEmden

et

al.

-RRB-

Copyright

by

William

S.

Havens

User

Expert

System

Answer

Substitutions

Responses

Queries

Interactions

Common

Ontology

Direct

Manipulation

Figure

Modern

Expert

Systems

-RRB-

The

user

and

the

expert

system

must

share

a

common

ontology

of

the

task

Both

must

represent

and

manipulate

the

same

domain

entities

What

are

the

objects

classes

of

interest

in

the

task

Which

parameters

of

these

objects

adequately

characterize

their

individual

states

How

are

objects

related

and

by

which

constraints

-RRB-

The

user

and

the

system

must

communicate

about

the

task

as

directly

as

possible

perhaps

via

a

modern

graphical

user

interface

-LRB-

GUI

-RRB-

The

GUI

mediates

the

interactions

of

the

user

and

the

system

by

providing

a

common

language

of

discourse

-RRB-

The

expert

system

must

support

shared

hypothetical

reasoning

Both

the

user

and

the

system

possess

knowledge

about

the

search

space

of

solutions

How

big

is

it

What

is

its

shape

Where

in

the

space

are

good

solutions

likely

to

be

found

Both

agents

must

be

free

to

use

whatever

of

this

domain

knowledge

they

possess

to

find

solutions

In

particular

the

process

of

backtracking

the

search

on

failure

must

not

rely

on

simplistic

chronological

backtracking

control

regimes

They

are

problematic

in

current

LP

languages

and

expert

system

shells

For

example

consider

a

modern

mixed-initiative

expert

system

after

a

significant

number

of

incremental

reasoning

cycles

-LRB-

as

depicted

in

Figure

-RRB-

Given

a

failure

in

the

reasoning

process

suppose

the

expert

system

identifies

a

particular

mistaken

rule

choice

as

the

culprit

Unfortunately

this

culprit

occurred

very

early

in

the

mixed-initiative

reasoning

cycles

Should

all

the

interactions

and

choices

made

by

the

user

subsequent

to

the

culprit

be

backtracked

chronologically

Certainly

not

A

similar

argument

can

be

made

for

the

symmetrical

case

of

the

culprit

is

always

the

most

recent

rule

choice

which

has

led

to

a

failed

derivation

Copyright

by

William

S.

Havens

user

revising

a

previous

query

issued

to

the

system

Again

all

subsequent

derivations

made

by

both

the

system

and

the

user

can

not

be

discarded

What

is

required

for

shared

hypothetical

reasoning

are

more

sophisticated

backtracking

techniques

based

on

current

research

in

intelligent

backtracking

-LRB-

IB

-RRB-

In

this

paper

we

describe

a

new

type

of

reasoning

engine

for

modern

expert

system

applications

The

architecture

of

the

reasoner

is

based

on

a

synthesis

of

recent

technical

advances

in

-RRB-

logic

programming

-LRB-

LP

-RRB-

-RRB-

constraint

reasoning

-RRB-

object

programming

-RRB-

intelligent

backtracking

and

-RRB-

reason

maintenance

The

reasoning

engine

has

been

implemented

as

a

new

constraint

logic

programming

-LRB-

CLP

-RRB-

language

-LRB-

Jaffar

Lassez

-RRB-

which

is

called

Echidna

The

language

is

being

applied

in

a

number

of

expert

system

applications

including

diagnosis

-LRB-

Havens

Jones

et

al.

-RRB-

expert

design

-LRB-

Calvert

et

al.

-RRB-

intelligent

user

interfaces

-LRB-

Havens

Dill

et

al.

-RRB-

and

knowledge-based

animation

A

difficult

aspect

of

the

research

has

been

the

integration

of

IB

within

the

CLP

paradigm

The

addition

of

object

programming

capabilities

to

CLP

exacerbates

the

problem

The

focus

of

this

paper

is

the

IB

methodology

developed

for

Echidna

Preliminary

results

have

been

reported

elsewhere

-LRB-

Havens

Havens

-RRB-

Details

of

the

programming

language

aspects

of

Echidna

can

be

found

in

-LRB-

Havens

Sidebottom

et

al.

-RRB-

The

organization

of

the

rest

of

this

paper

is

as

follows

Enabling

research

in

LP

IB

constraint

reasoning

CLP

and

structured

knowledge

representation

is

outlined

briefly

in

section

In

section

we

provide

an

architectural

overview

of

the

Echidna

language

and

an

example

schema

taken

from

a

model-based

diagnosis

application

In

section

we

describe

some

problems

of

IB

in

LP

and

CLP

languages

and

the

additional

problems

introduced

by

structured

knowledge

representations

These

problems

are

used

to

motivate

the

subsequent

IB

methodology

In

section

we

define

the

dataflow

of

events

among

unified

Horn

clauses

and

objects

From

this

development

we

develop

the

IB

scheme

in

section

Finally

the

paper

concludes

with

a

status

report

on

the

Echidna

CLP

language

and

our

future

research

plans

Related

Research

Significant

progress

is

being

made

in

the

theory

and

practice

of

LP

The

discipline

is

rapidly

advancing

Prolog

in

many

incarnations

is

the

premier

LP

language

It

has

become

a

de

facto

system

programming

language

for

expert

system

development

and

has

been

used

successfully

in

many

applications

Prolog

exhibits

a

precise

and

simple

semantics

based

on

Horn

clause

logic

and

SLD

resolution

-LRB-

Lloyd

-RRB-

The

language

maintains

a

distinct

separation

between

the

declarative

and

procedural

reading

of

logic

programs

There

now

exist

efficient

Prolog

Copyright

by

William

S.

Havens

implementations

for

many

computing

platforms

based

on

the

WAM

architecture

-LRB-

Warren

-RRB-

Nevertheless

Prolog

is

not

a

panacea

for

expert

systems

Like

simple

rule-based

shells

the

Prolog

language

provides

no

explicit

knowledge

structuring

capabilities

Furthermore

it

relies

on

a

strict

chronological

backtrack

control

structure

The

pathological

behavior

of

chronological

backtrack

search

is

well

known

requiring

exponential

time

in

the

number

of

choice

points

in

the

worst

case

-LRB-

Knuth

-RRB-

Efficient

compilation

techniques

have

been

developed

which

mitigate

this

situation

-LRB-

Warren

-RRB-

Static

data

dependency

analysis

provides

some

additional

help

by

identifying

at

compile

time

the

possible

causes

of

goal

failures

-LRB-

Kumar

Lin

Chang

Despain

-RRB-

IB

techniques

have

also

been

developed

to

overcome

the

pathologies

of

CB

Its

progenitor

dependency

backtracking

was

developed

for

electronic

circuit

analysis

-LRB-

Stallman

Sussman

-RRB-

It

was

noted

that

a

strict

chronological

choice

of

backtrack

points

is

extremely

inefficient

Many

previous

choices

made

by

the

reasoner

may

have

had

no

possible

effect

on

the

current

failure

By

keeping

track

of

which

choices

have

affected

the

current

state

of

the

reasoner

the

possible

causes

of

any

failure

can

be

easily

identified

This

reduced

set

of

backtrack

points

can

then

be

explored

using

normal

backtracking

algorithms

The

success

of

dependency

backtracking

in

specific

applications

led

to

the

development

of

general

truth

maintenance

systems

-LRB-

TMS

-RRB-

-LRB-

Doyle

deKleer

McAllester

-RRB-

There

continues

to

be

considerable

research

interest

in

both

the

justification-type

-LRB-

JTMS

-RRB-

of

-LRB-

Doyle

-RRB-

and

the

assumption-based

-LRB-

ATMS

-RRB-

of

-LRB-

deKleer

-RRB-

The

JTMS

is

straightforward

using

a

dependency

lattice

to

maintaining

a

single

belief

context

The

ATMS

associates

sets

of

assumptions

-LRB-

labels

-RRB-

with

each

derived

datum

to

manipulate

multiple

simultaneous

contexts

Smith

and

Kelleher

-LRB-

-RRB-

analyse

both

approaches

pointing

out

more

similarities

than

differences

Using

their

perspective

the

RMS

deployed

in

Echidna

can

be

seen

to

be

a

single

context

ATMS

Given

the

recognized

effectiveness

of

IB

compared

to

chronological

backtracking

it

is

natural

to

apply

this

methodology

to

LP

The

early

research

of

Bruynooghe

and

Pereira

-LRB-

-RRB-

established

the

basic

method

using

a

justification-type

RMS

The

more

recent

work

of

Drakos

-LRB-

-RRB-

showed

how

to

limit

the

size

of

the

nogood

database

constructed

by

the

RMS

Echidna

uses

a

variation

of

this

technique

Codognet

et

al.

-LRB-

-RRB-

and

You

and

Wong

-LRB-

-RRB-

have

made

further

practical

improvements

Empirical

results

of

current

implementations

indicate

the

most

benefit

in

combinatorial

search

problems

recently

reason

maintenance

system

-LRB-

RMS

-RRB-

-LSB-

-RSB-

Copyright

by

William

S.

Havens

Research

in

constraint

reasoning

methods

for

solving

constraint

satisfaction

problems

-LRB-

CSPs

-RRB-

has

a

long

history

including

beginning

with

early

work

in

computer

scene

analysis

-LRB-

Waltz

-RRB-

Later

Mackworth

-LRB-

-RRB-

formalized

a

family

of

network

consistency

algorithms

which

have

since

been

generalized

-LRB-

Freuder

-RRB-

Their

computational

complexity

has

been

analysed

-LRB-

Mackworth

Freuder

-RRB-

Consistency

techniques

can

be

used

to

enhance

backtrack

search

via

lookahead

schemes

-LRB-

Haralick

Elliot

-RRB-

and

look-back

schemes

-LRB-

Nadel

Dechter

-RRB-

The

backjumping

method

of

Gaschnig

-LRB-

-RRB-

is

a

look-back

scheme

central

to

intelligent

backtracking

Constraint

reasoning

methods

are

being

used

increasingly

in

expert

systems

applications

-LRB-

Mittal

et

al.

Fox

Havens

Rehfuss

-RRB-

Constraints

seem

part

of

the

natural

ontology

of

expert

knowledge

Constraint

reasoning

is

effective

because

it

attempts

to

avoid

search

by

progressively

discarding

portions

of

the

search

space

which

can

not

be

part

of

any

global

solution

In

fortuitous

situations

-LRB-

over-constrained

problems

typically

-RRB-

constraint

reasoning

algorithms

can

sufficiently

reduce

the

size

of

the

search

space

so

that

very

little

-LRB-

or

no

-RRB-

searching

need

be

done

It

can

not

actually

find

a

solution

nor

guarantee

its

existence

Nevertheless

if

combined

with

a

compatible

searching

scheme

constraint

reasoning

can

yield

a

great

improvement

in

efficiency

over

search

alone

LP

and

constraint

reasoning

are

already

being

combined

in

the

new

field

of

CLP

as

characterized

by

Jaffar

and

Lassez

-LRB-

-RRB-

CLP

replaces

unification

driven

search

with

constraint

propagation

and

constraint

solving

whenever

possible

New

CLP

languages

incorporating

constraint

reasoning

techniques

are

being

developed

-LRB-

Colmerauer

Jaffar

Michaylov

Older

Vellino

Saraswat

Van

Hentenryck

Voda

-RRB-

Structured

object-centered

knowledge

representations

have

been

incorporated

into

model-based

expert

systems

-LRB-

Brown

Chandrasekaran

Davis

-RRB-

Object-oriented

principles

are

being

adapted

to

LP

-LRB-

Conery

Vaucher

et

al.

Zaniolo

-RRB-

Rule

formalisms

have

been

extended

with

structural

representations

in

order

to

make

the

inherent

organization

of

the

knowledge

explicit

Structural

representations

are

variously

characterized

but

generally

derive

from

the

early

frame

systems

proposed

by

Minsky

-LRB-

-RRB-

Most

adopt

the

message-based

programming

paradigm

of

object-oriented

languages

such

as

Smalltalk

-LRB-

Goldberg

Robson

-RRB-

Echidna

A

schematic

view

of

the

architecture

of

the

Echidna

reasoning

engine

is

shown

in

Figure

was

surprised

that

his

scene

analysis

program

frequently

produced

interpretations

without

search

-LSB-

-RSB-

Copyright

by

William

S.

Havens

There

are

three

major

subsystems

-RRB-

the

SLD

Engine

-RRB-

the

Constraint

Engine

and

-RRB-

the

RMS

The

SLD

Engine

is

a

LP

theorem

prover

familiar

to

Prolog

based

on

SLD-resolution

-LRB-

Lloyd

-RRB-

The

SLD

Engine

interprets

queries

submitted

through

the

user

interface

as

goals

to

be

proven

using

the

predicates

defined

in

the

Knowledge

Base

-LRB-

KB

-RRB-

Predicates

are

represented

as

Horn

clauses

associated

with

particular

schemata

in

the

KB

Schemata

are

the

structural

knowledge

representation

provided

in

Echidna

-LRB-

which

are

described

in

more

detail

below

-RRB-

As

a

consequence

of

resolving

queries

the

SLD

Engine

constructs

a

Constraint

From

the

knowledge

representation

perspective

it

is

a

graph

of

the

schema

instances

and

their

relationships

deduced

from

the

schemata

in

the

KB

From

the

constraint

reasoning

perspective

it

is

a

network

consistency

graph

-LRB-

Mackworth

-RRB-

on

which

the

Constraint

Engine

can

operate

directly

The

nodes

in

the

network

consistency

graph

are

CLP

variables

and

the

arcs

are

k-ary

constraints

over

the

variables

The

Constraint

Engine

uses

various

constraint

solving

algorithms

to

propagate

consistency

within

the

network

consistency

graph

-LRB-

and

therefore

among

the

schema

instances

as

well

-RRB-

In

the

background

the

RMS

records

in

the

Dependency

Lattice

the

derivations

made

by

the

SLD

Engine

and

their

consequences

propagated

by

the

Constraint

Engine

The

RMS

is

a

hybrid

single-context

JTMS-type

augmented

with

datum

labels

as

in

ATMS

approach

Similar

to

the

earlier

work

of

Bruynooghe

and

Pereira

-LRB-

-RRB-

Drakos

-LRB-

-RRB-

and

You

and

Wong

-LRB-

-RRB-

Echidna

uses

its

RMS

to

record

derivational

changes

to

the

proof

tree

In

Echidna

however

assumptions

correspond

to

both

user

queries

and

the

nondeterministic

choices

of

clauses

made

by

the

SLD

Engine

to

satisfy

goals

Events

supported

by

these

assumptions

include

variable

instantiation

by

unification

schema

instance

creation

and

constraint

propagation

The

partial

order

relation

in

the

Dependency

Lattice

is

causal

support

The

maximal

nodes

of

the

lattice

are

the

input

queries

The

minimal

nodes

are

the

leaves

of

goal

elaboration

in

the

proof

tree

for

each

query

and

the

fringe

of

constraint

propagation

in

the

Constraint

Network

On

a

goal

failure

or

constraint

inconsistency

the

reasoning

engine

uses

the

RMS

to

perform

IB

as

described

in

this

paper

Constraint

Network

is

parasitic

to

the

proof

trees

constructed

for

the

input

queries

Copyright

by

William

S.

Havens

Data

Flow

Control

Flow

Process

Knowledge

Representation

SLD

Engine

Constraint

Engine

Constraint

Network

Schema

Knowledge

Base

Reasoning

Maintenance

Dependency

Lattice

Queries

Figure

Echidna

Architecture

The

Echidna

CLP

language

is

somewhat

similar

to

CHIP

-LRB-

VanHentenryck

-RRB-

for

discrete

and

integer

variables

but

with

the

additions

of

IB

and

a

schema

knowledge

representation

Echidna

solves

constraints

in

three

domains

-RRB-

finite

discrete

variables

-RRB-

integer

variables

and

-RRB-

real

interval

variables

Constraints

on

discrete

variables

are

propagated

using

a

generalization

of

the

algorithm

-LRB-

Mackworth

-RRB-

for

k-ary

constraints

Integer

constraints

are

solved

using

a

variation

of

similar

to

the

approach

used

in

CHIP

The

method

exploits

the

ordered

structure

of

the

domain

for

certain

constraints

-LRB-

eg

inequalities

-RRB-

Echidna

propagates

constraints

on

discontiguous

real

intervals

using

a

new

method

called

HACR

-LRB-

Sidebottom

Havens

-RRB-

which

is

based

on

the

hierarchical

arc

consistency

techniques

of

Mackworth

Mulder

and

Havens

-LRB-

-RRB-

This

approach

differs

from

the

real

variable

constraint

solving

approaches

typically

employed

in

CLP

languages

such

as

CHIP

Prolog

III

-LRB-

Colmerauer

-RRB-

and

CLP

-LRB-

R

-RRB-

-LRB-

Jaffar

Michaylov

-RRB-

First

it

can

process

some

non-linear

constraints

such

as

root

extraction

exponentiation

and

trigonometric

functions

Second

the

accuracy

to

which

variables

represent

solutions

can

be

incrementally

increased

during

the

reasoning

process

under

program

control

Schemata

in

Echidna

are

knowledge

structures

imposed

on

the

Horn

clause

semantics

of

the

CLP

language

Following

normal

object-programming

practice

a

schema

is

a

generative

representation

for

a

class

of

objects

Each

schema

contains

-RRB-

a

class

declaration

-RRB-

a

set

of

parameters

-LRB-

instance

variables

-RRB-

and

-RRB-

a

set

of

methods

Schemata

form

a

type

hierarchy

with

subclasses

inheriting

the

parameters

and

methods

of

their

superclasses

Figure

is

an

example

Copyright

by

William

S.

Havens

schema

of

a

common

hose

shown

in

Figure

The

example

is

taken

from

a

model-based

diagnosis

system

-LRB-

Havens

Jones

et

al.

-RRB-

In

this

example

schema

-LRB-

line

-RRB-

we

see

the

class

definition

of

hose

as

a

subclass

of

schema

physOBJ

In

lines

a

number

of

additional

parameters

of

the

schema

are

declared

The

variables

InFlow

OutFlow

InPress

and

OutPress

are

all

declared

as

positive

real

intervals

Line

declares

two

additional

parameters

and

which

are

both

instances

of

the

class

fitting

In

line

a

discrete

variable

State

is

declared

which

represents

the

diagnostic

state

of

the

hose

model

The

domain

of

possible

values

for

the

State

parameter

is

good

blocked

and

leaking

These

three

states

characterize

all

possible

operating

conditions

that

a

hose

can

assume

in

the

diagnostic

system

knowledge

base

The

remaining

lines

of

the

schema

are

the

methods

defined

within

the

hose

class

Each

is

represented

as

a

Horn

clause

InFlow

OutFlow

OutPressInPress

Hose

Figure

a

Hose

Example

Copyright

by

William

S.

Havens

schema

hose

physOBJ

-LCB-

-LSB-

inf

-RSB-

InFlow

OutFlow

InPress

OutPress

isa

fitting

isa

fitting

-LCB-

good

blocked

leaking

-RCB-

State

state

-LRB-

State

-RRB-

new

-LRB-

-RRB-

flow

-LRB-

InFlow

-RRB-

pressure

-LRB-

InPress

-RRB-

flow

-LRB-

OutFlow

-RRB-

pressure

-LRB-

OutPress

-RRB-

default

default

good

blocked

leaking

good

State

good

InPress

OutPress

InFlow

OutFlow

blocked

State

blocked

InFlow

OutFlow

leaking

State

leaking

OutPress

InPress

-RCB-

Class

Definition

Parameter

Declarations

Method

Definitions

Figure

Hose

Schema

The

methods

in

a

schema

interpret

messages

sent

to

its

instances

The

familiar

Prolog

syntax

for

Horn

clauses

is

amended

to

support

message

passing

between

communicating

objects

A

method

is

accessed

by

sending

a

logical

message

to

an

object

using

the

send

operator

S

m

-LRB-

Xn

-RRB-

where

S

is

the

receiving

object

m

is

the

message

and

-LRB-

Xn

-RRB-

are

the

message

arguments

For

example

there

are

six

methods

defined

in

the

hose

schema

The

first

-LRB-

in

line

-RRB-

is

a

very

short

accessor

method

which

allows

external

access

to

the

State

parameter

of

the

schema

The

new

method

-LRB-

lines

-RRB-

is

used

to

create

a

new

instance

of

a

hose

given

two

hose

fittings

and

The

method

establishes

four

constraints

-LRB-

lines

-RRB-

between

the

fittings

and

the

hose

by

sending

messages

to

these

objects

The

input

flow

and

pressure

of

the

hose

must

equal

the

flow

and

pressure

of

fitting

and

likewise

the

output

flow

and

pressure

must

equal

their

corresponding

parameters

in

fitting

Once

established

by

the

SLD

Engine

these

constraints

are

persistent

They

are

enforced

by

the

Constraint

Engine

unless

backtracked

by

the

RMS

Finally

-LRB-

in

line

-RRB-

the

new

method

establishes

a

default

operating

state

for

the

hose

by

issuing

the

goal

default

The

locally

defined

default

method

-LRB-

line

-RRB-

responds

by

choosing

disjunctively

Copyright

by

William

S.

Havens

either

goal

good

blocked

or

leaking

in

that

order

Any

new

hose

is

assumed

to

be

good

unless

diagnostic

evidence

suggests

otherwise

The

remaining

three

methods

of

the

class

-LRB-

lines

-RRB-

define

the

constraints

which

characterize

the

hose

model

for

each

operating

state

For

example

-LRB-

in

line

-RRB-

if

the

State

good

then

the

input

pressure

and

the

output

pressure

of

the

hose

must

be

equal

Likewise

the

input

flow

and

output

flow

will

be

the

same

In

contrast

-LRB-

line

-RRB-

if

the

State

blocked

then

both

the

input

and

output

flows

are

zero

and

no

constraints

are

known

about

the

input

and

output

pressures

The

combination

of

CLP

a

schema

knowledge

representation

and

IB

in

Echidna

is

appropriate

for

model-based

reasoning

tasks

such

as

diagnosis

Deductive

models

are

easy

to

construct

using

object

programming

methodology

augmented

with

the

power

of

CLP

techniques

The

hose

model

presented

above

although

simple

is

also

competent

It

captures

the

operating

states

of

the

model

by

expressing

these

states

as

constraints

on

the

input

and

output

parameters

of

the

model

We

can

adequately

capture

the

behaviour

of

more

complex

artifacts

by

assembling

these

primitive

models

into

larger

models

We

can

use

these

models

for

expert

reasoning

tasks

such

as

diagnosis

by

exploiting

the

power

of

IB

In

the

hose

model

for

example

if

its

predicted

output

pressure

is

at

variance

with

the

artifact?s

measured

pressure

then

this

difference

is

a

symptom

which

must

be

explained

One

hypothesis

-LRB-

among

perhaps

many

-RRB-

is

that

the

operating

state

of

the

hose

object

is

not

good

but

instead

blocked

Asserting

this

hypothesis

as

a

new

goal

state

-LRB-

blocked

-RRB-

where

is

the

particular

hose

instance

will

cause

the

Echidna

reasoner

to

perform

IB

on

The

schema

will

be

forced

into

its

blocked

state

thereby

asserting

the

new

constraints

appropriate

to

that

state

Intelligent

Backtracking

in

CLP

IB

is

difficult

to

realize

in

CLP

reasoners

The

RMS

must

record

not

only

the

inferences

made

by

the

SLD

Engine

but

also

those

produced

by

the

Constraint

Engine

We

shall

see

that

constraint

propagation

introduces

an

apparently

random

directionality

to

the

logical

flow

of

the

reasoning

engine

The

problem

is

further

exacerbated

by

the

existence

of

persistent

logical

variables

-LRB-

instance

variables

-RRB-

within

schemata

To

make

this

synthesis

practical

we

have

had

to

develop

a

technique

called

dataflow

dependency

backtracking

-LRB-

DDB

-RRB-

-LRB-

Havens

-RRB-

which

supports

IB

in

CLP

reasoners

with

structured

knowledge

representations

Although

techniques

for

IB

are

being

actively

investigated

for

LP

languages

they

seem

less

viable

for

CLP

When

structured

knowledge

representations

are

introduced

the

problems

get

Copyright

by

William

S.

Havens

worse

We

conclude

that

a

new

view

of

IB

is

required

Reuse

of

Existing

Subgoals

How

realistic

are

the

assumptions

behind

IB

Is

the

additional

overhead

required

for

correctly

identifying

the

culprit

on

failure

worth

it

Empirical

results

suggest

maybe

-LRB-

Bruynooghe

Pereira

Drakos

Codognet

et

al.

-RRB-

We

believe

regardless

of

efficiency

that

it

is

essential

for

logical

reasoners

used

in

mixed-initiative

expert

system

applications

-LRB-

as

argued

in

-RRB-

Lets

examine

the

following

LP

and

CLP

examples

We

assume

Prolog

's

left-to-right

computation

rule

Given

the

goal

clause

-LRB-

-RRB-

below

suppose

that

goals

and

succeed

on

particular

values

for

their

arguments

X

and

Y

but

goal

fails

on

this

value

for

Y

-LRB-

-RRB-

-LRB-

Y

-RRB-

-LRB-

X

-RRB-

-LRB-

Y

-RRB-

What

is

the

backtrack

point

-LRB-

i.e.

which

goal

is

the

culprit

-RRB-

Chronological

backtracking

assumes

that

every

previous

goal

instantiation

may

have

caused

the

failure

and

will

choose

-LRB-

X

-RRB-

as

the

culprit

Unfortunately

goal

has

no

possible

influence

on

variable

Y

so

inevitably

will

generate

the

identical

failure

again

What

is

worse

all

of

the

possible

solutions

for

will

be

eventually

tried

each

causing

to

again

generate

the

same

repeated

failure

-LRB-

called

thrashing

-LSB-

Mackworth

-RSB-

-RRB-

IB

will

correctly

identify

-LRB-

Y

-RRB-

as

the

proper

culprit

Goal

has

most

recently

-LRB-

in

the

chronological

order

-RRB-

had

a

possible

effect

on

Y

Then

all

succeeding

goals

-LRB-

in

the

ordering

-RRB-

are

undone

and

the

culprit

retried

for

a

different

instantiation

for

Y

The

method

maintains

completeness

because

no

instantiation

of

-LRB-

X

-RRB-

in

the

subexpression

-LRB-

-RRB-

below

of

-LRB-

-RRB-

can

succeed

-LRB-

as

argued

above

-RRB-

-LRB-

-RRB-

-LRB-

X

-RRB-

-LRB-

Y

-RRB-

Consequently

the

search

tree

for

these

two

goals

can

be

deleted

from

consideration

in

toto

without

missing

any

possible

solutions

of

the

original

goal

-LRB-

-RRB-

However

the

method

is

not

optimal

Further

significant

improvements

in

IB

are

possible

Consider

again

expression

-LRB-

-RRB-

It

is

clear

that

goal

-LRB-

X

-RRB-

can

not

be

the

culprit

for

the

failure

of

-LRB-

Y

-RRB-

but

it

should

also

be

obvious

that

neither

can

-LRB-

Y

-RRB-

be

a

future

culprit

for

any

failure

of

-LRB-

X

-RRB-

They

share

no

common

variables

being

independent

subgoals

in

the

expression

Consequently

it

makes

no

sense

to

undo

the

current

instantiation

of

when

is

identified

as

the

proper

culprit

for

IB

-LRB-

as

above

-RRB-

Clearly

the

instantiation

for

-LRB-

X

-RRB-

is

already

correct

It

need

not

be

undone

and

retried

from

scratch

for

all

possible

clauses

which

could

satisfy

its

goal

In

Copyright

by

William

S.

Havens

particular

every

instantiation

for

X

which

has

already

been

rejected

by

would

also

be

rejected

if

the

goal

were

restarted

As

well

every

future

possible

instantiation

for

X

which

has

not

been

explored

would

not

yet

be

explored

if

were

restarted

Inevitably

the

proof

for

would

return

to

the

exact

state

it

attained

at

the

time

of

the

backtracking

failure

of

We

conclude

for

the

common

occurrence

of

independent

subgoals

that

IB

should

differentiate

between

identifying

the

culprit

and

selecting

which

subsequent

subgoals

need

to

be

undone

They

are

separate

issues

Having

separated

the

identification

of

the

culprit

from

the

necessary

undoing

of

dependent

subgoals

we

can

further

improve

the

efficiency

of

IB

Consider

a

more

complex

version

of

the

goal

of

-LRB-

-RRB-

which

shares

variables

between

the

culprit

and

subgoals

and

as

goal

-LRB-

-RRB-

below

-LRB-

-RRB-

-LRB-

X

Y

-RRB-

-LRB-

X

-RRB-

-LRB-

Y

-RRB-

Now

both

and

are

mutually

dependent

because

they

share

a

common

variable

X.

Likewise

so

are

and

which

share

variable

Y

If

we

elaborate

-LRB-

-RRB-

from

left

to

right

then

the

instantiation

of

can

depend

-LRB-

but

not

-RRB-

on

the

particular

instantiation

chosen

for

However

we

can

still

improve

IB

even

when

subgoals

are

not

independent

Consider

the

simplest

case

After

backtracking

to

-LRB-

X

Y

-RRB-

for

another

proof

suppose

it

succeeds

with

a

new

value

for

Y

but

the

value

for

X

remains

unchanged

The

issue

is

whether

the

dependent

subgoal

need

be

undone

and

restarted

with

the

new

proof

for

Of

course

it

need

not

because

its

argument

X

has

not

changed

So

the

existing

proof

of

is

known

to

be

correct

even

though

and

are

mutually

dependent

subgoals

No

doubt

other

implementations

of

IB

do

not

incorporate

this

improvement

because

it

necessitates

a

more

complex

storage

allocation

scheme

than

the

popular

WAM

-LRB-

Warren

-RRB-

architecture

provides

However

we

must

abandon

the

strict

stack

architecture

of

WAM

anyway

-LRB-

as

is

argued

in

below

-RRB-

Bidirectional

Dataflow

CLP

introduces

new

complications

for

IB

Information

can

propagate

in

both

directions

within

a

definite

clause

in

CLP

languages

Logical

data

can

flow

from

any

instantiated

goal

to

all

other

goals

in

a

conjunct

whatever

their

particular

textual

order

-LRB-

in

the

program

-RRB-

or

chronological

order

-LRB-

in

the

computation

-RRB-

Constraint

propagation

among

related

goals

sharing

common

variables

is

data

dependency

analysis

-LSB-

-RSB-

would

not

be

able

to

distinguish

this

situation

whereas

unification

analysis

-LSB-

-RSB-

could

Copyright

by

William

S.

Havens

bidirectional

by

nature

Whenever

a

variable

is

refined

by

one

goal

all

sister

goals

sharing

that

variable

must

incorporate

the

updated

information

Consider

the

following

definite

clause

-LRB-

-RRB-

q

-LRB-

X

Y

-RRB-

-LRB-

X

Y

-RRB-

-LRB-

X

-RRB-

-LRB-

X

Y

-RRB-

where

X

and

Y

are

both

domain

variables

-LRB-

after

VanHentenryck

-LSB-

-RSB-

-RRB-

and

the

goals

and

are

all

constraints

We

say

that

the

binding

of

a

domain

variable

X

is

its

currently

associated

domain

DX

of

possible

values

Domain

variables

are

refined

under

constraint

propagation

by

reducing

their

domain

sizes

monotonically

We

denote

a

monotonic

change

to

domain

variable

X

as

X

which

means

that

the

domain

DX

of

variable

X

has

been

refined

to

D'

X

such

that

D'

X

DX

A

nonmonotonic

change

X

to

X

occurs

during

backtracking

if

a

D'

X

such

that

a

DX

There

is

some

value

a

for

variable

X

which

was

added

to

its

domain

by

backtracking

Suppose

constraint

has

been

applied

to

X

yielding

a

refined

binding

X

which

needs

to

be

propagated

to

constraints

and

which

share

variable

X

There

may

be

some

values

in

the

binding

of

variable

Y

which

are

no

longer

consistent

with

the

new

X

So

X

must

be

propagated

in

both

directions

as

indicated

in

Figure

below

If

either

or

refine

variable

Y

to

Y

then

consistency

must

also

be

propagated

along

the

dataflow

path

for

Y

to

the

other

constraint

q

-LRB-

X

Y

-RRB-

-LRB-

X

Y

-RRB-

-LRB-

X

-RRB-

-LRB-

X

Y

-RRB-

Y

fi

X

fi

Figure

Bidirectional

Dataflow

in

Definite

Clauses

The

bidirectional

flow

of

data

in

CLP

languages

complicates

the

implementation

of

efficient

IB

techniques

Data

can

flow

both

ways

in

clauses

during

backtracking

as

well

as

during

constraint

propagation

In

contrast

stack-based

Prolog

architectures

make

a

number

of

simplifying

assumptions

including

Every

goal

in

the

proof

tree

preceding

the

culprit

-LRB-

in

chronological

order

of

derivation

-RRB-

is

least

for

constraint

propagation

based

on

arc

consistency

type

algorithms

in

Echidna

include

primitive

constraints

and

definite

clauses

with

embedded

constraints

Copyright

by

William

S.

Havens

totally

unaffected

by

the

retraction

of

the

culprit

goal

This

is

not

true

for

dependency

backtracking

in

CLP

reasoners

since

constraints

can

have

been

propagated

in

both

directions

Retrying

the

culprit

goal

with

another

clause

may

still

require

constraints

to

be

propagated

into

some

previous

goals

Every

node

in

the

proof

tree

following

and

including

the

culprit

goal

is

to

be

undone

and

retried

from

scratch

This

strategy

is

easy

to

implement

in

a

stack

discipline

but

is

very

inefficient

As

argued

previously

there

may

be

significant

proof

subtrees

following

the

culprit

node

which

either

-RRB-

do

not

share

any

variables

with

the

culprit

goal

or

-RRB-

if

they

do

share

common

variables

their

new

bindings

are

consistent

with

the

current

instantiations

for

these

nodes

A

forward-looking

data

dependency

analysis

-LRB-

Chang

Despain

Kumar

Lin

-RRB-

could

detect

the

first

case

but

not

the

latter

For

example

please

reconsider

the

expression

of

-LRB-

-RRB-

and

the

corresponding

dataflow

diagram

of

Figure

Suppose

the

culprit

is

identified

as

-LRB-

X

-RRB-

and

a

new

instantiation

for

the

goal

is

attempted

producing

a

new

binding

X

We

note

that

the

relationship

of

X

to

X

may

be

either

a

monotonic

change

a

nonmonotonic

change

or

at

The

backtracking

of

introduces

a

bidirectional

dataflow

of

X

to

the

other

goals

within

the

clause

For

goal

it

is

necessary

only

to

apply

constraint

propagation

to

the

updated

value

X

-LRB-

since

we

know

that

only

clauses

for

which

can

successfully

unify

with

the

existing

variable

bindings

of

will

be

tried

-RRB-

For

goal

however

there

are

three

cases

If

D'

X

DX

then

the

change

is

normal

domain

refinement

and

the

new

value

X

is

propagated

into

the

current

clausal

instantiation

for

If

D'

X

DX

then

no

change

has

occurred

and

no

information

need

be

propagated

For

the

nonmonotonic

case

D'

X

DX

and

we

must

attempt

to

reunify

the

amended

goal

-LRB-

X

Y

-RRB-

with

the

current

clausal

instantiation

for

If

is

realized

as

a

definite

clause

then

it

may

be

necessary

to

repeat

the

dataflow

of

nonmonotonic

information

into

the

goals

of

its

body

By

so

doing

we

can

determine

which

branches

of

the

existing

proof

tree

for

-LRB-

X

Y

-RRB-

can

be

reused

for

-LRB-

X

Y

-RRB-

and

which

branches

need

to

be

undone

and

their

goals

restarted

Other

schemes

for

IB

would

always

undo

-LRB-

X

Y

-RRB-

and

restart

-LRB-

X

Y

-RRB-

anew

regardless

of

how

much

of

their

derivation

is

common

Nonlocal

Data

Dependencies

We

return

to

the

important

issue

of

the

nonlocal

side-effects

of

logical

variable

propagation

in

CLP

languages

Unlike

chronological

backtracking

the

culprit

goal

may

occur

anywhere

in

the

proof

tree

and

consequently

backtracking

propagated

arbitrarily

far

in

the

derivation

In

the

definite

this

example

then

the

failure

will

necessarily

recur

Copyright

by

William

S.

Havens

clause

of

-LRB-

-RRB-

suppose

again

that

-LRB-

X

-RRB-

is

backtracked

yielding

a

new

binding

X

Besides

propagating

this

new

information

to

nodes

and

inside

the

clause

as

described

above

we

must

also

propagate

X

outside

the

clause

to

the

variable

U

of

goal

q

-LRB-

U

V

-RRB-

which

was

unified

with

-LRB-

-RRB-

in

the

derivation

to

every

sister

goal

of

q

-LRB-

U

V

-RRB-

which

shares

variable

U

and

if

q

-LRB-

U

V

-RRB-

appears

in

the

body

of

a

definite

clause

whose

arguments

include

U

then

the

dataflow

backtracking

must

be

propagated

outside

that

clause

and

so

on

Figure

illustrates

these

dataflow

paths

only

within

the

clause

The

logical

variables

declared

as

schema

parameters

present

additional

difficulties

These

instance

variables

reside

within

each

instance

and

hence

persist

beyond

the

elaboration

of

any

particular

predicate

defined

within

the

schema

This

property

is

central

to

recording

object

state

within

the

instance

-LRB-

as

is

normal

in

object

programming

-RRB-

Consequently

the

RMS

must

keep

track

for

each

instance

variable

the

history

of

derivations

which

have

influenced

its

binding

These

derivations

may

be

the

result

of

the

multiple

and

distinct

goal

elaborations

Any

of

the

goals

involved

may

be

the

proper

culprit

for

IB

Figure

contains

an

Echidna

definition

of

a

schema

called

foo

The

schema

has

two

parameters

The

parameter

X

is

a

real

variable

while

the

parameter

Y

has

a

discrete

domain

of

colours

There

is

also

a

third

variable

Z

local

to

method

r

-LRB-

Z

-RRB-

which

is

of

type

Herbrand

by

default

Within

the

schema

there

are

defined

three

logical

methods

r

-LRB-

Z

-RRB-

q

-LRB-

X

Y

-RRB-

and

colour

-LRB-

Y

-RRB-

The

dataflow

diagram

for

foo

is

drawn

in

Figure

The

parameters

serve

to

link

clause

instances

across

different

goals

Indeed

the

clauses

which

access

a

particular

parameter

may

be

associated

with

entirely

different

queries

The

complications

for

efficiently

realizing

IB

are

serious

We

are

forced

not

only

to

propagate

constraints

across

proof

trees

for

multiple

queries

but

also

to

backtrack

across

these

same

structures

-LRB-

ie

a

proof

network

-RRB-

Given

a

particular

culprit

in

the

proof

network

we

can

no

longer

afford

to

undo

every

subsequent

goal

in

the

chronological

ordering

Standard

IB

will

not

suffice

It

would

require

undoing

the

state

of

every

object

sent

a

message

supported

by

the

culprit

For

interactive

reasoning

tasks

this

would

be

intolerable

perhaps

forcing

the

reasoner

to

cancel

many

dependent

interactions

with

the

We

must

instead

analyze

the

flow

of

backtracking

information

throughout

the

proof

network

thereby

retaining

as

much

of

the

completed

work

as

possible

effect

backtracking

the

user

Copyright

by

William

S.

Havens

q

-LRB-

X

Y

-RRB-

-LRB-

X

Y

-RRB-

-LRB-

X

-RRB-

-LRB-

X

Y

-RRB-

Y

fi

X

fi

colour

-LRB-

Y

-RRB-

r

-LRB-

Z

-RRB-

-LRB-

Z

X

-RRB-

Z

fi

schema

foo

-LCB-

real

X.

-LCB-

red

blue

green

-RCB-

Y.

r

-LRB-

Z

-RRB-

-LRB-

Z

X

-RRB-

q

-LRB-

X

Y

-RRB-

-LRB-

X

Y

-RRB-

-LRB-

X

-RRB-

-LRB-

X

Y

-RRB-

colour

-LRB-

Y

-RRB-

-RCB-

-LRB-

a

-RRB-

-LRB-

b

-RRB-

Figure

Dataflow

over

Schema

Parameters

Hypothetical

Dataflow

The

difficulties

in

augmenting

CLP

with

IB

noted

above

necessitates

the

development

of

new

methodology

We

visualize

the

CLP

reasoning

engine

performing

hypothetical

reasoning

by

systematically

making

nondeterministic

Horn

clause

choices

then

propagating

the

logical

consequences

of

these

choices

over

the

clause

instances

constructed

to

represent

each

proof

tree

The

nodes

in

a

proof

tree

correspond

to

goals

and

constraints

For

each

goal

the

reasoning

engine

makes

a

free

choice

of

a

program

clause

among

the

candidate

set

for

that

predicate

The

head

of

the

chosen

Horn

clause

is

unified

with

the

goal

On

success

the

unification

establishes

equality

constraints

between

the

corresponding

terms

in

the

goal

and

the

clause

head

By

the

addition

of

these

new

constraints

new

bindings

may

be

derived

for

the

logical

variables

appearing

in

the

unified

terms

These

new

bindings

are

then

propagated

among

other

literals

sharing

those

same

variables

in

both

the

goal

clause

and

unified

Horn

clause

In

object-oriented

CLP

the

instance

variables

allow

new

bindings

to

pass

between

proof

trees

established

for

different

queries

New

bindings

are

propagated

along

logical

variables

but

through

constraints

predicates

and

across

the

unifications

linking

clauses

When

a

new

binding

is

propagated

from

one

variable

to

another

it

is

Copyright

by

William

S.

Havens

transformed

by

the

constraint

or

clause

into

a

different

form

but

it

inherits

the

underlying

hypothetical

Horn

clause

choices

which

created

it

In

this

section

we

characterize

the

dataflow

of

logical

variable

bindings

as

events

manipulated

by

the

reasoning

engine

Events

are

created

and

propagated

as

a

consequence

of

particular

hypothetical

choices

of

Horn

clauses

made

to

satisfy

input

goals

In

the

next

section

we

show

how

events

can

be

used

to

realize

IB

in

CLP

Events

Events

are

created

by

both

the

SLD

Engine

and

the

Constraint

Engine

Each

event

is

composed

of

two

parts

-RRB-

the

current

binding

of

an

associated

logical

variable

and

-RRB-

the

set

of

Horn

clause

choices

which

have

caused

this

particular

binding

We

define

the

event

associated

with

a

logical

variable

X

as

the

pair

h

-LRB-

X

H

-RRB-

where

X

is

a

refined

binding

of

X

and

H

is

the

set

of

hypotheses

supporting

the

new

binding

Using

the

terminology

of

deKleer

-LRB-

-RRB-

H

is

the

label

of

the

event

h

We

know

that

the

CLP

reasoner

has

applied

some

constraint

to

X

yielding

a

new

binding

X

such

that

D'

X

DX

The

normal

mode

for

the

CLP

reasoner

is

to

monotonically

refine

X

from

its

full

declared

domain

towards

a

ground

value

a

or

perhaps

too

far

to

bottom

We

can

write

the

progression

as

D'

X

-LCB-

a

-RCB-

Each

step

in

this

refinement

requires

adding

new

hypotheses

-LRB-

as

free

Horn

clause

choices

-RRB-

to

the

label

supporting

the

new

binding

The

label

for

bottom

written

H

-LRB-

-RRB-

represents

an

inconsistent

environment

a

nogood

in

the

terminology

of

Doyle

-LRB-

-RRB-

Goal

Metavariables

We

represent

the

state

of

each

goal

in

the

proof

tree

for

a

particular

query

as

a

state

variable

These

state

variables

are

not

logical

variables

in

the

CLP

language

but

are

goal

metavariables

They

are

accessible

only

to

the

reasoning

engine

itself

Each

such

metavariable

has

an

associated

assume

all

logical

variables

are

domain

variables

of

one

type

or

another

Copyright

by

William

S.

Havens

domain

which

contains

the

Horn

clause

choices

which

may

be

used

to

prove

the

goal

Choosing

a

particular

value

for

the

metavariable

creates

a

new

hypothesis

about

the

proof

of

the

query

The

choice

causes

the

corresponding

clause

head

to

be

unified

with

the

goal

and

consequently

the

proof

tree

to

be

further

elaborated

Related

techniques

were

used

initially

by

Bruynooghe

Pereira

-LRB-

-RRB-

The

SLD

Engine

maintains

a

vector

of

the

goal

metavariables

which

it

manipulates

to

find

solutions

to

the

input

queries

In

the

process

goals

are

elaborated

predicates

are

evaluated

and

constraints

are

propagated

The

size

of

the

state

vector

grows

as

a

proof

tree

is

constructed

and

shrinks

when

backtracking

occurs

Metavariables

are

freely

manipulated

by

the

reasoning

engine

to

effect

IB

Indeed

the

engine

is

only

concerned

with

assigning

metavariables

such

that

the

clauses

in

the

proof

tree

remain

consistent

during

elaboration

Let

G

p

-LRB-

Xn

-RRB-

be

an

unsolved

goal

where

p

is

the

predicate

symbol

and

Xn

are

the

arguments

We

associate

with

each

such

G

a

goal

metavariable

z

which

records

the

current

clause

choice

The

domain

for

z

is

Dz

-LCB-

pm

-RCB-

which

is

the

set

of

Horn

clauses

defining

the

predicate

p

When

G

is

selected

for

elaboration

-LRB-

according

to

the

computation

rule

of

the

reasoner

-RRB-

it

will

be

proven

if

some

clause

pi

Dz

can

unify

with

G

such

that

all

its

subgoals

can

be

proven

and

all

its

constraints

remain

consistent

The

process

of

choosing

pi

is

nondeterministic

in

the

general

case

The

representation

of

Dz

is

mutable

in

order

that

it

can

be

manipulated

by

the

SLD

Engine

and

by

the

RMS

Horn

clauses

are

deleted

from

Dz

if

-RRB-

a

candidates

clause

head

can

not

unify

with

the

goal

pattern

of

G

or

-RRB-

the

RMS

identifies

the

current

clause

choice

as

the

culprit

-LRB-

as

described

later

in

-RRB-

If

ever

Dz

then

every

candidate

Horn

clause

for

G

has

been

attempted

and

failed

Consequently

the

predicate

p

-LRB-

Xn

-RRB-

for

the

arguments

Xn

appearing

in

G

and

bottom

is

signaled

to

the

RMS

Deep

backtracking

is

then

begun

with

G

as

the

inconsistent

node

In

Echidna

goal

metavariables

and

their

domains

are

only

constructed

for

those

goals

which

could

unify

with

the

head

of

more

than

a

single

clause

in

the

knowledge

base

No

metavariables

are

constructed

for

primitive

constraints

or

predicates

Metapredicates

such

as

split

-LRB-

X

-RRB-

and

indomain

-LRB-

X

-RRB-

defined

as

in

CHIP

also

have

associated

metavariables

but

of

a

different

type

Labels

We

use

labels

to

record

causal

support

in

the

RMS

for

IB

A

label

is

a

set

of

clause

choices

which

has

caused

a

particular

derivation

More

precisely

a

label

is

a

chronologically

ordered

set

of

metavariable

choices

Copyright

by

William

S.

Havens

H

-LCB-

zw

aw

zi

ai

zc

ac

-RCB-

for

w

i

c

Each

metavariable

choice

is

an

assignment

zi

ai

where

zi

is

the

metavariable

and

ai

Dzi

is

its

choice

value

In

any

non-empty

label

there

is

a

distinguished

choice

zc

ac

which

is

the

most

recent

called

the

culprit

-LRB-

Stallman

Sussman

-RRB-

which

is

the

choice

selected

on

failure

for

IB

Labels

are

associated

with

both

goals

in

the

proof

tree

and

the

variables

which

appear

as

their

arguments

The

nodes

in

a

proof

tree

correspond

to

goals

generated

by

a

particular

derivation

-LRB-

and

hence

a

particular

choice

of

metavariables

-RRB-

Given

G

p

-LRB-

Xn

-RRB-

predicate

p

is

hypothesized

to

be

true

given

its

arguments

Xn

The

label

H

-LRB-

G

-RRB-

of

the

goal

G

is

the

set

of

metavariable

choices

which

have

caused

the

goal

to

be

in

its

current

state

of

resolution

H

-LRB-

G

-RRB-

is

composed

of

two

different

influences

the

propositional

label

H

-LRB-

p

-RRB-

for

G

and

the

variable

label

H

-LRB-

X

-RRB-

for

each

variable

X

-LCB-

Xn

-RCB-

H

-LRB-

p

-RRB-

is

the

ordered

set

of

metavariables

choices

-LRB-

from

a

toplevel

query

to

the

goal

G

itself

-RRB-

which

have

caused

G

to

be

added

to

the

proof

tree

If

any

choice

in

H

-LRB-

p

-RRB-

is

changed

it

will

necessarily

remove

G

from

the

proof

tree

For

a

purely

propositional

derivation

H

-LRB-

p

-RRB-

entirely

characterizes

the

support

for

G

This

is

not

true

for

first-order

goals

where

the

support

for

their

arguments

must

also

be

considered

Given

the

goal

G

and

the

candidate

Horn

clauses

in

Dz

the

SLD

Engine

must

select

one

clause

to

unify

with

G

We

think

of

the

engine

as

having

an

active

-LRB-

and

possibly

clever

-RRB-

agent

associated

with

each

goal

This

agent

continually

monitors

its

metavariable

Whenever

its

current

value

becomes

nogood

the

agent

spontaneously

changes

the

value

It

does

so

by

examining

the

remaining

possible

choices

in

the

metavariable

domain

It

chooses

a

next

candidate

Horn

clause

by

assigning

a

new

value

to

the

metavariable

Let

pj

Dz

be

chosen

as

the

current

value

for

z

such

that

Horn

clause

pj

is

of

the

form

p

-LRB-

Yn

-RRB-

Ri

Rm

If

the

unification

fails

pj

-LRB-

Xn

-RRB-

meaning

that

clause

pj

is

false

for

arguments

-LRB-

Xn

-RRB-

The

SLD

Engine

deletes

clause

pj

from

Dz

and

looks

for

another

choice

The

label

which

supports

the

deletion

in

Dz

is

derived

from

H

-LRB-

G

-RRB-

as

described

in

If

the

unification

succeeds

the

reasoning

engine

constructs

new

metavariables

for

each

nondeterministic

goal

Ri

in

Copyright

by

William

S.

Havens

the

body

of

pj

thereby

expanding

the

proof

tree

The

propositional

label

H

-LRB-

Ri

-RRB-

for

each

new

goal

Ri

is

H

-LRB-

Ri

-RRB-

H

-LRB-

p

-RRB-

-LCB-

z

pj

-RCB-

For

example

consider

again

expression

-LRB-

-RRB-

which

defines

the

method

q

in

the

schema

foo

of

-LRB-

-RRB-

q

-LRB-

X

Y

-RRB-

-LRB-

X

Y

-RRB-

-LRB-

X

-RRB-

-LRB-

X

Y

-RRB-

Let

be

given

by

the

Horn

clauses

in

Table

and

let

F

be

an

instance

of

schema

foo

Number

Clause

-LSB-

-RSB-

-LRB-

U

V

-RRB-

-LRB-

U

-RRB-

-LSB-

-RSB-

-LRB-

U

a

-RRB-

-LSB-

-RSB-

-LRB-

U

b

-RRB-

Table

Clauses

for

Predicate

Number

Clause

-LSB-

-RSB-

-LRB-

W

-RRB-

-LRB-

W

-RRB-

-LSB-

-RSB-

-LRB-

W

-RRB-

-LRB-

W

-RRB-

Table

Clauses

for

Predicate

Given

a

top-level

query

-LRB-

-RRB-

F

q

-LRB-

X

Y

-RRB-

we

compute

the

propositional

labels

of

the

various

goals

in

the

proof

tree

for

-LRB-

-RRB-

as

follows

The

label

of

the

query

is

H

-LRB-

q

-RRB-

This

label

is

since

a

query

involves

no

clause

choices

made

by

the

reasoner

Likewise

there

is

only

a

single

Horn

clause

defining

the

predicate

q

within

schema

foo

Consequently

the

predicate

is

deterministic

and

no

metavariable

is

allocated

for

this

goal

either

Hence

each

subgoal

and

in

the

body

of

q

inherits

the

propositional

label

issuance

of

the

query

is

a

choice

made

by

the

user

instead

Copyright

by

William

S.

Havens

H

-LRB-

q

-RRB-

H

-LRB-

-RRB-

H

-LRB-

-RRB-

H

-LRB-

-RRB-

H

-LRB-

q

-RRB-

However

predicate

has

three

Horn

clauses

-LRB-

as

shown

in

Table

-RRB-

When

this

goal

is

elaborated

the

reasoner

will

be

forced

to

make

a

particular

choice

of

clauses

-LSB-

-RSB-

-LSB-

-RSB-

or

-LSB-

-RSB-

for

If

-LSB-

-RSB-

is

chosen

then

the

propositional

label

H

-LRB-

-RRB-

for

its

subgoal

will

be

H

-LRB-

-RRB-

H

-LRB-

-RRB-

-LCB-

-RCB-

-LCB-

-RCB-

Goal

will

be

further

elaborated

by

choosing

either

Horn

clause

-LSB-

-RSB-

or

-LSB-

-RSB-

for

its

predicate

which

is

given

in

Table

If

-LSB-

-RSB-

is

chosen

then

the

propositional

label

for

its

subgoal

is

H

-LRB-

-RRB-

H

-LRB-

-RRB-

-LCB-

-RCB-

-LCB-

-RCB-

Otherwise

if

-LSB-

-RSB-

is

chosen

for

then

the

propositional

label

for

its

subgoal

is

H

-LRB-

-RRB-

H

-LRB-

-RRB-

-LCB-

-RCB-

-LCB-

-RCB-

For

a

first-order

goal

with

arguments

we

must

include

the

variable

label

H

-LRB-

X

-RRB-

for

each

argument

X

as

well

as

the

propositional

label

of

the

goal

We

can

write

H

-LRB-

G

-RRB-

H

-LRB-

p

-RRB-

H

-LRB-

-RRB-

H

-LRB-

Xn

-RRB-

where

contributions

of

support

from

the

various

components

of

H

-LRB-

G

-RRB-

are

not

disjoint

but

usually

share

many

of

the

same

choices

In

the

next

section

we

consider

how

variable

labels

are

constructed

as

new

events

are

created

and

propagated

by

the

reasoner

Combination

Rules

New

events

are

constructed

by

unification

constraint

propagation

and

predicate

application

IB

in

Echidna

depends

on

the

actual

changes

made

to

logical

variables

shared

among

related

goals

not

the

potential

of

such

changes

Sharing

a

variable

between

two

goals

is

necessary

but

not

sufficient

for

a

data

dependency

between

them

Indeed

in

CLP

languages

the

dataflow

dependency

can

run

in

both

directions

simultaneously

between

goals

sharing

common

variables

Unification

New

events

are

created

as

a

consequence

of

unification

Conceptually

unification

builds

Copyright

by

William

S.

Havens

equality

constraints

between

unifying

terms

in

the

goal

literal

and

head

literal

of

the

matching

Horn

clauses

Once

established

by

unification

equality

constraints

are

propagated

like

other

constraints

as

described

in

the

next

section

We

consider

four

cases

of

unification

which

are

illustrated

in

Figure

below

Let

X

and

Y

both

be

arbitrary

terms

to

be

unified

In

our

formulation

unification

brings

together

existing

events

and

produces

new

events

depending

on

the

unifying

terms

Let

hX

be

the

event

currently

associated

with

X

and

likewise

hY

be

the

event

for

Y.

H

-LRB-

p

-RRB-

is

the

propositional

label

of

the

goal

invoking

the

unification

H

-LRB-

X

-RRB-

is

the

label

part

of

hX

before

the

unification

while

H

-LRB-

X

-RRB-

is

the

label

of

the

new

derived

event

hX

A

similar

notation

is

used

for

existing

and

new

events

associated

with

Y.

New

events

can

be

exchanged

between

X

and

Y

in

four

different

cases

as

follows

X

Y

hX

hY

H

-LRB-

p

-RRB-

X

Y

hX

hY

hY

hX

H

-LRB-

p

-RRB-

X

fi

Y

hX

hY

H

-LRB-

p

-RRB-

hY

X

Y

hX

hY

H

-LRB-

p

-RRB-

hX

-LRB-

a

-RRB-

-LRB-

b

-RRB-

-LRB-

c

-RRB-

-LRB-

d

-RRB-

Figure

Creation

of

Events

via

Unification

Case

Both

terms

unify

exactly

A

new

equality

constraint

is

established

between

X

and

Y

for

future

constraint

propagation

across

these

terms

No

immediate

change

need

occur

to

either

term

and

no

new

event

is

propagated

in

either

direction

If

X

and

Y

are

logical

variables

then

DX

DY

and

the

labels

of

both

variables

remain

the

same

after

H

-LRB-

X

-RRB-

H

-LRB-

X

-RRB-

and

H

-LRB-

Y

-RRB-

H

-LRB-

Y

-RRB-

Figure

indicates

that

events

hX

for

X

and

hY

for

Y

plus

the

propositional

support

H

-LRB-

p

-RRB-

enter

the

unification

from

above

but

no

new

event

is

produced

below

as

output

equality

constraint

might

be

implemented

simply

by

both

variables

sharing

common

storage

Copyright

by

William

S.

Havens

For

example

if

both

X

and

Y

are

unbound

variables

of

the

same

type

then

their

unification

produces

no

domain

refinement

in

either

variable

No

information

is

added

and

hence

no

event

constructed

nor

propagated

Case

Term

Y

is

a

variable

which

subsumes

term

X

The

unification

causes

an

event

to

propagate

from

X

to

Y

If

X

is

also

a

variable

then

we

know

that

DX

DY

As

indicated

in

Figure

the

new

event

hY

is

derived

from

hX

of

X

and

the

propositional

support

H

-LRB-

p

-RRB-

as

follows

hY

-LRB-

X

H

-LRB-

X

-RRB-

H

-LRB-

p

-RRB-

-RRB-

hY

is

propagated

to

the

dataflow

path

for

Y

while

the

label

of

X

remains

unchanged

H

-LRB-

X

-RRB-

H

-LRB-

X

-RRB-

For

example

suppose

Y

is

a

discrete

variable

whose

domain

DY

-LCB-

red

blue

green

-RCB-

and

X

is

a

constant

term

blue

The

propositional

label

for

the

unification

is

H

-LRB-

p

-RRB-

Since

X

is

a

constant

term

H

-LRB-

X

-RRB-

The

unification

of

X

and

Y

produces

a

new

event

for

variable

Y

hY

-LRB-

-LCB-

blue

-RCB-

H

-LRB-

p

-RRB-

-RRB-

Case

Term

X

is

a

variable

which

subsumes

term

Y

If

Y

is

also

a

variable

then

DX

DY

A

new

event

hX

is

constructed

from

hY

of

Y

and

the

propositional

support

H

-LRB-

p

-RRB-

according

to

Figure

The

new

event

from

the

unification

is

hX

-LRB-

Y

H

-LRB-

Y

-RRB-

H

-LRB-

p

-RRB-

-RRB-

and

is

propagated

along

the

dataflow

path

for

X

while

the

label

of

Y

remains

unchanged

H

-LRB-

Y

-RRB-

H

-LRB-

Y

-RRB-

For

example

let

both

X

and

Y

be

discrete

variables

whose

domains

are

DX

-LCB-

black

red

blue

green

yellow

-RCB-

and

DY

-LCB-

red

blue

green

-RCB-

respectively

Let

H

-LRB-

X

-RRB-

be

inherited

from

the

goal

clause

invoking

the

unification

and

let

Y

be

a

persistent

but

unbound

variable

in

the

schema

foo

whose

variable

label

is

consequently

H

-LRB-

Y

-RRB-

The

unification

of

X

and

Y

produces

a

Copyright

by

William

S.

Havens

single

new

event

hX

-LRB-

-LCB-

red

blue

green

-RCB-

H

-LRB-

p

-RRB-

-RRB-

There

is

no

contribution

to

H

-LRB-

X

-RRB-

from

H

-LRB-

X

-RRB-

because

no

previous

refinement

to

X

has

removed

any

element

from

DX

which

is

contained

in

DY

Case

Both

X

and

Y

are

variables

which

are

unifiable

such

that

DX

DY

Neither

variable

subsumes

the

other

Two

new

events

hX

and

hY

are

constructed

from

hX

hY

and

H

-LRB-

p

-RRB-

as

shown

in

Figure

The

new

events

for

both

variables

are

the

same

hX

hY

-LRB-

DX

DY

H

-LRB-

X

-RRB-

H

-LRB-

Y

-RRB-

H

-LRB-

p

-RRB-

-RRB-

which

are

propagated

in

both

directions

For

example

suppose

as

above

that

X

and

Y

are

both

discrete

variables

but

that

DX

-LCB-

black

red

green

yellow

-RCB-

Now

unifying

X

and

Y

will

remove

elements

from

both

variable

domains

and

new

events

for

both

variables

will

need

be

constructed

and

propagated

These

new

events

are

hX

hY

-LRB-

-LCB-

red

green

-RCB-

H

-LRB-

X

-RRB-

H

-LRB-

Y

-RRB-

H

-LRB-

p

-RRB-

-RRB-

Constraint

Propagation

In

the

CLP

language

constraints

tie

together

logical

variables

under

some

specified

relation

In

the

Echidna

formulation

the

relation

can

be

a

primitive

constraint

or

represented

as

a

definite

clause

Echidna

uses

variations

of

arc

consistency

generalized

for

k-ary

constraints

for

discrete

integer

and

real

interval

variables

-LRB-

Sidebottom

Havens

-RRB-

Constraints

transform

events

across

logical

variables

Let

C

be

an

instance

of

a

constraint

c

with

arguments

Xi

Xn

C

c

-LRB-

Xi

Xn

-RRB-

Each

variable

Xi

is

made

arc

consistent

by

removing

those

values

from

its

domain

Di

which

do

not

satisfy

c

Whenever

Xi

is

refined

to

a

new

binding

Xi

by

arc

consistency

then

a

new

event

is

created

for

that

variable

and

is

propagated

to

every

other

constraint

-LRB-

either

primitive

or

clausal

-RRB-

which

has

Xi

as

an

argument

The

new

event

computed

for

Xi

is

hX

i

-LRB-

Xi

H

-LRB-

C

-RRB-

-RRB-

Copyright

by

William

S.

Havens

where

H

-LRB-

C

-RRB-

is

the

label

supporting

the

application

of

the

constraint

H

-LRB-

C

-RRB-

H

-LRB-

p

-RRB-

H

-LRB-

-RRB-

H

-LRB-

Xi

-RRB-

H

-LRB-

Xn

-RRB-

The

propagation

of

events

for

constraints

is

illustrated

graphically

in

Figure

The

current

event

hXi

for

each

argument

Xi

is

combined

with

the

propositional

label

H

-LRB-

p

-RRB-

for

the

Horn

clause

in

which

C

appears

in

its

body

producing

the

new

event

hX

i.

c

-LRB-

Xi

Xn

-RRB-

hXi

hXn

hX

i

H

-LRB-

p

-RRB-

Figure

Propagation

of

Events

through

Constraints

For

example

let

C

X

Y

for

both

X

and

Y

declared

as

real

intervals

The

current

domains

of

these

variables

are

DX

-LSB-

-RSB-

and

DY

-LSB-

-RSB-

Suppose

C

is

applied

by

the

reasoner

with

the

result

that

the

binding

of

X

is

reduced

to

-LSB-

-RSB-

A

new

event

is

created

for

X

hX

-LRB-

-LSB-

-RSB-

H

-LRB-

X

-RRB-

H

-LRB-

Y

-RRB-

H

-LRB-

p

-RRB-

-RRB-

Predicate

Evaluation

Primitive

predicates

in

the

CLP

language

also

propagate

events

when

they

are

evaluated

Let

p

be

a

predicate

on

arguments

Xi

Xn

The

predicate

is

applied

to

its

arguments

and

for

each

argument

Xi

which

is

bound

to

Xi

we

create

a

new

event

hX

i

-LRB-

Xi

H

-LRB-

p

-RRB-

H

-LRB-

-RRB-

H

-LRB-

Xi

-RRB-

H

-LRB-

Xn

-RRB-

-RRB-

and

propagate

it

along

the

dataflow

path

for

Xi

The

general

case

of

event

dataflow

for

predicates

is

illustrated

in

Figure

where

only

some

of

the

hX

i

hXi

Copyright

by

William

S.

Havens

p

-LRB-

Xi

Xn

-RRB-

hXi

hXn

h

hX

i

hX

'n

X

H

-LRB-

p

-RRB-

Figure

Propagation

of

Events

in

Predicates

Intelligent

Backtracking

Given

the

machinery

described

above

IB

is

straightforward

to

implement

in

CLP

reasoners

such

as

Echidna

We

make

three

significant

contributions

-RRB-

The

culprit

is

identified

as

the

most

recent

Horn

clause

choice

which

has

bound

a

logical

variable

appearing

in

some

inconsistent

constraint

or

failed

predicate

The

method

is

analogous

to

unification

context

analysis

of

You

and

Wong

-LRB-

-RRB-

but

extended

for

domain

variables

in

a

CLP

reasoner

-RRB-

Like

Drakos

-LRB-

-RRB-

nogood

information

is

computed

during

forward

reasoning

-LRB-

and

constraint

propagation

as

well

-RRB-

but

discarded

on

failure

thereby

limiting

the

size

of

the

dependency

lattice

-LRB-

nogood

database

-RRB-

in

the

RMS

-RRB-

Definite

clause

instantiations

in

the

proof

tree

are

reused

whenever

possible

thereby

avoiding

the

recomputation

of

significant

portions

of

the

tree

In

our

implementation

the

RMS

records

the

events

associated

with

unifications

constraint

propagations

and

predicate

evaluations

The

event

records

are

the

nodes

in

a

dependency

lattice

maintained

by

the

RMS

The

arcs

in

this

lattice

represent

causal

support

as

described

above

The

maximal

nodes

of

the

lattice

are

queries

and

the

minimal

nodes

are

the

current

fringe

of

goal

elaboration

and

constraint

propagation

The

RMS

uses

the

dependency

lattice

to

compute

the

culprit

on

failure

for

IB

The

CLP

reasoning

system

continues

to

elaborate

goals

and

apply

constraints

until

a

failure

or

inconsistency

is

encountered

From

the

failing

unification

goal

or

constraint

a

nogood

label

H

-LRB-

-RRB-

is

constructed

H

-LRB-

-RRB-

represents

a

metavariable

environment

which

is

known

to

be

Copyright

by

William

S.

Havens

inconsistent

At

least

one

of

the

choices

in

H

-LRB-

-RRB-

must

be

changed

to

remove

the

failure

Any

one

will

do

since

every

choice

was

necessary

to

arrive

at

the

current

inconsistent

proof

However

in

order

to

ensure

completeness

in

IB

search

we

must

synchronize

the

iteration

of

choice

variables

by

selecting

the

most

recent

chronological

choice

in

H

-LRB-

-RRB-

as

the

culprit

Let

H

-LRB-

-RRB-

take

the

form

H

-LRB-

-RRB-

-LCB-

zn

an

-RCB-

n

We

identify

the

culprit

as

zn

an

and

the

failure

label

Y

supporting

the

removal

of

choice

an

from

Dzn

is

the

remaining

choices

Y

-LCB-

-RCB-

n

For

example

please

reexamine

the

derivation

of

query

expression

-LRB-

-RRB-

Suppose

again

that

goal

q

-LRB-

X

Y

-RRB-

calls

goal

-LRB-

X

Y

-RRB-

unifying

with

clause

-LRB-

U

V

-RRB-

-LRB-

U

-RRB-

In

turn

subgoal

-LRB-

U

-RRB-

unifies

with

clause

-LRB-

W

-RRB-

-LRB-

W

-RRB-

Finally

subgoal

-LRB-

W

-RRB-

is

called

with

H

-LRB-

-RRB-

-LCB-

-RCB-

as

illustrated

before

The

predicate

for

-LRB-

W

-RRB-

succeeds

with

a

refined

binding

W

thus

propagating

the

following

event

to

unified

variable

U

and

through

to

unified

variable

X

hX

hU

hW

-LRB-

W

-LCB-

-RCB-

-RRB-

Now

suppose

the

next

goal

-LRB-

X

-RRB-

in

expression

-LRB-

-RRB-

is

called

and

succeeds

without

rebinding

variable

X.

Finally

goal

-LRB-

X

Y

-RRB-

is

called

and

fails

Which

Horn

clause

choice

is

the

culprit

for

IB

What

is

the

nogood

containing

this

culprit

There

may

be

alternate

clause

choices

for

the

most

recent

subgoal

-LRB-

X

-RRB-

but

we

know

that

has

not

rebound

variable

X

and

hence

has

not

propagated

a

new

event

for

X

into

either

goals

or

Therefore

can

not

be

a

culprit

for

IB

We

compute

the

nogood

label

for

-LRB-

X

Y

-RRB-

from

H

-LRB-

G

-RRB-

for

the

failing

goal

as

H

-LRB-

-RRB-

H

-LRB-

G

-RRB-

H

-LRB-

-RRB-

H

-LRB-

X

-RRB-

H

-LRB-

Y

-RRB-

-LCB-

-RCB-

-LCB-

-RCB-

From

H

-LRB-

-RRB-

we

identify

the

culprit

as

the

most

recent

clause

choice

which

is

Horn

clause

-LSB-

-RSB-

for

predicate

is

deleted

from

the

metavariable

domain

The

failure

label

supporting

this

removal

is

the

remaining

clause

choices

in

the

label

Y

-LCB-

-RCB-

Copyright

by

William

S.

Havens

Deleting

an

from

Dzn

has

the

side

effect

of

undoing

the

Horn

clause

instance

allocated

for

that

choice

Y

removes

the

clause

choice

from

future

consideration

until

any

of

its

own

support

is

deleted

by

a

higher

order

failure

in

the

chronological

order

of

H

-LRB-

-RRB-

If

any

support

for

Y

is

deleted

then

clause

an

is

restored

to

metavariable

domain

Dzn

and

becomes

a

candidate

clause

for

G

again

Note

that

current

dependency

backtracking

techniques

in

Prolog

reinitialize

the

entire

goal

including

all

of

its

candidate

clauses

in

order

to

maintain

the

lexical

order

clause

selection

rule

defined

in

the

language

We

make

no

assumptions

in

Echidna

about

the

execution

order

of

candidate

clauses

for

a

goal

This

approach

gains

efficiency

because

it

only

restores

those

candidate

clauses

which

may

possibly

now

succeed

given

the

higher

failure

Once

culprit

has

been

identified

and

its

current

Horn

clause

choice

deleted

with

the

support

of

the

failure

label

the

goal

is

left

again

unproven

A

new

Horn

clause

is

chosen

arbitrarily

for

the

metavariable

from

its

domain

-LRB-

if

any

candidate

clauses

remain

-RRB-

and

unification

begun

anew

On

success

new

equality

constraints

are

established

among

the

unifying

terms

in

the

goal

and

the

matching

clause

and

their

bindings

propagated

If

the

culprit

metavariable

domain

is

empty

then

every

Horn

clause

in

the

domain

has

been

tried

and

failed

This

initiates

deep

backtracking

because

the

goal

is

false

given

its

arguments

The

union

of

all

the

individual

failure

labels

for

the

metavariable

is

itself

a

nogood

-LRB-

as

in

-LSB-

Bruynooghe

Pereira

-RSB-

-RRB-

The

corporate

environment

represented

by

these

choices

necessarily

leads

to

failure

We

therefore

construct

the

nogood

for

G

as

follows

H

-LRB-

-RRB-

Y

pi

-LRB-

-RRB-

pi

Dz

then

identify

the

new

culprit

as

the

most

recent

choice

in

this

ordered

set

And

the

IB

process

is

continued

as

described

above

Conclusion

In

this

paper

we

have

described

a

method

for

realizing

IB

in

a

new

CLP

language

called

Echidna

The

new

language

is

intended

for

model-based

expert

system

applications

We

have

synthesized

current

methodology

from

LP

constraint

reasoning

reason

maintenance

and

objectoriented

programming

Previous

IB

techniques

have

been

applied

to

LP

experimentally

Extending

them

to

a

CLP

language

has

presented

some

difficulty

which

is

further

exacerbated

by

the

inclusion

removing

all

nogoods

which

are

associated

with

its

subgoals

as

in

-LSB-

-RSB-

programmer

must

avoid

assumptions

about

the

execution

order

of

clauses

in

a

predicate

Copyright

by

William

S.

Havens

of

object

programming

capabilities

These

problems

have

necessitated

development

of

a

new

way

of

viewing

the

behaviour

of

CLP

reasoners

The

Echidna

CLP

language

has

been

successfully

implemented

in

C++

for

Unix

workstations

It

is

being

used

experimentally

in

a

number

of

model-based

expert

system

applications

Current

research

is

focusing

on

two

major

issues

efficiency

and

further

extensions

for

object

programming

It

is

recognized

that

employing

RMS

mechanisms

for

supporting

full

IB

is

expensive

computationally

We

are

examining

ways

of

ameliorating

this

inefficiency

including

-LRB-

Codognet

-RRB-

and

by

providing

a

straight

WAM

mode

of

execution

where

the

reasoner

relies

on

chronological

backtracking

for

specified

predicates

This

extension

requires

the

programmer

to

understand

when

IB

is

desirable

and

when

it

is

not

worth

the

RMS

overhead

We

have

argued

that

in

mixed-initiative

expert

systems

when

both

the

system

and

the

user

are

performing

shared

hypothetical

reasoning

IB

is

essential

and

hence

necessarily

worth

the

overhead

Our

research

in

object

programming

within

CLP

is

concentrating

on

the

logical

state

change

problem

LP

and

hence

CLP

semantics

view

logical

variables

as

representing

unknown

ground

quantities

which

do

not

change

once

identified

This

is

antithetical

to

object

programming

practice

where

instance

variables

change

over

time

to

represent

the

progress

of

state

of

the

object

These

two

views

of

programming

need

to

be

better

reconciled

in

order

to

fully

exploit

the

marriage

of

CLP

and

object

programming

Other

researchers

are

also

pursuing

this

problem

-LRB-

for

instance

Conery

Vaucher

-RRB-

Acknowledgements

The

author

would

like

to

acknowledge

support

for

this

research

from

the

Centre

for

Systems

Science

at

SFU

the

Science

Council

of

British

Columbia

and

the

Natural

Sciences

and

Engineering

Research

Council

of

Canada

The

staff

of

the

SFU

Expert

Systems

Laboratory

including

Miron

Cuperman

Sue

Sidebottom

Russ

Ovans

Sumo

Kindersley

and

Greg

Sidebottom

have

worked

tirelessly

to

make

the

Echidna

system

a

reality

References

Bobrow

D.

G.

Winograd

T.

-LRB-

-RRB-

An

Overview

of

KRL

a

Knowledge

Representation

Language

Cognitive

Science

D.

C.

Brown

B.

Chandrasekaran

-LRB-

-RRB-

Knowledge

and

Control

for

a

Mechanical

Design

Expert

System

IEEE

Computer

-LRB-

-RRB-

M.

Bruynooghe

L.M.

Pereira

-LRB-

-RRB-

Deduction

Revision

by

Intelligent

Backtracking

in

J.A.

Campbell

-LRB-

ed

-RRB-

Implementations

of

Prolog

Ellis

Horwood

Publishers

B.

G.

Buchanan

E.

H.

Shortliffe

-LRB-

-RRB-

Rule-Based

Expert

Systems

The

MYCIN

Experiments

of

the

Stanford

Copyright

by

William

S.

Havens

Heuristic

Programming

Project

Addison-Wesley

T.

Calvert

J.

Dickinson

J.

Dill

W.

Havens

J.

Jones

-LRB-

-RRB-

IntelCAD

an

Intelligent

Basis

for

Design

proc

IEEE

Pacific

Rim

Conf

on

Communications

Computers

and

Signal

Processing

Victoria

Canada

May

J.-H

Chang

A.

M.

Despain

-LRB-

-RRB-

Semi-Intelligent

Backtracking

of

Prolog

Based

on

a

Static

Dependency

Analysis

proc

IEEE

Symp

of

Logic

Programming

Boston

July

C

Codognet

P.

Codognet

G.

Fil

-LRB-

-RRB-

Yet

Another

Intelligent

Backtracking

Method

proc

Int

Conf

Symp

on

Logic

Programming

Seattle

WA.

MIT

Press

A.

Colmerauer

-LRB-

-RRB-

An

Introduction

to

Prolog

III

Communications

of

the

ACM

-LRB-

-RRB-

pp.

John

S.

Conery

-LRB-

-RRB-

Logical

objects

proc

Int

Conf

on

Logic

Programming

pages

R.

Davis

-LRB-

-RRB-

Diagnostic

Reasoning

Based

on

Structure

and

Behavior

Artificial

Intelligence

-LRB-

-RRB-

R.

Dechter

-LRB-

-RRB-

Enhancement

Schemes

for

Constraint

Processing

Backjumping

Learning

and

Cutset

Decomposition

Artificial

Intelligence

-LRB-

-RRB-

J.

deKleer

-LRB-

-RRB-

An

Assumption-Based

TMS

Artificial

Intelligence

-LRB-

-RRB-

J.

Doyle

-LRB-

-RRB-

A

Truth

Maintenance

System

Artificial

Intelligence

N.

Drakos

-LRB-

-RRB-

Reason

Maintenance

in

Horn

Clause

Logic

Programs

in

Smith

Kelleher

-LRB-

eds

-RRB-

Reason

Maintenance

Systems

and

their

Applications

John

Wiley

and

Sons

Toronto

M.

S.

Fox

-LRB-

-RRB-

Constraint-Directed

Search

A

Case

Study

of

Job-Shop

Scheduling

Morgan

Kaufmann

E.

C.

Freuder

-LRB-

-RRB-

Synthesizing

Constraint

Expressions

Communications

of

the

ACM

-LRB-

-RRB-

pp

J.

Gaschnig

-LRB-

-RRB-

Performance

Measurement

and

Analysis

of

Certain

Search

Algorithms

Tech

Rep.

Carnegie

Mellon

University

Pittsburgh

Pa.

Gevarter

W.

B.

-LRB-

-RRB-

The

Nature

and

Evaluation

of

Commercial

Expert

Systems

Building

Tools

IEEE

Computer

-LRB-

-RRB-

pp.

A.

Goldberg

D.

Robson

-LRB-

-RRB-

The

Language

and

its

Implementation

Addison-Wesley

Reading

Mass.

R.

M.

Haralick

G.

L.

Elliot

-LRB-

-RRB-

Increasing

Tree-Search

Efficiency

for

Constraint

Satisfaction

Problems

Artificial

Intelligence

W.

S.

Havens

-LRB-

-RRB-

Echidna

Constraint

Reasoning

System

Programming

Specifications

proc

Computational

Intelligence

Sept.

Milano

Italy

W.

S.

Havens

-LRB-

-RRB-

Dataflow

Dependency

Backtracking

in

a

New

CLP

Language

Proc

AAAI

Spring

Symp

on

Constraint-Based

Reasoning

Stanford

University

Stanford

CA.

W.

S.

Havens

-LRB-

-RRB-

An

Incremental

Intelligent

Backtracking

Scheme

for

LP

and

CLP

Reasoners

International

Logic

Programming

Symposium

Workshop

on

Defeasible

Reasoning

San

Diego

CA

October

W.

S.

Havens

J.

Dill

J

Dickinson

J.

Crawford

I.

Begg

R.

Kheraj

W.

Moore

-LRB-

-RRB-

Intelligent

Graphics

Interfaces

for

Supervisory

Control

and

other

Real-Time

Database

Applications

proc

Int

Conf

on

Data

Eng.

April

Kobe

Japan

W.

S.

Havens

J.D.

Jones

C.

Hunter

S.

Joseph

A.

Manaf

-LRB-

-RRB-

Applications

of

the

Echidna

Constraint

Reasoning

System

in

C.

Y.

Suen

R.

Shinghal

-LRB-

eds

-RRB-

Operational

Expert

Systems

in

Canada

Pergamon

Press

W.

S.

Havens

P.

S.

Rehfuss

-LRB-

-RRB-

Platypus

a

Constraint-Based

Reasoning

System

proc

Joint

Int.Conf

on

Artificial

Intelligence

Detroit

Mich.

August

W.

S.

Havens

S.

Sidebottom

S.

Kindersley

M.

Cuperman

R.

Ovans

G.

Sidebottom

-LRB-

-RRB-

Echidna

Constraint

Reasoning

System

-LRB-

Version

-RRB-

Programming

Manual

Centre

for

Systems

Science

Simon

Fraser

University

Burnaby

B.C.

Canada

May

J.

Jaffar

J-L

Lassez

-LRB-

-RRB-

Constraint

Logic

Programming

in

Munich

January

J.

Jaffar

S.

Michaylov

-LRB-

-RRB-

Methodology

and

Implementation

of

a

CLP

System

proc

Int

Conf

on

Logic

Copyright

by

William

S.

Havens

Programming

Melbourne

Australia

May

Knuth

D.

E.

-LRB-

-RRB-

Estimating

the

Efficiency

of

Backtrack

Programs

Mathematics

of

Computation

-LRB-

-RRB-

pp.

V.

Kumar

Y.

Lin

-LRB-

-RRB-

A

Data-Dependency-Based

Intelligent

Backtracking

Scheme

for

Prolog

Journal

of

Logic

Programming

-LRB-

-RRB-

J.

W.

Lloyd

-LRB-

-RRB-

Foundations

of

Logic

Programming

Springer-Verlag

New

York

A.K.

Mackworth

-LRB-

-RRB-

Consistency

in

Networks

of

Relations

Artificial

Intelligence

-LRB-

-RRB-

Mackworth

A.

K.

and

E.

C.

Freuder

-LRB-

-RRB-

The

Complexity

of

Some

Polynomial

Network

Consistency

Algorithms

for

Constraint

Satisfaction

Problems

Artificial

Intelligence

pp.

A.

K.

Mackworth

J.

Mulder

W.

S.

Havens

-LRB-

-RRB-

Hierarchical

Arc

Consistency

Exploiting

Structured

Domains

in

Constraint

Satisfaction

Problems

Computational

Intelligence

-LRB-

-RRB-

National

Research

Council

of

Canada

Ottawa

D.

A.

McAllester

-LRB-

-RRB-

An

Outlook

on

Truth

Maintenance

Artificial

Intelligence

Laboratory

AI

Memo

No.

MIT

Cambridge

Mass.

S.

Mittal

C.L.

Dym

M.

Morjaria

-LRB-

-RRB-

PRIDE

an

Expert

System

for

the

Design

of

Paper

Handling

Systems

Computer

July

M.

Minsky

-LRB-

-RRB-

A

Framework

for

Representing

Knowledge

in

The

Psychology

of

Computer

Vision

P.Winston

-LRB-

ed

-RRB-

McGraw-Hill

New

York

B.

A.

Nadel

-LRB-

-RRB-

Constraint

Satisfaction

Algorithms

Computational

Intelligence

W.

Older

A.

Vellino

-LRB-

-RRB-

Extending

Prolog

with

Constraint

Arithmetic

on

Real

Intervals

proc

Canadian

Conference

on

Computer

and

Electrical

Engineering

Ottawa

Canada

V.

J.

Saraswat

-LRB-

-RRB-

Concurrent

Constraint

Programming

Languages

Ph.D.

Thesis

Carnegie-Mellon

University

Pittsburgh

PA.

G.

Sidebottom

W.

S.

Havens

-LRB-

-RRB-

Hierarchical

Arc

Consistency

Applied

to

Numeric

Constraint

Processing

in

Logic

Programming

CSS-IS

Tech

Report

Centre

for

Systems

Science

Simon

Fraser

University

Burnaby

B.C.

Canada

B.

Smith

G.

Kelleher

-LRB-

-RRB-

Reason

Maintenance

Systems

John

Wiley

Sons

New

York

R.M.

Stallman

G.J.

Sussman

-LRB-

-RRB-

Forward

Reasoning

and

Dependency

Directed

Backtracking

in

a

System

for

Computer-Aided

Circuit

Analysis

Artificial

Intelligence

p.

M.

H.

van

Emden

M

Ohki

A.

Takeuchi

-LRB-

-RRB-

Spreadsheets

with

Incremental

Queries

as

a

User

Interface

for

Logic

Programming

New

Generation

Computing

P.

Van

Hentenryck

-LRB-

-RRB-

Constraint

Satisfaction

in

Logic

Programming

MIT

Press

Cambridge

Mass.

J.

Vaucher

G.

Lapalme

and

J.

Malenfant

-LRB-

-RRB-

Scoop

Structured

concurrent

object

oriented

prolog

in

proc

pages

P.

Voda

-LRB-

-RRB-

The

Constraint

Language

Trilogy

Semantics

and

Computation

tech

report

Complete

Logic

Systems

North

Vancouver

B.C.

Canada

Waltz

D.

L.

-LRB-

-RRB-

Generating

Semantic

Descriptions

from

Drawings

of

Scenes

with

Shadows

Technical

Report

MIT

D.

H.

D.

Warren

-LRB-

-RRB-

Implementing

Prolog

Compiling

Predicate

Logic

Programs

D.A.I.

Research

Report

nos.

Univ.

of

Edinburgh

Scotland

J.-H

You

B.

Wong

-LRB-

-RRB-

Intelligent

Backtracking

in

Prolog

Made

Practical

tech

rep.

TR

Dept.

of

Comp

Science

U.

of

Alberta

Edmonton

Alberta

Canada

January

C.

Zaniolo

-LRB-

-RRB-

Object-Oriented

Programming

in

Prolog

proc

Int

Symp

on

Logic

Programming

IEEE

Computer

Society

Copyright

by

William

S.

Havens

constraint logic programming
intelligent backtracking
schemata