**5. 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

$$fact(n) = \begin{cases} 1 & \text{if } n = 1 \\ nfact(n-1) \text{ if } n \ge 2 \end{cases}.\tag{14}$$

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):

$$T(n) = \begin{cases} c & \text{if } n = 1 \\ T(n-1) + d \text{ if } n \ge 2 \end{cases} \tag{15}$$

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*<sup>0</sup> ∈ *X*, the generalized complexity space of (*X*, *<sup>d</sup>*, *<sup>x</sup>*0) is the quasi-metric space (C*X*,*x*<sup>0</sup> , *<sup>d</sup>*C*X*,*x*<sup>0</sup> ), where

$$\mathcal{C}\_{\mathbf{X},\mathbf{x}\_0} = \{ f : \mathbf{N} \longrightarrow \mathbf{X} : \sum\_{n=1}^{\infty} \mathbf{2}^{-n} d^{\mathbf{s}}(\mathbf{x}\_0, f(n)) < \infty \},$$

Hence (C(0,∞]×**N***ω*,(∞,1**N***<sup>ω</sup>* ), *<sup>d</sup>*C(0,∞]×**N***ω*,(∞,1**N***<sup>ω</sup>* )

*<sup>f</sup>*<sup>2</sup> : **<sup>N</sup>** −→ **<sup>N</sup>***ω*. Moreover *<sup>f</sup>*<sup>1</sup> ∈ C because

<sup>2</sup>−*<sup>n</sup>* <sup>1</sup>

Now for *<sup>f</sup>* = (*f*1, *<sup>f</sup>*2) ∈ C(0,∞]×**N***ω*,(∞,1**N***<sup>ω</sup>* ) define

Then <sup>Γ</sup>(*f*) ∈ C(0,∞]×**N***ω*,(∞,1**N***<sup>ω</sup>* ), because

∑<sup>∞</sup>

∑<sup>∞</sup>

∑<sup>∞</sup>

*<sup>d</sup>*C(0,∞]×**N***ω*,(∞,1**N***<sup>ω</sup>* )

<sup>2</sup> *<sup>d</sup>*C(0,∞]×**N***ω*,(∞,1**N***<sup>ω</sup>* )

for all *<sup>f</sup>* , *<sup>g</sup>* ∈ C(0,∞]×**N***ω*,(∞,1**N***<sup>ω</sup>* ).

∑<sup>∞</sup>

1 <sup>2</sup> <sup>∑</sup><sup>∞</sup>

1

*<sup>n</sup>*=<sup>1</sup> <sup>2</sup>−*<sup>n</sup>* max{ <sup>1</sup>

(*f* , *g*),

Furthermore, it is a simple matter to check that

*<sup>f</sup>*1(*n*) <sup>≤</sup>

∞ ∑ *n*=1

(15) (given by (13)) and *<sup>M</sup>* : **<sup>N</sup>***<sup>ω</sup>* −→ **<sup>N</sup>***<sup>ω</sup>* is the mapping defined by

(*M*(*x*))*<sup>n</sup>* =

∞ ∑ *n*=1

In fact *f*<sup>1</sup> ∈ C*c*,1, where *c* = *f*1(1).

for all *<sup>x</sup>* <sup>∈</sup> **<sup>N</sup>***ω*.

where by 1**N***<sup>ω</sup>* we denote the word of **N***<sup>ω</sup>* such that �(1**N***<sup>ω</sup>* ) = 1 and (1**N***<sup>ω</sup>* )<sup>1</sup> = 1.

and Denotational Semantics for Recursive Programs Based on Complexity Spaces

Note that if *<sup>f</sup>* ∈ C(0,∞]×**N***ω*,(∞,1**N***<sup>ω</sup>* ), then we can write *<sup>f</sup>* = (*f*1, *<sup>f</sup>*2), with *<sup>f</sup>*<sup>1</sup> : **<sup>N</sup>** −→ (0, <sup>∞</sup>] and

<sup>117</sup> A Common Mathematical Framework for Asymptotic Complexity Analysis

<sup>2</sup>−*n*(*u*−<sup>1</sup> <sup>+</sup> *<sup>d</sup>***N***<sup>ω</sup>* )*<sup>s</sup>*

Γ(*f*)(*n*)=(Ψ*T*(*f*1)(*n*)), *M*(*f*2(*n*))),

for all *n* ∈ **N**, where, compare Theorem 5, Ψ*<sup>T</sup>* : C*c*,1 −→ C*c*,1 is the functional associated to

1 if *n* = 1

Observe that *<sup>d</sup>***N***<sup>ω</sup>* (1**N***<sup>ω</sup>* , *<sup>M</sup>*(*x*)) = 0 and *<sup>d</sup>***N***<sup>ω</sup>* (*M*(*x*), 1**N***<sup>ω</sup>* ) = <sup>2</sup>−<sup>1</sup> <sup>−</sup> <sup>2</sup>−(�(*x*)+1), for all *<sup>x</sup>* <sup>∈</sup> **<sup>N</sup>***ω*.

*<sup>n</sup>*=<sup>1</sup> <sup>2</sup>−*n*(*u*−<sup>1</sup> <sup>+</sup> *<sup>d</sup>***N***<sup>ω</sup>* )*s*((∞, 1**N***<sup>ω</sup>* ), <sup>Γ</sup>(*f*)(*n*)) <sup>=</sup>

*<sup>n</sup>*=<sup>1</sup> <sup>2</sup>−*<sup>n</sup>* [*u*−1(∞, <sup>Ψ</sup>*T*(*f*1)(*n*))) + *<sup>d</sup>***N***<sup>ω</sup>* (*M*(*f*2(*n*)), 1**N***<sup>ω</sup>* )] <sup>≤</sup>

