Use xreplace instead of subs in simplify_logic.

Subs had an issue where one predicate of a boolean function was contained
entirely within another predicate of a boolean function (eg. predicates x,
and x+1).  The smaller predicate would sometimes be substituted before the
larger, causing the larger to not be substituted, and potentially causing
the simplification to produce incorrect results.  This appeared to happen
on only some invocations of the interpreter: the added test would sometimes
pass and sometimes fail.

Xreplace instead searches for all predicates simultaneously, matching the
largest predicate that it can in any expression, thereby preventing this
issue.