SlideShare une entreprise Scribd logo
1  sur  49
1 Introduction to the theory of computation ,[object Object]
那為什麼要學習計算理論的課程呢? ,[object Object]
理論觀念可應用在很多地方。
這些理論的主題是有趣、令人興奮的。
本章的主要主題 ,[object Object]
A  formal   language  is an abstraction of the general characteristics of programming languages.
之後再討論  mechanical computation  的概念,也就是  algorithm  的觀念,以及哪些問題適合用  algorithm  來解、哪些不能。
outline 1.1 Mathematical preliminaries and notation sets ,[object Object],1.2 Three basic concepts ,[object Object],1.3 Some applications ,[object Object]
1.1 Mathematical Preliminaries and Notation ,[object Object],[object Object]
S =  { i : i > 0, i   是偶數 } ,[object Object],S 1     S 2  =  {  x: x    S 1   or  x    S 2 } S 1     S 2  =  {  x: x    S 1   and  x    S 2 } S 1   -  S 2  =  {  x: x    S 1   and  x    S 2 }
關於集合 (set) ,[object Object]
Universal   set   U :  代表所有可能的元素。 ,[object Object],S        =  S  -    =  S , S        =  
關於集合 (set) ,[object Object],[object Object],若  S 1   的元素也都是  S   的元素,則  S 1   為  S   的  subset 。 S 1      S ,[object Object],[object Object],S 1      S 2  =  
關於集合 (set) ,[object Object]
集合  S   的元素個數記成  | S | 。
部份集合  powerset ,所有子集合所形成的集合稱為部份集合。令  2 S   為  S   的  powerset ,其元素個數為  2 |S|   。
S =  { a, b, c }
2 S  =  {  ,  { a } ,  { b } ,  { c } ,  { a,b } ,  { b, c } ,  { c, a } ,  { a, b, c }   } .
關於集合 (set) ,[object Object],S  =  S 1      S 2   = {( x, y ) :  x      S 1   and   y      S 2  } S 1      S 2     …     S n   = {( x 1 , x 2 , …, x n  ) : x i      S i } ,[object Object],S 1      S 2   = {(2,2), (2, 3), (2, 5), (2, 6), (4, 2), (4, 3), (4, 5), (4, 6)}
關於  functions and relations ,[object Object],f :   S 1  ->S 2 ,[object Object]
如果  S 1   就是  f   的  domain ,則  f   稱為 total   function 、否則稱為  partial   function 。
關於  functions and relations ,[object Object]
若  |f(n)|  ≥   c |g(n)| ,   「 f   has order at least   g 」 ,  f(n) = Ω (g(n))
若存在  c 1   與  c 2   兩個常數,  c 1  |g(n)|  ≤   |f(n)|  ≤  c 2  |g(n)| ,   「 f   and   g   have the same order of magnitude 」 ,  f(n) = Θ (g(n))
關於  functions and relations ,[object Object],f(n) = 2n 2  + 3n g(n) = n 3 h(n) = 10 n 2  + 100 則 f(n) = O(g(n)) g(n) = Ω(h(n)) f(n) = Θ(h(n))
關於  functions and relations ,[object Object],{ ( x 1 , y 1 ) ,  ( x 2 , y 2 ) , … } ,其中  x i   是  domain  的元素、 y i   是  range  的元素。 ,[object Object]
若有某個  x i   出現兩次以上的話,就不是 function ,只能稱它為  relation  。所以  relation  比函式一般化。
關於  functions and relations ,[object Object]
一個  equivalence relation  必須滿足下列三個條件: the  reflexivity  rule( 反身性 ),  x ≡ x  for all  x,  the  symmetry  rule( 對稱性 ), if  x ≡ y   then  y ≡ x   與  the  transitivity  rule( 遞移性 ), if  x ≡ y  and  y ≡ z  , then  x ≡ z .
Example 1.4  除以  3  的餘數是否相同的關係,是不是  equivalence relation  呢?
關於  Graphs and Trees ,[object Object]
e i  =  ( v j , v k )   是從  v j   連到  v k   的邊、有方向的邊; e i   是  v j   的  outgoing  edge ,是  v k   的  incoming   edge 。
邊都有方向的圖形、稱為有向圖  directed   graph ,  digraph 。圖形的點或邊都可以有名稱。
關於  Graphs and Trees ,[object Object],[object Object]
path : 沒有重複邊的 walk,  simple   path   : 沒有重複點的 path
length ,  cycle ,  simple   cycle ,  loop ,[object Object]
關於  Graphs and Trees ,[object Object]
There is exactly one path from the  root  to every other vertex.
root 沒有 incoming edge 、其他點都有一條  incoming edge ;
parent ,  child ,  leaves ,  level : root  到該點的  edge  數 ,  height 。
ordered   trees ,同一個 level 的 node 都有順序。
degree : in-degree  與  out-degree
關於  Graphs and Trees
關於  proof techniques ,[object Object]
最常用、最重要的兩個證明: proof   by   induction   歸納法、 proof   by   contradiction   矛盾證法、反證法。
歸納法證明通常是證明  P 1 , P 2 , …   每個  statement  都是正確的,包括幾個部份 ,[object Object]
Inductive   assumption :  假設  P 1 , P 2 , …, P n   是正確的, for some  n  ≥  k 。
Inductive   step :證明  P 1 , P 2 , …, P n   ->  P n+1 , for any  n  ≥  k
關於  proof techniques ,[object Object],Proof:  令  l ( n )   代表高度為  n   的  binary tree  最多的  leaf  數。因此等於要證明  l ( n )     2 n . Basis:  l ( 0 )  = 1  ≤  2 0 ,故成立。 Inductive assumption:  l ( i )   ≤  2 i , for  i = 0, 1, …, n Inductive step:  高度為  n+1   的  binary tree  之  leaf  數最多就是  l ( n )   的兩倍,因此  l ( n+1 )  = 2 l ( n )   ≤  2×2 n  = 2 n+1 。 由數學歸納法得證。

