Module type Nbrs.T
Output signature of the functor Nbrs.Make.
include Rs.RS with type react = react and type ac := AppCond.t and type label = string * int * float and type graph = graph and type limit = int
type react= reactThe type of bigraphical reaction rules.
type p_class=|P_class of react listPriority class.
|P_rclass of react listReducing priority class.
The type of priority classes.
type graph= graphThe type of transition systems.
val typ : Rs.rs_typeThe kind of reactive system.
val string_of_react : react -> stringString representation of reaction rules. The representation of the redex and the reactum are computed by
Big.to_string.
val name : react -> stringThe name of the reaction rule.
val parse_react_unsafe : name:string -> lhs:Big.t -> rhs:Big.t -> ?conds:ac list -> label -> Fun.t option -> reactCreate a new reaction rule. If
eta = None, the identity function is used as instantiation map. No validity check is performed.
val parse_react : name:string -> lhs:Big.t -> rhs:Big.t -> ?conds:ac list -> label -> Fun.t option -> react optionSame as
Brs.parse_react_unsafe but returnsNoneif it is impossible to parse a valid reaction.
val string_of_limit : limit -> stringString representation of a simulation limit.
val is_valid_react : react -> boolReturn
trueif the inner (outer) interfaces of the redex (reactum) are equal, the redex is solid and the instantiation map is total. Returnfalseotherwise. SeeBig.is_solid.
exceptionNOT_VALID of react_errorRaised when a reaction rule is not valid.
val is_valid_react_exn : react -> boolSame as
is_valid_reactbut an exception is raised when the rule is not valid.- raises NOT_VALID
when the rule is not valid.
val string_of_react_err : react_error -> stringString representation of reaction validity errors.
val is_valid_priority : p_class -> boolReturn
trueif a priority class is valid,falseotherwise.
val is_valid_priority_list : p_class list -> boolReturn
trueif a list of priority classes contains at least a non reducible priority class,falseotherwise.
val cardinal : p_class list -> intReturn the total number of reaction rules in a list of priority classes.
val step : Big.t -> react list -> (Big.t * label * react list) list * intCompute the set of reachable states in one step. Note that isomorphic states are merged. The total number of occurrences is also returned.
val random_step : Big.t -> react list -> (Big.t * label * react list) option * intCompute a random state reachable in one step. The total number of occurrences is also returned.
val apply : Big.t -> react list -> Big.t optionSequential application of a list of reaction rules. Non-enabled rules are ignored.
Noneis returned if no rewriting is performed i.e., when all the reaction rules are non-enabled.
val fix : Big.t -> react list -> Big.t * intReduce a reducible class to the fixed point. The number of rewriting steps is also returned.
val rewrite : Big.t -> p_class list -> Big.t * intScan priority classes and reduce a state. Stop when no more rules can be applied or when a non reducible priority class is enabled. Also return the number of rewriting steps performed in the loop.
exceptionMAX of graph * Rs.statsRaised when the size of the transition system reaches the maximum number of states.
val bfs : s0:Big.t -> priorities:p_class list -> predicates:(Base.Predicate.t * Big.t) list -> max:int -> iter_f:(int -> Big.t -> unit) -> graph * Rs.statsbfs ~s0 ~priorities ~max ~iter_fcomputes the transition system of the reactive system specified by initial states0and priority classespriorities. Arguments~maxand~iter_fare the maximum number of states of the transition system and a function to be applied whenever a new state is discovered, respectively. Priority classes are assumed to be sorted by priority, i.e., the first element in the list is the class with the highest priority. List of predicates~predicatesis also checked for every state.- raises Brs.MAX
when the maximum number of states is reached.
val sim : s0:Big.t -> priorities:p_class list -> predicates:(Base.Predicate.t * Big.t) list -> init_size:int -> stop:limit -> iter_f:(int -> Big.t -> unit) -> graph * Rs.statsSimulate the raective system specified by initial state
s0and priority classespriorities. Argumentsinit_sizeandstopare the initial size of the state set and the simulation limit, respectively. Functioniter_fis applied to every new state discovered during the simulation.- raises DEADLOCK
when the simulation reaches a deadlock state.
- raises LIMIT
when the simulation limit is exceeded.
val to_prism : graph -> stringCompute the string representation in PRISM
traformat of a transition system.
val to_state_rewards : graph -> stringCompute the string representation in PRISM
rewsformat of state rewards.
val to_transition_rewards : graph -> stringCompute the string representation in PRISM
trewformat of transition rewards.
val to_dot : graph -> path:string -> name:string -> stringCompute the string representation in
dotformat of a transition system.
val to_lab : graph -> stringCompute the string representation in PRISM
labformat of the labelling function of a transition system.
val action : react -> stringThe MDP action this reaction rule belongs to.
val weight : react -> floatThe weight of a reaction rule.