If the PoW serves any other purpose than mining bitcoin, it can't be used, since there won't be any opportunity cost in mining on the most recent chain.
> What stops me from attacking that network by mining on my private chain with a double spend?
Nothing stops you mining on a private chain, but since you have a small minority of the compute power, the network doesn't care about your private chain. The same is true in Bitcoin.
> I have no opportunity cost.
You could be mining blocks that generate useful byproducts and currency.
> Nothing stops you mining on a private chain, but since you have a small minority of the compute power, the network doesn't care about your private chain.
Right, this is not an issue for small miners. But if you have a significant part of mining power, it's important that there is a significant opportunity cost mining on the wrong chain. That can only be ensured by using a PoW that is wasteful outside the currency you're mining.
I'm not sure I follow what you mean. I didn't mean that this be used for mining bitcoin, but rather that there are other cryptocurrencies that have useful by-products. Am I misunderstanding your comment?
These other cryptocurrencies are less secure than bitcoin.
For them, the cost of attacking the network by mining on an orphaned chain is lower, because by definition the PoW has a useful by-product.
The more useful the byproduct, the less secure the coin.
Edit: to illustrate, imagine a PoW that computes cures for cancer. Somebody can now mine on whichever block of the chain he wants forever, since he's producing a cancer cure anyway. The incentive of a block reward (within the currency) is not primary. Thus there is diminished incentive for the network to create a linear blockchain, where everybody mines on the most recent block. Without that, you cannot order transactions.
A cure-cancer PoW where each block fixes all of cancer is ridiculous.
A more apt analogy would be that each block would solve a protein folding or active site matching problem for cancer. Then each solution would be public, and useless to mine over again.
Except the miners don't gain value from discovering a protein fit, so they have no incentive to mine the wrong chain.
Even then, as long as the coin value is larger you will have a consensus with the miners to to mine the latest block. Any sidechains will be neglected, which is why this "no value or nothing" attitude doesn't fit a blockchain network.
See primecoin.io for an example of more useful PoW.