leanprover / leanprover/lean4

(kernel) invalid projection when extracting the proposition from an `Exists` statement.

Open
#2,697 2 comments 2 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 following code explains the issue:

set_option pp.rawOnError true
/- Error:
(kernel) invalid projection
  h.2
-/
example (h : ∃ _ : Nat, P) : P := h.2

/- Works -/
example (h : ∃ _ : Nat, P) : P := by
  let ⟨_, P⟩ := h
  exact P
Context

The issue is discussed here. It seems that the error makes sense, but Alex suggested me to open an issue since it's a kernel error.

Versions

The error appears since Lean (version 4.0.0, commit ec941735c80d, Release) up til v4.2.0-rc1, on a Mac Intel.

Others

As mentioned above, the error makes sense from a human perspective, so if this kernel error is intended, feel free to close this issue :)

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 running the minimal reproducer in the issue and comparing the failing h.2 projection with the working pattern-matching example. Investigate the kernel's handling of projections from Exists; done means the behavior is clarified and either corrected or documented as intended.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.