Skip to main content

Challenge 35: Existence of ordered gaps in non-Cauchy sequences

Prove that if \(a\) is a sequence that is not Cauchy, then there exists \(\varepsilon > 0\) such that \[ \forall N \in \mathbb{N}, \exists n \geq N, \exists m \geq n, \varepsilon \leq |a(m) - a(n)| \]

To do so, complete the following theory in Lean 4:

import Mathlib.Tactic

def IsCauchy {X : Type*} [AddGroup X] [Lattice X] (a : ℕ → X) : Prop :=
  ∀ (ε : X), 0 < ε → ∃ N : ℕ, ∀ n ≥ N, ∀ m ≥ N, |a m - a n| < ε

variable {X : Type*} [CommRing X] [LinearOrder X]
variable {a : ℕ → X}

example
  (hC : ¬ IsCauchy a)
  : ∃ ε : X, 0 < ε ∧ ∀ (N : ℕ), ∃ n ≥ N, ∃ m ≥ n, ε ≤ |a m - a n| :=
by sorry

I recommend that you try to solve the challenge on your own in Lean 4 Web before looking at the solutions. Once you have tried, expand the "Proposed solutions" section to compare your approach with the proofs you will find there.

Have you found a different proof? Share it in the comments, inside a Lean code block (using ```lean ... ```), to enrich the challenge!

Proposed solutions

1. Proof in natural language

Since \(a\) is not Cauchy, we have \[ ¬(\forall \varepsilon > 0, \exists N, \forall n \geq N, \forall m \geq N, |a(m) - a(n)| < \varepsilon) \] Pushing the negation inside, there exists an \(\varepsilon\) such that \[ \begin{align} &\varepsilon > 0 \tag{1} \\ &\forall N, \exists n \geq N, \exists m \geq N, \varepsilon \leq |a(m) - a(n)| \tag{2} \end{align} \] Let us prove that \[ \forall N \in \mathbb{N}, \exists n \geq N, \exists m \geq n, \varepsilon \leq |a(m) - a(n)| \tag{3} \] holds. To do so, let \(N \in \mathbb{N}\). By (2), there exist \(n, m\) such that \[ \begin{align} &n \geq N \tag{4} \\ &m \geq N \tag{5} \\ &\varepsilon \leq |a(m) - a(n)| \tag{6} \end{align} \] We will prove it by distinguishing cases according to whether \(n \leq m\).

Case 1: Suppose that \[ n \leq m \tag{7} \] Then (3) holds for \(n\) and \(m\) by (4), (7) and (6).

Case 2: Suppose that \[ m \leq n \tag{8} \] Then, by (6) and the symmetry of the absolute value (\(|x - y| = |y - x|\)), we have \[ \varepsilon \leq |a(n) - a(m)| \tag{9} \] and (3) holds for \(m\) and \(n\) by (5), (8) and (9).

2. Proofs in Lean 4

import Mathlib.Tactic

def IsCauchy {X : Type*} [AddGroup X] [Lattice X] (a : ℕ → X) : Prop :=
  ∀ (ε : X), 0 < ε → ∃ N : ℕ, ∀ n ≥ N, ∀ m ≥ N, |a m - a n| < ε

variable {X : Type*} [CommRing X] [LinearOrder X]
variable {a : ℕ → X}

-- Proof 1
-- =======

example
  (hC : ¬ IsCauchy a)
  : ∃ ε : X, 0 < ε ∧ ∀ (N : ℕ), ∃ n ≥ N, ∃ m ≥ n, ε ≤ |a m - a n| :=
by
  unfold IsCauchy at hC
  -- hC : ¬∀ (ε : X), 0 < ε → ∃ N, ∀ n ≥ N, ∀ m ≥ N, |a m - a n| < ε
  push Not at hC
  -- hC : ∃ ε, 0 < ε ∧ ∀ (N : ℕ), ∃ n ≥ N, ∃ m ≥ N, ε ≤ |a m - a n|
  obtain ⟨ε, hε1, hε2⟩ := hC
  -- ε : X
  -- hε1 : 0 < ε
  -- hε2 : ∀ (N : ℕ), ∃ n ≥ N, ∃ m ≥ N, ε ≤ |a m - a n|
  have hε3 : ∀ (N : ℕ), ∃ n ≥ N, ∃ m ≥ n, ε ≤ |a m - a n| := by
    intro N
    -- N : ℕ
    -- ⊢ ∃ n ≥ N, ∃ m ≥ n, ε ≤ |a m - a n|
    obtain ⟨n, hn, m, hm, h⟩ := hε2 N
    -- n : ℕ
    -- hn : n ≥ N
    -- m : ℕ
    -- hm : m ≥ N
    -- h : ε ≤ |a m - a n|
    rcases le_total n m with hnm1 | hmn2
    · -- hnm1 : n ≤ m
      exact ⟨n, hn, m, hnm1, h⟩
    · -- hmn2 : m ≤ n
      have h' : ε ≤ |a n - a m| := by rwa [abs_sub_comm]
      exact ⟨m, hm, n, hmn2, h'⟩
  exact ⟨ε, hε1, hε3⟩

-- Proof 2
-- =======

theorem exists_ordered_gap_of_not_isCauchy
  (hC : ¬ IsCauchy a)
  : ∃ ε : X, 0 < ε ∧ ∀ (N : ℕ), ∃ n ≥ N, ∃ m ≥ n, ε ≤ |a m - a n| :=
by
  unfold IsCauchy at hC
  -- hC : ¬∀ (ε : X), 0 < ε → ∃ N, ∀ n ≥ N, ∀ m ≥ N, |a m - a n| < ε
  push Not at hC
  -- hC : ∃ ε, 0 < ε ∧ ∀ (N : ℕ), ∃ n ≥ N, ∃ m ≥ N, ε ≤ |a m - a n|
  obtain ⟨ε, hε1, hε2⟩ := hC
  -- ε : X
  -- hε1 : 0 < ε
  -- hε2 : ∀ (N : ℕ), ∃ n ≥ N, ∃ m ≥ N, ε ≤ |a m - a n|
  refine ⟨ε, hε1, fun N => ?_⟩
  -- N : ℕ
  -- ⊢ ∃ n ≥ N, ∃ m ≥ n, ε ≤ |a m - a n|
  obtain ⟨n, hn, m, hm, h⟩ := hε2 N
  -- n : ℕ
  -- hn : n ≥ N
  -- m : ℕ
  -- hm : m ≥ N
  -- h : ε ≤ |a m - a n|
  rcases le_total n m with hnm1 | hmn2
  · -- hnm1 : n ≤ m
    exact ⟨n, hn, m, hnm1, h⟩
  · -- hmn2 : m ≤ n
    exact ⟨m, hm, n, hmn2, by rwa [abs_sub_comm]⟩

You can inspect, modify and run the code of these proofs interactively in Lean 4 Web.

Comments