This is a small package for propositional logic --- it provides a few tools for representing and playing around with propositional logic objects. For now, it contains a parser to build AST trees out of most propositional phrases:
###
>>> import parser
>>> print parser.parse('jack and jill and bill or ted')
or[and[and[jack, jill], bill], ted]
###
as well as a silly algorithm for turning propositions into a set of
states:
###
>>> import algorithm
>>> algorithm.getTrueStates(
... parser.parse('2b or not 2b implies question'))
[{'2b': 'T', 'question': 'T'}, {'2b': 'F', 'question': 'T'}]
###
As you might guess, it's nowhere near done yet. Still, it might
be useful for someone, so I'm putting up my work up before I
forget.
The README in the package has more details about this. I must learn how to properly document Python packages with the doc-sig tools...
propositions-0.4.1.tar.gz 07/16/2002. A quick patch to fix a persistant bug dealing with equality. Who knew copy.deepcopy() could be so dangerous? *grin*
Thanks to Yi Guo for helping me fix this.
propositions-0.4.tar.gz 10/15/2001. More cleanups, and made it friendly with distutils.
Also, I've finally implemented solutions for converting propositions into conjunctive/disjunctive normal forms. I'm quite happy about this, though no one else seems to share my enthusiasm... *grin*
Back to Python.