Zulip Chat Archive

Stream: mathlib4

Topic: Removing classicality from `Finsupp.single` and `Finsupp....


Thomas Murrills (Dec 09 2023 at 22:20):

I noticed that as-is you can’t #eval code involving finitely supported functions defined using the nice fun₀ notation—which is counterintuitive, as all of the data is finite.

The issue is just that we use classicality to get decidable equality on the domain and codomain types. Would it be reasonable to demand DecidableEq instances in single and update, and then turn on classicality when necessary to supply those instances?

(Or is this not how it works? I’m making some assumptions; I haven’t worked much with classicality in mathlib.)

Eric Wieser (Dec 09 2023 at 22:21):

I already have an open PR attempting to do this

Damiano Testa (Dec 09 2023 at 22:22):

I had the impression that DFinsupp is the decidable one though, right?

Eric Wieser (Dec 09 2023 at 22:22):

But in the short term, the answer is "use DFinsupp"

Eric Wieser (Dec 09 2023 at 22:22):

Yes, but that's not what the D is supposed to mean

Damiano Testa (Dec 09 2023 at 22:22):

Although, as far as I understand D is for dependent.

Damiano Testa (Dec 09 2023 at 22:23):

Eric, we seem to have crossed messages!

Eric Wieser (Dec 09 2023 at 22:24):

See also https://github.com/leanprover-community/mathlib4/wiki/Computation-models-for-polynomials-and-finitely-supported-functions

Thomas Murrills (Dec 09 2023 at 22:25):

Would using DFinsupp require changing my types everywhere? If so I might just hand-roll decidable versions of single and update and override the macro in the meantime; it’s just scratch work, and I don’t plan on PRing anything in the short term. :)

Eric Wieser (Dec 09 2023 at 22:26):

Yes, it not only means adjusting your types but also defining a dfinsupp version of the syntax!

Eric Wieser (Dec 09 2023 at 22:26):

Though it would be cool to have a dfinsupp version anyway

Eric Wieser (Dec 09 2023 at 22:27):

Especially if we can use one syntax, and have it use the expected type to disambiguate

Eric Wieser (Dec 09 2023 at 22:28):

Eric Wieser said:

I already have an open PR attempting to do this

#6317, though it does not pass CI

Eric Wieser (Dec 09 2023 at 22:29):

Ah, this doesn't really solve the problem, as it still remains non-computable

Eric Wieser (Dec 09 2023 at 22:30):

(because it only adds DecidableEq ι not DecidableEq α)

Thomas Murrills (Dec 09 2023 at 22:30):

But it’s halfway there! :)

Eric Wieser (Dec 09 2023 at 22:31):

It has the merit of doing the half of the refactor that is shared between your proposal and replacing finsupp with an alias for dfinsupp

Eric Wieser (Dec 09 2023 at 22:31):

Where the second halves of those refsctors diverge

Eric Wieser (Dec 09 2023 at 22:33):

(also, please could you add this thread to the list of threads on the wiki page I link above?)

Thomas Murrills (Dec 09 2023 at 23:24):

(Done—had to run right as that message came in :P)


Last updated: Dec 20 2023 at 11:08 UTC