Models as Values in a Model Expression Algebra: A Functional Approach to Model Driven Engineering
arXiv:2604.05001v1 Announce Type: new
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.