Zulip Chat Archive

Stream: general

Topic: How does fin deal with negatives


Henrik Böving (Aug 22 2021 at 23:26):

While playing around with the fin type I noticed that I can e.g. do -1 : fin 3 and it will automatically turn that value into a 2. I got curious about the mechanism and digged around in the fin definition here: https://github.com/leanprover-community/lean/tree/master/library/init/data/fin but I couldn't even find something that relates to the integers. Could someone point me at the right spot?

Yakov Pechersky (Aug 23 2021 at 00:01):

docs#fin.comm_ring

Yakov Pechersky (Aug 23 2021 at 00:03):

Specifically, subtraction is docs#fin.sub and negatives are docs#fin.has_neg


Last updated: Dec 20 2023 at 11:08 UTC