Papers
Topics
Authors
Recent
Search
2000 character limit reached

Unfolding Expressions in Computational Semantics

Updated 6 July 2026
  • Unfolding expressions are operations that convert implicit or folded representations into explicit forms while preserving essential structural invariants.
  • They are applied in diverse fields, including geometry, high-energy physics, electronic structure, functional programming, and type theory.
  • Practical applications range from edge-unfolding polyhedra and histogram reconstruction to controlled unfolding in proof assistants and constraint handling rules in program transformations.

“Unfolding expressions” denotes a family of operations in which a compact, implicit, folded, or detector-distorted representation is replaced by a more explicit one. In the supplied literature, the term ranges from cutting and flattening polyhedral surfaces into planar nets, to generating lists by anamorphisms, to reconstructing truth-level histograms from detector-level counts, to substituting recursive definitions in λ\lambda-letrec, to locally replacing constants by their defining expressions in dependent type theory, to inlining CHR constraints, to deriving source-level facts for lazy functional programs, and to assigning supercell eigenstates weights in the primitive Brillouin zone 0509054. A common thread is expansion under structural constraints: cuts must avoid overlap, coalgebras must terminate, recursive substitutions must preserve expressibility, and optimization or projection operators must preserve the relevant semantics.

1. Geometric and physical meanings of unfolding

In computational geometry, an edge-unfolding of a polyhedron is produced by cutting along edges and flattening the faces to a net, a connected planar piece with no overlaps. A grid unfolding allows additional cuts along grid edges induced by coordinate planes passing through every vertex, and a vertex-unfolding permits faces in the net to be connected at single vertices, not necessarily along edges [0509054]. For orthogonal polyhedra, the central result is that any orthogonal polyhedron of genus zero has a grid vertex-unfolding, and for an orthogonal polyhedron PP with nn vertices there is an algorithm that vertex-unfolds PP in O(n2)O(n^2) time; the same work also presents a simpler vertex-unfolding algorithm that requires a 3×13 \times 1 refinement of the vertex grid [0509054]. The supplied material also states that there are orthogonal polyhedra that cannot be vertex-unfolded, so some type of gridding of the faces is necessary [0509054].

In high-energy physics, unfolding is the inverse problem of reconstructing true distributions of physical observables from detector-distorted measurements. At the level of probability densities, the detector is modeled by a response function

r(μz)=m(μz)ϵ(z),r(\mu \mid z) = m(\mu \mid z)\,\epsilon(z),

and the expected reconstructed distribution is

g(μ)=r(μz)f(z)dz+β(μ).g(\mu) = \int r(\mu \mid z)\, f(z)\, dz + \beta(\mu).

In the discretized formulation,

μi=j=1MRijzj+βi,μ=Rz+β,\mu_i = \sum_{j=1}^{M} R_{ij} z_j + \beta_i, \qquad \boldsymbol{\mu} = R \boldsymbol{z} + \boldsymbol{\beta},

with unfolding defined as estimating z\boldsymbol{z} from PP0, PP1, and PP2 subject to physical constraints (Gasperini et al., 26 Feb 2026).

In electronic-structure theory, band structure unfolding reverses the folding caused by supercell calculations. Primitive-cell bands are folded into the reduced supercell Brillouin zone, and unfolding assigns to each supercell eigenstate a weight at each primitive-cell PP3. The resulting unfolded spectral function is

PP4

with unfolding weight

PP5

The AO-based formulation explicitly accounts for the non-orthogonality of atomic orbitals and their atom-centered nature, and the implementation in FHI-aims is presented as enabling accurate and efficient unfolding of conduction, valence, and core states (Quan et al., 26 Jun 2025).

These cases all involve explicit expansion of latent structure, but the object being “unfolded” differs: a surface in geometry, a truth-level spectrum in HEP, and a supercell eigenspace in electronic structure. This suggests that “unfolding” is best treated as a structural operator rather than a single domain-specific procedure.

2. Unfolding as generation, recursion, and symbolic expansion

In recursion-scheme–based program synthesis, unfolding appears concretely as the anamorphism pattern. Origami’s list anamorphism is g(μ)=r(μz)f(z)dz+β(μ).g(\mu) = \int r(\mu \mid z)\, f(z)\, dz + \beta(\mu).9 with {1} the initial seed, {2} the predicate, {3} the head element, and {4} the next seed (Fernandes et al., 2024). The same source states that anamorphisms generate data structures from seeds, while hylomorphisms compose an anamorphism and a catamorphism: μi=j=1MRijzj+βi,μ=Rz+β,\mu_i = \sum_{j=1}^{M} R_{ij} z_j + \beta_i, \qquad \boldsymbol{\mu} = R \boldsymbol{z} + \boldsymbol{\beta},0 and explicitly describes Hylo as “captur[ing] an Anamorphism followed by a Catamorphism, such as applying foldr to the result of unfold” (Fernandes et al., 2024).

