Theorem: setOf_liouvilleWith_subset_aux
File: Mathlib/NumberTheory/Liouville/Measure.lean

tactic: rintro x ⟨p, hp, hxp⟩
state_before: ⊢ {x | ∃ p, p > 2 ∧ LiouvilleWith p x} ⊆
    ⋃ (m : ℤ),
      (fun x => x + ↑m) ⁻¹'
        ⋃ (n : ℕ) (_ : n > 0),
          {x | ∃ᶠ (b : ℕ) in atTop, ∃ a, a ∈ Finset.Icc 0 ↑b ∧ abs (x - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑n)}

tactic: rcases exists_nat_one_div_lt (sub_pos.2 hp) with ⟨n, hn⟩
state_before: case intro.intro
x p : ℝ
hp : p > 2
hxp : LiouvilleWith p x
⊢ x ∈
    ⋃ (m : ℤ),
      (fun x => x + ↑m) ⁻¹'
        ⋃ (n : ℕ) (_ : n > 0),
          {x | ∃ᶠ (b : ℕ) in atTop, ∃ a, a ∈ Finset.Icc 0 ↑b ∧ abs (x - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑n)}

tactic: rw [lt_sub_iff_add_lt'] at hn
state_before: case intro.intro.intro
x p : ℝ
hp : p > 2
hxp : LiouvilleWith p x
n : ℕ
hn : 1 / (↑n + 1) < p - 2
⊢ x ∈
    ⋃ (m : ℤ),
      (fun x => x + ↑m) ⁻¹'
        ⋃ (n : ℕ) (_ : n > 0),
          {x | ∃ᶠ (b : ℕ) in atTop, ∃ a, a ∈ Finset.Icc 0 ↑b ∧ abs (x - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑n)}

tactic: suffices ∀ y : ℝ, LiouvilleWith p y → y ∈ Ico (0 : ℝ) 1 → ∃ᶠ b : ℕ in atTop,
    ∃ a ∈ Finset.Icc (0 : ℤ) b, |y - a / b| < 1 / (b : ℝ) ^ (2 + 1 / (n + 1 : ℕ) : ℝ) by
  simp only [mem_iUnion, mem_preimage]
  have hx : x + ↑(-⌊x⌋) ∈ Ico (0 : ℝ) 1 := by
    simp only [Int.floor_le, Int.lt_floor_add_one, add_neg_lt_iff_le_add', zero_add, and_self_iff,
      mem_Ico, Int.cast_neg, le_add_neg_iff_add_le]
  refine' ⟨-⌊x⌋, n + 1, n.succ_pos, this _ (hxp.add_int _) hx⟩
state_before: case intro.intro.intro
x p : ℝ
hp : p > 2
hxp : LiouvilleWith p x
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
⊢ x ∈
    ⋃ (m : ℤ),
      (fun x => x + ↑m) ⁻¹'
        ⋃ (n : ℕ) (_ : n > 0),
          {x | ∃ᶠ (b : ℕ) in atTop, ∃ a, a ∈ Finset.Icc 0 ↑b ∧ abs (x - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑n)}

tactic: clear hxp x
state_before: case intro.intro.intro
x p : ℝ
hp : p > 2
hxp : LiouvilleWith p x
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
⊢ ∀ (y : ℝ),
    LiouvilleWith p y →
      y ∈ Ico 0 1 → ∃ᶠ (b : ℕ) in atTop, ∃ a, a ∈ Finset.Icc 0 ↑b ∧ abs (y - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑(n + 1))

tactic: intro x hxp hx01
state_before: case intro.intro.intro
p : ℝ
hp : p > 2
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
⊢ ∀ (y : ℝ),
    LiouvilleWith p y →
      y ∈ Ico 0 1 → ∃ᶠ (b : ℕ) in atTop, ∃ a, a ∈ Finset.Icc 0 ↑b ∧ abs (y - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑(n + 1))

tactic: refine' ((hxp.frequently_lt_rpow_neg hn).and_eventually (eventually_ge_atTop 1)).mono _
state_before: case intro.intro.intro
p : ℝ
hp : p > 2
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
x : ℝ
hxp : LiouvilleWith p x
hx01 : x ∈ Ico 0 1
⊢ ∃ᶠ (b : ℕ) in atTop, ∃ a, a ∈ Finset.Icc 0 ↑b ∧ abs (x - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑(n + 1))

tactic: rintro b ⟨⟨a, -, hlt⟩, hb⟩
state_before: case intro.intro.intro
p : ℝ
hp : p > 2
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
x : ℝ
hxp : LiouvilleWith p x
hx01 : x ∈ Ico 0 1
⊢ ∀ (x_1 : ℕ),
    (∃ m, x ≠ ↑m / ↑x_1 ∧ abs (x - ↑m / ↑x_1) < ↑x_1 ^ (-(2 + 1 / (↑n + 1)))) ∧ 1 ≤ x_1 →
      ∃ a, a ∈ Finset.Icc 0 ↑x_1 ∧ abs (x - ↑a / ↑x_1) < 1 / ↑x_1 ^ (2 + 1 / ↑(n + 1))

tactic: rw [rpow_neg b.cast_nonneg, ← one_div, ← Nat.cast_succ] at hlt
state_before: case intro.intro.intro.intro.intro.intro
p : ℝ
hp : p > 2
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
x : ℝ
hxp : LiouvilleWith p x
hx01 : x ∈ Ico 0 1
b : ℕ
hb : 1 ≤ b
a : ℤ
hlt : abs (x - ↑a / ↑b) < ↑b ^ (-(2 + 1 / (↑n + 1)))
⊢ ∃ a, a ∈ Finset.Icc 0 ↑b ∧ abs (x - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑(n + 1))

tactic: refine' ⟨a, _, hlt⟩
state_before: case intro.intro.intro.intro.intro.intro
p : ℝ
hp : p > 2
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
x : ℝ
hxp : LiouvilleWith p x
hx01 : x ∈ Ico 0 1
b : ℕ
hb : 1 ≤ b
a : ℤ
hlt : abs (x - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑(Nat.succ n))
⊢ ∃ a, a ∈ Finset.Icc 0 ↑b ∧ abs (x - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑(n + 1))

tactic: replace hb : (1 : ℝ) ≤ b
state_before: case intro.intro.intro.intro.intro.intro
p : ℝ
hp : p > 2
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
x : ℝ
hxp : LiouvilleWith p x
hx01 : x ∈ Ico 0 1
b : ℕ
hb : 1 ≤ b
a : ℤ
hlt : abs (x - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑(Nat.succ n))
⊢ a ∈ Finset.Icc 0 ↑b

tactic: exact Nat.one_le_cast.2 hb
state_before: case hb
p : ℝ
hp : p > 2
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
x : ℝ
hxp : LiouvilleWith p x
hx01 : x ∈ Ico 0 1
b : ℕ
hb : 1 ≤ b
a : ℤ
hlt : abs (x - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑(Nat.succ n))
⊢ 1 ≤ ↑b

case intro.intro.intro.intro.intro.intro
p : ℝ
hp : p > 2
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
x : ℝ
hxp : LiouvilleWith p x
hx01 : x ∈ Ico 0 1
b : ℕ
a : ℤ
hlt : abs (x - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑(Nat.succ n))
hb : 1 ≤ ↑b
⊢ a ∈ Finset.Icc 0 ↑b

tactic: have hb0 : (0 : ℝ) < b := zero_lt_one.trans_le hb
state_before: case intro.intro.intro.intro.intro.intro
p : ℝ
hp : p > 2
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
x : ℝ
hxp : LiouvilleWith p x
hx01 : x ∈ Ico 0 1
b : ℕ
a : ℤ
hlt : abs (x - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑(Nat.succ n))
hb : 1 ≤ ↑b
⊢ a ∈ Finset.Icc 0 ↑b

tactic: replace hlt : |x - a / b| < 1 / b
state_before: case intro.intro.intro.intro.intro.intro
p : ℝ
hp : p > 2
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
x : ℝ
hxp : LiouvilleWith p x
hx01 : x ∈ Ico 0 1
b : ℕ
a : ℤ
hlt : abs (x - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑(Nat.succ n))
hb : 1 ≤ ↑b
hb0 : 0 < ↑b
⊢ a ∈ Finset.Icc 0 ↑b

tactic: rw [sub_div' _ _ _ hb0.ne', abs_div, abs_of_pos hb0, div_lt_div_right hb0, abs_sub_lt_iff,
  sub_lt_iff_lt_add, sub_lt_iff_lt_add, ← sub_lt_iff_lt_add'] at hlt
state_before: case intro.intro.intro.intro.intro.intro
p : ℝ
hp : p > 2
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
x : ℝ
hxp : LiouvilleWith p x
hx01 : x ∈ Ico 0 1
b : ℕ
a : ℤ
hb : 1 ≤ ↑b
hb0 : 0 < ↑b
hlt : abs (x - ↑a / ↑b) < 1 / ↑b
⊢ a ∈ Finset.Icc 0 ↑b

tactic: rw [Finset.mem_Icc, ← Int.lt_add_one_iff, ← Int.lt_add_one_iff, ← neg_lt_iff_pos_add, add_comm, ←
  @Int.cast_lt ℝ, ← @Int.cast_lt ℝ]
state_before: case intro.intro.intro.intro.intro.intro
p : ℝ
hp : p > 2
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
x : ℝ
hxp : LiouvilleWith p x
hx01 : x ∈ Ico 0 1
b : ℕ
a : ℤ
hb : 1 ≤ ↑b
hb0 : 0 < ↑b
hlt : x * ↑b - 1 < ↑a ∧ ↑a < 1 + x * ↑b
⊢ a ∈ Finset.Icc 0 ↑b

tactic: push_cast
state_before: case intro.intro.intro.intro.intro.intro
p : ℝ
hp : p > 2
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
x : ℝ
hxp : LiouvilleWith p x
hx01 : x ∈ Ico 0 1
b : ℕ
a : ℤ
hb : 1 ≤ ↑b
hb0 : 0 < ↑b
hlt : x * ↑b - 1 < ↑a ∧ ↑a < 1 + x * ↑b
⊢ ↑(-1) < ↑a ∧ ↑a < ↑(1 + ↑b)

tactic: refine' ⟨lt_of_le_of_lt _ hlt.1, hlt.2.trans_le _⟩
state_before: case intro.intro.intro.intro.intro.intro
p : ℝ
hp : p > 2
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
x : ℝ
hxp : LiouvilleWith p x
hx01 : x ∈ Ico 0 1
b : ℕ
a : ℤ
hb : 1 ≤ ↑b
hb0 : 0 < ↑b
hlt : x * ↑b - 1 < ↑a ∧ ↑a < 1 + x * ↑b
⊢ -1 < ↑a ∧ ↑a < 1 + ↑b

tactic: simp only [mem_iUnion, mem_preimage]
state_before: x p : ℝ
hp : p > 2
hxp : LiouvilleWith p x
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
this :
  ∀ (y : ℝ),
    LiouvilleWith p y →
      y ∈ Ico 0 1 → ∃ᶠ (b : ℕ) in atTop, ∃ a, a ∈ Finset.Icc 0 ↑b ∧ abs (y - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑(n + 1))
⊢ x ∈
    ⋃ (m : ℤ),
      (fun x => x + ↑m) ⁻¹'
        ⋃ (n : ℕ) (_ : n > 0),
          {x | ∃ᶠ (b : ℕ) in atTop, ∃ a, a ∈ Finset.Icc 0 ↑b ∧ abs (x - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑n)}

tactic: have hx : x + ↑(-⌊x⌋) ∈ Ico (0 : ℝ) 1 := by
  simp only [Int.floor_le, Int.lt_floor_add_one, add_neg_lt_iff_le_add', zero_add, and_self_iff,
    mem_Ico, Int.cast_neg, le_add_neg_iff_add_le]
state_before: x p : ℝ
hp : p > 2
hxp : LiouvilleWith p x
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
this :
  ∀ (y : ℝ),
    LiouvilleWith p y →
      y ∈ Ico 0 1 → ∃ᶠ (b : ℕ) in atTop, ∃ a, a ∈ Finset.Icc 0 ↑b ∧ abs (y - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑(n + 1))
⊢ ∃ i i_1 i_2,
    x + ↑i ∈ {x | ∃ᶠ (b : ℕ) in atTop, ∃ a, a ∈ Finset.Icc 0 ↑b ∧ abs (x - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑i_1)}

tactic: refine' ⟨-⌊x⌋, n + 1, n.succ_pos, this _ (hxp.add_int _) hx⟩
state_before: x p : ℝ
hp : p > 2
hxp : LiouvilleWith p x
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
this :
  ∀ (y : ℝ),
    LiouvilleWith p y →
      y ∈ Ico 0 1 → ∃ᶠ (b : ℕ) in atTop, ∃ a, a ∈ Finset.Icc 0 ↑b ∧ abs (y - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑(n + 1))
hx : x + ↑(-⌊x⌋) ∈ Ico 0 1
⊢ ∃ i i_1 i_2,
    x + ↑i ∈ {x | ∃ᶠ (b : ℕ) in atTop, ∃ a, a ∈ Finset.Icc 0 ↑b ∧ abs (x - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑i_1)}

tactic: simp only [Int.floor_le, Int.lt_floor_add_one, add_neg_lt_iff_le_add', zero_add, and_self_iff,
  mem_Ico, Int.cast_neg, le_add_neg_iff_add_le]
state_before: x p : ℝ
hp : p > 2
hxp : LiouvilleWith p x
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
this :
  ∀ (y : ℝ),
    LiouvilleWith p y →
      y ∈ Ico 0 1 → ∃ᶠ (b : ℕ) in atTop, ∃ a, a ∈ Finset.Icc 0 ↑b ∧ abs (y - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑(n + 1))
⊢ x + ↑(-⌊x⌋) ∈ Ico 0 1

tactic: refine' hlt.trans_le (one_div_le_one_div_of_le hb0 _)
state_before: case hlt
p : ℝ
hp : p > 2
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
x : ℝ
hxp : LiouvilleWith p x
hx01 : x ∈ Ico 0 1
b : ℕ
a : ℤ
hlt : abs (x - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑(Nat.succ n))
hb : 1 ≤ ↑b
hb0 : 0 < ↑b
⊢ abs (x - ↑a / ↑b) < 1 / ↑b

tactic: calc
  (b : ℝ) = (b : ℝ) ^ (1 : ℝ) := (rpow_one _).symm
  _ ≤ (b : ℝ) ^ (2 + 1 / (n + 1 : ℕ) : ℝ) :=
    rpow_le_rpow_of_exponent_le hb (one_le_two.trans ?_)
state_before: case hlt
p : ℝ
hp : p > 2
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
x : ℝ
hxp : LiouvilleWith p x
hx01 : x ∈ Ico 0 1
b : ℕ
a : ℤ
hlt : abs (x - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑(Nat.succ n))
hb : 1 ≤ ↑b
hb0 : 0 < ↑b
⊢ ↑b ≤ ↑b ^ (2 + 1 / ↑(Nat.succ n))

tactic: simpa using n.cast_add_one_pos.le
state_before: case hlt
p : ℝ
hp : p > 2
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
x : ℝ
hxp : LiouvilleWith p x
hx01 : x ∈ Ico 0 1
b : ℕ
a : ℤ
hlt : abs (x - ↑a / ↑b) < 1 / ↑b ^ (2 + 1 / ↑(Nat.succ n))
hb : 1 ≤ ↑b
hb0 : 0 < ↑b
⊢ 2 ≤ 2 + 1 / ↑(n + 1)

tactic: simp only [mul_nonneg hx01.left b.cast_nonneg, neg_le_sub_iff_le_add, le_add_iff_nonneg_left]
state_before: case intro.intro.intro.intro.intro.intro.refine'_1
p : ℝ
hp : p > 2
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
x : ℝ
hxp : LiouvilleWith p x
hx01 : x ∈ Ico 0 1
b : ℕ
a : ℤ
hb : 1 ≤ ↑b
hb0 : 0 < ↑b
hlt : x * ↑b - 1 < ↑a ∧ ↑a < 1 + x * ↑b
⊢ -1 ≤ x * ↑b - 1

tactic: rw [add_le_add_iff_left]
state_before: case intro.intro.intro.intro.intro.intro.refine'_2
p : ℝ
hp : p > 2
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
x : ℝ
hxp : LiouvilleWith p x
hx01 : x ∈ Ico 0 1
b : ℕ
a : ℤ
hb : 1 ≤ ↑b
hb0 : 0 < ↑b
hlt : x * ↑b - 1 < ↑a ∧ ↑a < 1 + x * ↑b
⊢ 1 + x * ↑b ≤ 1 + ↑b

tactic: exact mul_le_of_le_one_left hb0.le hx01.2.le
state_before: case intro.intro.intro.intro.intro.intro.refine'_2
p : ℝ
hp : p > 2
n : ℕ
hn : 2 + 1 / (↑n + 1) < p
x : ℝ
hxp : LiouvilleWith p x
hx01 : x ∈ Ico 0 1
b : ℕ
a : ℤ
hb : 1 ≤ ↑b
hb0 : 0 < ↑b
hlt : x * ↑b - 1 < ↑a ∧ ↑a < 1 + x * ↑b
⊢ x * ↑b ≤ ↑b