leanprover / leanprover/lean4

Congruence lemmas are not used for partially applied functions

Open
#2,128 1 comment 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

The two examples below fail, but work if you replace Nat → Nat by Nat.

opaque partiallyApplied (p : Prop) [Decidable p] : Nat → Nat

example : partiallyApplied (True ∧ True) = partiallyApplied True := by
  simp

example : partiallyApplied (True ∧ True) = partiallyApplied True := by
  congr
  decide

As reported on Zulip: https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/mkCongrSimp.3F.20error.20for.20Set/near/338881269

This is causing issues in mathlib because Set α is defined as α → Prop, so a lot of terms are actually partially-applied functions, like for example Set.image f s.

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

Reproduce the two failing examples from the issue, including the partiallyApplied definition, and compare them with the working Nat case. Start by tracing the congruence and mkCongrSimp behavior implicated by the report; done means both examples succeed without replacing Nat → Nat and the behavior also covers partially applied terms such as Set.image f s.

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
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.