Zulip Chat Archive

Stream: lean4

Topic: Haskell 'Num'-like class hierarchy


Yuri de Wit (Feb 04 2022 at 14:54):

Having a small bit of experience with Haskell, I am wondering if there is a general class hierarchy for numbers in Lean4?

Simon Hudon (Feb 04 2022 at 21:07):

Those existed in the core library in Lean 3 but they will be (or are?) part of Mathlib4 instead.

What is in core is OfNat a n which allows you to use numerals for your number type -- specifically, it allows you to use natural number n as a numeral. For other classes such as Num, Real, etc, the Lean classes will more closely follow mathematical convention and provide Monoid, Group, SemiRing, Ring, Field, etc which are more useful because we can put the right laws into them


Last updated: Dec 20 2023 at 11:08 UTC