Quantum Monte Carlo formalism for dynamical pions and nucleons