Nat.segment
defimported Lean
The f-segment of k, where f : ℕ → ℕ will be assumed to be at least StrictMono.
Statement
set_option autoImplicit true in set_option relaxedAutoImplicit true in open Function Set in @[scoped grind] noncomputable def Nat.segment (f : ℕ → ℕ) (k : ℕ) : ℕ
- Defined in
- CSLib, `Nat.segment`
- 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.Nat.segment← Nat.segment (Cslib/Foundations/Data/Nat/Segment.lean:28): verbatim
- Verified
- 08 Oct 2026
- Axioms
- none listed
- Used by 9
- Nat.segment'
segment'is a helper function that will be proved to be equal tosegment. It facilitates the proofs of some theorems below. - Nat.segment_upper_boundFor a strictly monotonic function
f : ℕ → ℕwithf 0 = 0,k < f (segment f k + 1)for allk : ℕ. - Nat.segment_zeroFor a strictly monotonic function
f : ℕ → ℕwithf 0 = 0,segment f 0 = 0. - Nat.segment_lower_boundFor a strictly monotonic function
f : ℕ → ℕwithf 0 = 0,f (segment f k) ≤ kfor allk : ℕ. - Nat.segment_galois_connectionFor a strictly monotonic function
f : ℕ → ℕwithf 0 = 0,fandsegment fform a Galois connection. - Nat.segment_range_valFor a strictly monotonic function
f : ℕ → ℕ, allksatisfyingf m ≤ k < f (m + 1)hassegment f k = m. - Nat.segment_pre_zeroFor a strictly monotonic function
f : ℕ → ℕ,segment f k = 0for allk < f 0. - Nat.segment_plus_oneA slight restatement of the definition of
segmentwhich has proven useful. - Nat.segment_idemFor a strictly monotonic function
f : ℕ → ℕ, the segment off kisk.
- Nat.segment'
Lean source view module on GitHub
set_option autoImplicit true in set_option relaxedAutoImplicit true in open Function Set in /-- The `f`-segment of `k`, where `f : ℕ → ℕ` will be assumed to be at least StrictMono. -/ @[scoped grind] noncomputable def Nat.segment (f : ℕ → ℕ) (k : ℕ) : ℕ := open scoped Classical in Nat.count (· ∈ range f) (k + 1) - 1