The role of unfolding in Origami is methodological as well as operational. The recursion scheme is fixed, and only slots are evolved by Genetic Programming, so the unfolding shape is not synthesized; rather, the GP searches for the initial seed, the termination test, the element generator, and the seed transformer (Fernandes et al., 2024). The stated motivation is that recursion schemes decouple how to traverse or generate the data structure from how to process it, thereby avoiding some of the pitfalls of recursive functions during program synthesis (Fernandes et al., 2024).

In the unfolding semantics of higher-order, lazy functional programs, unfolding is a systematic way of “executing” a functional program symbolically by repeatedly replacing function calls with their definitions, producing a set of derived equations or facts. The language includes variables, constructors, user-defined functions, and predefined functions, with higher-order application encoded by @, and the semantics iterates an unfolding operator PP6 over interpretations: PP7 The meaning of a program is the least fixpoint or limit PP8 (Rey-Poza et al., 2017). The paper emphasizes that these facts themselves are valid source code and can be used as a semantic representation of the program (Rey-Poza et al., 2017).

In both settings, unfolding is not merely expansion by substitution. In Origami it is a typed synthesis template over coalgebras; in unfolding semantics it is an interpretation transformer over facts, guards, and predefined functions. A plausible implication is that “unfolding expressions” in programming-language research often denotes controlled generation of explicit operational structure rather than unrestricted inlining.

For the untyped nn0-calculus with letrec, unfolding is the process of substituting occurrences of function variables by the right-hand side of their definition. A finite nn1-letrec term expresses an infinite nn2-term if the latter can be obtained as an infinite unfolding of the former (Rochel, 2016). The supplied material gives the intuitive example

nn3

which unfolds to the infinite nn4-term

nn5

Formally, unfolding is defined by rewriting systems nn6 and nn7, with partial unfolding semantics

nn8

and total unfolding semantics with black holes

nn9

Theorem 1.25 is reported as establishing that these are well-defined functions (Rochel, 2016).

The central characterization theorem states: PP0 The supplied details further state that a regular PP1-term is strongly regular iff all its binding–capturing chains are finite (Rochel, 2016). This turns unfolding from an operational intuition into a criterion for expressibility.

Equality of unfoldings is also made algorithmic. The same work identifies a first-order term graph formalism on which bisimulation preserves and reflects the unfolding semantics of PP2-letrec and which is closed under functional bisimulation, and from this derives efficient methods to determine whether two terms are equivalent under infinite unfolding and to compute the maximally shared form of a given PP3-letrec term (Rochel, 2016). The graph-theoretic layer is therefore not ancillary: it is the mechanism by which infinite unfolding is compared and compressed finitely.

This literature treats unfolding as a semantics for recursive syntax. Unlike the recursion-scheme literature, where unfolds generate data from seeds, here unfolds map finite recursive syntax into infinite terms by rewriting, with regularity and bisimulation providing the corresponding invariants.

4. Controlled unfolding in type theory and proof assistants

In dependent type theory, unfolding is the operation of replacing a constant or definition by its defining expression. The supplied material gives addition as the canonical example: PP4 with defining equations

PP5

Unfolding plus in PP6 means replacing occurrences of + by these clauses and reducing (Gratzer et al., 2022).

“Controlling unfolding in type theory” proposes that definitions are opaque by default and can be selectively unfolded in a local manner. A top-level annotation such as μi=j=1MRijzj+βi,μ=Rz+β,\mu_i = \sum_{j=1}^{M} R_{ij} z_j + \beta_i, \qquad \boldsymbol{\mu} = R \boldsymbol{z} + \boldsymbol{\beta},1 makes + transparent within the body of (⊕), while outside (⊕) it remains opaque (Gratzer et al., 2022). The details further state that unfolding is local and transitive: if definition PP7 is unfolded and PP8's body uses PP9, then it must be legal to unfold O(n2)O(n^2)0 as well, and this is enforced via proposition symbols that track unfolding entailment (Gratzer et al., 2022).

