Regula rule reference

This page documents Regula 0.2.0. The latest release is Regula 0.11.1: this page in Regula 0.11.1.

RG2005: Required admission and source evidence must be complete๐Ÿ”—

  • Category Admission
  • Scope project
  • Subreason admission

Required evidence is missing, incomplete, unsupported or invalid: owned declarations did not pass kernel admission, a frozen source or .olean file changed during the audit, or authentication the result needs could not complete. The result is INCOMPLETE.

What to do. Remove the construction that bypasses kernel checking (or the source change during the run), then run the project command that collects the missing evidence.

Requirement
Owned declarations pass kernel replay from the exact frozen sources; no metaprogram adds unchecked declarations.
Reported in
EditorProjectSingle fileDocs examples
Enforcement
Strict, like every rule: see how rules are enforced.

Checked example๐Ÿ”—

Diagnostic demonstration: the violating run is INCOMPLETE by design. It shows the exact diagnostic and is not accepted negative evidence. The corrected input passed a completed positive check.

Violating input

โœ— IncompleteExample.leansource examples/rules/RG2005/Violation.lean
import Lean
/-! # Reflexivity

Reflexivity declared with unchecked, ill-typed evidence. -/
open Lean Elab Command
set_option debug.skipKernelTC true in
run_cmd liftCoreM <| Lean.addDecl (.thmDecl {
  name := `reflexive
  levelParams := []
  type := mkForall `n .default (mkConst ``Nat)
    (mkApp3 (mkConst ``Eq [Level.succ Level.zero]) (mkConst ``Nat) (mkBVar 0) (mkBVar 0))
  value := mkConst ``True.intro })

Findings of the violating run

RG2005 error incomplete fresh project

Subject <example> at project <example>

[INCOMPLETE[kernel-admission]] while replaying declaration 'reflexive':
(kernel) declaration type mismatch, 'reflexive' has type
  True
but it is expected to have type
  โˆ€ (n : Nat), Eq n n

Correction

Change to Example.lean
- import Lean
- /-! # Reflexivity
- 
- Reflexivity declared with unchecked, ill-typed evidence. -/
- open Lean Elab Command
- set_option debug.skipKernelTC true in
- run_cmd liftCoreM <| Lean.addDecl (.thmDecl {
-   name := `reflexive
-   levelParams := []
-   type := mkForall `n .default (mkConst ``Nat)
-     (mkApp3 (mkConst ``Eq [Level.succ Level.zero]) (mkConst ``Nat) (mkBVar 0) (mkBVar 0))
-   value := mkConst ``True.intro })
+ /-! # Reflexivity
+ 
+ Reflexivity for every natural number. -/
+ theorem reflexive (n : Nat) : n = n := rfl
โœ“ PassesExample.leansource examples/rules/RG2005/Fixed.lean
/-! # Reflexivity

Reflexivity for every natural number. -/
theorem reflexive (n : Nat) : n = n := rfl

The correction replaces ill-typed unchecked evidence with a checked proof of the same reflexivity statement.

Checked by a fresh whole-project audit of <example> (axiomGate): violating run incomplete, corrected run completed.

How to fix it๐Ÿ”—

  1. Remove uses of debug.skipKernelTC, addDecl with unchecked values, or other metaprograms that add unchecked declarations; state and prove the theorem normally.

  2. Do not edit sources while an audit runs; rerun it.

  3. For an editor pending result, run lake lint (or lake lint -- --fresh).

  4. Rename an owned declaration that shares its name with another module's constant unless both are theorems of the same statement, universe parameters and mutual block, such as an equation lemma Lean realizes in each module that needs it; admission checks each owned copy that is not identical to the replayed or trusted one.

Why it matters๐Ÿ”—

Successful elaboration alone is not checked admission: metaprograms and debug options can store declarations the kernel never checked. An accepted result must rest on kernel-checked evidence for the exact frozen sources.

What triggers it๐Ÿ”—

Before accepting proof evidence the checker replays every owned logical declaration and its owned dependencies through Lean's kernel (Admission.validate); an executable's environment reuses, instead of repeating, a library environment's replay of a module over the identical import closure and frozen .olean parts (including .olean.private). Each replayed module's own copy of a name is checked: a lemma Lean realizes in two modules, such as an equation lemma, is admitted when the copies are theorems of the same statement, universe parameters and mutual block and each owned copy that is not identical to the replayed or trusted one passes the kernel with a proof that does not reach its own name and reaches the same axioms. A declaration that fails replay, source or .olean bytes that changed after they were frozen, or a required authentication that failed is reported here with impact incomplete.

In the editor, this rule marks results that need fresh evidence only the project command collects, and those messages name lake lint. The editor also reports it, as incomplete, when its own analysis of a declaration fails or the module has elaboration errors.

Required proof shape๐Ÿ”—

The replayed declaration must type-check in the kernel with exactly its stated type and value.

What a passing result establishes๐Ÿ”—

Every owned logical declaration and its owned dependencies passed kernel replay (every other copy of a theorem that another loaded module also declares is identical to the replayed or trusted one, or passed the kernel's check under a fresh name with a proof that does not reach its own name and reaches the same axioms), and the frozen sources were unchanged during the audit. A failed admission or changed source is incomplete and never accepted.

It does not establish:

  • Imported, unowned dependencies are not replayed; they remain the declared trusted base.

  • Incremental admission does not establish fresh source elaboration.

It leaves these review obligations open: R-QUALIFY.

Configuration and exceptions๐Ÿ”—

No option waives admission. A failed generated-role authentication cannot waive RG1001 or RG1006.

Limitations and unsupported cases๐Ÿ”—

This page's example is a diagnostic demonstration: the violating run is INCOMPLETE by design and is not accepted negative evidence. Its corrected counterpart passed a completed positive check.

Sources๐Ÿ”—

Normative clauses
standard ยง7.3 Clean Elaboration and Diagnostics
Checklist rows
DECL-01, DECL-02, FOUND-05, SCOPE-02, TYPE-01, THEOREM-01, THEOREM-03, THEOREM-07, DECL-03, DECL-04, COMP-02, COMP-04, BUILD-01, BUILD-04
Detector, policy and proof sources
lean/Regula/Checker/Admission.lean, lean/Regula/Checker/SourceAudit.lean, lean/Regula/Checker/SourceBinding.lean
Proved linkage
Acceptance side only: an accepted run satisfies RegulaPolicy.AdmissionOK. The editor's deferral to the project audit is Regula.Checker.Policy.editor_decision_pending.