Notes
Credibility
This article references information generated by AI. It is a memo for research and learning. Please verify accuracy and factuality yourself. In particular, I cannot judge whether terms actually exist or are used in Japanese, so I use the LLM-generated terms as-is.
Introduction
I touched MSO Transducers briefly as an undergraduate, but never gained intuition for them. Now that LLMs lower the learning barrier, I thought I might understand them better, so I'm revisiting the topic and taking notes within what I can understand.
First-Order Logic (FOL)
In first-order logic, we treat elements of a set as variables and can quantify over them. Here, variables and quantifiers mean:
- First-order variables: written as lowercase letters like , representing individual elements of a set
- Quantifiers: universal/existential quantifiers using and meaning "for all" and "there exists"
For example, the following predicate says: "for every , there exists a such that $y = x + 1".
So far, this is straightforward.
Monadic Second-Order Logic (MSO)
In second-order logic (SOL), we can quantify over relations or functions of elements. In MSO, we restrict quantification to unary relations (monadic relations), i.e., sets. We can also use structure-specific predicates called atomic formulas.
For example, a graph being 2-colorable can be expressed by:
Here (red) and (blue) are sets of vertices, and is the edge set.
It suddenly looks complex, so let's break it down:
- :
- There exist vertex sets and
- :
- For every vertex , it is in or
- :
- For all vertices , if is an edge, then ...
- :
- : both and are in
- : both and are in
With this breakdown it's understandable. Indeed, graphs satisfying this predicate are 2-colorable.
So the set of all 2-colorable graphs is definable in MSO.
I remember learning how to describe graphs with predicates in graph theory lectures, but I had forgotten. Even when researching MSO, I didn't connect it with graph theory. In class, it was presented as "graphs can be expressed with predicates," but I didn't think about the logical class involved.
Büchi–Elgot–Trakhtenbrot theorem
The Büchi–Elgot–Trakhtenbrot theorem shows that MSO over strings and regular languages have equivalent expressive power. It was proved in a paper from 1960, so it has been known for a long time.
It was an important result bridging logic and automata theory. I haven't studied automata theory comprehensively, so I didn't know it. Maybe I should read Elements of Automata Theory after all.
As an undergraduate, I read [1706.01668] One-way definability of two-way word transducers where MSO Transducers appear, but I didn't even know that regular languages are MSO-definable. So if I reread it now, I might understand more.
Courcelle's Theorem
Courcelle's Theorem states that for graphs of bounded treewidth, any property definable in MSO can be decided in linear time.
This seems related to tree automata. According to Gemini Deep Research, as with strings, the class of trees definable by regular tree languages and MSO coincide. I want to verify that later.
It's amazing that you can wait 20 minutes and have the web automatically researched for you. I wish I had that as a student.
I will leave the HTML version of the DeepResarch results here (accuracy unknown).
The rapid explosion in complexity from or reminds me of my undergraduate thesis results.
MSO Transducers
Example: String transformation
Consider transforming a string over alphabet by replacing with , with , and with . This can be expressed by:
Here , , are predicates true at position in the input string when the character is , , . , , are similar predicates for position in the output string. and indicate the same position in input and output.
This is a fairly casual definition, but it is enough to capture what MSO can do. I'll try a more rigorous definition later.
Example: Complement graph generation
Consider transforming a graph into its complement . The complement graph has the same vertex set and edges between vertices that are not connected in the original graph.
For MSO transformation, input and output are:
- Input: graph
- Output: complement graph
Transformation rules
- Define output vertex set:
- The output vertex set is identical to the input vertex set.
- Define output edge set:
- "There is an edge between in the output graph iff and there is no edge between them in the input graph."
These definitions are in MSO, so complement graph generation is an MSO transformation.
A more formal definition
The earlier examples were too informal, so let's define MSO transformations more formally.
Formal definition of string structures
A -string structure is defined as a tuple where:
- : Domain, a finite set of positions.
- : a total order on .
- : a set of labels. For each , is a subset of representing positions where character occurs.
- means "the character at position is $a".
Formal definition of MSO transformations
An MSO transformation is defined as a relation from input structure to output structure . The relation is specified by a single MSO formula .
The formula is written over the input structure and output structure .
A pair belongs to iff it satisfies :
Example
Let's revisit the transformation that maps , , , now with a formal definition.
First define input and output structures:
- Input:
- Output:
Next define a formula expressing that the input and output structures are isomorphic when labels are ignored:
This says the domains are equal (same string length) and the order of positions is the same.
Define the relabeling rules:
This refers to the labels at the same position.
Finally, the overall transformation formula is:
Thus the transformation is expressible in MSO logic.
Execution example
Let's check the behavior for input .
- Input structure
- , ,
- Output structure
- Output labels from relabeling rules:
- : so
- : so
- : so
Interpreting as a string yields .
Personally, it feels a bit strange that you can define a transformation this way, but it reminds me of writing programs in Prolog.
MSO has variants
It seems MSO has multiple variants. By adding predicates to the logic, the class of definable transformations changes.
For graphs: can use adjacency , can use incidence , can use to check cardinality modulo and , and there are extensions like / that add predicates for minimal/maximal size of sets satisfying an MSO property.
Conclusion
I reviewed MSO Transducers with examples. When thinking about structures or transformations, I naturally imagine constructive definitions, so defining a structure and then expressing transformations via logic over that structure still doesn't feel natural. This is probably part of proofs, but I feel it's hard to define a transformation purely in logical form unless you have practiced converting constructive definitions into logical ones. Properties like 2-colorability or complement graphs are clear enough that logical definitions come naturally, but arbitrary transformations are harder.
Next, I want to look into proofs of the theorems mentioned here and related theory.