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

calc does not try to unify with expected type #2913

Open
1 task done
collares opened this issue Nov 19, 2023 · 0 comments
Open
1 task done

calc does not try to unify with expected type #2913

collares opened this issue Nov 19, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@collares
Copy link
Contributor

collares commented Nov 19, 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

Although example : 3 + 9 = 12 := rfl works, the following code

example : 3 + 9 = 12 :=
  calc
    3 + 9 = 12 := rfl

fails with

type mismatch
  rfl
has type
  3 + 9 = 3 + 9 : Prop
but is expected to have type
  3 + 9 = 12 : Prop

Replacing rfl with by rfl or by exact rfl above makes it work, but I think it shouldn't be necessary.

Context

Phil Wadler encountered this issue while porting his "Programming Language Foundations in Agda" book to Lean: https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/Debugging.20an.20issue.20with.20calc.20mode

This is a regression pointed out by Wadler after upgrading from an old nightly. I bisected it and it works on the 2023-01-05 nightly and fails on the 2023-01-06 one. According to https://github.com/leanprover/lean4-nightly/releases/tag/nightly-2023-01-06 this points to fedf235, but see also 474f1a4 where this was worked around for the show tactic.

In particular, plfa/plfl@a4684b2 contains three more calc uses which now require type ascriptions (and didn't need them before fedf235).

Versions

Lean 4.3.0-rc2 on Linux

Impact

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

@collares collares added the bug Something isn't working label Nov 19, 2023
@collares collares changed the title calc problems with defeq terms calc does not try to unify with expected type 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