FSM Decomposition using Partitions on States

27
FSM Decomposition FSM Decomposition using Partitions on using Partitions on States States 290N: The Unknown Component 290N: The Unknown Component Problem Problem Lecture 24 Lecture 24

description

FSM Decomposition using Partitions on States. 290N: The Unknown Component Problem Lecture 24. Outline. Once upon a time… Motivating example Terminology Definition of SP-partitions Decomposition using SP-partitions Computation of SP-partitions Extensions for ND FSMs. Motivating Example. - PowerPoint PPT Presentation

Transcript of FSM Decomposition using Partitions on States

Page 1: FSM Decomposition using Partitions on States

FSM Decomposition using FSM Decomposition using Partitions on StatesPartitions on States

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

Lecture 24Lecture 24

Page 2: FSM Decomposition using Partitions on States

OutlineOutline Once upon a time…Once upon a time… Motivating exampleMotivating example TerminologyTerminology Definition of SP-partitionsDefinition of SP-partitions Decomposition using SP-partitionsDecomposition using SP-partitions Computation of SP-partitionsComputation of SP-partitions Extensions for ND FSMsExtensions for ND FSMs

Page 3: FSM Decomposition using Partitions on States

Motivating ExampleMotivating Example

YY11 = y = y11’y’y22’y’y33x’+yx’+y22yy33’x’ + y’x’ + y22yy33xxYY22 = y = y22’x +y’x +y11’y’y22’y’y33’x’ + y’x’ + y11yy33

YY33 = y = y11x+yx+y22yy33’x + y’x + y22yy33x’ + yx’ + y11’y’y22’x’’x’Z = yZ = y22yy33

YY11 = y = y11x+yx+y11’x’’x’

YY22 = y = y33x’x’

YY33 = y = y22’y’y33’’

Z = yZ = y11’y’y22’y’y33’’

ss yy11 yy22 yy33

11 00 00 00

22 00 00 11

33 00 11 00

44 00 11 11

55 11 00 00

66 11 00 11

ss yy11 yy22 yy33

11 11 11 00

22 11 00 11

33 11 00 00

44 00 00 00

55 00 00 11

66 00 11 00

Page 4: FSM Decomposition using Partitions on States

TerminologyTerminology

FSM is {FSM is {I, O, S, I, O, S, , , }} A A partitionpartition on on SS is a set of disjoint subsets of is a set of disjoint subsets of

states, whose set-union is states, whose set-union is S, S, i.e.i.e. = {B= {Bkk}; B}; Bi i BBj j ==, i , i j; U j; Uii B Bi i = S= S

NotationsNotations Subsets Subsets BBkk are called are called blocksblocks BB(s) (s) denotes the block containing state denotes the block containing state ss s s t t iff iff ss and and tt are in the same block, i.e. are in the same block, i.e. BB(s) = B(s) = B(t) (t)

Page 5: FSM Decomposition using Partitions on States

Partitions and Equivalence RelationsPartitions and Equivalence Relations

Relation Relation RR on sets on sets SS and and TT is a subset of pairs is a subset of pairs R = { (s,t) | s R t }R = { (s,t) | s R t }

Equivalence relation Equivalence relation RR ReflexiveReflexive: for all : for all s, s R ss, s R s SymmetricSymmetric: if : if s R ts R t, then , then t R st R s TransitiveTransitive: if : if s R ts R t and and t R ut R u, then , then s R us R u

PropositionProposition. If . If RR is an equivalence relation on is an equivalence relation on SS, , then the set of equivalence classes is a partition then the set of equivalence classes is a partition on on SS, and conversely, every partition , and conversely, every partition on on SS is is an equivalence relation an equivalence relation RR

Page 6: FSM Decomposition using Partitions on States

Operations on PartitionsOperations on Partitions

Definition.Definition. Product of partitions, Product of partitions, 11 and and 22, , is a is a partition partition 1122 on on SS such that such that s s 1122 t t iff iff s s 11 t t and and s s 22 t t

