SourceForge has been redesigned. Learn more.
Close

#88 oclingo: unsafe variables message

v3.x
wont-fix
None
1
2014-04-24
2013-08-22
No

We invoke the following command with oclingo and we get the command that appears below:

dhcp-64-103-84-154:oclingo dmagka$ oclingo dpal/cp_base.lp dpal/o_transforms.lp --imax=9 0 &
[1] 7711
dhcp-64-103-84-154:oclingo dmagka$
ERROR: unsafe variables in:
dpal/o_transforms.lp:4:1: c(X):-a(X),r(X,Y),b(Y).
dpal/o_transforms.lp:4:11: X
dpal/o_transforms.lp:4:19: Y

Why are X and Y considered unsafe since they both occur in the positive body of the rule?
This is in contrast with what potasco guide says "gringo expects rules to be safe, i.e., all variables that appear in a rule have to appear in some positive literal (a literal not preceded by not) in the body".

Files cp_base.lp and o_transforms.lp attached.

2 Attachments

Discussion

  • Philipp Obermeier

    The way you encoded the rule still left the domains of the external atoms undefined. To guarantee safety you could rewrite the program as shown in enc.lp (attached). This encoding would then take an input stream like stream.str (also attached) and produce the desired result.

    • Invocation oclingo: oclingo enc.lp
    • Invocation controller: controller.py stream.str
    • Output Controller:
        Got input:
        #step 1.
        a(0).
        b(1).
        r(0,1).
        #endstep.
    
        Answer: 1
          0.  a(0)  a_dom(0)  c(0)    
          1.  b(1)  b_dom(1)  r(0,1)  r_dom(0,1)  
        Got input:
        #stop.
    
     
  • Roland Kaminski

    Roland Kaminski - 2013-08-29
    • assigned_to: Philipp Obermeier
     
  • Roland Kaminski

    Roland Kaminski - 2014-04-24

    oclingo development is discontinued - please switch to clingo-4

     
  • Roland Kaminski

    Roland Kaminski - 2014-04-24
    • status: open --> wont-fix
     
  • Roland Kaminski

    Roland Kaminski - 2014-04-24
     
  • Roland Kaminski

    Roland Kaminski - 2014-04-24

    oclingo development is discontinued - please switch to clingo-4

     

Log in to post a comment.