Introduction

Quantum simulations boost the development of topological materials1, quantum transport2 and quantum algorithms3 for the benefit of low-power electronics4, spintronics5 and quantum computing6. They employ intricate quantum interference of light or matter particles. This is a challenging task: the difficulty arises from the fundamental constraint that all interfering quanta must be indistinguishable7. Violating this demand precludes the observation of such coherent phenomena in larger scales, in terms of particle number and duration.

So far, protocols have mainly relied on the use of three distinct quantum states: numerous qubits implemented by superconducting circuits8 and electronic states of trapped ions9,10; coherent states of photons11 and atoms (Bose–Einstein condensates)12; and multiple single-particle Fock (number) states distributed among many modes in photonic waveguides13,14,15,16,17,18 and optical lattices19. Thus, simulations have never seriously profited from interference of multi-particle Fock states, even though the importance of this regime has been recognised20, and the first attempt to mimic it with many-body systems was made21.

Here we experimentally and theoretically demonstrate that multiphoton Fock state interference can be useful for quantum simulations that address applications of high impact. We employ a single multiport interferometer with a tunable parameter that encodes time to reach a late state of evolution. This approach allows us to avoid error accumulation that is typical for methods that build on numerous quantum gates or steps of a quantum algorithm22,23,24,25,26,27. This is a counterpart of a hardware-encoded operation in classical computation, where a single binary instruction realizes a complex algorithm consisting of several primitive steps in one tick of a system clock. Remarkably, utilisation of photon-number detection in our setup grants us access to a hidden non-linearity induced by a projective measurement, a technique that enables universal quantum computation with linear optics28,29.

As a concrete example, we consider a quantum gate architecture that consists of a single beam splitter; however, this approach can be generalised to more complex interferometric networks. Our idea, shown in Fig. 1a–c, is based on overlapping two multiphoton Fock states, $${\left|l\right\rangle }_{a}$$ and $${\left|S-l\right\rangle }_{b}$$ (l photons in mode a and S − l in mode b), on a beam splitter with tunable reflectivity r which programmes the simulation duration. We then collect photon statistics at its outputs.

The scope of our example embraces a chain of S + 1 two-level spins that initially contains just one spin excited, and that is subjected to an XY interaction. The excitation probabilities at its sites after the interaction duration are determined by the output photon statistics. These mappings are based on a solid mathematical grounding known as the Schwinger representation which links quantum harmonic oscillators with representations of spin Lie algebra su(2). See Supplementary Note 1 for details.

Our platform also allows us to simulate certain classes of fermionic systems, e.g. a non-linear Su–Schrieffer–Heeger (SSH) model30, obtained from the XY spin chain by a Jordan–Wigner transformation31. Furthermore, we can map to Bogoliubov–de Gennes Hamiltonians, simulating many-body systems beyond the single-excitation subspace, e.g. a p-wave superconducting chain (Kitaev model)32, and the transverse-field Ising model9.

Due to recent advances in photon-number-resolved detection, we were able to employ transition-edge sensors (TESs)33 to count photons exiting the beam splitter. Amazingly, TES measurements correspond to single-site-resolved detection in the chain. The use of TESs is crucial, as Fock state quantum interference is evidenced by photon bunching. For example, two identical photons impinging on a balanced beam splitter leave in a superposition of two-photon Fock states, with both always being detected in the same output port. This is known as the Hong–Ou–Mandel (HOM) effect34 whose generalised form can be observed for higher-order Fock states if they are prepared in similar polarisation, spectral and spatio-temporal modes35, as shown in Fig. 1d.

Results

Fock state quantum simulations

The Fock state quantum simulations build on a beam-splitter interaction $${U}_{\,\text{BS}\,}^{(r)}\,=\,{e}^{-i\theta (r){H}_{\text{BS}}}$$, guided by the Hamiltonian

$${H}_{\text{BS}}=\frac{1}{2}({a}^{\dagger }b+a{b}^{\dagger }),$$
(1)

where a and b denote photonic creation operators that act on the interferometer input modes. The reflectivity r, defined as the probability of reflection of a single photon, encodes the interaction time $$\theta (r)=2\arcsin \sqrt{r}$$. For entries $${\left|l\right\rangle }_{a}$$ and $${\left|S-l\right\rangle }_{b}$$, the computational output from the beam splitter and detectors is36

