Skip to main content
  • Research Article
  • Open access
  • Published:

New results on the Baire partial quasi-metric space, fixed point theory and asymptoticcomplexity analysis for recursive programs

Abstract

In Cerdà-Uguet et al. (Theory Comput. Syst. 50:387-399, 2012), a newmathematical fixed point technique, that uses the so-called Baire partial quasi-metricspace, was introduced with the aim of providing the asymptotic complexity of a class ofrecursive algorithms. The aforementioned technique presents the advantage that requiresless calculations than the quasi-metric original one given by Schellekens (Electron. NotesTheor. Comput. Sci. 1:211-232, 1995). In this paper we continue the study, started inCerdà-Uguet et al. (Theory Comput. Syst. 50:387-399, 2012), on the use ofpartial quasi-metric spaces for asymptotic complexity analysis of algorithms. Concretely,our main purpose is to prove that the Baire partial quasi-metric space is an appropriatemathematical framework for discussing via fixed point arguments the asymptotic complexityof a general class of recursive algorithms to which all the algorithms analyzed inCerdà-Uguet et al. (Theory Comput. Syst. 50:387-399, 2012) belong. Theobtained results are illustrated by means of applying them to yield the complexity of twocelebrated recursive algorithms which don not belong to the class discussed inCerdà-Uguet et al. (Theory Comput. Syst. 50:387-399, 2012).

MSC: 47H10, 54E50, 68Q15, 68Q25, 68W40.

1 Introduction

In 1994, Matthews introduced the notion of partial metric space in order to obtain a newmathematical framework to model computational recursion processes in program verification bymeans of ‘metric’ fixed-point techniques [1]. Moreover, he gave an application of this new metric structure to parallelcomputing by means of a partial metric version of the celebrated Banach fixed-point theoremin [2]. Later on, in 1995, Schellekens introduced the (quasi-metric) complexity space asa new mathematical approach of the foundation for the asymptotic complexity analysis ofalgorithms [3]. The applicability of this theory to the asymptotic complexity analysis of Divideand Conquer algorithms was also illustrated by Schellekens, in the same reference, usingfixed-point arguments based on the use of a quasi-metric version of the aforementionedBanach fixed-point theorem.

Motivated by the utility of quasi-metric spaces for the asymptotic complexity analysis ofalgorithms via fixed-point techniques and the usefulness of partial metric spaces to analyzeprogram correctness, the possibility of analyzing the asymptotic complexity of algorithmsvia Matthews’ fixed-point theorem was discussed recently in [4]. However, in the aforesaid reference it was shown that, at first, such ananalysis cannot be carried out through the aforementioned result. In consequence, in thepreceding reference a new mathematical tool, which was called the Baire partial quasi-metricspace, was introduced in order to provide a novel mathematical framework for the asymptoticcomplexity analysis of algorithms which unify, under the same framework, the quasi-metricfixed-point arguments originating with the Schellekens approach and the seminal ideas ofMatthews on partial metric spaces. The mathematical framework based on the Baire partialquasi-metric space presents the advantage of providing the complexity of the algorithmsunder consideration through easier and fewer calculations than those given in theSchellekens methods. In [4], the applicability of the Baire partial-quasi-metric fixed-point techniques wereillustrated discussing the complexity of a few particular and celebrated recursivealgorithms. Nevertheless, in the class of recursive algorithms there are some whosecomplexity cannot be analyzed be means of the fixed-point techniques developed in [4]. Examples of this kind of algorithms are the well-know algorithms that solves theTowers of Hanoi puzzle and the algorithm that computes the value of the Fibonacci sequence,which we will call Hanoi and Fibonacci, respectively, in the following.

In this paper we continue and improve the study started in [4] of the use of partial quasi-metrics for asymptotic complexity analysis ofalgorithms. Concretely, our main purpose is to prove that the Baire partial quasi-metricspace is a suitable mathematical framework for discussing by means of fixed-point argumentsthe asymptotic complexity of a general class of recursive algorithms to which the Hanoi,Fibonacci and all the algorithms analyzed in [4] belong.

The remainder of the paper is organized as follows: Section 2 is devoted, on the onehand, to recall the basics on asymptotic complexity analysis of algorithms and, on the otherhand, to introduce the reader to the associated current metric fixed-point tools.Concretely, we recall briefly, with the aim of motivating our subsequent work, theSchellekens fixed-point method and how it can be applied to the complexity analysis of someDivide and Conquer algorithms. Moreover, the fundamentals on partial metric spaces and theirutility in complexity analysis of algorithms are also discussed. Furthermore, in the samesection, we recall, according to [4], how both frameworks, the quasi-metric and the partial metric one, are unified inorder to construct a new mathematical approach, the so-called Baire partial quasi-metricspace, which preserves the original Schellekens ideas and allows to apply the Matthewsseminal ones to complexity analysis. In Section 3, our new results are presented. Inparticular, we introduce a new fixed-point technique based on the Baire partial quasi-metricspace that extends the provided one in [4] and, in addition, allows to provide easily the complexity of some algorithmswhich cannot be analyzed by means of the aforementioned technique given in [4]. Finally, we validate the developed theory applying it to an analysis andretrieving the asymptotic complexity of the celebrated Hanoi and Fibonacci.

2 The asymptotic complexity analysis of algorithms and metric fixed-point tools

2.1 The fundamentals

From now on, R + and will denote the set of nonnegative real numbersand the set of positive integer numbers, respectively.

In complexity analysis of algorithms, the running time of computing, that is the timetaking by an algorithm in order to solve the problem for which it has been designed, playsa crucial role (see, for instance, [5]). Usually there are several algorithms that are able to solve a fixed problem.Thus, in a natural way, the complexity analysis focus its interest on determining which ofthem has less complexity, that is which takes less running time of computing. In order tocompare the complexity of all algorithms solving the same problem, the running time ofcomputing of each algorithm is denoted by a function T:N(0,] in such a way that T(n) represents the time taken by the algorithm to solve theproblem under consideration when the input of the algorithm is of size n. Hence,one can compare the running time of computing all the aforesaid algorithms by means of thecomparison of their associated functions.