Definition.Definition. Sum of partitions, Sum of partitions, 11 and and 22, , is a partition is a partition 11++22 on on SS such that such that s s 1+1+22 t t iff there exist a sequence of states in iff there exist a sequence of states in SS, , s=ss=s00,s,s11,…,s,…,snn, for which , for which ssii 11 s si+1i+1 or or ssii 22 s si+1i+1

Definition.Definition. Partition Partition 22 is larger or equal to partition is larger or equal to partition 11, , 11 22,, if and only if if and only if 1 1 2 2 = = 1 1 (equivalently, (equivalently, 11 + + 2 2 = = 22))

Page 7: FSM Decomposition using Partitions on States

ExampleExample S = { 1,2,3,4,5,6,7,8,9 }S = { 1,2,3,4,5,6,7,8,9 }

1 1 = { 1,2 | 3,4 | 5,6 | 7,8,9 } = { 1,2 | 3,4 | 5,6 | 7,8,9 }

2 2 = { 1,6 | 2,3 | 4,5 | 7,8 | 9 }= { 1,6 | 2,3 | 4,5 | 7,8 | 9 }

112 2 = { 1 | 2 | 3 | 4 | 5 | 6 | 7,8 | 9 }= { 1 | 2 | 3 | 4 | 5 | 6 | 7,8 | 9 }

11++2 2 = { 1,2,3,4,5,6 | 7,8,9 }= { 1,2,3,4,5,6 | 7,8,9 }

1 2 3 4 5 6 7 8 9

Page 8: FSM Decomposition using Partitions on States

Partitions as a LatticePartitions as a Lattice

DefinitionDefinition. Let . Let (S, (S, )) be a partially ordered set, and be a partially ordered set, and TT be be a subset of a subset of SS. Then . Then s s S S is the is the least upper boundleast upper bound (l.u.b.) of (l.u.b.) of TT iff iff

s s t t for all for all tt in in TT

s’ s’ t t for all for all tt in in TT implies that implies that s’ s’ s s DefinitionDefinition. A lattice is partially ordered set, . A lattice is partially ordered set, L = (S, L = (S, ),),

which has a which has a l.u.b.l.u.b. and a and a g.l.b.g.l.b. DefinitionDefinition. If . If LL is a finite lattice, then it has a l.u.b. and is a finite lattice, then it has a l.u.b. and

g.l.b. for the set of all elements in g.l.b. for the set of all elements in LL, denoted by , denoted by 11 and and 00. . Element Element 11 is called is called identity,identity, and and 00 is called is called zerozero..

TheoremTheorem. Partitions form a lattice.. Partitions form a lattice.

Page 9: FSM Decomposition using Partitions on States

ExampleExample

Lattice of subsets of Lattice of subsets of S={1,2,3}S={1,2,3}

Lattice of partitions on Lattice of partitions on S={1,2,3}S={1,2,3}

{1,2,3}

{3}{2}{1}

{1,2} {1,3} {2,3}

{1,2,3}

{1 | 2 | 3}

{1 | 2,3}{1,2 | 3} {1,3|2}

Page 10: FSM Decomposition using Partitions on States

SP-PartitionsSP-Partitions

Definition.Definition. A partition A partition on the set of states on the set of states SS of of the machine the machine M = (S,I,O,M = (S,I,O,,,)) has the substitution has the substitution property (is SP-partition) iff the states in any property (is SP-partition) iff the states in any block, under all inputs, transit into another block, block, under all inputs, transit into another block, i. e. i. e. x x [ s [ s t ]t ] [ [ (s,x) (s,x) (t,x) ](t,x) ]

Page 11: FSM Decomposition using Partitions on States

ExampleExample

A

B

B

SP-partition:SP-partition:

= { 1,2 | 3,4,5 } = { A,B }= { 1,2 | 3,4,5 } = { A,B }

Page 12: FSM Decomposition using Partitions on States

-Image of FSM-Image of FSM

Definition.Definition. Let Let be an SP-partition on the set of be an SP-partition on the set of states states SS of the machine of the machine M = (S,I,O,M = (S,I,O,,,). ). Then, Then, the the -image of -image of MM is the machine is the machine MM = ({B = ({B},I,},I,))

