Just a few further remarks, - partition requires the import of Data.List - with an import of Data.Maybe, assign can be much shorter stated as assign (atom,value) formula = catMaybes (map (assignClause (atom,value)) formula)