Re: Creating a function where the output is asentence
Thomas Russ <[email protected]> Fri, 20 Jul 2007 13:11:58 -0700
| Newsgroups | gmane.comp.ai.powerloom |
|---|---|
| Message-ID | <[email protected]> |
On Jul 20, 2007, at 12:06 PM, Prasan Samtani wrote:
> I think I've figured it out...
>
> (defrelation sp-statement-info ((?s sp-statement) (?i PROPOSITION)))
> ...
> (assert (sp-statement-info sk1 (car-color car1 green)))
> ...
> (retrieve (sp-statement-info sk1 ?i))
>
> |= (retrieve (sp-statement-info sk1 ?i))
> There is 1 solution so far:
> #1: ?I=(= (CAR-COLOR CAR1) GREEN)
>
> Sorry for the needless posts..
I don't think they are needless. It is a rather confusing area, so
I'll provide
some background for the benefit of the other readers of the forum.
What was happening is that items in assertions (technically,
propositions)
are evaluated. If there are nested expressions, then they are
treated as
functions that PowerLoom expects to return values to be used in the
top-level
proposition. So for example, if one were to assert
(assert (P a b (f g)))
Then PowerLoom expects "f" to be a function, and to return a value
(even if
only a skolem) that will be used in the proposition "P". That is why
a lot
of the error messages indicated that a relation (i.e., a non-functional
relation) was found where a function was expected.
Unfortunately, this expectation breaks down when you start looking at
higher
order function, namely ones that expect to get logical sentences as
arguments.
So, for relations that take PROPOSITION arguments, PowerLoom has to
do something
special, namely not try to evaluate the form as a function, but to
treat it
as a proposition. This is signaled by using the PROPOSITION type.
>
> --Prasan
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Prasan Samtani
> Sent: Friday, July 20, 2007 11:39 AM
> To: [email protected]
> Subject: Re: [PowerLoom Forum] Creating a function where the output is
> asentence
>
> I just realized I made a horrible mistake, the relation name is
> car-color, not color. But the question still applies, except the error
> now says that there are too many arguments in the proposition.
>
> -----Original Message-----
> From: Prasan Samtani
> Sent: Friday, July 20, 2007 11:32 AM
> To: [email protected]
> Subject: Creating a function where the output is a sentence
>
> I'm trying to create a function that has a sentence as its output
> value,
> but I keep running into an error that says I have a relation in a
> function position. The relevant code is posted below, and the error
> and
> specific question follows it.
>
> ------------------------------------------------------------
> ;; Taxonomy of speech acts
> (defconcept speech-act)
> (defconcept sp-statement ((?s speech-act)))
> (defconcept stmt-assert ((?s sp-statement)))
> (defconcept stmt-reassert ((?s sp-statement)))
> (defconcept stmt-other ((?s sp-statement)))
> ...
>
> ;; A statement speech-act contains arbitrary information
> ;; I'm assuming there's something wrong with the below statement?
> (deffunction sp-statement-info ((?s sp-statement)) :-> (?i SENTENCE))
> ...
>
> (defconcept color)
> (defconcept car)
> (deffunction car-color ((?a car)) :-> (?c color))
> (assert (and (color red)
> (color yellow)
> (color green)
> (car car1)))
>
> (assert (and (stmt-assert sk1)
> (act-speaker sk1 player)
> (act-ratified-receiver sk1 Pierre)
> (act-receiver sk1 John)))
>
> ;; Throws an error at this statement
> (assert (sp-statement-info sk1 (color car1 green)))
> ------------------------------------------------------------
>
> The error I get is:
> |= (assert (sp-statement-info sk1 (color car1 green)))
> ERROR: Relation `COLOR' found in function position..
> Error occurred while parsing the proposition:
> (SP-STATEMENT-INFO @SK1 (COLOR @CAR1 @GREEN))
>
> How would I go about creating a function that has an arbitrary
> sentence
> as its output?
>
> Thanks,
> Prasan
>
> _______________________________________________
> powerloom-forum mailing list
> [email protected]
> http://mailman.isi.edu/mailman/listinfo/powerloom-forum
>
> _______________________________________________
> powerloom-forum mailing list
> [email protected]
> http://mailman.isi.edu/mailman/listinfo/powerloom-forum