SlideShare a Scribd company logo
1 of 109
Download to read offline
离散6、7、8章选讲
张华枫
计研111
ron.huafeng@gmail.com
1
 图灵机
 递归函数
 哥德尔不完备性定理
2
图灵机背景介绍
欧几里得(Euclid)
希尔伯特(Hilbert)
图灵(Turing)
3
 Euclid
Elements 《几何原本》
4
How Euclid’s ‘Elements’ work
 Definitions
 Postulates
(公设)
 Axioms
(公理)
 Agreed Method
Each step in the proof is an
application of one of the above.
5
Hilbert’s question (1900)
 Is there, or could there possibly be,
a definite method that could decide
whether a particular mathematical
expression is true?
 What exactly do we mean by a
definite method?
Turing’s answer - mechanical –
algorithmic - the Turing machine
6
Theory Hall of Fame
Alan Turing
1912 – 1954
b. London, England.
PhD – Princeton (1938)
Research
Cambridge and Manchester U.
National Physical Lab, UK
Creator of the Turing Test
8
More about Turing
“Breaking the Code”
 Movie about the personal life of Alan Turing
Death was by cyanide poisoning (some say suicide)
 Turing worked as a code breaker for the Allies
during WWII.
 Turing eventually tried to build his machine
and apply it to mathematics, code breaking,
and games (chess).
Was beat to the punch by vonNeumann
9
The Turing Machine
Some history
Created in response to Kurt Godel’s 1931
proof that formal mathematics was
incomplete
There exists logical statements that cannot
be proven by using formal deduction from a
set of rules
 Good Reading: “Godel, Escher, Bach” by
Hofstadter
Turing set out to define a process by which
it can be decided whether a given
mathematical statement can be proven or not.
10
Theory Hall of Fame
 Kurt Godel
 1906 – 1978
 b. Brünn, AustriaHungary
 PhD – University of Vienna (1929)
 Research
Princeton University
 Godel’s Incompleteness Theorem
11
The Turing Machine
 • Motivating idea
 Build a theoretical “human computer”
 Likened to a human with a paper and pencil that
can solve problems in an algorithmic way
 The theoretical machine provides a means to
determine:
If an algorithm or procedure exists for a given
problem
What that algorithm or procedure looks like
How long would it take to run this algorithm or
procedure.
12
The Church-Turing Thesis
(1936)
 Any algorithmic procedure that can
be carried out by a human or group
of humans can be carried out by some
Turing Machine
 Equating algorithm with running on a TM
 Turing Machine is still a valid
computational model for most modern
computers.
13
Theory Hall of Fame
 Alonso Church
 1903 – 1995
 b. Washington D.C.
 PhD – Princeton (1927)
 Mathematics Prof (1927 – 1967)
 Advisor to both Turing and Kleene
14
Turing’s Concept
 A machine
 With a finite set of states
 Unrestricted input and output
 Unlimited storage space
 Simplest possible operations
01 00 1 11 1 10 0 0
Read/write head
Infinite tape
15
Basic operations of the
machine Read
 Read the symbol on the current square
 Change the inner state of the machine
 Write
 Change the symbol on the current square
 Change the inner state of the machine
 Move
 Tape can move any distance left or right
01 00 1 11 1 10 0 0
Read/write head
Infinite tape
16
Turing Machine
 A Machine consists of:
 A state machine
 An input tape
 A movable r/w tape head
 A move of a Turning Machine
 Read the character on the tape at the
current position of the tape head
 Change the character on the tape at the
current position of the tape head
 Move the tape head
 Change the state of the machine based on
current state and character read
17
Turing Machine
 Tape that holds character
string
 Movable tape head that reads
and writes character
 Machine that changes state
based on what is read in
Input tape (input/memory)
State
Machine
(program)
Read head
…
18
Turing Machine
 In the original Turing Machine
 In the original Turing Machine
The read tape was infinite in both
directions
 We describe a semi-infinite TM where
The tape is bounded on the left and
infinite on the right
It can be shown that the semi-infinite
TM is equivalent to the basic TM.
19
Turing Machine
 About the input tape
 Bounded to the left, infinite to the right
 All cells on the tape are originally filled
