Chapter 4

Propositional Logic and Boolean Functions

[36/100%]
Show
LaTeX
Problem 105

Prove that the number of kk-dimensional faces in an nn-dimensional cube equals F(n,k)=Cnk⋅2n−kF(n, k)=C_{n}^{k} \cdot 2^{n-k}. Find the total number F(n)F(n) of faces of an nn-dimensional cube.

?
Problem 106

Let aˉ=(a1,a2,…,an)\bar{a}=\left(a_{1}, a_{2}, \ldots , a_{n}\right) and bˉ=(b1,b2,…,bn)\bar{b}=\left(b_{1}, b_{2}, \ldots , b_{n}\right) be two tuples (two points) of the nn-dimensional unit cube Bn\mathbb {B}^{n}. The Hamming distance between aˉ\bar{a} and bˉ\bar{b} is the number H(aˉ,bˉ)=∑i=1n∣ai−bi∣H(\bar{a}, \bar{b})=\sum_{i=1}^{n}\left|a_{i}-b_{i}\right|. Prove that this distance satisfies the following properties:

?
(a)

nonnegativity: H(aˉ,bˉ)⩾0H(\bar{a}, \bar{b}) \geqslant 0, with H(aˉ,bˉ)=0H(\bar{a}, \bar{b})=0 if and only if aˉ=bˉ\bar{a}=\bar{b};

(b)

symmetry: H(aˉ,bˉ)=H(bˉ,aˉ)H(\bar{a}, \bar{b})=H(\bar{b}, \bar{a});

(c)

the triangle inequality: H(aˉ,bˉ)⩽H(aˉ,cˉ)+H(cˉ,bˉ)H(\bar{a}, \bar{b}) \leqslant H(\bar{a}, \bar{c})+H(\bar{c}, \bar{b}).

Problem 107

Let aˉ,bˉ∈Bn\bar{a}, \bar{b} \in \mathbb {B}^{n} be points of the nn-dimensional unit cube, H(aˉ,bˉ)=kH(\bar{a}, \bar{b})=k. Prove that then

?
(a)

the shortest path along the edges of Bn\mathbb {B}^{n} connecting aˉ\bar{a} and bˉ\bar{b} contains kk edges;

(b)

in total there are kk! such distinct paths.

Problem 108

Let in the sequence of vectors

aˉ(0)=(0,…,0),aˉ(1),…,aˉ(n)=(1,…,1)∈Bn \bar{a}^{(0)}=(0, \ldots , 0), \bar{a}^{(1)}, \ldots , \bar{a}^{(n)}=(1, \ldots , 1) \in \mathbb {B}^{n}

each next element be obtained from the previous one by replacing one of the zeros with a one. Prove that the system of equations H(xˉ,aˉ(i))=kiH\left(\bar{x}, \bar{a}^{(i)}\right)=k_{i}, i=0,…,n,ki∈ωi=0, \ldots , n, k_{i} \in \omega, has at most one solution in Bn\mathbb {B}^{n}.

?
Problem 109

Find the vertices of the unit cube B5\mathbb {B}^{5} that are at the indicated distances from the vertices (0,0,0,0,0),(1,0,0,0,0),(1,1,0,0,0),(1,1,1,0,0),(1,1,1,1,0)(0,0,0,0,0),(1,0,0,0,0),(1,1,0,0,0),(1,1,1,0,0),(1,1,1,1,0), (1,1,1,1,1)(1,1,1,1,1) respectively:

?
(a)

2,1,2,3,2,32,1,2,3,2,3;

(b)

3,4,5,4,3,23,4,5,4,3,2;

(c)

4,3,2,3,4,54,3,2,3,4,5;

(d)

3,2,1,2,3,23,2,1,2,3,2;

(e)

2,3,2,3,2,32,3,2,3,2,3;

(f)

2,3,1,3,2,32,3,1,3,2,3. ⊛

Problem 110

Which subsets of the vertices of B4\mathbb {B}^{4} correspond to the following Boolean functions:

?
(a)

f1(x1,x2,x3,x4)=1⇔x1=0f_{1}\left(x_{1}, x_{2}, x_{3}, x_{4}\right)=1 \Leftrightarrow x_{1}=0;

(b)

f2(x1,x2,x3,x4)=1⇔x4=1f_{2}\left(x_{1}, x_{2}, x_{3}, x_{4}\right)=1 \Leftrightarrow x_{4}=1;

