Re: [Flora-users] Syntax/Feature issue?

6 views
Skip to first unread message

Rangarajan Krishnamoorthy

unread,
Nov 10, 2018, 8:23:42 PM11/10/18
to FLORA-2 Mailing List
Michael,

Continuing this example, I have the following statements in the file “Reification.flr”:

John[believes -> ${Mary[likes -> Sally]}].
John[believes -> ${Bob[likes -> ?X] :- Mary[likes -> ?X]}].
John[believes -> ?A] :- John[believes -> {${?Head :- ?Body}, ?Body}].


// Query: John[believes -> ${Bob[likes -> Sally]}]. — (1)
// Query: John[believes -> ${Bob[likes -> Nancy]}]. — (2)


When I load this file into Flora-2 session, I get some warnings about “unsafe” / “singleton” variables. I ignore them.

Based on the discussion in the paper that I had referenced in my earlier email, I assumed that the query marked (1) should return “Yes”, whereas (2) should return “No”. However, Flora-2 returns “Yes” for both the queries. How is that?

Also, I don’t understand the use of the variable “?A” in the third rule.

— Rangarajan

> On 09-Nov-2018, at 10:31 AM, Michael Kifer <ki...@cs.stonybrook.edu> wrote:
>
> Do you mean this?
>
> John[believes->?A] :- John[believes->{${?Head:-?Body},?Body}].
>
> It is a rule, but you are apparently using this sentence as a query (on command prompt?).
>
> Otherwise it is allowed (when used as a rule).
>
> --
>
> --- michael
>
>
>
>
> On 11/8/18 11:44 PM, Rangarajan Krishnamoorthy wrote:
>> Hi,
>> In the paper “Nonmonotonic Reasoning in Flora-2” by Michael Kifer that appeared in LNCS 2005, there is a nice example of Reification (Page 4). However, the item numbered (3) is not accepted in my current Flora-2 (Windows version). I get a Parser error: “embedded :- is not allowed in rule head or body”.
>>
>> Am I missing anything?
>>
>> Regards,
>> Rangarajan
>>
>> _______________________________________________
>> Flora-users mailing list
>> Flora...@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/flora-users
>
>
> _______________________________________________
> Flora-users mailing list
> Flora...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/flora-users

_______________________________________________
Flora-users mailing list
Flora...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flora-users

Michael Kifer

unread,
Nov 10, 2018, 8:36:29 PM11/10/18
to flora...@lists.sourceforge.net, ergoai-flor...@coherentknowledge.com


On 11/10/18 6:01 PM, Rangarajan Krishnamoorthy wrote:
Michael,

Continuing this example, I have the following statements in the file “Reification.flr”:

John[believes -> ${Mary[likes -> Sally]}].
John[believes -> ${Bob[likes -> ?X] :- Mary[likes -> ?X]}].
John[believes -> ?A] :- John[believes -> {${?Head :- ?Body}, ?Body}].


// Query: John[believes -> ${Bob[likes -> Sally]}]. — (1)
// Query: John[believes -> ${Bob[likes -> Nancy]}]. — (2)


When I load this file into Flora-2 session, I get some warnings about “unsafe” / “singleton” variables. I ignore them. 


In general, one should not ignore them and use _Var to silence the warnings after examining them. In this particular case, one of these warnings actually caught a typo:  ?A should have been ?Head!!


Based on the discussion in the paper that I had referenced in my earlier email, I assumed that the query marked (1) should return “Yes”, whereas (2) should return “No”. However, Flora-2 returns “Yes” for both the queries. How is that?


That's because of the above typo in the last rule.


Also, I don’t understand the use of the variable “?A” in the third rule.


See above.


That said, the rules should have been like this:


John[believes-> ${Bob[likes->?_X] :- Mary[likes->?_X]}].
John[believes-> ${Mary[likes->Sally]}].

John[believes-> ?A] :-
    // block John[believes-> ${A :- B}] from matching the head of this rule
    ?A != ${?_H :- ?_B},
    John[believes-> {${?A :- ?B}, ?B}].


The highlighted part is important: it prevents an infinite structural recursion, as mentioned in the comment.

--

       --- michael


Reply all
Reply to author
Forward
0 new messages