with a special “blank” character □
 Tape head is read/write
 Tape head can not move to the left of the
start of the tape
If it tries, the machine “crashes”
20
Turing Machines
 Let’s formalize this
 A Turing Machine M is a 5-tuple:
 M = (Q, Σ, Γ, δ, q0) where
 Q = a finite set of states (assumed not to
contain the halting state h)
 Σ = input alphabet (strings to be used as
input)
 Γ = tape alphabet (chars that can be written
onto the tape. Includes symbols from Σ)
 Both Σ and Γ are assumed not to contain the
“blank” symbol
 δ = transition function
BUT WAIT, SHEN ME GUI?
21
What is language?
 In mathematics, computer science, and
linguistics, a formal language is a set of
strings of symbols that may be constrained by
rules that are specific to it.
 A programming language is a formal constructed
language designed to communicate instructions
to a machine, particularly a computer.
Programming languages can be used to create
programs to control the behavior of a machine
or to express algorithms.
22
 Formal Languages
 Finite Automata
 Non Finite Automata
 Regular Expressions
 Context Free Languages
 Pushdown Automata
 Turing Machines
 …
23
 Programming Languages
24
ALGOL
Ada
AIML
Assembly
AutoHotkey
BASIC
Batchfile
BCPL
C
C#
C++
COBOL
CPL
D
DarkBASIC
dBASE
F#
FORTRAN
FoxPro
Go
GW Basic
HDML
HTML
Java
JavaScript
JCL
LISP
Live Script
LOGO
Matlab
Pascal
Perl
PHP
Pick
Python
Prolog
QBasic
R
Ruby
SGML
Smalltalk
SQL
Tcl
True BASIC
VHDL
Visual Basic
Visual FoxPro
WML
WHTML
XML
Turing Machines
 Transition function:
 δ: Q x (Γ  { Δ })  (Q  {h}) x (G  { Δ }) x {R, L,
S}
 Input:
 Current state
 Tape symbol read at current position of tape head
 Output:
 State in which to move the machine (can be the halting
state)
 Tape symbol to write at the current position of the tape
head (can be the “blank” symbol)
 Direction in which to move the tape head (R = right, L =
left, S= stationary)
25
Turing Machines
 Transition Function
q0 q1
X / Y, R
Symbol at
current tape
Head position
Symbol to
write at the
current head
position
Direction in
which to move
the tape head
<q0, X>  <q1, Y, R>
26
 Let Σ = input alphabet = {0, 1}, then transition
functions can be shown as a table
Current Input Output Move Next
0 0 1 - 1
0 1 - R 0
1 1 - L 1
1 0 - R Stop
27
1 0 1 00 1 …
1 1 1 00 1 …
q1
q3
δ(q1, 0) = (q3, 1, L)
 A more complicated transition table
Current Input Output Move Next
0 0 0 R 0
0 1 0 R 1
1 0 1 L 10
1 1 1 R 1
10 0 0 R 11
10 1 0 R 100
11 0 1 Stop 0
11 1 1 R 11
100 0 1 L 101
100 1 1 R 100
101 0 1 L 10
101 1 1 L 101
28
 Live Demo
 https://www.khanacademy.org/computer-
programming/double1s/6037171975487488
29
More Examples
 Successor
 X+Y
