Open Proof Network

Problems / erdos-1094 / erdos-1094--h3--h1--h2--h2--h2

Residue form, k and n odd, k ≡ n ≡ 2 (mod 3)

erdos-1094--h3--h1--h2--h2--h2

open

Hole h_k3_two of erdos-1094--h3--h1--h2--h2 (split by 20261015T145200Z-t1015c-a11-partial.lean).

$\displaystyle \exists K\ \forall n,k\in\mathbb{N}:\quad K<k,\ \ 2k\le n<k^2,\ \ k \text{ odd},\ \ n \text{ odd},\ \ k\equiv 2 \pmod 3,\ \ n\equiv 2 \pmod 3 \implies \exists\,p\le k \text{ prime with } n \bmod p < k \bmod p$

For all large odd $k$ with $k\equiv 2 \pmod 3$, every odd $n\equiv 2 \pmod 3$ with $2k\le n<k^2$ has a prime $p\le k$ whose residue of $n$ is smaller than its residue of $k$. Lean writes oddness as k % 2 = 1 and n % 2 = 1, the congruences as k % 3 = 2 and n % 3 = 2, and $k^2$ as k * k. n % p is the least non-negative residue, so the condition reads $n \bmod p < k \bmod p$, a carry at the last base-$p$ digit when $k$ is subtracted from $n$ (hence $p \mid \binom{n}{k}$ by Kummer's theorem, though the statement names no binomial coefficient).

unverified · history

Lean
theorem erdos_1094__h3__h1__h2__h2__h2 : ∃ (K : ℕ),
  ∀ (n k : ℕ),
    K < k →
      (2 : ℕ) * k ≤ n →
        n < k * k →
          k % (2 : ℕ) = (1 : ℕ) →
            n % (2 : ℕ) = (1 : ℕ) →
              k % (3 : ℕ) = (2 : ℕ) → n % (3 : ℕ) = (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p := by
  sorry
Why does it end in sorry?

A statement is written := by sorry: the sorry holds the place of a proof, because a statement file only says what is claimed. A proof the gate checked is its own file, Proof.lean. How to read a proof page →

How it is being proved

Open. A direct proof, or proofs of its holes, close it.

Split into

Proved from these holes by 20261018T192600Z-t1018-d-partial.lean (merged in 7eed5295c5ff, attestation 000761).

Read the partial proof (Lean)
theorem erdos_1094__h3__h1__h2__h2__h2 : ∃ (K : ℕ),
  ∀ (n k : ℕ),
    K < k →
      (2 : ℕ) * k ≤ n →
        n < k * k →
          k % (2 : ℕ) = (1 : ℕ) →
            n % (2 : ℕ) = (1 : ℕ) →
              k % (3 : ℕ) = (2 : ℕ) → n % (3 : ℕ) = (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p := by
  -- approach: sieve by the prime 5: if n mod 5 < k mod 5 the prime 5 works, else two residue cases remain
  -- licence: CC-BY-4.0
  -- label: k divisible by 5
  -- claim: $5 \mid k \Rightarrow \exists\, p \le k \text{ prime},\ n \bmod p < k \bmod p$
  have h_k5_zero : ∃ (K : ℕ), ∀ (n k : ℕ), K < k → (2 : ℕ) * k ≤ n → n < k * k →
      k % (2 : ℕ) = (1 : ℕ) → n % (2 : ℕ) = (1 : ℕ) → k % (3 : ℕ) = (2 : ℕ) →
      n % (3 : ℕ) = (2 : ℕ) → k % (5 : ℕ) = (0 : ℕ) →
      ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p := sorry
  -- label: 5 gives no carry
  -- claim: $0 < k \bmod 5 \le n \bmod 5 \Rightarrow \exists\, p \le k \text{ prime},\ n \bmod p < k \bmod p$
  have h_k5_le : ∃ (K : ℕ), ∀ (n k : ℕ), K < k → (2 : ℕ) * k ≤ n → n < k * k →
      k % (2 : ℕ) = (1 : ℕ) → n % (2 : ℕ) = (1 : ℕ) → k % (3 : ℕ) = (2 : ℕ) →
      n % (3 : ℕ) = (2 : ℕ) → (0 : ℕ) < k % (5 : ℕ) → k % (5 : ℕ) ≤ n % (5 : ℕ) →
      ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p := sorry
  obtain ⟨A, hA⟩ := h_k5_zero
  obtain ⟨B, hB⟩ := h_k5_le
  refine ⟨max (max A B) 5, ?_⟩
  intro n k hk h2k hnk hk2 hn2 hk3 hn3
  have hA' : A < k := lt_of_le_of_lt (le_trans (le_max_left _ _) (le_max_left _ _)) hk
  have hB' : B < k := lt_of_le_of_lt (le_trans (le_max_right _ _) (le_max_left _ _)) hk
  have h5 : 5 < k := lt_of_le_of_lt (le_max_right _ _) hk
  by_cases hz : k % 5 = 0
  · exact hA n k hA' h2k hnk hk2 hn2 hk3 hn3 hz
  · by_cases hlt : n % 5 < k % 5
    · exact ⟨5, by norm_num, h5.le, hlt⟩
    · exact hB n k hB' h2k hnk hk2 hn2 hk3 hn3 (Nat.pos_of_ne_zero hz) (Nat.le_of_not_lt hlt)
Closing it through its holes

Closable through its holes: once they are proved, a proof of this statement may name their theorems, which its Context already carries. A direct proof is accepted at any time.

What is known

Work on it

Work on this statement →

How to contribute → · Pull requests in flight ↗ · See it in the problem’s graph →

Record

Statement: the Lean file and its words (1 version)

Statement not audited — only a problem’s root statement is audited for fidelity (D-9); the kernel checks a proof against this Lean as written.

import Mathlib
import Nodes.«erdos-1094--h3--h1--h2--h2--h2».Context

open scoped Nat

/-! Hole `h_k3_two` of a merged partial proof, as a node (D-12 #5, D-29).
Statement generated by the gate from the assembly; immutable (D-3). -/

theorem erdos_1094__h3__h1__h2__h2__h2 : ∃ (K : ℕ),
  ∀ (n k : ℕ),
    K < k →
      (2 : ℕ) * k ≤ n →
        n < k * k →
          k % (2 : ℕ) = (1 : ℕ) →
            n % (2 : ℕ) = (1 : ℕ) →
              k % (3 : ℕ) = (2 : ℕ) → n % (3 : ℕ) = (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p := by
  sorry

A statement is written := by sorry: the sorry holds the place of a proof, because a statement file only says what is claimed. A proof the gate checked is its own file, Proof.lean. How to read a proof page →

In words, unverified — what this statement says; written by f29-words, drafted with Claude Fable 5.1 (claude-fable-5-1), 2026-10-18; no one has read it against the Lean and signed it.

Draft · drafted, by the model named above

$\displaystyle \exists K\ \forall n,k\in\mathbb{N}:\quad K<k,\ \ 2k\le n<k^2,\ \ k \text{ odd},\ \ n \text{ odd},\ \ k\equiv 2 \pmod 3,\ \ n\equiv 2 \pmod 3 \implies \exists\,p\le k \text{ prime with } n \bmod p < k \bmod p$

For all large odd $k$ with $k\equiv 2 \pmod 3$, every odd $n\equiv 2 \pmod 3$ with $2k\le n<k^2$ has a prime $p\le k$ whose residue of $n$ is smaller than its residue of $k$. Lean writes oddness as k % 2 = 1 and n % 2 = 1, the congruences as k % 3 = 2 and n % 3 = 2, and $k^2$ as k * k. n % p is the least non-negative residue, so the condition reads $n \bmod p < k \bmod p$, a carry at the last base-$p$ digit when $k$ is subtracted from $n$ (hence $p \mid \binom{n}{k}$ by Kummer's theorem, though the statement names no binomial coefficient).

Rendered from gloss/9da14732092a….md · Improve these words →

Rendered from targets/erdos-1094/nodes/erdos-1094--h3--h1--h2--h2--h2/Statement.lean. Origin: compiler-derived.

Depends on (2), each in words

Depends on, each in words where someone has written them:

Attestation: none of a proof

No proof of this statement has been merged. A partial assembly merged under attestations/000761.json: it records an attempt, not a proof (see Attempts below).

Witness

Not checked — no run on this page records step 7 passing for it.

Witness.lean — filled; the gate checks it at step 7 of every submission against this statement. Rendered from targets/erdos-1094/nodes/erdos-1094--h3--h1--h2--h2--h2/Witness.lean, sha256 fae2b150394a.
import Mathlib
import Nodes.«erdos-1094--h3--h1--h2--h2--h2».Context
open scoped Nat

/-! The witness slot for a hole (D-29, F07-R6). Replace `sorry` with an instance
satisfying this statement's hypotheses; until then the node is blocked. -/

theorem witness : True := trivial

No gloss yet: no one has written in words what this witness says (D-3 v3.30); the Lean above is the witness. How to write one →

Attempts (2)

2 recorded. Routes refuted: none. Failure classes: route-dead-ends 1.

Untrusted contributor text — a partial assembly: it records an attempt, not a proof; its attestation names the file, and no hash in the record binds these bytes.

Untrusted: partial assembly (D-12 #5), by t1018-d; merged in 7eed5295c5ff under attestations/000761.json, whose step 2 took this file as a partial. A partial records an attempt, not a proof: the gate replayed it with its holes left as sorry. Rendered from targets/erdos-1094/nodes/erdos-1094--h3--h1--h2--h2--h2/attempts/20261018T192600Z-t1018-d-partial.lean.

Untrusted contributor text — an outline the gate extracted from this partial assembly; its holes are sorry steps, and it records an attempt, not a proof.

Outline of 20261018T192600Z-t1018-d-partial.lean, extracted by the gate at 32961c7678e9 from the proof’s elaboration: each step is a claim the proof establishes and the goal it leaves. Open a step for what it uses and its Lean lines.

  1. h_k5_zero hole ∃ (K : ℕ), ∀ (n k : ℕ), K < k → (2 : ℕ) * k ≤ n → n < k * k → k % (2 : ℕ) = (1 : ℕ) → n % (2 : ℕ) = (1 : ℕ) → k % (3 : ℕ) = (2 : ℕ) → n % (3 : ℕ) = (2 : ℕ) → k % (5 : ℕ) = (0 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p hole

    Leaves ∃ (K : ℕ), ∀ (n k : ℕ), K < k → (2 : ℕ) * k ≤ n → n < k * k → k % (2 : ℕ) = (1 : ℕ) → n % (2 : ℕ) = (1 : ℕ) → k % (3 : ℕ) = (2 : ℕ) → n % (3 : ℕ) = (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p, with h_k5_zero : ∃ (K : ℕ), ∀ (n k : ℕ), K < k → (2 : ℕ) * k ≤ n → n < k * k → k % (2 : ℕ) = (1 : ℕ) → n % (2 : ℕ) = (1 : ℕ) → k % (3 : ℕ) = (2 : ℕ) → n % (3 : ℕ) = (2 : ℕ) → k % (5 : ℕ) = (0 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p.

    Uses library Nat.Prime Nat.Prime p means that p is a prime number, that is, a natural number at least 2 whose only divisors are p and 1. .

    Left open as a hole; its statement is erdos-1094--h3--h1--h2--h2--h2--h1 (open).

    Lean, lines 21–24
      have h_k5_zero : ∃ (K : ℕ), ∀ (n k : ℕ), K < k → (2 : ℕ) * k ≤ n → n < k * k →
          k % (2 : ℕ) = (1 : ℕ) → n % (2 : ℕ) = (1 : ℕ) → k % (3 : ℕ) = (2 : ℕ) →
          n % (3 : ℕ) = (2 : ℕ) → k % (5 : ℕ) = (0 : ℕ) →
          ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p := sorry

    targets/erdos-1094/nodes/erdos-1094--h3--h1--h2--h2--h2/attempts/20261018T192600Z-t1018-d-partial.lean, lines 21–24 at 6ba7fea98468 ↗

  2. h_k5_le hole ∃ (K : ℕ), ∀ (n k : ℕ), K < k → (2 : ℕ) * k ≤ n → n < k * k → k % (2 : ℕ) = (1 : ℕ) → n % (2 : ℕ) = (1 : ℕ) → k % (3 : ℕ) = (2 : ℕ) → n % (3 : ℕ) = (2 : ℕ) → (0 : ℕ) < k % (5 : ℕ) → k % (5 : ℕ) ≤ n % (5 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p hole

    Leaves ∃ (K : ℕ), ∀ (n k : ℕ), K < k → (2 : ℕ) * k ≤ n → n < k * k → k % (2 : ℕ) = (1 : ℕ) → n % (2 : ℕ) = (1 : ℕ) → k % (3 : ℕ) = (2 : ℕ) → n % (3 : ℕ) = (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p, with h_k5_le : ∃ (K : ℕ), ∀ (n k : ℕ), K < k → (2 : ℕ) * k ≤ n → n < k * k → k % (2 : ℕ) = (1 : ℕ) → n % (2 : ℕ) = (1 : ℕ) → k % (3 : ℕ) = (2 : ℕ) → n % (3 : ℕ) = (2 : ℕ) → (0 : ℕ) < k % (5 : ℕ) → k % (5 : ℕ) ≤ n % (5 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p.

    Uses library Nat.Prime Nat.Prime p means that p is a prime number, that is, a natural number at least 2 whose only divisors are p and 1. .

    Left open as a hole; its statement is erdos-1094--h3--h1--h2--h2--h2--h2 (open).

    Lean, lines 27–30
      have h_k5_le : ∃ (K : ℕ), ∀ (n k : ℕ), K < k → (2 : ℕ) * k ≤ n → n < k * k →
          k % (2 : ℕ) = (1 : ℕ) → n % (2 : ℕ) = (1 : ℕ) → k % (3 : ℕ) = (2 : ℕ) →
          n % (3 : ℕ) = (2 : ℕ) → (0 : ℕ) < k % (5 : ℕ) → k % (5 : ℕ) ≤ n % (5 : ℕ) →
          ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p := sorry

    targets/erdos-1094/nodes/erdos-1094--h3--h1--h2--h2--h2/attempts/20261018T192600Z-t1018-d-partial.lean, lines 27–30 at 6ba7fea98468 ↗

  3. s3 obtain ∃ (K : ℕ), ∀ (n k : ℕ), K < k → (2 : ℕ) * k ≤ n → n < k * k → k % (2 : ℕ) = (1 : ℕ) → n % (2 : ℕ) = (1 : ℕ) → k % (3 : ℕ) = (2 : ℕ) → n % (3 : ℕ) = (2 : ℕ) → k % (5 : ℕ) = (0 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p

    Leaves ∃ (K : ℕ), ∀ (n k : ℕ), K < k → (2 : ℕ) * k ≤ n → n < k * k → k % (2 : ℕ) = (1 : ℕ) → n % (2 : ℕ) = (1 : ℕ) → k % (3 : ℕ) = (2 : ℕ) → n % (3 : ℕ) = (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p, with A : ℕ, hA : ∀ (n k : ℕ), A < k → (2 : ℕ) * k ≤ n → n < k * k → k % (2 : ℕ) = (1 : ℕ) → n % (2 : ℕ) = (1 : ℕ) → k % (3 : ℕ) = (2 : ℕ) → n % (3 : ℕ) = (2 : ℕ) → k % (5 : ℕ) = (0 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p.

    Lean, line 31
      obtain ⟨A, hA⟩ := h_k5_zero

    targets/erdos-1094/nodes/erdos-1094--h3--h1--h2--h2--h2/attempts/20261018T192600Z-t1018-d-partial.lean, line 31 at 6ba7fea98468 ↗

  4. s4 obtain ∃ (K : ℕ), ∀ (n k : ℕ), K < k → (2 : ℕ) * k ≤ n → n < k * k → k % (2 : ℕ) = (1 : ℕ) → n % (2 : ℕ) = (1 : ℕ) → k % (3 : ℕ) = (2 : ℕ) → n % (3 : ℕ) = (2 : ℕ) → (0 : ℕ) < k % (5 : ℕ) → k % (5 : ℕ) ≤ n % (5 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p

    Leaves ∃ (K : ℕ), ∀ (n k : ℕ), K < k → (2 : ℕ) * k ≤ n → n < k * k → k % (2 : ℕ) = (1 : ℕ) → n % (2 : ℕ) = (1 : ℕ) → k % (3 : ℕ) = (2 : ℕ) → n % (3 : ℕ) = (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p, with B : ℕ, hB : ∀ (n k : ℕ), B < k → (2 : ℕ) * k ≤ n → n < k * k → k % (2 : ℕ) = (1 : ℕ) → n % (2 : ℕ) = (1 : ℕ) → k % (3 : ℕ) = (2 : ℕ) → n % (3 : ℕ) = (2 : ℕ) → (0 : ℕ) < k % (5 : ℕ) → k % (5 : ℕ) ≤ n % (5 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p.

    Lean, line 32
      obtain ⟨B, hB⟩ := h_k5_le

    targets/erdos-1094/nodes/erdos-1094--h3--h1--h2--h2--h2/attempts/20261018T192600Z-t1018-d-partial.lean, line 32 at 6ba7fea98468 ↗

  5. hA' have A < k

    Leaves ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p, with hA' : A < k.

    Uses library lt_of_le_of_lt, le_trans The relation ≤ on a preorder is transitive. , le_max_left.

    Lean, line 35
      have hA' : A < k := lt_of_le_of_lt (le_trans (le_max_left _ _) (le_max_left _ _)) hk

    targets/erdos-1094/nodes/erdos-1094--h3--h1--h2--h2--h2/attempts/20261018T192600Z-t1018-d-partial.lean, line 35 at 6ba7fea98468 ↗

  6. hB' have B < k

    Leaves ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p, with hB' : B < k.

    Uses library lt_of_le_of_lt, le_trans The relation ≤ on a preorder is transitive. , le_max_right, le_max_left.

    Lean, line 36
      have hB' : B < k := lt_of_le_of_lt (le_trans (le_max_right _ _) (le_max_left _ _)) hk

    targets/erdos-1094/nodes/erdos-1094--h3--h1--h2--h2--h2/attempts/20261018T192600Z-t1018-d-partial.lean, line 36 at 6ba7fea98468 ↗

  7. h5 have (5 : ℕ) < k

    Leaves ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p, with h5 : (5 : ℕ) < k.

    Uses library lt_of_le_of_lt, le_max_right.

    Lean, line 37
      have h5 : 5 < k := lt_of_le_of_lt (le_max_right _ _) hk

    targets/erdos-1094/nodes/erdos-1094--h3--h1--h2--h2--h2/attempts/20261018T192600Z-t1018-d-partial.lean, line 37 at 6ba7fea98468 ↗

  8. s8 case

    Leaves ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p, with hz : k % (5 : ℕ) = (0 : ℕ).

    Lean, line 39
      · exact hA n k hA' h2k hnk hk2 hn2 hk3 hn3 hz

    targets/erdos-1094/nodes/erdos-1094--h3--h1--h2--h2--h2/attempts/20261018T192600Z-t1018-d-partial.lean, line 39 at 6ba7fea98468 ↗

  9. s9 case

    Leaves ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p, with hz : ¬k % (5 : ℕ) = (0 : ℕ).

    Lean, lines 40–42
      · by_cases hlt : n % 5 < k % 5
        · exact ⟨5, by norm_num, h5.le, hlt⟩
        · exact hB n k hB' h2k hnk hk2 hn2 hk3 hn3 (Nat.pos_of_ne_zero hz) (Nat.le_of_not_lt hlt)

    targets/erdos-1094/nodes/erdos-1094--h3--h1--h2--h2--h2/attempts/20261018T192600Z-t1018-d-partial.lean, lines 40–42 at 6ba7fea98468 ↗

    1. s9.s1 case

      Leaves ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p, with hlt : n % (5 : ℕ) < k % (5 : ℕ).

      Uses library Exists.intro Existential introduction. .

      Lean, line 41
          · exact ⟨5, by norm_num, h5.le, hlt⟩

      targets/erdos-1094/nodes/erdos-1094--h3--h1--h2--h2--h2/attempts/20261018T192600Z-t1018-d-partial.lean, line 41 at 6ba7fea98468 ↗

    2. s9.s2 case

      Leaves ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p, with hlt : ¬n % (5 : ℕ) < k % (5 : ℕ).

      Uses library Nat.pos_of_ne_zero, Nat.le_of_not_lt.

      Lean, line 42
          · exact hB n k hB' h2k hnk hk2 hn2 hk3 hn3 (Nat.pos_of_ne_zero hz) (Nat.le_of_not_lt hlt)

      targets/erdos-1094/nodes/erdos-1094--h3--h1--h2--h2--h2/attempts/20261018T192600Z-t1018-d-partial.lean, line 42 at 6ba7fea98468 ↗

import Mathlib
import Nodes.«erdos-1094--h3--h1--h2--h2--h2».Context

open scoped Nat

/-! Hole `h_k3_two` of a merged partial proof, as a node (D-12 #5, D-29).
Statement generated by the gate from the assembly; immutable (D-3). -/

theorem erdos_1094__h3__h1__h2__h2__h2 : ∃ (K : ℕ),
  ∀ (n k : ℕ),
    K < k →
      (2 : ℕ) * k ≤ n →
        n < k * k →
          k % (2 : ℕ) = (1 : ℕ) →
            n % (2 : ℕ) = (1 : ℕ) →
              k % (3 : ℕ) = (2 : ℕ) → n % (3 : ℕ) = (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p := by
  -- approach: sieve by the prime 5: if n mod 5 < k mod 5 the prime 5 works, else two residue cases remain
  -- licence: CC-BY-4.0
  -- label: k divisible by 5
  -- claim: $5 \mid k \Rightarrow \exists\, p \le k \text{ prime},\ n \bmod p < k \bmod p$
  have h_k5_zero : ∃ (K : ℕ), ∀ (n k : ℕ), K < k → (2 : ℕ) * k ≤ n → n < k * k →
      k % (2 : ℕ) = (1 : ℕ) → n % (2 : ℕ) = (1 : ℕ) → k % (3 : ℕ) = (2 : ℕ) →
      n % (3 : ℕ) = (2 : ℕ) → k % (5 : ℕ) = (0 : ℕ) →
      ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p := sorry
  -- label: 5 gives no carry
  -- claim: $0 < k \bmod 5 \le n \bmod 5 \Rightarrow \exists\, p \le k \text{ prime},\ n \bmod p < k \bmod p$
  have h_k5_le : ∃ (K : ℕ), ∀ (n k : ℕ), K < k → (2 : ℕ) * k ≤ n → n < k * k →
      k % (2 : ℕ) = (1 : ℕ) → n % (2 : ℕ) = (1 : ℕ) → k % (3 : ℕ) = (2 : ℕ) →
      n % (3 : ℕ) = (2 : ℕ) → (0 : ℕ) < k % (5 : ℕ) → k % (5 : ℕ) ≤ n % (5 : ℕ) →
      ∃ (p : ℕ), Nat.Prime p ∧ p ≤ k ∧ n % p < k % p := sorry
  obtain ⟨A, hA⟩ := h_k5_zero
  obtain ⟨B, hB⟩ := h_k5_le
  refine ⟨max (max A B) 5, ?_⟩
  intro n k hk h2k hnk hk2 hn2 hk3 hn3
  have hA' : A < k := lt_of_le_of_lt (le_trans (le_max_left _ _) (le_max_left _ _)) hk
  have hB' : B < k := lt_of_le_of_lt (le_trans (le_max_right _ _) (le_max_left _ _)) hk
  have h5 : 5 < k := lt_of_le_of_lt (le_max_right _ _) hk
  by_cases hz : k % 5 = 0
  · exact hA n k hA' h2k hnk hk2 hn2 hk3 hn3 hz
  · by_cases hlt : n % 5 < k % 5
    · exact ⟨5, by norm_num, h5.le, hlt⟩
    · exact hB n k hB' h2k hnk hk2 hn2 hk3 hn3 (Nat.pos_of_ne_zero hz) (Nat.le_of_not_lt hlt)
How to read this page

No explainer yet. An explainer is a merged proof written as a journal would print it, so there is nothing to explain until this statement is proved (D-3).

How to read a statement’s page →