X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=ata.mli;h=4ec2f59224c570773264b9ebe7989c2b0532d950;hb=d2cbab156c2b74051cf831dc3ac634aedc8f2c2f;hp=593a39e59463b2dd5c46b7f1f06895d7d89e2426;hpb=dc91851aaeac91a71eba2c266d0227adea0c5815;p=SXSI%2Fxpathcomp.git diff --git a/ata.mli b/ata.mli index 593a39e..4ec2f59 100644 --- a/ata.mli +++ b/ata.mli @@ -1,26 +1,23 @@ -(* module Ptset : sig - include Set.S with type elt = int - val from_list : elt list -> t - end - *) +module TS : sig + type t + val empty : t + val cons : Tree.t -> t -> t + val append : Tree.t -> t -> t + val concat : t -> t -> t + val length : t -> int + val iter : (Tree.t -> unit) -> t -> unit +end type state = int val mk_state : unit -> state -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 | `LLeft | `RRight ] * bool * state) -and formula = { fid : int; fkey : int; pos : formula_expr; neg : formula; st : (Ptset.t*Ptset.t)*(Ptset.t*Ptset.t); size: int;} +and formula = { fid : int; fkey : int; pos : formula_expr; neg : formula; st : (Ptset.t*Ptset.t*Ptset.t)*(Ptset.t*Ptset.t*Ptset.t); size: int;} val true_ : formula val false_ : formula val atom_ : [`Left | `Right | `LLeft | `RRight ] -> bool -> state -> formula @@ -33,27 +30,35 @@ val pr_frm : Format.formatter -> formula -> unit module HTagSet : Hashtbl.S with type key = Ptset.t*Tag.t -type t = { - id : int; - mutable states : Ptset.t; - init : Ptset.t; - mutable final : Ptset.t; - universal : Ptset.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; +type dispatch = { first : Tree.t -> Tree.t; + flabel : string; + next : Tree.t -> Tree.t -> Tree.t; + nlabel : string; + consres : Tree.t -> TS.t -> TS.t -> bool -> bool -> TS.t; + } +type formlist = Nil | Cons of state*formula*int*formlist + +type t = { + id : int; + mutable states : Ptset.t; + init : Ptset.t; + mutable final : Ptset.t; + universal : Ptset.t; + starstate : Ptset.t option; + (* Transitions of the Alternating automaton *) + phi : (state,(TagSet.t*(bool*formula*bool)) list) Hashtbl.t; + sigma : (dispatch*bool*formlist*Ptset.t*Ptset.t) HTagSet.t; } val dump : Format.formatter -> t -> unit module Transitions : sig -type t = state*TagSet.t*bool*formula*predicate +type t = state*TagSet.t*bool*formula*bool (* Doing this avoid the parenthesis *) val ( ?< ) : state -> state -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 ( >< ) : state -> TagSet.t*bool -> state*(TagSet.t*bool*bool) +val ( ><@ ) : state -> TagSet.t*bool -> state*(TagSet.t*bool*bool) +val ( >=> ) : state*(TagSet.t*bool*bool) -> formula -> t val ( +| ) : formula -> formula -> formula val ( *& ) : formula -> formula -> formula val ( ** ) : [`Left | `Right | `LLeft | `RRight ] -> state -> formula @@ -62,22 +67,12 @@ 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 - val rev_iter : (Tree.Binary.t -> unit) -> t -> unit - val find : (Tree.Binary.t -> bool) -> t -> Tree.Binary.t -end + (*module BottomUpJumpNew : sig *) - val run : t -> Tree.Binary.t -> TS.t - val run_time : t -> Tree.Binary.t -> TS.t + val run : t -> Tree.t -> TS.t*int + val run_count : t -> Tree.t -> int + val run_time : t -> Tree.t -> TS.t*int (*end *)