# How does qiskit finally implement a noise model?

I have been reading qiskit documentation for hours and I still don't get how does it implements noise in the circuit. I have understood that it works with a objects of the class QuantumError which finally gives a zip of the quantum instructions (quantum gates that can be applied to the circuit) and the probability of each instruction. Once we have this, how is it really applied to the circuit when we use the add_all_qubit_quantum_error to add the error to the noise model? What I want to do is to check if it is theoretically correct as for a quantum channel the most efficient form to apply this will be to use the Kraus representation:

$$\mathcal E(\rho)=\sum_{k=1}^M E_k \rho E_k^\dagger.$$

For example for the bit-flip case the corresponding Kraus operators E_k will be:

Therefore to add the quantum noise for the bit-flip case we will need to multiply the density matrix of our state by the Kraus operator and its hermitian conjugate as we can see in the Kraus representation of a quantum channel. However I don't understand how can this corresponds with what I have read in the documentation as finally the functions such as pauli_error and so on end up returning a QuantumError object which is finally written as a zip of instructions and probabilities which I guess are append to the circuit in someway. I have carefully read the source code of every noise function that is used to implement the different types of noise and I am not able to figure out whether it is the same as implementing the corresponding Kraus errors, I would be extremely grateful if someone could answer me.

A probability distribution over unitaries {(p_1, U_1),..., (p_k, U_K)}, where you select U_i with probability p_i, is equivalent to Kraus operators \sqrt{p_1}U_1,..., \sqrt{p_k}U_k. For example, the bit flip error can be implemented by randomly deciding whether to leave the state unchanged (with probability p) or apply an X gate (with probability 1-p). With an infinite number of shots, where each shot randomizes independently from the other shots, all measurement statistics will converge to those obtained from the density matrix.