Documentation
¶
Overview ¶
Package formal builds the Lean package of the content repository and reads what it proves (spec 07).
Build runs lake build in the lean directory, then runs AlgoExtract (Extract.lean) with lake env lean. AlgoExtract writes one JSON line for each declaration in the namespace Algo to decls.jsonl. Check reads that file and reports each declaration that uses an axiom outside the policy of 07.5, and each name of a lean field that does not exist.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Allowed = []string{"propext", "Classical.choice", "Quot.sound"}
Allowed are the axioms that a proof can use (spec 07.5). Each other axiom, such as sorryAx or Lean.ofReduceBool, fails the build.
var Kinds = map[string][]string{
"model": {"def"},
"spec": {"def", "inductive", "structure"},
"correct": {"theorem"},
"cost": {"theorem"},
"space": {"theorem"},
}
Kinds are the kinds that each key of a lean field must name.
Functions ¶
func ClaimClass ¶
ClaimClass returns the class of a front matter bound in the same normal form, such as "nlogn" for "Θ(n log n)". It returns "" when the bound is not of the form Θ(...), O(...) or Ω(...).
func ClassOf ¶
ClassOf returns the class of a class lemma in a normal form, such as "nlogn" for `f =O[Filter.atTop] fun n => ↑n * Real.log ↑n`. It returns "" when typ is not a class lemma.
func IsClassLemma ¶
IsClassLemma tells if a type states an asymptotic class, such as `f =O[Filter.atTop] g`.
Types ¶
type Decl ¶
type Decl struct {
Decl string `json:"decl"`
Kind string `json:"kind"`
Module string `json:"module"`
Type string `json:"type"`
TypeHash string `json:"type_hash"`
Axioms []string `json:"axioms"`
Deps []string `json:"deps"`
Sorry bool `json:"sorry"`
Computable bool `json:"computable"`
Doc string `json:"doc,omitempty"`
Pos *Pos `json:"pos,omitempty"`
}
Decl is one line of decls.jsonl.
func (Decl) Disallowed ¶
Disallowed returns the axioms of d that the policy does not permit.
type Finding ¶
type Finding struct {
// Rule is the audit rule of 07.15, such as L01 or L03.
Rule string
// Where is the declaration, or the node and its field.
Where string
Msg string
}
Finding is one problem that Check finds.
func Check ¶
Check reports each declaration that uses an axiom outside the policy (rule L03), and each name of a lean field that is not in ds or has the wrong kind (rule L01). The findings are in a stable order.
func CheckClaims ¶
CheckClaims compares the time claims of a node that has lean.cost with the class lemmas of its module (rule L05). A claim with no class lemma of the same class is a finding. Space claims count only when lean.space is set.
type Options ¶
type Options struct {
// Dir is the Lean package, the lean directory of the content repository.
Dir string
// Out is the directory for decls.jsonl and the copy of Extract.lean, such as build/lean.
Out string
// NoBuild skips lake build, when the package is built already.
NoBuild bool
// Wrap changes a command before it runs, for example to run it in a container. Nil runs it on the host.
Wrap func(argv []string) []string
// Log gets the output of lake.
Log io.Writer
}
Options tell Build where the package is and how to run lake.