Path: utzoo!attcan!uunet!munnari.oz.au!lee
From: lee@munnari.oz.au (Lee Naish)
Newsgroups: comp.lang.prolog
Subject: Re: What does "extralogical" mean?
Message-ID: <2243@munnari.oz.au>
Date: 28 Sep 89 03:51:01 GMT
References: <2204@munnari.oz.au> 
Sender: news@cs.mu.oz.au
Reply-To: lee@munmurra.UUCP (Lee Naish)
Organization: Comp Sci, University of Melbourne
Lines: 35

In article  alberto@tove.umd.edu (Jose Alberto Fernandez R) writes:
>>> 	pred p(T1, ..., Tn)
>>> is interpreted as saying that
>>> 	p(X1, ..., Xn) :- Body
>>> is to be read declaratively as
>>> 	p(X1, ..., Xn) :- isa(X1, T1), ..., isa(Xn, Tn), Body.
>
>Well, your ISA(Term, Type) predicate could be as extra-logical as VAR(Term)
>is. I think that it. For example, what happen if a variable is not
>instanciated when the predicate P is called?

The isa predicates are not extra logical.  The types are defined in a
special language (for expressing regular trees) which can be seen as a
syntactic sugar for (a sub-set of) Horn Clause Logic.  What is important
here is the *meaning* of the pred declaration/isa call.  Its meaning is
expressed entirely in classical first order logic.  Its not possible to
do this for var (at least without destroying the closeness of the
Prolog-logic connection).

What happens when P is called is an entirely different question to the
meaning of P.  When P is called, the isa calls are not executed at all.
The aim of the *compile time* type checking is to ensure that the
computed answers (at run time) are correct with respect to the intended
meaning of the program (ie, with the isa calls), without having to
actually call isa at runtime.

I think the Mycroft & O'Keefe work (at least the versions which I have
seen), and most other papers on types for Prolog, do not clearly state what
the intended semantics of a program with type declarations is.  The way
I arrived at the semantics was from considering the difference between
natural specifications and efficient programs (the specifications
include the isa calls, using Richard's notation, whereas the programs don't).
Richard arrived at the same conclusion using a different path.

	lee