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 Physlib.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Number of files within Physlib.
Equations
- Physlib.noImports = do let imports ← Physlib.allImports pure imports.size
Instances For
Gets all constants from an import.
Equations
- Physlib.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
- c.toGitHubLink line = toString "https://github.com/leanprover-community/physlib/blob/master/" ++ toString c.toFilePath ++ toString "#L" ++ toString line
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 __do_lift ← liftM (Lean.findInternalDocString? env c) pure __do_lift.isSome
Instances For
The doc string from a name.
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, 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 Physlib.
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 Physlib.
Equations
- Physlib.noLines = do let imports ← Physlib.allImports let x ← Array.mapM Physlib.Imports.getLines imports pure x.flatSize
Instances For
The number of TODO items.
Equations
- Physlib.noTODOs = do let imports ← Physlib.allImports let x ← Array.mapM Physlib.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.
Instances For
All user defined declarations.
Equations
- Physlib.allUserConsts = do let imports ← liftM Physlib.allImports let __do_lift ← Array.flatMapM Physlib.Imports.getUserConsts imports pure __do_lift