FormalConjecturesUtil/Linters/CategoryAnswerLinter.lean

GitHub source file

Explanation legend Lean4 Domain Explanation Language (L4DEL)

L4DEL explanations are a separate layer. They do not change the Lean source. Intuition is explanatory prose; numbered items are a reading path; sources link the wording back to evidence.

L4DEL
Lean4 Domain Explanation Language

Credit: The upstream authors and contributors retain credit for the project and mathematics. lean4-explainer only renders their pinned source and adds the separately disclosed explanation layer.

Project sources: Pinned project documentation, Formal Conjectures paper, arXiv v1

4 declarations, 1 contain sorry, 0 declared as axioms

The Category Answer Linter

The CategoryAnswerLinter ensures that declarations tagged @[category research solved] do not leave answer(sorry) in their statement: once a problem is solved, the answer should be filled in explicitly, e.g. answer(True).

The check is syntactic. Under the default google.answer setting, answer(sorry) at Prop elaborates to a bare True carrying no annotation, so the placeholder is no longer visible in the elaborated term.

A statement that deliberately keeps answer(sorry) (for instance because the problem is independent of ZFC, or because the answer is a constant that is not known explicitly) can opt out with set_option linter.style.category_answer false in.

Imports (3)
Imported by 2 files
  1. def CategoryAnswerLinter.containsSorry Whether stx contains a sorry anywhere sorry line 49 source

    Source documentation

    Whether stx contains a sorry anywhere.

    no axioms what this means

    Statement uses: Lean.Syntax, Bool

    Proof uses: Inhabited.default

    1 instances, coercions and auxiliary constants left out.

    partial def containsSorry (stx : Syntax) : Bool :=
    …
  2. def CategoryAnswerLinter.answerSorries The answer(..) nodes in stx whose answer is still a sorry line 53 source

    Source documentation

    The answer(..) nodes in stx whose answer is still a sorry.

    no axioms what this means

    Statement uses: Lean.Syntax, Array

    Proof uses: Inhabited.default

    1 instances, coercions and auxiliary constants left out.

    partial def answerSorries (stx : Syntax) : Array Syntax :=
    …
  3. def CategoryAnswerLinter.categoryNeedsAnswer Whether the given category is research solved line 58 source

    Source documentation

    Whether the given category is research solved.

    standard axioms: propext what this means

    Statement uses: ProblemAttributes.Category, Bool

    Proof uses: BEq.beq, ProblemAttributes.Category.research, ProblemAttributes.ProblemStatus.solved

    1 instances, coercions and auxiliary constants left out.

    def categoryNeedsAnswer (cat : ProblemAttributes.Category) : Bool :=
    …

    Mentions: ProblemAttributes.Category

  4. def CategoryAnswerLinter.categoryAnswerLinter The linter checking that solved statements do not use answer(sorry) line 62 source

    Source documentation

    The linter checking that solved statements do not use answer(sorry).

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Lean.Elab.Command.Linter

    Proof uses: Lean.Elab.Command.Linter.mk, Lean.withSetOptionIn, Lean.Syntax, ite, Lean.Elab.Command.CommandElabM, Unit, Eq, Bool, Lean.Syntax.isOfKind, Lean.Name.mkStr4, Bool.true, Lean.Syntax.getArg, OfNat.ofNat, Nat, cond, Bool.or, Bool.false, Lean.TSyntax, List.cons, Lean.SyntaxNodeKind and 36 more

    16 instances, coercions and auxiliary constants left out.

    def categoryAnswerLinter : Linter where
    …