7. For APPLICANTS IN $\left\{ \begin{array} { l } \text { COMPUTER SCIENCE } \\ \text { COMPUTER SCIENCE \& PHILOSOPHY } \end{array} \right\}$ ONLY.
Throughout this question, all functions will be Boolean functions of Boolean input variables. A Boolean variable can be either 0 or 1 . A Boolean function may have one or more Boolean input variables, and the output of a Boolean function is also either 0 or 1 . Three elementary Boolean functions are defined as follows:
- The function $\min \left( x _ { 1 } , \ldots , x _ { k } \right)$ can take any number of inputs. It outputs the value 1 exactly when each of its inputs is 1 , that is the output of the function is the minimum value among its inputs.
- The function $\max \left( x _ { 1 } , \ldots , x _ { k } \right)$ can take any number of inputs. It outputs the value 1 exactly when at least one of its inputs is 1 , that is the output of the function is the maximum value among its inputs.
- The function flip takes a single input and is defined as flip $\left( x _ { 1 } \right) = 1 - x _ { 1 }$.
First we will consider Boolean functions obtained by combining the three elementary Boolean functions. One such function is shown below:
$$f \left( x _ { 1 } , x _ { 2 } , x _ { 3 } \right) = \min \left( \max \left( x _ { 1 } , x _ { 2 } , x _ { 3 } \right) , \operatorname { flip } \left( \min \left( x _ { 1 } , x _ { 2 } , x _ { 3 } \right) \right) \right) .$$
(i) Describe in words when the function $f$ outputs 1 and when it outputs 0 .
(ii) The function majority $\left( x _ { 1 } , \ldots , x _ { k } \right)$ takes $k$ inputs and outputs 1 exactly when strictly greater than $k / 2$ of its inputs are 1 . Explain how you could combine elementary Boolean functions to obtain the following functions:
(a) majority $\left( x _ { 1 } , x _ { 2 } \right)$
(b) majority $\left( x _ { 1 } , x _ { 2 } , x _ { 3 } \right)$
Now we will consider Boolean functions that can be obtained by combining only majority functions.
(iii) There are exactly 16 distinct Boolean functions of two input variables. Some of these can be represented using only majority functions that take 3 inputs; the use of 0 or 1 as fixed inputs to majority is permitted. For example, majority $\left( x _ { 1 } , x _ { 2 } , 1 \right)$ represents the function $\max \left( x _ { 1 } , x _ { 2 } \right)$. Find any four other Boolean functions of two variables that can be represented by combining one or more majority functions of 3 inputs. Write your answers in terms of majority functions.
(iv) Give an example of a Boolean function $g$ of two input variables that cannot be represented by combining majority functions (of any number of inputs). You should write your answer by explicitly specifying $g ( 0,0 ) , g ( 0,1 ) , g ( 1,0 )$ and $g ( 1,1 )$. Justify your answer.
In the last part, you may express Boolean functions by combining any of the elementary Boolean functions or the majority function.
(v) Consider four input variables $x _ { 1 } , x _ { 2 } , x _ { 3 } , x _ { 4 }$. Let $z _ { 1 } = \min \left( x _ { 1 } , x _ { 2 } \right) , z _ { 2 } = \min \left( x _ { 2 } , x _ { 3 } \right)$, $z _ { 3 } = \min \left( x _ { 3 } , x _ { 4 } \right) , z _ { 4 } = \min \left( x _ { 4 } , x _ { 1 } \right)$. It is sometimes possible to represent a function $s \left( x _ { 1 } , x _ { 2 } , x _ { 3 } , x _ { 4 } \right)$ using a function $t \left( z _ { 1 } , z _ { 2 } , z _ { 3 } , z _ { 4 } \right)$. For example, $\min \left( x _ { 1 } , x _ { 2 } , x _ { 3 } , x _ { 4 } \right) = \min \left( z _ { 1 } , z _ { 2 } , z _ { 3 } , z _ { 4 } \right)$, as both functions output 1 if and only if all four $x _ { i }$ are 1 . Can you represent the following functions of inputs $x _ { 1 } , x _ { 2 } , x _ { 3 } , x _ { 4 }$ as some Boolean function of inputs $z _ { 1 } , z _ { 2 } , z _ { 3 } , z _ { 4 }$ ? Justify your answers.
(a) majority $\left( x _ { 1 } , x _ { 2 } , x _ { 3 } , x _ { 4 } \right)$.
(b) The function parity $\left( x _ { 1 } , x _ { 2 } , x _ { 3 } , x _ { 4 } \right)$ which outputs 1 exactly when an odd number of its inputs are 1 .
This page has been intentionally left blank
This page has been intentionally left blank
[Figure]