1 (***********************************************************************)
5 (* Kim Nguyen, LRI UMR8623 *)
6 (* Université Paris-Sud & CNRS *)
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 *)
14 (***********************************************************************)
16 (** Implementation of hashconsed Boolean formulae *)
18 type move = [ `Left | `Right | `Epsilon | `Up1 | `Up2 ]
20 (** Direction for automata predicates *)
25 | Or of 'formula * 'formula
26 | And of 'formula * 'formula
27 | Move of (move * bool * State.t)
30 (** View of the internal representation of a formula,
31 used for pattern matching *)
35 (** Abstract type representing hashconsed formulae *)
38 (** Hash function for formulae *)
41 (** Returns a unique ID for formulae *)
43 val equal : t -> t -> bool
44 (** Equality over formulae *)
46 val expr : t -> t expr
47 (** Equality over formulae *)
49 (*val st : t -> StateSet.t * StateSet.t
50 (** states occuring left and right, positively or negatively *)
53 val compare : t -> t -> int
54 (** Comparison of formulae *)
56 val print : Format.formatter -> t -> unit
59 val is_true : t -> bool
60 (** [is_true f] tests whether the formula is the atom True *)
62 val is_false : t -> bool
63 (** [is_false f] tests whether the formula is the atom False *)
71 val atom_ : move -> bool -> StateSet.elt -> t
72 (** [atom_ dir b q] creates a down_left or down_right atom for state
73 [q]. The atom is positive if [b == true].
78 val and_ : t -> t -> t
79 (** Boolean connective *)
81 val of_bool : bool -> t
82 (** Convert an ocaml Boolean value to a formula *)
85 val ( +| ) : t -> t -> t
86 val ( *& ) : t -> t -> t
87 val ( *+ ) : move -> StateSet.elt -> t
88 val ( *- ) : move -> StateSet.elt -> t
90 (** Module to facilitate infix notations of formulae.
91 Just [open Formla.Infix] and write:
92 [let f = `Left *+ q1 +| `Right *+ q2 in ...]