$$p(k)={|\langle k,S-k|{U}_{{\rm{BS}}}^{(r)}|l,S-l\rangle |}^{2}={|{\phi }_{k}^{(r)}(l-Sr,S)|}^{2},$$
(2)

where $${\phi }_{k}^{(r)}(x,S)$$ is the Kravchuk function37.

We selected three distinct examples of simulations, shown in Fig. 2, for experimental demonstration. The first a, uses input data initialised to $${\left|\frac{S}{2}\right\rangle }_{a}{\left|\frac{S}{2}\right\rangle }_{b}$$ and the setting of r = 0.5. For the second and third b & c, we set $${\left|0\right\rangle }_{a}{\left|S\right\rangle }_{b}$$ and repeated the computation several times while gradually increasing r. While for the second programme one can use any value of S, the third one runs exclusively for an odd number of photons.

Edge states in non-linear systems

Interpretation of the outcomes of our quantum programmes becomes straightforward if we consider matrix representations of HBS and of the Hamiltonian describing a general chiral XY $$\frac{1}{2}$$-spin chain $${H}_{\text{XY}}=\mathop{\sum }\nolimits_{n = 1}^{S+1}\frac{{J}_{n}}{2}\ ({\sigma }_{n}^{x}{\sigma }_{n+1}^{x}+{\sigma }_{n}^{y}{\sigma }_{n+1}^{y})$$, where $${\sigma }_{n}^{x}$$ and $${\sigma }_{n}^{y}$$ are the Pauli operators acting on the nth spin. In the single excitation subspace spanned by the states $$\left|n\right\rangle ={\sigma }_{n}^{+}\left|{\downarrow }_{1},\ldots ,{\downarrow }_{S+1}\right\rangle$$, where $${\sigma }_{n}^{+}=(1/2)\left({\sigma }_{n}^{x}+i{\sigma }_{n}^{y}\right)$$ is the raising operator, the latter has matrix elements $${\left[{{\bf{H}}}_{\text{XY}}\right]}_{mn}^{\text{Spin}\,}=\left\langle m| {H}_{\text{XY}}| n\right\rangle ={J}_{n-1}{\delta }_{n,m+1}+{J}_{m-1}{\delta }_{m,n+1}$$, where δi,j denotes the Kronecker delta. The elements of HBS in the Fock state basis are given by $${\left[{{\bf{H}}}_{\text{BS}}\right]}_{nm}^{\text{Fock}\,}=\left\langle n,S-n| {H}_{\text{BS}}| m,S-m\right\rangle$$. The two representations are identical, $${\left[{{\bf{H}}}_{\text{BS}}\right]}_{nm}^{\text{Fock}\,}={\left[{{\bf{H}}}_{\text{XY}}\right]}_{nm}^{\text{Spin}\,}$$, when we set the spin couplings to $${J}_{n}=\frac{1}{2}\sqrt{n(S+1-n)}$$. As these amplitudes are non-periodic, this chain lacks translational invariance. This precludes the usual Fourier space methods used for characterising topological insulators. Remarkably, photon statistics measured behind the beam splitter is capable of simulating this non-crystalline system. The existence of topologically non-trivial states is indicated here by the fact that the Hamiltonian belongs to the chiral orthogonal (BDI) class of Altland–Zirnbauer symmetry classes, characterised by a $${\mathbb{Z}}$$ topological invariant. Our first programme performs a real-space study of this system and computes probabilities that describe its zero-energy eigenmode, $$\left|{{{\Psi }}}_{0}\right\rangle =\mathop{\sum }\nolimits_{k = 0}^{S}{e}^{-i\frac{\pi }{2}(S/2-k)}\ {\phi }_{k}^{(1/2)}(0,S)\ {\sigma }_{k+1}^{+}\left|{\downarrow }_{1},\ldots ,{\downarrow }_{S+1}\right\rangle$$. Unlike the typical edge states which are exponentially peaked at the ends of a quantum wire, these two edge states are weakly localised and plateau to a constant value in the bulk, given by $$\frac{4}{\pi S\sqrt{1-{(2k/S-1)}^{2}}}$$, as outlined in Fig. 2a. The intensity-dependent amplitudes Jn render HXY a generalisation of the seminal Su–Schrieffer–Heeger (SSH) model30 to the non-linear regime38. See Supplementary Notes 2 and 3 for details.

