Meta-decomposition

0 views
Skip to first unread message

Rangarajan Krishnamoorthy

unread,
Nov 21, 2018, 10:39:52 PM11/21/18
to ErgoAI, Flora-2, and XSB Users Forum
I have a doubt about the “=..” operator.

1) p(a) =.. ?y.
This returns:
?y = [hilog(p), a]

2) p(a)@foo =.. ?y.
This too returns:
?y = [hilog(p), a]

I am surprised by this behaviour. I expected it to return:
?y = [hilog(p,foo), a]

However, 
3) ${p(a)@foo} =.. ?y.
Returns:
?y = [hilog(p,foo), a]

Why should I be forced to reify a predicate so that “=..” returns the module too?

Regards,
Rangarajan

Michael Kifer

unread,
Nov 22, 2018, 12:34:49 AM11/22/18
to ErgoAI-Flor...@coherentknowledge.com

Most predicates expect terms, not truth-valued formulas as arguments.  This is because, say, in  foo(p(1)) the argument can be understood either as a predicate p(1) in the current module or as a term p(1). To prevent ambiguity, one is required to reify when a predicate is meant.  The bare syntax foo@bar is also not allowed in such cases without reification -- to make sure the user means what he writes. There are other grammatical reasons as well. Since an argument can be more complex formulas then just predicates, this sometimes creates ambiguity or looks confusing. Requiring explicit reification makes the syntax sharper and easier to understand. 


The predicate =.. falls in this category.


Some meta-predicates and primitives, like clause{...} , ~ , once(...), etc., always expect formulas in some or all  of their arguments, which is clear from their semantics.

In those cases reification is not required (but is accepted).


In your case #2, the compiler should have actually issued an error, as it does for p@foo =.. ?y.

It is an oversight that will be fixed soon.

--

       --- michael




Reply all
Reply to author
Forward
0 new messages