Proof Assistant Projects
Collection
Digesting proof assistant libraries for AI ingestion. • 103 items • Updated • 3
statement stringlengths 4 290 | proof stringlengths 0 3.01k | type stringclasses 6
values | symbolic_name stringlengths 4 44 | library stringclasses 4
values | filename stringclasses 18
values | imports listlengths 0 7 | deps listlengths 0 11 | docstring stringclasses 16
values | source_url stringclasses 1
value | commit stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|
SupportedOS where
| linux
| macos
| windows
deriving Inhabited, BEq | inductive | SupportedOS | Root | lakefile.lean | [
"Lake"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
getOS! : SupportedOS | if Platform.isWindows then
.windows
else if Platform.isOSX then
.macos
else
.linux | def | getOS! | Root | lakefile.lean | [
"Lake"
] | [
"SupportedOS"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
SupportedArch where
| x86_64
| arm64
deriving Inhabited, BEq | inductive | SupportedArch | Root | lakefile.lean | [
"Lake"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
nproc : IO Nat | do
let cmd := if getOS! == .windows then "cmd" else "nproc"
let args := if getOS! == .windows then #["/c echo %NUMBER_OF_PROCESSORS%"] else #[]
let out ← IO.Process.output {cmd := cmd, args := args, stdin := .null}
return out.stdout.trimAscii.toNat! | def | nproc | Root | lakefile.lean | [
"Lake"
] | [
"getOS!"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
getArch? : IO (Option SupportedArch) | do
let cmd := if getOS! == .windows then "cmd" else "uname"
let args := if getOS! == .windows then #["/c echo %PROCESSOR_ARCHITECTURE%\n"] else #["-m"]
let out ← IO.Process.output {cmd := cmd, args := args, stdin := .null}
let arch := out.stdout.trimAscii.toString
if arch ∈ ["arm64", "aarch64", "ARM64"] the... | def | getArch? | Root | lakefile.lean | [
"Lake"
] | [
"SupportedArch",
"getOS!"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
getArch! : IO SupportedArch | do
if let some arch ← getArch? then
return arch
else
error "Unknown architecture" | def | getArch! | Root | lakefile.lean | [
"Lake"
] | [
"SupportedArch",
"getArch?"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
isArm! : IO Bool | do
return (← getArch!) == .arm64 | def | isArm! | Root | lakefile.lean | [
"Lake"
] | [
"getArch!"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
hasCUDA : IO Bool | do
if getOS! == .windows then
let ok ← testProc {
cmd := "nvidia-smi"
args := #[]
}
return ok
else
let out ← IO.Process.output {cmd := "which", args := #["nvcc"], stdin := .null}
return out.exitCode == 0 | def | hasCUDA | Root | lakefile.lean | [
"Lake"
] | [
"getOS!"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
useCUDA : IO Bool | do
return (get_config? noCUDA |>.isNone) ∧ (← hasCUDA) | def | useCUDA | Root | lakefile.lean | [
"Lake"
] | [
"hasCUDA"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
buildArchiveName : String | let arch := if run_io isArm! then "arm64" else "x86_64"
let os := if getOS! == .macos then "macOS" else "linux"
if run_io useCUDA then
s!"{arch}-cuda-{os}.tar.gz"
else
s!"{arch}-{os}.tar.gz" | def | buildArchiveName | Root | lakefile.lean | [
"Lake"
] | [
"getOS!",
"isArm!",
"useCUDA"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
SupportedPlatform where
os : SupportedOS
arch : SupportedArch | structure | SupportedPlatform | Root | lakefile.lean | [
"Lake"
] | [
"SupportedArch",
"SupportedOS"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
getPlatform! : IO SupportedPlatform | do
if Platform.numBits != 64 then
error "Only 64-bit platforms are supported"
return ⟨getOS!, ← getArch!⟩ | def | getPlatform! | Root | lakefile.lean | [
"Lake"
] | [
"SupportedPlatform"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
copySingleFile (src dst : FilePath) : LogIO Unit | do
let cmd := if getOS! == .windows then "cmd" else "cp"
let args :=
if getOS! == .windows then
#[s!"/c copy {src.toString.replace "/" "\\"} {dst.toString.replace "/" "\\"}"]
else
#[src.toString, dst.toString]
proc {
cmd := cmd
args := args
} | def | copySingleFile | Root | lakefile.lean | [
"Lake"
] | [
"getOS!"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
copyFolder (src dst : FilePath) : LogIO Unit | do
let cmd := if getOS! == .windows then "robocopy" else "cp"
let args :=
if getOS! == .windows then
#[src.toString, dst.toString, "/E"]
else
#["-r", src.toString, dst.toString]
let _out ← rawProc {
cmd := cmd
args := args
} | def | copyFolder | Root | lakefile.lean | [
"Lake"
] | [
"getOS!"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
removeFolder (dir : FilePath) : LogIO Unit | do
let cmd := if getOS! == .windows then "cmd" else "rm"
let args :=
if getOS! == .windows then
#[s!"/c rmdir /s /q {dir.toString.replace "/" "\\"}"]
else
#["-rf", dir.toString]
proc {
cmd := cmd
args := args
} | def | removeFolder | Root | lakefile.lean | [
"Lake"
] | [
"getOS!"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
removeFile (src: FilePath) : LogIO Unit | do
proc {
cmd := if getOS! == .windows then "cmd" else "rm"
args := if getOS! == .windows then #[s!"/c del {src.toString.replace "/" "\\"}"] else #[src.toString]
}
package LeanCopilot where
preferReleaseBuild := get_config? noCloudRelease |>.isNone
buildArchive? := buildArchiveName
precompileModules ... | def | removeFile | Root | lakefile.lean | [
"Lake"
] | [
"buildArchiveName",
"getOS!"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
nameToVersionedSharedLib (name : String) (v : String) : String | if Platform.isWindows then s!"lib{name}.{v}.dll"
else if Platform.isOSX then s!"lib{name}.{v}.dylib"
else s!"lib{name}.so.{v}" | def | nameToVersionedSharedLib | Root | lakefile.lean | [
"Lake"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
afterReleaseSync {α : Type} (pkg : Package) (build : SpawnM (Job α)) : FetchM (Job α) | do
if pkg.preferReleaseBuild ∧ pkg.baseName ≠ (← getRootPackage).baseName then
(← pkg.optGitHubRelease.fetch).bindM fun _ => build
else
build | def | afterReleaseSync | Root | lakefile.lean | [
"Lake"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
afterReleaseAsync {α : Type} (pkg : Package) (build : JobM α) : FetchM (Job α) | do
if pkg.preferReleaseBuild ∧ pkg.baseName ≠ (← getRootPackage).baseName then
(← pkg.optGitHubRelease.fetch).mapM fun _ => build
else
Job.async build | def | afterReleaseAsync | Root | lakefile.lean | [
"Lake"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
ensureDirExists (dir : FilePath) : IO Unit | do
if !(← dir.pathExists) then
IO.FS.createDirAll dir | def | ensureDirExists | Root | lakefile.lean | [
"Lake"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
gitClone (url : String) (cwd : Option FilePath) : LogIO Unit | do
proc (quiet := true) {
cmd := "git"
args := if getOS! == .windows then #["clone", url] else #["clone", "--recursive", url]
cwd := cwd
} | def | gitClone | Root | lakefile.lean | [
"Lake"
] | [
"getOS!"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
runCmake (root : FilePath) (flags : Array String) : LogIO Unit | do
assert! (← root.pathExists) ∧ (← (root / "CMakeLists.txt").pathExists)
let buildDir := root / "build"
if ← buildDir.pathExists then
IO.FS.removeDirAll buildDir
IO.FS.createDirAll buildDir
let ok ← testProc {
cmd := "cmake"
args := flags ++ #[".."]
cwd := buildDir
}
if ¬ ok then
if f... | def | runCmake | Root | lakefile.lean | [
"Lake"
] | [
"afterReleaseAsync",
"copySingleFile",
"ensureDirExists",
"getOS!",
"gitClone",
"nameToVersionedSharedLib",
"nproc"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
getCt2CmakeFlags : IO (Array String) | do
let mut flags := #["-DOPENMP_RUNTIME=NONE", "-DWITH_MKL=OFF"]
match getOS! with
| .macos => flags := flags ++ #["-DWITH_ACCELERATE=ON", "-DWITH_OPENBLAS=OFF"]
| .linux => flags := flags ++ #["-DWITH_ACCELERATE=OFF", "-DWITH_OPENBLAS=ON", "-DOPENBLAS_INCLUDE_DIR=../../OpenBLAS", "-DOPENBLAS_LIBRARY=../../Ope... | def | getCt2CmakeFlags | Root | lakefile.lean | [
"Lake"
] | [
"afterReleaseAsync",
"copyFolder",
"copySingleFile",
"ensureDirExists",
"getOS!",
"gitClone",
"nameToVersionedSharedLib",
"nproc",
"removeFile",
"removeFolder",
"runCmake"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
buildCpp (pkg : Package) (path : FilePath) (dep : Job FilePath) : SpawnM (Job FilePath) | do
let optLevel := if pkg.buildType == .release then "-O3" else "-O0"
let flags := #["-fPIC", "-std=c++17", optLevel]
let mut args := flags ++ #[
"-I", (← getLeanIncludeDir).toString,
"-I", (pkg.buildDir / "include").toString,
]
if getOS! == .windows then
-- link the headers
args := args ++ #[... | def | buildCpp | Root | lakefile.lean | [
"Lake"
] | [
"afterReleaseSync",
"getOS!"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
suggestion (tac : String) (msgs : MessageLog := {}) : TacticM Suggestion | do
-- TODO `addExactSuggestion` has an option to construct `postInfo?`
-- Factor that out so we can use it here instead of copying and pasting?
let goals ← getGoals
let postInfo? ← if goals.isEmpty then pure none else
let mut str := "\nRemaining subgoals:"
for g in goals do
let goalType ← instanti... | def | suggestion | Root | LeanCopilot/Frontend.lean | [
"Lean",
"LeanCopilot.Options",
"Lean.Meta.Tactic.TryThis",
"Batteries.Data.MLList.Basic",
"Batteries.Control.Nondet.Basic"
] | [] | Construct a suggestion for a tactic.
* Check the passed `MessageLog` for an info message beginning with "Try this: ".
* If found, use that as the suggestion.
* Otherwise use the provided syntax.
* Also, look for remaining goals and pretty print them after the suggestion. | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 |
withMessageLog (t : TacticM Unit) : TacticM MessageLog | do
let initMsgs ← modifyGetThe Core.State fun st => (st.messages, { st with messages := {} })
t
modifyGetThe Core.State fun st => (st.messages, { st with messages := initMsgs }) | def | withMessageLog | Root | LeanCopilot/Frontend.lean | [
"Lean",
"LeanCopilot.Options",
"Lean.Meta.Tactic.TryThis",
"Batteries.Data.MLList.Basic",
"Batteries.Control.Nondet.Basic"
] | [] | Run a tactic, returning any new messages rather than adding them to the message log. | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 |
withoutInfoTrees (t : TacticM Unit) : TacticM Unit | do
let trees := (← getInfoState).trees
t
modifyInfoState fun s => { s with trees } | def | withoutInfoTrees | Root | LeanCopilot/Frontend.lean | [
"Lean",
"LeanCopilot.Options",
"Lean.Meta.Tactic.TryThis",
"Batteries.Data.MLList.Basic",
"Batteries.Control.Nondet.Basic"
] | [] | Run a tactic, but revert any changes to info trees.
We use this to inhibit the creation of widgets by subsidiary tactics. | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 |
hint (stx : Syntax) (tacStrs : Array String) (check : Bool) : TacticM Unit | do
if check then
let tacStxs ← tacStrs.filterMapM fun tstr : String => do match runParserCategory (← getEnv) `tactic tstr with
| Except.error _ => return none
| Except.ok stx => return some (tstr, stx)
let tacs := Nondet.ofList tacStxs.toList
let results := tacs.filterMapM fun t : (String × Sy... | def | hint | Root | LeanCopilot/Frontend.lean | [
"Lean",
"LeanCopilot.Options",
"Lean.Meta.Tactic.TryThis",
"Batteries.Data.MLList.Basic",
"Batteries.Control.Nondet.Basic"
] | [
"suggestion",
"withMessageLog",
"withoutInfoTrees"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
tacGen : Aesop.TacGen | fun (mvarId : MVarId) => do
let state ← ppTacticState [mvarId]
let nm ← SuggestTactics.getGeneratorName
let model ← getGenerator nm
let suggestions ← generate model state ""
-- A temporary workaround to prevent the tactic from using the current theorem.
-- TODO: Use a more principled way, e.g., see `Lean4Re... | def | LeanCopilot.tacGen | Root | LeanCopilot/LlmAesop.lean | [
"LeanCopilot.Tactics",
"LeanCopilot.Options",
"Batteries.Data.String.Basic",
"Aesop"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
"#configure_llm_aesop" : command => `(@[aesop 100%] def tacGen := LeanCopilot.tacGen) | macro | #configure_llm_aesop | Root | LeanCopilot/LlmAesop.lean | [
"LeanCopilot.Tactics",
"LeanCopilot.Options",
"Batteries.Data.String.Basic",
"Aesop"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
"search_proof" : tactic => `(tactic| aesop? (add 100% tacGen)) | macro | search_proof | Root | LeanCopilot/LlmAesop.lean | [
"LeanCopilot.Tactics",
"LeanCopilot.Options",
"Batteries.Data.String.Basic",
"Aesop"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
isVerbose : m Bool | do
match LeanCopilot.verbose.get? (← getOptions) with
| some true => return true
| _ => return false | def | LeanCopilot.isVerbose | Root | LeanCopilot/Options.lean | [
"Lean",
"LeanCopilot.Models"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
checkTactics : CoreM Bool | do
match LeanCopilot.suggest_tactics.check.get? (← getOptions) with
| some false => return false
| _ => return true | def | LeanCopilot.SuggestTactics.checkTactics | Root | LeanCopilot/Options.lean | [
"Lean",
"LeanCopilot.Models"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
getGeneratorName : m String | do
match LeanCopilot.suggest_tactics.model.get? (← getOptions) with
| some n => return n
| _ => return Builtin.generator.name | def | LeanCopilot.SuggestTactics.getGeneratorName | Root | LeanCopilot/Options.lean | [
"Lean",
"LeanCopilot.Models"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
getNumPremises : m Nat | do
match LeanCopilot.select_premises.k.get? (← getOptions) with
| some k => return k
| _ => return 16 | def | LeanCopilot.SelectPremises.getNumPremises | Root | LeanCopilot/Options.lean | [
"Lean",
"LeanCopilot.Models"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
ppTacticState : List MVarId → MetaM String | | [] => return "no goals"
| [g] => return (← Meta.ppGoal g).pretty
| goals =>
return (← goals.foldlM (init := "") (fun a b => do return s!"{a}\n\n{(← Meta.ppGoal b).pretty}")).trimAscii.toString | def | LeanCopilot.ppTacticState | Root | LeanCopilot/Tactics.lean | [
"Lean",
"LeanCopilot.Options",
"LeanCopilot.Frontend",
"Aesop.Util.Basic",
"Batteries.Data.String.Basic",
"Batteries.Data.String.Matcher"
] | [] | Pretty-print a list of goals. | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 |
getPpTacticState : TacticM String | do
let goals ← getUnsolvedGoals
ppTacticState goals | def | LeanCopilot.getPpTacticState | Root | LeanCopilot/Tactics.lean | [
"Lean",
"LeanCopilot.Options",
"LeanCopilot.Frontend",
"Aesop.Util.Basic",
"Batteries.Data.String.Basic",
"Batteries.Data.String.Matcher"
] | [] | Pretty-print the current tactic state. | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 |
suggestTactics (targetPrefix : String) : TacticM (Array (String × Float)) | do
let state ← getPpTacticState
let nm ← getGeneratorName
let model ← getGenerator nm
let suggestions ← generate model state targetPrefix
-- A temporary workaround to prevent the tactic from using the current theorem.
-- TODO: Use a more principled way, e.g., see `Lean4Repl.lean` in `LeanDojo`.
if let som... | def | LeanCopilot.suggestTactics | Root | LeanCopilot/Tactics.lean | [
"Lean",
"LeanCopilot.Options",
"LeanCopilot.Frontend",
"Aesop.Util.Basic",
"Batteries.Data.String.Basic",
"Batteries.Data.String.Matcher"
] | [] | Generate a list of tactic suggestions. | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 |
PremiseInfo where
name : String
path : String
code : String
score : Float | structure | LeanCopilot.PremiseInfo | Root | LeanCopilot/Tactics.lean | [
"Lean",
"LeanCopilot.Options",
"LeanCopilot.Frontend",
"Aesop.Util.Basic",
"Batteries.Data.String.Basic",
"Batteries.Data.String.Matcher"
] | [] | Information of a premise. | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
annotatePremise (pi : PremiseInfo) : MetaM String | do
let declName := pi.name.toName
try
let info ← getConstInfo declName
let premise_type ← Meta.ppExpr info.type
let some doc_str ← findDocString? (← getEnv) declName
| return s!"{pi.name} : {premise_type}\n"
return s!"{pi.name} : {premise_type}\n```doc\n{doc_str}\n```\n"
catch _ => return s!... | def | LeanCopilot.annotatePremise | Root | LeanCopilot/Tactics.lean | [
"Lean",
"LeanCopilot.Options",
"LeanCopilot.Frontend",
"Aesop.Util.Basic",
"Batteries.Data.String.Basic",
"Batteries.Data.String.Matcher"
] | [] | Annotate a premise with its type, doc string, import module path, and definition code. | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 |
retrieve (input : String) : TacticM (Array PremiseInfo) | do
if ¬ (← premiseEmbeddingsInitialized) ∧ ¬ (← initPremiseEmbeddings .auto) then
throwError "Cannot initialize premise embeddings"
if ¬ (← premiseDictionaryInitialized) ∧ ¬ (← initPremiseDictionary) then
throwError "Cannot initialize premise dictionary"
let k ← SelectPremises.getNumPremises
let query... | def | LeanCopilot.retrieve | Root | LeanCopilot/Tactics.lean | [
"Lean",
"LeanCopilot.Options",
"LeanCopilot.Frontend",
"Aesop.Util.Basic",
"Batteries.Data.String.Basic",
"Batteries.Data.String.Matcher"
] | [] | Retrieve a list of premises given a query. | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 |
selectPremises : TacticM (Array PremiseInfo) | do
retrieve (← getPpTacticState) | def | LeanCopilot.selectPremises | Root | LeanCopilot/Tactics.lean | [
"Lean",
"LeanCopilot.Options",
"LeanCopilot.Frontend",
"Aesop.Util.Basic",
"Batteries.Data.String.Basic",
"Batteries.Data.String.Matcher"
] | [] | Retrieve a list of premises using the current pretty-printed tactic state as the query. | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 |
generator : NativeGenerator | {
url := Url.parse! "https://huggingface.co/kaiyuy/ct2-leandojo-lean4-tacgen-byt5-small"
tokenizer := ByT5.tokenizer
params := {
numReturnSequences := 32
}
} | def | LeanCopilot.Builtin.generator | Models | LeanCopilot/Models/Builtin.lean | [
"ModelCheckpointManager",
"LeanCopilot.Models.ByT5"
] | [
"params"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
encoder : NativeEncoder | {
url := Url.parse! "https://huggingface.co/kaiyuy/ct2-leandojo-lean4-retriever-byt5-small"
tokenizer := ByT5.tokenizer
} | def | LeanCopilot.Builtin.encoder | Models | LeanCopilot/Models/Builtin.lean | [
"ModelCheckpointManager",
"LeanCopilot.Models.ByT5"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
premisesUrl | Url.parse! "https://huggingface.co/kaiyuy/premise-embeddings-leandojo-lean4-retriever-byt5-small" | def | LeanCopilot.Builtin.premisesUrl | Models | LeanCopilot/Models/Builtin.lean | [
"ModelCheckpointManager",
"LeanCopilot.Models.ByT5"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
vocab : Array String | #[
"\u0000",
"\u0001",
"\u0002",
"\u0003",
"\u0004",
"\u0005",
"\u0006",
"\u0007",
"\\b",
"\t",
"\n",
"\u000b",
"\\f",
"\r",
"\u000e",
"\u000f",
"\u0010",
"\u0011",
"\u0012",
"\u0013",
"\u0014",
"\u0015",
"\u0016",
"\u0017",
"\u0018",
"\u0019",
"\u001a",
"\u001b",... | def | LeanCopilot.ByT5.vocab | Models | LeanCopilot/Models/ByT5.lean | [
"LeanCopilot.Models.Native"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
byteToToken (b : UInt8) : String | vocab[b.toNat]! | def | LeanCopilot.ByT5.byteToToken | Models | LeanCopilot/Models/ByT5.lean | [
"LeanCopilot.Models.Native"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
tokenToByte! (t : String) : UInt8 | vocab.findIdx? (· = t) |>.get! |>.toUInt8 | def | LeanCopilot.ByT5.tokenToByte! | Models | LeanCopilot/Models/ByT5.lean | [
"LeanCopilot.Models.Native"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
tokenize (text : String) : Array String | (byteToToken <$> text.toUTF8.toList).toArray | def | LeanCopilot.ByT5.tokenize | Models | LeanCopilot/Models/ByT5.lean | [
"LeanCopilot.Models.Native"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
detokenize (tokens : Array String) : String | match (String.fromUTF8? ⟨tokens.map tokenToByte!⟩) with
| some s => s
| none => "" | def | LeanCopilot.ByT5.detokenize | Models | LeanCopilot/Models/ByT5.lean | [
"LeanCopilot.Models.Native"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
eosToken | "</s>" | def | LeanCopilot.ByT5.eosToken | Models | LeanCopilot/Models/ByT5.lean | [
"LeanCopilot.Models.Native"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
tokenizer : Tokenizer | {
tokenize := tokenize,
detokenize := detokenize,
eosToken := eosToken
} | def | LeanCopilot.ByT5.tokenizer | Models | LeanCopilot/Models/ByT5.lean | [
"LeanCopilot.Models.Native"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
ExternalModel where
name : String
host : String | "localhost"
port : UInt16 := 23337
deriving Inhabited, Repr | structure | LeanCopilot.ExternalModel | Models | LeanCopilot/Models/External.lean | [
"Lean",
"LeanCopilot.Models.Interface"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
ExternalGenerator extends ExternalModel
deriving Repr | structure | LeanCopilot.ExternalGenerator | Models | LeanCopilot/Models/External.lean | [
"Lean",
"LeanCopilot.Models.Interface"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
GeneratorRequest where
name : String
input : String
«prefix» : String
deriving ToJson | structure | LeanCopilot.GeneratorRequest | Models | LeanCopilot/Models/External.lean | [
"Lean",
"LeanCopilot.Models.Interface"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
Generation where
output: String
score: Float
deriving FromJson | structure | LeanCopilot.Generation | Models | LeanCopilot/Models/External.lean | [
"Lean",
"LeanCopilot.Models.Interface"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
GeneratorResponse where
outputs : Array Generation
deriving FromJson | structure | LeanCopilot.GeneratorResponse | Models | LeanCopilot/Models/External.lean | [
"Lean",
"LeanCopilot.Models.Interface"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
EnencoderRequest where
name : String
input : String
deriving ToJson | structure | LeanCopilot.EnencoderRequest | Models | LeanCopilot/Models/External.lean | [
"Lean",
"LeanCopilot.Models.Interface"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
EncoderResponse where
outputs : Array Float
deriving FromJson | structure | LeanCopilot.EncoderResponse | Models | LeanCopilot/Models/External.lean | [
"Lean",
"LeanCopilot.Models.Interface"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
send {α β : Type} [ToJson α] [FromJson β] (req : α) (url : String) : IO β | do
let reqStr := (toJson req).pretty 99999999999999999
let out ← IO.Process.output {
cmd := "curl"
args := #["-X", "POST", url, "-H", "accept: application/json", "-H", "Content-Type: application/json", "-d", reqStr]
}
if out.exitCode != 0 then
throw $ IO.userError s!"Request failed. Please check if... | def | LeanCopilot.send | Models | LeanCopilot/Models/External.lean | [
"Lean",
"LeanCopilot.Models.Interface"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
ExternalGenerator.generate (model : ExternalGenerator) (input : String) (targetPrefix : String) : IO $ Array (String × Float) | do
let url := s!"http://{model.host}:{model.port}/generate"
let req : GeneratorRequest := {
name := model.name,
input := input,
«prefix» := targetPrefix
}
let res : GeneratorResponse ← send req url
return res.outputs.map fun g => (g.output, g.score) | def | LeanCopilot.ExternalGenerator.generate | Models | LeanCopilot/Models/External.lean | [
"Lean",
"LeanCopilot.Models.Interface"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
ExternalEncoder extends ExternalModel
deriving Repr | structure | LeanCopilot.ExternalEncoder | Models | LeanCopilot/Models/External.lean | [
"Lean",
"LeanCopilot.Models.Interface"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
ExternalEncoder.encode (model : ExternalEncoder) (input : String) : IO FloatArray | do
let url := s!"http://{model.host}:{model.port}/encode"
let req : EnencoderRequest := {
name := model.name,
input := input,
}
let res : EncoderResponse ← send req url
return FloatArray.mk res.outputs | def | LeanCopilot.ExternalEncoder.encode | Models | LeanCopilot/Models/External.lean | [
"Lean",
"LeanCopilot.Models.Interface"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
isGeneratorInitialized : (name : @& String) → Bool | opaque | LeanCopilot.FFI.isGeneratorInitialized | Models | LeanCopilot/Models/FFI.lean | [
"Lean",
"LeanCopilot.Models.Interface",
"LeanCopilot.Models.Native",
"LeanCopilot.Models.Builtin"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
isEncoderInitialized : (name : @& String) → Bool | opaque | LeanCopilot.FFI.isEncoderInitialized | Models | LeanCopilot/Models/FFI.lean | [
"Lean",
"LeanCopilot.Models.Interface",
"LeanCopilot.Models.Native",
"LeanCopilot.Models.Builtin"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
initGenerator (name : @& String) (modelPath : @& String) (computeType : @& String) (device : @& String) (deviceIndex : @& Array UInt64) : Bool | opaque | LeanCopilot.FFI.initGenerator | Models | LeanCopilot/Models/FFI.lean | [
"Lean",
"LeanCopilot.Models.Interface",
"LeanCopilot.Models.Native",
"LeanCopilot.Models.Builtin"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
initEncoder (name : @& String) (modelPath : @& String) (computeType : @& String) (device : @& String) (deviceIndex : @& Array UInt64) : Bool | opaque | LeanCopilot.FFI.initEncoder | Models | LeanCopilot/Models/FFI.lean | [
"Lean",
"LeanCopilot.Models.Interface",
"LeanCopilot.Models.Native",
"LeanCopilot.Models.Builtin"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
generate (name : @& String) (inputTokens : @& Array String) (targetPrefixTokens : @& Array String) (numReturnSequences : UInt64) (beamSize : UInt64)
(minLength : UInt64) (maxLength : UInt64) (lengthPenalty : Float) (patience : Float) (temperature : Float)
: Array (Array String × Float) | opaque | LeanCopilot.FFI.generate | Models | LeanCopilot/Models/FFI.lean | [
"Lean",
"LeanCopilot.Models.Interface",
"LeanCopilot.Models.Native",
"LeanCopilot.Models.Builtin"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
encode (name : @& String) (inputTokens : @& Array String) : FloatArray | opaque | LeanCopilot.FFI.encode | Models | LeanCopilot/Models/FFI.lean | [
"Lean",
"LeanCopilot.Models.Interface",
"LeanCopilot.Models.Native",
"LeanCopilot.Models.Builtin"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
initPremiseEmbeddings (path : @& String) (device : @& String) : Bool | opaque | LeanCopilot.FFI.initPremiseEmbeddings | Models | LeanCopilot/Models/FFI.lean | [
"Lean",
"LeanCopilot.Models.Interface",
"LeanCopilot.Models.Native",
"LeanCopilot.Models.Builtin"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
premiseEmbeddingsInitialized : Unit → Bool | opaque | LeanCopilot.FFI.premiseEmbeddingsInitialized | Models | LeanCopilot/Models/FFI.lean | [
"Lean",
"LeanCopilot.Models.Interface",
"LeanCopilot.Models.Native",
"LeanCopilot.Models.Builtin"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
initPremiseDictionary (path : @& String) : Bool | opaque | LeanCopilot.FFI.initPremiseDictionary | Models | LeanCopilot/Models/FFI.lean | [
"Lean",
"LeanCopilot.Models.Interface",
"LeanCopilot.Models.Native",
"LeanCopilot.Models.Builtin"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
premiseDictionaryInitialized : Unit → Bool | opaque | LeanCopilot.FFI.premiseDictionaryInitialized | Models | LeanCopilot/Models/FFI.lean | [
"Lean",
"LeanCopilot.Models.Interface",
"LeanCopilot.Models.Native",
"LeanCopilot.Models.Builtin"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
retrieve (queryEmb : @& FloatArray) (k : UInt64) : Array (String × String × String × Float) | opaque | LeanCopilot.FFI.retrieve | Models | LeanCopilot/Models/FFI.lean | [
"Lean",
"LeanCopilot.Models.Interface",
"LeanCopilot.Models.Native",
"LeanCopilot.Models.Builtin"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
cudaAvailable : Unit → Bool | opaque | LeanCopilot.FFI.cudaAvailable | Models | LeanCopilot/Models/FFI.lean | [
"Lean",
"LeanCopilot.Models.Interface",
"LeanCopilot.Models.Native",
"LeanCopilot.Models.Builtin"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
cudaAvailable : Bool | FFI.cudaAvailable () | def | LeanCopilot.cudaAvailable | Models | LeanCopilot/Models/FFI.lean | [
"Lean",
"LeanCopilot.Models.Interface",
"LeanCopilot.Models.Native",
"LeanCopilot.Models.Builtin"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
generate (model : NativeGenerator) (input : String) (targetPrefix : String) : IO $ Array (String × Float) | do
if ¬ FFI.isGeneratorInitialized model.name then
let path ← model.path
if ¬ (← path.pathExists) then
throw $ IO.userError s!"Cannot find the model {model.name}. Please run `lake exe download {model.url}`."
let device := model.device.toString
let computeType := model.computeType.toString
if... | def | LeanCopilot.NativeGenerator.generate | Models | LeanCopilot/Models/FFI.lean | [
"Lean",
"LeanCopilot.Models.Interface",
"LeanCopilot.Models.Native",
"LeanCopilot.Models.Builtin"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
encode (model : NativeEncoder) (input : String) : IO FloatArray | do
if ¬ FFI.isEncoderInitialized model.name then
let path ← model.path
if ¬ (← path.pathExists) then
throw $ IO.userError s!"Cannot find the model {model.name}. Please run `lake exe download {model.url}`."
let device := model.device.toString
let computeType := model.computeType.toString
if ¬... | def | LeanCopilot.NativeEncoder.encode | Models | LeanCopilot/Models/FFI.lean | [
"Lean",
"LeanCopilot.Models.Interface",
"LeanCopilot.Models.Native",
"LeanCopilot.Models.Builtin"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
premiseEmbeddingsInitialized : IO Bool | do
return FFI.premiseEmbeddingsInitialized () | def | LeanCopilot.premiseEmbeddingsInitialized | Models | LeanCopilot/Models/FFI.lean | [
"Lean",
"LeanCopilot.Models.Interface",
"LeanCopilot.Models.Native",
"LeanCopilot.Models.Builtin"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
initPremiseEmbeddings (device : Device) : Lean.CoreM Bool | do
let url := Builtin.premisesUrl
if ¬(← isUpToDate url) then
Lean.logWarning s!"The local premise embeddings are not up to date. You may want to run `lake exe LeanCopilot/download` to re-download it."
let path := (← getModelDir url) / "embeddings.npy"
if ¬ (← path.pathExists) then
throwError s!"Please ... | def | LeanCopilot.initPremiseEmbeddings | Models | LeanCopilot/Models/FFI.lean | [
"Lean",
"LeanCopilot.Models.Interface",
"LeanCopilot.Models.Native",
"LeanCopilot.Models.Builtin"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
premiseDictionaryInitialized : IO Bool | do
return FFI.premiseDictionaryInitialized () | def | LeanCopilot.premiseDictionaryInitialized | Models | LeanCopilot/Models/FFI.lean | [
"Lean",
"LeanCopilot.Models.Interface",
"LeanCopilot.Models.Native",
"LeanCopilot.Models.Builtin"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
initPremiseDictionary : IO Bool | do
let path := (← getModelDir Builtin.premisesUrl) / "dictionary.json"
if ¬ (← path.pathExists) then
throw $ IO.userError s!"Please run `lake exe download {Builtin.premisesUrl}` to download the premise dictionary."
return false
return FFI.initPremiseDictionary path.toString | def | LeanCopilot.initPremiseDictionary | Models | LeanCopilot/Models/FFI.lean | [
"Lean",
"LeanCopilot.Models.Interface",
"LeanCopilot.Models.Native",
"LeanCopilot.Models.Builtin"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
GenericGenerator where
generate : String → String → IO (Array (String × Float)) | structure | LeanCopilot.GenericGenerator | Models | LeanCopilot/Models/Generic.lean | [
"LeanCopilot.Models.Interface"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
GenericEncoder where
encode : String → IO FloatArray | structure | LeanCopilot.GenericEncoder | Models | LeanCopilot/Models/Generic.lean | [
"LeanCopilot.Models.Interface"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
TextToText (τ : Type) where
generate (model : τ) (input : String) (targetPrefix : String) : IO $ Array (String × Float) | class | LeanCopilot.TextToText | Models | LeanCopilot/Models/Interface.lean | [] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
TextToVec (τ : Type) where
encode : τ → String → IO FloatArray | class | LeanCopilot.TextToVec | Models | LeanCopilot/Models/Interface.lean | [] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
generate {τ : Type} [TextToText τ] (model : τ) (input : String) (targetPrefix : String := "") : IO $ Array (String × Float) | TextToText.generate model input targetPrefix | def | LeanCopilot.generate | Models | LeanCopilot/Models/Interface.lean | [] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
encode {τ : Type} [TextToVec τ] (model : τ) (input : String) : IO FloatArray | TextToVec.encode model input | def | LeanCopilot.encode | Models | LeanCopilot/Models/Interface.lean | [] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
Device where
| cpu
| cuda
| auto
deriving Repr | inductive | LeanCopilot.Device | Models | LeanCopilot/Models/Native.lean | [
"ModelCheckpointManager"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
Device.toString : Device → String | | Device.cpu => "cpu"
| Device.cuda => "cuda"
| Device.auto => "auto" | def | LeanCopilot.Device.toString | Models | LeanCopilot/Models/Native.lean | [
"ModelCheckpointManager"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
ComputeType where
| default
| auto
| int8
| int8_float32
| int8_float16
| int8_bfloat16
| int16
| float16
| bfloat16
| float32
deriving Repr | inductive | LeanCopilot.ComputeType | Models | LeanCopilot/Models/Native.lean | [
"ModelCheckpointManager"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
ComputeType.toString : ComputeType → String | | ComputeType.default => "default"
| ComputeType.auto => "auto"
| ComputeType.int8 => "int8"
| ComputeType.int8_float32 => "int8_float32"
| ComputeType.int8_float16 => "int8_float16"
| ComputeType.int8_bfloat16 => "int8_bfloat16"
| ComputeType.int16 => "int16"
| ComputeType.float16 => "float16"
| Comput... | def | LeanCopilot.ComputeType.toString | Models | LeanCopilot/Models/Native.lean | [
"ModelCheckpointManager"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
Tokenizer where
tokenize : String → Array String
detokenize : Array String → String
eosToken : String | structure | LeanCopilot.Tokenizer | Models | LeanCopilot/Models/Native.lean | [
"ModelCheckpointManager"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
NativeModel where
url : Url
device : Device | .auto
deviceIndex : Array UInt64 := #[0]
computeType : ComputeType := .default
tokenizer : Tokenizer | structure | LeanCopilot.NativeModel | Models | LeanCopilot/Models/Native.lean | [
"ModelCheckpointManager"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
NativeModel.name (model : NativeModel) : String | model.url.name! | def | LeanCopilot.NativeModel.name | Models | LeanCopilot/Models/Native.lean | [
"ModelCheckpointManager"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
NativeModel.path (model : NativeModel) : IO FilePath | getModelDir model.url | def | LeanCopilot.NativeModel.path | Models | LeanCopilot/Models/Native.lean | [
"ModelCheckpointManager"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
BeamSearchParams where
numReturnSequences : UInt64
beamSize : UInt64 | numReturnSequences
minLength : UInt64 := 1
maxLength : UInt64 := 1024
lengthPenalty : Float := 0.0
patience : Float := 2.0
temperature : Float := 1.0
deriving Repr | structure | LeanCopilot.BeamSearchParams | Models | LeanCopilot/Models/Native.lean | [
"ModelCheckpointManager"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | |
NativeGenerator extends NativeModel where
params : BeamSearchParams | structure | LeanCopilot.NativeGenerator | Models | LeanCopilot/Models/Native.lean | [
"ModelCheckpointManager"
] | [
"params"
] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
NativeEncoder extends NativeModel | structure | LeanCopilot.NativeEncoder | Models | LeanCopilot/Models/Native.lean | [
"ModelCheckpointManager"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 | ||
Generator where
| native : NativeGenerator → Generator
| external : ExternalGenerator → Generator
| generic : GenericGenerator → Generator | inductive | LeanCopilot.Generator | Models | LeanCopilot/Models/Registry.lean | [
"Lean",
"Batteries.Data.HashMap",
"LeanCopilot.Models.Native",
"LeanCopilot.Models.External",
"LeanCopilot.Models.Generic",
"LeanCopilot.Models.Builtin",
"LeanCopilot.Models.FFI"
] | [] | https://github.com/lean-dojo/LeanCopilot | 4ad50a8d816799241c93f6f46f6926ef16189e39 |
Structured dataset from LeanCopilot — LLM-based proof automation.
4ad50a8d816799241c93f6f46f6926ef16189e39| Column | Type | Description |
|---|---|---|
| statement | string | Declaration signature/claim with the leading keyword removed (verbatim slice); the full declaration minus its proof |
| proof | string | Verbatim proof/body, empty if the declaration has none |
| type | string | Declaration keyword |
| symbolic_name | string | Declaration identifier |
| library | string | Sub-library |
| filename | string | Repository-relative source path |
| imports | list[string] | File-level Require/Import modules |
| deps | list[string] | Intra-corpus identifiers referenced |
| docstring | string | Preceding documentation comment, empty if absent |
| source_url | string | Upstream repository |
| commit | string | Upstream commit extracted |
| Type | Count |
|---|---|
| def | 95 |
| structure | 19 |
| opaque | 12 |
| inductive | 6 |
| macro | 2 |
| class | 2 |
getOS! : SupportedOS
if Platform.isWindows then
.windows
else if Platform.isOSX then
.macos
else
.linux
getOS! | lakefile.leanEach declaration is split into a statement (signature/claim) and a proof (body) that are disjoint
and together form the complete declaration, for proof modeling, autoformalization, retrieval, and
dependency analysis via deps.
@misc{lean4_leancopilot_dataset,
title = {Lean4-LeanCopilot},
author = {Norton, Charles},
year = {2026},
note = {Extracted from https://github.com/lean-dojo/LeanCopilot, commit 4ad50a8d8167},
url = {https://huggingface.co/datasets/phanerozoic/Lean4-LeanCopilot}
}