0 A Common Mathematical Framework for Asymptotic Complexity Analysis and Denotational Semantics for Recursive Programs Based on Complexity Spaces

Most programming languages allow to construct recursive algorithms by means of a recursive definition expressing the meaning of such a definition in terms of its own meaning. In order to analyze the correctness of such recursive definitions, D.S. Scott developed a mathematical theory of computation which is based on ideas from order theory and topology (Davey & Priestley, 1990; Scott, 1970; 1972). From the Scott theory viewpoint, the meaning of such a denotational specification is obtained as the fixed point of a nonrecursive mapping, induced by the denotational specification, which is at the same time the topological limit of successive iterations of the nonrecursive mapping acting on a distinguished element of the model. Moreover, the order of Scott’s model represents some notion of information so that each iteration of the nonrecursive mapping, which models each step of the program computation, is identified with an element of the mathematical model which is greater than (or equal to) the other ones associated with the preceding iterations (preceding steps of the program computation) because each iteration gives more information about the meaning than those computed before. Hence the aforesaid meaning of the recursive denotational specification is modeled as the fixed point of the nonrecursive mapping which is obtained as the limit, with respect to the so-called Scott topology, of the increasing sequence of successive iterations. Consequently, the fixed point captures the amount of information defined by the increasing sequence, i.e. the fixed point yields the total information about the meaning provided by the elements of the increasing sequence, and it does not contain more information than can be obtained from the elements of such a sequence.


Introduction
In Denotational Semantics one of the aims consists of giving mathematical models of programming languages so that the meaning of a recursive algorithm can be obtained as an element of the constructed model.
Most programming languages allow to construct recursive algorithms by means of a recursive definition expressing the meaning of such a definition in terms of its own meaning.In order to analyze the correctness of such recursive definitions, D.S. Scott developed a mathematical theory of computation which is based on ideas from order theory and topology (Davey & Priestley, 1990;Scott, 1970;1972).From the Scott theory viewpoint, the meaning of such a denotational specification is obtained as the fixed point of a nonrecursive mapping, induced by the denotational specification, which is at the same time the topological limit of successive iterations of the nonrecursive mapping acting on a distinguished element of the model.Moreover, the order of Scott's model represents some notion of information so that each iteration of the nonrecursive mapping, which models each step of the program computation, is identified with an element of the mathematical model which is greater than (or equal to) the other ones associated with the preceding iterations (preceding steps of the program computation) because each iteration gives more information about the meaning than those computed before.Hence the aforesaid meaning of the recursive denotational specification is modeled as the fixed point of the nonrecursive mapping which is obtained as the limit, with respect to the so-called Scott topology, of the increasing sequence of successive iterations.Consequently, the fixed point captures the amount of information defined by the increasing sequence, i.e. the fixed point yields the total information about the meaning provided by the elements of the increasing sequence, and it does not contain more information than can be obtained from the elements of such a sequence.A typical and illustrative example of such recursive definitions is given by those recursive algorithms that compute the factorial of a nonnegative integer number by means of the following recursive denotational specification: (1) Of course the above denotational specification has the drawback that the meaning of the symbol fact is expressed in terms of itself.Hence the symbol fact can not be replaced by its meaning in the denotational specification (1), since the meaning, given by the right-hand side in (1), also contains the symbol.Following the original ideas of Scott, the meaning of the specification (1), i.e. the entire factorial function, is obtained as the unique total function that is a fixed point of the nonrecursive functional φ f act defined on the set of partial functions ordered by extension (see (Davey & Priestley, 1990) for a detailed description of the set of partial functions) by where the successive iterations acting over the partial function f 1 (dom f 1 = 1 and f 1 (1)=1) hold that φ n f act f 1 (m)=1i fm = 1 and φ n f act f 1 (m)=m!for all m ≤ n.Thus, the increasing with respect to the extension order sequence of iterations (φ n f act ( f 1 )) n∈N models each step of the computation of the factorial of a nonnegative integer number by a recursive algorithm using the specification (1) and, in addition, the limit of the sequence with respect to the Scott topology is exactly the meaning of the symbol fact which provides the factorial of each nonnegative integer number.Furthermore, each iteration provides more information about the symbol fact (i.e. about the entire factorial function) than the preceding ones.Since Scott's mathematical theory of computation was introduced, it has been wondered in the literature whether such a model can be applied to other fields of Computer Science which differ from Denotational Semantics.A positive answer to the posed question was provided by M.P. Schellekens in (Schellekens, 1995).In fact, Schellekens showed that the original Scott idea of getting, via fixed point techniques, the meaning of a denotational specification as the topological limit of "successive approximations" is helpful in Asymptotic Complexity Analysis.Concretely, Schellekens introduced a novel mathematical method to provide asymptotic upper bounds of the complexity of those algorithms whose running time of computing satisfies a recurrence equation of Divide and Conquer type in such a way that the original ideas of Scott, namely, the meaning is a fixed point and is the limit of a sequence of successive iterations of a functional acting on a distinguished element, are respected but now the fixed point technique is new.Furthermore, in Schellekens' method the topology, intrinsic to the Scott model, is induced by a "distance" tool which provides, in addition, a measure of the degree of approximation of the elements that form the model.This fact yields an advantage over the Scott model because in the latter one quantitative data approach is not available.
Motivated by the fact that Schellekens' method successfully applies the Scott ideas for Denotational Semantics to the asymptotic complexity analysis of algorithms and that, in addition, the aforesaid method improves the Scott one in the sense that it allows to provide quantitative information, not only qualitative, about the degree of approximation of the elements that form the model, the propose of this chapter is twofold.
On one hand, we will show that Schellekens' method, and thus the original ideas of Scott, is useful to obtain asymptotic upper bounds of complexity for a class of recursive algorithms whose running time of computing leads to recurrence equations different from the Divide and Conquer ones.Moreover, we improve the original Schellekens's method by introducing a new fixed point technique which allows to obtain lower asymptotic bounds for the running time of computing of the aforesaid algorithms.We will illustrate and validate the developed method applying our results to provide the asymptotic complexity (upper and lower bounds) of the running time of computing of a celebrated recursive algorithm that computes the Fibonacci sequence (see, for instance, (Cull et al., 1985)).
On the other hand, we will introduce a generalized mathematical method, in the spirit of Schellekens and based on the mathematical approach given in (Romaguera & Schellekens, 2000), which will be useful to formally describe the running time of computing of algorithms that perform a computation using recursive denotational specifications and the meaning, and thus the correctness, of such a denotational specification simultaneously.In order to validate the new results we will apply them to provide, at the same time, the program correctness and the asymptotic complexity class (upper and lower bounds) of the running time of a recursive program that computes the factorial function via the denotational specification (1).
The remainder of the chapter is organized as follows: In Section 2 we recall a few pertinent concepts from asymptotic complexity analysis of algorithms.Section 3 is devoted to introduce the method of Schellekens, and its relationship to the above exposed Scott ideas, which provides an upper bound of the asymptotic complexity for those algorithms whose running time of computing leads to a Divide and Conquer recurrence equation.The utility of the method is illustrated by means of the application given by Schellekens to obtain an asymptotic upper bound of the average running time of computing of Mergesort.In order to analyze the complexity of the recursive algorithm that computes the Fibonacci sequence via the Schellekens approach, in Section 4 we will introduce the new method based on successive approximations and fixed point techniques that allow us to describe the complexity class (asymptotic upper and lower bounds) for the running time of computing of recursive algorithms more general than the Divide and Conquer ones.Moreover, in Section 5 we give the generalized mathematical method which is useful to describe formally the running time of computing of algorithms that perform a computation using recursive denotational specifications as well as their program correctness .Finally, in Section 6 we summarize the aims achieved and the advantages of our new mathematical methodologies with respect to the Schellekens and Scott ones.