(c)

f3(x1,x2,x3,x4)=1⇔x1+x2⩾x3+x4f_{3}\left(x_{1}, x_{2}, x_{3}, x_{4}\right)=1 \Leftrightarrow x_{1}+x_{2} \geqslant x_{3}+x_{4};

(d)

f4(x1,x2,x3,x4)=1⇔x1x2=0f_{4}\left(x_{1}, x_{2}, x_{3}, x_{4}\right)=1 \Leftrightarrow x_{1} x_{2}=0 or x3x4=1x_{3} x_{4}=1?

Problem 111

Construct truth tables for the following Boolean functions:

?
(a)

f1(x1,x2,x3)=1⇔x1+x3⩾x2f_{1}\left(x_{1}, x_{2}, x_{3}\right)=1 \Leftrightarrow x_{1}+x_{3} \geqslant x_{2};

(b)

f2(x1,x2,x3)=1⇔f_{2}\left(x_{1}, x_{2}, x_{3}\right)=1 \Leftrightarrow the sum x1+x2+x3x_{1}+x_{2}+x_{3} is even;

(c)

f3(x1,x2,x3)=0⇔(x1=x2f_{3}\left(x_{1}, x_{2}, x_{3}\right)=0 \Leftrightarrow \left(x_{1}=x_{2}\right. or x1=x3)\left.x_{1}=x_{3}\right);

(d)

