Zulip Chat Archive
Stream: general
Topic: semiquot
Mario Carneiro (May 09 2018 at 10:28):
A minor advertisement for data/semiquot
because I think it's a cool idea. I've mentioned this approach before, but this data type makes it easy to work with nondeterministic functions using quotient types.
An application is in fp/basic
, floating point numbers. Previously, we had to keep track of messy NaN payload data, which is not reliably handled across different processors, causing some unavoidable nondeterminism. Now, there is only one NaN value, and functions that leak NaN payload data (like float.sign
) are semiquot
so that they are allowed to return anything in that case. (We don't currently have a float.bits
function that gives the bitwise representation of a float, but that would of course leak NaN payload data so it would also be semiquot
.)
Patrick Massot (May 09 2018 at 10:47):
Is this meant only for programming or could be useful for maths?
Mario Carneiro (May 09 2018 at 10:49):
It has some interesting mathematical structure, being an ordered monad with some filter-like closure properties, but in classical lean it is equivalent to the collection of nonempty subsets of A
Mario Carneiro (May 09 2018 at 10:50):
It's most interesting when viewed constructively
Patrick Massot (May 09 2018 at 10:50):
Ok, thanks for confirming I was not in the target audience of this message.
Mario Carneiro (May 09 2018 at 10:53):
I think the correct answer is it is meant for verified programming, which of course involves both programming and math, but the math is probably not so interesting to you
Patrick Massot (May 09 2018 at 12:14):
Thanks for the advertisement anyway, I think it's a good idea to advertise each new stuff in mathlib here
Last updated: Dec 20 2023 at 11:08 UTC