In the Lighting Network or with micropayment it's possible to open up payment channels that basically work like a smart contract.
At the beginning, the channel is funded by one or two parties with some initial coins (or "funds"), which is then transactioned to the blockchain. The question is: Where do these initial coins go to? Are they like stored in the blockchain-only? Or are they stored in some kind of virtual Bitcoin address for that channel?
So let's say one party is Alice and the other is Bob. The channel is single-funded by Alice (the very same as here). Now Alice sends Bob 0.2 BTC: Where are the transactions in the channel being written to? In other words, how can I make sure that Alice doesn't deliberately screw up the channel and gets back the 1 BTC instead of the 0.8 BTC? Does this even reliably work without a man in the middle? If not, who or where is this man in the middle?