PURE LEAN 4 EXERCISES · NO MATHLIB REQUIRED

Prove Lean 4 statements in your browser

Work through 60 self-contained theorem-proving problems—from propositional logic and list induction to Gauss’s sum, Peirce’s law, and Cantor’s theorem—verified directly by the Lean 4 kernel without Mathlib.

Solved Progress0 / 60
Easy
0/25
Medium
0/26
Hard
0/9
Contribute exercises on GitHub
StatusProblemDifficultyAction
1.Modus Ponens
(P Q : Prop) (hp : P) (hpq : P → Q) : Q
EasySolve
2.Commutativity of Conjunction
(P Q : Prop) : P ∧ Q → Q ∧ P
EasySolve
3.Commutativity of Disjunction
(P Q : Prop) : P ∨ Q → Q ∨ P
EasySolve
4.Contrapositive
(P Q : Prop) (h : P → Q) : ¬ Q → ¬ P
EasySolve
5.Right Identity of Addition
(n : Nat) : n + 0 = n
EasySolve
6.Currying and Uncurrying
(P Q R : Prop) : (P ∧ Q → R) ↔ (P → Q → R)
EasySolve
7.Right Identity of List Append
{α : Type} (xs : List α) : xs ++ [] = xs
EasySolve
8.Left Identity of Addition
(n : Nat) : 0 + n = n
MediumSolve
9.Associativity of Addition
(a b c : Nat) : (a + b) + c = a + (b + c)
MediumSolve
10.Commutativity of Addition
(a b : Nat) : a + b = b + a
MediumSolve
11.De Morgan's Law for Disjunction
(P Q : Prop) : ¬ (P ∨ Q) ↔ ¬ P ∧ ¬ Q
MediumSolve
12.Existential Premise to Universal
{α : Type} (P : α → Prop) (Q : Prop) : ((∃ x, P x) → Q) ↔ (∀ x, P x → Q)
MediumSolve
13.Length of Appended Lists
{α : Type} (xs ys : List α) : (xs ++ ys).length = xs.length + ys.length
MediumSolve
14.Map Distributes over Append
{α β : Type} (f : α → β) (xs ys : List α) : (xs ++ ys).map f = xs.map f ++ ys.map f
MediumSolve
15.Triple Negation Collapse
(P : Prop) : ¬ ¬ ¬ P → ¬ P
MediumSolve
16.Gauss's Triangular Sum Formula
(n : Nat) : 2 * sumTo n = n * (n + 1)
HardSolve
17.List Reverse is an Involution
{α : Type} (xs : List α) : xs.reverse.reverse = xs
HardSolve
18.Peirce's Law
(P Q : Prop) : ((P → Q) → P) → P
HardSolve
19.Smullyan's Drinker Paradox
{α : Type} [Nonempty α] (P : α → Prop) : ∃ x : α, P x → ∀ y : α, P y
HardSolve
20.Cantor's Diagonal Theorem
{α : Type} (f : α → (α → Prop)) : ¬ ∀ g : α → Prop, ∃ x : α, f x = g
HardSolve
21.Transitivity of Implication
(P Q R : Prop) (hpq : P → Q) (hqr : Q → R) : P → R
EasySolve
22.Associativity of Conjunction
(P Q R : Prop) : (P ∧ Q) ∧ R ↔ P ∧ (Q ∧ R)
EasySolve
23.Distributivity of And over Or
(P Q R : Prop) : P ∧ (Q ∨ R) ↔ (P ∧ Q) ∨ (P ∧ R)
EasySolve
24.Double Negation Introduction
(P : Prop) : P → ¬¬P
EasySolve
25.Double Negation of Excluded Middle
(P : Prop) : ¬¬(P ∨ ¬P)
MediumSolve
26.Negation of Existential Quantifier
{α : Type} (P : α → Prop) : (¬∃ x, P x) ↔ ∀ x, ¬P x
EasySolve
27.Frobenius Rule
{α : Type} (P : α → Prop) (Q : Prop) : (∃ x, P x ∧ Q) ↔ (∃ x, P x) ∧ Q
MediumSolve
28.Russell's Barber Paradox
(α : Type) (Shaves : α → α → Prop) : ¬∃ b, ∀ x, Shaves b x ↔ ¬Shaves x x
MediumSolve
29.Material Implication
(P Q : Prop) : (P → Q) ↔ (¬P ∨ Q)
MediumSolve
30.De Morgan's Law for Conjunction
(P Q : Prop) : ¬(P ∧ Q) ↔ ¬P ∨ ¬Q
HardSolve
31.Left Multiplication by Zero
(n : Nat) : 0 * n = 0
EasySolve
32.Right Cancellation of Addition
(a b c : Nat) (h : a + c = b + c) : a = b
EasySolve
33.Commutativity of Multiplication
(m n : Nat) : m * n = n * m
MediumSolve
34.Sum of Two Even Numbers
(m n : Nat) (hm : ∃ a, m = 2 * a) (hn : ∃ b, n = 2 * b) : ∃ c, m + n = 2 * c
EasySolve
35.Every Natural Number Is Even or Odd
(n : Nat) : (∃ k, n = 2 * k) ∨ (∃ k, n = 2 * k + 1)
MediumSolve
36.Divisibility of Linear Combinations
(d a b x y : Nat) (ha : ∃ k, a = d * k) (hb : ∃ m, b = d * m) : ∃ q, x * a + y * b = d * q
MediumSolve
37.Sum of the First n Odd Numbers
(n : Nat) : sumOdd n = n * n
MediumSolve
38.Geometric Sum of Powers of Two
(n : Nat) : sumPow2 n + 1 = 2 ^ (n + 1)
MediumSolve
39.Powers of Two Exceed Linear Growth
(n : Nat) : n < 2 ^ n
MediumSolve
40.Sum of Squares Formula
(n : Nat) : 6 * sumSq n = n * (n + 1) * (2 * n + 1)
HardSolve
41.Map Preserves List Length
{α β : Type} (f : α → β) (xs : List α) : (xs.map f).length = xs.length
EasySolve
42.Map Respects Function Composition
{α β γ : Type} (f : β → γ) (g : α → β) (xs : List α) : (xs.map g).map f = xs.map (fun x => f (g x))
EasySolve
43.Reverse Preserves List Length
{α : Type} (xs : List α) : xs.reverse.length = xs.length
EasySolve
44.Reverse of Appended Lists
{α : Type} (xs ys : List α) : (xs ++ ys).reverse = ys.reverse ++ xs.reverse
MediumSolve
45.Filter Cannot Increase Length
{α : Type} (p : α → Bool) (xs : List α) : (xs.filter p).length ≤ xs.length
EasySolve
46.Filter is Idempotent
{α : Type} (p : α → Bool) (xs : List α) : (xs.filter p).filter p = xs.filter p
MediumSolve
47.Tail-Recursive List Sum Equivalence
(xs : List Nat) : fastSum xs = listSum xs
MediumSolve
48.Tail-Recursive Reverse Equivalence
{α : Type} (xs : List α) : fastRev xs = xs.reverse
MediumSolve
49.Insertion Sort Preserves Length
(xs : List Nat) : (isort xs).length = xs.length
MediumSolve
50.Insertion Sort Produces a Sorted List
(xs : List Nat) : Sorted (isort xs)
HardSolve
51.Composition of Injective Functions
(α β γ : Type) (f : α → β) (g : β → γ) (hf : ∀ x y, f x = f y → x = y) (hg : ∀ x y, g x = g y → x = y) : ∀ x y, g (f x) = g (f y) → x = y
EasySolve
52.Composition of Surjective Functions
(α β γ : Type) (f : α → β) (g : β → γ) (hf : ∀ b, ∃ a, f a = b) (hg : ∀ c, ∃ b, g b = c) : ∀ c, ∃ a, g (f a) = c
EasySolve
53.Left Inverse Implies Injectivity
(α β : Type) (f : α → β) (g : β → α) (h : ∀ x, g (f x) = x) : ∀ x y, f x = f y → x = y
EasySolve
54.Right Inverse Implies Surjectivity
(α β : Type) (f : α → β) (g : β → α) (h : ∀ y, f (g y) = y) : ∀ y, ∃ x, f x = y
EasySolve
55.Uniqueness of Function Inverses
(α β : Type) (f : α → β) (g h : β → α) (hg : ∀ x, g (f x) = x) (hh : ∀ y, f (h y) = y) : g = h
MediumSolve
56.Mirroring a Binary Tree is an Involution
{α : Type} (t : BinTree α) : mirror (mirror t) = t
EasySolve
57.Mirroring Preserves Binary Tree Size
{α : Type} (t : BinTree α) : treeSize (mirror t) = treeSize t
EasySolve
58.Functorial Composition of Tree Map
{α β γ : Type} (f : β → γ) (g : α → β) (t : BinTree α) : treeMap f (treeMap g t) = treeMap (fun x => f (g x)) t
MediumSolve
59.De Morgan's Law for Set Union
(α : Type) (A B : α → Prop) : (fun x => ¬(A x ∨ B x)) = (fun x => ¬A x ∧ ¬B x)
MediumSolve
60.Lawvere's Fixed-Point Theorem
(α β : Type) (f : α → α → β) (hsurj : ∀ g : α → β, ∃ a, f a = g) (h : β → β) : ∃ b, h b = b
HardSolve