0% found this document useful (0 votes)
38 views

1 Sem. 2014-15 Logic in Computer Science (CS/IS F214) Tutorial #2

(1) The document discusses binary boolean operations and functions between sets. (2) It explains that there are 16 binary boolean operations as every combination of two variables A and B can take one of two values. (3) The main boolean operations - AND, OR, XOR, implications and negations - are defined in terms of when their output is 1 based on the input values of A and B.

Uploaded by

AVISHA GUPTA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

1 Sem. 2014-15 Logic in Computer Science (CS/IS F214) Tutorial #2

(1) The document discusses binary boolean operations and functions between sets. (2) It explains that there are 16 binary boolean operations as every combination of two variables A and B can take one of two values. (3) The main boolean operations - AND, OR, XOR, implications and negations - are defined in terms of when their output is 1 based on the input values of A and B.

Uploaded by

AVISHA GUPTA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1st Sem.

2014-15

Logic in Computer Science (CS/IS F214)

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?

(c) How many boolean operations on k variables are there?

(d) How many binary boolean operations are there?

Q2. (a) Enumerate all the binary boolean operations.

(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.

For each members x in S, the f(x) could be any of the n values in T.

There are m members in S, and choice of f(x) is independent of f(y) for x and y in S:

Therefore there are nm possible functions from S to T.

b) This is a special case of (a) with T = { 0, 1 }.

c) This is a special case of (b) with S is the set of all binary sequences of length k.

d) This is a special case of (c) with k=2.

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.

A B f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16


0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
1 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

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)

You might also like