The Lean Language Reference
1.
Introduction
2.
Elaboration and Compilation
3.
The Lean Language
4.
Terms
5.
Monads and
do
-Notation
6.
IO
7.
Tactic Proofs
8.
The Simplifier
9.
Basic Types
10.
Standard Library
11.
Notations and Macros
12.
Elan
13.
Lake and Reservoir
Index
3.
Â
The Lean Language
3.1.
Files
3.2.
Types
3.3.
Module Structure
3.4.
Axioms
3.5.
Recursive Definitions
3.6.
Type Classes
3. The Lean Language
3.1.
Files
3.1.1.
Modules
3.1.1.1.
Encoding and Representation
3.1.1.2.
Concrete Syntax
3.1.1.2.1.
Whitespace
3.1.1.2.2.
Comments
3.1.1.2.3.
Keywords and Identifiers
3.1.1.3.
Structure
3.1.1.3.1.
Module Headers
3.1.1.3.2.
Commands
3.1.1.4.
Contents
3.1.2.
Packages, Libraries, and Targets
3.2.
Types
3.2.1.
Functions
3.2.1.1.
Functions
3.2.1.2.
Currying
3.2.1.3.
Implicit Functions
3.2.1.4.
Pattern Matching
3.2.1.5.
Extensionality
3.2.1.6.
Totality and Termination
3.2.2.
Propositions
3.2.3.
Universes
3.2.3.1.
Predicativity
3.2.3.2.
Polymorphism
3.2.3.2.1.
Level Expressions
3.2.3.2.2.
Universe Variable Bindings
3.2.3.2.3.
Universe Unification
3.2.4.
Inductive Types
3.2.4.1.
Inductive Type Declarations
3.2.4.1.1.
Parameters and Indices
3.2.4.1.2.
Example Inductive Types
3.2.4.1.3.
Anonymous Constructor Syntax
3.2.4.1.4.
Deriving Instances
3.2.4.2.
Structure Declarations
3.2.4.2.1.
Structure Parameters
3.2.4.2.2.
Fields
3.2.4.2.3.
Structure Constructors
3.2.4.2.4.
Structure Inheritance
3.2.4.3.
Logical Model
3.2.4.3.1.
Recursors
3.2.4.3.1.1.
Recursor Types
3.2.4.3.1.1.1.
Subsingleton Elimination
3.2.4.3.1.2.
Reduction
3.2.4.3.2.
Well-Formedness Requirements
3.2.4.3.2.1.
Universe Levels
3.2.4.3.2.2.
Strict Positivity
3.2.4.3.2.3.
Prop vs Type
3.2.4.3.3.
Constructions for Termination Checking
3.2.4.4.
Run-Time Representation
3.2.4.4.1.
Exceptions
3.2.4.4.2.
Relevance
3.2.4.4.3.
Trivial Wrappers
3.2.4.4.4.
Other Inductive Types
3.2.4.4.4.1.
FFI
3.2.4.5.
Mutual Inductive Types
3.2.4.5.1.
Requirements
3.2.4.5.1.1.
Mutual Dependencies
3.2.4.5.1.2.
Parameters Must Match
3.2.4.5.1.3.
Universe Levels
3.2.4.5.1.4.
Positivity
3.2.4.5.2.
Recursors
3.2.4.5.3.
Run-Time Representation
3.2.5.
Quotients
3.3.
Module Structure
3.3.1.
Commands and Declarations
3.3.1.1.
Definition-Like Commands
3.3.1.2.
Modifiers
3.3.1.3.
Signatures
3.3.1.4.
Headers
3.3.2.
Section Scopes
3.4.
Axioms
3.5.
Recursive Definitions
3.5.1.
Structural Recursion
3.5.1.1.
Mutual Structural Recursion
3.5.2.
Well-Founded Recursion
3.5.3.
Controlling Reduction
3.5.4.
Partial and Unsafe Recursive Definitions
3.6.
Type Classes
3.6.1.
Class Declarations
3.6.2.
Instance Declarations
3.6.3.
Instance Synthesis
3.6.4.
Deriving Instances
3.6.4.1.
Deriving Handlers