*<sup>n</sup>*=<sup>1</sup> <sup>2</sup>−*<sup>n</sup>* [*u*−1(Ψ*T*(*f*1)(*n*)), <sup>Ψ</sup>*T*(*g*1)(*n*)) + *<sup>d</sup>***N***<sup>ω</sup>* (*M*(*f*2(*n*)), *<sup>M</sup>*(*g*2(*n*)))] <sup>≤</sup>

*<sup>n</sup>*=<sup>1</sup> <sup>2</sup>−*<sup>n</sup>* [*u*−1(*f*1(*n*), *<sup>g</sup>*1(*n*)) + *<sup>d</sup>***N***<sup>ω</sup>* (*f*2(*n*), *<sup>g</sup>*2(*n*))] <sup>=</sup>

Therefore, by Theorem 1, we can deduce that the functional Γ has a unique fixed point *f f act* = (*<sup>f</sup> f act*,1, *<sup>f</sup> f act*,2) ∈ C(0,∞]×**N***ω*,(∞,1**N***<sup>ω</sup>* ). Of course, by construction of <sup>Γ</sup>, we have that *<sup>f</sup> f act*,1 ∈ C*c*,1.

<sup>Ψ</sup>*<sup>T</sup>* (*f*1)(*n*), <sup>1</sup>

) is, by Theorem 8, a bicomplete quasi-metric space,

((∞, 1**N***<sup>ω</sup>* ), *f*(*n*)) < ∞.

*nxn*−<sup>1</sup> if 1 <sup>&</sup>lt; *<sup>n</sup>* <sup>≤</sup> �(*x*) + <sup>1</sup> , (16)

<sup>4</sup> } < ∞.

(Γ(*f*), Γ(*g*)) =

and the quasi-metric *<sup>d</sup>*C*X*,*x*<sup>0</sup> on C*X*,*x*<sup>0</sup> is defined by

