Existential monadic second-order logic (EMSO) is the fragment of MSO in which all quantifiers over sets must be
existential quantifiers, outside of any other part of the formula. The first-order quantifiers are not restricted. That is, one can speak of "there exists some
x, such that..." and "for all
x, we have..." where
x is a term, but one can only speak of "there exists some monadic predicate
P, such that..." not "for all monadic predicate
P, we have...".
Fagin's theorem states that existential second-order logic (ESO) captures precisely the
descriptive complexity of the complexity class
NP. By analogy, the class of problems that may be expressed in existential monadic second-order logic has been called
monadic NP. In other words, EMSO captures precisely the descriptive complexity of monadic NP (MNP). In the
logic of graphs, testing whether a graph is
disconnected is in MNP, as the test can be represented by a formula that describes the existence of a proper subset of vertices with no edges connecting them to the rest of the graph. The complementary problem, testing whether a graph is connected, does not belong to monadic NP. That is, it is a problem in
co-MNP \ MNP. By symmetry, graph disconnection testing is in MNP \ co-MNP, showing that neither complexity class contains the other. The addition of "monadic" makes the question easier. The analogous question, of whether NP =
co-NP, is an open question in computational complexity. By contrast, when we wish to check whether a Boolean MSO formula is satisfied by an input finite
tree, this problem can be solved in linear time in the tree, by translating the Boolean MSO formula to a
tree automaton and evaluating the automaton on the tree. In terms of the query, however, the complexity of this process is generally
nonelementary. ensuring that the input data is preprocessed in linear time and that each solution is then produced in a delay linear in the size of each solution, i.e., constant-delay in the common case where all free variables of the query are first-order variables (i.e., they do not represent sets). There are also efficient algorithms for counting the number of solutions of the MSO formula in that case. == Decidability and complexity of satisfiability ==