Skip to content

[Merged by Bors] - feat(Data.Prod.Lex): port file#783

Closed
j-loreaux wants to merge 9 commits intomasterfrom
j-loreaux/data.prod.lex
Closed

[Merged by Bors] - feat(Data.Prod.Lex): port file#783
j-loreaux wants to merge 9 commits intomasterfrom
j-loreaux/data.prod.lex

Conversation

@j-loreaux
Copy link
Copy Markdown
Contributor

@j-loreaux j-loreaux commented Nov 29, 2022

mathlib3 SHA: 1fc36cc9c8264e6e81253f88be7fb2cb6c92d76a

porting notes: there are several issues here that should probably be fixed before this gets merged

  1. Prod.Lex is not protect in core, so when you have this namespace open and try to refer to Lex, Lean finds Prod.Lex instead of _root_.Lex. This is not a huge deal since we have notation α ×ₗ β, but we should probably ask for it to be protected in core. See chore: protect Prod.Lex leanprover/lean4#1895
  2. on the declarations toLex_mono and toLex_strictMono, Lean sees right through the type synonym α ×ₗ β to α × β and uses the wrong Preorder instance, which is why I had to provide them manually. I think this is a bug and should be fixed, otherwise it will cause loads of other issues down the road (for other type synonyms) and the errors will be hard to diagnose. EDIT: Hopefully CoeFun causes types to be unfolded leanprover/lean4#1891 will provide a fix.
  3. I had to provide the definitions of min and max for the LinearOrder instance manually because in Lean 4 we have the classes Min and Max which have no counterpart in Lean 3. In this case it's a bit annoying because ite requires decidability, so I effectively had to provide that three times in this instance declaration. Surely there should be a better way?

@j-loreaux j-loreaux added awaiting-review mathlib-port This is a port of a theory file from mathlib. labels Nov 29, 2022
@kim-em
Copy link
Copy Markdown
Contributor

kim-em commented Nov 29, 2022

  1. I had to provide the definitions of min and max for the LinearOrder instance manually because in Lean 4 we have the classes Min and Max which have no counterpart in Lean 3. In this case it's a bit annoying because ite requires decidability, so I effectively had to provide that three times in this instance declaration. Surely there should be a better way?

This was easy: I added defaults for min and max in LinearOrder.

@kim-em
Copy link
Copy Markdown
Contributor

kim-em commented Nov 29, 2022

I've added notes about the fixes coming in nightly-2022-11-30. I think we can come back and touch these up later.

bors merge

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review labels Nov 29, 2022
bors bot pushed a commit that referenced this pull request Nov 29, 2022
mathlib3 SHA: 1fc36cc9c8264e6e81253f88be7fb2cb6c92d76a

porting notes: there are several issues here that should probably be fixed before this gets merged
1. `Prod.Lex` is not protect in core, so when you have this namespace open and try to refer to `Lex`, Lean finds `Prod.Lex` instead of `_root_.Lex`. This is not a huge deal since we have notation `α ×ₗ β`, but we should probably ask for it to be protected in core. See leanprover/lean4#1895
2. on the declarations `toLex_mono` and `toLex_strictMono`, Lean sees right through the type synonym `α ×ₗ β` to `α × β` and uses the wrong `Preorder` instance, which is why I had to provide them manually. I think this is a bug and should be fixed, otherwise it will cause loads of other issues down the road (for other type synonyms) and the errors will be hard to diagnose. EDIT: Hopefully leanprover/lean4#1891 will provide a fix.
3. I had to provide the definitions of `min` and `max` for the `LinearOrder` instance manually because in Lean 4 we have the classes `Min` and `Max` which have no counterpart in Lean 3. In this case it's a bit annoying because `ite` requires decidability, so I effectively had to provide that three times in this instance declaration. Surely there should be a better way?

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@bors
Copy link
Copy Markdown

bors bot commented Nov 29, 2022

Build failed:

@kim-em
Copy link
Copy Markdown
Contributor

kim-em commented Nov 29, 2022

bors p=10

bors merge

bors bot pushed a commit that referenced this pull request Nov 29, 2022
mathlib3 SHA: 1fc36cc9c8264e6e81253f88be7fb2cb6c92d76a

