Does proof-of-work contribute directly to prevent double-spending? I know similar questions have been asked before (e.g. How proof of work prevents double spend) but I'm struggling to visualise the solution to double-spending being directly reliant on proof of work.

Imagine a miner, Bob, trying to double-spend 1 BTC by sending to both Alice and Jim.  Either he can include both transactions to Alice and Jim in a single bad block that he mines - in which case the block will be rejected even with a valid PoW.  Or he can broadcast his first (valid) transaction to Alice and let someone else mine it and then mine his own bad block later with the transaction to Jim which again will be rejected regardless of having valid Proof-of-work.  So double-spending is really protected against on the level of transaction-validation which every full node on the network performs?  Meaning PoW doesn’t really directly stop double-spending - what stops double-spending is simply the nodes being aware of previously confirmed transactions.  And the reason we can trust all transactions on the blockchain are "confirmed" is PoW?

If that's right, and PoW is more of a high-level system-wide solution, here's a final question I'm hoping someone can clarify: why can't we replace PoW with an automatic 10 minute block-addition based on a simple timestamp?  Is it because it's such a mission-critical task (involving the trust of the whole system), that unlike Difficulty calculation (where we rely on timestamps), we must find an alternative where no time value can be spoofed? (even though if it was, individual nodes would presumably be able to reject it fake times).  Is it wrong to think of Proof-of-work as basically a replacement for trusting a (hackable/spoofable) timestamp server that could regulate 'blocks every 10 minutes'.
There are multiple definitions of the term "double spending" at play here. First, there is the actual definition of double spending: to spend the same money multiple times. A simple example of this is the coin on a string in a vending machine. You put tie a string to a coin, when you put the coin in the machine, it thinks you paid, you get whatever you want from the machine, then you use the string to pull the coin back out so that it can be spent again somewhere else.

By this definition, the exchange of goods has occurred, but the money used to pay for it is used by the payer to pay for another good later. In effect, you created multiple transactions that conflicted with each other and they are all considered to be settled (i.e. final and irreversible) in the accounting system of that money.

Then there is the definition of "double spending" in the context of Bitcoin transactions. Double spending is often used to say that there are multiple unconfirmed transactions which conflict with each other. But unconfirmed transactions are not considered to be settled, so you have conflicting unsettled transactions under this definition.

The goal of the blockchain is to resolve these conflicting unsettled transactions. It's purpose is to ensure that all transactions do not conflict with each other and to make them considered settled. So to not have double spends, you need two properties for transactions: irreversible, and non-conflicting.

The non-conflicting part is handled by nodes. Nodes validate blocks and transactions. They reject blocks if they contain transactions that conflict with other transactions in that block or in the blockchain. So the thing that prevents the conflict aspect of double spends are nodes.

The Proof of Work is what allows for the irreversible aspect. It requires that miners expend time and energy in order to create a block. In order to change the contents of a block, one must expend time and energy to create a new block which conflicts with one that already exists.

The Proof of Work is also used to resolve blockchain conflicts. If there are multiple candidate blockchains that stem from a common forking point, nodes follow the one that has the most cumulative work because that chain is the one where the most energy was expended to create.

The chain part of the blockchain creates a compounding factor so that in order to replace a block in the blockchain, you must also replace the blocks that are on top of it thus expending far more time and energy. Because there are other people mining on the original blockchain, you must also be able to mine faster than them in order for your blockchain to have more work than the original for yours to be accepted by everyone else.

Because replacing blocks requires significant time and energy expenditure, one can reasonably assume that a block and the transactions it contains will never change once multiple blocks have been mined on top of it. This gives us the irreversible aspect. This is why it is said that confirmed transactions are irreversible.


  why can't we replace PoW with an automatic 10 minute block-addition based on a simple timestamp?


Because that is not decentralized. Who creates the blocks? If multiple people can create blocks like with mining, by what mechanism are ties broken? How do you resolve two different people creating different blocks? What stops someone from spoofing timestamps and replacing the blockchain with their own version?

The easiest way to resolve these is to make blocks only produced by a limited and trusted group of people. So it is now centralized. Congrats, you created Paypal, but less efficient.

The whole purpose of the Proof of Work is to allow for a decentralized system where everyone can agree on the truth without some central authority dictating what that truth is. If everyone follows the same rules, then everyone will eventually conclude on what the truth is. The use of energy expenditure in the Proof of Work prevents someone from rewriting history with different blocks because it is expensive to do so. The tie breaking of using the chain with the most work allows nodes to converge on the same blockchain. Use of the Proof of Work answers the questions I gave above without relying on a central authority.

In conclusion, the Proof of Work allows transactions to become settled and irreversible. It allows nodes to converge onto the same blockchain and makes it extremely expensive, to the point of impossible expensive, to rewrite history thus making transactions in the blockchain irreverisble. The actual ensuring that no conflicting transactions exist in the blockchain and thus actually preventing true double spends is left to the nodes that validate the blockchain.