Lean4
LanguageTacticsCourse
LanguageTacticsCourse
1.1 The Environment1.2 Primitives & Basic Types1.3 Functions & Definitions1.4 Local Scope
2.1 Products (Structures)2.2 Sums (Inductive Types)2.3 Recursive Data2.4 Collections & Arrays
3.1 Pattern Matching3.2 Recursion3.3 Tail Recursion & Accumulators3.4 Higher-Order Functions3.5 Error Handling
4.1 The Concept4.2 Creating Instances4.3 Custom Classes
5.1 The Do Notation5.2 The IO Monad5.3 Mutable State
6.1 Lake (Build System)6.2 Modules & Imports6.3 Compiling to Binary
22 lessons
6 modules

Lean 4 as a Programming Language

Learn Lean 4 as a modern, purely functional programming language. No proofs required—just clean, expressive code.

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

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

The EnvironmentPrimitives & TypesFunctionsLocal Scope
2

Data Modeling

Structure your data with products, sums, and recursive types. Lean's type system shines here.

StructuresInductive TypesRecursive DataCollections
3

Control Flow & Logic

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

Pattern MatchingRecursionHigher-Order FunctionsError Handling
4

Type Classes

Polymorphism through type classes—similar to Rust traits or Haskell typeclasses.

The ConceptCreating InstancesCustom Classes
5

Effectful Programming

The do notation, IO monad, and mutable state. Practical programming made functional.

Do NotationIO MonadMutable State
6

Project Engineering

Build real projects with Lake, modules, and compiled binaries.

Lake Build SystemModules & ImportsCompiling to Binary

Ready to begin?

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

Start Module 1