changed commutative formulas to n-ary instead of binary; also preventing duplicate subformulas