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`
LeanToFunction
​
LeanToFunction
[term]
converts a
LeanTerm
with compilable types into a
Function
whose arguments are
Typed
, suitable for
FunctionCompile
.
​
Details and Options
▪
LeanToFunction
is the lowering step that
LeanCompile
feeds to
FunctionCompile
: it produces the uncompiled
Function
so you can inspect or modify it before compiling.
▪
Each Lean argument type becomes a
Typed
slot with the corresponding Wolfram compiler type (
Nat
/
Int
to
"MachineInteger"
, and so on).
▪
Arithmetic, comparisons, Boolean connectives,
if
and
bif
,
max
and
min
become their Wolfram Language counterparts; a call to any other function stays in the body, as a symbol of its name or, for a name such as
"Nat.log2"
that is not a symbol name, as the
LeanConst
itself.
​
Examples  
(4)
Basic Examples  
(1)
A Lean definition, compiled from source:
In[1]:=
addEnv=
LeanImportString
["def myAdd (x y : Nat) : Nat := x + y"]
Out[1]=
LeanEnvironment
Constants: 1
Kinds: 1 def

Turn a Lean definition into a typed
Function
:
In[2]:=
LeanToFunction
[addEnv["myAdd"]]
Out[2]=
Function[{Typed[x61,MachineInteger],Typed[y62,MachineInteger]},x61+y62]
Scope  
(2)

Properties & Relations  
(1)

SeeAlso
LeanCompile
 
▪
LeanTerm
RelatedGuides
▪
Lean 4 from the Wolfram Language
""

© 2026 Wolfram. All rights reserved.

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