Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type error in condition clause when approaching recursion limit #2775

Closed
1 task done
SchrodingerZhu opened this issue Oct 27, 2023 · 0 comments
Closed
1 task done
Labels
bug Something isn't working

Comments

@SchrodingerZhu
Copy link

SchrodingerZhu commented Oct 27, 2023

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

In the condition clause of a nested if branch, if the checker is approaching maxRecLimit, it will give out certain error messages that may not be related to the recursion limit.

For example,

set_option maxRecDepth 37
def test : IO Unit := do
  pure ()
  for i in #[0] do
    for j in #[0] do
      if i != 1 && i != 2 then
        pure ()

will give out

application type mismatch
  @ite ?m.412 (i != 1 && i != 2)
argument
  i != 1 && i != 2
has type
  Bool : Type
but is expected to have type
  Prop : Type

For a lower limit (say 36), such type error exists but the checker also reports about the limit problem.
For a higher limit (say 38), the error suddenly disappears.

Context

zulip

Steps to Reproduce

Compile the code above.

Expected behavior: Give no error or report an error about maxRecLimit.

Actual behavior: Give a "strange" type-error.

Versions

Lean (version 4.3.0-nightly-2023-10-13, commit 42802f9788a8, Release)
Darwin XXXX.XXXX 23.1.0 Darwin Kernel Version 23.1.0: Tue Sep 26 22:11:17 PDT 2023; root:xnu-10002.40.89.501.1~3/RELEASE_ARM64_T8103 arm64

Additional Information

n/a

Impact

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

@SchrodingerZhu SchrodingerZhu added the bug Something isn't working label Oct 27, 2023
leodemoura added a commit that referenced this issue Oct 31, 2023
arthur-adjedj pushed a commit to arthur-adjedj/lean4 that referenced this issue Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant