Preprint
Article

This version is not peer-reviewed.

Guarded Language Operators as Contractions in a Length-Based Ultrametric Space

Submitted:

13 April 2026

Posted:

14 April 2026

You are already at the latest version

Abstract
We study a class of wrapping operators acting on the space of formal languages over a fixed finite alphabet. The underlying space is equipped with a length-based ultrametric, in which two languages are close whenever they coincide on all sufficiently short words. We prove that every wrapping operator generated by a finite family of guards with positive total guard length is a contraction. As a consequence, Banach’s contraction principle yields existence and uniqueness of a fixed point for the corresponding recursive language equation, together with convergence of the Picard iteration from an arbitrary initial language. We also obtain an explicit quantitative estimate for the rate of convergence. This makes it possible to determine how many iterations are sufficient to recover the fixed point correctly on all words up to a prescribed length. Several examples illustrate the theory, including operators with different guard lengths and a case showing that convergence in the length-based ultrametric does not coincide with set-theoretic convergence. An application to recursive structures and document validation is also presented, including recursive data formats, abstract syntax trees, and a restricted fragment of JSON schemas. The results provide a formal foundation for validation together with explicit bounds for correctness on inputs of bounded length.
Keywords: 
;  ;  ;  ;  ;  ;  ;  

1. Introduction

The study of fixed point equations on structured spaces is a central theme in both pure and applied mathematics. Since Banach’s classical work [1], contraction mappings on complete metric spaces have provided a powerful framework for proving existence and uniqueness of solutions to recursive equations. One of the main advantages of this approach is its constructive nature: the fixed point is obtained as the limit of the Picard iteration sequence, and the contraction constant yields explicit information about the rate of convergence.
In the semantics of programming languages, metric and ultrametric ideas have played an important role in the analysis of recursive definitions. In particular, de Bakker and Zucker [2] showed that complete metric methods provide a natural setting for denotational semantics of concurrency, while America and Rutten [3] developed a categorical treatment of complete metric spaces and contraction-based fixed point constructions for recursive domain equations. A recurring idea in this line of work is that contractivity is closely related to guardedness: recursion becomes well behaved when each recursive occurrence is separated from the surrounding structure by a sufficient amount of observable information.
The present paper develops an analogous point of view in the setting of formal languages. Let Σ be a finite alphabet and let L denote the set of all formal languages over Σ . We equip L with a length-based ultrametric in which two languages are close whenever they coincide on all words up to a sufficiently large length. This makes L a natural environment for studying recursive language constructions by fixed point methods.
We introduce a class of wrapping operators of the form
T S , G ( L ) = S r = 1 p u r L v r ,
where S Σ * is a fixed seed language and
G = { ( u r , v r ) : r = 1 , , p } Σ * × Σ *
is a finite family of guards. The key assumption is that the total guard length satisfies
min 1 r p | u r | + | v r | m
for some integer m 1 . Under this hypothesis, every wrapped word carries a mandatory outer layer of total length at least m before the recursive core can be reached. This is the feature that yields contractivity.
Our main result shows that every such wrapping operator is a contraction on ( L , d ) with contraction factor 2 m . Banach’s fixed point theorem then implies that the corresponding recursive language equation
L = T S , G ( L )
admits a unique solution in L . Moreover, the Picard iterates converge to this solution from any initial language, and the convergence is quantitatively controlled by the guard length. In particular, when the iteration starts from the empty language, one obtains an explicit bound ensuring correctness on all words up to any prescribed length.
Beyond its theoretical interest, the framework developed in this paper has a natural interpretation in computer science. In particular, recursive data structures, document formats with nested syntax, and schema-based validation mechanisms can be modeled using wrapping operators. In this setting, the contractive nature of guarded recursion provides not only well-defined semantics, but also explicit bounds on the number of steps required to validate inputs of bounded size. This connects the abstract fixed-point theory developed here with practical questions in parsing, serialization, and validation of recursive data.
The paper is organized as follows. Section 2 recalls the required preliminaries on formal languages, the length-based ultrametric on L , and Banach’s contraction principle. Section 3 introduces wrapping operators generated by finite families of guards and establishes the main fixed point and convergence results. Section 4 contains several examples illustrating the theory, including a case in which ultrametric convergence differs from set-theoretic convergence. Section 5 presents an application to recursive document validation.

