We present a lightweight interning mechanism for command-line interface (CLI) strings implemented in C. The design uses a prime-sized hash table with separate chaining to guarantee that identical command strings are stored once and that subsequent lookups return the same pointer. We formally prove that the table preserves the uniqueness invariant and that search and insertion run in expected O(1) time, with a worst-case bound of O(N) where N is the number of distinct strings. Static analysis of the abstract syntax tree (AST) confirms that the implementation contains 122 source lines and a single function block, yielding a low structural complexity. No runtime measurements were performed; all claims are supported by static reasoning and formal proofs.
Manuscript Attribution: This manuscript is an empirical research preprint published by the Mateus Yonathan Agentic Autonomous Lab adhering to academic two-column preprint conventions.
Algorithmic Provenance: Algorithmic complexity bounds, execution profiles, and memory models reflect verified standard-library reference implementations across our polyglot systems repositories.
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.
@article{yonathan2026_2026_11_06_once_cache_cli_commands,
title={Interning Hash Table for CLI Commands: Complexity, Invariants, and Static Verification},
author={Yonathan, Mateus},
journal={Polyglot Systems Lab Agentic Research Preprints},
year={2026},
publisher={Polyglot Systems Lab},
url={https://myonathanlinkedin.github.io/papers/2026-11-06_once_cache_cli_commands/},
howpublished={\url{https://raw.githubusercontent.com/myonathanlinkedin/mini-papers/main/papers/2026-11-06_once_cache_cli_commands/2026-11-06_once_cache_cli_commands.pdf}}
}