1 Introduction

Mathematical modeling and analysis of within host human viral infections have provided useful insights into the understanding of interplay between three main compartments: viruses, target cells, and infected cells. Nowak and Bangham [1] have proposed the basic virus infection model in the form

$$ \textstyle\begin{cases} \dot{F} ( t ) =\delta -\beta F ( t ) -\kappa F ( t ) H ( t ) , \\ \dot{S} ( t ) =\kappa F(t)H ( t ) -aS ( t ) , \\ \dot{H} ( t ) =\theta S ( t ) -cH ( t ) , \end{cases} $$
(1)

where F, S, and H are the healthy (uninfected) target cells, actively infected cells, and free virus particles. δ and βF are the production and natural death rates of the healthy cells, respectively. The incidence rate is modeled by \(\kappa FH\). The death rate of actively infected cells is given by aS. The free viruses are generated at rate θS and cleared at rate cH. The model has been developed to describe within host dynamics of different viruses such as human immunodeficiency virus (HIV) [2, 3], hepatitis C virus (HCV) [4, 5], hepatitis B virus (HBV) [6, 7], chikungunya virus (CHIKV) [8], and dengue virus [9].

The immune system works to defend the body against attacks by foreign invaders. B cells and CTL cells play a central role in the specific immune response. In general, B cells produce antibodies that neutralize the viruses, namely antibody immune response and CTL cells attack and kill virus-infected cells, namely cell-mediated immune response. The impact of cell-mediated immune response on the virus dynamics has been modeled [1] as follows:

$$ \textstyle\begin{cases} \dot{F} ( t ) =\delta -\beta F ( t ) -\kappa F ( t ) H ( t ) , \\ \dot{S} ( t ) =\kappa F(t)H ( t ) -aS ( t ) -\lambda S ( t ) Z ( t ) , \\ \dot{H} ( t ) =\theta S ( t ) -cH ( t ) , \\ \dot{Z} ( t ) =gS ( t ) Z ( t ) - \xi Z ( t ) , \end{cases} $$
(2)

where Z is the concentration of the CTL cells. The CTL cells are proliferated at rate \(gSZ\), die at rate ξZ, and kill infected cells at rate \(\lambda SZ\). Model (2) has been extended in several works (see, e.g., [1013]). In other words, the basic model (1) has been modified to take into account the effect of antibody immune response in [14] as follows:

$$ \textstyle\begin{cases} \dot{F} ( t ) =\delta -\beta F ( t ) -\kappa F ( t ) H ( t ) , \\ \dot{S} ( t ) =\kappa F(t)H ( t ) -aS ( t ) , \\ \dot{H} ( t ) =\theta S ( t ) -cH ( t ) -dH ( t ) Y ( t ) , \\ \dot{Y} ( t ) =qH ( t ) Y ( t ) - \eta Y ( t ) , \end{cases} $$
(3)

where Y is the concentration of antibodies. The free viruses are removed by the antibodies at rate \(dHY\). The antibodies are proliferated at rate \(qHY\) and die at rate ηY. In the literature, the effect of antibody immune response has been incorporated into mathematical models of various virus infections (see, e.g., [1517]).

In models (1)–(3) it has been assumed that once a healthy cell is contacted by a virus it becomes productive instantaneously. In fact, a number of intracellular processes is needed to produce new viruses. In case of HIV infection the intracellular processes take approximately 0.9 days [18]. Therefore, the intracellular time delay has a significant effect on the virus dynamics. Delayed viral infection models have been constructed and analyzed in several works (see, e.g., [1932]). To incorporate both cell-mediated and antibody immune responses as well as the time delay into the virus dynamics, Wodarz [33] has proposed the following model:

$$ \textstyle\begin{cases} \dot{F} ( t ) =\delta -\beta F ( t ) -\kappa F ( t ) H ( t ) , \\ \dot{S} ( t ) =\kappa e^{-\mu \tau }F(t-\tau )H ( t- \tau ) -aS ( t ) -\lambda S ( t ) Z ( t ) , \\ \dot{H} ( t ) =\theta S ( t ) -cH ( t ) -dH ( t ) Y ( t ) , \\ \dot{Y} ( t ) =qH ( t ) Y ( t ) - \eta Y ( t ) , \\ \dot{Z} ( t ) =gS ( t ) Z ( t ) - \xi Z ( t ) , \end{cases} $$
(4)

where, \(e^{-\mu \tau }\) represents the survival rate of infected cells after the interval τ, and μ is a positive constant. Model (4) has been extended in [3436]. It has been reported in [37, 38] that in case of HIV infection, latent HIV reservoirs serve as a major obstruction in treating HIV infection. Latently infected cells have been incorporated into the virus dynamics model with both cell-mediated and antibody in [25] and [39]. The bilinear incidence rate associated with the mass action principle can be insufficient to describe infection process in detail. The most obvious reason for a nonlinear incidence rate is that the number of free pathogen particles can vary in a very wide range, from a few particles up to hundreds of millions of them in the case of virus. The bilinear interaction term, which may be considered as an approximation, is hardly able to adequately describe the process that runs over such a range of variables. For instance, if the number of free pathogen particles is very high, so that exposure of a susceptible host is virtually certain, then the incidence rate may respond more slowly than linear to the further increase in the number of the pathogen particles [40].

