Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!torn!news.bc.net!newsserver.sfu.ca!fornax!jamie
From: jamie@cs.sfu.ca (Jamie Andrews)
Subject: Re: Hard Prolog Questions
Message-ID: <1995Feb6.173436.17959@cs.sfu.ca>
Organization: Faculty of Applied Science, Simon Fraser University
References: <3gtma1$1bn@mozo.cc.purdue.edu>
Date: Mon, 6 Feb 1995 17:34:36 GMT
Lines: 48

In article <3gtma1$1bn@mozo.cc.purdue.edu>,
Randall A Helzerman <helz@ecn.purdue.edu> wrote:
>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... P is

n(0).
n(s(X)) :- m(X).
m(0).
m(s(X)) :- n(X).

     ...and Q is

n(0).
n(s(X)) :- n(X).
m(X) :- n(X).

>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.

     I think you're right... you're essentially trying to find
the Kolmogorov complexity of the function encoded by the
program.  This is reducible to the Busy Beaver problem (see
Boolos & Jeffrey); also, I think there's a book by Chaitin which
contains a direct proof.

     These are very interesting questions; it would be
interesting to compile a list of precise transformations that
can reduce program size, and do an analysis of the repeated
transformation of programs to see what the properties of that
search space are -- e.g. how often do you get a smaller
program?  how likely is it that a program cannot be reduced with
the transformations?  (One would have to do a probabilistic
analysis because most interesting questions in this area are
undecidable.)

--Jamie.
  jamie@cs.sfu.ca
"Could you do the egg bacon spam and sausage without the spam then?"
