Skip to content

Commit dce2589

Browse files
committed
fix: missing noWs in notations (#23822)
Also removed the `9000` priority, since this was probably chosen randomly, and there is no comment justifying it. This somewhat follows on from #19900.
1 parent 72c41a8 commit dce2589

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

Mathlib/Algebra/Module/Torsion.lean

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,16 @@ variable (A : Type*) [AddCommGroup A] (n : ℤ)
911911
def torsionBy : AddSubgroup A :=
912912
(Submodule.torsionBy ℤ A n).toAddSubgroup
913913

914-
@[inherit_doc]
915-
scoped notation:max (priority := high) A"["n"]" => torsionBy A n
914+
@[inherit_doc torsionBy]
915+
scoped syntax:max (name := torsionByStx) (priority := high) term noWs "[" term "]" : term
916+
917+
macro_rules | `($A[$n]) => `(torsionBy $A $n)
918+
919+
/-- Unexpander for `torsionBy`. -/
920+
@[scoped app_unexpander torsionBy]
921+
def torsionByUnexpander : Lean.PrettyPrinter.Unexpander
922+
| `($_ $A $n) => `($A[$n])
923+
| _ => throw ()
916924

917925
lemma torsionBy.neg : A[-n] = A[n] := by
918926
ext a

Mathlib/Algebra/MonoidAlgebra/Defs.lean

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -816,11 +816,19 @@ endowed with the convolution product.
816816
def AddMonoidAlgebra :=
817817
G →₀ k
818818

819-
@[inherit_doc]
820-
scoped[AddMonoidAlgebra] notation:9000 R:max "[" A "]" => AddMonoidAlgebra R A
821-
822819
namespace AddMonoidAlgebra
823820

821+
@[inherit_doc AddMonoidAlgebra]
822+
scoped syntax:max (priority := high) term noWs "[" term "]" : term
823+
824+
macro_rules | `($k[$g]) => `(AddMonoidAlgebra $k $g)
825+
826+
/-- Unexpander for `AddMonoidAlgebra`. -/
827+
@[scoped app_unexpander AddMonoidAlgebra]
828+
def unexpander : Lean.PrettyPrinter.Unexpander
829+
| `($_ $k $g) => `($k[$g])
830+
| _ => throw ()
831+
824832
instance inhabited : Inhabited k[G] :=
825833
inferInstanceAs (Inhabited (G →₀ k))
826834

0 commit comments

Comments
 (0)