perf: make Monoidal.fromInducedMonoidal a def instead of a global instance #46534
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.39) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 252 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.331
Real PR Conversation Timeline
1 comments
"Review active on #46534"
general
weight: 0.35
eric-wieser
This PR makes
CategoryTheory.Monoidal.fromInducedMonoidaladefrather than a global instance, and states the correspondingFunctor.Monoidalinstance explicitly at each use ofMonoidal.induced.The conclusion of
fromInducedMonoidalisF.Monoidalwhere the monoidal structure on the source isinduced F fData. Sinceinduced F fDatadiffers from an arbitrary monoidal structure extending the sameMonoidalCategoryStructonly in proof fields, this conclusion unifies with every goal of the formF.Monoidal, leavingfDataunassigned. As a global instance it therefore launched a search forF.Faithfulon each such goal, which can only succeed when the monoidal structure is syntacticallyinduced F fData. Whether that search ran before or after cheaper instances such asFunctor.Braided.toMonoidaldepended on import order.With
import Mathlib.AlgebraicGeometry.Morphisms.Etalefollowed byimport Mathlib, synthesizing(Over.pullback t).Monoidalfor a morphism of schemesttakes 564 heartbeats after this change, against 4884 with the instance enabled.At each site where a monoidal structure is built with
Monoidal.induced, theInducingFunctorDatais now a named declaration (where it was not already), and the instanceF.Monoidal := Monoidal.fromInducedMonoidal _ datais stated explicitly. This affectsModuleCat,AlgCat,CoalgCat,BialgCat,HopfAlgCat,QuadraticModuleCat,HomologicalComplex,WideSubcategory, andTransported. The data forAlgCatandQuadraticModuleCatis anabbrev, as theFunctor.Braidedinstances for their forgetful functors rely on unfolding it.Downstream projects that relied on the global instance for their own uses of
Monoidal.inducedwill need to add the instance explicitly in the same way.Reported by Jonathan Roy on Zulip.
🤖 Prepared with Claude Code