Perfect state transfer

The XY spin chain with these couplings has been extensively studied in the literature due to its remarkable property of facilitating the perfect transfer of an arbitrary quantum state16,17,39,40. Our quantum simulation provides an insight into this system from which the perfect transfer becomes self-evident. The equivalence of HBS and HXY matrix representations implies the correspondence between interactions generated by these Hamiltonians, $${U}_{\,\text{BS}\,}^{(r)}$$ and $${U}_{\text{XY}}(t)={e}^{-it{H}_{\text{XY}}}$$, respectively. Mathematically, the beam-splitter interaction in the Fock state basis amounts to an α-fractional Quantum Kravchuk–Fourier transform (α-QKT) of the input state with fractionality $$\alpha =\frac{4}{\pi }\arcsin \sqrt{r}$$36. As 2-QKT is the spatial inversion operator37, so is UXY(t) at t = π. Therefore, the transfer is an effect of mirror reflection of a quantum state w.r.t. the chain centre. Proving this fact was tricky within the framework of spin chains, whereas it is an evident conclusion from our photonic simulations. We note that α = 2 implies interference on a perfectly reflecting beam splitter (r = 1) which swaps input states at its outputs. To demonstrate this behaviour, in our second programme, we simulated the state transfer of a strongly localised edge state, typical of e.g. the SSH model. The initial Fock state $${\left|0\right\rangle }_{a}{\left|S\right\rangle }_{b}$$ is gradually transformed to $${\left|S\right\rangle }_{a}{\left|0\right\rangle }_{b}$$ for increasing r, as shown in Fig. 2b. Derivations are presented in Supplementary Note 4.

Generalised Majorana modes

Multiphoton Fock state interference also facilitates the simulation of many-body systems that are not restricted to a single excitation subspace. For example, a p-wave superconducting chain (Kitaev model)32 is described by the mean field Hamiltonian $${H}_{{\rm{K}}}=\mathop{\sum }\nolimits_{n = 1}^{N}\{-{\mu }_{n}({c}_{n}^{\dagger }{c}_{n}-1/2)-{t}_{n}({c}_{n+1}^{\dagger }{c}_{n}+{c}_{n}^{\dagger }{c}_{n+1})+{{{\Delta }}}_{n}({c}_{n+1}^{\dagger }{c}_{n}^{\dagger }+{c}_{n}{c}_{n+1})\}$$, where $${c}_{n}^{\dagger }$$ and cn are creation and annihilation operators for electrons on the nth atomic site, while μn, tn and Δn are site dependent chemical potentials, hopping amplitudes and superconducting pairing potentials, respectively. This Hamiltonian may be expressed in the form $${H}_{{\rm{K}}}=\frac{1}{2}{\chi }^{\dagger }{{\bf{H}}}_{{\rm{BdG}}}\chi$$ where $$\chi =\frac{1}{\sqrt{2}}{({a}_{1},-i{b}_{1},{a}_{2},-i{b}_{2},\ldots {a}_{N},-i{b}_{N})}^{{\rm{T}}}$$ is a Nambu spinor and HBdG is the Bogoliubov–de Gennes Hamiltonian matrix, in the basis of Majorana operators $${a}_{n}={c}_{n}+{c}_{n}^{\dagger }$$ and $${b}_{n}=i({c}_{n}^{\dagger }-{c}_{n})$$. The beam-splitter Hamiltonian in the Fock state basis HBS is identical to HBdG for the parameters $${\mu }_{n}={J}_{2n-1},{t}_{n}={{{\Delta }}}_{n}=\frac{{J}_{2n}}{2}$$, where 2N = S + 1. This correspondence allows one to simulate the Heisenberg evolution of the Majorana operators over the interaction time θ(r), as well as the evolution of the real fermion operators cn and $${c}_{n}^{\dagger }$$, by using linear superpositions of Fock states as input. In particular, the evolution of the operators an and −ibn is encoded by the evolution of the photonic modes $${\left|2(n-1)\right\rangle }_{a}{\left|S-2(n-1)\right\rangle }_{b}$$ and $${\left|2n-1\right\rangle }_{a}{\left|S-(2n-1)\right\rangle }_{b}$$, respectively. To evidence this, a further simulation with input $${\left|0\right\rangle }_{a}{\left|S\right\rangle }_{b}$$ was performed, where S is an odd number, modelling the perfect transfer of Majorana modes between the two ends of a p-wave chain of $$N=\frac{S+1}{2}$$ atomic sites that is depicted in Fig. 2c. This is half the number of sites as in the XY spin chain, reflecting the fact that each physical fermion comprises a pair of Majoranas. The simulated dynamics also apply to one-dimensional arrays of photonic cavities41 where the effective superconducting pairing and Majorana modes arise from Kerr-type non-linearities within a Bose–Hubbard model. See Supplementary Note 5 for more details.

