133 110 2MB
English Pages 142 [135] Year 2023
Studies in Systems, Decision and Control 493
Monther Busbait Mikhail Moshkov Albina Moshkova Vladimir Shevtchenko
Decision Trees for Fault Diagnosis in Circuits and Switching Networks
Studies in Systems, Decision and Control Volume 493
Series Editor Janusz Kacprzyk, Systems Research Institute, Polish Academy of Sciences, Warsaw, Poland
The series “Studies in Systems, Decision and Control” (SSDC) covers both new developments and advances, as well as the state of the art, in the various areas of broadly perceived systems, decision making and control–quickly, up to date and with a high quality. The intent is to cover the theory, applications, and perspectives on the state of the art and future developments relevant to systems, decision making, control, complex processes and related areas, as embedded in the fields of engineering, computer science, physics, economics, social and life sciences, as well as the paradigms and methodologies behind them. The series contains monographs, textbooks, lecture notes and edited volumes in systems, decision making and control spanning the areas of Cyber-Physical Systems, Autonomous Systems, Sensor Networks, Control Systems, Energy Systems, Automotive Systems, Biological Systems, Vehicular Networking and Connected Vehicles, Aerospace Systems, Automation, Manufacturing, Smart Grids, Nonlinear Systems, Power Systems, Robotics, Social Systems, Economic Systems and other. Of particular value to both the contributors and the readership are the short publication timeframe and the world-wide distribution and exposure which enable both a wide and rapid dissemination of research output. Indexed by SCOPUS, DBLP, WTI Frankfurt eG, zbMATH, SCImago. All books published in the series are submitted for consideration in Web of Science.
Monther Busbait · Mikhail Moshkov · Albina Moshkova · Vladimir Shevtchenko
Decision Trees for Fault Diagnosis in Circuits and Switching Networks
Monther Busbait Dammam, Saudi Arabia Albina Moshkova Adamstown, Co. Dublin, Ireland
Mikhail Moshkov King Abdullah University of Science and Technology Thuwal, Saudi Arabia Vladimir Shevtchenko Nizhny Novgorod, Russia
ISSN 2198-4182 ISSN 2198-4190 (electronic) Studies in Systems, Decision and Control ISBN 978-3-031-39030-2 ISBN 978-3-031-39031-9 (eBook) https://doi.org/10.1007/978-3-031-39031-9 © The Editor(s) (if applicable) and The Author(s), under exclusive license to Springer Nature Switzerland AG 2023 This work is subject to copyright. All rights are solely and exclusively licensed by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use. The publisher, the authors, and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, expressed or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. This Springer imprint is published by the registered company Springer Nature Switzerland AG The registered company address is: Gewerbestrasse 11, 6330 Cham, Switzerland
To our families
Preface
In this book, we study theoretical problems of fault diagnosis in circuits and switching networks, which are among the most fundamental models for computing Boolean functions. There are two types of fault diagnosis algorithms: non-adaptive (diagnostic tests) and adaptive (diagnostic decision trees). Most researchers in theoretical diagnostics investigate diagnostic tests. We study diagnostic decision trees. The minimum depth of a diagnostic decision tree does not exceed the minimum cardinality of a diagnostic test, and the minimum depth of a diagnostic decision tree can be essentially less than the minimum cardinality of a diagnostic test. We study two main cases: when the scheme (circuit or switching network) has the same mode of operation for both calculation and diagnostics, and when the scheme has two modes of operation—normal for calculation and special for diagnostics. In the former case, we get mostly negative results, including superpolynomial lower bounds on the minimum depth of diagnostic decision trees depending on scheme complexity and the NP-hardness of construction diagnostic decision trees. In the latter case, we describe classes of schemes and types of faults for which decision trees can be effectively used to diagnose schemes, when they are transformed into so-called iteration-free schemes. The tools and results discussed in this book can help to understand both the possibilities and challenges of using decision trees to diagnose faults in various schemes. The book can be useful to specialists both in the field of theoretical and technical diagnostics. It can also be used for the creation of courses for graduate students. Dammam, Saudi Arabia Thuwal, Saudi Arabia Adamstown, Co. Dublin, Ireland Nizhny Novgorod, Russia February 2023
Monther Busbait Mikhail Moshkov Albina Moshkova Vladimir Shevtchenko
vii
Acknowledgements
We are indebted to King Abdullah University of Science and Technology for its support during the preparation of this book. We are grateful to our colleagues with whom we collaborated in the study of fault diagnosis: Saad Alrawaf, Igor Chikalov, Galina Goduhina, and Shahid Hussain. We are thankful to Prof. Andrzej Skowron for stimulating discussions. We extend an expression of gratitude to Prof. Janusz Kacprzyk, Dr. Thomas Ditzinger, and the Series Studies in Systems, Decision and Control staff at Springer for their support in making this book possible. Dammam, Saudi Arabia Thuwal, Saudi Arabia Adamstown, Co. Dublin, Ireland Nizhny Novgorod, Russia February 2023
Monther Busbait Mikhail Moshkov Albina Moshkova Vladimir Shevtchenko
ix
Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1 Preliminary Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Directions of Research . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.1 Arbitrary Schemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.2 Best Schemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.3 Problem of Decision Tree Construction . . . . . . . . . . . . . . . . . 1.2.4 Iteration-Free Schemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.5 Schemes with Two Modes of Operation . . . . . . . . . . . . . . . . . 1.2.6 Optimal Bases for Closed Classes of Boolean Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4 Contents of Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5 Use of Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1 1 3 3 4 5 5 6
2 Diagnosis of Constant Faults at Inputs of Gates in Circuits . . . . . . . . . 2.1 Basic Notions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.1 Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.2 Set of Tuples of Constant Faults at Inputs of Gates . . . . . . . . 2.1.3 Problem of Diagnosis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.4 Decision Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Diagnosis of Arbitrary and Specially Constructed Circuits . . . . . . . . 2.2.1 Arbitrary Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.2 Specially Constructed Circuits . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.3 Auxiliary Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.4 Proofs of Theorems 2.1 and 2.2 . . . . . . . . . . . . . . . . . . . . . . . . 2.3 Complexity of Diagnostic Decision Tree Construction . . . . . . . . . . . 2.3.1 Proof of Theorem 2.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13 16 16 17 17 18 19 19 20 20 22 24 25
7 7 8 9 9
xi
xii
Contents
2.4 Diagnosis of Iteration-Free Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4.1 Bounds on Complexity of Diagnostic Decision Trees . . . . . . 2.4.2 Quasiprimitive Bases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4.3 Non-quasiprimitive Bases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.5 Approach to Circuit Construction and Diagnosis . . . . . . . . . . . . . . . . 2.6 Optimal Bases for Some Closed Classes . . . . . . . . . . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27 27 28 32 34 35 42
3 Diagnosis of Embedding Faults in Circuits . . . . . . . . . . . . . . . . . . . . . . . . 3.1 Main Notions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Main Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
43 44 45 50
4 Diagnosis of Extensions of Constant Faults in Circuits . . . . . . . . . . . . . 4.1 Main Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Extensions Preserving Efficiency of Diagnosis . . . . . . . . . . . . . . . . . . 4.2.1 Linear Faults for Linear Bases . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.2 Unate Faults for Unate Bases . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 Impossibility of Further Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4 Optimal Bases for Some Closed Classes . . . . . . . . . . . . . . . . . . . . . . . 4.5 Complexity of Diagnosis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
53 54 57 57 58 61 65 69 70
5 Diagnosis of Retaining Faults in Circuits . . . . . . . . . . . . . . . . . . . . . . . . . 5.1 Main Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Diagnosis of Iteration-Free Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3 Optimal Bases for Closed Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4 Shannon Functions of Two Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
71 72 73 75 80 84
6 Diagnosis of Constant Faults in Switching Networks . . . . . . . . . . . . . . . 87 6.1 Arbitrary Switching Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 6.1.1 Main Notions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 6.1.2 Switching Networks for Symmetric Boolean Functions . . . . 91 6.1.3 Diagnosis of Arbitrary and Specially Constructed Switching Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 6.1.4 Complexity of Diagnostic Decision Tree Construction . . . . . 94 6.2 Iteration-Free Switching Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 6.2.1 Main Notions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 6.2.2 Diagnosis of Decomposable Networks . . . . . . . . . . . . . . . . . . 98 6.2.3 Diagnosis of Indecomposable Networks . . . . . . . . . . . . . . . . . 103 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 Appendix A: Closed Classes of Boolean Functions . . . . . . . . . . . . . . . . . . . . 119 Final Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Chapter 1
Introduction
In this book, we study decision trees for diagnosis of faults in circuits and switching networks. We consider two main cases: when the scheme (circuit or switching network) has the same mode of operation for both calculation and diagnostics, and when the scheme has two modes of operation—normal for calculation and special, with the possibility of splitting inputs, for diagnostics. In the former case, we get mostly negative results, including superpolynomial lower bounds on the minimum depth of diagnostic decision trees and NP-hardness of construction diagnostic decision trees. In the latter case, we describe scheme classes and fault types for which decision trees can be effectively used to diagnose schemes during their transformation by splitting the inputs into so-called iterationfree schemes.
1.1 Preliminary Discussion Circuits and switching networks have various names. In particular, switching networks are also known as contact networks. We follow terminology considered in the book of Jukna [16]. Circuits (directed acyclic graphs with input nodes labeled with pairwise different variables, gate nodes labeled with Boolean functions from a given finite basis B, and one output node) and switching networks (undirected graphs with two specified nodes—poles in which each edge is labeled with a literal—a variable or its negation) are among most fundamental models for computing Boolean functions. As the complexity of the circuit, we consider mainly its number of gates and, as the complexity of the switching network, we consider its number of edges. In this book, we investigate arbitrary finite bases B. Circuits in the basis B implement Boolean functions from the closed class [B], where [B] is the closure of the set B relative to the operation of substitution and the operations of insertion and deletion of unessential variable. Our study is largely based on the structure of all closed classes of Boolean functions described by Post who considered the closure © The Author(s), under exclusive license to Springer Nature Switzerland AG 2023 M. Busbait et al., Decision Trees for Fault Diagnosis in Circuits and Switching Networks, Studies in Systems, Decision and Control 493, https://doi.org/10.1007/978-3-031-39031-9_1
1
2
1 Introduction
relative to the operation of substitution and by Yablonskii, Gavrilov, and Kudriavtzev who considered additionally the closure relative to the operations of insertion and deletion of unessential variable [33, 34, 43]. For circuits, we study faults consisting in replacing arbitrary number of functions assigned to gates by some other Boolean functions, in particular, we investigate constant 0 and 1 faults at the inputs of gates. We also study faults consisting in embedding arbitrary number of new gates implementing Boolean functions from a finite fault basis P into the circuit. In this case, we consider the total number of inputs and gates as the complexity of a circuit. For switching networks, we consider three types of constant faults: replacement of arbitrary number of literals assigned to edges (i) by constants from the set {0, 1}, (ii) by the constant 0, and (iii) by the constant 1. Let us fix a scheme (a circuit or a switching network) S and a type of faults F. The problem of diagnosing faults of type F for the scheme S is as follows: for the scheme S with a fault of type F, we should recognize the Boolean function implemented by it. To this end, we can use the following queries: we assign to the variables of S a tuple of their values and observe the value of the function implemented by S on this tuple. There are two types of algorithms based on these queries: non-adaptive (diagnostic tests) and adaptive (diagnostic decision trees). A diagnostic test is a set of queries, which allow us to distinguish between any two different functions implemented by the scheme S with possible faults of the type F. The complexity of this test is characterized by its cardinality. A diagnostic decision tree is a tree with root in which terminal nodes are labeled with Boolean functions and nonterminal nodes are labeled with queries (tuples of zeros and ones). For each fault of type F in S, this tree returns the function implemented by S with the considered fault. The complexity of a decision tree is characterized by its depth, which is the maximum length of a path from the root to a terminal node. The relationships between diagnostic tests and diagnostic decision trees are of considerable interest to us. The minimum depth of a diagnostic decision tree does not exceed the minimum cardinality of a diagnostic test: we can build a decision tree that solves the problem of fault diagnosis by sequentially using the queries included in the diagnostic test. The set of queries used by a diagnostic decision tree is a diagnostic test: if two functions implemented by the scheme S with two different faults of type F are different, then the work of the decision tree for these faults will be finished in different terminal nodes, i.e., the decision tree uses a query that allows us to distinguish between the considered two functions. Therefore the minimum number of nonterminal nodes in a diagnostic decision tree is not less than the minimum cardinality of a diagnostic test. In our research, we encounter each of the following situations: (i) low values of both the depth of decision trees and the cardinality of tests depending on the complexity of schemes, (ii) high values of both parameters, and (iii) low values of the depth of decision trees and high values of the cardinality of tests. Goldman, Chipulis, Madatyan, and Karava˘ı in [14, 17, 20] described classes of iteration-free schemes (both circuits and switching networks) and types of faults
1.2 Directions of Research
3
for which the minimum cardinality of diagnostic tests is bounded from above by linear functions depending on the number of variables in schemes. In these cases, the minimum depth of diagnostic decision trees is bounded from above by the same linear functions. From the results obtained in Chaps. 2, 3, and 6 of this book it follows that there are schemes (both circuits and switching networks) and types of faults for which the minimum depth of diagnostic decision trees grows as a superpolynomial function depending on scheme complexity. In these cases, the minimum cardinality of diagnostic tests also grows as a superpolynomial function on scheme complexity. The minimum depth of diagnostic decision trees can be substantially less than the minimum cardinality of diagnostic tests. From the results obtained by Madatyan, Moshkov and Busbait [6, 20, 23] it follows that there are sequences of iteration-free schemes (both circuits and switching networks) for which the minimum cardinality of diagnostic tests grows exponentially depending on the complexity of schemes and the growth of the minimum depth of diagnostic decision trees is at most linear depending on the complexity of schemes—see explanations in introductions to Chaps. 2 and 6. Since the set of queries used by a diagnostic decision tree is a diagnostic test, in the considered cases we have decision trees with small depth and large number of nodes. Fortunately, it is possible to effectively use these decision trees. Problems and methods of diagnostics can be roughly divided into theoretical and technical diagnostics. Theoretical diagnostics (in particular, this book) deals with mathematical models for computing of Boolean functions such as circuits and switching networks and mathematical methods of its study. Most part of researchers here investigate diagnostic tests. The use of decision trees (conditional tests) for fault diagnosis was proposed by Chegis and Yablonskii [7, 42]. The coauthors of the present book include what seems to be the majority of researchers working with diagnostic decision trees. Problems of technical diagnostics are closer to current practical needs. Many authors in this area use decision trees as diagnostic algorithms—see, in particular, papers of Chen, Zheng, Lloyd, Jordan, Brewer and Lee, Alena, Robinson [8, 19]. However, such studies mostly do not lead to mathematical results.
1.2 Directions of Research There are six main directions of our research.
1.2.1 Arbitrary Schemes In the first direction, we study how the minimum depth of diagnostic decision trees depends on the complexity of arbitrary schemes in the worst case.
4
1 Introduction
We will say that a set of Boolean functions C is primitive if at least one of the following conditions holds: • Every function from C is either a conjunction x1 ∧ · · · ∧ xn or a constant. • Every function from C is either a disjunction x1 ∨ · · · ∨ xn or a constant. • Every function from C is a linear function. We show that, for circuits in a basis B and constant faults at inputs of gates, the growth of the minimum depth of diagnostic decision trees depending on the complexity of circuits in the worst case is at most linear if B is primitive and at least superpolynomial if B is not primitive. For circuits in a basis B and faults consisting in embedding gates implementing Boolean functions from a fault basis P to the circuits, the growth of the minimum depth of diagnostic decision trees in the worst case is at most linear if P = {x} or the set B ∪ P is primitive and at least superpolynomial otherwise. For arbitrary switching networks and constant faults of any of the considered three types, the growth of the minimum depth of diagnostic decision trees in the worst case is at least superpolynomial.
1.2.2 Best Schemes Unlike the first one, the second direction of research studies the complexity of diagnostic decision trees for the best (from the point of view of solving the problem of diagnosing) schemes that implement Boolean functions specified either by formulas or switching networks. For a Boolean function f given either by a formula or by a switching network, we consider the best scheme (respectively a circuit or a switching network) implementing f with the minimum possible depth of a decision tree for diagnostic of the considered type of faults. We study how this minimum depth of diagnostic decision trees depends on the complexity of the representation of Boolean functions in the worst case. As the complexity of a formula, we consider the number of functional symbols in it. If Boolean functions are given by formulas over a basis B, for construction of best circuits we can use gates implementing arbitrary Boolean functions, and we consider constant faults at the inputs of gates, then the growth of the minimum depth of diagnostic decision trees for the best circuits in the worst case is at most linear if B is primitive and at least superpolynomial if B is not primitive. If Boolean functions are given by switching networks and we consider constant faults of any of the mentioned three types, then the growth of the minimum depth of diagnostic decision trees for the best switching networks in the worst case is at least superpolynomial.
1.2 Directions of Research
5
1.2.3 Problem of Decision Tree Construction The third direction of research is to study the complexity of algorithms for the following problem of decision tree construction: for a given scheme S and a set W of faults of given type in the scheme S, it is required to construct a diagnostic decision tree, which solves the problem of diagnosis of faults from W for the scheme S. Note that there exists a decision tree with at most 2 |W | − 1 nodes, which solves the problem of diagnosis of faults from W for the scheme S. For circuits in a basis B and constant faults at the inputs of gates, if B is primitive, then there exists a polynomial time algorithm, which solves this problem. If B is not primitive, then the considered problem is NP-hard. For switching networks and constant faults of any of the mentioned three types, the problem of decision tree construction is NP-hard.
1.2.4 Iteration-Free Schemes From the point of view of the complexity of constant fault diagnosis, only circuits in primitive bases seem to be acceptable. The situation can be changed by a significant restriction on the class of schemes under consideration. The fourth direction of research is the study of iteration-free circuits and switching networks. A circuit is called iteration-free if each node of it has at most one leaving edge. This notion generalizes the notion of read-once formula. A Boolean function f (x1 , ..., xn ) is called unate if there exist numbers σ1 , ..., σn ∈ {0, 1} and a monotone Boolean function g(x1 , ..., xn ) such that f (x1 , ..., xn ) = g(x1σ1 , ..., xnσn ), where x σ = x if σ = 1, and x σ = ¬x if σ = 0. Constants 0 and 1 are unate functions. A set of Boolean functions C will be called quasiprimitive if at least one of the following conditions holds: • Each function from C is a linear function. • Each function from C is a unate function. For iteration-free circuits in a basis B and constant faults at inputs of gates, the growth of the minimum depth of diagnostic decision trees depending on the complexity of circuits in the worst case is at most linear if B is quasiprimitive and at least superpolynomial if B is not quasiprimitive. We describe maximum extensions of constant faults at inputs of gates, which keep linear upper bounds on the depth of decision trees for diagnosis of iteration-free circuits in a quasiprimitive basis B depending on the circuit complexity. If a gate is labeled with a constant, then this gate has no faults. If a gate is labeled with a linear function f (x1 , . . . , xn ), then this function can be changed to an arbitrary linear function g(x1 , . . . , xn ). If a gate is labeled with a unate function f (x1σ1 , ..., xnσn ), where f is a monotone function and σ1 , ..., σn ∈ {0, 1}, then the function f (x1σ1 , ..., xnσn )
6
1 Introduction
can be changed to an arbitrary unate function g(x1σ1 , ..., xnσn ), where g is a monotone function. We consider one more type of faults of gates in circuits in an arbitrary basis B, which keeps linear upper bounds on the depth of decision trees for diagnosis of iteration-free circuits in the basis B depending on the circuit complexity. Let a gate of a circuit implement in the normal state a function f (x1 , . . . , xn ) ∈ B. If f is a constant, then this gate has no faults. Let f be not a constant and two n-tuples α˜ and ˜ = 1. Then this gate with a fault β˜ from {0, 1}n be fixed such that f (α) ˜ = 0 and f (β) ˜ = 0 and can implement an arbitrary Boolean function g(x1 , . . . , xn ) such that g(α) ˜ = 1. These faults are known as retaining faults. g(β) A switching network is called iteration-free if its edges are labeled with pairwise different variables. We study iteration-free networks over a finite set N of networks which is called basis. These networks can be obtained by replacing some edges in a network from N with recursively constructed networks (including networks from N ). We assume that all networks from N are indecomposable, i.e., cannot be obtained from two nontrivial (containing more than one edge) networks by replacing an edge in the first network with the second one. For each basis N and each type of constant faults, we obtain a linear upper bound on the minimum depth of diagnostic decision trees depending on the complexity of iteration-free networks. Note that in each of the considered cases with linear upper bounds on the minimum depth of diagnostic decision trees, there exist decision trees satisfying these bounds and possessing an effective description of the work.
1.2.5 Schemes with Two Modes of Operation The fifth direction of research deals with scheme construction and effective diagnosis of faults based on the results obtained for iteration-free schemes. Circuits in a basis B implement Boolean functions from the class [B] closed relatively the operation of substitution and the operations of insertion and deletion of unessential variable. We show that, for each basis B, there exists a quasiprimitive basis B such that B = [B]. For a given function f from [B], we construct a formula-like circuit S in the basis B in which each gate has at most one leaving edge. There are two modes of the circuit S operation: normal, when it implements the function f , and diagnostic, when inputs of S having multiple issuing edges are splitting and are labeled with pairwise different variables. In the latter case, the circuit S is transformed into an iteration-free circuit, which can be effectively diagnosed relatively to constant faults at the inputs of gates or maximum extensions of these faults. In the case of retaining faults, we can keep the initial basis B and apply the same technology that includes the construction of a formula-like circuit and use two modes of its operation. Both in this and in the previous case, we can use known nontrivial upper bounds on the complexity of formulas implementing functions from closed
1.3 Related Work
7
classes. Based on these bounds, we can obtain nontrivial upper bounds on the depth of decision trees for diagnosis of circuits operating in the diagnostic mode. Similar approach can be used to diagnose switching networks. Let a basis N contain, among others, two networks each with two edges. In the first, the edges are connected in parallel, and in the second in series. Then each Boolean function can be implemented by a switching network in the basis N . This network has two modes of operation: normal, when it implements the considered function, and the diagnostic, when its edges are labeled with pairwise different variables (in this case, we can control each edge independently of other edges). In the diagnostic mode, the initial network is transformed into an iteration-free network in the basis N , which can be diagnosed efficiently.
1.2.6 Optimal Bases for Closed Classes of Boolean Functions We consider three cases, when diagnosis of iteration-free circuits is efficient: the diagnosis of iteration-free circuits in a quasiprimitive basis B (i) relative to constant faults at inputs of gates and (ii) relative to the maximum extensions of these faults, and (iii) the diagnosis of iteration-free circuits in an arbitrary basis B relative to retaining faults. In each case, for any iteration-free circuit S in the basis B, the minimum depth of a diagnostic decision tree is bounded from above by the value c B L(S), where c B is a constant depending only on the basis B, and L(S) is the complexity of S—the number of gates in S. In each case, we study the following problem: for a given closed class K of Boolean functions, we should find an optimal basis B (quasiprimitive in the cases (i) and (ii)) for which [B] = K and the constant c B has the minimum value. In the case (i), we find optimal bases for the 40 most common closed classes. In the case (ii), we find an optimal basis for each closed class containing functions with at least two essential variables. In the case (iii), we find an optimal basis for each closed class of Boolean functions.
1.3 Related Work The main areas of research related to the possible appearance of faults in schemes are 1. Synthesis of reliable schemes from unreliable elements (initiated by von Neuman, Moore, and Shannon [22, 27]). 2. Synthesis of self-correcting schemes (initiated by Potapov and Yablonskii [35]). 3. Monitoring of scheme operation (initiated by Chegis, Yablonskii, Moore, Eldred, Armstrong, and Roth [4, 7, 10, 21, 40, 42]).
8
1 Introduction
Not only schemes without memory such as circuits and switching networks are studied, but also automata and programs. The third area includes the problem of scheme verification (for a given scheme with possible faults, it is necessary to recognize if it implements the same function as the scheme without faults) and the problem of scheme diagnostic (for a given scheme with possible faults, it is necessary to recognize the function implemented by this scheme). We are working in the third area and deal with the problem of diagnostic of circuits and switching networks. As we mentioned, there are two types of algorithms for solving the problem of scheme diagnostic: non-adaptive known as diagnostic tests and adaptive known as diagnostic decision trees. Most of the theoretical publications related to the problem of scheme diagnostic are devoted to the study of diagnostic tests—see, in particular, papers of Madatyan, Noskov, Red’kin, Romanov, Popkov, and Antyufeev [3, 20, 28, 32, 37–39]. Most of the mathematical results related to decision trees for fault diagnosis in circuits and switching networks are concentrated in the present book. This book is based on the papers of its coauthors, including [6, 24–26, 41], and their colleagues Alrawaf, Chikalov, Goduhina, and Hussain [1, 5, 13]. In this book, we use methods of test theory initiated by Yablonskii and Chegis [7, 42] and rough set theory initiated by Pawlak [29–31]. Both theories study tests (reducts) and decision trees. More details about these theories can be found in the book by Chikalov, Lozin, Lozina, Moshkov, Nguyen, Skowron, and Zielosko [9]. We should mention two more directions of research that are close to some of the topics in this book. One direction is related to the following problem of exact learning: for a given scheme from some class of iteration-free schemes, using only membership queries we should find a scheme from the considered class implementing the same function as the initial scheme. Usually, the considered class of schemes is essentially wider than the class of schemes obtained from given scheme by adding faults—see, in particular, papers of Angluin, Hellerstein, Karpinski and Raghavan, Schach [2, 36]. Another direction is studying the computational complexity of various problems related to faults, in particular, fault detectability and evaluation of the cardinality of tests, and proving their NP-hardness—see papers of Ibarra, Sahni, Fujiwara, Toida, Krishnamurthy, and Akers [11, 12, 15, 18].
1.4 Contents of Book This book contains six chapters and Appendix A. In Chap. 2, we study constant faults at the inputs of gates of circuits in the frameworks of all six directions of research: investigation of arbitrary circuits, best circuits, complexity of diagnostic decision tree construction, iteration-free circuits, two-mode operation of circuits, and optimal bases for closed classes of Boolean functions.
References
9
Chapter 3 is devoted to the first direction of research. We study arbitrary circuits and very wide class of faults consisting in embedding arbitrary number of new gates implementing Boolean functions from a fault basis P to the circuit. In Chaps. 4 and 5, we investigate diagnostic of iteration-free circuits. In Chap. 4, we consider circuits in quasiprimitive bases and the maximum extensions of constant faults at inputs of gates. In Chap. 5, we study circuits in arbitrary bases and retaining faults. In both chapters, the study is done in the frameworks of the last three directions of research: investigation of iteration-free circuits, two-mode operation of circuits, and optimal bases for closed classes of Boolean functions. In Chap. 6, we study constant faults of three types in switching networks in the frameworks of the first five directions of research: investigation of arbitrary switching networks, best networks, complexity of diagnostic decision tree construction, iteration-free networks, and two-mode operation of networks. In Appendix A, we describe the structure of all closed classes of Boolean functions.
1.5 Use of Book This book is more theoretical than practical. However, the tools and results considered in it can help to understand both the opportunities and challenges of using decision trees to diagnose faults in various schemes. This book can be useful for specialists both in theoretical and technical diagnostics. The book can also be used for the creation of courses for graduate students.
References 1. Alrawaf, S., Chikalov, I., Hussain, S., Moshkov, M.: Diagnosis of constant faults in iterationfree circuits over monotone basis. Discret. Appl. Math. 166, 287–291 (2014) 2. Angluin, D., Hellerstein, L., Karpinski, M.: Learning read-once formulas with queries. J. ACM 40(1), 185–210 (1993) 3. Antyufeev, G.V., Romanov, D.S.: Tests with stuck-at and shift faults on circuit inputs. Comput. Math. Model. 31(4), 494–500 (2020) 4. Armstrong, D.B.: On finding a nearly minimal set of fault detection tests for combinational logic nets. IEEE Trans. Electron. Comput. EC-15(1), 66–73 (1966) 5. Busbait, M., Chikalov, I., Hussain, S., Moshkov, M.: Diagnosis of constant faults in read-once contact networks over finite bases. Discret. Appl. Math. 184, 76–88 (2015) 6. Busbait, M., Moshkov, M.: Diagnosis of three types of constant faults in read-once contact networks over finite bases. Theor. Comput. Sci. 630, 26–42 (2016) 7. Chegis, I.A., Yablonskii, S.V.: Logical methods of electric circuit control. Trudy MIAN SSSR 51, 270–360 (1958). (in Russian) 8. Chen, M.Y., Zheng, A.X., Lloyd, J., Jordan, M.I., Brewer, E.A.: Failure diagnosis using decision trees. In: 1st International Conference on Autonomic Computing (ICAC 2004), 17–19 May 2004, pp. 36–43. IEEE Computer Society, New York (2004)
10
1 Introduction
9. Chikalov, I., Lozin, V.V., Lozina, I., Moshkov, M., Nguyen, H.S., Skowron, A., Zielosko, B.: Three Approaches to Data Analysis - Test Theory, Rough Sets and Logical Analysis of Data, Intelligent Systems Reference Library, vol. 41. Springer (2013) 10. Eldred, R.D.: Test routines based on symbolic logic statements. J. ACM 6(1), 33–36 (1959) 11. Fujiwara, H.: Computational complexity of controllability/observability problems for combinational circuits. IEEE Trans. Comput. 39(6), 762–767 (1990) 12. Fujiwara, H., Toida, S.: The complexity of fault detection problems for combinational logic circuits. IEEE Trans. Comput. C-31(6), 555–560 (1982) 13. Goduhina, G.B.: Experimental study of conditional tests for diagnosis of constant faults in iteration-free contact networks. In: Combinatorial-Algebraic and Probabilistic Methods in Applied Mathematics, pp. 16–21. Gorky University Publishers, Gorky (1988). (in Russian) 14. Goldman, R.S., Chipulis, V.P.: Diagnosis of repetition-free combinational circuits. Diskret. Analiz 14, 3–15 (1969). (in Russian) 15. Ibarra, O., Sahni, S.: Polynomially complete fault detection problems. IEEE Trans. Comput. C-24(3), 242–249 (1975) 16. Jukna, S.: Boolean Function Complexity - Advances and Frontiers, Algorithms and Combinatorics, vol. 27. Springer (2012) 17. Karava˘ı, M.F.: Diagnosis of tree-form circuits having an arbitrary basis. Autom. Remote. Control. 34, 154–161 (1973) 18. Krishnamurthy, B., Akers, S.B.: On the complexity of estimating the size of a test set. IEEE Trans. Comput. C-33(8), 750–753 (1984) 19. Lee, C., Alena, R., Robinson, P.: Migrating fault trees to decision trees for real time fault detection on international space station. In: 2005 IEEE Aerospace Conference, pp. 1–6 (2005) 20. Madatyan, Kh.A.: Complete test for repetition-free contact circuits. In: Probl. Kibern., vol. 23, pp. 103–118. Nauka Publishers, Moscow (1970). (in Russian) 21. Moore, E.F.: Gedanken-experiments on sequential machines. In: Automata Studies. Annals of Mathematical Studies, vol. 34, pp. 129–153. Princeton University Press, Princeton (1956) 22. Moore, E.F., Shannon, C.E.: Reliable circuits using less reliable relays. J. Franklin Inst. 262(3,4), 191–208, 281–297 (1956) 23. Moshkov, M.: Diagnostics of constant faults in circuits. In: Mat. Vopr. Kibern., vol. 9, pp. 79–100. Fizmatlit, Moscow (2000). (in Russian) 24. Moshkov, M.: Time complexity of decision trees. In: Peters, J.F., Skowron, A. (eds.) Trans. Rough Sets III, Lecture Notes in Computer Science, vol. 3400, pp. 244–459. Springer (2005) 25. Moshkova, A.: On diagnosis of retaining faults in circuits. In: Polkowski, L., Skowron, A., (eds.) Rough Sets and Current Trends in Computing, First International Conference, RSCTC’98, Warsaw, Poland, June 22–26, 1998. Lecture Notes in Computer Science, vol. 1424, pp. 513– 516. Springer (1998) 26. Moshkova, A.: On effective methods for diagnosis of retaining faults in circuits. Fund. Inf. 66(3), 299–313 (2005) 27. von Neuman, J.: Probabilistic logics and the synthesis of reliable organisms from unreliable components. In: Automata Studies. Annals of Mathematical Studies, vol. 34, pp. 43–98. Princeton University Press, Princeton (1956) 28. Noskov, V.N.: Diagnostic tests for inputs of logic devices. Diskret. Analiz 26, 72–83 (1974). (in Russian) 29. Pawlak, Z.: Rough sets. Int. J. Parallel. Program 11(5), 341–356 (1982) 30. Pawlak, Z.: Rough Sets - Theoretical Aspects of Reasoning about Data. Theory and Decision Library: Series D, vol. 9. Kluwer (1991) 31. Pawlak, Z., Polkowski, L., Skowron, A.: Rough set theory. In: Wah, B.W., (ed.) Wiley Encyclopedia of Computer Science and Engineering. Wiley, Inc. (2008). https://doi.org/10.1002/ 9780470050118.ecse466 32. Popkov, K.A.: Lower bounds for lengths of complete diagnostic tests for circuits and inputs of circuits. Prikl. Diskr. Mat. 4(34), 65–73 (2016) 33. Post, E.: Introduction to a general theory of elementary propositions. Amer. J. Math. 43, 163– 185 (1921)
References
11
34. Post, E.: Two-valued Iterative Systems of Mathematical Logic. Annals of Mathematics Studies, vol. 5. Princeton University Press, Princeton (1941) 35. Potapov, Yu.G., Yablonskii, S.V.: On the synthesis of self-correcting relay circuits. Dokl. Akad. Nauk SSSR 134(3), 544–547 (1960). (in Russian) 36. Raghavan, V., Schach, S.R.: Learning switch configurations. In: Third Annual Workshop on Computational Learning Theory, COLT 1990, University of Rochester, Rochester, August 6–8, 1990, pp. 38–51 (1990) 37. Red’kin, N.P.: Length of diagnostic tests for boolean circuits. Math. Notes 102(3–4), 580–582 (2017) 38. Red’kin, N.P.: Diagnostic tests for contact circuits. Moscow Univ. Math. Bull. 74(2), 62–64 (2019) 39. Romanov, D.S.: Diagnostic tests for local coalescences of variables in boolean functions. Comput. Math. Model. 23(1), 72–78 (2012) 40. Roth, J.P.: Diagnosis of automata failures: a calculus and a method. IBM J. Res. Develop. 10, 278–291 (1966) 41. Shevtchenko, V.: On the depth of decision trees for diagnosing faults in circuits. In: The Third International Workshop on Rough Sets and Soft Computing, RSSC’94, San Jose State University, San Jose, 1994, pp. 594–601 (1994) 42. Yablonskii, S.V., Chegis, I.A.: On tests for electric circuits. Uspekhi Matematicheskikh Nauk 10(4), 182–184 (1955). (in Russian) 43. Yablonskii, S.V., Gavrilov, G.P., Kudriavtzev, V.B.: Functions of the Algebra of Logic and Post Classes. Nauka Publishers, Moscow (1966). (in Russian)
Chapter 2
Diagnosis of Constant Faults at Inputs of Gates in Circuits
In this chapter, we study decision trees for diagnosis of constant faults in circuits. The faults under consideration are presented in the form of Boolean constants at some inputs of the circuit gates. The problem of diagnostics is to recognize the function implemented by the circuit with a tuple of constant faults from a given set of tuples. For this problem solving, we use decision trees. Each query (attribute) of a decision tree consists of observing the output of the circuit at the inputs of which a binary tuple is given. Let B be a nonempty finite set (a basis) of Boolean functions and let Circ(B) be the set of one-output circuits in the basis B. The number of gates in a circuit S ∈ Circ(B) will be denoted by L(S), and the minimum depth of a decision tree, which solves the problem of diagnosis of the circuit S relative to the set of all possible tuples of constant faults at gate inputs, will be denoted by h(S). The first direction of investigation comprises the study of the depth of diagnostic decision trees for arbitrary circuits in the basis B. Let us consider for this purpose the function h (1) B , which characterizes the worst-case dependency of h(S) on L(S) on the set Circ(B) of circuits: h (1) B (n) = max{h(S) : S ∈ Circ(B), L(S) ≤ n} . The basis B will be called primitive if at least one of the following conditions holds: • Every function from B is either a disjunction x1 ∨ . . . ∨ xn or a constant. • Every function from B is either a conjunction x1 ∧ . . . ∧ xn or a constant. • Every function from B is a linear function. (1) We will show that h (1) B (n) = O(n) for primitive basis B, and log2 h B (n) = Ω(n 1/2 ) for non-primitive basis B. As opposed to the first one, the second direction of research explores the depth of diagnostic decision trees for the best (from the point of view of solving the problem of diagnostics) circuits implementing Boolean functions given as formulas over the
© The Author(s), under exclusive license to Springer Nature Switzerland AG 2023 M. Busbait et al., Decision Trees for Fault Diagnosis in Circuits and Switching Networks, Studies in Systems, Decision and Control 493, https://doi.org/10.1007/978-3-031-39031-9_2
13
14
2 Diagnosis of Constant Faults at Inputs of Gates in Circuits
basis B. Let Φ(B) be the set of formulas over the basis B. For a formula ϕ ∈ Φ(B), we will denote by L(ϕ) the number of functional symbols in ϕ. Let h(ϕ) = min h(S), where the minimum is taken over all possible circuits S (not necessarily in the basis B), which implement the same function as the formula ϕ. We will study the behavior of a function h (2) B , which characterizes the worst-case dependency of h(ϕ) on L(ϕ) on the set of formulas over B and is defined as follows: h (2) B (n) = max{h(ϕ) : ϕ ∈ Φ(B), L(ϕ) ≤ n} . (2) c We will show that h (2) B (n) = O(n) for primitive basis B, and log2 h B (n) = Ω(n ) for non-primitive basis B, where c is a positive constant depending only on B. The third direction of research is to study the complexity of algorithms for the following problem Con(B): for a given circuit S from Circ(B) and an arbitrary set W of tuples of constant faults at inputs of gates of the circuit S, it is required to construct a decision tree, which solves the diagnosis problem for the circuit S relative to the faults from W . Note that there exists a decision tree with at most 2 |W | − 1 nodes, which solves the diagnosis problem for the circuit S relative to the faults from W . If B is a primitive basis, then there exists an algorithm, which solves the problem Con(B) with polynomial time complexity. If B is a non-primitive basis, then the problem Con(B) is NP-hard. From the point of view of the diagnosis problem solving for arbitrary tuples of constant faults at inputs of gates of arbitrary circuits, only primitive bases seem to be admissible. The extension of the set of such bases is possible by the substantial restriction on the class of the circuits under consideration. The fourth direction of research is the study of the depth of diagnostic decision trees for iteration-free circuits in the basis B. A circuit is called iteration-free if each node of it has at most one leaving edge. Denote by Circ1 (B) the set of iteration-free circuits in the basis B with only one output. Consider the function h (3) B , which characterizes the worst-case dependency of h(S) on L(S) for circuits from Circ1 (B) and is defined as follows: 1 h (3) B (n) = max{h(S) : S ∈ Circ (B), L(S) ≤ n} .
A Boolean function f (x1 , . . . , xn ) is called unate if there exist numbers σ1 , . . . , σn ∈ {0, 1} and a monotone Boolean function g(x1 , . . . , xn ) such that f (x1 , . . . , xn ) = g(x1σ1 , . . . , xnσn ) , where x σ = x if σ = 1, and x σ = ¬x if σ = 0. The basis B will be called quasiprimitive if at least one of the following conditions holds: • Each function from B is a linear function. • Each function from B is a unate function. (3) We will show that h (3) B (n) = O(n) if B is quasiprimitive, and log2 h B (n) = Ω(n) if B is not quasiprimitive. Note that there exist decision trees satisfying the bounds for quasiprimitive bases and possessing an effective description of the work.
2 Diagnosis of Constant Faults at Inputs of Gates in Circuits
15
Note also that, from linear upper bounds on the cardinality of diagnostic tests obtained in [3, 4], the bound h (3) B (n) = O(n) can be derived immediately for arbitrary basis B with the following property: each function from B is implemented by some iteration-free circuit in the basis {x ∧ y, x ∨ y, ¬x}. However, from Lemma 11 of Madatyan’s paper [5] it follows that, for iteration-free circuits in the basis {(x1 ∧ x2 ) ∨ (x1 ∧ x3 ∧ x5 ) ∨ (x4 ∧ x3 ∧ x2 ) ∨ (x4 ∧ x5 )}, the minimum cardinality of diagnostic tests for constant faults at the inputs of gates in the worst case grows exponentially with the growth of the number of gates in circuits. The fifth direction of research deals with circuit construction and effective diagnosis of faults based on the results obtained for the iteration-free circuits. Two functions are equal if one of them can be obtained from the other by operations of insertion and deletion of unessential variable. Based on the results of Ugol’nikov [9], one can show for each basis B1 the existence of a quasiprimitive basis B2 with the following properties: • The set of functions implemented by circuits in the basis B2 coincides with the set of functions implemented by circuits in the basis B1 . • There exists a polynomial p such that, for each formula ϕ1 ∈ Φ(B1 ), there exists a formula ϕ2 ∈ Φ(B2 ), which implements the function equal to that implemented by ϕ1 , and such that L(ϕ2 ) ≤ p(L(ϕ1 )). Our approach to circuit construction and fault diagnosis is as follows. Let / {0, 1}, and let us ϕ1 ∈ Φ(B1 ) be a formula implementing certain function f , f ∈ construct a formula ϕ2 ∈ Φ(B2 ) implementing the function equal to f and satisfying the inequality L(ϕ2 ) ≤ p(L(ϕ1 )). Next a circuit S in the basis B2 is constructed according to the formula ϕ2 implementing the function f , satisfying the equality L(S) = L(ϕ2 ) and the condition that at most one edge leaves each gate of the circuit S. In addition to the normal operation mode of the circuit S, there exists the diagnostic mode in which the inputs of the circuit S are “split” so that it becomes ˜ The inequality h( S) ˜ ≤ cp(L(ϕ1 )), where c is a constant an iteration-free circuit S. ˜ depending only on the basis B2 , holds for the circuit S. The sixth direction of research deals with optimal quasiprimitive bases for closed classes of Boolean functions. The diagnosis of iteration-free circuits in a quasiprimitive basis B relative to constant faults at inputs of gates is efficient: for an iteration-free circuit S in the basis B, the minimum depth of a diagnostic decision tree is bounded from above by the value c B L(S), where c B is a constant depending only on the basis B and L(S) is the number of gates in S. We study the following problem: for a given closed class K of Boolean functions, we should find a quasiprimitive basis B for which [B] = K and the constant c B has the minimum value. Here [B] is the closure of the set B relative to the operation of substitution and the operations of insertion and deletion of unessential variable. We find optimal bases for the 40 most common closed classes. This chapter is based mainly on papers of Moshkov and Moshkova [6–8]. Definitions, notation, and results from Appendix A “Closed Classes of Boolean Functions” are used in this chapter without special notice.
16
2 Diagnosis of Constant Faults at Inputs of Gates in Circuits
This chapter contains six sections. In Sect. 2.1, basic notions are defined. In Sect. 2.2, the complexity of decision trees for diagnosis of arbitrary and specially constructed circuits is considered. In Sect. 2.3, the complexity of algorithms for construction of decision trees for diagnosis of faults is studied. In Sect. 2.4, iterationfree circuits are investigated. In Sect. 2.5, an approach to circuit construction and diagnosis is considered. In Sect. 2.6, optimal bases for 40 closed classes of Boolean functions are described.
2.1 Basic Notions The notions of circuit, set of tuples of constant faults at the inputs of gates, diagnosis problem, and decision tree are defined in this section.
2.1.1 Circuits A basis is an arbitrary nonempty finite set of Boolean functions. Let B be a basis. A circuit in the basis B is a labeled finite directed graph without directed cycles and, possibly, with multiple edges, which has nodes of the three types: inputs, gates, and outputs. Nodes of the input type have no entering edges, each input is labeled with a variable, and distinct inputs are labeled with distinct variables. Every circuit has at least one input. Each node of the gate type is labeled with a function from the set B. Let v be a gate and let a function g depending on t variables be attached to it. If t = 0 (this is the case, when g is one of the constants 0 or 1), then the node v has no entering edges. If t > 0, then the node v has exactly t entering edges, which are labeled with numbers 1, . . . , t, respectively. Every circuit has at least one gate. Each node of the output type has exactly one entering edge, which leaves a gate. Let v be an output. Nothing is attached to v, and v has no leaving edges. We will consider only circuits, which have exactly one output. Let S be a circuit in the basis B, which has n inputs labeled with variables x1 , . . . , xn . Let us correspond to each node v in the circuit S a Boolean function f v depending on variables x1 , . . . , xn . If v is an input of S labeled with the variable xi , then f v = xi . If v is a gate labeled with a constant c ∈ {0, 1}, then f v = c. Let v be a gate labeled with a function g depending on t > 0 variables. For i = 1, . . . , t, let the edge labeled with the number i leave a node vi and enter the node v. Then f v = g( f v1 , . . . , f vt ). If v is the output of the circuit S and an edge, leaving a node u enters the node v, then f v = f u . The function corresponding to the output of the circuit S will be denoted by f S . We will say that the circuit S implements the function f S . Denote by L(S) the number of gates in the circuit S. The value L(S) characterizes the complexity of the circuit S.
2.1 Basic Notions
17
Denote by Circ(B) the set of circuits in the basis B. Denote F (B) = { f S : S ∈ Circ(B)}. One can show that F (B) = [B] \ {0, 1}, where [B] is the closure of the set B relatively to operation of substitution and operations of insertion and deletion of unessential variable.
2.1.2 Set of Tuples of Constant Faults at Inputs of Gates Let S be a circuit in the basis B. Edges entering gates of the circuit S will be called inputs of gates. Let the circuit S have m gate inputs. The circuit S will be called degenerate if m = 0 and nondegenerate if m > 0. Let S be a nondegenerate circuit. Later we will assume that the gate inputs in the circuit S are enumerated by numbers from 1 to m. Thus, each edge entering a gate has a sequential number in the circuit besides the number attached to it and corresponding to the gate. We will consider the faults in the circuit S, which consist in appearance of Boolean constants at gate inputs. Each fault of such kind is defined by a tuple of constant faults at inputs of gates of the circuit S, which is an arbitrary m-tuple of the kind w˜ = (w1 , . . . , wm ) ∈ {0, 1, 2}m . If wi = 2, then the ith gate input in the circuit S operates properly. If wi = 2, then the ith gate input in the circuit S is faulty and implements the constant wi . Define a circuit S(w) ˜ in the basis B ∪ {0, 1}, which will be interpreted as the result of action of the tuple of faults w˜ on the circuit S. Let us overlook all gate inputs in the circuit S. Let i ∈ {1, . . . , m}. If wi = 2, then the ith gate input will be left without changes. Let wi = 2 and the ith gate input is the edge d leaving the node v1 and entering the node v2 . Add to the circuit S a new gate v(wi ), which is labeled with the constant wi . Instead of the node v1 connect the edge d to the node v(wi ). A set of tuples of constant faults at inputs of gates of the circuit S is a subset W ˜ : of the set {0, 1, 2}m containing the tuple (2, . . . , 2). Denote Circ(S, W ) = {S(w) w˜ ∈ W }. Note that S((2, . . . , 2)) = S.
2.1.3 Problem of Diagnosis Let S be a nondegenerate circuit in the basis B with n inputs labeled with variables x1 , . . . , xn and m gate inputs, and let W be a set of tuples of constant faults at gate inputs of the circuit S. The diagnosis problem for the circuit S relative to the faults from W : for a given circuit S ∈ Circ(S, W ), it is required to recognize the function implemented by the circuit S . We denote this problem z S,W . The solution of the problem z S,W for a circuit S ∈ Circ(S, W ) is a formula, which implements a function equal to f S , or a tuple w˜ ∈ W such that f S = f S(w) ˜ . As in Appendix A, two Boolean functions are called equal if one of them can be obtained from the other by operations of insertion and deletion of unessential variable.
18
2 Diagnosis of Constant Faults at Inputs of Gates in Circuits
Later, we will often consider the set {0, 1, 2}m of all possible tuples of constant faults at inputs of gates of the circuit S. Denote z S = z S,{0,1,2}m .
2.1.4 Decision Trees To solve the problem z S,W , we will use decision trees for which each attribute consists in observation of output of the circuit S ∈ Circ(S, W ) at the inputs of which a tuple from the set {0, 1}n is given. A decision tree over circuit S is a directed tree with root in which each terminal node is labeled with a Boolean function depending on variables x1 , . . . , xn given by a formula or a tuple of constant faults at inputs of gates of the circuit S (the result of the decision tree work), each nonterminal node (we call such nodes working) is labeled with a tuple from the set {0, 1}n (attribute), two edges leave each working node that are labeled with the numbers 0 and 1, respectively. Let Γ be a decision tree over circuit S. A complete path in Γ is an arbitrary sequence ξ = v1 , d1 , . . . , vt , dt , vt+1 of nodes and edges of Γ such that v1 is the root, vt+1 is a terminal node, and, for i = 1, . . . , t, the edge di leaves the node vi and enters the node vi+1 . The number t is called the length of the path ξ (if the path contains only one node, then t = 0). We now define the notion of the complete path corresponding to the circuit S ∈ Circ(S, W ). If t = 0, then the complete path ξ corresponds to the circuit S . Let t > 0 and let, for i = 1, . . . , t, the node vi be labeled with the tuple σ˜ i and the edge di be labeled with the number δi ∈ {0, 1}. The path ξ corresponds to the circuit S if and only if f S (σ˜ i ) = δi for i = 1, . . . , t. It is clear that, for any circuit S ∈ Circ(S, W ), in the decision tree Γ there exists exactly one complete path, which correspond to the circuit S . The work of the decision tree Γ for the circuit S finishes in the terminal node of this path. We will say that the decision tree Γ over the circuit S solves the problem z S,W if, for any circuit S ∈ Circ(S, W ), the terminal node of the complete path corresponding to S is labeled with a formula, which implements a function equal to f S , or a tuple w˜ ∈ W such that f S = f S(w) ˜ . As complexity of a decision tree, we will consider its depth, which is the maximum length of a complete path in this tree. We denote by h(Γ ) the depth of the decision tree Γ . By h(S), we denote the minimum depth of a decision tree solving the problem z S —the problem of diagnosis of the circuits S relative to faults from the set {0, 1, 2}m . If S is a degenerate circuit, then h(S) = 0. Example 2.1 Let S0 be a circuit with one gate represented in Fig. 2.1(a). For this circuit, L(S0 ) = 1. We will consider all possible tuples of constant faults at gate inputs of S0 . The circuit S0 (possible, with faults) implements a function from the set {x ∧ y, x, y, 0, 1}. In Fig. 2.1(b), one can see a decision tree, which solves the problem z S0 . The depth of this decision tree is equal to 3. One can show that h(S0 ) = 3.
2.2 Diagnosis of Arbitrary and Specially Constructed Circuits
x
y
1
2 x∧y
01
0 0 0
11
0 x∧y
19
1 10
(a)
1 0 y
10
1 1
1 x (b)
Fig. 2.1 Circuit S0 and decision tree solving problem z S0
2.2 Diagnosis of Arbitrary and Specially Constructed Circuits In this section, the complexity of decision trees for diagnosis of arbitrary and specially constructed circuits is studied.
2.2.1 Arbitrary Circuits The first direction of investigation comprises the study of the depth of diagnostic decision trees for arbitrary circuits in the basis B. Let us consider for this purpose the function h (1) B , which characterizes the worst-case dependency of h(S) on L(S) on the set Circ(B) of circuits. The function h (1) B will be defined in the following way: h (1) B (n) = max{h(S) : S ∈ Circ(B), L(S) ≤ n} . The basis B will be called primitive if at least one of the following conditions holds: • Every function from B is either a disjunction x1 ∨ . . . ∨ xn or a constant. • Every function from B is either a conjunction x1 ∧ . . . ∧ xn or a constant. • Every function from B is a linear function x1 + . . . + xn + c (mod 2), where c ∈ {0, 1} and n ≥ 0. Theorem 2.1 For any basis B, the following statements hold: (a) If B is a primitive basis, then h (1) B (n) = O(n). 1/2 ). (b) If B is a non-primitive basis, then log2 h (1) B (n) = Ω(n
20
2 Diagnosis of Constant Faults at Inputs of Gates in Circuits
2.2.2 Specially Constructed Circuits As opposed to the first one, the second direction of research explores the depth of diagnostic decision trees for circuits implementing Boolean functions given as formulas over B. These circuits are not arbitrary but chosen as the best from the point of view of solving of the diagnosis problem. Let Φ(B) be the set of formulas over the basis B. For a formula ϕ ∈ Φ(B), we will denote by L(ϕ) the number of functional symbols in ϕ. Let ϕ implement a function, which does not belong to the set {0, 1}. Set h(ϕ) = min h(S), where the minimum is taken over all possible circuits S (not necessarily in the basis B), which implement the same function as the formula ϕ. If ϕ implements a function from the set {0, 1}, then h(ϕ) = 0. We will study the behavior of a function h (2) B , which characterizes the worst-case dependency of h(ϕ) on L(ϕ) on the set of formulas over B and is defined as follows: h (2) B (n) = max{h(ϕ) : ϕ ∈ Φ(B), L(ϕ) ≤ n} . Theorem 2.2 For an arbitrary basis B, the following statements hold: (a) If B is a primitive basis, then h (2) B (n) = O(n). c (b) If B is a non-primitive basis, then the equality log2 h (2) B (n) = Ω(n ) holds for certain positive constant c, which depends only on B.
2.2.3 Auxiliary Statements Let us prove three statements, which are used in this and following sections. Lemma 2.1 Let B be a basis, S be a circuit in the basis B with n inputs and m > 0 gate inputs, w˜ 0 , w˜ 1 , . . . , w˜ r be tuples from {0, 1, 2}m such that f S(w˜ 0 ) = f S(w˜ i ) for i = 1, . . . , r , and p be the minimum cardinality of a set of tuples from {0, 1}n on which the function f S(w˜ 0 ) is distinct from all functions f S(w˜ 1 ) , . . . , f S(w˜ r ) . Then h(S) ≥ p. Proof Let Γ be a decision tree, which solves the problem z S and for which h(Γ ) = h(S), and ξ be the complete path in Γ , which corresponds to the circuit S(w˜ 0 ). It is clear that on the set of tuples attached to working nodes of the path ξ , the function f S(w˜ 0 ) is distinct from all functions f S(w˜ 1 ) , . . . , f S(w˜ r ) . Therefore the length of the path ξ is at least p. Hence h(Γ ) ≥ p and h(S) ≥ p. Next statement is a simple corollary of a result of Ugol’nikov from [9]. Lemma 2.2 Let B1 and B2 be bases such that [B1 ] ⊆ [B2 ]. Then there exist constants c1 , c2 ≥ 1 with the following property: for any formula ϕ1 over B1 , there exists a formula ϕ2 over B2 , which implements the function equal to the function implemented by the formula ϕ1 and for which L(ϕ2 ) ≤ c1 (L(ϕ1 ))c2 .
2.2 Diagnosis of Arbitrary and Specially Constructed Circuits
21
Proof Let ϕ be a formula over some basis. Denote by Λ(ϕ) the number of symbols of variables and constants in the formula ϕ. It has been proven in [9] that there exist constants d1 , d2 ≥ 1 such that, for any formula ϕ1 over B1 , there exists a formula ϕ2 over B2 , which implements a function equal to the function implemented by the formula ϕ1 and for which Λ(ϕ2 ) ≤ d1 (Λ(ϕ1 ))d2 . Let ϕ1 be a formula over B1 . Denote by ϕ2 a formula over B2 , satisfying the following conditions: (a) ϕ2 implements a function, which is equal to the function implemented by the formula ϕ1 . (b) Λ(ϕ2 ) ≤ d1 (Λ(ϕ1 ))d2 . (c) ϕ2 has the minimum number of functional symbols among all formulas satisfying the conditions (a) and (b). The formula ϕ2 can be represented in a natural way as a finite rooted directed tree D nodes of which are labeled with symbols of variables or functions. Denote by Λ0 the number of nodes in D, which are labeled with symbols of variables or constants. Let Λ1 be the number of nodes in D, which are labeled with symbols of functions of one variable. Denote by Λ2 the number of nodes in D, which are labeled with symbols of functions of two and more variables. It is clear that the number of terminal nodes in the tree D is equal to Λ0 . Using Lemma 3.12 from [7], one can show that Λ0 + Λ2 ≤ 2Λ0 and hence Λ2 ≤ Λ0 . Since the formula ϕ2 satisfies the condition (c), the tree D does not contain three nodes consecutively linked by edges such that they are labeled with symbols of monadic functions. Using this fact, one can show Λ1 ≤ 2(Λ0 + Λ2 ) ≤ 4Λ0 . It is clear that Λ(ϕ2 ) = Λ0 and L(ϕ2 ) ≤ Λ0 + Λ1 + Λ2 . Therefore L(ϕ2 ) ≤ 6Λ0 = 6Λ(ϕ2 ). Denote by p the maximum number of variables in functions from B1 . Evidently, Λ(ϕ1 ) ≤ ( p + 1)L(ϕ1 ). Taking into account that ϕ2 satisfies the condition (b) obtain L(ϕ2 ) ≤ 6Λ(ϕ2 ) ≤ 6d1 (Λ(ϕ1 ))d2 ≤ 6d1 (( p + 1)L(ϕ1 ))d2 = 6d1 ( p + 1)d2 (L(ϕ1 ))d2 . Set c1 = 6d1 ( p + 1)d2 and c2 = d2 . Then L(ϕ2 ) ≤ c1 (L(ϕ1 ))c2 . Since ϕ1 is an arbitrary formula over B1 , the statement of the lemma holds. Lemma 2.3 Let B be a non-primitive basis. Then there exist the functions ψ1 (x, y, z) and ψ2 (x, y, z) in [B] such that ψ1 (x, y, 1) = x ∨ y and ψ2 (x, y, 0) = x ∧ y. Proof From the results contained in Appendix A it follows that at least one of the relations F2∞ ⊆ [B], D2 ⊆ [B], and F6∞ ⊆ [B] holds, where F2∞ = [{x ∨ (y ∧ z)}], D2 = [{(x ∧ y) ∨ (x ∧ z) ∨ (y ∧ z)}], and F6∞ = [{x ∧ (y ∨ z)}]. If F2∞ ⊆ [B], then we can take functions x ∨ (y ∧ z) and z ∨ (x ∧ y) in the capacity of the functions ψ1 and ψ2 . If D2 ⊆ [B], then in the capacity of the functions ψ1 and ψ2 we can take one and the same function (x ∧ y) ∨ (x ∧ z) ∨ (y ∧ z). If F6∞ ⊆ [B], then we can take the functions z ∧ (x ∨ y) and x ∧ (y ∨ z) in the capacity of the functions ψ1 and ψ2 .
22
2 Diagnosis of Constant Faults at Inputs of Gates in Circuits
2.2.4 Proofs of Theorems 2.1 and 2.2 Let IN be the set of nonnegative integers {0, 1, 2, . . .}. The following statement char(2) acterizes relationships between the functions h (1) B and h B . Lemma 2.4 Let B be a basis. Then, for any n ∈ IN \ {0}, the values of h (1) B (n) and (2) (2) (1) h B (n) are definite and the inequality h B (n) ≤ h B (n) holds. Proof Let n ∈ IN \ {0}. It is clear that {S : S ∈ Circ(B), L(S) ≤ n} is a nonempty set. Denote by p the maximum number of variables in functions from B. Let S be a circuit in the basis B such that L(S) ≤ n. Assume that S is a nondegenerate circuit. It is clear that the number of inputs of the circuit S, which are connected by edges with gates is at most pn. Using this fact, one can show that h(S) ≤ 2 pn . If S is a degenerate circuit, then h(S) = 0 < 2 pn . Taking into account that S is an arbitrary circuit in the basis B with L(S) ≤ n, we obtain that the value h (1) B (n) is definite. It is clear that {ϕ : ϕ ∈ Φ(B), L(ϕ) ≤ n} is a nonempty set. Let ϕ ∈ Φ(B) and L(ϕ) ≤ n. If the formula ϕ implements a function belonging to the set {0, 1}, then h(ϕ) = 0 ≤ h (1) B (n). Let ϕ implement a function, which does not belong to {0, 1}. It is not difficult to construct a circuit S in the basis B, which implements the same function as the formula ϕ and for which L(S) = L(ϕ) ≤ n. It is clear that h(ϕ) ≤ h(S) ≤ h (1) B (n). Since ϕ is an arbitrary formula over B for which L(ϕ) ≤ n, we (2) (1) conclude that the value h (2) B (n) is definite and that the inequality h B (n) ≤ h B (n) holds. Let us study the behavior of the function h (1) B for an arbitrary primitive basis B. We denote by k(B) the maximum number of essential variables in a function from B. Lemma 2.5 Let B be a primitive basis. Then h(S) ≤ (k(B) + 1)L(S) for any circuit S in the basis B. Proof Since B is a primitive basis, at least one of the relations [B] ⊆ S6 , [B] ⊆ P6 , [B] ⊆ L 1 holds, where S6 = [{x ∨ y, 0, 1}], P6 = [{x ∧ y, 0, 1}], and L 1 = [{x + y(mod 2), 1}]. Consider the case [B] ⊆ L 1 . Let S be a circuit from Circ(B). Assume that S is a nondegenerate circuit. Let the circuit S have exactly r inputs labeled with variables x1 , . . . , xr , respectively. Denote by m the number of gate inputs in the circuit S. Let exactly t inputs of the circuit S be linked by edges to inputs of gates corresponding to essential variables of functions attached to gates, and let these inputs be labeled with variables xi1 , . . . , xit (possibly, t = 0). One can show that any circuit S from Circ(S, {0, 1, 2}m ) implements a function of the kind (d1 ∧ x1 ) + . . . + (dr ∧ xr ) + d0 (mod 2), where d j ∈ {0, 1}, 0 ≤ j ≤ r . It is clear that d j = 0 for any j ∈ {1, . . . , r } \ {i 1 , . . . , i t }. Let us describe the work of a decision tree solving the problem z S , which is the diagnosis problem for the circuit S relative to the faults from the set {0, 1, 2}m . Let S ∈ Circ(S, {0, 1, 2}m ). Give at the inputs of the circuit S the tuple consisting of
2.2 Diagnosis of Arbitrary and Specially Constructed Circuits
23
zeros. We obtain at the output of the circuit S the value d0 . For each j ∈ {1, . . . , t}, give some tuple at inputs of the circuit S . Let j ∈ {1, . . . , t}. Give one at the input of the circuit S labeled with the variable xi j , and give zeros at the other inputs of the circuit. We obtain the value di j + d0 (mod 2) at the output of the circuit. Thus, after the giving at the inputs of the circuit S the considered t + 1 tuples, the coefficients d1 , . . . , dr , d0 of the formula (d1 ∧ x1 ) + . . . + (dr ∧ xr ) + d0 (mod 2) will be recognized. Hence the considered decision tree solves the problem z S , and the depth of this decision tree is at most t + 1. Therefore h(S) ≤ t + 1. It is clear that t ≤ k(B)L(S). Then h(S) ≤ (k(B) + 1)L(S). If S is a degenerate circuit, then h(S) = 0 < (k(B) + 1)L(S). The cases [B] ⊆ S6 and [B] ⊆ P6 can be considered in the same way. (2) Let us study the behavior of the functions h (1) B and h B for a non-primitive basis B.
Lemma 2.6 Let B be a non-primitive basis. Then the following statements hold: 1/2 (a) log2 h (1) ). B = Ω(n c (b) There exists a constant c ≥ 0 such that log2 h (2) B = Ω(n ). Proof Using Lemma 2.3, we obtain that there exist the functions ψ1 (x, y, z) and ψ2 (x, y, z) from [B] such that ψ1 (x, y, 1) = x ∨ y and ψ2 (x, y, 0) = x ∧ y. Denote B1 = {ψ1 , ψ2 }. Let r ∈ IN \ {0}. It is easily to show that there exists a formula ϕr over B1 with the following properties: ϕr implements the function gr = gr (x1 , . . . , xr , y1 , . . . , yr , z 1 , . . . , zr , t1 , . . . , tr , u 0 , u 1 ) such that gr (x1 , . . . , xr , y1 , . . . , yr , z 1 , . . . , zr , t1 , . . . , tr , 0, 1) = rj=1 ((x1 ∨ y1 ) ∧ · · · ∧ (x j−1 ∨ y j−1 ) ∧ (x j ∧ y j ) ∧ (x j+1 ∨ y j+1 ) ∧ · · · ∧ (xr ∨ yr )) ∨ ri = 1 ((xi ∧ z i ) ∨ (yi ∧ ti )) and the inequality L(ϕr ) ≤ 6r 2 holds. Let S be a circuit in an arbitrary basis implementing a function equal to the function gr . Let us show that h(S) ≥ 2r . Let the circuit S have exactly n inputs. One can show that the variables x1 , . . . , xr , y1 , . . . , yr , z 1 , . . . , zr , t1 , . . . , tr are essential variables of the function gr . Therefore the circuit S has inputs labeled with these variables. If the variable u i , i ∈ {0, 1}, is an essential variable of the function gr , then S has an input labeled with this variable. Thus, the circuit S implements a function f S (x1 , . . . , xr , y1 , . . . , yr , z 1 , . . . , zr , t1 , . . . , tr , . . .) depending on m ≥ 4r variables and equal to the function gr . Let σ˜ = (σ1 , . . . , σ2r ) ∈ {0, 1}2r . Define a tuple w(σ˜ ) of constant faults at inputs of the circuit S. For i = 1, . . . , r , the constant σi is implemented at all gate inputs connected to the input z i of the circuit S. For i = 1, . . . , r , the constant σr +i is implemented at all gate inputs connected to the input ti of the circuit S. For i = 0, 1, the constant i is implemented at all gate inputs connected to the input u i of the circuit S (if such input exists). The other gate inputs in the circuit S operate correctly. Denote by f σ˜ the function implemented by the circuit S(w(σ˜ )). It is clear that the function f σ˜ is obtained from the function f S by substitution of the constants σ1 , . . . , σ2r for the variables z 1 , . . . , zr , t1 , . . . , tr and of the constant i for
24
2 Diagnosis of Constant Faults at Inputs of Gates in Circuits
the variable u i (if S contains the input u i ), i = 0, 1. Denote by the set of all possible tuples σ˜ = (σ1 , . . . , σ2r ) ∈ {0, 1}2r such that σi + σr +i = 1 for i = 1, . . . , r . Denote by 0˜ the tuple (0, . . . , 0) from {0, 1}2r . Let σ˜ = (σ1 , . . . , σ2r ) ∈ . One can show that the functions f 0˜ and f σ˜ differ on a tuple (δ1 , . . . , δm ) ∈ {0, 1}m if and only if the equalities δ1 = σ1 , . . . , δ2r = σ2r hold. It is clear that || = 2r . Hence the minimum cardinality of the set of tuples from {0, 1}m on which the function f 0˜ differs from all functions f σ˜ , σ˜ ∈ , is equal to 2r . Using Lemma 2.1, obtain h(S) ≥ 2r . (a) Using the relation B1 ⊂ [B] one can show that there exists a constant d1 ≥ 1 with the following property: for any r ∈ IN \ {0}, there exists a circuit Sr in the basis B, which implements the function gr and for which L(Sr ) ≤ d1 r 2 . Set c1 = 4d1 . Let n ∈ IN and n ≥ c1 . Denote r = (n/d1 )1/2 . One can show that L(Sr ) ≤ d1r 2 ≤ 1/2 1/2 n 1/2 /c1 and log2 h (1) n and h(Sr ) ≥ 2r = 2 (n/d1 ) ≥ 2n /c1 . Hence h (1) B (n) ≥ 2 B = 1/2 Ω(n ). (b) It is clear that [B1 ] ⊆ [B]. Using Lemma 2.2, we conclude that there exist constants d2 , d3 ≥ 1 with the following property: for any r ∈ IN \ {0}, there exists a formula πr over B, which implements a function equal to the function gr and for which L(πr ) ≤ d2 r d3 . Set c2 = 2d3 d2 and c = 1/d3 . Let n ∈ IN and n ≥ c2 . Denote r = (n/d2 )1/d3 . One can show that L(πr ) ≤ d2 r d3 ≤ n and h(πr ) ≥ 2r = 1/d c n c /c2 c and log2 h (1) 2 (n/d2 ) 3 ≥ 2n /c2 . Hence h (2) B (n) ≥ 2 B = Ω(n ). Proof (of Theorem 2.1) The statement of the theorem follows from Lemmas 2.5 and 2.6. Proof (of Theorem 2.2) The statement of the theorem follows from Lemmas 2.4, 2.5, and 2.6.
2.3 Complexity of Diagnostic Decision Tree Construction The third direction of research is to study the complexity of algorithms for construction of decision trees for diagnosis problem. A basis B will be called degenerate if B ⊆ {0, 1}, and nondegenerate, otherwise. If B is a degenerate basis, then each circuit S in the basis B is degenerate, and h(S) = 0. Let B be a nondegenerate basis. Define an algorithmic problem Con(B). The problem Con(B): for a given circuit S from Circ(B) and a given set W of tuples of constant faults at inputs of gates of the circuit S, it is required to construct a decision tree, which solves the diagnosis problem for the circuit S relative to the faults from W . Note that there exists a decision tree, which solves the diagnosis problem for the circuit S relative to the faults from W and the number of nodes in which is at most 2 |W | − 1.
2.3 Complexity of Diagnostic Decision Tree Construction
25
Theorem 2.3 Let B be a nondegenerate basis. Then the following statements hold: (a) If B is a primitive basis, then there exists an algorithm, which solves the problem Con(B) with polynomial time complexity. (b) If B is a non-primitive basis, then the problem Con(B) is NP-hard.
2.3.1 Proof of Theorem 2.3 We now study the complexity of the problem Con(B) solving for a nondegenerate primitive basis B. Lemma 2.7 Let B be a nondegenerate primitive basis. Then there exists an algorithm with polynomial time complexity, which solves the problem Con(B). Proof Since the basis B is primitive, at least one of the relations [B] ⊆ S6 , [B] ⊆ P6 , [B] ⊆ L 1 holds. Consider the case [B] ⊆ S6 . Let S be a circuit in the basis B with n inputs labeled with variables x1 , . . . , xn , and let W be a set of tuples of constant faults at gate inputs of the circuit S. One can show that any circuit S ∈ Circ(S, W ) implements a function of the kind (2.1) (c1 ∧ x1 ) ∨ ... ∨ (cn ∧ xn ) ∨ c0 , where c0 , c1 , . . . , cn ∈ {0, 1}. Denote by δ˜0 the n-tuple (0, . . . , 0). For i = 1, . . . , n, denote by δ˜i the n-tuple (0, . . . , 0, 1, 0, . . . , 0) in which 1 is in the ith digit. One can show that, for the recognition of the coefficients c0 , c1 , . . . , cn in the formula (2.1), which implements the function f S , it is sufficient to know the values of the function f S on n-tuples δ˜0 , δ˜1 , . . . , δ˜n . In fact, f S (δ˜0 ) = c0 . If c0 = 1, then f S ≡ 1 and we may set c1 = . . . = cn = 1. If c0 = 0, then f S (δ˜i ) = ci for i = 1, . . . , n. Let us show that there exists an algorithm, which solves the problem Con(B) with polynomial time complexity. Let us describe the work of this algorithm for a circuit S and a set W of tuples of faults. By simulating the work of the circuit S(w) ˜ on the tuple δ˜i for each w˜ ∈ W and i ∈ {1, . . . , n}, we will construct in polynomial time a table T with n + 1 columns and |W | rows satisfying the following conditions: • Columns of the tables are labeled with tuples δ˜0 , δ˜1 , . . . , δ˜n , respectively. • Rows of the table are labeled with pairwise different tuples from the set W . ˜ ˜ and • The number f S(w) ˜ (δi ) is in the intersection of the row labeled with the tuple w the column labeled with the tuple δ˜i . Two rows of the table T will be called homogeneous if they differ only in attached tuples from W . Otherwise, these rows are called heterogeneous. The construction of a decision tree begins with a tree consisting of one node v, which is labeled with the table T . If all rows of the table T are homogeneous, then instead of the table T , we label the node v with a tuple from W , which is attached to
26
2 Diagnosis of Constant Faults at Inputs of Gates in Circuits
one of the rows of T . The work of the algorithm is finished. Let in the table T there be heterogeneous rows. We choose a column of T that contains both zeros and ones. Instead of the table T , we label the node v with the tuple from {0, 1}n attached to this column. We add to the tree nodes v0 , v1 and edges d0 , d1 . For i = 0, 1, the edge di leaves the node v and enters the node vi . The edge di is labeled with the number i. The node vi is labeled with the subtable Ti of the table T that consists of rows of T , which in the intersection with chosen column have the number i. Then the algorithm works alternately with nodes v0 and v1 in the same way as with the node v, etc. The work of the algorithm finished, when all terminal nodes of the constructed decision tree are labeled with tuples from W . One can show that the constructed decision tree solves the problem z S,W and has at most 2 |W | − 1 nodes. It is easy to see that the considered algorithm has polynomial time complexity. The cases [B] ⊆ P6 and [B] ⊆ L 1 can be considered in the same way. We now study the complexity of the problem Con(B) solving for a nondegenerate basis B which is not primitive. Lemma 2.8 Let B be a nondegenerate basis, which is not primitive. Then the problem Con(B) is NP-hard. Proof Using Lemma 2.3, one can show that there exist circuits S1 and S2 in the basis B, which implements functions ψ1 (x, y, z) and ψ2 (x, y, z) such that ψ1 (x, y, 1) = x ∨ y and ψ2 (x, y, 0) = x ∧ y. Assume that there exists an algorithm, which solves the problem Con(B) and has polynomial time complexity. Let us show that in this case there exists an algorithm, which has polynomial time complexity and solves the vertex cover problem which is NP-complete. In this problem, for a given undirected graph G without loops and multiple edges and a number m ∈ IN, it is required to recognize whether the inequality cv(G) ≤ m holds, where cv(G) is the minimum cardinality of vertex cover of the graph G. Let G = (V, R), where V = {v1 , . . . , vn } is the set of vertices of the graph G and R = {{vi1 , v j1 }, . . . , {vit , v jt }} is the set of edges of the graph G. If m ≥ n, then the inequality cv(G) ≤ m holds. If m = 0, then the inequality cv(G) ≤ m holds if and only if R = ∅. Assume 0 < m < n. Consider the Boolean function ψG (x1 , . . . , xn ) = (xi1 ∨ x j1 ) ∧ . . . ∧ (xit ∨ x jt ). It is clear that inequality cv(G) ≤ m holds if and only if the function ψG has the value 1 on an n-tuple from ψnm+1 : {0, 1}n → {0, 1} {0, 1}n containing at most m numbers 1. Define a function n m+1 xi ≥ m + 1. in the following way: ψn (x1 , . . . , xn ) = 1 if and only if i=1 Using the circuits S1 and S2 , it is easily to construct in polynomial time a circuit S in the basis B with n inputs, and two tuples w˜ 1 , w˜ 2 of constant faults at gate inputs of the circuit S such that the circuit S(w˜ 1 ) implements the function ψnm+1 (x1 , . . . , xn ) and the circuit S(w˜ 2 ) implements the function ψG (x1 , . . . , xn ) ∨ ψnm+1 (x1 , . . . , xn ). It is clear that f S(w˜ 1 ) = f S(w˜ 2 ) if and only if the inequality cv(G) ≤ m holds. Denote W = {w˜ 1 , w˜ 2 , (2, . . . , 2)}. Apply the algorithm, which solves the problem Con(B) and has polynomial time complexity, to the circuit S and to the set W . As a result, we obtain a decision tree Γ , which solves the problem z S,W . Construct the circuits
2.4 Diagnosis of Iteration-Free Circuits
27
S(w˜ 1 ) and S(w˜ 2 ) and apply the decision tree Γ to them. The results of the decision tree Γ work on circuits S(w˜ 1 ) and S(w˜ 2 ) will be different if and only if the inequality cv(G) ≤ m holds. Note that the processes of construction of circuits S(w˜ 1 ) and S(w˜ 2 ) and of applying to them the decision tree Γ can be carried out in polynomial time. Thus, if an algorithm exists, which solves the problem Con(B) with polynomial time complexity, then an algorithm exists, which solves the vertex cover problem in polynomial time. Hence the problem Con(B) is NP-hard. Proof (of Theorem 2.3) The statement of the theorem follows from Lemmas 2.7 and 2.8.
2.4 Diagnosis of Iteration-Free Circuits From the point of view of solving the problem of diagnosing arbitrary tuples of constant faults at inputs of gates of arbitrary circuits, only primitive bases seem to be admissible. The extension of the set of such bases is possible due to a significant restriction of the class of circuits under consideration. The fourth direction of research is the study of the depth of diagnostic decision trees for iteration-free circuits.
2.4.1 Bounds on Complexity of Diagnostic Decision Trees Let B be a basis. A circuit in the basis B is called iteration-free if each node of it has at most one leaving edge. Let us denote by Circ1 (B) the set of iteration-free circuits in the basis B with only one output. Let us consider the function h (3) B , which characterizes the worst-case dependency of h(S) on L(S) for circuits from Circ1 (B) and is defined in the following way: 1 h (3) B (n) = max{h(S) : S ∈ Circ (B), L(S) ≤ n} .
Let us call a Boolean function f (x1 , . . . , xn ) unate if there exist numbers σ1 , . . . , σn ∈ {0, 1} and a monotone Boolean function g(x1 , . . . , xn ) such that f (x1 , . . . , xn ) = g(x1σ1 , . . . , xnσn ), where x σ = x if σ = 1, and x σ = ¬x if σ = 0. Constants 0 and 1 are unate functions. The basis B will be called quasiprimitive if at least one of the following conditions is true: • All functions from B are linear functions. • All functions from B are unate functions. The class of the quasiprimitive bases is rather large: we will show (see Proposition 2.1) that, for any basis B1 , there exists a quasiprimitive basis B2 such that [B1 ] = [B2 ].
28
2 Diagnosis of Constant Faults at Inputs of Gates in Circuits
Theorem 2.4 Let B be a basis. Then the following statements holds: (a) If B is a quasiprimitive basis, then h (3) B (n) = O(n). (b) If B is not a quasiprimitive basis, then log2 h (3) B (n) = Ω(n).
2.4.2 Quasiprimitive Bases The following statement characterizes the class of quasiprimitive bases. Proposition 2.1 For any basis B1 , there exists a quasiprimitive basis B2 such that [B1 ] = [B2 ]. Proof In Appendix A, for each closed class U of Boolean functions, a basis BU is considered such that U = [BU ]. One can show that for all classes U , with the exception of the classes C2 , C3 and C4 , the basis BU is quasiprimitive. Denote BC2 = {x ∧ y, x ∨ ¬y}, BC3 = {x ∨ y, x ∧ ¬y} and BC4 = {x ∨ y, x ∧ y, x ∨ (y ∧ ¬z)}. From Lemma 18 of [10] it follows C2 = [BC2 ] and C3 = [BC3 ]. From Lemma 17 of [10] it follows that the equality C4 = [{x ∨ y, x ∧ y, g}] holds for any nonmonotone α-function g. One can show that the function x ∨ (y ∧ ¬z) is a nonmonotone α function. Hence C4 = [BC4 ]. Evidently, bases BC2 , BC3 , and BC4 are quasiprimitive. Thus, for any closed class U of Boolean functions, there exists a quasiprimitive basis B such that U = [B]. Let B1 be a basis. Denote U = [B1 ]. By proved above, for the closed class U , there exists a quasiprimitive basis B2 such that U = [B2 ]. The following statement characterizes iteration-free circuits in a basis, which consists of unate functions. Lemma 2.9 Let B be a nondegenerate basis consisting of unate functions, and let S be an iteration-free circuit in the basis B with n inputs and m > 0 gate inputs. Then there exist tuples σ˜ 0 and σ˜ 1 from {0, 1}n such that, for any circuit S ∈ Circ(S, {0, 1, 2}m ), if f S ≡ const, then f S (σ˜ 0 ) = 0 and f S (σ˜ 1 ) = 1. Proof We prove the statement of the lemma by induction on the parameter t = L(S). Consider an arbitrary nondegenerate circuit S ∈ Circ1 (B) for which L(S) = 1. Let the circuit S have n inputs labeled with variables x1 , . . . , xn . Let the only gate v in the circuit S be labeled with the function g of m variables. Assume, for the definiteness, that the inputs of the gate v are connected to the inputs of the circuit S labeled with the variables x1 , . . . , xm . Since g is a unate function, there exists a monotone function q of m variables and the numbers δ1 , . . . , δm ∈ {0, 1} such that g(x1 , . . . , xm ) = q(x1δ1 , . . . , xmδm ). Define two tuples σ˜ 0 and σ˜ 1 from {0, 1}n in the following way: σ˜ 0 = (¬δ1 , . . . , ¬δm , 0, . . . , 0) and σ˜ 1 = (δ1 , . . . , δm , 0, . . . , 0). Let S ∈ Circ(S, {0, 1, 2}m ). It is clear that a function equal to the function f S can be obtained from the function g(x1 , . . . , xm ) by substitution of constants from {0, 1} for some variables. Taking into account that q is a monotone function one can show
2.4 Diagnosis of Iteration-Free Circuits
29
that either f S ≡ const or f S (σ˜ 0 ) = 0 and f S (σ˜ 1 ) = 1. Therefore the statement of the lemma holds if t = 1. Assume that the statement of lemma is true for some t ≥ 1. Show that this statement also holds for t + 1. Let S ∈ Circ1 (B), L(S) = t + 1, the circuit S have m > 0 gate inputs, and the output of the circuit S be linked by an edge to a gate v labeled with a function g. If g ∈ {0, 1}, then f S ≡ const for any S ∈ Circ(S, {0, 1, 2}m ) and the statement of the lemma holds for the circuit S. Let g ∈ / {0, 1} and edges d1 , . . . , dr , which leave nodes v1 , . . . , vr , enter the node v. For i = 1, . . . , r , let Si be a subcircuit of S consisting of nodes and edges such that each of them is contained in a directed path terminating in vi . Let i ∈ {1, . . . , r }. If the subcircuit Si does not contain inputs of S, then a constant is implemented on the ith input of the gate v for any circuit S ∈ Circ(S, {0, 1, 2}m ). If the subcircuit Si does not contain gates, then it consists of one input of the circuit S. Let the subcircuit Si contain at least one input of the circuit S and at least one gate. Add to the subcircuit Si a node u and an edge d leaving the node vi and entering the node u. Denote the obtained graph by G i . It is clear that G i is a nondegenerate circuit from Circ1 (B), and L(G i ) ≤ t. By the inductive hypothesis, for the circuit G i , there exist tuples σ˜ 0i and σ˜ 1i , satisfying the statement of the lemma. Since g is a unate function, there exist a monotone function q(x1 , . . . , xr ) and numbers δ1 , . . . , δr ∈ {0, 1} such that g(x1 , . . . , xr ) = q(x1δ1 , . . . , xrδr ). Define a tuple σ˜ 0 of values of inputs of S. Let i ∈ {1, . . . , r }. If the subcircuit Si consists of the only input of the circuit S, then we give on this input the number ¬δi . Let the subcircuit Si contain at least one input of the circuit S and at least one gate. Then we give on the inputs of the circuit S, included into the subcircuit Si , the tuple σ˜ 0i if δi = 1, and the tuple σ˜ 1i if δi = 0. We give zeros on the inputs of the circuit S not belonging to any subcircuit Si , i ∈ {1, . . . , r }. Define a tuple σ˜ 1 of values of inputs of the circuit S. Let i ∈ {1, . . . , r }. If the subcircuit Si consists of the only input of the circuit S, then we give on this input the number δi . Let the subcircuit Si contain at least one input of the circuit S and at least one gate. Then we give on the inputs of the circuit S, included into the subcircuit Si , the tuple σ˜ 0i if δi = 0, and the tuple σ˜ 1i if δi = 1. We give zeros on the inputs of the circuit S not belonging to any subcircuit Si , i ∈ {1, . . . , r }. Let S ∈ Circ(S, {0, 1, 2}m ) and let, for the definiteness, for any i ∈ {1, . . . , p}, on the ith input of the gate v the function equal to the constant γi is implemented, while, for any i ∈ { p + 1, . . . , r }, on the ith input of the gate v a function is implemented which is not constant. Then δ δ f S (σ˜ 0 ) = q(γ1δ1 , . . . , γ p p , 0, . . . , 0) and f S (σ˜ 1 ) = q(γ1δ1 , . . . , γ p p , 1, . . . , 1). Since q is a monotone function, either f S ≡ const, or f S (σ˜ 0 ) = 0 and f S (σ˜ 1 ) = 1. Hence the statement of the lemma also holds for t + 1. We now study the behavior of the function h (3) B for a quasiprimitive basis B. Let each function from B be linear or be a constant. Then the basis B is primitive. Using (3) (1) Theorem 2.1, we conclude that h (1) B (n) = O(n). It is clear that h B (n) ≤ h B (n) for any natural n. Hence h (3) B (n) = O(n). Let all functions from B be unate. If B is a degenerate basis, then all functions from B are constants and h (3) B (n) = O(n). Let us assume now that the basis B is nondegenerate. Let g be a function from B depending on r > 0 variables, and let
30
2 Diagnosis of Constant Faults at Inputs of Gates in Circuits
Sg be an iteration-free circuit in the basis B with r inputs labeled with variables x1 , . . . , xr and with one gate labeled with the function g. For i = 1, . . . , r , let the ith gate input be linked to the input of the circuit, which is labeled with the variable xi . We denote h(g) = h(Sg ) and c(B) = max{h(g) : g ∈ B \ {0, 1}}. Lemma 2.10 Let B be a nondegenerate basis containing only unate functions. Then h(S) ≤ max(c(B), 1)L(S) for any iteration-free circuit S in the basis B. Proof One can show that, for any function g ∈ B depending on r > 0 variables, there exists a decision tree Γg , which solves the problem z Sg , for which h(Γg ) = h(Sg ), and the result of the work of Γg for any circuit S ∈ Circ(Sg , {0, 1, 2}r ) consists of • A formula ϕ = g(α1 , . . . , αr ) implementing a function equal to f S , where αi = xi if xi is an essential variable of the function f S , and αi is a constant from {0, 1} if xi is not an essential variable of the function f S . • For any essential variable xi of the function f S , a tuple (β1 , . . . , βi−1 , βi+1 , . . . , βr ) ∈ {0, 1}r −1 such that f S (β1 , . . . , βi−1 , 0, βi+1 , . . . , βr ) = f S (β1 , . . . , βi−1 , 1, βi+1 , . . . , βr ). Let c = c(B) = max{h(Γg ) : g ∈ B \ {0, 1}}. Set c1 = max{1, c}. By induction on the parameter t = L(S), we will prove that, for any nondegenerate iteration-free circuit S in the basis B, there exists a decision tree Γ , which solves the problem z S and for which h(Γ ) ≤ c1 L(S). If the circuit S has m gate inputs, then, for any circuit S ∈ Circ(S, {0, 1, 2}m ), the result of Γ work is a formula implementing a function equal to the function f S . Let S ∈ Circ1 (B), L(S) = 1, the only gate of the circuit S be labeled with a function g of r variables, and the ith gate input be linked to the input of the circuit S, which is labeled with a variable x ji , i = 1, . . . , r . For the problem z S solving, we will use the decision tree Γg modified in the following way: we give tuples, generated by the decision tree Γg , on the inputs of the circuit S linked to the gate while on the other inputs of the circuit S we give zeros. In each formula attached to a terminal node of the decision tree Γg , the variables x1 , . . . , xr are replaced by the variables x j1 , . . . , x jr , respectively. One can show that the modified in such a way decision tree Γg solves the problem z S . The depth of this decision tree is at most c1 . Hence if t = 1, then the considered statement holds. Assume that this statement holds for some t ≥ 1. Let us show that it holds for t + 1. Let S ∈ Circ1 (B), L(S) = t + 1, the circuit S have m > 0 gate inputs, and the output of the circuit S be linked by an edge to a gate v, which is labeled with a function g. Let g ∈ {0, 1}. Then f S ≡ g for any circuit S ∈ Circ(S, {0, 1, 2}m ). Denote by Γ the decision tree consisting of only one node labeled with the formula g. It is clear that Γ solves the problem z S and h(Γ ) = 0 < c1 L(S). Therefore the considered statement holds for the circuit S. Assume now that g ∈ / {0, 1}. Let the edges d1 , . . . , dr , leaving nodes v1 , . . . , vr , respectively, enter the gate v. For i = 1, . . . , r , let Si be a subcircuit of S consisting of those nodes and edges of the circuit S everyone of which is included into a directed path terminating in vi . Let i ∈ {1, . . . , r }. If the subcircuit Si does not contain the inputs of the circuit S, then a constant is implemented on the ith input of the gate v for any circuit S ∈ Circ(S, {0, 1, 2}m ). If the subcircuit Si does
2.4 Diagnosis of Iteration-Free Circuits
31
not contain gates, it consists of an only input of the circuit S. Let the subcircuit Si contain at least one input of the circuit S and at least one gate. Add to the subcircuit Si a node u and an edge d leaving the node vi and entering the node u. Denote by G i the obtained graph. Evidently, G i is a nondegenerate circuit from Circ1 (B) for which L(G i ) ≤ t. Let G i have m i gate inputs. By inductive hypothesis, there exists a decision tree Γi , which solves the problem z G i and for which h(Γi ) ≤ c1 L(G i ). Using Lemma 2.9, we obtain that there exist input tuples σ˜ 0i and σ˜ 1i of the circuit G i such that, for any circuit G ∈ Circ(G i , {0, 1, 2}m i ), if f G ≡ const, then f G (σ˜ 0i ) = 0 and f G (σ˜ 1i ) = 1. Let us describe the work of a decision tree Γ , which solves the problem z S . Let S ∈ Circ(S, {0, 1, 2}m ). First, the decision tree Γ simulates in some way the work of the decision tree Γg . The gate v is analyzed at that. Let the decision tree Γg generate the tuple (δ1 , . . . , δr ). Let i ∈ {1, . . . , r }. If the subcircuit Si consists of an only input of the circuit S, then we give the number δi at this input. Let the subcircuit Si contain at least one input of the circuit S and at least one gate. Then we give at the inputs of the circuit S , belonging to the subcircuit Si , the tuple σ˜ 0i if δi = 0, and the tuple σ˜ 1i if δi = 1. We give zeros at the inputs of the circuit S not belonging to any subcircuit Si , i ∈ {1, . . . , r }. Let the result of the work of the decision tree Γg be a formula g(α1 , . . . , αr ). Let, for the definiteness, αi = xi for i = 1, . . . , q and αi be a constant from {0, 1} for i = q + 1, . . . , r . Assume that, for i = 1, . . . , p, the subcircuit Si contains at least one input of the circuit S and at least one gate, and, for i = p + 1, . . . , q, the subcircuit Si consists of one input of the circuit S, which is labeled with the variable xli . Later, the decision tree Γ consequently simulates the work of the decision trees Γ1 , . . . , Γ p . The subcircuits S1 , . . . , S p are analyzed at that. Let i ∈ {1, . . . , p}. Describe the work of the decision tree Γ , when it simulates the decision tree Γi . Let (β1 , . . . , βi−1 , βi+1 , . . . , βr ) be a tuple constructed by the decision tree Γg for an essential variable xi of the function g (x1 , . . . , xr ) = g(α1 , . . . , αr ). For this tuple, g (β1 , . . . , βi−1 , 0, βi+1 , . . . , βr ) = g (β1 , . . . , βi−1 , 1, βi+1 , . . . , βr ). Let j ∈ {1, . . . , r } \ {i}. If the subcircuit S j consists of the only input of the circuit S, then we give the number β j at this input. Let the subcircuit S j contain at least one input of the circuit S and at least one gate. At the inputs of the circuit S , belonging to the j j subcircuit S j , we give the tuple σ˜ 0 if β j = 0, and the tuple σ˜ 1 if β j = 1. At the inputs of S , belonging to the subcircuit Si , we give the tuples generated by the decision tree Γi . We give zeros at the inputs of the circuit S not belonging to any subcircuit S j , j ∈ {1, . . . , r }. If g (β1 , . . . , βi−1 , 0, βi+1 , . . . , βr ) = 1, then the value of the output of the circuit S is inverted before it is used by the decision tree Γi . Let the result of the work of the decision tree Γi be a formula ϕi . After the construction of formulas ϕ1 , . . . , ϕ p in the process of the simulation by the decision tree Γ of the work of decision trees Γ1 , . . . , Γ p , the work of the decision tree Γ is over. The formula g(ϕ1 , . . . , ϕ p , xl p+1 , . . . , xlq , αq+1 , . . . , αr ) will be obtained as the result. One can show that this formula implements a function equal to the function f S . Denote by I the set of all i ∈ {1, . . . , r } such that the subcircuit Si contains at least S and at least one gate. It is one input of the circuit clear that h(Γ ) ≤ h(Γg ) + i∈I h(Γi ) ≤ c1 + c1 i∈I L(G i ) ≤ c1 L(S). Hence the
32
2 Diagnosis of Constant Faults at Inputs of Gates in Circuits
considered statement holds also for t + 1. If S is a degenerate circuit, then h(S) = 0 < c1 L(S). Remark 2.1 Note that it is not necessary to construct the considered decision trees since we can effectively simulate their work if, for each function g ∈ B depending on r > 0 variables, we have a decision tree Γg , which solves the problem z Sg and for which h(Γg ) = h(Sg ).
2.4.3 Non-quasiprimitive Bases In this section, the behavior of the function h (3) B for a non-quasiprimitive basis B is studied. The section also contains the proof of Theorem 2.4. Let us prove some auxiliary statements. Lemma 2.11 Let B be a non-quasiprimitive basis. Then there exists an iterationfree circuit S¬ in the basis B and tuples w˜ 1 and w˜ 2 of constant faults at gate inputs of the circuit S¬ such that circuit S¬ (w˜ 1 ) implements a function equal to x, and the circuit S¬ (w˜ 2 ) implements a function equal to ¬x. Proof Since the basis B is non-quasiprimitive, then there exists a function g(x1 , . . . , xn ) ∈ B, which is not unate. Let us show that there exist a number i ∈ {1, . . . , n} and two tuples (α1 , . . . , αi−1 , αi+1 , . . . , αn ) and (β1 , . . . , βi−1 , βi+1 , . . . , βn ) from {0, 1}n−1 such that g(α1 , . . . , αi−1 , 0, αi+1 , . . . , αn ) = 0 , g(α1 , . . . , αi−1 , 1, αi+1 , . . . , αn ) = 1 , g(β1 , . . . , βi−1 , 0, βi+1 , . . . , βn ) = 1 , g(β1 , . . . , βi−1 , 1, βi+1 , . . . , βn ) = 0 .
(2.2)
Assume the contrary. In this case, for any i ∈ {1, . . . , n}, there exists a number σi ∈ {0, 1} such that, for any tuple (γ1 , . . . , γi−1 , γi+1 , . . . , γn ) ∈ {0, 1}n−1 , the inequality g(γ1 , . . . , γi−1 , σi , γi+1 , . . . , γn ) ≥ g(γ1 , . . . , γi−1 , ¬σi , γi+1 , . . . , γn ) holds. One can show that the function g(x1σ1 , . . . , xnσn ) is monotone. Therefore g(x1 , . . . , xn ) is a unate function, which is impossible. Thus, for any i ∈ {1, . . . , n} and some tuples (α1 , . . . , αi−1 , αi+1 , . . . , αn ), (β1 , . . . , βi−1 , βi+1 , . . . , βn ) ∈ {0, 1}n−1 , the equalities (2.2) hold. Using these equalities one can construct an iteration-free circuit S¬ in the basis B, containing one gate labeled with the function g, and the tuples w˜ 1 and w˜ 2 of constant faults at inputs of this gate such that the circuit S¬ (w˜ 1 ) implements a function equal to x, while the circuit S¬ (w˜ 2 ) implements a function equal to ¬x.
2.4 Diagnosis of Iteration-Free Circuits
33
The proof of the following lemma is similar to the proof of Lemma 11 from [10]. Lemma 2.12 Let B be a non-quasiprimitive basis. Then there exist an iteration-free circuit S∧ in the basis B and a tuple w˜ of constant faults at gate inputs of the circuit ˜ implements a function equal to the function x ∧ y. S∧ such that the circuit S∧ (w) Proof Since B is non-quasiprimitive, it contains a nonlinear function q(x1 , . . . , xn ). It is well known (see Theorem 6 with the consequent note in [10]) that the function q has the unique representation in the form of a Zhegalkin polynomial: q(x1 , . . . , xn ) =
ai1 ...is · xi1 · . . . · xis (mod 2) ,
{i 1 ,...,i s }⊆{1,...,n}
where · is the usual multiplication and ai1 ...is ∈ {0, 1}, {i 1 , . . . , i s } ⊆ {1, . . . , n}. Since q is nonlinear, the Zhegalkin polynomial for q contains a term with at least two variables. Without loss of generality, we can assume that x1 and x2 are among these variables. Then we can transform the considered polynomial as follows: q(x1 , . . . , xn ) = x1 · x2 · q1 (x3 , . . . , xn ) + x1 · q2 (x3 , . . . , xn ) +x2 · q3 (x3 , . . . , xn ) + q4 (x3 , . . . , xn )(mod 2) . From uniqueness of the Zhegalkin polynomial it follows that q1 (x3 , . . . , xn ) ≡ 0. Let α3 , . . . , αn be numbers from {0, 1} such that q1 (α3 , . . . , αn ) = 1. Then χ (x1 , x2 ) = q(x1 , x2 , α3 , . . . , αn ) = x1 · x2 + α · x1 + β · x2 + γ (mod 2), where α, β, γ ∈ {0, 1}. Consider the function ψ(x1 , x2 ) = χ (x1 + β(mod 2), x2 + α(mod 2)) + γ + α · β(mod 2). One can show that ψ(x1 , x2 ) = x1 · x2 = x1 ∧ x2 . Denote σ1 = ¬β, σ2 = ¬α and σ3 = ¬(γ + α · β(mod 2)). Then (q(x1σ1 , x2σ2 , α3 , . . . , αn ))σ3 = x1 ∧ x2 .
(2.3)
From Lemma 2.11 it follows that there exist a circuit S¬ ∈ Circ1 (B) and a tuple u˜ of ˜ implements constant faults at gate inputs of the circuit S¬ such that the circuit S¬ (u) a function equal to the function ¬ x. From the equality (2.3) it follows that based on the function q and on the circuit S¬ we can construct an iteration-free circuit S∧ in the basis B and a tuple w˜ of constant faults at gate inputs of the circuit S∧ such that ˜ implements a function equal to the function x ∧ y. the circuit S∧ (w) Lemma 2.13 Let B be a non-quasiprimitive basis. Then log2 h (3) B (n) = Ω(n). Proof Using Lemma 2.11, we conclude that there exist a circuit S¬ ∈ Circ1 (B) and tuples w˜ 1 and w˜ 2 of constant faults at gate inputs of the circuit S¬ such that the circuit S¬ (w˜ 1 ) implements a function equal to the function x, while the circuit S¬ (w˜ 2 ) implements a function equal to the function ¬x. Using Lemma 2.12, we obtain that there exist a circuit S∧ ∈ Circ1 (B) and a tuple w˜ of constant faults at gate ˜ implements a function equal to inputs of the circuit S∧ such that the circuit S∧ (w) the function x ∧ y.
34
2 Diagnosis of Constant Faults at Inputs of Gates in Circuits
Using the circuits S¬ and S∧ , one can construct for any r ∈ IN \ {0} an iterationfree circuit Sr in the basis B with the following properties: • For any σ˜ = (σ1 , . . . , σr ) ∈ {0, 1}r , there exists a tuple u(σ˜ ) of constant faults at gate inputs of the circuit Sr such that the circuit Sr (u(σ˜ )) implements a function equal to the function x1σ1 ∧ . . . ∧ xrσr . • There exists a tuple v˜ of constant faults at gate inputs of the circuit Sr such that the circuit Sr (˜v ) implements a function equal to the function 0. • L(Sr ) ≤ dr , where d = L(S¬ ) + L(S∧ ). Let us show that h(Sr ) ≥ 2r . Let the circuit Sr have exactly m inputs labeled with variables x1 , . . . , xm . The function implemented by the circuit Sr (˜v) will be denoted by f and, for any tuple σ˜ ∈ {0, 1}r , the function implemented by the circuit Sr (u(σ˜ )) will be denoted by f σ˜ . Let σ˜ = (σ1 , . . . , σr ) ∈ {0, 1}r . One can show that the functions f and f σ˜ have different values on a tuple (δ1 , . . . , δm ) ∈ {0, 1}m if and only if δ1 = σ1 , . . . , δr = σr . Hence the minimum cardinality of a set of tuples from {0, 1}m on which the function f is different from any function f σ˜ , σ˜ ∈ {0, 1}r , is equal to 2r . Using Lemma 2.1, we obtain h(Sr ) ≥ 2r . Set c1 = 2d. Let n ≥ c1 . Denote r = n/d. One can show that L(Sr ) ≤ dr ≤ n n/c1 and log2 h (3) and h(Sr ) ≥ 2r = 2 n/d ≥ 2n/c1 . Hence h (3) B (n) ≥ 2 B (n) = Ω(n). Proof (of Theorem 2.4) The statement of the theorem follows from Lemmas 2.5, 2.10, and 2.13.
2.5 Approach to Circuit Construction and Diagnosis The fifth direction of research deals with the approach to the circuit construction and to the effective diagnosis of faults based on the results obtained for the iteration-free circuits. From Proposition 2.1 and Lemma 2.2 it follows that, for each basis B1 , there exists a quasiprimitive basis B2 with the following properties: • [B1 ] = [B2 ], i.e., the set of functions implemented by circuits in the basis B2 coincides with the set of functions implemented by circuits in the basis B1 . • There exists a polynomial p such that, for any formula ϕ1 over B1 , there exists a formula ϕ2 over B2 , which implements the function equal to that implemented by ϕ1 , and such that L(ϕ2 ) ≤ p(L(ϕ1 )). The considered approach to the circuit construction and fault diagnosis consists in the following. Let ϕ1 be a formula over B1 implementing certain function f , f ∈ / {0, 1}, and let us construct the formula ϕ2 over B2 implementing the function equal to f and satisfying the inequality L(ϕ2 ) ≤ p(L(ϕ1 )). Next a formula-like circuit S in the basis B2 is constructed (according to the formula ϕ2 ) implementing the function f , satisfying the equality L(S) = L(ϕ2 ) and the condition that at most one edge leaves each gate of the circuit S. In addition to the normal operation mode
2.6 Optimal Bases for Some Closed Classes
35
of the circuit S, there exists the diagnostic mode in which the inputs of the circuit S ˜ From Theorem 2.4 it follows are “split” so that it becomes an iteration-free circuit S. ˜ where c is a ˜ ≤ cL(S) ≤ cp(L(ϕ1 )) hold for the circuit S, that the inequalities h( S) constant depending only on the basis B2 . We can use known nontrivial upper bounds on the complexity of formulas implementing functions from closed classes to obtain nontrivial upper bounds on the depth of decision trees for diagnosis of circuits operating in the diagnostic mode. In particular, from the results obtained by Andreev [2] it follows that each monotone Boolean function f with n variables can be implemented by a formula-like circuit S( f ) in the quasiprimitive basis B = {x ∨ y, x ∧ y, 0, 1}, which complexity L(S( f )) is asymp2 √ 2n . π n log2 n
In the next section, we will show that c(B) = 3. From ˜ f )) is asymptotically at most 3 2 √ 2n , where Lemma 2.10 it follows that h( S( π n log2 n ˜ f ) is the iteration-free circuit obtained from the circuit S( f ) by “splitting” its S( inputs. totically at most
2.6 Optimal Bases for Some Closed Classes Let B be a quasiprimitive basis. From Lemmas 2.5 and 2.10 it follows there exists a constant c such that, for any iteration-free combinatorial circuit S in the basis B, the inequality h(S) ≤ cL(S) holds. For the quasiprimitive basis B, we denote by C (B) the minimum nonnegative integer c such that, for any iteration-free circuit S in the basis B, the inequality h(S) ≤ cL(S) holds. From Proposition 2.1 it follows that, for any closed class of Boolean functions U , there exists a quasiprimitive basis B of this class. We denote C (U ) = min{C (B) : B is a quasiprimitive basis of the class U }. A basis B of the class U will be called an optimal basis of the class U if B is a quasiprimitive basis of U such that C (B) = C (U ). The sixth direction of research is to find, for an arbitrary closed class of Boolean functions U with k(U ) ∈ {2, 3}, where k(U ) is the order of the class U , the value of the parameter C (U ) and some optimal quasiprimitive basis B. This problem is solved for all 40 closed classes of Boolean functions U with k(U ) ∈ {2, 3}. Among them there are practically all classes which are most often used in investigations. The solution is based on the following theorem. Theorem 2.5 Let U be a closed class of Boolean functions with k(U ) ∈ {2, 3} and B be a quasiprimitive basis of U with k(B) = k(U ). Then B is an optimal basis for U and C (U ) = C (B) = k(U ) + 1. We preface the proof of this theorem with several auxiliary statements. Let g be a Boolean function with r > 0 variables, and let Sg be an iteration-free circuit with r inputs labeled with variables x1 , . . . , xr and with one gate labeled with the function g. For i = 1, . . . , r , let the ith gate input be linked to the input of the
36
2 Diagnosis of Constant Faults at Inputs of Gates in Circuits
circuit, which is labeled with the variable xi . We denote h(g) = h(Sg ). For any fault w˜ from the set {0, 1, 2}r , the function f Sg (w) ˜ implemented by the circuit Sg with the fault w˜ will be called fault function for g. The set of fault functions for g coincides with the set of subfunctions of g, i.e., functions obtained from g by assigning the constant values 0 and 1 to some variables of g. Lemma 2.14 Let g be a Boolean function with at least t pairwise different fault functions. Then h(g) ≥ log2 t . Proof Let Γ be a decision tree, which solves the problem z Sg and for which h(Γ ) = h(g). Then Γ has at least t terminal nodes. One can show that the number of terminal nodes in Γ is at most 2h(Γ ) . Therefore t ≤ 2h(Γ ) , h(Γ ) ≥ log2 t, and h(g) ≥ log2 t. Since h(g) is an integer, we obtain h(g) ≥ log2 t . Lemma 2.15 Let B be a quasiprimitive basis with k(B) ≥ 2 containing only linear functions. Then C (B) = k(B) + 1. Proof From Lemma 2.5 it follows that h(S) ≤ (k(B) + 1)L(S) for any iterationfree circuit S in the basis B. Therefore C (B) ≤ k(B) + 1. Let g(x1 , . . . , xr ) ∈ B and g have t = k(B) essential variables xi1 , . . . , xit . For each J ⊆ {i 1 , . . . , i t }, we consider the following tuple w˜ J of constant faults at inputs of the only gate of the circuit Sg : 0 at each input corresponding to an unessential variable of the function g and 0 at each input corresponding to a variable x j , j ∈ J . We also consider the following tuple w˜ 1 of constant faults at inputs of the only gate of S: 1 at the input corresponding to the variable xi1 and 0 at each other input. One can show that functions implemented by circuits Sg (w˜ J ), J ⊆ {i 1 , . . . , i t }, and Sg (w˜ 1 ) are pairwise different. Therefore g has at least 2t + 1 fault functions. From Lemma 2.14 it follows that h(g) = h(Sg ) ≥ t + 1 = k(B) + 1, i.e., h(Sg ) ≥ (k(B) + 1)L(Sg ). Thus, C (B) ≥ k(B) + 1 and C (B) = k(B) + 1. Let B be a quasiprimitive basis containing only unate functions. Let us remind that c(B) = max{h(g) : g ∈ B \ {0, 1}}. Lemma 2.16 Let B be a quasiprimitive basis with k(B) ≥ 2 containing only unate functions. Then C (B) = c(B). Proof Let g be a function from B containing k(B) ≥ 2 essential variables. We now consider two tuples of constant faults at the inputs of the only gate in Sg : 0 at each input and no any constants at inputs. It is clear that the circuit Sg with these tuples of faults implements two different functions, i.e., the function g has at least two fault functions. From Lemma 2.14 it follows that h(g) ≥ 1. Hence c(B) ≥ 1. From Lemma 2.10 it follows that h(S) ≤ c(B)L(S) for any iteration-free circuit S in the basis B. Therefore, C (B) ≤ c(B). Let q be a function from B such that h(q) = c(B). Then h(Sq ) = c(B) = c(B)L(Sq ). Thus, C (B) ≥ c(B) and C (B) = c(B). From the next statement it follows that instead of unate functions we can study monotone functions.
2.6 Optimal Bases for Some Closed Classes
37
Lemma 2.17 Let f (x1 , . . . , xn ) be a monotone Boolean function, σ1 , . . . , σn ∈ {0, 1} and g(x1 , . . . , xn ) = f (x1σ1 , . . . , xnσn ). Then h(g) = h( f ). Proof For a˜ = (a1 , . . . , an ) ∈ {0, 1}n , we denote a˜ + = (a1σ1 , . . . , anσn ). For a Boolean function p(x1 , . . . , xn ), we denote p + (x1 , . . . , xn ) = p(x1σ1 , . . . , xnσn ). It is clear ˜ We denote by F( p) the set of fault functions for p and by that p + (a˜ + ) = p(a). F( p)+ we denote the set {q + : q ∈ F( p)}. One can show that F( f ) = F(g)+ and F(g) = F( f )+ . Let Γ be a decision tree that solves the problem z S f or the problem z Sg . We denote by Γ + the decision tree obtained from Γ by the following substitution of tuples and functions attached to working and terminal nodes of Γ . If a working node of Γ is labeled with a tuple a, ˜ then the corresponding working node of Γ + is labeled with the + tuple a˜ . If a terminal node of Γ is labeled with a function p, then the corresponding terminal node of Γ + is labeled with the function p + . One can show that • If Γ is a decision tree that solves the problem z S f , then Γ + is a decision tree that solves the problem z Sg . • If Γ is a decision tree that solves the problem z Sg , then Γ + is a decision tree that solves the problem z S f . From here it follows that h(g) = h( f ).
Let us remind that the number of essential variables of a Boolean function f is denoted by k( f ). The following statement follows from the results obtained in [1]. Lemma 2.18 Let f be a monotone Boolean function with k( f ) ∈ {1, 2, 3, 4}. Then h( f ) ≤ k( f ) + 1. Let f (x1 , . . . , xn ) be a monotone Boolean function. We consider the following partial order ≤ on the set {0, 1}n . Let a˜ = (a1 , . . . , an ), b˜ = (b1 , . . . , bn ) ∈ {0, 1}n . ˜ A tuple Then a˜ ≤ b˜ if a1 ≤ b1 , . . . , an ≤ bn . We will write a˜ < b˜ if a˜ ≤ b˜ and a˜ = b. n ˜ ˜ = 1 and f (b) = 0 for any a˜ ∈ {0, 1} is called a minimal true point for f if f (a) ˜ We denote by mtp( f ) the set of minimal true points for f . b˜ ∈ {0, 1}n such that b˜ < a. We correspond to each minimal true point a˜ = (a1 , . . . , an ) for f the elementary conjunction ec(a) ˜ = xi1 · · · xit , where {i 1 , . . . , i t } = {i : i ∈ {1, . . . , n}, ai = 1}. The number t is called the length of this elementary conjunction. We will represent the ˜ It is clear that function f as a disjunctive normal form dnf( f ) = a∈mtp( ˜ f ) ec(a). all variables in dnf( f ) are essential. Lemma 2.19 Let f be a monotone function. Then h( f ) = k( f ) + 1 if k( f ) ∈ {1, 2, 3} and h( f ) ≥ 4 if k( f ) ≥ 4. Proof (a) Let k( f ) = 1 and x be essential variable of f . Then f is equal to x. It is clear that x has three fault functions: x, 0, and 1. Using Lemma 2.14, we obtain h(x) ≥ 2. From Lemma 2.18 it follows that h(x) ≤ 2. Therefore h(x) = 2. Thus, if k( f ) = 1, then h( f ) = k( f ) + 1.
38
2 Diagnosis of Constant Faults at Inputs of Gates in Circuits
(b) Let k( f ) = 2 and x, y be essential variables of f . Then f is equal to x ∨ y or x y. It is clear that the function x ∨ y has five fault functions x ∨ y, x, y, 0, 1 and the function x y also has five fault functions x y, x, y, 0, 1. Using Lemmas 2.14 and 2.18, we obtain h(x ∨ y) = 3 and h(x y) = 3. Thus, if k( f ) = 2, then h( f ) = k( f ) + 1. (c) Let k( f ) = 3 and x, y, z be essential variables of f . Consider the representation of the function f as dnf( f ) for all possible three values |mtp( f )|. • If |mtp( f )| = 1, then f is equal to x yz. • If |mtp( f )| = 2, then f is equal to x ∨ yz or x y ∨ x z, or can be obtained from one of these functions by renaming of variables without identification. • If |mtp( f )| = 3, then f is equal to x ∨ y ∨ z or x y ∨ x z ∨ yz. We now show that each of the considered functions has at least nine fault functions: • • • •
x yz has the following fault functions: x yz, x y, x z, yz, x, y, z, 0, 1. x ∨ yz has the following fault functions: x ∨ yz, x ∨ y, x ∨ z, yz, x, y, z, 0, 1. x y ∨ x z has the following fault functions: x y ∨ x z, x y, x z, y ∨ z, x, y, z, 0, 1. x ∨ y ∨ z has the following fault functions: x ∨ y ∨ z, x ∨ y, x ∨ z, y ∨ z, x, y, z, 0, 1. • x y ∨ x z ∨ yz has the following fault functions: x y ∨ x z ∨ yz, x y, x z, yz, x, y, z, 0, 1.
Using Lemmas 2.14 and 2.18, we obtain h( f ) = 4. Thus, if k( f ) = 3, then h( f ) = k( f ) + 1. (d) Let k( f ) ≥ 4 and f is represented as dnf( f ). We now show that f has at least nine different fault functions. We consider a number of cases. (d.1) Let the length of each elementary conjunction in dnf( f ) be equal to 1. Then, for some pairwise different variables x, y, z from dnf( f ), the function x ∨ y ∨ z is a fault function for f . It is clear that the following nine functions are fault functions for f : x ∨ y ∨ z, x ∨ y, x ∨ z, y ∨ z, x, y, z, 0, 1. (d.2) Let dnf( f ) contain an elementary conjunction, which length is greater than or equal to 3. Then, for some pairwise different variables x, y, z from dnf( f ), the function x yz is a fault function for f . It is clear that the following nine functions are fault functions for f : x yz, x y, x z, yz, x, y, z, 0, 1. (d.3) Let dnf( f ) contain elementary conjunctions of the length 1 and 2. Then, for some pairwise different variables x, y, z from dnf( f ), the function x ∨ yz is a fault function for f . It is clear that the following nine functions are fault functions for f : x ∨ yz, x ∨ y, x ∨ z, yz, x, y, z, 0, 1. (d.4) Let the length of each elementary conjunction in dnf( f ) be equal to 2. Choose one elementary conjunction x y in dnf( f ). Consider two possibilities. (d.4.1) There is another elementary conjunction zt in dnf( f ) such that {x, y} ∩ {z, t} = ∅. As a result, in dnf( f ), there are elementary conjunctions x y, zt and, maybe, some other elementary conjunctions of the length 2 and with variables from the set {x, y, z, t}. We denote by ϕ the disjunction of all these elementary conjunctions. If we assign 0 to each variable of f that does not belong to the set {x, y, z, t},
2.6 Optimal Bases for Some Closed Classes
39
we obtain that ϕ is a fault function for f . Therefore the following nine functions are fault functions for f : ϕ, x y, zt, x, y, z, t, 0, 1. (d.4.2) All other elementary conjunctions in dnf( f ) have common variables with x y. As a result, for some variables z, t such that {x, y} ∩ {z, t} = ∅, in dnf( f ), there are elementary conjunctions x y, x z (or yz) and xt (or yt) and, maybe, some other elementary conjunctions of the length 2 with variables from the set {x, y, z, t}. We denote by ψ the disjunction of all these elementary conjunctions. If we assign 0 to each variable of f that does not belong to the set {x, y, z, t}, we obtain that ψ is a fault function for f . Therefore the eight functions ψ, x y, x, y, z, t, 0, 1 and at least one function from the set {x z, yz, xt, yt} are fault functions for f . Thus, if k( f ) ≥ 4, then f has at least nine fault functions. Using Lemma 2.14, we obtain h( f ) ≥ 4. Proof (of Theorem 2.5) (a) Let B contain only linear functions. By Lemma 2.15, C (B) = k(B) + 1. Let B be an arbitrary quasiprimitive basis of the class U . Then k(B ) ≥ k(U ). It is clear that B contains only linear functions. By Lemma 2.15, C (B ) = k(B ) + 1 ≥ k(U ) + 1 = k(B) + 1. Therefore B is an optimal basis for U and C (U ) = C (B) = k(U ) + 1. (b) Let B contain only unate functions. By Lemma 2.16, C (B) = c(B), where c(B) = max{h(g) : g ∈ B \ {0, 1}}. Using Lemmas 2.17 and 2.18, we obtain c(B) ≤ k(B) + 1 = k(U ) + 1. Let B be an arbitrary quasiprimitive basis of the class U . Then k(B ) ≥ k(U ). It is clear that B contains only unate functions. By Lemma 2.16, C (B ) = c(B ). Let f be a function from B such that k( f ) = k(B ). Then f is a unate function and, by Lemmas 2.17 and 2.19, h( f ) = k( f ) + 1 if k( f ) ∈ {1, 2, 3} and h( f ) ≥ 4 if k( f ) ≥ 4. From here it follows that h( f ) ≥ k(U ) + 1. Therefore c(B ) ≥ k(U ) + 1. Thus, B is an optimal basis for U and C (U ) = C (B) = k(U ) + 1. In Appendix A, for each closed class U of Boolean functions, a basis BU is considered such that k(BU ) = k(U ). One can show that, for all classes U with the exception of the classes C2 , C3 and C4 , the basis BU is quasiprimitive. In the proof of Proposition 2.1 it was shown that the new bases BC2 = {x ∧ y, x ∨ ¬y}, BC3 = {x ∨ y, x ∧ ¬y} and BC4 = {x ∨ y, x ∧ y, x ∨ (y ∧ ¬z)} are quasiprimitive bases for the classes C2 , C3 and C4 , respectively. It is easy to check that k(BCi ) = k(Ci ) for i = 2, 3, 4. Therefore, for each closed class U , we know a quasiprimitive basis BU such that k(U ) = k(BU ) . From Theorem 2.5 it follows that the basis BU is optimal for each closed class U with k(U ) ∈ {2, 3}. There are all closed classes with the exception of trivial classes O1 , . . . , O9 for which k(Oi ) ∈ {0, 1} for i = 1, . . . , 9 and classes Fiμ , i = 1, . . . , 8, μ ≥ 3, for which k(Fiμ ) ≥ 4. These 40 classes are listed below jointly with optimal bases. n xi , 1. The class S1 consists of all disjunctions (that is functions of the kind i=1 n = 1, 2, . . ., and all functions obtained from them by renaming of variables without identification). For this class, C (S1 ) = 3 and {x ∨ y} is an optimal basis. 2. The class S3 consists of all disjunctions and all functions equal to 1. For this class, C (S3 ) = 3 and {x ∨ y, 1} is an optimal basis.
40
2 Diagnosis of Constant Faults at Inputs of Gates in Circuits
3. The class S5 consists of all disjunctions and all functions equal to 0. For this class, C (S5 ) = 3 and {x ∨ y, 0} is an optimal basis. 4. The class S6 consists of all disjunctions and all functions equal either to the function 0 or to the function 1. For this class, C (S6 ) = 3 and {x ∨ y, 0, 1} is an optimal basis. n xi , 5. The class P1 consists of all conjunctions (that is functions of the kind i=1 n = 1, 2, . . ., and all functions obtained from them by renaming of variables without identification). For this class, C (P1 ) = 3 and {x ∧ y} is an optimal basis. 6. The class P3 consists of all conjunctions and all functions equal to 0. For this class, C (P3 ) = 3 and {x ∧ y, 0} is an optimal basis. 7. The class P5 consists of all conjunctions and all functions equal to 1. For this class, C (P5 ) = 3 and {x ∧ y, 1} is an optimal basis. 8. The class P6 consists of all conjunctions and all functions equal to 0 or equal to 1. For this class, C (P6 ) = 3 and {x ∧ y, 0, 1} is an optimal basis. 9. The class L 1 consists of all linear functions. For this class, C (L 1 ) = 3 and {x + y(mod 2), 1} is an optimal basis. and β-functions (that is func10. The class L 2 consists of all linear α-functions 2k 2l+1 xi + 1(mod 2), i=1 xi (mod 2), k, l = 0, 1, 2, . . ., and all tions of the kind i=1 functions obtained from them by renaming of variables without identification). For this class, C (L 2 ) = 3 and {x + y + 1(mod 2)} is an optimal basis. of all linear α-functions and γ -functions (that is the 11. The class L 3 consists functions of the kind li=1 xi (mod 2), l = 0, 1, 2, . . ., and all functions obtained from them by renaming of variables without identification). For this class, C (L 3 ) = 3 and {x + y(mod 2)} is an optimal basis. 12. The class L 4 consists of all linear α-functions (that is functions of the kind 2l+1 i=1 x i (mod 2), l = 0, 1, 2, . . ., and all functions obtained from them by renaming of variables without identification). For this class, C (L 4 ) = 4 and {x + y + z(mod 2)} is an optimal basis. all linear self-dual functions (that is functions of 13. The class L 5 consists of 2l+1 2l+1 xi + 1(mod 2), i=1 xi (mod 2), l = 0, 1, 2, . . . and all functions the kind i=1 obtained from them by renaming of variables without identification). For this class, C (L 5 ) = 4 and {x + y + z + 1(mod 2)} is an optimal basis. 14. The class D2 consists of all self-dual monotone functions. For this class, C (D2 ) = 4 and {(x ∧ y) ∨ (x ∧ z) ∨ (y ∧ z)} is an optimal basis. 15. The class D1 consists of all self-dual α-functions. For this class, C (D1 ) = 4 and {(x ∧ y) ∨ (x ∧ ¬z) ∨ (y ∧ ¬z)} is an optimal basis. 16. The class D3 consists of all self-dual functions. For this class, C (D3 ) = 4 and {(x ∧ ¬y) ∨ (x ∧ ¬z) ∨ (¬y ∧ ¬z)} is an optimal basis. 17. The class A1 = M1 consists of all monotone functions. For this class, C (A1 ) = 3 and {x ∧ y, x ∨ y, 0, 1} is an optimal basis. 18. The class A2 = M2 consists of all monotone α-functions and β-functions. For this class C (A2 ) = 3 and {x ∧ y, x ∨ y, 1} is an optimal basis. 19. The class A3 = M3 consists of all monotone α-functions and γ -functions. For this class, C (A3 ) = 3 and {x ∧ y, x ∨ y, 0} is an optimal basis.
2.6 Optimal Bases for Some Closed Classes
41
20. The class A4 = M4 consists of all monotone α-functions. For this class, C (A4 ) = 3 and {x ∧ y, x ∨ y} is an optimal basis. 21. The class C1 consists of all Boolean functions. For this class, C (C1 ) = 3 and {¬x ∨ ¬y} is an optimal basis. 22. The class C2 consists of all α-functions and β-functions. For this class, C (C2 ) = 3 and {x ∧ y, x ∨ ¬y} is an optimal basis. 23. The class C3 consists of all α-functions and γ -functions. For this class, C (C3 ) = 3 and {x ∨ y, x ∧ ¬y} is an optimal basis. 24. The class C4 consists of all α-functions. For this class, C (C4 ) = 4 and {x ∨ y, x ∧ y, x ∨ (y ∧ ¬z)} is an optimal basis. 25. The class F12 consists of all α-functions satisfying the condition a 2 . For this class, C (F12 ) = 4 and {x ∨ (y ∧ ¬z), (x ∨ y) ∧ (x ∨ z) ∧ (y ∨ z)} is an optimal basis. 26. The class F22 consists of all monotone α-functions satisfying the condition 2 a . For this class, C (F22 ) = 4 and {x ∨ (y ∧ z), (x ∨ y) ∧ (x ∨ z) ∧ (y ∨ z)} is an optimal basis. 27. The class F32 consists of all monotone functions satisfying the condition a 2 . For this class, C (F32 ) = 4 and {1, (x ∨ y) ∧ (x ∨ z) ∧ (y ∨ z)} is an optimal basis. 28. The class F42 consists of all functions satisfying the condition a 2 . For this class, C (F42 ) = 4 and {x ∨ ¬y, (x ∨ y) ∧ (x ∨ z) ∧ (y ∨ z)} is an optimal basis. 29. The class F52 consists of all α-functions satisfying the condition A2 . For this class, C (F52 ) = 4 and {x ∧ (y ∨ ¬z), (x ∧ y) ∨ (x ∧ z) ∨ (y ∧ z)} is an optimal basis. 30. The class F62 consists of all monotone α-functions satisfying the condition 2 A . For this class, C (F62 ) = 4 and {x ∧ (y ∨ z), (x ∧ y) ∨ (x ∧ z) ∨ (y ∧ z)} is an optimal basis. 31. The class F72 consists of all monotone functions satisfying the condition A2 . For this class, C (F72 ) = 4 and {0, (x ∧ y) ∨ (x ∧ z) ∨ (y ∧ z)} is an optimal basis. 32. The class F82 consists of all functions satisfying the condition A2 . For this class, C (F82 ) = 4 and {x ∧ ¬y, (x ∧ y) ∨ (x ∧ z) ∨ (y ∧ z)} is an optimal basis. 33. The class F1∞ consists of all α-functions satisfying the condition a ∞ . For this class, C (F1∞ ) = 4 and {x ∨ (y ∧ ¬z)} is an optimal basis. 34. The class F2∞ consists of all monotone α-functions satisfying the condition ∞ a . For this class, C (F2∞ ) = 4 and {x ∨ (y ∧ z)} is an optimal basis. 35. The class F3∞ consists of all monotone functions satisfying the condition ∞ a . For this class, C (F3∞ ) = 4 and {1, x ∨ (y ∧ z)} is an optimal basis. 36. The class F4∞ consists of all functions satisfying the condition a ∞ . For this class, C (F4∞ ) = 3 and {x ∨ ¬y} is an optimal basis. 37. The class F5∞ consists of all α-functions satisfying the condition A∞ . For this class, C (F5∞ ) = 4 and {x ∧ (y ∨ ¬z)} is an optimal basis. 38. The class F6∞ consists of all monotone α-functions satisfying the condition ∞ A . For this class, C (F6∞ ) = 4 and {x ∧ (y ∨ z)} is an optimal basis.
42
2 Diagnosis of Constant Faults at Inputs of Gates in Circuits
39. The class F7∞ consists of all monotone functions satisfying the condition A . For this class, C (F7∞ ) = 4 and {0, x ∧ (y ∨ z)} is an optimal basis. 40. The class F8∞ consists of all functions satisfying the condition A∞ . For this class, C (F8∞ ) = 3 and {x ∧ ¬y} is an optimal basis. ∞
References 1. Alrawaf, S., Chikalov, I., Hussain, S., Moshkov, M.: Diagnosis of constant faults in iterationfree circuits over monotone basis. Discret. Appl. Math. 166, 287–291 (2014) 2. Andreev, A.E.: Complexity of monotonic functions. Moscow Univ. Mech. Bull. 40(4), 45–49 (1985) 3. Goldman, R.S., Chipulis, V.P.: Diagnosis of repetition-free combinational circuits. Diskret. Analiz 14, 3–15 (1969). (in Russian) 4. Karava˘ı, M.F.: Diagnosis of tree-form circuits having an arbitrary basis. Autom. Remote. Control. 34, 154–161 (1973) 5. Madatyan, Kh.A.: Complete test for repetition-free contact circuits. In: Probl. Kibern., vol. 23, pp. 103–118. Nauka Publishers, Moscow (1970). (in Russian) 6. Moshkov, M.: Diagnostics of constant faults in circuits. In: Mat. Vopr. Kibern., vol. 9, pp. 79–100. Fizmatlit, Moscow (2000). (in Russian) 7. Moshkov, M.: Time complexity of decision trees. In: Peters, J.F., Skowron, A., (eds.) Trans. Rough Sets III. Lecture Notes in Computer Science, vol. 3400, pp. 244–459. Springer (2005) 8. Moshkov, M., Moshkova, A.: Optimal bases for some closed classes of Boolean functions. In: Fifth European Congress on Intelligent Techniques and Soft Computing, Aachen, Germany, 1997, pp. 1643–1647 (1997) 9. Ugol’nikov, A.B.: Depth and polynomial equivalence of formulas for closed classes of twovalued logic. Math. Notes 42(4), 832–837 (1987) 10. Yablonskii, S.V., Gavrilov, G.P., Kudriavtzev, V.B.: Functions of the Algebra of Logic and Post Classes. Nauka Publishers, Moscow (1966). (in Russian)
Chapter 3
Diagnosis of Embedding Faults in Circuits
In this chapter, we study decision trees for diagnosis of embedding faults in circuits. Let B and P be nonempty finite sets of Boolean functions in which each variable of each function is essential. The set B is a circuit basis and the set P is a fault basis. The embedding faults from the fault basis P consist in embedding new gates implementing functions from P into circuits in the basis B. These faults include well-known from technical and theoretical diagnostic constant faults, faults of the kind “negation”, “and” and “or” faults and combinations thereof. For any circuit S in the basis B, we denote by h P (S) the minimum depth of a decision tree, which solves the problem of diagnosis of the circuit S relative to embedding faults from the fault basis P. We denote by L + (S) the number of gates and inputs in the circuit S and consider defined for t ≥ 2 function h B,P (t) = max{h P (S) : S ∈ Circ(B), L + (S) ≤ t} , where Circ(B) is the set of circuits in the basis B. We study the behavior of the function h B,P (t) for any circuit basis B and fault basis P. In particular, the following statement holds. If a pair of bases B and P satisfies at least one of the conditions (a) P = {x}, (b) B ∪ P contains only conjunctions and possibly constants, (c) B ∪ P contains only disjunctions and possibly constants, and (d) B ∪ P contains only linear functions, then 0 ≤ h B,P (t) ≤ t . If a pair of bases B and P does not satisfy any of the above conditions (a)–(d), then 2
(t+3)/7
≤ h B,P (t) ≤ 2t−1 .
© The Author(s), under exclusive license to Springer Nature Switzerland AG 2023 M. Busbait et al., Decision Trees for Fault Diagnosis in Circuits and Switching Networks, Studies in Systems, Decision and Control 493, https://doi.org/10.1007/978-3-031-39031-9_3
43
44
3 Diagnosis of Embedding Faults in Circuits
This statement is the first approximation of the obtained results. More accurate approximations are discussed in this chapter—see Theorems 3.1–3.12. The initial results and their proofs compose Shevtchenko’s Ph.D. thesis [5]. The description of these results and corresponding proofs are too long and complicated to be considered in this book. This chapter is partially based on the papers of Shevtchenko [1–7]. Definitions, notation, and results from Appendix A are used in this chapter without special notice. We also use some definitions and notation related to the circuits from Sect. 2.1.1 and definitions and notation related to the decision trees from Sect. 2.1.4. This chapter contains two sections. In Sect. 3.1, main notions are discussed. In Sect. 3.1, we formulate Theorems 3.1–3.12 and make concluding remarks.
3.1 Main Notions Let B and P be nonempty finite sets of Boolean functions in which each variable of each function is essential. The set B is a circuit basis and the set P is a fault basis. First, we remind the notion of a circuit in the basis B defined in Sect. 2.1.1. A circuit in the basis B is a labeled finite directed graph without directed cycles and, possibly, with multiple edges, which has nodes of the three types: inputs, gates, and outputs. Nodes of the input type have no entering edges, each input is labeled with a variable, and distinct inputs are labeled with distinct variables. Every circuit has at least one input. Each node of the gate type is labeled with a function from the set B. Let v be a gate and let a function g depending on t variables be attached to it. If t = 0 (this is the case, when g is one of the constants 0 or 1), then the node v has no entering edges. If t > 0, then the node v has exactly t entering edges, which are labeled with numbers 1, . . . , t, respectively. Every circuit has at least one gate. Each node of the output type has exactly one entering edge, which leaves a gate. Let v be an output. Nothing is attached to v, and v has no leaving edges. We will consider only circuits, which have exactly one output. Denote by Circ(B) the set of circuits in the basis B. Let S be a circuit in the basis B. The function implemented by the circuit S is defined as in Sect. 2.1.1. We will say that in the circuit S a node v1 precedes a node v2 if in S there is a directed path from the node v1 to the node v2 . In particular, any node precedes itself. For any circuit S in the basis B, we denote by L + (S) the number of inputs and gates in the circuit S. This parameter characterizes the complexity of the circuit S. We denote by V (S) the set of all nodes of S with the exception of the output. Let S be a circuit in the basis B and ψ(x1 , . . . , xt ) be a function from the fault basis P. We now describe the embedding of a gate implementing the function ψ into the circuit S. Let t > 0. Choose in S a sequence of nodes v1 , . . . , vt from V (S). This sequence can have repeated nodes. Denote U = {v1 , . . . , vt }. Choose in S pairwise different
3.2 Main Results
45
edges (vi1 , w1 ), . . . , (vis , ws ) such that s ≥ 1, vi1 , . . . , vis ∈ U , w1 , . . . , ws ∈ V (S) and, for j = 1, . . . , s and k = 1, . . . , t, the node w j does not precede the node vk . We remove from S the edges (vi1 , w1 ), . . . , (vis , ws ) and add to S a node e and edges (v1 , e), . . . , (vt , e), (e, w1 ), . . . , (e, ws ). We label the node e with the function ψ and edges (v1 , e), . . . , (vt , e) with numbers 1, . . . , t, respectively. For j = 1, . . . , s, we label the edge (e, w j ) with the same number as the edge (vi j , w j ). Let t = 0 (in this case, ψ is a constant). Choose in S pairwise different edges (v1 , w1 ), . . . , (vs , ws ) such that s ≥ 1 and vi , wi ∈ V (S) for i = 1, . . . , s. We remove from S the edges (v1 , w1 ), . . . , (vs , ws ) and add to S a node e and edges (e, w1 ), . . . , (e, ws ). We label the node e with the function ψ and edges (e, w1 ), . . . , (e, ws ) with the same numbers as edges (v1 , w1 ), . . . , (vs , ws ). As a result, we obtain a circuit in the basis B ∪ P. We can continue this process and embed to the circuit S an arbitrary number of gates implementing functions from the fault basis P. We will call the considered faults embedding faults from the fault basis P. We denote by H P (S) the set of all circuits that can be obtained from the circuit S by the embedding an arbitrary number of gates implementing functions from the fault basis P. The set H P (S) includes the circuit S. The problem of diagnosis of the circuit S relative to the embedding faults from the fault basis P: for a given circuit from the set H P (S), we should recognize the function implemented by this circuit. To solve this problem, we will use decision trees, which are defined in much the same way as in Sect. 2.1.4. We denote by h P (S) the minimum depth of a decision tree, which solves the problem of diagnosis of the circuit S relative to the embedding faults from the fault basis P. We will study the function h B,P (t) = max{h P (S) : S ∈ Circ(B), L + (S) ≤ t} , which is defined for t ≥ 2. Note that the value h B,P (t) is the unimprovable upper bound on the minimum depth of decision trees that solve the problem of diagnosis of circuits in the basis B relative to the embedding faults from the fault basis P the complexity of which does not exceed t.
3.2 Main Results Later we will denote by B a circuit basis and by P a fault basis. Unless otherwise stated, we will assume that t ≥ 2. We will use the following notation: t −1 t −1 , + (t − 1)/2 + r + 1 (t − 1)/2 + r
v(t, r ) = where r ∈ {−1, 0, 1}.
46
3 Diagnosis of Embedding Faults in Circuits
Theorem 3.1 Let the basis P contain a nonmonotone function and a nonlinear function. Then, for any basis B, 2t−2 − 1 ≤ h B,P (t) ≤ 2t−1 . Theorem 3.2 Let the basis P contain only monotone functions and at the same time contain a function other than conjunction and constant, and a function other than disjunction and constant. (a) If the basis B contains only monotone functions, then, for t ≥ 5, v(t − 1, 0) ≤ h B,P (t) ≤ v(t, 0) and, for t = 2, 3, 4,
0 ≤ h B,P (t) ≤ 4 .
(b) If the basis B contains a nonmonotone function, then 2t−4 ≤ h B,P (t) ≤ 2t−1 . Theorem 3.3 Let the basis P contain only linear functions, of which at least one depends on two or more variables. (a) If the basis B contains only linear functions, then t − 2 ≤ h B,P (t) ≤ t . (b) If the basis B contains a nonlinear function, then 2t/2−1 − 2 ≤ h B,P (t) ≤ 2t−1 . Theorem 3.4 Let the basis P contain only conjunctions at least one of which depends on two or more variables, and possibly constants. 1. Let the basis P contain the constant 1. (a) If all functions in the basis B are conjunctions or constants, then t − 1 ≤ h B,P (t) ≤ t . (b) If the basis B contains only monotone functions and at the same time at least one of them is different from a conjunction and at least one is different from a constant, then 2t/3 ≤ h B,P (t) ≤ v(t, 0) . (c) If the basis B contains a nonmonotone function, then 2t/2 − 1 ≤ h B,P (t) ≤ 2t−1 .
3.2 Main Results
47
2. Let the basis P do not contain the constant 1. (a) If B = {0}, then h B,P (t) = 0 . (b) If all functions in the basis B are conjunctions or constants and B = {0}, then t − 2 ≤ h B,P (t) ≤ t . (c) If the basis B contains only monotone functions and at the same time, at least one of them is different from a conjunction and at least one is different from a constant, then 2(t−1)/3 ≤ h B,P (t) ≤ v(t, 0) . (d) If the basis B contains a nonmonotone function, then 2(t−1)/2 − 1 ≤ h B,P (t) ≤ 2t−1 . Theorem 3.5 Let the basis P contain only disjunctions at least one of which depends on two or more variables, and possibly constants. 1. Let the basis P contain the constant 0. (a) If all functions in the basis B are disjunctions or constants, then t − 1 ≤ h B,P (t) ≤ t . (b) If the basis B contains only monotone functions and at the same time at least one of them is different from a disjunction and at least one is different from a constant, then 2t/3 ≤ h B,P (t) ≤ v(t, 0) . (c) If the basis B contains a nonmonotone function, then 2t/2 − 1 ≤ h B,P (t) ≤ 2t−1 . 2. Let the basis P do not contain the constant 0. (a) If B = {1}, then h B,P (t) = 0 . (b) If all functions in the basis B are disjunctions or constants and B = {1}, then t − 2 ≤ h B,P (t) ≤ t . (c) If the basis B contains only monotone functions and at the same time, at least one of them is different from a disjunction and at least one is different from a constant, then 2(t−1)/3 ≤ h B,P (t) ≤ v(t, 0) .
48
3 Diagnosis of Embedding Faults in Circuits
(d) If the basis B contains a nonmonotone function, then 2(t−1)/2 − 1 ≤ h B,P (t) ≤ 2t−1 . Theorem 3.6 Let P = {0, 1} and τ be the maximum number of variables in functions from B. (a) If the basis B contains only functions that depend on at most one variable, then 1 ≤ h B,P (t) ≤ 2 . (b) If the basis B contains either only linear functions, or only conjunctions and possibly constants, or only disjunctions and possibly constants, and contains a function depending on at least two variables, then h B,P (t) = t − (t − 1)/τ + 1 . (c) If the basis B contains only monotone functions and at the same time B contains a function that is different from a conjunction and constant, and a function that is different from a disjunction and constant, then 2t/6 − 1 ≤ h B,P (t) ≤ v(t − (t − 1)/τ , 0) . (d) If the basis B contains a nonmonotone function and a nonlinear function, then 2(t+3)/7 ≤ h B,P (t) ≤ 2t− (t−1)/τ . Theorem 3.7 Let P = {1} and τ be the maximum number of variables in functions from B. (a) If the basis B contains either only functions that depend on at most one variable, or only disjunctions and, possibly, constants, then 1 ≤ h B,P (t) ≤ 2 . (b) If the basis B contains either only linear functions, or only conjunctions and possibly constants, and contains a function depending on at least two variables, then t − (t − 1)/τ ≤ h B,P (t) ≤ t − (t − 1)/τ + 1 . (c) If the basis B contains only monotone functions and at the same time B contains a function other than conjunction and constant, and a function other than disjunction and constant, then 2t/6 − 1 ≤ h B,P (t) ≤ v(t − (t − 1)/τ , 0) . (d) If the basis B contains a nonmonotone function and a nonlinear function, then
3.2 Main Results
49
2(t+3)/7 ≤ h B,P (t) ≤ 2t− (t−1)/τ . Theorem 3.8 Let P = {0} and τ be the maximum number of variables in functions from B. (a) If the basis B contains either only functions that depend on at most one variable, or only conjunctions and, possibly, constants, then 1 ≤ h B,P (t) ≤ 2 . (b) If the basis B contains either only linear functions, or only disjunctions and possibly constants, and contains a function depending on at least two variables, then t − (t − 1)/τ ≤ h B,P (t) ≤ t − (t − 1)/τ + 1 . (c) If the basis B contains only monotone functions and at the same time B contains a function other than conjunction and constant, and a function other than disjunction and constant, then 2t/6 − 1 ≤ h B,P (t) ≤ v(t − (t − 1)/τ , 0) . (d) If the basis B contains a nonmonotone function and a nonlinear function, then 2(t+3)/7 ≤ h B,P (t) ≤ 2t− (t−1)/τ . Theorem 3.9 Let P = {¬x} and τ be the maximum number of variables in functions from B. (a) If the basis B contains only linear functions, then h B,P (t) = 1 . (b) If the basis B contains a nonlinear function, then 2t/2 − 1 ≤ h B,P (t) ≤ 2t− (t−1)/τ . Theorem 3.10 Let P ∈ {{¬x, 1}, {¬x, 0}, {¬x, 0, 1}} and τ be the maximum number of variables in functions from B. (a) If B contains only functions that depend on at most one variable, then 1 ≤ h B,P (t) ≤ 2 . (b) If the basis B contains only linear functions and among them there is a function that depends on at least two variables, then h B,P (t) = t − (t − 1)/τ + 1 .
50
3 Diagnosis of Embedding Faults in Circuits
(c) If the basis B contains a nonlinear function, then 2(t+1)/2 − 1 ≤ h B,P (t) ≤ 2t− (t−1)/τ . Theorem 3.11 If P = {x}, then, for an arbitrary basis B, h B,P (t) = 0 . Theorem 3.12 For arbitrary bases B and P and for the basis P = P ∪ {x}, h B,P (t) = h B,P (t) . In conclusion, we will make a few remarks. Remark 3.1 Using the structure of closed classes of Boolean functions, one can make sure that all possible pairs of bases B and P for circuits and faults, respectively, are considered. Remark 3.2 For an arbitrary pair of bases B and P, the growth of the function h B,P (t) is either superpolynomial or linear, or this function is bounded from above by the constant 2. Remark 3.3 If a pair of bases B and P satisfies at least one of the conditions (a) P = {x}, (b) B ∪ P contains only conjunctions and possibly constants, (c) B ∪ P contains only disjunctions and possibly constants, and (d) B ∪ P contains only linear functions, then 0 ≤ h B,P (t) ≤ t . If a pair of bases B and P does not satisfy any of the above conditions (a)–(d), then 2
(t+3)/7
≤ h B,P (t) ≤ 2t−1 .
Remark 3.4 In the case, when a pair of bases B and P satisfies at least one of the conditions (a)–(d) from the previous remark, the problem of diagnosing P-faults in an arbitrary circuit in the basis B can be effectively solved using a decision tree that has simple description and depth not exceeding the number of circuit inputs.
References 1. Shevtchenko, V.: On complexity of diagnosing one type of faults in circuits of functional elements using conditional tests. In: Combinatorial-Algebraic and Probabilistic Methods in Applied Mathematics, pp. 86–97. Gorky University Publishers, Gorky (1988). (in Russian) 2. Shevtchenko, V.: On complexity of diagnosing faults of “+” type in circuits of functional elements. In: Combinatorial-Algebraic and Probabilistic Methods of Discrete Analysis, pp. 129– 140. Gorky University Publishers, Gorky (1989). (in Russian)
References
51
3. Shevtchenko, V.: On complexity of diagnosing faults of types “0”, “1”, “&”, and “∨” in circuits of functional elements. In: Combinatorial-Algebraic and Probabilistic Methods and Their Application, pp. 133–150. Gorky University Publishers, Gorky (1990). (in Russian) 4. Shevtchenko, V.: On the depth of decision trees for diagnosing faults in circuits. In: The Third International Workshop on Rough Sets and Soft Computing, RSSC’94, San Jose State University, San Jose, USA, 1994, pp. 594–601 (1994) 5. Shevtchenko, V.: Study of complexity of conditional tests for diagnostics of faults in circuits of functional elements. Ph.D. thesis, Nizhny Novgorod State University (1995). (in Russian) 6. Shevtchenko, V.: On complexity of diagnosing non-elementary closures in circuits of functional elements. In: Mat. Vopr. Kibern., vol. 10, pp. 103–139. Fizmatlit, Moscow (2001). (in Russian) 7. Shevtchenko, V., Moshkov, M., Moshkova, A.: Effective methods for diagnosing circuits of functional elements. In: 11th Interstate School-Seminar on Synthesis and Complexity of Control Systems, Nizhny Novgorod State University, Nizhny Novgorod, Russia, November 20–25, 2000, part 2, pp. 228–238 (2001). (in Russian)
Chapter 4
Diagnosis of Extensions of Constant Faults in Circuits
This chapter is devoted to the study of extensions of constant faults at the inputs of gates. We consider only bases such that each variable in each function from the basis is essential and the basis contains a function with two or more variables. For these bases, we consider only classes of faults that are extensions of constant faults. Each such class X of faults for a basis B can be defined in the following way. If a gate of a circuit in the normal state implements a function f (x1 , . . . , xn ) from B with n ≥ 1, then this gate, possibly with a fault, can implement an arbitrary function from a set X ( f ). The functions from X ( f ) depend on variables x1 , . . . , xn , f ∈ X ( f ) and, together with each function g, the set X ( f ) contains all its subfunctions, i.e., functions obtained from g by substitution of constants 0 and 1 instead of some its variables. If f ∈ {0, 1}, then X ( f ) = { f }. For a circuit S in the basis B, we denote by h X (S) the minimum depth of a decision tree, which solves the problem of diagnosis of the circuit S relative to X -faults. Our aim is to describe pairs B, X such that, for any iteration-free circuits S in the basis B, h X (S) ≤ c B,X L(S), where L(S) is the number of gates in S and c B,X is a positive constant depending only on B and X . In the case of constant faults at inputs of gates, the considered positive constant exists if and only if B is a linear basis containing only linear functions or B is a unate basis containing only unate functions. For each such basis B, we describe the maximum extension X of constant faults at gate inputs for which a constant c B,X exists. Let B be a linear basis, f (x1 , . . . , xn ) ∈ B and n ≥ 1. Then, in the maximum extension, X ( f ) is the set of all functions of the kind c1 x1 + · · · + cn xn + cn+1 (mod 2), where c1 , . . . , cn+1 ∈ {0, 1}. Let B be a unate basis, f (x1 , . . . , xn ) ∈ B, n ≥ 1 and f (x1 , . . . , xn ) = g(x1σ1 , . . . , xnσn ), where g(x1 , . . . , xn ) is a monotone function and σ1 , . . . , σn ∈ {0, 1}. Then, in the maximum extension, X ( f ) is the set of all functions of the kind q(x1σ1 , . . . , xnσn ), where q(x1 , . . . , xn ) is a monotone function.
© The Author(s), under exclusive license to Springer Nature Switzerland AG 2023 M. Busbait et al., Decision Trees for Fault Diagnosis in Circuits and Switching Networks, Studies in Systems, Decision and Control 493, https://doi.org/10.1007/978-3-031-39031-9_4
53
54
4 Diagnosis of Extensions of Constant Faults in Circuits
We consider only closed classes of Boolean functions that contains functions with two or more essential variables. For each such class U , we find an optimal basis B with [B] = U . This basis is linear if U contains only linear functions and it is unate if U contains a nonlinear function. Optimal means that this basis has the minimum possible constant c B,X , where X is the maximum extension of constant faults at inputs of gates for the basis B. We consider the following way to the design and diagnosis the circuits. Let U be a closed class of Boolean functions and B be a linear or unate basis such that U ⊆ [B]. We implement functions from U by formula-like circuits in the basis B. In addition to the normal operation mode of such circuits, there exists the diagnostic mode in which the considered circuits transform by “splitting” some inputs into iterationfree circuits. These circuits can be effectively diagnosed relative to the maximum extension of constant faults. For several pairs B, U , we consider the complexity of implementation of functions from U by formula-like circuits in the basis B and evaluate the complexity of diagnosis of corresponding to them iteration-free circuits. This chapter is based mainly on the papers of Moshkova [4–7]. Definitions, notation, and results from Appendix A are used in this chapter without special notice. We also use definitions and notation related to the circuits from Sect. 2.1.1. The chapter contains five sections. In Sect. 4.1, main definitions are discussed. In Sect. 4.2, we describe extensions of constant faults that preserve the efficiency of diagnosis. In Sect. 4.3, we prove the impossibility of further extensions. In Sect. 4.4, optimal bases for closed classes of Boolean functions are considered. In Sect. 4.5, we study the complexity of implementation of functions from closed classes by formula-like circuits and the complexity of diagnosis of corresponding to them iteration-free circuits.
4.1 Main Definitions In this chapter, we will study only bases such that each variable in each function from the basis is an essential variable. It will be convenient for us to consider one of the gates of a circuit as its output. We will study only circuits in which, for each gate v, there exists a path from an input or from a gate implementing a constant from the set {0, 1} to the output passing through the gate v. First, we recall some notation and definitions. Two Boolean functions are called equal if they differ only by unessential variables. We will assume that if a Boolean function f is given, then all functions equal to f are given. Often we will not distinguish equal functions. Let U be a nonempty set of Boolean functions. We denote by [U ] the closure of the set U relatively the operation of substitution (with the assumption on equal functions). The set U is called a closed class if U = [U ]. We denote by k( f ) the number of essential variables of the function f . The number k( f ) is called the order of the function f . Let B be a basis. Denote k(B) = max{k( f ) : f ∈ B}. The number k(B) is called the order of the basis B. Denote by
4.1 Main Definitions
55
k(U ) the minimum order of a basis B such that [B] = U . The number k(U ) is called the order of the class U . Let B be a basis and S be a circuit in the basis B. We denote by L(S) the number of gates in the circuit S. The circuit S is called a formula-like circuit if at most one edge leaves each gate of the circuit S. The circuit S is called an iteration-free circuit if at most one edge leaves each input and each gate of the circuit S. A function g is called a subfunction of a function f if it can be obtained from the function f by substituting the constants 0 and 1 instead of some of its variables. Let B be a basis. We now describe some class of faults X . We correspond to each function f (x1 , . . . , xn ) ∈ B a set X ( f ) of functions such that f ∈ X ( f ), the functions from X ( f ) depend on variables x1 , . . . , xn and, together with each function, the set X ( f ) contains all its subfunctions. If f ∈ {0, 1}, then X ( f ) = { f }. If a gate in the normal state implements a function f ∈ B, then it can implement an arbitrary function from the set X ( f ) in the case of faults. Such class of faults is called an extended class of constant faults. In this chapter, we will study only extended classes of constant faults. The diagnosis problem for the circuit S relatively the faults from X consists in the recognition of the function implementing by the circuit S, which, possibly, has faults from the class X . Let S have t gates implementing functions f i1 , . . . , f it ∈ B in the normal state. In the faulty state, these gates can implement arbitrary functions g1 ∈ X ( f i1 ), . . . , gt ∈ X ( f it ). The tuple w˜ = (g1 , . . . , gt ) will be called a tuple of X -faults for the circuit S, and the circuit S with this tuple of faults will be denoted S(w). ˜ Sometimes, we will describe a fault g j of the jth gate in the following way. First, we choose some function g ∈ X ( f i j ) and after that describe some constant faults at the inputs of j th gate. As a result, we obtain a subfunction g j of the function g that also belongs to the set X ( f i j ). As algorithms for diagnosis problem solving, the decision trees are used. Each query (attribute) of a decision tree consists in observation of the output of the circuit at the inputs of which a binary tuple is given. As a complexity measure, we consider the depth of a decision tree (the maximum number of queries made by the decision tree). The notion of a decision tree solving the diagnosis problem can be defined formally similarly to the definition from Sect. 2.1.4. Denote by h X (S) the minimum depth of a decision tree, which solves the diagnosis problem for the circuit S relatively the faults from the class X . Let B be a basis and X be an extended class of constant faults for B. Let f be a Boolean function with r > 0 variables from B. We denote by S f an iteration-free circuit with r inputs labeled with variables x1 , . . . , xr and with one gate labeled with the function f . For i = 1, . . . , r , the ith gate input is linked to the input of the circuit, which is labeled with the variable xi . We denote by h X (S f ) the minimum depth of a decision tree, which solves the diagnosis problem for the circuit S f relatively the faults from the class X . Sometimes, instead of h X (S f ), we will use the notation h X ( f ) (S f ). Let f ∈ B ∩ {0, 1}. We denote by S f a circuit with one gate labeled with the constant f and without inputs (it is not a circuit according to our definitions, but it will be convenient for us to say about it as about circuit). By definition, h X (S f ) = 0.
56
4 Diagnosis of Extensions of Constant Faults in Circuits
If k(B) = 0, then B ⊆ {0, 1} and, evidently, h X (S) = 0 for any iteration-free circuit in the basis B. If k(B) = 1, then B ⊆ {0, 1, x, ¬x} and, as one can show, h X (S) ≤ 2 for any iteration-free circuit in the basis B. Further we will study only bases B with k(B) ≥ 2 and closed classes U with k(U ) ≥ 2. A Boolean function f (x1 , . . . , xn ) is called unate if there exist a monotone Boolean function g (x1 , . . . , xn ) and numbers σ1 , . . . , σn ∈ {0, 1} such that f (x1 , . . . , xn ) = g x1σ1 , . . . , xnσn , where x σ = x, if σ = 1, and x σ = ¬x if σ = 0. The constants 0 and 1 are, by definition, unate functions. Lemma 4.1 For any unate function f (x1 , . . . , xn ) for which all variables are essential, there exist a unique monotone function g (x1, . . . , xn ) and a unique tuple (σ1 , . . . , σn ) ∈ {0, 1}n such that f (x1 , . . . , xn ) = g x1σ1 , . . . , xnσn . Proof Let f (x1 , . . . , xn ) be a unate function for which all variables are essential. Boolean function Then there exist numbers σ1 , . . . , σn ∈ {0, 1} and a monotone g (x1 , . . . , xn ) such that f (x1 , . . . , xn ) = g x1σ1 , . . . , xnσn . Let i ∈ {1, . . . , n}. Since the function g is monotone, f (x1 , . . . , xi−1 , 1σi , xi+1 , . . . , xn ) ≥ f (x1 , . . . , xi−1 , 0σi , xi+1 , . . . , xn ) for all possible values of x j , j = i. Since the variable xi is essential, there exist values α1 , . . . , αi−1 , αi+1 , . . . , αn ∈ {0, 1} such that f (α1 , . . . , αi−1 , 1σi , αi+1 , . . . , αn ) > f (α1 , . . . , αi−1 , 0σi , αi+1 , . . . , αn ). Therefore the function f unique defines the values σ1 , . . . , σn . It is clear that the function f and values σ1 , . . . , σn uniquely define the function g (x1 , . . . , xn ) = f x1σ1 , . . . , xnσn . Let f (x1 , . . . , xn) be a unatefunction for which all variables are essential and f (x1 , . . . , xn ) = g x1σ1 , . . . , xnσn , where σ1 , . . . , σn ∈ {0, 1} and g (x1 , . . . , xn ) be a monotone Boolean function. The tuple (σ1 , . . . , σn ) will be called the spectrum of the unate function f . A basis B will be called unate if it consists only of unate functions. A basis B will be called linear if it consists only of linear functions. A basis B will be called quasiprimitive if it is linear or unate. Note that any quasiprimitive basis B with k(B) ≤ 1 is both unate and linear. Any quasiprimitive basis B with k(B) ≥ 2 is either unate or linear. From Proposition 2.1 it follows that, for any basis B1 , there exists a quasiprimitive basis B2 such that [B1 ] = [B2 ]. In this chapter, we will study only quasiprimitive bases. Let B be a unate basis. For any function f ∈ B, we define a set of functions u( f ). If f ∈ {0, 1}, then u( f ) = { f }. If f = f (x1 , . . . , xn ) and n ≥ 1, then u( f ) is the set of all functions of the kind g(x1σ1 , . . . , xnσn ), where g(x1 , . . . , xn ) is a monotone function and (σ1 , . . . , σn ) is the spectrum of the function f . In particular, u(0) = {0}, u(1) = {1}, u(x) = {x, 0, 1}, u(¬x) = {¬x, 0, 1}, and u(x ∨ y) = u(x ∧ y) = {x ∧ y, x∨ y, x, y, 0, 1}. We now define a complete class of unate faults u B for the basis B: for
4.2 Extensions Preserving Efficiency of Diagnosis
57
each function f ∈ B, u B ( f ) = u( f ). One can show that u B is an extended class of constant faults for the basis B. An extended class of constant faults X for the basis B will be called a class of unate faults if, for any function f ∈ B, X ( f ) ⊆ u( f ). Note that the gates implementing constants have no faults. Let B be a linear basis. For any function f ∈ B, we define a set of functions l( f ). If f ∈ {0, 1}, then l( f ) = { f }. If f = f (x1 , . . . , xn ) and n ≥ 1, then l( f ) is the set of all functions of the kind c1 x1 + . . . + cn xn + cn+1 (mod 2), where c1 , . . . , cn+1 ∈ {0, 1}. In particular, l(0) = {0}, l(1) = {1}, l(x) = l(¬x) = {x, ¬x, 0, 1}, and l(x + y(mod 2)) = l(x + y + 1(mod 2))={x + y(mod 2), x + y + 1(mod 2), x, y, ¬x, ¬y, 0, 1}. We now define a complete class of linear faults l B for the basis B : for each function f ∈ B, l B ( f ) = l( f ). One can show that l B is an extended class of constant faults for the basis B. An extended class of constant faults X for the basis B will be called a class of linear faults if, for any function f ∈ B, X ( f ) ⊆ l( f ). Note that the gates implementing constants have no faults.
4.2 Extensions Preserving Efficiency of Diagnosis In this section, we study extended classes of constant faults: classes of linear faults for linear bases and classes of unate faults for unate bases. We show that in the considered cases the diagnosis of iteration-free circuits can be done efficiently.
4.2.1 Linear Faults for Linear Bases In this section, we consider linear bases. Lemma 4.2 Let S be an iteration-free circuit in a linear basis B with k(B) ≥ 2, X be a class of linear faults for the basis B, and S have n ≥ 1 inputs connected with inputs of gates by edges. Then h X (S) ≤ n + 1. Proof It is easy to see that the circuit S, possibly containing faults from the class X , implements a function c1 x1 + . . . + cn xn + cn+1 (mod 2), where x1 , . . . , xn are variables assigned to the inputs of the circuit S connected with inputs of gates by edges and c1 , . . . , cn+1 ∈ {0, 1}. To solve the problem of fault diagnosis, we should find the values of the constants c1 , . . . , cn+1 . To do this, we give zeros at the inputs of the circuit S. At the output, we will have the value cn+1 . Further, for i = 1, . . . , n, we will give 1 at the input labeled with the variable xi and zeros at all other inputs. At the output, we will have the value ci + cn+1 (mod 2). Then ci = ci + cn+1 + cn+1 (mod 2). Thus, h(S) ≤ n + 1. Theorem 4.1 Let B be a linear basis with k(B) ≥ 2, X be a class of linear faults for the basis B, and S be an iteration-free circuit in the basis B. Then h X (S) ≤ (k(B) + 1)L(S).
58
4 Diagnosis of Extensions of Constant Faults in Circuits
Proof Let the circuit S have n inputs connected with inputs of gates by edges. By Lemma 4.2, h X (S) ≤ n + 1. Obviously, n ≤ k(B)L(S). Hence h X (S) ≤ k(B)L(S) + 1 ≤ (k(B) + 1)L(S).
4.2.2 Unate Faults for Unate Bases In this section, we consider unate bases. Lemma 4.3 Let B be a unate basis with k(B) ≥ 2 and X be a classof unate faults L(S) h X S fi , for B. Then, for any iteration-free circuit S in the basis B, h X (S) ≤ i=1 where f 1 , . . . , f L(S) ∈ B are functions implemented by the gates of the circuit S. Proof Let us prove the statement of the lemma by induction on the number of gates in the circuit S. Let L(S) = 1. Then, obviously, h X (S) ≤ h X (S f1 ). Thus, the statement is true for L(S) = 1. Assume that the statement of the lemma holds for L(S) ≤ k, where k ≥ 1. Let us prove that the statement also holds for L(S) = k + 1. Consider the gate w, which is the output of the circuit S. If this gate implements a constant from the set {0, 1}, then, obviously, the circuit faults or with L(S) S (without h X S fi . Let the gate w faults) implements this constant and h X (S) = 0 ≤ i=1 have m > 0 inputs. Denote by Si (1 ≤ i ≤ m) the subcircuit of the circuit S whose output is the node vi of the circuit (a gate or an input) connected by an edge to the ith input of the gate w. The subcircuit Si contains all nodes that belong to directed paths in S finishing in the node vi . The subcircuit Si may not contain any gate, that is, it may consist of one input of the circuit S, or it may contain at least one gate. In the latter case, either Si does not contain any input and, for any X -faults, implements a constant or Si contains at least one input and it is an iteration-free circuit in the basis B with L (Si ) ≤ k. Let us consider the case, when Si is a circuit in the unate basis B. Let ρ(x1 , . . . , x p ) be a monotone function and δ1 , . . . , δ p ∈ {0, 1}. One can show that δ
¬δ
¬ρ(x1δ1 , . . . , x pp ) = π(x1¬δ1 , . . . , x p p ) , where π(x1 , . . . , x p ) is a monotone function. Using this fact, we can prove that the circuit Si implements in the normal state some unate function qi x j1 , . . . , x jr , where r is the number of inputs of the circuit Si , and there exist a monotone func tion gi (y1 , . . . , yr ) and values σ j1 , . . . , σ jr ∈ {0, 1} such that qi x j1 , . . . , x jr = σj σ gi (x j1 1 , . . . , x jr jr ). In a faulty state, the circuit Si will again implement a unate func
tion qi x j1 , . . . , x jr , and σ there existsa monotone function gi(y1 , . . . , yr ) such that σ j qi x j1 , . . . , x jr = gi x j1 1 , . . . , x jr jr . Since gi x j1 , . . . , x jr is a monotone func tion, if qi x j1 , . . . , x jr ≡ const, then qi (0σ j1 , . . . , 0σ jr ) = gi (0, . . . , 0) = 0, qi (1σ j1 , . . . , 1σ jr ) = gi (1, . . . , 1) = 1 .
4.2 Extensions Preserving Efficiency of Diagnosis
59
Note that the case, when the circuit Si implements a constant, is equivalent to the occurrenceof this constant at the ith input of the gate w. So we assume that qi x j1 , . . . , x jr ≡ const. Thus, by selecting the appropriate values at the inputs of the circuit S, we can give any tuple to the inputs of the gate w. Let the gate w implement the function f ∈ B in the normal state. Then, giving at most h X S f tuples at the inputs of S, we can recognize a function f implemented by the gate w, possibly in a faulty state. Let f = f (z 1 , . . . , z m ). Consider an arbitrary variable z i of this function. If z i is an unessential variable of the function f , then the operation of the subcircuit Si does not affect the output value of the circuit S. Therefore, the subcircuit Si does not need to be diagnosed. Consider the case, when z i is an essential variable. Then there are numbers α1 , . . . , αi−1 , αi+1 , . . . , αm ∈ {0, 1} such that f (α1 , . . . , αi−1 , 0, αi+1 , . . . , αm ) = γ0 , f (α1 , . . . , αi−1 , 1, αi+1 , . . . , αm ) = γ1 and γ0 = γ1 . If the subcircuit Si consists of one input of the circuit S, then it is not necessary to diagnose it. Let z i be an essential variable and Si contain both an input and a gate. For each j ∈ {1, . . . , i − 1, i + 1, . . . , m} such that z j is an essential variable of the function f (z 1 , . . . , z m ), we give at the inputs of the circuit S j such values that the input of the gate w with the number j receives the value α j . If the variable z j of the function f (z 1 , . . . , z m ) is unessential, then any values can be given at the inputs of the circuit S j , for example, zeros. Next, we can diagnose the subcircuit Si , since when the value β ∈ {0, 1} is at its output, the value γβ ∈ {0, 1} is at the output of the circuit S, and γ0 = γ1 . Since by the inductive hypothesis, to diagnose the circuit Si it suffices to L (Si ) ≤ k, then, i) i i perform at most L(S j=1 h X (S f ji ) queries, where f 1 , . . . , f L(Si ) are functions implemented by the gates of the circuit Si . Consider all the variables z 1 , . . . , z m in a similar way. Let i ∈ {1, . . . , m}. Let’s define the function ϕi : • If z i is an unessential variable of the function f , then ϕi = 0. • If z i is an essential variable of the function f , and Si consists of one input x j of S, then ϕi = x j . • If z i is an essential variable of the function f and Si contains both an input and a gate, then ϕi is the function implemented by the subcircuit Si . It is easy to see that the circuit S implements the function f (ϕ1 , . . . , ϕm ). If the functions f , ϕ1 , . . . , ϕm are given by formulas, then we obtain a formula implementing the same function as the circuit S. It is easy toshow that, in the process of L(S) h X S fi queries. diagnosing the circuit S, we perform at most i=1 Remark 4.1 Note that there is no necessity to construct the considered decision trees since we can effectively simulate their work if, for each f ∈ B, we have a decision tree, which solves the problem of diagnosis of the circuit S f relatively faults from X and whose depth is h X (S f ). For abasis B and a class of faults X for the basis B, we denote H X (B) = max{h X S f : f ∈ B}.
60
4 Diagnosis of Extensions of Constant Faults in Circuits
Lemma 4.4 Let B be a unate basis with k(B) ≥ 2 and X be a class of unate faults for B. Then, for any iteration-free circuit S in the basis B, h X (S) ≤ H X (B)L(S). L(S) Proof From Lemma 4.3 it follows that h X (S) ≤ i=1 h X S fi , where f 1, . . . , f L(S) are functions implemented by the gates of the circuit S. Evidently, h X S fi ≤ H X (B) L(S) for i = 1, . . . , L(S). Therefore i=1 h X S fi ≤ H X (B)L(S). Lemma 4.5 Let f (x1 , . . . , xn ), n ≥ 1, be a unate function in which each variable is essential and f (x1 , . . . , xn ) = g x1σ1 , . . . , xnσn , where g (x1 , .. . , xn ) is a monotone function and σ1 , . . . , σn ∈ {0, 1}. Then h u( f ) S f = h u(g) Sg . Proof The set u( f ) consists of all functions of the kind q x1σ1 , . . . , xnσn , where q (x1 , . . . , xn ) is a monotone function. The set u(g) consists of all monotone funcis one-to-one correspondence between these sets: a tions q (x1, . . . , xn ). There function q x1σ1 , . . . , xnσn ∈ u( f ) corresponds to the function q (x1 , . . . , xn ) ∈ u(g). It is easy to check that, for any function q(x1 , . . . , xn ) ∈ u(g), for any tuple (δ1 , . . . , δn ) ∈ {0, 1}n, and any δ ∈ {0, 1}, the equality q(δ1 , . . . , δn ) = δ holds if and only if the equality q γ1σ1 , . . . , γnσn = δ holds, where (γ1 , . . . , γn ) = δ1σ1 , . . . , δnσn . Using these facts, it is easy to describe a depth-preserving one-to-one correspondence between decision trees, which solve the diagnosis problem for the circuit S f relatively the faults from u( f ), and decision trees, which solve the diagnosis problem for the circuit Sg relatively the faults from u(g). Therefore h u( f ) S f = h u(g) Sg . n n For any natural n, we denote D(n) = n + n +1 . One can show that D(n) < 2 2 D(n + 1) for any natural n. Lemma 4.6 Let f (x1 ,. . . , xn ), n ≥ 1, be a unate function in which each variable is essential. Then h u( f ) S f = D(n). Proof Let f (x1 , . . . , xn ) = g x1σ1 , . . . , xnσn , where g (x1 , . . . , xn ) is amonotone function and σ1 , . . . , σn ∈ {0, 1}. It is easy to see that the value h u(g) Sg coincides with the minimum depth of a decision tree for recognition of monotone Boolean functions with n variables that is equal toD(n)—see well known result of Hansel [2]. From Lemma 4.5 it follows that h u( f ) S f = h u(g) Sg . Theorem 4.2 Let B be a unate basis with k(B) ≥ 2 and X be a class of unate faults for B. Then, for any iteration-free circuit S in the basis B, h X (S) ≤ D(k(B))L(S). Proof Let S be an iteration-free circuit in the basis B. By Lemma 4.4, h X (S) ≤ H X (B)L(S). One can show that h X ( f ) (S f ) ≤ h u( f ) (S f ) for any function f ∈ B. From here, from the fact that D(n) is a strictly increasing function, and from Lemma 4.5 it follows that H X (B) ≤ D(k(B)).
4.3 Impossibility of Further Extensions
61
4.3 Impossibility of Further Extensions In this section, we show that further extensions of constant faults preserving efficiency of diagnosis are impossible. Let us prove some auxiliary statements. The proof of the following statement is similar to the proof of Lemma 2.11. Lemma 4.7 Let B be a basis with k(B) ≥ 2, X be an extended class of constant faults for B, f ∈ B, and g(x1 , . . . , xn ) be a function from the set X ( f ), which is not unate. Then there exists an iteration-free circuit S¬ in the basis B and tuples w˜ 1 and w˜ 2 of X -faults of the circuit S¬ such that the circuit S¬ (w˜ 1 ) implements a function equal to x, and the circuit S¬ (w˜ 2 ) implements a function equal to ¬x. Proof Since g(x1 , . . . , xn ) is not unate, n ≥ 2. Let us show that there exist a number i ∈ {1, . . . , n} and two tuples (α1 , . . . , αi−1 , αi+1 , . . . , αn ) and (β1 , . . . , βi−1 , βi+1 , . . . , βn ) from {0, 1}n−1 such that g(α1 , . . . , αi−1 , 0, αi+1 , . . . , αn ) = 0 , g(α1 , . . . , αi−1 , 1, αi+1 , . . . , αn ) = 1 , g(β1 , . . . , βi−1 , 0, βi+1 , . . . , βn ) = 1 , g(β1 , . . . , βi−1 , 1, βi+1 , . . . , βn ) = 0 .
(4.1)
Assume the contrary. In this case, for any i ∈ {1, . . . , n}, there exists a number σi ∈ {0, 1} such that, for any tuple (γ1 , . . . , γi−1 , γi+1 , . . . , γn ) ∈ {0, 1}n−1 , the inequality g(γ1 , . . . , γi−1 , σi , γi+1 , . . . , γn ) ≥ g(γ1 , . . . , γi−1 , ¬σi , γi+1 , . . . , γn ) holds. One can show that the function g(x1σ1 , . . . , xnσn ) is monotone. Therefore g(x1 , . . . , xn ) is a unate function, which is impossible. Thus, for some i ∈ {1, . . . , n} and some tuples α˜ = (α1 , . . . , αi−1 , αi+1 , . . . , αn ) and β˜ = (β1 , . . . , βi−1 , βi+1 , . . . , βn ) from {0, 1}n−1 , the equalities (4.1) hold. Using these equalities, one can construct an iteration-free circuit S¬ in the basis B, containing one gate implementing the function f , and the tuples w˜ 1 and w˜ 2 of X -faults of S¬ such that the circuit S¬ (w˜ 1 ) implements a function equal to xi , while the circuit S¬ (w˜ 2 ) implements a function equal to ¬xi . Tuples w˜ 1 and w˜ 2 contain one function that is a subfunction of the function g in which variables x1 , . . . , xi−1 , xi+1 , . . . , xn are replaced by constants ˜ respectively. Replacing the variable xi by x, we obtain the from the tuples α˜ and β, required circuit. Corollary 4.1 Let B be a linear basis with k(B) ≥ 2 and X be an extended class of constant faults for B. Then there exists an iteration-free circuit S¬ in the basis B and tuples w˜ 1 and w˜ 2 of X -faults of the circuit S¬ such that the circuit S¬ (w˜ 1 ) implements a function equal to x, and the circuit S¬ (w˜ 2 ) implements a function equal to ¬x. Proof Since k(B) ≥ 2, the basis B contains a linear function with at least two essential variables. Evidently, this function is not unate. Using Lemma 4.7, we obtain that there exists an iteration-free circuit S¬ in the basis B and tuples w˜ 1 and w˜ 2 of X -faults of the circuit S¬ such that the circuit S¬ (w˜ 1 ) implements a function equal to x, and the circuit S¬ (w˜ 2 ) implements a function equal to ¬x.
62
4 Diagnosis of Extensions of Constant Faults in Circuits
Lemma 4.8 Let B be a unate basis with k(B) ≥ 2, X be an extended class of constant faults for B, f (x1 , . . . , xn ) ∈ B, f (x1 , . . . , xn ) = g x1σ1 , . . . , xnσn , where function, (σ1 , . . . , σn ) ∈ {0, 1}n and g (x1 , . . . , xn ) is a monotone and the set of faults X ( f ) contain a function f (x1 , . . . , xn ) = g x1τ1 , . . . , xnτn , where (τ1 , . . . , τn ) ∈ {0, 1}n , g (x1 , . . . , xn ) is a monotone function, and there exists i ∈ {1, . . . , n} such that σi = τi and xi is an essential variable of the function g . Then there exists an iteration-free circuit S¬ in the basis B and tuples w˜ 1 and w˜ 2 of X -faults of the circuit S¬ such that the circuit S¬ (w˜ 1 ) implements a function equal to x, and the circuit S¬ (w˜ 2 ) implements a function equal to ¬x. Proof Suppose for definiteness that σi = 0 and τi = 1. Since xi is an essential variable of the function f , it is an essential variable of the function g. Therefore there are two tuples α˜ = (α1 , . . . , αi−1 , 0, αi+1 , . . . , αn ) and β˜ = (α1 , . . . , αi−1 , 1, αi+1 , . . . , ˜ Since the function g is monotone, g(α) ˜ = g(β). ˜ =0 αn ) from {0, 1}n such that g(α) ˜ = 1. It is easy to see that q(x) = g(α1 , . . . , αi−1 , ¬xi , αi+1 , . . . , αn ) = and g(β) σi−1 σi+1 , xi , αi+1 , . . . , αnσn ) = ¬xi . In a similar way, we can find values f (α1σ1 , . . . , αi−1 γ1 , . . . , γi−1 , γi+1 , . . . , γn ∈ {0, 1} such that τi−1 τi+1 , xi , γi+1 , . . . , γnτn = xi . g (γ1 , . . . , γi−1 , xi , γi+1 , . . . , γn ) = f γ1τ1 , . . . , γi−1 We now describe the circuit S¬ and the tuples w˜ 1 and w˜ 2 of X -faults satisfying the conditions of the lemma. The circuit S¬ consists of one gate that implements the function f (x1 , . . . , xn ). The tuple of X -faults w˜ 1 can be described in the following way: instead of the function f (x1 , . . . , xn ), the gate implements the function f (x1 , . . . , xn ), and at its inputs with numbers 1, . . . , i − 1, i + 1, . . . , n there are τi−1 τi+1 , γi+1 , . . . , γnτn , respectively. The tuple of X -faults w˜ 2 can constants γ1τ1 , . . . , γi−1 be described in the following way: the gate implements the function f (x1 , . . . , xn ), and at its inputs with numbers 1, . . . , i − 1, i + 1, . . . , n there are constants σ
σ
i−1 i+1 , αi+1 , . . . , αnσn , α1σ1 , . . . , αi−1
respectively. Replacing the variable xi by x, we obtain the required circuit.
The proof of the following statement is similar to the proof of Lemma 2.12. Lemma 4.9 Let B be a basis with k(B) ≥ 2, X be an extended class of constant faults for B, f (x1 , . . . , xn ) ∈ B, the set X ( f ) contain a nonlinear function q(x1 , . . . , xn ), and there exist an iteration-free circuit S¬ in the basis B and tuple u˜ of X -faults ˜ implements a function equal to ¬x. Then of the circuit S¬ such that the circuit S¬ (u) there exist an iteration-free circuit S∧ in the basis B and a tuple w˜ of X -faults of the ˜ implements a function equal to the function circuit S∧ such that the circuit S∧ (w) x ∧ y. Proof It is well known (see Theorem 6 with the consequent note in [10]) that the function q has the unique representation in the form of a Zhegalkin polynomial:
4.3 Impossibility of Further Extensions
q(x1 , . . . , xn ) =
63
ai1 ···is · xi1 · . . . · xis (mod 2) ,
{i 1 ,...,i s }⊆{1,...,n}
where · is the usual multiplication and ai1 ···is ∈ {0, 1}, {i 1 , . . . , i s } ⊆ {1, . . . , n}. Since q is nonlinear, the Zhegalkin polynomial for q contains a term with at least two variables. Without loss of generality, we can assume that x1 and x2 are among these variables. Then we can transform the considered polynomial as follows: q(x1 , . . . , xn ) = x1 · x2 · q1 (x3 , . . . , xn ) + x1 · q2 (x3 , . . . , xn ) +x2 · q3 (x3 , . . . , xn ) + q4 (x3 , . . . , xn )(mod 2) . From uniqueness of the Zhegalkin polynomial it follows that q1 (x3 , . . . , xn ) ≡ 0. Let α3 , . . . , αn be numbers from {0, 1} such that q1 (α3 , . . . , αn ) = 1. Then χ (x1 , x2 ) = q(x1 , x2 , α3 , . . . , αn ) = x1 · x2 + α · x1 + β · x2 + γ (mod 2), where α, β, γ ∈ {0, 1}. Consider the function ψ(x1 , x2 ) = χ (x1 + β(mod 2), x2 + α(mod 2)) + γ + α · β(mod 2). One can show that ψ(x1 , x2 ) = x1 · x2 = x1 ∧ x2 . Denote σ1 = ¬β, σ2 = ¬α and σ3 = ¬(γ + α · β(mod 2)). Then (q(x1σ1 , x2σ2 , α3 , . . . , αn ))σ3 = x1 ∧ x2 . From this equality it follows that based on the function q and on the circuit S¬ we can construct an iteration-free circuit S∧ in the basis B and a tuple w˜ of X -faults of ˜ implements a function equal to the function the circuit S∧ such that the circuit S∧ (w) x ∧ y. Lemma 4.10 Let B be a basis with k(B) ≥ 2, X be an extended class of constant faults for B, there exist an iteration-free circuit S¬ in the basis B and tuples w˜ 1 and w˜ 2 of X -faults of the circuit S¬ such that the circuit S¬ (w˜ 1 ) implements a function equal to the function x, while the circuit S¬ (w˜ 2 ) implements a function equal to the function ¬x, and there exist an iteration-free circuit S∧ in the basis B and a tuple w˜ ˜ implements a function equal of X -faults of the circuit S∧ such that the circuit S∧ (w) to the function x ∧ y. Then, for any r ∈ IN \ {0}, there exists an iteration-free circuit Sr in the basis B such that L(Sr ) ≤ (L(S¬ ) + L(S∧ ))r and h X (Sr ) ≥ 2r . Proof Using the circuits S¬ and S∧ , one can construct for any r ∈ IN \ {0} an iteration-free circuit Sr in the basis B with the following properties: • For any σ˜ = (σ1 , . . . , σr ) ∈ {0, 1}r , there exists a tuple u(σ˜ ) of X -faults of the circuit Sr such that the circuit Sr (u(σ˜ )) implements a function equal to the function x1σ1 ∧ . . . ∧ xrσr . • There exists a tuple v˜ of X -faults of the circuit Sr such that the circuit Sr (˜v) implements a function equal to the function 0. • L(Sr ) ≤ dr , where d = L(S¬ ) + L(S∧ ). Let us show that h X (Sr ) ≥ 2r . Let the circuit Sr have exactly m ≥ r inputs labeled with variables x1 , . . . , xm . The function implemented by the circuit Sr (˜v) will be denoted by f and, for any tuple σ˜ ∈ {0, 1}r , the function implemented by the circuit
64
4 Diagnosis of Extensions of Constant Faults in Circuits
Sr (u(σ˜ )) will be denoted by f σ˜ . Let σ˜ = (σ1 , . . . , σr ) ∈ {0, 1}r . One can show that the functions f and f σ˜ have different values on a tuple (δ1 , . . . , δm ) ∈ {0, 1}m if and only if δ1 = σ1 , . . . , δr = σr . Hence the minimum cardinality of a set of tuples from {0, 1}m on which the function f is different from any function f σ˜ , σ˜ ∈ {0, 1}r , is equal to 2r . Using the same reasoning as in the proof of Lemma 2.1, we obtain h X (Sr ) ≥ 2r . Theorem 4.3 Let B be a linear basis with k(B) ≥ 2, X be an extended class of constant faults for B, and there be a function f ∈ B such that X ( f ) l( f ). Then there is a natural number d such that, for any r ∈ IN \ {0}, there exists an iterationfree circuit Sr in the basis B for which L(Sr ) ≤ dr and h X (Sr ) ≥ 2r . Proof From Corollary 4.1 it follows that there exists an iteration-free circuit S¬ in the basis B and tuples w˜ 1 and w˜ 2 of X -faults of the circuit S¬ such that the circuit S¬ (w˜ 1 ) implements a function equal to x, and the circuit S¬ (w˜ 2 ) implements a function equal to ¬x. Since X ( f ) l( f ), the set X ( f ) contains a nonlinear function. By Lemma 4.9, there exists an iteration-free circuit S∧ in the basis B and a tuple w˜ of X -faults of the ˜ implements a function equal to the function circuit S∧ such that the circuit S∧ (w) x ∧ y. Denote d = L(S¬ ) + L(S∧ ). Using Lemma 4.10, we obtain that, for any r ∈ IN \ {0}, there exists an iteration-free circuit Sr in the basis B such that L(Sr ) ≤ dr and h X (Sr ) ≥ 2r . From this theorem and Theorem 4.1, it follows that the complete class of linear faults l B is the maximum extended class of constant faults for the linear basis B with k(B) ≥ 2, which preserves the efficiency of diagnosis. Theorem 4.4 Let B be a unate basis with k(B) ≥ 2, X be an extended class of constant faults for B, and there be a function f (x1 , . . . , xn ) ∈ B such that X ( f ) u( f ). Then there is a natural number d such that, for any r ∈ IN \ {0}, there exists an iteration-free circuit Sr in the basis B for which L(Sr ) ≤ dr and h X (Sr ) ≥ 2r . Proof Let f (x1 , . . . , xn ) = g(x1σ1 , . . . , xnσn ), where g(x1 , . . . , xn ) is a monotone a function and (σ1 , . . . , σn ) ∈ {0, 1}n . Since X ( f ) u( f ), the set X ( f ) contains τ1
x , . . . , x ) that is not unate or a function f , . . . , x , . . . , function q(x = g (x ) 1 n 1 n 1 xnτn , where (τ1 , . . . , τn ) ∈ {0, 1}n , g (x1 , . . . , xn ) is a monotone function, and there exists i ∈ {1, . . . , n} such that σi = τi and xi is an essential variable of the function g . Using Lemmas 4.7 and 4.8, we obtain that there exists an iteration-free circuit S¬ in the basis B and tuples w˜ 1 and w˜ 2 of X -faults of the circuit S¬ such that the circuit S¬ (w˜ 1 ) implements a function equal to x, and the circuit S¬ (w˜ 2 ) implements a function equal to ¬x. Since B is a unate basis with k(B) ≥ 2, it contains a nonlinear function. By Lemma 4.9, there exists an iteration-free circuit S∧ in the basis B and a tuple w˜ of ˜ implements a function equal to X -faults of the circuit S∧ such that the circuit S∧ (w) the function x ∧ y.
4.4 Optimal Bases for Some Closed Classes
65
Denote d = L(S¬ ) + L(S∧ ). Using Lemma 4.10, we obtain that, for any r ∈ IN \ {0}, there exists an iteration-free circuit Sr in the basis B such that L(Sr ) ≤ dr and h X (Sr ) ≥ 2r . From this theorem and Theorem 4.2, it follows that the complete class of unate faults u B is the maximum extended class of constant faults for the unate basis B with k(B) ≥ 2, which preserves the efficiency of diagnosis.
4.4 Optimal Bases for Some Closed Classes In this section, we define the notion of an optimal basis for a closed class of Boolean functions, which order is at least 2. For each such class, we find an optimal basis. Let B be a linear basis with k(B) ≥ 2. We denote by C (B) the minimum natural c such that h l B (S) ≤ cL(S) for any iteration-free circuit S in the basis B, where l B is the complete class of linear faults for the basis B. The existence of such constant c follows from Theorem 4.1. Let U be a closed class of Boolean functions with k(U ) ≥ 2 that contains only linear functions. We denote by C (U ) the minimum value C (B), where B is a linear basis such that [B] = U . A linear basis B will be called an optimal basis for the class U relative to the complete class of linear faults l B if [B] = U and C (B) = C (U ). Theorem 4.5 Let U be a closed class of Boolean functions with k(U ) ≥ 2 that contains only linear functions and B be a linear basis such that [B] = U and k(B) = k(U ). Then B is an optimal basis for the class U relative to the complete class of linear faults l B and C (U ) = k(U ) + 1. Proof From Theorem 4.1 and from the equality k(B) = k(U ) it follows that h l B (S) ≤ (k(U ) + 1)L(S) for any iteration-free circuit S in the basis B. Therefore C (U ) ≤ C (B) ≤ k(U ) + 1. Let B be an arbitrary linear basis such that [B ] = U . Then k(B ) ≥ k(U ) and the basis B contains a linear function with n ≥ k(U ) variables f = x1 + . . . + xn + c(mod 2), where c ∈ {0, 1}. The set l( f ) contains 2n+1 functions. Using this fact, it is not difficult to show that h l B (S f ) ≥ n + 1, where S f is an iteration-free circuit with one gate that implements the function f . Therefore C (B ) ≥ k(U ) + 1 and C (U ) ≥ k(U ) + 1. Thus, C (U ) = k(U ) + 1 and B is an optimal basis for the class U relative to the complete class of linear faults l B . Let B be a unate basis with k(B) ≥ 2. We denote by C (B) the minimum natural c such that h u B (S) ≤ cL(S) for any iteration-free circuit S in the basis B, where u B is the complete class of unate faults for the basis B. The existence of such constant c follows from Theorem 4.2. Let U be a closed class of Boolean functions with k(U ) ≥ 2 that contains nonlinear functions. We denote by C (U ) the minimum value C (B), where B is a unate basis such that [B] = U (the existence of such bases follows from Proposition 2.1). A unate basis B will be called an optimal basis for the class U relative to the complete class of unate faults u B if [B] = U and C (B) = C (U ).
66
4 Diagnosis of Extensions of Constant Faults in Circuits
Theorem 4.6 Let U be a closed class of Boolean functions with k(U ) ≥ 2 that contains only nonlinear functions and B be a unate basis such that [B] = U and k(B) = k(U ). Then B is an optimal basis for the class U relative to the complete class of unate faults u B and C (U ) = D(k(U )). Proof From Theorem 4.2 and from the equality k(B) = k(U ) it follows that h u B (S) ≤ D(k(U ))L(S) for any iteration-free circuit S in the basis B. Therefore C (U ) ≤ C (B) ≤ D(k(U )). Let B be an arbitrary unate basis such that [B ] = U . Then k(B ) ≥ k(U ) and B contains a unate function f with k( f ) = k(B ). Using Lemma 4.6, we obtain that h u B (S f ) = D(k(B )), where S f is an iteration-free circuit with one gate that implements the function f . Since D is a strictly increasing function, C (B ) ≥ D(k(U )) and C (U ) ≥ D(k(U )). Thus, C (U ) = D(k(U )) and B is an optimal basis for the class U relative to the complete class of unate faults uB. Let U be a closed class of Boolean functions with k(U ) ≥ 2 and B be an optimal basis for U . This basis can be used for construction and diagnosis of circuits implementing functions from U . Let f ∈ U . It is clear that f can be implemented by formulas over the basis B. Let ϕ be a formula over B implementing the function f . Then we construct a circuit S in the basis B, which corresponds to ϕ and, in particular, satisfies the following conditions: • The circuit S implements the function f . • L(S) = L(ϕ), where L(ϕ) is the number of functional symbols in the formula ϕ. • At most one edge leaves any gate of the circuit S. It is clear that S is a formula-like circuit. In addition to the normal operation mode of the circuit S, there exists the diagnostic mode in which the inputs of the circuit S having more than one leaving edge are “split” so that it become an iteration-free circuit S (inputs of S are labeled with pairwise different variables). The relations h X (S ) ≤ C (U )L(S ) = C (U )L(ϕ) hold for the circuit S , where X = l B if B is linear and X = u B if B is unate. We now describe for each closed class U with k(U ) ≥ 2 an optimal basis and the parameter C (U ). Our considerations are based on Theorems 4.5 and 4.6. Note that, for all classes with the exception of C2 , C3 and C4 , the given bases coincide with bases, which are considered in Appendix A. The new bases for the classes C2 , C3 and C4 are considered in the proof of Proposition 2.1. 1. The class S1 consists of all disjunctions. For this class, k(S1 ) = 2, C (S1 ) = 3 and {x ∨ y} is an optimal basis. 2. The class S3 consists of all disjunctions and all functions equal to 1. For this class, k(S3 ) = 2, C (S3 ) = 3 and {x ∨ y, 1} is an optimal basis. 3. The class S5 consists of all disjunctions and all functions equal to 0. For this class, k(S5 ) = 2, C (S5 ) = 3 and {x ∨ y, 0} is an optimal basis. 4. The class S6 consists of all disjunctions and all functions equal to 0 or 1. For this class, k(S6 ) = 2, C (S6 ) = 3 and {x ∨ y, 0, 1} is an optimal basis.
4.4 Optimal Bases for Some Closed Classes
67
5. The class P1 consists of all conjunctions. For this class, k(P1 ) = 2, C (P1 ) = 3 and {x ∧ y} is an optimal basis. 6. The class P3 consists of all conjunctions and all functions equal to 0. For this class, k(P3 ) = 2, C (P3 ) = 3 and {x ∧ y, 0} is an optimal basis. 7. The class P5 consists of all conjunctions and all functions equal to 1. For this class, k(P5 ) = 2, C (P5 ) = 3 and {x ∧ y, 1} is an optimal basis. 8. The class P6 consists of all conjunctions and all functions equal to 0 or 1. For this class, k(P6 ) = 2, C (P6 ) = 3 and {x ∧ y, 0, 1} is an optimal basis. 9. The class L 1 consists of all linear functions. For this class, k(L 1 ) = 2, C (L 1 ) = 3 and {x + y(mod 2), 1} is an optimal basis. 10. The class L 2 consists of all linear α-functions and β-functions. For this class, k(L 2 ) = 2, C (L 2 ) = 3 and {x + y + 1(mod 2)} is an optimal basis. 11. The class L 3 consists of all linear α-functions and γ -functions. For this class, k(L 3 ) = 2, C (L 3 ) = 3 and {x + y(mod 2)} is an optimal basis. 12. The class L 4 consists of all linear α-functions. For this class, k(L 4 ) = 3, C (L 4 ) = 4 and {x + y + z(mod 2)} is an optimal basis. 13. The class L 5 consists of all linear self-dual functions. For this class, k(L 5 ) = 3, C (L 5 ) = 4 and {x + y + z + 1(mod 2)} is an optimal basis. 14. The class D2 consists of all self-dual monotone functions. For this class, k(D2 ) = 3, C (D2 ) = 6 and {(x ∧ y) ∨ (x ∧ z) ∨ (y ∧ z)} is an optimal basis. 15. The class D1 consists of all self-dual α-functions. For this class, k(D1 ) = 3, C (D1 ) = 6 and {(x ∧ y) ∨ (x ∧ ¬z) ∨ (y ∧ ¬z)} is an optimal basis. 16. The class D3 consists of all self-dual functions. For this class, k(D3 ) = 3, C (D3 ) = 6 and {(x ∧ ¬y) ∨ (x ∧ ¬z) ∨ (¬y ∧ ¬z)} is an optimal basis. 17. The class A1 consists of all monotone functions. For this class, k(A1 ) = 2, C (A1 ) = 3 and {x ∧ y, x ∨ y, 0, 1} is an optimal basis. 18. The class A2 consists of all monotone α-functions and β-functions. For this class, k(A2 ) = 2, C (A2 ) = 3 and {x ∧ y, x ∨ y, 1} is an optimal basis. 19. The class A3 consists of all monotone α-functions and γ -functions. For this class k(A3 ) = 2, C (A3 ) = 3 and {x ∧ y, x ∨ y, 0} is an optimal basis. 20. The class A4 consists of all monotone α-functions. For this class, k(A4 ) = 2, C (A4 ) = 3 and {x ∧ y, x ∨ y} is an optimal basis. 21. The class C1 consists of all Boolean functions. For this class, k(C1 ) = 2, C (C1 ) = 3 and {¬x ∨ ¬y} is an optimal basis. 22. The class C2 consists of all α-functions and β-functions. For this class, k(C2 ) = 2, C (C2 ) = 3 and {x ∧ y, x ∨ ¬y} is an optimal basis. 23. The class C3 consists of all α-functions and γ -functions. For this class, k(C3 ) = 2, C (C3 ) = 3 and {x ∨ y, x ∧ ¬y} is an optimal basis. 24. The class C4 consists of all α-functions. For this class, k(C4 ) = 3, C (C4 ) = 6 and {x ∨ y, x ∧ y, x ∨ (y ∧ ¬z)} is an optimal basis. μ 25. The class F1 (μ = 2, 3, . . .) consists of all α-functions satisfying the condiμ μ tion a μ . For this class, k(F1 ) = μ + 1, C (F1 ) = D(μ + 1) and {x ∨ (y ∧ ¬z), h ∗μ } is an optimal basis.
68
4 Diagnosis of Extensions of Constant Faults in Circuits μ
26. The class F2 (μ = 2, 3, . . .) consists of all monotone α-functions satisfying the μ μ condition a μ . For this class, k(F2 ) = μ + 1, C (F2 ) = D(μ + 1), {x ∨ (y ∧ ∗ ∗ z), h 2 } is an optimal basis if μ = 2 and {h μ } is an optimal basis if μ ≥ 3. μ 27. The class F3 (μ = 2, 3, . . .) consists of all monotone functions satisfying the μ μ condition a μ . For this class, k(F3 ) = μ + 1, C (F3 ) = D(μ + 1) and {h ∗μ , 1} is an optimal basis. μ 28. The class F4 (μ = 2, 3, . . .) consists of all functions satisfying the condition μ μ μ a . For this class, k(F4 ) = μ + 1, C (F4 ) = D(μ + 1) and {x ∨ ¬y, h ∗μ } is an optimal basis. μ 29. The class F5 (μ = 2, 3, . . .) consists of all α-functions satisfying the condiμ μ μ tion A . For this class, k(F5 ) = μ + 1, C (F5 ) = D(μ + 1) and {x ∧ (y ∨ ¬z), h μ } is an optimal basis. μ 30. The class F6 (μ = 2, 3, . . .) consists of all monotone α-functions satisfying the μ μ condition Aμ . For this class, k(F6 ) = μ + 1, C (F6 ) = D(μ + 1), {x ∧ (y ∨ z), h 2 } is an optimal basis if μ = 2 and {h μ } is an optimal basis if μ ≥ 3. μ 31. The class F7 consists of all monotone functions satisfying the condition Aμ . μ μ For this class, k(F7 ) = μ + 1, C (F7 ) = D(μ + 1) and {h μ , 0} is an optimal basis. μ 32. The class F8 (μ = 2, 3, . . .) consists of all functions satisfying the condition μ μ μ A . For this class, k(F8 ) = μ + 1, C (F8 ) = D(μ + 1) and {x ∧ ¬y, h μ } is an optimal basis. 33. The class F1∞ consists of all α-functions satisfying the condition a ∞ . For this class, k(F1∞ ) = 3, C (F1∞ ) = 6 and {x ∨ (y ∧ ¬z)} is an optimal basis. 34. The class F2∞ consists of all monotone α-functions satisfying the condition a ∞ . For this class, k(F2∞ ) = 3, C (F2∞ ) = 6 and {x ∨ (y ∧ z)} is an optimal basis. 35. The class F3∞ consists of all monotone functions satisfying the condition a ∞ . For this class, k(F3∞ ) = 3, C (F3∞ ) = 6 and {1, x ∨ (y ∧ z)} is an optimal basis. 36. The class F4∞ consists of all functions satisfying the condition a ∞ . For this class, k(F4∞ ) = 2, C (F4∞ ) = 3 and {x ∨ ¬y} is an optimal basis. 37. The class F5∞ consists of all α-functions satisfying the condition A∞ . For this class, k(F5∞ ) = 3, C (F5∞ ) = 6 and {x ∧ (y ∨ ¬z)} is an optimal basis. 38. The class F6∞ consists of all monotone α-functions satisfying the condition A∞ . For this class, k(F6∞ ) = 3, C (F6∞ ) = 6 and {x ∧ (y ∨ z)} is an optimal basis. 39. The class F7∞ consists of all monotone functions satisfying the condition A∞ . For this class, k(F7∞ ) = 3, C (F7∞ ) = 6 and {0, x ∧ (y ∨ z)} is an optimal basis. 40. The class F8∞ consists of all functions satisfying the condition A∞ . For this class, k(F8∞ ) = 2, C (F8∞ ) = 3 and {x ∧ ¬y} is an optimal basis.
4.5 Complexity of Diagnosis
69
4.5 Complexity of Diagnosis In this section, we consider the complexity of implementation of functions from closed classes by formula-like circuits and the complexity of these circuit diagnosis. Let U be a closed class of Boolean functions with k(U ) ≥ 2 and B be a quasiprimitive basis such that U ⊆ [B]. Let X be an extended class of constant faults for B such that X = l B if B is linear and X = u B if B is unate. Let n ∈ IN \ {0}. We denote by U (n) the set of functions from U with n variables. For f ∈ U (n), we denote by L B ( f ) the minimum number of functional symbols in a formula over B, which implements the function f . Set L B,U (n) = max{L B ( f ) : f ∈ U (n)}. We consider the following way to implement functions from U (n) by circuits in the basis B and to diagnose X -faults in these circuits. For a function f ∈ U (n), we construct a formula-like circuit S in the basis B, which implements f and for which L(S) ≤ L B,U (n). In addition to the normal operation mode of S, we use the diagnostic mode in which the inputs of S having more than one leaving edge are “split” and it become an iteration-free circuit S . We know that h X (S ) ≤ C (B)L(S ) ≤ C (B)L B,U (n). We now consider several pairs B, U , where B is a quasiprimitive basis and U is a closed class such that U ⊆ [B] and k(U ) ≥ 2. For each such pair, we give the value C (B) and estimate the function L B,U (n). Let B1 = {x + y(mod 2), 1} and U ∈ {L 1 , . . . , L 5 }. One can show that C (B1 ) = 3 and L B1 ,U (n) ≤ n. Let B2 = {x ∨ y, 0, 1} and U ∈ {S1 , S3 , S5 , S6 }. One can show that C (B2 ) = 3 and L B2 ,U (n) ≤ n − 1. Let B3 = {x ∧ y, 0, 1} and U ∈ {P1 , P3 , P5 , P6 }. One can show that C (B3 ) = 3 and L B3 ,U (n) ≤ n − 1. We now consider some results mentioned in the survey of Ugol’nikov [9] and obtained by Lupanov [3], Andreev [1] and Ugol’nikov [8]. n Let B4 = {¬x ∨ ¬y}. Then C (B4 ) = 3, L B4 ,C1 (n) ∼ log2 n (note that C1 = 2 n 2n−1 2 √ 2n ∞ ∞ [B4 ]), L B4 ,F1 (n) ∼ log n , L B4 ,A1 (n) ∼ π n log n , and L B4 ,F2 (n) ∼ √12π √n 2log n . 2 2 2 n Let B5 = {x ∧ y, x ∨ y, 0, 1}. Then C (B5 ) = 3 and L B5 ,A1 (n) ∼ π2 √n 2log n 2 (note that A1 = [B5 ]). Let B6 = {(x ∧ y) ∨ (x ∧ ¬z) ∨ (y ∧ ¬z)}. Then C (B6 ) = 6 and L B6 ,D1 (n) ∼ 2n−2 (note that D1 = [B6 ]). log2 n Note that the obtained upper bounds on complexity of diagnosis are considerably less than the trivial upper bound, which is equal to 2n . The results on the behavior of the function L B,U (n) can be used not only to obtain upper bounds for the complexity of diagnostics, but also to obtain lower bounds. Let U be a closed class of Boolean functions with k(U ) ≥ 2, n ∈ IN \ {0} and f be a function from U (n) such that L B4 ( f ) = L B4 ,U (n). Let S be a formula-like circuit in the basis B4 , which implements the function f . Then L(S) ≥ L B4 ,U (n). Let S be the iteration-free circuit obtained from S by “splitting” inputs that have more than one leaving edge. Then L(S ) ≥ L B4 ,U (n).
70
4 Diagnosis of Extensions of Constant Faults in Circuits
Let us show that h X (S ) ≥ L B4 ,U (n), where X = u B . The basis B4 contains only one function ¬x ∨ ¬y. It is clear that the set u(¬x ∨ ¬y) contains functions ¬x ∨ ¬y and ¬x ∧ ¬y. Each of these functions depends on two variables and both variables are essential. Using this fact, one can prove by induction on L(S ) that the circuit S
with X -faults can implement at least 2 L(S ) pairwise different functions. From here
it follows that h X (S ) ≥ L(S ) ≥ L B4 ,U (n).
References 1. Andreev, A.E.: Complexity of monotonic functions. Moscow Univ. Mech. Bull. 40(4), 45–49 (1985) 2. Hansel, G.: Sur le nombre des fonctions booleennes monotones de n variables. C. R. Acad. Sci. Paris 262(20), 1088–1090 (1966) 3. Lupanov, O.B.: On the complexity of realization of functions of propositional calculus by formulas. In: Probl. Kibern., vol. 3, pp. 61–80. Nauka Publishers, Moscow (1960). (in Russian) 4. Moshkova, A.: Extension for some closed classes of Boolean functions of the class of constant faults while maintaining the efficiency of diagnostics. In: Fourth Youth Scientific School on Discrete Mathematics and Its Applications, Moscow State University, Moscow, Russia, September 18–23, 2000, pp. 59–64 (2000). (in Russian) 5. Moshkova, A.: On diagnosis of extensions to the class of constant faults in circuits. In: Seventh International Seminar on Discrete Mathematics and Its Applications, Moscow State University, Moscow, Russia, January 29–February 2, 2001, part 1, pp. 70–73 (2001). (in Russian) 6. Moshkova, A.: On the maximum extensions of the class of constant faults of non-repeating circuits that preserve the efficiency of diagnostics. In: 11th Interstate School-Seminar on Synthesis and Complexity of Control Systems, Nizhny Novgorod State University, Nizhny Novgorod, Russia, November 20–25, 2000, part 1, pp. 117–121 (2001). (in Russian) 7. Moshkova, A.: Optimal bases for closed classes of Boolean functions. In: International SchoolSeminar on Discrete Mathematics and Mathematical Cybernetics, Ratmino, Russia, May 31– June 3, 2001, p. 23. MAKS Press, Moscow (2001). (in Russian) 8. Ugol’nikov, A.B.: The synthesis of schemes and formulas in incomplete bases. Dokl. Akad. Nauk SSSR 249(1), 60–63 (1979). (in Russian) 9. Ugol’nikov, A.B.: Complexity of functions from closed classes. In: Seminar on Discrete Mathematics and Its Applications, Moscow State University, Moscow, Russia, February 2–4, 1993, pp. 49–56 (1998). (in Russian) 10. Yablonskii, S.V., Gavrilov, G.P., Kudriavtzev, V.B.: Functions of the Algebra of Logic and Post Classes. Nauka Publishers, Moscow (1966). (in Russian)
Chapter 5
Diagnosis of Retaining Faults in Circuits
In this chapter, we study so-called retaining faults of circuits. We consider only bases such that each variable in each function from the basis is an essential variable. Let a gate of a circuit implement in the normal state a function f with n ≥ 1 variables, and two tuples α 0f and α 1f are fixed such that f (α 0f ) = 0 and f (α 1f ) = 1. Then, in general case, this gate with a fault can implement an arbitrary function g with n variables such that g(α 0f ) = 0 and g(α 1f ) = 1. Let a gate implement a constant from the set {0, 1}. Then this gate has no faults. The considered faults are called retaining. Let B be a basis. We divide the basis B into two parts: the set BC = B ∩ {0, 1} and the set B F = B \ {0, 1}. We prove that, for any iteration-free circuit S in the basis B F , the minimum depth of a decision tree for diagnosis of arbitrary retaining faults in S is bounded from above by the value cL(S), where c is a constant depending only on the basis B and L(S) is the number of gates in S. We denote by c B the minimum possible constant c for the basis B, which satisfies the mentioned conditions. We consider the following approach to the design and diagnosis of circuits. Only formula-like circuits in the basis B F are used. In addition to the normal operation mode of the circuit, there exists the diagnostic mode in which the circuit transforms by splitting some inputs into an iteration-free circuit. Let U be a closed class of Boolean functions. We consider only bases B of the class U such that U = [B F ] ∪ BC , where [B F ] is the closure of the set B F relative to the operation of substitution and the operations of insertion and deletion of unessential variable. The basis B for which the constant c B has the minimum value is called optimal. We find an optimal basis for each closed class of Boolean functions. We also study relationships between two types of Shannon functions. A function of the first type characterizes the complexity of diagnosis of formula-like circuits implementing Boolean functions from a closed class. A function of the second type characterizes the complexity of formulas implementing Boolean functions from a closed class. The obtained results allow us to transfer some known bounds for Shannon functions of the second type to the case of Shannon functions of the first type. © The Author(s), under exclusive license to Springer Nature Switzerland AG 2023 M. Busbait et al., Decision Trees for Fault Diagnosis in Circuits and Switching Networks, Studies in Systems, Decision and Control 493, https://doi.org/10.1007/978-3-031-39031-9_5
71
72
5 Diagnosis of Retaining Faults in Circuits
In particular, based on the results of Ugol’nikov mentioned in the survey [4], we show that, for the class C2 consisting of all α-functions and β-functions and its basis {x ∨ y, x + y + 1(mod 2)}, the asymptotic behavior of the Shannon function n of the first type is equal to log2 n , where n is the number of inputs in the considered 2 formula-like circuits. Note that each gate in these circuits has the normal state and exactly one faulty state. This chapter is based mainly on the papers of Moshkova [1–3]. Definitions, notation, and results from Appendix A “Closed Classes of Boolean Functions” are used in this chapter without special notice. We also use definitions and notation related to the circuits from Sect. 2.1.1. This chapter contains four sections. In Sect. 5.1, main definitions are discussed. In Sect. 5.2, the depth of decision trees for diagnosis of retaining faults in iteration-free circuits is studied. In Sect. 5.3, optimal bases for closed classes of Boolean functions are considered. In Sect. 5.4, the relationships between two types of Shannon functions are investigated.
5.1 Main Definitions In this chapter, we will study only bases such that each variable in each function from the basis is an essential variable. It will be convenient for us to consider one of the gates of a circuit as its output. We will study only circuits in which, for each gate v, there exists a path from an input or from a gate implementing a constant from the set {0, 1} to the output passing through the gate v. First, we recall some notation and definitions. Two Boolean functions are called equal if they differ only by unessential variables. We will assume that if a Boolean function f is given, then all functions equal to f are given. Often we will not distinguish equal functions. Let U be a nonempty set of Boolean functions. We denote by [U ] the closure of the set U relatively the operation of substitution (with the assumption on equal functions). The set U is called a closed class if U = [U ]. We denote by k( f ) the number of essential variables of the function f . The number k( f ) is called the order of the function f . Let B be a basis. Denote k(B) = max{k( f ) : f ∈ B}. The number k(B) is called the order of the basis B. Denote by k(U ) the minimum order of a basis B such that [B] = U . The number k(U ) is called the order of the class U . Let B be a basis and S be a circuit in the basis B. We denote by L(S) the number of gates in the circuit S. The circuit S is called a formula-like circuit if at most one edge leaves each gate of the circuit S. The circuit S is called an iteration-free circuit if at most one edge leaves each input and each gate of the circuit S. We now consider the notion of retaining faults. Divide the basis B into two parts: B = BC ∪ B F , where BC = B ∩ {0, 1} and B F = B \ {0, 1}. For each function f (x1 , . . . , xn ) ∈ B F , fix two tuples α 0f and α 1f from {0, 1}n such that f (α 0f ) = 0
5.2 Diagnosis of Iteration-Free Circuits
73
and f (α 1f ) = 1. Denote by G all (α 0f , α 1f ) the set of Boolean functions g(x1 , . . . , xn ) such that g(α 0f ) = 0 and g(α 1f ) = 1. A class of retaining faults for B is a family G = {G( f ) : f ∈ B} such that G( f ) = { f } if f ∈ BC , and G( f ) ⊆ G all (α 0f , α 1f ) and f ∈ G( f ) for any f ∈ B F . For example, if f (x, y) = x ∨ y, α 0f = (0, 0) and α 1f = (1, 1), then G all (α 0f , α 1f ) = {x ∨ y, x ∧ y, x, y}. If f (x) = x, then α 0f = (0), α 1f = (1) and G all (α 0f , α 1f ) = {x}. If f (x) = ¬x, then α 0f = (1), α 1f = (0) and G all (α 0f , α 1f ) = {¬x}. A class G of retaining faults will be called complete if G( f ) = G all (α 0f , α 1f ) for any f ∈ B F . A class G of retaining faults will be called essential if, for any f (x1 , . . . , xn ) ∈ B F , each variable of each function g(x1 , . . . , xn ) ∈ G( f ) is essential. Let S be a circuit in the basis B. If a gate of S implements in normal state a function f ∈ B, then this gate with a fault implements an arbitrary but fixed function from G( f ). The diagnosis problem for the circuit S relatively the faults from G consists in the recognition of the function implementing by the circuit S, which, possibly, has faults from the class G. As algorithms for this problem solving, the decision trees are used. Each query (attribute) of a decision tree consists in observation of the output of the circuit at the inputs of which a binary tuple is given. As a complexity measure, we consider the depth of a decision tree (the maximum number of queries made by the decision tree). The notion of a decision tree solving the problem under consideration can be defined formally similarly to the definition from Sect. 2.1.4. Denote by h G (S) the minimum depth of a decision tree, which solves the diagnosis problem for the circuit S relatively the faults from the class G.
5.2 Diagnosis of Iteration-Free Circuits In this section, we obtain a linear upper bound on the depth of decision trees for diagnosis of retaining faults in iteration-free circuits depending on the number of gates. Let B be a basis and G be a class of retaining faults for B. For any function f ∈ B F , denote by S f the iteration-free circuit, which contains exactly one gate and this gate implements the function f . The number h G (S f ) will be called the weight of the function f . Let S be a circuit in the basis B F . We denote by L G (S) the sum of weights of all gates in S (the weight of a gate is equal to the weight of function, which this gate implements). Theorem 5.1 Let B be a basis and G be a class of retaining faults for B. Then, for any iteration-free circuit S in the basis B F , the following inequality holds: h G (S) ≤ L G (S) .
74
5 Diagnosis of Retaining Faults in Circuits
Proof The statement of the theorem will be proved by induction on the number of gates in the circuit S. Let L(S) = 1 and the circuit S unique gate implement the function f . Then h G (S) = h G (S f ). Thus, the statement of the theorem holds if L(S) = 1. Assume that the considered statement holds if L(S) ≤ p for some p ≥ 1. Let us prove that this statement holds if L(S) = p + 1. Consider the gate w, which is the output of the circuit S. Let w have m inputs. Taking into account the nature of considered faults, one can show that we can obtain any m-tuple from {0, 1}m on the inputs of the gate w if we choose an appropriate tuple of values at inputs of the circuit S. Let the gate w in the normal state implement the function f ∈ B F . Then giving at most h G (S f ) tuples on circuit S inputs, we can identify the function g(y1 , . . . , ym ) implemented by the gate w, which, possibly, has a fault. Denote by Si (1 ≤ i ≤ m) the subcircuit of the circuit S such that the output of Si is the node (gate or input), which is connected with the ith input of the gate w by an edge. The subcircuit Si may contain either no gates (i.e., contains one input of the circuit S) or at least one gate. If the subcircuit Si consists of one input of the circuit S only (in this case, L G (Si ) = 0), then it is not necessary to solve the problem of Si diagnosis. Let L(Si ) ≥ 1. In this case, Si is an iteration-free circuit in the basis B F and L(Si ) ≤ p. Consider the variable yi of the function g. If yi is an unessential variable of the function g, then the value on the circuit S output does not depend on the value on the subcircuit Si output. In this case, we will not solve the problem of the subcircuit Si diagnosis. Let now yi be an essential variable of g. Then there exist numbers α1 , . . . , αi−1 , αi+1 , . . . , αm ∈ {0, 1} such that g(α1 , . . . , αi−1 , 0, αi+1 , . . . , αm ) = σ0 , g(α1 , . . . , αi−1 , 1, αi+1 , . . . , αm ) = σ1 and σ0 = σ1 . For each j ∈ {1, . . . , i − 1, i + 1, . . . , m}, we give to the inputs of the subcircuit S j such values that the output of S j will be equal to α j . We now can diagnose the subcircuit Si since if the value β ∈ {0, 1} will be on the output of Si , then the value σβ will be on the circuit S output, and σ0 = σ1 . Using the inductive hypothesis and the inequality L(Si ) ≤ p, we conclude that it is sufficient to make at most L G (Si ) queries during the process of the subcircuit Si diagnosis. For each j ∈ {1, . . . , m}, we define a function ϕ j . If y j is an unessential variable of the function g, then ϕ j = 0. If y j is an essential variable of the function g, L(S j ) = 0 and S j contains the input xi of the circuit S, then ϕ j = xi . If y j is an essential variable of the function g and L(S j ) ≥ 1, then ϕ j is equal to the function implemented by the subcircuit S j . One can show that the circuit S implements the function g(ϕ1 , . . . , ϕm ). It is not m difficult to see that in the process of the circuit S diagnosis at most h G (S f ) + i=1 L G (Si ) = L G (S) queries were made. Let B be a basis, B F = ∅ and G be a class of retaining faults for B. Denote HG (B) = max{h G (S f ) : f ∈ B F } .
5.3 Optimal Bases for Closed Classes
75
Corollary 5.1 Let B be a basis, B F = ∅ and G be a class of retaining faults for B. Then, for any iteration-free circuit S in the basis B F , the following inequality holds: h G (S) ≤ HG (B)L(S) . Remark 5.1 Note that there is no necessity to construct the considered decision trees since we can effectively simulate their work if, for each f ∈ B F , we have a decision tree, which solves the problem of diagnosis of the circuit S f relatively faults from G and whose depth is h G (S f ). Let B be a basis and G be a class of retaining faults for B. Denote by CG (B) the minimum nonnegative integer c such that the inequality h G (S) ≤ cL(S) holds for any iteration-free circuit S in the basis B F . If B F = ∅, then set CG (B) = 0. Let us estimate the value of CG (B) for the case B F = ∅. Theorem 5.2 Let B be a basis such that B F = ∅, and G be a class of retaining faults for B. Then the following statements hold: (a) CG (B) = HG (B). (b) If G is complete, then HG (B) = 2k(B) − 2. Proof (a) Let us show that CG (B) = HG (B). From Corollary 5.1 it follows that CG (B) ≤ HG (B). Consider a function f ∈ B F such that h G (S f ) = HG (B). It is clear that L(S f ) = 1. Therefore CG (B) ≥ HG (B). Thus, CG (B) = HG (B). (b) Let G be complete. Let us show that HG (B) = 2k(B) − 2. Consider an arbitrary function f ∈ B F and corresponding circuit S f . Let g ∈ G all (α 0f , α 1f ). We know values of g on tuples α 0f and α 1f . Thus, to recognize the function g it is sufficient to find the value of g on all tuples from {0, 1}k( f ) \ {α 0f , α 1f }. Therefore h G (S f ) ≤ 2k( f ) − 2. It k( f ) is clear that |G all (α 0f , α 1f )| = 22 −2 . Hence each decision tree solving the diagnosis k( f ) problem for the circuit S f relatively the faults from G must have at least 22 −2 terminal nodes. Therefore h G (S f ) ≥ 2k( f ) − 2 and, hence, h G (S f ) = 2k( f ) − 2. Thus, HG (B) = max{2k( f ) − 2 : f ∈ B F } = 2k(B) − 2.
5.3 Optimal Bases for Closed Classes In this section, for each closed class of Boolean functions, a basis is found, which is optimal from the point of view of complexity of diagnosis of formula-like circuits in this basis (during the procedure of diagnosis, each formula-like circuit is transformed into an iteration-free circuit). Let B be a basis and G be a class of retaining faults for B. We consider the following way for construction and diagnosis of circuits implementing functions from [B F ] ∪ BC . Let f ∈ BC . Then we can implement the function f by a circuit S in the basis BC , which has one gate and for which h G (S) = 0.
76
5 Diagnosis of Retaining Faults in Circuits
Let f ∈ [B F ]. It is clear that f can be implemented by formulas over the basis B F . Let ϕ be a formula over B F implementing the function f . Then we construct a circuit S in the basis B F , which corresponds to ϕ and, in particular, satisfies the following conditions: • The circuit S implements the function f . • L(S) = L(ϕ), where L(ϕ) is the number of functional symbols in the formula ϕ. • At most one edge leaves any gate of the circuit S. It is clear that S is a formula-like circuit. In addition to the normal operation mode of the circuit S, there exists the diagnostic mode in which the inputs of the circuit S having more than one leaving edge are “split” so that it become an iteration-free circuit S˜ (inputs of S˜ are labeled with pairwise different variables). The relations ˜ ≤ CG (B)L( S) ˜ = CG (B)L(ϕ) hold for the circuit S. ˜ h G ( S) Let U be a closed class of Boolean functions. We will say that the basis B correctly generates the closed class U if U = [B F ] ∪ BC . Denote by B(U ) the set of bases, which correctly generates the class U . Further we will show that B(U ) = ∅. Denote by G(B) the complete class of retaining faults for B and CG (U ) = min{CG(B) (B) : B ∈ B(U )} . A basis B will be called an optimal basis for U if B correctly generates the class U and CG(B) (B) = CG (U ). Theorem 5.3 Let U be a closed class of Boolean functions and B be a basis, which correctly generates the class U and for which k(B) = k(U ). Then B is an optimal basis for the class U and CG (U ) =
0, if k(U ) = 0 , 2k(U ) − 2, if k(U ) > 0 .
Proof Evidently, CG (U ) ≥ 0. Let k(U ) = 0 and B be a basis, which correctly generates the class U and for which k(B) = 0. Then B F = ∅ and CG(B) (B) = 0. Therefore CG (U ) = 0 and B is an optimal basis for the class U . Let now k(U ) > 0. Let B 0 be an optimal basis for the class U . Evidently, k(B 0 ) ≥ 0 k(U ). Therefore B F0 = ∅. Using Theorem 5.2, we obtain CG(B 0 ) (B 0 ) = 2k(B ) − 2 ≥ k(U ) 0 0 2 − 2. Since B is optimal for U , we have CG(B 0 ) (B ) = CG (U ). Thus, CG (U ) ≥ 2k(U ) − 2. Let B be a basis, which correctly generates the class U and for which k(B) = k(U ). Since k(U ) > 0, we have B F = ∅. Using Theorem 5.2, we obtain CG(B) (B) = 2k(U ) − 2. Therefore CG (U ) ≤ 2k(U ) − 2. Thus, CG (U ) = 2k(U ) − 2 and the basis B is an optimal basis for the class U . Further all closed classes of Boolean functions are enumerated. For each class U , the order k(U ) and a basis B, which correctly generates this class are cited. The order of the basis B is equal to the order of the class U . From Theorem 5.3 it follows that the basis B is an optimal basis for the considered class U , and
5.3 Optimal Bases for Closed Classes
CG (U ) =
77
0, if k(U ) = 0 , 2k(U ) − 2, if k(U ) > 0 .
Note that, for all classes with the exception of O9 , L 1 , F32 and F72 , the given bases coincide with bases, which are considered in Appendix A. 1. The class O1 consists of all functions equal to x and all functions obtained from them by renaming of variables without identification. For this class, k(O1 ) = 1, CG (O1 ) = 0 and {x} is an optimal basis. 2. The class O2 consists of all functions equal to 1. For this class, k(O2 ) = 0, CG (O2 ) = 0 and {1} is an optimal basis. 3. The class O3 consists of all functions equal to 0. For this class, k(O3 ) = 0, CG (O3 ) = 0 and {0} is an optimal basis. 4. The class O4 consists of all functions equal to x or ¬x and all functions obtained from them by renaming of variables without identification. For this class, k(O4 ) = 1, CG (O4 ) = 0 and {¬x} is an optimal basis. 5. The class O5 consists of all functions equal to 1 or x and all functions obtained from them by renaming of variables without identification. For this class, k(O5 ) = 1, CG (O5 ) = 0 and {x, 1} is an optimal basis (note that O5 = O1 ∪ {1}). 6. The class O6 consists of all functions equal to 0 or x and all functions obtained from them by renaming of variables without identification. For this class, k(O6 ) = 1, CG (O6 ) = 0 and {x, 0} is an optimal basis (note that O6 = O1 ∪ {0}). 7. The class O7 consists of all functions equal to 0 or 1. For this class, k(O7 ) = 0, CG (O7 ) = 0 and {0, 1} is an optimal basis. 8. The class O8 consists of all functions equal to 0, 1 or x and all functions obtained from them by renaming of variables without identification. For this class, k(O8 ) = 1, CG (O8 ) = 0 and {x, 0, 1} is an optimal basis (note that O8 = O1 ∪ {0, 1}). 9. The class O9 consists of all functions equal to 0, 1, x or ¬x and all functions obtained from them by renaming of variables without identification. For this class, k(O9 ) = 1, CG (O9 ) = 0 and {¬x, 0, 1} is an optimal basis (note that O9 = O4 ∪ {0, 1}). 10. The class S1 consists of all disjunctions. For this class, k(S1 ) = 2, CG (S1 ) = 2 and {x ∨ y} is an optimal basis. 11. The class S3 consists of all disjunctions and all functions equal to 1. For this class, k(S3 ) = 2, CG (S3 ) = 2 and {x ∨ y, 1} is an optimal basis (note that S3 = S1 ∪ {1}). 12. The class S5 consists of all disjunctions and all functions equal to 0. For this class, k(S5 ) = 2, CG (S5 ) = 2 and {x ∨ y, 0} is an optimal basis (note that S5 = S1 ∪ {0}). 13. The class S6 consists of all disjunctions and all functions equal to 0 or 1. For this class, k(S6 ) = 2, CG (S6 ) = 2 and {x ∨ y, 0, 1} is an optimal basis (note that S6 = S1 ∪ {0, 1}). 14. The class P1 consists of all conjunctions. For this class, k(P1 ) = 2, CG (P1 ) = 2 and {x ∧ y} is an optimal basis.
78
5 Diagnosis of Retaining Faults in Circuits
15. The class P3 consists of all conjunctions and all functions equal to 0. For this class, k(P3 ) = 2, CG (P3 ) = 2 and {x ∧ y, 0} is an optimal basis (note that P3 = P1 ∪ {0}). 16. The class P5 consists of all conjunctions and all functions equal to 1. For this class, k(P5 ) = 2, CG (P5 ) = 2 and {x ∧ y, 1} is an optimal basis (note that P5 = P1 ∪ {1}). 17. The class P6 consists of all conjunctions and all functions equal to 0 or 1. For this class, k(P6 ) = 2, CG (P6 ) = 2 and {x ∧ y, 0, 1} is an optimal basis (note that P6 = P1 ∪ {0, 1}). 18. The class L 1 consists of all linear functions. For this class, k(L 1 ) = 2, CG (L 1 ) = 2 and {x + y(mod 2), x + y + 1(mod 2)} is an optimal basis (we know that [{x + y(mod 2), 1}] = L 1 —see Appendix A; therefore [{x + y(mod 2), x + y + 1(mod 2)}] = L 1 ). 19. The class L 2 consists of all linear α-functions and β-functions. For this class, k(L 2 ) = 2, CG (L 2 ) = 2 and {x + y + 1(mod 2)} is an optimal basis. 20. The class L 3 consists of all linear α-functions and γ -functions. For this class, k(L 3 ) = 2, CG (L 3 ) = 2 and {x + y(mod 2)} is an optimal basis. 21. The class L 4 consists of all linear α-functions. For this class, k(L 4 ) = 3, CG (L 4 ) = 6 and {x + y + z(mod 2)} is an optimal basis. 22. The class L 5 consists of all linear self-dual functions. For this class, k(L 5 ) = 3, CG (L 5 ) = 6 and {x + y + z + 1(mod 2)} is an optimal basis. 23. The class D2 consists of all self-dual monotone functions. For this class, k(D2 ) = 3, CG (D2 ) = 6 and {(x ∧ y) ∨ (x ∧ z) ∨ (y ∧ z)} is an optimal basis. 24. The class D1 consists of all self-dual α-functions. For this class, k(D1 ) = 3, CG (D1 ) = 6 and {(x ∧ y) ∨ (x ∧ ¬z) ∨ (y ∧ ¬z)} is an optimal basis. 25. The class D3 consists of all self-dual functions. For this class, k(D3 ) = 3, CG (D3 ) = 6 and {(x ∧ ¬y) ∨ (x ∧ ¬z) ∨ (¬y ∧ ¬z)} is an optimal basis. 26. The class A1 consists of all monotone functions. For this class, k(A1 ) = 2, CG (A1 ) = 2 and {x ∧ y, x ∨ y, 0, 1} is an optimal basis (note that A1 = A4 ∪ {0, 1}). 27. The class A2 consists of all monotone α-functions and β-functions. For this class, k(A2 ) = 2, CG (A2 ) = 2 and {x ∧ y, x ∨ y, 1} is an optimal basis (note that A2 = A4 ∪ {1}). 28. The class A3 consists of all monotone α-functions and γ -functions. For this class k(A3 ) = 2, CG (A3 ) = 2 and {x ∧ y, x ∨ y, 0} is an optimal basis (note that A3 = A4 ∪ {0}). 29. The class A4 consists of all monotone α-functions. For this class, k(A4 ) = 2, CG (A4 ) = 2 and {x ∧ y, x ∨ y} is an optimal basis. 30. The class C1 consists of all Boolean functions. For this class, k(C1 ) = 2, CG (C1 ) = 2 and {¬x ∨ ¬y} is an optimal basis. 31. The class C2 consists of all α-functions and β-functions. For this class, k(C2 ) = 2, CG (C2 ) = 2 and {x ∨ y, x + y + 1(mod 2)} is an optimal basis. 32. The class C3 consists of all α-functions and γ -functions. For this class, k(C3 ) = 2, CG (C3 ) = 2 and {x ∧ y, x + y(mod 2)} is an optimal basis.
5.3 Optimal Bases for Closed Classes
79
33. The class C4 consists of all α-functions. For this class, k(C4 ) = 3, CG (C4 ) = 6 and {x ∨ y, x ∧ (y + z + 1(mod 2))} is an optimal basis. μ 34. The class F1 (μ = 2, 3, . . .) consists of all α-functions satisfying the condiμ μ μ tion a . For this class, k(F1 ) = μ + 1, CG (F1 ) = 2μ+1 − 2 and {x ∨ (y ∧ ∗ ¬z), h μ } is an optimal basis. μ 35. The class F2 (μ = 2, 3, . . .) consists of all monotone α-functions satisfying the μ μ condition a μ . For this class, k(F2 ) = μ + 1, CG (F2 ) = 2μ+1 − 2, {x ∨ (y ∧ ∗ ∗ z), h 2 } is an optimal basis if μ = 2 and {h μ } is an optimal basis if μ ≥ 3. μ 36. The class F3 (μ = 2, 3, . . .) consists of all monotone functions satisfying the μ μ condition a μ . For this class, k(F3 ) = μ + 1, CG (F3 ) = 2μ+1 − 2, {x ∨ (y ∧ z), h ∗2 , 1} is an optimal basis if μ = 2 and {h ∗μ , 1} is an optimal basis if μ ≥ 3 μ μ (note that F3 = F2 ∪ {1}). μ 37. The class F4 (μ = 2, 3, . . .) consists of all functions satisfying the condition μ μ a μ . For this class, k(F4 ) = μ + 1, CG (F4 ) = 2μ+1 − 2 and {x ∨ ¬y, h ∗μ } is an optimal basis. 38. The class F5μ (μ = 2, 3, . . .) consists of all α-functions satisfying the condiμ μ tion Aμ . For this class, k(F5 ) = μ + 1, CG (F5 ) = 2μ+1 − 2 and {x ∧ (y ∨ ¬z), h μ } is an optimal basis. 39. The class F6μ (μ = 2, 3, . . .) consists of all monotone α-functions satisfying the μ μ condition Aμ . For this class, k(F6 ) = μ + 1, CG (F6 ) = 2μ+1 − 2, {x ∧ (y ∨ z), h 2 } is an optimal basis if μ = 2 and {h μ } is an optimal basis if μ ≥ 3. μ 40. The class F7 consists of all monotone functions satisfying the condition Aμ . μ μ For this class, k(F7 ) = μ + 1, CG (F7 ) = 2μ+1 − 2, {x ∧ (y ∨ z), h 2 , 0} is an μ optimal basis if μ = 2 and {h μ , 0} is an optimal basis if μ ≥ 3 (note that F7 = μ F6 ∪ {0}). μ 41. The class F8 (μ = 2, 3, . . .) consists of all functions satisfying the condition μ μ Aμ . For this class, k(F8 ) = μ + 1, CG (F8 ) = 2μ+1 − 2 and {x ∧ ¬y, h μ } is an optimal basis. 42. The class F1∞ consists of all α-functions satisfying the condition a ∞ . For this class, k(F1∞ ) = 3, CG (F1∞ ) = 6 and {x ∨ (y ∧ ¬z)} is an optimal basis. 43. The class F2∞ consists of all monotone α-functions satisfying the condition a ∞ . For this class, k(F2∞ ) = 3, CG (F2∞ ) = 6 and {x ∨ (y ∧ z)} is an optimal basis. 44. The class F3∞ consists of all monotone functions satisfying the condition a ∞ . For this class, k(F3∞ ) = 3, CG (F3∞ ) = 6 and {1, x ∨ (y ∧ z)} is an optimal basis (note that F3∞ = F2∞ ∪ {1}). 45. The class F4∞ consists of all functions satisfying the condition a ∞ . For this class, k(F4∞ ) = 2, CG (F4∞ ) = 2 and {x ∨ ¬y} is an optimal basis. 46. The class F5∞ consists of all α-functions satisfying the condition A∞ . For this class, k(F5∞ ) = 3, CG (F5∞ ) = 6 and {x ∧ (y ∨ ¬z)} is an optimal basis. 47. The class F6∞ consists of all monotone α-functions satisfying the condition A∞ . For this class, k(F6∞ ) = 3, CG (F6∞ ) = 6 and {x ∧ (y ∨ z)} is an optimal basis.
80
5 Diagnosis of Retaining Faults in Circuits
48. The class F7∞ consists of all monotone functions satisfying the condition A∞ . For this class, k(F7∞ ) = 3, CG (F7∞ ) = 6 and {0, x ∧ (y ∨ z)} is an optimal basis (note that F7∞ = F6∞ ∪ {0}). 49. The class F8∞ consists of all functions satisfying the condition A∞ . For this class, k(F8∞ ) = 2, CG (F8∞ ) = 2 and {x ∧ ¬y} is an optimal basis. From the obtained results the next statement follows. Theorem 5.4 Let U be a closed class of Boolean functions. Then CG (U ) =
0, if k(U ) = 0 , 2k(U ) − 2, if k(U ) > 0 .
5.4 Shannon Functions of Two Types In this section, we study relationships between two types of Shannon functions. A function of the first type characterizes the complexity of diagnosis of formulalike circuits implementing Boolean functions from a closed class. A function of the second type characterizes the complexity of formulas implementing Boolean functions from a closed class. The obtained results allow us to transfer some known bounds for Shannon functions of the second type [4] to the case of Shannon functions of the first type. Let B be a basis, B F = ∅ and G be a class of retaining faults for B. Let f ∈ B F and S f be the one-gate circuit implementing the function f . The number h G (S f ) is called the weight of the function (functional symbol) f . Let ϕ be a formula over B F . We denote by L G (ϕ) the sum of weights of all functional symbols in ϕ. Let S be a circuit in the basis B F . We denote by L G (S) the sum of weights of all gates in S (the weight of a gate is equal to the weight of function, which this gate implements). Note that if S is a formula-like circuit obtained from a formula ϕ in the way described at the beginning of the previous section, then L G (S) = L G (ϕ). For any formula-like circuit S in the basis B F , we denote by S˜ an iteration-free circuit obtained from S in the following way: we “split” the inputs of S, which have ˜ more than one leaving edge. Instead of the circuit S, we will diagnose the circuit S. ˜ Let f ∈ [B F ]. Denote H B,G ( f ) = min{h G ( S) : S ∈ S (B, f )}, where S (B, f ) is the set of formula-like circuits in the basis B F implementing f . Denote L B,G ( f ) = min{L G (ϕ) : ϕ ∈ (B, f )}, where (B, f ) is the set of formulas over B F implementing f . Lemma 5.1 Let B be a basis, B F = ∅, G be a class of retaining faults for B, and f ∈ [B F ]. Then H B,G ( f ) ≤ L B,G ( f ) .
5.4 Shannon Functions of Two Types
81
Proof Consider a formula ϕ over B F , which implements the function f and for which L G (ϕ) = L B,G ( f ). Using ϕ it is not difficult to construct a formula-like circuit S such that S implements f and L G (S) = L G (ϕ). From Theorem 5.1 it follows that ˜ ≤ L G (S) = L B,G ( f ). Thus, H B,G ( f ) ≤ L B,G ( f ). h G ( S) Let U be a closed class of Boolean functions such that U ⊆ [B F ] ∪ BC . For any natural n, denote U (n) the set of functions from U with n variables. Note that U (n) is a nonempty set. Define two Shannon functions: U (n) = max{H B,G ( f ) : f ∈ U (n)}, H B,G
L UB,G (n) = max{L B,G ( f ) : f ∈ U (n)} .
U The function H B,G (n) characterizes the complexity of diagnosis of formula-like circuits implementing functions from U , and the function L UB,G (n) characterizes the complexity of implementation of functions from U by formulas. The second function for various classes U , bases B and weights of functions (which were not related to the diagnosis problem and were chosen usually in an arbitrary way) was studied by many authors – see survey of Ugol’nikov [4]. We now consider relationships between U (n) and L UB,G (n). H B,G
Theorem 5.5 Let B be a basis, G be a class of retaining faults for B, U be a closed class of Boolean functions such that U ⊆ [B F ] ∪ BC , and n be a natural number. Then U (n) ≤ L UB,G (n) . H B,G U Proof Consider a function f ∈ U (n) such that H B,G (n) = H B,G ( f ). Then using U (n) ≤ Lemma 5.1, we obtain H B,G ( f ) ≤ L B,G ( f ) ≤ L UB,G (n). Thus, H B,G U L B,G (n). U Further we consider some cases, where H B,G (n) = L UB,G (n). Denote by FG (S) the set of functions, which can be implemented by a circuit S with faults from the class G.
Lemma 5.2 Let B be a basis and G be an essential class of retaining faults for B. Then, for any iteration-free circuit S in the basis B F , the following equality holds: |FG (S)| = |G( f 1 )| · . . . · |G( f L(S) )| , where f 1 , . . . , f L(S) are functions, which are implemented by the circuit S gates. Proof We prove the statement of the lemma by induction on L(S). Let L(S) = 1 and the unique gate of S implement a function f . Evidently, |FG (S)| = |G( f )|. Thus, the considered statement holds if L(S) = 1. Assume that this statement holds if L(S) ≤ k for some k ≥ 1. Let us prove that the statement holds if L(S) = k + 1. Consider the gate w, which is the output of the circuit S. Let w have m inputs. Denote by S j (1 ≤ j ≤ m) the subcircuit of the circuit S such that the output of S j is the node (gate or input), which is connected
82
5 Diagnosis of Retaining Faults in Circuits
with the jth input of the gate w by an edge. The subcircuit S j can contain either no gates (i.e., contains one input of the circuit S) or at least one gate. In the former case, evidently, |FG (S j )| = 1. In the latter case, S j is an iteration-free circuit in the basis B F and L(Si ) ≤ k. Using the inductive hypothesis, we conclude that the equal )| holds, where f 1 , . . . , f L(S are functions, ity |FG (S j )| = |G( f 1 )| · . . . · |G( f L(S j) j) which are implemented by the circuit S j gates. Let the gate w implement the function f in the normal state. Then the gate w can implement one of |G( f )| functions in the case of faults. We now show that |FG (S)| = |G( f )| · |FG (S1 )| · . . . · |FG (Sm )|. Let g ∈ G( f ) and g1 ∈ FG (S1 ), . . . , gm ∈ FG (Sm ). One can show that there exist faults from the class G such that the circuit S with these faults implements the function g(g1 , . . . , gm ). Let g , g ∈ G( f ), g1 , g1 ∈ FG (S1 ), . . . , gm , gm ∈ FG (Sm ), and (g , g1 , . . . , gm ) = (g , g1 , . . . , gm ). Let us show that g (g1 , . . . , gm ) = g (g1 , . . . , gm ). ˜ = g (α). ˜ Taking Let g = g . Then there exists a tuple α˜ ∈ {0, 1}m such that g (α) into account the nature of retaining faults, we conclude that we can obtain the tuple α˜ at inputs of the gate w if we choose an appropriate tuple of values at the inputs of the circuit S. Therefore g (g1 , . . . , gm ) = g (g1 , . . . , gm ). Let g = g and gi = gi for some i ∈ {1, . . . , m}. Then there exists a tuple β˜ ˜ = gi (β). ˜ Since G is an of values at inputs of the subcircuit Si such that gi (β) essential class of retaining faults, all m variables of the function g are essential. Therefore there exist numbers α1 , . . . , αi−1 , αi+1 , . . . , αm ∈ {0, 1} such that g (α1 , . . . , αi−1 , 0, αi+1 , . . . , αm ) = g (α1 , . . . , αi−1 , 1, αi+1 , . . . , αm ). For each j ∈ {1, . . . , i − 1, i + 1, . . . , m}, we give to the inputs of the subcircuit S j such values that the output of S j will be equal to α j . To the inputs of the subcircuit Si , ˜ It is clear that at the output of S we will have different valwe give the tuple β. ues in the case, when Si implements gi , and in the case, when Si implements gi . Therefore g (g1 , . . . , gm ) = g (g1 , . . . , gm ). Thus, |FG (S)| = |G( f )| · |FG (S1 )| · . . . · |FG (Sm )|. Taking into account that |FG (S j )| = 1 if L(S j ) = 0 and |FG (S j )| = |G( f 1 )| · )|, where f 1 , . . . , f L(S are functions, which are implemented by the . . . · |G( f L(S j) j) circuit S j gates, if L(S j ) > 1, we conclude that |FG (S)| = |G( f 1 )| · . . . · |G( f L(S) )|, where f 1 , . . . , f L(S) are functions, which are implemented by the circuit S gates. Let B be a basis. An essential class of retaining faults G for B will be called proper if, for any function f ∈ B F , the equality |G( f )| = 2h G (S f ) holds. Theorem 5.6 Let B be a basis, G be a proper class of retaining faults for B, U be a closed class of Boolean functions such that U ⊆ [B F ] ∪ BC , and n be a natural number. Then U (n) = L UB,G (n) . H B,G U (n) ≤ L UB,G (n). We now show that Proof From Theorem 5.5 it follows that H B,G U (n) ≥ L UB,G (n). H B,G
5.4 Shannon Functions of Two Types
83
Let g be a function from U (n) such that L UB,G (n) = L B,G (g). Let S be a formulalike circuit in the basis B F , which implements the function g and for which ˜ Denote by f 1 , . . . , f L(S) functions implemented by the gates of H B,G (g) = h G ( S). ˜ We know that, for j = 1, . . . , L(S), the equality |G( f j )| = 2h G (S f j ) holds. From S. Lemma 5.2 it follows that ˜ = |G( f 1 )| · . . . · |G( f L(S) )| = 2h G (S f1 )+...+h G (S f L(S) ) . |FG ( S)| ˜ ≥ h G (S f1 ) + . . . + h G (S f L(S) ) Using this equality, it is not difficult to show that h G ( S) ˜ ≥ L G (S). It is clear that L G (S) ≥ L B,G (g). Hence H B,G (g) = L G (S). Thus, h G ( S) U (n) ≥ L UB,G (n). ≥ L UB,G (n). Therefore H B,G We now show that proper classes of retaining faults exist. Theorem 5.7 Let B be a basis with B F = ∅. Then we can construct a proper class of retaining faults G for B such that, for any function f (x1 , . . . , xn ) from B F , the weight h G (S f ) is equal to 0 if n = 1, is equal to 1 if n = 2, and is equal to an arbitrary number from the set {1, . . . , 2n − n − 2} if n ≥ 3. Proof Consider an arbitrary function f (x1 , . . . , xn ) ∈ B F and construct a set G( f ) satisfying the conditions of the theorem. Let n = 1. Then f ∈ {x1 , ¬x1 }. Denote G( f ) = { f }. It is easy to check that the set G( f ) satisfies the conditions of the theorem. Let n = 2. Consider two cases. Let the tuples α 0f and α 1f be different only in one digit. Let, for the definiteness, α 0f = (0, 0) and α 1f = (0, 1). Denote by D the set of Boolean functions g(x1 , x2 ) such that g(0, 0) = 0 and g(0, 1) = g(1, 0) = 1. It is clear that D ⊆ G all (α 0f , α 1f ), D contains two functions and, for each function from D, the variables x1 and x2 are essential. Denote G( f ) = { f, g}, where g is a function from D, which is not equal to f . It is clear that G( f ) ⊆ G all (α 0f , α 1f ), |G( f )| = 2, each variable in each function from G( f ) is essential, and h G (S f ) = 1. Let now the tuples α 0f and α 1f be different in two digits. Let, for the definiteness, α 0f = (0, 0) and α 1f = (1, 1). Denote by D the set of Boolean functions g(x1 , x2 ) such that g(0, 0) = 0, g(1, 1) = 1 and g(0, 1) = g(1, 0). It is clear that D ⊆ G all (α 0f , α 1f ), D contains two functions and, for each function from D, the variables x1 and x2 are essential. Denote G( f ) = { f, g}, where g is a function from D, which is not equal to f . It is clear that G( f ) ⊆ G all (α 0f , α 1f ), |G( f )| = 2, each variable in each function from G( f ) is essential, and h G (S f ) = 1. Let n ≥ 3 and m ∈ {1, . . . , 2n − n − 2}. Denote by Q the set of all tuples from {0, 1}n , which are different from the tuple α 0f in exactly one digit. Choose a subset B of the set {0, 1}n \ (Q ∪ {α 0f , α 1f }) such that |B| = m. Denote by D the set of ˜ = 1 for each Boolean functions g(x1 , . . . , xn ) such that g(α 0f ) = 0, g(α 1f ) = 1, g(β) 0 1 n ˜ β ∈ {0, 1} \ (B ∪ {α f , α f }), and there exists γ˜ ∈ B for which g(γ˜ ) = f (γ˜ ). It is clear that D ⊆ G all (α 0f , α 1f ), |D| = 2m − 1 and, for each function from D, variables x1 , . . . , xn are essential. Denote G( f ) = D ∪ { f }.
84
5 Diagnosis of Retaining Faults in Circuits
It is clear that G( f ) ⊆ G all (α 0f , α 1f ), |G( f )| = 2m , and each variable in each function from G( f ) is essential. Let us show that h G (S f ) = m. It is clear that if we will find the values of a function from G( f ) on all tuples from B, we will recognize the considered function. Therefore h G (S f ) ≤ m. Let Γ be an arbitrary decision tree, which solves the problem of diagnosis of the circuit S f relative to faults from G( f ). It is clear that Γ must have at least 2m terminal nodes. Using this fact, it is not difficult to show that the depth of Γ is at least m. Therefore h G (S f ) ≥ m. We now give examples of the use of results known for the function L UB,G (n) for U (n). We consider only cases, when U ⊆ [B F ] ∪ BC , the study of the function H B,G B F = ∅, and B F does not contain functions x and ¬x. For each basis B, we consider for simplicity a proper class of retaining faults G such that h G (S f ) = 1 for any f ∈ B F . The existence of such class follows from Theorem 5.7. From Theorem 5.6 U (n) = L UB,G (n). it follows that H B,G First, we consider some cases for which [B] coincides with the set of all Boolean functions and U ⊂ [B]. Let us consider the basis B = {¬x ∨ ¬y}. The next four asymptotic formulas are obtained based on results of Andreev mentioned in [4]. 1. Let U = F1∞ , where F1∞ is the closed class, which consists of all α-functions 2n−1 U satisfying the condition a ∞ . Then H B,G (n) ∼ log . 2n the closed class, which consists of all monotone func2. Let U = A1 , where A1 is 2 √ 2n U tions. Then H B,G (n) ∼ π n log n . 2
3. Let U = F52 , where F52 is the closed class, which consists of all α-functions 2n−1 U (n) ∼ log . satisfying the condition A2 . Then H B,G 2n 4. Let U = F7∞ , where F7∞ is the closed class, which consists of all monotone n U (n) ∼ √12π √n 2log n . functions satisfying the condition A∞ . Then H B,G 2
We now consider some cases for which U = [B]. The next two asymptotic formulas are obtained based on results of Ugol’nikov mentioned in [4]. 1. Let U = F1∞ , where F1∞ is the closed class, which consists of all α-functions 2n−2 U satisfying the condition a ∞ , and B = {x ∨ (y ∧ ¬z)}. Then H B,G (n) ∼ log . 2n 2. Let U = C2 , where C2 is the closed class, which consists of all α-functions and n U (n) ∼ log2 n . β-functions, and B = {x ∨ y, x + y + 1(mod 2)}. Then H B,G 2
Note that the bounds mentioned here are considerably less than the trivial upper bound, which is equal to 2n .
References 1. Moshkova, A.: On diagnosis of retaining faults in circuits. In: Polkowski, L., Skowron, A. (eds.) Rough Sets and Current Trends in Computing, First International Conference, RSCTC’98, Warsaw, Poland, June 22-26, 1998. Lecture Notes in Computer Science, vol. 1424, pp. 513–516. Springer (1998)
References
85
2. Moshkova, A.: On time complexity of retaining fault diagnosis in circuits. In: Eighth International Conference on Information Processing and Management of Uncertainty in Knowledge-Based Systems, vol. 1, pp. 372–375. Madrid, Spain (2000) 3. Moshkova, A.: On effective methods for diagnosis of retaining faults in circuits. Fund. Inf. 66(3), 299–313 (2005) 4. Ugol’nikov, A.B.: Complexity of functions from closed classes. In: Seminar on Discrete Mathematics and Its Applications, Moscow State University, Moscow, Russia, February 2–4, 1993, pp. 49–56 (1998). (in Russian)
Chapter 6
Diagnosis of Constant Faults in Switching Networks
In this chapter, we study decision trees for diagnosis of constant faults in switching networks. A switching network is an undirected graph with two poles in which literals (variables or negations of variables) are assigned to edges. For a given tuple of variable values, the value of the function implemented by the network is equal to 1 if and only if there exists a path between poles such that the value of each literal assigned to the edges in this path is equal to 1. We consider faults each of which consists in assigning Boolean constants to some edges of the network instead of literals. The problem of diagnosis is to recognize the function implemented by the switching network with a constant fault from a given set of faults. For this problem solving, we use decision trees. Each query (attribute) of a decision tree consists of observing the value of function implemented by the faulty switching network on a given tuple of variable values. Let P be a switching network. We denote by L(P) the number of edges in P. We consider three types of constant faults: {0, 1}-faults, {0}-faults, and {1}-faults of P. Let C ∈ {{0, 1}, {0}, {1}}. A C-fault of P consists in assigning of constants from C to some edges of P instead of literals. Let R be a set of C-faults of P. The problem of diagnosis of C-faults for P and R: for the switching network P with a C-fault ρ from R, we should find a C-fault δ of P such that the network P with the fault δ implements the same function as the network P with the fault ρ. We denote by h C (P) the minimum depth of a decision tree, which solves the problem of diagnosis of C-faults for P and the set of all possible C-faults of P. This chapter consists of two sections. In the first section, we consider a number of negative results related to the depth of decision trees for diagnosis of arbitrary switching networks. This section is based on the paper [11]. First, we show that there are simple switching networks, for which the depth of decision trees for diagnosis of constant faults is high. We prove that, for any C ∈ {{0, 1}, {0}, {1}} and any natural n, there exists a switching network P such that L(P) = 2n and h C (P) ≥ 2n . © The Author(s), under exclusive license to Springer Nature Switzerland AG 2023 M. Busbait et al., Decision Trees for Fault Diagnosis in Circuits and Switching Networks, Studies in Systems, Decision and Control 493, https://doi.org/10.1007/978-3-031-39031-9_6
87
88
6 Diagnosis of Constant Faults in Switching Networks
Then we show that there are simple switching networks such that, for all switching networks implementing the same functions, the depth of decision trees for diagnosis of constant faults is high. We prove that, for any C ∈ {{0, 1}, {0}, {1}} and any natural n, there exists a switching network P such that L(P) = n 2 + n and h C (Q) ≥ nn 2 for any switching network Q implementing the same function as P. For any C ∈ {{0, 1}, {0}, {1}}, we define the algorithmic problem Con(C): for a given switching network P with L(P) ≥ 1 and a set R of C-faults of P, it is required to construct a decision tree Γ , which solves the problem of diagnosis of C-faults for P and R. One can show that there exists a decision tree, which solves this problem and has at most 2 |R| − 1 nodes. We prove that, for any C ∈ {{0, 1}, {0}, {1}}, the problem Con(C) is NP-hard. The second section is devoted to the study of iteration-free switching networks in which edges are labeled with pairwise different variables. This section is based on papers [4, 5]. It is convenient for us to consider iteration-free switching networks without variables assigned to edges. We call them networks. If we attach to edges of a network pairwise different variables, we obtain an iteration-free switching network for which we will use the same notation. It will allow us to say about faults of the network, decision trees for its diagnosis, etc. We consider networks over a finite set B of networks, which is called basis. The considered networks can be obtained by replacing some edges in a network from B with recursively constructed networks (including networks from B). We assume that all networks from B are indecomposable nontrivial networks, i.e., cannot be obtained from two nontrivial (containing more than one edge) networks by replacing an edge in the first network with the second one. For any C ∈ {{0, 1}, {0}, {1}}, we prove that h C (S) ≤ tC (B)(L(S) − 1) for any h C (Q) network S over basis B, where tC (B) = max{tC (Q) : Q ∈ B} and tC (Q) = L(Q)−1 for any network Q from the set B. These results can be used to diagnose switching networks implementing arbitrary Boolean functions—see Remark 6.4. We denote by S12 a network with two poles and two parallel edges connecting the poles and by S22 we denote a network consisting of simple path of length two connecting two poles (see Table 6.2). We consider the function H BC (n), which characterizes the dependence in the worst case of the minimum depth of a decision tree for diagnosis of C-faults for a network over B on the number n of edges in the network. We prove that {0,1}
• H B (n) = Θ(n) for any basis B. {0} {0} • H B (n) = 1 for n ≥ 2 if B = {S22 }, and H B (n) = Θ(n) if B = {S22 }. {1} {1} • H B (n) = 1 for n ≥ 2 if B = {S12 }, and H B (n) = Θ(n) if B = {S12 }. Kuznetsov in [8] published the list of all nontrivial indecomposable networks with at most 10 edges. The value h {0,1} (Q) was studied by Goduhina [7] for each nontrivial indecomposable network Q containing at most 8 edges. In this chapter, we find value of h C (Q) for each C ∈ {{0, 1}, {0}, {1}} and for each nontrivial indecomposable network Q with at most 10 edges. The obtained results allow us to find the value
6.1 Arbitrary Switching Networks
89
tC (B) for an arbitrary basis B containing only nontrivial indecomposable networks with at most 10 edges. Let us consider the basis B(2) = {S12 , S22 }. We prove that t{0,1} (B(2)) = 3. Therefore h {0,1} (S) ≤ 3(L(S) − 1) for any iteration-free network S over basis B(2). We should mention here some results of Madatyan [9] related to the study of diagnostic tests for {0, 1}-faults in iteration-free networks. A diagnostic test is a set of queries, which allows us to solve the considered problem of diagnosis. Madatyan proved that, for each iteration-free network S over the basis B(2), the minimum cardinality of a diagnostic test is at most 23 L(S). It is easy to see that the minimum depth of a decision tree solving the problem of diagnosis is at most the minimum cardinality of a diagnostic test. From here it follows that the upper bound h {0,1} (S) ≤ 3 L(S) is true for any iteration-free network S over the basis B(2). It improves our 2 bound for the basis B(2). Madatyan also showed that, for k = 1, 2, . . ., there exists an iteration-free network over the basis {S15 } (see Table 6.2) with 4k + 1 edges for which the minimum cardinality of a diagnostic test is equal to 3 · 2k+1 − 4. Note that from the results obtained in this chapter it follows that the minimum depth of a decision tree for diagnosis of the considered network is at most 7k. We see here huge adaptivity gap between complexity of diagnostic decision trees, which can be interpreted as adaptive algorithms (the choice of the next query depends on the results of the previous queries) and diagnostic tests, which can be interpreted as non-adaptive algorithms (the sequence of queries is fixed). The remainder of this chapter is organized as follows. In Sect. 6.1, we consider arbitrary switching networks, and in Sect. 6.2—iteration-free switching networks.
6.1 Arbitrary Switching Networks In this section, we study arbitrary switching networks in which edges can be labeled with arbitrary variables or their negations.
6.1.1 Main Notions In this section, we consider main notions related to switching networks, constant faults, and decision trees for fault diagnosis. We also prove a simple lower bound on the depth of decision trees for fault diagnosis. A switching network is an undirected connected graph P with multiple edges and without loops in which two different nodes called poles are fixed. Each edge of P is labeled with a literal from the set {xi , x¯i : i ∈ {0, 1, 2, . . .}}, where xi is a variable, and x¯i is its negation. We denote by L(P) the number of edges in the switching network P. Note that, in the graphical representations of networks, empty circles are the poles and the filled circles are usual nodes of the network.
90
6 Diagnosis of Constant Faults in Switching Networks
We consider three types of constant faults: {0, 1}-faults, {0}-faults, and {1}-faults of P. Let C ∈ {{0, 1}, {0}, {1}}. A C-fault of P consists in assigning of constants from C to some edges of P instead of literals. Let {xi1 , . . . , xim } be the set of all variables from literals attached to edges of P. We will say that xi1 , . . . , xim are input variables of P. We correspond to the switching network P and its C-fault ρ a Boolean function f P,ρ (xi1 , . . . , xim ) that is implemented by the switching network P with the fault ρ. Let ξ be a simple path (without repeating nodes) between poles of P. We denote by cρ (ξ ) the conjunction of all Boolean functions (literals or constants) attached to edges of the path ξ in the switching network P with the fault ρ. Then f P,ρ (xi1 , . . . , xim ) is the disjunction of all conjunctions cρ (ξ ) corresponding to simple paths ξ between poles of P. We denote f P = f P,λ , where λ is the empty fault (no constants are assigned to edges of P), and will say that the network P implements the function fP. Let R be a set of C-faults of P. The problem of diagnosis of C-faults for P and R: for the switching network P with a C-fault ρ from R, we should find a C-fault δ of P such that f P,ρ = f P,δ . To resolve this problem, we can ask about values of the function f P,ρ on arbitrary tuples from {0, 1}m . As algorithms for solving the problem of diagnosis of C-faults, we will consider decision trees each of which is a directed tree with root. Terminal nodes of the tree are labeled with C-faults of P. Each nonterminal node is labeled with an m-tuple from {0, 1}m . Two edges start in this node that are labeled with 0 and 1, respectively. The depth h(Γ ) of a decision tree Γ is the maximum length of a path from the root to a terminal node. Let Γ be a decision tree. For the switching network P with a C-fault ρ, this tree works in the following way. If the root of Γ is a terminal node, then the output of Γ is the fault attached to the root. Otherwise, we find the value of the function f P,ρ on the m-tuple attached to the root and pass along the edge, which starts in the root and is labeled with this value, etc., until we reach a terminal node. The fault attached to this node is the output of Γ . We will say that Γ solves the problem of diagnosis of C-faults for P and R if, for any C-fault ρ from R, the output of Γ is a C-fault δ of P such that f P,ρ = f P,δ . We denote by h C (P) the minimum depth of a decision tree, which solves the problem of diagnosis of C-faults for P and the set of all C-faults of P including the empty fault λ, i.e., the problem of diagnosis of arbitrary C-faults of P. We consider now a lower bound on h C (P). Lemma 6.1 Let C ∈ {{0, 1}, {0}, {1}}, P be a switching network with m input variables, ρ0 , ρ1 , . . . , ρr be C-faults of P such that f P,ρ0 = f P,ρi for i = 1, . . . , r , and t be the minimum cardinality of a set of tuples from {0, 1}m on which the function f P,ρ0 is different from the functions f P,ρ1 , . . . , f P,ρr . Then h C (P) ≥ t .
6.1 Arbitrary Switching Networks
91
Proof Let Γ be a decision tree, which solves the problem of diagnosis of arbitrary C-faults for P and for which h(Γ ) = h C (P). Let the work of Γ on the network P with the fault ρ0 finish in the terminal node v of Γ . We denote by ξ the path from the root of Γ to the terminal node v. It is clear that, on the set of m-tuples attached to nonterminal nodes of ξ , the function f P,ρ0 is different from the functions f P,ρ1 , . . . , f P,ρr . Therefore the length of ξ is at least t. Thus, h(Γ ) ≥ t and h C (P) ≥ t.
6.1.2 Switching Networks for Symmetric Boolean Functions A Boolean function f (x1 , . . . , xn ) is called symmetric if its value depends only on the number of ones in the input. This function can be represented by the tuple t˜ = (t0 , t1 , . . . , tn ) ∈ {0, 1}n+1 , where, for i = 0, 1, . . . , n, ti is the value of the function f on each tuple with exactly i ones. Shannon in [14] proposed simple switching network Pt˜ with L(Pt˜) = n 2 + n implementing the symmetric function f that does not equal to 0 identically. The network Q depicted in Fig. 6.1 illustrates the case, when n = 3. Let ti1 , . . . , ti p be all digits equal to 1 in the tuple t˜ = (t0 , t1 , . . . , t3 ) representing a symmetric Boolean function f (x1 , x2 , x3 ). Transform the network Q into a switching network Pt˜ implementing the function f . One pole of Pt˜ is the left-most node of Q. The second pole is obtained by merging of nodes of Q labeled with the numbers ti1 , . . . , ti p . Let n be a natural number. For any natural number m such that m + 1 ≤ n, we denote by ψn≥m+1 the symmetric Boolean function with n variables x1 , . . . , xn that is equal to 1 if and only if the number of ones in the input is at least m + 1. We denote = n by ψn 2 the symmetric Boolean function with n variables x1 , .. ., xn that is equal to 1 if and only if the number of ones in the input is equal to n2 . We denote by = n ψn 2 the symmetric Boolean function with n variables x1 , . . . , xn that is equal to 1 if and only if the number of ones in the input does not equal to n2 . For each of these functions, there is a switching network that implements it and contains n 2 + n edges. It is clear that this network can be constructed in a time polynomial on n.
Fig. 6.1 Network Q
3 3
2 2 1
2
3
1
3
0
3
2 1
3 3
2
92
6 Diagnosis of Constant Faults in Switching Networks
6.1.3 Diagnosis of Arbitrary and Specially Constructed Switching Networks In this section, we consider two negative results related to the depth of decision trees for diagnosis of switching networks. First, we prove that there are simple switching networks for which the depth of decision trees for diagnosis of constant faults is high. Theorem 6.1 For any C ∈ {{0, 1}, {0}, {1}} and any natural n, there exists a switching network PC with n input variables such that L(PC ) = 2n and h C (PC ) ≥ 2n . Proof (a) Let C ∈ {{0, 1}, {0}}. As switching networks P{0,1} and P{0} , we consider the switching network S1 depicted in Fig. 6.2. It is clear that S1 has n input variables and L(S1 ) = 2n. We denote by ρ a {0}-fault of S1 such that the constant 0 is assigned to each edge of S1 . It is clear that f S1 ,ρ = 0. Let δ˜ = (δ1 , . . . , δn ) ∈ {0, 1}n . We now ˜ of S1 : for i = 1, . . . , n, if δi = 0, then we assign the constant describe a {0}-fault ρ(δ) 0 to the edge labeled with xi , and if δi = 1, then we assign 0 on the edge labeled δ1 δn with x¯i . It is clear that f S1 ,ρ(δ) ˜ = x 1 · · · x n . One can show that f S1 ,ρ = f S1 ,ρ(δ) ˜ for n n ˜ any δ ∈ {0, 1} and 2 is the minimum cardinality of a set of tuples from {0, 1}n n on which the function f S1 ,ρ is different from the functions f S1 ,ρ(δ) ˜ , δ˜ ∈ {0, 1} . It is clear that any {0}-fault of S1 is a {0, 1}-fault of S1 . By Lemma 6.1, h C (S1 ) ≥ 2n . (b) Let C = {1}. As switching network P{1} , we consider the switching network S2 depicted in Fig. 6.3. It is clear that S2 has n input variables and L(S2 ) = 2n. It is also clear that f S2 ,λ = 0, where λ is the empty fault. Let δ˜ = (δ1 , . . . , δn ) ∈ {0, 1}n . ˜ of S2 : for i = 1, . . . , n, if δi = 0, then we assign We now describe a {1}-fault ρ(δ) 1 to the edge labeled with xi , and if δi = 1, then we assign 1 to the edge labeled δ1 δn with x¯i . It is clear that f S2 ,ρ(δ) ˜ = x 1 · · · x n . One can show that f S2 ,λ = f S2 ,ρ(δ) ˜ for n n any δ˜ ∈ {0, 1} and 2 is the minimum cardinality of a set of tuples from {0, 1}n n on which the function f S2 ,λ is different from the functions f S2 ,ρ(δ) ˜ , δ˜ ∈ {0, 1} . By n Lemma 6.1, h C (S2 ) ≥ 2 . We now show that there are simple switching networks such that, for all switching networks implementing the same functions, the depth of decision trees for diagnosis of constant faults is high.
Fig. 6.2 Switching network S1
Fig. 6.3 Switching network S2
6.1 Arbitrary Switching Networks
93
Theorem 6.2 For any C ∈ {{0, 1}, {0}, {1}} and any natural n, there exists a switch ing network P with n input variables such that L(P) = n 2 + n and h C (Q) ≥ nn 2 for any switching network Q implementing the same function as P. Proof (a) Let C ∈ {{0, 1}, {1}}. We denote by P the switching network with n input = n variables x1 , . . . , xn , which implements the symmetric function ψ = ψn 2 and for which L(P) = n 2 + n (see Sect. 6.1.2). Let Q be a switching network with n input variables x1 , . . . , xn , which implen ˜ ments the function ψ. n Let δ = (δ1 , . . . , δn ) be a tuple from the set {0, 1} con˜ taining exactly k = 2 ones. Then ψ(δ) = 0. For definiteness, we assume that δ˜ = (1, . . . , 1, 0, . . . , 0). We know that ψ is equal to the disjunction of all conjunctions cλ (ξ ) corresponding to simple paths ξ between poles of Q, where λ ˜ each conjunction is is the empty fault of Q (see Sect. 6.1.1). For the tuple δ, equal to 0. Therefore, in each conjunction, there is at least one literal from the set A = {x¯1 , . . . , x¯k , xk+1 , . . . , xn }. ˜ be the fault of Q obtained by Denote B = {x1 , . . . , xk , x¯k+1 , . . . , x¯n }. Let ρ(δ) assigning the constant 1 to each edge labeled with a literal from B. The switching ˜ implements the function f Q,ρ(δ) network Q with the fault ρ(δ) ˜ . This function is the disjunction of all conjunctions cρ(δ) ˜ (ξ ) corresponding to simple paths ξ between poles of Q. Since each conjunction cλ (ξ ) contains a literal from A, each conjunction cρ(δ) ˜ (ξ ) contains a literal from A. Thus, the value of f Q,ρ(δ) ˜ on the tuple δ˜ is equal to 0. Let i ∈ {1, . . . , n} and σ˜ i be the tuple obtained from δ˜ by changing the ith digit δi to δ¯i . Since ψ is equal to 1 on the tuple σ˜ i , the function f Q,ρ(δ) ˜ is equal to 1 on the tuple σ˜ i . Therefore in Q there is a simple path ξ that contains only literals from A that are based on the variable xi : x¯i if i ∈ {1, . . . , k} and xi if i ∈ {k + 1, . . . , n}. For this path, cρ(δ) ˜ (ξ ) is equal to x¯i if i ∈ {1, . . . , k} and to x i if i ∈ {k + 1, . . . , n}. As a result, we obtain f Q,ρ(δ) ˜ = x¯ 1 ∨ · · · ∨ x¯ k ∨ x k+1 ∨ · · · ∨ x n ∨ C 1 ∨ · · · ∨ Cm , where C1 , . . . , Cm are elementary conjunctions constructed from literals from A and containing at least two literals each. Let j ∈ {1, . . . , m}. Then C j can be represented as a D, where a ∈ A and D is an elementary conjunction with literals from A that does not contain a. It is clear that a ∨ a D = a. As a result, we have f Q,ρ(δ) ˜ = x¯1 ∨ · · · ∨ x¯k ∨ xk+1 ∨ · · · ∨ xn . Thus, for any tuple (b1 , . . . , bn ) ∈ {0, 1}n with exactly k zeros, x1b1 ∨ · · · ∨ xnbn is a function implemented by the switching network Q with some {1}-fault. It is clear that the function 1 is implemented by the network Q with the {1}-fault for which b1 bn the constant 1 is assigned to each edge of Q. One can show that x1 ∨ · · · ∨ xn 1n = n for any tuple (b1 , . . . , bn ) ∈ {0, 1} with exactly k zeros and n is the minimum 2 cardinality of a set of tuples from {0, 1}n on which the function 1 is different from the functions x1b1 ∨ · · · ∨ xnbn such that the tuple (b1 , . . . , bn ) belongs to {0, 1}n and has exactly k zeros. It is clear that any {1}-fault of Q is a {0, 1}-fault of Q. By Lemma 6.1, h C (Q) ≥ nn . 2
94
6 Diagnosis of Constant Faults in Switching Networks
(b) Let C = {0}. We denote by P the switching network with n input variables = n x1 , . . . , xn , which implements the symmetric function ψ = ψn 2 and for which L(P) = n 2 + n (see Sect. 6.1.2). Let Q be a switching network with n input variables x1 , . . . , xn , which implen ˜ ments the function ψ n. Let δ = (δ1 , . . . , δn ) be a tuple from the set {0, 1} con˜ taining exactly k = 2 ones. Then ψ(δ) = 1. For definiteness, we assume that ˜ = 1, in Q there exists a simple path ξ between δ˜ = (1, . . . , 1, 0, . . . , 0). Since ψ(δ) poles of Q for which the elementary conjunction cλ (ξ ) corresponding to this path ˜ where λ is the empty fault of Q. Let us show that is equal to 1 for the tuple δ, cλ (ξ ) = x1 · · · xk x¯k+1 · · · x¯n . It is clear, that all variables without negation from cλ (ξ ) belong to the set A = {x1 , . . . , xk } and all variables with negation from cλ (ξ ) belong to the set B = {x¯k+1 , . . . , x¯n }. Let at least one literal from A do not belong to cλ (ξ ). Then cλ (ξ ) is equal to 1 on a tuple with less than k ones. Let at least one literal from B do not belong to cλ (ξ ). Then cλ (ξ ) is equal to 1 on a tuple with greater than k ones. Thus, cλ (ξ ) = x1 · · · xk x¯k+1 · · · x¯n . Let us consider a {0}-fault of Q that consists in assigning the constant 0 to each edge that does not belong to the path ξ . Then the switching network Q with this fault implements the function cλ (ξ ) = x1 · · · xk x¯k+1 · · · x¯n . Thus, for any tuple (b1 , . . . , bn ) ∈ {0, 1}n with exactly k ones, x1b1 · · · xnbn is the function implemented by the switching network Q with some {0}-fault. It is clear that the function 0 is implemented by Q with {0}-fault that consists in assigning b1 bn the constant 0 to each edge of Q. One can show 0 = x1 · · · xn for any tuple nthat n (b1 , . . . , bn ) ∈ {0, 1} with exactly k ones and n is the minimum cardinality of 2 a set of tuples from {0, 1}n on which the function 0 is different from the functions n x1b1 · · · xnbn such that the tuple n(b1 , . . . , bn ) belongs to {0, 1} and has exactly k ones. By Lemma 6.1, h C (Q) ≥ n . 2
Remark 6.1 It is well known that nn = max nk : k = 0, . . . , n . Therefore 2 n n ≥ 2
2n . n+1
6.1.4 Complexity of Diagnostic Decision Tree Construction In this section, we consider one more negative result: we prove that the problem of construction of decision trees for diagnosis of constant faults in switching networks is NP-hard. Let C ∈ {{0, 1}, {0}, {1}}. We now define an algorithmic problem Con(C): for a given switching network P with L(P) ≥ 1 and a set R of C-faults of P, it is required to construct a decision tree Γ , which solves the problem of diagnosis of C-faults for P and R.
6.1 Arbitrary Switching Networks
95
Fig. 6.4 Switching network Q1
Fig. 6.5 Subnetwork P2
One can show that there exists a decision tree, which solves this problem and has at most 2 |R| − 1 nodes. Theorem 6.3 Let C ∈ {{0, 1}, {0}, {1}}. Then the problem Con(C) is NP-hard. Proof Let us assume that there exists an algorithm, which solves the problem Con(C) and has polynomial time complexity. We now show that in this case there exists an algorithm, which has polynomial time complexity and solves the vertex cover problem that is NP-hard. In this problem, for a given simple undirected graph G = (V, E) with the set of vertices V and the set of edges E, and a natural number m, 0 < m < |V |, it is required to recognize if there exists a subset W of the set V such that each edge from E is incident to at least one node from W and |W | ≤ m. Let V = {v1 , . . . , vn } and E = {{vi1 , v j1 }, . . . , {vit , v jt }}. Let us consider the Boolean function ψG (x1 , . . . , xn ) = (xi1 ∨ x j1 ) · · · (xit ∨ x jt ). It is clear that the vertex cover problem defined above has a solution if and only if there exists a tuple (δ1 , . . . , δn ) ∈ {0, 1}n with at most m ones such that ψG (δ1 , . . . , δn ) = 1. It is also clear that the considered problem has a solution if and only if ψn≥m+1 = ψn≥m+1 ∨ ψG (see definition of the function ψn≥m+1 in Sect. 6.1.2). (a) Let C ∈ {{0, 1}, {0}}. It is clear that in a polynomial time depending on the length of description of the graph G we can construct a switching network Q 1 depicted in Fig. 6.4 in which the subnetwork P1 implements the function ψn≥m+1 and has n 2 + n edges (see Sect. 6.1.2) and the subnetwork P2 implements the function ψG and has 2t edges (see Fig. 6.5). Let R = {λ, ρ}, where λ is the empty fault of Q 1 and ρ is a fault of Q 1 that consists in assigning the constant 0 to each edge of the subnetwork P2 . Both faults from R are {0}-faults and therefore {0, 1}-faults. It is clear that the network Q 1 with the fault λ implements the function ψn≥m+1 ∨ ψG and the network Q 1 with the fault ρ implements the function ψn≥m+1 . Apply the algorithm, which solves the problem Con(C) and has polynomial time complexity to the network Q 1 and the set of faults R. As a result, we obtain a decision tree Γ , which solves the problem of diagnosis of C-faults for Q 1 and R. Apply Γ to the network Q 1 with the fault λ and apply Γ to the network Q 1 with the fault
96
6 Diagnosis of Constant Faults in Switching Networks
Fig. 6.6 Switching network Q2
ρ. The considered vertex cover problem has a solution if and only if the results of work of Γ for these faults are different. Note that the processes of the construction of Q 1 , λ, ρ and Γ and the application of Γ to Q 1 and faults λ and ρ can be done in a polynomial time. Thus, if there is a polynomial time algorithm for the problem Con(C), then there is a polynomial time algorithm for the vertex cover problem. Hence the problem Con(C) is NP-hard. (b) Let C = {1}. It is clear that in a polynomial time depending on the length of description of the graph G we can construct a switching network Q 2 depicted in Fig. 6.6 in which the subnetwork P1 implements the function ψn≥m+1 and has n 2 + n edges (see Sect. 6.1.2) and the subnetwork P2 implements the function ψG and has 2t edges (see Fig. 6.5). Let R = {λ, ρ}, where λ is the empty fault of Q 2 and ρ is a {1}-fault of Q 2 that consists in assigning the constant 1 to two edges in the right-hand side of the network Q 2 that are labeled with the literals x1 and x¯1 , respectively. It is clear that the network Q 2 with the fault λ implements the function ψn≥m+1 and the network Q 2 with the fault ρ implements the function ψn≥m+1 ∨ ψG . Apply the algorithm, which solves the problem Con(C) and has polynomial time complexity to the network Q 2 and the set of faults R. As a result, we obtain a decision tree Γ , which solves the problem of diagnosis of C-faults for Q 2 and R. Apply Γ to the network Q 2 with the fault λ and apply Γ to the network Q 2 with the fault ρ. The considered vertex cover problem has a solution if and only if the results of work of Γ for these faults are different. Note that the processes of the construction of the switching network Q 2 , faults λ, ρ and decision tree Γ and the application of Γ to Q 2 and faults λ and ρ can be done in a polynomial time. Thus, if there is a polynomial time algorithm for the problem Con(C), then there is a polynomial time algorithm for the vertex cover problem. Hence the problem Con(C) is NP-hard.
6.2 Iteration-Free Switching Networks In this section, we study iteration-free switching networks in which edges are labeled with pairwise different variables. It is convenient for us to consider iteration-free switching networks without variables assigned to edges. We call them networks.
6.2 Iteration-Free Switching Networks
97
6.2.1 Main Notions In this section, we consider main notions related to networks, constant faults and decision trees for fault diagnosis. We also prove a simple lower bound on the depth of decision trees for fault diagnosis. A network is an undirected graph S with multiple edges and without loops in which two different nodes called poles are fixed. For each edge e in S, there is a simple path (without repeating nodes) between poles, which contains e. We will assume that the set of edges of S is ordered. We denote by L(S) the number of edges in the network S. A network containing only two nodes and one edge connecting these nodes is called trivial. Various examples of networks can be found in Tables 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9 and 6.10. Let us remind that a Boolean function f (x1 , . . . , xn ) is called monotone if, for any n-tuples a = (a1 , . . . , an ) and b = (b1 , . . . , bn ) from {0, 1}n , if a1 ≤ b1 , . . . , an ≤ bn , then f (a) ≤ f (b). A variable xi of the function f is called essential if there exist two tuples a, b ∈ {0, 1}n , which are different only in the ith digit and for which f (a) = f (b). Let S be a network with L(S) = n edges e1 , . . . , en . We assign to these edges variables x1 , . . . , xn , respectively, and define a Boolean function f S (x1 , . . . , xn ) implemented by S with assigned variables. Let a1 , . . . , an ∈ {0, 1} be values of variables x1 , . . . , xn , respectively. Then f S (a1 , . . . , an ) = 1 if and only if there is a path between poles of S in which all variables corresponding to edges in the path have value 1. One can show that f S is a monotone function, and all variables of this function are essential. We consider three types of constant faults: {0, 1}-faults, {0}-faults, and {1}faults. Let C ∈ {{0, 1}, {0}, {1}}. A C-fault of S consists in assigning of constants More formally, a C-fault of S is an n-tuple from C to some variables of f S . ρ = (ρ1 , . . . , ρn ) ∈ {C ∪ {2}}n . For i = 1, . . . , n, the value ρi is called the value of the fault ρ for the variable xi . The network S with the fault ρ implements the function f S,ρ (x1 , . . . , xn ) = f S (x1 ◦ ρ1 , . . . , xn ◦ ρn ), where ⎧ ⎨ 0, ρi = 0 xi ◦ ρi = 1, ρi = 1 ⎩ xi , ρi = 2 for i = 1, . . . , n. Note that f S,ρ is a monotone function. A C-fault ρ is called normal if, for i = 1, . . . , n, ρi = 2 if and only if the variable xi is an essential variable of the function f S,ρ . One can show that, for any C-fault δ of S, there exists a normal C-fault ρ of S such that f S,ρ = f S,δ . The problem of diagnosis of C-faults for S: for the network S with C-fault δ of S, we should find a normal C-fault ρ of S such that f S,ρ = f S,δ . To resolve this problem we can ask about values of the function f S,δ on arbitrary tuples from {0, 1}n . Algorithms for solving the problem of diagnosis of C-faults can be represented in the form of decision trees each of which is a directed tree with root. Terminal nodes
98
6 Diagnosis of Constant Faults in Switching Networks
of the tree are labeled with normal C-faults of S. Each nonterminal node is labeled with an n-tuple from {0, 1}n . Two edges start in this node that are labeled with 0 and 1, respectively. The depth h(Γ ) of a decision tree Γ is the maximum length of a path from the root to a terminal node. Let Γ be a decision tree. For the network S with a C-fault δ, this tree works in the following way. If the root of Γ is a terminal node, then the outcome of Γ is the normal fault attached to the root. Otherwise, we find the value of the function f S,δ on the n-tuple attached to the root and pass along the edge, which starts in the root and is labeled with this value, etc., until we reach a terminal node. The normal fault attached to this node is the outcome of Γ . We will say that Γ solves the problem of diagnosis of C-faults for S if, for any C-fault δ of S, the outcome of Γ is a normal C-fault ρ of S such that f S,ρ = f S,δ . We denote by h C (S) the minimum depth of a decision tree, which solves the problem of diagnosis of C-faults for S. We consider now a lower bound on h C (S). We denote FC (S) = { f S,ρ : ρ ∈ (C ∪ {2})n }. The set FC (S) contains all functions defined on {0, 1}n that can be obtained from the function f S implemented by S by assigning of constants from C to some variables of f S . This set includes the function f S as well. Lemma 6.2 For any C ∈ {{0, 1}, {0}, {1}} and any iteration-free switching network S, the following inequality holds: h C (S) ≥ log2 |FC (S)| . Proof Let Γ be a decision tree, which solves the problem of diagnosis of C-faults for S and for which h(Γ ) = h C (S). For each function f ∈ FC (S), in the tree Γ there is a terminal node, which is labeled with a fault ρ for S such that f = f S,ρ . Therefore, the number of terminal nodes in Γ is at least |FC (S)|. One can show that the number of terminal nodes in Γ is at most 2h(Γ ) . Thus, |FC(S)| ≤ 2h C (S) and h C (S) ≥ log2 |FC (S)|. Since h C (S) is an integer, we have h C (S) ≥ log2 |FC (S)| .
6.2.2 Diagnosis of Decomposable Networks In this section, we study the problem of diagnosis of C-faults for decomposable networks, which can be constructed from a finite set of indecomposable networks. Recall that a network containing only two nodes and one edge connecting these nodes is called trivial. A network S is called decomposable if there are two nontrivial networks P and Q, and an edge e in the network P such that S can be obtained by replacing the edge e with the network Q. During the replacement, the ends of e are identified with the poles of Q, the edge e is removed, and the poles of P become the poles of S. The edges of S are ordered in the following way: first there are all edges of P with the exception of e in the same order as in P and after that all edges of Q in the same order as in Q. If a network is not decomposable, it is called indecomposable.
6.2 Iteration-Free Switching Networks
99
Let B be a finite nonempty set of indecomposable nontrivial networks (basis for networks). We denote Net1 (B) = B and, for any natural r ≥ 2, we denote by / Net1 (B) ∪ · · · ∪ Netr −1 (B) such that S can Netr (B) the set of all networks S ∈ be obtained by replacing some edges in a network from B with networks from Net 1 (B) ∪ · · · ∪ Netr −1 (B). The set Net(B) = Net 1 (B) ∪ Net 2 (B) ∪ . . . is called the set of networks over basis B. We now consider an upper bound on the minimum depth of decision trees for diagnosis of C-faults for networks over B depending on the number of edges in the h C (Q) for any network. We denote tC (B) = max{tC (Q) : Q ∈ B}, where tC (Q) = L(Q)−1 Q ∈ B. Recall that L(S) is the number of edges in a network S, and h C (S) is the minimum depth of a decision tree, which solves the problem of diagnosis of C-faults for S. Theorem 6.4 Let B be a finite nonempty set of indecomposable nontrivial networks. Then, for any C ∈ {{0, 1}, {0}, {1}} and any network S ∈ Net(B), the following inequality holds: h C (S) ≤ tC (B)(L(S) − 1) . Proof We will prove the considered inequality by induction on index r such that h C (S) (L(S) − 1) = tC (S)(L(S) − S ∈ Netr (B). Let S ∈ Net 1 (B). Then h C (S) = L(S)−1 1) ≤ tC (B)(L(S) − 1). Let now r ≥ 2 and, for any network from Net 1 (B) ∪ · · · ∪ Netr −1 (B), the considered inequality hold. Let us prove that the considered inequality holds for any S ∈ Netr (B). Since r ≥ 2, there exist networks P0 ∈ B and P1 , . . . , Pk ∈ Net1 (B) ∪ · · · ∪ Netr −1 (B), k ≤ L(S), such that S can be obtained by replacing k edges in the network P0 with the networks P1 , . . . , Pk . It is clear that L(S) = L(P0 ) + (L(P1 ) − 1) + · · · + (L(Pk ) − 1). We proved that h C (P0 ) ≤ tC (B)(L(P0 ) − 1). By induction hypothesis, h C (Pi ) ≤ tC (B)(L(Pi ) − 1) for i = 1, . . . , k. For i = 0, 1, . . . , k, let Γi be a decision tree, which solves the problem of diagnosis of C-faults for Pi and for which h C (Γi ) ≤ tC (B)(L(Pi ) − 1). We consider now a decision tree Γ , which solves the problem of diagnosis of C-faults for S. We describe the work of Γ for the network S with a C-fault δ. As a result, we obtain a normal C-fault ρ for S such that f S,ρ = f S,δ . First, the decision tree Γ simulates in some way the work of the decision tree Γ0 . The network P0 (as a skeleton of S) is analyzed at that. Let P0 contain m = L(P0 ) edges, e1 , . . . , em . Let a nonterminal node of the decision tree Γ0 be labeled with an m-tuple (a1 , . . . , am ) ∈ {0, 1}m . For i = 1, . . . , m, we assign the value ai to some variables of S (we denote the set of these variables X i ). If the edge ei was not replaced with a network, then we assign the value ai to the variable corresponding to ei in S (X i contains only this variable). If the edge ei was replaced with a network P j , then we assign the value ai to all variables corresponding to edges of the network P j in S (X i contains all these variables). The value of the function implemented by P j with the fault δ will be equal ai provided that this function is not constant.
100
6 Diagnosis of Constant Faults in Switching Networks
Let a normal C-fault γ = (γ1 , . . . , γm ) for P0 be the outcome of the decision tree Γ0 . For i = 1, . . . , m, we fix values of ρ for some variables of f S . To this end, the decision tree Γ will simulate the work of some decision trees Γ j , j ∈ {1, . . . , k}. If γi = 2, then the value of ρ is equal to γi for each variable from X i . Let γi = 2. If X i contains only one variable, then the value of ρ for this variable is equal to 2. Let X i contain two or more variables. Then the edge ei was replaced in S with a network P j , j ∈ {1, . . . , k}. Since γi = 2 , there are values b1 , . . . , bi−1 , bi+1 , . . . , bm ∈ {0, 1} such that f P0 ,γ (b1 , . . . , bi−1 , 0, bi+1 , . . . , bm ) = f P0 ,γ (b1 , . . . , bi−1 , 1, bi+1 , . . . , bm ). Now, the decision tree Γ simulates the work of the decision tree Γ j . Let P j contain l = L(P j ) edges ε1 , . . . , εl . Let a nonterminal node of the decision tree Γ j be labeled with an l-tuple (a1 , . . . , al ) ∈ {0, 1}l . We assign values a1 , . . . , al to variables corresponding in S to the edges ε1 , . . . , εl , respectively. For s = 1, . . . , i − 1, i + 1, . . . , m, we assign the value bs to all variables from X s . Let the outcome of the decision tree Γ j be a normal C-fault α = (α1 , . . . , αl ) for P j . Then α1 , . . . , αl are the values of ρ for the variables corresponding to the edges ε1 , . . . , εl , respectively. The outcome of Γ is the tuple ρ, which will be completely defined after the finishing of the work with γm . One can show that f S,δ = f S,ρ . Therefore Γ solves the problem of diagnosis of C-faults for S. It is clear that h(Γ ) ≤ h(Γ0 ) + · · · + h(Γk ) ≤ t (B)(L(P0 ) − 1) + · · · + t (B)(L(Pk ) − 1) = t (B)(L(S) − 1). Remark 6.2 The bound from Theorem 6.4 is in some sense sharp: the coefficient tC (B) is the minimum number a such that h C (S) ≤ a(L(S) − 1) for any S ∈ Net(B) (the equality h C (S) = tC (B)(L(S) − 1) holds for at least one network S from B). Remark 6.3 It is not necessary to design and memorize the decision tree Γ for diagnosis of C-faults for a network S ∈ Net(B) whose depth satisfies the inequality from Theorem 6.4. The proof of Theorem 6.4 shows that we can simulate the work of this tree efficiently if we know decision trees with minimum depth for the diagnosis of C-faults for networks from B and if we know how the network S was built from the networks contained in B. We denote by S12 a network with two poles and two parallel edges connecting the poles and by S22 we denote a network consisting of simple path of length two connecting two poles (see Table 6.2). Remark 6.4 The results of Theorem 6.4 can be used to diagnose switching networks implementing arbitrary Boolean functions. Let the set B contain, among others, the networks S12 and S22 . Then each Boolean function can be implemented by a conventional switching network over B in which edges are labeled with literals. This network has two modes of operation: normal, when it implements the considered function, and the diagnostic, when its edges are labeled with pairwise different variables instead of the initial literals (in this case, we can control each edge independently of other edges). In the diagnostic mode, the initial network is transformed into an iteration-free network over B, which can be diagnosed efficiently.
6.2 Iteration-Free Switching Networks
101
Theorem 6.4 gives us an upper bound on h C (S), which depends linearly on L(S) and is true for any S ∈ Net(B). We have no lower bound on h C (S), which is linear depending on L(S) and holds for any S ∈ Net(B). However, we can obtain such a bound in the worst case. To this end, we consider a function H BC , which characterizes the dependence in the worst case of the minimum depth of a decision tree for diagnosis of C-faults for a network from Net(B) on the number of edges in the network. For each natural n, H BC (n) = max{h C (S) : S ∈ Net(B), L(S) ≤ n} . Theorem 6.5 Let B be a finite nonempty set of indecomposable nontrivial networks. Then {0,1} H B (n) = Θ(n) . {0,1}
Proof From Theorem 6.4 it follows that H B (n) = O(n). Let us show that {0,1} H B (n) = Ω(n). Let B contain the network S12 . Then, for any natural n ≥ 2, the set Net(B) contains a network Pn with n edges such that f Pn = x1 ∨ . . . ∨ xn . Let I ⊆ {1, . . . , n}. We is equal to 2 if i ∈ I and consider a fault δ of Pn whose value for the variable xi xi ( f Pn ,δ = 0 if I = ∅). is equal to 0 if i ∈ {1, . . . , n} \ I . It is clear that f Pn ,δ = i∈I
Since F(Pn ) contains the function xi for each I ⊆ {x1 , . . . , xn }, F{0,1} (Pn ) ≥ 2n i∈I
{0,1}
and, by Lemma 6.2, h {0,1} (Pn ) ≥ n. From here it follows that H B (n) ≥ n and {0,1} H B (n) = Ω(n). Assume S12 does not belong to B. Then B contains a network S2 with a simple path between poles whose length is at least 2 (it is easy to show that S12 is the only indecomposable nontrivial network in which the length of each simple path between poles is equal to 1). Let L(S2 ) = t. One can show that, for any natural m ≥ 2, there exists a network Sm from Net(B) such that L(Sm ) ≤ (m − 1)t and there is a simple path τ between poles of Sm with length p ≥ m. Let x j1 , . . . , x j p be variables corresponded to edges in τ . Let I ⊆ { j1 , . . . , j p }. We consider a fault δ of Sm whose value for each variable xi of Sm is equal to 2 if i ∈ I , is equal to 1 / { j1 , . . . , j p }. It isclear that f Sm ,δ = if i ∈ { j1 , . . . , j p } \ I , and is equal to 0 if i ∈ xi ( f Sm ,δ = 1 if I = ∅). Since F(Sm ) contains the function xi for each I ⊆ i∈I i∈I { j1 , . . . , j p }, F{0,1} (Sm ) ≥ 2 p ≥ 2m and, by Lemma 6.2, h{0,1} (Sm ) ≥ m. Let n be a natural number such that n ≥ t and m = nt + 1. It is clear that {0,1} L(Sm ) ≤ (m − 1)t ≤ n. Since h {0,1} (Sm ) ≥ m ≥ nt , we have H B (n) ≥ nt for any {0,1} natural n ≥ t. Therefore H B (n) = Ω(n). Theorem 6.6 Let B be a finite nonempty set of indecomposable nontrivial networks. {1} {1} If B = {S12 }, then H B (n) = 1 for n ≥ 2. Otherwise, H B (n) = Θ(n).
102
6 Diagnosis of Constant Faults in Switching Networks
Proof Let B = {S12 }. An arbitrary network S from the set Net(B) consists of two poles and L(S) ≥ 2 edges connecting the poles. Therefore F{1} (S) = {x1 ∨ · · · ∨ {1} x L(S) , 1} and h {1} (S) = 1. Hence H B (n) = 1 for n ≥ 2. {1} Let B = {S12 }. From Theorem 6.4, it follows that H B (n) = O(n). Let us show {1} 2 that H B (n) = Ω(n). Since B = {S1 }, the set B contains a network S2 with a simple path between poles whose length is at least 2 (it is easy to show that S12 is the only indecomposable nontrivial network in which the length of each simple path between poles is equal to 1). Let L(S2 ) = t. One can show that, for any natural m ≥ 2, there exists a network Sm from Net(B) such that L(Sm ) ≤ (m − 1)t and there is a simple path τ between poles of Sm with length p ≥ m. Let x j1 , . . . , x j p be variables corresponded to edges in τ . Let I ⊆ { j1 , . . . , j p }. We consider a {1}-fault δ(I ) of Sm whose value for each variable xi of Sm is equal to 2 if i ∈ { j1 , . . . , j p } \ I or i∈ / { j1 , . . . , j p } and is equal to 1 if i ∈ I . / Let I1 , I2 ⊆ { j1 , . . . , j p } and I1 = I2 . Then there is k ∈ I1 ∪ I2 such that k ∈ I1 ∩ I2 . Let us consider a tuple α of values of variables of Sm in which xk = 0, xi = 1 for any i ∈ { j1 , . . . , j p } \ {k} and xi = 0 for any i ∈ / { j1 , . . . , j p }. It is easy to show that f Sm ,δ(I1 ) (α) = f Sm ,δ(I2 ) (α). Therefore F{1} (Sm ) ≥ 2 p ≥ 2m and, by Lemma 6.2, h {1} (Sm ) ≥ m. Let n be a natural number such that n ≥ t and m = nt + 1. It is clear that {1} L(Sm ) ≤ (m − 1)t ≤ n. Since h {1} (Sm ) ≥ m ≥ nt , we have H B (n) ≥ nt for any nat{1} ural n ≥ t. Therefore H B (n) = Ω(n). Theorem 6.7 Let B be a finite nonempty set of indecomposable nontrivial networks. {0} {0} If B = {S22 }, then H B (n) = 1 for n ≥ 2. Otherwise, H B (n) = Θ(n). Proof Let B = {S22 }. An arbitrary network S from the set Net(B) consists of simple path of length L(S) ≥ 2 connecting two poles. Therefore F{0} (S) = {x1 ∧ . . . ∧ {0} x L(S) , 0} and h {0} (S) = 1. Hence H B (n) = 1 for n ≥ 2. {0} Let B = {S22 }. From Theorem 6.4 it follows that H B (n) = O(n). Let us show {0} that H B (n) = Ω(n). Since B = {S22 }, the set B contains a network S2 with at least 2 edges connected to a pole (it is easy to show that S22 is the only indecomposable nontrivial network in which exactly one edge is connected to each pole). Let L(S2 ) = t. One can show that, for any natural m ≥ 2, there exists a network Sm from Net(B) such that L(Sm ) ≤ (m − 1)t and there are p ≥ m edges connected to a pole. Let x j1 , . . . , x j p be variables corresponded to these edges. Let I ⊆ { j1 , . . . , j p }. We consider a {0}-fault δ(I ) of Sm whose value for each variable xi of Sm is equal to 2 / { j1 , . . . , j p } and is equal to 0 if i ∈ I . if i ∈ { j1 , . . . , j p } \ I or i ∈ / Let I1 , I2 ⊆ { j1 , . . . , j p } and I1 = I2 . Then there is k ∈ I1 ∪ I2 such that k ∈ I1 ∩ I2 . Let us consider a tuple α of values of variables of Sm in which xk = 1, xi = 0 for any i ∈ { j1 , . . . , j p } \ {k} and xi = 1 for any i ∈ / { j1 , . . . , j p }. It is easy to show that f Sm ,δ(I1 ) (α) = f Sm ,δ(I2 ) (α). Therefore F{0} (Sm ) ≥ 2 p ≥ 2m and, by Lemma 6.2, h {0} (Sm ) ≥ m.
6.2 Iteration-Free Switching Networks
103
Let n be a natural number such that n ≥ t and m = nt + 1. It is clear that {0} L(Sm ) ≤ (m − 1)t ≤ n. Since h {0} (Sm ) ≥ m ≥ nt , we have H B (n) ≥ nt for any nat{0} ural n ≥ t. Therefore H B (n) = Ω(n).
6.2.3 Diagnosis of Indecomposable Networks Let C ∈ {{0, 1}, {0}, {1}}. In this section, we find value of h C (S) for each nontrivial indecomposable network S with at most 10 edges. We now describe tools, which h C (S) can be found in an easy were used to obtain these values. The value tC (S) = L(S)−1 way if we know the value h C (S). The first tool is a dynamic programming algorithm [1, 2, 6, 12]. Let S contain n edges. For α1 , . . . , αm ∈ {0, 1}n and b1 , . . . , bm ∈ {0, 1}, we denote by FC (S)(α1 , b1 ) · · · (αm , bm )
(6.1)
the set of all functions f from FC (S) for which f (α1 ) = b1 , . . . , f (αm ) = bm . All nonempty subsets of FC (S), which can be represented in the form (6.1) including the set FC (S) are called separable subsets of the set FC (S). Let G ⊆ FC (S). Then G(α1 , b1 ) · · · (αm , bm ) = FC (S)(α1 , b1 ) · · · (αm , bm ) ∩ G . First, the dynamic programming algorithm constructs the set FC (S). Next, this algorithm constructs the set ΔC (S) of all separable subsets of the set FC (S). Each subset G ∈ ΔC (S) is considered as a subproblem of the initial problem FC (S): for a given function f ∈ G we should find a normal C-fault ρ for S such that f = f S,ρ . We denote by h(G) the minimum depth of a decision tree solving the problem G. For a problem G, we denote by E(G) the set of tuples α ∈ {0, 1}n such that |G(α, 0)| ≥ 1 and |G(α, 1)| ≥ 1. The considered algorithm is based on the following equalities: h(G) = 0 if |G| = 1, and h(G) = min{1 + max{h(G(α, 0)), h(G(α, 1))} : α ∈ E(G)} if |G| ≥ 2. The algorithm begins the computation of the value h(G) from smallest separable subsets and finishes when the value h(FC (S)) is computed. For networks containing at most five edges, we used the dynamic programming algorithm, which allows us to find exact value of h {0,1} (S). For networks containing at most seven edges, we used the dynamic programming algorithm, which allows us to find exact values of h {0} (S) and h {1} (S). For the networks containing more than five edges for C = {0, 1} and networks containing more than seven edges for C ∈ {{0}, {1}}, we used lower bound on h C (S) from Lemma 6.2. To obtain upper bound on h C (S), we used greedy algorithms for decision tree construction considered in [3]. We describe here only two greedy algo-
104
6 Diagnosis of Constant Faults in Switching Networks
rithms, which allowed us to obtain best results for each of the considered networks. The description is adapted to the problem of diagnosis. We now consider the first step of each algorithm—the choice of n-tuple from E(FC (S)), which will be attached to the root of the tree, where n = L(S). For a given n-tuple α from E(FC (S)), we denote N0 (α) = |FC (S)(α, 0)| and N1 (α) = |FC (S)(α, 1)|. The first greedy algorithm (similar to the one considered in [10]) chooses a tuple α from E(FC (S)), which minimizes the value max{N0 (α), N1 (α)} . The second greedy algorithm (similar to the one considered in [13]) chooses a tuple α from E(FC (S)), which minimizes the value N0 (α) log2 N0 (α) + N1 (α) log2 N1 (α) . Later, each greedy algorithm works in the same way with subsets FC (S)(α, 0) and FC (S)(α, 1) corresponding to the children of the root, etc. The construction of the decision tree is finished when separable subsets corresponding to terminal nodes are singletons. For each of the considered nontrivial indecomposable network S with at most 10 edges and for each C ∈ {{0, 1}, {0}, {1}}, the difference between lower bound on h C (S) from Lemma 6.2 and upper bound—the depth of a decision tree constructed by one of the considered greedy algorithms—is at most one. To find the exact value of h C (S) for each nontrivial indecomposable network S with at most 10 edges and for each C ∈ {{0, 1}, {0}, {1}}, we created new algorithm called bounded depth algorithm. Let C ∈ {{0, 1}, {0}, {1}}, d be a nonnegative integer, and S ∈ Net(B). Let G be a subset of FC (S) with |G| ≥ 2. We will describe a sequence T (G, d) of tuples from {0, 1}n , where n = L(S). We will say that two tuples α, β ∈ E(G) are equivalent if, for any f ∈ G, f (α) = f (β). This equivalence relation divides E(G) into classes of equivalence E 1 , . . . , E p . We choose one representative from each class and order these representatives α1 , . . . , α p such that, . . . , p − 1, I (α for i = 1, i ) ≤ I (αi+1 ), where, for , G(α j , 1)}. If log I (α1 ) > d − 1, the , 0) j = 1, . . . , p, I (α j ) = max{G(α j 2 sequence T (G, d) is empty. Let log2 I (α1 ) ≤ d − 1 and k be the maximum number from {1, . . . , p} such that log2 I (αk ) ≤ d − 1. Then T (G, d) = (α1 , . . . , αk ). Bounded depth algorithm. Let t be a nonnegative integer. We now describe an algorithm, which recognizes if there exists a tree Γ for diagnosis of C-faults for the network S with h(Γ ) ≤ t, and if such a tree exists, it constructs one. The inputs of this algorithm are the set FC (S) and the number t. During each step, the algorithm will work with a tree D, which is a prefix of some decision tree for diagnosis of C-faults for S. Each node v of the tree D will be labeled with an integer d(v) and a sequence T (v) of tuples from {0, 1}n , where n = L(S). We will also correspond a subset G(v) of the set FC (S) to the node v.
6.2 Iteration-Free Switching Networks
105
Fig. 6.7 Network S12
We will assume that in each nonterminal node of D, the edge leaving this node and labeled with 0 is going to the left and the edge labeled with 1 is going to the right. In this case, we have a natural ordering of terminal nodes of D from the left to the right. At the first step, we form the root node r of D for which d(r ) = t, T (r ) = T (FC (S), t), and G(r ) = FC (S). Let us assume that we already made m ≥ 1 steps and constructed a tree D. We now describe the step number m + 1. If each terminal node of D is labeled with a normal C-fault for S, then D is a decision tree for diagnosis of C-faults for the network S with h(D) ≤ t. Otherwise, we choose the leftmost terminal node v of D, which is not labeled with a normal fault. Let T (v) be empty. If v be the root of D, then there is no decision tree Γ for diagnosis of C-faults for S such that h(Γ ) ≤ t, and the algorithm finishes its work. If v is not a root of D, then we remove v and the edge entering v. Also, we remove the subtree with root at the sibling v of v and remove the edge entering v . Moreover, we remove the n-tuple α attached to the parent of v. Then, we proceed to step number m + 2. Let T (v) be nonempty and α be the first n-tuple in T (v). We remove α from T (v) and we attach it to the node v. We add to D two nodes v0 , v1 and we draw edges from v to v0 and v1 labeled with 0 and 1, respectively. For v0 , d(v0 ) = d(v) − 1, G(v0 ) = G(v)(α, 0) and T (v0 ) = T (G(v0 ), d(v0 )). For v1 , d(v1 ) = d(v) − 1, G(v1 ) = G(v)(α, 1) and T (v1 ) = T (G(v1 ), d(v1 )). If |G(v0 )| = 1, we attach to the node v0 the corresponding normal fault for the function from G(v0 ). Similarly, if |G(v1 )| = 1, we attach to the node v1 the corresponding normal fault for the function from G(v1 ). Now we proceed to step number m + 2. If, for some C ∈ {{0, 1}, {0}, {1}} and some network S with at most 10 edges, the difference between the lower and the upper bounds for h C (C) is equal to 1, we apply the bounded depth algorithm to the set FC (S) and to the number t, which is equal to the obtained lower bound for h C (S). If the algorithm constructs a decision tree Γ for diagnosis of C-faults for the network S with h(Γ ) = t, then h C (S) = t. Otherwise, h C (S) = t + 1. We now consider an example of the bounded depth algorithm work. Example 6.1 Let S12 be a network with two edges and variables assigned to these edges as in Figure 6.7. This network implements the function f S12 (x1 , x2 ) = x1 ∨ x2 . We are interested in finding a decision tree with the minimum depth that solves the problem of diagnosis of {0, 1}-faults for S12 .
106 Table 6.1 Outputs of functions f S 2 ,ρi , 1 i = 1, 2, 3, 4, 5
6 Diagnosis of Constant Faults in Switching Networks Input
f S 2 ,ρ1
f S 2 ,ρ2
f S 2 ,ρ3
f S 2 ,ρ4
f S 2 ,ρ5
00 01 10 11
0 0 0 0
1 1 1 1
0 1 0 1
0 0 1 1
0 1 1 1
1
1
1
1
1
Fig. 6.8 Steps of bounded depth algorithm
We found that F{0,1} (S12 )={ f S12 ,ρ1 , f S12 ,ρ2 , f S12 ,ρ3 , f S12 ,ρ4 , f S12 ,ρ5 }, where ρ1 = (0, 0), ρ2 = (1, 1), ρ3 = (0, 2), ρ4 = (2, 0), and ρ5 = (2, 2) are normal faults for the network S12 . Table 6.1 describes functions from the set F{0,1} (S12 ). We know that |F{0,1} (S12 )| = 5. According to Lemma 6.2, the minimum depth of a decision tree that solves the problem of diagnosis of {0, 1}-faults for S12 is at least 3. In this example, we use the bounded depth algorithm to verify if a tree with depth of 3 exists. Note that from each class of equivalent 2-tuples, we choose only one representative. Also, tuples that have the same output for all faults are excluded. As a result, at the beginning of the algorithm work we have the whole set {0, 1}2 of input tuples (see Table 6.1). Let t = 3. One can show that T (F{0,1} (S12 ), t) = (00, 01, 10, 11). We start constructing a tree D with a root node r as it depicted in Fig. 6.8. We start with the root node r (the leftmost terminal node not labeled with a normal fault). We remove the first tuple 00 from T (r ) and we attach it to the node r . We add two nodes v0 , v1 and we draw edges from r to v0 and v1 labeled with 0 and 1, respectively. For v0 , d(v0 ) = d(r ) − 1, G(v0 ) contains all fault functions that give an output of 0 with the input tuple 00 and T (v0 ) = T (G(v0 ), d(v0 )). For v1 , d(v1 ) = d(r ) − 1, G(v1 ) contains all fault functions that give an output of 1 with the input tuple 00 and T (v1 ) = T (G(v1 ), d(v1 )). The obtained tree is depicted in Fig. 6.9. Since |G(v1 )| = 1, we attach to the node v1 the fault ρ2 corresponding to the function in G(v1 ). For v0 , we remove the first tuple 01 from T (v0 ) and we attach it to the node v0 . We add two nodes v00 and v01 and we draw edges from v0 to v00 and v01 labeled with 0 and 1, respectively. For v00 , d(v00 ) = d(v0 ) − 1, G(v00 ) contains all fault functions within G(v0 ) that give an output of 0 with the input tuple 01 and T (v00 ) = T (G(v00 ), d(v00 )). For v01 , d(v01 ) = d(v0 ) − 1, G(v01 ) contains all fault functions within G(v0 ) that give an output of 1 with the input tuple 01 and T (v01 ) = T (G(v01 ), d(v01 )). The obtained tree is depicted in Fig. 6.10.
6.2 Iteration-Free Switching Networks
107
Fig. 6.9 Steps of bounded depth algorithm
Fig. 6.10 Steps of bounded depth algorithm
Fig. 6.11 A decision tree with the minimum depth for diagnosis {0, 1}-faults for S12 constructed by bounded depth algorithm
By repeating the same sequence of steps for nodes v00 and v01 , the tree depicted in Fig. 6.11 will be constructed with depth of tree not exceeding the set threshold t = 3. Since the depth of this tree equals to the value obtained by Lemma 6.2, one can say that this tree solves the problem of diagnosis of {0, 1}-faults for S12 and has the minimum depth. The obtained results are shown in Tables 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 6.9 and 6.10. These tables contain, for each nontrivial indecomposable network S with at most 10 edges (the list of these networks was published by Kuznetsov in [8]),
108
6 Diagnosis of Constant Faults in Switching Networks
Table 6.2 Results for networks with 2, 5, and 7 edges
Network S
h{0,1} (S) h{0} (S) h{1} (S)
S12
3
2
1
S22
3
1
2
S15
7
4
4
S17
9
5
5
S27
9
5
5
• The name of the network S in the form S ij , where i is the number of edges in the network and j is the index of the network in the list of networks with i edges. • Graphical representation of the network S in which two empty circles are the poles and the filled circles are usual nodes of the network. • The values h {0,1} (S), h {0} (S), and h {1} (S). When we consider values h {0,1} (S), h {0} (S), and h {1} (S), we assume that the edges of the network S are labeled with pairwise different variables. Using these results, we can obtain a number of corollaries. For i = 2, 5, 7, 8, 9, 10, we denote by B(i) the set of all indecomposable networks with i edges. For C ∈ {{0, 1}, {0}, {1}} and i = 2, 5, 7, 8, 9, 10, the value tC (B(i)) can be found in Table 6.11 at the intersection of the row C and the column i.
6.2 Iteration-Free Switching Networks
109
Table 6.3 Results for networks with 8 and 9 edges
Network S
h{0,1} (S) h{0} (S) h{1} (S)
S18
10
7
6
S28
10
7
5
S38
10
5
7
S48
10
6
7
S58
10
6
7
S19
11
7
7
S29
11
6
7
110
6 Diagnosis of Constant Faults in Switching Networks
Table 6.4 Results for networks with 9 edges
Network S
h{0,1} (S) h{0} (S) h{1} (S)
S39
11
7
7
S49
11
7
7
S59
11
7
7
S69
11
7
7
S79
11
7
6
S89
11
7
7
S99
12
8
6
6.2 Iteration-Free Switching Networks
111
Table 6.5 Results for networks with 9 and 10 edges
Network S
h{0,1} (S) h{0} (S) h{1} (S)
9 S10
12
7
7
9 S11
12
7
7
9 S12
12
7
7
S110
13
8
7
S210
13
8
7
S310
13
8
7
S410
13
8
7
112
6 Diagnosis of Constant Faults in Switching Networks
Table 6.6 Results for networks with 10 edges
Network S
h{0,1} (S) h{0} (S) h{1} (S)
S510
13
8
7
S610
13
8
7
S710
13
8
7
S810
13
8
7
S910
13
8
7
10 S10
13
8
7
10 S11
13
8
7
6.2 Iteration-Free Switching Networks
113
Table 6.7 Results for networks with 10 edges
Network S
h{0,1} (S) h{0} (S) h{1} (S)
10 S12
13
7
8
10 S13
13
7
8
10 S14
13
7
8
10 S15
13
7
8
10 S16
13
7
8
10 S17
13
7
8
10 S18
13
7
8
114
6 Diagnosis of Constant Faults in Switching Networks
Table 6.8 Results for networks with 10 edges
Network S
h{0,1} (S) h{0} (S) h{1} (S)
10 S19
13
7
8
10 S20
13
7
8
10 S21
13
7
8
10 S22
13
7
8
10 S23
13
8
7
10 S24
13
8
7
10 S25
13
8
7
6.2 Iteration-Free Switching Networks
115
Table 6.9 Results for networks with 10 edges
Network S
h{0,1} (S) h{0} (S) h{1} (S)
10 S26
13
8
7
10 S27
13
8
7
10 S28
13
8
7
10 S29
13
8
7
10 S30
13
7
8
10 S31
13
7
8
10 S32
13
7
8
116
6 Diagnosis of Constant Faults in Switching Networks
Table 6.10 Results for networks with 10 edges
h{0,1} (S) h{0} (S) h{1} (S)
Network S
10 S33
13
7
8
10 S34
13
7
8
Table 6.11 Values of tC (B(i)) for C ∈ {{0, 1}, {0}, {1}} and i = 2, 5, 7, 8, 9, 10 C\i 2 5 7 8 9 {0,1} {0} {1}
3 2 2
1.75 1 1
1.5 ≈ 0.83 ≈ 0.83
≈ 1.43 1 1
1.5 1 ≈ 0.88
10 ≈ 1.44 ≈ 0.89 ≈ 0.89
References 1. AbouEisha, H., Amin, T., Chikalov, I., Hussain, S., Moshkov, M.: Extensions of Dynamic Programming for Combinatorial Optimization and Data Mining, Intelligent Systems Reference Library, vol. 146. Springer (2019) 2. Alkhalid, A., Amin, T., Chikalov, I., Hussain, S., Moshkov, M., Zielosko, B.: Optimization and analysis of decision trees and rules: dynamic programming approach. Int. J. Gen. Syst. 42(6), 614–634 (2013) 3. Alkhalid, A., Chikalov, I., Moshkov, M.: Comparison of greedy algorithms for decision tree optimization. In: Skowron, A., Suraj, Z. (eds.), Rough Sets and Intelligent Systems - Professor Zdzisław Pawlak in Memoriam - Volume 2. Intelligent Systems Reference Library, vol. 43, pp. 21–40. Springer (2013) 4. Busbait, M., Chikalov, I., Hussain, S., Moshkov, M.: Diagnosis of constant faults in read-once contact networks over finite bases. Discret. Appl. Math. 184, 76–88 (2015) 5. Busbait, M., Moshkov, M.: Diagnosis of three types of constant faults in read-once contact networks over finite bases. Theor. Comput. Sci. 630, 26–42 (2016) 6. Garey, M.R.: Optimal binary identification procedures. SIAM J. Appl. Math. 23(2), 173–186 (1972) 7. Goduhina, G.B.: Experimental study of conditional tests for diagnosis of constant faults in iteration-free contact networks. In: Combinatorial-Algebraic and Probabilistic Methods in Applied Mathematics, pp. 16–21. Gorky University Publishers, Gorky (1988). (in Russian) 8. Kuznetsov, A.V.: Non-repeating contact schemes and non-repeating superpositions of functions of algebra of logic. Trudy MIAN SSSR 51, 186–225 (1958). (in Russian)
References
117
9. Madatyan, K.A.: Complete test for repetition-free contact circuits. In: Probl. Kibern., vol. 23, pp. 103–118. Nauka Publishers, Moscow (1970). (in Russian) 10. Moshkov, M.: Time complexity of decision trees. In: Peters, J.F., Skowron, A. (eds.), Trans. Rough Sets III. Lecture Notes in Computer Science, vol. 3400, pp. 244–459. Springer (2005) 11. Moshkov, M.: Diagnosis of constant faults in switching networks. arXiv:2302.02756 [cs.CC] (2023) 12. Moshkov, M., Chikalov, I.: On algorithm for constructing of decision trees with minimal depth. Fund. Inf. 41(3), 295–299 (2000) 13. Quinlan, J.R.: Induction of decision trees. Mach. Learn. 1(1), 81–106 (1986) 14. Shannon, C.E.: A symbolic analysis of relay and switching circuits. Trans. Am. Inst. Electr. Eng. 57(12), 713–723 (1938)
Appendix A
Closed Classes of Boolean Functions
The structure of all classes of Boolean functions closed relatively the operation of substitution has been described by Post in [2, 3]. In [4], Yablonskii, Gavrilov, and Kudriavtzev considered the structure of all classes of Boolean functions closed relatively the operation of substitution and the operations of insertion and deletion of unessential variable. Appendix contains the description of this structure which is slightly different from the Post structure. It is based on a similar text from [1]. Some Definitions and Notation A function f (x1 , . . . , xn ) with variables defined on the set E 2 = {0, 1} and with values from E 2 will be called a Boolean function. The constants 0 and 1 are also Boolean functions. Let U be a set of Boolean functions, f (x1 , . . . , xn ) be a function from U , and gi be either function from U or variable, i = 1, . . . , n. We will say that the function f (g1 , . . . , gn ) is obtained from functions from U by operation of substitution. Let f (x1 , . . . , xn ) be a Boolean function. A variable xi of the function f will be called essential if there exist two n-tuples δ˜ and σ˜ from E 2n , which differ only in the ith ˜ = f (σ˜ ). Variables of the function f , which are not essential digit and for which f (δ) will be called unessential. The number of essential variables of the function f will be called its order and will be denoted k( f ). Let x j be an unessential variable of the function f and g(x1 , . . . , x j−1 , x j+1 , . . . , xn ) = f (x1 , . . . , x j−1 , 0, x j+1 , . . . , xn ). We will say that the function g is obtained from f by operation of deletion of unessential variable. We will say that the function f is obtained from g by operation of insertion of unessential variable. Let U be a nonempty set of Boolean functions. We denote by [U ] the closure of the set U relatively the operation of substitution and the operations of insertion and deletion of unessential variable. The set U will be called a closed class if U = [U ].
© The Editor(s) (if applicable) and The Author(s), under exclusive license to Springer Nature Switzerland AG 2023 M. Busbait et al., Decision Trees for Fault Diagnosis in Circuits and Switching Networks, Studies in Systems, Decision and Control 493, https://doi.org/10.1007/978-3-031-39031-9
119
120
Appendix A: Closed Classes of Boolean Functions
A finite set B of Boolean functions will be called a basis of the closed class U if U = [B]. The basis B of the closed class U will be called minimal if U = [B ] for each proper subset B of the set B. The order of the basis B is the maximum order of a function from B. It will be denoted by k(B). The order of the closed class U is the minimum order of its basis. It will be denoted by k(U ). The value of the parameter k(U ) will not change if, instead of arbitrary bases, only minimal ones are considered. The notion of a formula over a set of Boolean functions U will be defined inductively in the following way: (a) The expression f (x1 , . . . , xn ), where f (x1 , . . . , xn ) is a function from U , is a formula over U . (b) Let f (x1 , . . . , xn ) be a function from U and ϕ1 , . . . , ϕn be expressions which are either formulas over U or variables. Then the expression f (ϕ1 , . . . , ϕn ) is a formula over U . A Boolean function corresponds in natural way to any formula over U . We will say that the formula implements this Boolean function. Denote by [U ]1 the closure of the set U relatively the operation of substitution. One can show that [U ]1 coincides with the set of functions implemented by formulas over U . Denote by [U ]2 the closure of the set [U ]1 relatively operations of insertion and deletion of unessential variable. One can show that [U ] = [U ]2 . The operation of negation will be denoted by the symbol ¬. Instead of ¬x, we will write sometimes x. ¯ Denote x 0 = ¬x and x 1 = x. Instead of x ∧ y, we will write sometimes x · y or even x y. Let n be a natural number and t ∈ E 2 . Denote by t˜n the n-tuple from E 2n all the digits of which are equal to t. Let f be a Boolean function depending on n variables. The function f will be called α-function if f (t˜n ) = t for any t ∈ E 2 , β-function if f (t˜n ) = 1 for any t ∈ E 2 , and γ -function if f (t˜n ) = 0 for any t ∈ E 2 . A function f will be called a linear function if f = c0 + c1 x1 + . . . + cn xn (mod 2), where ci ∈ E 2 , 0 ≤ i ≤ n. A function f will be called a self-dual function if f (x1 , . . . , xn ) = ¬ f (¬x1 , . . . , ¬xn ). A function f will be called a monotone function if, for any n-tuples δ˜ = (δ1 , . . . , δn ) and σ˜ = (σ1 , . . . , σn ) from E 2n such ˜ ≤ f (σ˜ ) holds. that δi ≤ σi , 1 ≤ i ≤ n, the inequality f (δ) Let μ be an integer and μ ≥ 2. We will say that a function f (x1 , . . . , xn ) satisfies the condition a μ if, for any μ tuples from E 2n on which f has the value 0, there exists a number j ∈ {1, . . . , n} such that in each of the considered tuples the jth digit is equal to 0. We will say that the function f satisfies the condition a ∞ if there exists a number j ∈ {1, . . . , n} such that, in any n-tuple from E 2n on which f has the value 0, the jth digit is equal to 0. We will say that the function f satisfies the condition Aμ if, for any μ tuples from E 2n on which f has the value 1, there exists a number j ∈ {1, . . . , n} such that in each of the considered tuples the jth digit is equal to 1. We will say that a function f satisfies the condition A∞ if there exists a number j ∈ {1, . . . , n} such that, in any n-tuple from E 2n on which f has the value 1, the jth digit is equal to 1. The constant 1, by definition, satisfies the condition
Appendix A: Closed Classes of Boolean Functions
121
a ∞ and does not satisfy the condition A2 . The constant 0, by definition, satisfies the condition A∞ and does not satisfy the condition a 2 . Let μ be an integer and μ ≥ 2. Denote hμ =
μ+1
(x1 ∧ x2 ∧ . . . ∧ xi−1 ∧ xi+1 ∧ . . . ∧ xμ+1 )
i=1
and h ∗μ
=
μ+1
(x1 ∨ x2 ∨ . . . ∨ xi−1 ∨ xi+1 ∨ . . . ∨ xμ+1 ) .
i=1
Description of All Closed Classes of Boolean Functions In this section, all closed classes of Boolean functions are listed. For each class, its Post notation, its minimal basis with the minimum order, its order, and the description of functions contained in the considered class are presented. As in [4], two Boolean functions are called equal if one of them can be obtained from the other by operations of insertion and deletion of unessential variable. The inclusion diagram for closed classes of Boolean functions [4] is depicted in Fig. A.1. Two points in this diagram corresponding to certain classes U and V are connected by an edge if the class V is immediately included into the class U (there are no intermediate classes between U and V ). The point corresponding to the class U is placed at that above the point corresponding to the class V . 1. The class O1 = [{x}] with k(O1 ) = 1. This class consists of all functions equal to the function x, and all functions obtained from them by renaming of variables without identification. 2. The class O2 = [{1}] with k(O2 ) = 0. This class consists of all functions equal to the function 1. 3. The class O3 = [{0}] with k(O3 ) = 0. This class consists of all functions equal to the function 0. 4. The class O4 = [{¬x}] with k(O4 ) = 1. This class consists of all functions equal to functions x or ¬x, and all functions obtained from them by renaming of variables without identification. 5. The class O5 = [{x, 1}] with k(O5 ) = 1. This class consists of all functions equal to functions 1 or x, and all functions obtained from them by renaming of variables without identification. 6. The class O6 = [{x, 0}] with k(O6 ) = 1. This class consists of all functions equal to functions 0 or x, and all functions obtained from them by renaming of variables without identification. 7. The class O7 = [{0, 1}] with k(O7 ) = 0. This class consists of all functions equal to functions 0 or 1.
122
Appendix A: Closed Classes of Boolean Functions
Fig. A.1 Inclusion diagram for closed classes of Boolean functions [4]
Appendix A: Closed Classes of Boolean Functions
123
8. The class O8 = [{x, 0, 1}] with k(O8 ) = 1. This class consists of all functions equal to functions 0, 1 or x, and all functions obtained from them by renaming of variables without identification. 9. The class O9 = [{¬x, 0}] with k(O9 ) = 1. This class consists of all functions equal to functions 0, 1, ¬x, or x, and all functions obtained from them by renaming of variables without identification. 10. The class S1 = [{x ∨ y}] nwith k(S1 ) = 2. This class consists of all disjunctions xi , n = 1, 2, . . ., and all functions obtained from (that is functions of the kind i=1 them by renaming of variables without identification). 11. The class S3 = [{x ∨ y, 1}] with k(S3 ) = 2. This class consists of all disjunctions and all functions equal to 1. 12. The class S5 = [{x ∨ y, 0}] with k(S5 ) = 2. This class consists of all disjunctions and all functions equal to 0. 13. The class S6 = [{x ∨ y, 0, 1}] with k(S6 ) = 2. This class consists of all disjunctions, and all functions equal to functions 0 or 1. 14. The class P1 = [{x ∧ y}] with n k(P1 ) = 2. This class consists of all conjuncxi , n = 1, 2, . . ., and all functions obtained tions (that is functions of the kind i=1 from them by renaming of variables without identification). 15. The class P3 = [{x ∧ y, 0}] with k(P3 ) = 2. This class consists of all conjunctions, and all functions equal to 0. 16. The class P5 = [{x ∧ y, 1}] with k(P5 ) = 2. This class consists of all conjunctions, and all functions equal to 1. 17. The class P6 = [{x ∧ y, 0, 1}] with k(P6 ) = 2. This class consists of all conjunctions, and all functions equal to 0 or 1. 18. The class L 1 = [{x + y(mod 2), 1}] with k(L 1 ) = 2. This class consists of all linear functions. 19. The class L 2 = [{x + y + 1(mod 2)}] with k(L 2 ) = 2. This class consists of all linear α-functions and β-functions (that is functions of the kind 2k i=1
xi + 1(mod 2),
2l+1
xi (mod 2), k, l = 0, 1, 2, . . . ,
i=1
and all functions obtained from them by renaming of variables without identification). 20. The class L 3 = [{x + y(mod 2)}] with k(L 3 ) = 2. This class consists of all linear α-functions and γ -functions (that is the functions of the kind li=1 xi (mod 2), l = 0, 1, 2, . . ., and all functions obtained from them by renaming of variables without identification). k(L 4 ) = 3. This class consists of 21. The class L 4 = [{x + y + z(mod 2)}] with 2l+1 xi (mod 2), l = 0, 1, 2, . . ., all linear α-functions (that is functions of the kind i=1 and all functions obtained from them by renaming of variables without identification). 22. The class L 5 = [{x + y + z + 1(mod 2)}] with k(L 5 ) = 3. This class consists of all linear self-dual functions (functions of the kind
124
Appendix A: Closed Classes of Boolean Functions 2l+1 i=1
xi + 1(mod 2),
2l+1
xi (mod 2), l = 0, 1, 2, . . . ,
i=1
and all functions obtained from them by renaming of variables without identification). 23. The class D2 = [{(x ∧ y) ∨ (x ∧ z) ∨ (y ∧ z)}] with k(D2 ) = 3. This class consists of all self-dual monotone functions. 24. The class D1 = [{(x ∧ y) ∨ (x ∧ ¬z) ∨ (y ∧ ¬z)}] with k(D1 ) = 3. This class consists of all self-dual α-functions. 25. The class D3 = [{(x ∧ ¬y) ∨ (x ∧ ¬z) ∨ (¬y ∧ ¬z)}] with k(D3 ) = 3. This class consists of all self-dual functions. 26. The class A1 = M1 = [{x ∧ y, x ∨ y, 0, 1}] with k(A1 ) = k(M1 ) = 2. This class consists of all monotone functions. 27. The class A2 = M2 = [{x ∧ y, x ∨ y, 1}] with k(A2 ) = k(M2 ) = 2. This class consists of all monotone α-functions and β-functions. 28. The class A3 = M3 = [{x ∧ y, x ∨ y, 0}] with k(A3 ) = k(M3 ) = 2. This class consists of all monotone α-functions and γ -functions. 29. The class A4 = M4 = [{x ∧ y, x ∨ y}] with k(A4 ) = k(M4 ) = 2. This class consists of all monotone α-functions. 30. The class C1 = [{¬x ∨ ¬y}] with k(C1 ) = 2. This class consists of all Boolean functions. 31. The class C2 = [{x ∨ y, x + y + 1(mod 2)}] with k(C2 ) = 2. This class consists of all α-functions and β-functions. 32. The class C3 = [{x ∧ y, x + y(mod 2)}] with k(C3 ) = 2. This class consists of all α-functions and γ -functions. 33. The class C4 = [{x ∨ y, x ∧ (y + z + 1(mod 2))}] with k(C4 ) = 3. This class consists of all α-functions. μ μ 34. The class F1 = [{x ∨ (y ∧ ¬z), h ∗μ }] with k(F1 ) = μ + 1, μ = 2, 3, . . .. This class consists of all α-functions satisfying the condition a μ . 35. The class F2μ with k(F2μ ) = μ + 1, μ = 2, 3, . . ., where F2μ = [{x ∨ (y ∧ μ z), h ∗2 }] if μ = 2, and F2 = [{h ∗μ }] if μ ≥ 3. This class consists of all monotone α-functions satisfying the condition a μ . 36. The class F3μ = [{1, h ∗μ }] with k(F3μ ) = μ + 1, μ = 2, 3, . . .. This class consists of all monotone functions satisfying the condition a μ . μ μ 37. The class F4 = [{x ∨ ¬y, h ∗μ }] with k(F4 ) = μ + 1, μ = 2, 3, . . .. This class consists of all functions satisfying the condition a μ . μ μ 38. The class F5 = [{x ∧ (y ∨ ¬z), h μ }] with k(F5 ) = μ + 1, μ = 2, 3, . . .. This class consists of all α-functions satisfying the condition Aμ . μ μ μ 39. The class F6 with k(F6 ) = μ + 1, μ = 2, 3, . . . , where F6 = [{x ∧ (y ∨ μ z), h 2 }] if μ = 2, and F6 = [{h μ }] if μ ≥ 3. This class consists of all monotone α-functions satisfying the condition Aμ . μ μ 40. The class F7 = [{0, h μ }] with k(F7 ) = μ + 1, μ = 2, 3, . . .. This class consists of all monotone functions satisfying the condition Aμ . 41. The class F8μ = [{x ∧ ¬y, h μ }] with k(F8μ ) = μ + 1, μ = 2, 3, . . .. This class consists of all functions satisfying the condition Aμ .
Appendix A: Closed Classes of Boolean Functions
125
42. The class F1∞ = [{x ∨ (y ∧ ¬z)}] with k(F1∞ ) = 3. This class consists of all α-functions satisfying the condition a ∞ . 43. The class F2∞ = [{x ∨ (y ∧ z)}] with k(F2∞ ) = 3. This class consists of all monotone α-functions satisfying the condition a ∞ . 44. The class F3∞ = [{1, x ∨ (y ∧ z)}] with k(F3∞ ) = 3. This class consists of all monotone functions satisfying the condition a ∞ . 45. The class F4∞ = [{x ∨ ¬y}] with k(F4∞ ) = 2. This class consists of all functions satisfying the condition a ∞ . 46. The class F5∞ = [{x ∧ (y ∨ ¬z)}] with k(F5∞ ) = 3. This class consists of all α-functions satisfying the condition A∞ . 47. The class F6∞ = [{x ∧ (y ∨ z)}] with k(F6∞ ) = 3. This class consists of all monotone α-functions satisfying the condition A∞ . 48. The class F7∞ = [{0, x ∧ (y ∨ z)}] with k(F7∞ ) = 3. This class consists of all monotone functions satisfying the condition A∞ . 49. The class F8∞ = [{x ∧ ¬y}] with k(F8∞ ) = 2. This class consists of all functions satisfying the condition A∞ .
References 1. Moshkov, M.: Time complexity of decision trees. In: Peters, J.F., Skowron, A. (eds.) Trans. Rough Sets III. Lecture Notes in Computer Science, vol. 3400, pp. 244–459. Springer (2005) 2. Post, E.: Introduction to a general theory of elementary propositions. Amer. J. Math. 43, 163–185 (1921) 3. Post, E.: Two-valued Iterative Systems of Mathematical Logic. Annals of Mathematics Studies, vol. 5. Princeton University Press, Princeton (1941) 4. Yablonskii, S.V., Gavrilov, G.P., Kudriavtzev, V.B.: Functions of the Algebra of Logic and Post Classes. Nauka Publishers, Moscow (1966). (in Russian)
Final Remarks
In this book, we studied decision trees for diagnosis of faults in circuits in arbitrary bases and in switching networks. For circuits, we considered faults consisting in replacing arbitrary number of functions assigned to gates by some other Boolean functions, in particular, we investigated constant 0 and 1 faults at the inputs of gates. We also studied faults consisting in embedding arbitrary number of new gates implementing Boolean functions from a finite fault basis P into the circuit. For switching networks, we considered three types of constant faults. We carried out research in six main directions: • We studied how the minimum depth of diagnostic decision trees for arbitrary schemes (circuits or switching networks) depends on their complexity in the worst case. • We investigated the depth of diagnostic decision trees for the best (from the point of view of solving the problem of diagnosing) schemes that implement Boolean functions specified either by formulas or switching networks. • We studied the complexity of algorithms for construction of decision trees solving the problem of fault diagnosis for a given scheme and a given set of faults. • We studied how the minimum depth of diagnostic decision trees for arbitrary iteration-free schemes depends on their complexity in the worst case. • We proposed an approach to the construction of schemes with two modes of operation and effective diagnostics of faults based on the results obtained for iteration-free schemes. • We considered cases, where the minimum depth of decision trees for diagnosis of iteration-free circuits is bounded from above by a linear function cL(S) depending on the number of gates L(S) and studied for closed classes bases with the minimum coefficient c in this function.
© The Editor(s) (if applicable) and The Author(s), under exclusive license to Springer Nature Switzerland AG 2023 M. Busbait et al., Decision Trees for Fault Diagnosis in Circuits and Switching Networks, Studies in Systems, Decision and Control 493, https://doi.org/10.1007/978-3-031-39031-9
127
128
Final Remarks
In the future, it would be interesting to extend some of the obtained results to the case of nondeterministic branching programs, i.e., directed graphs with two specified nodes (source and target) in which each edge is either unlabeled or is labeled with a literal.
Index
A Algorithm bounded depth algorithm, 104 dynamic programming algorithm, 103 first greedy algorithm, 104 second greedy algorithm, 104 Algorithmic problem Con(B)—construction of decision trees for circuits, 24 Con(C)—construction of decision trees for switching networks, 94
B Basis, 16 correctly generating closed class, 76 degenerate, 24 linear, 56 of closed class, 120 minimal, 120 optimal for complete class of linear faults, 65 for complete class of retaining faults, 76 for complete class of unate faults, 65 for constant faults at gate inputs, 35 primitive, 19 quasiprimitive, 27 unate, 56 Basis for networks, 99 Boolean function, 119 α-function, 120 β-function, 120 γ -function, 120
h ∗μ , 121 h μ , 121 condition A∞ , 120 Aμ , 120 a ∞ , 120 a μ , 120 linear, 120 monotone, 120 negation, 120 self-dual, 120 simmetric, 91 subfunction, 36 unate, 27 spectrum, 56
C Circuit, 16 degenerate, 17 formula-like, 34 gate, 16 input of gate, 17 input, 16 iteration-free, 27 nondegenerate, 17 output, 16 Closed class of Boolean functions, 119
D Decision tree, 18 complete path, 18 depth, 18
© The Editor(s) (if applicable) and The Author(s), under exclusive license to Springer Nature Switzerland AG 2023 M. Busbait et al., Decision Trees for Fault Diagnosis in Circuits and Switching Networks, Studies in Systems, Decision and Control 493, https://doi.org/10.1007/978-3-031-39031-9
129
130 for diagnosis of circuit, 18, 45, 55, 73 of network, 97 of switching network, 90 working node, 18 Diagnostic test, 89 F Fault basis, 44 Faults for circuits class of linear faults, 57 complete, 57 class of retaining faults, 73 complete, 73 essential, 73 proper, 82 class of unate faults, 57 complete, 56 constant faults at inputs of gates, 17 embedding faults, 45 extended class of constant faults, 55 maximum extended class of constant faults for linear basis, 64 for unate basis, 65 Faults for networks {0, 1}-faults, 97 {0}-faults, 97 {1}-faults, 97 normal, 97, 98 Faults for switching networks {0, 1}-faults, 90 {0}-faults, 90 {1}-faults, 90 Formula over a set of Boolean functions, 120 N Network, 97
Index decomposable, 98 indecomposable, 98 over basis, 99 poles, 97 simple path between poles, 97 trivial, 97
O Operation deletion of unessential variable, 119 insertion of unessential variable, 119 substitution, 119 Order of basis, 120 of closed class, 120 of function, 119
P Problem of diagnosis for circuits, 17, 45, 55, 73 for networks, 97 for switching networks, 90
S Switching network, 89 input variable, 90 literal, 89 poles, 89 simple path between poles, 90
V Variable essential, 119 unessential, 119