Infrared physics of gauge theories and quantum dynamics of inflation