with with (B(B,x) = B,x) = B’ ’ iff iff (B(B,x) ,x) B B’.’.

Page 13: FSM Decomposition using Partitions on States

ExampleExample

A

B

B

SP-partition:SP-partition:

= { 1,2 | 3,4,5 } = { A,B }= { 1,2 | 3,4,5 } = { A,B }

Page 14: FSM Decomposition using Partitions on States

ObservationsObservations Observation 1. Observation 1. Machine Machine MM performs only part of the performs only part of the

computation of machine computation of machine MM, because it only keeps track , because it only keeps track of which block of of which block of contains the given state. contains the given state.

Observation 2. Observation 2. If If is an SP-partition, and we know the is an SP-partition, and we know the block of block of ,, which contains the given state of which contains the given state of MM, then we , then we can compute the block of can compute the block of ,, to which this state of to which this state of MM is is transformed by any input sequence. Machine transformed by any input sequence. Machine MM performs this computation. performs this computation.

On the other hand, if On the other hand, if is not an SP-partition, then it is is not an SP-partition, then it is not possible to predict where the given state will go not possible to predict where the given state will go under some input sequences. under some input sequences. In other words, an SP-partition defines an uncertainty In other words, an SP-partition defines an uncertainty about the states of about the states of MM, which does not spread as the , which does not spread as the machine operates.machine operates.

Page 15: FSM Decomposition using Partitions on States

SP-Partitions as a Sub-LatticeSP-Partitions as a Sub-Lattice

Lemma.Lemma. SP-partitions are closed under SP-partitions are closed under product and sum operations.product and sum operations.

Theorem.Theorem. SP-partitions form a sub-lattice SP-partitions form a sub-lattice of the lattice of all partitionsof the lattice of all partitions

Page 16: FSM Decomposition using Partitions on States

ExampleExample

11 = { 1,2 | 3,4 | 5,6 | 7,8 } = { 1,2 | 3,4 | 5,6 | 7,8 }

22 = { 1,2,3,4 | 5,6,7,8 } = { 1,2,3,4 | 5,6,7,8 }

33 = { 1 | 2 | 3 | 4,5 | 6 | 7 | 8 } = { 1 | 2 | 3 | 4,5 | 6 | 7 | 8 }

44 = { 1,2 | 3,4,5,6 | 7,8 } = { 1,2 | 3,4,5,6 | 7,8 }

55 = { 1 | 2 | 3,6 | 4 | 5 | 7 | 8 } = { 1 | 2 | 3,6 | 4 | 5 | 7 | 8 }

66 = { 1 | 2 | 3,6 | 4,5 | 7 | 8 } = { 1 | 2 | 3,6 | 4,5 | 7 | 8 }

1

0

44 22

55

6633 11

Page 17: FSM Decomposition using Partitions on States

ObservationsObservations

Lattice of SP-partitions shows all non-trivial Lattice of SP-partitions shows all non-trivial parallel-serial decompositions of the FSMparallel-serial decompositions of the FSM The lattice is a picture of FSM structureThe lattice is a picture of FSM structure

Algebraic properties of the lattice are reflected in Algebraic properties of the lattice are reflected in the machine properties, and vice versa the machine properties, and vice versa FSMs can be classified according to their latticesFSMs can be classified according to their lattices

Page 18: FSM Decomposition using Partitions on States

Decomposition of FSMsDecomposition of FSMs

Definition.Definition. Machine Machine MM is is decomposabledecomposable into two into two machines, machines, MM11 and and MM22, if the set of i/o strings , if the set of i/o strings

produced by produced by MM is equal to the set of i/o strings is equal to the set of i/o strings produced by the composition of produced by the composition of MM11 and and MM22. .

Definition.Definition. Decomposition of Decomposition of MM into two machines, into two machines, MM11 and and MM22, is , is non-trivialnon-trivial if if MM11 and and MM22 have fewer have fewer

states than states than MM..

Page 19: FSM Decomposition using Partitions on States

