32leaves.net

Reasoner – Playing with boolean expressions

One of my lectures deals with mathematical logic. In order to play around with this highly interessting topic I wrote a small program dealing with this. The program is able to

  • compute thruth tables
  • evaluate expressions with custom input
  • render syntax graphs
  • check if an expression is satisfiable or a tautology
  • Normalize expressions to CNF or DNF

The following operators are allowed:

  • &

    : AND

  • |

    : OR

  • ->

    : SUBJUNCTION

  • <->

    : BIJUNCTION

  • !

    : NOT

You may use lower case characters suffixed with integer numbers (e.g.

a, b, c2, d-3

)

Example:

1
2
3
4
5
/**
 * This is just a test
 */

(((a & b ) -> ((c | (a & c)) <-> d)) & a) <-> (a & (a <-> (b | c)))

Be aware that as I’m just beginning diving into this field all algorithms implemented in this application are NP complete. Meaning that the time it takes to compute certain things grows exponentially to the amount of distinct atoms (e.g. computing a truth tabe for

1
a & b

is way faster than for

1
a & b & c & d & e & f & g & h & i & j & k & l & m & n & o & p & q & r & s & t & u & v & w & x & y & z

which produces 67108864 rows).
The program runs on Windows, MacOSX and Linux. Alltough I didn’t test Windows (cauz’ I don’t have that “operating system” running anywhere). I’ll publish the binaries and source as soon as I have access to the University network tomorrow (where I have enough space left to do so).

Demo Video

One Response to “Reasoner – Playing with boolean expressions”

  1. Marco says:

    Very nice! By the way … works great ok Win32! Only the highlighter has a little cosmetic bug (with comments).

    Your tool is very nice ;-)

Leave a Reply

Fork me on GitHub