I am learning about collision resistance security notion of hash functions. However, I got confused when collision resistance experiment started using "keyed" hash functions in the experiment (and also in other similar experiments). This is a small extract from Introduction to Modern Cryptography by Katz and Lindell :
The collision finding experiment: 1. A key s is generated by running Gen(1^n). 2. The adversary A is given s, and outputs x; x^0 3. The output of the experiment is defined to be 1 iff x \ne x0 and H^s(x) = H^s(x0).
I understand that without "keyed" hash function, in formal analysis of the security, adversary can "cheat" by pre-computing collisions (before the experiment). But even after adding "key", adversary can "cheat" by pre-computing collisions for all "keys". And during experiment, adversary can output collisions based on the key. What did "keyed" hash function solve in formal analysis?