30
31 Successor Program
Rules:
If read 1, write 0, go right, repeat.
If read 0, write 1, HALT!
If read □, write 1, HALT!
Let’s see how they are carried out on a piece of paper
that contains the reverse binary representation
of 47:
32 Successor Program
If read 1, write 0, go right, repeat.
If read 0, write 1, HALT!
If read □, write 1, HALT!
1 1 1 1 0 1
33 Successor Program
If read 1, write 0, go right, repeat.
If read 0, write 1, HALT!
If read □, write 1, HALT!
0 1 1 1 0 1
34 Successor Program
If read 1, write 0, go right, repeat.
If read 0, write 1, HALT!
If read □, write 1, HALT!
0 0 1 1 0 1
35 Successor Program
If read 1, write 0, go right, repeat.
If read 0, write 1, HALT!
If read □, write 1, HALT!
0 0 0 1 0 1
36 Successor Program
If read 1, write 0, go right, repeat.
If read 0, write 1, HALT!
If read □, write 1, HALT!
0 0 0 0 0 1
37 Successor Program
If read 1, write 0, go right, repeat.
If read 0, write 1, HALT!
If read □, write 1, HALT!
0 0 0 0 1 1
38 Successor Program
So the successor’s output on 111101 was 000011
which is the reverse binary representation of 48.
Similarly, the successor of 127 should be 128:
39 Successor Program
If read 1, write 0, go right, repeat.
If read 0, write 1, HALT!
If read □, write 1, HALT!
1 1 1 1 1 1 1
40 Successor Program
If read 1, write 0, go right, repeat.
If read 0, write 1, HALT!
If read □, write 1, HALT!
0 1 1 1 1 1 1
41 Successor Program
If read 1, write 0, go right, repeat.
If read 0, write 1, HALT!
If read □, write 1, HALT!
0 0 1 1 1 1 1
42 Successor Program
If read 1, write 0, go right, repeat.
If read 0, write 1, HALT!
If read □, write 1, HALT!
0 0 0 1 1 1 1
43 Successor Program
If read 1, write 0, go right, repeat.
If read 0, write 1, HALT!
If read □, write 1, HALT!
0 0 0 0 1 1 1
44 Successor Program
If read 1, write 0, go right, repeat.
If read 0, write 1, HALT!
If read □, write 1, HALT!
0 0 0 0 0 1 1
45 Successor Program
If read 1, write 0, go right, repeat.
If read 0, write 1, HALT!
If read □, write 1, HALT!
0 0 0 0 0 0 1
46 Successor Program
If read 1, write 0, go right, repeat.
If read 0, write 1, HALT!
If read □, write 1, HALT!
0 0 0 0 0 0 0
47 Successor Program
If read 1, write 0, go right, repeat.
If read 0, write 1, HALT!
If read □, write 1, HALT!
0 0 0 0 0 0 0 1
x+y48
x+y49
x+y50
Turing Machine
 Running a Turing Machine
 The execution of a TM can result in 4 possible
cases:
The machine “halts” (ends up in the halting
state)
The machine has nowhere to go (at a state,
reading a symbol where no transition is defined)
The machine “crashes” (tries to move the tape
head to before the start of the tape)
The machine goes into an “infinite loop” (never
halts)
51
Turing Machine
 Accepting a string
 A string x is accepted by a TM, if
Starting in the initial configuration
With x on the input tape
The machine eventually ends up in the
halting state.
52
Turing Machine
 Running a Turing Machine
 The execution of a TM can result in 4
possible cases:
The machine “halts” (ACCEPT)
The machine has nowhere to go (REJECT)
The machine “crashes” (REJECT)
The machine goes into an “infinite loop”
(REJECT but keeps us guessing!)
53
Turing Machine
 Language accepted by a Turing Machine
 The language accepted by a TM is the set of
all input strings x on which the machine
halts.
54
Will a Turing Machine halt?
 In computability theory, the halting problem
is the problem of determining, from a
description of an arbitrary computer program
and an input, whether the program will finish
running or continue to run forever.
55
Halting Machine (HM)
program +
inputs
yes
or
no
Exist?
The halting problem is not
decidable.
56
Halting Machine
Inverter (HMI)
57
Halting
Machine (HM)
program done
HM
said
yes?
count forever
program
can be
inputs
and codes
yes
no
58
Halting
Machine (HM)
yes
or
no?
HMI
+
HMI
Yes?
Halting Machine
Inverter (HMI)
59
Halting
Machine (HM)
done
HM
said
yes?
count forever
yes
no
program
program
can be
inputs
and codes
60
Halting
Machine (HM)
yes
or
no?
HMI
+
HMI
No?
Halting Machine
Inverter (HMI)
61
Halting
Machine (HM)
done
HM
said
yes?
count forever
yes
no
program
program
can be
inputs
and codes
Pseudocode
int Halt(procedure,Input); // return yes or no
int HMI(P)
{
if (Halt(P,P) == no){
return yes;
}
else{
while(1){}
}
}
Halt(HMI, HMI)?
62
 停机问题的应用
 使用类似方法构造其他不可判定问题
