e446c8a2c50e159a2af23266b6db5444262c7b9c
[SXSI/xpathcomp.git] / ata.mli
1 (* module Ptset : sig
2   include Set.S with type elt = int
3   val from_list : elt list -> t
4  end
5 *)
6
7 type state = int
8 val mk_state : unit -> state
9
10 type predicate = [ `Left of (Tree.Binary.t -> bool) | `Right of (Tree.Binary.t -> bool) |
11                        `True
12                  ]
13
14
15 val eval_pred : Tree.Binary.t -> predicate -> bool
16
17 type formula_expr =
18     False
19   | True
20   | Or of formula * formula
21   | And of formula * formula
22   | Atom of ([ `Left | `Right ] * bool * state)
23 and formula = { fid : int; pos : formula_expr; neg : formula; st : Ptset.t*Ptset.t; size: int;}
24 val true_ : formula
25 val false_ : formula
26 val atom_ : [`Left | `Right ] -> bool -> state -> formula
27 val and_ : formula -> formula -> formula
28 val or_ : formula -> formula -> formula
29 val not_ : formula -> formula 
30 val equal_form : formula -> formula -> bool
31 val pr_frm : Format.formatter -> formula -> unit
32
33
34 module HTagSet : Hashtbl.S with type key = Ptset.t*Tag.t
35
36 type t = {
37   id : int;
38   mutable states : Ptset.t;
39   init : Ptset.t;
40   mutable final : Ptset.t;
41   universal : Ptset.t;
42   phi : (state,(TagSet.t*(bool*formula*predicate)) list) Hashtbl.t;
43   delta : (state*Tag.t, (bool*formula*predicate)) Hashtbl.t;
44 (*  delta : (state,(bool*formula*predicate) TagMap.t) Hashtbl.t; *)
45   sigma : (bool*formula*(predicate list*predicate list)*bool) HTagSet.t;
46
47 }
48 val dump : Format.formatter -> t -> unit
49     
50 module Transitions : sig
51 type t = state*TagSet.t*bool*formula*predicate
52 (* Doing this avoid the parenthesis *)
53 val ( ?< ) : state -> state 
54 val ( >< ) : state -> TagSet.t*bool -> state*(TagSet.t*bool*predicate)
55 val ( ><@ ) : state -> TagSet.t*bool*predicate -> state*(TagSet.t*bool*predicate)
56 val ( >=> ) : state*(TagSet.t*bool*predicate) -> formula -> t
57 val ( +| ) : formula -> formula -> formula
58 val ( *& ) : formula -> formula -> formula
59 val ( ** ) : [`Left | `Right ] -> state -> formula
60
61 end
62 type transition = Transitions.t
63 val equal_trans : transition -> transition -> bool
64
65 module TS : sig
66   type t
67   val empty : t
68   val cons : Tree.Binary.t -> t -> t
69   val append : Tree.Binary.t -> t -> t
70   val concat : t -> t -> t
71   val to_list_rev : t -> Tree.Binary.t list
72   val length  : t -> int
73   val iter : (Tree.Binary.t -> unit) -> t -> unit
74 end
75
76 module BottomUpNew : 
77 sig
78   val run : t -> Tree.Binary.t -> TS.t
79 end