Zulip Chat Archive

Stream: new members

Topic: Support τ (tau) as the circle constant in fork of Mathlib?


Xuanmizhen (Aug 31 2025 at 13:16):

Hi, everyone! I'm new here. I'm considering supporting τ = 2π = 6.28318... in Mathlib.
As you may know, τ, defined to be the ratio of a circle’s circumference (length) to its radius, has been advocated for 15 years to be the "true circle constant", according to https://www.tauday.com/tau-manifesto. However, it seems that τ is still not supported in Mathlib.
To support τ, we'll introduce Real.tau, and have Mathlib.Data.Real.Tau.Irrational to prove that τ is irrational, etc.
I still have little knowledge about Lean, and I consider contributing τ as a chance to learn more about the Mathlib. Is there someone interested in this topic? Any suggestions? Glad to hear from you!

Aaron Liu (Aug 31 2025 at 13:17):

I don't think we need this

Aaron Liu (Aug 31 2025 at 13:18):

why can't we just use 2 * π everywhere

Aaron Liu (Aug 31 2025 at 13:20):

for the same reason we do exp 1 instead of defining Real.e

Xuanmizhen (Aug 31 2025 at 13:21):

Because, π is 1/2 τ, not that τ is 2 * π

Xuanmizhen (Aug 31 2025 at 13:22):

τists will find it comfortable to write without π.

Aaron Liu (Aug 31 2025 at 13:22):

well in mathlib π is defined as "twice an arbitrary zero of Real.cos between 1 and 2, which exists by the intermediate value theorem"

Xuanmizhen (Aug 31 2025 at 13:23):

That's interesting.

Xuanmizhen (Aug 31 2025 at 13:25):

Then how is Real.cos defined, if I may know?

Aaron Liu (Aug 31 2025 at 13:25):

anything can be defined in multiple ways and it doesn't really matter which one you pick as long as it's easy to work with and you can prove all the properties

Xuanmizhen (Aug 31 2025 at 13:26):

My long-term experience has told me that it is always more meaningful and more concise to write in τ, however.

Aaron Liu (Aug 31 2025 at 13:27):

Xuanmizhen said:

Then how is Real.cos defined, if I may know?

Real.cos is "the real part of Complex.cos", and Complex.cos is defined as z ↦ (exp (z * I) + exp (-z * I)) / 2, and Complex.exp is defined by its taylor series at zero

Xuanmizhen (Aug 31 2025 at 13:28):

Oh, I don't know Complex has cos before.

Xuanmizhen (Aug 31 2025 at 13:29):

I will learn what you told me further in the future. Anyway, I still believe my intuition, and one day I will write more elegant definitions with tau in the Mathlib, if I could.

Xuanmizhen (Aug 31 2025 at 13:29):

Do you know tau before?

Aaron Liu (Aug 31 2025 at 13:30):

yes

Xuanmizhen (Aug 31 2025 at 13:30):

Great.

Xuanmizhen (Aug 31 2025 at 14:00):

I've created an issue on GitHub. https://github.com/leanprover-community/mathlib4/issues/29175

Patrick Massot (Aug 31 2025 at 14:08):

I'm afraid this won't have any effect. I think you'll be a lot less frustrated if you focus on more productive quests.

Kevin Buzzard (Aug 31 2025 at 17:06):

Every definition comes with a cost and for the tau proposal, the cost outweighs the benefits. The way to do this if you want to write tau files is just to make tau an abbreviation for 2pi in your local files; this will work fine for everyone. In formalisation the more ways you have to say something the more lemmas you need to relate them and the more inefficient things get. In formalisation we need to be ergonomic.

Xuanmizhen (Sep 01 2025 at 00:53):

Patrick Massot said:

I'm afraid this won't have any effect. I think you'll be a lot less frustrated if you focus on more productive quests.

I understand. People dealing with τ in Mathlib have to have passion and a lot of spare time, and there's a great probability that I have to do it on my own, but I'll still do it.

Xuanmizhen (Sep 01 2025 at 01:03):

