Basic Examples (4)
Basic Examples
(4)
Load the bundled example environment:
In[1]:=
env=[PacletObject["Wolfram/LeanLink"]["AssetLocation","Examples"]]
Out[1]=
LeanEnvironment
_________________________________________________________________________________________________________________
How many constants, and of what kinds:
In[1]:=
env=[PacletObject["Wolfram/LeanLink"]["AssetLocation","Examples"]];Length[env]
Out[1]=
32
In[2]:=
Information[env,"Kinds"]
Out[2]=
theorem18,def11,constructor2,inductive1
_________________________________________________________________________________________________________________
A single constant is a summary box:
In[1]:=
env=[PacletObject["Wolfram/LeanLink"]["AssetLocation","Examples"]];env["id_proof"]
Out[1]=
LeanTerm
Its type, pretty-printed as Lean source - the proposition it proves:
In[2]:=
env["id_proof"]["TypeForm"]
Out[2]=
∀ (P : Prop), P → P
And the proof term:
In[3]:=
env["id_proof"]["TermForm"]
Out[3]=
fun x hp => hp
_________________________________________________________________________________________________________________
Every expression is a tree; draws it:
"ExprGraph"
In[1]:=
env=[PacletObject["Wolfram/LeanLink"]["AssetLocation","Examples"]];env["id_proof"]["ExprGraph"]
Out[1]=
"CallGraph"
In[2]:=
env["or_comm_proof"]["CallGraph"]
Out[2]=
Scope (2)
Scope
(2)
Applications (3)
Applications
(3)
Properties and Relations (1)
Properties and Relations
(1)
Possible Issues
Possible Issues
◼
The native bridge needs the platform shim under and the Lean toolchain it was built against () installed via elan: the ~190 MB Lean runtime is not bundled, so on first use LeanLink links from that toolchain next to the shim. Install it with . Mathlib import and the out-of-process graph functions (, ) additionally need on and a built project - of an unbuilt module returns an empty environment.
LeanLink/LibraryResources/
leanprover/lean4:v4.30.0
libleanshared
elantoolchaininstallleanprover/lean4:v4.30.0
lake
PATH
LeanImport
◼
TypePi
◼
A type shown in isolation can print an unresolved bound variable as / ; the full-theorem resolves binder names.
#0
#1
"TypeForm"
Neat Examples (1)
Neat Examples
(1)