[Merged by Bors] - feat: add notation for Real.sqrt#12056
[Merged by Bors] - feat: add notation for Real.sqrt#12056eric-wieser wants to merge 5 commits intomasterfrom
Conversation
|
LGTM. Should we wait for another maintainer, or just merge it? |
|
Maybe |
Ruben-VandeVelde
left a comment
There was a problem hiding this comment.
Pretty.
maintainer merge
|
🚀 Pull request has been placed on the maintainer queue by Ruben-VandeVelde. |
j-loreaux
left a comment
There was a problem hiding this comment.
To be honest, it's cute, but I'm not sure it improves readability in large expressions.
bors merge
This adds the notation `√r` for `Real.sqrt r`. The precedence is such that `√x⁻¹` is parsed as `√(x⁻¹)`; not because this is particularly desirable, but because it's the default and the choice doesn't really matter. This is extracted from #7907, which adds a more general nth root typeclass. The idea is to perform all the boring substitutions downstream quickly, so that we can play around with custom elaborators with a much slower rate of code-rot. This PR also won't rot as quickly, as it does not forbid writing `x.sqrt` as that PR does. While perhaps claiming `√` for `Real.sqrt` is greedy; it: * Is far more common thatn `NNReal.sqrt` and `Nat.sqrt` * Is far more interesting to mathlib than `sqrt` on `Float` * Can be overloaded anyway, so this does not prevent downstream code using the notation on their own types. * Will be replaced by a more general typeclass in a future PR. [Zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/.60Sqrt.60.20notation.20typeclass/near/400086502) Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>
|
Build failed: |
|
bors d+ |
|
✌️ eric-wieser can now approve this pull request. To approve and merge a pull request, simply reply with |
|
@eric-wieser Should we merge it now or you plan to do more changes? |
|
@fpvandoorn expressed some concerns about notation scope on Zulip, but I think they might need revisiting with your notation class PR anyway; so I'll just put this in. If the notation starts causing conflicts, we can revisit the notation being global. bors merge |
This adds the notation `√r` for `Real.sqrt r`. The precedence is such that `√x⁻¹` is parsed as `√(x⁻¹)`; not because this is particularly desirable, but because it's the default and the choice doesn't really matter. This is extracted from #7907, which adds a more general nth root typeclass. The idea is to perform all the boring substitutions downstream quickly, so that we can play around with custom elaborators with a much slower rate of code-rot. This PR also won't rot as quickly, as it does not forbid writing `x.sqrt` as that PR does. While perhaps claiming `√` for `Real.sqrt` is greedy; it: * Is far more common thatn `NNReal.sqrt` and `Nat.sqrt` * Is far more interesting to mathlib than `sqrt` on `Float` * Can be overloaded anyway, so this does not prevent downstream code using the notation on their own types. * Will be replaced by a more general typeclass in a future PR. [Zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/.60Sqrt.60.20notation.20typeclass/near/400086502) Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>
|
Pull request successfully merged into master. Build succeeded: |
This adds the notation `√r` for `Real.sqrt r`. The precedence is such that `√x⁻¹` is parsed as `√(x⁻¹)`; not because this is particularly desirable, but because it's the default and the choice doesn't really matter. This is extracted from #7907, which adds a more general nth root typeclass. The idea is to perform all the boring substitutions downstream quickly, so that we can play around with custom elaborators with a much slower rate of code-rot. This PR also won't rot as quickly, as it does not forbid writing `x.sqrt` as that PR does. While perhaps claiming `√` for `Real.sqrt` is greedy; it: * Is far more common thatn `NNReal.sqrt` and `Nat.sqrt` * Is far more interesting to mathlib than `sqrt` on `Float` * Can be overloaded anyway, so this does not prevent downstream code using the notation on their own types. * Will be replaced by a more general typeclass in a future PR. [Zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/.60Sqrt.60.20notation.20typeclass/near/400086502) Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>
This adds the notation `√r` for `Real.sqrt r`. The precedence is such that `√x⁻¹` is parsed as `√(x⁻¹)`; not because this is particularly desirable, but because it's the default and the choice doesn't really matter. This is extracted from #7907, which adds a more general nth root typeclass. The idea is to perform all the boring substitutions downstream quickly, so that we can play around with custom elaborators with a much slower rate of code-rot. This PR also won't rot as quickly, as it does not forbid writing `x.sqrt` as that PR does. While perhaps claiming `√` for `Real.sqrt` is greedy; it: * Is far more common thatn `NNReal.sqrt` and `Nat.sqrt` * Is far more interesting to mathlib than `sqrt` on `Float` * Can be overloaded anyway, so this does not prevent downstream code using the notation on their own types. * Will be replaced by a more general typeclass in a future PR. [Zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/.60Sqrt.60.20notation.20typeclass/near/400086502) Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>
This adds the notation `√r` for `Real.sqrt r`. The precedence is such that `√x⁻¹` is parsed as `√(x⁻¹)`; not because this is particularly desirable, but because it's the default and the choice doesn't really matter. This is extracted from #7907, which adds a more general nth root typeclass. The idea is to perform all the boring substitutions downstream quickly, so that we can play around with custom elaborators with a much slower rate of code-rot. This PR also won't rot as quickly, as it does not forbid writing `x.sqrt` as that PR does. While perhaps claiming `√` for `Real.sqrt` is greedy; it: * Is far more common thatn `NNReal.sqrt` and `Nat.sqrt` * Is far more interesting to mathlib than `sqrt` on `Float` * Can be overloaded anyway, so this does not prevent downstream code using the notation on their own types. * Will be replaced by a more general typeclass in a future PR. [Zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/.60Sqrt.60.20notation.20typeclass/near/400086502) Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>
This adds the notation `√r` for `Real.sqrt r`. The precedence is such that `√x⁻¹` is parsed as `√(x⁻¹)`; not because this is particularly desirable, but because it's the default and the choice doesn't really matter. This is extracted from #7907, which adds a more general nth root typeclass. The idea is to perform all the boring substitutions downstream quickly, so that we can play around with custom elaborators with a much slower rate of code-rot. This PR also won't rot as quickly, as it does not forbid writing `x.sqrt` as that PR does. While perhaps claiming `√` for `Real.sqrt` is greedy; it: * Is far more common thatn `NNReal.sqrt` and `Nat.sqrt` * Is far more interesting to mathlib than `sqrt` on `Float` * Can be overloaded anyway, so this does not prevent downstream code using the notation on their own types. * Will be replaced by a more general typeclass in a future PR. [Zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/.60Sqrt.60.20notation.20typeclass/near/400086502) Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>
This adds the notation `√r` for `Real.sqrt r`. The precedence is such that `√x⁻¹` is parsed as `√(x⁻¹)`; not because this is particularly desirable, but because it's the default and the choice doesn't really matter. This is extracted from #7907, which adds a more general nth root typeclass. The idea is to perform all the boring substitutions downstream quickly, so that we can play around with custom elaborators with a much slower rate of code-rot. This PR also won't rot as quickly, as it does not forbid writing `x.sqrt` as that PR does. While perhaps claiming `√` for `Real.sqrt` is greedy; it: * Is far more common thatn `NNReal.sqrt` and `Nat.sqrt` * Is far more interesting to mathlib than `sqrt` on `Float` * Can be overloaded anyway, so this does not prevent downstream code using the notation on their own types. * Will be replaced by a more general typeclass in a future PR. [Zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/.60Sqrt.60.20notation.20typeclass/near/400086502) Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>
This adds the notation
√rforReal.sqrt r. The precedence is such that√x⁻¹is parsed as√(x⁻¹); not because this is particularly desirable, but because it's the default and the choice doesn't really matter.This is extracted from #7907, which adds a more general nth root typeclass.
The idea is to perform all the boring substitutions downstream quickly, so that we can play around with custom elaborators with a much slower rate of code-rot.
This PR also won't rot as quickly, as it does not forbid writing
x.sqrtas that PR does.While perhaps claiming
√forReal.sqrtis greedy; it:NNReal.sqrtandNat.sqrtsqrtonFloatZulip