If the trolley is moving at light speed by the time it hits the station, it is impossible for anyone to get on or off because—from the trolley’s perspective—no time passes between stops. Ergo, the number of passengers on it must be the same every stop.
If the initial number of passengers is odd or a non-zero integer, this inability to board/unboard would contradict the rules.
Thus, in order to satisfy all the conditions, the initial number of people on the trolley must be 0. As an even number it will be subject to halving, but 0/2=0, so the rules are satisfied.
Hence, pulling the lever is the optimal solution as 0 people will die. QED.