$$d\_{\mathcal{C}\_{X,\aleph\_0}}(f,g) = \sum\_{n=1}^{\infty} 2^{-n} d\left(f(n), g(n)\right)\_{n'} $$

for all *f* , *g* ∈ C*X*,*x*<sup>0</sup> .

Notice that if we take in the preceding definition the base quasi-metric space (*X*, *d*) with *X* = (0, <sup>∞</sup>], *<sup>x</sup>*<sup>0</sup> = <sup>∞</sup> and *<sup>d</sup>* = *<sup>u</sup>*−1, then the generalized complexity space (C*X*,*x*<sup>0</sup> , *<sup>d</sup>*C*X*,*x*<sup>0</sup> ) is exactly the original complexity space (C, *<sup>d</sup>*<sup>C</sup> ).

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*<sup>0</sup> ∈ *X. Then the generalized complexity space* (C*X*,*x*<sup>0</sup> , *<sup>d</sup>*C*X*,*x*<sup>0</sup> ) *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 **<sup>N</sup>***<sup>ω</sup>* the set of all finite and infinite sequences (words) over **<sup>N</sup>**. Denote by � the prefix order on **<sup>N</sup>***ω*, i.e. *<sup>x</sup>* � *<sup>y</sup>* <sup>⇔</sup> *<sup>x</sup>* is a prefix of *<sup>y</sup>*. The pair (**N***ω*, �) is known as the domain of words over the alphabet **N**.

Moreover, for each *<sup>x</sup>* <sup>∈</sup> **<sup>N</sup>***<sup>ω</sup>* the length of *<sup>x</sup>* will be denoted by �(*x*). Thus, �(*x*) <sup>∈</sup> [1, <sup>∞</sup>] for all *<sup>x</sup>* <sup>∈</sup> **<sup>N</sup>***ω*,. In the following, given *<sup>x</sup>* <sup>∈</sup> **<sup>N</sup>***ω*, we will write *<sup>x</sup>* <sup>=</sup> *<sup>x</sup>*1, *<sup>x</sup>*2*x*3, . . . whenever �(*x*) = <sup>∞</sup> and *x* = *x*1*x*2,..., *xn* whenever �(*x*) = *n* < ∞.

According to (Matthews, 1994) and (Künzi, 1993), the domain of words can be endowed with a quasi-metric. Indeed, define on **<sup>N</sup>***<sup>ω</sup>* the function *<sup>d</sup>***N***<sup>ω</sup>* : **<sup>N</sup>***<sup>ω</sup>* <sup>×</sup> **<sup>N</sup>***<sup>ω</sup>* <sup>→</sup> **<sup>R</sup>**<sup>+</sup> by

$$d\_{\mathbb{N}^\omega}(\mathfrak{x}, \mathfrak{y}) = \mathfrak{2}^{-\ell(\mathfrak{x}, \mathfrak{y})} - \mathfrak{2}^{-\ell(\mathfrak{x})}\mathfrak{y}$$

for all *<sup>x</sup>*, *<sup>y</sup>* <sup>∈</sup> **<sup>N</sup>***ω*, where �(*x*, *<sup>y</sup>*) denotes the length of the longest common prefix of *<sup>x</sup>* and *y* provided that such a prefix exists, and �(*x*, *y*) = 0 otherwise. Of course we adopt the convention that 2−<sup>∞</sup> = 0.

It is well known that (**N***ω*, *<sup>d</sup>***N***<sup>ω</sup>* ) is a bicomplete quasi-metric space. Furthermore, *<sup>x</sup>* � *<sup>y</sup>* <sup>⇔</sup> *d***N***<sup>ω</sup>* (*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, <sup>∞</sup>], *<sup>u</sup>*−1) and (**N***ω*, *<sup>d</sup>***N***<sup>ω</sup>* ) are bicomplete quasi-metric spaces we have that ((0, <sup>∞</sup>] <sup>×</sup> **<sup>N</sup>***ω*, *<sup>u</sup>*−<sup>1</sup> <sup>+</sup> *<sup>d</sup>***N***<sup>ω</sup>* ) is a bicomplete quasi-metric space, where (*u*−<sup>1</sup> <sup>+</sup> *<sup>d</sup>***N***<sup>ω</sup>* )((*x*1, *<sup>x</sup>*2),(*y*1, *<sup>y</sup>*2)) = *<sup>u</sup>*−1(*x*1, *<sup>y</sup>*1) + *<sup>d</sup>***N***<sup>ω</sup>* (*x*2, *<sup>y</sup>*2), for all (*x*1, *<sup>x</sup>*2),(*y*1, *<sup>y</sup>*2) <sup>∈</sup> (0, <sup>∞</sup>] <sup>×</sup> **<sup>N</sup>***ω*.

Hence (C(0,∞]×**N***ω*,(∞,1**N***<sup>ω</sup>* ), *<sup>d</sup>*C(0,∞]×**N***ω*,(∞,1**N***<sup>ω</sup>* ) ) is, by Theorem 8, a bicomplete quasi-metric space, where by 1**N***<sup>ω</sup>* we denote the word of **N***<sup>ω</sup>* such that �(1**N***<sup>ω</sup>* ) = 1 and (1**N***<sup>ω</sup>* )<sup>1</sup> = 1.

