AFTD Auto-Formalizing Theoretical Domains

Nat.segment_plus_one

theoremverifiedformalizationimported Lean

A slight restatement of the definition of segment which has proven useful.

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open Function Set in
variable {f : ℕ → ℕ} in
open scoped Classical in
theorem Nat.segment_plus_one (h0 : f 0 = 0) (k : ℕ) :
    segment f k + 1 = count (· ∈ range f) (k + 1)
Formalizes
CSLib, `Nat.segment_plus_one`
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 2
  • Nat.segmentThe f-segment of k, where f : ℕ → ℕ will be assumed to be at least StrictMono.
  • Nat.segment_idemFor a strictly monotonic function f : ℕ → ℕ, the segment of f k is k.
Used by 1
  • Nat.segment_upper_boundFor a strictly monotonic function f : ℕ → ℕ with f 0 = 0, k < f (segment f k + 1) for all k : ℕ.

Lean source view module on GitHub

set_option autoImplicit true inset_option relaxedAutoImplicit true inopen Function Set invariable {f : ℕ → ℕ} inopen scoped Classical in/-- A slight restatement of the definition of `segment` which has proven useful. -/theorem Nat.segment_plus_one (h0 : f 0 = 0) (k : ℕ) :    segment f k + 1 = count (· ∈ range f) (k + 1) := by  suffices _ : count (· ∈ range f) (k + 1) ≠ 0 by unfold segment; omega  apply count_ne_iff_exists.mpr; use 0; grind
See it in the graphDiscuss this resultChallenge it