Problem with pcf8574

That is a very complex library with a lot of function you don't need for simple buttons. On a digital read it, by default, doesn't read the pin if it thinks it knows the value.

Try adding true to the digitalRead(). For example digitalRead(P0,true) to force it to actually read the pin.

I assume the buttons are connected to ground when on.