  We introduce a novel model-theoretic framework inspired from graph
modification and based on the interplay between model theory and algorithmic
graph minors. The core of our framework is a new compound logic operating with
two types of sentences, expressing graph modification: the modulator sentence,
defining some property of the modified part of the graph, and the target
sentence, defining some property of the resulting graph. In our framework,
modulator sentences are in counting monadic second-order logic (CMSOL) and have
models of bounded treewidth, while target sentences express first-order logic
(FOL) properties along with minor-exclusion. Our logic captures problems that
are not definable in first-order logic and, moreover, may have instances of
unbounded treewidth. Also, it permits the modeling of wide families of problems
involving vertex/edge removals, alternative modulator measures (such as
elimination distance or $\mathcal{G}$-treewidth), multistage modifications, and
various cut problems. Our main result is that, for this compound logic,
model-checking can be done in quadratic time. All derived algorithms are
constructive and this, as a byproduct, extends the constructibility horizon of
the algorithmic applications of the Graph Minors theorem of Robertson and
Seymour. The proposed logic can be seen as a general framework to capitalize on
the potential of the irrelevant vertex technique. It gives a way to deal with
problem instances of unbounded treewidth, for which Courcelle's theorem does
not apply. The proof of our meta-theorem combines novel combinatorial results
related to the Flat Wall theorem along with elements of the proof of
Courcelle's theorem and Gaifman's theorem. We finally prove extensions where
the target property is expressible in FOL+DP, i.e., the enhancement of FOL with
disjoint-paths predicates.