Fundamentals of Asymptotic Complexity Analysis
From now on, the letters R + and N will denote the set of nonnegative real numbers and the set of positive integer numbers, respectively.
Our basic reference for complexity analysis of algorithms is (Brassard & Bratley, 1988).
In Computer Science the complexity analysis of an algorithm is based on determining mathematically the quantity of resources needed by the algorithm in order to solve the problem for which it has been designed.

101
A Common Mathematical Framework for Asymptotic Complexity Analysis and Denotational Semantics for Recursive Programs Based on Complexity Spaces A typical resource, playing a central role in complexity analysis, is the running time of computing.Since there are often many algorithms to solve the same problem, one objective of the complexity analysis is to assess which of them is faster when large inputs are considered.To this end, it is required to compare their running time of computing.This is usually done by means of the asymptotic analysis in which the running time of an 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 the problem under consideration when the input of the algorithm is of size n.Of course the running time of an algorithm does not only depend on the input size n, but it depends also on the particular input of the size n (and the distribution of the data).Thus the running time of an algorithm is different when the algorithm processes certain instances of input data of the same size n.As a consequence, it is usually necessary to distinguish three possible behaviors when the running time of an algorithm is discussed.These are the so-called best case, the worst case and the average case.The best case and the worst case for an input of size n are defined by the minimum and the maximum running time of computing over all inputs of size n, respectively.The average case for an input of size n is defined by the expected value or average running time of computing over all inputs of size n.
In general, given an algorithm, to determine exactly the function which describes its running time of computing is an arduous task.However, in most situations is more useful to know the running time of computing of an algorithm in an "approximate" way than in an exact one.For this reason the Asymptotic Complexity Analysis focus its interest on obtaining the "approximate" running time of computing.
In order to recall the notions from Asymptotic Complexity Analysis which will be useful for our aim later on, let us assume that f : N → (0, ∞] denotes the running time of computing of a certain algorithm under study.Moreover, consider that there exists a function g : N → (0, ∞] such that there exist, simultaneously, n 0 ∈ N and c ∈ R + satisfying f (n) ≤ cg(n) for all n ∈ N with n ≥ n 0 (≤ and ≥ stand for the usual orders on R + ).Then, the function g provides an asymptotic upper bound of the running time of the studied algorithm.Hence, if we do not know the exact expression of the function f , then the function g gives an "approximate" information of the running time of the algorithm for each input size n, f (n), in the sense that the algorithm takes a time to process the input data of size n bounded above by the value g(n).Following the standard notation, when g is an upper asymptotic bound of f we will write f ∈O(g).
In the analysis of the complexity of an algorithm, besides obtaining an upper asymptotic bound, it is useful to assess an asymptotic lower bound of the running time of computing.In this case the Ω-notation plays a central role.Indeed, the statement f ∈ Ω(g) means that there exist n 0 ∈ N and c ∈ R + such that cg(n) ≤ f (n) for all n ∈ N with n ≥ n 0 .Of course, and similarly to the O-notation case, when the time taken by the algorithm to process an input data of size n, f (n), is unknown, the function g yields an "approximate" information of the running time of the algorithm in the sense that the algorithm takes a time to process the input data of size n bounded below by g(n).
Of course, when the complexity of an algorithm is discussed, the best situation matches up with the case in which we can find a function g : N → (0, ∞] in such a way that the running time f holds the condition f ∈O (g) ∩ Ω(g), denoted by f ∈ Θ(g), since, in this case, we obtain a "tight "asymptotic bound of f and, thus, a total asymptotic information about the time taken by the algorithm to solve the problem under consideration (or equivalently to process the input data of size n for each n ∈ N).From now on, we will say that f belongs to the asymptotic complexity class of g whenever f ∈ Θ(g).
In the light of the above, from an asymptotic complexity analysis viewpoint, to determine the running time of an algorithm consists of obtaining its asymptotic complexity class.

