Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Mathlib/Algebra/BigOperators/Group/Finset/Defs.lean
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ to show the domain type when the product is over `Finset.univ`. -/
whenPPOption getPPNotation <| withOverApp 5 do
let #[_, _, _, _, f] := (← getExpr).getAppArgs | failure
guard f.isLambda
let ppDomain ← getPPOption getPPFunBinderTypes
let ppDomain ← withAppArg <| getPPOption getPPFunBinderTypes
let (i, body) ← withAppArg <| withBindingBodyUnusedName fun i => do
return (⟨i⟩, ← delab)
let res ← withNaryArg 3 <| delabFinsetArg i
Expand Down Expand Up @@ -296,7 +296,7 @@ to show the domain type when the sum is over `Finset.univ`. -/
whenPPOption getPPNotation <| withOverApp 5 do
let #[_, _, _, _, f] := (← getExpr).getAppArgs | failure
guard f.isLambda
let ppDomain ← getPPOption getPPFunBinderTypes
let ppDomain ← withAppArg <| getPPOption getPPFunBinderTypes
let (i, body) ← withAppArg <| withBindingBodyUnusedName fun i => do
return ((⟨i⟩ : Ident), ← delab)
let res ← withNaryArg 3 <| delabFinsetArg i
Expand Down
61 changes: 61 additions & 0 deletions MathlibTest/BigOps.lean
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Mathlib.Algebra.BigOperators.Group.Finset.Basic
import Mathlib.Data.Fintype.Basic

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

/-! ### Big operators over a finset with `pp.analyze` on -/

/-- info: ∑ i, i.toNat : ℕ -/
#guard_msgs in
#check ∑ i : Fin 3, i.toNat

/-- info: ∏ i, i.toNat : ℕ -/
#guard_msgs in
#check ∏ i : Fin 3, i.toNat

/-- info: ∑ i : Fin 3, i.toNat : ℕ -/
#guard_msgs in
set_option pp.analyze true in
#check ∑ i : Fin 3, i.toNat

/-- info: ∏ i : Fin 3, i.toNat : ℕ -/
#guard_msgs in
set_option pp.analyze true in
#check ∏ i : Fin 3, i.toNat

/-- info: ∑ i ∈ s, f i : M -/
#guard_msgs in
set_option pp.analyze true in
#check Finset.sum s fun i ↦ f i

/-- info: ∏ i ∈ s, f i : M -/
#guard_msgs in
set_option pp.analyze true in
#check Finset.prod s fun i ↦ f i

/-- info: ∑ i ∈ s with p i, f i : M -/
#guard_msgs in
set_option pp.analyze true in
#check Finset.sum {j ∈ s | p j} fun i ↦ f i

/-- info: ∏ i ∈ s with p i, f i : M -/
#guard_msgs in
set_option pp.analyze true in
#check Finset.prod {j ∈ s | p j} fun i ↦ f i

/-- info: ∑ i : ι, f i : M -/
#guard_msgs in
set_option pp.analyze true in
#check Finset.sum Finset.univ fun i ↦ f i

/-- info: ∏ i : ι, f i : M -/
#guard_msgs in
set_option pp.analyze true in
#check Finset.prod Finset.univ fun i ↦ f i

/-- info: ∑ i : ι with p i, f i : M -/
#guard_msgs in
set_option pp.analyze true in
#check Finset.sum {j | p j} fun i ↦ f i

/-- info: ∏ i : ι with p i, f i : M -/
#guard_msgs in
set_option pp.analyze true in
#check Finset.prod {j | p j} fun i ↦ f i

end