Next-token pretraining implies in-context learning