Quasi-metric spaces and Asymptotic Complexity Analysis: the Schellekens approach
In 1995, Schellekens introduced a new mathematical framework, now known as the Complexity Space, with the aim to contribute to the topological foundation for the Asymptotic Complexity Analysis of Algorithms via the application of the original Scott ideas for Denotational Semantics, that is via the application of fixed point and successive approximations reasoning, (Schellekens, 1995).This framework is based on the notion of a quasi-metric space.
Following (Künzi, 1993), a quasi-metric on a nonempty set X is a function d : X × X → R + such that for all x, y, z ∈ X : Of course a metric on a nonempty set X is a quasi-metric d on X satisfying, in addition, the following condition for all x, y ∈ X: (iii) d(x, y)=d(y, x).
A quasi-metric space is a pair (X, d) such that X is a nonempty set and d is a quasi-metric on X.
Each quasi-metric d on X generates a T 0 -topology T (d) on X which has as a base the family of open d-balls Given a quasi-metric d on X, the function d s defined on X × X by is a metric on X.
A quasi-metric space (X, d) is called bicomplete whenever the metric space (X, d s ) is complete.
A well-known example of a bicomplete quasi-metric space is the pair ((0, ∞], u −1 ), where Obviously we adopt the convention that 1 ∞ = 0.The quasi-metric space ((0, ∞], u −1 ) plays a central role in the Schellekens framework.Indeed, let us recall that the and d C is the quasi-metric (so-called complexity distance) on C defined by According to (Schellekens, 1995), since every reasonable algorithm, from a computability viewpoint, must hold the "convergence condition" it is possible to associate each algorithm with a function of C in such a way that such a function represents, as a function of the size of the input data, its running time of computing.Motivated by this fact, the elements of C are called complexity functions.Moreover, given two functions f , g ∈C, the numerical value d C ( f , g) (the complexity distance from f to g) can be interpreted as the relative progress made in lowering the complexity by replacing any algorithm P with complexity function f by any algorithm Q with complexity function g.Therefore, if f = g, the condition d C ( f , g)=0 can be read as f is "at least as efficient" as g on all inputs (note that Notice that the asymmetry of the complexity distance d C plays a central role in order to provide information about the increase of complexity whenever an algorithm is replaced by another one.A metric will be able to yield information on the increase but it, however, will not reveal which algorithm is more efficient. The utility of the complexity space in complexity analysis of algorithms was also illustrated by Schellekens in (Schellekens, 1995).In particular, he introduced a mathematical method to provide asymptotic upper bounds of the running time of computing for Divide and Conquer algorithms.To this end, Schellekens used the below fixed point theorem which is a quasi-metric version of the celebrate Banach's fixed point theorem.
Theorem 1.Let f be a contractive mapping from a bicomplete quasi-metric space (X, d) into itself with contractive constant s.Then f has a unique fixed point x 0 and, in addition, lim n→∞ f n (x)=x 0 for all x ∈ X.
Let us remark that a mapping f from a quasi-metric space (X, d) into itself it is called contractive provided that there exists s ∈ [0, 1) such that for all x, y ∈ X d( f (x), f (y)) ≤ sd(x, y).
In this case, s is called a contractive constant of f .Next we recall the aforenamed method with the aim of motivating our subsequent work, given in Sections 4 and 5.
where N b = {b k : k ∈ N}, c > 0 denotes the complexity on the base case (i.e. the problem size is small enough and the solution takes constant time), and h(n) represents the time taken by the algorithm in order to divide the original problem into a subproblems and to combine all subproblems solutions into a unique one (h ∈Cwith h(n) < ∞ for all n ∈ N).
Notice that for Divide and Conquer algorithms, it is typically sufficient to obtain the complexity on inputs of size n with n ranges over the set N b (see (Brassard & Bratley, 1988) for a fuller description).
Mergesort (in all behaviors) and Quicksort (in the best case behavior) are typical and well-known examples of Divide and Conquer algorithms whose running time of computing satisfies the recurrence equation ( 2) (we refer the reader to (Brassard & Bratley, 1988) and (Cull et al., 1985) for a detailed discussion about the both aforasaid algorithms).
In order to provide the asymptotic behavior of the running time of computing of a Divide and Conquer algorithm satisfying the recurrence equation ( 2), it is necessary to show that such a recurrence equation has a unique solution and, later, to obtain the asymptotic complexity class of such a solution.The method introduced by Schellekens allows us to show that the equation ( 2) has a unique solution, and provides an upper asymptotic complexity bound of the solution in the following way: Denote by C b,c the subset of C given by Since the quasi-metric space (C, d C ) is bicomplete (see Theorem 3 and Remark in page 317 of (Romaguera & Schellekens, 1999)) and the set C b,c is closed in (C, Next we associate a functional Φ T : C b,c −→ C b,c with the Divide and Conquer recurrence equation (2) as follows: Of course a complexity function in C b,c is a solution to the recurrence equation (2) if and only if it is a fixed point of the functional Φ T .Under these conditions, Schellekens proved (Schellekens, 1995) that In order to obtain the asymptotic upper bound of the solution to the recurrence equation ( 2), Schellekens introduced a special class of functionals known as improvers.
Observe that an improver is a functional which corresponds to a transformation on algorithms in such a way that the iterative applications of the transformation yield, from a complexity point of view, an improved algorithm at each step of the iteration.
Taking into account the exposed facts, Schellekens stated the following result in (Schellekens, 1995).
Theorem 2. A Divide and Conquer recurrence of the form (2) has a unique solution f T in C b,c suh that lim n→∞ Φ n T (g)= f T for all g ∈C b,c .Moreover, if the functional Φ T associated with ( 2) is an improver with respect to some function g ∈C b,c , then the solution to the recurrence equation satisfies that f T ∈O(g).
Of course the preceding theorem states a few relationships between the Schellekens framework and the Scott one (see Section 1).Concretely, the solution to a recurrence equation of type ( 2) is the fixed point f T ∈C b,c of the nonrecursive functional Φ T , which can be seen as the topological limit of the sequence of the successive iterations (Φ n T (g)) n∈N where Φ T is an improver with respect to g ∈C b,c .Note that in this case the functional Φ T plays the role of the nonrecursive functional φ f act introduced in Section 1 and that the role of meaning of the factorial recursive denotational specification, i.e. the factorial function, is now played by the running time of computing f T .Moreover, the facts that functional Φ T is an improver and ) yield that each iteration gives more information about the solution to the recurrence equation (the running time of computing) than the preceding ones and, in addition, one has that the information about the running time of computing of the algorithm under study is exactly that which can be obtained from the elements of such a sequence.Hence the role of the distinguished element f 1 and the successive approximations sequence (φ n ( f 1 )) n∈N of the Scott framework, is now played by the sequence of improved running time versions of the Divide and Conquer algorithm under study, (Φ n T (g)) n∈N ,a n d the complexity function g ∈C b,c with respect to which the nonrecursive functional Φ T is an improver.These analogies between the Schellekens and Scott techniques give relevance to the former one with respect to the standard and classical techniques to analyze the complexity of algorithms.Simultaneously, the framework based on the complexity space presents an advantage with respect to the Scott one.Indeed, the framework of Schellekens counts on a topology induced by a quasi-metric (the complexity distance) which allows to measure the information about the fixed point of the nonrecursive functional contained in each element of the sequence of successive approximations and the framework of Scott has not available, in general, quantitative data approach.
In order to validate Theorem 2 and to illustrate its usefulness, Schellekens obtained an upper asymptotic bound of the running time of Mergesort (in the average case behavior).In this particular case, the Mergesort running time of computing satisfies the following particular 106 Semantics -Advances in Theories and Mathematical Models www.intechopen.comcase of recurrence equation (2): It is clear that Theorem 2 shows that the recurrence equation ( 5) has a unique solution f M T in C 2,c .In addition, it is not hard to check that the functional Φ T induced by the recurrence equation ( 5), and given by (3), is an improver with respect to a complexity function g k ∈ C 2,c (with k > 0, g k (1)=c and g k (n)=kn log 2 n for all n ∈ N 2 ) if and only if k ≥ 1 2 .Note that under the assumption that the functional Φ in (3) is monotone, this is the case for the functional Φ T induced by ( 5), to show that Φ T is an improver with respect to f ∈ C is equivalent to verify that Φ T ( f ) ≤ f .Therefore, by Theorem 2, we can conclude that f M T ∈O (g 1 2 ), i.e.Theorem 2 provides a new formal proof, inspired by the original Scott fixed point approach, of the well-known fact that the running time of computing f M T of Mergesort (in the average case behavior) belongs to O(n log 2 n), i.e. that the complexity function g 1 2 , or equivalently O(n log 2 n), gives an asymptotic upper bound of f M T .Furthermore, it must be stressed that in (Schellekens, 1995) it was pointed out that an asymptotic lower bound of the running time of Mergesort (in the average case behavior) belongs to Ω(n log 2 n).However, to show this standard arguments, which are not based on the use of fixed point techniques, were followed.So Schellekens proved that Mergesort running time (in the average case behavior) belongs to the complexity class Θ(n log 2 n), but the unique, strictly speaking, novel proof of the last fact was given when the asymptotic upper bound was obtained.

An extension of Schellekens' approach: the general case of recursive algorithms
Although the most natural is to think that the running time of computing of Divide and Conquer algorithms is always the solution to a Divide and Conquer recurrence equations of type (2), there are well-known examples, like Quicksort (worst case behaviour), of Divide and Conquer algorithms whose complexity analysis does not lead with a recurrence equation of the aforesaid type (Cull et al., 1985).In particular, the running time of computing (worst case behavior) for the aforenamed algorithm is the solution to the recurrence equation given by with j > 0 and where c is the time taken by the algorithm in the base case.Observe that in this case it is not necessary to restrict the input size of the data to a set N b as defined in the preceding section.
Clearly, the recurrence equation ( 6) can not be retrieved as a particular case of the Divide and Conquer family of recurrence equations (2).However, the main and strong relationship between Mergesort and Quicksort is given by the fact that both are recursive algorithms.
Obviously, the class of recursive algorithms is wider than the Divide and Conquer one.An illustrative example, which does not belong to the Divide and Conquer family, is provided by the recursive algorithm, which we will call Hanoi, that solves the Towers of Hanoi puzzle (Cull et al., 1985;Cull & Ecklund, 1985).In this case, under the uniform cost criterion assumption, the running time of computing is the solution to a recurrence equation given by where c, d > 0 and where c represents the time taken by the algorithm to solve the base case.
Of course, to distinguish three possible running time behaviors for Hanoi is meaningless, since the input data distribution is always the same for each size n.
In (Romaguera et al., 2011), the fact that the class of recursive algorithms is wider than the Divide and Conquer inspired to wonder whether one can obtain a family of recurrence equations in such a way that the complexity analysis of those algorithms whose running time of computing is a solution either to recurrence equations associated with Quicksort (in the worst case behavior) and Hanoi or to a Divide and Conquer one can be carried out from it and, in addition, whether such a complexity analysis can be done via an extension of the fixed point technique of Schellekens.
A positive answer to the preceding questions was also given in (Romaguera et al., 2011).Concretely, it was shown two things.
On one hand, it was pointed out that the recurrence equations that yield the running time of computing of the above aforesaid algorithms can be considered as particular cases of the following general one: where c > 0, a ≥ 1 and h ∈Csuch that h(n) < ∞ for all n ∈ N.
Of course, the discussion of the complexity of the Divide and Conquer algorithms introduced in Section 3 can be carried out from the family of recurrence equations of type (8).This is possible because the running time of computing of the aforementioned algorithms leads to recurrence equations can be seen as a particular case of our last general family of recurrence equations.Indeed, a Divide and Conquer recurrence equation can be transformed into the following one Observe that the analysis of the recurrence equation family ( 10) allows immediately to study the Divide and Conquer recurrence equations.

108
Semantics -Advances in Theories and Mathematical Models www.intechopen.com On the other hand, the Schellekens fixed point technique was extended and applied to discuss the complexity class (asymptotic upper and lower bounds) of those algorithms whose running time of computing is the solution to a recurrence equation of type (8).Of course, it was introduced an improvement over the original Schellekens method in order to obtain asymptotic lower bounds of the running time of computing of algorithms.This was done by means of a new kind of functionals defined on the complexity space and called worseners (see Subsection 4.2 for the definition).Furthermore, the applicability of the new results to Asymptotic Complexity Analysis was illustrated by discussing the complexity class of the running time of computing, among others, of Quicksort (in the worst case behavior) and Hanoi.
Nevertheless, a recursive algorithm whose running time does not hold a recurrence equation of type ( 8) can be found, for instance, in (Cull et al., 1985).The aforementioned algorithm, that we will call Fibonacci, computes the value of the Fibonacci sequence at any given index n with n ∈ N. The running time of computing of Fibonacci matches up with the solution to a recurrence equation given as follows: where c represents the time taken by the computer to perform a basic operation.Again, similarly to Hanoi, to distinguish three possible running time behaviors is meaningless.
It is clear that the recurrence equation ( 11) can not be retrieved as a particular case from the family of recurrence equations (8).Consequently, the latter family of recurrence equations is not be able to model the complexity of Fibonacci.However, the running time of computing of all above recursive algorithms, including Fibonacci, can be modeled as the solution to a recurrence equation of the below general family: where h ∈Csuch that h(n) < ∞ for all n ∈ N, k ∈ N, c i > 0 and a i ≥ 1 for all 1 ≤ i ≤ k.
Inspired by the previous exposed fact our purpose in this section is to go more deeply into the Schellekens fixed point technique for the complexity analysis of algorithms and to demonstrate that such techniques can be successfully used to obtain the complexity class of those recursive algorithms whose running time is a solution to a recurrence equation of type ( 12).In particular we prove, by means of a new fixed point theorem, the existence and uniqueness of the solution to a recurrence equation of type ( 12).Moreover, we introduce, based on the fixed point theorem, a technique in the spirit of Schellekens and Scott to get the the complexity class (an asymptotic upper and lower bound) of such a solution.Concretely, our technique to obtain asymptotic upper bounds is based on, following the Schellekens original ideas, the use of improver functionals induced by the recurrence equation.Nevertheless, following (Romaguera et al., 2011), we provide asymptotic lower bounds of the solution via worseners functionals which capture, similarly to the improvers one but in a dual way, the original "successive approximations" spirit of Scott's approach.Furthermore, we prove that in order to provide the complexity class of an algorithm whose running time satisfies a recurrence equation of type ( 12) is enough to search among all complexity functions for which the functional associated to the recurrence equation is an improver and a worsener simultaneously.Finally, with the aim, on one hand, to validate our new results and, on the other hand, to show the potential applicability of the developed theory to Asymptotic Complexity Analysis, we end the section discussing the complexity class of the running time of Fibonacci.

The fixed point: existence and uniqueness of solution
Define the functional for all f ∈C c,k .
It is clear that a complexity function in C c,k is a solution to a recurrence equation of type ( 12) if and only if it is a fixed point of the functional Ψ T .
The next result is useful to supply the bicompleteness of the quasi-metric space First of all we prove that g ∈C.Indeed, given ε > 0, there exist i 0 , Now suppose for the purpose of contradiction that g / ∈C c,k .Then there exists Semantics -Advances in Theories and Mathematical Models www.intechopen.comwhenever i ≥ i 0 .As a result we have that The next result provides the existence and uniqueness of solution to a recurrence equation of type (12). where Indeed, we have that

111
A Common Mathematical Framework for Asymptotic Complexity Analysis and Denotational Semantics for Recursive Programs Based on Complexity Spaces where for all n > k.
Now the existence and uniqueness of the fixed point f T ∈C c,k of Ψ T follow from Corollary 4 and Theorem 1, because (max 1≤i≤k Since f T ∈C c,k is the solution to a the recurrence equation of type ( 12) if and only if f T is a fixed point of Ψ T , Theorem 5 yields that a recurrence of the form ( 12) has a unique solution f T in C c,k .Moreover, note that, by Theorem 1, we have that

Bounding the solution: the complexity class of running time of computing
In order to describe the complexity of those recursive algorithms whose running time of computing satisfies a recurrence equation of type ( 12) we need recall the below auxiliary result which was announced without proof in (Romaguera et al., 2011) with the aim of extending Schellekens fixed point technique and, thus, analyze the complexity class of those algorithms whose running time of computing holds a recurrence equation of type (8) .Proof. 1) Assume that there exists g ∈ C such that d C | C (Ψ(g), g)=0.Suppose for the purpose of contradiction that d C | C ( f , g) > 0. Then we have that From the preceding inequality we deduce that 1 ≤ s, which contradicts the fact that s is a contractive constant.So 2) The thesis of 2) can be proved applying similar arguments to those given in the proof of 1).
Observe that if a complexity function f represents the running time of computing of an algorithm under study, the fact that there exists a complexity function g satisfying the condition d C | C (Ψ(g), g)=0( d C | C (g, Ψ(g)) = 0) in the preceding lemma provides an asymptotic upper (lower) bound of the aforesaid running time, since 112 Semantics -Advances in Theories and Mathematical Models www.intechopen.com From statements in Lemma 6 we infer, such as it was pointed out in (Romaguera et al., 2011), that to provide an asymptotic upper bound of the running time of computing of an algorithm whose running time matches up with the fixed point of a contractive mapping Ψ : C −→ C (C ⊆C ) associated to a recurrence equation is enough to check if such a mapping satisfies the condition Ψ(g) ≤ g for any complexity function even if Ψ is not monotone (see Section 3).This fact presents an improvement of our new method over the Schellekens one.So in the remainder of this paper, and according to (Romaguera et al., 2011), given C ⊆Cand a contraction Ψ : C −→ C we will say that Ψ is a cont-improver with respect to a complexity function g ∈ C provided that Ψ(g) ≤ g.Note that the contractivity of the functional implies that a cont-improver is an improver.Consequently, a cont-improver is a transformation on algorithms in such a way that the application of the transformation yields, from a complexity point of view, an improved algorithm.
Motivated by statement 2) in Lemma 6, it was introduced a new kind of functionals called worseners.For our subsequent purpose, let us recall that, given C ⊆C , a contraction Ψ : C −→ C is called a worsener with respect to a function f ∈ C provided that f ≤ Ψ( f ).A n easy verification shows that if a functional Ψ is a worsener with respect to f , then Hence the computational meaning of a worsener functional is dual to the meaning of a cont-improver.Indeed, a worsener is a functional which corresponds to a transformation on algorithms in such a way that the application of the transformation yields, from a complexity point of view, a worsened algorithm.
The next result provides the method to provide the asymptotic upper and lower bounds of the running time of computing of those algorithms whose running time of computing is the solution to a recurrence equation of type ( 12).
Theorem 7. Let f T ∈C c,k be the (unique) solution to a recurrence equation of type (12).Then the following facts hold: 1) If the functional Ψ T associated to (12), and given by ( 13), is a cont-improver with respect to some function g ∈C c,k , then f T ∈O(g).2) If the functional Ψ T associated to (12), and given by ( 13), is a worsener with respect to some function g ∈C c,k , then f T ∈ Ω(g).
Proof.Assume that Ψ T is a cont-improver with respect to g ∈C c,k .Then we have Ψ T (g) ≤ g.
Hence we obtain that d C | C c,k (Ψ T (g), g)=0.It immediately follows, by statement 1) in Lemma 6, that d C | C c,k ( f T , g)=0 and, thus, f T ∈O(g).So we have proved 1).
To prove 2) suppose that Ψ T is a worsener with respect to g ∈C c,k .Then g ≤ Ψ T (g).Whence we deduce that 0, and we conclude that f T ∈ Ω(g).This finishes the proof.
the light of Theorem 7, we have that the solution to a recurrence equation of type (12) satisfies that f T ∈O(g) ∩ Ω(h) whenever Ψ T is a cont-improver and a worsener with respect to g ∈C c,k and h ∈C c,k , respectively.Consequently we obtain the complexity class of algorithms whose running time of computing satisfies a recurrence equation of type (12) when there exist l ∈C c,k , r, t > 0 and n 0 ∈ N such that g(n)=rl(n) and h = tl(n) for all n ≥ n 0 and, besides, Ψ T is a cont-improver and a worsener with respect to g and h respectively, because, in such a case, f T ∈ Θ(l).

