Skip to content

Comments

feat: additive writer monad#360

Open
Shreyas4991 wants to merge 3 commits intoleanprover:mainfrom
Shreyas4991:AdditiveWriterMonad
Open

feat: additive writer monad#360
Shreyas4991 wants to merge 3 commits intoleanprover:mainfrom
Shreyas4991:AdditiveWriterMonad

Conversation

@Shreyas4991
Copy link
Contributor

@Shreyas4991 Shreyas4991 commented Feb 21, 2026

This PR adds a writer monad whose log type is additive. This fills a gap in the mathlib API whose writer monad treats the log as multiplicative, which is a mistake as far as computer science is concerned.

Reference

@Shreyas4991 Shreyas4991 marked this pull request as ready for review February 21, 2026 00:21
@eric-wieser
Copy link
Contributor

eric-wieser commented Feb 21, 2026

which is a mistake as far as computer science is concerned.

Citation needed. Computer science does not make the Monoid/AddMonoid distinction made by mathlib; and in fact haskell's monoid system makes you use Writer (Sum X) and Writer (Product X) to choose between + and * as the accumulation operator (instead of the default of ++)

There is a zulip discussion #mathlib4 > Writer should use an additive monoid @ 💬. If CSLib reviewers have an opinion, I'd propose they leave it there rather than encouraging duplication into cslib.

@Shreyas4991
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants