Re: Internal Error: Invocation Target Exception in funcall of function

Thomas Russ <[email protected]> Wed, 10 Nov 2010 09:23:46 -0800
Newsgroups gmane.comp.ai.powerloom
Message-ID <[email protected]>
On Nov 10, 2010, at 4:42 AM, lee martie wrote:

> Powerloom 4.0.0 beta is giving me an internal error.
>
> Can you tell me if the following error is due to a
> Powerloom bug or if I am doing something incorrectly?

Well, it's a bit of both.  The PowerLoom in the ASK below is not  
correct.  But PowerLoom should print an error message instead of  
breaking.


>
> When running the following commands:
>
> (deffunction lookup ((?x thing)) :-> (?y function))
> (deffunction numVar ((?x thing)) :-> (?y number))
> (assert (= (lookup x) numVar))
> (assert (=(numVar x)20))
> (ask  (forall (?y) (= ((lookup x)x) 20) ) )

The problem you have here is that you are universally quantifying over  
the variable ?Y, but then it doesn't appear in the body of the  
quantification.  Also, universal quantification generally has to  
follow the pattern:

   (forall (?y) (=> (...) (...)))

where there is an implication.  That is because almost anything else  
that is universally quantified will be false, since very few sentences  
hold for every possible binding of the universal variable.  So the  
first clause of the implication is used to restrict the bindings for  
the variable that will need to be considered.

In your case, you could just ask the question directly and you will  
get the answer:

   (ask (= ((lookup x) x) 20))

BTW, I was a bit surprised that we deal with this syntax.  I found  
that the parser and query optimizer doesn't always get this right, so  
for example if you tried

   (retrieve all (= ((lookup ?x) ?x) ?y))

it would fail to find solutions, but re-writing it to

   (retrieve all (and (lookup ?x ?f) (?f ?x ?y)))
or
   (retrieve all (exists ?f (and (lookup ?x ?f) (?f ?x ?y))))
will find them.

-Tom Russ