In all the above mentioned works the viral infection is modeled by a system of ordinary or delay differential equations. These models are nonlinear, and calculating the exact analytical solution is difficult or impossible. Therefore, only approximate discrete-time models can be obtained by using suitable numerical approximation methods. One of the discretization methods which has been widely used to discretize viral infection models is called nonstandard finite difference (NSFD) [41]. It has been established that NSFD has the advantage of preserving the essential qualitative features of these models such as equilibria, positivity, boundedness, and global behaviors of solutions independently of the chosen step-size [4246]. The impact of cell-mediated immune response has been incorporated into the discrete-time virus dynamics models in [47, 48]. In very recent works, Elaiw and Alshaikh [4951] have proposed and investigated a class of discrete-time virus infection models with antibody immune response. However, the impact of both antibody and cell-mediated immune responses on the discrete-time virus infection model has not been investigated before.

The aim of the present paper is to formulate and analyze a discrete-time viral infection model with both antibody and cell-mediated immune responses. The model considers both latently infected cells and actively infected cells. The incidence rate of infection as well as the production and removal rates of all compartments are modeled by general nonlinear functions. We discretize the continuous-time model by using NSFD method. We first show that the solutions of the discrete-time model are positive and bounded, then we prove the global stability of the equilibria by constructing Lyapunov functions. Moreover, we perform numerical simulations to support the global stability results.

The achievements in this present paper look ahead to research perspectives focused on pattern formation induced by the action of the external environments, for instance, by Keller Segel dynamics [52]. The present literature is focused simply on the original SIR model [52], while it appears interesting extending the qualitative and computational analysis to more advanced models such as the one treated in our paper.

2 The model

We introduce the following general viral infection model with three types of time delays and both antibody and cell-mediated immune responses:

$$\begin{aligned} &\dot{F} ( t ) =\varTheta \bigl( F ( t ) \bigr) -\varLambda \bigl( F ( t ) ,H ( t ) \bigr) , \end{aligned}$$
(5)
$$\begin{aligned} &\dot{K} ( t ) = ( 1-\varepsilon ) e^{-\mu _{1}\tau _{1}}\varLambda \bigl( F ( t-\tau _{1} ) ,H ( t- \tau _{1} ) \bigr) - ( \alpha +m ) \digamma _{1} \bigl( K ( t ) \bigr) , \end{aligned}$$
(6)
$$\begin{aligned} &\dot{S} ( t ) =\varepsilon e^{-\mu _{2}\tau _{2}}\varLambda \bigl( F ( t-\tau _{2} ) ,H ( t-\tau _{2} ) \bigr) +m\digamma _{1} \bigl( K ( t ) \bigr) -a\digamma _{2} \bigl( S ( t ) \bigr) \\ &\hphantom{\dot{S} ( t ) =}{}-\lambda \digamma _{2} \bigl( S ( t ) \bigr) \digamma _{5} \bigl( Z ( t ) \bigr) , \end{aligned}$$
(7)
$$\begin{aligned} &\dot{H} ( t ) =\theta e^{-\mu _{3}\tau _{3}}\digamma _{2} \bigl( S ( t- \tau _{3} ) \bigr) -c\digamma _{3} \bigl( H ( t ) \bigr) -d\digamma _{3} \bigl( H ( t ) \bigr) \digamma _{4} \bigl( Y ( t ) \bigr) , \end{aligned}$$
(8)
$$\begin{aligned} &\dot{Y} ( t ) =q\digamma _{3} \bigl( H ( t ) \bigr) \digamma _{4} \bigl( Y ( t ) \bigr) -\eta \digamma _{4} \bigl( Y ( t ) \bigr) , \end{aligned}$$
(9)
$$\begin{aligned} &\dot{Z} ( t ) =g\digamma _{2} \bigl( S ( t ) \bigr) \digamma _{5} \bigl( Z ( t ) \bigr) -\xi \digamma _{5} \bigl( Z ( t ) \bigr) , \end{aligned}$$
(10)

where K is the concentration of latently infected cells. The parameter ε, with \(0<\varepsilon <1\), is a fraction of the healthy cells that become latently infected. The terms \(\alpha \digamma _{1} ( K ) \) and \(m\digamma _{1} ( K ) \) represent the death and activation rates of the latently infected cells. We suppose that the viruses contact the healthy cells at times \(t-\tau _{1}\) and \(t-\tau _{2}\), respectively, the cells become latently infected and actively infected at time t, where \(\tau _{1}\) and \(\tau _{2}\) are positive constants. The immature viruses at time \(t-\tau _{3}\) are assumed to be mature at time t, where \(\tau _{3}\) is a positive constant. \(e^{-\mu _{j}\tau _{j}}\), \(j=1,2,3 \), is the probability of the cells and viruses survival during the delay periods, where \(\mu _{1}\), \(\mu _{2}\), and, \(\mu _{3}\) are positive constants. Here Θ, Λ, and \(\digamma _{i}\), \(i=1,\ldots,5\), are general nonlinear functions satisfy the following conditions:

  1. C1
    1. (i)

      There exists \(F^{0}>0\) such that \(\varTheta ( F ^{0} ) =0\), \(\varTheta ( F ) >0\) for \(F\in [ 0,F ^{0} ) \);

    2. (ii)

      \(\varTheta ^{\prime } ( F ) <0\) for all \(F>0\);

    3. (iii)

      \(\exists b,\overline{b}>0\) such that \(\varTheta ( F ) \leq b-\overline{b}F\) for all \(F\geq 0\).

