Download presentation
Presentation is loading. Please wait.
Published byAlicia Adams Modified over 9 years ago
1
Complexity and Computability Theory I Lecture #2 Rina Zviel-Girshin Leah Epstein Winter 2002-2003
2
Rina Zviel-Girshin @ASC2 Overview Proofs Finite Automaton
3
Rina Zviel-Girshin @ASC3 Proofs Four main types: –direct proof (syllogism) –proof by construction –proof by contradiction –proof by induction
4
Rina Zviel-Girshin @ASC4 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
5
Rina Zviel-Girshin @ASC5 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.
6
Rina Zviel-Girshin @ASC6 Proof by Contradiction The idea: assume the opposite of the theorem derive a contradiction
7
Rina Zviel-Girshin @ASC7 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.
8
Rina Zviel-Girshin @ASC8 Proof by Induction Three main part: basis of induction induction hypothesis induction step Two types of induction: Partial induction Full induction
9
Rina Zviel-Girshin @ASC9 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
10
Rina Zviel-Girshin @ASC10 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
11
Rina Zviel-Girshin @ASC11 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.
12
Rina Zviel-Girshin @ASC12 Finite Automata Informally - our model will include basically: states transition between states as a reaction to some input w: Automaton:
13
Rina Zviel-Girshin @ASC13 Example
14
Rina Zviel-Girshin @ASC14 Formal Definition A finite automaton FA is a 5-tuple (Q, , , q 0, 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) q 0 - q 0 Q is the start state (the initial state, before input) F - F Q the set of accept states
15
Rina Zviel-Girshin @ASC15 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).
16
Rina Zviel-Girshin @ASC16 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.
17
Rina Zviel-Girshin @ASC17 Graphical representation A: accepting state not accepting state starting state The language of A: L(A)= { w | |w| is even over ={0,1}}
18
Rina Zviel-Girshin @ASC18 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.
19
Rina Zviel-Girshin @ASC19 Example Construct an automaton B accepting the following language: L(B)= { w | |w| is odd over ={a,b,c}} B:
20
Rina Zviel-Girshin @ASC20 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:
21
Rina Zviel-Girshin @ASC21 Example Construct an automaton D accepting the following language: L(D)= { w | w is over * } D:
22
Rina Zviel-Girshin @ASC22 Example Construct an automaton accepting the empty language: L=
23
Rina Zviel-Girshin @ASC23 Example Construct an automaton accepting the following language: L= { w | |w| mod 4=0 is over * } E:
24
Rina Zviel-Girshin @ASC24 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..
25
Rina Zviel-Girshin @ASC25 Example Consider the finite-state automaton A defined by the state diagram shown below: What are the states Q of A? Q={q0,q1,q2}
26
Rina Zviel-Girshin @ASC26 Example Consider the finite-state automaton A defined by the state diagram shown below: What is the alphabet of A? ={a,b}
27
Rina Zviel-Girshin @ASC27 Example Consider the finite-state automaton A defined by the state diagram shown below: What is the start state of A? q0
28
Rina Zviel-Girshin @ASC28 Example Consider the finite-state automaton A defined by the state diagram shown below: What are the accept states F of A? F ={q0,q1}
29
Rina Zviel-Girshin @ASC29 Example Create the transition table A of A AA ab q0q1q0 q1 q2 q1q0
30
Rina Zviel-Girshin @ASC30 Formal description of A The formal description of A is: A={Q={q0,q1,q2}, ={a,b}, A, q0, F={q0,q1}}
31
Rina Zviel-Girshin @ASC31 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.
32
Rina Zviel-Girshin @ASC32 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” q0 q1 a
33
Rina Zviel-Girshin @ASC33 FA description Draw a FSA according to given and F. State/ input symbol 01 q0q1q3 q1 q2 q1q2 q3 F={q1} ::
34
Rina Zviel-Girshin @ASC34 Example
35
Rina Zviel-Girshin @ASC35 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
36
Rina Zviel-Girshin @ASC36 Example qkm u where ’(q,u )= ( ’(q,u), )= (k, )= m
37
Rina Zviel-Girshin @ASC37 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 *, ’( q 0,x) F}
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.