Proof Hike · Module 6 · Lean 4.36.0

Algebra with Mathlib.

Meet a toolbox built by mathematicians.

The five steps

  1. Example 26: A library of mathematics
  2. Example 27: Numbers, checked
  3. Example 28: Follow the inequalities
  4. Example 29: Write a chain of reasons
  5. Example 30: A square is never negative

New words

Mathlib
A community-maintained mathematical library for Lean, containing definitions, checked theorems, and tactics.
Real number
A number on the usual continuous number line. Real numbers include rational and irrational numbers.
Polynomial
An expression formed from variables and coefficients using addition, multiplication, and natural-number powers.
Module
A source-file unit that controls imported and exported declarations. This course pins the module behavior of Lean 4.36.0.
Rational number
A number expressible as an integer divided by a nonzero integer. Lean’s rational arithmetic is exact.

A checked example

E26.leanTry it live (opens official Lean editor)
module

import Mathlib.Tactic.Ring
import Mathlib.Basic.Real.Basic

example (a b : ℝ) : (a + b)^2 = a^2 + 2*a*b + b^2 := by
  ring

Before you move on

  • Explain the claim in everyday words.
  • Identify what Lean expects at each step.
  • Complete the warm-up exercises.
  • Read an error and explain its fix.

The full lesson includes the captured Lean output, hints, stretch tasks, and checked solutions.

Use your browser’s Print command. This course stores progress only in the learner’s browser.