Every program in the book is in the companion repo, with outputs, errors and goals kept as golden files a test checks. Core Lean 4.35, one lake build on macOS, Linux and Windows.
Search
20 results for “vpavlyshyn”
-
Little Leaner: 10 chapters, 39 exercises, 12 maxims. PDF + EPUB, DRM-free, pay what you want from $15.
If you bounced off theorem proving before, this is the on-ramp I wish I'd had.
-
Ask a program whether the heron is above the algae in a pond and it may say yes.
Little Leaner asks for more: a proof.
My new book teaches Lean 4 and dependent types to beginners, the way The Little Schemer taught recursion 🧵
-
The idea fits in one line:
A proposition is a type. A proof is a thing of that type.
"The heron is above the algae" becomes a type in Lean 4, and its proof is a value Lean checks before anything runs.
-
The format: 752 questions with answers, two columns per page. One question keeps coming back: "What is the goal now?"
No logic course, no proof experience, no Mathlib. You need programming in any language, a pencil and patience.
-
It starts small and concrete: a pond food web, numbers built by hand, equality, lists and their laws.
Then types that depend on values. A vector knows its length, so taking the first element of an empty one is refused by Lean instead of crashing at run time.
-
The last chapter builds a language that cannot go wrong: typed expressions, an evaluator that never fails, a stack machine whose stack cannot run dry, and a compiler proved to keep the meaning of every program.
-
Why now? Once you can read a goal and close it, verified software stops being a research topic.
Compilers, protocols, data pipelines, business rules: write the claim as a type and the Lean kernel checks it, trusting no one.
-
It's also the base for neuro-symbolic agents. An LLM proposes a plan, a fact or a proof. Lean decides whether it holds.
The model can be wrong; the kernel can't be talked into agreeing. That's the pattern behind LeanElpi and Logic for Agents.
-
Use cases I care about: neurosymbolic agents where an LLM proposes and logic + the kernel decide, typed knowledge graphs, and certificates you can check instead of trust.
Books and companion code build on it: The Little Elpier, Logic for Agents, Bulletproof Knowledge.
-
Docs, book and blog: https://volland.github.io/lean-elpi/
Code: https://github.com/Volland/lean-elpi
Issues, PRs and stars welcome. If you write tactics or play with λProlog, I'd love to hear what breaks.
-
I built LeanElpi: λProlog inside Lean 4.
Write tactics, commands and proof search as logic programs, share types with Lean in both directions, and get proofs the Lean kernel checks.
A thread on what it is and why 🧵
-
What is ELPI? It's the dialect of λProlog behind Coq-Elpi: a higher-order logic programming language with binders, pattern unification and constraints built in.
LeanElpi is a clean-room, native Lean 4 implementation of it. No upstream code ported, Apache-2.0.
-
Why λProlog for proofs? Proof search *is* search. Rules like "to prove A ∧ B, prove A and prove B" are clauses. Backtracking, unification and fresh variables (pi, =>) come for free instead of being hand-coded in a tactic monad.
-
Getting started is one Lake dependency, Lean 4.35, no Mathlib:
require «lean-elpi» from git "https://github.com/Volland/lean-elpi" @ "v0.4.1"
then `import Elpi`.
-
The type bridge works both ways:
• `deriving Elpi` exposes a Lean inductive (parametric, recursive) to ELPI
• `elpi_extern twice` makes a Lean function an ELPI predicate
• `elpi_data` turns ELPI types into Lean inductives`twice 21 X` → X = 42
-
Inside Lean it's a metaprogramming tool: {{ … }} quotations, tactics and commands written in λProlog, and lean.* builtins over MetaM. It can read and even create inductive types from ELPI.
-
For the "don't trust, verify" crowd: an opt-in LF layer with dependently typed signatures, recorded proof terms and export to Lean inductives.
Whatever the logic program finds, the Lean kernel checks.
-
Not a Lean user? One native library, three bindings, no Lean install needed (macOS/Linux):
pip install leanelpi
npm install @lean-elpi/leanelpi
cargo add leanelpiProgram("pred n o:int.\nn 1.\nn 2.").solve("n X") → X = 1, X = 2
-
Honest numbers vs ELPI 1.18 on its own benchmark suite: all 24 programs run. ~2.4× slower by geometric mean (6.2× worst), faster on cbv, start-up and small programs.
Release 0.3.0 was 31× slower. The blog posts explain what changed.