Re: On production rules and phase I&II

From: Hassan Aït-Kaci <hak@ilog.com>
Subject: Re: On production rules and phase I&II
Date: Wed, 08 Mar 2006 15:27:44 +0100

> Peter F. Patel-Schneider wrote:
> 
> > In the absence of any demonstration that appending two lists can be performed
> > by recursive (Horn) rules, 
> 
> Here's the requested demonstration for pure Horn and no meta-rules:
> 
> 	append([],L,L).
> 	append([H|T],L,[H|R]) :- append(T,L,R).
> 
> > by recursive (Horn) rules, why should it be incumbent on me to show that it can
> > be done in pure production rules?  
> 
> I did my part. Now, it is your (or anyone's) turn in "Pure PRs" ...

How about

 	(p (cons ^head <H> ^tail <T> ^result <L>)
	   --->
	   (make append ^left nil ^right <L> ^result <L>) )

 	(p (append ^left <T> ^right <L> ^result <R>) 
	   (cons ^head <H> ^tail <T> ^result <M>) 
	   (cons ^head <H> ^tail <R> ^result <N>)
	   --->
	   (append ^left <M> ^right <L> ^result <N>) )
	   
Well, yes, this doesn't work, but only because pure production rules don't have
functions, which are needed in Prolog to do things like append.  This isn't
even a problem in theory, because we could simply provide the working memory
elements corresponding to the cons's.

peter

Received on Wednesday, 8 March 2006 15:00:15 UTC