/* dnf.q: This is a tiny example for symbolic expression manipulation. It
transforms logical expressions into disjunctive normal form (DNF).
05-08-1993 AG */
// eliminate double negations:
not not A = A;
// push negations inward (de Morgan's laws):
not (A or B) = not A and not B;
not (A and B) = not A or not B;
// distributivity laws:
A and (B or C) = A and B or A and C;
(A or B) and C = A and C or B and C;
// associativity laws:
A and (B and C) = (A and B) and C;
A or (B or C) = (A or B) or C;