Add a bullet symbol.
[tatoo.git] / src / formula.mli
1 (***********************************************************************)
2 (*                                                                     *)
3 (*                               TAToo                                 *)
4 (*                                                                     *)
5 (*                     Kim Nguyen, LRI UMR8623                         *)
6 (*                   Université Paris-Sud & CNRS                       *)
7 (*                                                                     *)
8 (*  Copyright 2010-2012 Université Paris-Sud and Centre National de la *)
9 (*  Recherche Scientifique. All rights reserved.  This file is         *)
10 (*  distributed under the terms of the GNU Lesser General Public       *)
11 (*  License, with the special exception on linking described in file   *)
12 (*  ../LICENSE.                                                        *)
13 (*                                                                     *)
14 (***********************************************************************)
15
16 module type ATOM =
17 sig
18   type t
19   val neg : t -> t
20   include Hcons.Abstract with type t := t
21   include Common_sig.Printable with type t := t
22 end
23
24 type ('formula,'atom) expr =
25   | False
26   | True
27   | Or of 'formula * 'formula
28   | And of 'formula * 'formula
29   | Atom of 'atom
30
31 (** View of the internal representation of a formula,
32     used for pattern matching *)
33
34 module Make(P : ATOM) :
35 sig
36   type t
37
38   (** Abstract type representing hashconsed formulae *)
39
40   val hash : t -> int
41   (** Hash function for formulae *)
42
43   val uid : t -> Uid.t
44   (** Returns a unique ID for formulae *)
45
46   val equal : t -> t -> bool
47   (** Equality over formulae *)
48
49   val expr : t -> (t,P.t) expr
50   (** Return a view of the formulae *)
51
52   val compare : t -> t -> int
53   (** Comparison of formulae *)
54
55   val print : Format.formatter -> t -> unit
56   (** Pretty printer *)
57
58   val is_true : t -> bool
59   (** [is_true f] tests whether the formula is the atom True *)
60
61   val is_false : t -> bool
62   (** [is_false f] tests whether the formula is the atom False *)
63
64   val true_ : t
65   (** Atom True *)
66
67   val false_ : t
68   (** Atom False *)
69
70   val atom_ : P.t -> t
71   (** [atom_ dir b q] creates a down_left or down_right atom for state
72       [q]. The atom is positive if [b == true].
73   *)
74
75   val not_ : t -> t
76   val or_ : t -> t -> t
77   val and_ : t -> t -> t
78   (** Boolean connective *)
79
80   val of_bool : bool -> t
81   (** Convert an ocaml Boolean value to a formula *)
82
83   val fold : (t -> 'a -> 'a) -> t -> 'a -> 'a
84   (** [fold f phi acc] folds [f] over the formula structure *)
85
86 end