Zulip Chat Archive
Stream: new members
Topic: cube root of 8 is equal to 2
Alex Gu (Aug 19 2025 at 20:41):
I'm not sure how to show this simple result, is there a short proof of it?
theorem c8 : (8 : ℝ) ^ (1 / 3 : ℝ) = 2 := by sorry
Kenny Lau (Aug 19 2025 at 20:46):
@Alex Gu Please remember to put the correct imports for an #mwe:
import Mathlib
theorem c8 : (8 : ℝ) ^ (1 / 3 : ℝ) = 2 := by
rw [one_div, Real.rpow_inv_eq]
all_goals norm_num
Alex Gu (Aug 19 2025 at 20:49):
thanks! and sorry about that :)
Louis Cabarion (Aug 19 2025 at 21:32):
Here’s how I solved it step by step:
- Type
apply?. - The first suggestion seems to yield easy subgoals:
Try this: refine (Real.eq_rpow_inv ?_ ?_ ?_).mp ?_
Remaining subgoals:
⊢ 0 ≤ 8
⊢ 0 ≤ 2
⊢ 1 / 3 ≠ 0
⊢ 8 = 2 ^ (1 / 3)⁻¹
- Click the suggested
refineline. Now you haverefine (Real.eq_rpow_inv ?_ ?_ ?_).mp ?_with four subgoals. - Since all the subgoals are equalities and inequalities which involve only normalised numerical expressions,
norm_numwill take care of them. Usenorm_numfour times and watch each goal get solved. - Finally, clean up everything:
import Mathlib
theorem c8 : (8 : ℝ) ^ (1 / 3 : ℝ) = 2 := by
refine (Real.eq_rpow_inv ?_ ?_ ?_).mp ?_ <;> norm_num
Louis Cabarion (Aug 19 2025 at 21:59):
Alternative:
import Mathlib
theorem c8 : (8 : ℝ) ^ (1 / 3 : ℝ) = 2 :=
(Real.eq_rpow_inv (by simp) (by simp) (by simp)).mp (by norm_num)
Louis Cabarion (Aug 19 2025 at 22:10):
@Kenny Lau Out of curiosity, could you share a step-by-step account of how you arrived at that proof (assuming you didn’t already know the lemma names by heart)?
Kenny Lau (Aug 19 2025 at 22:14):
Thanks for the invitation.
- I first tried
simp?, and saw that the goal became⊢ 8 ^ 3⁻¹ = 2, so I took the lemmaone_divand rewrited using it as the first step. - Then I see that I want a lemma about something to the power of an inverse, and I know the library spelling for these operations (rpow is special for real power), so I typed
rpow_invand hit Ctrl+Space, which gives me a list of suggestions, and the second one is exactly what I need:
- Then I see that all the 4 goals generated are within the scope of
norm_num, so that's what I did next.
Kyle Miller (Aug 19 2025 at 22:19):
Another way is to realize that if you cube both sides then you can cancel things, then everything's the kind of number that norm_num can handle.
import Mathlib
theorem c8 : (8 : ℝ) ^ (1 / 3 : ℝ) = 2 := by
suffices ((8 : ℝ) ^ (1 / 3 : ℝ)) ^ (3 : ℝ) = 2 ^ (3 : ℝ) by
rwa [Real.rpow_left_inj] at this <;> norm_num
positivity
rw [← Real.rpow_mul] <;> norm_num
Weiyi Wang (Aug 19 2025 at 22:26):
I am surprised this isn't a norm_num one-liner. Can we make it happen?
Kenny Lau (Aug 19 2025 at 22:27):
i think this will complicate things and might require something about computable reals which to my understanding is a bit of a far away goal
Weiyi Wang (Aug 19 2025 at 22:28):
Oh right, forgot about noncomputable reals :grimacing:
Aaron Liu (Aug 19 2025 at 22:29):
Weiyi Wang said:
I am surprised this isn't a norm_num one-liner. Can we make it happen?
yes
Aaron Liu (Aug 19 2025 at 22:29):
you don't need any computable reals either
Aaron Liu (Aug 19 2025 at 22:30):
but it'll only work when doing a rational power of a rational number where the answer is rational
Kenny Lau (Aug 19 2025 at 22:30):
(where everything is positive)
Aaron Liu (Aug 19 2025 at 22:31):
I guess we could support negative powers too
Kenny Lau (Aug 19 2025 at 22:31):
(edit: where the base is positive)
Kyle Miller (Aug 19 2025 at 22:31):
@Weiyi Wang The design of norm_num is to be able to normalize numeric expressions, and it chooses to only do it for families of expressions that it can always normalize. That limits it to mostly numeric expressions involving integers and rationals, and not powers with a non-integer exponent. (Here, "natural", "integer", etc. refer to the numbers inside a given number system, like Real. It doesn't have to be Nat, Int, Rat, etc.)
I'd suggested adding some root normalization once and Mario pushed back. I might have forgotten the context by now though.
Aaron Liu (Aug 19 2025 at 22:31):
negative bases too
Kenny Lau (Aug 19 2025 at 22:31):
mathlib doesn't have that refactor yet
Kenny Lau (Aug 19 2025 at 22:32):
I do support a refactor to make (-8)^(1/3) = -2, at the cost of the purists
Louis Cabarion (Aug 19 2025 at 22:32):
@Alex Gu A shorter proof:
import Mathlib
theorem c8 : (8 : ℝ) ^ (1 / 3 : ℝ) = 2 := by
rw [← Real.eq_rpow_inv] <;> norm_num
Aaron Liu (Aug 19 2025 at 22:32):
Niven's theorem guarantees that when everything is rational there are only like 2 extra cases for negative base
Kyle Miller (Aug 19 2025 at 22:32):
You can make a simproc, it doesn't have to be norm_num.
Aaron Liu (Aug 19 2025 at 22:33):
this feels like it's in-scope for norm_num
Aaron Liu (Aug 19 2025 at 22:33):
it could also be a simproc
Aaron Liu (Aug 19 2025 at 22:33):
Kenny Lau said:
I do support a refactor to make (-8)^(1/3) = -2, at the cost of the purists
how will you make it continuous
Kenny Lau (Aug 19 2025 at 22:33):
Aaron Liu said:
Kenny Lau said:
I do support a refactor to make (-8)^(1/3) = -2, at the cost of the purists
how will you make it continuous
I claim that nobody cares about the function (-8)^x
Aaron Liu (Aug 19 2025 at 22:34):
Kenny Lau said:
mathlib doesn't have that refactor yet
you don't need a refactor to evaluate (-8)^(1/3) = 1
Kenny Lau (Aug 19 2025 at 22:34):
?
Aaron Liu (Aug 19 2025 at 22:34):
I think it's true
Aaron Liu (Aug 19 2025 at 22:36):
I found docs#Mathlib.Meta.NormNum.evalRPow but right now it only does Int exponents
Louis Cabarion (Aug 19 2025 at 22:36):
Here is the step by step procedure:
- Type
rw??. - Shift-click "8 ^ (1 / 3) = 2" in the InfoView.
- Note the rewrite suggestion:
8 = 2 ^ (1 / 3)⁻¹
⊢ 0 ≤ 8
⊢ 0 ≤ 2
⊢ 1 / 3 ≠ 0
- Click on that suggestion and get
rw [← Real.eq_rpow_inv ?_ ?_ ?_]. - Note that we now have four goals easily solved by
norm_num. - Tidy up:
import Mathlib
theorem c8 : (8 : ℝ) ^ (1 / 3 : ℝ) = 2 := by
rw [← Real.eq_rpow_inv] <;> norm_num
Kenny Lau (Aug 19 2025 at 22:37):
(-8)^(1/3) = exp (y log x) cos (π y) = exp (log (-8) / 3) cos (π/3) = exp ((log(8) + i π)/3) cos (π/3) and wolfram alpha says its real part is 1/2 @Aaron Liu
Kenny Lau (Aug 19 2025 at 22:37):
and this is too deep in the junk value territory for me to care
Aaron Liu (Aug 19 2025 at 22:38):
Kenny Lau said:
(-8)^(1/3) = exp (y log x) cos (π y) = exp (log (-8) / 3) cos (π/3) = exp ((log(8) + i π)/3) cos (π/3)and wolfram alpha says its real part is 1/2 Aaron Liu
Must have been off by one somewhere
Eric Wieser (Aug 20 2025 at 00:31):
#26935 might be of interest WRT the cbrt (-8) question
Eric Wieser (Aug 20 2025 at 00:31):
@Kenny Lau, (-8)^(1/3) = 1 I think
Aaron Liu (Aug 20 2025 at 00:46):
so I wasn't off by one after all
Kenny Lau (Aug 20 2025 at 00:49):
Kenny Lau (Aug 20 2025 at 00:49):
I see that I have misinterpreted this docstring
Kenny Lau (Aug 20 2025 at 00:50):
I think for clarity the docstring should
spoiler
Aaron Liu (Aug 20 2025 at 01:09):
Kenny Lau said:
I think for clarity the docstring should
spoiler
Did you read the docstring of docs#Real.log
Kenny Lau (Aug 20 2025 at 01:09):
yes
Last updated: Dec 20 2025 at 21:32 UTC