https://github.com/leanprover/hex-bareiss-mathlib
Mathlib correspondence proofs for hex-bareiss. Published from hex-dev.
https://github.com/leanprover/hex-bareiss-mathlib
Last synced: about 1 month ago
JSON representation
Mathlib correspondence proofs for hex-bareiss. Published from hex-dev.
- Host: GitHub
- URL: https://github.com/leanprover/hex-bareiss-mathlib
- Owner: leanprover
- License: apache-2.0
- Created: 2026-06-29T02:59:55.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-07-04T04:42:14.000Z (about 1 month ago)
- Last Synced: 2026-07-04T06:25:06.198Z (about 1 month ago)
- Language: Lean
- Homepage: https://kim-em.github.io/hex-dev/find/?domain=Verso.Genre.Manual.section&name=hex-bareiss
- Size: 41 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Agents: AGENTS.md
Awesome Lists containing this project
README
# hex-bareiss-mathlib
Part of [`hex`](https://github.com/kim-em/hex-dev), a computer algebra
library for Lean 4. The aim is fast executable code, fully verified, built
with spec-driven development.
`hex-bareiss-mathlib` is the Mathlib bridge for
[`hex-bareiss`](https://github.com/leanprover/hex-bareiss). It proves the
row-pivoted Bareiss determinant correct, both against Mathlib's `Matrix.det`
and against the executable Leibniz determinant from
[`hex-determinant`](https://github.com/leanprover/hex-determinant). It depends on
[`hex-bareiss`](https://github.com/leanprover/hex-bareiss),
[`hex-determinant-mathlib`](https://github.com/leanprover/hex-determinant-mathlib),
and Mathlib.
# Quickstart
Add to your `lakefile.toml`:
```toml
[[require]]
name = "hex-bareiss-mathlib"
git = "https://github.com/leanprover/hex-bareiss-mathlib.git"
rev = "main"
```
```lean
import HexBareissMathlib
open HexMatrixMathlib
-- The executable Bareiss determinant equals the Leibniz determinant.
#check @bareiss_eq_det
-- @bareiss_eq_det : ∀ {n : ℕ} (M : Hex.Matrix ℤ n n), M.bareiss = M.det
-- ... and equals Mathlib's determinant of the corresponding matrix.
#check @bareissDet_eq_det
-- @bareissDet_eq_det : ∀ {n : ℕ} (M : Hex.Matrix ℤ n n), M.bareiss = (matrixEquiv M).det
```
# Functionality
- `bareiss_eq_det`: the row-pivoted Bareiss determinant equals the
executable Leibniz `Hex.Matrix.det`;
- `bareissDet_eq_det` (also `bareiss_eq_mathlib_det`): it equals Mathlib's
`Matrix.det` of the corresponding matrix `matrixEquiv M`;
- `bareissNoPivot_eq_det` and the bordered-minor invariant
(`BareissNoPivotInvariant`, `NonzeroBareissPivots`): the Desnanot-Jacobi
argument that drives the no-pivot correctness proof.
# Verification
The correspondence is fully proven on integer square matrices. The two
headline theorems are the preferred surface for Mathlib-side callers; both
hold outright, with no hypothesis to discharge.
The executable Bareiss determinant equals the Leibniz determinant,
`bareiss_eq_det`:
```lean
theorem bareiss_eq_det (M : Hex.Matrix Int n n) :
Hex.Matrix.bareiss M = Hex.Matrix.det M
```
It also equals Mathlib's determinant, `bareissDet_eq_det`:
```lean
theorem bareissDet_eq_det (M : Hex.Matrix Int n n) :
Hex.Matrix.bareiss M = Matrix.det (matrixEquiv M)
```
The Mathlib statement is proven directly by running the Bareiss loop and
tracking the bordered-minor invariant step by step, `bareiss_eq_mathlib_det`:
```lean
theorem bareiss_eq_mathlib_det (M : Hex.Matrix Int n n) :
Hex.Matrix.bareiss M = Matrix.det (matrixEquiv M)
```
The executable algorithm itself lives in
[`hex-bareiss`](https://github.com/leanprover/hex-bareiss); these theorems are on
that Mathlib-free library's forbidden list and live here by design.
# Reference manual
The hex reference manual covers this library and its computational base at
.
# Contributing
Development happens in the [`hex-dev`](https://github.com/kim-em/hex-dev)
monorepo, not in this published mirror. Contributions are welcome as pull
requests to the `SPEC/` directory: describe the behaviour you want, and
leave the implementation to the maintainer.