Post's correspondence problem

Lax624099.PostCorrespondence · concepts/Lax624099/PostCorrespondence.lean · lax-624099

definition

Loading review…

Sign in with ORCID

Community review

Flags

Each flag is tied to a public ORCID identity and explains why this concept may be incorrect.

No flags have been submitted.

    Community review

    Flag this concept

    State precisely what appears incorrect. This explanation will be public under your ORCID name.

    No source line selected.

    Natural Language Statement

    Definition

    A Post correspondence system is a finite structure whose elements are dominoes, letters and positions at once: a unary relation marks the dominoes, two ternary relations give the letter of the top word and of the bottom word of a domino at a position, and a binary relation is a linear order on the positions. The top word of a domino is the sequence of its letters at the positions it uses, in the order of the positions, and likewise the bottom word. The system has a match when it is well-formed and some nonempty sequence of dominoes has the same concatenation of top words and of bottom words, the problem of Post (1946). PCP is the decision problem of the structures isomorphic to a system with a match.

    Concept map
    7 concepts; 18 descendants hidden
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A

    Lean source view on GitHub

    1import Mathlib.Data.List.Forall2
    2import Mathlib.ModelTheory.Semantics
    3import Mathlib.ModelTheory.Complexity
    4import Mathlib.Tactic.FinCases
    5import Lax904597.Classes
    6import Lax624099.Problems
    7
    8/-!
    9---
    10title: Post's correspondence problem
    11type: definition
    12---
    13A Post correspondence system is a finite structure whose elements are
    14dominoes, letters and positions at once: a unary relation marks the
    15dominoes, two ternary relations give the letter of the top word and of the
    16bottom word of a domino at a position, and a binary relation is a linear
    17order on the positions. The top word of a domino is the sequence of its
    18letters at the positions it uses, in the order of the positions, and
    19likewise the bottom word. The system has a match when it is well-formed and
    20some nonempty sequence of dominoes has the same concatenation of top words
    21and of bottom words, the problem of Post (1946). PCP is the decision problem of the structures
    22isomorphic to a system with a match.
    23-/
    24
    25namespace Lax624099.PostCorrespondence
    26
    27open FirstOrder
    28
    29open FirstOrder.Language
    30
    31/-- Relation symbols of the language of Post correspondence systems. -/
    32inductive pcpRel : ℕ → Type
    33 /-- `le x y`: the order of the positions. -/
    34 | le : pcpRel 2
    35 /-- `dom d`: the element `d` is one of the dominoes. -/
    36 | dom : pcpRel 1
    37 /-- `uAt d p c`: the top word of the domino `d` has the letter `c` at the
    38 position `p`. -/
    39 | uAt : pcpRel 3
    40 /-- `vAt d p c`: the bottom word of the domino `d` has the letter `c` at the
    41 position `p`. -/
    42 | vAt : pcpRel 3
    43 deriving DecidableEq
    44
    45/-- The relational vocabulary of Post correspondence systems: marked dominoes
    46carrying two words each, over a universe ordered by the order of the positions
    47of those words. -/
    48def pcp : Language :=
    49 ⟨fun _ => Empty, pcpRel⟩
    50
    51instance instIsRelationalPcp : IsRelational pcp :=
    52 fun _ => ⟨fun f => Empty.elim f⟩
    53
    54/-- The order symbol of the positions. -/
    55abbrev pcpLeSym : pcp.Relations 2 := .le
    56
    57/-- The symbol marking the dominoes. -/
    58abbrev pcpDomSym : pcp.Relations 1 := .dom
    59
    60/-- The symbol giving the letters of the top words. -/
    61abbrev pcpUSym : pcp.Relations 3 := .uAt
    62
    63/-- The symbol giving the letters of the bottom words. -/
    64abbrev pcpVSym : pcp.Relations 3 := .vAt
    65
    66open FirstOrder
    67
    68open Language Structure
    69
    70namespace Pcp
    71
    72section Reading
    73
    74variable {A : Type} [pcp.Structure A]
    75
    76/-- `x` precedes `y` in the order of the positions. -/
    77def Ord (x y : A) : Prop := RelMap pcpLeSym ![x, y]
    78
    79/-- `x` strictly precedes `y` in the order of the positions. -/
    80def OrdLt (x y : A) : Prop := Ord x y ∧ x ≠ y
    81
    82/-- The element `d` is one of the dominoes. -/
    83def DomG (d : A) : Prop := RelMap pcpDomSym ![d]
    84
    85/-- The top word of the domino `d` has the letter `c` at the position `p`. -/
    86def UAt (d p c : A) : Prop := RelMap pcpUSym ![d, p, c]
    87
    88/-- The bottom word of the domino `d` has the letter `c` at the position
    89`p`. -/
    90def VAt (d p c : A) : Prop := RelMap pcpVSym ![d, p, c]
    91
    92/-- The position `p` carries a letter of the top word of the domino `d`. -/
    93def UsedU (d p : A) : Prop := ∃ c, UAt d p c
    94
    95/-- The position `p` carries a letter of the bottom word of the domino `d`. -/
    96def UsedV (d p : A) : Prop := ∃ c, VAt d p c
    97
    98end Reading
    99
    100/-- **Well-formedness of a Post correspondence system**: the order symbol is a
    101linear order, and each domino carries at most one letter at each position of
    102each of its two words. -/
    103structure IsWF (A : Type) [pcp.Structure A] : Prop where
    104 /-- The order of the positions is reflexive. -/
    105 ord_refl : ∀ x : A, Ord x x
    106 /-- The order of the positions is transitive. -/
    107 ord_trans : ∀ x y z : A, Ord x y → Ord y z → Ord x z
    108 /-- The order of the positions is antisymmetric. -/
    109 ord_antisymm : ∀ x y : A, Ord x y → Ord y x → x = y
    110 /-- The order of the positions is total. -/
    111 ord_total : ∀ x y : A, Ord x y ∨ Ord y x
    112 /-- A top word has at most one letter at each position. -/
    113 uAt_fun : ∀ d p c c' : A, UAt d p c → UAt d p c' → c = c'
    114 /-- A bottom word has at most one letter at each position. -/
    115 vAt_fun : ∀ d p c c' : A, VAt d p c → VAt d p c' → c = c'
    116
    117section Words
    118
    119variable {A : Type} [pcp.Structure A]
    120
    121/-- **The top word of the domino `d` is `w`**: some strictly increasing list
    122enumerates exactly the positions used by the top word of `d`, and `w` carries
    123the letters at them. -/
    124def IsWordU (d : A) (w : List A) : Prop :=
    125 ∃ ps : List A, ps.Pairwise OrdLt ∧ (∀ p, p ∈ ps ↔ UsedU d p) ∧ List.Forall₂ (UAt d) ps w
    126
    127/-- **The bottom word of the domino `d` is `w`**, as in
    128`DescriptiveComplexity.Pcp.IsWordU`. -/
    129def IsWordV (d : A) (w : List A) : Prop :=
    130 ∃ ps : List A, ps.Pairwise OrdLt ∧ (∀ p, p ∈ ps ↔ UsedV d p) ∧ List.Forall₂ (VAt d) ps w
    131
    132end Words
    133
    134/-- **The system has a match**: the instance is well-formed and there is a
    135nonempty sequence of dominoes whose top words and whose bottom words have the
    136same concatenation. -/
    137def PcpOn (A : Type) [pcp.Structure A] : Prop :=
    138 IsWF A ∧ ∃ (l : List A) (us vs : List (List A)),
    139 l ≠ [] ∧ (∀ d ∈ l, DomG d) ∧
    140 List.Forall₂ IsWordU l us ∧ List.Forall₂ IsWordV l vs ∧ us.flatten = vs.flatten
    141
    142end Pcp
    143
    144open Lax904597.Problems Lax624099.Problems
    145
    146/-- PCP: does the Post correspondence system have a match? -/
    147def PCP : DecisionProblem pcp :=
    148 DecisionProblem.ofPred Pcp.PcpOn
    149
    150end Lax624099.PostCorrespondence
    151

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above.

    Loading discussion…