Algorithmic meta-theorems are general algorithmic results applicable to a whole range of problems. Many prominent algorithmic meta-theorems are about model checking; such theorems state that for certain kinds of logic , and all classes that have a certain property, there is an algorithm that takes as input a formula and a structure and efficiently determines whether . Results in this direction include the seminal theorem of Courcelle [7, 8, 9] for model checking Monadic Second Order Logic (MSO) on graphs of bounded treewidth (see also [1, 2, 4, 10, 14]), as well as a large body of work on model checking first-order (FO) logic [5, 12, 16, 18, 22, 24, 23, 26, 32].
Another kind of algorithmic meta-theorems reduce the task of designing one type of algorithm for a problem, to one of designing a different kind of algorithm for the same problem. The hope is, of course, that the second type of algorithms are significantly easier to design than the first. A prototype example of such results is Bidimensionality , which reduces the design of sub-exponential time parameterized algorithms for a problem on planar (or -minor free) graphs, to the design of single exponential time algorithms for the same problem when parameterized by the treewidth of the input graph.
In this paper we prove a result of the second type for model checking Counting Monadic Second Order Logic (CMSO), an extension of MSO with atomic sentences for determining the cardinality of vertex and edge sets modulo any (fixed) integer. For every CMSO sentence define the CMSO problem as follows. The input is a graph on vertices, and the task is to determine whether .
Our main result states that for every CMSO sentence , if there is a time algorithm () for CMSO for the special case when the input graph is required to be “highly connected everywhere”, then there is a time algorithm for CMSO without any restrictions. In other words, our main theorem reduces CMSO model checking to model checking the same formula on graphs which are “highly connected everywhere”.
In order to complete the description of our main result we need to define what we mean by “highly connected everywhere”. For two integers and , we say that a graph is -unbreakable if there does not exist a partition of the vertex set into three sets , , and such that
is a separator: there are no edges from to ,
is small: , and
and are large: .
For example, the set of -unbreakable graphs contains precisely the -connected graphs, i.e. the connected graphs for which removing any set of at most vertices leaves the graph connected. We can now state our main result:
Let be a CMSO sentence. For all , there exists such that if there exists an algorithm that solves CMSO on -unbreakable graphs in time for some , then there exists an algorithm that solves CMSO on general graphs in time .
For Theorem 1 to be useful, there must exist problems that can be formulated in CMSO, for which it is easier to design algorithms for the special case when the input graphs are unbreakable, than it is to design algorithms that work on general graphs. Such problems can be found in abundance in parameterized complexity. Indeed, the recursive understanding technique, which has been used to solve several problems [6, 25, 27, 28, 31, 30] in parameterized complexity, is based precisely on the observation that for many graph problems it is much easier to design algorithms if the input graph can be assumed to be unbreakable.
Designing algorithms using the recursive understanding technique typically involves a technical and involved argument akin to doing dynamic programming on graphs of bounded treewidth (see Chitnis et al.  for an exposition). These arguments reduce the original problem on general graphs to a generalized version of the problem on -unbreakable graphs, for appropriate values of and . Then an algorithm is designed for this generalized problem on -unbreakable graphs, yielding an algorithm for the original problem.
For all applications of the recursive understanding technique known to the authors [6, 25, 27, 28, 31, 30], the problem in question (in which recursive understanding has been applied) can be formulated as a CMSO model checking problem, and therefore, the rather cumbersome application of recursive understanding can be completely replaced by a black box invocation of Theorem 1. Using Theorem 1 in place of recursive understanding has the additional advantage that it reduces problems on general graphs to the same problem on unbreakable graphs, facilitating also the last step of designing an algorithm on unbreakable graphs.
As an example of the power of Theorem 1 we use it to give a fixed parameter tractable (FPT) algorithm for the Vertex Multiway Cut Uncut problem. Here, we are given a graph together with a set of terminals , an equivalence relation on the set , and an integer , and the objective is to test whether there exists a set of at most vertices such that for any , the vertices and belong to the same connected component of if and only if . Since finding the desired set satisfying the above property can be formulated in CMSO, we are able to completely sidestep the necessity to define a technically involved annotated version of our problem, and furthermore, we need only focus on the base case where the graph is unbreakable. To solve the base case, a simple procedure that is based on the enumeration of connected sets with small neighborhood is sufficient. For classification purposes, our approach is significantly simpler than the problem-specific algorithm in . Finally, we show how Theorem 1 can be effortlessly deployed to show fixed parameterized tractability of a wide range of problems, where the input is a graph and the task is to find a connected induced subgraph of of bounded treewidth such that “few” vertices outside this subgraph have neighbors inside the subgraph, and additionally the subgraph has a CMSO-definable property.
Our techniques. The proof of Theorem 1 is based heavily on the idea of graph replacement, which dates back to the work of Fellows and Langston . We combine this idea with Courcelle’s theorem [7, 8, 9], which states that every CMSO-definable property has finite state on a bounded-size separation/boundary. In other words, for any CMSO-definable property and fixed , there is an equivalence relation defined on the set of all -boundaried graphs (graphs with a set of at most distinguished vertices) with a finite number, say (where depends only on and ) of equivalence classes such that if we replace any -boundaried subgraph of the given graph with another -boundaried graph, say , from the same equivalence class to obtain a graph , then has the property if and only if has the property . In our case, . Let denote a set containing one “ minimal” -boundaried graph from each equivalence class (for the fixed CMSO-definable property ). Let denote the size of the largest among these minimal representatives.
The main technical content of our paper is in the description of an algorithm for a generalization of our question. To be precise, we will describe how one can, given a -boundaried graph , locate the precise equivalence class in which is contained and how one could compute the corresponding smallest representative from the set . We refer to this task as “understanding” .
In order to achieve our objective, we first give an algorithm that allows one to understand -boundaried -unbreakable graphs (for a choice of which is sufficiently large compared to and ). This algorithm is built upon the following observation. The equivalence class of any -boundaried graph is determined exactly by the subset of on which evaluates to true. Here, the graph is the graph obtained by taking the disjoint union of the graphs and and then identifying the vertices of the boundaries of these graphs with the same label. Since is chosen to be sufficiently large compared to and , it follows that for every , the graph is -unbreakable and we can use the assumed algorithm for CMSO on -unbreakable graphs to design an algorithm that understands -boundaried -unbreakable graphs. This constitutes the ‘base case’ of our main algorithm.
In order to understand a general (-breakable) -boundaried graph, we use known algorithms from  to compute a partition of the vertex set of into and such that is a separator, and . Let and let . Without loss of generality, we may assume that at most half the vertices in the boundary of lie in . Consequently, the graph is a -boundaried graphs where the boundary vertices are the vertices in along with the boundary vertices of contained in . We then recursively understand the strictly smaller -boundaried graph to find its representative . Since the evaluation of on is the same as the evaluation of on (where the gluing happens along ), we only need to understand the -boundaried graph (where the boundary is carefully defined from that of and ) and we do this by recursively executing the “understand” algorithm on this graph.
At this point we also need to remark on two drawbacks of Theorem 1. The first is that Theorem 1 is non-constructive. Given an algorithm for CMSO on -unbreakable graphs, Theorem 1 allows us to infer the existence of an algorithm for CMSO on general graphs, but it does not provide us with the actual algorithm. This is due to the subroutine requiring a representative -boundaried subgraph for each equivalence class, to be part of its ‘source code’. Thus, the parameterized algorithms obtained using Theorem 1 are non-uniform (see Section 4), as opposed to the algorithms obtained by recursive understanding.
The second drawback is that Theorem 1 incurs a gargantuan constant factor overhead in the running time, where this factor depends on the formula and the cut size . We leave removing these two drawbacks as intriguing open problems.
In this section, we introduce basic terminology related to graphs, structures, CMSO, boundaried structures and parameterized complexity. In order to present a rigorous proof of our lemmas in a way that is consistent with existing notation used in related work, we follow the notation from the paper . We use as a shorthand for . Given a function and a subset , we denote .
Throughout this paper, we use the term “graph” to refer to a multigraph rather than only a simple graph. Given a graph , we let and denote the vertex and edge sets of , respectively. When is clear from the context, we denote and . Given two subsets of , and , we let denote the set of edges of with one endpoint in and the other endpoint in . Given , we let denote the subgraph of induced by , and we let and denote the open and closed neighborhoods of , respectively. Moreover, we denote . Given , we denote and . Given , we denote . Moreover, we let denote the set of every vertex in that is incident to at least one edge in , and we define . A graph is a cluster graph if there exists a partition of for some of such that for all , is a clique, and for all , .
Treewidth. Treewidth is a structural parameter that indicates how much a given graph resembles a tree. For example, a tree has treewidth 1 and an -vertex clique has treewidth . Formally, the treewidth of a graph is defined as follows.
A tree decomposition of a graph is a pair of a tree and , such that
for any edge , there exists a node such that both endpoints of belong to , and
for any vertex , the subgraph of induced by the set is a tree.
The width of is . The treewidth of is the minimum width of a tree decomposition of .
Unbreakability. To formally introduce the notion of unbreakability, we rely on the definition of a separation:
[Separation] A pair where is a separation if . The order of is .
Roughly speaking, a graph is breakable if it is possible to “break” it into two large parts by removing only a small number of vertices. Formally,
[-Unbreakable graph] Let be a graph. If there exists a separation of order at most such that and , called an -witnessing separation, then is -breakable. Otherwise, is -unbreakable.
The following lemma implies that it is possible to determine (approximately) whether a graph is unbreakable or not, and lemmata similar to it can be found in . We give a proof for the sake of completeness and in order to avoid interrupting the flow of the reader and to ensure that we keep the presentation focussed on the main result, the proof has been moved to the Appendix (Section 5.1).
There exists an algorithm, Break-ALG, that given and a graph , in time either returns an -witnessing separation or correctly concludes that is -unbreakable.
Boundaried Graphs. Roughly speaking, a boundaried graph is a graph where some vertices are labeled. Formally,
[Boundaried graph] A boundaried graph is a graph with a set of distinguished vertices called boundary vertices, and an injective labeling . The set is the boundary of , and the label set of is .
We remark that we also extend the definition of -(un)breakability from graphs, to boundaried graphs in the natural way. That is, we ignore the boundary vertices when considering the existence of an -witnessing separation. For ease of presentation, we sometimes abuse notation and treat equally-labeled vertices of different boundaried graphs, as well as the vertex that is the result of the identification of two such vertices, as the same vertex. Given a finite set , denotes the class of all boundaried graphs whose label set is , and . A boundaried graph in is called a -boundaried graph. Finally, denotes the class of all boundaried graphs. The main operation employed to unite two boundaried graphs is the one that glues their boundary vertices together. Formally,
[Gluing by ] Let and be two boundaried graphs. Then, is the (not-boundaried) graph obtained from the disjoint union of and by identifying equally-labeled vertices in and .111Each edge in (or ) whose endpoints are boundaried vertices in (or ) is preserved as a unique edge in .
We first define the notion of a structure in the context of our paper.
[Structure] A structure is a tuple whose first element is a graph, denoted by , and each of the remaining elements is a subset of , a subset of , a vertex in or an edge in . The number of elements in the tuple is the arity of the structure.
Given a structure of arity and an integer , we let denote the ’th element of . Note that . By appending a subset of (or ) to a structure of arity , we produce a new structure, denoted by , of arity with the first elements of being the elements of and For example, consider the structure of arity , where and Let be some subset of . Then, appending to results in the structure
Next, we define the notions of a type of a structure and a property of structures.
[Type] Let be a structure of arity . The type of is a tuple of arity , denoted by , where the first element, , is graph, and for every , is vertex if , edge if , vertex set if , and edge set otherwise.222Note that we distinguish between a set containing a single vertex (or edge) and a single vertex (or edge).
[Property] A property is a function from the set of all structures to
Finally, we extend the notion of unbreakability to structures.
[-Unbreakable structure] Let be a structure. If is an -unbreakable graph, then we say that is an -unbreakable structure, and otherwise we say that is an -breakable structure.
2.3 Counting Monadic Second Order Logic
The syntax of Monadic Second Order Logic (MSO) of graphs includes the logical connectives variables for vertices, edges, sets of vertices and sets of edges, the quantifiers and , which can be applied to these variables, and five binary relations:
, where is a vertex variable and is a vertex set variable;
, where is an edge variable and is an edge set variable;
where is an edge variable, is a vertex variable, and the interpretation is that the edge is incident to ;
where and are vertex variables, and the interpretation is that and are adjacent;
equality of variables representing vertices, edges, vertex sets and edge sets.
Counting Monadic Second Order Logic (CMSO) extends MSO by including atomic sentences testing whether the cardinality of a set is equal to modulo where and are integers such that and . That is, CMSO is MSO with the following atomic sentence: if and only if , where is a set. We refer to [2, 7, 9] for a detailed introduction to CMSO.
Evaluation. To evaluate a CMSO-formula on a structure , we instantiate the free variables of by the elements of In order to determine which of the free variables of are instantiated by which of the elements of , we introduce the following conventions. First, each free variable of a CMSO-formula is associated with a rank, . Thus, a CMSO-formula can be viewed as a string accompanied by a tuple of integers, where the tuple consists of one integer for each free variable of .
Given a structure and a CMSO-formula , we say that type matches if (i) the arity of is at least , where the maximum is taken over each free variable of , and (ii) for each free variable of , is compatible with the type of For example, if is a vertex set variable, then Finally, we say that matches if matches . Given a free variable of a CMSO sentence and a structure that matches , the element corresponding to in is .
[Property ] Given a CMSO-formula , the property is defined as follows. Given a structure , if does not match , then equals false, and otherwise equals the result of the evaluation of where each free variable of is instantiated by
Note that some elements of might not correspond to any variable of . However, may still be evaluated on the structure —in this case, the evaluation of does not depend on all the elements of the structure. If the arity of is 1, then we use as a shorthand for .
[CMSO-definable property] A property is CMSO-definable if there exists a CMSO-formula such that . In this case, we say that defines .
2.4 Boundaried Structures
The notion of a boundaried structure is an extension of the notion of a boundaried graph and is defined as follows.
[Boundaried structure] A boundaried structure is a tuple whose first element is a boundaried graph , denoted by , and each of the remaining elements is a subset of a subset of a vertex in an edge in or the symbol The number of elements in the tuple is the arity of the boundaried structure.
Given a boundaried structure of arity and an integer , we let denote the ’th element of . We remark that we extend the definition of -(un)breakability of structures, to boundaried structures. Next, other terms presented in previous subsections are adapted to fit boundaried structures.
[Type] Let be a boundaried structure of arity . The type of is a tuple of arity , denoted by , where the first element, , is boundaried graph, and for every , is vertex if , edge if , vertex set if , edge set if and otherwise.
Now, given a boundaried structure and a CMSO-formula we say that matches if (i) the arity of is at least , where the maximum is taken over each free variable of , and (ii) for each free variable of , is compatible with the type of Moreover, we say that matches if matches .
Given , denotes the class of all boundaried structures of arity , and given a finite set , () denotes the class of all boundaried structures of arity whose boundaried graph belongs to (resp. ). A boundaried structure in is called a -boundaried structure. Finally, we let denote the class of all boundaried structures.
[Compatiblity] Two boundaried structures and are compatible (notationally, ) if the following conditions are satisfied.
and have the same arity
For every :
vertex,edge and , or
vertex,edge and .
For every such that both and are vertices: and
For every such that both and are edges: and , where and . That is, and are the endpoints of the edge .
[Gluing by ] Given two compatible boundaried structures and of arity , the operation is defined as follows.
is a structure of arity .
For every :
if and are sets, ;
if and are vertices/edges, ;
if , ;
2.5 Finite State
This subsection states a variant of the classical Courcelle’s Theorem [7, 8, 9] (see also ), which is a central component in the proof of our main result. To this end, we first define the compatibility equivalence relation on boundaried structures as follows. We say that if and for every boundaried structure
Now, we define the canonical equivalence relation on boundaried structures.
[Canonical equivalence] Given a property of structures, the canonical equivalence relation on boundaried structures is defined as follows. For two boundaried structures and , we say that if (i) , and (ii) for all boundaried structures compatible with (and thus also with ), we have
It is easy to verify that is indeed an equivalence relation. Given a property of structures, and , we let denote the set of equivalence classes of when restricted to .
[Finite state] A property of structures is finite state if, for every and , is finite.
Given a CMSO sentence the canonical equivalence relation associated with is , and for the sake of simplicity, we denote this relation by .
Lemma 2.2 ().
Every CMSO-definable property on structures has finite state.
2.6 Parameterized Complexity
An instance of a parameterized problem is a pair of the form where is a non-negative integer called the parameter. Thus, a parameterized problem is a subset of , for some finite alphabet .
Two central notions in parameterized complexity are those of uniform fixed-parameter tractability and non-uniform fixed-parameter tractability. In this paper, we are interested in the second notion, which is defined as follows.
[Non-uniform fixed-parameter tractability (FPT)] Let be a parameterized problem. We say that is non-uniformly fixed-parameter tractable (FPT) if there exists a fixed such that for every fixed , there exists an algorithm A that for every , determines whether in time .
3 CMSO Model Checking
Given a CMSO formula , the CMSO problem is defined as follows. The input of CMSO is a structure that matches , and the objective is to output . In this section, we prove the following result, which then implies Theorem 1.
Let be a CMSO formula. For all , there exists such that if there exists an algorithm that solves CMSO on -unbreakable structures in time for some , then there exists an algorithm that solves CMSO on general structures in time .
In the context of parameterized complexity, min-CMSO (min-Edge-CMSO) is defined as follows. The input of min-CMSO is a structure , where for all (resp. ), matches , and a parameter . The objective is to determine whether there exists (resp. ) of size at most such that is true. Similarly, we define max-CMSO (resp. max-Edge-CMSO), where the size of should be at least , and eq-CMSO (resp. eq-Edge-CMSO), where the size of should be exactly . Then, as a consequence of Theorem 2, we derive the following result.
Let xmin,max,eq,min-Edge,max-Edge,eq-Edge, and let be a CMSO sentence. For all , there exists such that if x-CMSO parameterized by is FPT on -unbreakable structures, then x-CMSO parameterized by is FPT on general structures.
Denote and . First, notice that for every fixed , there exists a CMSO sentence such that x-CMSO is essentially equivalent to CMSO. Indeed, if xmin,max,eq, we can define as follows:
if x=min, then set ;
if x=max, then set ;
if x=eq, then set .
Here, we have that
is the CMSO sentence ,
is the CMSO sentence , where is the CMSO sentence , and
is the CMSO sentence .
In case xmin-Edge,max-Edge,eq-Edge, we replace each occurrence of by an occurrence of .
Let . Accordingly, define as follows. For all , let be the constant in Theorem 2 where and . Suppose that x-CMSO parameterized by is FPT on -unbreakable structures. Then, there exists a fixed such that for every fixed , there exists an algorithm A that solves x-CMSO on -unbreakable structures in time . Thus, we can employ A to solve CMSO on -unbreakable structures in time . By Theorem 2, we obtain that for every fixed , there exists an algorithm that solves CMSO on general structures in time , which implies that for every fixed , there exists an algorithm that solves x-CMSO on general structures in time . We thus conclude that x-CMSO parameterized by is FPT on general structures. ∎
From now on, to prove Theorem 2, we assume a fixed CMSO formula and a fixed . Moreover, we fix as the number of free variables of , and . We also let be fixed, where its exact value (that depends only on and ) is determined later. Finally, we assume that there exists an algorithm, Solve-Unbr-ALG, that solves CMSO on -unbreakable structures in time for some .
3.1 Understanding the Cmso Problem
To solve CMSO, we consider a generalization of CMSO, called Understand. The definition of this generalization is based on an examination of . Given a boundaried structure , we let denote the equivalence class in that contains . For every equivalence class , let denote some boundaried structure in such that there is no boundaried structure where the length of the string encoding is smaller than the length of the string encoding . Accordingly, denote . These will be the representatives of the equivalence classes induced by . By Lemma 2.2, there is a fixed (that depends only on and ) such that both and the length of encoding of any boundaried structure in are upper bounded by as well as . Note that the encoding explicitly lists all vertices and edges. By initially choosing appropriately, we ensure that .
The Understand problem is defined as follows. The input is a boundaried structure that matches , and the objective is to output a boundaried structure such that .
We proceed by showing that to prove Theorem 2, it is sufficient to prove that there exists an algorithm that solves Understand on general boundaried structures in time .
If there exists an algorithm that solves Understand on general boundaried structures in time , then there exists an algorithm that solves CMSO on general structures in time .
Let denote the graph satisfying . Suppose that there exists an algorithm, Understand-ALG, that solves Understand on general structures in time . Then, given an input for CMSO, which is a structure , our algorithm works as follows. It lets be the boundaried structure that is identical to except that the (not-boundaried) graph is replaced by the boundaried graph defined by and . Then, it calls Understand-ALG with as input to obtain a boundaried structure . Next, it lets be the boundaried structure of arity where , and for all , if is vertex or edge then , and otherwise . Moreover, it lets be the (not-boundaried) structure . Recall that where is an upper bound on the length of any boundaried structure in , and therefore is an -unbreakable structure. Thus, our algorithm can finally call Solve-Unbr-ALG (whose existence we have already assumed) with as input, and outputs the answer that this call returns.
Clearly, the algorithm runs in time . Let us now prove that it solves CMSO correctly. By the correctness of Understand-ALG, it holds that . In particular, this equality implies that . Notice that . Hence, . By the correctness of Solve-Unbr-ALG, we thus conclude that our algorithm is correct. ∎
In light of Lemma 3.1, the rest of this section focuses on the proof of the following result.
There exists an algorithm that solves Understand on general boundaried structures in time .
3.2 Understand on Unbreakable Structures
Recall that . In this subsection, we show that Algorithm Solve-Unbr-ALG can be used as a subroutine in order to efficiently solve Understand on -unbreakable boundaried structures. For this, we follow the method of test sets (see for example, [Section 12.5, ]). The high level idea here is as follows. We first enumerate the relevant subset of the finite set of minimal representatives. In other words, we simply list those minimal representatives which can be glued in a meaningful way to the structure under consideration, call it . We now observe that gluing each of these representatives to results in an -unbreakable structure, which is what we need to call Solve-Unbr-ALG. In this way we solve the instance obtained by gluing to each minimal representative.
Now, for every (not necessarily distinct) pair of minimal representatives, we glue them together and do the same. This way, we can identify the specific minimal representative whose behaviour when glued with every minimal representative, precisely resembles that of the structure when we do the same with . Consequently, we obtain a solution for Understand. We now formalize this intuition in the following lemma.
There exists an algorithm Understand-Unbr-ALG, that solves Understand, where it is guaranteed that inputs are -unbreakable boundaried structures, in time .333Here, Understand-Unbr-ALG is not requested to verify whether the input is indeed an -unbreakable boundaried structure.
We design the algorithm Understand-Unbr-ALG as follows. Let be an input, which is an -unbreakable boundaried structure. Moreover, let , and let denote the set of boundaried structures in that are compatible with . In the first phase, the algorithm performs the following computation. Notice that for every , since , it holds that is an -unbreakable structure. Thus, for every , Understand-Unbr-ALG can call Solve-Unbr-ALG with as input, and it lets ans denote the result.
In the second phase, the algorithm performs the following computation. Notice that for every and , since , it holds that is a -unbreakable structure. Thus, since , for all and , Understand-Unbr-ALG can call Solve-Unbr-ALG with as input, and it lets ans denote the result.
Finally, in the third phase, for every , the algorithm performs the following computation. It checks whether for every it holds that ans, and if the answer is positive, then it outputs . Since , there exists such that , and therefore, at the latest, when , the algorithm terminates. Thus, the algorithm is well defined, and it is clear that it runs in time .
To conclude that the algorithm is correct, it remains to show that for all , there exists such that ans, as this would imply that the algorithm necessarily outputs . For this purpose, suppose by way of contradiction that there exists such that for all it holds that ans. We now argue that which leads to a contradiction since each boundaried structure in belongs to a different equivalence class.
For all , since it holds that ans, it also holds that ans. This implies that . Consider some boundaried structure (not necessarily in ) that is compatible with (and thus also with ). We claim that . Indeed, let be the (unique) boundaried structure in such that . Then, and . Note that since is compatible with , it is also compatible with , and hence . Therefore, . Overall, we obtain that indeed .
Note that , and thus, since we have shown that for every boundaried structure compatible with it holds that , we derive that . However, each boundaried structure in belongs to a different equivalence class, and thus we have reached the desired contradiction. ∎
3.3 Understand on General Structures
The Algorithm Understand-ALG. We start by describing an algorithm called Understand-ALG, which is based on recursion. Given an input to Understand on general boundaried structures, which is a boundaried structure , the algorithm works as follows. First, it calls Break-ALG (given by Lemma 2.1) with as input to either obtain an -witnessing separation or correctly conclude that is -unbreakable. In the second case or if , it calls Understand-Unbr-ALG (given by Lemma 3.3), and returns its output. Next, suppose that Understand-ALG obtained an -witnessing separation and that . Without loss of generality, assume that . Denote .
Now, we define a boundaried structure, , which can serve as an instance of Understand. First, we let the graph be , and we define . Now, for all , we define . Since , and , we have that . Thus, to each , we can let assign some unique integer from . Hence, . Now, for all , we set as follows.
If vertex,edge: If , then , and otherwise .
Understand-ALG proceeds by calling itself recursively with as input, and it lets be the output of this call.
Now, we define another boundaried structure, , which can serve as an instance of Understand. First, we define the boundaried graph as follows. Let be the disjoint union of and , where both and are treated as not-boundaried graphs. For all , identify (in ) the vertex of with the vertex of