The connection between statistical mechanics and quantum field theory