Free electrons can induce entanglement between photons

Entanglement of photons is a fundamental feature of quantum mechanics, which stands at the core of quantum technologies such as photonic quantum computing, communication, and sensing. An ongoing challenge in all these is finding an efficient and controllable mechanism to entangle photons. Recent experimental developments in electron microscopy enable to control the quantum interaction between free electrons and light. Here, we show that free electrons can create entanglement and bunching of light. Free electrons can control the second-order coherence of initially independent photonic states, even in spatially separated cavities that cannot directly interact. Free electrons thus provide a type of optical nonlinearity that acts in a nonlocal manner, offering a way of heralding the creation of entanglement. Intriguingly, pre-shaping the electron’s wavefunction provides the knob for tuning the photonic quantum correlations. The concept can be generalized to entangle not only photons but also photonic quasiparticles such as plasmon-polaritons and phonons.


INTRODUCTION
Developed at the beginning of the twentieth century, quantum mechanics had by now changed the way we see the world. At the second half of the century, it gave birth to the fields of quantum optics and quantum information. One of the fundamental elements of quantum mechanics is the idea of entanglement, which is a nonlocal quantum correlation between different particles. This fundamental feature gave rise to numerous ideas in quantum technologies such as quantum teleportation 1 , quantum communication 2 , quantum cryptography 3,4 , and quantum computation [5][6][7][8] . Photons are the fastest information carriers, have a very weak coupling to the environment, and thus are central to many areas of quantum technologies. Entanglement between two photonic states is at the core of photonics-based quantum technologies, such as quantum teleportation 9,10 , communication [11][12][13][14][15][16] , sensing 17 , imagining 18 , metrology 19 , cryptology 20 , and photon-based quantum computers 21,22 . Therefore, ways to induce entanglement between photons or create entangled light sources have numerous applications in modern quantum technologies.
The conventional approach for creating entangled light uses linear optical operations such as beam splitters, or optical nonlinearities such as spontaneous parametric down-conversion. Linear optical operations [23][24][25] cannot effectively entangle multiphoton states, and techniques based on nonlinearities [26][27][28][29][30] are limited to specific wavelengths and typically suffer from low efficiencies. Thus, methods to create multiple-photon entangled states with non-trivial statistics have practical and fundamental importance. Our work proposes a way to entangle and bunch photonic states using free electrons.
The interaction of a quantum light state and a free electron exchanges quantum information between the light and the electron. This idea has opened possibilities for using electrons to create quantum states of light 48 , and a proposal to induce quantum correlations between different electrons interacting with the same photonic cavity 45 . Moreover, electrons with wavefunctions that are coherently shaped by light can also create entanglement of electrons with optical excitations 51,52 or directly between separated qubits 53,54 . These ideas show how freeelectron interactions open research directions in quantum optics and quantum information.
However, from a fundamental perspective, all free-electronbased light-matter interactions so far were proposed to create entanglement in matter (qubits 53 , free electrons 45 ) rather than in light. This has left free-electron approaches outside an entire area of quantum optics: the creation of entangled light. We propose the use of free electrons as an approach to address this fundamental challenge-creating desired states of multiplephoton entangled light.
Here we show that free electrons can entangle different photonic states (Fig. 1), even when they are spatially separated as with two different photonic cavities. Specifically, we find that post-selection of specific electron energies after the interaction enables creating even stronger entanglement. Importantly, the electron measurement enables heralding the successful creation of entanglement, as well as the bunching and anti-bunching of light. We find the underlying condition to enable the exchange of quantum information: the electron's coherent energy uncertainty must be smaller than the energy of an individual photon. Using this condition, we propose a way by which free electrons can generate second-order correlations in light, making spatially separated light states bunched or anti-bunched. We propose a practical scheme-similar to the Hanbury Brown and Twiss (HBT) experiment 55 -that can be implemented in current setups (e.g., in UTEMs). There, we theoretically show how initially independent (i.e., uncorrelated) light sources can be correlated or anticorrelated using free electrons.
Our approach has several attractive features connected with the nature of free electrons: electrons are ultrafast and thus enable the creation of quantum correlations between short pulses of light. Free electrons can also interact with any light frequency, are easy to detect 56 for post-selection and heralding of quantum light, and their wavefunction can be shaped 49,57,58 to provide additional degrees-of-freedom for controlling quantum correlations. In this manner, free electrons could be envisioned as carriers of quantum information, acting as a type of nonlinear optical medium-one with a nonlocal optical response-with prospects to create phenomena such as quantum teleportation.
Looking at the bigger picture, our concept is directly applicable to the interaction of any quantum particle with any bosonic/ photonic quasiparticle (e.g., plasmons, excitons, magnons, and phonons 57 ). It is exciting to contemplate the broad range of systems that adhere to the general schemes we propose in Fig. 1; for example, electron-phonon interactions can be induced with the exact same formalism (Fig. 1d), creating correlations between the entropy of phonons even in spatially separated solids, practically entangling their temperatures too.

