Closed
Conversation
eric-wieser
reviewed
Nov 3, 2023
eric-wieser
reviewed
Feb 14, 2024
mathlib-bors bot
pushed a commit
that referenced
this pull request
Apr 11, 2024
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>
mathlib-bors bot
pushed a commit
that referenced
this pull request
Apr 13, 2024
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>
eric-wieser
reviewed
Apr 13, 2024
xgenereux
pushed a commit
that referenced
this pull request
Apr 15, 2024
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>
atarnoam
pushed a commit
that referenced
this pull request
Apr 16, 2024
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>
uniwuni
pushed a commit
that referenced
this pull request
Apr 19, 2024
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>
callesonne
pushed a commit
that referenced
this pull request
Apr 22, 2024
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>
Jun2M
pushed a commit
that referenced
this pull request
Apr 24, 2024
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>
eric-wieser
approved these changes
May 25, 2024
Member
eric-wieser
left a comment
There was a problem hiding this comment.
I pushed some more changes, this now looks great.
@kmill, could you check the unexpander / use of default_instance is reasonable?
kmill
reviewed
May 25, 2024
PR summary 8f948ff6a7
|
| File | Base Count | Head Count | Change |
|---|---|---|---|
| Mathlib.Data.Real.Sqrt | 1073 | 1075 | +2 (+0.19%) |
| Mathlib.Data.Complex.Abs | 1075 | 1077 | +2 (+0.19%) |
| Mathlib.Analysis.RCLike.Basic | 1218 | 1220 | +2 (+0.16%) |
| Mathlib.Topology.ContinuousFunction.StarOrdered | 1253 | 1255 | +2 (+0.16%) |
| Mathlib.Analysis.Complex.AbelLimit | 1264 | 1266 | +2 (+0.16%) |
| Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic | 1266 | 1268 | +2 (+0.16%) |
| Mathlib.Analysis.SpecialFunctions.Pow.Real | 1346 | 1348 | +2 (+0.15%) |
| Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics | 1348 | 1350 | +2 (+0.15%) |
| Mathlib.Data.Real.GoldenRatio | 1382 | 1384 | +2 (+0.14%) |
| Mathlib.Analysis.InnerProductSpace.Basic | 1467 | 1469 | +2 (+0.14%) |
| Mathlib.Analysis.SpecialFunctions.Trigonometric.Bounds | 1628 | 1630 | +2 (+0.12%) |
| Mathlib.LinearAlgebra.Matrix.PosDef | 1675 | 1677 | +2 (+0.12%) |
| Mathlib.Analysis.SpecialFunctions.Stirling | 1803 | 1805 | +2 (+0.11%) |
| Mathlib.MeasureTheory.Measure.Lebesgue.VolumeOfBalls | 1865 | 1867 | +2 (+0.11%) |
| Mathlib.Probability.Distributions.Gaussian | 1867 | 1869 | +2 (+0.11%) |
| Mathlib.NumberTheory.Harmonic.GammaDeriv | 1899 | 1901 | +2 (+0.11%) |
| Mathlib.Analysis.CstarAlgebra.ContinuousFunctionalCalculus.Instances | 1938 | 1940 | +2 (+0.10%) |
| Mathlib.NumberTheory.NumberField.CanonicalEmbedding.ConvexBody | 2169 | 2171 | +2 (+0.09%) |
| Mathlib.NumberTheory.NumberField.Discriminant | 2172 | 2174 | +2 (+0.09%) |
| Mathlib.NumberTheory.NumberField.ClassNumber | 2180 | 2182 | +2 (+0.09%) |
Import changes for all files
| Files | Import difference |
|---|---|
| There are 693 files with changed transitive imports: this is too many to display! |
Declarations diff
+ NthRoot
+ NthRoot.unexpander
+ instance : NthRoot ℝ 2 := ⟨fun x ↦ NNReal.sqrt (Real.toNNReal x)⟩
+ sqrt_def
- sqrt
You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>
## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>Co-authored-by: Kyle Miller <kmill31415@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also use it for
Real.sqrt, and replace the few occurrences ofsqrtthat do not already use the notation.Zulip