The formal core calculus O(n2)O(n^2)1 introduces proposition symbols O(n2)O(n^2)2, dependent products over propositions O(n2)O(n^2)3, and extension types O(n2)O(n^2)4. The key rules include

O(n2)O(n^2)5

O(n2)O(n^2)6

and

O(n2)O(n^2)7

The intended reading is that O(n2)O(n^2)8 is the type of elements of O(n2)O(n^2)9 that are definitionally equal to 3×13 \times 10 when the unfolding condition 3×13 \times 11 is assumed (Gratzer et al., 2022).

The same source states that the system has been implemented in the cooltt proof assistant and that a normalization theorem is proved for the core calculus (Gratzer et al., 2022). Here, unfolding expressions are not treated as tactics or ad hoc conversion settings, but as a type-theoretic construct with elaboration into a core language. This distinguishes controlled unfolding from unrestricted definitional equality.

5. Program transformation: CHR and lazy functional programs

In CHR, unfolding is defined as the replacement of a procedure call by its definition, specialized to user-defined constraints in rule bodies. The paper “Unfolding in CHR” defines an unfolding rule for annotated CHR programs, proves its correctness, and discusses conditions under which an unfolded rule can replace an original one while preserving program meaning (0807.3979). The operational setting uses the reference semantics 3×13 \times 12 with a propagation history and a modified semantics 3×13 \times 13 for annotated programs, and the supplied details state

3×13 \times 14

The observable semantics is therefore qualified answers, and correctness means preservation of qualified answers under unfolding (0807.3979).

The central transformation is compile-time pre-application of one rule inside another. If a rule 3×13 \times 15 has body constraints that match the head of a rule 3×13 \times 16, and the guard and built-in constraints are strong enough, the unfolding rule replaces those body constraints by the renamed body of 3×13 \times 17, conjoins the necessary guard information, and updates the local token store (0807.3979). Proposition 4.10 is reported as showing that if 3×13 \times 18, where 3×13 \times 19 is the unfolding of r(μz)=m(μz)ϵ(z),r(\mu \mid z) = m(\mu \mid z)\,\epsilon(z),0 by r(μz)=m(μz)ϵ(z),r(\mu \mid z) = m(\mu \mid z)\,\epsilon(z),1, then for every goal r(μz)=m(μz)ϵ(z),r(\mu \mid z) = m(\mu \mid z)\,\epsilon(z),2,

r(μz)=m(μz)ϵ(z),r(\mu \mid z) = m(\mu \mid z)\,\epsilon(z),3

The same source also states that confluence and termination properties are preserved under the stated transformations (0807.3979).

The unfolding semantics of lazy functional programs uses a different technical apparatus but a similar intuition. A fact has the form

r(μz)=m(μz)ϵ(z),r(\mu \mid z) = m(\mu \mid z)\,\epsilon(z),4

subject to the condition that r(μz)=m(μz)ϵ(z),r(\mu \mid z) = m(\mu \mid z)\,\epsilon(z),5 and r(μz)=m(μz)ϵ(z),r(\mu \mid z) = m(\mu \mid z)\,\epsilon(z),6 contain no user-defined function symbols and predefined functions are allowed only where they cannot be evaluated further (Rey-Poza et al., 2017). The unfolding operator generates these facts by symbolically replacing user-defined calls, while clean removes redundancy among overlapping facts (Rey-Poza et al., 2017). Adequacy is stated as equivalence between operational evaluation and evaluation with the limit interpretation r(μz)=m(μz)ϵ(z),r(\mu \mid z) = m(\mu \mid z)\,\epsilon(z),7 (Rey-Poza et al., 2017).

Both CHR and lazy functional unfolding are semantics-preserving program transformations, but the preserved semantics differs: qualified answers in CHR and adequacy with respect to a small-step operational semantics in lazy functional programming. This suggests that “unfolding expressions” in program transformation is best understood through the semantic invariant attached to the target language.

6. Optimization, inversion, and projection-based unfolding

In optimization-based HEP unfolding, the Poisson likelihood is approximated by a quadratic term and combined with curvature regularization to obtain

r(μz)=m(μz)ϵ(z),r(\mu \mid z) = m(\mu \mid z)\,\epsilon(z),8

with integer decision variables r(μz)=m(μz)ϵ(z),r(\mu \mid z) = m(\mu \mid z)\,\epsilon(z),9 (Gasperini et al., 26 Feb 2026). The regularization term is a discrete Laplacian penalty,