Note that if *<sup>f</sup>* ∈ C(0,∞]×**N***ω*,(∞,1**N***<sup>ω</sup>* ), then we can write *<sup>f</sup>* = (*f*1, *<sup>f</sup>*2), with *<sup>f</sup>*<sup>1</sup> : **<sup>N</sup>** −→ (0, <sup>∞</sup>] and *<sup>f</sup>*<sup>2</sup> : **<sup>N</sup>** −→ **<sup>N</sup>***ω*. Moreover *<sup>f</sup>*<sup>1</sup> ∈ C because

$$\sum\_{n=1}^{\infty} 2^{-n} \frac{1}{f\_1(n)} \le \sum\_{n=1}^{\infty} 2^{-n} (\mu\_{-1} + d\_{\mathbf{N}^\omega})^s ((\infty, 1\_{\mathbf{N}^\omega}), f(n)) < \infty.$$

In fact *f*<sup>1</sup> ∈ C*c*,1, where *c* = *f*1(1).

Now for *<sup>f</sup>* = (*f*1, *<sup>f</sup>*2) ∈ C(0,∞]×**N***ω*,(∞,1**N***<sup>ω</sup>* ) define

$$\Gamma(f)(n) = (\Psi\_T(f\_1)(n))\_\prime M(f\_2(n))\_\prime$$

for all *n* ∈ **N**, where, compare Theorem 5, Ψ*<sup>T</sup>* : C*c*,1 −→ C*c*,1 is the functional associated to (15) (given by (13)) and *<sup>M</sup>* : **<sup>N</sup>***<sup>ω</sup>* −→ **<sup>N</sup>***<sup>ω</sup>* is the mapping defined by

$$(M(\mathbf{x}))\_n = \begin{cases} 1 & \text{if } n = 1 \\ n\mathbf{x}\_{n-1} \text{ if } 1 < n \le \ell(\mathbf{x}) + 1 \end{cases} \tag{16}$$

for all *<sup>x</sup>* <sup>∈</sup> **<sup>N</sup>***ω*.

18 Will-be-set-by-IN-TECH

Notice that if we take in the preceding definition the base quasi-metric space (*X*, *d*) with *X* =

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

**Theorem 8.** *Let* (*X*, *d*) *be a quasi-metric space and let x*<sup>0</sup> ∈ *X. Then the generalized complexity space*

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,

Denote by **<sup>N</sup>***<sup>ω</sup>* the set of all finite and infinite sequences (words) over **<sup>N</sup>**. Denote by � the prefix order on **<sup>N</sup>***ω*, i.e. *<sup>x</sup>* � *<sup>y</sup>* <sup>⇔</sup> *<sup>x</sup>* is a prefix of *<sup>y</sup>*. The pair (**N***ω*, �) is known as the domain

Moreover, for each *<sup>x</sup>* <sup>∈</sup> **<sup>N</sup>***<sup>ω</sup>* the length of *<sup>x</sup>* will be denoted by �(*x*). Thus, �(*x*) <sup>∈</sup> [1, <sup>∞</sup>] for all *<sup>x</sup>* <sup>∈</sup> **<sup>N</sup>***ω*,. In the following, given *<sup>x</sup>* <sup>∈</sup> **<sup>N</sup>***ω*, we will write *<sup>x</sup>* <sup>=</sup> *<sup>x</sup>*1, *<sup>x</sup>*2*x*3, . . . whenever �(*x*) = <sup>∞</sup>

According to (Matthews, 1994) and (Künzi, 1993), the domain of words can be endowed with

*<sup>d</sup>***N***<sup>ω</sup>* (*x*, *<sup>y</sup>*) = <sup>2</sup>−�(*x*,*y*) <sup>−</sup> <sup>2</sup>−�(*x*)

for all *<sup>x</sup>*, *<sup>y</sup>* <sup>∈</sup> **<sup>N</sup>***ω*, where �(*x*, *<sup>y</sup>*) denotes the length of the longest common prefix of *<sup>x</sup>* and *y* provided that such a prefix exists, and �(*x*, *y*) = 0 otherwise. Of course we adopt the

