Axiomatic Reasoning for LLMs

Logic behind Deep Coding

1. Core Premises

  1. Intent–Structure–Implementation Separation
    Any software system can be partitioned into three layers:
    • Intent: high-level human objective (purpose, constraints, desired behaviors).
    • Structural Specification: a machine‑interpretable, closed‑form description of interfaces, dependencies, allowed interactions, and invariants.
    • Implementation: executable code that conforms to the structural specification.
  2. Generative Conformance
    Implementation is not written manually but generated from the structural specification.
    The generation process is constrained such that the output is guaranteed to satisfy the specification by construction.

  3. Recursive Refinement with Fixed Premises
    Systems are built incrementally through phases.
    After each phase, a structured summary (fixed premise) captures all design decisions and verified invariants.
    Subsequent phases treat this summary as immutable, preventing context drift and enabling local reasoning.

  4. Skeleton–Tissue Architecture
    The structural specification is physically realized as a skeleton (invariant base classes, interfaces, cross‑cutting concerns) that is human‑maintained and AI‑inaccessible for modification.
    The tissue (business logic, concrete implementations) is fully generated by AI from the specification.

  5. Negentropy as Information Density
    The quality of a specification is measured by its inferential information density:
    [ \text{ID} = \frac{I(M)}{C(M)} ]
    where (I(M)) is the Kolmogorov complexity (minimum description length) of module (M), and (C(M)) is the cognitive cost (number of inference steps) to understand or modify it.
    Maximizing ID means capturing maximum constraints in minimal description, reducing ambiguity and inference overhead.

2. Structural Separation Principle

Axiom 1 (Separation of Concerns)
The structural specification and the implementation are distinct artifacts.
The specification defines what must be satisfied; the implementation defines how it is satisfied.

Axiom 2 (Single Source of Truth)
All inter‑module dependencies, allowed dependency directions, interface signatures, and invariants are encoded exclusively in the structural specification.
No such constraints appear only in implementation code.

Axiom 3 (Referential Transparency of Specification)
Given a structural specification (S) and a generation function (G),
[ \forall M \in \text{Implementation}(S),\; \text{Conforms}(M, S) = \text{true} ]
and any modification to (S) yields a new set of implementations that automatically satisfy the updated specification.

Consequence:
Bugs caused by interface mismatches, hidden dependencies, or inconsistent constraints become impossible at the implementation level.


3. Generative Conformance

Definition (Generative Conformance)
A system is generatively conformant if the only way to produce implementation code is through a deterministic or verifiable mapping from the structural specification, and the mapping is provably correct with respect to the specification.

Implementation Mechanism:

Property:
Because generation and validation are separated and validation is deterministic, the probability of generating a non‑conforming implementation is reduced to the error rate of the validation mechanism (which can be made arbitrarily close to zero through static analysis).


4. Recursive Refinement and Fixed Premise

Definition (Fixed Premise)
A fixed premise is a structured summary of all design decisions, verified invariants, and the current structural specification after a completed phase.
It is treated as immutable for all subsequent phases unless explicitly overridden by a new phase plan.

Recursive Refinement Loop:

  1. Phase Planning: Decompose the next increment into a set of changes to the structural specification.
  2. Specification Update: Apply the planned changes to the structural specification (only).
  3. Regeneration: Generate all affected implementation modules from the updated specification.
  4. Validation Gate: Verify that the new implementation conforms to the updated specification.
  5. Fixed Premise Update: If validation passes, commit the new specification and the summary of changes as the new fixed premise.
  6. Repeat.

Property:
The recursion is incremental and reversible—any phase can be rolled back by restoring the previous fixed premise.
Because each phase starts from a fully known and verified state, the cognitive load does not grow with system size; it remains linear with the number of phases.


5. Skeleton–Tissue Architecture

Structural Realization:

Property:
The skeleton acts as a physical firewall: AI‑generated code cannot bypass the skeleton’s constraints because the skeleton owns the execution context (e.g., run() method in a base class that calls the AI‑implemented abstract method).
This guarantees that cross‑cutting concerns are always enforced, regardless of the quality of the generated code.


6. Information‑Theoretic Foundation (Negentropy)

Definition (Inferential Information Density)
Let (S) be a structural specification.

The inferential density (\text{ID}(S) = \frac{I(S)}{C(S)}) measures how much constraint is packed per unit of cognitive cost.

Maximization Strategy:

Empirical Correlate:
Systems with high (\text{ID}) exhibit:

Relation to Negentropy:
In Shannon’s terms, a high‑ID specification has low entropy (high order).
The generation process from specification to implementation does not increase entropy—it preserves the structure, thereby resisting the natural tendency toward disorder (analogous to “heat death” in software aging).


7. Implications for Correctness and Self‑Modification

Theorem (Elimination of Implementation‑Level Bugs)
If

  1. the structural specification is complete and correct,
  2. the generation function (G) is correct (i.e., always produces conforming code), and
  3. the validation gate rejects any non‑conforming output,
    then no implementation‑level bugs (violations of the specification) can exist.
    All residual errors are confined to the specification layer.

Theorem (Self‑Modification via Specification Update)
Any desired change to system behavior can be expressed as a modification to the structural specification.
Because the skeleton is invariant and the tissue is regenerated from the updated specification, the resulting system is globally consistent after a single regeneration step.
No manual propagation of changes across modules is required.

Corollary (Boehm Curve Collapse)
The exponential cost increase of fixing bugs discovered late in development disappears.
The cost of any change becomes the sum of:


8. Boundary Conditions

The logic above holds under the following conditions:

Condition Required Rationale
Specification completeness Yes If the specification omits a required constraint, the generated system will be “correct” relative to the incomplete specification but may fail in practice.
Generation correctness Yes Statistical language models have a non‑zero error rate; practical systems must use deterministic code generation (e.g., from ASTs) or multi‑agent validation to approach correctness.
Skeleton enforceability Partial Template‑method patterns require object‑oriented languages with inheritance. Functional or procedural paradigms require different mechanisms (e.g., effect systems) to achieve the same physical firewall.
System scope Single repository, single decision‑making authority Cross‑organization or distributed systems lack a single structural specification; only interface‑level conformance can be guaranteed.
Non‑functional requirements Partially specifiable Performance, security against unknown threats, and emergent behaviors cannot be fully captured in static specifications; they require runtime monitoring and traditional verification.

When these conditions are not met, the system reverts to a hybrid mode where the methodology applies to the specifiable subset, and conventional development handles the remainder.


9. Conclusion

Deep Coding formalizes software construction as a three‑layer process:

By enforcing generative conformance, maintaining fixed premises through recursive refinement, and physically separating invariant architecture (skeleton) from generated logic (tissue), the framework eliminates entire classes of implementation‑level bugs and enables self‑modification through specification‑only updates.

The theoretical foundation rests on maximizing inferential information density (negentropy), which reduces cognitive overhead and resists architectural decay.
The logic is not a philosophical assertion but a tractable engineering model with clearly defined boundary conditions, making it applicable to practical AI‑assisted development in controlled environments.