PCP characterization of a string-constraint family
AbbreviationAlphabet for the PCP encoding#✓fully proved
The alphabet for the PCP encoding: dominoes (as index letters) and plain letters.
abbrev BlockSym (α : Type*) := Post.Domino α ⊕ α
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
Uses 1 · Used by 12
AbbreviationDomino as an index letter#✓fully proved
A domino as an index letter.
abbrev dominoLetter (d : Post.Domino α) : BlockSym α := Sum.inl d
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
abbrev BlockSym (α : Type*) := Post.Domino α ⊕ α
CSLibExt/AutomatedReasoning/StringConstraints/PCPCharacterization.lean:87
Uses 2 · Used by 1
DefinitionTop morphism of the PCP encoding#✓fully proved
The top morphism: a domino letter maps to its top word as plain
letters; plain letters map to [] (they never occur in an index word).
DefinitionBottom morphism of the PCP encoding#✓fully proved
The bottom morphism.
DefinitionRegular language of domino index words#✓fully proved
The regular language of index words: concatenations of domino letters.
def dominoRegex (P : List (Post.Domino α)) : RegularExpression (BlockSym α) :=
RegularExpression.star ((P.map fun d => RegularExpression.char (Sum.inl d)).sum)
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
abbrev BlockSym (α : Type*) := Post.Domino α ⊕ α
CSLibExt/AutomatedReasoning/StringConstraints/PCPCharacterization.lean:87
Uses 2 · Used by 4
DefinitionPCP encoding as a one-variable string constraint#✓fully proved
The PCP encoding as a string constraint over one variable.
def pcpConstraint (P : List (Post.Domino α)) : Formula (BlockSym α) (Fin 1) :=
Formula.and
(Formula.atom (Atom.mem (Term.var 0) (EncodedRegex.flatten (dominoRegex P))))
(Formula.and
(Formula.atom (Atom.eq (Term.hom topFun (Term.var 0))
(Term.hom botFun (Term.var 0))))
(Formula.atom (Atom.lenGe (Term.var 0) 1)))
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
inductive Formula (α : Type*) (V : Type*) where
| atom : Atom α V → Formula α V
| and : Formula α V → Formula α V → Formula α V
| or : Formula α V → Formula α V → Formula α V
| true : Formula α V
| false : Formula α V
CSLibExt/AutomatedReasoning/StringConstraints/Syntax.lean:150
abbrev BlockSym (α : Type*) := Post.Domino α ⊕ α
CSLibExt/AutomatedReasoning/StringConstraints/PCPCharacterization.lean:87
inductive Atom (α : Type*) (V : Type*) where
| eq : Term α V → Term α V → Atom α V
| mem : Term α V → EncodedRegex α → Atom α V
| lenLe : Term α V → ℕ → Atom α V
| lenGe : Term α V → ℕ → Atom α V
CSLibExt/AutomatedReasoning/StringConstraints/Syntax.lean:134
inductive Term (α : Type*) (V : Type*) where
| const : List α → Term α V
| var : V → Term α V
| append : Term α V → Term α V → Term α V
| hom : (α → List α) → Term α V → Term α V
CSLibExt/AutomatedReasoning/StringConstraints/Syntax.lean:74
def flatten (r : RegularExpression α) : EncodedRegex α :=
⟨flattenAux r []⟩
CSLibExt/Computability/Decidability/RegularExpression.lean:173
def dominoRegex (P : List (Post.Domino α)) : RegularExpression (BlockSym α) :=
RegularExpression.star ((P.map fun d => RegularExpression.char (Sum.inl d)).sum)
CSLibExt/AutomatedReasoning/StringConstraints/PCPCharacterization.lean:105
def topFun : BlockSym α → List (BlockSym α)
| Sum.inl d => d.1.map Sum.inr
| Sum.inr _ => []
CSLibExt/AutomatedReasoning/StringConstraints/PCPCharacterization.lean:94
def botFun : BlockSym α → List (BlockSym α)
| Sum.inl d => d.2.map Sum.inr
| Sum.inr _ => []
CSLibExt/AutomatedReasoning/StringConstraints/PCPCharacterization.lean:99
Uses 10 · Used by 1
DefinitionDomino named by a one-letter block#✓fully proved
The domino named by a one-letter block; junk ([], []) otherwise.
def blockDomino (b : List (BlockSym α)) : Post.Domino α :=
match b with
| [Sum.inl d] => d
| _ => ([], [])
abbrev BlockSym (α : Type*) := Post.Domino α ⊕ α
CSLibExt/AutomatedReasoning/StringConstraints/PCPCharacterization.lean:87
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
Uses 2 · Used by 1
TheoremMembership in a sum of regular expressions#✓fully proved
Membership in a sum of regular expressions.
theorem mem_sum_matches {rs : List (RegularExpression α)} {w : List α} :
w ∈ (rs.sum).matches' ↔ ∃ r ∈ rs, w ∈ r.matches'
Used by 1
TheoremMembership in the domino index-word language#✓fully proved
Membership in the index-word language: the word is a concatenation of domino letters.
theorem mem_dominoRegex {P : List (Post.Domino α)} {w : List (BlockSym α)} :
w ∈ (dominoRegex P).matches' ↔
∃ bs : List (List (BlockSym α)), w = bs.flatten ∧
∀ b ∈ bs, ∃ d ∈ P, b = [Sum.inl d]
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
abbrev BlockSym (α : Type*) := Post.Domino α ⊕ α
CSLibExt/AutomatedReasoning/StringConstraints/PCPCharacterization.lean:87
def dominoRegex (P : List (Post.Domino α)) : RegularExpression (BlockSym α) :=
RegularExpression.star ((P.map fun d => RegularExpression.char (Sum.inl d)).sum)
CSLibExt/AutomatedReasoning/StringConstraints/PCPCharacterization.lean:105
Uses 4 · Used by 1
TheoremMembership atom of the PCP encoding checks index words#✓fully proved
The membership atom of the encoding checks index-word membership.
theorem sat_mem_dominoRegex {σ : Fin 1 → List (BlockSym α)}
{P : List (Post.Domino α)} :
SatAtom σ (Atom.mem (Term.var 0) (EncodedRegex.flatten (dominoRegex P))) ↔
σ 0 ∈ (dominoRegex P).matches'
abbrev BlockSym (α : Type*) := Post.Domino α ⊕ α
CSLibExt/AutomatedReasoning/StringConstraints/PCPCharacterization.lean:87
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
def SatAtom (σ : V → List α) : Atom α V → Prop
| .eq t₁ t₂ => eval σ t₁ = eval σ t₂
| .mem t e => eval σ t ∈ e.toRegex.matches'
| .lenLe t k => (eval σ t).length ≤ k
| .lenGe t k => k ≤ (eval σ t).length
CSLibExt/AutomatedReasoning/StringConstraints/Syntax.lean:176
inductive Atom (α : Type*) (V : Type*) where
| eq : Term α V → Term α V → Atom α V
| mem : Term α V → EncodedRegex α → Atom α V
| lenLe : Term α V → ℕ → Atom α V
| lenGe : Term α V → ℕ → Atom α V
CSLibExt/AutomatedReasoning/StringConstraints/Syntax.lean:134
inductive Term (α : Type*) (V : Type*) where
| const : List α → Term α V
| var : V → Term α V
| append : Term α V → Term α V → Term α V
| hom : (α → List α) → Term α V → Term α V
CSLibExt/AutomatedReasoning/StringConstraints/Syntax.lean:74
def flatten (r : RegularExpression α) : EncodedRegex α :=
⟨flattenAux r []⟩
CSLibExt/Computability/Decidability/RegularExpression.lean:173
def dominoRegex (P : List (Post.Domino α)) : RegularExpression (BlockSym α) :=
RegularExpression.star ((P.map fun d => RegularExpression.char (Sum.inl d)).sum)
CSLibExt/AutomatedReasoning/StringConstraints/PCPCharacterization.lean:105
TheoremTop morphism applied to an index word#✓fully proved
The top morphism applied to an index word.
theorem flatMap_topFun {w : List (BlockSym α)} {s : List (Post.Domino α)}
(hw : w = s.map Sum.inl) : w.flatMap topFun = (Post.top s).map Sum.inr
abbrev BlockSym (α : Type*) := Post.Domino α ⊕ α
CSLibExt/AutomatedReasoning/StringConstraints/PCPCharacterization.lean:87
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
def topFun : BlockSym α → List (BlockSym α)
| Sum.inl d => d.1.map Sum.inr
| Sum.inr _ => []
CSLibExt/AutomatedReasoning/StringConstraints/PCPCharacterization.lean:94
def top (s : List (Domino α)) : List α := s.flatMap Prod.fst
CSLibExt/Computability/Decidability/PCP.lean:68
Uses 4 · Used by 1
TheoremBottom morphism applied to an index word#✓fully proved
The bottom morphism applied to an index word.
theorem flatMap_botFun {w : List (BlockSym α)} {s : List (Post.Domino α)}
(hw : w = s.map Sum.inl) : w.flatMap botFun = (Post.bottom s).map Sum.inr
abbrev BlockSym (α : Type*) := Post.Domino α ⊕ α
CSLibExt/AutomatedReasoning/StringConstraints/PCPCharacterization.lean:87
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
def botFun : BlockSym α → List (BlockSym α)
| Sum.inl d => d.2.map Sum.inr
| Sum.inr _ => []
CSLibExt/AutomatedReasoning/StringConstraints/PCPCharacterization.lean:99
def bottom (s : List (Domino α)) : List α := s.flatMap Prod.snd
CSLibExt/Computability/Decidability/PCP.lean:71
Uses 4 · Used by 1
TheoremFlattening a list of one-letter blocks#✓fully proved
Flattening a list of one-letter blocks.
theorem map_inl_flatten (s : List (Post.Domino α)) :
s.map dominoLetter = (s.map (fun d => [dominoLetter d])).flatten
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
abbrev dominoLetter (d : Post.Domino α) : BlockSym α := Sum.inl d
CSLibExt/AutomatedReasoning/StringConstraints/PCPCharacterization.lean:90
Uses 3 · Used by 1
TheoremPCP is characterized by string-constraint satisfiability:#✓fully proved
For each
PCP instance P, PCP P holds iff the encoding constraint is satisfiable.
This is a semantic characterization, not a computable reduction to a
formula-indexed satisfiability predicate (see the module header).
theorem pcp_iff_stringSat (P : List (Post.Domino α)) :
Post.PCP P ↔ ∃ σ : Fin 1 → List (BlockSym α), Sat σ (pcpConstraint P)
abbrev Domino (α : Type*) := List α × List α
CSLibExt/Computability/Decidability/PCP.lean:65
def PCP (P : List (Domino α)) : Prop := ∃ s, IsSolution P s
CSLibExt/Computability/Decidability/PCP.lean:79
abbrev BlockSym (α : Type*) := Post.Domino α ⊕ α
CSLibExt/AutomatedReasoning/StringConstraints/PCPCharacterization.lean:87
def Sat (σ : V → List α) : Formula α V → Prop
| .atom a => SatAtom σ a
| .and f g => Sat σ f ∧ Sat σ g
| .or f g => Sat σ f ∨ Sat σ g
| .true => True
| .false => False
CSLibExt/AutomatedReasoning/StringConstraints/Syntax.lean:183
def pcpConstraint (P : List (Post.Domino α)) : Formula (BlockSym α) (Fin 1) :=
Formula.and
(Formula.atom (Atom.mem (Term.var 0) (EncodedRegex.flatten (dominoRegex P))))
(Formula.and
(Formula.atom (Atom.eq (Term.hom topFun (Term.var 0))
(Term.hom botFun (Term.var 0))))
(Formula.atom (Atom.lenGe (Term.var 0) 1)))
CSLibExt/AutomatedReasoning/StringConstraints/PCPCharacterization.lean:109
Uses 24
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.