All 57 Entries

Bounded Entropy in Formal Languages: A Mathematical Foundation for Deterministic Code Generation

December 15, 2025 founding whitepaper auditing 2.3 million Rust functions across 50,000 repositories (94.7% under 1.0 bit of signature-conditioned entropy), paired with November 25, 2026 errata correcting its kWh/MWh daily unit slip and dimensional objective formula.

David Charlot • • Addendum & Errata: Nov 25, 2026 • 10 min read • Glossary • Verification & AI-Use Disclosure
bounded-entropy shannon-entropy deterministic-lookup rust code-generation historical-whitepaper

Part I: Contemporary Historical Summary (As Written in December 2025)

Historical Source Provenance (Original Date: December 15, 2025): David Jean Charlot, PhD · Open Interface Engineering. Preserved from our Wave I formal-methods whitepaper (Download Original Dec 2025 PDF).

Abstract & Core Thesis

Natural languages such as English carry roughly 1.0 to 1.5 bits of Shannon entropy per character after accounting for context (Shannon, 1951). Autoregressive large language models were engineered for that open-ended distribution: every next token navigates nuance, metaphor, and human ambiguity.

Formal programming languages inhabit a narrower regime. Measuring token-level and signature-conditioned empirical entropy across 2.3 million Rust functions mined from 50,000 open-source repositories (847M lines of code) in late 2025 yielded a sharp concentration: 94.7% of audited Rust function bodies exhibited less than 1.0 bit of conditional entropy given their normalized type signature and surrounding trait context (H(body | sig) < 1.0 bit), and 76.2% sat below 0.5 bits.

Treating 0.35 bits/char typed systems code as if it were 1.3 bits/char natural prose invokes billion-parameter matrix multiplications to reconstruct deterministic type obligations on every completion. The December 2025 thesis proposed inverting the synthesis stack: resolve low-entropy formal structure through exact pattern, type-directed, and AST lookup (L0–L3), and invoke frontier neural inference (L5) strictly on the ~1.3% tail where genuine semantic ambiguity remains.

Constraint Stacking & Rust Corpus Audit

To model why formal code entropy is compressed relative to natural prose, the whitepaper expressed syntactic, type, library, and domain restrictions as multiplicative reductions on the raw token space S_0 (Superseded / corrected — see Nov 25, 2026 Errata below):

Constraint Stacking Reduction (as written in Dec 2025):
  |S_c| = |S_0| * rho_syn * rho_type * rho_stdlib * rho_domain

Observed per-character entropy across corpora (Dec 2025 n-gram/compression audit):
  English prose (Shannon 1951) :  1.00 - 1.50 bits/char
  Python 3 source              :  0.42 bits/char
  Java source                  :  0.38 bits/char
  Rust source (affine + traits):  0.35 bits/char

Illustrative Rust survival-fraction product:
  rho_syn (grammar) * rho_type (borrow + traits) * rho_stdlib * rho_domain
  ≈ 0.001 * 0.01 * 0.10 * 0.05 = 5.0e-8

Once a Rust function specifies its parameter types, lifetimes, trait bounds, and Result<T, E> return contract, valid implementations frequently collapse to a single canonical AST equivalence class up to alpha-renaming. Across the 2.3M-function corpus (82.1% of normalized signature keys recurred across distinct repositories), conditional implementation entropy partitioned into four bands:

Conditional Entropy Band H(body | sig)Share of 2.3M Rust FunctionsRepresentative Code ArchetypesProposed Synthesis Mechanism
< 0.5 bits76.2%Trait impls (From, Display, Error), getters, iterator adapters, Serde/DTO mappersL0–L1 Exact Pattern & LSP Type-Directed
0.5 – 1.0 bits18.5%Standard collection pipelines, bounded CRUD handlers, parser combinatorsL2 Deterministic AST Search
1.0 – 2.0 bits4.1%Multi-branch domain state machines, custom retry/backoff policiesL3–L4 Embedding + Constrained Synthesis
> 2.0 bits1.2%Novel algorithms, custom lock-free kernels, domain-specific physicsL5 Frontier Neural Inference

The December 2025 text argued that in the zero-entropy limit (H(body | sig) -> 0), the Kullback–Leibler divergence between a verified pattern lookup distribution P(sigma) and a neural code distribution N(sigma) vanishes (D_KL(P(sigma) || N(sigma)) -> 0) (Superseded / corrected — see Nov 25, 2026 Errata below), while stochastic sampling incurs a ~15% compile-retry overhead.

Six-Layer Lookup-Before-Inference Cascade (L0–L5)

To operationalize that distribution, the whitepaper specified a six-layer Lookup-Before-Inference cascade and proposed a scalar Computational Wisdom ratio (Superseded / corrected — see Nov 25, 2026 Errata below):

