feat(Algebra/Order): linear order and strict ordered ring structures on opposites #46504
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.40) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 285 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.338
Real PR Conversation Timeline
1 comments
"Review active on #46504"
general
weight: 0.35
eric-wieser
Add
LinearOrder,IsOrderedCancelMonoid/IsOrderedCancelAddMonoidandIsStrictOrderedRinginstances onαᵐᵒᵖandαᵃᵒᵖ, theMax,MinandOrdinstances they are built from, and the simp lemmasop_lt_op,unop_lt_unop,op_sup,unop_sup,op_inf,unop_inf,op_compare,unop_compareand the strict versions ofunop_le_one,unop_nonnegetc. (unop_lt_one,op_pos, ...). Also generalize the existingIsOrderedMonoid/IsOrderedAddMonoidinstances fromPartialOrdertoPreorder.With the existing
Field αᵐᵒᵖinstance,αᵐᵒᵖis now a linearly ordered field wheneverαis.---
Design: the
LinearOrderis built withFunction.Injective.linearOrderfrom pointwiseMax/Min/Ordinstances (as forULift), not withLinearOrder.lift', so thatmax/min/comparecommute withop/unopbyrfland thePartialOrderandDecidableEqfields agree with the existing instances at instance-reducible transparency (checked withwith_reducible_and_instances rflfor both opposites).The cancellative instances are included because
IsStrictOrderedRingextendsIsOrderedCancelAddMonoid. InRᵐᵒᵖthe left and right strict monotonicity of multiplication swap, sinceop a op b = op (b a).TwoUniqueProds.of_covariant_leftinMathlib/Algebra/Group/UniqueProds/Basic.leanstill builds this order locally withLinearOrder.lift'; using the new instance there would need an import ofMathlib.Algebra.Order.Group.Opposite, which the directory import check does not allow for that file, so it is left unchanged.The additive names of the new
< 1lemmas are given explicitly (unop_lt_zero,unop_pos,op_lt_zero,op_pos) because the defaultto_additivenames would clash withAddOpposite.unop_neg.AI use: I used Claude Code (Anthropic) to draft these instances and lemmas and to check them against mathlib's conventions; an initial version used
LinearOrder.lift'and was changed to the construction above after checking the instance diamonds. I reviewed the code myself afterwards. Checked locally: the changed modules andMathlib.Algebra.Group.UniqueProds.BasicandMathlib.Algebra.Order.Star.Basicbuild,lake exe lint-stylepasses, and the diamond and instance-synthesis tests described above.