## 4.2.Defining and denoting sets

There are essentially two ways to specifying a set.

The first is to enumerate its members -- give a list of them. We represent such a set by listing its elements separated by commas and enclosed in braces, as follows { 5, 6, 7 }

Clearly this method is feasible only if the set has a small number of members.

Examples:

• Capitals of five continents: { Washington, London, Cairo, Peking, Canberra }
• The vowels: { a, e, i, o, u }
• My favorite animals: { rhino, gerbil }

The second method of defining a set is to specify a property which is common to all members, and to its members only. This property is called a defining property.

Our notation for this second is as follows: A name or identifier is introduced which stands for any member of the set being specified.

This is then followed by a statement of the defining property of the set. These two elements are separated by a vertical bar and enclosed in braces.

An example: { n | n is a natural number and 3 n and n < 6 }

In English: n is a natural number and n greater than or equal to 3, and less than 6.

It is possible to write the defining property in a shorter way: { n | n is a natural number and 3 n < 6 }

Examples:

• { w | w is a string of n letters, where n = 5 }
• { n | n is a natural number divisible by exactly two natural numbers }
• { n | n is a natural number and it exists a natural number
x with x * x = n }