Problems and Exercises in Discrete Mathematics

429
Problems and Exercises in Discrete Mathematics

Transcript of Problems and Exercises in Discrete Mathematics

Page 1: Problems and Exercises in Discrete Mathematics

Problems and Exercises in Discrete Mathematics

Page 2: Problems and Exercises in Discrete Mathematics

Kluwer Texts in the Mathematical Sciences

VOLUME 14

A Graduate-Level Book Series

The titles published in this series are listed at the end o/this volume.

Page 3: Problems and Exercises in Discrete Mathematics

Problems and Exercises in Discrete Mathematics

by

G. P. Gavrilov and

A. A. Sapozhenko Department o/Computational Mathematics and Cybernetics, Moscow State University, Moscow, Russia

.... " SPRINGER-SCIENCE+BUSINESS MEDIA, B.V.

Page 4: Problems and Exercises in Discrete Mathematics

A C.I.P. Catalogue record for this book is available from the Library of Congress.

ISBN 978-90-481-4702-1 ISBN 978-94-017-2770-9 (eBook) DOI 10.1007/978-94-017-2770-9

This is a completely revised and updated edition of Selected Problems in Discrete Mathematics by the same authors. MIR, Moscow, © 1989

Printed on acid-free paper

A1l Rights Reserved © 1996 Springer Science+Business Media Dordrecht Originally published by Kluwer Academic Publishers in 1996 Softcover reprint ofthe hardcover lst edition 1996

No part of the material protected by this copyright notice may be reproduced or utilized in any form or by any means, clectronic or mcchanical, including photocopying, rccording or by any information storage and retricval system, without writtcn pcrmission from the copyright owncr.

Page 5: Problems and Exercises in Discrete Mathematics

Contents Preface ix

I PROBLEMS 1

1 Representations of Boolean Functions 3 1.1 Tabular Representations . . . . . . . . 3 1.2 Formulas................. 8 1.3 Disjunctive and Conjunctive Normal Forms. 20 1.4 Polynomials............. 25 1.5 Essential and Unessential Variables . . . . . 30

2 Closed Classes and Completeness in Boolean Algebra 38 2.1 Closure Operation 38 2.2 Self-Dual Functions. . . . . . . . . 43 2.3 Linear Functions .......... 47 2.4 Functions Preserving the Constants 52 2.5 Monotone Functions ....... .55 2.6 Completeness and Closed Classes 60

3 Many-Valued Logics 66 3.1 Formulas of k-Valued Logics. . . . . . . . . . . . . 66 3.2 Closed Classes and Completeness in k-valued logic. 71

4 Graphs and Networks 81 4.1 Basic Concepts of Graph Theory .................. 81 4.2 Planarity, Connectivity, and Numerical Characteristics of Graphs 88 4.3 Directed Graphs. . . . . . . 93 4.4 Trees and Bipolar Networks . . . . . . . . . . . . . . . . . . . . . 98

5 Elements of Coding Theory 110 .5.1 Hamming's Distance . 110 5.2 Hamming's Codes. . . . . . 113 .5.3 Linear Codes ....... . 118 5.4 Alphabetic Code Divisibility . 122 5.5 Optimal Codes ....... . 127

6 Finite Automata 134 6.1 Determined and Boundedly Determined Functions. . 134 6.2 Diagrams, Equations, and Circuits ......... . 148

v

Page 6: Problems and Exercises in Discrete Mathematics

VI CONTENTS

6.3 Closed Classes and Completeness in Automata.

7 Elements of Algorithm Theory 7.1 Turing Machines .. 7.2 Recursive Functions. 7.3 Computability.

8 Combinatorics 8.1 Permutations and Combinations. 8.2 Inclusion and Exclusion Formula 8.3 Recurrences and Generating Functions 8.4 Polya's Theory ....... . 8.5 Asymptotics and Inequalities. 8.6 Estimates in Graph Theory

9 Boolean Minimization 9.1 Faces of the n-cube. Covers and tests for tables 9.2 Constructing of the Reduced Disjunctive Normal Form Methods 9.3 Irredundant, Minimal, and Shortest DNFs ........... .

10 Logical Design 10.1 Circuits of Logical Elements 10.2 Contact Circuits ..... .

II ANSWERS, HINTS, SOLUTIONS

1 Representations of Boolean Functions 1.1 Tabular Representations . . . . . . . . 1.2 Formulas................. 1.3 Disjunctive and Conjunctive Normal Forms. 1.4 Polynomials............. 1.5 Essential and Unessential Variables .....

2 Closed Classes and Completeness in Boolean Algebra 2.1 Closure Operation 2.2 Self-Dual Functions ........ . 2.3 Linear Functions .... . . . . . . 2.4 Functions Preserving the Constants 2.5 Monotone Functions ...... . 2.6 Completeness and Closed Classes

3 Many-Valued Logics 3.1 Formulas of k-Valued Logics ............ . 3.2 Closed Classes and Completeness in k-Valued logic

· 182

188

· 188 · 202 .209

214 · 214 · 224 · 228 · 236 .240 .248

254 .254 · 260 .266

273 · 273 .280

295

297 · 297 · 297 · 299 .299 · 300

303 .303 · 305 · 306 · 307 .309 · 311

313 · 313 · 315

Page 7: Problems and Exercises in Discrete Mathematics

CONTENTS

4 Graphs and Networks 4.1 Basic Concepts of Graph Theory ................. . 4.2 Planarity, Connectivity, and Numerical Characteristics of Graphs 4.3 Directed Graphs ...... . 4.4 Trees and Bipolar Networks

5 Elements of Coding Theory 5.1 Hamming's Distance 5.2 Hamming's Codes .... . 5.3 Linear Codes ...... . 5.4 Alphabetic Code Divisibility 5.5 Optimal Codes ...... .

6 Finite Automata 6.1 Determined and Boundedly Determined Functions. 6.2 Diagrams, Equations, and Circuits ...... . 6.3 Closed Classes and Completeness in Automata.

7 Elements of Algorithm Theory 7.1 Turing Machines .. 7.2 Recursive Functions. 7.3 Computability.

8 Combinatorics 8.1 Permutations and Combinations . 8.2 Inclusion and Exclusion Formula 8.3 Recurrences and Generating Functions 8.4 Polya's Theory ....... . 8.5 Asymptotics and Inequalities. 8.6 Estimates in Graph Theory

9 Boolean Minimization 9.1 Faces of the n-cube. Covers and tests for tables 9.2 Constructing of the Reduced DNF Methods 9.3 Irredundant, Minimal, and Shortest DNFs

10 Logical Design 10.1 Circuits of Logical Elements 10.2 Contact Circuits ..... .

Bibliography

Index

Vll

325 · 325 · 326 · 327 · 328

329 · 329 · 331 · 333 · 335 · 337

339 · 339 · 341 · 345

348

· 348 .349 · 351

353 · 353 · 363 · 368 · 379 · 383 · 401

403 · 403 · 406 .408

409 · 409 · 410

415

419

Page 8: Problems and Exercises in Discrete Mathematics

Preface

This book of problems is mainly intended for undergraduates. It can also be useful for postgraduates and researchers who apply methods of Discrete l\Iathe­matics in their study and investigations. Lecturers can use this material for exercises during seminars. The contents are based on a course of lectures and seminars on Discrete Mathematics carried out by the authors and their colleagues over a number of years at the Department of Computational Mathematics and Cybernetics of Moscow State University. The Russian reader can use "Introduction to Discrete Mathematics" by S. V. Yablonsky as the theoretical guide while solving the problems in this collection. In the translation of the book, the authors essentially extended the theoretical introductions to the chapters, so the Western reader can use this book without any additional theoretical guidance.

The study of mathematics is impossible without experience in solving tasks. There are many excellent textbooks on the classical fields of mathematics: analysis, algebra, differential equalities, etc. The situation is different in such modern fields as Discrete Mathematics and Theoretical Computer Sciences. To date a common notion on the subject of Discrete Mathematics has hardly been formed, although it usually includes Boolean algebra, k-valued logics, coding theory, automata theory, algorithm theory, combinatorics, graph theory, and logical design. Sometimes, several parts of logics, set theory and algebra, such as propositional calculus, and relations, are assigned to Discrete Mathematics. There are textbooks [4], [21], [22], [29], [31], [45], and also manuals and problem books on separate parts of Discrete Mathematics: Boolean algebra [16], [46], automata theory [20], [23], [24], [39], [41], algorithm theory [1], [2], [25], [27], graph theory [3], [6], [19], [32], [40], [43], [47], [30], [3.5], combinatorics [S], [17], [IS], [26], [34], [36], [37], [3S], [42], coding theory [28]. [33]. This problem book stands out because all the main parts of Discrete Mathematics are represented in it.

Another peculiarity of the book is the functional approach to the subject. This approach is typical of the Moscow School of Discrete Mathematics. It was initiated by the well-known Yablonsky paper [45] and includes considering the objects of Discrete Mathematics as being generated from the elements of some basis by means of some relevant operations. It assumes an investigation into classes of objects, closed with respect to some sets of operations, and problems of expressibility and completeness. This approach is very productive in Boolean algebra, many-valued logics and automata, where it allows one to set a lot of varied problems. It is less successful in other parts, such as in coding theory and combinatorics.

The writing of the book was begun in 1971 when the authors started their work

ix

Page 9: Problems and Exercises in Discrete Mathematics

x PREFACE

at the Computational Mathematics and Cybernetics Department of the Moscow State University. Our first experience was a small problem book of two parts [10] published by the M.S.U. Publishing House in 1974. Then, in 1977, the book [11] was published by Nauka Publishers. It was recommended as a manual for universities by the Education Ministry of the U.S.S.R. In 1980, 1981, and 1989, respectively, the Spanish [13], Hungarian [14] and English [15] translations of [11] appeared. In 1992, a second Russian edition [12] appeared. This manual is an essentially revised translation of our textbook [12] and consists of exercises (about 60%), tasks of intermediate difficulty (about 25%), and some difficult problems (about 15%). The most difficult problems are marked with an asterisk. In all, the book contains over 3000 problems and exercises.

The book is divided into two parts. The first part contains problems and the second consists of answers, hints, and solutions. Each part has 10 chapters.

The first two chapters of Part I are devoted to Boolean algebra which forms

the basis of Discrete Mathematics. About a quarter of the total teaching time during lectures and seminars is devoted to Boolean algebra. The first chapter acquaints the reader with the various tools representing of a discrete function: tables, formulas, normal forms, polynomials, geometrical representations using the n-cube, etc. In the second chapter, the reader is introduced to the concepts of discrete functions, composition, functionally complete sets and closure. Some methods for testing the completeness and closure of sets of functions are also considered.

The third chapter is devoted to k-valued logic. The problems presented here are intended to familiarize the reader with the canonical expansions of k-valued func­tions, equivalent transformations of formulas, closed classes of k-valued functions, and methods for testing the completeness and closure of sets of functions. Several problems in the chapter are intended to demonstrate the difference between k-valued logic (k > 2) and Boolean algebra.

The fourth chapter contains problems in graph and network theory. The basic concepts (isomorphism, planarity, coloring, cover, etc.) and the methods of the theory are illustrated by exercises and problems.

The fifth chapter deals with the elements of coding theory. Three topics are studied: the uniqueness of decoding problems in alphabetic coding, the design of optimal codes, the design of self-correcting and linear codes.

The sixth chapter contains problems in automata theory. The problems collected here help in acquainting the reader with the notion of a discrete deterministic transformer of information (automaton), various tools of performance of automata (diagrams, tables, canonical equations and circuits), and operations over automata.

The seventh chapter deals with the elements of algorithm theory and is intended to make the reader familiar with two models of algorithms: Turing machines and recursive functions.

The eighth chapter is devoted to combinatorics. Here the properties of binomial coefficients, factorials and others combinatorial objects are studied. The chapter also contains sections devoted to the inclusion-exclusion formula, recurrent sequences, Polya's theory, asymptotic estimations in combinatorics and graph theory.

The ninth chapter deals with Boolean minimization. The structure of the faces

Page 10: Problems and Exercises in Discrete Mathematics

PREFACE xi

of the n-cube, covers, tests for tables, as well as the design methods of minimal, irredundant and reduced disjunctive normal forms·are considered.

The tenth chapter deals with logical design. The circuits of logical elements and the contact circuits are studied.

The problems and exercises in this book have various origins. A considerable number of them are taken from mathematical folklore and are well-known to specialists in Discrete Mathematics. Most of the problems were conceived by the authors while preparing the material for seminars and examinations. Some of the problems are simple assertions from scientific articles. Sometimes, but far from always, we point out the names of the authors. Some of the problems were kindly supplied by our colleagues: O. B. Lupanov, V. K. Leontiev, V. B. Alekseev, S. V. Yablonsky, and G. Burosch. We express our thanks to them.

The authors are deeply indebted to Serge Kostyukovich, Serge Levit, Andrew Sapozhenko, and Natalia Sumkina for their help in the preparation of the typescript and V. M. Khrapchenko for useful discussions on terminology. All reproaches on defects of design, misprints, linguistic errors, have to be addressed to Al. A. Sapozhenko who took on the task of translating the book and the preparation of the typescript. G. P. Gavrilov edited a considerable part of the typescript.

G. P. Gavrilov, A. A. Sapozhenko

Page 11: Problems and Exercises in Discrete Mathematics

Part I

PROBLEMS

Page 12: Problems and Exercises in Discrete Mathematics

Chapter 1

Representations of Boolean Functions

1.1 Tabular Representations

A vector (aI, a2, ... , an), where ai E {O, I}, 1 ~ i ~ n, is called a binary vector or simply tuple. Elements of the tuple are called components or coordinates. Briefly, a tuple (aI, a2, ... , an) is denoted by an or a. The number n is called a length of the tuple an. A weight (or norm) of a tuple an (notation: Ilanll ) is the number of its coordinates equaled to unity, i.e. lIan ll = L:i=l ai.

The set of all binary vectors of length n is called an n-dimensional Boolean cube or hypercube or the n-cube. It will be denoted by Bn (and sometimes by E2)' A tuple an is called a vertex of the cube Bn. The set of all vertices of the n-cube having a weight k is called the k-th stratum of the n-cube or the k-th level of the n-cube (denoted by Br). The integer /J (an) = L:i=l ai2n-i, is called the number of the tuple an. The tuple an is obviously a binary expansion of the number /J (an).

A distance (the Hamming distance) between vertices a and fi of the cube Bn

is the number p (a,~) = L:i=l IQi - ;Jil, equal to the number of coordinates in which they differ. The Hamming distance is a metric, and the cube Bn is a metric space. The tuples a and fi from Bn are adjacent if p (a, fi) = 1, and opposite if

p (a,iJ) = n.

A tuple an is said to precede (or to be not greater than) a tuple fin (notation: an ~~n) if Qi ~ ;Ji for all i = 1, ... , n. If, besides an =f-fin , the tuple an is said to precede ~n strictly (notation: an -<fin). Tuples an and fin are comparable if either an ~fin or finj an. Otherwise, an and fin is said to be incomparable. A tuple an directly precedes ~n if an -<fin and p (a, fi) = 1. The relation j (that is often called the precedena relation) is the partial order in Bn. Figure 1.1 shows the diagrams of partially ordered sets B2, B3 and B4.

A function fern) defined on the set Bn and taking the values from the set {O, I} is called a Boolean function. A tuple of variables (XI, X2, ... , xn) we denote by the symbol in (or x ) and the set of all variables by xn. The set of all Boolean functions of variables Xl, X2, ••• , Xn will be denoted by Pdxn).

3

Page 13: Problems and Exercises in Discrete Mathematics

4 CHAPTER 1. REPRESENTATIONS OF BOOLEAN FUNCTIONS

1111

11 1110

11 110

"0' 00 000 0000

82 83 84

Fig.l.l

A Boolean function f (xn) can be represented by the table T (1) (see Table 1.1), where tuples u = (a1,a2, ... ,an-ban) are arranged in ascending order of their numbers. This arrangement is called a standard tuples arrangement. We shall represent a function f (in) by the vector of its values or the values vector of f or = (0:0,0:1, ... , 0:2n-d in which the coordinate O:i is the value f (u;) of the func­tion f on the tuple Ui with number i (i = 0,1, ... , 2n - 1). Sometimes by misuse of language, we shall write f (in) = (0:0, 0:1, ... , 0:2n_ d. The symbol N f will be used

Table 1.1

Xl X2 ... Xn -1 Xn f(X1,X2,' ,.,Xn-1,Xn )

° ° ... ° ° f(O,O, ... ,0,0)

° ° ... ° 1 f( 0,0, ... ,0,1)

° ° ... 1 ° f(O,O, ... ,1,0)

•••••• II •••••• • •• II ••••• II ••••• II ••

1 1 ... 1 1 f(I,I, ... ,1,1)

to denote the set {un I (un E Bn) & (1 (un) = I)}, i.e. the set of all tuples un from Bn, where the function f (in) is equal to unity.

If n ~ 2, a Boolean function f (in) can be represented by a rectangular table Ih,n-k (1) of the form shown in Table 1.2 , where the value f (a1, ... , ak,ak+1, ... , an)

Page 14: Problems and Exercises in Discrete Mathematics

1.1. TABULAR REPRESENTATIONS 5

of the function fern) is located at the intersection of the "row" (0"1, ... , O"k) and the "column" (O"k+I, ... ,O"n), 1:::; k < n.

Table 1.2

0 0 O"k+! 1 Xk+! 0 0 O"k+2 1 Xk+2

...................

0 1 O"n 1 xn Xl X2 Xk

0 0 0

0 0 1

............

0"1 0"2 O"k ......... . f(o-)

............

1 1 1

The functions described in Tables 1.3 and 1.4 are usually called elementary.

Table 1.4 Table l.3 Xl X2 h f4 is f6 h f8 fg

X 0 1 it h 0 0 0 0 0 1 1 1 1 0 0 1 0 1 0 1 0 1 1 0 1 1 0 1 0 1 1 0 1 0 0 1 1 0 0 1 0

1 1 1 1 0 1 1 0 0

The notations and the names of the elementary functions are listed below. l. The functions 0 and 1 are called zero (or O-function) and unit (or 1-function)

respectively.

2. The function fl is called an identity function and is denoted by x. 3. The function h is called a negation of x, denoted by x or 'X, and often read

as "not x". 4. The function h is called a conjunction of Xl and X2, denoted by XI&X2, or

Xl· X2, or XIX2, or min(xl,x2), and often read as "Xl and X2". 5. The function f4 is called a disjunction of Xl and X2, denoted by Xl V X2, or

Xl + X2, or max(xI,x2), and often read as "Xl or X2". 6. The function fs is called an exclusive sum of Xl and X2, denoted by Xl EEl X2

or XI + X2, and often read as "Xl plus X2".

Page 15: Problems and Exercises in Discrete Mathematics

6 CHAPTER 1. REPRESENTATIONS OF BOOLEAN FUNCTIONS

7. The function f6 is called an equivalence of Xl and X2, denoted by Xl rv X2, or Xl == X2, or Xl t----+ X2, and often read as "Xl is equivalent to X2".

8. The function f7 is called an implication of Xl and X2, denoted by Xl -7 X2 or Xl => X2, and often read as "Xl implies X2".

9. The function fs is called SheffeT's stToke of Xl and X2, denoted by Xl I X2,

and often read as "not both Xl and X2". In engineering literature, the function Xl I X2 is often called an anticonjunction or "not-ancf' since it is equal to negation of conjunction.

10. The function fg is called PeiTce's aTrow of Xl and X2, denoted by Xl t X2, and often read as "neither Xl nOT X2". In engineering literature, the function Xl t X2 is often called an antidisjunction or "not-or' (or Dagger's function, or Webb's function as well).

Sometimes, the functions 0 and 1 are treated as functions depending on the empty set of variables.

The symbols --', &, V, EB, rv, etc. are used in the notations of elementary functions and are called logical connectives (or connectives).

Example 1. Find the number of the tuple Q = (10011). Solution. We have n = 5 and 0:1 = 0:4 = 0:5 = 1, 0:2 0:3 = O. So by

n . definition v( Q) = L: 0:; . 2n-. = 24 + 21 + 2° = 19.

;=1

Example 2. Find the tuple Q of the minimal possible length such that v(Q) = 35.

Solution. The tuple of the minimal length has 1 in the first coordinate. So we need to find the least integer n such that 2n > 35. This integer is the required length of the tuple. It is clear that n = 6. To find the coordinates of the tuple Q,

we use the so-called "consequent division by 2 with a residue" procedure: (1) The residue Tl of the division of the number 35 by 2 is 1 and the quotient ql

is 17. Set 0:6 = Tl = 1. (2) The residue T2 of the division of the number ql by 2 is 1 and the quotient q2

is 8. Set 0:5 = T2 = 1. (3) The residue T3 of the division of the number q2 by 2 is 0 and the quotient q3

is 4. Set 0:4 = T3 = O. (4) The residue T 4 of the division of the number q3 by 2 is 0 and the quotient q3

is 2. Set 0:3 = T4 = O. (5) The residue T5 of the division of the number q4 by 2 is 0 and the quotient q5

is 1. Set 0:2 = T5 = O. (6) The residue T6 of the division of the number q5 by 2 is 1 and the quotient q6

is O. Set 0:1 = T6 = 1. The procedure is complete as the quotient q6 is O. So we have

Q = (100011).

Example 3. Find the binary tuple of the length m that is an expansion of the number 2m - l - 2 (m ;::: 3).

Solution. Let us represent the number 2m - l - 2 as a sum of the powers of two: 2m - l _ 2 = 2 (2m - 2 - 1) = 2 (2m - 3 + 2m - 4 + ... + 2 + 1)

Page 16: Problems and Exercises in Discrete Mathematics

1.1. TABULAR REPRESENTATIONS 7

Thus the required tuple is (0 ~ 0). m-2 times

Example 4. Find the number of functions f(xn) satisfying the following condition: f (an) = 0 for the tuples an such that lIanli :::; n/2.

Solution. The number of tuples from Bn where the values of function fare fixed, is equal to

L (~) = {2:=: 1 n ~f n ~s odd, O~i~[n/21 Z 2 + 2 (n/2) If n IS even.

The function f can take arbitrary values (0 or 1) on each tuple out of the above­described set. It follows that the number of different functions satisfying the condition is equal to 22n-1 for odd n and to 22n-I_t(n/2) for even n.

1.1.1. Find the numbers of the following vectors: (1) 0 = (1011); (2) 0 = (11001); (3) 0 = (11001101); (4) 0 = (010111101); (5) 0 = (1 ~1);

m times (6)0=(~~) m~l;

m times 2m times (7) 0 = (1 ~L:-.:.J.~I) m ~ 1;

m times m times m times (8) 0 = (~~L:-.:.J.) m ~ 1.

m times m times m times

1.1.2. Find the tuple 0 of minimal length and such that v(o) = n : (1) n = 5; (2) n = 6; (3)n = 28; (4) n = 47; (5) n = 1; (6) n = 2m + 1; (7) n = 2m - 5; (8) n = 3· 2m - 1.

1.1.3. Represent the function f by the rectangular table IIk,n-k if: (1) Of = (lOll), k = 1, n = 2; (2) Of = (1001), k = 1, n = 2; (3) Of = (1001 0011), k = 1, n = 3; (4) Of = (1101 0111), k = 2, n = 3; (5) Of = (00011010), k = 1, n = 3; (6) Of = (01011110), k = 2, n = 3; (7) Of = (01011110 10010011), k = 2, n = 4; (8) Of = (1101 0111 00011010), k = 2, n = 4.

1.1.4. Find the number of (1) tuples in IB.n (2) tuples in IBk'1 such that 2n- 1 :::; v(o) < 2n;

Page 17: Problems and Exercises in Discrete Mathematics

8 CHAPTER 1. REPRESENTATIONS OF BOOLEAN FUNCTIONS

(3) ordered pairs of different tuples in Bn; (4) ordered pairs of tuples with distance r in Bn ; (5) unordered pairs of tuples in B'k; (6) unordered pairs of tuples with distance r in B'k; (7) tuples a in Bn such that ~ j a j 7 for some tuples ~ and 7 satisfying the

conditions ~ j 7; and p(~, 7) = k (n ~ k ~ 1); (8) tuples a in Bn such that there are at least r zeros between each two adjacent

unit coordinates of a, 0 :::; r :::; n - 2, 2:::; k :::; n.

1.1.5. Find the number of functions f in pn such that: (1) the values of f are fixed on some I tuples and are arbitrary on the rest 2n - I

tuples in Bn; (2) f (an) = 1 if (n - 1)/2 :::; Iiall :::; n/2, on the others tuples f takes arbitrary

values from {O, I}; (3) f takes the same values on any pairs of opposite tuples in Bn; (4) f takes the opposite values on any pairs of adjacent tuples in Bn; (5) f is equal to 0 not less than on 2n - 1 tuples; (6) f does not change its value under arbitrary permutation of coordinate in a

tuple (i.e. f is symmetric).

1.2 Formulas

Let X be a certain (finite or countable infinite) alphabet of variables and <I> = {f~nJ), fJn 2 ), ••• } be a set of functional symbols, where the superscripts indicate the arity of the symbols. Sometimes the superscripts are omitted if the arity of the symbols is assumed to be known.

Definition 1. A is a formula generated by a set <I> or a formula over <I>, or a formula in a basis <I> if and only if it is a word of one of the following two types:

(1) /k (XiI' Xi" ... , Xi n ), where fk is a functional symbol of n, n ~ 0, arguments, and XiI' Xi2' •.. , Xin are symbols of variables from X ;

(2) fm (A1,A2 , ••• , As), where fm is a functional symbol of s arguments and Ai is either a formula generated by <I> or a symbol of variable, i = r,s.

In order to accentuate the fact that the formula A contains only variables from X or only functional symbols from <I>, we write A(X) or A[<I>J, respectively.

Sometimes we shall write a formulas of the type f (x, y) either as (x fy) or as X f y, and a formulas of the type f (x) as (f x) or as f x. In this case, the symbol f is called a (logical) connective.

The connectives are usually denoted by the symbols from the set E = {...,,&, V, Ef),"',-+, I,n.

Definition 2. A is a formula generated by the set E or formula over E, or formula in a basis E, if and only if it is a word of one of the following two types:

(1) x, i.e. any variable from the set X;

Page 18: Problems and Exercises in Discrete Mathematics

1.2. FORMULAS 9

(2) (..,E), (E&e), (E V e), (E EB e), (E'" e), (E --+ e), (E I e), (E 1 e), where E and e are formulas generated by E.

The following conventions are usually adopted for abbreviating the notation of formulas generated by the set E of connectives:

(a) the outer brackets in the formulas are omitted; (b) the formula (..,A) is written in the form A; (c) the formula (A&E) is written in the form (A· E) or (AE); (d) it is assumed that the connective "..," is stronger than any connective of two

variables in E; (e) the connective & is assumed to be stronger than any other connective of two

variables in E. Owing to these conventions, we can write, for instance, the formula (( (( ..,.1') if! y) &.::) --+ (( x& (..,y)) V z)) in the form (x EEl y) z --+ (x'fJ V z) . .. Mixeri' form of notation is also used. For example,

x EB f ('fJ, z) orxd (X2' 0, X3) V X2! (Xl,X2, 1) .

Suppose that some function Fi : E(n;) --+ E corresponds to every functional symbol in,) from the set <P. The concept of a function 'PA, realized by a formula A over the set <P is defined by induction:

(l) if A = fi(n,) (x jll X j2' ... , Xjn,) then for every tuple (aI, a2, ... , an.) of values of the variables x it, X j2' ... , X jn, we set

(2) if A = A (Yl, Y2, ... , Yk) = f (AI, A2, ... , Am), where f E <P and AI IS either a formula generated by <P or a variable in X, then we set

'PA(D1, D2, ... ,Ds) = F(/31,/32, ... ,/3m),

where F is the function corresponding to the functional symbol f and (3p is the value of the function cP Ap (p = 1,2, ... , m) that is defined as follows

In the case when A = fin,) (XjjlXj2, ... ,Xjn.), i.e. A is obtained from some function f E <P by replacing the variables, we set

cP A = Fi (X j1 , x 12 , ... , x jn,) .

If, however, A = f (AI, A2 , ..• , Am) we set

Page 19: Problems and Exercises in Discrete Mathematics

10 CHAPTER 1. REPRESENTATIONS OF BOOLEAN FUNCTIONS

here F is the function corresponding to the functional symbol f and 'P Ai (Yil, ... , Yis.) is the function realized by the formula Ai (i = 1,2, ... , m).

The concept of a function 'P A, realized (represented) by formula A over (in) a basis L: is also can be defined by induction:

(1) the formula A = x, where x E X, corresponds to the identity function. So we set 'PA (x) = Xj

(2) if A = (-,B) or A = (B 0 C), where 0 E {&, V, EB, "', -t, I, l}, then we set 'P A = V5 B or 'P A = 'P B 0 'Pc, respectively (here the symbol 0 should now be interpreted as the notation of the corresponding elementary Boolean function, see Tables 1.3 and 1.4).

Let A = A(XipXi2, ... ,Xik)' B = B(xjl,xh, ... ,Xjl) and {Xl,X2, ... ,Xn} be a set of variables which are encountered in at least one of the formulas A or B, i.e. {Xl,X2, ... ,Xn} = {XipXi2, ... ,Xik} U {XjpXh, ... ,Xjl}. Formulas A and B are called equivalent (notation: A = B or A == B) if on each tuple (Ql, Q2, ... , Qn) of the values of variables Xl, X2, ... , Xn the values of functions 'PA and 'PB realized by formulas A and B, respectively, coincide, i.e. 'PA (Qil , Qi2 , ... , Qik) = 'PB (Qjl, Qh, ... , QjJ

Let <P be a set of functional symbols or logical connectives and P be a set of functions corresponding to them. A superposition (or composition) of the functions from a set P is defined as an arbitrary function F realized by a formula generated by the set <P.

Let A = A [J}nd, ... ,f!ns )] and B = B [g~nd, ... ,gins)1. Formulas A and B is said to have the same structure if the formula A can be obtained from the formula B by substitution of a functional symbol fi(n.) for every occurrence of the symbol

g}n.) (i = 1, ... , s). The structure of a formula reflects the inductive process of its generation in the correspondence with the definition of a formula (see Definitions 1 and 2).

The structure of a formula can be naturally characterized by its diagram (special, usually oriented, graph) which vertices marked by functional symbols (or logical connecti ves) and symbols of variables. For example, if formulas

A = P2) (g(2) (x, h(1) (y)) , 'P(2) (( x&y) , 1P(O») ), B = 1P(O),

C = g(2) (X, x), D = Jt2) ('P(2) (((x Vy) EB z) ,y), h(1) ((x&z)))

are generated by a certain set <P which contains logical connectives &, V, EB and functional symbols f(2), g(2), h(1), 'P(2), 1P(O) (and possibly something else) then their structure is described by the diagrams depicted in Fig. 1.2.

To call attention especially to the structure of a formula A = A [h, ... , fs] the notation A = C [fl, ... , fs] is used.

The following equivalences will be called basic: 1. x 0 y = yo x is called commutativity of the connective 0, where 0 is any of the

following connectives: &, V, EB, "', 1,1· 2. (x 0 y) 0 z = x 0 (y 0 x) is called associativity of the connective 0, where 0 is

any of the following connectives: &, V, EB, "'.

Page 20: Problems and Exercises in Discrete Mathematics

1.2. FORMULAS 11

3. (a) x&(y V z) = (x&y) V(x&z) is called distributivity of conjunction with respect to disjunction;

(b) x V(Y&z) = (x V y )&( x V z) is called distributivity of disjunction with respect to conjunction;

(c) x&(y (lJ z) = (x&y) EB (x&z) is called distributivity of conjunction with respect to mod 2 sum.

4. (a) x&y = (iVY); (b) xVy = (i&y); are called de Morgan's rules (lows).

5. (a) xV(x&y) = x; (b) x&(xVy) = x; are called (direct) absorption rules.

6. (a) xV(i&y) = xVy; (b) x&(iVy) = x&y; are called absorption rules.

7. (a) x&i = x&O = x EB x;

(b) x V i = x VI = x '" x = x -+ x = 1;

(c) x V x = x&x = x&l = x V 0 = x EB 0 = x;

(d) x EB 1 = x -+ 0 = x '" 0 = x 1 x = x 1 x = i;

(e)x=x.

8. (a) x EB y = (x&y)V(i&y) = (xVY)&(iVy);

(b) x'" y = xEBy = (x&y)V(i&y) = (xVy)&(iVy);

(c) l' -+ Y = iVy = (( x&y) EB x) EB 1.

9. (a) 1'1 y = x&y = iVy; (b) xl y = xVy = i&Y·

• 1\'(0)

B

'IjJ(0)

A

c x

Fig.1.2

Example 1. Prove that the word A = -,x) in the alphabet {-', &, V, (,), x} is not a formula in the basis Bo = {-', &, V}.

Page 21: Problems and Exercises in Discrete Mathematics

12 CHAPTER 1. REPRESENTATIONS OF BOOLEAN FUNCTIONS

Solution. To prove that a word W is not a formula, it is enough to find some condition such that every formula satisfies this condition but W does not. In our case, such a condition is, for example, the following: "every formula over Bo that differs from a formula consisting of a single symbol of a variable, has a pair of outer brackets" .

Let us prove this fact by induction on the number of connectives ..." &, V in a formula.

The basis of ind uction. If there is only one connective in a formula, then within an accuracy of renaming variables (with identification), this formula is of the type A = (...,x), or A = (x&y), or A = (x V y). Consequently, the basis of induction is proved.

x

0 0 0 0 1 1 1 1

Table 1.5

y Z 'PA 0 0 1 0 1 0 1 0 1 1 1 1 0 0 1 0 1 1 1 0 1 1 1 1

The in duct i vet ran sit ion. Assume that this state­ment is true for an arbitrary formula containing not more than s connectives (s 2:: 1). Let us prove it for formulas having s + 1 connectives. By the definition, the formula S can have one of the following three types: A = (...,B), or A = (B&C), or A = (B V C). All of them remove outer brackets. Hence, the inductive transition is also proved.

Note that by adding the left bracket the word A can be transformed to the word (...,x) which is a formula.

Example 2. By constructing the tables of functions realized by the formulas

A = ((x 1 y) ~ ((y EB (x V z)) I z)) and B = ((x Vy) '" '" (x ~ (y EB (x V z)))) find out whether these formulas are equivalent.

Solution. Considering that the function x ~ y turns to 0 only on the tuple (1,0) and the function x 1 y is equal to 1 only on the tuple (0,0), we can simplify the construction of the table of the function 'P A (x, y, z) generated by the formula A. Indeed 'PA = 0 if and only if xl y = 1 and (y EB (x V z)) I z = 0, i.e. when x = y = 0 and (0 EB (0 V z)) I z = z I z = Z = o. Consequently, 'PA = 0 under x = y = 0 and z = 1 only (see Table 1.5). We shall construct the table of the function 'PB (x, y, z) step by step (see Table 1.6). Comparing the value vectors of the functions 'PA and 'PB, we see that 'PA i- 'PB· Consequently, formulas A and B are not equivalent.

Example 3. Using the basic equivalences prove the equivalence of the formulas

A = (x 1 y) ~ (xz ~ ((x I (y '" z)) V (x· y EB z)))

and B = ((x ~ y) I (x 1 (yz))) V yz.

Solution. Applying the basic equivalences 8.(c), 9.(a) and 9.(b) we obtain

A = x V y V xz V (x (y '" z) V (xy EB z)) .

Page 22: Problems and Exercises in Discrete Mathematics

1.2. FORMULAS 13

Table 1.6

x y z Y 'PI = X V Y XZ 'P2 = Y fB XZ 'P3 = X --t 'P2 'PB = 'PI ,...., 'P2

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

Then using the basic equivalences 7.(e), 4.(a), 8.(b) and 8.(a), we have

A = (x V 1]) V (x V z) V ((xV (y fB z)) V ((x V 1]) Z V xyz)) .

Further applying the basic equivalencies 2, 7.(c), 7.(e), 1,3 and 8.(a) we get:

A = x V 1] V Z V yz V 1]z V xz V yz V xyz.

Finally using the absorption rule 5.(a) we come to the equality

Let us now transform the formula B to the same type. We have

B=(xVy)xVyzV1]Vz.

We used here basic equivalences 8.(c), 9.(a), 9.(b) and 4.(a). Then using basic equivalences 4.(a), 7.(e) and 4.(b), we obtain

B = x1] V x V yz V 1] V z.

With the help of the absorption rule 5.(a) the last formula is transformed to

x V 1] V z.

Thereby, the equivalence of the formulas A and B is proved.

Page 23: Problems and Exercises in Discrete Mathematics

14 CHAPTER 1. REPRESENTATIONS OF BOOLEAN FUNCTIONS

Example 4. There are three communications A, Band C to be transmitted by a communication channel. It is known that each of the following conditions has been fulfilled:

(1) Not more than one of the communications A and B has been transmitted.

(2) The communication A can be transmitted if and only if both communications Band C have been transmitted.

(3) At least one of the communications A or C has been transmitted.

Find out whether the communication B cannot be transmitted if the communi­cation C is known to have been transmitted?

Solution. Let us introduce the Boolean variables x, y and z as follows. Put x = 1 (analogously y = 1 and z = 1) if and only if the communication A (respectively the communication B and the communication C) has been transmitted by the communication channel. To the events (1), (2) and (3) there correspond the following Boolean functions: xy, x '" yz and xV z (it means, for example, that the second event fulfills if and only if x '" y z = 1). The Boolean function f (x, y, z) corresponding to the simultaneous fulfilling of three events is

xy· (x '" yz) . (x V z).

Transform this expression:

f(x,y,z) = (xVy)· (x· yz V x· yz)· (x V z) = = (x· yz V x· y. yz) . (x V z) = x· (yz V y. (y V z)) . z =

= x· (y V z) . z = x· y. z.

Hence, it follows that f(x,y,z) = 1 if and only if x = 0, y = 0 and z = 1, i.e. if the communications A and B has not been transmitted but the communications C has been transmitted. So the answer is "Yes".

1.2.1. Construct the diagram of the formula A:

(1) A = (x --+ (--,y));

(2) A = (x --+ (y&(--,z));

(3) A = ((--,x) V(Y EB (--,z)));

(4) A = ((--,(x --+ (--,y))) EB ((zV(y&x)) ~ y));

(5) A = f(1)(g(2)(j(1)(X),g(2)(y,/(1)(z))));

(6) A = g(2)(g(2)(x,f(1)(y)),g(2)(z,f(1)(x)));

(7) A = g(2)((XV f(1)(y)),g(2)((--,z),f(1)(y)));

(8) A = ((x --+ f(1)(y))Vg(2)((--,z)&f(1)(y)),x)).

1.2.2. Reconstruct the formula by its diagram (shown in Fig. 1.3).

Page 24: Problems and Exercises in Discrete Mathematics

1.2. FORMULAS 15

&

Y

o 1

x Y x

x Y (1) (2)

1 <p'J)

1 2 x

(4) Y

l

x

x

Y x 1

h'" Y

(5) (6) x x x

Fig.1.3

1.2.3. Construct the value vector of the function fA realized by the formula A: (1) A = (x -+ (--.y) V(x ffi z))j (2) A = (((x -+ y) -+ (--.((x I y) -+ (x I z)))) -+ ((--.y) -+ z)); (3) A = (x+ ((--.y) -+ ((--.x) tB z))); (4) A = (( (( x 1 y) I (y 1 x)) I z) 1 (x I z)); (5) A = f(1)(g(2)(j(1)(X),g(2)(g(2)(X, f(1)(y)), f(1)(x)))); (6) A = ((--.((x I (--.(y ffi (--.z)))))) V(--'(x&z))); (7) A = f(2)(((X -+ (--.y)) -+ z),g(1)(((x ffi y) -+ z))); (8) A = (((((x I y)) 1 z) I x) 1 y).

1.2.4. For the functions f(Xl' X2) and g(Xl' X2) represented by their value vectors construct the value vector Cth of the function h(xn ):

Page 25: Problems and Exercises in Discrete Mathematics

16 CHAPTER 1. REPRESENTATIONS OF BOOLEAN FUNCTIONS

(1) 0.1 = (0010), ~g = (1000), h = f(X1, X3)&g(X2' xtl; (2) o.f = (0100), ~g = (1101), h = f(X1' g(X2' Xl)); V g(X2' f(X1, Xl)); (3) o.f = (1001), ~g = (1110), h = f(X1' X3) ffi g(X2 ffi g(X2' f(X1, X4));

construct the table 112,2(h); (4) 0.1 = (0110), ~g = (1011), h = f(g(X1, X3), f(X2, Xl)); (5) 0.1 = (1101), ~g = (0111), h = f(g(xl, X2), X2) -t g(X2,J(X2' Xl)); (6) o.f = (1000), ~g = (0110), h = f(X1' J(X2, xtl) V g(f(X1' X2), g(X1' X3))) ffi J(g(X3, X4), J(X2,X2)));

construct the table 112,2( h). 1.2.5. By constructing the tables of the functions realized by the formulas A

and B, find out whether A and B are equivalent: (1) A = (x -t y) ffi ((y -t i) -t X· y), B = "'y :-:;. z;--t""'-;;;x; (2) A = (xVy) I (i -t (y -t z), B = Y -t (xV z); (3) A = x -t ((y -t z) -t y. z), B = (xV(y -t z))· (x ffiy); (4) A= (.rly)V(x~z) I (xEByz), B=x·(y·z)Vx-tz; (5) A = ((x V y). i) -t ((x ~ i) ffi y)) . ((x ffi y) . i), B = (x -t yz)&x -t y; (6) A = (iVy) -t ((y I i) -t (x'" X· z)), B = X· yV(x -t xy -t z); (7) A = (x I y) -t ((y 1 i) -t (x ffi z)), B = X· (y. z) ffi (x -t z); (8) A = (((x I y) 1 i) I y) 1 (y -t z), B = ((x I y) 1 (y I i))· (x -+ (y -t z)).

1.2.6. (1) The function J(:1;3) is defined as follows: it is equal to unity either for Xl = 1 or when the variables X2 and X3 assume different values while the value of the variable Xl is less than that of the variable X3. Otherwise, the function is equal to zero. Compile the tables T(f) and 01,2(f) of the function f(:1;3) and write down the tuples of the set Nf .

(2) The function f(5;4) is defined as follows: it is equal to zero only on such lupks 0 = (OJ. 02. 03, (4) that satisfy the inequality OJ +02> 03+204. Compile the tables T(f) and 112,2(f) and write down the tuples of the set Nf .

1.2.7. By constructing the tables of the functions realized with the formulas, prove the following equivalences:

(1) xVy = (x -t y) -t y;

B:

(2) x'" y = (x -t y)&(y -t x); (3) x 1 y = ((xl x) I (y I y)) I ((xl x) I (y I y)); (4) xV(y '" z) = (xVy) ~ (xV z); (5) x&(y ~ z) = ((x&y) rv (x&z)) rv x; (6) x -t (y rv z) = (x -t y) rv (x -t z); (7) xV(y -t z) = (xVy) -t (xVz); (8) x -t (y V z) = (x -t y) V(x -t z);

1.2.8. Using the basic equivalences, prove an equivalence of the formulas A and

(1) A. = (i -t y) -t (i· Y rv (x ffi y)), B = (x· Y -t x) -t y; (2) A = (x· yV(i -t y. z)) rv ((i -t y) -t z), B = (x -t y) ffi (y ffi z); (3) A = (x ffi y' z) -t (i -t (y -t z)), B = x -t ((y -t z) -t x); (4) A = i -t (y -t (x rv z))) . (x rv (y -t (z V(x -t y)))),

Page 26: Problems and Exercises in Discrete Mathematics

1.2. FORMULAS

B = (x -) (y -) z)) -) x; (5) A = (xVi)· z) -) ((x -) y) -) ((yV z) -) x)), B = (x -) y) -) (i) -) x); (6) A = (x· i)V X· z) Ell ((y -) z) -) X . y), B = (x· (i). z) Ell y) Ell Z; (7) A = x -) ((x· i) -) (x· z -) y)) -) y). z, B = x· (y -) z); (8) A = (x rv y) -) (x -) z) V(x Ell i). z), B = x rv (z -) y).

1.2.9. Find out whether the following words are formulas over the basis {" & V, -)}: (l)x-)y; (2) (x&),y; (3) (x f- y); (4) (y -) (x)); (5) (x -) (y & (,x))); (6) (x & y),z; (7) (,x-)z);

(8) ('x -) (z)); (9) (x f- (z)).

17

1.2.10. Find out in how many ways can brackets be arranged in the word A so that a formula over {" &, V, -) Ell} can be obtained:

(1) A = 'x -) y&x; (2) A = x&y&"z V x; (3) A = x -) 'y -) x&,x? (4) A = 'EB x'y -) 'z; (5) A = "x Ell "'y;

(6) A = xV'y Ell x Ell 'y; (7) A = .1' V y&'x EB z; (8) A = x V "y&,x EB z.

1.2.11. The complexity of a formula generated by the set of logical connectives E is defined as the number of occurrences of the connectives in it. By induction on the complexity of a formula, show that in the formula

(1) of nonzero complexity, there exists at least one pair of brackets; (2) the number of left brackets is equal to the number of right brackets; (3) two connectives cannot be side by side; (4) two variable symbols cannot be side by side.

1.2.12. An index of a connective a formula is defined as the difference between the number of left brackets preceding the connective under consideration in the formula and the number of right brackets preceding this connective. Prove that any formula of nonzero complexity generated by the set {" &, V, -)}

(1) contains a single connective of index 1;

(2) can be uniquely presented in one of the following forms: (,A), (A&B), (A V B), (A -) B), where A and B are formulas generated by {" &, V, -)}.

Page 27: Problems and Exercises in Discrete Mathematics

18 CHAPTER 1. REPRESENTATIONS OF BOOLEAN FUNCTIONS

1.2.13. Let us consider the formulas generated by the set of connectives {-', &, V, --+} in a form without brackets. Instead of (-,x), (x&y), (xVy) and (.r --+ y), we shall write -,:r, &xy, V xy, --+ xy.

For example, the formula (( -,x) --+ (y V( -,z))) will assume the form --+ -,x V y-,z. Prove that if each of the connectives &, V, --+ is evaluated as the number +1, each variable symbol as the number -1, and the connective -, as zero, the expression for A in a form without brackets will be a formula if and only if the sum of estimates of all occurrences of the symbols in A is equal to -1 and if this sum is nonnegative in each proper initial segment of the expression A.

1.2.14. Find out whether the word A is a formula generated by the set <I> if (1) A = f(2)(g(2)(x, y), f(2)(X)), <I> = U(2), g(2), <p(1)}; (2) A =)x(<p(1), <I> = {g(1), <p(l)};

(3) A = <p(l)U(2)(I, x)), <I> = {f(2),<p(l)}; (4) A = g(2)(<p(1), f(3)(x, y, <p(l))), <I> = U(3), g(2), <p(l)};

(5) A = (<p(l)U(2)(X, <p(l)(X)))), <I> = U(2), <p(l)}.

1.2.15. Find the value vector Q<p of the function <p represented by the formula A over the set <I> = UP), fJ2) , g(2)} if the functional symbols fP), fJ2), g(2) are put in correspondence with Boolean functions defined by vectors (10), (1011), and (1000) respectively:

(1) A = fJ2)U~1)(g(2)(X, fP)(y))), y); (2) A = g(2)Ul l)uJ2)(x, y)), g(2) (x, fP) (y))); (3) A = f~1)UJ2\X, g(2)UJ2)(X, y), fP) (y)))).

1.2.16. Compile the tables of functions represented by the following formulas (generated by the set of connectives L;):

(1) (x --+ y) EB ((y --+ z) EB (z --+ x)); (2) (xVy)V(x·z)l(x",y); (3) x --+ (z '" (y EB xz)); (4) (((x I y) 1 z) I y) 1 z.

1. 2.17. A formula generated by a set L; is called identically truth (identically false) if the function represented by it is equal to 1 (resp. zero) on any tuple of values of variables. Find out whether the function f is false:

(1) f = (x --+ y) --+ ((x V z) --+ (y V z)); (2) f = ((x EB y) rv z)(x --+ yz); (3) f = ((xV Y) 1 (x EB y)) EB (x --+ Y --+ (x V y)); (4) f = ((xVy)z --+ ((x'" z) EB y)) (x(yz)).

1.2.18. Find out whether the following formulas A and B are equivalent: (1) A = ((x Vy) V z) --+ ((xVy)(xV z)), B = x '" z; (2) A = (.r --+ y) --+ z, B = x --+ (y --+ z); (3) A = ((x EB y) --+ (x Vy)) ((x --+ y) --+ (x EB y)), B = xly; (4) A = (x --+ y) V((x --+ z)y), B = (xy) (y --+ xz).

1.2.19. Find all functions which depend only on variables ofthe set {x, y} and are superpositions over the set P:

Page 28: Problems and Exercises in Discrete Mathematics

1.2. FORMULAS 19

(1) P = {Ul <i" U2, I}; (2) P = {UIU2 EEl (U1 VU2)}; (3) P = {f(Ul, U2) = (1101), g(U1, U2, U3) = (10010110)} 1.

1.2.20. A depth of a formula A over <1> (notation: depthcp (A))) is determined by induction:

(I) if A is the symbol of a variable of a functional symbol of 0 arguments, then df'pth.pA = 0:

(II) if A = f(n)(A 1 , ... , An), where f(n) E <1>, then

depcp(A) = max dep.p(A) + 1. l:$':$n

Find the formula A generated by the set {1}, having a minimal depth and representing the function

(1) f = ,rVy; (2) f = I?fl y; (3) f = xy.

1.2.21. Find out if a function f can be represented by a formula A of depth k generated by a set of connectives 5 if

(1) f = xy, k = 2, 5 = {I}; (2) f = x ---) y, k = 3, 5 = {V, rv}; (3)f=xEElyEElz, k=2, S={---),&}.

1.2.22. Prove that a function f cannot be represented by a formula over 5: (l)f=xEElY,S={&}; (2) f = xy, S = {---) }; (3)f=xVY,S={rv}.

1.2.23. Find out whether it is possible to represent a function f by a formula of depth k + lover 5 if it can be represented by a formula of depth k over S.

1.2.24. A function f in P2 can be represented by a formula of depth k over a set S. Show that the function f can be represented by a certain formula of depth more than k over the same set S.

1.2.25. Verify whether the following relations are valid: (1) IV(y rv z) = (IVY) rv (xV z); (2) x ---) (y rv z) = (x ---) y) rv (x ---) z); (3) x&(y rv z) = (x&y) rv (x&z); (4) x ---) WVz) = (x ---) fj)V(x ---) z); (5) x ---) (y&z) = (x ---) y)&(x ---) z); (6) x EEl (y&z) = (x EEl y) ---) (x EEl z); (7) x ---) (y ---) z) = (x ---) y) ---) (x ---) z).

1.2.26. Realize the function f by a formula in the basis 5: (1) f=x---)y, S={--" V}; (2) f=xVy, 5= {---)}; (3)f=x rv y,S={&,---)};

1 Here and below, while presenting a function in the vector form, we often shall use the notation f = J instead of O:j = J.

Page 29: Problems and Exercises in Discrete Mathematics

20

B:

CHAPTER 1. REPRESENTATIONS OF BOOLEAN FUNCTIONS

(4) f = xly, 5 = {l}.

1.2.27. Using the basic equivalences, prove the equivalence of formulas A and

(1) A = (X&z) V(x&y) V(x&z), B = x&y&zVx&z; (2) A = (.r --7 y) --7 ((x&y) + (of '" y)), B = (J'Vy)&(iVY); (3) A = x --7 (x&y --7 ((x --7 y) --7 y)&z), B = y --7 (x --7 z).

1.2.28. Let A and B be formulas generated by the set {-', & V, 61, "', --7, I, n and Al = (A --7 B) --7 B, A2 = A -t (B -t -, (A -t A)). Prove that A", B = 1 if and only -, (AI'" A2 ) = L

1.2.29. Prove that formula A containing only the connective rv is identically true if and only if any variable from formula A appears in it an even number of times.

1.2.30. By 51) A I , we denote the formula obtained from the formula A as a result of a simultaneous replacement of each occurrence of variable x by formula E. If formula A does not contain x, then by definition we put 51) A I = A.

(1) Prove that A is identically true if and only if the formula 5:I - Y2 AI is identically truth. Yl and Y2 being variables not appearing in formula A.

(2) Can the condition that Yl and Y2 do not appear in formula A be neglected in (I)?

1.2.31. (1) Suppose that the function f(x, y) from P2 satisfies the relation

f(f(x, f(y, z)), f(f, (x, y), f(x, z))) == L

Prove that the following equivalences are true in this case: (a) f(x, x) == 1; (b) f(x, f(y x)) == 1; (c) f(f(f(x, y), f(x, z)), f(x, f(y, z))) == 1; (d) f(f(x, y), f(f(x, f(y, z)), f(x, z))) == 1; (e) f(f(x, f(y, z)), f(y, f(x, z))) == L (2) Do the equivalences (b), (c) and (d) follow from (e)?

1.3 Disjunctive and Conjunctive Normal Forms

The formula "1& "2& & "r(f I "IV"2V V "r) Xii Xi2 • .• Xir ormu a XiI Xi2 • •. xir ,

here 17k E {O, I}, X?k = Xi k , xL = Xik , i k E {I, 2, ... , n} for all k = 0, is called a conjunction (resp. disjunction) over the set of variables xn = {Xl, X2, ... ,

xn}. A conjunction (disjunction) is called elementary (abbreviated as e.c. and r.d. respectively) if Xi) =I- Xik for j =I- k. For the sake of brevity, the symbol & in an e.c. will be omitted. The symbols of variables or their negations will be called literals. The number of literals in an e.c. (e. d.) is called the rank of the e.c. (e.d.). The

Page 30: Problems and Exercises in Discrete Mathematics

1.3. NORMAL FORMS 21

constant 1 will be assumed to be the e.c. of the rank zero, and 0 will be called the e.d. of the rank zero.

Formulas of the type (1)

s (concise notation V f{i), where J{i (i = 1,""8) are conjunctions, are called the

i=l disjunctive normal forms (abbreviated as d.n.f.).

Formulas of the type (2)

(concise notation &£=1 Dil, where Di (i = 1,""8) are disjunctions, are called conjunc­tivenormal forms (abbreviated as c.n.f.). The number s is called the length of the d.nI (c.n.f.). The sum of the ranks of conjunctions (disjunctions) is called the complexity of d.nI (c.n.f.). The disjunctive (conjunctive) normal form over the set xn = {Xl, X2, ... , Xn} of variables is called perfect if it is formed by pairwise different elementary conjunctions (disjunctions) of the rank n.

Let fun) be a Boolean function and let 1 :::; i l < i2 < ... < ik :::; n. By fil,i2, ... ,ik(xn) (or sometimes by Sil ,i2, ... ,ik f(xn)l) we shall denote the function

G"1(J2··J7k 0"1 (T2· .. (J'k

obtained from f( xn) by substituting the constants 0'1, 0'2, ... , O'k respectively for th . bl .. . Th f t' jil ,i2, ... ,ik(-n)· Iidth <71 <72 <7k evana esxlj,x'2""'X'k' eunclOn <71 <72 .. ·<7k X lscae eXilxi2"'Xik - component of the function f(5;n) or a subfunction of f(5;n). The subfunction f~;:;,.:;~ik(x") is called proper if k i- nand k i- 0, The subfunctions of f(5;") are different if they differ as functions of the variables Xl, X2, ... , X n .

Let 1 :::; i1 < i2 < . , . < ik :::; n. In this case, the following representation is valid:

V X<7IX<72 , .. x<7 k fi l ,i2, ... ,ik (5;n) 1,1 1,2 1,k 0"10"2·.·(Jk , (3)

(<71, <72, ... , <7d

where the disjunction includes all vectors (0'1, 0'2, ... , O'k) in Bk. For k = n this representation has the form

f(x n) = V x~lx~2 ... x~nf(0'1'0'2'''''O'n)' (<71,<72, ... , <7n)

Representation (4) can be written in the form

f(x n) = V X~IX~2 &: 1(&)=1

X <7n n .

(4)

(5)

The right-hand side of the equality (5) is the perfect d.n.f. of f(5;n). Similarly, the following representations are valid:

f(i;") = (6)

f(5;n) = 1\ (x~IVx~2V· .. Vx~n). (7) &n:f(&n)=o

Page 31: Problems and Exercises in Discrete Mathematics

22 CHAPTER 1. REPRESENTATIONS OF BOOLEAN FUNCTIONS

The right-hand side of the equality (7) is the perfect c.n.f. of f(xn).

Example 1. Construct the value vector O:g of the subfunction 9 = f;03(X4) of the function f(x 4 ) with the value vector O:f = (1110011010100011).

Solution. By the definition of a subfunction we have g(OO) = f(0100), g(OI) = f(0101), g(10) = f(1100), g(l1) = f(1101).

Hence, writing out the coordinates of the vector O:f with the numbers 4, 5, 10, 11 we get

g(OO) = 0, g(OI) = 1, g(10) = 1, g(l1) = O. Therefore 0:9(Xl,X4) = (0110).

Note that we can regard the subfunction 9 as a functions depending on the variables Xl, X2, X3, X4 Then, taking into account that

g( a, 0, 0,,8) = g( a, 0,1,,8) = g( a, 1, 0,,8) = g( a, 1, 1,,8) for any a,,8 from B2 we obtain that O:g(x4) = (010101011010 1010).

Example 2. Construct the perfect d.n.f. and the perfect c.n.f. of the function f(x3) such that O:f = (01010010).

Solution. Considering the value vector we see that Nf = {(001), (011), (llO)}, NJ = {(OOO), (010), (100), (101), (Ill)}.

Accordingly (5) and (7) we find f(i 3) = .r~xgx1 V .r~x~x1 V x~x~xg = XIX2 X3 V XIX2 X3 V XIX2 X3

and f(i: 3) = (Xl V X2 V X3) (Xl V.1:2 V X3) (Xl V X2 V X3) (Xl V X2 V X3) (Xl V X2 V X3).

Example 3. Using equivalent transformations construct the perfect d.n.f. of the function f(x,y) = X ~ y.

Solution. Sequentially using the rules 8 (c), 6 (a), 7 (c), 7 (b), 3 (a) (note that the rules 6 and 7 are applied from the right to the left) we have

x ~ y = xVy = xVxy = x·l Vxy = x(yVfJ)Vxy = xyVxfJVxy. The last formula is the wanted d.n.£.

1.3.1. Using equivalent transformations, reduce the formula F to d.n.f.: (1) F = (Xl V X2 X3)(XI V X3); (2) F = ((Xl V X2 X3X4) ((X2 V X4) ~ XIX3 X4) V X2 X3) V(XI V X4); (3) F = ((Xl ~ X2X3) (X2X4 EB X3) ~ XIX4) V Xl. (4) F = (Xl VX2 VX3)(XIX2 V X3); (5) F = (XIX2 EB X3)(XIX3 ~ X2); (6) F = (Xl'" X2) V (XIX3 EB (X2 ~ X3)); (7) F = (Xl! X2X3)1((Xllx2) ! X3); (8) F = Xl ~ (X2 ~ X3) EB (xII(X2 EB X3))'

1.3.2. Construct the perfect d.n.f. of the function f represented by its value vector:

(1) O:f(x2) = (0010); (2) O:f(i;2) = (0010);

Page 32: Problems and Exercises in Discrete Mathematics

1.3. NORMAL FORMS

(3) af(i3) = (10001110); (4) af(i3) = (01101100); (5) af(i3) = (11001000); (6) aJ(i3) = (01000101); (7) af(r') = (0100000001000100); (8) aJ(i4) = (0000010000000001).

23

1.3.3. Using transformations of the type A = Ax V Ax, A V A = A, reduce a given d.n.f. D(x3 ) to a perfect d.n.f. if

(1) D(x3) = Xl V X2X3;

(2) D(x3) = XIX2 V XIX3;

(3) D(:i') = 1'1 V hr2 V h r3'

(4) D(x3) = XlX2 V X3;

(5) D(x3) = XlX2 V X2X3 V XlX3;

(6) D(x3) = Xl V X2X3 V X2X3;

(7) D(x3) = XlX2 V X2X3 V X3;

(8) D(x3) = Xl V X2 V XlX3·

1.3.4. Find the value vector Ctg of the J{-component 9 of the function f(x n ):

(1) f(x 3) = Xl -+ (X2 ttl XlX3), K = X2;

(2) f(x 3) = XlX21(X2 -+ XlX3), K = X3;

(3) f(5;3) = (Xl V X2 V X3) ! (Xl -+ (X2 -+ X3)), K = Xl;

(4) f(x 3) = (01110100)' K = Xl;

(5) f(x 3 ) = (11001110), K = X2;

(6) f(x 3 ) = (10011110). K = X3;

(7) f(x 4) = (Xl ttl X2) -+ (X3 -+ XlX4), K = X2X4;

(8) f(iA ) = (Xl V X2X3 V X4) ttl (XIX2X3 -+ X4), K = XlX2X3;

(9) f(x 4) = (0101011011100011), K = XlX4; (10) f(x 4) = (11011011 0000 1001), K = X2X3X4.

1.3.5. With the help of the transformations A = (A V x)(A V x) and AA = A construct the perfect c'n,f. from the given c.n.f. K:

(1) K = (Xl V X2)X3;

(2) K = (Xl V X2)(X2 V X3)X3; (3) K = (Xl V X2)(Xl V X3)(X2 V X3);

(4) K = XIX2(Xl V X3)(Xl VX3);

(5) K = (Xl V X2)X2(Xl V X3)(X2 V X3);

(6) ]{ = (Xl V X2 V X3)(Xl V X2 V X4);

(I) J{ = (Xl V X2)(X2 V X3)(X3 V X4);

(8) ]{ = XlX2X3(XI V X2 V X3 V X4)'

1.3.6. Count the number of functions f(x n ) for which the perfect c.n.f. IS

simultaneously a d,n.f.

1.3.7. Find the length of the perfect d.n.£. of the function f(x n ):

Page 33: Problems and Exercises in Discrete Mathematics

24 CHAPTER 1. REPRESENTATIONS OF BOOLEAN FUNCTIONS

(1) f(xn) = VI<i<i<nXjxi,n 2: 2; (2) f(xn) = &1$i<j$n(Xi -+ xi), n 2: 2; (3) fUrn) = (((xllx2)lx3)1 .. . IXn-I)lxn,n 2: 2; (4) f(xn) = Xl -+ (X2 -+ (X3 -+ ... -+ (Xn-l -+ Xn) .. . )), n 2: 2; (5) f(x n) = ( ... ((Xl -+ X2) -+ X3) -+ ... -+ Xn-d -+ Xn, n 2: 2; (6) f(xn) = (Xl V X2)(XI V X2) -+ X3.·. Xn, n 2: 3; (7) f(xn) = XIX2 ... Xn EEl X3 EEl ... EEl Xn, n 2: 3; (8) f(xn) = (Xl V X2 V X3 V ... V Xn) -+ (( ... (X3 I'V X4) I'V ... I'V xn-d I'V Xn), n 2: 4.

1.3.8. Let us suppose that the sets xn = {Xl, X2, ... , xn} and ym = {y!, Y2, ... , Ym} do not intersect. Assuming that the perfect d.n.f.s of functions f( 5:n ) and g(ir) have k and I terms respectively, find the length of the perfect d.n.f. of the following functions:

(1) f(5:n)&g(fjm); (2) f(5:n) V g(fjm); (3) f(5: n) EEl g(fjm).

1.3.9. Present the Xr, X2- and XIX3-components of the function f(5:3) by using the minimal complexity d.n.f. for

(1) f( j;3) = (01101101); (2) f(i:3) = (Xl -+ X2) EEl X2X3; (3) f(5:3) = (Xl -+ X2X3) EEl X2·

1.3.10. Find out which of the functions depending on variables Xl and X2 have the largest number of pairwise different subfunctions.

1.3.11. Find the number of Boolean functions f(5: n) which are transformed into thelllselves upon a commutation of Xl and X2'

1.3.12. Two functions f(5: n) and g(5:n) are commutatively equivalent if there exists a permutation 7r of numbers 1, ... , n such that f(xI, ... , Xn) = g(X 7T(I), ... , X 7T(n))' Find the number of classes of commutatively equivalent functions in P2(X2).

1.3.13*. The function fn(5: n) is defined by the following recurrence relations: f4(5:4) = XIX2(X3 V X4) V X2(XIX3 V XIX4) V XIX2 X3X4, fn+l(in+l) = fn(i!, i 2, ... , in)i:n+l VXIX2,,,XnXn+1 (n 2: 4). For each func­

tion in the sequence Un} find the number of different subfunctions of the type f~(in), i = 1, n, u E {O, I}, such that no two functions are commutatively equivalent.

1.3.14. Prove that the number of different functions f( in) for which a given function g( 5: k ) is a subfunction is not less than

22n _ (22k _ 1)2n-k (k ::::; n).

1.3.15. Let f~(xn) = ft(x n ) for any i(l ::::; i ::::; n). Prove that f(x n) is a constant.

1.3.16. Find the number of functions f(xn) such that f~(/(5:n) = f~,/(xn) for all 1 ::::; i < j ::::; n (n 2: 3).

1.3.17. Let h(in) = f(91(i n), ... , 9i_l(in), 9i(in), 9i+1(5:n), ... , 9n(5:n)), n 2: 2, and the following relation is satisfied for any i = 1, 2, ... , nand u E {O, I}:

S!h(xn)1 = f(S~91(5:n)l, ... , S~9i_l(5:n)l, a, S~gi+l(Xn)l, ... , S~gn(xn)l),

Page 34: Problems and Exercises in Discrete Mathematics

1.4. POLYNOMIALS 25

in ot her words, the Ii -component of the superposition of the functions f, gl, ... ,

gi-1, gi, gi+1, ... , gn is equal to the superposition of the xf-components of the functions f, gl, ... , gi-1, gi+1, ... , gn' _ Moreover, let the x?x~k-component of the function gi(Xn) coincide with the x?x~k-component of the same function gi(Xn ), i = r,-n, for all j, k (1 ~ j < k ~ n) and (Jj, (Jk from {O, I}. Prove that h( in) is a constant.

1.4 Polynomials

An elementary conjunction is called monotone if it does not contain negations of variables. The formula

(1)

where I<i (i = G) are pairwise different elementary monotone conjunctions over the set xn, is called Zhegalkin's polynomial or the Reed-Muller polynomial or a mod i polynomial or, simply, a polynomial. The highest rank of elementary conjunctions appearing in a polynomial is called the degree of this polynomial. The number s is called the length of the polynomial. For s = 0, we assume that P(x n ) = O. The following statement is valid.

Theorem (I. I. Zhegalkin). Every Boolean function f can be represented by the modulo 2 polynomial Pj . This polynomial is unique.

We adopt the following numeration of monotone elementary conjunctions over the set xn = {Xl, X2, ... , Xn} of variables. We correspond each monotone e.c. I< with a vector 0-( I<) = ((Jl, (J2, ... , (In) in Bn, in which (Ji = 1 if and only if Xi

appears in K The number I< of an e.c. is defined as v( 0-( K)) = L~=l (Ji2n-i. The constant 1 will have the number zero in this numeration. Thus, each polynomial P( in) can be presented in the form

(2)

where I<i is an e.c. with number i (i = 0, 2n -1). The vector ~(P) =((30, (31, ... , f32n-d is called the vector of coefficients of polynomial p(in).

The method of undeterminate coefficients for constructing Zhegalkin's polynomial representing the function f( in) can be described as follows. We consider a polynomial in the form (2) and for each ii E En we compose an equation f( ii) = P( ii). The solution of these equations gives the coefficients of the polynomial p(xn).

Example 1. Construct the polynomial Pj(x2) for the function f(x 2) = Xl -t X2.

Solution. Write out the polynomial with the undetermined coefficients:

Pj (x2) = (30 EB (31 X2 EB (32 X1 EB (33 Xl X2·

Further construct the system of linear equations with respect to the coefficients ;30, ;31, (32, (33:

Page 35: Problems and Exercises in Discrete Mathematics

26 CHAPTER 1. REPRESENTATIONS OF BOOLEAN FUNCTIONS

1(0, 0) = 1 = /30 EB /31 ·0 EB /32·0 EB /33 . OJ

1(0, 1) = 1 = /30 EB /31. 1 EB /32.0 EB /33· OJ

1(1, 0) = 0 = /30 EB /31 ·0 EB /32· 1 EB /33· OJ

1 (1, 1) = 1 = /30 EB /31 . 1 EB /32 . 1 EB /33 . 1.

We obtain /30 = /32 = /33 = 1, /31 = O. Hence Xl -t X2 = 1 EB Xl EB XIX2·

The method of undeterminate coefficients implies the following algorithm for obtaining the vector of coefficients ~(Pf) of the polynomial of the function 1 from the value vector Qf. Divide the vector Qf into two halves. Construct the new vector QI such that its first half coincides with the first half of ii f, and the second half is equal to the mod 2 sum of the first and second halves of Qf. Further, divide each half of the vector QI into two halves and carry out the same actions which were done at the first step. When this procedure is done n times with progressively smaller parts, we will get the vector ~(Pf). We shall refer to this procedure as the "division and summation" algorithm.

Example 2. Construct the polynomial for the function 1(;;:3) with the value vector iif = (00111001).

Solution. Apply the "division and summation" algorithm. In Table 1.7 we see the process of obtaining of the vector ~(Pf). For brevity, we set Qo = iif and ~=~(Pf)·

Table 1.7

X Y z Qo QI Q2 Q3 = /3 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 1 1 1 0 1 1 1 1 1 0 1 0 0 1 1 1 1 1 0 1 0 0 0 1 1 1 0 0 1 0 0 1 1 1 1 0 0 0

We see that ones ofthe ~ correspond to tuples (010), (100) and (101). This means that the addends of the polynomial are X2, Xl and XlX3. The required polynomial is

Pf = X2 EB Xl EB XI X 3·

Note that the transformation of Qf to ~(Pf) could be carried out without constructing the whole of Table 1.7. It is enough to deal only with the vectors themselves.

Page 36: Problems and Exercises in Discrete Mathematics

1.4. POl}'NOMIALS 27

One more method of constructing Zhegalkin's polynomial from an arbitrary formula F involves the construction of an equivalent formula FI over the set of connectives {&,""'}, with the subsequent replacement of x by x El:l1 throughout, the opening of the brackets, the application of the distributive law (x El:l y)z = xz El:l yz, and thf' collection of terms.

Example 3. Construct the polynomial for the function f realized by the formula F = .rl --+ X2·

Solution. The first step is the obtaining of Fl. We have

F = XI --+ X2 = XI V 1'2 = XIX2 = Fl'

Further transformations give the required polynomial

1.4.1. Find the number of monotone elementary conjunctions of rank r over the Sf't X".

1.4.2. Find the number of polynomials of power r over the set of variables xn. 1.4.3. Find the number of different polynomials of length k over the set xn

vanishing at the tuples 6 and 1. The polynomials are considered to be different if they differ in the set of e.c.

1.4.4. F sing the method of indeterminate coefficients, find polynomials for the following functions:

(1) f(.;·2) = (1001); (2) f(.;·2) = (1011); (3) f(5,,3) = (01111000); (4) f(5;3) = (01001100); (5) f(i 3 ) = (01101001); (6) f(.r 3 ) = (00100001); (7) f(i'3) = (01101101); (8) f(i'3) = (11111000).

1.4.5. Transform the vector o.f to the vector ~(Pf) using the method illustrated by Example 2:

( 1) a. f (j2) = (1011); (2) Gf(i2) = (0110); (:3) Gi(i'3) = (01011100); (4) OJ(j.3) = (11011110); (5) Of(j4) = (0100110101011110); (6) CtJ(j4) = (0110000111010010); (7) Ct f(j4) = (0110110111011101); (8) Gf(}·4) = (1011 0100 11011110).

Page 37: Problems and Exercises in Discrete Mathematics

28 CHAPTER 1. REPRESENTATIONS OF BOOLEAN FUNCTIONS

1.4.6. For given vector ~(Pf) construct the vector iif: (1) ~(Pf) = (1011); (2) ~(Pf) = (1110); (3) ~(Pf) = (00011110); (4) ~(Pf) = (01011101); (5) ~(Pf) = (0110110001011000); (6) ~(Pf) = (1110000001011110); (7) ~(Pf) = (0010 110001011100); (8) ~(Pf) = (1001010000001111).

1.4.7. Construct the polynomials for the function f(x n ) represented by the formulas:

(1) f(x 2) = Xl I X2; (2) f(x 3) = (Xl ~ X2) (X2 ! X3); (3) f(x3) = ((Xl ~ X2) V x3)lxI; (5) f(x3) = Xl V X2X3 VX2X3; (6) f(x3) = (Xl ~ X2) ! XIX2X3; (7) f(x3) = ((Xl ~ X2) V X2) I X2 X3; (8) f(i4) = ((XIX2 ~ X2X3) I X2 X4) V X3X4; (9) f(i4) = XIX2X3X4 V XIX2X3 V X2X4'

1.4.8. Any Boolean function f can be represented by an arithmetic polynomial over the usual operations of multiplication, addition and subtraction. For this purpose, it is sufficient first to express f with a formula over a conjunction and a negation, and then replace the symbols of conjunction by the symbols of multiplication, the subformulas of the type A by 1- A, and open the brackets. Find the arithmetic polynomial for the following functions:

(1) f(x 2) = Xl V X2; (2) f(x 2) = Xl ~ X2; (3) f(x 2 ) = (1001); (4) f(x3) = (00011111); (5) f( x3 ) = (01010011); (6) f( x3 ) = (00111010).

1.4.9. Find the function f(xn) whose polynomial has a length 2n times the length of its perfect d.nJ.

1.4.10. Prove the validity of the following formula for expansion in k variables (the summing carry out modulo 2):

1.4.11. Prove that (1) f(xn) = XIUJ(Xn) EB Jf(xn)) $ fJ(x n );

(2) f(xn) = (Xl VUJ(xn) '" Jf(xn))) '" Jf(xn).

Page 38: Problems and Exercises in Discrete Mathematics

1.4. POLYNOMIALS 29

1.4.12. Show that the function f(i n ) represented by a polynomial of degree k > 0 becomes equal to 1 on at least 2n- k tuples in En.

1.4.13. Determine the number of tuples in En on which the polynomial p(in) becomes equal to unity:

(1) P(i·n ) = Xl ... Xk ffi Xk+l'" Xn (1 ::; k < n); (2) p(in) = 1 ffi Xl EB XlX2 ffi ... EEl XlX2··· Xn = 1 EEl L:'=l Xl ... Xi. 1.4.14. Show that for any l (l ::; 2n), there exists a polynomial p(in) of length

not exceeding n, so that INp(xn ) I = l.

1.4.15. Prove that any function f( in) other than 0 can be presented in the form f(i· n ) = L:=l Ii;, where J{i (i = 1,S) are elementary conjunctions containing no more than one negation of the variable, and s ::; 2n - l .

1.4.16. Show that if the symbol "V" in a perfect d.n.f. is replaced by "EEl" everywhere, a formula equivalent to the initial one is obtained. Is this statement true for an arbitrary d.n.£.?

The derivative of a Boolean function f( in) with respect to the variables XiI' J';2' ... , X i k (or the Boolean difference) is defined as the function

d(Xi!l Xi 2 , ••• , Xi k )

=f(Xl, ... , iij) ... , ii k , ••• , xn)EElf(Xl, ... , XiI' ... , Xi k , ... , Xn).

(For k = 1, the notation d~~~~) is used.)

1.4.17. Prove the following properties of a derivative:

( 1 )

~ (df(X n)) _ ~ (df(x n )) .

dXj dXi - dXi dXj ,

(2) df(in) dJ(in)

d(XiJl ... , Xi k ) d(Xil, .. ·• Xik)'

(:3)

(4)

(5)

Page 39: Problems and Exercises in Discrete Mathematics

30 CHAPTER 1. REPRESENTATIONS OF BOOLEAN FUNCTIONS

(6) dfd(i: n) = 0 if and only if Xi does not appear explicitly in Zhegalkin's polynomial

T,

of the function f(xn);

1.4.18. If g(XI, ... , xm) and h(Xm+I' ... , Xn) are Boolean functions and 1 ::; i j ::; m for all j = l,k, then

(1) d(g tB h) dg

d(XiJl ... , Xi k ) d(Xi" ... , Xik)'

(2) d(g&h) _ h dg .

d(XiJl ... , Xi k ) - d(Xi" ... , dXik)'

(3) d(g V h) = h dg .

d(Xi" ... , Xik) d(Xi, , ... , dXik)

1.4.19. Prove Zhegalkin's theorem.

1.5 Essential and Unessential Variables

A variable Xi of the function f(Xl, X2, tuples 0, and ~ such that

and

... , Xn) is called essential if there exist

f(o,) # f(~). Otherwise, the variable Xi is called an unessential variable of the function f(x n). Two functions f(Xn) and g(in) are called equal

if the sets of their essential variables coincide and, on any two tuples, differing perhaps only in the values of unessential variables, the values of the functions are identical. Let the functions f and 9 be equal and the sets X and Y of their variables satisfy the inclusion X C Y. Then the function f can be obtained from 9 by deleting some unessential variables, and the function 9 is obtained from f by adding unessential variables (from the set Y \ X).

Let 1 ::; i l < i2 , .•• < ik ::; n. We shall say that the function

is obtained from f( Xl, X2, ... ,xn) by identification of the variables Xi" Xi2 , ••• , Xi k

if 'f' is obtained from f by substitution of some one variable X in the place of the

Page 40: Problems and Exercises in Discrete Mathematics

1.5. ESSENTIAL AND UNESSENTIAL VARIABLES 31

variables Xi1, Xi2 , ••• , Xik. For x, we can take any variable not belonging to the set Xn\{Xi1' Xi 2 , ••• , Xik}'

Example 1. From the function l(x3 ) represented by the value vector iif (10lD 1111) and depending unessentially on X2, obtain the value vector iig of the function 9 equalled to I and essentially depending on all of its variables.

Solution. It follows from the definition that if Xk is an unessential variable of l(xn), then

for every tuple (O'l, ... ,O'k-l,O'k+1'''',O'n)' The equality (1) is equivalent to the equality 1~(i:") :::: 1~(i:n) for the components. Expanding I with respect to the vaTiable x k, we have

I :::: xol; V xd~ :::: I; :::: 1~· Hence, the value vector of the function obtained from I by deletion, the unessential variable Xk, coincides with the value vector of any of the components 1~ and if. In our case, we need to extract the value vector ii f5 (or ii ff) from ii f. Writing the coordinates ao, aI, a4, and a5 of the vector ii f corresponding to the values 1(000). 1(001), 1(100), and 1(101), we obtain that iig :::: (1011). The essential dependency on the variables Xl and X3 follows from the relations g(OI) =f. g(l1) and g(Ol) =f. g(OO).

Example 2. Enumerate all the essential and the unessential variables of the function I such that O:f :::: (1100 0011 11000011).

Solution. Comparing the values of function for each pair of tuples, adjacent by the variable J:4, we note that

1(0,0,0,0):::: 1(0,0,0,1):::: 1(0,1,1,0):::: 1(0,1,1,1) :::: f (1, 0, 0, 0) :::: 1(1,0,0,1) :::: 1(1,1,1,0) :::: f (1, 1, 1, 1) :::: 1

and

1(0,0,1,0):::: 1(0,0,1,1):::: 1(0,1,0,0):::: 1(0,1,0,1) :::: 1(1,0,1,0):::: 1(1,0,1,1):::: 1(1,1,0,0):::: 1(1,1,0,1):::: 0,

i.e. I (Xl, X2, X3, 0) == I (Xl, X2, X3, 1). Consequently, variable X4 is unessential. Note that 1(0,0.0,0) :::: 1 while 1(0,0,1,0) :::: ° and 1(0,1,0,0) :::: 0. Therefore, the variables J'3 and X2 are essential. Finally, taking to account that 1(0, X2, X3, X4) :::: (11000011) :::: 1(1,x2,x3,x4), we conclude that the variable Xl are unessential. Thus the variables Xl and X4 are unessential and variables X2 and X3 are essential. (It. is evident that I (:;;4) :::: X2 ~ X3.)

Example 3. Enumerate all the essential and unessential variables of the function

f (i:4) :::: ((XlX2 V X3) ~ (XlX4 V X2X3)) -+ (((X2 ttl X4)VX3) 1(';1'1' (X2 -+ (X3 ttl X4))))' Solution. It is possible to use the following statements (prove them): (1) If a d.n.f. contains each of its variables only once (with or without negation),

it depends essentially on all its variable. Note that such a d.n.f. is called repetition­lree.

Page 41: Problems and Exercises in Discrete Mathematics

32 CHAPTER 1. REPRESENTATIONS OF BOOLEAN FUNCTIONS

(2) A variable x is essential for a function f if and only if x occurs in the polynomial of f.

We use the first of the statements. To this end we represent f by a d.nJ. and then simplify it.

At first, we use the equivalences

X-+y=xVy, X= x, x '" y = x EB y, and x I y = x V y.

We have

f (i4) = ((XlX2 V X3) EB (XlX4 V X2X3))

V(X2 EB X4) V X3 V Xl (X2 V (X3 EB X4)).

Then, we use the equivalences

xfBy=xyVxy, xVy=x·y, "'i1FY=x"'y=xyVxy, x·y=xVy, x=x,

x EB Y = x EB y EB 1 = x EB y = xy V xy.

We obtain:

f (i4) = (XlX2 V X3) XlX4 V X2X3 V XlX2 V X3 (XlX4 V X2X3)

V (X2X4 V X2X4) X3 V Xl V X2 (X3X4 V X3X4). Note that

and

XlX2 V X3 = XlX2 . X3 = (Xl V X2) X3.

Removing the parentheses, we get

f (i4) = XlX2 V XlX2X3 V XlX2X4 V XlX2X3X4 V XlX2X3

VXlX3 V X2X3X4 V X3X4 V XlX3X4 V XlX2X3 V XlX2X3X4

VX2X3 V X2X3X4 V X2X3X4 V Xl V X2X3X4 V X2X3X4.

noindent With the help of the absorption rule A V AB = A, the last formula can be transformed to the following one:

Further, using the equivalences x V X = 1 and X· 1 = x, we obtain f (i4) = Xl V X3X4 V X2X3 V XlX3X4 V X2X3 (X4 V X4)

= Xl V X3X4 V XlX3X4 V X3 (X2 V X2) = Xl V X3X4 V XlX3X4 V X3.

Finally, using the absorption rule and the equivalence xy V x = x V y, we have f(i4) = Xl VX3 VX4·

The obtained d.nJ. is repetition-free. It immediately follows that the variable X2 is unessential and Xl, X3 and X4 are essential.

Page 42: Problems and Exercises in Discrete Mathematics

1.5. ESSENTIAL AND UNESSENTIAL VARIABLES 33

Example 4. Find out whether the function gl (x, y) = xVy can be obtained from the function f (iA) = (XI V X2 V X3) X4 V XIX2X4 by the identification of variables.

Solution. It is easy to see f (0) = 1 and f (I) = 0. Consequently, any func­

tion that can be obtained from the function f (iA ) by the identification and the renaming of variables is equal to 1 on the zero tuple and to ° on the unit tuple. At the same time, the function gl (x,y) does not satisfy this condition (gl (0,0) = ° and gl (1.1) = 1). Thus, the function gl cannot be obtained from the function f by identifying variables.

Example 5. The same question about the function g2 (x, y) = x I y.

Solution 1. One of the ways to check whether g2 can be obtained from f by identification is to enumerate all possibilities to replace the variables from the set X = {.rl . . r2 .. c3 •. C4} by.r and y. Each identification is uniquely determined by the set A <;;; X of those variables which are replaced by x. There are 14 nonempty subsets of X. Due to the symmetry of g = x I y, the replacement of the variables from the sets A by x and the variables from X \ A by y, leads to the function g if and only if the reverse replacement does the same. Therefore, it is sufficient to check 7 variants. Among them, we find the required substitutions: XI = X2 = X, X3 = X4 = Y and .1'1 = .1'2 = 1'3 = X. 1'4 = y.

Solution 2. Let us assume that it is possible to construct the function g2 from f in the mentioned way. The equalities g2(0,D = g2(1,0) = 1 imply that there exist opposite tuples a = (al,a2,a3,a4) and j3 = (al,a2,a3,a4) such that f(a) = f(~) = 1. This means that there exists a tuple i different from (0000) and ll11 such that the function ip(Xl,X2,X3,X4) = f(xl,x2,x3,x4)&f(xl,x2,x3,x4) is not equal to 0. Any such tuple defines the required identification of variables. We have

ip(i4) = ((XI V X2 VX3)X4 VXIXZX4)' ((Xl Vxz V X3)X4 V XIXZX4) = = XIX2X4 (XI V X2 V X3) V XIX2X4 (XI V X2 V X3) = XIX2X4 V XIX2X4·

It is evident that ip (i4) is equal to 1 on the tuples (1,1,0,0), (1,1,1,0), (0,0,0.1) and (0.0.1.1) only. The tuple (1,1,0,0), for example, leads to the following identification: XI = ;1'2 = X and X3 = :1'4 = y; it yields

f (x, X, y, y) = (x V X V V) V V iiy = xV V V V xy = X V V = x I y.

Another suitable identification is defined by the tuple (1,1,1,0): XI = X2 = X3 = x

and X4 = y;

f (X,;1', X, y) = (x V x V x) V V iiy = V V xy = x V V = x I y.

1. 5.1. For the function f represented by the vector a f, construct the function g equalled to f and depending essentially on all its variables:

(1) Of(;2) = (1100); (2) 6/(;2) = (OlD1);

Page 43: Problems and Exercises in Discrete Mathematics

34 CHAPTER 1. REPRESENTATIONS OF BOOLEAN FUNCTIONS

(3) a/(i3) = (1010 1010); (4) al(i3) = (0011 1100); (5) al(F) = (0011 1100); (6) af(i3) = (0011 0011); (7) a f(xi) = (1011 1011 1101 1101); (8) a/(x<) = (0101 1I11 OlOl 1111); (9) al(x<) = (HOO HOO 0011 0011).

1.5.2. Enumerate the essential variables of the following functions: (1) f(x 3) = (Xl -t (Xl V X2» -t X3; (2) f(x2) = (Xl V X2) -t X2; (3) f(x4) = (Xl V X2 V X2 X3 V XIX2 X3)X4; (4) f(x3) = (Xl V X2 V X3)(Xl V X2 V X3)(XI V X2 V X3)(XI V X2 V X3); (5) f(x 2) = «Xl V X2) -t XIX2) ED (Xl -t X2) . (Xl -t xd; (6) f(x 2) = (Xl -t «X2 -t xt) -t Xl)) rv (Xl V X2); (7) f(x 3 ) = (Xl -t X2) ED (X2 -t X3) ED (xz -t X3); (8) f(x3) = «Xl V Xz' X3) -t (X2 -t Xl . X3» -t (Xl V X3); (9) f(x 4 ) = (Xl' (X2 V X3' X4») ED XIX2X3X4'

1.5.3. Show that Xl is an unessential variable of the function f expressing f by a formula which does not contain Xl:

(1) f(x 2 ) = (Xl ED X2)' (Xl t X2); (2) f(x2) = (Xl -t X2) V(XI I X2); (3) f(x2) = (Xl -t X2) . X2; (4) f(x3) = «(X3 -t X2) V xd' (Xl -t xt)· X3XI) ED X3; (5) f(x3 ) = «Xl VX2)(XI VX3) -t (Xl -t X2X3»X2' (6) f(x 3 ) = «Xl $ X2) -t X3)' (X3 -t X2); (7) f(£3) = «Xl V X2) -t (Xl rv X3» . Xl -t (X3 V Xl); (8) f(£4) = (Xl -t «X2 -t X3) -t X4» '" Xl' (X2 -t X3)' X4; (9) f(x4) = (Xl' Xz V X3)' (X2 V Xl' X4) -t (Xl -t (xz -t X3»'

1.5.4. Find out the unessential variables of the function f(x n ):

(1) f(i 3 ) = (1111 0000); (2) f(i 3 ) = (0011 0011); (3) J(x4 ) = (0011110000111100); (4) f(x 4 ) = (0101101000110011); (5) f(x Z) = «Xl V X2) -t Xl' X2) ED (Xl -t X2) . (X2 -t xd; (6) J(i2) = (Xl -t «X2 -t Xt} -+ X2)) rv (Xl VX2); (7) f(x3) = (Xl -t X2' X3) . (X2 -t Xl' X3) V(XI rv X2); (8) f(x 3 ) = «Xl -t Xl) ED (X2 -t X3» ED (Xl rv X2)'

1.5.5. Letthefundion f(xn) be defined by the vectoraf = (aD, aI, ... , a2n_t}. Show that if Xk is an unessential variable, ai = a2n-k+i for all i on the segment [s2n -k+1 , (2s + 1)2n - k - 1], s = 0, 2k- 1 - 1.

1.5.6. Show that if there are unessential variables among the variables of the function J(xn ), n 2:: 1, the function assumes the value 1 on an even number of tuples. Is the converse true?

Page 44: Problems and Exercises in Discrete Mathematics

1.5. ESSENTIAL AND UNESSENTIAL VARIABLES 35

1.5.7. Let the function f(x n) be such that IN,I = 2m(2l - 1). What is the maximum possible number of unessential variables of the function f?

1.5.8. Show that the statement "Xi is an essential variable of the function f(xn)" is equi valent to each of the following statements:

(1) fM';''') i- f{(i"); (2) there are variables Xi" "., xik(ij i- i, j = U) and constants 0'1, "., O'k

such that the function f~~' .. ·:;;:k Urn) depends essentially on Xi

1.5.9. Using the results of Problems 1.5.5. and 1.5.6., find the variables on which the function f depends essentially:

(1) f( iA ) = (1011100 III 001010); (2) f(i· 4 ) == (0011110011000011); (3) f(i 4) == (0111011101110111); (4) f(i 4 ) == (0101111100001010).

1.5.10. Find the values of n(n :::: 2) for which the following functions depend essentially on all their variables:

(1) f(i n) == (Xl V X2) E9 (X2 V X3) E9 ... E9 (Xn-l V Xn) E9 (Xn V Xl); (2) f(i n ) == (Xl --+ X2) (X2 --+ Xl)

E9(X2 --+ X3) (X3 --+ Xz)E9 ... E9(xn --+ Xl)(Xl --+ Xn); (3) f(i n ) == ( ... ((Xl 1 X2) 1 X3) 1 ···1 Xn)--+ (xll(X21(X31·· ·IXn) ... )); (4) f(';''') == (Xl --+ X2)(X2 --+ X3) ... (Xn-l --+ Xn)(Xn --+ xd--+ (Xl E9 X2 E9 ... E9

Xn rIc 1);

(5) f(i n ) == ( .. V . Xi I Xi2 •• .Xi1n / 21 ) & 1 S'I <'2 <'''<'In/21 sn

1.5.11. Let the function f( in) and g(fr) depend essentially on all their variables and let the variables Xl, ... , Xn, Yl, ... , Ym be pairwise different. Show that the function f(Xl, ... , Xn-l, g(Yl' ... , Ym)) depends essentially on all its variables.

1.5.12. Let pc(xn) be a set of all Boolean functions depending, and that too essentially, on the variables Xl, X2, ... , X",

(1) Enumerate all functions in pC(X2). (2) Find the number IPC(X3 )1.

(3) Show that IPc(xn)1 == f=(_ll(~)22n-k. k=O

(4) Show that lim 2-2n IPC(Xn)1 == 1. n~oo

1.5.13. Let 0, /3 and 1 be such tuples in En that 0 ::::: ~ ::::: i. Let the function f(1:n) be such that f(o) = f(i) i- f(~). Show that f(x n) depends essentially on at least two variables.

1.5.14*. Show that Xi is an essential variable of the function f if and only if this variable appears explicitly in the contracted d.n.f. of the function f.

Page 45: Problems and Exercises in Discrete Mathematics

36 CHAPTER 1. REPRESENTATIONS OF BOOLEAN FUNCTIONS

1.5.15. Show that Xi is an essential variable of the function f if and only if Xi appears explicitly in the Zhegalkin polynomial of the function f.

1 5 16 L t dfW) - 0 f t t { . . } f . bl .. . e d(x", ... , X'k' XJ) - or any non-emp y se X t ,,···, X'k 0 varIa es

different from Xj' Does f(5;n) have an unessential dependence on x/ 1.5.17. Show that any symmetric function f(5;n) other than a constant depends

essentially on all its variables.

1.5.18. Suppose that the function f(5;n) changes its value m times at the vertices of the chain ii, S1, ... , Sk-1, 1 connecting these vertices ii, 1 of the cube En, for which p(ii, 1) = k. Show that f(5;n) depends essentially on at least m variables.

1.5.19. Let f( 5;n) depend essentially on at least two variables. Show that there are three vertices ii, S, 1 of the cube En satisfying the condition

p(ii, S) = p(S, 1) = 1, ii :I 1, f(ii) = f(1) :I f(S).

1.5.20. Let f( 5;n) depend essentially on all its variables. Prove that, for any i (1 ::; i ::; n), there exists a j such that a certain substitution of constants in place of variables other than Xi and Xj leads to a function depending essentially on Xi and

Xj'

1.5.21. Show that, for any function f( 5;n) that depends essentially on n variables there exists a variable Xi and a constant 0' such that the function f~(5;n) = f(X1, ... , Xi-1, 0', Xi+l, ... , xn) depends essentially on n - 1 variables.

1.5.22. Let f(5;n) depend essentially on all its variables. Check the validity of the following statements:

(1) there exists a number i such that, for any j, there exist constants whose substitution into f( 5;n) for variables other than Xi and X J leads to a function depending essentially on Xi and Xj;

(2) for any two variables Xi and Xj, there exist constants whose substitution into f( 5;n) for variables other than Xi and X j leads to a function depending essentially on Xi and x)'

1.5.23. Enumerate the functions in P2(X2) that can be obtained by identifying the variables of the following functions:

(1) f(5;3) = (10010110); (2) f(5;3) = (11111101); (3) f(5;3) = X1X2 V X2X3 V X3X1; (4) f(5;3) = X1X2X3 ED X2X3 ED X3X1 ED X2 ED l.

1.5.24. Show that the identity operation on the function f(5;n) can lead to a constant if and only if f(O) = J(1).

1.5.25. Find the number of functions f(5;2) for which the identification of variables cannot lead to a function depending essentially on one variable.

1.5.26. Can the identity operation on the symmetric function f(5;n) lead to a function that depends essentially on all its variables and that is not symmetric?

Page 46: Problems and Exercises in Discrete Mathematics

1.5. ESSENTIAL AND UNESSENTIAL VARIABLES 37

1.5.27. Let a, ~, i be three vertices in En such that a ::; ~ ::; i, and let f(i n ) be such that f(a) = f(i) "I- f(~). Show that it is possible to identify certain variables of the function f in such a way that the function depends essentially on at least two and at most three variables.

1.5.28*. Show that for the function f(x n ), n :::: 4, represented by Zhegalkin's polynomial of power not less than 2, exist two variables whose identification decreases the number of essential variables by one.

1.5.29. Enumerate all the functions f(x 3 ) that depend essentially on three variables and in which the identification of any two leads to a function depending essentially on exactly one variable.

1.5.30. Let the function f(xn) be such that INfl > 2n-1. Show that the identification of any two variables of the function leads to a function that is not identically equal to zero.

1.5.31. Show that the number of functions f(X1, X2, ... , Xn+1) which lead to a certain function g(X1' X2, ... , Xn) as a result of identification, is asymptotically equal to (n!1)22n as n --t 00.

1.5.32. Show that if f(i: n ) depends unessential on Xi, the identification of this variable to any other variable leads to a function that depends essentially on the same variables as the function f(x n ).

1.5.33. Let n :::: 1 and let the functions J(xn) and g(xn) be such that I Nfffig I = l. Show that for any i = G, at least one of the functions f or 9 depends essentially on Xi.

1.5.34*. Let a function f(x n ) depends essentially on n variables. Let vf(a) be the number of vertices ~ for which f( a) "I- f(~) and p( a, ~) = l. Let us set v(f) = maXiiEBn vf(a). Find v(J) for the following functions f:

(1) fun) = Xl EB X2 EB ... EB Xn;

(2) f(i:k[n/kJ) = (Xl V .. · V Xk)&(Xk+1 V··· V X2k)&

... &(Xk([n/kJ-l)+l V.·· V Xk[n/kJ), 1 ::; k ::; n;

Page 47: Problems and Exercises in Discrete Mathematics

Chapter 2

Closed Classes and Completeness in Boolean Algebra

2.1 Closure Operation

A closure [J{] of a set J{ of Boolean functions is the set of all functions in P2 which are superpositions offunctions from J{. A set J{ is called closed if [J{] = K. Closed sets are also called closed classes. A subset P of functions in a closed set J{ is called complete in J{ if [P] = J{. A complete set P in a closed class J{ is called irreducible if for all proper subset pI ~ P the relation [PI] f- J{ is valid. A subset P ~ J{ is called precomplete class of closed class J{ if [P] f- J{ and for any f E J{ \ P the equality [P U {I}] = J{ holds.

Functions f and g are called congruent if one can be obtained from other by substitution of variables (without identification). For example, the functions xy and yz are congruent, but the functions xy and zz are not congruent. In the further for convenience we point out one sample of a set of congruent functions. For example, the class {x, y, . .. Xl, X2, ... } of all identity functions will be denoted by {x}.

If A is some set of Boolean functions, then by A(xn) or shortly by An will be denoted the set of all functions in A depending only on variables Xl, X2, ... ,Xn .

2.1.1. Write out all functions f(xI, X2) belonging to the closure of the set A:

(I)A=x; (2) A = {Xl EEl X2}; (3) A = {O, x}; (4) A = {XIX2}; (5) A = {XIX2 V X2X3 V x3xd; (6) A = {Xl V X2}; (7) A = {O, Xl rv X2}; (8) A = {XIX2,XI EEl X2}; (9) A = {Xl EEl X2 EEl X3}; (10) A = {XIX2 V X2X3 V X3xd; (11) A = {Xl EEl X2 EEl X3 EEl I};

38

Page 48: Problems and Exercises in Discrete Mathematics

2.l. CLOSURE OPERATION

(12) A = {XIX2}; (13) A = {XIX2 V X2X3 V x3xd; (14) A = {Xl V X2 V X3}; (15) A = {XIX2 V X3}.

2.1.2. Show that 1 E [AJ, (1) 1 = x, A = {O,x -t y}; (2) 1 = x ffi y, A = {x 1 y}; (3) 1 = x, A = {xffiY}; (4) 1 = xffiyffiz, A = {x rv y}; (5) 1 = 0, A = {xy ffi z}; (6) 1 = x, A = {xy}; (7) 1 = x V y, A = {x V y}; (8) 1 = x, A = {xy Vyz V zx}; (9) 1 = xy, A = {xy EBz}; (10) 1 = xyz V t(x V y V z), A = {xy V yz V zx}; (11) 1 = x ffi y ffi z, A = {i,xy Vyz V zx}; (12*) 1 = x EB y EB z, A = {xy V yz V zx}; (13) 1 = xEBy, A = {xy,xV y}; (14) 1 = x V y, A = {x -t y}; (15) 1 = xy, A = {x V y, x EB y}.

39

2.1.3. Write out all pairwise non-congruent functions 1(553 ) in the closure of the set A:

(1) A = {I, x}; (2) A = {xy}; (3)A={xrvy}; (4) A = {xyVyzV zx}; (5) A = {x ffi y ffi z ffi I}; (6)A={xvyVz}; (7)A={x-ty}; (8) A = {xy V z}; (9) A = {xy}; (10) A = {(x V y)(y V z)(z V x)}.

2.1.4. Extract the basis from the complete for the class [A] set. (1) A = {O, l,x}; (2) A = {x EB y,x rv y, I}; (3) A = {x, x ffi y, x ffi y ffi z}; (4) A = {xy,x Vy,xy V z}; (5)A={xVy,x-ty}; (6) A = {xy, xy }; (7) A = {x EB y EB z,xy V yz V zx,x}; (8) A = {l,x rv y,x EB y EB z EB I}; (9) A = {xy, xy V xz};

Page 49: Problems and Exercises in Discrete Mathematics

40 CHAPTER 2. CLOSED CLASSES AND COMPLETENESS

(10) A = {X,X Vy,x Vy V z,xy V z}.

2.1.5. Find out which of the below sets are closed classes: (1) the set of all functions of one variable; (2) the set of all functions of two variables; (3) the set of all functions f( Xl, X2, ... ,xn ) such that f(l, 1, ... ,1) = 1, n;::: 0; (4) the set of all functions f(Xt,X2, ... xn) such that f(l, 1, ... ,1) = 0, n;::: 0; (5) the set of all symmetric functions, i.e. the functions f(XI,X2, ... ,Xn )

such that for any permutation (.1 ~ ... ~) the equality f(xt, X2, ... , xn) = Zl Z2 ••• Zn

f( Xi" Xi2' ... , Xi n ) holds; (6) the set of all functions f(xn) such that INfl = 2n - l ;

(7) the set of all functions having a Zhegalkin's polynomial of degree not exceeding 1;

(8) the set of all functions having a Zhegalkin's polynomial of degree not exceeding 2;

(9) the set of all functions having a d.n.f. without negations of variables; (10) the set of all functions f(x n ) whose arbitrary d.n.f. contains at least one

negation of variable; (11) the set of all functions f(xn) whose Zhegalkin's polynomial contains 2n - 1

addends; (12) the set of all functions f(xn) whose Zhegalkin's polynomial contains 2n - 1

addends and does not contain 1 as addend; (13) the set of all functions f(x n ), such that INfl = 1 n ;::: 1; (14) the set of all functions f(x n ), such that INfl = 1 and f(l, 1, ... ,1) = 0

n?:1.

2.1.6. Prove that (1) an intersection of two closed classes is a closed class; (2) generally speaking an union of two closed classes is not a closed class; (3) generally speaking a difference of two closed classes is not a closed class; (4) generally speaking a complement a non-empty closed class different from P2

is not a closed class.

2.1. 7. Prove that a class A which is precomplete in some closed class is closed.

2.1.8. Verify the following closure operation properties: (1) [[KJ] = [KJ; (2) if KI ~ K 2 , [KIJ ~ [K2J; (3) [KI n K2J ~ [KIJ n [K2J; (4) [KIJ U [K2J ~ [KI U K2J; (5) [0J = 0.

2.1.9. Find out whether a set A ~ P2 is a closed class. It is assumed that together with a function f E A all functions congruent to f are in A:

Page 50: Problems and Exercises in Discrete Mathematics

2.1. CLOSURE OPERATION

(1) A = {a, I}; (2) A = {x}; (3) A = {x, x}; (4) A = {1,x}; (5) A = {Xl· ... · Xn,n = 1,2, ... }; (6) A = {XI EB ... EB Xn,n = 1,2, ... }; (7) A = {O,XI V ... V Xn,n = 1,2, ... }; (8) A = {XI EB ... EB X2n-l,n = 1,2, ... }; (9) A = {O,XI EB ... EB X2n-l,n = 1,2, ... }; (10) A = {O,I,xI EB ... EBxn EBO',O' E {O,I},n = 1,2 ... }.

41

2.1.10. (1) Enumerate all closed classes K ~ P2 which contain only a finite number of pairwise non-equal functions;

(2) Enumerate all closed classes K ~ P2 which contain only a finite number of pairwise non-congruent functions;

(3) Point out a set A ~ P2 such that for any n 2: 1 the number of functions in [A] essentially depending on XI, ... ,Xn is equal to

(a) 1; (b) 2.

2.1.11. (1) Prove that if closed class in P2 contains a function depending essentially on n 2: 2 variables, it contains an infinitely large number of pairwise non-congruent functions.

(2) Is it true that if a closed class in P2 contains a function essentially depending 011 11 2: 2 variables then for any m 2: n it contains a function essentially depending on m variables?

2.1.12. Through reduction to a priori complete set in P2 , show that the set A is complete in P2 if:

(l)A={xlY}; (2) A = {.ry +:::, (x'" y) ffi z}; (3) A = {x -+ y,xEByEBz}; (-i) A = {x -+ y, 1 = (0101Ill0)}; (5) A = {0,m(:i;3) = XIX2 V X2X3 V X3Xl,X EB y EB I}; (6) A = {x '" y, X EB y, xy EB z}; (7) A = {xy V xz, 1 = (01l1l1l0)}; (8) A = {xy ffi zt ffi 1,1 = (10ll0ll0)}; (9) A = {O,I,xEByEBz,xYffizxEBzy}; ( 10) A = {ip V z, x EB y}.

2.1.13. Which of the relations C,::::l,=, <) is satisfied for the sets K 1,1<2 in P2 (the relation <) means that none of the relations ~,:2,= is satisfied)?

(1) KI = [AI n A2],1<2 = [Ad u [A2]; (2) 1\1 = [AI \ A2], K2 = [AI] \ [A2]; (:3) 1\1 = [AI U (A2 n A3)],I<2 = [AI U A2] n [AI U A2]; (-i) KJ = [AI \ A2], K2 = [AI] \ [AI n A2]'

Page 51: Problems and Exercises in Discrete Mathematics

42 CHAPTER 2. CLOSED CLASSES AND COMPLETENESS

2.1.14. Point out the examples of the closed classes J{l ~ J{2 ~ P2 such that:

(1) J{l n J{2 = 0, J{2 \ J{l i- 0, [J{l U J{2] = J{l U J{2;

(2) J{2 n J{2 i- 0, J{2 \ J{l i- 0, [J{l U J{2] = J{l U J{2;

(3) J{l :::> J{2, [J{l \ J{2] = J{l \ J{2;

(4) J{l n J{2 i- 0, J{2 \ J{l i- 0, [J{l \ J{2] = J{l \ J{2;

(5) J{l n J{2 i- 0, J{2 \ J{l i- 0, [J{l ill J{2] = J{l ill J{2.

2.1.15. Enumerate all precomplete classes of the closed class J{:

(1) 1\ = [0, x]; (2) 1\ = [0,1]; (3) J{ = [xy]; (4) J{ = [x ill y];

(5) J{ = [O,x V y]; (6) 1\ = [I, xy]; (7) 1\ = [x ill y ill z]; (8) J{ = [x ill y, 1].

2.1.16. Prove that for each closed class J{ ~ P2 the equality [J{U {x}] = 1\ U {x} holds.

2.1.17. Prove that each precomplete class in P2 contains an identity function.

2.1.18. Prove that each closed class in P2 containing a function different from a constant contains an identity function.

2.1.19. Prove that the set P2 of all Boolean functions can not be represented by union of non-empty pairwise non-intersected closed classes.

2.1.20. Prove that if a closed class in P2 has a finite basis, then each basis of this class is finite.

2.1.21. Prove that a non-empty closed class in P2 different from the sets {O}, {I} and {O, I} can not be extended up to a basis in P2 .

2.1.22. Prove that a closed class [x -t y] contains only functions in P2 which can be represented (within the notation of the variables) in the form Xi V J(:rn), where f(:rn) E P2 .

2.1.23. Let the function J(:rn) belong to the closed class [x -t y], and depend essentially on at least two variables. Prove that INfl > 2n - 1 .

Page 52: Problems and Exercises in Discrete Mathematics

2.2. SELF-DUAL FUNCTIONS 43

2.2 Self-Dual Functions

A Boolean function f( Xl, X2, ... ,xn ) is called self-dual if

or, that is the same, if

From the definition it follows that a function is self-dual if and only if for any two opposite tuples it takes different values. The class of all self-dual Boolean functions will be denoted by S. From the definition it follows that ISnl = 22n-'. The following statement is known as

Lemma on a non-self-dual function. If a function f is not self-dual, then somf constant can be obtained by replacing the variables of the function f by X and .1'.

For an arbitrary A <,;; P2, denote by A* the set of all functions f such that there exists a function g in A for which the equality f = g* holds. The set A* is called dual to A. If A * = A, then the set A is called self-dual.

Example 1. Find out whether the function represented by the vector a =

(1011 0010) is self-dual. Solution. From the definition it follows that a value vector of a self-dual function

fun) is of the form:

Hence we have to check whether the second half of the vector a can be obtained from the first one by reflecting with subsequent setting negations on coordinates. In our case, the answer is "yes".

Example 2. The same question on the function represented by the vector ci = (1011 0100).

Answer. "No", because, for instance, f(OOl) = f(110) = O.

Example 3. For which n is the function

f = A (Xi, V Xi2 .•. V Xijn/2j) l:'Oi, <i2 < ... <ijn/2[:'On

self-dual? Solution. Note that the set N f of tuples such that f( a) = 0 consists of all tuples

of weight no more than [n/2]. If n is even, then B~/2 <,;; Nf . Let ci be an arbitrary

tuple in B~/2' The opposite tuple is also in B~/2' Therefore, f(a) = f(a) = O. We arrive at a contradiction for the definition of a self-dual function. Hence, the fUIlction f is not self-dual as n is even.

Page 53: Problems and Exercises in Discrete Mathematics

44 CHAPTER 2. CLOSED CLASSES AND COMPLETENESS

Now let n be odd. Then NJ = UI:"02J By. Obviously, & E NJ if and only if & E N f . This means that 1 is self-dual as n is odd.

Example 4. Which of the variables of the nonself-dual function I( in) represented by its value vector & = (01101101) ought to be replaced by x and which ought to be replaced by x to get a constant?

Solution. As 1 1: S, there exists a pair of opposite tuples on which the function takes the same values. In our case, 1(010) = 1(101) = 1. Let us replace Xl and X3

by X and X2 by x. We get that I(x,x,x) = I(x,x,x) = 1.

2.2.1. Find out whether the function 1 is self-dual: (1) 1 = XIX2 V X2X3 V X3XI;

(2) f = Xl V X2;

(3) 1 = Xl EEl X2 EEl X3 EEl 1; (4) 1 = (x V fj V z)t V xfjz; (5) 1 = (x V fj V z)t V xyz; (6) f = Xl -+ X2;

(7) 1 = Xl EEl X2;

(8) 1 = XIX2 EEl X2X3 EEl X3 X I EEl X2 EEl X3;

(9) 1 = XIX2 V X3;

(10) 1 = Xl EEl X2 EEl (XIX2 V X2X3 V X3 X I);

(11) 1 = XIX2 EEl X3(XI V X2);

(12) 1 = XIX2 X 3 EEl XIX2 EEl X2 X 3 EEl X3 X I;

(13) 1 = XIX2 X 3 EEl XIX2 X3 EEl X2 X 3 EEl XIX3;

(14) 1 = (Xl -+ X2) EEl (X2 -+ X3) EEl (X3 -+ Xl) EEl X3;

(15) 1 = (Xl -+ X2) EEl (X2 -+ X3) EEl (X3 -+ Xl)'

2.2.2. Find out whether the function 1 represented by the vector &f is self-dual: (1) &f = (1010); (2) &f = (1001); (3) of = (10010110); (4) Of = (01100110); (5) Of = (01110001); (6) Of = (01001101); (7) Of = (1100 1001 0110 1100); (8) Of = (1110011100011000); (9) Of = (1000001110001100); (10) Of = (1001101110111001); (11) Of = (110000111010 0101); (12) Of = (11000011 00111100); (13) Of = (10010110 1001 0110); (14) Of = (110101001011 0010); (15) &f = (1010 010101011010).

2.2.3. Replace the hyphens in the vector & to obtain a value vector of some completely defined self-dual function:

Page 54: Problems and Exercises in Discrete Mathematics

2.2. SELF-DUAL FUNCTIONS

(1)0=(1-0-); (2) 0 = (-01-); (3) 0 = (01 - -); (4) 0 = (01-0-0- -); (5) 0 = (- - 01 - -11); (6) 0 = (-1 - 1 - 0 - 1); (7) 0 = (-10 - 0 - -1); (8) 0 = (1001 - - - -1111 - - - -); (9) 0 = (11- -00 - -01- -10 - -); (10) 0 = ( - - - - - - 01 - -1011 00).

45

2.2.4. Substituting x and x instead of the variables of the function f represented by its value vector OJ, obtain a constant:

(1) Of = (10110110); (2) Of = (11011000); (3) Of = (10100100); (4) Of = (10101000); (5) Of = (11001110); (6) Of = (1000 1101 0010 1100); (7) Of = (1001 0110 10011010); (8) Of = (011100010011 0001); (9) Of = (0110 1000 1110 1011); (10) Of = (1010 0101010100110); (ll ) of = (1010 ll10 1100 1010); (12) Of = (OllOOOOl); (1:3) Of = (1011 0100 1111 0010); (14) Of = (00001111 0010 1111); (15) Of = (1110100001101000).

2.2.5. Let m(x,y,z) = xy Vyz V zx. Prove the following equivalences: (1) m(m(i,y,z),m(x,y,z),m(x,y,E)) = m(m(x,y,z),m(x,y,z),m(x,y,E)). (2) .1' if y Efl z = m(m(x, y, z), m(x, y, z), E); (3) m(m(x, y, z), m(x, y, z), m(x, y, E)) = m(x, m(x, y, E), m(x, y, z)); (4) xEDyEElz = m(m(x,y,z),m(x,y,z),m(x,y,z)); (5) m(x, y, z) = m(x, y, z); (6) m(x,y,z)=xyEByzEflzx; (7) m(x,y,z) = m(x,m(x,y,z),z); (8) xyz V t(x V y V z) = m(x, m(y, z, i), i); (9) xyzvt(xVyVz)=m(m(x,y,t),m(x,z,i),m(y,z,i)); (10) xyz V i(x V Y V z) = m(x EEl y EEl z, m(x, y, z), i).

2.2.6. Prove that if f(j;n) is a self-dual function, then INfl = 2n-1.

2.2.7. Show that there are no self-dual functions depending essentially on two variables.

2.2.8. Determine the values n ~ 2 for which the function f(j;n) self-dual:

(1) f(i n ) = Xl Efl X2 ED ..• EEl Xn;

Page 55: Problems and Exercises in Discrete Mathematics

46 CHAPTER 2. CLOSED CLASSES AND COMPLETENESS

(2) f(x n ) = V XiX); l:::i<)<on

(3) f(x n) = .. V . Xi 1 Xi2 ... Xiln/2[; 1 <0'1 <'2 <'''<'In!2[:::n

(4) f(x n) = E9 XiXj; l:::i<j<on

(5) f(x n) = (Xl V X2) Efl (X2 V X3) Efl ... Efl (Xn-l V Xn) Efl (Xn V xJ); (6) f(xn) = (Xl V X2 V X3) Efl (X4 V X5 V X6) Efl·.· Efl (X n-2 V Xn-l V Xn), n = 3k; (7) f(xn) = m(Xl, X2, X3) EB m(X4, X5, X6) Efl .,. EB m(X,,_2, Xn-I, .Tn), n = 3k; (8) f(x n) = (XI -+ X2)(X2 -+ X3) ... (Xn-I -+ Xn)(Xn -+ xIl; (9) f(x n) = (Xl -+ X2) EB (X2 -+ X3) EB ... EB (Xn-l -+ Xn) Efl (X n -+ XI) EB Xl Efl X2 EB

... EB Xn; (10) f(x n) = V XiIXi2" .Xik , 1::::: k::::: n.

l<Oi l <i2< ... <ik :::n

2.2.9. Enumerate all self-dual functions that depend essentially on the variables

XI,X2,.T3. Show that each of these functions can be presented in the form xrxg V x;'xj V xgxj or Xl Efl X2 Efl X3 Efl u, where o,/3",u belong to the set {O, I}.

2.2.10. Prove that the function f( xn) is self-dual if and only if its Xl-component

fl(i:") is dual to its xI-component fJ(x n).

2.2.11. Let a function f(x n) be such that f*(0,X2, ... ,Xn) = f(1,X2, .. "Xn), Is it true that f*(XI, X2, ... , I) = f(XI, X2, ... , OJ?

2.2.12. Let a function f(x-n) be represented in the form f(xn) = .Tny(in- I ) V Xny*(in-l), where the function y is such that y(xn- I) V y*(in-l) = y(xn- I ). Prove

that f E S. 2.2.13. Prove that the function f = ylj! EB x(y Efl lj!) is self-dual if y and lj! are

self-dual.

2.2.14. Using the Lemma on a nonself-dual function, prove that S is a precomplete class.

2.2.15. Is it true that the number of self-dual functions depending essentially on the variables Xl, X2, ... , Xn, equals the number of functions in P2( X n- l ) depending essentially on all of its variables?

2.2.16. Let a function f(i n ) essentially depend on XI and each of the components Jl(i") and fJ(i n) is self-dual. Show that f(i n) is not self-dual.

2.2.17. Prove the following relation:

EBf(m(xI, X2, X3), X2, m(x1' X2, X3), X4,"" Xn)

Eflf(m(Xh X2, X3), m(XI, X2, X3), X3, X4, ... , Xn).

2.2.18. Using the previous problem, prove that:

(1) 5 = [{Xl EflX2 Eflx3,m(XhX2,X3),X}]; (2) 5 = [{m(XI,X2,X3)}]; (3) 5 = [{m(XI,X2,X3)}];

Page 56: Problems and Exercises in Discrete Mathematics

2.3. LINEAR FUNCTIONS

2.2.19. Is the set A self-dual in the following cases: (1) A = {O, l,x}; (2) A = {O,x}; (3) A = {x EB y,x rv y,x EBy EB z}; (4)A={x-ty,xVy}; (5) A = {x -t y,xy}; 6) A = {xy,x V y,m(x,y,z)}; 7) A = {x EByEBz,x}; 8) A = [{x -t y}]; 9) A = [{m(x,y,z)}]; 10) A = [{I,x EB y}]; 11) A = [{l,x EB y,xy}]; 12) A = [{I,xy}]; 13)A=[{xVy,xEBy}]; 14)A=[{xEBY}]; 15) A = [{xy EB z EB I}].

2.3 Linear Functions

47

A function I(xn) is called linear if it can be represented by Zhegalkin's polynomial of degree 1, i.e. there exist the constants O:j E {O, I}, i = 0, 1, ... , n, such that

(1)

The set of all linear functions will be denoted by L. The set of all linear functions depending on the variables Xl, X2, ••• ,Xn will be denoted by Ln. From (1) it follows that IL"I = 2n+1. The following statement is valid.

Lemma (on a non-linear function). If 1 1:. L, then the functions xy or xy can be obtained by replacing its variables to 0, 1, x, y, x, y.

Example 1. Find out whether the function 1 represented by the vector o.J = (1001011010010110) is linear.

Solution. Construct the coefficient vector S = S(PJ) of Zhegalkin's polynomial PJ' We have S = (1110100000000000). The vector ~ defines the polynomial PJ = 1 EB X4 EB X3 EB X2. This is a polynomial of degree 1. Hence, 1 is linear.

Note that in the vector S only the coordinates with numbers equal to zero or degrees of 2 are not equal to O. This is a criterion of the linearity of Boolean func­tions.

Example 2. Replace the hyphens in the vector a = (-110 - - - 0) so that the binary vector obtained as a result is a value vector of some linear function. Construct the polynomial for f.

Solution. We use the following statement (the corollary of Problem 2.3.6): if a linear function 1 depends essentially on the variable Xj then on any two tuples differing only in i-th coordinates, 1 takes different values.

Comparing the values of the coordinates 0:1 and 0:3, 0:2 and 0:3 in the vector a, we find out that the function 1 essentially depends on X2 and X3 (as 1(001) i- 1(011) and 1(010) i- 1(011)). Therefore, by linearity we have 0:0 = 0 and 0:5 = 0:6 = 1. The value 0:4 = 0 because if 0:4 = 1, then due to 0:0 = 0, the function 1 would

Page 57: Problems and Exercises in Discrete Mathematics

48 CHAPTER 2. CLOSED CLASSES AND COMPLETENESS

essential depend on Xl. In this case, by linearity we would have 1(011) f:. 1(111). This contradicts the fact that 1(011) = 1(111) = 0 (since 03 = 07 = 0 in 0). Thus, we have of = (01100110) and 1 = X2 EEl X3·

Example 3. Obtain the function X Vy by replacing the variables of the function 1 with the value vector 0 = (1000000000001010) to the functions 0, 1, x, y, x, y.

Solution. The function X V Y takes 1 in three tuples. Note that the function 1 also takes 1 in three tuples (0000), (1100), and (1110). All these tuples have 0 in the fourth coordinate and, besides, the first coordinate of each tuple coincides with the second one. Put X4 = 0, Xl = X2 = X, X3 = y. We have l(x,x,y,O) = X V y. To obtain the required function, it remains to replace y by y. Thus, we have

l(x, x, y, 0) = x V y.

2.3.1. Expanding the function 1 into the Zhegalkin polynomial, find out whether it is linear:

(1) 1 = x --+ y; (2) 1 = X --+ Y EEl xy; (3) 1 = xy(x '" y); (4) 1 = xyV xyV z; (5) 1 = (xy V xy)z V z(xy V xy); (6) 1 = ((x --+ y)(y --+ x)) '" z; (7) 1 = xyz V xy; (8) 1 = xyz EEl xyz EEl xy; (9) 1 = m(x, y, z) EEl xyz EEl xyz;

(10) 1 = (x V yz) EEl xyz; (11) 1 = (x V yz) EEl xyz; (12) 1 = (xyz V xyz) EEl x(y EEl z); (13) 1 = (xyz EEl x(yz) EEl x(y V z); (14) 1 = (xyz EEl zxy) V (xyz EEl xyz); (15) 1 = (xyz '" xyz) '" (xyz '" xyz).

2.3.2. Find out if the function 1 is linear: (1) Of = (1001); (2) of = (1101); (3) Of = (10010110); (4) Of = (11000011); (5) Of = (1010 0101); (6) Of = (1010 0110); (7) Of = (1100 1001 0110 1001); (8) of = (0110 1001); (9) Of = (1001 011001101001);

(10) Of = (0110100101101001); (11 ) of = (10100101 1001 1100); (12) Of = (1010 01010101 1010);

Page 58: Problems and Exercises in Discrete Mathematics

2.3. LINEAR FUNCTIONS

(13) iif = (1010011001100101); (14) iif = (0011 1100 11000011); (15) iif = (10011001 01100110).

49

2.3.3. Replace the hyphens in the vector ii = (-110 - - - 0) so that the binary vector obtained as a result, is a value vector of some linear function. Construct the polynomial for J.

(1) ii = (10 - 1); (2) ii = (0 - 11); ( 3) ii = (100 - 0 - - - ); (4) ii = (-001 - -1-); (5) ii = (1-101- --); (6) ii = (-0 - 1 - -00); (7) ii = (11 - 0 - - - 1); (8) ii = (1 - -11 - 0-); (9)0=(--10 ----0--1 -110);

(10) ii = (1 - - - - - - - - - -0 - 110); (11)ii=(-11-1---1--- ---0); (12) ii = (- - -0 - 00 - 1 - 1 - - - --); (13) ii = (-100 - - - 1 - 1 - - - - - -); (14)ii=(---1-11- -11-1-0-); ( 1.5) ii = ( -1 - - - - - - 00 - 1 - 1 - -).

2.3.4. Obtain some of the functions xy, xjj, xjj by replacing the variables of the function f to the functions 0, 1, x, y.

(1) f(x 3 ) = XIX2 V X2X3 V X3XI;

(2) ii f = (01100111); (3) iif = (1101 0101); (4) ii f = (11001110); (.5) ii f = (1101 1111 11001111); (6) ii f = (011111111110 1110); (7) ii f = (1111 0101 111111011); (8) ii f = (0111101111111110); (9) ii f = (1001 0111 11111010); (10) iif = (1101 1001 10010111); (11) f = (Xl V X2 V X3)(XI V X2 V X3 V X4);

(12) f = (Xl V X2 V X3 V X4)(XI V X2 V X3 V X4)(X2 V X3);

(13) f = XIX2X3X4 V XIX2X3X4 V XIX2X3X4 V XIX2X3X4 V XIX2X4 V X2X3X4 V XIX2X3;

(14) ii f = (1100111111111110); (15) &.f = (10111110 1011 0111).

2.3.5. Can the function f lead to xy if the functions O,l,x,y,x,jj are sllbstituted for its variables?

(1) f = Xl -+ X2;

(2) iif = (11101000);

Page 59: Problems and Exercises in Discrete Mathematics

50 CHAPTER 2.

(3) o.f = (10010110); (4) o.f = (11011011); (5) o.f = (1001 0111); (6) o.f = (11010110); (7) f = Xl --+ (X2 --+ X3);

CLOSED CLASSES AND COMPLETENESS

(8) f = (XIX2 V XIX2X3) EB XIX2X3; (9) f = XIX2 V X2X3 V X3XI;

(10) o.f = (10011010); (11) o.f = (1001011001101001); 12) o.f = (1110100110010111); (13) o.f = (1101111001101011); (14) o.f = (11000011 00111100); (15) 0. f = (01111011 1111 1100).

2.3.6. (1) Let a function f(x n) be represented in the form f = Xn EB cp (xn- l ). Prove that, for any two tuples differing only in the n-th coordinate, the function f takes opposite values.

(2) Prove the converse, i.e. that if a function f(x n ) takes the opposite values for any two tuples differing only in the n-th coordinate, then it can be represented in the form f = Xn EB cp (xn- l ).

(3) Prove that a function f(xn) taking the opposite values for any two tuples differing only in one coordinate is linear.

2.3.7. (1) Let a function f(xn ) be represented in the form f = Xn EB cp(xn- l ).

Prove that INfl = 2n - l .

(2) Prove that if a function f(x n ) is linear and essentially depends on all its variables, then INfl = 2n - l .

2.3.8. Prove that the function f(x n ), depending essentially on all its variables, is linear if and only if the substitution of any subset of constants for any subset of variables leads to a function that depends essentially on all the remaining variables.

2.3.9. Prove that a linear function is self-dual if and only if it depends essentially on an odd number of variables.

2.3.10. Find the number of the linear functions essentially depending exactly on k variables from the set {Xl, X2, ... ,xn}.

2.3.11. Find the number of the linear functions f(x n) such that f(OO ... O) = f(11 ... 1)=1.

2.3.12. Let f(XI,X2,0, ... ,0) = Xl --+ X2. Prove that f fI. L.

2.3.13. A function f(xn) depends essentially on all its variables, f(xl, 0, ... ,0) =I­f(XI, 1, ... ,1), and n is odd. Prove that f fI. L.

Page 60: Problems and Exercises in Discrete Mathematics

2.3. LINEAR FUNCTIONS 51

2.3.14. A function f(i n ) is not linear. Prove that it is possible to obtain a nonlinear function depending on two variables by replacing some n - 2 variables of f by constants.

2.3.15. A quadruple of tuples a, ~, -)" 8 in Bn will be called special if the set of coordinates can be divided into two subsets A = {ill i2 , • •• , id and B = {jl,i2, ... ,jn-d, provided that

k

1 < L Jiv < k, 8iv = 1'iv , V = 1,2, ... , k. 1/=1

Prove that a function f( in) is not linear if and only if there exists a special quadruple such that the function f takes 1 on odd tuples from the quadruple.

2.3.16. Prove that if a function f(fi;n) is not linear and IN!I = 2n - l , then both a conjunction and disjunction can be obtained from f by replacing its variables by 0, 1, x, y, x, y.

2.3.17. Show that, by identifying the variables in the nonlinear function f(fi;n), n ~ 4, a nonlinear function depending on no more than three variables can be obtained.

2.3.18. Prove that the system A is complete in L. Find out whether A is a basis in L:

(I)A={1,xIEBx2}j (2) A = {O,XI ~ xd (3) A = {a, 1, Xl EB X2 EB X3}; (4) A = {x EB 1,XI EB xd; (5) A = {Xl EBX2,XI ~ X2}; (6) A= {XIEBX287x3,x871,0}; (7) A = {Xl E& X2 EEl X3 EEl 1, Xl ~ X2}; (8) A = {Xl EB X2 EB X3 EB X4, X EB 1}; (9) A = {Xl EB X2 EB X3 EB 1,0};

(10) A = L n P2(X2); (11) A = (L n S) U {OJ; (12) A = L \ S; (13) A = {Xl 8:J X2, Xl ttl X2 EEl X3 E& 1, I}; (14) A = {XIX2 V Xd2'X EB I}; (15) A = (L \ S) n P2(X 2 ).

2.3.19. Prove that [fJ f- L for any f E L.

2.3.20. Prove that L n S = [x EB y EEl z EB 1 J.

Page 61: Problems and Exercises in Discrete Mathematics

52 CHAPTER 2. CLOSED CLASSES AND COMPLETENESS

2.3.21. Prove that the system A = {x,iI, 12, h}, where iI, 12, h are pairwise different functions depending essentially on Xl, X2, is complete in P2.

2.3.22. Let Q = {O, X, fl, f2, fa}, where iI, 12, h are pairwise different functions depending essentially on variables Xl, X2, ... , Xn (n > 1). Prove that the system Q is complete in P2 •

2.3.23. Prove that from a polynomial of degree 3 depending on three variables, a function of the type xy ffi l(x, y), where l(x, y) is a linear function, can be obtained by identification of variables.

2.3.24. Prove that from an arbitrary nonlinear function a function of the type xyffil(x, y)orxYffiyzffizxffil(x, y, z)}, where l(x, y) and l(x, y, z)arearbitrary linear functions, can be obtained by identification of variables.

2.4 Functions Preserving the Constants

A function f(i;n) preserves the constant 0 (the constant 1) if f(OO ... O) = 0 (respectively, f(l1 .. . 1) = 1). The set of all functions preserving the constant (1, (1 E {O, I}, is denoted by T". The set of all functions in T" depending on variables Xl, X2, ... , Xn is denoted by T;:. The set T" is a precomplete class in P2.

Example 1. Find out for which n the function f( i;n) = EBi':-12 m( Xi, Xi+!, Xi+2) belongs to the set To n TI , n > 2.

Solution. If n is odd, then f is a superposition of the functions m( Xl> X2, X3) and Xl ffi X2 ffi X3 belonging to the closed class To n TI . Hence, it also belongs to To n TI . If n is even, then f(l, 1, ... ,1) = O. Thus, f 1. To n TI .

Example 2. Find the number of functions f(i;n) in A = (L \ To) n S.

Solution. A = (L \ (To n L)) n S = (L n S) \ (L n To n S). Hence, IAI = IL n S)I - IL n To n SI. A linear function is self-dual if and only if it depends essentially on an odd number of variables, i.e. it can be represented in the form f = XiI ffiXi2 ... ffiXi2'tI ffi(1, (1 E {O, I}. The number of linear functions depending

essentially on k variables is equal to 2 (~) ((~) ways of choosing k variables and two ways of choosing a constant term). Thus,

Ie n sn I = 2 L (n) = 2n. O::;.::;(n-I)/2 2s + 1

It is clear that ILn n sn n Tol = ~ ILn n snl because a constant term is determined uniquely and equal to O. Finally, we have IAI = 2n - l .

Example 3. Prove that [{ xy, X ffi Y } 1 = To·

Page 62: Problems and Exercises in Discrete Mathematics

2.4. FUNCTIONS PRESERVING THE CONSTANTS 53

Solution. Note that, a polynomial of an arbitrary function f in To does not contain 1 as an addend. But an arbitrary polynomial can be obtained by the superposition of functions xy and x EB y.

2.4.1. Find out whether the function f(in) belongs to the set Tl \ To: (1) f = (Xl ---) X2)(X2 ---) X3)(X3 ---) Xl); (2) f = m(xI, X2, X3); (3) f = Xl ---) (X2 ---) (X3 ---) Xl)); (4) f = XlX2X3 V XlX2 V X2; (5) f = (Xl V X2)X3 V XlX2 V X2; (6) f = XlX2h V XlX2 V X2 V XlX2X3; (7) o.f = (1001 0110); 8) o.f = (11011001); (9) o.f = (10000111); 10) o.f = (00011011).

2.4.2. Find out for which values of n :::: 3 the function f(in) belongs to the set

To \ Tl :

A:

(l)f(xn) = Xl ttl X2 EB ... EB Xn;

(2)f(xn) = C~: XiXiH) EB XnXl;

(3)f(xn) = EB XiXj; l$i<j$n

(4)f(xn) = EB (Xi V Xj); l$i<j$n

(5)f(xn) = 1 ttl (Xl ---) .T2)(X2 ---) X3)(X3 ---) X4)'" (Xn-l ---) Xn)(Xn ---) Xl); n-2

(6)f(i") = EB (Xi ---) (Xi+l ---) Xi+2)); i=l n-2

(7)f(i n ) = EB ((Xi ---) XiH) ---) Xi+2); i=l n-2

(8)f(xn) = EB (Xi EB XiH Xi+2); i=l

(9)f(in) = EB XiXjXk; l$i<J<k$n

(lO)f(in) = EB m(Xi,Xj,Xk); l$i<J<k$n

(ll)f(xn) = EB 'Pi(in),'Pi E S n Tl ; i=l

(12)f(xn) = Xn C~~ 'Pi(Xn- l )) V in C~ 'PHin- l )) ,

(13)f(i") = Xn C~~ 'Pi(i;n-l)) ffi :6~ 'Pi(i;n-l), n

(14)f(i n ) = V 'Pi(i n ), 'Pi E (L n To) \ S; i=l

(15)f(xn) = A 'Pi(i n), 'Pi E S \ Tl· i=l

2.4.3. Compute the number of functions depending on Xl, X2, ... , Xn in the set

(l) A = To n Tl ;

(3) A = To n L; (2) A = To UTI;

(4) A = Tl n S;

Page 63: Problems and Exercises in Discrete Mathematics

54 CHAPTER 2. CLOSED CLASSES AND COMPLETENESS

(5) A = To U L; (6) A = L \ TI; (7) A = (L UTI) n S; (8) A = L n TI n S; (9) A = L uS U To; (10) A = (L US) \ TI ;

(11)A=(L\To)nS; (12)A=SnTo; (13) A = (S n To) U TI; (14) A = (S n L) \ TI; (15) A = (To \ Td n S; (16) A = (To \ TI) n L;

2.4.4. Prove that: (1) L n S n To = L n S n Tl = L n To n TI = L n S n To n TI; (2) S n To = S n TI = S n To n TI.

2.4.5. Prove that: (1) [{ x V y, x EB y }] = To; ( 2) [{ x V y, x '" y }] = TI ;

( 3) [{ x y , x '" y}] = T1 :

(4) [{xy EB z}] = To; (5) [{ xy, x EB y EB z }] = To n TI; (6) [{xy EB z EB t}] = To n TI; (7) [{x EB y}] = L n To; (8) [{x'" y}] = L n TI ;

(9) [{x.f\yEBz}] = LnSnTo; (10*) [{m(x, y, .:), x t1l y t1l z}] = To n S; ( 11 *) [{ m ( x, y, z )}] = TI n S; (12) [{x EB y EB z EB I}] = L n S; (13) [{xy,m(x,y,z)}] = To n TI; (14) [{ x V y, m (x, y, z)}] = To n TJ ;

(1.5) [{m(x. y, z),x EB y}] = To.

2.4.6. Find out whether the set A is a basis in the class ]{: (1) A = {xy '" z}, ]{ = TI ;

(2) A = {xy V z}, ]{ = To; (3)A={xy,x",y,xVy}, ]{=TI; (4) A = {x EB y EB z, m(x, y, z)}'/{ = To n TI; (5) A = {xy,.r EB y EB z, m( x, y, z )}, ]{ = To n TI; (6*) {A = xy,m(x,y,z)}, ]{ = To n TI; (7) A = {x EB y,m(x,y,z)},]{ = To n TI; (8) A = {x V y,xy}, ]{ = To; (9) A = {x EB y EB z, OJ, ]{ = To n L;

(10) A = {x EB y EB z,x EB y EEl z EEl t}, ]{ = To n L; ( 11) A = {xy + y til z, x EB y EEl z}, ]{ = To n T1 ;

( 12) A = {m ( x , y, z ) , x ffi y ttl z}, J{ = To n S; (13) A = {(x'" y) '" z}, ]{ = L n S n To; (14) A = {x'" m(y, z, tn, ]{ = T1 ;

(15) A = {xy,x EB y EB z,x V y}, K = To n TI.

Page 64: Problems and Exercises in Discrete Mathematics

2.5. MONOTONE FUNCTIONS 55

2.4.7. Replace the hyphens in the vector it so that the binary vector obtained as a result is a value vector of some function generating a basis in K. Prove uniqueness of the solution:

l)it=(----), K=TonL; 2) it = (- - - - - - --), K = L n S; 3) it = (-110 -11-), K = To; 4) it = (- - --), K = Tl n L; 5) it = (- - - - - - --), K = L n S n T; 6) it = (-1l0 0110 0110 100-), K = To n TI ;

7) it = (- - 1 - - - - - - - - - - - --), K = L n S; 8) it = (-0 - - - 0 - -), K = S n TI ;

9) it = (-0 - - - 0 - -), K = S n To; 10) it = (- - - - 1 - 0 - ), K = S n TI ;

ll)it=(---- -10-), K=SnTo; 12)it=(---1 -0--), K=SnTI ;

13) it = (- - - - 1 - - - - - - - - - - - ), K = L n To n TI ;

14) it = (- - - - - - - - - - - - - - 1-), K = L n S n To; 15) it = (-00 - - - --), K = S.

2.4.8. Prove that the class Tl is precomplete in P2.

2.4.9. Prove that the set A is precomplete in L: (1) A = [{O, x}l; (2) A = L n TI ;

(3) A = L n To; (4) A = L n S.

2.4.10. Find out whether the set A is precomplete in To: (1) A = To n L; (2) A = To n S; (3)A=TonTl; (4)A=[{0,x}]; (5) A = [{xy,xVy}].

2.5 Monotone Functions

A function f(xn) is called monotone if, for any pair of tuples it, ~ E En such that it :S ~, the unequality f(it) :S f(~) takes place. Otherwise, a function f(xn) is called nonmonoione. The set of all monotone functions is denoted by M, while the set of all monotone functions depending on the variables Xl, X2, ..• Xn is denoted by Mn. The set M is a closed and precomplete class in P2 . The following statement is valid:

Lemma (on a nonmonotone function). If f ~ M then the function x can be obtained from f by substituting of the functions 0, 1, X for its variables f.

Page 65: Problems and Exercises in Discrete Mathematics

56 CHAPTER 2. CLOSED CLASSES AND COMPLETENESS

A vertex a of the cube Bn is called the lower one (upper zero) of the monotone function f(x n ) if f(a) = 1 (f(a) = 0) and for any vertex ~, it follows from ~ < a, that f(~) = 0 (f(~) = 1 follows from the condition a < ~).

The verification that any Boolean function f('in) defined by its value vector a f = (aD, aI, ... ,a2n -d is a monotone or nonmonotone function can be done in the following way. Let's divide the vector a f in two equal parts a f6 = (aD, a}, ... ,a2n-Ld, and af! = (a2n-l, a2n-I+I, ... ,a2n -d. If the unequality a f6 ~ a fi does not take place then f( 'in) is not a monotone function. Else let us divide again every vector a f~ (0' E {O, I}) into two equal parts a fl,2 and a/,2. If

0',0 0',1

one ofthe unequalities af l,2 ~ afl,2 does not take place, then f(x n ) tic M. Otherwise, 0',0 0',1

let us divide the vectors again and so on. If the relation of the preceding takes place for all pairs of vectors, then the function f(x n ) is monotone.

Example 1. Let af = (10011111) be the value vector of a function f. The first step does not define the nonmonotonity because 1001 ~ 1111. The second step gives 10 10 01, 11 ~ 11. So the function f(xn) is nonmonotone.

In order to prove the monotonicity of a nonconstant function f defined by the formula, one can transform it (using the equivalences) to some formula over the connectives & and V (or other monotone connectives).

Example 2. f = xVxyVxyz. Using equivalences we have xyVxyz = x(yVyz) = x(y V z). Further, x V x(y V z) = x V y V z. So function f is monotone.

Another one way to prove the nonmonotonicity of the function f is to obtain x by replacing some its variables by constants and the variable x.

2.5.1. Find out whether the function presented by its value vector is monotone: (1) af = (0110); (2) af = (00110111); (3) af = (01010111); (4) af = (01100110); (5) (xf = (00010111); (6) af = (01010011); (7) (xf = (0010 0011 01111111); (8) af = (0001 0101 0111 0111).

2.5.2. Verify whether the function f is monotone:

(1) f = (Xl ffi X2)&(XI rv X2);

(2) f = Xl -+ (X2 -+ Xl);

(3) f = Xl -+ (Xl -+ X2);

(4) f = XIX2X3 V XIX2X3 V XIX2X3 V XIX2X3 V XIX2X3;

(5) f = XIX2X3 V XIX2X3 V XIX2X3 V XIX2X3 V XIX2X3;

(6) f = (Xl ffi X 2)XIX2;

(7) f = XIX2 ffi X2 X 3 ffi X3 X I;

(8) f = Xl X2 ffi X2 X 3 ffi X3 X I ffi Xl·

2.5.3. For nonmonotone function f, find two neighbouring tuples (X, ~ such that a < ~ and f(a) > f(~):

Page 66: Problems and Exercises in Discrete Mathematics

2.5. MONOTONE FUNCTIONS

(1) f = XlX2X3 V XlX2; (3) f = XlX2 ffi X3; (5) f = XlX3 ffi X2 X4;

(2) f = Xl ffi X2 ffi X3; (4) f = Xl V X2X3; (6) f = (XlX2X4 --t X2X3) ffi X4·

57

2.5.4. Let Mn be the set of such vectors a = (ao, aI, ... ,a2n-d that are the value vectors of a monotone function. Find out the number of vectors from Mn which can be obtained from the vector i 2n = ho, 11, ... , 12n-d by replacing the hyphens by 0 or 1:

(1) i 2 = (0-); (3) i4 = (-00-); (5) i 8 = (- - - - -00-); (7) i 8 = (-1 - - 0 - - - );

(2) i 2 = (--); (4) i4 = (-10-); (6) i 8 = (- - -1 - - 0 - ); (8):y8 = (0 - - - - - -1).

2.5.5. Let MSn be the set of such vectors a = (ao, aI, ... , a2n-d that are the value vectors of functions from M n S. Find out the number of vectors from MSn which can be obtained from the vector i 2n = ho, 11, ... "2n-d by replacing the hyphens by 0 or 1

(1) i 2 = (--); (2) i4 = (-0 - -); (3) i4 = (- - -1); (4) i 8 =(-00-0---); ( 5) i 8 = (-0 1 - 0 - - - ); (6) i 16 = (- - -0 - 0 - - - 0 - - - - - -); (7) i 16 =(---l --1- -1-- ----); (8) i16 = (- - -1 - -0 - - - - - - - --).

2.5.6. For what values of n 2 2 is the function f(in) monotone:

(l)f(in) = Xl ffi X2 ffi ... ffi Xn;

(2)f( in) = EB XiX j; l~i<j~n

(3)f(xn) = XlX2··· Xn --t (Xl ffi X2 ffi ... ffi Xn);

(4)f(xn) = .. EB. Xi 1 Xi2·· .Xim' m = h[; l~!l <!2< ... <lm~n

(5)f(in) = XlX2··· Xn ffi EB Xl··· Xi-l Xi+! ... Xn; l~i~n

n

(6)f(i n )=EB EB XilXi2···Xim· m=ll~il <i2 < ... <im~n

2.5.7. Give an example of a nonmonotone function f(i n ) which every subfunc­tion of the type f~ (in), i = r;n, (J E {O, I}, is monotone. How many such functions are?

2.5.8. Show that if f(in) is nonmonotone, there exist two vectors a, S in En that differ exactly in one coordinate, and for which a < S but f( a) > f(S).

2.5.9. Show that the function f, which depends essentially on at least two variables, is monotone if and only if any (proper) subfunction of the function f is monotone.

Page 67: Problems and Exercises in Discrete Mathematics

58 CHAPTER 2. CLOSED CLASSES AND COMPLETENESS

2.5.10. Show that the function f(xn) is monotone if and only if for any r (r = 1, n -1), for any nonempty subset {iI, ... , ir} C {I, ... , n} and for any tuples a = ((}l, ... , (}r) and T = (Tl' ... , Tr) with a ::; T, the following relation is satisfied:

2.5.11. Prove that, for the monotone functions f(xn), the following expansion formulas are valid:

2.5.12. Prove that for any momotonic function J other than a constant, there exist disjunctive normal forms and conjunctive normal forms that do not contain negations of variables and that represent f.

2.5.13. The elementary conjunction J( is called the prime implicant if J( V J = J and 1\' V f i- f for every conjunction J(' obtained from ]{ by deleting letters. Prove that any prime implicant does not contains the variables' negations.

2.5.14. Find out the number of lower ones e(J) and upper zeroes n(J) of the monotone function f:

(1) f(x 3 ) = XlX2 V X2X3 V X3Xl; (2) f(x 2 ) = Xl V X2;

(3) f(i 4 ) = XlX2X3 V X4(XI V X2 V X3);

(4) f(x 2k ) = (Xl V X2)(X3 V X4).·. (X2k-l V X2k);

(5) f(x 3k ) = (Xl V X2 V X3)(X4 V Xs V X6) ... (X3k-2 V X3k-l V X3k).

2.5.15. Let ~(x, y) = x V y. Let I<c,(xn ) = M=l ~(Xi' ail. Prove that if 0: is the lower one of the function f( in), then the elementary conj unction K" (in) is in the Zhegalkin polynomial of the function f( in) as a term.

2.5.16. Show that there are no monotone self-dual functions with exactly two lower ones.

2.5.17. (1) Show that there is a subset in Bn consisting of ([n/2]) pairwise incomparable tuples.

(2*) Show that IMnl ;::: 2([n/2)).

2.5.18. The sequence of tuples 0:0 ,0:1 , ... , O:k is called an ascending chain of length kif O:i-l < O:i (i = 1, ... , k).

(1) Show that there is n! pairwise different ascending chains of length n in Bn. (2) Show that the number of pairwise different ascending chains of length n,

which contain the fixed vertex 0: from B'k, is equal to k!(n - k)!.

2.5.19. (1) Show that the size of an arbitrary subset of pairwise incomparable

tuples of the cube Bn is not greater than ([n/2]). (2) Show that if the subset A ~ Bn consists of pairwise incomparable tuples,

and, moreover, II 0: II ::; k ::; n/2 for any 0: E A, then IAI ::; (~).

Page 68: Problems and Exercises in Discrete Mathematics

2.5. MONOTONE FUNCTIONS 59

2.5.20. (1) Using Dilworth's theorem, which states that the minimal number of chains containing all the vertices of partialy ordered set is equal to the maximal number of pairwise incomparable vertices in this set, prove that

(2) Prove that the number of the monotone functions f(xn)l, such that every its lower one has a weight no greater than k (0 S k S n/2), does not exceed

1 + (k + d~). 2.5.21. Find the number of functions in the following sets: (1) Mn \ (TI U To); (2) Mn \ (TI n To); (3) Mn n L; ( 4) Mn n L n S; (5) L" \ (Ai US).

2.5.22. Show that: (1) IS'n AI"I S IMn-11 when n:::: 1;

(2) IM"I S IMn-112 when n :::: 1; (3) IAinl S IMn-21222n-2 when n :2: 2. 2.5.23. (1) Enumerate all monotone functions depending on the variables Xl, X2.

(2) Enumerate all pairwise noncongruent monotone functions depending essen-tially on three variables.

(;3) Let 4'(1!) be the number of monotone functions depending on the variables .rl, )'2, ... , J'n. Show that:

(a) 4'(1) = 3; (b) ~'(2) = 6; (c) 1jJ(3) =20; (d*) 1jJ(4) = 168.

2.5.24. Enumerate all pairwise non congruent self-dual monotone functions depending on four variables.

2.5.25. Prove that IM"I < Isnl, when n :::: 4.

2.5.26. Let A c::: Ei' and let C be the set of all tuples 0 E E'k such that there is a tuple l3 from A which is comaprable with o. Prove that

2.5.27. Let j EM", qk(f) = lNi n E'kl (~rl. Prove that qk-l(f) S qk(f) (k = 1, ... , n).

2.5.28. The function y(i'''), defined on E" and assuming arbitrary real values, is called a gfllfl,'ah::cd monotone junction (abbrev. GMF) if it follows from it S ~ that y(o) S yed).

(1) Prove that the GMF cp( i") can be presented as a linear combination of monotone Boolean functions as is shown below:

y(./,Il) = c + L (lIf(.r"), f(r" )E.H

Page 69: Problems and Exercises in Discrete Mathematics

60 CHAPTER 2. CLOSED CLASSES AND COMPLETENESS

where c is a real number, and af is a nonnegative number.

(2) Let 'P(:rn) be a GMF, and qk('P) = (~)-l L 'P(a). Prove that qk-l('P) :::; iiEBr

qk('P) (k = 1, ... , n).

5.2.29.* (1) Let f(xn) and g(xn) be the monotone functions. Prove that

(2) Let fl' ... , fs be the functions from Mn. Prove that

2.5.30. (1) Is it correct that if f E Mn, then it follows from a, ~ E En, I/(~) > I/(a) (II ~ II >11 a II) that f(a) :::; f(~)?

(2) For any k (0 :::; k < n) let it follow from conditions 1/( an) :::; 2n - 1 -2k, I/(tn) = I/(an) + 2k that f(an) :::; f(~n). Prove that f EM.

2.5.31. Let F (y2n) = M:61\7~r/-l (Yi --+ Yi+2k). Prove that INFI = IMnl.

2.6 Completeness and Closed Classes

The following completeness criterion is valid in P2:

Theorem (E. Post). A system A of functions from P2 is complete in P2 if and only if it is not contained entirely in one of the classes To, TlJ L, S, and M.

The function f(x n ) is called Sheffer's function if it forms a basis in P2 •

To examine the completeness of the systems of functions, it is convenient to use a table called a criterial table. This table has five columns corresponding to five pre complete classes in P2 • The rows correspond to the functions of the examined system. The plus sign is placed in the cell, which is formed by the column corresponding to the class K and the row corresponding to f, if f E K. Otherwise, the minus sign is placed. The system of functions is complete if and only if every column contains at least one minus sign.

Example 1. Examine the completeness of the system A = {fl = xy EB z, 12 = xEByEB1}.

Solution. The criterial table is shown below (see Table 2.1): Every column contains at least one minus sign. The system is complete.

Example 2. Examine the completeness ofthe system A = (S\M)UL \ (TouTd.

Page 70: Problems and Exercises in Discrete Mathematics

2.6. COMPLETENESS AND CLOSED CLASSES 61

Table 2.1

To Tl L S M

11 + ~ ~ ~ ~

12 ~ + + ~ ~

Solution. Let us divide the system A in two subsets Al = S \ M and A2 = L \ (To U Td, and examine whether the functions of these subsets belong to the precomplete classes. Note that Xl E Al n A2• Hence, Ai <l: To, Ai <l: Tl, Ai <l: M (i = 1, 2). It is obvious that Al ~ S, A2 ~ L. Note that m(x, y, z) = xy EB yz EB zx belongs to Al and is not a linear function. So Al <l: L. What one needs to do now is to conclude whether A2 is in S. Since A2 ~ L, every function I from A2 can be presented as I = QlXl EB Q2 X 2 EB ... QnXn EB Qo· Since A2 <l: To, then Qo = 1. Since A2 <l: Tl , then 1(1) = EB1<i<n Qi EB 1 = o. Hence, the number of ones among the coefficients Ql, ... , Qn is odd. This means that the function I is linear and depends essentially on the odd number of variables. Such a function is self-dual (prove it). Thus, the criterial table is given in Table 2.2:

Table 2.2

To Tl L S M A1 ~ ~ ~ + ~

A2 ~ ~ + + ~

The system A is not complete in P2 because the fourth column does not contain a minus sign.

The criterial table can be useful for finding the bases in the system A.

Example 3. Find all possible bases from the complete in P2 system A {iJ = x EB y, 12 = xy EB z, Is = x EB y EB z EB 1, 14 = xy EB yz EB zx}.

Solution. The criterial table is given in Table 2.3:

Table 2.3

To Tl L S M

11 + ~ + ~ ~

12 + ~ ~ ~ ~

h ~ ~ + + ~

14 + + ~ + +

Using this table, we construct the c.n.f. J{ the elementary disjunctions of which

Page 71: Problems and Exercises in Discrete Mathematics

62 CHAPTER 2. CLOSED CLASSES AND COMPLETENESS

correspond to the table's columns and include the symbols of those functions which are not in the class corresponding to the columns. In our case, we have

Multiplying the parentheses and applying the equivalences, we obtain:

The subsets of functions corresponding to the items of d.n.f. D are the required bases. In our case, we have two bases: BI = {h, h} and B2 = {II, h, I4}'

The completeness of the system of functions can be proved by the reduction of the examined system to such known systems as

{xy, xVy, i}, {xy, xfBy, I}, {iVy}, {iy}.

Example 4. Prove that the system

A = {II = xy V yz V zx, 12 = 0, h = 1, 14 = X fB y fB z}

is complete in P2.

Solution. We have II(x,y,O) = xy, I4(x,y,0) = x fB y. So the functions xy, ,r tB y. 1 can be obtained from the functions of the system A, i.e. A is complete in P2 .

2.6.1. Find out if the system is complete in the following cases: (1) A = {xy,xVy,xfBy,xyVyzV zx}; (2) A = {xY, x V y, x fB y fB z EEl I}; (3) A = {I, i, x(y '" z) if i(y I:El z), x '" y}; (~) A = {O,i,x(y ttl z) ttl yz}; (5) A = {i,x(y '" z) '" (y V i),x fB y fB z}; (6) A = {i,x(y '" z) '" yz,x fB y fB z}; (7) A = {xy(x fB y),xy ttl x ttl y, I,xy fB yz EEl z:r}; (8) A = {xy(x fB z), I}; (9) A = {x --+ y,i --+ yx,x ifl y fB z, I}; (10) A = {x --+ y,xtBy}.

2.6.2. Find out if the system of functions A is complete (the functions are defined by the value vectors):

(1) A = {II = (OllO),h = (llOOOOll),h = (100IOllO)); (2) A = {II = (0111),12 = (01011010), h = (OIllll10)}; (3) A = {II = (0 III ), 12 = (1001 011 0 )} ; (4) A = {II = (0101),12 = (I1IOIOOO),h = (Ol10100I)); (5) A = {II = (1001),12 = (1110 IOOO)}; (6) A = {II = (11),12 = (OIll),h = (00110111)); (7) A = {II = (10),12 = (001101ll)); (8) A = {II = (11), h = (00), h = (0011 0101)};

Page 72: Problems and Exercises in Discrete Mathematics

2.6. COMPLETENESS AND CLOSED CLASSES

(9) A = {il = (10000001),h = (Olll),h = (lOll)); (10) A = {il = (10000001),h = (OllO),h = (1001)).

2.6.3. Find out if the system A is complete in the following cases: (1) A = (5 n M) U (L \ M); ( 2) A = (L n TI n To) U (5 \ (To U TI)); ( 3) A. = (L n Ttl U (5 n M); ( 4) A = (L n Ttl U (5 \ To); (5) A = (M \ To) U (L \ 5); ( 6) A = (M \ To) U (5 \ L); (7) A = (L n M) U (5 \ To); ( 8) A = (( L n M) \ TI ) U (5 n Ttl; (9) A = (AI \ 5) U (L n 5); (10) A = (M n 5) U (To \ M) U (TI n 5).

2.6.4. Verify whether the system of functions A is the basis in P2. (1) A = {x --7 y,x EEly,x Vy}; (2) A = {x ffi y ffi z, x V y, 0, I}; (3) A. = {nJ1yEByz,xEByffi I}; (4) A. = {xy V z,xy EB z,xy rv z}; ( 5) A = {x m y EEl z, x EEl y EEl z EEl 1, xy EEl y z EEl z x, i}; (6) A = {x EByEElz,xyEElzxEElzy,O,l}; (7) A= {xmy,xrvyz}; (8) A = {xy EB yz EB zi, 0,1, x V y}.

63

2.6.5. Isolate all possible bases from the complete system A in P2 in the following cases:

(1) A = {I, i, xy (x EEl y), x EEl y EEl xy EEl y z EEl zx}; (2) A = {O,x ffi y,x --7 y,xy rv xz}; (3) A = {O, 1, x EEl y EEl z, xy EEl zx EEl yz, xy EEl z, x V y}; (4) A = {JoYJ Vy,.ry V z,x EB y,x --7 y}; (P» A. = {xY+ZJ+y+z,xy,1}; (6) A. = {J'Y V 1z,1,x --7 y,O,x EB zy}; (7) A = {:ry,xyV z,xEEly,x --7 y,i}; (8) A = {x EEl y, x rv y, x EEl y EEl z, xy, X --7 y}.

2.6.6. Using the operations of the theory of sets, represent the closure of the set A. through the known closed classes To, TI, L, 5, M, and P2 if:

( 1) A. = P2 \ (To U TI U L U 5 U M); (2) A = M \ (To n L); ( 3) A = M \ (To n Ttl; ( 4) A = To n (L \ 5); (5) A = 5 \ (To \ TI); (6) A = (L n 5) \ (To UTI); ( 7) A = (5 \ TI) U (L \ (TI U To)); ( 8) A = L \ (5 U To); (9) A = L \ (To U Ttl; (10) A = (To \ TI) U (M \ L); ( 11) A. = (To \ TJ ) U (M \ To); ( 12) A = M \ (5 U L).

Page 73: Problems and Exercises in Discrete Mathematics

64 CHAPTER 2. CLOSED CLASSES AND COMPLETENESS

2.6.7. (1) Let P2(X2) be the set of all such functions from P2(X2) which depend essentially on two variables. Find all the bases B ~ P2(X2) consisting of:

(a) one function; (b) two functions; (c) three functions. (2) Prove that no base B ~ P2(X2) containing four functions exists.

2.6.8. Find out if it is possible to extend the set A to be the basis in P2: (1) A = {x '" y,m(x,y,z)}; (2) A = {x}; (3)A={xEBY,xVy}; (4)A={xVy,xy}; (5)A={O,1}; (6)A={O,1,xVy}; (7) A = {x --t y,x Vy}; (8) A = {x EB y,x Vy}.

2.6.9. Find out if the system of functions A following cases:

(1) fl E S \ M, f2 ~ L US, fl --t 12 == 1; (2) fl ~ L U To UTI, 12 E M n L, fl --t 12 == 1; (3) fl ~ To U L, 12 ~ 5, fl --t 12 == 1; (4) fl E (5 n L) \ To, 12 E M \ (To n L), h --t 12 == 1. 2.6.10. Find out for what values of n :2 2 the function f(x n ) is Sheffer's

function: (1) f(x n) = 1 EB XlX2 EB ... EB Xixi+! EB ... EB Xn-lXn EB XnXl; (2) f(x n) = 1 EB XlX2 EB ... EB XiXi+! EB ... EB Xn-lXn; (3) f(x n ) = Vl<i<j<n XiXj; (4*) f(xn) = 1 ffi EB-l<i<j<n XiXj; (5) f(xn) = VlSil< ... ~i[n_:jsn XiJ:i2··· Xijn/2[; (6) f(x n) = 1 EB (Xl --t X2) EB (X2 --t X3) EB ... EB (Xn-l --t Xn) EB (Xn --t Xl); (7) f(x n) = 1 EB (Xl --t X2) EB (X2 --t X3) EB ... EB (Xn-l --t Xn); (8) f(x n) = (xllx2) EB (x2Ix3) EB ... EB (xn-llxn) EB (XnIXl); (9) f(x n) = (xllx2) EB (x2Ix3) EB ... EB (xn-lIXn); (10) f(x n) = XlX2 ... Xn EB (Xl --t X2)&(X2 --t X3)& ... &(Xn-l --t Xn)&(Xn --t Xd.

2.6.11. Prove that if f is monotone and depends essentially on no less than two variables, then the system {a, f} is complete in P2 •

2.6.12. Let h, f2' h be pairwise different functions depending essentially on two variables. Prove that the system {x EB y EB z EB 1, fl' 12, h} is complete in P2.

2.6.13. Prove that if f ~ ToUTl US, then f is Sheffer's function.

6.2.14. It is known that using the operation of superposition it is possible to obtain the constants ° and 1 from the function f. Prove that function f is Sheffer's function.

2.6.15. Let the function f be monotonic with exactly two lower unities. Prove that J is Sheffer's function.

2.6.16. Find the number of Sheffer's functions in p2(xn).

Page 74: Problems and Exercises in Discrete Mathematics

2.6. COMPLETENESS AND CLOSED CLASSES 65

2.6.17. Let f be a function depending essentially on two variables and f ~

Tl U To. Prove that the function f is Sheffer's function.

2.6.18. Let 1 be Sheffer's function depending on n ~ 3 variables. Prove that by identifying the variables in f it is possible to obtain one of the functions x V f}

or xv. 2.6.19. (1) Prove that L <;;; Tl UTa U S. (2) Prove that the set A is not empty: (a) A = (L n Td \ (To US); (b) A = (L n To) \ (Tl U 5); ( c) A = (L n 5) \ (To U Tl)'

2.6.20. (1) Let f(x n ) be a symmetric function depending essentially on n ~ 3 variables, and 1(1110 ... 0) = f(OO ... 0). Prove that the system { J(xn), 0, x} is complete in P2 .

(2) Let n be even. Let f(Xn) be a symmetric function depending essentially on n variables, and 1(0) i- 1(i). Prove that system {f(x n ), x} is complete in P2 .

2.6.21. (1) Let A be the set of functions from P2(Xn) such that IAI > ~ ·22n

(n ~ 2). Prove that the system A is complete in P2 .

(2) Let A be the set of functions from P2(xn) depending essentially on n variables such that IAI > ~ ·22n (n ~ 2). Prove that the system A is complete in P2 .

(3) Let IA \ (To U T1)1 > ~ . 22n - 1, A <;;; P2 (xn) (n ~ 2). Prove that the system

A is complete in P2 .

(4) Let IA n LI > 2n, IA n MI > n + 2, A <;;; P2 (xn) (n ~ 2). Prove that the system A is complete in P2 •

(5) Let IA n LI > 2n , IA n 51 > 2n , A <;;; P2 (xn) (n ~ 3). Prove that the system A is complete.

(6) Let IA n 51 > ~ . 22n- 1, IA n (L \ To)1 > 2n - 1 , A <;;; P2(xn) (n ~ 3). Prove

that the system A is complete.

2.6.22. Prove that any function 1 from the set 5 \ (To U Tl U M U L) forms a basis in 5.

2.6.23. Is it correct that any function 1 E To \ (Tl U M U L U 5) forms a basis in To?

2.6.24. (1) Is it correct that if 1 E M \ (5 U L), then the set {a, 1, J} is the basis in M?

(2) Is it correct that for any f E M \ (5 U L) such that f ~ ([{x Vy}] U [{XV}]) the set {a, 1, J} is the basis in M?

2.6.25. Let f(x 4 ) be a such function that, for any i (1 ~ i ~ 4), all subfunctions f~ and n takes 1 exactly on any four tuples. Can the system {I, J} be complete in P2?

Page 75: Problems and Exercises in Discrete Mathematics

Chapter 3

Many-Valued Logics

3.1 Formulas of k-Valued Logics

Throughout this chapter, we shall assume that k is a natural number larger than 2. We shall denote the set {O, 1, ... , k - I} by Ek . The function f(x n ) = f( Xl, X2, ... , Xn) is called a function of the k-valued logic if, on any tuple 0 = (aI, a2, •.. , an) of values of the variables Xl, X2, .•. , X n , where ai E Ek , the value f(o) also belongs to the set Ek • The set of all functions of the k-valued logic is denoted by Pk . The concept of fictitious and essential variables, equal functions, formulas generated by a set offunctions (and connectives), superposition and closure operations, closed class, basis, etc., are defined in k-valued logic in the same way as in Boolean algebra. Hence, we shall give only the definitions of such concepts that differ essentially from the corresponding concepts in P2 •

The following functions in a k-valued logic are assumed to be elementary func­tions:

constants 0, 1, ... , k - 1; these functions will be treated as functions depending on an arbitrary finite number of variables (including zero variables);

Post's negation: X + 1 (mod k), denoted as x; Lukasiewicz's negation: (k - 1) - x, denoted as '" X or N X;

characteristic function (of the first kind) of a number i:

. ( ) . k' () {I if X = z, Ji X , Z = 0, 1, ... , - 1; Ji X = ° if X 1:- i;

characteristic function of the second kind of a number i:

. { k - 1 if X = z, Ji(x), Z = 0, 1, ... , k - 1; Ji(x) = ° if x 1:- i;

the smallest of x or y: min(x, y) (alternatively, xy or x&y); the larger of x or y: max(x, y) (alternatively, xVy); mod k sum: x + y (mod k) (read as "mod k x plus y")l;

1 Unless otherwise stated, the symbols "+" and "." in this chapter will denote mod k sum and product

66

Page 76: Problems and Exercises in Discrete Mathematics

3.1. FORMULAS OF k- VALUED LOGICS

mod k product: :r' y (mod k) (read as "mod k product of x and y"); truncated difference:

x...;..y={ o if O:S x < y :S k - 1,

x - y if O:S y :S x :S k - 1;

implicat ion:

{ k - 1 if O:S x < y :S k - 1, x :; y = (k - 1) - x + y 1'f O:S y:S x:S k -1;

joint denial: max(x, y) + 1 (mod k), denoted by Vk(X, y); mod k difference:

x- y ={ x - y if O:S y :S x :S k - 1, k - (y - x) if O:S x < y :S k - 1.

67

The functions (operations) min, max, "+" and "." are commutative and asso­ciative. Moreover, the following relations are valid:

(J' + y) . z = (J' . z) + (y . z)

which is called the distributivity of multiplication with respect to addition;

max (min(x, y), z) = min (max(x, z), max(y, z))

called the distributivity of the operation max with respect to the operation min;

min (max(x, y), z) = max (min(x, z), min(y, z))

which is called the distributivity of the operation min with respect to the operation max;

max(x, .1') = x, min(x, x) = x

which is called the idempotency of the operations min and max; and

min(rv x, rv y) =rv max(x, y), max(rv x, rv y) =rv min(x, y)

which is called analogs of De Morgan's rules (laws) in P2. The following equalities are introduced by definition:

{ 0 if x = 0, -x = k - x if x f. O.

Page 77: Problems and Exercises in Discrete Mathematics

68 CHAPTER 3. MANY-VALUED LOGICS

In view of the associativity of the mod k product, the product x . x . x ..... x (l cofactors, I :::: 1) is often written in the power form xl.

3.1.1. Prove the validity of the following equalities: (1) -(x) = '" x; (2) x ~ y = '" (x ~ y); (3) x ~ (x ~ y) = min(x, y); (4) (x ~ y) ~ y = max(x, y); (5) (x ~ y) + x = min(x, y); (6) x~y =x-min(x, y); (7) x ~ y = max(x, y) - y; (8) ('" x) ~ (y ~ x) = '" max(x, y); (9) ('" x) ~ ('" y) = y ~ x; (10) '" (x + y) = ('" x) + ('" y); (11) '" (x· y) = ('" x)· y; (12) max((x + 2) ~ 1, Jk- 2(X)) = x; (13) min(", Jk- 1(X), (k - 2) ~ x) = x; (14) x ~ Y = (x ~ y) + X· ]k-1(y) + y. ]k-dx); (15) Vk(X, y) + X' ]k-1(y) + y. ]k-1(X) = max(x, y); (16) max(x, y) + ]o(Y ~ x) + ]k-1(X) . y = max(x, y); (17) min(x, y)+Jo(Y~X)-]k_1(x)·y=min(x, y); (18) Jo(max(Jo(x), J1(x), ... , Jk-2(X))) = Jk- 1(X); (19) J1(max(x, I, J1(x), J2 (x), ... , Jk - 2 (X))) = Jo(x); (20) X· ]0(j1(X)) + ]o(x)· ]l(X) = x + ]o(x) - ]l(X); (21) Jo(x ~ i) ~ Jo(x ~ (i - 1)) = Ji(x), i = 1, 2, ... , k - 1; (22) ('" (('" x) ~ 1)) ~ ( ... (((k - 1) ~ ,('" x)) ~ ('" x)! ~ ... ~ ('" xn = x;

k - 1 times (23) ( ... (((k-l)~]o(x))~]o(x~I))~ ... ~]0(x~(k-3)))~((k-1)]0('" x)) = x.

3.1.2. Prove that the function j in Pk is generated by the set of functions A (A c Pkl as a result of the superposition operation.

(1) j = J1(x), A = {Jo(x), J2(x), max(x, y)}, k = 3; (2) j = '" x, A = {Jo(x), J1(x),min(x, y)max(x, y)}, k = 3; (3) j = x, A = {I, x2 , J1(x), max(x, y)}, k = 3; (4) j = ]o(x), A = {x - 1, x2 }, k = 3, 5; (5) j = ]l(X), A = {x· y + x - y2 + I}, k = 3, 5; (6) j = '" x, A = {I, X· y}, k = 3, 5; (7) j = x, A = {3, ]o(x), x ~ y}, k = 4; (8) j ='" x, A = {x + 2, Jo(x), J1(x), max(x, y), X· y}, k = 4; (9) j = ]4(X), A = {x ~ I, h(x)}, k = 6; (10) j = ]5(X), A = {x + 2, x2, J3(x)} , k = 6; (11) j = ]l(X), A = {x, -x, Jk- 1(X)}; (12) j = Jk-1(X), A = {'" x, x ~ y}; (13) j=Jk_2(x),A={k-l, x+2, x~y}; (14) j = ]o(x), A = {I, '" x, x ~ 2y};

Page 78: Problems and Exercises in Discrete Mathematics

3.1. FORMULAS OF k-VALUED LOGICS 69

(15)f=i,A={1, "'X, x~y}.

3.1.3. Prove that if 0 belongs to Ek and is coprime to k, each function Ji(x), ° ::; i ::; k - 2 can be presented as a superposition generated by the set {x + 0, Jk- 1 (x)}.

3.1.4. Show that the function '-P from Pkcan be represented by a formula generated by the set {O, 1, ... , k -1, x ~ 2y} if

(1) '-P = jk-l(X), k = 2m (m:::: 2); (2) '-P = jo(x), k = 2m + 1 (m:::: 1).

3.1.5. Let hI (x) = '" x, hi+1(X) = x :::> hi(x), i :::: 1. Prove that", hk-1(X) =

Jk-1(x)'

3.1.6. For what values of k (k :::: 3) are the functions x 2 , x 3 and X4 pairwise different?

3.1. 7. Let k = 3, 4, ... , 9, 10. How many different functions in Pk , depending only on the variable x, can be presented in the form xl (I :::: 1 and the power is taken over mod k) for each k?

3.1.8. Prove that each function f( x) in Pk can be presented as a superposition generated by the set {l, Jk-1(X), x + 1}.

3.1.9. The functions fl(X) and h(x) in P3 satisfy the following conditions: h(x) ¢,const, h(E3) oj: E3 and h(E3) = E3.

Prove that the function g(x) = h(x) + h(x), where mod 3 sum is taken, does not assume at least one value in E3, i.e. g(E3) oj: E3.

3.1.10. Let the function f(x) in P3 be presented in the form aox2 + alx + a2 (mod 3 sum and product are taken, and ao, aI, a2 belong to E3)' What values can be assumed by the coefficients ao, al and a2 if the function f( x) is known not to assume at least one value in E3, i.e. f(E3) oj: E3.

Anyfunctionf(x], X2, ... , xn)inh, n::::1,canbepresentedinthefirstform, which is an analog of the perfect disjunctive normal form for Boolean functions:

f(x], X2, ... , Xn) = max.; {min(f(O'], 0'2, ... , O'n), J"I(X])' J"2(X2), ... , J"n(Xn))}'

Here the maximum is taken over all tuples (j = (0'], 0'2, ... , O'n) of values of the variables x], X2, ... , Xn.

Another representation of the functions of k-valued logic, called the second form, is also possible:

f(5:n) = L f((j)· j"l (Xl) ..... j"Jxn) . f((j), .;

where the sum is taken over all tuples (j = (0'], ... , O'n) of values of variables Xl. X2, ... , Xn (mod k sum and product are taken).

Example. Present the function f(x, y) = max(jo(x) . jo(y), X· (jl(Y) + 2jz(y))) in P3 in the first and second forms.

Page 79: Problems and Exercises in Discrete Mathematics

70 CHAPTER 3. MANY-VALUED LOGICS

Table 3.1

y \ x 0 1 2 0 1 0 0 1 0 1 2 2 0 2 1

Solution. First of all, we compile the table of values of the function f (see Table 3.1 below):

With the help of Table 3.1, we obtain the first and second forms of the function

f. f(x, y) = max{min(l, Jo(x), Jo(y)), min(O, Jo(x), Jl(y)), min(O, Jo(x), J2(y)),

min(O, Jl(x), Jo(y)), min(l, Jl(x), Jl(y)), min(2, Jl(x), J2(y)), min(O, J2(x), Jo(Y)), min(2, J2(x), Jl(y)), min(l, J2(x), J2(y))}.

Using simple manipulations, we get f(x, y) = max{min(l, Jo(x), Jo(y)), min(l, Jl(x), Jl(y)), min(Jl(x), J2(y)),

min(J2(x), Jl(y)), min(l, J2(x), J2(y))}. f(x, y) = 1· jo(x)· jo(Y) + O· jo(x), iI(y) + O· jo(x)· h(y) + O· iI(x), jo(Y) + 1 .

jl(X) . jt(Y) + 2· jt(x) . h(y) + O· h(x) . jo(y) + 2· h(x), jl(Y) + 1· h(x) . j2(Y) = jo(x), jo(y) + iI(x), jt(Y) + 2· jt(x) . j2(Y) + 2· j2(X) . jt(Y) + h(x) . j2(y),

3.1.11. For a given k, present the function f in the first and second forms (simplify the obtained expressions).

(1) f=i, k=3; (2) f = ~ x, k = 4; (3) f = -jo(x), k = 5; (4) f = 2 . Jl(x), k = 6; (5) f = J2(X 2 + x), k = 5; (6) f = ('" X)2 +x, k = 4; (7) f=3·jt(x)-h(x), k=4; (8) f = x + 2y, k = 3; (9) f = max(x, y), k = 3; (10) f=X+y2, k=3; (11) f=x 2.y, k=3; (12) f = X· fj, k = 4.

3.1.12. Prove the validity of the following relation which is analog of the perfect conjunctive normal form of the functions in Pk:

(here n ~ 1 and the minimum is taken over all tuples if = (0'1, 0'2, ... , O'n) of values of the variables Xl, X2, ... , Xn ).

Page 80: Problems and Exercises in Discrete Mathematics

3.2. CLOSED CLASSES AND COMPLETENESS 71

3.2 Closed Classes and Completeness in k-valued logic

Let [ be a subset of the set Ek . The function f( j;n) in Pk (n ::::: 1) is said to preserve the set [if it takes a value f(ii n), also belonging to [, on any tuple iin = (aI, 0'2, ... , an) such that ai E [ (i = 1, 2 .... , n). For n = 0, it is assumed by definition that the function f == a (a E E k ) preserves the set [ only if a E [. The set of all functions in Pk preserving the set [ is a closed class, denoted by T( [) and called the class preserving the set [, if [ is a proper subset of the set Ek (i.e.

0(~)[(~)Ek)' T([) -I Pk (see Problem 3.2.3).

Let D = {[I, [2, ... , [s} denote the partition of a set Ek, i.e. Ek = Ui=l [i, [i -I 0 for i = 1, 2, ... , sand [i n [j = 0 for i -I j. Elements a and b are said to be equivalent with respect to the partition D (notation a ~ b (mod D)) if a and b belong to a certain (the same!) subset [j of the partition D. Two tuples iin and ~n are called equivalent with respect to the partition D (notation iin ~ ~n (mod D)) if ai ~ f3i (mod D) for i = 1, 2, ... , n. The function f(j;n) in Pk (n ::::: 1) is said to preserve the partition D, if for any tuples iin and ~n, the equivalence on rv :3 71 (mod D) leads to the eqiuvalence f(ii n ) rv f(~n) (mod D). It is assumed by definition that any constant function (i.e., a function depending on zero variables of the type f = a, a E E k ) preserves any partition D. A set of all functions in Pk

preserving the partition D = {[I, [2, ... , [s} is a closed class, denoted by U(D) or U ([I, [2, ... , [s) and called the class preserving the partition D. If s -I 1 and s -I k, the class U(D) is different from Pk (see Problem 3.2.4).

The function f(i n ) in Pk (n ::::: 0) is called linear if it can be presented in the form ao + al . .1'1 + ... + an . .1· n , where aj E Ek , j = 0, 1, ... , n, and the sum and products are taken over mod k. The set of all linear functions in Pk forms a closed class of linear functions, denoted by Lk (or L). The class Lk differs from Pk for all k ~ 3. A mod k polynomial of variables XI, X2, ... , Xn is an expression of the type ao + al . XI + ... + am' Xm , where the coefficients ai belong to the set Ek ,

and X.i is either a variable in {XI, X2, ... , xn} or a product of variables in this set (j = 1. ... , Tn). A certain function from Pk can be presented by a mod k polynomial if there exists such a polynomial equal to this formula. The set of all functions in PA- that can be presented by mod k polynomials (or, in short, the set of all mod k polynomials) forms a closed class in Pk .

Theorem. Each function in Pk can be represented by a mod k polynomial if and only if k is a prime number (in other words, the set of mod k polynomials in h zs complrtf in PA- if and ollly if k is a prime number).

If k is a composite number, then Pk contains functions that can be represented by polynomials, as well as functions that cannot (for example, the constant functions 0, L ... , k - 1 and "polynomial" functions x, x2, X . y, x + y can be represented by polynomials, while the functions jo(x), max(x, y), min(x, y), x --;- y cannot).

Page 81: Problems and Exercises in Discrete Mathematics

72 CHAPTER 3. MANY- VALUED LOGICS

Example 1. Represent the function f( x) = x2 -7 x in P5 by a mod 5 polynomial.

Solution. Let us first represent the function f( x) in the second form: f(x) = L f(u) . j(](x) = f(O) . jo(x) + f(l) . jl(X) + f(2) . j2(X) + f(3) . h(x) +

(]

f(4) . j4(X) = o· jo(x) + o· jl(X) + 2· j2(X) + 1 . j3(X) + O· j4(X) = 2· h(x) + h(x). Then we shall use the fact that jo(x) = 1 - Xk- 1 if k is a prime number (k ~ 3)

and that ji(X) = jo(x - i), i = 1, ... , k - 1. (Here, as usual, we take mod k difference and mod k power.) We have j2(X) = 1 - (x - 2)4 = _x4 - 2x3 + x2 + 2x,

h(x) = 1-(x-3)4 = 1-(x+2)4 = -x4+2x3+x2-2x. Consequently, x2 -7 x = 2X4 - 2x3 - 2X2 + 2x. (This formula can be written in a more compact form 2x· (x - 1)2 . (x + 1).)

The polynomial representation of the function f( x) can also be carried out by means of the method of indeterminate coefficients. Let f( x) = ao + al . x + a2 . x2 + a3· x3 + a4 . X4 (higher powers need not be considered since xHI = xl (mod 5)). We compile the following system of equations:

ao = f(O) = 0, ao + al + a2 + a3 + a4 = f(l) = 0, ao + 2al + 4a2 + 3a3 + a4 = f(2) = 2, ao + 3al + 4a2 + 2a3 + a4 = f(3) = 1, ao + 4al + a2 + 4a3 + a4 = f(4) = O.

Solving this system of equations, for example, by the method of elimination, we obtain: ao = 0, al = 2, a2 = 3, a3 = 3, a4 = 2.

Example 2. Prove that the function f(x, y) = x2 -7 y in P4 cannot be represented by a mod 4 polynomial.

Solution. Assume that the converse is true, i.e. that f(x, y) can be represented by a mod 4 polynomial, and write this hypothetical polynomial in the general form (with indeterminate coefficients): f(x, y) = (aoo + alOx + a20x2 + a30x3) + (aolY + al1xy + a21x2y + a31x3y) + (a02y2 + a12xy2 + a22x2y2 + a32x3y2) + (a03y3 + a13xy3 + a23x2y3 + a33x3y3).

(Powers higher than 3 need not be considered since, for 1 ~ 1, the relations x21+2 = x2 (mod 4) and x21+3 = x3 (mod 4) are valid.) We have:

{ f(l, 0)=aOO+alO+ a20+ a30=1, f(l, 2) = aoo + alO + a20 + a30 + 2(aOl + all + a21 + a31) = O. (1)

Since the equation 1 + 20 = 0 (mod 4) has no solutions (this can be proved directly by successively putting a = 0, 1, 2 and 3), system (1) also has no solution. Consequently, we cannot choose appropriate coefficients aij which would ensure the representation of the function f in the form of a mod 4 polynomial. Therefore, the function f cannot be represented by a mod 4 polynomial.

Remark. In the problem considered above, it would suffice to write two relations between the coefficients. However, a more complete set of equations should be often

Page 82: Problems and Exercises in Discrete Mathematics

3.2. CLOSED CLASSES AND COMPLETENESS 73

considered. Below, we shall demonstrate other methods to prove that the functions in Pk cannot be represented by mod k polynomials.

3.2.1. (1) Find out which of the classes, T({O, 2}) or U({O, I}, {2}), contain the following functions in P3 :

(a) rv Xj (b) jl(X)j (c) J2(x)j (d) x -T Yj (e) x + Yj (f) min(x, y). (2) Find out which of the classes, T( {I, 3}), U( {O, I}, {2}, {3}) and/ or

U( {O, 3}, {I, 2}) contain the following functions in P4 :

(a) Xj (b) rv x; (c) jo(x)j (d) x + 2yj (e) max(x, Y)j (f) X2. y.

3.2.2. For a given k and a function fin Pk , choose the classes of the types T(£) or/and U(D) to which this function belongs. Here £ must be a proper subset of the set Ek (i.e. £ i=- (J) and £ i=- Ek ), and D must be a partition {£!, ... , £.} of the set Ek , such that 1 < s < k:

(1) k = 3, f = X2 + Ij (2) k = 3, f = JO(X2 + 2x)j (3) k=3, f=(x2-Ty2)+lj (4) k = 3, f = X· fj - Y + Ij (5) k=4, f=h(x-X2)j (6) k = 4, f = J3(2x + X2)j (7) k = 4, f = x . Y - Y + 3j (8) k = 5, f = min(x2, Y)j (9) k=5, f=(2x 2-Ty)-lj (10) k=6, f=x 3 .y+2j (11) k is an arbitrary integer not less than 3, f = jl (2x -T X2)j (12) k is an arbitrary integer not less than 3, f = Jk-I(X· y -1).

3.2.3. (1) Let £ ~ Ek. Prove that T(£) i=- Pk if and only if £ is a proper subset of the set Ek (i.e. £ i=- (J) and £ i=- Ek)'

(2) Determine the number of different closed classes in Pk which preserve the sets.

(3) Let £ ~ Ek. Calculate the number of functions in Pk contained in the class T(£) and depending on the variables Xl, X2, ... , Xn (n 2:: 0).

3.2.4. (1) Let D = {£l' ... , £.} be a partition of the set Ek . Prove that U(D) i=- Pk if and only if 1 < s < k.

(2) For k = 3, 4 and 5, calculate the number of different closed classes in Pk

which preserve the partitions. (3) Let D = {£l' ... , £.} be a partition of the set Ek • Calculate the number

of functions in Pk contained in the class U(D) and depending on the variables Xl, X2, ... , Xn (n 2:: 0).

3.2.5. Let £ be nonempty subset in Ek other than the entire Ek and let D = {£, Ek \ £}. Calculate the number offunctions in Pk which depend on the variables Xl, X2, ... , Xn (n 2:: 0) and are contained in the set:

(1) T(£) \ U(D); (2) U(D) \ T(£);

Page 83: Problems and Exercises in Discrete Mathematics

74 CHAPTER 3. MANY- VALUED LOGICS

(3) T(E) U U(D).

3.2.6. By Sk, we denote the set of all different-valued functions in Pk which depend on a single variable (i.e. g(x) belongs to Sk if and only if g(Ek) = Ek). Let

pP) be the set of all functions of the k-valued logic h, which depend on a single

variable, and C Sk = p~1) \ Sk. (1) Prove that the sets Sk and CSk are closed classes. (2) Calculate the number of functions depending on the variable x and belonging

totheclassSknU({O, k-2}, {l, ... , k-3}, {k-1}). (Fork=3,weassume that {1, ... , k - 3} = CD.)

3.2.7. Expand the function f in Pk into a mod k polynomial: (1) f=2.x-;-x 2, k=5; (2) f = min(x 2, x 3 ), k = 5; (3) f = max(2· x -;-1, x 2 ), k = 5; (4) f=3·x-;-(x-;-2·x), k=7; (5) f = max((x -;-1)2, x3 ), k = 7; (6) f = min(x 2 , y), k = 3; (7) f=max(2·x-;-y, x'y), k=3; (8) f = x -;- y, k = 3; (9) f = Jk- 2(X), k is an arbitrary prime number; (10) f = h(x - x 2 ), k is an arbitrary prime number.

3.2.8. (1) Prove that the function 2j;(x) in P4 can be represented by a mod 4 polynomial for any i = 0, 1, 2 and 3.

(2) Prove that if a function in P4 , depending on a single variable, takes the values either from the set {O, 2} or from the set {1, 3}, it can be represented by a mod 4 polynomial.

(3) Using the function f(x, y) = 2· jo(x) . jo(y) (in P4 ), prove that statement (2) cannot be generalized to functions depending on more than one variable.

3.2.9. Prove that if a function f(x) in P4 cannot be represented by a mod 4 polynomial, then for any integer m 2: 2, the function (J(x))m cannot be represented by a mod 4 polynomial either.

3.2.10. Calculate the number of functions in P4 which depend only on a variable x and can be represented by mod 4 polynomials.

3.2.11. (1) Let a function f(x) in P6 be represented by a mod 6 polynomial. Prove that it can be represented by a mod 6 polynomial of the form ao + alx + a2x2.

(2) Prove that the number of functions in Ps, which depend on a variable x and can be presented by mod 6 polynomials, is equal to 108.

(3) Enumerate all the functions f(x) in Ps which can be represented in the form a + b· jo(x) (a and b belong to E6 ), cannot be represented by mod 6 polynomials, and satisfy the condition that the function (J( X))2 can be represented by a mod 6 polynomial.

3.2.12. Find out whether a function f in Pk can be represented by a mod k polynomial:

Page 84: Problems and Exercises in Discrete Mathematics

3.2. CLOSED CLASSES AND COMPLETENESS

(1) 1 = 3 . .r + 2· x 2 • k = 4; (2) 1 = 3 . jo(x), k = 6; (3) 1 = 2· (J1(X) + J4 (x)), k = 6; (4) 1 = (x + y) + y, k = 4; (5) 1 = (max(x, y) - min(x, y))2, k = 4.

75

In k-valued logics, the completeness testing of an arbitrary set of functions is fraught with serious technical difficulties because the application of the completeness criterion based on an analysis of the set of all precomplete classes in Pk involves the verification of a large number of conditions, even for k = 3 and 4 (since there are exactly 18 precomplete classes in P3 and 82 in P4 ). The completeness of concrete sets in Pk is normally proved by reducing them to sets known to be complete before-hand (like the Rosser-Turquette set {D, 1, ... , k-l, Jo(x), J1(x), ... , Jk-1(X), min(.r, y), max(.r, y)} or Post's set {X, max(x, y)}). Besides, there exist a number of completeness criteria in which we consider sets of functions containing some func­tions of a single variable and only one function which essentially depends on at least two variables. Let us formulate the most important criteria of this kind. It should be recalled that

Sk is a set of all different-valued functions in Pk , which depend on a single "ariable,

p~l) is a set of all functions of one variable in Pk and C Sk = pP) \ Sk. The fUIlction 1( x) E Pk is referred to as essential if it essentially depends on at least two variables and takes all k values in the set Ek •

Theorem 1 (J. Slupecki's criterion). A set p~l) U{f(x)} is complete in Pk (lor k 2: :3 }if and only if f (i) is an essential function.

Theorem 2 (S. V. Yablonsky's criterion). A set CSk U{f(x)} is complete in Pk

(for k 2: 3) if and only if f( x) is an essential function.

Theorem 3 (A. Salomaa's criterion). A set Sk U{f(x)} is complete in Pk (for k 2: ,5) if and only if f( i:) is an essential function.

The statements containing various completeness criteria for sets of functions in the sets p~1), Sk and C Sk, can be used along with these theorems, Let us consider an example of the application of such criteria. Let a function hij(x), where D -:; i < j -:; k - 1, be defined as follows:

if x = j, if x = i, otherwise.

Theorem 4 (S. Piccard), Each of the sets {x, h01(X), x + jo(x)} and

{h01(X), h02 {x), ... , hO(k-1){X), x + jo(x)} is complete in p~1).

Page 85: Problems and Exercises in Discrete Mathematics

76 CHAPTER 3. MANY-VALUED LOGICS

3.2.13. By choosing an appropriate class of the type T(£) or U(D), prove that the set A is incomplete in Pk if:

(1) A = {'" x, min(x, y), x. y2}; (2) A = {I, 2, X..;.- j2(X), max(x, y)}; (3) A = {2, jo(x), x + jo(x) + JI(x) + Jk-I(X), min(x, y)}; (4) A = {J2(X), x + jo(x), x + jo(x) + JI(x), max(x, y)}; (5) A = {k - 1, Jo( x ), x..;.- y, x . y . z }; (6) A= {2·x3 , 2·x+y, x2.y, x·Jo(y), x2+(",y)}; (7) A= {x·y, max(x, y)-z+I}; (8) A= {_x2, max(x, y)+z}; (9) A= {l, -X'y, X2..;.-y}; (10) A = {2, max(x, y), x..;.- y}; (11) A = {k - 2, '" jk-2(X), max(x, y), x + y}; (12) A= {j2(X), x+jo(x)+JI(x), X'y, x..;.-y}; (13) A = {I, Jo(x), x + jk-I(X), min(x, y), max(x, y)}; (14) A = {I, 2, ... , k - 1, x + jo(x), j2(X) + 1, max(x, y)}; (15) A = {I, '" x, x..;.- y, min(x, y)}; (16) A = {'" x, Jo(x), JI(x), ... , Jk-I(X), min(x, y) + (jo(x) + jo(Y)) (x + y)}; (17) A= {I-x, jo(x), jl(X), ... , jk-I(X), x'y, x";'-y, min(x, y)}.

3.2.14. It is known (see Sec. 3.1) that the set

A = {O, 1, ... , k - 1, jo(x), jI(X), ... , jk-I(X), x + y, X· y}

is complete in Pk .

(1) Prove that it is possible to isolate from A a subset which is complete in Pk

and consists of two functions. (2) Prove that any subset of the set A, which consists of a single function, is

incomplete in Pk .

3.2.15. The Rosser-Turquette set

Al = {O, 1, ... , k -1, Jo(x), JI(x), ... , Jk-I(X), min(x, y), max(x, y)}

is known to be complete in Pk (see Sec. 3.1). (1) Verify that, by omitting in Al any constant other than 0 and k -1, we obtain

a subset contained in a certain class of the type T(£), where (]) of. £ of. Ek (and, hence, is incomplete in Pk ).

(2) Isolate from the set Al a subset which is complete in Pk and consists of 2k - 2 functions.

3.2.16. For given k, test the completeness of the following subsets of the Rosser-Turquette set:

(1) k = 3, {I, Jo(x), J2(x), min(x, y), max(x, y)}; (2) k = 3, {I, 2, J2(x), min(x, y), max(x, y)}; (3) k = 4, {I, 2, Jo(x), JI(x), min(x, y), max(x, y)}; (4) k = 4, {I, 2, Jo(x), J3(x), min(x, y), max(x, y)}.

Page 86: Problems and Exercises in Discrete Mathematics

3.2. CLOSED CLASSES AND COMPLETENESS 77

3.2.17. Prove that each of the following sets is complete in Sk:

(1) {h01 (x), h02 (x), ... , hO(k-1)(Xn; (2) {h01(X), hdx), ... , hi ,(i+1)(X), ... , h(k-2),(k-1)(Xn; (3) {x, hOI(Xn·

3.2.18. Prove that the set {h01(X), h02 (x), ... , hO(k-1)(X), x + jo(xn is

complete in pP).

3.2.19. Using the method of reduction to sets which are known beforehand to be complete, prove the completeness in Pk of the following sets:

(1) {Jo(x), J1(x), ... , Jk-1(X), x2, X..;.- y}; (2) {k-I, x";'-y, x+y}; (3) {",x, x+2, x..;.-y}; (4) {-x, I-x2, x..;.-y}; (5) {x + y, ('" x) ..;.- 2y}; (6) {x, min(x, yn; (7) {min(x, y) - I}; (8) {J k-l (x), i + y, x . y }; (9) {I, x2+y, x2..;.-y}; (10) {Jo(x), x + y, X. y2}; (11) {k-2, x'y+I, ("'x)..;.-y}; (12) {k-I, x2 _y, x2 ..;.-y}; (13) {I, 2·x+y, x..;.-y}; (14) {I, x2 - y, min(x, yn; (15) {I, x+y+2, x2 ..;.-y}; (16) {x· jo(Y), min(x, yn·

3.2.20. Using the Slupecki criterion, prove the completeness in Pk of the following sets:

(1) {k-I, x-y+2, x2..;.-y}; (2) {h(x), X+y2, x·y+I}; (3) {x..;.-y, (",x) -y}; (4) {jl(X), x - y, x 2 - y}; (5) {x, jo(x), X· y}; (6) {x-I, (x+jo(x))·(I..;.-y)+(I..;.-x)·(y-jl(y)n; (7) {(I..;.- x)· y + x· (1..;.- yn; (8) {x· jo(x - y) + (x - iJ(x))· jo(y) + y. jo(xn; (9) {jo(x - y) + X· jo(y) + (x - j1(X))' jl(yn; (10) {x· io(Y) + jo(x), (y + jo(Y) - jl(Y)) + jl(X)' (y - jo(y)n; (11) {y. jo(x) + jl(X)' (y.+ jo(y)) + iJ(y)· (j2(X) - jl(X)n·

3.2.21. Test the completeness in Pk of the following sets: (1) {k-I, x+2, max(x, y)}; (2) {I, 2, x..;.- y}; (3) {k - 2, x + y, min(x, y)}; (4) {O. 1, T..;.-(",y)}; (.5) {2, 2·x+y, x2..;.-y};

Page 87: Problems and Exercises in Discrete Mathematics

78

(6) {I, 2, max(.y, y)}; (7) {2 -;- x, X· y, max(x, y)}; (8) {k-2, 2'T+Y, T-;-y}; (9) {~x, -T' y, min(T, y)}; (10) {2, x+y, x-;-y};

CHAPTER 3. MANY-VALUED LOGICS

(11) {"'x, 2·jo(x), JI(x), x-;-y}; (12) {l, rv x, Jo(x) + JI(x), max(x, y)}; (13) {O, 1, ~ x, 2 - jo(x) - 2· jl(X), min(x, y)};

(14) {I, k - 1, x -;- [~l ' min(x, y)}; (15) {k - 2, '" X, l' -;- y}.

3.2.22. Prove that the following sets are complete in Pk if and only if k is a prime number:

(1) {l, x+y+x·z}; (2) {x-y+ 1, x2 _y, X·y2}; (3) {T - 1. x + y. 1'2 . y}; (4) {k-l, x·y+x-y+z}; (5) {k-2, x+2·y, X·y2}; (6) {'" x, x - y, x2 . y}; (7) {x-2, x+2'y+l, x·y-x-y}; (8) {I, 2·x+y, X·y2_ X+ y }; (9) {x+y+1, x·y-x2}; (10) {:r - 2y, .r . y + x + I}; (11) {1+XI-X2+XI·X2· ... ·xd.

3.2.23. Prove that the following functions in Pk cannot be represented by mod k polynomials in the case of a composite k:

(1) ji(X), 0::: i::: k - 1; (2) max(x, y); (3) min(T, y); (4) T-;-y; (5) l' :J y; (6) (x -;- y) -;- z;

(7) any Sheffer's function (i.e. a function forming a complete system in Pd.

3.2.24. Having chosen, for a function I(x, y), the polynomials Qo(x), QI(X) and QAx) such that at least one of the functions QO(f(QI(X), Q2(y))) or QO(f(QI(X), Q2( 1'))) is known not to be expandable into a mod k polynomial, prove that for k = 4 and 6 the following functions cannot be represented by mod k polynomials:

(1) I=(2-;-x3).y; (2) I = ((rv x) + y) -;- (x -;-1); (3) I = mi n ( rv x, y) -;- (1 -;- x); U) I = max(1', y) -;- (x -;- 2).

3.2.25. Isolate the basis of the set A which is complete in Pk :

(1) A = {k - 1, jo(.r), jl(X), ... , jk-l(X), X· y, x -;- y}; (2) A = {x - 2, Jo(1'), max(x, y), x -;- y2, x2 . y};

Page 88: Problems and Exercises in Discrete Mathematics

8.2. CLOSED CLASSES AND COMPLETENESS

(3) A = {rv x, min(x, y), X· y, x + y}; ( 4) A = {k - 1, x + 2, max ( X, y), x -;.- y}; (5) A= {2, jo(x), X+y2, X2-;.-y, x·y·z}.

79

3.2.26. Let B be an arbitrary basis isolated from a Rosser-Turquette set. Prove that in this basis

(a) there exists at least one of the functions Ji (x), 0 :::: i :::: k - 2, (b) there does not exist the constant 0, (c) if Jo(x) E B, then k - 1 ~ B.

3.2.27. Prove that if a closed class in Pk has a finite complete set, the set of all different bases of this class is no more than countable. (Two bases are assumed to be different if one of them cannot be obtained from the other by redesigning the variables without identifying them.)

3.2.28. (1) Let A be a nonempty set of functions of one variable from Pk , which

differs from the entire set rp) and satisfies the following conditions: there exists a

precomplete class B in Pk , such that B n pP) = A. Prove that such a class B is umque.

(2) Prove that the number of precomplete classes in Pk , each of which does not contain the complete set pP), is smaller than 2kk.

3.2.29. (1) Prove that the closed class f{l = [x 2 . y2] in P3 contains neither constants nor identical function.

(2) Prove that the closed class f{2 = [jl(X)-j2(Y)] in P3 does not contain functions which essentially depend on a single variable.

3.2.30. Two functions in Pk are referred to as congruent if they can be obtained from each other by redesigning their variables without identifying them. Prove that the closed class f{3 = [j2(X) . h(y)] in P3 consists of a finite number of pairwise non congruent functions which essentially depend on all their arguments.

3.2.31. Let us consider the closed class

f{4 = [h(xd, h(XI, X2), h(XI, X2, X3), ... , fn(Xl' X2, ... , xn), ... J,

where fn(xn) = j2(XI)' j2(X2)· ... · j2(Xn), n = 1, 2, 3, .... It obviously contains an infinite number of pairwise non congruent functions. Prove that f{4 does not contain precomplete classes.

3.2.32. Calculate the number of essential functions in Pk which depend on the variables Xl, X2, ... , Xn(n 2: 2).

3.2.33. It is known that for k 2: 3, there exist in Pk , closed classes having no bases and closed classes with countable infinite bases. Let us consider the class

Ak = [12, ... , fm' ... J, where

{I for Xl = ... = Xi-l = Xi+! = ... = Xm = 2,

fm(XI' ... , xm) = Xi = l(l = 1, ... , m), o otherwise

Page 89: Problems and Exercises in Discrete Mathematics

80 CHAPTER 3. MANY-VALUED LOGICS

m:::: 2. The set {h, ... , 1m, ... } is a basis in Ak . Using the class Ak , prove that there exists in Pd k :::: 3) a continual family {R,} of closed classes which form a chain upon inclusion, i.e. only one of the inclusions B-y] C B-Y2 or B-Y2 C B-y] is valid for any two classes B-y] and B-Y2 in the family {B-y}.

Page 90: Problems and Exercises in Discrete Mathematics

Chapter 4

Graphs and Networks

4.1 Basic Concepts of Graph Theory

Let V be a finite nonempty set and X be a tuple of pairs of elements in V. The tuple X may contain both pair with identical elements and identical pairs. The set V and the tuple X define a graph with loops and multiple edges (to make it short, a pseudograph) G = (V, X). I

The elements of the set V are called vertices, while the elements of the tuple X are called the edges of the pseudograph. Edges of the type (v, v) (v E V) are called loops. A pseudograph without loops is referred to as a graph with multiple edges (or a multigraph). If none of the pairs is contained in the tuple X more than once, the multigraph G = (V, X) is called a graph. 2

If x = (u, v) is an edge of a graph, the vertices u and v are known as the ends of the edge x. If v is an end of the edge x, v and x are known to be incident. The vertices u and v of the graph G are called adjacent if there exists an edge of the graph G connecting them. Two edges are called adjacent if they have a vertex in common. The degree of a vertex v is defined as the number d( v) of edges of the graph which are incident to the vertex v. The degree of a vertex v in a pseudograph is equal to the total number of the edges incident to this vertex plus the number of the incident to it. A vertex of a graph of degree 0 is referred to as an isolated vertex, and a vertex of degree 1 is known as a terminal or pendant vertex.

The sequence (1)

in which vertices and edges alternate and such that for each i = 1, n - 1 the edge Xi has the form (Vi, Vi+I), is called the walk connecting the vertices VI and Vn. The number of edges in a walk is termed as the length of the walk. A sequence consisting of a single vertex is called a walk of length O. A walk in which all edges are pairwise different is known as a chain. A walk in which all vertices are pairwise different

IThe definitions given in this section coincide with (or are similar to) those presented in [19] and in the chapter "Graphs and Networks" in [7].

2Henceforth, all definitions are given for graphs. As a rule, these definitions can be extended naturally to multigraphs and pseudographs. When the differences in definitions are significant, definitions for pseudographs are formulated separately.

81

Page 91: Problems and Exercises in Discrete Mathematics

82 CHAPTER 4. GRAPHS AND NETWORKS

is called a simple chain. The walk (1) is called closed if VI = vn . A closed walk whose edges are pairwise different is called a cycle. A cycle in which all vertices, except the first and the last, are pairwise different is called a simple cycle. A graph is termed connected if, for any of its two vertices, there exists a chain connecting these vertices.

The distance between the vertices of a connected graph is defined as the length of the shortest chain connecting the vertices. The largest of these distances is called the diameter of the graph. The diameter of a graph G is denoted by D( G).

A subgraph of a graph G is a graph whose vertices and edges are all contained among the vertices and edges of the graph G. A subgraph is proper if it differs from the graph itself. A connected component of a graph G is its connected subgraph which is not a proper subgraph of any other connected subgraph of the graph G. A subgraph containing all the vertices of a graph is called a spanning subgraph. A subgraph of the graph G = (V, X) generated by the subset U ~ V is a graph H = ([1, Y) such that the set Y consists of those and only those edges of the graph G which both ends lie in U.

The graphs (pseudographs) G = (V, X) and H = (U, Y) are isomorphic if there exist two one-to-one correspondences '-P : V H U and1/;: X H Y such that for any edge x = (u, v) in X we have 1/;( x) = ('-P( u), '-P( v)). For graphs, this definition can be simplifyed. Graphs G = (V, X) and H = (U, Y) are isomorphic if there exists a one­to-one mapping '-P : V H U such that (u, v) E X if and only if ('-P( u), ip( v)) E Y. Such a mapping 'P is termed an isomorphic mapping (or isomorphism). An automorphism is an isomorphic mapping of a graph onto itself. The operation of omitting a vertex

from a graph G consists in the removal of a certain vertex together with the edges incident to it.

The operation of omitting an edge from a graph G = (V, X) consists in the removal of the corresponding pair from X. Unless stipulated otherwise, all the vertices are preserved in this case. The complement G of a graph G is a graph in which two vertices are adjacent if and only if they are nonadjacent in G. The operation of subpartition of the edge (u, v) in the graph G = (V, X) consists in the removal of the edge (u, v) from X, the addition of a new vertex w to V, and the addition of two edges (u,w) and (w,v) to X \ {(u,v)}. A graph G is called a subpartition of a graph Hif G can be obtained from H by the consecutive application of the edge subpartition operation. Graphs G and H are homeomorphic if they have subpartitions which are isomorphic. Let G = (V, X) and H = (U, Y) be two graphs. We shall denote by Gill H a graph known as the symmetric difference of the graphs

G and H with a set of vertices W = V U U and the set of edges Z = X ill Y consisting of those and only those edges which are included exactly in one of the sets X or Y. We shall denote by G x H the Cartesian product of the graphs G = (V, X) and H = (U, Y), i.e. a graph which vertices are pairs of the form (v, u)(v E V, u E U) and such that its vertices (VI, UI) and (V2' U2) are adjacent if and only if at least one of the pairs VI, V2 (in the graph G) or UI, U2 (in the graph H) is adjacent. The union

of the graphs G = (V, X) and H = (U, Y) is the graph E = (V U U, X U Y).

A tree is a connected graph containing no cycles. A graph without cycles is known as a forest. A graph is complete if any two of its different vertices are connected

Page 92: Problems and Exercises in Discrete Mathematics

4.1. BASIC CONCEPTS 83

by an edge. A complete graph with n vertices is denoted by Kn. An empty (null, completely disconnected) graph is a graph without edges. A single-vertex graph without edges is referred to as trivial. A graph is bipartite if the set of its vertices can be divided into two subsets (two fractions) 1.-) and V;, so that each edge of the graph connects the vertices of different fractions. A bipartite graph with fractions Vi and V; and the set of edges X will be denoted by (1.-), V;, X). If each vertex of 1.-) is connected by an edge with each vertex of V;, the graph is referred to as a complete bipartite graph. A complete bipartite graph (Vi, V2 , X) such that 11.-) I = nl, 1V21 = n2,

is denoted by K n1 ,n2'

A graph is assumed to be k-connected if the omission of any of its k - 1 vertices results in a connected graph differing from trivial. The vertex of a graph whose removal increases the number of connected components is known as a separating vertex, or a cut vertex. A graph is called a regular graph of degree d if all its vertices are of degree d. A regular graph of degree 1 is known as a matching and a regular graph of degree 3 is called a cubic graph. The k-factor of a graph is its spanning regular subgraph of degree k. The I-factor is known as a perfect matching. The maximum matching of a graph G is the matching containing the maximum number of edges. The Hamiltonian cycle of a graph is a simple cycle containing all the vertices of the graph. The Hamiltonian chain is a simple chain containing all the vertices of a graph. A unit n-dimensional cube is a graph En whose vertices are Boolean vectors of length n, and the edges are one-dimensional faces.

4.1.1. Prove that for an arbitrary graph G = (V, X), the equality 21XI LvEV d( v) is valid.

4.1.2. Let ik(G) be the number of vertices of degree k in a graph G. Determine the number of pairwise nonisomorphic graphs for which

(1) i 2(G) = i3(G) = i 4 (G) = 2, ik(G) = 0 for k i- 2,3,4; (2) i 2(G) = i3(G) = i 4(G) = 3, ik(G) = 0 for k i- 2,3,4.

4.1.3. Prove that in any graph without multiple edges and loops and which has no less than two vertices, there exist two vertices with identical degrees.

4.1.4. Prove that for any tuple of nonnegative integers (ko, kl , ... ), such that Li iki = 2m, there exists a pseudograph with m edges, which has exactly ki vertices of degree i for each i = 0,1, ....

4.1.5. Let do(G) be the least among the degrees of the vertices of an n-vertex graph G.

(1) Prove that if do(G) ;::: (n - 1)/2, the graph is connected. (2) Can l(n -l)/2J be substituted for (n -1)/2 in the previous statement?

4.1.6. Prove that any closed walk of an odd length contains a simple cycle. Is a similar statement valid for walks of an even length?

4.1.7. Prove that a connected graph with n vertices contains at least n-1 edges.

4.1.8. Prove that a connected graph with n vertices and c connected components has a number of edges not exceeding ~(n - c)(n - c + 1).

Page 93: Problems and Exercises in Discrete Mathematics

84 CHAPTER 4. GRAPHS AND NETWORKS

4.1.9. Prove that any nontrivial connected graph contains a vertex which is not a separating vertex.

4.1.10. Prove that any two simple chains of maximum length in a connected graph have at least one vertex in common. Do they always have a common edge?

4.1.11. Prove that if an arbitrary edge contained in a simple cycle is removed from a connected graph, the latter will remain connected.

4.1.12. Show that if a graph with n vertices contains no cycles of an odd length and if the number of edges exceeds (n - 1)2/4, the graph is connected.

4.1.13. Determine the number Pk (n) for which any graph with n vertices and Pk(n) cycles of length k is connected.

4.1.14. Let graphs G and H be isomorphic. Prove that

(1) for every d 2: 0, the number of vertices of degree d in the graphs G and H is the same;

(2) for every I the number of simple cycles of length I in graphs G and H is the same.

4.1.15. Prove that conditions (1) and (2) in Problem 4.1.14 are insufficient for the graph G and H to be isomorphic.

4.1.16. Find the pairs of isomorphic and nonisomorphic graphs among those shown in Figures 4.1-4.4. Justify your answer.

4.1.17. Let graphs G and H be 2-connected, have six vertices and eight edges each. The graph G has exactly two vertices of degree 2, while the graph H has four vertices of degree 3. Can we state that the graphs G and Hare

(1) isomorphic, (2) nonisomorphic?

4.1.18. Graphs G and Hare 2-connected, have six vertices and ten edges each. One vertex in each graph is of degree d (1 :S d :S 5), while the remaining vertices are of degree d1 (d1 < d). Prove that graphs G and H are isomorphic.

4.1.19. Prove that in a graph having no nontrivial automorphisms

(1) the distance between any two vertices of degree 1 is larger than two; (2) there exists a vertex of degree 3 or higher.

4.1.20. What is the number of automorphisms of a graph which is a cycle of length p?

4.1.21. Construct a graph without cycles which does not contain nontrivial automorphisms and has the minimum possible number of edges.

4.1.22. What is the smallest number n (n > 1) of vertices in a graph having no nontrivial automorphisms?

Page 94: Problems and Exercises in Discrete Mathematics

4.1. BASIC CONCEPTS 85

(a) Fig.4.1 (b)

(a) (b)

Fig.4.2

(a) Fig.4.3

(b)

(a) Fig.4.4

(b)

Page 95: Problems and Exercises in Discrete Mathematics

86 CHAPTER 4. GRAPHS AND NETWORKS

4.1.23. Let the degrees of all six vertices in a 2-connected graph having nine edges be the same, and the number of simple cycles of length 3 be two. Reconstruct the graph and determine the number of its automorphisms.

4.1.24. Let O( v) be the set of all vertices adjacent to v and 0'( v) = O( v) U {v}. Let Rn be the set of all graphs G with n vertices, which possess the following properties: for any two nonadjacent vertices u and v, either O( v) ~ O( u) or O( u) ~ O(v), and for any adjacent vertices u and v, either O'(v) ~ O'(u) or O'(u) ~ O'(v). Let G E Rn. Prove the following statements:

(1) all the vertices of the same degree in a graph G are either pairwise adjacent or pairwise nonadjacent;

(2) there is at least one vertex of degree n - 1; (3) if for a certain d the vertices of degree d are pairwise adjacent, the vertices

of a degree higher than d are also pairwise adjacent; (4) a graph G is uniquely determined (within isomorphism) by specifying the

degrees of its vertices; (5) the removal of a vertex in G leads to a graph in Rn - 1 •

4.1.25. Let n 2: 3, and let the family peG) = {Hb H2 , ... ,Hn } of graphs be specified so that a certain graph Hi is obtained from an n-vertex graph G by the removal of a vertex with a number i (i = I;n). It should be noted that the vertices in graphs Hi are not labelled. Prove that, using the family P( G), it is possible

(1) to determine the number of edges of the graph G; (2) to determine the degree of the vertex in each Hi whose removal from G leads

to the graph Hi; (3) to find out whether an arbitrary graph L having no more than n - 1 vertices

is a sub graph of the graph G; (4) to find out whether the graph G is connected; (5) to reconstruct the graph G if it is disconnected.

4.1.26. Let D(G) be the diameter of a graph G and a be a complement to the graph G. Prove that D(a) :s 3 if the graph G is disconnected or if D(G) 2: 3.

4.1.27. A graph G is termed self-complementary if the graphs G and a are isomorphic.

(1) Find a self-complementary nontrivial graph with the smallest number of vertices.

(2) Prove that a self-complementary graph is connected. (3) Prove that if G is a self-complementary graph, then 2 :s d( G) ~ 3.

4.1.28. Find the number of pairwise nonisomorphic graphs with 20 vertices and 188 edges.

4.1.29. Prove that if graphs G and H are homeomorphic, then (1) for every d i= 2, the number of vertices of degree d in both graphs is the

same; (2) there exists a one-to-one mapping of the set of simple cycles of the graph G

onto the set of simple cycles of the graph H, for which the number of vertices of degree d in the corresponding cycles is the same for all d i= 2.

Page 96: Problems and Exercises in Discrete Mathematics

4.1. BASIC CONCEPTS

(a)

(a)

(b)

Fig.4.5

(b) F' 46 Ig ..

87

(c)

4.1.30. Find out whether the graphs shown ill Fig. 4.5 contain subgraphs homeomorphic to the graph G if:

(1) G = ]{4 (see Fig. 4.6 a); (2) G = ]{s (see Fig. 4.6 b); (3) G = ]{3,3 (see Fig. 4.6 c).

4.1.31. The superdivision operation consists in the replacement of two adjacent edges (u, v) and (v, w), whose common vertex v is of degree 2, by a single edge (u, w). Applying the superdivision operation step by step, we can obtain from an arbitrary graph G containing vertices of degree 2 a pseudograph which does not contain vertices of degree 2. This pseudograph will be referred to as a complete superdivision of the graph G.

(1) Prove that a complete superdivision of graph G does not depend on the order in which the superdivision operation has been applied to pairs of adjacent edges of the graph G.

(2) Prove that the graphs G and H are homeomorphic if and only if their complete superdivisions are isomorphic (as pseudographs).

4.1.32. Prove that the Petersen graph (Fig. 4.5 a) has no Hamiltonian cycle, but the graph obtained from it by the removal of a vertex has a Hamiltonian cycle.

4.1.33. Prove that each of the graphs ]{n, ]{n,n, and Bn has a Hamiltonian cycle.

4.1.34. Let n be odd and B~ be a subset of vertices of a cube Bn, consisting of vertices of weight k. Let G be a subgraph of the cube Bn, generated by the set B~-l U Bill. Does a perfect matching exist in the graph G?

2 2

4.1.35. A graph G contains a Hamiltonian cycle, while a graph H contains a Hamiltonian chain. Is it true that a Hamiltonian cycle exists in the graph G x H?

Page 97: Problems and Exercises in Discrete Mathematics

88 CHAPTER 4. GRAPHS AND NETWORKS

4.1.36. Prove that if the condition d( u) + d( v) ~ n is .satisfied for any two vertices u and v of a connected n-vertex graph, then it has a Hamiltonian cycle.

4.1.37. Prove that any graph with n vertices, containing at least (n~l) +2 edges, has a Hamiltonian cycle.

4.1.38. Prove that a graph containing two nonadjacent vertices of degree 3 and other vertices of a degree not higher than 2, does not have a Hamiltonian cycle.

4.1.39. (1) Prove that D(G x H) S; D(G) + D(H).

(2) Is it true that D(G x H) S; max{D(G),D(H)}? 4.1.40. Prove that each regular connected graph of degree 2d can be represented

as the union of distinct 2-factors.

4.1.41. Prove that a graph K 2n can be represented in the form of a union of a I-factor and n - 1 Hamiltonian cycles.

4.1.42. Prove that a graph ]{2n+1 can be represented as the union of n Hamiltonian cycles.

4.1.43. Prove that a graph ]{n with labelled vertices contains ((n - I)!) /2 different Hamiltonian cycles.

4.1.44. Prove that the number of different perfect matchings in the graph ]{2n

with the labelled vertices is (2n)!/2n nL

4.2 Planarity, Connectivity, and Numerical Characteristics of Graphs

A graph is called planar if it can be drawn on a plane so that the arcs of the curves representing the edges intersect only at points corresponding to the vertices of the graph. Moreover, irrespective of the point of intersection, only the arcs corresponding to the edges, incident exactly with the vertex corresponding to a given point, converge at this point. Such a representation which maps a planar graph is called a fiat (or topological planar) graph. The internal face of a flat connected graph is defined as a finite region of a plane, bounded by a closed walk and containing neither vertices nor edges of the graph. The walk bounding a face is called a boundary of the face. The walk of a plane consisting of the points which do not belong either to the graph or to any of its internal faces, is called the external face. For 2-connected flat graphs (multigraphs) having n vertices, m edges and r

faces, the Euler formula n - m + r = 2 is valid. The following planarity criterion is also fulfilled.

Theorem (L. S. Pontryagin-K. Kuratowski). A graph is planar if and only if it does not contain subgraphs homeomorphic to the graph ]{5 and subgraphs homeomorphic to the graph ]{3,3 (Figures 4.6b, c).

Page 98: Problems and Exercises in Discrete Mathematics

4.2. PLANARITY AND CONNECTIVITY 89

The thickness of a graph G is the smallest number t( G) of its planar subgraphs whose union is equal to G. Each nontrivial connected flat pseudograph G can be put in correspondence with a dual pseudograph G* as follows. Within each face of the pseudograph G, we choose a vertex belonging to the graph G*. If x is an edge of the graph G, lying on the boundary between faces gl and g2, and VI and V2 are vertices of the pseudograph G* taken on these faces, the vertices VI and V2

are connected by an edge in G*. A flat pseudograph (graph) isomorphic to its dual pseudograph is referred to as self-dual. The cycles ZI, Z2,"" Zk of a graph G are linearly dependent, if for some ill i2, ... ,is (1 ::; il < i2 < ... < i. ::; k), the relation Zit EB Zi2 EB ... EB Zis = 0, is satisfied, where 0 is a graph without edges, and Z EB Y is the symmetric difference between the graphs Z and Y. Otherwise, the cycles ZI, Z2,"" Zk are referred to as linearly independent. The maximum number ~(G) of cycles in the set of linearly independent cycles of the graph G is termed the cyclomatic number of the graph G.

The colouring of the vertices (edges) of a graph is called correct if the adj acent vertices (edges) have different colours. The smallest number x( G) of colours for which there exists a correct colouring of the vertices of the graph G is known as the chromatic number of the graph G. The smallest number X'( G) of colours for which there exists a correct colouring of the edges of the graph G is called the edge chromatic number of the graph G.

The subset U of the vertices (edges) is called the cover of the set of vertices (or edges) of a graph G if each vertex (edge) of the graph either coincides with a certain element of the set U, or is adjacent to a certain element of U (accordingly, is incident with a certain element of U). A cover is terminal if it ceases to be a cover as a result of the omission of any element. A cover is minimal or shortest if it has the smallest number of elements. The smallest size of a subset U of the vertices of a graph G, such that each edge of the graph is incident with at least one vertex in U, is denoted by oo( G) and is called the vertex covering number. The smallest size of the subset Y of the edges of a graph G, such that each vertex of the graph is incident with at least one edge of Y, is denoted by 01 (G) and is called the edge covering number of the graph G. The set of vertices (edges) of a graph G is called independent if neither of its two elements are adjacent. By f3o(G) (resp. f31(G)) we denote the maximal size of an independent set of vertices (resp. edges) of a graph G. The number 130 ( G) (number 131 (G)) is called the vertex (resp. edge) independence number of the graph G. By ooo( G) we denote the smallest size of a set of vertices U such that each vertex of the graph G which is contained in U is adjacent to at least one vertex in U.

(a) (b)

FigA.7

Page 99: Problems and Exercises in Discrete Mathematics

90 CHAPTER 4. GRAPHS AND NETWORKS

4.2.1. Are the graphs shown in Figures 4.4a, band 4.5a, b, c planar?

4.2.2. For which n 2: 2 the graphs shown in Figures 4.7a and b are planar? 4.2.3. Let Gn = (Vi, V2,X) be a bipartite graph, Vi = {al,a2, ... ,an},

V2 = {b1,b2, ... ,bn}, X = {Xl,X2"",X n,Yl,Y2"",Yn,Zl,Z2, ... ,Zn}, where

Xi = (ai, bi), i = r,n, -,------,

Yi = (ai,bi+l), i = 1,n -l,Yn = (an,b1), Zi = (ai, bi+2), i = 1, n - 2, Zn-l = (an-l,b1 ), Zn = (a n,b2).

Determine n > 2 for which the graph Gn is planar.

4.2.4. (1) What is the minimal number of edges that have to be removed from the cube B4 for the obtained graph to be planar?

(2) What is the minimal number of vertices that have to be removed from B4 for the obtained graph to be planar?

4.2.5. Let G be a 2-connected flat graph having at least two internal faces. Prove that there exists a simple chain belonging to the boundary of the external face and such that its removal leads to a 2-connected flat graph with fewer faces.

Remark. The removal of a chain involves the removal of all its edges and internal vertices, while end vertices of the chain remain in the graph.

4.2.6. Using the result obtained by solving Problem 4.2.5, prove by induction that the number of internal faces in a flat 2-connected graph with n vertices and m edges is m - n + l.

4.2.7. Prove by induction over the number of edges that the cyclomatic number ~(G) of a pseudograph with n vertices, m edges and c connected components is equal to m - n + c.

4.2.8. Determine the cyclomatic number ~(G) for the graphs shown in Figures. 4.3 a, 4.4 a, and 4.5 a. Find a system consisting of ~(G) linearly independent cycles.

4.2.9. Prove that any planar graph contains a vertex of degree not higher than 5.

4.2.10. Prove that any planar graph having at least four vertices contains at least four vertices of a degree not higher than 5.

4.2.11. Prove that if each simple cycle in a connected planar graph with n vertices and m edges contains at least k edges, then m ~ k(n - 2)/(k - 2).

4.2.12. A flat connected graph whose every face (including the external face) is bounded by a cycle of length three is called a triangulation. Prove that any triangulation with n 2: 3 vertices has 3n - 6 edges and 2n - 4 faces.

4.2.13. Let t( G) be the thickness of a graph G. Prove that (1)

t(Kn) 2: [(n + 7)/6];

Page 100: Problems and Exercises in Discrete Mathematics

4.2. PLANARITY AND CONNECTIVITY 91

(2) t(Kn,m) ~ ]n· m/(2(n + m - 2))[;

(3) t(Bn) ~ ](n + 1)/4[.

4.2.14. Using Euler's formula, prove that graphs K3 ,3 and K5 are not planar.

4.2.15. Prove that a 2-connected graph with a cyclomatic number ( - 1 can be obtained from a 2-connected graph with a cyclomatic number ((( > 1) by removing a chain.

4.2.16. Construct a graph dual to the graph shown in Figure 4.3 a.

4.2.17. Prove that a pseudograph dual to a connected flat graph is connected and flat.

4.2.18. Prove that the cyclomatic number of a dual graph coincides with the cyclomatic number of the original graph.

4.2.19. Prove that if G has a separating vertex, G* has a separating vertex as well.

4.2.20. Prove that a pseudograph G* dual to a 3-connected flat graph G has no loops or multiple edges.

4.2.21. Determine the number of pairwise nonisomorphic self-dual flat 2-connected graphs with six vertices.

4.2.22. Prove that there exist no 6-connected planar graphs.

4.2.23. Prove that a graph dual to an n-vertex (n > 3) triangulation is a 2-connected flat cubic graph.

4.2.24. (1) Prove that a flat cubic graph which faces each have at least five vertices, contains no less than 12 vertices.

(2) Prove that if ri is the number of faces of a flat cubic graph, which are bounded by i edges, then L(6 - i)ri = 12.

4.2.25. Determine the chromatic numbers of the graphs shown in Figures 4.2-4.6.

4.2.26. Determine the edge chromatic numbers of the graphs shown in Figures 4.1-4.5.

4.2.27. Determine the chromatic and edge chromatic number of (1) the graph Kn; (2) the graph Kn,n; (3) the graph Bn.

4.2.28. What is the number of correct vertex colourings of the cube Bn for the minimal number of colours?

Page 101: Problems and Exercises in Discrete Mathematics

92 CHAPTER 4. GRAPHS AND NETWORKS

4.2.29. Prove that the edge chromatic number of the Petersen graph shown in Figure 4.5a is equal to four, but for any of its subgraphs G with eight vertices, X'( G) ::; 3. Is the inequality X'( G) ::; 3 valid for an arbitrary proper subgraph of the Petersen graph obtained as a result of the removal of a vertex?

4.2.30. Prove that four colours are sufficient for the correct edge colouring of any cubic multigraph.

4.2.31. Prove that all edges of a flat cubic graph can be coloured in two colours a and b so that each vertex is incident with an edge of colour a and to two edges of colour b.

4.2.32. Prove that it is enough to have six colours for a correct colouring of the vertices of any flat graph.

4.2.33. Prove by induction over the number of vertices that the inequality X( G) ::; 5 is valid for a flat graph G.

4.2.34. Construct a flat graph G with the minimal possible number of vertices and such that X( G) = 4.

4.2.35. The vertices of a graph G are numbered in the order of increasing degrees. Prove that if k is the highest number for which k ::; d( Vk) + 1, then X( G) ::; k.

4.2.36. The operation of contraction consists in the removal of two adjacent vertices from a graph and the addition of a new vertex adjacent to those of the remaining vertices which were adjacent to at least one of the removed vertices. Prove that the graph obtained as a result of contraction to a planar graph is planar.

4.2.37. Let 1 be the length of the longest simple chain in a graph G. Prove that x( G) ::; 1+ 1.

4.2.38. Let d be the highest of the degrees of vertices of a graph G. Prove that (1) X(G) ::; d + 1; (2) X'( G) ::; d + 1.

4.2.39. Let p be the maximum number for which there exists a subgraph of a graph G isomorphic to the graph Kp. Prove that X( G) 2:: p.

4.2.40. Prove that for a graph G with n vertices, the following inequalities are valid:

(1) f3o(G) . X(G) ::; n; (2) X( G) . X( G) 2:: n.

4.2.41. What is the smallest number n for which there exists an n-vertex nonplanar graph with a nonplanar complement?

4.2.42. Determine the thickness of the graph K 8 •

4.2.43. Prove that Qo(G) + fJo(G) = Ql(G) + fJl(G) = n for an arbitrary connected graph G with n (n > 1) vertices.

4.2.44. (1) Give an example contradicting the following statement: any vertex cover contains the minimal vertex cover.

Page 102: Problems and Exercises in Discrete Mathematics

4.3. DIRECTED GRAPHS

(2) Prove that any vertex cover contains a terminal vertex cover.

4.2.45. Determine the number of terminal and minimal edge covers for (1) a chain of length m; (2) a cycle of length n;

(3) Petersen's graph (Figure 4.5 a).

93

4.2.46. Prove that for any graph G, the inequalities ao(G) :::: f31(G) and al(G) :::: f31 (G) are valid.

4.2.47. Prove that for any graph G, the inequality aoo(G) :::; ao(G) is valid.

4.2.48. Prove or refute the following inequality: f3o( G) :::; aoo( G).

4.2.49. Let U ~ V be a subset of vertices of a graph G = (V, X) and let v(U) bp the number of vertices v E V \ U which are not adjacent to any vertex in U. Let

1 Vk(G) = (IVI) L v(U).

k u<;:v,IU!=k

(1) Prove that aoo( G) :::; k + Vk( G). (2) Let do be the lowest degree of vertices of a graph G. Prove that

(3) Prove that the following inequality is valid for a regular graph G of degree d with n vertices:

n n d :::; aoo(G) :::; 1 + d(1 + lnd).

4.2.50. Prove that if do is the lowest degree of the vertices of a graph G, then au( G) :::: do.

4.2.51. If G is a bipartite graph and m is the number of its edges, then m :::; ao( G) . f3o( G). Prove that the equality is attained only for complete bipartite graphs.

4.3 Directed Graphs

A directed pseudograph D = D(V, X) is defined by specifying a nonempty (finite) set V and tuple X of ordered pairs of elements in V. The elements of the set V are called vertices, and the elements of the tuple X are called arcs (or directed edges) of the directed pseudograph D(V, X). The tuple X may also contain pairs of the form (v, v) referred to as loops, and identical pairs known as multiple (or parallel) arcs. The pairs (u, v) and (v, u) are assumed to be identical if and only if u = v. A directed multigraph is the term applied to a directed pseudograph containing no loops. If a directed pseudograph has neither loops nor multiple arcs, it is called a directed graph (or simply a digraph). An oriented graph is a digraph having no

Page 103: Problems and Exercises in Discrete Mathematics

94 CHAPTER 4. GRAPHS AND NETWORKS

symmetric pairs of directed edges, i.e. the tuple X cannot simultaneously contain an arc (u, v) and an oppositely directed arc (v, u).

Let x = (u, v) be an arc of a directed pseudograph. Then the vertex u is called the initial vertex (origin), and the vertex v is the terminal vertex (end) of the arc x. In this case, the arc x is also said to emerge from the vertex u and terminate at the vertex v. If a vertex v is the origin or the end of an arc x, v and x are said to be incident. The out-degree of a vertex v (of a pseudograph D) is the number of arcs of the pseudograph D emerging from the vertex v. The out-degree of the vertex v is denoted by od( v) or d+ (v). Similarly, the in-degree of a vertex v (denoted by id ( v) or d- ( v )) is the number of arcs of the pseudograph terminating at the vertex v.

By replacing each ordered pair (u, v) in the tuple X of a directed pseudograph D (1/, X) by a disordered pair {u, v} consisting of the same elements u and v, we obtain a pseudograph G = (V, XO) associated with D (V, X).

Directed pseudographs DI (V1, XI) and D2 (V2, X2) are said to be isomorphic if there exist two one-to-one correspondences tp : Vi H 112 and 1jJ : Xl H X2 such that for any arc x = (u, v) E XI, the relation 1jJ(x) = (tp(u), tp(v)) is valid. The isomorphic mapping of a directed pseudograph onto itself is referred to as the automorphism of the pseudograph. All automorphisms of a directed pseudograph form a group relative to the operation of multiplication (successive application) of automorphisms. This group is referred to as a group (of automorphisms) of the directed pseudograph. The operation of omission of a vertex and an arc, as well as the concepts of subgraph, spanning subgraph and generated subgraph for directed pseudographs are defined as in the case of nondirected pseudographs.

In contrast to the definitions of the corresponding "nondirected" concepts, the definitions of directed walk, closed walk, chain, cycle, simple chain and simple cycle contain the requirement that the sequence (of vertices and arcs)

satisfies the condition that each arc Xi (1 :s i :s n - 1) has the form (Vi, Vi+1), i.e. the vertex Vi is the origin of the arc Xi and the vertex Vi+1 is its end. It is assumed that a directed (u-v )-walk is directed from its initial vertex u to the terminal vertex v. The length of a walk is equal to the number of arcs contained in it. The distance p (u, v) from the vertex u to the vertex v is defined as the shortest length of the (u­v)-walk. A directed walk is often referred to as just a path, while a directed simple cycle is known as a contour or directed cycle.

A directed simple spanning chain is called a Hamiltonian path (Hamiltonian chain). A Hamiltonian contour is the spanning contour of a directed pseudograph. If a directed pseudograph contains a Hamiltonian contour, it is called a Hamiltonian pseudograph.

A vertex v of a directed pseudograph is said to be accessible from a vertex u if there exists a (u-v )-path in the pseudograph, i.e. the path emerging from the vertex u and terminating at the vertex v.

A directed pseudograph is strongly connected (or strong) if any vertex in it is accessible from its any other vertex. A directed pseudograph is called unilaterally connected (or unilatera~ if, for any two of its vertices, at least one is accessible from

Page 104: Problems and Exercises in Discrete Mathematics

4.3. DIRECTED GRAPHS 95

the other. A directed pseudograph D (V, X) is assumed to be weakly connected (or wak) if a pseudograph (V, XO) associated with it is connected. If a directed pseudograph is not connected, even weakly, it is referred to as disconnected. A trivial digraph consisting of only one vertex is assumed (by definition) to be strongly connected.

A strong component of a digraph D is the term applied to any of its directed subgraphs which is a strong directed graph contained in no other strongly connected directed sub graph of the digraph D. Similarly, a unilateral component is the maximum unilateral subgraph of the digraph D, while a weak component is the maximum weak subgraph. The concepts of strong, unilateral and weak components are naturally generalized to the case of a directed pseudograph.

Let., = {SI, S2, ... , Sn} be a set of all strong components of a digraph D. The condensation D* of the digraph D is the digraph in which the set of vertices is ., and the arc (Si, Sj) is contained in the digraph D* if and only if the digraph D contains at least one arc emerging from a vertex of the component Si and terminating at a vertex of the component Sj.

If D = D (V, X) is a digraph, the digraph D' inverse to it is specified by the same set of vertices V and a set of arcs X' such that an arc (u, v) belongs to X' if and only ifthe arc (v, u) belongs to X.

A vertex v of a digraph D is called a source if any other vertex of the digraph D is accessible from it. The sink of a digraph D is any of its vertices v which is a source in the digraph D' inverse to digraph D.

Let D be a digraph for which a digraph associated with it is a tree. Then the digraph G is called an arborescence (or a growing tree) if it has a source. A directed pseudograph is assumed to be complete if any two different vertices in it are joined by at least one arc.

A complete oriented graph is known as a tournament.

Let D be an n-vertex digraph and let V = {VI, V2, ... , v n } be the set of its vertices. The adjacency matrix of a digraph D is an (n x n)-matrix A (D) = Ilaijll in which aij = 1, if the arc (Vi, Vj) belongs to D and aij = 0 in the opposite case. Moreover, we assume that the set of all arcs of the digraph D is also numbered: X = {Xl, X2, ••• , x m }. The incidence matrix (or matrix of incidence) of a digraph D is an (n x m)-matrix B (D) = Ilbijll in which

{I if the vertex Vi is the origin of the arc x j,

bij = -1 if t.he vertex Vi is t.he end of the arc x j,

o if the vertex Vi is not incident with the arc Xj'

4.3.1. Disprove the following statement: if out- and in-degrees of any vertex of a digraph are positive and even, there exists for each vertex of the digraph a contour containing it.

4.3.2. Let a digraph D (V, X) be weakly connected, V = {VI, V2, ... , Vn },

n 2: 2 and d+ (vt) - d- (vt) = 1, d+ (V2) - d- (V2) = -1, d+ (Vj) = d- (Vj)

for j = 3, ... , n. Prove that the digraph D contains a directed (vrv2)-chain including all the arcs of the digraph.

Page 105: Problems and Exercises in Discrete Mathematics

96 CHAPTER 4. GRAPHS AND NETWORKS

4.3.3. Prove that a digraph is strongly connected if and only if it contains a directed spanning closed walk.

4.3.4. Prove that a weak digraph is strongly connected if and only if it has a directed closed walk containing each arc of the digraph at least once.

4.3.5. Let us suppose that a digraph D can be presented in the form of a union of certain of its directed closed walks Db D2 , ••• , Dk (k ~ 1) which satisfy the following condition: every two walks Dj and Dj+l (1 ~ j ~ k - 1) have at least one vertex in common. Prove that the digraph D is strongly connected.

4.3.6. Prove that any tournament contains a Hamiltonian path.

4.3.7. Prove that a tournament T is a strong digraph if and only if T has a spanning contour (i.e. is a Hamiltonian tournament).

4.3.8. Let {VI, V2, . .. ,vn } be a set of vertices of a tournament. Prove that

n n

L (d+ (Vi))2 = L (n - 1 - d+ (Vi)? i=1 i=1

4.3.9. Let the out-degree of the vertex V of tournament T be not lower than the out-degree of each other vertex of the tournament. Prove that the distance from the vertex V to any other vertex of the tournament does not exceed 2.

4.3.10. Let S be some subset of arcs of a tournament T. The arcs of the subset S are called concordant if the vertices of the tournament T can be renumbered so that the fact that the arc (Vi, Vj) belongs to the subset S implies that i < j. Let f (n) be the largest integer such that each n-vertex tournament (n ~ 3) contains the subset S consisting of f (n) concordant arcs. Prove that

f (n) ~ In/2J . l(n + 1)/2J.

4.3.11*. Prove that the number of directed cycles of length 3 in an n-vertex tournament does not exceed

t( ) = { n(n2 -1)/24 ifn is odd, n n(n2 _ 4)/24 if n is even.

4.3.12. Prove that the group of automorphisms of any tournament has an odd order (i.e. consists of an odd number of elements).

4.3.13. Prove that the condensation D* of an arbitrary digraph has no contours.

4.3.14. Prove that a digraph D is unilateral if and only if its condensation D* has a unique oriented spanning chain.

4.3.15. A digraph D(V, X) is called transitive if the fact that arcs (u, v) and (v, w) belong to the set X implies that the set X contains the arc (u, w). Prove that the condensation of any tournament is a transitive tournament.

4.3.16. An acyclic or contour-free digraph is a digraph containing no directed cycles or contours. Prove that a acyclic digraph contains a vertex with zero out­degree.

Page 106: Problems and Exercises in Discrete Mathematics

4.3. DIRECTED GRAPHS 97

4.3.17. Prove that a digraph is isomorphic to its condensation if and only if it is acyclic.

4.3.18. Let a digraph D be weakly connected but not unilateral. Prove that there is no vertex in D such that its omission leads to a strong digraph.

4.3.19. Prove that a weak digraph is an arborescence if and only if only one of its vertices has zero in-degree, the in-degree of any of the remaining vertices being equal to unity.

4.3.20. Let Sn be a symmetric group of permutations operating on the set {I, 2, ... , n}, n 2: 2. Let us consider an arbitrary set T of transpositions in the group Sn. We put in correspondence to the set T a digraph D (V, XT) in which V = {I, 2, ... , n} and the arc (i, j) belongs to XT if and only if i < j and the transposition (ij) is contained in the set T. Prove that the set T forms a basis in Sn (or, in other words, the set T is an irreducible system of generators of the group Sn) if and only if the digraph D (V, X T ) is an arborescence.

4.3.21. Prove that a complete strongly connected digraph is a Hamiltonian digraph.

4.3.22. Prove that a complete digraph contains a source.

4.3.23. Verify that any transitive tournament has a single Hamiltonian path.

4.3.24. Prove that the number of all different Hamiltonian paths in each tournament is odd.

4.3.25. Let a complete strongly connected digraph have n vertices (n 2: 3). Prove that for any k (3 s: k s: n), there exists for any vertex of the digraph a contour of length k containing this vertex.

4.3.26. Let D (V, X) be a complete strongly connected digraph for which IVI 2: 4. Prove that the digraph D contains two different vertices VI and V2 satisfying the following condition: digraphs D1 and D2 obtained from the digraph D as a result of the removal of the vertices VI and V2 (respectively) are strongly connected.

4.3.27. We shall denote by Aq the q-th degree of the adjacency matrix A (D) = Ilai) II of a digraph D. Prove that the (i, j)-th element a;;) of the matrix Aq is equal to the number of all (vi-vj)-walks of length q (in the digraph D).

4.3.28. Let B be the incidence matrix of a digraph D (V, X). Prove that the subset Xl <::: X of arcs of the digraph D generates a simple cycle (not necessarily oriented) if and only if the set of columns corresponding to these arcs (in matrix B) is linearly dependent, and each of its proper subsets does not possess this property.

4.3.29. Prove that the determinant of any square submatrix of the incidence matrix B (D) of a digraph D is equal to 0, or +1 or -l.

4.3.30. Let B be the incidence matrix of a weakly connected n-vertex digraph D, and the matrix 13 be obtained from B by deletion of any (one) row. Prove that there exists a one-to-one correspondence between different directed trees of the digraph

Page 107: Problems and Exercises in Discrete Mathematics

98 CHAPTER 4. GRAPHS AND NETWORKS

D (which are treated as directed subgraphs of the digraph D) and nondegenerate (n - I)-order submatrices of the matrix E.

4.3.31. Let a matrix E be a submatrix of the incidence matrix B of a weakly connected digraph D, described in the previous problem. By E', we shall denote a matrix transposed relative to the matrix E. Prove that the number of different directed trees in the digraph D is equal to the value of the determinant of the matrix E· E'.

4.4 Trees and Bipolar Networks

A k-pole network is a pseudograph G = (V, X) with k selected vertices. These vertices are called poles. Thus, a network is defined by the pseudograph G = (V, X) and a subset P ~ V of the poles. A network r with a set of poles P and a pseudograph G = (V, X) will be denoted by (Pj V, X). Two k-pole networks are isomorphic if there exists an isomorphism between their pseudographs transforming the poles of the first network onto the poles of the second one.

A one-pole network the pseudograph of which is a tree, is called a rooted tree. The single pole of such a network is called a root. A fiat rooted tree is the map of a graph on a plane. This concept can be defined by induction as follows. The network shown in Figure 4.8 a is a flat rooted tree. If A and B (see Figure 4.8 b) are flat rooted trees, the figures C, D and E (Figures 4.8 c and d) are also flat rooted trees. We shall assume that an arbitrary flat rooted tree is mapped onto a flat with a cut which is a ray emerging from the root (see Figure 4.8 e). Here we can assume that the edges incident with the root are numbered clockwise by 1, ... , m, where m is the degree of the root. If we remove the edge with number i from such a flat rooted tree, we shall obtain a graph with two connected components. The component which does not contain a root will be called the i-th branch of the original rooted tree. The vertex incident with the i-th edge (in the original tree) will be treated as the root of the i-th branch. For an arbitrary rooted tree A, we denote by do (A) the degree of its root. Flat rooted trees A and B are called identical if either do (A) = do (B) = 0 or do (A) = do (B) = m > 0 and for any i = 1, m, the i-th branches of the trees A and B are identical. Two trees

D~fl:[Y c=a=b c=a=b

(a) (b) (c) (d) (e)

FigA.8

which are not identical are referred to as different. Thus, trees D and E are different (see Figure 4.8 d) if the trees A and B (see Figure 4.8 b) are different. Each flat rooted

Page 108: Problems and Exercises in Discrete Mathematics

4.4. TREES AND BIPOLAR NETWORKS 99

tree T with m edges can be put in one-to-one correspondence with a binary vector of length 2m, known as a code of the tree. A tree with a single edge corresponds to the vector Ol. If the vectors a and ~ are put in correspondence with trees A and B (Figure 4.8 b), respectively, then the vector 001 is put in correspondence with the tree C (Figure 4.8 c), and the vectors o~ and ~o are put in correspondence with the trees D and E (Figure 4.8 d).

Henceforth, unless stipulated otherwise, the term network will mean a two-pole network. The network r({a, b}; V, X) will be briefly denoted by r(a, b). The subgraph of such a network is the subgraph of the graph (V, X). A vertex of a nontrivial subgraph G of the network r is called boundary vertex if it is either a pole or incident with a certain edge of the network, which does not belong to the subgraph G. We shall call a nontrivial subgraph of a network a shoot if it has a unique boundary vertex. A subnetwork of a two-pole network is its subgraph having exactly two boundary vertices. These vertices are the poles of the subnetwork.

A network is connected, if its graph is connected. A connected network (or subnetwork) having a single edge is called trivial. A connected network is called strongly connected if each edge lies in a simple chain connecting the poles of the network. A strongly connected network is known to be decomposable if it has at least one nontrivial subnetwork.

(a) S (b)

Fig.4.9

Otherwise, it is assumed to be nondecomposable. Let r (a, b) be a decomposable network, G (c, d) its nontrivial subnetwork, and r 1 (a, b) be a network obtained from r (a, b) by substituting an edge (c, d) for the subnetwork G (c, d). Then the network r(a, b), in turn, can be obtained by substituting the network G(c, d) for the edge (c, d) of the network r 1 (a, b). Thus, the decomposable network r(a, b) can be defined by specifying the network r 1 ( a, b) edge (c, d) of the network r 1 (a, b), and the network G (c, d). Such a definition is referred to as the decomposition of the network r (a, b). A network r 1 (a, b) is called the external and the network G (c, d) the internal network of the decomposition. A network r (a, b) is called the superposition or composition of the networks r 1 (a, b) and G (c, d). A network consisting of m parallel edges joining the poles a and b is denoted by r~ (a, b) or simply r;;,. A network the graph of which is a simple chain of length m and which

Page 109: Problems and Exercises in Discrete Mathematics

100 CHAPTER 4. GRAPHS AND NETWORKS

joins the poles a and b, is denoted by r:., (a, b) or simply r:.,. A network that can be obtained from networks r~ and r~ by applying a finite number of substitutions of a network for an edge is referred to as a series-parallel network, or a 'Jl'-network. A nontrivial nondecomposable network r (a, b) differing from r~ (a, b) and q (a, b) is called an H-network.

A decomposable network is called p-decomposable (s-decomposable) if a certain external network of the decomposition has the form r!;. (resp. r:.,), m 2: 2. If a certain external network of the decomposition of a network r is an H-network, then r is referred to as H-decomposable. Any decomposable network is either p-, or s-, or H-decomposable. A canonical p-decomposition of a network is a p-decomposition for which the internal networks of the decomposition are other than networks of the type r~ and other than p-decomposable networks. The canonical s-decomposition is defined in a similar way. The canonical H-decomposition is a decomposition which external network is an H-network.

Each 'Jl'-network r with m 2: 1 edges can be put in correspondence with a flat rooted tree T (r) with m terminal vertices, such that (a) each vertex of the tree T (r) other than a terminal vertex, is labelled by a symbol p or s; (b) the labels p and s alternate on each chain emerging from the root to a terminal vertex; and (c) vertices other than the root have a degree other than two. The terminal vertices of the tree T (r) are not labelled. The tree T (r) is defined by induction. If r has the form r!;. (or r:.,), then T (r) is a tree the root of which is labelled by the symbol p (resp. s), while the remaining m vertices are terminal, adjacent to the root and are not labelled. If a network r is decomposable and other than the networks of the type described above, and the external network of the decomposition has the form r~ (or rk), while the internal networks are just GI, G2 , ••• , Gk , the tree T (r) is constructed as follows. Let T(G1 ), T(G2), ••• , T(Gk ) be the trees corresponding to the internal networks of the decomposition. Then, for the root of T (r), we take a vertex of degree k, labelled by the symbol p (resp. s). The vertices adjacent to the root are labelled by the symbol s (resp. p). The vertices VI, V2, ..• , Vk adjacent to the root are identified with the roots of the trees T (Gd, T (G2 ), ••• , T (Gk ).

For example, the 'Jl'-network shown in Figure 4.9 a corresponds to the tree shown in Figure 4.9 b.

A tree T (r) is called a diagram of the canonical decomposition of a 'Jl'-network r. It should be noted that if the external network of the decomposition of a network r has the form r%(a, b), and the internal networks G1(a, ud, G2(Ul, U2), ... , Gk (Uk-I, b) are substituted for the edges (a, ud, (Ul' U2), ... , (Uk-I, b), respectively, the vertices VI, V2, ••• , Vk in the tree T (r), which are identified with the roots of flat rooted trees T(Gd, T(G2), ... , T(Gk), follow one another from left to right in an increasing order of numbers. Thus, the tree T (r') shown in Figure 4.10b is a diagram is a diagram of the canonical decomposition of the network r' (Figure 4.10a) but is not a diagram of the network r (see Figure 4.9a).

Page 110: Problems and Exercises in Discrete Mathematics

4.4. TREES AND BIPOLAR NETWORKS 101

s (a) (b)

Fig.4.l0

A vertex of a network, other than a pole, is referred to as internal. A vertex v depends on a vertex u if any simple chain joining the poles and passing through v passes through u as well. Vertices v and u are equivalent if v depends on u and u depends on v. A vertex v is weaker than a vertex u, while the vertex u is stronger than the vertex v if v depends on u but is not equivalent to it. A vertex v is called minimal if it is not weaker than any other internal vertex of a network. Henceforth, we shall call a simple chain joining the poles of a network a chain of the network. The cases when the term "chain" is used in a different sense will always be stipulated. A chain of a network will be assumed to be the shortest if it has the minimum possible length. The length of a network is equal to the length of its shortest chain. A cut is a set of the edges of a network the deletion of which destroys all the chain. A cut is called terminal if none of its subsets is a cut. A cut is referred to as minimal if it has the minimum possible number of edges. The number of edges in the minimal cut is called the width of a network.

4.4.1. Let G be a graph with n ~ 2 vertices. Prove the equivalence of the following statements:

(1) G is a connected graph with n - 1 edges; (2) G is a connected graph which, however, becomes disconnected as a result of

deletion of any of its edges; (3) any pair of different vertices of the graph G is joined by a unique chain; (4) G is a graph without cycles, but the addition of an edge joining any two

nonadjacent vertices leads to the emergence of a cycle.

4.4.2. Prove that any tree with n ~ 2 vertices has at least two terminal vertices.

4.4.3. Prove that if the number of terminal vertices in a nontrivial graph G is equal to the number of edges, G is either disconnected or is a tree.

4.4.4. Let F (G) = {HI, H2 , .•. , Hn} be a family of graphs in which the graph Hi is obtained from an n-vertex graph G by deleting a vertex with the number i (i = 0). The vertices in the graphs Hi are not labelled. Prove that

Page 111: Problems and Exercises in Discrete Mathematics

102 CHAPTER 4. GRAPHS AND NETWORKS

(1) it can be found out from the family F (G) whether the graph G is a tree; (2) if G is a tree, it can be uniquely reconstructed from F (G) (accurate to an

isomorphism) .

4.4.5. The intersection of two graphs G and H is a graph G n H all the vertices and edges of which belong to both G and H. Prove that a nonempty intersection of two subtrees of a tree is a tree.

Let Pc (v, w) be the distance between vertices v and w in a graph G = (V, X). The vertex Uo for which

max Pc (uo, v) = min max Pc (u, v) vEV uEV vEV

is called the center of the graph, and the number R (G) = maxvEV pc (uo, v) is called the radius of the graph.

4.4.6. (1) Determine the number of centers in the graph (a) G (see Figure 4.4a); (b) G (see Figure 4.4b); (c) G = f{n l,n2'

(2) Prove that any tree contains not more than two centers.

4.4.7. Prove that a tree has one center if its diameter is an even number and two centers when the diameter is odd.

4.4.8. (1) Let D (G) be the diameter and R (G) the radius of a graph G. Prove that R(G)::; D(G)::; 2R(G).

(2) Prove that if G is a tree, then R (G) =1 D (G) /2 r. (3) Give an example of a graph G for which R (G) = D (G).

4.4.9*. Prove that a tree can be uniquely reconstructed (correct to an isomor­phism) if pairwise distances between its terminal vertices are specified.

4.4.10. Prove that any two simple chains of maximum length in a tree with an odd diameter have at least one edge in common.

4.4.11. An infinite tree is the term applied to a graph with a countable set of vertices satisfying the following condition: for any two vertices u and v of the graph, there exists a unique simple (u-v )-chain with a finite length. Prove that if the degree of each vertex of an infinite tree is finite, there exists, for any vertex, a simple chain of infinite length which contains this vertex.

4.4.12. Let P = {VI, V2, ... } be an infinite simple chain. Let G = f{2 X P. What is the power of the set of all spanning trees of the graph G?

To compute the number of spanning trees in a graph the following well-known statement is used (Prove it or see [19]):

Theorem (G. Kirchhoff). Let G = (V, X) be a multigraph with a set of vertices V = {VI, V2, ... , vn }! and M (G) = Ilaij II be a quadratic matrix of order

Page 112: Problems and Exercises in Discrete Mathematics

4.4. TREES AND BIPOLAR NETWORKS 103

n, where

{ d( Vi) for i = j;

aij = -1 for i =/=- j and (Vi, Vj) E X; o fori =/=-j and (Vi, Vj) rf- X.

Than all signed minors of M (G) are equal to each other and their common value is equal to the number of pairwise different spanning trees of a graph G.

4.4.13. Determine the number of spanning trees of the graphs shown III

Figures 4.2 a, band 4.6 a, b, if the vertices of the graphs are numbered.

4.4.14. What is the chromatic number of a tree with n :2: 2 vertices?

4.4.15. Is it true that if the diameter of a graph Gis k (k > 2), there exists a spanning tree the diameter og which is equal to k?

4.4.16. Prove that for n :2: 3, the number of pairwise nonisomorphic rooted trees with n vertices is at least double the number of pairwise nonisomorphic trees with n vertices having no roots.

4.4.17. Let a rooted tree with n (n :2: 2) terminal vertices have no vertices of power 2 other than a root. Prove that the total number of vertices of the tree does not exceed 2n - 1.

(a) (b)

Fig.4.11

4.4.18. Construct the codes of flat rooted trees shown in Figure 4.11 a and b.

4.4.19. Using a given code a, construct a flat rooted tree if: (1) a = (001010011011); (2) a = (0100011001101011); (3) a = (0001010110011011); (4 a = (001010101000111011); (5) it = (01001001011001101011);

Page 113: Problems and Exercises in Discrete Mathematics

104 CHAPTER 4. GRAPHS AND NETWORKS

(6) ~ = (0100110011001100100111).

4.4.20. (1) Determine the number of pairwise nonisomorphic rooted trees with four edges.

(2) Determine the number of pairwise different flat rooted trees with four edges.

4.4.21. Divide the set of vectors {~1' ~2' ~3, ~4' ~s} into equivalence classes so that the vectors of one class are the codes of pairwise isomorphic trees: 0:1 = (0010101101), ~2 = (0100101101), ~3 = (0101001011), 0:4 = (0100101011), ~5 = (0010110101).

4.4.22. Prove that the code ~ = (aI, a2, ... , a2n) of a flat rooted tree with n edges possesses the following properties:

2n (1) I: ai = n;

i=1

(2) for any k (1 ~ k ~ 2n), the inequality I:f=l ai ~ k/2 is valid.

4.4.23. Prove that any binary vector ~ of length 2n, which satisfies conditions (1) and (2) of the previous problem, is a code of a flat rooted tree with n edges.

4.4.24. (1) Prove that the following recurrence relation is valid for the number 1jJ (n) of vectors ~ E B 2n that satisfy conditions (1) and (2) of Problem 4.4.22:

n

1jJ (n) = L 1jJ (i - 1) 1jJ (n - i), where 1jJ (0) = 1jJ (1) = 1. i=1

(2*) Derive an analytic expression for 1jJ (n).

4.4.25. Let G be a connected flat graph. Starting from a certain vertex v belonging to the boundary of the external face, we shall go around (circumvent) this boundary so that it always remains on the right. At a certain moment of time, we shall return to the initial vertex v. The circumvention will be continued if there remain uncircumvented edges incident with the vertex v and belonging to the boundary of the external face. Otherwise, the circumvention is terminated.

(1) Prove that G is a tree if and only if each edge is circumvented twice in the above process.

(2) Let G be a tree with a root v. In accordance with the circumvention procedures described above, the tree G can be put in correspondence with a binary vector. By consecutive circumventing edges, we shall write 0 if an edge is circumvented for the first time and 1 if it is circumvented for the second time. Prove that the vector obtained in such a way is a code of the tree G.

4.4.26. Let G be a graph with n vertices and m edges. The graph G is called balanced if neither of its subgraphs has vertices of degree higher than 2m/n.

(1) Prove that for n > 2, a tree is a nonbalanced graph. (2) Give an example of a balanced graph for which m = n + 3.

4.4.27. Let G be a graph with a real nonnegative number ascribed to each edge as a weight. The weight of a subgraph of the graph G is the sum of the weights of the edges of this subgraph. The minimal spanning tree of the graph G is its

Page 114: Problems and Exercises in Discrete Mathematics

4.4. TREES AND BIPOLAR NETWORKS 105

spanning tree having the minimal weight. Prove that the minimal covering tree can be obtained by using the following algorithm. We choose the edge with the minimal weight. Then we choose the edge that has the minimal weight among the edges which do not form a cycle with the edges chosen earlier and so on. The algorithm is terminated when there is no such edge.

4.4.28. Is it true that any subnetwork of a strongly connected network is strongly connected?

4.4.29. Let a connected network have a unique shoot with k vertices, which is not contained in another shoot with a larger number of vertices. Prove that it is sufficient to draw k - 1 additional edges to make the network strongly connected. Can we always manage with the lesser number of additional edges?

4.4.30. Is it true that for any nand m (m 2: n 2: 3) there exist decomposable networks with n vertices and m edges?

4.4.31. Is it true that the graph of a strongly connected network is 2-connected?

4.4.32. Is it true that if we choose two nonadjacent vertices in an arbitrary 2-connected cubic graph as poles, we shall obtain a nondecomposable network?

4.4.33. Determine the number of pairwise nonisomorphic nondecomposable networks that can be obtained by choosing two vertices in an n-dimensional cube as poles.

4.4.34. (1) Prove that if a nondecomposable network has n > 3 vertices and m edges, then

3n :::; 2m + 2 :::; n (n - 1).

(2) Prove that for any nand m such that m 2: ~n - 1, n 2: 4, there exists a nondecomposable network with n vertices and m edges.

Fig.4.12

4.4.35. For the networks shown in Figure 4.12a,

band c, determine (1) the type of decomposition; (2) external networks of the canonical de­

composition. 4.4.36. Let r be the network shown in

Figure 4.13. 7 8 9

Fig.4.13

Page 115: Problems and Exercises in Discrete Mathematics

106 CHAPTER 4.

(1) Indicate all minimal vertices of the network.

(2) Divide all the internal vertices of the network r into the classes consisting of pair­wise equivalent vertices.

GRAPHS AND NETWORKS

(3) Verify whether there exists a vertex in this network which is weaker than any other vertex.

4.4.37. Prove that for any vertex v of a strongly connected network, there exists a chain containing all the vertices that are stronger than or equivalent to it.

4.4.38. Let S (r) be a set of all vertices v of the network r which are not minimal.

(1) Is it true that if r is an H-decomposable network without multiple edges, we obtain a nondecomposable network by joining each vertex v E S (r) through edges with each pole to which v is not adjacent?

(2) For obtaining a nondecomposable network is it sufficient to join each vertex v from S (r) with exactly one pole from those which are not adjacent to v?

4.4.39. (1) Prove that any separating vertex is minimal.

(2) Prove that any vertex adjacent to both poles is minimal.

4.4.40. Let all vertices of a strongly connected network r be minimal.

(1) Find out whether the network r can be (a) p-decomposable;

(b) s-decomposable; (c) H -decomposable.

(2) Let the network r be s-decomposable. Prove that each internal vertex is a separating vertex.

(3) Let r be H-decomposable. Verify whether or not any of internal networks can be

(a) an H-network;

(b) an H-decomposable network;

(c) a network other than networks r::, (m ~ 1).

a b a k---tJ b

(a) (b)

Fig.4.14

Page 116: Problems and Exercises in Discrete Mathematics

4.4. TREES AND BIPOLAR NETWORKS 107

S (a) P (b)

Fig.4.15

4.4.41. Let a strongly connected network r with eight edges be neither p- nor s-decomposable and have no subnetworks of the type r~, r:" (m > 1). Prove that r is a nondecomposable network.

4.4.42. Let G = (Vi, V2 , X) be a connected bipartite graph the degree of each of whose vertices is higher than or equal to two. Prove that if we construct a network r (a, b) by joining the pole a by an edge with each vertex of the set Vi and the pole b with each vertex of the set '\12, then r (a, b) is an H-network.

4.4.43. Does there exist a p-decomposable network for which any subnetwork containing at least three edges is p-decomposable?

4.4.44. Construct canonical decomposition diagrams for the networks shown in Figure 4.14a and b.

4.4.45. Construct 7l'-networks having the canonical decomposition diagrams shown in Figure 4.15a and b.

4.4.46. Prove that if 7l'-networks r 1 and r 2 are not isomorphic, they have different canonical decomposition diagrams.

4.4.47. Let A and B be two chains of a network r (a, b) and let a vertex u belong to chain A and not belong to chain B, while a vertex v belongs to chain B does not belong to A. Further, let [u, v] be a simple chain which joins u and v and does not intersect the chains A and B at any point other than its ends.

(1) Prove that there exist at least two chains of the network r whose vertices belong to the union of the chains A, Band [u, v] and which contain the chain [u, v]. Do at least three such chains always exist?

(2) Prove that if the chains A and B have internal vertices in common but have no edges in common, there exist at least four chains of the network, which are contained in the union of the chains A, Band [u, v] and satisfy the conditions of 4.4.47 (1).

4.4.48. Prove the equivalence of the following two definitions of a 7l'-network: (1) A network r (a, b) is a 7l'-network if its edges can be oriented so that all the

edges in each simple chain joining the poles a and b are directed from a to b.

Page 117: Problems and Exercises in Discrete Mathematics

108 CHAPTER 4. GRAPHS AND NETWORKS

(2) The 7l'-networks are those and only those networks which are obtained as a result of the following inductive process:

(a) The networks ri and q (Figure 4.16 a) are 7l'-networks. (b) If the networks A and B (Figure 4.16b) are 7l'-networks, the networks shown

in Figure 4.16c are also 7l'-networks.

4.4.49. Prove that among all 7l'-networks with m (m > 4) edges, the s-decom­posable networks have the largest number of shortest chains.

aO----4 • ..----0 b b=c

a~d

aC:=>b C~d a=c V//.T7n77'T'J'7777/ b=d

(a) (b) (c)

FigA.16

4.4.50. (1) Indicate the type of 7I'-networks which have the maximum number of simple chains joining the poles.

(2) Indicate the type of 7l'-networks having the maximum number of terminal cuts.

4.4.51. Let <p (m) be the maximum number of chains of a 7l'-network with m edges. Prove that

(1) <p (1) = 1; (2) <p (3n) = 3n (n ~ 1); (3) <p (3n + 1) = 4 x 3n (n ~ 1); (4) <p (3n + 2) = 2 x 3n (n ~ 1).

4.4.52. Is it true that among all the networks with m edges, the 7l'-networks have the maximal number of simple chains?

4.4.53. For each n ~ 5, indicate an H-network with n vertices, which has the maximal number of chains connecting the poles. For each k (1 :=; k < n), calculate the number of chains of length k between the poles.

4.4.54. Prove that for a network with m edges, having a length I and width t, the inequality m ~ I x t is valid.

4.4.55. Prove that in a 7l'-network, the intersection of any simple chain between poles with any terminal cut contains exactly one edge.

4.4.56. The set of chains in a network r is called a defining set for a vertex v if {v} is the intersection of the sets of the internal vertices of these chains. Prove or disprove the following statement: Let a network r wihtout multiple edges be not

Page 118: Problems and Exercises in Discrete Mathematics

4.4. TREES AND BIPOLAR NETWORKS 109

p-decomposable. Then r is non decomposable if and only if a defining set of chains exists for any internal vertex.

4.4.57. Prove the following statement: the necessary and sufficient condition for making a decomposable network r nondecomposable by adding of edges is that r must not have multiple edges and must have at least four vertices.

4.4.58. Construct a decomposable network with the smallest number of edges and n vertices (n 2: 4), which cannot be made nondecomposable by successively replacing subnetworks of the type q and r~ by edges.

Page 119: Problems and Exercises in Discrete Mathematics

Chapter 5

Elements of Coding Theory

5.1 Hamming's Distance

Let a = (a1, a2, ... , an) and /3 = (1311 132, ... , f3n) be tuples from Bn. Remember that

the number p (ii, /3) = L:i'=1 la; - 13;1 is called a distance (the Hamming distance)

between vertices ii and /3. It is easy to check that the Hamming distance satisfies the metric axioms (see Problem 1.5.1.).

The set B"r:(a) = {/3: p(a, /3) = k} is called the sphere, while the set 5;:(a) = {/3: p( a, /3) :::; k} is the ball of radius k with the centre at a.

We will deal with the operations &, EEl, V, --, over tuples from Bn. These operations are defined as follows

where 0 E {&, EEl, V}, and

5.1.1. Show that the following relations hold for any a, /3, ::y in Bn: (1) p(a, ::y) = p(/3, a); (2) p(a, ::y) :::; p(a, /3) + p(/3, ::y); (3) p(a, a) = 0; (4) if p(a, /3) = 0 then a = /3; (5) p(a, ::y) = p(a EEl /3, ::y EEl /3) for any /3; (6) p{a, /3) = lIall + 11/311 - 2I1a&/3I1; (7) p(a, /3) = lIa EEl /311; (8) p(a, /3) = lIaV /311-lIa&/3I1· 5.1.2. (1) Find the number of unordered pairs of adjacent vertices of Bn. (2) Find the number of unordered pairs oftuples (an, /3n), such as p( an, /3n) = k.

5.1.3. Find the size of the subset A ~ Bn: (1) A = B;:(a); (2) A = 5;:(a); (3) A = B;:(a) n B;:.(/3), where p(a,/3) = r;

110

Page 120: Problems and Exercises in Discrete Mathematics

5.1. HAMMING'S DISTANCE 111

(4) A = SJ:(a) n S;:'(~), where p(a,~) = r.

5.1.4. Let a and ~ be vertices of the cube Bn, p( a, ~) = m. Find the number of vertices i satisfying the following condition:

(1) p(a, i) + p(i, ~) = p(a, ~); (2) p(a, .:y) = k, p(~, i) = r; (3) p(a, .:y) ::; k, p(~,.:y) = r; (4) p(a, .:y) ::; k, p(~,.:y);::: r.

5.1.5. Prove that the following systems of relations are incompatible for a, ~ and .:y in Bn, n ;::: 2:

(1) p(a, ~) > 2n/3, p(~, i) > 2n/3, p(.:y, a) > 2n/3; (2) v(a) < v(~ EEl .:y), v(~) < v(.:y EEl a), v(.:y) < v(.:y EEl ~); (3) Iiall > II~ EEl ill, II~II > Iii EEl all, Ilill > Iia EEl ~II, Ila&(~&i)11 = 0; (4) Iia EEl ~ EEl ill = 0, Iia EEl ~ EEl ill = n - 1.

5.1.6. Let a, ~ and i be the vertices of the cube Bn. Show that: (1) a ::; ~ is equivalent to a&~ = a; (2) a V ~ = ~ is equivalent to ~ ::; a; (3) a::; i is equivalent to aV(~&i) ::; (aV ~)&i. 5.1. 7. How many vectors (0:1, 0:2, ... , 0:12) III B~2 satisfy the relation

L1::;i::;m O:i ::; m/2 for all m = 1, 12?

5.1.8. Find the number of vectors a in BJ:, 1 ::; k ::; n/2, 1 ::; r ::; (n - k) / (k -1), which have at least r zeroes between every two its ones.

5.1.9. The set A s;:; Bn is called a complete set in Bn if any vector ~ E Bn can be uniquely reconstructed under the condition that the distance p( a, ~) is known for each a E A. A complete set in Bn is called a base set if, for each vector a in A, the set A \ {a} is not a complete set.

(1) Prove that any ascending chain ao, aI, ... , an-1 in Bn forms a base set. (2) Show that the sets B~ and B~_l are complete in Bn for n > 2. Indicate a

number n > 2 for which B~ is not a base set.

Bn.

(3) For what nand k is the set BJ: not complete in Bn? (4) Prove that any base set A in Bn satisfies the condition log20,+1) ::; IAI ::; n.

(5) Prove that none of the faces having a dimension n - 2 is a complete set in

(6) Prove that the number W n of base sets in Bn satisfies the following inequalities

2(n!) ::; Wn ::; e:). 5.1.10. Let 'P be a one-to-one mapping of Bn onto itself. A mapping'P is said

to preserve a distance between vertices if p( a, ~) = p( 'P( a), 'P(~)) for all a, ~ in Bn. Prove that a mapping cp preserves a distance if and only if it can be obtained with the help of:

(1) a certain permutation of coordinates simultaneously in all vectors in Bn; (2) a substitution of 0 by 1 and 1 by 0 in certain coordinates of all vectors.

Page 121: Problems and Exercises in Discrete Mathematics

112 CHAPTER 5. ELEMENTS OF CODING THEORY

5.1.11. A mapping <.p of the set En onto itself is called monotonic if the condition v(a) :::; v(~) leads to the inequality v(<.p(a)) :::; v(<.p(~)). Find the number of monotonic mappings of the cube En.

5.1.12. Let I(A) be the number of edges of the n-cube, connecting pairs of vertices of subset A ~ En, and In(m) = maxA~Bn, IAI=m IAI.

(1) Prove that In(m):::; !mlog2 m; (2) Prove that the estimate (1) is attained under m = 2k; (3) Let A ~ En, IAI > 2n - l . Prove that I(A) ~ n; (4) Prove that I(A) :::; nlAI- min{IAI, 2n -IAI}. 5.1.13. Let Fr(n) be a family of subsets A ~ En such that p(a,~) :::; 2r for any

a and ~ in A. Put <.pr(n)) = maXAEFr(n) IAI. (1) Prove that the maximum I A I among all A E Fr (n) is not less than LO~i~r (~). (2) Let n be odd and r = (n - 1)/2. Find a subset A E Fr(n) such that

IAI = LO~i~r (~) and different from a ball of radius r in a subcube of the n-cube.

5.1.14. Prove by induction that the tuples in En can be arranged into a cycle

ao, al,"" a2n -l' 5.1.15. A binary vector (ao, aI, ... , a2n-d is called n-universal iffor any tuple

((31, (32, ... , (3n) in En there exists the number k such that (3i = akElli, (i = 1,2, ... , n), where k EB i = k + i(mod 2n). For example, the vector (0011) is 2-universal.

(1) Find out whether the vector a2n is n-universal:

(a) a4 = (0110); (b) a4 = (OlOl); (c) a8 = (00011101); (d) a8 = (0001 10 lO ) ;

(e) a8 = (0100 0111); (f) a8 = (0100 1110); (g) a16 = (0000 1111 0010 1101); (h) a16 = (1100 1011 OlOO 0011).

(2) Prove that for any n there exists a n-universal vector.

5.1.16. The cycle Z in Enis called a 2d-cycle if IZ&Sd'(a)1 = 2d + 1 for all a E Z.

(1) Let l(n) be the maximal length of 2-cycle in bn . Find 1(2),1(3),1(4). (2) Prove that for any 2-cycle in En and any face G of dimension 4 the inequality

Ie n GI :::; 8 holds. (3) Prove that 1( n) :::; 2n - l as n > 3.

5.1.17*. Let <.p(n) ( <.p'(n)) be the maximal size of the set A ~ En such that II a&~ II = 1 (respectively, II a&~ II ~ 1) for any two different tuples in A. Prove that

(1) <.p(n) = n; (2) <.p'(n) = 2n - l .

5.1.18*. Prove that the cube Bn can be represented as a union of pairwise nonintersecting ascending chains with the following properties:

(1) the number of chains of length n - 2k is equal to (~) - (k:l)' k = 0, [n/2]; (2) the weights of the minimal and the maximal vertices of each chain of length

n - 2k are equal to k and n - k, respectively;

Page 122: Problems and Exercises in Discrete Mathematics

5.2. HAMMING'S CODES 113

(3) if ai, aiH, and ai+2 are three consecutive vertices of an ascending chain having a length n - 2k, the vertex ~ satisfying the relations ai < ~ < ai+2, ~ i- ai+1 belongs to a certain chain of length n - 2k - 2.

5.2 Hamming's Codes

Let A and B be two finite alphabets and let R be a certain set of finite words in the alphabet A. A single-valued mapping r.p of the set R into a set of words in the alphabet B is called a coding of the set R. The counterpart C of the set R for the mapping r.p is referred to as a code of the set R. The words in C are known as code words. If a word w in R maps a word v in C, then v is a code of the word W. The words in R are called messages, and the alphabets A and B are called a message alphabet and a coding alphabet, respectively. If a coding alphabet B consists of two letters (in this case we shall assume that B = {O, I}), the coding r.p and the corresponding code C are called binary. A code is referred to as a uniform (or block) code if all code words are of the same length. A block binary code in which every code word has the length n is a subset of vertices of the n-cube. A Boolean function fc(i n ) which is equal to one in the set C and to zero outside C is called the characteristic function of the binary block code C. Let p(a, ~) be the ordinary Hamming distance between vertices a and ~ in Bn, which is equal to the number of coordinates in which a and ~ differ. The quantity d( C) = min p( a, ~), where the minimum is taken over all pairs of different vertices belonging to the code C ~ Bn, is called the code distance of the code C. The code C ~ Bn with a code distance d is abbreviated as the (n, d)-code. The maximal possible size of an (n, d)-code is denoted by m (n, d), while an (n, d)-code which size is m (n, d) is known as a maximal code. A perfect code is an (n, 2d + I)-code which satisfies the following condition: for any vertex a E Bn, there exists a code word ~ for which p (a, ~) :::; d. A binary block code is referred to as equidistant if the distance between any two code words is constant. A code C ~ Bn is known to be an equal-weight code if any code word has the same weight, i.e. if there exists an integer k (0 :::; k :::; n) such that C ~ BJ:. This number k is called a weight of an equal-weight code. The quantity max IGI, where the maximum is taken over all (n, d)-codes of weight k is denoted by m (n, k, d).

Let the words of a binary block code C be transmitted through a communication channel where some errors may happen in a transmitted word. The transmission via such a channel can be regarded as transformations of the words being transmitted. Here we shall consider only such transformations of binary words which do not change the length of a word and consists of the replacement of certain letters by the opposite, i.e. in the replacement of 0 by 1 and 1 by O. If a word a is transformed into a word ~ different from a as a result of transmission, this means that errors happen in the channel. If the i-th letter of a word a being transmitted differs from the i-th letter of the obtained the word ~, the error is said to occur in the i-th digit. If the obtained word differs from the word being transmitted in t digits, terrors are said to happen. Obviously, the number of errors made during a transmission is

Page 123: Problems and Exercises in Discrete Mathematics

114 CHAPTER 5. ELEMENTS OF CODING THEORY

equal to the Hamming distance between the transmitted and received words. Let C ~ Bn be a binary code. An arbitrary single-valued mapping 'IjJ of the set

Bn onto the set C is called a decoding. Let ii E C and let 'IjJ-l( ii) be a set of all vertices ~ in Bn, such that 'IjJ(~) = ii. Let Sf( ii) be a set of all words which are obtained from a code word ii as a result of not more than terrors (obviously, Sf( ii) is a sphere of radius t with center at ii). A code C is said to correct t errors if there exists a decoding 'IjJ such that S; ( ii) ~ 'IjJ -1 ( ii) for any ii E C. A code C detects t errors if any word which can be obtained from an arbitrary code word ii as a result of not more than t errors differs from any word in C \ {ii}.

Hamming's method for constructing codes correcting one error consists of trans­formation an arbitrary binary vector ii = (aI, a2, ... , am) (which is called a message)

to the vector ~ = ~(ii) = (/31,/32," .,/3n), where n = min{l: 2m S 2//(1 + I)}. The vector ~(ii) (it is called a message code) contains all digits of ii (they are called information digits) and, besides, k = n - m so-called control digits Po, PI, ... ,Pk-l. It is assumed that /3j = Pi, if j = 2i, (i = O,I, ... ,k -1) and /3j = aj-Jiog2j[, if j is not a power of 2. The values of control digits Po, PI, ... ,Pk-l are defined by the following equalities (so-called checking relations):

Pi = /32'+1 EB /32'+2 EB ... , i = 0, ... ,k - 1,

where the right-hand part is the modulo 2 sum of all digits /3j(2 i ,j S n), such that the coefficient of 2i in the binary expansion of j is equal to 1.

Example 1. By means of Hamming's method, obtain the message code ~(ii) for the message ii = (10 11 ).

Solution. We have m = 4, n = min{l: 2m S 2//(1 + I)} = 7, k = n - m = 3. The message code ~(ii) is /31/32/33/34/35/36/37 = Popdp2011. The values of the control digits are obtained from the equalities:

Po = /33 EB /35 EB /37 = 1 EB 0 EB 1 = 0,

PI = /33 EB /36 EB /37 = 1 EB 1 EB 1 = 1,

Po = /35 EB /36 EB /37 = 0 EB 1 EB 1 = O.

Hence, the wanted message code ~(ii) = (0110011).

A decoding consists of finding the origin message ii from some vector i = (,1, ... , In), obtained from the message code ~(ii) by replacing no more than one of its digits. The algorithm is as follows. Put m = [log2(2n /(n + 1))], k = n - m. Compute the k sums determined by the vector i = hI, ... "n):

Vi = 12' EB 12'+1 EB ... , i = 0,1, ... , k - 1, (1)

where the i-th sum consists of all coordinates Ij (2i S j S n) such that the coefficient with the number 2i in the binary expansion of j equals to 1. As a result we get the binary vector v = (VO,Vl, ... ,Vk-l). and the integer v(v) = L:O<i<kVi2i) is the

number of the digit in ~(ii) where the error occurred. If v( v) = O~ it is assumed

Page 124: Problems and Exercises in Discrete Mathematics

5.2. HAMMING'S CODES 115

that no error happened. If v(v) 2': n, it is assumed that some word other than a message code was transmitted.

Example 2. Find the message Q from the vector l' = (1001110) obtained from Hamming's code ~(Q) by changing no more than one coordinate.

Solution. We have n = 7, m = [log2 (27 /8)) = 4, k = n - m = 3. Write out equation (1) and compute the components of the vector v = (vo, V1, ... , Vk-t). We get

Vo = 11 EEl ,3 EEl ,5 EEl 17 = 1 EEl 0 EEl 1 EEl 0 = 0,

Vo = 12 EEl 13 EEl 16 EEl 17 = 0 EEl 0 EEl 1 EEl 0 = 1,

Vo = 14 EEl ,5 EEl ,6 EEl 17 = 1 EEl 1 EEl 1 EEl 0 = 1.

We obtain v(v) = 1 .22 + 1 .21 + 0 . 22 = 6. Therefore, the error occured in the sixth digit. The message code ~(Q) is (1001100). By deleting the control digits (with numbers 1,2,4), we get the message Q = (0100).

5.2.1. Find the code distance of the given code C ~ Bn. 1) C = {HOOO, 10101, 01110};

2) C = {111100,110011,001111};

3) C = {00001,11111,10100,01010};

4) C = {101010,010110,000001};

5) C = {01101010, 11000110,00011001, 10101100};

5.2.2. For every code C of the previous problem, find:

(a) the number of errors corrected by the code C;

(b) the number of errors detected by the code C.

5.2.3. For the code C ~ Bn determined by its characteristic function fc(xn) (a) find out how many errors the code C corrects; (b) find out how many errors the code C detected.

(1) fc(x n ) = Xl EEl X2 EEl ••• EEl Xn;

(2) fc(x n ) = X1X2'" xn V X1X2.·· Xn;

(3) fc(x3n ) = X1X2 .. · X3n EEl Xl ... xnxn+1 ..• X3n

EElX1 ••• xnxn+1 ... X2nX2n+1 ..• x3nEElx1 .•. X2n X 2n+1 ... X3n;

(4) fe( in) = X1X2 ... X n-1 EEl X1X2 ••. Xn-2Xn EEl ••• EEl X2X3 ... Xn ·

5.2.4. By means of Hamming's method, construct the message code ~(Q) for the message Q.

(1) Q

(3) Q (5) Q (7) Q

010; 1001; 10101011; 100010011;

(2) Q (4) Q

(6) Q = (8) Q

011; 1101; 111001111; 01110111011.

Page 125: Problems and Exercises in Discrete Mathematics

116 CHAPTER 5. ELEMENTS OF CODING THEORY

5.2.5. For the given vector i obtained from Hamming's message code ~(a) of a message a by replacing no more than one coordinate with it opposite, reconstruct the message a:

(1) i (3) 1 (5) i (7) i (9)1

110; 011110; 0101101; 1100011; 1010101010100;

(2) I (4) I (6) I (8) i (10) 1 =

101110; 1001011; 1011101; 11011100110; 001011110111111.

5.2.6. Prove that two Hammings message codes for different messages differ, no less than in three coordinates.

5.2.7. Prove that a code C <;;; Bn corrects t errors if and only if p ( v, w) 2': 2t + 1 for any two different code words v and w in C.

5.2.8. Is it true that a code C <;;; Bn correcting t errors detects (1) at least 2t + 1 errors; (2) at least 2t errors; (3) no more than 2t errors?

5.2.9. Prove that it is possible to obtain from any subset C <;;; Bn a code detecting an error by deleting from C not more than half the vertices.

5.2.10. Determine the number of maximal (n, 2)-codes.

5.2.11. Let n = 3k. Prove that m(n, 2n/3) = 4.

5.2.12. Prove that the size of a perfect (n, 2d + I)-code is 2-n L:1=D (7). 5.2.13. Does there exist a perfect (n, 3)-code for n = 147?

5.2.14. Prove that for n > 7, no perfect (n, 7)-codes exist.

5.2.15. Prove that a code C <;;; Bn is not maximal if ICI = 3.

5.2.16. Prove that for any natural k and n = 2k - 1

(1) there exists a partition of the cube Bn+l into disjoint balls of radius 1 (hence, there exists a perfect (n, 3)-code in Bn);

(2) there exists a partition of the cube Bn+l into disjoint spheres of radius l.

5.2.17. Let nand d be such that a perfect (n, 2d + I)-code exists. Prove that

(d:l) is exactly divisible by edt)·

2. 5.2.18. Prove that there exist no equidistant (n, 2d + I)-codes of size exceeding

5.2.19. Prove that for an even d, there exists an equidistant code of a size [2n/dJ.

5.2.20. Prove that

(1) m (n + 1, d) 2': m (n, d);

(2) m (n + d, d) 2': 2m (n, d);

(3) m (2n, d) 2': (m (n, dW;

Page 126: Problems and Exercises in Discrete Mathematics

5.2. HAMMING'S CODES

( 4) m ( n, d) :::; 2m (n - 1, d);

(5) m (n, d) :::; 2d/(2d - n) if n < 2d.

5.2.21. Prove that

5.2.22. Prove that

5.2.23. Prove that

m (n, d) :::; 2d/(2d - n), if n < 2d.

5.2.24. Prove that

if 2P - n(2k - d) > O.

5.2.25. Prove that, if k :::; d :::; n - k, then

(1) m (n, k, 2d) :::; [im(n - 1, k - 1, 2d)] ;

(2) m(n, k, 2d):::; [i [~=~ [ ... [n-~+d] ... ]]];

(3) m (n, k, 2d) :::; [_n_m(n - 1, k, 2d)] ; n-k

117

5.2.26. Let q(n, d) be the maximum number of vertices in Bn, the pairwise distances between which do not exceed d. Prove that

m(n, d + l)q(n, d):::; 2n.

5.2.27. Prove that m (n, d) :::; 2n - d+l.

5.2.28. Prove that every set C ~ Bn such that ICI ~ 2d contains a subset D of size not less than 2-d 1CI which is an (n, d)-code.

Page 127: Problems and Exercises in Discrete Mathematics

118 CHAPTER 5. ELEMENTS OF CODING THEORY

5.3 Linear Codes

An expression of the form

(1)

where a; E Bn, A; E {O, I}, i = 1,"8, is called a linear combination of the vectors aI, a2, ... , as. The linear combination (1) is called trivial if )'1 = A2 = ... = As = 0 and nontrivial otherwise. Any linear combination of vectors in Bn is obviously a vector in Bn. Vectors aI, a2, ... , as in Bn are linearly independent if any of their nontrivial linear combinations differs from 5 = (0, 0, ... , 0). Otherwise, the vectors aI, a2, ... , as are said to be linearly dependent. A subset G ~ Bn is called a group if G is closed with respect to the exclusive sum, i.e. for any a and ~ in G, the vector a EB ~ belongs to G. It follows that any linear combination of vectors in a group G ~ Bn also belongs to G (in particular, 5 E G). Thus, any group Gin Bn is a linear vector space with respect to the set of operations EB, '. The maximum number k = k( G) of linearly independent vectors in the linear space G is called a dimensionality of G. A set of k linearly independent vectors of a linear k-dimensional space is known as a basis of this space. If a code G ~ Bn forms a group, it is called a linear, or a group code. If a linear code in Bn has a dimensionality k, it is referred to as an (n, k)-code. A binary linear code correcting one error is known as the Hamming code.

Linear codes can be conveniently defined in terms of matrices. A matrix H (C), the rows of which are code words of a code C ~ Bn, is called a code C matrix. A matrix M( C) formed by k arbitrary linearly independent vectors which are code words of an (n, k)-code C is called a generating matrix of the code C. If H is an arbitrary matrix formed by zeros and ones with n columns, the set C(H) of all vertices of the cube Bn, which are linear combinations of rows in the matrix H, is called a code generated by the matrix H. Vectors a = (aI, a2, ... , an) and ~ = (,81, (32, ... , (3n) are referred to as orthogonal if a1(31 EB a2(32 EB ... EB an(3n = O. The set V(H) of all vectors in Bn which are orthogonal to each of the rows of the matrix H, is known as the null space of the matrix H. Let C be a binary code in which every word is orthogonal to each row of a certain matrix H. If C is an (n, k)­code, and the matrix H consists of n - k linearly independent rows, then H is called a checking matrix of the code C. The set C* of all vectors that can be represented as a linear combination of the rows of the checking matrix of the (n, k )-code C is called a code dual to the code C. By g( n, d), we shall denote max ICI, where the maximum is taken over all linear codes C ~ Bn with a code distance d.

5.3.1. Clarify whether the vectors in the set A are linearly independent. (1) A = {(Oll), (101), (lll)}; (2) A = {(OII),(lOl),(IlO)}; (3) A = {(lOll), (1100), (1001), (1l10)}; (4) A = {( 1011), (1100), (1001), (OlIO)}; (5) A= {(lOIl),(llOO),(lOOl),(lOIO)}; (6) A = {(OOlI), (1100), (1101), (1l10)}.

Page 128: Problems and Exercises in Discrete Mathematics

5.3. LINEAR CODES 119

5.3.2. (1) For each set A from Problem 5.3.1, find the set of linear combinations of the vectors from A.

(2) For each set A from Pr,pblem 5.3.1, find the number of vectors which are orthogonal to each vector from A.

5.3.3. Clarify whether the set A is a group with an exclusive sum operation. (1) A = {(OO), (11)}; (2) A = {(~O), (01), (11)}; (3) A = {(OOO), (010), (101), (Ill)}; (4) A = {(OOO), (010), (011), (Ill)}; (5) A = {(OOO), (Ill)}; (6) A = {(000),(110),(011),(101)}.

5.3.4. Find the number of subgroups of En. (l)n=l; (2)n=2; (3)n=3.

5.3.5. Find the number of (n,k)-codes. (l)n=2,k=l; (2)n=2,k=l; (3)n=3,k=2.

5.3.6. Find the number of (n, k)-codes with distance d. (l)n=2,k=l,d=2; (2)n=4,k=l,d=4; (3)n=3,k=2,d=2; (4)n=3,k=2,d=l; (5)n=3,k=2,d=3; (6)n=4,k=2,d=2.

5.3.7. From a given matrix H, determine the size m(C(H)) of a code C(H) generated by it, as well as the code distance d(C(H)):

(5) H =

000 100 010 o 0 1

1 100 o 1 1 0 001 1

o 0 0 0 1 000

n l), 111

000 000 000

o 1 1 001

1 1 100 (00101)

(2) H = 0 1 0 1 0 ; 10011

(

01 100 1 0 (4) H = 1 0 0 1 1 0 1

o 000 1 1 1 1 1 1 1 1 1 0

(6) H =

1 1 100 00111 o 0 001

o 0 0 0 0 1 1 000

1 1 o 0 1 1 o 0

000 000 000

111 001

Matrices H from (5) and (6) are of size (n X n), provided that n is odd in the case of (6);

(7) H = (hP), where h is a identity (k x k) matrix and P is an arbitrary binary (k x (n - k)) matrix, formed by different rows, each of which contains at least two ones, and k ::; n -log2(n + 1);

Page 129: Problems and Exercises in Discrete Mathematics

120 CHAPTER 5. ELEMENTS OF CODING THEORY

(8) H = (hQ), where Is is a (5 x 5) identity matrix and

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

Q= 1 1 0 1 1 0 1 1 1 0 0 1 1 0 0 1 1 1 1 1 1 0 1 0 1 1 1 0 1

5.3.8. Let a set C ~ Bn consists of k linearly independent vectors. Prove that any two linear combinations of vectors in the set C, having different coefficients, are different vertices of the cube Bn.

5.3.9. Prove that there exists in Bn a system of n linearly independent vectors, but there exists no system of n + 1 linearly independent vectors.

5.3.10. Prove that any (n, k)-code has a size 2k.

5.3.11. Prove that in a binary linear code either each code vector or half the code vectors have even weight.

5.3.12. Prove that the number of different bases in Bn is

(2n _ 1)(2n -2) . .. (2n _ 2n- 1 )

n!

5.3.13. Prove that the number of different (n, k)-codes in Bn is

(2n _ 1)(2n _ 2) ... (2n _ 2k- 1 )

(2k - 1)(2k - 2) .. . (2k - 2k- 1)'

5.3.14. Determine the number of vectors in Bn which are orthogonal to a given vector 0: in HI:.

5.3.15. Prove that the set of all vectors in Bn which are orthogonal to each row of a (k x n) binary matrix H form a linear space. Is this space always (n - k)­dimensional?

5.3.16. Is it true that for any linear code there exists a matrix H which is (1) a generating matrix; (2) a checking matrix? 5.3.17. Let V ~ Bn be a space consisting of linear combinations of rows in a

matrix H = (hP), where h is a identity (k x k) matrix and P is a (k x (n - k)) matrix consisting of zeros and ones. Prove that V is a zero space of the matrix G = (pT In-k), where In- k is the identity matrix of size (n - k) x (n - k) and p T is the transpose of the matrix P.

5.3.18. Construct a checking matrix for a code generated by the matrices H from Problems 5.3.7 (1)-(3).

5.3.19. Prove that if C ~ Bn is an (n, k)-code, the code dual to C is an (n, n - k )-code.

Page 130: Problems and Exercises in Discrete Mathematics

5.3. LINEAR CODES 121

5.3.20. Let H(C) be a matrix of an (n, k)-code C ~ Bn, which does not contain null columns. Prove that

(1) each column of the matrix H( C) has 2k - 1 ones and the same number of zeros; (2) the sum of the weights of rows of the matrix H( C) is n . 2k-l.

5.3.21. Prove that the code distance of a linear code C ~ Bn is equal to the minimum weight of its nonzero vectors.

5.3.22. Prove that the code distance of an (n, k)-code does not exceed [n2 k- 1 /(2 k -1)].

5.3.23. Prove that for n = 2d - 1, the size of a linear (n, d)-code does not exceed 2d.

5.3.24. (1) Prove that the maximum possible size g(n, d) of a linear (n, d)-code satisfies the inequality

g(n, d) :::; 2g(n - 1, d). (2) Using the result obtained by solving Problem 5.3.18, prove that g(n, d) :::;

d. 2n - 2d+2 •

5.3.25. Let a code C be a zero space of a matrix H. Prove that the code distance of the code C is not smaller than d if and only if any combination of d - 1 or a smaller number of columns of the matrix H is linearly independent.

5.3.26. Prove that if 'Lt;:J (n~l) < 2k, there exists a (k x n) matrix consisting of zeros and ones, in which any d - 1 columns are linearly independent, and hence there exists an (n, n - k)-code with a code distance equal to or greater than d.

5.3.27. Let Hk, n be a (k x n) matrix, where k =]1og2(n + 1)[, in which the i-th column is a binary decomposition of the number i (i = 1, n). For example, for n = 6, matrix H3,6 has the form

00111) 1 100 1 o 1 0 1 0

(1) Prove that the zero space of the matrix is the Hamming code, i.e. a linear code correcting one error.

(2) Construct a code which is a zero space of the matrix H3,6.

(3) Determine the number of errors that are corrected by the code generated by the matrix Hk , n'

5.3.28. The spectrum of a set C ~ Bn is a vector s = (so, S1, ... , sn), where Sr is the number of pairs of vertices in C that are r apart. Prove that for any (n, k )-code C, there exists an (n, k )-code C' having the same spectrum and a generating matrix of the form (hP), where h is an identity (k x k) matrix and P is a (k x (n - k)) matrix consisting of zeros and ones.

5.3.29. (1) Prove that g(9, 5) = 4. (2) Prove that m(9, 5) ~ 5.

Page 131: Problems and Exercises in Discrete Mathematics

122 CHAPTER 5. ELEMENTS OF CODING THEORY

5.3.30. Let an (n, k)-code have a code distance d. Is it true that there exists an (n, k )-code with a code distance d - I?

5.4 Alphabetic Code Divisibility

Let A be an alphabet and A* the set of all finite words in the alphabet A, including the empty word. The length (number of letters) of a word W is denoted by I(W). The empty word is denoted by A. A concatenation of words U and V is the word UV obtained by writing the word V just to the right of the word U. A word V is known as a subword of a word W if there exist words P and S (which probably are empty) such that W = PV S. In this case, the word P is a prefix, and the word S a suffix of the word W. A non-empty subword (prefix, suffix) of a word W is called proper if it does not coincide with W.

Let A = {aI, a2, ... , ar } and B = {bI, b2, ... , bs } be two alphabets considered as a message alphabet and a coding alphabet, respectively. Let ~ be a single-valued mapping of letters of the alphabet A in B*:

{

al -t UI ,

~ : a2 -t U2,

ar -t Ur.

The set C (L:) = {UI, U2, ... , Ur} is called a code of alphabet A or simply a code and is denoted by C(~). The words UI, U2, ... , Ur, are called code words.

A coding FE : A* -t B* with the properties: (1) FE(ai) = Ui, (i = 1, ... , r); (2) FE( ail ai2 ... aik) = Uil Ui2 ... Uik ,

is called an alphabetic coding (generated by L:) An alphabetic coding ](E and the corresponding code C(L:) are assumed to be uniquely decoded or divisible if each relation of the type

L: (aiJ L:( ai2) ... L: (ai k) = L: (ajl) L: (aj') ... L: (ajl)

for the words in the coding alphabet B implies that I = k and jt it (t = 1,2, ... , k). A code L:(A) is called a prefix code or a code with prefix property if none of the words in ~(A) is the beginning of any other word in ~(A). A divisible alphabetic code ~(A) is assumed to be complete if, for every word W in a coding alphabet B, the following statement is valid: either W is a proper prefix of a certain word in ~(A), or a certain word in C(~) is (not necessarily proper) a prefix of the word W. The following statements are valid.

Theorem 1 (McMillan's inequality). For any divisible code C(L:) with a coding alphabet of q symbols and a set of lengths of code words 11 ,/2, ... , IT} the following inequality holds:

r

Lq-1i S l. i=I

Page 132: Problems and Exercises in Discrete Mathematics

5.4. ALPHABETIC CODE DIVISIBILITY 123

Theorem 2. For any divisible code C(I;) with a coding alphabet B and a set of code word lengths 11,12, ... , IT there exists a prefix code C(I;') with the same coding alphabet and the same set of code word lengths.

Corollary. Let h, 12, ... , IT be natural integers such that I:i=1 q-l; ~ 1. Then there exists a prefix code with a q-symbol coding alphabet and with 11 ,12 , ••• , IT as the set of code word lengths.

Markov's algorithm for checking an alphabetic code for divisibility is the following. Let C(I;) be an alphabetic code. Denote by SI the set of words {3 with the following property: there exist two different code words U and V such that the word {3 is the proper suffix of U and the proper prefix of V and, besides, {3 is not a code word by itself. Consider the directed labelled pseudograph Gr, with the set of vertices 5 = 51 U {).} and the set of arcs is defined as follows.

(a) If a and T are two distinct vertices, then the arc coming from the vertex a to T is present in Gr, if and only if there exist a code word Wand a sequence P = Ui" Ui2 , ... , Uik of the code words such that Wand aUi" Ui2 , ... , Uik T

are equal (as the words in the coding alphabet). Note that the sequence P may be empty if none of the vertices a and T coincides with A. The arc joining a with T is marked by the sequence P.

(b) If a coincides with T, then the arc (loop) joining a with itself is present in Gr, if and only if a = A and there exist a code word Wand a sequence P = Ui" Ui2 , ... , Uik , such that W = Ui" Ui2 , ... , Uik provided that k > 1. In this case, the loop (A, A) is marked by the word U. The pseudograph Gr, is referred to as the graph of the alphabetic code C(I;). We consider a loop (A, A) as a contour of length one. The following theorem gives a divisibility test of an alphabetic code.

Theorem 3 (AI. A. Markov). A code C(I;) is divisible if and only if its graph Gr, contains no contours passing through the vertex A .

Example 1. Let C(I;) = {a, ab, cab, baac}. Find out whether code C(I;) is divisible. If "yes", then point out a word which can be decoded in two different ways.

Solution. The graph Gr, is shown on Figure 5.1 (a). There exists a contour which contains the vertex A. Consequently, writing out the words assigned to the vertices and the arcs of the contour, we get the word decoded in two different ways: a bbac ab = ab a a cab.

b aab a c

~ Q A A

A ab C A b ca ab

a b c

Fig.5.1

Page 133: Problems and Exercises in Discrete Mathematics

124 CHAPTER 5. ELEMENTS OF CODING THEORY

Example 2. The same problem for the code C(E) = {a, b, aab}. Solution.The graph Gr, is shown on Figure 5.1 (b). The graph contains the

loop (A, A). The code C(E) is not divisible. The word decoded in two ways is aab = a a b.

Example 3. The same problem for the code C(E) = {cab, abc, bee, abca, abcb}. Solution.The graph Gr, is shown on Figure 5.1 (c). The graph does not contain

the loops or contours passing through the vertex A. The code C(E) is divisible.

5.4.1. Find out whether the code C is a prefix code. (1) C = {a, ba, bb, bbba}j (2) C = {ab, bb, ba, aab}j (3) C = {ac, c, bb, abc, bac, j abb, abcb}j (4) C = {a, ba, cab, acb}j (5) C = {a, ba, bba, ... , (b)na, .. . }j (6) C = {a, ba, ... , b(a)n, .. . }.

5.4.2. Find out whether the code C with the coding alphabet {0,1,2} is divisible. (1) C = {01, 201, 112, 122, 0112}j (2) C = {00l, 021, 102, 201, 001121,010121001}j (3) C = {O, 01, 0010001001}j (4) C = {20, 01202, 22, 2001, 2012010, 10201121, 1112}j (5) C = {01, 011, 100, 2100, 10121, 00l210}j (6) C = {01, 011, 100, 2100, 10110, 00112}j (7) C = {01, 12, 021, 0102, 10112,}j (8) C = {01, 12, 012, 111, 0102, 10112, 01112}j (9) C = {01, 12, 012, 0102, 020112}j (10) C = {01, 10, 210, 121, 0210, 0112}j (11) C = {01, 10, 210, 201, 0210, 0110222221}j (12) C = {01, 10, 210, 201, 0210, 011022221}j (13) C = {01, 10, 210, 201, 0210, 011022}j (14) C = {01, 12, 011, 01210, 20120, 2011220}j (15) C = {01, 12, 011, 01210, 201120, 2011220}j (16) C = {OOO, 0100, 10, 1001, 0010010}j (17) C = {01, 12, 01121, 21201}.

5.4.3. Find out whether the word B in the alphabet {O, 1, 2} is a code of a message in the coding generated by the mapping E:

E: I ~ : i~2 4 -+ 101 5 -+ 2100

Page 134: Problems and Exercises in Discrete Mathematics

5.4. ALPHABETIC CODE DIVISIBILITY 125

If "yes" find out whether the word B is a code of a single message.

(1) W = 10120121012100; (2) W = 1012101201210012; (3) W = 0121001210201; (4) W = 120120121001210; (5) W = 1010122100; (6) W = 12101210012; (7) W = 101212101012; (8) W= 1010012100101.

5.4.4. Choose the subset B ~ A with the minimal number of elements provided that binary expansions of the numbers in B having minimal possible length form

( a) a prefix code; (b) a divisible code; (1) A = {I, 5, 6, 7, 12, 13, 17}; (2) A = {I, 3, 6, 8, 10, 13, 19, 33, 37}; (3) A = {2, 6, 7, 9, 12, 15, 18, 35, 36, 37}; (4) A = {I, 2, 5, 8, 9, 10, 13, 14}; (5) A = {2, 3, 7, 8, 11, 12, 13, 14}; (6) A = {3, 5, 9, 10, 13, 17}; (7) A = {I, 2, 5, 8, 9, 12, 13, 14}; (8) A = {5, 6, 7, 8, 9, 10, 11, 12, 13}; (9) A= {4, 6, 7,10,13,15,20,23, 25}; (10) A = {5, 7, 9, 10, 12, 14, 17,23, 24}.

5.4.5. For the code C, find a word of minimal length which is nonuniquely decoded.

(1) C = 10, 01, 12, 012, 2100, 12011, 12010; (2) C = 0, 101010, 01010101; (3) C = 0, (10)k+l, (01)\ (4) C = 010, 101, 01010, (01)k, k = 3s + 1; (5) C = 0, (10)k, (Ol)m; (6) C = 001, 011, 100, 110, (1100)k, k = 3s; (7) C = 0, 10, 11, (101)k; (8) C = 01, 10, 11, (110)k, k = 2s; (9) C = Ok, 1m; (10) C = (Ol)kO, O(lO)k+l, l(Ol)m; (11) C = 0, Ok1, l(o)m; (12) C = {(01)k, (lO)m, (Ol)SO} (13) C = {(Ol)k, (01)k+ 10, (1O)k+21, (10)k1} (14) C = {O, ok1(0)m, (1(0)m)21} (15) C = {(Ol)k, (lO)k+l, (Ol)kO} (16) C = {(01)k, (01)k+10, (10)k+2}.

5.4.6. Construct a binary prefix code C with a given consequence L of code word lengths:

(1) L = (1,2,3,3); (3) L = (2, 2, 3, 3, 4, 4, 4, 4); (5) L = (2, 2, 3, 4, 4);

(2) L = (1,2,4,4,4,4); (4) L = (2, 2, 2, 4, 4, 4); (6) L = (2, 3, 3, 3, 4, 4);

Page 135: Problems and Exercises in Discrete Mathematics

126 CHAPTER 5. ELEMENTS OF CODING THEORY

5.4.7. Using McMillan's inequality, find out whether a set of integers L can be a set of code word lengths for some divisible code in a q-symbol alphabet:

(1) L = (1, 2, 2, 3), q = 2; (2) L = (1, 2, 2, 3), q = 3; (3) L = (2, 2, 2, 4, 4, 4), q = 2; (4) L = (1, 2, 2, 2, 3, 3, 3, 3), q = 3; (5) L = (1, 1, 2, 2, 3, 3, 3), q = 3; (6) L = (1, 1, 1, 2, 2, 2, 2, 3), q = 4;

5.4.8. Let each word in an alphabetic binary code C of power 2n + 1 have a length not exceeding n.

(1) Can the code C be di visi ble? (2) Prove that the code C is not a prefix code.

5.4.9. Let C(E) be an alphabetic code of power r, in which the sum of the length of the code words is equal to N, and the maximum length of the code words is I. Prove that if the code C(E) is not divisible, then there exists a nonuniquely decoded word in the coding alphabet having a length not larger than (I - 1) (N - m + 1) + 1.

5.4.10. Let k be the minimum and I the maximum length of the code words of an alphabetic code C and let N be the sum of the lengths of the code words. Prove that in order to establish the divisibility of the code C, it is sufficient to verify the uniqueness of decoding of all codes of the words length of which in the alphabet of messages does not exceed N I / k.

5.4.11. Let M be a set consisting of r nonempty words in an alphabet of q symbols. Show that:

(1) in M there exists a word of length not less than logq (q + r( q - 1)) - 1; (2) for any t: > 0, the part of words in M, the length of which does not exceed

(1- t:) x logq(1 + r(q -1)), is not more than

as r 2: 2, q 2: 2.

5.4.12. Prove that a prefix code C(E) with a q-symbol coding alphabet is complete if and only if when the equality 2:=£==1 q-l, :::; 1 holds, where /1,/2, ... , IT are the lengths of the code words in C(E).

5.4.13. Let 11,/2, ... , IT be positive integers such that 2::i==l q-l, :::; 2n. Prove that, in the n-cube En, there exists pairwise nonintersected faces 91,92, ... ,9T) the dimensions of which are equal to 11,/2, ... ,IT' respectively.

5.4.14. Let a code C(E) consist of two nonempty words and is not divisible. Prove that the minimal length of a non uniquely decoded word is not greater than 21 - 1, where l is the maximal length of a code word in C(E). Give an example of the code when this estimate is attainable.

5.4.15. Let X(C) be the minimal length of a nonuniquely decoded word in the coding alphabet for the code C. Put X(N, r) = maxX(C), where maximum is over

Page 136: Problems and Exercises in Discrete Mathematics

5.5. OPTIMAL CODES 127

all nondivisible codes C with r code words and the sum of the lengths of the code words are equal to N. Prove that:

(1) there exists a positive constant Cl such that X(N,3) S cl N 2 ;

(2) for any k, there exists N 2: k and a code C = {UI,U2,U3 } such that Lt=ll(U;) = Nand X(C) 2: C2, where C2 is a constant not depending on k.

5.5 Optimal Codes

Let two alphabets A = {al,a2, ... ,ar}, B = {bI,b2, ... ,bq } and a list (tuple) of numbers P = (PI, P2, ... , Pr), Pi > 0, L~=l Pi = 1 be given. Let C = {WI, W2, ... , wr} be an alphabetic prefix code in alphabet B. We assume that the word Wi E C is a code of the letter ai E A, and Ii is the length of the word Wi (i = 1,2, ... , r). The numbers PI, P2, ... , pr will be called probabilities (of appearance of the letters aI, a2, ... , ar as well as the appearance of the corresponding code words WI,W2, ... ,Wr)). The number lme(C,P) = L~=lliPi is called a redundancy of the code C or a mean length of a code word in the code C. Put 1*(P) = infe Ime(C, P) where an infimum is taken over all prefix codes C with r code words. The prefix code C' such that lme(C,P) = 1*(P) is called a q-valued code with minimal redundancy for the list of probabilities P or an optimal (P, q)-code. In the case, when q = 2, a code with a coding alphabet of q letters is called binary.

Table 5.1

A p pI pII pIlI pIV e IV e Ill e II e I e

1 0,4 0,4 0,4 0,4 ~0'6 041 1 1 1

2 0,3 ~3 ~3 ~3 ~4 1 00 00 00 00

3 0,1 0,1 ~0'2"1 f O,3 OIL[0101-j 011 011

4 0,1 0,1 0,1 011 0100 0100

5 0,05y0,1 0101l{01010

6 0,05 01011

Huffman's method of constructing the optimal (P,2)-codes uses the following statements:

1. Lemma 1. Among the code words of maximal length l of an optimal (P, 2)­code, there exist two words having the same prefix of length l - 1.

2. Lemma 2. If the words Wi, wej in an optimal (P,2)-code C correspond to the probabilities pi, Pj with Pi > Pj! then the lengths I(Wi) and l(wj) of these words satisfy the ineqnality l( w;) S l( Wj).

Page 137: Problems and Exercises in Discrete Mathematics

128 CHAPTER 5. ELEMENTS OF CODING THEORY

3. Reduction Theorem. Let C = {WI, W2, ... , wr} be a binary alphabetic code, P = {PI, P2, ... , Pr}, PI 2:: P2 2:: ... 2:: Pr}, Pi > 0, L:i=I Pi = 1 a list of probabilities. Let Wi, Wj be some words of maximal length I corresponding to probabilities Pi, Ph and having the same prefix W of length I - 1. Put p' = Pi + Pj and consider the list of probabilities

in which the probabilities are in non-increasing order. The code C' = (C u {w}) \ {Wi,Wj} is (P',2)-optimal if and only if when the code Cis (P,2)-optimal. The code C' is known as an extension of the optimal code C.

Huffman's method consists for the following. Let pr-I and Pr be the last two probabilities in the original list of probabilities which are excluded from the list, and their sum is inserted into the list in such a way that the probabilities in the new list are arranged in a nonincreasing order. This procedure is repeated until we obtain a list of two probabilities, in which symbol 0 is assigned to one probability and symbol 1 to the other (this is the optimal code for a two-letter alphabet of messages for any probability distribution). Then, in accordance with the theorem, an optimal code is constructed for three letters for the corresponding list of probabilities, and so on until we obtain an optimal code for the original list of probabilities. The Huffman method is illustrated by the following example.

Example 1. Given A = {1, 2, 3, 4, 5, 6}, B = {O, 1}, P = (0.4, 0.3, 0.1, 0.1, 0.05, 0.05), r = 6 it is necessary to construct a (P,2)-optimal code by means of the Huffman method. The scheme for constructing the required code is shown in Table 5.1.

acb,1127 aca, 1127 ace, 1/9

To each prefix code C in the q-symbol alphabet B with a given list of probabilities P, a marked rooted tree D( C, P, q) can be put in correspon­dence. This tree D( C, P, q) will be called the code C tree. D( C, P, q) is constructed in the following way. The root of the tree corresponds to the empty word A. The vertices of the first level correspond to the letters of the alphabet B. The vertices of the second level correspond to the words of length 2 in the alphabet B, provided that the vertices corresponding to words with a some one-letter prefix are neighbours of the vertex of the first level

Fig. 5.1 corresponding to this letter, and so on. The end vertices of the tree correspond to code words of the code C. The probability of appearance some code word W is prescribed the end vertex corresponding to the word w. The tree obtained from D( C, P, q) by removing the marks is called a frame of D( C, P, q).

Example 2. Let C = {b,c,aa,ab,aca,acb,acc} be a prefix code with the list of probabilities P (~,§,~,~,~,~,§,). The tree D(C,P,3) is shown in

Page 138: Problems and Exercises in Discrete Mathematics

5.5. OPTIMAL CODES 129

Figure 5.2 The tree D(C,P,3), corresponding to an optimal (P,q)-code C, will be called optimal. The number of edges in a tree D, incident to a vertex v and not lying on the path between v and the root of the tree, is called a degree of branching of a vertex v in a tree D. We say that a vertex v belongs to the i-th level of a tree D if the chain connected to this vertex by the root of the tree contains k edges. An edge is said to belong to the k-th level of a tree if it connects the vertices of the k-th and the (k + l)-th levels. A tree D is called (1', q)-satumted if the degrees of branching of all vertices are equal to 0 or q but may be one in the last level. The degree of branching of this exceptional vertex is equal to qo, where

qo = { q -1,

l' - [q:1] (q - 1),

if q~l is integer,

otherwise.

A construction of a (P, k)-optimal code with k > 2 can be realized analogously in the binary case. Some difference is at the first step when the number of the "pasting" probability is not fixed and equals qo.

Example 3. Construct a (P,3)-optimal code for the list of probabilities P = (0.4, 0.3, 0.1, 0.1, 0.05, 0.05).

Solution. As l' = 6, q = 3, r:1 is integer, then qo = q - 1 = 2. The number qo gives the quantity of probabilities "pasting" at the first step. The construction is carried out, as in the binary case, in two stages. First, we reduce the list of probabilities to three. Then, after constructing a code for a 3-letter message alphabet, we extend it up to l' = 6. The process is illustrated in Table 5.2

Table 5.2

A p pI pll ell ell e

1 0,4 0,4 0,4 0 0 0

2 0,3 0,3 0,3 1 1 1

3 0,1 0,1}----l0,3 21 -f 20

4 0,1 0,1 21 21

5 0,05J rO,l 22l [220

6 0,05 221

5.5.1. With the help of Huffman's method, construct the binary optimal code for the given list of probability P:

(1) P = (0.4, 0.2, 0.20.2); (2) P = (0.7, 0.1, 0.10.1); (3) P = (0.2, 0.2, 0.2, 0.2 0.2);

Page 139: Problems and Exercises in Discrete Mathematics

130 CHAPTER 5. ELEMENTS OF CODING THEORY

(4) P = (0.5, 0.2, 0.1, 0.u9 0.08 0.03); (5) P = (0.4, 0.3, 0.08, 0.060.040.040.040.04); (6) P = (0.3, 0.3, 0.2, 0.040.030.030.030.030.030.01); (7) P = (0.3, 0.2, 0.1, 0.1 0.060.060.060.06 0.06); (8) P = (0.4, 0.2, 0.1, 0.050.050.050.050.050.05).

5.5.2. Construct an optimal (P, q)-code for a given P and q: (1) P = (0.3, 0.2, 0.20.20.1), q = 3; (2) P = (0.4, 0.2, 0.20.10.10.10.1), q = 3; (3) P = (0.3, 0.3, 0.20.10.10.10.1), q = 3; (4) P = (0.4, 0.1 0.1 0.1 0.1 0.08, 0.060.06), q = 3; (5) P = (0.3, 0.2, 0.10.10.10.10.1), q = 4; (6) P = (0.21, 0.20, 0.170.160.120.080.040.02), q = 4; (7) P = (0.20, 0.15, 0.15 0.130.120.11 0.11 0.03), q = 4; (8) P = (0.23, 0.22, 0.180.170.080.040.020.020.02), q = 4;

(9) P = (~, ~, ~, ~, fT, fT, -h, -h), q = 3;

(10) P = G, ~, fe" fe" fe" fe" to, to), to, to, to), q = 4.

5.5.3. For a given q make a list of probabilities P such that there exists an optimal q-valued prefix (P, q)-code with a prescribed set of code word lengths L. Construct this code:

(l)q=2 L=(1,2,3,4,5,5); (2) q = 2 L = (2,2,2,3,3); (3) q = 2 L = (2,2,3,3,4,4,4,4); (4) q = 2 L = (1,2,4,4,4,4); (5) q = 3 L = (1,1,2,2); (6)q=3 L=(I,I,2,3,3,3); (7)q=3 L=(1,2,2,2,2,2,2); (8) q = 4 L = (1,1,2,2,2,2,2,2); (9) q = 4 L = (1,1,1,2,2,2,3,3,3); (10) q=4 L= (1,1,2,2,2,2,2,2,2,2).

5.5.4. For a prefix code C with a given list of probabilities P, construct the code tree D(C,P,q):

(1) C = (1,00,01,02,20,21),P = (0,5; 0,1; 0,1; 0,1; 0,1; 0,1);

(2) C = (00,01,10,110,111),P = (~; ~; ~; ~; ~);

(3) C = (0,10,110,1110,1111), P = (~; ~; ~; fe,; fe,); (4) C = (0,1,20,21,220,221),P = G; ~; ~; ~; fs; fs); (5) C = (0,10,11,120,121,122), P = (~; ~; -/2; -/2; -/2; -/2); (6) C = (0,1,20,21,220,221,222), P = (~; ~; ~; ¥- -/2; -/2; -/2); (7) C = (0,10,11,20,210,222), P = G; ~; ~; ~; -/2; -/2); (8) C = (0,10,11,12,20,22), P = (~; ~; ~; ~; ~; ~);

(9) C = (0,10,11,120,121,122), P = (~; ~; ~; ~; ~; ~);

Page 140: Problems and Exercises in Discrete Mathematics

5.5. OPTIMAL CODES 131

(10) C = (0,1,20,21,220,221), P = (~; ~; ~; ~; ~; D. 5.5.5. (a) Find out which of the trees constructed in the previous problem are

saturated; (b) Find out which of the trees constructed in problem 5.5.4 can be frames of

optimal code trees.

5.5.6. Are the following statements true? (1) An optimal code tree D( C, P, 2) is saturated. (2) An optimal code tree D( C, P, q), q ?: 2, is saturated. (3) An optimal code tree does not contain a vertex with a branching degree equal

to l. (4) In an optimal code tree, all vertices, besides maybe one, have branching

degrees equal to 0 or q. (5) In an optimal code tree all vertices, besides vertices of the 1- I-th level,

where I is the maximal code word length, have branching degrees equaled 0 or q. (6) Every unmarked (T, q )-saturated tree can be mark so that the obtained tree

is an optimal code tree.

5.5.7. (1) Prove that a prefix q-valued code with a list of code word lengths L = (h, 12 , ... , IT) is complete if Li=l q-I, = 1, i.e. the equality holds in McMillan's inequality.

(2) Using the Reduction Theorem, show that every binary optimal code is complete.

(3) Is the previous statement true for optimal (P, q )-codes if q > 2?

5.5.8. Prove that among code words of maximal length in an optimal (P, q)-code, there exist two words differing in the last letter (See Lemma 1).

5.5.9. Prove that the number of code words with maximal length of any optimal binary code is even.

5.5.10. Find out whether there exists a binary optimal code with a given sequence of code word lengths L:

(1) L = (2,3,3,3); (3) L = (1,3,3,3,3); (5) L = (1,2,3,4,4); (7) L = (1,2,3,4,4,4,4); (9) L = (1,4,4,4,4,4,4,4);

(2) L = (2,3,3,3); (4) L = (1,2,3,4); (6) L = (1,2,3,4,4,4); (8) L = (1,3,3,3,3,3,3);

(10) L = (3,3,3,3,3,3).

5.5.11. Find out whether there exists a q-valued optimal code with given sequence of code word lengths L:

(1) L = (1,1,2), q = 3; (2) L = (1,1,2,2), q = 3; (3)L=(1,1,2,2,2,2), q=3; (4) L = (1,2,2,2,2,2,2), q = 3; (5) L = (2,2,2,2,2,2,2), q = 3; (6) L = (3,3, ... ,3), q = 3;

'--v--' 26times

Page 141: Problems and Exercises in Discrete Mathematics

132 CHAPTER 5.

(7) L = (3,3, ... ,3), q = 3; ---....--25times

(8) L = (2,2, ... ,23,3,3,3), q = 4; ---....--13times

(9) L=(2,2, ... ,23,3,3,3), q=4. ---....--Iltimes

ELEMENTS OF CODING THEORY

5.5.12. Show that if q < r :::; qS - q + 1, s = 2,3, ... , then in any q-valued optimal code with r code words, there exist two code words of different length.

5.5.13. A code is called almost uniform if its code word lengths differ by no more than 1.

(1) Show that for any positive integer r there exists an almost uniform optimal (P, q)-code for P = (~,~, ... ,~,).

(2) Find out whether there exist a lists of probabilities different from P in (1) such that there exists an almost uniform code which is optimal.

5.5.14. Show that the maximal length of a code word in any optimal binary code of size r does not exceed r - 1.

5.5.15. Point out a list of probabilities P = (PI,P2,'" ,Pr), such that the list of lengths of a code words of binary optimal code for P is (1,2,3, ... , r - 2, r - 1, r - 1).

5.5.16. Prove by induction on r that the sum of the length of the code words of any binary optimal code of size r does not exceed (r + 1 )(r - 1 )/2.

5.5.17. Using the Reduction Theorem, show that the number of optimal binary codes with r code words does not exceed (r - 1 )!2r.

5.5.1B. Prove that the number of mapping ~ : ai -+ Bi, (i = 1,2, ... , r), where ai is a letter of an alphabet A, IAI = r, and Bi is a word in alphabet B of a length not exceeding r - 1, does not exceed qr2.

5.5.19. A prefix alphabetic code C with the scheme ~ : ai -+ Bi , (i = 1,2, ... , r), will be called irredundant if, after removing any letter from any code word Bi , C ceases to be prefix.

(1) Is an optimal code irredundant? (2) Prove that the number of irredundant alphabetic q-valued codes of size r

does not exceed (4r?r. Hint. Estimate the number of marked trees corresponding to irredundant codes.

5.5.20. Let P = (PI, P2, ... ,Pr) be the list of probabilities and 1*( P) = infe lme( C, P), where an infimum is taken over all prefix codes C with r code words. Prove that

(1) 1*(P) > 1 ifr ~ 3; (2) For any f. > 0 and any r ~ 1, there exists a list of probabilities P such that

1*(P) < 1 + L

5.5.21. Let it be l(r) = sUPp infe lme(C, P) where an infimum is taken over all prefix q-valued codes C with r code words, and the supremum is taken over all lists

Page 142: Problems and Exercises in Discrete Mathematics

5.5. OPTIMAL CODES 133

of probabilities P = (Pl,P2,'" ,Pr), such that Pi> 0, (i = 1,2, ... , r), L:i=l Pi = 1. Prove that

( 1) i ( r) :::: (logq r) - 1;

(2) i(r) ::; [logq r] + 1.

Page 143: Problems and Exercises in Discrete Mathematics

Chapter 6

Finite Automata

6.1 Determined and Boundedly Determined Functions

Let A be a nonempty finite alphabet. The elements of the alphabet are called letters (or symbols). A word in an alphabet A is an arbitrary sequence of the letters from A. A length of a word w (the number of letters in the word) is denoted by A( w). The set of all words XS = x (1) x (2) ... x (s) of length s (s 2: 1) in the alphabet A will be denoted by AS. The word of length 0 (empty word) is denoted by the symbol A. By A* we denote the set {A} U US>I AS, while AW denotes the set of all words XW = x (1) x (2) ... , where x(t) E A, (= 1, 2, .... The words in the set AWare called infinite words in the alphabet A.

The word w, obtained by writing a word W2 to the right of a finite (or empty) word WI, is called a concatenation of words WI and W2 and is denoted by WIW2. The word WI is called the beginning (prefix), and W2 the end (suffix) of the word w.

Let A and B be finite nonempty alphabets. A mapping r.p: AW ---+ BW is called a determined function or a determined operator (in abbreviated form, a d.-function or a d.-operator) if it satisfies the following condition:

For any s 2: 1, the s-th symbol y(s) in a word yW = r.p(XW) is a single-valued function of the first s symbols x (1), x (2), ... , x (s) of the word XW.

If the words xl' and x2' have identical prefixes of length s (s 2: 1), the words YI = r.p (xt) and y'2 = r.p (x2') have also identical prefixes of length s.

The set of all d-functions of the type r.p: AW ---+ BW will be denoted by <I> A, B.

If A = Al X A2 X ... X An and B = BI X B2 X ... x Bm , then the mapping r.p: AW ---+ BW induces m functions depending on n variables, provided that the variable Xj runs through the set Aj (j = 1, 2, ... , n). These functions are defined as follows. Let XW = x(1) x(2) ... x(t) ... be a word in AW and

yW = r.p(XW) = y(1) y(2) ... y(t) ....

In this case, x(t) = (XI(t), X2(t), ... , xn(t)), xAt) E Aj, xi = xA1) xA2) ... xAt) ... ,

134

Page 144: Problems and Exercises in Discrete Mathematics

6.1. DETERMINED FUNCTIONS 135

-W _ (-W -W -W) X - Xl' X 2 , ••. , Xn ,

y(t) = (YI(t), Y2(t), ... , Ym(t)), Yi(t) E Bi, Yi = Yi(l) Yi(2) ... Yi(t) ... , yW = (fir, Y2' ... , y';',,), If'i(Xl , X2, ... , X~) = y'(. By proceeding in the reverse order, we can construct the mapping If' realized by

the functions If'i. The concept of a d.-function of n arguments is defined as a mapping the type

If': (AI x A2 X ... x An)W -+ BW. The variable Xi of a function If' (Xl, X2, ... , Xn): (AI x A2 X ... x An)W -+

BW, i = 1,2, ... ,n, is called essential if there are two tuples (xII' X2I ' ... , x~I) and (x12' x2I ' ... , x~I) of values of the variables Xl, X2, ... , Xn which differ only in their i-th components and such that If' (X111 x2I ' ... , x~I) '# If' (X12' x2I ' ... , x~I)' If the variable Xl is not essential, it is called unessential or fictitious.

The function If' (Xl, X2, ... , Xn) is said to depend essentially (fictitiously) on a variable Xi (1 :::; i :::; n) if this variable is an essential (resp. fictitious) variable of the function If'.

If A is a set of all vectors of length n with elements in Ek , and B is the set of all vectors of length m with elements in Et, we shall use the notation <I>~';n instead

of <I>A,B' For n = m = 1, the superscripts in <I>!:~ will be omitted. If k = 'I, we shall write only one subscript: <I>~' m.

Sometimes it is convenient to assume that a d.-function If' in <I> A, B is realized by a discrete device (automaton) A<p operating at the discrete instants of time t = 1, 2, ....

At each instant t of time, a signal x(t) is X(t) j jy(tl. supplied to the input of this device, and a signal· - A<p _ x(t) is supplied to the input of this device, and a '-------' signal y(t) appears at the output (Fig. 6.1). The Fig.6.1 word XW is called the input word and yW the output word. The alphabets A and B are called input and output alphabets of the automaton U<p. If A = Al X A2 X ... x An and B = BI X B2 X ... x Bm , it can be assumed that the automaton A<p represents m determined functions, each of which depends on n variables.

Any two d.-functions If'I and If'2 in <I> A, B called distinguishable if there exists an input word x~ which is transformed by these functions into different output words ,i.e. If'I (x~) '# If'2 (x~). Otherwise these functions are said to be equivalent or indistingu ishable.

Let If' E <I> A, Band 'ljJ E <I> A, B. If there exists a word xg E A * such that i If'( xgxW) = If'( xg)'ljJ( XW) for any word XW E AW, the operator 'ljJ is called the residual operator of the operator If' generated by the word xg, and is denoted by If'x~' The set Q( If', xo) of all residual operators of the operator If', equivalent to the operator If'xg, forms an equivalence class called the state of operator If' containing a residual operator If'x'' o The state containing the operator If' is called the initial state. If'ljJ E Q(lf', xo), the operator 'ljJ is said to be represented by the state Q( If', xg) of the operator If'. The

IHere, <p(xg) denotes a prefix of length s of the output word <p(xOXW).

Page 145: Problems and Exercises in Discrete Mathematics

136 CHAPTER 6. FINITE AUTOMATA

operator cp is called a boundedly determined operator (abbreviated as a b.d.-operator or a b.d.-function) if it has a finite number of pairwise different states. The number of different states of a b.d.-function is known as its weight. If the pairwise different states of an operator cp form an infinite set, we shall assume that the weight of the operator cp is equal to 00. By ~ A, B we shall denote the set of all functions in cI> A, B

that are b.d.-functions. It is convenient to analyze d.-functions by considering their graphic representa­

tion in the form of infinite information trees. Let A be an alphabet of n letters. By D A we shall denote an infinite oriented rooted tree satisfying the following conditions:

(a) the out-degree of each vertex, including a root, is equal to nj (b) the in-degree of a root is equal to zero, while every other vertex has an

in-degree 1 j (c) each arc of the tree DAis assigned a letter of the alphabet A, and different

arcs emanating from the same vertex of the tree (in particular from a root) are assigned different letters. A root of the trees is assumed to be a zero rank vertex. If a vertex v is the end of an arc emanating from an i-th rank vertex (i ~ 0), it is called a vertex of i + 1-th rank. An arc of j-th level (j ~ 1) is an arc emanating from the (j -1 )-th rank vertex. Each infinite oriented chain in the tree D A corresponds to a word in AW. Figure 6.2 shows a fragments of the tree DA , A = {O, I}, consisting of the first three levels of this tree (here and below, we assume that the left and right arcs emanating from a vertex are assigned the symbols 0 and 1 respectively). Thick lines are used to isolate the chain corresponding to the word 101.

A loaded tree D A, B is obtained from the tree D A by assigning a letter from the alphabet B to each arc. Each oriented infinite chain in the tree D A, B has a corresponding word in BW, formed by the letters assigned to the arcs of this chain. Hence it can be assumed that the loaded tree DA,B defines (represents) the mapping cp: AW -t BW, which is a d.-function. The fragment of a loaded tree DA,B, where A = {O, I} and B = {O, 1, 2}, is shown in Figure 6.3. The d.-function corresponding to this tree processes, for example, the word 1010 into the word 2012.

Fig.6.2 Fig.6.3

Let D A, B be a loaded tree representing the d.-function cpo The residual operator

Page 146: Problems and Exercises in Discrete Mathematics

6.1. DETERMINED FUNCTIONS 137

'PiO(S 2: 0) of the operator 'P has a subtree DA,B(X~) growing from an s-th rank vertex v(x~) at which the chain starting from the root and containing exactly s arcs terminates. In the i-th level, this chain has a corresponding arc labelled by the letter xo(i) E A.

If the residual operators 'Pi'l and 'Pi'2 are equivalent, the vertices v( x?) and 1 2

v( X~2) corresponding to them and the subtrees growing from these vertices are also called equivalent. The weight of a tree representing a d.-function is equal to the weight of this function and, hence, to the maximum number of pairwise non­equivalent vertices (or subtrees) of the given tree.

Example 1. Find out, whether the following mapping is a d.-function: yW = 'P( XW) E <P2, where XW = x(l )x(2) ... x( t) ... , yW = y(l )y(2) ... y( t) ... and

y(t) = x(t) ---t x(l), where t 2: 1.

Solution. From the d.-function definition, it follows that value of the output y( t) at the moment t can be uniquely defined by values of the input at time moments 1 and t, i.e. the s-th symbol of the resulting word fjw for any s 2: 1 is a one-to-one function of the first s symbols of the entry word XW. Therefore, the given function is a d.-function.

Example 2. Find out whether the function yW is a d.-function, if yW = 'P(XW) E

<P 2, where XW = x(1)x(2) ... x(t) ... , yW = y(1)y(2) ... y(t) ... and

t = { x (t - 1) if t is even, y( ) x(t) . y(t + 1) if t is odd.

Solution. At first sight, it seems that the function is not a d.-function, but let's analyze the essential dependence of this function on y(t + 1). Let t = 2s + 1, where s 2: 0. So we have y(2s + 1) = x(2s + 1) . y(2s + 2) = x(2s + 1) . x(2s + 1) = 0. Therefore, for every odd t output y(t) is equal to 0, i.e. it is uniquely defined by the first t symbols of the input word XW. It is obvious that such a one-to-one correspondence takes place for even t. Therefore, the given function is a d.-function.

Example 3. Find out whether the following mapping is a d.-function: fjw = 'P(XW) E <1>2, where XW = x(l )x(2) ... x(t) ... , fjw = y(l )y(2) ... y(t) ... and

(t) = { 0 if there is s ~ t such that 3· x(s) ~ x(s + 1) + x(s + 2), y 1 elsewhere?

Solution. When x(s) = 0, the inequality 3 . x(s) ~ x(s + 1) + x(s + 2) takes place independently from the values of x(s + 1) and x(s + 2). When x(s) = 1, it is wrong for any x(s + 1) and x(s + 2). Therefore,

(t) = { ° if x (s) ~ ° for some s ~ t, Y 1 otherwIse,

Page 147: Problems and Exercises in Discrete Mathematics

138 CHAPTER 6. FINITE AUTOMATA

i.e. the mapping 'P is a d.-function.

Example 4. Let iJw = 'P(XW) E <P 2 , where XW = x(1)x(2) ... x(t) ... , iJw = y(1)y(2) ... y(t) ... and y(t) is the (t+2)-th digit after point in the binary expansion of the number x(t)/6. Find out whether the mapping 'P(XW) is a d.-function?

Solution. It is clear from the definition of the function that the value of output y(t) at the moment t can be defined uniquely from the value of entry x(t): one needs to find the (t + 2)-th digit after the point in the binary expansion of the number x(t)/6. It is not difficult to obtain that

1 1 1 1 1 "6 = 8" + 32 + 128 + ... + 2 . 41 + ....

Therefore, the binary expansion of the number! is 0.0010101 ... = 0.0(01), so

(t) = { 1 if x(t) ~ 1 and t is odd, y 0 otherwIse.

Hence, 'P is a d.-function.

Example 5. Let E be the subset of all words xW from set {O, l}W having 1 on even places, i.e. x(2s) = 1 when s 2 1. Find out whether it is possible to continue the function 'P so that it would be a d.-function:

Solution. (a) It is obvious, that value of the first output symbol y(t) does not depend of the entry symbol (y(l) = 1 both for XW = Ol[OlW and for XW E E). But y(2) is the function of the sequence x(2)x(4) ... x(2s) .... Moreover, y(2) = x(l) if x(2s) = 1 for any s 2 1, and y(2) = 1 if XW = 01[Olw. Let us consider two input words: [Oll w and Ol[Olw. We have 'P([OllW) = [10lW and 'P(Ol[OlW) = tw. That means y(2) = 0 if XW = [OllW, and y(2) = 1 if XW = 01[OlW, i.e. y(2) is not one-to-one function of the entry symbols x(l) and x(2). Therefore, the given function 'P cannot be uniquely defined to be a d.-function.

(b) From the description of the function 'P, we can see that y(l) = x(1) and y(2) = x(2), both for xW E E and for XW = 00x(3)x(4) ... x(t) .... Further, if x(2) is equal to 0, then y(t) = 0 for any t 2 3, but if x(2) = 1 then y(t) = x(t), t 2 3. That means we can try to continue the definition of our function in the following way: if XW = x(1)lx(3)lx(5)1 .. . lx(2s -1)Ox(2s+ 1)x(2s+2) ... , where s 2 1, then Ij>(XW) = x(1)lx(3)1 .. . lx(2s - l)[OlW (in other words, y(t) = x(t) until the symbol o does not come in "input" for some to = 280; after that, y(t) = 0 for all t 2 to). It is obvious that the function Ij>(XW) is a d.-function which is a continuation of the

Page 148: Problems and Exercises in Discrete Mathematics

6.1. DETERMINED FUNCTIONS 139

Example 6. Find out whether ~(XW) = y(l)y(2) ... y(t) ... (from <1>2) is a b.-d.-function, and find its weight:

(t) _ { 0 when t = I, y - x(t) -+ y(t - 1) when t ::::: 2.

Solution. Having built four levels of the information tree of a given function (Figure 6.4), we see that all vertices can be divided into 3 classes: the first class contains only the vertex 0 (see Figure 6.4), the second consists of the vertices 1, 2, 4,6, 10, 14, etc., and the third consists of the vertices 3,5,7,8,9, 11, 12, 13 etc.

o

Fig.6.4

The reduced functions ~o(:i;W), ~oi,(:i;W) and ~i,(:i;W), where s 2:: 1, correspond to vertices of the second class. The reduced functions ~ax,(:i:W), where (J" is equal 0 or 1, s ::::: 1 and :i: S -# is correspond to vertices of the third class. Note that functions belonging to the same class are equivalent. We have

~(Ox(l)x(2) ... x(t) ... )

= O(x(l) -t 0)(x(2) -t (x(l) -t 0)) ... (x(t) -t (x(t - 1) -t ...

-t (x(1) -t 0) ... )) ...

= Ox(I)(x(l) V x(2)) ... (x(l) V ... V x(t - 1) V x(t)) ... ;

~(oiS(x( L)x(2) ... x(t) ... )

= OL:J,x(l)(x(l) V x(2)) ... (x(l) V ... V x(t -1) V x(t)) ... ;

~(iS(x(1)x(2) ... x(t) ... )

Page 149: Problems and Exercises in Discrete Mathematics

140 CHAPTER 6. FINITE AUTOMATA

= 0 I ... I x(l)(x(l) V x(2)) ... (x(l) V ... V x(t - 1) V x(t)) ... ~

s-I

(here 1 = 0 and for s = 1, the word L.J, is empty). s-I

So we see that every reduced function ipo(XW ), ipoi'(XW ) and ipi'(XW ), where s 2:: 1, is equivalent to function 'ljJ(XW) = y(1)y(2) ... y(t) ... , where y(t) = x(l) V ... V x(t -1) V x(t), t 2:: l.

Further, ip(o-XIX2 ... xsx(1)x(2) ... x(t) ... )

= o· XI(XI V X2) ... (XI V X2 V ... V xs-d(xI V X2 V ... V xs)

(XI V X2 V ... V Xs V x(l))(xI V X2 V ... V Xs V x(l) V x(2)) ...

... (XI V X2 V ... V Xs V x(l) V x(2) V ... V x(t)) .. .

= o· XI(XI V X2) ... (XI V X2 V ... V xs_I)11 ... 1 ... ,

because XS # IS (i.e. XI V X2 V ... V Xs = 1). Therefore, ipO"x,(x(1)x(2) ... ) ::::::: Iw. So we can conclude that the function ip is a

b.-d.-function of weight 3.

6.1.1. Let ip(x(1)x(2) ... x(t) ... ) = y(1)y(2) ... y(t) ... is a function from <1>2.

Find out whether it is a d.-function if: (1) y(l) = x(l)and y(t) = x(l) EB x(2) EB··· EB x(t) for t 2:: 2; (2) y(t) = x(l) V x(2) V ... V x(t) V x(t + 1) for t 2:: 1; (3) y(t) = x(l) . x(2)· .... x(t)· x(t + 2) -+ x(l) for t 2:: 1; (4) y(l) = y(2) = 1 and y(t) = x(2t - 1 - t) for t 2:: 3; (5) y(l) = 1 and y(t) = x(2 + x(t)) for t 2:: 2; (6) y(l) = y(2) = 0 and y(t) = x(2 + x(t)) for t 2:: 3; (7) y(l) = 1 and y(t) = x(2 + y(t - 1)) for t 2:: 2; (8) (t) = { 1 if ther~ is such integer 12:: 0 that t = 2/,

Y 0 otherwIse;

(9) (t) = { x(19t - t2. - 80) if 7 ::; t ::; 12, y 1 otherwIse.

6.1.2. Whether the following function ip from <1>2 is a d.-function:

{ OW if XW = Ow (1) ip( XW) = I W otherwise;'

(2) (XW) = { IWif XW = Ow, ip x(1)x(2) ... x(t) ... otherwise

(here x(1)x(2) ... x(t) ... is the output sequence corresponding to the input sequence XW = x(1)x(2) ... x(t) .. . );

-w {IWifXw=ow, (3) ip(x ) = x(1)x(2)x(3)x(4) ... x(2s _ 1)x(2s) ... otherwise

Page 150: Problems and Exercises in Discrete Mathematics

6,1, DETERMINED FUNCTIONS

(4) (Xw) = { !w if ther~ is such a number c that 2:t~1 x(t) s:: c, '{J Ow otherwise' ,

{ XW if the sequence XW is such that

(5) '{J(XW) = , 2:;=1 x(i) ~ t/2 for all t = 1,2, .. " Ow otherwise;

(6) '{J(XW) = y(l)y(2)", y(t)"" where

{ i (1) if t = 1,

y(t) = itt) EEl y(t -1) if t is odd and t > 1, x(t-l) iftiseven;

141

(7) '{J( XW) = y(1 )y(2) .. ,y( t) .. " where y( t) is defined from y(21) = x(21 - 1) and y(21- 1) = x(21- 1) V y(21), 1= 1,2", ,;

(8) '{J( XW) = y(1 )y(2) .. ,y( t) .. " where y( t) is the (3t + 2)-th digit after the point in the binary expansion of the number x(t + 1)/7;

(9) '{J(XW) = y(l)y(2)", y(t)"" where y(t) is 2t+l-th digit after point in the binary expansion of the number (2 'x(t + 1) + 1)/15?

6.1.3. Let D be the subset of all such words from the set {O, I}W in which two l's cannot stand side by side, Find out whether it is possible to continue the definition of the function '{J so that it would be a d.-function, If "YES" give an example of such a continuation of the function '{J:

(1) '{J(XW) = Ow when XW E D; (2) '{J(XW) = x(l)x(2)", i(t)", when XW E D; (3) '{J(XW) = OXW when XW E D; (4) '{J is defined only on the word x~ = 11010010001", (i,e. xo(t) = 1 only for

t = i(i -1)/2 + 1, i = 1,2, ... ) and '{J(x~) = Yo = 1010010001 ... (i.e. yo(t) = 1 only

then t = W, j = 2,3, ... );

(5) '{J is defined only on two words: Ow and [Ol]W; '{J(OW) = i w and '{J([OW = 1[10]W;

(6) ('W) {OW ifxwED, '{JX = iw ifxw=lw;

(7) ( 'W) {XW if XW E D, '{J x = O[I]W if XW = lW;

(8) ('W) = { OX(1)(2) ... i(t)... if XW E D, '{J x OO[l]W if XW = lw.

6.1.4*. Find out whether the function

n times

if lI(xn ~ lI(xn, otherwise;

if lI(xnll(x~) s:: 1/2, otherwise;

Page 151: Problems and Exercises in Discrete Mathematics

142 CHAPTER 6. FINITE AUTOMATA

(3) (-W -W) {iW if v(xf) S; v(x~), r.p Xl' X 2 = Ow otherwise;

(4) (-W -w -W) = {iW if v(x~) + v(x~) S; v(x~), r.p Xl' X 2 , X3 x~ otherwise.

6.1.5. The partial functions r.p: {a, l}W -+ {a, l}w given below are not defined only on the word Ow = 00 ... ° ... Which of these functions can be redefined to determined the functions and which ones cannot?

{ XW if the number of zeros in each prefix

(1) (xW) = of the word x~ .is not less than the r.p number of umtles,

i W otherwise;

(2) r.p( XW) = y(l )y(2) ... y( t) ... , where

(t) = {O if :3s((~ S; t)&(x(s) = 1)), y 1 otherwIse;

(3) r.p(XW) = y(1)y(2) ... y(t) ... , where

{

I if for a certain s S; t in the prefix ( ) = x(1)x(2) ... x(s), the number of zeros is

y t larger than the number of unities, x(t) otherwise;

(4) r.p(XW) = y(1)y(2) ... y(t) ... , where

(t) = {I if v(x(~)x(2) ... x(t)OO ... 0 ... ) S; 1/2, Y ° otherwIse.

6.1.6*. (1) Disprove the following statement: If the function r.p(XI' X 2 ): {a, l}w x {a, l}w -+ {a, l}w depends essentially

on the variable Xl and if, for each (fixed) word x2' E {a, l}w, r.p(XI' x2') is a d.-function, the function r.p(XI' X 2 ) is also a d.-function.

(2) Let the function r.p(XI' X 2 ): {a, l}w x {a, l}w -+ {a, l}w satisfy the following condition: for any words x~ and x2' in {a, l}w, the functions r.p(XI' x~)

and r.p(x~, X 2 ) are determined. Will the function r.p(Xl' X 2 ) be determined as well?

6.1.7. Construct the fragment of a loaded tree containing the s first levels for the function fjw = r.p(XW) from the set <1>2:

(1) y(l) = 1 and y(t) = x(t - 1) for t 2: 2, s = 3; (2) y(l) = ° and y(t) = x(t) EEl y(t - 1) for t 2: 2, s = 4;

6.1.8. For a given function r.p(XW) E <1>2, represent in its loaded tree the chain corresponding to the prefix XS of the input word XW and write the prefix fjs of the output word fjw:

(1) r.p(XW) = 10100100010 ... (i.e. y(t) = 1 only for t = (;), i = 2,3, ... ,)

x7 = 0101001;

Page 152: Problems and Exercises in Discrete Mathematics

6.1. DETERMINED FUNCTIONS 143

(2) (t) = {I if x(l) :- x(2) + ... + x(t) > t/2, y 0 otherwIse,

(a) xlO = 0101010110, (b) xlO = 1100101110.

6.1.9. The loaded tree corresponding to the function <p(XW) E cP 2 has the following form: the left and right arcs coming from the root are labelled by 0 and 1 accordingly; if v is a vertex of the i-th rank (i :2: 1) and the i-th level arc terminating at the vertex v is labelled by a E {O, I}, the left arc coming from v is labelled by the same symbol a, while the right arc is labelled by jj' (negation of a).

(1) Is it true that the s-th letter of the output word fjw = <p( XW) for this function can be determined from the relation

(a) y(l) = x(l), y(s) = x(s -1) EB x(s) for s :2: 2; (b) y(l) = x(l), y(2) = x(l) EB x(2), y(s) = x(s - 2) EB x(s) for s :2: 3; (c) y(s) = x(l) EB x(2) EB ... EB x(s)? (2) Find the weight of the function <po

6.1.10. Are the residual operators <Pxf and <Px~ of the d.-function <p E cI>2 equivalent? (Below, everywhere, <p(XW) = fjw = y(1)y(2) ... y(t) ... )

(1) (t) = {X(t) when t = 1,2,3, Y x(t) when t :2: 4:

(a) x~ = 11, x~ = 00101; (b) xi = 010, x~ = 1001.

(2) (t) = { x(t) when t = 1,2,3, Y x(t - 1) when t :2: 4:

(a) x~ = 10, x~ = 011; (b) xi = 111, x~ = 00101; (c) xt = 0101, x~ = 1000.

(3) () {X(t) when t is odd, Y t = x(t) when t is even:

(a) x~ = 00, x~ = 100101; (b) xi = 101, x~ = 110; (c) xt = 0101, x~ = 11111.

(4) y(t) = { ~(t _ 2) EB y(t - 1)

(a) x~ = 10, x~ = 010; (b) xt = 1110, x~ = 1011101; (c) xi = 110, x~ = 00101.

(5) y(t) = { ~(t) --+ y(t - 1)

(a) xi = 011, x~ = 1111; (b) x~ = 01111, x~ = 00111;

when t = 1,2, when t :2: 3:

when t = 1,2, when t :2: 2:

Page 153: Problems and Exercises in Discrete Mathematics

144 CHAPTER 6. FINITE AUTOMATA

(c) xi = 0100, x~ = 111010.

(6) y(t) is a t-th digit after point in the binary expansion of the number 9/20: (a) Xl - 0 x6 - 001110' 1 - , 2 - ,

(b) xi = 101, x~ = 1001011; (c) xi = 1101, x~ = 00100.

(7) (t)={ x(t) ifx(I):x(2)+ ... +x(t)<t/2, y 1 otherwIse:

(a) x~ = 10, x~ = 0011; (b) xi = 111, x~ = 01111; (c) xi = 1101, x~ = 10010.

{

t-I

(8) y(t) = 1 if t = 1 or if t ~ 2 and 1 + i~Y - x(i)) . i ::; t· x(t),

o otherwise:

(a) x3 - 011 x3 - 101' 1 - ,2 - ,

(b) x~ = 11, x~ = 0101; (c) x~ = 11001, x~ = 10110.

6.1.11. Prove that the function 'PI is a residual operator of d.-function 'Po E <P2 (as usual 'Po = 'Po(XW) = iJw = y(l)y(2) ... y(t) ... and 'PI = 'PI(XW) = iJw = y(l)y(2) ... y(t) .. . ):

(1) 'Po: { y (1) = x (1), y(t) = x(t -1) . x(t), t ~ 2; y(l) = 0,

'PI : y(t) = -x (':"-t---l"'-) ----t-x-,(--,-t), t ~ 2;

{ y(l) = 0,

(2) 'Po: y(t) = y(t - 1) ---t x(t), t ~ 2; y(l) = x(I),

'PI : y(t) = x(t) V y(t - 1), t ~ 2; ( ) t y(t) = x(t),t = 1,2,3, 3 'Po: y(t) = y(t - 3) ---t y(t - 1), t ~ 4;

y(t) = O,t = 1,2, 'PI : y(t) = 1, t ~ 3;

( ) t y(t) = x(t), t = 1,2, 4 'Po: y(t) = ~(t - 2) ---t x(t), t ~ 3;

y(t) = x(t), t = 1,2, 'PI : y(t) = x(t) ---t y(t - 2), t ~ 3;

(5) 'Po: y(t) is the t-th digit after the point in the binary expansion of the number 7/60,

'PI: y(t) is the t-th digit after the point in the binary expansion of the number 13/15.

Page 154: Problems and Exercises in Discrete Mathematics

6.1. DETERMINED FUNCTIONS 145

6.1.12. Find out whether the function 'f! E 4>2 is a b.d.-function and determine its weight:

(1) (t) = { 1 when t = 1, Y i( t - 1) when t ::=: 2;

(2) (t) _ { 0 when t = 1, Y - x(t) when t::=: 2;

(3) (t) = { x(l) when t = 1, Y y(t-l) whent::=:2;

(4) (t) = {X(l) when t = 1, Y 0 when t ::=: 2;

(5) (t) _ { x(l) when t = 1, Y - y(t-l)-tx(t) whent::=:2;

(6) () {I when t = 1,2, y t = x(t - 2) when t ::=: 3;

{ x(l) (7) y(t) = x(l) EEl x(2) EEl··· EEl x(t)

when t = 1, when t::=: 2;

(8) () {I when t = 1,2, y t = y( t - 2) EEl x( t - 1) when t ::=: 3;

{ 0 if t = 1,

(9) y(t) = x(t) EEl y(t - 2) if t is odd and t ::=: 3, x(t - 1) if t is even;

(10) (t) _ { 1 when t = 1, y - x([t/2]) -t x(t) when t ::=:2;

(11) (t) = {O ift = 1,2, ... ,1, y y(t-l) whent::=: 1+1, I::=: 1;

(12) y(t) is the t-th digit after the point in the binary expansion of the number

7/15;

{ Yl(l) = 0,

12 Y2(1) =1, (13) 'f! E <1>2' and 'f! : Yl(t) = Y2(t - 1), t::=: 2,

Y2(t) = Yl(t - 1), t::=: 2;

{ Yl(l) = xl(l)· X2(1),

22 Y2(1) = Xl(l) V x2(1), (14) 'f! E <1>2' and'f!: Yl(t) = Xl(t) V X2(t) V Y2(t -1), t::=: 2,

Y2(t) = Xl(t) . X2(t) . Y2(t - 1), t ::=: 2.

6.1.13*. Let DA,B be a loaded tree representing a b.d.-function 'f!: AW --+ BW. Each vertex of the tree D A, B is assigned a number equal to the weight of its subtree. We obtain a new tree [) A B.

Page 155: Problems and Exercises in Discrete Mathematics

146 CHAPTER 6. FINITE AUTOMATA

(1) For any r ~ 1, give an example of a b.d.-function c.p, such that each vertex of the tree [) A, B corresponding to the function c.p is labelled by the number r.

(2) For any r ~ 2, give an example of a b.d.-function such that for j = 0, 1, ... , r - 1, each j -th rank vertex of the tree [) A, B corresponding to the function c.p is labelled by the number r - j.

6.1.14. (1) Prove that the tree [) A, B constructed according to the conditions of Problem 6.1.13 has the following property: the sequence of numbers 1I( VI)' 1I( V2), ... assigned to the vertices of the oriented chain VI, (VI, V2), V2, (V2' V3), V3, ... (finite or infinite) is monotonically nonincreasing, and that this sequence is stabilized for an infinite chain.

(2) Show that any residual operator of the function c.p E <1> A, B has a weight not exceeding the weight of the function c.p.

6.1.15. The tree representing the function c.po(XW) E <1>2 is of the following form: the symbol 1 is assigned only to the arcs belonging to the oriented chain emanating from the root and corresponding to the input word 101001000100001 ... ( here x(t) = 1 only for t = G), i = 2, 3, ... ); the remaining arcs are labelled by the symbol O. Prove that the function c.po has an infinite weight and is therefore not boundedly determined.

6.1.16. For each r ~ 2, obtain an example of a b.d.-function of weight r

satisfying the following condition: in the loaded tree representing this function, the symbol 1 is assigned only to some (not necessarily all) arcs of a single infinite oriented chain Z emanating from the root. The remaining arcs (not belonging to the chain Z) are assigned the symbol O.

A word XW E AW is called quasi-periodic if there exist integers no and T, such that no ~ 1, T ~ 1, and x(n + T) = x(n) for n ~ no. In this case, the prefix x(1)x(2) ... x(no - 1) of the word XW is called a pre-period, the number no - 1 a length of the pre-period, the word x(no)x(no + 1) ... x(no + T - 1) a period of the word xW , and the number T a length of the period. Such a quasi-periodic word can be presented in the form

x(1)x(2) ... x(no - 1)[x(no)x(no+1) ... x(no+T-1}t.

6.1.17. (1) Prove that if the function rp E <I>A,B, then any quasi-periodic word in AW is transformed by the function c.p into a quasi-periodic word in BW.

(2) Confining yourself to the set <1>2, show that the statement converse to the one formulated in part (1) is not true.

Hint. See Problem 6.1.15.

6.1.18*. Disprove the following statement: if a d.-function c.p(XI ,X2) : {O, l}w X {O, l}w -t {O, l}W depends essentially

on the variable Xl and if for every (fixed) word x2' E {O, l}W, c.p(Xt, x2') is a b.d.-function, the function c.p(XI' X 2 ) is also boundedly determined.

6.1.19. Suppose that all the vertices of a loaded tree are divided in the normal way into equivalence classes. Prove that any equivalence class has a vertex V

Page 156: Problems and Exercises in Discrete Mathematics

6.1. DETERMINED FUNCTIONS 147

satisfying the condition that all the vertices in an oriented chain emanating from the root of a tree and terminating at the vertex v are not pairwise equivalent.

6.1. 20. (1) Prove that for each vertex of a loaded tree having a weight r, there exists an equivalent vertex having a rank not higher than r - 1.

(2) Can we replace r - 1 in the previous problem by r - 2 if r ::::: 27

Let h(Xl, X2, ... , xn), h(xl, X2, ... , xn), ... , fm(xl' X2, ... , xn) be a function of the type Ek x Ek X ... X Ek --t El , where k and I are not lower than

"--v-'"' n times

2. The operator 'Ph,h, ... ,jm in <I>~:;n is called an operator generated by the functions fl' 12, ... , fm if the following equalities hold for all t ::::: 1:

Yi(t) = fi(xl(t), X2(t), ... , xn(t)), i = 1, 2, ... , m.

6.1.21. Show that an operator in <I>~:~ is generated (by a function of the type [')k x Ek ~ ... X Ek, --t El) if and only if its weight is equal to 1.

n times

6.1.22. Find out if the operator 'P E <I>~' 2 defined by the following relations is a generated operator:

{ Yl(l) = 0, Yl(t) = x(t - 1) Ell Y2(t - 1), t::::: 2, Y2(t) = x(t).

6.1.23. A partial operator 'P: {O, l}w --t {O, I}W is defined only at the input words OW and i w. Redefine it in such a way that the resulting operator has the minimum possible weight.

(1) 'P(OW) = 0101[100]W, <p(iW) = 11[10]W; (2) 'P(OW) = Ol[Oll]W, <p(iW) = 1010010 ... ,

i.e. y(t) = 1 only for t = G), i = 2,3, ...

6.1.24. (1) Prove that if IAI > 1 and IBI > I, the cardinality of the set <I>A,B is equal to the continuum.

(2) Find the cardinality of a set <I> A,B for the case when either IAI = 1 or IBI = 1.

6.1.25. The words xr and x~ in AWare called s-equivalents (notation: xr Ps x~) if their prefixes of length s (s ::::: 1) are equal. The relation ps is the equivalence relation and divides the set AW into classes Kj(s) of s-equivalent words.

(1) Find the size of each class Kj{ s) (s is a fixed number). (2) How many different classes Kj(s) exist for a fixed s7 (3) How many different classes Kji(S + I) exist in each class Kj(s) (here I ::::: I)? (4) Prove that the mapping 'P: AW --t BW is a d.-function if and only if for all

s ::::: 1 and for any words xr and x~ belonging to the set AW, the relation xr ps x~ leads to the relation 'P(xr) Ps 'P(x~).

6.1.26. (1) Show that the set <I>A,B is countable infinite for IBI ::::: 2. (2) Find the cardinality of the set <I>A,B for IBI = 1.

Page 157: Problems and Exercises in Discrete Mathematics

148 CHAPTER 6. FINITE AUTOMATA

6.1.27. Let DA,B be a loaded tree representing a b.d.-function <p: A'" ~ BW of weight r. Let us change the output symbol of some arc in the j-th level of the tree DA,B (we assume that IBI 2:: 2). This leads to a tree DA,B representing a certain (new) b.d.-function <p' of weight r'.

(1) Show that 1 ~ r' ~ r + j. (2) Give an example of a b.d.-function <p at which the upper estimate r' = r + j

is attained.

6.2 Diagrams, Equations, and Circuits

Let Q = {Qo, Ql, ... , Qw-l} be a set of all states of the function <p in ~ A, B.

We associate a digraph r", with the function <p:

(1) the set of vertices of the digraph r", is the set Ew = {a, 1, ... , W - I}; the vertex j is assumed to correspond to the state Qj;

(2) if <p(i) and <p(j) are residual operators of the function <p represented by the states Qi and Qj respectively (<p(j) is also a residual operator of <p(i) and corresponds to the prefix Xl = a and if <p(i)(axw) = b<p(j)(xW)), then the digraph r '" contains the arc (i, j) and is assigned the expression a(b);

(3) the arc (i, j) exists in r", only when the conditions in (2) are satisfied. The vertex in r "" corresponding to the initial state of the function <p, is often

marked by an asterisk. Suppose that m arcs, which are assigned the expressions al(bl ), a2(b2), ... , am(bm), pass from vertex i to vertex j (here, it is essential that ap # aq for p # q, although some or all of the symbols b. may be identical); we shall then join i with j through a single arc (i, j) which is assigned all the expressions ap(bp), p = 1, m. The digraph r", is called the Moore diagram of function <po

Two vertices VI and V2 of Moore's diagram are called equivalent if the vertices of the diagram can be labeled so that the following conditions are satisfied:

(a) the labels of vertices VI and V2 are the same; (b) if Ul and U2 have the same labels, then for any input symbol a the corres­

ponding arcs (Ul, WI) and (U2' W2) have the same label a(b), and the ends of these arcs (i.e. the vertices WI, W2) have the same labels.

The operation of identifying equivalent states consists of the following: (1) the vertices with the same labels are replaced by the single vertex; (2) emerging at the first step parallel arcs with the same labels are substituted for the single arc (with the same direction and the same label).

A vertex v of Moore's diagram is called accessible from the (initial) vertex U if there exists a directed chain coming out of the vertex U and coming into the vertex v. The initial vertex is accessible by definition.

The operation of eliminating unaccessible vertices consists of deleting the diagram of all vertices which are not accessible. The diagram, for which all vertices are accessible and not containing the equivalent vertices, is called reduced.

Using the informative trees, the following propositions are easily established.

Page 158: Problems and Exercises in Discrete Mathematics

6.2. DIAGRAMS, EQUATIONS, AND CIRCUITS 149

(a) The operation of eliminating unaccessible vertices in Moore's diagram leads to the diagram realizing the same function.

(b) The operation of identifying equivalent states in Moore's diagram leads to the diagram realizing the same function.

(c) The number of vertices in the reduced Moore's diagram of a b.d.-function is equal to the weight of this function.

Two functions can be associated with this diagram: (a) F: A x Q -t B is output function, (b) G: A x Q -t Q is transition function. The functions F and G in r'P are defined as follows: from the pair (a, j), we

determine the vertex j and an arc emanating from j which is assigned the input symbol a (suppose that this arc has the form (j, r)); the value of the function F on the pair (a, j) is an output symbol which is assigned to the arc (j, r) and which appears after the symbol a in parentheses. The value of the function G on the pair (a, j) coincides with r, i.e. it is equal to the "number" of the states which "is the end" of the arc (j, r).

The system of equations

{ y(t) = F(x(t), q(t - 1)), q(t) = G(x(t), q(t - 1)), q(O) = qo,

(1)

where x(t) E A, y(t) E B, q(t) E Q (t = 1, 2, ... ) and qo E Q is called the canonical equations for the operator'f! with the initial condition qo.

With the help of Moore's diagram and canonical equations, we can also specify determined operators that are not boundedly determined. The set of vertices of the digraph r'P corresponding to such a d.-operator coincides with the natural scale N = {O, 1, 2, ... }.

If 'f! is a boundedly determined operator, the functions F(x(t), q(t - 1)) and G(x(t), q(t -1)) (see Eqs. (1)) and the arguments on which these functions depend assume a finite number of values. Hence, it is possible to compile a canonical table of the b.d.-operator 'f! (see Table 6.1).

Table 6.1

.r( t) q( t - 1) y(t) q( t)

a J F(a,j) G(a,j)

Page 159: Problems and Exercises in Discrete Mathematics

150 CHAPTER 6. FINITE AUTOMATA

Instead of the canonical equations (1), it is convenient to consider canonical equations in which the input and transition functions are functions of the k-valued logic Pk (k ;::: 2). In order to obtain a corresponding representation of the operator <p

the alphabets A, Band Q are coded by vectors whose coordinates belong to the set Ek (k ;::: 2). If <p is a b.d.-operator and n =]logk IAIL m =]logk IBI[, l' =]logk IQIL then it is sufficient to take vectors (whose coordinates belong to Ek ) of length n, m, and l' to code letters from the alphabets A, Band Q, respectively.2 In this case, the system (1) is transformed as follows:

Ym(t) = Fm(Xl(t), ... , xn(t), ql(t - 1), ... , qr(t - 1)), ql(t) = G1 (Xl(t), ... , xn(t), ql(t - 1), ... , qr(t - 1)), (2)

qr(t) = Gr(Xl(t), ... , xn(t), ql(t - 1), ... , qr(t - 1)), ql(O) = QOl, ... , qr(O) = qOr'

Henceforth, we shall also use a "vector form" of systems similar to (2). In such a notation, system (2) has the form

{ y(m)(t) = F(m)(x(n)(t), q(r)(t - 1)), q(r)(t) = G(r)(x(n)(t), q(r)(t - 1)), q(r)(o) = q~).

(3)

The functions Fi and G1 in (2) are, in general, partial functions, i.e. they are not defined everywhere. Usually, they are redefined in such a way that the right-hand sides of Eqs. (2) acquire the simplest possible form.

The canonical table describing the b.d.-operator <p corresponding to (2) has m + n + 21' columns and kn +r rows.

The equations in system (2) are called canonical equations in scalar form, while the equations in (3) are canonical equations in vector form.

It can be assumed that system (2) defines an operator in the set <P~' m .

Let a d.-operator <p be defined by system (2), and let each of the functions Fi and G[ be a function of the k-valued logic Pk (k ;::: 2), which are defined everywhere. We shall consider the operator <p as an element of the set <P~' m. The circuit ~'P of the operator cp is defined as follows: ~'P is a network whose poles are assigned the symbols of input and output variables, while some of the vertices other than the poles are assigned symbols of some d.-operators (in the set U~l U~=l <p~,s'). The circuit of <p in <p~,m will be presented in the form of a rectangle (Figure 6.5) with n input and m output channels. The input channels are represented by arrows emanating from the input poles, while the output channels are represented by arrows terminating at the output poles. The poles are represented in the form of circles. If m = 1 the circuit ~'P of the operator <p can sometimes be represented in the form of a triangle (Figure 6.6) with n input poles and one output pole.

2If the d.-operator 'P is not a b.d.-operator, r = 00.

Page 160: Problems and Exercises in Discrete Mathematics

6.2. DIAGRAMS, EQUATIONS, AND CIRCUITS 151

:~ I

~:~ Xl

X,

• • • • • • Ym X.

>----oY

Fig.6.5 Fig.6.6

We assume that an input symbol Xi(t) E Ek is "supplied" to the i-th input Xi at each instant of time t = 1, 2, ... , while the value Yi(t) = Fj(Xl(t), ... , xn(t), ql(t - 1), ... , qr(t - 1)) is delivered (represented) at the j-th output Yj. The output Yj is said to have a delayed dependence on the input Xi if the function Fj(x(n)(t), q(r)(t - 1)) does not depend essentially on the variable Xi(t).

The concept of a delayed dependence can be introduced in a different way. Let us consider, for example, a d.-function of the type <P(Xl' X2 , ... , Xn) : Al x A2 X

... x An --t B and define its delayed dependence on the variable Xl. The function <p depends with a delay on Xl, iffor any input words xr, x'2, ... , x~ (xj E Aj, j = 0), the s-th letter of the f)w = <p(xr, x'2, ... , xl:) is defined by the first s symbols of the words x'2, ... , x~ and s - 1 first symbols of the word xr.

Suppose that a d.-function <p is defined by Eqs. (2) and that E", is the circuit of this function. We define three operations involving <p and E",.

(1) Operation 0 1 involves the identification of two or more input variables in the function <p and the identification of the input poles corresponding to these variables in the circuit Etp. The identified poles are considered as a single Figure 6.8 pole in the new circuit. Figure 6.7 shows a circuit E,p obtained from E", by identifying poles Xl and X2·

(2) Operation O2 involves the deletion of an output variable Yj in the function <p (which is equivalent to the deletion of the equation Yj(t) = Fj(x(n)(t), q(r)(t - 1)) from (2)) and the deletion of the output channel and the pole corresponding to the output variable Yj from the circuit E", (see Figure 6.8, which shows the circuit E,p obtained from E", after the deletion of the output channel and the pole YI).

Remark 1. If m = 1, the deletion of the variable YI (the only output variable) leads to an automation without an output.

(3) Operation 0 3 involves the introduction of a feedback of one input and one output variable. Let us take the variables Xi and Yj as the input and output variables. The operation 0 3 can be applied (to the function <p and circuit Etp) only ifthe output Yj has delayed dependence on the input Xi. The canonical equations for the new function 1jJ are obtained by deleting the equation Yj(t) = Fj(x(n)(t), q(r)(t - 1)) from system (2) and by replacing the variable Xi(t) in each of the functions Fs (s = 1, ... , m, s I- j) and G1 (l = 1, ... , r) by the function Fj(XI(t), ... , Xi-l(t), Xi+1(t), ... , xn(t). ql(t-1), ... , qr(t-1)) obtained from the function Fj(x(n)(t), q(r)(t-1)) by deleting the fictitious variable Xi(t). The initial conditions remain the same as before. The circuit E1jJ is obtained from Etp by identifying the input Xl and output Y j. In this case, the identified poles are considered as a single internal vertex of the circuit E,p. Figure 6.9 shows the circuit E1jJ obtained from E", by introducing the feedback in variables Xl and YI.

Page 161: Problems and Exercises in Discrete Mathematics

152 CHAPTER 6. FINITE AUTOMATA

cp

Fig.6.7

Xn Xn ? (

... ...

cp 1V

... ... (

Fig.6.S

Xn Xn ? ? ?

...

cp

... ( (

Fig.6.9

Page 162: Problems and Exercises in Discrete Mathematics

6.2. DIAGRAMS, EQUATIONS, AND CIRCUITS 153

Remark 2. If n = 1, the introduction of a feedback in variable Xl (and any output variable) leads to an automation without input.

Remark 3. While applying the operations described above, it is convenient to indicate in parentheses (following the notation of these operations) the channels (poles and variables) to which these operations are applied. For example, we can use the notation 0 1 (X}, X3), 02(YS) and 03(XlO' Y2)'

Let us define two more operations with d.-functions.

(4) Operation 04 is the union of two (or more) functions. Let 'PI E <I>~I,ml

and 'P2 E <I>~2' m2. We shall assume that these functions have input variables " , d"" " t' I D th t t . bl Xl' X 2, ... , X n1 an Xl> X 2 , ... , X n2 ' respec lVe y. cor e ou pu varIa es,

we take y~, y~, ... , Y:"1 and Y?, y~, ... , Y::' 2 , respectively. All these variables are assumed to be pairwise different. Let E<Pl and E<P2 be the circuits of the functions 'PI and 'P2, respectively. In this case, the circuit E,p of the function 'ljJ, which is equal to the union of the functions 'PI and 'P2, will appear as shown in Figure 6.10. The output (input) poles of the circuit E,p are all output (input) poles of the initial circuits E"'1 and E<P2' The system of canonical equations (and initial conditions) of the function 'ljJ is obtained simply by a union of the corresponding systems of functions 'PI and 'P2 (naturally, it is assumed that the sets Q(1) and Q(2) of all the states of the functions 'PI and 'P2 are disjoint).

(5) Operation S is the superposition operation. Let 'PI E ell A, Band 'P2 E ell B, c. The superposition 'P2('PI) of operators 'PI and 'P2 is an operator 'ljJ E eIlA,c, such that "p(XW) = 'P2('PI(XW)) for any input word XW in AW. Let the operators 'Pi E eIlZi,m'(i = 1, 2), and let the circuits E<pl and E<P2 correspond to them (we assume that the input and output variables and the states of the functions 'PI and 'P2 are the same as in the preceding paragraph). In this case, we can consider a "different" superposition for these operators: for example, we identify the input pole x? of the circuit E<p2

with the output pole YI+I of the circuit E<pp the pole x~ with the pole YI+2' and so on. Finally, we identify the pole X::' I -1 with the pole Y:" I ' As a result, we get a circuit E,p (see Figure 6.11) for which: (a) all the input poles will be the input poles of the circuit E<Pl and the input poles of the circuit E<P2 not participating in the above identification procedure; (b) the output poles are all output poles of the circuit E<P2 and those output poles of the circuit E<Pl which were not identified with any of the input poles of the circuit E<P2' The identified poles are called the internal vertices of the circuit E,p. The circuit E,p is called the superposition of circuits E<P2

d ~ (. . bl " , ", " , ) If th t . an '-'<PI III varIa es Xl - Y'+J' X 2 - Y'+2' ... , X m1 - 1 - Yml . e opera or 'PI IS defined by the system of equations (4')

Page 163: Problems and Exercises in Discrete Mathematics

154

l:cp :

CHAPTER 6. FINITE AUTOMATA

<P2

Fig.6.10

Xj .x;:, x;,:-I+l

--- ------------------ -------------- ------------

• • •

IPI

• • •

•••

• • •

y; y; y;' Fig.6.11

y~ ( t) = F{ ( x~ ( t ), ... , X~, (t), q~ (t - 1), · .. , q~1 (t - 1)),

y;,.l(t)=F~,(X~(t), ... , X~,(t), q~(t-1), · .. , q~, (t - 1)),

q~(t) = G~(x~(t), ... , X~, (t), q~(t - 1), ... , q~,(t -1)),

q~,(t)=G~I(X~(t)' ... , X~,(t), q~(t-1), · .. , q~1 (t - 1)),

q~ (0) = qhl' ... , q~, (0) = qhTl'

.x;:' 1

y~

(4')

Page 164: Problems and Exercises in Discrete Mathematics

6.2. DIAGRAMS, EQUATIONS, AND CIRCUITS

and the operator tp2 is defined by the system of equations (4")

y~ ( t) = F{' (x~ (t), ... , X~2 (t), q~ (t - 1), ... , q~)t - 1)),

y:;'Jt) = F::'2(X~(t), ... , X~2(t), q~(t - I), ... , q~)t - 1)),

q~ ( t) = G~ (x~ ( t), ... , X~2 (t), q~' (t - 1), ... , q~2(t -1)),

155

(4")

then the operator 'ljJ represented by the circuit L,,p has the following system (5) corresponding to it:

where

y~ (t) = F{ (x; (t), ... , X~j ( t), q~ (t - 1), ... , q~j (t - 1)),

y;(t) = F{(x;(t), ... , X~j (t), q~(t - 1), ... , q~j (t - 1)),

y~(t) = F{'(F!+1' ... , F:"j' X~Lj_l+1(t), ... , x~) t), ql (t - 1), ... , qT2 (t - 1)),

y:;'Jt) = F::'JF{+1' ... , F:"j' X:;'j_l+l(t), ... , X~2 ( t), ql (t - 1), ... , qT2 (t - 1)), q~(t) = G;(xW), ... , X~l(t), q~(t -I),

... , q~l (t - 1)),

q~l (t) = C~l (x; (t), ... , X~j (t), q~ (t - 1), ... , q~j (t - 1)),

ql(t) = C;(F!w ... , F:"j' X:;'l-I+I(t), ... , x~,( t), ql (t - 1), ... , qT2 (t - 1)),

qT2(t) = C~2(F{+1' ... , F:"l' X:;'l-I+1(t), ... , X~2 ( t), ql (t - 1), ... , qT2 (t - 1)),

q~ (0) = q~I' ... , q~j (0) = q~Tj' ql (0) = q~I' ... , qT2 (0) = q~T2'

j=I+1, ... , Inl.

(5)

The element of unit delay (in the set <h) is a b.d.-operator tpd defined by t.he

Page 165: Problems and Exercises in Discrete Mathematics

156

system of equations (6)

CHAPTER 6.

{ y(t) = q(t - 1), q(t) = x(t), q(O) = 0.

FINITE AUTOMATA

(6)

Every b.d.-operator in <I>~' m may be represented by a circuit generated by a set containing: (1) circuits representing an element of unit delay; (2) circuits representing operators generated by functions from a certain set that is complete in Pk. In other words, the set of b.d.-operators formed by the element tpd and the operators generated by functions from a certain set complete in Pk form a set that is complete in Un,m <I>;;"n with respect to the operations 0 1 , O2 , 0 3 , 0 4 , and S.

Remark 4. Henceforth, while constructing a circuit of any b.d.-operator tp

generated by a certain given set M of b.d.-operators, we shall adopt the following procedure: the circuit ~'I' of the operator tp is constructed by using only single­output circuits representing operators in the set M (in this case, unless stipulated otherwise, we can only carry out the operations 0 1 , O2 , 0 3 , 0 4 , and S).

Example 1. Construct the Moore diagram, the canonical table, and the canonical equations for the function tp E <1>2 tp(iW ) = y(l)y(2) ... y(t) ... :

(a) y(t) = { ~ when t = 1, when t 2: 2;

{ I when t = 1, (b) y(t) = x(l) when t 2: 2;

{ x(t) when t is odd, (c) y(t) = x(t _ 1) when t is even;

Solution. (a) Having built 3 levels of the informative tree of a given func­tion (see Figure 6.12), we see that all the tree's vertices are divided into two equivalence classes: the first class contains only vertex 0, and the second includes all the remaining vertices. Hence, the weight of the considered function is equal to 2. So its Moore diagram can be built from the reduced tree by identifying the vertices 1, 2, 3, 4 and recovering the input symbols corresponding to the tree's edges (see Figure 6.13).

o

3Vv 1 1

1 2 o 0

o

*. 0(0), l~ ()) o 1

1(1)

Fig.6.12 Fig.6.l3 Fig.6.14

Further, with the help of Moore's diagram (see Figure 6.14), we build a canonical table. Let Xl (t) and Yl (t) be the input and output variables (to point out its

Page 166: Problems and Exercises in Discrete Mathematics

6.2. DIAGRAMS, EQUATIONS, AND CIRCUITS 157

difference from variables of the function's initial definition). Let q(t - 1) and q( t) be variables for the description of the function's states on input and output correspondly. Table 6.2 is the obtained canonical table.

Table 6.2

Xl (t) q( t - 1) YI (t) q( t) 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 1

It follows from the canonical table that YI(t) = q(t -1) and q(t) = 1. Therefore, we obtain the following canonical equations and initial condition:

YI(t) = q(t - 1), q(t) = 1, q(O) = O.

(b) To find out the weight of the function is to count the number of vertices in the reduced Moore diagram. It is sufficient to consider the first three levels of the informative tree (see Figure 6.15). The weight of the function is equal to 3. The vertex 0 is the first equivalence class. The second one consists of the vertices 1, 3, 4, etc. The third equivalence class consists of the vertices 2, 5, 6 etc. The reduced tree and the Moore diagram are shown in Figures 6.16 and 6.17.

*

o Fig.6.15

0(0) 1(0)

0(1) 1(1)

3

o Fig.6.16

Let us construct a table. Let x(t) and y(t) be the input and output variables, correspondly. Let ql(t -1), q2(t -1) and ql(t), q2(t) be the variables for the description of the function's states of input and output, correspondly. State 0 is encoded by pair (0,0) (i.e. ql = q2 = 0), state 1 is encoded by

Fig. 6.17 the pair (0,1), and state 2 is encoded by the pair (1,0). The corresponding canonical table is presented in Table 6.3.

Page 167: Problems and Exercises in Discrete Mathematics

158 CHAPTER 6. FINITE AUTOMATA

Table 6.3

x(t) ql (t - 1) q2( t - 1) y( t) ql(t) q2(t) 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 1 1 0 0 1 1 1 0 0 1 1 0 1 0 1 0 0 1 1 1 0 1 1 0 1 1 1

Note that for ql(t - 1) = q2(t - 1) = 1, the values of the functions y(t), ql(t), q2(t) are absent in the diagram. Therefore the functions y(t), ql(t), q2(t) are partial Boolean functions. We complete their definition as shown in Table 6.4.

Table 6.4

x( t) ql (t - 1) q2( t - 1) y( t) ql(t) q2(t) 0 1 1 0 1 0 1 1 1 0 0 1

Such a continuation gives a simple enough representation of the functions y(t), ql(t), q2(t) depending on the variables x(t), ql(t - 1), q2(t - 1)):

(c) It is enough to build 4 levels of an informative tree (see Figure 6.18). All the tree's vertices can be divided into three equivalence classes. The first class contains vertices 0, 3, 4, 5,6, etc., the second includes vertices 1, 7, 9, 11, 13, etc., and the third class contains vertices 2, 8, 10, 12, 14, etc. The weight of the given function is equal to 3.

The reduced tree is presented on Figure 6.19. It allows to construct the Moor diagram as in the previous case. The canonical table is presented in Table 6.5. The values of the functions y(t), ql(t), q2(t) for ql(t - 1) = q2(t - 1) = 1 are defined to be zeros.

Page 168: Problems and Exercises in Discrete Mathematics

6.2. DIAGRAMS, EQUATIONS, AND CIRCUITS

o

Fig.6.18

Table 6.5

x(t) ql (t - 1) q2( t - 1) y( t) ql(t) q2( t) 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1 1 1 0 1 0 0 1 1 1 0 1 1 0 1 1 0 0 0 1 1 1 0 0

As a result, we obtain the following canonical equations:

{ y(t) = x(t)· ih(t - 1) V :(t) . iit(t - 1), ql ( t) = x ( t) . ql (t - 1) . q2 (t - 1), q2(t) = x(t)· ih(t - 1) . eh(t - 1), ql(O) = q2(O) = o.

1 0 0 0 0 0 0 0

159

o

Fig.6.19

Example 2. Find out the weight of the b.d.-function 'P E <1>2 defined by the following canonical equations:

Solution. This problem can be solved by constructing the informative tree of the function cp. But we are going to solve this problem in another way. First, we build its canonical table, then we construct the Moore diagram, and, finally, we obtain the reduced diagram. The number of vertices in the reduced diagram turns

Page 169: Problems and Exercises in Discrete Mathematics

160 CHAPTER 6. FINITE AUTOMATA

out to be equal to 2. It is easy to check that the weight of the function is more than 1. Hence, it equals 2.

1(0) 1(0)

1 (0) 0(1) 1 (0)

~ * 0(0)

Fig.6.20 Fig.6.21

The canonical table of the function cp is Table 6.6. The Moore diagram is presented in Figure 6.20. Analyzing the diagram, we can conclude that the state 00 is equivalent to state 01 and state 10 is equivalent to state 11. The reduced diagram is presented in Figure 6.21.

Table 6.6

x(t) ql(t - 1) q2(t-l) y(t) ql(t) q2(t) 0 0 0 1 1 0 0 0 1 1 1 1 0 1 0 0 0 1 0 1 1 0 0 0 1 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 1 1 1 1 0 1 0

Therefore, the weight of the function cp is equal to 2. (It is not difficult to see that variable q2 is fictitious. So function cp is equivalent (by its functionality) to function cp' which has the following canonical equations:

{ y(t) = x(t) . ij(t - 1),

cp/: q(t) = x(t) '" q(t - 1), q(O) = 1.

The weight of the function cp' is equal to 2.)

Example 3. Find out the weights of the b.d.-functions obtained from the b.d.­function cp by identifying all possible pairs of input variables XI, X2, and X3:

Page 170: Problems and Exercises in Discrete Mathematics

6.2. DIAGRAMS, EQUATIONS, AND CIRCUITS 161

1 y(t) = q(t - 1) -. (XI(t) V X2(t) V X3(t)), 'P: q(t) = Xl(t) . X2(t) . X3(t) -. ij(t - 1),

q(O) = O.

Solution. Let Xl = X2. Then we obtain the function 'P12:

1 y(t) = q(t - 1) -. (Xl(t) V X3(t)), 'P12: q(t) = 1,

q(O) = O.

The Moore diagram of this function is displayed in Figure 6.22. The weight of the function yl2 is equal to 2. Let Xl = X3. Then we obtain the function 'P13:

{ y(t) = 1,

'P13: q(t) = xI(l) . X2(t) -. ij(t - 1), q(O) = O.

00(1) 10(1) 00(1)

* 00(1 ),01 (1)

° 10(1),11(1) 1

11(1) 11(1) 11(1)

Fig.6.22 Fig.6.23

00(1) 00(1)

* 00(1),01 (1)

° 10(1),11(1) 1

11(1) 11(1)

Fig.6.24

The Moore diagram and reduced diagram of this function are presented in Figure 6.23. The weight of the function 'P13 is equal to 1.

Let 1:2 = .[3. Then we obtain the function 'P23:

{ y(t) = 1,

'P23 : q ( t) = 1, q(O) = O.

The Moore diagram and reduced diagram of this function are presented on Figure 6.24. The weight of the function y23 is equal to 1.

Page 171: Problems and Exercises in Discrete Mathematics

162 CHAPTER 6. FINITE AUTOMATA

Example 4. Construct tne canonical equations and Moore diagram of the b.d.­functions obtained from the b.d.-function 'P by introducing the feedback in pairs of variables (Xl, YI), (X2' YI) and (X2' Y2). Find out the weights of the obtained functions as well:

{

YI (t) = ij( t - 1), Y2(t) = XI(t) . q(t - 1),

'P: q(t) = XI(t) . q(t - 1) V X2(t), q(O) = O.

Solution. Let us introduce the feedback in variables Xl, and YI. In order to find out the canonical equations of the newly obtained function one has to replace XI(t) in equations Y2(t) = XI(t) . q(t - 1) and q(t) = XI(t) . q(t - 1) V X2(t) by the right part of the equation YI(t) = ij(t - 1). Then, we obtain

{ Y2(t) = 0,

'P1l : q(t) = X2(t), q(O) = O.

The Moore diagram and reduced diagram of this function are presented in Figure 6.25. The weight of the function 'P11 is equal to 1.

0(0) 1(0) 0(0)

'oW Fig.6.25

Let us introduce the feedback in variables X2, and YI. Then we obtain the function

{ Y2(t) = XI(t) . q(t - 1),

'P21 : q(t) = XI(t)· q(t - 1) V X2(t) = XI(t) V ij(t - 1), q(O) = O.

The Moore diagram of this function is presented on Figure 6.26. The weight of function 'P21 is equal to 2.

0(1) 0(1)

* 0 0(0) 1 ~O 0

1(1) 1(1)

Fig.6.26 Fig.6.27

Page 172: Problems and Exercises in Discrete Mathematics

6.2. DIAGRAMS, EQUATIONS, AND CIRCUITS 163

Let us introduce the feedback in the variables X2, and Y2' Then we obtain the function

{ YI(t) = q(t - 1),

<P22: q(t) = XI(t) . q(t - 1), q(O) = O.

The Moore diagram and reduced diagram of this function are presented on Figure 6.27. The weight of function <P21 is equal to 1. This function is autonomous (generated by the constant 1).

Example 5. Construct the canonical equations and the Moore diagram for the superposition 'PI('P2) (in variables Y2 - xd of the b.d.-functions 'PI and 'P2 from cl>2. Find out the weight of this superposition:

YI(t) = xo(t)· q(t - 1) V XI(t), ql(t) = xo(t) V XI(t) V ql(t - 1), ql(O) = 1, Y2(t) = X2(t) EB q2(t - 1), q2 ( t) = X 2 ( t) V q2 (t - 1), q2(0) = o.

Solution. The canonical equation of the superposition 'P = 'PI ('P2) in the variables Y2 - Xl can be obtained, firstly, by replacing the variable Xl (t) in the canonical equations of the function 'PI by the right part of the equation Y2( t) = X2(t) EB q2(t - 1). Then we need to add the equation q2(t) = X2(t) V q2(t - 1) and the initial condition q2(0) = 0 to the already obtained equations. So we have

{ YI(t) = xo(t)· ql(t - 1) V (X2(t) EB ~2(t - 1)),

. qdt) = xo(t) V X2(t) EB q2(t - 1) V ql(t - 1), 'P . q2 ( t) = X 2 ( t) V q2 (t - 1),

ql(O) = 1, q2(0) = o.

Therefore, the weight of function 'P is not greater than 4 (because every variable ql, q2 can be either 0 or 1).

01

Fig. 6.28

The Moore diagram is displayed on Figure 6.28. The corresponding reduced diagram contains the vertices 01, 10, and 11. The weight of the super­position 'P equals 3.

Example 6. For the operator 'P in cl>2 which is defined with the help of Moore's diagram presented in Figure 6.29, construct a circuit in a basis con­sisting of the function X 1 Y (the Pierce arrow element). (see Figure 6.31 ) and the unit delay element (see Figure 6.32).

Page 173: Problems and Exercises in Discrete Mathematics

164

0(1), 1 (0) 0(0)

O·~ 1(0)

Fig.6.29

Fig.6.31

CHAPTER 6. FINITE AUTOMATA

q(t-1)

Fig.6.30

Fig.6.32

Solution. The canonical table for the given operator obtained from the Moor's diagram is shown in Table 6.7

Table 6.7

x(t) q( t - 1) y(t) q(t) 0 0 1 1 0 1 0 1 1 0 0 1 1 1 0 0

The canonical equations of the operator are the following:

{ y(t)=x(t)·ij(t-l), q(t) = x(t) V ij(t - 1), q(O) = O.

Page 174: Problems and Exercises in Discrete Mathematics

6.2. DIAGRAMS, EQUATIONS, AND CIRCUITS 165

Figure 6.30 shows a circuit representing this operator. The circuit is constructed by using the canonical equations and the following relations:

and

y(t) = x(t) . q(t - 1) = x(t) 1 q(t - 1),

q(t) = x(t) V q(t - 1) = x(t) 1 q(t - 1),

Z = Z 1 z.

Example 7. Construct a circuit for the function '-P E <1>2' in a basis consisting of the unit delay element and operators generated by disjunction, conjunction, and negation:

YI(t) = XI(t) . ql(t - 1) V X2(t)· X3(t), Y2(t) = q2(t - 1) -t XI(t) V X3(t),

'-P : ql ( t) = ql (t - 1) EB q2 (t - 1), q2(t) = XI(t) . X2(t) . ql(t - 1), ql (0) = q2(0) = o.

Solution. First we construct a circuit generated by the set consisting of disjunction, conjunction, and negation for the following system of Boolean func­tions:

YI = Xl . ql V X2 . X3, Y2 = ih V Xl V X3, q~ = ql . q2 V ql . q2, q~ == Xl' X 2 . qi.

(We use such formulae as X -t Y = X V Y and X EB Y = xfj V xy.)

The circuit for the last system of functions has 5 input channels (in variables Xl, X2, X3, ql, and q2) and 4 output channels (in variables YI, Y2, q~, and q~). Let us denote this circuit as E*. It is presented on Figure 6.33.

The input and output poles of this circuit are displayed by light circles. The internal poles are denoted by dark circles. The functional (logical) elements are displayed as triangles with two (for conjunction and disjunction) or one (for negation) input channels. Every logical element has only one output channel. The internal poles are marked by functions whose circuits are sub circuits of E* (with corresponding inputs).

Page 175: Problems and Exercises in Discrete Mathematics

166 CHAPTER 6. FINITE AUTOMATA

Fig.6.33

o 0

d d

Fig.6.34

In order to obtain the circuit ~cp, it is sufficient to subsequently connect the outputs q~ and q~ of the circuit ~* with the elements of a unit delay (the operation of superposition) and then introduce the feedback in pairs of the channels qr - ql

and q~ - q2 where q;' corresponds to the input, and q; corresponds to the output channel of the elements of a unit delay.

The circuit ~cp is presented on Figure 6.34. (Zeros near the elements of a unit delay denote that the output symbols of these element are equal to 0 at the moment t = 1.)

Page 176: Problems and Exercises in Discrete Mathematics

6.2. DIAGRAMS, EQUATIONS, AND CIRCUITS 167

Example 8. Using the circuit I;", of function 'fI E <1>2 (see Figure 6.35) construct the canonical equations of 'fl.

Fig.6.35 Fig.6.36

Solution. Having removed the delay elements from the circuit I;"" we obtain the circuit I;~ (see Figure 6.36) which has the additional output (q~ and q;) and input (ql and q2) poles. The conduct functions for every pole are the following system of Boolean functions

Yl = Xl . X2 Ell ih, Y2 = ql . (X2 V (h), q~ = Xl Ell X2 V i12 = Xl Ell X2 . q2, q; = (Xl· X2 Ell ih) . X2 = (Xl ~ ql) . X2·

In order to obtain the canonical equation for the circuit I;"" one needs to take into account the time and the initial condition:

Yl(t) = Xl(t) . X2(t) Ell ih(t - 1), Y2(t) = ql(t - 1) . (X2(t) V ij2(t - 1)), ql(t) = Xl(t) Ell X2(t)· q2(t - 1), q2(t) = (Xl(t) ~ ql(t - 1)) . X2(t), ql ( 0) = q2 ( 0) = O.

Example 9. Construct the canonical equations for the functions presented by circuits (see Figure 6.37).

Page 177: Problems and Exercises in Discrete Mathematics

168 CHAPTER 6. FINITE AUTOMATA

n~2

y (I)

a b c d e

Fig.6.37

Solution. (a) The presented circuit realizes the function 'PI(X) = 'Px('Pd(X)) where 'Px is the b.d.-function generated by the function x from P2' Using "the language of sequences", the function 'PI (x) can be described as follows: 'PI (XW) = lX( 1 )x(2) ... x( t) .... Therefore, we can write out the canonical equations:

y(t) = q(t - 1), q(t) = x(t), q(O) = O.

(b) The presented circuit realizes the function 'P2(X) = 'Pd('PI(X)), That means 'P2( XW) = 01x(1 )x(2) ... x( t) .... Further, taking in account that the functions 'Pd and 'PI are defined by the following canonical equations:

we have

{ y(t) = ql(t - 1), qi ( t) = q2 (t - 1), q2(t) = x(t), ql(O) = q2(O) = o.

(c) The given circuit realizes the b.d.-function

Page 178: Problems and Exercises in Discrete Mathematics

6.2. DIAGRAMS, EQUATIONS, AND CIRCUITS 169

'P~n)(X) = 'Pd(tpd( ... (tpd(X) ... ) which is the n-steps delay. It is obvious that ~

n Times tp~n)(xw) = 00 ... 0 xw. The canonical equations of this function are the following:

'-.-' n Times

Y ( t) = ql (t - 1), ql ( t) = q2 (t - 1),

qn-l(t) = qn(t - 1), qn(t) = x(t), ql(O) = q2(0) = ... = qn(O) = O.

(d) Let us denote the function of the given circuit by tp4(X) (the variable x is fictitious). In order to find its canonical equations, we can take the canonical equations of the function tpd( tpx( x)), then branch the output in two (y and yJ), and, further, introduce the feedback in the variables x and YI:

We have 'P4(XW ) = [OW.

{ y(t) = q(t - 1),

tpd(tpx(X)) : q(t) = x(t), q(O) = 0,

y(t) = q(t - 1),

YI(t) = q(t - 1),

q(t) = x(t),

q(O) = 0,

{ y(t) = q(t - 1),

tp4(X): q(t) = ij(t - 1), q(O) = O.

(e) In order to construct the canonical equations of the function tp5 (x) realized by the given circuit, we should firstly construct the canonical equations of the superposition tpxVy(tpx(X),'Pd(XJ)), where tpxvy(x,y) is the b.d.-function generated by disjunction, then branch the output in two (y and YI), and, finally, introduce the feedback in the variables Xl and YI:

( () ( )) . { y(t) = x(t) V q(t -1), q(t) = XI(t), tpv 'Px x , tpd Xl . q(O) = 0,

y(t) = x(t) V q(t - 1),

YI(t) = x(t) V q(t - 1),

q(t) = XI(t),

q(O) = 0,

Page 179: Problems and Exercises in Discrete Mathematics

170 CHAPTER 6. FINITE AUTOMATA

{ y(t) = x(t) V q(t -1),

c,os(x) : q(t) = x(t) V q(t - 1), q(O) = 0,

i.e. y(I)=x(I), y(2)=x(I)Vx(2), ... ,y(t)=x(I)Vx(2)V ... Vx(t), ....

6.2.1. Build the Moore diagram, canonical table and canonical equations of the function c,o(XW) = y(l)y(2) ... y(t) ... from ci>2:

(1) () {I when t = 1, y t = x(t -1) ---+ x(t) when t ~ 2;

(2) () {O when t = 1, y t = x(t -1) ---+ y(t - 1) when t ~ 2;

(3) () {I when t = 1, y t = y(t-l).x(t) whent~2;

(4) () {I when t = 1,2, y t = x(t) ---+ x(2) when t ~ 3;

(5) (t) _ { x(l) when t = 1, y - x(t-l)EBx(t) whent~2;

(6) (t) = { x(t) when t = 1,2, Y x(t-l) whent~3;

(7) (t) = {X(2) when t.= 2, y 1 otherwise;

(8) (t) = { x(l) ---+ x(t) when t.= 1,2,3, y 0 otherwise;

(9) (t) _ { x(l) when t = 1, y - y(t-l)Vx(t) whent~2;

(10) (t) _ { x(l) when t = 1,2, y - y(t-2)EI1y(t-l) whent~3;

(11) (t) = { x(l) when t = 1, Y y(t - 1)· x(t) when t ~ 2;

(12) (t) = { x(t) if t is odd, y y(t - 1) EB x(t) if t is even;

(13) c,o(XW) = [x(I)O]W;

{OW if XW = Ow,

(14) c,o(XW)(t) = ~1[I]W if XW = Ollx(l + 2)x(l + 3) ... and 1 ~ 1, 1 W if XW = lx(2)x(3) ... ;

(15) y(t) is the (t + 2)-th digit after the point in the binary expansion of the number 3 . x(t)/7;

Page 180: Problems and Exercises in Discrete Mathematics

6.2. DIAGRAMS, EQUATIONS, AND CIRCUITS

{ 0 ift=l,

(16) y(t) = x(t - 1) -t x(t) if t is even, x (t) otherwise;

{ 0 if t = 1,

(17)y(t)= x(t) ift=38-2and8~2, y(t - 1) . x(i - 1) otherwise;

{ xli) x( i-I)

(18) y(i) = y(i _ 1)

y(i - 1) . xli)

if i = 48 + 1 and 8 ~ 0, if t = 48 + 2 and 8 ~ 0, if i = 48 + 3 and 8 ~ 0, otherwise.

6.2.2. Build a reduced diagram for the diagram presented in Figure 6.38:

171

6.2.3. Redefine the partial operator 'P: {O, 1}W -t {O, I}W in such a way as to obtain a b.d.-operator. Construct the Moore diagram, the canonical table and the canonical equations for the new operator if:

(1) 'P([OllOI0]W) = [Olll]W, 'P(O[I]W) = O[I]W;

(2) 'P(OW) = iw, 'P(l[O)W) = [lO]W;

(3) 'P(1[10]W) = [01]W, 'P([OOI)W) = 1[10]W;

(4) . { y(3i -1) = x(3i -1), t ~ 1, 'P. y(3i) = x(3t - 1), t ~ 1.

6.2.4. Find out the weight of the b.d.-function 'P (from <i>2) presented by its canonical equations:

Page 181: Problems and Exercises in Discrete Mathematics

172 CHAPTER 6. FINITE AUTOMATA

1(0)

Gz:71

0(1)

a

1

0(0),1(1)

3 e

0(0). ](1)

0(0), 0(0)

*~3 0~0(1)2~

1(1) 0(1),1(1)

g

0(1) 1(0)

(2) cp :

1

0(1) 1(0)

3

1

0(1)

* 0

k

Fig.6.38

1(1) ----0(1)

1

1(1) *0 0(0) 2

0(1) 0(1)

1(0) 1(0)

0(0),1(1) 0(0),1(1)

4 5 h

3

j

Page 182: Problems and Exercises in Discrete Mathematics

6.2. DIAGRAMS, EQUATIONS, AND CIRCUITS 173

{ y(t) = q,(t - 1),

(3) 'P : ql(t) = i12(t -1) -t ql(t - 1), q2(t) = x(t), ql(O) = 0, q2(0) = 1;

{ y(t)=x(t)Vq,(t-1),

(4) 'P : ql(t) = x(t) EEl q2(t - 1), q2 (t) = x ( t) . ql (t - 1) . i12 (t - 1), ql(O) = q2(0) = 0;

{ y(t) = q,(l - 1) ~ q,(t - 1),

(5) 'P : ql ( t) = q2 (t - 1), q2 ( t) = x ( t) -t ql (t - 1), ql(O) = 1, q2(0) = 0;

{ y(t) = x(t)· q,(t - 1) V q,(t -1),

(6) 'P : ql ( t) = ql (t - 1) -t X ( t ) , q2(t) = x(t) -t ih(t - 1), ql ( 0) = q2 ( 0) = 1;

{ ,(t)=,,(t)·q,(t-1)Vx(t)·q,(t-l),

(7) 'P : qdt) = ~(t). q~(t - 1) V x(t) . q2(t - 1), q2(t) = x(t) . (ql(t - 1) V q2(t - 1)), ql(O) = 1, q2(0) = 0;

{ y(t) "'-q,(t - 1) . qAt -I) ~ x(t), (8) 'P : ql (t) - .r (t ),

q2(t) = q2(t - 1) EEl ql(t - 1)), ql(O) = q2(0) = 1;

6.2.5. Let (~~,m; XI, X 2 , ••. , Xn; 11, Y2, ... , Ym) denote the set of all functions in ~~,m with input variables Xl, X 2 , .•• , Xn and output variables }'i, Y2 , •.. , Ym . Show that the number of functions with a weight w in the set (<1>~,m; XI. X 2 , ... , X n, Yl, Y;, ... , Ym) does not exceed (wkm)wkn.

6.2.6. Let the operator 'P in <1>~' m be defined by (2) and let the functions GI , G2 , ..• , Gr be connected through the relation Gl EEl G2 EEl ... EEl Gr == O. Show that the weight of the operator 'P does not exceed 2r - l .

6.2.7. Construct the canonical equations and the reduced Moore diagram for the superposition 'P = 'PI('P2) of the b.d.-functions 'PI and 'P2 from <1>2:

Page 183: Problems and Exercises in Discrete Mathematics

174 CHAPTER 6. FINITE AUTOMATA

0(1) 0(0)

~oO~ 1(1) 0(0),1(1)

a b

Fig.6.39 Fig.6.40

(4) the function 'PI is presented by the Moore diagram (see Figure 6.39),

(5) the functions 'PI and 'P2 are presented by the Moore diagram (see Figure 6.40 (a) and Figure 6.40 (b), respectively);

(6) 'PI: YI(t) = YI(t - 1) -+ YI(t - 2), t ~ 3, {

YI(l) = YI(2) = 0,

Y2(1) = 0, Y2(2) = 1, 'P2: Y2(t) = X2(t) -+ Y2(t - 2), t ~ 3.

6.2.8. Construct the canonical equations and the reduced Moore diagram of the b.d.-function obtained from the function 'P by introducing the feedback in variables Xi and Y{

(1) 'P :

Page 184: Problems and Exercises in Discrete Mathematics

6.2. DIAGRAMS, EQUATIONS, AND CIRCUITS

i = 2, j = 1;

(2) 'P :

i = j = 2;

(3) 'P :

i = 2, j = 1;

(4) 'P : { Yl(t) = q(t - 1), Y2(t) = Xl(t) EB (X2(t) V q(t - 1)), q(t) = q(t - 1) --+ xdt)· X2(t), q(O) = 0,

(a) i = j = 1; (b) i = 2, j = 1;

{ Yl(t) = Xl(t), Y2(t) = X2(t) EB q(t - 1)),

(5) 'P: Y3(t) = X2(t) V q(t - 1), q(t) = Xl(t) V X2(t), q(O) = 0,

(a) i = 2, j = 1; (b) i = 1, j = 2; (c) i = 1, j = 3.

175

6.2.9. Find out the weight of the b.d.-function obtained from the function 'P by introducing the feedback in variables Xi and Y{

(1) 'P :

i = 1, j = 2;

(2) 'P : { Yl(t) = Xl(t) 1 q(t - 1), Y2(t) = X2(t) V q(t - 1), q(t) = Xl(t) . X2(t), q(O) = 0,

(a) i = 1, j = 2; (b) i = 2, j = 1;

(3) 'P : {

Yl (t) = ij( t - 1), Y2(t) = Xl(t) V q(t - 1), q(t) = Xl(t) tD X2(t), q(O) = 0,

(a) i = j = 1; (b) i = 2, j = 1; (c) i = j = 2;

Page 185: Problems and Exercises in Discrete Mathematics

176 CHAPTER 6. FINITE AUTOMATA

(4) V; :

(a) i = 1, j = 2; (b) i = j = 2; (c) i = 3, j = 1;

{ Yt(t) = Xt(t) I qt(t - 1),

(5)' Y2(t) = ij(t - 1)), V;. qt(t) = Xt(t)X2(t),q2(t) = qt(t -1)· X3(t),

qt(O) = 0, q2(0) = 1,

(a) i = 1, j = 2; (b) i = 2, j = 1; (c) i = j = 2; (d) i = 3, j = 1; (e) i = 3, j = 2.

6.2.10. Find out the weight of the b.d.-function obtained from the b.d.-function V; through the operation Ot (identification) of the input variables Xi and X - j:

{ y(t) = Xt(t) -t X2(t) . qt(t - 1),

(1)' qt(t) = X2(t) -t X3(t)· ij2(t -1), V;. q2(t) = Xt(t)· X2(t) V ijt(t - 1),

qt(O) = q2(0) = 0,

(a) i = 1, j = 2; (b) i = 2, j = 3;

{ y(t) = Xt(t) V X2(t)· qt(t - 1),

(2)' qt(t) = q2(t - 1) -t ilt(t - 1), V; • q2(t) = X2(t) V X3(t) V qt(t - 1),

qt(O) = q2(0) = 0,

(a) i = 1, j = 2; (b) i = 2, j = 3;

{ Yt(t) = Xt(t)· X2(t) -t q(t - 1),

(3)' Y2(t) = Xt(t)· X3(t) -t X2(t), v;. q(t) = X3(t) V ij(t -1),

q(O) = 1,

(a) i = 1, j = 2; (b) i = 1, j = 3; (c) i = 2, j = 3;

(a) i = 1, j = 2; (b) i = 1, j = 3; (c) i = 2, j = 3. diagrams (see Figures 6.41

(a) and 6.41 (b), respectively).

Page 186: Problems and Exercises in Discrete Mathematics

6.2. DIAGRAMS, EQUATIONS, AND CIRCUITS 177

0(1) 0(1)

~ 1 (1)

a b

Fig.6.41

6.2.11. Find out the weight of the superposition tpl(tp2) if:

{ Yl(t) = :l(t) -> ql(t - 1),

(3) tpl : ql (t) = ql (t - 1), ql(O) = 0,

The function tp2 is presented by the Moore diagram (see Figure 6.42);

* 1

a b

Fig.6.42 Fig.6.43

(4) The functions tpl and tp2 are presented by the Moore diagrams (see Figure 6.43 (a) and 6.43 (b), respectively);

(5) the functions tpl and tp2 are presented by the Moore

Page 187: Problems and Exercises in Discrete Mathematics

178 CHAPTER 6. FINITE AUTOMATA

6.2.12. Let 'f' be a b.d.-operator of weight r and let 1/J be an operator of weight r', obtained from 'f' by introducing the feedback in a certain pair of variables. Is it always true that

(1) r ::::: r'; (2) r = r'; (3) r ::; r'?

6.2.13. Construct the circuit E'I' of the function 'f' E <1>2' The circuit must be generated by the set consisting of a unit delay element and functions generated by the disjunction, conjunction and negation:

{ y(t) = x(t) V q(t - 1),

(1) 'f': q(t) = x(t)· ij(t - 1), q(O) = 1;

{ y(t) = x(t) EEl q(t - 1),

(2) 'f': q(t) = x(t) ! q(t - 1), q(O) = 0;

(3) the function 'f' is represented by the canonical table (see Table 6.8) and q(O) = 1;

Table 6.8 Table 6.9

Xl (t) q( t - 1) YI (t) q( t) Xl (t) q( t - 1) YI(t) q( t) 0 0 0 1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 0 1 1 1 0 1 1 1 0

(4) the function 'f' is represented by the canonical table (see Table 6.9) and q(O) = 0;

(5) the function 'f' is represented by the Moore diagram (see Figure 6.44 (a));

(6) the function 'f' is represented by the Moore diagram (see Figure 6.44 (b));

(7) the function 'f' is represented by the Moore diagram (see Figure 6.44 (c));

(8) the function 'f' is represented by the Moore diagram (see Figure 6.44 (d));

(9) the function 'f' is represented by the Moore diagram (see Figure 6.44 (e));

(10) the function 'f' is represented by the Moore diagram (see Figure 6.44 (f));

Page 188: Problems and Exercises in Discrete Mathematics

6.2. DIAGRAMS, EQUATIONS, AND CIRCUITS

;~ 0(1),1(0)

a

01

11

d

1(1)

b

e

Fig.6.44

11

179

01

01

11

f

(9) the function i.p is represented by the Moore diagram (see Figure 6.44 (e));

(10) the function i.p is represented by the Moore diagram (see Figure 6.44 (f));

{ Y(l)=O, (11) i.p: y(t) = x(t - 1) V y(t - 1), t 2 2;

(12) . { y(l) == y(2) = 1, i.p. y(t) = y(t -1) --t x(t - 2), t 2: 3;

{ y(2t -1) = x(2t -1), t 21, (13) i.p: y(2t) = x(2t - 1) EB x(2t), t 21;

{ Y1(1) = x1(1),

(14) 'P: Y2(1) = x2(1), Y1(t) = X1(t) --t X2(t), t 2 2, Y2(t) = X2(t) --t X1(t), t 2 2.

6.2.14. For the given circuit, construct the canonical equations, the canonical table and the Moore diagram:

(1) see Figure 6.45 (a); (2) see Figure 6.45 (b); (3) see Figure 6.45 (c); (4) see Figure 6.45 (d);

(5) see Figure 6.46 (a); (6) see Figure 6.46 (b); (7) see Figure 6.46 (c); (8) see Figure 6.46 (d).

Page 189: Problems and Exercises in Discrete Mathematics

180 CHAPTER 6. FINITE AUTOMATA

x (t)

y (t)

a b c d

Fig.6.45

6.2.15. Suppose that the b.d.-operators 'f!I and 'f!2 have weights rl and r2

respectively. What will be the weight of the operator 'ljJ obtained from 'f!I and 'f!2

with the help of the operator 0 4 (union)?

6.2.16. The b.d.-operators 'f!I and 'f!2 have weights equal to rl and r2 respecti-vely. Will the weight of the superposition 'f!I('f!2) be

(a) larger than

(1) rI, (2) r2, (3) rl + r2, (4) ri' r2?

(b) smaller than

(5) rI, (6) r2?

The operator 'f! in cI> A, B is called autonomous (constant, or without input

operator) if, for any input word j;W E AW, the value of the operator 'f! on j;W is equal to the same (output) word in BW.

6.2.17. Is the operator 'f! E 4>2 autonomous in the following cases?

() -W) {Y(I) = y(2) = 1, 1 'f!(x : y(t)=y(t-l)EBy(t-2),t~3;

Page 190: Problems and Exercises in Discrete Mathematics

6.2. DIAGRAMS, EQUATIONS, AND CIRCUITS

a .---------oXlt)

y/t)

c

Fig.6.46

{ y(t) = x(t) --t q(t - 1),

(2) 'Y: q(t) = :r(t) V q(t - 1), q(O) = 1;

{ y(t) = x(t) --t q(t - 1),

(3) 'Y: q(t) = x(t) V q(t - 1), q(O) = 0;

(4) 'Y(i'''') : y(2t - 1) = y(2t - 2), t 2 2, {Y(I)=O,

y(2t) = leos ~tl, t 2 1.

>: (t) b

)i (t) y/t)

d

181

Page 191: Problems and Exercises in Discrete Mathematics

182 CHAPTER 6. FINITE AUTOMATA

6.2.18. Let <.p be an autonomous operator of weight r(r < 00). (1) Show that the output word of the operator <.p is quasiperiodic. (2) Prove that the sum of the lengths of the period and pre-period of the output

word of the operator <.p does not exceed r.

6.3 Closed Classes and Completeness in Automata

Let M be a set of d.-functions (or b.d.-functions), and let 0 be a set of operations. If an arbitrary admissible application of any operation from 0 over a function from M leads to a function from M, then the set M is called closed (with respect to 0). The closure [M]o is the set of all d.- (or b.d.- ) functions which can be obtained from the functions from the set M with the help of the operations from O. It is assumed that these operations are applied a finite number of times. Usually, it is suggested that [M]o 2 M. Henceforth, we shall always assume that this inclusion is satisfied (if this is not the case, a special mention will be made). The operation of obtaining the set [M]o from M is called the closure operation.

The set M is called a (functionally) closed class relative to the set of operations o if [M]o = M. Let M be a class of d.- (or b.d.-) functions closed with respect to a set of operations O. The subset P in M is called a (functionally) complete set in M relative to the set of operations 0 if [P]o = M. A set P of d.- (or b.d.-) functions is called an irreducible set relative to the operations 0, if for every proper subset P' in P the (strict) inclusion [P/]o C [P]o is valid. Any complete and irreducible set in M is called a basis of the closed class M relative to the set of operations O. The set M ' , contained in the closed class M, is called a precompiete class in M if it is not a complete set in M, but if the equality [M'U{<.p}]o = M is satisfied for every function <.p E M \ M'.

Remark 1. We shall omit the expression "relative to the set of operations 0" if the set 0 is considered to be known.

Remark 2. Usually, we shall use the set {Ol, O2 , 0 3 , 0 4 , S} formed by the operations described in Sec. 6.2, for the set of operations O.

It was mentioned in Sec. 6.2 that the set of b.d.-functions containing a unit delay element <.pd and the operators generated by the functions of a certain set that is complete in Pk (k 2:: 2) forms a complete set in the set U~=o U~=o ~~,m relative to the operations Ot, O2 , 0 3 , 0 4 , and S (i.e., in a set of all k-valued b.d.-functions).

The set U~=o U~=o ~~,m (k 2:: 2) is known to have a basis relative to the set of operations {Ol, O2, 0 3 , 0 4 , S}, consisting of a single function. An example of such a basis is the set {<.pO(XI' X 2, X 3, <.pd (X4))}, where <.pd is a unit delay element from ~k' and <.po is an operator in ~!,l generated by the function max(xI,x4+X2(1-X4), X3) + 1 (mod k sum, difference and product).

Everywhere in this section, we shall use the symbol ~(k)(<I>(k)) to denote the set

Page 192: Problems and Exercises in Discrete Mathematics

6.3. COMPLETENESS IN AUTOMATA 183

of all k-valued b.d.-(resp. d.-) functions including the functions without inputs, or (and) without outputs, i.e.

Example 1. Prove the completeness of the system of functions {'PI, 'P2} in ~2 relative to the set of operations {Ol, O2 , ,03 , 0 4 , S}:

'PI: y(i) = Xl(t)· X2(t), t ~ 1,

{ YI(i) = Xl(t) V q(i - 1),

2: Y2(i) = Xl(t) . q(t -1) V X2(t), 'P q(t) = Xl(t)· X2(t),

q(O) = O.

Solution. Let us try to construct a unit delay element and the function 'P=l (x) generated by a unity. It would be sufficient to prove the completeness of the system {'PI, 'Pd because the system {x . y, I} is complete in P2.

Having identified the variables in the function 'PI, we obtain the b.d.-function 'PI (x, x) = 'P=o( x) generated by zero. Then, we remove the output variable Y2 from the function 'P2 (operation O2) and take the superposition 'P3( x) =

'P2( 'P=o( x), 'P=o( x)):

{ YI(t) = q(t - 1),

'P3 : q(t) = 0, q(O) = 0,

i.e. 'P3(X) = 'P=l(X). Further, we construct the function generated by the negation: 'P4(X) = 'Pl(X, 'P=I(X)) = 'P;;(x) (operation S); then we replace the variable X2 in the function 'P2 by the function 'P;;(x) (operation S) and introduce in the function CP2( Xl, !.p;;( X2)) the feedback in the variables X2 and Yl. As a result, we obtain the function CPS(Xl) which has the following canonical equations:

i.e. cps(xd = CPd(Xl).

{ Y2(t) = Xl(t)· q(t - 1) V Xl(t) V q(t - 1)

= Xl(t) . q(t - 1) V Xt) . q(t - 1) = q(t - 1), q(t) = Xl(t)· (Xl(t) V ij(i - 1)) = Xl(t), q(O) = 0,

Therefore, the set {'PI, !.p2} is complete in the ~2 system {CPl, 'P=l (x), !.pd( x)}. So the system {!.pI, 'P2} is also complete.

6.3.1. Prove the completeness of the system of functions {!.pI, !.p2} in ~2 relative to the set of operations {01 , O2 , ,03 , 0 4 , 5}:

(1) CPl: y(i) = XI(t) . x2(i), t ~ 1,

{ y(i) = XI(t)· x2(i) V q(t - 1),

CP2: q(t) = Xl(t) V x2(i), q(O) = 0;

Page 193: Problems and Exercises in Discrete Mathematics

184 CHAPTER 6. FINITE AUTOMATA

(2) tpl : y(t) = XI(t) --+ X2(t), t;::: 1, { y(t) ~ (x,(t) ~ x,(t)) . q(t -I),

tp2 : q(t) = XI(t)· X2(t), q(O) = 0;

(3) tpl : y(t) = XI(t)· X2(t) V XI(t)· X3(t) V X2(t)· X3{t), t;::: 1, { y(t) ~ q(t -1),

tp2: q(t) = XI(t) E!1 X2(t), q(O) = 0;

(4) tpl : y(t) = XI(t) . X2(t), t ~ 1, { y(t) ~ (x,(t) ~ x,(t)) V q(t - 1),

tp2 :. q(t) = XI(t) --+ X3(t), q(O) = 1;

1(1) 10(1),11(0)

~ ~ ~O(O) 000)

o * 1 11(1)

01(0) 10(1) 0(0) 01(1)

a b

Fig.6.47

11(1)

c

(5) tpl: y (t) = Xl (t) --+ X2 (t), t ;::: 1, tp2 is represented by the Moore diagram (see Fig. 6.47 (a));

(6) tpl : y(t) = XI(t) . X2(t), t;::: 1, tp2 is represented by the Moore diagram (see Fig. 6.47 (b));

(7) tpl : y(t) = XI(t) V X2(t), t;::: 1, tp2 is represented by the Moore diagram (see Fig. 6.47 (c));

(8) tpl: y(t) = x(t), t;::: 1,

{ YI(t) = XI(t)· X2(t) E!1 X3(t) E!1 q(t - 1), Y2(t) = XI(t) E!1 q(t - 1),

tp2: q(t) = XI(t),

(9) tpl:

tp2 :

q(O) = 0;

y(t) = XI(t)· X2(t), t;::: 1,

{ YI(t) = XI(t)· X2(t) V q(t - 1), Y2(t) = XI(t) V q(t - 1), q(t) = XI(t), q(O) = O.

6.3.2. Prove that the function 'P is Sheffer's function in ~2 relative to the set of operations {Ot, O2 , ,03 , 0 4 , 5}:

{ y(t) = XI(t) V X2(t) V X3(t) . q(t - 1),

(1) tp: q(t) = X3(t)· X4(t), q(O) = 0;

Page 194: Problems and Exercises in Discrete Mathematics

6.3. COMPLETENESS IN AUTOMATA

(2) cP :

(3) '-P :

(4) '-P :

(5) '-P :

{ y(t) == Xl(t) . X2(t) V X3(t)· q(t - 1), q(t) == Xl(t) ---+ (X2(t) ---+ X3(t)), q(O) == 1;

{ y(t) == Xl(t) . X2(t) . X3(t) V q(t - 1), q(t) == Xl(t) . X2(t), q(O) == 0;

{ y(t) == Xl(t)· X2(t) V qI(t - 1)· q2(t - 1), ql(t) == X2(t) . X3(t), q2(t) == Xl(t) . X3(t) V ql(t - 1), qI(O) == 0, q2(0) == 1;

1 Yl(t) == XI(t) . ·ql(t - 1), Y2(t) == Xl(t) . iiI(t - 1) V X2(t)· ih(t - 1), ql(t) == Xl(t) . X3(t), q2(t) == ql(t - 1), ql(O) == q2(0) == o.

185

6.3.3. Extract a complete in ~2 (relative to {Ol , O2 , ,03 , 0 4 , S}) subset from the system A which is complete in <[>2 relative to the same set of operations. The extracted subset has to contain the least possible number of functions:

(1) A == {cp=o(x), CP=l(X), CPx.y(x,y), CPXE[JYE[Jz(x,y,z), '-Pd(X)};

(2) A == {'-P=o(x), '-Px~y(x,y), '-Px->y(x,y), cpd(CPx(X))};

(3) A == {CP=l(X), CPxE[Jy(x, y), CPXVy(x, y), CPd(CPx.y(x, y))};

(4) A == {cp=o(x), CPx(x), CPx.y(x,y), CPxvy(CPd(X), cPy(y))};

(5) A == {CP=l(X), CPx.y(x, y), CPx->y(x, CPd(y)), '-Px(cpd(CPY(y)))}·

6.3.4. A periodic word XW of period 3 is supplied at the input of a b.d.-operator '-P E ~2' Find the maximum period of the output word (the majorization is carried out over all input periodic words of period 3):

(1) cP: ql(t) == x(t)ih(t - 1)q2(t - 1) V X(t)q2(t - 1), { y(t) == (x(t) EEl qI(t - 1))q2(t - 1),

q2(t) == X(t)ql(t - l)q2(t - 1) V X(t)q2(t - 1), ql(O) == q2(0) == 0;

{ y(t) == X(t)ql(t - 1),

(2) cP: ql(t) == X(t)qI(t -1) V q2(t - 1), q2 ( t) == qI (t - 1), ql(O) == q2(0) == O.

6.3.5. Let cP be a b.d.-function of weight r, belonging to the set ~ A,B.

(1) Prove that if each input word XW is quasi-periodic with a period T, the output word cp(XW) is also quasi-periodic and its period does not exceed the number r . T.

(2) Find an upper estimate for the length of the pre-period of the output word cp(XW) if the pre-period of the word XW is known to have a length p.

Page 195: Problems and Exercises in Discrete Mathematics

186 CHAPTER 6. FINITE AUTOMATA

6.3.6. Given the functions ipo(XI,X2 ) = ipxllx2(XI ,X2), the element of unit delay ipo(X), and ip(XW) = a). Does there exist an s 2: 1 such that ip(ipd(X)) E [ipo, ipd]O, where 0 = {S}? (Here, ipd(X) = ipd( ipd( . .. ipd(X) ... )) is the superposition of s functions ipd.)

Recall that if f(x n) E Pk , then ipf(xn)(XI, ... , Xn) denotes a b.d.-operator (in <1>~,I) generated by the function f(x n ).

6.3.7*. Does <1>(2) contain a basis (relative to {Ol, O2, 0 3 , 0 4 , S}) with five functions?

6.3.8*. Prove that any closed class in <1>(k)' except the entire set <1>(k)' can be extended to a precomplete class.3

6.3.9*. Using Problems 6.3.3(1) and 6.3.8, show that <1>(2) contains at least four precomplete classes.

6.3.10. Let ipd E <1>2. Enumerate all the classes that are precomplete in [ipd]{03, 0 5 , S} relative to the set of operations {05, S}.

6.3.11. Let ipx = ipx(X) be a b.d.-operator in <P(k), generated by the function x. Prove that whatever the type of the closed class M in <P(k), the equality [M U{ ipx}) = M U{ ipx} is always satisfied (here, as usual, we take together with the function, all functions that are equal to it or congruent to it).

6.3.12. Is the intersection of all precomplete classes in <1>(k) nonempty?

6.3.13. Can the set <1>(k) be presented in the form of a union Ui=l Mi(S 2: 2) of pairwise disjoint closed classes in <1>(k)?

6.3.14*. Prove that the power of the set of all closed classes in <1>(k) is continual.

6.3.15. Determine the power of the set of all closed classes in <1>(k), having finite complete sets.

6.3.16*. Prove that the power of the set of all closed classes in <P(k) is equal to 2 (the power of a hypercontinuum).

6.3.17*. Find the power of the set of all closed classes in <I>(k) having finite bases.

6.3.18. Disprove the following statements: (1) the set <1>(k) forms a precomplete class in <P(k);

(2) the set <P(k) contains a function forming together with the set <1>(k) a complete set in <I>(k).

6.3.19. Let Mo be a set consisting of all k-valued d.-functions that do not have outputs, and of all functions ip belonging to U~=o U:=l <p~,m and assuming the value o for t = 1, i.e. ip(x~, ... , x~) = (ij~, ... , y<;:,) and Yj(1) = 0 for f = 1, m.

(1) Is Mo a precomplete class in <P(k)?

(2) Is the intersection Mo n <1>(k) a precomplete class in <1>(k)?

3Here and below, unless specified otherwise, the closure and completeness are considered with respect to the set of operations {Ol, O2 , 0 3 , 0 4 , 5}.

Page 196: Problems and Exercises in Discrete Mathematics

6.3. COMPLETENESS IN AUTOMATA 187

6.3.20. Put 0 = {01 , O2 , ,03 , 0 4 , S}, 0 1 = {01 , O2 , ,04 , 5}) Find out whether the function 'P belongs to the closed class A:

(1) ..p = 'P=o(x), A = ['Px(x), 'Pd('Py(Y))]o;

(2) 'P = 'P=l(X), A = ['Px(x), 'Pd(X)]O;

(3) 'P = 'Px(x), A = ['Px-+y(x,y), 'Pd(X)]O;

(4) 'P = 'P=l(X), A = ['Pxvy(x, Y), 'Pd('Px(X), 'Px('Pd(Y))]O;

{ y(t) = 0 if t = 48 + 1 or t = 48 + 2, 8 ~ 0, (5) ..p:

y(t) = 1 otherwise,

(a) A = ['Px\y(X,y), 'Pd(x)]o,; (b) A = ['Pd(X), 'Pd('Px(Y))]o

6.3.21. Is it possible to extend the set A so it would be a complete system in <1>2

relative to the set of operations {01 , O2 , ,03 , 0 4 , 5}, if we add just one function from the set B:

(1) A = {'Px(x), 'PXE!lyE!lz(x,y,z), 'Pd(X)} , B = {'P=l(X), 'PXE!ly(x, y), 'Pm(x,y,z)(x, y, z)};

(2) A = {'P=1 (x), 'Px~y( x, y), 'Pd( 'Px(X))} , B = {'P=o'(x), 'Px.y(x,y), 'Pd(X)};

(3) A. = {'Px.y(x,y), 'Pxvy(X,'Pd(y))}, B = {'P=o(x), 'P=l(X), 'Px-+y(X,'Pd(y))};

(4) A = {'Px.y(x,y), 'PxE!ly(x,y), 'Px.y(X,'Pd(y))}, B = {'P=l(X), 'PX~y(X,'Pd(Y)), 'Pd(X)};

(5) A = {'Pxvy(x,y), 'Px.y(x,y), 'Pm(x,y,z)(x,y, 'Pd(Z))} , B = {'PXE!ly(x,y), 'Px('Pd('Pd(y)), 'Pd(X)}?

Page 197: Problems and Exercises in Discrete Mathematics

Chapter 7

Elements of Algorithm Theory

7.1 Turing Machines

A Turing machine is an (abstract) device consisting of a tape, a controlling device and a scanning head.

The tape is divided into squares. Any square at each (discrete) instant of time contains exactly one symbol in an external alphabet A = {ao, al, ... , an-d, n ~ 2. A certain symbol of the alphabet A is called an empty symbol, and a square containing an empty symbol at a given moment is known as a blank square (at that moment). A empty symbol is usually represented by a (zero). The tape is assumed to be infinite in both directions. l

At any instant of time, the controlling device is in a certain state qj, which belongs to a set Q = {qo, ql, ... , qr-l,} r ~ 1. The set Q is referred to as an internal alphabet (or a set of internal states). Sometimes, disjoint subsets Ql and Qo of initial and final states, respectively, are isolated from the set Q.

Remark. Henceforth, unless stated otherwise, we shall assume that IQI ~ 2, and take only one state ql for the initial state. As a rule, the state qo will be the final state.

The head moves along the tape so that, at each instant, it scans exactly one square of the tape. The head can scan a symbol in the square and record (print) on it a new symbol of the external alphabet instead. The symbol "printed" in the square can, in particular, coincide with that being scanned (at that instant).

During its operation, the controlling device changes (or does not) its (internal) state depending on its state and on the scanned symbol by the head, orders the head to print in the square scanned a symbol of the external alphabet, and either to remain at the same square, or to move by one square to the left or right.

The functioning of the controlling device can be characterized by three functions:

G: Q x A -+ Q,

lThis should be understood as follows: at each instant, the tape is finite (contains a finite number of squares), but the "length" of the tape (the number of squares in it) can be increased (if required).

188

Page 198: Problems and Exercises in Discrete Mathematics

7.1. TURING MACHINES 189

F: Q x A -+ A,

D: Q x A -+ is, L, R}.

The function ° is called a transition function, F an output function, and D is a function of displacement (of the head). The symbols S, Land R denote, respectively, the absence of head displacement, a left movement and a right movement by a square.

The functions 0, F and D can be specified by a list of quintuples

(1)

which are abbreviated as qiajqijaijdij. These quintuples are referred to as commands. The functions 0, F and D are, in general, partial functions (not specified every­where). This means that a quintuple of the type (1) is not defined for each pair (q1, aj). The list of all quintuples which determine the operation of a Turing machine is known as the program of this machine. The program is often given in tabular form (see Table 7.1).

a J

an -1

Table 7.1

qi

If there is no quintuple of the type (1) in the program for a pair (qi, aj), a dash appears in the table at the intersection of row aj and column qi.

The functioning of Turing machine can be conveniently described in the "langu­age of configurations".

Let, at instant t, the extreme left nonblank square C\ of the tape contain a symbol ajl' while the extreme right nonblank square Cs (s 2': 2) contains a symbol aj, (there are s - 2 squares between C1 and Cs). In this case, the word P = ajl aj2 ... ajp ... aj" where ajp is the symbol contained at instant t in the square Cp (1 :::; p :::; s), is said to be recorded on the tape at instant t. For s = 1, i.e. when the tape contains only one nonempty symbol, P = ajl' Let us suppose that, at this instant of time, the controlling device is in a state qi and the head scans a symbol ajl of the word P(l2': 2). Then the word

(2)

is called the configuration of the machine (at a given instant t). For I = 1, the configuration has the form qiajl .,. aj,. If, at instant t, the head scans a blank

Page 199: Problems and Exercises in Discrete Mathematics

190 CHAPTER 7. ELEMENTS OF ALGORITHM THEORY

square located to the left (or right) of the word P, and there are v 2: 0 blank squares between this square and the first (last) square of the word P, the configuration of the machine at the moment t is presented by the word

qi L,:..!:;, aj, . .. aj,

v + 1 times

(3)

(resp. the word aj, ... aj, L,:..!:;, qiA), where A denotes the empty symbol of the

v times alphabet A. If, at the moment t, the tape is blank, i.e. a blank word consisting of only empty symbols of the external alphabet is recorded on it, the word qiA will be the configuration of the machine at the instant t.

Let the configuration of the machine at a moment t have the form (2), and suppose that the program of the machine contains the command

Then, for dijl = L, the configuration of the machine at the next instant will be expressed by the word

(a) %,Aaij,ah ... aj, if I = 1; (b) %2aj,aij2aj3 ... aj, if I = 2; (c) ajl ... ajl_2qijlajl-laijlajl+l ... aj, if I> 2. The cases when dijl = R or dijl = S, or when the machine configuration

corresponds to the head outside the word P (as in the word (3)), or when the word P is empty, are described in a similar way.

If a program of the machine contains no quintuple of the form (1) for a pair (qi, ajl), or if a "new" state %1 is the terminal state, the machine stops, and the "resulting" configuration is referred to as the terminal configuration. The configuration corresponding to the beginning of operation of the machine is referred to as the initial configuration.

Let J{ be the configuration of the machine at a certain instant and let J{' be its configuration at the next instant. Then the configuration J{' is called a configuration directly derived from J( (and denoted by J{ F J{'). If J{l is the initial configuration, the sequence J{l, J{2, ... , J{m, where J{i F ](i+1 for 1 :::; i :::; m - 1, is called the Turing computation. In this case, ](m is said to be derivable from ](1, and the following notation is used: ](1 f- ](m. If, in addition, ](m is a terminal configuration, it is said to be terminally derivable from ](1 and the notation ](1 f- .](m is used.

Suppose that a Turing machine T starts operating at a certain (initial) instant of time. The word recorded at this moment on the tape is called the initial word. To put the machine T into operation, it is necessary to place the scanning head against a square of the tape and indicate the state of the machine T at the initial moment.

If PI is an initial word, the machine T which starts to operate at the "word" PI will either stop after a certain number of steps, or will not stop at all. In the former case, the machine T is said to be applicable to the word PI, and the result of the application of the machine T to the word PI is a word P corresponding to the terminal configuration (notation P = TlPl )). In the latter case, the machine T is said to be inapplicable to the word Pl.

Page 200: Problems and Exercises in Discrete Mathematics

7.1. TURING MACHINES 191

Henceforth, unless otherwise stipulated, we shall assume that (1) the initial word is nonempty, (2) at the initial moment the head is against the extreme left nonblank square on the tape, and (3) the machine starts to operate when it is in the state ql.

The zone of operation of the machine T (on the word Pd is the set of squares which are scanned by the head at least once during the operation.

We shall often use the notation [p]m for words of the form P P ... P (m times). If P = a is a word of length 1, we shall write am instead of aa ... a (m times) and also [a]m.

'vVe shall denote by W an arbitrary finite word in the external alphabet of a Turing machine (in particular, an empty word, i.e. that consisting of empty symbols of the external alphabet).

While describing the operation of a Turing machine in terms of "configuration language", we shall use an expression similar to

qdXOPOW r- .POqoW,

l' ;:: 1 and y ;:: 1. The expression should be understood as follows: the machine "erases" the word IX and stops at the first symbol of the word W. If, however, W is an empty word, the machine stops at the second 0 (zero) following the word !Y.

Turing machines TI and 70 are called equivalent (in alphabet A) if, for any input word P (in alphabet A), the relation TI(P) c::: T2(P) holds. This expression has the following meaning: TI(P) and T2(P) are either both specified or both not specified2,

and if they are specified, then TI(P) = T2(P). The symbol c::: is called the symbol of conditional equality.

Let machines TI and T2 have programs III and Il2' respectively. We shall assume that the internal alphabets of these machines do not intersect and that q~ is a final state of the machine TI while q~ is an initial state of the machine T2. We shall replace the state q~ by the state q~ throughout t.he program III and combine the obtained program with Il2 . The new program II determines the machine T called the composition of the machines Tl and T2 (over the pair of states (q~, q~)) and denoted by Tl 0 T2 or TIT2 (in detail, T = T(Tl' T2, (q~, q~))). The external alphabet ofthe composition TIT2 is the union of the external alphabets of TI and T2.

Let q' be a final state of a machine T, and q" be a state of this machine which is other than final. We shall replace the symbol q' throughout the program II of the machine T by q". We shall obtain a program II' determining the machine T' (q', q"). The machine T' is called the iteration of the machine T (over the pair of states (q', q")).

Let Turing machines TI , T2 and T3 be defined by programs Ill, Il2 and Il3, respectively. We assume that the internal alphabets of these machines are pairwise nonintersecting. Let q~ and q~' be two different final states of the machine TI . We shall replace the state q~ throughout the program III by an initial state q~ of the machine T2 , and the state q~ by an initial state q~ of T3 . Then we combine the new program with Il2 and Il3. We obtain a program II defining the Turing machine T = T(Tlo (q~, q~), T2, (q~, q~), T3)' This machine is known as a branching of the machines T2 and T3, controlled by the machine TI .

2T(P) is defined (not defined) if the machine T is applicable (inapplicable) to the word P.

Page 201: Problems and Exercises in Discrete Mathematics

192 CHAPTER 7. ELEMENTS OF ALGORITHM THEORY

In defining complicated Turing machines, the operator notation of algorithms is often used in the form of a line consisting of symbols of machines, transition symbols (of the form If and 2(), and also symbols a and ware used to denote the beginning and end of algorithm operation. In operator notation (of an algorithm), the expression Ti~Tj .. . Tm¥Tn denotes the branching of machines Tj and Tn, which is controlled by the machine Ti. Here, the final state qiQ of the machine Ti is replaced by the initial state qnl of the machine Tn, while any other final state of the machine Ti is replaced by the (same) initial state of Tj • If the machine Ti has a single final state, the symbols IqiQ and qnll denote unconditional transition. The symbols qiQ and qnl are omitted whenever confusion is unlikely.

Example. The operator scheme

describes the following "computational process". At first, the machine T2 starts to operate. If it stops in the state q2Q, the machine Tl begins to operate. When it stops, T2 starts to operate again. If, however, T2 stops in a final state other than q2Q, the "work is continued" by the machine T3. If this machine comes to the final state q3Q, then Tl starts to operate. If, however, T3 terminates at a final state other than q3Q, the "work is continued" by T4. If the machine T4 stops in a certain state, the computational process is terminated.

Let 0 = (aI, a2, ... , an), n 2:: 1, be an arbitrary tuple of nonnegative integers. The word 1"'1+l 01"'2+ l 0 ... 01"'n+ l is called the basic machine code (or just a code) oj the tuple 0 (in the alphabet {O, I}) and is denoted by k(o). In particular, the word 1 "'+1 is the basic machine code of the number a.

Henceforth, we shall mainly consider partial numerical functions. The function f(xl, X2, ... , xn), n 2:: 1, is a partial numerical Junction if the variables Xi assume the values in the natural scale N ={O, 1,2, ... , m, ... }, and if f(o) E N when the function f is defined on the tuple ii = (aI, a2, ... , an).

A numerical partial function is said to be computable (in the Turing sense) if there exists a Turning machine Tf having the following properties:

(a) if J(o) is specified, then Tf(k(o)) = k(f(o)); (b) if J( 0) is not specified, then either Tf ( k( 0)) is not a code of any number in

N, or the machine Tf cannot be applied to the word k( ii).

Remark. Henceforth, we shall assume that at the initial moment the head scans the extreme left unity of the word k(o). It is known that this restriction does not make the class of computable functions narrow.

If a function J is computable in the Turing sense by using a machine Tf , the machine Tf will be said to compute the function f

7.1.1. Find out whether a Turing machine T specified by a program II is applicable to a word P. If it is, determine the result of the application of the

Page 202: Problems and Exercises in Discrete Mathematics

7.1. TURING MACHINES 193

machine T to the word P. It is assumed that ql is the initial and qo the final states, and at the initial moment the head scans the extreme left unity on the tape.

qIOq20R qdq I 1R q20q30R

(1) II: q21qdL (a) P = 1302 12 ,

q30qoOS (b) P = 13 01 3 ,

q31q21R (c) P = 10[01]21.

(2) II :

(3) II :

qIOq2 1R qI1q30R q20q31L (a) P = 1401, q21q21S (b) P = 13 01 2 ,

q31qI1R (e) P = 16.

qIOqI1R qI1q20R q20qI1R (a) P = 1012 ,

q2 1q3 1L (b) P = 1202 1, q30qI1L (e) P = [10F1.

7.1.2. In the alphabet {O, I}, construct a Turing machine having the following property (for empty symbol we take 0):

(1) the machine is applicable to any nonempty word in the alphabet {O, I}; (2) the machine is inapplicable to any word in the alphabet {O, I}, and the zone

of operation in each word is infinite; (3) the machine is inapplicable to any word in the alphabet {O, I} and the zone

of operation is limited by the same number of squares, which does not depend on the chosen word;

(4) the machine is applicable to words of the form 13n (n 2: 1) and inapplicable to any word of the form 13n+a , where 0 = 1, 2 and n 2: 1;

(5) the machine is applicable to words of the form 1 aOl a, where 0 2: 1, and inapplicable to lCtOF' if 0 -# f3 (02: 1 and f3 2: 1).

7.1.3. Using a given Turing machine T and an initial configuration K I ,

determine the terminal configuration (qo is the final state):

ql q2

(1) T: 0 qolS qlOR

1 q20R q2 1L

ql q2 q3

(2) T: 0 qoOS qo1L qI1L

1 q2 1R q30R qlOR

Page 203: Problems and Exercises in Discrete Mathematics

194 CHAPTER 7. ELEMENTS OF ALGORITHM THEORY

7.1.4. Construct a Turing machine in the alphabet {O, I}, which transforms the configuration KI into Ko:

(1) KI = qIl n, Ko = qolnOln (2) KI = qlonln, Ko = qo[011n

(3) KI = I n qIO, Ko = qo12n (4) KI = InqlOl m , Ko = Im qoOln

(n ~ 1), (n ~ 1), (n ~ 1), (m ~ 1, n ~ 1).

7.1.5. (1) Prove that, for any Turing machine, there exists an equivalent machine whose program does not contain the symbol S.

(2) Prove that, for any Turing machine, it is possible to construct an equivalent machine whose program does not contain final states.

7.1.6. The program of a Turing machine T has the form (the empty symbol is o and the initial state is ql).

ql q2 q3 q4

0 q2 1R q31R qI2L q23R

1 q4 1L q31R q2 1R q31R

2 qI2L q20R q32R -

3 - q23R q30R q43L

(1) Prove that starting the operation with a blank tape, the machine T will construct a word of the form Pn = 110102 103 ••• lOn 1 (n is an arbitrary positive integer) in t(n) steps, and at any instant t ~ t(n) (for n ~ 3) the head of the machine will be to the right of the word Pn - 2 •

(2) Construct a machine possessing the same property and having the set {O, 1} as an external alphabet.

(3) Prove that if the program of a Turing machine does not contain the symbol L (naturally, it may contain symbols Sand R), the machine, starting the operation wi th a blank tape, cannot construct a prefix of the word 11 0 1 021 031 ... on lOn +11 ... , however long.

7.1. 7. Prove that for any Turing machine T (in an alphabet A), there exists a countable set of machines Tl, T2 , ••• , Tm , ••• equivalent to it (in the alphabet A) and differing from one another in their programs.

7.1.8. Let A = {ao, at, ... , an-d be a certain alphabet containing at least two letters. We shall encode its characters as follows: the code of ai is the word lOi+Il in the alphabet {O, I}. According to this coding, the code of an arbitrary word P = ai, ai2 ... ais (s ~ 1) in the alphabet A will have the form 1 Oil +111 Oi2 +11 ... lO is+11. Prove that, irrespective of the type of a Turing machine T with the external alphabet

Page 204: Problems and Exercises in Discrete Mathematics

7.1. TURING MACHINES 195

A there exists a Turing machine To with the external alphabet {O, I}, which satisfies the following condition: for any word P (in the alphabet A) the machine To is applicable to the code of this word if and only if the machine T is applicable to the word P. Moreover, if T(P) is specified, the code of the word T(P) coincides with the word which is a result of application of the machine To to the code of the word P.

7.1.9. Construct the composition TIT2 of Turing machines Tl and T2 (for the pair of states (ql0, q21)) and determine the result of application of the composition Tl T2 to the word P (q2o is the final state of the machine T2)'

qn q12 q21 q22

0 q120R q101L 0 q221R q2dR

1 q12 1R qn OR 1 q210L q201S

qn q12 q13 q21 q22

0 q100 L q130R qn OR 0 q22 1L q200R

1 q12 1R q13 1R qn OR 1 q22 1L q21 0L

qn q12 q13 q21 q22 q23

0 q120R q130R q100L 0 q220L q230L q200R

1 qn1R qn 1R - 1 q21 1L q22 1L q231L

7.1.10. Determine the result of the application of iteration of a machine T (for a pair of states (qo, q;)) to the word P (qo and q~ are the final states):

ql q2 q3 q4 qs

(l)i=l,T: 0 qoOS q40S qsOS q4 1R q~lL

1 q20R q30R Ql 0R - -

ql q2 q3 q4 qs q6

(2) i = 1, T: 0 q~OR q~OR q40R qslL q60L qoOR

1 q20R q30R q3 1R q4 1R qs1L q6 1L

Page 205: Problems and Exercises in Discrete Mathematics

196 CHAPTER 7. ELEMENTS OF ALGORITHM THEORY

qi q2 q3 q4 q5 q6

0 q20L - q40R q5 1L q60L q~OR

1 qI2R q2 1R - q4 1R q5 1L q6 1L (3) i = 3, T:

2 - q3 1R - - - qolR

7.1.11. Determine the result of the application of the machine T = T(TI' (q~o, q21), T2, (q~o, q3I), T3) to the word P (q20 and q30 are the final states of the machines T2 and T3 , respectively):

q1l qI2 q2 1 q31 q32 0 qI20R q~oOR 0 q201s 0 q32 1L q30 1L 1 q12 1R q~olL 1 q2IOR 1 q3t1L -

qll qI2 q13 q21 q22

0 q120R q~oOL q~/oOR 0 q220L q200R

1 qll lR q13 1R q131R 1 q21 1L q221L

q31 q32

0 q320R q30 1S 1 q3t1R q3t1R

(a) P = 1"021(x ~ 1), (b) P = FOI0lYOF(x ~ 1, Y ~ 1, z ~ 1). 7.1.12. Using machines TI, T2 , T3 , T4 , and T5 , construct the operator scheme

of the algorithm A (here qlO, q~o, q20, q30, q40, and q50 are the final states of the corresponding machines):

qll q12 q21 q22 q23

0 q120R qlOOR 0 q220R q230R q200S

1 q~oOR qll lS 1 q21 1R q22 1R q231R

q31 q32 q41 q42 q43 q51

0 q32 1R q301S 0 q420L q430L q400R 0 q50 1S

1 q3IOR - 1 q41 1L q42 1L q431L 1 q51 1R

(1) A: qIIX ~ .qol 2X (x ~ 1),

(2) A: ql1x+l ~ .qol 3X (x ~ 0),

(3) A: WOql1x+! ~ .WOqoI2x+l (x ~ 0).

Page 206: Problems and Exercises in Discrete Mathematics

7.1. TURING MACHINES 197

Remark. If x = 0, then IX is assumed to be an empty word.

7.1.13. Using the operator scheme of the algorithm A and the description of the machines appearing in the scheme of the algorithm, construct the program of a machine and determine what is specified by this scheme to the word P.

(1) A= a T ---1 T T ~w 1 1 2 3 1 '

qn q21 q22 q23

0 q100L 0 q230R q230R q201L

1 qn 2R 1 q2dR - q23 1R

2 - 2 qn 1R - -

q31 q32

0 q320L q~oOR

1 q31 1L q32 1L

2 - q30 1R

(qn, q21 and q31 are the initial and qlO, q20, q30, and q~o the final states of the machines).

(2) A= a ~ Tl T2 lq;o T3 lm._1_1 w,

qn q12 q13 q14 q21 qn q23

0 - q130R q140L - 0 qnOL q20 1S q201S

1 q120R qdR q13 1R q100L 1 q~olS q23 1L q231L

q31 q32 q33 q34

0 q320L q330R q~olS q301R

1 q3dL q34 1L - q34 1L

P = FOP (x 2': 1, y 2': 1)

(qll, q21 and q31 are the initial and qlO, q20, q~o, q30, and q~o the final states of the machines).

7.1.14. Construct a Turing machine computing the function f: { o if x = 0

(l)f(x)=sgnx= 1 if x 2': 1;

if x = 1, if x 2': 2, (2)f(X)=[~l={ ~

is not defined if x = 0;

(3) f(x) = [~l = m if x = 2m or x = 2m + 1, m 2': 0;

{ 0 if x < y, ( 4) f (x, y) = x -7- Y = x _ y if x; y;

Page 207: Problems and Exercises in Discrete Mathematics

198 CHAPTER 7.

(5) f(x, y) =x-y; (6) f(x, y) = 47.

Y

ELEMENTS OF ALGORITHM THEORY

Remark. Here (and below), some well known "elementary" functions are often used for "analytic" representation of numerical functions. An "analytically" presented function is assumed to be specified only on integral tuples of values of variables (belonging to the natural scale N) for which all the "elementary functions" appearing in a given analytic representation of the function under consideration are specified and assumed to have integral nonnegative values. For example, the function x 2 /(3 - y /2) is specified only when y /2 is a nonnegative integer, 3 - y /2 is a positive integer and x 2 /(3 - y /2) is a nonnegative integer.

A Turing machine T is said to correctly compute a function J( in) if: (1) f( an) is specified, T( k( an)) = k(J( an)), and the head of the machine in the

terminal configuration scans the left unity of the code k(J( an)); (2) f( an) is not specified, and the machine T starting to operate from the left

unity of the code k( an) does not stop.

7.1.15. Prove that for any computable function, there exists a Turing machine that correctly computes this function.

7.1.16. Construct a Turing machine which correctly computes the function f: (1) f(x) = x-+- 1; (2) f(x) = sgnx = 1 - sgnx;

(3) f(x) = X~2; (4) f(x, y) = x + y;

(5) f(x, y) = 2~Y'

7.1.17. Using the program of the Turing machine T, write the analytic expression for the functions f(x) and f(x, y) computable by the machine T. (For the initial and final states everywhere, we take ql and qo, respectively.)

(1) T: ql q2 ql q2 q3 q4 qs

0 q2 1L qoOR (2) T: 0 q20R ql0L q40L q40L qoOR

1 ql 1R q2 1L 1 ql 1R q30R q30L qslL qslL

ql q2 q3 q4 qs q6 q7 qs q9

(3) T: 0 q20R q30R qolS qsOR q30L q70L - q90L ql0R

1 q20R q41R q3 1L q4 1R q61R q6 1R qsOL qslL q9 1L

7.1.18. Which functions of one variable can be computed by Turing machines (in the alphabet {O, I}) whose programs contain only one command?

7.1.19. Is it true that two different computable functions II (im) and h(in) can be computed on the same Turing machine if and only if m i:- n?

Page 208: Problems and Exercises in Discrete Mathematics

7.1. TURING MACHINES 199

7.1.20. Let M be a countable set of computable functions and let T(M) be the minimum possible set of Turing machines, such that for any function f in M, there exists a machine in the set T(M) that computes the function f.

(1) Prove that, if for a certain n ~ 1, there exists in the set M an infinite subset consisting of functions of n variables, then there exists in T(M) a machine with an indefinitely large number of states (i.e. for any 10 ~ 1, there exists in T(M) a machine with a number of states exceeding 10).

(2) What are the necessary and sufficient conditions for the set T(M) to be finite?

7.1.21. Construct an operator scheme of a Turing machine computing a function f. For elementary operators, use the machines Ti (i =4, 5, 6, 7, and 8). In Problems (1) and (2), first construct an operator scheme only through the machines T1, T2, T3 and then represent each of them by an operator scheme using T4, T5, ... , Ts. The initial states in the machines under consideration are q11, q21, ... , qSl and the final states are ql0, q~o, q20, q~o, q30, q40, ... , qso, q~o·

q41 q51

0 q400R 0 q500L

1 q401R 1 q501L

q71

0 q700S 0

1 q71 1L 1

(1) f(x, y) = x + y (mod 2),

q11 q12 q21 q22 q23

0 q12 1L q100R 0 q231L Q230L Q201S

1 q11 1R q12 1L 1 q220L q210L -

(2) f(x) = 2x ,

{ q111 f- .Q1012, Tl : Q11 I x+1 f- .101 XOQ~012 for x > OJ

{ FOIOtQ2dY f- .Q201Y,

T2 : FOZ+1lQt Q21 IY f- .F+I01z0tQ~01Y for z > o. Here x > 0, y > 0, t > O.

T3: WOQ31IY+1 f- . WOQ3012y+1, y ~ OJ

(3) f(x) = 3xj

(4) f(x, y) = X· Yj

(5) f(x, y) = x - y.

q61

0 q600S

1 q61 1R

qSl

qsolS

q~oOS

q31

0 Q300L

1 q31 1R

The distance between two squares C and C' on a tape is equal to the number of squares between C and C' plus one. In particular, adjacent squares are separated

Page 209: Problems and Exercises in Discrete Mathematics

200 CHAPTER 7. ELEMENTS OF ALGORITHM THEORY

from each other by unity. Let I be a positive integer. The subset of all squares of the tape, such that every two of them are separated by a distance multiple of I, is called a lattice with spacing I. Thus, the tape can be regarded as a union of llattices with spacing l. Let R(I) be a lattice with spacing I. Two squares of this lattice will be called adjacent if the distance between them (relative to the entire tape) is I. The word P = a1 a2 ... am is said to be recorded on the lattice R(I) if

(1) the symbol a1 is recorded in a square C1 of this lattice; (2) the symbol a2 is recorded in the square C2 which is adjacent to C1 in the

lattice R(I) and is located to the right of C1 , and so on; (m) the symbol am is recorded in the square Cm separated from the square C 1

by a distance (m - 1)1 and located to the right3 of C1•

A Turing machine T1 is said to simulate a Turing machine T on a lattice R(I) (with spacing I) if irrespective of the word P (in an alphabet A), the following condition is satisfied: let the word P be recorded on the lattice R(I) and let at the initial instant the head of the machine T1 scan the extreme left character of the word P; the machine T1 stops if and only if the machine T is applicable to the word P. If T(P) is defined, the word T(P) will be recorded on the lattice R(I) after the machine T1 terminates its operation.

7.1.22. Simulate the operation of a machine T computing the function f on a lattice with spacing I:

(1) f(x) = [~l ' 1 = 4;

(2) f(x, y) = sg~ x, 1=3; (3) f(x, y) = x + y, 1=3.

7.1.23. Prove that, for any Turing machine T and any integer I ~ 2, there exists a machine T' simulating the machine T on a lattice with spacing l.

A word in the alphabet {O, I} having the form 11(0'1+1)0111(0'2+1)01 ••• Oll l(O'n+1),

(l ~ 2) will be called an I-multiple code of the tuple an = (aI, a2, ... , an). 7.1.24. (1) Prove that a machine transforming the basic code of a tuple an to

an I-multiple code of this tuple (I ~ 2) can be defined by the following operator scheme:

T I 'T' Iq~o a 1 -- .L'2 - w 1 l'

where: (a) T1 has the initial state qll and the final state qlQ, and

(b) T2 has the initial state q21 and two final states q20 and q~o and q21 F+1021 0'.+, +1010'·+2+10 ... 01 O'n+10'+111(0'1 +1)0111(0'2+1)0' ...

... Oll'(O'i+1-x) r .q~olx0210'i+1+1010'i+2+10 ...

3We assume that only empty symbols of the external alphabet are outside the squares CI • C2 • ...• Cm on the lattice R(f).

Page 210: Problems and Exercises in Discrete Mathematics

7.1. TURING MACHINES 201

(2) Construct the programs of the machines T3 , T4 , ... , Tn using the following description:

the machine T3 , which starts to operate from the last unity of the array of unities, "shifts" the array by one square to the left, (without changing the "remaining content" of the tape4 ); the head stops against the first unity of the "shifted" array;

for a given I 2:: 1, the head of the machine T4 , which starts to operate from an arbitrary square containing unity, moves to the right until it passes through an array of 1+1 zeros; the head stops in the first square behind this array and prints 1 on it;

for a given I 2:: 1, the head of the machine Ts, which starts to operate from any square and moves to the right, prints I unities in succession and stops at the last unity;

the machine T6 starts to operate at the extreme left nonblank square; for a given I 2:: 1, the first left array of I + 1 zeros is "detected", and the head stops at the last of these zeros ("the content of the initial piece of the tape" remains unchanged);

the machine T7 starts to operate from the extreme left nonblank square, and detects the unity to the left of the first array consisting of three zeros "bordered" by unities, the head stops at the unity detected ("the content of the initial piece of the tape" remains unchanged);

the machine Ts prints 0 in the initial square, and the head stops after shifting to the left by a square;

the head of the machine Tg is shifted to the right by two squares of the "initial" square, and the machine stops at the state q90 if the new square contains 0 and at the state q~o if the "new" square contains 1 (the content of the tape remains unchanged);

the head of the machine TlO is shifted to the left by one square (after that, the machine stops and no changes occur in the tape);

the head of Tn starts to move to the right of an "initials' square, "detects" the first9 (in this displacement) unity and, having made another step, stops at the square located to the right of the" detected" unityS (the content of the tape remains unchanged).

4In other words, we assume that not a single "new" unity has appeared and the changes in the initial piece of the tape occurred only in the indicated array.

sIf unity is recorded in the "initial" square, the head stops at the next square to the right.

Page 211: Problems and Exercises in Discrete Mathematics

202 CHAPTER 7. ELEMENTS OF ALGORITHM THEORY

(3) Taking Ta, T4 , ••• , Tn for initial machines, construct the operator scheme for the machines Tl and T2 and for the machine transforming the basic code of the tuple into an I-multiple code.

7.1.25. Construct the operator scheme of a Turing machine transforming the I-multiple code of the tuple on into the basic code of this tuple. For initial machines corresponding to elementary operators, use the machines T4 , T5 , ••• , Ts of Problem 7.1.21. and the following three machines:

the machine T1, such that for I ~ 1, its head, moving to the right of a blank square, detects the first (in this displacement) array containing at least I unities; then the head erases the first I unities in this array and stops at the square containing the last unity which has been erased ("the remaining" content of the tape remains unchanged) ;

the machine T2 whose head is shifted from the "initial position" to the left by I squares (l is specified); the machine stops at the I-th square, and the content of the tape remains unchanged in this case;

the machine T3 operates in the same way as machine T2 , but the head is shifted to the right.

The lattice code of the tuple an = (aI, a2, ... , an) is the word in the alphabet {O, 1} recorded on n lattices with spacing n so that the first lattice contains the word 1 <>1 +1, the second contains the word 1<>2+1, etc., and the n-th lattice contains the word 1 <>n+l. The beginnings of the words on the lattices must agree with each other, i.e. the extreme left unity on the first lattice immediately precedes (on the tape) the extreme left unity in the second lattice, and this unity immediately precedes the extreme left unity of the third lattice, etc.

7.1.26. (1) Construct the operator scheme of a Turing machine transforming the basic code of the tuple on into a lattice code of this tuple. For the initial machines corresponding to elementary operators, use the machines T4 , Ts, ... , Ts in Problem 7.1.21. and the following two machines:

the machine T1 , whose head is shifted from the "initial position" to the right by n squares, stops at the n-th square; the content of the tape remains unchanged;

the machine T2 operates in a similar way, but its head is shifted to the left. (2) Using the same machines as in the previous problem, construct the operator

scheme of a Turing machine that transforms the lattice code of a tuple on into the basic code of this tuple.

7.2 Recursive Functions

The functions considered in this section are partial numerical functions. The function F(Xl' ... , xn) = f(gl(Xl, ... , xn), ... , gm(Xl, ... , xn)) is called

the superposition of functions f and gl, ... , gm and is denoted by S(f(m); gin), ... , gk»). Here the function F is defined on the tuple On and F(on) = f(gl(on), ... , gm(on)) if and only if each function g;(l :::; i :::; m) is defined on the tuple on and, besides, the function f is defined on the tuple (gl (on), ... , gm (on)).

Page 212: Problems and Exercises in Discrete Mathematics

7.2. RECURSIVE FUNCTIONS 203

Let g(Xl' ... , Xn-l) and h(xl' ... , Xn-l, Xn, xn+d be two functions and n :::: 2. We shall define the third function f( Xl, ... , Xn-l, Xn) with the help of the following scheme:

{ f(xl, ... , Xn-l, 0) = g(Xl' ... , xn-d, (1) f(xl, ... , Xn-l, Y + 1) = h(xl' ... , Xn-l, y, f(xl, ... , Xn-l, y)), Y :::: O.

This scheme is known as a primitive recursive scheme for the function f(:i;n) in variable J' n (and Xn+l) and gives a primitive recursive description of the function f( in) in terms offunctions 9 and h. The function f is also said to be obtained from 9 and h by using the primitive recursion operation in variable Xn (and xn+!)' In this case, the following notation is used: f = R(g, h) (the variables in which the recursion is carried out are indicated separately).

In the primitive recursive description of the function f(x) depending on a single variable, the primitive recursion scheme has the form

{ flO) = a, fly + 1) = h(y, flY)), y :::: 0,

(2)

where a is a constant (a number from the natural scale N = {O, 1,2, ... }). Let f(xl, ... , Xn-l, Xn), n :::: 1 be a certain function. We shall define the

function g(J'l' ... , Xn-l, Xn) as follows: let a = (0'1, ... , an-I, O'n) be an arbitrary tuple of nonnegative integers. We shall consider the equation

(3)

(a) If equation (3) has a solution Yo E N and for all yEN such that 0 ::; y < Yo the function f( 0'1, ... , an-I, y) is defined, and its values differ from O'n, we assume that g(a) = Yo.

(b) If Eq. (3) does not have a solution in nonnegative integers, we assume that g( a) is undefined.

(c) If Yo is the smallest nonnegative integral solution of Eq. (3) and for a certain Yl E Nand Yl < Yo, the value of f(O'l, ... , O'n-l, Yl) is undefined, we assume that g( a) is not defined.

The function g( in) constructed in this way from f( in) is said to be obtained from the function f(xl, ... , Xn-l, xn) by using the operation of minimization with l'espect to the variable Xn (or just the minimization in xn). In this case, the following notation is used: 9 = Mf, or g(in) = Mxn(f(i n)), or g(in) = /-ly(f(Xl, ... , Xn-l, y) = Xn), or g(in) = /-lxn(f(in)).

Remark. The operations of primitive recursion and minimization can be applied with respect to any variables in the functions f, 9 and h (however, the variables should always be indicated).

The following functions, henceforth, will be referred to as simplest: (a) s(x) = X + 1 is the successor function, (b) o( x) == 0 is the nullary function, and

Page 213: Problems and Exercises in Discrete Mathematics

204 CHAPTER 7. ELEMENTS OF ALGORITHM THEORY

(c) I;:'(XI' ... , xn) = xm(1 ::; m ::; n, n = 1, 2, ... ) is the selection function, or the function of selecting arguments.

The class K pr.r of all primitive recursive functions is the set of all functions which can be obtained from the simplest ones by the operations of superposition and primitive recursion.

The class K par.r of all partial recursive functions is the set of all functions that can be obtained from the simplest ones by the operations of superposition, primitive recursion and minimization.

Remark. In the definition of the K pr.r and K par.r classes it is assumed that while constructing each concrete function, the corresponding operations are applied a finite number of times including zero (some or all of the operations may not be applied at all).

The class K g.r of all general recursive functions is a set of all partial recursive functions defined everywhere.

It can be easily shown that Kpar.r":!Kg.r (the inclusion is strict!). The following strict inclusion is also valid: K g.r :::> K pr.r .

We shall denote by Kc the class of all partial numerical functions that can be computed with Turing machines.

The following statements are valid:

Theorem (A. Church, A.M. Turing) The classes K par.r and Kc coincide.

Theorem (R. Robinson). All primitive recursive functions of one variable, and only these functions, can be obtained from the functions x + 1 and sgn(x +- [JXP) by applying a finite number of times the following three operations:

(a) absolute difference f(x) = Ih(x) - h(x)l; (b) composition f(x) = fl(h(x));

( ) 't t' {f(O) = 0, c z era wn f(x + 1) = fl(f(x)).

7.2.1. Apply the primitive recursion to the functions g(XI) and h(xI' X2, X3) with respect to variables X2 (and X3). Write the function f(xI, X2) = R(g, h) in "analytic" form:

(1) g(XI) = xI, h(xI' X2, X3) = Xl + X3; (2) g(XI) = XI, h(xI' X2, X3) = Xl + X2; (3) g(XI) = 2X1 , h(XI, X2, X3) = X~1 (we put 0° = 1); (4) g(xt) = 1, h(xI' X2, X3) = x3(1 + sgnixi + 2 - 2X3i); (5) g(XI) = Xl, h(XI' X2, X3) = (X3 + 1) sgn (1 + ¥).

7.2.2. Prove that the functions f(xn) are primitive recursive: (1) f(xI, X2) = Xl +- X~j (2) f(xI) = 3X1 ; (3) f(xI, X2, X3) = X~X2 EB X3 (mod 2 sum).

Page 214: Problems and Exercises in Discrete Mathematics

7.2. RECURSIVE FUNCTIONS

7.2.3. Prove the validity of the relation f = R(g, h) if:

{

Xl if X2 = 0, (1) f(XI, X2) = rest(xI, X2) = the remainder of the division

of Xl by X2 if X2 > 0;

the recursion is carried out in variables Xl (and X3)'

{

Xl if X2 = 0, (2) f(XI, X3) = [~l = the quoti~nt of the division of

Xl by X2 If X2 > 0;

the recursion is carried out in variables Xl (and X3)' (3) f(Xl) = Xl 7 [y'xl]2,

9 = 0, h(Xll X2) = (X2 + 1) sgn(4xI 7 (X~ + 4X2))' (4) f(Xl) = [JXl], 9 = 0, h(Xl, X2) = X2 + sgn((x2 + 1)2 7 (Xl + 1)).

205

7.2.4. Prove that if the functions g(y), 'Pl(X), 'P2(X), and 'P3(X) are primitive recursive, the function

{ 'Pl(X) if g(y) ::; a,

f(x, y) = 'P2(X) if a < g(y) ::; b, 'P3(X) if g(y) > b,

where 0 ::; a ::; b, is also primitive recursive.6

7.2.5. Let gl(y), g2(X) and g3(X, y) be primitive recursive functions. Prove that, in this case, the function f(x, y) defined by the scheme

{ 1(0, y) = gl(y), f(x + 1, 0) = g2(X), f( X + 1, Y + 1) = g3( x, y)

is also primitive recursive (here X ~ 0 and y ~ 0).

7.2.6. Let the functions g(Xl' ... , Xn-l, Xn), hl(Xl, ... , Xn-l, Xn) and h2(.rl, ... , Xn-l, Xn), n ~ 1, be primitive recursive. Prove that the following functions are also primitive recursive in this case:

(1) f(Xl, ... , Xn-l, Xn) = I: g(XI' ... , Xn-l, i); i=O

Xn

(2) f(Xl, ... , Xn-l, Xn) = n g(Xl, ... , Xn-l, i); i=O

6The conditions imposed on the function g(y) must be understood as follows: we consider all such values of y for which the function g(y) satisfies the indicated relation.

Page 215: Problems and Exercises in Discrete Mathematics

206 CHAPTER 7. ELEMENTS OF ALGORITHM THEORY

{ t g(Xl' (3) f(Xl, ... , Xn-l, y, z) = O=y

... , Xn-l, i)

{ fI g(Xl' ... , Xn-l, i) (4) f(Xl, ... , Xn-l, y, z) = ~=y

h2(XI, ... , Xn_l, Xn)

for y :::; z,

for y > z;

for y :::; z,

for y > z;

(5) f(Xl, ... , Xn-l, Xn) = L g(Xl' ... , Xn-l, i) i=hl(XI, ... , Xn-I, Xn)

(here, as usual, the sum is consider to be zero if the upper limit of summation is smaller than the lower one);

h2(XI, ... , Xn-I, Xn)

(6) f(Xl, ... , Xn-l, Xn) = TI g(XI, ... , Xn-l, i) i=hl (Xl, ... , Xn-l, Xn)

(in the case when the upper limit of the product is smaller than the lower limit, the product is assumed to be unity).

7.2.7. Apply the minimization operation to the function f in Xi. Represent the resultant function in an "analytic" form:

(1) f(Xl) = 3, i = 1;

(2) f(xd= [T], i=l;

(3) f(Xl, X2) = Ii(xl, X2), i = 2; (4) f(Xl, X2) = Xl -;- X2, i = 1, 2;

(5) f(Xl, X2) = Xl - '*, i = 1, 2; (6) f(Xl, X2) = 2XI(2x2 + 1), i = 1,2.

7.2.8. Applying the minimization operation to an appropriate primitive recur-sive function, prove that the function f is partially recursive:

(1) f(xd = 2 - Xl; (2) f(Xl) = T; (3) f(xl, X2) = Xl - 2X2; (4) f(xl, X2) = 1_:II X2'

7.2.9. Is the following statement correct: if at least one of the partial recursive functions g and h is not defined everywhere, then f = R(g, h) ~ Kg .r ?

7.2.10. (1) Can a function that is not defined anywhere be obtained by a single application of minimization of a function which is defined everywhere?

(2) Give an example of a primitive recursive function which leads to a function that is not defined anywhere by applying the minimization operation twice.

7.2.11. Prove the computability of the following functions:

(1) f(x, y, z) = [X!l] (x - sgn(2X -;- y)) -;- (x + 1)z;

(2) f(x, y, z) = (XY~l + 2[X/2J) (y2 -;- xz);

(3) f(x, y, z) = 4x2 7 y2 - (X2 + 1)z7l;

Page 216: Problems and Exercises in Discrete Mathematics

7.2. RECURSIVE FUNCTIONS

7.2.12. What are the powers of the classes K pr.Tl Kg.r, K par.r and Kc? The function rp( x, y), defined by the scheme

{ rp(O, y) = y + 1, rp(x + 1, 0) = rp(x, 1), rp(x + 1, y + 1) = rp(x, tp(x + 1, y)),

where x 2: 0 and y 2: 0 is usually called Ackermann's function.

207

7.2.13. Prove that the Ackermann function satisfies the following conditions: (a) tp(x, y) > y for any x and y, (b) rp( x, y) is strictly monotonic in both variables, (c) rp(x + 1, y) 2: rp(x, y + 1) for any x and y.

7.2.14. Using the solution of Problem 7.2.13. and Robinson's theorem (stating that the set {x + 1, sgn( x...;- [foP)} is complete, relative to the composition, iteration and absolute difference operations in the class of all primitive recursive functions of one variable), prove that irrespective of the form of the primitive recursive function fry) of one variable, there exists an x for which f(y) < rp(x, y) for any value of the variable y.

7.2.15. Prove that the Ackermann function is general recursive but is not primitive recursive.

7.2.16*. Let us denote by K~n and KJl) the sets of all unary primitive recursive and all general recursive functions of one variable, respectively. Prove that the sets K(1) U{x + y} and K(1) U{x + y} are complete, relative to superposition in the pr.T g,T

classes K pr.r and Kg,r, respectively.

7.2.17. Let a Turing machine T compute the function JI(x) E K g.r \ K pr.r • Is it always true that the function h(x, y), computable by this machine, does not belong to Kpr,r?

7.2.18. (1) Let the Turing machines Tl and T2 compute primitive recursive functions JI(x) and h(x), respectively. Is it always true that the composition TIT2 also computes a primitive recursive function f( x)? What will happen if the machines TI and T2 correctly compute the functions fl and f2?

(2) Let a machine T compute a primitive recursive function f(x). Is it always true that if an iteration of the machine T computes a function g( x) defined everywhere, this function is necessarily primitive recursive?

7.2.19. Are the following relations valid? (1) f-lx(x ...;-1) = (f-l(x",;- 2)) ...;-1. (2) f-l x2(XI + (X2"';- Xl)) = f-lxl ((Xl ...;- X2) + X2)' (3) f-lx (x...;- [~]) E Kpr,r' (4) f-lx(x",;- [y'x]2) E K pr.r .

(5) f-lx([ \f'X2]) E Kpr,r'

Page 217: Problems and Exercises in Discrete Mathematics

208 CHAPTER 7. ELEMENTS OF ALGORITHM THEORY

7.2.20*. Let the functions h(x) and f2(X) belong to the set Kg.r \ Kpr.r. Can the following statements be correct?

(1) h(h(x)) E Kpr.r, but h(Jl(X)) ~ Kpr.r.

(2) h(x2 ) E Kpr." but [Jh(x2 )] ~ Kpr.r. (3) fl(X) + h(x) E Kpr.Tl but fl(X) + 2h(x) ~ Kpr.r.

7.2.21*. Let f(x) E Kg •r \ Kpr.r. Are the following relations always satisfied? (1) f(2x) ~ Kpr•r ;

(2) f(x + y) E Kpr.r ;

(3) f(x· y) ~ K pr.r ;

(4) 1 + f(x) ~ Kpr.r ;

(5) f(x + y) E Kpr.r •

7.2.22. (1) Both variables of a function f(x, y) in Kg.r are essential. We assume that {txf(x, y) and {tyf(x, y) are the functions defined everywhere. Can at least one of these functions essentially depend only on one variable?

(2) The function f(x, y) E Kg .r has one fictitious variable. Can both variables of the function {txf( x, y) be essential if we additionally assume that it is a general recursive function?

7.2.23. Formulate the necessary and sufficient condition that a function {txf(x) is not defined anywhere.

7.2.24. (1) What is the necessary and sufficient condition for the relation {txf( x) E Kg .r to be fulfilled?

(2) Can at least one of the functions {txf(x, y) or p.yf(x, y) be general recursive if f(x, y) E Kpar.r \ Kg .r ?

7.2.25*. Let f(x) E Kg.r \ Kpr.r. Can the relation {txf(x) E Kpr.r be true?

7.2.26. It is known that f(x) E Kg.r and that for any x ~ 0, f(2x + 1) = f(x) and f(2x) = f(x + 1). It is true that f(x) E Kpr.r?

7.2.27. Find out whether the set Kg .r \ Kpr.r is complete relative to superposition in the class K g•r?

7.2.28. Does a set M form a complete set relative to the set of operations 0 in the class Kpar.r?

(1) M = Kpar.r \ Kpr.r, 0 = {R, {t}; (2) M = Kpar.r \ Kg.r, 0 = {S}; (3) M = Kg.r \ Kpr.r, 0 = {S, {t}; (4) M = Kpr.r , 0 = {{t}.

7.2.29. Let a general recursive function f(x) be such that f(N) = {J(x): x E N} is an infinite proper subset of the set N. Will the following equality hold

[(K!!~.r \ K~~/ U{J(x)}] = K!!~.r'

Page 218: Problems and Exercises in Discrete Mathematics

7.3. COMPUTABILITY 209

where KJ!~.r and KP) are the sets of all unary partially recursive and all general recursive functions of one variable, respectively, and the closure is taken relative to superposition and minimization?

7.3 Computability

A partial function F( Xo, Xl, ... , Xn) is called universal for a family Q of functions of n variables if the following two conditions are satisfied:

(a) for any i(i ==0,1, ... ), the function F(i, Xl, ... , Xn) of n variables, belongs to Q;

(b) for any function f(xI, ... , xn) in Q, there exists a number i such that for all values of variables Xl, ... , Xn,

The number i is called the number of the function f( Xl, ... , xn), and the numbering of functions of the family Q obtained in this way, is called a numeration corresponding to the universal function F( Xo, Xl, ... , xn). Conversely, if a numeration of the family Q is specified, i.e. if a mapping 'P: i -t fi of the natural scale on Q is defined, the function F(xo, Xl, ... , Xn) defined by the formula

is universal for Q. Each primitive (partial) recursive function f(xI' ... , Xn) can be associated with a term reflecting the way of representing the function f(xI, ... , xn) in terms of I;:' (Xl, ... , Xn) = Xm , s(X) = X + 1 and o(x) == 0 using superposition, primitive recursion (and minimization). By numbering all the terms, we can obtain the numeration for all primitive (partial) recursive functions. A numeration of this type is called a Codel numbering. For a formal definition of the Codel numbering, see, for example, [35]. Henceforth, we shall assume that a certain Codel numbering is fixed. A partial recursive function of n variables, having a number X in this numbering, will be denoted by 'P~n). The superscript will be omitted if there are no other stipulations concerning the number of variables of the function 'P~n).

The following statements are valid.

Theorem 1 (on a function which is universal for the set of all primitive recursive functions of n variables). The class of all primitive recursive functions of n variables has a general recursive universal function.

This universal function (corresponding to a chosen Codel numbering) will be denoted by D(xo, Xl, ... , xn ).

Theorem 2 (on a uni versal function). There exists a partial recursive function U(xo, Xl, ... , Xn) which is universal for the set of all partial recursive functions of n variables.

Page 219: Problems and Exercises in Discrete Mathematics

210 CHAPTER 7. ELEMENTS OF ALGORITHM THEORY

The concept of a universal function is frequently used in proofs involving "diagonalization" . As an example, we can consider the following proof of the existence of a general recursive function which is not primitive recursive. Let D(xo, xd be a universal function in the class of primitive recursive functions of one variable. It follows from part (a) of the definition of the universal function that D(xo, xd is defined everywhere. Let us consider g(x) = D(x, x) + 1. The function g(x) is not primitive recursive. Indeed, if this were so, the equality D(j, x) = g(x) would be satisfied for a certain j and for all x. However, for x = j, this equality is transformed into an inconsistent relation

D(j,j) = g(j) = D(j,j) + 1.

The following statement, put forward by Kleene, is known as a (s-m-n )-theorem .

Theorem 3. For any m, n 2: 1, there exists a primitive recursive function s(m+l) such that for all x, Yl, ... , Ym, the following relation holds:

Let T be a Turing machine and K be a certain configuration. The time complexity tT(K) of a computation process is defined as the number of steps taken by the machine T during a transition from K to the final configuration if T can be applied to K. The function tr(K) is not defined if T is inapplicable to K. The computation process zone is the minimum part of the tape containing all squares in at least one configuration encountered in the computation process. The storage complexity sT(K) is defined as the length of the computation process zone with the initial configuration K if T is applicable to this configuration. The function ST( K) is not defined if T is inapplicable to I<. By WT(I<), we denote the number of changes in the direction of the head displacement and, by rT(K), the maximum number of passages of the head across the boundary between two adjacent squares of the zone during computation (the maximum is taken over all pairs of adjacent squares). The functions WT( K) and rT( K) are not defined if T is inapplicable to K. If, for K, we take the initial configuration for the word P, the complexity functions are denoted by tT(P), ST(P), WT(P) and rT(P), respectively. If qT is a complexity function, then qT(n) = maxp: '\(P)~n qT(P),

7.3.1. Prove that a function that is universal for primitive recursive functions of one variable

(a) assumes all the values in N ={O, 1, 2, ... }; (b) assumes each value in N an infinite number of times.

7.3.2. Prove that each primitive recursive function of one variable in a Godel numbering has a countable set of numbers.

7.3.3. Prove that there is no partial recursive universal function for a family of all general recursive functions of n variables.

7.3.4. Prove that there exist partial numerical functions that are not partial recursive. Give the proof based on a comparison of the powers of two sets: that of

Page 220: Problems and Exercises in Discrete Mathematics

7.3. COMPUTABILITY 211

partial recursive functions and that of all partial numerical functions. Also give the another proof based on "diagonalization".

7.3.5. Give an example of a partial numerical function which assumes exactly one value and which is not partial recursive.

7.3.6. Prove that the function f is not a partial recursive function:

(1) f(x ) == { 1 if the ~alue of 'Px(y) is defined, , y 0 otherwIse;

(2) f(x) == { 1 if 'Px(X! is defined, o otherwIse;

(3) f(x ) = { 'Px(y) if v:x(y) is defined, , y 0 otherwIse;

(4) f( ) {I if 'Px(y) == z, x, y, Z == 0 otherwise;

(5) f(x z) == { 1 if ther~ exists y for which 'Px(y) == z, , y, 0 otherwIse.

7.3.7. Is the function f partial recursive in the following cases:

(1) {(x) == { 1 if 'Px(X! == I, . 0 otherwIse;

(2) f(x) == { is not de~ned if <px(x) is defined, 1 otherwIse;

(3) f(x) == { 1 if the ~nity belongs to the set of values of function 'Px, o otherwIse;

(4) f( x) == { 1 if 'Px is. primitive recursive, o otherwIse;

{I if the decimal decomposition of the number

(5) f( x) == 7r contains an infinite number of zeros, o otherwise.

7.3.8. Let u(xo, Xl, ... , Xn) be a partial recursive function that is universal for a nonempty subset M of general recursive functions, such that K g .r \ M is infinite. Using the "diagonalization" process, indicate a countable set of general recursive functions not belonging to M.

7.3.9. Show that if a function f( x) is partial recursive, any function differing from f( x) on a finite set of values of the argument is partial recursive.

7.3.10. Let U (x, y) be a function that is universal for the set of all partial recursive functions of a single variable. Prove that the function f(x) == U(x, x) + 1 does not have recursive extensions (in other words, a function defined everywhere, coinciding with f( x) wherever f( x) is defined and arbitrary otherwise, is not a partial recursive function).

7.3.11. Let a partial recursive function f( x) be such that the function h( x),

Page 221: Problems and Exercises in Discrete Mathematics

212 CHAPTER 7. ELEMENTS OF ALGORITHM THEORY

defined by the condition

{Oat points where f( x) is defined,

h( x) = 1 at points where f( x) is not defined,

is recursive. Prove that the function f( x) has a recursive extension.

7.3.12. Give an example of a binary sequence ao, aI, ... , an, ... generated by an appropriate autonomous deterministic operator and satisfying the following condition: the function f(x), defined by the equality f(n) = an for all n ~ 0, is not general recursive.

7.3.13. (1) Prove that if the sequence ao, aI, ... , an, ... is the output for a certain autonomous b.d.-operator, the function f(x), defined by the relation f(n) = an for all n ~ 0, is general recursive.

(2) Is such a function always primitive recursive?

7.3.14. Give an example of an infinite binary sequence 0 = ao, aI, ... , an, '" satisfying the following conditions:

(1) there is no autonomous b.d.-operator for which 0 is an output sequence; (2) there exists a Turing machine which starts operating on a blank tape and

constructs the sequence 0; moreover, for each n there exists an instant of time to = to( n), such that for t ~ to, the head of the machine does not scan the squares of the tape to the left of the square, where the symbol an is recorded.

7.3.15. Give an example of the transformation of finite words which may be carried out by a suitable Turing machine, but cannot be carried out by any deterministic operator.

7.3.16. For a given function f, construct a Turing machine T which can correctly compute f with an upper estimate for its time complexity, and majorize the remaining complexity functions. The input data are given in a unary form. The external alphabet is given by A ={O, 1}.

(1) f(x, y) = x + y, fr(n)::; cn; (2) f(x) = 2x, tT(n)::; cn2; (3) f(x) = Ix - YI, tT(n)::; cn2; (4) f(x, y) = [;:], tT(n)::; cn2;

(5) f(x) =]10g2 xl, tT(n)::; cn2.

7.3.17. Construct a Turing machine T transforming the unary notation of a number into a binary notation with given restrictions on the complexity function: tT(n) ::; cln2, sT(n) '"" n, wT(n) ::; C2n, fT(n) ::; C3n, where CI, C2 and C3 are constants.

7.3.18. Construct a Turing machine T which transforms a binary notation into a unary notation, and such that tT( n) :::; CI n2n, ST (n) '"" C2n + 2n, WT (n) :::; C3n2n, fT(n) ::; C4n2n, where CI, C2, C3 and C4 are constants.

7.3.19. Construct a Turing machine T with an input alphabet A of m characters, transforming a word Pinto P * P, where the symbol * does not appear in P, and such that tT(n):::; cln2, sT(n)::; C2n, wT(n) ::; C3n, fT(n) ::; C4n.

Page 222: Problems and Exercises in Discrete Mathematics

7.3. COMPUTABILITY 213

7.3.20. (1) Construct a machine T, recognizing the linearity7 of an arbitrary Boolean function f(i;n). The function J(i;n) is defined by a binary vector ii f of length N = 2n. The input alphabet of the machine is A = {O, 1, A}. The functions tT(N) and sT(N) must satisfy the inequalities tT(N) ~ C1N2, sT(N) ~ c2N.

(2) Construct a machine T, recognizing the self-duality of an arbitrary Boolean function J(i;n), and such that ty(N) ~ C1N2, sT(N) ~ c2N.

(3) Construct a machine T, recognizing the monotonicity of an arbitrary Boolean function f(i;n), and such that tT(N) ~ C1N2, sT(N) ~ c2N.

7.3.21. Show that for any Turing machine T and for any word P (1) ST(P) ~ tT(P) + IFI; (2) there exists a constant c, such that tT( P) ~ CST(P).

7 A machine recognizing a property of an input word has two final states, qo and q~. The machine stops at the state qo if the property is observed, and at the state q~ if it is not.

Page 223: Problems and Exercises in Discrete Mathematics

Chapter 8

Combinatorics

8.1 Permutations and Combinations

The tuple of elements aill ... , air in the set U = {aI, ... , an} is called an r­multisubset of n-set U, or an (n, r)-multiset. If the sequential order of elements in a multiset is specified, we call it an ordered multiset. Two ordered multisets, differing only in the sequential order of their elements, are assumed to be different. If the sequential order of elements is not significant, the multiset is called a disordered multiset. Elements may, or may not, repeat themselves in a multiset. An ordered (n, r)- multiset in which the elements may be repeated is called a permutation of n elements with repetitions taken r at a time, or an (n, r )-permutation with repetitions. If an ordered (n, r)-multiset has pairwise different elements, we call it an (n, r)­permutation without repetitions, or simply an (n,r)-permutation. The number of (n, r)-permutations will be denoted by the symbol P(n, r), while the number of (n, r)-permutations with repetitions will be denoted by P(n, r). A disordered (n, r)-multiset, in which the elements can be repeated, is called a combination of n elements taken r at a time, or simply an (n, r)-combination with repetitions. If the elements of a disordered multiset are pairwise different, it is called a combination (without repetition) of n elements taken r at a time, or an (n, r)-combination. Each such combination is a subset of power r in the set U. The number of combinations of n elements taken r at a time will be denoted by C(n, r), while the number of combinations (with repetitions) of n elements taken r at a time will be denoted by C(n, r).

Example 1. Let U = {a, b, c}, r = 2. In this case, we obtain: nine permutations with repetitions, viz., aa, ab, ac, ba, bb, bc, ca, cb, cc,

six permutations without repetitions, viz., ab, ac, ba, bc, ca, cb,

six combinations with repetitions, viz., aa, ab, ac, bb, bc, cc, and three combinations without repetitions, viz., ab, ac, bc.

The product n(n - 1) ... (n - r + 1), where n is real and r is a positive integer, will be denoted by (n)r. By definition, we put (n)o = 1. If n is a natural number, (n)n is denoted by the symbol n! and is called n-factorial. For n = 0, we assume

214

Page 224: Problems and Exercises in Discrete Mathematics

8.1. PERMUTATIONS AND COMBINATIONS 215

that O! = 1. For any real n and a nonnegative integer r, the quantity (n)r/r! is

called a binomial coefficientl and is denoted by the symbol (~). Let rl, r2, ... , rk be nonnegative integers and let rl + r2 + ... + rk = n. The quantity n!/rl!r2! ... rk! is called a polynomial coefficient, and is denoted by Cl, r2 ~ ... , rJ .

The following two rules are taken into consideration while counting the number of different combinations.

Multiplication rule. If an object A can be chosen in m different ways, and if after each such choice, an object B can, in turn, be chosen in n different ways, the choice "A and B" in this order can be carried out in m x n ways.

Summation rule. If an object A can be chosen in m different ways and an object B in n other ways, and if the choice "A and B" is not possible, the choice "A or B" can be made in m + n ways.

Example 2. Two dice (with six faces each) are cast. In how many different ways can they be cast so that each of them shows either an even number or each an odd number.

Solution. Let A be the number of ways in which an even number is shown by each die, and let B be the number of ways for an odd cast. Then, according to the summation rule, the required number is A + B. Let C be the number of ways of an even cast by the first die and D the number of ways for an even cast by the second die. Obviously, C = D = 3. According to the multiplication rule, A = C x D = 9. Similarly, B = 9. Hence, the total possible number of ways is equal to 18.

Example 3. Show that the number of (n, r )-permutations without repetitions is equal to (n)r.

Solution. Induction on r. For r = 1, the number of ways in which one object can be chosen from n is equal to nl. Suppose that the equality P(n, r) = (n)r, is satisfied for a certain r ~ 1. We shall prove that an analogous equality also holds for r + 1. Each set of r + 1 objects can be obtained by first choosing r objects comprising the (n, r )-permutation, followed by the addition of the (r + 1)-th object to it. If r objects are chosen, there are n - r ways in which the (r + 1 )-th object can be chosen. According to the multiplication rule, we obtain

P(n, r + 1) = P(n,r) x (n - r).

Using the induction hypothesis, we can write

P(n, r + 1) = (n)r x (n - r) = (n)r+l'

A large number of combinatorial problems can be reduced to a computation of the number of binary vectors.

IThe notations C~, nCr, and (n, r) are also encountered in the literature.

Page 225: Problems and Exercises in Discrete Mathematics

216 CHAPTER 8. COMBINATORICS

Example 4. In how many ways can the number n be presented as a sum of k nonnegative components (representations differing only in the order of the components are assumed to be different)?

Solution. Each decomposition of the number n into k nonnegative integral components is assigned a vector of length n + k - 1 with n ones and k - 1 zeros, such that the number of ones just before the first zero is equal to the first component, the number of ones between the first and second zeros is equal to the second component, and so on. This is a one-to-one correspondence. It should be noted that each binary vector with n + k - 1 coordinates and n ones can, in turn, be associated with an n­element subset A of the set U = {aI, a2, ... , an+k-l} as follows: the i-th coordinate of the vector is equal to 1 if and only if ai E A, i = 1, 2, ... , n + k - 1. But the number of such subsets is C(n + k - 1, n).

8.1.1. In how many ways can three tickets be distributed among 20 students if: (1) The tickets are for different theaters, and each student can get no more than

one ticket? (2) The tickets are for different theaters and for different shows, and any student

can obtain any number of tickets (not exceeding three)? (3) The tickets are for the same show, and each student can get no more than

one ticket?

8.1.2. In how many ways can nine persons be lined up ( 1) in single file? (2) in threes, if they are formed in each rank according to height, and no two

persons have the same height?

8.1.3. Prove that (1) P(n, r) = nT,

(2) C(n, r) = (~), (3) C(n, r) = (n!~~l).

8.1.4. Find the number of vectors 0: = (aI, ... , an) whose coordinates satisfy the following conditions:

(1) ai E {a, 1, ... , k - I}, i = 1, ... , n;

(2) ai E {O, 1, ... , ki - I}, i = 1, ... , n; (3) aiE {O, I}, i=l, ... ,n,andal+ ... +an=r.

8.1.5. (1) Find the number of matrices having n rows and m columns with their elements in the set {O, I}.

(2) Find the same, provided that the rows of the matrix are pairwise different.

8.1.6. Given n objects of one type and m objects of another. Find the number of multisets containing r objects of one type and s objects of the other type.

8.1. 7. Words are formed by using n letters, of which a and b appear a and (3 times, respectively, while the remaining letters are pairwise different. How many

Page 226: Problems and Exercises in Discrete Mathematics

8.1. PERMUTATIONS AND COMBINATIONS 217

different r-Iettered words can be formed, so that the letters a and b appear hand k times, respectively, (h ::; D, k ::; (3)?

8.1.8. A deck containing 4n(n 2 5) cards has n cards each of four different suits, numbered 1, 2, ... , n. In how many different ways can five cards be chosen, so that they contain

(1) five consecutive cards of the same suit? (2) four of the five cards with the same value? (3) three cards with one value and two cards with some other value? (4) five cards of the same suit? (5) five successively numbered cards? (6) exactly three of the five cards with the same value? (7) no more than two cards of the same suit?

8.1.9. Solve the following problems by using the summation and multiplication rules:

(1) In how many ways can two chips be chosen from among 28 in a game of dominoes, such that they can be put next to each other (i.e., the same number is encountered on both chips)?

(2) Three dice are cast. In how many ways can they show the same number or pairwise different numbers?

(3) It is customary to give more than one Christian name to the newly born baby in England. In how many different ways can a baby be named if he is to be given three names from a total of 300?

8.1.10. (1) In how many ways can the number n be presented as a sum of k natural components (representations differing only in the order of components are assumed to be different)?

(2) In how many ways can the number 7n be presented in the form of a product of three cofactors (representations differing only in the order of cofactors are assumed to be different)?

(3) The same, provided that representations differing only in the order of cofactors are assumed to be identical, and n -=J 3s?

8.1.11. In how many ways can n zeros and k ones be arranged so that each two subsequent ones are separated by not less than m zeros?

(2) Find the number of nonnegative integers not exceeding IOn whose digits are arranged in nondiminishing order.

(3) A rectangular city is divided by streets into squares. There are n such squares from north to south, and k squares from east to west. Find the number of shortest walks from the north-eastern end of the city to the south-western end.

8.1.12. Let n be the product p~l x ... X p~r of powers of pairwise different prime numbers. Find

(1) the number of all natural divisors of the number n; (2) the number of all divisors that cannot be divided by a square of any integer

other than 1; (3) the sum of divisors of the number n.

Page 227: Problems and Exercises in Discrete Mathematics

218 CHAPTER 8. COMBINATORICS

8.1.13. Prove the following properties of binomial coefficients: (1)

(~) = (n: k} (2)

(~) (~) = (~=~) (~} (3)

(~) = (n ~ 1) + (~= D; (4)

( n ) j (n) (k)~ k - r k - (n - k + r)r'

(5)

(~)=~(n~~~l} (6)

(n - r) / (n) = (k )r ; k - r k (n)r (7)

(n+1) j(n) = n+1 ; k k n-k+1 (8)

t (r) = (n+1). r=k k k + 1

8.1.14. Prove that

(1) (~) increases with n for a fixed k;

(2) (~=;) decreases with r for fixed nand k;

(3) if n is fixed, then (~) increases with k for k < [n/2] - 1 and decreases for

k 2]n/2[;

(4)

oTttn (~) = Cn~2]); (5) if q = [n/s] and r = n - s[n/sJ, and L:i=l ni = n, then

Page 228: Problems and Exercises in Discrete Mathematics

8.1. PERMUTATIONS AND COMBINATIONS

(6) if 0 ::; kl < ... < ks ::; n, 1 ::; s ::; n + 1 , then

{ ( n ) ( n ) ( n ) } (n) max + + ... + = L ; (k, , ... ,k,) kl k2 ks n-, <. !!.±.!. j

~_J< 2

(7) for a prime P and for any P > k 2: 1, the number W is a multiple of p;

(S) let Pi be the i-th prime number, then

II Pi::; . (2n) n<p.S2n n

219

8.1.15. (1) Let m be a nonnegative integer, and let n = n(m) be the minimum integer, such that m < n!. Prove that there is one and only one way in which the number m can be associated with a vector a(m) = (aI, a2, ... , an-d, such that m = al x I! + a2 x 2! + ... + an-l x (n - I)!, 0::; ai < i, i = 1, ... , n - 1.

(2) Let f.L(a) be a number, such that a = a(f.L(a)). Find the vector a(m) for m = 4, 15,37

(3) Find f.L( a) from the following values of a: (a) a = (0, 2, 0, 4); (b) a = (0, 2,1); (c) a = (1, 2, 3, 2). (4) The permutation of a set Zn = {I, 2, ... , n} is defined as an arbitrary

mapping of Zn onto itself. Any permutation 7r can be put in a one-to-one correspondence with the vector 7r = (7r(1), ... , 7r(n)), in which the 7r(i) coordinate indicates the position of the element i. Each permutation 7r is put in correspondence with a number v( 7r), 0 ::; v( 7r) < n!, called the number of the permutation. For this purpose, we first construct a vector aIT = (aI, a2, ... , an-I). We put an-l = 7r(I) - 1. If an-I, ... , an-j are already defined and s(j) = I{i < jl7r(i) < 7r(j)}, we put an-j-l = 7r(j + 1) - s(j + 1) - 1. The number v( 7r) is defined as f.L( aIT ). For example, ih = (3, 4, 2,1), then aIT = (1,2,2), v(7r) = 1 x 1!+2 x2!+2 x 3! = 17. From the permutation 7r defined by the vector 7r, find the number v( 7r) in the following cases:

(a) 7r=(2, 3,1,4), (b) 7r=(3, 5, 2,1,4), (c) 7r=(1, 4,3,5,2).

(5) Find the algorithm for constructing the permutation 7r from its number V7r.

(6) From the number m, find the permutation 7r on the set Zn, n! > m 2: (n-1)!, such that v( 7r) = m:

(a) m = 7; (b) m = IS; and (c) m = 2S.

8.1.16. (1) Let k and n be natural numbers. Prove that any integer m such

that 0 ::; m < (~), can be uniquely associated with an integral vector ~(m) (131, 132, ... , 13k), satisfying the conditions

n > /31 > 132 > ... > 13k 2: 0, m = (/3;) + (t~l) + ... + (~k). In this case, m is called the number of the tuple ~ (denoted by m = f.L(13)). (2) For given m, n, and k, construct the vector ~(m): (a) m = 19, n = 7, k = 4; (b) m = 25, n = 7, k = 3;

Page 229: Problems and Exercises in Discrete Mathematics

220 CHAPTER 8. COMBINATORICS

(c)m=32, n=8, k=4.

(3) From a given vector ~ = ((31. ... , (3k), find a number m satisfying the conditions of Problem 8.1.16 (1):

(a) ~ = (6, 3, 0); (b) ~ = (5, 4, 3, 1); (c) ~ = (6, 4, 3, 2, 1). ( 4) Let BJ: be the set of all vectors of length n having k ones and n - k zeros.

Using Problem 8.1.16 (1), enumerate all tuples in BJ: from 1 to (~), i.e. construct

a one-to-one mapping v of the set BJ: onto the set {I, 2, ... , (~)}.

8.1.17. Using the relation

prove the following identity by induction on n:

(1)

8.1.18. Let nand m be positive integers. Using the identity (1) or some other method, prove the following equalities:

(1)

(2)

f) _l)k (n) = 0; k=O k

(3)

(4)

t k(k - 1) (~) = n(n - 1)2n - 2 ;

k=2

(5)

(6)

~ 1 (n) 1 (n+l ) ~k+1 k =n+l 2 -1;

(7)

Page 230: Problems and Exercises in Discrete Mathematics

8.1. PERMUTATIONS AND COMBINATIONS

(8)

(9)

(10)

(11 )

(12)

( 13)

(14)

(15)

n (l)k-l (n) 1 1 {;-k- k =1+ 2+",+;;

~(~)(k:r) = (n~m}

E (~r = e:); n (2n)! 2n ( )

2

E (k!)2((n - k)!)2 = n ;

n n-k (n) (n - k) LL =3n ; k=Or=O k r

~ ( n ) (m) = (m + n) ; r=O k + r r n - k

f( _l)k-n (k) (m) = { 0 for m i= n, k=n n k 1 for m = n.

8.1.19. Prove the following identities: (1)

'" (n) _ '" ( n ) _ 2n - 1 . L: 2k - L: 2k + 1 - ,

(2)

4'" (n) = 2n + 2~+1 cos 1m. L...J 4k 4 '

k

(3) if 0 ~ r < m, then

(4)

L ( n ) = ~ (2n + 2~+1 cos ~(n - 2r)) , 0 :s: r :s: 3; k 4k + r 4 4

221

Page 231: Problems and Exercises in Discrete Mathematics

222 CHAPTER 8. COMBINATORICS

(5) if 0 ::; r < m, m ~ 1, then

2n ( 7r ) (n) 2n

( 7r ) - 1 - (m - 1) cos n - ::; L ::; - 1 + (m - 1) cos n - . m m k mk+r m m

8.1.20. Prove that (1)

'\' mk+r ( n ) ~ _2~rv. ( 2~'V)n m ~ 0' k = ~ e m 1 + ae m •

k m + r v=o

Using the identity (2), calculate (2)

(3)

(4)

'\'( 1)k2k ( n ). "'i: 4k + 1 '

L(-l l 3k ( n )(2k+l). k 2k + 1 r

8.1.21. Find the number of rational terms in the expansion

(1) (v'2 + «3io;

(3) (0i + 12)100;

(2) (v'3 + 15)50;

( 4) (ijI2 + ij3)30.

8.1.22. Find the coefficient of tk in the expansions

(1) (1 + 2t - 3t2)8, k = 9;

(2) (1 - t + 2t2)10, k = 7;

(3) (2 + t - 2t3 )20, k = 10;

(4) (2+t4 +n15 , k=17.

(2)

8.1.23. Show that the following identities are valid for integral m ~ 0 and n ~ 0: (1)

(2)

t (nh = m + 1 m > no k=O (m) k m - n + 1 ' -,

t (m + k - 1) = f (n + k - 1) . k=O k k=O k

8.1.24. Let a and b be real, and let k, m, nand r be nonnegative integers. Prove that

Page 232: Problems and Exercises in Discrete Mathematics

8.1. PERMUTATIONS AND COMBINATIONS 223

(1)

(~) + (k:1) = (a:1); (2)

(1 + tt = E (~)tk, It I < 1;

(3)

(-a) k(a+k-1) k = (-1) k ' a > 0;

(4)

t (a-k) = (a+1) _ (a-n); k=O r r + 1 r + 1

(5)

~ (~) (n : k) = (a: b) (addition theorem);

(6)

~(-lt-kG) = (a: I} (7)

~(a+~=~-l)(b+~-l) = (a+b:n-1); (8)

L (a) (b) ( C )=(a+b+C} O$k,r$n k r n-k-r n

(9)

E(-l)kC:) G)k = /[;

(10)

00 ( 1/2 ) C) k E 2k + 1 2 = J5 - V3;

(11 )

( ) m-l a 211'"ril.l 27ftv a

m L k bmk+r = L e--;;- (1 + be-;n) , Ibl < l. k m + r v=O

8.1.25. (1) Find the number of words of length mn in an n-lettered alphabet, in which each letter is encountered m times.

(2) In how many ways can a set of n elements be decomposed into s subsets the first of which contains kl elements, the second k2 elements, and so on?

Page 233: Problems and Exercises in Discrete Mathematics

224 CHAPTER 8. COMBINATORICS

(3) With the help of combinatorial analysis, prove that the following equality holds for any nonnegative integers kI, k2, ... , k., n, such that kl +k2+" .+k. = n:

( n) (n - kl) (n - kl - k2 - ... - k._l ) = n! kl k2 ... k. kl!k2!'" k.!·

(4) Prove the following identity by induction on s:

kb "', ks kl + ... +k.=n

(2) Let J-l(a) be a number, such that a = a(J-l(a)). Find the vector a(m) for m = 4,15,37.

(2) Let J-l(a) be a number, such that a = a(J-l(a)). Find the vector a(m) for m = 4,15,37

(3) Find J-l( a) from the following values of a: N

8.2 Inclusion and Exclusion Formula

Let us consider N objects and n properties AI, ... , An. Each object may, or may not, possess any of these properties. We denote by Nil, ... ,ik the number of objects having the properties Aill ... , Aik (and perhaps some other properties as well). In this case, the number No of objects not possessing any of the properties AI, ... , An is defined by the equality

No = So - Sl + S2 - ... + ( -1 t Sn, (1)

where So = N, and Sk = L: Nil, ... ,ik , k = 1, ... , n. l~il < ... <ik~n

Formula (1) is called the inclusion and exclusion formula.

Example 1. Suppose that a deck contains n cards, numbered from 1 to n. In how many ways can the cards be arranged in the deck so that card number i does not occupy the i-th position for any value of i(1 :S i :S n)?

Solution. We have n properties Qi of the form: "the i-th card occupies the i-th position in the deck". The number of possible arrangements of the cards in the deck is equal to n!. The number of arrangements Nib ... , ik for which a card with number iv occupies the position iv (II = ~k), is equal to (n - k)!. This gives

So = n!, Sk = L: Nil, ... ,ik = (~)(n - k)! = ~;. l~il < ... <ik:Sn .

Using formula (1), we find that the number No of arrangements for which none of the properties Qi is satisfied, is equal to

Page 234: Problems and Exercises in Discrete Mathematics

8.2. INCLUSION AND EXCLUSION FORMULA 225

If the number of properties is not very large, such problems can be conveniently solved with the help of Euler's circles (see Fig. 8.1).

Example 2. In a group of 25 students, 20 have successfully passed their exa­minations. Out of the 12 students engaged in sports, 10 have passed their exams. How many of the unsuccessful students do not take part in sporting activities?

Solution. We represent the group of students ,--------------, who have successfully passed their examinations by a circle marked A (see Fig. 8.1), and the group of students participating in sporting activities by a circle marked B. The intersection of the circles corresponds to the group of successful students L-__________ ~

who participate in sports, while the union of the circles corresponds to the group of students who Fig.8.1 have either passed their examinations or who take part in sporting activities. The number of such students is equal to 20 + 12 - 10 = 22. The number of unsuccessful students who do not take part in sport, is equal to 25 - 22 = 3.

Venn's diagram is used for solving problems involving counting the number of elements in the set U = {aI, a2, ... , aN} having some given properties. Venn's diagram for n properties has X the form of a rectangle divided into 2n squares. Each square corresponds to one type of elements. X The type of an element is determined by whether or not the element possesses the i-th property for each i, 1 :S i :S n. Hence, it is convenient to encode the type of element (and the cell

y ~

0

0

y

0

'---y------J Z Z

Fig.8.2

corresponding to it) by a binary vector (a1, ... , an), in which aj 1 if the i-th property takes place for a given type of elements, and Qi = 0 otherwise (i = 1, ... , n).

Example 3. Let X, Y and Z be the subsets of the set U = (a1, ... , aN), satisfying the conditions

where Ji = U \ A for A E {X, Y, Z}. Find the number of such triads.

Solution. For each a E U, three properties are defined: a E X, a E Y, a E Z. Each element belongs to one of eight types depending on its affiliation to the sets X, Y, and Z. Apparently, the inclusion A ~ B is equivalent to Ann = 0. Hence, the condition X ~ (Y n Z) U Y is equivalent to X n (Y n Z) n Y = X n((Yu Z) n Y) = X n(Z n Y) = 0. The remaining two conditions are equivalent to the equalities Z n{Y n X) = 0 and Y n(.X n Z) = 0. These conditions are presented in the diagram (see Fig 8.2) as empty squares. Hence, X, Y, and Z satisfy the conditions of the problem if and only if the elements of the ,set U = {a1, ... , aN}

Page 235: Problems and Exercises in Discrete Mathematics

226 CHAPTER 8. COMBINATORICS

do not contain the elements of three types, viz. XY Z, XY Z, and XY Z. Any element in U can belong to any of the remaining five types. Hence, the number of the required triads is equal to 5n .

8.2.1. (1) Prove formula (1) by induction. (2) Let Nm be the number of objects possessing exactly m properties from among

n. Prove that • n-m k(m + k)

Nm = L (-1) Sm+k' k=O m

(3) Let Nm be the number of objects possessing no less than m properties from among n. Prove that

• n~ k (m - 1 + k) Nm = t'o (-1) m _ 1 Sm+k'

(4) Prove that

n (m -1) . Sk = ~k k _ 1 Nm •

(5) Prove that

8.2.2. Four persons deposit their hats in a cloakroom. Assuming that the hats are returned at random, find the probability that exactly k persons will get their hats back. Consider all the values of k(O ~ k ~ 4).

8.2.3. Let E(r, n, m) be the number of ways in which r different objects can be arranged in n boxes of which m are empty. Let F(r, n, m) be the number of arrangements for which at least m boxes are empty. Show that

(1)

(2)

(n) n-m (n m) E(r, n, m) = m E(-l)k ~ (n-m-k),;

(3)

( n) n-m k (n - m) r m F(r, n, m) = m E(-l) k (n-m-k) m+k'

Page 236: Problems and Exercises in Discrete Mathematics

8.2. INCLUSION AND EXCLUSION FORMULA 227

8.2.4. A survey into the reading habits of students revealed that 60% read magazine A, 50% read magazine B, 50% read magazine C, 30% read magazines A and B, 20% read magazines Band C, 40% read magazines A and C, while 10% read all three magazines. What percentage of students

( 1) do not read any magazine, (2) read exactly two magazines, (3) read at least two magazines?

8.2.5. A university department has thirteen staff members, each of whom knows at least one foreign language. Ten know English, seven German, and six French. Five know both English and German, four know English and French, and three know French and German.

(1) How many know all three languages? (2) How many know exactly two languages? (3) How many staff members know only English?

8.2.6. (1) Show that the number of positive integers that are divisible by nand that are not larger than x is equal to [x / n].

(2) Find the number of positive integers not exceeding 1000 that are not divisible by 3, 5, and 7.

(3) Find the number of positive integers not exceeding 1000 that are not divisible by 6, 10, and 15.

(4) Show that if n = 30m, the number of positive integers not exceeding nand indivisible by 6, 10, and 15 is equal to 22m.

(5) Let PI, ... , pr be all prime numbers not exceeding Vn' Show that the number of prime numbers P such that Vn < P ::::; n, is equal to n -1 + Lk=l (_I)k Sk, where the sum

Sk = L [ "1 n ,,] PI ... Pr r

is taken over all possible (~) tuples of powers aI, ... , aT) of which exactly k powers are equal to 1, while the remaining powers are equal to zero.

(6) Find the number of prime numbers not exceeding 100.

8.2.7. Let U be a set of n( n ~ 3) elements. (1) Find the number of pairs (X, Y) of subsets of the set U satisfying the

condition X n Y = 0. (2) Find the number of pairs (X, Y), such that X ~ U, Y ~ U, I(X \ Y) U(Y \

X)I = 1. (3) Find the number of triads (X, Y, Z) for which X ~ U, Y ~ U, Z ~

U, XU(ynZ) = XU? (4) Find the number of pairs (X, Y) of subsets of the set U for which Xny =

0, IXI ~ 2, WI ~ 3. (5) Find the number of pairs (X, Y) for which X ~ U, Y ~ U, I(X \ Y) U(Y \

X)I = 1, IXI 22, WI ~ 2.

Page 237: Problems and Exercises in Discrete Mathematics

228 CHAPTER 8. COMBINATORICS

(6) Find the number of triads (X, Y, Z), such that X ~ U, Y ~ U, Z ~ U, Xu(YnZ) = XUY, IXI ~ 1, WI ~ 1, IZI ~ 1.

8.2.8. Majordomo's problem. Some n pairs of feuding knights (n ~ 2) are invited to dinner. Show that there are Lk=o(-I)k(~)2k(2n - k -I)! ways of seating them at a round table, so that no two enemies sit side by side.

8.2.9. MaT'T'ied couples' problem. In how many different ways can n married couples be seated around a round table so that men and women occupy alternate positions, and none of the couples is seated side by side?

8.3 Recurrences and Generating Functions

The sequence ao, aI, ... , an, ... is called reCUT'T'ent if, for a certain k and all n, a relation of the following type is satisfied:

(1)

where the coefficients Pi, i = 1, k are independent of n. The polynomial

P(x) = Xk + PlXk- l + ... + Pk (2)

is a characteristic polynomial for recurrent sequences {an}.

8.3.1. (1) Prove that a recurrent sequence can be completely defined by specifying its first k terms and the relation (1).

(2) Let A, be the root of a characteristic polynomial. Prove that the sequence p n} satisfies the relation (1).

(3) Prove that if At, ... , Ak are prime (not multiple) roots of the characteristic polynomial (2), the general solution of the recurrence relation (1) has the form

(4) Let Ai be a root of multiplicity ri(i = 0) of the characteristic polynomial (2). Prove that in this case, the general solution of the recurrence relation (1) has the form

s

an = ~)Cil + Ci2 n + ... + Cir,nr.-l)A?, i=l

where Cij{i = 0, j = 1, I;) are arbitrary constants.

8.3.2. Find the general solutions of the following recurrence relations: (1) an+2 - 4an +l + 3an = 0; (2) an+2 + 3an = 0; (3) an+2 - an+l - an = 0; (4) an+2 + 2an+l + an = 0; (5) an+3 + lOan+2 + 32an+1 + 32an = 0;

Page 238: Problems and Exercises in Discrete Mathematics

8.3. RECURRENCES AND GENERATING FUNCTIONS

8.3.3. Find an from the following recurrence relations and initial conditions: (1) an+2 - 4an+! + 3an = 0, al = 10, a2 = 16; (2) an+3 - 3an+2 + an+l - 3an = 0, al = 3, a2 = 7, a3 = 27; (3) an+3 - 3an+! + 2an = 0, al = a, a2 = b, a3 = c; (4) an+2 - 2cosaan+! + an = 0, al = cos a, a2 = cos 2a; (5) an+2 - an = 0, al = 2, a2 = 0; (6) an+2 - 6an+! + 9an = 0, al = 6, a2 = 27.

8.3.4. Show that

229

(1) if x = 1 is not a root of the polynomial x 2 + px + q, the partial solution of the recurrence relation

(3)

where a, /3, p, q are given numbers, is the sequence a~ = an + b; find a and b; (2) if x = 1 is a simple root of the polynomial x 2 + px + q, the partial solution

can be obtained in the form a~ = n(an + b); find the values of a and b; (3) if x = 1 is a multiple root of the polynomial x 2 + px + q, the partial solution

may be obtained in the form a~ = n2(an + b); find a and b; (4) in each of the above cases, find the general solution of the relation (3).

8.3.5. Solve the following recurrence relations: (1) an+! - an = n, al = 1;

(2) an+2 + 2an+! - 8an = 27 X 5n, al = -9, a2 = 45;

(3) an+2 - 2an+! + 2an = 2n, ao = 1, al = 2;

(4) an+2 + an+l - 2an = n, ao = 1, al = -2;

(5) an+2 - 4an+! + 4an = 2n, ao = 1, al = 2;

(6) an+2 + an+! - 6an = 5 X 2n+!, ao = 2, al = 1.

8.3.6. (1) Let {an} and ibn} be two sequences whose terms are connected through the relations

an+l = PI an + ql bn, bn+1 = P2 an + q2 bn, .0. = PI q2 - P2ql of: 0,

where PI, ql, P2, q2 are given numbers. Find the expressions for an and bn, assuming al and b1 to be given.

(2) Find the solution of the following system of recurrence relations:

Page 239: Problems and Exercises in Discrete Mathematics

230 CHAPTER 8. COMBINATORICS

(3) Find the general solution for the following system of recurrence relations:

an+l = b + 5, bn+l = -an + 3.

8.3.7. Fibonacci's sequence {Fn} is defined by the recurrence relation FnH = Fn+l + Fn and by the initial conditions FI = F2 = 1. Prove that

(1) Fn+m = Fn-IFm + FnFm+1 for any natural numbers nand m;

(2) the number Fn is divisible by Fm for any m and n = km;

(3) two adjacent numbers Fn and Fn+l are mutually prime;

(4) any natural number N(N > 1) may be uniquely presented as a sum of Fibonacci's numbers, such that each number enters the sum not more than once and no two adjacent numbers enter together;

(5) Fn = ,Is [(¥f - e-{'Sfl; (6) FI + F3 + ... + F2n+l = F2n+2;

(7) 1 + F2 + F4 + ... + F2n = F2n+l;

(8) F~+l + F~ - F~_l = F3n .

Each sequence ao, aI, ... , an, ... can be associated with a series A(t) = ao + alt + ... + antn + ... called a generating function for the sequence {an}. The exponential generating function for {an} is the series E(t) = aO+al (t)+ . .. +!!nf.+ .... n. The operations of addition, multiplication, and multiplication by a constant can be defined for generating functions by treating them as formal series. Let A(t) and B(t) be the generating functions for the sequences {an} and {bn } respectively, and let a and j3 be constants. In this case,

aA(t) + j3B(t) = aao + j3bo + (aal + j3bl )t + ... + (aan + j3bn)tn + ... ,

A(t)B(t) = aobo + (aObl + albo)t + ... + (aobn + albn- l + ... + anboW + .... If Ea(t) and Eb(t) are exponential generating function for the sequences {an}

and {bn } respectively, the operations of addition and multiplication by a constant are defined in the same way as for normal generating function, while their product is defined as

cntn Ea(t)Eb(t) = Co + CIt + .. , + -, + ... ,

n.

where Cn = aobn + (~)albn-l + ... + (~)akbn-k + ... + anbo.

8.3.8. Find the generating function f(t) for the sequence {an}, if

(1) an = 1 for all n :?: 0;

(2) an = 1 for 0 ~ n ~ N and an = 0 for n > N;

(3) an = an;

(4) an = an In!; (5) an = (_l)n;

Page 240: Problems and Exercises in Discrete Mathematics

8.3. RECURRENCES AND GENERATING FUNCTIONS 231

(6) an = n;

(7) an = n(n - 1);

(8) an = (:), m is a natural number;

(9) an = (~), a is a real number;

(10) an = n2 ;

(11) an = sin an;

(12) an = cos an.

8.3.9. Find the exponential generating functions E(t) for the sequence {an}, if

(1) an = 1;

(2) an = an;

(3) an = n;

(4) an = n(n - 1);

(5) an = (m)n;

(6) an = n 2 •

8.3.10. Using the identities connecting the generating functions, derive the following identities for binomial coefficients:

(1) (1 + t)n(1 + tr = (1 + t)n+m;

(2) (1 - t)-l-n(l - tt1- m = (1 - tt2- n- m;

[~l ( n ) (n + 3 - 1) = (n + k - 1) ; 5=0 k - 23 3 k

Page 241: Problems and Exercises in Discrete Mathematics

232 CHAPTER 8. COMBINATORICS

k is even, k is odd.

8.3.11. Find the general term an in the sequence for which the function A(t) is a generating function.

(1) A(t) = (q + pt)m; (2) A(t) = (1 - ttl;

(3) A(t) = J[=t; (4) A(t) = tm(l - tr; (5) A(t) = (t + t2 + ... + t')m;

(6) A(t) = (1 + %rm;

(7) A(t) = (1 + 2t)-1/2 (1 - ~rm; (8) A(t) = t2 (1 - t)(l + 2ttm; (9) A( t) = In(l + t); (10) A(t) = arctan t; (11) A(t) = arcsint;

(12) A(t) = e-2t2 ;

t 2

(13) A(t) = J e- X dx; o

(14) A(t) = (-t/(l + t)t.

8.3.12. Derive the following identities2:

(1) L(-l)n-s(:) (:t:) = (n:l); s

(2) E(-1)S(7) (2':'S) = (_l)n(:); s

(3) L(-l)s(m_n,:+s)(n~s) = (m-;-l); s

(4) L(2:)(2m~2s) = (;:) + (_l)m(:); s

(5) L (n~2s) (n+2m;2s+l) = eni:~+2); s

(6) L(-1)n-s4s(n+2ss+l) =n+1. s

8.3.13. Let A(t) and E(t) be the generating and exponential generating func­tions of the sequence {an}, respectively.

00

(1) Using the equality n! = J e-xxndx, show that o

A(t) = 100 e-X E(xt)dx.

2Summation is carried out over all s for which these expressions are meaningful.

(4)

Page 242: Problems and Exercises in Discrete Mathematics

8.3. RECURRENCES AND GENERATING FUNCTIONS 233

(2) Verify that formula (4) is valid for the generating functions A(t) = (1- ttl and E(t) = et of the sequence ao = al = a2 = ... = 1.

(3) The same, for a sequence with a general term

{ 0, n < j, an = (n)j, n::::: j.

8.3.14. (1) Let (a)n = a(a - 1) ... (a - n + 1). With the help of exponential generating functions, prove that

Hint. Use the identity (1 + t)a+b = (1 + W(1 + t)b. (2) Let (a)n,h = a(a - h) ... (a - h(n - 1)). Prove that

(a + b)n,h = E (~)(a)n-k'h(bh.h' 8.3.15. Let {an} and {bn} be sequences, and let A(t) and B( t) be their respective

generating functions. Prove that if

(1) an = bn - bn- l , then A(t) = B(t)(1 - t);

(2) an = bn+l - bn , then A(t) = B(t) ((1 - t) - bo) t-l;

(3) an = bn+l + bn+2 + ... , then A(t) = (B(1) - B(t))j(1 - t);

(4) an = nbn, then A(t) = tftB(t);

(5) an = n2bn, then A(t) = tft (tftB(t));

(6) we define the operation Sk(k ::::: 0) on the sequence {bn} with the help of the relation

Sk(bn)+ G)bn - l +"'+ C+~-1)bn-j+",+ (k+:-1)bo

and we put an = Sk(bn), then A(t) = (1 - ttk B(t);

(7) an = b2n , then A(t) = HB(t l/2) + B(_tl/2));

(8) an = bo + bl + ... + bn- l , ao = 0, then A(t) = B(t)t(1- ttl.

8.3.16. Let A(t) and B(t) be the generating functions of the sequences {an} and {bn}, respectively, and let A(t)B(t) = 1. Find {bn} and B(t) from the given sequence {an} if

(1) an = (':); (2) an = an; (3) an = n + 1;

(4) ao = a2 = 1, an = ° for n # 0, 2;

(5) an = (_1)n; (6) an = (-1)ne:)4-n.

Page 243: Problems and Exercises in Discrete Mathematics

234 CHAPTER 8. COMBINATORICS

8.3.17. Suppose that the sequence {an} satisfies the recurrence relation an+2 + pan+1 + qan = O.

(1) Prove that A(t) = (ao + (aI + pao)t) / (1 + pt + qt2). (2) Let 1 + pt + qt2 = (1 - AIt)(l - A2t), Al =f A2. Prove that

( ) A~ - A~ A~+1 - A~+1 an = aI + pao \ \ + ao \ \

Al - A2 Al - A2

(3) Write an expression for an for the case when

8.3.18. Let

n (n + j) n-I (n + j) an = L 2' ,bn = L 2' l' n = 0, 1, 2, ... ,

)=0 J )=0 J +

and let A(t) and B(t) be the corresponding generating functions. (1) Prove that an and bn are connected through relations of the type

bn+1 = an + bn, ao = 1, bo = O.

(2) Prove that A(t) and B(t) satisfy the system of equations

A(t) -1 = tA(t) + B(t), B(t) = tA(t) + tB(t).

(3) Find A(t) and B(t). ( 4) Show that

( 2)n 1 + y's (2)n 1 lim -- a' --- lim -- b-­n-+oo 3 + y's n - 2y's 'n-+oo 3 + y's n - y's'

8.3.19. Suppose that the terms of the sequence {an} satisfy the relation

00

(1) Prove that the generating function A(t) = L antn satisfies the equality n=O

tA2(t) = A(t) -aD or, if the initial conditions are taken into account, A(t) = I-~!-4t.

(2) Expanding A(t) into a power series in t, show that an = n~I e:). (3) Find the sequence {an} whose terms satisfy the relations

Page 244: Problems and Exercises in Discrete Mathematics

8.3. RECURRENCES AND GENERATING FUNCTIONS 235

8.3.20. Derive a recurrence relation for the sequence {an} and solve this relation if

(1) an is the number of ways in which a convex (n + 2)-gon can be divided into triangles by diagonals that do not intersect within this polygon.

(2) an is the number of ways in which parentheses can be arranged in the expression bl : b2 : ... : bn+h so that the resulting expressions are meaningful.

8.3.21. Using the method of mathematical induction, find the sequence {an} from the following recurrence relations and initial conditions:

(1) an+! ::::: (n + l)an, ao::::: 1;

(2) nan+1 + an::::: 0, al::::: 1;

(3) (n + 2)(n + 1)an+2 ::::: n2an, ao::::: 0, al ::::: 1;

(4) (n + 2)2an+2 + an::::: 0, ao::::: 1, al::::: 0;

(5) n2an+2 + (n + 2)2an ::::: 0, al::::: 1, a2::::: 0;

(6) a~+1 - anan+2 ::::: ( -1 )n-I, ao::::: 1, al ::::: 1.

8.3.22. Let An(t) ::::: L~oa(n, k)tk be an arbitrary function for a sequence satisfying the relation

a(n, k) ::::: a(n, k - 1) + a(n - 1, k)

with initial conditions a(n, 0) ::::: 1, a(O, k) ::::: 0 for k > O. Show that

(1) (1 - t)An(t) ::::: An-I(t);

(2) An(t) ::::: (1 - ttn;

(3) a(n, k) ::::: (n+Z-I).

8.3.23. (1) In how many ways can a 10-copeck coin be changed into 1, 2, 3 and 5-copeck coins?

(2) The same, but each coin must have a duplicate. (3) The same problem under the condition that the change is to be made from

four l-copeck coins, three 2-copeck coins, two 3-copeck coins, and one 5-copeck coin.

8.3.24. Find the generating function A(t) for the sequence {an}, where

(1) an is the number of solutions in nonnegative integers for the equation

2x + 3y + 5z ::::: n.

(2) an is the number of solutions of the same equation, given that x, y, z assume values in the set {O, I}.

(3) an is the number of integral solutions of the same equation, given that 0 :S x :S p, 0 ::; y ::; r, 0 ::; z :S s.

8.3.25*. Find the value of an using a given generating function A(t) for the sequence {an}:

00

(1) A(t)::::: TI (1 - qkt), Iql < 1. k=1

Page 245: Problems and Exercises in Discrete Mathematics

236 CHAPTER 8. COMBINATORICS

Hint. Show that A(t) = (1- qt)A(qt), and compare the coefficients of tn on the left- and right-hand sides of this equation.

(2) A(t) = fi (1 + qt2k ). k=O

Hint. Prove that an = l", where bn is the number of unities in the binary expansion of the number n.

8.3.26. Let

Prove that

(1) S(n + 1, k, I) = S(n, k, 1+ 1) - S(n, k, I);

(2) S(n, k, 1+ 1) = S(n, k, I) - S(n + 1, k, I);

(3) S(n, k + 1, I) = (n + I)S(n, k, I) + nS(n - 1, k, I); (4) S(n, k, I) = 0 for n > k;

(5) S(n, n, I) = n!;

(6) S(n, k, I) > 0 for n ::; k;

(7) S(n, k, I) is an increasing function of parameters k and 1 for n ::; k; n

(8) S(n, n + 1, I) = E (k + l)k!; k=O

(9) S(1, k, 0) = 1 for 1 ::; k.

8.3.27. Let

00

and 17n (t) = L S(n, k)t k •

Prove that for It I < 1

(1)

(2)

n!tn 0' (t)- .

n - (1 - t)(1 - 2t) ... (1 - nt)'

8.4 Polya's Theory

k=O

The permutation on a set Zn = {1, 2, ... , n} is the mapping of Zn onto itself3. The permutation 7r = (.1,2, ... , n) will be frequently specified by the line

'1, "2, ... , In

3 Any set of n elements can be taken as Zn.

Page 246: Problems and Exercises in Discrete Mathematics

8.4. POLYA '5 THEORY 237

(iI, i2 , .•• , in). A permutation is called cyclic (or a cycle) if a certain number h is substituted for h, j2 for h, and so on, jk-l is substituted for jk, and jk for jl, while all the other numbers remain unchanged. Such a cycle is denoted by (jl, j2, ... , jk)' The number k is called the length oj the cycle. Any permutation

can be presented as a product of cycles. For example, G:~:!:!:D = (1,2)(3,4,5). A cycle of length 2 is called a transposition. The permutations on the set Zn form a group relative to the multiplication operation. The multiplication operation of the permutations 7fl and 7f2 involves their successive application. For example, if

_ (1,2,3,4) _ (1,2,3,4) th _ (1,2,3,4) It b '1 'fi d th t 7fl - 2,4,3,1 ' 7f2 - 1,4,3,2' en 7f17f2 - 4,2,3,1' can e easl y ven e a the multiplication operation is associative: 7f( aT) = (7fa)T .The unit element of a

. h'd't t' (1 2 n) Th " ( 1 2 n ) group IS tel entJ y permuta IOn 1: 2: :::: n' e permutatIOn mverse to i l : i;, ..... .', in

is given by (i\', i;: ...... : ~n ). The permutation group on the set Zn is called a symmetry group oj n-th degree and is denoted by Sn. The order of a symmetry group of n-th degree (the number of its elements) is equal to n!.

If the permutation on a set Zn is represented as a product of b1 cycles of length 1, b2 cycles of length 2, and so on, and bn cycles of length n, the permutation is said to be oj the type (b1 , b2 , ..• , bn). For example, the permutation G:;:!:~) is of the type (1, 0,1,0). If G is a subgroup of the group Sn, the polynomial

PG = PG (t1 ... tn) = IGI-1 L t~1 ... t~n, 7rEG

where (b1 , .•. , bn) is the type of permutation 7f, is called the cyclic index oj the group G. Let G be a group of permutations on Zn. The elements a and bin Zn are called G-equivalent (notation a rv b) if there exists a permutation 7f E G such that 7fa = b (or, which is the same, 7fb = a). The classes of G-equivalence are called transitive sets or orbits.

Bernside's Lemma. The number oj orbits v(G) in the set Zn, defined by the group G, is given by the equality

v(G) = IGI-1 L b1(7f). 7rEG

Let M and N be finite sets, and let G and H be the permutation groups of M and N. The power group HG consists of all possible pairs (7f; a), where 7f E G, a E H, and acts on the set N M of all functions f: M -+ N. Moreover, by definition, (7f; a)f(x) = af(7f(x)) for all x E M and f E NM. Suppose that a weight function w: N -+ {O, 1, ... } is defined on the set N, and that qn is the number of elements

(X)

having a weight n in N. The generating function Q(t) = L qntn is called a figure n=O

counting series. The weight of the function f in N M is determined from the equality w(t) = L w(f(x)). The functions Jl and 12 in N M are called equivalent (notation

xEM it rv h) if there exists an element 7f E G, such that fl(7fX) = 12(x) for all x E M. If 11 and h are equivalent, they have the same weight. Hence we can determine

Page 247: Problems and Exercises in Discrete Mathematics

238 CHAPTER 8. COMBINATORICS

the weight w(F) of the equivalence class F as the weight of any element fin F. Let <Pk be the number of equivalent classes of weight k in N M . The generating function

00

<I>(t) = L <Pktk is called a function counting series. k=O

Polya's Theorem.

<I>(t) = Pc(Q(t), Q(e), ... , QW)),

where n = IGI, Pc(tl, t2 , ... , tn) is the cyclic index of group G, and Q(t k ) IS

substituted into Pc in the place of variable tk, k = 1, 2, ... , n.

8.4.1. Find the type of permutation 7r:

(1) 7r = (2, 3, 4,1); (3) 7r = (3, 4, 5, 6, 1,2); (2) 7r = (4, 2, 3, 1); (4) 7r = (8, 2,1,7,4,6,3,5).

8.4.2. Represent the permutations in Problem 8.4.1 in the form of a product of transpositions.

8.4.3. Find the cyclic index of the group G, where (1) G is a group of permutations of the vertices of a square, which are obtained

by rotating the square in a plane; (2) G is a group of permutations of the vertices of a square, which are obtained

by rotating the square in space; (3) G is a group of permutations of the vertices of a tetrahedron, which are

obtained by rotating it; (4) G is a group of permutations of the edges of a tetrahedron, which are obtained

by rotating it; (5) G is a group of permutations of the faces of a tetrahedron, which are obtained

by rotating it; (6) G = 53; (7) G = A4, where A4 is an alternating group of power 4, i.e. a subgroup of

group 54, formed by permutations representable as products of an even number of transpositions;

(8) G is a group of permutations of the faces of a cube, which are obtained as a result of rotation; and

(9) G is a group of permutations of the vertices of an octahedron.

8.4.4. (1) Prove that the group G, defined in Problem 8.4.3(1), specifies one orbit on the set N 4 •

(2) Find the number of orbits in the set N4 , which are defined by the group G and formed by the permutations 7ri = (1, 2, 3, 4), 7r2 = (1, 2, 4, 3), 7r3 = (2, 1, 3, 4) and 7r4 = (2, 1, 4, 3).

8.4.5. Prove Bernside's lemma.

8.4.6. Let b = (bi , b2 , .•• , bn ) be a vector corresponding to the decomposition of the number n, i.e. bi + 2b2 + ... + nbn = n, where bk are non-negative integers (1 s:; k s:; n). We denote by H(b) the set of all permutations of the symmetry group 5n , whose type coincides with b, and let h(b) = IH(b)l. Prove that

Page 248: Problems and Exercises in Discrete Mathematics

8.4. POLYA'S THEORY 239

~ n (1) h(b) = n!( TI kbkbk!tl;

k=l _ 1 ~ n bk.

(2) PSJtl' t2, ... , tn) - I L h(b) TI tk , n. b k=l

(3) the cyclic index PSn is equal to the coefficient of xn in the expansion of the function

exp(tlx + hx2/2 + ... + tkxk /k + ... ) into a power series in x.

8.4.7. Let An be an alternating group of power n, i.e. a subgroup of the group Sn, consisting of all its permutations, which can be represented as a product of an even number of transpositions. Prove that

PAn (t1, ... , tn) = PSn(t1 , ... , tn) + PSn(tl, -t2' ... , (-lttn)'

8.4.8. Let G be a group of permutations of the set X, and H a group of permutations of the set Y, X n Y = 0. Any pair of permutations 7r E G, a E H is put in correspondence with the permutation 7r x a of the set XU Y, defined as Z -+ 7rZ for Z E X, Z -+ X, Z -+ az for z E Y. Prove that

(1) the permutations 7r X a form a group of the order IGI IHI. This group is called the direct product of the groups G and H, and is denoted by G x H;

(2) if the permutations 7r E G and a E H, are of the type (bl, ... , bn ) and (el' ... , en), then n x a is of the type (b1 + el, ... , bn + en);

(3) PGxH = PG X PH.

8.4.9. (1) Find the number of necklaces that can be made from beads of two colours, if each necklace contains seven beads. If one necklace can be obtained from the other by turning it, the two are assumed to be identical (mirror reflections are not allowed).

(2) Using Polya's theorem, find the number of necklaces from beads of k colours, if each necklace consists of n beads. The necklaces are considered to be identical if they can be obtained from one another by rotation (without reflection).

8.4.10. (1) Find the number of different colourings of a tetrahedron vertices in two colours. Two colourings are assumed to be different if the colours of the vertices cannot be made to coincide through a rotation of the tetrahedron.

(2) Find the number of different colourings of the vertices of a tetrahedron using three colours.

(3) Find the number of different colourings of the faces of a cube, such that three faces are painted in red, two in blue and one in white.

8.4.11. Let G be a group of permutations of the set Zn and E be a unit group acting on the set N and transforming each element x E N into itself. Find the number of orbits defined by the power group EG on the set NZn.

8.4.12. (1) Let Tk , be the number of pairwise non-isomorphic rooted trees, and 00

let T(x) = L Tkxk be the generating function for the sequence {Td. Prove that k=l

00

T(x) = x + x L Psn(T(x), ... , T(xn)). n=l

Page 249: Problems and Exercises in Discrete Mathematics

240 CHAPTER 8. COMBINATORICS

(2) Prove the validity of the following recurrence relation:

8.4.13. Let gn be the number of pairwise non-isomorphic graphs with n vertices, and let In be the number of pairwise non-isomorphic connected graphs with n vertices. Let

00 00

n=l n=l

be the corresponding generating functions. Prove that

00

g(t) = L GSn (l(t), ... , lW))· n=l

8.4.14. Let p(n, k) be the number of permutations of the group Sn, which 00

consist of k cycles, and let Pn(t) = L p(n, k)tk be the corresponding generating n=O

function. Prove that n-l

(1) Pn(t) = n (t + i); i=O

(2) p(n, k) = p(n - 1, k - 1) + (n - l)p(n - 1, k).

8.5 Asymptotics and Inequalities

The following notation will be used while estimating the growth of functions. The notation cp(x) = O(1,b(x)), for x E X, means that there exists a constant C such that Icp(x)1 S CI1,b(x)l, for x E X. If cp(x) = O(1,b(x)) and 1,b(x) = O(cp(x)), for x E X, we can write cp( x) ~ 1,b( x) for x EX. The notation cp( x) = O( 1,b( x)) for x -t a means that limx-+a ~ = O. The functions cp( x) and 1,b( x) are said to be asymptotically equal (notation cp(x) rv 1,b(x)) for x -t a, if cp(x) = 1,b(x) + O(1,b(x)) for x -t a. For different types of estimates, it is convenient to use Stirling's formula

(1)

For more accurate estimates, the following inequalities are used

J27rnnn exp (-n + _1 ___ 1_) < n! < J27rnnn exp (-n + _1_) . (2) 12n 360n3 12n

8.5.1. Prove the following inequalities:4

(1) nn/2 < n! < (nt1f for n > 2;

4The symbol (2n - 1)!! is used to denote the number 1 x 3 x 5 x ... x (2n - 1), while (2n)!! = 2 x 4 x 6 x ... x (2n).

Page 250: Problems and Exercises in Discrete Mathematics

8.5. ASYMPTOTICS AND INEQUALITIES

(2) (2n)! < [n(n + lW;

(3) (1 + ~r < 3;

(4) (~r < n!;

(5) (n!)2 < (n(n2+1)r, n> 1;

n(n+l)

(6) 1 x 22 X 33 X ..• X nn ::; enp) 2 ;

(7) ((2n - I)!!) /(2n)!! < 1/( J3n + 1); (8) (2n - I)!! < n n, n > 1;

(9) n! > e-nnn.

(10) (1 + o:)n ~ 1 + o:n, 0: ~ -1;

(11) (n + 2/n + l)n+1 > (n + l/n)n.

8.5.2. Prove the following inequalities: (1)

( n - k) k (n) (3n) k 2 k + 1 < k < k ,n > k > 1;

(2)

( n)k (n) nn k < k < kk(n _ k)n-k' n> k > 0;

(3)

4n (2n) 4n r,;;: < ::;~, n > l.

2vn n v3n + 1

241

8.5.3. Using Stirling's formula, show that for n --t 00, the following asymptotic equalities are valid:

(1)

(2)

(3)

rv --4 . ( 2n) 1 n

n ,fiffi'

n! 3V33n

([~]!r (n _ 2 [~])! rv ~-;; (4) for integral nonnegative k and m

(m+l)(m+2) ... (m+n) k! m-k ":""-_~_--:-'-----,":""-_:c'- rv -n . (k+l)(k+2) ... (k+m) m! '

Page 251: Problems and Exercises in Discrete Mathematics

242 CHAPTER 8. COMBINATORICS

(5) (2n)!! (if'

(2n - 1)!! ~ V 'in.

8.5.4. Prove that for n -t 00, the following asymptotic equalities are valid:

(1)

(2)

(3)

(4)

(5)

n 1 (n) 2n+1 l:- ~-' k=l k + 1 k n'

~ (, : kV) ~ ~2n, 0 :s r < k;

"" ( n ) al+kll ~ ~(1 + a)n 0 < r < k a > O' L;: r + kv k ,- , ,

n (_1)k-1 (n) l: k k ~ Inn; k=l

t k(n)2 ~ ~ fi4n. k=l k 2 V-;

8.5.5. Let bo, b1 , ... , bn be such numbers that 0 < ak :s bk :s ck < 1. Are the following inequalities valid?

(1) (1 + at :s Lk=O (~)bk :s (1 + c)n;

(2) (1- c)n:s Lk=O(-1)k(~)bk:S: (1- a)n.

8.5.6. (1) Prove the Chebyshev inequality in the following form. Let A = {aI, a2, ... , an} be a set of numbers, and

1 n a--""a' - L..i~'

n ;=1

1 n

Da=-l:(ai-at n i=l

Then the fraction 8t of those ai for which lai - al 2 t, does not exceed Da/t2.

(2) Using Chebyshev's inequality, prove that

(3) Prove that

n 1 (n) 2n+1 l:- ~-. k=l k k n

Page 252: Problems and Exercises in Discrete Mathematics

8.5. ASYMPTOTICS AND INEQUALITIES 243

8.5.7. Using Stirling's formula, show that

(1) if k ~ 00 and k - ~ = o(n3/ 4 ) for n ~ 00, then

(2*) if a> 0, k ~ 00 and k - aa;1 = 0(n2/ 3 ) for n ~ 00, then

( n) k (1+a)n+1 _(k(at 1)-anf ( 0(1 (k(a+1)-anP)) a = e 2an 1 + - + .

k J27rna n n2 '

(3*) if a> 0, k < m, k ~ 00 and k, m = aa;l + 0(n2/ 3 ) as n ~ 00, then

(4*) if a> 0, k ~ 00 and k - aa;l = 0(n2/ 3 ) as n ~ 00, then

. A-An -p.n 8.5.8. Let ° < A < 1, An be an mteger, If = 1 - A, and let G(n, A) = ~.

2rr>'lJ-n

Using formulas (1) and (2), show that (1)

(2)

(3)

(4) if A > ~, then

(5) iffor A > ~, n ~ 3, then

8.5.9. Let k and n be natural numbers (k < n). Show that

Page 253: Problems and Exercises in Discrete Mathematics

244 CHAPTER 8.

(1)

(nh = nkexp (-~ v~V ~iV); (2) iffor n -? 00 k = 0 (fo), then (nh rv nk;

(3) if k = o(n) as n -? 00, then for any m > 1

(4) for n -? 00 and k = 0(n3/4 )

(nh = nkexp -- - - +0(1) ; ( p p ) 2n 6n2

COMBINATORICS

(5) if n~m -? t, n~m -? p, n:;m -? q and h x (k - rp) -? x for m + n -? 00, then

8.5.10. (1) Let k = k(n) and s = s(n) be such that for n -? 00 S = o( Vk). Show that

(2) Show that if s = 0 (kr~l), then

(n-s)j(n) (k)S ( r sv+l (1 1)) k - s k rv n exp -?; v(v + 1) kv - nV .

8.5.11. Let s = s(n) and k = k(n) be nonnegative integral functions of a natural argument. Show that

(1) if s + k = o(n) for n -? 00, then

(n~s) (Sk s2k+sk2 00 1 (k)V 00 1 (S)V ) -- = exp - - - - s L - - - k L - + o( 1) ;

(~) n 2n2 v=3v n v=3v(v-l) n

(2) if S2 + P = o(n) for n -? 00, then

Page 254: Problems and Exercises in Discrete Mathematics

B.5. ASYMPTOTICS AND INEQUALITIES 245

(3) if n > k + s, then

( sk (k sn)) (n-s) (n) ( Sk) exp - -:; 1 + n _ k + 2( n _ k)( n _ k _ s) < k / k < exp - -:; .

8.5.12. Let f(x) be a continuous, monotonically increasing function on the segment tn, m]. Show that

f(n) ~ f f(k) -1m f(x)dx ~ f(m). k=n n

8.5.13. Using the previous problem, show that for n > 1 and m -t 00, the following relations are valid:

(1) m

LIn k "" mIn m - m + O(1n m)j k=l

(2)

(3) m 1 ( 1 ) L kl k 11k =lnlnlnm+c+O 1 11 ' k=2 n x n n m n m n n m

where c is a constantj (4)

~ logk 11 2 0 (lOgm) ~ -- = - og m + c + --, k=l k 2 m

where c is a. constant; (.5 )

m 1 1 (1) ---c+-+O E kln2 k - lnm mln2 m'

where c is a consta.ntj (6)

ml 1 (1 1) (1 1) ---- ---- +0 ---L kv - /J - 1 nv- 1 m v - 1 nV mV . k=n

8.5.14. The sequence {Pn} is defined by the recurrence relation

Pn=Pn-l-o.P~_l' Po=l, 0<0.<1, (3)1.

Show that

( 1) 0 < Pn < 1, n 2:: 1;

Page 255: Problems and Exercises in Discrete Mathematics

246 CHAPTER 8. COMBINATORICS

(2) Pn decrease monotonically with increasing n;

(3*) 1

Pn f'V (Q({3 - l)n) 1-,8

as n -t 00.

Hint. Use the inequalities

8.5.15. (1) Show that the solution of the equation xeX = t has the form

Inlnt ((lnlnt)2) x = lnt -lnlnt+ ~ +0 ~ , t -t 00.

(2) Prove that the solution of the equation eX + In x = t for t -t 00 has the form

x- nt---+ -- . -1 Inlnt 0 ((lnlnt)2) t t

8.5.16. Let f(t) > 0 and etJ(t) = f(t) + t + 0(1) for 0 < t < 00. Show that

In t f(t) = -t + 0(t-2), t -t 00.

8.5.17. Suppose that the generating function A(t) of the sequence {an} has the form A(t) = Q(t)/P(t), where Q(t) and P(t) are polynomials with real coefficients. Let Al be the smallest (in magnitude) root of the polynomial P(t). Prove that:

(1) if Al is a simple (not multiple) real root, then for n -t 00

(2) if Al is a real root of multiplicity r, then for n -t 00

where r(At} is a derivative of P(t) of the order r at the point t = AI'

8.5.18. Let A(t) be the generating function of the sequence {an}. Find the asymptotic behavior of an for n -t 00:

(1) A(t) = (1 + t)/(3t2 - 4t + 1); (2) A(t) = 1/(6t2 + 5t - 6);

(3) A(t) = (12t3 + lOt2)/(6t2 + 5t - 6);

Page 256: Problems and Exercises in Discrete Mathematics

8.5. A SYMP TO TICS AND INEQUALITIES

(4) A(t) = 1/(4t2 + 1);

(5) A(t) = 2t3/(6t4 - 17t3 + 35t2 - 22t + 4);

(6) A(t) = (1 - 3t)/(8t3 -1)(t2 + 1);

(7) A(t) = 1/(t2 + 2t - 2?;

(8) A(t) = (t3 - 1)/(2t2 + 1)(t2 + 1.4t + 0.49).

247

8.5.19. Find the asymptotic behavior of an for n ---t 00 from the following recurrence relations and the corresponding initial conditions:

(1) an+2 + 3an+! + 2an = 0, ao = 1, al = 2;

(2) an = qan-l + p(l - an-d, ao = 1, p + q = 1, p, q > 0;

(3) an+2 + 2an+! + 4an = 0, ao = 0, al = 2;

(4) an+3 - 9an+2 + 26an+l - 24an = 0, ao = al = 1, a2 = -3;

(5) an+4 - 4an+2 + ran = 2n, ao = 1, al = 0, a2 = 2, a3 = 0.

8.5.20'. Find the limit of the sequence {an}, given by the recurrence relations

(1) an+l = (an + b/an)/2, b > 0, ao > 0.

(2) an+l = (2an + b/a~)/3, b> 0, ao > 0.

(3) an+l = (b - a~), 0< b < 1, ao = b/2.

8.5.21. Suppose that an satisfies the relations

an+2 :::; 2-n- 3 + (n + 1)4-n- 3 + an ( G) n+2 + (n + 2)2n+2 + 4an) , (4)

al = 0, a2 = 1/16. Show that

(1) an ~ 1/8;

(2) an ~ 9(3/4)n;

(3) an = 2-n - 1 (1 + O((3/4)n)).

8.5.22. Suppose that the sequence {an} satisfies the condition an+m :::; an + am, al > 0. Prove that an < aln for n 2: 1.

8.5.23. Let k and n be integers. Calculate k = k(n) to the nearest integer, for which the function f(n, k) assumes the maximum value:

(1) f(n, k) = (~)2-2k;

(2) f(n, k) = (~)2n-k-2k(1_ 2-2k )n-k.

Page 257: Problems and Exercises in Discrete Mathematics

248 CHAPTER 8. COMBINATORICS

8.5.24. Find the minimum and maximum values of the expression

as a function of r(O ~ r ~ k ~ nj r, k, n are integers).

8.5.25. Let k is an integer and n -+ 00. Find the asymptotic behaviour of the quantity g( n) = miIlo$;k$;n f( n, k) if:

(1) f(n, k) = 2n- k + 22kj

(2) f(n, k) = k2k + t22n-k.

8.6 Estimates in Graph Theory

A graph (digraph, pseudograph, etc.) is called labelled (or numbered) if some labels are assigned to its vertices. By Yn we shall denote the set of all n-vertex graphs (in short n-graphs) whose vertices are labelled by numbers 1, 2, ... , n. The subset of all graphs from Yn, each of which has exactly m edges, will be denoted by Yn, m' A graph with n vertices and m edges, will be briefly called an (n, m)-graph. Graphs G and H in Yn are assumed to be different if there exist two vertices j and k that are adjacent in one graph but not in the other.

Let 'Pn (P) denote the number of graphs in Yn having the property P. It is said that almost all n-graphs have the property P if limn ..... co 'Pn (P)/IYnl = 1. Let m = m (n) be an integral nonnegative function, and let 'Pn m (P) be the number of all graphs in Ynm having the property P. It is said that almost all the (n, m(n))­graphs have the property P if limn ..... co 'Pn,m(P)/IYn,ml = 1.

8.6.1. Prove that (1)

(2)

8.6.2. (1) Find the number of different tournaments with n vertices, labelled by 1,2, ... , n.

(2) Find the number of oriented pseudographs with n labelled vertices and m arcs.

8.6.3. (1) Show that the number of graphs in Yn, whose k given vertices are isolated, is equal to 2(n2'k).

(2) Show that the number of graphs without isolated vertices in Yn is equal to

Page 258: Problems and Exercises in Discrete Mathematics

8.6. ESTIMATES IN GRAPHS 249

(3) Show that almost all n-graphs have no isolated vertices.

8.6.4. Let the subset Y C Yn consist of N pairwise different graphs. Show that the number of pairwise nonisomorphic graphs in Y is not less than N In!.

8.6.5. Let 'IjJ (m) be the number of pairwise nonisomorphic connected graphs with m edges. Show that:

(1)

(2) for lagre enough m,

8.6.6. Show that the number of pairwise nonisomorphic pseudographs that do not have isolated vertices but have m edges does not exceed (em)m, where e is a constant independent of m.

8.6.7. Show that the number of pairwise nonisomorphie k-pole networks with m edges without loops and without isolated vertices does not exceed (2m)k (em )2m, where e is a constant independent of m and k.

8.6.8. Prove that the number of pairwise nonisomorphic trees with m edges does not exceed the number of pairwise different plane rooted trees with m edges.

8.6.9. (1) Prove that the number of pairwise different plane rooted trees with m edges does not exceed e:).

(2) Determine the asymptotic behavior of the number q (m) of plane rooted trees with m edges for m -+ 00.

8.6.10. Using the Cayley theorem, according to which the number of pairwise different trees with n labelled vertices is equal to nn-2, prove that the number of pairwise nonisomorphic trees with n vertices is not less than enn-2,5en, where lim en = V'ii,

n-oo

8.6.11. Show that the number of pairwise different trees with n labelled vertices, where the vertex with number 1 has a degree k, is equal to (~::::D (n - 1 )n-k-l .

8.6.12. Find the number of graphs in Yn constituting forests.

8.6.13*. Show that the number of forests in Yn, whose given vertices j and k belong to different components, is equal to 2nn - 3 •

8.6.14. Let r.p (n) be the number of pairwise different rooted trees with n pendant vertices, such that the degree of a root is equal to 2, and the degree of each vertex other than a root or a pendant vertex is equal to 3.

(1) Show that the number r.p (n) is equal to the number of ways in which brackets can be arranged in the expression b1 : b2 : ...: bn so that the new expression obtained in this way is meaningful.

Page 259: Problems and Exercises in Discrete Mathematics

250 CHAPTER 8. COMBINATORICS

(2) Show that

cp (n) = .!. (2n - 2) . n n-1

8.6.15. (1) Show that the number of pairwise nonisomorphic bipolar 7r-networks with m edges does not exceed twice the number of pairwise different plane rooted trees with m pendant vertices.

(2) Show that the number of pairwise nonisomorphic 7r-networks with m edges

does not exceed 2 (~:=D.

8.6.16. Find the number of pairwise nonisomorphic networks r (a, b) with n vertices and m edges, having the following properties:

(1) the network r (a, b) is s-decomposable, (2) all the vertices in the network r (a, b) are minimal.

Remark. The poles a and b of the network r (a, b) are not equal: the former is the entrance to the network and the latter is the exit from the network. Upon an isomorphic mapping of the network r to the network G, the entrance (exit) of the network r must correspond to the entrance (exit) of the network G.

8.6.17. Let cP (n, m) be the number of different formulas generated by the set of connectives {&, V} and the set of variables {Xl, X2, .•. , xn} with m entries of the connectivity symbols.

(1) Show that cP (n, m) is equal to the number of pairwise different rooted trees each of whose pendant vertices is labelled by a certain symbol in the set {Xl, X2, ••• , x n }, while each nonpendant vertex is labelled by one of the symbols & or V.

(2) Show that

Remark. Formulas are assumed to be different if they form different words in the alphabet {&, V, (,), Xl, X2, ... , xn }.

8.6.18. Let cP (n, m, k) be the number of different formulas generated by the set of connectives {&, V, -} and the set of variables {Xl, X2, ... , xn} with m entries of the symbols of variables and k entries of the symbol "-". Prove that

1 (2m - 2) CP(n, m, k)S; m m-1 sm-Inm.

8.6.19. Show that the number of disconnected graphs in Qn,m does not exceed

Page 260: Problems and Exercises in Discrete Mathematics

8.6. ESTIMATES IN GRAPHS 251

8.6.20. Show that the number of graphs in 9n,m having exactly two connectivity components does not exceed

[n/2] ( ) m ( (k-1) ) ( (n-k-1) ) L n kk-2(n _ kt-k- 2 L . 2 . 2 •

k=l k i=k-1 J - k + 1 m - J - n + k + 1

8.6.21. Show that the number of k-connected graphs in 9n, m which are not (k + I)-connected (k ~ n - 2) does not exceed

Hint. For k ~ n - 2, a graph that is not (k + I)-connected contains k vertices whose deletion results in a disconnected graph.

8.6.22. Show that the number of pairwise different connected subgraphs of a cube En, which are generated by subsets with k vertices does not exceed 2n (4n )k-1. (Assume that the vertices of the cube En are labelled by the numbers from 1 to 2n.)

8.6.23. By majorization of the number of graphs in 9n having a vertex of degree n - 1, show that almost all n-graphs have a radius larger than unity.

Let p (G) be a certain numerical parameter of graph G. Let

p (n) = T(;) L p(G)

be the mean value of parameter p, and

Dp(n) = T(;) L (p(G) - p(n))2 GEYn

be a variance of p. In the same way, we can determine the mean value and variance of parameters of the graphs in 9n, m' Let B > 0, and iSn (B) be the fraction of those graphs G in 9n for which p( G) ~ B, and Don (B) be the fraction of such graphs G in 9n, that Ip( G) - p( n) I ~ B. Various estimates and proofs of the properties of nearly all graphs are frequently obtained with the help of the following (Chebyshev's) inequali ties:

is (B) < p(n). n _ B ' (1)

(2)

For example, let p( G) be the number of isolated vertices of the graph G. We must show that p(G) = 0 for almost all n-graphs. Let gn(i) be the number of graphs in 9n, in which the i-th vertex is isolated. In this case,

n

p(n) = T(;) L p(G) = T(;) L gn(i). i=l

Page 261: Problems and Exercises in Discrete Mathematics

252 CHAPTER 8. COMBINATORICS

Obviously, gn(i) = 2(n~1) for all i = 1, n. Hence, p(n) = n ·2-n. Putting () = ~ in (1), we find that the fraction of graphs G in gn, for which p(G) ~ 1/2, does not exceed n2-n+1 . But limn.-oo n· 2-n+I = O. Hence, p( G) < 1/2 for almost all n-graphs, i.e. p( G) = O.

Let us now suppose that p( G) is the number of edges in the graph G. We shall show that for nearly all n-graphs p( G) = 1/2 (;) (1 + en), where liffin.-oo en = O. We have

where gn(i, j) = 2(;)-1 is the number of graphs in which the pair (i, j) of vertices

is joined through an edge. Thus, p(n) = 1/2(;). Let us calculate the variance:

Let us label all pairs of the type (i, j) 1 ::; i < j ::; n by numbers from 1 to (;), and let 9n(V, 11) be the number of graphs Gin gn, in which pairs with numbers v

and 11 are edges. Then

But 9n(V, 11) = 2(;)-2, if v i-Il. Hence,

Dp(n) = ~(;) + ~(;) ((;) -1) -G(;) r = ~ (~). Putting () = Jnp(n) in (2), we find the fraction of those graphs G E gn for

which Ip(G) - H;)I ~ ~(;) does not exceed l/n. Hence, for almost all graphs,

p(G) = 1/2(;)(1 + en), where limn.-oo en = O.

8.6.24. Let p(G) be the number of pairs of different vertices of graph Gin gn, for which there is no chain of a length smaller than 3 joining these vertices. Let

p(n) = T(;) LGEgn p(G). (1) Show that

1 (n) (3)n-2 p(n) = 2 2 4

(2) Show that almost all n-graphs have no vertices separated by a distance larger than 2.

(3) Using the results of problems 8.6.23 and 8.6.24 (2), show that the radii and diameters of almost all n-graphs are equal to two.

Page 262: Problems and Exercises in Discrete Mathematics

8.6. ESTIMATES IN GRAPHS 253

8.6.25. Show that the average number of Hamiltonian cycles in graphs G in Qn is equal to {n - 1)!/2n+l.

8.6.26. Find the average number of cycles of length 3 in graphs G of Qn,m.

8.6.27*. Using the Chebyshev inequality (2), show that in almost all (n, m (n))-graphs, where m(n) = [njln (n In n)], the number of isolated vertices is equal to n(l - c:(n)), where liII1n--+oo c:(n) = O.

8.6.28*. Let k be an integer (k ~ 2). Show that if m = m(n) = ~(n) . n2 - k:! (where ~(n) -t 00 for n -t (0), nearly all (n, m)-graphs contain a complete subgraph with k vertices.

8.6.29. Find the average number of k-vertex independent sets in graphs G in Qn.

8.6.30. Let k be a natural number. Calculate the average number of vertices of degree k in graphs G of Qn, m.

8.6.31. Let p(G) be an integral nonnegative parameter and let p(n) be its average value for graphs G in Qn. Show that if limn--+oo p( n) = 0, then p( G) = 0 for almost all graphs.

Page 263: Problems and Exercises in Discrete Mathematics

Chapter 9

Boolean minimization

9.1 Faces of the n-cube. Covers and tests for tables

The set B~;:~:::;'~k = {( aI, ... ,an) E Bn : ail = 0"1, •.. ,aik = O"d is called a face of the cube Bn. The set {it, ... , in} is called the direction of the face, the number k is called the rank of the face, and n-k is called the dimension of the face B~;:~.'::;"~k. The code of the face G = Bn,il, ... ,ik is the vector :::; (G) = ('VI ••• 'V ) such as

Ql,. .. ,Qk I " "n

"IiI = 0"1, ..• , "Iik = O"k and the other coordinates are "-". For example, ::y (B;;1,3) = (0 - 1-). A one-dimensional face is called an edge of the n-cube.

By Gn we denote the set of vectors::Y = hI, ... ,"In) such that "Ii E {O, 1, -}. A vector ii is said to be less or equal to a vector ~ (denoted by ii ~ ~), if ~ can be obtained from ii by replacing some [may be no one) coordin~tes of a : ai E {O, I} to hyphens ("-"). The relation a ~ f3 of vectors ii = ::Y(G), f3 = ::Y(H) corresponds to the relation G ~ H of the faces G and H. Let Iiall be the number of the hyphens in the vector a, and G'k be the set {ii E Gn : Iiall = k}. Then G~ = Bn, G1 is the set of the edge codes , G'k is the set of k-dimensional faces (of Bn) codes. The set J(a,~) = {::y E Bn: a::;::Y::;~, a, ~ E Bn} is called an interval of Bn, if a ::; ~. The number p(a,~) is called the dimension of the interval J(a,~).

Let M be a matrix with elements from {O, I}. We shall say that a column ~ E M is covered by a row ii E M, if the element on their crossing is "1". A matrix of size m x n is a matrix with m rows and n columns. The subset A of the rows of M is called a cover (of the set of rows) if the each column of the matrix M is covered by the row from A. The number of rows in a cover is called the length or the size of the cover. A cover is the shortest if it has the minimal length among all covers. The length ~(M) of the shortest cover is called the depth of the matrix M. Let some number w(ii) :::: 0 (the weight of ii) be assigned to each row a E M. The number w(A) = L&EAW(ii) is called the weight of the set A. A cover is minimal (relative to a weight function w) if it has the minimal weight among all covers of M. A cover is irredundant if it ceases to be a cover after the deletion of any of its rows. A cover is called greedy, (or gradient) if it is the result of the following (gradient) procedure. As the first step we include in the gradient cover a row a1 with the

254

Page 264: Problems and Exercises in Discrete Mathematics

9.1. FACES, COVERS, AND TESTS 255

maximum number of ones and delete this row from M together with all columns, covered by al. As a result, we get the matrix MI. After k steps, we have obtained the set of rows Ak = {aI, ... ,ad in the gradient cover and the matrix Mk . At the (k+ l)-th step, we include in the gradient cover any row ak+1 which covers the maximum number of columns of Mk , etc. The procedure is complete when M k is empty. If k is the number of the last step of this procedure the set Ak is the required cover. The result of the above procedure, is not uniquely defined because the choice of ak is not uniquely defined at the k-th step, k = 1,2, ... By Lg(M), we denote the maximal length of a gradient cover of a matrix M.

A subset A of rows of a matrix M is called a test of M if the following property holds: arbitrary columns i and j in A are different in the submatrix A if the columns i and j are different in the matrix M. The number of rows in a test is called the length of the test. A test is minimal if it has the minimal length among all tests for M. A test is irredundant if it ceases to be a test after the deletion of any row.

9.1.1. Show that a face of dimension k is an interval of dimension k and vice­versa.

9.1.2. Prove the following statements:

(1) the number of different faces of a fixed direction {iI, ... ,ik} is equal to 2k;

(2) two different faces of the same direction do not intersect;

(3) the union of all faces of the cube Bn of a given direction is the entire cube

(4) the number of all faces of rank k in the n-cube is equal to (~) . 2k;

(5) the total number of faces of the n-cube is equal to 3n ;

(6) the number of faces of dimension k containing a given vertex a in the n-cube

is equal to (~);

(7) the number of faces of dimension k containing a given face of dimension I is

equal to (~=D; (8) the intersection of two faces of the n-cube (if it is not empty) is a face;

(9) the number of k-dimensional faces intersecting a given I-dimensional face of the cube Bn is equal to L~~(k,l) G) 21- j (~=j).

9.1.3. (1) LetG, H, andF be the faces of the n-cube. Show that the relations G n H #- 0, G n F #- 0, H n F #- 0 lead to the inequality G n (H n F) #- 0.

(2) If a, ~ are vertices of the cube Bn, then let B( a,~) be the face of the n-cube with the code ::y, obtained from the set a by replacin~ the coordinates which are different from the corresponding coordinates of the set f3 by hyphens. Prove that for any vertex a, ~,and::Y from the Bn the set B(a,~) n B(~,:::;) n B(::Y, a) containing a single tuple b = (151 , .•• ,bn ), bi = Ci.if3i V f3i/i V liCi.i (i = 1 ... n).

Page 265: Problems and Exercises in Discrete Mathematics

256 CHAPTER 9. BOOLEAN MINIMIZATION

(3) Let E(A) is the set E(A) of all edges (of the cube Bn), of which ends are contained in a subset A ~ Bn. Prove that for any integer m, 0 ::; m ::; 2n- 1 and for any A ~ Bn, such as IAI = 2n- 1 + m the inequality IE(A)I ~ mn holds.

9.1.4. Let nJ, n2, ... ,n. be nonnegative integers such that L:i=12ni = 2n. In this case, Bn contains pairwise nonintersecting faces GJ, G2 , • •• ,G. the dimensions of which are, respectively, equal to nl, n2, . .. ,n. such that Ui=l Gi ~ Bn .

9.1.5. The faces G1 and G2 are called incomparable if neither of the inclusions G1 ~ G2 and G2 ~ G1 is satisfied.

(1) Show that there exists a set of faces of the cube Bn consisting of ([n/3)) (n[!it)3)) pairwise incomparable faces.

(2) Show that the size of any set of pairwise incomparable faces of the cube Bn does not exceed ( n ) . 2n-[n/3) [n/3) .

9.1.6. Find the depth of the matrix M:

(1) M = [ ~m 1 j 1100

11110000001111 00111100111100

(3) M = 11000111100110 11111110000000 00000001111111

11100 01110

(5) M = 00111 10011 11001

(2) M = [ Hml 1 ; 001001

110000 011000 001100 000110 000011

(4) M =

100001 1010010 1001001

(6) M = 0101010 0010110 0100101

9.1.7. Find the minimal lengths of the greedy covers of the matrices M from Problem 9.1.6.

9.1.8. Find the numbers of the shortest covers of the matrices M from Problem 9.1.6.

9.1.9. Find the numbers of the irredundant covers of matrices M from Problem 9.1.6.

9.1.10. (1) Let M is a matrix with n nonzero columns and the number of units in every row is not less than k. Show that ~(M) ::; n - k + 1.

Page 266: Problems and Exercises in Discrete Mathematics

9.1. FACES, COVERS, AND TESTS 257

(2) Show that this estimate is attainable. 9.1.11. Let M is a matrix of linear (n,k)-code. Show that e(M) :::; k.

9.1.12*. Let M be a matrix of size m x n and the number of units in every column is not less than s. Prove that Lg(M) :::; 1 + ~ In e:nn.

9.1.13 *. Let Mbe a matrix with n nonzero columns and there exists a submatrix M with m rows such as the number of columns of M with s units does not exceed IOn. Prove that the maximal length Lg(M) of greedy cover of matrix M satisfies the unequality

L (M) < 1 + 10 + !!!.In ~. 9 - n 8 m

9.1.14. Let Mbe a matrix with n nonzero columns and let the depth of Mbe p. Prove that

Lg(M) :::; 1 + p + (ln~) fln (1 - ~) .

9.1.15. Let a binary matrix M having n = 2(2q - 1) columns and q + 2 rows and the set of numbers of the unity coordinates in row i of matrix M is Ei = {2i- 1 , 2i- 1 + 1, ... ,2i - 1, n - 2i- 1 + 1, n - 2i - 1 , • .. , n - 2i + 2} 1 :::; i :::; q Eq+1 = {I, 2, ... ,2q - I}, Eq+2 = {2Q, 2Q+1, . .. ,n}. Find the ratio of the length of a greedy cover to the length of the shortest cover.

9.1.16. The set N ~ Bn is called (n, k)-picked, if each k-dimensional face contains at least one vertex from N. Let L(n, k) = min INI, minimum of all (n,k)­picked sets. Prove that:

(1) L(n, 1) = 2n-\

(2) L(n,n -1) = 2;

(3) L( n, 2) :::; [2n /3];

(4) m :::; L(n, n - 2) < m + 2, where m is the smallest integer, such that

([m/2]) ~ n;

(5) Prove that [n/k] ( )

L( n, k) :::; t; (k : l)i ;

(6) Prove that L(n, k) ~ 2n - r L(r, k) (k:::;r:::;n);

(7) Prove that

9.1.17*. Let 1 :::; I < k :::; nand Mn,k,/ be the matrix with rows corresponding to the tuples from B'k and columns corresponding to the tuples from HI' Let the

Page 267: Problems and Exercises in Discrete Mathematics

258 CHAPTER 9. BOOLEAN MINIMIZATION

unity be on the crossing of row and column if and only if the tuple corresponding to the column contains all units of the tuple corresponding to the row.

(1) Find e(Mn,n-I,I)'

(2) Prove that

] n]n-I] ]n-Z+I[ [[[ e(Mn,k,I)~ k k-I ... k-I+I ....

(3) Prove that e(Mn,n-k,!) = Z + 1, n ~ (I + I)k.

(4) Prove that

(5) Prove that

where r is the remainder of division n by 1- 1, and q = (n - r)j(1 - 1).

9.1.18. Let Mbe a matrix of size m x n and let cp be a positive number. Show that there exists a set of rows A of the matrix M, satisfying the following properties:

(a) IAI 5: njcp (b) Let B be the submatrix obtained from M by deleting all the columns of M,

covered by the rows from A. Then the maximal number of ones in a row of B does not exceed cpo

9.1.19. Find the lengths of the minimal tests of the matrices M from Problem 9.1.6.

9.1.20. Find the length of a minimal test of the matrix M: (1) the set of columns of Mis Bn;

(2) the set of columns of Mis BJ:;

(3) the set of columns of M is UO~k~n/2B;k;

(4) the set of columns of Mis BJ: U BJ:+l (k > 0).

9.1.21. By M(2) denote the matrix, which consists of the sums modulo 2 of all nonordered pairs of the columns of the matrix M. For example, if

[ 110 1 [ 011 1 M = 011 , then M(2) = 110 . 001 011

Prove that a set of rows of the matrix M with numbers i l , ... ,ik is a test (minimal, irredundant) if and only if the set of rows of the matrix M(2) with the

Page 268: Problems and Exercises in Discrete Mathematics

9.1. FACES, COVERS, AND TESTS 259

same numbers is a cover of M(2) (respectively, shortest, irredundant).

9.1.22. Matrices M and L with equal number of rows are called T-equivalent if the set of rows of the matrix M with numbers iI, ... ,ik is a test if and only if the set of rows of the matrix L with the same numbers is a test of the matrix L. Find out whether the following matrices M and L are T-equivalent:

(1) M is obtained from L by commutation of columns;

(2) M is obtained from L by commutation of rows;

(3) M is obtained from L by deleting of all columns, which consist of zeros only (ones only);

(4) M is obtained from L by deleting some k - 1 columns from each set of k identical ones.

(5) M is obtained from L by adding modulo 2 a fixed vector a to each column of the matrix L;

(6) M is obtained from L by adding modulo 2 a fixed vector a to each row of the matrix L;

(7) M is obtained from L by substitution of all 0 for 1 and all 1 for 0;

(8) M consists of all linear combinations of columns of the matrix L;

(9) M = L(2) (see the definition in Problem 9.1.21).

9.1.23. Prove that if Mhas n pairwise different columns, then the length of the minimal test is not less than log 2n.

9.1.24. Prove that the number of irredundant tests of the matrix M with m

rows does not exceed ([m/2])'

9.1.25. Prove that the number of a matrix of size m x n with pairwise different rows, for which the collection of the rows with numbers iI, ... ,ik is a test, is equal to 2k(2k + 1) ... (2k - n + 1)2n(m-k).

The universal algorithm for obtaining all tests of an arbitrary matrix M consists of the construction of some c.n.f. K(M) from the matrix M and the subsequent transformation c.n.f. to d.n.f., the addends of which correspond to the irredundant tests.

Example. Obtain all irredundant tests of the matrix M. Solution. Costruct a matrix M(2).

r 0 1 0 1 011

M= 1 0 1 ;

110

Page 269: Problems and Exercises in Discrete Mathematics

260 CHAPTER 9. BOOLEAN MINIMIZATION

Further, by the matrix M(2), construct the c.n.f. Q(M), the variables of which are the numbers of rows of the matrix M(2) and the elementary disjunctions correspond to columns. Namely, the disjunction corresponding to the column having ones in positions il , ... , iT is (il V ... Vir)' In our case, we have

Q(M) = (1 V 2 V 3)(2 V 4)(1 V 3 V 4).

After opening the parentheses and using the rule A V AB = A (absorption) we get the d.n.f.

D(M) = 1·2 V 1·4 V 2·4 V 3·4 V 2·3.

The following sets of the rows are the irredundant tests:

{1,2}, {1,4}, {2,4}, {3,4}, {2,3}.

9.1.26. Obtain all irredundant tests for the matrix from items (1), (2), (5), (6) in Problem 9.1.6. with the help of the universal algorithm.

9.1.27. Prove that if, in a matrix M of size m x n, the distance between two rows is not less than d, then the length of the minimal test does not exceed

m 2edm l+-d ln ( )' nn-l

9.2 Constructing of the Reduced Disjunctive Normal Form Methods

Conjunction K is called an implicant of a function f(xn ) if K V f(xn ) = f(xn ).

An implicant K of a function f is called prime if rejection of any literal from K leads to an elementary conjunction that is not an implicant of the function f The disjunction of all prime implicants of the function f is called the reduced d. n.f. of the function f

A disjunctive normal form is called: minimal if it has the smallest number of literals among all equivalent d.n.f.s; shortest if it has the smallest length (number of elementary conjunctions) among

all equivalent d.n.f.s; irredundant if the omission of any elementary conjunction or literal leads to a

non-equivalent d.n.f.; d. n.f. of the function f if it represents the function f. Conjunctions in d.n.f. are called addends, the number of addends in d.n.f. IS

called the length of d.n.f The sum of the ranks of addends is called the complexity of d.n.f. The function f absorbs a function g (notation: g$.f), if 9 V f = f (or, that is the same, 9 & f = g). A prime implicant K of a function f is called core if d.n.f., which consists of all prime implicants different from K, does not absorb K. The disjunction of all core implicants of a function f is called the core of the function f.

Page 270: Problems and Exercises in Discrete Mathematics

9.2. CONSTRUCTING OF THE REDUCED DNF 261

If an elementary conjunction K is an implicant of a function f(x n), the set NK

of such vectors a in En for which K(a) = 1 forms a face belonging to the set Nj .

This face is called the interval of the function f(xn) corresponding to the implicant K. An interval of the function f which is not included in any other interval of the function f is called maximal. Maximal intervals correspond to prime implicants of the function f. The interval corresponding to a core implicant of a function f is called core. An arbitrary core interval of a function f contains a vertex, which is not contained in any other maximal interval of f. Such a vertex is called a proper vertex of the core interval.

Blake's method of the obtaining the reduced d.n.f. from an arbitrary d.nJ. involves the using of the following rules: xK1 VXK2 = xK1 VXK2 V KIK2 (gene­ralized pasting) and Kl V KIK2 = Kl(absorption). It is assumed that these rules are applied from the left to the right. At the first stage, the operations of generalized pasting are continued as long as possible. At the next stage, the absorption operation is carried out.

Example 1. Obtain the reduced d.nJ. from d.nJ. D, where is

After the first stage, we obtain

After the second stage, we obtain a reduced d.n.f.

Nelson's method allows to obtain the reduced d.nJ. from c.nJ. First the parentheses are opened by using the distributivity law. At the second stage, literals

and terms are cancelled by using the relations x x K = 0, xxK = xK, Kl V KIK2 = K 1 ·

Example 2. Construct the reduced d.nJ. for a given c.nJ.

After opening the parentheses, we get

After the second stage, we get the reduced d.nJ.

Page 271: Problems and Exercises in Discrete Mathematics

262 CHAPTER 9. BOOLEAN MINIMIZATION

Quine's algorithm for obtaining the reduced d.n.f. from the perfect d.n.f. works as follows. At the first stage, the operation xKVxK = KV xK VxK (incomplete pasting) is applied to the perfect d.n.f. This operation applies to each pair of conjunctions for which such operation is applied. Then the conjunctions of the rank K, are deleted with the help of the rule K V MK = K (absorption). After that we get some d.n.f. DI . At the (k + l)-th stage the operations of incomplete pasting and absorption are applied to the conjunctions of the rank n - k of the d.n.f. Dk. The work is complete if Dk+l = Dk.

~3

Example 3. Let the function f(x ) be defined by the perfect d.n.f.

After the first stage, we obtain

After the second stage, we get the reduced d.n.f.

For small values of n, the reduced d.n.f. can be found from the geometrical representation of the set Nf in Bn. With this purpose the faces of Bn of maximal dimension, which contained in Nf are founded. Then the d.n.f. is constructed from conjunctions corresponding to these faces.

Example 4. Let the function f(x3 ) be represented by the vector Of = (00011111). Find its reduced d.n.f.

Solution. The vertices of the set Nf = {111, 110, 101, 100,011} marked by the circles in Bn. The faces of the maximal dimension are B~,l and B~i2,3. The codes of these faces are (1 - -) and (- 1 1). Conjunctions corresponding to this faces is Xl, x2x3 and the reduced d.n.f. is Dj = Xl V X2X3.

111 Another way of obtaining the reduced d.n.f. for the

000

Fig. 9.1

functions, depending on the small number of variables (no more 4), consists of using of minimizing chart (see

11 Figure 9.1) (Karnaugh maps or Veitch diagrams). A function is

represented by means of rectangular tables. The sets of meanings of variables are disposed in Gray's code on the sides of rectangular. To find the prime implicants we picked out the maximal by inclusion rectangulars, consisting of one values. It is assumed that every cell of the table, is neighboring to all cells which are side by side to the opposite cells disposed on the same horizontal

or vertical. This method also can be used for incompletely defined functions. In this

Page 272: Problems and Exercises in Discrete Mathematics

9.2. CONSTRUCTING OF THE REDUCED DNF 263

case we look for the maximal rectangulars, which contain ones (at least one) and do not contain zeros.

Example 5. Table 9.1 is a minimizing chart for the function f(x 4 ) with the vector of meanings af = (1110 0101 0100 1101). The codes of the maximal intervals are (0 0 - 0), (000 -), (- - 0 1), (- 1 - 1), (1 1 - 0). The reduced d.n.f. is

Table 9.1

X3 001 1 X2 X4 0 1 1 0

0 tm '0 0 CC 11 Table 9.2

o

o 1 0 r-11

-- -I

1 I 0 X2 001 1 I I Xl X3 0 1 1 0

1 r-- -1-_1 I

1 I 1 11.1 1 I 0 I - -- - --' 0 _I 0 ,K -I ~11 I

0 0 1 0 0 '-:-:'

1 1 0 (- ~!) 0

Example 6. Table 9.2 is a minimizing chart for the partial function f(x3 ).

Reduced d.n.f. is Dj = XIX3 VXIX2 V X2X3 V XIX3.

A prime implicant I of a function f is called core if there exists a tuple a such that J(a) = 0, and at the same time K(a) = 0 for every prime implicant ]( different from 1. Such a tuple is called a proper vertex of the core implicant.

9.2.1. Select the prime implicants of the function f(x n ) from the given set of elementary conjunctions A

(1) A = {Xl, X3,XIX2, X2X3}, f(x 3 ) = (00101111);

(2) A = {XIX2, X2X3, XIX2Xd, f(x 3 ) = (01111110);

(3) A = {Xl, X4, X2X3, XIX2X4}, f(x 4 ) = (1010111001011110);

(4) A = {Xl, X2, xlxd, f(x 2 ) = (1011);

(5) A = {XIX3, XIX3, X2}, f(x 3 ) = (00111011);

(6) A = {XIX2, X2X3, X2}, f(x 3 ) = (00101111).

9.2.2. Using Blake's method construct the reduced d.n.f. for the given d.n.f.D : (1) D = XIX2 V XIX2 X 4 V X2 X 3 X 4;

(2) D = XIX2X3 VXIX2X4 VX2X3X4;

Page 273: Problems and Exercises in Discrete Mathematics

264 CHAPTER 9. BOOLEAN MINIMIZATION

(3) D = Xl VXlX2 VXlX2X3 VXlX2X3X4;

(4) D = XlX2X4 VXlX2X3 VX3X4;

(5) D = X3X4 VX2X4 V XlX4 V X2 X3X4;

(6) D = XlX2X3 V X3X4 VXlX4 VX2X4;

(7) D = X3X4 V XlX2 V X3X4 VXlX3;

(8) D = XlX2X3 VXlX2X4 V X2 X3X4 V X2X3X4 V XlX2 X3·

9.2.3. Construct the reduced d.n.f. for the given c.n.f.s: (1) (Xl V X2 V X3)(XI V X2 V X3)(X2 V X3);

(2) (Xl V X4)(X2 V X3 V X4)(XI V X2 V X3);

(3) (Xl V X2 V X3)(XI V X4)(X2 V X3 V X4);

(4) (XlVX2)(XlVX2VX3);

(5) (Xl V X2 V X3)(XI V X2);

(6) (Xl V X2 V X3)(XI V X2 V X3);

(7) (Xl V X2)(X2 V X3)(X3 V Xl);

(8) (Xl V X2)(X2 V X3)(X3 V X4)(X4 V Xl);

(9) (Xl V X2 V X3)(XI V X2 V X4)(XI V X2 V X4);

(10) (Xl V X2)(XI V X2 V X4)(XI V X2 V X3)(X3 V X4)'

9.2.4. Using Quine's method, construct the reduced d.n.f. for the function f represented by its value vector oJ:

(1) oJ = (0111 0110); (3) oJ = (0010 1111); (5) oJ = (0001 1011 1101 1011); (7) oJ = (1111 1111 0111 1110);

(2) oJ = (1011 1101); (4) oJ = (1110 0100);

(6) oJ = (0000 1111 1111 0110); (8) oJ = (0000 1111 0111 1111);

9.2.5. Construct the reduced d.n.f. with the help of searching the maximal faces containing in the set NJ:

(1 ) oJ = (1111 0100); (3) oJ = (1101 0011); (5) oJ = (1111 10000100 1100); (7) oJ = (1110 0110 0000 0111);

(2) oJ = (0101 0011); (4) oJ = (1110 0111);

(6) oJ = (0001 01111110 1111); (8) oJ = (1111 11111111 1000);

9.2.6. Using the minimizing chart find the reduced d.n.f. for the function f : (1) oJ = (0101 0111); (2) oJ = (1101 1011); (3) oJ = (1011 0000); (4) oJ = (1110 1111); (5) oJ = (0001 1011 1101 1111); (6) oJ = (0011 1101 1111 1101); (7) oJ = (0011 1101 1101 1110); (8) oJ = (0010 1011 1101 1111);

Page 274: Problems and Exercises in Discrete Mathematics

9.2. CONSTRUCTING OF THE REDUCED DNF 265

9.2.7. Using the minimizing charts construct the reduced d.n.f. for the partial function f, defined by the vector (lines corresponding to indeterminate values):

(1) (if = (01 - - 01 - 1); (2) (if = (1 - 01 - -10); (3) (if = (1 - - - 0 -10); (4) (if = (0 - -1 0 - 1-); (5) (if = (10 -1 - 011 - 0 - - 1- 01); (6) (if = (0 - -1 - - -0 - -1- 1 - 01); (7) (if = (- -01 -1 - 00 - - - -1 - 0); (8) (if = (-10- 1- -11- 01 - 0 - -);

9.2.8. Find all core implicants for the functions f from the Problem 9.2.6.

9.2.9. Find the length of the reduced d.n.f. of the following functions:

(1) f(:i;n) = xdB X2 El:l •.• El:l Xn;

(2) f(:i;n) = (Xl V X2 V X3)(Xl V X2 V X3) El:l X4 El:l X5 El:l •.• El:l Xn;

(3) f(:i;n) = (Xl V X2 V X3)(Xl V X2 V X3)(X4 El:l X5 El:l •.. El:l xn);

(4) f(:i;n) = (Xl El:l .•. El:l Xr)(Xr+l El:l ••. El:l xn), 1 ::; k::; n;

(5) f(:i;n) = (Xl V·.· V Xn)(Xl V··· V Xr V Xr+l V··· V Xn), 1 ::; k ::; n;

(6) f(:i;n) = (Xl V· .. V Xr)(Xr+l V··· V xn), 1 ::; k ::; n;

(7) f(:i;n) = (Xl -t X2)(X2 -t X3)'" (Xn-l -t Xn)(Xn -t Xl);

(8) f(:i;n) = (Xl V··· V Xn)(Xl V··· V Xn);

(9) f(:i;n) = (Xl V X2)(X3 V X4)'" (X2n-l V X2n)'

9.2.10. Let Sk,m(:i;n) be such that NSkm = {ii E Bn : k::; Iliill ::; k + m}.

(1) For given set ii E B'k find the number of maximal intervals of the function Sk,m, which contains the set ii.

(2) For k < I ::; k + m find the number of maximal intervals of the function Sk,m, which contains the set ii.

(3) Show that the number of maximal intervals IC(Sk,m(:i;4)) of the function Sk,m . 1 (n) (n-k) IS equa to k m •

(4) Show that maxo::;k,m::;n le(Sk,m(:i;n)) = n!/(([n/3]!)2(n - [n/3])!).

9.2.11. Let le(f) be the length of the reduced d.n.f. of the function f. Show that

Page 275: Problems and Exercises in Discrete Mathematics

266 CHAPTER 9. BOOLEAN MINIMIZATION

9.2.12. Show that the number of core implicants of an arbitrary function f(j;n) does not exceed 2n - 1 .

9.2.13. Find the number of core implicants of the functions in Problem 9.2.9.

9.2.14. (1) Show that each prime implicant of the function J(j;n) of rank n is core.

(2) Show that each prime implicant of the function J(j;n), which rank less than 2, is core.

9.2.15. (1) Show that a prime implicant of the monotone function does not contains negations of variables.

(2) Show that each prime implicant of the monotone function is core.

9.2.16. Prove that the reduced d.n.f. of the function J realize f.

9.3 Irredundant, Minimal, and Shortest DNFs

Minimizing charts, defined in the previous section, can be used for constructing irredundant, shortest, and minimal d.n.f.'s for the functions depending on a small number variables (usually not more than four). To obtain the shortest d.n.f. of a function J, we need to find the shortest cover of the set of ones by rectangles of the minimizing chart, which corresponding to the prime implicants of the function f.

Example 1. Find the shortest d.n.f. for the function J from Example 5 in the previous section.

Solution. The minimizing chart is represented by Table 9.1. As can be easily seen, all (but one corresponding to the conjunction XIX2X3) maximal rectangles contain a proper vertex. Therefore, these prime implicants are core. The core of the function J represents it, because the corresponding rectangles cover the set N j .

None of core implicants can be removed. At the same time, the implicant XIX2X3

cannot be included in an irredundant d.n.f., because the corresponding rectangle is covered by the other ones. Thus, there exists a single irredundant d.n.f.

which is also the reduced, the shortest, and the minimal d.n.f. of the function f

Often, the so-called Quine table Qj is used for obtaining irredundant d.n.f.'s of a function J . The rows of this table correspond to the prime implicants of the function J, and its columns correspond to the tuples from the set N j . The crossing element of the ro::::, correspondin2 to a prime implicant I, and the column, corresponding to a

Page 276: Problems and Exercises in Discrete Mathematics

9.3. IRREDUNDANT, MINIMAL, AND SHORTEST DNFS 267

(of the table Q J) with the minimal sum of the ranks of implicants, corresponding to the rows from the cover, conforms to the minimal d.n.f. of the function f.

To obtain all irredundant d.nJ. 's of the function f, the following algorithm can be used. Construct the c.n.f. K(J) in the following way. Put, in accordance to each column a of the table Qj, the disjunction D-; = Kl V K2 V ... V Ks , where 1<; ( i = 1, ... ,8) is the prime implicant of the function f such that Ki(ii) = 1. The parentheses are opened like in the Nelson method (Example 2 in the previous section). As a result, we get some d.nJ. By applying to this d.nJ. the rules A&A = A and A V AB = A as long as possible, we get a new d.nJ. M(J ) with addends corresponding to the irredundant d.nJ. of the function f.

Example 2. Find all irredundant d.n.f.s of the function

Solution. The reduced d.nJ. of the function f is

Quin's table Q J is shown in Table 9.3.

Table 9.3

001 001 001 001 001 001

Kl = XIX2 0 0 1 0 1 0

K2 = XIX3 0 0 1 0 0 1

K3 = X2 Xl 0 1 0 1 0 0

K4 = X2 X3 0 1 0 0 0 1

Ks = X3 Xl 1 0 0 1 0 0

K6 = X3 X2 1 0 0 0 1 0

The c.n.f. K(J ) is

K(J ) = (Ks V K6)(K3 V K4)(I<1 V K2)(K3 V KS)(I<l V K~)(K2 V K4)'

Then

Therefore, the function f has two shortest d.n.f., which (in this case) are also minimal, and three irredundant d.nJ., which are not shortest (and minimal). The shortest d.n.f. corresponding to the addend Kd<4KS from the d.n.£. M(J ), is

Page 277: Problems and Exercises in Discrete Mathematics

268 CHAPTER 9. BOOLEAN MINIMIZATION

The remaining irredundant d.nJ. 's can be obtained analogously.

An algorithm for the simplification of a d.n.f. consists of using the following two operations.

1. Operation of removing an addend (Operation 1). This operation removes an addend K from the d.nJ. D under the condition that removing K leads to the d.nJ. D', which is equivalent to D.

2. Operation of removing a character (Operation 2). This operation removes a character xi from an addend K of the d.nJ. D under the condition that removing this character leads to the d.nJ. D', which is equivalent to D.

When using the algorithm of simplification, the d.nJ. is considered like a word with a fixed order of addends, and also characters in every addend. Operation 1 (Operation 2) is applied to the first addend (respectively, character) in this order, for which the operation is applicable. In the process, first we try to apply Operation 1 to each addends. If it fails, we try to apply Operation 2. After each successful application of Operation 2, we try to apply Operation 1. The work of the algorithm is complete if none of the operations is applicable.

Example 3. To apply the algorithm of simplification to the d.nJ.

Solution. At the first stage, we remove the first addend. As a result, we get d.nJ.

There are no conjunctions in DI , which can be removed. But we can remove the character Xl in the first conjunction. Then we have

This is an irredundant d.nJ. The work of the algorithm is complete. Observe that if, at the last stag,e we should remove the character X3 instead of

the character Xl (what this algorithm requires), then the process of the simplification

could be continued by removing the addend Xl i 3 • As a result, we could get d.nJ.

Page 278: Problems and Exercises in Discrete Mathematics

9.3. IRREDUNDANT, MINIMAL, AND SHORTEST DNFS 269

which is the shortest and minimal.

9.3.1. Find out if the following d.n.f.'s are (a) irredundant, (b) shortest, (c) minimal:

(1) D = X1X2 VX2;

(2) D = X3X4 V X1X2X4 VX1X2X3;

(3) D = X1X2 VX1X3 VX2X3X4 V X2X3;

(4) D = X1X2 V X2;

(5) D = Xl VX2;

(6) D = X1X2 VX1X2;

(7) D = X1X2X3 V X2 X3 V X2 X3;

(8) D = X1X2 VX1X3X4 VX2X3X4;

(9) D = X1X2X4 VX1X3X4 VX2X3X4;

10) D = X1X2X3 VX1X2X4 VX1X3X4 VX2X3X4;

9.3.2. Apply the algorithm of the simplification to the d.n.f.: (1) D = X1X2 V X2;

(2) D = J"1J"2 V X1X2;

(3) D = X1£2£3 V X2X3 VX2X3;

(4) D = X1X2 V X1X2 VX2X3;

(5) D = X1X2 V X2X3 V X1 X3 V X1X2 V X2X3;

(6) D = X1X2X3X4 V X2 X3X4 V X2 X3 V X1 X3;

(7) D = X3X4 V X2£3X4 V Xl X2X4 V Xl X2X3 V Xl X3 X3 V Xl X2 X4;

(8) D = X1X3 V X2X3 V X1 X2 VX1X2X4 V X2X3X4 V X1 X3X4;

9.3.3. For a given reduced d.n.f. D, construct a d.n.f. which consists of conjunctions contained in at least one irredundant d.n.f.

(1) D=xyVxzVYz;

(2) D =zw V Y zw V X Y w V xy z V X YZ V xYw;

(3) D = x Y z V x YW V x y w V xzw V Yzw;

(4) D =zw V xYw V xYz VxyzVxy w;

(5) D =z wV Y wVxwVyz w Vxyz;

(6) D = xy z V x Y z V X yz V Z w V Y w V X w;

(7) D =x zVyzVxyV xY wV Y zwVxzw;

Page 279: Problems and Exercises in Discrete Mathematics

270 CHAPTER 9. BOOLEAN MINIMIZATION

(8) D =x zV y wVxyVyzVxwVzw.

9.3.4. For a given reduced d.n.f. D, construct a d.n.f. D'EM which consists of conjunctions, contained in at least one minimal d.n.f.

(1) D = xyVx Z Vyz;

(2) D = x YZ V x y Z V xyw V xzw V YZ w;

(3) D =x wV Y wV zwV xzVyz;

(4) D =x zVyzV xy wVxyV y zwVxzw;

(5) D = yzV xz wV X yzVxzwVxy z;

(6) D =xYw V xzw V y zw V Y z w V xYz; (7) D =x zVx z VxyzVxzw;

(8) D = yzt V ywt V xY zt V xy z w.

9.3.S. Construct the minimal d.n.f. for the d.n.f. from Problem 3.4.

9.3.6. Using Quine's tables, construct the irredundant d.n.f. for the function f defined by the vector:

(1) Qj= (0111 1100);

(3) Qj= (0001 1111); (5) Qj= (1110 10000110 1000);

(7) Qj= (0001 0111 1010 1110);

(2) Qj= (0111 1110);

(4) Qj= (1111 10000100 1100);

(6) Qj= (1110 0110 0001 0101);

(8) Q j= (0001 1011 1110 0111);

9.3.7. Find the number T(f) of irredundant d.n.f.'s and the number fL(f) of minimal d.n.f. 's of the function f.

(1) f(i n) = Xl EB X2 EB ... EB Xn EB 1;

(2) f(i n) = (Xl V X2 V X3)(XI VX2 VX3) EB X4 EB ... EB Xn;

(3) f(i;n) = (Xl V X2 V X3)(XI VX2 VX3)(X4 EB ... EB Xn);

(4) f(i;n) = (01111111 1111 1110);

(5) f(i;n) = (Xl VX2 VX3 VX4 V Xs V··· V Xn)&(XI V X2 V··· V Xn);

(6) f(i;n) = (Xl EB ... EB Xk)(Xk+1 EB ... EB xn).

9.3.8. Show that the number of terminal d.n.f. 's for an arbitrary Boolean func­tion f( in) does not exceed (~:).

9.3.9. Let L(f) be the number of letters of the minimal, and l(f) the number of addends of the shortest d.n.f. of the function f. Show that

Page 280: Problems and Exercises in Discrete Mathematics

9.3. IRREDUNDANT, MINIMAL, AND SHORTEST DNFS

(1) maxf(:rn) /(f(;i;n)) = 2n - l ;

(2) maxf(:rn) L(f(;i;n)) = n2n- l .

271

9.3.10. Prove that the number of terminal d.nJ.'s for a function f(;i;n) with 2n - l core implicants is equal to 1.

9.3.11. Find out for how many functions f(;i;n) are the following relations valid:

(1) L(f(;i;n)) = n2n- l ;

(2) L(f(;i;n)) = n2n- l - n.

9.3.12. The function f(;i;n) is called a chain function if the set N f can be

arranged in a sequence ;1, a2, ... , a/ such that p( Q;, Q;+1) = 1, for all 1 :s; i < / and p(Qi, Qj) > 1 if Ii - jl > 1. Let 1](/) be the number of irredundant d.nJ.'s of the chain function f such as INfl = /. Prove that:

(1) 1](1) = 1](2) = 1](3) = 1](4) = 1;

(2) 1](/) = 1](1- 2) + 1](/- 3) ifl ?: 5;

(3) Find the asymptotic behavior of 1](1) if / -t 00.

9.3.13. Let /*(f) be the minimal possible number of elementary conjunctions in the c.nJ. of the function f and A(f) = /(f)//*(f). Find A(f) for f =

(Xl V X2)(X3 V X4) ... (X2n-l V X2n).

9.3.14. Let Do = Do(;i;n) and Dl = Dl(;i;n) be the d.nJ. such as Do&Dl == 0, ~m

Do V Dl == 1 and d.nJ. D(Y ) does not contain common letters with the d.nJ.'s Do and Dl . D.nJ. E, constructed from the d.nJ. Do by replacing each occurrence of the letter Yi on d.n.£. Do and each occurrence Yl on d.nJ. Dl , with the subsequent opening the parentheses, is called a repetition-free superposition d.nJ. D, Do, Dl by variable Yi.

(1) Prove that the repetition-free superposition of irredundant d.nJ.'s is the irredundant d.nJ.

(2) Prove that the repetition-free superposition of reduced d.nJ.'s is the reduced d.n.£.

9.3.15. Let the function W(;i;4) such as

Qw= (0101 1100 0011 1010).

Prove that relations (1 )-( 3) are valid:

(1) W(Xl,X2,X3,X4) = W(;i;4).

(2) The minimal d.nJ.'s of the function W(;i;4) are

Page 281: Problems and Exercises in Discrete Mathematics

272 CHAPTER 9. BOOLEAN MINIMIZATION

DI = XIX3X 4 VX 2X 3 X 4 VX IX3 X 4 V X2 X 3X 4,

D2 = XIX2 X 3 VX IX2 X 4 VX IX2X 3 V XIX2 X 4·

(3) The number of the irredundant d.n.f.'s is 10.

(4) If >.(xm ) = Xl EEl X2 EEl ... EEl Xm and n is even and

f(x n ) = W(XllX2, >'(X3"",Xn /2+1), >'(Xn /2+2,""xn ))

then there exist irredundant d.n.f.'s E and F of the function f, such that

I(E)/I(F) = 2n / 2 - 2 •

(5) The number of irredundant d.n.f.'s of the function

is equal to 102n- t , and the number of minimal d.n.£. is equal to 22n- 4•

Page 282: Problems and Exercises in Discrete Mathematics

Chapter 10

Logical Design

10.1 Circuits of Logical Elements

A circuit of logical elements (GLE) or logical network is a directed contourless network with vertices marked in the following way. The poles of this network are divided into input and output poles. The input poles are labelled by variable symbols ( or, sometimes, their negations or constants). Each vertex other than an input (an internal vertex) is labelled by a logical symbol. The following conditions must be satisfied in this case:

1) An in-degree of each input pole is equal to zero; 2) An in-degree of each vertex other than the input pole is equal to the number

of arguments of the logical symbol which are assigned to this vertex.

f a b

Fig.1O.1

Figure 10.1 (a) shows a way of drawing a CLE. The inputs are marked by the light circles, the internal vertices are marked by the black circles, and the outputs

273

Page 283: Problems and Exercises in Discrete Mathematics

274 CHAPTER 10. LOGICAL DESIGN

are marked by the double circles. Figure 10.1 (b) shows the other way of drawing the same circuit. The logical elements (gate) are marked by triangles with labels inside. The inputs of a gate come to the one side of the corresponding triangle and, at the same time, the opposite vertex is the output of the gate. The inputs of the circuit marked (the same, as earlier) by double circles. Outputs will be sometimes supplied by the symbol of the functions realized in this output.

The set of logical symbols (or connective) used for marking internal vertices of a CLE is called a basis of the CLE. In this chapter, the term "basis"is used in another sense than in Chapter 2. Here, neither a completeness of the system of the functions in this set nor its irredundancy are supposed. An internal vertex, labelled by a logical symbol, is called a logical element or gate. For example, we say, about circuits in the basis {V, &, -} (this basis will be called standard) or in the basis {EfJ,&}.

A concept of a function realized at a vertex of a circuit is defined by induction as follows. If a CLE does not contain logical elements at all, then each vertex of this circuit is an input. In this case, the function, realized at the vertex, is defined to be equal to the variable (or its negation), assigned to this input. Let the function realized at an arbitrary vertex of a circuit be defined for all CLE consisting of no more than m 2: 0 elements. Now consider an arbitrary CLE ~ of m+ 1 gates (m2: 0). As a CLE is a directed contourless graph, there exists a vertex v of out-degree O. As a result of removing the vertex v, we get the CLE ~I of m elements. By the induction hypothesis, for each vertex of the CLE ~/, the function realized at any of its vertex is defined. Let the removed vertex v be of degree k, and f a logical symbol assigned to v at the CLE~. Let /t(Xl,""X n )"", fk(xl,""x n ) be functions realized at the vertices from which the arcs are coming in the vertex v. Then the function 'Pv realized at the vertex v is defined by the equality:

It is said that a function f is realized or computed by a circuit ~ if the latter has an output realizing this function. A complexity of a CLE is the number of vertices different from inputs (i.e. the number of gates). A CLE ~ is called minimal if it has a minimal complexity among all CLE's computing the functions realized by ~. A complexity of a Boolean function f (system of functions A = {/t, ... , fm}) in a class of CLE's in a basis B is the complexity of any minimal CLE in the basis B realizing the function f (the system A). The complexity of a circuit ~ (function f , system of function A) in a basis B is denoted by LB(~) (LB(J), LB(A)). Further, if the basis is not mentioned, it is assumed that the basis is standard i.e. {V,&,-}. In this case, we will be omit the symbol B in the notation of a complexity of a circuit and write L(~) and L(J). Everywhere in what follows, the logic connectives V, &, ffi, 1, "', I are assumed depending on 2 arguments.

10.1.1. For the circuits of the logical element, shown in Figure 10.2, find the functions realized by these circuits.

Page 284: Problems and Exercises in Discrete Mathematics

10.1. CIRCUITS OF LOGICAL ELEMENTS

'f

d

a

&

b

e

Fig.10.2

275

f. -2

c

1

f

10.1.2. For the given function f(xn), synthesize a CLE in the standard basis with a complexity not exceeding m :

(1) f(x 2 ) =XI . X2, m = 2;

(2) f(x 2 ) = Xl rv X2, m = 4;

(3) f(x3 ) = XIX2 V X2X3 V X3Xb m = 4;

(4) f(x 3 ) = (0111 1110), m = 6;

(5) f(x 3 ) = (0001 1111), m = 2;

(6) f(5;3) = (1000 1101), m = 4;

Page 285: Problems and Exercises in Discrete Mathematics

276 CHAPTER 10. LOGICAL DESIGN

10.1.3. For the given function f(xn), synthesize a formula in the basis B.

(1) f(x 2 ) = Xl EB X2;

(2) f(x 2) = Xl EB X2;

(3) f(x 2) = Xl -+ X2;

(4) f(x 2 ) = Xl -+ X2;

(5) f(x 2 ) = Xl V X2;

(6) f(x 2 ) = Xl V X2;

(7) f(x3 ) = Xl V X2 V X3;

(8) f(x 3 ) = Xl V X2 V X3;

(9) f(x 3 ) = XIX2 V X2 X 3 V X3 X I;

(10) f(x 3 ) = XIX2 V X2 X 3 V X3 X I;

(11) f(x 3 ) = XIX2X3 VXIX2X3;

(12) f(x 3 ) = XIX2X3 VXIX2X

(13) f(x 3 ) = Xl EB X2X3;

(14) f(x3 ) = Xl EB X2X3;

B={I,-}; B = {-+,-}; B={n; B={&,-}; B={I,-}; B={"",&); B={l,-}; B={-+,-}; B={&,EB}; B={-+,-}; B = {-, I,n; B = {&,EB, -}; B= {-,I,n, B={-+,-}.

10.1.4. Synthesize a formula in the basis B for the function defined by the vector:

(1) f(x 2 ) = (1011); (2) f(x 2 ) = (1011); (3) f( x2 ) = (1001); (4) f(x 2 ) = (1001); (5) f(x 2 ) = (10000001); (6) f(x 2 ) = (10000001); (7) f(x 3 ) = (1110 1000); (8) f(x 3 ) = (1110 1000); (9) f(x3 ) = (1001 0110);

(10) f(x 3 ) = (1001 0110); (11) f(x 3 ) = (1010 1110); (12) f(x 3 ) = (1010 1110); (13) f(x 3 ) = (0110 1111); (14) f(x 3 ) = (0110 1111);

B={V,-}; B = {I}; B = {&,-+}; B= U}; B={I,-}; B = {EB, &, -}; B={EB,&,I}; B={-+,-}; B = {EB, I}; B={I,-}; B = {EB,&,-}; B={V,-}; B = {EB,&,-}; B = U,-}.

10.1.5. Realize the function f(x n ) by a CLE in the standard basis after simplifying its formula:

(1) f(x 3 ) = XIX2X3 V XIX2 X 3 V XIX2 X 3 V X IX2 X 3 V X IX2 X 3 V X IX2 X 3;

(2) f(x 3 ) = XIX2X3 V XIX2 X 3 V X IX2 X 3 V XIX2 X 3 V X IX2 X 3 V X IX2 X 3;

(3) f(x 3 ) = XIX3 V X2X3 VXIX2 VXIX3;

(4) f(x3 ) = (Xl VX2 V X3)(XI VX2 VX3)(XI V X2 VX3)(XI V X2 VX3);

(5) f(x 3 ) = (Xl V X2)(XI VX2 V X3) V XIX2 X 3 V X2 X 3;

(6) f(x 3 ) = (Xl V X 2)(X2 V X3)(XI V X2 VX3)(XI V X2 VX3);

(7) f(x 3 ) = XIX2 V XIX3 V XIX2 X 3 VXIX2 VXIX3.

Page 286: Problems and Exercises in Discrete Mathematics

10.1. CIRCUITS OF LOGICAL ELEMENTS 277

10.1.6. Synthesize the CLE in the basis B realizing the system of function F.

(1) F = {I1 = X1X2VX2X3VX3X1; h = Xl EElX2EEl X3}; (a) B = {V,&,-}, (b) B = {EEl,&}, (c) B = {I,l};

(2) F = {II = Xl, 12 = X1X2, h = X1X2X3, 14 = I}; (a) B = {&, -}, (b) B={-,l};

(3) F = { 11 = Xl EEl X2, h = Xl V X2 V X3 V X1 X2X3, h = X1X2 VX1X2}; (a) B = {EEl,&,-}, (b) B = {V,&,-};

(4) F = {I1 = X1X2 V X2 X3 V X1X3, h = Xl '" X2, h = X2 EEl X3}; (a) B = {V,&, -}, (b) B = {L};

(5) F = {II = X1 X2 V X2X3 V X3X1, h = Xl VX2 VX3, h = X1X2X3}; (a) B = {V,&,-}, (b) B = {I};

(6) F = {I1(i4) = X1X3X4VX1X3X4VX2X3X4 V X2X3X4, h = I1(X1,X2,X3,X4)}; (a) B = {V,&,-}, (b) B = {EEl,&,-};

(7) F = {I1(i4) = X1X2X3 VX1X2X3 VX1X2X4 V X1 X2X4, 12 = Xl EEl X 2, h = X2EEl X3, 14 = Xl EEl X4}; (a) B = {V,&,-}, (b) B = {EEl,&,-};

(8) F = {Io = Xl, X2, X3, 11 = X1 X2X3, h = X1 X2X3, h = X1 X2X3, 14 = X1 X2X3, Is = X1 X2X3, 16 = X1 X2X3, h = X1 X2X3, Is = X1 X2X3}; (a) B = {&, -}, (b) B = {V, EEl, I};

D. n.f. method of synthesizing a CLE from a d.nJ. involves the next two stages: (1) d.nJ. minimization of the given function; (2) realizing the obtained d.nJ. by means of a eLE.

10.1. 7. Realize the function I by using the d.nJ. method:

(1) 1= (0100 0110); (2) 1= (0111 1110); (3) 1= (0001 1111); (4) 1= (0001 0111); (5) 1= 1 EEl X EEl zy; (6) I = X EEl y EEl z.

10.1.8. Prove that, if the function 1* is dual to the function I and I different from a constant, then L(f*) = L(f).

A CLE ( in an arbitrary basis) realizing the system of two functions: m( x, y, p) = xy V yp V px and l( x, y, p) = x EEl y EEl p is called a one-digit binary adder.

10.1.9. Synthesize a one-digit binary adder in the basis B with a complexity not exceeding L.

(1) B = {V,&,-}, L = 9;

(2)B={EEl,&}, L=5;

Page 287: Problems and Exercises in Discrete Mathematics

278 CHAPTER 10. LOGICAL DESIGN

(3) B = {-, I, t}, L = 12;

10.1.10. Synthesize the CLE in basis {EB, &} realizing the system of the function {/t(x4), h(x4), /3(x4)} such that V(/t(0:4), 12(0:4), /3(0:4)) is equal to the number of ones in tuple 0:4 = (al, a2, a3, (4). Then the CLE is a binary expansion of the number of ones of the tuple 0:4( it is the same as stated earlier v( aI, ... , an) = L:I<i<n ai ·2n- i).

The circuit Dn realizing the of all conjunctions of rank n depending on variables XI, X2, ••• , X n , is called a decoder.

6. 10.1.11. (1) Synthesize D2 in the basis B = {&, -} with a complexity equal to

(2) Synthesize Dn in the basis B = {&, -} so that

L(Dm) ::; 2n+1 + n - 4.

(3) Synthesize Dn in the basis B = {&, -} so that

L(Dn) ::; 2n + 2(n+3)/2 + n.

10.1.12. A circuit Mn realizing the function

f(xI, ... , Xn , Yo, YI,···, Y2n-d = V YV(<7I, ... <7n)x? .. x~n, (<7I, ... ,<7n)

where V(O"I, •.. O"n) = L:19~n 0";. 2n-i, is called a multiplexer of variables Xl, ••• ,Xn,

Yo, YI, ..• , Y2 n -l·

(1) Synthesize M2 in a standard basis with a complexity not exceeding 13.

(2) Prove that L(Mn) ::; 3· 2n + 2(n+3)/2 + n.

(3) Prove that L(Mn) ~ 2n - l .

10.1.13. A universal network for the set of variables X is CLE U(X) realizing all the Boolean functions of variables from X. Denote u(xn) by Un, where xn = {XI, ••. ,Xn }.

(1) Synthesize the CLE U1 with a complexity 3.

(2*) Prove by induction that the complexity of the minimal network Un is equal to 22n - n.

(3) Prove that there exists a CLE in the basis {V, &, EB, -} realizing all self-dual functions f(xn) with a complexity not exceeding 2 . 22n- l

10.1.14. Let Dn - k be a decoder for the set of variables X!, ••• , Xn-k, X {Xl, ... , Xn-k} and Uk the universal network for the set of variables X' = {Xn -k+1, ..• , xn }.

(1) Prove that, for an arbitrary Boolean function f(xn ),

Page 288: Problems and Exercises in Discrete Mathematics

10.1. CIRCUITS OF LOGICAL ELEMENTS 279

(2) Using the results of the Problems 1.14 (1), 1.11 (3), and 1.13, prove that for any f > 0, essentially great n, and any Boolean function f(:in), the following inequality holds:

The function f(:in) such that N, = U~kBi is called a (k, m)-belt function. Denote the (k, m)-belt function by sk,m (:in). The function Sk,k (:in) is called an elementary symmetric function. The function f(:in) realizing a disjunction of an elementary symmetric functions is called symmetric.

10.1.15. (1) Prove, that for any permutation 7r = (ib ... , in) of numbers 1, , n, and for any symmetric function f(:in), the following equality holds:

(2) Prove that for any belt function, there exists a CLE with the number of elements of negations not exceeding (n + 1)/2.

10.1.16*. Synthesize the CLE realizing three one-place functions Xl, X2, X3 and containing exactly two elements of negation.

10.1.17. Prove that L(x (f) y) = 4.

The depth of a CLE in the basis B, is the maximal number of the internal vertices (logical elements) in ordered chains connecting an input and an output. For example, the depth of the circuit, shown in Figure 10.1 (a), is equal to 3.

10.1.18. Synthesize a CLE of depth I for the function fi :

(1) It = XIX2X3X4, 1=2;

(2) h = X2X3 V XtX2X3, 1= 2;

(3) h = Xt (f) X2 (f) X3, 1 = 6;

(4) f4 = Xt(X3 V X4)(XS V X6) V X2(X3X S V X4 X S V X4 X 6 V X3X6), 1 = 3;

(5) fs = Xl VXIX2 VXIX2X3 VXtX2X3X4, 1 = 2;

(6) f6 = (XIX2 V X2 X 3 V X3 X t) V(Xt (f) X2 (f) X3), 1 = 2.

10.1.19. The CLE ~ is called connected if the graph obtained by replacing the arcs of the CLE by edges is connected. Let the CLE ~ be a connected circuit with a single output of out-degree equal to zero.

(1) Prove that L(~) ~ 21+1 - 1, where I is the depth of the circuit ~.

Page 289: Problems and Exercises in Discrete Mathematics

280 CHAPTER 10. LOGICAL DESIGN

(2) Prove that any minimal CLE with one output is connected.

10.1.20. Prove that, for any I, there exists a minimal CLE of depth I.

10.1.21. Prove that any CLE realizing a function f(x n ), depending essentially on all its variables, has a depth not exceeding log 2n - 1.

10.2 Contact Circuits

Let r be a network with k poles. Marking each edge of r by a letter from the alphabet

xn = {Xb X2, ... , xn,i1,i2 , ••• , in}, we obtain the object E called a k-pole contact circuit realizing Boolean functions of variables Xb X2, . .. , Xn or, in short, a (k, n)­circuit. (2, n) -circuits will be called Xn-circuits. The network r is called a network of the contact circuit E. A contact circuit is called connected (strongly connected, parallel-series and so on), if its network has the same property. A parallel-series contact circuit is briefly denoted as 7r-circuit. The edges of a circuit labelled by the symbols of variables or their negations are called contact. A contact marked by the symbol of a variable (or its negation) is called a closing (resp. breaking) contact. Let El and E2 be two k-pole contact circuits whose poles are labelled by the letters at, a2, ... , ak. The circuits El and E2 are called isomorphic if their networks are isomorphic and if

(a) the corresponding edges are labelled in the same way, and (b) the corresponding poles are labelled in the same way. Let a and b be two poles of the contact circuit E, and let [a , b] be a chain joining

a and b. Let K[a,b] be the conjunction of the letters assigned of the chain [a,b]. The function fab(xn), defined by the formula

falxn ) = [a, b] V K[a,bj, [a,b]

where the disjunction is taken over all simple chains in the circuit joining the poles a and b, is called a conductivity function (between poles a and b of the circuit E). A circuit E is said to realize a function g(t) if it contains the poles a and b such that g(xn) = fali/).

A contact circuit with k + 1 poles is called a contact (1, k)-pole network, realizing . ~n ~n . . ~n

a system of functIOns gl(X ), ... ,gk(X ), If for any functIOn gi(X ) (1s i S k), there exists a pole bi such that gi('Xn) = fab, ('Xn). When drawing a (1, k)-pole network, the pole a is marked by a light circle and called an input, the poles b; are marked by the double circles and called outputs, all others vertices are marked by the black circles. In a similar way, the notion of a contact (k, 1)-pole network, can be defined.

If the number of poles in a contact circuit is not indicated, we shall always mean two-pole circuits. Two contact circuits are called equivalent if they realize the same Boolean function, or the same system of the functions. A complexity of a contact circuit is the number of its contacts. A contact circuit having the lowest complexity among all equivalent circuits is called minimal. A complexity of a Boolean function f

Page 290: Problems and Exercises in Discrete Mathematics

10.2. CONTACT CIRCUITS 281

in a class of contact circuits (notation Lk(f)) is the complexity of a minimal contact circuit realizing f. A complexity of a Boolean function f in the class of 7r-circuits is the number of contacts in the minimal 7r-circuit realizing f (notation L,,( f)). The concept of a formula generated by a set of logic connectives was defined in Chapter 1. A complexity of a Boolean function f in a class of formulas (generated by a set of connectives {V, &, -} ) is the number of entries of the symbols of variables. In this class of formulas, a complexity of a function fis denoted by LI)( f ).

a a

a b

a

d e

Fig.l0.3

10.2.1. Find the functions represented by the two­pole contact circuits ~ that are shown in Figure 10.3.

One of the ways to synthesize a contact circuits for a given Boolean function consists of the representation of the function by simple enough d.n.f. (or c.n.f.), accom-

c

a

f

panied by the realization ofthe obtained d.n.f. (or c.n.f.) Fig. lOA with the contact circuit. The last can be obtained by constructing the circuit for each elementary conjunction K = xiII & ... &xi: (disjunction D = xiII V ... V xi:). This circuit is the series (parallel) junction of contacts XiII, ... ,xi: . Then we combine parallel (series) junctions to obtain the required circuit.

Example 1. Construct a circuit for the function f(x3 ) be realized by its value vector (1101 1100).

Solution. Write the perfect d.n.f. of the function f and then simplify this d.n.f.:

The circuit corresponding to the last d.n.f. is shown in Figure IDA.

Page 291: Problems and Exercises in Discrete Mathematics

282 CHAPTER 10. LOGICAL DESIGN

10.2.2. Representing a function f by a d.n.£. or a c.n.f., synthesize a 7r-circuit realizing the function f :

(1) fUe) = (1101); (2) f(x2) = Xl '" X2;

(3) f(x3 ) = (1000 1111); (4) f(x3 ) = (1110 1000);

(5) f(x 3 ) = (0100 0010); (6) f(x3) = (Xl --+ X2)(XI EB X2);

(7) f(x3) = XIX2 EB X2X3 EB X3XI EB 1.

10.2.3. Synthesize a contact circuit realizing the function f :

(1) f(x3) = (Xl V X2 V X3)(XI VX2 VX3);

(2) f(x3) = XIX2 EB X2X3 EB X3XI;

(3) f(x3) = Xl EB X2 EB X3 EB 1;

(4) f(x3) = (Xl V X2 X3)(XI V X2);

(5) f(x3) = (Xl I X2) 1 (X3 I X2);

(6) f(x3) = Xl EB X2X3 EB 1;

(7) f(x3) = (Xl VX2X3)(XI EB X3)'

10.2.4. Synthesize a contact circuit with a complexity not exceeding I and realizing the function f:

(1) f(x3) = Xl EB X2X3, 1=6;

(2) f(x3) = XIX2 EB X2X3 EB X3XI EB 1, 1=5;

(3) f(x3) = XIX3 V X2X3 VXIX2X3, 1=5;

(4) f(x3) = XIX2 VXIX2X3 VXIX2X3 VXIX2, 1=5;

(5) f(x4) = XIX4 V X2 X3X4 V X2 X3X4 V XIX4, 1=7;

(6) f(x3) = (Xl EB X2 EB X3)(XI V X3), 1=5;

(7) f(x4) = (0000 0001 0111 1111), 1=7.

10.2.5. Synthesize a contact circuit with a complexity not exceeding L for the function f, after simplifying its formula if:

(1) f = ((Xl V X2)(X2 V X4) V(X3 VX4)(XIX2X3 V X4XS))((XI V X2X3), L = 5;

(2) f =XI VXIX2 VXIX2X3 VXIX2X3X4, L = 4;

(3) f =( Xl V X2)( (XIX2 V X2 X3)X6

Page 292: Problems and Exercises in Discrete Mathematics

10.2. CONTACT CIRCUITS 283

10.2.6. Synthesize a contact circuit of complexity not exceeding L and realizing the system of functions cI> :

(2) cI> = {h = (00000001), h = (00000011), h = (00000111), /4 = (00001111), /s = (00011111), /6 = (00111111), h = (01111111)}, L = 11;

(5) cI> = {h = (00000001), h = (00010111), h = (01111111)}, L = 9;

Page 293: Problems and Exercises in Discrete Mathematics

284 CHAPTER 10. LOGICAL DESIGN

a

b

a~ Xl X2

X2

... ~ ~ Xn_ .An-1

... . b Xn-2 Xn-1 Xn

c

d

a

a e

Fig.10.5

(6) <I> = {II = (10010110), h = (01101001), h = (00111100), h = (11000011)}, L = 10.

10.2.7. Find the functions represented by the contact circuits shown in Figure 10.5.

10.2.8. Let v(ii) = L:i=12iai be the number of the tuple ii = (al,a2, ... ,an ).

Synthesize a contact circuit with no more than I contacts realizing the function f:

(1) f(x4) = { 1, if v(a~,a2) ::::: v(a3,a4), o otherWIse, 1= 7;

(2) f(x4) = { 1, if v(a~,a2) = v(a3,a4), o otherWIse, I = 8;

Page 294: Problems and Exercises in Discrete Mathematics

10.2. CONTACT CIRCUITS

(3) f(x 4 ) = { 1,ifO'I~O'2=O'3+O'4' o otherWIse, 1= 12;

(4) f(;;;4) = { 1, if 0'1 ~ 0'2 = 0'3 + O'4(mod 2), o otherwIse, I = 8;

(5) f(X4) = { 1, if 0'1 ~ 0'2 :::; 0'3 + 0'4, 0; otherwIse, I = 10;

0'2:::; 0'4, {

1, if 0'1 :::; 0'3 &

(6) f(x4 ) =

o otherwise, I = 4;

(7) f( x4 ) = { 1, if the ~uples (0'1, O'2)and (0'3, O'4)are incomparable, o otherwIse, I = 8.

a b

Fig.10.6

10.2.9. Synthesize a contact circuit realizing the one-digit binary adder.

285

A contact (1, 2n )-circuit D~, the definition by induction of which is shown in Figure 10.6, is called a contact Xn-tree. Obviously, D~ realizes all conjunction of rank n of variables Xl, •.. ,Xn and Lk ( D~) = 2n +l - 2. The (1, m )-circuit is called dividing if, for each two outputs band c of this circuit, the conductivity function

Ac(xn ) == O.

10.2.10. (1) Synthesize D~.

(2) Prove that D~ is a dividing (1,2n )-circuit.

(3) A system of functions iD is called orthogonal if, for each two functions f and g from the system iD, f&g = O. Prove that, for any orthogonal system of func­tions iD = {h(xn), ... , fm(xn)}, there exists a contact circuit with a complexity not

Page 295: Problems and Exercises in Discrete Mathematics

286 CHAPTER 10. LOGICAL DESIGN

exceeding 2n+1 - 2, realizing ~.

10.2.11. Let A be a dividing contact (I,k}-pole network with poles a, bl , ... , bk

and let B be a contact (m,I}-pole network with poles al,oo., am, b. Let some of poles b; be identified with some of the poles aj. Prove that any circuit L:, obtained by means of such an operation, has the following property:

k _

fa,b(Xn) = V fa,bi(Xn)/b"b(Xn), ;=1

where fa,b(Xn) is the conductivity function between poles a and b of the circuit L:, fa,bi (xn) is the conductivity function between poles a and b; of the circuit A, /b"b(Xn) is the conductivity function between poles aj identified with the pole b; of the circuit A and the pole b of the circuit B.

(1,22n )_ or (22n,I)-circuit realizing all functions f(XI,X2,oo"Xn) IS called a universal contact circuit. A circuit is shown U~ in Figure 10.7

Fig.1O.7

Shannon's method of obtaining a contact circuit realizing a Boolean function f(xn), consists of using the circuits D~_m and U!.

Let f(xn ) be a function which needs to be realized by a circuit. For an arbitrary tuple a = (0"1,'" ,O"n-m) in Bn-m, put

By the decomposition formula, we have

f(xn) = V X~l ••. x~':-;: Jq(xn). Q=(0'1, .. "Un-m)

Let D~_m be a contact tree with the poles a, bo, bI, . .. ,b2n-m_l realizing the conjunctions Kv- = X~l .•. x~':-;: between the poles a and bk , where is k =

lI(a) = E7~lm 2::-m- i O";. Let U! be the universal (22m , I)-circuit with the poles ao, al, ... , a22m-1, b realizing all functions f(xn- m+1,"" xn).

Consider the circuit L: f obtained by identifying, for each a E iJn - m , the output b,,(;j ofthe circuit D~_m and input ar ofthe circuit U!, such that far,b(Xn- m+1,' .. , xn) = Jq(xn) (Figure 10.8).

Page 296: Problems and Exercises in Discrete Mathematics

10.2. CONTACT CIRCUITS 287

Fig.l0.8

Taking into consideration that the circuit D~_m is dividing, we have for the obtained circuit Ej

la.bUin) = V X~l ••• x~~-;;; h(in) = I (in). (Tl •...• (Tn-m)

Note that from the synthesis method, the following equality follows

L(Ej) = L(D~_m) + L(U!).

10.2.12. (1) Synthesize U; with the number of contacts not exceeding 16.

(2) Prove by induction on n that there exist U: such that

(1)

(3) Prove by choice of a suitable m in the equality (1) that for any E > 0, for sufficiently large n, and for any Boolean function I (in), the following is valid

The cascade method for contact circuits synthesis consists of the following. Let I(Xl, ... , xn) (n 2 2) be a Boolean function which needs to be realized by a contact circuit. By \[Ii (i = 1, ... , n - 1), we denote the set of all subfunctions I(O'l, ... ,O'i,Xi+b ... ,Xn ), (O'l, ... ,O'i) E Bi of the function f. To each I E \[Ii

(i = 1, ... , n - 1), we put in correspondence, some point v j of a plane. Denote the set of these points by V;. The points corresponding to the functions from \[I i are

Page 297: Problems and Exercises in Discrete Mathematics

288 CHAPTER 10. LOGICAL DESIGN

called i-th rank vertices. Denote by 11; the set of all vertices of i-th rank. We add three more poles, viz. input pole a and output poles band c. Pole a is the vertex of rank zero, while poles b and c are the vertices of rank n. The function f (Xl, ... , xn)

corresponds to pole a. The functions, identically equaled to 1 and 0, correspond to poles band c, respectively. Put V = {a, b, c} U Ui~ll 11;.

Decompose the set V into the equivalence classes. The vertices from V are said to belong to one equivalence class if they correspond to the equal functions. We paste together the vertices corresponding to the same equivalence class K in a single vertex WK.

Let a function ~v(Xi+t, Xi+2,' •. , xn) of i-th rank from the equivalence class K be not equal to its subfunction ~v(l, Xi+2, .•. , xn) (~v(O, Xi+2, .•• , Xn)) from class L (M). Then we connect the vertex WK with the vertex WL (the vertex WM) by the contact Xi+1 (respectively, by the contact 3:;+1)'

So doing, we get circuit L,j such that fa,bCin) = J(xn), fa,c(x n ) = f(xn) . If we need to realize only the function f, then the vertex c corresponding to the constant 0, may be deleted together with the incident contacts.

In the sequel, under the circuit L, obtained by the "standard" cascade method, we will assume the circuit without vertex c. The cascade method can be reconstructed in the obvious way for the realization of systems of functions.

Example 2. Realize f(x3 ) = XtX2 EB X3 by the cascade method. We have Wi = {X3,X2 EB X3}, Wi = {X3,X3}, w; = {0,1}. Put Vo = {a}, Vi = {1,2}, V2 = {3,4}, V3 = {5,6}. The vertices 1 and 4 corresponding to the function X3 are equivalent. The way of drawing edges is shown in Figure 10.9 (a). The circuit obtained by identifying equivalent vertices and deleting the vertex 0 shown in Figure 10.9(b).

a a

a b

Fig. 10.9

10.2.13. Using the cascade method, synthesize a contact circuit realizing the function f:

(1) f(x3) = XIX2X3 EB X2X3 EB X3 EB 1;

(2) f(x3 ) = XIX2 V X2 X3 V X3 X l;

(3) f(x3 ) = Xl EB X2 EB X3 EB 1;

Page 298: Problems and Exercises in Discrete Mathematics

10.2. CONTACT CIRCUITS

(4) f(x3 ) = (Xl V X2 V X3)(XI V X2 V X3);

(5) f(x 3 ) = (0110 1000);

(6) f(x 3 ) = (0110 1101);

(7) f(x 4 ) = (0000 0001 0111 1111).

289

10.2.14. Using the cascade method, synthesize a contact circuit realizing the system of function <P:

(1) <P = {xy, X V y};

(2) <P = {X2 EB X3, Xl EB X2 EB X3, X2};

(3) <P = {X3, X3, X2 EB X3, X2 rv X3, Xl EB X2 EB X3, Xl EB X2 EB X3};

(4) <P = {X2& X3, X2 V X3, X3, XIX2 V X2 X 3 V x3xd;

(5) <P = {II =XI EB X2 EB X3, h = (Xl V X2)X3 V XIX2};

(6) <P = {h = XIX2 X 3 VX IX2 X 3, h = XIX3 VX 2};

(7) <P = {Xl V X2, Xl VX 2, Xl V X2, Xl VX 2};

(8) <P = {XIX2, XIX2, XIX2, XIX2}'

10.2.15. Prove that the circuit L;j, obtained by the cascade method for a func­tion f(x) different from the constant 0, is strongly connected.

10.2.16. Prove that the circuit L;<I> realizing a system offunctions <P and obtained by the cascade method, is dividing if the system <P consists of pairwise orthogonal functions.

10.2.17. (1) Prove that the complexity of the universal contact network U~ obtained by the cascade method, does not exceed 2 . 22n.

(2) Prove that for any ( > 0, any function f(xn), and for the circuit L;j obtained for f by the cascade method, the following inequality holds: L(L; j) :::; (1 _ () . 2n;2.

10.2.18. Prove that the circuit D~,k realizing all elementary k-th rank conjunc­tions of variables Xl, ... , xn obtained by a cascade method, is the contact tree of complexity 2n+I - 2.

10.2.19. Prove that there exists a circuit D~ realizing all n-th rank disjunctions of variables Xl, ... , X n , such that

10.2.20. The function <,Om(:rn) (0:::; m :::; 2n) is called staircase, if <,Om(iin) = 1, whenever v(a) 2: m. Put <P(n) = {<,Om(an), 0:::; m :::; 2n}.

(1) Prove the following properties of the staircase functions:

Page 299: Problems and Exercises in Discrete Mathematics

290 CHAPTER 10. LOGICAL DESIGN

(d) (-n) = { Xl V 'Pm-2n- 1 (X2, • •• , Xn) if 0 < m ::; 2n-t, 'Pm X ( ) ·f 2n- 1 < < 2n Xl • 'Pm X2, •• ·, Xn 1 m _ ;

(e) 'P2k(Xn ) does not depend essentially on the variable Xn (k = 1, ... , 2n- I );

(f) 'Pm(xn) is a monotonic function.

(2) Prove that the complexity of the circuit realizing cI>(n) obtained by the "straight" cascade method, when the functions of the i-th level are decomposed by the variable Xi, is equa:l to 3 . 2n - 2n - 3.

(3) Prove that the complexity of the circuit realizing cI>(n) obtained by the "inverse" cascade method, when the functions of the i-th level are decomposed by the variable Xn-i+l, is equal to 2n+1 - n - 2.

10.2.21. Let the circuit E contain a contact xC< and let E' (E") be a circuit obtained by series (respectively, parallel) connection of this circuit with the circuit consisting of a single contact xfJ, a,j3 E {O, I}. Prove that the circuits E' and E" are not minimal.

10.2.22. Show that a minimal circuit EJ realizing a function f(x) different from the constant 0, is strongly connected.

10.2.23. Prove that there are no minimal contact Xl-circuits with two contacts and X2-circuits with three contacts.

10.2.24. Show that there are no minimal contact X 3-circuits of complexity 4 containing closing contacts only.

10.2.25. Prove that a minimal contact circuit for the function f = xEBy contains four contacts.

A contact circuit is called repetition-free if each variable occurs not more than once in a circuit as a label of a contact.

10.2.26. Prove that a strongly connected repetition-free circuit

(1) realizes a function depending essentially on all variables encountered in the circuit;

(2) is minimal.

10.2.27. Show that, for each natural m, there exists a minimal contact circuit of complexity m.

10.2.28. Let E be a minimal circuit. Join to E a new contact labelled by a new variable in such a way that a strongly connected circuit is obtained. Prove that the

Page 300: Problems and Exercises in Discrete Mathematics

10.2. CONTACT CIRCUITS 291

obtained circuit is also minimal.

10.2.29. Let LtU) be a minimal number of contacts in the circuit I: f which contains only closing contacts. By m(x3), denote the function XIX2 V X2X3 V X3Xl.

(1) Find two circuits of complexity 5 with nonisomorphic networks, containing only closing contacts and realizing m(x3 ).

(2) Prove that Lt(m(x3 )) 2: 5.

(3) Prove that if a circuit I: contains only closing contacts and realizes m(x3), then there exist variables Xi, Xj such that for each of these variables, the circuit I: contains no less than two contacts labelled by xi, X j.

(4) Let Kl = X2X3, K2 = X4X5 and I(x5) = m(xbkbk2). Prove that LtUUi5)) = 8.

(5) Prove that L k ( I(x5)) ::; 7.

Let a 2-connected two-pole contact circuit I: be planar, and f(a, b) be its network. Let the poles a and b lie on one face of f(a, b). Draw an edge (a, b) in this face so that the obtained network f'(a, b) is also flat. Choose a point into each of the faces of f'(a, b). Using the chosen points as vertices, construct a graph G* by drawing an edge between every two points lying in the neighboring faces of f'(a, b). We draw the edges so that each of them intersects one contact lying on the common boundary of their faces. Denote by a* and b* the points lying in the faces of f'(a, b) divided by the edge (a,b). Each edge of the graph G*, other than (a*,b*), intersects a contact of the circuit I:. We label this edge by the same letter that is used to label the contact intersected by it. Let us denote the vertices of the graph G* located on the faces of the network f' divided by the edge (a, b) by a*, b* and call them poles. We delete the edge (a*, b*) from G*. As a result, we obtain a 2-connected circuit I:* with poles a* and b*. The circuit ~* is called a circuit dual to r. The process of obtaining a dual circuit shown in Figure 10.10.

;-_.-.-.- ........

a a "' "-\

X t a* a*<:>-LC>b*

y u

b b

a b c

Fig.1O.10

Page 301: Problems and Exercises in Discrete Mathematics

292 CHAPTER 10. LOGICAL DESIGN

10.2.30. Synthesize the circuits dual to those shown in Figure 10.11.

x X y a b a<:;Xi)b a o--:!---Q b

a b c

y z a b a€9h a b

d e f

Fig. 10. 11

10.2.31. Prove that the contact circuit ~* dual to ~ realizes a Boolean function dual to the function realized by the circuit ~.

10.2.32. Prove that for any Boolean function f, such that Lk(f ) :::; 7, the equality Lk(f) = Lk(f*) = Lk(f) holds.

10.2.33. Prove that, for any Boolean function f, the equality L,,(j ) = L1f(j*) holds.

10.2.34. Let f be the function realized by the circuit shown in Figure 10.12. Prove that a function dual to f cannot be realized by a repetition-free circuit.

a

Fig.1O.12

10.2.35. Is the relation Lk(f ) = Lk(f) true for all Boolean functions f? 10.2.36. Prove that, for any Boolean function f, the equality Lifl(f ) = Ln(f)

is valid. The lower estimates of complexity are frequently obtained by using the so-called

"pigeon-hole principle". The following statement is an example. Let S(n, m) be the size of some class K, of circuits realizing a Boolean function

depending on the variables Xl, X2, . .. ,Xn and having a complexity not greater than

Page 302: Problems and Exercises in Discrete Mathematics

10.2. CONTACT CIRCUITS 293

m. Let ~(n) be the number of Boolean functions f(xn ) of some set 3. Then, if S(n, m) < ~(n), there exists the function f(xn) E 3 that cannot be realized by a circuit of complexity less than or equal to m from the class K.

10.2.37. Show that the number S(n, m) of connected pairwise nonisomorphic xn contact circuits of complexity no more than m, does not exceed (cnm)m, where c is a constant independent of nand m.

10.2.38. Show that the number P(n, m) of connected pairwise nonisomorphic x-circuits having a complexity of no more than m and realizing Boolean functions of variables Xl, X2, • •• ,Xn , does not exceed (en)m, where c is a constant independent of nand m.

10.2.39. Show that the number <I>(n, m) of pairwise different formulas of complexity no more than m generated connectives (V, &, -) and by the set of variables XI, X2, ••• , X n , does not exceed (en)m, where c is a constant independent of nand m.

CLE is called irredundant if each vertex of this circuit belongs to some ordered chain which connects one of the inputs of the circuit with the output.

10.2.40. (1) Show that, for each Boolean function f, there exists an irredundant circuit-realizing f

(2) Let N( n, m) be the number of irredundant CLE in the standard basis realizing the functions of variables XI, X2, •.• ,Xn and having a complexity not greater than m. Prove that

N(n,m)::; (e(n+m)?+m,

where c is a constant independent of n and m. 10.2.41. (1) Prove that, for any to > 0 and sufficiently large n, there exists a

Boolean function f(xn ) such that

L(f)? 2:(1- to).

(2) Prove that a part S. of functions not satisfying the inequality from the item (1), tends to zero for n -+ 00.

10.2.42. Prove that, for any to > 0 and sufficiently large n, there exists a self-dual function f(xn ) such that:

(1) Lk(f ) ? 2n:

1 (1 - to);

(2) Lk(f ) ? l!:~~ (1 - to). 10.2.43. Prove that, for any to > 0 and sufficiently large n, there exists a function

f(xn) which is a superposition offunctions ~(x,y,z) = xyV z and is such that:

Page 303: Problems and Exercises in Discrete Mathematics

Part II

ANSWERS, HINTS, SOLUTIONS

Page 304: Problems and Exercises in Discrete Mathematics

Chapter 1

Representations of Boolean Functions

1.1 Tabular Representations

1.1.1. (1) 11; (3) 205; (5) 2m +! + 1.

1.1.2. (1) (101); (3) (11000); (6) Q = (1 0 ... 0 1). ~

m -1 times

1.1.4. (1) (~); (2) (~=D; (3) 2n • (2n - 1);

(6) (~) . C/;)-k) . (2k:(r~2)) for even T such that 2k ~ T ~ 4k, 0 for odd T;

(7) 2k.

1.1.5. (1) 22n-l; (2) 22n-([n/2J); (3) 22n- l ; (4) 2n+l;

(5) LO:<:;i9n-1 en; (6) 2n+l.

1.2 Formulas

1.2.1. (2) See Fig. 0.1.1; (4) See Fig. 0.1.2; (5) See Fig. 0.1.3; (7) See Fig. 0.1.4.

1. 2.2. (1) (( (0 EB (x EB (y V x))) V x) & (y EB ((...,x) -+ 1))) ; (2) <p (f (g (<p(I), x, f (y, <p(y))), 1)).

1.2.3. (1) Q/A = (11111110); (2) Q/A = (0111 0000).

1.2.4. (2) Qh = (0101); (4) Qh = (10010011); (6) Qh = (1100001111000101).

297

Page 305: Problems and Exercises in Discrete Mathematics

298 CHAPTER 1. REPRESENTATIONS OF BOOLEAN FUNCTIONS

1.2.5. (2),(6) Yesj (3),(7) No.

1.2.10.(1) In five ways. (2) In nine ways.

1.2.12. (1) Basis of induction. If the complexity of a formula is unity (generated by the set of connectives M = {..." & j V, -+}), this formula has one of the following forms: (...,x), (x&y), (x V y) or (x -+ y) (within the notation of variables). Therefore, the statement of obvious for formulas of complexity 1. Induction step. Let the statement be valid for all formulas (generated by the set of connectives M) of complexity not exceeding a number l(l ~ 1). We take an arbitrary formula A (generated by M) of complexity 1 + 1. For the sake of definiteness, we assume that A = (BVO) (remaining cases are considered similarly). The connective V between formulas Band 0 has an index equal to unity. Further, if the connective in formula B (or 0), treated as a connective of formula B (resp. 0), has an index equal to unity, its index of this connective in formula A cannot be lower. If, however, the connective in A (or 0) has an index equal to unity, its index in formula A will be equal to 2 (the index increases since formula A contains a left parenthesis before subformula B).

1.2.15. (3) (0 1 0 0).

1.2.18. (3) A", B.

1.2.19. (2) h(x, y) == 0, f2(X, y) = x, h(x, y) = y, f4(X, y) = x EB y.

1.2.20. (1) ((x L y) L (x L y)). (2) ((x L y) L ((x Lx) L (y L y))).

1.2.21. (1) ((x I y) I (x I y))j (2) ((xV(xVy)) '" y). (3) No, it cannot. 1.2.22. (2) The function represented by a formula generated by the set {-+}

takes the value 1 on at least half the tuples of values of its arguments. The function xy does not satisfy this condition.

1.2.23. In general, it is impossible. For example, for S = {""}, the function x cannot be represented by a formula of even depth generated by S.

1.2.24. If only the constant functions can be represented by a formula generated by the set S, the statement is obvious. Let a certain function f(xn) ¢. const be represented by a formula generated by S. Identifying all the variables in the function f(x n ) and in the formula representng it, we obtain a function <p(x) (and the formula A(x) corresponding to it). We must consider the following three cases: (a) <p(x) is a constant, (b) <p(x) = x and (c) <p(x) = x. Having obtained (in cases (b) and ( c)) a formula representing the function x (and having a depth not less than 1), we can construct a formula of an indefinitely large depth for each specific function represented by a formula generated by S. Let <p(x) == o. Then there exists a tuple 0: = (al, ... , an) on which the function f is equal to 1. Substituting x for all Xi corresponding to ai = 1 and <p( x) == 0 for the remaining Xi, we obtain a function 1j;(x) = x. If <p(x) == 1, the function x can be obtained in a similar way.

1.2.26. (2) xVy = (x -+ y) -+ y. (3) x'" y = (x -+ y)&(y -+ x).

1.2.30. (2) In general, it cannot. For example, A = Y2 -+ x is a formula which is not identically true. However, the formula S;1 -+Y2 A I = Y2 -+ (YI -+ Y2) is identically true.

Page 306: Problems and Exercises in Discrete Mathematics

1.4. POLYNOMIALS 299

1.2.31. (1) If we assume that f(O, 0) = 0, then putting x = y = z = 0, we obtain f(1(O, f(O, 0)), f(1(O, 0), f(O, 0))) = f(1(O, 0), f(O, 0)) = 0, which contradicts the conditions of the problem. Thus, f(O, 0) = 1. Putting f(O, 1) = 0, we obtain (for x = y = z = 0)(1(0, f(O, 0)), f(f(O, 0), f(O, 0))) = f(1(O, 1), f(l, 1)) = f(O, f(l, 1)) and by hypothesis, the relation f(l, 1) = ° must be sutisfied. However, considering that x = 0, y = z = 1, we see that f(1(O, f(l, 1)), f(1(O, 1), f(O, 1))) = f(f(O, 0), f(O, 0)) = 0, which is a contradiction in the conditions of the problem. Thus, f(O, 1) = 1. Finally, assuming that f(l, 1) = ° and putting x = y = ° and z = 1, we get f(1(O, f(O, 1)), f(f(O, 0), f(O, 1))) = f(1(O, 1), f(l, 1)) = f(l, 0). Taking into account the condition of the problem, we obtain f(l, 0) = 1. But in this case, f(f(l, f(l, 1)), f(f(I, 1), f(l, 1))) = f(f(I, 0), f(O, 0)) = f(l, 1) = 0, which contradicts the condition of the problem. Consequently, f(l, 1) = 1 as well. Thus, f(O, 0) = f(O, 1) = f(l, 1) = 1. Hence, f(x, y) = x --t y or f(x, y) == 1. The equivalences (a)-(e) are verified directly (for example, by using the basic equivalences).

(2) No, they do not. It is sufficient to consider the function f(x, y) = X rv y.

1.3 Disjunctive and Conjunctive Normal Forms

1.3.4. (1) Q9(XI,X3) = (1100); (2) Q9(XI,X2) = (1110); (3) Q9(X2,X3) = (1000); (4) Q9(X2,X3) = (0111).

1.3.6. 2n. 1.3.7. (1) 2n - n - 1; (2) n + 1;

(4) 2n - 1; (5) (2n +1 + (_l)n) /3;

(3) (2n+l + (-I)n) /3;

(6) 2n - 1 + 2;

(7) 2n - 1 - 1 if n is odd and 2n - 1 + 1 if n is even.

1.3.8. (1) k x I; (2) k x 2m + I x 2n - k x I; (3) k(2m -I) + 1(2n - k).

1.3.9. (2) f6(x 3) = X2X3; fJ(x 3) = Xl; f~13(x3) = 1.

1.3.10. The functions Xl EB X2 and Xl rv X2 have 7 subfunctions.

1.3.11. 2(3j4)2n.

1.3.12. 12. 1.3.16. 4.

1.4 Polynomials

1.4.1. (~). sr sr-I k k (n) 1.4.2. 2 n - 2 n ,where Sn = Li=O i .

1.4.3. ° if k is odd and en;l) if k is even.

Page 307: Problems and Exercises in Discrete Mathematics

300 CHAPTER 1. REPRESENTATIONS OF BOOLEAN FUNCTIONS

1.4.4. (1) XIEBX2EB1; (2) XIX2 EB X2 EB 1; (3) X2X3 EB Xl EB X2 EB X3'

1.4.5. (1) S(Pj ) = (1101);

(3) S(Pj ) = (01001110);

(5) S(Pj ) = (0110110000100111);

(7) S(Pj ) = (0110110111011101).

1.4.8. (1) We have

Xl V X2 = XI&X2 = 1 - ((1 - xd . (1 - X2)) = Xl + X2 - XIX2.

1.4.9. f(x n ) = XIX2' "xn'

1.4.12. Hint. Using the decomposition formula, carry out the proof by induction on n.

1.4.13. (1) 2n - k + 2k - 2;

1.4.14. For n = 1, the statement is obvious. We proceed by induction from n - 1 to n. If I ::; 2n-l, by inductive hypothesis there exists a polynomial P( xn - l ) of a length no more than n - 1, for which INpl = 1. Then the polynomial xnP(xn - l )

becomes equal to unity at 1 vertices of the cube En. If 2n - 1 < 1 ::; 2n; we consider the polynomial P(xn - l ) which becomes equal to unity at 2n -I vertices of the cube En-I. Then the polynomial xnP(xn - l ) EB 1 is one sought.

1.4.19. Hint. The existence of the polynomial Pj realizing f follows from Problem 1.4.10. The uniqueness follows from the existence and from the fact that the number of polynomials p(xn) is equal to the number (22n) of functions f(xn).

1.5 Essential and Unessential Variables

1.5.1. (1) Xl; (2) X2; (3) Xl; (4) Xl EB X2.

1.5.2. (1) X3; (2) XI,X2; (3) X4; (4) Xl.

1.5.3. (1) f = 0; (2) f = 1; (4) f = X3; (4) f = 1.

1.5.4. (1) Xl; (2) X2; (3) X2, X3; (4) X}, X2, X4.

1.5.7. m. 1.5.8. (1) XI, X2, X3,X4; (2) X},X2,X3; (3) X3,X4; (4) Xl, X2, X4.

1.5.10. (1) n ::; 3; (2) No values of n; (3) n ::; 3; (4) Even n; (5) n = 4k - 2, k = 1,2, ....

1.5.12. (2) IPC(X3 )1 = 218.

1.5.13. Hint. Using the condition of the problem, prove that there exists tuples ii', S''::Y', such that p( ii', S') = p(S', i') = 1. Let ii' and S' differ in the i-th and S' and i' in the j-th place. Then the variables Xi and Xj are essential.

Page 308: Problems and Exercises in Discrete Mathematics

1.5. ESSENTIAL AND UNESSENTIAL VARIABLES 301

1.5.14. Hint. It is sufficient to prove that if Xi or Xi appear in a prime implicant K of the function f, then Xi is an essential variable. Deleting xi from K, we obtain an elementary conjunction K' that is not an implicant. Hence, it follows that there exists a tuple a = (01"" 0i-1, a, 0i+I, ... , On) such that K'(a) = 1 but ](0) = o. At the same time, f(ai ) = 1 since K(ai ) = 1. Hence, Xi is essential.

1.5.15. Hint. If Xi explicitly enters the polynomial p(xn), the latter can be presented in the form XiQ EB R, where Q and R are polynomials independent of Xi

and Q 1= O. Let the tuple a = (01, ... ,Oi-I,Oi+1, ... ,On) be such that Q(a) = 1. Then P( 01, ... , 0i-1, Xi, 0i+I,' .. , On) = Xi EB R(a). The statement now follows from Problem 1.5.8. (1).

1.5.16. No, it does not. Hint Consider f(x n ) = Xl EB X2 EB ... EB Xn .

1.5.17. Hint. Let f(x n ) satisfy the condition of the problem. Then there exists an integer i (1 ::; i ::; n) such that for any a and ~ (such that a E BI' j E BI'_l)f(a) =f f(~). The statement now follows from the fact that for any i in BI'_l UBI', there exist edges of any direction of i.

1.5.18. Hint. See Problem 11.5.13.

1.5.19. If J(xn) is expressed through a polynomial of a degree greater than unity, without loss of generality it can be presented in the form X1X2P1 EB X1P2 EB X2P3 EB P 4 ,

where PI 1= 0 and PI, P 2 , P 3 and P 4 depend on the variables X3, ... , X n • Let a = (03, ... ,On) be a tuple such that P1(a) = 1. Then the component f~;':::~Jxn) has the form X1X2 EB AlXl EB A2X2 EB A3 and, hence, the component essentially depends on Xl and X2. Hence, it follows that the required three tuples will be found in the face B~;~::~~n. If f (xn) is expressed by a first-degree polynomial and essentially depends on Xl and X2, then, for any tuple (03 ... , On), any three vertices in the face B~;~::~~n are the required vertices.

1.5.21. We assume the contrary. Without loss of generality, we can assume that the maximum number of essential variables among the components of the form f~(xn) belong to the component if(xn). Then the assumption is equivalent to the statement that if (xn) fictitiously depends on a certain variable, say X2, i.e. 11 = f:r/· Since Xl is an essential variable, at least one of the relations f:r/ =f f~r/ and f:i2 =f f~i2 must be sutisfied. Let, for example, f:i2 =f f~i2. Then the function

f 2 - ,1,2 V f l ,2 1 = XlJOl Xl 11

essentially depends on Xl, as well as on all essential variables of the subfunction f:i 2 = if. This is in contradiction with the fact that if has the maximum number of essential variables.

1.5.22. (1) The validity of the statement follows from the previous problem. (2) No, the statement is not valid. Hint. Consider f(x 3 ) = XlX3 V X2X3 and the variables Xl and X2.

1.5.23. (1) XI,X2. (2) 1. (3) Xl,X2. (4) X2 -+ XI, Xl f'V X2.1.

1.5.25. 6.

Page 309: Problems and Exercises in Discrete Mathematics

302 CHAPTER 1. REPRESENTATIONS OF BOOLEAN FUNCTIONS

1.5.26. Yes, it can. Hint. Consider the function XI, X2, Xa V XlX2X4 V XlXaX4 V X2 XaX4·

1.5.25. The numbers of coordinates of the tuples ii,~,::Y, can be divided into the following four groups:

Al = {i: (}:l = (3i = Ii = O}, A2 = {i: (}:i = (3i,(3i < Ii}, A - 3 = {i : (}:i < (3i, (3i = Ii}, A4 = {i : (}:i = (3i = Ii = 1}.

Let f(ii) = f(::Y) = (1,f(~) = a. Then if f(O) = f(i) = (1, we put Xi = X if i E Al U A2, and Xi = Y if i E Aa U A4. If f(O) = (1, f(i) = a, we put Xi = X for i E AI, Xi = Y for i E A2, Xi = z for i E Aa U A4. If f(O) = a, we put Xi = X for i E Al U A2, Xi = Y for i E Aa, and Xi = z for i E A4. The essential dependence on the obtained functions follows from Problem 1.5.13.

1.5.29. Xl Ell X2 Ell ... Ell Xn Ell (1, (1 in{ 0, 1} for n ~ 2, xr1 X~2 V X~2 X~3 V X~3 xrt, (1i E {O, 1}, i = 1,3 for n = 3; x~ xi, x~ Xi for n = 2.

1.5.30. The functionobtained from f( in) by identifying the variables Xi and X j has the form xd~t V xd~g. The conditions of the problem imply that at least one of the components fN and f~g is not identically equal to zero.

1.5.33. Hint. At least one of the function f and 9 becomes equal to unity on an odd number of tuples.

Page 310: Problems and Exercises in Discrete Mathematics

Chapter 2

Closed Classes and Completeness in Boolean Algebra

2.1 Closure Operation

2.1.1. (1) {Xl, XI, X2, X2}. (2) {0,XI,X2,XIEBx2}. (3) {O, 1, Xl, X2, XI, X2}. (4) {Xl, X2, XIX2}. (5) {Xl, X2}. (6) {1,XI,X2,XI V X2,XI V X2,XI V X2}.

2.1.2. (1) f = X --+ 0. (2) f = ((x 1 x) 1 (y 1 y)) 1 (x 1 y). (3)f=(xEBx)EBx. (4) f = (x rv y) rv z. (5) f = xx EBx. (6) f = x(yx). (7) f = (x v x) v (x v y). (12) f = m(m(x,y,z),m(x,y,z),z), where m(x,y,z) = xyVyzVzx.

2.1.3. (1) {O, 1, x, x}. (2) {x, xy, xyz}. (3) {l,x,x rv y,xEByEBz}. (4) {x,xyVyzV zx}. (5) {x,x,xEByEBz,xEByEBzEB1}.

2.1.4. (1) {O, x}. (2) {x EB y, I}. (3) {xEBY}. ( 4) {xy, x V y}. (5) {x --+ y}.

2.1.5. (1), (3), (7) The set is closed. (2), (4)-6), (8) The set is not closed.

303

Page 311: Problems and Exercises in Discrete Mathematics

304 CHAPTER 2. CLOSED CLASSES AND COMPLETENESS

2.1. 7. Let A be the precomplete class of the closed class K. That means that [A] i- K and [A U {I}] = K for any function f E K \ A. If we suppose A not to be closed, then we would have [A] \ A i- 0. But that means that, on the one hand, [A U ([A] \ A)] = K, and, on the other hand, A U ([A] \ A) = [A] and [[All = [AJ, since [A] is closed. This is a contradiction.

2.1.9. (1), (3), (5), (7), (8), (10) The set A is closed. (2), (4), (6), (9) The set A is not closed.

2.1.10. (1) {O}, {I}, {I, O}. (2) {O}, {I}, {I, O}, [0, x], [1, x], [0, 1, xJ, [x], [0, xJ, [x]. (3) (a) [xy]; (b) [x EB y, x rv y].

2.1.12. (1) The system {x, xy, x V y} is the complete system in P2 since any f E P2 can be presented by means of d.nJ. or c.nJ. On the other hand, x = x ~ x, xy = (x ~ x) ~ (x ~ x), x V y = (x ~ y) ~ (x ~ y).

(2) We have 0 = xx EB x, xy = xy EB 0, x = (x fV x) EB x. The system {x, xy} is complete since x V y = 8

(3) We have x = x EB x EB x, x V y = x --+ y, xy = x --+ y. (4) We have 0 = f(x,x,x), x = x --+ 0, xy = x --+ y. (5) We have x = x EB 0 EB 1, xy = m(x, y, 0).

2.1.13. (1) Kl ~ K2. (2) In general, K l ¢K2. Consider Al = {x, xy}, A2 = {x, x EB y}. 2.1.14. (1) For example, Kl = {O}, K2 = {I}. (2) For example, Kl = [x, OJ, K2 = [x, 1]. (3) Kl = [0, xJ, K2 = [0, 1, x].

2.1.15. (1) Ml = [0, 1, x], M2 = [x] are precomplete in K. (2) Ml = {O}, M2 = {I}. (3) [x]. (4) [x EB y EB z], [0, x].

2.1.17. Let K be the precomplete class in P2. If x ~ K, then [K U {x}] = P2, since K is precomplete. But taking in account 2.1.7 and 2.1.16, we have [K U {x}] = K U {x}. Since the problem's condition x I y 1. [K], therefore, x I y 1. K U {x} = P2 ·

That is a contradiction.

2.1.18. Let f(xn) not be a constant. If f(x, x, ... , x) E {x, x} then x can be obtained from f. Otherwise, f(x, x, ... , x) E {O, I}. Let, for clarity, f(x, x, ... , x) = O. Since f(xn) 1= 0, then there is a tuple 0: = (al' ... , an) such that f(o:) = 1. Let us replace the variable Xi by x if ai = 1, and by y if ai = O. As a result, we obtain the function g(x, y). It is clear that g(x, y) E {xy, x EB y} and x E [g(x, y].

2.1.19. Let us suppose that P2 = Kl U K2 U ... U K. where K; are nonempty pairwise nonintersecting closed classes. There is such i that x lYE Ki . But then K; = g, in contradiction with s > 1.

2.1.21. The result follows from 2.1.18 and from that the system containing the function x, cannot be expanded to be a basis.

Page 312: Problems and Exercises in Discrete Mathematics

2.2. SELF-DUAL FUNCTIONS 305

2.1.22. Hint. The proof can be carried out by induction on the number of occurrences of the connective "-t" in the formula which represents the function f E [x -t y].

2.1.23. Hint. Use 2.1.22.

2.2 Self-Dual Functions

2.2.1. (1), (3), (4), (10) The function f is self-dual. (2), (5)-(7), (9) The function f is not self-dual.

2.2.2. (1), (3), (5)-(8) f E S. (2), (4), (9), (10) f i. S.

2.2.3. (1) (1l00); (4) (01101001); (8) (1001000011110110).

2.2.4. (1) f(x, X, x) = f(x, x, x) = 1; (2) f(x, x, x) = 1.

2.2.6. The cube Bn can be divided into 2n - 1 nonintersecting pairs of opposite vertices. The self-dual function f(xn) takes one strictly once on any such pair. The counter-example for opposite proposition is the function Xl EB X2.

2.2.8. (1), (3) f(xn) E S when n is odd. (2), (4), (5) f(xn ) i. S when n ::J 3, f(5;3) E S. (6) f(xn) i. S when n = 3k.

2.2.10. Necessity. Let f = xdl V xdJ· Then f* = (xdl V xdJr = (Xl V (ff)*) & (Xl V (fJ r) = Xl (fJ r V Xl (ff r V (fJ r (ff r = Xl (fJ r V Xl (ff )*. Since f E S then f* = f and, hence,

( 1)* - ( 1)* 1 - 1 Xl fo V Xl fl = xdl V xdo·

Suggesting Xl = 1 and, after, Xl = 0, we obtain that (fJ)* = Jl and (ff)* = fJ·

Sufficiency. Let (ff)* = fJ. It follows that Jl = ((ff)*)" = (fJ)* and, hence,

f = xdi V xdJ = Xl (fJr V Xl (fir = (xdi V xdJ)" = 1*.

2.2.11. Yes, it is true. It follows from 2.2.10.

2.2.13. f is the superposition of self-dual functions m(5;3), c.p, and 'ljJ.

2.2.14. Let f i. S. It is to be proved that [{f} U S] = P2. We have {x, x} c S. It follows from the lemma of nonself-dual functions that {I, O} ~ [{x, x, f}]. It is known that [x, xy, X V y] = P2• Hence, [0, 1, X EB y EB z, m(x, y, z)] = P2 ,

because X = X EB 1 EB 0, xy = m(x,y,O), X V Y = m(x,y,I). So we have P2 ~ [0, 1, x EB y EB z, m(x, y, z)] ~ [{x, X, f} u S] = [if} US].

2.2.15. It is true for n = 1, 3, and it not true for the remaining natural n.

2.2.16. It follows from the problem's notation and from 2.2.10, that fJ = fl· But then f does not depend essentially on Xl.

Page 313: Problems and Exercises in Discrete Mathematics

306 CHAPTER 2. CLOSED CLASSES AND COMPLETENESS

2.2.18. (1) It is not difficult to obtain all functions 1 E S depending on no more than three variables (see 2.2.9). If, for some n, all self-dual functions I(xn - l ) are obtained, then using the representation from 2.2.17, we can obtain any f(xn) E S.

2.2.19. (1), (3), (5)-(7),(9), (10) Sets M are self-dual. (2), (4), (8), (14) Sets M are not self-dual.

2.3 Linear Functions

2.3.1. (1), (4), (7), (10) 1 ~ L. (2), (3), (5), (6), (8), (9) 1 E L.

2.3.2. (1), (3)-(5), (8)-(10) 1 E L. (2), (6), (7) 1 ~ L.

2.3.4. (1) I(x, y, 1) = xy. (2) I(x,y,y) = xy. (3) I(x, y, 0) = xf}. (4) l(x,l,y) = xf}. (5) l(y,O,I,x) = xf}. (6) I(y,x,y,y) = xf}. (11) I(x,x,x,y) = xy. (12) I(x, 1, y, 1) = xy.

2.3.5. (1), (4), (7), (9) No, it cannot, because INfl ~ 2. (2) xy = I(x, f}, 1). (3), (8), (11) No, it cannot, because 1 E L. (5), (6) No, it cannot. Hint. Substitution of constants and identification reduce the number of zeros.

2.3.6. (1) Let aI, ... , an-l be an arbitrary tuple of variables Xl, ••• , Xn-l. Then l(aI, ... , an-I, xn) = xn Ell cp(al,"" an-d· It is clear that l(aI,"" an-I, 0) =I­I(al,"" an-I, 1).

(2) Let's represent the function as xnh(xn - l ) Ell g(xn - l ). Since 1 depends essentially on xn , then h ¢ 0. Let us suppose that h ¢ 1. Then there is such tuple 0 = (aI, ... , an-d that h(o) = 0. But then l(aI,"" an-I, 0) = l(aI,"" an-I, 1) = g(o) which contradicts the problem's conditions. So h == 1.

(3) Hint. The values of Ion Bn can be uniquely defined from the value 1(0) and the problem's conditions. Additionally, the function's value on the tuples of even weight is equal to 1(0) and on the tuples of odd weight, is opposite to it. Such a function is Xl Ell ... Ell Xn Ell 1(0). This representation is unique.

2.3.7. (1), (2) It follows from 2.3.6.(1)

2.3.10. 2(~).

2.3.11. 2n - l .

2.3.12. The function Xl --+ X2 is nonlinear. If 1 E L, then Xl --+ X2 = I(XI, X2, 0, ... , 0) E L: which is in contradiction with the earlier statement.

2.3.13. Let us suppose that 1 E L. Then 1 = Xl Ell· .. Ellxn Ell 0', where 0' E {O, I}. It follows from the condition l(xI, 0, ... , 0) f:. l(xI, 1, ... , 1) that n is even. That is a contradiction with the condition of the problem.

Page 314: Problems and Exercises in Discrete Mathematics

2.4. FUNCTIONS PRESERVING THE CONSTANTS 307

2.3.14. Since f is nonlinear, then there are such i and j that

f = Xi XN1 EB XiCP2 EB XjCP3 EB CP4 where the functions CPm (m = 1, ... , 4) do not depend on Xi and Xj, and CP1 'i= O. Let ii = (a1, ... ,ai-1, ai+1, ... ,aj-1, aj+l,"" an) be such a tuple that CP1(ii) = 1. Then the function 1/J(Xi, Xj)=f(a1, ... ,ai-1, Xi, ai+1,···,aj-1, Xjaj+l,"" an) is nonlinear.

2.3.15. Sufficiency. Let the function f(xn) be such that there is a special quadruple of tuples ii, S, i, '6 in Bn such that the function f takes 1 on them an odd number of times. Let Xm = am if mE A2. Otherwise (m E AI) let Xm = X when 1m = 1, and Xm = Y when 1m = O. As a result of this substitution, the function cp(x, y) such that cp(l, 1) = f(ii), cp(O, 0) = f(S)' cp(l, 0) = f(i), cp(O, 1) = f(8). It is clear that cp(x, y) 1:. L. Necessity. It follows from 2.3.14.

2.3.16. Hint. Using 2.3.14, prove that there is a face of dimension 2 such that the function takes 1 on it an odd number of times. Using INfl = 2n - 1 , prove that there are two faces such that the function takes 1 at once on one of the faces, and three times on the other face.

2.3.18. (1) Using the superposition, it is possible to obtain the function Xi, EB Xi2 EB ... EB Xik from the function Xl EB X2; using the substitution for 1, it is possible to obtain the function Xi, EB Xi2 EB ... EB Xik EB 1. The system A is a basis.

(2)-(9) The system A is a basis. (10), (13) The system A is not a basis.

2.3.19. Let f E L. If f depends essentially on the odd number of variables, then f E S n L. If f depends essentially on the even number of variables, then either f(O) = 0, 1 1:. [U}] or f(O) = 1, f(1) = 1, 01:. [U}]·

2.3.21. Since there are just two linear functions depending essentially on Xl and X2 then at least one function from f1' h, h is nonlinear. Besides, each of theses functions is not self-dual. Substituting the variables for X and x in the nonself-dual function, we can obtain a constant. Using negation, we can obtain second constant. Substituting for 0, 1, x, x, y, y in the nonlinear function, we can obtain a function of the kind xy EB (j. So, we have [{x, xy EB (j}] = P2.

2.3.23. The function can be presented in the following way: f = xyz EB axy EB (3yz EB ,XZ EB l(x, y, z) where a, (3, IE {O, I} and l(x, y, z) E L. If a = (3 = 1=1, then f(x, y, y) = xy EB 11(x, y) where h E L. If a + (3 + ,= 2 and, for example, a = 0, then f(x, x, y) = xy EB 12(x, y) where 12 E L. If a + (3 + I ::; 1 and, for example, a = (3 = 0, then f(x, y, x) = xy EB 13(x, y) where bEL.

2.4 Functions Preserving the Constants

2.4.1. (1), (3), (4), (6), (8), (9) f E T1 \ To. (2), (5),(7), (10) f 1:. T1 \ To.

2.4.2. (1), (2) For even n 2 4. (3), (4) For n == 2,3 (mod 4). (5), (8) For all n 23. (6), (7) For all even n.

Page 315: Problems and Exercises in Discrete Mathematics

308 CHAPTER 2. CLOSED CLASSES AND COMPLETENESS

(9), (10) For all natural n ¢ 3 (mod 4). Hint. (~) is odd when n ¢ 3

(mod 4).

2.4.3. (1) 22n-2; (2) ~22n; (3) 2n; (4) 22n- 1 - I ;

(5) 22n - I + 2n; (6) 2n; (7) 22n- 1 - I + 2n - I ; (8) 2n-\

(9) 22n - I + 22n- 1- I + 2n - l ; (10) H22n- 1 + 2n); 15) O.

2.4.4. Hint. If I E Tuns, (J' E {O, I}, then I E TunS; if IE LnTonTI then IE S.

2.4.5. (1) xy = (x V y) ffi x ffi y. Further, see Example 3. (2) Hint. Use Example 3 and the equality T~ = TI .

(3) Hint. Reduce to (2). (4) Hint. x ffi y = xx ffi y, xy = (xy ffi z) ffi z. Further, see Example 3. (5) The polynomial of any function from TonTI contains an odd number of terms,

and does not contain 1 as an addend. Any such polynomial can be constructed with the help of the functions xy, x ffi y ffi z.

(6) See (5). (7) Hint. If a polynomial has a degree not greater than 1 and does not contain

terms equal to 1 then it is a superposition of the function x ffi y.

2.4.6. (1) Yes, it is. We have 1 = xx rv x, X rv y = xx rv y, xy = xy rv 1. Further, see 2.4.5 (5).

(2) The set A is not a basis in To, since A ~ To n TI . (3) The set A is not a basis in TI , since [{xy, x rv y}] = TI .

(4) The set A is not a basis in To n TI , since A ~ S. (5) No, it is not since [{xy, x ffi y ffi z}] = To n TI .

(6) The set A is a basis in To n TI (see 2.4.5 (5) and 2.1.2 (12)).

2.4.7. (1) ii f = (0110), I = Xl ffi X2·

Solution. IUe) E L depends essentially on Xl and X2, and 1(0, 0) = O. Hence, I = Xl ffi X2· The proposition [{Xl ffi X2}] = To n L was proved in 2.4.5 (7).

(2) iif = (10010110). (3) iif = (01101110). (4) ii f = (1001). (6) ii f = (0110 0110 01101001). (7) 1= 1 ffi Xl ffi X2 ffi X3 ffi X4'

(8) iif = (00101011).

2.4.8. Let I ~ TI . Then either (a) I(x, ... , x) == 0 or (b) I(x, ... , x) = x. In the case (a), we have P2 = [{O, 1, xy ffi z}] ~ [{O} u TI ] ~ [{f} UTI]' In the case (b), we have P2 = [x, xy}] ~ [{f} UTI]'

2.4.9. (1) Let I E L \ A. Then I depends essentially on more than one variable. Substituting for constant 0 in I, we can obtain a function of the kind X ffi y ffi (J',

(J' E {O, I}. But [{x ffi y ffi (J', x}] = L. (3) Let IE L \ A. Then I(x, ... , x) E {I, x}. Further, the proposition follows

from the completeness in L of systems {I, x ffi Y }, {x, X ffi y}.

2.4.10. (1) Let I E To \ L. Using the identification of variables in I, we can obtain a function 'P either of the kind xy ffi Zt(x, y) or m(x, y, z) ffi 12(x, y, z), where II, 12 are linear functions (see 2.3.24). In both cases,

Page 316: Problems and Exercises in Discrete Mathematics

2.5. MONOTONE FUNCTIONS 309

To = [{X Ell y, 'P}] ~ [(To n L) U {f}]. (2) No, it is not, since A c To n Tl . (3) Yes, it is. (4) No, it is not. (5) No, it is not, because, for example, riO} u A] i: To.

2.5 Monotone Functions

2.5.1. (1), (4), (6), (7) Itt M. (2), (3), (5), (8) I EM. 2.5.2. (1) Yes, it is, 1==0. (2) Yes, it is, I == 1. (3) No, it is not, I(x,O) = X.

(4) Yes, it is, I = Xl V X2X3. (5) No, it is not, 1(1,0, z) = z. (6), (7) Yes it is. (8) No, it is not.

2.5.3. (1) a = (010), ~ = (1l0). (2) a = (001), ~ = (Oll).

2.5.4. (1), (3) Two vectors. (2), (5)-(7) Three vectors. (8) 18.

2.5.5. (1), (2), (4)-(6) One vector. (3), (7) Two vectors. (8) Three vectors.

2.5.6. (1) f(xn)) E M when n = 1. If n :::: 2, then I(xl, 1, 0, ... , 0) = Xl. And, hence, I tt M.

(2) I(xn) E M when n = 2, 3; I(xn) tt M when n :::: 4. (3) f(xn) is monotone when n is even, and nonmonotone when n is odd. ( 4) If n = 1 and n = 3, then the function is monotone else the function is not

monotone.

2.5.7. If n = 1, then Xl. If n > 1, then there is no such function (see 2.5.9).

2.5.8. If Itt M, then there are tuples 0- = (0'1" 'O'n) and T = (Tl" .Tn ) such that 0- < T, but f(o-) > f(T). If p(o-, T) = 1, then the proposition is proved. Let p( 0-, T) = k > 1. Let us consider an arbitrary sequence of the kind 10, 11, ... , 1k where 10 = ir, 1k = T, 1i-1 < 1i (that means P(1i-l, 1i) = 1). So, we have 1(10) = 1, I(1k) = 0. It is clear that there is i, 0< i :::; k such that 1(1;-1) > 1(1;). As the result, let a = 1i-l, ~ = 1i.

2.5.9. It follows from 2.5.8.

2.5.11. Let us prove the first of the expansions. Using 2.5.10, we have I(x n ) = xJ{ V xd~ = Xi (f{ V I~) V iJ~ = xJ{ V n·

2.5.12. It follows from 2.5.11 by induction. 2.5.13. Let us assume that the converse is true. Let K = xlL be a prime

implicant of the function I E M. Then, by definition, K V I = I, LV f i: f. It follows from the last sentence that there is a tuple a = (aI, a2,"" an) such that L(a) = 1, I(a) = 0. Let us note that al = 1 since, otherwise, K(a) = 1, I(a) = 0. This contradicts the condition. Let ~ = (0, a2,"" an). We have L(a) = L(~) =

Pl.·(~) = I(~) = l. It follows from ~ < a and I E M that I(a) :::: I(~) = 1. This leads to a contradiction.

2.5.14. (1) e(f) = nU) = 3. (2) e(f) = 2, n(f) = l. (3) eU) = n(f) = 4. (4) e(f) = 2\ n(f) = k.

Page 317: Problems and Exercises in Discrete Mathematics

310 CHAPTER 2. CLOSED CLASSES AND COMPLETENESS

2.5.16. Let a and ~ be the lower ones ofthe function f(xn ) E M (n ~ 2). Then INfl = 211 &11 + 211ffill - 211&nffill. If a 1. ~ and ~ 1. a, then INfl #- 2k for all k. That means f tJ. 5.

2.5.17. (1) Consider B~/2]' (2) Let

Mf = {f E P2n : U B~ ~ Nf , k>[n/2]

U B~ ~ Nf}' k<[n/2]

Show that Ml ~ Mn and IMll = 2([n/2]).

2.5.18. (1) There is a vertex ai E Bi (i = 0, 1, ... , n) in any ascending chain of length n in the cube Bn. It is clear that always ao = O. There are n possibilities for choosing a1' There are n -1 possibilities to choose a2 when a1 is already chosen, etc. In the result we have n! possibilities.

(2) k!(n - k)!.

2.5.19. (1) Let A be the set of pairwise incomparable tuples from Bn, Ai = An B['. Let Z(a) be the set of chains of length n which contain the vertex a. We have

n! ~ j U Z(a)j = L IZ(a)1 = L IAli!(n - i)! &EA &EA O~i~n

~ [~](h[)! ~ IAil = IAI [~l (l~[)!. O~.~n

SO, IAI ::; Cn/2])' (2) Hint. The unequality i!(n - i)! ?: k!(n - k)! takes place when i ~ k ~ n/2.

2.5.21. (1) O. (2) 2. (3) n + 2. (4) n. (5) 2n - 2.

2.5.22. (1) If f E 5 n Mn, then f = xnfl V Xn (fIr and f1 E Mn-1. The estimate follows from that.

(2) If f E Mn, then f = xnfl V f;, where f:: E M, a E {O, I}. The function f is fully defined by the couple (fl, f;)·

2.5.25. In view of 2.5.23, we have IM41 = 168, and 1541 = 256. Further, the proposition follows from IMn I ::; IMn-112 and 15n I = 15n - 112 by induction.

2.5.26. Let, for clarity, k > I. For arbitrary ~ E A, there are exactly (;~D tuples a E C such that ~ < a. For any a E C, there are not more than (7) tuples ~ E A such that ~ < a. Hence, IAI (~=:) ::; ICI (7). We obtain the required

unequality with the help of the identity m (~) = (7) (~=D· 2.5.27. It follows from 2.5.26.

2.5.28. (2) Using (1), we have

Page 318: Problems and Exercises in Discrete Mathematics

2.6. COMPLETENESS AND CLOSED CLASSES 311

2.5.29. (1) Carry out the induction on the number of variables. (2) Carry out by induction by s using (1).

2.5.30. (1) In general, it is not true. Consider the function f(5;3) = X3 and tuples (110) and (001).

(2) Let us assume that the converse is true. Let the conditions take place, but f ~ M. Then there are neighboring tuples a, ~ such that a < ~ and f( a) > f(~). Let us assume that the tuples a, ~ differ in the (n - k)-th position. Then I/(~) = 1/( a) + 2k and, by the problem's condition, f( a) :S f(~). This leads to a contradiction.

2.5.31. F (ao, al,"" a2n-d = 1 if and only if the vector (ao, al,··., a2n-d is a value vector of some monotone function (see 2.5.30 (2)).

2.6 Completeness and Closed Classes

2.6.1. (1) No, it is not, A ~ To. (2) Yes, it is. (3) No, it is not, A ~ L. (4) Yes, it is. (5) No, it is not, A ~ S. (6) Yes, it is.

2.6.2. (1) No, it is not, A ~ L. (2) No, it is not, A ~ To. (3), (5) Yes, it is. (4) No, it is not, A ~ S. (6) No, it is not, A ~ M.

2.6.3. (1), (4), (6) Yes, it is. (2) No, it is not, A ~ S. (3) No, it is not, A ~ Tl . (5) No, it is not, A ~ L.

2.6.4. (1) No, it is not, since the subsystem {x -t y, X EEl y} is complete. (2) Yes, it is. (3) No, it is not, A ~ Tl .

(4) No, it is not. xy V z can be removed.

2.6.5. (1) Bl = {1,x,J}, B2 = {x,xy(xEBy),J} where f = xEByEBxyEByzEBzx. (2) Bl = {O,x -t y}, B2 = {xEBy,x -t y}, B3 = {O,xy rv xz}, B4 = {xEBy,xy rv

xz }.

2.6.6. (1) P2' (2) M n Tl . (3) (M n L) \ S. (4) To n S. (5) S. (6) L n S.

2.6.7. (1) (a) {x I y}, {x! y}; (b) {x EEl y, X -t y}, {x rv y, xy} and, additionally, four bases obtained from

them by the permutation of variables in the functions xy, x -t y. (c) {x EEl y, x rv y, xy}, {x EEl y, x rv y, X V y}. (2) Hint. Using the criteria table, prove that there are no bases which differ

from the bases enumerated in (1).

2.6.8. (1) Yes, AU {O} is a basis. (2) No, it is not. The function x is in all precomplete classes. (3) Yes, AU {1} is a basis. (4) No, it is not. The functions xy and x Vy are in the same precomplete classes.

2.6.9. (1) In general, no, it is not. Consider fl = x EEl y EB z, h = Xl V X2 V X3.

Page 319: Problems and Exercises in Discrete Mathematics

312 CHAPTER 2. CLOSED CLASSES AND COMPLETENESS

(2) Yes, it is: h == 1 ~ 5, !I 1: M U L U To UTI. (3) In general, no, it is not. Consider !I = x --> y, h == 1. (4) In general, no, it is not. Consider !I = x, h == 1.

2.6.10. (1) f(x n ) is not a Sheffer function for any n. If n is even, then f E T l .

If n is odd then f E 5. (2) If n is even, then function f is a Sheffer function else f E T l .

(3) The function J(xn) is a Sheffer function when n ~ 2. (4) The function f(xn) is a Sheffer function when n = 4k + l. (5) If n is even, then the function f(x n ) is a Sheffer function or else f(x n ) E 5.

2.6.11. Hint. 01: Tl U 5, J 1: To U M U L.

2.6.12. Hint. There are at least one linear function and no self-dual functions among three functions, depending essentially on Xl and Xz.

2.6.13. It follows from f 1: To U Tl that f E M. If f E L, then it follows from f 1: To U Tl that f E 5, but this contradicts the condition.

2.6.14. It is clear that f 1: To U Tl U 5. Further, see 2.6.13.

2.6.15. Since 2.5.16, then f 1: 5. It is clear that J 1: To UTI. Further, see 2.6.13.

2.6.16. Let 5(n) be the number of the Sheffer functions f(x n ). Since 2.6.13, then 5( n) = IP:r \ (To U Tl U 5) I = 2zn-z - 2zn- l

- l .

2.6.17. See 2.2.7. and 2.6.13.

2.6.18. Since f 1: 5, then there are tuples 0: = (0'1"'" an) and ~ = (al,"" an) such that f(a) = f(~). It is clear that 0: 1: {a, I}, since f(O) = 1, 1(1) = O. Let us replace Xi by X in 1(Xl,"" .Tn ) if ai = 1, and by y if ai = O. The function g(x, y) is a Sheffer function.

2.6.19. (2) (a) 1 E A; (c) i E A.

2.6.21. (1) A cz. To since IAI > ITol· Similarly, A cz. Tl , A cz. 5, A cz. L.

2.6.23. No, it is not. For example, xi} E To \ (Tl U L U M U 5), but [{xi}} 1 does not contain a function f(x n ) such that IN!I > 2n - l , for example, Xl V Xz.

2.6.24. (1) No, it is not. Consider f = x V y. (2) Yes, it is.

2.6.25. Yes, it is: for example, the function f = Xl EB Xz EB XZX3 EB X3X4 satisfies the problem's conditions and, at the same time, f 1: Tl U 5 U M U L.

Page 320: Problems and Exercises in Discrete Mathematics

Chapter 3

Many-Valued Logics

3.1 Formulas of k-Valued Logics

3.1.1. (1) Hint. Consider two cases: x = k - 1 and x i= k - 1.

(2)-(7) Hint. Consider two cases: x ~ y and x < y.

(8) Let x ~ y. Then rv x = k - 1 - x ~ y - x and (rv x) + (y + x) = k-l-x-(y-x) = k-l-y =rv y. If, however, x> y, we have (rv x)+(y+x) =rv x.

(9) Hint. Consider two cases: x ~ y and x > y.

(10)-(11) The equalities are proved directly by using the relations rv x = k-l-x and x = x + l.

(12) Hint. Consider two cases: x = k - 2 and x i= k - 2.

(13) Hint. Consider two cases: x = k - 1 and x i= k - 1.

(14) Hint. Consider five cases: (a) x = y = k -1; (b) x = k -1, y i= k - 1; (c) x i= k - 1, y = k - 1; (d) x # k - 1, y # k - 1, x ~ y, and (e) x i= k - 1, y i= k -1, x> y.

3.1.2. Hint. The relations from Problem 3.1.1 can be useful for solving this problem.

(1) J1(x) = Jo(max(Jo(x), J2(x))).

(2) rv x = max(Jo(x), min(x, J1(x))).

(3) fl(X) = max(l, J1(X 2 )), h(x) = J1(h(x)), /i(x) = jo(x) and x = max(jo(x), J1(x)).

(4) jo(x) = (x 2 - I? for k = 3 and jo(x) = (x4 _1)2 for k = 5.

(5) Let xy + x - y2 + 1 = cp(x, y). We have cp(x, x) = x + 1, cp(x, x + 1) = o. Further we obtain all the constants and (a) cp(2, x) = jl(X) for k = 3, (b) cp(O, x) = 1 - x2 for k = 5, and hence we can construct the functions _x2, X4, X + 4( = x-I) and jl(X) = 1 - (x - 1)4.

(6) We put xfj = 'Ij;(x, y). This gives:

(a) rv X = 'Ij;(1, 'Ij;(1, 'Ij;(x, 1))) for k = 3,

313

Page 321: Problems and Exercises in Discrete Mathematics

314 CHAPTER 3. MANY-VALUED LOGICS

(b) 1/>l(X) = 1/>(1/>(x, 1), 1) = 4x = -x, 1/>2(X) = 1/>(1, x) = x + 1, 1/>3(X) = 1/>2(1/>2(X)) = x + 2, 1/>4(X) = ~)3(1/>3(X)) = X + 4 and rv x = 1/>4(1/>1 (x)) = 4 - x for k = 5.

(7) We have x -+ x = 0, jo(O) = 1, 3 -+ 1 = 2, jo(x -+ 1) -+ jo(x) = j1(X), jo(x -+ 2) -+ jo(x -+ 1) = h(x), 1 -+ jo(x -+ 2) = j3(X), 4'l(X) = (3 -+ jo(x)) -+ jo(x), 4'2(X)-+ = 4'l(X) -+ j1(X), 4'3(X) = ((4'2(X) -+ h(x)) -+ j3(X)) -+ h(x) = x.

(8) rv x = max(Jo(x), Jg(x + 2), 2J1(x)).

(lO) js(x) = Jl(x + 4).

3.1.4. (1) Take y = m - l.

(2) Consider the function 1 -+ 2x.

3.1.6. Obviously, the comparisons x2 == x3 (mod k), and x3 == X4 (mod k) cannot be carried out identically for any k 2 3, since for x = k - 1, we have

x2 = (k - 1)2 = 1, x3 = (k - I? = k - 1 and X4 = (k - 1)4 = l. Let us now consider the relation x2 == X4 (mod k). We put x = 2. This gives

4 == 16 (mod k). Trying the values of k from 3 to 15, we see that the comparison can be carried out only for k = 3, 4, 6 and 12. Hence, for each of these values of k, we must find out whether a comparison x2 == 4 (mod k) is valid for any values of x in Ek. It turns out that, for any k = 3, 4, 6 and 12, the comparison x2 == x4 (mod k) is fulfilled identically in Ek • For example, for k = 6 we have

x 2 = (0 1 2345) = X4. o 1 434 1

3.1. 7. For k = 3, 5 and 7, the number of different functions of the given form is k - 1, while for k = 4, 6, 8, 9, lO, it is equal to 3, 2, 4, 7, 4, respectively. For example, for k = 4 we have

x = (0 1 2 3) x2 = (0 1 2 3) x3 = (0 1 2 3) 0123' 0101' 0103

and x21 = x2 , x21+1 = x3 (12 1).

3.1.8. jk-1(X) = Jk-1(X)+ ... +Jk_1(X)(k-1 terms); j;(x) = jk-1(X-i-1), 0 ~ i ~ k - 2. If g(x) E p~1), then

g(x) = g(O)jo(x) + ... + g(i)j;(x) + ... + g(k - 1)jk_1(X).

It remains for us to take into account lj;(x) = j;(x) + ... + ji(X) (I terms).

3.1.9. Letusconsiderthefunctionsf(x)-c(CE {I, 2}), f(x+1), f(x+2) and f(h12(x )), where hdx) = x + j1(X) - j2(X). Each of them takes the same number of

Page 322: Problems and Exercises in Discrete Mathematics

3.2. CLOSED CLASSES AND COMPLETENESS 315

different values as the function f(x). Therefore, we can assume that ft(x) = (g~:)

and h(x) = (~ !, ~J, where a, bl, b2 E {1, 2}. Then g(x) = (~bl, a!bJ. If bl = 1, then b2 = 2 and a + b2 = 2 and, hence, a = 0, which contradicts to the condition of the problem (since a E {1, 2}). If, however, bl = 2, we have b2 = 1 and a + b2 = l. Consequently, a = 0, and we again arrive at a contradiction.

3.1.11. (1) i; = max(min(l, Jo(x)), Jl(x)) = jo(x) + 2h(x);

(2) '" x = max(Jo(x), min(2, Jl(x)), min(l, J2(x))) = 3jo(x) + 2jl(X) + j2(X);

(3) -jo(x) = Jo(x) = 4jo(x);

(4) 2Jl (x) = min(4, Jl(x)) = 4jl(X);

(5) J2(X 2 + x) = max(Jl(x), J3(x)) = 4jl(X) + 4j3(X);

(6) ('" X)2 + X = max(min(l, Jo(x)), min(l, Jl(x)), J2(x), J3(x))

= jo(x) + jl(X) + 3j2(X) + 3h(x);

(7) 3jl{X) - h(x) = max(Jl(x), J3(x)) = 3jl(X) + 3h(x).

Let us prove that the right-hand side of this relation coincides with the left-hand side. If at least one (Ji f- ai, for example, for i = io, then

max(f(a-), '" J"1 (al), ... , '" J",O-1 (aio-Il, '" J",o (aiD), '" J"'O+1 (aio+1), ... , '" J"n(an ))

= max(f(a-), '" J"1 (ad, ... , '" J"'O-1 (aio-l), '" 0, '" J"'O+1 (aio+1), ... , '" J"n(an )) = k - 1.

If, however, a- = a, then max(f(a-), '" J"1 (al), ... , '" J"n(an ))

= max(f(a), '" (k -1), ... , '" (k-l)) = f(a), and, hence, min{max(f(a-), '" J"1 (al), ... , '" J"n(a n ))}

= min(k-l, ... , k-l, f(a), k-l, ... , k-l) = f(a).

3.2 Closed Classes and Completeness in k-valued logic

3.2.1. (1) In order to simplify the notation, we put T({O, 2}) = T and U({O, 1}, {2})=U:

(a) '" x E T and r;. U; (b) jl(X) E TnU; (e) J2(x) E Tn U; (d) x + yET and r;. U;

Page 323: Problems and Exercises in Discrete Mathematics

316

(e) x + y tI. T and tI. U; (f) min(x, y) E TnU.

CHAPTER 3. MANY-VALUED LOGICS

(2) We put T( {I, 3}) = T, U( {O, I}, {2}, {3}) = U1, U( {O, 3}, {I, 2}) = U2 ;

(a) x tI. T, tI. U1 , and tI. U2 ;

(b) "" x tI. T and E U1 n U2 ;

(c) jo(x) tI. T, E UI, and tI. U2; (d) x+2y E T, tI. U1 , and tI. U2 ;

(e) max(x, u) E TnUl and rt. U2 ;

(f) x2y E T, rt. UI, and rt. U2.

3.2.2. (1) The subset {2} and the partition {OJ U{I, 2} are suitable: (2) £ = {O, 2} and D = {{O, 2}, {I}}; (3) £ = {I} and D = {{O}, {I, 2}}; (4) £ = {2}. There is no suitable partition. (5) £ = {OJ and D = {{O, I}, {2}, {3}}; (6) £ = {OJ and D = {{O, 2}, {I, 3}}; (7) £ = {I, 3} and D = {{O, 2}, {I, 3}}; (8) £ = {OJ and D = {{O, 1, 4}, {2, 3}}; (9) £ = {4} and D = {{O, 1, 2, 4}, {3}}; (10) £ = {O, 2} and D = {{O, 2, 4}, {I, 3, 5}}.

3.2.3. (1) If £ = 0 or £ = Ek , any function in Pk , preserves this set (for £ = 0, it is assumed by definition that f(0, ... , 0) = 0). Let £ =J 0 and £ =J Ek • Then there exists a E Ek such that a rt. £. Obviously, f(x) == a tI. T(£). Hence T(£) =J Pk.

(2) Hint. It should be first proved that different classes T (£) correspond to different proper subsets in Ek. The number of all nonempty subsets in Ek is 2k - 1.

3.2.4. (1) If D = {{OJ, {I}, ... , {k - I}}, i.e. s = k, or D = {{O, 1, ... , k­I}} i.e. s = 1, then any function in Pk preserves this partition. Let s =J 1 and s =J k. In the partition D = {£1' ... , £s} we take a subset £il such that I£il I ~ 2, and another subset £i2 , differing from £il' Let aI, a2 E £il and b E £i2' Let us consider the function

f(x) = {a1 for x = aI, b for x =J a1'

Obviously, f(a2) = b, and hence, f does not preserve the partition D, i.e f rt. U(D).

(2) Hint. We must first prove that for s =J 1 and s =J k different classes U(D) correspond to different partitions of Ek • For k = 3, the set has the following partitions: Dl = {{OJ, {I}, {2}}, D2 = {{O, 1}, {2}}, D3 = {{O, 2}, {I}}, D4 = {{OJ, {I, 2}}, D5 = {{O, 1, 2}}. U(Dd = U(D5) = P3. The remaining three classes U(D2), U(D3) and U(D4) differ from one another and from P3 . Consequently, there exist four different classes of the type U(D) in P3 (if we also take into account the entire set P3 as well). For k = 4, the set Ek has the following partitions:

D1 = {{OJ, {I}, {2}, {3}}, D2 = {{O, I}, {2}, {3}}, D3 = {{O, 2}, {I}, {3}},

Page 324: Problems and Exercises in Discrete Mathematics

3.2. CLOSED CLASSES AND COMPLETENESS 317

D4 = {{O, 3}, {I}, {2}}, D5 = {{I, 2}, {O}, {3}}, D6 = {{I, 3}, {O}, {2}},

D7 = {{2, 3}, {O}, {I}}, Ds = {{O, I}, {2, 3}}, D9 = {{O, 2}, {I, 3}},

DlO = {{O, 3}, {I, 2}}, Dll = {{a}, {I, 2, 3}}, D12 = {{I}, {a, 2, 3}},

D13 = {{2}, {O, 1, 3}}, D14 = {{3}, {a, 1, 2}}, D15 = {{O, 1, 2, 3}}.

Consequently, there are 14 different classes of type U(D) in P4 • In P5 , there are 51 classes of the type U (D).

(3) Let (iI, i2 , ••. , in) be a tuple of numbers in the set {1,2, ... ,s}. The number of such tuples is sn. Arrange them in the alphabetic order and assign them numbers from 1 to sn. The tuple (1,1, ... ,1,1) has the number 1, the tuple (1,1, ... ,1,2) the number 2, the tuple (1,1, ... ,1,2,1) the number s + 1, and so on. If a tuple (iI, i2 , ..• , in) has a number m, the number I filii fi21 ... 1 fin I is denoted by dm . The number of functions in the set Pk(Xn ), which preserve the partition D = {fl' f2' ... , fs} is equal to

L If1l Idllfj21d2 ... Ifjr Idr, (jl,h, ... ,jr)

where r = sn and the sum is taken over all possible tuples of length sn, consisting of numbers from the set {I, 2, ... , s}.

3.2.5. We denote the set f by fl and Ek \ f by f 2. Let If I = I and, as in Problem 3.2.4(3), let dm stand for the number Ifill ... lfinl, where (iI, ... , in) is the tuple of length n, consisting of numbers belonging to the set {I, 2}, where m is the number of the tuple in the alphabetic order. Obviously, dl = In.

(1) Since T(f)\U(D) = T(f)\(T(f) n U(D)), the number offunctions in Pk(Xn )

contained in the set T(f) \ U(D) is

L jl = 1

(j2, ... , jr)

where r = 2n , and the last sum is taken over all such tuples of length 2n - 1, which consist of numbers belonging to the set {I, 2}. The above formula is valid for n 2 1.

If n = 0, then i(T(f) \ U(D))(O)i = 0.

(2) For n 2 1, we have

Page 325: Problems and Exercises in Discrete Mathematics

318

=

CHAPTER 3. MANY-VALUED LOGICS

L 1 £jl Idll £j21 d2 .. ·1 £jr Idr - L (j1,j2,oo.,jr)

L j1 = 2

(h, .. ·,jr)

j1 = 1 (j2, ... , jr)

l£jlldll£j2Id2"'I£jrldr=(k-Z( L l£j2I d2 "·I£jYr (j2, ... ,jr)

(here, as before, r = 2n and ji E {I, 2}, i = 2, ... , r). For n = 0, I(U(D) \ T(£))(O)I = 1£21 = k -Z.

(3) We have

For n = 0, we have I(T(£) U U(D))OI = k.

3.2.6. (1) If

() ( OI ... k-I) It x = ao a1 ... ak-1

and h(x) = (01 ... k - 1) bo b1 .•• bk - 1

are the functions in Sk, they have different values (i.e. ai 1- aj and b; 1- bj for i 1- j), and hence

provided that b; 1- bj if i 1- j and, therefore, ab, 1- abJ • Consequently, f( x) E Sk. Let f1(X) and h(x) be functions in CSk. Then there exist i, j (i 1- j) such

that h(i) = hU) But under this condition, the equality h(h(i)) = h(hU)) is also observed. Therefore, f(x) = f1(h(x)) E CSk.

(2) For k = 3, we have IS3nU({0, I}, {2})1 = 2. This class contains the following functions:

(012) 012 and (012) . 102

If k ::::: 4, then

ISknU({O, k-2}, {k-1}, {I, ... , k-3})1 =2!(k-3)!'

Page 326: Problems and Exercises in Discrete Mathematics

3.2. CLOSED CLASSES AND COMPLETENESS

3.2.7. (1) 2X4 + x3 + 2x2 + x;

(2) 3x4 + 3x3 + 3x2 + 2x;

(3) x + x 3 - X4;

(4) 5x6 + 2x5 + 4X4 + x3 + x2 + 4x;

(5) 6x6 + 3x5 + 5x4 + 3x2 + 5x

319

3.2.9. Hint. It is sufficient to prove that the functions f(x) - j2(x) and f( x) - P( x) take the values only in the set {O, 2} and then to make use ofthe result of Problem 3.2.S (2).

3.2.10. If the function f(x) in P4 can be presented by a mod 4 polynomial, it can be written in the form ao + alx + a2x2 + a3x3, where ai E E4 , i = 0, 1,2,3 (see Problem 3.2.S (1)). But one and the same function can be represented by different polynomials. Besides, each such function is represented by four different polynomials (see, for example, the solution to Problem 3.2.S (1)). The latter fact can be easily proved by considering that the following relations are valid in P4 : 2x3 = 2X2 = 2x and 3x3 = 2x + x3. The number of corresponding functions is equal to 64.

3.2.11. (1) The functions x, x2 and x3 in P6 should be compared.

(2) Since 3x2 = 3x (mod 6), each function that can be represented by a mod 6 polynomial is represented by two different polynomials. Therefore, the number of functions in P6 which can be represented by mod 6 polynomials is 63 /2 = lOS.

3.2.12. (1), (2), (4) No, it cannot. (3) and (5) Yes, it can.

3.2.13. (1) T({O, k -I}); (2) T( {I, 2}); (3) U({O, I}, {2, ... , k-1}); (4) T( {O, 1}); (5) T({O, k-l}); (6) T({O}); (7) T({I}); (S)T({k-l}).

3.2.14. (1) The set {Jo(x), x + y} is such a subsystem (see Problem 3.1.S and use the Slupecki criterion). The completeness of this system can be proved in a different way. We have

jo(x) + jo(jo(x)) == 1; x+1=x, x+1=x+2, ... , (x+(k-2))+I=x+(k-l); ji(X) = jo(x - i) = jo(x + (k - i)), i = 1, 2, ... , k - 1;

j2(jO(X) + jo(y)) = jo,o(x, y) = jo(x)jo(y); jl,m(X, y) = jo,o(x -I, y - m), 1=0, 1, ... , k - 1 and m = 0, 1, ... , k - 1;

ji:~(x, y) = jt,m(x, y) + ... + jl,m(X, y) (8 terms), 8 = 1, 2, ... , k - 1, k. If f(x, y) is an arbitrary function of two arguments, then

Page 327: Problems and Exercises in Discrete Mathematics

320 CHAPTER 3. MANY-VALUED LOGICS

f(x, y) = L f(l, m)i!,~m)(x, y), (I,m)

where the summation is carried out over all pairs (I, m) E Ek x Ek . It remains for us to take into account the fact that the system of all functions in Pk , which depend on two arguments, is complete in Pk .

(2) {O, x + y, xy} c T({O}), {jo(x), jl(X), ... , jk-l(X)} c T({O, I}), {I, 2, ... , k-l} C T({I, 2, ... , k-l}).

3.2.15. (1) Al \ {i} C T(Ek \ {ill, i = 1, ... , k - 2. (2) Al \ {O, k - 1, Jo(x), Jk-l(X)}. Hint: J1(Jl(X)) = 0, J1(1) = k - 1 (see also Problems 3.1.1(18) and (19)).

3.2.16. (1) The subsystem is complete: 0= Jo(1), 2 = Jo(O), J1(x) = Jo(max(Jo(x), J2(x))).

(2) The subsystem is not complete. Consider the partition D = {{O, I}, {2}}. (3) The subsystem is not complete and preserves the partition { {O}, {I}, {2, 3}}. (4) The subsystem is not complete and preserves the partition {{O}, {1,2}, {3}}.

3.2.19. (1) x -;- x = 0, Jo(O) = k - 1, (JO(0))2 = 1. Further, we obtain the remaining constants (for k 2:: 4):

(k-l)-;-I=k-2, (k-2)-;-I=k-3, .... Then we construct max(x, y) and min(x, y):

x-;-(x-;-y) = min(x, y), (k-l)-;-x =rv x, rv min(rv x, rv y) = max(x, y). Thus, the initial system generates the Rosser-Turquette system.

(2) (x -;- y) + y = max(x, y), x + (k - 1) + ... + (k - 1) = x + 1 (here k - 1 is added k - 1 times). Consequently, we have constructed the system {x + 1, max(x, y)} known to be complete beforehand.

(3) If k = 21 + 1 (12:: 1), we proceed as follows: ((x + 2) + ... + 2) + 2 = x + 1 (2 is added 1 + 1 times); x-;-(x-;-y)=min(x, y), rvmin(rvx, rvy)=max(x, y).

We have obtained a Post's system. Let us now suppose that k = 21 (1 2:: 2). Then we construct the Rosser-Turquette system: min( x, y) and max( x, y) are obtained in the same way as for an odd k. Then we construct the constants:

x-;-x=O, 0+2=2,2+2=4, ... , (k-4)+2=k-2, rvO=k-l, rv 2=k-3, ... , rv(k-2)=I, and then the functions Ji(x): ((k - 1) -;- x) -;- ... -;- x = Jo(x),

~

k-l times Jo(x + k - 2m) = J2m(x), m = 1, 2, ... , 1- 1, J2m (rv x) = J2m (k -1 - x) = Jk-I-2m(X), m = 0, 1, ... , 1- 1.

(4)Wehave x-;-x=O, 1-02 =1, -1=k-1, (k-1)-;-x=rvx, x -;- (x -;- y) = min(x, y), rv min(rv x, rv y) = max(x, y). Using k - 1, 1 and x -;- y, we obtain the constants

Page 328: Problems and Exercises in Discrete Mathematics

3.2. CLOSED CLASSES AND COMPLETENESS 321

k-2=(k-l)-;-I, k-3=(k-2)-;-I, ... , 2=3-;-1. Then we obtain ((k - 1) -;- x) -;- ... -;- x = Jo(x), Jk-1(X) = Jo('" x), ---....--

k-l times Jk- 2(:1') = Jo((k - 2) -;- x) -;- Jk-1(X), Jk-3(X) = Jo((k - 3) -;- x) -;- Jo((k - 2) -;- x) and so on. Thus, the initial system generates the Rosser-Turquette system.

3.2.20. While solving these problems, it is expedient to compile tables with two inputs (in x and y) for the functions of the two variables under consideration.

(1) x - y + 2 is an essential function. Consequently, it is sufficient to construct the functions x, x + jo(x) and h01(X) = x + jo(x) - jl(X), see Picard's theorem. We have

(k-lj2-;-(k-l)=O, (k_1)2-;-X=jO(x), jo(O)=I, x-y+2 = x-y+l, x-y+l = x-y, o-x = -x,

From x + y and jo(x), we construct

x-1+2 = x; x-(-y) = x+y.

x + jo(x); h01(X) = (x + jo(x)) - jo(x + (k - 1)) = x + jo(x) - jl(X).

(2) The functions x + y2 and xy + 1 are essential. We construct the functions x, h01(X) and x + jo(x):

hU2(X)) =0, xxO+l=l, xxl+1=x, h(x) =j2(x+2) =jo(x), x+(jo(X))2=X+jo(x), ((x+1)+1)+ ... +1=x-1, jo(X-1)=jl(X),

" 'V' I

k-l times

h01(X) = X + jo(x) + ,Ul(X))2 + .~. + (jl(X))2;

k-l times

(3) ('" x) - y and x -;- yare essential functions, x -;- x = 0, ('" x) - ° = "'x, (",(",x))-y=x-y, O-x=-x, x-(-y)=x+y, ",0= k-l, x+(k-l) = x-I, x-(k-1) = x, l-;-x = )o(x), jo(x-l) = jl(X). From x + y and jo(x), we construct x + jo(x); h01(X) = (x + jo(x)) - jl(X).

(4) x - y and x2 - yare essential functions; (jl(XW - jl(X) = 0, X - ° = x, X - Y = x - y, 0- x = -x, x - (-y) = x + y, jl(X) = jo(x). From x + y and jo(x), we construct x + jo(x); h01(X) = (x + jo(x)) - jl(X).

3.2.21. (1) If k = 2m+ 1 (m ~ 1), the system is complete since (x+2) + ... +2 =

x + 1 (2 is added here m + 1 times) and, hence, the initial system generates the complete system {i, max( x, y)}. If, however, k = 2m (m ~ 2), the system is incomplete, since it preserves the subset [ of all odd numbers in Ek , i.e. [; = rn-I U {21 + I}.

1=0

(2) The system is incomplete and preserves the set {I, 2}.

(3) For k = 2m + 1 (m ~ 1), the system is complete since it generates the complete system {X, min(x, y)} (see Problem 3.2.19(6)). The function x can be constructed as follows:

(x - 2) - ... - 2 = x - 2m = x + 1. ~

m times

Page 329: Problems and Exercises in Discrete Mathematics

322 CHAPTER 3. MANY-VALUED LOGICS

If k = 2m (m > 2), the system is incomplete since it preserves the set £ = U~(/{21}.

(4) The system is incomplete and preserves the set {O, I}.

(5) For k = 2m + 1 (m 2: 1), the system is complete since it generates the complete system {jo(x), x + y} (see Problem 3.2.14(1)). Indeed, 2x + ... + 2x +y = x+y, x+2 + ... + 2 = x+l, x + '" + x = 0, ~ --------- ~

m+l times m+l times k times o + 1 = 1, 12 -;- X = jo(x). If k = 2m (m 2: 2), the system is incomplete since

m-l it preserves the set £ = U {21}.

1=0

(6) The system is incomplete and preserves a certain (k - 1)- element subset in Ek .

(7) The system is incomplete and preserves a certain one-element subset in Ek.

(8) For odd k, the system is complete (generates, for example, the system {x + y, jo(x)}). For even k, it is incomplete since it preserves the subset of all even numbers in E k •

(9) The system is incomplete, since it preserves a certain two-element subset in E k •

(14) The system is incomplete. It preserves, for example, the partition D =

{{O, 1, ... , k-2}, {k-l}}.

3.2.22. The functions appearing in each of the given systems are polynomials. Consequently, for composite k, these systems are incomplete. If, however, k is a prime number not less than 3, the completeness of a system can be conveniently proved by constructing one of the following systems: (a) the system {jo( x), x + y} complete in Pk (for any k, see Problem 3 2.14( 1)) or (b) the system {I, x + y, xy} complete in the class of polynomials.

(1) It is sufficient to construct the functions x + y and xy. We have 1 + 1 + 1 x 1 = 3, 1 + 3 + 1 x 1 = 5, ... , 1 + (k - 2) + 1 x 1 = k = 0, x + y + x x 0 = x+y, (x+l)+ ... +1=x-1, x+O+x(y-l)=xy.

'-----v----" k-l times

(2) It is sufficient to construct the system {jo(x), x + y}. We have x-x+l = 1, 12-1 = 0, x-O+l = x+l, x-(y+1)+1 = x-y, 1 X

x 2 = x 2 , X 2 X 2 = x\ ... , X k - 3 X 2 = X k - 1 (Note that k-l is even, since k is a prime number of not less than 3),1- X k - l = jo(x), 0 - x = -x, x - (-y) = x + y.

(3) We construct the system {jo(x), x+y}: x+ ... +x = 0 (k terms), 0-1 = -1, x 2(-I) = _x2 , X 2(_X 2 ) = -x\ ... , x 2(_X k - 3 ) = _xk-\ (-1) + ... + (-1) = 1(k -1 terms), 1 + (_X k- 1 ) = 1- X k- 1 =jo(x).

(4) We construct the functions 1, x + y and xy: x(k - 1) + x - (k - 1) + z = z+l, (k-l)+1 = 0, 0+1 = 1, xxO+x-O+y = x+y, (x+l)y+x+1-y+0 = xy+x+l, x+(k-l) = x-I, x(y-l)+x+l = xy+l, (xy+l)-1 = xy.

Page 330: Problems and Exercises in Discrete Mathematics

3.2. CLOSED CLASSES AND COMPLETENESS 323

3.2.23. (1) Take into account the fact that {jo(x), x + y} is a complete system and that ji(X + i) = jo(x), i = 1 ... , k - 1.

(2) Consider Post's system.

(3) Adding, for example, the functions'" x and x, we can construct Post's system.

(4) Post's system can easily be constructed by adding, for example, the functions '" x and x.

3.2.24. (1) For k = 4 and 6, we can consider the function f(x + 1, x).

(2) For k = 4, analyze the function f(2, x) and for k = 6, the function f( 4, x).

(3) For k = 4, we can consider any of the functions (f(0, X))2, (f(x + 1, X))2 and 1 - f(2, x), while for k = 6, the function 1- f(4, x) should be considered.

(4) For k = 4, any of the functions (f(x, 0))2, (f(x, X))2, (f(x + 2, X))2 or f(2, x) - 2 is suitable. For k = 6, we can consider the function f( 4, x) - 2.

3.2.26. Take into account the fact that {O, 1, ... , k - 1, Jk-1(X), min(x, y), max(x, y)} C U ({O, 1, ... , k - 2}, {k - I}), min(Ji(x), Jk-1(X)) == 0, 0::; i ::; k - 2, and max(Jo(Jo(x)), Jo(x)) == k - l.

3.2.27. If the variables of the functions belong to the set {Xl, X2, ... , xn , ... },

the number of different functions in any closed class in Pk (including Pk as a particular case) is not more than countable. Let a closed class A(~ Pk ) have a finite complete system. Then any basis in it is finite. Consequently, the power of the set of its bases does not exceed the power of the set of all its finite subsystems, which (as is known from the theory of sets) is not more than countable.

3.2.29. (1) Let us prove that the class Kl contains only one (accurate up to a redesignation of variables) function of one variable g( x) = x2• We denote the function x2y2 by f(x, y). We have

Obviously, x2 -I x and x2 -I const.

(2) Let us denote the function jl(X)j2(y) by <p(x, y). We have <p(x, x) = 0, <p(0, x) = <p(x, 0) = <p(0, 0) = 0. Therefore, K2 contains only one function depending on no more than one variable, and this function is an identical zero.

3.2.32. Let us calculate the number of nonessential functions in p~n) and subtract the obtained expression from kkn. A function is not essential if it takes less than k different values (in Ek ) or takes all the k values (in Ek ), but essentially depends only on one variable. The number of first-type functions can be determined by the inclusion-exclusion method. It is

Page 331: Problems and Exercises in Discrete Mathematics

324 CHAPTER 3. MANY-VALUED LOGICS

The number of the second-type functions is (k!)n.

3.2.33. Let us establish a one-to-one correspondence between all rational numbers of the segment [0, 1] and the set of functions {h, h, ... , 1m, " .}. We take an arbitrary real number / E [0, 1] and denote by C",/ the subset of all such functions in {h, h, ... , 1m, ... } which, given the chosen correspondence, are in

compliance with all rational numbers less than /. For /1 < /2, we have C"'/l (;)C"'/2' Let B",/ = [C",/], Obviously, B"'/l (;)B",/2 for /1 < /2·

Page 332: Problems and Exercises in Discrete Mathematics

Chapter 4

Graphs and Networks

4.1 Basic Concepts of Graph Theory

4.1.1. It follows from the calculation of pairs (v, x), where v E V, x EX, and v and x are incident.

4.1.2. (2) None. 4.1.5. (1) Let O(v) be the set of vertices adjacent to v and O'(v) = {v} U O(v).

By hypothesis, 10'(v)1 2:: (n + 1)/2 and IV \ Q'(v)1 :::; (n - 1)/2. Hence, it follows that each vertex from V \ 0'( v) is adjacent to a vertex from 0'( v) and, hence, the graph is connected.

(2) It is possible for an even n and impossible for an odd n. 4.1.10. Let [v, u], [w, t] be two chains of maximal length which have no common

vertices in a graph G. The graph G is connected. Consequently, there exists a chain Z, connecting, for example, vertices v and w. Let Vl be the last vertex of the chain [v, u] which is met on the path from v to w along the chain Z and Wl be the first vertex of the chain [w, t], met on this path after Vl. The vertex Vl of the chain [v, u] divides it into two parts: lv, VI] and lvI, u]. Let lv, VI] be no shorter than [Vb u]. Similarly, the vertex Wl divides the chain [w, t] into two parts. Let [w, Wl] be no shorter than [Wl, t]. Then the chain [v, VI, WI, w] is longer than each of the chains [v, u] and [w, t]. We arrive at a contradiction.

4.1.18. Hint. Consider the complements of the graphs G and H. 4.1.20. 2p. 4.1.22. Six. 4.1.24. (1) Let v, u and W be three vertices of the same degree of a graph G in

Rn. We assume that v and u are adjacent, and w, v are not. For vertices u and w, at least one of the inclusions O(u) ~ O(w) or O(w) ~ O(u) is valid. It follows, therefore, from this and from the equality 10(u)1 = 10(w)1 that O(u) = Q(w) and, therefore, v E O(w). Let us now consider the pair v and w. It follows from the fact that the inclusion 0' (v) ~ 0' (w) does not take place, since u E 0'( v) \ O( w). The inclusion O'(w) ~ O'(v) is not valid either since 10'(w)1 = 10'(v)l. We arrive at the contradiction.

4.1.25. (1) The number of edges of the graph G are equal to the sum of the numbers of edges of graphs Hi, divided by n - 2.

325

Page 333: Problems and Exercises in Discrete Mathematics

326 CHAPTER 4.

(2) This follows from 4.1.25 (1).

4.1.28. Two. 4.1.34. Yes, there exists. 4.1.35. Yes, it is.

4.1.39. No, it is not.

GRAPHS AND NETWORKS

4.2 Planarity, Connectivity, and Numerical Characteristics of Graphs

4.2.5. Let G be a flat 2-connected graph with at least two internal faces. If there exists an internal face separated from the external face by a single simple chain, then the deletion of this chain leads to a 2-connected graph (prove this statement). Suppose that there is no such face. Then any internal face having a common chain with the external face has at least one vertex in common with it, which does not lie on this chain. Let us prove that this case is impossible. We number all internal faces. We mark by an index i the connected pieces of the boundary of the external face which simultaneously belong to an internal face with the number i. Then there exist such indices i and j which are met during the circumvention of the boundary of the external face in the sequence i,j,i,j. We denote the corresponding pieces of the boundary by fil' fjl' fi2' f j2 ,. Let us choose on these pieces points aI, bI, a2, b2

on the plane (one point on each piece). Then the points al and a2 can be connected by a curve whose all points except al and a2 are internal points of the face with the number i, while the points bl and b2 can be connected by a curve whose internal part lies in the face with number j. The curves intersect at a certain point d which is, hence, an internal point of two different faces. We arrive at a contradiction.

4.2.9. Suppose that the degree of each vertex of a 2-connected graph G is more than 5, and let G' be its planar representation. Let n be the number of vertices, m the number of edges, and 1" the number of faces of the graph G' (including the internal and external faces). According to Problem 4.2.6, we have 1" = m - n + 2. The number of pairs of the form (v, x), where v is a vertex incident to the edge x, is equal to 2m. On the other hand, this number is equal to the sum of the degrees of the graph vertices. Since, by hypothesis, each degree is no less than 6, we can write 2m 2: 6n, i.e. m 2: 3n. The boundary of each face has at least two edges, and each edge belongs to a boundary of no more than two faces. Hence, 31" ~ 2m. It can be easily seen that the system 1" = m - n + 2, m 2 3n, 31" ~ 2m is incompatible.

4.2.14. We assume that the graph Ks is planar. Let K~ be its planar representation. Then the number 1" of faces of the graph K~ is 1" = m - n + 2, where m is the number of edges, and n the number of vertices. As in Problem 4.2.9, we have 31" ~ 2m. Hence, m ~ 3n - 6. But m = 10 and n = 5. We arrive at a contradiction. While proving the nonplanarity of the graph K 3 ,3, we note that each of its cycle contains at least four edges. Assuming that K 3 ,3 is a planar graph, use Problem 4.2.11.

Page 334: Problems and Exercises in Discrete Mathematics

4.3. DIRECTED GRAPHS 327

4.2.22. Each vertex of a 6-connected graph has a degree of no less than 6 (see Problem 4.2.9).

4.2.27. (3) X(Bn) = 2, X'(Bn) = n. 4.2.28. Two. 4.2.45. (1) Let r(m) be the number of terminal coverings of a chain of length m.

Then r(m) = r(m - 2) + r(m - 3), r(l) = r(2) = r(3). The solution of recurrence relations of this type is given in Section 8.3.

4.2.49. (1) Vk(G) is the average number of vertices which are not adjacent to the vertices of the subset U ~ V of degree k. Consequently, there exists a subset Uo, lUol = k, such that II(UO) ::::: Vk(G). If W is the set of vertices which are not adjacent to the vertices from Uo, then W U Uo is the vertex cover of a size not exceeding k + Vk( G).

(2) Let e(v, u) = 1 if the vertices v and u are not adjacent and e(v, u) = 0 if they are. Let Sk( v) be the number of subsets U ~ V composed of k vertices, none of which is adjacent to v, and let d( v) be the degree of the vertex v. Then

L II(U) = L L L e(v, u) U~V, IUI=k U~V, IVI=k uEU vEV

= L Sk(V) = L (n - d(V)) ::::: IVI (n - do). ~v ~v k k

Hence,

IVI-I ( d) ih(G) ::::: IVI g 1 - IVI ~ i .

4.3 Directed Graphs

4.3.2. The proof can be carried out by induction on the number of vertices of the digraph. On an inductive step, it is expedient to delete one of the vertices VI or V2 from the digraph.

4.3.5. Use induction on the number k. 4.3.8. The statement can be proved by induction on the number of vertices in

the tournament. 4.3.10. For n = 1, the inequality is obvious. Let it be valid for such n that

1 ::::: n ::::: m. Let us consider the tournament T with m + 1 vertices. Since any tournament with m + 1 vertices has exactly C~+1 arcs, there exists a vertex Vo with an out-degree of no less than [( m + 1) /2]. Having deleted the vertex Vo in T, we get a tournament T' which has m vertices and contains a set S consisting of at least f( m) of concordant arcs. The arcs emerging from Vo and the arcs belonging to S are concordant. Using the inductive hypothesis, we obtain

f(m+1) ~ [m;l] + [;]. [m;l] = [m;l]. [m;2].

4.3.12. Any group of even order contains at least one element inverse to itself and differing from the unit element of the group. If the group order of the tournament T

Page 335: Problems and Exercises in Discrete Mathematics

328 CHAPTER 4. GRAPHS AND NETWORKS

would be even, the group would contain an element 0: satisfying the above property. Since 0: is not a unit element, there exist two vertices VI and V2 such that 0:( VI) = V2

and 0:(V2) = VI. Let T contain the arc (VI, V2)' Then the arc (o:(vd, 0:(V2)) should also belong to T. We arrive at a contradiction.

4.3.15. The proof can be carried out by induction on the number of strong components of the tournament. If there is only one vertex in the condensation or even there are two vertices in it, the condensation is by definition a transitive digraph.

4.3.19. Carry out induction on the number of vertices in the digraph. At an inductive step, one of the vertices with zero out-degree should be deleted after establishing beforehand the existence of such a vertex in the given digraph.

4.3.21. Proof can be carried out by induction on the number of vertices in the digraph.

4.3.25. Carry out induction over the length of a contour. 4.3.29. Proof can be carried out by induction on the determinant order.

4.4 Trees and Bipolar Networks

4.4.2. Starting from an arbitrary vertex of the tree, we construct a chain, adding a new vertex on each step as long as possible. At the moment when it becomes impossible, the end vertices of the chain will become terminal vertices of the tree. The process of construction terminates since the set of vertices is finite, and there are no cycles in the tree.

4.4.4. (1) According to Problem 4.1.25, the number of edges in the graph G and its connectivity can be reconstructed from F( G).

4.4.9. The induction can be carried out on the magnitude of the tree radius. 4.4.12. The cardinality is continual. 4.4.14. 2. 4.4.23. Carry out induction over the length of the vector. 4.2.28. It is true. 4.4.30. It is true. 4.4.31. Generally, it is not true. 4.4.32. Generally, i t is not true. 4.4.33. n - 1. 4.4.34. An irreducible network does not have parallel edges and is not p­

reducible. Hence, m ::; (;) - 1. Each internal vertex in an irreducible network has a degree no less than 3 and poles have a degrees no less than 2 for n > 2.

4.4.40. (1) (a), (b) and (c). Yes, it can. (3) (a) and (b). No, it cannot. 4.4.43. Consider r;;." m > 3. 4.4.52. No, it is not.

Page 336: Problems and Exercises in Discrete Mathematics

Chapter 5

Elements of Coding Theory

5.1 Hamming's Distance

5.1.2. (1) n2n- 1 ;

(2) (k±;-r) (~_~:} (3) t (ji:r) (7+~-:). ;=0 2 2

5.1.7. Hint. Prove that the number 1jJ(n) of vectors a E B~n such that Z=~1 (}:i ::; T for all m = 1, 2n satisfies the recurrent relation

n

1jJ(n) = L: 1jJ(i - l)1jJ(n - i), 1jJ(0) = 1jJ(1) = 1. i=l

Using this relation, prove that 1jJ(6) = 132.

5.1.8. (n-r~-l)).

5.1.9. (2) We prove that the level Bf is a complete set for n > 2. Let Oi be a vector in Bf, in which the i-th coordinate is equal to 1. Let the distances p( Oi'~) = ri, i = r,-n be specified. Let us demonstrate how ~ can be reconstructed. If ILSII = k > 0, we obviously have r~ E {k - 1, k + I}. Let max1:5i:5n ri ~ 2 ,:nd A(,B) = i : ri = min1<j<n rj. If i E A(,B), then the i-th coordinate of the vector ,B is equal to 1 or else it is-equal to O. Ifmax1<j<n rj = 1, then ~ = O. For n = 5, the level Bf is not a basis set, since the set (00001),(00010),(00100), (01000) is complete. For n = 2, the set {(01), (10)} is not complete.

(3) For an even nand k = n/2, for any n > 1 and k = 0, n. (4) Let A = {a!, ... , ad be a complete set. Let us consider the set of

equalities p(Oi'~) = ri,i = U. Obviously,ri E {O,l, ... ,n},i = U. Each tuple (1"1,1"2,"" rk) for which the set has a solution uniquely determines a certain vector ,B E Bn. Hence, it follows that (n + l)k ~ 2n. Hint. The upper bound for the number of vectors in the base system can be obtained from the fact that

I For a nonintegral a, (:) is assumed to be equal to O.

329

Page 337: Problems and Exercises in Discrete Mathematics

330 CHAPTER 5. ELEMENTS OF CODING THEORY

the set of equations p(ai'~) = T'i,i = 1,k, can be reduced to an ordinary set of linear equations. For k > n, some of the equations of this system can be expressed as linear combinations of the remaining equations. Such equations and, hence, the vectors corresponding to them, can be omitted.

5.1.10. Sufficiency. The commutation of coordinates of all vectors in Bn, as well as the inversion of the coordinates iI, i2 , ••• , ik of all vectors in Bn do not change the separation between the vertices. Necessity. Let r.p be a mapping of the cube Bn into itself such that for any a and ~, p( r.p( a), r.p(~)) = p( a, ~). Let us consider the set D = B~ U Bf which is complete in Bn (see the previous problem). Let r.p(D) = {r.p(0), r.p( al), ... , r.p( an)} be an image ofthe set D and ai be a vector in Bf whose i-th coordinate is equal to unity. We put ~i = r.p(0) Ee r.p( ai), i = G. We have II~ill = p(O'~i) = p(r.p(O) Eer.p(O),r.p(O)Eer.p(a;)) = p(r.p(O),r.p(ai)) = p(O,ai) = 1. Let j (i) be the number of the coordinate of the vector ~i' which is equal to unity, i = G. Then the mapping 7r: i ---4 j(i) is a permutation on the set {I,2, ... ,n}. For an arbitrary a = (al,"" an) in Bn, we put 7r( a) = (a1r{1), ... , a1r(n)). We show that, for any i' E Bn, the equality r.p(i') = 7r(i') Efjr.p(O) is valid. Thus, the necessity is proved. Indeed, p( r.p( i'), r.p(0)) = p( i', 0), p( r.p( i'), r.p( a;)) = p( i', a;). On the other hand, p(7r(i') Efjr.p(O),r.p(O)) = p(i',O),p(7r(i') Eer.p(O),r.p(ai)) = p(i',a;). Obviously, the sets r.p( D) and D are complete in Bn. Hence, it follows that r.p( i') and 7r( i') Efj r.p( 0) coincide.

5.1.11. e~:~~l).

5.1.12. (1) Hint. Consider the set {a: Iiall 2] n±;+1 [, a E Bn}.

5.1.13. (1) The proof is similar to 5.1.25. (2) A = {a: ° E Bn, 11011 is even}.

5.1.14. For n = 1,2, the statement is obvious. Let 01,02, ... , a2n be a cycle in Bn. Let ~i7' where ~ E Bn, (J E {O, I}, denote a vector of length n + 1, whose first n coordinates coincide with the corresponding coordinates of the tuple ~, and the (n + 1)-th coordinate is (J. Then the sequence al 0, a20, ... , a2nO, a2n 1, ... ,021, all is a cycle in Bn±l, containing all its vertices.

5.1.15. (1) (a), (c), (e), (g), (h) Yes; (b), (d), (f) No.

5.1.16. (2) For A such that IAI = 2n-l, we can take any (n - I)-dimensional face containing 1. For an odd n, we can take the set {a: Iiall 2 (n + I)/2}. On the other hand, if IAI > 2n-l, there exist in A two opposite tuples whose intersection is O.

5.1.18. For the cube Bl, the partition consists of a single chain Z = {(O),(I)}, Zl = {(IO)} and Z2 = {(OO), (01), (lI)} can be taken as a partition chains for B2 • The properties (1) and (2) are satisfied for these partitions. We assume that the statement is proved for cubes with a dimension not exceeding n and then prove the statement for Bn±l. By hypothesis, there exists a partition of faces B;+1·n±l and Bn±l.n±l into a chain which satisfies the conditions (1) and (2). Partitions in B;+1·n±l and B~±l.n+1 can be chosen in such a way that they are isomorphic, i.e. such that the chain Zo = (aI, a2, ... , as) belongs to a partition of the cube B~±l.n+1

Page 338: Problems and Exercises in Discrete Mathematics

5.2. HAMMING'S CODES 331

if and only if the chain Zl = {ii;, ii~, . .. ,ii~} obtained from Zo by substituting unity for zero at the (n - 1)-th coordinate in each tuple iii in Zo belongs to a partition of the face B~+!,n+l. Let Zo = {ii1 ,ii2, ... ,iis} and Zl = {ii;,ii~ ... ,ii~} be two . h' h" . . f h f Bn+1 n+l d B n+1 n+l W Isomorp IC cams m partitIOns 0 t e aces 0' an 1 ' . e construct two new chains Zo = {iil,ii2, ... ,ii.,ii~} and Zl = {ii;,ii~, ... ,ii~_l}' The chain Zo is

obtained from Zo by adding the vertex ii: E Zl, while the chain Zl is obtained from Zl by omitting the vertex ii:. We proceed in this way with each pair of isomorphic chains. As a result, we obtain a partition of the cube Bn+! into nonintersecting chains. The fulfillment of conditions (1) and (2) can be easily verified.

5.2 Hamming's Codes

5.2.1 (1) 3; (2) 4; (3) 3; (4) 4; (5) 4.

5.2.2 (1), (3) (a) 1, (b) 2; (2), (4), (5) (a) 1, (b) 3.

5.2.3. (1) (a) 0, (b) 1; (2) (a) [(n -1)/2], (b) n -1; (3) (a) [(2n -1)/2], (b) 2n - 1; (4) (a) 0, (b) 0 for odd nand 1 for even N.

5.2.4. (1) 100110; (2) 1l001l; (3) 0011001; (4) 1010101; (5) ll10010ll0ll; (6) 0010110001111; (7) 1110000ll0011; (8) 000011ll0111011.

5.2.5. (1) 1; (2) 1l0; (3) 1l0; (4) 0011; (5) OlDl; (6) 1l01; (7) 001l; (8) 0111110; (9) 1l01l0100; (10) l1ll0llll0l.

5.2.6. Let ii and i' be two different vectors (messages) and ~(ii), ~(i') their

Hamming codes. Note that if p(ii, i') ~ 3, then, obviously, p (~(ii), ~(i')) ~ 3.

ii of- i' yields p (~( Q), ~(i')) 2: 1. Hence, two cases are possible.

(1) p( Q, i') = 1 . There is a single digit where Q and i' are different. Let i be the number of this digit in ~(Q) Cas well as)n ~(i')). Let (0'0"'" O'k-d be the binary expansion of i. The vectors !3( Q) and !3( i') are different in all coordinates q such that O'q = 1. Since i is an information digit, i is not a power of 2. Hence, there more than one control digit which are different in ~(Q) and ~(i'). Together with one

information digit, this provides the validity of the inequality p (~(Q), ~(i')) 2: 3.

(2) p( ii, i') = 2. There are exactly two digits which are different in ii and i'. Let i and j be their places in ~(ii) as well as in ~(i'). Let s be one of the numbers of digits where the binary expansions of i and j are different. Then control digits with number s are different in ~(ii) and ~(i'). Together with i and j, it gives three digits in which h ii) and ~(i') are different.

5.2.7. Let p(v, w) :::; 2t for some v and w in C. Then S~(v) n S~(w) of- 0. Consequently, any mapping 1jJ: Bn --7 C such that S~(u) ~ 1jJ-l(U) for any u E C is not single-valued.

Page 339: Problems and Exercises in Discrete Mathematics

332 CHAPTER 5. ELEMENTS OF CODING THEORY

5.2.8. (1) Generally, it is not true. (2) It is true. (3) Generally, it is not true.

5.2.9. The sets Co = {Q E C, Iiall is even} and Cl = {Q E C, IIQII is odd} are codes detecting a single error. At least one of them contains not less than half the number of words in C.

5.2.10. 2. 5.2.12. The size of a ball of radius d is equal to 'Lf=o (7). The balls with centers

in code words are not intersect and cover Bn. This follows the assertion.

5.2.13. No. Suppose the contrary. Let, for a certain n > 7, there exists a perfect (n, 3)-code. Then, in view of 5.2.12, the number 'LT=o (:) for this n is a power of

two. Consequently, for a certain k, the equality (n + 1)( n2 - n - 6) = 3 X 2k is valid. Then either n + 1 is a power of two, or n + 1 has the form 3 x 2r for a certain natural r. If n + 1 = 2r, then n2 - n + 6 = 3 X 2k-r. Substituting n = 2r - 1 into the last equality, we obtain 22r - 3 - 3 x 2r- 3 + 1 = 3 X 2k- r- 3 • For r > 3, the left-hand side is an odd number exceeding 3, while the right-hand side is either an even number or 3. The second case can be considered similarly.

5.2.15. Let the vertices Q = (aI, ... , an), ~ = (131, ... , f3n) and l' = bl' ... , In) form an (n, d)-code. Without loss of generality, Q = 6 and p( Q, ~) = d. We put AUT = {i: f3i = a, Ii = T}, a, T E {O, I}. Let us consider a vertex a such that ai = 0 for i E All and ai = 1 for i rf- All' We have p(Q, a) = 110'11 = IAOlUAloU Aool21AOlU AlOi = p(~, 1') 2 d,

p(o-, ~) 2 Ilill 2 d, p(a, i) 2 II~II = d.

5.2.17. Without loss of generality, we assume that 6 E C. For any Q E Bd+!, there exists a unique vertex 1 E C such that p(ii, 1) :<:; d. Since the weight of any nonzero code word is not less than 2d + 1, l' E B2d+l . Let A( 1') = {Q: ii E B'd+!' p( ii, 1') = d}. Then U'YEC n Bn A( 1') = Bd+! and for any 1'1, 1'2 in C n B2d+!

2d+l

we have A( 1'd n A( 1'2) = 0.

5.2.18. The code distance of any equidistant code of a size more than 2 is even.

5.2.20. (2) In each of the faces B;.~g,l, ... ,d and B;.~t,l, ... ,d, we construct codes Co and Cl of size m(n, d). Then COUCI is an (n + d, d)-code of size 2m(n, d).

(4) Hint. If C is an (n, d)-code in Bn, for (n - I)-dimensional face g, the set C ng is an (n - 1, d)-code.

5.2.21. See the proof of 5.2.12.

5.2.23. Let n < 2d and let C be an arbitrary (n, d)-code of size m 2 2. We construct a matrix M whose lines are code words. Let R be the sum of pairwise distances between (unordered) pairs of code words. On the one hand, R 2 (~) d.

On the other hand, R = 'Li'=l hi(m - hi), where hi is the number of unities in the i-th row of the matrix M. As h(m - h) :<:; m2/4, we have m(m - 1)d/2 :<:; nm2 /4. Hence, m :<:; 2d/(2d - n).

5.2.25. (3) Let C be the maximal (n, k, 2d)-code. Then the set Ci = {Q: Q E C, ai = O} is an (n - 1, k, 2d)-code. The number of pairs of the form (i, ~) such

Page 340: Problems and Exercises in Discrete Mathematics

5.3. LINEAR CODES 333

that 1 :s i :s n, ~ E Ci , does not exceed n . max ICil :s n . m(n - I, k, d). On the other hand, each vector ii E C generates n - k such pairs. Hence,

(n - k) . m(n, k, 2d) :s n . m(n - I, k, 2d).

5.2.26. Let ii E Bn, C S;; Bn and let C'" = H: i = ii ffi~, ~ E C}. Then, if C is an (n, d)-code and p(ii,~) < d, C",nCjj = 0. Indeed, let i E C"', a E Cjj and

iT' = iT ffi~, i' = i EEl ii. Then

p(i, iT) = p(ii EEl i', ~ ffi iT') = llii ffi l' ffi ~ ffi 17'11 = II(ii ffi~) ffi (i' ffi iT')11 =J 0, since otherwise ii ffi ~ = l' ffi a' and, hence, p(ii, ~) = p(i', a'). But p(ii, ~) < d and p( i', a') ~ d, since 1', a' E C. Hence, the statement follows.

5.2.27. This follows from Problem 5.2.26 if we take into account that in any (d - 1 )-dimensional face of the cube Bn, the pairwise distances between vertices do not exceed d - I, and the number of the vertices is 2d- 1 •

5.2.28. See Problem 5.2.9.

5.3 Linear Codes

5.3.1. (I), (4), (5) Yes. (2), (3), (6) No.

5.3.2. (1) (a) B3 , (b) Au {(OOO)}, (c) Au {(OOOO), (0111), (0101), (0010)}; (2) (a) I, (b) 2, (c) 2.

5.3.3. (1), (3), (5), (6) Yes. (2), (4) No.

5.3.4. (1) 2; (2) 5; (3) 18.

5.3.5. (1) 1;

5.3.6 (1)-(3) 1;

(2) 3;

(4) 6;

(3) 7.

(5) 4;

5.3.7 (1) m(C(H))=8, (2) m(C(H)) = 8, (3) m(C(H)) = 16, (4) m(C(H)) = 8,

d(C(H)) = 2; d(C(H)) = 2;

d(C(H)) = 3; d(C(H)) = 5.

(6) 7.

5.3.8. Supposing the contrary, we would have two different linear combinations equal to the same vector v E Bn. Summing them, we obtain a nontrivial linear combination which equals zero. This contradicts the independence of the vectors.

5.3.9. A linearly independent system is, for example, B~. If s vectors in Bn are linearly independent, all their combinations of the form (1) are pairwise different. If there exists a subset consisting of n + 1 linearly independent vectors, we would have the equality IBnl = 2n+l.

Page 341: Problems and Exercises in Discrete Mathematics

334 CHAPTER 5. ELEMENTS OF CODING THEORY

5.3.10. This follows from the fact that an (n, k)-code is a k-dimensional subspace of Bn, i.e. the maximum number of linearly independent vectors in it is k, and any linear combination of code vectors belongs to the code.

5.3.11. If there is a vector with an odd weight in the code, a half the number of code words have odd weights and the other half even weights. Otherwise, all the vectors are of an even weight. The former statement follows from the fact that the number of linear combinations containing a given vector with an odd weight is a half of all linear combinations.

5.3.12. A nonzero vector in Bn can be chosen in 2n - 1 ways. If i linearly independent vectors are chosen, the corresponding space has 2i vectors. Any vector in the complement to this space constitutes with i chosen vectors a linearly independent set, and any vector in the subspace can be represented as a linear combination of the chosen vectors. Thus, the (i + 1)-th vector can be chosen in 2n - 2i ways.

5.3.13. See Problem 5.3.12.

5.3.14. 2n-k.

5.3.16. (1) Let B be a basis of a linear code C. Then the matrix M(B), which rows are the vectors in B, is a generating matrix.

(2) Let B be a basis of the space orthogonal to code C. Then, the matrix M(B), the rows of which are the vectors in B, is a checking matrix.

5.3.17. The matrix M( C) generating the (n,; k )-code C can be reduced to the form (hP) by substituting for rows their linear combinations and transposing the columns. If a vector ii is orthogonal to each row of the matrix M(C), then a vector {J obtained from ii by an appropriate transposition of coordinates is orthogonal to each row of the matrix M(C), and vice versa. One of the generating matrices of the code C dual to the code C* generated by the matrix (hP has the form (pT I n - k ),

i.e. C' is an (n, n - k)-code. Hence, the code C' dual to the code C is also an (n, n - k )-code.

5.3.18. See Problem 5.3.17.

5.3.19. The solution follows from Problems 5.3.15 and 5.3.16.

5.3.21. The code distance d is obviously not smaller than the minimum weight of the nonzero code vector. If p( ii, ~) < d for some code words ii and ~, we arrive at a contradiction to the condition of the problem since ii Ell ~ is also a code vector and p(O, ii EEl {J) < d.

5.3.22. The number of ones in the matrix of the code C is equal to ~ICln. On the other hand, this number is not smaller than d(ICI-1).

5.3.23. Let ii = (aI, ... , an) be a weight-d vector orthogonal to the matrix H. We shall denote by hi the i-th column of the matrix H. It follows from the

orthogonality of a to each row of the matrix H that f: aihi = O. This leads to i=l

a linear dependence between the rows hi which appear in the linear combination.

Page 342: Problems and Exercises in Discrete Mathematics

5.4. ALPHABETIC CODE DIVISIBILITY 335

Consequently, to each vector Q of weight d in the null space of the matrix H, there correspond d linearly dependent columns of this matrix. Thus, every d - 1 columns of the matrix H are linearly independent, the minimum weight of the code vector is not smaller than d and, conversely, if there exists a set of d - 1 linearly dependent rows, there exists a vector of a weight smaller than d in the orthogonal subspace.

5.3.24. (1) Divide the n-cube into two the n - I-cubes. The part of the (n,d)­code in a subcube is a (n,d-l)-code.

5.3.29. (1) It follows from 5.3.23 that g(9, 5) ~ 10. We can easily construct a linear (9, 5)-code of power 4. Therefore, g(9, 5) E {4, 8}. Let us assume that C is a linear (9, 5)-code of power 8. Then four code vectors have an odd weight. No two of these four vectors lie outside B~. But among three vectors in B~, there are two where the distance between them does not exceed 4.

5.4 Alphabetic Code Divisibility

5.4.1. (1), (3), (4), (6) C is not a prefix code. (2), (5) C is a prefix code.

5.4.2. (1) Code C is not divisible. A nonuniquely decoded word is, for example, 0112201 = 0112 201. (2), (4), (5), (8) Code C is divisible.

(3) 001 0 0 01 0 01 = 0010001001; (6) 0110110011 2100 = 011 011 00112 100; (7) 01 021 01 12 = 0102 10112.

5.4.3. (1), (2), (4) B is a code of a single message. (3), (8) B is not a code of a message. (5) - (7) B is the code of more than one message.

5.4.4. Solution. Let C(A) be the set of binary expansions of numbers in A: C(A) = {I, 100, 110, 111, 1100, 1101, 10001}. Removing the words 1 and 110, we obtain a prefix code. It is easily checked that removing anyone word is unessential. We have for the problem (a) B = A \ {1,6}.

(2a) B = A \ {1,3,6,8}; (2b) B = A \ {I}; (3a) B = A \ {2,6, 7,8,9}; (3b) B = A \ {2, 7}; (4a) B = A \ {1,2,5}; (4b) B = A \ {1,2}.

5.4.5. (1) 1201012 = 1201012; (2) 0 101010 101010 101010 101010 = 01010101 01010101 01010101; (3) (01 )k(k+l)O;

(4) If k = 4, then 01010 101 = 01010101, if f k > 4, then 010 101 01010 = 01010 101 010;

(5) 0(10)H(m,k), where H(m, k) is the least common multiple of m and k; (6) (1100)k if k = 38, (8 = 1,2, ... ), 0 otherwise; (7) (101)kO for any k = 1,2, ... ,; (8) (101)k for k = 28.

5.4.6. (1) C = {a,ba,bba,bbb}; (2) C = {a,ba,bbba,bbab,bbbb,bbac};

Page 343: Problems and Exercises in Discrete Mathematics

336 CHAPTER 5. ELEMENTS OF CODING THEORY

(3) C = {ab,ba,bba,bbb,aaaa,aaba,aaba}; (4) C = {aa,ab,ba,bbaa,bbab,bbba}.

5.4.7. (1) No, since ~ + ~ + ~ + ~ = ~ > 1;

(2) Yes, since ~ + ~ + ~ + ~ < 1;

(3), (4) Yes.

5.4.8. (1) No. To prove it we use McMillan's inequality. Let Ii, i = 1,2, ... ,ICI be the code words lengths of the code C. Then

ICI ICI LTli ~ LTn = ICI·Tn > 1. i=1 i=1

The code cannot be divisible.

(2) If the C is a prefix code, it is divisible. A contradiction to (1).

5.4.9. Let a code C(:B) with the assembly of code word lengths 11,/2 , •.. , ITl be not divisible. Then, in the graph GE , there exists a contour or a loop passing through the vertex A.. The number of vertices (as well as arcs) in the contour is no more than in the graph GE and, consequently, not more than 1 + 2:;=1 (Ii - 1) = N - r + 1. Passing along the contour (the loop), consider the words assigned to the pair (vertex, arc, which is the end of the arc). It is clear that the common number of letters in these two words does not exceed I. It can be equal to I only for the first such pair. This implies the assertion.

5.4.10. Let C be an alphabetic code with the assembly of code word lengths II, h, ... ,ITl mini Ii = k, maxi Ii = k,2:i=1 = N. From the previous problem it follows that if the code c is not divisible, then there exists a word in the coding alphabet of a length no more than 1 + (N - r + 1) (l - 1) S Nt. Then its length in the message alphabet is no more than NI/k.

5.4.11. (1) Let I be maximal length of a word in M. Then, for the number r

of words in M, the following inequality holds: r S 2:~=1 qi = (ql+l - q)) / (q - 1).

From this I ~ logq(q + r(q - 1)) - 1. (2) The part 8, of the words of a length not exceeding I = (1- f) logq(l + r( q -1)),

is not more than (ql - q)/r(q - 1). If r ~ 2,q = 2, then 8, S (31-' - 2) S ~ < (~)1-'2-'. If r ~ 2, q ~ 2 and rq > 4, then r(q - 1) ~ 3 and

8, S ql+l/ (r(q - 1)) = q(1 + r(q - 1))1-'/ (r(q - 1))

S q C(q~l) + 1) 1-< (r(q -1)t' S q (~) (r(q -1)t'.

5.4.15. (1) The statement follows from results of Problem 5.4.9.

(2) Hint. Consider the code C(I:) = {a, (ab)k+l, (ba)k+2}, k 2: 1. A single contour passing through the vertex A. subsequently passes through the vertices (ba)k+l- i b, a(ba)i (i = 1,2, ... , k + 1), and the word corresponding to this contour looks like (abt+3k+2a.

Page 344: Problems and Exercises in Discrete Mathematics

5.5. OPTIMAL CODES 337

5.5 Optimal Codes

5.5.1. (1), (2), One of the possible codes is C = {O, 10, 110, 111}. (3) C =

{00,01,10,110,111}. 5.5.2. (1) For example, C = {a, b, ca, cb, cc}; (2) For example, C = {a,b,ca,cb,cca,ccb,ccc}. 5.5.3. (1) For example, P = g;~;~; ft; i2; i2;}. The optimal code is C =

{0,10,110,1110,11110,11111}. Solution. Carry out the reduction of the lengths: (1,2,3,4,5,5) --> (1,2,3,4,4) --> (1,2,3,3) --> (1,2,2) --> (1,1).

The binary code with an assemble of code word lengths (1,1) is uniquely determined (within a permutation of words) and is C = {O, I}. Consequently transform this code up to the required code:

C = {0,1} --> {0,10,11} --> {0,10,11} --> {0,10,110,111} --> {0,10,110,1110,1111} --> {0,10, 110,1110,11110,11111}.

(2) For example, P = (0.2; 0.2; 0.2; 0.2; 0.2), C = {00,01,10,110,111}.

(3) For example, P = G; ~; ~; ~; ft; ft; ft; ft), C = {00,01, 100, 101, 1100, 1101, 1l10, 1111}.

(5) For example, P = G; ~; ~; ~), C = {a,b,ca,cb}.

(10) For example, P = (~; ~; ~; ~; ~; ~; ~; ~), C = {a,b, ca,cb, cc,cd, da,db, dc, dd}.

5.5.4. (1), (3), (4), (8) The code is optimal. (2), (9), (10) The code is not optimal.

5.5.5. (a) (2), (4), (8), (10) The trees are saturated, the rests are not saturated. (b) (1), (2), (4), (8), (10) The trees can be frames of optimal trees, the rests

cannot.

5.5.6. (1) The statement is truth. Every binary optimal code is complete. (2),(4) In general, the statement is false (See Problem 5.5.5 b,l). (3),(5),(6) The statement is true.

5.5.7. (1*) Let C be a complete q-valued code with code word lengths Ii, i = 1, ... , r. Let 1 be the maximal code word length. The completeness of C implies that every code word of length 1 has some code word as a prefix. The number of words of length 1 having a fixed word of length Ii as prefix equals to ql-Li. Let Wi and Wj be two code words and B( w) the set of all words of length I having W as prefix. It is clear that B(Wi) n B(wj)) = 0. Hence, L1<i<r ql-l, = ql. Q.E.D.

(2) The base of induction is a binary optimal cod~ of size two. The inductive step is carried out by means of the Reduction Theorem.

(3) For q > 2, in general, the statement is false. For example, put q = 3, P = 0; ~; ~; ~}, C = {a,b,ca,cb}. The code C is optimal, but not complete because 1/3 + 1/3 + 1/9 + 1/9 = 8/9 < 1.

5.5.8. If, for some code word W of maximal length 1, a word differing from W in the last symbol does not exist, then we can replace it by its prefix of length 1-1. The

Page 345: Problems and Exercises in Discrete Mathematics

33S CHAPTER 5. ELEMENTS OF CODING THEORY

prefix property remains valid. The mean length decreases, which is in contradiction to the optimality of the code.

5.5.9. Hint. See 5.5.S.

5.5.10. (1), (4), (6) No, See 5.5.9. (2), (7), (S) No. McMillan's inequality is violated. (3), (5) An optimal code exists.

5.5.11. (1), (3), (5), (7), (9) Does not exist. (2), (4), (6), (S) does exist.

5.5.13. Hint. (1) Check that an almost uniform code can be obtained by the Huffman method.

(2) Hint. Consider the assembly of probabilities P = (~ + f, ~"",~, ~ - f), where f < !.

T

5.5.14. Hint. Carry out induction on r using the Reduction Theorem.

5.5.15. For example, P = (~,~, ... , 2}-2' 2r:" 2r:,)'

5.5.16. Base of induction r = 2. At the induction step, use Problem 5.5.14.

5.5.17. In the reduction process, an ambiguity can occur in the ordering the probabilities. If an assembly contains r probabilities, then there are no more than r-1 possibilities to place the sum of two minimal probabilities among r- 2 probabilities. During assignment of code words to the probabilities, there are two possibilities at every step. This completes the proof.

5.5.1S. (1) The number of non empty words of a length no more than r - 1 is equal to br- 1 = Ll<i<r qi :S (qT - q)j(q - 1). The number of one-valued mappings of the letters of the-alphabet A in words out of B*, [B[ = q of a length less than r,

2 does not exceed qr .

Page 346: Problems and Exercises in Discrete Mathematics

Chapter 6

Finite Automata

6.1 Determined and Boundedly Determined Functions

6.1.1. (1), (3), (6), (8) Yes, it is. (2), (4),(5),(7) No, it is not. (9) No, it is not, since y(9) = x(10).

6.1.2. (1) No, it is not, since cp(fjw) = Ow, but cp(OI[O]W) = iw, i.e. the first symbol of the output word is not defined uniquely by the first symbol of the input word.

(2) Yes, it is; cp(XW) = x(l)x(2) ... x(t) .... (3) No, it is not. Consider cp(OW) and cp(O[I]W). (4), (5), (9) No, it is not; (6), Yes, it is; (7) Yes, it is; cp(XW) = lx(I)lx(3)lx(5) ... ; (8) Yes, it is: cp(XW) = Ow since 1/7 = 0.(001) = 0.001001001 ....

6.1.3. (1) Yes, it is possible; g(XW ) = Ow. (2) Yes, it is possible; g(XW) = x(l)x(2) ... x(t) .... (3) Yes, it is possible g(XW ) = Oxw. (4), (5) Yes, it is possible. (6) Not, it is not possible; consider the input words x~ = I[O]W and x2' = iw. (7) No, it is not possible; consider the input words x~ = I[O]W and x2' = iw. (8) Yes, it is possible; g(XW) = Ox(1 )y(3) ... y(t) ... , where y(t) = x(t -1) EBx(I)'

x(2) EB 1.

6.1.4. (1) Yes, it is. (2) No, it is not. (4) No, it is not. 6.1.5. (1) It is impossible to a supplement the definition of a deterministic

function; (2) The function cp admits a supplement to the definition of a deterministic

function; (4) A supplement to a definition is impossible.

339

Page 347: Problems and Exercises in Discrete Mathematics

340 CHAPTER 6. FINITE AUTOMATA

6.1.6. (1) It is sufficient to consider the function

{ iw if X - OW i.p(XI' X2) = -w·f X2 = O-w' d X _ -w

Xl I 2 r an I - Xl·

6.1.9. (2) The weight of the function i.p is equal to 2. 6.1.10. (1) (a) No, they are not equivalent. (b) Yes, they are equivalent. (2) (a), (c) No, they are not equivalent. (b) Yes, they are equivalent. (3) (a), (b) Yes, they are equivalent. (c) No, they are not equivalent. (4) (a), (c) No, they are not equivalent. (b) Yes, they are equivalent. (5) (a), (c) Yes, they are equivalent. (b) No, they are not equivalent. (6) (a), (c) No, they are not equivalent. (b) Yes, they are equivalent. Hint.

i.p(XW) = 01[1l00]w. (7) (a) Yes, they are equivalent. Hint. i.px2(x(1)x(2) ... ) = z(l)z(2) ... z(t) ...

1

where z(t) = {X(t) if 1 + O. + x(l) + ... + x(t) < t/2 + 1,

1 otherwIse.

'Px.(x(1)x(2) ... ) = v(1)v(2) ... v(t) ... where 2

v(t) = {x(t) if 0 + O. + 1 + 1 + x(l) + ... + x(t) < t/2 + 2, 1 otherwIse.

(b) Yes, they are equivalent. (c) No, they are not equivalent; consider the functions i.px' and '-Px5 on the word

1 2

OW. (8) (a), (b) No, they are not equivalent; consider the residual operators on the

word O[I]w. ( c) Yes, they are equivalent.

6.1.11. (2) One can take the residual operator i.po generated by an arbitrary word of length 2.

(4) Examine the residual operator of the function 'Po generated by the word X2 = II.

(5) i.po(XW) = OO[OI11]W, i.p1(XW) = [1101]w.

6.1.12. (1), (2), (4), (5), (13) Yes, it is. All the weights are equal to 2. (3), (7), (14) Yes, it is. All the weights are equal to 3. (6), (12) Yes, it is. The weights are equal to 4; (8) Yes, it is. The weight is equals to 5. (9) Yes it is. The weight is 7. (10) No, it is not. (11) Yes, it is. The weight is 21.

6.1.13. (2) If T = 3, we can take i.p(XW) = (3/4).

6.1.16. For T = 3, we can take

. { y(l) = x(I), i.p. y(t) = (x(t) EB x(t - 1))y(t - 1), t 2: 2.

Page 348: Problems and Exercises in Discrete Mathematics

6.2. DIAGRAMS, EQUATIONS, AND CIRCUITS 341

6.1.18. See hint to Problem 6.1.6(1).

6.1.20. (2) In order to solve the problem, it is sufficient to consider the function

<p( XW) = 00x(2)x(3) ... x( t) ....

6.1.22. It is a generated operator.

6.1.24. (2) If IAI = 1 and lEI::: 2, then I<I>A,BI = c. If lEI = 1 and IAI ::: 1, then I<I>A,BI = 1.

6.1.25. (1) If IAI > 1, the power of each class Kj(s) is c.

(2) The number of different classes is IAls.

6.1.26. (2) If lEI = 1 and IAI::: 1, then I<l>A,BI = 1.

6.2 Diagrams, Equations, and Circuits

6.2.1.

(1) { y(t) = q(t - 1) --t x(t), q(t) = x(t), q(O) = O.

2 {y(t) = q(t - 1), () q(t) = x(t) I q(t - 1), q(O) = O.

(3) The Moore diagram is presented in Figure 6.1 (a).

( 4) ql (t) = ql (t - 1) V q2 (t - 1), { y (t) = x ( t) . ql (t - 1) --t q2 (t - 1),

q2(t) = x(t)· il1(t - 1) V (ql(t - 1) '" q2(t - 1)), ql(O) = q2(0) = O.

(5) Figure 6.1 (b); (6) Figure 6.1 (c); (7) Figure 6.1 (d); (8) Figure 6.1 (e);

(9) Figure 6.1 (f); (10) Figure 6.1 (g); (11) Figure 6.1 (h).

(12), (15) Hint. The weight of the function is equal to 3.

(13) Hint. The weight of the function is equal to 4.

(14) Hint. The weight of the function is equal to 2.

(17) Hint. The weight of the function is equal to 6.

(18) Hint. The weight of the function is equal to 7.

Page 349: Problems and Exercises in Discrete Mathematics

342

1(1) 0(0)

*. 0(1) .Q 0(0).0,1(0)

0 1(1)

0(1) *. • • o 1(1) 1

1 2

a

0(1)

0(0) 0 1(1) -2

1(1)

d 0(1),1(1)

CHAPTER 6.

0(0) 1(0)

~ o 1

0(1)

b

Fig.6.1

6.2.2. (1) Figure 6.2 (a);. (2) Figure 6.2 (b);

* 0

(3) The vertices 1 and 2 are equivalent, Figure 6.2 (c);

(4) Figure 6.2 (d); (5) Figure 6.2 (e);

FINITE AUTOMATA

0(0)

1(1)

1(0)

(6) The vertices 1, 2, and 3 are equivalent, Figure 6.2 (e);

(7) The vertices in tuples {0,2} and {1,3} are equivalent, Figure 6.2 (g);

(8) The vertices in triples {0,3,5} and {1,2,4} are equivalent, Figure 6.2 (h);

(9) Figure 6.2 (i);

(10) Figure 6.2 (j);

(11) Figure 6.2 (k).

Page 350: Problems and Exercises in Discrete Mathematics

6.2. DIAGRAMS, EQUATIONS, AND CIRCUITS 343

0(1)

~O 1(0)

0(0)

~O 1(0)

1 (0) 0(1)

~ *OU,2) 1(1)

a b c

1(1) 0(0) 1 (1) 0(1) 0(1)

Q 0(1) S)/(1) Q .. __ O"",(I<-) --<""-... 0",, 1 (1) _0 1 (0)

* •• _0::...l.(0:L~,,-,,I..>..:( I"",) --o-... ~:w 0 3

d

(0, 2) 0(0),1(0) (1,3)

*~ 1(1)

g

5

j

(0,2) 1

e

(0,3,5) 0(0),1(1) (1,2,4)

0(0)

0(1) 1(0)

*~ 1(0)

h

Fig.6.2

o (1,2,3)

f

(0,3,5) 0(0),1(1) (1,2)

*~

1(1)

k

1(0)

6.2.3. (1) The operator definition can be supplemented so that we can obtain a b.d.-operator of weight 4, described by the following canonical equations:

{ y(t) = X(t)ql(t - 1)q2(t - 1) EB ql(t - 1) EB q2(t - 1), ql (t) = m (x (t), ql (t - 1), q2 (t - 1)) EB x (t) EB ql (t - 1), q2(t) = x(t)(ih(t - 1) V ih(t - 1)) EB ql(t - 1) EB q2(t - 1), ql(O) = q2(O) = o.

6.2.4. (1) The weight is equal to 1. (2), (5) The weight is equal to 4. (3), (6) The weight is equal to 2. (4), (7), (8) The weight is equal to 3.

6.2.5. To each function of weight w (in the indicated set of b.d.-functions) there corresponds a canonical array containing n + 1 "input" columns (including the

Page 351: Problems and Exercises in Discrete Mathematics

344 CHAPTER 6. FINITE AUTOMATA

column describing the state of the function) and m + 1 "output" columns (taking into account the transition function). This array contains wk "input" tuples. At the "output" of the array, there must be some tuples of the set containing wkm elements ("output" tuples). In order to obtain the upper bound, we must assume that each "input" tuple can be associated with any "output" tuple.

6.2.7. (1) y(t) = q1(t - 1) V x(t)iMt -1), q1(t) = x(t)ij(t -1), q2(t) = X(t)q2(t -1), q1(0) = 1, q2(0) = O.

The weight of the superposition ({i1 «((i2) is equal to 2. So it can be defined by the following canonical equations and initial condition:

y(t) = x(t) ~ q(t -1), q(t) = x(t), q(O) = 1,

i.e. it is "functioning" in the same way as the function ({i1;

(2) Hint. The superposition's weight is equal to 3. (3) The superposition is the function of the weight 1. (4) Hint. The superposition's weight is equal to 4. (5) Hint. The superposition's weight is equal to 2. (6) Hint. The superposition's weight is equal to 5.

6.2.8. (1) Hint. The resulting function has the weight 2. (2) Hint. The resulting function is generated by the negation. (5) (a )-( c) Hint. The resulting function has a weight 2.

6.2.9. (1) The weight is 1. (2) (a) The weight is 2. (b) The weight is 1. (3) (a), (c) The weight is 1. (b) The weight is 2. (4) (a), (c) The weight is 1. (b) The weight is 2. (5) (a) The weight is 4. (b), (e) The weight is 2. (c), (d) The weight is 3. (In

(e) the vertices in pairs ((00), (01)) and ((10), (11)0 are equivalent.)

6.2.10. (1) (a) The weight is 4. (b) The weight is 2. (2) (a), (b) The weight is 3. (3) (a) The weight is 1. (b), (c) The weight is 2. (4) (a)-(c) The weight is 2.

6.2.11. (1), (4) The weight is 4. (2) The weight is 2. (3) The weight is 3. (5) The weight is 7.

6.2.13. (12) Hint. The function's weight is equal to 3;

Page 352: Problems and Exercises in Discrete Mathematics

6.3. COMPLETENESS IN AUTOMATA 345

(13) The canonical equations and initial conditions for some continuation of the function can be written in the following way:

6.2.14.

y(t) = x(t) rv q2(t - 1), ql(t) = x(t) . iit(t - 1) . iMt -1), q2(t) = x(t) . ih(t -1) . iMt -1), ql(O) = q2(0) = O.

(3) y(t) = ql(t - 1) . iMt - 1), ql(t) = x(t), q2 ( t) = ql (t - 1), ql(O) = q2(0) = O.

(7) Yl(t) = X2(t) . ql(t - 1) V q2(t - 1), Y2(t) = Xl(t) . q3(t - 1), ql(t) = X2(t) . ql(t - 1) V q2(t - 1), q2(t) = Xl(t), q3(t) = X2(t), ql(O) = q2(0) = q3(0) = O.

6.2.16. (1) and (2) Consider the operator 'Pd('Pd). (5) It is expedient to analyze the operator 'Pd('P=O), where 'P=o is an operator

generated by the constant O.

6.2.17. (2) The operator is autonomous. (3) The operator is not autonomous.

6.2.2. (2) Such a circuit exists.

6.2.23. First, draw all possible three-vertex digraphs with numbered vertices which satisfy condition (c) and are such that the out-degree of each vertex is equal to 2. The digits 0, 1 and 2 can be taken as the numbers for vertices. It is convenient to take the vertex marked by 0 is convenient to be as initial one. Then the arcs of each of the constructed digraphs must be "loaded" in all possible ways so as to obtain Moore's diagrams of some b.d.-operators.

6.3 Closed Classes and Completeness in Automata

6.3.1. (1),(2) The unit delay is generated from 'P2 by identifying the variables. (3) Consider the functions 7fJl(X) = 'P2(X, x), 7fJ2(X,y) = 'Pl(X,y,7fJl(X)), and

7fJ3 ( x) = 'P2 ( X , 7fJl ( X ) ) . (4) The unit delay and the function, generated by the Pierce's arrow, are

constructed as follows: 7fJl (x) = 'P2( x, x, x), 7fJ2( x) = 'PI (x, 7fJl( x)), 7fJ3( x, y) = 'Pl(X,7fJ2(Y)), 7fJ4(X) = 'Pl(X, x), 7fJs(x) = 'P2(7fJl(X), 7fJ4(X) , x), 7fJ6(X) = 7fJ2(7fJS(7fJ2(X))).

Page 353: Problems and Exercises in Discrete Mathematics

346 CHAPTER 6. FINITE AUTOMATA

(5) The required functions can be obtained as follows: 1,&1 (x) = 'PI (x, x), 1,&2 ( X) = 1,&1 ( 'P2 ( X ) ) .

(6) Obtain from the function 'Pt, the function 'P=l(X), generated by one, and then place it properly in 'P2.

(7) Obtain from the function 'PI the function 'P=o(x) and place it in the function

'P2· (8) The function, generated by the conjunction, can be obtained by introducing

the feedback in the variables X3 and Y2 into the function 'P2. Then, construct the function 'P=o(x) and consider the superposition 'P2('Pl(X),'Pl(X),'P=o(x)),

(9) Placing the function 'PI (x, x) properly in the function 'P2, we obtain the func­tion 'P=l (x). The unit delay can be built by introducing the feedback in the variables X2 and Y2 in the function 'P2.

6.3.2. (1) Assuming X3 = X2, we obtain the function generated by the Sheffer's stroke. Then construct the functions 'P=o(x), 'P=l(X), 'Px(x) and construct the superposition 'P( 'P=l (x), 'P=l (x), 'P=o( x), 'Px( x)).

(2) 'P(Xl,X2,X3) = 'PXIVX2(Xt,X2); so, ['P]o ::::> {'P=o(x), 'P=l(X), 'Px(x)}. Then 'Pd(X) = 'Px('P('P=l(X),X,'P=o(x))),

(3) If X2 = Xl, then 'P(Xl' Xl, X3) = 'PXl&X3(Xl, X3)' Then construct 'P=o(x), 'P=l(X) and, finally, the unit delay 'Pd( x) = 'P( x, 'P=o( x), 'P=l (x)).

(4) Putting X3 = X2, we obtain 'P(Xl,X2,X2) = 'PXl&X2(Xl,X2). Further, 'Pd(X) = 'P( 'P=l (x), x, 'P=o( x)).

(5) Assuming X3 = Xl, we can see that the function 'PXl (xd is obtained at the first output of the function 'P(xt, X2, Xl)' and the function 'PX2->Xl (Xl, X2) is obtained at the second output. Then we construct 'P=o(x), 'P=l(X), and a unit delay 'Pd(X) = 'Px('P('P=l(X),'P=l(X),'Px(x))).

6.3.3. (1) The function 'P=o(x) can be removed (it can be obtained from 'Pd(X) by applying the operations of union, identification of inputs and feedback).

(2) The first two functions can be removed because 'Px->y(x,x) = 'P=l(X), 'Pd('Px('P=lX))) = 'P=o(x), 'Px->y(x,'P=o(x)) = 'Px(x), 'Px~y( x, y) = 'PXj&X2 ('Px->y( X, y), 'Py->x( X, Y)), 'Px&y( x, y) = 'Px( 'Px->y( X, 'Pii(Y)))' (3) The first two functions can be removed because:

(a) 'Pd('Px.y(x, x)) = 'Pd(X); (b) the function 'P=o( x) can be obtained from 'Pd by applying the operations of

union, identification of inputs, and feedback;

(c) 'Pxvii('P=O(x),y) = 'Pii(Y); (d) 'Px&y(x, y) = 'Px('PXVii('Px(X) , y)); (e) 'Pxff)y = 'PX('PXl&X2('Pxvii(x,y),'Pxvy(x,y))). (4) The function 'Px(x) can be removed because 'PxVy('Pd('P=O(x)),'Pii(Y)) = 'Pii(Y)' (5) The first and third functions can be removed.

6.3.8. The statement can be proved as follows. Let M be a closed class in cl>(k)

which differs from the entire set cl>(k)' We assume that M is not a precomplete class

and consider the totality of all subsets M' in cl>(k) \ M, which satisfy the condition

Page 354: Problems and Exercises in Discrete Mathematics

6.3. COMPLETENESS IN AUTOMATA 347

[MUM']o oF <I>(k)' This totality is not empty. We choose in it a maximum chain (by inclusion) whose existence can be established either with the help of Zermelo's axiom of choice, or by directly taking into account the count ability of the set <I>(k)

(by arranging the set <I>(k) \ M in the form of a natural scale). The union of all the sets of the chosen maximum chain will be denoted by Mo. Then M U Mo is a precomplete class in <I>(k)' In the proof, we essentially use the fact that there

exists in the set <I>(k) a finite system complete with respect to the set of operations 0= {Ol, O2 , 0 3 , 0 4 , 5}.

6.3.11. This fact can be proved almost in the same way in which the validity of a similar statement was established in Boolean algebra (see Problem 2.1.16).

6.3.12. Yes, there exists such a function (see Problems 6.3.11 and 2.1.17).

6.3.13. Cf. Problem 2.1.19.

6.3.14. For k 2:: 3, the statement directly follows from the corresponding result in Pk . In the general case (for k 2:: 2), the subsets of autonomous operators can be used.

6.3.15. It is countable.

6.3.17. This power is continual.

6.3.18. It is expedient to use the "pigeon hole principle", i.e. to compare the powers of the corresponding sets.

Page 355: Problems and Exercises in Discrete Mathematics

Chapter 7

Elements of Algorithm Theory

7.1 Turing Machines

7.1 1. (1) (a) T(P) = 130212. (b) The machine T is not applicable to the word 13013 . (c) T(P) = 10[01]21.

7.1.2. (4) The program of one of all possible machines has the form

ql q2 q3 0 qoOS q20S q30S 1 q2 1R q3 1R q3 1S

7.1.4. (3) A Turing machine transforming the configuration Kl into Ko can be specified by the following program:

q10q20R q4 1q41L q11q11R qsOq60R q20q31R qs1qs1L q21q21R q6 1q70R q30q41L q70qoOR q40qsOL q71q11R

7.1.5. (1) This can be done as follows: each command of the form qiexqjj3S (where ex and j3 belong to the external alphabet A) in the program of the Turing machine is replaced by IAI + 1 commands qiexqjj3R, qjtqj/L (r runs through the alphabet A), where qj is a new state (each state is characterized by its own qj).

7.1. 7. In order to construct the machine T m, it is sufficient to add m additional (new) states q~, ... , q:" and "supplement" the program of the machine T, for example, with the following commands: q~aq~aS, ... , q:"aq:"aS, where a is a fixed character of the external alphabet.

348

Page 356: Problems and Exercises in Discrete Mathematics

7.2. RECURSIVE FUNCTIONS 349

7.1.9. (1) (a) The composition TIT2 is inapplicable to the word 130212. (b) TIT2 is applicable to the word 1401; as a result, we obtain 10103 12.

7.1.10. (1) (a) This iteration is inapplicable to words of the form 13k (k ~ 1). (b) It is inapplicable to words of the form 13k+1 (k ~ 1) either. (c) The iteration is applicable to any word of the form 13k+2 (k ~ 1). As a result, we obtain the word 1.

7.1.11. (1) (a) T(P) = 1041. (b) T(P) = Is01.

7.1.14. (3) One of the possible Turing machines is specified by

qlOqoOR q40qs1L ql 1q20R q4 1q41R q20qo1S qsOq60L q21q30R qs1qs1L q30q40R q60qlOR q31q31R q61q61L

7.1.16. (3) An example of the possible machines is

qlOqo1L q3 1q40R ql1q20R q40q40S q20q20S q4 1qsOR q21q30R qsOql lR q30q30S qs1qs1S

7.1.17. (1) f(x) = x + 1, f(x, y) = x + y + 2.

7.1.18. If we assume, as usual, that machines start to operate in the state ql, and the extreme left unity of the code of the number x is scanned at the initial instant, the machines mentioned in the problem can compute only one of the following three functions: x, x-I, and a function defined nowhere.

7.1.19. Yes, it is true.

7.1.20. (1) For a fixed (finite!) set of states, there exists only a finite number of pairwise non-equivalent Turing machines (with a given external alphabet). (2) There exists an 1 such that for any n ~ 1, the subset of all functions of n variables in M contains no more than 1 elements.

7.2 Recursive Functions

7.2.1. (2) Xl + X2 - SgnX2·

Page 357: Problems and Exercises in Discrete Mathematics

350 CHAPTER 7. ELEMENTS OF ALGORITHM THEORY

7.2.2. (1) First, we can prove the primitive recursion ofthe functions Xl -:- X2 and x2 and then apply the superposition operation. The "direct proof" of the primitive recursion of the function g( x) = X2 is as follows:

{ g(O) 0, g(x + 1) = hl(x, g(x)) = x2 + 2x + 1,

i.e. hl(x, y)=2x+y+1;

{ hl(X, 0) hl(x, y + 1)

{ gl (0) gl (x + 1)

i.e. h2(x, y) = y + 2;

2x + 1 = gl(X), S(hl(X, y)) = (2x + y + 1) + 1;

1, h2(X, gl(X)) = 2x + 3,

2, S(h2(X, y)) = (y + 2) + 1.

7.2.5. f( X, y) = sgn X· g1 (y) + g2( x -:-1) x sgn y + g3( x -:- 1, y -:-1) x sgn x x sgn y.

7.2.7. (2) flXI([xd2]) = 2XI '

(4) flXI (x - 1 -:- X2) = (Xl + X2) x sgn Xl, flXI (Xl -:- X2) = Xl - X2·

7.2.9. No, it is not correct.

7.2.10. (1) No, it cannot.

(2) 1 + sgn x.

7.2.12. All these classes are countable infinite.

7.2.17. No, not always: the function h(x, y) can be identically equal to O.

7.2.18. (1) No, not always.

7.2.19. (3) This relation is valid. Hint. This function resulting from the minimization operation is 2x -:- 1. (4) Yes, it is. Hint. This function resulting from the minimization operation is

Ox; 3f -:- ([X; 1] -:- [~]) ) -:- 1.

7.2.20. (1) Yes, it can.

Page 358: Problems and Exercises in Discrete Mathematics

7.3. COMPUTABILITY 351

(2) This statement is false for any function 11 in Kg.r \ Kpr.r .

(3) The statement is correct for some functions !I and 12 in the set K g.r \ K pr.r .

7.2.21. (1) No, they are not always satisfied.

(2) This inclusion is false for any function f(x) in Kg.r \ Kpr.r .

(3) This relation is valid for any function f(x) in Kg.r \ Kpr.r .

7.2.24. (2) No, it cannot.

7.2.26. Yes, it is true.

7.3 Computability

7.3.1. (a) This follows from the fact that there exists a function in f{pr.r which assumes all the values.

7.3.2. Any primitive recursive function can be associated with an infinite set of terms reflecting the way of obtaining the function from the simplest functions.

7.3.3. If these exists a partially recursive universal function F(xo, Xl, ... , xn ),

it is defined everywhere. Then the function F(XI' Xl, X2, ... , xn) +1 is general recursive and has a number y in the numbering corresponding to the universal func­tion F(n+l). But in this case F(y, y, ... , y) = F(y, y, ... , y) + 1.

7.3.6. Carry out the proof by "diagonalization".

7.3.7. (1)-(4). No, it is not.

(5) Yes, it is.

7.3.8. The solution is similar to that of Problem 7.3.3.

7 .3.11. Consider the function

g(X) = {f1(x) if h(x) = 0, if h(x) = 1.

7.3.12. Consider the sequence ao, al, ... , such that ai = 1 if ipi(i) is defined and ai = ° if ipi( i) is not defined, i = 0, 1, .... The sequence is quasi-periodic.

7.3.15. For example, the inversion of a word.

Page 359: Problems and Exercises in Discrete Mathematics

352 CHAPTER 7. ELEMENTS OF ALGORITHM THEORY

7.3.21. (2) This follows from the fact that no more than CST(P) different configurations of length ST(P) exist for a certain c which depends on the alphabet of states and on the external alphabet of the machine T. If a configuration is repeated, T operates for an infinitely long time.

Page 360: Problems and Exercises in Discrete Mathematics

Chapter 8

Combinatorics

8.1 Permutations and Combinations

8.1.1. (1) The number of ways is (20h = 20 x 19 x 18. The tickets are not equivalent. The first ticket can be distributed in 20 ways, the second in 19 ways, and the third in 18 ways.

(2) 203 . (3) C(20,3).

8.1.2. (1) 9!. (2) C(9, 3) x C(6, 3).

The first rank can be chosen in C(9, 3) ways, and then the second in C(6, 3) ways. Using the multiplication rule, we obtain the result.

8.1.3. (1) Each term of a permutation with repetitions can be chosen indepen­dently in n ways. Using the multiplication rule, we obtain P(n, r) = nT •

(2) From each (n, r)-combination without repetition, we can obtain r! different (n, r )-permutations, and each (n, r )-permutation can be obtained in this way. Hence, r!C(n, r) = P(n, r). Since (see Example 3)P(n, r) = (n)r' we have

C(n, r) = (nUr! = (~).

(3) Each (n, r)-combination A with repetitions composed of elements of the set U = {al,···, an} we associate with a vector a(A) of length n + r - 1 consisting of r ones and n - 1 zeros, such that the number of ones between the (i -1)-th and i-th zeros is equal to the number of elements aj in the combination A, i = 2, ... ,n, while the number of zeros before the first unity (after the (n - 1)- th unity) is equal to the number of elements al (resp. elements an) constituting the combination A. There is a one-to-one correspondence between the combinations and the vectors. On the other hand, the number of vectors with n - 1 ones and r zeros is C (n + r - 1, n - 1), since each such vector can be put in one-to-one correspondence with a combination of n + r - 1 elements taken n -1 at a time. Therefore, taking into account the result of the previous problem, we find that C(n, r) = (n!~~l).

8.1.4. (1) kn. (3) (~).

353

Page 361: Problems and Exercises in Discrete Mathematics

354 CHAPTER 8. COMBINATORICS

8.1.5. (1) 2mn.

8.1.6. (7) (;). The multiplication rule is used.

First we choose the places for the letter a (in (~)ways ), then we choose the places,

for the letter b (in (r~h) ways). We still have r - h - k places the first of which can be occupied by one of the remaining n - 0' - f3 letters, the second by one of n - 0' - f3 - 1 letters, and so on, (n - 0' - (3)r-h-k ways in all.

8.1.8. (1) 4(n - 4). Then a suit can be chosen in four ways, after which the smallest value of a card can be chosen in n - 4 ways.

(2) 4n(n - 1). The number of four cards can be chosen in n ways, after which the remaining cards can be chosen in 4( n - 1) ways.

(3) 24n(n -1). (4) 4(~).

(7) 12(;fn + 4(;)n3.

8.1.9. (1) 147. The number which appears on the two chips can be chosen in seven ways. It may turn out that this number appears on a chip twice. Then the second chip can be chosen in six ways. Otherwise, we must choose two different numbers from the six numbers that app,ear on the chips. The number of ways in which can this can be done is equal to \~). Thus,

(2) 26. The number of occurrences of identical faces is 6, and the number of occurrences of pairwise different faces is (~) = 20.

(3) 300 + 3002 + 3003 • A newlyborn baby can be given one, two or three names. The number of ways in which k names can be given is 300k •

8.1.10. (1) (~=D· We associate each division n = nl + ... + nk which is a binary vector with k - 1 ones and n - k zeros as follows: the number of zeros preceding the first unity is nl -1, the number of zeros between the i-th and (i + l)-th zero is niH - 1, i = 1, ... , k - 2, the number of zeros after the (k - 1)-th unity is nk-1.

This is a one-to-one correspondence. The number of such binary vectors is (~=D.

(2) (n~2). Hint. The solution should be reduced to the problem of decompo­sition of n into three addends, after which the result of Problem 8.l.4 should be applied.

Page 362: Problems and Exercises in Discrete Mathematics

8.1. PERMUTATIONS AND COMBINATIONS 355

(3)

1 (n + 2) 1 6 2 + 2"([n/2] + 1).

The representation of the number 7n in the form of three multipliers corresponds to the representation of n in the form of the sum of three non-negative addends: n = n1 + n2 + n3. Among these addends, two can be identical. In this case, the number of disordered partitions is [n/2] + 1. When all the addends are different, the number of ordered partitions is six times as large as the number of disordered partitions, which is equal to ~ ((~) - 3 ([ i 1 + 1) ). Using the summation rule, we obtain the required result.

8.1.11. (1) (n-k(m;l)+m). Let 0 = (a1, ... , an+k) be a tuple of zeros and ones in which there are at least m zeros between two consecutive ones. Let ~(o) = (/31, ... , /3n-k(m - 1) + 1) be a tuple obtained from 0 by deleting m zeros following the first, second, ... , (k -1 )-th unity. The tuple ~(o) contains k ones and is uniquely determined from 0. On the other hand, the tuple 0 is uniquely determined from the tuple ~(o) and the number m. Thus, the number of initial tuples is equal to the number of tuples of length n - (m - l)k + 1 containing k ones.

(2) (nt9). We associate each number A satisfying the condition of the problem with a binary vector with n ones and 10 zeros. The number of ones preceding the first zero is equal to the difference between n and the number of digits of the number A. The number of ones between the i-th and (i + l)-th zeros, 1 ::; i ::; 8 is equal to the number of digits equal to i in the number A, and the number of ones following the ninth zero is equal to the number of nines in A. Then we apply the result of Example 4 for k = 10.

(3) (nj;k). Any of the shortest walks consists of n southward and k westward segments. The length of a segment is equal to the side of the square. Such a walk can be assigned a binary vector of length n + k, in which the i-th coordinate is equal to zero if the i-th segment is directed southwards, and equal to 1 if it has a westward direction. The number of such vector is (ntk).

8.1.12. (1) (1 + (1)(1 + (2) ... (1 + an). E h d·· (31 (3r 0 < /3 < . . - 1 b· ac lVlsor PI ... Pr , _, _ a" z - , ... , r, can e put III a one-to-one correspondence with a vector (/31, ... , /3r). Then see Problem 8.1.4.

(2) 2/2r. Each divisor p~1 ... pf!.r of the number n, which cannot be divided into the square of an integer, can be put in correspondence with a binary vector (/31, ... , /3r ).

r

(3) IT (p~k-! + 1 )(Pk - 1)-1. k=l Hint. Note that after opening the parentheses in the expression

(1 + PI + ... + p~l) ... (1 + Pr + ... + p~r), each divisor appears exactly once as a summand.

Page 363: Problems and Exercises in Discrete Mathematics

356 CHAPTER 8. COMBINATORICS

8.1.13. (1) The first proof:

Another proof. The number (~) is equal to the number of ways in which a k-element

subset can be chosen from U = {al,"" an}. But each k-element subset we can put in a one-to-one correspondence with its complement in an (n - k)-element set U.

(2) We have

(:)G) - k!(n-k~!!::(k-r)! - (n-r)!~:;:=~~:(k-r)! - (~)(:=~). (3) We have

( n - 1) (n - 1) (n - I)! (n - I)! k + k-1 = k!(n-k-1)!+(k-1)!(n-k)!

(n - I)! (n) = k!(n_k)!(n-k+k)= k .

(4) We have

( n )/ (n) k!(n - k)! (k)r k-r k - (k-r)!(n-k+r)! - (n-k+r);

t (n - r - 1) = t ((n - r) _ (n - r - 1)) = (n). r=O k - r r=O k - r k - r - 1 k

(6) ,(7) Directly.

(8) Induction on n. For n = k, we have

t (r) = 1 = (n + 1). r=k k k + 1

Inductive transition n ~ n + 1 :

By inductive hypothesis, we have

t (r) = (n + 1) . r=k k k + 1

Page 364: Problems and Exercises in Discrete Mathematics

8.1. PERMUTATIONS AND COMBINATIONS 357

Hence, we obtain from this and the previous equality

~ (r) = (n + 1) (n + 1) = (n + 2) . ~ k k+1 + k k+1

8.1.14. (1) Let us consider the ratio (ntl) / (~) = (n + l)/(n - k + 1). This ratio is greater than unity for all 0 < k :::; n. Hence, the statement.

(2) Hint. The ratio (~=;=D / (~=;) < 1 for k < n.

(3) The ratio (k~l) / (~) > 1 for k :::; [n/2] and less than unity for k > [n/2].

(4) This follows from (3).

(5) If the sum contains two binomial coefficients (';;) and (';:), such that ni-nj > 1, then by replacing them with (n.;I) and (nJt) , we obtain a sum smaller than the initial one. For this reason, the superscripts of any two binomial coefficients in the minimal sum differ by not more than 1 and assume not more then two values. If q is the smaller of them, we assume that the superscript of r binomial coefficients (0 :::; r < 8) is q + 1, and that of the remaining 8 - r coefficients is q. Then from the condition 2::£=1 ni = n, we obtain (q + l)r + q( 8 - r) = n, whence

q = [n/8]' r = n - 8[n/ 8], while the minimum value ofthe sum is (8 - r) (k) + r(Qtl).

(6) Hint. Note that (j) ~ (7) if I~ - il > I~ - jl· (7) We have (ph = (~) kL The number (phis divisible and k! is not divisible

by P for k < p. Consequently, (~) is divisible by p.

(8) We have (2n)! = e:)(n!)2. The number (2n)! is divisible by any prime

number Pi, where n < Pi :::; 2n, and the number (n!)2 is not divisible by Pi. Consequently, e:) is divisible by Pi·

8.1.15. (1) Solution. We put Qn-l = [(n:'I)!]' Suppose that the coefficients Qn-l, Qn-2, ... , Qn-i have been determined. Then

. _ [m - Qn-l(n - I)! - Qn-2(n - 2)! - ... - Qn-i(n - i)!] Qn-(I+1)- (n-i-1)! .

The uniqueness of the representation will be proved by contradiction. Let two vectors Ci( m) = (Ql,"" Qn-d and ~(m) = ({31,"" {3n-d correspond to a certain m. Let j be the largest of the subscripts in which the vectors differ from each other. Without any loss of generality, we can assume that Qj < {3j. We have

n-l n-l j-l j-l 0= L {3ii! - L Qii! ~ ({3j - Qj)j! - L Qii! ~ j! - L i x i! > O.

i=1 i=1 i=1 i=1

We arrive at the contradiction.

(2) Ci(4) = (0, 2); Ci(15) = (1, 1, 2); Ci(37) = (1, 0, 2, 1).

Page 365: Problems and Exercises in Discrete Mathematics

358 CHAPTER 8. COMBINATORICS

(3) fl(O, 2, 0, 4) = 100; fl(O, 2, 1) = 10; fl(1, 2, 3, 2) = 72.

(4) v(2, 3, 1, 4) = 8; v(3, 5, 2, 1, 4) = 68; v(l, 4, 3, 5, 2) = 15.

(5) Let the number m be specified. We present it in the form m = al x 1! + a2 x 2! + ... + a n -l x (n - I)!, where ai :::; i, 1 :::; i < n. The construction of the required permutation 7r is equivalent to that of the vector (7r(I), 7r(2), ... ,7r(n)). The coordinates 7r(j) will be given by induction. We put 7r(I) = a n -l + 1. If the coordinates 7r(l), ... , 7r(j - 1) are specified, we put 7r(j) = an-j + 1 + s(j), where s(j) is the number of 7r(k), 1 :::; k < j, for which 7r(k) < j.

(6) 7r7 = (2, 1, 4, 3); 7r18 = (2, 3, 4, 1); 7r28 = (2, 1, 4, 5, 3).

8.1.16. (1) The coordinates of the vector ~(m) = ((31, ... ,(3k) are defined as

follows: (31 is the largest integer such that m 2: (~). If (31, ... ,(3i have already

been specified, then (3i+l is the maximum integer such that m - (,13;) - (tl) - ... -(k!;i+l) 2: (~·~I). The uniqueness is proved as in Problem (8.1.15.(1).

(2) (a) ~(19) = (6, 4, 1, 0) since 19 = m + (~) + (;) + (~);

(b) ~(25) = (6, 3, 2);

(c) ~(32) = (4, 3, 2, 1).

(3) (a) m = 23 since m = m + m + (~) = 23;

(b) m = 13;

(c)m=10.

(4) First we put in correspondence to the vector a = (aI, ... ,an) in Bi: a vector ~ = ((31, .... ,(3k) in which (3j + 1 is the number of coordinates of the (k - j + 1)-th unity on the left in the tuple a, 1 :::; j :::; k. Then we put v( a) = fl(~) + 1. For

example, if a = (1, 0, 0, 1, 0),then~=(3, 0), v(a)=fl(~)+I= m+(~)+1=4.

8.1.17. For n = 1, equality (1) can be verified directly. Let the equality be proved for a certain n 2: 1. We have

E (n: l)tk = E ((~) + (k: 1)) tk

= t (n)tk + I:: ( : )tk = t (n)l + t (n)tk+l k=O k k=1 k 1 k=O k k=O k

= (1 + t t + t (1 + t t = (1 + t t+ 1.

8.1.18. (1) Put i = 1 in (1).

(2) Put t = -1 in (1).

(3) Differentiate (1) with respect to t and put t = 1.

Page 366: Problems and Exercises in Discrete Mathematics

8.1. PERMUTATIONS AND COMBINATIONS

( 4) Differentiate (1) twice and put t = 1.

(5) Using (1) and (3), we obtain

(6) Integrate identity (1) with respect to t between 0 and 1.

(7) Integrate identity (1) with respect to t between - 1 and O.

(8) Carry out induction on n by using Problem 8.1.13. (3) and 8.1.18 (7).

359

(9) Compare the coefficients of tk on the left- and right-hand sides of the identity

(1 + t)n(1 + t)m = (1 + t)n+m.

(10) Put in (9) k = n = m.

(11) Dividing bye:), reduce the problem to (10).

(12) We have

(13) We have

(14) The problem is reduced to (9) by substituting n - k for k.

(15) Note that

(2) 4 L (cos ~ + i sin ~)n + (J2t (cos ~ _ i sin ~)n = 2n + 2n/ 2 2 cos 7rn. k 4 4 4 4 4

(3) "" _ h,r V ( 2~'V)n "" _ hir V""",, n 1'2~i(rk+') m-1. m-1 () Lem l+e m =LemLL em 1'=0 1'=0 S k r k + s

= LL n L e2~i(r~'-r)1' = m Ln. r-1 ( ) m-1 ()

k s=o r k + s 1'=0 k m k + r

Page 367: Problems and Exercises in Discrete Mathematics

360 CHAPTER 8. COMBINATORICS

In the latter case, we have used the identity

I: e 2~n1' = {m if n is multiple of m, 1'=0 0 otherwise.

8.1.20. (1) The solution is similar to that of Problem 8.1.19. (3). We have

'" _ ~ ( 2"'") m '" 2",r" '" n k _ 2","k m-l . m-l n ( ) ~ e m 1 + ae m = ~ e m ~ a e m = 1'=0 v=O k=O k

t (n)ak E e_21r'(~-r)" = m t ( n )ams+T •

k=O k 1'=0 s=o ms + r In the latter case, we have used the fact that the sum 2:~:01 exp{27rilll /m} is equal to 0 for 1 < l < m and is equal to m for l = O.

(2) !((1 + y3)n + (1 - y3)n). Use (1) for m = 2, r = 0, a = y3.

(3) ((1 + Rt + i(l + iR)n + (1- R)n - i(l- iR)n)/4R. Use (1) for m = 4, r = 1, a = A.

(4) (-3) r;' (~) ((1 + Rt-T - (1- R)n-r)/2. Using Problem 8.1.13 (2), we obtain

2:(-1)k3( n ) (2k+l) = (n) 2:(-3)k( n-T ) k 2k+l T r k 2k+1-r

Further, we use (1) for m=2, a = Rand r = 1 - r.

8.1.21. (1) 4. The term of the expansion ekO)2k/23(20-k)/3 is rational if and only if k is even and 20 - k is a multiple of three, i.e. for k = 2,8, 14, 20.

(2) 13. (3) 9. (4) 6.

8.1.22. (1) -30288. The general form of the k-th term of the expansion has the form (~) Ak, where A = t(2 - 3t), and the expansion Ak contains from the k-th to

(2k)-th powers oft. The power t 9 appears in AS, A6 , A7 , and A8 with the coefficients

respectively. The coefficient of t 9 is the sum of these quantities and is equal to -30288.

(2) -91. (3) 13. (4) O.

8.1.23. (1) We put t = m - n. Then the identity is transformed as follows:

n+t+1 t + 1

or t (n)k = _1_ k=O (n + t + 1 h t + 1

Page 368: Problems and Exercises in Discrete Mathematics

8.1. PERMUTATIONS AND COMBINATIONS 361

The latter relation can be proved by induction. Assuming that (0)0 = 1, we can easily verify the validity of (*) for n = O. We assume that (*) is valid for a certain n and prove that

We have

Similarly,

8.1.24.

n+l (n + Ih L ( 2) = I/(t + 1). k=O n + t + k

'f (n + Ih 1 + 'f (n + I)(nh-l k=O (n + 2 + th n + 2 + t k=l (n + 2 + t)(n + 1 + th-l

1 n + 1 ~ (nh (b . (*)) n + 2 + t + n + 2 + t ~ (n + t h = y usmg

1 n+I 1 1 = n+2+t + n+2+t t+I = t+I'

(2) t (m + k - 1) = t (m + k - 1) k=O m - 1 k=O m - 1

(ah (ah-l (ah-l (1) ~ + (k _ I)! + (k - I)!

(a))k + k(ah-l k!

(a + 1)k k!

(2) The series A( t) = L:~o (~) tk is a series of the function f( t) = (1 + t)a, since

f(k)(O)/k! = (~). The series A(t) converges for It I < 1 and for all a according to the d' Alembert criterion:

( a )tk+l/(a)tk = ~ t k+l k k+l' la - kit

lim -k - = t < 1. k->oo + 1

Let the term Tk(t) be the remainder of the series (in Cauchy's form). We shall demonstrate that Tk(t) -+ 0 as k -+ 00. Thus, proving the equality. We have

Tk(t) = f(k+l)(0t)(1 - 0)ktk+l/k! = (a)k+l(1 + 0W-k- 1(I - 0/tk+1/k!

(a-I) (I-0)k = k tka(l + 0tt-1 1 + 0t

Here (a~l)tk -+ 0 as k -+ 00, the expression a(l + 0t)a-l is bounded, and

o < (t;:tr < 1 for 0 < e < 1, It I < 1. Hence it follows that )~~ Tk(t) = O.

Page 369: Problems and Exercises in Discrete Mathematics

362 CHAPTER 8. COMBINATORICS

(3) (-ka) =(-a)(-a-l) ... (-a-k+l)/k!=(-I)k(a+~-l).

(4) kt (a~k) = k~O ((a~!i1) - (~~;)) = (~!D - (~~~). (5) Use the identity (1 + W(1 + t)b = (1 + W+b.

(6) It follows from (5) if we put b = -1.

(7) It follows from (3) and (5).

(8) By using (5) we obtain

o<f:<n (~) (n (n - ~ - r) = o];n (~) O<~-k G) (n - ~ - r) -'- -- --

L (a) (b ~ c) = (a + b + c) . Osksn k n k n

(9) By using (2), and the identity en = (_4)k (-V2), we obtain

(10) It follows from (2) that

J5 _ ( 1)1/2 _ 00 (1/2) (l)k. J3 _ ( 1)1/2 _ 00 (1/2) ( l)k - - 1 + - - L -, - - 1 - - - L --2 4 k=O k 4 2 4 k=O k 4

Hence 2 f ( 1/2 ) (~)2k+1 = J5 - J3.

k=O 2k + 1 4 2

(11) See 8.1.20 (1).

8.1.25. (1) (mn)!/(m!)n. (2) Cl' k~, ... ,kJ (3) Let us calculate (in two ways) the number An (k1 , ... , ks ) of orderings of n

objects among which there are k1 objects of the first kind, k2 objects of the second kind, etc., and ks objects of the s-th kind. First method. We first choose k1 places among n for arranging the objects of the first kind. This can be done in (~) ways. Then we choose k2 places for arranging the objects of the second kind. This can be done in (n~2kl) ways, and so on. Using the multiplication rule, we find that

(k k ) = (n) (n - k1) ... (n - k1 - ... - kS - 1) An 1,"" s k1 k2 k2 '

Second method. Let us calculate the number n of ordering of pairwise different objects. We shall assume that the objects are divided into s groups so that the i-th group contains ki objects (i = 0). The choice of k1 places for objects of the first

Page 370: Problems and Exercises in Discrete Mathematics

8.2. INCLUSION AND EXCLUSION FORMULA 363

kind, k2 places for objects of the second kind, etc., can be made in An(k1, ... , ks) ways. In the group i, the objects can be arranged in ki ways (i = G). Hence, An(k1, ... , ks)k1!'" ks! = n!

(4) For s = 2, the identity follows from (1) by substituting (t2/t1 ) for t. Suppose that this identity has been proved for a certain s ~ 2. We shall prove that

k, ... k,t, k, + ... +k,t, =n

We put T = (tl + ... + ts). Then

n! tk'tk2 tk,t! -'-k-c'-k-:C'--k---" 1 2 ... s+ 1 . 1.1 2"" s+ 1·

(tSH + Tt = t (~)t:+lTn-k = t (~) (t1 + ... + tst-kt:+l k=O k=O

n

=L L k=O k, ... k,

k, + ... +k,=n-k

8.2 Inclusion and Exclusion Formula

8.2.1 (1) Proof. For n = 1, No = N -Nl = So-51 , and formula (1) is obviously valid. Let the formula be valid for n - 1 properties, and let Ni" ... ,ik be the number of objects which do not possess any of the properties i l , •.. , ik • We have

n-l No = No 0 = N - "'" Ni + "'" Ni J' tl !"o, 'tn-l L...J L.J '

i=1 l~i<j~n-l

Ni, j, k + ... + (-It-l Nl, ... , n-l' (A.I) l~i<j<k~n-l

This formula is also valid for a set of objects having the property n:

Ni , ... , n-I, n = Nn - L Ni, n + ... + (-1t-1 NI , ... , n-1, n (A.2) l~i~n-l

where Ni , ... , Til, n is the number of objects having the property n and none of the properties 1, ... , n - 1. Obviously,

N- - - = N- - - N- - . 1, ... , n-l, n 1, ... , n-l I, ... , n-l, n

Subtracting (A.2) from (A.I), we obtain formula (2).

Page 371: Problems and Exercises in Discrete Mathematics

364 CHAPTER 8. COMBINATORICS

(2) By definition, formula (3) can be written in the form

Let us prove that any object possessing m properties will be taken into account by this formula only once, and all the other objects will not be taken into account at all. Indeed, the elements having s < m properties are obviously not taken into account. The elements having s = m + t given properties will be taken into account (:~~) times in the second sum. But

nf(_l)k(m+k) (m+t) = (m+t)t(_l)k(t) ={1 fort=O, k=O m m + k m k=O k 0 for t > O.

Thus, the elements having exactly m properties are taken into account in (3) just once, while the remaining objects are not taken into account at all.

(3) It should be noted that Nm+l = Nm - Nm; then (4) can be proved by induction on m. By definition, No = N = So. Then N1 = So - (So - S1 + S2 - ... ) = L:k=0(-1)k-1Sk • Thus, (4) holds for m = 1. Let identity (4) be valid for a certain m 21. Then

v v A n~ k ((m - 1 + k) (m + k)) Nm+1 = Nm - Nm = t'o (-1) m _ 1 - m Sm+k

n-m (1 + k) n-(m+1) ( k) k-1 m - k m-= L (-1) Sm+k = L (-1) Sm+l+k.

k=1 m k=O m

(4) Let us derive, for example, formula (5) from (3). By putting m n in (3), we obtain Nn = Sn in accordance with (5). Let formula (5) be valid for all k 2 n - 1/ + 1, 1/ 2 1. Substituting n - 1/ for m in (3) and using the inductive hypothesis, we substitute the right-hand side of equality (5), in which k is replaced by n - 1/ + k, for Sn-v+k for any k 2 1. This gives

A V k (n - 1/ + k) (m) A Sn-v = Nn- v - L(-l) X L k Nm k=1 n - 1/ m=n-v+k n - 1/ +

A ( m ) A k (m - n + 1/) n (m) A =Nn- v - L n-1/ Nm XL(-l) k = L _ Nm. m=n-v+1 k=1 m=n-v n v

Thus, formula (5) is proved. Formula (6) is proved similarly. Let us prove (7). It is sufficient to verify that

Page 372: Problems and Exercises in Discrete Mathematics

8.2. INCLUSION AND EXCLUSION FORMULA 365

for all r. Let us use formula (5). We have

(5) Let us prove that Sm > Nm. We put R(n, m) = Sm - Nm. In view of (3), we have

Let us prove that Nm 2: Sm - (m + l)Sm+!. We put R'(n, m) = N - Sm + (m + 1 ) Sm+!' In view of (3) and (5), we have

n-m (m + k) n-m (m + k) n ( r ) R'(n, m) = {;(_l)k m Sm+k = {;(_l)k m r=~m k+m k

8.2.2. The total number of ways in which the hats can be returned is 4! = 24. The probability that exactly m persons obtain their own hats is Nm /4!, where Nm

is defined by formula (3) for n = 4. We have

No = So - Sl + S2 - S3 + S4 = 4! - 4 x 3! + 6 x 2! - 4 x I! + 1 = 9,

po = 3/8; N1 = Sl - 252 + 353 - 454 = 4 x 3! - 2 x 6 x 2! + 3 x 4 - 4 x 1 = 8,

,(4) , , PI = 1/3, N2 = 2 = 6P2 = 1/4, N3 = OP3 = 0, N4 = 1p4 = 1/24.

8.2.3. (1) The number of distributions of the objects for which the given k boxes

remain empty is (n - k)\ Sk = (~)(n - kY. It remains for us to apply formula (2).

(n) k ' (2)5m +k = m (n-m-k), E(r, n, m)=Nm

Page 373: Problems and Exercises in Discrete Mathematics

366 CHAPTER 8. COMBINATORIC5

= E( _l)k(m ~ k) (m: k)(n - m - k)' = (:) E(-l)k(n ~ m) (n - m - ky.

(3) Use formula (4) in Problem 8.2.1. (3).

8.2.4. Hint.: Use Euler's circles. (1) 20%. (2) 60%. (3) 70%.

8.2.5. (1) 2. (2) 6. (3) 3.

8.2.6.(1) Each positive integer m divisible by n and not exceeding x satisfies the inequalities 1 ~ nm ~ x, i.e. 0 < m ~ x/no Since m is an integer, 1 ~ m ~ [x/n]. Hence, we obtain the statement.

(2) 457. Using formula (1), we obtain 51 = 675, 52 = 141, 53 = 9, No = 457. (3) 734. (4) We have N = 50 = 30m, 51 = 10m, 52 = 3m, 53 = m, No = So - SI +

S2 - S3 = 22m. (5) The number p, such that yin < P ~ n, is prime if and only if it is not divisible

by any prime number smaller than yin. The number Nil, ... , ik of numbers indivisible by any prime number from Pil"'" Pik is [n/Pil X ... x PiJ,

N . 11,··" tk

l<Pil ,"'j Pik ~Vn

for k 2 1, So = n. Applying formula (2), we find that the required number is

The unity is subtracted since 1 is not a prime number. (6) 25.

8.2.7. 1/3n . Irrespective of the distribution of other elements, each element can belong to one of the sets l XY, XY or XY.

(2) n2n. One element in U belongs to the set XYuXY. The remaining elements belong to the set XY or XY.

(3) 3n . The equality X U YZ = X U Y is equivalent to the equality XY U XYZ = U. Therefore, each element in U is contained in exactly one of the sets XYZ, XYZ, XYZ.

(4) 3n - (n 2 + 7n + 16)2n - 3 + (I/2)n(n2 + 3) + 1. Solution. From among the total number 3n of pairs (X, Y) satisfying the

condition of Problem 8.2.7. (1), we must exclude the pairs belonging to the set C = Ao U Al U Bo U Bl U B2 , where Ao = {(X, Y) : IXI = O}, Al = {(X, Y) : IXI = I}, Bo = {(X, Y) : WI = O}, Bl = {(X, Y) : WI = I}, B2 = {(X, y) : WI = 2}. Obviously,

Ao n Al = 0, Bi n Bj = 0 (0 ~ i ~ j ~ 2).

IThe expression "the element Jl belongs to the set XY" is understood here and below in the sense v E X U (U \ Y), and v E XY is equivalent to v E (U \ X) U (U \ Y).

Page 374: Problems and Exercises in Discrete Mathematics

8.2. INCLUSION AND EXCLUSION FORMULA 367

Therefore,

ICI = IAol + IAII + IBol + IBII + IB21-IAo U Bol-IAo U BII

-lAo U B21-IAI U Bol-IAI U BII-IAI U B21. It can easily be seen that IAol = 2n (n elements of the set U are distributed

among the squares XY and XY. The squares XY and XY are empty since X = 0.) Similarly,

IAII = n2n-I, IBol = 2n, IBII = n2n-I, IB21 = (~)2n-2. Further, we have

lAo U Bol = 1, lAo U BII = IAI U Bol = n,

IAI U BII = n{n - 1), lAo U B21 = (~), IAI U B21 = n(n;l). Hence,

ICI = (n + 2)2n + n(n - 1)2n- 3 - n(n~+3) - 1,

and the number of required pairs is 3n -ICI.

(5) n(2n - 2n). From among the pairs (X, Y) satisfying the conditions of problem (2), we must exclude those for which the power of a set X or Y having a lower power is smaller than 2. Considering that the smaller subset is composed of n -1 elements, their number is n.

(6) (n + 2){2n - 1 -1). It follows from Problem 8.2.7.(3) that the elements of the set U can be contained only in the squares XYZ, XYZ and XYZ. Since IZI :S 1, two cases are possible here: (a) Y = 0. Then the square XYZ is empty, and there are 2n - 2 ways in which n elements in U can be distributed among the squares XYZ and XYZ so that IXI :S 1 and WI 2:: 1, i.e. so that the squares are not empty. (b) IZI = 1. Then the square XYZ contains one element which can be chosen in n ways. The remaining n - 1 elements must be distributed among the squares XY Z and XYZ so that IXI 2:: 1 and WI 2:: 1. The condition IXI 2:: 1 has already been satisfied since the square XY Z is not empty. Therefore, we must fulfill the only condition that the square XYZ is not empty. The number of such ways of distribution of n - 1 elements is 2n- 1 - 1. Therefore, in case (b) we have n(2n- 1 - 1) ways, and the total number of ways is (n + 2)(2n-1 - 1).

8.2.8. We calculate the number Nn , k of seating arrangements for which k given pairs of warring knights are not separated. We combine each of the given pairs into a single "object". We obtain 2n - k objects which can be arranged in (2n - k - I)! ways. In each of the given k pairs, the adversaries can change positions. Thus, we obtain Nn, k = 2k(2n - k - I)!, and Sk = (~)Nn, k. Applying formula (2), we find that the required number is

8.2.9. We calculate the number Nn , k of seating arrangements of n married couples if k given couples are not separated. We combine each of such k couples into a singles into a single "object". Then we have 2n - k places for arranging k

Page 375: Problems and Exercises in Discrete Mathematics

368 CHAPTER 8. COMBINATORICS

"objects", the number of arrangements being 2(2n- k -1 h-l (the seats are assumed to be numbered). After k isolated couples are arranged, we presume the evenness of the seats occupied by ladies (these seats must be all either even of odd, otherwise two ladies will be seated side by side). The seating arrangement of ladies (gentlemen) remaining after the arrangement of married couples can be realized in (n - k)! ways. Using the multiplication rule, we obtain Nn • k = 2(2n- k-l h-l ((n - k )1)2. Further,

Sk = (~)Nn. k. It remains for us to apply formula (2).

8.3 Recurrences and Generating Functions

8.3.1. (1) Induction. The numbers aD, al, ... , ak-l are specified by hypothesis. If all the terms ai have already been defined for i ~ n, by using (1), we then obtain

(2) We must prove that cAn+k + PlcAn+k- 1 + ... + PkCAn = 0 or, which is the same, cAn(Ak + PIAk- 1 + '" + Pk) = O. Since A is a root of polynomial (2), the expression in the parentheses vanishes.

(3) The fact that an = CIA~ + ... + CkAk' satisfies relation (1) follows from (2) and from the fact that if two sequences an and bn satisfy relation (1), the sequence dn = (tan + (3bn satisfies this relation for all Q and (3.

Let us now prove that any sequence an satisfying (1) can be represented in the form an = CIA~ + ... + CkAk' , where Ci are the appropriate constants. In view of Problem 8.3.1 (1), any sequence an satisfying (1) is completely defined by its first terms aD, al, ... , ak-l. Therefore, it remains for us to demonstrate that for any aD, cd, ak-l there exist Cll ... , Ck such that

{" + C2 + + Ck aD,

CIAI + C2 A2 + + Ck).k all (A.l) ................ Ak- 1 + ).k-l + + Ak- l

CI I C2 2 Ck k-l ak-l·

The determinant of (A. 1) is a Vandermonde determinant. nl<i<j<k (>.; - Aj) and does not vanish if >.; -=1= Aj for i -=1= j. the- s~t-of equations (A.l) has a unique solution.

It is equal to Consequently,

( 4) In order to prove that any sequence of the form specified in the problem satisfies (1), it is sufficient to demostrate that the sequence an = nmAn , where A is a root of multiplicity r > m of polynomial (2), satisfies (1). Substituting as = sm AS, s = n, . .. , n + k, into the left-hand side of (1) and putting Po = 1, we obtain

Page 376: Problems and Exercises in Discrete Mathematics

8.3. RECURRENCES AND GENERATING FUNCTIONS 369

h P ( ) - "k (k ')i k-j were i x - L-j=o Pj - J x .

It should be noted that Po(x) = P(x), where P is polynomial (2). Since A is an r-tuple root of the polynomial Po, Po(x) = (x - AYQo(X), where Qo is a polynomial. It can be easily verified that Pi+! (x) = x d: Pi (x). Therefore, Pi = (x - Ay-iQi(X), where Qi is a polynomial. Hence, it follows that Pi(A) = ° for all i < T. Consequently, L(A) = 0. Thus, (1) is fulfilled for the sequence nm x An for m < T and, thereby, for the sequences of the form specified in the condition of the problem.

Let us now prove that any sequence an satisfying (1) (provided that Ai is a root of multiplicity Ti, i = 1, ... , s, of polynomial (2)) has the form mentioned in the formulation of the problem. Here, without loss of generality, we assume that Pk i= 0, i.e. zero is not a root of the characteristic polynomial. (If Pk = 0, Equation (1) can be simplified.) In order to prove this, it is sufficient to show (see the solution of Problem 8.3.1 (3)) that for any ao, aI, ... , ak-I, the system

CI, 1 + + Cs , 1

(CI, 1 + CI, 2 + ... + CI, T1-I)AI + ...

(CI, 1 + CI, 2(k - 1) + ... + CI, Tl-I(k - 1Yl-I )A~-I + ... ... + (Cs , 1 + Cs , 2(k -1) + ... + cs , Ts-I x (k - 1ys-I)A~-I = ak-I

has a solution. For this purpose, it is sufficient to prove that its determinant --+ --+

differs from zero or, which is the same, that the vectors A 0, ... , A k-I, where --+ (\i '\i 'T-l\i \i ',i 'r-l\i)' k Ai = AI' ZAI'"'' Zl AU"" As, ZA3'"'' Z s As, Z = 0,,,., - 1, are linearly independent. We assume that the converse is true. Then there exist

--+ constants dodI , ... , dk- b which are not all equal to zero and such that A =

--+ --+ --+ ( ) k-I i A do A 0 + ... + dk- I A k-I = 0. Let Q x = Li=O dix and let u be an operator such that f::.f(x) = xfx. We put f::.kf = f::.(f::.k-If). Then

A = (Q(AI), f::.Q(AI),"" f::.Tt-IQ(AI),"" Q(A s ),"" f::.Ts-IQ(A s ».

It should be noted that Q(AI) = f::.Q(AI) = ... = f::.T-IQ(A) for A = ° if and only --+ --+

if A is an T-multiple root of the polynomial Q(x). Thus, A = ° means that Al is a root of multiplicity TI, A2 is a root of multiplicity T2, and, finally, As is a root of multiplicity Ts of the polynomial Q(x). But TI + T2 + ... + Ts = k and Q(x) is a polynomial of a power lower than k and, hence, it cannot have k roots. We arrive at a contradiction. Therefore, the set of equations (A.l) has a unique solution.

8.3.2. (1) CI +C23n. The characteristic polynomial x2 -4x+3 has the roots Al = 1 and A2 = 3. Using Problem 8.3.1 (3), we obtain the general solution CIA~ + C2A~.

(2) CI (-3t/2 + C2( -1 )n( _3)n/2.

Page 377: Problems and Exercises in Discrete Mathematics

370

(3) cI((+vts)/2)n + c2((1 - vts)/2)n.

(4) (_l)n (CI + c2n).

(5) (cI+c2n)(-4)n+C3(-2)n.

(6) (-l)n(CI + C2n + C3n2).

CHAPTER 8. COMBINATORICS

8.3.3. (1) 7 + 3n . The general solution has the form CI + C23n (see Problem 8.3.2 (1)). From the initial conditions, we obtain CI + 3C2 = 10, CI + 9C2 = 16. Hence, CI = 7, C2 = 1, an = 7 + 3n.

(2) 3n +in+(-it.

(3) CI + C2n + C3( -2t, where CI = (14a - b - 4c)/9, C2 = (b + C - 2a)/3, C3 = (2b - C - a)/18.

(4) cos an. The roots of the characteristic polynomial are AI, 2 = e±ia = cos a ± i sin a. The general solution is an = CI A~ +C2A2' From the equalities al = cos a, a2 = cos 2a, we obtain CI = C2 = 1/2. Hence, an = (A~ + A2) /2 = cos an.

(5) 1 - ( -1 t . (6) 3n (1 + n).

8.3.4. (1) Substituting an + b for an in (3), we obtain a(n + 2) + b + p(a(n + 1) + b) + q( an + b) = an + f3. Comparing the coefficients of n on the left-hand sides, as well as the free terms, we obtain

a = a/(l + p + q), b = ((1 + p + q)f3 - a(2 + p))/(l + p + q)2.

(2) It follows from the fact that x = 1 is a root of the polynomial x2 + px + q that q = -1 - p. Substituting n( an + b) for an in the equality an+2 + pan+! - (p + 1 )an = an + f3, we find that

a = a/[2(p + 2)]; b = (2f3(p + 2) - a(p + 4))/(2(p + 2)2). (3) Since x = 1 is a multiple root of the polynomial x2 + px + q, p = -2 and

q = 1. Substituting n2(an + b) for an in the equality an+2 - 2an+! + an = an + f3 and comparing the coefficients of n3, n2, n and nO, we find that the coefficients of n3 and n2 are equal to 0, and

a = a/6, b = (f3 - a)/2. (4) For (1), the general solution has the form an = CIA~ + C2A2 + an/(l + p + q) + (f3(1 + q + p) - a(p + 2))/(1 + p + q)2,

where AI, 2 = (-p ± Vp2 - 4q)/2 if p2 - 4q i= O. Thus,

an = (CI + c2n)( -~ + an/(l + p + q)) + (f3(1 + q + p) - a(p + 2))/(1 + p + q)2;

for (2),

an = CI( -p - l)n + C2 + an/[2(p + 2)] + (2f3(p + 2) - a(p + 4))/2(p + 2)2;

for (3),

an = n2((an/6) + (f3 - 2)/2) + CIn + C2·

8.3.5. (1) an = 1 + (~). The general solution of the recurrence relation an+! -an = 0 is an arbitrary constant c. A particular solution of equation (1) is sought in the form A~ = n(an + b). Substituting this expression into (1), we obtain a~ =

n(n - 1)/2. The general solution of equation (1) has the form of an = a~ + c. From the condition al = 1, we find that C = 1 and, hence, an = 1 + n(n -1)/2.

Page 378: Problems and Exercises in Discrete Mathematics

8.3. RECURRENCES AND GENERATING FUNCTIONS 371

(2) an = 2( -4)n - 3 X 2n + 5n. The general solution of the homogeneous equation an+2 + 2an+l - 8an = 0 has the form Cl ( -4 t + C22n. A particular solution of equation (2) is sought in the form a~ = d x 5n . Substituting this relation, we obtain d = 1. The general solution of the inhomogeneous equation (2) has the form Cl( _4)n + C22n + 5n. From the initial conditions, we find that Cl = 2, C2 = -3.

(3) 2n - l + 2n - l cos(7r(n - 1)/4);

(4) .l. + ~(_2)n + n2 _ 5n. 27 27 6 18'

(5) 2n - 3 (n2 + 8 - n);

(6) (-3)n+2n+n2n.

8.3.6. (1) A non-degenerate case is when either ql =1= 0 or P2 =1= O. If ql = P2 = 0, we obviously have an = ClP~ bn = C2q"2. Let ql =1= o. Then bn = 1/ ql (an+l -PI an), bn+l = 1/ ql (an+2 - PI an+l)' Substituting bn+l and bn into the second relation, we obtain an+2 + (-PI - q2)an+l + (Plq2 - P2ql)an = O. The problem is reduced to Problem 8.3.1.

(2) an = (5 + 2n)2n, bn = -(1 + 2n)2n. (3) an = clin + C2( _i)n + 4 bn = clin+l + C2(-W+l - 1.

8.3.7. (1) Induction on n. For n = 2, the relation F2+m = FlFm + F2Fm+l = Fm + Fm+l hold for all m ~ 1. The inductive step n -t n + 1: Fn+l+m = Fn+m + Fn+m- l = Fn-lFm + FnFm+l + Fn- 2Fm + Fn_lIi'm+l = FnFm + Fn+lFm+l .

(2) Carry out induction on k. (3) If Fn+l and Fn had a common divisor d > 1, then Fn- 1 and Fn would have

the same common divisor, since Fn- l = Fn+l - Fn. It follows by induction that Fl and F2 should have the divisor d.

(4) Method of representation. If N = 2, then N = F2 + Fl. If N > 2, we choose the largest nl such that Fnl ~ N, then the largest n2 such that Fn2 ~ N - Fnl , and so on. Then N = FnJ + Fn2 + . ... Since Fn+l > Fn for N > 1, the representation cannot contain two numbers with the same index n > 2. The representation cannot contain two adjacent numbers Fn and Fn+l, since Fn + Fn+l = Fn+2 and, hence, FN+2 must be chosen at the step on which Fn+l is chosen.

(5) The general solution of the recurrence relation Fn+2 = Fn+l + Fn is given in Problem 8.3.2. (3). Using the initial conditions, we obtain thr required result.

(6) and (7). The proof is carried out by induction on n. (8) Applying twice the identity of Problem 8.3.7. (1), we obtain

= F:LlFn + Fn-lFnFn-l + F; + F~+l(Fn+l - Fn- l )

= F;+l + F; + F~_lFn + Fn+lFn-l(Fn - Fn+d

= F;+l + F; + F~_lFn + Fn+lFn-l(Fn - Fn+l)

= F;+1 + F; + FLlFn - Fn+lFLl = F;+l + F; - FLI'

Page 379: Problems and Exercises in Discrete Mathematics

372 CHAPTER 8. COMBINATORICS

8.3.8. (1) (1 - ttl. The generating functions for the sequence an = 1, n = 0, 1, ... , is by definition the series A(t) = L~=o tn which is an expansion of the function f(t) = (1 - ttl into a series for It I < 1.

(2) 1 + t + ... + tN = (t N + I - 1) / (t - 1).

(3) (1 - attl (4) eat. (5) (1 + ttl. (6) t(1 - tt2. We have A(t) = L~=ontn = tL~=o(n + 1)tn. The series

L~=o(n + 1W is obtained by the termwise differentiation of the series L~=o tn uniformly converging to <p(t) = (1 - t)-I for It I < 1. Thus, the series L~=o ntn converges to the function f(t) = t<p'(t) = t(1 - tt2.

(7) 2t2(1 - t)-3. (8) (1 + t)m. (9) (1 + t)a. (2) t(t + 1) x (1 - tt3.

(11) tsina(1- 2tcos a + t2t l . We put <p(a) = eia = cos a + i sina and use the fact that <pn( a) = eian = cos an + i sin an, <pn( -a) = e-ian = cos an - i sin an. Let us consider the generating functions

00 00

AI(t) = L <pn(aW = (1 - <p(a)ttl, A2(t) = L <pn( -aW = (1 - <p( -a)ttl. n=O n=O

Since sinan = (2itl(<p(an) - <p(-an)), we have

00

A(t) = L(sinanW = (2itl(AI(t)-A2(t)) = (2itl((1-<p(a)ttl+(1-<p(-a)t)tl n=O

= (2itIt( <p( a) - <p( -a) )(1 - (<p( a) + <p( -a))t + t2tl = t sin a(1 - 2t cos a + t2tl.

(12) (1 - t cos a)(1 - 2t cos a + etl. 8.3.9. (1) et. By definition, E(t) = L;:=oantn/n! This series converges to et. (2) eat. (3) tet. (4) t2et. (5) (1 + t)m. By definition, E(t) = L:'o(m)ntn In! = L:=o (:)tn = (1 + t)n. (6) et (t2 + t). 8.3.10. Hint. (1)-(6) Compare the coefficients of tk.

8.3.11. (1) (:)qm-npn. (2) 1. (3) (_1)ne~2).

(5) (_1)n-m Lk( _1)k{r-l) (;) (m~n~kr)' It should be noted that (Ht2+ .. . +t') = tm (1- nm (1- t) -m. The coefficient oftkr in the expansion of (1 - t')m is ( -1/ (~) .

The coefficient of tn-m- kr in the expansion of (1 - t) -m is (n-~~kr)'

(6) (1/2)n/2(:~) for even nand ° for odd n.

(7) (-2tn Lk e:) (:~). The coefficient of tk in the expansion of (1 + 2t)-1/2 is

(-t/2)2k . The coefficient oftn- k in the expansion of (1-t/2tm is (:~) (-1/2){n-k). Therefore, the coefficient of tn in the expansion of f (t) is

L (-t/2)2k( _1/2)n-k (:~) = (-1/2)n L (-t)( _4)k (:~) = (-1/2t L en (:~). k k k

(8) (:~)2n-2 - (:~)2n-3. (9) (_l)n-In- l .

Page 380: Problems and Exercises in Discrete Mathematics

8.3. RECURRENCES AND GENERATING FUNCTIONS 373

(10) (-It- 1 /(2n -1). We shall use the fact that J~ 1::2 = arctant. We have (1 + x2t 1 = 2::;:"=0(-1)nx2n. Integrating the left- and right-hand sides between 0 and t, find that arctan t = 2::;:"=0 (-1 )nt2n+1/ (2n + 1).

(11) 0 for even nand 1 ·2· ., .. (n - 2)/ (2·4· .... (n - 1)· n) for odd n. Hint: J~ J:~x2 = arcsin t.

(12) (_2)n/2/(n/2)! for even nand 0 for odd n.

(13) (_1)(n-1)/2/((n - 1)/2)!n) for odd nand 0 for even n.

(14) (_l)n(;-::.~).

8.3.12. (1) Let us compare the coefficients of tn- 1 in the identity (1 + t)n(1 + t)-m-2 = (1 + t)n-m-2. On the one hand, this coefficient is

2:s (n~s) (-:~2) = 2:( -1 )"-1 (:) (:!n. s

On the other hand,

(2) Consider the identity (l+t)m(l-t)m = (1_t2)m and compare the coefficients of en.

(3) Consider the identity (1 - r1)m(1 - ttn- 1 = (-l)mt-m(l - t)m-n-1 and coefficients of tk- m

(4) Consider the identity ((1 + t)n + (1 - tt? = (1 + t)2n + 2(1 - t2t + (1- t)2n and coefficients of t2m.

(5) Consider the identity ((1 + ttn-1 + (1- ttn- 1 )((1 + ttn- 1 - (1- ttn- 1) = (1 + tt2n- 2 - (1 - tt2n- 2 and the coefficients of t2m+l.

(6) Consider the identity (1- t)2n(1 + 2t(1- tt2) = (1 + et and the coefficients of t2m.

8.3.13. (1) We have

(2)

(3) For the sequence an, we have

Further,

Page 381: Problems and Exercises in Discrete Mathematics

374 CHAPTER 8. COMBINATORICS

8.3.14. (1) We use the identity (1 + t)a+b = (1 + t)a(1 + t)b. Comparing

the coefficients of tn, we find that (a!b) = L:k (n~k) m = L:k k!(n~k)!(a)n-kbk' Multiplying both sides by n!, we obtain the required equality. (2) We put a' = a/h, b' = b/h. Applying the identity proved in 8.3.14 (1) to a' and b', we find that

(a' + b')n = L:k (~) (a')n-k(b'k Multiplying both sides by hn, we arrive at the required identity (since (a')sh S = (a )s,h).

8.3.15 (1) We multiply the equality an = bn - bn- l by tn and take the sum over n. In the region of convergence of the series L:::"=o antn and 2:::"=0 bntn, the following identites are valid:

00 00 00 00

L antn = L(bn - bn-IW = L bntn - L bn_Itn = B(t)(l - t). n=O n=O n=l

(2) We multiply the equality an = bn+l - bn by t n+! and take the sum over n between ° and 00. We obtain tA(t) = B(t) - bo - tB(t).

(3) We note that bn = an-l - an- Hence, B(t) = -A(t)(l - t) + ao, where ao = B(l).

( 4) Multiplying the equality an = nbn by tn and taking the sum, we obtain 00 d

A(t) = L: nbntn = tdiB(t). n=l

(5) The proof is similar to that in 8.3.15 (4). (6) Let us compare the coefficients of tn in the equality A(t) = (1 - ttk B(t).

By definition, this coefficient on the left-hand side is an and on the right-hand side,

(7) We have

00 00

B(tl/2) = L bntn/2, B( _e/2 ) = L( -ltbn tn/2•

n=O n=O

Multiplying the sum of these series by 1/2, we obtain

1 0000

2(B(tl/2) + B( _tl / 2)) = L b2ntn = L antn A(t). n=O n=O

(8) Note that bn = an+! - an. The equality A(t) = B(t)t(l - ttl now follows from 8.3.15 (2).

8.3.16 (1) First method. Let C(t) be a generating function of the sequence 1,0,0, .... By hypothesis, C(t) = A(t)B(t). Consequently, the equalities 1 = aobo,

0= aObl + alba, . .. ,0 = t an-ibj, ... must hold. Since an = (m), t (~.) bi = ° for i=O n i=O n 1

all n = 1,2, ... and (;)bo = 1 for n = O. Consecutively, we obtain bo = 1, bl = -m,

b2 = m(m + 1 )/2, b3 = -m(m + l)(m + 2)/6. By induction of n, we can easily prove that bn = (-:). Thus, B(t) = (1 +ttm.

Page 382: Problems and Exercises in Discrete Mathematics

8.3. RECURRENCES AND GENERATING FUNCTIONS 375

Second method. A(t) = (1 + t)m, B(t) = [A(tWl = (1 + ttm. Hence,

bn = (-nm). (2) bo = 1, bl = -a, bn = ° for n > 1, B(t) = 1 - at. We have

A(t) = ~)att = (1 - atrt, n~O

and since A(t)B(t) = 1, we obtain B(t) = 1 - at.

(3) bo - b2 - 1, bl = -2, bn = 0, n > 2, B(t) = (1 - t)2. (4) b2n = (_I)n, b2n+l = 0, n 2:: 0, B(t) = (1 + t2tl.

(5) bo = bl = 1, B(t) = 1 + t. (6) bn = e~2), B(t) = JI+t.

8.3.17. (1) Multiplying by tn+2 and taking the sum, we get

A(t) = alt + ao + ptA(t) - paot + qA(t)e.

(2) We represent A(t) in the form l~llt + 1~~2t' Having determined Cl and C2,

we find that

A(t) = 1 (al + pao + AlaO _ al + pao + A2ao) . Al-A2 l-Alt l-A2t

Having determined the coefficient of tn in the expansion of A(t) into a series in t, we obtain an expression for an.

(3) Let us represent A( t) in the form l~'>.t + (l-.:'~t)2' From

ao + (al - 2Aao)t (1 - At)2

we find that Cl = -3- + 2ao, C2 = 3- - ao· Expanding A(t) into a series, we obtain

A(t) = I:(ClAn + c2(n + I)Anw, an = (ao + n (~ - ao)) An. n=O

8.3.18. (1) Hint. Use the identity in problem 8.1.13 (3). (2) We multiply each relation of 8.3.18 (1) by tn+! and take the sum over n

between ° and 00. Using the initial conditions, we obtain the relations between generating functions.

(3) 1 - t

A(t) = -1---3t-+-t2' t

B(t) = -1---3t-+-t--"2

(4) The roots of the equation 1 - 3t + e = ° are Al = (3 + v'5)/2 and A2 = (3 - v'5)/2. We express A(t) in the form

a b A(t) = 1 - Alt + 1 - A2(

Page 383: Problems and Exercises in Discrete Mathematics

376 CHAPTER 8. COMBINATORICS

Since A(t) = (1 - t)/(l - Alt)(l - A2t),

equating the right-hand sides, we get a(l - >d) + b(1- >'It) = 1 - tHence a = (AI - l)/(AI - A2) = (1 + vIs)/(2v1s), b = 1 - a = (vis - 1)/(2v1s).

Thus,

Similarly, we obtain

1 (1 1) B(t) = vis 1 - Alt - 1 - A2t .

Expanding A(t) and B(t) into series in t, we find that

Taking into account the inequalities 0 < A2 < AI, we obtain

8.3.19. (1) Multiplying by t n and taking the sum of the initial relation, we get A(t) - ao = tA2(t).

(2) We have

A(t) = (2ttI(1 - (1 - 4t)I/2) = (2ttl (1 - n~o (-I)ne~2)(4t)n) = 2 f (_1)n-I(I/2)(4t)n-I = f _1 (2n)tn.

n=I n n=O n+I n

(3) Multiplying by tn and taking the sum over n, we obtain for the generating function A(t) = L tn the equation A2(t) = A(2t). We seek its solution in the form

n=O A(t) = eat. This function obviously satisfies the equation. Considering that al = 1, we find that Q = 1, whence an = l/n!. The uniqueness of the solution follows from the initial relations.

8.3.20. (1) We number the vertices of the (n + 2)-gon by 1,2, ... , n + 2 in the clockwise direction. Two cases are possible here. The first case. None of the diagonals passes through the vertex n + 2. Then there must be a diagonal between the vertices 1 and n + 1, and the number of ways of dividing the polygon is an-I. The second case. There exist a diagonal emerging from the vertex n + 2. Let k be the smallest number such that the (k + 1)-th vertex is joined to the vertex n + 2 by a diagonal. If k 2: 2, there exist a diagonal of the form (1, k + 1). Then the number of divisions of the initial k + 1 )-gon is equal to the number of divisions of the (k + 1)­gon with the vertices 1,2, ... ,k + 1, multiplied by the number of divisions of the (n - k + 2)-gon with the vertices k + 1, k + 2, ... ,n + 2, i.e. is ak-Ian-k (2 :::; k :::; n). It is natural to assume that ao = 1. This gives an = Lk=I ak-Ian-k. As in Problem

8.3.19, we find that an = n~I e:)· (2) an = n~I e:)· The problem is solved in the same way as 8.3.20 (1).

Page 384: Problems and Exercises in Discrete Mathematics

8.3. RECURRENCES AND GENERATING FUNCTIONS

8.3.21. (1) n1. (2) (_l)n-l /(n - I)!. (3) 1232 •.. (n - 2)2/n! for odd n, 0 for even n. (4) 0 for odd n, (-1)n/22-n/((n/2)!t2 for even n. (5) n2 for odd nand 0 for even n.

377

(6) an = Fn, where {Fn} = 1,1,2,3 is a Fibonacci sequence. We first prove that if {an} satisfies the relation

(A.2)

it also satisfies the relation

(A.3)

For n = 0 and 1, the statement is valid. Let us prove that (A.2) leads to the identity

(A.4)

We have

= a~+3 - 2(anH - an+2)an+2 + an+!an+2 = a~+3 - an+2an+4 - an+2an+4 + 2a~+2 +an+2 an+2 = a~+3 - an+2anH + an+2( -an+4 + an+2 + an+2 + an+!)

= a~+3 - an+2an+4 + an+2( -an+3 + an+3) = a~+3 - an+2an+4'

Identity (A.4) is proved. Relation (A.3) follows from (A.4) by induction. Thus, {Fn} satisfies (A.3). In view of uniqueness (which can be proved by induction), relation (A.3) has no other solutions.

8.3.22. (1) Multiplying the recurrence relation by tk and taking the sum over k , we obtain (1 - t)An(t) = An_1(t).

(2) Since a(O,O) = 1 and a(O, k) = 0 for all k > 0, Ao(t) = 1. Carrying out induction on n and using 8.3.22 (1), we find that An(t) = (1 - ttn.

(3) Expanding An(t) into a series, we obtain a(n,k) = (-kn) (_l)k = (n+~-l). 8.3.23. (1) 20. (2) 6. (3) 9.

8.3.24. (1) A(t) = (1 - t2tl(1 - t3tl(1- t5tl. Let us prove that A(t) is the required genereting function. We note that (1 - t k ) = 2:::0 tks for k = 2,3,5, i.e. all non-zero expansion coefficients are equal to 1. The coefficient of tn in the expansion of the product (1 - t2tl(1 - t3t 1(1 - t5t1 is equal to the sum of the products of the form akb[Cm, where ak is the coefficient of t2k in the expansion (1 - t2t 1, bl is the coefficient of at in the expansion (1 - t3 tl, and Cm is the coefficient of t5m , and 2k + 31 + 5m = n. It should be noted that ak = b[ = Cl = 1, and the number of summands is exactly equal to an.

(2) A(t) + (1 + t2)(1 + t3)(1 + t5).

(3) A(t) = (1 + t 2 + ... + t2p )(1 + t3 + ... + t3T )(1 + t5 + ... + t 5S ).

Page 385: Problems and Exercises in Discrete Mathematics

378 CHAPTER 8. COMBINATORICS

8.3.25. (1) It should be noted that

C<)

A(qt) = II (1 + l+1t) = A(t)(l + qtt1, k=1

and, hence, A(t) = A(qt)(l + qt). The coefficient of tn on the left-hand side is, by definition, an, and on the right-hand side, anqn - an_1qn. By induction on n, we hence obtain

n

an = qn(n+1)/2 II (qk _1)-1, n = 1,2, ... , ao = l. k=1

(2) See solution to problem 8.3.24 (1).

8.3.26. (1), (2) S(n,k,1 + 1) = l/~o(-l)n-1/ [(~!D - C~1)l (II + 1 + I)k

= Y=\_lt+1-I/(n~1)(II+/)k+ t(_l)n-I/(~)(II+/)k 1/=1 1/=1

= S(n + 1, k, I) + S(n, k, I).

(3) S(n,k+1,/) = t(_l)n-I/(~)(II+/)k(II+/) v=o

= t (_1)n-vn(~=D(1I + l)k + IS(n, k, I) v=o

= n v~o(-l)n-v ((~) - (n~1)) + IS(n,k,/)

= (n + I)S(n, k, I) + nS(n - I, k, I).

(4) The proof is carried out by induction on k and by using 8.3.26 (3). For any I and n > 0, we have

S(n,O,/) = ~(-lt-V(:) = 0.

Let the statement be correct for a certain k ~ 0, any n > k and any I. Let k + 1 < n. From 8.3.26 (3), we have

S(n, k + 1, l) = (n + I)S(n, k, I) + nS(n - 1, k, I).

Since k < n -I, in view of inductive hypothesis S(n,k,/) = S(n -l,k,/) = ° and, hence, S(n, k + 1, I) = 0.

(5) Induction on n. We have 5(0,0,1) = 10 = 1 = 01. Let S(n,n,/) = n! for a certain n ~ ° and any I. Using (3) and (4) of this problem, we obtain

S(n + 1, n + I, I) = (n + 1 + I)S(n + 1, n, I) + (n + l)S(n, n, I)

= (n + l)S(n, n, I) = (n + l)S(n, n, I) = (n + 1)1.

(6) Induction on k. In view of 8.3.26 (5), we have S(n, n, I) = n! > ° for all n and all I. Let S(n, k, I) ~ 0, for a certain k > n and any n and I. Using 8.3.26 (3), we get

S(n, k + 1, I) = (n + l)S(n, k, l) + nS(n - 1, k, I) > 0.

Page 386: Problems and Exercises in Discrete Mathematics

S.4. POLYA'5 THEORY

(7) This follows from parts (1), (2) and (6) of this problem. (8) This follows from (3) and (5). (9) This can be derived from 8.3.26 (3) and (4) by induction of k.

8.3.27. (1) In view of 8.3.26 (9), we have

00 00

O"n(t) = L 5(1, k, OW = L tk = t(l - i)-I. k""O k""l

Further, in view of 8.3.26 (3), we have

S(n, k + 1) = nS(n, k) + n5(n - 1, k).

379

Multiplying both sides of this expression by tk+1 and taking the sum over k, we obtain O"n(t)(1 - nt) = ntO"n-l(t). The statement can now be proved by induction on n.

(2) For n = 1, the right-hand sides of formulas in (1) and (2) for O"n coincide.

If we prove that for O"n(t) = tLk""I(-I)n-kk(~)(1- kitl the recurrence relation

O"n-l(t) = ((1- nt)/nt)O"n(t) is valid, the statement will follow from it by induction. We have

= f) -It-k (n - 1) (1 _ (n - k)t) = 'f( -It-k+1 (n - 1) (n - k)t k",,1 k - 1 1 - kt k",,1 k - 1 1 - kt

8.4 Polya's Theory

8.4.1. (1)(0,0,0,1). (2) (2,1,0,0). (3) (0,0,2,0,0,0). (4) (2,0,0,0,0,1,0,0).

8.4.2. The transposition of the elements i and j will be denoted by (i,j). Then (2,3,4,1) = (1,2)(2,3)(3,4); (4,2,3,1) = (1,4)(1,2)(1,3);

(3,4,5,6,1,2) = (1,5)(2,6)(3,5)(4,6); (8,2,1,7,4,6,3,5) = (1,3)(3,7)(4,5)(5,8)(8,7).

8.4.3. (1) There exist four rotations of the square in the plane, which transform the former into itself: by 0°, by 90°, by 180° and by 270°. These rotations correspond to permutations (1,2,3,4), (2,3,4,1), (3,4,1,2), (4,1,2,3). The first permutation is of the (4,0,0,0) type, while the remaining ones are out of the (0,0,0,1) type. The cycle index has the form PG ( tl , i 2 , h, t4 ) = (t1 + 3t4 ) /4. (2) In addition to the permutations mentioned in 8.4.3 (1), we also have four permutations (1,4,3,2),

Page 387: Problems and Exercises in Discrete Mathematics

3S0 CHAPTER 8. COMBINATORICS

(3,2,1,4), (2,1,4,3), (4,3,2,1) corresponding to the rotations of the square about the diagonals. Two of them are of the type (2,1,0,0), while the other two are of the type (0,0,0,1). Hence, PG = (tf + 5t4 + 2tit2)/S, (3) There exist 12 rotations of the tetrahedron: identical, eight rotations by 1200 about the axis passing through its vertex and the center of the opposite face, and three rotations about an axis passing through the midpoints of opposite edges. Hence, PG = (tf + St1t3 + 3t~)/12.

(4) PG = (t~ + St~ + 3titD/12. (5) PG = (tt + St 1t3 + 3t~)/12. (6) PG = (t{ + 3t1h + 2t3 )/6. (7) PG = (tt + St1t3 + 3tD/12. (S) From 24 rotations of the cube, one is identical, there are rotations by IS0°

and six are rotations by 900 about the straight lines passing through the centers of opposite faces, six are rotations by IS0° about the straight lines passing through the midpoints of opposite edges, and eight are rotations by 1200 about axes connecting opposite vertices. The identical permutation gives six cycles of length 1, the three permutations corresponding to the rotations by IS0° give two cycles of length 1 and two cycles of length 2, the six permutations corresponding to the rotations by 900

give two cycles of length 1 and one cycle of length 4, and the other six permutations corresponding to the rotations by IS0° give three cycles of length 2. The eight permutations corresponding to the rotations by 1200 give two cycles of length 3. Hence, PG = (t~ + 3tit~ + 6tit~ + 6t~ + St~)/24.

(9) We have five types of rotation: by 00 (state of rest) corresponding to the identity permutation, the rotation by 900 about the diagonal, the rotation by IS0° about the diagonal, the rotation by IS0° about the straight line passing through the midpoints of opposite faces, and the rotations by 1200 about the straight line passing through the midpoints of opposite faces. The identity permutation corresponding to the state of rest makes a contribution to ZG equal to t~, the second-type permutation gives tit4 , the third-type permutation tit~, the fourth-type permutation t~, and the fifth-type permutation t~. Each of these types corresponds to 1,6,3,6 and S rotations, respectively. Hence, PG = (t~ + 6tit4 + 3tit~ + 6t~ + St~)/24.

8.4.4. (1) We prove this statement directly by using Bernside's lemma. The group G consist of permutations 1f1 = (1,2,3,4), 1f2 = (2,3,4,1), 1f3 = (3,4,1,2), 1f 4 = (4,1,2,3). It is immediately seen that for any pair 1 s:; i, j s:; 4 there exist a permutation 1f such 1fi = j. Thus, all the elements are equivalent, and we have one equivalence class.

Let us obtain the result by using Bernside's lemma. We have IGI = 4, b1 (1fd = 4, b1(1fd = 0 for i = 2,3,4. Hence, I/(G) = (4 + 0 + 0 + 0)/4 = 1.

(2) Note that the elements 1 and 2 are transformed into each other by permutation 1f3, while permutation 1f2 transforms elements 3 and 4 into each other, but none of the permutations transforms the elements of the set {I, 2} into the elements of the set {3,4}. Thus, we have two orbits. Applying Bernside's lemma, we obtain

IGI = 4, b1(1fJ) = 4, b1(1f2) = b1(1f3) = 2,b1(1f4) = 0, I/(G) = (4+2+2+0)/4 = 2.

8.4.5. We must prove that IGII/(G) = 2:ll'EG b1 (1f), where IGI is the order

Page 388: Problems and Exercises in Discrete Mathematics

8.4. POLYA'S THEORY 381

(number of elements) of the group G, v( G) is the number of classes of G-equivalence (orbits) on the set Zn, and bl err) is the number of elements which do not change places upon permutation 7r. We put Gy->x = {7r E G: 7ry = x}. If M ~ Zn is a certain orbit and x E M, then G = UyEM Gy->x' In this case, we obviously have Gv->x n Gy->x = 0 for v -I y. Note that \Gy->x\ = \Gx->x\ if y rv x, i.e. if y belongs to the same orbit as x does. Indeed, if (J E Gy->x and Gx->x = {7r1, ... , 7rm },

then {(J7rl,"" (J7rm} E Gy->x where (J7ri -I (J7rj for i -I j. On the other hand, if Gy->x = {(Jl,"" (Jd and (J E Gy->x, then {(J-l(Jl,"" (J-l(Jk} ~ Gx->x and (J-l(Jj

for i -I j. Hence, it follows that \Gy->x \ = \Gy->x\. Let now M1 , ... , MV(G) be orbits and Xi E Mi. The

v(G) v(G)

L bl (7r) = L \ Gx->x \ = L L \ Gy->x. I = L IGI = IGlv(G). xEG xEZn i=l yEMi i=l

-4

8.4.6. (1) Each permutation 7r in Sn of the type b = (b1 , b2, ... , bn) can be represented in the form of the product of cycles so that the length of the cycles does not decrease: 7r = h)(i2)'" (ib1)(ib1+l, ih +2) .... Such two notations can generally lead to different permutations. This can be in two cases: (a) when identical cycles occupy different places in these notations, and (b) when the cycles are equivalent (as the cycles of a permutation) but start with different elements (e.g. (1 2 3) and (23 1)). The first reason leads to the repetition of the same permutation I1k=l bkl times, while the second reason leads to the repetition of I1k=l kbk times. These reasons are independent.

(2) By definition PSn (il , .... in) = (nltl L i~d1C) ... i~n(1C) = (nltl X L L t~l ... i~l

1CE Sn -4 ---> b 1CEH(b)

(3) We have

exp (ilX +t2"'t +t3~ + ... ) = k~l exp {tkxk/k} = k~l C~o xkbkt%kk-bk(bkltl).

The coefficient of xn is equal to the sum over possible non-negative integers bl, b2, ... , such that b1 + 2b2 + ... + nbn = n, of terms of the form I1k=l t%k(bklkbk tl.

8.4.7. It should be noted that a cycle of an even length is an odd permutation, while a cycle of an odd length is an even permutation. Each odd permutation of the type (b1 , ... , bn) makes a contri bution t~l ... t~n to the expression P Sn (t 1, ... , in) and a contribution t~l ... t~n to the expression PSn (tl,-t 2, ... , (-1)n-1in). Therefore, the terms on the right-hand side of the equality to be proved, which correspond to odd permutations, are cancelled out, while the terms corresponding to even permutations are doubled. Besides, it can be easily seen that IAn\ = ISn\/2 = (nl)/2. Hence, the statement follows.

8.4.8. (1) We must prove that the set {7r X (J} with the multiplication operation forms a group, that is

Page 389: Problems and Exercises in Discrete Mathematics

382

(1) there exists a unit element; (2) each element has its inverse; (3) the operation is associative.

CHAPTER 8. COMBINATORICS

The unit element is obviously 7fo x (/0, where 7f0( (/0) is a unit permutation in the group G (respectively, in the group 11). The inverse element to 7f x(/ is a permutation 7f-1 x (/-1, where 7f-1 and (/-1 are the corresponding inverse elements. It remains to prove that (7f1 x (/1) X ((7f2 x (/2) X (7f3 x (/3)) = ((7f1 x (/1) X (7f2 x (/2)) X (7f3 x (/3)' Let us consider the action of a permutation on an element v E Xu Y. Without loss of generality, we can assume that vEX. Then (7f1 x (/1) X ((7f2 x (/2) X (7f3 x (/3))V = 7f1(7f27f3)V, ((7f1 x (/1) X (7f2 x (/2)) X (7f3 x (/3)V = (7f17f2)7f3V, and the associativeness follows from the fact that the multiplication operator in the group G is associative. The order of the group is obviously equal to IGIIHI, since the elements 7f and (/ of the permutation 7f x (/ are chosen independently, and the two permutations 7f1 x (/1 and 7f2 x (/2 are obviously different if 7f1 i- 7f2 or (/1 i- (/2·

(2) If bi(Ci) is the number of cycles of length i of the permutation 7f x (/ is equal to bi + Ci.

(3) We have P.o H (t t ) = _1 - '" tbl (T) tdn(T) = _1_ X '" tbl (7r)+cdu) tbn(U)+Cn(U) x 1,··· n 10xHI ~ 1 ... n 10liHI ~ 1 ... n

TEOxH 7rXU

= (-L '" tbd7r) tbn (7r)) x (-L '" tbdu ) tbn(u)) = P. x P 101 ~ 1 •.• n IHI ~ 1 ..• n G H· 7rEO uEH

8.4.9. (1) 20. The necklace of seven beads can be colored in two colors in 27 = 128 ways. We have a set G of seven different rotations 7f1, ... , 7f7 transforming the necklace into itself. The type of identity permutation is (7, 0, 0, 0, 0, 0, 0), while any other permutation is of the type (0, 0, 0, 0, 0, 0, 1). The cycle index is PG(tI, ... ,t7) = (t~ + 6t7 )/7. According to Polya's theorem, the number of different equivalence classes is Po(2, 2, 2, 2, 2, 2, 2) = 20.

(2) ThecycleindexisP(h, ... ,tn ) = (t~+(n-1)tn)/n. The number of necklaces is P(k, ... , k) = (kn + (n - 1)k)/n.

8.4.10. (1) The cycle index is (see Problem 8.4.3. (3)) PG = ti + 8t1t3 + 3t~)/12. According to Polya's theorem, the number of colorings is PG (2, 2, 2, 2) = 5

(2) The cycle index PG can be taken from Problem 8.4.3 (9). The number of colorings is Po (3, 3, 3, 3, 3, 3) = 54.

(3) Let M be the set of cube faces, G the rotation group and N the set consisting of three colors: red, blue and z to white colors. The cycle index (see Problem 8.4.3 (8)) is Po = (t~ + 3tit~ + 6tit4 + 6t~ + 8t~)/24. According to Polya's theorem, the function counting series is PG(ft, 12, h, 14)' where Ik = xk+yk+zk, k = 1, 2, 3, 4. Therefore

POU1, h, h, 14) = fi((x + y + z)6 + 3(x + y + z)2(X2 + y2 + Z2)2 +6(x + y + Z)2 X (x4 + y4 + Z4) + 6(x2 + y2 + Z2)3 + 8(x3 + y3 + Z3)2). The number of different colorings for which three faces are red, two are blue and

one is white, is equal to the coefficient C3, 2, l(PO ) of X 3y2z1 in PO U1, 12, h, 14)' We have

C3, 2, 1PO(ft, h, h, 14) = fiC3, 2, 1((X+y+Z)6+3(x+y+z)2(x2+y2+Z2)2) = fi (60 + 12) = 3.

Page 390: Problems and Exercises in Discrete Mathematics

8.5. ASYMPTOTICS AND INEQUALITIES 383

8.4.11. PG(N, N, ... , N). It follows from Polya's theorem.

8.4.12. (1) If a rooted tree has k> 1 vertices, it has 1 ~ n < k edges incident with the root. The subtrees "planted" on edges which are incident with the root will be referred to as branches of the tree. If the branches are isomorphic to one another, by transposing them, we can obtain a tree isomorphic to the initial one. The permutation group of branches is a symmetry group of order n, and the figure counting series (branches) coincides with the rooted trees counting series T( x). The result follows from Polya's theorem.

8.4.13. The solution is similar to that if the previous problem. If the connectivity components of a graph are isomorphic to one another, they can be transposed to give a graph isomorphic to the initial one. For a graph with n components, the permutation group of components coincides with Sn. The figure counting series is l(n). The result follows from Polya's theorem.

8.4.14. (1), (2). Let 7r be a permutation of n elements, having k cycles. The element n in it may form a unit cycle. Then such a permutation can be put in a one-to-one correspondence with a permutation of n - 1 elements with k - 1 cycles (the number of such permutations is equal to P(n -1, k-1)). If the element n does not form a unit cycle, the permutation 7r can be obtained from a certain permutation of n - 1 elements having k cycles each by including the element into a certain cycle. For a fixed permutation of n - 1 elements with k cycles, such an inclusion can be carried out in n -1 ways (the element n cannot be placed first, since n is the largest element). Hence, it follows that P(n, k) = P(n - 1, k - 1) + P(n - 1, k)(n - 1). Multiplying the equality by tk and taking the sum over k, we obtain the relation Pn(t) = (t + n - 1)Pn- 1 (t) between the generating functions. By induction taking into account the equality Pl(t) = t, we obtain

Pn(t) = t(t + 1) ... (t + n - 1).

8.5 Asymptotics and Inequalities

8.5.1. (1) Note that n ::::: (i + l)(n - i) < ((n + 1)/2)2 for 0 ::::: i < n.

Hence,

n+1 (n+l)n nn/2~ II (i+1)(n-i)~n!~-2- II (i+1)(n-i)::::: -2-15,i5,n/2 15,i<n/2

(2) Note that (i + 1)(2n - i) ~ n(n + 1).

(3) We have

( 1 ) n n (n) n 1 n 1 - = L k n-k ~ L -k' ~ 2 + L k < 3. n i=O k=O . k=l 2

Page 391: Problems and Exercises in Discrete Mathematics

384 CHAPTER 8. COMBINATORICS

(4) Induction on n. For n = 1, the inequality is valid. If (n/3)n < n! then, using (3), we have

Cn; l)r+1 = (ir Cn; 1)) (1 + (l/nW ~ (ir (n + 1) ~ (n + I)!

(5) Note that (n!)2 ~ (2n)!2-n and use the result of Problem 8.5.1 (2).

(6) Use Cauchy's inequality

-Ya1a2 ... ak ~ (a1 + a2 + ... + ak)/k, at ;::: 0

and the fact that the arithmetic mean of the multipliers on the left-hand side of the inequality is equal to n(n~1) 2:%:1 i2 = (2n + 1)/3.

(7) Putting an = (2n -1)!! X v'3n + 1(2n!!t\ prove that a~+1/a~ < 1. Further, carry out induction on n.

(8) Note that i(2n - i) < n2 for i < n.

(9) en = "Lk:O nk / k! > nn In!. (10) For n = 1, the inequality is obviously valid. We assume that (1 + a)n >

1 + an for all -1 ~ a and a certain n ;::: 1. Then

(11) Expanding both sides of the inequality according to Newton's binomial theorem, we compare the terms of the expansion with the same numbers. We have (~)n-k = (nt1)(n + 1tk for k = 0, 1. Further, the ratio (~)n-k/(nt1)(n + 1tk is equal to (1 - k/(n + 1))(1 - l/(n + 1W. In view of 8.5.1 (10), the ratio does not exceed 1. Therefore, each term of expansion of (1 + 1/n)n does not exceed the corresponding term in the expansion of (1 + 1/ (n + 1) t+l. Besides, in the latter expansion we also have the (n + 2)-th term (n + 1t(n+1) > O. Hence, a strict inequality follows.

8.5.2. (1) We put ak = e(::;1k) f / (~) and verify that ak+I/ ak < 1 for k ;::: 1.

Since a1 = 1, it follows that the first inequality holds. The second inequality follows from Problem 8.5.1 (9).

(2) (n/k)k ~ (nh/k! for 1 ~ k ~ n. The second inequality can be obtained

by using the ratio ak+1/ak, where ak = (~)kk(n - k)n-kn-n. We have ak+I/ak =

(1 + (n - k - 1 t1 )n-k-1 (1 + 1/ k tk. Since (1 + l/m)m increases monotonically with m (see problem 8.5.1 (11)), ak+I/ak ;::: 1 for k ~ (n -1)/2. Considering that al < 1, we find that the inequality ak < 1 is valid for k ~ (n - 1)/2. For k > n/2, the inequality follows from symmetry considerations.

(3) We prove the first inequality by induction on n. For n = 1, the inequality holds. Assuming that it is valid for a certain n ;::: 1, we have

(2(n+l))=22n+l(2n»22n+l~>2(2n+l)4n> 1 4n+l. n + 1 n + 1 n n + 1 2vn v'nTI n 2v'nTI

The second inequality can be proved by induction and using the result of Problem 8.5.1 (7).

Page 392: Problems and Exercises in Discrete Mathematics

8.5. ASYMPTOTICS AND INEQUALITIES 385

8.5.3.(1)(2n - 1)!! = (2n)!(n!t 12-n

(3) n!([n/3]!t2((n - 2[n/3])!tl rv (27rtl[n/3tl (n(n - 2[n/3])rl/2nn[n/3]-2[n/31x (n_2[n/3])-n+2[n/31.

Note that (n/3) - 1 < [n/3] ::; n/3, n/3 < n - 2[n/3] < n/3 + 2. So we have

[n/3]-1(n - 2[n/3])-1/2 2: ((n/3) -1)-1(n/3t1/2

2: (n/3t3/2(1 - 3/ntl rv (n/3t3/2;

[n/3]-1(n - 2[n/3])-1/2 ::; (n/3t1((n/3) - 2t1/2

We put a = n/3 - [n/3]' 0 ::; a < 1. This gives

[n/3]2[n/31(n _ 2[n/3])n-2[n/31 = ((n/3) _ 2)2[n/31((n/3) + 2a)n-2[n/31

= (n/3)n(1- 3a/n)2[n/31(1 + 6a/n)n-2[n/31.

Further (1 - 3a/n)2[n/31 = (1 - 3a/n)2«n/3)-Ci) = (1 - 3a/n)2n/3(1 - 3a/nt2Ci

Similarly, (1 + 6a/nt-2[n/31 rv e2Ci . Hence, we obtain the required asymptotic equality.

(4)

(m + 1) ... (m + n) k! (n + m)! k! In + m( )n+m( k)-(n+k) k-m -'-:--'--~--'-- = - rv - -- n + m n + e (k+1) ... (k+n) m!(n+k)! m! n+k

k. m k k m m n m m • m k , (k)-n (k)m ( k)-k k' rvm!n - e- (1+--;:;-) 1+~ (1+--;:;-) 1+~ 1+~ rvm!n -.

In the last case, we have used asymptotic equalities of the form

Page 393: Problems and Exercises in Discrete Mathematics

386 CHAPTER 8. COMBINATORICS

(1 + r;;Y '" em, (1 + (m/n))m '" em2 /n '" 1 for m2 = o(n).

(5) Note that (2n)!!((2n - l)!!tl = (2n)!((2n - 1)!!t2.

Then we can use Stirling's formula and the result of 8.5.2 (1).

8.5.4. (1)

1 1 11 2n +1 1 / (1 + ttdt = --(1 + tt+1 = - - --.

n+l 0 n+l n+l o

On the other hand,

(2) Using the result of Problem 8.1.19 (3), we obtain

'" n '" _~ (~)n '" -2"rv ( h'V)n ( ) 1 k-l 1 k-l

L = - L e k 1 + e k = - 2n + L e k 1 + e k •

II kv + r k 11=0 k 11=1

It should be noted that lexp{-27rirv/k}1 = 1 and

I 7rV ( 7rV . 7rV) I I 7rV I 7r = 2 cos T cos T + i sm T = 2 cos T :S 2 cos k· Hence,

I~ e_2.~rv (1 + /~'vrl :S (k -1) (2cosir = 0 c:)· (3) Use the result of Problem 8.1.20 (1), noting that

11 + o:e27rIl / k l :S 1 - 0: + 20: cos 7r: < 1 + 0: for 0 < v < k.

(5) Using Problems 8.1.18 (9) and 8.5.3 (2), we obtain

t k (n) 2 = n t (n - 1) ( n ) = n (2n - 1) = ~ (2n) "'! ~4 n. k=1 k k=1 k - 1 n - k n - 1 2 n 2 V ;:

8.5.5. (1) Yes, they are. The validity of the inequalities follows from the fact that

Page 394: Problems and Exercises in Discrete Mathematics

8.5. ASYMPTOTICS AND INEQUALITIES 387

(2) No, they are not. A counterexample is a sequence {bd such that bk = 2 X 3-k

for even k and bk = 3-k for odd k. Putting a = 1/3 and c = 2/3, we obtain o < ak :::; bk < ck < 1. However, in view of 8.1.20 (1), we find that

= (1 - 1/3t + ~ ((1 + 1/3t + (1 - ~) n) > (1 - at.

8.5.6. (1) We have

1~ 1 '" 2 2 Da = - ~(ai - a) 2': - ~ (ai - a) 2': Ott. n i=1 n a.:la;-al~t

(2) Let us consider a set A = {aO,a1, ... ,a2n-d in which a" is the number of ones in the binary vector 0: = (Q1, ... , Qn) having the number v. It should be noted that

Further, we note that the number on the left-hand side of the inequality to be proved is equal to the number of a" for which la" - al 2': tfo. In view of problem 8.5.6 (1), this number does not exceed 2n Da( t fot2. But

= _2n(a)2 + L k2 (n) = _2n(n/2)2 + (n2 + n)2n- 2 = n2n- 2. O~k~n k

Therefore, 2n Da/(tfo)2 = 2n - 2/t 2 •

(3) Minorization. We put t = In n. Taking into account 8.5.6 (2), we can write

n 1 (n) (n) L k2 k > L k-2 k k=1 k:lk-n/21<tfo

Majorization. We first note that (~) < (T r in view of 8.5.2 (1) and

(k~1)/ (~) = n-Z+1 < 1/3 for k:::; n/4. Therefore,

Page 395: Problems and Exercises in Discrete Mathematics

388 CHAPTER 8. COMBINATORICS

L k- 2 < L + - L + - - tvn L n (n) (n) 16 (n) (n )-2 (n) k=l k - kSn/4 k n2 k:lk-n/21>tv'n k 2 k:lk-n/2IStv'n k

00 4 :::; (4et/4L3-i + 16n-22n/t2 + 2(1 +tn-3/2)2n::s n-22n+2.

i=O n

8.5.7. (1) Using formula (2), we obtain

( n) ynnn(l + O(l/n)) k - /21rk(n - k)kk(n - k)n-k'

We put x = n/2 - k. Then the obtained expression can be written as

( n) (1 + O(1/n))2n+l

k - J27rn (1 _ ~) (1 + ~) (1 _ ~) n/2-x (1 + ~) n/2+x'

Further, we have

Hence

(n) 2n+l _(2k_n)2 '" --e n

k J27rn .

(2) As in 8.5.7 (1), by using Stirling's formula we find that

( n) k ynaknn(l + O(l/n)) k a = /21rk(n _ k)kk(n _ k)(n-k)'

Putting a = a/(a + 1), /3 = l/(a + 1), x = an - k, we get

( n) k (a + l)anc>-x(1 + O(l/n)) ( / )-cm+x a = x a-x n x k /27rna(1- x/an)(l + x//3n)

(/3 + x/nr{3n-x = (a + l)n(1 + O((x + l)/n)) . J27rna( 1 - x/an )cm-x (1 + x / /3n )(3n-x

Further, we have

Page 396: Problems and Exercises in Discrete Mathematics

B.5. ASYMPTOTICS AND INEQUALITIES

30:3n3 - ••. ) + ((3n + x )(x / (3n - x2/2(32n2 + x3 /3(33n3 - ... ) = x2/2n

(1/0: + 1/(3) + O(X3/n2) = x2(a + 1)2/2an + o(1/n).

Finally, we obtain

where x = na(a + 1)-1 - k. Since x = o(n2/3), X~l = o(n- 1/ 3 ), it follows that

We put D = <I>(xm + (h/2)) - <I>(Xk - (h/2)),

and ll1(x) = ;e-x2 / 2. It remains for us to prove that

Using (A.l), we obtain

On the other hand, according to (A.l), we have

For Xm - Xk 2 1, Xk -t 00 and Xkh -t 0, we obtain

389

(A.2)

(A.3)

If, however, Xm - Xk < 1, we put Tf = Tf(n,m,k) = (xm - xk)h- 1 • It follows from m - k -t 00 as n -t 00 that Tf = ry(n, m, k) -t 00. We note that

221 (Xm - xk)/2 = 2(Xm - Xk) x (Xm + Xk) > hryXk.

Further

y'2;D ~ ll1(xk)(l + O(xmh)) - Il1(Xm) = W(Xh) - Il1(Xm) +~,

where ~ = O(Il1(xk)xmh) = O(Il1(Xk)Xkh). But

ll1(xkl - w(xml 2 ll1(xk)(l - exp{ -(x~ - x%)/2} 1 2 ll1(xk)hryxk.

Hence, it follows that

Consequently,

Page 397: Problems and Exercises in Discrete Mathematics

390 CHAPTER 8. COMBINATORICS

Thus, it follows from (A. 1) and (A.3) that

(4) We put Xl = X + 2~, k(x) = na!~F. Then

'" (n) v '" (n) v '" (n) v ~ a = ~ a + ~ a. v~k(x) II k(x)~v~k(xl) II v>k(xd II

But

L (n)av ~ n(n)aVD ,

v>k(xd II 110

where 110 =]k(XI)[' In view of 8.5.7 (2), we obtain

L (:) aV ~ n(21l'na rl/2(1 + a t+l exp{ -xU2} = nl/2(21l' r l /2 x V>k(Xl)

On the other hand, it follows from 8.5.7 (3) that

L (n)a v ", (a + It (e-X2/

2 _ e-X f/ 2

) •

k(x)~v~k(xd II v'27r X Xl

The required estimate follows from (AA) and (A.5).

(AA)

(A.5)

8.5.8 (1) Using inequality (2) and the inequality n! > yl21l'nnne-n following from it, we obtain

( n) y'27i;1nnexp(-n + 1/(12n)) An < 21l'nVXl1(An»'n(p,n)/Lnexp(->.n-p,n)

On the other hand,

el /(12n)

--===--- '" G( n A) yl21l'nXp,AAnp,/Ln ,.

Page 398: Problems and Exercises in Discrete Mathematics

8.5. ASYMPTOTICS AND INEQUALITIES 391

(2) The minorant follows from the solution of 8.5.8 (1). In order to obtain the majorant, using inequalities (2) we find that

(n) {1 1 1 1 1} ), G(n,),) exp 12n - 12),n - - 121m + 360(),n)3 + 360(/m)3 .

Without loss of generality, we can assume that ), ~ J.1. Then 1/(12n) < 1/(12),n) and

1 1 1 1 1 --:-:---:-:- + - -- < - -- < O. 360(),n)3 360(J.1n)3 12J.1n - 180J.13n3 12J.1n

Consequently,

(~) < G(n, ),).

(3) Using the minor ant from 8.5.8 (2), we obtain (~) > G(n, ),)e-12~>''', But for n ~ 3

exp{-(12n),J.1t1} ~ exp{-(3nt1} ~ exp{-1/9} > ,Ji/2.

For n = 2 and )'n = J.1n = 1, the equality is observed.

(4) Majorant

n (n) ( n) 00 (1 _ ),) i 1 ( n ) k~n k < )'n ~ -),- = 2), - 1 )'n .

(5) (a) The inequality can be easily verified when), = 1/2

(b) )'n = n-1

is (----'"-.)n-1 n ). n-1 '

( ( n) (1) -n/2 (1) -n/2) since L k < 2n = 2 2 ;

k?,n/2

( the left-hand side is n + 1, and the right-hand side

(c) 3 ::; n ::; 5, n/2 < )'n < n -1. (This can be checked directly.) Let now n ~ 5 and n/2 < )'n < n - 2. It follows from (4) and (1) that

L (n) ::;),(2),_1)-1(n) ::;),1/2(2)'-lt1(27l'n(1-),)t 1/2),-)..nJ.1-lJ.n. k?,An k )'n

Let us put f(),) = ),1/2(2), _1)-1 (27l'n(1 - ),) t 1/2. We must prove that f(),) < 1 for)' E [1/2 + t, (n - 2)/n], where t = l/n for ever nand 1/(2n) for odd n. Differentiation with respect to ), shows that the function f(),) is convex down on the segment under investigation. Therefore, the maximum values must be achieved at the ends of the segment. For n ::; 5 we get

f 0 + t) = J! + t(1 + 2tt1(27l'n(1/2 - t))-1/2

Page 399: Problems and Exercises in Discrete Mathematics

392 CHAPTER 8. COMBINATORICS

For n 2: 6 we have:

f((n - 2)/n) = )1 - 2/n(1 - 4/nt1(47rt1/ 2 ::; (1 - 4/ntl(47rtl/2 < 1.

If A < 1/2, then J.l = 1 - A > 1/2.

(6) Since (~) = (n:k) , using 8.5.8 (5), we obtain

( ) n () ~ n = ~ n -J1.n A -.\n ~ k ~ k <J.l •

O~k~.\n k=J1.n

8.5.9. (1) It is clear that

k-l k-l (nh = nk II (1 - i/n) = nk exp L In(l - i/n).

i=O i=1

Besides,

k-l k-l 00 1 ( . ) 11 00 1 k-l Lln(l-i/n)=-LL-': =-L-II Li ll

i=1 i=1 11=1 II n 11=1 lin i=1

(2) On the one hand, it is obvious that (n h ::; nk. On the other hand, taking into account that k = o( v'n), we have

k-l (nh = II (n - i) > (n - k)k = nk(l - (k/n))k 2: nk(l - k2/n) rv nk(l - o(t)).

i=O

k-l (3) We use the fact (see Problem 8.5.13 (2)) that L: ill = (II + 1)-1 p+1 + O(P).

;=1 Hence, in view of 8.5.8 (1), for k --t 00 and k = o(n), we have

= n exp - + 0 - -k { 00 (kV+1 (1 (k)lI))} E 11(11 + l)nll II n .

But

Hence, we obtain the required equality.

Page 400: Problems and Exercises in Discrete Mathematics

B.5. ASYMPTOTICS AND INEQUALITIES 393

(4) Use 8.5.9 (3) for m = 3.

8.5.10. (1) In view of 8.1.13 (6) and 8.5.9 (1), we have

(n - s) / (n) = (k). '" (~)' k-s k (n). n

(2) Make use of 8.5.9 (3).

8.5.11. (1) We have

( n - s) / (n) = (n - s h = IT (1 __ s .) = k k (n h i=O n - z

= exp Lin 1 - ~. = exp - L L - ~ { k-1 ( )} {k-1 00 1 ( )V} ;=0 n Z i=O v=l 1/ n Z

{ k-1 1 S2 k-1 1 k-1 1 ( s ) v}

= exp -s L -. - - L . 2 - L L - -. . i=O n - Z 2 i=O (n - z) ;=0 v~3 1/ n - z

Further k-1 1 n (1) --=in +0 - . ~n-i n-k+l n'

k-1 1 k ( (1)) ~(n-i)2=n(n2-k) 1+0;;;, ;

i n 00 1 (k - I)" n n _ k + 1 = :; -;; -n- ;

k-1 1 L(n - itV = --((n - k + 1)-V+1 - n-v+1) + O((n - ktV) i=O 1/ - 1

for 1/ > 2. Therefore

",exp{-s 00 ~(k-l)" _ s2k _ 00 SV((n-ktV+1-n-V+1)} :; a n 2n(n - k) ~ 1/(1/ - 1)

=exp {_Sk_S(k-l)2 _ s2k -s 00 ..!:..(k-l)" _ 00 SVk(1+0(~))} n 2n2 2n(n - k) E an?; I/n(n - k)v-1

= exp {- sk _ sP +2S2k (1 + 0 (~)) _ s L..!:.. (~)" -k L sV(1 + O(~~l}' n 2n n ,,~3 a n v~3 I/n( n - k)

(2) It follows from 8.5.11 (1).

Page 401: Problems and Exercises in Discrete Mathematics

394 CHAPTER 8. COMBINATORICS

k-l ( ) (3) The majorant follows from the fact (see 8.5.11 (1)) that .n 1 - n~i :S .=0

(1 - !) k < e -;k. In order to obtain the minorant, we shall use the relation (see 8.5.11 (1))

(n:s)/ (~) = g (1- n~J ~ (1- n~kr

= exp { kIn (1 - n ~ k) } = exp { - k L v = 1 00 ~ (n ~ k r} ~ exp { -k (n ~ k + 2(n ~ k)2 ~ C ~ kr)}

= exp {- s: (1 + n: k + 2(n _ k);: _ k _ s))}· 8.5.12. Hint. 2:;;'=n+1 f(k) is the upper and 2:;;';'; f(k) the lower integral sum

for J::' f(x)dx.

8.5.13 (1) We have (see 8.5.12)

m m

LIn k :S fIn xdx + In m. k=l 1

At the same time

fIn xdx = x In x - J dx = x In x-x.

Hence,

n

LIn k ~ mIn m - m + 1 + In m. k=l

On the other hand (see 8.5.12),

m m

LInk ~ J lnxdx = mhim - m + 1. k=l 1

(2)-(6) are similar to (1).

8.5.14 (1) Induction on n. For n = 1, we have PI = Po - ala = 1 - a. Hence, o < PI < 1. Let 0 < Pn < 1 for a certain n ~. 1. Then Pn+1 = Pn - a~ = Pn(1- a~-I). Since 0 < a < 1, {3 > 1 and 0 < Pn < 1, 0 < Pn+l < 1.

(2) It follows from the relation Pn+1 - Pn = -a~ < O.

Page 402: Problems and Exercises in Discrete Mathematics

8.5. ASYMPTOTICS AND INEQUALITIES 395

(3) Majorant. We have ~ = 1. Hence aPk_l

n 1 d = '" Pk-1 - Pk < J ~ = 1 (l-fJ - 1)

n L fJ - fJ ((3 ) Pn . k=l apk-1 Pn ax a-I

Therefore, p;-fJ 2: 1 + a((3 - l)n or, which is the same,

Pn :::; (1 + a((3 - l)n)l/(l-fJl. (A.6)

Minorant. It follows from (A.6) and the recurrence relation Pn = Pn-1(1 - ap~:::~) that

Pn1Pn-1 2: 1 - a/(l + a((3 - l)(n - 1)). (A.7)

Further, 1 d n

1 (l-fJ ) J x '" Pk-1 - Pk --,-.,-----,- Pn - 1 = - < L . a((3 - 1) axfJ - _ apfJ

Pn k_1 k (A.S)

It should be noted that, according to (A.7), Pk 2: Pk-1(1- a) for 1 :::; k :::;]yIn[ and Pk 2: Pk-1 (1 - (eyln)) for k > ]yIn[, where e is a constant. Taking into account the relation (Pk-1 - Pk) I apL1 = 1, we obtain

:::; (a(l - a)t1lvln[+nl(1 - (elvin)) = n + O( vIn).

Taking into account (A.S), we find that for (3 > 1,

1 a((3 -1) (p~-fJ - 1) :::; n + O( yin).

Hence,

Pn 2 (a((3 -l)(n + O(yIn)))l/(l-fJl.

Therefore, for n -+ 00,

Pn '" (a((3 - 1)n )l/(l-I».

8.5.15. (1) We write the equation in the form

x = lnt -lnx. (A.9)

Since t -+ 00, we can assume that t > e and, hence, x > 1. Then it follows from (A.9) that x < lnt, i.e. 1 < x < Int. Therefore, lnx = O(lnlnt). Thus x = In t + O(ln In t) for t -+ 00. Taking logarithms, we obtain

In x = In In t + In (1 + 0 (In In t I In t)) = In In t + 0 (In In t I In t).

Substituting this into (A.9), we obtain a new approximation: x = lnt -lnlnt + O(ln In t/ln t). Taking logarithms once again and substituting the result into the

Page 403: Problems and Exercises in Discrete Mathematics

396 CHAPTER 8. COMBINATORICS

right-hand side of (A.9), we obtain the next approximation providing the required accuracy (see [5]).

(2) Since t -4 00, X -4 00 as well. Therefore, eX < t or, which is the same, x < In t. Hence, eX = t - In x > t - In In t and

x> lnt + In(l-lnlnt/t)

00

= lnt - L v-1(lnlnt/W v=l

= lnt -lnlnt/t + 0((1nlnt/t)2).

U sing this relation, we obtain eX = t -lnx < t -In(1nt -lnlnt/t + 0((1nlnt/t)2))

= t -lnlnt -In(1- (lnlnt/(tlnt) + 0((1ntJ-1(1nlnt/t)2))

= t -lnln t + O(1n In t/(t lnt)).

Taking the logarithms, we obtain x < In (t - In In t + 0 (In In t / ( tln t) ) )

= lnt + In(l-lnlnt/t + 0(1nlnt/(t2Int)))

= lnt -lnlnt/t + 0((1nlnt/t)2).

The majorant and minor ant coincide with the required accuracy.

8.5.16. Hint. First prove that f(t) = o(t) for t -400. Then the initial equality can be written in the form etj(t) = t + o(t) + 0(1). Using this equality, prove that f( t) = o( 1) and transform the initial equality to etf(t) = t + 0(1). Finally, prove that

f(t) = lnt/t + 0 (~). 8.5.17. (1) We expand A(t) into simple fractions:

C1 C2 Cm A(t) = -- + -- + ... + -- + B(t),

Al - t A2 - t Am - t

where B( t) is a polynomial. In order to determine the coefficient C1 , we multiply A(t) by Al - t. Then

-Q(t) (>'l-t)A(t)=( -A) (-A) t 2 •.. t m

For t = AI, the left-hand side is equal to CI, and the right-hand side to ~9g/r

Thus, C1 = ~9gS. Similarly, we can calculate the coefficients Ci(i = 2,m). The

Page 404: Problems and Exercises in Discrete Mathematics

8.5. ASYMPTOTICS AND INEQUALITIES 397

fraction 1-:/>'k can be expanded into the geometrical series (1 - }J -1 = n~o UJ n.

We obtain m C 00 (t)n

A(t) = L Ai L :r + B(t). 1=1 1 n=O 1

Hence, for large n

(2) Let us first consider the case when P(t) has no roots other than Al and Q(t) has a power lower than of P(t) and Al is not a root of Q(t). Then

r-l P(t) = (t - AJ)r, Q(t) = Lqi.

i=O

The expansion in powers of tP-l(t) has the form

Hence

( l)r 00 r-l ( T) A(t) = Q(t)/ P(t) = - Al E (tAJ)n ~ 9i n -_ i A;.

Therefore

In the general case,

where Al(t) is a polynomial, and Q.(t) is a polynomial of degree smaller than T ••

In this case, the asymptotic value of an is determined by the coefficient of tn in the expansion of the fraction Ql(t)/(t - AJ)rl. The problem is reduced to the one considered earlier.

8.5.18. (1) 2 x 3n • Use the results of Problem 8.5.17 (1). The polynomial P1(t) = 3t2 - 4t + 1 has the roots Al = 1/3 and A2 = 1. We put Q(t) = HI + t) and P(t) = t2 - ~t + ~. Then

a rv _ Q(I/3) (~)-n-l = _ 4/9 3n +l = 2 x 3n. n P'(1/3) 3 2/3 - 4/3

(2) an rv (-fJ ar+l). The smaller (in magnitude) root of the polynomial

6t2 + 5t - 6 is 2/3. Using 8.5.17 (1), we obtain the required result.

Page 405: Problems and Exercises in Discrete Mathematics

398 CHAPTER 8. COMBINATORICS

( 1 (3)n+1) (3) an rv -13"2 .

(5) Hint. 6t4 -17t3+35t2-22t+4 = 6 (t - D (t -~) (t-l+iV3)(t-l-iV3), From this we obtain

(6) fs2n+1.

2 n a rv-3 n 31 .

(7) (-;n (V3 - 1 t n- 2. The roots of the equation t2 + 2t - 2 = 0 are A1 = V3 - 1

and A2 = - V3 - 1. Representing A( t) in the form

we find by the method of indeterminate coefficients that a = 0 and b = 1. Using 8.5.17 (2), we obtain

(8) an rv (10/7)n+2 c~n. The smallest in magnitude root of the denominator is

0.7 and has a multiplicity 2. We note that A(t) = (t~t\)2 - 2J+1' Using 8.5.17 (2), we obtain

8.5.19. (1) an rv (-3(-2)n). Let A(t) = 2:~=oantn. Multiplying both sides of the relation by tn+2 and taking the sum, we obtain A(t) - a1t - ao + 3t(A(t) - ao) + 2t2 A(t) = O. Since ao = 1 and a1 = 2, we get A(t) = (1 - t)/(2t2 + 3t + 1). The roots of the denominator are A1 = -1/2 and A2 = -1. Using 8.5.17 (1), we find that an rv (-3( _2)n).

(2) 1/2. As in 8.5.19 (1), we can write A(t) = (2(1- t))-1 + (2(1- (q - p)t)t1. Since q + p = 1 and p, q > 0, Iq - pi < 1; the roots of the denominators are A1 = 1 and A2 = q - p, IA11 < IA21. Using 8.5.17 (1) (or directly), we obtain an rv !.

(3) a = 2n +1 (sin 21rn _ sin 41rn). n y'3 3 3'

(4) an rv 3n.

(5) an rv n22n- 5 .

8.5.20 (1) Hint. If the limit of an exists and is equal to a, we have a = (a + b/a)/2 or a = Vb from the recurrence relation, since a > O. If ao = Vb, then a1 = (ao + b/ ao)/2 = (Vb + Vb)/2 = Vb. It can be easily obtained by induction

Page 406: Problems and Exercises in Discrete Mathematics

8.5. ASYMPTOTICS AND INEQUALITIES 399

that an = Vb. Let us consider the case when aD > b (the case aD < b is similar). We prove that an decreases and an > Vb for all n 2: O. If an > Vb for a certain n 2: 0, then an+l - an = ((an + b/an)/2) - an = (b - a~)/(2an) < O. Thus, an decreases with increasing n. an+l - Vb = ~(an + b/ an) - Vb = (an - Vb) 2 /(2an) > O. Consequently, an decreases and has a lower bound. This means that there exists a limit a = limn-+CXJ an. As was shown above, this limit is equal to Vb.

(2) As in 8.5.20 (1), if the limit an exists, it is equal to ijb. Let us consider the case when aD < ijb. As in 8.5.20 (1), we prove that an monotonically increases, and an < ijb for all n. Hence, it follows that there exist a limit of an. If limn-+CXJ an = a, then proceeding to the limit in the recurrence relation, we obtain a = ijb.

(3) Jf+b - l. Note that al - aD = (b - a~)/2 - aD = (-b - b2)/2 < 0 and al = (b - b2)/2 > 0, i.e. 0 < al < aD. Further,

a2 - al = (b - ai)/2 + (b + b2)/2 = (a~ - b2)/2 > 0, a2 - aD = (b - ai)/2 - b/2 = -a~ < O. Hence, al < a2 < aD. In general, an+2 - an = (a~ - a~+l) /2. By induction, we find that {a2n} increases, a2n < aD for all n 2: 1, and {a2n+l} decreases, a2n+l > al. Consequently, there exist the limits c = limn-+ CXJ a2n and d = limn-+CXJ a2n+l. Proceeding to the limit in the recurrence relation, we obtain c = (b - d)2 and d = (b- C)2. Hence, (c- d)(2 - c- d) = 0; since c < b/2 < 1/2 and d < b/2 < 1/2, we have 2 - c - d > 0; c = d. Therefore c = Jf+b - l.

8.5.21. (1) Using relations (3) and (4), we find that a3 = 9/128 and a4 :::; 11/128. For n 2: 3, inequality (4) can be written in the form

an+2 :::; 17/1024 + an(323/1024 + an). Hence, it follows that if an :::; 1/8, then an+2 :::; 1/8 for n 2: 3.

(2) Using the fact that an :::; 1/8, we derive from (4) a new inequality

Hence, by induction, an :::; 9 (~r. (3) Using 8.5.21 (2), we obtain from (A.8)

Using this inequality, we get an = 2n-I(1 + O((3/4)n)).

8.5.22. Induction on n. For n = 1, we have al = al x l. If an :::; aln, then

8.5.23. (1) Consider the relation

f(n,k+1) n-k _2k ak = = --2 .

f(n,k) k+1

Page 407: Problems and Exercises in Discrete Mathematics

400 CHAPTER 8. COMBINATORICS

If k < [log2log2 n], then ak > 1, and if k > [log2log2 n], then ak < 1. Consequently, the maximum value of f(n,k) is attained either for k = [log2Iog2n], or for k = [log2log2 n] + 1.

(2) The same result as in 8.5.23 (1).

8.5.24. Note that -\(n, r, k) = f(n, r + 1, k)1 f(n, r, k) = (k - r)22r-l I(r + 1)

and that -\(n,r,k) > 1 for k ~ r > O. Consequently, f(n,r,k) increases in r. Hence

) ( (n) -k+2k maxf(n,r,k =fn,k,k)= k 2 ,

8.5.25. (1)

{

2n+l In if g( n) '" (2n In) (1 + 2 2[log2 n)-log2(n-log2 n») if

2n-~og2 n] if

[log2 n] > log2(n -log2 n), log2(n -log2 n) ~ [log2 n]

~ log2(n -log2 n -log2log2 n), [log2 n] < log2(n -log2 n -log2log2 n).

The function f(n, k), as a function of a real argument k, is convex down, and the

minimum is attained at k = k* = log2 (n - log2 n + 0 eo~ n) ). We put ko = [log2 n]. Obviously, either g(n) = f(n, ko) or g(n) = f(n, ko - 1). In order to find g(n), we must choose the minimum value between f(n, ko) and f(n, ko - 1). Three cases are possible.

(a) log2 n ~ ko > log2(n -log2 n). Then

f(n, ko - 1) = 2n - ko +1 + 22kO -1 '" 2n+1 In,

f( n, ko) = 2n - ko + 22kO !: 2n-log2 n + 22Iog2(n-log2 n) "" 2n +1 In.

(b) log2(n -log2 n) ~ ko > log2(n -log2 n -log2log2 n). Then

Consequently, g(n) '" f(n, ko).

( c) ko < lOg2( n - lOg2 n -log2log2 n). Then

f(n, ko) = 2n - ko + 22kO "" 2n- ko '" 2n, f(n, ko - 1) ~ 2n - ko +1 > f(n, ko). n

Hence, g(n) '" f(n,ko) '" 2n- ko.

(2) g(n) "" 2n(2<>(n) + 2-<>(n»), where

{ log2 n - [log2 n] if a(n) < 1/2, a(n) '" 2n(21-<>(n) + 2<>(n)-1) if a(n) > 1/2.

Page 408: Problems and Exercises in Discrete Mathematics

8.6. ESTIMATES IN GRAPHS 401

8.6 Estimates in Graph Theory

8.6.2. (l)2m; (2) (::J 8.6.3. (2) Use the inclusion-exclusion relation.

8.6.5. (1) Make use of the fact that in a connected graph, m ~ (~) and m > n-1.

(2) A connected graph with m edges has no more than m+ 1 vertices. The number

of pairs of different vertices is hence not larger than (mil). Hence, 1fJ(m) ~ ((mr)). Then Stirling's formula should be used.

8.6.6. Note that the number of vertices in a graph does not exceed 2m. A further line of reasoning is the same as in Problem 8.6.5(2).

8.6.7. See Problems 8.6.5(2) and 8.6.6. 8.6.9. (1) The code of a tree with m edges is a binary vector of length 2m with

m unit coordinates. (2) See Problem 4.4 24. 8.6.10. Use the solution of Problem 8.6.4 and Stirling's formula. 4 5.14. See Problems 8.3.18 and 8.3.19. 8.6.16. The network r(a, b) having properties I and II is a result of substituting

the networks of the type r~, k = 1, m + 1 for the edges of the network r(a, b). The number of such networks is equal to the number of arrangements of m objects in n - 1 boxes, so that none of the boxes is empty, and is (~.=n.

8.6.17. (2) Use the solution of Problem 8.6.14. 8.6.19. If a graph is not connected, the set of its vertices can be divided into

two parts so that there are no edges connecting the vertices of the different parts. The number of vertices in one of the parts lies between 1 and [n/2]. A graph with numbered vertices is completely determined by the choice of edges. The number of edges which are forbidden is equal to k(n - k), where k is the number of vertices in one of the parts.

8.6.22. Any subgraph of the cube En is completely defined by specifying the set of its vertices. The set of vertices of a connected subgraph is defined by specifying its certain spanning set (i.e. the tree containing all the vertices). In order to specify the tree which is a subgraph of the cube En, we can choose any vertex of the cube belonging to the tree (there are no more than 2n ways of doing so) and a tree with k vertices (there are no more than 4k - l ways of doing so). For each edge of a tree, its direction as that of an edge of the cube En can be specified in no more than n ways. Hence, we obtain the required estimate.

8.6.26.

8.6.29.

8.6.31. Let 8(n) be a part of graphs for which p(G) ~ 1. In view of inequality (1), we have a(n) ~ -p(n) --t 0 as n --t 00. Hence, we obtain the result.

Page 409: Problems and Exercises in Discrete Mathematics

402 CHAPTER 8. COMBINATORICS

8.6.32. (2) Z(f(I<2,3), iI, i 2, i3, i 4 , is) = 2~3!(ii + i2)(ii + 3il i 2 + 2i3)' 8.6.33. (1) Let us consider an arbitrary permutation al a2 ... an of numbers of

the set {I, 2, ... , n} and arrange the parentheses in it so as to obtain a substitution with a cyclic structure (j) = (jl, i2, ... , jn). First, we have jl cycles of length I, then j2 cycles of length 2, and so on (i.e. the substitution has the following form:

Let us now assume that two substitutions 7rl and 7r2 with a cyclic structure (j)

are constructed from two different permutations of elements of the set {I, 2, ... , n} in the way described above. When does 7rl coincide with 7r2? The coincidence is possible for two reasons: (1) identical cycles in the substitutions 7rl and 7r2 are in different positions, (2) although the cycles are identical (as cycles of a substitution), in the above construction, they start with the different elements (say, (123) and (231)). The first reason leads to a repetition of the same substitution ilk=l jk! times, while the second reason to a repetition ilk=l kjk times, the reasons being mutually independent.

( 4) The proof can be carried out by induction on n using the relations from parts (1) and (2) of this problem.

8.6.34. Use the following obvious fact: a cycle is an even substitution if and only if its length is odd.

8.6.36. This follows from the Polya theorem. 8.6.37. Interpret the coefficients of the binomiai 1 + x appropriately and use

the Polya theorem. 8.6.40. Associate each graph with a tuple of connected graphs, i.e. the tuple of

all its connective components. Then apply the Polya theorem. 8.6.42. Any tournament is uniquely determined by its condensation with

numbered vertices and the tuple of strong components. The numbering of the vertices is required only for associating them with the corresponding strong compo­nents of the tournament.

Page 410: Problems and Exercises in Discrete Mathematics

Chapter 9

Boolean Minimization

9.1 Faces of the n-cube. Covers and tests for tables

9.1.2. (1) If the set {il, ... ,i 2 } is fixed, then the number of the faces B~;~~.'::;,':k is equal to the number of binary tuples (O"l, ... , O"k), which is equal to 2k.

(2) If Ci E Bn,il, ... ,ik n Bn,i1, ... ,ik then 0"1 = T1 ... O"k = Tk. Hence the faces Ul,,,·,CTk 1"1,···,1"k ' , , ,

coincide. We arrive at a contradiction. (3) It follows from (1) and (2) and from the consideration that IB~;:~.':,~';k I = 2n-k.

(4) The direction {i1, ... ik} can be chosen in (~) ways. The statement now follows from (1).

(5) Follows from (4). (6) If Ci = B~;~~::,~'~k, then the vector (O"l, ... ,O"k) is single-valued by the vector Ii

and the set {iI,"" id. The set {il, ... ,id can be chosen in (~) ways. (7) The code of the k-dimensional face e containing the given I-dimensional face

H obtained from the code of the face H by arranging k - I hypens among n - I coordinates, whose values are ° or 1.

(8) Consider an operation 0 for the symbols a and {3 from the set {a, 1, -} such as: ao{3 = a, if a = {3; aop = a, (ao{3 = (3), if a E {a, I}; {3 = - (accordingly, if p E {a, I}; a = -), a value a 0 {3 is indeterminate if a # {3 and a, {3 E {a, I}. The natural way operation 0 propagates to the vectors from en. It easy to show that if Ii and ~ are codes of the faces F and e, then the vector Ii 0 ~ is defined iff F n H # 0. In the last case, Ci 0 ~ is the code of the face which coincides with F n H.

(9) Follows from (7).

9.1.4. Put Ii = n - ni. Then the numbers Ii satisfy the MacMillan inequality L1 <i<s 2-1, :5 1. Then there exists a prefix binary code C = {WI, W2, •.. ,Ws with the lengths of code words h, 12, . .. ,Is. Let us add to each code word Wi n - Ii hypens as the last n - Ii coordinats. Then each of such Wi may be considered as a code of the (n - li)-dimensional face. The faces are pairwise non-intersecting because C is a prefix code.

9.1.5. (1) Consider a set of all intervals I(ii,~) such as ii E B&'/3]' ~ E B~_[n/3]'

403

Page 411: Problems and Exercises in Discrete Mathematics

404 CHAPTER 9. BOOLEAN MINIMIZATION

Then there exists (n[!iltl) vertex ~ E B~_[n/3] such as 0 :::; ~ for each vertex

o E B~/3] from ([n/3]) vertex. Then the number of intervals 1(0, ~), which equal

the number of such pairs (0, ih is (([ni3117~.[n/3]) It is easy to see that all of them

are pairwise incomparable. (2) Analogous to Problem 2.5.19 (1) from Chapter 2.

9.1.6. (1) 2. (2) 3. (3) 2. (4) 3. (5) 2. (6) 3.

9.1.7. (1) 2. (2) 4. (3) 3. (4) 3. (5) 2. (6) 3.

9.1.8. (1) 2. (2) 1. (3) 1. (4) 2. (5) 5. (6) 4.

9.1.9. (1) 2. (2) 1. (3) 3. (4) 5. (5) 5. (6) 4.

9.1.10. Consider the matrix (Pk-1/n-k+I) such as Pk- l is an (n - k + 1) x (k - I)-dimensional matrix, the elements of which are equal to 1, and In-k+l is the (n - k + 1) x (n - k + 1 )-dimensional unit matrix.

9.1.11. Let A be the set of basis vectors of a linear (n,k)-code. Then IAI = k and A is the covering. The last statement follows from the next consideration. Let the element (i, I) of the matrix A be equal to 1. The row number i is the linear combination of the basis rows. Then there exists a basis vector, the j-th coordinate of which is equal to 1.

9.1.12*. (1) Let Rk be the set of all subsets with k elements of the rows of the matrix M. By v(P) for PERk denote the number of columns which are not covered by the rows from P. Let ilk = (7) LPERk v(P) be the average number of columns non-covered by a subset from Rk • Let V be the set of columns of the matrix M, p( v) be the number of PERk which do not cover the column v and let 0"( v) be the number of rows, covering the column v. Then

It is clear that ~(M) :::; k + ilk, for each natural k. Put k = 1 r;-ln r;- [, then we get

m esn ~(M):::; 1 + -In-.

s m

9.1.13*. Similarly, as for Problem 9.1.12, prove that

b'k:::;f+(I-f)(I- ~r :::;f+e-sk/ m .

Put k = 1 r;-ln ;; [ in inequality LdM) :::; k+nb'k' then we get the required inequality.

9.1.14. At the first step of the greedy procedure, we include in the cover a row, which covers no less than nip columns. Since, no more than n (1 -~) columns will be non-covered. If Ak is the set of columns non-covered after k steps, and

I Ak I :::; n (1 - ~ r, then, at the (k + 1)-th step, at least one of the rows covers no

Page 412: Problems and Exercises in Discrete Mathematics

9.1. FACES, COVERS, AND TESTS 405

less than IAkl /p columns. Therefore, IAk+11 ::; IAkl (1-~) ::; n (1 - ~)k+1 . Hence,

IAkl ::; n (1 - ~t . For each natural k, we have Lr(P) ::; k + IAkl ::; k + n(1 _ ~)k. (Here, we use the the assumption that the matrix does not contain empty columns.)

Putting k = 1 (In ~) /In (1 - ~) [ in the last inequality, we get the statement.

9.1.15. ~ = ~ (log 2 (~ + 1) ) . 9.1.16. The set N = {a E Bn : Iiall, n is even} is (n, I)-picked and INI = 2n- 1 .

Prove that L(n, 1) :::: 2n - 1 • Taking into account Problem 9.1.2 (2), the n - cube can be decomposed into 2n - 1 l-dimensional faces of one direction. Each of them contain the vertex of (n, 1 )-picked set.

(2) The minorant is obvious. On another side, N = {O, I} is (n, n - l)-picked.

(3) (V.V. Glagolev) Hint. Consider N = {a E Bn : Iiall == 0 (mod 3)} or N1 = {a E Bn : v(a) == 3 (mod 4)}.

(4) (O.B. Lupanov) Minorization. It should be noted that a vertex a = (aI, ... ,an) contained in the (n - 2)-dimensional face with a code ::y = b1,' .. "n) where is ,i"j E {O,l} if ai = Ii, aj = Ij. Let N ~ Bn be a (n,n - 2)-picked set and INI = m. Let us consider a matrix M whose rows are the vectors from N. The above remark implies that, for each pair (i,j), 1 ::; i < j ::; n and each pair (0',7),0',7 E {O,l}, there exists a row a = (a1, ... ,an ) such that ai = 0', aj = 7.

Hence, any two columns of the matrix M are pairwise incomparable. The number

of pairwise incomparable binary sets of length m does not exceed (m/2)' Hence,

(~/2) :::: n.

Majorization. Let m be the minimum integer such that (m/2) :::: n. We construct a binary matrix M with m rows and n pairwise incomparable columns. We add the rows 0 and I to the matrix M. Then the set of rows of the obtaining matrix will be (n, n - 2)-picked.

(5) Follows from the statement that the set N = U\~o(k+1)] B(k+1)i is (n, k )-picked.

(6) If N is (n, k)-picked and G is the r-dimensional face of Bn then N n G is (n, k)-picked. From this statement and from 1.2 follows the required inequality.

(7) The inequality follows from Problem 9.1.12 if we put m:= 2n, s:= 2k, n := (:) 2n-k.

9.1.17. (1) l + 1.

(2) Put ~(Mn,k,t) = f1.n,k,l. The statement now follows from the fact that kf1.n,k,1 ::::

nf1.n-1,k-1,1-1, where f1.n,k,1 is an integer and f1.n-I+1,k-I+1,l = l(n -l + 1)/(k -l + 1)[.

(3) It is obvious that ~(Mn,n-k,l) > l because for any choice of vectors a1,"" al

from B~_k' there exists a vector ~ E Bl that is not covered by no one from the l chosen vectors. It may be done by the choice one zero-coordinate from each of the vectors 01, ... ,al and put 1 in those coordinates in the vector ~. If, in the chosen 1+1 vectors from B~_k' the sets of zero-coordinates will be pairwise non-intersecting, then all vectors from Bi will be covered.

Page 413: Problems and Exercises in Discrete Mathematics

406 CHAPTER 9. BOOLEAN MINIMIZATION

( 4) The minorant follows from the size considerations: the number of covered columns is (7) and each row covers (~) columns. The majorant follows from 9.1.12.

(5) Majorization. Let n = q(l- 1) + r, 0 ~ r ~ 1- 2. Decompose n coordinates in the I - 1 blocks so that the difference in size of any two blocks does not exceed 1. There are r blocks of size q + 1 and 1- 1 - r blocks of size q. For each pair of coordinates of any of these blocks, choose a vector from B~_2 which has 0 in these

coordinates. The size of the set P of such vectors is r (q~l) + (/-1- r) (~). Show that,

for each a from B~_l' there exists fi from P such that a < fi. Indeed, the number of zeros in a is I and the number of blocks is 1 - 1, hence some block contains some two zero coordinates. The set P contains a vector fi with zeros in these coordinates. It is clear that a < fi.

9.1.19. (1) 2. (2) 2. (3) 4. (4) 3. (5) 3. (6) 3.

9.1.20. (1) n. (2) n - 1. (3) n - 1. (4) n.

9.1.21. Hint. Two columns of the matrix M different in row j iff row j of the matrix M(2) covers a sum modulo 2 of these columns.

9.1.22. (1), (4), (5), (7) Yes. (2), (3), (6), (8), (9) Generally, not.

9.1.23. If the matrix contains less than log 2n rows, then the number of the pairwise independent columns is less than n.

9.1.24. Let A and B be irredundant tests for the matrix M with m rows. Hence, none of the implications A C B, B C A does not have a place. Hence, the number of tests is no more than the number of pairwise incomparable sets in Bn and, therefore, is no more than ([mi2])'

9.1.25. The number of k x n-dimensional matrix with pairwise different columns is equal to 2k(2k + 1) ... (2k - n + 1). The number of m x n-dimensional matrices with a given fixed k rows is equal to 2n(m-k).

9.1.26. (1) {1,2}, {1,4}, {2,3}, {3,4}.

(2) {1,2,3}, {1,2,4}, {1,3,4}.

9.1.27. (A. S. Kospanov). If the distance between any two columns of the matrix M with pairwise independent columns is not less than d, then each column of the matrix M(2) contains no less than d units. The statement now follows from Problems 9.1.21 and 9.1.12.

9.2 Constructing of the Reduced DNF Methods

9.2.1. (1) Xl,X2X3.

(2) XIX2.

(3) X2X3, XIX2X4.

Page 414: Problems and Exercises in Discrete Mathematics

9.2. CONSTRUCTING OF THE REDUCED DNF

(4) Xl.

9.2.2. (1) After using the generalized pasting, we obtain DI = XIX2 V XIX2 X 4 V X2 X 3 X 4 V X 2 X 4 V XIX3 X 4 V X IX3 X 4 V X 3 X 4'

After using the absorption, we get D2 = XIX2 V X 2X 4 VX3X4.

(2) XIX2X3 V XIX2 X 4 V X IX2 X 4 V X IX3 X 4 V X 2X 3X 4'

(3) Xl V X2 V X3 V X4·

(4) X3X4 VX2X3X4 V XIX2 X 4 V X IX2 X 3 V XIX2 X 3 V XIX2 X 4'

(5) DVXIX3VX3X4VX2X3VXIX2X4'

9.2.3. (1) XIX3 V XIX2X3·

(4) Xl VX2X3'

(5) XIX2 VXIX2X3.

(6) XIX2 VXIX2 V X2X3 V X 2 X 3 V XIX3 V X IX3.

(7) XIX2X3 VXIX2X3.

(8) XIX2X3 V XIX2 X 4 V XIX3X 4·

9.2.4. (1) XIX3 VXIX2 V X 2 X 3 V X2X3·

(2) X2X3 VX2X3 V XIX2 V XIX3 V X IX2 V XIX3·

(3) Xl V X2X3·

(4) XIX2 VXIX3 VX2X3·

(5) XIX2 V X2 X 3 V X3 X 4 V XIX3 X 4 V XIX2 X 3 V XIX2 X 4·

(6) Xl X2 V Xl X2 V Xl X3 X 4 V X2 X 3 X 4 V X2 X 3X 4 V Xl X3 X 4·

9.2.5. (1) Xl VX2X3.

(2) XIX3 V X2 X 3 V XIX2·

(3) XIX2 VXIX3 V X2 X 3 V XIX2·

(4) XIX2 VXIX3 V X2 X 3 V XIX3 V X IX3 V X 2X 3.

(5) XIX2 VXIX3X4 V X2 X 3X 4 V XIX2X 3 V XIX3 X 4 V X 2X 3X 4.

(6) XIX2 V XIX3 V XIX4 V X2 X 3 V X2 X 4 V X IX3 X 4'

9.2.6. (1) X3 V XIX2·

(2) XIX2 VXIX3 VX2X3 V XIX3 V XIX2 V X2 X 3·

(3) XIX3 VXIX2.

(4) Xl VX2 VX3.

(5) X2X4 V XIX3 V X3 X 4 V X2 X 3 V XIX4 V XIX2·

(6) X2X3 V X2 X 3 V X3 X 4 V XIX2 V XIX3 V XIX4·

9.2.7. (1) X2 V X3·

(2) X2 V X IX3 V XIX3·

(3) Xl V X2 X 3·

(4) X2 VXIX3'

(5) X3X4 VXIX4 VXIX3 V XIX3 V XIX4 V X 2X 3 V X3X 4'

9.2.8. (1) X3, XIX2'

(2) There are no core implicants. (3) XIX3, XIX2·

407

Page 415: Problems and Exercises in Discrete Mathematics

408

(4) X}, X2, X3.

(5) X2X4 V XIX3, X3 X4·

(6) X2X3, X2X3'

CHAPTER 9. BOOLEAN MINIMIZATION

9.2.9. (1) 2n- l • (2) 2n- l • (3) 6· 2n- 4 • (4) 2n- 2 •

(5) k + (n - k)(n - k -1). (6) k(n - k). (7) 2. (8) n(n - 1). (9) 2n.

9.2.10. (1) (n;;;k). (2) G)n -lk + m -1. (3) Follows from (1). ( 4) Follows from the fact that

min (k!)(n - k - m)!m! = ([nI3)!)2(n - [nI3))!. O$k,m$n

9.2.11. Each interval of the function fis a one-value defined by any given pair of contrary points in this interval. Obviously, the set Nj contains these points. Hence, the number of maximal intervals is no more than the number of non-ordered pairs of vertex (may be coincided) from the set N j .

9.2.12. (1) 2n - l . (2) 2n- 3 . (3) O. (4) k(n - k). Hint. A lower unity in any maximal interval of the monotonic

function is an eigen point of the interval, which contains this unity. (5) 2n - 2 • Hint. Use 9.1.9.(5) and the fact that all intervals are O-dimensional. (6) k. (7) 2. Observe, that f = Xl'" Xn VXI ... Xn . (9) 2n.

9.2.13. Choose one eigen point for each core implicant of the function f(xn ).

Consider all edges of the cube Bn with some direction. No one edge contains two marked eigen points. The statement now follows from this fact.

9.3 Irredundant, Minimal, and Shortest DNFs

9.3.1. (l)(a) no; (b) yes; (c) no. (2)(a) no; (b) no; (c) no. 9.3.3. (1) DEr = xyVxz. (2) Dr,r = D. 9.3.7. (1) r(f) = p.(f) = 1. (2) r(f) = 52n-\ p.(f) = 2n -4. (4) r(f) = 58,

p.(f) = 6. 9.3.8. Hint. The valuation follows from the facts that the number of elementary

conjunctions above variables Xl,' .. ,Xn is 3n , the length of an irredundant d.n.f. is not more than 2n and, in an irredundant d.n.f., there are no conjunctions which absorb other conjunctions.

9.3.9. Hint. Majorant is by induction. 9.3.11. (1) 2. (2) 2n.

9.3.12. (3) Hint. See Problem 8.5.17. 9.3.13. 2n In.

Page 416: Problems and Exercises in Discrete Mathematics

Chapter 10

Logical Design

10.1 Circuits of Logical Elements

ID.1.1. (a) 11 = XlX2, 12 = Xl rv X2·

(b) h = XlX2 EB X2 X3 EB X3 Xl, 12 = Xl EB X2 EB X3· (c) h = Xl V X2 V X3, 12 = XlX2 X3·

10.1.3. (1) ((Xl I X2) I (X2 I X2)) I (Xl I X2).

(2) (Xl -t X2) -t (Xl -t X2).

(3) ((x21 X2) 1 xt) 1 ((x21 X2) 1 xt). (4) Xl&X2.

(5) (Xl I Xt}(X2 I X2). (6) ((x&y) rv x) rv y.

10.1.4. (1) X2 V Xl·

(2) X2 I (Xl I Xl). (3) (Xl -t X2)&(X2 -t xd. (4) ((Xl 1 Xl) 1 X2) 1 ((x21 X2) 1 Xl). (5) (a) ((Xl I X2) I X3) I ((Xl I X2) I X3). (6) XlX2X3 EEl (Xl EB 1)(x2 EB 1)(x3 EB 1).

10.1.5. Hint. (1) 1= X2 VXlX3. (2) 1= XlX2 V X2X3 V X3Xl· (3) 1= X3(XI V X2) VXl(X2 V X3). (4) I = (Xl VX2)(X2 VX3).

ID.1. 7.Hint. (1) 1= X2 X3 V XlX2X3·

(2) 1= XlX2 V X2X3 V X3Xl· (3) I = Xl V X2 X3·

10.1.8. The statement follows from that fact that after replacing all V on & and all & on V in CLE E, we obtain the circuit E*, which represents the dual function

J*. 10.1.15. (2) The statement follows from the representations

sk,m(xn) = sk,n(xn)&so,m(xn) and sO,m(xn) = Sn-m,n(xn).

409

Page 417: Problems and Exercises in Discrete Mathematics

410 CHAPTER 10. LOGICAL DESIGN

10.1.16. Note that the functions Sk,3(x3) (k = 0, ... ,3) are monotonic and may be represented by circuit which does not contain negations. First, show that the set of all circuits such as Sk,k(x3) (k = 0, ... ,3) may be represented with the help of two negations. We have SO,1(x3) = S2,3(x3), Sl,1(X3) = SO,1(X3)&Sl,3(x3).

Put 1,,(x3) = Xl EI1 X2 EI1 X3 EI1 <7. Then we obtain 10(x3) = Sl,1(X3) U S3,3(X3), Il(X3) = 10(x3), S2,2(X3) = 11(X3)&S2,3(x3), SO,0(x3) = h(x3)&SO,1(X3). Now any conjunctions such as X"lX"2X"3 may be constructed from the functions Sk,k(x3)

and elementary monotonic conjunctions without using the negations. For example, XlX2X3 = Sl,1(X3)& Xl, XlX2X3 = S2,2(X3)& X2X3. Having all elementary conjunctions of rank 3, we can construct the functions Xi (i = 1,2,3) by using only disjunctions. For example, Xl = XlX2X3 VXlX2X3 VXlX2X3 VXlX2X3.

10.1.17. Figure 10.2 (c) and Problem 10.1.8 show that L(x EI1 y) ::; 4. The inequality L( X EI1 y) ::; 4 follows from the next considerations. The function I = X EEl y is a non-monotonic function, therefore it cannot be represented without using the negations. In a minimal circuit ~ f representing J, the negation cannot be on the output of the circuit, otherwise the function represented in a vertex preceding output will be 1 = 1* ,. Then using the result of Problem 10.1.8, we obtain that the circuit ~f is not minimal. Hence, the output of the circuit ~f coincides with the output of V or &. Denote this element by o. Then I = it 012, where 11 and 12 represented in the vertices of the circuit ~ 1> which precede the output. None of these functions are one-placed because function f is different from the functions x" V h, x" &h. Besides, it =I- 12 because f is not equal to a constant. Therefore, the circuit ~ f must contain at least two more two-placed elements.

10.1.19. Prove by induction on 1.

10.1.20. Hint. Consider a circuit ~f with the depth 1 and representing the function f = Xl V· .. V X/+l.

10.1.21. The statement follows from 10.1.19 and from the fact that the complexity of a CLE representing the function, which depends essentially on all its variables, is not less n - 1.

10.2 Contact Circuits

10.2.1. (a) f = Xl EI1 X2 = XlX2 VX lX2.

(b) f = XlX4 V XlX3 XS V X2 X3X4 V X2 X5·

(c) I = (Xl V X2)(Xl VX2) = Xl EI1 X2· ( d) f = Xl EI1 X2 EI1 X3 EI1 1. (e) XIX2 V X2(X3 X2 V X3 X2) VXlX2.

(f) 1= XIX2 V X2 X3 V X3Xl·

10.2.4. Hint. Represent the function fby a formula in the basis {V, &, -}. If the number of letters is equal to I, then construct the circuit by a formula. If the number of letters is more than I and the formula is not simplified, then represent the

Page 418: Problems and Exercises in Discrete Mathematics

10.2. CONTACT CIRCUITS 411

subformulas by circuits and try to combine these pieces so that there are no "false" chains in the common circuit:

(1) j = XlX2X3 V Xl(X2 VX3)'

(2) j = X2 VXlX3.

(3) j = X2(Xl VX3) VXlX3.

(4) j = Xl(X2 V X3) V X2(X2 V X3).

(5) j = X2(Xl V X3) V XlX3·

10.2.5. (1) j = (Xl V X2 X3)(X2 V X4)'

(2) j = Xl V X2 V X3 V X4·

(3) j=Xl.

(4) j = (Xl VX2)(X4 VX6)(XS V X7)'

(5) j=XlVX2VX3VX4.

(6) j = XlX2 V XlX3 V XlX4 V X2 X3 V X2 X4 V X3X4'

10.2.7. (1) j=XlX2",XnVXlX2",Xn'

(2) j = XlX2".Xn-lXn'

(3) j = Xl Ell X2 @ ... Ell Xn·

(4) j = (Xl, ... ,Xn,Yl, ... ,Yn) = Pn, where PI = Xl V Yl, Pk+l = XkYk V Pk(Xk VYk).

Note that Pn realizes a carry to the (n + 1 )-th digit function in the binary adder.

(5) j(x2n) = &1~i~n(X2n-l rv X2n)'

10.2.10. (3) For each function of the system, identify the outputs of D~ corresponding to the elementary conjunctions belonging to its perfect d.n.f. From orthogonality, it follows that no conjunction belongs to more than one perfect d.n.f.

10.2.12. (2) Prove the statement by induction on n. It is easy to see that L( Un = 2 < 2 . 221. By the induction hypothesis, there exists a circuit for U:_ 1 ,

whose complexity does not exceed 2 X 22n- l• All functions for which Xn is an

unessential variable are realized by U:_ 1 • If a function j depends essentially on X n ,

then it may be represented as j = xng V xnh, where 9 and h are different functions of the variables XI, ... , Xn-l. Divide all such functions into two non-intersecting sets. In the case when exactly one of these functions (g or h) is equal to zero, we put j E 1<1, otherwise j E 1<2. For each function j essentially depending on Xn, add to the circuit U:_ 1 the vertex Vi' If j E 1<1 and j = xng (f = xnh), then connect the vertex Vg (Vh) of the circuit U:_ 1 in which the corresponding function is realized with a new vertex Vi by a contact Xn (Xn). If j E 1<2 and j = xng + xnh, then connect the vertices Vg and Vh of the circuit U:_ l with the vertex Vi by the contacts X and

X, respectively. Hence, we add 11<11 + 211<21 contacts. Note that 11<11 = 2· 22n- 1 - 2

and 11<11 + 11<21 = 22n - 22n - l• The last equality follows from the fact that 1<1 u 1<2

consists of the functions depedning on Xn essentially. Obviously, such an addition does not introduce the chains of non-zero conductivity into the circuit U:_ l and, therefore, does not change the functions realized by U:_ l . It is also obvious that, in the new vertex, a function from 1<1 U 1<2 corresponding to this vertex is realized.

Page 419: Problems and Exercises in Discrete Mathematics

412 CHAPTER 10. LOGICAL DESIGN

Hence, we have constructed a circuit for U~. Estimate the complexity of this circuit. We have

(3) Putting m = [log 2(n - 2 log 2n)], we obtain for large n and an arbitrary f > 0

2n+2 2n+I 2n+2 -----,---- + - < (1 + f)-. nlog2(n - 2 log 2n) n2 - n

10.2.17. (1) A circuit for Uf may be obtained with the help of the cascade method. This is a circuit of complexity 2. Suppose that the circuit I;n-l for U~_l obtained by the cascade method contains no more than 2 X 22n- 1 contacts. Let I;n

be the circuit for U~ and Vn be a set of vertices of this circuit. A vertex vI from Vn corresponding to a function f(xn ) that does not depend on Xn , are contained also in Vn - 1 . Let K 1 and K 2 be classes of functions depending essentially on n variables and denoted in the solution of Problem 10.2.12 (2). According to the cascade method, each vertex v from Kl is connected by a single contact with some vertex of I;n-l (the other contact connects v with the vertex corresponding to 0, is removed). Each vertex v in K2 is connected with two various vertices K2 by a contact with each of them. The further reasonings repeat the proof of Problem 10.2.12 (2).

10.2.18. The statement follows by induction with regard to the following considerations. Let I;n be (1, 2n)-pole network constructed by the cascade method and realizing all conjunctions of rank n. Let v be the output realizing the conjunction K x~, where ]{ is some conjunction depending essentially on the variables XI, ... , Xn-l. In I;n constructed by the cascade method, the vertex v is connected by a single contact x~ with some vertex u realizing K. This follows that the circuit I;~ obtained from I;n by removing all contacts x~, is realized all conjunctions of rank n - 1. By the induction hypothesis, I;~ has 2n - 2 contacts marked by the variables XI, . .. ,Xn-l and their negations. The number contacts of the type x~ is equal to the number of outputs, which equals 2n. The statement follows.

10.2.19. Consider the circuit for D~ obtained by the cascade method. The number of edges that come out of each vertex v from the i-th level is equal to 2 if o :::; i < n - 2. If i = n - 1, then only one edge comes out from each of the vertices. The statement follows.

10.2.21. For example, let a circuit I; be a series junction of a two-pole circuit A and a contact x. Transform the circuit I; by deleting all contacts x and contracting to a point each contact X in A. Obviously, that the conductivity function of a new circuit coincides with the previous and the number of contacts becomes less.

Page 420: Problems and Exercises in Discrete Mathematics

10.2. CONTACT CIRCUITS 413

10.2.22. If the circuit E j is not strongly connected, then it has a twig. Obviously, we do not change the conductivity function by deleting a twig. Then E j cannot be minimal.

10.2.25. Lk(x EEl y) ::; 4 follows from the fact that there exists a circuit of complexity 4 that represents x EB y (see Problem 10.2.1). Assume that the minimal circuit for the function x EB y contains less than 4 contacts. By the statement of Problem 10.2.23, this circuit cannot have exactly three contacts. Each minimal circuit with two contacts realizes either a function of the type xO!yf3 or a function of the type xO! V yf3.

10.2.26. Let xf be a letter encountered in the repetition-free circuit E as a label of a contact. Since E is strongly connected, then there exists a chain joining the poles a and b of the circuit E and containing the contact xf. Let us fix the values (12, ... ,(1n of the variables different from Xl so that all contacts of the chain except xf are connected and all contacts not contained in the chain are disconnected. Hence, !a,b( Xl, (12, ... ,(1n) = xO!. Therefore, the conductivity function !a,b essentially depends on the variable Xl.

10.2.27. The statement follows from the fact that for any n there exists a strongly connected without repetition circuit with n contacts.

10.2.32. A arbitrary contact circuit with seven edges stays planar after addition of a pole edge since each graph with eight edges is planar. Since for any such circuit, the dual circuit is defined and has the same complexity, it follows that Lk(f) = Lk(f*).

The second inequality follows from the fact that T(xI,"" Xn) = 1*(Xl,"" Xn).

10.2.33. The statement follows from the fact that any 1r-circuit is planar and stays planar after the addition of a pole edge.

10.2.34. The circuit E in Figure 10.12 has the sets {x, y}, {r, w}, {x, r, v, z} and {x, w, t, u} among its cuts. Then if there exists a circuit repetition-free El realizing the function 1*, it contains chains with conductivities xy, rw, xrvz, xwtu. Without any loss of generality, we can assume that the contact x adjoins the pole a of the network El . Then either contact r or contact w also adjoins this pole. In the former case, El does not contain the chain xrvz, and in the latter, xwtu.

10.2.35. No,itisnot. MakeuseofthefactthatJ(xl' ... , xn) = 1*(Xl, ... , xn) and the result of Problem 10.2.34.

10.2.37. Let H(k) be the number of connected two-pole networks with kedges. Each of the considered contact circuits may be obtained from some two-pole network by labelling each edge by one ofthe 2n symbols Xl, ... , Xn, Xl, ... ,xn- Since H (k) ::; (ck)k, then

m m

S(n, m) ::; L H(k)(2n)k ::; L(ck/(2n/ ::; (c'mn)m. k=O k=O

10.2.39. (0. B. Lupanov) Each formula which contains k symbols of variables has k-1 connectivities & and V , and it also has no more than k - 1 left and not

Page 421: Problems and Exercises in Discrete Mathematics

414 CHAPTER 10. LOGICAL DESIGN

more than k - 1 right parentheses. The general number of symbols does not exceed 4k - 3. Hence, any such formula is the word with a length not exceeding 4k - 3 in the alphabet {( ,), V, &} u X n, xn = {Xl,' .. ,Xn, Xl, . .. ,xn} and the number of letters in the xn is k. The number of words of length s which contains k letters from the alphabet A and s-k letters from the alphabet B does not exceed C: IAlk IBI"-k . Hence,

<I>(n,m):::; L C:k_3(2n)k43k-3:::; (cn)m. k-:!,m

10.2.41. (1), (2) Using the result of the previous problem, we have for n -t 00

Hence, follows (2) and (1).

10.2.42. 1) The number of the self-dual functions f(xn) is equal to 22n - l • Using Problem 10.2.37, we have

log 2S (n, 2n;1 (1- t)) :::; 2nn-

1 (1- t)log2(c, 2n-I(1_ t))

= 2n - I (1-t)(1 + O(n-l)) < 2n - l . Hence, follows the statement.

2) Using Problem 10.2.38, we have for n -t 00

Page 422: Problems and Exercises in Discrete Mathematics

Bibliography

[1] Z. V. Alferova, Theory of Algorithms (in Russian), Statistika, Moscow, 1973.

[2] M. Arbib, Brains, Machines and Mathematics, McGraw-Hill, New York, 1965.

[3] C. Berge, Thiorie des graphes et ses applications, Paris, 1958.

[4] N. L. Biggs, Discrete Mathematics, Clarendon Press, Oxford, 1989.

[5] N. G. de Bruijn, Asymptotic Methods in Analysis, North-Holland, Amsterdam, 1958.

[6] N. Christofides, Graph Theory: Algorithmic Approach, London, 1975.

[7] Discrete Mathematics and Mathematical Problems in Cybernetics, Vol. 1, (eds. S. V. Yablonsky, O. B. Lupanov), (in Russian), Nauka, Moscow, 1974.

[8] P. Erdos, J. Spencer, Probabilistic Methods in Combinatorics, Akademiai Kiado, Budapest, 1974.

[9] W. Feller, Introduction to Probability Theory and its Applications, Vols. 1-2, J. Wiley, New York, 1968-1971.

[10] G. P. Gavrilov, A. A. Sapozhenko, Collection of Problems and Exercises in Discrete Mathematics, Part I and Part II (in Russian), Moscow State Univ. Publishers, 1974.

[11] G. P. Gavrilov, A. A. Sapozhenko, Collection of Problems m Discrete Mathematics (in Russian), Nauka, Moscow, 1977.

[12] G. P. Gavrilov, A. A. Sapozhenko, Problems and Exercises on the Course of Discrete Mathematics (in Russian), Nauka, Moscow, 1992.

[13] G. P. Gavrilov, A. A. Sapozhenko, Problemas de Matematica Discreta (in Spannish), Mir, Moscow, 1980.

[14] G. P. Gavrilov, A. A. Szapozsenko, Disceret Matematikai feladatgyiijtemeny (in Hungarian), Miiszaki Konyvkiad6, Budapest, 1981.

[15] G. P. Gavrilov, A. A. Sapozhenko, Selected Problems in Discrete Mathematics (in English), Mir, Moscow, 1989.

415

Page 423: Problems and Exercises in Discrete Mathematics

416 BIBLIOGRAPHY

[16) G. P. Gavrilov, Functional Systems in Discrete Mathematics, Part I and Part II (in Russian), Moscow State Univ. Publishers, 1985.

[17) S. G. Guindikin, Algebra of Logic in Exercises, Nauka, Moscow, 1972.

[18) M. Hall, Combinatorial Theory, Blaisdell Publ. Co., Waltham, Mass., 1967.

[19] F. Harary, Graph Theory, Addison-Wesley, London, 1969.

[20] J. E. Hopcroft, J. D. Ullman, Introduction to Automata Theory, Addison­Wesley, New-York, 1979.

[21] R. Johnsonbaugh, Discrete Mathematics, New York, London, 1984.

[22] J. G. Kemeny, J. L. Snell, and G. L. Thompson, Introduction to Finite Mathematics, Prentice-Hall, Englewood Cliffs, 1957.

[23] N. E. Kobrinsky, B. A. Trakhtenbrot, Introduction to Theory of Finite Automata (in Russian), Fizmatgiz, Moscow, 1962.

[24] V. B. Kudriavtsev, S. V. Aleshin, A. S. Podkolzin, Introduction to Automata Theory (in Russian), Nauka, Moscow, 1985.

[25] I. A. Lavrov, L. L. Maksimova, Problems in Set Theory, Mathematical Logics, and Algorithm Theory (in Russian), Nauka, Moscow, 1984.

[26] L. Lovasz, Combinatorial Problems and Exercises, 2nd edition, Akademiai Kiado, Budapest, 1993.

[27] A. I. Mal'tsev, Algorithms and Recursive Functions (in Russian), Nauka, Moscow, 1986.

[28] A. A. Markov, Introduction to Coding Theory (in Russian), (in Russian), Nauka, Moscow, 1982.

[29] H. F. Mattson, Discrete Mathematics and Applications, J. Wiley, New-York, 1993.

[30] M. Minsky, Computation: Finite and Infinite Machines, Prentice-Hall, Englewood Cliffs, 1967.

[31] O. Nicodemi, Discrete Mathematics, West Publ. Comp., New-York, 1987.

[32] O. Ore, Theory of Graphs, American Math. Soc., Providence, 1962.

[33] Y. Peterson, E. Weldon, Error Correcting Codes, M.I.T. Press, Cambridge, Mass., 1972.

[34] J. Riordan, An Introduction in Combinatorial Analysis, J. Wiley, New York, 1958.

Page 424: Problems and Exercises in Discrete Mathematics

BIBLIOGRAPHY 417

[35] H. Rogers, Theory of Recursive Functions and Effective Computability, McGraw-Hill Book Company, MIT, 1967.

[36] K. A. Rybnikov (ed.), Combinatorial Analysis: Problems and Exercises (in Russian), Nauka, Moscow, 1982.

[37] K. A. Rybnikov, Introduction in Combinatorial Analysis (in Russian), Moscow University Press, Moscow, 1985.

[38] V. N. Sachkov, Introduction to Combinatorial Methods in Discrete Mathematics (in Russian), Nauka, Moscow, 1982.

[39] C. E. Shannon, J. MacCarthy (eds.), Automata Studies, Princeton Univ. Press, Princeton, 1956.

[40] M. Swamy, K. Thulasiraman, Graphs, Networks and Algorithms, J. Wiley, New York, 1981.

[41] B. A. Trakhtenbrot, Ya. M. Barzdin, Finite Automata (in Russian), Nauka, Moscow, 1974.

[42] N. Ya. Vilenkin, Combinatorial Analysis (in Russian), Nauka, Moscow, 1969.

[43] R. J. Wilson, Introduction to Graph Theory, Oliver and Boyd, Edinburgh, 1972.

[44] S. V. Yablonsky, Functional Constructions in k- Valued Logic, in: Proceedings of V. A. Steklov Inst. of Maths., Vol. 51 (in Russian), Izd. Akad. Nauk SSSR, Moscow, 1958.

[45] S. V. Yablonsky, Introduction to Discrete Mathematics, Mir, Moscow, 1989.

[46] S. V. Yablonsky, G. P. Gavrilov and V. B. Kudryavtsev, Boolean Functions and Post's Classes (in Russian), Nauka, Moscow, 1966.

[47] A. A. Zykov, Foundations of Graph Theory (in Russian), Nauka, Moscow, 1987.

Page 425: Problems and Exercises in Discrete Mathematics

Index

Adder, one-digit binary 277 Alphabet

message 122 coding 122

Algorithm "division and summation" 26 Markov's 123 of simplification of the d.n.f, 268 Quine's 262

Antidisjunction 6 Arborescence 95 Arc 93 Automaton 135 Automorphism 82

Chain in a graph 81 Hamiltonian 94 simple 82

Circuit, contact 280

complexity of 280 dual to 291 universal 286

of logical elements 273 complexity of 274 depth of 279 minimal 274

Class, closed 38 of general recursive functions 204 of partial recursive functions 204 of primitive recursive functions 204 precomplete 38

Closure 38 Code

alphabetic 122 complete 122 di visi ble 122 mean length of 127 optimal 127

extension of 128

419

tree of 128 prefix 122 redundancy of 127 uniquely decoded 122

extension of 128 tree of 129

with minimal redundancy 127 word of 122

Coding alphabetic 122 Combination 214

with repetitions 214 Component, connected 82 Composition

of functions 10 of networks 99

Conjunction 5 elementary 20

monotone 25 Contour 94

Hamiltonian 94 Cover 89, 254

gradient (greedy) 254 irredundant 254 length (size) of 254 minimal 89, 254 shortest 89, 254 terminal 89

Criterion Salomaa's 75 Slupecki's 75 Yablonsky's 75

Cube, Boolean (n-Cube) 3 n-dimensional 83

Cycle in a graph 82 of permutation 214

Cycles, linearly dependent 89 Decoder 278

Degree, of a vertex 81

Page 426: Problems and Exercises in Discrete Mathematics

420

Dependence, delayed 151 Diagram

Moore's 148 reduced 148

Venn's 225 Diameter of a graph 82 Difference,

mod k 67 truncated 67 symmetric, of graphs 82

Digraph 93 Disjunction 5

elementary 20 Distance,

between vertices 82 Hamming's 3

Element of unit delay 155 Equations, canonical 150 Equivalence 6

Face of the cube 254 external 88 internal 88

Forest 82 Form

conjunctive normal 22 complexity of 21 conjunctive normal, perfect 22

disjunctive normal 21 complexity of 21,260 irredundant 260 length of 21, 260 minimal 260 perfect 21 reduced 260 shortest 260

of k-valued function first 69 second 69

Formula, complexity of 17 depth of 19 Euler's 88 inclusion and exclusion 229 over set of functional symbols 8 over set of logical connectives 8 Stirling's 240

Formulas, equivalent 10 Function

Boolean 3 complexity of 274 linear 47 monotone 55 preserving the constant 52 self-dual 43 Sheffer's 60 symmetric 279

boundedly determined 136 weight of 136

computable 192 determined 134 generating 230

exponential 230 k-valued logic 66

INDEX

characteristic of the first kind 66 characteristic of the second kind 66 essential 75 preserving a partition 71 preserving a set 71

output 49, 189 transition 149, 189

Functions congruent 38 distinguishable 135 equal 30

Graph 83 bipartite 83 complete 82 complement of 82 connected 82 cubic 83 directed, oriented 93 directed 93 empty 83 fiat 88 k-connected 83 of alphabetic code 123 planar 88 regular of degree d 83 thickness of 88 trivial 83

Graphs homeomorphic 82 isomorphic 82

Page 427: Problems and Exercises in Discrete Mathematics

INDEX

Group, symmetry 237

Hypercube 3

Implicant 260 core 260 prime 260

Implication 6, 67 Index, cyclic 237 Inequality, McMillan's 122 Interval of the n-cube 254

maximal 261 Isomorphism 82

Lemma Bernside's 237 on a nonlinear function 47 on a nonmonotone function 55 on a nonself-dual function 43

Level of the n-cube 3 Logical connectives 6 Loop 81, 93

Machine, Turing's 188 Matching 83

maximum 83 perfect 83

Matrix adjacency 95 incidence 95

Method Blake's 261 cascade 287 Huffman's 127 of indeterminate coefficients 26 Nelson's 261 Shannon's 286

Multigraph 81 directed 93

Multiplexer 278 Multiplication rule 215 Multiset 214

disordered 214 ordered 214

Negation Lukasiewicz's 66 Post's 66 i 5

Network 99 connected 99

decomposable 99 H-network 100 series-parallel (7r-network) 100 strongly connected 99 trivial 99 width of 101

Number chromatic 89 cyclomatic 89 edge covering 89 vertex (edge) independence 89 vertex covering 89

One, lower 56 Operation

421

deletion of an output variable 151 identification of variables 151 introduction of a feedback 151 of minimization 203 of primitive recursion 203 superposition 153 union of functions 153

Operator, residual 135 Orbit 237

Path 94 Hamiltonian 94

Permutation 214, 236 cyclic 237 with repetitions 214

Pierce's arrow 6 Polynomial

mod k 71 mod 2 32 Reed-Muller's 25 Zhegalkin's 25

Prefix 122, 134 proper 122

Product Cartesian 82 mod k 67

Pseudograph 87 directed 95 Hamiltonian 94

Rank of conjunction (disjunction) 20

Sequence, recurrent 228 Series

Page 428: Problems and Exercises in Discrete Mathematics

422

figure counting 237 function counting 238

Set Post's 75 Rosser-Turquette's 75

Sheffer's stroke 6 State 135

ini tial 135 Stratum of the n-cube 3 Subfunction of Boolean function 21

proper 21 Subgraph 82

generated by a subset 82 proper 82 spanning 82

Subnetwork 99 Subword 122

proper 122 Suffix 122, 134

proper 122 Sum

exclusive 5 mod k 66

Summation rule 215 Superposition

of functions 10 of networks 99

Table, canonical 149 Test 255

irredundant 255 length of 255 minimal 255

Theorem Kleene's 210 Markov's 123 on a universal function 209 Piccard's 75 Polya's 238 Pontryagin-K uratiwski 's 88 Post's 60 Robinson's 204

Tournament 95 Transposition 237 Tree 82

code of 99 growing 95 informative 136

loaded 136 rooted 98 saturated 129

Triangulation 90 Tuple

Boolean (binary) 3 norm of 3 preceding to tuple 3 weight of 3

Tuples adjacent 3 comparable 3 opposite 3

Variable essential 30 unessential 30

Vector Boolean 3

INDEX

of coefficients of polynomial 25 values 4

Vertex accessible 94, 148 boundary 99 initial 94 internal 101 isolated 81 minimal 101 separating (cut) 83 terminal 81

Vertices adjacent 81 equivalent 101 independent 89

Walk 81 closed 82

Webb's function 6 Word 134

empty 134 infinite 134

Zero, upper 56

Page 429: Problems and Exercises in Discrete Mathematics

Kluwer Texts in the Mathematical Sciences

1. A.A. Hanns and D.R. Wyman: Mathematics and Physics of Neutron Radiography. 1986 ISBN 90-277-2191-2

2. H.A. Mavromatis: Exercises in Quantum Mechanics. A Collection of Illustrative Problems and Their Solutions. 1987 ISBN 90-277-2288-9

3. V.I. Kukulin, V.M. Krasnopol'sky and I. Homcek: Theory of Resonances. Principles and Applications. 1989 ISBN 90-277-2364-8

4. M. Anderson and Todd Feil: Lattice-Ordered Groups. An Introduction. 1988 ISBN 90-277-2643-4

5. I. Avery: Hyperspherical Harmonics. Applications in Quantum Theory. 1989 ISBN 0-7923-0165-X

6. H.A. Mavromatis: Exercises in Quantum Mechanics. A Collection of Illustrative Problems and Their Solutions. Second Revised Edition. 1992 ISBN 0-7923-1557-X

7. G. Micula and P. Pavel: Differential and Integral Equations through Practical Problems and Exercises. 1992 ISBN 0-7923-1890-0

8. W.S. Anglin: The Queen of Mathematics. An Introduction to Number Theory. 1995 ISBN 0-7923-3287-3

9. Y.G. Borisovich, N.M. Bliznyakov, T.N. Fomenko and Y.A. Izrailevich: Introduction to Differential and Algebraic Topology. 1995 ISBN 0-7923-3499-X

10. 1. Scbmeelk, D. TakaCi and A. Takaei: Elementary Analysis through Examples and Exercises. 1995 ISBN 0-7923-3597-X

11. 1.S. Golan: Foundations of Linear Algebra. 1995 ISBN 0-7923-3614-3 12. S.S. Kutateladze: Fundamentals of Functional Analysis. 1996 ISBN 0-7923-3898-7 13. R. Lavendhomme: Basic Concepts of Synthetic Differential Geometry. 1996

ISBN 0-7923-3941-X 14. G.P. Gavrilov and A.A. Sapozhenko: Problems and Exercises in Discrete Mathe-

matics. 1996 ISBN 0-7923-4036-1 15. R. Singh and N. Singh Mangat: Elements of Survey Sampling. 1996.

ISBN 0-7923-4045-0

KLUWER ACADEMIC PUBLISHERS - OORDRECHT / BOSTON / LONDON