RESULTS
Interactions of free electrons with two photonic states To model quantum electron-light interactions and their quantum correlations, we define our Hilbert space as the tensor product of H e ⊗ H ph and more generally H e H ph 1 H ph 2 , with H e being the Hilbert space of the electron, and H ph i ; i ¼ 1; 2; the Hilbert spaces of each photonic state. To account for the possibility of multiple electron interactions, we use the density-matrix formalism that includes mixed photonic states that cannot be described by a wavefunction. In the case of two photonic cavities, we describe the initial state using the following density matrix: with the final equality based on the (realistic) assumption that the initial electron and photon states are separable before any interaction occurs. The basis of the photonic states consists of the Fock states |n 1 〉, |n 2 〉. The basis of the electron state consists of |k〉, being the state of the electron with energy E 0 + ℏωk. The integer k represents the displacement of the electron energy in units of the light energy quanta ℏω, relative to the central energy E 0 (known as the zero-loss peak). We assume that the electron's central energy is much larger than the photon energy E 0 ≫ ℏω and that the electron energy uncertainty is smaller than the light quanta. These assumptions enable defining the electron states |k〉 as discrete. The assumptions are all satisfied in current electron microscopy experiments 36,41,50,59 that have interactions with photonic excitations that are typically in the optical range. This is exactly the case in all theoretical and experimental papers in the field 31,32,37 . In the rest of the paper, we use this assumption to model all electrons as having discrete energies. This way, we can consider as initial conditions both conventional monoenergetic electron states |0〉 ("unshaped", the spectrum contains only a single energy peak), or "shaped" electron states that appear as coherent superpositions of multiple electron energy states.
The state of the system after one interaction with an electron is where U φ is the free space propagation (FSP) operator which affects the electron state in the manner of , silicon-photonic waveguides (c), and even other types of photonic quasiparticles 57 such as phonons (d), which may entangle the temperatures of spatially separated objects. e One specific experimental setup that can demonstrate the general concept is the ultrafast transmission electron microscope (UTEM), where electrons can interact with evanescent fields and induce quantum correlations between these fields. Here, the two photonic states are created by having a light pulse split into two parts that undergo total internal reflection in two locations inside a prism (similar to 59 ). Another relevant scheme was shown feasible in 36 using classical light.
defined by φ ¼ 2π z zD ; with z being the propagation distance and z D ¼ 4πγ 3 0 m e v 3 = hω 2 . m e is the electron mass, v its velocity, and γ 0 its Lorentz factor. During FSP, each electron energy component accumulates phase at a different rate, as was demonstrated inside electron microscopes and other systems 36,60,61 . S 1 and S 2 are the scattering matrices describing the quantum electron-photon interaction of swift electrons interacting with phase-matched bosonic modes 45 : g Q is the coupling strength, which can be defined as an integral on the electric field along the electron trajectory (considering the second quantized field that corresponds to a single photon excitation) 35,45 . a y i ,a i are the photonic creation/annihilation operators of the bosonic modes with quantized energy ℏω; b † ,b describe the translation in momentum (or equivalently energy) of the electron, which can be defined as b † |k〉 = |k + 1〉, b|k〉 = |k − 1〉, where the state |0〉 is the state of a monoenergetic electron with initial energy E 0 and |n〉 is a monoenergetic electron with energy |E 0 + nℏω〉. Equivalently, one can write b = exp(iωz/v) where z is the position operator of the electron in the first quantization and v is the average velocity of the electron beam 57 . We note that the b,b † operators are not fermionic creation and annihilation operators. Due to the standard approximation used to derive Eq. (3), these operators commute ([b,b † ] = 0), which is opposite from the case of fermion operators that anticommute.
The required assumptions to derive Eq. (3) is that the initial electron energy E 0 is much larger than ℏω, and that the electron is paraxial, i.e., the momentum in the transverse direction is negligible compared to the momentum along the z axis. These assumptions allow us to: (1) perform the paraxial approximation and reduce the dynamics of the electron to a 1D problem and (2) linearize the dispersion relation of the electron around its initial energy E 0 , which allows us to relate the momentum translation operator b to an energy ladder operator with equal energy spacings. Those assumptions are well justified under the typical condition inside transmission electron microscopes 35,50 , and recently also scanning electron microscopes 62 . A detailed derivation and discussion of the assumptions can be found in section 1 of the Supplementary Material of 45 .
Because the operators of the light and the electron commute, [a, b] = 0, we can represent the scattering matrices as a sum of the multiplication of two commuting operators-one for the light and one for the electron. Consequently, we develop an efficient representation of the interaction with multiple cavities: The A φ k operators contain only the photonic creation/annihilation operators a y i ,a i . The complete derivation can be found in Supplementary Note 1.1.
This approach allows us to investigate and simulate many interactions of consecutive electrons with one or more photonic states. Next, we investigate induced correlations between two states of light for two different options: (1) when not measuring the electron's energy and tracing it out after each interaction; (2) when measuring the electron after the interaction and postselecting on certain desired energy values.
Inducing photon correlations using free electrons In this section, we show how a free-electron interaction can correlate two states of light even without measuring the electron state after the interaction (i.e., without post-selection). A strong entanglement is possible when post-selecting on the electron energy measurement (shown in the next section). It was shown that electrons of narrow energy distribution (i.e., a single energetic state, a Kronecker "delta" electron, described by the zero-loss energy |E 0 〉) can induce entanglement between the electron and a photonic state 45 . This discovery motivates utilizing electrons to create quantum correlations between the photonic cavities. In the language of quantum information, we regard the two photonic states as the principal system and the electron as the environment 63 . Since the electron does not have to be measured following the interaction, the system is generally an open quantum system. After each electron passed by, we trace it out to find the density matrix of the photonic system ρ We then repeat the calculation with the next electron (an illustration is provided in Fig. 2a).
The electron index that interacts with the light is represented by m = 0, 1, 2, .. with m = 0 being the initial state before any interaction (i.e., |E 0 〉). The joint photonic state after m consecutive electrons can be written as an operator-sum representation 63,64 : while the A φ k operators, known as operation elements or Kraus operators, contain only the photonic creation/annihilation operators a y i ,a i and are defined in Eq. (5). The complete derivation can be found in Supplementary Note 1.2. Using this approach, one can describe the dynamics of the principal system (the two states of light) without explicitly considering the properties of the environment (the free electrons). This way, we investigate the photonic states' properties, such as quantum correlations and statistics, after many interactions.
We examine the difference between the joint-photonic probability distribution P(n 1 ,n 2 ) (which is depicted in Fig. 2c) and the multiplication of the individual photonic probability distributions P (n 1 )P(n 2 ). P(n) is defined as the probability to have n photons in the photonic state. The difference increases with each electron interaction, indicating correlations between the photonic states as depicted in Fig. 2d. We can also quantify the correlations using the quantum mutual information 63 between the two states of light (Fig. 2b), indicating that the photonic states become dependent on each other and increasingly so following more electron interactions. Note that these correlations are not necessarily quantum. Testing whether the correlations are truly quantum requires different criteria, as discussed below.
To check whether we have entanglement between the two photonic cavities in this case, we use two criteria from quantum information: the Peres-Horodecki criterion for entanglement 65,66 and the realignment criterion 67,68 . Both are sufficient but not necessary conditions for entanglement. Generally, the problem of verifying entanglement of mixed states is an NP-hard problem 69 . Since we are dealing with mixed states in an infinite Hilbert space, no current criterion can provide necessary conditions for entanglement. For example, the Peres-Horodecki and realignment criteria give a near-zero result, meaning that they did not exclude entanglement, yet they also could not distinguish whether the correlations in Fig. 2 represent entanglement or just classical correlations. Thus, further research on the amount of entanglement created by the scheme without post-selection such as we present here is a formidable task and left for future research. We show below that modifying the experiment to use electron post-selection avoids this inconclusive situation, creating states of light that are strongly entangled.
A key requirement for the transfer of information between the cavities is for the electron to undergo a certain distance of FSP between the interactions. Without this evolution, electrons cannot mediate any influence of the first photonic state on the second one. We can explain this lack of influence by noticing that the absolute value of the electron's wavefunction is not modulated after a coherent electron-photon interaction 36 and rather requires FSP for the modulation to arise. Since the electron-light interaction only depends on the electron's amplitude (rather than its phase), the FSP stage is necessary. From a mathematical point of view, the key to the lack of induced correlations in the case of no FSP is that S 1 , S 2 commute, [S 1 , S 2 ] = 0 (see Supplementary Note 2). Consequently, without FSP, there is complete symmetry between the two photonic states, and the theory does not change if one would replace the order of interactions or even if they both happen simultaneously.
To transfer quantum information between the cavities, we can shape the electron's amplitude in a manner that depends on the first cavity state, imprinting the information on the electron's wavefunction, so it is transferred to the second cavity. Returning to the mathematical point of view, the addition of FSP breaks the symmetry in the problem, since the FSP operator does not commute with the S 1 , S 2 operators.
The electron can give/take net energy to the second photonic state depending on the first photonic state, as shown in Fig. 3. It is interesting to consider whether such an effect can occur in the opposite direction, i.e., transferring energy backward through the induced entanglement. It is not trivial but possible to prove that regardless of the quantum state of the interacting electron, one cannot transfer energy backward. For the analytical proof and more information regarding this subject, see Supplementary Note 3. These results show how a natural arrow of time emerges from the order of entanglement events. Thanks to the specific commutation relations, the electron interaction can be described as occurring first with cavity ph 1 and afterward with cavity ph 2 , creating a notion of causality as a result of the induced entanglement.