It is well known that (**N***ω*, *<sup>d</sup>***N***<sup>ω</sup>* ) is a bicomplete quasi-metric space. Furthermore, *<sup>x</sup>* � *<sup>y</sup>* <sup>⇔</sup>

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, <sup>∞</sup>], *<sup>u</sup>*−1) and (**N***ω*, *<sup>d</sup>***N***<sup>ω</sup>* ) are bicomplete quasi-metric spaces we have that ((0, <sup>∞</sup>] <sup>×</sup> **<sup>N</sup>***ω*, *<sup>u</sup>*−<sup>1</sup> <sup>+</sup> *<sup>d</sup>***N***<sup>ω</sup>* ) is a bicomplete quasi-metric space, where (*u*−<sup>1</sup> <sup>+</sup> *<sup>d</sup>***N***<sup>ω</sup>* )((*x*1, *<sup>x</sup>*2),(*y*1, *<sup>y</sup>*2)) =

*<sup>u</sup>*−1(*x*1, *<sup>y</sup>*1) + *<sup>d</sup>***N***<sup>ω</sup>* (*x*2, *<sup>y</sup>*2), for all (*x*1, *<sup>x</sup>*2),(*y*1, *<sup>y</sup>*2) <sup>∈</sup> (0, <sup>∞</sup>] <sup>×</sup> **<sup>N</sup>***ω*.

,

a quasi-metric. Indeed, define on **<sup>N</sup>***<sup>ω</sup>* the function *<sup>d</sup>***N***<sup>ω</sup>* : **<sup>N</sup>***<sup>ω</sup>* <sup>×</sup> **<sup>N</sup>***<sup>ω</sup>* <sup>→</sup> **<sup>R</sup>**<sup>+</sup> by

1993; Matthews, 1994). Such a mathematical structure can be constructed as follows:

2<sup>−</sup>*nd* (*f*(*n*), *g*(*n*)),

) is exactly

∞ ∑ *n*=1

and the quasi-metric *<sup>d</sup>*C*X*,*x*<sup>0</sup> on C*X*,*x*<sup>0</sup> is defined by

the original complexity space (C, *<sup>d</sup>*<sup>C</sup> ).

particular, we have the following result.

of words over the alphabet **N**.

convention that 2−<sup>∞</sup> = 0.

*d***N***<sup>ω</sup>* (*x*, *y*) = 0.

and *x* = *x*1*x*2,..., *xn* whenever �(*x*) = *n* < ∞.

for all *f* , *g* ∈ C*X*,*x*<sup>0</sup> .

(C*X*,*x*<sup>0</sup> , *<sup>d</sup>*C*X*,*x*<sup>0</sup>

*d*C*X*,*x*<sup>0</sup>

(*f* , *g*) =

) *is bicomplete if and only if* (*X*, *d*) *is bicomplete .*

(0, <sup>∞</sup>], *<sup>x</sup>*<sup>0</sup> = <sup>∞</sup> and *<sup>d</sup>* = *<sup>u</sup>*−1, then the generalized complexity space (C*X*,*x*<sup>0</sup> , *<sup>d</sup>*C*X*,*x*<sup>0</sup>

Observe that *<sup>d</sup>***N***<sup>ω</sup>* (1**N***<sup>ω</sup>* , *<sup>M</sup>*(*x*)) = 0 and *<sup>d</sup>***N***<sup>ω</sup>* (*M*(*x*), 1**N***<sup>ω</sup>* ) = <sup>2</sup>−<sup>1</sup> <sup>−</sup> <sup>2</sup>−(�(*x*)+1), for all *<sup>x</sup>* <sup>∈</sup> **<sup>N</sup>***ω*. Then <sup>Γ</sup>(*f*) ∈ C(0,∞]×**N***ω*,(∞,1**N***<sup>ω</sup>* ), because

$$\begin{array}{ll}\Sigma^{\infty}\_{n=1}2^{-n}(\mathfrak{u}\_{-1}+d\_{\mathbb{N}^{\omega}})^{s}((\infty,\mathbf{1}\_{\mathbb{N}^{\omega}}),\Gamma(f)(n))&=\\\Sigma^{\infty}\_{n=1}2^{-n}\left[\mathfrak{u}\_{-1}(\infty,\mathbf{\varvarlim}\_{\mathbf{T}}(f\_{1})(n))\right]+d\_{\mathbb{N}^{\omega}}(M(f\_{2}(n)),\mathbf{1}\_{\mathbb{N}^{\omega}})\;\;\;\mathbf{1}\_{\mathbb{N}^{\omega}})\;\;\;\;\;\mathcal{I}\_{n}\\\\\Sigma^{\infty}\_{n=1}2^{-n}\max\{\frac{1}{\mathfrak{u}\_{T}(f\_{1})(n)},\frac{1}{4}\}&<\infty.\end{array}$$

