--- license: agpl-3.0 language: - en tags: - haskell - formal-verification - agda - liquid-haskell - smt - sat-solver - refinement-types - lambda-calculus - linear-algebra - number-theory - riemann-zeta - dex - mathematics - no-weights --- # montrepol > **This is not a machine-learning model.** There are no weights, no training > data, no inference API and no benchmark scores. It is a library of exact > mathematics in Haskell, with machine-checked proofs and a certifying solver, > published here as a code repository. This card follows the model-card layout > so that it can say plainly what the repository is and is not. ## What it is Exact mathematics in Haskell, depending on nothing but GHC: no Hackage packages in the core build. The test harness, pseudorandom generator, TOML reader, solver and every algorithm are written in the repository. Every claim is tied to something that can fail: a test, a proof or a refinement check. | Package / layer | What it is | | --- | --- | | `mp-check` | Test harness: SplitMix64, generators, properties, tests tagged with claim IDs | | `mp-linalg` | Semirings, matrices with dimensions in the type, naive and Strassen products, Bareiss determinant, rank, inverse, exact participation ratio and Kish k_eff | | `mp-lie` | Root systems A–G, simple roots, Cartan matrices, Weyl group orders by orbit–stabilizer (E8 = 696,729,600, computed) | | `mp-seq` | Berlekamp–Massey over any field, LFSRs, periods | | `mp-analytic` | Sieve, von Mangoldt, Chebyshev ψ, exact Bernoulli numbers, ζ by Euler–Maclaurin, Riemann–Siegel θ, Hardy Z, its zeros, the explicit formula | | `mp-hcalc` | **Hcalc**: a certifying SMT core. DPLL SAT, Fourier–Motzkin over ℚ, and DPLL(T) over both. Every answer comes with a certificate that independent code checks. | | `mp-lambda` | The simply typed λ-calculus, and refinement types `{v:Int \| φ}` whose verification conditions Hcalc decides | | `mp-gate` | The repository's rules (R1–R6), checked over the code, proofs, model and build, plus a replay of planted defects | | `formal/` | Agda proofs under `--safe`, with no standard library | | `liquid/` | Liquid Haskell (with Z3) checking a core module in place | | `dex/` | Dex code: typed-index integer matrices, run as self-checking quines | The project's own README is [`README-project.md`](README-project.md). [`CONFORMANCE.md`](CONFORMANCE.md) lists every claim, generated from `model/`. ## Intended uses - Exact linear algebra, root-system and analytic-number-theory computations in Haskell, where correctness matters more than speed. - A worked example of tying every claim to a check: claim registers, honesty levels, certificate checking, and planted defects that tests must catch. - Teaching: a small certifying SMT solver, refinement types, and proofs of Strassen's identities that can be read end to end. ## Out of scope - **Any machine-learning use.** There is nothing to load into a pipeline. - **Production SMT solving.** Hcalc uses Fourier–Motzkin elimination and plain DPLL. They are chosen because their certificates are easy to check, and they are far slower than Z3 or CVC5. - **Rigorous floating-point results.** ζ, θ and Z are computed in `Double`, checked against closed forms and tables to stated tolerances, without interval error bounds. ## How to get started ```bash cabal build all && cabal test all && cabal run mp-gate # GHC 9.10.1, cabal 3.12 cabal run mp-gate -- mutants # planted-defect replay agda --no-libraries -i formal formal/Everything.agda # Agda 2.6.3 cd liquid && cabal update && cabal build all && cd .. # Liquid Haskell, needs z3 ./dex/build.sh && ./dex/check.sh # Dex, pinned toolchain ``` ## Evaluation There are no benchmark numbers, because there is nothing to benchmark in the machine-learning sense. Correctness is checked instead. On revision `3877b96`, these results were run in a Linux development container on 2026-11-16: | Check | Result | | --- | --- | | Haskell tests | 225 checks across 8 packages, all passing | | Claim register | 65 conformance IDs, each tagged on at least one test | | Planted defects (`mp-gate mutants`) | 34 of 34 caught, across code, Agda proofs, Liquid Haskell refinements and Dex | | Agda (`--safe --without-K`) | all modules check | | Liquid Haskell 0.9.10.1.2 + Z3 4.8.12 | `LIQUID: SAFE (491 constraints checked)` on `MP.Lambda.Simple` | | Dex (commit `25e2e38`, LLVM 12) | quine check passes | | Riemann zeta zeros | all 512 tabulated by Odlyzko up to height 826.9 are found independently, each within 1e-8 | The repository's GitHub Actions workflows had not yet run when these results were recorded. ## What is proved, and what each result trusts Every claim has one of five honesty levels, and the build fails if they are blurred: | Level | Meaning | Trusts | | --- | --- | --- | | `some-true` | reproduced from a cited authority; not established here | the authority | | `build` | constructed here and checked by a test against an oracle; evidence, not proof | the test and its oracle | | `open` | measured and reported; never asserted | — | | `proved` | machine-checked by Agda under `--safe` | Agda's kernel | | `refined` | checked by Liquid Haskell | Liquid Haskell and Z3 | The `proved` results are: - Strassen's identities hold in any abelian group with a two-sided distributive product. - The abelian-group normaliser used to prove them is sound. - The Kish lower bound Σwᵢ² ≤ (Σwᵢ)² holds. The `refined` result is that `MP.Lambda.Simple`'s functions terminate, its size measure is at least 1, and its pattern matches are total. ## Limitations - **Proofs are about the mathematics, not the Haskell.** That `MP.Matrix.strassenSq` computes exactly the products proved correct in Agda is checked by reading and by tests, not mechanically. - **Hcalc decides over ℚ.** Validity over ℚ implies validity over ℤ, so refinement checking is sound for integer programs. It is incomplete for them: `x < y ⟹ x + 1 ≤ y` is rejected, and a test shows it. - **Hcalc's trusted base** is its Tseitin encoding and its reading of terms as linear expressions. Models and certificates are checked independently. - **Completeness of the zero table** is Odlyzko's result, not re-verified here with Turing's method. - **The explicit formula's truncation error** is measured, not bounded. - **Dex** is pinned to its last upstream commit (January 2024). It needs LLVM 12, which `dex/build.sh` installs from Ubuntu 22.04's packages. ## Licence GNU Affero General Public License v3.0 or later ([`LICENSE`](LICENSE)). Parts adapted from the UOR Foundation's repository template keep their MIT / Apache-2.0 notices; see [`NOTICE`](NOTICE) and [`LICENSES/`](LICENSES). ## Sources The authorities the tests compare against are listed, with full citations, in [`model/authorities.toml`](model/authorities.toml). They include Humphreys, *Reflection Groups and Coxeter Groups*; Bourbaki, *Lie Groups and Lie Algebras* ch. 4–6; Strassen (1969); Bareiss (1968); Massey (1969); Edwards, *Riemann's Zeta Function*; and Odlyzko's tables of zeta zeros.