X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=ata.mli;h=c56c22bd16b09e244de58d7075e2dc45790bb116;hb=978f182e9ce00820c1ce8c721f61ab57afabd160;hp=f5e2c4fa6f893d944a48865f99319b725d0ed85f;hpb=d04661689691b4587cfc45a35e98604fcdc2b878;p=SXSI%2Fxpathcomp.git diff --git a/ata.mli b/ata.mli index f5e2c4f..c56c22b 100644 --- a/ata.mli +++ b/ata.mli @@ -1,56 +1,71 @@ type state = int val mk_state : unit -> state -type predicate = Ptset.t*Ptset.t -> Tree.Binary.t -> [ `True | `False | `Maybe ] 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 | `LLeft | `RRight ] * bool * state) +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_ : ?pred:predicate option -> [`Left | `Right ] -> bool -> state -> formula +val atom_ : [`Left | `Right | `LLeft | `RRight ] -> bool -> state -> formula val and_ : formula -> formula -> formula val or_ : formula -> formula -> formula val not_ : formula -> formula -val equal_form : formula -> formula -> bool +(*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 = { + +type 'a 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; + starstate : Ptset.t option; + (* Transitions of the Alternating automaton *) + phi : (state,(TagSet.t*(bool*formula*bool)) list) Hashtbl.t; + sigma : (int,('a t -> Tree.t -> Tree.t -> Ptset.t*'a)) Hashtbl.t; } -val dump : Format.formatter -> t -> unit + +val dump : Format.formatter -> 'a t -> unit module Transitions : sig -type t = state*TagSet.t*bool*formula +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) -val ( >=> ) : state*(TagSet.t*bool) -> 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 ] -> state -> formula +val ( ** ) : [`Left | `Right | `LLeft | `RRight ] -> state -> formula end type transition = Transitions.t -val equal_trans : transition -> transition -> bool +val equal_trans : transition -> transition -> bool -module BottomUpNew : -sig - val miss : int ref - val call : int ref - val run : t -> Tree.Binary.t -> Tree.Binary.t list -end + module type ResultSet = + sig + type t + val empty : t + val cons : Tree.t -> t -> t + val concat : t -> t -> t + val iter : (Tree.t -> unit) -> t -> unit + val fold : (Tree.t -> 'a -> 'a) -> t -> 'a -> 'a + val map : (Tree.t -> Tree.t) -> t -> t + val length : t -> int + end + + module IdSet : ResultSet + + val top_down_count : 'a t -> Tree.t -> int + val top_down : 'a t -> Tree.t -> IdSet.t + val bottom_up_count_contains : 'a t -> Tree.t -> int + val bottom_up_count : 'a t -> Tree.t -> Tag.t -> int