- python (version 3.7.1+). It may be possible to run the code in previous versions, however not all functionality is guaranteed. See https://www.python.org for download instructions if python is not installed.
There is no main funciton that runs our belief revision engine. The belief revision engine is primarily a module to import using either a python script or the python interpreter. The module should be imported as follows:
from belief_revision_engine import cnf,belief_base,entails,expand,contract,revise
An example file has been provided - example.py
- demonstrating the proper use of the module's functions. Only functions included in belief_revision_engine.py
should be used; internal functions of any classes are not intended to be accessed by the user. There are comments at the beginning of each function detailing their behavior. The functions are restated for redundancy here.
s
- propositional logic sentence- Converts a propositional sentence to Conjunctive Normal Form.
- Does not function correctly for all inputs
s
(optional) - propositional logic sentence in cnf- Returns an instance of BeliefBase with
s
as the only held belief.
b
- belief bases
- propositional logic sentence in cnf- Return true or false if
b
entailss
.
b
- belief bases
- propositional logic sentence in cnf- Expand
b
withs
. Does not remove contradictions. Returns None.
b
- belief bases
- propositional logic sentence in cnfmode
- type of contraction ('partial-meet' (default), 'full-meet', 'maxichoice')- Contract
s
fromb
; remove all beliefs fromb
that entails
. Returns None.
b
- belief bases
- propositional logic sentence in cnfmode
- type of contraction ('partial-meet' (default), 'full-meet', 'maxichoice')- Revises
b
withs
; remove all beliefs fromb
that entail nots
, then expandb
withs
.
These functions can be used to formulate all aspects of a belief revision engine. If at any point the belief base needs to be displayed to the command line, python's default print
function is used. Additionally, the BeliefBase class plays nice with the ==
and !=
operator for easy comparison.
We used the following symbols to represent propositional logic in our implementation of a belief revision engine:
Symbol | Operation |
---|---|
^ |
AND |
v |
OR |
~ |
NOT |
-> |
IMPLIES |
<-> |
BICONDITIONAL |
Note: It is imperative that parenthesis are used appropriately when using our cnf conversion tool. Statements like p->q->r
are ambigious and are undefined in our engine. This should be replaced with (p->q)->r
or p->(q->r)
.