Computational Wisdom (as written in Dec 2025 — dimensionally unnormalized; see Errata):
  W = C / (E + T + M)
  where C = verified correctness, E = energy, T = latency, M = memory footprint
  Principle: Knowing when NOT to infer.
LayerMechanismCorpus Hit ShareCumulative CoverageMedian LatencyModel Basis (Dec 2025)
L0 Exact PatternContent-addressed signature + trait hash lookup62.4%62.4%0.3 msDeterministic (0 neural params)
L1 LSP-Augmentedrust-analyzer type-hole & trait-obligation completion18.7%81.1%4.2 msType-checked symbolic fill
L2 AST SearchStructural tree-sitter / e-graph equivalence match9.3%90.4%28 msVerified structural isomorphism
L3 Embedding RetrievalCompact local vector index over verified templates6.2%96.6%71 msGuarded retrieval + compiler check
L4 Constrained SynthesisGrammar/type-masked small-model fill2.1%98.7%340 msConstrained local synthesis
L5 Frontier LLMFull autoregressive reasoning on > 2.0 bit tail1.3%100%2.8 sFull neural inference

For energy scaling at 1,000,000 daily completions, the original December 2025 text modeled 0.075 Wh (270 J) per frontier LLM call versus 0.00103 Wh (3.71 J) blended across L0–L5, printing a daily aggregate figure of "103 MWh/day -> 1.03 MWh/day" (Superseded / corrected — see Nov 25, 2026 Errata below).


Formal & Arithmetic Errata (2026-11-25 Audit)

  1. kWh vs. MWh Daily Unit Error (1,000x Prefix Slip) and Exact Ratio Reconciliation:
    • Per-Call Base Ratio: 0.075 Wh (270 J frontier LLM call numerator) divided by 0.00103 Wh (3.708 J blended L0–L5 cascade denominator) equals 72.82x (~72.8x).
    • Daily Scaling at 1,000,000 Calls:
      • Base frontier LLM: 1,000,000 × 0.075 Wh = 75,000 Wh/day = 75.0 kWh/day (kilowatt-hours, NOT megawatt-hours!).
      • With the stated 15% compile-retry overhead (× 1.15): 75.0 kWh/day × 1.15 = 86.25 kWh/day (310.5 J/call), giving an exact retry-adjusted energy ratio of 86.25 kWh / 1.03 kWh = 83.74x (~83.7x). (Reaching a numerical prefix of 103.5 requires a 38% retry overhead 75.0 × 1.38 = 103.5 kWh/day, still in kWh/day, not MWh/day.)
      • Blended L0–L5 cascade: 1,000,000 × 0.00103 Wh = 1,030 Wh/day = 1.03 kWh/day (NOT 1.03 MWh/day). Reaching 86.25 MWh/day vs. 1.03 MWh/day would require 1,000,000,000 (1B) daily completions across an industry-wide fleet rather than 1M calls.
  2. Dimensional Invalidity of W = C / (E + T + M):
    • Adding raw joules (E), seconds (T), and bytes (M) in the denominator E + T + M is dimensionally invalid (J + s + B has no physical unit and changes arbitrarily under unit rescaling such as ms vs. s or MB vs. B).
    • A well-formed scalar surrogate requires dimensionless normalization against explicit task reference budgets: W_norm = C / (E / E_ref + T / T_ref + M / M_ref). Because scalar trade-off weights still permit trading away correctness or hard SLA limits, subsequent OpenIE specifications abandoned W in favor of lexicographic gating: enforce verified correctness C = 1 and hard latency/memory bounds (T <= T_max, M <= M_max) first, then rank surviving implementations strictly by physical energy E.
  3. Exact Realizability Condition on D_KL(P(sigma) || N(sigma)) -> 0 and Heuristic Status of “Constraint Stacking”:
    • Vanishing conditional entropy H_P(body | sig) -> 0 implies that the ground-truth distribution P(sigma) concentrates onto a point mass 1 over the canonical AST equivalence class b*. However, D_KL(P(sigma) || N(sigma)) = -log N(b* | sigma) approaches 0 if and only if the neural model N is realizable and calibrated in the limit N(b* | sigma) -> 1. Any nonzero model misspecification, temperature floor, or BPE tokenization split leaves D_KL > 0 (which is precisely why nonzero compile-retry rates persist!).
    • Furthermore, what Part I labeled the “Constraint Stacking Theorem” (|S_c| = |S_0| * rho_syn * rho_type * rho_stdlib * rho_domain) multiplies marginal survival factors that are strongly statistically correlated in real compilers (e.g., standard-library calls are already syntactically valid and strongly typed). It should be read strictly as an illustrative correlated multiplicative heuristic, not a formal theorem.

