Challenge 32: Successor criterion for extraction functions
A subsequence is obtained by applying an extraction function to the original sequence; that is, a strictly increasing function \(\varphi : \mathbb{N} \to \mathbb{N}\). For example, the subsequence \[ u_0, u_2, u_4, u_6, \dots \] is obtained with the extraction function \(\varphi\) defined by \(\varphi(n) = 2n\).
Prove that if \[ \forall n, \varphi(n) < \varphi (n+1), \] then \(\varphi\) is an extraction function.
To do so, complete the following Lean 4 theory:
import Mathlib.Basic.Real.Basic def IsExtraction (φ : ℕ → ℕ) : Prop := StrictMono φ variable (φ : ℕ → ℕ) example (hφ : ∀ n, φ n < φ (n + 1)) : IsExtraction φ := 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 it, 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. Proofs in natural language
Let \(\varphi : \mathbb{N} \to \mathbb{N}\) be such that \[ \forall n \in \mathbb{N}, \varphi(n) < \varphi(n+1) \tag{1} \] We have to prove that \(\varphi\) is an extraction function; that is, \[ \forall i j \in \mathbb{N}, i < j \to \varphi(i) < \varphi(j) \]
Proof 1 (induction on \(j\))
Let \(i, j \in \mathbb{N}\) with \(i < j\). We prove by induction on \(j\) that \(\varphi(i) < \varphi(j)\).
Case \(j = 0\). The hypothesis \(i < 0\) is impossible, since no natural number is less than \(0\). Hence the result holds vacuously.
Step \(j = n + 1\). Assume as induction hypothesis that \[ i < n \to \varphi(i) < \varphi(n) \tag{ih} \] and we have to prove that \[ i < n+1 \to \varphi(i) < \varphi(n+1) \] To do so, let \[ i < n+1 \tag{2} \] and we have to prove that \[ \varphi(i) < \varphi(n+1) \] We will proceed by cases, since from (2) it follows that \[ i < n \lor i = n \] Case \(i < n\). Then, \[ \begin{array}{llll} \varphi(i) &< \varphi(n) &&\text{[by (ih), since \(i < n\)]} \\ &< \varphi(n+1) &&\text{[by (1)]} \end{array} \] Case \(i = n\). Then, \[ \begin{array}{llll} \varphi(i) &= \varphi(n) &&\text{[since \(i = n\)]} \\ &< \varphi(n+1) &&\text{[by (1)]} \end{array} \]
Proof 2 (induction on the inequality)
Let \(i, j \in \mathbb{N}\) with \(i < j\), or, equivalently, \(i + 1 \leq j\). We prove by induction on \(j\), starting from \(j = i + 1\), that \(\varphi(i) < \varphi(j)\).
Base case \(j = i + 1\). We have to prove \(\varphi(i) < \varphi(i+1)\), which is (1) for \(n = i\).
Inductive step. Let \(m \geq i + 1\) and assume that \[ \varphi(i) < \varphi(m) \tag{ih} \] Then, \[ \begin{array}{llll} \varphi(i) &< \varphi(m) &&\text{[by (ih)]} \\ &< \varphi(m+1) &&\text{[by (1)]} \end{array} \]
Proof 3 (Mathlib lemma)
It suffices to apply Mathlib's lemma strictMono_nat_of_lt_succ, which states that a function \(f : \mathbb{N} \to \alpha\), with \(\alpha\) a preorder, is strictly increasing if \(f(n) < f(n+1)\) for all \(n\). Since \(\varphi\) satisfies (1), it is strictly increasing and, by definition, an extraction function.
2. Proofs in Lean 4
import Mathlib.Basic.Real.Basic def IsExtraction (φ : ℕ → ℕ) : Prop := StrictMono φ variable (φ : ℕ → ℕ) -- Proof 1 -- ======= example (hφ : ∀ n, φ n < φ (n + 1)) : IsExtraction φ := by intro i j hij -- i j : ℕ -- hij : i < j -- ⊢ φ i < φ j induction j with | zero => -- hij : i < 0 -- ⊢ φ i < φ 0 exact absurd hij (Nat.not_lt_zero i) | succ n ih => -- n : ℕ -- ih : i < n → φ i < φ n -- hij : i < n + 1 -- ⊢ φ i < φ (n + 1) rcases lt_or_eq_of_le (Nat.lt_succ_iff.mp hij) with h1 | h2 · -- h1 : i < n calc φ i < φ n := ih h1 _ < φ (n + 1) := hφ n · -- h2 : i = n calc φ i = φ n := by rw [h2] _ < φ (n + 1) := hφ n -- Proof 2 -- ======= example (hφ : ∀ n, φ n < φ (n + 1)) : IsExtraction φ := by intro i j hij -- i j : ℕ -- hij : i < j -- ⊢ φ i < φ j have h : i + 1 ≤ j := hij clear hij induction j, h using Nat.le_induction with | base => -- ⊢ φ i < φ (i + 1) exact hφ i | succ m _ ih => -- m : ℕ -- ih : φ i < φ m -- ⊢ φ i < φ (m + 1) calc φ i < φ m := ih _ < φ (m + 1) := hφ m -- Proof 3 -- ======= theorem isExtraction_of_lt_succ (hφ : ∀ n, φ n < φ (n + 1)) : IsExtraction φ := strictMono_nat_of_lt_succ hφ
You can inspect, modify and run the code of these proofs interactively in Lean 4 Web.
Comments