Zulip Chat Archive
Stream: Is there code for X?
Topic: Existence of irrational ^ irrational becomes rational
Seewoo Lee (Dec 11 2024 at 16:37):
There's a well known proof (using the law of excluded middle) which shows existence of and such that , using (I don't know the original reference, but here's an argument). I just wrote the proof yesterday, and realized that it is not in mathlib4 yet. So I may make PR for this, and I wonder if there are any comments for that.
One comment I got is that we also have so that we don't need law of excluded middle (source) - although I haven't formalized this yet (but it shouldn't be hard).
Junyan Xu (Dec 11 2024 at 17:00):
There's one previous discussion of the first proof, and I'm surprised I couldn't find more ...
Seewoo Lee (Dec 12 2024 at 00:31):
FYI, here's a proof that hasn't golfed yet:
/-
Prove that there exists a, b ∉ ℚ such that a^b ∈ ℚ.
Here's a proof in natural language:
Consider c = √2^√2. If c is rational, we are done. If c is irrational, then c^√2 = 2 is rational, so we are done.
-/
import Mathlib.Algebra.Algebra.Rat
import Mathlib.Data.Real.Irrational
import Mathlib.Analysis.SpecialFunctions.Pow.Real
open Classical Real Set
-- Proof of irrationality of √2 already exists in mathlib.
theorem sqrt2_irrational : Irrational (√2) := irrational_sqrt_two
theorem sqrt2_pow_sqrt2_pow_sqrt2_eq_2 : (√2 ^ √2) ^ √2 = 2 := by
have h2s : √2 * √2 = 2 := mul_self_sqrt (by norm_num)
rw [← rpow_mul, h2s, rpow_two, sq_sqrt]
norm_num
exact sqrt_nonneg 2
theorem ne_irrational_eq_rational (a : ℝ) : ¬ Irrational a ↔ ∃ (q : ℚ), a = q := by
constructor
· intro h
rw [Irrational, not_not, mem_range] at h
obtain ⟨q, ha⟩ := h
use q
simp [ha]
· rintro ⟨q, ha⟩ h
rw [Irrational, mem_range] at h
apply h
use q
simp [ha]
theorem exist_irrat_power_rat : ∃ a b : ℝ, Irrational a ∧ Irrational b
∧ ∃ (q : ℚ), a ^ b = q := by
let c := √2 ^ √2
by_cases hc : Irrational c
· -- c is irrational
use c, √2
constructor
· exact hc
· constructor
· exact sqrt2_irrational
· use 2
exact sqrt2_pow_sqrt2_pow_sqrt2_eq_2
· -- c is rational
use √2, √2
constructor
· exact sqrt2_irrational
· constructor
· exact sqrt2_irrational
· rw [ne_irrational_eq_rational] at hc
obtain ⟨q, hc⟩ := hc
use q
Matt Diamond (Dec 12 2024 at 01:44):
import Mathlib
open Real
example : ∃ (a b : ℝ) (_ : Irrational a) (_ : Irrational b), ¬Irrational (a ^ b) :=
by
by_cases h : Irrational (√2 ^ √2)
· use √2 ^ √2, √2, h, irrational_sqrt_two, by simp [← rpow_mul (sqrt_nonneg _)]
· use √2, √2, irrational_sqrt_two, irrational_sqrt_two, h
Yury G. Kudryashov (Dec 12 2024 at 03:17):
You should assume that a
is positive (it's trivial), otherwise Mathlib definition of rpow
is very strange.
Matt Diamond (Dec 12 2024 at 03:46):
oh, are you saying that a ^ b
doesn't necessarily mean what we think it means unless we assume a
is positive?
Matt Diamond (Dec 12 2024 at 03:55):
ah, I see docs#Real.rpow_def_of_neg ... good point
Kevin Buzzard (Dec 12 2024 at 10:10):
I guess that depends on what you think (-1)^(1/2) means!
Jz Pan (Dec 12 2024 at 10:57):
Seewoo Lee said:
so that we don't need law of excluded middle
But in mathlib, in order to define √2
we need to use axiom of choice anyway...
import Mathlib
open Real
noncomputable def test : ℝ := √2
-- 'test' depends on axioms: [propext, Classical.choice, Quot.sound]
#print axioms test
Seewoo Lee (Dec 12 2024 at 16:21):
Jz Pan 말함:
Seewoo Lee said:
so that we don't need law of excluded middle
But in mathlib, in order to define
√2
we need to use axiom of choice anyway...import Mathlib open Real noncomputable def test : ℝ := √2 -- 'test' depends on axioms: [propext, Classical.choice, Quot.sound] #print axioms test
Oh I see.. where they use AC to define √2
? I never realized this.
Seewoo Lee (Dec 12 2024 at 17:24):
Here's a slight modification of @Matt Diamond 's one with positivity assumption:
example : ∃ (a b : ℝ) (_: Irrational a) (_: Irrational b) (_: 0 < a),
¬Irrational (a ^ b) := by
by_cases h : Irrational (√2 ^ √2)
· use √2 ^ √2, √2, h, irrational_sqrt_two, NNReal.rpow_pos (by norm_num),
(by rw [← rpow_mul, mul_self_sqrt (by norm_num), rpow_two]; norm_num; norm_num)
· use √2, √2, irrational_sqrt_two, irrational_sqrt_two, by norm_num, h
Kevin Buzzard (Dec 12 2024 at 20:06):
Probably what's actually used is LEM but in lean this is proved using AC
Daniel Weber (Dec 12 2024 at 20:25):
Following the definition choice also comes from docs#StrictMono.orderIsoOfSurjective and docs#Real.toNNReal
Seewoo Lee (Dec 12 2024 at 21:36):
So back to my original question, if I willing to put this in mathlib, then I may consider it under Mathlib.Data.Real.Irrational
- any other suggestions (or shouldn't I make PR?)
Ruben Van de Velde (Dec 12 2024 at 21:43):
I'm a bit confused - we (that is, the mathematical community excluding me) know which of those branches is true, right?
Seewoo Lee (Dec 12 2024 at 21:48):
Yes, is irrational by Gelfond-Schneider. So there are two things here:
- It might be better to use instead of since we don't need branch for the former.
- But also, the initial argument itself is pretty famous and good to be somewhere IMO (for archive purpose), so I'm not sure if is "better". One possibility is to add both but I should ask this first - are there any theorems in mathlib that are proven twice but with different proofs?
Edward van de Meent (Dec 12 2024 at 21:58):
imo, since this proof really is about giving a counterexample to build intuition, i'd say that the current (branching) proof is satisfactory for this purpose.
Eric Wieser (Dec 12 2024 at 22:36):
Do we actually want this result in Mathlib
, or should it go in Counterexamples
? It's not obvious to me that anything would ever use this theorem in it's current form.
Eric Wieser (Dec 12 2024 at 22:37):
But as a nice example it probably would be fine in Counterexamples
or Archive
Eric Wieser (Dec 12 2024 at 22:42):
If in the former, I would expect the statement to be the equivalent:
theorem not_irrational_rpow : ¬ ∀ a b : ℝ, Irrational a → Irrational b → 0 < a → Irrational (a ^ b) := by
Seewoo Lee (Dec 13 2024 at 02:15):
Thanks! Here’s a PR.
Violeta Hernández (Dec 13 2024 at 13:08):
Nit but 0 < a
can be replaced with 0 ≤ a
Mario Carneiro (Dec 13 2024 at 15:41):
Eric Wieser said:
If in the former, I would expect the statement to be the equivalent:
theorem not_irrational_rpow : ¬ ∀ a b : ℝ, Irrational a → Irrational b → 0 < a → Irrational (a ^ b) := by
which has the nice property of being intuitionistically provable (no LEM needed for the classic proof, if you ignore the LEM used in the current construction of the sqrt function)
Eric Wieser (Dec 15 2024 at 01:03):
Violeta Hernández said:
Nit but
0 < a
can be replaced with0 ≤ a
That makes the statement weaker not stronger
Eric Wieser (Dec 15 2024 at 01:04):
But this is also why counterexamples aren't great for Mathlib
itself, as it's hard to decide when to stop adding extra characterizations to strengthen the example.
Matt Diamond (Dec 15 2024 at 01:07):
does allowing a
to be 0
make a difference if 0
is already ruled out by the Irrational a
assumption?
Last updated: May 02 2025 at 03:31 UTC