This page documents Regula 0.10.0. The latest release is Regula 0.11.1: this page in Regula 0.11.1.
RG5003: Registered public material declarations require an Intent section
- Category Documentation
- Scope registered material declaration
- Subreason
material-intent
A registered public material declaration has a docstring without a nonempty labelled Intent section.
What to do. Add a heading whose text is exactly Intent to the docstring, followed by the requirement the claim must meet, stated from the source mathematics or specification.
- Requirement
- Every public
@[regula_material]docstring has a nonempty# Intentsection stating the requirement the claim must meet. - Reported in
- Enforcement
- Strict, like every rule: see how rules are enforced.
Checked example
Violating input
Example.leansource examples/rules/RG5003/Violation.leanimport Regula.MaterialClaim
/-! # Reflexivity
Reflexivity for every natural number; `reflexive` supplies its evidence. -/
/-- Every natural number equals itself, without additional hypotheses. -/
@[regula_material] theorem reflexive (n : Nat) : n = n := rfl
Findings of the violating run
RG5003 error violation fresh project, claim kernel-only
Declaration reflexive at Example.lean (the audit's fresh isolated copy), line 6, column 28
material-intent: add a nonempty `# Intent` section stating the requirement this claim must meetCorrection
Example.lean import Regula.MaterialClaim
/-! # Reflexivity
Reflexivity for every natural number; `reflexive` supplies its evidence. -/
- /-- Every natural number equals itself, without additional hypotheses. -/
+ /-- Every natural number equals itself, without additional hypotheses.
+
+ # Intent
+ ## Requirement
+ Equality on natural numbers must be reflexive for every value, with no side condition. -/
@[regula_material] theorem reflexive (n : Nat) : n = n := rfl
Example.leansource examples/rules/RG5003/Fixed.leanimport Regula.MaterialClaim
/-! # Reflexivity
Reflexivity for every natural number; `reflexive` supplies its evidence. -/
/-- Every natural number equals itself, without additional hypotheses.
# Intent
## Requirement
Equality on natural numbers must be reflexive for every value, with no side condition. -/
@[regula_material] theorem reflexive (n : Nat) : n = n := rfl
The correction adds a nonempty # Intent section, structured with a ## Requirement subsection, to the registered theorem's existing docstring; the explanation, registration, proposition and proof are unchanged.
Checked by a fresh whole-project audit of <example> (axiomGate): violating run rejected, corrected run completed.
How to fix it
-
Add
# Intentwith the requirement in your own words, derived from the source mathematics or program specification, not from the Lean statement. -
Prefer a level-one heading; a top-level Verso docstring header must be
#.
Why it matters
The explanation states what the formal statement says; the intent states what it is required to say. Comparing the two, and both with the declaration, exposes statements that are faithfully explained but wrong (standard ยง5.2).
What triggers it
An Intent section is an ATX heading line whose text is exactly Intent (one to six #, no closing sequence), followed before the next heading of equal or higher level by at least one non-heading line with text. Text under deeper subsection headings counts. A registered docstring without such a section is rejected with applicability material-intent.
A declaration with no docstring at all is RG5002 only; the two rules partition the failures.
Required proof shape
The Intent section states the requirement the declaration must meet; review compares the two.
What a passing result establishes
Every registered public material declaration's docstring has a nonempty labelled Intent section, decided by the proved classifier RegulaPolicy.materialDocumentationFailure.
It does not establish:
-
That the intent states what the requirement owner needs, or that the declaration meets it (R-INTENT, R-DOC). There is no intent detector, length threshold or similarity check.
-
Code fences in the docstring are not tracked: a
# Intentline inside a fenced block counts as an Intent heading.
Configuration and exceptions
The rule checks only declarations registered with @[regula_material] from Regula.MaterialClaim. Removing a registration from a material declaration changes the reviewed claim, not only this rule's result.
Limitations and unsupported cases
Setext headings and closing sequences such as # Intent # are not recognized as Intent headings.
The editor reports this rule only when the module has finished elaborating without errors; a module with elaboration errors gets RG2005 (incomplete) instead.
Sources
- Normative clauses
- standard ยง5.2 Faithful Explanation of Formal Claims
- Checklist rows
DOC-02- Detector, policy and proof sources
lean/RegulaPolicy/Intent.lean,lean/Regula/MaterialClaim.lean,lean/Regula/Linter/Documentation.lean- Proved linkage
RegulaPolicy.materialDocumentationFailure_eq_missingIntent_iffandRegulaPolicy.Intent.hasIntentSection_iff.