Non-uniform transverse-field Ising chain

One can also simulate a transverse-field Ising model, $${H}_{{\rm{K}}}=\frac{1}{2}\mathop{\sum }\nolimits_{n = 1}^{N}({\mu }_{n}{\sigma }_{n}^{z}+2{t}_{n}{\sigma }_{n}^{x}{\sigma }_{n+1}^{x})$$, since this is related to the p-wave superconducting chain by a Jordan–Wigner transformation. Due to the non-uniform field μn and spin couplings tn, the system inherits the perfect mirror reflection from the beam-splitter dynamics and allows for perfect state transfer after an interaction time θ = π. We thus highlight a quantum spin network that allows perfect transfer, similar to the previously discussed XY model, but which has not been considered by previous authors. For example, to simulate the transfer of an excited spin between ends of a chain, one should interfere the state $$\frac{1}{\sqrt{2}}({\left|0\right\rangle }_{a}{\left|S\right\rangle }_{b}+{\left|1\right\rangle }_{a}{\left|S-1\right\rangle }_{b})$$ on a balanced beam splitter. Detailed derivations are presented in Supplementary Note 5.

Experimental study

Figure 3 shows the experimental integrated-photonics schema used for Fock state quantum simulations. Two pulsed spontaneous parametric down-conversion sources (SPDC) each generated independent two-mode photon-number-entangled states $$\left|{{\Psi }}\right\rangle =\mathop{\sum }\nolimits_{n = 0}^{\infty }\sqrt{{\left\langle n\right\rangle }^{n}}\ \left|n,n\right\rangle$$ with an average photon number $$2\left\langle n\right\rangle =0.4$$. For the pump repetition rate of 75 kHz this led to ~0.46 five-photon (12 four-photon) Fock states created per minute in each arm of the SPDC, of which about 0.2 (6) reached the detectors due to ca. 50% losses in the set-up. One mode from each $$\left|{{\Psi }}\right\rangle$$ (the idlers, c and d) was sent to a TES. Due to photon-number entanglement in $$\left|{{\Psi }}\right\rangle$$ states, the outcomes of TESs, l and S − l, heralded the creation of Fock states $${\left|l\right\rangle }_{a}$$ and $${\left|S-l\right\rangle }_{b}$$ in the signal modes a and b.

We characterised the set-up to confirm the high degree of indistinguishability of these Fock states, the key issue for multiphoton HOM effect. We measured the standard HOM interference dip between both sources for a small mean photon number of the order of 10−4, and achieved the visibility VHOM = 85.9%. Next, we took a measurement of the second-order correlation function for each SPDC source separately and observed g(2) ≥ 1.86 ≈ 1 + VHOM, which corroborates the previous result. An effective Schmidt mode number of $$K=\frac{1}{{g}^{(2)}-1}=1.16$$ proves our SPDC sources nearly single-mode.

The measured simulations are presented in Fig. 4. The data shown in Fig. 4a, b consists of ~1.6 × 103 registered events, for each value of r, in which the total number of photons was S = 4. The data in Fig. 4c comprises 2.3 × 102 measurements, for each value of r, in which S = 5. We compared them with a numerical model based on Eq. (2) supplemented with the analysis of experimental imperfections, and found that they are in good agreement. Errors were estimated as a square root inverse of the number of measurements. See ‘Methods’ for details.

