No public endorsements yet.
Loading review…
Sign in with ORCIDConcept map
Evidence
Each proof establishes this claim relative to its assumptions.
-
no assumptions
thm✓Lax11.Courcelle⊢
Lax11Proofs.Courcelle.exists_linearTime_program_modelChecking
Theorem
Every property of graphs expressible in monadic second-order logic can be decided in linear time on graphs of bounded cliquewidth, given a k-expression for the graph. Fix a sentence and a width bound k; then there are one word RAM program and one constant c such that, at every word length, given any graph in compressed sparse row form followed by a k-expression that evaluates to it, as a word x each of whose entries v satisfies c(|x|+v+1) ≤ , the program halts within c(|x|+1) steps and writes if the sentence holds in the graph and if it does not.
This is the Courcelle–Makowsky–Rotics form of Courcelle's theorem: the width measure is cliquewidth and the logic is monadic second-order logic with quantification over vertices and vertex sets, which is the pairing the two notions are matched to.
Lean source view on GitHub
| 1 | import Lax67.RamComputes |
| 2 | import Lax11.Mso |
| 3 | import Lax11.InstanceEncoding |
| 4 | |
| 5 | /-! |
| 6 | --- |
| 7 | title: Courcelle's theorem on a word RAM |
| 8 | type: theorem |
| 9 | --- |
| 10 | Every property of graphs expressible in monadic second-order logic can |
| 11 | be decided in linear time on graphs of bounded cliquewidth, given a |
| 12 | *k*-expression for the graph. Fix a sentence and a width bound *k*; then |
| 13 | there are one word RAM program and one constant *c* such that, at every |
| 14 | word length, given any graph in compressed sparse row form followed by a |
| 15 | *k*-expression that evaluates to it, as a word *x* each of whose entries |
| 16 | *v* satisfies *c*(|x|+*v*+1) ≤ `2 ^ w`, the program halts within |
| 17 | *c*(|x|+1) steps and writes `1` if the sentence holds in the graph and |
| 18 | `0` if it does not. |
| 19 | |
| 20 | This is the Courcelle–Makowsky–Rotics form of Courcelle's theorem: the |
| 21 | width measure is cliquewidth and the logic is monadic second-order |
| 22 | logic with quantification over vertices and vertex sets, which is the |
| 23 | pairing the two notions are matched to. |
| 24 | |
| 25 | # Formalization notes |
| 26 | |
| 27 | The expression is *input*, not something the program computes. Deciding |
| 28 | cliquewidth, or approximating it, is a different theorem with a |
| 29 | different proof, and folding it in here would silently claim it; the |
| 30 | statement is the honest one, "given a graph together with a |
| 31 | *k*-expression for it". This is the same choice a treewidth-based |
| 32 | statement makes when it takes a tree decomposition as input. |
| 33 | |
| 34 | The order of the quantifiers is the content of the theorem: the |
| 35 | sentence and the width bound come first, then the program and the |
| 36 | constant, then the graph and the word length. So one program serves all |
| 37 | graphs of cliquewidth at most *k* at every word length, with one |
| 38 | constant, but both may depend — and in every known proof do depend, in a |
| 39 | way that grows faster than any tower of exponentials in the sentence — |
| 40 | on the sentence and the width. Nothing here estimates the constant. This |
| 41 | is the opposite ordering from the vertex cover statement of this |
| 42 | submission, and it has to be: there the parameter is an entry of the |
| 43 | input word, so one program can read it and serve every parameter, while |
| 44 | here the sentence is not part of the input at all and a program that has |
| 45 | never seen it cannot decide it. Quantifying the program before the word |
| 46 | length says the same thing about `w` as everywhere else in this |
| 47 | submission — one program that works at every word length that admits its |
| 48 | input, rather than a family of programs, one of which could hide an |
| 49 | arbitrary amount of information in its literals. |
| 50 | |
| 51 | One constant does both jobs, and the condition it appears in says two |
| 52 | things at once. The first is that the running time fits: taking *v* to |
| 53 | be any entry of the word — an instance word is never empty — the |
| 54 | condition gives *c*(|x|+1) ≤ `2 ^ w`, so `2 ^ w` is at least the number |
| 55 | of steps the claim allows, and with it every quantity the program forms |
| 56 | out of the length of the word, the number of nodes of the expression and |
| 57 | the addresses of the arrays included. The four tables of the dynamic |
| 58 | program are also covered, since their sizes depend on the sentence and |
| 59 | the width bound alone and are therefore absorbed into *c*, which is |
| 60 | chosen after both. |
| 61 | |
| 62 | The second is that the entries themselves fit, and this is why the |
| 63 | condition quantifies over them. A machine at word length `w` sees its |
| 64 | input reduced modulo `2 ^ w`, so an entry that is not a word is not the |
| 65 | entry it was handed. Most entries of an instance are small: vertex |
| 66 | numbers, offsets and node numbers are below the length of the word, and |
| 67 | an operation code is below the number of operations at width *k*, which |
| 68 | `c` covers. But not all of them are, because the format has slots the |
| 69 | encoding deliberately leaves free — the parent entry of the root, |
| 70 | through which nothing points, and the vertex name at a node whose |
| 71 | operation creates no vertex. Those may hold any number whatever, and |
| 72 | saying of every entry that it fits is what makes the claim about them |
| 73 | honest instead of silently assuming they are small. It is the same |
| 74 | bookkeeping the vertex cover statement of this submission does with |
| 75 | `c * (|x| + k + 1)`, where the one entry not bounded by the length is |
| 76 | the parameter. |
| 77 | |
| 78 | The fitting condition is a condition on the admissible inputs and not a |
| 79 | hypothesis of the claim, because as a hypothesis it would be empty. A |
| 80 | graph with an edge has encodings of every length, since a block may list |
| 81 | a neighbour repeatedly, so no word length accommodates all encodings of |
| 82 | a fixed graph at once and "if every instance for `G` and `k` fits into a |
| 83 | word" would never be satisfied. Restricting the inputs instead says what |
| 84 | is meant: at every word length, every instance that fits is decided |
| 85 | within the bound. |
| 86 | |
| 87 | Only encodings of `G` are admitted as inputs; the program may behave |
| 88 | arbitrarily on words that encode nothing, and on words too long for its |
| 89 | word length. |
| 90 | -/ |
| 91 | |
| 92 | namespace Lax11.Courcelle |
| 93 | |
| 94 | open Lax67.Ram Lax67.RamComputes Lax11.Mso Lax11.InstanceEncoding |
| 95 | |
| 96 | open Classical in |
| 97 | /-- **Courcelle's theorem** (Courcelle–Makowsky–Rotics form): model |
| 98 | checking monadic second-order logic is linear time on a word random |
| 99 | access machine, for graphs presented together with a `k`-expression. For |
| 100 | every sentence and every width bound there are one program and one |
| 101 | constant such that, at every word length `w`, on every graph given in |
| 102 | compressed sparse row form followed by a `k`-expression for it as a word |
| 103 | `x` each of whose entries `v` satisfies `c * (x.length + v + 1) ≤ 2 ^ w`, |
| 104 | the program halts within a constant multiple of the length of the input, |
| 105 | having written `1` if the sentence holds in the graph and `0` |
| 106 | otherwise. -/ |
| 107 | axiom exists_linearTime_program_modelChecking : |
| 108 | ∀ (φ : MSO 0 0) (k : ℕ), |
| 109 | ∃ (p : Program) (c : ℕ), ∀ (n : ℕ) (G : SimpleGraph (Fin n)) (w : ℕ), |
| 110 | ComputesInTime w p |
| 111 | {x | EncodesModelCheckingInstance x n G k ∧ |
| 112 | ∀ v ∈ x, c * (x.length + v + 1) ≤ 2 ^ w} |
| 113 | (fun _ => if Sat G Fin.elim0 Fin.elim0 φ then [1] else [0]) |
| 114 | (fun x => c * (x.length + 1)) |
| 115 | |
| 116 | end Lax11.Courcelle |
| 117 |
Formalization notes
The expression is input, not something the program computes. Deciding cliquewidth, or approximating it, is a different theorem with a different proof, and folding it in here would silently claim it; the statement is the honest one, "given a graph together with a k-expression for it". This is the same choice a treewidth-based statement makes when it takes a tree decomposition as input.
The order of the quantifiers is the content of the theorem: the sentence and the width bound come first, then the program and the constant, then the graph and the word length. So one program serves all graphs of cliquewidth at most k at every word length, with one constant, but both may depend — and in every known proof do depend, in a way that grows faster than any tower of exponentials in the sentence — on the sentence and the width. Nothing here estimates the constant. This is the opposite ordering from the vertex cover statement of this submission, and it has to be: there the parameter is an entry of the input word, so one program can read it and serve every parameter, while here the sentence is not part of the input at all and a program that has never seen it cannot decide it. Quantifying the program before the word length says the same thing about as everywhere else in this submission — one program that works at every word length that admits its input, rather than a family of programs, one of which could hide an arbitrary amount of information in its literals.
One constant does both jobs, and the condition it appears in says two things at once. The first is that the running time fits: taking v to be any entry of the word — an instance word is never empty — the condition gives c(|x|+1) ≤ , so is at least the number of steps the claim allows, and with it every quantity the program forms out of the length of the word, the number of nodes of the expression and the addresses of the arrays included. The four tables of the dynamic program are also covered, since their sizes depend on the sentence and the width bound alone and are therefore absorbed into c, which is chosen after both.
The second is that the entries themselves fit, and this is why the condition quantifies over them. A machine at word length sees its input reduced modulo , so an entry that is not a word is not the entry it was handed. Most entries of an instance are small: vertex numbers, offsets and node numbers are below the length of the word, and an operation code is below the number of operations at width k, which covers. But not all of them are, because the format has slots the encoding deliberately leaves free — the parent entry of the root, through which nothing points, and the vertex name at a node whose operation creates no vertex. Those may hold any number whatever, and saying of every entry that it fits is what makes the claim about them honest instead of silently assuming they are small. It is the same bookkeeping the vertex cover statement of this submission does with , where the one entry not bounded by the length is the parameter.
The fitting condition is a condition on the admissible inputs and not a hypothesis of the claim, because as a hypothesis it would be empty. A graph with an edge has encodings of every length, since a block may list a neighbour repeatedly, so no word length accommodates all encodings of a fixed graph at once and "if every instance for and fits into a word" would never be satisfied. Restricting the inputs instead says what is meant: at every word length, every instance that fits is decided within the bound.
Only encodings of are admitted as inputs; the program may behave arbitrarily on words that encode nothing, and on words too long for its word length.
Community review
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above; your ORCID profile must share a public name.
0 comments