Discrete Applied Mathematics 135 (2004 41 54 www.elsevier.com/locate/dam Average time of computig Boolea operators A.V. Chashki 1 Faculty of Mechaics ad Mathematics, Moscow State Uiversity, Vorob evy Gory, Moscow 119899, Russia Abstract The average time of computig Boolea operators by straight-lie programs of two types is studied. Upper ad lower bouds for the correspodig Shao fuctios are obtaied. Asymptotically exact formulas for Shao fuctios are derived i the case whe the umber of compoets of the operators to be computed icreases with the umber of their argumets.? 2002 Elsevier B.V. All rights reserved. Keywords: Average time; Straight-lie programs with a coditioal stop; Boolea operator 1. Itroductio The average time of computig Boolea fuctios by straight-lie programs with a coditioal stop was studied i [1]. I this paper, we cosider two types of aalogous programs that compute Boolea operators. Ay rst-type straight-lie program with a coditioal stop is a sequece of operators of two types. Each operator of the rst type computes a Boolea fuctio. The argumets of that fuctio are the values computed by precedig operators or the values of some iput variables. Each operator of the secod type depeds o m + 1 variables, where m is the umber of program outputs, ad ca termiate the executio of the program. The result of a secod-type operator is determied by the values computed by the program at some m + 1 precedig steps. For each particular operator, the idices of these steps are xed ad may be dieret for dieret operators. If the last argumet of a secod-type operator equals uity, the the executio of the program termiates ad the values of its other argumets are declared to the values of the program o E-mail address: chash@olie.ru(a.v. Chashki. Traslated from Discrete Aalysis ad Operatios Research 5(1 (Novosibirsk, 1998 88 103. 1 Supported by the Russia Foudatio for Fudametal Research (Grat 96-01-01068. 0166-218X/$ - see frot matter? 2002 Elsevier B.V. All rights reserved. PII: S0166-218X(0200293-7
42 A.V. Chashki / Discrete Applied Mathematics 135 (2004 41 54 the tuple of variables uder cosideratio. If the last argumet of the operator is zero, the the ext operator of the program is executed. Straight-lie programs of the secod type with a coditioal stop dier from usual straight-lie programs by the followig: (i some rst-type operators ad, possibly, some iputs of the program are labeled by itegers from 0 to m; (ii a operator labeled by zero termiates the executio of the program if its value is equal to uity; (iii the ith value of the program after its termiatio is the value of its last executed operator (or its iput if such a operator is abset labeled by i. We d upper ad lower bouds o the Shao fuctios for the average time of computig Boolea operators by rst- ad secod-type programs. Asymptotically exact formulas are derived i the case whe the umber of compoets of the operators beig computed icreases with the umber of their argumets. 2. Basic deitios Below are formal deitios. Let B {f : {0; 1} k {0; 1}} be a basis i P 2, : {0; 1} m+1 {0; 1} m+1 be the idetity Boolea operator, ad X = {x 1 ;:::;x } be a set of idepedet variables. The rst-type straight-lie program with a coditioal stop is a sequece P = p 1 :::p i :::p s whose elemets are the operators p i =f i (p i;1 ;:::;p i;l, where p i;j {p 1 ; :::;p i 1 } X, f i B {}; moreover, if p i;j = p t {p 1 ;:::;p i 1 }, the f t. A operator p i is called a rst-type (or fuctioal operator if f i. A operator p i is called a secod-type (or stop operator if f i =. The program P is said to have iputs ad m outputs, ad the variable x i is said to be assiged to its ith iput. Put (p i =i, i.e., (p is the idex of the operator p i the program P. Let p i1 ;:::;p ir be all secod-type operators i P, i 1 i r. Deote by q t the tth secod-type operator i P ad by q t;j the jth argumet of this operator. The value of a operator p i P o a arbitrary biary tuple x is deed by iductio. We set p 1 (x=f 1 (x for the rst operator ad p i (x=f i (p i;1 (x;:::;p i;l (x for i 1. The result of P o x is deoted by P(x=(P 1 (x;:::;p m (x, ad its jth compoet is deed as P j (x=q 1;m+1 (xq 1;j (x q 1;m+1 (x(q 2;m+1 (xq 2;j (x q r 2;m+1 (x(q r 1;m+1 (xq r 1;j (x q r 1;m+1 (xq r;m+1 (xq r;j (x :::: Let B {f : {0; 1} k {0; 1}} be a basis i P 2 ad X = {x 1 ;:::;x } be a set of idepedet variables, each associated with a umber a i {0; 1;:::;m}. The secod-type straight-lie program with a coditioal stop is a sequece P = p 1 :::p i :::p s whose elemets are the operators p i =(f i (p i;1 ;:::;p i;l ;a i, where a i {0; 1;:::;m}, f i B, ad p i;j {p 1 ;:::;p i 1 } X. A operator p i is called a rst-type (or fuctioal operator if a i 0 ad a secod-type (or stop operator if a i = 0. The program P is said to have iputs ad m outputs, ad the variable x i is said to be assiged to its ith iput.
A.V. Chashki / Discrete Applied Mathematics 135 (2004 41 54 43 The value of a operator p of a secod-type program P o ay biary tuple x is deed i the same maer as for operators of rst-type programs. As before, let (p be the idex of p i P ad q t be the tth secod-type operator i P. Let q t;j deote a operator p i such that i = max s, where the maximum is over all s such that a s = j ad s (q t, uless such a operator is abset, i which case let q t;j deote the variable x r with a maximum idex r to which the umber j is assiged. The result of a secod-type program P o a tuple x is deoted by P(x=(P 1 (x;:::;p m (x, ad the value of its jth compoet is deed as P j (x=q 1 (xq 1;j (x q 1 (x(q 2 (xq 2;j (x q r 2 (x(q r 1 (xq r 1;j (x q r 1 (xq r (xq r;j (x :::: The executio time T P (x of a rst-type program P o a tuple of variables x is the miimum (q j such that q j;m+1 (x = 1, i.e., the umber of operators executed before the program termiates. The executio time T P (x of a secod-type program P o a tuple of variables x is the miimum (q j such that q j (x = 1. The quatity T(P=2 T P (x; where summatio is over all biary tuples of legth, is called the average executio time of P. If f(x =P(x for a Boolea operator f ad ay biary tuple x, the program P is said to compute the operator f. The quatity T B;i (f = mi T (P; where the miimum is over all programs of the ith type that compute f over the basis B, is called the average time of computig f. A program P computig f i the average time T (P=T B;i (f is called miimal. The umber of elemets of a Boolea circuit implemetig a operator f over a basis B is called the complexity of f ad is deoted by L B (f. The Shao fuctios T B;i (; m are deed i the stadard way as T B;i (; m = max T B;i (f; where the maximum is over all Boolea (; m-operators f : {0; 1} {0; 1} m. I what follows, we cosider a basis cosistig of all at most k-place Boolea fuctios, where k is a costat. The average time of computig f by programs of the ith type over this basis is deoted by T k;i (f, ad the correspodig Shao fuctios, by T k;i (; m. Suppose that the umber of argumets of each Boolea operator cosidered below is sucietly large ad the umber m of compoets of these operators satises m = O(1. Let c ad c i (i =1; 2;::: deote suitable costats ad log deote the logarithm to the base 2. The cocepts used without deitios ca be foud i [3]. 3. The mai results The mai results of this paper are bouds o Shao fuctios. They are give i Theorems 1 ad 2. The cases whe asymptotically exact formulas ca be derived
44 A.V. Chashki / Discrete Applied Mathematics 135 (2004 41 54 for Shao fuctios are formulated as cosequeces of these theorems. The upper bouds are proved by covetioal methods [3] used i Boolea circuits. The lower bouds are proved by a cardiality method (by comparig the umber of programs with the umber of Boolea operators. Set (m; k= { m m+k if k m+2; (m; m 2k 2 if k m +2; ( m k = mi 1; : 2k 2 Theorem 1. Let k be a costat ad m = O(1. The (m; k 2 (1 + o(1 6 T k;1(; m 6 (m; k 2 The lower boud follows from Lemmas 5 ad 6 proved below. The upper boud follows from Lemmas 8 ad 9. Theorem 2. Let k be a costat ad m = O(1. The 2 1 m k (1 + o(1 6 T k;2 (; m 6 2 1 (m +1 k The lower ad upper bouds i the theorem follow from Lemmas 7 ad 10, respectively. The ext assertios are easily deduced from Theorems 1 ad 2. Corollary 1. Let k be a costat ad k m +2. The T k;1 (; m= 2 1 m (k 1 Corollary 2. Let k be a costat; m ; ad m = O(1. The T k;1 (; m= 2 Corollary 3. Let k be a costat; m ; ad m = O(1. The T k;2 (; m= 2 1 m k 4. Bouds for the umber of programs A rst-type program P =p 1 :::p s is said to be termial if for ay i {1;:::;s} there exists a tuple x such that P(x P (x, where P =p 1 :::p i 1 p i+1 :::p s. A secod-type
A.V. Chashki / Discrete Applied Mathematics 135 (2004 41 54 45 program P is called reduced if the values computed by the stop operators are ot used as argumets of the other operators. Obviously, ay rst-type program ca be trasformed ito a termial program such that the average executio time of the ew program is at most that of the origial program. A aalogous statemet holds for secod-type programs: ay secod-type program ca be trasformed ito a reduced program such that its average executio time is at most the average executio time of the origial program. Ideed, suppose that a secod-type program has a stop operator whose value is a argumet of aother operator. If the value of the stop operator is zero, the it ca be replaced by a costat; but if its value equals uity, it ca be replaced by zero, because the operator termiates the program ad this value is owhere used. To each rst-type program P with m outputs ad with its iputs associated with variables x 1 ;:::;x, we assig a directed graph GP as follows: (i a vertex of GP is assiged to each variable x i ad to each operator p j of P; (ii the symbol x i is assiged to the vertex associated with the variable x i ; (iii the symbol f j is assiged to the vertex associated with the operator p j ; (iv vertices u i ad u j are coected by a arc directed from u i to u j if u j correspods to a operator p whose sth argumet is the operator associated with u i, 1 6 s 6 max(m +1;k; each such arc is assiged the symbol s; ad (v vertices u i ad u j are coected by a arc directed from u i to u j if they correspod to the lth ad (l + 1th stop operators of the program P; each such arc is assiged the symbol 0. To each secod-type program P with m outputs ad with its iputs associated with variables x 1 ;:::;x, we assig a directed graph GP as follows: (i a vertex of GP is assiged to each variable x i ad to each operator p j of the program P; (ii the symbol x i is assiged to the vertex associated with the variable x i ; (iii the symbol f j is assiged to the vertex associated with the operator p j ; (iv vertices u i ad u j are coected by a arc directed from u i to u j if u j correspods to the operator p whose sth argumet is the operator associated with u i,16s6k; each such arc is called fuctioal ad is assiged the symbol s; (v vertices u i ad u j are coected by a arc directed from u i to u j if u j correspods to the stop operator q t, the vertex u i correspods to q t;s, ad q t;s q r;s for all r t ad 1 6 s 6 m; each such arc is called specic ad is assiged the symbol s; ad (vi vertices u i ad u j are coected by a arc directed from u i to u j if they correspod to the lth ad (l + 1th stop operators of the program P; each such arc is called a stop arc ad is assiged the symbol 0. Programs P 1 ad P 2 are said to be isomorphic if their correspodig graphs are isomorphic. It is easy to see that ay program ca be restored, up to a isomorphism, from its correspodig graph. We itroduce the followig otatio: N 1 (k; ; m; L 1 ;L 2 is the umber of oisomorphic rst-type programs over the basis of all at most k-place Boolea fuctios cotaiig at most L 1 fuctioal operators ad at most L 2 stop operators with iputs ad m outputs;
46 A.V. Chashki / Discrete Applied Mathematics 135 (2004 41 54 N 1 (k; ; m; L is the umber of oisomorphic termial programs of the rst type over the basis of all at most k-place Boolea fuctios cotaiig at most L operators with iputs ad m outputs; N 2 (k; ; m; L 1 ;L 2 is the umber of oisomorphic secod-type programs over the basis of all at most k-place Boolea fuctios cotaiig at most L 1 fuctioal operators ad at most L 2 stop operators with iputs ad m outputs; N 2 (k; ; m; L is the umber of oisomorphic reduced programs of the secod type over the basis of at most k-place Boolea fuctios cotaiig at most L operators with iputs ad m outputs. Lemma 1. If k is a costat; the N 1 (k; ; m; L 1 ;L 2 6 (c 1 m(l 1 + L 2 + (k 1L1+(m+1L2 ; N 2 (k; ; m; L 1 ;L 2 6 (c 1 m(l 1 + L 2 + (k 1(L1+L2+(m+1L2 : Proof. Sice both iequalities i the lemma are proved i a similar way; we prove oly the rst. To this ed; it is suciet to estimate from above the umber of graphs correspodig to the programs uder cosideratio. Each graph cotais at most L 1 + L 2 + vertices ad at most kl 1 +(m +2L 2 1 arcs. The umber of such graphs does ot exceed (see; e.g.; [1] (c(l 1 + L 2 + kl1+(m+2l2 L1 L2 : The arcs of the graph ca be labeled i at most k kl1 (m+2 (m+2l2 ways; ad its vertices; i at most (L 1 + L 2 + (c(k L1+L2 ways; where c(k is a costat depedig o k. Therefore; the umber of distict labeled graphs does ot exceed the product of the three quatities above; i.e.; N 1 (k; ; m; L 1 ;L 2 6 (c 1 m(l 1 + L 2 + (k 1L1+(m+1L2 : Lemma 1 is proved. Lemma 2 is a straightforward cosequece of Lemma 1 ad is preseted without proof. Lemma 2. If k m +2; the N 1 (k; ; m; L 6 (c 2 m(l + (k 1L : Lemma 3. If k 6 m +2; the N 1 (k; ; m; L 6 (c 3 m(l + (L+(m+k=2 : Proof. We show that q i;m+1 q j;m+1 whe i j for ay termial program P. Assume that q i;m+1 =q j;m+1 ad i j.ifq i;m+1 =1; the the operator q i termiates the program; ad the operator q j is ot computed. If q i;m+1 =0; the the operator q j does ot termiate
A.V. Chashki / Discrete Applied Mathematics 135 (2004 41 54 47 the program P. Cosequetly; the operator q j ca be removed from the program. Hece; the assumptio made cotradicts the fact that P is a termial program. It follows from q i;m+1 q j;m+1 that L 2 6 L 1 +. The L 2 6 (L + =2 ad L 1 = L L 2. Therefore; (k 1L 1 +(m +1L 2 6 (k 1(L L 2 +(m +1L 2 6 (k 1L +(m +1 k +1L 2 6 (2k 2 L + 2 +(m k +2 L + 2 6 (m + k L + : 2 Substitutig this boud ito the rst iequality i Lemma 1; we obtai the required result. Lemma 3 is proved. Lemma 4. If k is a costat; the N 2 (k; ; m; L 6 (c 4 m(l + kl : Proof. We estimate from above the umber of graphs correspodig to the programs uder cosideratio. Let L 1 be the umber of fuctioal operators ad L 2 be the umber of stop operators i the program. Obviously; L= L 1 + L 2 ; ad each graph cotais at most L + vertices. Let us estimate the umber of arcs. Each vertex correspodig to a fuctioal operator emaates at most oe specic arc. The umber of specic arcs is deoted by N. Obviously; o specic or fuctioal arcs leave the vertices correspodig to the stop operators. Hece; N6 L 1. Each graph cotais L 2 1 stop arcs ad at most kl fuctioal arcs. Cosequetly; the total umber of arcs is at most kl + L 2 + N. It is easy to see that the greater the dierece betwee the umbers of arcs ad vertices; the larger the umber of graphs is (see [2]. This dierece ca be trasformed to give (k 1L + L 2 + N 6 (k 1L + L 2 + L 1 = kl : Takig ito accout the umber of ways i which the arcs ad vertices of the graph ca be labeled; we obtai N 2 (k; ; m; L 6 (c 4 m(l + kl : Lemma 4 is proved. 5. Lower bouds Let f be a Boolea operator, ad P be a program computig f. To each biary tuple x of legth, which is viewed as the biary represetatio of a positive iteger, we assig its umber N P (x such that 1 6 N P (x 6 2 ad N P (x N P (y if T P (x T P (y, ad N P (x N P (y ift P (x=t P (y ad x y.
48 A.V. Chashki / Discrete Applied Mathematics 135 (2004 41 54 Lemma 5. Let k m+2. The for almost all Boolea (; m-operators f T k;1 (f 2 m (m + k Proof. Let f be a Boolea operator ad P be a miimal program computig f. Let x i be such that N P (x i =i2 =q; where q =2 q0 ; with q 0 beig a iteger; q =log 2 ; ad i =2; 3;:::;q. We estimate from above the umber of Boolea operators that ca be implemeted by miimal programs cotaiig x i such that T P (x i 6 ((i 12 =q 2m=(m + k. Each such operator is uiquely determied by the rst T P (x i operators of its miimal program ad by a set of at most 2 N P (x i biary vectors of legth m that are its values o the argumets requirig more executio time tha x i. By Lemma 3; the umber N i of distict programs whose complexity does ot exceed T P (x i satises the iequality (((i 12 2m =q 2m=(m+k+(m+k=2 m + k + : ( ( (i 12 N i 6 c 3 m q Sice m = O(1 ; after some simple algebra; we obtai N i 6 2 (i 1m2 =q (1 + O(log =: Thus; deotig by M the umber of operators i questio; we have q M 6 2 (i 1m2 =q (1 + O(log =2 m2 mi2 =q : i=2 Takig ito accout i 6 q =log 2 ; we trasform the expoet of the quatity uder the summatio sig to obtai ( ( m2 mi2 (i 1m2 log + 1+O q q ( ( ( = m2 m2 log i (i 1 1+O q = m2 m2 q Therefore; ( ( 1 1+O : log M 6 q2 m2 m2 =q(1+o(1=log =2 m2 m2 =q (1+O(1=log : A compariso of this boud for M with the umber of all Boolea (; m-operators shows that all miimal programs of almost all Boolea operators satisfy the followig coditio: if x i is such that N P (x i = i2 ; where q =2q0 (q 0 is a iteger q q log 2 ; ad i =2; 3;:::;q; the T (i 12 P(x i q 2m m + k : (1
A.V. Chashki / Discrete Applied Mathematics 135 (2004 41 54 49 Set X i = {x N P (x i N P (x 6 N P (x i+1 }. For the average executio time T(P of each such program P we the have T(P=2 x q 1 =2 i=2 q 1 T P (x 2 T P (x i X i i=2 T P (x i 2 q 1 q 1 (i 12 q q i=2 (q 1(q 22 m = q 2 m + k ( ( = 2 m log 2 1+O : (m + k Lemma 5 is proved. 2m m + k Lemma 6. Let k m +2. The for almost all Boolea (; m-operators f T k;1 (f 2 1 m (k 1 Proof. As i the proof of the precedig lemma; it is easy to show that all miimal programs P that implemet almost all Boolea operators satisfy the followig coditio: if x i is such that N P (x i = i2 ; where q =2q0 (q 0 is a iteger q q log 2 ; ad i =2; 3;:::;q; the T (i 12 P(x i q m k 1 : (2 The proof of (2 is aalogous to that of (1; the oly dierece is that Lemma 2 is used istead of Lemma 3. Oce agai we set X i = {x N P (x i N P (x 6 N P (x i+1 }. The; for the average executio time T (P of the program P satisfyig (2; we have T(P=2 x q 1 =2 i=2 q 1 T P (x 2 T P (x i X i i=2 T P (x i 2 q 1 q 1 (i 12 q q i=2 (q 1(q 22 m = 2q 2 k 1 ( ( = 2 1 m log 2 1+O : (k 1 Lemma 6 is proved. m k 1
50 A.V. Chashki / Discrete Applied Mathematics 135 (2004 41 54 The ext lemma is give without proof, for it almost literally coicides with that of Lemma 5. The oly dierece is that Lemma 4 is used istead of Lemma 3, ad (1 is replaced by the coditio if x i is such that N P (x i = i2 ; where q =2q0 (q 0 is a iteger q q log 2 ; ad i =2; 3;:::;q; the T (i 12 m P(x i q k : Lemma 7. For almost all (; m-operators f T k;2 (f 2 1 m k 6. Upper bouds Let =( 1 ;:::; s be a biary tuple. O the set of such tuples, we dee the fuctio N (= s i=1 i2 i 1. Lemma 8. For ay Boolea (; m-operator f T k;1 (f 6 2 1 m (k 1 Proof. Let f =(f 1 ;:::;f m ; where f i is the ith compoet of f. Settig s = log ad decomposig f i i the rst s variables; we have f i (x 1 ;:::;x = f i ( 1 ;:::; s ;x s+1 ;:::;x x 1 1 :::xs s ( 1;:::; s = ( 1;:::; s f i;j (x s+1 ;:::;x x 1 1 :::xs s ; where j = N ( 1 ;:::; s. The program P computig f is represeted as P = P 1 q 1 :::P s q s : Here; the program P j computes the fuctios f 1;j ;:::;f m;j ;x 1 1 ;:::;xs s ad cosists of oly fuctioal operators; while the operator q j termiates the program P if x 1 1 :::xs s = 1; where j = N ( 1 ;:::; s ; ad declares f i;j (x s+1 ;:::;x tobetheith value of the program. It follows from [3] that L(P i 6 2 s m (k 1( s
Therefore; T(P =2 A.V. Chashki / Discrete Applied Mathematics 135 (2004 41 54 51 ( s+1;:::; ( 1;:::; s T P ( 1 ;:::; s 2 6 2 m2 s (k 1( s 2 s i(1 + o(1 i=1 6 2 m2 2 2s (k 1( s 22s 1 (1 + o(1 6 m2 1 (k 1 Lemma 8 is proved. Let s; h be itegers. We divide the set of all biary tuples of legth s ito disjoit sets Y i such that Y i if (i 1h 6 N ( ih. Dee the fuctios g l (x 1 ;:::;x s = 1 :::xs s ; Y l x 1 g j;l (x 1 ;:::;x =g l (x 1 ;:::;x s x s+1 s+1 :::x ; where N( s+1 ;:::; = i=s+1 i2 i s 1 = j. Let z(x 1 ;:::;x be a arbitrary Boolea fuctio. Set z j (x 1 ;:::;x s =z(x 1 ;:::;x s ; s+1 ;:::;, where N( s+1 ;:::; =j, ad z j;l (x 1 ;:::;x s =z j (x 1 ;:::;x s g l (x 1 ;:::;x s. Let t = 2 s =h. The [3] yields z(x 1 ;:::;x = ( t z j;l (x 1 ;:::;x s x s+1 s+1 :::x ; ( s+1;:::; l=1 where N( s+1 ;:::; =j. It is easy to see that z j;l (x 1 ;:::;x s x s+1 s+1 :::x = z j;l (x 1 ;:::;x s g j;l (x 1 ;:::;x : Cosequetly, z(x 1 ;:::;x = ( t z j;l (x 1 ;:::;x s g j;l (x 1 ;:::;x : (3 ( s+1;:::; l=1 Let R be the umber of distict fuctios z j;l (x 1 ;:::;x s ad L z be the circuit complexity of these fuctios. It is easy to see that R 6 2 h+s+1 =h ad L z 6 2 h+s+1 : (4 Lemma 9. For ay Boolea (; m-operator f T k;1 (f 6 2 Proof. We prove the lemma for m = 1. I the geeral case; the proof diers from that preseted below oly by additioal idices i formulas. Let z(x 1 ;:::;x be a arbitrary
52 A.V. Chashki / Discrete Applied Mathematics 135 (2004 41 54 Boolea fuctio. Settig s = 2 log ad h = 4 log ; we use (3. A program computig z ca be represeted as P = P 1 p 1;1 q 1;1 :::p j;l q j;l :::p t;d q t;d ; where t = 2 s =h ; d =2 s ; ad P 1 is a program computig all possible fuctios z j;l (x 1 ;:::;x s ; all fuctios g l (x 1 ;:::;x s ; ad all products x s+1 s+1 :::x. Furthermore; the operator p j;l computes the fuctio g j;l (x 1 ;:::;x ; while the operator q j;l termiates the program if p j;l =1 ad declares that its result is the value of z j;l (x 1 ;:::;x s computed by P 1. It is easy to see that T P ( 1 ;:::; s ;x s+1 ;:::;x =T P ( 1;:::; s;x s+1 ;:::;x for all x s+1 ;:::;x wheever ( 1 ;:::; s ad ( 1 ;:::; s belog to the same set Y l. Sice 2 h+s h 1 6 2 2 ; it follows from (3 ad (4 that T(P =2 T P ( 1 ;:::; =2 6 2 ( s+1;:::; ( 1;:::; s t ( s+1;:::; l=1 ( s+1;:::; l=1 6 2 L z htd + ( 1;:::; s Y l T P ( 1 ;:::; t h(l z +2(N ( s+1 ;:::; t + l d j=1 l=1 t (2h((j 1t + l dt 6 2 (2 +1 2 2 +2h i 6 2 (2 2+1 2 + h(td 2 i=1 6 2 (2 2+1 2 + h2 2 h 2 (1 + o(1 6 2 1 Fially; we ote that ay Boolea operator ca be computed by a program that diers from that described above oly by the umber of argumets i the stop operator. Therefore; the average executio time of the rst-type program thus costructed is idepedet of the umber of its argumets. Lemma 9 is proved. Lemma 10. For ay Boolea (; m-operator f T k;2 (f 6 2 1 (m +1 k Proof. Settig s= 2 log ; h= 4 log ; ad t= 2 s =h ; we use (3. Each compoet f i of f ca be represeted as f i (x 1 ;:::;x = ( t f i;j;l (x 1 ;:::;x s g j;l (x 1 ;:::;x ; ( s+1;:::; l=1
A.V. Chashki / Discrete Applied Mathematics 135 (2004 41 54 53 where N( s+1 ;:::; =j. We divide the set of all biary tuples of legth s ito disjoit subsets Y l such that Y l if (l 1kh 6 N( l hk. The fuctios f i;j;l are collected i groups Yˆ j;l such that each of them; except possibly the last; cosists of k fuctios; ad f i;j;l Yˆ j;l if (l 1k 6 l l k. Let w = t=k. Put k ĝ l (x 1 ;:::;x s = g (l 1k+r(x 1 ;:::;x s ; r=1 ĝ j;l (x 1 ;:::;x =ĝ l (x 1 ;:::;x s x s+1 s+1 :::x ; where N( s+1 ;:::; =j. Sice f i;j;l g j;q = 0 for l q; we have f i (x 1 ;:::;x = ( s+1;:::; ( w l =1 ( k f i;j;(l 1k+r(x 1 ;:::;x s ĝ j;l (x 1 ;:::;x : r=1 A program computig the operator f ca be represeted as P = P 0 P 1 :::P j :::P 2 s; where P 0 is a program computig all the fuctios f i;j;l (x 1 ;:::;x s ad all the fuctios ĝ l (x 1 ;:::;x s ; while P j is a program havig the form P j = P j;1 :::P j;l :::P j;w where P j;l is a program that computes ĝ j;l (x 1 ;:::;x ad all fuctios ˆf i;j;l = k r=1 f i;j;(l 1k+r(x 1 ;:::;x s ; termiates the program if ĝ j;l (x 1 ;:::;x =1; ad declares that the value of ˆf i;j;l is the value of the ith compoet of f. It is easy to see that each program P j;l cosists of at most m + 1 operators: a 2-iput stop operator computes the fuctio ĝ j;l (x 1 ;:::;x ad mk-iput operators compute the fuctios ˆf i;j;l. Obviously; the circuit complexity L z of all possible fuctios f i;j;l ad of the fuctios ĝ l (x 1 ;:::;x s satises (4. It is also easy to see that T P ( 1 ;:::; s ;x s+1 ;:::;x = T P ( 1 ;:::; s;x s+1 ;:::;x for all (x s+1 ;:::;x wheever the tuples ( 1 ;:::; s ad ( 1 ;:::; s belog to the same set Y l. Settig d =2 s ; we have T(P =2 T P ( 1 ;:::; =2 6 2 d ( s+1;:::; ( 1;:::; s w ( s+1;:::; l =1 ( 1;:::; s Y l j=1 l =1 6 2 L z dwhk + T P ( 1 ;:::; w (L z +((j 1w + l (m + 1hk d j=1 l =1 w ((j 1w + l (m +1hk
54 A.V. Chashki / Discrete Applied Mathematics 135 (2004 41 54 6 2 ( L z dwhk + 6 2 ( 2 2+1 2 (m +1hk(dw2 2 + (m +1hk22 (hk 2 2 6 2 1 (m +1 k Lemma 10 is proved. (1 + o(1 7. Programs with a limited umber of stop operators We preset without proofs some results cocerig the average executio time of programs with a limited umber of coditioal stops. Cosider the rst-type programs i which the umber of stop operators is o(2 =m ad the secod-type programs i which the umber of stop operators is o(2 =. Their Shao fuctios are deoted by T k;1 ad T k;2, respectively. Theorem 3. Let k be a costat. The T k;1(; m= T k;2(; m= m2 1 (1 + o(1; (k 1 m2 1 (k 1 The upper bouds are easily proved usig Lemma 8, ad the lower bouds are proved i the same fashio as Lemma 5, with the umber of programs estimated usig Lemma 1. Ackowledgemets The author is grateful to Professor O.B. Lupaov for his attetio to this study ad to R.M. Kolpakov, who idicated some iaccuracy i the rst versio of this paper. Refereces [1] A.V. Chashki, Average case complexity for ite boolea fuctios, Discrete Appl. Math. 114 (2001 43 59. [2] O.B. Lupaov, Asymptotic bouds for the umber of graphs ad etworks with edges, Problemy kiberetiki 4 (1960 61 80 (i Russia. [3] O.B. Lupaov, Sythesis of some classes of cotrol systems, Problemy kiberetiki 9 (1963 63 97 (i Russia.