Here, \(F^{0}\) is the equilibrium susceptible cell concentration in the absence of viral infection. Condition C1 implies that \(F(t)\rightarrow F^{0}\) as \(t\rightarrow \infty \) in the absence of the infection.

  1. C2
    1. (i)

      \(\varLambda (F,H)>0\), and \(\varLambda (0,H)=\varLambda (F,0)=0\) for all \(F>0\), \(H>0\);

    2. (ii)

      \(\frac{\partial \varLambda (F,H)}{\partial F}>0\), \(\frac{\partial \varLambda (F,H)}{\partial H}>0\), \(\frac{\partial \varLambda (F,0)}{\partial H}>0\) for all \(F>0\), \(H>0\);

    3. (iii)

      \(\frac{d}{dF} ( \frac{\partial \varLambda (F,0)}{\partial H} ) >0\) for all \(F>0\).

Furthermore, C2(i) means there are no incidences if there are no susceptible cells or free virus particles. For C2(ii), the number of new cases monotonically grows with growth in the numbers of susceptible cells and free pathogen particles. Moreover, condition C2(iii) accounts that the infection rate starts growing even if the number of pathogens is very small.

  1. C3
    1. (i)

      \(\digamma _{j}(\rho )>0\) for \(\rho >0\), \(\digamma _{j}(0)=0\), \(j=1,\ldots,5\);

    2. (ii)

      \(\digamma _{j}^{\prime }(\rho )>0\) for \(\rho >0\), \(j=1,2,4,5\) and \(\digamma _{3}^{\prime }(\rho )>0\) for \(\rho \geq 0\);

    3. (iii)

      There are \(\upsilon _{j}>0\), \(j=1,\ldots,5\), such that \(\digamma _{j}(\rho )\geq \upsilon _{j}\rho \) for \(\rho \geq 0\).

Condition C3 indicates that the natural mortality rates of the infected cells, pathogens, CTL, and antibodies monotonically grow with growth in their populations.

  1. C4

    \(\frac{\partial }{\partial H} ( \frac{\varLambda (F,H)}{ \digamma _{3} ( H ) } ) \leq 0\) for all \(H>0\).

The quantity \(\frac{\varLambda (F,H)}{\digamma _{3} ( H ) }\) may be interpreted as the efficiency of the pathogen, that is, the ratio of its infectivity to its removal. Condition C4 mentions that the efficiency of the pathogen is nonincreasing with respect to the population of the pathogens [39].

Remark 1

There are several forms of the general functions which can satisfy C1–C4 such as:

  1. (i)

    Intrinsic growth rate function \(\varTheta (F)\): linear form \(\varTheta (F)=\delta -\beta F \) [1] and logistic growth form \(\varTheta (F)=\delta -\beta F+rF ( 1-\frac{F}{F _{\max }} ) \), where \(r<\beta \) [53, 54].

  2. (ii)

    Incidence rate function \(\varLambda (F,H)\): bilinear incidence \(\kappa FH\) [55], saturated incidence \(\frac{\kappa FH}{1+uH}\) [56], (iii) Holling-type II incidence \(\frac{\kappa FH}{1+w F}\) [57], Beddington–DeAngelis incidence \(\frac{ \kappa FH}{1+uH+w F}\) [58], Crowley–Martin incidence \(\frac{\kappa FH}{(1+uH)(1+w F)}\) [59], Hill-type incidence \(\frac{\kappa F^{\ell }H}{ \zeta ^{\ell }+F^{\ell }}\) [60], where κ, u, w, ζ, and are positive constants.

  3. (iii)

    Function \(\digamma _{i}(\rho )\): linear \(\digamma _{i}(\rho )=\upsilon _{i}\rho \) [1] and quadratic \(\digamma _{i}(\rho )=\upsilon _{i}\rho +\overline{\upsilon }_{i}\rho ^{2}\) [15], where \(\upsilon _{i}\) and \(\overline{\upsilon }_{i}\) are positive constants.

We use the NSFD method [41] to discretize model (5)–(10). Let \(t_{n}=nh\), where \(h>0\) is the time step size and \(n\in \mathbb{N}= \{ 0,1,2,\ldots \} \). Let \(( F_{n},K_{n},S_{n},H_{n},Y_{n},Z_{n} ) \) be the approximations of the solution \(( F(t_{n}),K(t_{n}),S(t_{n}),H(t _{n}),Y ( t_{n} ) ,Z ( t_{n} ) ) \) of system (5)–(10) at the discrete time points \(t_{n}\). Assume that there exist integers \(m_{i}\in \mathbb{N}\), \(i=1,2,3\), with \(\tau _{i}=hm_{i}\).

