问题
In the Coq standard library, there is an enumerated type called comparison
with three elements Eq,Lt,Gt
. This is used to define the less-than or less-than-or-equal operators in ZArith
: m < n
is defined as m ?= n = Lt
and m <= n
is defined as m ?= n <> Gt
. By virtue of Hedberg's theorem (UIP_dec
in the standard library) I can prove that <
is proof-irrelevant, but I run into issues when it comes to <=
, since it is defined negatively. I find this particularly annoying, since if <=
were defined in the, IMO, more natural way (m ?= n = Lt \/ m ?= n = Eq
) I would be able to prove proof-irrelevance just fine.
Context: I'm using some previously written Coq files where the author uses proof irrelevance as a global axiom to avoid bringing in setoids, and for aesthetic reasons I would prefer to do without axioms. It seems then to me that my options are:
Hope that ultimately
Z.le
as currently defined is still proof-irrelevantUse my own definition(s) so that proof irrelevance is provable (less satisfying since I'd like to stick to the standard library as much as possible)
Rework things with setoids
回答1:
No, this is not provable in Coq. It depends on the axiom of function extensionality, which says that (forall x, f x = g x) -> f = g
. It's quite easy to prove that all negations are proof irrelevant under this assumption (since False
is proof irrelevant), and quite impossible to prove that any negations are proof irrelevant without it.
来源:https://stackoverflow.com/questions/49780370/is-z-le-as-defined-in-the-standard-library-proof-irrelevant