leanprover / leanprover/lean4

RFC: Support dependency in Verso docstrings

Open
#15,137 0 comments 2 reactions 0 assignees View on GitHub

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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.