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
[Merged by Bors] - feat(algebra/module): define ordered semimodules and generalize convexity of functions #3728
Conversation
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Hmm, even with the implicit a b c, it still wants the λ _ _ _... |
No problem -- thanks a lot for the suggestions! |
lemma convex_on.le_on_segment {f : E → ℝ} (hf : convex_on s f) {x y z : E} | ||
(hx : x ∈ s) (hy : y ∈ s) (hz : z ∈ [x, y]) : | ||
f z ≤ max (f x) (f y) := |
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.
Can this not be generalized to β
because β
has no max
?
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.
Yeah. The other option would be to generalize it to a β with a linear order (and a semimodule with ℝ as the ring), so basically pretty much just ℝ...
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.
Maybe add a doc-string to this effect?
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.
The other option would be to generalize it to a β with a linear order (and a semimodule with ℝ as the ring), so basically pretty much just ℝ...
Hmm, what if I defined a lexicographic ordering on pairs β = (ℝ, ℝ)
, and gave them the obvious semimodule structure.
This lemma would then hold even though β
is not ℝ
, right, meaning we could generalize as something like the following?
lemma convex_on.le_on_segment {f : E → ℝ} (hf : convex_on s f) {x y z : E} | |
(hx : x ∈ s) (hy : y ∈ s) (hz : z ∈ [x, y]) : | |
f z ≤ max (f x) (f y) := | |
lemma convex_on.le_on_segment [linear_order β] {f : E → β} (hf : convex_on s f) {x y z : E} | |
(hx : x ∈ s) (hy : y ∈ s) (hz : z ∈ [x, y]) : | |
f z ≤ max (f x) (f y) := |
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!
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.
Oops -- sorry @eric-wieser, I think you must have added this comment at the same time as I confirmed the merger. I think it's probably simpler now to keep this in mind for the next PR on the subject: I'll be defining concave_on
next, so I'll have to make another pass on these lemmas anyway.
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.
Yeah, not a big deal - its not like you actively removed a generalization, you just missed one that could be added :)
Otherwise, LGTM. |
bors d+ |
✌️ dupuisf can now approve this pull request. To approve and merge a pull request, simply reply with |
bors r+ |
…xity of functions (#3728) Co-authored-by: Frédéric Dupuis <31101893+dupuisf@users.noreply.github.com>
Pull request successfully merged into master. Build succeeded: |
This defines a new typeclass for ordered semimodules, in which both the semiring and the semimodule are ordered, and where the scalar product respects the order relations. This is then used to generalize the definition of convexity for functions, enabling (in the long term) to define operator convexity.
I also plan to connect this to convex cones, which define an order on the vector space and vice-versa.