Computation histories as dominoes #
The combinatorial core of the RE-hardness of DescriptiveComplexity.PCP: a
string-rewriting system has a derivation from its start word to the halting
word exactly when a certain list of domino pairs has a match. Nothing here
mentions a structure or a formula – the first-order side reads this file's
DescriptiveComplexity.Pcp.History.HasMatch off an instance.
The system #
A rewriting system is a relation Rule between words over an alphabet Γ;
one step (DescriptiveComplexity.Pcp.History.Step) replaces a left-hand side
by a right-hand side somewhere in the word, and
DescriptiveComplexity.Pcp.History.Derives is its reflexive-transitive
closure. The question the dominoes answer is whether the start word C₀
derives the one-letter word [halt].
The dominoes, and the two things the construction has to arrange #
A match is read left to right as a queue: the unmatched overhang is a word,
each domino consumes its top from the front of the overhang and appends its
bottom at the back, and the whole history ⊳C₀#C₁#…#Cₙ# is spelt out by the
bottom words one configuration ahead of the top words. Two things have to be
arranged for that reading to be forced.
- The match must start with the start domino. Every word is decorated
(
DescriptiveComplexity.Pcp.History.starLputs astarbefore each letter,DescriptiveComplexity.Pcp.History.starRafter each), so every top begins withstarand every bottom begins with a letter that is notstar– except the start domino's, which begins withstaras well. Since the first domino of a match has its two words beginning alike, it can only be that one. This is why every right-hand side of a rule is required to be nonempty (DescriptiveComplexity.Pcp.History.Ok): a domino with an empty bottom would escape the argument, and it is exactly the domino the undecorated construction needs to close the match. Here the closing domino swallowshalt, the separator and thediain one piece instead, and its bottom is the single letterdia. - The start domino must not reappear. Its top is the marker
tri, which no other domino writes, so it can never be consumed again.
The alignment is then algebra: starL and starR are homomorphisms, and
starL w ++ [star] = star :: starR w is the half-letter offset that makes the
top and the bottom of a match spell the same word.
The decorated alphabet #
The alphabet of the domino words: the letters of the rewriting system, the
separator between two configurations of a history, the decoration star, the
marker tri opening a history and the marker dia closing a match.
- sym
{Γ : Type}
: Γ → Letter Γ
A letter of the rewriting system.
- sep
{Γ : Type}
: Letter Γ
The separator between two configurations.
- star
{Γ : Type}
: Letter Γ
The decoration, which forces the alignment of a match.
- tri
{Γ : Type}
: Letter Γ
The opening marker, which forces the first domino of a match.
- dia
{Γ : Type}
: Letter Γ
The closing marker.
Instances For
Dependency graph
Two different constructors of the alphabet are never equal; the shape in which the case analyses below need it.
Dependency graph
A word of the rewriting system, as a word of the alphabet above.
Equations
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
The half-letter offset: decorating on the left and closing with a
star is decorating on the right and opening with one. This one identity is
what makes the top and the bottom words of a match spell the same word.
Dependency graph
One decorated word is a prefix of the other. Two decorated words opening a common word are comparable, and the longer one continues with the decoration of the difference.
Dependency graph
The rewriting system #
One rewriting step: a left-hand side of a rule, somewhere in the word, replaced by its right-hand side.
Equations
Instances For
Dependency graph
Derivability: any number of rewriting steps.
Equations
Instances For
Dependency graph
Dependency graph
Dependency graph
Simultaneous rewriting: any number of rules applied at once, at
disjoint places. It is what the dominoes between two separators perform, and it
derives no more than one rule at a time does
(DescriptiveComplexity.Pcp.History.ParStep.derives).
- nil
{Γ : Type}
{Rule : List Γ → List Γ → Prop}
: ParStep Rule [] []
The empty word rewrites to itself.
- keep
{Γ : Type}
{Rule : List Γ → List Γ → Prop}
(a : Γ)
{u v : List Γ}
: ParStep Rule u v → ParStep Rule (a :: u) (a :: v)
A letter may be kept.
- rule
{Γ : Type}
{Rule : List Γ → List Γ → Prop}
{l r u v : List Γ}
: Rule l r → ParStep Rule u v → ParStep Rule (l ++ u) (r ++ v)
A rule may be applied.
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
The dominoes #
A domino of the construction: the one that opens a history, one that copies a letter, one that copies a separator, one per rule, and the one that closes a match.
- start
{Γ : Type}
: Dom Γ
Opens the history, writing the start word.
- copy
{Γ : Type}
: Γ → Dom Γ
Copies a letter into the next configuration.
- copySep
{Γ : Type}
: Dom Γ
Copies the separator between two configurations.
- rule
{Γ : Type}
: List Γ → List Γ → Dom Γ
Applies a rule.
- close
{Γ : Type}
: Dom Γ
Closes the match on the halting configuration.
Instances For
Dependency graph
A domino belongs to the system: only its rule dominoes are constrained, and only by the rule they apply – whose two sides must be nonempty, so that no top and no bottom word is empty.
Equations
- DescriptiveComplexity.Pcp.History.Ok Rule (DescriptiveComplexity.Pcp.History.Dom.rule l r) = (Rule l r ∧ l ≠ [] ∧ r ≠ [])
- DescriptiveComplexity.Pcp.History.Ok Rule x✝ = True
Instances For
Dependency graph
The top word of a domino.
Equations
- One or more equations did not get rendered due to their size.
- DescriptiveComplexity.Pcp.History.topW halt DescriptiveComplexity.Pcp.History.Dom.start = DescriptiveComplexity.Pcp.History.starL [DescriptiveComplexity.Pcp.History.Letter.tri]
- DescriptiveComplexity.Pcp.History.topW halt (DescriptiveComplexity.Pcp.History.Dom.copy a) = DescriptiveComplexity.Pcp.History.starL [DescriptiveComplexity.Pcp.History.Letter.sym a]
- DescriptiveComplexity.Pcp.History.topW halt DescriptiveComplexity.Pcp.History.Dom.copySep = DescriptiveComplexity.Pcp.History.starL [DescriptiveComplexity.Pcp.History.Letter.sep]
- DescriptiveComplexity.Pcp.History.topW halt (DescriptiveComplexity.Pcp.History.Dom.rule l a) = DescriptiveComplexity.Pcp.History.starL (DescriptiveComplexity.Pcp.History.symW l)
Instances For
Dependency graph
The bottom word of a domino.
Equations
- One or more equations did not get rendered due to their size.
- DescriptiveComplexity.Pcp.History.botW C₀ (DescriptiveComplexity.Pcp.History.Dom.copy a) = DescriptiveComplexity.Pcp.History.starR [DescriptiveComplexity.Pcp.History.Letter.sym a]
- DescriptiveComplexity.Pcp.History.botW C₀ DescriptiveComplexity.Pcp.History.Dom.copySep = DescriptiveComplexity.Pcp.History.starR [DescriptiveComplexity.Pcp.History.Letter.sep]
- DescriptiveComplexity.Pcp.History.botW C₀ (DescriptiveComplexity.Pcp.History.Dom.rule l a) = DescriptiveComplexity.Pcp.History.starR (DescriptiveComplexity.Pcp.History.symW a)
- DescriptiveComplexity.Pcp.History.botW C₀ DescriptiveComplexity.Pcp.History.Dom.close = [DescriptiveComplexity.Pcp.History.Letter.dia]
Instances For
Dependency graph
The word spelt by the top of a list of dominoes.
Equations
Instances For
Dependency graph
The word spelt by the bottom of a list of dominoes.
Equations
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
The system has a match: a nonempty list of its dominoes whose top words and whose bottom words spell the same word.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
From a derivation to a match #
The dominoes of one rewriting step copy the word on both sides of the rule and apply the rule in the middle, so they consume one configuration and its separator and write the next one and its separator. Chaining them writes the whole history; the start domino opens it and the closing domino swallows the last configuration.
The dominoes copying a word letter by letter.
Equations
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
The dominoes of one step: they consume a configuration and its separator, and write the next configuration and its separator.
Dependency graph
The dominoes of a derivation: they consume every configuration but the last, and write every configuration but the first, so the word they consume and the word they write are the same history read one configuration apart.
Dependency graph
A derivation gives a match.
Dependency graph
From a match to a derivation #
A match is read as a queue: the overhang is a word β # γ, where β is what
is left of the configuration being consumed and γ what has been written of
the next one, and every domino takes its top off the front of the overhang and
puts its bottom at the back. The invariant below says exactly that the queue
belongs to a history, and each domino preserves it.
The top word of a domino is the decoration of the word it takes off the queue, followed by what it carries past the queue – nothing, except for the closing domino, which carries the two letters that end a match.
The undecorated word a domino takes off the queue.
Equations
- DescriptiveComplexity.Pcp.History.topUW halt DescriptiveComplexity.Pcp.History.Dom.start = [DescriptiveComplexity.Pcp.History.Letter.tri]
- DescriptiveComplexity.Pcp.History.topUW halt (DescriptiveComplexity.Pcp.History.Dom.copy a) = [DescriptiveComplexity.Pcp.History.Letter.sym a]
- DescriptiveComplexity.Pcp.History.topUW halt DescriptiveComplexity.Pcp.History.Dom.copySep = [DescriptiveComplexity.Pcp.History.Letter.sep]
- DescriptiveComplexity.Pcp.History.topUW halt (DescriptiveComplexity.Pcp.History.Dom.rule l a) = DescriptiveComplexity.Pcp.History.symW l
- DescriptiveComplexity.Pcp.History.topUW halt DescriptiveComplexity.Pcp.History.Dom.close = [DescriptiveComplexity.Pcp.History.Letter.sym halt, DescriptiveComplexity.Pcp.History.Letter.sep]
Instances For
Dependency graph
What a domino carries past the queue.
Equations
Instances For
Dependency graph
Dependency graph
The queue of a match belongs to a history: it is a configuration reached from the start word, cut in two by the separator, with the part before the cut still to be consumed and the part after it already rewritten.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
A queue carries a separator.
Dependency graph
A queue carries nothing but letters of the system and the separator.
Dependency graph
The word a domino consumes is a prefix of the queue. A top word cannot run past the separator: the only word of the system reaching it is the one the closing domino consumes, and the queue is then exactly that word.
Dependency graph
A word without a separator is no extension of a queue.
Dependency graph
No domino consumes more than the queue holds.
Dependency graph
Dependency graph
The queue lemma: a list of dominoes whose bottom words, appended to the current overhang, spell what its top words spell, walks the queue from a history to the halting configuration.
Dependency graph
A match gives a derivation. The first domino of a match can only be the one that opens a history, since every top word begins with the decoration and no other bottom word does; from there the queue lemma reads the match as a computation.
Dependency graph
Dependency graph
Dependency graph
Only the domino opening a history has a bottom word beginning with the decoration; every other one begins with a letter.
Dependency graph
A match gives a derivation. The first domino of a match can only be the one that opens a history, since every top word begins with the decoration and no other bottom word does; from there the queue lemma reads the match as a computation.
Dependency graph
The dominoes decide derivability: the system has a match exactly when its start word derives the halting configuration.