Furthermore, it is a simple matter to check that

$$\begin{aligned} &d\_{\mathcal{C}(\mathbb{0},\mathbb{N}^{\omega},\mathbb{Q}^{\omega},\langle\mathrm{vol}\_{\mathbb{N}^{\omega}}\rangle)}(\Gamma(f),\Gamma(\mathcal{g})) &= \\ &\sum\_{n=1}^{\infty}2^{-n}\left[u\_{-1}(\mathbb{Y}\_{T}(f\_{1})(n)),\mathbb{V}\_{T}(\mathcal{g}\_{1})(n)\right] + d\_{\mathbb{N}^{\omega}}(M(f\_{2}(n)),M(\mathcal{g}\_{2}(n)))\right] \leq \\ &\frac{1}{2}\sum\_{n=1}^{\infty}2^{-n}\left[u\_{-1}(f\_{1}(n),\mathcal{g}\_{1}(n)) + d\_{\mathbb{N}^{\omega}}(f\_{2}(n),\mathcal{g}\_{2}(n))\right] &= \\ &\frac{1}{2}d\_{\mathcal{C}\_{[0,\infty]\times\mathbb{N}^{\omega},[0,1\_{\mathbb{N}^{\omega}}]}}(f,\mathcal{g})\_{\prime} \end{aligned}$$

for all *<sup>f</sup>* , *<sup>g</sup>* ∈ C(0,∞]×**N***ω*,(∞,1**N***<sup>ω</sup>* ).

Therefore, by Theorem 1, we can deduce that the functional Γ has a unique fixed point *f f act* = (*<sup>f</sup> f act*,1, *<sup>f</sup> f act*,2) ∈ C(0,∞]×**N***ω*,(∞,1**N***<sup>ω</sup>* ). Of course, by construction of <sup>Γ</sup>, we have that *<sup>f</sup> f act*,1 ∈ C*c*,1.

**7. Acknowledgements**

MTM2009-12872-C02-01.

**8. References**

The authors thank the support from the Spanish Ministry of Science and Innovation, grant

<sup>119</sup> A Common Mathematical Framework for Asymptotic Complexity Analysis

and Denotational Semantics for Recursive Programs Based on Complexity Spaces

Boxer, L. & Miller, R. (2005). *Algorithms sequential and parallel: a unified approach*, Charles River

Brassard, G. & Bratley, P. (1988). *Algorithms: Theory and Practice*, Prentice Hall, ISBN:

Cull, P.; Flahive, R. & Robson, R. (1985). *Difference equations: from rabbits to chaos*, Springer,

Davey, B.A. & Priestley, H.A. (1990). *Introduction to Lattices and Order*, Cambridge University

Ecklund, E.F. Jr.&, Cull. P. (1985). Towers of Hanoi and analysis of algorithms. *The American*

Künzi, H.P.A. Nonsymmetric topology, *Proceedings of Colloquium on Topology*, pp. 303-338,

Llull-Chavarría, J. & Valero, O. (2009). An application of generalized complexity spaces to

Matthews, S.G. (1994). Partial metric topology. *Annals of the New York Academy of Sciences*, Vol.

Rodríguez-López, J.; Romaguera. S & Valero, O. (2008). Denotational semantics for

Romaguera, S. & Schellekens, M.P. (1999). Quasi-metric properties of complexity spaces.

Romaguera, S. & Schellekens, M.P. (2000). The quasi-metric of complexity convergence.

Romaguera, S.; Schellekens, M.P. & Valero, O. (2011). Complexity spaces as quantitative domains of computation, *Topology and its Applications*, Vol. 158, 853–860. Romaguera, S.; Schellekens, M.P. & Valero, O. (2011). The complexity space of partial

Romaguera, S.; Tirado, P. & Valero, O. (2011). New results on mathematical foundations of

Romaguera, S. & Valero, O. (2008). On the structure of the space of complexity partial functions. *International Journal of Computer Mathematics*, Vol. 85, 631–640. Schellekens, M.P. (1995). The Smyth completion: a common foundation for denotational