Nevertheless, given an algorithm, to asses which is the function that describes itsrunning time of computing for every input size is, in many cases, a hard challenge. Forthis reason, in most situations it is enough to work, in order to compare the algorithmcomplexity, with an approximate running time of computing of each algorithm to becompared. To provide the running time of computing of algorithms in an approximate way isthe main objective of the so-called asymptotic complexity analysis of algorithms.

In what follows we recall a few pertinent notions from asymptotic complexity analysiswhich will be a crucial role in our subsequent work. To this end, we will denote byRT the set of all functions from into(0,].

Let fRT denote the running time of computing of a concrete algorithm.Moreover, given a certain function gRT, consider that there exist n 0 N and c>0 satisfying f(n)cg(n) for all nN with n n 0 (of course ≤ stands for the usual order on(0,]). Hence, it is clear that the function g provides anasymptotic upper bound of the running time f of the algorithm underconsideration. Therefore, if we do not have exact information as regards the expression ofthe function f, then the function g yields us an‘approximate’ information of the running time of computing f in sucha way that the considered algorithm takes a time to solve the problem boundedasymptotically above by g. Following the standard notation, we will writefO(g) provided that f,gRT and g is an asymptotic upper bound off.

Of course, an asymptotic upper bound itself does not provide much information on thecomplexity f of the algorithm under study. In order to give a tighter bound onthe complexity f, in asymptotic complexity analysis of algorithms are used inaddition asymptotic lower bounds of the running time of computing. Concretely, a functionhRT provides an asymptotic lower bound of the unknown runningtime of computing f under consideration provided that there exist n 0 N and c>0 such that ch(n)f(n) for all nN with n n 0 . When h is an asymptotic lower bound of fwe will denote it, as usual, by fΩ(h).

Therefore when we have found two functions h,gRT such that fΩ(h)O(g), we obtain, through h and g, a completeasymptotic information about the time f taken by the algorithm under discussion.Moreover, in case of f obeying the condition fΩ(h)O(g), for any h,gRT, we will say that Ω(h)O(g) is the complexity class of f. Furthermore, we willdenoted the complexity class of f by Θ(l) provided the existence of a function lRT such that fΩ(l)O(l).

Accordingly, the main aim of the asymptotic complexity analysis is to describe therunning time of algorithms by means of determining its asymptotic complexity class.

2.2 The Schellekens approach and the quasi-metric complexity space

According to [6], and following modern terminology, a quasi-metric space is a pair(X,d) such that X is a non-empty set and d is aquasi-metric on X, where by a quasi-metric we mean a functiond:X×X R + such that for all x,y,zX:

  1. (i)

    d(x,y)=d(y,x)=0x=y;

  2. (ii)

    d(x,y)d(x,z)+d(z,y).

Clearly, a metric space is a quasi-metric space (X,d) in such a way that d satisfies the next additionalcondition for all x,yX:

  1. (iii)

    d(x,y)=d(y,x).

It is well known that each quasi-metric d on X generates a T 0 -topology T(d) on X which has as a base the family of opend-balls { B d (x,ε):xX,ε>0}, where B d (x,ε)={yX:d(x,y)<ε} for all xX and ε>0. Moreover, a quasi-metric space (X,d) is called bicomplete if the metric space(X, d s ) is complete, where the metric d s is defined for all x,yX by d s (x,y)=max(d(x,y),d(y,x)).

In 1995, as we have mentioned in Section 1, Schellekens introduced the so-calledcomplexity space with the aim of developing a mathematical foundation for the asymptoticcomplexity analysis of algorithms [3]. Let us recall that the complexity space consists of the pair(C, d C ), where

C= { f RT : n = 1 2 n 1 f ( n ) < }

and d C is the bicomplete quasi-metric on defined by

d C (f,g)= n = 1 2 n max ( 1 g ( n ) 1 f ( n ) , 0 ) .
(1)

Of course in equation (1) the convention that 1 =0 is adopted.

Although in asymptotic complexity analysis of algorithms the running time of computing isrepresented by means of functions in RT and, thus, the condition ‘ n = 1 2 n 1 f ( n ) <’ in not required, according to [3], every reasonable algorithm, from a computability point of view, must obey theaforementioned condition. Hence each algorithm can be associated with a function belongingto whichrepresents, as a function of the input size, its running time of computing.

The utility of the complexity space in algorithm complexity is given, in part, by thecomputational interpretation of the numerical value d C (f,g). Concretely, given two functions f,gC, the complexity distance from f to g, thatis d C (f,g), provides information about the relative progress made inlowering the complexity by replacing any program A with complexity functionf by any program B with complexity function g in such a waythat if fg, the fact that d C (f,g)=0 can be interpreted as the program A is at least asefficient as the program B. In fact, the condition d C (f,g)=0 implies that fO(g).

It must be stressed that the asymmetry of d C is key in order to provide information about the increase ofcomplexity whenever an algorithm is replaced by another one. Of course, a metric wouldgive at most information on the increase but it would not be able to provide whichalgorithm of both, A or B, is more efficient.

In [3], Schellekens gave an application of the complexity space to asymptoticcomplexity analysis. In particular, he gave a new method, based on the use of thecelebrated Banach fixed-point theorem, to analyze the running time of computing of Divideand Conquer algorithms.

In what follows we recall briefly the aforesaid method, since this will allow the readerto gain a better understanding of the motivation for our subsequent work (exposed inSection 3). To this end, let us recall that the Banach fixed-point theorem can bestated in the quasi-metric framework as follows.

Theorem 1 Let f be a mapping from a bicomplete quasi-metric space (X,d) into itself such that there exists s[0,1) satisfying

d ( f ( x ) , f ( y ) ) sd(x,y),

for all x,yX. Then f has a unique fixed point.

In many cases, the recursive structure of a Divide and Conquer algorithm yields theresult that its running time of computing satisfies the recurrence equation

