140 likes | 359 Views
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 reduced Computing reachable subsets of states Explicit
E N D
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 reduced • Computing reachable subsets of states • Explicit • Enumerating minterms • Partitioning Boolean space • Implicit • Cofactoring monolithic transition relation • Hybrid • Using 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 • 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 • 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 • Additional data structures • 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 • 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 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 if Sj is not in H (that is, Sj has not been visited) create the new state of the determinized automaton make the new state accepting if some state of Sj is accepting insert Sj into Q and into H else find the new state corresponding to Sj using the hash table H add the transition from Si into Sj
Example whenSubset Construction Leads to Exponential 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 • For each minterm, find the subset of states reachable from the given subset in one iteration • 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 the product of partitions for all states in the subset • Each partition corresponds to one subset of next states • Collect unique subsets • 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}
Code 01 Code 10 Code 11 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} • 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
Computing Transition Relation of the Subset • Implicit approach • 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 • Hybrid approach • The individual state transition relations Ri(x,s) are available • Add the transition relations for all states in the subset R(x,s) = iSiRi(x,s)
Computing Reachable Subsetsusing 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
Code 01 Code 10 Code 11 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: 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
Computing Orthonormal Expansion using General Method • Given a state subset Si andits transition relation R(x,s) 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) • 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 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))
Example R(x1,x2,s1,s2) =x1’x2’s1’s2 + (x1+x2)s2 Extract minterm: m(x,s) = x1x2s1s2 Restrict tovariables x: m(x) = x1x2 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) = x1’x2’s1’s2 Restrict tovariables x: m(x) = x1’x2’ 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