Library
Module
Module type
Parameter
Class
Class type
type state = State.t
The type of state identifiers
type label = TransLabel.t
The type of transition labels
type attr = Attr.t
The type of state attributes
The type for transitions. A transition is a triplet (s1,l,s2)
, where s1
is the source state, s2
the destination state and l
the transition label
The type for initial transitions. An initial transition is a pair (l,s)
, where s
is the destination state and l
the transition label
module State : Lascar.Ltsa.STATE with type t = state
module Label : Lascar.Ltsa.LABEL with type t = label
module Attr : Lascar.Ltsa.ATTR with type t = attr
module States : Utils.SetExt.S with type elt = state
Returns the set of states, with attached attribute as a assocation list
val transitions : t -> transition list
Returns the list of transitions
val itransitions : t -> itransition list
Returns the list of initial transitions
val string_of_state : state -> string
A synonym of State.to_string
val string_of_label : label -> string
A synonym of Label.to_string
val string_of_attr : attr -> string
A synonym of Attr.to_string
is_reachable s q
returns true iff q
is a reachable state in s
, i.e. if it can be reached from an initial state using the transitio relation.
val is_transition : t -> transition -> bool
is_transition t q
returns true iff t
is a transition in s
succs s q
returns the set of immediate successors in s
, i.e. the set of state q'
such that there exists a transition (q,l,q')
in R
. Raise Invalid_argument if q
is not in s
.
succs' s q
returns the list of immediate successors, with the associated transition label, of state q
in s
. Raise Invalid_argument if q
is not in s
.
preds s q
returns the set of immediate predecessors of state q
in s
, i.e. the set of state q'
such that there exists a transition (q',l,q)
in R
. Raise Invalid_argument if q
is not in s
.
preds' s q
returns the list of immediate predecessors, with the associated transition label, of state q
in s
. Raise Invalid_argument if q
is not in s
.
Transitive closure of succs
. succs_hat s q
returns all the successors (immediate or not) of q
in s
Transitive closure of preds
. preds_hat s q
returns all the predecessors (immediate or not) of q
in s
attr_of s q
returns the attribute of state q
in s
. Raise Not_found
if there is no state q
in s
val empty : t
The empty LTSA (no state, no transition)
val create :
states:(state * attr) list ->
itrans:(label * state) list ->
trans:(state * label * state) list ->
t
create qs q0s ts
builds a LTSA from
(label,dst_state)
ts
, where each transition is given as (src_state,label,dst_state)
add_state (q,a) s
returns the LTSA obtained by adding state q
, with attribute a
, to s
. Returns s
is q
is already a state in s
exception Invalid_state of state
add_transition (q1,l,q2) s
returns the LTSA obtained by adding transition from state q1
to state q2
, with label l
to LTSA s
. Raises Invalid_state
if q1
or q2
are not states of s
add_itransition (l,q) s
returns the LTSA obtained by adding initial transition to state q
, with label l
to LTSA s
. Raises Invalid_state
if q
are is not a state of s
remove_state q s
returns the LTSA obtained by removing state q
, and all attached transitions, from s
. Raises Invalid_state
is q
is not a state in s
iter_states f s
applies function f
to all states (with associated attribute) of s
fold_states f s z
computes f xN ... (f x2 (f x1 z))...
, where x1
, ..., xN
are all the states of s
val iter_transitions : (transition -> unit) -> t -> unit
iter_transitions f s
applies function f
to all transitions of s
val fold_transitions : (transition -> 'a -> 'a) -> t -> 'a -> 'a
fold_transitions f s z
computes f xN ... (f x2 (f x1 z))...
, where x1
, ..., xN
are all the transitions of s
val iter_itransitions : (itransition -> unit) -> t -> unit
iter_itransitions f s
applies function f
to all initial transitions of s
val fold_itransitions : (itransition -> 'a -> 'a) -> t -> 'a -> 'a
fold_itransitions f s z
computes f xN ... (f x2 (f x1 z))...
, where x1
, ..., xN
are all the initial transitions of s
fold_succs s x f z
computes f xN lN ... (f x2 (f x1 l1 z) l2)...
, where x1
, ..., xN
are all the successors of state x
in LTSA s
, and l1
, ..., lN
the associated transitions labels
iter_succs s x f z
computes f x1 l1; ... ;f xN lN
, where x1
, ..., xN
are all the successors of state x
in LTSA s
, and l1
, ..., lN
the associated transitions labels
fold_preds s x f z
computes f xN lN ... (f x2 (f x1 l1 z) l2)...
, where x1
, ..., xN
are all the predecessors of state x
in LTSA s
, and l1
, ..., lN
the associated transitions labels
iter_preds s x f z
computes f x1 l1; ... ;f xN lN
, where x1
, ..., xN
are all the predecessors of state x
in LTSA s
, and l1
, ..., lN
the associated transitions labels
map_state f s
returns the LTSA obtained by replacing each state q
by f q
in s
. State attributes are left unchanged. Result is undefined if f
is not injective.
map_attr f s
returns the LTSA obtained by replacing each state attribute a
by f a
in s
.
map_state_attr f s
returns the LTSA obtained by replacing each pair of state and associated attributes (q,a)
by f (q,a)
in s
. As for map_state
, the result is undefined if f
is not injective its first argument.
map_label f s
returns the LTSA obtained by replacing each transition label l
by f l
in s
.
map_transition f s
returns the LTSA obtained by replacing each transition t
by f t
in s
. Each non-initial transition qs,l,qd
is replaced by qs',l',qd'
, where (Some qs',l',qd') = f (Some qs,l,qd)
. If present, the initial transition l,qi
is replaced by l',qi'
where (None,l',qi') = f (None, l, qi)
. Warning: updating the source and/or destination state in a transition may result in a incoherent LTS description. This function should essentially be viewed as a variant of map_label
in which the transformation function f
can take the source and destination state into account.
unwind depth s
unwinds LTSA system s
to produce a list of execution trees (rooted at initial states) up to the specified depth
val dot_output :
string ->
?fname:string ->
?options:Utils.Dot.graph_style list ->
?marked_states:(state * Utils.Dot.node_style) list ->
?extra_nodes:(string * Utils.Dot.node_style) list ->
?implicit_transitions:transition list ->
t ->
unit
dot_output name s
writes a .dot representation of s
with name name
. The name of the output file is name.dot
or specified with the fname
optional argument. States listed with the optional argument marked_states
will be drawn with the specified style. Extra nodes, to be added to the generated graph, can be specified with the extra_nodes
optional argument. Transitions listed in the implicit_transitions
optional argument will not be drawn.
val dot_output_oc :
string ->
out_channel ->
?options:Utils.Dot.graph_style list ->
?marked_states:(state * Utils.Dot.node_style) list ->
?extra_nodes:(string * Utils.Dot.node_style) list ->
?implicit_transitions:transition list ->
t ->
unit
dot_output_coc name oc s
is a variant of dot_output
in which the description of s
is written to the (previously opened) output channel oc
.
val dot_output_execs :
string ->
?fname:string ->
?options:Utils.Dot.graph_style list ->
int ->
t ->
unit
dot_output_execs name depth s
writes a .dot representation, with name name
of the execution trees obtained by calling unwind depth s
. The name of the file is name.dot
or specified with the fname
optional argument. Drawing options can be specified with the options
optional argument.
tex_output name fname s
writes a .tex representation of s
with name name
. The name of the output file is name.dot
or specified with the fname
optional argument. When the optional argument listed_transitions
is Some l
, only transitions listed in l
are written, otherwise all transitions of s
are written.