$$\begin{aligned} &\frac{F_{n+1}-F_{n}}{\phi ( h ) } =\varTheta ( F_{n+1} ) -\varLambda ( F_{n+1},H_{n} ) , \end{aligned}$$
(11)
$$\begin{aligned} &\frac{K_{n+1}-K_{n}}{\phi ( h ) } = ( 1-\varepsilon ) e^{-\mu _{1}\tau _{1}}\varLambda ( F_{n-m_{1}+1},H_{n-m_{1}} ) - ( \alpha +m ) \digamma _{1} ( K_{n+1} ) , \end{aligned}$$
(12)
$$\begin{aligned} &\frac{S_{n+1}-S_{n}}{\phi ( h ) } =\varepsilon e^{-\mu _{2}\tau _{2}}\varLambda ( F_{n-m_{2}+1},H_{n-m_{2}} ) +m \digamma _{1} ( K_{n+1} ) -a\digamma _{2} ( S_{n+1} ) \\ &\hphantom{\frac{S_{n+1}-S_{n}}{\phi ( h ) } =}{} -\lambda \digamma _{2} ( S_{n+1} ) \digamma _{5} ( Z_{n+1} ) , \end{aligned}$$
(13)
$$\begin{aligned} &\frac{H_{n+1}-H_{n}}{\phi ( h ) } =\theta e^{-\mu _{3} \tau _{3}}\digamma _{2} ( S_{n-m_{3}+1} ) -c\digamma _{3} ( H_{n+1} ) -d \digamma _{3} ( H_{n+1} ) \digamma _{4} ( Y_{n+1} ) , \end{aligned}$$
(14)
$$\begin{aligned} &\frac{Y_{n+1}-Y_{n}}{\phi ( h ) } =q\digamma _{3} ( H_{n+1} ) \digamma _{4} ( Y_{n+1} ) -\eta \digamma _{4} ( Y_{n+1} ) , \end{aligned}$$
(15)
$$\begin{aligned} &\frac{Z_{n+1}-Z_{n}}{\phi ( h ) } =g\digamma _{2} ( S_{n+1} ) \digamma _{5} ( Z_{n+1} ) -\xi \digamma _{5} ( Z_{n+1} ) . \end{aligned}$$
(16)

The function \(\phi ( h ) \) is a denominator function [61, 62] where \(\phi ( h ) =h+O ( h^{2} ) \).

The initial conditions of system (11)–(16) are

$$\begin{aligned} &F_{\omega } =\psi _{\omega }^{1}\geq 0,\qquad K_{\omega }=\psi _{ \omega }^{2}\geq 0,\qquad S_{\omega }=\psi _{\omega }^{3}\geq 0, \\ & H_{\omega }=\psi _{\omega }^{4}\geq 0,\qquad Y_{\omega }=\psi _{ \omega }^{5}\geq 0,\qquad Z_{\omega }=\psi _{\omega }^{6}\geq 0 \end{aligned}$$

for all \(\omega =-\overline{m},-\overline{m}+1,\ldots,0\),

$$\begin{aligned} &\psi _{0}^{i} >0, \quad i=1,\ldots,6, \end{aligned}$$
(17)

where \(\overline{m}=\max \{m_{1},m_{2},m_{3}\}\).

2.1 Preliminaries

We define a compact set

$$ \varGamma = \bigl\{ (F,K,S,H,Y,Z)\colon 0< F,K,S< \vartheta _{1},0< H< \vartheta _{3},0< Y< \vartheta _{4},0< Z< \vartheta _{2} \bigr\} , $$

where \(\vartheta _{1}=\frac{b}{\sigma _{1}}\), \(\vartheta _{2}=\frac{g \vartheta _{1}}{\lambda }\), \(\vartheta _{3}=\frac{\theta \vartheta _{1}}{ \sigma _{2}}\), \(\vartheta _{4}= \frac{q\theta \vartheta _{1}}{d\sigma _{2}}\), \(\sigma _{1}=\min \{ \overline{b},\alpha \upsilon _{1},a,\xi \} \), and \(\sigma _{2}= \min \{ c,\eta \} \).

Lemma 1

Suppose that Conditions C1C3 are satisfied and \(\digamma _{j}(\rho )=\rho \), \(j=2,3,4,5\), then any solution \((F_{n},K_{n},S_{n},H_{n},Y_{n},Z_{n})\)of model (11)(16) with initial conditions (17) is positive and ultimately bounded.

Lemma 2

For system (11)(16), let Conditions C1C4 hold true, then there exist four threshold parameters \(\mathcal{R}_{0}>0\), \(\mathcal{R}_{1}^{Y}>0\), \(\mathcal{R} _{1}^{Z}>0\), and \(\mathcal{R}_{2}^{Z}>0\)such that

  1. (i)

    if \(\mathcal{R}_{0}\leq 1\), then the system has only one equilibrium \(Q^{0}\).

  2. (ii)

    if \(\mathcal{R}_{1}^{Y}\leq 1<\mathcal{R}_{0}\)and \(\mathcal{R} _{1}^{Z}\leq 1<\mathcal{R}_{0}\), then the system has two equilibria \(Q^{0}\)and \(Q^{\ast }\).

  3. (iii)

    if \(\mathcal{R}_{1}^{Y}>1\)and \(\mathcal{R}_{2}^{Z}\leq 1\), then the system has three equilibria \(Q^{0}\), \(Q^{\ast }\), and.

  4. (iv)

    if \(\mathcal{R}_{1}^{Z}>1\)and \(\mathcal{R}_{1}^{Y}/\mathcal{R} _{2}^{Z}\leq 1\), then the system has three equilibria \(Q^{0}\), \(Q^{\ast }\), and.

  5. (v)

    if \(\mathcal{R}_{1}^{Y}>\mathcal{R}_{2}^{Z}>1\), then the system has five equilibria \(Q^{0}\), \(Q^{\ast }\), , , and.

