cs1010: theory of computation - brown...

19
CS1010: Theory of Computation Lorenzo De Stefani Fall 2020 Lecture 0a: Introduction

Upload: others

Post on 27-Aug-2021

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS1010: Theory of Computation - Brown Universitycs.brown.edu/courses/csci1010/files/doc/fall2020/Lecture... · 2020. 9. 10. · theory of computation: –Automata and Languages –Computability

CS1010:TheoryofComputation

LorenzoDeStefaniFall2020

Lecture0a:Introduction

Page 2: CS1010: Theory of Computation - Brown Universitycs.brown.edu/courses/csci1010/files/doc/fall2020/Lecture... · 2020. 9. 10. · theory of computation: –Automata and Languages –Computability

Whatisthiscourseabout?

• Canwedefinecomputationwithoutreferringtoamoderncomputer?

• Canwedefineacomputermathematically?– YesàTuringmachines

• Iscomputation definableindependentofpresent-dayengineeringlimitations,understandingofphysics,etc.?

• Canacomputersolveanyproblem,givenenoughtimeanddisk-space?

• Oraretherefundamentallimitstocomputability?

Whatis“Computation”?

9/10/20 Theory of Computation - Fall'20 Lorenzo De Stefani 1

Page 3: CS1010: Theory of Computation - Brown Universitycs.brown.edu/courses/csci1010/files/doc/fall2020/Lecture... · 2020. 9. 10. · theory of computation: –Automata and Languages –Computability

Whatisthiscourseabout?

Thiscoursecovers3areas,whichmakeupthetheoryofcomputation:– AutomataandLanguages– ComputabilityTheory– ComplexityTheory

Thiscourseisaboutthefundamentalcapabilitiesandlimitationsofcomputers/computation

9/10/20 Theory of Computation - Fall'20 Lorenzo De Stefani 2

Page 4: CS1010: Theory of Computation - Brown Universitycs.brown.edu/courses/csci1010/files/doc/fall2020/Lecture... · 2020. 9. 10. · theory of computation: –Automata and Languages –Computability

AreasofTheoryofComputation

• Whatcanbecomputed?• Canacomputersolveanyproblem,

givenenoughtimeanddisk-space?

• Howfastcanwesolveaproblem?• Howlittledisk-spacecanweuseto

solveaproblem

• Whatproblemscanwesolvegivenreallyverylittle(constant)space?

COMPUTABILITY

AUTOMATA

COMPLEXITY

9/10/20 Theory of Computation - Fall'20 Lorenzo De Stefani 3

Page 5: CS1010: Theory of Computation - Brown Universitycs.brown.edu/courses/csci1010/files/doc/fall2020/Lecture... · 2020. 9. 10. · theory of computation: –Automata and Languages –Computability

AreasofTheoryofComputation

• Notallproblems!!!• Eg.GivenaC-program,wecannotcheckifitwillnoteventuallycrash

• Verificationofcorrectnessofprogramsishenceimpossible!

COMPUTABILITY

AUTOMATA

COMPLEXITY

Whatproblemscanacomputersolve?

9/10/20 Theory of Computation - Fall'20 Lorenzo De Stefani 4

Page 6: CS1010: Theory of Computation - Brown Universitycs.brown.edu/courses/csci1010/files/doc/fall2020/Lecture... · 2020. 9. 10. · theory of computation: –Automata and Languages –Computability

AreasofTheoryofComputation

• EvencheckingwhetheraC-programwillhalt/terminate isnotpossible!

Program(n)Inputintegern>1while(n!=1)

if(niseven)returnProgram(n/2)

elsereturnProgram(3n+1)

E.g.,forinputn=34:17,52,26,13,40,20,10,5,16,8,4,2,1.

COMPUTABILITY

AUTOMATA

COMPLEXITY

Whatproblemscanacomputersolve?

Impossibletodecidewhetherthisprogramterminatesforallpossibleinputvalues

9/10/20 Theory of Computation - Fall'20 Lorenzo De Stefani 5

Page 7: CS1010: Theory of Computation - Brown Universitycs.brown.edu/courses/csci1010/files/doc/fall2020/Lecture... · 2020. 9. 10. · theory of computation: –Automata and Languages –Computability

AreasofTheoryofComputation

• Certainproblemscannotbesolvedbycomputers– I.e.,theyhavenoalgorithmicsolution

• ATuringmachine,asimplemodelforacomputer,candoeverythingthatacomputercando(Church-Turingthesis)

• WecanuseaTuringmachinetodeterminewhatacomputercanandcan’tdo(i.e.,compute)

COMPUTABILITY

AUTOMATA

COMPLEXITY

Whatproblemscanacomputersolve?

9/10/20 Theory of Computation - Fall'20 Lorenzo De Stefani 6

