Zulip Chat Archive

Stream: Is there code for X?

Topic: Gcd of a set of natural numbers or integers


Alex J. Best (Jun 17 2022 at 17:23):

I have a possibly infinite set of integers (or naturals), that I'd like to take the GCD of.
What is the best way to do this (i.e. most available lemmas) with mathlib currently?
My best attempt so far is to take the generator of the integer ideal generated by the set using docs#submodule.is_principal.generator. But something that uses the normalization gcd monoid stucture sounds better (so that the gcd is positive), is there such an instance using Sup already?

Eric Wieser (Jun 17 2022 at 17:32):

I guess you want a type alias that defines sup = gcd?

Eric Wieser (Jun 17 2022 at 17:33):

Which came up before in https://leanprover.zulipchat.com/#narrow/stream/217875-Is-there-code-for-X.3F/topic/Gcd.20type.20tags/near/210707674

Alex J. Best (Jun 17 2022 at 19:37):

Yeah I thought associates would be the right thing, which in the case of nat is an equivalent type. But a type alias might be the right answer in general


Last updated: Dec 20 2023 at 11:08 UTC