The proofs of Lemmas 12 are given in Appendix.

2.2 Global stability

We define the function

$$ G(\rho )=\rho -\ln \rho -1. $$

Clearly, \(G(\rho )\geq 0\) and \(G(1)=0\) for all \(\rho >0\), therefore

$$ \ln \rho \leq \rho -1. $$
(18)

Theorem 1

Suppose that Conditions C1C4 are satisfied and \(\mathcal{R}_{0}\leq 1\), then \(Q^{0}\)of model (11)(16) is G.A.S.

Remark 2

Conditions C2–C4 imply that

$$ \bigl( \varLambda (F,H)-\varLambda \bigl(F,H^{\ast }\bigr) \bigr) \biggl( \frac{ \varLambda (F,H)}{\digamma _{3}(H)}-\frac{\varLambda (F,H^{\ast })}{\digamma _{3} ( H^{\ast } ) } \biggr) \leq 0, $$

which yields

$$ \biggl( 1-\frac{\varLambda (F,H^{\ast })}{\varLambda (F,H)} \biggr) \biggl( \frac{\varLambda (F,H)}{\varLambda (F,H^{\ast })}- \frac{\digamma _{3} ( H ) }{\digamma _{3} ( H^{\ast } ) } \biggr) \leq 0. $$
(19)

Lemma 3

Suppose that Conditions C1C4 are satisfied and \(\mathcal{R}_{0}>1\), then

$$\begin{aligned} &(\mathrm{i})\quad \operatorname{sgn}\bigl( \overline{F}-F^{\ast } \bigr) =\operatorname{sgn}\bigl( H^{\ast }-\overline{H} \bigr) =\operatorname{sgn}\bigl( \mathcal{R}_{1} ^{Y}-1 \bigr), \\ &(\mathrm{ii})\quad \operatorname{sgn}\bigl( \widehat{F}-F^{\ast } \bigr) =\operatorname{sgn}\bigl( H^{\ast }-\widehat{H} \bigr) =\operatorname{sgn}\bigl( S^{\ast }- \widehat{S} \bigr) =\operatorname{sgn}\bigl( \mathcal{R}_{1}^{Z}-1 \bigr) . \end{aligned}$$

Theorem 2

Suppose that Conditions C1C4 are satisfied, \(\mathcal{R}_{1}^{Y}\leq 1<\mathcal{R}_{0}\)and \(\mathcal{R}_{1}^{Z}\leq 1<\mathcal{R}_{0}\), then \(Q^{\ast }\)of system (11)(16) is G.A.S.

Theorem 3

If Conditions C1–C4 hold, \(\mathcal{R} _{1}^{Y}>1\)and \(\mathcal{R}_{2}^{Z}\leq 1\), thenof system (11)(16) is G.A.S.

Theorem 4

If Conditions C1C4 are satisfied, \(\mathcal{R}_{1}^{Z}>1\)and \(\mathcal{R}_{1}^{Y}/ \mathcal{R}_{2}^{Z}\leq 1\), thenof system (11)(16) is G.A.S.

Theorem 5

If Conditions C1C4 are satisfied and \(\mathcal{R}_{1}^{Y}>\mathcal{R}_{2}^{Z}>1\), thenof system (11)(16) is G.A.S.

The proofs of Theorems 15 and Lemma 3 are given in Appendix.

3 Numerical simulations

We perform our simulation by choosing

$$ \begin{aligned}&\varTheta (F)=\delta -\beta F+rF \biggl( 1-\frac{F}{F_{\max }} \biggr) ,\qquad \varLambda (F,H)=\frac{\kappa FH}{1+c_{1}H}, \\ & \digamma _{i}(\rho )=\rho ,\quad i=1,\ldots,5, \end{aligned} $$
(20)

where \(r>0\) is the maximum proliferation rate of the healthy cells and \(F_{\max }>0\) is the maximum level of healthy cells concentration in the body. If F reaches \(F_{\max }\), it should decrease. Therefore, system (11)–(16) becomes