An application to Asymptotic Complexity Analysis: Fibonacci case
In this subsection we validate the developed theory and illustrate the potential applicability of the obtained results by means of providing the asymptotic complexity class of the recursive algorithm that computes the Fibonacci sequence, an algorithm whose running time of computing can be analyzed neither via the technique exposed in (Schellekens, 1995) nor via its extended version given in (Romaguera et al., 2011).
As we have exposed above, the running time of computing of Fibonacci is the solution to the below recurrence equation: where c > 0. Clearly, this recurrence equation can be retrieved from ( 12) as a particular case when we fix k = 2, a 1 = a 2 = 1, c 1 = 2c, c 2 = 3c and h(n)=4c for all ∈ N.Then, taking for all f ∈C c,2 , Theorem 5 guarantees the existence and uniqueness of the solution in C c,2 , say f F T , to the above recurrence equation in such a way that it matches up with the running time of computing of the recursive algorithm under consideration.
Next, fix r > 0 and α > 1 2 and define the function h α,r by Since α > 1 2 , the D'Alembert ratio test guarantees that h α ∈C c,2 .It is not hard to see that Ψ T is a cont-improver with respect to the complexity function h α (i.e.Ψ T (h α ) ≤ h α ) if and only if α ≥ 1.61 and r ≥ 4c α 2 .Hence we obtain, by statement 1) in Theorem 7, that the running of Fibonacci holds f F T ∈O(h 1.61, 4c ).
Moreover, a straightforward computation shows that at Ψ T is a worsener with respect to the complexity function h α,r (i.e.h α,r ≤ Ψ T (h α,r )) if and only if α ≤ 1.61 (r is not subject to any constraint).Thus we deduce, by statement 2) in Theorem 7, that f ).
Therefore we obtain that f ), which agrees with the complexity class that can be found in the literature for the recursive algorithm under study, i.e. f F T ∈ Θ((1.61) n ) (Cull et al., 1985).

