Papers
Topics
Authors
Recent
Search
2000 character limit reached

Models as Values in a Model Expression Algebra: A Functional Approach to Model Driven Engineering

Published 5 Apr 2026 in cs.SE | (2604.05001v1)

Abstract: This paper proposes a functional foundation for model driven engineering that unifies model construction, metamodels, templates, and transformations under a single formalism: the model expression algebra. In this algebra, models are values, model expressions are terms, and evaluation is the interpretation homomorphism from terms to values. Model expressions are composed from four operators: model creation and element creation operators, reference operators for retrieving models and elements, and computation operators that embed functional computations. Metamodels are type schemas that constrain the algebra, and model templates, understood as parameterized model expressions, are formalized as open terms with free variables. Model transformations then arise naturally as model templates whose input parameter is a source model. We prove type preservation under evaluation and type safety of transformation execution. Since models are themselves model elements, the algebra also supports megamodels and weaving models without additional mechanisms. The approach is realized through an embedded domain-specific language (DSL) that demonstrates how a single mainstream language can serve simultaneously as the metamodeling, model construction, and transformation language, with formal guarantees enforced by the language's type system.

Summary

  • The paper presents a functional MDE framework that treats models as first-class values using a model expression algebra.
  • It leverages a TypeScript-based DSL to enable type-safe model construction, transformation, and metamodeling with built-in traceability.
  • The approach unifies model, template, and transformation paradigms, offering compositional and parameterizable solutions to reuse limitations.

Formal Foundations for Functional Model-Driven Engineering

Introduction

This paper introduces a functional approach to model-driven engineering (MDE) built on the notion of a model expression algebra, where models are treated as values and model expressions as terms within a well-defined algebra. Unlike conventional object-oriented (OO) MDE ecosystems (e.g., EMF, MDA), which restrict models to collections of passive object-graphs, this framework provides a type-safe, compositional, parameterizable, and extensible value-oriented alternative with direct operational semantics for model construction, transformation, and metamodeling in mainstream programming languages. The approach is functionally realized via an embedded domain-specific language (DSL) in TypeScript and JSX, demonstrating practical applicability and integration with existing language infrastructure.

Model Expression Algebra: Syntax and Semantics

The core abstraction is a term algebra over four operator classes:

  • Model creation (u): Initializes a model with a distinct type schema and namespace.
  • Element creation (&): Instantiates typed elements with properties.
  • Reference (p): Resolves named references to facilitate cross-links (intra- or inter-model).
  • Computation (k): Allows parameterized, programmatic computation of sub-expressions (e.g., iteration, conditionals, function abstraction), enabling structural variation and template-based model families.

Model evaluation is defined as an interpretation homomorphism that maps expressions into concrete model values. Metamodels are type schemas constraining allowable forms per type constructor system, supporting both entity and value types, with guarantees of uniqueness, conformance, and hierarchical composition. The type system ensures that every model expression, when well-typed with respect to its metamodel, produces only conformant models.

Critically, templates are just model expressions with free parameters (open terms), and both ground models and model templates are unified via the same algebraic framework. Higher-order templates—functions from templates to templates—are natively supported without further mechanism.

Metamodeling and Megamodels

Metamodels are formalized as finite sets of entity and value types, built from primitive types and type constructors (entity, subtype, array, optional, reference, instance reference). Model conformance is statically enforced by the TypeScript host language; the implementation leverages this static enforcement via runtime descriptors and compile-time inference.

Megamodels—models whose elements are themselves models—naturally arise by nesting model creation operators. Weaving models, which encode cross-model links, use instance reference types and require no additional formalism: embedding these references in the algebra suffices, and referential integrity checking is separated from construction.

Model Transformations as Parameterized Templates

Transformations are formalized as structured collections of rules, where each rule is a template from source model elements to target model expressions. The rule dispatch mechanism is driven by the subtype hierarchy, guaranteeing that for each source element, the most specific applicable rule is selected deterministically; this polymorphic dispatch is realized via TypeScript decorators. The execution semantics accumulate elements in the target model monotonically, and traceability is built in via automatic trace recording per rule application.

Type preservation and safety of transformation execution follow directly from the algebraic and type system properties: each rule's output conforms to the target metamodel if its parameters and sub-rules do, and composite execution yields globally conformant models.

Implementation: The Synthesis Embedded DSL

All theoretical constructs map directly to reusable programming structures in Synthesis:

  • Model expressions are JSX/TypeScript terms whose evaluation (after parameter substitution and expression reduction) is realized by a custom rendering engine.
  • Metamodels are TypeScript objects registered with runtime descriptors, from which static interfaces are automatically inferred.
  • Templates are TypeScript functions returning model expressions; higher-order templates are curried functions.
  • Transformations are TypeScript classes with decorator-based rule registration and dispatch.
  • Execution traceability, type safety, and static conformance are ensured at runtime and compile-time with the host infrastructure.

This enables the unification of metamodeling, model construction, and transformation in a single mainstream language and runtime. For example, an organizational structure can be transformed to a complex workflow process via parameterized, easily extensible template-driven transformation logic.

Empirical and Theoretical Comparison

The algebraic/value-oriented approach sharply distinguishes itself from conventional object-oriented models (EMF, ATL, QVT), which lack first-class parameterization, have fragmented reuse mechanisms, and require glue code for reuse and cross-metamodel transformation. The paper meticulously profiles reuse limitations in current MDE—especially structural and cross-schema parameterization—and demonstrates inherent algebraic solutions for value-parameterized and higher-order templates.

Graph-based frameworks (TGGs, AGG, Henshin) are compared; while they offer strong guarantees (e.g., bidirectionality), they require dedicated tools and lack programmatic parameterization and template mechanisms. The present algebra frames both construction and transformation in terms well supported by mainstream type systems, facilitating integration into broader software toolchains.

Implications for Practice and Future Directions

Practical adoption is enabled by mapping all core concepts into the rich toolchain and ecosystem of TypeScript/JSX; practitioners gain compositional, type-safe, and parameterizable MDE without new syntactic constructs or specialized execution platforms. The approach especially benefits scenarios that demand systematic customization, model family generation, and transformation law reuse.

The theoretical unification of model, template, and transformation structures simplifies reasoning about conformance, substitution, and reuse—enabling future extension to bidirectional and incremental transformations (e.g., via lens formalism), monadic composition (for staged pipelines), and integration with generative AI for automatic synthesis and adaptation of model expressions.

Limitations include current restriction to unidirectional transformations, lack of empirical large-scale industrial benchmarks, and lower ecosystem maturity compared to entrenched OO MDE frameworks. Addressing bidirectionality and deeper integration with advanced reuse and generative paradigms are identified as primary future work.

Conclusion

This work establishes a rigorous, type-theoretic foundation for functional model-driven engineering, unifying model construction, transformation, parameterization, and metamodeling in a compositional algebraic framework with direct practical realization. By reifying models as values and model expressions as first-class terms, it resolves longstanding limitations in MDE related to reuse, customization, and static safety, and enables integration with existing programming ecosystems and advanced AI techniques. The approach offers substantial theoretical and operational advantages over both traditional object-oriented and graph-based MDE paradigms, and it charts a clear path toward more flexible, expressive, and robust engineering of complex software systems.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.