Re: Non-declarative Constructors?
macgregor@ISI.EDU
Message-id: <199210022124.AA19641@quark.isi.edu>
Date: Fri, 2 Oct 1992 14:24:23 -0800
To: phayes@herodotus.cs.uiuc.edu, Tom Gruber <Gruber@Sumex-AIM.Stanford.edu>,
interlingua@ISI.EDU
From: macgregor@ISI.EDU
Subject: Re: Non-declarative Constructors?
Pat, thanks for cleaning up my example. Substituting "(the-location 30 40)"
for an object identifier is fine. From Gruber's response, here
is a KIF definition of "the-location":
(DEFFUNCTION THE-LOCATION
(<=> (THE-LOCATION ?LAT ?LON ?LOC)
(AND (LOCATION ?LOC)
(LEGAL-LATITUDE ?LAT)
(LEGAL-LONGITUDE ?LON)
(LATITUDE ?LOC ?LAT)
(LONGITUDE ?LOC ?LON)))
(FUNCTION THE-LOCATION)
(ARITY THE-LOCATION 3))
This definition does NOT include any assertion about the existence
of location terms (I still think of them as objects, but that's
irrelevant). Thus, I claim that starting from a knowledge base
containing only the above declaration, that the statement
(retrieve ?loc (the-location 30 40 ?loc))
should return nil. However, my impression was that the whole purpose of the
"the-foo" constructor was to introduce an equivalent of a call to
"make-instance" in logic. From one of Tom's earlier messages:
> I've been using the "the" prefix for constructors, and I think it
> works pretty well. In KIF, you don't want to say MAKE-FOO because that
> sounds imperative. But you can define a function that given some
> arguments returns an instance of a class. So, the function the-foo
> (arg1 arg2) is defined so that the thing it denotes is determined from
> its arguments.
If the above semantics is the approved one, then I don't
see how that effect is obtained. Possibly you are saying, Tom, that
in order to obtain the desired effect, I should define the function
"the-location" as being a total function? Let us pretend that I've
done that: (assert (total the-location)). Then I come back to my
original question. Here is a
variation of it that Ramesh came up with:
(ask (the-location 40 40 (the-location 30 40)))
=> false
(retrieve ?x (location ?x))
=> ??
One possibility is that nothing comes back. Another is that I
get back the term (the-location 30 40), since I called the function
once. Another is that the outer call to the predicate "the-function"
executed a call to the function "the-function", having the side-effect
of creating (the-location 40 40), so I get back two terms. Another
possibility is that the system refuses to
return an answer. I have doubts about the utility of a system
that returns either the first or last response.
> It looks like you are merging the use of terms in first-order reasoning and
> their use in LISP-type functional reasoning, but this may be a mistake.
Perhaps so. What I wish to do is, from Lisp, retrieve terms from an
embedded logic system. If I can't retrieve terms (other
than built-ins like numbers), then the logic system can't be integrated with
any kind of object-oriented application. I was hoping that constructors like
"the-location" would make the system more useful. Depending on how the
system interacts with queries like "retrieve", this may or may not
be the case.
BTW, I've seen a PACT ontology that includes constructors
such as "the-quantity", but haven't seen anything indicating how they
are used in practice. If there is a use for these constructors that
is very different from the thrust of my retrieve examples, I'd be
interested seeing some examples.
Cheers, Bob
>PS, in any case, shouldnt the last answer here be loc-0?
Yes.
Robert M. MacGregor macgregor@isi.edu
USC/ISI, 4676 Admiralty Way, Marina del Rey, CA 90292 (310) 822-1511