The third conditional: if ... had done x
With the third conditional, Elena, we are often talking about something that might have happened, but didn't. As your example illustrates, when we are discussing such past situations we normally use past perfect in the if-clause, followed by would have + past participlein the main clause. Compare the following:
I didn't pass the exam. But if I had passed it, I would have registered for the civil engineering course at Nottingham Trent University.
We didn't manage to get there by nightfall. But if we had (managed to get there), we would have slept in a comfortable bed and not on the ground.
Note that we use the third conditional in this way when we are expressing regret about something. To emphasise how much we regret something, we can use if only as an alternative to if:
I just didn't realize he was ill. If only I had realized (that), I would have got him to a doctor much earlier.
From: BBC Learning English - http://www.bbc.co.uk/worldservice/learningenglish/
Now, Elena, as well as talking about things that didn't happen, we also use the third conditional to talk about things that did happen but that might not have happened. In other words, we use it to both to describe past action and to regret past inaction. If we are referring to things that did happen, we need a not in the if-clause of the following conditional sentence. Compare the following:
I received some really excellent training for this job. Had I not been trained in this way, I wouldn't have survived in the job for very long.
When my car broke down, I had to run very fast all the way to the station. If I hadn't run so fast, I would surely have missed the train.
The third conditional: if …had(n't) been -ing
Note that although we normally use the past perfect simple in the if-clause, we sometimes use the past perfect progressive if the action described continues over a period of time:
You were driving so fast. If you hadn't been driving so fast, the accident would never have happened.
It's lucky you're so attentive to what's going on around you. If you hadn't been looking out of the window at that moment, you wouldn't have witnessed the crime.
would've / might've
Note that if we want to introduce the idea of possibility into our assertion in the main clause, might've done can be used as an alternative to would've done:
It's fortunate that you spend so much time looking out of your front room window. If you hadn't been looking out the window just then, you might not have seen the crime being committed.
It's a pity you weren't wearing your glasses. If you had been wearing them, you might've noticed that it was a bull, not a cow, that was charging towards us.
would've / could've
Similarly, if we want to talk about abilities / possibilities rather thancertainties, we can use could've done instead of would've done in the main clause. Compare the way ability / possibility contrasts with certainty in these examples:
I am an adopted and unhappy child. I often think that If my real mother had kept me, I could've danced in the street to earn money for us both.
My dancing feet would have softened the hearts of the passers-by and they would've thrown money into the hat in front of us.