# Boolean Algebra

A Boolean algebra is a structure (`B`, `and`, `or`, `not`, `0`, `1`) such that, `B` is a non-empty set, `and` and `or` are binary functions from `B`x`B` to `B`, `not` is a unary function from `B` to `B`, and both `0` and `1` are constants which are members of the set `B`. The following laws hold:

• for all `a` in `B`: `a and a = a` - idempotency.
• for all `a` in `B`: `a or a = a` - idempotency.
• for all `a`, `b` in `B`: `a and b = b and a` - commutativity.
• for all `a`, `b` in `B`: `a or b = b or a` - commutativity.
• for all `a`, `b`, `c` in `B`: `a and (b and c) = (a and b) and c` - associativity.
• for all `a`, `b`, `c` in `B`: `a or (b or c) = (a or b) or c` - associativity.
• for all `a`, `b`, `c` in `B`: `a and (b or c) = (a and b) or (a and c)` - distributivity.
• for all `a`, `b`, `c` in `B`: `a or (b and c) = (a or b) and (a or c)` - distributivity.
• for all `a` in `B`: `a and 1 = a` - verum.
• for all `a` in `B`: `a or 1 = 1` - verum.
• for all `a` in `B`: `a and 0 = 0` - falsum.
• for all `a` in `B`: `a or 0 = a` - falsum.

## Example

We can use digital voltage levels and logic gates as the interpretations of the elements of Boolean algebra as follows:

• `B` is the set {low voltage level, high voltage level}.
• `and` is the AND gate.
• `or` is the OR gate.
• `not` is the NOT gate.
• `0` is the low voltage level.
• `1` is the high voltage level.

It can be shown by the logic gate truth tables that this interpretation satisfies the laws of Boolean algebra.