Skip to content

feat: support more indexed monads in elabDoWith#13801

Merged
sgraf812 merged 4 commits into
masterfrom
sg/do-indexed-monads
May 20, 2026
Merged

feat: support more indexed monads in elabDoWith#13801
sgraf812 merged 4 commits into
masterfrom
sg/do-indexed-monads

Conversation

@sgraf812
Copy link
Copy Markdown
Contributor

This PR adds two new fields to DoOps, splitMonadApp? and mkMonadApp, so that callers of elabDoWith can use indexed monads like Measure α (where Measure : (α : Type u) → [MeasureSpace α] → Type u carries instance arguments) that the default m α decomposition cannot handle. The existing behavior moves into DoOps.default.

splitMonadApp? replaces the hard-coded .app m α step inside the extractMonadInfo recursion, and mkMonadApp replaces the hard-coded mkApp m α used to construct the monadic type.

Sebastian Graf added 2 commits May 20, 2026 15:07
This PR renames the `do` elaborator's `mkMonadicType` to `mkMonadApp`, aligning it with the existing `mkPureApp` / `mkBindApp` naming convention in `DoOps`.
This PR adds two new fields to `DoOps`, `splitMonadApp?` and `mkMonadApp`, so that callers of `elabDoWith` can use indexed monads like `Measure α` (where `Measure : (α : Type u) → [MeasureSpace α] → Type u` carries instance arguments) that the default `m α` decomposition cannot handle. The existing behavior moves into `DoOps.default`.

`splitMonadApp?` replaces the hard-coded `.app m α` step inside the `extractMonadInfo` recursion, and `mkMonadApp` replaces the hard-coded `mkApp m α` used to construct the monadic type.
@sgraf812 sgraf812 added the changelog-language Language features and metaprograms label May 20, 2026
@sgraf812 sgraf812 changed the title feat: support indexed monads in elabDoWith feat: support more indexed monads in elabDoWith May 20, 2026
@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label May 20, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

mathlib-lean-pr-testing Bot commented May 20, 2026

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 34df7320668250fa586c2bbb706637896581a3f9 --onto 43ef70db63e2c1c1720b84fd153125c96a00c5d2. You can force Mathlib CI using the force-mathlib-ci label. (2026-05-20 16:34:41)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase da8bcf79160085502377aea35b4c338cfa34a72d --onto 43ef70db63e2c1c1720b84fd153125c96a00c5d2. You can force Mathlib CI using the force-mathlib-ci label. (2026-05-20 18:07:01)

@leanprover-bot
Copy link
Copy Markdown
Collaborator

leanprover-bot commented May 20, 2026

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 34df7320668250fa586c2bbb706637896581a3f9 --onto 803553a556fd82fa1060efb0c43eda542130cb16. You can force reference manual CI using the force-manual-ci label. (2026-05-20 16:34:43)
  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase da8bcf79160085502377aea35b4c338cfa34a72d --onto 803553a556fd82fa1060efb0c43eda542130cb16. You can force reference manual CI using the force-manual-ci label. (2026-05-20 18:07:03)

@sgraf812 sgraf812 enabled auto-merge May 20, 2026 17:29
@sgraf812 sgraf812 added this pull request to the merge queue May 20, 2026
Merged via the queue into master with commit 65b3453 May 20, 2026
18 checks passed
@sgraf812 sgraf812 deleted the sg/do-indexed-monads branch May 20, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-language Language features and metaprograms toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants