Sanitize the representation of formula
[tatoo.git] / src / ata.mli
1 (***********************************************************************)
2 (*                                                                     *)
3 (*                               TAToo                                 *)
4 (*                                                                     *)
5 (*                     Kim Nguyen, LRI UMR8623                         *)
6 (*                   Université Paris-Sud & CNRS                       *)
7 (*                                                                     *)
8 (*  Copyright 2010-2013 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 type move = [ `First_child
17             | `Next_sibling
18             | `Parent
19             | `Previous_sibling
20             | `Stay ]
21
22 type predicate = Move of move * State.t
23                  | Is_first_child
24                  | Is_next_sibling
25                  | Is of Tree.NodeKind.t
26                  | Has_first_child
27                  | Has_next_sibling
28
29 val is_move : predicate -> bool
30
31 module Atom : Boolean.ATOM with type data = predicate
32
33 module Formula :
34   sig
35     include module type of Boolean.Make(Atom)
36     val mk_atom : predicate -> t
37     val mk_kind : Tree.NodeKind.t -> t
38     val has_first_child : t
39     val has_next_sibling : t
40     val is_first_child : t
41     val is_next_sibling : t
42     val is_attribute : t
43     val is_element : t
44     val is_processing_instruction : t
45     val is_comment : t
46     val first_child : State.t -> t
47     val next_sibling : State.t -> t
48     val parent : State.t -> t
49     val previous_sibling : State.t -> t
50     val stay : State.t -> t
51     val get_states : t -> StateSet.t
52   end
53
54
55 module Transition : Hcons.S with
56             type data = State.t * QNameSet.t * Formula.t
57
58 module TransList : sig
59   include Hlist.S with type elt = Transition.t
60   val print : Format.formatter -> ?sep:string -> t -> unit
61 end
62
63
64 type node_summary = private int
65 val node_summary : bool -> bool -> bool -> bool -> Tree.NodeKind.t -> node_summary
66 val dummy_summary : node_summary
67 type config = {
68   sat : StateSet.t;
69   unsat : StateSet.t;
70   todo : TransList.t;
71   summary : node_summary;
72 }
73
74 module Config : Hcons.S with type data = config
75 val dummy_config : Config.t
76
77 type t = private {
78   id : Uid.t;
79   mutable states : StateSet.t;
80   mutable selection_states: StateSet.t;
81   transitions: (State.t, (QNameSet.t*Formula.t) list) Hashtbl.t;
82   mutable cache2 : TransList.t Cache.N2.t;
83   mutable cache4 : Config.t Cache.N4.t;
84 }
85
86
87
88 val create : StateSet.t -> StateSet.t -> t
89 val reset : t -> unit
90 val full_reset : t -> unit
91 val get_trans : t -> QNameSet.elt -> StateSet.t -> TransList.t
92
93
94 val eval_trans : t -> Config.t -> Config.t -> Config.t -> Config.t -> Config.t
95
96 val add_trans : t -> State.t -> QNameSet.t -> Formula.t -> unit
97 val print : Format.formatter -> t -> unit
98 val complete_transitions : t -> unit
99 val cleanup_states : t -> unit
100 val normalize_negations : t -> unit