Bob writes software for employer A and employer B. Bob has a general contract with employer A which states that any IP generated in the course of employment (whether during work hours or not) can be claimed by employer A. On the other hand, Bob's contract with employer B has no claim over IP generated.
The purposes of the software at each company are different, but from time to time he implements the same code in both systems.
Bob has a specific release contract from employer A regarding work at employer B. Specifically employer A will not claim ownership over IP produced at employer B, if it is not derived from the work at employer A (let us call this the release condition).
Overlap in code potentially goes against the release condition. To avoid this situation, Bob releases all software at employer A under CC-BY-4.0. This is justified because the code will be released as open source due to the nature of the field. The software at employer B is commercial and not open source.
My question is whether the following statements are correct: (1) if company A agrees to open source licensing suggested by Bob (which is justified by the field), they cannot claim that work at company B is derived from work at company A, since the code which belongs to both is in the public domain; (2) company B has no licensing conflict due to CC-BY-4.0 not requiring them to release their code under the same license; (3) CC-BY-4.0 can be a valid choice of license for software (I see that GNU recommend against it for code); (4) Between GPLv3 and CC-BY-4.0 there is no difference in terms of IP claims, while GPLv3 is more limiting for subsequent commercialisation (by any party).