1 / 248

Module 1: Course Overview

Module 1: Course Overview. Course: CSE 460 Instructor: Dr. Eric Torng Grader/TA: To be determined. What is this course?. Philosophy of computing course We take a step back to think about computing in broader terms Science of computing course

Download Presentation

Module 1: Course Overview

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Module 1: Course Overview • Course: CSE 460 • Instructor: Dr. Eric Torng • Grader/TA: To be determined

  2. What is this course? • Philosophy of computing course • We take a step back to think about computing in broader terms • Science of computing course • We study fundamental ideas/results that shape the field of computer science • “Applied” computing course • We learn study a broad range of material with relevance to computing today

  3. Phil. of life What is the purpose of life? What are we capable of accomplishing in life? Are there limits to what we can do in life? Why do we drive on parkways and park on driveways? Phil. of computing What is the purpose of programming? What can we achieve through programming? Are there limits to what we can do with programs? Why don’t debuggers actually debug programs? Philosophy

  4. Physics Study of fundamental physical laws and phenomenon like gravity and electricity Engineering Governed by physical laws Our material Study of fundamental computational laws and phenomenon like undecidability and universal computers Programming Governed by computational laws Science

  5. Applied computing • Applications are not immediately obvious • In some cases, seeing the applicability of this material requires advanced abstraction skills • Every year, there are people who leave this course unable to see the applicability of the material • Others require more material in order to completely understand their application • for example, to understand how regular expressions and context-free grammars are applied to the design of compilers, you need to take a compilers course

  6. Some applications • Important programming languages • regular expressions (perl) • finite state automata (used in hardware design) • context-free grammars • Proofs of program correctness • Subroutines • Using them to prove problems are unsolvable • String searching/Pattern matching • Algorithm design concepts such as recursion

  7. Fundamental Theme * • What are the capabilities and limitations of computers and computer programs? • What can we do with computers/programs? • Are there things we cannot do with computers/programs?

  8. Module 2: Fundamental Concepts • Problems • Programs • Programming languages

  9. Problems We view solving problems as the main application for computer programs

  10. Inputs Outputs Definition • A problem is a mapping or function between a set of inputs and a set of outputs • Example Problem: Sorting (4,2,3,1) (1,2,3,4) (3,1,2,4) (1,5,7) (7,5,1) (1,2,3) (1,2,3)

  11. How to specify a problem • Input • Describe what an input instance looks like • Output • Describe what task should be performed on the input • In particular, describe what output should be produced

  12. Example Problem Specifications* • Sorting problem • Input • Integers n1, n2, ..., nk • Output • n1, n2, ..., nk in nondecreasing order • Find element problem • Input • Integers n1, n2, …, nk • Search key S • Output • yes if S is in n1, n2, …, nk, no otherwise

  13. Programs Programs solve problems

  14. Purpose • Why do we write programs? • One answer • To solve problems • What does it mean to solve a problem? • Informal answer: For every legal input, a correct output is produced. • Formal answer: To be given later

  15. Programming Language • Definition • A programming language defines what constitutes a legal program • Example: a pseudocode program may not be a legal C++ program which may not be a legal C program • A programming language is typically referred to as a “computational model” in a course like this.

  16. C++ • Our programming language will be C++ with minor modifications • Main procedure will use input parameters in a fashion similar to other procedures • no argc/argv • Output will be returned • type specified by main function type

  17. Maximum Element Problem • Input • integer n ≥ 1 • List of n integers • Output • The largest of the n integers

  18. C++ Program which solves the Maximum Element Problem* int main(int A[], int n) { int i, max; if (n < 1) return (“Illegal Input”); max = A[0]; for (i = 1; i < n; i++) if (A[i] > max) max = A[i]; return (max); }

  19. Fundamental Theme Exploring capabilities and limitations of C++ programs

  20. Restating the Fundamental Theme * • We will study the capabilities and limits of C++ programs • Specifically, we will try and identify • What problems can be solved by C++ programs • What problems cannot be solved by C++ programs

  21. Question • Is C++ general enough? • Or is it possible that there exists some problem P such that • P can be solved by some program P in some other reasonable programming language • but P cannot be solved by any C++ program?

  22. Church’s Thesis (modified) • We have no proof of an answer, but it is commonly accepted that the answer is no. • Church’s Thesis (three identical statements) • C++ is a general model of computation • Any algorithm can be expressed as a C++ program • If some algorithm cannot be expressed by a C++ program, it cannot be expressed in any reasonable programming language

  23. Summary * • Problems • When we talk about what programs can or cannot “DO”, we mean what PROBLEMS can or cannot be solved

  24. Module 3: Classifying Problems • One of the main themes of this course will be to classify problems in various ways • By solvability • Solvable, “half-solvable”, unsolvable • We will focus our study on decision problems • function (one correct answer for every input) • finite range (yes or no is the correct output)

  25. Set of Problems Subset 1 Subset 2 Subset 3 Classification Process • Take some set of problems and partition it into two or more subsets of problems where membership in a subset is based on some shared problem characteristic

  26. Set of All Problems Solvable Problems Unsolvable Problems Classify by Solvability • Criteria used is whether or not the problem is solvable • that is, does there exist a C++ program which solves the problem?

  27. Set of All Problems Non-Function Problems Function Problems Function Problems • We will focus on problems where the mapping from input to output is a function

  28. Inputs Outputs General (Relation) Problem • the mapping is a relation • that is, more than one output is possible for a given input

  29. Inputs Outputs Criteria for Function Problems • mapping is a function • unique output for each input

  30. 1 3 9 Inputs Outputs Example Non-Function Problem • Divisor Problem • Input: Positive integer n • Output: A positive integral divisor of n 9

  31. 10 Inputs Outputs Example Function Problems • Sorting • Multiplication Problem • Input: 2 integers x and y • Output: xy 2,5

  32. 1 3 9 Inputs Outputs Another Example * • Maximum divisor problem • Input: Positive integer n • Output: size of maximum divisor of n smaller than n 9

  33. Set of Function Problems Non-Decision Problems Decision Problems Decision Problems • We will focus on function problems where the correct answer is always yes or no

  34. Yes No Inputs Outputs Criteria for Decision Problems • Output is yes or no • range = {Yes, No} • Note, problem must be a function problem • only one of Yes/No is correct

  35. (1,3,2,4) Yes (1,2,3,4) No Inputs Outputs Example • Decision sorting • Input: list of integers • Yes/No question: Is the list in nondecreasing order?

  36. (3,5,14) Yes (3,5,15) No Inputs Outputs Another Example • Decision multiplication • Input: Three integers x, y, z • Yes/No question: Is xy = z?

  37. (14,5) Yes (14,7) No Inputs Outputs A Third Example * • Decision Divisor Problem • Input: Two integers x and y • Yes/No question: Is y a divisor of x?

  38. Other Probs Decision Problems Set of All Problems Solvable Problems Unsolvable Problems Focus on Decision Problems • When studying solvability, we are going to focus specifically on decision problems • There is no loss of generality, but we will not explore that here

  39. Set of All Problems Finite Domain Problems Infinite Domain Problems Finite Domain Problems • These problems have only a finite number of inputs

  40. Set of All Problems Infinite Domain Finite Domain Empty Solvable Problems Unsolvable Problems Lack of Generality • All finite domain problems can be solved using “table lookup” idea

  41. Table Lookup Program int main(string x) { switch x { case “Bill”: return(3); case “Judy”: return(25); case “Tom”: return(30); default: cerr << “Illegal input\n”; }

  42. Key Concepts • Classification Theme • Decision Problems • Important subset of problems • We can focus our attention on decision problems without loss of generality • Same is not true for finite domain problems • Table lookup

  43. Module 4: Formal Definition of Solvability • Analysis of decision problems • Two types of inputs:yes inputs and no inputs • Language recognition problem • Analysis of programs which solve decision problems • Four types of inputs: yes, no, crash, loop inputs • Solving and not solving decision problems • Classifying Decision Problems • Formal definition of solvable and unsolvable decision problems

  44. Analyzing Decision Problems Can be defined by two sets

  45. Set of All Legal Inputs Yes Inputs No Inputs Decision Problems and Sets • Decision problems consist of 3 sets • The set of legal input instances (or universe of input instances) • The set of “yes” input instances • The set of “no” input instances

  46. Redundancy * • Only two of these sets are needed; the third is redundant • Given • The set of legal input instances (or universe of input instances) • This is given by the description of a typical input instance • The set of “yes” input instances • This is given by the yes/no question • We can compute • The set of “no” input instances

  47. Typical Input Universes • S*: The set of all finite length strings over finite alphabet S • Examples • {a}*: {/\, a, aa, aaa, aaaa, aaaaa, … } • {a,b}*: {/\, a, b, aa, ab, ba, bb, aaa, aab, aba, abb, … } • {0,1}*: {/\, 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, … } • The set of all integers • If the input universe is understood, a decision problem can be specified by just giving the set of yes input instances

  48. Language Recognition Problem • Input Universe • S* for some finite alphabet S • Yes input instances • Some set L subset of S* • No input instances • S* - L • When S is understood, a language recognition problem can be specified by just stating what L is.

  49. Traditional Formulation Input A string x over some finite alphabet S Task Is x in some language L subset of S*? 3 set formulation Input Universe S* for a finite alphabet S Yes input instances Some set L subset of S* No input instances S* - L When S is understood, a language recognition problem can be specified by just stating what L is. Language Recognition Problem *

  50. Equivalence of Decision Problems and Languages • All decision problems can be formulated as language recognition problems • Simply develop an encoding scheme for representing all inputs of the decision problem as strings over some fixed alphabet S • The corresponding language is just the set of strings encoding yes input instances • In what follows, we will often use decision problems and languages interchangeably

More Related