正規語言相關文章參考資料為陳穎平教授上課講義

L3 The Church-Turing Thesis

Turing Machines

圖靈機的想法: Finite control + unlimited and unrestricted memory.

  1. 在磁帶上面讀 & 寫
  2. 可以將讀取頭向左/右移動
  3. 磁帶是無限長的
  4. 可以立刻決定拒絕 (Reject) 或接受 (Accept)

Formal Definition of A Turing Machine

Definition

A Turing machine is a 7-tuple (Q,Σ,Γ,δ,q0,qaccept,qreject)(Q, Σ, Γ, δ, q_0, q_{accept}, q_{reject}), where Q,Σ,ΓQ, Σ, Γ are all finite sets and

  1. QQ is the set of states;
  2. ΣΣ is the input alphabet not containing the blank symbol ;
  3. ΓΓ is the tape alphabet, where Γ⊔ ∈ Γ and ΣΓΣ ⊆ Γ;
    • ΣΓΣ ⊆ Γ 是因為需要把 input string 放到磁帶上
    • 代表空的位置
  4. δδ : Q×ΓQ×Γ×{L,R}Q × Γ → Q × Γ × \{ L, R \} is the transition function;
    • {L,R}\{ L, R \} 用於控制磁帶頭左/右移
  5. q0Qq_0 ∈ Q is the start state;
  6. qacceptQq_{accept} ∈ Q is the accept state;
  7. qrejectQq_{reject} ∈ Q is the reject state.

A configuration of the Turing machine consists of

  • the current state;
  • the current tape contents;
  • the current head location.

and is represented as uqvuqv for a state qq, two strings uu and vv over the tape alphabet ΓΓ, and the current head at the first symbol of vv.

If the Turing machine can legally go from configuration C1C_1 to configuration C2C_2, we say that C1C_1 yields C2C_2.

Formally, if a,b,cΓa, b, c ∈ Γ, u,vΓu, v ∈ Γ^∗, and qi,qjQq_i, q_j ∈ Q, uaqibvuaqibv and uqjacvuqjacv are two configurations.

  • ua qi bvua~q_i~bv yields u qj acvu~q_j~acv if δ(qi,b)=(qj,c,L)δ(q_i, b) = (q_j, c, L).
  • ua qi bvua~q_i~bv yields uac qj vuac~q_j~v if δ(qi,b)=(qj,c,R)δ(q_i, b) = (q_j, c, R).

A Turing machine MM accepts input ww if a sequence of configurations C1,C2,...,CkC_1, C_2, ... , C_k exists, where

  1. C1C_1 is the start configuration of MM on input ww;
  2. Each CiC_i yields Ci+1C_{i+1};
  3. CkC_k is an accepting configuration.

The collection of strings that MM accepts is the language of MM, or the language recognized by MM, denoted L(M)L(M).

Definition

Call a language Turing-recognizable if some Turing machine recognizes it. (Also known as recursively enumerable language)

Definition

Call a language Turing-decidable or simply decidable if some Turing machine decides it. (Also known as recursive language)

  • recognizes: 可能會有字串不屬於 accept/reject,在圖靈機中不斷循環
  • decides: 字串一定屬於 accept/reject
  • 因此 Turing-recognizable 的範圍比 Turing-decidable

Variants of Turing Machines

Multitape Turing Machines

k-tape Turing machine:

  • δδ : Q×ΓkQ×Γk×{L,R,S}kQ × Γ^k → Q × Γ^k × \{ L, R, S \}^k .
  • k 個磁帶可以操作
  • 每個磁帶頭可以選擇向左/右或是不動
Theorem

Every multitape Turing machine has an equivalent single-tape Turing machine.

  • single-tape Turing machine 可以視為 multitape Turing machine 的特例: k=1k=1
  • 可以使用 single-tape Turing machine 來模擬 multitape Turing machine 的行為
    • #\# 符號分隔每個 tape 的資料
    • 使用 dotted tape symbols 代表該磁帶的磁帶頭所在位置
    • 每次掃過每個 tape 並記錄磁帶頭位置,透過 transition function 模擬行為,並對對應的 tape 進行操作
Corollary

A language is Turing-recognizable if and only if some multitape Turing machine recognizes it.

Nondeterministic Turing Machines

Nondeterministic - several choices at any point:

  • δδ : Q×ΓP(Q×Γ×{L,R})Q × Γ → P(Q × Γ × \{ L, R \}) .
    • transition function 改為 Power set
Theorem

Every nondeterministic Turing machine has an equivalent deterministic Turing machine.

  • deterministic Turing machine 可以視為 nondeterministic Turing machine 的特例
  • deterministic Turing machine 當作一個 queue 使用,用來儲存 nondeterministic Turing machine 的狀態
    • #\# 符號分隔每個狀態
    • 類似 BFS 遍歷 nondeterministic Turing machine 的所有可能
Corollary

A language is Turing-recognizable if and only if some nondeterministic Turing machine recognizes it.

Corollary

A language is decidable if and only if some nondeterministic Turing machine decides it.

Enumerators

枚舉器: 枚舉所有字串

Theorem

A language is Turing-recognizable if and only if some enumerator enumerates it.

The Definition of Algorithm

Hilbert’s Problems

Find an algorithm to determine whether a given polynomial Diophantine equation with integer coefficients has an integer solution.

  • 如何定義 algorithm ?
    • Church: λ-calculus;
    • Turing: Turing machines.

Terminology for Describing Turing Machines

The different levels of detail:

  • formal description: Spells out in full the Turing machine’s states, transition function, and so on;
    • 可以想像成 machine code/assembly code
  • implementation description: Describes the way that the Turing machine moves its head and the way that it stores data on its tape;
    • 可以想像成 C/Java code
  • high-level description: Describes an algorithm.
    • 可以想像成 pseudo code