File size: 7,220 Bytes
5316c4e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
---
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.