Zulip Chat Archive
Stream: Is there code for X?
Topic: Sup in nat belongs to set
Vladimir Goryachev (May 20 2021 at 15:56):
Hello everyone. I have a subset of natural numbers, for which I can prove it is bounded and nonempty. How do I show that its Sup belongs to it? (And also, should I use Sup there or something else?)
Vladimir Goryachev (May 20 2021 at 16:41):
Or maybe I should ask, how do I best write "the largest n such that this property holds"?
Ruben Van de Velde (May 20 2021 at 16:42):
Your approach sounds correct, but I'm finding it surprisingly hard to prove
Patrick Massot (May 20 2021 at 16:43):
Finite stuff in mathlib is a mess, we're sorry about it.
Johan Commelin (May 20 2021 at 16:47):
nat.find
gives you the smallest nat
with some property.
Johan Commelin (May 20 2021 at 16:48):
In your case, you are looking for the smallest n
such that for all m > n
, m \notin S
.
Floris van Doorn (May 20 2021 at 16:49):
There is docs#nat.has_Sup and docs#nat.Sup_def. It might be missing that the Sup is an element of the set.
Eric Wieser (May 20 2021 at 17:03):
Does docs#finset.max combined with docs#finset.max_eq_sup_with_bot and docs#finset.sup_eq_supr help?
Vladimir Goryachev (May 20 2021 at 17:28):
using rw nat.Sup_def at
works, but gives me a nat.find ?m_1
. I used to deal with such strings by using erw nat.find_eq_iff at
, but this time it does not work. So actually, how does one convert nat.find ?m_1
to something useful?
Vladimir Goryachev (May 20 2021 at 17:28):
I could try to rewrite this using finsets, thank you.
Ruben Van de Velde (May 20 2021 at 17:35):
I managed to do it without finsets in two steps:
import order.conditionally_complete_lattice
lemma sup_in (s : set nat) (h : ∃ n, ∀ a ∈ s, a ≤ n) (h' : set.nonempty s) :
∃ m, m ∈ s ∧ ∀ a ∈ s, a ≤ m := sorry
lemma sup_in' (x : set nat) (h : ∃ n, ∀ a ∈ x, a ≤ n) (h' : set.nonempty x) : Sup x ∈ x := sorry
Ruben Van de Velde (May 20 2021 at 17:35):
Now I'm waiting for one of the experts to solve it in two lines :)
Floris van Doorn (May 20 2021 at 17:58):
not quite two lines, but a little shorter:
import order.conditionally_complete_lattice
open_locale classical
namespace nat
lemma Sup_mem {s : set ℕ} (h1 : s.nonempty) (h2 : ∃ n, ∀ a ∈ s, a ≤ n) : Sup s ∈ s :=
begin
rw [Sup_def h2],
rcases h1 with ⟨n, hn⟩,
cases h : nat.find h2 with m,
{ convert hn, rw [eq_comm, ← nonpos_iff_eq_zero], convert nat.find_spec h2 n hn, rw h },
{ by_contra h',
apply nat.find_min h2 ((nat.lt_succ_self m).trans_le h.ge),
intros k hk,
rw [← lt_succ_iff], rw [← h] at *,
exact lt_of_le_of_ne (nat.find_spec h2 k hk) (mt (by { rintro rfl, exact hk }) h') }
end
end nat
Patrick Massot (May 20 2021 at 18:41):
I think all those proofs are not in the relevant generality. I propose:
import order.conditionally_complete_lattice
open set
lemma set.nonempty.Sup_mem {α : Type*} [conditionally_complete_linear_order α] {s : set α}
(h : s.nonempty) (hs : finite s) : Sup (s : set α) ∈ s :=
begin
classical,
revert h,
apply finite.induction_on hs,
{ simp },
rintros a t hat t_fin ih -,
rcases t.eq_empty_or_nonempty with rfl | ht,
{ simp },
{ rw cSup_insert t_fin.bdd_above ht,
by_cases ha : a ≤ Sup t,
{ simp [sup_eq_right.mpr ha, ih ht] },
{ simp only [sup_eq_left, mem_insert_iff, (not_le.mp ha).le, true_or] } }
end
example {s : set ℕ} (h1 : s.nonempty) (h2 : bdd_above s) : Sup s ∈ s :=
begin
apply h1.Sup_mem,
sorry
end
Patrick Massot (May 20 2021 at 18:42):
The sorry asks to prove that a set of natural numbers which is bounded above is finite. I don't know whether we already know that, but we certainly want to prove it anyway
Patrick Massot (May 20 2021 at 19:55):
see #7682
Eric Wieser (May 20 2021 at 20:49):
Is the statement also true for complete linear orders, without the finiteness assumptions?
Alistair Tucker (May 20 2021 at 21:07):
(deleted)
Kevin Buzzard (May 20 2021 at 22:12):
Sup of open interval (0,1) considered as a subset of complete lattice closed interval [0,1] isn't in the set
Mario Carneiro (May 20 2021 at 22:27):
It is true for (conditionally) complete discrete linear orders without finiteness, I think
Mario Carneiro (May 20 2021 at 22:27):
what you need here is that bounded sets are compact
Kevin Buzzard (May 21 2021 at 05:43):
What's an example of a complete discrete linear order that isn't itself finite?
Last updated: Dec 20 2023 at 11:08 UTC