Spock jumped to the conclusion that because the memory bank has been tampered with then the assassins automatically beamed from and back to the Enterprise. Of course, since "reality" proved him right then no one questioned his logic. However, the assassins were never seen during the killing and could very well have been Klingons in federation outfits (as Worf the defender sort of suggested) beamed from and back to the Klingon ship. Valeris could have altered the computer memory. Just imagine how much harder it would have been to prove anything if they had proceeded this way. At any rate, it shows that Spock's reasoning is very weak.