Applied Mathematics and Computation 268 (2015) 1292–1301
Contents lists available at ScienceDirect
Applied Mathematics and Computation journal homepage: www.elsevier.com/locate/amc
A fixed point theorem in partial quasi-metric spaces and an application to Software Engineering Naseer Shahzad a,∗, Oscar Valero b, Mohammed A. Alghamdi a, Maryam A. Alghamdi c a Operator Theory and Applications Research Group, Department of Mathematics, Faculty of Science, King Abdulaziz University, P.O. Box 80203, Jeddah 21589, Saudi Arabia b Department of Mathematics and Computer Science, University of Balearic Islands, Ctra. de Valldemossa km. 7.5, 07122 Palma de Mallorca, Spain c Department of Mathematics, King Abdulaziz University, Sciences Faculty for Girls, P.O. Box 4087, Jeddah 21491, Saudi Arabia
a r t i c l e
i n f o
MSC: 47H10 54E50 54F05 68N30 68Q25 68Q55 68Q60 65G40 Keywords: Partial quasi-metric Quasi-metric Partial metric Partially ordered set Complexity analysis Denotational semantics
a b s t r a c t Scott (1970) [11] introduced qualitative fixed point techniques as a suitable mathematical tool for program verification. Inspired by the fact that the Scott mathematical tools do not include metric implements, Matthews (1994) [8] introduced the concept of partial metric space with the aim of reconciling the Scott fixed point techniques with metric spaces and proved a fixed point theorem for self-mappings in partial metric spaces providing, thus, quantitative techniques useful, in the spirit of Scott, in denotational semantics. Schellekens (1995) [10] showed that the original Scott ideas can be also applied to asymptotic complexity analysis of algorithms via quantitative fixed point techniques for self-mappings in quasi-metric spaces. Later on Cerdà-Uguet et al. (2012) [3] showed that, contrarily to the case of Matthews partial metric spaces, partial quasi-metrics are useful for modeling the algorithmic complexity by means of quantitative fixed point techniques that preserve the Scott ideas and Schellekens techniques concurrently. In the present paper, we focus our efforts on developing a quantitative fixed point technique, based on partial quasi-metric spaces, that allows us to provide a suitable mathematical tool for program verification and complexity analysis simultaneously and, in addition, preserves the Scott ideas and the essence of Matthews and Schellekens techniques. Moreover, we show its applicability to discuss the running time of computing an algorithm using a recursive denotational specification and the meaning of such an specification. © 2015 Elsevier Inc. All rights reserved.
1. Introduction When a programmer designs an algorithm by means of the use of recursive denotational specifications, two things are taking into account. On the one hand, the meaning of such an specification. On the other hand, the running time of computing the algorithm under consideration. So program verification and asymptotic complexity analysis of algorithms play a central role in Software Engineering. In 1970, Scott introduced fixed point techniques as a suitable mathematical tool for program verification (see [11] and [4] for a more recent treatment of the topic). Concretely, the Scott approach allows to obtain the meaning of a recursive denotational ∗
Corresponding author. Tel.: +966501235542. E-mail address:
[email protected] (N. Shahzad).
http://dx.doi.org/10.1016/j.amc.2015.06.074 0096-3003/© 2015 Elsevier Inc. All rights reserved.
N. Shahzad et al. / Applied Mathematics and Computation 268 (2015) 1292–1301
1293
specification as the least fixed point of a nonrecursive mapping. However, it must be pointed out that the Scott framework is based on order theory (partially ordered spaces and monotone mappings) and it does not use metric methods, which are useful to establish the information content of the elements involved in the framework itself. Thus the fixed point techniques of Scott are qualitative but not quantitative. Motivated by the aforementioned drawback, in 1994 Matthews introduced the notion of partial metric space in order to reconcile metric spaces with the Scott fixed point techniques [8] (see Section 2 for the definition of partial metric). Concretely, partial metrics induce a partial order in the spirit of Scott and, in addition, provides a degree of the information content captured by all mathematical elements used in the Scott model. In this direction, Matthews proved a fixed point theorem for self-mappings in partial metric spaces which provides quantitative techniques that allow us to analyze the meaning of recursive denotational specifications in line with Scott approach. In 1995, Schellekens proved that the original Scott ideas can be also applied to computational fields different from Denotational Semantics [10]. In particular, he developed a quantitative fixed point technique for self-mappings in quasi-metric spaces which has been proved to be useful for the asymptotic analysis of algorithmic complexity (see also Section 2 for the definition of quasi-metric). Recently, a discussion about the utility of partial metrics in asymptotic complexity analysis of algorithms was made in [1] and [3]. In the aforesaid references, it was proved that the original fixed point techniques of Matthews are not useful for modeling algorithmic complexity. However, in the same references it was also shown that partial quasi-metrics, in the sense of [7], are an appropriate tool for complexity analysis preserving both, the original Scott ideas and the spirit in the Schellekens techniques concurrently. Motivated by the exposed facts, in this paper we are interested in developing a quantitative fixed point technique that allows us to provide a suitable mathematical tool for program verification and complexity analysis simultaneously and, thus, in some sense, preserves the Scott ideas and the essence of Matthews and Schellekens techniques. Concretely, we focus our efforts on obtaining a unified framework based on partial quasi-metrics useful to discuss the running time of computing an algorithm using a recursive denotational specification and the meaning of such an specification. Hence, we introduce a partial quasi-metric space and we show its applicability, by means of the use of Theorem 4 in Section 3, considering and analyzing an algorithm which computes the factorial of nonnegative integer numbers by means of a recursive denotational specification. 2. Mathematical basics In this section we recall a few basic and pertinent notions which will be fundamental in order to achieve our main objective. As usual (see [4]), a partially ordered set is a pair (X, ≤) such that X is a nonempty set and ≤ is a partial order on X. Of course, a partial order ≤ on X is a reflexive, antisymmetric and transitive binary relation on X. Moreover, given a subset Y⊆X, a lower bound for Y in (X, ≤) is an element x ∈ X such that x ≤ y for all y ∈ Y. The greatest lower bound for Y in (X, ≤), if exists, is an element x ∈ X which is a lower bound for Y and, in addition, it satisfies that z ≤ x provided that z ∈ X is another lower bound for Y. Besides, given x ∈ X, we will denote by ↓≤ x the set {y ∈ X: y ≤ x}. Furthermore, an element x ∈ X is maximal in (X, ≤) provided that if there exists y ∈ X such that x ≤ y, then y = x. A sequence (xn )n∈N in (X, ≤) is decreasing if xn+1 ≤ xn for all n ∈ N, where N denotes the set of positive integer numbers. Following [9], an element x of a partially ordered set (X, ≤) is said to be a pre-fixed point, with respect to ≤, of a mapping f from (X, ≤) into itself provided that f(x) ≤ x. As usual, a mapping f from a partially ordered set (X, ≤) into itself will be called monotone if f(x) ≤ f(y) whenever x ≤ y. From now on, we will denote by R+ the set of nonnegative real numbers. On account of [6], by a quasi-metric on a nonempty set X we mean a function d : X × X → R+ such that for all x, y, z ∈ X: (i) d(x, y) = d(y, x) = 0 ⇔ x = y, (ii) d(x, z) ≤ d(x, y) + d(y, z). Each quasi-metric d on a set X induces a T0 topology T (d) on X which has as a base the family of open d-balls {Bd (x, r): x ∈ X, r > 0}, where Bd (x, r) = {y ∈ X : d(x, y) < r} for all x ∈ X and r > 0. Of course, a quasi-metric space is a pair (X, d) such that X is a nonempty set and d is a quasi-metric on X. If d is a quasi-metric on a set X, then the function ds defined on X × X by ds (x, y) = max{d(x, y), d−1 (x, y)} is a metric on X, where d−1 is the conjugate quasi-metric of d defined on X by d−1 (x, y) = d(y, x) for al x, y ∈ X. A quasi-metric is called bicomplete provided that the metric ds is complete. It is well known that a quasi-metric space (X, d) can be endowed with a partial order ≤ d which is defined by x ≤d y ⇔ d(x, y) = 0. According to [7], a partial quasi-metric on a nonempty set X is a function q : X × X → R+ such that for all x, y, z ∈ X: (i) (ii) (iii) (iv)
q(x, x) = q(x, y) and q(y, y) = q(y, x) ⇔ x = y, q(x, x) ≤ q(y, x), q(x, x) ≤ q(x, y), q(x, y) ≤ q(x, z) + q(z, y) − q(z, z).
Observe that a quasi-metric on a set X is a partial quasi-metric q satisfying in addition the condition: (v) q(x, x) = 0 for all x, x ∈ X. Moreover, a partial quasi-metric q on a set X is called partial metric if it satisfies additionally the condition: (v) q(x, y) = q(y, x) for all x, y ∈ X.
1294
N. Shahzad et al. / Applied Mathematics and Computation 268 (2015) 1292–1301
Of course, a partial quasi-metric space is a pair (X, q) such that X is a nonempty set and q is a partial quasi-metric on X. It is clear that every partial quasi-metric q on X induces a quasi-metric dq on X given by
dq (x, y) = q(x, y) − q(y, y) for all x, y ∈ X (Remark 5 in [7]). Moreover, (X, q) is complete provided that the quasi-metric space (X, dq ) is bicomplete, i.e., the metric space (X, dqs ) is complete (Theorem 1 in [7]). Furthermore, following [7], each partial quasi-metric q induces on X a partial order ≤ q in the following way :
x ≤q y ⇔ q(x, y) = q(y, y). Notice that, given x, y ∈ X, x ≤q y ⇔ x ≤dq y. Similarly to the case of quasi-metric spaces, a partial quasi-metric q generates a T0 -topology T (q) on X which has as a base the family of open q-balls {Bq (x, ε ): x ∈ X, ε > 0}, where Bq (x, ε) = {y ∈ X : q(x, y) < q(y, y) + ε} for all x ∈ X and ε > 0. Whence we immediately deduce that a sequence (xn )n∈N in a partial quasi-metric space (X, q) converges to a point x ∈ X with respect to T (q) ⇔ limn→∞ q(xn , xn ) = limn→∞ q(x, xn ) ⇔ limn→∞ dq (x, xn ) = 0. Clearly, T (q) = T (dq ). A sequence (xn )n∈N in a partial quasi-metric space (X, q) is said to be 0-convergent to x ∈ X provided that it converges to x with respect to T (dqs ) and q(x, x) = 0 (compare with Definition 6 in [5] and with Definition 2 in [14]). Clearly, every 0-convergent sequence is convergent with respect to T (q) but the converse is false in general. The next example shows that there are convergent sequences with respect to T (q) that are not 0-convergent. Example 1. Consider the partial quasi-metric space (R, qS ) introduced in Example 3 of [7], where qS (x, y) = dS (x, y) + dS (0, x) and
dS (x, y) =
min{y − x, 1} if x ≤ y , 1 if y < x
for all x, y ∈ R. Next consider the sequence (xn )n∈N in R given by xn =
qS 0,
1
n
= dS 0,
1
n
+ dS (0, 0) =
1 n
for all n ∈ N. Then dS (0, 0) = 0 and
1 n
for all n ∈ N. Hence limn→∞ qS (0, 1n ) = limn→∞ qS ( 1n , 1n ) = 0. So the sequence (xn )n∈N converges to 0 with respect to T (qS ). However,
dqs S (0, xn ) = max dqS 0,
1 1 ,0 , dq S n n
=1+
1 n
for all n ∈ N. Therefore, the sequence (xn )n∈N is not 0-convergent. A sequence (xn )n∈N is called 0-Cauchy provided that limn,m→∞ q(xn , xm ) = 0. In addition, a partial quasi-metric space (X, q) is said to be 0-complete if every 0-Cauchy sequence (xn )n∈N in X 0-converges to a point x ∈ X (compare, again, with [5]). Clearly every complete partial quasi-metric space is 0-complete. Nevertheless, the following example shows that there are 0-complete partial quasi-metric spaces that are not complete. Example 2. Let | · | be the Euclidean norm on R. Consider the partial quasi-metric space (Q, q), where
q(x, y) = |y − x| + |y| for all x, y ∈ Q. It is clear that (Q, q) is a 0-complete partial quasi-metric space. Nevertheless, it is not complete because the metric dqs is not complete, where the quasi-metric dq is given by
dq (x, y) = |y − x| for all x, y ∈ Q. Finally, we will say that a mapping f from a partial quasi-metric space (X, q) into itself is (i) monotone if f is monotone from (X, ≤q ) into itself and (ii) mixed continuous if it is continuous from (X, T (dqs )) into (X, T (dq−1 )). Examples of monotone and mixed continuous mappings will be given in Section 3. 3. The fixed point result As announced before we are interested in obtaining an application of fixed point theory to Software Engineering. To this end, the next results will play a central role. Proposition 3. Let (X, d) be a quasi-metric space and let x ∈ X. If (xn )n∈N is a decreasing sequence in (X, ≤d ), then the following assertions hold: (1) If (xn )n∈N converges to x in (X, T (d)), then x is a lower bound of (xn )n∈N . (2) If (xn )n∈N converges to x in (X, T (ds )), then x is the greatest lower bound of (xn )n∈N .
N. Shahzad et al. / Applied Mathematics and Computation 268 (2015) 1292–1301
1295
Proof. First of all we prove that x is a lower bound of (xn )n∈N . Since the sequence (xn )n∈N is decreasing in (X, ≤d ) we have that xm ≤ d xn for all m, n ∈ N such that m ≥ n. Thus d(xm , xn ) = 0 for all m, n ∈ N such that m ≥ n. Next we show that d(x, xn ) = 0 for all n ∈ N. Assume, for the purpose of contradiction, that there exists n0 ∈ N such that 0 < d(x, xn0 ). Then, given ε > 0, there exists n1 ∈ N such that d(x, xn ) < ε for all n ≥ max {n0 , n1 }. Hence 0 < d(x, xn0 ) ≤ d(x, xn ) + d(xn , xn0 ) = d(x, xn ) < ε for all n ≥ max {n0 , n1 }. It follows that 0 < d(x, xn0 ) ≤ 0, which is impossible. Therefore d(x, xn ) = 0 for all n ∈ N and, thus, x ≤ d xn for all n ∈ N. It follows that x is a lower bound of (xn )n∈N . Now assume that (xn )n∈N converges to x in (X, T (ds )). Then we prove that x is the greatest lower bound of (xn )n∈N . Of course, by (1), x is a lower bound of (xn )n∈N . Suppose that there exists y ∈ X with y ≤ d xn for all n ∈ N. Then d(y, xn ) = 0 for all n ∈ N. Whence we deduce that d(y, x) ≤ d(y, xn ) + d(xn , x) = d(xn , x) for all n ∈ N. Since (xn )n∈N converges to x in (X, T (ds )), there exists n2 ∈ N such that d(xn , x) < ε for all n ≥ n2 . Thus we conclude that d(y, x) = 0, which implies y ≤ d x. Whence x is the greatest lower bound of (xn )n∈N . Theorem 4. Let (X, q) be a 0-complete partial quasi-metric space. Assume that the following assertions hold: (1) f is a mixed continuous monotone mapping from (X, q) into itself which admits a pre-fixed point x0 ∈ X with respect to ≤ q such that limn→∞ q( f n (x0 ), f n (x0 )) = 0. (2) There exists k ∈ [0, 1[ with q( f n (x0 ), f n+1 (x0 )) ≤ kq( f n−1 (x0 ), f n (x0 )) for all n ∈ N. Then f has a fixed point x∗ which satisfies the following: (1) x∗ is the greatest lower bound of ( f n (x0 ))n∈N in (X, ≤q ) and, thus, x∗ ∈↓≤q x0 . (2) q(x∗ , x∗ ) = 0. (3) x∗ is maximal in (F ix( f )∩ ↓≤q x0 , ≤q ). Proof. Let x0 ∈ X such that f(x0 ) ≤ q x0 . Of course we can assume that x0 = f(x0 ), since otherwise x0 is a fixed point of f. Since f(x0 ) ≤ q x0 and f is monotone we immediately obtain
f m (x0 ) ≤q f n (x0 ) for all m, n ∈ N with n ≤ m. It follows that q( f m (x0 ), f n (x0 )) = q( f n (x0 ), f n (x0 )) for all m, n ∈ N with m ≥ n. Consequently
lim q( f m (x0 ), f n (x0 )) = 0.
n,m→∞
Since
q( f n (x0 ), f n+1 (x0 )) ≤ kq( f n−1 (x0 ), f n (x0 )) for all n ∈ N we obtain
q( f n (x0 ), f m (x0 )) ≤ q( f n (x0 ), f n+1 (x0 )) + · · · + q( f m−1 (x0 ), f m (x0 ))
≤ kn + · · · + km−2 + km−1 q(x0 , f (x0 )) kn − km q(x0 , f (x0 )) 1−k kn q(x0 , f (x0 )). ≤ 1−k
=
for all m, n ∈ N such that m ≥ n. Whence we deduce that
lim q( f n (x0 ), f m (x0 )) = 0.
n,m→∞
Thus the sequence ( f n (x0 ))n∈N is 0-Cauchy. The 0-completeness of (X, q) provides the existence of x∗ ∈ X such that ( f n (x0 ))n∈N is convergent to x∗ in (X, dqs ) and q(x∗ , x∗ ) = 0. Since ( f n (x0 ))n∈N is decreasing in (X, ≤q ) and it converges to x∗ in (X, T (dqs )) we deduce, by assertion (2) in Proposition 3, that x∗ is the greatest lower bound of ( f n (x0 ))n∈N . Next we prove that x∗ is a fixed point of f. The monotonicity of f yields that f(x∗ ) ≤ q fn (x0 ) for all n ∈ N. Then f(x∗ ) ≤ q x∗ , since x∗ is the greatest lower bound of ( f n (x0 ))n∈N . Next we show that x∗ ≤ q f(x∗ ). By the mixed continuity of the mapping f we have
lim dq ( f n (x0 ), f (x∗ )) = 0.
n→∞
Thus we obtain
dq (x∗ , f (x∗ )) ≤ dq (x∗ , f n (x0 )) + dq ( f n (x0 ), f (x∗ )) = dq ( f n (x0 ), f (x∗ )) for all n ∈ N. So dq (x∗ , f (x∗ )) = 0. Therefore x∗ ≤ q f(x∗ ) and, thus, x∗ is a fixed point of f. It remains to prove that x∗ is maximal in (F ix( f )∩ ↓≤q x0 , ≤q ). Suppose there exists y ∈ F ix( f )∩ ↓≤q x0 with x∗ ≤ q y. Since y ∈ F ix( f )∩ ↓≤q x0 , we have y ≤ q fn (x0 ) for all n ∈ N. The fact that x∗ is the greatest lower bound of ( f n (x0 ))n∈N yields that y ≤ ∗ ∗ ∗ ≤q x , ≤ ). q x . Hence x = y. Therefore x is maximal in (F ix( f )∩ ↓ q 0
1296
N. Shahzad et al. / Applied Mathematics and Computation 268 (2015) 1292–1301
The next example shows that the 0-completeness of the partial quasi-metric space cannot be deleted in Theorem 4 in order to guarantee the existence of fixed point. Example 5. Consider the partial quasi-metric space (]0, 1], q∗ ) such that q∗ (x, y) = max{x − y, 0} + max{x, y} for all x, y ∈ ]0, 1]. It is clear that (]0, 1], q∗ ) is not 0-complete and x ≤q∗ y ⇔ x ≤ y. Define the mapping f: ]0, 1] → ]0, 1] by f (x) = 2x for all x ∈ ]0, 1]. Clearly f is monotone and mixed continuous. Moreover, 12 = f (1) ≤q∗ 1. Furthermore we have that
1 =0 2n
lim q∗ ( f n (1), f n (1)) = lim
n→∞
n→∞
and
1 2n−1
−
1 2n+1
= q∗ ( f n (1), f n+1 (1)) ≤
1 1 1 − n 2 2n−2 2
=
1 q∗ ( f n−1 (1), f n (1)) 2
for all n ∈ N. Nevertheless, f has no fixed points. In the following example we show that the monotonicity of the mapping cannot be omitted in the statement of Theorem 4 in order to yield the existence of a fixed point of the mapping. Example 6. Consider the 0-complete partial quasi-metric space ([0, 1], q∗ ), where q∗ is the partial quasi-metric introduced in Example 5. Define the mapping f: [0, 1] → [0, 1] by
x
f (x) =
2 1
if x = 0
.
if x = 0
for all x ∈ [0, 1]. It is not hard to see that f is mixed continuous. Besides
= f (1) ≤q∗ 1. Of course,
1 = 0. 2n
lim q∗ ( f n (1), f n (1)) = lim
n→∞
1 2
n→∞
Moreover, the mapping f holds
q∗ ( f n (1), f n+1 (1)) ≤
1 q∗ ( f n−1 (1), f n (1)) 2
for all n ∈ N. It is obvious that f is not monotone, since 1 = f (0) q∗ f (1) =
1 2.
Furthermore, f has no fixed points.
In the following example we show that the existence of a pre-fixed point of the self-mapping cannot be omitted in the statement of Theorem 4 to ensure the existence of fixed point. Example 7. Let ([0, 1], qS ) be the partial quasi-metric space such that qs (x, y) = dS−1 (x, y) + y for all x, y ∈ [0, 1], where
dS−1 (x, y) =
x − y if x ≥ y 1
if x < y
.
Observe that dS−1 is the restriction of the conjugate of the quasi-metric dS , introduced in Example 1, to [0, 1]. It is not hard to check that ([0, 1], qs ) is 0-complete. Now, consider the mapping f: [0, 1] → [0, 1] introduced in Example 6. Clearly x ≤qs y ⇔ x = y and, thus f is monotone and does not exist x0 ∈ [0, 1] such that f (x0 ) ≤qs x0 . In addition, we have limn→∞ qs ( f n (1), f n (1)) = limn→∞ 21n = 0. Furthermore,
1 1 1 1 = qs ( f n (1), f n+1 (1)) ≤ = qs ( f n−1 (1), f n (1)) 2n 2 2n−1 2 for all n ∈ N. Clearly f is mixed continuous. However, f has no fixed points. Next we show that the mixed continuity of the mapping cannot be omitted in the statement of Theorem 4 in order to provide the existence of a fixed point of the mapping. Example 8. Let ([0, 1], q+ ) be the 0-complete partial quasi-metric space such that q+ (x, y) = max{y − x, 0} + 2y for all x, y ∈ R. Clearly x ≤q+ y ⇔ y ≤ x. Consider the mapping f: [0, 1] → [0, 1] introduced in Example 6. It is clear that f is monotone and 1 = f (0) ≤q+ 0. Moreover,
lim q+ ( f n (0), f n (0)) = lim
n→∞
n→∞
1 = 0. 2n
Furthermore,
1 1 1 1 = q+ ( f n (0), f n+1 (0)) ≤ = q+ ( f n−1 (0), f n (0)) 2 2n 2 2n+1
N. Shahzad et al. / Applied Mathematics and Computation 268 (2015) 1292–1301
1297
for all n ∈ N. It is not hard to check that f is not mixed continuous. Indeed, consider the sequence (xn )n∈N in ([0, 1], q+ ) given by 1 ( f (0), f (xn )) = 1 − 2n for xn = 1n for all n ∈ N. Then dqs + (0, xn ) = 1n for all n ∈ N and, thus, limn→∞ dqs + (0, xn ) = 0. However, dq−1 + all n ∈ N. Whence we deduce that limn→∞ dq−1 ( f (0), f (xn )) = 0. Clearly f has no fixed points. +
The next example shows that the contractive condition of the self-mapping in assertion (2) in statement of Theorem 4 cannot be deleted in order to assure the existence of fixed point. Example 9. Let (R, qmax ) be the partial quasi-metric space such that qmax : R × R → R+ is given by qmax (x, y) = max{x − y, 0} for all x, y ∈ R. It is not hard to see that (R, qmax ) is 0-complete. Moreover, x ≤qmax y ⇔ x ≤ y. Consider the mapping f : R → R given by f (x) = x − 1 for all x ∈ R. Of course, the mapping f is monotone and f (x) ≤qmax x for all x ∈ R. A straightforward computation shows that f is mixed continuous. Clearly, qmax ( f n (x), f n (x)) = 0 for all n ∈ N and all x ∈ R. Thus limn→∞ qmax ( f n (x), f n (x)) = 0 for all x ∈ R. Besides, there does not exist c ∈ [0, 1[ such that
qmax ( f n (x), f n+1 (x)) ≤ cqmax ( f n−1 (x), f n (x)) for all n ∈ N and any x ∈ R, since
qmax ( f n (x), f n+1 (x)) = qmax ( f n−1 (x), f n (x)) = 1 for all n ∈ N. Clearly f has no fixed points. Next we show that Theorem 4 does not yield the existence of fixed point in general when the “limit” condition in assertion (1) in statement of Theorem 4 is omitted. Example 10. Let (] − ∞, −5[, q∧ ) be the partial quasi-metric space such that q∧ (x, y) = − min{x, y} for all x, y ∈] − ∞, −5[. Of course, (] − ∞, −5[, q∧ ) is 0-complete. Moreover, x ≤q∧ y ⇔ y ≤ x. Define the mapping f :] − ∞, −5[→] − ∞, −5[ by f (x) = 45 x − 1 for all x ∈] − ∞, −5[. An easy verification shows that f is monotone, mixed continuous and that, in addition, f (x0 ) ≤q∧ x0 for all x0 ∈] − ∞, −5[. Moreover,
q∧ ( f n (x0 ), f n+1 (x0 )) ≤
4 q∧ ( f n−1 (x0 ), f n (x0 )) 5
for all x0 ∈] − ∞, −5[ and all n ∈ N. Nevertheless, limn→∞ q∧ ( f n (x0 ), f n (x0 )) = 5. Obviously f has not fixed points. The next example shows that Theorem 4 does not yield the uniqueness of the fixed point in general. Example 11. Consider the 0-complete partial quasi-metric space ([0, 1], q∗ ) introduced in Example 5. Define the mapping f: [0, 1] → [0, 1] by
f (x) =
⎧x ⎨ if x ∈ [0, 12 [ 2
⎩ 1 if x ∈ [ 1 , 1] 2
.
2
It is obvious that f is monotone and mixed continuous. Moreover,
1 n
lim q∗ f
n→∞
and
1
q∗ f n
4
4
, fn
, f n+1
1 4
1 4
= lim
n→∞
≤
1 4
≤q∗ f ( 14 ) =
1 8.
Furthermore,
1 =0 2n+2
1 1 1 , fn q∗ f n−1 2 4 4
for all n ∈ N. Clearly 0 is the fixed point provided by Theorem 4, although F ix( f ) = {0, 12 }. 4. The application: a partial quasi-metric framework for Software Engineering As we have commented in Section 1, two things that a programmer takes into account when designs an algorithm using a recursive denotational specifications are the meaning of such an specification and the running time of computing the algorithm under consideration. Hence program verification and asymptotic complexity analysis of algorithms are central in Software Engineering. In this section we develop a quantitative fixed point technique based on the use of partial quasi-metrics and Theorem 4 which is useful for program verification and complexity analysis of algorithms simultaneously. Moreover, such a technique preserves in some sense the Scott ideas and, at the same time, the essence of Matthews and Schellekens techniques (see Section 1). To this end, the remainder of the paper is organized as follows: Section 4.1 presents the partial quasi-metric space which is the basis for the quantitative fixed point technique. Section 4.2 considers an algorithm computing the factorial of nonnegative integer numbers by means of a recursive denotational specification, and applies the aforementioned quantitative fixed point technique in order to show the meaning of such an specification and to determine the running time of computing the algorithm.
1298
N. Shahzad et al. / Applied Mathematics and Computation 268 (2015) 1292–1301
4.1. The partial quasi-metric Next we introduce a partial quasi-metric in order to illustrate the applicability of the developed, in Section 3, fixed point theory to Software Engineering. To this end, let us recall a few pertinent concepts from [3] (see also [1]). In the aforesaid references, the so-called Baire partial quasi-metric was constructed as follows: Let be a nonempty alphabet endowed with a partial order . Denote by ∞ the set of all finite and infinite sequences over . Given v ∈ ∞ denote by l(v) the length of v. Thus l(v) ∈ N ∪ {∞} for all v ∈ ∞ . Moreover, if F = {v ∈ ∞ : l(v) ∈ N} and ∞ = {v ∈ ∞ : l(v) = ∞}, then ∞ = F ∪ ∞ and we will write v = v1 v2 . . . vl (v) and w = w1 w2 . . . whenever v ∈ F and w ∈ ∞ , respectively. We say that v is a subprefix of w provided that l(v) ≤ l(w) and vk wk for all k ≤ l(v). When v is a subprefix of w we write vsubp w. In the following we put l (v, w) = sup{n ∈ N : vk wk for all k ≤ n} provided the existence of n0 ∈ N such that n0 ≤ l(v), vk wk for all k ≤ n0 , and l (v, w) = 0 otherwise. Of course, l (v, v) = l(v) for all v ∈ ∞ . Taking into account the exposed facts and according to [3], the Baire partial quasi-metric space was introduced as the complete partial quasi-metric space ( ∞ , q ), such that q : ∞ × ∞ → R+ is given by
q (v, w) = 2−l (v,w)
(1)
∞.
∞.
2−∞
We have adopted the convention that = 0. Observe that v subp w ⇔ v ≤q w for all v, w ∈ for all v, w ∈ Keeping in mind the aim of applying Theorem 4 to Software Engineering we introduce the following partial quasi-metric space. Proposition 12. Let ∞ and ∞ be the set of all finite and infinite sequences over the nonempty alphabets and endowed with the partial orders 1 and 2 , respectively. If = × , then the pair (∞ , Q , ) is a 0-complete partial quasi-metric space, were the function Q , : ∞ × ∞ → R+ is defined by
Q , ((v, s), (w, t )) = q (v, w) + q (t, s) for all v, w ∈
∞
and s, t ∈
(2)
∞ .
Proof. We only proof the 0-completeness, since the fact that ( ∞ , q ) and (∞ , q ) are partial quasi-metric spaces makes obvious that (∞ , Q , ) is a partial quasi-metric space. Let ((vn , sn ))n∈N be a 0-Cauchy sequence in (∞ , Q , ). Then
lim Q , ((vn , sn ), (vm , sm )) = 0.
n,m→∞
Whence we immediately obtain
lim q (vn , vm ) = lim q (sn , sm ) = 0.
n,m→∞
n,m→∞
Then we have
lim dqs (vn , vm ) = 0
n,m→∞
and
lim dqs −1 (sn , sm ) = 0.
n,m→∞
Hence (vn )n∈N and (sn )n∈N are Cauchy sequences in ( ∞ , dqs ) and (∞ , ds −1 ), respectively. On account of [3], ( ∞ , q ) q
∞ ∞ s and (∞ , q−1 ) are complete partial quasi-metric spaces, then there exist v ∈ and s ∈ such that limn→∞ dq (v, vn ) = limn→∞ ds −1 (s, sn ) = 0. It follows that q
lim dQs , ((v, s), (vn , sn )) = 0,
n→∞
since
dQs , ((v, s), (w, t )) ≤ 2 dqs (v, w) + dqs −1 (s, t )
for all (v, s), (w, t) ∈ ∞ . Thus we have that the sequence ((vn , sn ))n∈N converges to (v, s) ∈ ∞ with respect to T (dQs we show that Q , ((v, s), (v, s)) = 0. Indeed, we have
,
). Next
lim Q , ((vn , sn ), (v, s)) ≤ 2 lim dqs (v, vn ) + lim dqs −1 (s, sn ) = 0. n→∞ n→∞ n→∞
Hence
lim l1 (vn , v) = lim l2 (s, sn ) = ∞.
n→∞
n→∞
Since l1 (vn , v) ≤ l(v) and l2 (s, sn ) ≤ l(s) we conclude that l(v) = l(s) = ∞. Therefore Q , ((v, s), (v, s)) = 0 and, thus, (∞ , Q , ) is 0-complete.
N. Shahzad et al. / Applied Mathematics and Computation 268 (2015) 1292–1301
1299
The next property will be very useful in Section 4.2. To state it we need to recall the notion of conjugate partial quasi-metric. According to [7], given a partial quasi-metric space (X, q), the function q−1 : X × X → R+ defined by q−1 (x, y) = q(y, x) for all x, y ∈ X is a partial quasi-metric called the conjugate of q. Recall that for given x, y ∈ X we have x ≤q−1 y ⇔ dq−1 (x, y) = 0 ⇔ q(y, x) = q(y, y) (see Section 2 to consult how to induce the partial order from a partial quasi-metric). Proposition 13. Let (v, s), (w, t) ∈ ∞ .Then
(v, s) ≤Q, (w, t ) ⇔ v ≤q w and s ≤q−1 t. Proof. The condition (v, s) ≤Q , (w, t ) is equivalent to Q , ((v, s), (w, t )) = Q , ((w, t ), (w, t )). Moreover, the preceding equality is equivalent to q (v, w) = q (w, w) and q (t, s) = q (t, t ). The last equalities are equivalent to v ≤q w and s ≤q−1 t.
Taking = = N and 1 =2 =≤, where ≤ stands for the usual partial order on N, in Propositions 12 and 13 we obtain the following consequences which will play a central role in the application provided in the aforesaid subsection. Corollary 14. Then the pair (QN×N , (N × N)∞ ) is a 0-complete partial quasi-metric space such that (v, s) ≤QN×N (w, t ) ⇔ v ≤qN w and s ≤q−1 t for all (v, s), (w, t ) ∈ (N × N)∞ . N
4.2. The application to Software Engineering In order to show the potential applicability of the theory developed until now, we will consider a well known but illustrative example in Software Engineering. Concretely we consider an algorithm which computes the factorial of nonnegative integer numbers by means of a recursive denotational specification and we will provide the meaning of such an specification and the complexity class of the running time of computing taken by the algorithm. On the one hand, the next denotational specification is usually used when a developer implements the aforesaid algorithm:
f act (n) =
1 n f act (n − 1)
if n = 1 . if n > 0
(3)
It is clear that the meaning of (3) is the entire factorial function. However, when one wants to specify the meaning of (3) then the following handicap arises. The meaning of fact is given in terms of itself. So such a symbol cannot be replaced by its meaning in the preceding recursive denotational specification. In order to avoid this drawback and to yield the meaning of the denotational specification under consideration, as we have mentioned in Section 1, the qualitative Scott fixed point techniques are considered. Concretely the meaning is found as the fixed point of the following mapping:
1 if n = 0 , n f (n − 1) if n > 0 and n − 1 ∈ dom( f )
H( f ) =
(4)
where dom(f) denotes the domain of the partial function f. Notice that the mapping H is defined from the partially ordered set of partial functions into itself and that we have omitted such details here because they will not be useful later on. Nevertheless, we refer the reader to [11] and [12] for a detailed discussion about the mathematical aspects of Scott theory. Observe that the advantage of the Scott approach is provided by the fact that the mapping H is nonrecursive in contrast to the recursive nature of the denotational specification (3). On the other hand, the running time of computing taken by the algorithm that computes the factorial of integer numbers using (3) is modeled through a function T f act ∈ RT (RT = { f : N →]0, ∞[}) so that Tfact (n) depicts the time taken by the algorithm to compute the factorial of the integer number n. Of course, such a function is the solution to the recurrence equation below:
f (n) =
c f (n − 1) + c
if n = 1 , if n > 1
(5)
and R+ denotes the set of positive real numbers. It must be pointed out that c represents the time that the where f ∈ RT , c ∈ R+ 0 0 algorithm spends to perform the task under consideration on the base case. However, in Software Engineering it is not necessary to describe exactly the solution to Eq. (5) in order to know the expression of Tfact . It is enough to determine Tfact in a roughly way by means of its asymptotic complexity class. Let us recall that Tfact belongs to the complexity class of g ∈ RT , denoted by T f act ∈ O(g), provided the existence of n0 ∈ N and c > 0 satisfying Tfact (n) ≤ cg(n) for all n ∈ Nn0 , where Nn0 = {n ∈ N : n ≥ n0 }. Next, as announced before, we show that Theorem 4 can be applied to provide the entire factorial function as the meaning of the algorithm using the recursive denotational specification (3) and the complexity class of such an algorithm simultaneously. f To this end, given a mapping f ∈ RT , we identify such a mapping with a sequence v f ∈ N∞ which is defined by vn = f (n) for all n ∈ N. Now define the nonrecursive mapping F : (N × N)∞ → (N × N)∞ by
F (v, s)n =
(c, 1)
if n = 1
(vn−1 + 1, nsn−1 ) if n > 1 and n − 1 ≤ l(s)
.
1300
N. Shahzad et al. / Applied Mathematics and Computation 268 (2015) 1292–1301
It is a simple matter to see that F is a mixed continuous monotone mapping from (QN×N , (N × N)∞ ) into itslef. Clearly F (c, 1) ≤QN×N (c, 1), i.e., (c, 1) is a pre-fixed point of F with respect to ≤QN×N . Besides
lim QN×N (F n (c, 1), F n (c, 1)) = 0.
(6)
n→∞
Furthermore,
QN×N (F n (c, 1), F n+1 (c, 1)) ≤
1 QN×N (F n−1 (c, 1), F n (c, 1)) 2
(7)
for all n ∈ N. By Corollary 14, the partial quasi-metric space ((N × N)∞ , QN×N ) is 0-complete. Thus, all conditions in statement of Theorem 4 are satisfied and, therefore, we have guaranteed the existence of a fixed point of F, (v f act , s f act ) ∈ (N × N)∞ , in such a way that QN×N ((v f act , s f act ), (v f act , s f act )) = 0. It follows that l(v f act ) = l(s f act ) = ∞. Clearly vfact is the solution to the recurrence f act equation (5) and, hence, it represents the running time of computing the algorithm under consideration. Moreover, sn = n! for fact represents the meaning of the recursive denotational specification (3), which is the entire factorial all n ∈ N. Consequently s function fact. Next let vc ∈ N∞ with
vcn =
c n+c
if n = 1 . if n > 1 f act
It is not hard to see that, given w ∈ N∞ , v f act ≤qN w ⇔ n + c ≤ wn for all n > 1. It follows that vn
≤ vcn = n + c for all n ∈ N. So
fv f act ∈ O( fvc ), where fv f act , fvc ∈ RT with fv f act (n) = and fvc (n) = for all n ∈ N. Observe that O( fvc ) is the complexity class of the algorithm that computes the factorial of nonnegative integer numbers using (3) given in the literature ([2]). Regarding the limit condition (6) and the contractive condition (7), we have that they guarantee that the sequence (F n (c, 1))n∈N provides information about the computational recursion process. Concretely, it assures that F n+1 (c, 1) gives more information about the final stage of the computational process than the preceding one Fn (c, 1). In addition, the fixed point belongs to N∞ × N∞ and, thus, it yields information about the final stage of the process which matches up with the running time of computing and the meaning of the denotational specification. Moreover, the fact that (c, 1) is a pre-fixed point of F, that is F (c, 1) ≤QN×N (c, 1), points out that the fixed point satisfies the initial condition of Eqs. (3) and (5).
vnf act
Observe that the convergence of (F n (c, 1))n∈N with respect to T (dQs
(F n (c, 1))n∈N
vcn
N×N
) and the fact that the fixed point (vfact , sfact ) is the
greatest lower bound of ensures that the fixed point contains all information about the running time of computing and the meaning of the denotational specification but it does only capture the information than can be derived from the elements of (F n (c, 1))n∈N . Regarding to the maximality of the fixed point, we have that (vfact , sfact ) is the unique element in (N × N)∞ that provides the complete information about the final stage of the recursion, i.e., about the running time of computing and the meaning of the denotational specification at the same time. We end the paper noting that Eqs. (3) and (5) admit a unique solution and, although Theorem 4 does not give the uniqueness of such a solution, in some sense, that role played by the uniqueness is now played by the maximality of the fixed point. Note, in fact, that the maximality gives that the fixed point provided by Theorem 4 captures the maximum information about the computational object to model (that, in this case, is the meaning of the denotational specification and the running time of computing). Moreover, observe that the latter characteristic makes such a result able to analyze (both from denotational and complexity viewpoint) those algorithms that use recursive denotational specifications admitting more than one meaning, i.e., one meaning for each initial condition x0 (pre-fixed point in the terms of statement of Theorem 4). For a deeper discussion about recursive denotational specifications admitting more than one meaning and quantitative techniques based on partial metric spaces, we refer the reader to [13]. In fact, in some sense, Theorem 4 extends Theorem 2 in [13]. 5. Conclusion Since Scott fixed point techniques for program verification do not include metric implements, partial metric spaces were introduced by Matthews. Thus the fixed point theorem for self-mappings in partial metric spaces, due to Matthews, provides quantitative techniques useful to analyze the meaningful of recursive denotational semantics in the spirit of Scott. The original Scott ideas was applied by Schellekens to asymptotic complexity analysis of algorithms via quantitative fixed point techniques for self-mappings in quasi-metric spaces. Moreover, Cerdà-Uguet, Schellekens and Valero showed that the original fixed point techniques of Matthews are not useful for modelling the algorithmic complexity in the sense of Schellekens and, motivated by this drawback, they proved a partial quasi-metric fixed point theorem which is an appropriate tool for complexity analysis in such a way that the original Scott ideas and Schellekens techniques are preserved concurrently. In this paper, following the original work by Cerdà-Uguet, Schellekens and Valero, we have developed a quantitative fixed point technique, based on partial quasi-metric spaces, which is proved to be useful for program verification and complexity analysis simultaneously and, in addition, preserves the Scott ideas and the essence of Matthews and Schellekens techniques. The aforementioned utility has been showed discussing the complexity class of the running time of computing an algorithm which computes the factorial of nonnegative integer numbers by means of a recursive denotational specification and providing the meaning of such an specification with the same partial quasi-metric and quantitative fixed point technique. We summarize our achievement in the table below, where for each quantitative fixed point technique we indicate whether it is useful in denotational
N. Shahzad et al. / Applied Mathematics and Computation 268 (2015) 1292–1301
1301
semantics and complexity analysis. Moreover, we have used the following abbrevations: MPFT for Matthews partial metric fixed point technique, SQFT for Schellekens quasi-metric fixed point technique and NPQMFT for our new partial quasi-metric fixed point technique.
Denotational semantics Complexity analysis
MPFT
SQFT
NPQMFT
Yes No
No Yes
Yes Yes
Acknowledgments This project was funded by the National Plan for Science, Technology and Innovation (MAARIFAH) – King Abdulaziz City for Science and Technology – the Kingdom of Saudi Arabia – award number (12-MAT051-03). The authors also, acknowledge with thanks Science and Technology Unit, King Abdulaziz University for technical support. The authors are grateful to two anonymous referees for their useful suggestions and comments. References [1] M.A. Alghamdi, N. Shahzad, O. Valero, New results on the baire partial quasi-metric space, fixed point theory and asymtptotic complexity analysis for recursive programs, Fixed Point Theory Appl. 2014 (2014) 14. [2] L. Boxer, R. Miler, Algorithms Sequential and Parallel: A Unified Approach, Charles River Media Inc., Massachusetts, 2005. [3] M.A. Cerdà-Uguet, M.P. Schellekens, O. Valero, The baire partial quasimetric space: a mathematical tool for the asymptotic complexity analysis in computer science, Theory Comput. Syst. 50 (2012) 387–399. [4] B.A. Davey, H.A. Priestley, Introduction to Lattices and Order, Cambridge University Press, Cambridge, 1990. [5] E. Karapinar, I.M. Erhan, A. Öztürk, Fixed point theorems on quasi-partial metric spaces, Math. Comput. Model. 57 (2013) 2442–2448. [6] H.P.A. Künzi, Nonsymmetric distances and their associated topologies: about the origins of basic ideas in the area of asymmetric topology, in: C.E. Aull, R. Lowen (Eds.), Handbook of the History of General Topology, 3, Kluwer, Dordrecht, 2001, pp. 853–968. [7] H.P.A. Künzi, H. Pajooshesh, M.P. Schellekens, Partial quasi-metrics, Theor. Comput. Sci. 365 (2006) 237–246. [8] S.G. Matthews, Partial metric topology, Ann. N. Y. Acad. Sci. 728 (1994) 183–197. [9] S. Roman, Lattices and Ordered Sets, Springer, New York, 2008. [10] M.P. Schellekens, The smyth completion: a common foundation for the denotational semantics and complexity analysis, Electron. Notes Theor. Comput. Sci. 211–232 (1995). [11] D.S. Scott, Outline of a mathematical theory of computation, in: Proceedings of the 4th Annual Princeton Conference on Information Sciences and Systems, 1970, pp. 169–176. [12] D.S. Scott, Domains for denotational semantics, LNCS 140 (1982) 577–613. [13] N. Shahzad, O. Valero, On 0-complete partial metric spaces and quantitative fixed point techniques in denotational semantics, Abstr. Appl. Anal. 2013 (2013) 11 Article ID 985095. [14] A. Shoaib, M. Arshad, J. Ahmad, Fixed point results of locally contractive mappings in ordered quasi-partial metric spaces, Sci. World J. 2013 (2013) 8 Article ID 194897.