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 
leastOfBdd: {P : β„€ β†’ Prop} β†’ [inst : DecidablePred P] β†’ (b : β„€) β†’ (βˆ€ (z : β„€), P z β†’ b ≀ z) β†’ (βˆƒ z, P z) β†’ { lb // P lb ∧ βˆ€ (z : β„€), P z β†’ lb ≀ z }
leastOfBdd
{
P: β„€ β†’ Prop
P
:
β„€: Type
β„€
β†’
Prop: Type
Prop
} [
DecidablePred: {Ξ± : Sort ?u.6} β†’ (Ξ± β†’ Prop) β†’ Sort (max1?u.6)
DecidablePred
P: β„€ β†’ Prop
P
] (b :
β„€: Type
β„€
) (
Hb: βˆ€ (z : β„€), P z β†’ b ≀ z
Hb
: βˆ€ z :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
z β†’ b ≀ z) (
Hinh: βˆƒ z, P z
Hinh
: βˆƒ z :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
z) : { lb :
β„€: Type
β„€
//
P: β„€ β†’ Prop
P
lb ∧ βˆ€ z :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
z β†’ lb ≀ z } := have
EX: βˆƒ n, P (b + ↑n)
EX
: βˆƒ n :
β„•: Type
β„•
,
P: β„€ β†’ Prop
P
(b + n) := let ⟨
elt: β„€
elt
,
Helt: P elt
Helt
⟩ :=
Hinh: βˆƒ z, P z
Hinh
match
elt: β„€
elt
,
le.dest: βˆ€ {a b : β„€}, a ≀ b β†’ βˆƒ n, a + ↑n = b
le.dest
(
Hb: βˆ€ (z : β„€), P z β†’ b ≀ z
Hb
_
Helt: P elt
Helt
),
Helt: P elt
Helt
with | _, ⟨n,
rfl: βˆ€ {Ξ± : Sort ?u.226} {a : Ξ±}, a = a
rfl
⟩,
Hn: P (b + ↑n)
Hn
=> ⟨n,
Hn: P (b + ↑n)
Hn
⟩ ⟨b + (
Nat.find: {p : β„• β†’ Prop} β†’ [inst : DecidablePred p] β†’ (βˆƒ n, p n) β†’ β„•
Nat.find
EX: βˆƒ n, P (b + ↑n)
EX
:
β„€: Type
β„€
),
Nat.find_spec: βˆ€ {p : β„• β†’ Prop} [inst : DecidablePred p] (H : βˆƒ n, p n), p (Nat.find H)
Nat.find_spec
EX: βˆƒ n, P (b + ↑n)
EX
, fun
z: ?m.771
z
h: ?m.774
h
=> match
z: ?m.771
z
,
le.dest: βˆ€ {a b : β„€}, a ≀ b β†’ βˆƒ n, a + ↑n = b
le.dest
(
Hb: βˆ€ (z : β„€), P z β†’ b ≀ z
Hb
_
h: ?m.774
h
),
h: ?m.774
h
with | _, ⟨_,
rfl: βˆ€ {Ξ± : Sort ?u.787} {a : Ξ±}, a = a
rfl
⟩,
h: P (b + ↑w✝)
h
=>
add_le_add_left: βˆ€ {Ξ± : Type ?u.845} [inst : Add Ξ±] [inst_1 : LE Ξ±] [inst_2 : CovariantClass Ξ± Ξ± (fun x x_1 => x + x_1) fun x x_1 => x ≀ x_1] {b c : Ξ±}, b ≀ c β†’ βˆ€ (a : Ξ±), a + b ≀ a + c
add_le_add_left
(
Int.ofNat_le: βˆ€ {m n : β„•}, ↑m ≀ ↑n ↔ m ≀ n
Int.ofNat_le
.
2: βˆ€ {a b : Prop}, (a ↔ b) β†’ b β†’ a
2
<|
Nat.find_min': βˆ€ {p : β„• β†’ Prop} [inst : DecidablePred p] (H : βˆƒ n, p n) {m : β„•}, p m β†’ Nat.find H ≀ m
Nat.find_min'
_: βˆƒ n, ?m.863 n
_
h: P (b + ↑w✝)
h
)
_: ?m.846
_
⟩ #align int.least_of_bdd
Int.leastOfBdd: {P : β„€ β†’ Prop} β†’ [inst : DecidablePred P] β†’ (b : β„€) β†’ (βˆ€ (z : β„€), P z β†’ b ≀ z) β†’ (βˆƒ z, P z) β†’ { lb // P lb ∧ βˆ€ (z : β„€), P z β†’ lb ≀ z }
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
exists_least_of_bdd: βˆ€ {P : β„€ β†’ Prop} [inst : DecidablePred P], (βˆƒ b, βˆ€ (z : β„€), P z β†’ b ≀ z) β†’ (βˆƒ z, P z) β†’ βˆƒ lb, P lb ∧ βˆ€ (z : β„€), P z β†’ lb ≀ z
exists_least_of_bdd
{
P: β„€ β†’ Prop
P
:
β„€: Type
β„€
β†’
Prop: Type
Prop
} [
DecidablePred: {Ξ± : Sort ?u.1732} β†’ (Ξ± β†’ Prop) β†’ Sort (max1?u.1732)
DecidablePred
P: β„€ β†’ Prop
P
] (
Hbdd: βˆƒ b, βˆ€ (z : β„€), P z β†’ b ≀ z
Hbdd
: βˆƒ b :
β„€: Type
β„€
, βˆ€ z :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
z β†’ b ≀ z) (
Hinh: βˆƒ z, P z
Hinh
: βˆƒ z :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
z) : βˆƒ lb :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
lb ∧ βˆ€ z :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
z β†’ lb ≀ z :=

Goals accomplished! πŸ™
P: β„€ β†’ Prop

inst✝: DecidablePred P

Hbdd: βˆƒ b, βˆ€ (z : β„€), P z β†’ b ≀ z

Hinh: βˆƒ z, P z


βˆƒ lb, P lb ∧ βˆ€ (z : β„€), P z β†’ lb ≀ z
P: β„€ β†’ Prop

inst✝: DecidablePred P

Hbdd: βˆƒ b, βˆ€ (z : β„€), P z β†’ b ≀ z

Hinh: βˆƒ z, P z

b: β„€

Hb: βˆ€ (z : β„€), P z β†’ b ≀ z


βˆƒ lb, P lb ∧ βˆ€ (z : β„€), P z β†’ lb ≀ z
P: β„€ β†’ Prop

inst✝: DecidablePred P

Hbdd: βˆƒ b, βˆ€ (z : β„€), P z β†’ b ≀ z

Hinh: βˆƒ z, P z


βˆƒ lb, P lb ∧ βˆ€ (z : β„€), P z β†’ lb ≀ z
P: β„€ β†’ Prop

inst✝: DecidablePred P

Hbdd: βˆƒ b, βˆ€ (z : β„€), P z β†’ b ≀ z

Hinh: βˆƒ z, P z

b: β„€

Hb: βˆ€ (z : β„€), P z β†’ b ≀ z

lb: β„€

H: P lb ∧ βˆ€ (z : β„€), P z β†’ lb ≀ z


βˆƒ lb, P lb ∧ βˆ€ (z : β„€), P z β†’ lb ≀ z
P: β„€ β†’ Prop

inst✝: DecidablePred P

Hbdd: βˆƒ b, βˆ€ (z : β„€), P z β†’ b ≀ z

Hinh: βˆƒ z, P z


βˆƒ lb, P lb ∧ βˆ€ (z : β„€), P z β†’ lb ≀ z

Goals accomplished! πŸ™
#align int.exists_least_of_bdd
Int.exists_least_of_bdd: βˆ€ {P : β„€ β†’ Prop} [inst : DecidablePred P], (βˆƒ b, βˆ€ (z : β„€), P z β†’ b ≀ z) β†’ (βˆƒ z, P z) β†’ βˆƒ lb, P lb ∧ βˆ€ (z : β„€), P z β†’ lb ≀ z
Int.exists_least_of_bdd
theorem
coe_leastOfBdd_eq: βˆ€ {P : β„€ β†’ Prop} [inst : DecidablePred P] {b b' : β„€} (Hb : βˆ€ (z : β„€), P z β†’ b ≀ z) (Hb' : βˆ€ (z : β„€), P z β†’ b' ≀ z) (Hinh : βˆƒ z, P z), ↑(leastOfBdd b Hb Hinh) = ↑(leastOfBdd b' Hb' Hinh)
coe_leastOfBdd_eq
{
P: β„€ β†’ Prop
P
:
β„€: Type
β„€
β†’
Prop: Type
Prop
} [
DecidablePred: {Ξ± : Sort ?u.2166} β†’ (Ξ± β†’ Prop) β†’ Sort (max1?u.2166)
DecidablePred
P: β„€ β†’ Prop
P
] {b b' :
β„€: Type
β„€
} (
Hb: βˆ€ (z : β„€), P z β†’ b ≀ z
Hb
: βˆ€ z :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
z β†’ b ≀ z) (
Hb': βˆ€ (z : β„€), P z β†’ b' ≀ z
Hb'
: βˆ€ z :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
z β†’ b' ≀ z) (
Hinh: βˆƒ z, P z
Hinh
: βˆƒ z :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
z) : (
leastOfBdd: {P : β„€ β†’ Prop} β†’ [inst : DecidablePred P] β†’ (b : β„€) β†’ (βˆ€ (z : β„€), P z β†’ b ≀ z) β†’ (βˆƒ z, P z) β†’ { lb // P lb ∧ βˆ€ (z : β„€), P z β†’ lb ≀ z }
leastOfBdd
b
Hb: βˆ€ (z : β„€), P z β†’ b ≀ z
Hb
Hinh: βˆƒ z, P z
Hinh
:
β„€: Type
β„€
) =
leastOfBdd: {P : β„€ β†’ Prop} β†’ [inst : DecidablePred P] β†’ (b : β„€) β†’ (βˆ€ (z : β„€), P z β†’ b ≀ z) β†’ (βˆƒ z, P z) β†’ { lb // P lb ∧ βˆ€ (z : β„€), P z β†’ lb ≀ z }
leastOfBdd
b'
Hb': βˆ€ (z : β„€), P z β†’ b' ≀ z
Hb'
Hinh: βˆƒ z, P z
Hinh
:=

Goals accomplished! πŸ™
P: β„€ β†’ Prop

inst✝: DecidablePred P

b, b': β„€

Hb: βˆ€ (z : β„€), P z β†’ b ≀ z

Hb': βˆ€ (z : β„€), P z β†’ b' ≀ z

Hinh: βˆƒ z, P z


↑(leastOfBdd b Hb Hinh) = ↑(leastOfBdd b' Hb' Hinh)
P: β„€ β†’ Prop

inst✝: DecidablePred P

b, b': β„€

Hb: βˆ€ (z : β„€), P z β†’ b ≀ z

Hb': βˆ€ (z : β„€), P z β†’ b' ≀ z

Hinh: βˆƒ z, P z

n: β„€

hn: P n

h2n: βˆ€ (z : β„€), P z β†’ n ≀ z


mk.intro
↑{ val := n, property := (_ : P n ∧ βˆ€ (z : β„€), P z β†’ n ≀ z) } = ↑(leastOfBdd b' Hb' Hinh)
P: β„€ β†’ Prop

inst✝: DecidablePred P

b, b': β„€

Hb: βˆ€ (z : β„€), P z β†’ b ≀ z

Hb': βˆ€ (z : β„€), P z β†’ b' ≀ z

Hinh: βˆƒ z, P z


↑(leastOfBdd b Hb Hinh) = ↑(leastOfBdd b' Hb' Hinh)
P: β„€ β†’ Prop

inst✝: DecidablePred P

b, b': β„€

Hb: βˆ€ (z : β„€), P z β†’ b ≀ z

Hb': βˆ€ (z : β„€), P z β†’ b' ≀ z

Hinh: βˆƒ z, P z

n: β„€

hn: P n

h2n: βˆ€ (z : β„€), P z β†’ n ≀ z

n': β„€

hn': P n'

h2n': βˆ€ (z : β„€), P z β†’ n' ≀ z


mk.intro.mk.intro
↑{ val := n, property := (_ : P n ∧ βˆ€ (z : β„€), P z β†’ n ≀ z) } = ↑{ val := n', property := (_ : P n' ∧ βˆ€ (z : β„€), P z β†’ n' ≀ z) }
P: β„€ β†’ Prop

inst✝: DecidablePred P

b, b': β„€

Hb: βˆ€ (z : β„€), P z β†’ b ≀ z

Hb': βˆ€ (z : β„€), P z β†’ b' ≀ z

Hinh: βˆƒ z, P z


↑(leastOfBdd b Hb Hinh) = ↑(leastOfBdd b' Hb' Hinh)

Goals accomplished! πŸ™
#align int.coe_least_of_bdd_eq
Int.coe_leastOfBdd_eq: βˆ€ {P : β„€ β†’ Prop} [inst : DecidablePred P] {b b' : β„€} (Hb : βˆ€ (z : β„€), P z β†’ b ≀ z) (Hb' : βˆ€ (z : β„€), P z β†’ b' ≀ z) (Hinh : βˆƒ z, P z), ↑(leastOfBdd b Hb Hinh) = ↑(leastOfBdd b' Hb' Hinh)
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
greatestOfBdd: {P : β„€ β†’ Prop} β†’ [inst : DecidablePred P] β†’ (b : β„€) β†’ (βˆ€ (z : β„€), P z β†’ z ≀ b) β†’ (βˆƒ z, P z) β†’ { ub // P ub ∧ βˆ€ (z : β„€), P z β†’ z ≀ ub }
greatestOfBdd
{
P: β„€ β†’ Prop
P
:
β„€: Type
β„€
β†’
Prop: Type
Prop
} [
DecidablePred: {Ξ± : Sort ?u.3167} β†’ (Ξ± β†’ Prop) β†’ Sort (max1?u.3167)
DecidablePred
P: β„€ β†’ Prop
P
] (b :
β„€: Type
β„€
) (
Hb: βˆ€ (z : β„€), P z β†’ z ≀ b
Hb
: βˆ€ z :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
z β†’ z ≀ b) (
Hinh: βˆƒ z, P z
Hinh
: βˆƒ z :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
z) : { ub :
β„€: Type
β„€
//
P: β„€ β†’ Prop
P
ub ∧ βˆ€ z :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
z β†’ z ≀ ub } := have
Hbdd': βˆ€ (z : β„€), P (-z) β†’ -b ≀ z
Hbdd'
: βˆ€ z :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
(-z) β†’ -b ≀ z := fun
z: ?m.3253
z
h: ?m.3256
h
=>
neg_le: βˆ€ {Ξ± : Type ?u.3258} [inst : AddGroup Ξ±] [inst_1 : LE Ξ±] [inst_2 : CovariantClass Ξ± Ξ± (fun x x_1 => x + x_1) fun x x_1 => x ≀ x_1] [inst_3 : CovariantClass Ξ± Ξ± (Function.swap fun x x_1 => x + x_1) fun x x_1 => x ≀ x_1] {a b : Ξ±}, -a ≀ b ↔ -b ≀ a
neg_le
.
1: βˆ€ {a b : Prop}, (a ↔ b) β†’ a β†’ b
1
(
Hb: βˆ€ (z : β„€), P z β†’ z ≀ b
Hb
_
h: ?m.3256
h
) have
Hinh': βˆƒ z, P (-z)
Hinh'
: βˆƒ z :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
(-z) := let ⟨
elt: β„€
elt
,
Helt: P elt
Helt
⟩ :=
Hinh: βˆƒ z, P z
Hinh
⟨-
elt: β„€
elt
,

Goals accomplished! πŸ™
P: β„€ β†’ Prop

inst✝: DecidablePred P

b: β„€

Hb: βˆ€ (z : β„€), P z β†’ z ≀ b

Hinh: βˆƒ z, P z

Hbdd': βˆ€ (z : β„€), P (-z) β†’ -b ≀ z

elt: β„€

Helt: P elt


P (- -elt)
P: β„€ β†’ Prop

inst✝: DecidablePred P

b: β„€

Hb: βˆ€ (z : β„€), P z β†’ z ≀ b

Hinh: βˆƒ z, P z

Hbdd': βˆ€ (z : β„€), P (-z) β†’ -b ≀ z

elt: β„€

Helt: P elt


P (- -elt)
P: β„€ β†’ Prop

inst✝: DecidablePred P

b: β„€

Hb: βˆ€ (z : β„€), P z β†’ z ≀ b

Hinh: βˆƒ z, P z

Hbdd': βˆ€ (z : β„€), P (-z) β†’ -b ≀ z

elt: β„€

Helt: P elt


P elt
P: β„€ β†’ Prop

inst✝: DecidablePred P

b: β„€

Hb: βˆ€ (z : β„€), P z β†’ z ≀ b

Hinh: βˆƒ z, P z

Hbdd': βˆ€ (z : β„€), P (-z) β†’ -b ≀ z

elt: β„€

Helt: P elt


P elt
P: β„€ β†’ Prop

inst✝: DecidablePred P

b: β„€

Hb: βˆ€ (z : β„€), P z β†’ z ≀ b

Hinh: βˆƒ z, P z

Hbdd': βˆ€ (z : β„€), P (-z) β†’ -b ≀ z

elt: β„€

Helt: P elt


P elt
P: β„€ β†’ Prop

inst✝: DecidablePred P

b: β„€

Hb: βˆ€ (z : β„€), P z β†’ z ≀ b

Hinh: βˆƒ z, P z

Hbdd': βˆ€ (z : β„€), P (-z) β†’ -b ≀ z

elt: β„€

Helt: P elt


P (- -elt)

Goals accomplished! πŸ™
⟩ let ⟨lb,
Plb: P (-lb)
Plb
,
al: βˆ€ (z : β„€), P (-z) β†’ lb ≀ z
al
⟩ :=
leastOfBdd: {P : β„€ β†’ Prop} β†’ [inst : DecidablePred P] β†’ (b : β„€) β†’ (βˆ€ (z : β„€), P z β†’ b ≀ z) β†’ (βˆƒ z, P z) β†’ { lb // P lb ∧ βˆ€ (z : β„€), P z β†’ lb ≀ z }
leastOfBdd
(-b)
Hbdd': βˆ€ (z : β„€), P (-z) β†’ -b ≀ z
Hbdd'
Hinh': βˆƒ z, P (-z)
Hinh'
⟨-lb,
Plb: P (-lb)
Plb
, fun
z: ?m.3841
z
h: ?m.3844
h
=>
le_neg: βˆ€ {Ξ± : Type ?u.3846} [inst : AddGroup Ξ±] [inst_1 : LE Ξ±] [inst_2 : CovariantClass Ξ± Ξ± (fun x x_1 => x + x_1) fun x x_1 => x ≀ x_1] [inst_3 : CovariantClass Ξ± Ξ± (Function.swap fun x x_1 => x + x_1) fun x x_1 => x ≀ x_1] {a b : Ξ±}, a ≀ -b ↔ b ≀ -a
le_neg
.
1: βˆ€ {a b : Prop}, (a ↔ b) β†’ a β†’ b
1
<|
al: βˆ€ (z : β„€), P (-z) β†’ lb ≀ z
al
_ <|

Goals accomplished! πŸ™
P: β„€ β†’ Prop

inst✝: DecidablePred P

b: β„€

Hb: βˆ€ (z : β„€), P z β†’ z ≀ b

Hinh: βˆƒ z, P z

Hbdd': βˆ€ (z : β„€), P (-z) β†’ -b ≀ z

Hinh': βˆƒ z, P (-z)

lb: β„€

Plb: P (-lb)

al: βˆ€ (z : β„€), P (-z) β†’ lb ≀ z

z: β„€

h: P z


P (- -z)
P: β„€ β†’ Prop

inst✝: DecidablePred P

b: β„€

Hb: βˆ€ (z : β„€), P z β†’ z ≀ b

Hinh: βˆƒ z, P z

Hbdd': βˆ€ (z : β„€), P (-z) β†’ -b ≀ z

Hinh': βˆƒ z, P (-z)

lb: β„€

Plb: P (-lb)

al: βˆ€ (z : β„€), P (-z) β†’ lb ≀ z

z: β„€

h: P z


P (- -z)
P: β„€ β†’ Prop

inst✝: DecidablePred P

b: β„€

Hb: βˆ€ (z : β„€), P z β†’ z ≀ b

Hinh: βˆƒ z, P z

Hbdd': βˆ€ (z : β„€), P (-z) β†’ -b ≀ z

Hinh': βˆƒ z, P (-z)

lb: β„€

Plb: P (-lb)

al: βˆ€ (z : β„€), P (-z) β†’ lb ≀ z

z: β„€

h: P z


P z
P: β„€ β†’ Prop

inst✝: DecidablePred P

b: β„€

Hb: βˆ€ (z : β„€), P z β†’ z ≀ b

Hinh: βˆƒ z, P z

Hbdd': βˆ€ (z : β„€), P (-z) β†’ -b ≀ z

Hinh': βˆƒ z, P (-z)

lb: β„€

Plb: P (-lb)

al: βˆ€ (z : β„€), P (-z) β†’ lb ≀ z

z: β„€

h: P z


P z
⟩ #align int.greatest_of_bdd
Int.greatestOfBdd: {P : β„€ β†’ Prop} β†’ [inst : DecidablePred P] β†’ (b : β„€) β†’ (βˆ€ (z : β„€), P z β†’ z ≀ b) β†’ (βˆƒ z, P z) β†’ { ub // P ub ∧ βˆ€ (z : β„€), P z β†’ z ≀ ub }
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
exists_greatest_of_bdd: βˆ€ {P : β„€ β†’ Prop} [inst : DecidablePred P], (βˆƒ b, βˆ€ (z : β„€), P z β†’ z ≀ b) β†’ (βˆƒ z, P z) β†’ βˆƒ ub, P ub ∧ βˆ€ (z : β„€), P z β†’ z ≀ ub
exists_greatest_of_bdd
{
P: β„€ β†’ Prop
P
:
β„€: Type
β„€
β†’
Prop: Type
Prop
} [
DecidablePred: {Ξ± : Sort ?u.4600} β†’ (Ξ± β†’ Prop) β†’ Sort (max1?u.4600)
DecidablePred
P: β„€ β†’ Prop
P
] (
Hbdd: βˆƒ b, βˆ€ (z : β„€), P z β†’ z ≀ b
Hbdd
: βˆƒ b :
β„€: Type
β„€
, βˆ€ z :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
z β†’ z ≀ b) (
Hinh: βˆƒ z, P z
Hinh
: βˆƒ z :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
z) : βˆƒ ub :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
ub ∧ βˆ€ z :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
z β†’ z ≀ ub :=

Goals accomplished! πŸ™
P: β„€ β†’ Prop

inst✝: DecidablePred P

Hbdd: βˆƒ b, βˆ€ (z : β„€), P z β†’ z ≀ b

Hinh: βˆƒ z, P z


βˆƒ ub, P ub ∧ βˆ€ (z : β„€), P z β†’ z ≀ ub
P: β„€ β†’ Prop

inst✝: DecidablePred P

Hbdd: βˆƒ b, βˆ€ (z : β„€), P z β†’ z ≀ b

Hinh: βˆƒ z, P z

b: β„€

Hb: βˆ€ (z : β„€), P z β†’ z ≀ b


βˆƒ ub, P ub ∧ βˆ€ (z : β„€), P z β†’ z ≀ ub
P: β„€ β†’ Prop

inst✝: DecidablePred P

Hbdd: βˆƒ b, βˆ€ (z : β„€), P z β†’ z ≀ b

Hinh: βˆƒ z, P z


βˆƒ ub, P ub ∧ βˆ€ (z : β„€), P z β†’ z ≀ ub
P: β„€ β†’ Prop

inst✝: DecidablePred P

Hbdd: βˆƒ b, βˆ€ (z : β„€), P z β†’ z ≀ b

Hinh: βˆƒ z, P z

b: β„€

Hb: βˆ€ (z : β„€), P z β†’ z ≀ b

lb: β„€

H: P lb ∧ βˆ€ (z : β„€), P z β†’ z ≀ lb


βˆƒ ub, P ub ∧ βˆ€ (z : β„€), P z β†’ z ≀ ub
P: β„€ β†’ Prop

inst✝: DecidablePred P

Hbdd: βˆƒ b, βˆ€ (z : β„€), P z β†’ z ≀ b

Hinh: βˆƒ z, P z


βˆƒ ub, P ub ∧ βˆ€ (z : β„€), P z β†’ z ≀ ub

Goals accomplished! πŸ™
#align int.exists_greatest_of_bdd
Int.exists_greatest_of_bdd: βˆ€ {P : β„€ β†’ Prop} [inst : DecidablePred P], (βˆƒ b, βˆ€ (z : β„€), P z β†’ z ≀ b) β†’ (βˆƒ z, P z) β†’ βˆƒ ub, P ub ∧ βˆ€ (z : β„€), P z β†’ z ≀ ub
Int.exists_greatest_of_bdd
theorem
coe_greatestOfBdd_eq: βˆ€ {P : β„€ β†’ Prop} [inst : DecidablePred P] {b b' : β„€} (Hb : βˆ€ (z : β„€), P z β†’ z ≀ b) (Hb' : βˆ€ (z : β„€), P z β†’ z ≀ b') (Hinh : βˆƒ z, P z), ↑(greatestOfBdd b Hb Hinh) = ↑(greatestOfBdd b' Hb' Hinh)
coe_greatestOfBdd_eq
{
P: β„€ β†’ Prop
P
:
β„€: Type
β„€
β†’
Prop: Type
Prop
} [
DecidablePred: {Ξ± : Sort ?u.5034} β†’ (Ξ± β†’ Prop) β†’ Sort (max1?u.5034)
DecidablePred
P: β„€ β†’ Prop
P
] {b b' :
β„€: Type
β„€
} (
Hb: βˆ€ (z : β„€), P z β†’ z ≀ b
Hb
: βˆ€ z :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
z β†’ z ≀ b) (
Hb': βˆ€ (z : β„€), P z β†’ z ≀ b'
Hb'
: βˆ€ z :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
z β†’ z ≀ b') (
Hinh: βˆƒ z, P z
Hinh
: βˆƒ z :
β„€: Type
β„€
,
P: β„€ β†’ Prop
P
z) : (
greatestOfBdd: {P : β„€ β†’ Prop} β†’ [inst : DecidablePred P] β†’ (b : β„€) β†’ (βˆ€ (z : β„€), P z β†’ z ≀ b) β†’ (βˆƒ z, P z) β†’ { ub // P ub ∧ βˆ€ (z : β„€), P z β†’ z ≀ ub }
greatestOfBdd
b
Hb: βˆ€ (z : β„€), P z β†’ z ≀ b
Hb
Hinh: βˆƒ z, P z
Hinh
:
β„€: Type
β„€
) =
greatestOfBdd: {P : β„€ β†’ Prop} β†’ [inst : DecidablePred P] β†’ (b : β„€) β†’ (βˆ€ (z : β„€), P z β†’ z ≀ b) β†’ (βˆƒ z, P z) β†’ { ub // P ub ∧ βˆ€ (z : β„€), P z β†’ z ≀ ub }
greatestOfBdd
b'
Hb': βˆ€ (z : β„€), P z β†’ z ≀ b'
Hb'
Hinh: βˆƒ z, P z
Hinh
:=

Goals accomplished! πŸ™
P: β„€ β†’ Prop

inst✝: DecidablePred P

b, b': β„€

Hb: βˆ€ (z : β„€), P z β†’ z ≀ b

Hb': βˆ€ (z : β„€), P z β†’ z ≀ b'

Hinh: βˆƒ z, P z


↑(greatestOfBdd b Hb Hinh) = ↑(greatestOfBdd b' Hb' Hinh)
P: β„€ β†’ Prop

inst✝: DecidablePred P

b, b': β„€

Hb: βˆ€ (z : β„€), P z β†’ z ≀ b

Hb': βˆ€ (z : β„€), P z β†’ z ≀ b'

Hinh: βˆƒ z, P z

n: β„€

hn: P n

h2n: βˆ€ (z : β„€), P z β†’ z ≀ n


mk.intro
↑{ val := n, property := (_ : P n ∧ βˆ€ (z : β„€), P z β†’ z ≀ n) } = ↑(greatestOfBdd b' Hb' Hinh)
P: β„€ β†’ Prop

inst✝: DecidablePred P

b, b': β„€

Hb: βˆ€ (z : β„€), P z β†’ z ≀ b

Hb': βˆ€ (z : β„€), P z β†’ z ≀ b'

Hinh: βˆƒ z, P z


↑(greatestOfBdd b Hb Hinh) = ↑(greatestOfBdd b' Hb' Hinh)
P: β„€ β†’ Prop

inst✝: DecidablePred P

b, b': β„€

Hb: βˆ€ (z : β„€), P z β†’ z ≀ b

Hb': βˆ€ (z : β„€), P z β†’ z ≀ b'

Hinh: βˆƒ z, P z

n: β„€

hn: P n

h2n: βˆ€ (z : β„€), P z β†’ z ≀ n

n': β„€

hn': P n'

h2n': βˆ€ (z : β„€), P z β†’ z ≀ n'


mk.intro.mk.intro
↑{ val := n, property := (_ : P n ∧ βˆ€ (z : β„€), P z β†’ z ≀ n) } = ↑{ val := n', property := (_ : P n' ∧ βˆ€ (z : β„€), P z β†’ z ≀ n') }
P: β„€ β†’ Prop

inst✝: DecidablePred P

b, b': β„€

Hb: βˆ€ (z : β„€), P z β†’ z ≀ b

Hb': βˆ€ (z : β„€), P z β†’ z ≀ b'

Hinh: βˆƒ z, P z


↑(greatestOfBdd b Hb Hinh) = ↑(greatestOfBdd b' Hb' Hinh)

Goals accomplished! πŸ™
#align int.coe_greatest_of_bdd_eq
Int.coe_greatestOfBdd_eq: βˆ€ {P : β„€ β†’ Prop} [inst : DecidablePred P] {b b' : β„€} (Hb : βˆ€ (z : β„€), P z β†’ z ≀ b) (Hb' : βˆ€ (z : β„€), P z β†’ z ≀ b') (Hinh : βˆƒ z, P z), ↑(greatestOfBdd b Hb Hinh) = ↑(greatestOfBdd b' Hb' Hinh)
Int.coe_greatestOfBdd_eq
end Int