cs.FLOct 8, 2026

Type-Checking for Pattern-Based Tree Transformations

Authors: C. Aiswarya, Sahil Mhaskar, M. Praveen

Organizations: CNRS IRL ReLaX, India

Abstract

We introduce and study pattern-based tree transformations. As an illustrating example, consider a source pattern (x⋅y)+(x⋅z)(x \cdot y) + (x \cdot z) and a target pattern x⋅(y+z)x \cdot (y + z) as a pair. This source pattern matches any expression ee of the form (e1⋅e2)+(e1⋅e3)(e_1 \cdot e_2) + (e_1 \cdot e_3) (by substituting xx with e1e_1, yy with e2e_2, and zz with e3e_3) and the pair transforms it into the expression e1⋅(e2+e3)e_1 \cdot (e_2 + e_3) as dictated by the target pattern. Note that in this example, the set of expressions that match the source pattern is not a regular tree language. We propose a model of tree transformations given by a finite representation of a (possibly infinite) set of such (source pattern, target pattern) pairs. The expressive power of this model comes at the cost of undecidability of checking equivalence. Nevertheless, we show that the type-checking problem is decidable for our model of pattern-based tree transformations. The type-checking problem asks whether applying a given transformation to trees having a given regular property (type) preserves the property. Our decision procedure is by a reduction to the emptiness problem of alternating tree automata.

Figures & tables

Explore similar work

Aug 13, 2026cs.FL

Algebraic Decomposition Theory for Transformer Length Generalization

Transformer-based language models are known to sometimes generalize to sequences longer than seen during training, but we lack a precise characterization of which tasks admit length generalization. It is not even known which regular languages transformers length-generalize on -- and this is a foundational class of languages. Our contributions are to establish the first complete characterization of which regular languages transformers length-generalize on and provide a decision algorithm running in polynomial time in the size of the language's syntactic monoid. These results rely on an effective characterization of the regular languages in C-RASP, a recently-established formalism that expresses which languages transformers length-generalize on. This characterization is challenging because classical tools like Krohn-Rhodes decomposition theory for finite semigroups are insufficient for C-RASP. Firstly, the basic building blocks of Krohn-Rhodes theory -- flip-flop and simple groups -- are not expressible in C-RASP. Secondly, the basic building block of C-RASP (unbounded counting) is not expressible by the finite semigroups of Krohn-Rhodes theory. Thus, length generalization on regular languages is controlled by an algebraic property that is invisible to classical finite decomposition theory. We generalize classical decomposition theory from finite semigroups to the infinite additive group on the integers, allowing us to characterize C-RASP in terms of iterated wreath products of the integers and derive a provable polynomial-time decision algorithm for regular language membership. Experiments across a broad test suite of regular languages confirm that our theory captures transformers' length-generalization behavior more accurately than existing classifications.
May 28, 2026cs.FL

The Inclusion Depth of Pattern Languages: An Open Problem in Algorithmic Learning Theory

Pattern languages are a classical model in formal language theory and algorithmic learning theory. This note formulates the problem of computing the inclusion depth of a pattern language: the length of the longest strict inclusion chain from the universal pattern language to the language generated by a given pattern. Inclusion depth captures the mind-change complexity of pattern identification from positive data. The central open question is whether the inclusion depth ID_Sigma(p) is computable for every pattern p over every finite alphabet Sigma with at least two symbols, and whether it is computable in polynomial time. A simple conjectured formula, ID_Sigma(p) = 2|p| - #var(p) - 1, would imply a linear-time algorithm. The problem connects pattern language inclusion, combinatorics on words, language identification in the limit, and mind-change-bounded learning.
Oct 6, 2026cs.SD

Geometric Representations for Transformed Pattern Matching in Music

We review the notion of representing music using point sets and argue that such representations are better adapted than sequential representations for matching patterns in unvoiced, polyphonic music, such as keyboard music. Musical transformations such as transposition, inversion, diminution, augmentation and retrograde can be modelled by geometric transformations in pitch-time representations that combine translation with scaling parallel to and reflection in the time axis. We identify eight types of geometric pitch-time representation that use chromatic pitch, morphetic pitch, morph or chroma to represent pitch and either onset time or midtime to represent time. We illustrate how these types of representation allow us to characterise different types of musical transformation. For example, by using midtime instead of onset time, we can precisely characterise certain retrograde relationships; and by using morph and chroma pitch representations we can characterise transformations involving octave displacements and duplications. We present the concept of a transformation class and consider the three specific classes, F2STRF_{\mathrm{2STR}}, F2STRMod7F_{\mathrm{2STRMod7}} and F2STRMod12F_{\mathrm{2STRMod12}}. We introduce the notion of an inter-pattern transformation graph for a set of patterns, SS, and a transformation class, FF. Each vertex in such a graph represents a pattern in SS and there is an edge in the graph from pattern P1P_1 to pattern P2P_2 if and only if P1P_1 can be mapped onto P2P_2 by a transformation in FF. We show, with the aid of such graphs, that the musical relationships between the occurrences of the HAYDN theme in Ravel's Menuet sur le nom d'Haydn can be precisely described in terms of transformations in F2STRF_{\mathrm{2STR}}, F2STRMod7F_{\mathrm{2STRMod7}} and F2STRMod12F_{\mathrm{2STRMod12}} within the pitch-time representations considered.