Aviva Directory » Computers & Internet » Programming » Lean

Originally launched by Leonardo de Moura at Microsoft Research in 2013, versions 1 and 2 of Lean were experimental, while version 3 was the first semi-stable release of the Lean programming language, and version 4 is not backward-compatible with version 3.

With its first stable release in 2023, Lean 4, a fully stable version of the language, offers significant benefits over Lean 4.

ML, Coq, and Haskell influenced lean.

Based on a calculus of constructions with inductive types, Lean was created as a proof assistant and programming language. The first two versions were considered experimental and included features such as support for Homotopy Type Theory based foundations that were later dropped.

Lean 3 was implemented primarily in C++ with some features written in Lean. After version 3.4.2, Lean 3 was officially end-of-lifed while Lean 4 began, as Lean 4 was not intended to be compatible with previous versions. During this period, members of the Lean Community developed and released unofficial versions up to 3.51.1.

Lean 4, which was released in 2021, is a reimplementation of the Lean theorem prover. It is capable of producing C code that can be compiled, enabling the development of efficient domain-specific automation. Lean 4 includes a macro system and improved typeclass synthesis and memory management procedures over the previous version. Additionally, Lean 4 allows users to modify the frontend and other key parts of the core system without touching C++ code, as they are now all implemented in Lean and available to the end user to be overridden as needed.

The Lean mathematical library, mathlib, is a community-driven effort to build a library of mathematics formalized in the Lean proof assistant. It also contains definitions useful in programming.

A proof assistant is a piece of software that provides a language for defining objects, specifying properties of these objects, and proving that these specifications hold. The system checks to determine that these proofs are correct down to their logical foundation. Proof assistants are often used to verify the correctness of a program, but they can also be used for abstract mathematics, which is of particular interest to the mathlib community.

Up to version 3, Lean focused on being a proof assistant, and its chief applications have been to digitize theoretical mathematics. However, a goal of Lean 4 is to make Lean a good programming language rather than just a proof assistant. To that end, its syntax has been reworked in several ways to make it easier to write a wider variety of programs. An optimizing compiler that generates efficient C code was written, making it easier to integrate with C/C++ code when necessary. Lean 4 is largely self-hosting and written in Lean itself.

This portion of our web guide is dedicated to the Lean programming language. Topics related to the language itself, or any compilers, editors, IDEs, or other tools or utilities designed to facilitate programming with Lean, are appropriate for this category, as are Lean programming guides, tutorials, communities, or forums.



Recommended Resources

Search for Lean on Google or Bing