$$\begin{aligned} &\frac{F_{n+1}-F_{n}}{\phi ( h ) } =\delta -\beta F_{n+1}+rF _{n+1} \biggl( 1-\frac{F_{n+1}}{F_{\max }} \biggr) -\frac{\kappa F_{n+1}H _{n}}{1+c_{1}H_{n}}, \end{aligned}$$
(21)
$$\begin{aligned} &\frac{K_{n+1}-K_{n}}{\phi ( h ) } =\frac{ ( 1- \varepsilon ) e^{-\mu _{1}\tau _{1}}\kappa F_{n-m_{1}+1}H_{n-m _{1}}}{1+c_{1}H_{n-m_{1}}}- ( \alpha +m ) K_{n+1}, \end{aligned}$$
(22)
$$\begin{aligned} &\frac{S_{n+1}-S_{n}}{\phi ( h ) } =\frac{\varepsilon e ^{-\mu _{2}\tau _{2}}\kappa F_{n-m_{2}+1}H_{n-m_{2}}}{1+c_{1}H_{n-m_{2}}}+mK _{n+1}-aS_{n+1}- \lambda S_{n+1}Z_{n+1}, \end{aligned}$$
(23)
$$\begin{aligned} &\frac{H_{n+1}-H_{n}}{\phi ( h ) } =\theta e^{-\mu _{3} \tau _{3}}S_{n-m_{3}+1}-cH_{n+1}-dH_{n+1}Y_{n+1}, \end{aligned}$$
(24)
$$\begin{aligned} &\frac{Y_{n+1}-Y_{n}}{\phi ( h ) } =qH_{n+1}Y_{n+1}- \eta Y_{n+1}, \end{aligned}$$
(25)
$$\begin{aligned} &\frac{Z_{n+1}-Z_{n}}{\phi ( h ) } =gS_{n+1}Z_{n+1}- \xi Z_{n+1}. \end{aligned}$$
(26)

The denominator function \(\phi ( h ) \) can take the form [61, 62]

$$ \phi ( h ) =\frac{1-e^{-\beta h}}{\beta }. $$

We assume that \(r<\beta \) [54]. Now we check the validity of Conditions C1–C4 for the functions given by (20). We have \(\varTheta ( 0 ) =\delta >0\), \(\varTheta ( F^{0} ) =0\), where

$$ F^{0}=\frac{F_{\max }}{2r} \biggl( r-\beta +\sqrt{ ( r-\beta ) ^{2}+\frac{4r\delta }{F_{\max }}} \biggr) . $$

Since \(r<\beta \), then

$$ \varTheta ^{\prime } ( F ) =-\beta +r-\frac{2rF}{F_{\max }}< 0. $$

It follows that \(\varTheta ( F ) >0\) for all \(F\in [ 0,F ^{0} ) \) and

$$ \varTheta ( F ) =\delta - ( \beta -r ) F-r\frac{F ^{2}}{F_{\max }}< \delta - ( \beta -r ) F. $$

Let \(b=\delta >0\) and \(\overline{b}=\beta -r>0\). Thus, C1 is satisfied. We have also

$$\begin{aligned} &\varLambda (F,H) =\frac{\kappa FH}{1+c_{1}H}>0\quad \text{and}\quad \varLambda (0,H)= \varLambda (F,0)=0\quad \text{for all }F>0,H>0, \\ &\frac{\partial \varLambda (F,H)}{\partial F} = \frac{\kappa H}{1+c_{1}H}>0\quad \text{for all }F>0\text{ and }H>0, \\ &\frac{\partial \varLambda (F,H)}{\partial H} =\frac{\kappa F}{ ( 1+c_{1}H ) ^{2}}>0\quad \text{for all }F>0\text{ and }H>0, \\ &\frac{\partial \varLambda (F,0)}{\partial H} =\kappa F>0\quad \text{for all }F>0, \\ &\frac{d}{dF} \biggl( \frac{\partial \varLambda (F,0)}{\partial H} \biggr) =\kappa >0\quad \text{for all }F>0. \end{aligned}$$

Therefore, Condition C2 is satisfied. We have \(\digamma _{j} ( \rho ) =\rho >0\) for all \(\rho >0\) and \(\digamma _{j} ( 0 ) =0\), \(j=1,\ldots,5\), and \(\digamma _{j}^{\prime } ( \rho ) =1>0\), \(j=1,\ldots,5\), for all \(\rho \geq 0\). Then Condition C3 is satisfied, where \(\upsilon _{j}=1\), \(j=1,\ldots,5\). Finally, we have

$$ \frac{\partial }{\partial H} \biggl( \frac{\varLambda (F,H)}{\digamma _{3}(H)} \biggr) = \frac{-\kappa Fc_{1}}{ ( 1+c_{1}H ) ^{2}}< 0\quad \text{for all }F>0\text{ and }H>0. $$

Therefore, Condition C4 holds true and hence Theorems 15 are applicable.

For this system, the threshold parameters are given by

$$\begin{aligned} &\mathcal{R}_{0} =\frac{\theta \gamma \kappa F^{0}}{ac},\qquad \mathcal{R}_{1}^{Y}= \frac{\theta \gamma \kappa \overline{F}}{ac ( 1+c_{1}\overline{H} ) }, \\ &\mathcal{R}_{1}^{Z} =\frac{\theta \gamma \kappa \widehat{F}}{ac ( 1+c_{1}\widehat{H} ) },\qquad \mathcal{R}_{2}^{Z}=\frac{e^{\mu _{3}\tau _{3}}\gamma \kappa \widetilde{F}\widetilde{H}}{a ( 1+c_{1}\widetilde{H} ) \widetilde{S}}, \\ &\mathcal{R}_{1}^{Y}\backslash \mathcal{R}_{2}^{Z} =\frac{\theta e ^{-\mu _{3}\tau _{3}}\xi g}{cg\eta }, \end{aligned}$$

where

