Joc Pederson homers help Diamondbacks beat the Pirates 4-3