Asymptotic Complexity Analysis and Denotational Semantics via a common mathematical framework
As we have pointed out in Sections 1 and 3, the main objective of Schellekens' work was to apply the fixed point technique of the Scott approach for Denotational Semantics to Asymptotic Complexity Analysis.After accomplishing the original aim, he suggested the possibility of giving applications of the complexity space framework to new realms of Computer Science as, in particular, to Denotational Semantics.Thus, the research line began by Schellekens would have benefited from the fundamentals of Denotational Semantics (concretely from Scott's ideas) and, at the same time, the latter would benefit from the ideas and techniques that could be originated in the context of the complexity space.In this direction, a few fruitful interactions between both research disciplines have recently been shown in (Romaguera & Valero, 2008), (Rodríguez-López et al., 2008), (Llull-Chavarría & Valero, 2009) , (Romaguera & Valero, 2011b) and (Romaguera et al., 2011a).
In this section we go more deeply into the relationship between both aforenamed disciplines and present a unified mathematical structure that will be helpful in Asymptotic Complexity Analysis and Denotational Semantics simultaneously.For this purpose, consider a recursive algorithm computing the factorial of a nonnegative integer number by means of the recursive denotational specification introduced in Section 1, that is It is clear that the running time of computing of such a recursive algorithm is the solution to the following recurrence equation (Boxer and Miller, 2005): where c, d > 0. In the light of the preceding recursive specifications, our objective is to be able to describe simultaneously under a unique fixed point technique the running time of computing and the meaning of the recursive algorithm that computes the factorial of a nonnegative integer number, that is to provide the complexity class of the solution to the recurrence equation ( 15) and to prove that the unique solution to the denotational specification ( 14) is the entire factorial function.To this end we will need to recall the following facts.
On one hand, in (Romaguera & Schellekens, 2000) S. Romaguera and Schellekens introduced and studied a new complexity space setting, that we will call generalized complexity spaces, whose construction is as follows: Given a quasi-metric space (X, d) and a fixed x 0 ∈ X, the generalized complexity space of (X, d, x 0 ) is the quasi-metric space (C X,x 0 , d C X,x 0 ), where

