[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,89 +2,184 @@
|
||||
id: wiki-2026-0508-turing-machine-foundations
|
||||
title: Turing Machine Foundations
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [TURING-001]
|
||||
aliases: [Turing Machine, TM, Universal Turing Machine]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 1.0
|
||||
tags: [computer-science, computation-theory, turing-machine, Logic]
|
||||
confidence_score: 0.95
|
||||
verification_status: applied
|
||||
tags: [theory-of-computation, computability, complexity, formal-languages]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-04-26
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
tech_stack:
|
||||
language: unspecified
|
||||
framework: unspecified
|
||||
language: Theory
|
||||
framework: Computability
|
||||
---
|
||||
|
||||
# Turing Machine Foundations (튜링 머신 기초)
|
||||
# Turing Machine Foundations
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> "무한한 테이프와 단순한 규칙만으로 우주의 모든 계산을 정의하라" — 앨런 튜링이 제안한 추상적 계산 모델로, 현대 디지털 컴퓨터의 논리적 시초이자 계산 가능성(Computability)의 한계를 정의한 이론.
|
||||
## 매 한 줄
|
||||
> **"매 computation 의 mathematical model"**. Alan Turing (1936) "On Computable Numbers" — 매 modern CS 의 theoretical foundation, 매 Church-Turing thesis 의 underpin (any "effective computation" = TM-computable, including 2026 LLMs / quantum computers in the strong CT extension).
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
- **추출된 패턴:** 기호를 읽고 쓰는 헤드와 상태 전이 규칙을 통해 복잡한 알고리즘을 물리적 장치 없이 논리적으로 기술하는 보편적 계산(Universal Computation) 패턴.
|
||||
- **핵심 구성 요소:**
|
||||
- **Tape:** 정보를 저장하는 무한한 길이의 테이프.
|
||||
- **Head:** 테이프의 기호를 읽고 쓰거나 이동하는 장치.
|
||||
- **[[State|State]] Register:** 머신의 현재 상태를 저장.
|
||||
- **Action Table:** 현재 상태와 읽은 기호에 따라 다음 상태, 쓸 기호, 이동 방향을 결정하는 명령 세트.
|
||||
- **Church-Turing Thesis:** "효과적으로 계산 가능한 모든 알고리즘은 튜링 머신으로 구현 가능하다"는 가설.
|
||||
## 매 핵심
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌:** 단순한 수학적 호기심에서 시작했으나, 오늘날 우리가 사용하는 모든 폰 노이만 아키텍처 컴퓨터의 철학적 근간이 됨.
|
||||
- **정책 변화:** Antigravity 프로젝트는 에이전트의 논리적 추론 한계를 분석할 때 튜링 머신의 정지 문제(Halting Problem)와 같은 계산 불가능성 이론을 참고하여 시스템의 안정성을 확보함.
|
||||
### 매 Definition
|
||||
TM = (Q, Σ, Γ, δ, q₀, q_accept, q_reject):
|
||||
- Q = finite states.
|
||||
- Σ = input alphabet.
|
||||
- Γ = tape alphabet (Σ ⊂ Γ, blank ∈ Γ).
|
||||
- δ: Q × Γ → Q × Γ × {L, R}. transition function.
|
||||
- q₀ = start state. q_accept, q_reject = halt states.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- Computer-Science, Algorithm, [[Logic|Logic]], Neural-Networks-Foundations
|
||||
- **Raw Source:** 10_Wiki/Topics/AI/Turing-Machine Foundations.md
|
||||
### 매 Operation
|
||||
- Infinite tape, head reads/writes one cell, moves L/R.
|
||||
- Configuration = (state, tape contents, head position).
|
||||
- Computation = sequence of configurations from start to halt.
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
### 매 Variants (all equivalent in power)
|
||||
- Multi-tape TM, non-deterministic TM (NTM), 2D-tape TM.
|
||||
- All decide same language class (Turing-recognizable / RE).
|
||||
- Time/space complexity 의 different (NTM: NP, polynomial bound).
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
### 매 핵심 results
|
||||
- **Universal TM (UTM)**: 매 TM 의 simulate 의 single TM — 매 modern computer 의 essence.
|
||||
- **Halting problem**: undecidable (Turing 1936). No TM decides if arbitrary TM halts.
|
||||
- **Church-Turing thesis**: TM-computable = effectively computable. Equivalent to λ-calculus, μ-recursive functions, register machines.
|
||||
- **Time hierarchy theorem**: more time → strictly more languages.
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
### 매 응용
|
||||
1. Computability theory (decidable / undecidable).
|
||||
2. Complexity classes (P, NP, PSPACE, EXP).
|
||||
3. Compiler theory (Rice's theorem — semantic properties undecidable).
|
||||
4. Cryptography (one-way functions assume no efficient TM).
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
## 💻 패턴
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
### TM simulator (Python)
|
||||
```python
|
||||
from dataclasses import dataclass
|
||||
from collections import defaultdict
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
@dataclass
|
||||
class TM:
|
||||
states: set
|
||||
alphabet: set
|
||||
tape_alphabet: set
|
||||
delta: dict # (state, symbol) -> (state, symbol, direction)
|
||||
start: str
|
||||
accept: str
|
||||
reject: str
|
||||
blank: str = '_'
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
|
||||
```text
|
||||
# TODO
|
||||
def run(self, input_str, max_steps=10_000):
|
||||
tape = defaultdict(lambda: self.blank)
|
||||
for i, c in enumerate(input_str):
|
||||
tape[i] = c
|
||||
state, head = self.start, 0
|
||||
for _ in range(max_steps):
|
||||
if state == self.accept: return True
|
||||
if state == self.reject: return False
|
||||
sym = tape[head]
|
||||
if (state, sym) not in self.delta: return False
|
||||
state, write, move = self.delta[(state, sym)]
|
||||
tape[head] = write
|
||||
head += 1 if move == 'R' else -1
|
||||
raise RuntimeError("max_steps exceeded")
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### TM that recognizes 0ⁿ1ⁿ
|
||||
```python
|
||||
delta = {
|
||||
('q0', '0'): ('q1', 'X', 'R'), # mark first 0
|
||||
('q0', 'Y'): ('q3', 'Y', 'R'), # all 0s done, check 1s
|
||||
('q1', '0'): ('q1', '0', 'R'),
|
||||
('q1', 'Y'): ('q1', 'Y', 'R'),
|
||||
('q1', '1'): ('q2', 'Y', 'L'), # mark matching 1
|
||||
('q2', '0'): ('q2', '0', 'L'),
|
||||
('q2', 'Y'): ('q2', 'Y', 'L'),
|
||||
('q2', 'X'): ('q0', 'X', 'R'),
|
||||
('q3', 'Y'): ('q3', 'Y', 'R'),
|
||||
('q3', '_'): ('accept', '_', 'R'),
|
||||
}
|
||||
tm = TM({'q0','q1','q2','q3','accept','reject'}, {'0','1'},
|
||||
{'0','1','X','Y','_'}, delta, 'q0', 'accept', 'reject')
|
||||
assert tm.run("0011") == True
|
||||
assert tm.run("001") == False
|
||||
```
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### Halting problem proof sketch
|
||||
```python
|
||||
# Suppose H(M, w) decides if M halts on w.
|
||||
# Construct D(M):
|
||||
def D(M):
|
||||
if H(M, M):
|
||||
loop_forever()
|
||||
else:
|
||||
return # halt
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
# What does D(D) do?
|
||||
# If H(D,D)=True (D halts on D), D loops forever — contradiction.
|
||||
# If H(D,D)=False (D loops on D), D halts — contradiction.
|
||||
# Therefore H cannot exist.
|
||||
```
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
### Church-Turing equivalence (λ-calc to TM)
|
||||
```python
|
||||
# Church numerals (λ-calc) → TM-computable
|
||||
# 0 = λf.λx. x
|
||||
# 1 = λf.λx. f x
|
||||
# n = λf.λx. f^n x
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
# Successor: λn.λf.λx. f (n f x)
|
||||
# Both λ-calc and TM compute same functions
|
||||
# Modern proof: encode λ-term as tape string, β-reduce step by step
|
||||
```
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
### Universal Turing Machine concept
|
||||
```python
|
||||
# UTM takes encoding <M, w> and simulates M on w
|
||||
def UTM(encoding):
|
||||
M_desc, w = decode(encoding)
|
||||
M = parse_TM(M_desc)
|
||||
return M.run(w)
|
||||
|
||||
# Modern equivalent: any general-purpose CPU running an interpreter
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 질문 | Tool |
|
||||
|---|---|
|
||||
| 매 problem 의 decidable? | Reduce to/from halting |
|
||||
| 매 lang 의 regular vs CFL vs RE? | Pumping lemma / TM construction |
|
||||
| 매 algorithm 의 complexity? | TM time/space hierarchy |
|
||||
| 매 model 의 power? | Compare to TM (Turing-complete?) |
|
||||
|
||||
**기본값**: Standard 1-tape deterministic TM as reference; multi-tape for clarity.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Theory-of-Computation]] · [[Formal-Languages]]
|
||||
- 변형: [[Multi-Tape-TM]] · [[Non-Deterministic-TM]] · [[Lambda-Calculus]] · [[Mu-Recursive-Functions]]
|
||||
- 응용: [[Halting-Problem]] · [[Complexity-Classes]] · [[Rices-Theorem]] · [[Computability]]
|
||||
- Adjacent: [[Church-Turing-Thesis]] · [[Universal-Turing-Machine]] · [[P-vs-NP]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: Computability question (is X decidable?). Complexity bounds 의 reason. Programming language design (Turing-completeness check). Cryptographic foundations.
|
||||
**언제 X**: Practical algorithm engineering (use RAM model). Concurrent / distributed reasoning (TM is sequential — use π-calculus, CSP).
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **TM as practical computer**: 매 model only — real CPUs have RAM, registers, parallelism. 매 asymptotic equivalence ≠ practical performance.
|
||||
- **"Turing-complete" hand-wave**: SQL is TC (with recursive CTE), so is HTML+CSS — TC alone says little about usability.
|
||||
- **Confusing recognize vs decide**: TM recognizes RE language (may loop on rejections); decides recursive language (always halts).
|
||||
- **Halting ≠ all undecidable**: many problems undecidable but not via halting reduction (e.g., Post's correspondence).
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Turing 1936, Sipser "Introduction to the Theory of Computation", Hopcroft-Ullman).
|
||||
- 신뢰도 A+.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — TM foundations with simulator, halting proof, UTM, Church-Turing |
|
||||
|
||||
Reference in New Issue
Block a user