This repository contains a collection of exercises written in Lean, a theorem prover and functional programming language. These exercises focus on various mathematical proofs and techniques, covering topics like geometric series, binomial coefficients, and recursive functions.
The project is structured as follows:
Main.lean
: The main entry point for running the Lean project.Exercises/
: Contains individual.lean
files for each exercise.Exercise1.lean
: Contains a proof of the sum of the first ( n ) terms of a geometric series.Exercise2.lean
: Deals with binomial coefficients and their properties.Exercise3.lean
: Defines a recursive function and proves its properties using mathematical induction.
.lake/
: Contains build-related files managed by Lake, Lean's build system.lakefile.lean
: The build configuration for the project.lean-toolchain
: Specifies the Lean version used in this project (Lean 4).
-
Clone the repository:
git clone <repository-url> cd lean_exercises
-
Install dependencies:
This project uses Lake to manage dependencies and builds. To ensure you have everything needed, install the mathlib dependency using:
lake exe cache get
-
Build the project:
To compile the Lean files, run:
lake build
-
Run the project:
After building, run the main executable:
lake run
File: Exercise1.lean
If
File: Exercise2.lean
In this exercise, you will work with binomial coefficients, including proving properties like:
Please solve this coding question:
Q. Let
(i )
(ii)
File: Exercise3.lean
This exercise defines a recursive function and uses mathematical induction to prove its properties:
Please solve this coding question:
Q. We define a function recursively for all positive integers
for
Show that
- Lean 4: Ensure that you have Lean 4 installed. You can install it via
elan
, the Lean version manager. - VS Code: It's recommended to use Visual Studio Code with the Lean extension for a better development experience.