RFC: Support dependency in Verso docstrings
Open
Nobody has claimed this yet.
RFC
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
Proposal
It would be useful to refer to names of previous fields in the Verso docstring of a structure field. The following currently fails on {name}`n`.
set_option doc.verso true
structure Foo where
n : Nat
-- Unknown constant `n`
/-- Proves that {name}`n` is zero. -/
isZero_n : n = 0
Tested on
Lean 4.35.0-nightly-2026-09-11
Target: x86_64-unknown-linux-gnu Linux
Impact
Add 👍 to issues you consider important. If others benefit from the changes in this proposal being added, please ask them to add 👍 to it.
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 reproducing the failure with set_option doc.verso true and the Foo structure example in the issue. Investigate how Verso docstrings resolve {name} references for structure fields. Done means the isZero_n docstring can refer to the preceding n field without an unknown-constant error.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100