The Shannon lengths are . Their Competitive optimality of the Shannon code says that for every binary uniquely decodable code of lengths and every positive integer ,
On this event, . Summing and applying the Kraft inequality proves