subset construction 290n: the unknown component problem lecture 13

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

Post on 20-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Subset Construction 290N: The Unknown Component Problem Lecture 13

Subset ConstructionSubset Construction

290N: The Unknown Component 290N: The Unknown Component ProblemProblem

Lecture 13Lecture 13

Page 2: Subset Construction 290N: The Unknown Component Problem Lecture 13

OutlineOutline Subset constructionSubset construction General flow of the algorithmGeneral flow of the algorithm ExamplesExamples

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 reducedWhen the number of states is reduced

Computing reachable subsets of statesComputing reachable subsets of states ExplicitExplicit

• Enumerating mintermsEnumerating minterms• Partitioning Boolean spacePartitioning Boolean space

ImplicitImplicit• Cofactoring monolithic transition relationCofactoring monolithic transition relation

HybridHybrid• Using the transition relations for each stateUsing the transition relations for each state

Page 3: Subset Construction 290N: The Unknown Component Problem Lecture 13

Determinization by Subset Determinization by Subset ConstructionConstruction

Assume that ND transitions in the ND automaton happen Assume that ND transitions in the ND automaton happen at the same timeat the same time

It means that, at any moment, the ND automaton is in a subset It means that, at any moment, the ND automaton is in a subset of its states of its states

The subset may contain more than one stateThe subset may contain more than one state The point of determinization is to enumerate through all The point of determinization is to enumerate through all

the subsets of states reachable from the initial state the subsets of states reachable from the initial state under any possible inputsunder any possible inputs

Each subset of states of the ND automaton becomes a single Each subset of states of the ND automaton becomes a single state of the new deterministic automatonstate of the new deterministic automaton

The languages accepted by the ND automaton and its The languages accepted by the ND automaton and its determinized version are the samedeterminized version are the same

Page 4: Subset Construction 290N: The Unknown Component Problem Lecture 13

Determinization AlgorithmDeterminization Algorithm The automaton The automaton

The linked lists of states The linked lists of states {s}{s}, with the accepting states marked, with the accepting states marked Additional data structuresAdditional data structures

Q:Q: The FIFO queue of reached subsets of states The FIFO queue of reached subsets of states Sk Sk H:H: The hash table mapping each reached subsets of states The hash table mapping each reached subsets of states Sk Sk into the into the

corresponding state of the determinized automatoncorresponding state of the determinized automaton InitializationInitialization

Create the initial state of the determinized automaton by creating the Create the initial state of the determinized automaton by creating the subset of states subset of states {s0}{s0} composed of the initial state of the ND automaton composed of the initial state of the ND automaton

insert insert {s0}{s0} into into QQ and and HH ComputationComputation

while while QQ is not empty, extract one subset of states is not empty, extract one subset of states SiSi from from QQ for all subsets of states for all subsets of states SjSj reachable in one transition from reachable in one transition from SiSi if if SjSj is not in is not in HH (that is, (that is, SjSj has not been visited) has not been visited) create the new state of the determinized automatoncreate the new state of the determinized automaton make the new state accepting if some state of make the new state accepting if some state of SjSj is accepting is accepting insert insert SjSj into into QQ and into and into HH else find the new state corresponding to else find the new state corresponding to SjSj using the hash table using the hash table HH add the transition from add the transition from SiSi into into SjSj

Page 5: Subset Construction 290N: The Unknown Component Problem Lecture 13

Example whenExample when Subset Construction Subset Construction Leads to Exponential Number of StatesLeads to Exponential Number of States

Page 6: Subset Construction 290N: The Unknown Component Problem Lecture 13

Example when Subset Construction Example when Subset Construction Reduces Number of StatesReduces Number of States

Page 7: Subset Construction 290N: The Unknown Component Problem Lecture 13

Computing Reachable SubsetsComputing Reachable Subsets Given a subset of states, what are other subsets of states that can be Given a subset of states, what are other subsets of states that can be

reached in one transition from the given subset?reached in one transition from the given subset? Naïve explicit approach (using STG)Naïve explicit approach (using STG)

Enumerate the minterms of the Boolean space of conditionsEnumerate the minterms of the Boolean space of conditions For each minterm, find the subset of states reachable from the given For each minterm, find the subset of states reachable from the given

subset in one iterationsubset in one iteration Collect unique subsetsCollect 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}

Page 8: Subset Construction 290N: The Unknown Component Problem Lecture 13

