Zulip Chat Archive

Stream: mathlib4

Topic: Missing simp lemma


Michael Stoll (Jun 22 2025 at 15:53):

Note the following:

import Mathlib

example : (1 / 2 : ) + (1 / 2) = 1 := by
  simp -- leaves `2⁻¹ + 2⁻¹ = 1`
  sorry

example : (1 / 2 : ) + (1 / 2) = 1 := by
  simp [-one_div] -- succeeds using `add_halves`

So it seems that we need 2⁻¹ + 2⁻¹ = 1 as a simp lemma. It currently exists only for docs#ENNReal , for whatever strange reason:

@loogle 2⁻¹ + 2⁻¹ = 1

loogle (Jun 22 2025 at 15:53):

:search: ENNReal.inv_two_add_inv_two

Robin Arnez (Jun 22 2025 at 15:54):

norm_num should be sufficient, no?

Michael Stoll (Jun 22 2025 at 15:55):

But we still want simp to be confluent.

Robin Arnez (Jun 22 2025 at 15:55):

Yeah, good point

Robin Arnez (Jun 22 2025 at 15:57):

Yeah we should probably have 2⁻¹ + 2⁻¹ = 1 and 3⁻¹ + 3⁻¹ + 3⁻¹ = 1 corresponding to add_halves and add_thirds

Kevin Buzzard (Jun 22 2025 at 16:30):

Apparently asking that simp be confluent is asking too much in general?

Ruben Van de Velde (Jun 22 2025 at 16:42):

It is, but we should still aim for it

Bolton Bailey (Jun 22 2025 at 17:05):

I got annoyed that sin (π / 2) = 1 but sin (π * 2⁻¹) = 1 wasn't so I filed #25912 and @Yaël Dillies suggested I could try making the reverse of div_eq_mul_inv a simp lemma. This would mean that 2⁻¹ would simplify to 1 / 2. Perhaps at that point we could make div_add_div_same a simp lemma to make 2⁻¹ + 2⁻¹ -> 1/2 + 1/2 -> 1+1/2 -> 1 happen automatically.

Yaël Dillies (Jun 22 2025 at 17:08):

Bolton Bailey said:

This would mean that 2⁻¹ would simplify to 1 / 2.

What?

Bolton Bailey (Jun 22 2025 at 17:10):

Oh sorry, maybe I am still stuck on my earlier misunderstanding of what you were saying, you were saying that a * b.inv should simplify to a / b, but that a.inv shouldn't simplify to 1/a right? My bad.

Bolton Bailey (Jun 22 2025 at 17:15):

Anyway, I had thought it was cleaner to make a⁻¹ simplify to 1 / a, which would just remove expressions involving ⁻¹ from simp normal form entirely. I guess this would mean making inv_eq_one_div simp too

Yaël Dillies (Jun 22 2025 at 17:21):

Yes, no, that's a step too far IMO

Kenny Lau (Jun 22 2025 at 17:28):

Kevin Buzzard said:

Apparently asking that simp be confluent is asking too much in general?

Why?

Kevin Buzzard (Jun 22 2025 at 17:30):

Yeah I was surprised by this but a few months ago I was suggesting some trig lemmas to make simp confluent and this was the response I got. I can't find the thread right now because I'm travelling and on mobile which no longer has a search function?

Eric Wieser (Jun 22 2025 at 18:01):

I deliberately blocked the update to the new mobile Zulip because of teething issues like that (and losing LaTeX). Their release notes tell you how to manually install the old version

Eric Wieser (Jun 22 2025 at 18:02):

Bolton Bailey said:

I guess this would mean making inv_eq_one_div simp too

I think we should make it simp in the reverse direction

Eric Wieser (Jun 22 2025 at 18:03):

The one_divs are quite annoying when using PiLp

Kenny Lau (Jun 22 2025 at 18:03):

I think either way we'll end up having to change/add a lot of simp lemmas

Kenny Lau (Jun 22 2025 at 18:03):

I don't see the harm of starting with 2^-1 + 2^-1 = 1


Last updated: Dec 20 2025 at 21:32 UTC