Skip to Content
深入理解運算原理|從簡單的機器到無所不能的程式
book

深入理解運算原理|從簡單的機器到無所不能的程式

by Tom Stuart
November 2017
Beginner to intermediate
344 pages
7h 2m
Chinese
GoTop Information, Inc.
Content preview from 深入理解運算原理|從簡單的機器到無所不能的程式
不可能的程式
|
295
至此,為什麼程式的行為難以預測,原因有兩個:
1. 任何具有足夠能力而能自我參照的系統,都無法正確回答和它自己相關的每個問
20
。我們始終能夠構建諸如
do_the_opposite.rb
,這種程式的行為無法由系統預測。
為了避免這種問題,我們需要跨出自我參照系統,並使用不同且能力更強大的系統
來回答和它自己相關的問題。
2. 但若是通用程式語言,就沒有能力更強大的系統可以讓我們升級。邱奇 - 圖靈論題
告訴我們,我們為了預測程式行為所發明的任何可用的演算法,皆可由程式本身執
行,因此通用系統的功能就推給我們了。
對付不可運算性
編寫程式的所有重點就是讓電腦做些有用的事情。身為程式開發人員,我們應該如何想
像:對付會檢查程式正常工作的世界是個無法解決的問題?
拒絕或否認是個誘人的回應:
略過整個問題。如果我們可以自動驗證程式行為,那
勢必很好,但是我們做不到,所以就讓我們只希望最好而且永遠不要試著檢查程式
是否正確運作。
但這是反應過度,因為它的情況並沒有聽起來那麼糟。萊斯定理並不代表不可能程式
分析,只是我們無法寫出永遠都會停止並產生正確答案的非顯然分析器(nontrivial
analyzer)。就如第 283 頁的『建置停機核對器』所述,什麼都無法阻止我們編寫可以
某些
程式提供正確答案的工具,只要我們能夠容忍這樣的事實:總有
其他
程式不會
傳回任何東西並給了錯誤的答案或永遠循環。
雖然是無法決定性,但這裡還是有一些分析和預測程式行為的實用方法:
詢問無法決定的問題,但若找不到答案,就放棄。舉例來說,要檢查程式是否能印 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

JSON實務手冊

JSON實務手冊

Tom Marrs

Publisher Resources

ISBN: 9789864766000