String rewriting systems
AbbreviationRewriting rules#✓fully proved
A rewriting rule over an alphabet \(\alpha\) is a pair \((l, r)\) of words over \(\alpha\); applying it replaces an occurrence of \(l\) by \(r\).
Used by 48
InductiveOne-step rewriting#✓fully proved
Let \(R\) be a string rewriting system, given as a list of rules. A word \(w\) rewrites to a word \(w'\) in one step of \(R\) when there are a rule \((l, r)\) of \(R\) and words \(u\) and \(v\) with \(w = u l v\) and \(w' = u r v\).
inductive Step (R : List (Rule α)) : List α → List α → Prop
| mk {l r : List α} (u v : List α) : (l, r) ∈ R → Step R (u ++ l ++ v) (u ++ r ++ v)
abbrev Rule (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/StringRewriting.lean:70
Uses 1 · Used by 38
DefinitionDerivations in a string rewriting system#✓fully proved
For a list of rules \(R\), a word \(x\) derives a word \(y\) when \(x\) rewrites to \(y\) in zero or more steps of \(R\), that is, when \((x, y)\) lies in the reflexive-transitive closure of the one-step rewriting relation of \(R\).
def Derives (R : List (Rule α)) : List α → List α → Prop := Relation.ReflTransGen (Step R)
abbrev Rule (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/StringRewriting.lean:70
inductive Step (R : List (Rule α)) : List α → List α → Prop
| mk {l r : List α} (u v : List α) : (l, r) ∈ R → Step R (u ++ l ++ v) (u ++ r ++ v)
CSLibExt/Computability/Decidability/StringRewriting.lean:74
Uses 2 · Used by 23
DefinitionThe reachability problem for string rewriting#✓fully proved
An instance \((R, x, y)\) consists of a string rewriting system \(R\), given as a list of rules, and two words \(x\) and \(y\); it is a yes-instance of the reachability problem when \(x\) rewrites to \(y\) in zero or more steps of \(R\).
def SR (I : List (Rule α) × List α × List α) : Prop := Derives I.1 I.2.1 I.2.2
abbrev Rule (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/StringRewriting.lean:70
def Derives (R : List (Rule α)) : List α → List α → Prop := Relation.ReflTransGen (Step R)
CSLibExt/Computability/Decidability/StringRewriting.lean:78
Uses 2 · Used by 7
DefinitionRewriting systems with nonempty sides#✓fully proved
A string rewriting system \(R\), given as a list of rules \((l, r)\), has nonempty sides when every rule of \(R\) has a nonempty left side \(l\) and a nonempty right side \(r\).
def NonemptyRules (R : List (Rule α)) : Prop := ∀ r ∈ R, r.1 ≠ [] ∧ r.2 ≠ []
abbrev Rule (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/StringRewriting.lean:70
Uses 1 · Used by 6
The dominoes
AbbreviationLifting a word to the extended alphabet#✓fully proved
A word \(a_1 \cdots a_n\) over \(\alpha\) is sent to the word \(a_1 \cdots a_n\) over the extended alphabet of \(\alpha\) in which each \(a_i\) is read as a letter.
abbrev lift (u : List α) : List (Sym α) := u.map letter
abbrev Sym (α : Type*) := Option (Option α)
CSLibExt/Computability/Decidability/PCP.lean:110
abbrev letter (a : α) : Sym α := some (some a)
CSLibExt/Computability/Decidability/PCP.lean:113
Uses 2 · Used by 8
DefinitionThe start domino of the reduction from reachability to MPCP#✓fully proved
Let \(x\) be a word over an alphabet \(\alpha\), and extend \(\alpha\) by a star \(\star\) and an end marker \(\diamond\). The start domino of \(x\) has top the one-letter word \(\diamond\) and bottom the word \(\diamond x \star\), with the letters of \(x\) read as letters of the extended alphabet.
def startCard (x : List α) : Domino (Sym α) := ([endMark], endMark :: lift x ++ [star])
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
abbrev Sym (α : Type*) := Option (Option α)
CSLibExt/Computability/Decidability/PCP.lean:110
abbrev endMark : Sym α := none
CSLibExt/Computability/Decidability/PCP.lean:119
abbrev lift (u : List α) : List (Sym α) := u.map letter
CSLibExt/Computability/Decidability/StringRewriting.lean:132
abbrev star : Sym α := some none
CSLibExt/Computability/Decidability/PCP.lean:116
Uses 5 · Used by 5
DefinitionFinal domino#✓fully proved
For a word \(y\) over \(\alpha\), the final domino of \(y\) is the domino over the extended alphabet with top \(y \star \diamond\) and bottom \(\diamond\), where \(y\) is read as a word of letters, \(\star\) is the row separator and \(\diamond\) is the end marker.
def finalCard (y : List α) : Domino (Sym α) := (lift y ++ [star, endMark], [endMark])
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
abbrev Sym (α : Type*) := Option (Option α)
CSLibExt/Computability/Decidability/PCP.lean:110
abbrev lift (u : List α) : List (Sym α) := u.map letter
CSLibExt/Computability/Decidability/StringRewriting.lean:132
abbrev star : Sym α := some none
CSLibExt/Computability/Decidability/PCP.lean:116
abbrev endMark : Sym α := none
CSLibExt/Computability/Decidability/PCP.lean:119
Uses 5 · Used by 5
DefinitionThe separator domino#✓fully proved
Over the extended alphabet, that is, an alphabet \(\alpha\) together with a star \(\star\) and an end marker \(\diamond\), the separator domino has top and bottom both equal to the one-letter word \(\star\); the star separates the rows of a derivation.
def sepCard : Domino (Sym α) := ([star], [star])
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
abbrev Sym (α : Type*) := Option (Option α)
CSLibExt/Computability/Decidability/PCP.lean:110
abbrev star : Sym α := some none
CSLibExt/Computability/Decidability/PCP.lean:116
Uses 3 · Used by 5
DefinitionThe domino of a rewriting rule#✓fully proved
For a rule \((l, r)\) over an alphabet \(\alpha\), the domino of the rule has top \(l\) and bottom \(r\), read as words over the extended alphabet, that is, \(\alpha\) together with a star and an end marker.
def ruleCard (r : Rule α) : Domino (Sym α) := (lift r.1, lift r.2)
abbrev Rule (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/StringRewriting.lean:70
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
abbrev Sym (α : Type*) := Option (Option α)
CSLibExt/Computability/Decidability/PCP.lean:110
abbrev lift (u : List α) : List (Sym α) := u.map letter
CSLibExt/Computability/Decidability/StringRewriting.lean:132
Uses 4 · Used by 5
DefinitionCopy domino#✓fully proved
For a letter \(a\) of \(\alpha\), the copy domino of \(a\) is the domino over the extended alphabet whose top and bottom are both the one-letter word \(a\).
def copyCard (a : α) : Domino (Sym α) := ([letter a], [letter a])
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
abbrev Sym (α : Type*) := Option (Option α)
CSLibExt/Computability/Decidability/PCP.lean:110
abbrev letter (a : α) : Sym α := some (some a)
CSLibExt/Computability/Decidability/PCP.lean:113
Uses 3 · Used by 5
DefinitionLetters of a rewriting instance#✓fully proved
For an instance \((R, x, y)\) of the reachability problem, where \(R = [(l_1, r_1), \dots, (l_k, r_k)]\) is a list of rewriting rules and \(x\), \(y\) are words, the letters of the instance form the word \(l_1 r_1 l_2 r_2 \cdots l_k r_k \, x \, y\), a list in which a letter may occur several times.
def symbols (I : List (Rule α) × List α × List α) : List α :=
I.1.flatMap (fun r ↦ r.1 ++ r.2) ++ I.2.1 ++ I.2.2
abbrev Rule (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/StringRewriting.lean:70
Uses 1 · Used by 6
DefinitionThe MPCP instance of a reachability instance#✓fully proved
Let \((R, x, y)\) be an instance of the reachability problem over an alphabet \(\alpha\), where \(R = [(l_1, r_1), \dots, (l_k, r_k)]\), and write \(\#\) for the separator and \(\diamond\) for the end marker of the extended alphabet \(\mathrm{Sym}(\alpha)\), in which letters of \(\alpha\) are read as letters. Let \(a_1 \cdots a_m\) be the word \(l_1 r_1 l_2 r_2 \cdots l_k r_k \, x \, y\), the letters of the instance. The MPCP instance of \((R, x, y)\) is the list of dominoes (top word, bottom word) \((\diamond, \diamond x \#), (y \# \diamond, \diamond), (\#, \#), (l_1, r_1), \dots, (l_k, r_k), (a_1, a_1), \dots, (a_m, a_m)\), in this order. Its first domino is \((\diamond, \diamond x \#)\).
def toMPCP (I : List (Rule α) × List α × List α) : List (Domino (Sym α)) :=
startCard I.2.1 :: finalCard I.2.2 :: sepCard :: (I.1.map ruleCard ++ (symbols I).map copyCard)
abbrev Rule (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/StringRewriting.lean:70
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
abbrev Sym (α : Type*) := Option (Option α)
CSLibExt/Computability/Decidability/PCP.lean:110
def startCard (x : List α) : Domino (Sym α) := ([endMark], endMark :: lift x ++ [star])
CSLibExt/Computability/Decidability/StringRewriting.lean:135
def finalCard (y : List α) : Domino (Sym α) := (lift y ++ [star, endMark], [endMark])
CSLibExt/Computability/Decidability/StringRewriting.lean:138
def sepCard : Domino (Sym α) := ([star], [star])
CSLibExt/Computability/Decidability/StringRewriting.lean:141
def ruleCard (r : Rule α) : Domino (Sym α) := (lift r.1, lift r.2)
CSLibExt/Computability/Decidability/StringRewriting.lean:144
def symbols (I : List (Rule α) × List α × List α) : List α :=
I.1.flatMap (fun r ↦ r.1 ++ r.2) ++ I.2.1 ++ I.2.2
CSLibExt/Computability/Decidability/StringRewriting.lean:150
def copyCard (a : α) : Domino (Sym α) := ([letter a], [letter a])
CSLibExt/Computability/Decidability/StringRewriting.lean:147
Uses 9 · Used by 5
Comparing words of letters with separators
TheoremLetters differ from the star#✓fully proved
For every letter \(a\) of the alphabet \(\alpha\), the symbol \(a\) of the extended alphabet of the MPCP-to-PCP reduction is different from the star \(\star\).
theorem letter_ne_star (a : α) : letter a ≠ star
abbrev letter (a : α) : Sym α := some (some a)
CSLibExt/Computability/Decidability/PCP.lean:113
abbrev star : Sym α := some none
CSLibExt/Computability/Decidability/PCP.lean:116
Uses 3 · Used by 2
TheoremComparing words of letters before a separator#✓fully proved
Let \(u, v\) be words over \(\alpha\), read as words of letters, and let \(X, Y\) be words over the extended alphabet of \(\alpha\). If \(u X = v \star Y\), where \(\star\) is the row separator, then there is a word \(w\) over \(\alpha\) with \(v = u w\) and \(X = w \star Y\).
theorem exists_of_lift_append_eq {u v : List α} {X Y : List (Sym α)}
(h : lift u ++ X = lift v ++ star :: Y) : ∃ w, v = u ++ w ∧ X = lift w ++ star :: Y
abbrev Sym (α : Type*) := Option (Option α)
CSLibExt/Computability/Decidability/PCP.lean:110
abbrev lift (u : List α) : List (Sym α) := u.map letter
CSLibExt/Computability/Decidability/StringRewriting.lean:132
abbrev star : Sym α := some none
CSLibExt/Computability/Decidability/PCP.lean:116
Uses 5 · Used by 1
From solutions to derivations
TheoremThe backward direction of the MPCP reduction#✓fully proved
Let \((R, x, y)\) be a reachability instance and read words over \(\alpha\) as words of letters. Let \(A\) be a sequence of dominoes of the MPCP instance of \((R, x, y)\). For all words \(v, s, t\) over \(\alpha\), if \(s\) rewrites to \(t\) under \(R\) in zero or more steps and the top of \(A\) equals \(v \star t\) followed by the bottom of \(A\), where \(\star\) is the row separator, then \(s v\) rewrites to \(y\) under \(R\) in zero or more steps.
Reading the dominoes left to right, \(s\) is the part of the current row already matched, with bottoms \(t\), and \(v\) is the rest of the row still to be matched on top.
theorem derives_of_top_eq : ∀ (A : List (Domino (Sym α))), (∀ c ∈ A, c ∈ toMPCP I) →
∀ (v s t : List α), Derives I.1 s t → top A = lift v ++ star :: (lift t ++ bottom A) →
Derives I.1 (s ++ v) I.2.2
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
abbrev Sym (α : Type*) := Option (Option α)
CSLibExt/Computability/Decidability/PCP.lean:110
def toMPCP (I : List (Rule α) × List α × List α) : List (Domino (Sym α)) :=
startCard I.2.1 :: finalCard I.2.2 :: sepCard :: (I.1.map ruleCard ++ (symbols I).map copyCard)
CSLibExt/Computability/Decidability/StringRewriting.lean:154
def Derives (R : List (Rule α)) : List α → List α → Prop := Relation.ReflTransGen (Step R)
CSLibExt/Computability/Decidability/StringRewriting.lean:78
def top (s : List (Domino α)) : List α := s.flatMap Prod.fst
CSLibExt/Computability/Decidability/PCP.lean:68
abbrev lift (u : List α) : List (Sym α) := u.map letter
CSLibExt/Computability/Decidability/StringRewriting.lean:132
abbrev star : Sym α := some none
CSLibExt/Computability/Decidability/PCP.lean:116
def bottom (s : List (Domino α)) : List α := s.flatMap Prod.snd
CSLibExt/Computability/Decidability/PCP.lean:71
Uses 20 · Used by 1
From derivations to solutions
TheoremRewriting steps keep the letters of the instance#✓fully proved
Let \((R, x, y)\) be an instance of the reachability problem over an alphabet \(\alpha\). If a word \(w\) rewrites to a word \(w'\) in one step of \(R\) and every letter of \(w\) is among the letters of the instance, then every letter of \(w'\) is among the letters of the instance.
theorem mem_symbols_of_step {w w' : List α} (h : Step I.1 w w')
(hw : ∀ a ∈ w, a ∈ symbols I) : ∀ a ∈ w', a ∈ symbols I
inductive Step (R : List (Rule α)) : List α → List α → Prop
| mk {l r : List α} (u v : List α) : (l, r) ∈ R → Step R (u ++ l ++ v) (u ++ r ++ v)
CSLibExt/Computability/Decidability/StringRewriting.lean:74
def symbols (I : List (Rule α) × List α × List α) : List α :=
I.1.flatMap (fun r ↦ r.1 ++ r.2) ++ I.2.1 ++ I.2.2
CSLibExt/Computability/Decidability/StringRewriting.lean:150
Uses 3 · Used by 1
TheoremThe forward direction of the MPCP reduction#✓fully proved
Let \((R, x, y)\) be a reachability instance and read words over \(\alpha\) as words of letters. If a word \(w\) over \(\alpha\) rewrites to \(y\) under \(R\) in zero or more steps and every letter of \(w\) occurs in a rule of \(R\), in \(x\) or in \(y\), then there is a sequence \(A\) of dominoes of the MPCP instance of \((R, x, y)\) whose top is \(w \star\) followed by the bottom of \(A\), where \(\star\) is the row separator.
theorem exists_cards_of_derives {w : List α} (h : Derives I.1 w I.2.2) :
(∀ a ∈ w, a ∈ symbols I) → ∃ A : List (Domino (Sym α)), (∀ c ∈ A, c ∈ toMPCP I) ∧
top A = lift w ++ star :: bottom A
def Derives (R : List (Rule α)) : List α → List α → Prop := Relation.ReflTransGen (Step R)
CSLibExt/Computability/Decidability/StringRewriting.lean:78
def symbols (I : List (Rule α) × List α × List α) : List α :=
I.1.flatMap (fun r ↦ r.1 ++ r.2) ++ I.2.1 ++ I.2.2
CSLibExt/Computability/Decidability/StringRewriting.lean:150
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
abbrev Sym (α : Type*) := Option (Option α)
CSLibExt/Computability/Decidability/PCP.lean:110
def toMPCP (I : List (Rule α) × List α × List α) : List (Domino (Sym α)) :=
startCard I.2.1 :: finalCard I.2.2 :: sepCard :: (I.1.map ruleCard ++ (symbols I).map copyCard)
CSLibExt/Computability/Decidability/StringRewriting.lean:154
def top (s : List (Domino α)) : List α := s.flatMap Prod.fst
CSLibExt/Computability/Decidability/PCP.lean:68
abbrev lift (u : List α) : List (Sym α) := u.map letter
CSLibExt/Computability/Decidability/StringRewriting.lean:132
abbrev star : Sym α := some none
CSLibExt/Computability/Decidability/PCP.lean:116
def bottom (s : List (Domino α)) : List α := s.flatMap Prod.snd
CSLibExt/Computability/Decidability/PCP.lean:71
Uses 19 · Used by 1
TheoremReachability reduces to MPCP#✓fully proved
For an instance \((R, x, y)\) of the reachability problem, \(x\) rewrites to \(y\) in zero or more steps of \(R\) if and only if the MPCP instance of \((R, x, y)\) has an MPCP solution, that is, a solution that starts with its first domino.
theorem sr_iff_mpcp_toMPCP : SR I ↔ MPCP (toMPCP I)
def SR (I : List (Rule α) × List α × List α) : Prop := Derives I.1 I.2.1 I.2.2
CSLibExt/Computability/Decidability/StringRewriting.lean:82
def MPCP (P : List (Domino α)) : Prop :=
∃ d₀ s, P.head? = some d₀ ∧ IsSolution P (d₀ :: s)
CSLibExt/Computability/Decidability/PCP.lean:82
def toMPCP (I : List (Rule α) × List α × List α) : List (Domino (Sym α)) :=
startCard I.2.1 :: finalCard I.2.2 :: sepCard :: (I.1.map ruleCard ++ (symbols I).map copyCard)
CSLibExt/Computability/Decidability/StringRewriting.lean:154
Uses 23 · Used by 1
The many-one reduction
DefinitionThe total reduction of reachability with nonempty sides to MPCP#✓fully proved
On an instance \((R, x, y)\) of the reachability problem, the reduction returns the MPCP instance of \((R, x, y)\) when every rule of \(R\) has a nonempty left side and a nonempty right side, and otherwise the empty list of dominoes, which has no solution.
def reduce (I : List (Rule α) × List α × List α) : List (Domino (Sym α)) :=
cond (nonemptyWordsB I.1) (toMPCP I) []
abbrev Rule (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/StringRewriting.lean:70
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
abbrev Sym (α : Type*) := Option (Option α)
CSLibExt/Computability/Decidability/PCP.lean:110
def nonemptyWordsB (P : List (Domino α)) : Bool := P.all fun d ↦ !d.1.isEmpty && !d.2.isEmpty
CSLibExt/Computability/Decidability/PCP.lean:312
def toMPCP (I : List (Rule α) × List α × List α) : List (Domino (Sym α)) :=
startCard I.2.1 :: finalCard I.2.2 :: sepCard :: (I.1.map ruleCard ++ (symbols I).map copyCard)
CSLibExt/Computability/Decidability/StringRewriting.lean:154
Uses 5 · Used by 1
TheoremReachability with nonempty sides many-one reduces to MPCP with nonempty words#✓fully proved
Let \(\alpha\) be an alphabet with a primitive recursive coding, and let \(\alpha'\) be \(\alpha\) extended with two new symbols, the star and the end marker. There is a computable function \(f\) from instances \((R, x, y)\) of the reachability problem over \(\alpha\), where \(R\) is a list of rewriting rules over \(\alpha\) and \(x\) and \(y\) are words over \(\alpha\), to finite lists of dominoes over \(\alpha'\) such that, for every such instance, the following are equivalent: every rule of \(R\) has a nonempty left side and a nonempty right side and \(x\) rewrites to \(y\) in zero or more steps of \(R\); and every domino of \(f(R, x, y)\) has a nonempty top word and a nonempty bottom word and \(f(R, x, y)\) has an MPCP solution.
theorem manyOneReducible_sr_mpcp :
ManyOneReducible (fun I : List (Rule α) × List α × List α ↦ NonemptyRules I.1 ∧ SR I)
(fun P : List (Domino (Sym α)) ↦ NonemptyWords P ∧ MPCP P)
abbrev Rule (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/StringRewriting.lean:70
def NonemptyRules (R : List (Rule α)) : Prop := ∀ r ∈ R, r.1 ≠ [] ∧ r.2 ≠ []
CSLibExt/Computability/Decidability/StringRewriting.lean:85
def SR (I : List (Rule α) × List α × List α) : Prop := Derives I.1 I.2.1 I.2.2
CSLibExt/Computability/Decidability/StringRewriting.lean:82
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
abbrev Sym (α : Type*) := Option (Option α)
CSLibExt/Computability/Decidability/PCP.lean:110
def NonemptyWords (P : List (Domino α)) : Prop := ∀ d ∈ P, d.1 ≠ [] ∧ d.2 ≠ []
CSLibExt/Computability/Decidability/PCP.lean:86
def MPCP (P : List (Domino α)) : Prop :=
∃ d₀ s, P.head? = some d₀ ∧ IsSolution P (d₀ :: s)
CSLibExt/Computability/Decidability/PCP.lean:82
Uses 23 · Used by 2
TheoremReachability for rules with nonempty sides many-one reduces to PCP#✓fully proved
Let \(\alpha\) be an alphabet with a primitive recursive coding, let \(\alpha'\) be \(\alpha\) extended with two new symbols, the star and the end marker, and let \(\alpha''\) be \(\alpha'\) extended in the same way by two further new symbols. There is a computable function \(f\) from instances \((R, x, y)\) of the reachability problem over \(\alpha\), where \(R\) is a list of rewriting rules over \(\alpha\) and \(x\) and \(y\) are words over \(\alpha\), to finite lists of dominoes over \(\alpha''\) such that, for every such instance, \(f(R, x, y)\) has a PCP solution if and only if every rule of \(R\) has a nonempty left side and a nonempty right side and \(x\) rewrites to \(y\) in zero or more steps of \(R\).
theorem manyOneReducible_sr_pcp :
ManyOneReducible (fun I : List (Rule α) × List α × List α ↦ NonemptyRules I.1 ∧ SR I)
(PCP (α := Sym (Sym α)))
abbrev Rule (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/StringRewriting.lean:70
def NonemptyRules (R : List (Rule α)) : Prop := ∀ r ∈ R, r.1 ≠ [] ∧ r.2 ≠ []
CSLibExt/Computability/Decidability/StringRewriting.lean:85
def SR (I : List (Rule α) × List α × List α) : Prop := Derives I.1 I.2.1 I.2.2
CSLibExt/Computability/Decidability/StringRewriting.lean:82
def PCP (P : List (Domino α)) : Prop := ∃ s, IsSolution P s
CSLibExt/Computability/Decidability/PCP.lean:79
abbrev Sym (α : Type*) := Option (Option α)
CSLibExt/Computability/Decidability/PCP.lean:110
Uses 10 · Used by 1
Thue systems
DefinitionThe word problem of a Thue system#✓fully proved
On an instance \((R, x, y)\), where \(R\) is a list of rewriting rules and \(x\), \(y\) are words, the word problem asks whether \(x\) and \(y\) are related by the equivalence relation generated by the one-step rewriting relation of \(R\), that is, by its reflexive, symmetric and transitive closure.
def ThueWP (I : List (Rule α) × List α × List α) : Prop := EqvGen (Step I.1) I.2.1 I.2.2
abbrev Rule (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/StringRewriting.lean:70
inductive Step (R : List (Rule α)) : List α → List α → Prop
| mk {l r : List α} (u v : List α) : (l, r) ∈ R → Step R (u ++ l ++ v) (u ++ r ++ v)
CSLibExt/Computability/Decidability/StringRewriting.lean:74
Uses 2 · Used by 1
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.