Secton 1.2 Subsets and the Boolean operatons on sets If every element of the set A s an element of the set B, we say that A s a subset of B, or that A s contaned n B, or that B contans A, and we wrte A B, or B A. Any set s a subset of tself: A A. When we want to say that A s a subset of B and A s dffrent from B, we say that A s a proper subset of B, and we wrte A B. For nstance, ; the fve basc number-sets are ncreasngly more comprehensve sets. n because every nteger s a ratonal number ( n = 1 ), but 1 not( ), snce 2 s a ratonal number but not an nteger. Note that for any set A, A : any thng that belongs to belongs to A as well. (there s nothng lke that) The followng general law, the Antsymmetry law for : A B & B A A = B (1) (here A and B are sets) s equvalent to the prncple of extensonalty (see the frst secton), namely the prncple that says that sets are determned by ther elements. In fact, the left-hand sde of the mplcaton n (1) says that all elements of A are elements of B and vce versa, whch s to say that A and B have the same elements. The antsymmetry law serves as the formal setup for showng that two sets gven by condtons are the same (f that s the case). One shows two thngs: one, that the frst set s contaned n the other, two, that the other s contaned n the frst. The reader should try ths on the example of the sets gven n (2) and (3) n Secton 1.1. Later n ths secton, we wll see another example. 7
An obvous law for s the law of Transtvty for : A B and B C A C. Although ths s completely obvous, t serves as the bass for an mportant generalzaton, n the noton of orderng, consdered n the next chapter. Note that the relatons "beng an element of", denoted by, and "beng a subset of", denoted by, are very dfferent. E.g., 2 {2, 7} does not hold; t does not even make sense, snce 2 s not a set. Of course, 2 {2, 7} does hold. Also, {2} {2, 7} holds, and ths s the same as 2 {2, 7}. On the other hand, {2} {2, 7} does not hold; n fact, the set {2, 7} has no element that s a set. It s possble that both A B and A B hold at the same tme; e.g., {1, 2} {{1, 2}, 1, 2}, {1, 2} {{1, 2}, 1, 2} ; however, such stuatons are rather rare n practce. The set of all subsets of a gven set A s called the power set of A, and t s denoted by (A). That s to say, X (A) X A. E.g., ({1, 2}) = {, {1}, {2}, {1, 2}}. (A) s never empty; the empty set s always n t. Also, A non-empty, (A) has at least two elements. (A), and thus, f A s 8
* * Wth A an alphabet, a set of symbols, A the set of strngs over A, a subset of A s called a language over A. The dea s that the strngs n the language are the well-formed sentences of the language (a sentence s consdered a sngle strng, by treatng the blanks as occurrences of a specal character called blank). Intally, we do not put any condton on how the sentences should be formed; hence the complete generalty of the defnton of language. The theory of formal languages, an mportant part of theoretcal computer scence, deals manly wth how one can generate a language by rules. The legal programs of PASCAL form a (formal) language; the relevance of formal language theory should be ndcated by ths remark alone. Later we wll also see partcular formal languages related to logc. The bracket notaton for sets s used n a modfed form to denote a subset of a gven set. {n n s prme} s the same as {n n and n s prme}, the set of postve prmes, and of course, t s a subset of. In what follows, captal letters always denote sets. The ntersecton of X and Y, n symbols X Y, that are elements of both X and Y at the same tme: s the set whose elements are the thngs a X Y a X and a Y. E.g., {1, 2, 4, 7, 10} {3, 4, 10, 13} = {4, 10}, {1, 2, 4} {3, 7} =, {n n s even} {n n s prme} = {2}. 9
n If A s a set for all values = 1, 2,..., n of the subscrpt, then A, the =1 ntersecton of the A, s the set of all those x whch are elements of all A : n x A =1 for all such that 1 n, we have x A. E.g., f A s the set of natural numbers dvsble by, then (why?). 10 A = A 8 9 5 7 = A =1 2520 One can take the ntersecton of any famly of sets except the ntersecton of the empty famly (whch would have to be the set of all thngs, a non-exstent set). If I s any set, and A s a partcular set for each I (n whch case we talk about the famly A εi of sets), then A, the ntersecton of the A, s the set of all thngs that belong to every A, I n I. The notaton A =1 means the same as A. {1,..., n} E.g., {k n k } = {0} (why?) ( -{0} = {n n 0} ). n -{0} The unon of two sets X and Y, denoted X ether X, or Y, or both: Y, s the set of all thngs that are elements of a X Y ether a X, or a Y (or both). E.g., {1, 2, 4, 7, 10} {3, 4, 10, 13} = {1, 2, 3, 4, 7, 10, 13}, {n n s even} {n n s odd} =. 10
We may take the unon of more than two sets. A denotes the set, called the unon of the I sets A, I, whose elements are those thngs that belong to at least one of the sets A. E.g., f B = {5k+ k }, then B = {0, 1, 2, 3, 4} 4 4 (why s that?). We wrte =0 nstead of, thus ε{0, 1, 2, 3, 4} B = =0. Or, to gve another example: f A s the set A = {n n s dvsble by, and n 120}, then 7 A = {n =2 n 120 and n s not prme} {2, 3, 5, 7} (ths s related to the equalty of the sets (2) and (3) n Secton 1.1). Here s another way we can use the unon ( ) and ntersecton ( ) symbols. Assume that X s a set of sets: that s, all elements of X are themselves sets. Then X denotes the unon of all the sets n X. 7 For nstance, f X = {A {2, 3, 4, 5, 6, 7, }}, then X s the same as A =2 consdered earler. We may gve the defnton of the notaton X thus: for any x, x X there s A X such that x A. Note that =. 11
The notaton X s smlar: t denotes the ntersecton of all the sets n the set X. In symbols: x X for all A X, we have x A. Here, there s an excluson: does not make sense. The reason s that the last dsplay would gve that all thngs x belong to ; however, "the set of all thngs" s not a legtmate concept. The thrd operaton we consder here s the dfference of two sets. X - Y denotes the set of those thngs that are n X, but are not n Y : a X - Y a X and a Y. E.g., {1, 2, 4, 7, 10} - {3, 4, 10, 13} = {1, 2, 7}. Let A be a fxed set, and consder the operatons of ntersecton, unon and dfference performed on subsets of A ; the result s always a subset of A agan. Ths s clear snce those operatons never nvolve elements that are not n ether of the sets n queston. We say that the collecton of all subsets of A s closed under the operaton of ntersecton, unon and dfference; the latter operatons are collectvely called the Boolean operatons. If all sets under consderaton are understood to be subsets of the fxed set A, then the dfference A - X s abbrevated as -X, and t s called the complement of X, or the complement of X wth respect to A n more detal. E.g., f we are talkng about subsets of, that s, A=, then - {n n s even} = {n n s odd}. The Boolean operatons obey certan laws. Here s a lst of them. In what follows, A s a fxed set, X, Y and Z denote arbtrary subsets of A ; -X means A-X. 12
Commutatve laws: X Y = Y X, X Y = Y X. Assocatve laws: X (Y Z) = (X Y) Z, X (Y Z) = (X Y) Z. Just lke n the case of addton and multplcaton of numbers, these laws have the consequence that n expressons usng several ntersecton operatons, or alternatvely, several unon operatons, parentheses may be omtted or restored n any meanngful way, and the order of terms may be changed, wthout alterng the value of the expresson. E.g., (X (U V)) Z = (U Z) (V X) = U V X Z. Absorpton laws: X (X Y) = X, X (X Y) = X. Idempotent laws: X X = X X X = X Dstrbutve laws: (X Y) Z = (X Z) (Y Z), (X Y) Z = (X Z) (Y Z). Laws for complements: X -X = 0, X -X = A ; De Morgan's laws: -(X Y) = (-X) (-Y), -(X Y) = (-X) (-Y). 13
The proofs of these denttes can be done va antsymmetry for. We consder the frst dstrbutve law. To show (X Y) Z (X Z) (Y Z), let x belong to the left-hand-sde, to show that t belongs to the rght-hand sde. Then x belongs both to X Y and Z. Snce t belongs to X Y, t ether belongs to X (Case 1), or to Y (Case 2), or possbly both. In Case 1, x belongs both to X and Z, hence, to X Z, and thus to (X Z) (Y Z). In Case 2, we obtan the same concluson smlarly. We have shown that x belongs to the rght-hand sde n any case. To show (X Y) Z (X Z) (Y Z), let x belong to the rght-hand sde, to show that t belongs to the left-hand sde. Snce x (X Z) (Y Z), ether x X Z (Case 1), or x Y Z (Case 2). In the frst case, x X and x Z ; from x X t follows that x X Y ; hence, x belongs to both X Y and Z, and thus to the left-hand sde. In Case 2, the argument s smlar. 14