Kevin Buzzard said:

Every definition comes with a cost and for the tau proposal, the cost outweighs the benefits. The way to do this if you want to write tau files is just to make tau an abbreviation for 2pi in your local files; this will work fine for everyone. In formalisation the more ways you have to say something the more lemmas you need to relate them and the more inefficient things get. In formalisation we need to be ergonomic.

That's a good point to think about! However, I'm afraid that you may underestimate the value of formalising τ completely. We can have a more deeper understanding of the difference between τ and π, and we can see which of them, or both, have their unique meanings.
I don't know when you say ergonomic, whether you are referring to human labor, or you are referring to the cost when compiling. As for the former, I think there would be τists finding it valuable to work with. As for the latter, we may define some more abstract and common behaviors for both τ and π, so they can be reused.

Robin Arnez (Sep 01 2025 at 07:47):

Well the point is that there are really only three ways this could go:

  1. Use τ as the normal form. This is basically impossible due to backwards compatibility.
  2. Use π as the normal form and introduce τ merely as an abbreviation that gets simped away immediately (@[simp] abbrev Real.tau := 2 * Real.pi). This is possible but feels a bit pointless.
  3. Have both τ and π as normal forms. This only really introduces more complexity, e.g. π + τ = 3 * π is slightly harder to prove than π + 2 * π = 3 * π which already works well with many tactics.

Xuanmizhen (Sep 01 2025 at 07:53):

Yes. But well, no one would insert both π and τ in a same file.

Johan Commelin (Sep 01 2025 at 07:54):

This will definitely lead to a proliferation of definitions.

https://www.youtube.com/watch?v=1qpVdwizdvI

Next thing we know, someone will propose π/180\pi/180, and call it {}^\circ :see_no_evil:

Xuanmizhen (Sep 01 2025 at 08:03):

I'm afraid that the author of the video hasn't got the real thing of The Tau Manifesto.

Xuanmizhen (Sep 01 2025 at 08:07):

In fact, there's a constant called λ in The Tau Manifesto, defined to be τ / 4. We can say that λ has its meaning.

Damiano Testa (Sep 01 2025 at 08:58):

It is starting to dawn on me that not all of these discussions are ironic...

Kevin Buzzard (Sep 01 2025 at 10:22):

@Xuanmizhen this is formalization, not mathematics. Formalization has different rules to mathematics. In mathematics it's fine to have π\pi and τ\tau and λ\lambda if you want them. But in formalization it is not, because one needs what is called a "simp normal form". If we allow all three of these symbols to be "primitive" then this is a massive problem for formalization, because then the number of lemmas we need goes up by a factor of three, causing a huge amout of unnecessary overhead. So we have to decide the precisely one of these is "primitive" and already we decided that the answer is that the primitive one is π\pi. You might not like that decision, but that decision is not going to change, because changing it would be a gigantic amount of work, for no benefit as far as formalization is concerned; it would just be "churn". So the way to introduce τ\tau would be to define it to be 2π2\pi and then immediately teach the system to replace τ\tau by 2π2\pi everywhere (i.e. make τ\tau not "primitive"). This is completely pointless as far as mathlib is concerned because we gain nothing. It is true that there are some lemmas in mathlib which mention 2π2\pi which then become "simpler" with τ\tau, but from the point of view of formalization it is still a bad idea to make this change, because as I already explained it is more important for formalization to have one "normal form" for everything than it is to have lemmas which are three characters shorter. This is why mathlib is not interested in having τ\tau. Let me stress that rhis is nothing to do with the Tau manifesto debate -- this is a pragmatic decision based on how the formalization of mathematics is done. The fact that some lemmas would be slightly shorter with τ\tau, and some would be slightly longer, and that maybe it is the case that more would be shorter than longer (or maybe it is not the case) is irrelevant; what is relevant is that we cannot support 3 times as many lemmas about fundamental terms in this situation because it is too much pain for too little gain, and we already put too much effort into making π\pi the fundamental term.

In short: arguments from formalization override arguments from the Tau manifesto, because mathlib is a formalization project.

