Harvard CS 121 and CSCI E-121 Lecture 1: Introduction and Overview

Similar documents
Automata Theory. Şubat 2006 Tuğrul Yılmaz Ankara Üniversitesi

Honors Class (Foundations of) Informatics. Tom Verhoeff. Department of Mathematics & Computer Science Software Engineering & Technology

CS 3719 (Theory of Computation and Algorithms) Lecture 4

Turing Machines: An Introduction

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

Model 2.4 Faculty member + student

Automata and Formal Languages

3515ICT Theory of Computation Turing Machines

Computability Theory

CAs and Turing Machines. The Basis for Universal Computation

Notes on Complexity Theory Last updated: August, Lecture 1

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

The Halting Problem is Undecidable

Introduction to Automata Theory. Reading: Chapter 1

Pushdown Automata. place the input head on the leftmost input symbol. while symbol read = b and pile contains discs advance head remove disc from pile

THEORY of COMPUTATION

CSE 135: Introduction to Theory of Computation Decidability and Recognizability

Introduction to Theory of Computation

Computational Models Lecture 8, Spring 2009

6.080/6.089 GITCS Feb 12, Lecture 3

Overview of E0222: Automata and Computability

Chapter 3. Cartesian Products and Relations. 3.1 Cartesian Products

Pushdown automata. Informatics 2A: Lecture 9. Alex Simpson. 3 October, School of Informatics University of Edinburgh als@inf.ed.ac.

Automata and Computability. Solutions to Exercises

Universality in the theory of algorithms and computer science

A Working Knowledge of Computational Complexity for an Optimizer

CMPSCI 250: Introduction to Computation. Lecture #19: Regular Expressions and Their Languages David Mix Barrington 11 April 2013

Turing Machines, Part I

Mathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson

THE TURING DEGREES AND THEIR LACK OF LINEAR ORDER

Chapter 1. Computation theory

NP-Completeness and Cook s Theorem

Master of Arts in Mathematics

Cardinality. The set of all finite strings over the alphabet of lowercase letters is countable. The set of real numbers R is an uncountable set.

Introduction to formal semantics -

Reading 13 : Finite State Automata and Regular Expressions

Implementation of Recursively Enumerable Languages using Universal Turing Machine in JFLAP

MACM 101 Discrete Mathematics I

How To Understand The Theory Of Computer Science

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 4 Nancy Lynch

Introduction to computer science

Regular Languages and Finite Automata

Complexity Classes P and NP

CSC4510 AUTOMATA 2.1 Finite Automata: Examples and D efinitions Definitions

Lecture 1. Basic Concepts of Set Theory, Functions and Relations

Lecture 16 : Relations and Functions DRAFT

Philadelphia University Faculty of Information Technology Department of Computer Science First Semester, 2007/2008.

Primes in Sequences. Lee 1. By: Jae Young Lee. Project for MA 341 (Number Theory) Boston University Summer Term I 2009 Instructor: Kalin Kostadinov

Informatique Fondamentale IMA S8

(IALC, Chapters 8 and 9) Introduction to Turing s life, Turing machines, universal machines, unsolvable problems.

How To Compare A Markov Algorithm To A Turing Machine

Chapter 7 Uncomputability

Page 1. CSCE 310J Data Structures & Algorithms. CSCE 310J Data Structures & Algorithms. P, NP, and NP-Complete. Polynomial-Time Algorithms

C H A P T E R Regular Expressions regular expression

Eastern Washington University Department of Computer Science. Questionnaire for Prospective Masters in Computer Science Students

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2

CHAPTER 3. Methods of Proofs. 1. Logical Arguments and Formal Proofs

CS 301 Course Information

8 Primes and Modular Arithmetic

CS103B Handout 17 Winter 2007 February 26, 2007 Languages and Regular Expressions

Binary Adders: Half Adders and Full Adders

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness

Computer Science Theory. From the course description:

CS154. Turing Machines. Turing Machine. Turing Machines versus DFAs FINITE STATE CONTROL AI N P U T INFINITE TAPE. read write move.

