Skip to content
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] - chore(ring_theory/dedekind_domain): speed up dedekind_domain.lean #9232

Closed
wants to merge 12 commits into from

Conversation

Vierkantor
Copy link
Collaborator

@Vierkantor Vierkantor commented Sep 16, 2021

@eric-wieser noticed that dedekind_domain.lean was compiling slowly and on the verge of a timeout. @kbuzzard, @sgouezel and I reworked some definitions to make everything elaborate much faster: is_dedekind_domain_inv_iff, mul_inv_cancel_of_le_one and ideal.unique_factorization_monoid went from over 10 seconds on my machine to less than 3 seconds. No other declaration in that file now takes over 2 seconds on my machine.

Apart from the three declarations getting new proofs, I also made the following changes:

  • The operations on localization (has_add, has_mul, has_one, has_zero, has_neg, npow and localization.inv) are now @[irreducible]
  • fraction_ring.field copies its field from localization.comm_ring for faster unification (less relevant after the previous change)
  • Added fractional_ideal.map_mem_map and fractional_ideal.map_injective to simplify the proof of is_dedekind_domain_inv_iff.
  • Split the proof of matrix.exists_mul_vec_eq_zero_iff into two parts to speed it up

Open in Gitpod

@Vierkantor Vierkantor added the awaiting-review The author would like community review of the PR label Sep 16, 2021
Copy link
Member

@jcommelin jcommelin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 🎉

bors d+

@bors
Copy link

bors bot commented Sep 16, 2021

✌️ Vierkantor can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@github-actions github-actions bot added delegated The PR author may merge after reviewing final suggestions. and removed awaiting-review The author would like community review of the PR labels Sep 16, 2021
@eric-wieser
Copy link
Member

The queue is empty but the PR builders are busy, so let's just throw this over to nael and hope

bors r+

@github-actions github-actions bot added the ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) label Sep 16, 2021
bors bot pushed a commit that referenced this pull request Sep 16, 2021
…9232)

@eric-wieser [noticed that `dedekind_domain.lean`](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Timeouts.20in.20ring_theory.2Fdedekind_domain.2Elean.3A664.3A9) was compiling slowly and on the verge of a timeout. @kbuzzard, @sgouezel and I reworked some definitions to make everything elaborate much faster: `is_dedekind_domain_inv_iff`, `mul_inv_cancel_of_le_one` and `ideal.unique_factorization_monoid` went from over 10 seconds on my machine to less than 3 seconds. No other declaration in that file now takes over 2 seconds on my machine.

Apart from the three declarations getting new proofs, I also made the following changes:
 * The operations on `localization` (`has_add`, `has_mul`, `has_one`, `has_zero`, `has_neg` and `localization.inv`) are now `@[irreducible]`
 * `fraction_ring.field` copies its field from `localization.comm_ring` for faster unification (less relevant after the previous change)
 * Added `fractional_ideal.map_mem_map` and `fractional_ideal.map_injective` to simplify the proof of `is_dedekind_domain_inv_iff`.
@bors
Copy link

bors bot commented Sep 16, 2021

Build failed:

@eric-wieser
Copy link
Member

Well that at least got us an answer quickly!

@eric-wieser eric-wieser added awaiting-review The author would like community review of the PR and removed ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) awaiting-review The author would like community review of the PR labels Sep 16, 2021
This should ensure the API for `localization` is contained within `mk`/`mk_eq_mk_iff`/`rec`, no more `quotient` defs escaping
This halves the elaboration time of `matrix.mul_vec_eq_zero_iff`
@Vierkantor Vierkantor added awaiting-review The author would like community review of the PR and removed delegated The PR author may merge after reviewing final suggestions. labels Sep 22, 2021
@Vierkantor
Copy link
Collaborator Author

I'm going to re-request a review since a lot changed since the previous one.

@jcommelin
Copy link
Member

Thanks 🎉

bors merge

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels Sep 22, 2021
bors bot pushed a commit that referenced this pull request Sep 22, 2021
…9232)

@eric-wieser [noticed that `dedekind_domain.lean`](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Timeouts.20in.20ring_theory.2Fdedekind_domain.2Elean.3A664.3A9) was compiling slowly and on the verge of a timeout. @kbuzzard, @sgouezel and I reworked some definitions to make everything elaborate much faster: `is_dedekind_domain_inv_iff`, `mul_inv_cancel_of_le_one` and `ideal.unique_factorization_monoid` went from over 10 seconds on my machine to less than 3 seconds. No other declaration in that file now takes over 2 seconds on my machine.

Apart from the three declarations getting new proofs, I also made the following changes:
 * The operations on `localization` (`has_add`, `has_mul`, `has_one`, `has_zero`, `has_neg`, `npow` and `localization.inv`) are now `@[irreducible]`
 * `fraction_ring.field` copies its field from `localization.comm_ring` for faster unification (less relevant after the previous change)
 * Added `fractional_ideal.map_mem_map` and `fractional_ideal.map_injective` to simplify the proof of `is_dedekind_domain_inv_iff`.
 * Split the proof of `matrix.exists_mul_vec_eq_zero_iff` into two parts to speed it up



Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>
@bors
Copy link

bors bot commented Sep 22, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title chore(ring_theory/dedekind_domain): speed up dedekind_domain.lean [Merged by Bors] - chore(ring_theory/dedekind_domain): speed up dedekind_domain.lean Sep 22, 2021
@bors bors bot closed this Sep 22, 2021
@bors bors bot deleted the speedup-dedekind-domain branch September 22, 2021 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants