On the generative capacity of matrix insertion-deletion systems of small sum-norm

A matrix insertion-deletion system (or matrix ins-del system) is described by a set of insertion-deletion rules presented in matrix form, which demands all rules of a matrix to be applied in the given order. These systems were introduced to model very simplistic fragments of sequential programs based on insertion and deletion as elementary operations as can be found in biocomputing. We are investigating such systems with limited resources as formalized in descriptional complexity. A traditional descriptional complexity measure of such a matrix ins-del system is its size s=(k;n,i′,i′′;m,j′,j′′)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$s=(k;n,i',i'';m,j',j'')$$\end{document}, where the parameters from left to right represent the maximal matrix length, maximal insertion string length, maximal length of left contexts in insertion rules, maximal length of right contexts in insertion rules; the last three are deletion counterparts of the previous three parameters. We call the sum n+i′+i′′+m+j′+j′′\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$n+i'+i''+m+j'+j''$$\end{document} the sum-norm of s. We show that matrix ins-del systems of sum-norm 4 and sizes (3; 1, 0, 0; 1, 2, 0), (3; 1, 0, 0; 1, 0, 2), (2; 1, 2, 0; 1, 0, 0), (2; 1, 0, 2; 1, 0, 0), and (2; 1, 1, 1; 1, 0, 0) describe the recursively enumerable languages. Moreover, matrix ins-del systems of sizes (3; 1, 1, 0; 1, 0, 0), (3; 1, 0, 1; 1, 0, 0), (2; 2, 1, 0; 1, 0, 0) and (2; 2, 0, 1; 1, 0, 0) can describe at least the regular closure of the linear languages. In fact, we show that if a matrix ins-del system of size s can describe the class of linear languages LIN\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathrm {LIN}$$\end{document}, then without any additional resources, matrix ins-del systems of size s also describe the regular closure of LIN\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathrm {LIN}$$\end{document}. Finally, we prove that matrix ins-del systems of sizes (2; 1, 1, 0; 1, 1, 0) and (2; 1, 0, 1; 1, 0, 1) can describe at least the regular languages.


Introduction
Two common operations while processing natural languages are inserting and deleting words in between parts of sentences; such insertions and deletions are usually based on context information. The (context-free) insertion operation was first considered in Haussler (1983), but also recently in Verlan et al. (2020). The deletion operation as a basis of a grammatical derivation process was introduced in Kari (1991), where the deletion was motivated as a variant of the right-quotient operation that does not necessarily happen at the right end of the string. Insertion and deletion were considered with a linguistic motivation in Galiukschov (1981) and together were first studied in Kari and Thierrin (1996). The corresponding grammatical mechanism is called an insertion-deletion system (abbreviated as ins-del system). Informally, the insertion and deletion operations of an ins-del system are defined as follows: if a string g is inserted between two parts w 1 and w 2 of a string w 1 w 2 to get w 1 gw 2 , we call the operation insertion, whereas if a substring d is deleted from a string w 1 dw 2 to get w 1 w 2 , we call the operation deletion. Suffixes of w 1 and prefixes of w 2 are called contexts.
Several variants of ins-del systems have been considered in the literature, imposing regulation mechanisms on top, motivated by classical formal language theory (Dassow and Pȃun 1989). Some interesting variants (from our perspective) are ins-del P systems (Alhazov et al. 2011), tissue P systems with ins-del rules (Kuppusamy and Rama 2003), context-free ins-del systems (Margenstern et al. 2005), graph-controlled ins-del systems (Fernau et al. 2017b;Freund et al. 2010;Ivanov and Verlan 2017), matrix insertion systems (Marcus and Pȃun 1990), matrix ins-del systems (Kuppusamy et al. 2011;Petre and Verlan 2012;Kuppusamy and Mahendran 2016), random context and semi-conditional ins-del systems (Ivanov and Verlan 2015), etc. We refer to the survey (Verlan 2010) for more details of several variants of ins-del systems. In this paper, we focus on matrix ins-del systems (Kuppusamy et al. 2011;Petre and Verlan 2012;Kuppusamy and Mahendran 2016). Viewing insertions and deletions as elementary operations for biocomputing (Pȃun et al. 1998), matrices can be seen as a very simple control mechanism.
In a matrix ins-del system, the insertion-deletion rules are given in matrix form. If a matrix is chosen for derivation, then all the rules in that matrix are applied in order and no rule of the matrix is exempted. In the size s ¼ ðk; n; i 0 ; i 00 ; m; j 0 ; j 00 Þ of a matrix ins-del system, the parameters (from left to right) denote the maximum number of rules (length) in any matrix, the maximal length of the inserted string, the maximal length of the left context for insertion, the maximal length of the right context for insertion, the maximal length of the deleted string, the maximal length of the left context for deletion, maximal length of the right context for deletion. We denote the language classes generated by matrix ins-del systems of size s by MATðsÞ. The tuple formed by the last six parameters, namely ðn; i 0 ; i 00 ; m; j 0 ; j 00 Þ, is called the ins-del size. We call the sum of its parameters the sum-norm of the (matrix) ins-del system. 1 It is known that ins-del systems are computationally complete, i.e., they characterize the family RE of recursively enumerable languages, which readily transfers to the mentioned variants. Descriptional complexity then aims at investigating which of the resources are really needed to obtain computational completeness. For instance, is it really necessary to permit insertion operations that check out contexts of arbitrary length? For resource restrictions that do not (or are not known to) suffice to achieve computational completeness, one is interested in seeing which known families of languages can be still generated. As in our case, for several families of matrix ins-del systems, it is even unknown if all of CF (the context-free languages) can be generated, we then look at the rather large sub-family L reg ðLINÞ, the regular closure of LIN. In Table 1, we report on what resources are needed for a matrix ins-del system of sum-norm 3 or 4 to generate the class specified there, also giving a short literature survey. Further races for smaller sizes are described when we discuss the particularities of our results below.
A further technical contribution consists in formulating a new normal form, called time separating special Geffert normal form (tsSGNF), that allows to simplify some arguments, because in particular there is no way to have mixtures of terminals and nonterminals at the right end of a derivable sentential form. Hence, such mixed cases need not be considered when proving correctness of simulation results based on tsSGNF. This is important, as the nonexistence of such mixed forms is often tacitly assumed in several proofs that use SGNF; replacing SGNF by tsSGNF should help to easily fix these results. In this respect, matrix control differs from graph control 2 (GCID) in connection with ins-del systems since the latter control demands that if LIN GCIDðk; n; i 0 ; i 00 ; m; j 0 ; j 00 Þ, then L reg ðLINÞ GCID ðk þ 2; n; i 0 ; i 00 ; m; j 0 ; j 00 Þ; see Fernau et al. (2017b), Fernau et al. (2017d.
Parts of this work have been presented at the conference SOFSEM 2019; see Fernau et al. (2019)  On the generative capacity of matrix insertion-deletion systems of small sum-norm 673 5. L reg ðLINÞ(MATð2; 2; 1; 0; 1; 0; 0Þ \ MATð2; 2; 0; 1; 1; 0; 0Þ. However, most of the proofs have been suppressed in the conference paper. In this extended version of the paper, we retain the first one and the last two results stated above from Fernau et al. (2019), however with detailed proofs. We must also thank one of the referees of this manuscript for pointing us to a problem with the construction suggested in Fernau et al. (2019) for proving the above-stated second result. The matrix length in the above-stated third result is improved from 3 to 2 in this paper and a new result MATð2; 1; 1; 1; 1; 0; 0Þ ¼ RE, is also proved here. A summary of the results of this paper can be seen in Tables 1  and 2 below.

Preliminaries
We assume that the readers are familiar with the standard notations in formal language theory. We recall a few notations here to keep the paper self-contained. Let R Ã denote the free monoid generated by the alphabet (finite set) R. The elements of R Ã are called strings or words; k denotes the empty string, L R and L R denote the reversal of language L and language family L, respectively. RE and LIN denote the families of recursively enumerable languages and linear languages, respectively. Occasionally, we use the shuffle operator, written as .
For the computational completeness results, we use the fact that type-0 grammars in Special Geffert Normal Form (SGNF) (Freund et al. 2010) are known to characterize the recursively enumerable languages and is extensively used in Fernau et al. (2017aFernau et al. ( , 2017cFernau et al. ( , 2018a and Petre and Verlan (2012). In fact, we slightly extend this notion in order to simplify certain arguments below. These simplifications were often tacitly assumed in previous works, but the following new definition gives good ground for it.
Definition 1 A type-0 grammar G ¼ ðN; T; S; PÞ is said to be in time separating special Geffert normal form, tsSGNF for short, if N is the nonterminal alphabet, T is the terminal alphabet, S 2 N is the start symbol and P is the set of production rules satisfying the following conditions. -N decomposes as N ¼ N ð0Þ [ N 0 [ N 00 , where N 00 ¼ fA; B; C; Dg and S 2 N ð0Þ , S 0 2 N 0 , -the only non-context-free rules in P are the two erasing rules AB ! k and CD ! k, -the context-free rules are of one of the following forms: where b 0 2 fA; Cg, b 00 2 fB; Dg and X 6 ¼ Y in (a) and (b); (c) possibly, there is also the rule S ! k.
Remark 1 Notice that as these context-free rules are more of a linear type, it is easy to see that there can be at most one nonterminal from N ð0Þ [ N 0 present in the derivation of G. We exploit this observation in our proofs. According to the construction of this normal form described in Freund et al. (2010) and Geffert (1991), the derivation of a string is performed in two phases. In Phase I, the context-free rules are applied repeatedly. More precisely, this phase splits into two stages: in stage one, rules from (a) have left-hand sides from N ð0Þ ; this stage produces a string of terminal symbols to the right side of the only nonterminal from N ð0Þ in the sentential form and codings thereof are put on the left side of the only nonterminal occurrence from N ð0Þ ; the transition to stage two is performed by using rules with left-hand sides from N ð0Þ and one symbol from N 0 occurring on the right-hand sides; in stage two, rules from (b) with left-hand sides from N 0 are applied; importantly, here (and later) no further terminal symbols are produced. This separation into non-interacting times of the derivation  Fernau et al. (2018b) process was the reason to call this normal form time separating. In the previous version of the normal form, it was possible that rules from the two stages could be applied also in different orders; this could lead to problems in the simulation. The two erasing rules AB ! k and CD ! k are not applicable during the first phase as long as there is a S (or S 0 ) in the middle. All the symbols A and C are generated on the left side of these middle symbols and the corresponding symbols B and D are generated on the right side. Phase I is completed by applying the rule S 0 ! k in the derivation. In Phase II, only the non-context-free erasing rules are applied repeatedly and the derivation ends. By induction, it is clear that sentential forms derivable by tsSGNF grammars belong to fA; Finally, notice that [similar to Fernau et al. (2017e)], we can also assume that X 6 ¼ Y in the context-free rules, as we can we can alternate between even and odd derivation steps.
Let us remark that the idea of a time separating (special) Geffert normal form is useful even when the number of nonterminal symbols matter, as proven by us in a recent paper presented at ICMC 2020 (to appear in its LNCS volume).
Our reasoning shows in particular the following first result: Theorem 1 For any recursively enumerable language L, i.e., L 2 RE, there exists a type-0 grammar G in tsSGNF with L ¼ LðGÞ.
Definition 2 A matrix insertion-deletion system is a construct C ¼ ðV; T; A; RÞ where V is an alphabet, T V, A is a finite language over V, R is a finite set of matrices fr 1 ; r 2 ; . . .r l g, where each r i , 1 i l, is a matrix of the form r i ¼ ½ðu 1 ; a 1 ; v 1 Þ t 1 ; ðu 2 ; a 2 ; v 2 Þ t 2 ; . . .; ðu k ; a k ; v k Þ t k . For 1 j k, u j ; v j 2 V Ã , a j 2 V þ and t j 2 fins; delg.
The triplet ðu j ; a j ; v j Þ t j is called an ins-del rule and the pair ðu j ; v j Þ is termed the context with u i as the left and v i as the right context for a j in t j ; a j is called insertion string if t j ¼ ins and deletion string if t j ¼ del. The elements of A are called axioms. For all contexts of t where t 2 fins; delg, if u ¼ k or v ¼ k, then we call the context to be one-sided. If u ¼ v ¼ k for a rule, then the corresponding insertion/ deletion can be done freely anywhere in the string and is called context-free insertion/deletion. An insertion rule is of the form ðu; g; vÞ ins , which means that the string g is inserted between u and v. A deletion rule is of the form ðu; d; vÞ del , which means that the string d is deleted between u and v. Applying ðu; g; vÞ ins corresponds to applying the rewrite rule uv ! ugv, and applying ðu; d; vÞ del corresponds to applying the rewriting rule udv ! uv.
At this point, we make a note that in a derivation, the rules of a matrix are applied sequentially one after another in the given order and no rule is used in appearance checking, as it is often the case in more classical matrix grammars with rewriting rules; see Dassow and Pȃun (1989). For x; y 2 V Ã we write x ) r i y, if y can be obtained from x by applying all the rules of a matrix r i ; 1 i l, in order. The language LðCÞ generated by C is defined as LðCÞ ¼ fw 2 T Ã j x ) Ã w; forsomex 2 Ag; where ) Ã (as usual with matrix ins-del systems) denotes the reflexive and transitive closure of ):¼ S r2R ) r . If a matrix ins-del system has at most k rules in a matrix and the size of the underlying ins-del system is ðn; i 0 ; i 00 ; m; j 0 ; j 00 Þ, then we denote the corresponding class of language by MATðk; n; i 0 ; i 00 ; m; j 0 ; j 00 Þ.

Regular closure of linear languages
Recall that a linear grammar is a context-free grammar G ¼ ðN; T; S; PÞ whose productions are of the form A ! x, where A is a nonterminal symbol, and x is a word over N [ T with at most one occurrence of a nonterminal symbol. The language class LIN collects all languages that can be described by linear grammars. LIN can be characterized by linear grammars in normal form, which means that any rule A ! x either obeys x 2 T [ fkg or x 2 TN or x 2 NT. It is well known that LIN is not closed under concatenation and Kleene star. This motivates to consider the class L reg ðLINÞ as the smallest class containing LIN that is closed under union, concatenation or Kleene star. Similarly, we can assume that any right-linear grammar that we consider is in normal form, i.e., it has only rules A ! aB or A ! k, with A 2 N, B 2 NnfAg and a 2 T. The following grammatical characterization for L reg ðLINÞ was shown in Fernau et al. (2018d).
Proposition 1 Fernau et al. (2018d) Let L T Ã be some language. Then, L 2 L reg ðLINÞ if and only if there is a context-free grammar G ¼ ðN; T; S; PÞ with LðGÞ ¼ L that satisfies the following properties.
-N can be partitioned into N 0 and N 0 . -There is a right-linear grammar G R ¼ ðN 0 ; N 0 ; S; P 0 Þ.
-N 0 can be further partitioned into N 1 ; . . .; N k for some k, such that the restriction P i of P involving symbols from N i [ T are only linear rules, with T serving as the terminal alphabet. -P can be partitioned into P 0 ; P 1 ; . . .; P k .
Notice that this characterization corresponds to a twostage approach: First, the right-linear grammar G R is used to produce a sequence of symbols from N 0 that both serve as terminal symbols for G R and as nonterminal symbols for the linear grammar G i that can be obtained from G by using rules P i only. Here, it is not necessary but possible to insist on using N 00 N 0 instead of N 0 as the terminal alphabet of G R , such that N 00 \ N i ¼ fS i g for each i 2 ½1. . .k, i.e., we can single out a start symbol S i for each G i . Clearly, the linear rules mentioned in the previous proposition can be assumed to be in normal form. In order to simplify the proofs of some of our main results, the following observations from Fernau et al. (2018b); Fernau et al. (2018c) are helpful.
We often use labels from ½1. . .jPj to uniquely address the rules of a grammar in tsSGNF. Then, such labels (and possibly also primed version thereof) will be used as rule markers that are therefore part of the nonterminal alphabet of the simulating matrix ins-del system. For the ease of reference, we collect in P ll the labels of the context-free rules of the form X ! Yb (which resemble left-linear rules) and in P rl the labels of the context-free rules of the form X ! bY (which resemble right-linear rules).
Some of the key features in our construction of matrix ins-del systems in this section are the following ones: -There is at least one deletion rule in most simulating matrices, mostly for reasons of control. In some cases, the axiom will have $ and we delete this in order to avoid repeating the matrix and to ensure that the matrix (containing the deletion of $) is applied only once until the intended rule simulation is completed. We insert $ again at the end of the simulation. -In the majority of cases, at least one of the deletion rules of every matrix has a rule marker in the left context or the marker itself is deleted. A matrix of this type is said to be guarded. The importance of a matrix being guarded is that it can be applied only in the presence of the corresponding rule marker. This will avoid interference of any other matrix application. -After successful application of every matrix, either a rule marker remains or the intended simulation is completed. -As discussed in Remark 1, during Phase I, the symbols A and C are on the left of the middle nonterminal S or S 0 and the corresponding symbols B and D are on the right of S or S 0 . When S 0 is deleted from the center, the symbols from fA; Cg and fB; Dg may combine to be erased in Phase II. -In the transition to Phase II, a special symbol Z is introduced that is assumed to stay to the left of AB or CD, whatever substring is to be deleted. Special matrices allow Z to move in the sentential form or to be (finally) deleted. This is our novel idea not used in earlier papers. -There is a subtlety if k 2 L. Then, we can assume that S ! k is in the simulated grammar, which would add one more erasing matrix, similar to h1 in Fig. 2, which deletes S and introduces Z.
We now proceed to present our results.
Proof Formally, consider a type-0 grammar G ¼ ðN; T; P; SÞ in tsSGNF. The rules from P are supposed to be labelled injectively with labels from the set ½1. . .jPj, with label sets P ll and P rl as defined above. Also recall that the nonterminal alphabet decomposes as N ¼ N ð0Þ [ N 0 [ N 00 , N 00 ¼ fA; B; C; Dg, S 2 N ð0Þ ; S 0 2 N 0 , according to the normal form. We construct a matrix insertion-deletion system C ¼ ðV; T; fSg; MÞ, where the alphabet of C is The set of matrices M of C consists of the matrices described in the following.
We simulate a rule p: X ! bY, X; Y 2 N ð0Þ [ N 0 , b 2 N 00 , i.e., p 2 P rl , by the four matrices displayed on the left-hand side of Fig. 1.
Similarly, we simulate the rule q: X ! Yb, i.e., q 2 P ll , by the four matrices shown on the right-hand side of Fig. 1 in a symmetrical manner.
Recall that applying the rule h : S 0 ! k starts Phase II within the working of G. In the simulation, the presence of a new symbol, Z, indicates that we are in Phase II. This motivates the introduction of the five matrices listed in Fig. 2.
We now proceed to prove that LðCÞ ¼ LðGÞ. We initially prove that LðGÞ LðCÞ by showing that C correctly simulates the application of the rules of the types p, q, f, g, h, as discussed above. We explain the working of the simulation matrices for the cases p and f mainly, as the working of q and g simulation matrices are similar, and as the working of the simulation of the h rule is clear. Notice that the transition from Phase I to Phase II (as accomplished by applying h in G) is now carried out by applying h1 and hence introducing Z which will be always present when simulating Phase II with the system C.
Simulation of p : X ! bY: consider the string aXb derivable from S in G, with X 2 N ð0Þ [ N 0 and a 2 fA; Cg Ã , b 2 fB; Dg Ã T Ã according to Remark 1. We now show that on applying the matrices introduced for simulating rules from P rl , we can derive abYb within C, starting from aXb. First, we apply the rules of matrix p1. The markers p and p 0 are randomly inserted by the first two rules, leading to a string from . However, the third rule of p1 is applicable only when p 0 p is inserted before the nonterminal X. This shows that aXb ) p1 c 1 is possible if and only if c 1 ¼ ap 0 pb. Now, on applying matrix p2, p 00 and p 000 are inserted anywhere, so intermediately we arrive at a string from . Then, p 0 is deleted in the left context of p 000 p 00 . So, we now arrive at the string ap 000 p 00 pb. This shows that c 1 ¼ ap 0 pb ) p2 c 2 is possible if and only if c 2 ¼ ap 000 p 00 pb. We now apply matrix p3. Hence, b is first inserted randomly, leading to a string from . The left context in the second rule of p3, enforces that, inevitably, we arrive at c 3 ¼ ap 000 bpb. Finally, we apply matrix p4. Here, Y is inserted anywhere by the first rule, but the second one enforces that we now look at ap 000 bYb, which yields c 4 ¼ abYb by the last rule. As G is in tsSGNF, we also know that Y 2 N 00 . This shows that c 3 ¼ ap 000 bpb ) p4 c 4 is possible if and only if c 4 ¼ abYb. The intended sequence of derivations is hence: aXb ) p1 ap 0 pb ) p2 ap 000 p 00 pb ) p3 ap 000 bpb ) p4 abYb: This completes the simulation of rule p. Simulation of q : X ! Yb is similar and symmetric to the working of the p rule simulation and hence omitted.
Simulation of f : AB ! k or g : CD ! k: consider the sentential form aABb derivable in G. This means that we are in Phase II. As said above, the symbol Z will be present in the corresponding sentential form derivable in C. Any string from can be transformed into aZABb by using matrix move-Z. Now, aZABb ) f 1 aZb correctly simulates one application of f. Now, we prove LðCÞ LðGÞ. Formally, this is an inductive argument that proves the following properties of a string w 2 V Ã such that S ) Ã w in C: 1. At most one symbol from N ð0Þ [ N 0 is occurring in w. 2. If one symbol X from N ð0Þ occurs in w, then w ¼ aXu, where a 2 fA; Cg Ã and u 2 T Ã : w is derivable in G; 3. If one symbol X from N 0 occurs in w, then w ¼ aXbu, where a 2 fA; Cg Ã , b 2 fB; Dg Ã and u 2 T Ã : w is derivable in G; 4. If no symbol from N ð0Þ [ N 0 occurs in w, then Z occurs at most once in w.

If no symbol from
(a) (b) Fig. 1 Matrices of size (3; 1, 0, 0; 1, 2, 0) for simulating the context-free rules of tsSGNF On the generative capacity of matrix insertion-deletion systems of small sum-norm 677 These properties are surely true at the very beginning, as the sentential form S satisfies 2. We are discussing the induction step in what follows.
Conditions 2 and 3 consider any sentential form w that satisfies 2 or 3. Hence, w ¼ aXbu, where a 2 fA; Cg Ã , b 2 fB; Dg Ã and u 2 T Ã . In fact, the conditions are more specific about some details regarding X and b. All rules but r1 (for some context-free rule r) or h1 require the presence of some rule marker (or of Z) and are hence not applicable.
-If matrix r1 is applied, then w 0 ¼ ar 0 rbu results, satisfying 5(a). The left-hand side of rule r must have been X. By induction, aXbu is derivable in G. -If h1 is applied, then w 0 results, with , satisfying 6. Matrix h1 checks the presence of X ¼ S 0 . By induction, aS 0 bu is derivable in G, so that applying h1 corresponds to an application of h on aS 0 bu in G.
Condition 5(a) Consider any sentential form w that satisfies 5(a). Hence, w ¼ ar 0 rbu, where a 2 fA; Cg Ã , b 2 fB; Dg Ã and u 2 T Ã . Moreover, aXbu is derivable in G, where X is the left-hand side of rule r. As no other rule markers are present in w, only matrix r1 is applicable. Now, we have to distinguish between r ¼ p 2 P rl and r ¼ q 2 P ll . In the first case, we inevitably derive w 0 ¼ ap 000 p 00 pbu [see 5(b)], and in the second case, we arrive at w 0 ¼ aq 0 q 00 bbu [see 5(d)]. In both cases, by induction hypothesis, the stated derivability conditions on G are true.
Condition 5(b) Consider any sentential form w that satisfies 5(b). Hence, w ¼ ap 00 bpbu, where a 2 fA; Cg Ã , p 2 P rl with p : X ! bY, b 2 fB; Dg Ã and u 2 T Ã : aXbu is derivable in G. The only matrix that can cope with the presence of the rules markers p and p 00 (and only these) is p3. Now, inevitably, w ) p3 w 0 ¼ abYbu, bringing us into Case 2 or 3, as G can derive this string from aXbu (induction hypothesis) by applying p.
Condition 5(c) Consider any sentential form w that satisfies 5(c). Hence, w ¼ ap 000 bpbu, where a 2 fA; Cg Ã , p 2 P rl with p : X ! bY, b 2 fB; Dg Ã and u 2 T Ã : aXbu is derivable in G. The presence of the rules markers p and p 000 enforces us to apply matrix p4. Now, inevitably, w ) p4 w 0 ¼ abYbu, bringing us into Cases 2 or 3, as G can derive this string from aXbu (induction hypothesis) by applying p.
Condition 5(d) As the reader may check, no matrix from C is applicable in such a situation.
Condition 6 Consider any sentential form w that satisfies 6. The only applicable matrices are move-Z, del-Z, f1, g1. If we apply matrix move-Z, this brings us back to another situation of Case 6, whose claims readily hold by induction. A similar easy case is the application of del-Z, which leads us into Case 5(d). This is particularly interesting when , as now a terminal string was derived in C that is also generated by G. Matrix f1 can only be applied if Z sits immediately to the left of the substring AB. The effect of applying f1 corresponds to deleting this substring and hence to applying the rule f in G. This brings us back to Case 6. A similar argument holds for applying matrix g1.
These considerations complete the proof due to Condition 5(d) that applies to w 2 T Ã . The second equality follows by Proposition 2. h It is shown that MATð3; 1; 2; 0; 1; 0; 0Þ ¼ MATð3; 1; 0; 2; 1; 0; 0Þ ¼ RE in Fernau et al. (2019), which is the conference version of this paper. We now improve the matrix length from 3 to 2 in the following theorem.
Before we begin our proof, we highlight the key feature of the markers first. In order to simulate, say, AB ! k, we have to use deletion rules ðk; A; kÞ del and ðk; B; kÞ del , as deletions cannot be performed under contexts. However, there is the danger that we are deleting unintended occurrences. So we have to carefully place markers before, after and between the chosen nonterminals A and B in order to check that they are neighbored. Also, the auxiliary nonterminal $, which is present in the axiom itself, serves as a Fig. 2 Matrices of size (2; 1, 0, 0; 1, 1, 0) for simulating the erasing rules of tsSGNF semaphore flag as known in concurrent programming, preventing simulation cycles from being interrupted. We will use this trick also in other simulations below.
Proof Consider a type-0 grammar G ¼ ðN; T; P; SÞ in tsSGNF, with the rules uniquely labelled with P ll [ P rl . Recall the decomposition N ¼ N ð0Þ [ N 0 [ N 00 by tsSGNF. We can construct a matrix ins-del system C ¼ ðV; K is the following set of markers: fp; p 0 ; p 00 ; p 000 j p 2 P rl g [ fq; q 0 ; q 00 ; q 000 j q 2 P ll g [ ff ; f 0 ; f 00 ; f 3 ; f 4 ; f 5 ; f 6 ; f 7 ; f 8 ; f 9 ; f 10 ; g; g 0 ; g 00 ; g 3 ; g 4 ; g 5 ; g 6 ; g 7 ; g 8 ; g 9 ; g 10 ; $g : The set of matrices M is defined as follows. Rules p : X ! bY 2 P rl and q : X ! Yb 2 P ll are simulated by the matrices shown in Fig. 3a, b, respectively. We simulate rule f : AB ! k by the matrices shown in Fig. 4. Rule g : CD ! k is simulated alike.
Recalling that our axiom is $S, we also have two additional matrices (i) s ¼ ½ðk; $; kÞ del for termination and (ii) h1 ¼ ½ðk; S 0 ; kÞ del to simulate the phase transition h : S 0 ! k.
We now proceed to prove that LðCÞ ¼ LðGÞ, starting with the inclusion LðGÞ LðCÞ. Consider the string aXb derivable from S in G, with X 2 N ð0Þ [ N 0 and a 2 fA; Cg Ã , b 2 fB; Dg Ã T Ã according to Remark 1. We now show that on applying the matrices of Fig. 3a (introduced for simulating rules from P rl of the type X ! bY), we can derive some string within C, starting from some , simulating w ¼ aXb ) abYb ¼ w 0 in G.
Quite similarly, applying the matrices of Fig. 3b (introduced for simulating rules from P ll of the type X ! Yb), we can derive some string within C, starting from some , simulating w ¼ aXb ) aYbb ¼ w 0 in G.
Every time a context-free rule is simulated by either p or q rules, the marker $ is first deleted and finally re-inserted at a somewhat random position at the end of every simulation. In other words, the $ gets shuffled around the string during Phase I. The phase transition rule h : S 0 ! k is simulated by applying h1, so that we can now speak about Phase II of G. As the working of the g rule (a) (b) Fig. 3 Simulating context-free rules of tsSGNF by matrix rules of size (2; 1, 2, 0; 1, 0, 0) simulation is similar to the working of the f rule simulation, we discuss only rule f below. To actually produce a terminal word, C has to apply s at the very end. We now discuss Phase II in detail, focussing on f : AB ! k. Let w ¼ aABb be a sentential form derivable in G, with A; B 2 N 00 and a 2 fA; Cg Ã , b 2 fB; Dg Ã T Ã , ensured by tsSGNF. This means that is derivable in C (by induction). We can now see that The purpose of introducing a $ in f13 is to enable another simulation of AB ! k or of CD ! k. When all occurrences of AB and CD are deleted by repeated applications of the matrices designed for simulating the f and g rules, there is still a $ at the end of every simulation. This $ is deleted by applying rule s, thereby terminating Phase II of tsSGNF. Inductively, this shows that LðGÞ LðCÞ.
Let us now prove the converse direction. Consider once more a string w ¼ aXb derivable from S in G, with X 2 N ð0Þ [ N 0 and a 2 fA; Cg Ã , b 2 fB; Dg Ã T Ã according to Remark 1. We know by our previous arguments that the variation can be derived in C. In particular, the axiom fits into this description. We will now argue that, starting with such a string, we either terminate the first phase of the simulation by applying h1, which obviously corresponds to applying S 0 ! k in G, or we try to apply any of the other matrices. We will then show that any nonblocked derivation will again lead to a string of the form , which justifies our starting point inductively. As all matrices of the form p2, ..., p7 or q2, ..., q7 or f2, ..., f13 require the presence of a marker symbol from Knf$g, we can focus on applying the matrices p1, q1 or f1. Here, we ignore the rules g1, ..., g13 due to their similarity to the matrices simulating the f rules. Also, the matrices simulating the p rules and the q rules are very similar, so that we only discuss the first ones.
If we apply f1, this blocks any other simulation branch, as the marker $ is deleted and the marker f is inserted, but no other marker is present in the string w 0 that can be thought of being produced from w by randomly inserting some f. As can be checked case-by-case, the only applicable matrix is now f2, which also makes clear that the f was inserted left to some A-occurrence (and hence within a) in w. To highlight the chosen insertion place, let a ¼ a 0 Aa 00 such that w 0 ¼ a 0 fAa 00 Xb. Now, if w 0 ) f 2 w 00 , we can conclude that w 00 ¼ a 0 ff 0 Af 00 a 00 Xb. The only applicable matrix is now f4, leading to w 00 ) f 4 a 0 ff 0 f 00 f 6 a 00 Xb ) f 5 a 0 ff 0 a 00 Xb. Notice that the application of f5 that we displayed is in fact the only possibility. But now, the derivation is stuck. Therefore, there is no use of applying f1 on w $ .
We can only simulate p rules on w $ that have X as their left-hand side, because the correctness of this (unique) symbol is tested as left context in p1. This enforces w $ ) p1 aXpb as intended. As $ is deleted and no (variation of) f is present as a marker, in particular no fi matrix is applicable for i ¼ 1; . . .; 13. As p is the only marker in aXpb, only p2 is applicable indeed, which enforces aXpb ) p2 app 0 b as intended. The presence of p and p 0 makes three matrices interesting to apply: p2, p3 and p7. However, the absence of X renders applying p2 impossible. Yet, p7 could be applied, leading to apb. But how to continue from here? Any rule dealing with p either requires some symbol like X Fig. 4 Simulating non-contextfree rules by matrix rules of size (2; 1, 2, 0; 1, 0, 0) to the left of p (in matrix p2) or some p 0 to the right of p (in matrix p3) or the presence of p 00 p 0 (in matrix p4). The absence of $ also prohibits starting another rule simulation. In other words, the derivation is stuck. This shows that we have to continue with app 0 b ) p3 app 000 p 0 p 00 b, as was our intention. Observe that neither $ nor X nor pp 0 nor bp 00 nor Y is present in the current sentential form, which means that only p4 or p7 might apply. After applying p7, we obtain app 000 p 00 b, which again has no substring like $, X, pp 0 , bp 00 or Y. Additionally, the substring p 000 p 0 is now lacking, which means that none of the rules is applicable and hence the derivation is blocked. Therefore, we have to apply matrix p4 as intended, enforcing app 000 p 0 p 00 b ) p4 ap 000 p 0 bp 00 b. The absence of $, X (or Y) and p blocks pi for i ¼ 1; 2; 3; 4; 6, as well as f1. If we apply p7, we arrive at ap 000 bp 00 b. Still, symbols X, Y and p are missing, so that p5 would be the only applicable rule, leading to ap 000 bp 00 b ) p5 ap 000 bYb. Due to the absence of a $-marker, the only matrix that can deal with the substring p 000 b is p6, which leads to abY$b as intended, although by following a strategy slightly different from the one presented before. Finally, we have to discuss what happens if we apply p5 on ap 000 p 0 bp 00 b (as presented above). We arrive at ap 000 p 0 bYb. As the markers p and $ are missing, only p6 and p7 are applicable. If p7 is applied first, then arguments similar to the previous ones show that now only p6 is applicable, leading to abY$b as intended, although by again following a slightly different strategy. Alternatively, we consider applying p6 on ap 000 p 0 bYb as intended, leading to ap 0 bY$b. When we apply p7 now, we have arrived at abY$b with the derivation strategy presented above.
However, there is one last catch in this simulation. Nobody forces us to apply p7 on ap 0 bY$b; we could also keep p 0 within the string and continue with simulations of context-free rules or (failed) simulations of non-contextfree rules (as discussed above) or, after applying h1, we might even start (successfully) simulating non-context-free rules (as discussed below). A similar analysis is valid for the q rules, leading to a string like aq 0 Yb$b. Now, observe that any matrix (apart from p7 or q7 that erase p 0 or q 0 ) that makes use of p 0 (or q 0 ) expects p or p 000 (q or q 000 , respectively) to the left of p 0 (or q 0 ), which cannot happen, as the (unique) symbols from N ð0Þ [ N 0 of the tsSGNF grammar stay to the right of p 0 (or q 0 ). Therefore, the presence of single-primed rule markers is harmless, they are to be deleted at any time later using p7 or q7. Hence, we ignore them in our discussions. In particular, assuming that we only have to discuss a string w ¼ aXb derivable from S in G (as we did so far) is not devaluating our argumentation. Now, assume that Phase I was simulated as intended. This means that we consider some string w that is derivable in Phase I by G as well as is by C. As we are using tsSGNF, this means that w 2 fA; Cg Ã fB; Dg Ã T Ã by Remark 1. Notice that by the discussions performed so far, this observation translates to the simulating grammar C.
First, assume that w ¼ aAfb for some a 2 fA; Cg Ã , f 2 fB; Dg and b 2 fB; Dg Ã T Ã , or f 2 T and b 2 T Ã , or w ¼ aA is a sentential form derivable in G, corresponding to some string w $ derivable in C. The only applicable rule is f1 (or g1, discussed at the end), since other matrices demand the presence of a marker (say, either f or f 00 ). Also, no rule from the simulation of Phase I is applicable anymore due to the absence of symbols from N ð0Þ [ N 0 . Recall that we ignore the possible presence of symbols like p 0 as discussed above. Also, by the very structure of the matrices simulating an f rule, no progress on a sentential form b with b 2 fB; Dg Ã T Ã is observed beyond the possible application of f1. One application of f1 on w deletes the symbol $ that was present in the axiom and introduces a marker f randomly, hence leading to a string w 1 from . All matrices simulating the f rule require the presence of (multiply) primed versions of the marker f, apart from f2 which has to be applied next. Matrix f2 checks that an A must be immediately to the right of f, which means that f has been previously inserted within the prefix aA of w. Hence, the resulting string w 2 can be (equivalently) obtained from w by first picking one occurrence of A within the prefix aA and then inserting the string f 00 immediately to the right of this A-occurrence and f 0 immediately to the right of marker f. The introduction of f 0 between f and A spoils the pattern fA, thus f2 cannot be applied again. This leads to the string a 0 ff 0 Af 00 a 00 fb, with aA ¼ a 0 Aa 00 . All matrices fi but f3 require at least one of the substrings $, fA, f 0 f 00 or f k (3 k 10) to be present, which renders them inapplicable. However, matrix f3 also checks that the Aoccurrence that we picked within w sees a B-occurrence to the immediate right of Af 00 . This enforces f ¼ B in our string w ¼ aAfb and a ¼ a 0 a 00 (all other strings are stuck at this point). Therefore, after applying matrix f3, we arrive at the string w 3 ¼ aff 0 Af 00 f 3 Bf 5 b. Now, none of the matrices f 5 À f 13 are applicable due to the absence of one of the markers f 4 ; f 6 ; f 7 ; f 9 ; f 10 . The matrices f1, f2, f3 are also inapplicable due to the absence of $, fA, and f 00 B, respectively. Hence, the only applicable rule is f4. The first rule in f4 demands the deletion of one occurrence of A. Initially, it might be tempting to delete some other unintended A-occurrence. However, only if the intended A-occurrence (part of the substring f 0 Af 00 ) is deleted, then we will have the substring f 0 f 00 in order to apply the second rule of f4. Hence, we get w 4 ¼ aff 0 f 00 f 6 f 3 Bf 5 b. Again, matrices f 1 À f 3, f 6 À f 13 still remain inapplicable due to the same reason as above. The only applicable matrices on w 4 are f4 (again) or f5.
Suppose f4 is applied again (repeatedly for k ! 0 times) on w 4 , then some k number of As in a are deleted freely and ðf 6 Þ k is inserted after f 0 f 00 , leading to a string w 0 4 ¼ a 0 ff 0 f 00 ðf 6 Þ k f 6 f 3 Bf 5 b, where a 0 is obtained from a by deleting k occurrences of A. For further continuation of the derivation, the only other applicable matrix is f5. Since there is a unique occurrence of f 00 , the matrix f5 can be applied only once, which will delete only one f 6 leading to the string w 00 4 ¼ a 0 ff 0 ðf 6 Þ k f 3 Bf 5 b. Assuming f4 is applied no more, no other matrix (including f6), is applicable due to the absence of one of $; fA; f 00 B; f 00 ; f 4 ; f 7 ; f 9 ; f 10 . Hence, the derivation is stuck here if k [ 0. We hence apply matrix f5 on Due to the absence of one of the markers or substrings $; fA; f 00 ; f 4 ; f 7 ; f 9 ; f 10 , no matrix other than f6 is applicable. Applying f6 on w 5 yields w 6 ¼ aff 0 f 7 Bf 5 b. The absence of $; fA; f 00 ; f 3 ; f 4 ; f 7 f 5 ; f 8 ; f 9 ; f 10 blocks the applicability of all fi matrices except f7. Applying f7 on w 6 leads to the string w 7 ¼ af 0 f 7 Bf 4 f 5 b as intended. Matrices f 1 À f 7 are not applicable, since the markers $; f ; f 00 ; f 3 are not present in w 7 . Similarly, matrices f9, f11, f12 and f13 are not applicable on w 7 , since the markers f 8 , f 9 and f 10 are not present. Additionally, f10 is inapplicable due to the absence of f 7 f 5 . Thus, the only applicable matrix is f8. The first rule in f8 demands the deletion of one occurrence of B. Initially, it might be tempting to delete some other unintended Boccurrence. However, only if the indented B is deleted, then we will have the substring f 7 f 4 , and the second rule of f8 can be applied. Hence, we get w 8 ¼ af 3 f 7 f 4 f 8 f 5 b. The matrices f 1 À f 7, f 11 À f 13 are inapplicable due to the absence of one of the markers $; f ; f 3 ; f 00 ; f 9 ; f 10 . The matrix f10 is inapplicable, since we do not the have the context f 7 f 5 in w 8 . The only applicable matrices on w 8 are f8 (again) or f9.
Suppose f8 is applied again (repeatedly for k ! 0 times) on w 8 , then some k number of Bs in b are deleted freely and ðf 8 Þ k is inserted after f 7 f 4 , leading to a string For further continuation of the derivation, the only other applicable matrix is f9. Since there is a unique occurrence of f 4 , the matrix f9 can be applied only once, which will delete only one f 8 , leading to the string Due to the absence of any of $; f ; f 00 ; f 3 ; f 4 ; f 9 ; f 10 , no matrix is applicable on w 0 9 but f 10 , but this requires the presence of the substring f 7 f 5 . This is only possible of k ¼ 0 (as intended), i.e., if w 8 ¼ w 0 8 and w 9 ¼ w 0 9 ¼ af 0 f 7 f 5 b.
The matrices f 1 À f 9, f 11 À f 13 are clearly inapplicable on w 9 due to the absence of the markers $; f ; f 0 ; f 00 ; f 4 ; f 9 ; f 10 . So we could now apply f10 on w 9 , then we will have w 10 ¼ af 0 f 7 f 9 b. Due to absence of essential markers, all matrices except f11 and f12 are inapplicable. If the latter is applied, then we get w 0 10 ¼ af 7 b and the derivation is stuck as no continuation is possible. In particular, we cannot apply matrix f7 due to the absence of f, a marker that we cannot introduce by applying f1 due to the absence of the marker $. So, f11 is applied onto w 10 and we get w 11 ¼ af 0 f 9 f 10 b. Now, the only applicable matrices are f12 and f13. Both the rules can be applied in any order (independently) to get . Observe that there are also scenarios where only f13 is applied, so that we stick with . Now, we can indeed start a new cycle of simulation with f1 and f2, but then at latest, in order to find the substring f 00 B as required by f3, we should apply f12 to connect a and b.
Let us finally return to the situation when we try to apply g1 on w $ , with w ¼ aAfb for some a 2 fA; Cg Ã , f 2 fB; Dg and b 2 fB; Dg Ã T Ã , or f 2 T and b 2 T Ã , or w ¼ aA (i.e., f ¼ b ¼ k), being a sentential form derivable in G, corresponding to some string w $ derivable in C. If w ) g1 w 0 , then . If we now apply g2, this means that we have split a as a 0 Ca 00 , so that for w 0 ) g2 w 00 , w 00 ¼ a 0 gg 0 Cg 00 a 00 Afb, with f and b satisfying the conditions stated above. However, now the derivation is stuck, as the string w 00 does not contain a substring CD as required by matrix g3.
These arguments show that also the non-context-free rules are correctly simulated and hence the whole simulation is correct, as also no successful re-starts of simulations are possible on strings from . The second claimed computational completeness result follows by Proposition 2 and this concludes the proof. h In the previous two theorems, the maximum length of the insertion/deletion context was two and the other operation, namely deletion/insertion is done in a context-free manner. If we restrict the parameters in the size to be binary (0 or 1), then we achieve computational completeness using matrices of maximum length two; however, insertion is now performed under a 2-sided context.
Proof Consider a type-0 grammar G ¼ ðN; T; P; SÞ in tsSGNF. The rules from P are supposed to be labelled injectively with labels from the set ½1. . .jPj, with label sets P ll and P rl as defined above. Also recall that the nonterminal alphabet decomposes as N ¼ N ð0Þ [ N 0 [ N 00 , N 00 ¼ fA; B; C; Dg, S 2 N ð0Þ ; S 0 2 N 0 , according to the normal form. We construct a matrix insertion-deletion . . .; f 7 ; g; g 0 ; g 00 ; g 3 ; . . .; g 7 g The set of matrices M of C consists of the matrices described in Fig. 5a, b and in Fig. 6.
Specifically, we simulate a rule p: X ! bY, X 6 ¼ Y, X; Y 2 N ð0Þ [ N 0 , b 2 N 00 , i.e., p 2 P rl , by the matrices displayed on the left-hand side of Fig. 5a. Similarly, we simulate a rule q: X ! Yb, X 6 ¼ Y, X; Y 2 N ð0Þ [ N 0 , b 2 N 00 [ T, i.e., q 2 P ll , by the matrices shown on the right-hand side of Fig. 5b. We simulate rule f : AB ! k by the matrices shown in Fig. 6. The simulation of rule g : CD ! k is done is a similar manner.
Recalling that our axiom is $S, we also have two additional matrices (i) s ¼ ½ðk; $; kÞ del for termination and (ii) h1 ¼ ½ðk; S 0 ; kÞ del to simulate the phase transition h : S 0 ! k.
We now proceed to prove that LðCÞ ¼ LðGÞ, starting with the inclusion LðGÞ LðCÞ. Consider the string derivable from $S in G, with X 2 N ð0Þ [ N 0 and a 2 fA; Cg Ã , b 2 fB; Dg Ã T Ã according to Remark 1. We apply matrix p1, which deletes the only hanging marker $ and then inserts p to the right of X, leading to w 1 ¼ aXpb. On applying matrix p2, which inserts a p 0 between X and p and then deletes the nonterminal X, we have w 2 ¼ ap 0 pb. Applying matrices p3, p4, p5 in the specified order, we have the following: We note that at every cycle of context-free rule simulation, the $ is deleted at the beginning of the simulation and introduced at the end of the simulation so as to enable the start of next simulation cycle.
The phase transition rule h : S 0 ! k is simulated by applying h1, so that we can now speak about Phase II of G. As the working of the g rule simulation is similar to the working of the f rule simulation, we discuss only rule f below. To actually produce a terminal word, C has to apply s at the very end.
We now discuss Phase II in detail, focusing on f : AB ! k. Let w ¼ aABb be a sentential form derivable in G, with A; B 2 N 00 and a 2 fA; Cg Ã , b 2 fB; Dg Ã T Ã , ensured by tsSGNF. This means that is derivable in C (by induction). We can now see that The purpose of introducing a $ in the last rule f10 or g10 is to enable another simulation of AB ! k or of CD ! k. When all occurrences of AB and CD are deleted by repeated applications of the simulations of the f and g rules, there is still a $ at the end of every simulation. This $ is deleted by applying rule s, thereby terminating Phase II of tsSGNF. Inductively, this shows that LðGÞ LðCÞ.
Let us now consider the converse direction. Consider a string w ¼ aXb derivable from S in G, with X 2 N ð0Þ [ N 0 (a) (b) Fig. 5 Matrices of size (2; 1, 1, 1; 1, 0, 0) for simulating context-free rules of tsSGNF Fig. 6 Matrices with contextfree deletion simulating f : AB ! k and g : CD ! k On the generative capacity of matrix insertion-deletion systems of small sum-norm 683 and a 2 fA; Cg Ã , b 2 fB; Dg Ã T Ã according to Remark 1. We know by our previous arguments that the variation can be derived in C. We will now argue that, starting with such a string, we either terminate the first phase of the simulation by applying h1, which obviously corresponds to applying S 0 ! k in G, or we try to apply any of the other matrices. As all matrices of the form p2, ..., p5 or q2, ..., q5 or f2, ..., f10 require the presence of a marker symbol from Knf$g, we can focus on applying p1, q1 or f1. Here, we ignore the matrices g1, ..., g10 due to their similarity to the fi matrices. Also, the simulations of the p rules and q rules are very similar, so that we only discuss the first ones.
We now start to apply p1 on w $ which deletes the marker $ and then inserts a p to the right of X. Hence, w $ ) p1 aXpb. The absence of $; p 0 ; Y blocks the application of rules p1, p3, p4, p5. Deterministically, the next matrix application is p2 on w 1 which inserts p 0 after X and then deletes the X to yield w 2 ¼ ap 0 pb. It is to be noted that to the left of p, the marker p 0 is present and therefore, matrix p4 cannot be applied. Since there is no X, the matrices p1 and p2 cannot be applied. Further, the absence of bY prevents the application of the rule of p5. We must apply matrix p3 now, introducing a b between p 0 and p and then deleting the marker p 0 . This corresponds to applying the rewriting rule p 0 ! b to w 2 , yielding w 3 ¼ abpb. The absence of $; X; p 0 ; Y forces us to apply the only applicable matrix p4 on w 3 that inserts a Y before p, yielding w 4 ¼ abYpb. The only applicable matrix is now p5 which inserts a $ between the recently introduced bY and deletes the marker p, yielding w 5 ¼ b$Y. Now, assume that Phase I was simulated as intended. This means that we consider some string w that is derivable in Phase I by G as well as is by C. As we are using tsSGNF, this means that w 2 fA; Cg Ã fB; Dg Ã T Ã by Remark 1.
First, assume that w ¼ aAfb for some a 2 fA; Cg Ã and b 2 fB; Dg Ã T Ã , or f 2 T and b 2 T Ã , or w ¼ aA is a sentential form derivable in G, corresponding to some string w $ derivable in C. The only applicable rule is f1 (or g1, discussed at the end), since other matrices demand the presence of a marker (say, either f or f 00 ). Also, no rule from the simulation of Phase I is applicable anymore due to the absence of symbols from N ð0Þ [ N 0 . Also, by the very structure of the matrices simulating an f rule, no progress on a sentential form b with b 2 fB; Dg Ã T Ã is observed beyond the possible application of f1. On applying f1 on w deletes the symbol $ that was present in the axiom and introduces a marker f randomly, hence leading to a string w 1 from . Application of f1 again is not possible due to the absence of $. Apart from the matrices f2 and f3, all other matrices simulating the f rule require the presence of (multiply) primed versions of the marker f and therefore they cannot be applied.
Assume first we had applied matrix f3 on w 1 . The obtained string w 0 can be obtained from w by inserting a f 00 between AB (which must form the central part). Since f 0 is missing, f4 cannot be applied. But f 0 is introduced by f2 only, which supposes f to be presented, whose introduction assumes the presence of $. Can we get rid of f 00 again? In order to do so, we must apply matrix f6, which assumes the presence of f 4 . However, in order to introduce f 4 , we must apply matrix f4, which is impossible. Hence, the derivation is stuck.
So, to proceed further, one has to apply matrix f2 on w 1 . The first rule in matrix f2 checks that an A must be immediately to the right of f, which means that the previously inserted f has been introduced within the prefix aA of w 1 , thus verifying the decomposition w 1 ¼ a 0 fAa 00 fb, with aA ¼ a 0 Aa 00 . A new marker f 0 is introduced between f and A by the first rule of matrix f2. The second rule in f2 introduces the marker f 3 after any B, thus obtaining w 2 ¼ a 0 ff 0 Aa 00 b 0 Bf 3 b 00 , with fb ¼ b 0 Bb 00 . The same matrix cannot be applied again, as the substring fA is no longer present in the derived string. Now, only two matrices, namely f3 and f8, are applicable to w 2 , since other matrices require markers which are not introduced yet. Applying f8 makes no sense, as the just introduced markers f 0 and f 3 are deleted. Alternatively, the matrix f3 introduces the marker f 00 between A and B, this ensures that the B must be immediately to the right of A in w 2 , which enforces f ¼ B in w (also enforces that in w 2 , a 00 must end with A and b 0 must start with a B) and also deletes the marker f. Notice that this introduction of f 00 also ensures that the central part of w was properly formed, avoiding mismatches like AD.
Hence, we have w 3 ¼ a 0 f 0 Aa 00 f 00 b 0 Bf 3 b 00 . The absence of the contexts $, fA, AB and f i for i ! 4 blocks the application of matrices f 1 À f 10 except f4, f5 and f8. If we apply matrix f8 now, the derivation is stuck, as now also f4 and f5 are inapplicable. A similar problem appears if we apply first f4 or f5 and then f8. The matrix f4 (applied on w 3 ) demands that if a A is deleted randomly, then we should get the substring f 0 f 00 in the sentential form in order to apply the second rule of f4 and this is possible only if a 0 f 0 Aa 00 f 00 ¼ a 0 f 0 Af 00 in w 3 , i.e., if a 00 ¼ k. Similarly, the matrix f5 demands that if a B is deleted randomly, then we should get the substring f 00 f 3 in the sentential form in order to apply the second rule of f5 and this is possible only if f 00 b 0 Bf 3 b 00 ¼ f 00 Bf 3 b 00 in w 3 , i.e., if b 0 ¼ k. In summary, we find that necessarily w 3 ¼ a 0 f 0 Af 00 Bf 3 b 00 . Now, matrices f4 and f5 are applied in any order. They basically simulate the rewriting rules f 0 A ! f 0 f 4 and f 00 B ! f 00 f 5 , so that we get w 4 ¼ a 0 f 0 f 4 f 00 f 5 f 3 b 00 . As the only matrix (namely, f6) that requires (apart from an occurrence of f 00 ) the presence of f 4 also requires the presence of f 5 (and vice versa), we have to apply both matrices f4 and f5 before proceeding.
Note that from now on the matrices f4 or f5 can be reapplied if and only if f 0 f 00 or f 00 f 3 is a substring of our sentential form, because deleting A or B cannot produce these substrings that are required by the second rules of the matrices f4 or f5, respectively. We call this observation ob*. Now, what remains is the deletion of the markers that were introduced in this simulation in some order, however taking care that f 0 f 00 and f 00 f 3 is never a substring in the resulting sentential form, so as to avoid an unintended (re)application of rules f4, f5 which will delete random occurrences of A or B (see ob*).
This danger is handled by replacing f 00 with f 6 in matrix f6. One may wonder what if the matrix f6 was never applied to the sentential form w 4 ¼ a 0 f 0 f 4 f 00 f 5 f 3 b 00 . Due to ob*, the only matrices that are applicable to w 4 are f6 and f8. If f6 was avoided and f8 was applied, then the markers f 0 ; f 3 are deleted, leaving behind w 5 ¼ a 0 f 4 f 00 f 5 b 00 . At this point, no matrix is applicable except f6. Hence the matrix f6 is somehow enforced to be applied on w 4 or w 5 which replaces the marker f 00 as f 6 . Due to absence of f 00 and ob*, matrices f4 and f5 can never be re-applied. If f 00 has to be introduced again (using matrix f3), then AB need to be present as substring which is not possible as some markers are present in between them in the derived string w 4 or w 5 . The purpose of matrix f7 is to make sure that f 4 and f 5 are deleted in different matrices. The markers are deleted using matrices f8 to f10 in any desired (applicable) order yielding . Three such derivations are shown below.
Let us finally return to the situation when we try to apply g1 on w $ , with w ¼ aAfb for some a 2 fA; Cg Ã , f 2 fB; Dg and b 2 fB; Dg Ã T Ã , or f 2 T and b 2 T Ã , or w ¼ aA (i.e., f ¼ b ¼ k), being a sentential form derivable in G, corresponding to some string w $ derivable in C. If w ) g1 w 0 , then . If we now apply g2, this means that we have split a as a 0 Ca 00 and fb like b 0 Db 00 , with f and b satisfying the conditions stated above, so that for w 0 ) g2 w 00 , w 00 ¼ a 0 gg 0 Ca 00 Ab 0 Dg 3 b 00 . However, now the derivation is stuck, as w 00 contains no substring CD as required by matrix g3.
These arguments show that also the non-context-free rules are correctly simulated and hence completes the proof. h The reader might think that the markers f 6 ; f 7 ; f 8 and their relevant insertion and deletion rules are not necessary. One idea would be to construct matrices like f 7 0 ¼ ½ðk; f 0 ; kÞ del ; ðk; f 00 ; kÞ del Þ and f 8 0 ¼ ½ðk; f 3 ; kÞ del ; ðk; $; kÞ ins . The problem is that however, such ideas might not work as one can start to apply these matrices f 7 0 and f 8 0 soon after applying f3, leading to unintended situations. This would make a correctness proof more tedious if not impossible at all. With the introduction of the markers f 6 ; f 7 ; f 8 , the proof is simplified, to say the least.
Proposition 4 Fernau et al. (2018b) The following language relations are true.
Initially, our main objective was to find how much beyond LIN can a matrix ins-del system (of the four sizes stated in Proposition 4) lead us to. However, we then succeeded to provide a general result showing that if there exists a matrix ins-del systems of size ðk; n; i 0 ; i 00 ; m; j 0 j 00 Þ describing LIN, then the same system will describe L reg ðLINÞ.
Theorem 5 For all integers n; m ! 1, t ! 2 and i 0 ; i 00 ; j 0 ; j 00 ! 0 with t þ n ! 4 and i 0 þ i 00 ! 1, if every L 2 LIN can be generated by a MATðt; n; i 0 ; i 00 ; m; j 0 ; j 00 Þ system with a single axiom that is identical to the start symbol S of a linear grammar describing L, then L reg ðLINÞ MATðt; n; i 0 ; i 00 ; m; j 0 ; j 00 Þ, as well. 3 Proof Let L 2 L reg ðLINÞ for some L T Ã . By Proposition 1, we can assume that L is described by a context-free grammar G ¼ ðN; T; S; PÞ that basically consists of a rightlinear grammar G R ¼ ðN 0 ; N 00 ; S; P 0 Þ and linear grammars G i ¼ ðN i ; T; S i ; P i Þ for 1 i k. For technical reasons that should become clear soon, we rather consider i contains, besides all rules from P i , rules of the form hS i ; Ai ! w whenever S i ! w 2 P i for some w 2 ðN i [ TÞ Ã . This means, apart from LðG 0 i Þ ¼ LðG i Þ (as the new nonterminals will never be used in terminating derivations), that also LððN 0 i ; T; hS i ; Ai; P 0 i ÞÞ ¼ LðG i Þ for any A 2 N 0 .
Since LIN MATðt; n; i 0 ; i 00 ; m; j 0 ; j 00 Þ, each G 0 i can be simulated by a matrix ins-del system C i ¼ ðV i ; T; fS i g; R i Þ for 1 i k, each of size ðt; n; i 0 ; i 00 ; m; j 0 ; j 00 Þ. We assume, without loss of generality, that V i \ V j ¼ T if 1 i\j k. Let us first consider the case i 0 ! 1 and i 00 ¼ 0. We construct a matrix ins-del system C for G as follows 4 : R i ; and for t ! 3, R 0 is the set fm p j p 2 P 0 g, where: m p ¼ ½ðA 0 ; hS i ; Bi; kÞ ins ; ðhS i ; Bi; B 0 ; kÞ ins ;ðk; For t ¼ 2 and n ! 2, we add the following matrix m p instead of the above-defined matrix m p into R 0 : m p ¼ ½ðA 0 ; hS i ; BiB 0 ; kÞ ins ; ðk; A 0 ; kÞ del Þ for p ¼ A ! S i B 2 P 0 .
Notice that A 6 ¼ B, as we assume that G 0 is in normal form, which is important for both variants of m p . The case when i 0 ¼ 0 and i 00 ! 1 follows from Propositions 2 and 3. h Combining Theorem 5 with results from Fernau et al. (2018b), we have the following corollary. The strictness of the subset relation in the theorem below follows from Example 1.

Corollary 1
The following assertions are true.
Theorem 6 REG(MATð2; 1; 1; 0; 1; 1; 0Þ \ MATð2; 1; 0; 1; 1; 0; 1Þ. Proof Consider a type-3 grammar G ¼ ðN; T; P; SÞ in right-linear form, with the rules uniquely labelled with p : X ! bY and r : X ! k where X; Y 2 N and b 2 T. We can construct a matrix ins-del system C ¼ ðV; T; S; MÞ with alphabet V ¼ N [ T [ fp; p 0 ; p 00 ; p 000 g : The set of matrices shown in Fig. 8a, b constitutes M. Consider a sentential form w ¼ aX derivable in the grammar G, with a 2 T Ã . Assume we are about to apply a concrete rule X ! bY 2 P, with X; Y 2 N, yielding w 0 ¼ abY. Hence, the matrices listed in Fig. 8a should apply, one after the other, giving: This shows that LðGÞ LðCÞ. In the following, we are arguing why LðGÞ LðCÞ.
Consider a string w ¼ aX that is derivable from S in C. As no rule markers are present, only a matrix of type p1 or p2 can be applied.
Assume more concretely that matrix p1 or p2 belonging to p : X ! bY is applied. If p2 is applied first before applying p1, then this means that X is replaced by the marker p 00 and no further matrices are possible to apply as they require either the markers p or p 0 or X which are not present in the derived string. So, only p1 can be applied first and it can be applied any number of times, yielding w 1 ðnÞ ¼ aXðp 0 pÞ n ; n ! 1. On w 1 ðnÞ, matrices p3 and p4 are inapplicable due to the absence of p 00 . At first glance, it may appear that matrix p5 is applicable. However, if we closely look at the two rules in the matrix p5, the matrix is applicable if and only if bp is a substring of our sentential form. We use this observation (calling it ob1) repeatedly. Note that every p in w 1 ðnÞ is preceded by p 0 and hence bp is not a substring in w 1 ðnÞ. This prohibits the application of p5 on w 1 ðnÞ. Finally, the absence of p 000 renders p6 inapplicable. So, assuming that p1 is not applied again, the only matrix applicable on w 1 ðnÞ is p2. On applying p2, the marker p 00 is introduced in the place of X which yields w 2 ðnÞ ¼ ap 00 ðp 0 pÞ n . The matrices p1 and p2 are hereafter not applicable due to the absence of X. Matrices p4 and p6 require the presence of p 000 and are hence not applicable to w 2 ðnÞ. Observation ob1 prevents us from applying p5. The only matrix that is applicable to w 2 ðnÞ is p3 which introduces yet another new marker p 000 randomly and the second rule of p3 deletes the occurrence of p 0 rightmost of p 00 . Thus we obtain a string w 3 ðnÞ that can be described as . For convenience, we let s n ¼ ðp 0 pÞ nÀ1 . The absence of X in w 3 ðnÞ prevents applying matrices p1 and p2. We can now observe that the matrix p3 is applicable if and only p 00 p 0 is a substring (we call this observation ob2). Since w 3 ðnÞ contains neither bp nor p 00 p 0 as a substring, matrices p5 and p3 are inapplicable on w 3 ðnÞ due to ob1, ob2. Hence, the only matrices applicable on w 3 ðnÞ are either p4 or p6. As a last observation ob3, notice that matrices p4 and p6 are only applicable if p 000 is present.
Case 1: If we apply matrix p6 to w 3 ðnÞ, then the (randomly inserted) marker p 000 is deleted and we end up with w 0 3 ðnÞ ¼ ap 00 ps n . Due to the absence of any of X; p 00 p 0 ; p 000 ; bp, all rules become inapplicable due to ob1, ob2, ob3 and hence the derivation is stuck.
Case 2: If we apply matrix p4 to w 3 ðnÞ, then the marker p 00 is deleted with the (randomly inserted) marker p 000 on its left. This enforces the marker p 000 that was introduced randomly should have been placed on the left of p 00 . Hence, we now know that w 3 ðnÞ ¼ ap 000 p 00 ps n . So, the first rule of p4 guarantees the presence of p 000 p 00 as a substring and also deletes p 00 . The second rule of p4 then introduces a b (the intended b of the simulation rule X ! bY) to the right of p 000 , thus yielding w 4 ðnÞ ¼ ap 000 bps n . The matrix p4 actually simulates the rewriting rule p 00 ! b.
The absence of X and p 00 blocks the application of matrices p1 through p4. Now, either p5 or p6 is applicable. The order of application of the rules hereafter do not matter, as they are independent.
Case A: If we apply matrix p5 on w 4 ðnÞ, then we get w 5 ðnÞ ¼ ap 000 bYs n . The absence of X; p 00 ; bp enforces the application of matrix p6 which deletes the marker p 000 , thus yielding w 6 ðnÞ ¼ abYs n . It is to be noted that matrix p6 need not be even applied after applying p5 and one can start the derivation based on some Y-rule, but of course p6 can be applied at any time. In particular, sentential forms that contain various r 000 for different rules r are possible but do not invalidate our arguments, as all these triple-primed markers have to and can be deleted in a terminal derivation. Notice that if indeed several occurrences of p 000 are present upon applying matrix p4, there is clearly the danger of inserting b to the right of the wrong occurrence of p 000 by the second rule of p4. However, a successful application of p5 enforces the correct occurrence of p 000 to be chosen by p4, again by observation ob1.
Case B: If we first apply matrix p6 on w 4 ðnÞ, then we get w 0 5 ðnÞ ¼ abps n . The absence of X; p 00 ; p 000 enforces the deterministic application of matrix p5 which yields w 6 ðnÞ ¼ abYs n . Notice that should we ''forget'' to apply matrix p6, i.e., should p 000 stay in the string, then we cannot make mischievous use of that left-over occurrence of p 000 by applying the second rule of p4 to it, because then there would not be any b left to Y as required by matrix p5.
After applying both matrices, we get w 6 ðnÞ ¼ abYs n . Since no markers p 0 ; p in s n can be deleted hereafter, this enforces that the matrix p1 was applied exactly once, i.e., n ¼ 1, and hence s n ¼ k.
The singleton rule shown in Fig. 8b clearly simulate the rule r : X ! k. The above arguments show the first inclusion REG MATð2; 1; 1; 0; 1; 1; 0Þ. The second inclusion result follows by Proposition 2. The strictness of the inclusions follow by Example 1. These considerations complete the proof. h

Conclusions and further research directions
In this paper, using matrix ins-del systems, we have obtained some (improved) computational completeness results and described the regular closure of linear languages with small resource needs. It is interesting to note that if one could describe linear languages by a matrix insertion-deletion system of size s, then with the same size s, we could describe the regular closure of linear languages, as well. We have also given a complete picture of the state of the art of the generative power of the matrix ins-del systems with sum-norm 3 or 4 in Table 1. Finally, we believe that the normal form tsSGNF that we introduced offers some features that could be used in other computational completeness proofs. In particular, no substrings with nonterminals to the right of terminals are derivable in this normal form.
Further to some open problems mentioned in the introduction, We now present some further concrete research questions.
-It would be interesting to explore closure properties for matrix ins-del systems of small sizes. For instance, is the family MATð2; 2; 1; 0; 1; 0; 0Þ closed under reversal? If this were true, then MATð2; 2; 1; 0; 1; 0; 0Þ ¼ MATð2; 2; 0; 1; 1; 0; 0Þ, which would also mean that the statement of Corollary 1 could be simplified. -Do matrix ins-del systems of small sum-norm allow for efficient parsing? We are not aware of any research in this direction. Also this area seems to be largely neglected, although it is clear that this is of much importance if it comes to finally applying these generative devices in language processing. -It has been argued in other places that ins-del systems could form the basis of biocomputing devices. Insertion and deletions would form the basic operations for such machines. Then the question arises how to program such devices. Following the paradigm of imperative programming, the most basic way of building programs would be to design program fragments consisting of basic operations that should be performed one after the other. This is exactly what matrix grammars can do. One future challenge would be to devise implementations that are based on these basic commands and their sequential execution. -In a recent paper (Vu and Fernau 2021), Vu and Fernau studied matrix grammars with insertions, deletions and substitutions, a third operation whose relevance to biocomputing is explained in Beaver (1995) and Kari (1997), allowing for further restrictions on the resources studied in this paper. In this context, questions similar to the previous item arise.