Proof of the holographic formula for entanglement entropy