Zulip Chat Archive

Stream: general

Topic: tactics to calculate the area of ​​a circle


ZHAO Jinxiang (Dec 23 2024 at 18:39):

import Mathlib

example : (MeasureTheory.volume {(a, b) :  ×  | a ^ 2 + b ^ 2 < 1}).toReal = π := by
  sorry

Is there any tactics to calc this?

Kevin Buzzard (Dec 23 2024 at 18:45):

You don't want a tactic to prove this -- you want a theorem in the library. The proof isn't "apply some generally and widely-applicable technique" such as the technique which simultaneously proves (x+y)2=x2+2xy+y2(x+y)^2=x^2+2xy+y^2 and (x+y)(xy)=x2y2(x+y)(x-y)=x^2-y^2. The result you want reduces (after some calculation) to an explicit integral, and integrals are an art. Tactics are science.

Edward van de Meent (Dec 23 2024 at 18:51):

i feel like there should be a better way to spell "the circle around 0,0" than just writing out the definition... i gave it a try, but it seems that with current mathlib, you get (ball ((WithLp.equiv 2 (ℝ × ℝ)).symm (0,0)) 1)? but there isn't a MeasureSpace instance for WithLp 2 (ℝ × ℝ)...

Eric Wieser (Dec 23 2024 at 18:57):

example : (MeasureTheory.volume (ball (!₂[(0 : ), 0]) 1)).toReal = π := by
  sorry

works

Eric Wieser (Dec 23 2024 at 19:01):

But we should probably add the missing

instance : MeasurableSpace (WithLp p ( × )) := Prod.instMeasurableSpace
instance : BorelSpace (WithLp p ( × )) := Prod.borelSpace

Eric Wieser (Dec 23 2024 at 19:01):

Which makes your version work

Eric Wieser (Dec 23 2024 at 19:01):

(We already did this for the Pi version)

Edward van de Meent (Dec 23 2024 at 19:02):

shouldn't you at some point have to prove that the product topology is compatible with the new norm?

Edward van de Meent (Dec 23 2024 at 19:06):

i.e. shouldn't there be a MetricSpace instance here? there already is. i really should look first

Eric Wieser (Dec 23 2024 at 21:58):

I think the result you're thinking of is that we should prove that WithLp.equiv is measure preserving on prod types (which we got for Pi types in #7037)

Yury G. Kudryashov (Dec 23 2024 at 22:46):

Should we have a generic MeasurableSpace instance on WithLp p X instead?

Yury G. Kudryashov (Dec 23 2024 at 22:46):

BTW I think that #new members is a better channel for questions like this one.

Eric Wieser (Dec 23 2024 at 22:57):

Yury G. Kudryashov said:

Should we have a generic MeasurableSpace instance on WithLp p X instead?

Seems reasonable, though we should check whether we decided against this in the previous discussion

Eric Wieser (Dec 23 2024 at 22:59):

It looks like inheriting the MeasurableSpace would be ok, but inheriting the MeasureSpace would create diamonds

Johan Commelin (Dec 24 2024 at 05:29):

Kevin Buzzard said:

The result you want reduces (after some calculation) to an explicit integral, and integrals are an art. Tactics are science.

I think we can aim for a bit more. There are various software packages out there that will calculate a bunch of integrals for you. And some of them can even leave step-by-step traces of how the computation goes.
It would be great to tactify that. And of course it will not be able to handle every integral out there. But if it handles the common cases, that will already be good.

Ruben Van de Velde (Dec 24 2024 at 07:18):

That sounds like a Project - maybe someone could file an issue


Last updated: May 02 2025 at 03:31 UTC