mathlib4 icon indicating copy to clipboard operation
mathlib4 copied to clipboard

feat(Order/FunLike): define `PointwiseLE`

Open urkud opened this issue 1 year ago • 9 comments

  • introduce a mixin class DFunLike.PointwiseLE, use it to define DFunLike.instPartialOrder;
  • add a generic DFunLike.orderEmbeddingCoe
  • add DFunLike.PointwiseLE instances here and there.

With this refactor and #13022, I'm going to generalize lemmas like MeasureTheory.ae_mono to OuterMeasureClass.


  • [x] depends on: #12983

Open in Gitpod

urkud avatar Feb 19 '24 16:02 urkud

I've been working on removing the analogous generic instances for SetLike. What's your motivation here?

YaelDillies avatar Mar 09 '24 17:03 YaelDillies

What's your motivation? Do you have examples of fun like / set like types where this is not the right order?

I'm going to migrate measures to fun like and some lemmas can be generalized to OuterMeasureClass if the order is given by this definition.

urkud avatar Mar 09 '24 22:03 urkud

Yes, the typical examples are UpperSet and Filter.

YaelDillies avatar Mar 09 '24 22:03 YaelDillies

This instance scares me a bit. One example where this is the wrong order is linear maps from E →L[ℂ] E to E →L[ℂ] E, where we often want to say that f ≤ g if g - f is completely positive.

dupuisf avatar Apr 17 '24 12:04 dupuisf

@YaelDillies @dupuisf I updated this PR to use a mixin instead.

urkud avatar May 05 '24 00:05 urkud

@YaelDillies @dupuisf I updated this PR to use a mixin instead.

And now I updated commit message.

urkud avatar May 10 '24 02:05 urkud

This PR/issue depends on:

  • ~~leanprover-community/mathlib4#12983~~ By Dependent Issues (🤖). Happy coding!

Can you summarise your motivation in the PR description? You're not making anything shorter here, so the motivation can't be "Abstract away some boiler-plate". Do you have the need to reason about several pointwise ordered fun-like types at once?

YaelDillies avatar May 20 '24 07:05 YaelDillies

Okay, I now understand your motivation.

Why can you not make PointwiseLE (+ whatever things you need to hold pointwise) part of OuterMeasureClass?

YaelDillies avatar May 21 '24 05:05 YaelDillies

  1. We can drop some lemmas like coe_le_coe, coe_lt_coe, as well as PartialOrder instances. I don't do it in this PR to minimize diff.
  2. I plan to add PointwiseOne, PointwiseMul etc, as well as PointwiseSup etc and use them to prove generic algebraic instances, SMul/MulAction/... instances, and *Lattice instances.
  3. No other *Class instances assume additional structure on the type. I don't want to break it for one class.

urkud avatar May 24 '24 06:05 urkud

I'm not fully convinced you're not overengineering the solution

YaelDillies avatar May 24 '24 09:05 YaelDillies

Resumed a relevant thread at Zulip

urkud avatar Jun 02 '24 23:06 urkud