Entanglement between photonic states using post-selection
Strong quantum correlations can be induced by post-selecting on the electron's energy after one interaction (as proposed recently for the generation of entanglement between qubits 46 .) This approach allows the creation of quantum entanglement between many photons and even creating Bell states of light. This can be realized inside transmission electron microscopes because of the precision of the electron energy spectrometer that can measure a single event and distinguish the number of photons exchanged. We begin with an electron at the zero-loss energy |E 0 〉 that interacts with two arbitrary states of light as seen in Fig. 4a. After one interaction, we measure the electron with a projection operator of one defined energy, E 0 − kℏω, where k is an integer. Using the A k operators defined above in Eq. (5), the density matrix of the remaining light state after the post-selection can be expressed as ph2 is the initial density matrix of the two states of light. The probability to post-select the electron with the requested energy is (see Supplementary Note 1.3) After the measurement, the remaining joint light state is a pure state. In this case, we can quantify the entanglement between the two states of light by using the entropy of entanglement 70,71 . The entropy of entanglement is the von Neumann entropy 72 of the reduced density matrix for any of the subsystems: For a pure state ρ AB = |ψ〉〈ψ| AB , S(ρ A ) = −Tr(ρ A logρ A ) = S(ρ B ). In our case, the two subsystems are the two states of light. If the entropy of entanglement is non-zero, i.e., the subsystem is in a mixed state, it indicates that the two subsystems are entangled. Figure 4 shows that the free-electron interaction can induce quantum entanglement between any two general states of light, even ones with multiple photons. In addition, the electron is heralding the creation of entanglement and its amount when it is detected, providing a non-destructive measurement method for heralding of the entangled light. Specifically, when measuring the electron with electron energy loss spectroscopy, one can tell precisely which photonic parameters to expect and when the entanglement is occurring with femtosecond time resolution 31,36 .
Let us focus on a particular case of this result-the creation of a Bell state. An electron with initial energy |E 0 〉 goes through two empty cavities and is later measured with energy E 0 − ℏω. the post-selected state of light will be a Bell state ψ ph The probability of achieving this entangled state is~2|g Q | 2 for |g Q | ≲ 0.2, and the maximum value of this probability is P = 0.37, for g Q = 0.7. this value of g Q can already be achieved in current experiments 73 . The full derivation can be found in Supplementary Note 4. Figure 4c, d presents maps of the post-selection probability and entanglement entropy as a function of g Q and the number of photons. Such experiments can be performed in current setups with repetition rates of few MHz 50 , with higher repetition rates possible using different ultrafast microscopy techniques [74][75][76] , and with continuous-wave operation recently shown possible 50,77 ).
Hanbury Brown and Twiss type experiment using free electrons Until now, we have seen how one can use free electrons to create entanglement, with or without post-selecting them. Let us look at these experiments through the lens of quantum optics by imagining the following gedanken experiment: the initial photonic state is sent through a beam splitter into two interaction points with additional relative phase ϕ. A second-order correlation between the two light states is detected, using the following definition of second-order correlations: where 〈a i 〉 = Tr(ρ i a i ), 〈n i 〉 = Tr(ρ i n i ), 〈n 1 n 2 〉 = Tr(ρ 12 n 1 n 2 ) This measurement scheme is analogous to the HBT experiment 55 , except for the induced correlations arising from the free electrons' interactions. In addition, it provides a way to examine how free electrons can correlate or anticorrelate light. We can consider the interaction of the same two states of light with multiple electrons if they arrive as a dilute beam so that we can neglect the Coulomb interaction between them. Assuming the beam carries m such electrons, and assuming that they are initially unshaped, the problem turns out to be analytical and straightforward using the Heisenberg picture. The initial secondorder correlation function is g After m electron interactions, we achieve the following second-order correlation (see Supplementary Note 5): This formula shows that even for photonic states that were initially uncorrelated, i.e., g 2 ð Þ 0 ¼ 1, or for empty cavities, consecutive interactions can induce second-order correlations between them (Fig. 5a).
Interestingly, inserting FSP between the two interactions, we find that the FSP phase plays a similar role to the relative phase between the states of light (Fig. 5f). Therefore, one can alternate between these two experimental knobs-creating the delay between the states of light by altering the actual light path or delaying the electron between the interactions (FSP). These ideas provide degrees of freedom to shape the light statistics, induce second-order correlations, and create anti-bunched light.
Shaping the electron wavefunction to control correlations We found that the induced correlations strongly depend on the shape of the electron wavefunctions and the quantum state of the light. An electron cannot induce quantum correlations when its coherent energy uncertainty is comparable or bigger than the photon energy (Fig. 5g, h). This concept is analogous to a similar uncertainty-width-dependence found in electron radiation mechanisms 78 . Electrons of wide coherent energy uncertainty, or equivalently, "comb" electrons that are made from a series of energy peaks, ℏω apart, with a constant phase difference between them (Fig. 5i, as demonstrated recently 59 ), cannot induce secondorder correlations. Instead, their interaction with each cavity is equivalent to performing a displacement operator on the state of light in that cavity 45,48 , maintaining a separable joint state.
In contrast to the interactions of wide-uncertainty electrons, narrow-uncertainty electrons can be used to control the quantum state of light and achieve non-trivial photon statistics. When starting from an initially classical (coherent state) light, the electron can modify the correlations by creating anti-bunching (i.e., g (2) < 1). For this to occur, we must set a certain delay that creates a relative phase difference ϕ between the two states of light, as shown in Fig. 5e. Another way of achieving the relative phase needed for anti-bunching is delaying the electron between the interactions, as shown in Fig. 5f.

