1 / 37

Complexity and Computability Theory I

Complexity and Computability Theory I. Lecture #2 Rina Zviel-Girshin Leah Epstein Winter 2002-2003. Overview. Proofs Finite Automaton. Proofs. Four main types: direct proof (syllogism) proof by construction proof by contradiction proof by induction. Direct proof.

eperdue
Download Presentation

Complexity and Computability Theory I

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. Complexity and Computability Theory I Lecture #2 Rina Zviel-Girshin Leah Epstein Winter 2002-2003

  2. Overview • Proofs • Finite Automaton Rina Zviel-Girshin @ASC

  3. Proofs • Four main types: • direct proof (syllogism) • proof by construction • proof by contradiction • proof by induction Rina Zviel-Girshin @ASC

  4. Direct proof axioms + rules of deduction (modus ponens)  theorems axioms + theorems + rules of deduction  theorems All philosophers are wise. Socrates is a philosopher. Socrates is wise. modus ponens: a, ab  b Rina Zviel-Girshin @ASC

  5. Proof by Construction The idea: • prove by building a solution (algorithm, automaton) Example: Theorem: There exists a graph with no edges.  Proof: Construct such a graph: Q.E.D. Rina Zviel-Girshin @ASC

  6. Proof by Contradiction The idea: • assume the opposite of the theorem • derive a contradiction Rina Zviel-Girshin @ASC

  7. Example Theorem: There does not exist a “greatest natural number” (i.e. N is infinite). Proof: Assume that there is a greatest natural number. Call it x. From our assumption it is obvious that no larger number can exist. Let y = x+1. y is greater than x. y is a natural number. Contradiction to the assumption that x is a greatest natural number. Q.E.D. Rina Zviel-Girshin @ASC

  8. Proof by Induction Three main part: • basis of induction • induction hypothesis • induction step Two types of induction: • Partial induction • Full induction Rina Zviel-Girshin @ASC

  9. Partial induction • Basis of induction – the theorem is true for some natural number k (usually 0, 1) • Induction hypothesis - we assume that the theorem is true for some n • Induction step - proof that assuming the theorem is true for n, it is true for n+1 Rina Zviel-Girshin @ASC

  10. Full induction • Basis of induction – the theorem is true for some natural number k (usually 0, 1) • Induction hypothesis - we assume that the theorem is true for all x  n • Induction step - proof that assuming theorem is true for all x  n, it is true for n+1 Rina Zviel-Girshin @ASC

  11. Example Theorem: The number of edges in a tree equals to the number of vertices minus 1 (|E|=|V|-1). Proof (by induction on number of vertices): Let n be the number of vertices. • Induction basis: for n=1, a tree of a single vertex has n-1=0 edges. The theorem is, therefore true. • Induction hypothesis:The theorem is true for some n  1 i.e. number of edges in it is n-1. • Induction step:A tree of n+1 vertices is a tree of n vertices, with addition of exactly one vertex and exactly one edge. Therefore the number of edges in the new tree is: The number of edges in a tree of n vertices +1 = (n-1) + 1 = n, where n = number of vertices in the new tree minus 1. Rina Zviel-Girshin @ASC

  12. Finite Automata Informally - our model will include basically: • states • transition between states as a reaction to some input   w: Automaton: Rina Zviel-Girshin @ASC

  13. Example Rina Zviel-Girshin @ASC

  14. Formal Definition A finite automaton FA is a 5-tuple (Q, , , q0, F), where: • Q - a finite set of states (all the legal states of the automaton) •  - alphabet (a finite set of symbols - alphabet of the input) •  - transition function - QQ (given a state and input symbol - what is the next state to be in) • q0 - q0Q is the start state (the initial state, before input) • F - FQ the set of accept states Rina Zviel-Girshin @ASC

  15. Modus operandi • Each state can be accepting or not. • The automaton reads one symbol of the input word (i.e. one letter) at a time. • On each symbol it moves to a new state (defined in transition function) by: • The current state • The symbol read • The automaton stops after the last symbol in the input word is read. • If the state in which it stops is accepting - the automaton accepts (recognized the input word). Rina Zviel-Girshin @ASC

  16. Language of an automaton • Language of an automaton A : L(A) •  Informally: the words that A accepts (recognizes), i.e. when reading them it stops in an accepting state. Rina Zviel-Girshin @ASC

  17. Graphical representation starting state not accepting state A: accepting state The language of A: L(A)= { w | |w| is even over ={0,1}} Rina Zviel-Girshin @ASC

  18. Graphical representation • A circle represents a state of the automaton. • The transition function, delta, is represented by directed and labeled edges between states. • Final states have a double circle. • The start state has an incoming arrow. Rina Zviel-Girshin @ASC

  19. Example • Construct an automaton B accepting the following language: L(B)= { w | |w| is odd over ={a,b,c}} B: Rina Zviel-Girshin @ASC

  20. Example • Construct an automaton C accepting the following language: L(C)= { w | w *, ={a,b,c} and a last letter of w is c} C: Rina Zviel-Girshin @ASC

  21. Example • Construct an automaton D accepting the following language: L(D)= { w | w is over * } D: Rina Zviel-Girshin @ASC

  22. Example • Construct an automaton accepting the empty language: L=  Rina Zviel-Girshin @ASC

  23. Example • Construct an automaton accepting the following language: L= { w | |w| mod 4=0 is over * } E: Rina Zviel-Girshin @ASC

  24. State diagram • A graphical representation of a finite automaton FA is also called a state diagram. • Given a formal definition of the FA one can draw its state diagram. • Given a state diagram one can write a formal definition of the FA. . Rina Zviel-Girshin @ASC

  25. Example • Consider the finite-state automaton A defined by the state diagram shown below: Q={q0,q1,q2} What are the states Q of A? Rina Zviel-Girshin @ASC

  26. Example • Consider the finite-state automaton A defined by the state diagram shown below:  ={a,b} What is the alphabet  of A? Rina Zviel-Girshin @ASC

  27. Example • Consider the finite-state automaton A defined by the state diagram shown below: q0 What is the start state of A? Rina Zviel-Girshin @ASC

  28. Example • Consider the finite-state automaton A defined by the state diagram shown below: F ={q0,q1} What are the accept states F of A? Rina Zviel-Girshin @ASC

  29. Example Create the transition table A of A Rina Zviel-Girshin @ASC

  30. Formal description of A The formal description of A is: A={Q={q0,q1,q2} ,  ={a,b}, A, q0, F={q0,q1}} Rina Zviel-Girshin @ASC

  31. Transition function • Motivation:  (delta ) • : QQ • The transition function  defines the movement of an automaton from one state to another. • Transition function input is an ordered pair: (current state, current input symbol). • For each pair of "current state" and "current input symbol" the transition function produces as output the next state in the automaton. Rina Zviel-Girshin @ASC

  32. a q0 q1 Example • (q0,a)=q1 means that state q1 is reachable from state q0 by the transition labeled by the input symbol a. • where • q0 is a current state • a is an input symbol • q1 is an output state also called “next state” Rina Zviel-Girshin @ASC

  33. FA description • Draw a FSA according to given  and F. : F={q1} Rina Zviel-Girshin @ASC

  34. Example Rina Zviel-Girshin @ASC

  35. Extended transition function • Notation: ’ • ’: Q*Q • The extended transition function ’ defines the movement of an automaton on word w= u. • Formal definition ’(q,u)=  (’(q,u), )=m Rina Zviel-Girshin @ASC

  36. q k m Example u  where ’(q,u)=  (’(q,u), )=  (k, )= m Rina Zviel-Girshin @ASC

  37. The language of an automaton • Informally: the words that A accepts (recognizes), i.e. when reading them it stops in an accepting state. • Formally: L(A)={x| x*, ’( q0,x)F} Rina Zviel-Girshin @ASC

More Related