What s a computer? Language Theory and Computation. A small suan pan (Chinese abacus) Photo courtesy of the Computer History Museum

Similar documents
Theory of Computation Lecture 1. Dr. Nahla Belal

Automata Theory and Formal Grammars: Lecture 1

CS 208: Automata Theory and Logic

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

CS 455/555: Mathematical preliminaries

CSCE 551: Chin-Tser Huang. University of South Carolina

Undecidability. Andreas Klappenecker. [based on slides by Prof. Welch]

Topics COSC Administrivia. Topics Today. Administrivia (II) Acknowledgements. Slides presented May 9th and 16th,

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism,

Theory of Computation

Assignment #2 COMP 3200 Spring 2012 Prof. Stucki

Introduction to Automata

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

CS 121, Section 2. Week of September 16, 2013

Theory of Computation

Introduction to the Theory of Computing

Turing Machines, diagonalization, the halting problem, reducibility

Handouts. CS701 Theory of Computation

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

Chapter 0 Introduction. Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin

CSE 105 THEORY OF COMPUTATION

ACS2: Decidability Decidability

Understanding Computation

Definition: Let S and T be sets. A binary relation on SxT is any subset of SxT. A binary relation on S is any subset of SxS.

Models of Computation. by Costas Busch, LSU

CPS 220 Theory of Computation REGULAR LANGUAGES

Theory of Computation

CS 154 Introduction to Automata and Complexity Theory

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

1 Alphabets and Languages

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

Turing Machines Part III

34.1 Polynomial time. Abstract problems

Decidability (What, stuff is unsolvable?)

Introduction to Theoretical Computer Science. Motivation. Automata = abstract computing devices

COM364 Automata Theory Lecture Note 2 - Nondeterminism

CPSC 421: Tutorial #1

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

1.A Sets, Relations, Graphs, and Functions 1.A.1 Set a collection of objects(element) Let A be a set and a be an elements in A, then we write a A.

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

} Some languages are Turing-decidable A Turing Machine will halt on all inputs (either accepting or rejecting). No infinite loops.

What Is a Language? Grammars, Languages, and Machines. Strings: the Building Blocks of Languages

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CS 154, Lecture 3: DFA NFA, Regular Expressions

Part I: Definitions and Properties

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS

acs-07: Decidability Decidability Andreas Karwath und Malte Helmert Informatik Theorie II (A) WS2009/10

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES

Solutions to Old Final Exams (For Fall 2007)

CSE 311: Foundations of Computing. Lecture 26: More on Limits of FSMs, Cardinality

4.2 The Halting Problem

16.1 Countability. CS125 Lecture 16 Fall 2014

Mapping Reducibility. Human-aware Robotics. 2017/11/16 Chapter 5.3 in Sipser Ø Announcement:

Computational Models Lecture 8 1

Theory of Computation 1 Sets and Regular Expressions

Mathematical Preliminaries. Sipser pages 1-28

Foundations of Computer Science Lecture 23 Languages: What is Computation?

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

Introduction. Foundations of Computing Science. Pallab Dasgupta Professor, Dept. of Computer Sc & Engg INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR

Decidability. Human-aware Robotics. 2017/10/31 Chapter 4.1 in Sipser Ø Announcement:

Chapter 7 Turing Machines

CS:4330 Theory of Computation Spring Regular Languages. Finite Automata and Regular Expressions. Haniel Barbosa

CSE 105 THEORY OF COMPUTATION

10. The GNFA method is used to show that

Decidability and Undecidability

CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018


FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

CSCI3390-Lecture 6: An Undecidable Problem

Decidability: Church-Turing Thesis

Computational Models - Lecture 4

ECS 120 Lesson 18 Decidable Problems, the Halting Problem

Turing Machine Recap

Before We Start. The Pumping Lemma. Languages. Context Free Languages. Plan for today. Now our picture looks like. Any questions?

Computational Models Lecture 8 1

CSE 105 THEORY OF COMPUTATION

Uses of finite automata

Math 3361-Modern Algebra Lecture 08 9/26/ Cardinality

Fooling Sets and. Lecture 5

Turing Machines. Lecture 8

Computational Models Lecture 8 1

Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 20. To Infinity And Beyond: Countability and Computability

CSE 105 THEORY OF COMPUTATION

Complexity and NP-completeness

Theory of computation: initial remarks (Chapter 11)

CS 275 Automata and Formal Language Theory

CSE 355 Test 2, Fall 2016

Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK

CSci 311, Models of Computation Chapter 4 Properties of Regular Languages

Foundations of Informatics: a Bridging Course

CMP 309: Automata Theory, Computability and Formal Languages. Adapted from the work of Andrej Bogdanov

Computer Sciences Department

Automata and Languages

Discrete Mathematics for CS Spring 2007 Luca Trevisan Lecture 27

computability and complexity theory

UNIT-VIII COMPUTABILITY THEORY

Theory of computation: initial remarks (Chapter 11)

