AFTD Auto-Formalizing Theoretical Domains

Nat.segment_lower_bound

theoremverifiedformalizationimported Lean

For a strictly monotonic function f : ℕ → ℕ with f 0 = 0, f (segment f k) ≤ k for all k : ℕ.

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open Function Set in
variable {f : ℕ → ℕ} in
theorem Nat.segment_lower_bound (hm : StrictMono f) (h0 : f 0 = 0) (k : ℕ) :
    f (segment f k) ≤ k
Formalizes
CSLib, `Nat.segment_lower_bound`
Lean proof
By Ching-Tsun Chou, from github.com/leanprover/cslib at 3951377e5a3f (Copyright (c) 2025 Ching-Tsun Chou. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.33.0.
Verified
08 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 4
  • Nat.segmentThe f-segment of k, where f : ℕ → ℕ will be assumed to be at least StrictMono.
  • Nat.nth_of_strictMonoFor a strictly monotonic function f : ℕ → ℕ, f n is exactly the n-th element of the range of f.
  • Nat.count_notMem_range_posIf f 0 = 0, then 0 is below any n not in the range of f.
  • Nat.segment_idemFor a strictly monotonic function f : ℕ → ℕ, the segment of f k is k.
Used by 1

Lean source view module on GitHub

set_option autoImplicit true inset_option relaxedAutoImplicit true inopen Function Set invariable {f : ℕ → ℕ} in/-- For a strictly monotonic function `f : ℕ → ℕ` with `f 0 = 0`, `f (segment f k) ≤ k` for all `k : ℕ`. -/theorem Nat.segment_lower_bound (hm : StrictMono f) (h0 : f 0 = 0) (k : ℕ) :    f (segment f k) ≤ k := by  classical  rw [nth_of_strictMono hm (segment f k), segment]  rcases Classical.em (k ∈ range f) with h_k | h_k  · simp_all [count_succ_eq_succ_count]  · have h1 : count (· ∈ range f) k > 0 := count_notMem_range_pos h0 k h_k    have h2 : count (· ∈ range f) (k + 1) = count (· ∈ range f) k :=      count_succ_eq_count h_k    rw [h2]    suffices _ : nth (· ∈ range f) (count (· ∈ range f) k - 1) < k by omega    apply nth_lt_of_lt_count    omega
See it in the graphDiscuss this resultChallenge it