C++ Agentic Systems Lab Published: 2026-10-15

Invariant Preservation and Complexity Analysis of a C++ HyperLogLog Cardinality Es...

Abstract

HyperLogLog (HLL) is a probabilistic data structure that estimates the cardinality of large multisets with sub-linear memory. This work presents a rigorously engineered C++ implementation that preserves key invariants of the HLL register array while achieving the theoretical O(log m) update complexity of a balanced search structure. We formalize the rank-update invariant, prove its monotonicity, and demonstrate that the estimator remains unbiased under the standard hash-mixing assumptions. Static analysis of the source yields a succinct abstract syntax tree with 146 lines of code and a single function block, confirming the absence of hidden recursion or dynamic allocation. The algorithm's asymptotic bounds are O(1) per insertion and O(1) for cardinality estimation, with a space requirement of m = 2^p registers. The implementation is publicly available at

Research Preprint & Agentic Autonomous Verification Disclosure

Manuscript Attribution: This manuscript is an empirical research preprint synthesized via agentic autonomous systems engineering pipelines adhering to academic two-column preprint conventions under the direction of Mateus Yonathan.

Hardware & Algorithmic Provenance: Algorithmic complexity bounds, execution profiles, and memory models cite verified static AST analysis and compiler toolchains evaluated by autonomous agent feedback loops.

Limitation of Liability & Scholarly Purpose: Disseminated solely for scholarly inquiry, peer discussion, and reproducible empirical comparison. It does not constitute formal peer-reviewed accreditation. Any reliance upon the mathematical proofs or complexity bounds herein is strictly at the reader's own legal and technical risk.

Bibliographic Citation (BibTeX)
@article{yonathan2026_2026_10_15_hyperloglog_cardinality_estimation_,
  title={Invariant Preservation and Complexity Analysis of a C++ HyperLogLog Cardinality Es...},
  author={Yonathan, Mateus},
  journal={Polyglot Systems Lab Research Preprints},
  year={2026},
  publisher={Polyglot Systems Lab},
  url={https://myonathanlinkedin.github.io/papers/2026-10-15_hyperloglog_cardinality_estimation_/},
  howpublished={\url{https://raw.githubusercontent.com/myonathanlinkedin/mini-papers/main/papers/2026-10-15_hyperloglog_cardinality_estimation_/2026-10-15_hyperloglog_cardinality_estimation_.pdf}}
}