statement
stringlengths
1
1.98k
proof
stringlengths
0
15.3k
type
stringclasses
10 values
symbolic_name
stringlengths
1
117
library
stringclasses
156 values
filename
stringclasses
526 values
imports
listlengths
0
7
deps
listlengths
0
64
docstring
stringlengths
0
2.13k
source_url
stringclasses
1 value
commit
stringclasses
1 value
doubleEmptyLineLinter : PhyslibTextLinter
fun lines ↦ Id.run do let enumLines := (lines.toList.zipIdx 1) let pairLines := List.zip enumLines (List.tail! enumLines) let errors := pairLines.filterMap (fun ((l1, lno1), l2, _) ↦ if l1.length == 0 && l2.length == 0 then some (s!" Double empty line. ", lno1, 1) else none) errors.toArray
def
doubleEmptyLineLinter
scripts.MetaPrograms
scripts/MetaPrograms/regex_lint.lean
[ "Lean", "Mathlib.Tactic.Linter.TextBased", "Batteries.Data.Array.Merge", "Regex" ]
[ "PhyslibTextLinter" ]
Checks if there are two consecutive empty lines.
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
doubleSpaceLinter : PhyslibTextLinter
fun lines ↦ Id.run do let enumLines := (lines.toList.zipIdx 1) let errors := enumLines.filterMap (fun (l, lno) ↦ if String.containsSubstr l.trimLeft " " then let k := (Substring.findAllSubstr l " ").toList.getLast? let col := match k with | none => 1 | some k => String.offsetOfPos ...
def
doubleSpaceLinter
scripts.MetaPrograms
scripts/MetaPrograms/regex_lint.lean
[ "Lean", "Mathlib.Tactic.Linter.TextBased", "Batteries.Data.Array.Merge", "Regex" ]
[ "PhyslibTextLinter" ]
Checks if there is a double space in the line, which is not at the start.
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
longLineLinter : PhyslibTextLinter
fun lines ↦ Id.run do let enumLines := (lines.toList.zipIdx 1) let errors := enumLines.filterMap (fun (l, lno) ↦ if l.length > 100 ∧ ¬ String.containsSubstr l "http" then some (s!" Line is too long.", lno, 100) else none) errors.toArray
def
longLineLinter
scripts.MetaPrograms
scripts/MetaPrograms/regex_lint.lean
[ "Lean", "Mathlib.Tactic.Linter.TextBased", "Batteries.Data.Array.Merge", "Regex" ]
[ "PhyslibTextLinter" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
substringLinter (s : String) : PhyslibTextLinter
fun lines ↦ Id.run do let enumLines := (lines.toList.zipIdx 1) let errors := enumLines.filterMap (fun (l, lno) ↦ if String.containsSubstr l s then let k := (Substring.findAllSubstr l s).toList.getLast? let col := match k with | none => 1 | some k => String.offsetOfPos l k.stopPos ...
def
substringLinter
scripts.MetaPrograms
scripts/MetaPrograms/regex_lint.lean
[ "Lean", "Mathlib.Tactic.Linter.TextBased", "Batteries.Data.Array.Merge", "Regex" ]
[ "PhyslibTextLinter" ]
Substring linter.
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
endLineLinter (s : String) : PhyslibTextLinter
fun lines ↦ Id.run do let enumLines := (lines.toList.zipIdx 1) let errors := enumLines.filterMap (fun (l, lno) ↦ if l.endsWith s then some (s!" Line ends with `{s}`.", lno, l.length) else none) errors.toArray
def
endLineLinter
scripts.MetaPrograms
scripts/MetaPrograms/regex_lint.lean
[ "Lean", "Mathlib.Tactic.Linter.TextBased", "Batteries.Data.Array.Merge", "Regex" ]
[ "PhyslibTextLinter" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
numInitialSpacesEven : PhyslibTextLinter
fun lines ↦ Id.run do let enumLines := (lines.toList.zipIdx 1) let errors := enumLines.filterMap (fun (l, lno) ↦ let numSpaces := (l.takeWhile (· == ' ')).length if numSpaces % 2 != 0 then some (s!"Number of initial spaces is not even.", lno, 1) else none) errors.toArray
def
numInitialSpacesEven
scripts.MetaPrograms
scripts/MetaPrograms/regex_lint.lean
[ "Lean", "Mathlib.Tactic.Linter.TextBased", "Batteries.Data.Array.Merge", "Regex" ]
[ "PhyslibTextLinter" ]
Number of space at new line must be even.
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
PhyslibErrorContext where /-- The underlying `message`. -/ error : String /-- The line number -/ lineNumber : ℕ /-- The column number -/ columnNumber : ℕ /-- The file path -/ path : FilePath
structure
PhyslibErrorContext
scripts.MetaPrograms
scripts/MetaPrograms/regex_lint.lean
[ "Lean", "Mathlib.Tactic.Linter.TextBased", "Batteries.Data.Array.Merge", "Regex" ]
[]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
printErrors (errors : Array PhyslibErrorContext) : IO Unit
do for e in errors do IO.println (s!"error: {e.path}:{e.lineNumber}:{e.columnNumber}: {e.error}")
def
printErrors
scripts.MetaPrograms
scripts/MetaPrograms/regex_lint.lean
[ "Lean", "Mathlib.Tactic.Linter.TextBased", "Batteries.Data.Array.Merge", "Regex" ]
[ "PhyslibErrorContext" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
physlibLintFile (path : FilePath) : IO (Array PhyslibErrorContext)
do let lines ← IO.FS.lines path let allOutput := (Array.map (fun lint ↦ (Array.map (fun (e, n, c) ↦ PhyslibErrorContext.mk e n c path)) (lint lines))) #[doubleEmptyLineLinter, doubleSpaceLinter, numInitialSpacesEven, longLineLinter, unneededParentheses, substringLinter ".-/", substringLinter " )", ...
def
physlibLintFile
scripts.MetaPrograms
scripts/MetaPrograms/regex_lint.lean
[ "Lean", "Mathlib.Tactic.Linter.TextBased", "Batteries.Data.Array.Merge", "Regex" ]
[ "PhyslibErrorContext", "doubleEmptyLineLinter", "doubleSpaceLinter", "endLineLinter", "longLineLinter", "numInitialSpacesEven", "substringLinter", "unneededParentheses" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
main (_ : List String) : IO UInt32
do initSearchPath (← findSysroot) let mods : Name := `Physlib let imp : Import := {module := mods} let mFile ← findOLean imp.module unless (← mFile.pathExists) do throw <| IO.userError s!"object file '{mFile}' of module {imp.module} does not exist" let (physlibMod, _) ← readModuleData mFile let f...
def
main
scripts.MetaPrograms
scripts/MetaPrograms/regex_lint.lean
[ "Lean", "Mathlib.Tactic.Linter.TextBased", "Batteries.Data.Array.Merge", "Regex" ]
[ "physlibLintFile" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
runLinterOnModule (module : Name): IO Unit
do initSearchPath (← findSysroot) Lean.enableInitializersExecution -- If the linter is being run on a target that doesn't import `Batteries.Tactic.List`, -- the linters are ineffective. So we import it here. let lintModule := `Batteries.Tactic.Lint let lintFile ← findOLean lintModule unless (← lintFile.pa...
def
runLinterOnModule
scripts.MetaPrograms
scripts/MetaPrograms/runPhyslibLinters.lean
[ "Batteries.Tactic.Lint", "Batteries.Data.Array.Basic", "Lake.CLI.Main" ]
[]
Run the Batteries linter on a given module and update the linter if `update` is `true`.
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
main (_ : List String) : IO Unit
do let modulesToLint := #[`Physlib] modulesToLint.forM <| runLinterOnModule
def
main
scripts.MetaPrograms
scripts/MetaPrograms/runPhyslibLinters.lean
[ "Batteries.Tactic.Lint", "Batteries.Data.Array.Basic", "Lake.CLI.Main" ]
[ "runLinterOnModule" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
main (_ : List String) : IO Unit
do initSearchPath (← findSysroot) Lean.enableInitializersExecution println! "Checking sorryful results." let env ← importModules (loadExts := true) #[`Physlib, `QuantumInfo] {} 0 let fileName := "" let options : Options := {} let ctx : Core.Context := {fileName, options, fileMap := default } let state :...
def
main
scripts.MetaPrograms
scripts/MetaPrograms/sorry_lint.lean
[ "Physlib.Meta.Informal.Post", "Mathlib.Lean.CoreM", "Physlib.Meta.Linters.Sorry", "Physlib.Meta.Sorry" ]
[ "Physlib.sorryfulPseudoTest" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
moduleDocs : MetaM (Array String)
do let env ← getEnv let allModules ← allPhyslibModules let modDocs := allModules.filterMap fun c => Lean.getModuleDoc? env c let modDocs := modDocs.flatten let modDocs := modDocs.map fun d => d.doc return modDocs
def
moduleDocs
scripts.MetaPrograms
scripts/MetaPrograms/spelling.lean
[ "Physlib.Meta.Informal.Post", "Mathlib.Lean.CoreM", "Physlib.Meta.Linters.Sorry", "Physlib.Meta.Sorry", "Mathlib.Data.List.Defs", "Lean.DocString.Extension", "Physlib.Meta.AllFilePaths" ]
[ "allPhyslibModules" ]
The strings appearing as documentation within Physlib.
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
allWords : MetaM (Array String)
do let allConstants ← Physlib.allUserConsts let allModuleDocs ← moduleDocs let allDocStrings ← allConstants.mapM fun c => Lean.Name.getDocString c.name let allDocStrings := allDocStrings ++ allModuleDocs let allDocStrings := allDocStrings.filter (fun x => x ≠ "") let allList := allDocStrings.flatMap (fun s ...
def
allWords
scripts.MetaPrograms
scripts/MetaPrograms/spelling.lean
[ "Physlib.Meta.Informal.Post", "Mathlib.Lean.CoreM", "Physlib.Meta.Linters.Sorry", "Physlib.Meta.Sorry", "Mathlib.Data.List.Defs", "Lean.DocString.Extension", "Physlib.Meta.AllFilePaths" ]
[ "Lean.Name.getDocString", "Physlib.allUserConsts", "moduleDocs" ]
All the words in either module doc-strings or doc-strings of definitions, theorems and lemmas.
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
dictionary : MetaM (Array String)
do let path : System.FilePath := "./scripts/MetaPrograms/spellingWords.txt" let lines ← IO.FS.lines path return lines.map (fun s => s.toLower)
def
dictionary
scripts.MetaPrograms
scripts/MetaPrograms/spelling.lean
[ "Physlib.Meta.Informal.Post", "Mathlib.Lean.CoreM", "Physlib.Meta.Linters.Sorry", "Physlib.Meta.Sorry", "Mathlib.Data.List.Defs", "Lean.DocString.Extension", "Physlib.Meta.AllFilePaths" ]
[]
The custom dictionary of correctly spelled words.
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
main (_ : List String) : IO Unit
do initSearchPath (← findSysroot) Lean.enableInitializersExecution println! "Checking spelling." let env ← importModules (loadExts := true) #[`Physlib] {} 0 let fileName := "" let options : Options := {} let ctx : Core.Context := {fileName, options, fileMap := default } let state := {env} let (array, ...
def
main
scripts.MetaPrograms
scripts/MetaPrograms/spelling.lean
[ "Physlib.Meta.Informal.Post", "Mathlib.Lean.CoreM", "Physlib.Meta.Linters.Sorry", "Physlib.Meta.Sorry", "Mathlib.Data.List.Defs", "Lean.DocString.Extension", "Physlib.Meta.AllFilePaths" ]
[ "allWords", "dictionary" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
doubleSpaceLinter : PhyslibTextLinter
fun lines ↦ Id.run do let enumLines := (lines.toList.zipIdx 1) let errors := enumLines.filterMap (fun (l, lno) ↦ if String.containsSubstr l.trimAsciiStart.copy " " then let k := (Substring.Raw.findAllSubstr l " ").toList.getLast? let col := match k with | none => 1 | some k => Stri...
def
doubleSpaceLinter
scripts.MetaPrograms
scripts/MetaPrograms/style_lint.lean
[ "Lean", "Mathlib.Tactic.Linter.TextBased", "Batteries.Data.Array.Merge" ]
[ "PhyslibTextLinter" ]
Checks if there is a double space in the line, which is not at the start.
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
substringLinter (s : String) : PhyslibTextLinter
fun lines ↦ Id.run do let enumLines := (lines.toList.zipIdx 1) let errors := enumLines.filterMap (fun (l, lno) ↦ if String.containsSubstr l s then let k := (Substring.Raw.findAllSubstr l s).toList.getLast? let col := match k with | none => 1 | some k => String.Pos.Raw.offsetOfPos l k...
def
substringLinter
scripts.MetaPrograms
scripts/MetaPrograms/style_lint.lean
[ "Lean", "Mathlib.Tactic.Linter.TextBased", "Batteries.Data.Array.Merge" ]
[ "PhyslibTextLinter" ]
Substring linter.
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
numInitialSpacesEven : PhyslibTextLinter
fun lines ↦ Id.run do let enumLines := (lines.toList.zipIdx 1) let errors := enumLines.filterMap (fun (l, lno) ↦ let numSpaces := (l.takeWhile (· == ' ')).positions.length if numSpaces % 2 != 0 then some (s!"Number of initial spaces is not even.", lno, 1) else none) errors.toArray
def
numInitialSpacesEven
scripts.MetaPrograms
scripts/MetaPrograms/style_lint.lean
[ "Lean", "Mathlib.Tactic.Linter.TextBased", "Batteries.Data.Array.Merge" ]
[ "PhyslibTextLinter" ]
Number of space at new line must be even.
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
physlibLintFile (path : FilePath) : IO (Array PhyslibErrorContext)
do let lines ← IO.FS.lines path let allOutput := (Array.map (fun lint ↦ (Array.map (fun (e, n, c) ↦ PhyslibErrorContext.mk e n c path)) (lint lines))) #[doubleEmptyLineLinter, doubleSpaceLinter, numInitialSpacesEven, longLineLinter, substringLinter ".-/", substringLinter " )", substringLinter "( ", ...
def
physlibLintFile
scripts.MetaPrograms
scripts/MetaPrograms/style_lint.lean
[ "Lean", "Mathlib.Tactic.Linter.TextBased", "Batteries.Data.Array.Merge" ]
[ "PhyslibErrorContext", "doubleEmptyLineLinter", "doubleSpaceLinter", "endLineLinter", "longLineLinter", "numInitialSpacesEven", "substringLinter" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
main (_ : List String) : IO UInt32
do initSearchPath (← findSysroot) let mods : Name := `Physlib let imp : Import := {module := mods} let mFile ← findOLean imp.module unless (← mFile.pathExists) do throw <| IO.userError s!"object file '{mFile}' of module {imp.module} does not exist" let (physlibMod, _) ← readModuleData mFile let f...
def
main
scripts.MetaPrograms
scripts/MetaPrograms/style_lint.lean
[ "Lean", "Mathlib.Tactic.Linter.TextBased", "Batteries.Data.Array.Merge" ]
[ "physlibLintFile" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
PhyslibCategory | ClassicalMechanics | CondensedMatter | Cosmology | Elctromagnetism | Mathematics | Meta | Optics | Particles | QFT | QuantumMechanics | Relativity | StringTheory | StatisticalMechanics | Thermodynamics | QuantumInfo | Other deriving BEq, DecidableEq
inductive
PhyslibCategory
scripts.MetaPrograms
scripts/MetaPrograms/TODO_to_yml.lean
[ "Physlib.Meta.Basic", "Physlib.Meta.TODO.Basic", "Mathlib.Lean.CoreM", "Physlib.Meta.Informal.Post", "Physlib.Meta.Informal.SemiFormal", "Physlib.Meta.Linters.Sorry" ]
[]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
PhyslibCategory.string : PhyslibCategory → String
| ClassicalMechanics => "Classical Mechanics" | CondensedMatter => "Condensed Matter" | Cosmology => "Cosmology" | Elctromagnetism => "Electromagnetism" | Mathematics => "Mathematics" | Meta => "Meta" | Optics => "Optics" | Particles => "Particles" | QFT => "QFT" | QuantumMechanics => "Quantum Mechani...
def
PhyslibCategory.string
scripts.MetaPrograms
scripts/MetaPrograms/TODO_to_yml.lean
[ "Physlib.Meta.Basic", "Physlib.Meta.TODO.Basic", "Mathlib.Lean.CoreM", "Physlib.Meta.Informal.Post", "Physlib.Meta.Informal.SemiFormal", "Physlib.Meta.Linters.Sorry" ]
[ "PhyslibCategory" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
PhyslibCategory.emoji : PhyslibCategory → String
| ClassicalMechanics => "⚙️" | CondensedMatter => "🧊" | Cosmology => "🌌" | Elctromagnetism => "⚡" | Mathematics => "➗" | Meta => "🏛️" | Optics => "🔍" | Particles => "💥" | QFT => "🌊" | QuantumMechanics => "⚛️" | Relativity => "⏳" | StringTheory => "🧵" | StatisticalMechanics => "🎲" | The...
def
PhyslibCategory.emoji
scripts.MetaPrograms
scripts/MetaPrograms/TODO_to_yml.lean
[ "Physlib.Meta.Basic", "Physlib.Meta.TODO.Basic", "Mathlib.Lean.CoreM", "Physlib.Meta.Informal.Post", "Physlib.Meta.Informal.SemiFormal", "Physlib.Meta.Linters.Sorry" ]
[ "PhyslibCategory" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
PhyslibCategory.List : List PhyslibCategory
[ PhyslibCategory.ClassicalMechanics, PhyslibCategory.CondensedMatter, PhyslibCategory.Cosmology, PhyslibCategory.Elctromagnetism, PhyslibCategory.Mathematics, PhyslibCategory.Meta, PhyslibCategory.Optics, PhyslibCategory.Particles, PhyslibCategory.QFT, PhyslibCategory.QuantumMechani...
def
PhyslibCategory.List
scripts.MetaPrograms
scripts/MetaPrograms/TODO_to_yml.lean
[ "Physlib.Meta.Basic", "Physlib.Meta.TODO.Basic", "Mathlib.Lean.CoreM", "Physlib.Meta.Informal.Post", "Physlib.Meta.Informal.SemiFormal", "Physlib.Meta.Linters.Sorry" ]
[ "PhyslibCategory" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
PhyslibCategory.ofFileName (n : Name) : PhyslibCategory
if n.toString.startsWith "Physlib.ClassicalMechanics" then PhyslibCategory.ClassicalMechanics else if n.toString.startsWith "Physlib.CondensedMatter" then PhyslibCategory.CondensedMatter else if n.toString.startsWith "Physlib.Cosmology" then PhyslibCategory.Cosmology else if n.toString.startsWith "Ph...
def
PhyslibCategory.ofFileName
scripts.MetaPrograms
scripts/MetaPrograms/TODO_to_yml.lean
[ "Physlib.Meta.Basic", "Physlib.Meta.TODO.Basic", "Mathlib.Lean.CoreM", "Physlib.Meta.Informal.Post", "Physlib.Meta.Informal.SemiFormal", "Physlib.Meta.Linters.Sorry" ]
[ "PhyslibCategory" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
FullTODOInfo where content : String fileName : Name name : Name line : Nat isInformalDef : Bool isInformalLemma : Bool isSemiFormalResult : Bool isSorryfulResult : Bool
false category : PhyslibCategory tag : String
structure
FullTODOInfo
scripts.MetaPrograms
scripts/MetaPrograms/TODO_to_yml.lean
[ "Physlib.Meta.Basic", "Physlib.Meta.TODO.Basic", "Mathlib.Lean.CoreM", "Physlib.Meta.Informal.Post", "Physlib.Meta.Informal.SemiFormal", "Physlib.Meta.Linters.Sorry" ]
[ "PhyslibCategory" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
FullTODOInfo.toYAML (todo : FullTODOInfo) : MetaM String
do let content := todo.content let contentIndent := content.replace "\n" "\n " return s!" - file: {todo.fileName} githubLink: {Name.toGitHubLink todo.fileName todo.line} line: {todo.line} isInformalDef: {todo.isInformalDef} isInformalLemma: {todo.isInformalLemma} isSemiFormalResult: {to...
def
FullTODOInfo.toYAML
scripts.MetaPrograms
scripts/MetaPrograms/TODO_to_yml.lean
[ "Physlib.Meta.Basic", "Physlib.Meta.TODO.Basic", "Mathlib.Lean.CoreM", "Physlib.Meta.Informal.Post", "Physlib.Meta.Informal.SemiFormal", "Physlib.Meta.Linters.Sorry" ]
[ "FullTODOInfo" ]
Converts a `FullTODOInfo` to an entry in a YAML code.
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
FullTODOInfo.ofTODO (t : todoInfo) : FullTODOInfo
{content := t.content, fileName := t.fileName, line := t.line, name := t.fileName, isInformalDef := false, isInformalLemma := false, isSemiFormalResult := false, category := PhyslibCategory.ofFileName t.fileName, tag := t.tag}
def
FullTODOInfo.ofTODO
scripts.MetaPrograms
scripts/MetaPrograms/TODO_to_yml.lean
[ "Physlib.Meta.Basic", "Physlib.Meta.TODO.Basic", "Mathlib.Lean.CoreM", "Physlib.Meta.Informal.Post", "Physlib.Meta.Informal.SemiFormal", "Physlib.Meta.Linters.Sorry" ]
[ "FullTODOInfo", "PhyslibCategory.ofFileName" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
getTodoInfo : MetaM (Array FullTODOInfo)
do let env ← getEnv let todoInfo := (todoExtension.getState env) -- pure (todoInfo.qsort (fun x y => x.fileName.toString < y.fileName.toString)).toList pure (todoInfo.map FullTODOInfo.ofTODO)
def
getTodoInfo
scripts.MetaPrograms
scripts/MetaPrograms/TODO_to_yml.lean
[ "Physlib.Meta.Basic", "Physlib.Meta.TODO.Basic", "Mathlib.Lean.CoreM", "Physlib.Meta.Informal.Post", "Physlib.Meta.Informal.SemiFormal", "Physlib.Meta.Linters.Sorry" ]
[ "FullTODOInfo", "FullTODOInfo.ofTODO" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
informalTODO (x : ConstantInfo) : CoreM FullTODOInfo
do let name := x.name let tag ← Informal.getTag x let lineNo ← Name.lineNumber name let docString ← Name.getDocString name let file ← Name.fileName name let isInformalDef := Informal.isInformalDef x let isInformalLemma := Informal.isInformalLemma x let category := PhyslibCategory.ofFileName file retur...
def
informalTODO
scripts.MetaPrograms
scripts/MetaPrograms/TODO_to_yml.lean
[ "Physlib.Meta.Basic", "Physlib.Meta.TODO.Basic", "Mathlib.Lean.CoreM", "Physlib.Meta.Informal.Post", "Physlib.Meta.Informal.SemiFormal", "Physlib.Meta.Linters.Sorry" ]
[ "FullTODOInfo", "Informal.getTag", "Informal.isInformalDef", "Informal.isInformalLemma", "PhyslibCategory.ofFileName" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
allInformalTODO : CoreM (Array FullTODOInfo)
do let x ← AllInformal x.mapM informalTODO
def
allInformalTODO
scripts.MetaPrograms
scripts/MetaPrograms/TODO_to_yml.lean
[ "Physlib.Meta.Basic", "Physlib.Meta.TODO.Basic", "Mathlib.Lean.CoreM", "Physlib.Meta.Informal.Post", "Physlib.Meta.Informal.SemiFormal", "Physlib.Meta.Linters.Sorry" ]
[ "FullTODOInfo", "informalTODO" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
FullTODOInfo.ofSemiFormal (t : WantedInfo) : FullTODOInfo
{content := t.content, fileName := t.fileName, line := t.line, name := t.name, isInformalDef := false, isInformalLemma := false, isSemiFormalResult := true, category := PhyslibCategory.ofFileName t.fileName, tag := t.tag}
def
FullTODOInfo.ofSemiFormal
scripts.MetaPrograms
scripts/MetaPrograms/TODO_to_yml.lean
[ "Physlib.Meta.Basic", "Physlib.Meta.TODO.Basic", "Mathlib.Lean.CoreM", "Physlib.Meta.Informal.Post", "Physlib.Meta.Informal.SemiFormal", "Physlib.Meta.Linters.Sorry" ]
[ "FullTODOInfo", "PhyslibCategory.ofFileName", "WantedInfo" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
allSemiInformal : CoreM (Array FullTODOInfo)
do let env ← getEnv let semiInformalInfos := (wantedExtension.getState env) pure (semiInformalInfos.map FullTODOInfo.ofSemiFormal)
def
allSemiInformal
scripts.MetaPrograms
scripts/MetaPrograms/TODO_to_yml.lean
[ "Physlib.Meta.Basic", "Physlib.Meta.TODO.Basic", "Mathlib.Lean.CoreM", "Physlib.Meta.Informal.Post", "Physlib.Meta.Informal.SemiFormal", "Physlib.Meta.Linters.Sorry" ]
[ "FullTODOInfo", "FullTODOInfo.ofSemiFormal" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
SorryfulInfo.toFullTODOInfo (s : SorryfulInfo) : FullTODOInfo
where content := s.docstring fileName := s.fileName line := s.line name := s.name isInformalDef := false isInformalLemma := false isSemiFormalResult := false isSorryfulResult := true category := PhyslibCategory.ofFileName s.fileName tag := s.name.toString
def
SorryfulInfo.toFullTODOInfo
scripts.MetaPrograms
scripts/MetaPrograms/TODO_to_yml.lean
[ "Physlib.Meta.Basic", "Physlib.Meta.TODO.Basic", "Mathlib.Lean.CoreM", "Physlib.Meta.Informal.Post", "Physlib.Meta.Informal.SemiFormal", "Physlib.Meta.Linters.Sorry" ]
[ "FullTODOInfo", "PhyslibCategory.ofFileName", "SorryfulInfo" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
allSorryfulResults : CoreM (Array FullTODOInfo)
do let env ← getEnv let sorryfulInfos := (sorryfulExtension.getState env) pure (sorryfulInfos.map SorryfulInfo.toFullTODOInfo)
def
allSorryfulResults
scripts.MetaPrograms
scripts/MetaPrograms/TODO_to_yml.lean
[ "Physlib.Meta.Basic", "Physlib.Meta.TODO.Basic", "Mathlib.Lean.CoreM", "Physlib.Meta.Informal.Post", "Physlib.Meta.Informal.SemiFormal", "Physlib.Meta.Linters.Sorry" ]
[ "FullTODOInfo", "SorryfulInfo.toFullTODOInfo" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
allTODOs : MetaM (List FullTODOInfo)
do let todos ← getTodoInfo let informalTODOs ← allInformalTODO let semiInformal ← allSemiInformal let sorryfulResults ← allSorryfulResults let all := todos ++ informalTODOs ++ semiInformal ++ sorryfulResults return (all.qsort (fun x y => x.fileName.toString < y.fileName.toString ∨ (x.fileName.toString ...
def
allTODOs
scripts.MetaPrograms
scripts/MetaPrograms/TODO_to_yml.lean
[ "Physlib.Meta.Basic", "Physlib.Meta.TODO.Basic", "Mathlib.Lean.CoreM", "Physlib.Meta.Informal.Post", "Physlib.Meta.Informal.SemiFormal", "Physlib.Meta.Linters.Sorry" ]
[ "FullTODOInfo", "allInformalTODO", "allSemiInformal", "allSorryfulResults", "getTodoInfo" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
categoriesToYML : MetaM String
do let todos ← allTODOs let mut cat := "Category:\n" for c in PhyslibCategory.List do let num := (todos.filter (fun x => x.category == c)).length cat := cat ++ s!" - name: \"{c}\" num: {num} emoji: \"{c.emoji}\"" return cat ++ "\n"
def
categoriesToYML
scripts.MetaPrograms
scripts/MetaPrograms/TODO_to_yml.lean
[ "Physlib.Meta.Basic", "Physlib.Meta.TODO.Basic", "Mathlib.Lean.CoreM", "Physlib.Meta.Informal.Post", "Physlib.Meta.Informal.SemiFormal", "Physlib.Meta.Linters.Sorry" ]
[ "PhyslibCategory.List", "allTODOs" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
todosToYAML : MetaM String
do let todos ← allTODOs /- Check no duplicate tags-/ let tags := todos.map (fun x => x.tag) if !tags.Nodup then let duplicates := tags.filter (fun tag => tags.count tag > 1) |>.eraseDups println! duplicates panic! s!"Duplicate tags found: {duplicates}" /- End of check. -/ let todosYAML ← todos.m...
def
todosToYAML
scripts.MetaPrograms
scripts/MetaPrograms/TODO_to_yml.lean
[ "Physlib.Meta.Basic", "Physlib.Meta.TODO.Basic", "Mathlib.Lean.CoreM", "Physlib.Meta.Informal.Post", "Physlib.Meta.Informal.SemiFormal", "Physlib.Meta.Linters.Sorry" ]
[ "FullTODOInfo.toYAML", "allTODOs" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
fullTODOYML : MetaM String
do let cat ← categoriesToYML let todos ← todosToYAML return cat ++ todos
def
fullTODOYML
scripts.MetaPrograms
scripts/MetaPrograms/TODO_to_yml.lean
[ "Physlib.Meta.Basic", "Physlib.Meta.TODO.Basic", "Mathlib.Lean.CoreM", "Physlib.Meta.Informal.Post", "Physlib.Meta.Informal.SemiFormal", "Physlib.Meta.Linters.Sorry" ]
[ "categoriesToYML", "todosToYAML" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3
main (args : List String) : IO UInt32
do initSearchPath (← findSysroot) Lean.enableInitializersExecution println! "Generating TODO list." let env ← importModules (loadExts := true) #[`Physlib, `QuantumInfo] {} 0 let fileName := "" let options : Options := {} let ctx : Core.Context := {fileName, options, fileMap := default } let state := {en...
def
main
scripts.MetaPrograms
scripts/MetaPrograms/TODO_to_yml.lean
[ "Physlib.Meta.Basic", "Physlib.Meta.TODO.Basic", "Mathlib.Lean.CoreM", "Physlib.Meta.Informal.Post", "Physlib.Meta.Informal.SemiFormal", "Physlib.Meta.Linters.Sorry" ]
[ "fullTODOYML" ]
https://github.com/HEPLean/PhysLean
01143d7c9702318879b3c86bd9eadcdc60a13cc3