> That's why if x is state then f can never be purely idempotent
That is simply not true. f could be, for example, “set x.variable to 7”, which is definitely idempotent.
There's no side effects in f here, so the statement does not apply
There's no side effects in f here, so the statement does not apply