l3lab/ntp-mathlib huggingface dataset:
theorem irrational_sqrt_rat_iff (q : ℚ) :
    Irrational (Real.sqrt q) ↔ Rat.sqrt q * Rat.sqrt q ≠ q ∧ 0 ≤ q :=
  if H1 : Rat.sqrt q * Rat.sqrt q = q then
    iff_of_false
      (not_not_intro
        ⟨Rat.sqrt q, by
          

Proof state:
q : ℚ
H1 : Rat.sqrt q * Rat.sqrt q = q
⊢ ↑(Rat.sqrt q) = Real.sqrt ↑q

Next tactic:
rw [← H1, cast_mul, sqrt_mul_self (cast_nonneg.2 <| Rat.sqrt_nonneg q), sqrt_eq,
            abs_of_nonneg (Rat.sqrt_nonneg q)]
theorem irrational_sqrt_rat_iff (q : ℚ) :
    Irrational (Real.sqrt q) ↔ Rat.sqrt q * Rat.sqrt q ≠ q ∧ 0 ≤ q :=
  if H1 : Rat.sqrt q * Rat.sqrt q = q then
    iff_of_false
      (not_not_intro
        ⟨Rat.sqrt q, by
          rw [← H1, cast_mul, sqrt_mul_self (cast_nonneg.2 <| Rat.sqrt_nonneg q), sqrt_eq,
            abs_of_nonneg (Rat.sqrt_nonneg q)]⟩)
      fun h => h.1 H1
  else
    if H2 : 0 ≤ q then
      iff_of_true
        (fun ⟨r, hr⟩ =>
          H1 <|
            (exists_mul_self _).1
              ⟨r, by
                

Proof state:
q : ℚ
H1 : ¬Rat.sqrt q * Rat.sqrt q = q
H2 : 0 ≤ q
x✝ : Real.sqrt ↑q ∈ Set.range Rat.cast
r : ℚ
hr : ↑r = Real.sqrt ↑q
⊢ r * r = q

Next tactic:
rwa [eq_comm, sqrt_eq_iff_mul_self_eq (cast_nonneg.2 H2), ← cast_mul,
                      Rat.cast_inj] at hr
theorem irrational_sqrt_rat_iff (q : ℚ) :
    Irrational (Real.sqrt q) ↔ Rat.sqrt q * Rat.sqrt q ≠ q ∧ 0 ≤ q :=
  if H1 : Rat.sqrt q * Rat.sqrt q = q then
    iff_of_false
      (not_not_intro
        ⟨Rat.sqrt q, by
          rw [← H1, cast_mul, sqrt_mul_self (cast_nonneg.2 <| Rat.sqrt_nonneg q), sqrt_eq,
            abs_of_nonneg (Rat.sqrt_nonneg q)]⟩)
      fun h => h.1 H1
  else
    if H2 : 0 ≤ q then
      iff_of_true
        (fun ⟨r, hr⟩ =>
          H1 <|
            (exists_mul_self _).1
              ⟨r, by
                rwa [eq_comm, sqrt_eq_iff_mul_self_eq (cast_nonneg.2 H2), ← cast_mul,
                      Rat.cast_inj] at hr
                

Proof state:
q : ℚ
H1 : ¬Rat.sqrt q * Rat.sqrt q = q
H2 : 0 ≤ q
x✝ : Real.sqrt ↑q ∈ Set.range Rat.cast
r : ℚ
hr : Real.sqrt ↑q = ↑r
⊢ 0 ≤ ↑r

Next tactic:
rw [← hr]
theorem irrational_sqrt_rat_iff (q : ℚ) :
    Irrational (Real.sqrt q) ↔ Rat.sqrt q * Rat.sqrt q ≠ q ∧ 0 ≤ q :=
  if H1 : Rat.sqrt q * Rat.sqrt q = q then
    iff_of_false
      (not_not_intro
        ⟨Rat.sqrt q, by
          rw [← H1, cast_mul, sqrt_mul_self (cast_nonneg.2 <| Rat.sqrt_nonneg q), sqrt_eq,
            abs_of_nonneg (Rat.sqrt_nonneg q)]⟩)
      fun h => h.1 H1
  else
    if H2 : 0 ≤ q then
      iff_of_true
        (fun ⟨r, hr⟩ =>
          H1 <|
            (exists_mul_self _).1
              ⟨r, by
                rwa [eq_comm, sqrt_eq_iff_mul_self_eq (cast_nonneg.2 H2), ← cast_mul,
                      Rat.cast_inj] at hr
                rw [← hr]
                

Proof state:
q : ℚ
H1 : ¬Rat.sqrt q * Rat.sqrt q = q
H2 : 0 ≤ q
x✝ : Real.sqrt ↑q ∈ Set.range Rat.cast
r : ℚ
hr : Real.sqrt ↑q = ↑r
⊢ 0 ≤ Real.sqrt ↑q

Next tactic:
exact Real.sqrt_nonneg _
theorem irrational_sqrt_rat_iff (q : ℚ) :
    Irrational (Real.sqrt q) ↔ Rat.sqrt q * Rat.sqrt q ≠ q ∧ 0 ≤ q :=
  if H1 : Rat.sqrt q * Rat.sqrt q = q then
    iff_of_false
      (not_not_intro
        ⟨Rat.sqrt q, by
          rw [← H1, cast_mul, sqrt_mul_self (cast_nonneg.2 <| Rat.sqrt_nonneg q), sqrt_eq,
            abs_of_nonneg (Rat.sqrt_nonneg q)]⟩)
      fun h => h.1 H1
  else
    if H2 : 0 ≤ q then
      iff_of_true
        (fun ⟨r, hr⟩ =>
          H1 <|
            (exists_mul_self _).1
              ⟨r, by
                rwa [eq_comm, sqrt_eq_iff_mul_self_eq (cast_nonneg.2 H2), ← cast_mul,
                      Rat.cast_inj] at hr
                rw [← hr]
                exact Real.sqrt_nonneg _⟩)
        ⟨H1, H2⟩
    else
      iff_of_false
        (not_not_intro
          ⟨0, by
            

Proof state:
q : ℚ
H1 : ¬Rat.sqrt q * Rat.sqrt q = q
H2 : ¬0 ≤ q
⊢ ↑0 = Real.sqrt ↑q

Next tactic:
rw [cast_zero]
theorem irrational_sqrt_rat_iff (q : ℚ) :
    Irrational (Real.sqrt q) ↔ Rat.sqrt q * Rat.sqrt q ≠ q ∧ 0 ≤ q :=
  if H1 : Rat.sqrt q * Rat.sqrt q = q then
    iff_of_false
      (not_not_intro
        ⟨Rat.sqrt q, by
          rw [← H1, cast_mul, sqrt_mul_self (cast_nonneg.2 <| Rat.sqrt_nonneg q), sqrt_eq,
            abs_of_nonneg (Rat.sqrt_nonneg q)]⟩)
      fun h => h.1 H1
  else
    if H2 : 0 ≤ q then
      iff_of_true
        (fun ⟨r, hr⟩ =>
          H1 <|
            (exists_mul_self _).1
              ⟨r, by
                rwa [eq_comm, sqrt_eq_iff_mul_self_eq (cast_nonneg.2 H2), ← cast_mul,
                      Rat.cast_inj] at hr
                rw [← hr]
                exact Real.sqrt_nonneg _⟩)
        ⟨H1, H2⟩
    else
      iff_of_false
        (not_not_intro
          ⟨0, by
            rw [cast_zero]
            

Proof state:
q : ℚ
H1 : ¬Rat.sqrt q * Rat.sqrt q = q
H2 : ¬0 ≤ q
⊢ 0 = Real.sqrt ↑q

Next tactic:
exact (sqrt_eq_zero_of_nonpos (Rat.cast_nonpos.2 <| le_of_not_le H2)).symm
theorem ne_int (h : Irrational x) (m : ℤ) : x ≠ m := by
  

Proof state:
x : ℝ
h : Irrational x
m : ℤ
⊢ x ≠ ↑m

Next tactic:
rw [← Rat.cast_coe_int]
theorem ne_int (h : Irrational x) (m : ℤ) : x ≠ m := by
  rw [← Rat.cast_coe_int]
  

Proof state:
x : ℝ
h : Irrational x
m : ℤ
⊢ x ≠ ↑↑m

Next tactic:
exact h.ne_rat _
theorem ne_one (h : Irrational x) : x ≠ 1 := by 

Proof state:
x : ℝ
h : Irrational x
⊢ x ≠ 1

Next tactic:
simpa only [Nat.cast_one] using h.ne_nat 1
/-- If `x + y` is irrational, then at least one of `x` and `y` is irrational. -/
theorem add_cases : Irrational (x + y) → Irrational x ∨ Irrational y := by
  

Proof state:
q : ℚ
x y : ℝ
⊢ Irrational (x + y) → Irrational x ∨ Irrational y

Next tactic:
delta Irrational
/-- If `x + y` is irrational, then at least one of `x` and `y` is irrational. -/
theorem add_cases : Irrational (x + y) → Irrational x ∨ Irrational y := by
  delta Irrational
  

Proof state:
q : ℚ
x y : ℝ
⊢ x + y ∉ Set.range Rat.cast → x ∉ Set.range Rat.cast ∨ y ∉ Set.range Rat.cast

Next tactic:
contrapose!
/-- If `x + y` is irrational, then at least one of `x` and `y` is irrational. -/
theorem add_cases : Irrational (x + y) → Irrational x ∨ Irrational y := by
  delta Irrational
  contrapose!
  

Proof state:
q : ℚ
x y : ℝ
⊢ x ∈ Set.range Rat.cast ∧ y ∈ Set.range Rat.cast → x + y ∈ Set.range Rat.cast

Next tactic:
rintro ⟨⟨rx, rfl⟩, ⟨ry, rfl⟩⟩
/-- If `x + y` is irrational, then at least one of `x` and `y` is irrational. -/
theorem add_cases : Irrational (x + y) → Irrational x ∨ Irrational y := by
  delta Irrational
  contrapose!
  rintro ⟨⟨rx, rfl⟩, ⟨ry, rfl⟩⟩
  

Proof state:
case intro.intro.intro
q rx ry : ℚ
⊢ ↑rx + ↑ry ∈ Set.range Rat.cast

Next tactic:
exact ⟨rx + ry, cast_add rx ry⟩
theorem rat_add (h : Irrational x) : Irrational (q + x) :=
  of_rat_add (-q) <| by 

Proof state:
q : ℚ
x y : ℝ
h : Irrational x
⊢ Irrational (↑(-q) + (↑q + x))

Next tactic:
rwa [cast_neg, neg_add_cancel_left]
theorem of_int_add (m : ℤ) (h : Irrational (m + x)) : Irrational x := by
  

Proof state:
q : ℚ
x y : ℝ
m : ℤ
h : Irrational (↑m + x)
⊢ Irrational x

Next tactic:
rw [← cast_coe_int] at h
theorem of_int_add (m : ℤ) (h : Irrational (m + x)) : Irrational x := by
  rw [← cast_coe_int] at h
  

Proof state:
q : ℚ
x y : ℝ
m : ℤ
h : Irrational (↑↑m + x)
⊢ Irrational x

Next tactic:
exact h.of_rat_add m
theorem int_add (h : Irrational x) (m : ℤ) : Irrational (m + x) := by
  

Proof state:
q : ℚ
x y : ℝ
h : Irrational x
m : ℤ
⊢ Irrational (↑m + x)

Next tactic:
rw [← cast_coe_int]
theorem int_add (h : Irrational x) (m : ℤ) : Irrational (m + x) := by
  rw [← cast_coe_int]
  

Proof state:
q : ℚ
x y : ℝ
h : Irrational x
m : ℤ
⊢ Irrational (↑↑m + x)

Next tactic:
exact h.rat_add m
theorem of_neg (h : Irrational (-x)) : Irrational x := fun ⟨q, hx⟩ => h ⟨-q, by 

Proof state:
q✝ : ℚ
x y : ℝ
h : Irrational (-x)
x✝ : x ∈ Set.range Rat.cast
q : ℚ
hx : ↑q = x
⊢ ↑(-q) = -x

Next tactic:
rw [cast_neg, hx]
protected theorem neg (h : Irrational x) : Irrational (-x) :=
  of_neg <| by 

Proof state:
q : ℚ
x y : ℝ
h : Irrational x
⊢ Irrational (- -x)

Next tactic:
rwa [neg_neg]
theorem sub_rat (h : Irrational x) : Irrational (x - q) := by
  

Proof state:
q : ℚ
x y : ℝ
h : Irrational x
⊢ Irrational (x - ↑q)

Next tactic:
simpa only [sub_eq_add_neg, cast_neg] using h.add_rat (-q)
theorem rat_sub (h : Irrational x) : Irrational (q - x) := by
  

Proof state:
q : ℚ
x y : ℝ
h : Irrational x
⊢ Irrational (↑q - x)

Next tactic:
simpa only [sub_eq_add_neg] using h.neg.rat_add q
theorem of_sub_rat (h : Irrational (x - q)) : Irrational x :=
  of_add_rat (-q) <| by 

Proof state:
q : ℚ
x y : ℝ
h : Irrational (x - ↑q)
⊢ Irrational (x + ↑(-q))

Next tactic:
simpa only [cast_neg, sub_eq_add_neg] using h
theorem of_rat_sub (h : Irrational (q - x)) : Irrational x :=
  of_neg (of_rat_add q (by 

Proof state:
q : ℚ
x y : ℝ
h : Irrational (↑q - x)
⊢ Irrational (↑q + -x)

Next tactic:
simpa only [sub_eq_add_neg] using h
theorem sub_int (h : Irrational x) (m : ℤ) : Irrational (x - m) := by
  

Proof state:
q : ℚ
x y : ℝ
h : Irrational x
m : ℤ
⊢ Irrational (x - ↑m)

Next tactic:
simpa only [Rat.cast_coe_int] using h.sub_rat m
theorem int_sub (h : Irrational x) (m : ℤ) : Irrational (m - x) := by
  

Proof state:
q : ℚ
x y : ℝ
h : Irrational x
m : ℤ
⊢ Irrational (↑m - x)

Next tactic:
simpa only [Rat.cast_coe_int] using h.rat_sub m
theorem of_sub_int (m : ℤ) (h : Irrational (x - m)) : Irrational x :=
  of_sub_rat m <| by 

Proof state:
q : ℚ
x y : ℝ
m : ℤ
h : Irrational (x - ↑m)
⊢ Irrational (x - ↑↑m)

Next tactic:
rwa [Rat.cast_coe_int]
theorem of_int_sub (m : ℤ) (h : Irrational (m - x)) : Irrational x :=
  of_rat_sub m <| by 

Proof state:
q : ℚ
x y : ℝ
m : ℤ
h : Irrational (↑m - x)
⊢ Irrational (↑↑m - x)

Next tactic:
rwa [Rat.cast_coe_int]
theorem mul_cases : Irrational (x * y) → Irrational x ∨ Irrational y := by
  

Proof state:
q : ℚ
x y : ℝ
⊢ Irrational (x * y) → Irrational x ∨ Irrational y

Next tactic:
delta Irrational
theorem mul_cases : Irrational (x * y) → Irrational x ∨ Irrational y := by
  delta Irrational
  

Proof state:
q : ℚ
x y : ℝ
⊢ x * y ∉ Set.range Rat.cast → x ∉ Set.range Rat.cast ∨ y ∉ Set.range Rat.cast

Next tactic:
contrapose!
theorem mul_cases : Irrational (x * y) → Irrational x ∨ Irrational y := by
  delta Irrational
  contrapose!
  

Proof state:
q : ℚ
x y : ℝ
⊢ x ∈ Set.range Rat.cast ∧ y ∈ Set.range Rat.cast → x * y ∈ Set.range Rat.cast

Next tactic:
rintro ⟨⟨rx, rfl⟩, ⟨ry, rfl⟩⟩
theorem mul_cases : Irrational (x * y) → Irrational x ∨ Irrational y := by
  delta Irrational
  contrapose!
  rintro ⟨⟨rx, rfl⟩, ⟨ry, rfl⟩⟩
  

Proof state:
case intro.intro.intro
q rx ry : ℚ
⊢ ↑rx * ↑ry ∈ Set.range Rat.cast

Next tactic:
exact ⟨rx * ry, cast_mul rx ry⟩
theorem mul_rat (h : Irrational x) {q : ℚ} (hq : q ≠ 0) : Irrational (x * q) :=
  of_mul_rat q⁻¹ <| by 

Proof state:
q✝ : ℚ
x y : ℝ
h : Irrational x
q : ℚ
hq : q ≠ 0
⊢ Irrational (x * ↑q * ↑q⁻¹)

Next tactic:
rwa [mul_assoc, ← cast_mul, mul_inv_cancel hq, cast_one, mul_one]
theorem of_mul_int (m : ℤ) (h : Irrational (x * m)) : Irrational x :=
  of_mul_rat m <| by 

Proof state:
q : ℚ
x y : ℝ
m : ℤ
h : Irrational (x * ↑m)
⊢ Irrational (x * ↑↑m)

Next tactic:
rwa [cast_coe_int]
theorem of_int_mul (m : ℤ) (h : Irrational (m * x)) : Irrational x :=
  of_rat_mul m <| by 

Proof state:
q : ℚ
x y : ℝ
m : ℤ
h : Irrational (↑m * x)
⊢ Irrational (↑↑m * x)

Next tactic:
rwa [cast_coe_int]
theorem mul_int (h : Irrational x) {m : ℤ} (hm : m ≠ 0) : Irrational (x * m) := by
  

Proof state:
q : ℚ
x y : ℝ
h : Irrational x
m : ℤ
hm : m ≠ 0
⊢ Irrational (x * ↑m)

Next tactic:
rw [← cast_coe_int]
theorem mul_int (h : Irrational x) {m : ℤ} (hm : m ≠ 0) : Irrational (x * m) := by
  rw [← cast_coe_int]
  

Proof state:
q : ℚ
x y : ℝ
h : Irrational x
m : ℤ
hm : m ≠ 0
⊢ Irrational (x * ↑↑m)

Next tactic:
refine' h.mul_rat _
theorem mul_int (h : Irrational x) {m : ℤ} (hm : m ≠ 0) : Irrational (x * m) := by
  rw [← cast_coe_int]
  refine' h.mul_rat _
  

Proof state:
q : ℚ
x y : ℝ
h : Irrational x
m : ℤ
hm : m ≠ 0
⊢ ↑m ≠ 0

Next tactic:
rwa [Int.cast_ne_zero]
protected theorem inv (h : Irrational x) : Irrational x⁻¹ :=
  of_inv <| by 

Proof state:
q : ℚ
x y : ℝ
h : Irrational x
⊢ Irrational x⁻¹⁻¹

Next tactic:
rwa [inv_inv]
theorem div_rat (h : Irrational x) {q : ℚ} (hq : q ≠ 0) : Irrational (x / q) := by
  

Proof state:
q✝ : ℚ
x y : ℝ
h : Irrational x
q : ℚ
hq : q ≠ 0
⊢ Irrational (x / ↑q)

Next tactic:
rw [div_eq_mul_inv, ← cast_inv]
theorem div_rat (h : Irrational x) {q : ℚ} (hq : q ≠ 0) : Irrational (x / q) := by
  rw [div_eq_mul_inv, ← cast_inv]
  

Proof state:
q✝ : ℚ
x y : ℝ
h : Irrational x
q : ℚ
hq : q ≠ 0
⊢ Irrational (x * ↑q⁻¹)

Next tactic:
exact h.mul_rat (inv_ne_zero hq)
theorem div_int (h : Irrational x) {m : ℤ} (hm : m ≠ 0) : Irrational (x / m) := by
  

Proof state:
q : ℚ
x y : ℝ
h : Irrational x
m : ℤ
hm : m ≠ 0
⊢ Irrational (x / ↑m)

Next tactic:
rw [← cast_coe_int]
theorem div_int (h : Irrational x) {m : ℤ} (hm : m ≠ 0) : Irrational (x / m) := by
  rw [← cast_coe_int]
  

Proof state:
q : ℚ
x y : ℝ
h : Irrational x
m : ℤ
hm : m ≠ 0
⊢ Irrational (x / ↑↑m)

Next tactic:
refine' h.div_rat _
theorem div_int (h : Irrational x) {m : ℤ} (hm : m ≠ 0) : Irrational (x / m) := by
  rw [← cast_coe_int]
  refine' h.div_rat _
  

Proof state:
q : ℚ
x y : ℝ
h : Irrational x
m : ℤ
hm : m ≠ 0
⊢ ↑m ≠ 0

Next tactic:
rwa [Int.cast_ne_zero]
theorem div_nat (h : Irrational x) {m : ℕ} (hm : m ≠ 0) : Irrational (x / m) :=
  h.div_int <| by 

Proof state:
q : ℚ
x y : ℝ
h : Irrational x
m : ℕ
hm : m ≠ 0
⊢ ↑m ≠ 0

Next tactic:
rwa [Int.coe_nat_ne_zero]
theorem of_one_div (h : Irrational (1 / x)) : Irrational x :=
  of_rat_div 1 <| by 

Proof state:
q : ℚ
x y : ℝ
h : Irrational (1 / x)
⊢ Irrational (↑1 / x)

Next tactic:
rwa [cast_one]
theorem of_pow : ∀ n : ℕ, Irrational (x ^ n) → Irrational x
  | 0 => fun h => by
    

Proof state:
q : ℚ
x y : ℝ
h : Irrational (x ^ 0)
⊢ Irrational x

Next tactic:
rw [pow_zero] at h
theorem of_pow : ∀ n : ℕ, Irrational (x ^ n) → Irrational x
  | 0 => fun h => by
    rw [pow_zero] at h
    

Proof state:
q : ℚ
x y : ℝ
h : Irrational 1
⊢ Irrational x

Next tactic:
exact (h ⟨1, cast_one⟩).elim
theorem of_pow : ∀ n : ℕ, Irrational (x ^ n) → Irrational x
  | 0 => fun h => by
    rw [pow_zero] at h
    exact (h ⟨1, cast_one⟩).elim
  | n + 1 => fun h => by
    

Proof state:
q : ℚ
x y : ℝ
n : ℕ
h : Irrational (x ^ (n + 1))
⊢ Irrational x

Next tactic:
rw [pow_succ] at h
theorem of_pow : ∀ n : ℕ, Irrational (x ^ n) → Irrational x
  | 0 => fun h => by
    rw [pow_zero] at h
    exact (h ⟨1, cast_one⟩).elim
  | n + 1 => fun h => by
    rw [pow_succ] at h
    

Proof state:
q : ℚ
x y : ℝ
n : ℕ
h : Irrational (x * x ^ n)
⊢ Irrational x

Next tactic:
exact h.mul_cases.elim id (of_pow n)
open Int in
theorem of_zpow : ∀ m : ℤ, Irrational (x ^ m) → Irrational x
  | (n : ℕ) => fun h => by
    

Proof state:
q : ℚ
x y : ℝ
n : ℕ
h : Irrational (x ^ ↑n)
⊢ Irrational x

Next tactic:
rw [zpow_ofNat] at h
open Int in
theorem of_zpow : ∀ m : ℤ, Irrational (x ^ m) → Irrational x
  | (n : ℕ) => fun h => by
    rw [zpow_ofNat] at h
    

Proof state:
q : ℚ
x y : ℝ
n : ℕ
h : Irrational (x ^ n)
⊢ Irrational x

Next tactic:
exact h.of_pow _
open Int in
theorem of_zpow : ∀ m : ℤ, Irrational (x ^ m) → Irrational x
  | (n : ℕ) => fun h => by
    rw [zpow_ofNat] at h
    exact h.of_pow _
  | -[n+1] => fun h => by
    

Proof state:
q : ℚ
x y : ℝ
n : ℕ
h : Irrational (x ^ -[n+1])
⊢ Irrational x

Next tactic:
rw [zpow_negSucc] at h
open Int in
theorem of_zpow : ∀ m : ℤ, Irrational (x ^ m) → Irrational x
  | (n : ℕ) => fun h => by
    rw [zpow_ofNat] at h
    exact h.of_pow _
  | -[n+1] => fun h => by
    rw [zpow_negSucc] at h
    

Proof state:
q : ℚ
x y : ℝ
n : ℕ
h : Irrational (x ^ (n + 1))⁻¹
⊢ Irrational x

Next tactic:
exact h.of_inv.of_pow _
theorem one_lt_natDegree_of_irrational_root (hx : Irrational x) (p_nonzero : p ≠ 0)
    (x_is_root : aeval x p = 0) : 1 < p.natDegree := by
  

Proof state:
x : ℝ
p : ℤ[X]
hx : Irrational x
p_nonzero : p ≠ 0
x_is_root : (aeval x) p = 0
⊢ 1 < natDegree p

Next tactic:
by_contra rid
theorem one_lt_natDegree_of_irrational_root (hx : Irrational x) (p_nonzero : p ≠ 0)
    (x_is_root : aeval x p = 0) : 1 < p.natDegree := by
  by_contra rid
  

Proof state:
x : ℝ
p : ℤ[X]
hx : Irrational x
p_nonzero : p ≠ 0
x_is_root : (aeval x) p = 0
rid : ¬1 < natDegree p
⊢ False

Next tactic:
rcases exists_eq_X_add_C_of_natDegree_le_one (not_lt.1 rid) with ⟨a, b, rfl⟩
theorem one_lt_natDegree_of_irrational_root (hx : Irrational x) (p_nonzero : p ≠ 0)
    (x_is_root : aeval x p = 0) : 1 < p.natDegree := by
  by_contra rid
  rcases exists_eq_X_add_C_of_natDegree_le_one (not_lt.1 rid) with ⟨a, b, rfl⟩
  

Proof state:
case intro.intro
x : ℝ
hx : Irrational x
a b : ℤ
p_nonzero : C a * X + C b ≠ 0
x_is_root : (aeval x) (C a * X + C b) = 0
rid : ¬1 < natDegree (C a * X + C b)
⊢ False

Next tactic:
clear rid
theorem one_lt_natDegree_of_irrational_root (hx : Irrational x) (p_nonzero : p ≠ 0)
    (x_is_root : aeval x p = 0) : 1 < p.natDegree := by
  by_contra rid
  rcases exists_eq_X_add_C_of_natDegree_le_one (not_lt.1 rid) with ⟨a, b, rfl⟩
  clear rid
  

Proof state:
case intro.intro
x : ℝ
hx : Irrational x
a b : ℤ
p_nonzero : C a * X + C b ≠ 0
x_is_root : (aeval x) (C a * X + C b) = 0
⊢ False

Next tactic:
have : (a : ℝ) * x = -b := by simpa [eq_neg_iff_add_eq_zero] using x_is_root
theorem one_lt_natDegree_of_irrational_root (hx : Irrational x) (p_nonzero : p ≠ 0)
    (x_is_root : aeval x p = 0) : 1 < p.natDegree := by
  by_contra rid
  rcases exists_eq_X_add_C_of_natDegree_le_one (not_lt.1 rid) with ⟨a, b, rfl⟩
  clear rid
  have : (a : ℝ) * x = -b := by 

Proof state:
x : ℝ
hx : Irrational x
a b : ℤ
p_nonzero : C a * X + C b ≠ 0
x_is_root : (aeval x) (C a * X + C b) = 0
⊢ ↑a * x = -↑b

Next tactic:
simpa [eq_neg_iff_add_eq_zero] using x_is_root
theorem one_lt_natDegree_of_irrational_root (hx : Irrational x) (p_nonzero : p ≠ 0)
    (x_is_root : aeval x p = 0) : 1 < p.natDegree := by
  by_contra rid
  rcases exists_eq_X_add_C_of_natDegree_le_one (not_lt.1 rid) with ⟨a, b, rfl⟩
  clear rid
  have : (a : ℝ) * x = -b := by simpa [eq_neg_iff_add_eq_zero] using x_is_root
  

Proof state:
case intro.intro
x : ℝ
hx : Irrational x
a b : ℤ
p_nonzero : C a * X + C b ≠ 0
x_is_root : (aeval x) (C a * X + C b) = 0
this : ↑a * x = -↑b
⊢ False

Next tactic:
rcases em (a = 0) with (rfl | ha)
theorem one_lt_natDegree_of_irrational_root (hx : Irrational x) (p_nonzero : p ≠ 0)
    (x_is_root : aeval x p = 0) : 1 < p.natDegree := by
  by_contra rid
  rcases exists_eq_X_add_C_of_natDegree_le_one (not_lt.1 rid) with ⟨a, b, rfl⟩
  clear rid
  have : (a : ℝ) * x = -b := by simpa [eq_neg_iff_add_eq_zero] using x_is_root
  rcases em (a = 0) with (rfl | ha)
  · 

Proof state:
case intro.intro.inl
x : ℝ
hx : Irrational x
b : ℤ
p_nonzero : C 0 * X + C b ≠ 0
x_is_root : (aeval x) (C 0 * X + C b) = 0
this : ↑0 * x = -↑b
⊢ False

Next tactic:
obtain rfl : b = 0 := by simpa
theorem one_lt_natDegree_of_irrational_root (hx : Irrational x) (p_nonzero : p ≠ 0)
    (x_is_root : aeval x p = 0) : 1 < p.natDegree := by
  by_contra rid
  rcases exists_eq_X_add_C_of_natDegree_le_one (not_lt.1 rid) with ⟨a, b, rfl⟩
  clear rid
  have : (a : ℝ) * x = -b := by simpa [eq_neg_iff_add_eq_zero] using x_is_root
  rcases em (a = 0) with (rfl | ha)
  · obtain rfl : b = 0 := by 

Proof state:
x : ℝ
hx : Irrational x
b : ℤ
p_nonzero : C 0 * X + C b ≠ 0
x_is_root : (aeval x) (C 0 * X + C b) = 0
this : ↑0 * x = -↑b
⊢ b = 0

Next tactic:
simpa
theorem one_lt_natDegree_of_irrational_root (hx : Irrational x) (p_nonzero : p ≠ 0)
    (x_is_root : aeval x p = 0) : 1 < p.natDegree := by
  by_contra rid
  rcases exists_eq_X_add_C_of_natDegree_le_one (not_lt.1 rid) with ⟨a, b, rfl⟩
  clear rid
  have : (a : ℝ) * x = -b := by simpa [eq_neg_iff_add_eq_zero] using x_is_root
  rcases em (a = 0) with (rfl | ha)
  · obtain rfl : b = 0 := by simpa
    

Proof state:
case intro.intro.inl
x : ℝ
hx : Irrational x
p_nonzero : C 0 * X + C 0 ≠ 0
x_is_root : (aeval x) (C 0 * X + C 0) = 0
this : ↑0 * x = -↑0
⊢ False

Next tactic:
simp at p_nonzero
theorem one_lt_natDegree_of_irrational_root (hx : Irrational x) (p_nonzero : p ≠ 0)
    (x_is_root : aeval x p = 0) : 1 < p.natDegree := by
  by_contra rid
  rcases exists_eq_X_add_C_of_natDegree_le_one (not_lt.1 rid) with ⟨a, b, rfl⟩
  clear rid
  have : (a : ℝ) * x = -b := by simpa [eq_neg_iff_add_eq_zero] using x_is_root
  rcases em (a = 0) with (rfl | ha)
  · obtain rfl : b = 0 := by simpa
    simp at p_nonzero
  · 

Proof state:
case intro.intro.inr
x : ℝ
hx : Irrational x
a b : ℤ
p_nonzero : C a * X + C b ≠ 0
x_is_root : (aeval x) (C a * X + C b) = 0
this : ↑a * x = -↑b
ha : ¬a = 0
⊢ False

Next tactic:
rw [mul_comm, ← eq_div_iff_mul_eq, eq_comm] at this
theorem one_lt_natDegree_of_irrational_root (hx : Irrational x) (p_nonzero : p ≠ 0)
    (x_is_root : aeval x p = 0) : 1 < p.natDegree := by
  by_contra rid
  rcases exists_eq_X_add_C_of_natDegree_le_one (not_lt.1 rid) with ⟨a, b, rfl⟩
  clear rid
  have : (a : ℝ) * x = -b := by simpa [eq_neg_iff_add_eq_zero] using x_is_root
  rcases em (a = 0) with (rfl | ha)
  · obtain rfl : b = 0 := by simpa
    simp at p_nonzero
  · rw [mul_comm, ← eq_div_iff_mul_eq, eq_comm] at this
    

Proof state:
case intro.intro.inr
x : ℝ
hx : Irrational x
a b : ℤ
p_nonzero : C a * X + C b ≠ 0
x_is_root : (aeval x) (C a * X + C b) = 0
this : -↑b / ↑a = x
ha : ¬a = 0
⊢ False
case intro.intro.inr
x : ℝ
hx : Irrational x
a b : ℤ
p_nonzero : C a * X + C b ≠ 0
x_is_root : (aeval x) (C a * X + C b) = 0
this : x * ↑a = -↑b
ha : ¬a = 0
⊢ ↑a ≠ 0

Next tactic:
refine' hx ⟨-b / a, _⟩
theorem one_lt_natDegree_of_irrational_root (hx : Irrational x) (p_nonzero : p ≠ 0)
    (x_is_root : aeval x p = 0) : 1 < p.natDegree := by
  by_contra rid
  rcases exists_eq_X_add_C_of_natDegree_le_one (not_lt.1 rid) with ⟨a, b, rfl⟩
  clear rid
  have : (a : ℝ) * x = -b := by simpa [eq_neg_iff_add_eq_zero] using x_is_root
  rcases em (a = 0) with (rfl | ha)
  · obtain rfl : b = 0 := by simpa
    simp at p_nonzero
  · rw [mul_comm, ← eq_div_iff_mul_eq, eq_comm] at this
    refine' hx ⟨-b / a, _⟩
    

Proof state:
case intro.intro.inr
x : ℝ
hx : Irrational x
a b : ℤ
p_nonzero : C a * X + C b ≠ 0
x_is_root : (aeval x) (C a * X + C b) = 0
this : -↑b / ↑a = x
ha : ¬a = 0
⊢ ↑(-↑b / ↑a) = x
case intro.intro.inr
x : ℝ
hx : Irrational x
a b : ℤ
p_nonzero : C a * X + C b ≠ 0
x_is_root : (aeval x) (C a * X + C b) = 0
this : x * ↑a = -↑b
ha : ¬a = 0
⊢ ↑a ≠ 0

Next tactic:
assumption_mod_cast
theorem one_lt_natDegree_of_irrational_root (hx : Irrational x) (p_nonzero : p ≠ 0)
    (x_is_root : aeval x p = 0) : 1 < p.natDegree := by
  by_contra rid
  rcases exists_eq_X_add_C_of_natDegree_le_one (not_lt.1 rid) with ⟨a, b, rfl⟩
  clear rid
  have : (a : ℝ) * x = -b := by simpa [eq_neg_iff_add_eq_zero] using x_is_root
  rcases em (a = 0) with (rfl | ha)
  · obtain rfl : b = 0 := by simpa
    simp at p_nonzero
  · rw [mul_comm, ← eq_div_iff_mul_eq, eq_comm] at this
    refine' hx ⟨-b / a, _⟩
    assumption_mod_cast
    

Proof state:
case intro.intro.inr
x : ℝ
hx : Irrational x
a b : ℤ
p_nonzero : C a * X + C b ≠ 0
x_is_root : (aeval x) (C a * X + C b) = 0
this : x * ↑a = -↑b
ha : ¬a = 0
⊢ ↑a ≠ 0

Next tactic:
assumption_mod_cast
@[simp]
theorem irrational_mul_rat_iff : Irrational (x * q) ↔ q ≠ 0 ∧ Irrational x := by
  

Proof state:
q : ℚ
m : ℤ
n : ℕ
x : ℝ
⊢ Irrational (x * ↑q) ↔ q ≠ 0 ∧ Irrational x

Next tactic:
rw [mul_comm, irrational_rat_mul_iff]
@[simp]
theorem irrational_int_mul_iff : Irrational (m * x) ↔ m ≠ 0 ∧ Irrational x := by
  

Proof state:
q : ℚ
m : ℤ
n : ℕ
x : ℝ
⊢ Irrational (↑m * x) ↔ m ≠ 0 ∧ Irrational x

Next tactic:
rw [← cast_coe_int, irrational_rat_mul_iff, Int.cast_ne_zero]
@[simp]
theorem irrational_mul_int_iff : Irrational (x * m) ↔ m ≠ 0 ∧ Irrational x := by
  

Proof state:
q : ℚ
m : ℤ
n : ℕ
x : ℝ
⊢ Irrational (x * ↑m) ↔ m ≠ 0 ∧ Irrational x

Next tactic:
rw [← cast_coe_int, irrational_mul_rat_iff, Int.cast_ne_zero]
@[simp]
theorem irrational_nat_mul_iff : Irrational (n * x) ↔ n ≠ 0 ∧ Irrational x := by
  

Proof state:
q : ℚ
m : ℤ
n : ℕ
x : ℝ
⊢ Irrational (↑n * x) ↔ n ≠ 0 ∧ Irrational x

Next tactic:
rw [← cast_coe_nat, irrational_rat_mul_iff, Nat.cast_ne_zero]