MATH 60 NOTEBOOK CERTIFICATIONS

The Classes P and NP

Computer Architecture Syllabus of Qualifying Examination

Automated Theorem Proving - summary of lecture 1

Introduction to Turing Machines

Regular Languages and Finite State Machines

So let us begin our quest to find the holy grail of real analysis.

Diagonalization. Ahto Buldas. Lecture 3 of Complexity Theory October 8, Slides based on S.Aurora, B.Barak. Complexity Theory: A Modern Approach.

Handout #1: Mathematical Reasoning

WHAT ARE MATHEMATICAL PROOFS AND WHY THEY ARE IMPORTANT?

Properties of Real Numbers

MATH10040 Chapter 2: Prime and relatively prime numbers

Finite Automata and Formal Languages

CS 341: Foundations of Computer Science II elearning Section Syllabus, Spring 2015

CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 313]

Computing exponents modulo a number: Repeated squaring

Creating, Solving, and Graphing Systems of Linear Equations and Linear Inequalities

Lecture 7: NP-Complete Problems

Models of Sequential Computation

Theorem3.1.1 Thedivisionalgorithm;theorem2.2.1insection2.2 If m, n Z and n is a positive

o-minimality and Uniformity in n 1 Graphs

SRM UNIVERSITY FACULTY OF ENGINEERING & TECHNOLOGY SCHOOL OF COMPUTING DEPARTMENT OF SOFTWARE ENGINEERING COURSE PLAN

Sequence of Mathematics Courses

This asserts two sets are equal iff they have the same elements, that is, a set is determined by its elements.

Theoretical Computer Science (Bridging Course) Complexity

SIMS 255 Foundations of Software Design. Complexity and NP-completeness

T Reactive Systems: Introduction and Finite State Automata

Compiler Construction

On the Structure of Turing Universe: The Non-Linear Ordering of Turing Degrees

24 Uses of Turing Machines

Fundamentele Informatica II

1. Nondeterministically guess a solution (called a certificate) 2. Check whether the solution solves the problem (called verification)

Transcription:

Harvard CS 121 and CSCI E-121 Lecture 1: Introduction and Overview Harry Lewis September 3, 2013

Introduction to the Theory of Computation Computer Science 121 and CSCI E-121 Objective: Make a theory out of the idea of computation. turing.jpg 170!201 pixels 1

What is computation? Paper + Pencil Arithmetic 121 + 99 220 Abacus Calculator w/moving parts (Babbage wheels, Mark I) Ruler & compass geometry constructions Digital Computers 2

Further computing devices Programs in C, Java. The Internet and other distributed systems. Cells/DNA? The human brain? Quantum computers? For us computation will be Processing information by unlimited application of a finite set of operations or rules 3

What do we want in a theory? 4

What we would like to get past 5

What we would like to get past This must be hard because I can t figure out how do it 6

What we would like to get past This must be hard because I can t figure out how do it This must be hard because I can t figure out how do it and neither can anybody else, including a lot of really smart people 7

What we would like to get past This must be hard because I can t figure out how do it This must be hard because I can t figure out how do it and neither can anybody else, including a lot of really smart people This method seems to get the right answer on every case I ve tried 8

What we would like to get past This must be hard because I can t figure out how do it This must be hard because I can t figure out how do it and neither can anybody else, including a lot of really smart people This method seems to get the right answer on every case I ve tried It s never crashed while I was testing it so let s ship it 9

What do we want in a theory? Precision Mathematical, formal. Can prove theorems about computation, both positive (what can be computed) and negative (what cannot be computed). Generality Technology-independent, applies to the future as well as the present Abstraction: ignores inessential details (though it may pay to restore them later) 10

Inessential details Simple models are easier to reason about Once you have some model, it may pay to restore detail previously ignored Example: The UPS delivery truck Example: Boarding an airplane 11

An automaton is an abstraction A machine reading symbols from a tape A system receiving discrete impulses over time A chip 12

