1 / 17

CSCI – 340: Computational Models

CSCI – 340: Computational Models. (Source: Textbook preface). The purpose of this course is to : . To familiarize students with the foundations and principles of computer science. To strengthen the students’ ability to carry out formal rigorous mathematical arguments.

dinah
Télécharger la présentation

CSCI – 340: Computational Models

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. CSCI – 340: Computational Models (Source: Textbook preface) The purpose of this course is to : • To familiarize students with the foundations and principles of computer science. • To strengthen the students’ ability to carry out formal rigorous mathematical arguments. • To teach material that is prerequisite to advanced computer science course such as Analysis of Algorithm, AI, and Compiler Design.

  2. Course Objectives The student who successfully completes this course should be able to: • Define, interpret, and construct finite-state automata; apply these formalisms to practical programming problems. • Define, interpret, and construct context-free grammars, pushdown automata; apply these formalisms to practical programming problems. • Define, interpret, and construct regular expressions; apply these formalisms to computer algorithms. • Understand the theory of Turing machines and its relevance to computability. • Understand the limits of algorithmic computability. • Understand the concepts of efficiency of computation, language families, and complexity classes P and NP. • Parsing Techniques. • Matrix Algebra

  3. Enforcement Of Objectives

  4. Review of Inductive Construction of Sets and Inductive Proof Techniques Example 1.1, page 5: Power Set Construction Let S = {a, b, c}. Power Set The set of all the subsets of a given set S, is called power set of S. The power set of S is denoted by p(S) or 2|S|. p(S) = {} a {, {a}} b { , {a}, {b}, {a, b}} C { , {a}, {b}, {c}, {a, b},{a, c}, {b, c}, {a, b,c}} a {, {a}} b { , {a}, {b}, {a, b}}

  5. I II |p(S)| = 2n III |p(S)| = 2n+1 Use Mathematical Induction on the size of S to show that if S is a finite set, then Mathematical Induction Basis: It is trivial to see that if S =  then |S| = 0 and Inductive hypothesis: Assume that |S| = n and The number of elements in the power set of S = 2|S| Inductive step: Let |S| = n+1; assume II is true and show that If we add 1 element to S in II, the size of the power set of S is doubled. The proof is complete.

  6. III Basis: It is clear that n = 1, Sn = 1. I Induction hypothesis: Assume that for some value of n > 1, Induction Step: Using I and II to show that II Inductive Proofs – Example 2 Prove that Example 1.6, page 11/12 Proof by mathematical induction: Denote the sum by Sn.

  7. Add n + 1 to both sides of II to obtain Another proof: , which is the same as III. Adding these two, we obtain, Inductive Proofs – Continued

  8. Composing Stamps: Example 3 Mathematical Induction Assume that we are given an infinite supply of stamps of two different denominations, 3 cents and and 5 cents. Prove using mathematical induction that it is possible to make up stamps of any value  8 cents. Outline of Proof Illustration 8 = 3 + 5 9 = 3 + 3 + 3 = 3 * 3 10 = 5 + 5 = 2 * 5 11 = 1 * 5 + 2 * 3 Basis: We can make an 8 cents stamp by using one 3-cents and one 5-cents stamp. Inductive hypothesis: Assume that we can make stamps of values k = 8, 9, 10, … n. Inductive step: Show that we can compose a stamp of value n + 1.

  9. Composing Stamps – Actual Proof Inductive step: Show that we can compose a stamp of value n + 1. In composing n, several (or none) 3-cents and several (or none)5-cents stamps have been used. To go from n to n + 1, we consider two cases. Case 1 : If there is at least one 5-cents stamp in the collection, replace it by two 3-cents stamps. This gives us stamps of value n + 1 cents. Case 2 : Suppose that the current collection uses only 3-cents stamps. Since n  8, there must three 3-cents stamps in the collection. Replace these three stamps by two 5-cents stamps. This gives us a stamp of value n + 1 cents. The proof is complete. Another Proof

  10. Implication In propositional logic "if p then q" is written as p  q and read as "p implies q". p q p  q same as p  q F F T F T T T F F T T T Review Propositional Logic – Page 1 How to remember this definition? Implication is false only when the premise is true and the consequence is false.

  11. Bi-conditional p  q means p iff q p q p  q same as F F T F T F T F F T T T Propositional Logic – Page 2 How to remember this definition? Bi-conditional is a like a magnitude comparator, it is true when both inputs are identical.

  12. More Terminology Tautology A logical expression that is always true, regardless of what truth values are assigned to its statement variables, is called a tautology. The statement p p is a tautology. Contradiction A logical expression that is always false, regardless of what truth values are assigned to its statement variables, is called a contradiction. The statement p p is a contradiction. Theorem If A and B are logical statements and if the statements A and A  B are true, then the statement B is true.

  13. Simple Logic Proofs A B A  B A (A  B) A (A  B)  B F F T F T F T T F T T F F F T T T T T T Direct Proof using a truth table Prove that A  (A  B)   B is a contradiction. A  (A  B)   B = A  (A  B)   B = (A A)  (A  B)   B using distributive law. = F  (A  B)   B = (A  B)   B = A  (B   B) using associative law = A  F = F Contradiction. Hence B must be true. Proof by contradiction

  14. An Important Theorem Among the four statements p  q statement q  p converse p  q inverse q  p contra-positive 1. The statement and its contra-positive are equivalent. 2. The converse and inverse are equivalent. 3. No other pairs in the statements given above are equivalent. Proof:Make a truth table to see that 1 and 2 are tautologies.

  15. Prove that is not a rational number. (Example 1.7, page 13) Proof: Assume is a rational number. Let m and n be two integers, with no common factor, such that This shows that is even. Proof By Contradiction 1 1 Or Since is a multiple of 2, it is an even number. Therefore, n is even must be of the form 2k for some integer k.

  16. We have concluded that both and are even, therefore, n and m are also even They must have a common factor. This contradicts our assumption. Hence is not a rational number. Proof Continued …

  17. Proof of Proposition 1

More Related