File: Mathlib/Data/Nat/Find.lean

full_name: _private.Mathlib.Data.Nat.Find.0.Nat.lbp
code: private def lbp (m n : ℕ) : Prop 
goal: Prop

full_name: _private.Mathlib.Data.Nat.Find.0.Nat.wf_lbp
code: private def wf_lbp : WellFounded (@lbp p) 
goal: WellFounded Nat.lbp

full_name: Nat.findX
code: protected def findX : { n // p n ∧ ∀ m < n, ¬p m } 
goal: { n // p n ∧ ∀ (m : ℕ), m < n → ¬p m }

full_name: Nat.find
code: /-- If `p` is a (decidable) predicate on `ℕ` and `hp : ∃ (n : ℕ), p n` is a proof that
there exists some natural number satisfying `p`, then `Nat.find hp` is the
smallest natural number satisfying `p`. Note that `Nat.find` is protected,
meaning that you can't just write `find`, even if the `Nat` namespace is open.

The API for `Nat.find` is:

* `Nat.find_spec` is the proof that `Nat.find hp` satisfies `p`.
* `Nat.find_min` is the proof that if `m < Nat.find hp` then `m` does not satisfy `p`.
* `Nat.find_min'` is the proof that if `m` does satisfy `p` then `Nat.find hp ≤ m`.
-/
protected def find : ℕ 
goal: ℕ

full_name: Nat.find_spec
code: protected theorem find_spec : p (Nat.find H) 
goal: p (Nat.find H)

full_name: Nat.find_min
code: protected theorem find_min : ∀ {m : ℕ}, m < Nat.find H → ¬p m 
goal: m < Nat.find H → ¬p m

full_name: Nat.find_min'
code: protected theorem find_min' {m : ℕ} (h : p m) : Nat.find H ≤ m 
goal: Nat.find H ≤ m

full_name: Nat.find_eq_iff
code: lemma find_eq_iff (h : ∃ n : ℕ, p n) : Nat.find h = m ↔ p m ∧ ∀ n < m, ¬ p n 
goal: Nat.find h = m ↔ p m ∧ ∀ (n : ℕ), n < m → ¬p n

full_name: Nat.find_lt_iff
code: @[simp] lemma find_lt_iff (h : ∃ n : ℕ, p n) (n : ℕ) : Nat.find h < n ↔ ∃ m < n, p m 
goal: Nat.find h < n ↔ ∃ m, m < n ∧ p m

full_name: Nat.find_le_iff
code: @[simp] lemma find_le_iff (h : ∃ n : ℕ, p n) (n : ℕ) : Nat.find h ≤ n ↔ ∃ m ≤ n, p m 
goal: Nat.find h ≤ n ↔ ∃ m, m ≤ n ∧ p m

full_name: Nat.le_find_iff
code: @[simp] lemma le_find_iff (h : ∃ n : ℕ, p n) (n : ℕ) : n ≤ Nat.find h ↔ ∀ m < n, ¬ p m 
goal: n ≤ Nat.find h ↔ ∀ (m : ℕ), m < n → ¬p m

full_name: Nat.lt_find_iff
code: @[simp] lemma lt_find_iff (h : ∃ n : ℕ, p n) (n : ℕ) : n < Nat.find h ↔ ∀ m ≤ n, ¬ p m 
goal: n < Nat.find h ↔ ∀ (m : ℕ), m ≤ n → ¬p m

full_name: Nat.find_eq_zero
code: @[simp] lemma find_eq_zero (h : ∃ n : ℕ, p n) : Nat.find h = 0 ↔ p 0 
goal: Nat.find h = 0 ↔ p 0

full_name: Nat.find_mono
code: lemma find_mono (h : ∀ n, q n → p n) {hp : ∃ n, p n} {hq : ∃ n, q n} : Nat.find hp ≤ Nat.find hq 
goal: Nat.find hp ≤ Nat.find hq

full_name: Nat.find_le
code: lemma find_le {h : ∃ n, p n} (hn : p n) : Nat.find h ≤ n 
goal: Nat.find h ≤ n

full_name: Nat.find_comp_succ
code: lemma find_comp_succ (h₁ : ∃ n, p n) (h₂ : ∃ n, p (n + 1)) (h0 : ¬ p 0) :
    Nat.find h₁ = Nat.find h₂ + 1 
goal: Nat.find h₁ = Nat.find h₂ + 1

full_name: Nat.find_pos
code: lemma find_pos (h : ∃ n : ℕ, p n) : 0 < Nat.find h ↔ ¬p 0 
goal: 0 < Nat.find h ↔ ¬p 0

full_name: Nat.find_add
code: lemma find_add {hₘ : ∃ m, p (m + n)} {hₙ : ∃ n, p n} (hn : n ≤ Nat.find hₙ) :
    Nat.find hₘ + n = Nat.find hₙ 
goal: Nat.find hₘ + n = Nat.find hₙ

full_name: Nat.findGreatest
code: /-- `Nat.findGreatest P n` is the largest `i ≤ bound` such that `P i` holds, or `0` if no such `i`
exists -/
def findGreatest (P : ℕ → Prop) [DecidablePred P] : ℕ → ℕ
  
goal: ℕ → ℕ

full_name: Nat.findGreatest_zero
code: @[simp] lemma findGreatest_zero : Nat.findGreatest P 0 = 0 
goal: Nat.findGreatest P 0 = 0

full_name: Nat.findGreatest_succ
code: lemma findGreatest_succ (n : ℕ) :
    Nat.findGreatest P (n + 1) = if P (n + 1) then n + 1 else Nat.findGreatest P n 
goal: Nat.findGreatest P (n + 1) = if P (n + 1) then n + 1 else Nat.findGreatest P n

full_name: Nat.findGreatest_eq
code: @[simp] lemma findGreatest_eq : ∀ {n}, P n → Nat.findGreatest P n = n
  
goal: P n → Nat.findGreatest P n = n

full_name: Nat.findGreatest_of_not
code: @[simp]
lemma findGreatest_of_not (h : ¬ P (n + 1)) : findGreatest P (n + 1) = findGreatest P n 
goal: Nat.findGreatest P (n + 1) = Nat.findGreatest P n

full_name: Nat.findGreatest_eq_iff
code: lemma findGreatest_eq_iff :
    Nat.findGreatest P k = m ↔ m ≤ k ∧ (m ≠ 0 → P m) ∧ ∀ ⦃n⦄, m < n → n ≤ k → ¬P n 
goal: Nat.findGreatest P k = m ↔ m ≤ k ∧ (m ≠ 0 → P m) ∧ ∀ ⦃n : ℕ⦄, m < n → n ≤ k → ¬P n

full_name: Nat.findGreatest_eq_zero_iff
code: lemma findGreatest_eq_zero_iff : Nat.findGreatest P k = 0 ↔ ∀ ⦃n⦄, 0 < n → n ≤ k → ¬P n 
goal: Nat.findGreatest P k = 0 ↔ ∀ ⦃n : ℕ⦄, 0 < n → n ≤ k → ¬P n

full_name: Nat.findGreatest_pos
code: @[simp] lemma findGreatest_pos : 0 < Nat.findGreatest P k ↔ ∃ n, 0 < n ∧ n ≤ k ∧ P n 
goal: 0 < Nat.findGreatest P k ↔ ∃ n, 0 < n ∧ n ≤ k ∧ P n

full_name: Nat.findGreatest_spec
code: lemma findGreatest_spec (hmb : m ≤ n) (hm : P m) : P (Nat.findGreatest P n) 
goal: P (Nat.findGreatest P n)

full_name: Nat.findGreatest_le
code: lemma findGreatest_le (n : ℕ) : Nat.findGreatest P n ≤ n 
goal: Nat.findGreatest P n ≤ n

full_name: Nat.le_findGreatest
code: lemma le_findGreatest (hmb : m ≤ n) (hm : P m) : m ≤ Nat.findGreatest P n 
goal: m ≤ Nat.findGreatest P n

full_name: Nat.findGreatest_mono_right
code: lemma findGreatest_mono_right (P : ℕ → Prop) [DecidablePred P] {m n} (hmn : m ≤ n) :
    Nat.findGreatest P m ≤ Nat.findGreatest P n 
goal: Nat.findGreatest P m ≤ Nat.findGreatest P n

full_name: Nat.findGreatest_mono_left
code: lemma findGreatest_mono_left [DecidablePred Q] (hPQ : ∀ n, P n → Q n) (n : ℕ) :
    Nat.findGreatest P n ≤ Nat.findGreatest Q n 
goal: Nat.findGreatest P n ≤ Nat.findGreatest Q n

full_name: Nat.findGreatest_mono
code: lemma findGreatest_mono [DecidablePred Q] (hPQ : ∀ n, P n → Q n) (hmn : m ≤ n) :
    Nat.findGreatest P m ≤ Nat.findGreatest Q n 
goal: Nat.findGreatest P m ≤ Nat.findGreatest Q n

full_name: Nat.findGreatest_is_greatest
code: theorem findGreatest_is_greatest (hk : Nat.findGreatest P n < k) (hkb : k ≤ n) : ¬P k 
goal: ¬P k

full_name: Nat.findGreatest_of_ne_zero
code: theorem findGreatest_of_ne_zero (h : Nat.findGreatest P n = m) (h0 : m ≠ 0) : P m 
goal: P m