There is nothing stopping you having τ\tau in your own project.

Xuanmizhen (Sep 01 2025 at 10:33):

@Kevin Buzzard Thanks for telling me about these things. I’ll fork Mathlib and do it on my own, and τists may be interested in it. Now I understand that the standard Mathlib has good reasons not introducing τ, so temporarily I won’t consider contributing τ to Mathlib again. When I get my stuff done, I’ll show the link to my fork here, so everyone can see it. In my project, there would be no π at all.

Eric Wieser (Sep 01 2025 at 10:37):

For you own project, you can just add:

import Mathlib

open scoped Real in
scoped[Real] notation "τ" => 2 * π

there is no need to fork mathlib

Xuanmizhen (Sep 01 2025 at 10:38):

No. I'll define τ directly, and prove properties about it.

Xuanmizhen (Sep 01 2025 at 10:38):

I'll delete pi in my fork.

Kevin Buzzard (Sep 01 2025 at 10:43):

This (deleting pi) will be a huge undertaking! Good luck!

Kevin Buzzard (Sep 01 2025 at 10:45):

One thing you will have to decide is that for all the lemmas which mention π\pi but not 2π2\pi, whether to represent this as tau / 2 or tau * 0.5 or tau * 2^{-1} or 0.5 * tau or ... . Formally, all of these things are different.

Xuanmizhen (Sep 01 2025 at 10:46):

Okay. Thanks for telling me that.

Xuanmizhen (Sep 01 2025 at 10:56):

If anyone finds that someone has implemented τ in their Mathlib fork, please let me know, so I don't need to do it again.

Damiano Testa (Sep 01 2025 at 11:30):

There may be only about 1589 declarations that mention docs#Real.pi.

These are the first 100 (in alphabetical order)

Xuanmizhen (Sep 01 2025 at 11:32):

Pretty good.

Eric Wieser (Sep 01 2025 at 11:33):

https://loogle.lean-lang.org/?q=Real.pi finds many fewer

Damiano Testa (Sep 01 2025 at 11:33):

Does that also look inside proofs?

Xuanmizhen (Sep 01 2025 at 11:33):

Are there other things I need to take care of when creating τ in my version of Mathlib?

Damiano Testa (Sep 01 2025 at 11:35):

Damiano Testa said:

Does that also look inside proofs?

Indeed, docs#AddChar.zmod_injective does not appear if you search for both, but AddChar.zmod_injective uses Real.pi in its proof.

Xuanmizhen (Sep 01 2025 at 11:37):

Currently, I've got a fork at https://github.com/Xuanmizhen/mathlib4, but I haven't done anything.

Xuanmizhen (Sep 01 2025 at 11:38):

When I delete π in my fork, I'll see what depend on it.

Ruben Van de Velde (Sep 01 2025 at 12:21):

Have fun!

Xuanmizhen (Sep 01 2025 at 13:20):

Is it possible to define tau as the period of sin or cos?

Notification Bot (Sep 01 2025 at 13:33):

This topic was moved here from #mathlib4 > Support τ (tau) as the circle constant in Mathlib? by Johan Commelin.

Johan Commelin (Sep 01 2025 at 13:34):

I've moved this out of the #mathlib4 channel, since this is now a discussion about work in a personal fork.

Johan Commelin (Sep 01 2025 at 13:34):

Xuanmizhen said:

Is it possible to define tau as the period of sin or cos?

Certainly!

Johan Commelin (Sep 01 2025 at 13:34):

There is probably a lemma in mathlib, showing that they are periodic. The proof might use pi though.

Xuanmizhen (Sep 01 2025 at 13:37):

OK. Then I think maybe I can prove these lemmas with λ, which is τ / 4. I'll define λ first, prove the period, and define τ.

Xuanmizhen (Sep 01 2025 at 13:38):

Then prove τ = 4 * λ and λ = (1 / 4) * τ

Eric Wieser (Sep 02 2025 at 20:32):

(deleted)


Last updated: Dec 20 2025 at 21:32 UTC