let rec eval f = function | And l -> List.for_all (eval f) l | Or l -> List.exists (eval f) l | Not x -> not (eval f x) | Atom a -> f a | True -> true | False -> false