Contenu connexe

Similaire à Chapter01

最大熵模型
最大熵模型最大熵模型
最大熵模型
jianingy
 
对偶分解与拉格朗日松弛在自然语言处理推理的应用导论
对偶分解与拉格朗日松弛在自然语言处理推理的应用导论对偶分解与拉格朗日松弛在自然语言处理推理的应用导论
对偶分解与拉格朗日松弛在自然语言处理推理的应用导论
zhaoweihb
 
通信网第二三章习题答案
通信网第二三章习题答案通信网第二三章习题答案
通信网第二三章习题答案
bupt
 
Sect14 1
Sect14 1Sect14 1
Sect14 1
F.l. Yu
 
正则表达式入门
正则表达式入门正则表达式入门
正则表达式入门
thinkinlamp
 
2 2廣義角三角函數
2 2廣義角三角函數2 2廣義角三角函數
2 2廣義角三角函數
leohonesty0814
 
Dunbar’s conjecture for planar graphs
Dunbar’s conjecture for planar graphsDunbar’s conjecture for planar graphs
Dunbar’s conjecture for planar graphs
greentask
 
S101-76國立花蓮高商
S101-76國立花蓮高商S101-76國立花蓮高商
S101-76國立花蓮高商
yustar1026
 
Algorithms.exercises.solution
Algorithms.exercises.solutionAlgorithms.exercises.solution
Algorithms.exercises.solution
Regina Long
 
第3章 离散系统的时域分析
第3章   离散系统的时域分析第3章   离散系统的时域分析
第3章 离散系统的时域分析
reader520
 

Similaire à Chapter01 (20)

!“压缩传感”引论
!“压缩传感”引论!“压缩传感”引论
!“压缩传感”引论
 
3 3數學歸納法
3 3數學歸納法3 3數學歸納法
3 3數學歸納法
 
福建省福州大学2019年暑假物理竞赛夏令营-物理奥赛进阶之路:0-1+微积分初步+40张ppt.pptx
福建省福州大学2019年暑假物理竞赛夏令营-物理奥赛进阶之路:0-1+微积分初步+40张ppt.pptx福建省福州大学2019年暑假物理竞赛夏令营-物理奥赛进阶之路:0-1+微积分初步+40张ppt.pptx
福建省福州大学2019年暑假物理竞赛夏令营-物理奥赛进阶之路:0-1+微积分初步+40张ppt.pptx
 
最大熵模型
最大熵模型最大熵模型
最大熵模型
 
3 7複數的極式
3 7複數的極式3 7複數的極式
3 7複數的極式
 
对偶分解与拉格朗日松弛在自然语言处理推理的应用导论
对偶分解与拉格朗日松弛在自然语言处理推理的应用导论对偶分解与拉格朗日松弛在自然语言处理推理的应用导论
对偶分解与拉格朗日松弛在自然语言处理推理的应用导论
 
通信网第二三章习题答案
通信网第二三章习题答案通信网第二三章习题答案
通信网第二三章习题答案
 
第7章 语法制导翻译和中间代码生成
第7章 语法制导翻译和中间代码生成第7章 语法制导翻译和中间代码生成
第7章 语法制导翻译和中间代码生成
 
Sect14 1
Sect14 1Sect14 1
Sect14 1
 
Appendix A
Appendix AAppendix A
Appendix A
 
正则表达式入门
正则表达式入门正则表达式入门
正则表达式入门
 
From Hadamard to Langlands
From Hadamard to LanglandsFrom Hadamard to Langlands
From Hadamard to Langlands
 
2 2廣義角三角函數
2 2廣義角三角函數2 2廣義角三角函數
2 2廣義角三角函數
 
Dunbar’s conjecture for planar graphs
Dunbar’s conjecture for planar graphsDunbar’s conjecture for planar graphs
Dunbar’s conjecture for planar graphs
 
1 1指數
1 1指數1 1指數
1 1指數
 
S101-76國立花蓮高商
S101-76國立花蓮高商S101-76國立花蓮高商
S101-76國立花蓮高商
 
第5章 自底向上的语法分析
第5章 自底向上的语法分析第5章 自底向上的语法分析
第5章 自底向上的语法分析
 
Algorithms.exercises.solution
Algorithms.exercises.solutionAlgorithms.exercises.solution
Algorithms.exercises.solution
 
第3章 离散系统的时域分析
第3章   离散系统的时域分析第3章   离散系统的时域分析
第3章 离散系统的时域分析
 
非齐次特征值问题解存在性研究
非齐次特征值问题解存在性研究非齐次特征值问题解存在性研究
非齐次特征值问题解存在性研究
 

Chapter01