How Does the Longest Chain Rule Prevent Double-Spending in PoW?
The longest chain rule dictates that all honest nodes must follow the blockchain with the most cumulative Proof-of-Work (the longest chain). If a double-spend attempt occurs, it creates a temporary fork.
Honest miners will continue building on the chain they first saw, making the attacker's chain shorter and eventually discarded by the network, thus invalidating the double-spend.