Informatics 1 - Computation & Logic: Tutorial 3
Counting
Week 5: 16-20 October 2017
Please attempt the entire worksheet in advance of the tutorial, and bring all work with you. Tutorials cannot function properly unless you study the material in advance. Attendance at tutorials is obligatory;pleaselet the ITO know if you cannot attend. You may work with others, indeed you should do so; but you must develop your own understanding; you can’t phone a friend during the exam. If you do not master the coursework you are unlikely to pass the exams.
If we want to go beyond yes/no questions, it is natural to ask, How many ...? We are interested in sets, so we will ask how many elements there are in a set. We will focus on finite sets. We write A or #A for the number of elements in A | | I Let A and B be disjoint finite sets , with at least one element, b B (A and B 2 may have other elements).
(a) Is b A? 2 Use arithmetic operators to give expressions for the following numbers:
(b) = (e) A B = |{}| | [ | (c) A b = (f) A B = | [{ }| | ⇥ | (d) a, b a A = (g) }A = |{h i| 2 }| | | (h) f f : A B = |{ | ! }| (i) R A A RisatotalorderingofA = |{ ✓ ⇥ | }| II Give rules, in the style of Tutorial 0, to generate the following sets:
(a) the set }N of finite subsets of the natural numbers, N. F✓ (b) the set N of natural numbers
1 The natural numbers N = 0, 1, 2, 3, 4,... correspond to the sizes of finite sets. { } For a finite set, the answer to the question, How many?, will be a number. Since = is a finte set, 0 is a natural number. ; {} In most living languages it is possible to name an arbitrary natural number. so, we can use natural language to give the answer. However, these names soon become unwieldy. Tally marks are a unary numeral system. Each element of the set we are counting is represented by a separate mark, a stroke.Forexample,thenumbersone,two, three are represented by , , .Tomakethisnotationmoreeasilylegible,forlarger numbers we use clusters. For example, four, five, six are represented by , , ; twelve is represented by ; In our everyday lives, we usually use decimal notation for natural numbers. A finite sequence of n digits xi 0,...,9 represents a number. 2{ } i xn 1,...,x0 represents 10 xi h i i Binary notation is similar. A finite sequence of n digits xi 0, 1 represents a 2{ } number. i xn 1,...,x0 represents 2 xi h i i In general, for k-ary notation (k>1), a finite sequence of n digits xi 0,...,n 1 2{ } represents a number. i xn 1,...,x0 represents n xi h i i