Merged from branch stable-succint-refactor
[SXSI/xpathcomp.git] / ata.mli
diff --git a/ata.mli b/ata.mli
index f5e2c4f..e446c8a 100644 (file)
--- a/ata.mli
+++ b/ata.mli
@@ -1,17 +1,29 @@
+(* module Ptset : sig
+  include Set.S with type elt = int
+  val from_list : elt list -> t
+ end
+*)
+
 type state = int
 val mk_state : unit -> state
 
-type predicate = Ptset.t*Ptset.t -> Tree.Binary.t ->  [ `True | `False | `Maybe ]
+type predicate = [ `Left of (Tree.Binary.t -> bool) | `Right of (Tree.Binary.t -> bool) |
+                      `True
+                ]
+
+
+val eval_pred : Tree.Binary.t -> predicate -> bool
+
 type formula_expr =
     False
   | True
   | Or of formula * formula
   | And of formula * formula
-  | Atom of ([ `Left | `Right ] * bool * state * predicate option)
-and formula = { fid : int; pos : formula_expr; neg : formula; st : Ptset.t*Ptset.t;}
+  | Atom of ([ `Left | `Right ] * bool * state)
+and formula = { fid : int; pos : formula_expr; neg : formula; st : Ptset.t*Ptset.t; size: int;}
 val true_ : formula
 val false_ : formula
-val atom_ : ?pred:predicate option -> [`Left | `Right ] -> bool -> state -> formula
+val atom_ : [`Left | `Right ] -> bool -> state -> formula
 val and_ : formula -> formula -> formula
 val or_ : formula -> formula -> formula
 val not_ : formula -> formula 
@@ -19,26 +31,29 @@ val equal_form : formula -> formula -> bool
 val pr_frm : Format.formatter -> formula -> unit
 
 
-type property = [ `None | `Existential  ]
+module HTagSet : Hashtbl.S with type key = Ptset.t*Tag.t
 
 type t = {
   id : int;
-  states : Ptset.t;
+  mutable states : Ptset.t;
   init : Ptset.t;
-  final : Ptset.t;
+  mutable final : Ptset.t;
   universal : Ptset.t;
-  phi : (TagSet.t * state, bool * formula) Hashtbl.t;
-  delta : (TagSet.t, Ptset.t * bool * Ptset.t * Ptset.t) Hashtbl.t;
-  properties : (state,property) Hashtbl.t;
+  phi : (state,(TagSet.t*(bool*formula*predicate)) list) Hashtbl.t;
+  delta : (state*Tag.t, (bool*formula*predicate)) Hashtbl.t;
+(*  delta : (state,(bool*formula*predicate) TagMap.t) Hashtbl.t; *)
+  sigma : (bool*formula*(predicate list*predicate list)*bool) HTagSet.t;
+
 }
 val dump : Format.formatter -> t -> unit
     
 module Transitions : sig
-type t = state*TagSet.t*bool*formula
+type t = state*TagSet.t*bool*formula*predicate
 (* Doing this avoid the parenthesis *)
 val ( ?< ) : state -> state 
-val ( >< ) : state -> TagSet.t*bool -> state*(TagSet.t*bool)
-val ( >=> ) : state*(TagSet.t*bool) -> formula -> t
+val ( >< ) : state -> TagSet.t*bool -> state*(TagSet.t*bool*predicate)
+val ( ><@ ) : state -> TagSet.t*bool*predicate -> state*(TagSet.t*bool*predicate)
+val ( >=> ) : state*(TagSet.t*bool*predicate) -> formula -> t
 val ( +| ) : formula -> formula -> formula
 val ( *& ) : formula -> formula -> formula
 val ( ** ) : [`Left | `Right ] -> state -> formula
@@ -47,10 +62,18 @@ end
 type transition = Transitions.t
 val equal_trans : transition -> transition -> bool
 
+module TS : sig
+  type t
+  val empty : t
+  val cons : Tree.Binary.t -> t -> t
+  val append : Tree.Binary.t -> t -> t
+  val concat : t -> t -> t
+  val to_list_rev : t -> Tree.Binary.t list
+  val length  : t -> int
+  val iter : (Tree.Binary.t -> unit) -> t -> unit
+end
 
 module BottomUpNew : 
 sig
-  val miss : int ref
-  val call : int ref
-  val run : t -> Tree.Binary.t -> Tree.Binary.t list
+  val run : t -> Tree.Binary.t -> TS.t
 end