

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Professor: Dillon; Class: Organization Programming Lang; Subject: Computer Science & Engineering; University: Michigan State University; Term: Fall 2008;
Typology: Study notes
1 / 2
This page cannot be seen from the preview
Don't miss anything!


L. Dillon, CSE 452, Fall 2008 1
concurrency etc.)
<A language implementation can reliably detect when (1) occurs < But not when (2) occurs
L. Dillon, CSE 452, Fall 2008 2
A = B
< 6 x D A and y, z D B , ( x, y ) D f and ( x, z ) D f implies y = z
< 6 x D A 7 y D B such that ( x, y ) D f
< partial operations < nontermination
L. Dillon, CSE 452, Fall 2008 3
A partial function f : A A B is computable if there is a program P that computes f , i.e., for any x D A , if there exists y D B such that y = f ( x ), then computation P ( x ) halts with output y
All general computing devices compute the same functions— ZWLJPÄJHSS[OLM\UJ[PVUZJVTW\[HISLIH Turing machine
The set of computable functions on the natural numbers is called the set of partial recursive functions
L. Dillon, CSE 452, Fall 2008 4
Given a program P and an input x , decides whether P halts on x
There is no program that computes Halt
There are useful program properties that cannot be decided automatically ½Will a program run forever? ½ Will a program eventually cause an error? ½>PSSHWYVNYHTL]LY[V\JOHZWLJPÄJTLTVYSVJH[PVUHNHPU& (ButJVUZLY]H[P]LHUHSZPZTHZ\MÄJLLN[WLJOLJRPUN
1, if P(x) halts 0, otherwise
Halt ( P, x ) =
L. Dillon, CSE 452, Fall 2008 5
ZHZUV[OPUNHIV[WYHJ[PJHSP[LMÄJPLUJ< Provides estimates of the resources (e.g., time, space) needed by a program that computes a given function <Different complexity classes: linear, polynomial, exponential, ...
Time complexity function
n = 10 n = 20 n = 30 n = 40 n = 50 n = 60
n .00001 s .00002 s .00003 s .00004 s .00005 s .00006 s n (^2) .0001 s .0004 s .0009 s .0016 s .0025 s .0036 s n^5 .1 s 3.2 s 24.3 s 1.7 m 5.2 m 13.0 m 2 n^ .001 s^ 1.0 s^ 17.9 m^ 12.7 d^ 35.7 y^ 366 c 3 n^ .059 s^ 58 m^ 6.5 y^ 3855 c^2 =^10 8 c^ 1.3=^ c s = sec., m = min., d = days, y = years, c = centuries; n PZZPaLVMWYVISLTPUZ[HUJL L. Dillon, CSE 452, Fall 2008 6
:PaLVM3HYNLZ[7YVISLT0UZ[HUJL Solvable in 1 Hour Time complexity function
With present computer
With computer 100 times faster
With computer 1000 times faster n N 1 100 N 1 1000 N 1 n^5 N 2 2.5 N 2 3.98 N 2 3 n^ N 3 N 3 + 4.19 N 3 + 6.
Source: Computers and Intractability: A Guide to the Theory of NP-Completeness , by M. Garey and D. Johnson, W. H. Freeman & Co., 1979.
L. Dillon, CSE 452, Fall 2008 7
< i.e., no polynomial time program can possibly solve them
< e.g., SAT: "solving" a Boolean logic formula < widely believed to be intractable
< Thereare practical limits to what programs can do regardless VMLMÄJPLUJVM[OLSHUN\HNLZ[OLHYL^YP[[LUPU < Thereare program properties for which automated analysis, al- though possible in theory, may be impractical < Complexityof a problem to be solved may affect choice of programming language