Computation, Computers, and Programs. Administrivia. Resources. Course texts: Kozen: Introduction to Computability Hickey: Introduction to OCaml

Similar documents
Material from Recitation 1

Source of Slides: Introduction to Automata Theory, Languages, and Computation By John E. Hopcroft, Rajeev Motwani and Jeffrey D.

Cardinality of Sets. Washington University Math Circle 10/30/2016

I have read and understand all of the instructions below, and I will obey the Academic Honor Code.

Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama

1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1}

Comparing sizes of sets

CSE 20 DISCRETE MATH. Fall

Let A(x) be x is an element of A, and B(x) be x is an element of B.

Regarding Python level necessary for the course

Infinity and Uncountability. Countable Countably infinite. Enumeration

A B. bijection. injection. Section 2.4: Countability. a b c d e g

MATH 22 MORE ABOUT FUNCTIONS. Lecture M: 10/14/2003. Form follows function. Louis Henri Sullivan

Problems, Languages, Machines, Computability, Complexity

Computer Sciences Department

Outline. Language Hierarchy

Languages and Automata

Section 1.7 Sequences, Summations Cardinality of Infinite Sets

CS402 - Theory of Automata Glossary By

Section 2.4 Sequences and Summations

W13:Homework:H07. CS40 Foundations of Computer Science W13. From 40wiki

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

MATHEMATICS 191, FALL 2004 MATHEMATICAL PROBABILITY Outline #1 (Countability and Uncountability)

Lecture 5: The Halting Problem. Michael Beeson

MITOCW watch?v=4dj1oguwtem

Calculating Cardinalities

INTRODUCTION PRINCIPLES OF PROGRAMMING LANGUAGES. Norbert Zeh Winter Dalhousie University 1/10

THREE LECTURES ON BASIC TOPOLOGY. 1. Basic notions.

.Math 0450 Honors intro to analysis Spring, 2009 Notes #4 corrected (as of Monday evening, 1/12) some changes on page 6, as in .

COSE212: Programming Languages. Lecture 0 Course Overview

2. Functions, sets, countability and uncountability. Let A, B be sets (often, in this module, subsets of R).

CSE 20 DISCRETE MATH. Winter

CS103 Handout 14 Winter February 8, 2013 Problem Set 5

Cardinality of Sets MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Cardinality of Sets Fall / 15

CMSC330 Fall 2016 Midterm #2 2:00pm/3:30pm

TOPOLOGY, DR. BLOCK, FALL 2015, NOTES, PART 3.

Context-Free Grammars

Point-Set Topology 1. TOPOLOGICAL SPACES AND CONTINUOUS FUNCTIONS

To illustrate what is intended the following are three write ups by students. Diagonalization

Introduction to Sets and Logic (MATH 1190)

CS 4349 Lecture August 21st, 2017

Enumerations and Turing Machines

Lexical Analysis. Lecture 2-4

W13:Homework:H08. CS40 Foundations of Computer Science W13. From 40wiki

Lecture-12: Closed Sets

COMP 117: Internet-scale Distributed Systems Lessons from the World Wide Web

Cantor s Diagonal Argument for Different Levels of Infinity

1.7 The Heine-Borel Covering Theorem; open sets, compact sets

Compilers for Modern Architectures Course Syllabus, Spring 2015

Context-Free Grammars

CSC Discrete Math I, Spring Sets

CSC-461 Exam #2 April 16, 2014

COMPUTABILITY THEORY AND RECURSIVELY ENUMERABLE SETS

San Jose State University College of Science Department of Computer Science CS151, Object-Oriented Design, Sections 1, 2, and 3, Spring 2018

Today s Topics. What is a set?

CS503 Advanced Programming I CS305 Computer Algorithms I

Database Systems Management

Syllabus CS 301: Data Structures Spring 2015

Figure 1.1: This is an illustration of a generic set and its elements.

CSci 4211: Introduction to Computer Networks. Time: Monday and Wednesday 2:30 to 3:45 pm Location: Smith Hall 231 Fall 2018, 3 Credits