115
A Common Mathematical Framework for Asymptotic Complexity Analysis and Denotational Semantics for Recursive Programs Based on Complexity Spaces and the quasi-metric d C X,x 0 on C X,x 0 is defined by for all f , g ∈C X,x 0 .
Notice that if we take in the preceding definition the base quasi-metric space (X, d) with X = (0, ∞], x 0 = ∞ and d = u −1 , then the generalized complexity space (C X,x 0 , d C X,x 0 ) is exactly the original complexity space (C, d C ).
In (Romaguera & Schellekens, 2000) several mathematical properties, which are interesting from a computational point of view, of generalized complexity spaces were studied.Among them we are interested in the bicompleteness, because it will be useful for our aim later on.In particular, we have the following result.
Theorem 8. Let (X, d) be a quasi-metric space and let x 0 ∈ X.Then the generalized complexity space (C X,x 0 , d C X,x 0 ) is bicomplete if and only if (X, d) is bicomplete .
On the other hand, in the literature it has been introduced the so-called domain of words as a possible mathematical foundation of Denotational Semantics (Davey & Priestley, 1990;Künzi, 1993;Matthews, 1994).Such a mathematical structure can be constructed as follows: Denote by N ω the set of all finite and infinite sequences (words) over N. Denote by the prefix order on N ω , i.e. x y ⇔ x is a prefix of y.The pair (N ω , ) is known as the domain of words over the alphabet N.
According to (Matthews, 1994) and (Künzi, 1993), the domain of words can be endowed with a quasi-metric.Indeed, define on N ω the function d N ω : N ω × N ω → R + by d N ω (x, y)=2 − (x,y) − 2 − (x) , for all x, y ∈ N ω , where (x, y) denotes the length of the longest common prefix of x and y provided that such a prefix exists, and (x, y)=0 otherwise.Of course we adopt the convention that 2 −∞ = 0.
It is well known that (N ω , d N ω ) is a bicomplete quasi-metric space.Furthermore, x y ⇔ d N ω (x, y)=0.
Next we present the new mathematical framework and we apply it to to discuss, in the spirit of Scott and Schellekens, the complexity and the meaning of a recursive algorithm computing the factorial of a nonnegative integer number.First of all, we mix the original complexity space and the domain of words via a generalized complexity space in the following way: Since ((0, ∞], u −1 ) and (N ω , d N ω ) are bicomplete quasi-metric spaces we have that ((0, ∞] × N ω , u −1 + d N ω ) is a bicomplete quasi-metric space, where (u −1 + d N ω )((x 1 , x 2 ), (y 1 , y 2 )) = u −1 (x 1 , y 1 )+d N ω (x 2 , y 2 ), for all (x 1 , x 2 ), (y 1 , y 2 ) ∈ (0, ∞] × N ω .

