Lean4
LanguageTacticsPlaygroundAcademyProblemsPricing
Overview

Lean 4 as a Programming Language

Lean 4 as a programming language: types, data, control flow, effects and projects, with no theorem proving required.

This guide covers Lean 4 from the perspective of a software engineer. You will learn syntax, data structures, control flow, and how to build real applications. The theorem proving aspects are covered separately in the Tactics section.

Modules

1

Foundations

Lean's syntax, basic types and functions, and the interactive environment.

The EnvironmentPrimitives & TypesFunctionsLocal Scope
2

Data Modeling

Structures, inductive types, recursive data, and the standard collections.

StructuresInductive TypesRecursive DataCollections
3

Control Flow & Logic

Pattern matching, recursion, higher-order functions, and error handling.

Pattern MatchingRecursionTail RecursionHigher-Order FunctionsError Handling
4

Type Classes

Polymorphism through type classes, which work much like Rust traits or Haskell type classes.

The ConceptCreating InstancesCustom Classes
5

Effectful Programming

do notation, the IO monad, and mutable state.

Do NotationIO MonadMutable State
6

Project Engineering

Lake projects, modules, and compiled executables.

Lake Build SystemModules & ImportsCompiling to Binary

Ready to begin?

Start with the first lesson to learn about Lean's interactive environment.

Start Module 1
Lean4

A comprehensive learning platform for the Lean 4 programming language and theorem prover.

Lean 4 on GitHub

Learn

  • Language Guide
  • Tactics Reference
  • Lean Playground
  • Interactive Academy
  • Lean Problems
  • Proof Stories
  • Pricing

Community

  • Community Forum
  • Lean Zulip
  • Official Lean Website
  • Mathlib Documentation

Site

  • About
  • Contact
  • Editorial Policy
  • Your Account

Policies

  • Privacy Policy
  • Terms of Use
  • Withdraw from contract
  • Legal Notice

Built for the Lean community. Not officially affiliated with the Lean FRO. Lean is a trademark of Lean FRO, LLC.