leanprover / leanprover/lean4

support for `scoped` and `local` default instances

Open
#6,604 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

The attribute default_instance currently does not support local and scoped modifiers.
Motivation:

/-- info: 1 + 2 : Nat -/
#guard_msgs in #check 1 + 2

@[local default_instance 101]  -- Error: `default_instance` must be global
instance instOfNatInt (n : Nat) : OfNat Int n where
  ofNat := n

/-- info: 1 + 2 : Int -/
#guard_msgs in #check 1 + 2

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 locating the implementation of the default_instance attribute and how local and scoped modifiers are handled for other attributes. Use the supplied #guard_msgs examples as regression tests; done means both modifiers are accepted and the expected Nat and Int instance selection works.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.