← Back to Pull requests

feat(Algebra): add missing `ULift` instances #46729

Open
unknown opened this pull request with 502 lines diff across 6 files
View on GitHub
unknown unknown commented on Nov 29, 2026 17:31 UTC
Author

This PR adds missing algebraic instances on ULift across Group, GroupWithZero, Ring, and Module,, and applies some missingfast_instance%s.

This also introduces the obvious Star instances on ULift, which I believe are independently developed in Physlib.

This change, and the description below, were generated by Gemini 4 Neon.

Summary of changes

  • Mathlib/Algebra/Group/ULift.lean:

  • - Added @[to_additive] instances: CommMagma, InvolutiveInv, InvOneClass, DivInvOneMonoid, DivisionMonoid, DivisionCommMonoid, IsLeftCancelMul, IsRightCancelMul, and IsCancelMul.
    - Applied fast_instance% to data-carrying injective transporter instances.
  • Mathlib/Algebra/GroupWithZero/ULift.lean:

  • - Moved MulZeroClass (ULift M₀) here from Ring/ULift.lean.
    - Added NoZeroDivisors, IsLeftCancelMulZero, IsRightCancelMulZero, IsCancelMulZero, SemigroupWithZero, and MulDivCancelClass.
    - Applied fast_instance% to data-carrying injective transporter instances.
  • Mathlib/Algebra/Ring/ULift.lean:

  • - Imported GroupWithZero.ULift instead of Group.ULift (removing the duplicate MulZeroClass).
    - Added LeftDistribClass, RightDistribClass, HasDistribNeg, NonUnitalNonAssocCommSemiring, NonAssocCommSemiring, NonUnitalNonAssocCommRing, NonAssocCommRing, and IsDomain.
    - Relaxed RingHom.ulift (and its lemmas) from [CommRing R] [CommRing S] to [NonAssocSemiring R] [NonAssocSemiring S].
  • Mathlib/Algebra/Module/ULift.lean:

  • - Added @[to_additive] to isScalarTower / isScalarTower' / isScalarTower''.
    - Added @[to_additive] instances SMulCommClass / ' / '' and FaithfulSMul / '.
  • Mathlib/Algebra/Star/ULift.lean (new file):

  • - Added Star, InvolutiveStar, TrivialStar, StarMul, StarAddMonoid, StarRing, StarModule (ULift R) M, StarModule R (ULift M), and IsProperStar on ULift (using fast_instance% for data-carrying transporters).

    ---
    <!-- Your PR title will become the first line of the commit message.

    In this box, the text above the --- (if not empty) will be appended
    to the commit message, and can be used to give additional context or
    details. Please leave a blank newline before the ---, otherwise GitHub
    will format the text above it as a title.

    For details on the "pull request lifecycle" in mathlib, please see:
    https://leanprover-community.github.io/contribute/index.html

    In particular, note that most reviewers will only notice your PR
    if it passes the continuous integration checks.
    Please ask for help on https://leanprover.zulipchat.com if needed.

    When merging, all the commits will be squashed into a single commit
    listing all co-authors.

    Co-authors in the squash commit are gathered from two sources:

    First, all authors of commits to this PR branch are included. Thus,
    one way to add co-authors is to include at least one commit authored by
    each co-author among the commits in the pull request. If necessary, you
    may create empty commits to indicate co-authorship, using commands like so:

    git commit --author="Author Name <author@email.com>" --allow-empty -m "add Author Name as coauthor"

    Second, co-authors can also be listed in lines at the very bottom of
    the commit message (that is, directly before the ---) using the following format:

    Co-authored-by: Author Name <author@email.com>

    If you are moving or deleting declarations, please include these lines
    at the bottom of the commit message (before the ---, and also before
    any "Co-authored-by" lines) using the following format:

    Moves:

  • Vector. -> List.Vector.

  • ...
  • Deletions:

  • Nat.bit1_add_bit1

  • ...
  • Any other comments you want to keep out of the PR commit should go
    below the ---, and placed outside this HTML comment, or else they
    will be invisible to reviewers.

    If this PR depends on other PRs, please list them below this comment,
    using the following format:

  • depends on: #abc [optional extra text]

  • depends on: #xyz [optional extra text]
  • -->

    Diff: 502 lines (+376 / -126) across 6 files Reviewer: eric-wieser Review duration: 2547m
    All Vouch review confidence checks passed
    Residual risk 0.28 = Change Risk (0.53) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.53 · 502 lines diff across 6 files
    0.53
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Diff Size diff_size
    0.372
    Shallow Review Depth shallow_review_depth
    0.344
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #46729"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52.5% (MEDIUM) · Higher = larger blast radius
    52.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 28% · Safe to merge
    28%