1 relations: the second time around chapter 7 equivalence classes
Post on 21-Dec-2015
229 views
TRANSCRIPT
1
Relations: The Second Time Around
Chapter 7
Equivalence Classes
2
7.1 Relations Revisited: Properties of Relations
Ex. 7.3 Consider a finite state machine M=(S,I,O,v,w).(a) For s1,s2 in S, define s1Rs2 if v(s1,x)=s2 for some x in I. Relation R establishes the first level of reachability.(b) The second level of reachability. s1Rs2 if v(s1,x1x2)=s2
for some x1x2 in I2. For the general reachability relation we have v(s1,y)=s2 for some y in I*.(c) Given s1,s2 in S, the relation 1-equivalence, which is denoted by s1E1s2, is defined when w(s1,x)=w(s2,x) for all x in I. This idea can be extended to states being k-equivalence, where s1Eks2 if w(s1,y)=w(s2,y) for all y in Ik.If two states are k-equivalent for all k in Z+, then they are calledequivalent.
3
7.1 Relations Revisited: Properties of Relations
Def. 7.2 A relation R on a set A is called reflexive if for all x in A, (x,x) is in R.
Ex. 7.4 For = {1,2,3,4}, a relation R will be reflexiveif and only if R {(1,1), (2,2), (3,3), (4,4)}. R = {( , )|, , } is reflexive on .
Ex. 7.5 If | |= , | |= There are relations on .How many of these are reflexive?We must include {( The remaining pairscan be either included or excluded from the relation. Therefore,
there are reflexive relations.
2
i
A A Ax y
x y A x y A
A n A A n A
a a a A n n
n
i i
n n
.
, )| }.
2
2
2
2
2
4
7.1 Relations Revisited: Properties of Relations
Def. 7.3 Relation R on set is call symmetric if ( , ) R( , ) R, for all , .
A x yy x x y A
Ex. 7.6 With A={1,2,3}, we have:(a) R1={(1,2),(2,1),(1,3),(3,1)}, symmetric, but not reflexive;(b) R2={(1,1),(2,2),(3,3),(2,3)}, reflexive, but not symmetric;(c) R3={(1,1),(2,2),(3,3)}, R4={(1,1),(2,2),(3,3),(2,3),(3,2)}, both reflexive and symmetric;(d) R5={(1,1),(2,3),(3,3)}, neither reflexive nor symmetric.
5
7.1 Relations Revisited: Properties of Relations
To count the symmetric relations on = { write as where and
contains 1
2 subsets of
the form {( Therefore, there are
symmetric relations on . And reflexive and symmetric relations on .
Def. 7.4 For a set , a relation R on is called if forall , , , ( ,
11 2
2
A a a aA A A A A a a i n A
a a i j n i j A n n
a a a a
AA
A A transitivex y z A x y
ni i
i j
i j j in n n
n n
, , , },, {( , | }
{( , )| , , }. ( )
, ), ( , )}.( )
( )
21 2
2
1
2
1
2
1
1
2 2
2
2
2
), ( , ) R ( , ) R.y z x z
6
7.1 Relations Revisited: Properties of Relations
Ex. 7.8 Define the relation R on the set Z+ by aRb if a exactlydivides b. Then R is transitive, reflexive, but not symmetric (2R6,but not 6R2)
Ex. 7.9 Consider the relation R on the set Z where R when0. Then R is reflexive, symmetric, but not transitive.
(3R0,0R - 7, but not 3R - 7)
Def. 7.5 Consider a relation R on a set , R is called if for all , , ( R and R ) = .Ex. 7.11 the subset relation: R if , reflexive, transitive,antisymmetric, but not symmetric.Ex. 7.12 = {1,2,3}, R = {(1,2), (2,1), (2,3)} is neither symmetricnor antisymmetric. R = {(1,1), (2,2)} is both symmetric and antisymmetric.
a bab
A antisymmetrica b A a b b a a b
A B A B
A
7
7.1 Relations Revisited: Properties of Relations
To count the antisymmetric relations on = { write as where and
contains 1
2 subsets of
the form {( There are 3 choices for this kind ofsubsets: select one or none of them. Therefore, there are
antisymmetric relations on . And reflexive and antisymmetric relations on .
11 2
2
A a a aA A A A A a a i n A
a a i j n i j A n n
a a a a
AA
ni i
i j
i j j i
n n n n n
, , , },, {( , | }
{( , )| , , }. ( )
, ), ( , )}.
( ) ( )
21 2
2
1
2
1
2
1
1
2 3 32 2
8
7.1 Relations Revisited: Properties of Relations
Def. 7.6 A relation R os a set A is called a partial order, or apartial ordering relation, if R is reflexive, antisymmetric, andtransitive. (It is called a total order if for any a,b in A, either a Rbor bRa).
Examples of partial order: , , , ,
Ex. 7.15. Define the relation R on the set Z+ by aRb if a exactlydivides b. R is a partial order.
Def. 7.7 An equivalence relation R on a set A is a relation that isreflexive, symmetric, and transitive.
Examples: aRb if a mod n=b mod n
The equality relation {(ai,ai)|ai in A} is both a partial order andan equivalence relation.
9
7.2 Computer Recognition: Zero-One Matrices and Directed Graphs
Def. 7.8 If , , and are sets with R and Rthen the composite relation R R is a relation from to defined by R R and there are exists
with ( , ) R R
1 21 2
1 21 2
A B C A B B CA C
x z x A z Cy B x y y z
,
{( , )| , ,, ( , ) }.
(Note the different ordering with function composition.)
Ex. 7.17 A={1,2,3,4}, B={w,x,y,z}, and C={5,6,7}. ConsiderR1={(1,x),(2,x),(3,y),(3,z)}, a relation from A to B, and R2={(w,5),(x,6)}, a relation from B to C. Then R1 R2={(1,6),(2,6)}is a relation from A to C.
Theorem 7.1 Let A, B, C, and D be sets with RR and R Then R R R( R R R
12 3 1 2 3
1 2 3
A BB C C D
,, . ( )
) .
10
7.2 Computer Recognition: Zero-One Matrices and Directed Graphs
Def. 7.9 Given a set and a relation R on , we define the R recursively by (a) R R; and (b) for Z R
R R
Ex. 7.19 If = {1,2,3,4} and R = {(1,2), (1,3), (2,4), (3,2)}, thenR R and for 4, R
Def. 7.10 - (Use boolean operation, 1 +1 =1)
Ex. 7.20
1
is a 3 4 (0,1) - matrix.
1 + +1
2 3
A A powerof n
An
zero one matrix
n
n
n
,.
{( , ), ( , ), ( , )}, {( , )}, .
1 4 1 2 3 4 1 4
0 0 1
0 1 0 1
1 0 0 0
11
7.2 Computer Recognition: Zero-One Matrices and Directed Graphs
Ex. 7.21 A={1,2,3,4}, B={w,x,y,z}, and C={5,6,7}. R1={(1,x),(2,x),(3,y),(3,z)}, a relation from A to B, and R2={(w,5),(x,6)}, a relation from B to C.
relation matrixM M
w
x
y
zw x y z
M M M
( ) , ( )
( ) ( ) (
R R
5 6 7
R R R
1 2
1 2
1
2
3
4
0 1 0 0
0 1 0 0
0 0 1 1
0 0 0 0
1 0 0
0 1 0
0 0 0
0 0 0
0 1 0 0
0 1 0 0
0 0 1 1
0 0 0 0
1 0 0
0 1 0
0 0 0
0 0 0
0 1 0
0 1 0
0 0 0
0 0 0
1 2)R
12
7.2 Computer Recognition: Zero-One Matrices and Directed Graphs
Let A be a set with |A|=n and R a relation on A. If M(R) is therelation matrix for R, then(a) M(R)=0 (the matrix of all 0's) if and only if R is empty(b) M(R)=1 (the matrix of all 1's) if and only if R=A A(c) M(Rm)=[M(R)}m, for m in Z+.
Def. 7.11 Let = ( , = ( be two (0,1) -
matrices. We say that precedes, or is less than, , and wewrite , if for all , .
Ex. 7.23 With =1
0
0
0
1
1 and =
1
0
0
1
1
1 we have .
In fact, there are eight (0,1) - matrices for which .
E e F f m n
E FE F e f i m j n
E F E F
G E G
ij m n ij m n
ij ij
) )
,
,
1 1
13
7.2 Computer Recognition: Zero-One Matrices and Directed Graphs
Def. 7.12 For Z is the (0,1) - matrix
where if =
if Def 7.13 Let = ( be a (0,1) - matrix. The transpose of
, written , is the matrix ( where
for all 1 , .
Ex. 7.24 =
+
ij
tr * *
tr
n I n n
i j
i jA a
A A a a a
i m j n
A A
n ij n n
ij m n
ji n m ji ij
, ( )
,
,)
) ,
, .
1
0
10 1
0 0
1 1
0
1
0
0
1
1
14
7.2 Computer Recognition: Zero-One Matrices and Directed Graphs
Theorem 7.2 Given a set with | |= , and a relation R on ,let denote the relation matrix for R. Then(a) R is reflexive if and only if
(b) R is symmetric if and only if =
(c) R is transitive if and only if =
(d) R is antisymmetric if and only if
tr
2
tr
A A n AM
I M
M M
M M M M
M M I
n
n
.
.
.
.( , )0 0 0 1 1 0 0 1 1 1
15
Proof of (c) Let If ( , ), ( , ) R,
1 1 1 Hence ( , ) R.
Conversely, if R is transitive and is the relation matrix for R,
let be the entry in row and column of with
For to be 1 in there must exist at least one where in . This happens only if ( , ), ( , ) R. With
R transitive, it then follows that ( , ) R.
2
2
2
M M x y y z
M x z
M
s x z M s
s M y Am m M x y y z
x z
xy yz xz
xz xz
xz
xy yz
.
.
, .
,
1
1
So and2
m
M Mxz
1
.
7.2 Computer Recognition: Zero-One Matrices and Directed Graphs
16
7.2 Computer Recognition: Zero-One Matrices and Directed Graphs
Def. 7.14 Directed Graphs G=(V,E) (Digraph)
Ex. 7.25
1 2
4 3 5isolated vertex (node)
a loop V={1,2,3,4,5}E={(1,1),(1,2),(1,4),(3,2)}
1 is adjacent to 2.2 is adjacent from 1.
Undirected graphs: no direction in edges
17
7.2 Computer Recognition: Zero-One Matrices and Directed Graphs
Ex. 7.26
(s1) b:=3;(s2) c:=b+2;(s3) a:=1;(s4) d:=a*b+5;(s5) e:=d-1;(s6) f:=7;(s7) e:=c+d;(s8) g:=b*f;
Construct a directed graph G=(V,E), whereV={s1, s2, s3, s4, s5, s6, s7, s8} and (si, sj) in Eif si must be executed before sj.
s3 s1 s6
s4 s2 s8
s5 s7
precedence graph
precedence constraint scheduling3 processors: 3 time units2 processors: 4 time units
In general, n tasks,m processors: NP-completem=2: polynomialm=3: open problem
18
7.2 Computer Recognition: Zero-One Matrices and Directed Graphs
Ex. 7.27 relations and digraphs
A={1,2,3,4}, R={(1,1),(1,2),(2,3),(3,2),(3,3),(3,4),(4,2)}
1
2
34
directed graphrepresentation
1
2
34
associatedundirected graph
a connected graph: a pathexists between any two vertices
cycle: a closed path (thestarting and ending verticesare the same)
path: no repeated vertex
Def. 7.15 Strongly connected digrapha directed path exists between any two vertices
The above graph is not strongly connected. (no directed path from 3 to 1)
19
7.2 Computer Recognition: Zero-One Matrices and Directed Graphs
Ex. 7.28 Components
1 2
3 4
two components
1 2
3 4
one component
Ex. 7.29 Complete Graphs: Kn
K1 K2 K3 K4
K5
(n vertices with n(n-1)/2 edges)
20
7.2 Computer Recognition: Zero-One Matrices and Directed Graphs
directed graphs relations
adjacency matrices relation matrices
Ex. 7.30 If R is a relation on finite set A, then R is reflexive if and only if its directed graph contains a loop at each vertex.
Ex. 7.31 A relation R on a finite set A is symmetric if and onlyif its directed graph contains only loops and undirected edges.
Ex. 7.31 A relation R on a finite set A is transitive if and only if inits directed graph if there is a path from x to y, (x,y) is an edge.A relation R on a finite set A is antisymmetric if and only if inits directed graph there are no undirected edges aside from loops.
21
7.2 Computer Recognition: Zero-One Matrices and Directed Graphs
Ex. 7.33 A relation on a finite set A is an equivalence relationif and only if its associated (undirected) graph is one complete graph augmented by loops at every vertex or consists of the disjoint union of complete graphs augmented by loops at every vertex.
reflexive: loop on each vertexsymmetric: undirected edgetransitive: disjoint union of complete graphs
22
7.3 Partial Orders: Hasse Diagrams
natural counting: Nx+5=2 : Z2x+3=4 : Qx2-2=0 : Rx2+1=0 : C
Something was lost when we wentfrom R to C. We have lost the abilityto "order" the elements in C.
Let A be a set with R a relation on A. The pair (A,R) is calleda partially ordered set, or poset, if relation R is a partial order.
Ex. 7.34 Let A be the courses offered at a college. Define R on Aby xRy if x,y are the same course (reflexive) or if x is a prerequisitefor y. Then R makes A into a poset.
23
7.3 Partial Orders: Hasse Diagrams
Ex. 7.36 PERT (Performance Evaluation and Review Technique)
J1 J6
J3
J2J5
J4
J7
Find each job's earliest start time and latest start time.Those jobs which earliness equals to lateness are critical.All critical jobs form a critical path.
A poset
24
7.3 Partial Orders: Hasse Diagrams
not partial order
1 21
2
3
not antisymmetric not transitive or not antisymmetric
Ex. 7.37 Hasse diagram
1
2 3
4
1
2 3
4
a partialorder
corresponding Hasse diagram
Read bottom up.reflexivity andtransitive linksare not shown.
25
7.3 Partial Orders: Hasse Diagrams
Ex. 7.38
{1,2,3}
{1,2} {1,3} {2,3}
{1} {2} {3}
subset relation exactly division relation
1
2
4
8
2 3 5 72 3 5 7 11
6
12385
35
equalityrelation
26
7.3 Partial Orders: Hasse Diagrams
Def. 7.16 If (A,R) is a poset, we say that A is totally ordered iffor all x,y in A either xRy or yRx. In this case R is called a totalorder.
For example, <,> are total order for N,Z,Q,R. But partiallyordered in C.
But can we list the elements for a partially ordered set insome way?
sorting for a totally ordered set
27
7.3 Partial Orders: Hasse Diagrams
topological sorting for a partially ordered set
A
C
B E
G F D
Hasse diagram fora set of tasks
How to execute the tasks one at a timesuch that the partial order is not violated?
For example, BEACGFD, EBACFGD, ...
28
7.3 Partial Orders: Hasse Diagrams
topological sorting sequence (linear extension)
a b
c d
a^bc^d: 2 jumps
a^bd^c: 2 jumps
b^ac^d: 2 jumps
b^a^d^c: 3 jumps
bd^ ac: 1 jumps
Find a linear extensionwith minimum jumps.
(an NP-complete problem)
29
7.3 Partial Orders: Hasse Diagrams
Def. 7.17 If ( , R) is a poset, then an element of is calleda of if for all , ( , ) R.( R = ) An element is called a minimal element of
if whenever and , then ( , ) R ( R = ).
Ex 7.42 With R the "less than or equal to" relation on the set Z, (Z, ) is a poset with neither a maximal nor a minimal element.The poset (N, ), however, has a minimal element 0 but nomaximal element.
A x Aimal element A a A a x x a
x a x a y AA b A b y b y b y b y
max
30
7.3 Partial Orders: Hasse Diagrams
{1,2} {1,3} {2,3}
{1} {2} {3}
1 min
2
4
8 max
2 3 5 72 3 5 7 11
6
12385
35
Ex.7.43
{1,2,3}max
min
max and min
min
max
unique max and min
31
7.3 Partial Orders: Hasse Diagrams
Theorem 7.3 If ( , R) is a poset and is finite, then has botha maximal and a minimal element.Proof: Let . If there is no element where and
R , then is maximal. Otherwise there is an element with and R If no element , satisfies
R , then is maximal. Otherwise we can find so that while R and R Continuing in this
manner, since is finite, we get to an element with( R for any where
11 1
1 2 22 2
3 1 2 2 3
A A A
a A a A a aa a a a A
a a a a a A a aa a a a Aa a a a a a a a
A a Aa a a A a a
nn
12
2 13
3 2 1
. ,
, .
, ) n na, so is maximal.The proof for minimal element is similar.
In topological sorting, each time we find a maximal element,or each time we find a minimal element.
32
7.3 Partial Orders: Hasse Diagrams
Def 7.18 If ( , R) is a poset, then an element is calleda element if R for all . Element is called a
element if R for all .
Ex. 7.44 Let = {1,2,3} and R be the subset relation.(a) With = ( ), the poset ( , ) has as a least elementand as a greatest element.(b) For = the collection of nonempty subsets of , the poset ( , ) has as a greatest element. There is no leastelement.(c) For = the collection of proper subsets of , the poset ( , ) has as a least element. There is no greatestelement
A x Aleast x a a A y A
greatest a y a A
UA P U A
UB U
B U
C UC
33
7.3 Partial Orders: Hasse Diagrams
Theorem 7.4 If the poset (A,R) has a greatest (least) element,then that element is unique.Proof: Suppose that x,y in A and that both are greatest elements.Then (x,y) and (y,x) are both in R. As R is antisymmetric, it follows that x=y. The proof for the least element is similar.
Def. 7.19 Let ( , R) be a poset with . An element iscalled a ( ) for if R ( R ) for all .An element ' is called a , , (
, ) if it is a lower bound (upper bound) of andfor all other lower bounds (upper bounds) " of we have
"R ' ( 'R ").
A B A x Alower upper bound B x b b x b B
x A greatest lower bound leastupper bound B
x Bx x x x
glblub
34
7.3 Partial Orders: Hasse Diagrams
Ex. 7.46 Let U={1,2,3,4}, with A=P(U), let R be the subsetrelation on A. If B={{1},{2},{1,2}}, then {1,2}, {1,2,3},{1,2,4}, and {1,2,3,4} are all upper bounds for B(in A), whereas {1,2} is a least upper bound (in B). Meanwhile, a greatest lower bound for B is the empty set, which is not in B.
Ex. 7.47 Let R be the "less than or equal to" relation for the poset(A,R). (a) If A=R and B=[0,1] or [1,0) or (0,1] or (0,1), then B has glb 0 and lub 1. (b) If A=R, B={q in Q|q2<2}. Then B has
2 as a lub and - 2 as glb, and neither of these is in B.
(c) A=Q, with B as in part (b). Here B has no lub or glb.
35
7.3 Partial Orders: Hasse Diagrams
Theorem 7.5 If ( ,R) is a poset and , then has at mostone lub (glb).
Def 7.20 The poset ( ,R) is called a if for any ,the element lub{ , } and glb{ , } both exist in .
Ex. 7.48 For = N and , N, define R by . Then{ , } = { , }, { , } = { , }, and (N, )
is a lattice.
Ex. 7.49 ( ( ), ) is a lattice with lub{ , } = and{ , } = for , .
A B A B
A lattice x y Ax y x y A
A x y x y x yx y x y x y x y
P U S T S TS T S T S T U
lub max glb min
glb
36
7.4 Equivalence Relations and Partitions
Def. 7.21 Given a set and an index set , let foreach . Then { is a partition of if(a) = and (b) for all , where .
Each subset is called a or of the partition.
Ex. 7.51 = {1,2,3,4,5,6,7,8,9,10}, then each of the followingdetermines a partition of :(a) b) c)
11
A I A Ai I A A
A A A A i j I i j
A cell block
AA
A AA A AA i i
ii i I
ii I
i j
i
i
},
{ , , , , }, { , , , , }( { , , }, { , , , }, { , , }( { ,
1 2 3 4 5 6 7 8 9 101 2 3 4 6 7 9 5 8 10
5
22 3
}, .
[ , ).}
1 5
1
i
A i A i iA
ii i
Ex. 7.52 = R, and for each Z, let Then { is a partition of R.Z
37
7.4 Equivalence Relations and Partitions
Def. 7.22 Let R be an equivalence relation on a set . Forany , the equivalence class of , denoted is definedby R
Ex. 7.53 R if 4|( - ) for , Z. For this equivalence we find that 0 Z 1 Z 2 Z 3
Ax A x xx y A y x
x y x y x yk k
k kk k
,{ | }.
{ , , , , , , } { | }{ , , , , , , } { | }{ , , , , , , } { | }{ , , , , , , } {
8 4 0 4 8 47 31 5 9 4 16 2 2 6 10 4 25 1 3 7 11
4 3
1 2 3k k Z | }.
, , , }And { 0 provides a partition of Z.
38
7.4 Equivalence Relations and Partitions
Ex. 7.54 For , Z, R if Then R is an equivelencerelation. What can we say about the corresponding partition of
Z? In general, forn any Z Therefore,
Z = [ ]
Theorem 7.6 If R is an equivalence relation on a set , and , , then (a) [ ]; (b) R if and only if and
(c) [ ] = [ ] or [ ] [ ] = .
2
+
=
a b a b a b
n n n n n
n
Ax y A x x x y x y
x y x y
n
2
0
.
, { , }.
.
;
39
7.4 Equivalence Relations and Partitions
Ex. 7.58 If an equivalence relation R on A={1,2,3,4,5,6,7} inducesthe partition ? What is R?A { , } { } { , , } { }1 2 3 4 5 7 6
R = ({1,2} {1,2}) ({3} {3}) {(4,5,7} {4,5,7})
({6} {6}), |R|= 22
1 3 1 152 2 2 .
Theorem 7.7 If A is a set, then (a) any equivalence relation R on Ainduces a partition of A, and (b) any partition of A gives rise to anequivalence relation on A.
Theorem 7.8 For any set A, there is a one-to-one correspondencebetween the set of equivalence relations on A and the set ofpartitions of A.
40
7.4 Equivalence Relations and Partitions
Ex. 7.59 (a) If = {1,2,3,4,5,6}, how many relations on areequivalence relations? one - to - one correspondence between equivalence relations and partitions
( , )
(b) How many of the equivalence relations satisfy 1,2 4
1,2,4 are in the same partition. ( , )=
A A
S i
S i
i
i
6 203
4 15
1
6
1
4.
.
41
7.5 Finite State Machines: The Minimization Process
Given s1,s2 in S, the relation 1-equivalence, which is denoted by s1E1s2, is defined when w(s1,x)=w(s2,x) for all x in I. This idea can be extended to states being k-equivalence, where s1Eks2 if w(s1,y)=w(s2,y) for all y in Ik.
If two states are k-equivalent for all k in Z+, then they are calledequivalent, denoted by s1Es2. Hence our objective is to determinethe partition of S induced by the equivalence relation E and selectone state for each equivalence class.
42
7.5 Finite State Machines: The Minimization Process
observations:(1) If two states in a machine are not 2-equivalent, could they possibly be 3-equivalent?
No. If and are not 2 - equivalent, then there exists in
such that ( , ) ( So for any , ( = (
1 22
s s xy
I w s xy w s xy z Iw s xyz w s xy w v s xy z w s xy w v s xy z
w s xyz
1 2
1 1 1 2 2
2
, )., ) ( , ) ( ( , ), ) ( , ) ( ( , ), )
, ).
In general, to find states that are (k+1)-equivalent, we look atstates that are k-equivalent.
43
7.5 Finite State Machines: The Minimization Process
observations:(b) Suppose E We wish to determine whether EThat is does ( ( for all strings
Because E E w(sConsequently, ( ( if
( ( ( ( That is, if ( E
In general, for s
2 1 3
2 1 1
2
s s s sw s x x x w s x x x
x x x I s s s s x w s xw s x x x w s x x x
w v s x x x w v s x x xv s x v s x
1 2 2
1 1 2 3 2 1 2 3
1 2 33
1 2 1 2 1 2 1
1 1 2 3 2 1 2 3
1 1 2 3 2 1 2 3
1 1 2 1
. ?, ) , )
? , , ) ( , )., ) , )
, ), ) , ), )., ) ( , ).
1 2 1 +
1
, s we have E if and only if(i) E and (ii) ( E for all .
S s ss s v s x v s x x I
k
k k
1 2
2 1 2, ) ( , )
44
7.5 Finite State Machines: The Minimization Process
s1 s4 s3 0 1s2 s5 s2 1 0s3 s2 s4 0 0s4 s5 s3 0 0s5 s2 s5 1 0s6 s1 s6 1 0
Ex. 7.60
0 1 0 1v w
step 1: determine 1-equivalent states by examining outputs
P1: {s1},{s2, s5, s6},{ s3, s4}
input 0
s5 s2 s1 s2 s5
P2: {s1},{s2, s5},{ s6},{ s3, s4}
input 1
s2 s5 s4 s3
P3=P2, the process is complete with 4 states.
A
C
B
D
45
7.5 Finite State Machines: The Minimization Process
Could it be that P3=P2, but P3=P4?
Def. 7.23 If are any partitions of a set , then is called a refinement of and we write if everycell of is contained in a cell of When and
we write This occurs when at least one cellin is properly contained in a cell in
In the minimization process, because ( + 1) -equivalence implies - equivalence. So each successivepartition refines the preceding partition.
2 21
2 1 22 2
2 1
+
P P A PP P P
P P P PP P P P
P P
P P kk
k k
12 1
11 1
1
,, ,
..
.
46
7.5 Finite State Machines: The Minimization Process
Theorem 7.9 In applying the minimization process, if 1and and are partitions with then for any + 1.Proof: If not, let ( + 1) be the smallest subscript such that
Then so there exist with Ebut E But E E for all .And with we then find that E forall . So
+ + +
+ + 1+ 1
kP P P P P P
r kr k
P P P P s s S s ss s s s v s x v s x x I
P P v s x v s xx I
k k k k r r
r r r r rr r r
r r r
1 1 1
1 1 1 2 21 1 2 2 1 1 2
1 1 2
,
. , ,. ( , ) ( , )
, ( , ) ( , )s s P Pr r r1 + +E Consequently, 1 2 1. .
If there must be a smallest integer 0 such that
E but E That is, there is an such that( (but they will agree on the first outputs) is called a for and
1
1 1+
1 2
s s k
s s s s x Iw s x w s x kx distinguishing string s s
k kk
2
2 1 21
1 2
,
., ) ( , ).
.
47
7.5 Finite State Machines: The Minimization Process
How to find the minimal length distinguishing string?
s1 s4 s3 0 1s2 s5 s2 1 0s3 s2 s4 0 0s4 s5 s3 0 0s5 s2 s5 1 0s6 s1 s6 1 0
0 1 0 1v w
Ex. 7.61P1: {s1},{s2, s5, s6},{ s3, s4}
input 0
s5 s2 s1 s2 s5
P2: {s1},{s2, s5},{ s6},{ s3, s4}
input 1
s2 s5 s4 s3
A distinguishing string for s2 and s6 is 00 (or 01).
48
7.5 Finite State Machines: The Minimization Process
s1 s4 s2 0 1s2 s5 s2 0 0s3 s4 s2 0 1s4 s3 s5 0 1s5 s2 s3 0 0
0 1 0 1v w P1: {s1 ,s3, s4},{s2, s5}
input 1s2 s2 s5 s2 s3
input 1s2 s2 s5
Ex. 7.62
P2: {s1 ,s3, s4},{s2},{ s5}
P3: {s1 ,s3},{ s4},{s2},{ s5}
distinguishing string for s1 and s4: 111
49
Exercise: P318:10 P330:20 P340:26 P346:10 P356:14