certXiv
Journal of Certified & Reproducible Science
Official Open-Access Journal · Frontier AI & Kernel Audited · Beyond Legacy Peer Review
← Back to Published Journal Articles
TCB-2 · Reproducible Compute External Challenge Target (ZENODO) · Verification Overlay cs.AI ⚙ Lean 4 zenodo:24663045 · DOI: https://doi.org/10.5281/zenodo.24663045 · 2026-11-29

Machine-Checked Formalization and Bidirectional Specification Equivalence of Residue-Conditioned Natural Density in Lean 4

Dagli, Volkan, Dagli, Zerrin, Dagli, Daghan
Read Official PDF View Proof / Code Artifact ↗ JSON / Agent Record

Abstract

Formalizing elementary number-theoretic density results in an interactive theorem prover exposes a recurring verification-engineering challenge: two distinct formalizations of the same informal specification — one phrased functionally via arithmetic radicals and integer congruences, the other phrased set-theoretically via finite prime-support operations — can diverge subtly on edge cases unless their equivalence is itself machine-checked. We present a modular, zero-sorry, zero-custom-axiom Lean 4 (v4.21.0 / Mathlib4) formalization of residue-conditioned coprimality natural density (formulated as the General Divisor Theorem in an unreviewed specification by Hawkley), comprising 7 production modules (2,311 lines of code, 60 top-level kernel-checked theorems). For any positive integers N, m and residue a, with d = rad(gcd(m, N)), R = rad(N)/d, and T_min = mR, the development machine-checks: (i) the exact admissible/inadmissible dichotomy (emptiness vs. period T_min); (ii) exact per-period count phi(R) via an explicit affine permutation on ZMod R; (iii) closed-form arbitrary-bound counting C(q T_min + s) = q phi(R) + C(s); (iv) the explicit finite-sample convergence rate |C(X)/X - phi(R)/T_min| <= T_min/X for all X > 0 and asymptotic natural density via the real squeeze theorem; (v) the integer correction identity underlying d/phi(d); and (vi) a bidirectional specification-equivalence bridge proving parameter, predicate, periodicity, and benchmark agreement between the functional arithmetic and prime-support Finset specifications. All 18 headline theorems are audited in CI via #print axioms, depending strictly on [propext, Classical.choice, Quot.sound].

Trusted Computing Base & Merkle Digest

Grade: TCB-2 (Backed by executable verification code, simulation scripts, or hybrid formal+tested artifacts with SHA-256 integrity hash.)
Verifier Notes: Seeded with linked Lean 4 artifact (https://github.com/pCwOrM/general-divisor-theorem); eligible for sandboxed TCB-0/TCB-1 promotion.
SHA-256 Root: c155ade8154b39cd6d9a99e8…

Human + AI Provenance & License

AI / Tooling: Indexed from Zenodo Open Preprints
Human Accountability: Dagli, Volkan, Dagli, Zerrin, Dagli, Daghan
Distribution License: CC BY 4.0 (Full-text mirror permitted)

Embed Verification Shield in GitHub README

certXiv TCB-2 badge

Frontier AI Scientific Review (Rubric v1.0 · Beyond Legacy Peer Review)

External challenge target (verified via certXiv TCB & OAI-PMH overlay). Official journal submissions receive automatic Frontier AI Scientific Reviews (GPT-6.2 Astra).

Machine-Readable Claims & Declarations (0)

No structured formal declarations attached yet. Human or AI contributors can attach a Lean 4 / Rocq / SAT certificate repository to promote this paper's TCB tier.

Upgrade Verification Tier for zenodo:24663045

Attach a Lean 4, Rocq, Isabelle, or SAT/SMT certificate repository that formalizes or certifies claims in this paper.

Public GitHub, GitLab, or Zenodo URL containing the formalization or certificate.

External Preprint Overlay Controls (zenodo:24663045)

This record indexes public ZENODO metadata under CC0 1.0. Original authors can claim this overlay, attach an official repository, or request display removal.