Distinguishing Between ANDed and ORed Premises

60 views
Skip to first unread message

Chris

unread,
Dec 12, 2009, 9:46:23 PM12/12/09
to PyKE
How do you differentiate between ANDed and ORed premises in Pyke,
especially with negation?

For example, how would I represent the following rule?

"Combine ingredients A and B if A is not vinegar and B is not baking
soda."

After reading through the docs, the closest thing I could come up with
is:

combine_ingredients
foreach
ingredients($A,$B)
notany
is($A,vinegar)
is($B,baking_soda)
assert
combine($A,$B)

However, I'm not clear how multiple statements under the notany
keyword are interpreted. I'm assuming they're ORed, which means that
that representation would not fire for the statement ingredients
(vinegar,vinegar), even though it should.

Bruce Frederiksen

unread,
Dec 13, 2009, 6:29:36 PM12/13/09
to py...@googlegroups.com
Multiple clauses under a notany are AND-ed (like multiple clauses everywhere else). 

  notany
    clause_A
    clause_B

means that there is "not any" proof for "clause_A and clause_B".

So the rule that you have should do what you want.  (And, as stated, would combine baking soda with vinegar, just not the other way around).

Two things that you might consider with this example.

First, if the ingredients don't conceptually come in pairs you could use one list of single ingredients twice.  Second, you could use a check clause with Python's != operator:

combine_ingredients
  foreach
    ingredient($A)
    check $A != 'vinegar'
    ingredient($B)
    check $B != 'baking_soda'
  assert
    combine($A, $B)


--

You received this message because you are subscribed to the Google Groups "PyKE" group.
To post to this group, send email to py...@googlegroups.com.
To unsubscribe from this group, send email to pyke+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyke?hl=en.



Reply all
Reply to author
Forward
0 new messages