Documentation

CslibFrontier.Computability.PostCorrespondence.Rewrite

String rewriting and the modified correspondence problem #

A set R of dominoes is read as a semi-Thue system: one step replaces an occurrence of the top word of a domino of R by its bottom word. With the copy dominoes a / a, an MPCP instance with start domino ε / w simulates rewriting from w to the empty word: a match is a sequence of rewriting steps, each written below the word it rewrites. This is the mechanism of Sipser's computation-history dominoes [Sipser2013, proof of Theorem 5.15], with the rule set of the simulated machine as R.

Completeness needs nothing beyond the copy dominoes. Soundness needs an end marker e that separates successive words: every reachable word other than ε ends with its only e, and e occurs in the top of a domino only as its last letter. Then each block of the match up to an occurrence of e rewrites the current word to the next one.

Main definitions #

Main results #

References #

def Cslib.PostCorrespondence.Rewrites {α : Type u_1} (R : Domino α → Prop) (u v : List α) :

One rewriting step with a set R of dominoes, read as a semi-Thue system: an occurrence of the top word of a domino of R is replaced by its bottom word.

Instances For
    theorem Cslib.PostCorrespondence.Rewrites.append_left {α : Type u_1} {R : Domino α → Prop} {u v : List α} (h : Rewrites R u v) (w : List α) :
    Rewrites R (w ++ u) (w ++ v)
    theorem Cslib.PostCorrespondence.Rewrites.append_right {α : Type u_1} {R : Domino α → Prop} {u v : List α} (h : Rewrites R u v) (w : List α) :
    Rewrites R (u ++ w) (v ++ w)
    theorem Cslib.PostCorrespondence.reflTransGen_tops_bottoms {α : Type u_1} {R : Domino α → Prop} {σ : List (Domino α)} :
    (∀ d ∈ σ, R d ∨ d.top = d.bottom) → Relation.ReflTransGen (Rewrites R) (tops σ) (bottoms σ)

    A sequence of dominoes, each of which is in R or has equal top and bottom, rewrites its top concatenation to its bottom concatenation.

    def Cslib.PostCorrespondence.copy {α : Type u_1} (a : α) :

    The copy domino of a letter.

    @[simp]
    theorem Cslib.PostCorrespondence.copy_top {α : Type u_1} (a : α) :
    (copy a).top = [a]
    @[simp]
    theorem Cslib.PostCorrespondence.copy_bottom {α : Type u_1} (a : α) :
    theorem Cslib.PostCorrespondence.Rewrites.exists_dominoes {α : Type u_1} {R : Domino α → Prop} {u v : List α} (h : Rewrites R u v) :
    ∃ (σ : List (Domino α)), (∀ d ∈ σ, R d ∨ ∃ (a : α), d = copy a) ∧ tops σ = u ∧ bottoms σ = v

    Every rewriting step is realized by a sequence of copy dominoes and one domino of R.

    theorem Cslib.PostCorrespondence.mSolvable_of_reflTransGen {α : Type u_1} {R : Domino α → Prop} {D : List (Domino α)} (hR : ∀ (d : Domino α), R d → d ∈ D) (hcopy : ∀ (a : α), copy a ∈ D) {w : List α} (h : Relation.ReflTransGen (Rewrites R) w []) :
    { start := { top := [], bottom := w }, dominoes := D }.Solvable

    Completeness of the semi-Thue encoding: if w rewrites to the empty word, the MPCP instance with start domino ε / w is solvable, using the dominoes of R and the copy dominoes.

    theorem Cslib.PostCorrespondence.reflTransGen_of_mSolvable {α : Type u_1} {R : Domino α → Prop} {D : List (Domino α)} (hD : ∀ d ∈ D, R d ∨ d.top = d.bottom) {e : α} (he : ∀ d ∈ D, e ∈ d.top → ∃ (t : List α), d.top = t ++ [e] ∧ e ∉ t) {w : List α} (hw : ∀ (u : List α), Relation.ReflTransGen (Rewrites R) w u → u = [] ∨ ∃ (u' : List α), u = u' ++ [e] ∧ e ∉ u') (h : { start := { top := [], bottom := w }, dominoes := D }.Solvable) :

    Soundness of the semi-Thue encoding. Suppose a letter e occurs in the top word of a domino only as its last letter, and every word reachable from w is empty or ends with its only e. Then a match of the MPCP instance with start domino ε / w yields a rewriting of w to the empty word.