2. Preliminaries

Throughout the paper, Σ denotes a fixed finite alphabet and Σ * the set of all finite words over Σ , including the empty word ε . For a word w Σ * , its length is denoted by | w | .
Definition 1 
([4,5]). A formal language over Σ is any subset L Σ * .
We denote by L the set of all formal languages over Σ .
Definition 2 
([4,5]). Each language L L is identified with its characteristic function
1 L : Σ * { 0 , 1 } , 1 L ( w ) = 1 , w L , 0 , w L .
For u Σ * and L Σ * , we define left and right concatenation by
u L : = { u w : w L } , L u : = { w u : w L } .
Definition 3 
([2]). For any two formal languages L 1 , L 2 L define a distance between L 1 and L 2 by
d ( L 1 , L 2 ) = 0 , L 1 = L 2 , 2 k , k = min { | w | : 1 L 1 ( w ) 1 L 2 ( w ) } .
Lemma 1. 
Let L 1 , L 2 L be two formal languages. If d ( L 1 , L 2 ) = 2 k , then L 1 and L 2 coincide on all words of length strictly less than k, and there exists a word w with | w | = k such that
1 L 1 ( w ) 1 L 2 ( w ) .
This follows directly from Definition 3; see [2].
Theorem 1 
([2]). The function d is an ultrametric on L , i.e.,
d ( L 1 , L 3 ) max { d ( L 1 , L 2 ) , d ( L 2 , L 3 ) } for all L 1 , L 2 , L 3 L .
Definition 4. 
A sequence ( L n ) L is Cauchy if for every k N there exists N such that
1 L n ( w ) = 1 L m ( w ) for all | w | k and all n , m N .
This is the standard notion of a Cauchy sequence in the metric space ( L , d ) ; see [2] for the underlying metric structure.
Theorem 2 
([2]). The ultrametric space ( L , d ) is complete.
Definition 5 
([1]). Let ( X , d ) be a metric space. A mapping T : X X is a contraction if there exists c ( 0 , 1 ) such that
d ( T x , T y ) c d ( x , y ) for all x , y X .
Definition 6 
([1]). An element x * X is a fixed point of T if T ( x * ) = x * .
Theorem 3 
([1]). Let ( X , d ) be a complete metric space and let T : X X be a contraction. Then T admits a unique fixed point x * , and the iterates
x n + 1 = T ( x n )
converge to x * for every x 0 X .

3. Main Result