Computability, Cantor s diagonalization, Russell s Paradox, Gödel s s Incompleteness, Turing Halting Problem.

CS103 Handout 13 Fall 2012 May 4, 2012 Problem Set 5

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

CSE 332: Data Structures. Spring 2016 Richard Anderson Lecture 1

Cardinality Lectures

CS 241 Data Organization. August 21, 2018

CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM

CSE Theory of Computing Spring 2018 Project 2-Finite Automata

Principles of Compiler Construction ( )

6 NFA and Regular Expressions

Turing Machine Languages

Theory of Computation Dr. Weiss Extra Practice Exam Solutions

Example: NFA to DFA Conversion

Math 187 Sample Test II Questions

CS 3512, Spring Instructor: Doug Dunham. Textbook: James L. Hein, Discrete Structures, Logic, and Computability, 3rd Ed. Jones and Barlett, 2010

Functions. Def. Let A and B be sets. A function f from A to B is an assignment of exactly one element of B to each element of A.

CMPSCI 250: Introduction to Computation. Lecture #1: Things, Sets and Strings David Mix Barrington 22 January 2014

MATH 139 W12 Review 1 Checklist 1. Exam Checklist. 1. Introduction to Predicates and Quantified Statements (chapters ).

What Is Computer Science? The Scientific Study of Computation. Expressing or Describing

CS 374: Algorithms & Models of Computation

CS5371 Theory of Computation. Lecture 8: Automata Theory VI (PDA, PDA = CFG)

Continuity and Tangent Lines for functions of two variables

Course and Contact Information. Course Description. Course Objectives

CSci 4211: Data Communications and Computer Networks. Time: Monday and Wednesday 1 pm to 2:15 pm Location: Vincent Hall 16 Spring 2016, 3 Credits

CSC 326H1F, Fall Programming Languages. What languages do you know? Instructor: Ali Juma. A survey of counted loops: FORTRAN

Compilers. Computer Science 431

Functions. How is this definition written in symbolic logic notation?

CS 200, Section 1, Programming I, Fall 2017 College of Arts & Sciences Syllabus

Theory of Programming Languages COMP360

(a) R=01[((10)*+111)*+0]*1 (b) ((01+10)*00)*. [8+8] 4. (a) Find the left most and right most derivations for the word abba in the grammar

HW 1 CMSC 452. Morally DUE Feb 7 NOTE- THIS HW IS THREE PAGES LONG!!! SOLUTIONS THROUGOUT THIS HW YOU CAN ASSUME:

T. Background material: Topology

CS314: FORMAL LANGUAGES AND AUTOMATA THEORY L. NADA ALZABEN. Lecture 1: Introduction

CS243, Logic and Computation Sets, functions, and languages

CSE Theory of Computing Spring 2018 Project 2-Finite Automata

CS 241 Data Organization using C

Johns Hopkins Math Tournament Proof Round: Point Set Topology

CS2 Practical 2 CS2Ah

Surfaces and Partial Derivatives

LOGIC AND DISCRETE MATHEMATICS

Transcription:

CS20a: Computation, Computers, Programs Instructor: Jason Hickey Email: jyh@cs.caltech.edu Office hours: TR 10-11am TAs: Nathan Gray (n8gray@cs.caltech.edu) Brian Aydemir (emre@cs.caltech.edu) Jason Frantz (frantz@its.caltech.edu) TBA (tba@devnull.com) http://www.cs.caltech.edu/~cs20/a October 1, 2002 1 Administrivia Course texts: Kozen: Introduction to Computability Hickey: Introduction to OCaml You must have a CS account. Sign up at http://sysadmin.cs.caltech.edu http://www.cs.caltech.edu/~cs20/a October 1, 2002 2 Resources All course material is posted on the course website (there are no physical handouts): http://www.cs.caltech.edu/~cs20/a Mail: Send requests to course admin at cs20-admin@metaprl.org You are encouraged to submit homework via Osaka To submit HW1, use cs134-submit hw1 CS20 technical mail to jyh@cs.caltech.edu is usually ignored General course announcements are posted to cs20- class@metaprl.org To subscribe, send email to cs20-class-subscribe@metaprl.org The rest of the message doesn t matter http://www.cs.caltech.edu/~cs20/a October 1, 2002 3

