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`
LeanExpr
​
LeanExpr
[name]
returns the type of the Lean constant name as a symbolic expression tree.
​
Details and Options
▪
The result is a tree of CIC heads (
LeanForall
,
LeanApp
,
LeanConst
,
LeanSort
,
LeanBVar
, …) which render in Lean notation.
▪
Options:
"ProjectDir"
(the lake project),
"Imports"
(modules to load), and
"Depth"
(the expression-tree depth before a subtree becomes
LeanTruncated
, default
100
).
▪
LeanExpr
queries a single constant; to load many at once into a
LeanEnvironment
use
LeanImport
, after which
env["name"]["Type"]
gives the same tree.
​
Examples  
(2)
Basic Examples  
(1)
Examples Initialization
The type of a Mathlib theorem as an expression tree (gated on a built checkout):
In[1]:=
mathlibDir=FileNameJoin[{$HomeDirectory,"src","mathlib4"}];​​IfDirectoryQ[FileNameJoin[{mathlibDir,".lake","build"}]],​​
LeanExpr
["And.comm",​​"Imports"{"Mathlib.Logic.Basic"},"ProjectDir"mathlibDir],​​"Mathlib not built"​​
Out[1]=
{a:Prop}{b:Prop}
Iff
And
#1
#0
And
#0
#1
Properties & Relations  
(1)

SeeAlso
LeanValue
 
▪
LeanConstantInfo
 
▪
LeanTerm
 
▪
LeanImport
RelatedGuides
▪
LeanLink
""

© 2026 Wolfram. All rights reserved.

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