$$\begin{aligned} &\overline{F} =\frac{-\overline{B}+\sqrt{\overline{B}^{2}-4 \overline{A}\overline{C}}}{2\overline{A}}=\widetilde{F}, \\ &\overline{A} =r+c_{1}r\overline{H}, \\ &\overline{B} =-F_{\max } \bigl( r-\beta -\kappa \overline{H}+c_{1} \overline{H} ( r-\beta ) \bigr) , \\ &\overline{C} =-F_{\max }\delta ( 1+c_{1}\overline{H} ) , \\ &\overline{H} =\frac{\eta }{q}=\widetilde{H}, \end{aligned}$$

and

$$\begin{aligned} &\widehat{F} =\frac{-\widehat{B}+\sqrt{\widehat{B}^{2}-4 \widehat{A}\widehat{C}}}{2\widehat{A}}, \\ &\widehat{A} =r+c_{1}r\widehat{H}, \\ &\widehat{B} =-F_{\max } \bigl( r-\beta -\kappa \widehat{H}+c_{1} \widehat{H} ( r-\beta ) \bigr) , \\ &\widehat{C} =-F_{\max }\delta ( 1+c_{1}\widehat{H} ) , \\ &\widehat{H} =\frac{\theta e^{-\mu _{3}\tau _{3}}\xi }{cg},\qquad \widetilde{S}=\frac{\xi }{g}. \end{aligned}$$

Numerical simulations for system (21)–(26) are performed using the following values: \(\delta =10\), \(\beta =0.01\), \(r=0.009\), \(F_{\max }=1200\), \(\varepsilon =0.3\), \(\alpha =0.4\), \(m=0.1\), \(a=0.6\), \(\lambda =0.1\), \(\theta =1.2\), \(c=4\), \(\eta =0.1\), \(\xi =0.03\), \(d=0.8\), \(h=0.1\), and \(\mu _{i}=0.1\) (\(i=1,2,3 \)). The other parameters will be chosen in what follows.

Let us consider the initial values:

  1. IV1:

    \(\psi _{\omega }^{1}=800\), \(\psi _{\omega }^{2}=8\), \(\psi _{\omega }^{3}=1\), \(\psi _{\omega }^{4}=0.5\), \(\psi _{\omega }^{5}=1\), \(\psi _{\omega }^{6}=0.5\),

  2. IV2:

    \(\psi _{\omega }^{1}=600\), \(\psi _{\omega }^{2}=10\), \(\psi _{\omega }^{3}=3\), \(\psi _{\omega }^{4}=1\), \(\psi _{\omega }^{5}=3\), \(\psi _{ \omega }^{6}=1\), and

  3. IV3:

    \(\psi _{\omega }^{1}=400\), \(\psi _{\omega }^{2}=12\), \(\psi _{\omega }^{3}=5\), \(\psi _{\omega }^{4}=2\), \(\psi _{\omega }^{5}=5\), \(\psi _{ \omega }^{6}=2\), \(\omega =-\overline{m},-\overline{m}+1,\ldots,0\).

  • Stability of equilibria

We choose \(\tau _{1}=0.1\), \(\tau _{2}=0.5\), \(\tau _{3}=0.9\) and choose κ, η, and ξ are varied as follows.

Case (1) \(\kappa =0.003\), \(q=0.05\), and \(g=0.002\). This yields \(\mathcal{R}_{0}=0.634<1\). Figure 1 shows that the concentration of healthy cells increases and tends to the value \(F^{0}=1089.96\). Moreover, the concentrations of infected cells, free viruses, antibodies, and CTL cells decay and reach zero for IV1–IV3. Consequently, there exists only one equilibrium that is \(Q^{0}\) and it is G.A.S. This result supports the result of Theorem 1.

Figure 1
figure 1

The simulation of trajectories of system (21)–(26) for Case \(\mathcal{R}_{0}\leq 1\)

Case (2) \(\kappa =0.01\), \(q=0.05\), and \(g=0.002\). With these values we obtain \(\mathcal{R}_{1}^{Y}=0.799<1<\mathcal{R}_{0}=2.112\) and \(\mathcal{R}_{1}^{Z}=0.440<1<\mathcal{R}_{0}=2.112\). Figure 2 displays that for all the three initial values IV1–IV3, the solutions of the system reach the equilibrium \(Q^{\ast }= ( 523.57,10.285,5.244,1.438,0,0 ) \). Consequently, \(Q^{\ast }\) exists and it is G.A.S. This agrees with the result of Theorem 2.

Figure 2
figure 2

The simulation of trajectories of system (21)–(26) for Case \(\mathcal{R}_{1}^{Y}\leq 1<\mathcal{R}_{0}\) and \(\mathcal{R}_{1}^{Z}\leq 1<\mathcal{R}_{0}\)

Case (3) \(\kappa =0.01\), \(q=0.2\), and \(g=0.002\) and then \(\mathcal{R}_{0}=2.112>1\), \(\mathcal{R}_{1}^{Y}=1.587>1\), and \(\mathcal{R}_{1}^{Z}=0.440<1\). Figure 3 displays that the solutions of the system reach the equilibrium \(\overline{Q}= ( 823.137,5.676,2.894,0.5,2.934,0 ) \) for all the initial values IV1–IV3. Thus exists and it is G.A.S. This result is consistent with the result of Theorem 3.

