How can reinforcement learning work for avoidance? (Paradox) Gradient descent works by reinforcing a small amount every time the machine gets the right answer.
If it gets the right answer it is more likely to pick that answer next time and so it gets reinforced again and again.
But here's a paradox. What if you want to train a machine to avoid something. As soon as it starts to avoid it, it will no longer encounter that event again and so it can't reinforce its learning.
Hence how can a machine learn about bad things if its very purpose is to avoid bad things?
Edit: I am thinking specifically about real-time learning where there is no split between training phase and testing phase. The paradox is that if the learning rate is small, it will only shift slightly away from bad things making random exploration still likely to hit bad things. And so the equilibrium will be to be just on the edge of avoiding a bad thing but still quite likely to hit it by random chance.
 A: 
As soon as it starts to avoid it, it will no longer encounter that event again and so it can't reinforce its learning.

This is the not the case always.If we talk about any Reinforcement Learning algorithm e.g Q-Learning, there is a choice for action selection called Explore-Exploit Dilemma (or $\epsilon$-greedy policy) during training period. 
In this, at every state Agent may either choose to exploit and select the best action it has learnt over the period or choose to explore and select any random action. So, it is also possible that Agent will select a bad action again due to exploration, in that case Agent will reinforce its learning about that bad action. Decision of explore-exploit is taken based on a random variable and this is applicable for training phase only, during testing as you wrote, Agent will avoid bad things and will always choose the best action it has learnt during training. 
So, with the use of methods like exploit-explore, Agent or machine do learn good as well as bad things during training.
Edit :
As @neilslater wrote in the comment, Experience-replay is another way in which Agent learns about bad state-action pair, without visiting that state-action pair multiple times. In Experience-replay, Agent's experiences are stored in memory and Agent is trained again on that stored batch of experiences.   
