EECS 20 Lecture 16 (February 26, 2001) Tom Henzinger Determinization.

Slides:



Advertisements
Similar presentations
Theory of Computing Lecture 23 MAS 714 Hartmut Klauck.
Advertisements

CSE 311 Foundations of Computing I
CMPS 3223 Theory of Computation
Variants of Turing machines
Lecture 24 MAS 714 Hartmut Klauck
Decomposing Refinement Proofs using Assume-Guarantee Reasoning Tom Henzinger (UC Berkeley) Shaz Qadeer (Compaq Research) Sriram Rajamani (Microsoft Research)
VIII - Working with Sequential Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 1 Finite state machine optimization State minimization  fewer.
CSE 311: Foundations of Computing Fall 2013 Lecture 23: Finite state machines and minimization.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
EECS 20 Lecture 14 (February 16, 2001) Tom Henzinger Nondeterminism.
EECS 20 Lecture 38 (April 27, 2001) Tom Henzinger Review.
Finite Automata Great Theoretical Ideas In Computer Science Anupam Gupta Danny Sleator CS Fall 2010 Lecture 20Oct 28, 2010Carnegie Mellon University.
EECS 20 Lecture 15 (February 21, 2001) Tom Henzinger Simulation.
EECS 20 Lecture 13 (February 14, 2001) Tom Henzinger Minimization.
Transparency No Formal Language and Automata Theory Chapter 10 The Myhill-Nerode Theorem (lecture 15,16 and B)
Finite Automata Finite-state machine with no output. FA consists of States, Transitions between states FA is a 5-tuple Example! A string x is recognized.
1 The scanning process Goal: automate the process Idea: –Start with an RE –Build a DFA How? –We can build a non-deterministic finite automaton (Thompson's.
EECS 20 Lecture 1 (January 17, 2001) Tom Henzinger Motivation.
EECS 20 Lecture 8 (February 2, 2001) Tom Henzinger State Machines.
EECS 20 Lecture 9 (February 5, 2001) Tom Henzinger Transition Diagrams.
Aho-Corasick String Matching An Efficient String Matching.
Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.
Transparency No Formal Language and Automata Theory Chapter 10 The Myhill-Nerode Theorem (lecture 15,16 and B)
Week 4 1.More examples 2.Nondeterminism, equivalence, simulation (Ch 3) 3.Composition (Ch 4)
EECS 20 Chapter 4 Sections Connecting State Machines Last time we Introduced the nondeterministic state machine Highlighted differences between.
Automating Construction of Lexers. Example in javacc TOKEN: { ( | | "_")* > | ( )* > | } SKIP: { " " | "\n" | "\t" } --> get automatically generated code.
1 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY For next time: Read 2.1 & 2.2.
EECS 20 Lecture 4 (January 24, 2001) Tom Henzinger Block Diagrams.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
EECS 20 Lecture 36 (April 23, 2001) Tom Henzinger Safety Control.
EECS 20 Lecture 37 (April 25, 2001) Tom Henzinger Progress Control.
EECS 20 Chapter 3 Sections State Machines Continued Last time we Introduced the deterministic finite state machine Discussed the concept of state.
EECS 20 Lecture 12 (February 12, 2001) Tom Henzinger Equivalence.
Transparency No. 8-1 Formal Language and Automata Theory Chapter 8 DFA state minimization (lecture 13, 14)
State Minimization and Determinization EECS 290A Sequential Logic Synthesis and Verification.
CSE 311: Foundations of Computing Fall 2014 Lecture 23: State Minimization, NFAs.
Formal Language Finite set of alphabets Σ: e.g., {0, 1}, {a, b, c}, { ‘{‘, ‘}’ } Language L is a subset of strings on Σ, e.g., {00, 110, 01} a finite language,
Zvi Kohavi and Niraj K. Jha 1 Capabilities, Minimization, and Transformation of Sequential Machines.
NFA ε - NFA - DFA equivalence. What is an NFA An NFA is an automaton that its states might have none, one or more outgoing arrows under a specific symbol.
Lexical Analysis — Part II: Constructing a Scanner from Regular Expressions.
4b 4b Lexical analysis Finite Automata. Finite Automata (FA) FA also called Finite State Machine (FSM) –Abstract model of a computing entity. –Decides.
CSE373: Data Structures & Algorithms Lecture 10: Disjoint Sets and the Union-Find ADT Lauren Milne Spring 2015.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
Digital Circuits State Reduction and Assignment State Reduction reductions on the number of flip-flops and the number of gates a reduction in the.
UNIT - I Formal Language and Regular Expressions: Languages Definition regular expressions Regular sets identity rules. Finite Automata: DFA NFA NFA with.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AA.
CSE 311 Foundations of Computing I Lecture 24 FSM Limits, Pattern Matching Autumn 2011 CSE 3111.
98 Nondeterministic Automata vs Deterministic Automata We learned that NFA is a convenient model for showing the relationships among regular grammars,
Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and B = {a,b} {( 0, a), (
Unrestricted Grammars
Nondeterministic Finite State Machines Chapter 5.
June 13, 2016 Prof. Abdelaziz Khamis 1 Chapter 2 Scanning – Part 2.
Capabilities, Minimization, and Transformation of Sequential Machines
CSE 311 Foundations of Computing I
Georgiana Caltais - Damien Pous - Alexandra Silva
CSE 311 Foundations of Computing I
Motivation EECS 20 Lecture 1 (January 17, 2001) Tom Henzinger.
CS 154, Lecture 4: Limitations on DFAs (I),
Minimal DFA Among the many DFAs accepting the same regular language L, there is exactly one (up to renaming of states) which has the smallest possible.
DFA-> Minimum DFA Module 05.4 COP4020 – Programming Language Concepts Dr. Manuel E. Bermudez.
NFA TO DFA.
Implement FSM with fewest possible states • Least number of flip flops
State Machines EECS 20 Lecture 8 (February 2, 2001) Tom Henzinger.
Instructor: Aaron Roth
Instructor: Aaron Roth
COP46– Programming Language Translators Dr. Manuel E. Bermudez
CSE 311 Foundations of Computing I
Regular Language Equivalence and DFA Minimization
Instructor: Aaron Roth
Instructor: Aaron Roth
Presentation transcript:

EECS 20 Lecture 16 (February 26, 2001) Tom Henzinger Determinization

State machines Deterministic   Output-deterministic   Nondeterministic X X

A state machine is deterministic iff 1.there is only one initial state, and 2.for every state and every input, there is only one successor state. Hence, for every input signal there is exactly one run.

A state machine is output-deterministic iff 1.there is only one initial state, and 2.for every state and every input-output pair, there is only one successor state. Hence, for every behavior there is exactly one run.

State machines Deterministic  Output-deterministic  Nondeterministic Simulations can be found easily

If M2 is a deterministic state machine, then M1 is simulated by M2 iff M1 is equivalent to M2. “if and only if” M1 refines M2, and M2 refines M1

If M2 is an output-deterministic state machine, then M1 is simulated by M2 iff M1 refines M2.

If M2 is a nondeterministic state machine, then M1 is simulated by M2 implies M1 refines M2.

Fortunately: For every nondeterministic state machine M, we can find an output-deterministic state machine det(M) that is equivalent to M. ( This is called “subset construction.” )

Then, to check if M1 refines M2, check if M1 is simulated by det(M2): M1 refines M2 iff M1 refines det(M2) iff M1 is simulated by det(M2).

Then, to check if M1 refines M2, check if M1 is simulated by det(M2): M1 refines M2 iff M1 refines det(M2) iff M1 is simulated by det(M2). output-deterministic

The Subset Construction Given: nondeterministic state machine M Find: output-deterministic state machine det(M) that is equivalent to M

The Subset Construction Given: nondeterministic state machine M Find: output-deterministic state machine det(M) that is equivalent to M Inputs [det(M)] = Inputs [M] Outputs [det(M)] = Outputs [M]

The Subset Construction Let initialState [ det(M) ] = possibleInitialStates [M] ; Let States [ det(M) ] = { initialState [det(M)] } ; Repeat as long as new transitions can be added to det(M) : Choose P  States [det(M)] and (x,y)  Inputs  Outputs ; Let Q = { q  States [M] |  p  P, (q,y)  possibleUpdates [M] (p,x) } ; If Q  Ø then Let States [det(M)] = States [det(M)]  {Q} ; Let update [det(M)] (P,x) = (Q,y).

x / y p {p} q1 q2 M det(M)

x / y p {p} q1 q2 {q1,q2} M det(M)

1 / 1 a b M 0 / 0 1 / 1 0 / 1 1 / 0 det(M)

1 / 1 a b M 0 / 0 1 / 1 0 / 1 1 / 0 {a} det(M)

1 / 1 a b M 0 / 0 1 / 1 0 / 1 1 / 0 {a} det(M) 0 / 0

1 / 1 a b M 0 / 0 1 / 1 0 / 1 1 / 0 1 / 1 {a} {a,b} det(M) 0 / 0

1 / 1 a b M 0 / 0 1 / 1 0 / 1 1 / 0 1 / 1 {a} {a,b} det(M) 0 / 0

1 / 1 a b M 0 / 0 1 / 1 0 / 1 1 / 0 1 / 1 {a} {a,b} det(M) 0 / 01 / 1 0 / 0

1 / 1 a b M 0 / 0 1 / 1 0 / 1 1 / 0 1 / 1 {a} {a,b} det(M) 0 / 0 {b} 0 / 1 1 / 1 0 / 0

1 / 1 a b M 0 / 0 1 / 1 0 / 1 1 / 0 1 / 1 {a} {a,b} det(M) 0 / 0 {b} 0 / 1 1 / 0 1 / 1 0 / 0

1 / 1 a b M 0 / 0 1 / 1 0 / 1 1 / 0 1 / 1 {a} {a,b} det(M) 0 / 0 {b} 0 / 1 0 / 1 1 / 0 1 / 1 0 / 0

1 / 1 a b M 0 / 0 1 / 1 0 / 1 1 / 0 1 / 1 {a} {a,b} det(M) 0 / 0 {b} 0 / 1 1 / 0 1 / 1 0 / 0

M det(M) a b  / 0  / 1 c d  / 0

M det(M) a b  / 0  / 1 c d  / 0 {a,c}

M det(M) a b  / 0  / 1 c d  / 0 {a,c} {a,d}  / 0

M det(M) a b  / 0  / 1 c d  / 0 {a,c} {a,d}  / 0 {b,c}  / 1

M det(M) a b  / 0  / 1 c d  / 0 {a,c} {a,d}  / 0 {b,c}  / 1  / 0

M det(M) a b  / 0  / 1 c d  / 0 {a,c} {a,d}  / 0 {b,c}  / 1  / 0 {b}  / 1

M det(M) a b  / 0  / 1 c d  / 0 {a,c} {a,d}  / 0 {b,c}  / 1  / 0 {b}  / 1

M det(M) a b  / 0  / 1 c d  / 0 {a,c} {a,d}  / 0 {b,c}  / 1  / 0 {b}  / 1

M det(M) a b  / 0  / 1 c d  / 0 {a,c} {a,d}  / 0 {b,c}  / 1  / 0 {b}  / 1 {d}  / 0

M det(M) a b  / 0  / 1 c d  / 0 {a,c} {a,d}  / 0 {b,c}  / 1  / 0 {b}  / 1 {d}  / 0

For a given reactive system S: 1.If there is a nondeterministic state machine that implements S with n states, then there is an output- deterministic state machine that implements S with 2 n states. [Subset construction] 2. There may not be an output-deterministic state machine that implements S with fewer than 2 n states. [Homework 5, Problem C] 3. There may not be a unique nondeterministic state machine that implements S with the fewest states.

 /   / 0  /   / 0  / 1  / 0  /   / 0  /   / 0  / 1 equivalent but not isomorphic to

So what does minimization do for nondeterministic state machines ?

The Nondeterministic Minimization Algorithm Input : nondeterministic state machine M Output : minimize (M), the state machine with the fewest states that is bisimilar to M (the result is unique up to renaming of states)

A binary relation B  States [M1]  States [M2] is a bisimulation between M1 and M2 iff A1.  p  possibleInitialStates [M1],  q  possibleInitialStates [M2], ( p, q )  B, and A2.  p  States [M1],  q  States [M2], if ( p, q )  B, then  x  Inputs,  y  Outputs,  p’  States [M1], if ( p’, y )  possibleUpdates [M1] ( p, x ) then  q’  States [M2], ( q’, y )  possibleUpdates [M2] ( q, x ) and ( p’, q’ )  B, and

B1.  q  possibleInitialStates [M2],  p  possibleInitialStates [M1], ( p, q )  B, and B2.  p  States [M1],  q  States [M2], if ( p, q )  B, then  x  Inputs,  y  Outputs,  q’  States [M2], if ( q’, y )  possibleUpdates [M2] ( q, x ) then  p’  States [M1], ( p’, y )  possibleUpdates [M1] ( q, x ) and ( p’, q’ )  B. and

p q p’ x / y B

p q p’ x / y q’ x / y B

p q p’ x / y q’ x / y B

p q p’ x / y q’ x / y B q’’ x / y X

p q p’ x / y q’ x / y B q’’

For deterministic state machines M1 and M2, M1 is equivalent to M2   M1 and M2 are bisimilar.

For nondeterministic state machines M1 and M2, M1 is equivalent to M2   M1 and M2 are bisimilar. X

States The Nondeterministic Minimization Algorithm

1/01/01/01/0 1/01/0 1/01/0 1/01/0 1/01/0 1/01/0 1/01/0 1/01/0 X X X X X

1/01/0 1/01/0 1/01/01/01/0 X

0/10/1 0/10/1 0/10/1 X

1. Let Q be set of all reachable states of M. 2. Maintain a set P of state sets: Initially let P = { Q }. Repeat until no longer possible: split P. 3. When done, every state set in P represents a single state of the smallest nondeterministic state machine bisimilar to M. The Nondeterministic Minimization Algorithm

Split P If there exist two state sets R  P and R’  P two states r1  R and r2  R an input x  Inputs an output y  Outputs such that  r’  R’, ( r’, y )  possibleUpdates ( r1, x ) and  r’  R’, ( r’, y )  possibleUpdates ( r2, x ) then let R1 = { r  R |  r’  R’, ( r’, y )  possibleUpdates ( r, x ) } ; let R2 = R \ R1 ; let P = ( P \ { R } )  { R1, R2 }.

Split R’ R x / y r1 r2 X

Split R’ R x / y r1 r2 X

/0/0 /0/0 /0/0 /0/0 /0/0 /0/0 /1/1 /1/1 a e d c b M

/0/0 /0/0 /0/0 /0/0 /0/0 /0/0 /1/1 /1/1 a e d c b M

/0/0 /0/0 /0/0 /0/0 /0/0 /0/0 /1/1 /1/1 a e d c b M /1/1 /1/1 X

/0/0 /0/0 /0/0 /0/0 /0/0 /0/0 /1/1 /1/1 a e d c b M /0/0 /0/0 X

/0/0 /0/0 /0/0 /0/0 /0/0 /0/0 /1/1 /1/1 a e d c b M /1/1 /1/1 X

/0/0 /0/0 /0/0 /1/1 /1/1 a e d Minimal state machine bisimilar to M b,c

/0/0 /1/1 /1/1 a Minimal state machine equivalent to M (in general, this is difficult to find) b,c /0/0 d,e