FormalConjecturesUtil/Linters/ExistsImplicationLinter.lean
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
3 declarations, 0 contain sorry, 0 declared as axioms
The Exists Implication Linter
Many misformalisations stem from using a pattern of the form ∃ x, P x → Q instead of
∃ x, P x ∧ Q (e.g. when formalising something of the form "there is positive x such that ...").
This is almost always incorrect (and trivial to prove) since it then suffices to pick an x that
does not satisfy P. This linter flags occurrences of this pattern to the user and proposes a
corrected syntax.
Imports (4)
Imported by 2 files
- def
ExistsImplicationLinter.forallToAndChanges and expression of the form∀ (h1 : Prop1) (h2 : Prop2) ..., Propnto `Prop1 ∧ Prop2 ∧ line 46 sourceSource documentation
Changes and expression of the form
∀ (h1 : Prop1) (h2 : Prop2) ..., PropntoProp1 ∧ Prop2 ∧ ... ∧ Propn.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Lean.Expr,Lean.Meta.MetaMProof uses:
Lean.Meta.forallTelescope,Lean.Meta.Context,StateRefT',IO.RealWorld,Lean.Meta.State,Lean.Core.CoreM,Array,Bind.bind,Array.mapM,Lean.Meta.inferType,Array.foldrM,Lean.Meta.mkAppM,Lean.Name.mkStr1,List.toArray,List.cons,List.nil,Array.size,OfNat.ofNat,Nat,Bool.false8 instances, coercions and auxiliary constants left out.
def forallToAnd (expr : Expr) : MetaM Expr := …
- def
ExistsImplicationLinter.checkExistsArrowChecks if an expression contains the pattern∃ x, P x → Qline 54 sourceSource documentation
Checks if an expression contains the pattern
∃ x, P x → Q.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Lean.Syntax,Lean.Expr,Lean.Meta.MetaM,UnitProof uses:
Inhabited.default1 instances, coercions and auxiliary constants left out.
partial def checkExistsArrow (stx : Syntax) (e : Expr) : MetaM Unit := do …
- def
ExistsImplicationLinter.existsImplicationLinterTheexistsImplicationLinterdetects expressions of the form∃ a, P a → Qand flags them to the user since those are rarely correct line 83 sourceSource documentation
The
existsImplicationLinterdetects expressions of the form∃ a, P a → Qand flags them to the user since those are rarely correct.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Lean.Elab.Command.LinterProof uses:
Lean.Elab.Command.Linter.mk, Lean.Elab.Command.Linter.runTermLinter,Unit,ExistsImplicationLinter.linter.style.existsImplication,Lean.Syntax.Term,Lean.Expr,liftM,ReaderT,Lean.Meta.Context,StateRefT',IO.RealWorld,Lean.Meta.State,Lean.Core.CoreM,StateT,Lean.Meta.MetaM, ExistsImplicationLinter.checkExistsArrow,Lean.TSyntax.raw,List.cons,Lean.SyntaxNodeKind,Lean.Name.mkStr1and 2 more5 instances, coercions and auxiliary constants left out.
def existsImplicationLinter : Linter where …