{'fraction_non_alphanumeric': 0.03821013380127221, 'fraction_numerical': 0.01500329019521825, 'mean_word_length': 4.027790030877812, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
From a posteriori to a priori solutions for a two-level system interacting with a single-photon wavepacket

We consider the a priori and a posteriori evolution of the quantum system interacting with a single-photon wavepackage. We show how the quantum filtering theory provides a solution to the set of master equations as well as the formulas for the whole statistics of the output photons. We give the solution to the problem using the collision model with a discrete in time interactions of the system with the environment given as a chain of qubits prepared initially in an entangled state being a discrete analogue of a single-photon state. We present in details the analytical formulas for the conditional and unconditional states of a two-level system together with a positive operator valued measure (POVM) for a direct measurement of the output photons.

In this paper we treat a problem of an interaction of a quantum system with an environment prepared in a single-photon state [17,36,37]. We apply the results obtained in the paper [26] to show how using of the solutions to the set of filtering equations one can determine the solution to the set of master equations describing the reduced evolution of an open system.
Let us remind that quantum filtering theory [38][39][40][41][42][43][44] provides a description for the conditional evolution of a quantum system interacting with the Bose field. In this approach, usually applied for the Markovian evolution, we deal with a division of the external field into the input and output parts [45,46]. The input part is interpreted as the field before the interaction with the system and the output part is the field after this interaction. By performing the measurements on the output field we gain the information about the system of our interest. The conditional evolution of the system depending on the results of the continuous in time measurements of the output field is given by the filtering equation (stochastic master equation). The exact form of this equation depends on the type of the measurement and on the initial state of the Bose field. The solutions to this equation are called quantum trajectories or the a posteriori states. An average of the quantum trajectories taken over all possible realizations of the stochastic process related to the considered measurement gives the a priori state of the system, which for the Markovian case fulfills the Gorini-Kossakowski-Sudarshan-Lindbland master equation [49,50].
The evolution of a quantum system interacting with the field prepared in the single-photon state is non-Markovian due to the temporal field correlations. The reduced dynamics of the system is given by the set of coupled first-ordered linear differential equations [10,17,26]. We derive the solution to these equations using the filtering theory, but instead of the methods based on the quantum stochastic Ito calculus [47,48], we make use of the model of quantum repeated interactions and measurements [51][52][53][54] (called also the collision model [55][56][57][58][59][60]). So we start from a discrete in time evolution modeling an environment by a chain of qubits prepared initially in an entangled state. The evolution of the composed system is given by repeated unitary interactions between the system and the bath qubits interrupted by the measurements performed on the qubits. The set of recursive stochastic equations describing the conditional evolution of the system and and its differential version were derived in [26]. In this paper we consider the filtering equations for the counting stochastic process, it means that the conditional evolution of the system depends on the results of the continuous in time detection of photons of the output field. We write down the formulas describing the a priori state of the system making use of the stochastic representation. Then we apply the obtained results to fully characterize the conditional and unconditional evolution of the two-level atom and the statistics of the output photons.
The paper is organized as fallows. In Sec. II we describe the model of repeated interactions and measurements, recall the recursive equations for the conditional vectors of the system, and write down the formula for a priori state for discrete in time measurements. In Sec. III we recall the set of filtering equations for the continuous in time observations of the output field together with the analytical formulas for the conditional vectors defining the a posteriori states of the system. In Sec. IV we write a general solution to the set of master equations and give the formula for the solution written in the stochastic counting process representation. In Sec. V we apply the formulas for the two-level atom writing down the explicit analytical expressions for the a posteriori states and for the a priori state. In the Appendix we analyze POVM for the detection of the output photons indexed by the number of counts.

II. THE MODEL
We consider a quantum system S coupled to the environment modeled by a chain of N qubits. We assume that the environment qubits do not interact between themselves, but they interact with the system S, one after the other, each during a time interval of the length τ = T /N . The Hilbert space of the composed system, consisting of the environment and S, is H E ⊗ H S , where H S is the Hilbert space associated with S and H E = where H E,k = C 2 is the Hilbert space of the k-th qubit interacting with S in the interval [kτ, (k + 1)τ ). The evolution of the composed system is given by the sequence of unitary operators, for 1 ≤ j ≤ N − 1 where where H S is the Hamiltonian associated with S, L is a bounded operator acting on H S , σ − k = |0 k 1|, σ + k = |1 k 0|, where |0 k and |1 k stand respectively for a ground and excited state of the k-th two-level system of the bath. We set the Planck constant = 1 and to simplify the notation we omit the identity operators from i =k H E,i . We assume that the composed system is initially prepared in a factorized state of the form where |ψ 0 denotes the state of the system S and |1 ξ is the state of the environment defined as where and N −1 k=0 |ξ k | 2 τ = 1.
In the model we gain the information about the system S in indirect way, namely by performing a sequence of measurements on the bath qubits just after their interactions with S. We consider the measurement of the environment observable The conditional state of S and the part of the environment chain which has not interacted with S up to time jτ is at the moment jτ given by [26] |Ψ j|η η ηj = |Ψ j|η η ηj where |Ψ j|η η ηj is the unnormalized conditional vector from the space and By η η η j we denoted a stochastic binary j-vector η η η j = (η j , η j−1 , . . . , η 1 ) with η k ∈ {0, 1} representing results of all measurements of (7) up to jτ . The conditional vectors |α j|η η ηj , |β j|η η ηj from H S , depending on the results of all measurements up to jτ and they satisfy the set of recursive equations: for the result 0, and for the result 1.
Let us note that the form of the conditional vector (9) indicates that the system S is entangled with the input field-the part of the environment which has not interacted with S yet. The vector |α j|η η ηj is associated with the scenario that S has not met the environment qubit prepared in the upper state up to jτ (it will meet if after jτ ), and |β t|η η ηj is the vector related to the scenario that the system has already met the environment qubit in the upper state.
It should be emphasized that we are not interested in a keeping track of the output field-the environment qubits after their interactions with S. It is due to the fact that that they will not interact with S again. This corresponds to the assumption that photons of the output field leave immediately the interaction region and they can not be reabsorbed by the system S.
Random results of the measurements give rise to a stochastic evolution of the system S. Taking the partial trace of |Ψ j|η η ηj Ψ j|η η ηj | with respect to obtain the a posteriori state of S at the time jτ where The formula (15) determines discrete quantum trajectories of S depending on the random results of the measurements and Trρ j|η η ηj gives the probability of a particular trajectory.
By taking a mean value of the a posteriori operator (15) over all possible outcomes (all possible realization of the stochastic process related to the measured observable) we obtain the a priori state of S. In order to write down an expression for the a priori state, it is convenient to change the notation for conditioning. Namely, instead of using η η η j we write the location of ones in (η j , . . . , η 1 ), that (l m , . . . , l 1 ) means that m photons were observed at the times τ i = τ l i (i = 1, . . . , m) and no other photons in the period from 0 to jτ . Thus the a priori state in the representation of the counting stochastic process has the form̺ where Clearly, m = 0 means zero photons in the period from 0 to jτ . Thus, having the formulas for all conditional vectors |α j|cond , |β j|cond one possesses the recipe for the a priori state of the system. Of course, there exist infinitely many representations for̺ j related to infinitely many possible observables of the output field.

III. FILTERING EQUATIONS AND QUANTUM TRAJECTORIES
From the set of recursive equations for the conditional vectors |α j|cond , |β j|cond , Eqs. (11)- (14), one can derive the set of discrete stochastic evolution equations for S [26]. In the continuous time limit, when ∆τ → 0 and N → ∞ such that T = N ∆τ is fixed, we obtain the set of stochastic differential equations of the form with the superoperator L acting as and Here the notation is simplified by skipping the conditional indexes. The set of coupled nonlinear stochastic differential equations determines the conditional dynamics of the system S. The a posteriori normalized state of S at the moment t is given byρ t . The operatorsρ 10 t andρ 01 t are related byρ 10 t = (ρ 01 t ) † . Initially, ρ 0 =ρ 00 0 = |ψ 0 ψ 0 | andρ 01 0 =ρ 10 0 = 0. By n(t) we denoted the stochastic counting process with the a posteriori mean value given by Let us stress that n(t) is a regular process thus (dn(t)) 2 = dn(t), which means that at most one photon can be detected in the interval of the length dt. Finally, passing to T → ∞, we get for the amplitude ξ t the normalization condition The solution to (20) can be written in the form where ρ t|cond = |α t|cond α t|cond | +∞ t ds|ξ s | 2 +|β t|cond β t|cond | (28) and |α t|cond , |β t|cond are the conditional vectors depending on all results of the continuous in time measurements of the output field up to t. The formulas for |α t|cond and |β t|cond are rather involved but they can be written with making use of some simple diagrammatic representation (see details in [26,28]).
For a detection of zero photons from 0 to t, and where For a detection of one photon at t 1 (strictly in [t 1 , t 1 +dt)) and no other photons from 0 to t, For detection of two photons at t 1 and t 2 such that 0 < t 1 < t 2 , and no other photons in the interval from 0 to t, For three photons detected at the moments t 1 , t 2 , t 3 such that 0 < t 1 < t 2 < t 3 , and no other photons in the interval from 0 to t, Let us note that in the model we deal with four processes: • a free propagation of S (expressed by T t ), • an absorption of a photon by S, • an emission of a photon by S, • a detection of a photon directly from the environment.
By recognizing the terms related to the mentioned processes, we can easily find a physical interpretation for the conditional vectors and hence for the quantum trajectories.

IV. SOLUTION TO THE SET OF MASTER EQUATIONS AND STATISTICS OF PHOTONS
The a priori state,̺ t , is obtained by taking an average of quantum trajectory,ρ t , over all possible realization of the output counting process n(t) i.e.
where ρ t|tm,...,t2,t1 are the conditional operators defined by (28). In (38) we have a sum over all possible pathways of the photon detection for the number of photons ranging from m = 0 to m = ∞ from the time 0 to t. Of course, (38) is generalization of the formula (17). Thus Trρ t|0 is the probability of lack of any detections from 0 to t, while Trρ t|tm,...,t2,t1 for all m ≥ 1 is the probability density of detecting photons at times t 1 , t 2 , . . . , t m (strictly at intervals [t 1 , t 1 + dt), [t 2 , t 2 + dt), . . ., [t m , t m + dt)) such that 0 < t 1 < t 2 < . . . < t m and no other photons from 0 to t. Clearly, for the system with a finite number degrees freedom, the sum in (38) has limited number of non-zero terms.
Let us note that the mean time of the m-th counts can be determined with making use of conditional operators, namely where̺ t is the a priori state of S,̺ 10 t = (̺ 01 t ) † , and initially̺ 0 =̺ 00 0 = |ψ 0 ψ 0 |,̺ 01 0 =̺ 10 0 = 0. The general solution to this set can be written as and ρ 0 is the initial state of S. Clearly, by taking the derivative of (43)-(44) one arrives in (40)- (42). Let us note that (38) is the solution to the set of master equations written in the representation associated with the stochastic process n(t). In this representation we havẽ Let us note that using the conditional vectors |α t|cond , |β t|cond one can find the whole statistics of photons of the output field. Namely, the probability of no detections from 0 to t is given as where || · || = · . The probability of having exactly m detections and no other detections from 0 to t is Of course, we deal here with a perfect detector i.e. all photons reaching detector are instantaneously measured. Moreover, we omit a retardation time due to the flight of photons from the system to detector, but it can be rather easily incorporated into the model.

V. CONDITIONAL AND UNCONDITIONAL EVOLUTION OF A TWO-LEVEL ATOM
Let us consider the case when the system S is a twolevel atom with the eigenstates |g and |e , and where Γ ∈ R + , σ − = |g e|, σ z = |e e| − |g g|, and ∆ 0 = ω c − ω 0 with ω 0 being the carrier frequency of the input wave packet.

A. Quantum trajectories and statistics of the output photons
By inserting (51) and (52) into the formulas (29) and (30), we obtain the conditional vectors referring to detection of zero photons from 0 up to t of the form We can easily give a physical interpretation of this result. It is seen from (53) and (54) that when the two-level atom was initially in the ground state and we have not observed any photons up to the time t, it means that the atom has not met the external photon yet and it is still in the ground state or it has already met the photon, it absorbed this photon and after the absorption the system stayed in the excited state up to t. If the atom was initially in the excited state and we have not observed any photons up to t, it implies that only one scenario has made realthe system has not met the external photon yet and it is still in the excited state (then only the vector |α t|0 gives non-zero contribution to the conditional state of the system). Now applying the conditional vectors (53) and (54) in (28), one can easily determine the unnormalized conditional state of the two-level atom for not observing any photon up to the time t, By taking the trace of (55), we obtain the probability of not detecting any photons up to t, Of course, one can easily generalize this expression to the case of an arbitrary initial state of the system. Notice that the expression in the first line refers to the possibility that the system will meet the photon after the time t, the term in the second line is the probability of absorption of the external photon before t and staying after this absorption in the excited state up to t. We see that P t=0 (0) = 1 and, by the presence of the decay terms, we have lim t→+∞ P t (0) = 0.
For a detection of one photon in the interval [t 1 , t 1 +dt) and no other photons from 0 to t, we obtain Thus when the two-level atom was initially prepared in the ground state, then we have |α t|t1 = 0 and the only two scenarios of events are possible. Namely, we detected the photon coming from the external field or the atom absorbed the photon before time t 1 , then emitted it at interval [t 1 , t 1 + dt), and stayed in the ground state up to t. These two scenarios are described respectively by the first and second terms of the formula for |β t|t1 . If the atom was initially in the excited state, it might not meet the photon before t, and we observed the photon emitted by the system or the atom has met the external photon before t, then we detected it directly from the field or the atom emitted the photon at t 1 , then absorbed the photon from the field, and after this stayed in the excited state up to t. For detection of two photons at the intervals [t 1 , t 1 +dt) and [t 2 , t 2 + dt) such that 0 < t 1 < t 2 < t and no other photons from 0 to t, we have Thus if we observed two photons we are certain that the system has already met the external photon (|α t|t2,t1 = 0). The terms in (60) correspond respectively to the following scenarios: • the first photon came directly from the field and the second one was emitted by the atom, • the first photon was emitted by the atom and the second one came from the field, • the first photon was emitted by the atom, then the atom absorbed the photon from the field, and it emitted the photon at t 2 .
All these possibilities we have to consider when the initial value of the probability of being in the excited state is non-zero. Of course, all the others conditional vectors vanish according to the fact that in our scheme we can not detect more than two photons. Let us notice that the mean time of the first count is given by the formula where where ρ 0 is the initial state of the atom. And for the mean time of the second count we have the formula B. The a priori evolution The a priori evolution of S is given by of the set of coupled equations [26] where Initially, we have̺ 0 =̺ 00 0 = ρ 0 , ̺ 01 0 = 0. Taking into account that Tr̺ 00 t = Tr̺ t = 1 and Tr̺ 01 t = Tr̺ 10 t = 0 for all t > 0, we deal here with nine coupled equations for nine coefficients.
The a priori state can be determined by using the conditional counting representation, namelỹ By applying (53), (54), (57)-(60) we can determine the conditional operators: ρ t|0 , ρ t|t1 , ρ t|t2,t1 , and it allows us finally to determine the explicit expression for the a priori state of the form where γ = −2i∆ 0 + Γ 2 . To obtain (70) we referred to Eqs. (A2)-(A4). This is the general formula for the state of the atom interacting with the single-photon wavepacket. It reduces to the known results obtained for the atom taken initially in the ground state [13,14,16]. The authors studied the problem of the excitation of the two-level atom by the single-photon wavepacket. Clearly, the prob-ability of being in the excited state depends on the initial state of the atom and on the shape of the wavepackage. It is easily seen that in the long time limit t → +∞, the system goes to the ground state, as expected.

C. POVM
Note that with the stochastic counting process, n(t), we can associate for a fixed time t a positive-operator valued measure (POVM) {M t|m } labeled by the number of counts m = 0, 1, 2. One can check that 3-element POVM has here the form , Clearly, for any initial state of the two-level atom, ρ 0 , P t (m) = TrM t|m ρ 0 is the probability of n detections from 0 to t. A detailed discussion on {M t|m } one can find in Appendix. By applying the POVM we can determine the statistical moments referring to the output field. For the first moment, m t , being the mean number of counts in the period from 0 to t, we obtain the formula dsξ s e −γ * s e|ρ 0 |e .
In the long time limit we get simply lim t→+∞ m t = 1 + e|ρ 0 |e . And for the second moment, we have By using (75) and (76) we can find the Mandel Q t parameter, defined as Let us note that for the case when the two-level atom is initially in the ground state we have Q t = −m t .

VI. CONCLUSIONS
We have considered the conditional and unconditional evolution of a quantum system interacting with a singlephoton pulse. In this case the system is correlated with the field and the stochastic evolution of the system is given by the set of four coupled equations for four conditional operators. As it was shown in [26] to derive the set of the filtering equations it is convenient to use the collision model. Starting from the discrete in time stochastic evolution of the system, one can determine the conditional evolution described by the set of differential equations for the continuous in time measurements.
In this paper we have focused on the solutions to the set of the filtering equations, their meaning, and applications. We have used the explicit formulas for the quantum trajectories, derived in [26], to determine the a priori evolution of the system and to describe the statistics of the photons of the output field. The a priori state is defined as the average of the quantum trajectories over all possible realizations of the stochastic process. In the paper we have considered the stochastic counting process associated with the continuous in time measurement of photons of the output field. We have written the formula for the a priori state in terms of the conditional operators which were expressed by means of the conditional vectors having intuitive physical interpretations. All these formulas we have applied to the case of the two-level system. First, we have given the explicit expressions for the conditional vectors associated with the particular results of the measurements and we have explained their meaning. The conditional vectors allowed us to find the conditional state of the two-level atom for the case when one does not observe any photons up to the time t. Moreover, we have presented the formulas for the expected time of detection of the first and the second photon. Then by applying the conditional operators we have given the explicit formula for the a priori state of the system and we have found the expressions for the POVM associated with detection of zero, one or two photons up to t. By this we have finally determined the formulas for the mean number of photons detected from 0 to t and the Mandel Q t parameter defining the properties of the output signal. Of course, the formula for the a priori state allows us to find easily the probability of the excitation at a given moment of the two-level atom prepared in the ground state by a single photon pulse. One can check that it agrees the results presented in [13,14,31]. The first property is clearly visible, to proof that the operators sum to the identity operator, in the first step one has to check that It is evident now that (A1) holds.