Prerequisites CS20 is typically taken 2 nd year undergrad. CS1,2 or equivalent is required. Basic knowledge of algorithms and discrete data structures. Knowledge of some programming in a basic imperative language like C/C++, Pascal, Modula 3, Java, Oberon, Eiffel, etc. http://www.cs.caltech.edu/~cs20/a October 1, 2002 4 Course work There are 9 homeworks, due each Monday One midterm and final Extension policy You get 8 24-hour extensions, use up to 2 on any assignment Submit with cs20-submit, extend with cs20-extend Extensions are only for HW/labs, not exams http://www.cs.caltech.edu/~cs20/a October 1, 2002 5 Grading policy Grade distribution Homework/Labs: 50%, Midterm: 20%, Final: 30% Style grading Written work 10% style, labs 20% style Due dates Assignments are due 11:59pm on due date Late penalties 25% penalty up to 1 week late 50% 2 weeks late No credit after that There will be extra credit work You can get a grading summary online http://www.cs.caltech.edu/~cs20/a October 1, 2002 6

Grading policy Collaboration is encouraged on homeworks and labs. You may discuss the problems freely, but you must write your code and homework submissions yourself. See the Policy page on the course web site. Solutions are posted on the due date. Do not look at them if you have not completed the assignment. http://www.cs.caltech.edu/~cs20/a October 1, 2002 7 Laboratory assignments Typically, each homework will include a lab component. For labs, we will be using the OCaml programming language You can work at home, or the machines in JRG 154 Lab submissions must be online using Osaka grader HW/Lab assignments will take roughly 6 hours/week. OCaml If you like, you may take CS11 concurrently http://www.cs.caltech.edu/~cs20/a October 1, 2002 8 Year outline CS20a: computability What is computable? CS20b: complexity What is effectively computable? CS20c: TBA http://www.cs.caltech.edu/~cs20/a October 1, 2002 9

CS20: Fundamental concepts in CS The CS20 series is primarily a theory course You will learn fundamental concepts like: Computability: what is computable, what is hard to compute? Computational models Automata, Turing machines, recursive functions, lambda calculus, Programs What is a program or specification? When are two programs equal? What is a proof? http://www.cs.caltech.edu/~cs20/a October 1, 2002 10 CS20a: Computability Automata theory Formal languages Program equivalence Basic computational models Automata Recursive functions Lambda calculus Turing machines Recursive, recursively-enumerable sets http://www.cs.caltech.edu/~cs20/a October 1, 2002 11 CS20a: Course Outline Regular languages Deterministic Finite Automata (DFAs) Nondeterministic Finite Automata (NFAs) Context-free languages Pushdown automata (non/deterministic) (PDAs) Recursive, R.E. languages Turing machines http://www.cs.caltech.edu/~cs20/a October 1, 2002 12

Basic set theory We take the naïve point of view regarding sets The meaning of the word set is intuitively obvious We will deal with sets in an intuitive manner Careless use of set theory can lead to contradiction Russell s paradox: what is the set of all sets that do not contain themselves? Notation Lowercase letters stand for elements Uppercase letters stand for sets a A http://www.cs.caltech.edu/~cs20/a October 1, 2002 13 Set predicates, construction a is a member of A: a A set A is a subset of set B: A B set A is a proper subset of set B: A B set A has elements a, b, c: A ={a, b, c} Comprehe is used to collect all the elements of a set A that have some property P B ={i i is an even integer} http://www.cs.caltech.edu/~cs20/a October 1, 2002 14 Basic set operations The symbol means or (and it is inclusive) The symbol means and A B {x x A x B} A B {x x A x B} The power set: 2 A {B B A} Difference A B {x x A x B} http://www.cs.caltech.edu/~cs20/a October 1, 2002 15

