A Unifying Theory of Biological Function