63
是否存在确保无内存泄露的算法?
 假设存在算法:boolLeakFree(Program p)
 给定邪恶程序:
void Evil(p) {
int a = malloc();
if (LeakFree(p)) return;
else free(a);
}
 LeakFree(Evil)产生矛盾:
 如果为真,则有泄露
 如果为假,则没有泄露
64
 判定问题(Decision Problem):回答是/否的问题
 可判定问题(Decidable Problem)是一个判定问题,该问
题存在一个算法,使得对于该问题的每一个实例都能给出是
/否的答案。
 停机问题是不可判定问题
 确定程序有无内存泄露是不可判定问题
65
Church论题
“凡Turing机可作的都是计算
凡Turing机可计算的就叫可计算的。”
66
递归函数初探
 递归函数是数论函数,即以自然数为研究对象,定义域和值域
都是自然数。
 可以通过把其他类型的数转化为自然数表示,从而使得递归函
数可以处理。例如:
 -5 -> (1, 5)
 −
2
5
-> (1, 2, 5)
 实数可以用自然数序列表示
 复数可以由一对自然数序列表示
 符号A、B等也可用自然数表示
67
Gödel编码定理:
一个非数字系统与自然数间可建立一一对应关系,从而
非数字系统的研究可归结为自然数间函数关系的研究。
68
递归函数定义
递归函数是由几个初始函数出发,通过代入和递归规则来
建立的。
(1)初始函数
零函数 0(x) = 0
射影函数 Imn(x1, …,xn, …, xm) = xn
后继函数 S(x) = x + 1
69
(2)代入规则
Z = X * Y * Y, Y= U + V
代入 Y/U+V
得到 Z = X * (U+V)*(U+V)
70

71
(3)递归规则
N! = 1 if N= 0
N*(N-1)! if N > 0
其中 ! 为需要定义的函数,N是变元
72
一般来说,可由函数
𝛼 𝑡1, … , 𝑡 𝑛
𝛽(𝑡1, … , 𝑡 𝑛, 𝑡 𝑛+1, 𝑡 𝑛+2)
来构造新函数𝑓(𝑡1, … , 𝑡 𝑛, 𝑥)
规定
𝑓 𝑡1, … , 𝑡 𝑛, 0 = 𝛼 𝑡1, … , 𝑡 𝑛
𝑓 𝑡1, … , 𝑡 𝑛, 𝑠(𝑥) = 𝛽 𝑡1, … , 𝑡 𝑛, 𝑥, 𝑓(𝑡1, … , 𝑡 𝑛, 𝑥)
这时,称函数𝑓是由𝛼,𝛽经原始递归规则得到的
73
𝛼 𝑡1, … , 𝑡 𝑛
𝛽(𝑡1, … , 𝑡 𝑛, 𝑡 𝑛+1, 𝑡 𝑛+2)
𝑓 𝑡1, … , 𝑡 𝑛, 0 = 𝛼 𝑡1, … , 𝑡 𝑛
𝑓 𝑡1, … , 𝑡 𝑛, 𝑠(𝑥)
= 𝛽 𝑡1, … , 𝑡 𝑛, 𝑥, 𝑓(𝑡1, … , 𝑡 𝑛, 𝑥)
表示阶乘函数
Let 𝛼() = 1, 𝛽(𝑡1, 𝑡2) = 𝑡1∗ 𝑡2, 𝑓 = !
𝑓 0 = 𝛼() = 1
𝑓 𝑠(𝑥) = 𝑓 𝑥 + 1 = 𝛽 𝑥, 𝑓(𝑥) = 𝑥 ∗ 𝑓(𝑥)
74
递归函数定义
由初始函数,经过有限次代入和原始(一般)递
归规则所得到的函数叫做原始(一般)递归函数。
75
原始递归函数举例
𝑓 𝑥, 𝑦 = 𝑥 ∗ 𝑦
可写成
𝑓 𝑥, 0 = 0
𝑓 𝑥, 𝑦 + 1 = 𝑓 𝑥, 𝑦 + 𝑥
76
 Turing可计算的函数必是递归函数
 递归函数必Turing可计算的