Methods, Provenance & Licensing Scope Box (est_j)

  • Epistemic Class (est_j — Analytical TDP Projection & Static Corpus Audit): Both 270 J (0.075 Wh) and 3.71 J (0.00103 Wh) were analytical server-TDP × latency estimates (est_j), not on-chip counter (reported_j) or inline DC shunt (measured_j) measurements. Conditional entropy H(body | sig) was estimated after α-normalizing local identifiers and stripping comments; raw surface text exhibits higher entropy than AST-normalized equivalence classes.
  • Artifact & Licensing Status: Archival PDF (#01) is publicly available at /papers/archive/01-Bounded-Entropy-Code-Generation.pdf under CC BY-ND 4.0. The original December 2025 corpus-mining prototype (openIE-dev/deterministic-coding) is a private repository (unreproduced externally); our clean-room November 2026 zero-parameter lookup benchmark is public at openIE-dev/deterministic-null.

Chronological Evolution Within OpenIE Research

  1. Zero-Parameter Hardware-Counter Baselines (The Deterministic Null): Explored the same lookup-before-inference hypothesis under reported_j hardware counters across 10 bounded engineering tasks, where a zero-parameter deterministic baseline tied frontier cloud AI on 9 of 10 tasks with a 3.59x repeat-workload energy reduction.
  2. Compiler-Embedded Structural Memoization (RCE-Compile): Tested content-addressed IR memoization inside the Reality Code Engine compiler, achieving up to 448.5x warm-cache cut (chip counter, reported_j) across 2,221 deterministic verification checks.
  3. Boolean Hardware Lookup (Downward LUT6 Compilation): Extended table-lookup amortization from software AST caches down to 64-entry LUT6 logic primitives (970 MB active streaming RAM on a 34.66B stack).
  • Shannon, C. E. (1951). Prediction and Entropy of Printed English. Bell System Technical Journal, 30(1), 50–64.
  • Hindle, A., Barr, E. T., Su, Z., Gabel, M., & Devanbu, P. (2012). On the Naturalness of Software. ICSE 2012, 837–847 — foundational empirical discovery that real-world source code has dramatically lower cross-entropy than natural language.
  • Allamanis, M., Barr, E. T., Devanbu, P., & Sutton, C. (2018). A Survey of Machine Learning for Big Code and Naturalness. ACM Computing Surveys, 51(4), Article 81 — comprehensive synthesis of code naturalness, type-guided completion, and idiomatic mining.
  • Roy, C. K., Cordy, J. R., & Koschke, R. (2009). Comparison and Evaluation of Code Clone Detection Techniques and Tools. Science of Computer Programming, 74(7), 470–495; Sajnani, H., et al. (2016). SourcererCC. ICSE 2016 — prior art on Type-1/2/3 inter-repository code redundancy.
  • Lu, S., Duan, N., Han, H., Guo, D., Hwang, S.-W., & Svyatkovskiy, A. (2022). ReACC: A Retrieval-Augmented Code Completion Framework. ACL 2022 — hybrid retrieval-before-generation code synthesis.

Changelog (2026-11-25)

  • Separated Part I (December 15, 2025 original summary) from Part II (November 25, 2026 formal errata, provenance, and related work).
  • Corrected the 1,000x MWh/day -> kWh/day unit error (75.0 kWh/day base, 86.25 kWh/day at 15% retries vs. 1.03 kWh/day; 72.8x base and 83.7x retry-adjusted ratios).
  • Documented the dimensional invalidity of W = C / (E + T + M) and its replacement by lexicographic correctness-first gating.
  • Qualified D_KL(P(sigma) || N(sigma)) -> 0 with the exact neural realizability condition and relabeled "Constraint Stacking" as a correlated multiplicative heuristic rather than a theorem.
  • Added foundational citations to Hindle et al. (ICSE 2012), Allamanis et al. (2018), clone detection (Roy et al., 2009; SourcererCC, 2016), and retrieval-augmented code completion (ReACC, 2022).
DC

David Charlot

Open Interface Engineering, Inc. · Signed Provenance · Self-Checked

Archival PDF (#01) public at /papers/archive/01-Bounded-Entropy-Code-Generation.pdf under CC BY-ND 4.0; original deterministic-coding repository is private (externally unreproduced); November 2026 successor repo openIE-dev/deterministic-null is public. Full licensing & AI-use disclosure →

Archival PDF (#01, Dec 15, 2025); original corpus scripts in private deterministic-coding repo (unreproduced externally); successor baseline public at openIE-dev/deterministic-null

Check the primary artifacts or run an independent replication

Inspect signed provenance manifests, rerun our public Apache-2.0 commodity-hardware replication kits, review our November 25, 2026 outside-review errata, or browse primary manuscripts on the Research Hub.