Deriving intertemporal budget constraint from flow constraint I am trying to learn how to solve difference equations in order to derive intertemporal budget constraints. Consider the government's flow budget constraint:

$$\frac{B_{t}-B_{t-1}}{p_{t}} + \frac{M_{t}-M_{t-1}}{p_{t}} + s_{t} -i_{t-1}\frac{B_{t-1}}{p_{t}} = 0$$ 

where $s_{t}$ is real taxes net of government consumption. I re-write the above as

$$\frac{R_{t}B_{t-1} + M_{t-1}}{p_{t}} = \frac{B_{t} + M_{t}}{p_{t}} + s_{t}$$ 

where $R_{t}$ is the gross nominal interest rate.

Now I am quite lost. I think what is confusing me is that I have $t-1$ and $t$ terms on the left-hand side. The examples I have tried before are usually on the form $a_{t} = a_{t+1} + b_{t} +(...)$ which I then solve "forward" by substituting for $a_{t+1}$ over and over again until I see a pattern developing. But in this case I can't really re-write the LHS in a proper manner. 

Any thoughts on how I should proceed? And if there are any books that go through difference equations I would be very interested in some names as I am self teaching myself so far.

EDIT: Thanks to @luchonacho I have obtained the following:

$B_{t} = \frac{B_{t+T}}{R_{t+1}R_{t+2}...R_{t+T}} + \frac{D_{t+T}}{R_{t+1}R_{t+2}...R_{t+T}} ...\frac{D_{t+1}}{R_{t+1}}$ since we are in an inifite period world I write this as"

$B_{t} = \lim_{T\to\infty}  \frac{B_{t+T}}{R_{t+1}R_{t+2}...R_{t+T}} + \sum\limits_{j=1}^{\infty} \frac{D_{t+j}}{\prod_{s=1}^{j} R_{t+s}}$

I might have messed up the summation/product notation but this is one of the expressions I have seen for the intertemporal constraint. However, another common way I have seen it written is as follows:



Ignore the right-hand side as it assumes a functional form of the utility function. I am interested in obtaining an expression with both $B_{t-1}$ and $M_{t-1}$ on the LHS. Is there a way I can go from the expression I obtained above to the one with both $B_{t-1}, M_{t-1}$? I am interested in deriving this because I want an expression for the valuation of all government liabilities.
Take your second equation, move it forward one period, and rearrange. You get:

$$ B_t = \frac{p_{t+1} s_{t+1} + \Delta M_{t+1}}{R_{t+1}}  + \frac{B_{t+1}}{R_{t+1}} $$

Then, define the nominal primary deficit as $D_{t+1} = -(p_{t+1} s_{t+1} + \Delta M_{t+1})$. The above transforms into:

$$ B_t = -\frac{D_{t+1}}{R_{t+1}} + \frac{B_{t+1}}{R_{t+1}} $$

which has the format you are looking for. To find the infinite-period intertemporal budget constraint, simply proceed with forward substitution.

The notation I've used (regarding the deficit) is taken from Wickens, Chapter 5. The above is roughly equal to equation (5.11) in the book. There, the author has a more general expression, which includes inflation, GDP growth, and debt-to-GDP ratio. Your example is a simplification of his. I suggest you go through Section 5.4 of the book, which it gives a very detailed analysis of the Government budget constraint (it also gives the solution you are looking for, in case you want to compare).



To find the final expression you are looking for (after edit), take your second equation and replace $B_t$ with the infinite-period intertemporal budget constraint:

$$\frac{R_{t}B_{t-1} + M_{t-1}}{p_{t}} = \frac{B^*_{t} + M_{t}}{p_{t}} + s_{t}$$ 

where $B^*_t$ is the result of the forward substitution exercise.