I write a small logical expression calculator (Boulev algebra)

You need to store a simplification of a logical expression (an example of here ).

There is a syntax tree of expression (leaves – operands (constants and variables), branches – operations) There is a task to make simplification of expressions as it makes a person (with explanations of each step) (an example in the attached screenshot).

Now there are only an idea to describe all the rules of replacement (all sorts of de Morgan laws and the like) and coming down the tree from the bottom to sort out these rules

## Answer 1, Authority 100%

I see what you do not have: no commutative, distributiveness and canonization of expression. But the idempotency was found early – first simply commutative operation or for four operands.

The constants of the truth and lies and the laws associated with them will be required.

For translated expressions of the specified type, it is possible to calculate the truth table for 4 values, build on it SDNF and simplify (and better, “learn” the table on the “Cheat Sheet”).