Hi I have a map like map<char,int>
and I wish to do a reverse lookup i.e. find a key from a value.
Is there any way to do this in Dafny (e.g. map.getKey(value)
) which has not been documented yet?
I am thinking that one solution could be to inverse the map so that I could inverse a map<char,int>
to map<int,char
and then use the normal lookup on the inversed map. I am not sure how to do this but have tried using map table[i] | i in table :: i
by map comprehension but this does not work.
Please help me.