A Foundations-of-Computation Approach to Formalizing Musical Analysis