77
第七章 一阶形式理论及模型
一阶语言的理论是19世纪末20世纪初数学形式化
的产物,对计算机的发明有重要影响。一个一阶语言
由字符表、形成规则、公式(按照形成规则的字符串)
组成。
从形式主义角度看,它们没有任何含义,就像一
部按给定规则来摆弄、拼凑字符的机器一样。
78
大背景
在那个年代,希尔伯特的数学天才就像太阳的光芒一
般夺目,在关于数学严格化的大纷争中希尔伯特带领
的形式主义派系技压群雄,得到许多当时有名望的数
学家的支持。希尔伯特希望借助于形式化的手段,抽
掉数学证明中的意义,把数学证明抽象成一堆无意义
的符号转换,就连我们人类赖以自豪的逻辑推导,也
不过只是一堆堆符号转换而已。这样一来,一个我们
日常所谓的,带有直观意义和解释的数学系统就变成
了一个纯粹由无意义符号表达的、公理加上推导规则
所构成的形式系统,而数学证明呢,只不过是在这个
系统内玩的一个文字游戏。
79
字符表
1. 个体变元 x,y,z,… 或者 x1, x2, x3 , …
2. 常项变元 a,b,c, … 或者 c1, c2,c3, …
3. 函词符号 F1, F2, …, Fn ( 函词符号集可以是
一个无穷的集合)
4. 谓词符号 P1,P2,…,Pm (谓词符号集也可以是
一个无穷的集合)
5. 特殊谓词 = ( 等号 )
6. 逻辑联结词 ,,,,
7. 量词 ,
8. 括号 ( , )
80
形成规则
(1) 项的形成规则
(i) 任一个体变元 x , 任一常项 c 都是一个项。
(ii) 若 F 是一个带 k 个变目的函词,t1,t2,…,tk
是项,则F(t1,t2,…,tk)是一个项。
(iii) 只有由定义 (i) ,(ii) 归纳定义得到的字符串
是项。
81
(2)公式的形成规则
I. F 是一个 k 目函词, t1,t2,…,tk,tk+1是项,则F(t1,t2,…,tk)=tk+1
是一公式。
II. P 是一个 k 目谓词, t1,t2,…,tk是项, P(t1,t2,…,tk)则是一
公式。
III. A, B 是公式,则~𝐀, 𝐀 ∧ 𝑩, 𝑨 ∨ 𝑩, 𝑨 → 𝑩, 𝑨 ↔ 𝑩是公式。
IV. A 是公式,x 是一变元,则∃𝒙𝑨, ∀𝒙𝑨是公式。
仅由 (1) - (iv) 归纳定义得到的字符串是公式。
82
(3)语句的定义
公式 A 是一个语句,如果 A 中不含任何变元的自由出现。
(即,A是一个命题)
(4)给定一阶语言 L , T 是一个一阶理论,如果它
包括:
① 谓词演算的所有公理。
② 一个 L 中的语句组成的集合,有穷或者无穷。它们称为
非逻辑公理。
③ 谓词演算的所有推理规则
83
 为什么是“一阶”?
 变元和常项都是一阶的个体,而非个体的集合
 例如 {1, 2} 和 {{}, {1}, {2}, {1,2}}的关系
84
(5)定理的定义
L 中的一个语句 A 是理论 T 的一个定理,如果 A 是上
面的①或 ②语句,或者是以逻辑公理或非逻辑公理为前提,
使用 T 的推理规则得到的语句。
85
结构、赋值及模型
 给定一阶语言L,其中的函词及谓词分别为F1,F2,…,Fn;
P1,P2,…,Pm
 L的结构是一个数学结构
M = <U,f1,f2,…,fn,R1,R2,..,Rm>,满足:
U是一个非空集合,有穷或者无穷
对应于L的每一个函词符号Fi,F是k元函词,则fi是A上的
一个k元函数
对应于L的每一个谓词符号Pi , Pi 是k元谓词,则 Ri
是A上的一个k元关系。
 I 为 L 在结构 M 上的一个赋值
