hex

Verified computational algebra in Lean 4: an aggregator for the released hex libraries.

Quickstart

Add to your lakefile.toml:

[[require]]
name = "hex"
git = "https://github.com/leanprover/hex.git"
rev = "main"

The requirement installs the libraries in the table below at a single coherent pinned set. The generated import Hex umbrella re-exports every aggregated library:

import Hex

open Hex

-- Exact, fraction-free integer determinant.
def M : Matrix Int 3 3 := #m[2, 1, 1; 1, 2, 1; 1, 1, 2]
#eval M.det   -- 4

-- LLL: reduce an integer lattice basis and read off a provably short vector.
-- The `by decide` arguments discharge the reduction-factor side conditions.
def L : Matrix Int 3 3 := #m[1, 1, 1; 1, 0, 2; 3, 5, 6]
#eval lllNative.firstShortVector L (3 / 4) (by decide +kernel) (by decide +kernel) (by decide)

To depend on just one piece, require that library directly (for example hex-lll for the Mathlib-free LLL core) instead of the aggregator.

Libraries

Each computational library is Mathlib-free; its Mathlib correspondence proofs and Mathlib-facing API, where they exist, live in a separate *-theory library. A library whose subject is a Mathlib-facing tactic, such as hex-rcf, has no computational half and appears only in the Theory column.

ComponentComputationalTheory
FoundationsHexBasicn/a
Fixed-precision power seriesHexTruncatedSeriesHexTruncatedSeriesTheory
Exact word arithmeticHexArithn/a
CRT and rational reconstructionHexModularn/a
Certified primalityHexPrimalityHexPrimalityTheory
Bounded elliptic-curve certificatesHexECPPHexECPPTheory
Dense univariate polynomialsHexPolyHexPolyTheory
Fast dense-polynomial algorithmsHexPolyFastn/a
Modular arithmeticHexModArithHexModArithTheory
Sparse multivariate polynomialsHexMvPolyHexMvPolyTheory
MatricesHexMatrixHexMatrixTheory
Polynomials over a prime fieldHexPolyFpHexPolyFpTheory
Sparse univariate polynomialsHexSparsePolyHexSparsePolyTheory
Integer polynomialsHexPolyZHexPolyZTheory
Quotient rings F_p[x]/(f)HexGFqRingn/a
Hensel liftingHexHenselHexHenselTheory
Complex root isolationHexRootsHexRootsTheory
Real root isolationHexRealRootsHexRealRootsTheory
Row reductionHexRowReduceHexRowReduceTheory
Finite-field factorizationHexBerlekampHexBerlekampTheory
Conway polynomialsHexConwayn/a
Finite fields F_p[x]/(f)HexGFqFieldn/a
Packed GF(2) polynomialsHexGF2HexGF2Theory
Canonical finite fieldsHexGFqHexGFqTheory
DeterminantsHexDeterminantHexDeterminantTheory
Bareiss determinantHexBareissHexBareissTheory
Gram-SchmidtHexGramSchmidtHexGramSchmidtTheory
LLL lattice reductionHexLLLHexLLLTheory
Integer polynomial factorizationHexBerlekampZassenhausHexBerlekampZassenhausTheory
Permutation groupsHexPermGroupHexPermGroupTheory
Graph canonical labellingHexGraphIsoHexGraphIsoTheory
Resultants and discriminantsHexResultantHexResultantTheory
Algebraic numbersHexNumberFieldHexNumberFieldTheory
Number field towersHexNumberFieldTowerHexNumberFieldTowerTheory
Real-closed-field decision (rcf tactic)n/aHexRCF

Announcements

Development of the full project (including unreleased libraries) happens in the hex-dev monorepo.