DISCUSSION
Our work proposes a way to create entanglement, bunching, and anti-bunching of light. We predict that coherent free electrons can entangle two spatially separated states of light, with the electron's energy uncertainty altering the level of entanglement. From a fundamental perspective, this shows that electron-photon interactions can create a type of nonlinearity, which is nonlocal and creates quantum correlations between separate photonic quasiparticles. Our proposed concepts can be implemented in state-ofthe-art experiments such as in ultrafast transmission electron microscopy, which implement coherent electron-photon interactions [31][32][33][34][35][36][37]43 .
We emphasize that post-selecting on the electron's energy enables the creation of strong entanglement of photonic states, heralded by the measurement of the electron. Furthermore, preshaping of the electron's quantum state can control the quantum correlations. This way, one can use the electron to control the quantum shape of light and modify classical light sources into In both panels, we mark interesting initial parameters (one of them is discussed in the text and represents the creation of a Bell state).
quantum. Our findings provide a step towards a bigger goal: inventing methods to create many-photon entangled states with non-trivial statistics. This approach is of fundamental interest for a wide range of applications of quantum technologies, such as photonic quantum computing. We found that the electron can transfer information between two photonic states through its entanglement with both of them, in a process akin to quantum-teleportation. This process is possible only if the distance between the cavities is large enough such that electron dispersion has time to alter the electron's spatial shape. In that case, the order of interactions affects the result in a way that spawns a natural arrow of time in the problem. As an example of its consequences, when the distance between interactions is negligible (equivalent to a simultaneous interaction), the electron cannot exchange any information or energy between the cavities. The distance between interactions limits the transfer of information between the cavities.
These results can be extended beyond photonic cavities, for example, to electron-phonon interactions and to electron-qubit interactions, generalizing the results of previous works 53,54 . Looking forward, we envision future quantum optical experiments based on networks of electrons and photons, creating high-dimensional hyper-entanglement that involve cluster states of spatially separated photonic states.

