A proof of the Beyer-Stein-Ulam relation between complexity and entropy