开发者

Looking for a good boolean algebra library

I'm writing a tool that deals with some boolean algebra. It's basically a tool to create a state machine based on a user-defined file that contains state names, conditions, and transition information. The method by which state transitions occur is to basically look at a boolean logic table. e.g. transition from State1 to State2 if:

(A & B) | (C & ~D) | (E)

I've got this all implemented, but now I need to add the ability to do some fun stuff like inverting the whole shebang:

~((A & B) | (C & ~D) | (E)) = (via DeMorgan) (~A & ~C & ~E) | (~A & D & ~E) | (~B & ~C & ~E) | (~B & D & ~E)

The result must be in Disjunctive Normal Form.

Basically, I don't want to write this myself and I'm hoping there's a library somewhere that knows how to deal with stuff like this. I've come across SymPy, but I'm not sure if there is a boolean algebra module.

开发者_运维问答

My app is written in C (probably shouldn't be), but anything will help.


Rather than incorporate code, I found a few great applications that are free for any use (via the University of California). A tool called Logic Friday has a nice front end to a few other applications: misii and espresso (included in the install), that perform symbolic Boolean algebra.

There isn't a great command line interface, but you can pass files around to do the job. This performs the minimization I was looking for.


You can try out this open source project, although its not a library you can just copy the Boolean Algebra Class to add to your project

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