Zulip Chat Archive

Stream: mathlib4

Topic: minFac is computable but depends on choice


Christoph Spiegel (Mar 20 2025 at 14:46):

This is probably a silly question, but how is this possible:

-- `Nat.minFac` uses `Classical.choice` ...
#print axioms Nat.minFac
-- ... but is computable
#eval Nat.minFac 9

Is there just a wasted call to Classical.choice somewhere in the foundations of mathlib that gets pulled into Nat.minFacbut is not actually executed or why does #eval not trip over the noncomputable / axiom?

Kevin Buzzard (Mar 20 2025 at 14:47):

If it's used in a proof that some computable function has a certain property, then this should be fine, no?

Kevin Buzzard (Mar 20 2025 at 14:50):

Looks to me that the data part of the definition of docs#Nat.minFacAux is computable but the proof that the "definition is well-defined", i.e. that the algorithm always terminates on any input, uses axioms.

Kevin Buzzard (Mar 20 2025 at 14:52):

axiom foo :  x, x < 9

def a : {n // n < 9} := 37, foo 37

#eval a -- 37

#print axioms a -- foo

Christoph Spiegel (Mar 20 2025 at 14:55):

Ah, that does make sense. Thanks for the example!


Last updated: May 02 2025 at 03:31 UTC