cs1010: theory of computation - brown university · 2020. 9. 10. · theory of computation:...

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

Upload: others

Post on 20-Feb-2021

10 views

Category:

Documents


0 download

TRANSCRIPT

  • CS1010:TheoryofComputation

    LorenzoDeStefaniFall2020

    Lecture0a:Introduction

  • 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

  • Whatisthiscourseabout?

    Thiscoursecovers3areas,whichmakeupthetheoryofcomputation:– AutomataandLanguages– ComputabilityTheory– ComplexityTheory

    Thiscourseisaboutthefundamentalcapabilitiesandlimitationsofcomputers/computation

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

  • 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

  • AreasofTheoryofComputation

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

    • Verificationofcorrectnessofprogramsishenceimpossible!

    COMPUTABILITY

    AUTOMATA

    COMPLEXITY

    Whatproblemscanacomputersolve?

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

  • 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

  • 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

  • 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

  • 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

  • Models

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

    TURINGMACHINES

    AUTOMATA

    CONTEX-FREELANGUAGES

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

  • Models

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

    – Stillasimplesettingbutinfinitespace

    TURINGMACHINES

    AUTOMATA

    CONTEX-FREELANGUAGES

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

  • 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

  • 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

  • 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

  • CourseStaff

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

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

  • 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

  • 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

  • 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)

  • 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