Let
be the set of all possible items you want in your priority queue. Boolean is a place holder for boolean values.
A generic way to specify a greater than function of an
type. This is to allow the queue to have a priority, for a more specific priority queue you would simply change this definition.
This is the schema for PriorityQueue. All that PriorityQueue contains is a set of partial functione mapping the natural numbers to the items in the queue.
The predicate gurantees that the doman of "items" is the emptyset or {1..n} where n is an integer greater then or equal to 1.
The initialize for a PriorityQueue, make sure it is empty to begin with.
Return "True" if the priority queue is empty and "False" otherwise
The join operation is the similar to what enqueue typically does, however in the case of the priority queue it needs to insert the item in the correct order. Notice this schema has two local variables, "smallest" representing the smallest index where the corresponding element is greater then the item to be added and "greater" which is the indexs of elements such that there corresponding element is greater then the one
to be added.
The Leave operation is the same as dequeue, it simply returns the value with index 1 and shifts everything down.