Introduction to Complexity and Computability NTIN090 JirkaFink https://ktiml.mff.cuni.cz/˜fink/ DepartmentofTheoreticalComputerScienceandMathematicalLogic FacultyofMathematicsandPhysics CharlesUniversityinPrague Wintersemester2017/18 LastchangeonJanuary11,2018 License:CreativeCommonsBY-NC-SA4.0 JirkaFink IntroductiontoComplexityandComputability 1 Jirka Fink: Introduction to Complexity and Computability Generalinformation E-mail fi[email protected] Homepage https://ktiml.mff.cuni.cz/˜fink/ Consultations Thursday,17:15,officeS305 Examination Homeworks(theoretical) Passtheexam JirkaFink IntroductiontoComplexityandComputability 2 Content 1 Computability 2 Complexity JirkaFink IntroductiontoComplexityandComputability 3 Literature Sipser,M.IntroductiontotheTheoryofComputation. Vol. 2. Boston: Thomson CourseTechnology,2006. Garey,Johnson: Computersandintractability-aguidetothetheoryof NP-completeness,W.H.Freeman1978 SoareR.I.: Recursivelyenumerablesetsanddegrees. Springer-Verlag,1987 OdifreddiP.: Classicalrecursiontheory,North-Holland,1989 AroraS.,BarakB.: ComputationalComplexity: AModernApproach. Cambridge UniversityPress2009. JirkaFink IntroductiontoComplexityandComputability 4 Outline 1 Computability 2 Complexity JirkaFink IntroductiontoComplexityandComputability 5 Post correspondence problem (Post, 1946) Input Everydominocontainstwostrings,oneoneachside;e.g. a ab (cid:26) (cid:27) Aninputtotheproblemisacollectionofdominoes;e.g. b , a , ca , abc ca ab a c Match Amatchaisalistofthesedominoes(repetitionspermitted)sothatthestringonthe topisthesameasthestringonthebottom;e.g. a b ca a abc ab ca a ab c Problem Findanalgorithmwhichdetermineswhetherforagivencollectionofdominoesthere existsamatch. JirkaFink IntroductiontoComplexityandComputability 6 Hilbert’s tenth problem (1900) Originalstatement(translatedfromGerman) GivenaDiophantineequationwithanynumberofunknownquantitiesandwithrational integralnumericalcoefficients: Todeviseaprocessaccordingtowhichitcanbe determinedinafinitenumberofoperationswhethertheequationissolvableinrational integers. Reformulation Findanalgorithmwhichforagivenmulti-variablepolynomialwithrationalcoefficients hasintegralroot. Exampleofaninstanceoftheproblem Isthereanintergralsolutionofequation6x3yz2+3xy2−x3−10=0? JirkaFink IntroductiontoComplexityandComputability 7 Halting problem Haltingproblem Isthereanalgorithmwhichforagivenprogramanditsinputdetermineswhetherthe programonthatinputterminates? Exampleofaprogram int main(int argc, char *argv[]) { int n, total, x, y, z; scanf("%d", &n); total=3; for(;;) { for(x=1; x<=total-2; ++x) { for(y=1; y<=total-x-1; ++y) { z=total-x-y; if(exp(x,n)+exp(y,n)==exp(z,n)) return 0; } } ++total; } } JirkaFink IntroductiontoComplexityandComputability 8 Random access machine Components Memorydividedintocells Cellsareindexedby(positive)integers Everycellcanstoreainteger Programcomposedofinstructions Arithmeticalinstructions:additions,subtraction,multiplication,division,modulo Logicalinstructions:conjunction,disjunction,shift Controlinstructions:conditionalandunconditionaljump,halt Inputandoutput Specialinstructionforreadingandwriting,or storinginmemoryinpre-definedcells Specialregisters(e.g. programcounter) Argumentsofinstructionsandmemoryindexing Integer,e.g. 3 Directaddressing,e.g. [4] Indirectaddressing,e.g. [[5]] Exampleofinstruction: [[5]]:=3+[4] Variablescanbeusedtoimprovereadability JirkaFink IntroductiontoComplexityandComputability 9 Random access machine Example: Factorial Calculatefactorialoftheinputstoredat[1]andsavetheresultsin[2]. [2] := 1 loop: [2] := [1] * [2] [1] := [1] - 1 jump_if_positive [1], loop halt VariantsofRandomaccessmachines Memorypotentiallyinfiniteonlyinonedirection Cellswithboundednumberofbits Moreinstructions,e.g. functioncalls Moreindirectionsinmemoryaccessing Etc. JirkaFink IntroductiontoComplexityandComputability 10
Description: