As Pakistan mourns, prime minister vows to defeat militants