Documentation

Cslib.Foundations.Data.Nat.Segment

Segments defined by a strictly monotonic function on Nat #

Given a strictly monotonic function f : ℕ → ℕ and k : ℕ with k ≥ f 0, Nat.segment f k is the unique m : ℕ such that f m ≤ k < f (k + 1). Nat.segment f k is defined to be 0 for k < f 0. This file defines Nat.segment and proves various properties aboout it.

noncomputable def Nat.segment (f : ) (k : ) :

The f-segment of k, where f : ℕ → ℕ will be assumed to be at least StrictMono.

Equations
Instances For

    Any strictly monotonic function f : ℕ → ℕ has an infinite range.

    theorem Nat.infinite_strictMono {ns : Set } (h : ns.Infinite) :
    ∃ (f : ), StrictMono f Set.range f = ns

    Any infinite subset of is the range of a strictly monotonic function.

    theorem Nat.nth_succ_gap {p : Prop} (hf : (setOf p).Infinite) (n k : ) :
    k < nth p (n + 1) - nth p nk > 0¬p (k + nth p n)

    There is a gap between two successive occurrences of a predicate p : ℕ → Prop, assuming p (as a set) is infinite.

    theorem Nat.nth_of_strictMono {f : } (hm : StrictMono f) (n : ) :
    f n = nth (fun (x : ) => x Set.range f) n

    For a strictly monotonic function f : ℕ → ℕ, f n is exactly the n-th element of the range of f.

    theorem Nat.count_notMem_range_pos {f : } (h0 : f 0 = 0) (n : ) (hn : nSet.range f) :
    count (fun (x : ) => x Set.range f) n > 0

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

    theorem Nat.strictMono_range_gap {f : } (hm : StrictMono f) {m k : } (hl : f m < k) (hu : k < f (m + 1)) :
    kSet.range f

    For a strictly monotonic function f : ℕ → ℕ, no number (strictly) between f m and f (m + 1) is in the range of f.

    @[simp]
    theorem Nat.segment_idem {f : } (hm : StrictMono f) (k : ) :
    segment f (f k) = k

    For a strictly monotonic function f : ℕ → ℕ, the segment of f k is k.

    theorem Nat.segment_pre_zero {f : } (hm : StrictMono f) {k : } (h : k < f 0) :
    segment f k = 0

    For a strictly monotonic function f : ℕ → ℕ, segment f k = 0 for all k < f 0.

    theorem Nat.segment_zero {f : } (hm : StrictMono f) (h0 : f 0 = 0) :
    segment f 0 = 0

    For a strictly monotonic function f : ℕ → ℕ with f 0 = 0, segment f 0 = 0.

    theorem Nat.segment_plus_one {f : } (h0 : f 0 = 0) (k : ) :
    segment f k + 1 = count (fun (x : ) => x Set.range f) (k + 1)

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

    theorem Nat.segment_upper_bound {f : } (hm : StrictMono f) (h0 : f 0 = 0) (k : ) :
    k < f (segment f k + 1)

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

    theorem Nat.segment_lower_bound {f : } (hm : StrictMono f) (h0 : f 0 = 0) (k : ) :
    f (segment f k) k

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

    theorem Nat.segment_range_val {f : } (hm : StrictMono f) {m k : } (hl : f m k) (hu : k < f (m + 1)) :
    segment f k = m

    For a strictly monotonic function f : ℕ → ℕ, all k satisfying f m ≤ k < f (m + 1) has segment f k = m.

    theorem Nat.segment_galois_connection {f : } (hm : StrictMono f) (h0 : f 0 = 0) :

    For a strictly monotonic function f : ℕ → ℕ with f 0 = 0, f and segment f form a Galois connection.

    noncomputable def Nat.segment' (f : ) (k : ) :

    segment' is a helper function that will be proved to be equal to segment. It facilitates the proofs of some theorems below.

    Equations
    Instances For
      theorem Nat.segment'_eq_segment {f : } (hm : StrictMono f) :

      For a strictly monotonic function f : ℕ → ℕ, segment' f and segment f are actually equal.

      theorem Nat.segment_zero' {f : } (hm : StrictMono f) {k : } (h : k f 0) :
      segment f k = 0

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

      theorem Nat.segment_upper_bound' {f : } (hm : StrictMono f) {k : } (h : f 0 k) :
      k < f (segment f k + 1)

      For a strictly monotonic function f : ℕ → ℕ, k < f (segment f k + 1) for all k ≥ f 0.

      theorem Nat.segment_lower_bound' {f : } (hm : StrictMono f) {k : } (h : f 0 k) :
      f (segment f k) k

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