leanprover-community / leanprover-community/mathlib4
anonymous constructor notation does not make use of default values
Open
Nobody has claimed this yet.
lean4-change-in-behaviour
- Dominant language
- Lean
- Stars
- 4.2k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
-- mathlib3 did not allow relying on default field values when using anonymous constructor notation:
structure Q :=
(n : nat)
(m : nat := 0)
example : Q := ⟨0⟩ -- fails
-- however it did allow using `auto_param`s.
meta def s : tactic unit := `[simp]
structure P :=
(n : nat)
(w : n = 0 . s)
example : P := ⟨0⟩
-- in Lean 4, these have been combined into the same syntax,
-- and neither can be used in anonymous constructor notation:
structure P where
n : Nat
w : n = 0 := by simp
example : P := ⟨0⟩
structure Q where
n : Nat
m : Nat := 0
example : Q := ⟨0⟩
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 with the anonymous constructor examples in the issue and trace the elaboration path for structure fields with default values or tactic values. Done means both P := ⟨0⟩ and Q := ⟨0⟩ examples elaborate successfully.
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
- 30/100