Re: How to assert that a country has one president

Thomas Russ <[email protected]> Tue, 27 Nov 2007 10:40:14 -0800
Newsgroups gmane.comp.ai.powerloom
Message-ID <[email protected]>
On Nov 27, 2007, at 10:04 AM, Cameron Ross wrote:

> Hello,
>
> We're trying to define an axiom to ensure a singular cardinality as  
> follows:
>
> ;; BEGIN PowerLoom
> (defconcept Person)
> (defconcept Country)
> (defrelation presidentOf ((?p Person) (?c Country)))

The simplest method would be reverse the order of arguments and make  
this a function:

   (deffunction hasPresident ((?c Country) (?p Person)))

This will assure that a country only has one president.  It will also  
enable implicit value clipping so that changing the value doesn't  
require an explicit retraction first.

> (assert (forall (?c ?p1 ?p2)
>                  (=> (and (presidentOf ?p1 ?c)
>                               (presidentOf ?p2 ?c))
>                        (= ?p1 ?p2))))

This rule will not necessarily do what you expect it to do.  If you  
were to assert

   (presidentOf John Freedonia)
   (presidentOf Bill Freedonia)

this rule will then result in the inference that

    (= Bill John)

so that henceforth these two individuals will be considered the  
same.  PowerLoom uses a unique name assumption (unlike OWL, for  
example), but that is just an assumption and can be overcome with an  
explicit assertion or an inference.  You would have to make sure that  
all instances are asserted to be different from one another in order  
to force a contradiction.  (I will note that PowerLoom is not always  
very aggressive in noticing such clashes, though).

Right off the top of my head, I can't think of a rule-based solution,  
although there probably is one.

>
> ;; END PowerLoom
>
>
>
> The following error results when the above are entered into the  
> PowerLoom command prompt:

This is, of course, a bug.  It shouldn't break.

>
>  Internal Error: OOPS -- BUG IN 'copy- 
> description'edu.isi.stella.StellaException: OOPS -- BUG IN 'copy- 
> description'
>       at edu.isi.powerloom.logic.Logic.copyPropositionArgument 
> (Logic.java:29501)
>       at edu.isi.powerloom.logic.Proposition.copyProposition 
> (Proposition.java:635)
>       at edu.isi.powerloom.logic.Logic.copyPropositionArgument 
> (Logic.java:29480)
>       at edu.isi.powerloom.logic.Proposition.copyProposition 
> (Proposition.java:635)
>       at edu.isi.powerloom.logic.Logic.copyPropositionArgument 
> (Logic.java:29480)
>       at edu.isi.powerloom.logic.Proposition.copyProposition 
> (Proposition.java:635)
>       at  
> edu.isi.powerloom.logic.Proposition.createForwardChainingIndex 
> (Proposition.java:4578)
>       at  
> edu.isi.powerloom.logic.Proposition.deriveComplexForwardRule 
> (Proposition.java:4571)
>       at edu.isi.powerloom.logic.Proposition.deriveOneSatelliteRule 
> (Proposition.java:4954)
>       at  
> edu.isi.powerloom.logic.Proposition.deriveSatelliteRulesForGoalP 
> (Proposition.java:4886)
>       at edu.isi.powerloom.logic.Proposition.deriveSatelliteRules 
> (Proposition.java:4796)
>       at edu.isi.powerloom.logic.Proposition.runGoesTrueDemons 
> (Proposition.java:11617)
>       at  
> edu.isi.powerloom.logic.Proposition.updateLinksAndTimestamps 
> (Proposition.java:11492)
>       at edu.isi.powerloom.logic.Proposition.assignTruthValue 
> (Proposition.java:11469)
>       at  
> edu.isi.powerloom.logic.Proposition.updatePropositionTruthValue 
> (Proposition.java:11277)
>       at  
> edu.isi.powerloom.logic.Proposition.helpUpdateTopLevelProposition 
> (Proposition.java:9493)
>       at edu.isi.powerloom.logic.Logic.updateTopLevelProposition 
> (Logic.java:9231)
>       at edu.isi.powerloom.logic.Logic.updateProposition(Logic.java: 
> 9260)
>       at edu.isi.powerloom.logic.Logic.smartUpdateProposition 
> (Logic.java:9406)
>       at edu.isi.powerloom.logic.Logic.renamed_Assert(Logic.java:9427)
>       at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown  
> Source)
>       at java.lang.reflect.Method.invoke(Unknown Source)
>       at edu.isi.stella.javalib.Native.funcall(Native.java:608)
>       at edu.isi.stella.Stella.apply(Stella.java:8401)
>       at edu.isi.stella.Cons.evaluateConsTree(Cons.java:8355)
>       at edu.isi.stella.Stella_Object.evaluate(Stella_Object.java: 
> 4351)
>       at edu.isi.powerloom.logic.Logic.evaluateLogicCommand 
> (Logic.java:31552)
>       at edu.isi.powerloom.logic.Logic.logicCommandLoop(Logic.java: 
> 31448)
>       at edu.isi.powerloom.logic.Logic.powerloom(Logic.java:37358)
>       at edu.isi.powerloom.PowerLoom.main(PowerLoom.java:108)
>
> Any advice is greatly appreciated.
> Cameron Ross.
>
> _______________________________________________
> powerloom-forum mailing list
> [email protected]
> http://mailman.isi.edu/mailman/listinfo/powerloom-forum