-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(data/real/ereal): add ereal
:= [-oo,oo]
#1703
Conversation
src/data/real/ereal.lean
Outdated
/-- A set of ereals has a Sup in ereal -/ | ||
theorem Sup_exists (X : set ereal) : has_Sup X := | ||
let Xoc : set (with_top ℝ) := λ x, X (↑x : with_bot _) in | ||
dite (Xoc = ∅) (λ h, ⟨⊥, ⟨ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to use dite
instead of its sugared version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I needed a dependent if/then/else. What's the sugared way to do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if h : Xoc = ∅ then _ else _
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in ac2ac59
I did some cleanup in this PR. I hope that is fine. |
OK so the situation with this PR was that I needed ereal and the proof that it was a complete lattice, which was initially a more substantial piece of work. It was then suggested that I prove a more general theorem about adding top and bot to a conditionally complete lattice gives a complete lattice, and this all happened in #1725 . The result is that this PR is essentially basic facts about unary neg on ereal and nothing else. I don't really know if this is worthy for mathlib any more so if people just want to close it then this is fine, but if people think it's better as a stub then here it is. I am unlikely to go any further with this now; in my opinion things like addition are unnatural on ereal, we have addition on the reals anyway. |
src/data/real/ereal.lean
Outdated
|
||
/-- ereal : The type $$[-\infty,+\infty]$$ or `[-∞, ∞]` -/ | ||
@[derive [linear_order, lattice.order_bot, lattice.order_top, | ||
lattice.has_Sup, lattice.complete_lattice]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you derive has_Sup
but not has_Inf
?
src/data/real/ereal.lean
Outdated
|
||
-/ | ||
|
||
/-- ereal : The type $$[-\infty,+\infty]$$ or `[-∞, ∞]` -/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/-- ereal : The type $$[-\infty,+\infty]$$ or `[-∞, ∞]` -/ | |
/-- ereal : The type `[-∞, ∞]` -/ |
@@ -26,6 +26,8 @@ class has_bot (α : Type u) := (bot : α) | |||
notation `⊤` := has_top.top _ | |||
notation `⊥` := has_bot.bot _ | |||
|
|||
attribute [pattern] lattice.has_bot.bot lattice.has_top.top |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It allows us to write ⊤
and ⊥
in the equation compiler, like this:
protected def neg : ereal → ereal
| ⊥ := ⊤
| ⊤ := ⊥
| (x : ℝ) := (-x : ℝ)
Don't |
(sorry, I will get to this at some point, I have a bunch of references to write before I leave for the US this weekend) |
OK so so the answer to the I guess that given that a mathematician would say that addition is partially defined on Going further with this, I could define |
I would say that you can just derive addition, but don't bother proving its properties: if someone needs them, then he will come back to it. Maybe add a comment in the file docstring though? |
OK I derived addition. I am still a bit conflicted by all this; I guess my instinct is to leave things as they are until someone actually needs some arithmetic on |
…1703) * feat(data/real/ereal): add `ereal` := [-oo,oo] * some updates * some cleanup in ereal * move pattern attribute * works * more docstring * don't understand why this file was broken * more tidyup * deducing complete lattice from type class inference * another neg theorem * adding some module doc * tinkering * deriving addition Co-authored-by: Floris van Doorn <fpvdoorn@gmail.com> Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…1703) * feat(data/real/ereal): add `ereal` := [-oo,oo] * some updates * some cleanup in ereal * move pattern attribute * works * more docstring * don't understand why this file was broken * more tidyup * deducing complete lattice from type class inference * another neg theorem * adding some module doc * tinkering * deriving addition Co-authored-by: Floris van Doorn <fpvdoorn@gmail.com> Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
TO CONTRIBUTORS:
Make sure you have:
If this PR is related to a discussion on Zulip, please include a link in the discussion.
For reviewers: code review check list