Papers
Topics
Authors
Recent
Search
2000 character limit reached

Formal Foundations and Proof-Carrying Certificates for q-ary Covering Codes in Lean 4

Published 8 Jun 2026 in cs.IT | (2606.09600v1)

Abstract: Covering codes in finite Hamming spaces ask for small sets of words whose Hamming balls cover the whole space. This paper presents a Lean 4 formalization of the elementary theory of q-ary covering codes, centered on certificate predicates for upper bounds, lower bounds, and exact covering numbers $K_q(n,r)$. The formalization proves the q-ary Hamming-ball volume formula, the sphere-covering lower bound, elementary exact cases, product and relation rules, and selected small exact certificates. It also demonstrates an end-to-end workflow for checking explicit upper bounds transcribed from van Laarhoven et al. (1989). The accompanying database is proof-carrying: stored bounds have traces that replay to Lean proofs of the corresponding upper- or lower-bound predicates. The contribution is not new record bounds or a reproduction of known tables, but a reusable, auditable foundation for machine-checked covering-code certificates.

Authors (1)

Summary

  • The paper introduces a proof-carrying certificate framework in Lean 4 to rigorously formalize q-ary covering codes.
  • It formalizes finite Hamming spaces and derives the Hamming-ball volume formula, establishing key bounds such as the sphere-covering bound.
  • The work implements an auditable, scalable database approach to verify explicit codes and supports integration with advanced computational methods.

Formalization of qq-ary Covering Codes with Proof-Carrying Certificates in Lean 4

Introduction and Context

The paper "Formal Foundations and Proof-Carrying Certificates for qq-ary Covering Codes in Lean 4" (2606.09600) describes a comprehensive formalization of finite Hamming spaces, qq-ary covering codes, and associated certificate-based interfaces in Lean 4. Unlike previous work focused predominantly on error-correcting codes, this research targets the formal certification of covering codes—codes whose Hamming balls of a specified radius cover the entire discrete word space of length nn over an alphabet of size qq. The emphasis is on a proof-carrying infrastructure that modularizes upper and lower bounds and produces machine-checkable certificates for key quantities like the covering number Kq(n,r)K_q(n,r).

Formalization Strategy and Architectural Choices

A central design decision is to represent codewords as functions from finite coordinate types to alphabet types. In Lean, this corresponds to types of the form Fin n→Fin q\mathrm{Fin}\ n \to \mathrm{Fin}\ q for classical qq-ary codes, but the infrastructure is deliberately kept more general to support applications with dependent coordinate-wise alphabets. All associated combinatorial objects, such as Hamming balls and code predicates, are defined directly in this functional framework. This abstraction provides robust generality while maintaining compatibility with the classical qq-ary setting and efficient kernel-level transparency in Lean.

Crucially, covering numbers are not defined as concrete functions minimized computationally—this would require noncomputable definitions and early commitment to representation choices in the proof engine. Instead, the formalization employs certificate-style logical predicates: for a given kk, predicates attesting to (i) the existence of size-qq0 covering codes (upper-bound certificates), (ii) nonexistence of smaller ones (lower-bound certificates), or (iii) both, yielding exact covering number certificates. This separation captures the native structure of most mathematical proofs in this area and supports direct compositionality.

Main Formal Results

The body of results formalized includes:

  • Finite Hamming Space Abstractions: General types for words, formal definitions of Hamming distance, balls, shells, and fundamental properties (e.g., triangle inequalities, ball monotonicity).
  • Hamming-Ball Volume Formula: A formalized, constructive proof of the classical closed-form formula for the volume of a Hamming ball,

qq1

which underpins various analytical lower bounds.

  • Sphere-Covering Bound: The formal statement and proof that any covering code qq2 of radius qq3 must satisfy qq4, as each codeword's Hamming ball can cover at most qq5 points.
  • Elementary Exact Results: Machine-checked, certificate-form proofs of trivial and near-trivial cases, such as qq6, qq7 for qq8, and exactness results for small parameters.
  • Product and Relation Theorems: General product construction results, stating that products of codes add their radii, as well as a suite of certified parameter-transport rules. This includes radius and length monotonicity, puncturing, lengthening, alphabet operations, direct products, block grouping, concatenation, and structural transformations, all encoded as proof-carrying transformations on the associated predicates.
  • Database and Trace Layer: An extensible proof-carrying database architecture, with entries not only storing numerical bounds but full derivation traces. These traces replay to Lean proofs for upper and lower bound predicates, making the database auditable, self-correcting, and extensible to new certificate forms (e.g., via imported results or computational searches).

