Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!gatech!newsfeed.pitt.edu!uunet!allegra!alice!pereira
From: pereira@alta.research.att.com (Fernando Pereira)
Subject: Re: Hard Prolog Questions
In-Reply-To: helz@ecn.purdue.edu's message of 3 Feb 1995 16:40:33 GMT
Message-ID: <PEREIRA.95Feb3174209@alta.research.att.com>
Sender: usenet@research.att.com (netnews <9149-80593> 0112740)
Nntp-Posting-Host: alta.research.att.com
Reply-To: pereira@research.att.com
Organization: AT&T Bell Laboratories
References: <3gtma1$1bn@mozo.cc.purdue.edu>
Date: Fri, 3 Feb 1995 22:42:09 GMT
Lines: 51

In article <3gtma1$1bn@mozo.cc.purdue.edu> helz@ecn.purdue.edu (Randall A Helzerman) writes:
   I've got a few questions for the Jedi-Knights of Prolog Semantics on
   the net:

   1.  Suppose I have a logic program P.  Further suppose that no clause in
       P can be derived from any other clause in P using resolution. 
       Is it possible for there to be another logic program Q such that
       Q is smaller than P but yet they both have the same Least Herbrand
       Model?

Sure. Let s^k(N) represent the term s(...s(N)) with k applications of
k. Then

Prog A:

	p(s^{k+1}(N)) :- p(s^k(N)).
	p(s^k(0)).
	...
	p(s(0)).
	p(0).

Prog B:

	p(s(N)) :- p(N).
	p(0).

have exactly the same least Herbrand model

	{ p(s^n(0)) | n > 0 }

satisfy your assumptions, and |Prog A| > k + |Prog B|.

   2.  (This is just a reality-check)  Solving the following problem is
	uncomputable:  Given a logic program P, finding a logic program Q
	such that:

		   1.  Q and P both have the same least Herbrand model,
		   2.  There exists no program which is smaller than Q
		       and yet has the same least Herbrand model as P.

This has all the flavor of an undecidable problem (program
equivalence), it should be easy to come up with a reduction.
--
Fernando Pereira
2B-441, AT&T Bell Laboratories
600 Mountain Ave, PO Box 636
Murray Hill, NJ 07974-0636
pereira@research.att.com
1-908-582-3980


