Tuple relational calculus
Asked Answered
B

2

7

Is safe tuple relational calculus a turing complete language?

Bonina answered 10/1, 2010 at 17:24 Comment(0)
C
6

Let's forget about safety. By Codd's theorem, relational calculus is equivalent to first order logic. FOL is very limited, it can't express the fact that there's a route from a point A to point B in some graph (it can express the fact that there's a route from a point A to point B in limited length, for example ∃x ∃y ∃z ∃t route(a,x) and route(x,y) and route(y,z) and route(z,t) and route(t,b) means there's a route of length 4).

See descriptive complexity for a description of what is the strength of different logics.

Cysticercoid answered 10/1, 2010 at 17:32 Comment(3)
You seem to know more about this than I do, however, why can't the following express that there is a route? edge(x, y) -> route(x, y) edge(x, y) & edge(y, z) -> route(x, z) if the graph is represented as a set of facts about edges, i.e. edge(a, b) & edge(b, c) & edge(c, d) then the query edge(a, d) will be provable by a FOL theorem prover (e.g. a prolog interpreter).Whitmore
You're saying that route is smallest transitive relation satisfying edge(x,y) -> route(x,y). This definition requires least-fixed-point. To define a new relation in tuple calculus, you may use intersection, union, projection... but it is not possible to say "route it is a relation satisfying the following conditions...". You might also quantify over relations, but that's higher-order logic, and quantification is allowed only over individuals in FOL.Cysticercoid
Thanks for your reply..Its really a useful.Bonina
F
1

According to Codd's Theorem, relational algebra and relational calculus are equivalent. It is well-known that relational algebra is not Turing Complete, so neither is relational calculus.

[Edit] You cannot, for instance, do aggregate operations (such as sum, max) or make recursive queries in relational algebra/calculus. See here (near the end).

Folderol answered 10/1, 2010 at 17:34 Comment(4)
Either you are wrong or Larry Watanabe is. I have no idea of the topic, but this is getting interesting to watch! (goes to fetch popcorn)Selfforgetful
Now relational algebra not being Turing Complete is more well-known :)Whitmore
However, from reading another poster's link to Codd's theorem, relational algebra is not equivalent to relational calculus - relational algebra is essentially equivalent to propositional logic whereas relational algebra is equivalent to FOL.Whitmore
@Larry: en.wikipedia.org/wiki/Relational_calculus - "The relational algebra and the relational calculus are essentially logically equivalent ... This result is known as Codd's theorem."Folderol

© 2022 - 2024 — McMap. All rights reserved.