After proving an existence statement, it is often notationally convenient to introduce a constant symbol for some witness of this theorem.
As a simple example, it is
Your issue is related to the usual Prop vs Type
distinction. The existence of your witness lies in Prop
(see definition of type ex
), so you can't inspect it to build a concrete term, you need to have this fact proved in Type
.
You are looking for the sig
(or a variation like sigS
or sigT
) type whose notation is :
Hypothesis inhabited : {x : A | x = x }.