Zulip Chat Archive

Stream: general

Topic: nat.dist


Yaël Dillies (Jun 11 2021 at 20:47):

i just came across nat.dist and I'm a bit puzzled. It's only ever used in data.ordmap.ordset. Is it generalised by other stuff in the library? Does it matter?

Anne Baanen (Jun 12 2021 at 09:48):

To save others a click, dist is the symmetric distance, defined as (n - m) + (m - n) or equivalently int.nat_abs (n - m : ℤ).

Mario Carneiro (Jun 12 2021 at 09:49):

it is the nat version of the dist function on metric spaces (which is real-valued)

Anne Baanen (Jun 12 2021 at 09:49):

I don't see an issue with keeping it. There are quite a few places where we use abs (n - m) where n m are already in some ring (see e.g. usages of docs#abs_sub), but it's not immediate to go from that to nat.dist.

Yaël Dillies (Jun 12 2021 at 10:06):

Okay sure :smile: . I just thought that because it's now a really old file in an isolated part of the library.


Last updated: Dec 20 2023 at 11:08 UTC