Ordinary word equations

DefinitionEmbedding of ordinary words into string terms#✓fully proved

Embed an ordinary word in the larger string-constraint term language.

def wordTerm : List (α ⊕ V) → Term α V
  | [] => .const []
  | Sum.inl a :: w => .append (.const [a]) (wordTerm w)
  | Sum.inr i :: w => .append (.var i) (wordTerm w)
Uses 1 · Used by 3

TheoremWord embedding preserves substitution semantics#✓fully proved

The embedding preserves substitution semantics.

@[simp] theorem eval_wordTerm (σ : V → List α) (w : List (α ⊕ V)) :
    eval σ (wordTerm w) = evalWord σ w
Uses 3 · Used by 1

DefinitionSolution of a word equation#✓fully proved

A substitution solves a word equation when the substituted sides agree.

def WordEq.Satisfies (σ : V → List α) (e : WordEq α V) : Prop :=
  evalWord σ e.lhs = evalWord σ e.rhs
Uses 2 · Used by 12

DefinitionWord equation as a string-constraint formula#✓fully proved

View an ordinary word equation as a string-constraint formula.

def WordEq.toFormula (e : WordEq α V) : Formula α V :=
  .atom (.eq (wordTerm e.lhs) (wordTerm e.rhs))
Uses 5 · Used by 2

TheoremFormula embedding of word equations preserves satisfaction#✓fully proved

The formula embedding preserves satisfaction.

@[simp] theorem WordEq.sat_toFormula (σ : V → List α) (e : WordEq α V) :
    Sat σ e.toFormula ↔ e.Satisfies σ
Uses 12 · Used by 1

TheoremWord evaluation depends only on occurring variables#✓fully proved

Evaluation depends only on variables that occur in the word.

theorem evalWord_eq_of_agree_on_vars {σ τ : V → List α} {w : List (α ⊕ V)}
    (h : ∀ i, Sum.inr i ∈ w → σ i = τ i) : evalWord σ w = evalWord τ w
Uses 1 · Used by 1

TheoremOccurring variable's image is no longer than the evaluated word#✓fully proved

Each occurring variable contributes a contiguous block, so its length cannot exceed the length of the evaluated word, even when substitutions may be empty.

theorem length_le_evalWord_of_mem (σ : V → List α) {w : List (α ⊕ V)} {i : V}
    (hi : Sum.inr i ∈ w) : (σ i).length ≤ (evalWord σ w).length
Uses 1 · Used by 1

DefinitionWord substitution normalized by emptying unused images#✓fully proved

Retain the images of occurring variables and replace every unused image by []. Only equality of variables, not equality of alphabet symbols, is needed.

def normalizeWordSubst [DecidableEq V] (σ : V → List α) (w : List (α ⊕ V)) :
    V → List α :=
  fun i => if i ∈ w.filterMap (Sum.elim (fun _ => none) some) then σ i else []
Used by 5

TheoremNormalization keeps images of occurring variables#✓fully proved

Normalization preserves the image of every occurring variable.

theorem normalizeWordSubst_of_mem [DecidableEq V] (σ : V → List α)
    {w : List (α ⊕ V)} {i : V} (hi : Sum.inr i ∈ w) :
    normalizeWordSubst σ w i = σ i
Uses 1 · Used by 1

TheoremNormalization empties images of absent variables#✓fully proved

Every variable absent from the word has empty normalized image.

theorem normalizeWordSubst_of_not_mem [DecidableEq V] (σ : V → List α)
    {w : List (α ⊕ V)} {i : V} (hi : Sum.inr i ∉ w) :
    normalizeWordSubst σ w i = []
Uses 1

TheoremNormalization does not change the evaluated word#✓fully proved

Removing unused images does not change the evaluated word.

@[simp] theorem evalWord_normalizeWordSubst [DecidableEq V] (σ : V → List α)
    (w : List (α ⊕ V)) : evalWord (normalizeWordSubst σ w) w = evalWord σ w
Uses 4 · Used by 1

TheoremNormalized images are bounded by the evaluation length#✓fully proved

After normalization, every variable image, including unused ones, is bounded by the length of the original evaluation.

theorem length_normalizeWordSubst_le [DecidableEq V] (σ : V → List α)
    (w : List (α ⊕ V)) (i : V) :
    (normalizeWordSubst σ w i).length ≤ (evalWord σ w).length
Uses 3 · Used by 1

TheoremBounding variable images by the target loses no pattern matches#✓fully proved

Matching a pattern against a fixed target loses no solutions by bounding ALL variable images by the target length. Unused variables are normalized to []; an arbitrary unnormalized solution need not obey this bound.

theorem patternMatch_iff_bounded {n : ℕ} (w : List (α ⊕ Fin n)) (target : List α) :
    (∃ σ : Fin n → List α, evalWord σ w = target) ↔
      ∃ σ : Fin n → List α, (∀ i, (σ i).length ≤ target.length) ∧
        evalWord σ w = target
Uses 4 · Used by 1

DefinitionExecutable satisfaction test for ground word equations#✓fully proved

Executable satisfaction test for a ground equation. Since the variable type is Empty, no substitution search is required.

def WordEq.groundSatB [DecidableEq α] (e : WordEq α Empty) : Bool :=
  decide (evalWord Empty.elim e.lhs = evalWord Empty.elim e.rhs)
Uses 2 · Used by 2

TheoremGround test agrees with satisfaction under any substitution#✓fully proved

The ground test agrees with satisfaction under any substitution.

theorem WordEq.groundSatB_eq_true_iff [DecidableEq α] (e : WordEq α Empty)
    (σ : Empty → List α) : e.groundSatB = true ↔ e.Satisfies σ
Uses 4 · Used by 1

TheoremGround test decides solvability of ground word equations#✓fully proved

The executable ground test decides existence of a solution, not just satisfaction of one guessed substitution.

theorem WordEq.groundSatB_iff [DecidableEq α] (e : WordEq α Empty) :
    e.groundSatB = true ↔ ∃ σ : Empty → List α, e.Satisfies σ
Uses 4

TheoremSolvability of word equation systems at a finite length bound#✓fully proved

A system over finitely many variables has a solution iff one substitution solves every equation at some finite global length bound. The witness bound is obtained from the solution; this supplies no terminating general UNSAT test.

theorem wordSystem_satisfiable_iff_exists_bound {n : ℕ} (es : List (WordEq α (Fin n))) :
    (∃ σ : Fin n → List α, ∀ e ∈ es, e.Satisfies σ) ↔
      ∃ B : ℕ, ∃ σ : Fin n → List α, (∀ i, (σ i).length ≤ B) ∧
        ∀ e ∈ es, e.Satisfies σ
Uses 2 · Used by 2

TheoremSatisfiability of a single word equation at a finite length bound#✓fully proved

An equation over Fin n is satisfiable iff it is satisfiable at some finite global length bound. There is no equation-computable bound claimed.

theorem WordEq.satisfiable_iff_exists_bound {n : ℕ} (e : WordEq α (Fin n)) :
    (∃ σ : Fin n → List α, e.Satisfies σ) ↔
      ∃ B : ℕ, ∃ σ : Fin n → List α, (∀ i, (σ i).length ≤ B) ∧ e.Satisfies σ
Uses 3
20 fully proved

The dependency explorer needs JavaScript and its graph data.

Download the complete graph data.