AFTD Auto-Formalizing Theoretical Domains

Nat.count_notMem_range_pos

theoremverifiedformalizationimported Lean

If f 0 = 0, then 0 is below any n not in the range of f.

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open Function Set in
variable {f : ℕ → ℕ} in
open scoped Classical in
theorem Nat.count_notMem_range_pos (h0 : f 0 = 0) (n : ℕ) (hn : n ∉ range f) :
    count (· ∈ range f) n > 0
Formalizes
CSLib, `Nat.count_notMem_range_pos`
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
Used by 1
  • Nat.segment_lower_boundFor a strictly monotonic function f : ℕ → ℕ with f 0 = 0, f (segment f k) ≤ k 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/-- If `f 0 = 0`, then `0` is below any `n` not in the range of `f`. -/theorem Nat.count_notMem_range_pos (h0 : f 0 = 0) (n : ℕ) (hn : n ∉ range f) :    count (· ∈ range f) n > 0 := by  have := count_monotone (· ∈ range f) (show 1 ≤ n by grind)  grind
See it in the graphDiscuss this resultChallenge it