Definition 7. 
Let Σ be a finite alphabet. A finite set
G = { ( u r , v r ) : r = 1 , , p } Σ * × Σ *
is called a finite set of guards.
Definition 8. 
Let Σ be a finite alphabet, let S Σ * , and let
G = { ( u r , v r ) : r = 1 , , p } Σ * × Σ *
be a finite set of guards.
We define an operator
T S , G : L L
by
T S , G ( L ) = S r = 1 p u r L v r , L L .
We call T S , G a wrapping operator generated by the seed S and the guards G.
Definition 9. 
Let
G = { ( u r , v r ) : r = 1 , , p } Σ * × Σ * .
We say that G has guard length at least m 1 if
min 1 r p | u r | + | v r | m .
Remark 1. 
When no ambiguity arises, we write T instead of T S , G .
Lemma 2. 
Let u , v Σ * . Then for all A , B L ,
d ( u A v , u B v ) 2 ( | u | + | v | ) d ( A , B ) .
Proof. 
We consider two cases.
Case 1: A = B . Then u A v = u B v , hence
d ( u A v , u B v ) = 0 2 ( | u | + | v | ) d ( A , B ) .
Case 2: A B . Let
k = min { | w | : 1 A ( w ) 1 B ( w ) } .
Then
d ( A , B ) = 2 k .
By Lemma 1, the languages A and B coincide on all words of length strictly less than k, and there exists a word w 0 Σ * with | w 0 | = k such that
1 A ( w 0 ) 1 B ( w 0 ) .
We claim that u A v and u B v coincide on all words of length strictly less than
k + | u | + | v | .
Let x Σ * satisfy
| x | < k + | u | + | v | .
If x does not begin with u, then clearly
x u A v and x u B v ,
so
1 u A v ( x ) = 1 u B v ( x ) = 0 .
Assume now that x begins with u. Then there exists a unique word y Σ * such that
x = u y .
From
| x | < k + | u | + | v |
we obtain
| y | < k + | v | .
If y does not end with v, then
y A v and y B v ,
hence
x u A v and x u B v .
Assume finally that y ends with v. Then there exists a unique word z Σ * such that
y = z v .
Since
| y | < k + | v | ,
it follows that
| z | < k .
Therefore
1 A ( z ) = 1 B ( z ) ,
because A and B coincide on all words of length strictly less than k. Hence
z A z B ,
which implies
y A v y B v
and therefore
x u A v x u B v .
We have shown that u A v and u B v coincide on all words of length strictly less than
k + | u | + | v | .
Thus
d ( u A v , u B v ) 2 ( k + | u | + | v | ) = 2 ( | u | + | v | ) 2 k = 2 ( | u | + | v | ) d ( A , B ) .
This completes the proof.    □
Lemma 3. 
For all A , B , S L ,
d ( A S , B S ) d ( A , B ) .
Proof. 
If A = B , then A S = B S and d ( A S , B S ) = 0 d ( A , B ) .
Let A B and let
k = min { | w | : 1 A ( w ) 1 B ( w ) } 0 .
Then d ( A , B ) = 2 k .
We will prove that for all words w with | w | < k , we have 1 A S ( w ) = 1 B S ( w ) .
Let | w | < k . From the definition of k, we know that 1 A ( w ) = 1 B ( w ) . We consider two subcases:
Case 1: 1 A ( w ) = 1 B ( w ) = 1 . Then w A and w B . Consequently, w A S and w B S , so 1 A S ( w ) = 1 = 1 B S ( w ) .
Case 2: 1 A ( w ) = 1 B ( w ) = 0 . Then w A and w B . To determine whether w A S , we need to check whether w S . We have:
1 A S ( w ) = max { 1 A ( w ) , 1 S ( w ) } = max { 0 , 1 S ( w ) } = 1 S ( w ) , 1 B S ( w ) = max { 1 B ( w ) , 1 S ( w ) } = max { 0 , 1 S ( w ) } = 1 S ( w ) .
Therefore 1 A S ( w ) = 1 S ( w ) = 1 B S ( w ) .
Thus we have proved that for all w with | w | < k , we have 1 A S ( w ) = 1 B S ( w ) . This means that the first possible disagreement between A S and B S occurs at length at least k. Consequently,
d ( A S , B S ) 2 k = d ( A , B ) .
   □