Representing Information Alphabet Ex: a, b, c,..., z. Strings: finite concatenation of alphabet symbols, order matters Ex: qaz, abbab ε = empty string (length 0; sometimes e) Inputs (& outputs) of computations are strings. we focus on discrete computations 13

Computational Problems (i.e. Tasks) A single question that has infinitely many different instances PARITY : given a string x, does it have an even number of a s? MAJORITY : given a string x, does it have more a s than b s? Problems are defined extensionally: a problem is the set of all instances of the question to which the answer is positive the set of all question, answer pairs 14

Examples of computational problems on numbers PRIMALITY : given a number x, is x prime? ADDITION: given two numbers x, y, compute x + y. A numerical problem is a set of binary or decimal numerals Examples of computational problems about computer programs C SYNTAX: given a string of ASCII symbols, does it follow the syntax rules for the C programming language? HALTING PROBLEM: given a computer program (say in C), can it ever get stuck in an infinite loop? 15

Computational problems from pure and applied mathematics DIOPHANTINE EQUATIONS: Given a polynomial equation (e.g. x 2 + 3xyz 44z 3 = 0), does it have an integer solution? TRAVELLING SALESMAN PROBLEM: Given a set of cities in the plane, what is the fastest way to visit them all? GRAPH 2-COLORING (3-COLORING): Given a set of people, can they be partitioned into 2 groups so that every pair of people in each group gets along? (3 groups?) 16

More examples of computational problems REGISTER ALLOCATION MULTIPROCESSOR SCHEDULING PROTEIN FOLDING DECODING ERROR-CORRECTING CODES NEURON TRAINING AUCTION WINNER MIN-ENERGY CONFIGURATION OF A GAS... 17

The (Mathematical) Idea of a Language A language: any set of strings. Solving a yes/no computational problem Deciding if a string is in a given language 18

Examples of Languages All words in the American Heritage Dictionary {a, aah, aardvark,..., zyzzva} Mathematically simple, because it s finite! All strings with an even number of a s. {ε, b, bb, aa, baa, aba, baa,...} Note: ε denotes the string of length 0 the empty string Infinite but simple membership rule All syntactically correct C programs (counting space and newline as characters) 19

Computational Models What is a computer? First try: a mathematical automaton. a a r d v... Finite Control Yes No We don t care how the control is implemented only that it have a finite number of states and change states based on fixed rules 20

Kinds of Automata Finite Automata a b a F.C. Head scans left to right Check simple patterns Finite Table Lookup Pushdown Automata Input a a b F.C. a b a a Stack Can t count without limit Use stack to count, parentheses Check many syntax rules balance 21

A model for general-purpose computers Turing Machines b a r F.C. Control is still finite Head moves left and right, reads, and writes 22

Q1: What computational problems can be solved by these automata? Finite Automata recognize the regular languages. A regular language is one that can be described by a regular expression, e.g. a generates {ε, a, aa, aaa,...} = any number of (ab) generates {ε, ab, abab, ababab,...} (a ab) a generates {???} (a ab) generates {???} 23

Q1: What computational problems can be solved by these automata? Pushdown Automata: the context-free languages. A PDA can determine whether or not strings are generated by any fixed context-free grammar, e.g. { } S asb generates {ε, ab, aabb, aaabbb,...} S ε Note: this is not the same as a b! S asb aasbb aabb 24

CFGs as models for natural languages sentence noun phrase verb noun phrase noun adjective noun phrase noun cat dog mouse adjective black hungry verb jumps barks generates {black dog jumps, hungry black cat barks,...} 25

More powerful models Turing machines: the computable languages Captures our intuitive notion of computable (Church Turing Thesis). TMs equivalent in expressiveness to C programs, LISP programs, Pentium CPU, (hypothetical) quantum computers,... Concept of computability is independent of technology! turing.jpg 170!201 pixels 26

Church s Thesis (Church-Turing Thesis) Intuitive notion of computable Formal notion of computable by a Turing Machine Are there non-computable languages? Yes in fact almost all languages are not computable What are some examples? [Problems to avoid!] 27

