Cosmic ray theory