{"id":1140,"date":"2016-11-16T19:10:46","date_gmt":"2016-11-16T18:10:46","guid":{"rendered":"http:\/\/www.mimuw.edu.pl\/~bojan\/?page_id=1140"},"modified":"2016-12-29T16:15:45","modified_gmt":"2016-12-29T15:15:45","slug":"monadic-second-order-logic-and-courcelles-theorem","status":"publish","type":"page","link":"https:\/\/www.mimuw.edu.pl\/~bojan\/20152016-2\/jezyki-automaty-i-obliczenia-2\/monadic-second-order-logic-and-courcelles-theorem","title":{"rendered":"0. Monadic second-order logic and Courcelle&#8217;s Theorem"},"content":{"rendered":"<p>In this part of the lecture, we discuss how logic can be used to describe graphs or trees or words. The logic of interest is\u00a0<em>monadic second-order logic (mso).\u00a0<\/em>The main result is Courcelle&#8217;s Theorem, which says that every fixed formula of\u00a0mso can be evaluated in linear time on graphs that are similar to trees.<\/p>\n<hr \/>\n<p><strong>Monadic second-order\u00a0logic.\u00a0<\/strong><\/p>\n<p>Monadic second-order logic (mso) is a logic with two types of quantifiers: one can quantify over elements, and one can quantify over sets of elements. One cannot, however, quantify over sets of pairs, or over sets triples, etc.<\/p>\n<p>Our main interest here is to use mso to describe properties of undirected graphs. For example, suppose that we view a undirected graph as relational structure (i.e. a model as in logic), where the universe is the vertices and there is one binary relation <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-c2d6553a1ce5b71224c383c846c8ab5d_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#69;&#40;&#120;&#44;&#121;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"48\" style=\"vertical-align: -4px;\"\/> for the edges; this relation is symmetric. The following formula <\/p>\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 16px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-82233cff309902a9e7dfad7499d5edd6_l3.png\" height=\"16\" width=\"88\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#91;&#92;&#102;&#111;&#114;&#97;&#108;&#108;&#32;&#120;&#32;&#92;&#102;&#111;&#114;&#97;&#108;&#108;&#32;&#121;&#32;&#92;&#32;&#69;&#40;&#120;&#44;&#121;&#41;&#92;&#93;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p>\n<p> says that the graph is a clique. The formula only quantifies over vertices, i.e. it uses only first-order quantification. Now we consider a formula which uses also set quantification. We adopt the convention that small variables <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-ea85061456ea7b5fe34eb0e9f3a7495c_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#120;&#44;&#121;&#44;&#122;&#44;&#92;&#108;&#100;&#111;&#116;&#115;\" title=\"Rendered by QuickLaTeX.com\" height=\"10\" width=\"63\" style=\"vertical-align: -3px;\"\/> range over elements and big variables <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-60cc7bd007474c0cacf7c7effa12231c_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#88;&#44;&#89;&#44;&#90;&#44;&#92;&#108;&#100;&#111;&#116;&#115;\" title=\"Rendered by QuickLaTeX.com\" height=\"14\" width=\"72\" style=\"vertical-align: -3px;\"\/> range over sets of elements. \u00a0The following formula says that input graph is not connected:<\/p>\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 39px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-eb6bb41e844e824edd196e5234e2f3a9_l3.png\" height=\"39\" width=\"480\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#91;&#92;&#117;&#110;&#100;&#101;&#114;&#98;&#114;&#97;&#99;&#101;&#123;&#92;&#101;&#120;&#105;&#115;&#116;&#115;&#32;&#88;&#125;&#95;&#123;&#92;&#116;&#101;&#120;&#116;&#123;&#101;&#120;&#105;&#115;&#116;&#115;&#32;&#97;&#32;&#115;&#101;&#116;&#125;&#125;&#32;&#92;&#32;&#92;&#117;&#110;&#100;&#101;&#114;&#98;&#114;&#97;&#99;&#101;&#123;&#40;&#92;&#102;&#111;&#114;&#97;&#108;&#108;&#32;&#120;&#32;&#92;&#102;&#111;&#114;&#97;&#108;&#108;&#32;&#121;&#92;&#32;&#120;&#32;&#92;&#105;&#110;&#32;&#88;&#32;&#92;&#108;&#97;&#110;&#100;&#32;&#69;&#40;&#120;&#44;&#121;&#41;&#32;&#92;&#82;&#105;&#103;&#104;&#116;&#97;&#114;&#114;&#111;&#119;&#32;&#121;&#32;&#92;&#105;&#110;&#32;&#88;&#41;&#125;&#95;&#123;&#92;&#116;&#101;&#120;&#116;&#123;&#36;&#88;&#36;&#32;&#105;&#115;&#32;&#99;&#108;&#111;&#115;&#101;&#100;&#32;&#117;&#110;&#100;&#101;&#114;&#32;&#110;&#101;&#105;&#103;&#104;&#98;&#111;&#117;&#114;&#115;&#125;&#125;&#32;&#92;&#108;&#97;&#110;&#100;&#32;&#92;&#117;&#110;&#100;&#101;&#114;&#98;&#114;&#97;&#99;&#101;&#123;&#40;&#92;&#101;&#120;&#105;&#115;&#116;&#115;&#32;&#120;&#32;&#92;&#32;&#120;&#32;&#92;&#105;&#110;&#32;&#88;&#41;&#32;&#92;&#108;&#97;&#110;&#100;&#32;&#40;&#92;&#101;&#120;&#105;&#115;&#116;&#115;&#32;&#120;&#32;&#92;&#32;&#120;&#32;&#92;&#110;&#111;&#116;&#32;&#92;&#105;&#110;&#32;&#88;&#41;&#125;&#95;&#123;&#92;&#116;&#101;&#120;&#116;&#123;&#36;&#88;&#36;&#32;&#105;&#115;&#32;&#110;&#101;&#105;&#116;&#104;&#101;&#114;&#32;&#101;&#109;&#112;&#116;&#121;&#32;&#110;&#111;&#114;&#32;&#102;&#117;&#108;&#108;&#125;&#125;&#92;&#93;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p>\n<p>The above formula illustrates all constructs in mso: one can quantify over elements, over sets of elements, one can test membership of elements in sets, and one can use the predicates available in the input model.<\/p>\n<p>Here is another example: an mso formula which says that the input graph is three colourable:<\/p>\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 60px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-7d20a18a05e9df605c18d6ef22241054_l3.png\" height=\"60\" width=\"493\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#91;&#92;&#101;&#120;&#105;&#115;&#116;&#115;&#32;&#88;&#95;&#49;&#32;&#92;&#101;&#120;&#105;&#115;&#116;&#115;&#32;&#88;&#95;&#50;&#32;&#92;&#101;&#120;&#105;&#115;&#116;&#115;&#32;&#88;&#95;&#51;&#32;&#92;&#117;&#110;&#100;&#101;&#114;&#98;&#114;&#97;&#99;&#101;&#123;&#92;&#102;&#111;&#114;&#97;&#108;&#108;&#32;&#120;&#32;&#92;&#98;&#105;&#103;&#118;&#101;&#101;&#95;&#123;&#105;&#125;&#32;&#88;&#95;&#105;&#125;&#95;&#123;&#92;&#116;&#101;&#120;&#116;&#123;&#101;&#118;&#101;&#114;&#121;&#32;&#118;&#101;&#114;&#116;&#101;&#120;&#32;&#105;&#115;&#32;&#99;&#111;&#108;&#111;&#117;&#114;&#101;&#100;&#125;&#125;&#32;&#92;&#108;&#97;&#110;&#100;&#32;&#92;&#113;&#117;&#97;&#100;&#32;&#92;&#117;&#110;&#100;&#101;&#114;&#98;&#114;&#97;&#99;&#101;&#123;&#92;&#102;&#111;&#114;&#97;&#108;&#108;&#32;&#120;&#32;&#92;&#102;&#111;&#114;&#97;&#108;&#108;&#32;&#121;&#32;&#92;&#32;&#69;&#40;&#120;&#44;&#121;&#41;&#32;&#92;&#82;&#105;&#103;&#104;&#116;&#97;&#114;&#114;&#111;&#119;&#32;&#92;&#98;&#105;&#103;&#118;&#101;&#101;&#95;&#123;&#105;&#32;&#92;&#110;&#101;&#113;&#32;&#106;&#125;&#32;&#88;&#95;&#105;&#40;&#120;&#41;&#32;&#92;&#108;&#97;&#110;&#100;&#32;&#88;&#95;&#106;&#40;&#120;&#41;&#125;&#95;&#123;&#92;&#116;&#101;&#120;&#116;&#123;&#101;&#118;&#101;&#114;&#121;&#32;&#101;&#100;&#103;&#101;&#32;&#104;&#97;&#115;&#32;&#101;&#110;&#100;&#112;&#111;&#105;&#110;&#116;&#115;&#32;&#119;&#105;&#116;&#104;&#32;&#100;&#105;&#102;&#102;&#101;&#114;&#101;&#110;&#116;&#32;&#99;&#111;&#108;&#111;&#117;&#114;&#115;&#125;&#125;&#92;&#93;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p>\n<p>We say that a property of graphs (or more generally, structures over some vocabulary) is\u00a0<em>mso definable\u00a0<\/em>if there is a formula of mso which is true exactly in those graphs which have the property.<\/p>\n<hr \/>\n<p><strong>Model checking of mso<\/strong><\/p>\n<p>Model checking of mso formulas is the problem of checking if a given formula is true in a given structure (here, a graph). This problem is computationally hard: if we assume that the input is both the graph and the formula, then the problem is PSPACE complete (actually, it is PSPACE complete even when the graph is fixed, e.g. the one vertex graph, by encoding QBF in a straightforward way). If the formula is fixed and the graph is the only input, then the problem can be NP complete, as the example of 3-colorability shows. Since mso has built in negation, then we can also get coNP problems, e.g. non-3-colorability, and by using alternation of set quantifiers we can\u00a0get problems that are complete for any level of the polynomial hierarchy. Summing up \u2013 in general, the\u00a0model checking problem<em>\u00a0<\/em>is hard.<\/p>\n<p>The goal of this lecture is to show that the model checking becomes tractable \u2013 even linear time \u2013 when the formula is fixed and the graphs are similar to trees. In particular, 3-colorability is tractable on graphs similar to trees, but the same holds for any graph problem which can be formalised in mso.<\/p>\n<hr \/>\n<p><strong>Treewidth and Courcelle&#8217;s Theorem.<\/strong><\/p>\n<p>We now come to the main result of this part of the lecture, namely Courcelle&#8217;s theorem. The theorem is about evaluating model checking mso on graphs of bounded tree width. Treewidth is a graph parameter, i.e. every graph has a some treewidth, which is a natural\u00a0number. The treewidth\u00a0of a graph describes the smallest width\u00a0of a tree decomposition that can produce the graph. Treewidth, tree decompositions and their width are defined <a href=\"https:\/\/www.mimuw.edu.pl\/~bojan\/20162017-2\/advanced-topics-in-automata-20162017-jezyki-automaty-i-obliczenia-2\/monadic-second-order-logic-and-courcelles-theorem\/tree-width\">here<\/a>. The general idea is that small width tree decompositions can be obtained for graphs that are similar to trees, although there exists other inequivalent ways of quantifying similarity to a tree, e.g.\u00a0<em>clique width<\/em>.<\/p>\n<p>Bodlaender and Kloks have shown that tree decompositions can be computed in linear time, when the width is fixed, i.e. every <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-2f4cc4976a18063268a04e50c161c0e2_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#107;&#32;&#92;&#105;&#110;&#32;&#92;&#78;&#97;&#116;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"39\" style=\"vertical-align: -1px;\"\/> there is a linear time algorithm which inputs a graph and outputs, if it exists, a tree decomposition of width <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-5fc287f6a1686dee0794a092dcc5d66b_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#107;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"8\" style=\"vertical-align: 0px;\"\/>. The constant in the linear time is exponential in <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-5fc287f6a1686dee0794a092dcc5d66b_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#107;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"8\" style=\"vertical-align: 0px;\"\/>. We will show an easier result, which is weaker in two ways: the algorithm is not linear, and the computed tree decomposition is not optimal.<\/p>\n<p><strong>Theorem 1.\u00a0<\/strong><em>For every <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-2f4cc4976a18063268a04e50c161c0e2_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#107;&#32;&#92;&#105;&#110;&#32;&#92;&#78;&#97;&#116;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"39\" style=\"vertical-align: -1px;\"\/> there is a\u00a0cubic time algorithm which inputs a graph and fails or outputs a tree decomposition of width <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-71b54dde57db4e18c7cc3d63a5a4c2a6_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#60;&#51;&#107;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"31\" style=\"vertical-align: 0px;\"\/>. The algorithm succeeds if the graph\u00a0has treewidth <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-bc0a69300531a0ef60af13d785cc72e5_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#60;&#32;&#107;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"23\" style=\"vertical-align: 0px;\"\/>.<\/em><\/p>\n<p>Theorem 1 is proved <a href=\"https:\/\/www.mimuw.edu.pl\/~bojan\/20162017-2\/advanced-topics-in-automata-20162017-jezyki-automaty-i-obliczenia-2\/monadic-second-order-logic-and-courcelles-theorem\/computing-a-tree-decomposition\">here<\/a>. The constant in the running time is exponential in <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-5fc287f6a1686dee0794a092dcc5d66b_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#107;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"8\" style=\"vertical-align: 0px;\"\/>.<\/p>\n<p>The second ingredient in Courcelle&#8217;s theorem is that, once the tree decomposition is given, \u00a0mso formulas can be evaluated in linear time.<\/p>\n<p><strong>Theorem 2. <\/strong><em>Let <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-2f4cc4976a18063268a04e50c161c0e2_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#107;&#32;&#92;&#105;&#110;&#32;&#92;&#78;&#97;&#116;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"39\" style=\"vertical-align: -1px;\"\/> \u00a0and let <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-8cb1ea867e2888b522709f63bc7b588a_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#118;&#97;&#114;&#112;&#104;&#105;\" title=\"Rendered by QuickLaTeX.com\" height=\"10\" width=\"10\" style=\"vertical-align: -3px;\"\/> be an mso formula over the vocabulary of graphs, i.e. using a binary relation <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-c2d6553a1ce5b71224c383c846c8ab5d_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#69;&#40;&#120;&#44;&#121;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"48\" style=\"vertical-align: -4px;\"\/>. \u00a0There is a linear time algorithm which inputs a tree decomposition of width <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-5fc287f6a1686dee0794a092dcc5d66b_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#107;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"8\" style=\"vertical-align: 0px;\"\/> and decides if the underlying graph satisfies <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-8cb1ea867e2888b522709f63bc7b588a_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#118;&#97;&#114;&#112;&#104;&#105;\" title=\"Rendered by QuickLaTeX.com\" height=\"10\" width=\"10\" style=\"vertical-align: -3px;\"\/>.<\/em><\/p>\n<p>Theorem 2 is proved in two steps:\u00a0<a href=\"https:\/\/www.mimuw.edu.pl\/~bojan\/20162017-2\/advanced-topics-in-automata-20162017-jezyki-automaty-i-obliczenia-2\/monadic-second-order-logic-and-courcelles-theorem\/tree-automata-and-interpretations\">we introduce automata over trees and show that they are equivalent to mso<\/a>\u00a0and then <a href=\"https:\/\/www.mimuw.edu.pl\/~bojan\/20162017-2\/advanced-topics-in-automata-20162017-jezyki-automaty-i-obliczenia-2\/monadic-second-order-logic-and-courcelles-theorem\/interpreting-a-graph-in-its-tree-decomposition\">we show that evaluating mso on a graph of bounded treewidth can be simulated by running a tree automaton over a tree decomposition<\/a>. The constant in the running time is nonelementary in <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-8cb1ea867e2888b522709f63bc7b588a_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#118;&#97;&#114;&#112;&#104;&#105;\" title=\"Rendered by QuickLaTeX.com\" height=\"10\" width=\"10\" style=\"vertical-align: -3px;\"\/>, i.e. it is more than exponential, more than doubly exponential, etc. Combining the two results above we get the following.<\/p>\n<p><strong>Corollary (Courcelle&#8217;s Theorem).\u00a0<\/strong><em>Let <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-2f4cc4976a18063268a04e50c161c0e2_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#107;&#32;&#92;&#105;&#110;&#32;&#92;&#78;&#97;&#116;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"39\" style=\"vertical-align: -1px;\"\/> and let <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-8cb1ea867e2888b522709f63bc7b588a_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#118;&#97;&#114;&#112;&#104;&#105;\" title=\"Rendered by QuickLaTeX.com\" height=\"10\" width=\"10\" style=\"vertical-align: -3px;\"\/> be an mso formula over the vocabulary of graphs, i.e. using a binary relation <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-c2d6553a1ce5b71224c383c846c8ab5d_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#69;&#40;&#120;&#44;&#121;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"48\" style=\"vertical-align: -4px;\"\/>. \u00a0There is a cubic algorithm which inputs an unidrected graph and fails or answers\u00a0if the graph satisfies <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-8cb1ea867e2888b522709f63bc7b588a_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#118;&#97;&#114;&#112;&#104;&#105;\" title=\"Rendered by QuickLaTeX.com\" height=\"10\" width=\"10\" style=\"vertical-align: -3px;\"\/>. The algorithm succeeds if the graph has tree width <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-519b5fcab9655e8acba97761dd29bb63_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#108;&#101;&#32;&#107;\" title=\"Rendered by QuickLaTeX.com\" height=\"13\" width=\"23\" style=\"vertical-align: -2px;\"\/>.<\/em><\/p>\n<p>Note that in the algorithm above, there are three possible outcomes: fail (don&#8217;t know), satisfies <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-8cb1ea867e2888b522709f63bc7b588a_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#118;&#97;&#114;&#112;&#104;&#105;\" title=\"Rendered by QuickLaTeX.com\" height=\"10\" width=\"10\" style=\"vertical-align: -3px;\"\/>, and does not satisfy <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-content\/ql-cache\/quicklatex.com-8cb1ea867e2888b522709f63bc7b588a_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#118;&#97;&#114;&#112;&#104;&#105;\" title=\"Rendered by QuickLaTeX.com\" height=\"10\" width=\"10\" style=\"vertical-align: -3px;\"\/>. Using the stronger, linear time, version of Theorem 1, we could get a linear running time for the algorithm in Courcelle&#8217;s Theorem.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this part of the lecture, we discuss how logic can be used to describe graphs or trees or words. The logic of interest is\u00a0monadic second-order logic (mso).\u00a0The main result is Courcelle&#8217;s Theorem, which says that every fixed formula of\u00a0mso can be evaluated in linear time on graphs that are similar to trees. Monadic second-order\u00a0logic.\u00a0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":535,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"class_list":["post-1140","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-json\/wp\/v2\/pages\/1140"}],"collection":[{"href":"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-json\/wp\/v2\/comments?post=1140"}],"version-history":[{"count":42,"href":"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-json\/wp\/v2\/pages\/1140\/revisions"}],"predecessor-version":[{"id":1243,"href":"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-json\/wp\/v2\/pages\/1140\/revisions\/1243"}],"up":[{"embeddable":true,"href":"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-json\/wp\/v2\/pages\/535"}],"wp:attachment":[{"href":"https:\/\/www.mimuw.edu.pl\/~bojan\/wp-json\/wp\/v2\/media?parent=1140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}