Thoughts on Digital Twins

November 26, 2025 — Bradley Venner

I’ve been a little skeptical of the digital twin concept, but it seems like a good time to focus on the concept given Mycorrhiza’s pivot to software engineering, Elena’s need to develop a senior project, a long-awaited development of a proposal for categorical models of monetary macroeconomic accounting theory by Menéndez and Winschel, the role of measurement models and procedures in categorical measurement systems, and the interactive vs functional models of lenses explicitly considered by Winskel and implicitly by Meilles, Seiller and Pavlovic.

Winschel states in the abstract of [@menendez:2025:macroeconomic] that the goal of their research project is “to enable the interdisciplinary collaboration for digital twins of monetary accounting systems”. Although I’m not sure about either the categorical formalism or the economic theory in this paper, it’s certainly a major step forward. The three layer micro/meso/macro formulation reminds me of similar formulations in ecological macroeconomics that might be more “progressive” than this paper. For example, Berg et. al. develop a model that simultaneously models the physical environment (physical materials through the natural system), the economic system (flows of produced goods and services through the real economy) and the financial system (monetary flows). There are 87 citations of this paper. There is a potential for an even more broad modeling approach using agent-based models, for example Pitt’s self-organizing multi-agent systems. It might be better to use double category theory rather than the implicit 2-categorical framework used in the paper to develop the theory, bringing it closer to categorical systems theories. Double categories also have potential applications in message passing systems. Aside: understanding the relationship between channel-based and actor-based systems would be really helpful. So many formalisms!

In looking for Berg’s paper, I went to Oliver Richter’s website (not the bodybuilder). He has focused on extending the static mechanics framework that economics adopted from physics to the more general constrained dynamics model from physics that he calls General Constrained Dynamics Models. Their paper From constrained optimization to constrained dynamics: extending analogies between economics and mechanics [@glötzl:2017:constrained] develops the analogy in detail. Surprisingly, the paper claims that this extension allows for heterogeneous agents and out-of-equilibrium analysis. Could something like this model be used for the “biological organization” model of autopoiesis in organisms? Reminder that someone has worked out how auotopoietic models realize Aristotle’s notion of form. The paper includes a detailed discussion of holonomic and non-holonomic constraints that really helped me understand these important concepts used in Pattee’s work. Perhaps the most obvious difference is that constraints are not the target of action of agents in the economic model but are the major target for an agent in a biological model.

Can this setup be categorified? There are a number of papers “categorifying” Lagrangian mechanics. Gemini cites an undergrad thesis Category Theory in Analytical Mechanics [@keusch:2025:category]. Another paper is The Relationship Between Lagrangian and Hamiltonian Mechanics: The Irregular Case [@braldey:2025:relationship], (link)[https://philosophyofphysics.lse.ac.uk/articles/10.31389/pop.197]. This paper develops a categorical equivalence argument developed by Barrett [@barrett:2015:structure]. These papers are concerned with transformations between Lagrangian and Hamiltonian systems, not necessarily in extending these frameworks to more general “spaces” than symplectic spaces.

The general setup proposes J agents and I “variables”. These two classes are taken as “atomic.” Variables may be resources or flows of resources. Since resources must be held by agents, resources are “alienable” properties of agents. There are no “inalienable” properties in the model (such as class location).

In their explanation of a stock-flow consistent model, there is one type of resource (money), three agents (governments, households and firms), and two stocks (savings) of money for governments and households. (firms never save?) Households send money to the government and firms as taxes (T) and consumption (C), respectively. Governments send money to firms (G), receive money from households (T) and create money (Mg). Firms receive money from consumers (C) and governments (G) and pay out money to consumers as wages (Y). They call money flows from governments to households “stocks” but these are accumulated flows. After reading this paper, I’m concerned that Lagrangian systems are not a good model for accounting systems, and that it would be better to focus on direct modeling of accounting than developing the “hydraulic model” as a classical physical system. Aside: William Phillips built a hydraulic computer that simulated the British economy and wrote a paper “Mechanical models in economic dynamics”.

In software engineering, bidirectional transformations seem to use a more broad framework than the lens-based approaches used in functional programming, which arose later. It appears that bidirectional model transformations are used to synchronize two (or more) models that are representations of “the same underlying data”.

Although details are still sketchy, Mycorrhiza appears to be developing a system for keeping code and requirements in sync. I spoke with Nic about this on Thanksgiving and encouraged them to continue working on the bidirectional relationship between a specification and code, but I’m also thinking that their distinction between “blueprints” and “greenprints” might be well described as the difference between denotational and operational models of a theory, with an LLM developing a “model” from a specification but also helping keep the operational and denotational models in sync.

This distinction between operational and denotational models may be one way to expand the bilateral notion of digital twin to a more triadic relationship, with a natural language specification of a problem domain being expanded into more formal models of that domain, with multiple views of that model. The operational model would be the “local-first” model, perhaps with semantics in something like multi-party session types. The denotational model would provide “constraints” on the operational model, perhaps expressed as with a modality/comodality relationship as in linear logic. Another possibility would be to think of this as a Hegelian doughnut with two adjunctions providing inner and outer approximations to the actually operating machine model.

Speculatively, is there some relationship between these ideas, the intrinsic/extrinsic models of types developed by Reynolds and expanded by Mellies, and the intensive/extensive models of quantity developed by Lawvere? The intrinsic/extrinsic division is a division within denotational semantics, while the intensive/extensive model is a division with quantity. There is an idea that physical units are types, so there very well could be a relationship.

Seiller emphasizes the view that types are “descriptors or classifiers” rather than the traditional view of “types as constraints”. This approach may provide a better link to