I tried to replace parts of the proof with sorry
, but I was getting confused by the results of doing so, so I made a small private lemma
with the part of the proof that seemed to be at issue, and again tried to replace parts of the smaller proof with sorry
.
I again got confused, so I tried to print
my lemma and copied and pasted the output of print
and renamed the resulting lemma. It didn't actually type-check, but I put in a few more sorry
s and got something that type-checked. Then I replaced more and more of the raw proof term with sorry
until I had narrowed it down further.
At some point I stumbled on a clue, and realised that I needed to set_option pp.all true
to see the full (gory) details.
It turned out that I had indeed relied on a theorem from Mathlib - and while this theorem itself did not rely on the axiom of choice, my use of it did, because it implicitly summoned into play some type class instances which did. After some digging I found that:
OrderedCancelAddCommMonoid.toContravariantClassLeft
was a/the culprit, which uses
contravariant_lt_of_contravariant_le
which uses
contravariant_le_iff_contravariant_lt_and_eq
which uses
LE.le.lt_or_eq
, which is an alias for lt_or_eq_of_le
which uses
Classical.propDecidable
which says that all Props are Decidable (with my constructivist hat on I disagree with this!)
which uses
Classical.em
, the law of the excluded middle
which uses
Classical.choose
which uses
Classical.indefiniteDescription
, which uses the axiom of choice (in some way I don't understand)
My plan of attack now is to use constructive instances, or define them myself if they don't already exist, using priority to ensure they are picked up first.
sorry
and see what happens. Of course this will addsorry
as an axiom, but at some pointchoice
should disappear. $\endgroup$sorry
, to check that the statement doesn't somehow uses choice. $\endgroup$