Q2: Are there computational problems that cannot be solved by these automata? Yes in fact almost all problems are not computable. But what are some examples? [Problems to avoid!] A non-regular problem? A non-context-free problem? Non-computable problems? 28

Classifying languages PARITY MAJORITY PRIMALITY C SYNTAX HALTING TSP 2-COLORING DIOPHANTINE EQ. FA/ PDA/ TM/ regular? context free? computable? 29

Q3: Are there computable problems that cannot be solved efficiently? A problem need not be uncomputable to be practically unsolvable (It may just take too long!) Theory of relative difficulty of problems Based on resources required: Time Memory... 30

The NP-Complete Problems TRAVELLING SALESMAN PROBLEM, GRAPH 3-COLORING, MULTIPROCESSOR SCHEDULING, PROTEIN FOLDING,... Do they have efficient algorithms? Either all do or none do! This is the famous (and still open) P vs. NP Question. 31

More NP-Complete Problems Integer Linear Program Is there a solution over the positive integers to a system like this? Boolean Satisfiability x 1 4x 2 + x 3 = 0 x 1 + x 2 + x 3 0 x 1 + 7x 3 0 Are there true/false values for the variables to make this formula true? (x y z) ( x y) ( z y) [ = or = and = not ] 32

For computer scientists Technology-independent foundations of CS. How to reason precisely about computation. Topics applicable to other parts of CS. Circuit Design Distributed Computing Parsing + Compiling Natural Language Processing Programming Langs Artificial Intelligence Algorithm Design Cryptography Finite Automata Finite Automata Context-free Languages Context-free Languages Regular Expressions, Uncomputability Finite Automata, Complexity Theory Complexity Theory Complexity Theory 33

For mathematicians A computational perspective on mathematics. Ex: which is a better formula for the n th Fibonacci number (1,1,2,3,5,8,13,21...)? 1. F n = 1 (1+ 5 5 2 ) n 1 5 (1 5 2 ) n. 2. F n = the number of strings over alphabet {a, b} of length n 2 with no two consecutive b s. 34

Connection between computation and mathematical proofs Uncomputability Gödel s Incompleteness Theorem. P vs. NP are mathematical proofs as easy to find as they are to verify? Can mathematics be automatized? Important and famous problems for Mathematics Rich interplay between the Theory of Computation and various areas of mathematics (logic, combinatorics, algebra, number theory, probability, functional analysis, algebraic geometry, topology,...). Many research opportunities. 35

For others How to recognize and interpret computational intractability in case it appears in your domain, e.g. PROTEIN FOLDING, NEURON TRAINING, AUCTION WINNER-DETERMINATION, MIN-ENERGY CONFIGURATION OF A GAS How to model computation, e.g. as it may occur in Cells/DNA, the brain, economic systems, physical systems, social networks,... 36

Philosophically interesting questions Are there well-defined problems that cannot be solved automatically? Can we always search for a solution to a puzzle more quickly than trying all possibilities? Can we formalize the idea that one problem is harder than another? 37

Prerequisites Experience in formal mathematics at the level of CS 20. Comfort reading and writing mathematical proofs. Sets (e.g. cardinality, powersets, cartesian products) Functions (e.g. one-to-one, onto, bijections) Relations (e.g. symmetric, transitive, reflexive) Graphs (e.g. directed vs. undirected) Proofs by induction Propositional logic (e.g. truth tables, De Morgan s Laws, CNF) Growth rates (O notation) You do not need to know/remember all of these concepts. 38

Strengthening your Mathematical Preparation Sipser, Chapter 0. Problem Set 0. Graded, but will not count. Strongly recommended! Open sections this week. Office Hours (mine & the TFs). Course materials for CS 20. Books by Solow and Rosen (see syllabus). If you have any doubts about your preparation, come talk to me! 39

Other Organizational Remarks No handouts, everything on the Web, including these slides Read collaboration policy carefully and respect it Lecture videos available 24 hours after lecture Sections start meeting this week, but no sectioning until next weekend One section will be a math section Use Piazza for questions, course staff monitors it Use of LaTeX for problem sets is mandatory 40