86
 对一阶理论T,有序对<M,I>是T的一个模型
 如果对所有的T的非逻辑公理A,𝐼 𝐴 = 1,通常记为
𝑀| = 𝐴。为表示𝑀在某一赋值下是𝑇的模型,我们也写
成𝑀| = 𝑇
87
 示例,群论
 𝑳 𝑮的函词是𝒙 → 𝒙−𝟏和𝒙, 𝒚 → 𝒙 ⋅ 𝒚,谓词为 =
 它的一阶理论𝑻 𝑮包含如下公式:
 ∀𝒙, 𝒚, 𝒛 𝒙 𝒚𝒛 = 𝒙𝒚 𝒛
 ∀𝒙 𝒙 ⋅ 𝟏 = 𝟏 ⋅ 𝒙 = 𝒙
 ∀𝒙(𝒙 ⋅ 𝒙−𝟏 = 𝒙−𝟏 ⋅ 𝒙 = 𝟏)
 𝑻 𝑮的模型就是数学中常研究的各种群结构
88
理论与模型的基本关系—完全性定理
 定义7.3.1(语法定义)
 一个理论𝑇是协调的,如果对任一语句 𝐴,𝑇 ⊢ 𝐴及
𝑇 ⊢ ~𝐴不可能同时成立。
 定理7.3.1 (紧致性定理)
 𝑇 是协调的,当且仅当 𝑇 的任一有穷子集是协调的。
 定义7.3.2(语法定义)
 一个理论𝑇是协调的,如果它有一个模型𝑀,𝑀╞ 𝑇.
89
 定理7.3.2
 一阶理论 𝑇 在语法上是协调的,当且仅当 𝑇 有一个模型。
 定理7.3.3 Gödel完全性定理
 𝑇是一阶理论,𝐴是任一语句,𝑇 ⊢ 𝐴当且仅当𝐴在所有
𝑇的模型中都成立。
90
库尔特·哥德尔(Kurt Gödel)
 20世纪最伟大的数学家、逻辑学家之一
 爱因斯坦语录
 “我每天会去办公室,因为路上可以和哥德尔聊天”
91
希尔伯特计划
Hilbert’s Program
 德国数学家大卫‧希尔伯特在20世纪20年代提出
 背景:第三次数学危机
 罗素悖论:𝑅={𝑋 | 𝑋∉𝑋},𝑅∈𝑅?
 目标:提出一个形式系统,可以覆盖现在所有的数学定理,
并且具有如下特点:
 完备性:所有真命题都可以被证明
 一致性:不可能推出矛盾,即一个命题要么是真,要么是假,
不会两者都是
 保守性:任何抽象域导出来的具体结论可以直接在具体域中证
明
 可判断性:存在一个算法来确定任意命题的真假
92
哥德尔不完备定理
Gödel’s Incompleteness Theorem
 1931年由哥德尔证明
 蕴含皮亚诺算术公里的一致系统是不完备的
 皮亚诺算术公理=自然数
 0是自然数
 每个自然数都有一个后继
 0不是任何自然数的后继
 如果b,c的后继都是a,则b=c
 自然数仅包含0和其任意多次后继
 对任意能表示自然数的系统,一定有定理不能被证明
93
哥德尔不完备定理与图灵机停机问题
 主流程序语言的语法+语义=能表示自然数的形式系统
 设有表达式 T 不能被证明
 f(){while(T); return;} 不能判断是否会终止
94
Gödel不完全性定理
 定理7.6.1(Gödel不完全性定理)
 若一阶理论𝑍1是协调的,则存在Z的一个语句 A ,在
𝑍1中 A 及A 都不可能形式证明
(这个定理的证明较为复杂,需要三个大步)
95
 𝑍1的公理:
 课本上有,一共8条
96
 构造𝑍1的一个形式语句A,使用非负整数域N作为
𝑍1的模型,使得A的在N中的解释为:A本身是不可
证明的。
 该语句及其否定,在𝑍1中都不可证明,否则产生
