Professional Documents
Culture Documents
Tutorial 2 PDF
Tutorial 2 PDF
2014-15
Tutorial #2
Q1. (a) Given sets S and T of sizes m and n respectively, how many functions f: S->T are there?
(b) Given set S of size m, how many boolean functions on S are there?
(b) Write an (intuitive) explanation of each of the binary boolean operations in (a).
====================================================================
Solutions:
Q1. a) A function f from S to T is essentially choosing a value from T for each value in S.
There are m members in S, and choice of f(x) is independent of f(y) for x and y in S:
c) This is a special case of (b) with S is the set of all binary sequences of length k.
Q2. Binary boolean operations i.e. boolean operations on two variables, say A and B:
Step 1: Identify all four combinations of values the two variables can take.
A B
0 0
0 1
1 0
1 1
Step 2: For each combination the value of a function can be 0 or 1 i.e. there should be (2 4 =) 16
functions.
Step 3: Think about what each function does and write an explanation.
f(A,B) Explanation
f4 A (Left) Projection i.e. (the function has) the same value as A
f6 B (Right) Projection
f1 0 (Constant) 0 (i.e. always false)
f16 1 (Constant) 1 (i.e. always true)
f2 A AND B 1 only if A is 1 and B is 1 (i.e. true if both A and B are true)
f8 A OR B 1 only if either A is 1 or B is 1 or both are 1
(i.e. true if at least one of A and B is true)
f5 A<B 1 only if A is 0 and B is 1 (i.e. true if B only is true)
f3 A>B 1 only if A is 1 and B is 0 (i.e. true if A only is true)
f10 A == B 1 only if A and B are same
f7 A != B 1 only if A is not the same as B
(i.e. true only if exactly one of them is true)
(a.k.a “Exclusive OR” a.k.a. “XOR” )
f14 A <= B 1 only if B is true whenever A is true (a.k.a. A implies B)
f12 A >= B B implies A
f13 NOT A (Left) Negation i.e. (the function has the value) that is the inverse /
negative of A i.e. 1 if A is 0 ; 0 if A is 1
(or true if A is false; false if A is true)
f11 NOT B (Right) Negation i.e. (the function has the value) that is the inverse /
negative of A i.e. 1 if A is 0 ; 0 if A is 1
(or true if A is false; false if A is true)
f15 NOT (A AND B) 1 only if at least one of them is 0 (i.e. true if at least one of them is false)
(a.k.a. NAND)
f9 NOT (A OR B) 1 only if A is 0 and B is 0 (i.e. true if both are false NOR)