Lemma 4. 
Let Σ be a finite alphabet, let S Σ * , and let
G = { ( u r , v r ) : r = 1 , , p } Σ * × Σ *
be a finite set of guards with guard length at least m 1 . Let
T = T S , G : L L
be the wrapping operator generated by the seed S and the guards G. Then
d ( T ( A ) , T ( B ) ) 2 m d ( A , B ) for all A , B L .
Proof. 
By Definitions 8 and 9, there exist S Σ * and finitely many pairs ( u r , v r ) , r = 1 , , p , such that
T ( L ) = S r = 1 p u r L v r for all L L ,
and
| u r | + | v r | m for all r = 1 , , p .
Let A , B L be arbitrary. For each r = 1 , , p , Lemma 2 gives
d ( u r A v r , u r B v r ) 2 ( | u r | + | v r | ) d ( A , B ) 2 m d ( A , B ) .
We now estimate the distance between the unions
U A : = r = 1 p u r A v r , U B : = r = 1 p u r B v r .
If U A = U B , then
d ( U A , U B ) = 0 2 m d ( A , B ) .
Assume that U A U B , and let k be the first length at which they differ. Then there exists a word w 0 with | w 0 | = k such that
1 U A ( w 0 ) 1 U B ( w 0 ) .
Without loss of generality, assume that
1 U A ( w 0 ) = 1 and 1 U B ( w 0 ) = 0 .
Then there exists an index r 0 such that
1 u r 0 A v r 0 ( w 0 ) = 1 ,
while
1 u r B v r ( w 0 ) = 0 for all r = 1 , , p .
In particular,
1 u r 0 B v r 0 ( w 0 ) = 0 .
Hence
1 u r 0 A v r 0 ( w 0 ) 1 u r 0 B v r 0 ( w 0 ) ,
so the first disagreement between u r 0 A v r 0 and u r 0 B v r 0 occurs at some length not exceeding k. Therefore
d ( U A , U B ) = 2 k d ( u r 0 A v r 0 , u r 0 B v r 0 ) .
Using the estimate above, we obtain
d ( U A , U B ) 2 m d ( A , B ) .
Finally, by Lemma 3,
d ( T ( A ) , T ( B ) ) = d ( S U A , S U B ) d ( U A , U B ) 2 m d ( A , B ) .
This completes the proof.    □
Theorem 4. 
Let Σ be a finite alphabet, let S Σ * , and let
G = { ( u r , v r ) : r = 1 , , p } Σ * × Σ *
be a finite set of guards with guard length at least m 1 . Let
T = T S , G : L L
be the wrapping operator generated by the seed S and the guards G. Then the equation
L = T ( L )
admits a unique solution L * L . Moreover, for every initial language L ( 0 ) L , the sequence defined by
L ( n + 1 ) = T L ( n ) , n 0 ,
converges to L * .
Proof. 
The space ( L , d ) is complete by the completeness theorem stated in the Preliminaries. By Lemma 4, the operator T is a contraction on ( L , d ) . Therefore, the conclusion follows from Banach’s contraction principle.    □
Lemma 5. 
Let Σ be a finite alphabet, let S Σ * , and let
G = { ( u r , v r ) : r = 1 , , p } Σ * × Σ *
be a finite set of guards with guard length at least m 1 . Let
T = T S , G : L L
be the wrapping operator generated by the seed S and the guards G. Then for any initial approximation L ( 0 ) and for any n 1 ,
d ( L ( n ) , L * ) 2 m n d ( L ( 0 ) , L * ) .
Proof. 
We prove the statement by induction on n.
For n = 1 , from Lemma 4 we have
d ( L ( 1 ) , L * ) = d ( T ( L ( 0 ) ) , T ( L * ) ) 2 m d ( L ( 0 ) , L * ) .
Assume the statement holds for n. Then
d ( L ( n + 1 ) , L * ) = d ( T ( L ( n ) ) , T ( L * ) ) 2 m d ( L ( n ) , L * ) ( by contractivity ) 2 m · 2 m n d ( L ( 0 ) , L * ) ( by the inductive hypothesis ) = 2 m ( n + 1 ) d ( L ( 0 ) , L * ) .
This completes the proof.    □
Corollary 1. 
Under the conditions of Lemma 5, if we want L ( n ) and L * to coincide on all words of length less than N, it is sufficient to require
d ( L ( n ) , L * ) 2 N .
A sufficient condition for this is
n N + log 2 d ( L ( 0 ) , L * ) m ,
provided that d ( L ( 0 ) , L * ) > 0 .
In particular, if L ( 0 ) = , then d ( L ( 0 ) , L * ) 1 , hence
n N m
is a sufficient condition.
If d ( L ( 0 ) , L * ) = 0 , then L ( 0 ) = L * and the conclusion is trivial.
Proof. 
If d ( L ( 0 ) , L * ) = 0 , then L ( 0 ) = L * , hence L ( n ) = L * for all n 0 , and the conclusion is immediate.
Assume now that d ( L ( 0 ) , L * ) > 0 . By Lemma 5,
d ( L ( n ) , L * ) 2 m n d ( L ( 0 ) , L * ) .
Thus it is sufficient to require
2 m n d ( L ( 0 ) , L * ) 2 N .
Taking base-2 logarithms, we obtain
m n + log 2 d ( L ( 0 ) , L * ) N ,
which is equivalent to
m n N log 2 d ( L ( 0 ) , L * ) .
Multiplying by 1 , we get
m n N + log 2 d ( L ( 0 ) , L * ) .
Therefore,
n N + log 2 d ( L ( 0 ) , L * ) m
is a sufficient condition.
If L ( 0 ) = , then d ( L ( 0 ) , L * ) 1 , so
log 2 d ( L ( 0 ) , L * ) 0 .
Hence
N + log 2 d ( L ( 0 ) , L * ) N ,
and therefore
n N m
is also a sufficient condition.    □
Theorem 5. 
Let Σ be a finite alphabet, let S Σ * , and let
G = { ( u r , v r ) : r = 1 , , p } Σ * × Σ *
be a finite set of guards with guard length at least m 1 . Let
T = T S , G : L L
be the wrapping operator generated by the seed S and the guards G. Let L * be the fixed point of T. If
d ( L , L * ) 2 N ,
then L and L * coincide on all words of length strictly less than N.
Proof. 
If d ( L , L * ) = 0 , then L = L * , and the conclusion is immediate.
Assume that d ( L , L * ) > 0 . By Definition 3, there exists an integer k 0 such that
d ( L , L * ) = 2 k ,
where k is the smallest length at which L and L * differ. Since
d ( L , L * ) 2 N ,
it follows that
2 k 2 N ,
hence
k N .
Therefore the first disagreement between L and L * can occur only at a word of length at least N. Equivalently, L and L * coincide on all words of length strictly less than N.    □

