A type for converting a function from an operation over SortedMaps to an
operation over SortedBags
The type of insert
and the common core of most functions that update
the contests of a Bag.
Apply a function (Nat -> Nat)
to a given argument
Is a count non-zero?
Count the number of occurances
Perform a count on the underlying SortedMap
Delete all ocurances
delete 1 item (equivalent to deleteN 1
)
delete a given number of items
An empty bag.
Convert a list to a Sorted Bag
insert a single item.
insert a given number of items
O(1). Are there any items? The proof in PosNat ensures that there are no
zero-counted items.
Special case for n=1 for onMaps
Apply an n-ary function over the wrapped SortedMap
.
A single item (more efficient than insert x empty
)
Convert a Sorted Bag to a List, keeping it sorted.
Merge two bags
Remove the BagWrapper
from a bag (the required proof from PosNat
makes
this safe)
An Isomorphism
between a wrapped and unwrapped bag