f4(x1,x2,x3)={x2, if x1=1;x3, otherwise. f_{4}\left(x_{1}, x_{2}, x_{3}\right)= \begin{cases} x_{2}, & \text{ if } x_{1}=1 ; \\ x_{3}, & \text{ otherwise. }\end{cases}

Problem 112

Let us call a flip-flop a Boolean function TT of several arguments for which T(q,0,…,0)=qT(q, 0, \ldots , 0)=q holds for any q∈Bq \in \mathbb {B}. Write out all possible

?
(a)

RSR S flip-flops T(3)T^{(3)}, for which the equalities T(q,1,0)=0T(q, 1,0)=0 and T(q,0,1)=1T(q, 0,1)=1 always hold;

(b)

DD flip-flops T(3)T^{(3)}, for which the equalities T(q,d,0)=qT(q, d, 0)=q and T(q,d,1)=dT(q, d, 1)=d always hold.

Problem 113

For each of the following formulas determine its depth and construct the truth table of the function it defines:

?
(a)

Ψ1=((x1→¬x3)∨(x2⊕x3))\Psi_{1}=\left(\left(x_{1} \rightarrow \neg x_{3}\right) \vee \left(x_{2} \oplus x_{3}\right)\right);

(b)

Ψ2=(¬(x1↑x2)↔(¬x1∧x2))\Psi_{2}=\left(\neg \left(x_{1} \uparrow x_{2}\right) \leftrightarrow \left(\neg x_{1} \wedge x_{2}\right)\right);

(c)

Ψ3=((x2⊕¬x3)∧((x1∨x2)→(x1↔¬x3)))\Psi_{3}=\left(\left(x_{2} \oplus \neg x_{3}\right) \wedge \left(\left(x_{1} \vee x_{2}\right) \rightarrow \left(x_{1} \leftrightarrow \neg x_{3}\right)\right)\right);

(d)

Ψ4=((¬x1∧x2)↓(x1→¬x3))\Psi_{4}=\left(\left(\neg x_{1} \wedge x_{2}\right) \downarrow \left(x_{1} \rightarrow \neg x_{3}\right)\right);

(e)

Ψ5=(((x1⊕x2)⊕x3)↑(¬x2↓x3))\Psi_{5}=\left(\left(\left(x_{1} \oplus x_{2}\right) \oplus x_{3}\right) \uparrow \left(\neg x_{2} \downarrow x_{3}\right)\right).

Problem 114

Determine which of the following formulas of propositional logic are identically true:

?
(a)

Ψ1=((x→¬y)→((¬y→z)→(x→z)));\Psi_{1}=((x \rightarrow \neg y) \rightarrow ((\neg y \rightarrow z) \rightarrow (x \rightarrow z))) ;

(b)

Ψ2=((x→¬y)→((x→z)→(¬y→z)))\Psi_{2}=((x \rightarrow \neg y) \rightarrow ((x \rightarrow z) \rightarrow (\neg y \rightarrow z)));

(c)

Ψ3=((x→¬y)→((x→(¬y→z))→(x→z)))\Psi_{3}=((x \rightarrow \neg y) \rightarrow ((x \rightarrow (\neg y \rightarrow z)) \rightarrow (x \rightarrow z)));

(d)

Ψ4=((¬x→y)→((¬y→z)→(x→z)))\Psi_{4}=((\neg x \rightarrow y) \rightarrow ((\neg y \rightarrow z) \rightarrow (x \rightarrow z))).

Problem 115

The table shown in fig. 115 shows the encoding of the decimal digits from 0 to 9 by means of four propositional variables A,B,C,D∈BA, B, C, D \in \mathbb {B}. Combinations of values of A,B,CA, B, C and DD not listed in the table are erroneous codes. Which of the following Boolean formulas define the set of all erroneous codes:

?
(a)

(¬A→(B∧C))(\neg A \rightarrow (B \wedge C));

(b)

((A∧B)∨(C∧D))((A \wedge B) \vee (C \wedge D));

(c)

((A∧B)∨(A⊕C))((A \wedge B) \vee (A \oplus C));

(d)

((A∧¬B)∨(C∧D))((A \wedge \neg B) \vee (C \wedge D));

(e)

((A∧B)∨(A∧C))((A \wedge B) \vee (A \wedge C));

(f)

(A∧(B⊕C))(A \wedge (B \oplus C))?

Fig. 3: Table from problem 115.Fig. 3: Table from problem 115.

Problem 116

Using the code table from the previous problem and assuming that the code is not erroneous, construct a formula with four variables A,B,CA, B, C and DD that will have value 1 if and only if the encoded number

?
(a)

equals 6;

(b)

is divisible by 4;

(c)

is divisible by 3;

(d)

is prime;

(e)

is composite;

(f)

is a Fibonacci number.

Problem 117

The variables (A1,B1,C1,D1)(A_{1}, B_{1}, C_{1}, D_{1}) and (A2,B2,C2,D2)(A_{2}, B_{2}, C_{2}, D_{2}) encode the numbers x1x_{1} and x2x_{2} respectively (see problem 115). Assuming that neither code is erroneous, write a formula that will have value 1 if and only if

?
(a)

x1=x2x_{1}=x_{2};

(b)

x1<x2x_{1}<x_{2};

(c)

x1⩽x2x_{1} \leqslant x_{2}.

Problem 118

The variables (C1,D1)(C_{1}, D_{1}) and (C2,D2)(C_{2}, D_{2}) encode the numbers x1x_{1} and x2x_{2} respectively from the set {0,1,2,3}\left\{ 0,1,2,3\right\} (see problem 115). Write formulas pA,pB,pCp_{A}, p_{B}, p_{C} and pDp_{D} whose values encode the product of these numbers.

?
Problem 119

Which of the following conditions can be expressed by Boolean formulas in the variables x1,x2,x3,x4x_{1}, x_{2}, x_{3}, x_{4}, using only the logical connectives ∧\wedge and ∨\vee?

?
(a)

At least two of the variables x1,x2,x3,x4x_{1}, x_{2}, x_{3}, x_{4} have value 1.

(b)

Not all of the variables x1,x2,x3,x4x_{1}, x_{2}, x_{3}, x_{4} have value 0.

(c)

An odd number of the variables x1,x2,x3,x4x_{1}, x_{2}, x_{3}, x_{4} have value 1.

Problem 120

Let us call the tuples α=(α1,…,αn)∈Bn\alpha =\left(\alpha_{1}, \ldots , \alpha_{n}\right) \in \mathbb {B}^{n} and β=(β1,…,βn)∈Bn\beta =\left(\beta_{1}, \ldots , \beta_{n}\right) \in \mathbb {B}^{n} adjacent if they occur in adjacent rows of the table for a function of nn variables, that is, they represent the binary representations of the numbers iαi_{\alpha } and iβi_{\beta }, for which ∣iα−iβ∣=1\left|i_{\alpha }-i_{\beta }\right|=1.

Find the number of functions in Pn\mathcal{P}_{n} that on every pair of adjacent tuples take

?
(a)

identical values;

(b)

different values.

Problem 121

Find the number of nn-ary Boolean functions taking value 1 on exactly kk tuples.

?
Problem 122

Find the number of functions in Pn\mathcal{P}_{n} that change their value whenever any argument is changed.

?
Problem 123

Find the number of functions in Pn\mathcal{P}_{n} that are commutative in every pair of arguments, that is, whose value does not change under a permutation of arbitrary arguments.

?
Problem 124

Let us call the tuples α=(α1,…,αn)∈Bn\alpha =\left(\alpha_{1}, \ldots , \alpha_{n}\right) \in \mathbb {B}^{n} and β=(β1,…,βn)∈Bn\beta =\left(\beta_{1}, \ldots , \beta_{n}\right) \in \mathbb {B}^{n} opposite if αi+βi=1\alpha_{i}+\beta_{i}=1 for every ii (in other words, αi=1\alpha_{i}=1 if and only if βi=0\beta_{i}=0).

Find the number of functions in Pn\mathcal{P}_{n} that take different values on every pair of opposite tuples.

?
Problem 125

Let n=2kn=2 k. Let us call the tuple α=(α1,…,αn)∈Bn\alpha =\left(\alpha_{1}, \ldots , \alpha_{n}\right) \in \mathbb {B}^{n} paired if αi=αk+i\alpha_{i}=\alpha_{k+i} for all i=1,…,ki=1, \ldots , k, that is, α=α′α′\alpha =\alpha^{\prime } \alpha^{\prime } for some tuple α′\alpha^{\prime } of size kk. Find the number of functions in Pn\mathcal{P}_{n} that take the same value on all paired tuples.

?
Problem 126

Determine how many three-place Boolean functions in total can be constructed using at most one connective from tables 1 and 2 on p. 36, and moreover using it at most once.

?
Problem 127

Let FF be a finite set of Boolean functions, and ε\varepsilon a positive, arbitrarily small constant. Prove that for sufficiently large nn, formulas over FF with fewer than 2n/n2^{n} / n symbols can represent at most 22n/n1−ε2^{2^{n}} / n^{1-\varepsilon } Boolean functions. Thus, almost all Boolean functions can only be represented by "long" formulas.

?
Problem 128

An argument xix_{i} of a Boolean function ff is called dummy (fictitious) if the value of ff never changes when the value of xix_{i} is changed. Find the number of nn-ary Boolean functions with no dummy arguments, for n=2,3,4n=2,3,4.

?
Problem 129

By induction on the construction of the formula Φ\Phi, prove the inequality

depth⁡(Φ)Ψx⩽depth⁡Φ+depth⁡Ψ. \operatorname {depth}(\Phi )_{\Psi }^{x} \leqslant \operatorname {depth} \Phi +\operatorname {depth} \Psi .

Give an example where the inequality is strict.

?
Problem 130

A database administrator has discovered that one or more of three records in his database A,BA, B and CC is erroneous. He has established that

?
(a)

if record BB is correct, then AA is erroneous;

(b)

at least one record of the pair B,CB, C is correct and at least one record of the pair A,CA, C is correct;

(c)

if AA is erroneous, then at least one of the records BB or CC is correct (but not both together). Describe the administrator's knowledge as a formula of propositional logic. Can he conclude that record BB is erroneous? Can it be reliably asserted that the erroneous record is unique?

Problem 131

The programmer Peter used three integer variables x,y,zx, y, z in his C program. At a certain point in the program he placed the conditional statement: if (x∗y>=0∣∣x∗z>=0)(\mathrm{x} * \mathrm{y}>=0| | \mathrm{x} * \mathrm{z}>=0) x=1\mathrm{x}=1; else x=2\mathrm{x}=2; Having analyzed his program, Peter established that before this statement is executed the following conditions hold:

?
(a)

if z<0z<0, then x<0x<0 or y⩾0y \geqslant 0;

(b)

x⩾0x \geqslant 0 or y<0y<0;

(c)

if y<0y<0, then at least one of the variables xx or zz is negative, but not both together.

Describe Peter's knowledge as a formula of propositional logic. Can he optimize the program by replacing the given conditional statement with the assignment x=1\mathrm{x}=1; or with the assignment x=2\mathrm{x}=2;? If "yes", then with which one?

Problem 132

A committee consists of five members. Decisions are made by majority vote, however, if the chairman votes "against", the decision is not adopted. Construct a formula of propositional logic depending on five propositional variables x1,x2,x3,x4,yx_{1}, x_{2}, x_{3}, x_{4}, y (xix_{i} means that the ii-th committee member votes "for", yy means that the chairman votes "for"), whose value equals 1 if and only if the decision is adopted as a result of the vote.

?
Problem 133

In each of the following texts identify the elementary statements, denote them by propositional variables, and write a formula of propositional logic reflecting the content of the text.

?
(a)

Misha decided to do a small renovation in his apartment and either put up new wallpaper or paint the floor. Along with the wallpaper he will need to renew the laminate flooring, replace the doors, and replace the double-glazed window. After painting the floor he needs to install a stretch ceiling, a new chandelier, and furniture. If the laminate flooring is renewed, then new furniture will also have to be bought. The old wallpaper cannot be left with the old furniture, nor can the old furniture be left with the old chandelier.

(b)

If there is frost, then it will be sunny, or if the weather is overcast it will snow, and if there is no frost, then it will be sunny, or if the weather is overcast it will rain. In case of rain or snow it will be damp, and in case of rain it will also be muddy. If it is sunny, then there will be neither dampness nor mud.

(c)

When Vova is at home, his cat eats or sleeps, and if Vova is not there, it also plays. If the cat eats, cat food needs to be bought. If the cat plays, new furniture or new wallpaper will have to be bought. For food one needs to go to the pet shop "Everything for Cats", and for furniture or wallpaper — to the hardware store "Everything for the Home". A taxi is needed to get to either shop. Vova will not take a taxi to the "Everything for the Home" store.

Problem 134

Detective Sh. Holmes suspects three persons of committing a crime: A,BA, B and CC. He has established that

?
(a)

if BB is the criminal, then CC is also the criminal;

(b)

someone from the pair A,CA, C is the criminal, but not both together;

(c)

if CC is not the criminal, then AA is not the criminal either.

Describe Sh. Holmes's knowledge as a formula of propositional logic and construct its truth table. Can he conclude that CC is the criminal? Can it be reliably asserted that the criminal acted alone?

Problem 135

Detective E. Poirot suspects three persons of committing a crime: A,BA, B and CC. They gave the following testimony: - AA: if BB is the criminal, then CC is innocent; - BB: if AA is guilty, then CC is also the criminal; - CC: AA is the criminal. E. Poirot has established that (а) if AA told the truth, then BB lied, and (б) CC's testimony is false. Describe E. Poirot's knowledge as a formula of propositional logic and construct its truth table. Can he conclude that BB is the criminal? Could the criminal have been alone?

?
Problem 136

Suppose that in every zoo that has lions and rhinoceroses there are no giraffes; in every zoo that has rhinoceroses and no giraffes there are lions; finally, in every zoo that has lions and giraffes there are also rhinoceroses. Do you think there can exist a zoo in which there are lions but neither giraffes nor rhinoceroses?

?
Problem 137

Anna, Beatrice, and Vera once discovered that they were all wearing identical jeans. It is known that Anna has jeans with pockets, narrow jeans, and faded jeans without pockets; Beatrice has jeans without pockets and faded narrow jeans with pockets. And finally, Vera has flared jeans and blue narrow jeans with pockets. What do their identical jeans look like?

?
Problem 138

A student who knew English poorly went on an internship in England. He needed to get to Manchester. He hitchhiked on the highway and stopped a car in which there were a father, a mother, and a daughter, who answered his question about their trip. He translated each phrase they said in two different ways and could not decide what the phrase actually meant. Here is what they said (the second possible meaning is given in parentheses).

Father: we are heading to Manchester (we are coming from Newcastle). Mother: we are not heading to Manchester, and we are coming from Newcastle (we did not stop in Liverpool and we are coming from Newcastle).

Daughter: we are not coming from Newcastle (we stopped in Liverpool). Should the student get into this car?

?
Problem 139

Lewis Carroll, the author of the widely known book "Alice in Wonderland" (it is less well known that he was a mathematician), liked to pose the following puzzle consisting of four statements: "One of two things: either the culprit left in a carriage, or the witness was mistaken. If the culprit had an accomplice, then he left in a carriage. The culprit had neither an accomplice nor a key; or he had both an accomplice and a key. The culprit had a key." What conclusion can be drawn from this?

?
Problem 140

A professor of economics formulated three rules for the students:

?
(a)

if investments do not increase, then either government spending will increase or unemployment will arise;

(b)

if government spending does not increase, then taxes will decrease;

(c)

if taxes decrease and investments increase, then unemployment will not arise.

It turned out that at the present moment investments have not increased. Can the students conclude that government spending will increase?