4. Examples

Example 1. 
Let Σ = { a , b } and consider the operator T : L L given by
T ( L ) = { ε } a L b .
Here S = { ε } , p = 1 , u 1 = a , v 1 = b , and | u 1 | + | v 1 | = 2 , hence T is guarded with guard length m = 2 .
Starting with L ( 0 ) = , the first iterates are
L ( 1 ) = T ( ) = { ε } , L ( 2 ) = T ( { ε } ) = { ε , a b } , L ( 3 ) = T ( { ε , a b } ) = { ε , a b , a a b b } , L ( 4 ) = T ( { ε , a b , a a b b } ) = { ε , a b , a a b b , a a a b b b } .
By induction one easily verifies that
L ( n ) = { a k b k : 0 k < n } ( n 1 ) .
Consequently, the limit (and hence the unique fixed point of T) is
L * = n 1 L ( n ) = { a k b k : k 0 } .
Moreover, since m = 2 , Lemma 4 gives contractivity with constant 2 2 , and Theorem 4 yields convergence of the Picard iteration to the unique fixed point.
Example 2. 
Let Σ = { 0 , 1 } and consider two operators T 1 , T 2 : L L defined by
T 1 ( L ) = { ε } 0 L 1 00 L 11 , T 2 ( L ) = { ε } 00 L 11 000 L 111 .
Both operators are guarded, but with different guard lengths:
m 1 = 2 for T 1 and m 2 = 4 for T 2 .
Starting with L ( 0 ) = , the first iterates for T 1 are
L 1 ( 1 ) = { ε } , L 1 ( 2 ) = { ε , 01 , 0011 } , L 1 ( 3 ) = { ε , 01 , 0011 , 000111 , 00001111 } .
For T 2 we obtain
L 2 ( 1 ) = { ε } , L 2 ( 2 ) = { ε , 0011 , 000111 } , L 2 ( 3 ) = { ε , 0011 , 000111 , 00001111 , 0000011111 , 000000111111 } .
The fixed points can be described explicitly. For T 1 one checks that
L 1 * = { 0 n 1 n : n 0 } .
Indeed, T 1 allows wrapping by ( 0 , 1 ) and by ( 00 , 11 ) , hence every application increases the exponent by 1 or by 2, and all n 0 are reachable.
For T 2 the allowed wrappings are ( 00 , 11 ) and ( 000 , 111 ) , so the exponent increases by 2 or 3. Since the semigroup generated by 2 and 3 contains all integers n 2 , we obtain
L 2 * = { ε } { 0 n 1 n : n 2 } .
In particular, L 2 * L 1 * .
Finally, the guard length controls the certified correctness depth: the contraction constants are
c 1 = 2 m 1 = 1 4 , c 2 = 2 m 2 = 1 16 ,
so the error d ( L i ( n ) , L i * ) decays faster for T 2 than for T 1 .
Example 3. 
Let Σ = { x , y } and define T : L L by
T ( L ) = x L x y L y .
This operator is guarded with seed S = and guard length m = 2 , since each wrapping adds one symbol on the left and one symbol on the right. Hence, by Lemma 4, T is a contraction on ( L , d ) with constant 2 2 , and therefore it has a unique fixed point.
Starting from L ( 0 ) = { ε } we obtain
L ( 1 ) = { x x , y y } , L ( 2 ) = { x x x x , x y y x , y x x y , y y y y } ,
and, in general, L ( n ) consists of palindromes of length exactly 2 n .
Although the set-theoretic union n 0 L ( n ) is the set of all even-length palindromes, the Picard iteration converges in the ultrametric to the empty language. Indeed, the shortest words in L ( n ) have length 2 n , so the first disagreement between L ( n ) and ∅ occurs at length 2 n , and therefore
d L ( n ) , = 2 2 n n 0 .
Since T ( ) = , the limit ∅ is a fixed point; by Banach’s theorem it is the unique fixed point of T.
This example shows that convergence in the length-based ultrametric means stabilization of membership on all words up to any fixed length, and does not coincide with convergence in terms of set-theoretic inclusion.

