Skip to content

Explains how collections of couplets form relations, the next level of structure in the Data Algebra, and why grouping facts this way reveals patterns that a single fact cannot show on its own.

Transcript

Slide 1: Welcome to Lesson 3. Last time we found the atom of data – the couplet, a value bound to its usage, written a arrow b. On its own, a single couplet is a lonely thing: one fact and no more. Real data is never one fact; it’s many, gathered together. So in this lesson we take our first step up the tower. We collect couplets into a set, and that set – humble as it sounds – is the first structure with genuine shape. It has a name you’ll already half-recognise from mathematics: a relation. Let’s see what happens when couplets keep company.

Slide 2: Let me recap the couplet in one breath: it is an ordered pair, a arrow b, one directed fact – a value on the left, its usage on the right. Now, a single fact rarely tells you anything useful. To describe even one person you need several facts at once: their name, their birth year, what they did. So the natural next move is simply to gather couplets together. And here is the pleasant surprise – we don’t need any new machinery to do it. We already have the perfect container from set theory: the set. Put couplets in a set, and you have built a relation.

Slide 3: Here is a relation. Three couplets, describing the mathematician Ada Lovelace: name points to ‘Ada’, born points to 1815, field points to ‘computing’. Bundle those three couplets into a single set and that set is a relation. Notice two things that come for free from using a set. First, there’s no meaningful order – the relation is the same whichever way we list the couplets. Second, there are no duplicates – a fact is either in the set or it isn’t. That’s all a relation is: a set of couplets, nothing more exotic. And yet, as you’ll see, it’s a shape you meet every single day.

Slide 4: In fact you already know relations intimately – you just call them by other names. Line up the couplets as fields and it’s a record. Lay them across a spreadsheet and it’s a row. Draw each couplet as an arrow from one node to another and it’s a small graph – Ada in the middle, arrows fanning out to her name, her birth year, her field. Record, row, graph: three things that today live in three different kinds of software, with three different query languages. But they are not three different things. They are one thing – a relation – wearing three sets of clothes.

Slide 5: Because a relation is a set of couplets, it quietly gives us two more sets for free. Gather up all the left elements – all the yins – and you have the domain of the relation: here, the set of name, born and field. Gather all the right elements – all the yangs – and you have its range: ‘Ada’, 1815, and ‘computing’. Domain and range will matter enormously later, because operations like the join work by matching one relation’s range against another’s domain. For now, just hold the picture: every relation carries a left-set and a right-set, and both fall straight out of the couplets it contains.

Slide 6: And now the payoff for building on set theory. Because a relation simply is a set, every operation you already know on sets applies to relations, unchanged. You can take the union of two relations, their intersection, their difference. On top of those, the algebra adds a few of its own: transpose reverses every couplet at once; composition lets you follow one relation into another; superstriction and substriction restrict one relation by another. You don’t need to memorise them today – each earns its own lesson later. The point is the leverage: define an operation once, on sets, and it works on every relation you’ll ever build. And every result is, again, a relation.

Slide 7: Let me put the relation where it belongs. Here’s the tower again. The couplet sits at the foot – an element of G cross G. Climb one step and you reach the relation: a set of couplets, which we write P of G cross G – the power set, meaning ‘all possible sets of couplets’. That single step, from couplet to relation, is the whole pattern of the tower in miniature: take what you have, and form sets of it. Do it again and you’ll get clans; again, and you’ll get hordes. But it all starts with this first, gentle move – gathering couplets into a set.

Slide 8: So, to carry forward. A relation is a set of couplets – and because it’s a set, order and duplicates simply don’t arise. It’s the shape you already know as a record, a row, or a small graph. It hands you a domain and a range for free, and it inherits every set operation plus a handful of algebraic ones. That’s a great deal of structure from one small idea. Next time we climb another rung and gather relations themselves into sets – and when we do, something very familiar appears: the table. In Lesson 4, we meet the clan.

Slide 9: That’s the relation – couplets keeping company, and the first real shape in the tower. Thank you for your time; I’ll see you in Lesson 4, where relations gather into clans.