add 'isNegated' method and 'insertGate' function . close #153