矛盾。
97
1. 给所有𝑍1中的公式编码:公式 ->编码
2. 证明对任意一个公式𝜑(𝑥),存在一个语句𝜓,使
得𝜓 ↔ 𝜑( 𝜓 ),其中 𝜓 表示𝜓的编码
3. 令𝜑(𝑥)表示,¬∃𝑧 Pr(𝑧, 𝑥),有一个自由变元x,
在N中的解释为“x是不可被证明的”,根据 2.
对于𝜑(𝑥)也存在一个语句𝜓,𝜓 ↔ 𝜑( 𝜓 )。从
而语句𝜓就解释为:𝜓自己是不可以被证明的。
98
 编码
 编码方案:如何操作
 编码方案可以终止,即存在一个可以终止的过程使得
一个公式能够变成一个非负整数
利用了递归函数的理论
 可以表述:
n是L的一个符号,常项,语句,…
n是一个证明
n是语句m的一个证明Pr(n,m)
99
 编码第(8)条
 n是一个形为A(x)的公式,只含x为自由变元,m是一个常
项,c是以m置换n中的x得到的公式,即𝑐 = 𝐴(𝑐 𝑚) ,其
中𝑐 𝑚为m所代表的常项,此关系可记为Sub(n,m)=c,这
是N上的一个递归关系
公式 编码
A(x) n
𝑐 𝑚 m
𝐴(𝑐 𝑚) c
100
 引理7.6.4 对角线定理
 令𝜑(𝑥)是𝑍1的语言L的任意一个公式,它的唯一一个自
由变元是x,存在语句𝜓,使得𝑍1 ⊢ 𝜓 ↔ 𝜑( 𝜓 )
 证明:
令 𝛽 x = 𝜑 𝑆𝑢𝑏 𝑥, 𝑥 = 𝜑 𝑥
令𝑚 = 𝛽 x and 𝜓 = 𝛽 𝑚
在 𝑍1 有
𝜓 ↔ 𝛽 𝑚
↔ 𝜑 𝑆𝑢𝑏 𝑚, 𝑚
↔ 𝜑(𝑆𝑢𝑏( 𝛽 x , 𝑚))
↔ 𝜑( 𝛽 𝑚 )
↔ 𝜑( 𝜓 )
101
 基本上,第一定理的证明是通过在形式公理系统中
构造如下命题 p = “此命题是不可证明的” 来完
成的。
 这样,它可以看成是说谎者悖论的一个现代变种。
同时,它的一个弱化形式可以导出图灵机停机问题
不可判定的结论。
102
 定理7.6.2 ( Gödel第二不完全性定理)
 令 CON(Z) 表示 Z是协调的。通过编码,CON(Z) 可以
表达为Z 的一个形式公式。某一 Z的语句Ψ 在 Z中不可
证明。
 例如:连续统假设
连续统假设(continuum hypothesis),数学上
关于连续统势的假设。常记作CH。
该假设是说,无穷集合中,除了整数集的基数,实
数集的基数是最小的。
103
 定理7.6.3(广义Gödel不完全性定理)
 令 T 是任何一个理论,它的公理是归纳地给出的,同时原
始递归函数在 T 中可以定义,那么, 若 T 协调,则
(1) 存在语句 A , A 及A 在 T 中都不可证。
(2) CON(T)在 T 中是不可证的。
104
证明论中的逻辑系统
𝜆-演算
𝜆-演算可以说是最简单、最小的一个形式系统。大约
在1930年左右,由美国的逻辑学家Kleen创建。至今,
在欧洲得到广泛的发展。
首先,它是函数式程序理论的基础
而后在𝜆-演算基础上发展起来的𝜋-演算、𝜒-演算,
成为近年来并发程序的理论工具之一。
105
 𝜆-演算是函数式设计语言的基础,更接近理论
 Lisp,Clojure,Scheme,…
 Haskell,Scala, Elm
 ML,Ocaml,F#
 基于 Ocaml 的定理证明语言 Coq 在2004年给出了
四色定理(一张地图最多用四种颜色就足够)的一个
证明
106
 图灵机和𝜆-演算的计算能力是等价的
 图灵机中的停机问题在𝜆-演算中表述为:不存在一
