leanprover-community / leanprover-community/lean
Type-class search fails for `∀ [foo], bar`
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 434
- Forks
- 79
- PR merge metrics
- No merged PRs in 30d
Description
class foo (n : ℕ) : Prop :=
(has_true : true)
class bar (n : ℕ) : Prop :=
(has_true : true)
@[reducible] def quux := ∀ n [foo n], bar n
lemma have_quux : quux := by intros n h; constructor; constructor
example [quux] : quux := by apply_instance
example [∀ n [foo n], bar n] : quux := by apply_instance
example [∀ n [foo n], bar n] : ∀ n [foo n], bar n := by apply_instance
example [∀ n [foo n], bar n] (n) [foo n] : bar n := by apply_instance
example [quux] (n) [foo n] : bar n := by apply_instance
I'm not sure if we should/can fix this in general because it conflicts with the frozen instances policy. Although in this case here it could be solved via unification.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied Lean reproducer and examining the type-class search behavior for the quantified instance forms. The issue raises a possible unification-based fix but also a conflict with the frozen instances policy, so first establish the intended policy and scope with maintainers. Done means an agreed behavior is implemented and the examples have appropriate regression coverage.
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