Practical Case Studies

The formalization workflow is put into practice by importing explicit covering codes from the literature, specifically the van Laarhoven et al. constructions for qq9, qq0, and qq1. Raw code data was transcribed and encoded in a packed representation, then the covering property and cardinality were verified by Lean, yielding certified upper-bound predicates. This process revealed transcription errors, underscoring the value of mechanized verification even for published constructions.

For large codes (e.g., hundreds of codewords), standard finite-set representations in Lean can become infeasible due to recursion depth and memory limits; the paper circumvents this by using packed-integer encodings and a switchable proof mode (kernel vs. native evaluation) for efficiency, albeit with a clearly articulated trust boundary.

Proof-Carrying Database and Auditability

A key contribution is the implementation of a database for covering-code bounds, where each entry is backed by a replayable certificate trace. Primitive leaves are validated theorems for explicit upper and lower bounds, which are propagated through certified relation rules until fixpoint. Compositionality is enforced: new proof objects or sources can be added, and all derived bounds remain auditable. Consistency between lower and upper bounds is maintained by mechanism, and each bound is reproducibly certified in Lean.

This design establishes a clear and minimal trust boundary: only theorem statements and primitive artifacts checked by Lean are considered trusted; all data-generation steps, external code, and computational proof modes are articulated as untrusted infrastructure or as optional layers.

Implications, Theoretical and Practical

The formalization addresses both foundational and workflow aspects for covering code research:

  • Theoretical Rigor and Reproducibility: All claims, including edge cases and degenerate parameters (such as empty alphabets or word spaces), are formal statements, not informally handled conventions. This results in a dataset and codebase where every bound is, in principle, machine-verifiable.
  • Scalability and Extensibility: The proof-carrying database structure can be extended to much larger parameter regimes, provided suitably encoded code data and covering predicates. The abstract certificate predicates support the anticipated integration of future lower-bound methods (e.g., LP, SDP, SAT-based exhaustive search).
  • Interoperability: The Lean artifact is designed to interface with computational code searchers, and the separation between code/data generation and proof checking ensures that only minimal trust is assumed in unverified components.
  • Auditable Path from Literature to Certified Result: Published explicit codes become machine-verified upper-bound certificates, and can be composed with independently verified lower bounds to yield exactness claims, sharpening reproducibility standards in combinatorial coding theory.

Future Directions

The infrastructure supports several future lines:

  • Stronger Lower Bounds: Integration of LP, SDP, or more sophisticated combinatorial arguments as lower-bound certificates tied into the same interface.
  • Scalable Importation: Mechanizing the import and certification of very large explicit codes from literature or computational search via structured, efficient certificates.
  • Structural Code Information: Storing more explicit code structure, patterns, or symmetry reductions to drive automated search and closure more efficiently.
  • Solver-Integrated Certification: Systematic incorporation of computational search results (e.g., SAT/ILP solvers) as certificates, with the same audit trail and compositional closure machinery.
  • Upstream Integration: Alignment with broader mathematical libraries (e.g., Mathlib) for maximal interoperability and reuse across proof assistant ecosystems.

Conclusion

This work establishes a foundational, auditable, and modular infrastructure for the formal certification of qq2-ary covering codes. By attaching certificates to all claims and making the combinatorial and computational workflow reproducible in Lean, the paper sets a standard for reproducibility and rigor in the formalization of coding-theoretic bounds. The methods and architecture are positioned for direct extension to more advanced or computationally demanding instances, offering a blueprint for trustworthy combinatorial databases and computational mathematics broadly.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.

Tweets

Sign up for free to view the 1 tweet with 5 likes about this paper.