Weak Monadic Logic of One Successor

Closely related to “weak monadic second-order logic over strings” (there are some very minor differences).

Explanation of the name:

  • second-order logic: we can quantify not only over elements but also over sets and relations
  • monadic: we cannot quantify over relations of arity two or more, just over unary relations (sets)
  • weak: the sets we quantify over are finite
  • of one successor: the domain is an infinite chain, where each element has one successor (we only have successor and equality)

Syntax and Semantics

Minimalistic syntax:

  F ::= v \subseteq v \mid succ(v,v) \mid F \lor F \mid \lnot F \mid \exists v.F

Let $\mathbb{N} = \{0,1,2,\ldots\}$ denote non-negative integers. Let $D$ be the set of all finite subsets of $\mathbb{N}$. We consider the set of interpretations $(D,\alpha)$ where for each variable $v$ we have $\alpha(v) \in D$, where $\subseteq$ is the subset relation

   \alpha({\subseteq}) = \{ (S_1,S_2) \mid S_1 \subseteq S_2 \}

and the relation $succ(v_1,v_2)$ is the successor relation on integers lifted to singleton sets:

   \alpha(succ) = \{ (\{k\},\{k+1\}) \mid k \in \mathbb{N} \}

The meaning of formulas is given by standard First-order logic semantics.

Note in particular that quantification is restricted to finite sets (elements of $D$).

Expressive Power

Set operations

The ideas is that quantification over sets with $\subseteq$ gives us the full Boolean algebra of sets.

  • Two sets are equal: $(S_1 = S_2) = (S_1 \subseteq S_2) \land (S_2 \subseteq S_1)$
  • Strict subset: $(S_1 \subset S_2) = (S_1 \subseteq S_2) \land \lnot (S_2 \subseteq S_1)$
  • Set is empty: $(S=\emptyset) = \forall S_1. S \subseteq S_1$
  • Set $S$ is singleton (has exactly 1 element): $One(S) = (\lnot (S = \emptyset)) \land (\forall S_1. S_1 \subset S \rightarrow S_1=\emptyset)$
  • Set membership, treating elements as singletons: $(x \in S) = (x \subseteq S)$
  • Intersection: $(A = B \cap C) = (A \subseteq B \land A \subseteq C) \land (\forall A_1. A_1 \subseteq B \land A_1 \subseteq C \rightarrow A_1 \subseteq A)$
  • Union: $(A = B \cup C) = (B \subseteq A \land C \subseteq A) \land (\forall A_1. B \subseteq A_1 \land C \subseteq A_1 \rightarrow A \subseteq A_1)$
  • Set difference: $(A = B \setminus C) = (A \cup (B \cap C) = B \land A \cap C = \emptyset)$

(or just use element-wise definitions with singletons)

  • If $k$ is a fixed constant, properties $\mbox{card}(A) \geq k$, $\mbox{card}(A)\leq k$, $\mbox{card}(A)=k$

Transitive closure of a relation

If $F(x,y)$ is a formula on singletons, we define reflexive transitive closure as follows. Define shorthand

  \mbox{Closed}(S,F) = (\forall x,y. One(x) \land One(y) \land x \in S \land F(x,y) \rightarrow y \in S)

Then $(u,v) \in \{(x,y) \mid F(x,y)\}^*$ is defined by

  \forall S. u \in S \land \mbox{Closed}(S,F) \rightarrow v \in S

Thus, we can express

    (root, current) \in \{(x,y).\ x \neq null\ \land\ next(x)=y \}

in WS1S. (To express structures with multiple acyclic lists and 'null', we introduce the set 'Nulls' denoting natural numbers that are considered null.)

Using transitive closure and successors:

  • Constant zero: $(x=0) = One(x) \land \lnot (\exists y. One(y) \land succ(y,x))$
  • Addition by constant: $(x = y + c) = (\exists y_1,\ldots,y_{c-1}. succ(y,y_1) \land succ(y_1,y_2) \land \ldots \land succ(y_{c-1},x))$
  • Ordering on positions in the string: $(u \leq v) = ((u,v) \in \{(x,y)|succ(x,y))\}^*$
  • Reachability in $k$-increments, that is, $\exists k \geq 0. y=x + c\cdot k$: $\mbox{Reach}_c(u,v) = ((u,v) \in \{(x,y)\mid y=x+c\}^*)$
  • Congruence modulo $c$: $(x \equiv y)(\mbox{mod}\ c) = \mbox{Reach}_c(x,y) \lor \mbox{Reach}_c(y,x)$

Representing integers

Note that although we interpret elements as sets of integers, we cannot even talk about addition of two arbitrary integers $x=y+z$, only addition with a constant. Also, although we can say $\mbox{Reach}_c(x,y)$ we cannot say in how many steps we reach $y$ from $x$. However, if we view sets of integers digits of a binary representation of another integer, then we can express much more. If $S$ is a finite set, let $N(S)$ represent the number whose digits are $S$, that is:

  N(S) = \sum_{i \in S} 2^i

Then we can define addition $N(Z) = N(X) + N(Y)$ by saying that there exists a set of carry bits $C$ such that the rules for binary addition hold:

  \exists C.\ 0 \notin C\ \land \forall i.\ 
    ((i \in Z) &\leftrightarrow& ((i \in X) \oplus (i \in Y) \oplus (i \in C))\ \land\\
    ((i+1 \in C) &\leftrightarrow& \mbox{atLeastTwo}(i \in X,i \in Y,i \in C)\big)


  x \oplus y &=& (x \lor y) \land \lnot (x \land y) \\
  \mbox{atLeastTwo}(x,y,z) &=& (x \land y) \lor (x \land z) \lor (y \land z)

This way we can represent entire Presburger arithmetic in MSOL over strings. Moreover, we have more expressive power because $X \subseteq Y$ means that the one bits of $N(X)$ are included in the bits of $N(Y)$, that is, the bitwise or of $N(X)$ and $N(Y)$ is equal to $N(Y)$. In fact, if we add the relation of bit inclusion into Presburger arithmetic, we obtain precisely the expressive power of MSOL when sets are treated as binary representations of integers (Indeed, taking the minimal syntax of MSOL from the beginning, the bit inclusion gives us the subset, whereas the successor relation $s(x,y)$ is expressible using $y=x+1$.)

Definable Relations

We can define relations on $\mathbb{N}$ in two different ways.

Relations on singleton sets:

   r^s_F = \{(p,q) \mid F(\{p\},\{q\}) \}

Relations on binary representations:

   r^b_F = \{(p,q) \mid F(N(p),N(q)) \}

Addition is not definable as some $r^s_F$, but it is definable as $r^b_F$.