*International Journal of Computer Mathematics*, Vol. 88, 1819–1829.

pp. 996-1007, ISBN: 9788461461677, Alicante (Spain), July 2011.

denotational semantics via domain of words. *Lecture Notes in Computer Science*, Vol.

programming languages, balanced quasi-metrics and fixed points. *International*

functions: a connection between Complexity Analysis and Denotational Semantics.

asymptotic complexity analysis of algorithms via complexity spaces, *Proceedings of the 11th International Conference on Mathematical Methods in Science and Engineering*,

semantics and complexity analysis, *Electronic Notes in Theoretical Computer Science*,

Media, ISBN: 1584504129, Massachusetts.

9780130232434, New Jersey.

ISBN: 9780387232348, New York.

Press, ISBN: 0521784514, Cambridge.

*Mathematical Monthly*, Vol. 92, 407–420.

*Journal of Computer Mathematics*, Vol. 85, 623–630.

*Topology and its Applications*, Vol. 98, 311–322.

*Quaestiones Mathematicae*, Vol. 23, 359–374.

Szekszárd (Hungary), August 1993.

5457, 530–541.

728, 183–197.

Vol. 1, 211–232.

Moreover, *f f act*(*n*) = Γ(*f f act*)(*n*) if and only if *f f act*,1(*n*) = Ψ*T*(*f f act*,1)(*n*) and *f f act*,2(*n*) = *M*(*f f act*,2(*n*)) for all *n* ∈ **N**.

Notice that a complexity function (a function belonging to C) is a solution to the recurrence equation (15) if and only if it is a fixed point of the functional Ψ*<sup>T</sup>* and that a word is a fixed point of the mapping *M* if and only if it satisfies the denotational specification (14). Whence we obtain that *f f act*,1 is the solution to the recurrence equation (15) and that *f f act*,2 is the solution to the recursive denotational specification (14). Moreover, by construction of *M*, *f f act*,2(*n*) = *n*! for all *n* ∈ **N**. Hence *f f act*,1 represents the running time of computing of the recursive algorithm under study and *f f act*,2 provides the meaning of the recursive algorithm that computes the factorial of a nonnegative number using the denotational specification (14), respectively.

So we have shown that generalized complexity spaces in the sense of (Romaguera & Schellekens, 2000) are useful to describe, at the same time, the complexity and the program correctness of recursive algorithms using recursive denotational specifications. The exposed method is also based on fixed point techniques like the Schellekens and Scott techniques but it presents an advantage with respect the latter ones. Indeed, the method provided by generalized complexity spaces allows to discuss the correctness of recursive algorithms which is an improvement with respect to the Schellekens technique and, in addition, it allows to analyze the correctness of the recursive algorithms by means of quantitative techniques which is an improvement with respect to the classical Scott technique that, as we have pointed out in Section 1, is based only on qualitative reasonings.

#### **6. Conclusions**

In 1970, D.S. Scott introduced a mathematical framework as a part of the foundations of Denotational Semantics, based on topological spaces endowed with an order relation that represents the computational information, which allowed to model the meaning of recursive denotational specification by means of qualitative fixed point techniques. Later on, in 1995, M.P. Schellekens showed a connection between Denotational Semantics and Asymptotic Complexity Analysis applying the original Scott ideas to analyze the running time of computing of Divide and Conquer algorithms but, this time, via quantitative fixed point techniques (the topology is induced by a quasi-metric that provides quantitative information about the elements of the mathematical framework). In this chapter, we have extended the Schellekens technique in order to discuss the complexity of recursive algorithms that do not belong to the Divide and Conquer family. In particular, we have introduced a new fixed point technique that allows to obtain the asymptotic complexity behavior of the running time of computing of the aforesaid recursive algorithms. The new technique has the advantage of providing asymptotic upper and lower bounds of the running time of computing while that the Schellekens technique only allows to obtain upper asymptotic bounds. Furthermore, we have gone more deeply into the relationship between Denotational Semantics and Asymptotic Complexity Analysis constructing a mathematical approach which allows, in the spirit of Scott and Schellekens, to model at the same time the running time and the meaning of a recursive algorithm that performs a task using a recursive denotational specification by means of quantitative fixed point techniques and, thus, presents a improvement with respect to the Scott and Schellekens approaches.