Figure 3
figure 3

The simulation of trajectories of system (21)–(26) for Case \(\mathcal{R}_{1}^{Y}>1\) and \(\mathcal{R}_{1}^{Z}\leq 1\)

Case (4) \(\kappa =0.01\), \(q=0.005\), and \(g=0.01\) and then \(\mathcal{R}_{0}=2.112>1\), \(\mathcal{R}_{1}^{Z}=1.337>1\), and \(\mathcal{R}_{1}^{Y}/\mathcal{R}_{2}^{Z}=0.041<1\). From Fig. 4 we can see that, for all the initial values IV1–IV3, the solutions of the system tend to the equilibrium \(\widehat{Q}= ( 695.628,7.866,3,0.823,0,2.020 ) \). This result shows that exists and it is G.A.S, and this agrees with the result of Theorem 4.

Figure 4
figure 4

The simulation of trajectories of system (21)–(26) for Case \(\mathcal{R}_{1}^{Z}>1\) and \(\mathcal{R}_{1}^{Y}/\mathcal{R}_{2}^{Z}\leq 1\)

Case (5) \(\kappa =0.01\), \(q=0.3\), and \(g=0.02\) and then \(\mathcal{R}_{0}=2.112>1\), \(\mathcal{R}_{1}^{Y}=1.742>1\), and \(\mathcal{R}_{2}^{Z}=1.412>1\). From Fig. 5 we observe that the solutions of the system reach the equilibrium \(\widetilde{Q}= ( 901.96,4.153,1.5,0.333,1.169,2.469 ) \). This yields that exists and it is G.A.S. This illustrates the result of Theorem 5.

  • Impact of time delay on the viral dynamics

Figure 5
figure 5

The simulation of trajectories of system (21)–(26) for Case \(\mathcal{R}_{1}^{Y}>\mathcal{R}_{2}^{Z}>1\)

Without loss of generality we let \(\tau =\tau _{1}=\tau _{2}=\tau _{3}\). We fix the values \(\kappa =0.01\), \(q=0.3\), and \(g=0.02\) and select different values of τ. We solve the system with initial IV2. Figure 6 shows the influence of the time delay parameter τ on the stability of the equilibria. One can see that as τ is increased, the concentration of healthy cells is increased, while the concentrations of infected cells, free viruses, CTL cells, and antibodies are decreased. Let us write \(\mathcal{R}_{0}\) as follows:

$$ \mathcal{R}_{0}(\tau )=F^{0} \biggl( \frac{m ( 1-\varepsilon ) e^{-(\mu _{1}+\mu _{3})\tau }}{\alpha +m}+\varepsilon e^{-(\mu _{2}+\mu _{3})\tau } \biggr) \biggl( \frac{\kappa \theta }{ac} \biggr) . $$

Since \(\mathcal{R}_{0}\) is a decreasing function of τ, then the time delay can change the stability properties of equilibria. Using the values of the parameters and from Fig. 6 we can see that if \(\tau \geq 4.373\), then \(Q^{0}\) is G.A.S. Biologically, the time delays play a similar role of antiviral treatment in eliminating the viruses from the body.

Figure 6
figure 6

The simulation of trajectories of system (21)–(26) with different values of τ

4 Conclusion

In this paper, we formulated and analyzed a discrete-time viral infection model with both antibody and cell-mediated immune responses. We incorporated two categories of infected cells, namely latently infected cells (such cells contain the virus but are not producing) and actively infected cells (such cells produce new viruses). The production and removal rates of the cells and viruses as well as the incidence rate were modeled by general nonlinear functions which satisfy a set of conditions. These general functions encompass several specific forms commonly used in the virus dynamics literature. We incorporated three types of time delays, in which the first and second delays describe the times between a virus contacts a susceptible cell and the cell becomes latently infected and actively infected cell, respectively. The third delay is the time from death of an infected cell until the virus is active. We used nonstandard finite difference scheme to discretize the continuous-time model. We showed that the solutions of the discrete-time model with given initial states are positive and bounded. We derived four threshold parameters which fully determine the existence and stability of the five equilibria of the model. Then, we proved the global stability of the equilibria by constructing Lyapunov functions. Moreover, we performed numerical simulations to support the global stability results. We studied the effect of time delay on the virus dynamics. Since \(Q^{0}\) is the desired equilibrium to be stabilized, we determined the critical time delay parameter \(\tau ^{\mathrm{critical}}\) by solving the equation \(\mathcal{R}_{0}(\tau ^{\mathrm{critical}})=1\) and showed that \(Q^{0}\) is globally asymptotically stable when \(\tau \geq \tau ^{\mathrm{critical}}\). This shows that the time delay can have a similar effect as the antiviral drugs. This gives some impression to develop a new class of treatment to increase the delay period and then suppress the viral replication. It is worth emphasizing that the role of the delay term does not only take into account the delay in the dynamical response of the interacting entities, but also their heterogeneity. This can be accounted for by modeling interactions as shown in [63]. Recently, many authors have argued that the virus moves freely in body and follows the Fickian diffusion (see, e.g., [6466]). Therefore, it is more reasonable to study reaction-diffusion versions of our model. We leave these points as possible future works.