5. Applications in Computer Science

The results of the previous sections have natural applications in computer science, especially in recursively defined languages, data structures, and validation schemes. The basic idea is that recursion is well controlled whenever each recursive occurrence is separated from the outer context by a nonzero guard. In this case, the corresponding wrapping operator is a contraction in the metric space under consideration; that is, it reduces the distance between languages by a factor smaller than 1. From a computer-science perspective, this means that the recursive specification can be viewed not only as a formal description, but also as a computational process in which, for inputs of bounded length, there exists a provable bound beyond which the result is guaranteed to be correct.

5.1. Recursive Data Structures and Formats

The first direct application of the theory under consideration is to recursive data structures and formats, in which complex objects are constructed from simpler ones by adding a new outer structural layer. Such situations arise in XML (Extensible Markup Language) and HTML (Hypertext Markup Language) documents with nested tags [6], in Lisp-like expressions, in serialized trees, and in JSON (JavaScript Object Notation) objects with recursively nested substructures [7]. In this setting, the set of valid objects can be described by an operator that adds new correct wrappers around already valid substructures to the basic admissible cases. The fixed point of this operator then represents the language of all valid objects that can be generated through a finite number of construction steps. From a computer science perspective, the sequence of iterations L ( 0 ) , L ( 1 ) , L ( 2 ) , can be viewed as a series of progressively refined approximations of the valid format. The initial iterations cover only the simplest structures, while subsequent ones allow increasingly deeper nesting. This corresponds to the way parsers and validators for recursive formats operate in practice: they process the structure layer by layer rather than as a single indivisible object. Therefore, fixed-point theory provides both a formal description and a clear model for stepwise computation and validity checking.
Table 1. Examples of recursive data structures and formats with their computer science interpretation.
Table 1. Examples of recursive data structures and formats with their computer science interpretation.
Example Sample Recursive Construction Computer Science Interpretation
HTML/XML documents <tag>doc</tag> Each new layer of tags adds an outer syntactic context; L ( n ) describes documents with nesting depth up to n.
S-expressions (f expr) An appropriate model for parsing nested Lisp-like terms, where each new expression contains an already valid subexpression.
JSON tree structure {"value": x,"children": [node]} Describes recursively nested objects; L ( n ) corresponds to trees of depth up to n.
Linked list {"head": x,"tail": list} Each new object adds one more node to the list; the iterations describe lists of length up to n.
Serialized abstract syntax tree Add(expr,num),Neg(expr) Each constructor builds a more complex expression from an already valid subexpression; L ( n ) describes trees with bounded syntactic depth.
Constructions in a Domain-Specific Language (DSL) Wrap(cmd) Each operator adds a new syntactic layer around an already valid command or expression.

5.2. Recursive Data Types, Abstract Syntax Trees, and Serialization

