Download presentation
Presentation is loading. Please wait.
1
Subset Construction 290N: The Unknown Component Problem Lecture 13
2
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
3
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
4
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
5
Example when Subset Construction Leads to Exponential Number of States
6
Example when Subset Construction Reduces Number of States
7
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}
8
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}
9
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
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)
11
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
12
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
13
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))
14
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.