Unfortunately, as most people in computational creativity will tell you, teaching/learning "rules" is only a tiny sliver of the problem. But even getting a computer to "understand" those things in a way that would allow it to apply them to the act of composing is vastly beyond our current understanding.