Module Bigraph.Big
type inter=|Inter of int * Link.Face.tInter (i,n)creates an interface with ordinaliand namesn.The type of interfaces.
Exceptions
exceptionCTRL_ERROR of int * Link.Face.tRaised when the arity of a control does not match the cardinality of a face. The first element is the arity while the second is the mismatching face.
exceptionISO_ERROR of int * intRaised when a
Iso.tis not total. The first element is the cardinality of the domain while the second is the cardinality of the isomorphism's domain of definition.
Functions on interfaces
val string_of_inter : inter -> stringCompute the string representation of an interface.
val pp_inter : Stdlib.Format.formatter -> inter -> unitPretty printer.
val ord_of_inter : inter -> intCompute the ordinal of an interface.
val face_of_inter : inter -> Link.Face.tCompute the face (i.e. name-set) of an interface.
Functions on bigraphs
val to_string : t -> stringCompute the string representation of a bigraph. Example:
{(0, A:3),(1, A:3)} 2 2 0 10 10 01 00 ({}, {}, {(0, 1), (1, 2)}) ({}, {}, {(0, 2), (1, 1)})
val pp : Stdlib.Format.formatter -> t -> unitPretty printer.
val of_string : string -> tParse a string produced by
Big.to_stringto a value of typeBig.t.- raises Invalid_argument
if the string cannot be parsed.
val parse : string -> tParse a bigraph. Example input format:
2 2 0 2 A A 10 10 01 00 1 1 2 f 1 2 2 fThe first line specifies the number of regions, nodes, sites, and links in the displayed order. The second line lists the controls of the nodes. It follows the adjacency matrix for the place graph and a list of links. A link is open (closed) if the corresponding line terminates with
t(f). Note this example corresponds to bigraph shown in the documentation ofBig.to_string.- raises Invalid_argument
if the input cannot be parsed.
val to_dot : t -> string -> stringto_dot b ncompute the string expressing bigraphbnamednindotformat.
val placing : int list list -> int -> Link.Face.t -> tplacing l r fcomputes a placing withrregions by parsing listl. The format oflis the same as the input forPlace.parse_placing. The link graph is the identity over facef.
val size : t -> intCompute the size of a bigraph as the sum of the cardinalities of the node set and edge set.
Elementary bigraphs
val id_eps : tThe empty identity.
val merge : int -> tBigraph consisting of one region and
nsites.
val split : int -> tBigraph consisting of one site and
nregions.
val one : tElementary bigraph consisting of one region.
val zero : tElementary bigraphs consisting of one site.
val ion : Link.Face.t -> Ctrl.t -> tion ns ccomputes an ion of controlc. It's outer names arens. No arity check is performed.
val ion_chk : Link.Face.t -> Ctrl.t -> tSame as
Big.ionbut with arity check.- raises CONTROL_ERROR
when the set of names has size different than the arity of
c.
val atom : Link.Face.t -> Ctrl.t -> tSame as
Big.ionbut without the site.
val atom_chk : Link.Face.t -> Ctrl.t -> tSame as
Big.ion_chkbut without the site.- raises CONTROL_ERROR
when the set of names has size different than the arity of
c.
val sub : inner:Link.Face.t -> outer:Link.Face.t -> tsub inner outercomputes a substitution whereinnerandouterare the inner and outer faces, respectively.
val closure : Link.Face.t -> tclosure fcomputes the closure of interfacef.
val intro : Link.Face.t -> tintro fcomputes an empty bigraph providing a fresh set of namesf. This function is the dual ofBig.closure.
Operations
val close : Link.Face.t -> t -> tclose f bcloses names inf. Example:\x0 \x1 b.
val comp : t -> t -> tcomp a bcomputes the composition of bigraphsaandb, a ∘ b using the algebraic notation.- raises COMP_ERROR
when the mediating interfaces do not match.
val comp_of_list : t list -> tcomp_of_list bscomputes the composition of all the bigraphs in listbs.- raises COMP_ERROR
when the mediating interfaces do not match.
val comp_seq : start:int -> stop:int -> (int -> t) -> tcomp_seq ~start ~stop fcomputes the compositionf(start) * ... * f(stop - 1).- raises COMP_ERROR
when the mediating interfaces do not match.
val nest : t -> t -> tnest a bcomputes the bigraph resulting from nesting bigraphbin bigrapha. Common names are shared.- raises COMP_ERROR
if composition cannot be performed.
val par : t -> t -> tpar a bcomputes the merge product of bigraphsaandb, a ∣ b using the algebraic notation.
val par_of_list : t list -> tpar_of_list bscomputes the merge product of all the bigraphs in listbs.
val par_seq : start:int -> stop:int -> (int -> t) -> tpar_seq ~start ~stop fcomputes the compositionf(start) | ... | f(stop - 1).
val ppar : t -> t -> tppar a bcomputes the parallel product of bigraphsaandb, a ∥ b using the algebraic notation.
val ppar_of_list : t list -> tppar_of_list bscomputes the parallel product of all the bigraphs in listbs.
val ppar_seq : start:int -> stop:int -> (int -> t) -> tppar_seq ~start ~stop fcomputes the compositionf(start) || ... || f(stop - 1).
val rename : inner:Link.Face.t -> outer:Link.Face.t -> t -> trename inner outer brenames the names ininto the names inout. The outer names inbnot ininnerare left untouched.
share f psi gcomputes the bigraphs obtained by sharing bigraphfin bigraphgby using placingpsi.- raises SHARING_ERROR
if
psiis not a placing.
- raises COMP_ERROR
if one composition cannot be performed.
val tens : t -> t -> ttens a bcomputes the tensor product of bigraphsaandb, a ⊗ b using the algebraic notation.- raises Link.NAMES_ALREADY_DEFINED
when
aandbhave shared names.
Predicates
val is_id : t -> boolis_id breturnstrueif bigraphbis an identity,falseotherwise.
val is_plc : t -> boolis_plc breturnstrueif bigraphbis a placing,falseotherwise.
val is_wir : t -> boolis_wir breturnstrueif bigraphbis a wiring,falseotherwise.
val is_epi : t -> boolis_epi breturnstrueif bigraphbis epimorphic,falseotherwise. A bigraph is epimorphic if both its place graph and link graph are epimorphic. SeePlace.is_epiandLink.is_epi.
val is_mono : t -> boolis_mono breturnstrueif bigraphbis monomorphic,falseotherwise. A bigraph is monomorphic if both its place graph and link graph are monomorphic. SeePlace.is_monoandLink.is_mono.
val is_guard : t -> boolis_guard breturnstrueif bigraphbis an guarded,falseotherwise. A bigraph is guarded if both its place graph and link graph are guarded. SeePlace.is_guardandLink.is_guard.
val is_solid : t -> boolis_solid breturnstrueif bigraphbis solid,falseotherwise. A bigraph is solid if it is epimorphic, monomorphic, and guarded. SeeBig.is_epi,Big.is_mono, andBig.is_guard.
val is_ground : t -> boolis_ground breturnstrueif bigraphbis ground,falseotherwise. A bigraph is ground if its place graph and link graph are both ground. SeePlace.is_groundandLink.is_ground.
Decompositions
val decomp : target:t -> pattern:t -> i_n:Iso.t -> i_e:Iso.t -> Fun.t -> t * t * tdecomp t p i_n i_e f_ecomputes the decomposition of targettgiven patternp, node isomorphismi_nand edge isomorphismi_e. The isomorphism are fromptot. The elements in the result are the context, the parameter and the identity of the decomposition. Argumentf_eis a total function from links in the pattern to links in the target.
val key : t -> big_keyCompute the key of a bigraph. The key is similar to a hash. Note that different bigraphs can have the same key.
val rewrite : (Iso.t * Iso.t * Fun.t) -> s:t -> r0:t -> r1:t -> Fun.t option -> trewrite o ~s ~r0 ~r1 etacomputes a bigraph obtained by replacing the occurrence of~r0(specified by occurrenceo) in~switheta ~r1, whereetais a valid (no check performed) instantiation map.- raises Place.NOT_PRIME
when
bis not prime decomposable.