Existing in Mathlib · Number theory
Fermat's Little Theorem
Choose a prime modulus p and a number n not divisible by p. Raising n to the power p−1 returns the unit residue 1 after reduction modulo p.
- Fermat's Little Theorem
- prime modulus
- modular exponentiation
- coprimality
Exact theorem
Exact Mathlib statement
theorem Nat.ModEq.pow_card_sub_one_eq_one {p : ℕ} (hp : Nat.Prime p) {n : ℕ} (hpn : n.Coprime p) : n ^ (p - 1) ≡ 1 [MOD p]The theorem at a glance
Fermat's Little Theorem — exact coprime exponent form
A visual guide to the theorem's hypotheses, structure, and conclusion; the exact statement gives the formal detail.
Fermat's Little Theorem — exact coprime exponent form

Detailed visual description
The retained poster presents the exact prime-modulus hypotheses, exponent p−1 conclusion, reading sequence, and boundary excluding the alternate n^p form, converses, and primality tests.
Statement structure
From hypotheses to conclusion
This map summarizes the statement's structure; the exact Mathlib declaration remains authoritative.
A unit residue returns to one

Detailed visual description
The theorem begins with a prime modulus and a coprime natural number, then concludes a precise congruence after p−1 repeated multiplications.
Why it matters
A mathematical landmark
Fermat's Little Theorem is a basic structural fact about arithmetic modulo a prime and a starting point for modern primality tests, finite-field calculations, and public-key cryptography.
ProofAtlas record
What has been checked
Mathlib is the source of the theorem; the local Lean replay and page review are separate.
Claim boundary
No new theorem is claimed
This target indexes Mathlib's natural-number congruence form: if p is prime and n is coprime to p, then n^(p-1) is congruent to 1 modulo p. It does not state the alternate n^p congruent to n form, primality converses, or a new proof.
- The selected declaration is the coprime exponent form, not the alternate n^p congruent to n form.
- It is not a converse and does not characterize primes.
- ProofAtlas is indexing an existing Mathlib theorem, not claiming new mathematics.
Source and local evidence
Where the theorem comes from
- Existing declaration
Nat.ModEq.pow_card_sub_one_eq_onein mathlib- Relationship
- The checked artifact is the upstream declaration itself
- Local Lean evidence
artifact.library.mathlib.fermat-little-theorem.v001