2 Sets and functions

2.3 Set algebra

2.3.1 Commutativity and associativity

This section is about the laws that union, intersection, difference, and complement obey.

Theorem 2.3.1.

For all sets A and B,

  • AB=BA, and

  • AB=BA.

These are called the commutativity properties for intersection and union. These results might seem obvious, but we will write out the proofs carefully because the method of using logical equivalences will be applied to more complex set identities later.

Proof.

By definition,

AB ={x:xAxB}
BA ={x:xBxA}.

Theorem 1.5.1 tells us that for any two WFFs ϕ and ψ, the formulas (ϕψ) and (ψϕ) are logically equivalent: one is true if and only if the other is true. So

xAxB

is true if and only if

xBxA

is true. This shows that for any x we have xAB if and only if xBA, so by definition of set equality, AB=BA.

The argument for is the same, except that we use the logical equivalence (ϕψ)(ψψ). ∎

What this proof shows is that if you have a set X defined in set builder notation using a logical formula

X={x:P(x)}

then it is equal to any other set defined using a logically equivalent formula.

Theorem 2.3.2.

For all sets A, B, C we have

  • A(BC)=(AB)C and

  • A(BC)=(AB)C.

This is the associativity property for and .

Proof.

Like the proof of the last theorem, these equalities follow from the associativity properties for and we saw in Theorem 1.5.1. ∎

Associativity tells us means there’s no ambiguity in writing

ABC or ABC

without any brackets to indicate which union or intersection should be done first. Compare this with

1+2+3.

There’s no need for brackets because it doesn’t matter whether you do 1+2 first then add 3, or whether you add 1 to the result of 2 + 3. On the other hand 1+2×3 or 123 require either brackets or a convention on which operation to do first. Similarly A(BC) is different to (AB)C in general, so the brackets here are obligatory, and A(BC) is different to (AB)C.

2.3.2 The distributive laws

Because we defined unions and intersections using logical conditions on set elements, they should obey laws that come from the results we proved about and .

Theorem 2.3.3.

For any sets A, B, C

  1. 1.

    A(BC)=(AB)(AC) and

  2. 2.

    A(BC)=(AB)(AC).

Proof.

Consider the first of these identities. The left hand side consists of all things x such that

xA(xBxC). (2.2)

The right hand side consists of all things x such that

(xAxB)(xAxC) (2.3)

By Theorem 1.6.1, for any WFFs ϕ,ψ,θ we have ϕ(ψϕ)(ϕψ)(ϕψ). Thus any x makes (2.2) true if and only if it makes (2.3) true. So x belongs to the first set if and only if it belongs to the second, therefore the two sets are equal.

The second identity can be proved similarly. ∎