>
> I get the following error:
>
>>> Internal Error: Invocation Target Exception in funcall of function:
>     public static edu.isi.powerloom.logic.TruthValue
> edu.isi.powerloom.logic.Logic.askEvaluatorWrapper(edu.isi.stella.Cons)
> (((FORALL (?Y) (= (sk05//NUMVAR @X |L|20) |L|20))))
>     java.lang.ArrayIndexOutOfBoundsException: -2147483648
>     -2147483648
> java.lang.ArrayIndexOutOfBoundsException: -2147483648
>     at
> edu 
> .isi 
> .powerloom 
> .logic.PatternVariable.helpBindVariableToValueP(PatternVariable.java: 
> 433)
>     at
> edu 
> .isi 
> .powerloom 
> .logic.PatternVariable.bindVariableToValueP(PatternVariable.java:401)
>     at
> edu 
> .isi 
> .powerloom 
> .logic.ControlFrame.tryUniversalIntroductionProof(ControlFrame.java: 
> 1008)
>     at
> edu 
> .isi 
> .powerloom.logic.ControlFrame.executeProofStrategy(ControlFrame.java: 
> 2502)
>     at
> edu 
> .isi 
> .powerloom 
> .logic.ControlFrame.continueCurrentOrNextStrategy(ControlFrame.java: 
> 2658)
>     at
> edu 
> .isi 
> .powerloom 
> .logic.ControlFrame.continueStrategiesProofs(ControlFrame.java:2776)
>     at
> edu 
> .isi.powerloom.logic.ControlFrame.evaluateNextMove(ControlFrame.java: 
> 4710)
>     at
> edu 
> .isi 
> .powerloom 
> .logic 
> .QueryIterator.executeBackwardChainingProofP(QueryIterator.java:1934)
>     at  
> edu.isi.powerloom.logic.QueryIterator.nextP(QueryIterator.java:1402)
>     at edu.isi.powerloom.logic.Logic.callAsk(Logic.java:16600)
>     at edu.isi.powerloom.logic.Logic.ask(Logic.java:16660)
>     at edu.isi.powerloom.logic.Logic.askEvaluatorWrapper(Logic.java: 
> 16669)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun 
> .reflect 
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at
> sun 
> .reflect 
> .DelegatingMethodAccessorImpl 
> .invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at edu.isi.stella.javalib.Native.funcall(Native.java:566)
>     at edu.isi.stella.Cons.evaluateConsTree(Cons.java:8560)
>     at edu.isi.stella.Stella_Object.evaluate(Stella_Object.java:4968)
>     at edu.isi.powerloom.logic.Logic.evaluateLogicCommand(Logic.java: 
> 31897)
>     at edu.isi.powerloom.logic.Logic.logicCommandLoop(Logic.java: 
> 31793)
>     at edu.isi.powerloom.logic.Logic.powerloom(Logic.java:37844)
>     at edu.isi.powerloom.PowerLoom.main(PowerLoom.java:159)
> edu.isi.stella.StellaException: Invocation Target Exception in funcall
> of function:
>     public static edu.isi.powerloom.logic.TruthValue
> edu.isi.powerloom.logic.Logic.askEvaluatorWrapper(edu.isi.stella.Cons)
> (((FORALL (?Y) (= (sk05//NUMVAR @X |L|20) |L|20))))
>     java.lang.ArrayIndexOutOfBoundsException: -2147483648
>     -2147483648
> java.lang.ArrayIndexOutOfBoundsException: -2147483648
>     at
> edu 
> .isi 
> .powerloom 
> .logic.PatternVariable.helpBindVariableToValueP(PatternVariable.java: 
> 433)
>     at
> edu 
> .isi 
> .powerloom 
> .logic.PatternVariable.bindVariableToValueP(PatternVariable.java:401)
>     at
> edu 
> .isi 
> .powerloom 
> .logic.ControlFrame.tryUniversalIntroductionProof(ControlFrame.java: 
> 1008)
>     at
> edu 
> .isi 
> .powerloom.logic.ControlFrame.executeProofStrategy(ControlFrame.java: 
> 2502)
>     at
> edu 
> .isi 
> .powerloom 
> .logic.ControlFrame.continueCurrentOrNextStrategy(ControlFrame.java: 
> 2658)
>     at
> edu 
> .isi 
> .powerloom 
> .logic.ControlFrame.continueStrategiesProofs(ControlFrame.java:2776)
>     at
> edu 
> .isi.powerloom.logic.ControlFrame.evaluateNextMove(ControlFrame.java: 
> 4710)
>     at
> edu 
> .isi 
> .powerloom 
> .logic 
> .QueryIterator.executeBackwardChainingProofP(QueryIterator.java:1934)
>     at  
> edu.isi.powerloom.logic.QueryIterator.nextP(QueryIterator.java:1402)
>     at edu.isi.powerloom.logic.Logic.callAsk(Logic.java:16600)
>     at edu.isi.powerloom.logic.Logic.ask(Logic.java:16660)
>     at edu.isi.powerloom.logic.Logic.askEvaluatorWrapper(Logic.java: 
> 16669)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun 
> .reflect 
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at
> sun 
> .reflect 
> .DelegatingMethodAccessorImpl 
> .invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at edu.isi.stella.javalib.Native.funcall(Native.java:566)
>     at edu.isi.stella.Cons.evaluateConsTree(Cons.java:8560)
>     at edu.isi.stella.Stella_Object.evaluate(Stella_Object.java:4968)
>     at edu.isi.powerloom.logic.Logic.evaluateLogicCommand(Logic.java: 
> 31897)
>     at edu.isi.powerloom.logic.Logic.logicCommandLoop(Logic.java: 
> 31793)
>     at edu.isi.powerloom.logic.Logic.powerloom(Logic.java:37844)
>     at edu.isi.powerloom.PowerLoom.main(PowerLoom.java:159)
>
>     at edu.isi.stella.javalib.Native.funcall(Native.java:610)
>     at edu.isi.stella.Cons.evaluateConsTree(Cons.java:8560)
>     at edu.isi.stella.Stella_Object.evaluate(Stella_Object.java:4968)
>     at edu.isi.powerloom.logic.Logic.evaluateLogicCommand(Logic.java: 
> 31897)
>     at edu.isi.powerloom.logic.Logic.logicCommandLoop(Logic.java: 
> 31793)
>     at edu.isi.powerloom.logic.Logic.powerloom(Logic.java:37844)
>     at edu.isi.powerloom.PowerLoom.main(PowerLoom.java:159)
>
>
>
>
>
> As always, thanks for your help and time.
> Lee Martie
>
> _______________________________________________
> powerloom-forum mailing list
> [email protected]
> http://mailman.isi.edu/mailman/listinfo/powerloom-forum