Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in the transformation of row variables #22

Open
arademaker opened this issue Sep 27, 2019 · 3 comments
Open

bug in the transformation of row variables #22

arademaker opened this issue Sep 27, 2019 · 3 comments

Comments

@arademaker
Copy link
Member

We have a serious bug in the transformation of the axiom:

(=>
   (exhaustiveDecomposition @ROW)
   (=>
      (inList ?ELEMENT (ListFn @ROW))
      (instance ?ELEMENT Class)))

This axiom is transformed into the following FOL code where ?ROW1 should be the ?CLASS:

/*
(forall (?CLASS ?ROW0 ?ROW1)
 (forall (?OBJ)
  (exists (?ITEM)
   (and (instance ?ITEM SetOrClass)
    (=> (instance ?OBJ Entity)
     (=>
      (and (instance ?ROW0 Entity) (instance ?CLASS SetOrClass)
       (instance ?ROW1 Entity))
      (=> (exhaustiveDecomposition2 ?CLASS ?ROW0)
       (=> (instance ?OBJ ?CLASS)
        (and (inList ?ITEM (ListFn2 ?ROW0 ?ROW1)) (instance ?OBJ ?ITEM))))))))))
*/
fof(a67962,axiom,! [CLASS,ROW0,ROW1] : (! [OBJ] : (? [ITEM] : ((s_instance(ITEM, s_SetOrClass) & (s_instance(OBJ, s_Entity) => ((s_instance(ROW0, s_Entity) & s_instance(CLASS, s_SetOrClass) & s_instance(ROW1, s_Entity)) => (s_exhaustiveDecomposition2(CLASS, ROW0) => (s_instance(OBJ, CLASS) => (s_inList(ITEM, s_ListFn2(ROW0, ROW1)) & s_instance(OBJ, ITEM)))))))))))
@fcbr
Copy link
Member

fcbr commented Sep 27, 2019

I recommend using save-passes to save each pass of the transformation to help narrow down the bug: https://github.com/own-pt/cl-krr/blob/master/suo-kif.lisp#L641

@arademaker
Copy link
Member Author

arademaker commented Sep 27, 2019

The bug in the transformation is a fact. But the axiom above is wrong in SUMO so I have changed it to:

(=>
   (exhaustiveDecomposition ?CLASS @ROW)
   (forall (?OBJ)
      (=>
         (instance ?OBJ ?CLASS)
         (exists (?ITEM)
            (and
               (inList ?ITEM (ListFn @ROW))
               (instance ?OBJ ?ITEM))))))

But we still have clearly a bug, see the extra row2 variable below:

/*
(forall (?ROW1 ?ROW0 ?CLASS ?ROW2)
 (forall (?OBJ)
  (exists (?ITEM)
   (and (instance ?ITEM SetOrClass)
    (=> (instance ?OBJ Entity)
     (=>
      (and (instance ?CLASS SetOrClass) (instance ?CLASS Class)
       (instance ?ROW1 Class) (instance ?ROW1 Entity) (instance ?ROW0 Class)
       (instance ?ROW0 Entity) (instance ?ROW2 Entity))
      (=> (exhaustiveDecomposition3 ?CLASS ?ROW0 ?ROW1)
       (=> (instance ?OBJ ?CLASS)
        (and (inList ?ITEM (ListFn3 ?ROW0 ?ROW1 ?ROW2))
         (instance ?OBJ ?ITEM))))))))))
*/
fof(a67115,axiom,! [ROW1,ROW0,CLASS,ROW2] : (! [OBJ] : (? [ITEM] : ((s_instance(ITEM, s_SetOrClass) & (s_instance(OBJ, s_Entity) => ((s_instance(CLASS, s_SetOrClass) & s_instance(CLASS, s_Class) & s_instance(ROW1, s_Class) & s_instance(ROW1, s_Entity) & s_instance(ROW0, s_Class) & s_instance(ROW0, s_Entity) & s_instance(ROW2, s_Entity)) => (s_exhaustiveDecomposition3(CLASS, ROW0, ROW1) => (s_instance(OBJ, CLASS) => (s_inList(ITEM, s_ListFn3(ROW0, ROW1, ROW2)) & s_instance(OBJ, ITEM))))))))))).

@arademaker
Copy link
Member Author

arademaker commented Dec 21, 2019

moreover, universal and existential row variables should have different transformations. Consider

(instance foo VariableArityRelation)
(forall (@row) (foo @row))
(exists (@row) (foo @row))

The intuition is that universal means:

(AND (foo0)
    (forall (?x1)(foo1 ?x1))
    (forall (?x1 ?x2)(foo2 ?x1 ?x2))
    (forall (?x1 ?x2 ?x3) (foo3 ?x1 ?x2 ?x3))
    ...)

But existential should be

(OR (foo0)
    (exists (?x1)(foo1 ?x1))
    (exists (?x1 ?x2)(foo2 ?x1 ?x2))
    (exists (?x1 ?x2 ?x3) (foo3 ?x1 ?x2 ?x3))
   ...)

Of course, the AND resulting axiom can be split into top-level axioms of the theory, but not the OR. These intuitions are actually made formal by http://www.w3c.hu/forditasok/RDF/cached/HayesMenzel-SKIF-IJCAI2001.pdf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants