A Mathematical Framework for Emergent Structure