Zulip Chat Archive

Stream: maths

Topic: a problem of reduction in lean4


Junqi Liu (May 03 2024 at 15:49):

how to solve x(1x)y(1y)z(1z)/(2(1x)(xz)2(1y)((1z)y))x(1x)y(1y)z(1z)/4x * (1 - x) * y * (1 - y) * z * (1 - z) / (2 * √(1 - x) * √(x * z) * 2 * √(1 - y) * √((1 - z) * y)) ≤ √x * √(1 - x) * √y * √(1 - y) * √z * √(1 - z) / 4 for x,y,z(0,1)x, y, z \in (0,1) in lean4?

Riccardo Brasca (May 03 2024 at 15:52):

Can you explain the math proof?

Jireh Loreaux (May 03 2024 at 16:00):

Aren't those two sides just equal?

Riccardo Brasca (May 03 2024 at 16:03):

Ahah, yes, it seems they're equal!

Junqi Liu (May 03 2024 at 16:03):

Jireh Loreaux said:

Aren't those two sides just equal?

yeah. But that doesn't affect the proof, does it?

Junqi Liu (May 03 2024 at 16:05):

Jireh Loreaux said:

Aren't those two sides just equal?

This is just a step to divide the numerator and the denominator.

Jireh Loreaux (May 03 2024 at 16:07):

ahhwuhu said:

yeah. But that doesn't affect the proof, does it?

sure it does. You can apply more lemmas / tactics with equality.

Jireh Loreaux (May 03 2024 at 16:08):

In the hope that automation would make my life easy, I would rewrite the numerator of the left-hand side into a bunch of square roots, use positivity to conclude they are all nonzero, and then use field_simp and pray.

Junqi Liu (May 03 2024 at 16:10):

oh! You're absolutely right! But I want to know why the simp command doesn't work?

Jireh Loreaux (May 03 2024 at 16:10):

what do you mean? what do you expect simp to do exactly?

Junqi Liu (May 03 2024 at 16:11):

Can simp not be divided directly?

Jireh Loreaux (May 03 2024 at 16:12):

I'm not sure what you mean.

Junqi Liu (May 03 2024 at 16:14):

emmmmmm. I mean, like x2x=x\frac{x^2}{x} = x, can I successfully prove it directly using simp command?

Andrew Yang (May 03 2024 at 16:15):

This is false in mathlib for x = 0.

Andrew Yang (May 03 2024 at 16:16):

So simp won't work directly. Maybe if you give it a h : x =/= 0 then simp [h] will work.

Junqi Liu (May 03 2024 at 16:16):

sure! But if x(0,1)x \in (0,1), does it ok?

Riccardo Brasca (May 03 2024 at 16:17):

Yes, if x is different from 0 then this is true, but the point is that division in Lean is trickier than one usually thinks

Riccardo Brasca (May 03 2024 at 16:18):

field_simp is supposed to help, but you need to give it the fact that the denominator is different from 0.

Junqi Liu (May 03 2024 at 16:19):

Riccardo Brasca said:

Yes, if x is different from 0 then this is true, but the point is that division in Lean is trickier than one usually thinks

Thanks! I feel that. Let me have a try!

Andrew Yang (May 03 2024 at 16:19):

For example this works

import Mathlib

example {x : } (hx : x  0) : (x * x) / x = x := by simp [hx]

But you'll need to let simp know about x ≠ 0 manually.

Yaël Dillies (May 03 2024 at 16:19):

Andrew Yang said:

This is false in mathlib for x = 0.

Actually it is true!

Jireh Loreaux (May 03 2024 at 16:20):

Here's a proof:

example (x y z : ) (hx : 0 < x) (hx' : 0 < 1 - x) (hy : 0 < y) (hy' : 0 < 1 - y) (hz : 0 < z) (hz' : 0 < 1 - z) :
    x * (1 - x) * y * (1 - y) * z * (1 - z) / (2 * (1 - x) * (x * z) * 2 * (1 - y) * ((1 - z) * y)) =
      x * (1 - x) * y * (1 - y) * z * (1 - z) / 4 := by
  field_simp
  nth_rewrite 1 [ Real.mul_self_sqrt hx.le,  Real.mul_self_sqrt hy.le,  Real.mul_self_sqrt hz.le]
  conv_lhs =>
    rw [ Real.mul_self_sqrt hx'.le,  Real.mul_self_sqrt hy'.le,  Real.mul_self_sqrt hz'.le]
  ring

Andrew Yang (May 03 2024 at 16:21):

Oh I thought 0/0 = 1...

Junqi Liu (May 03 2024 at 16:21):

example (x y z : ) (x0 : 0 < x) (x1 : x < 1) (y0 : 0 < y) (y1 : y < 1) (z0 : 0 < z) (z1 : z < 1) : x * (1 - x) * y * (1 - y) * z * (1 - z) / (2 * (1 - x) * (x * z) * 2 * (1 - y) * ((1 - z) * y)) =
  x * (1 - x) * y * (1 - y) * z * (1 - z) / 4

Can anyone help me solve it?

Jireh Loreaux (May 03 2024 at 16:22):

@ahhwuhu see my post just above.

Junqi Liu (May 03 2024 at 16:22):

Jireh Loreaux said:

just

Very thanks! Let me see!

Junqi Liu (May 03 2024 at 16:24):

And I have another question. Is there any difference between my use of x\sqrt{x} and Real.sqrt x?

Jireh Loreaux (May 03 2024 at 16:35):

no, they're the same.

Junqi Liu (May 03 2024 at 16:35):

okk! Thanks a lot!


Last updated: May 02 2025 at 03:31 UTC