It was related to a bug spotted while implementing the DBZ code.

This one was just realising that NOT(NOT(x)) is only == x is x is a boolean.

The code at the bottom is checking that NOT (decimal) is actually generated as (NOT((bool)decimal)) - since the argument to not should be a boolean.