The ogic of Booean matrices C. R. Edwards Schoo of Eectrica Engineering, Universit of Bath, Caverton Down, Bath BA2 7AY A Booean matrix agebra is described which enabes man ogica functions to be manipuated simutaneous. The agebra is simiar to conventiona matrix agebra and its structure incudes a topoogica description of ogic circuits. The matrices are readi manipuated b the digita computer. (Received December 97) The tpe of Booean matrices considered here were first deveoped b J. O. Campeau in the ate 95s. To the author's knowedge itte has been pubished in this fied recent but we ma ook forward to a reappraisa of this topic as it enabes ogic anasis and snthesis to be carried out with reative ease, especia with the aid of a digita computer. The manipuation of Booean matrices is simiar to that of conventiona matrices so that ogic design engineers wi have itte difficut in appreciating its advantages over more usua methods and empoing it as a usefu too. It is not the purpose of this artice to submit a series of rigorous mathematica proofs, for these the ist of references shoud be consuted, but to give the reader a good working knowedge of this rather fascinating branch of appied mathematics.. Basic concepts We require that Booean functions ma be expressed in a matrix agebra simiar to that of conventiona matrix agebra, viz. COEFFICIENTS (Defining the function(s)) INPUT VARIABLES REQUIRED FUNCTION(S) It wi be recaed that in 'conventiona' matrix agebra the coefficients are arranged in a particuar order so that under mutipication the correct coefficient is associated with a particuar variabe, e.g. [-: gives 3x + 2 P -4x + Q This is aso true of Booean matrix agebra, the coefficients being those, in order, of the chosen 'canonica' form. Since there are man different canonica forms, each of which ma be used to describe a particuar function, it is necessar to 'standardise' this form and thereafter not deviate from it. The choice of the canonica form is made, not as it ma appear for aesthetic reasons, but to enabe a straightforward 'unit' matrix to be deveoped ater. An equation of canonic form as used here consists of 2" terms, where n is the number of input variabes. Each term contains a the variabes, compemented or uncompemented, and a constant ( or ); no two terms are the same. B choosing particuar vaues for the constants, in () beow for exampe, the reader ma quick verif that an ogica function of x t and x 2 ma be defined. The two-variabe canonica form is: f{x u 2 ) (Ci. i.e. 'Sum of products' form. + C.. 2 + C3.i-.2 +, () Note that if the variabes x u x 2 are given the ogica vaue '\ the digits foowing each coefficient 'increase' b '' as the coefficient number increases, i.e. /(I, ) (C.O.O + C 2.. + C3.I.O + C 4..). A singe function in Booean matrix form is written as: [Ci c 2 c 3 cj fx x ] [T] cj rxi"! U2J For exampe, if T x 2 x t.x 2 + x,x 2, then in canonica form: T (.i.x 2 +.x,. x 2 + I..2 + O.^i. x 2 ) giving [ ] \xj [J] But there is no reason wh we shoud not write an number of functions in this wa: Given T x @ x. + x., Ux., V x + v then from we have as the reader ma verif. Three points to note here. First, the number of coumns appearing in the 'coefficient' part of the matrix equation is 2" where V is the number of variabes. Second, the number of rows appearing in the 'coefficient' matrix is equa to the number of functions. Third, the chosen canonica form, and order of terms must be rigid adhered to, otherwise incorrect resuts occur. The next probem to be overcome is the soution of a matrix equation of the form foowing. Suppose that we are given: If n nmpi o oj [ij [T\ then what are the vaues of 5 and T This is, in effect, the 'mutipication' of a vector b a two-dimensiona matrix. In practica terms we require the soution to the equations S x, and T x. when x One method of doing this is to put x \, in the canonica Voume 5 Number 3 247 Downoaded from https://academic.oup.com/comjn/artice-abstract/5/3/247/48639 on 9 December 27
equation: f(x,) (c^.x. + c 2.x. + c 3.x. + c^.x.) fs(h (Ci.. + c 2.. + C3.I.O + C4.I.I) and entering the coefficients for function 'S': S f s (, ) (.. +.. +..+..) simiar T (.. +.. +.. +..) Then combining the two we write: [? o ] [!] [T] [] This is cear rather tedious and we require a faster method and one which is simiar to 'conventiona' matrix mutipication. Since the equations are in canonica form, the vaues of the variabes (x and sa) can on 'seect' one coefficient coumn from the coefficient matrix as the answer. In the exampe above, <c 4 was 'seected' b the vaues x, and the answer "was given b coumn 4 of the coefficient matrix. If in the above exampe we put x,, the required soution ies in coumn of the coefficient matrix; if x, coumn 3 gives the soution, etc. Therefore, if we write beow the coefficient matrix the vaues of the input variabes so that the answer is direct given b the coefficients above them, the 'mutipication' can be performed b inspection, e.g. Whence: r i o o i i m \s] [ oj LiJ [T\ [ I]- Lo IJ [oj - (additiona identifing matrix) Moreover, and perhaps surprising, we have 'soved' for two Booean equations simutaneous. The matrix which we write beow the coefficient matrix is termed the 'unit' or 'identit' matrix. It has the same properties as the unit matrix in conventiona matrix agebra, i.e. the mutipication of an other vector (or matrix) b the unit matrix eaves that vector (or matrix) unchanged. It is aso a re-definition of the canonica form discussed above. For convenience we wi define the unit matrix [^4]UNIT as being a binar progession from eft to right and then we can awas derive the respective canonica form from it, e.g. for two input variabes, MUNIT [ [ ij In 'shorthand' we ma 'decode' each coumn of the unit matrix to give a 'decima' form, name: [^']UNIT [ 2 3 ] Then for three variabes we can write the unit matrix direct as [^'DUNIT [ 2 3 4 5 6 7 ], or LA ] UNIT [ [o i o i o i o i If the variabes are sa x _z then the canonica form is f(x,,z) fa.x..z + c 2.x..z + c 3.x..z + c 4.x..z c 5.x..z + c 6.x..z + c n.x..z + c s.x..z) Exampe: Evauate st U simutaneous for x Writing the truth tabe we have immediate: x + x..z + x..z, i,z ] in canonica form: z S T U which gives: UNIT f k Mathematica treatment of the above Let U represent union over a fied, f represent intersection over a fied and n represent intersection. Given the coefficient matrix [C], the identit matrix and the variabe vector ], then: /ic*i> x 2,... x n ) V "< D fa- 3 (2) Gives [C] ] /J For two input variabes x u x 2 we have, from (2): f (x,x 2 ) {c.(a.x + an.x,).(a 2.jc 2 + a 2.5c 2 ) + Ci2-(tfi2-*i + a 2.x ).(a 22.x 2 + a 22.x 2 ) Conversion of a matrix in binar form to 'decima' form: qj jt^'-'qv, Kj<2' (3) [q' is decima form). The identit matrix is chosen so that in its 'decima' form aj 7-, <<2" (4) 2. Booean matrix mutipication The method of mutiping two Booean matrices together is an extension of the method empoed above for the mutipication of a vector b a matrix. We wish to mutip two Booean matrices, sa: [B] [C] [Z>] we write the unit matrix direct under the pre-mutiping matrix: [C] ID] 248 The Computer Journa Downoaded from https://academic.oup.com/comjn/artice-abstract/5/3/247/48639 on 9 December 27
Suppose the first coumn of [C] matches the fourth coumn of [/4] UNIT then the first coumn of [Z>] is equa to the fourth coumn of [2?]. Again, suppose that the second coumn of [C] matches the second coumn of \A~] then the second coumn of [D] is equa to the second coumn of [2?]. We proceed in this fashion unti a the coumns of [C] (and thus [/)]) have been operated upon, e.g. [i [I UNIT o We ma carr out the same operation in 'decima' form: [2 3 3] [3 ] [3 2 ] [ 2 3]«D4] UNIT In genera it can be shown that [2?] [C] * [C] [2?], one exception is Note aso that the number of coumns appearing in each matrix must be equa to 2" where '«' is the number of variabes upon which the matrix is defined. This principe ma be extended to cover more than two matrices and the foowing can be shown to app: [2?] [C] [2>] {[2?] [C]} [2)] [2?] {[C] ID-]} 3. An interpretation of matrix mutipication Consider [5] [C] ] /,] where [i?] and [C] are two 'coefficient' matrices, ~\ is the variabe vector and /J is the resuting vector. If we first evauate [C] A'] we in fact mathematica describe a sstem of the form shown in Fig. \{a) where 'C represents a ogic circuit. The output [C] ~\ we wi ca ]', and is in fact a new variabe vector. We have reduced the initia equation to [it] x /,] which ma be interpreted as Fig. (6). Aternative, if we had first evauated [5][C] [ )] we woud have reduced Fig. (b) to a singe ogic bock Fig. (c)). Booean matrix mutipication therefore, can be regarded as a representation of cascaded ogic bocks. It shoud be noted that matrix mutipication is not imited to matrices of the same dimensions. Fig. \{d) shows the mutipication of matrices of differing dimensions, together with a cascaded bock representation. Exampe: It is required that the two ogic units shown in Fig. 2(a) shoud be cascaded as shown in Fig. 2(b). What are the functions appearing at the output? Given; truth tabes for ' ' and 'C: [c]x].x] Fig. (a) -I We have x b, x c b, c fx b f b fx c f c i i i oi [o i i oi j [ j [ o giving the resut: i o i [/4] unit Fig. (b) Fig. (c) Fig. Pxi- Paej- As a truth tabe: whence fx f /* (x- + x._ + x.) x + f (x. + x.) x@ The answer ma be checked b apping Booean agebra to each unit in turn, a rather tedious process which iustrates one of the advantages of Booean matrix mutipication. Mathematica treatment of mutipication [2?] [C] [D] ma be evauated as (see Fig. (d)) d rj u b m n{n (f ta -c v + s ta.g )}'! J r 5f; (5) m (.i J ^ 7 ^ /. In 'decima' form we write B{C{J} + } D{J} <7<2" (6) where.d{7} represents the number ing in the 7th coumn of egfor [2 3 ] [ 2 3] [2 3 ] Voume 5 Number 3 249 Downoaded from https://academic.oup.com/comjn/artice-abstract/5/3/247/48639 on 9 December 27
Pre- and post-mutipication is preserved, e.g. Given then [B] [C] [D] [C] [B]" [D] [B] [D] [C]" Exampe: In Fig. 2{b) suppose that the overa response of the sstem is given b [if] [C] Z] [Z>] JT] where ] represents the vector Fig. 2(b) B For the second coumn of D:D{2} B{C{2} + } B{2 + } 4. The inverse matrix We ma have a sstem given b [5] [C] [»] where [5] and Z>] are known and we wish to evauate [C]. In 'conventiona' matrix agebra we woud write [C] [?] - [Z>]. The question jiow arises, does [5]" exist and how do we find it? It can be shown that the inverse of a booean matrix exists if the matrix is 'non-singuar', that is if a coumns of the matrix are different, e.g. [ ] and [2 3 ] are non-singuar, [ j whereas I" C ] and [ 3 2] are singuar The inverse matrix is found from: Since [^4]UNIT ' S the ur >it matrix the expression is anaogous to n- B B' Note aso that since [/4] UNIT is non-singuar b definition, both [-B]" and [5] must be non-singuar. Given [/)] [232] and [2?] [3 2 ] find the truth tabe for [C]. Now [5] is non-singuar so its inverse exists. From [Z?]- [2?] M UNIT or [U]- [3 2 ] [ 2 3] we construct [i?] ~ x b inspection: [ 3 2 ] [3 2 ] [ 2 3] [ 2 3] Thence the matrix [C], given b [C] [Z?]- [Z>], is: [C] [ 3 2 ] [2 3 2] [2 3 2] [ ] L J The truth tabe for 'C is therefore: x fx e f c The resut shoud be checked b the reader. Mathematica treatment of the inverse matrix The inverse matrix is most convenient expressed b the decima notation (see (6)). [5] is non-singuar if B{J}^B{K} \^J<K^2" (7) Then with [5] non-singuar, [2?]- is given b B~ {B{J} + } 7 - </<2" (8) It can be shown that an agebra of singuar inverse matrices exists which enabes the generation and manipuation of functions with 'don't care' conditions. Unfortunate space wi not aow the incusion of this topic here. Px-«Pain- Fig. 3(«) c c» m c fctt- B ««C «B ^ c 25 The Computer Journa Downoaded from https://academic.oup.com/comjn/artice-abstract/5/3/247/48639 on 9 December 27
5. The 'powers' of matrices Consider Fig. 3(a) which represents a cascade of three identica ogic bocks. We can now evauate the response of this sstem as: [C] [C] [C] r\n, which is written in shorthand form as [C] 3 ] /]. Simiar, we ma evauate Fig. 3(6) as [5] [C] [5] [C] /] or EC]] 2 Note that in genera [[5] [C]] 2 # [5] 2 [C] 2. The author has found that certain non-singuar matrices obe an indices aw simiar to that of conventiona agebra and such matrices ma be used in snthesis of ogic arras. This, however, is beond the scope of this artice. When a probem invoves arge numbers of variabes or requires high 'powers' of matrices to be evauated, the use of a digita computer is cear essentia. 6. Further operations We ma require to anase the response of the sstem shown in Fig. 4(a), having a 'crossed' connection. One soution is to introduce a new modue 'A" containing a 'crossover' but what is the form of the matrix to do this? It is found that if we take the [A] UNT matrix (n 2) and interchange the ROWS corresponding to 'x' and '' the resut is the matrix required, e.g. in Fig. 4(6) The same resut can be obtained b deriving '' from a truth tabe but is ver tedious, especia when the number of variabes is high. The modification of the identit matrix in this wa provides an 'operator' which can be derived quick and easi as needs arise. A more compex exampe appears in Fig. 4(c). The concept of an operator is not imited to simpe 'crossovers' Fig. 4(rf) shows a more interesting probem. To derive '', the operator, we first take the D4]UNIT matrix and 'AND' its two rows together term b term; this becomes the row of '' corresponding to V. We then 'OR' the two rows of [/4] UNT ; this becomes the row of '' corresponding to ''. That is, from UNIT r i * [ we obtain [ 'x'th row o i i j 'th row In practice this method can be ver powerfu in the ogica manipuation of whoe functions. Mathematica it can be shown that if a matrix is mutipied b the identit matrix having its rows modified in a particuar fashion then the rows of the 'mutipicand' matrix undergo the same modification. More compex operators have been deveoped b the author to make possibe the anasis of circuits of the tpe shown in Fig. 5 in an number of dimensions. These operators, when raised to given powers, cce the inputs and outputs of the ogic ces so that the organisation of the arra is dupicated. Other operators have been deveoped which perturb the coumns of a given matrix. It can be shown that this is equivaent to the redefinition of the functions concerned in terms of combinations of the defining variabes, and as such is the first step in a snthesis procedure. 7. Computer impementation The operations described above are readi carried out b a digita computer without resort to specia programming techniques. A matrix of ten tenth order functions ma be represented b a vector of,24 ten-bit integers. The mutipication of two such matrices aows the manipuation of ten functions simu- B C Fig. 4(6) z \- -I f f f z Fig. 4(c) c Fig. 4(d) Voume 5 Number 3 25 Downoaded from https://academic.oup.com/comjn/artice-abstract/5/3/247/48639 on 9 December 27
Fig. 5 Tf-f! f<n+«'(n+)» to- tf T r.fx (n+i) ta n > - * 2. Evauate the operator [ Y] Take UNIT To o i ] Lo o j 'OR' the two rows, giving: as the upper row of 'AND' the two rows, giving: as the ower row of [ 7] 3. Evauate [A"], a third order sstem: L J Interchange top and bottom rows to give required crossover, whence: " f I]. 4. Mutip out the matrix equation in decima form to give answer: [23323] 2 3 4 5 6 7 [426537] 2 3 4 5 6 7 n [7 4 3 2 5] 3 n [ 2 2 2 3] 3 [2 2 3] taneous. Cacuations of this order, quite adequate for most practica purposes, ma be carried out on sma machines. Matrix mutipication is impemented b store interchanging, and extensive use is made of word comparison when setting up specia operators. Because both the matrices and operations are rigorous defined, fast and eegant routines resut. An exampe is now given which embodies most of the techniques deveoped in this artice. Exampe: Find the response of the sstem shown in Fig. 6. Given [ ] [o o i i i o o j ' o o o Soution. Write the matrix equation of the sstem putting in 'dumm' matrices for the inter-bock operators: [2>] [AT] [C] \_Y] fina ieding: [ 3 2] \ x Note that the mutipication of step 4 can be carried out coumn b coumn thus avoiding the tedious process of mutiping out compete each matrix in turn. The arrow shows the evauation of the second coumn of the answer. 5. Write truth tabe of this fina matrix: whence: x. 8. Concusion The main advantages of anasis (and snthesis) of sstems b Booean matrices of the tpe discussed is that the define a sstem's interconnections and ogic functions in a rigorous, formaised wa and are readi manipuated b the digita computer. Athough it has not been possibe to give a compete picture of a the operations possibe using these matrices, indeed this is sti the object of research, it is hoped that the reader wi find these basic concepts usefu and worth of empoment in the digita fied. fx f Fig. 6 252 The Computer Journa Downoaded from https://academic.oup.com/comjn/artice-abstract/5/3/247/48639 on 9 December 27
Acknowedgements The author woud ike to thank Dr. S. L. Hurst, Universit of Bath, for his invauabe advice. Prepared under Science Research Counci (UK) Grant B/7/295. References CAMPEAU, J. O. (955). The Snthesis and Anasis of Counters in Digita Sstems b Booean Matrices. Masters Thesis, Universit of Caifornia (June). CAMPEAU, J. O. (957). The Snthesis and Anasis of Digita Sstems b Booean Matrices, IRE Transactions on Eectronic Computers, Vo. EC-6, pp. 23-24. EDWARDS, C. R. (97). The Appication of Booean Matrices to Ceuar Logic. Interna communication, Universit of Bath (June). EDWARDS, C. R. (972). Some Booean Matrix Operators, Eectronics Letters, Vo. 8, No. 5, pp. 3-5. FLEGG, H. G. (964). Booean Agebra and its Appication, pp. 8-26. Backie. LEWIN, D. (968). Logica Design of Switching Circuits, pp. 3-35. Neson. Voume 5 Number 3 253 Downoaded from https://academic.oup.com/comjn/artice-abstract/5/3/247/48639 on 9 December 27