Relation algebra is not relational algebra

Lobsters Hottest News

Summary

This article clarifies the common confusion between relation algebra and relational algebra, explaining their distinct origins, applications in computer science and formal methods, and highlights a recent paper on the Prela query language based on relation algebra.

<p><a href="https://lobste.rs/s/t5fquc/relation_algebra_is_not_relational">Comments</a></p>
Original Article
View Cached Full Text

Cached at: 09/21/26, 06:27 PM

# Relation algebra ≠ relational algebra Source: [https://remy.wang/blog/ra-ra.html](https://remy.wang/blog/ra-ra.html) Lots of people confuse[**relation**algebra](https://en.wikipedia.org/wiki/Relation_algebra)with[relation**al**algebra](https://en.wikipedia.org/wiki/Relational_algebra), including[Wikipedia](https://en.wikipedia.org/w/index.php?title=Relational_algebra&oldid=1375720015)\(until today\) and one of my favorite database influencers,[Jamie Brandon](https://www.scattered-thoughts.net/writing/unexplanations-relational-algebra-is-math/)\. I don't blame them, because the names only differ by 2 letters, and I believe not even[Ted Codd](https://en.wikipedia.org/wiki/Edgar_F._Codd)knew about relation algebra; otherwise I doubt he would have named his thing "relational algebra"\. If you use a database, you've probably heard of the[relational algebra](https://en.wikipedia.org/wiki/Relational_algebra), which is the foundation for, well, relational databases\. Codd introduced the algebra in his 1970 paper[A relational model of data for large shared data banks](https://doi.org/10.1145/362384.362685)and gave it the name "relational algebra"[2 years later](https://www.inf.unibz.it/~franconi/teaching/2006/kbdb/Codd72a.pdf)\. For theory fans, his seminal result \(now known as[Codd's theorem](https://en.wikipedia.org/wiki/Codd%27s_theorem)\) says that relational algebra is equivalent to the so\-called domain independent relational calculus, which is essentially a well\-behaved fragment of first\-order logic queries\. Far fewer people know about[relation algebra](https://en.wikipedia.org/wiki/Relation_algebra)outside of logic and pure math\. There, it is defined as an[algebraic structure](https://en.wikipedia.org/wiki/Algebraic_structure)abstractly by a set of axioms, and the name comes from how a concrete algebra over**binary**relations can be conveniently modeled by it\. An interesting counterpart to Codd's theorem is that relation algebra is equivalent to\\text\{FOL\}^3, which restricts first\-order logic to use at most 3 different variables \(but quantifiers can be nested arbitrarily deep\)\. However, it can be extended to match the expressive power of FOL with a[fork operator](https://www.cosc.brocku.ca/Faculty/Winter/JoRMiCS/Vol1/PDF/v1n8.pdf)\. OK, so**relational**algebra is a CS thing, and**relation**algebra is a math thing? Not so fast\! It turns out relation algebra has been quietly finding applications in computer science as well\. One major piece of software built on it is the[Alloy analyzer](https://en.wikipedia.org/wiki/Alloy_(specification_language))which calls it "relational logic" \(which was incorrectly redirected to the page for relational algebra until I fixed it just now\.\.\.\)\. Alloy is a descendant of the[Z notation](https://en.wikipedia.org/wiki/Z_notation)by the late and great[Jean\-Raymond Abrial](https://en.wikipedia.org/wiki/Jean-Raymond_Abrial)\. Let's try it again: so**relational**algebra is a DB thing, and**relation**algebra is for math and formal methods? Still not\. Over the decades, there has been a small but dedicated group of people led by[Dirk Van Gucht](https://dl.acm.org/profile/81100432282)applying the ideas of**relation algebra**to database theory and systems\. We provide some pointers to the literature in our[recent paper](https://arxiv.org/abs/2607.26356)on the[Prela query language](https://prela-lang.org/)\- which brings me to my final point: Prela appears to be the first query language since Van Gucht's[IUGQL](https://scholarworks.iu.edu/iuswrrest/api/core/bitstreams/e9f160dd-e812-44b5-8e38-b776a5cc502d/content)that is based on**relation**algebra\. I believe**relation**algebra really deserves to be known by more people\. Tarski said it best: "the calculus of relations has an intrinsic charm and beauty which makes it a source of intellectual delight to all who become acquainted with it"\.[1](https://remy.wang/blog/ra-ra.html#fn1)Finally, I've started calling it "Tarski's Algebra of Relations", or TAR for short, in hope to avoid confusion in the future\. --- 1. That's right, Tarski calls relation algebra by yet another name, "the calculus of relations", and that is again not the same as the relational calculus in database theory\.\.\.[↩︎](https://remy.wang/blog/ra-ra.html#fnref1)

Similar Articles

Relational modeling and APL

Lobsters Hottest

The author explores combining relational modeling with APL-style array languages using constraint logic and equational rewrite rules, discussing how properties can be defined as bidirectional deductions rather than simple assignments.

A better SQL in 11 lines of code

Hacker News Top

This article introduces Prela, a new query language based on binary relations, and provides a Python tutorial to build a toy version, demonstrating its simplicity compared to SQL.

Towards Anomaly Detection on Relational Data

arXiv cs.LG

This paper introduces RelAD, a reconstruction-based framework for detecting anomalies in relational databases by jointly modeling attribute and relational edge reconstruction. Extensive experiments on six new benchmarks show RelAD outperforms existing methods.

Things I want in a modern relational query language

Lobsters Hottest

The article discusses desired features for a modern relational query language, critiquing SQL's shortcomings and suggesting improvements based on functional programming, better syntax, and user-defined types.