運算 理論
![](https://upload.wikimedia.org/wikipedia/commons/thumb/0/03/Turing_Machine_Model_Davey_2012.jpg/300px-Turing_Machine_Model_Davey_2012.jpg)
(1)
(2) 跟住
「 | 」 |
讀取 讀取 器 下 嗰格有 乜符號 ;編輯 嗰格-寫 一個新嘅符號落去或者刪除咗嗰格佢;將 條 帶 向 左 或 者 向 右 移 一 格 ,等 個 讀取 器 可 以讀取 打 前 嗰個格 隔 蘺嘅一 個 格 。
基本 概念
[舉個
要 解決 嘅問題 :家 吓俾一 列 正數 (輸入 )你,假設 呢個列 唔係一 個 空列 ,同 我 搵嗰列 數 入 面 最大 嗰個出 嚟。
用 嘅演算法 嘅步驟:
設 一 個 變數 ,叫 佢做「max」,並 且將佢個數 值設做「0」;將 收 到 嗰列正數 逐個逐個攞嚟同 max比 較吓;- 如果撞到
一 個 大過 max 嘅數(叫 呢個數 做「x」)嘅話,將 max 嘅數值設做 x,並 且繼續 將 max同 下 個 正數 比 較吓;(邏輯代數 )將 最後 得 出 嗰個 max 嘅數值俾出 嚟(輸出 )。max 嘅數值會係 成 列 數 入 面 最大 嗰個。
呢段
# Input:一 列 冧巴,叫 列 冧巴做「L」。
# Output:L 入 面 最大 嘅冧巴 。
def find_max (L):
max = 0 # 設 最大 值做 0。
for x in L: # 同 L 入 面 每 個 元 件 做以下 嘅嘢...
if x > max: # 如果 x 大過 最大 值...
max = x # ... 設 最大 值做 x。
return max # 做完嗮上述 嘅嘢後 ,俾返個 最大 值出嚟。
主要 子 理論
[自動 機 理論
[![](https://upload.wikimedia.org/wikipedia/commons/thumb/9/9d/DFAexample.svg/500px-DFAexample.svg.png)
可 運算 度
[例 1:While (真 ), 做...;呢種程 式 唔會停 機 -部 電腦 一行呢個程式就會一路行落去,永世 唔會停 。例 2:同 我 出 "Hello, world!";呢種程 式 會 停 機 -部 電腦 會 逐行逐行碼行咗佢,最後 停 低 。
halts(f)
,如果 f
halts(f)
halts(f)
def g(): # 定義 g
if halts(g): # 如果 halt(g) 係 真 ...
loop_forever() # 做永遠 唔停嘅 loop
呢個g()
halts(g)
g()
就會loop_forever
)嘅g()
halts(g)
g()
就唔loop_forever
)嘅
運算 複雜 度
[喺
舉個
for i : 1 to length of A
if A[i] is equal to x
return TRUE
return FALSE
n
n
喺
運算 模型
[圖 靈 機
[讀取 讀取 器 下 嗰格係 乜符號 ;編輯 嗰格-寫 一個新嘅符號落去或者刪除咗嗰格佢;將 條 帶 向 左 或 者 向 右 移 一 格 ,等 個 讀取 器 可 以讀取 打 前 嗰個格 隔 蘺嘅一 個 格 。
![](https://upload.wikimedia.org/wikipedia/commons/thumb/0/09/Turing_machine_2a.svg/540px-Turing_machine_2a.svg.png)
例 :圖 靈 機 計 加減 法
想像 以下 嘅演算法 ,條 帶 上面 有 兩 個數 值,同 ,兩個 都 用 二 進 制 表 達 ,而兩個數 之 間 同 條 帶 嘅起始 有 個 $
做標示 ,即 係 話 部 機會 讀嘅輸入 會 類似 噉嘅樣 [6]:
$0010$0011
(0010 喺二 進 制 係 2,而 0011 喺二 進 制 係 3)。
再 想像 部 圖 靈 機 跟以下 嘅演算法 行 [6]://由 x 嗰度減 1,再 加 1 落 y 嗰度,直 至 x = 0為 止 。 repeat until x == 0, then HALT { //用 T2(睇下面 ) subtract 1 from x //用 T1(睇下面 ) add 1 to y go back to the first $ }T2(
將 個數 減 1)如下:
- 攞
補充 -將 1 冚唪唥變做 0,0 冚唪唥變做 1;將 個數 加 1(睇 T1);再 做一 次 補充 。T1(
將 個數 加 1)如下:
- 如果喺個
數 嘅左邊 盡 頭 ($)起 始 ,行 去 個數 嘅右邊 盡 頭 ;由 右邊 開始 行 ,將 所有 1變 做 0,直 至 將 第 一 個 0變成 1。
例 如如果 輸入 係 $0010$0011
,部 機 行 完 一次段演算法之後,條 帶 嘅狀態 就會變成 $0000$0101
(0101 喺二 進 制 入 面 係 5)-呢一部圖靈機曉做加減數[6]。
格 自動 機
[![](https://upload.wikimedia.org/wikipedia/commons/thumb/b/b4/SpaceshipFormation.gif/270px-SpaceshipFormation.gif)
一粒 生 嘅細胞 ,如果鄰居數量 少 過 2 就會死 (孤獨 );一粒 生 嘅細胞 ,如果鄰居數量 多 過 3 就會死 (迫 死 );一粒 生 嘅細胞 ,如果鄰居有 2個 或 者 3個 ,就會生存 到 下 一 代 ;一粒 死 嘅細胞 ,如果鄰居啱啱好 有 3個 ,就會變成 生 嘅。
第 啲模型
[呀噉。
註釋
[睇埋
[歐 詞
[- ↑ 1.0 1.1 Turing machine
- ↑ computation;
動詞 :to compute - ↑ Boolean algebra
- ↑ algorithm
- ↑ automata theory
- ↑ abstract machine
- ↑ computability theory
- ↑ computable
- ↑ halting problem
- ↑ Alan Turing
- ↑ proof by contradiction
- ↑ computational complexity theory
- ↑ time complexity
- ↑ space complexity
- ↑ worst-case scenari
- ↑ cellular automaton
- ↑ discrete
- ↑ Conway's Game of Life
- ↑ register machine
- ↑
μ -recursive functions - ↑ combinatory logic
- ↑ lambda calculus
- ↑ Markov algorithm
- ↑ FSM
文獻
[教科書
[- Hopcroft, John E., and Jeffrey D. Ullman (2006). Introduction to Automata Theory, Languages, and Computation. 3rd ed Reading, MA: Addison-Wesley. ISBN 978-0-321-45536-9. One of the standard references in the field.
- Linz P. An introduction to formal language and automata. Narosa Publishing. ISBN 9788173197819.
- Michael Sipser (2013). Introduction to the Theory of Computation (3rd ed.). Cengage Learning. ISBN 978-1-133-18779-0.
- Eitan Gurari (1989). An Introduction to the Theory of Computation. Computer Science Press. ISBN 0-7167-8182-4. Archived from the original on 2007-01-07.
- Hein, James L. (1996). Theory of Computation. Sudbury, MA: Jones & Bartlett. ISBN 978-0-86720-497-1. A gentle introduction to the field, appropriate for second-year undergraduate computer science students.
- Taylor, R. Gregory (1998). Models of Computation and Formal Languages. New York: Oxford University Press. ISBN 978-0-19-510983-2. An unusually readable textbook, appropriate for upper-level undergraduates or beginning graduate students.
- Lewis, F. D. (2007). Essentials of theoretical computer science A textbook covering the topics of formal languages, automata and grammars. The emphasis appears to be on presenting an overview of the results and their applications rather than providing proofs of the results.
- Martin Davis, Ron Sigal, Elaine J. Weyuker, Computability, complexity, and languages: fundamentals of theoretical computer science, 2nd ed., Academic Press, 1994, ISBN 0-12-206382-1. Covers a wider range of topics than most other introductory books, including program semantics and quantification theory. Aimed at graduate students.
其他書
[- Hartley Rogers, Jr (1987). Theory of Recursive Functions and Effective Computability, MIT Press. ISBN 0-262-68052-1.
- S. Barry Cooper (2004). Computability Theory. Chapman and Hall/CRC. ISBN 1-58488-237-9.
- Richard L. Epstein and Walter A. Carnielli (2000). Computability: Computable Functions, Logic, and the Foundations of Mathematics, with Computability: A Timeline (2nd ed.). Wadsworth/Thomson Learning. ISBN 0-534-54644-7.
- Carl H. Smith, A recursive introduction to the theory of computation, Springer, 1994, ISBN 0-387-94332-3.
攷
[- ↑ Sipser, M. (2006). Introduction to the Theory of Computation (Vol. 2). Boston: Thomson Course Technology.
- ↑ Lewis, H. R., & Papadimitriou, C. H. (1997). Elements of the Theory of Computation. Prentice Hall PTR.
- ↑ Michael Sipser (2013). Introduction to the Theory of Computation 3rd. Cengage Learning. ISBN 978-1-133-18779-0. p. 1.
- ↑ 4.0 4.1 Hodges, Andrew (2012). Alan Turing: The Enigma (The Centenary Edition). Princeton University Press.
- ↑ 5.0 5.1 Rabin, Michael O. (June 2012). Turing, Church, Gödel, Computability, Complexity and Randomization: A Personal View 互聯
網 檔案館 嘅歸 檔,歸 檔日期 2019年 6月 5號 ,.. - ↑ 6.0 6.1 6.2 6.3 Turing Machine example to add two numbers.
- ↑ Donald Monk (1976). Mathematical Logic. Springer-Verlag.
- ↑ Computation in Physical Systems. Stanford Encyclopedia of Philosophy.
- ↑ 9.0 9.1 Background: Algorithms 互聯
網 檔案館 嘅歸 檔,歸 檔日期 2018年 7月 3號 ,.. - ↑ Denning, P.J.; Comer, D.E.; Gries, D.; Mulder, M.C.; Tucker, A.; Turner, A.J.; Young, P.R. (January 1989). "Computing as a discipline". Communications of the ACM. 32: 9–23.
- ↑ Turner, Raymond, Angius, Nicola , Primiero, Giuseppe. (Spring 2019). "The Philosophy of Computer Science", The Stanford Encyclopedia of Philosophy, Edward N. Zalta (ed.),
- ↑ 12.0 12.1 John E. Hopcroft, Rajeev Motwani, Jeffrey D. Ullman (2000). Introduction to Automata Theory, Languages, and Computation (2nd Edition). Pearson Education.
- ↑ Anderson, James A. (2006). Automata theory with modern applications. With contributions by Tom Head. Cambridge: Cambridge University Press.
- ↑ Church, Alonzo (1936). "An Unsolvable Problem of Elementary Number Theory". American Journal of Mathematics. 58 (58): 345–363.
- ↑ 15.0 15.1 15.2 Alan Turing, On computable numbers, with an application to the Entscheidungsproblem, Proceedings of the London Mathematical Society, Series 2, Volume 42 (1937), pp 230–265.
- ↑ Davis, Martin (1965). The Undecidable, Basic Papers on Undecidable Propositions, Unsolvable Problems And Computable Functions. New York: Raven Press.. Turing's paper is #3 in this volume. Papers include those by Godel, Church, Rosser, Kleene, and Post.
- ↑ 17.0 17.1 17.2 Arora, Sanjeev; Barak, Boaz (2009), Computational Complexity: A Modern Approach, Cambridge University Press.
- ↑ Braatz, R. P., Young, P. M., Doyle, J. C., & Morari, M. (1994). Computational complexity of/spl mu/calculation. IEEE Transactions on Automatic Control, 39(5), 1000-1002.
- ↑ Knuth, Donald (1998). Sorting and Searching. The Art of Computer Programming. 3 (2nd ed.). Reading, MA: Addison-Wesley Professional.
- ↑ Kolen, J. F., & Hutcheson, T. (2002). Reducing the time complexity of the fuzzy c-means algorithm. IEEE Transactions on Fuzzy Systems, 10(2), 263-267.
- ↑ Alon, N., Matias, Y., & Szegedy, M. (1999). The space complexity of approximating the frequency moments. Journal of Computer and system sciences, 58(1), 137-147.
- ↑ Petzold, C. (2008). The annotated Turing: a guided tour through Alan Turing's historic paper on computability and the Turing machine. Wiley Publishing.
- ↑ Toffoli, Tommaso; Margolus, Norman (1987). Cellular Automata Machines: A New Environment for Modeling. MIT Press. p. 27.
- ↑ 24.0 24.1 Adamatzky, Andrew, ed. (2010). Game of Life Cellular Automata. Springer. ISBN 978-1-84996-216-2.
- ↑ Coombs, Stephen (15 February 2009), The Geometry and Pigmentation of Seashells, pp. 3–4, retrieved 2 September 2012.
拎
[- Theory of Computation (
英文 ),MIT講 運算 理論 。 - Theory of Computation (
英文 ),哈佛大學 講 運算 理論 。