^^^The air is less dense at altitude, thus less compressed air/fuel mixture which would dramatically reduce the likelihood of detonation. Meanwhile, back at sea level, if you run 87 the computer pulls timing so that the spark arrives milliseconds later than if you use premium, there will be zero damage to the engine. Octane is simply the measure of the fuels resistance to ignition, so to a point the higher the octane the more timing (earlier arrival of the spark to ignite the fuel) the engine can tolerate to build a nice stable flame front for maximum power. With 87 the spark arrives late so less flame front, so you might notice reduced power and reduce fuel mileage, but the engine management software is going to manage things at a safe level.