Page 8: CS1010: Theory of Computation - Brown Universitycs.brown.edu/courses/csci1010/files/doc/fall2020/Lecture... · 2020. 9. 10. · theory of computation: –Automata and Languages –Computability

AreasofTheoryofComputation

• Polynomialtimecomputable• Non-det PolyTime(NP)• Approximation,Randomization

Functionsthatcannotbecomputedfast:• Applicationstosecurity• Encryptfast,decryptioncannotbedonefast

– RSAcryptography– webapplications

COMPUTABILITY

AUTOMATA

COMPLEXITY

Howfastcanwecomputeafunction?Howmuchmemoryspacedowerequire?

9/10/20 Theory of Computation - Fall'20 Lorenzo De Stefani 7

Page 9: CS1010: Theory of Computation - Brown Universitycs.brown.edu/courses/csci1010/files/doc/fall2020/Lecture... · 2020. 9. 10. · theory of computation: –Automata and Languages –Computability

AreasofTheoryofComputation

• Examples:– trafficsignals,– vendingmachines– hardwarecircuits– …

• Applications:– patternmatching,– modeling,– verificationofhardware,– …

COMPUTABILITY

AUTOMATA

COMPLEXITY

Whatcanwedowithmachinewithfinitememoryspace?

9/10/20 Theory of Computation - Fall'20 Lorenzo De Stefani 8

Page 10: CS1010: Theory of Computation - Brown Universitycs.brown.edu/courses/csci1010/files/doc/fall2020/Lecture... · 2020. 9. 10. · theory of computation: –Automata and Languages –Computability

Models

• Automata:– DFA/NFA– Foundationsofcomputing– Mathematicalmethodsofargument– Simplesetting

TURINGMACHINES

AUTOMATA

CONTEX-FREELANGUAGES

9/10/20 Theory of Computation - Fall'20 Lorenzo De Stefani 9

Page 11: CS1010: Theory of Computation - Brown Universitycs.brown.edu/courses/csci1010/files/doc/fall2020/Lecture... · 2020. 9. 10. · theory of computation: –Automata and Languages –Computability

Models

• Context-freelanguages– Grammars,parsing– Finitestatemachineswithrecursion(orstack)

– Stillasimplesettingbutinfinitespace

TURINGMACHINES

AUTOMATA

CONTEX-FREELANGUAGES

9/10/20 Theory of Computation - Fall'20 Lorenzo De Stefani 10

Page 12: CS1010: Theory of Computation - Brown Universitycs.brown.edu/courses/csci1010/files/doc/fall2020/Lecture... · 2020. 9. 10. · theory of computation: –Automata and Languages –Computability

Models

• Turingmachines(1940s):– Themostgeneralnotionofcomputing

– TheChurch-Turingthesis

• Allowtostudylimitsofcomputability– Canwesolveanymathematicalquestionmethodically?

– Gödel’sTheorem:NO!!!– “Eventhemostpowerfulmachinescannotsolvesomeproblems”

TURINGMACHINES

AUTOMATA

CONTEX-FREELANGUAGES

9/10/20 Theory of Computation - Fall'20 Lorenzo De Stefani 11

Page 13: CS1010: Theory of Computation - Brown Universitycs.brown.edu/courses/csci1010/files/doc/fall2020/Lecture... · 2020. 9. 10. · theory of computation: –Automata and Languages –Computability

Models• AlanTuring

– “OnComputableNumbers,withan ApplicationtotheEntscheidungs problem”(1936)

– Proveduncomputable functions exist(“haltingproblem”)

– Church-Turingthesis– CryptanalysisworkbreakingEnigmainWW2

• NoamChomsky– “LogicalStructureofLinguisticTheory”(1957)– Introducedthenotionofformallanguagesarguing

generativegrammarsareatthebaseofnaturallanguages

– Hierarchyofformallanguagesthatcoincideswithcomputation

• RabinandScott– “Finiteautomataandtheirdecisionproblems”(1959)– Introducednon-deterministicautomataandthe

formalismwestillusetoday

TURINGMACHINES

AUTOMATA

CONTEX-FREELANGUAGES

COMPLEXITY

FORMALIZATION

9/10/20 Theory of Computation - Fall'20 Lorenzo De Stefani 12

Page 14: CS1010: Theory of Computation - Brown Universitycs.brown.edu/courses/csci1010/files/doc/fall2020/Lecture... · 2020. 9. 10. · theory of computation: –Automata and Languages –Computability

AboutthisCourse

• TheoryofComputationtraditionallyconsideredchallenging– Iexpect(andhope)thatyouwillfindthistobetrue=)

• Averydifferentkindofcourse– Inmanyways,apuretheorycourse

