Lean4
LanguageTactics
LanguageTactics
Overview

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 MatchingRecursionTail RecursionHigher-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