1 (***********************************************************************)
4 (* Nicolas Pouillard, Berke Durak, projet Gallium, INRIA Rocquencourt *)
6 (* Copyright 2007 Institut National de Recherche en Informatique et *)
7 (* en Automatique. All rights reserved. This file is distributed *)
8 (* under the terms of the Q Public License version 1.0. *)
10 (***********************************************************************)
13 (* Original author: Berke Durak *)
16 type 'a boolean = And of 'a boolean list | Or of 'a boolean list | Not of 'a boolean | Atom of 'a | True | False;;
18 let rec eval f = function
19 | And l -> List.for_all (eval f) l
20 | Or l -> List.exists (eval f) l
21 | Not x -> not (eval f x)
26 let rec iter f = function
27 | (And l|Or l) -> List.iter (iter f) l
32 let rec map f = function
33 | And l -> And(List.map (map f) l)
34 | Or l -> Or(List.map (map f) l)
35 | Not x -> Not(map f x)
37 | (True|False) as b -> b