A particularly important application of the theory under consideration arises in recursive data types and abstract syntax trees (ASTs). In compilers, interpreters, and static analysis systems, more complex constructions are built from simpler ones through constructors that add a new outer layer around an already valid subexpression [8]. Thus, a valid structure can be viewed as the result of successive construction rather than merely as a formally specified object.
For example, in a language of arithmetic expressions with the constructors Num, Neg(expr), and Add(expr, Num), the corresponding operator may be written schematically as
T ( L ) = { Num } Neg ( L ) Add ( L , Num ) ,
which describes how new valid expressions are obtained from already valid ones.
In this case, the fixed point L * is the set of all well-formed serialized expressions, while L ( n ) contains the expressions of syntactic depth at most n. The same logic applies to classical data structures. A binary tree can be represented by Leaf and Node(left, right) [12], and a singly linked list by Cons(head, tail) [8]. In serialization, for example in JSON [7], this leads to forms such as {"head": value, "tail": List} or {"value": x, "children": [Tree, …]}. In both cases, the recursive part appears inside a clearly defined outer context. This wrapper plays the role of a guard and makes the step-by-step construction and verification of valid structures possible.

5.3. Validation under Limited Resources: The Length of the Guard as a Computational Parameter

One of the most practically relevant consequences of the theory is its application to validation under limited resources. In real systems, it is usually not necessary to determine validity for all possible unfoldings of recursion, but only for inputs up to a certain size—for example, a JSON document of fixed length [7], a syntax tree up to a given depth, or a query of limited volume. Therefore, the quantitative result of the paper has direct algorithmic meaning: if the minimum length of the outer wrapper is m, then after sufficiently many iterations the approximation L ( n ) already coincides with the fixed point on all inputs of length below N.
In the paper itself, this is formulated as an explicit bound of the form n N / m for correctness on words below a given length. From a computer science perspective, this means that the convergence theorem can be used as a formal stopping criterion. Instead of introducing an arbitrary recursion bound, the number of required steps can be derived from the structure of the specification itself. For a validator of nested JSON objects [11,14], a parser for Lisp-like expressions, or verification of serialized trees, this means that the necessary processing depth is not chosen heuristically, but is determined by the parameter m. Thus, the length of the guard becomes a measure not only of the structure of recursion, but also of the cost of its reliable computation.
Among the most important computer science interpretations of the theory under consideration is that the length of the guard can be viewed as a computational parameter. Mathematically, m is the minimum length of the mandatory outer wrapper added at each recursive step. From a computer science perspective, this is the amount of syntactic context that separates one recursive level from the next. The greater this value, the more quickly the iterations stabilize on inputs of limited length, since the contraction coefficient is 2 m . This also gives the result a clear practical meaning. A more explicit outer structure not only facilitates reading of the data, but also makes formal validation more predictable. For example, a JSON object with fields "head" and "tail" contains more mandatory structural context than an array in which the recursive element is placed directly. For this reason, a validator for a list may reach a correct result in fewer steps than a validator for a more general recursive array structure on the same input.

5.4. Restricted Fragment of Recursive JSON Schemas

The most direct practical application of the theory under consideration is to recursive JSON schemas [9,10,11]. Here, however, it must be clearly emphasised that the approach does not cover JSON Schema in its full generality, but rather a restricted recursive fragment in which the recursive occurrence is located within a clearly defined outer context—for example, inside an array, in an object with fixed keys [7], or within a nested property. In such cases, the language of valid JSON documents can be regarded as the result of step-by-step construction: one starts from the simplest admissible values and then gradually adds increasingly deeply nested structures. It is precisely this class of schemas that corresponds to the model of wrapping operators introduced in this paper.
A particularly noteworthy example is the model of nested comments in a social network. A comment may contain the fields "author", "text", and "replies", where "replies" is an array of new comments with the same structure. The initial approximation then describes comments without replies, the next one describes comments with one level of nested replies, and each subsequent step permits one more level of nesting. In the same way, a JSON representation of a linked list or a tree structure can be viewed as a serialization of classical recursive data types [8,12]. In this sense, the theory provides a clear model for the step-by-step construction and validation of recursive JSON structures when the recursion is placed within a sufficiently explicit structural wrapper.

5.5. Scope and Limitations

The proposed model is strongest for positive, structurally guarded recursive specifications that can be reduced to a finite wrapping operator. This includes formats with nested tags [6], abstract syntax trees [8], linked lists, tree-shaped JSON structures, and a limited but practically relevant fragment of recursive JSON schemas [9,11]. Under these conditions, the results of the previous sections provide, at once, unambiguous semantics, iterative convergence, and a formal validation bound for inputs of limited length.
At the same time, the model should not be regarded as a complete semantics for all possible schema languages with richer compositional operators [6,10]. The most accurate conclusion is that the theory under consideration provides a rigorous foundation for guarded recursive validation and the step-by-step unfolding of recursive structures, but it does not offer a definitive solution for all constructive possibilities of industrial schema standards [10,11].

