Model-free portfolio theory and its functional master formula