-
Notifications
You must be signed in to change notification settings - Fork 259
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] - fix: set big-operator parsing precedence to 67 #1723
Conversation
@@ -119,14 +119,14 @@ macro_rules (kind := bigprod) | |||
|
|||
/-- `∑ x in s, f x` is notation for `Finset.sum s f`. It is the sum of `f x`, | |||
where `x` ranges over the finite set `s`. -/ | |||
syntax (name := bigsumin) "∑ " extBinder "in " term "," term : term | |||
syntax (name := bigsumin) "∑ " extBinder "in " term "," term:51 : term |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The library note around lines 84~100 above suggests that we use precedence level 67 everywhere. Should that also work in Lean 4?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Done.
Thanks 🎉 bors merge |
Sets all big-operator precedences to 67, in keeping with the existing library note and with lean 3. https://github.com/leanprover-community/mathlib4/blob/82cf1905168dc57e7d95ce5576b7991b31e4f6ea/Mathlib/Algebra/BigOperators/Basic.lean#L89-L93 Fixes downstream code that relied on the wrong precedences. In all cases, the change in this PR makes the code match the parenthesization of the mathlib3 version. I came across this problem when I tried to write ```lean lemma sum_range_square (n : ℕ) : ∑i in Finset.range n, (i+1)^2 = n * (n + 1) * (2*n + 1)/6 := sorry ``` and I got the error ``` failed to synthesize instance AddCommMonoid Prop ``` This PR fixes that error, so that my example successfully parses as expected.
Pull request successfully merged into master. Build succeeded:
|
Sets all big-operator precedences to 67, in keeping with the existing library note and with lean 3.
mathlib4/Mathlib/Algebra/BigOperators/Basic.lean
Lines 89 to 93 in 82cf190
Fixes downstream code that relied on the wrong precedences. In all cases, the change in this PR makes the code match the parenthesization of the mathlib3 version.
I came across this problem when I tried to write
and I got the error
This PR fixes that error, so that my example successfully parses as expected.