CNF conversion function, not sure if it is correct however..