It is copyright infringement, yes. That's why clean room implementations are done by someone who hasn't seen the original source code,
https://en.m.wikipedia.org/wiki/Clean_room_design
For the other examples, it depends but I'm pretty sure a copyright infringement case for either of them wouldn't be immediately thrown out. IANAL but I do know that law is quite fuzzy.
It is copyright infringement, yes. That's why clean room implementations are done by someone who hasn't seen the original source code,
https://en.m.wikipedia.org/wiki/Clean_room_design
For the other examples, it depends but I'm pretty sure a copyright infringement case for either of them wouldn't be immediately thrown out. IANAL but I do know that law is quite fuzzy.