When a proof environment ends with a displaymath environment, the QED symbol should be placed in the displaymath environment. Otherwise, the symbol is pushed down below the last line of the proof environment.