Simplification of logic