Zulip Chat Archive

Stream: new members

Topic: Finset.instRepr


Violeta Hernández (Sep 13 2024 at 05:39):

What is this sorcery? docs#Finset.instRepr

Violeta Hernández (Sep 13 2024 at 05:40):

Surely it should be impossible to consistently print a Finset without having some extra structure like a linear order? And why is this unsafe?

Violeta Hernández (Sep 13 2024 at 05:40):

Is it somehow looking inside the quotient?

Violeta Hernández (Sep 13 2024 at 05:42):

Oh apparently the magic is happening at docs#Multiset.instRepr

Violeta Hernández (Sep 13 2024 at 05:43):

Oh here it is docs#Quot.unquot

Violeta Hernández (Sep 13 2024 at 05:44):

I guess my new question is, why does Lean allow this? Surely you can easily prove False by using this

Violeta Hernández (Sep 13 2024 at 05:44):

Does it count as using new axioms?

Yakov Pechersky (Sep 13 2024 at 06:04):

You can't prove things about unsafe

Yakov Pechersky (Sep 13 2024 at 06:06):

It works exactly how Quot.unquot describes. The quotient, computationally, still holds the unquotiented value in the VM. So we can repr the finset by printing the list that is wrapped.

Yakov Pechersky (Sep 13 2024 at 06:08):

A related question is, well, if quotient values are really the underlying base types underneath, wouldn't it be possible to sniff out if two quotients' representatives are _really_ equal by a timing attack, if evaluating the relation is faster in the equality case?

Daniel Weber (Sep 13 2024 at 13:19):

It seems like it should definitely be possible, yes. Isn't that the expected behaviour?

Kyle Miller (Sep 13 2024 at 18:54):

In general, even if x = y, the running times for #eval x and #eval y can be very different.


Last updated: May 02 2025 at 03:31 UTC