Index of theproofnetwork/open-problems@860a535/Prove2Me/Definitions/Def_QED_M112.lean
qedmarket’s copy of theproofnetwork/open-problems@860a535, 1 Dec 2026original source ↗
/-From Prove2Me, definition `QED_M112` (https://prove2.me/definitions/3cf10683-6863-5529-a736-8b459277bb6c). Apache-2.0 per Prove2Me's terms.-/import Mathlib /-! QED-M112: Word problem for one-relation monoidsTake a finite alphabet and two words u and v, and declare u = v. Two words are then equal in the monoid if you can turn one into the other by repeatedly swapping a copy of u for v, or v for u, somewhere inside the word. Magnus showed in 1932 that groups with one relation always have a solvable word problem. Is there an algorithm that, given u, v and two more words, decides whether those two words are equal in this monoid?Informal statement: For a finite alphabet $A$ and $u,v\in A^*$, let $\equiv_{u,v}$ be the smallest congruence on $A^*$ containing $(u,v)$. Does every one-relation monoid $\mathrm{Mon}\langle A\mid u=v\rangle$ have decidable word problem, i.e. is $\{(w_1,w_2): w_1\equiv_{u,v}w_2\}$ decidable for every fixed $A,u,v$? Board Claim: yes.Formalization notes:* Words are `List ℕ` (letters are natural numbers). For FIXED `u, v`, the predicate below is the word problem of `⟨ℕ | u = v⟩`. Letters not occurring in `u`, `v` are inert: no rewriting step creates, destroys or moves them, and every occurrence of `u` (also the empty word) sits inside one maximal inert-free segment. Hence `w₁ ≡ w₂` iff the two words have the same sequence of inert letters and corresponding segments are equivalent in `⟨A | u = v⟩`, `A` = letters of `u, v`. So this word problem is decidable iff that of `⟨A | u = v⟩` is (for any finite `A ⊇` letters of `u, v`: restriction gives one direction, segment splitting the other). Quantifying over all `u v : List ℕ` covers every finite alphabet up to renaming letters.* `OneStep u v x y` : `y` is obtained from `x` by replacing one occurrence of `u` by `v`. `Relation.EqvGen (OneStep u v)` is exactly the congruence generated by `(u, v)` on the free monoid (the closure is compatible with concatenation; every congruence containing `(u,v)` contains each step). Empty `u` or `v` is allowed (special monoids `⟨A | r = 1⟩`).* `Claim` (the board claim, NON-uniform): for every fixed `u, v`, the set of pairs `(w₁, w₂)` with `w₁ ≡_{u,v} w₂` is computable (Mathlib's `ComputablePred` on `List ℕ × List ℕ`). This is a genuine computability statement about each fixed set, not a classical triviality. `¬Claim` = some one-relation monoid has undecidable word problem.* `ClaimUniform` (stronger variant, for reference only): one algorithm for all `(u, v, w₁, w₂)`.-/namespace OpenProblems.QEDM112noncomputable section /-- One rewriting step with the relation `u = v`: replace one occurrence of `u` by `v`. -/def OneStep (u v : List ℕ) (x y : List ℕ) : Prop := ∃ a b : List ℕ, x = a ++ u ++ b ∧ y = a ++ v ++ b /-- `w₁ ≡ w₂` in the monoid `⟨ℕ | u = v⟩`: the congruence generated by `(u, v)`, i.e. theequivalence closure of single rewriting steps. -/def OneRelEquiv (u v w₁ w₂ : List ℕ) : Prop := Relation.EqvGen (OneStep u v) w₁ w₂ /-- Every one-relation monoid has decidable word problem. -/def Claim : Prop := ∀ u v : List ℕ, ComputablePred (fun p : List ℕ × List ℕ => OneRelEquiv u v p.1 p.2) /-- Uniform variant (stronger; not the board claim). -/def ClaimUniform : Prop := ComputablePred (fun p : List ℕ × List ℕ × List ℕ × List ℕ => OneRelEquiv p.1 p.2.1 p.2.2.1 p.2.2.2) endend OpenProblems.QEDM112