In Fig. 4a we show the photon statistics recorded by TES2−3 for the coupler splitting ratio r = 0.5, conditioned on the heralded photon numbers l = 2 and S − l = 2 in modes c and d. They directly model a zero-energy eigenmode of a non-linear SSH model described by $${\left[{{\bf{H}}}_{\text{BS}}\right]}_{nm}^{\text{Fock}\,}$$, with emerging two weakly localised edge states. Figure 4b depicts the statistics gathered for l = 0 and S − l = 4 for several splitting ratios: r = 0.04 (green squares), 0.3 (orange triangles), 0.5 (blue circles) and 0.96 (red diamonds). It visualises perfect state transfer of the first spin excitation in the chain of 5 particles by means of continuous-time mirror reflection w.r.t. the chain centre. Figure 4c shows an experimental simulation of the perfect transfer of a Majorana fermion in a p-wave superconducting chain of 3 sites that is based on the statistics gathered for l = 0 and S − l = 5 for all the listed values of r.

Discussion

Multi-particle Fock state interference is a compelling method in the field of quantum simulations, promising for studying non-crystalline topological materials, beyond the recently challenged bulk-edge correspondence theorem42,43. It allowed us to simulate systems as diverse as an XY spin chain and a non-linear SSH model, as well as the perfect transfer of Majorana fermions over a quantum wire, in a system that is not tied to a single-excitation subspace. The presented examples apply to a variety of systems such as superconducting nanowires44, disordered graphene quasi-1D nanoribbons45 and disordered cold atoms46. These may find applications in next-generation electronics47 and spintronics48 operating with almost no energy dissipation and speeds exceeding 100 GHz.

Remarkably, photon-number-resolved detection we use introduces an effective non-linearity into our system, a feature which can be harnessed in simulated models. This effect is a result of combining quantum interference with a projective measurement, realized with TES detectors in our demonstration. It was recognized as an important component enabling universal quantum computation with linear optics28,29.

Multiphoton Fock states have been utilised in quantum simulations in a very limited capacity until now. The main focus has been on the successful manipulation of large numbers of single or two-photon states in bulk optics49,50,51, as well as in integrated platforms52,53,54. For example, output states of quantum walks in coupled waveguides mostly consist of single photons, with only a small fraction of two-photon states13,14,15,18. The perfect state transfer in an XY spin chain that we consider has also been simulated using both continuous16 and discrete-time17 single-photon quantum walks. An advantage of this approach lies in easily engineered waveguide layouts which can be used to tune the couplings between spins18. However, a simulation of N spins using single photons requires at least N coupled waveguides, with the circuit length specifying the simulation duration. Thus, large waveguide arrays are needed, and it is difficult to vary the spin-chain length or interaction time without fabricating many devices. Ensuring a high degree of indistinguishability of single photons coming from different sources also remains a challenge7.

In contrast, our simulations are done exclusively in Fock space, with Fock states of high photon number encoding all the information from input to output. Our method minimises the spatial complexity, needing only one interaction between two modes, irrespective of the size of the spin chain, while the simulation time may be easily tuned by the beam-splitter reflectivity. On the other hand, simulation of large chains requires the generation of high-order Fock states which is challenging due to losses, the stochastic nature of the heralding, and the existence of multiple modes in the SPDC process55. Experimental imperfections lead to a trade-off between the probability of Fock state generation and their fidelity. These errors are nevertheless minimized by engineering of robust PP-KTP waveguide sources and applying spatial and narrow spectral filtering, resulting in near-single-mode heralded Fock states. They are verified in the experiment by measuring the Glauber second-order correlation function g(2) and computing the Schmidt mode number K, which also takes possible phase errors into account56. Although currently the experimental generation of five-photon Fock states is already beyond the state of the art, it is soon expected to reach the level of tens of photons57. Recent demonstration of a photonic integrated circuit with a built-in four-mode interferometer, 8 dB total loss, and photon-number-resolving detection at all outputs, definitely sets high expectations for higher-dimensional Fock-state-based photonic computation in the near future58.