Parallel CompositionParallel Composition Definition.Definition. Given the state machines Given the state machines

MM11 = (S = (S11, I, , I, 11)) and and MM22 = (S = (S22, I, , I, 22)), ,

and the output function and the output function : S: S11 S S22 I I O O, ,

the parallel composition of the parallel composition of MM11 and and MM22 is the is the

machine machine M = (SM = (S11 S S22, I, O, , I, O, , , )), where , where

((s((s11,s,s22), (x), (x11, x, x22)) = ()) = (11(s(s11, x, x11), ), 22(s(s22, x, x22)).)).M

M2

M1

I1

S1

S2

O

Page 20: FSM Decomposition using Partitions on States

Serial CompositionSerial Composition

Definition.Definition. Given the state machines Given the state machines

MM11 = (S = (S11, I, I11, , 11)) and and MM22 = (S = (S22, I, I22, , 22))

with with II22 = S = S11 I I11, a set of output symbols , a set of output symbols OO, and an , and an

output function output function : S: S11 S S22 I I11 O O, then the serial , then the serial

composition of composition of MM11 and and MM22 with the output function with the output function is is

the machine the machine M = (SM = (S11 S S22, I, I11, O, , O, , , )), where , where ((s,t),x) ((s,t),x)

= (= (11(s, x), (s, x), 22(t,(s,x))).(t,(s,x))).

M

M1 M2

I1

S1 S2 O

Page 21: FSM Decomposition using Partitions on States

TheoryTheory

Theorem 1.Theorem 1. Machine Machine MM has a non-trivial has a non-trivial parallel decomposition iff there exist two parallel decomposition iff there exist two non-trivial SP-partitions non-trivial SP-partitions 11 and and 22 on the on the

states of states of MM, such that , such that 11 22 = 0.= 0.

Theorem 2.Theorem 2. Machine Machine MM has a non-trivial has a non-trivial serial decomposition iff there exist a non-serial decomposition iff there exist a non-trivial SP-partition trivial SP-partition on the states of on the states of MM..

Page 22: FSM Decomposition using Partitions on States

Parallel Decomposition (part 1)Parallel Decomposition (part 1)

SP-partitions:SP-partitions:

11 = { 0,1,2 | 3,4,5 } = { A,B } = { 0,1,2 | 3,4,5 } = { A,B }

22 = { 0,5 | 1,4 | 2,3 } = { I,II,III } = { 0,5 | 1,4 | 2,3 } = { I,II,III }

A

B

Page 23: FSM Decomposition using Partitions on States

Parallel Decomposition (part 2)Parallel Decomposition (part 2)

M

M2

M1

I

S1

S2

M

M1 M2

Page 24: FSM Decomposition using Partitions on States

Serial Decomposition (part 1)Serial Decomposition (part 1)

A

B

B

SP-partition:SP-partition:

= { 1,2 | 3,4,5 } = { A,B }= { 1,2 | 3,4,5 } = { A,B }

Page 25: FSM Decomposition using Partitions on States

Serial Decomposition (part 2)Serial Decomposition (part 2)

c

a

b

Another partition:Another partition:

= { 1,3 | 2,4 | 5 } = { a,b,c }= { 1,3 | 2,4 | 5 } = { a,b,c }

Page 26: FSM Decomposition using Partitions on States

Serial Decomposition (part 3)Serial Decomposition (part 3)

M

M1 M2

M

M1M2

Page 27: FSM Decomposition using Partitions on States

Computation of All SP-partitionsComputation of All SP-partitions

For every pair of states, For every pair of states, ss and and tt, compute the , compute the SP-partition containing these states in one block. SP-partition containing these states in one block. The resulting non-trivial partitions are the smallest The resulting non-trivial partitions are the smallest

partitions of the lattice of SP-partitionspartitions of the lattice of SP-partitions

Find all possible sums of the above partitionsFind all possible sums of the above partitions The resulting non-trivial partitions are the remaining The resulting non-trivial partitions are the remaining

partitions of the lattice of SP-partitionspartitions of the lattice of SP-partitions