I am looking for a package for dealing with "mappings" $f\colon A\to B$ where $A$ and $B$ are finite subsets of the set of all possible (inert) expressions.
I need operations like:
- Computing $f(a)$ efficiently.
- Converting $f$ from and to a list of rules.
- Checking whether $f$ is injective (thus bijective).
- Computing the inverse function if possible.
- Listing the elements of $A$ and the set $f(A)$
- Ensuring or enforcing that the elements of $A$ and/or $B$ match a certain pattern, e.g.
- Converting to and from a
Listfor the case that $A$ is
- Efficient handling of the case that $B$ is a list of
Is there something out there that does this or could be extended easily or would you sit down the few hours it takes and program this from scratch? Am I missing some available functionality that provides a nice representation and implementation of such mappings?