Further discussion of Turing machines

Transcription:

CMPU 240 Language Theory and Computation What s a computer? Spring 2019 A small suan pan (Chinese abacus) Photo courtesy of the Computer History Museum Hand-cranked Curta calculator Photos courtesy of the Computer History Museum

Some kinds of computers have more computational power than others. We can abstract devices of the same kind to produce models of computers and ask what kinds of problems can be solved under a particular model. A computer is not dependent so much on technology as on ideas. Present-day computers are built out of transistors and wires. They could be built, according to the same principles, from valves and water pipes or from sticks and strings. W. Daniel Hillis W. Daniel Hillis Mechanical implementation of the or function Hydraulic implementation of the or function

One of the most remarkable things about computers is that their essential nature transcends technology. Why do we need theory? Why study this stuff? Theoretical computer science has many fascinating big ideas, but also many small (and sometimes dull) details. The more you learn, the more interesting it becomes. Our goal: Be exposed to the exciting aspects of computer theory without getting bogged down in drudgery. Theory is relevant to practice Provides conceptual tools that practitioners use in computer engineering Design a new programming language for a special application need (context-free) grammars! String searching and pattern matching use finite automata and regular expressions!

When developing solutions to real problems, we often confront the limitations of what software can do: Undecidable things no program whatever can do it Intractable things there are programs, but no fast programs Theory gives you the tools. He who loves practice without theory is like the sailor who boards ship without a rudder and compass and never knows where he may cast. Leonardo da Vinci, Prolegomena and General Introduction to the Book on Painting Theory shows the more elegant side of computers We usually think of computers as complicated machines. The best computer designs and applications are conceived with elegance in mind. A theoretical course can heighten your aesthetic sense and help you build more elegant systems. In computer science, elegance is not a dispensable luxury, but a matter of life and death. Edsger Dijkstra

Theory expands your mind Computer technology changes quickly. Studying theory enables you to understand the underlying models of all computation, not just technical details that become outdated in a few years. How could we talk about computation? Studying theory trains you in abilities with lasting value: Think and express yourself clearly and precisely. Solve problems and know when you haven t solved a problem. Automata, computability, and complexity Linked by the question: What are the fundamental capabilities and limitations of computers? Each area interprets the question differently: Automata theory: Definitions and properties of mathematical models of computation. Computability: Is a given problem solvable or unsolvable? Complexity: Is a given problem easy or hard? Automata theory We start with automata theory: Theories of computability and complexity require a precise definition of a computer. Automata theory allows practice with formal definitions of computation as it introduces concepts relevant to other, nontheoretical areas of computer science.

The central idea in the theory of computation is that of a universal computer, a computer powerful enough to simulate any other computing device. Most computers we encounter in everyday life are universal computers. With the right software and enough time and memory they can simulate any other type of computer Universal computers

The central idea in the theory of computation is that of a universal computer, a computer powerful enough to simulate any other computing device. The idea of a universal computer was recognized and described in 1937 by Alan Turing. 1 He called it a universal machine since at the time, computer still meant a person who performs computations. Most computers we encounter in everyday life are universal computers. With the right software and enough time and memory they can simulate any other type of computer or as far as we know any other device at all that processes information. 1 Poor Alonzo Church is a footnote. Where s his movie? Hypothesis: Any computing device made of transistors, sticks and strings, or neurons can be simulated by a universal computer. This suggests that making a computer think like a brain is just a matter of programming it correctly! While a universal computer can compute anything that can be computed any other computing device, there are some things that are just impossible to compute.

Vaguely defined questions E.g., What is the meaning of life? Lack data What is the winning number in tomorrow s lottery? youtube.com/watch?v=5zltctzp2js But there are also flawlessly defined computational problems that are impossible to solve. We call these problems noncomputable. What exactly are the limits to what a computer can do? We ll work to an answer of this over the semester! This will take us through the philosophically interesting topics of nondeterminism, Turing machines, computability, Gödel s incompleteness theorem, and time allowing quantum computing.

Because computers can do some things that seem very like human thinking, people worry that they threaten our unique position as rational beings. Some people seek reassurance in mathematical proofs of the limits of computers. There have been analogous controversies in human history. Andrew Borde, The First Book of the Introduction of Knowledge, 1542 The Ptolemaic universe Far out in the uncharted backwaters of the unfashionable end of the Western spiral arm of the galaxy lies a small unregarded yellow sun. Orbiting this, at a distance of roughly ninety million miles is an utterly insignificant little blue-green planet

These philosophical crises are based on a misplaced judgment of the source of human worth, and the current philosophical discussions about the limits of computers are based on a similar misjudgment. Course overview Study categories of languages and machines: Regular languages and finite automata Context-free languages and pushdown automata Unrestricted languages and Turing machines Study solvability and efficiency: The Halting Problem NP-completeness Course information

Prerequisites CMPU 102: Data Structures and Algorithms CMPU 145: Foundations of Computer Science https://www.cs.vassar.edu/~cs240 Math?

