Is it possible to write a function that returns the domain of a map which is defined as follows:
Variable A B : Type.
Hypothesis A_eqB_dec : forall x y : A, {x = y} + {x <> y}.
Definition map := A -> option B.
Is it possible to write a function that returns the domain of a map which is defined as follows:
Variable A B : Type.
Hypothesis A_eqB_dec : forall x y : A, {x = y} + {x <> y}.
Definition map := A -> option B.
Copyright © 2021 Jogjafile Inc.
It depends on what you call the domain. If it is a proposition of elements of
A, then that function is easy to define:You can even make this better, by replacing the proposition by a boolean, since "not being
None" is decidable:Note that defining these does not require any properties on
AorB. However, if you want to enumerate elements of the domain in some form, then I do not think you can do that without assuming thatAis enumerable in some way. IfAis enumerable, you should be able to enumerate elements in the domain as well, by going throughAand selecting only elements which are in the domain (in the sense ofdomain_boolabove). The exact way to do this will depend on your definition of "enumerable".