Every programmer learns early that good software is modular. You write a piece that does one thing, test it until it works, and connect it to another piece that also works. The result, the theory goes, is a system that works. This idea has a name in computer science: composability. It is the guarantee that independently correct components, when combined, produce a whole that behaves as their parts led you to expect. It is one of the field's oldest organizing ideas, and in practice it fails with remarkable regularity.
The failure follows a pattern that engineers have spent decades learning to recognize: everything looks fine until the pieces touch. A function that returns the correct result in isolation corrupts state when called inside a concurrent process. A microservice that handles a thousand requests a second collapses when the service it depends on slows down slightly. A container that runs identically on every developer's laptop behaves differently in production because a file permission was never part of the contract. In each case the components were correct. What broke was the substrate between them.
Functional programming made this concrete through the concept of referential transparency. An expression is referentially transparent if it can be swapped for its own value anywhere in a program without changing the result. A function that multiplies two numbers has this property. One that multiplies two numbers and logs the current timestamp does not, because its behavior depends on something outside its inputs. That distinction, between what a piece does and what it silently assumes about its surroundings, is exactly where composability lives or dies.
The standard prescription for composability is a clean interface: a well-documented API, matching data types, a descriptive function signature. That prescription is correct but insufficient. The real obstacles live beneath the interface, in the type system that decides what counts as a legal combination, the runtime that schedules and isolates components, the memory model that controls what one thread sees of another, and the state that persists between calls. No interface document makes those go away.
Memory models are among the least visible and most consequential of these. On modern hardware, caches and compilers reorder operations for performance, and two modules that are each correct under a strict ordering can deadlock or produce corrupted output when assembled under a weaker one. Work from the University of Cambridge's relaxed-memory research group has shown that these models have a non-trivial impact on the safety of standard program optimizations, and the interaction between memory semantics and those optimizations remains an open formal problem. The interface said nothing about any of this, because interfaces cannot.
What interfaces can do, when designed seriously, is enforce contracts. The discipline of design by contract draws a formal distinction between assumptions, the conditions a component requires of its environment, and guarantees, the commitments it makes in return. A function signature listing argument types is not a contract in this sense. A real contract encodes preconditions about what must be true before the function runs, postconditions about what will be true when it finishes, and invariants that hold throughout. Verifying a composition then becomes verifying that one component's guarantees satisfy another component's assumptions, and that work belongs in the infrastructure, not in the comments.
The composability problem reaches its sharpest edge in neurosymbolic AI, the family of systems that try to combine neural networks with symbolic reasoning engines. Neural networks are extraordinarily good at recognizing patterns in raw data. Symbolic systems are extraordinarily good at applying rules, checking logical constraints, and producing results that can be inspected. The reason that combination remains difficult is precisely the composability problem, at the infrastructure level.
The two paradigms are built on incompatible substrates. Neural networks operate in continuous, high-dimensional spaces and learn by propagating gradients through every operation in the pipeline. Symbolic systems operate on discrete structures, and discrete operations have no gradient. Composing them tightly therefore requires making symbolic reasoning differentiable, which means approximating it with continuous functions, and that approximation is expensive. DeepProbLog, developed at KU Leuven, computes query probabilities by counting the weighted combinations of symbolic proofs that satisfy a query, and its own authors note that exact inference does not always scale well and can be prohibitively expensive for large problems.
Google DeepMind's geometry solver AlphaGeometry illustrates what happens when engineers decide not to pay that price. Rather than fusing neural and symbolic components into a single differentiable pipeline, AlphaGeometry alternates between them: a neural language model proposes auxiliary geometric constructions, and a separate symbolic deduction engine checks whether those constructions complete a proof. The system solved 25 of 30 International Mathematical Olympiad geometry problems from a recent competition, outperforming the average human gold medalist, while keeping the two paradigms at arm's length. The fact that the field's most celebrated neurosymbolic result works by avoiding tight composition rather than achieving it is a precise statement about where the infrastructure currently stands.
A working diagram on a research lab glass board captures the composability problem the way engineers actually encounter it: two components that each work, a substrate between them that does not, and a set of principles written in the margin that might fix it. The crossed-out column labeled "hope" is not a joke.
The neurosymbolic case is a concentrated version of a problem that organizes modern software engineering at every level. Microservices, containers, serverless functions, and API gateways are all architectural bets that a system built from small, independently deployable parts will be easier to reason about than a monolith. That bet pays off in flexibility and scalability, but it moves the risk into the network and the runtime, the very substrate that composability depends on.
The characteristic failure of distributed composition is the cascade. A slow database raises latency in the service above it. That service's callers exhaust their connection pools. Retry logic floods the already-struggling database with additional requests. The October 2025 AWS outage followed this pattern at scale. According to Amazon's own post-event summary, a latent race condition produced a corrupted DNS record for a regional DynamoDB endpoint that automated systems failed to repair. Because a large number of internal AWS services use DynamoDB to store state, the failure propagated through the control plane, and the component managing EC2 instance lease state entered what Amazon described as congestive collapse. Full recovery took roughly fifteen hours.
What made the outage instructive was that the monitoring and failover systems meant to shorten that window depended on the same foundational services, so the recovery machinery was unavailable precisely when it was needed. This is the recurring shape of composability failure across the stack: the assumption is cheap to state, expensive to guarantee, and breaks at exactly the boundary the architecture diagram presented as clean.
If composability fails in the infrastructure, the fixes belong there too, and distributed systems theory and type theory have converged on a coherent set of answers. The first is idempotency: the guarantee that performing an operation multiple times produces the same result as performing it once. In a distributed system where networks drop responses and clients retry, idempotency is what makes a retry safe. A payment API that is not idempotent will charge a customer twice when a timeout triggers a second request. Idempotency does not solve the message delivery problem; it makes the system correct in the presence of that problem, which is a more achievable goal.
The deeper principle is monotonicity, formalized in the CALM theorem, published in the ACM's Communications journal. The theorem states that a program can be implemented consistently across a distributed system without coordination if and only if it is monotonic, meaning it only ever adds to its conclusions and never has to retract them. Conflict-free replicated data types, used in distributed databases and collaborative editing systems, are the applied expression of this idea. Their merge operations are commutative, associative, and idempotent, so replicas converge to the same state without locking, because the algebra of the data type guarantees it.
The thread connecting these principles back to referential transparency is the same underlying idea: composability is a property of what is preserved when pieces are combined, and that preservation must be designed into the substrate rather than assumed. Idempotency, monotonicity, and explicit contracts are not features you add after the fact. They are structural commitments, made at the level of the type system, the runtime, and the coordination protocol, that make the seams between components safe by construction. Composability has always been an infrastructure problem. The field is slowly building the infrastructure to match.
Key references: University of Cambridge relaxed-memory concurrency group, "Memory Consistency and Program Transformations," Formal Aspects of Computing, ACM, 2025. Hellerstein, J. and Alvaro, P., "Keeping CALM: When Distributed Consistency Is Easy," Communications of the ACM, 2020. Shapiro, M. et al., "Conflict-Free Replicated Data Types," INRIA, 2011. DeepProbLog: Van den Broeck, G. et al., KU Leuven. AlphaGeometry: Google DeepMind, Nature, 2024. AWS DynamoDB outage post-event summary, Amazon Web Services, October 2025. Meyer, B., "Applying Design by Contract," Computer, IEEE, 1992.
Daice Labs Inc.
Brookline, MA, USA
Roll the "daice"–exploration & programmable adaptation.