Qudit data encoding employed in our scheme brings yet another advantage. While in classical digital computation small errors in successive gates are easily corrected by rounding or truncating the signal to one of the allowed values (restandardisation), in the case of quantum circuits this is not possible and the errors accumulate22. Quantum error correction solutions, which address this problem, are difficult to realize in the current era of the Noisy Intermediate-Scale Quantum (NISQ) circuits23. The accumulated errors lead to drop of fidelity with the number of computation steps, which has been recently shown both theoretically24,59,60 and in experiment25,27, including photonic setups61. It is also foreseen that larger systems will suffer from higher individual gate errors due to technological constraints in controlling a large number of qubits26. In these circumstances, simplification introduced by the qudit encoding and a single quantum gate required for computation may lead to improvement of the precision. However, this comes at the cost of preparing a higher-order multiphoton state, and since higher photon Fock states are generated with lower fidelity55 this introduces a further source of error accumulation.

We emphasise that our approach can be generalised to more complex interferometric networks (e.g. combinations of beam tritters, quarters etc.) which allow one to simulate a wider class of Hamiltonians with more tunable parameters without changing the fundamental concepts62. Although it is an open intriguing question what additional systems may be simulated in this way, multiport interferometers such as beam tritters and quarters have already proven a useful tool for quantum simulations in the single-photon regime63,64,65. In principle, multiport networks can implement any unitary evolution described by an N × N matrix66, a feature which has been very recently harnessed in photonic quantum computing chips58. Our approach can also be extended to higher dimensions by including additional degrees of freedom such as photon frequency and polarisation (see Supplementary Note 6). The scope of simulations could be further broadened by using input state superpositions $$\mathop{\sum }\nolimits_{l = 0}^{S}{x}_{l}\left|l,S-l\right\rangle$$ and altering the spin-chain couplings. Although preparation of such general superpositions poses a challenge in photonics, input states in the form of generalised Holland–Burnett states were experimentally obtained by interfering Fock states on a beam splitter67. Some other examples could be reached by heralding and conditional state preparation using more intricate interferometers. Merging our approach with coupled-waveguide set-ups is yet an unexplored and intriguing territory.

It would also be very interesting to implement our technique with quantum simulation platforms that are universal. For example, Fock states are also available in motional states of trapped ions up to 10 excitations68 and in the form of plaquette Fock states of atoms in optical lattices up to 4 excitations21. The range of accessible parameters controlling these systems could provide access to other complementary simulation models. Moreover, deterministic creation of an arbitrary superposition of Fock states has been demonstrated for trapped ions and superconducting resonators69. This would further expand the assortment of input states that could be used for simulation and may give birth to new fascinating results.

Methods

Characterisation of the set-up

Each integrated SPDC source produced a two-mode weakly squeezed vacuum state $$\left|{{\Psi }}\right\rangle =\mathop{\sum }\nolimits_{n = 0}^{\infty }{\lambda }_{n}\ {\left|n,n\right\rangle }_{s,i}$$, where s and i denote two output modes, named the signal and idler, $${\lambda }_{n}=\frac{{\tanh }^{n}g}{\cosh g}$$, λn2 is a probability of creation of a pair of n photons and g is the parametric gain. The average photon number in each mode of $$\left|{{\Psi }}\right\rangle$$ is $$\left\langle n\right\rangle ={\sinh }^{2}g$$. The observed average photon number of $$\left\langle n\right\rangle \approx 0.2$$ amounts to g = 0.44, which was sufficient to ensure the emission of multiphoton pairs. In this regime, one can approximate $$\cosh g\approx 1$$ and thus, $${\lambda }_{n}\approx {\sinh }^{n}g=\sqrt{{\left\langle n\right\rangle }^{n}}$$.

The TESs were operated at 70 mK, which allowed photon-number resolved measurements in all modes33.

The transmission losses in the set-up were estimated by means of Klyshko efficiency measurements. To this end, we set the reflectivity of variable coupler at r = 0.5, and pumped each of the two SPDC sources separately at successively lower power values. The registered four-mode photon statistics were then binned into ‘photon(s)/no-photon’ datasets to mimic the use of standard binary detectors, e.g. avalanche photo-diodes, and we concluded the total efficiencies of the heralding modes c and d to be ηc = 50.3% and ηd = 48.5%, respectively. The variable-coupler modes a and b exhibited a total efficiency of ηa = 21.6% and ηb = 20.6%, respectively. These values result from the fact that each mode carried a 3 dB loss from the coupler itself and another 1 dB due to coupler insertion and fibre-to-fibre coupling losses. We estimated the transmission losses to be approximately of 50% ≈ 3 dB. Here 1 dB stands for the initial fibre in-coupling loss due to spatial mode mismatch, while 0.25 dB stems from detectors inefficiencies, and the remaining loss is from three FC/PC fibre-to-fibre couplers per mode as well as bending losses in the transmission fibres between the set-up and the detectors.

