[mercury-users] Re: coloured petri nets

Ralph Becket rbeck at microsoft.com
Fri Sep 7 00:57:43 AEST 2001


> From: Peter Ross [mailto:peter.ross at miscrit.be]
> Sent: 06 September 2001 15:08
>
> I want to implement coloured petri nets in Mercury using as much as
> possible Mercurys type system to provide type safety.
> 
> See
> 
> http://www.daimi.aau.dk/~kjensen/papers_books/rec_papers_books.html

This looks like a suitable application for stores since places can
only hold tokens of a particular type and transitions can only 
convert tokens of one type into tokens of another type; coloured
Petri nets are well typed.

Sketching the required types I came up with...

	% A place can accept new tokens and pass and
	% tokens it posesses on to one or more transitions.
	%
:- type place(T, S)
	---> place(
		tokens      :: queue(T),
		transitions :: list(transition_ref(T, S))
	).

:- type place_ref(T, S) == mutvar(place(T, S), S).

	% A transition processes a token and passes it
	% on to one or more places.
	%
:- type transition(T, S)
	---> some [U] transition(
		fn          :: func(T) = U,
		places      :: list(place_ref(U, S))
	).

:- type transition_ref(T, S) == mutvar(transition(T, S), S).

Unless you have a version of the compiler with the standard-funcs-
in-ground-insts-are-okay patch, you'll have to find some alternative
for the fn field of the transition type.

- Ralph
--------------------------------------------------------------------------
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