Skip to content

Commit efb6f06

Browse files
MrQubokim-em
authored andcommitted
fix(Algebra/BigOperators/Group/Finset): Add missing binder annotation with pp.analyze in Finset.sum (leanprover-community#33070)
1 parent aed017a commit efb6f06

File tree

2 files changed

+63
-2
lines changed

2 files changed

+63
-2
lines changed

Mathlib/Algebra/BigOperators/Group/Finset/Defs.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ to show the domain type when the product is over `Finset.univ`. -/
265265
whenPPOption getPPNotation <| withOverApp 5 do
266266
let #[_, _, _, _, f] := (← getExpr).getAppArgs | failure
267267
guard f.isLambda
268-
let ppDomain ← getPPOption getPPFunBinderTypes
268+
let ppDomain ← withAppArg <| getPPOption getPPFunBinderTypes
269269
let (i, body) ← withAppArg <| withBindingBodyUnusedName fun i => do
270270
return (⟨i⟩, ← delab)
271271
let res ← withNaryArg 3 <| delabFinsetArg i
@@ -296,7 +296,7 @@ to show the domain type when the sum is over `Finset.univ`. -/
296296
whenPPOption getPPNotation <| withOverApp 5 do
297297
let #[_, _, _, _, f] := (← getExpr).getAppArgs | failure
298298
guard f.isLambda
299-
let ppDomain ← getPPOption getPPFunBinderTypes
299+
let ppDomain ← withAppArg <| getPPOption getPPFunBinderTypes
300300
let (i, body) ← withAppArg <| withBindingBodyUnusedName fun i => do
301301
return ((⟨i⟩ : Ident), ← delab)
302302
let res ← withNaryArg 3 <| delabFinsetArg i

MathlibTest/BigOps.lean

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Mathlib.Algebra.BigOperators.Group.Finset.Basic
2+
import Mathlib.Data.Fintype.Basic
23

34
section
45
variable {ι M : Type*} [CommMonoid M] [AddCommMonoid M] [Fintype ι] {s : Finset ι} {p : ι → Prop}
@@ -62,4 +63,64 @@ set_option pp.funBinderTypes false
6263
#guard_msgs in
6364
#check Finset.prod {j | p j} fun i ↦ f i
6465

66+
/-! ### Big operators over a finset with `pp.analyze` on -/
67+
68+
/-- info: ∑ i, i.toNat : ℕ -/
69+
#guard_msgs in
70+
#check ∑ i : Fin 3, i.toNat
71+
72+
/-- info: ∏ i, i.toNat : ℕ -/
73+
#guard_msgs in
74+
#check ∏ i : Fin 3, i.toNat
75+
76+
/-- info: ∑ i : Fin 3, i.toNat : ℕ -/
77+
#guard_msgs in
78+
set_option pp.analyze true in
79+
#check ∑ i : Fin 3, i.toNat
80+
81+
/-- info: ∏ i : Fin 3, i.toNat : ℕ -/
82+
#guard_msgs in
83+
set_option pp.analyze true in
84+
#check ∏ i : Fin 3, i.toNat
85+
86+
/-- info: ∑ i ∈ s, f i : M -/
87+
#guard_msgs in
88+
set_option pp.analyze true in
89+
#check Finset.sum s fun i ↦ f i
90+
91+
/-- info: ∏ i ∈ s, f i : M -/
92+
#guard_msgs in
93+
set_option pp.analyze true in
94+
#check Finset.prod s fun i ↦ f i
95+
96+
/-- info: ∑ i ∈ s with p i, f i : M -/
97+
#guard_msgs in
98+
set_option pp.analyze true in
99+
#check Finset.sum {j ∈ s | p j} fun i ↦ f i
100+
101+
/-- info: ∏ i ∈ s with p i, f i : M -/
102+
#guard_msgs in
103+
set_option pp.analyze true in
104+
#check Finset.prod {j ∈ s | p j} fun i ↦ f i
105+
106+
/-- info: ∑ i : ι, f i : M -/
107+
#guard_msgs in
108+
set_option pp.analyze true in
109+
#check Finset.sum Finset.univ fun i ↦ f i
110+
111+
/-- info: ∏ i : ι, f i : M -/
112+
#guard_msgs in
113+
set_option pp.analyze true in
114+
#check Finset.prod Finset.univ fun i ↦ f i
115+
116+
/-- info: ∑ i : ι with p i, f i : M -/
117+
#guard_msgs in
118+
set_option pp.analyze true in
119+
#check Finset.sum {j | p j} fun i ↦ f i
120+
121+
/-- info: ∏ i : ι with p i, f i : M -/
122+
#guard_msgs in
123+
set_option pp.analyze true in
124+
#check Finset.prod {j | p j} fun i ↦ f i
125+
65126
end

0 commit comments

Comments
 (0)