Basic Lean meta programming commands #
The size of a flattened array of arrays after applying an element-wise filter.
Equations
- Array.flatFilterSizeM p as = Array.foldlM (fun (sizeAcc : Nat) (as : Array α) => do let __do_lift ← Array.filterM p as pure (sizeAcc + __do_lift.size)) 0 as
Instances For
Imports #
Gets all imports within PhysLean.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Number of files within PhysLean.
Equations
- PhysLean.noImports = do let imports ← PhysLean.allImports pure imports.size
Instances For
Gets all constants from an import.
Equations
- PhysLean.Imports.getConsts imp = do let mFile ← Lean.findOLean imp.module let __discr ← Lean.readModuleData mFile match __discr with | (modData, snd) => pure modData.constants
Instances For
Gets all user defined constants from an import.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Turns a name into a system file path.
Equations
- c.toFilePath = (System.mkFilePath (c.toString.splitOn ".")).addExtension "lean"
Instances For
Lines from import.
Equations
Instances For
Name #
Turns a name into a Lean file.
Equations
- c.toRelativeFilePath = { toString := "." }.join c.toFilePath
Instances For
Turns a name, which represents a module, into a link to github.
Equations
Instances For
Given a name, returns the line number.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns the location of a name.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Determines if a name has a location.
Equations
- c.hasPos = do let ranges? ← Lean.findDeclarationRanges? c pure ranges?.isSome
Instances For
Determines if a name has a doc string.
Equations
- c.hasDocString = do let env ← Lean.getEnv let doc? ← liftM (Lean.findDocString? env c) pure doc?.isSome
Instances For
The doc string from a name.
Equations
- c.getDocString = do let env ← Lean.getEnv let doc? ← liftM (Lean.findDocString? env c) pure (doc?.getD "")
Instances For
Given a name, returns the source code defining that name, including doc strings.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given a name, returns the source code defining that name, starting with the def ... or lemma... etc.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Number of definitions.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Number of definitions.
Equations
- One or more equations did not get rendered due to their size.
Instances For
All docstrings present in PhysLean.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Number of definitions without a doc-string.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Number of definitions without a doc-string.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The number of lines in PhysLean.
Equations
- PhysLean.noLines = do let imports ← PhysLean.allImports let x ← Array.mapM PhysLean.Imports.getLines imports pure x.flatSize
Instances For
The number of TODO items.
Equations
- PhysLean.noTODOs = do let imports ← PhysLean.allImports let x ← Array.mapM PhysLean.Imports.getLines imports Array.flatFilterSizeM (fun (l : String) => pure (l.startsWith "TODO ")) x
Instances For
The number of files with a TODO item.
Equations
- One or more equations did not get rendered due to their size.