Hillis s Connection Machine CM-2a Photo by Steve Grohe for Thinking Machines Corporation Hillis s Connection Machine CM-5 in Jurassic Park Syllabus Grades Assignments Mathematical background Exams Tips

Sets Set theory Relations and functions Recursive definitions Strings and languages Proofs Group of objects represented as a unit May contain any type of object: numbers, symbols, other sets,... Set membership: Non-membership: Subset: / Proper subset: Empty set: Infinite set contains infinitely many elements, e.g., the set of integers Z = {..., 2, 1, 0, 1, 2,...} Sets Determine the union ( ), intersection ( ), difference ( ), complement, and power set P(X) of any given sets. Prove the equality of sets X and Y: Show every element of X is an element of Y and vice versa (i.e., show that X Y and Y X to show X = Y). If X is a set, the notation X is its cardinality, i.e., the number of elements in X. Cartesian product and relations Cartesian product builds a set consisting of ordered pairs from two or more existing sets: A B = {(a, b) a A and b B} A 3 = A A A A binary relation on sets A and B is a subset of A B. An n-ary relation on sets S 1, S 2,, S n is a subset of S 1 S 2 S n

Functions A function from a set A to a set B is a mapping of elements of A to elements of B such that each element of A maps to exactly one element of B. f: A B A is the domain of f The range of f: A B is the set {b B b = f(a) for some a A}. Bijective functions A function f: A B is bijective if it is: one-to-one each element of A maps to a distinct element in the range B. onto the range is the entire set B. A total function f from A to B is a binary relation on A B such that For each a A, there is a b B such that (a, b) f. If (a, b) f and (a, c) f, then b = c. Countable and uncountable sets We divide sets into classes: Countable: finite or countably infinite A countably infinite set has the the same number of elements as the set of natural numbers N To show a set A is countably infinite, we need to show a bijective function exists from N to A. Uncountable: more elements than the set of natural numbers N Uncountable sets Prove a set X is uncountable by showing that it s impossible to sequentially list its members. Cantor s diagonalization argument is a proof by contradiction: Step 1: Assume the set is countable and therefore its members can be exhaustively listed. This listing must contain all members of the set. Step 2: Produce a member of the set that cannot occur anywhere in the listing, showing that such a listing cannot exist, and therefore the set is uncountable.

Recursive definitions of sets Recursion provides a method for generating elements of a set by specifying: basis elements explicitly a finite set of operators, used to construct the remaining elements of the set from the basis elements Generation using a finite number of operations is a fundamental property of recursive definitions. Recursive definitions of sets Example: A recursive definition of N, the set of natural numbers using the successor function, s(n) = n + 1: Basis: 0 N Recursive step: If n N, then s(n) N n N only if it can be obtained from 0 by a finite number of applications of the recursive step. Elements are: 0, s(0), s(s(0)), s(s(s(0))), 0, 1, 2, 3, Alphabet (Σ): any finite set of symbols, e.g., Languages Binary alphabet: Σ = {0, 1} ASCII: Σ = {a, b, c,..., 0, 1,...,!, @, #,...} String or word: a finite sequence of symbols chosen from some alphabet, e.g., 01101 abracadabra Convention: Use lowercase letters from the beginning of the alphabet for symbols and lowercase letters from the end of the alphabet for strings.

The length of a word w, written as w, is the number of symbols in it e.g., abcde = 5 uv = u + v The empty string, denoted by ε, is the string with no symbols in it ε = 0 String relations A string z is a substring of w if z appears consecutively in w, e.g., bat is a substring of batman Prefix and suffix: If w = vu, v and u are a prefix and a suffix of w, respectively, e.g., super is a prefix of superman man is a suffix of superman String operations Reverse: w R E.g., if w = abc, then w R = cba Concatenation: Given strings x and y, their concatenation is xy. E.g., if x = abc, and y = def, then xy = abcdef Languages A language is a set of strings chosen from some alphabet, e.g., The set of all binary strings consisting of some number of 0s followed by an equal number of 1s, i.e., {ε, 01, 0011, 000111, } The C programming language, i.e., English the set of all C programs that compile without syntax errors

More about languages Languages can be finite, e.g., L = {a, aba, bba} or infinite, e.g., L = {a n n > 0} Note: While a language can be infinite, the set of symbols it s composed of (Σ) is always finite. Powers: Σ k = set of all strings from alphabet Σ with length k Σ 0 = {ε} Σ * = set of all strings from alphabet Σ Σ + = Σ * {ε} We can concatenate languages: L 1L 2 = {xy x L 1, y L 2} L n = L concatenated with itself n times L 0 = {ε} L 1 = L Star-closure L * = L 0 L 1 L 2... (note: L + = L * L 0 ) Acknowledgments This lecture incorporates material from: Douglas Adams W. Daniel Hillis John Hopcroft Nancy Ide Michael Sipser