Subset Construction 290N: The Unknown Component Problem Lecture 13.

Slides:



Advertisements
Similar presentations
Model Checking Lecture 3. Specification Automata Syntax, given a set A of atomic observations: Sfinite set of states S 0 Sset of initial states S S transition.
Advertisements

Lexical Analysis IV : NFA to DFA DFA Minimization
CSE 311 Foundations of Computing I
CS 267: Automated Verification Lecture 8: Automata Theoretic Model Checking Instructor: Tevfik Bultan.
Automatic Verification Book: Chapter 6. What is verification? Traditionally, verification means proof of correctness automatic: model checking deductive:
Static Single Assignment CS 540. Spring Efficient Representations for Reachability Efficiency is measured in terms of the size of the representation.
Outline Node minimization dcmin complete combinational behavior? using latch_expose FSM “Windowing”
CS412/413 Introduction to Compilers Radu Rugina Lecture 37: DU Chains and SSA Form 29 Apr 02.
CS357 Lecture: BDD basics David Dill 1. 2 BDDs (Boolean/binary decision diagrams) BDDs are a very successful representation for Boolean functions. A BDD.
Supervisory Control of Hybrid Systems Written by X. D. Koutsoukos et al. Presented by Wu, Jian 04/16/2002.
1 CIS 461 Compiler Design and Construction Fall 2012 slides derived from Tevfik Bultan et al. Lecture-Module 5 More Lexical Analysis.
CS 267: Automated Verification Lecture 10: Nested Depth First Search, Counter- Example Generation Revisited, Bit-State Hashing, On-The-Fly Model Checking.
1 Formal Methods in SE Qaisar Javaid Assistant Professor Lecture # 11.
1 Carnegie Mellon UniversitySPINFlavio Lerda SPIN An explicit state model checker.
ECE C03 Lecture 131 Lecture 13 Finite State Machine Optimization Prith Banerjee ECE C03 Advanced Digital Design Spring 1998.
A New Approach to Structural Analysis and Transformation of Networks Alan Mishchenko November 29, 1999.
Reachability Analysis 290N: The Unknown Component Problem Lecture 14.
Computing with Finite Automata 290N: The Unknown Component Problem Lecture 9.
Reachability Analysis using AIGs (instead of BDDs?) 290N: The Unknown Component Problem Lecture 23.
Computation Engines: BDDs and SAT (part 2) 290N: The Unknown Component Problem Lecture 8.
ECE Synthesis & Verification - L211 ECE 697B (667) Spring 2006 Synthesis and Verification of Digital Systems Verification Equivalence checking.
Boolean Matching in Logic Synthesis. Equivalence of Functions Equivalence of two functions defined under l Negation of input variables l Permutation of.
ECE Synthesis & Verification - Lecture 10 1 ECE 697B (667) Spring 2006 ECE 697B (667) Spring 2006 Synthesis and Verification of Digital Systems Binary.
ECE 667 Synthesis & Verification - BDD 1 ECE 667 ECE 667 Synthesis and Verification of Digital Systems Binary Decision Diagrams (BDD)
Computing with Finite Automata (part 2) 290N: The Unknown Component Problem Lecture 10.
Model Checking Lecture 5. Outline 1 Specifications: logic vs. automata, linear vs. branching, safety vs. liveness 2 Graph algorithms for model checking.
State Minimization and Determinization EECS 290A Sequential Logic Synthesis and Verification.
Outline Decoder Encoder Mux. Decoder Accepts a value and decodes it Output corresponds to value of n inputs Consists of: Inputs (n) Outputs (2 n, numbered.
Lexical Analysis — Part II: Constructing a Scanner from Regular Expressions Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved.
Model Checking Lecture 3 Tom Henzinger. Model-Checking Problem I |= S System modelSystem property.
Lexical Analysis — Part II: Constructing a Scanner from Regular Expressions.
Lexical Analysis Constructing a Scanner from Regular Expressions.
CALTECH CS137 Spring DeHon CS137: Electronic Design Automation Day 9: May 6, 2002 FSM Equivalence Checking.
Lexical Analysis III : NFA to DFA DFA Minimization Lecture 5 CS 4318/5331 Spring 2010 Apan Qasem Texas State University *some slides adopted from Cooper.
CMSC 330: Organization of Programming Languages Finite Automata NFAs  DFAs.
1 Verification of FSM Equivalence Goal: Verify that two sequential circuit implementations always produce the same sequence of outputs given the same sequence.
COSC 2007 Data Structures II
BDDs1 Binary Tree Representation The recursive Shannon expansion corresponds to a binary tree Example: Each path from the root to a leaf corresponds to.
Lecture Notes 
98 Nondeterministic Automata vs Deterministic Automata We learned that NFA is a convenient model for showing the relationships among regular grammars,
Today’s Agenda  Quiz 5 (end of the class)  Quick Review  Finish Search Algorithms Formal Methods in Software Engineering1.
Nondeterministic Finite State Machines Chapter 5.
Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter
CS412/413 Introduction to Compilers Radu Rugina Lecture 3: Finite Automata 25 Jan 02.
June 13, 2016 Prof. Abdelaziz Khamis 1 Chapter 2 Scanning – Part 2.
Table-driven parsing Parsing performed by a finite state machine.
The Encoding of TM Motivation for encoding of TM
Pushdown Automata PDAs
Two issues in lexical analysis
Principles of Computing – UFCFA3-30-1
Chapter 2 FINITE AUTOMATA.
Intro to Theory of Computation
Models of Sequential Systems
Lexical Analysis — Part II: Constructing a Scanner from Regular Expressions Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved.
THEORY OF COMPUTATION Lecture One: Automata Theory Automata Theory.
Lexical Analysis — Part II: Constructing a Scanner from Regular Expressions Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved.
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.
Lecture 4: Lexical Analysis II: From REs to DFAs
DFA Equivalence & Minimization
Finite Automata.
Finite Automata & Language Theory
CSE322 NDFA WITH NULL MOVES AND REGULAR EXPRESSION
Automating Scanner Construction
Lexical Analysis — Part II: Constructing a Scanner from Regular Expressions Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved.
Discrete Controller Synthesis
An explicit state model checker
Minimize # states in a DFSM
Some Graph Algorithms.
Lecture 11 LR Parse Table Construction
Presentation transcript:

Subset Construction 290N: The Unknown Component Problem Lecture 13

Outline  Subset construction  General flow of the algorithm  Examples When the number of states is exponential (2^n-1) When the number of states is exponential (2^n-1) When the number of states is reduced When the number of states is reduced  Computing reachable subsets of states Explicit Explicit Enumerating mintermsEnumerating minterms Partitioning Boolean spacePartitioning Boolean space Implicit Implicit Cofactoring monolithic transition relationCofactoring monolithic transition relation Hybrid Hybrid Using the transition relations for each stateUsing the transition relations for each state

Determinization by Subset Construction  Assume that ND transitions in the ND automaton happen at the same time It means that, at any moment, the ND automaton is in a subset of its states It means that, at any moment, the ND automaton is in a subset of its states The subset may contain more than one state The subset may contain more than one state  The point of determinization is to enumerate through all the subsets of states reachable from the initial state under any possible inputs Each subset of states of the ND automaton becomes a single state of the new deterministic automaton Each subset of states of the ND automaton becomes a single state of the new deterministic automaton The languages accepted by the ND automaton and its determinized version are the same The languages accepted by the ND automaton and its determinized version are the same

Determinization Algorithm  The automaton The linked lists of states {s}, with the accepting states marked The linked lists of states {s}, with the accepting states marked  Additional data structures Q: The FIFO queue of reached subsets of states Sk Q: The FIFO queue of reached subsets of states Sk H: The hash table mapping each reached subsets of states Sk into the corresponding state of the determinized automaton H: The hash table mapping each reached subsets of states Sk into the corresponding state of the determinized automaton  Initialization Create the initial state of the determinized automaton by creating the subset of states {s0} composed of the initial state of the ND automaton Create the initial state of the determinized automaton by creating the subset of states {s0} composed of the initial state of the ND automaton insert {s0} into Q and H insert {s0} into Q and H  Computation while Q is not empty, extract one subset of states Si from Q for all subsets of states Sj reachable in one transition from Si for all subsets of states Sj reachable in one transition from Si if Sj is not in H (that is, Sj has not been visited) if Sj is not in H (that is, Sj has not been visited) create the new state of the determinized automaton create the new state of the determinized automaton make the new state accepting if some state of Sj is accepting make the new state accepting if some state of Sj is accepting insert Sj into Q and into H insert Sj into Q and into H else find the new state corresponding to Sj using the hash table H else find the new state corresponding to Sj using the hash table H add the transition from Si into Sj add the transition from Si into Sj

Example when Subset Construction Leads to Exponential Number of States

Example when Subset Construction Reduces Number of States

Computing Reachable Subsets  Given a subset of states, what are other subsets of states that can be reached in one transition from the given subset?  Naïve explicit approach (using STG) Enumerate the minterms of the Boolean space of conditions Enumerate the minterms of the Boolean space of conditions For each minterm, find the subset of states reachable from the given subset in one iteration For each minterm, find the subset of states reachable from the given subset in one iteration Collect unique subsets Collect unique subsets State subset {2,3} Minterm 00: 2  {1} 3  {1} {2,3}  {1} Minterm 01: 2  {3} 3  {1} {2,3}  {1,3} Minterm 10: 2  {3} 3  {1} {2,3}  {1,3} Minterm 11: 2  {3} 3  {1,3} {2,3}  {1,3}

Computing Reachable Subsets  Improved explicit approach (using STG) Compute partitioning on the condition space defined by states in the subset Compute partitioning on the condition space defined by states in the subset Compute the product of partitions for all states in the subset Compute the product of partitions for all states in the subset Each partition corresponds to one subset of next states Each partition corresponds to one subset of next states Collect unique subsets Collect unique subsets This approach does not require enumerating through the minterms This approach does not require enumerating through the minterms State subset {2,3} State 2 partition: (00)  {1} (01,10,11)  {3} State 3 partition: (00,01,10)  {1} (11)  {1,3} Product of partitions: (00)  {1} (01,10)  {1,3} (11)  {1,3} Unique next state subsets: {1} and {1,3} (00)  {1} (01,10,11)  {1,3}

Transition Relation of the Subset  Given the subset si, compute Rsi(x,s) This relation for each input x, gives the set of next states {sj} This relation for each input x, gives the set of next states {sj}   Example: State subset {2,3} Input variables {x1,x2} State variables {s1,s2} Transition relation of state 2: R2(x1,x2,s1,s2) = x1’x2’s1’s2 + (x1+x2)s1s2 Transition relation of state 3: R3(x1,x2,s1,s2) = x1x2s1s2 + s1’s2 Transition relation of state subset {2,3}: R(x1,x2,s1,s2) = R2 + R3 = x1’x2’s1’s2+ (x1 + x2)s2 Code 01 Code 11 Code 10

Computing Transition Relation of the Subset  Implicit approach The monolithic transition relation R(x,cs,ns) is available The monolithic transition relation R(x,cs,ns) is available Restrict the monolithic transition relation R(x,cs,ns) to the given subset of states Si(cs): R(x,s) =  cs [R(x,cs,ns) & Si(cs)] ns  s Restrict the monolithic transition relation R(x,cs,ns) to the given subset of states Si(cs): R(x,s) =  cs [R(x,cs,ns) & Si(cs)] ns  s  Hybrid approach The individual state transition relations Ri(x,s) are available The individual state transition relations Ri(x,s) are available Add the transition relations for all states in the subset R(x,s) = Si Ri(x,s) Add the transition relations for all states in the subset R(x,s) =  i  Si Ri(x,s)

Computing Reachable Subsets using Transition Relation of the Subset  Compute orthonormal expansion of the transition relation of the subset R(x,s) w.r.t. variables in {x} R(x,s) =  i [ fi(x) & gi(s) ], where (1) fi(x) & fj(x) = 0, i  j (2) gi(s) = gj(s)  i = j  In the orthonormal expansion, functions gi(s) are sets of next states reachable under conditions fi(x) from the given subset

Computing Orthonormal Expansion using BDD Variable Ordering   Orthonormal expansion is R(x,s) =  i [ fi(x) & gi(s) ], where (1) fi(x) & fj(x) = 0, i  j (2) gi(s) = gj(s)  i = j  BDD represents the function as a set of disjoint paths - condition (1)  BDD reduction guarantees merging identical cofactors - condition (2)  Building BDD with variables {x1,x2} on top lead to the orthonormal expansion  Example:  Example: R(x1,x2,s1,s2) = x1’x2’s1’s2 + (x1+x2)s2 s1’s2 encodes state {1} (condition x1’x2’) s2 encodes state subset {1,3} (condition x1+x2) x1 x2 s1 s2 Code 01 Code 11 Code 10

Computing Orthonormal Expansion using General Method  Given a state subset Si and its transition relation R(x,s) while R(x,s) is not empty, enumerate through the elements of the expansion (reachable subsets): while R(x,s) is not empty, enumerate through the elements of the expansion (reachable subsets): Extract one minterm m(x,s) from R(x,s) Extract one minterm m(x,s) from R(x,s) Restrict m(x,s) to only input variables x (call it m(x)) Restrict m(x,s) to only input variables x (call it m(x)) Find Sj reachable from Si under m(x): Sj(s) =  x[R(x,s) & m(x)] Find Sj reachable from Si under m(x): Sj(s) =  x[R(x,s) & m(x)] Find Cij(x) labeling transition Si  Sj: Cij(x)=  s[R(x,s)  Sj(s)] Find Cij(x) labeling transition Si  Sj: Cij(x)=  s[R(x,s)  Sj(s)] Subtract this transition from R(x,s): R(x,s) = R(x,s) & NOT(Cij(x)) Subtract this transition from R(x,s): R(x,s) = R(x,s) & NOT(Cij(x))

Example R(x1,x2,s1,s2) = x1’x2’s1’s2 + (x1+x2)s2 Extract minterm: m(x,s) = Extract minterm: m(x,s) = x1x2s1s2 Restrict to variables x: m(x) = x1x2 Sj(s) = Find the related set of states: Sj(s) = s2 (subset {1,3}) Find the related condition: Cij(x) = x1+x2 Subtract this transition from the relation: R(x1,x2,s1,s2) = x1’x2’s1’s2 Extract minterm: m(x,s) = Extract minterm: m(x,s) = x1’x2’s1’s2 Restrict to variables x: m(x) = x1’x2’ Sj(s) = Find the related set of states: Sj(s) = s1’s2 (subset {1}) Find the related condition: Cij(x) = x1’x2’ Subtract this transition from the relation: R(x1,x2,s1,s2) = 0 Quit the while-loop