Isn’t this a logical impossibility? To have knowledge is to contain it in your source code, so A is contained in B, and B is contained in A...
The idea is that A and B are passed each other’s source code as input (and know their own source code thanks to that theorem that guarantees that Turing machines have access to their own source code WLOG, which I think DanielLC’s comment proves). There’s no reason you can’t do this, although you won’t be able to deduce whether your opponent halts and so forth.
Alternatively, I’m considering all the strategies I could use, based on looking at my opponent’s strategy, and one of them is “Cooperate only if the opponent, when playing against himself, would defect.”
Your opponent might not halt when given himself as input.
The idea is that A and B are passed each other’s source code as input (and know their own source code thanks to that theorem that guarantees that Turing machines have access to their own source code WLOG, which I think DanielLC’s comment proves). There’s no reason you can’t do this, although you won’t be able to deduce whether your opponent halts and so forth.
Your opponent might not halt when given himself as input.