Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

LeanLink

Tutorials

  • Checking Mathlib with TypeTheory
  • Exploring Mathlib with LeanLink
  • An Import Graph for Mathlib
  • Getting Started with LeanLink

Guides

  • Lean 4 from the Wolfram Language

Symbols

  • ImportDOT
  • LeanApp
  • LeanBuild
  • LeanBVar
  • LeanCallGraph
  • LeanCompile
  • LeanConstantInfo
  • LeanConstant
  • LeanConst
  • LeanEnvironment
  • LeanEvaluate
  • LeanExport
  • LeanExportString
  • LeanExprGraph
  • LeanExpr
  • LeanForall
  • LeanFreeEnvironment
  • LeanFVar
  • LeanGoal
  • LeanImport
  • LeanImportString
  • LeanLam
  • LeanLet
  • LeanLevelIMax
  • LeanLevelMax
  • LeanLevelMVar
  • LeanLevelParam
  • LeanLevelSucc
  • LeanLevelZero
  • LeanListConstants
  • LeanListTheorems
  • LeanLitNat
  • LeanLitStr
  • LeanLoadEnvironment
  • LeanMVar
  • LeanNoValue
  • LeanProj
  • LeanSort
  • LeanState
  • LeanTactic
  • LeanTerm
  • LeanToFunction
  • LeanToTypeTheory
  • LeanTruncated
  • LeanValue
  • ProofToLean
  • TypeTheoryToLean
Wolfram`LeanLink`
LeanBuild
​
LeanBuild
[dir,{"Module1",...}]
builds those modules of the Lake project in dir and returns
Success
or a
Failure
carrying lake's output.
​
​
LeanBuild
[dir]
builds the project's default targets.
​
Details and Options
▪
LeanImport
loads a project's compiled
.olean
files, so the modules must be built first;
LeanBuild
does that from the Wolfram Language.
▪
The build uses the
lake
of the toolchain that the project's
lean-toolchain
file pins, called directly rather than through elan's proxy, so a build never downloads a toolchain. A pin that is not installed returns a
"ToolchainNotInstalled"
Failure
naming the
elantoolchaininstall
command.
▪
A failed build returns a
"LeanBuildFailed"
Failure
whose
"Output"
holds lake's messages and whose
"ExitCode"
is lake's exit code.
▪
A successful build drops LeanLink's cached environments for that project, so the next
LeanImport
loads the new
.olean
files.
▪
The project should pin the same Lean version as LeanLink's runtime (
leanprover/lean4:v4.35.0
); otherwise
LeanBuild
warns, since
LeanImport
cannot load the result.
​
Examples  
(2)
Basic Examples  
(1)
Build a module of a small Lake project, then import it:
In[1]:=
dir=CreateDirectory[];​​Export[FileNameJoin[{dir,"lakefile.toml"}],{"name = \"demo\"","[[lean_lib]]","name = \"Demo\""},"Lines"];​​Export[FileNameJoin[{dir,"lean-toolchain"}],"leanprover/lean4:v4.35.0","Text"];​​Export[FileNameJoin[{dir,"Demo.lean"}],"theorem two_eq : 1 + 1 = 2 := rfl","Text"];​​
LeanBuild
[dir,{"Demo"}]
Out[1]=
Success
✓
Message: Built Demo in /private/var/folders/5x/lyq7cw110cx_zr1zb3zr63gm0000gn/T/m000002853281
ProjectDir: /private/var/folders/5x/lyq7cw110cx_zr1zb3zr63gm0000gn/T/m000002853281

Import the module:
In[2]:=
demo=
LeanImport
["Demo","ProjectDir"dir,"Filter""two_eq"]
Out[2]=
LeanEnvironment
Constants: 34
Kinds: 34 theorem

Its theorem:
In[3]:=
demo["two_eq"]["TypeForm"]
Out[3]=
1 + 1 = 2
Possible Issues  
(1)

SeeAlso
LeanImport
 
▪
LeanEvaluate
 
▪
LeanImportString
RelatedGuides
▪
Lean 4 from the Wolfram Language
""

© 2026 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com