Cartesian product A B {(a, b) a A b B} A relation R on a set A is a set of ordered pairs from A: R A A We often write a 1 Ra 2 for (a 1,a 2 ) R For example, consider the relation < {(0, 1), (0, 2),...,(1, 2), (1, 3),...}. We write i<jif (i, j) <. http://www.cs.caltech.edu/~cs20/a October 1, 2002 16 Orders An equivalence relation R on a set A has the following properties: For each x A, xrx. If xry,thenyrx. If xryand yrz,thenxrz. A total order R on a set A is a relation with the following properties: If x y, thenxryor yrx. For no x A does xrxhold. If xry,andyrz,thenxrz. http://www.cs.caltech.edu/~cs20/a October 1, 2002 17 Functions A function f : A B is a relation (f A B), and it is single-valued: If (a 1,b 1 ) f and (a 2,b 2 ) f and a 1 = a 2,then b 1 = b 2. An injection: iff(a 1 ) = f(a 2 ),thena 1 = a 2. A surjection: for each b B, there is an a such that f(a) = b. A bijection is an injection and a surjection. http://www.cs.caltech.edu/~cs20/a October 1, 2002 18

Examples Natural numbers: N {0, 1, 2, 3,...} Real numbers: R Nonnegative reals: R + {x R x 0} f(x)= x 2 is neither an injection nor a surjection on R R f(x)= x 2 is an injection on N N f(x)= x 2 is a bijection on R + R + http://www.cs.caltech.edu/~cs20/a October 1, 2002 19 Countable sets AsetA is finite if there is a bijection A {1,...,n} for some n N. A set is infinite if it is not finite. A set A is countable if it is finite, or it is infinite and there is a bijection f : N A. A set is uncountable if it is not countable. http://www.cs.caltech.edu/~cs20/a October 1, 2002 20 Countable examples Theorem The set N N is countable. Proof (by picture) 10 14 6 9 13 3 5 8 12 1 2 4 7 11 http://www.cs.caltech.edu/~cs20/a October 1, 2002 21

Countable examples Real proof Let f(x,y)= (x + y 1,y). Let g(x,y) = (x 1)x/2 + y. Then g f is a bijection N N N. Corollary The set of rationals Q is countable. http://www.cs.caltech.edu/~cs20/a October 1, 2002 22 Reals are uncountable (Cantor) Theorem The real numbers R are uncountable. Proof 1. Assume [0, 1) is countable, and enumerate the interval. 2. Construct a new number by selecting digits along thediagonal,whereifthen th digit of the n th number is i, then th digit of the constructed number is some digit other than i and not 0 and not 9. 3. The constructed number is not in the list. http://www.cs.caltech.edu/~cs20/a October 1, 2002 23 Reals are uncountable Cantor s diagonalization argument 0 0. 7 3 5 9 2... 1 0. 3 7 7 1 8... 2 0. 0 0 1 0 0... 3 0. 9 7 9 1 4... 4 0. 8 1 5 2 5... 5 0. 6 6 6 0 0... 0. 4 1 8 3 1... http://www.cs.caltech.edu/~cs20/a October 1, 2002 24

Countability in the plane It is possible to draw an uncountable number of circles on the plane For each real number x, draw a circle of radius x about the origin http://www.cs.caltech.edu/~cs20/a October 1, 2002 25 What about non-intersecting figure-8s? http://www.cs.caltech.edu/~cs20/a October 1, 2002 26 Figure-8s Theorem Only a countable number of non-intersecting figure-8s can be drawn on the plane. (Semi) proof 1. The real numbers R and the rational numbers Q are dense: for any two numbers a<b,thereisa third such that a<c<b. 2. Each figure-8 can be uniquely identified by choosing two rational numbers, one in each loop. 3. Since Q is countable, so is Q Q, so the number offigure-8siscountable. http://www.cs.caltech.edu/~cs20/a October 1, 2002 27