leanprover / leanprover/lean4

MonadControlT is not the transitive closure of MonadControl

Open
#2,894 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P-low
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

Prerequisites
  • Put an X between the brackets on this line if you have done all of the following:
    • Check that your issue is not already filed.
    • Reduce the issue to a minimal, self-contained, reproducible test case. Avoid dependencies to mathlib4 or std4.
Description

The docstring of MonadControlT says that it's the transitive closure of MonadControl, but the types of MonadControl.restoreM and MonadControlT.restoreM are different. It's not clear to me why this is, and it's different from the relationship between MonadLiftT and MonadLift (whose fields are identical). I think this should either be clarified in the documentation or changed so that the types agree. I don't know what the intended behavior is here.

Context

I've been adding typeclasses for lawful MonadLift and MonadControl and was unable to implement

instance instLawfulMonadControlT.{u, v₁, v₂, v₃} (m : Type u → Type v₁) (n : Type u → Type v₂) (o : Type u → Type v₃)
  [Monad m] [Monad n] [Monad o] [LawfulMonad m] [LawfulMonad n] [LawfulMonad o]
  [MonadControl n o] [MonadControlT m n] [LawfulMonadControl n o] [LawfulMonadControlT m n]
    : LawfulMonadControlT m o

If the difference between the types of MonadControl.restoreM and MonadControlT.restoreM is intentional I would appreciate any suggestions on what the laws for MonadControlT should be.

I asked about this in a zulip thread.

Versions

[Output of #eval Lean.versionString]
4.3.0-rc1
[OS version]
Windows 11 Home, 10.0.22621 Build 22621

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the documented relationship and field types of MonadControl and MonadControlT, especially restoreM. Read the linked Zulip discussion for the unresolved intent, then determine whether the types should align or the documentation should explain the difference. Done means the intended behavior is decided and reflected consistently in the implementation or documentation.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.