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

Guides

  • Lean 4 from the Wolfram Language

Tech Notes

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

Symbols

  • ImportDOT
  • LeanApp
  • LeanBVar
  • LeanCallGraph
  • LeanCompile
  • LeanCompileTyped
  • LeanConstantInfo
  • LeanConstant
  • LeanConst
  • LeanEnvironment
  • LeanExport
  • LeanExportString
  • LeanExprGraph
  • LeanExpr
  • LeanExprToType
  • 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
  • LeanTruncated
  • LeanValue
  • ProofToLean
Wolfram`LeanLink`
LeanImport
​
LeanImport
[module]
imports the constants of a compiled Lean module and returns a
LeanEnvironment
.
​
​
LeanImport
[file]
imports from a
.lean
source file path.
​
Details and Options
▪
The result is a
LeanEnvironment
- a typed wrapper over
Association
[nameLeanTerm,...]
. Index it by constant name, or query it with
Keys
,
Length
, and
Information
.
▪
A module argument (
"Mathlib.Algebra.Group.Basic"
) is resolved inside a Lean project; a file argument is a path to a
.lean
source file (such as the bundled
Examples.lean
).
▪
The following options are accepted:
Option
Default
Description
"ProjectDir"
Automatic
the lake project the module is resolved in
"Imports"
{}
extra modules to load alongside the target
"Filter"
""
keep only constants whose name contains this substring
"IncludeInternal"
False
include compiler-internal / private declarations
▪
Importing a module requires that project to be built (
lakebuild
). An unbuilt or missing module yields an empty environment, not an error.
​
Examples  
(3)
Basic Examples  
(1)
Examples Initialization
Import the bundled example environment from its file path:
In[1]:=
env=
LeanImport
[PacletObject["Wolfram/LeanLink"]["AssetLocation","Examples"]]
Out[1]=
LeanEnvironment
Constants: 25
Kinds: 18 theorem6 def1 inductive

How many constants it holds:
In[2]:=
Length[env]
Out[2]=
25
The constant names:
In[3]:=
Keys[env]
Out[3]=
{id_proof,add_zero_term,bor_false,eq_transport,Vec.map,sigma_example,even_two,exists_succ,Vec,band_true,comp_proof,reverse_reverse,zero_add_proof,Vec.head,fin_example,add_comm_proof,contrapositive,add_succ_term,bnot_bnot,Vec.tail,and_comm_proof,add_assoc_proof,modus_ponens,nat_eq_decide,or_comm_proof}
A single constant, indexed by name, is a
LeanTerm
:
In[4]:=
env["id_proof"]["TypeForm"]
Out[4]=
∀ (P : Prop) (a : P), P
Scope  
(1)

Possible Issues  
(1)

SeeAlso
LeanImportString
 
▪
LeanEnvironment
 
▪
LeanTerm
 
▪
LeanListConstants
 
▪
LeanExport
RelatedGuides
▪
LeanLink
""

© 2026 Wolfram. All rights reserved.

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