Computing Reachable SubsetsComputing Reachable Subsets Improved explicit approach (using STG)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 subsetCompute the product of partitions for all states in the subset Each partition corresponds to one subset of next statesEach partition corresponds to one subset of next states Collect unique subsetsCollect unique subsets This approach does not require enumerating through the mintermsThis 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}

Page 9: Subset Construction 290N: The Unknown Component Problem Lecture 13

Transition Relation of the SubsetTransition Relation of the Subset Given the subset Given the subset si,si, compute compute Rsi(x,s)Rsi(x,s)

This relation for each input This relation for each input xx, gives the set of next states , gives the set of next states {sj}{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

Page 10: Subset Construction 290N: The Unknown Component Problem Lecture 13

Computing Computing Transition Relation of Transition Relation of the Subsetthe Subset

Implicit approachImplicit approach The monolithic transition relation The monolithic transition relation R(x,cs,ns)R(x,cs,ns) is available is available Restrict the monolithic transition relation Restrict the monolithic transition relation R(x,cs,ns)R(x,cs,ns) to the given to the given

subset of states subset of states Si(cs)Si(cs): : R(x,s) = R(x,s) = cs [R(x,cs,ns) & Si(cs)]cs [R(x,cs,ns) & Si(cs)]ns ns ss

Hybrid approachHybrid approach The individual state transition relations The individual state transition relations Ri(x,s)Ri(x,s) are available are available Add the transition relations for all states in the subsetAdd the transition relations for all states in the subset R(x,s) R(x,s)

= = iSiSi Ri(x,s)Ri(x,s)

Page 11: Subset Construction 290N: The Unknown Component Problem Lecture 13

Computing Reachable SubsetsComputing Reachable Subsetsusing using Transition Relation of the SubsetTransition Relation of the Subset

Compute Compute orthonormal expansionorthonormal expansion of the transition of the transition relation of the subset relation of the subset R(x,s)R(x,s) w.r.t. variables in w.r.t. variables in {x}{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 In the orthonormal expansion, functions gi(s)gi(s) are sets are sets of next states reachable under conditions of next states reachable under conditions fi(x) fi(x) from the from the given subsetgiven subset

Page 12: Subset Construction 290N: The Unknown Component Problem Lecture 13

Computing Orthonormal Expansion Computing Orthonormal Expansion using BDD Variable Orderingusing 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 BDD represents the function as a set of disjoint

paths - condition (1)paths - condition (1) BDD reduction guarantees merging identical BDD reduction guarantees merging identical

cofactors - condition (2)cofactors - condition (2) Building BDD with variables Building BDD with variables {x1,x2}{x1,x2} on top lead to on top lead to

the orthonormal expansionthe 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

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

Computing Orthonormal Expansion Computing Orthonormal Expansion using General Methodusing General Method

Given a state subsetGiven a state subset Si Si and and its transition relation its transition relation R(x,s)R(x,s)

while while R(x,s) R(x,s) is not empty, enumerate through the elements is not empty, enumerate through the elements of the expansion (reachable subsets):of the expansion (reachable subsets):

Extract one minterm Extract one minterm m(x,s) m(x,s) from from R(x,s)R(x,s) Restrict Restrict m(x,s) m(x,s) to only input variables to only input variables x x (call it (call it m(x)m(x))) Find Find SjSj reachable from reachable from SiSi under under m(x)m(x): : Sj(s) = Sj(s) = x[R(x,s) & m(x)]x[R(x,s) & m(x)] Find Find Cij(x)Cij(x) labeling transition labeling transition Si Si Sj Sj: : Cij(x)=Cij(x)=s[R(x,s) s[R(x,s) Sj(s)] Sj(s)] Subtract this transition from Subtract this transition from R(x,s): R(x,s) = R(x,s) & NOT(Cij(x))R(x,s): R(x,s) = R(x,s) & NOT(Cij(x))

Page 14: Subset Construction 290N: The Unknown Component Problem Lecture 13

ExampleExampleR(x1,x2,s1,s2) = x1’x2’s1’s2 + (x1+x2)s2

Extract minterm: Extract minterm: m(x,s) = m(x,s) = x1x2s1s2Restrict to variables x: m(x) = x1x2

Find the related set of states: Sj(s) = Sj(s) = s2 (subset {1,3})Find the related condition: Cij(x) = x1+x2Subtract this transition from the relation: R(x1,x2,s1,s2) = x1’x2’s1’s2

Extract minterm: Extract minterm: m(x,s) = m(x,s) = x1’x2’s1’s2Restrict to variables x: m(x) = x1’x2’

Find the related set of states: Sj(s) = 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