[mercury-users] Re: coloured petri nets

Peter Ross peter.ross at miscrit.be
Thu Sep 6 22:56:49 AEST 2001


I think I can implement things the way I want to if I can implement the
following functions

:- type petri
	--->    ?.
:- type ref(T)
	--->    ?.

:- func get_place(petri, ref(place(T)) = place(T).

In otherwords given some type petri and a reference to a place(T) in the
type petri, get me back the place(T).

Similary I will need

:- pred insert_place(petri::in, place(T)::in,
		ref(place(T))::out, petri::out) is det.

:- func set_place(ref(place(T)), place(T), petri) = petri.

This should allow me to do the following.

:- pred bind(arc_place_transition::in, environment::out,
                petri::in, petri::out) is nondet.

bind(ArcPlaceTransition, Environment, Petri0, Petri) :-
        Place = get_place(Petri0, ArcPlaceTransition ^ from),
        set__member(Token, Place ^ tokens),
        F = ArcPlaceTransition ^ bind,
        Env = F(Token),
        Petri = Petri0.
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list