Analytic representation of the proton-proton and proton-nucleus cross-sections and its application to the sea-level spectrum and charge ratio of muons