def simplify
      if children.length == 1
        # AND or OR constructs do nothing if they only have one operand
        # So remove the logal operator from the AST by simply using the opeand
        return children.first.simplify
      else
        # nested AND or OR constructs can be combined into one construct
        @children = children.map { |c| c.simplify }.map { |c| self.compatible_with(c) ? c.children : c }.flatten
        return self
      end
    end
def simplify
      if children.length == 1
        # AND or OR constructs do nothing if they only have one operand
        # So remove the logal operator from the AST by simply using the opeand
        return children.first.simplify
      else
        # nested AND or OR constructs can be combined into one construct
        @children = children.map { |c| c.simplify }.map { |c| self.compatible_with(c) ? c.children : c }.flatten
        return self
      end
    end
Simplifies nested AND and OR constructs to single constructs with multiple arguments:
 e.g. (a AND (b AND c)) -> (a AND b AND c)