Evolution of the states of light in terms of Kraus maps
This section of Methods presents the formalism developed for the predictions in the manuscript, evolving the light density matrix without considering the electron, in the case of a monoenergetic electron with energy E 0 . We consider each free electron as the noise and the two states of light as the system. We then compute the evolution of the system only with a Kraus map 63,64 . The evolution of the combined system of the electron and two photonic states follows the following unitary operators: S 1 and S 2 for the electron interaction with the two photonic states, and U φ for free-space propagation. As detailed in Supplementary Note 1.1, the multiplication of these provides: while the A k operators contain only the photonic creation/annihilation operators a y i ,a i and defined in Eq. (5); b describes the translation in momentum (or equivalently energy) of the electron. The light density after the interaction without measuring the electron (i.e., tracing out the  Fig. 5 Controlling the second-order coherence of light via electron shaping. a An analog of the Hanbury Brown and Twiss (HBT) experiment, into which we add photon correlations through the interaction with free electrons. A scheme that can be implemented in current electron microscopes: two separated light pulses interact with consecutive (unshaped) electrons. g (2) for the light created in two initially empty cavities after electron interactions as a function of the number of electrons (b), showing that second-order correlations can be induced when starting from vacuum fluctuations. Map of g (2) for any two initially uncorrelated states of light (c). The result is independent of the specific states of light, only depending on the number of electrons and the average photon number (through the parameter 〈n〉|g Q | −2 ). For many electrons, g (2) → 2, the light becomes bunched, thermalized, and second-order correlations are induced. The comparison of electrons with narrow energy uncertainty (d) and wide energy uncertainty (g) shows that for a coherent uncertainty wider than the photon energy ℏω, interaction cannot induce quantum correlations. The lack of correlations is seen in g (2) in h. It is possible to imitate the effect of a wideuncertainty electron by instead creating a "comb" electron (i) 45,59 . The second-order correlation g (2) can be modified by consecutive interactions as shown in e, starting by two classical coherent states of light, and plotting g (2) after N = 1 and N = 5000 interactions. For large N, g (2) → 2, the light becomes bunched and thermalized. For a smaller number of interactions, it is possible to achieve g (2) < 1, an anti-bunched light, depending on the relative phase ϕ between the two states of light. α is the coherent state parameter and g Q is the coupling strength. A map of g (2) after one interaction is shown in f, demonstrating the role of the relative phase of light ϕ and the phase φ accumulated by the freespace propagation (FSP) of the electron between the two points of interaction. The interaction strength is g Q = 0.4. electron) is given in terms of the A k operators: Thus, the A k operators are the Kraus operators of this problem and obey the completeness relation: P 1 k¼À1 A φy k A φ k ¼ I. This method can be used to evaluate the photonic density matrix after the interaction of one state of light with a monoenergetic electron, without measuring the electron (i.e., tracing out the electron): Moreover, the same method can be used to evaluate the joint state of the two states of light after the interaction and the post-selection of the electron's energy E 0 − kℏω: while initially ρ