个算法能够判定任意两个lambda函数是否等价
 定理 8.1.1 (不动点定理)中构造不动点(Y-
combinator)的方法和Gödel不完全性定理引理
7.6.4 中寻找𝜓的过程有类似的关系
107
埃舍尔(M. C. Escher)的名画
《瀑布》
108
Y-Combinator(YC)
 作为最成功的孵化器,YC成功孵化出了 Airbnb, Dropbox,
OMGpop,Stripe, Heroku, Parse,SocialCam, Xobni,
Reddit, Loopt,Parakey, Appjet
109
 推荐书
 计算机程序的构造和解释 SCIP (Structure and
Interpretation of Computer Programs)
 Programming Languages and Lambda Calculi
 哥德尔、艾舍尔,巴赫-集异璧之大成 ( Gödel Escher
Bach)
 推荐语言
 函数式语言:Lisp, ML, Haskell,最近比较火爆的Scala
Scala 而今又是更加火爆了
 一个链接
 http://hyperpolyglot.org/里面是各种编程语言的对比,
还比较有意思
110

More Related Content

Viewers also liked

daniels recent cv
daniels recent cvdaniels recent cv
daniels recent cv
Daniel Goan
 
Exploring The Efficacy of The Thrive Programme with Emetophic Clients Result...
Exploring The Efficacy of The Thrive Programme with Emetophic Clients  Result...Exploring The Efficacy of The Thrive Programme with Emetophic Clients  Result...
Exploring The Efficacy of The Thrive Programme with Emetophic Clients Result...
Kate Patterson
 
folderAGECONTROL-CHIhires
folderAGECONTROL-CHIhiresfolderAGECONTROL-CHIhires
folderAGECONTROL-CHIhires
Arnaud Veere
 

Viewers also liked (14)

daniels recent cv
daniels recent cvdaniels recent cv
daniels recent cv
 
Convenção Coletiva de Trabalho - Sincodiv - 2014-2015-
Convenção Coletiva de Trabalho - Sincodiv - 2014-2015-Convenção Coletiva de Trabalho - Sincodiv - 2014-2015-
Convenção Coletiva de Trabalho - Sincodiv - 2014-2015-
 
Интеллектуально-деловой клуб. Встреча нового 2016 года.
Интеллектуально-деловой клуб. Встреча нового 2016 года.Интеллектуально-деловой клуб. Встреча нового 2016 года.
Интеллектуально-деловой клуб. Встреча нового 2016 года.
 
Grandcanyon
GrandcanyonGrandcanyon
Grandcanyon
 
Webcast - how can banks defend against fraud?
Webcast - how can banks defend against fraud?Webcast - how can banks defend against fraud?
Webcast - how can banks defend against fraud?
 
Cryptography
CryptographyCryptography
Cryptography
 
Συνταγές από την Αρχαία Ελλάδα
Συνταγές από την Αρχαία ΕλλάδαΣυνταγές από την Αρχαία Ελλάδα
Συνταγές από την Αρχαία Ελλάδα
 
Exploring The Efficacy of The Thrive Programme with Emetophic Clients Result...
Exploring The Efficacy of The Thrive Programme with Emetophic Clients  Result...Exploring The Efficacy of The Thrive Programme with Emetophic Clients  Result...
Exploring The Efficacy of The Thrive Programme with Emetophic Clients Result...
 
High Impact Leadership for Emerging Leaders
High Impact Leadership for Emerging LeadersHigh Impact Leadership for Emerging Leaders
High Impact Leadership for Emerging Leaders
 
Best Magento Extensions For Loyalty Program
Best Magento Extensions For Loyalty ProgramBest Magento Extensions For Loyalty Program
Best Magento Extensions For Loyalty Program
 
folderAGECONTROL-CHIhires
folderAGECONTROL-CHIhiresfolderAGECONTROL-CHIhires
folderAGECONTROL-CHIhires
 
psikologi perkembangan
psikologi perkembanganpsikologi perkembangan
psikologi perkembangan
 
Hướng dẫn thần đúc
Hướng dẫn thần đúcHướng dẫn thần đúc
Hướng dẫn thần đúc
 
Gevaar
GevaarGevaar
Gevaar
 

离散6 8选讲 图灵机 递归函数 哥德尔不完备性定理