  The notion of directed treewidth was introduced by Johnson, Robertson,
Seymour and Thomas [Journal of Combinatorial Theory, Series B, Vol 82, 2001] as
a first step towards an algorithmic metatheory for digraphs. They showed that
some NP-complete properties such as Hamiltonicity can be decided in polynomial
time on digraphs of constant directed treewidth. Nevertheless, despite more
than one decade of intensive research, the list of hard combinatorial problems
that are known to be solvable in polynomial time when restricted to digraphs of
constant directed treewidth has remained scarce. In this work we enrich this
list by providing for the first time an algorithmic metatheorem connecting the
monadic second order logic of graphs to directed treewidth. We show that most
of the known positive algorithmic results for digraphs of constant directed
treewidth can be reformulated in terms of our metatheorem. Additionally, we
show how to use our metatheorem to provide polynomial time algorithms for two
classes of combinatorial problems that have not yet been studied in the context
of directed width measures. More precisely, for each fixed $k,w \in
\mathbb{N}$, we show how to count in polynomial time on digraphs of directed
treewidth $w$, the number of minimum spanning strong subgraphs that are the
union of $k$ directed paths, and the number of maximal subgraphs that are the
union of $k$ directed paths and satisfy a given minor closed property. To prove
our metatheorem we devise two technical tools which we believe to be of
independent interest. First, we introduce the notion of tree-zig-zag number of
a digraph, a new directed width measure that is at most a constant times
directed treewidth. Second, we introduce the notion of $z$-saturated tree slice
language, a new formalism for the specification and manipulation of infinite
sets of digraphs.