103A
Common Mathematical Framework for Asymptotic Complexity Analysis and Denotational Semantics for Recursive Programs Based on Complexity Spaces www.intechopen.comcomplexity space is the pair (C, d C ), where

A
Divide and Conquer algorithm solves a problem of size n (n ∈ N) splitting it into a subproblems of size n b , for some constants a, b with a, b ∈ N and a, b > 1, and solving them separately by the same algorithm.After obtaining the solution of the subproblems, the 104 Semantics -Advances in Theories and Mathematical Models www.intechopen.comalgorithm combines all subproblem solutions to give a global solution to the original problem.The recursive structure of a Divide and Conquer algorithm leads to a recurrence equation for the running time of computing.In many cases the running time of a Divide and Conquer algorithm is the solution to a Divide and Conquer recurrence equation, that is a recurrence equation of the form

105A
Common Mathematical Framework for Asymptotic Complexity Analysis and Denotational Semantics for Recursive Programs Based on Complexity Spaces for all f , g ∈C b,c .So, by Theorem 1, the functional Φ T : C b,c −→ C b,c has a unique fixed point and, thus, the recurrence equation (2) has a unique solution.

107A
Common Mathematical Framework for Asymptotic Complexity Analysis and Denotational Semantics for Recursive Programs Based on Complexity Spaces www.intechopen.com ) where S(m)=T(b m−1 ) and r(m)=h(b m−1 ) for all m ∈ N. (Recall that N b = {b k : k ∈ N} with b ∈ N and b > 1).

109A
Common Mathematical Framework for Asymptotic Complexity Analysis and Denotational Semantics for Recursive Programs Based on Complexity Spaces www.intechopen.com d s C ) is complete and, by Proposition 3, the subset C c,k is closed in (C, d s C ) we immediately obtain the following consequence.Corollary 4. The quasi-metric space

Lemma 6 .
Let C be a subset of C such that the quasi-metric space (C, d C | C ) is bicomplete and suppose that Ψ : C −→ C is a contractive functional with fixed point f ∈ C and contractive constant s.Then the following statements hold: 1) If there exists g ∈ C with d C | C (Ψ(g), g)=0, then d C | C ( f , g)=0.2) If there exists g ∈ C with d C | C (g, Ψ(g)) = 0, then d C | C (g, f )=0.

113A
Common Mathematical Framework for Asymptotic Complexity Analysis and Denotational Semantics for Recursive Programs Based on Complexity Spaces

114Semantics-
Advances in Theories and Mathematical Models www.intechopen.com

116Semantics-
Advances in Theories and Mathematical Models www.intechopen.com