Dictionaries in `Julia`

(and other programming languages) are *onto* functions, mathematically speaking. That is to say

*onto*(or surjective) function. The

*inverse image*of $f$ is a function

*power set*of $B,$ and where

If `D`

is a `Dict`

then `D`

is the equivalent to
$f$
where
$A =$
`keys(D)`

and
$B =$
`values(D)`

. To define the inverse image function
$f^{(-1)}$
it is just necesary to code:

```
invImg(C::Set, D::Dict) = Set(filter(x -> D[x] ∈ C, keys(D)))
```

For example:

```
D = Dict([1,2,3,4,5,6,7] .=> ['a','a','b','a','b','a','c'])
C = Set(['a','c'])
invImg(C, D)
```

obtaining $f^{(-1)}(C) = \{1,2,4,6,7\}$ as expected.

## Discussion (2)

I am not sure I fully grasp this, can you add some commentary for folks who don't have a rigoruous math background like myself?

I added a comment «In other words...» I hope may help. Probably what I had in mind was more an invitation for mathematicians to see the advantages of using Julia to exemplify set theory concepts.