Safe Haskell | None |
---|
Provides a set implementation for machine CSP sets. This relies heavily on the type checking and assumes in many places that the sets being operated on are suitable for the opertion in question.
We cannot just use the built in set implementation as FDR assumes in several places that infinite sets are allowed.
- data ValueSet
- = Integers
- | Processes
- | ExplicitSet (Set Value)
- | IntSetFrom Int
- | CompositeSet (Seq ValueSet)
- | AllSequences ValueSet
- | CartesianProduct [ValueSet] CartProductType
- | Powerset ValueSet
- | AllMaps ValueSet ValueSet
- emptySet :: ValueSet
- fromList :: [Value] -> ValueSet
- toList :: ValueSet -> [Value]
- toSeq :: ValueSet -> Seq Value
- compareValueSets :: ValueSet -> ValueSet -> Maybe Ordering
- member :: Value -> ValueSet -> Bool
- card :: ValueSet -> Integer
- empty :: ValueSet -> Bool
- union :: ValueSet -> ValueSet -> ValueSet
- unions :: [ValueSet] -> ValueSet
- infiniteUnions :: [ValueSet] -> ValueSet
- intersection :: ValueSet -> ValueSet -> ValueSet
- intersections :: [ValueSet] -> ValueSet
- difference :: ValueSet -> ValueSet -> ValueSet
- data CartProductType
- cartesianProduct :: CartProductType -> [ValueSet] -> ValueSet
- powerset :: ValueSet -> ValueSet
- allSequences :: ValueSet -> ValueSet
- allMaps :: ValueSet -> ValueSet -> ValueSet
- fastUnDotCartProduct :: ValueSet -> Maybe [ValueSet]
- singletonValue :: ValueSet -> Maybe Value
- valueSetToEventSet :: ValueSet -> EventSet
- unDotProduct :: ValueSet -> Maybe [ValueSet]
Construction
Integers | Set of all integers |
Processes | Set of all processes |
ExplicitSet (Set Value) | An explicit set of values |
IntSetFrom Int | The infinite set of integers starting at lb. |
CompositeSet (Seq ValueSet) | A union of several sets. |
AllSequences ValueSet | A set containing all sequences over the given set. |
CartesianProduct [ValueSet] CartProductType | A cartesian product of several sets. |
Powerset ValueSet | The powerset of the given set |
AllMaps ValueSet ValueSet | The set of all maps from the given domain to the given image. |
Basic Functions
compareValueSets :: ValueSet -> ValueSet -> Maybe OrderingSource
Compares two value sets using subseteq (as per the specification).
card :: ValueSet -> IntegerSource
The cardinality of the set. Throws an error if the set is infinite.
union :: ValueSet -> ValueSet -> ValueSetSource
Union two sets throwing an error if it cannot be done in a way that will terminate.
infiniteUnions :: [ValueSet] -> ValueSetSource
intersection :: ValueSet -> ValueSet -> ValueSetSource
Intersects two sets throwing an error if it cannot be done in a way that will terminate.
intersections :: [ValueSet] -> ValueSetSource
Replicated intersection.
difference :: ValueSet -> ValueSet -> ValueSetSource
Derived functions
cartesianProduct :: CartProductType -> [ValueSet] -> ValueSetSource
Produces a ValueSet of the carteisan product of several ValueSets,
using vc
to convert each sequence of values into a single value.
allSequences :: ValueSet -> ValueSetSource
Returns the set of all sequences over the input set. This is infinite so we use a CompositeSet.
Specialised Functions
singletonValue :: ValueSet -> Maybe ValueSource
Returns the value iff the set contains one item only.
unDotProduct :: ValueSet -> Maybe [ValueSet]Source
Attempts to decompose the set into a cartesian product, returning Nothing if it cannot.