T(n)= { c if  n = 1 , a T ( n b ) + h ( n ) if  n N b ,
(2)

where a,bN with a,b>1, N b ={ b k :kN}, c>0 and hC with h(n)< for all nN.

Observe that for Divide and Conquer algorithms, it is sufficient to obtain the complexityon inputs of size n with n ranges over the set N b (for a fuller treatment we refer the reader to [5]).

In order to provide the running time of computing of a Divide and Conquer algorithmsatisfying the recurrence equation (2), we have to prove that the recurrence equation hasa unique solution, which represents the running time, and, in addition, we have to computethe asymptotic complexity class of such a solution. As we show in the following, theannounced Schellekens method is able to prove that equation (2) has a unique solution andto yield an asymptotic upper bound (asymptotic lower bounds of the running time of Divideand Conquer algorithms were obtained by Schellekens following standard arguments which arenot based on the use of fixed-point techniques):

Denote by C b , c the subset of given by

C b , c = { f C : f ( 1 ) = c  and  f ( n ) =  for all  n N N b  with  n > 1 } .

Then the quasi-metric space ( C b , c , d C | C b , c ) is bicomplete, since the quasi-metric space(C, d C ) is bicomplete (see [7] for the bicompleteness of ) and the set C b , c is closed in (C, d C s ).

Next, given the recurrence equation (2), we introduce the functional Φ T : C b , c C b , c as follows:

Φ T (f)(n)= { c if  n = 1 , if  n N N b  and  n > 1 , a f ( n b ) + h ( n ) otherwise .
(3)

It is clear that a function in C b , c is a solution to the recurrence equation (2) if and only ifit is a fixed point of the functional Φ T . Then, it is not hard to check that

d C | C b , c ( Φ T ( f ) , Φ T ( g ) ) 1 a d C | C b , c (f,g)
(4)

for all f,g C b , c . Consequently, Theorem 1 guarantees the existence of aunique fixed point f T of Φ T and, thus, the existence and uniqueness of the solution tothe recurrence equation (2). Of course such a solution provides a unique possiblerepresentative of the running time.

In order to approximate, according to the Schellekens approach, the running time ofcomputing of the algorithms under consideration it remains to give an asymptotic upperbound of f T . But Schellekens proved that f T O(g) provided that g C b , c and that Φ T (g)g.

The preceding facts mentioned allow us to state the next useful result [3].

Theorem 2 A Divide and Conquer recurrence equation of the form (2) has a uniquesolution f T in C b , c . Moreover if there exists g C b , c such that the functional Φ T associated with equation (2) obeys Φ T (g)g, then f T O(g).

With the aim of illustrating the real utility of Theorem 2, Schellekens applied itto provide a description of an asymptotic upper bound of the running time of computing ofMergesort (for a detailed discussion of Mergesort see, for instance, [5]). Specifically, he gave a new proof of the well-known fact that the (average)running time of computing of Mergesort f T M is in O(n log 2 n).

2.3 The partial metric space approach

In 1994, as we have announced in Section 1, Matthews introduced partial metricspaces with a twofold objective [1]. On the one hand, he claimed to present a new mathematical framework to modelcomputational recursion processes, in the spirit of Scott (see [8] for details of Scott theory), in program verification by means of‘metric’ fixed-point techniques. On the other hand, in order to achieve thelater purpose, he wanted to obtain an extension of Banach’s fixed-point theorem tothe partial metric context.

Let us recall a few basic notions about partial metric spaces in order to introduce theMatthews fixed-point theorem.

Following [1], a partial metric space is a pair (X,p) such that X is a non-empty set X andp is a function p:X×X R + satisfying for all x,y,zX:

  1. (i)

    p(x,x)=p(x,y)=p(y,y)x=y;

  2. (ii)

    p(x,x)p(x,y);

  3. (iii)

    p(x,y)=p(y,x);

  4. (iv)

    p(x,y)p(x,z)+p(z,y)p(z,z).

Of course, a metric on a non-empty set X is a partial metric p onX satisfying, in addition, the following condition for allxX:

  1. (v)

    p(x,x)=0.

It is well known that each partial metric p on X generates a T 0 topology T(p) on X which has as a base the family of openp-balls { B p (x,ε):xX,ε>0}, where B p (x,ε)={yX:p(x,y)<p(x,x)+ε} for all xX and ε>0. Moreover, as a consequence, a sequence ( x n ) n N in a partial metric space (X,p) converges to a point xX with respect to T(p)p(x,x)= lim n p(x, x n ).

With the aim of introducing a partial metric version of the Banach fixed-point theorem,Matthews defined the notion of completeness in partial metric spaces. In particular, andaccording to [1], a sequence ( x n ) n N in a partial metric space (X,p) is called a Cauchy sequence if lim n , m p( x n , x m ) exists. A partial metric space (X,p) is said to be complete if every Cauchy sequence ( x n ) n N in X converges, with respect toT(p), to a point xX such that p(x,x)= lim n , m p( x n , x m ).

The announced new fixed-point theorem can be stated for partial metric spaces asfollows.

Theorem 3 Let f be a mapping from a complete partial metric space (X,p) into itself such that there is s[0,1) satisfying

p ( f ( x ) , f ( y ) ) sp(x,y),

for all x,yX. Then f has a unique fixed point. Moreover if xX is the fixed point of f, then p(x,x)=0.

It is interesting to point out that Matthews used the preceding result to provide asuitable test for lazy data flow deadlock in Kahn’s model of parallel computation(for a fuller treatment of the application we refer the reader to [2]).

In [4], motivated by the usefulness of partial metric spaces in some fields inComputer Science, it was wondered whether partial metric spaces are also useful, likequasi-metric spaces, in asymptotic complexity analysis in the spirit of Schellekens.Hence, in the same reference it was noted that although the set can be endowed with the partialmetric p C defined in [9] for all f,gC by

p C (f,g)= n = 1 2 n max ( 1 f ( n ) , 1 g ( n ) ) ,

Matthews fixed-point theorem cannot be directly applied to a discussion of thecomplexity class of the running time of algorithms through (C, p C ). Concretely, in spite of the partial metric space( C b , c , p C b , c ) being complete, it was proved that the condition

p C | C b , c ( Φ T ( f ) , Φ T ( g ) ) s p C | C b , c (f,g)

does not hold for any s[0,1), where Φ T is the functional associated to the recurrence equation (2)and introduced in Section 2.2. Hence, the Matthews fixed-point theorem cannot beapplied to an analysis of the running time of computing of the Divide and Conqueralgorithms whose running time obeys equation (2).

At this point, it seems natural to wonder if another choice of the partial metric couldallow to use Matthews fixed-point theorem for the purpose of discussing running time ofcomputing in asymptotic complexity analysis of algorithms. However, it is interesting tonote that the partial metric p C , as defined before, is the most natural partial metric thatcan be defined on the set because d C is induced by p C in the sense that, for all f,gC,

d C (f,g)= p C (f,g) p C (f,f)

and, hence, T( d C )=T( p C ).

Inspired by the fact that Matthews fixed-point theorem does not constitute a suitabletool for the aforementioned purpose, a thorough study of the possibility of applying thepartial metric p C to asymptotic complexity analysis of algorithms has been donerecently in [10]. In particular, new fixed-point theorems which differ from the Matthews onehave been proved in such a way that they provide a new mathematical basis to carry out anasymptotic complexity analysis of algorithms via partial metrics (concretely via p C ).

2.4 The Baire partial quasi-metric space approach

Since Theorem 3 cannot be used to analyze the complexity of those algorithms whoserunning time of computing is the solution to a recurrence equation (2), the Baire partialquasi-metric space was introduced in [4]. This new mathematical structure allows us to carry out the asymptoticcomplexity analysis of algorithms in the spirit of Schellekens but now involving theoriginal fixed-point arguments of Matthews.

In order to introduce the aforementioned Baire partial quasi-metric space and theassociated fixed-point technique for complexity analysis developed in [4], let us first recall some basics on partial quasi-metrics.

Following [11], a partial quasi-metric space is a pair (X,q) where X is a non-empty set and q is apartial quasi-metric on X. By a partial quasi-metric we mean a functionq:X×X R + such that for all x,y,zX:

  1. (i)

    q(x,x)q(x,y);

  2. (ii)

    q(x,x)q(y,x);

  3. (iii)

    q(x,y)q(x,z)+q(z,y)q(z,z);

  4. (iv)

    q(x,x)=q(x,y) and q(y,y)=q(y,x)x=y.

Of course, a partial metric on a set X is a partial quasi-metric satisfying inaddition the condition:

  1. (v)

    q(x,y)=q(y,x) for all x,yX.

Similarly to the case of partial metric spaces a partial quasi-metric qgenerates a T 0 -topology T(q) on X which has as a base the family of openq-balls { B q (x,ε):xX,ε>0}, where B q (x,ε)={yX:q(x,y)<q(x,x)+ε} for all xX and ε>0.

On account of [11], and similarly to the partial metric case, each partial quasi-metric qon X induces a quasi-metric d q :X×X R + in the following way:

d q (x,y)=q(x,y)q(x,x)

for all x,yX. Moreover, a partial quasi-metric space(X,q) is said to be complete provided that the associatedquasi-metric space (X, d q ) is bicomplete.

The Matthews fixed-point theorem, Theorem 3 in Section 2.3, was extended to thecontext of partial quasi-metric spaces as follows [11].

Theorem 4 Let f be a mapping from a complete partial quasi-metric space (X,q) into itself such that there is s[0,1), satisfying

q ( f ( x ) , f ( y ) ) sq(x,y),
(5)

for all x,yX. Then f has a unique fixed point. Moreover if xX is the fixed point of f, then q(x,x)=0.

It is worth to point out that generalizations of the preceding result have been obtainedfor a few type of contractions in partial quasi-metrics spaces in [12] and [13], recently.

In the light of the exposed notions, and according to [4], the Baire partial quasi-metric space can be introduced as follows.

Let Σ be a non-empty alphabet endowed with a partial order . Denote by Σ the set of all finite and infinite sequences (words) overΣ. Moreover, if x Σ denote by l(x) the length of x (l(x)[1,]). Furthermore, given x,y Σ , we will say that x is a subprefix of y,denoted by x s p y, provided that l(x)l(y) and x k y k for all kl(x).

Set l (x,y)=sup{nN: x k y k  for all kn} whenever there exists n 0 N such that n 0 l(x), x k y k for all k n 0 , and l (x,y)=0 otherwise. Then the Baire partial quasi-metric space is thecomplete partial quasi-metric space ( Σ , q B ), where q B : Σ × Σ R + is defined by

q B (x,y)= 2 l ( x , y )

for all x,y Σ .

As announced before, the Baire partial quasi-metric was introduced in order to apply, insome sense, partial metric fixed-point arguments to asymptotic complexity analysis ofalgorithms. Concretely, the new partial quasi-metric structure was applied successfully todiscussion of the asymptotic complexity of algorithms whose running time of computing istypically given by the recurrence equation

T(n)= { c if  n = 1 , T ( n 1 ) + h ( n ) if  n 2 ,
(6)

with c>0 and hRT such that h(n)< for all nN.

More specifically, the utility in asymptotic complexity analysis of the fixed-pointtechnique developed in [4] lies in the following result.

Theorem 5 Let Σ=(0,]. Fix cΣ and z Σ with l(z)= and z k for all kN with k2. Let Σ c be the subset of Σ given by Σ c :={y Σ :1l(y) and  y 1 =c} and let Φ z : Σ c Σ c be the mapping defined by

( Φ z ( x ) ) m := { c if  k = 1 , x m 1 + z m if  2 m l ( x ) + 1 .

Then Φ z has a unique fixed point w Σ c . Moreover, l(w)=. Furthermore, if u Σ c such that Φ z (u) s p u then w s p u.

The new mathematical technique that follows from Theorem 5 is provided by the resultbelow.

Corollary 6 Let RT c ={fRT:f(1)=c} and let Γ T : C c C c be the functional associated to recurrence equation (6) and given by

Γ T (f)(n)= { c if  n = 1 , f ( n 1 ) + h ( n ) if  n 2 ,
(7)

for all fRT. Then the following assertions hold:

  1. (1)

    A recurrence equation of the form (6) has a unique solution f T RT c .

  2. (2)

    If there exists g RT c such that Γ T (g)g, then f T O(g).

In the light of the preceding results, it should be pointed out that they allow one toprovide, via fixed-point techniques, an asymptotic upper bound of the running time ofcomputing of those algorithms under consideration but not its complexity class (accordingto the Schellekens approach exposed in Section 2.2). Moreover, they allow to achievethis without assuming the condition ‘ n = 1 2 n 1 f ( n ) < for all fRT’, which is an advantage with respect to the Schellekensapproach.

3 The new results

It is clear that the running time of computing of all recursive algorithms does not satisfynecessarily the recurrence equation (6). In fact, there are recursive algorithms whoserunning time of computing obeys the recurrence equation

T(n)= { c n if  1 n k , i = 1 k a i T ( n i ) + h ( n ) if  n > k ,
(8)

where hRT such that h(n)< for all nN, kN, c i >0, and a i 1 for all 1ik.

Two well-known examples of recursive algorithms whose running time satisfies the precedingrecurrence equation are the algorithm that solves the Towers of Hanoi puzzle, which we willcall Hanoi, and the algorithm that computes the value of the Fibonacci sequence at any givenindex n with nN, which we will call Fibonacci. Concretely, the running time ofcomputing of Hanoi satisfies the next recurrence equation

T(n)= { c if  n = 1 , 2 T ( n 1 ) + d if  n 2 ,
(9)

where c,d>0. Moreover, the running time of computing of Fibonacci satisfiesthe recurrence equation

T(n)= { 2 c if  n = 1 , 3 c if  n = 2 , T ( n 1 ) + T ( n 2 ) + 4 c if  n > 2 ,
(10)

where c>0.

Obviously, the recurrence equations (9) and (10) can be retrieved as a particular case ofthe recurrence equation (8). Observe, also, that the recurrence equation (6) can beretrieved from the recurrence equation (8). For a fuller treatment of Hanoi and Fibonacci werefer the reader to [14].

In [15] and [16], the Schellekens approach, exposed in Section 2.2, was extended and a newfixed-point technique based on the use of the (quasi-metric) complexity space was introducedin order to provide the complexity class of those recursive algorithms with running timesatisfying the recurrence equation (8). The aforesaid technique was applied successfully toyield lower and upper asymptotic complexity bounds of Hanoi and Fibonacci in the samereferences. However, such a quasi-metric fixed-point technique involves arduous computations(see, for instance, Theorem 5 in [15] and Theorem 5 in [16]) when compared with the technique based on the Baire partial quasi-metric andgiven by Theorem 5.

Motivated, on the one hand, by the fact that Theorem 5 is not able to provide thecomplexity class of algorithms like Hanoi and Fibonacci and, on the other hand, by the factthat the Baire partial quasi-metric allows one to develop fixed-point techniques thatrequire fewer and easier calculations than those involved by the Schellekens approach andexposed in [15] and [16], in this section we introduce a new mathematical technique based on the Bairepartial quasi-metric, given by Theorem 9, which extends the technique provided byTheorem 5 and, in addition, allows to provide easily, by means of Theorem 11, theasymptotic class of those recursive algorithms whose running time satisfies the recurrenceequation (8).

3.1 The new fixed-point technique

In order to present the announced technique we need to introduce the followinglemmata.

Lemma 7 Let Σ=(0,], kN and c 1 , c 2 ,, c k Σ. Let Σ c , k be the subset of Σ given by Σ c , k :={y Σ :kl(y) and  y m = c m  with 1mk}. Then Σ c , k is closed in ( Σ , d q B s ).

Proof Suppose that ( u n ) n N is a sequence in Σ c , k which converges to w in ( Σ , d q B s ). First of all we prove that kl(w). Indeed, assume that l(w)<k. Then taking ε= 2 l ( w ) 2 k we find that there exists n 0 N such that

2 l ( u n , w ) 2 l ( u n ) <ε
(11)

for all n n 0 . Since kl( u n ) and l ( u n ,w)l(w) for all n n 0 we obtain from inequality (11)

2 l ( w ) 2 k 2 l ( u n , w ) 2 l ( u n ) <ε,

which is a contradiction. So kl(w).

Next we show that w m = c m for all 1mk. To this end, assume that there exists k 0 N with k 0 <k such that w m = c m for all m k 0 and w k 0 + 1 c k 0 + 1 . We distinguish two possible cases:

Case 1. w k 0 + 1 < c k 0 + 1 . It is clear that 2 l ( w , u n ) = 2 k 0 for all n. Taking ε= 2 k 0 2 l ( w ) we have guaranteed the existence of n 0 N such that

2 l ( w , u n ) 2 l ( w ) <ε
(12)

for all n n 0 , since ( u n ) n N converges to w in ( Σ , d q B s ). Hence

2 k 0 2 l ( w ) = 2 l ( w , u n ) 2 l ( w ) <ε

which is impossible.

Case 2. w k 0 + 1 > c k 0 + 1 . Then, given ε= 2 k , there exists n 0 N such that

2 l ( u n , w ) 2 l ( u n ) <ε
(13)

for all n n 0 . Whence

2 k 0 2 l ( u n ) < 2 k

for all n n 0 . Hence

2 k 0 < 2 k + 2 l ( u n ) 2 k + 1 .

It follows that k+1 k 0 <k, which is impossible.

Consequently w m = c m for all 1mk and, thus, w Σ c , k . Therefore Σ c , k is closed in ( Σ , d q B s ). □

Lemma 8 Let f be a mapping from a complete partial quasi-metric space (X,q) into itself such that there is s[0,1[ satisfying

q ( f ( x ) , f ( y ) ) sq(x,y),
(14)

for all x,yX. Then f has a unique fixed point x. Moreover, the following assertions hold:

  1. (1)

    If there exists yX such that q(f(y),y)=0 then q(x,y)=0.

  2. (2)

    If there exists yX such that q(y,f(y))=0 then q(y,x)=0.

Proof First of all we note that the existence and uniqueness of the fixed pointx of f is guaranteed by Theorem 4.

(1) Assume for the purpose of contradiction that q(x,y)>0. Then the inequality (14) yields

q ( x , y ) q ( x , f ( y ) ) + q ( f ( y ) , y ) q ( f ( y ) , f ( y ) ) q ( x , f ( y ) ) = q ( f ( x ) , f ( y ) ) s q ( x , y ) .

It follows that 1s<1, which is a contradiction.

(2) Similar arguments to those given in the proof of (1) apply to the proof of assertion (2). □

The next result provides the mathematical foundations for the fixed-point techniqueuseful for analyzing the complexity class of recursive algorithms whose running time ofcomputing satisfies the recurrence equation (8).

Theorem 9 Let Σ=(0,] and kN. Fix a 1 , c 1 , a 2 , c 2 ,, a k , c k Σ and z Σ with l(z)= and z m for all mN and mk+1. Let Φ z : Σ c , k Σ c , k be the mapping defined by

( Φ z ( x ) ) m := { c m if  1 m k , i = 1 k a i x m i + z m if  k + 1 m l ( x ) + 1 .

Then the following assertions hold:

  1. (1)

    Φ z has a unique fixed point w Σ c , k .

  2. (2)

    l(w)=.

  3. (3)

    If u Σ c , k such that Φ z (u) s p u, then w s p u.

  4. (4)

    If v Σ c , k , then v s p w provided that l(v)= and v s p Φ z (v).

Proof The completeness of the Baire partial quasi-metric space( Σ , q B ) shows that the quasi-metric space ( Σ , d q B ) is bicomplete. Moreover, by Lemma 7, we see that the set Σ c , k is closed in ( Σ , d q B s ). Thus the quasi-metric space ( Σ c , k , d q B ) is bicomplete. Whence we deduce that the partial quasi-metricspace ( Σ c , k , q B ) is complete. Furthermore, it is a straightforward computationto check that the mapping Φ z : Σ c , k Σ c , k obeys the following inequality:

q B ( Φ z ( u ) , Φ z ( v ) ) 1 2 k + 1 1 2 q B (u,v)

for all u,v Σ c , k . It follows, by Theorem 4, that Φ z has a unique fixed point w Σ c , k with q B (w,w)=0. Hence l(w)=. So we have proved statements (1) and (2).

Now assume the existence of u Σ c , k such that Φ z (u) s p u. It follows, by construction of Φ z , that l(u)=l( Φ z (u))=. Since Φ z (u) s p u we obtain q B ( Φ z (u),u)=0. Hence, by assertion (1) in statement of Lemma 8, wefind that q B (w,u)=0. Whence we deduce that l (w,u)= and, hence, that w s p u. This proves statement (3).

Finally, assume the existence of v Σ c , k such that l(v)=. It follows that l( Φ z (v))=. Since v s p Φ z (v) we deduce that q B (v, Φ z (v))=0. Hence, by assertion (2) in statement of Lemma 8, wefind that q B (v,w)=0. Whence we deduce that v s p w. This proves statement (4). □

We must emphasize that taking k=1 and a 1 =1 in statement of Theorem 9 we retrieve, as a particularcase, Theorem 5. Moreover, setting k=1 and a 1 =a for any aN with a>1 in statement of Theorem 9 we obtain the followingcorollary.

Corollary 10 Let Σ=(0,]. Fix a,cΣ and z Σ with a>1, l(z)= and z k for all kN and k2. Let Σ c be the subset of Σ given by Σ c :={y Σ :1l(y) and  y 1 =c} and let Φ z : Σ c Σ c be the mapping defined by

( Φ z ( x ) ) m := { c if  m = 1 , a x m 1 + z m if  2 m l ( x ) + 1 .

Then the following assertions hold:

  1. (1)

    Φ z has a unique fixed point w Σ c .

  2. (2)

    l(w)=.

  3. (3)

    If u Σ c such that Φ z (u) s p u, then w s p u.

  4. (4)

    If v Σ c , then v s p w provided that l(v)= and v s p Φ z (v).

Next we want to emphasize that the Divide and Conquer recurrence equation (2) can betransformed into the recurrence equation

S(m)= { c if  m = 1 , a S ( m 1 ) + r ( m ) if  m > 1 ,
(15)

where S(m)=T( b m 1 ) and r(m)=h( b m 1 ) for all mN (recall that N b ={ b k :kN} with bN and b>1).

Therefore Corollary 10, and with it Theorem 9, retrieve as a particular caseTheorem 6 given in [4], which was obtained with the aim of analyzing the asymptotic complexity ofthose algorithms with running time of computing satisfying the recurrence equation (2) bymeans of fixed-point arguments based on the Baire partial quasi-metric space. In thisdirection, Theorem 9 allows us to unify Theorem 5 and Theorem 6 and, hence,to obtain a unique fixed-point technique, via the Baire partial quasi-metric space, forthe mathematical foundation of the asymptotic complexity analysis of those algorithmswhose running time leads in a natural way to recurrence equations of the type of equations(2), (6), and (16), where

T(n)= { c if  n = 1 , a T ( n 1 ) + h ( n ) if  n 2 ,
(16)

with a>1, c>0, and hRT such that h(n)< for all nN.

Notice that the recurrence equation (9) associated to Hanoi is a concrete case ofequation (16). Besides, celebrated examples of algorithms whose running time of computinglead to the recurrence equations (2) and (16) are, for instance, Mergesort and Quicksort(for more details see [5] and [14]).

3.2 The application to asymptotic complexity analysis

Notice that Theorem 9 yields a new fixed-point technique to analyze the complexityclass of all those algorithms whose running time of computing satisfies the recurrenceequation (8). Indeed, we associate to the recurrence equation (8) the functional Γ T : RT c , k RT c , k defined by

Γ T (f)(n)= { c n if  1 n k , i = 1 k a i f ( n i ) + h ( n ) if  n > k .
(17)

Then Theorem 9 provides, in a very easy way without involving arduous computations,the promised asymptotic complexity technique, Theorem 11, to determine the asymptoticcomplexity (upper and lower) bounds, and thus the complexity class, of the running time ofthose algorithms under study.

Theorem 11 A recurrence equation of the form (8) has a unique solution f T RT c , k . Moreover, if there exist g,h RT c , k such that Γ T (g)g and h Γ T (h), then f T Ω(h)O(g). Furthermore, f T Θ(l) provided that there exist c,d>0 and l RT c , k in such a way that the preceding functions g, h satisfy h(n)=cl(n) and g(n)=dl(n) for all nN.

Proof Let w Σ c , k be the fixed point of the mapping Φ z ensured by Theorem 9. Now, define f w RT c , k by f w (n)= w n for all nN. Then we immediately see that f w is the unique solution to the recurrence equation (8). So f w can be identified with the running time of computing of arecursive algorithm satisfying the recurrence equation (8), say f T . Of course, f T (n)= f w (n)= w n for all nN.

Next assume that there exists g RT c , k such that Γ T (g)g. Then we identify such a function with a word u g Σ c , k which is defined by u n g =g(n) for all nN. It is obvious that Φ z ( u g ) s p u g . It follows, by Theorem 9, that w s p u g . Hence we have showed that f w O(g) or, equivalently, that f T O(g).

Now suppose that there exists h RT c , k such that h Γ T (h). Then we identify such a function with a word v h Σ c , k which is defined by v n h =h(n) for all nN. Clearly l( v h )= and v h s p Φ z ( v h ). By Theorem 9 we obtain v h s p w. Whence we deduce that h f w and, hence, that f w Ω(h) or, equivalently, that f T Ω(h).

Finally, assume that there exist c,d>0 and l RT c , k such that the function g,h satisfy g(n)=cl(n) and h(n)=dl(n) for all nN. Since Γ T (g)g and h Γ T (h) we have f w Ω(h)O(g). It follows that f w Ω(l)O(l). Consequently f w Θ(l). Thus f T Θ(l). □

Observe that, although Theorem 5 can be obtained from Theorem 9, the lattergives a few more information about the running time of computing under consideration thanthe former. This is due to the fact that the assertion (4) in statement of Theorem 9allows to determine the lower asymptotic complexity bound for algorithms whose runningtime obeys equation (6) while that Theorem 5 does not allow one to do this.Consequently, the version of Theorem 5 retrieved from Theorem 9 improvesTheorem 5. So the new fixed-point result is clearly a non-trivial extension of theold one.

Furthermore, it must be stressed that a first attempt to apply fixed-point techniquesbased on the use of words to complexity analysis of algorithms was made in [17] by means of the so-called Baire balanced quasi-metric. However, theaforementioned quasi-metric fixed-point technique was only able to provide the existenceand uniqueness of solution to recurrence equations and not the complexity class. So, insome sense, our new technique improves those given in [17], since Theorem 9 allows to obtain the asymptotic complexity class of thesolution to a recurrence equation associated to an algorithm and, thus, the complexityclass of its running time of computing.

In order to help the reader to glimpse the utility of Theorem 11, and with it alsoof Theorem 9, we end the paper showing that, like the Schellekens approach, thedeveloped theory is helpful in providing the asymptotic complexity class of the recursivealgorithms whose running time satisfies the recurrence equation (8). In particular, weapply Theorem 11 to the analysis of Hanoi and Fibonacci, retrieving their well-knownasymptotic complexity class [14].

Hanoi As mentioned before, the running time of computing of Hanoi matches up withthe solution, under the uniform cost criterion assumption (see [14]), to the recurrence equation (9). Of course, such a recurrence equation can beretrieved from equation (8) as a particular case when we put k=1, c 1 =c, a 1 =2 and h(n)=d for all nN. Consider the functional associated with equation (9) andgiven by equation (17) as follows:

Γ T H (f)(n)= { c if  n = 1 , 2 f ( n 1 ) + d if  n 2 ,
(18)

for all f RT c , 1 . Then Theorem 11 yields the existence and uniqueness of thesolution f T H (in RT c , 1 ), which obviously represents the running time of computing ofHanoi, to the above recurrence equation.

It is a straightforward computation to check that Γ T H (g)g for any g RT c , 1 if and only if g(1)=c and g(n) 2 n 1 (d+c)d for all nN with n2. Thus, by Theorem 11, we deduce that f T H O(g), where

g(n)= { c if  n = 1 , 2 n 1 ( d + c ) d if  n 2 .
(19)

Moreover, it is not hard to check that h Γ T H (h) for any h RT c , 1 if and only if h(1)=c and h(n) 2 n 1 (d+c)d for all nN with n2. Thus, by Theorem 11, we deduce that f T H Ω(h), where

h(n)= { c if  n = 1 , 2 n 1 ( d + c ) d if  n 2 .
(20)

Accordingly, by Theorem 11, we obtain f T H Ω(h)O(g) with g and h given by equations (19) and(20), respectively. Since g=h we conclude, by Theorem 11, that f T H Θ(g). Therefore we have proved the following result.

Corollary 12 The complexity class of the running time of computing of Hanoi is Θ( 2 n 1 ).

Fibonacci As we have exposed above, the running time of computing of Fibonacci isthe solution to the recurrence equation (10). Clearly, such a recurrence equation can beretrieved from equation (8) as a particular case when we put k=2, a 1 = a 2 =1, c 1 =2c, c 2 =3c and h(n)=4c for all nN. Consider the functional associated with equation (10) andgiven by equation (17) as follows:

Γ T F (f)(n)= { 2 c if  n = 1 , 3 c if  n = 2 , f ( n 1 ) + f ( n 2 ) + 4 c if  n > 2 ,

for all f RT c , 2 . Then Theorem 11 yields the existence and uniqueness of thesolution f T F (in RT c , 2 ), which obviously represents the running time of computing ofFibonacci, to the above recurrence equation.

In order to guess the asymptotic bounds we fix r>0 and α>0 and define the function g α , r RT c , 2 by

g α , r (n)= { 2 c if  n = 1 , 3 c if  n = 2 , r α n if  n > 2 .

In what follows we denote the value 1 + 5 2 by ϕ. It is a straightforward computation tocheck that Γ T F ( g α , r ) g α , r if and only if α>ϕ and r 4 c ϕ 3 ϕ 2 ϕ . Then, by Theorem 11, f T H O( g α , r ) for all α>ϕ and r 4 c ϕ 3 ϕ 2 ϕ . Hence, taking α=1.619, we immediately have f T F O( g 1.619 , 4 c ϕ 3 ϕ 2 ϕ ).

Moreover, it is not hard to check that g α , r Γ T F ( g α , r ) if and only if αϕ for all r>0. It follows, by Theorem 11, that f T F Ω( g α , r ) for all αϕ and all r>0. Hence, taking α=ϕ, we obtain f T F Ω( g ϕ , r ).

Consequently, by Theorem 11, we obtain f T F Ω( g ϕ , r )O( g 1.619 , 4 c ϕ 3 ϕ 2 ϕ ) for all r>0. Therefore we have proved the following result.

Corollary 13 The running time of computing of Fibonacci belongs to the complexity class Ω( ( 1.618 ) n )O( ( 1.619 ) n ).

Observe that the fact that the running time of computing is in Ω( ( 1.618 ) n )O( ( 1.619 ) n ) guarantees that any other function, different from g α , r , chosen to determine the complexity class of f T F would not be able to provide the suitable lower and upperasymptotic bounds at the same time.

References

  1. Matthews SG: Partial metric topology. Ann. N.Y. Acad. Sci. 1994, 728: 183–197. 10.1111/j.1749-6632.1994.tb44144.x

    Article  MathSciNet  Google Scholar 

  2. Matthews SG: An extensional treatment of lazy data flow deadlock. Theor. Comput. Sci. 1995, 151: 195–205. 10.1016/0304-3975(95)00051-W

    Article  MathSciNet  MATH  Google Scholar 

  3. Schellekens MP: The Smyth completion: a common foundation for denotational semantics and complexityanalysis. Electron. Notes Theor. Comput. Sci. 1995, 1: 211–232.

    Article  MathSciNet  Google Scholar 

  4. Cerdà-Uguet MA, Schellekens MP, Valero O: The Baire partial quasimetric space: a mathematical tool for the asymptotic complexityanalysis in computer science. Theory Comput. Syst. 2012, 50: 387–399. 10.1007/s00224-010-9310-7

    Article  MathSciNet  MATH  Google Scholar 

  5. Brassard G, Bratley P: Algorithms: Theory and Practice. Prentice Hall, New Jersey; 1988.

    Google Scholar 

  6. Künzi HPA: Nonsymmetric distances and their associated topologies: about the origins of basicideas in the area of asymmetric topology. 3. In Handbook of the History of General Topology. Edited by: Aull CE, Lowen R. Kluwer Academic, Dordrecht; 2001:853–968.

    Chapter  Google Scholar 

  7. Romaguera S, Schellekens MP: Quasi-metric properties of complexity spaces. Topol. Appl. 1999, 98: 311–322. 10.1016/S0166-8641(98)00102-3

    Article  MathSciNet  MATH  Google Scholar 

  8. Scott DS: Outline of a mathematical theory of computation. Proc. 4th Annual Princeton Conference on Information Sciences and Systems 1970, 169–176.

    Google Scholar 

  9. Oltra S, Romaguera S, Sánchez-Pérez EA: Bicompleting weightable quasi-metric spaces and partial metric spaces. Rend. Circ. Mat. Palermo 2002, 51: 151–162. 10.1007/BF02871458

    Article  MathSciNet  MATH  Google Scholar 

  10. Alghamdi MA, Shahzad N, Valero O: Fixed point theorems in generalized metric spaces with applications to computerscience. Fixed Point Theory Appl. 2013., 2013: Article ID 118

    Google Scholar 

  11. Künzi HPA, Pajooshesh H, Schellekens MP: Partial quasi-metrics. Theor. Comput. Sci. 2006, 365: 237–246. 10.1016/j.tcs.2006.07.050

    Article  MATH  Google Scholar 

  12. Karapinar E, Erhan IM, Öztürk A: Fixed point theorems on quasi-partial metric spaces. Math. Comput. Model. 2013, 57: 2442–2448. 10.1016/j.mcm.2012.06.036

    Article  MATH  Google Scholar 

  13. Shoaib A, Arshad M, Ahmad J: Fixed point results of locally contractive mappings in ordered quasi-partial metricspaces. Sci. World J. 2013., 2013: Article ID 194897

    Google Scholar 

  14. Cull P, Flahive M, Robson R: Difference Equations: From Rabbits to Chaos. Springer, New York; 2005.

    Google Scholar 

  15. Romaguera S, Tirado P, Valero O: New results on mathematical foundations of asymptotic complexity analysis of algorithmsvia complexity spaces. Int. J. Comput. Math. 2012, 89: 1728–1741. 10.1080/00207160.2012.659246

    Article  MathSciNet  MATH  Google Scholar 

  16. Romaguera S, Valero O: A common mathematical framework for asymptotic complexity analysis and denotationalsemantics for recursive programs based on complexity spaces. 1. In Semantics-Advances in Theories and Mathematical Models. Edited by: Afzal MT. InTech, Rijeka; 2012:99–120.

    Google Scholar 

  17. Rodríguez-López J, Romaguera S, Valero O: Denotational semantics for programming languages, balanced quasi-metrics and fixedpoints. Int. J. Comput. Math. 2008, 85: 623–630. 10.1080/00207160701210653

    Article  MathSciNet  MATH  Google Scholar 

Download references

Acknowledgements

This work was funded by the Deanship of Scientific Research (DSR), King AbdulazizUniversity, Jeddah, under grant No. 363-002-D1434. The authors, therefore acknowledge withthanks DSR for technical and financial support.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Naseer Shahzad.

Additional information

Competing interests

The authors declare that they have no competing interests.

Authors’ contributions

All authors contributed equally and took part in every discussion. All authors read andapproved the final manuscript.

Rights and permissions

Open Access This article is distributed under the terms of the Creative Commons Attribution 2.0 International License ( https://creativecommons.org/licenses/by/2.0 ), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Reprints and permissions

About this article

Cite this article

Alghamdi, M.A., Shahzad, N. & Valero, O. New results on the Baire partial quasi-metric space, fixed point theory and asymptoticcomplexity analysis for recursive programs. Fixed Point Theory Appl 2014, 14 (2014). https://doi.org/10.1186/1687-1812-2014-14

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1186/1687-1812-2014-14

Keywords