g(μ)=r(μz)f(z)dz+β(μ).g(\mu) = \int r(\mu \mid z)\, f(z)\, dz + \beta(\mu).0

and the quadratic form is written as

g(μ)=r(μz)f(z)dz+β(μ).g(\mu) = \int r(\mu \mid z)\, f(z)\, dz + \beta(\mu).1

The same work derives a QUBO representation

g(μ)=r(μz)f(z)dz+β(μ).g(\mu) = \int r(\mu \mid z)\, f(z)\, dz + \beta(\mu).2

implemented in QUnfold with classical mixed-integer solvers and D-Wave’s hybrid quantum solver (Gasperini et al., 26 Feb 2026).

In AO-based band unfolding, the corresponding central expression is a projection weight. After Löwdin orthogonalization, the primitive translation operator reduces to a permutation matrix, and the unfolding weight takes the compact form

g(μ)=r(μz)f(z)dz+β(μ).g(\mu) = \int r(\mu \mid z)\, f(z)\, dz + \beta(\mu).3

Here g(μ)=r(μz)f(z)dz+β(μ).g(\mu) = \int r(\mu \mid z)\, f(z)\, dz + \beta(\mu).4 are Löwdin-orthogonalized supercell eigenvectors and g(μ)=r(μz)f(z)dz+β(μ).g(\mu) = \int r(\mu \mid z)\, f(z)\, dz + \beta(\mu).5 are eigenvectors of the primitive-cell translation operator in the orthogonalized representation (Quan et al., 26 Jun 2025). The same source presents the thermally averaged spectral function as

g(μ)=r(μz)f(z)dz+β(μ).g(\mu) = \int r(\mu \mid z)\, f(z)\, dz + \beta(\mu).6

with each configuration sampled from the canonical ensemble (Quan et al., 26 Jun 2025).

These two uses are mathematically distinct—one is inverse estimation under regularization, the other is projector-based spectral decomposition—but each formulates unfolding as extraction of latent structure from a compressed representation by means of an explicit objective or projector. A plausible implication is that in contemporary physics literature the term “unfolding” increasingly denotes a reconstruction map equipped with a quantitative weight or loss.

7. Conceptual commonalities and major distinctions

Across the supplied sources, unfolding is always an operation from a more compact or folded representation to a more explicit one, but the preserved object varies sharply. In geometry, the invariant is a connected planar piece with no overlaps [0509054]. In g(μ)=r(μz)f(z)dz+β(μ).g(\mu) = \int r(\mu \mid z)\, f(z)\, dz + \beta(\mu).7-letrec, the invariant is infinite unfolding semantics and its characterization by strong regularity (Rochel, 2016). In controlled type theory, the invariant is definitional equality under explicit unfolding conditions mediated by extension types (Gratzer et al., 2022). In CHR, it is preservation of qualified answers, and under stated conditions also confluence and termination (0807.3979). In lazy functional programming, it is adequacy with respect to operational semantics (Rey-Poza et al., 2017). In HEP, it is statistical compatibility between g(μ)=r(μz)f(z)dz+β(μ).g(\mu) = \int r(\mu \mid z)\, f(z)\, dz + \beta(\mu).8 and measured counts under regularization (Gasperini et al., 26 Feb 2026). In band unfolding, it is spectral weight in the primitive-cell Brillouin zone (Quan et al., 26 Jun 2025). In Origami, it is a recursion-scheme template in which generation and processing are decoupled (Fernandes et al., 2024).

A recurring misconception is that unfolding is always unrestricted inlining. The supplied literature contradicts that view. Grid vertex-unfolding requires gridding because some orthogonal polyhedra cannot be vertex-unfolded without it [0509054]. Origami fixes the recursion scheme and searches only over typed slots (Fernandes et al., 2024). Controlled type theory makes definitions opaque by default and permits only local selective unfolding (Gratzer et al., 2022). CHR safe rule replacement requires explicit syntactic and guard conditions (0807.3979). Functional unfolding semantics restricts facts so that bodies and guards contain no user-defined function symbols (Rey-Poza et al., 2017). HEP unfolding depends on regularization and discretization choices (Gasperini et al., 26 Feb 2026). AO band unfolding depends on orthogonalization and translation-operator structure (Quan et al., 26 Jun 2025).

The term therefore does not name a single algorithmic pattern. It names a class of expansion operators whose technical content is determined by the structure being unfolded, the admissible transformation rules, and the semantic or geometric invariant that must be preserved.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

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

Follow Topic

Get notified by email when new papers are published related to Unfolding Expressions.