Methods to check entanglement
To check the entanglement in the joint photonic pure state after postselecting the electrons, we used the entropy of entanglement 71,72 . The entropy of entanglement is an entanglement measure for bipartite pure states. It is defined via the von Neumann entropy of one of the reduced states. For a pure state ρ AB , the entanglement entropy is given by: S(ρ A ) = −Tr(ρ A log ρ A ) = −Tr(ρ B log ρ B ) = S(ρ B ). We used Eq. (8) to simulate the final density matrix of light after the post-selection.
To check the entanglement in the joint photonic mixed state after tracing out the electrons, we used the Peres-Horodecki criterion for entanglement 65,66 and the realignment criterion 67 . Both are necessary conditions for the joint density matrix of two quantum systems to be separable (i.e., not entangled) but not sufficient. To find them, we numerically calculated the final density matrix of the light joint state, using Eq. (7), and used the functions IsPPT, Negativity, Realignment, and TraceNorm in the QETLAB toolbox 68 .

Heisenberg picture
To calculate the analogy of second-order coherence between two photonic states, we used the Heisenberg picture. The Heisenberg picture is a formulation of quantum mechanics in which the operators incorporate a dependency on time, but the state vectors are time-independent. Throughout the paper, we used the following identity: while S is the scattering matrix describing the quantum electron-photon interaction; a is the photonic annihilation operator; b describes the translation in momentum (or energy) of the electron; g Q is the interaction strength. The full mathematical proof can be found in Supplementary Note 5.1.

Numerical calculation
All the numerical calculations in the main text were performed using MATLAB and the QETLAB toolbox for quantum entanglements 68 .

DATA AVAILABILITY
The data that support the findings of this study are available from the corresponding author upon request.