374beb271372e8f1225c76cd19b9057ed863bfa6
[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 (*
17   Time-stamp: <Last modified on 2013-04-18 16:25:35 CEST by Kim Nguyen>
18 *)
19
20 type predicate =
21     First_child
22   | Next_sibling
23   | Parent
24   | Previous_sibling
25   | Stay
26   | Is_first_child
27   | Is_next_sibling
28   | Is of Tree.NodeKind.t
29   | Has_first_child
30   | Has_next_sibling
31
32 val is_move : predicate -> bool
33
34 type atom = predicate * bool * State.t
35
36 module Atom : Formula.ATOM with type data = atom
37
38 module SFormula :
39   sig
40     include module type of Formula.Make(Atom)
41     val mk_atom : predicate -> bool -> State.t -> t
42     val mk_kind : Tree.NodeKind.t -> t
43     val has_first_child : t
44     val has_next_sibling : t
45     val is_first_child : t
46     val is_next_sibling : t
47     val is_attribute : t
48     val is_element : t
49     val is_processing_instruction : t
50     val is_comment : t
51     val first_child : State.t -> t
52     val next_sibling : State.t -> t
53     val parent : State.t -> t
54     val previous_sibling : State.t -> t
55     val stay : State.t -> t
56     val get_states : t -> StateSet.t
57   end
58
59
60 module Transition : Hcons.S with
61             type data = State.t * QNameSet.t * SFormula.t
62
63 module TransList : sig
64   include Hlist.S with type elt = Transition.t
65   val print : Format.formatter -> ?sep:string -> t -> unit
66 end
67
68
69 type t = private {
70   id : Uid.t;
71   mutable states : StateSet.t;
72   mutable selection_states: StateSet.t;
73   transitions: (State.t, (QNameSet.t*SFormula.t) list) Hashtbl.t;
74   mutable cache2 : TransList.t Cache.N2.t;
75   mutable cache6 : (TransList.t*StateSet.t) Cache.N6.t;
76 }
77
78
79
80 val create : StateSet.t -> StateSet.t -> t
81 val reset : t -> unit
82 val get_trans : t -> QNameSet.elt -> StateSet.t -> TransList.t
83
84 val eval_trans : t -> TransList.t
85   -> StateSet.t -> StateSet.t -> StateSet.t -> StateSet.t
86   -> bool -> bool -> bool -> bool -> Tree.NodeKind.t
87   -> TransList.t*StateSet.t
88
89 type config = {
90   sat : StateSet.t;
91   unsat : StateSet.t;
92   todo : TransList.t;
93 }
94
95 val eq_config : config -> config -> bool
96
97 val eval_trans2 : t -> config -> config -> config -> config
98   -> bool -> bool -> bool -> bool -> Tree.NodeKind.t
99   -> config
100
101
102 val add_trans : t -> State.t -> QNameSet.t -> SFormula.t -> unit
103 val print : Format.formatter -> t -> unit
104 val complete_transitions : t -> unit
105 val cleanup_states : t -> unit
106 val normalize_negations : t -> unit