One motif, the transform algebra
A four-note motif:
motif: 1 2 3 4
Every variation below is declared as an edit of that one line — never a new melody, just the motif read through a transformation:
inverted: { op: invert, pivot: 3 } # 1 2 3 4 → 5 4 3 2 (rising turns to falling)
palindrome: { op: palindrome } # 1 2 3 4 → 1 2 3 4 4 3 2 1
rotated: { op: rotate, by: 1 } # 1 2 3 4 → 2 3 4 1
Each variation points back at the same source; change the motif and every variation follows. And the same algebra works on any line — a melody, a bass line, even the structure of a whole song.