Built with doc-gen4, running Lean4.
Bubbles () indicate interactive fragments: hover for details, tap to reveal contents.
Use Ctrl+βCtrl+βto navigate, Ctrl+π±οΈto focus.
On Mac, use Cmdinstead of Ctrl.
/-
Copyright (c) 2016 Jeremy Avigad. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jeremy Avigad, Mario Carneiro
! This file was ported from Lean 3 source module data.int.least_greatest
! leanprover-community/mathlib commit 3342d1b2178381196f818146ff79bc0e7ccd9e2d
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathlib.Data.Int.Order.Basic
/-! # Least upper bound and greatest lower bound properties for integers
In this file we prove that a bounded above nonempty set of integers has the greatest element, and a
counterpart of this statement for the least element.
## Main definitions
* `Int.leastOfBdd`: if `P : β€ β Prop` is a decidable predicate, `b` is a lower bound of the set
`{m | P m}`, and there exists `m : β€` such that `P m` (this time, no witness is required), then
`Int.leastOfBdd` returns the least number `m` such that `P m`, together with proofs of `P m` and
of the minimality. This definition is computable and does not rely on the axiom of choice.
* `Int.greatestOfBdd`: a similar definition with all inequalities reversed.
## Main statements
* `Int.exists_least_of_bdd`: if `P : β€ β Prop` is a predicate such that the set `{m : P m}` is
bounded below and nonempty, then this set has the least element. This lemma uses classical logic
to avoid assumption `[DecidablePred P]`. See `Int.leastOfBdd` for a constructive counterpart.
* `Int.coe_leastOfBdd_eq`: `(Int.leastOfBdd b Hb Hinh : β€)` does not depend on `b`.
* `Int.exists_greatest_of_bdd`, `Int.coe_greatest_of_bdd_eq`: versions of the above lemmas with all
inequalities reversed.
## Tags
integer numbers, least element, greatest element
-/
namespace Int
/-- A computable version of `exists_least_of_bdd`: given a decidable predicate on the
integers, with an explicit lower bound and a proof that it is somewhere true, return
the least value for which the predicate is true. -/
def
Int.leastOfBdd
/--
If `P : β€ β Prop` is a predicate such that the set `{m : P m}` is bounded below and nonempty,
then this set has the least element. This lemma uses classical logic to avoid assumption
`[DecidablePred P]`. See `Int.leastOfBdd` for a constructive counterpart. -/
theorem
Int.coe_leastOfBdd_eq
/-- A computable version of `exists_greatest_of_bdd`: given a decidable predicate on the
integers, with an explicit upper bound and a proof that it is somewhere true, return
the greatest value for which the predicate is true. -/
def
Int.greatestOfBdd
/--
If `P : β€ β Prop` is a predicate such that the set `{m : P m}` is bounded above and nonempty,
then this set has the greatest element. This lemma uses classical logic to avoid assumption
`[DecidablePred P]`. See `Int.greatestOfBdd` for a constructive counterpart. -/
theorem