leanprover / leanprover/lean4

DefEq transitivity failure for function eta

Open
#12,520 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

The type-checker applies function eta only when one side of the equation is a manifest lambda. But there are other forms where eta-expanding would be productive, e.g. partially applied Eq.rec. This leads to a intransitivity of defeq checking:

variable (a : true = true → Bool)

example : (@Eq.rec Bool true (fun _ _ => Bool) (a (Eq.refl true)) _) = fun h => a h := rfl
example : (fun h => a h) = a := rfl
/--
error: Type mismatch
  rfl
has type
  ?m.8 = ?m.8
but is expected to have type
  Eq.rec (a ⋯) = a
-/
#guard_msgs in
example  : (@Eq.rec Bool true (fun _ _ => Bool) (a (Eq.refl true)) _) = a := rfl

This is similar in spirit to #2258. It seems to have low practical impact, reporting it here for reference.

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 reproducing the two rfl examples in the issue and compare the behavior with the related issue #2258. Trace the type-checker's function-eta handling for manifest lambdas and partially applied Eq.rec; done means the intended definitional-equality behavior is specified and covered by a regression test.

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.