I donāt know basically anything about this at all, but within formal grammars, your post makes me wonder about using finite state automata to, like, generate progressions or something.
Thereās this concept, following Schoenberg and others, of musical set theory which, to be honest, Iāve always kind of disdainedānot for good reasons! just because it struck me as barely scratching the surface as far as realizing mathematical concepts formally within music.
Anyway, one way to think about musical set theory is fixing a set (classically, a collection of āpitch classesā, i.e. note names), and then exploring some permutations of the set. This reminds me of mathematical group theory, where often you are concerned with studying collections of permutations or symmetries.
One interesting wrinkle this viewpoint suggests to me is restricting or changing the kinds of operations you can perform on your set, so that rather than just Schoenbergās transposition, inversion and retrograde, maybe you could let yourself swap the position of a few notes in a melody, or something.
Even studying symmetries of a small number of objects provides us with plenty of interesting algebraic things to think about, so surely there must be a musically interesting way of interpreting that.
Of course thereās also that paper from whence we get the term āEuclidean Rhythmā, which basically comes down to thinking of rhythm as trying to solve some division problem (put 3 beats inside a group of 8 beats) with constraints (space the beats as evenly as possible). Maybe too general to be fruitful, but I suspect interesting things are to be (re-)found if we either change the problem (say, make a 7-note scale from 12 notes), or change the constraints (emphasize beats away from the āfour on the floorā)