The HOM visibility is computed using the formula $${v}^{(2)}=\frac{{n}_{\text{max}}-{n}_{\text{min}}}{{n}_{\text{max}}+{n}_{\text{min}}}$$, where nmax and nmin are the maximal and minimal number of events registered by the TES detectors for the given photon number S. In the experiment for input $$\left|2,2\right\rangle$$ and r = 0.5, we obtained v(2) = 50.6% ± 1.2%, whereas for input $$\left|0,4\right\rangle$$ ($$\left|0,5\right\rangle$$) they were 99.1% ± 2.5% (97.8% ± 6.2%) for r = 0.04, 87.6% ± 2.2% (96.7% ± 7.2%) for r = 0.3, 65.7% ± 1.7% (71.4% ± 4.6%) for r = 0.5 and 99.9% ± 0.8% (98.6% ± 7.2%) for r = 0.96.

Error estimation

In the experiment, each measurement results in a 4-tuple consisting of the number of photons registered by TES1−4, corresponding to photon-number states in modes ad (Fig. 3). The tuple counts are stored in a database. The probability of detecting k and S − k photons in modes a and b is computed as p(k) = Nk/N, where Nk is the database value retrieved for the key (k, S − k, l, S − l) and N is the total count of events characterised by the given total number of photons S. The measurement errors for each mode were estimated to $${{\Delta }}p=1/\sqrt{N}$$.

Numerical model of experimental outcomes

To assess the experimental results we developed a theoretical model which extended Eq. (2) by taking into account the influence of losses, multi-modeness of beams as well as inefficient photodetection.

Decoherence resulting from the first two effects was modelled by replacing the mode with a $${b}^{\dagger }$$ superposition of the same mode $${b}^{\dagger }$$ and an orthogonal one $${b}_{\perp }^{\dagger }$$, i.e. $${b}^{\dagger }\to \cos y\ {b}^{\dagger }+\sin y\ {b}_{\perp }^{\dagger }$$, where the parameter $$y\in (0,\frac{\pi }{2})$$ introduced weights and ‘tuned’ the distinguishability. This transformation led to the interference of $${\left|l\right\rangle }_{a}$$ with a two-mode Fock state superposition $$\mathop{\sum }\nolimits_{n = 0}^{S-l}\left(\begin{array}{*{20}{c}}{S-l} \\ {n}\end{array} \right)^{-1/2}{\cos }^{n}y\ {(\sin y)}^{S-l-n}{\left|n\right\rangle }_{b}{\left|S-l-n\right\rangle }_{b\perp }$$ instead of the single-mode Fock state $${\left|S-l\right\rangle }_{b}$$, as before. Thus, effectively, some of the multiphoton states interfered with the vacuum state and this implemented the usual model describing particle loss. In our computations, we took $$y=\arcsin \sqrt{(K-1)/K}$$, where K denoted the effective Schmidt mode number measured during the set-up characterisation. For K = 1.16, we used y = 0.38.

Realistic model of photodetection requires taking into account a probability of detecting nd photons when a Fock state $$\left|{n}_{\text{in}}\right\rangle$$ reaches a TES. It is given by $${p}_{\text{TES}}({n}_{\text{in}},{n}_{d})=\left(\begin{array}{*{20}{c}}{{n}_{\text{in}}} \\ {{n}_{d}}\end{array} \right){(1-\eta )}^{{n}_{\text{in}}-{n}_{d}}\ {\eta }^{{n}_{d}}$$ where nd ≤ nin and η is the detector efficiency. In our computations we first used a starting value of η = 0.7 and then numerically optimised efficiencies for individual TESs to compensate for the uneven photon number distribution p(k) seen in Fig. 3a. The programmes were written in Python using mpmath library.