porting notes: there are several issues here that should probably be fixed before this gets merged
1. `Prod.Lex` is not protect in core, so when you have this namespace open and try to refer to `Lex`, Lean finds `Prod.Lex` instead of `_root_.Lex`. This is not a huge deal since we have notation `α ×ₗ β`, but we should probably ask for it to be protected in core. See leanprover/lean4#1895
2. on the declarations `toLex_mono` and `toLex_strictMono`, Lean sees right through the type synonym `α ×ₗ β` to `α × β` and uses the wrong `Preorder` instance, which is why I had to provide them manually. I think this is a bug and should be fixed, otherwise it will cause loads of other issues down the road (for other type synonyms) and the errors will be hard to diagnose. EDIT: Hopefully leanprover/lean4#1891 will provide a fix.
3. I had to provide the definitions of `min` and `max` for the `LinearOrder` instance manually because in Lean 4 we have the classes `Min` and `Max` which have no counterpart in Lean 3. In this case it's a bit annoying because `ite` requires decidability, so I effectively had to provide that three times in this instance declaration. Surely there should be a better way?

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@bors
Copy link
Copy Markdown

bors bot commented Nov 29, 2022

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(Data.Prod.Lex): port file [Merged by Bors] - feat(Data.Prod.Lex): port file Nov 29, 2022
@bors bors bot closed this Nov 29, 2022
@bors bors bot deleted the j-loreaux/data.prod.lex branch November 29, 2022 20:55
bors bot pushed a commit to leanprover-community/mathlib3 that referenced this pull request Dec 1, 2022
Regenerated from the [port status wiki page](https://github.com/leanprover-community/mathlib/wiki/mathlib4-port-status).
Relates to the following PRs:
* `algebra.field.defs`: leanprover-community/mathlib4#668
* `algebra.group.commute`: leanprover-community/mathlib4#750
* `algebra.group_with_zero.commute`: leanprover-community/mathlib4#762
* `algebra.group_with_zero.semiconj`: leanprover-community/mathlib4#757
* `algebra.group_with_zero.units.basic`: leanprover-community/mathlib4#735
* `algebra.hom.embedding`: leanprover-community/mathlib4#764
* `algebra.order.monoid.cancel.defs`: leanprover-community/mathlib4#774
* `algebra.order.monoid.canonical.defs`: leanprover-community/mathlib4#778
* `algebra.order.monoid.defs`: leanprover-community/mathlib4#771
* `algebra.order.monoid.min_max`: leanprover-community/mathlib4#763
* `algebra.order.monoid.order_dual`: leanprover-community/mathlib4#786
* `algebra.order.sub.defs`: leanprover-community/mathlib4#732
* `algebra.regular.basic`: leanprover-community/mathlib4#758
* `algebra.ring.commute`: leanprover-community/mathlib4#759
* `algebra.ring.regular`: leanprover-community/mathlib4#795
* `algebra.ring.semiconj`: leanprover-community/mathlib4#751
* `control.applicative`: leanprover-community/mathlib4#798
* `control.functor`: leanprover-community/mathlib4#612
* `control.monad.basic`: leanprover-community/mathlib4#752
* `data.countable.defs`: leanprover-community/mathlib4#736
* `data.int.units`: leanprover-community/mathlib4#807
* `data.nat.basic`: leanprover-community/mathlib4#729
* `data.nat.psub`: leanprover-community/mathlib4#806
* `data.nat.units`: leanprover-community/mathlib4#805
* `data.pi.algebra`: leanprover-community/mathlib4#564
* `data.prod.lex`: leanprover-community/mathlib4#783
* `logic.embedding.basic`: leanprover-community/mathlib4#700
* `logic.equiv.option`: leanprover-community/mathlib4#674
* `order.bounded_order`: leanprover-community/mathlib4#697
* `order.with_bot`: leanprover-community/mathlib4#776
* `order.disjoint`: leanprover-community/mathlib4#773
* `order.min_max`: leanprover-community/mathlib4#728
* `order.prop_instances`: leanprover-community/mathlib4#792
* `order.rel_iso.basic`: leanprover-community/mathlib4#772
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mathlib-port This is a port of a theory file from mathlib. ready-to-merge This PR has been sent to bors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants