Optimize the AST from Instaparse

I solved it, not sure there is a better way but by changing the following line in the parser:

not = ['~'] primary | ['~'] <'('> exp <')'>

I got enough information to update simplify to:

(defn simplify [coll]
  (if (coll? coll)
    (case (first coll)
      :term coll
      :S coll
      :not
      (if (= (count coll) 3)
        [(first coll) (last coll)]
        (second coll))
      (:and :or)
      (if (= (count coll) 2)
        (second coll)
        coll))
    coll))