You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: writer monad should use an additive logging type - #35578
The Writer monad's w type is supposed to be additive, not multiplicative. This is how it is conceptually used in Haskell (as a logging type). Haskell uses Monoid because it doesn't make a distinction between AddMonoid and Monoid.
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>
The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.
Declarations diff (Lean)
✅ Lean-aware diff — post-build, computed from the Lean environment (commit 2da6184).
The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
An argument against this is that the log monoid operator is usually non-commutative, which is more typically a property of * than +.
List append is not commutative. Yet it is traditionally represented as an addition operation.
Same with monoids of strings. In any case the only use of this monad appears to be in Cont monad, a CS application, and potentially now in CSLib.
An argument against this is that the log monoid operator is usually non-commutative, which is more typically a property of * than +.
A further counter argument is that we have a separate typeclass AddCommMonoid for commutative addition and we are not using that one here. We are only using AddMonoid.
eric-wieser
added
the
awaiting-zulip
There is a Zulip discussion; the author should await and report/implement the decision reached there
label
Feb 20, 2026
This pull request has conflicts, please merge master and resolve them.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awaiting-zulipThere is a Zulip discussion; the author should await and report/implement the decision reached theremerge-conflictThe PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot)t-dataData (lists, quotients, numbers, etc)
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Writer monad's w type is supposed to be additive, not multiplicative. This is how it is conceptually used in Haskell (as a logging type). Haskell uses
Monoidbecause it doesn't make a distinction betweenAddMonoidandMonoid.#mathlib4 > Writer should use an additive monoid @ 💬