Pion production as a probe of the nuclear matter equation of state