Author Contributions

The mentioned authors participated equally to the study and are arranged in alphabetical order as follows: conceptualization, H.H., A.I., H.K., and B.Z; methodology, H.H., A.I., H.K., and B.Z; investigation, H.H., A.I., H.K., and B.Z; writing—original draft preparation, H.H., A.I., H.K., and B.Z.; writing—review and editing, H.H., A.I., H.K., and B.Z. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

Data sharing is not applicable to this article.

Acknowledgments

The authors would like to express their gratitude for the support provided by the European Union-NextGenerationEU, through the National Recovery and Resilience Plan of the Republic of Bulgaria, project DUECOS BG-RRP-2.004-0001-C01.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Banach, S. Sur les opérations dans les ensembles abstraits et leur application aux équations intégrales. Fundam. Math. 1922, 3, 133–181. [Google Scholar] [CrossRef]
  2. de Bakker, J.W.; Zucker, J.I. Processes and the denotational semantics of concurrency. Inf. Control 1982, 54, 70–120. [Google Scholar] [CrossRef]
  3. America, P.; Rutten, J.J.M.M. Solving reflexive domain equations in a category of complete metric spaces. J. Comput. Syst. Sci. 1989, 39, 343–375. [Google Scholar] [CrossRef]
  4. Salomaa, A. Formal Languages; Academic Press: New York, NY, USA, 1973; ISBN 978-0-12-615750-5. [Google Scholar]
  5. Eilenberg, S. Automata, Languages, and Machines, Vol. A; Academic Press: New York, NY, USA, 1974; ISBN 978-0-12-234001-7. [Google Scholar]
  6. Martens, W.; Neven, F.; Schwentick, T.; Bex, G.J. Expressiveness and complexity of XML Schema. ACM Trans. Database Syst. 2006, 31, 770–813. [Google Scholar] [CrossRef]
  7. RFC 8259The JavaScript Object Notation (JSON) Data Interchange Format; Bray, T., Ed.; IETF: Fremont, CA, USA, 2017. [Google Scholar] [CrossRef]
  8. Bird, R. Introduction to Functional Programming using Haskell, 2nd ed.; Prentice Hall Europe: Hemel Hempstead, UK, 1998; ISBN 0-13-484346-0. [Google Scholar]
  9. Pezoa, F.; Reutter, J.L.; Suarez, F.; Ugarte, M.; Vrgoč, D. Foundations of JSON Schema. In Proceedings of the 25th International Conference on World Wide Web (WWW 2016); ACM: New York, NY, USA, 2016; pp. 263–273. [Google Scholar] [CrossRef]
  10. Attouche, L.; Baazizi, M.-A.; Colazzo, D.; Ghelli, G.; Sartiani, C.; Scherzinger, S. Validation of Modern JSON Schema: Formalization and Complexity. Proc. ACM Program. Lang. 2024, 8 (POPL), 55. [Google Scholar] [CrossRef]
  11. Wright, A.; Andrews, H.; Hutton, B.; Dennis, G. JSON Schema: A Media Type for Describing JSON Documents. IETF Internet-Draft draft-bhutton-json-schema-01. 2020. Available online: https://json-schema.org/draft/2020-12/json-schema-core.html.
  12. Meertens, L. First Steps Towards the Theory of Rose Trees. In Working Paper 592 ROM-25, IFIP Working Group 2.1; CWI: Amsterdam, The Netherlands, 1988. [Google Scholar]
  13. Gajić, L. On ultrametric spaces. Novi Sad J. Math. 2001, 31, 69–71. [Google Scholar]
  14. Ajv JSON Schema Validator, version 8.x. 2023. Available online: https://ajv.js.org (accessed on 1 January 2024).
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.
Prerpints.org logo

Preprints.org is a free preprint server supported by MDPI in Basel, Switzerland.

Subscribe

Disclaimer

Terms of Use

Privacy Policy

Privacy Settings

© 2026 MDPI (Basel, Switzerland) unless otherwise stated