• Butverygrounded(themodelsofcomputationarenotabstractatall)– Proofsareanintegralpartofthecourse,althoughIandthetextbothrely

oninformalproofs• Butthereasoningmuststillbeclear

• Theonlywaytolearnthismaterialisbydoingproblems– Youshouldexpecttospendseveralhoursperweekonhomework– Youshouldexpecttoreadpartsofthetext2-3times– Donotgiveupafter5minutesifyouarestumpedbyaproblem!

9/10/20 Theory of Computation - Fall'20 Lorenzo De Stefani 13

Page 15: CS1010: Theory of Computation - Brown Universitycs.brown.edu/courses/csci1010/files/doc/fall2020/Lecture... · 2020. 9. 10. · theory of computation: –Automata and Languages –Computability

CourseStaff

9/10/20 Theory of Computation - Fall'20 Lorenzo De Stefani 14

http://cs.brown.edu/courses/csci1010/index.html

Page 16: CS1010: Theory of Computation - Brown Universitycs.brown.edu/courses/csci1010/files/doc/fall2020/Lecture... · 2020. 9. 10. · theory of computation: –Automata and Languages –Computability

Textbookandcoursematerials• Textbook:MichaelSipserIntroductiontoTheoryofComputation(2nd ed.recommended;1st ed maybeok)

• Coursewebsite:https://cs.brown.edu/courses/csci1010/– UsethecourseSyllabusforreference– LectureSlidesavailableonthewebsiteafterclass– Homeworkassignmentspublishedonthewebsite– Solutionswillbeposted2daysafterthedeadlines

• Lectures:– ZoomlinkstolikelecturesandvideosonCanvas(dodistribute

them)

• Piazza:

– GreatwaytointeractwithTAsandpeers!Useitalot!

9/10/20 Theory of Computation - Fall'20 Lorenzo De Stefani 15

Page 17: CS1010: Theory of Computation - Brown Universitycs.brown.edu/courses/csci1010/files/doc/fall2020/Lecture... · 2020. 9. 10. · theory of computation: –Automata and Languages –Computability

HomeworkandMidterms

9/10/20 CS1570 - Fall'20 Lorenzo De Stefani 16

• Homework(ormidterm)everyweek:Postingdatesandhand-backdatespostedonthewebsite.Oneweektotaltimeforeachhomework.– Workinagroup,butthinkandtrytosolveeachproblemyourself!

– Listyoucollaboratorsonyoursubmission– Alwayswriteyourownsolutions– Donot“distributetheproblemswithinthegroup”– Usepiazza

• 2take-homeMidtermseachcoveringthefirst(resp.,second)partoftheclass.– Oneweekforeachmidtermassignment– Nocollaborationisallowed!– TAswillonlyanswerquestionsregardingclarificationsontheassignments– QuestionsshouldbeaskedprivatelyonPiazza

Page 18: CS1010: Theory of Computation - Brown Universitycs.brown.edu/courses/csci1010/files/doc/fall2020/Lecture... · 2020. 9. 10. · theory of computation: –Automata and Languages –Computability

HomeworkandMidterms

9/10/20 CS1570 - Fall'20 Lorenzo De Stefani 17

• AssignmentssubmittedusingGradescope.• Berigorousbutnotexcessivelyverbose• Simplelatepolicy:

– A “budget”of4totaldays,– Youcanuseupto2daysforanassignments– Requestsforextensiondueatleast24hoursbeforedeadlineusing

Googleformavailableonline(https://docs.google.com/forms/d/e/1FAIpQLScBRrM_B4HjJMp5m-rq9Ud9vRa9JU-y5i8ylMgOma3SudWYLw/viewform)

• Atthebeginningofthecourse,allstudentsarerequiredtosubscribetothecollaborationpolicy(https://forms.gle/1KzmBgLqGxWZ4gv86)

Page 19: CS1010: Theory of Computation - Brown Universitycs.brown.edu/courses/csci1010/files/doc/fall2020/Lecture... · 2020. 9. 10. · theory of computation: –Automata and Languages –Computability

Howtodowell• Youmustunderstandtheconceptswell!

– Ifyoudonot,thereisalmostnochanceofsuccess=(• Ifyoudounderstandtheconcepts,thereisverylittleelsetolearn!

– Youcandoreallywell=D• Youmustdoproblems.There’snoreplacementforthis.

– Discussproblemsandsolutionsingroupbutalwayswriteyourownsolutions• Attendinglecturesishighlyadvised!• Don’tpostponelearning;youwillnotbeableto“makeup”later.

– Startthehomeworkearlyon!• Topicsgethardquickly.• Cometoofficehours!• Participateinclass!!!

9/10/20 Theory of Computation - Fall'20 Lorenzo De Stefani 18