I am working on giving an MSOL formula for an NP-hard problem; this proves that the problem is linear-time solvable on bounded treewidth graphs. Given a graph $G = (V, E)$, the problem would be to find a subset $S \subseteq V$ such that each vertex of degree at least three has at least two neighbors and at most three neighbours in $S$. The MSOL formula for the problem is:
$\exists S \subseteq V:\forall v \in V\setminus d(v) \leq 2: ((\exists {u_1, u_2} \in S) \land (u_1 \in N(v)) \land (u_2 \in N(v)))$ $\land ((\exists u_3 \in S) \land ((u_3 \in N(v) \lor (u_3 \notin N(v))))$ $\land ((\forall u \in S \setminus \{u_1,u_2, u_3\}) \land (u \notin N(v)))$ where $d(v)$ indicates the degree of $v$.
- Is this a valid MSOL formula? can i make use of $d(v)$ in the formula?
- If not, how can i modify it in such a way that the formula solves the problem?