DAMAGE INVOLVING ONE WHO HAD NO PERMISSION [damage :permission]
Gemara
32a (Mishnah): If Reuven and Shimon were running in a Reshus ha'Rabim and Heziku (they damaged) each other, they are exempt.
32b (Beraisa): If a man entered Reuven's carpentry shop without permission, and a piece of wood flew off and killed him, Reuven is exempt. If he had permission to enter, Reuven is liable.
Version #1 (R. Yosi bar Chanina): In the Seifa, he is liable in the four payments but exempt from exile.
Version #2 - Rav Papa citing Rava (Beraisa): If he entered without permission, and a piece of wood flew off and killed him, Reuven is exempt.
(R. Yosi bar Chanina): He is exempt from exile, but is liable to pay four payments.
Version #1 exempts from exile even when the victim had permission to enter. All the more so, it exempts when the victim had no permission!
Version #2 exempts from exile when the victim had no permission to enter. If he had permission, Reuven would be exiled.
Version #3 (Rav Zvid - Beraisa): "And it found" excludes a victim who brought himself to be damaged;
R. Eliezer ben Yakov says, this teaches that if Reuven threw a stone, and Shimon stuck out his head and was killed, Reuven is exempt.
(R. Yosi bar Chanina): He is exempt from exile, but he is liable in four payments.
Version #3 obligates for four damages even when the victim brought himself to be damaged, and all the more so in the cases of Versions 1 and 2. Versions 1 and 2 obligate four damages when Reuven knew that the man entered, but would exempt if the victim brought himself to be damaged!
48a (Rava): If Shimon entered Reuven's yard without permission and he damaged Reuven, or Reuven was damaged through him, Shimon is liable. If Reuven damaged him, he is exempt.
(Rav Papa): This is only if Reuven did not know that Shimon was there. If he knew, Reuven is liable.
This is because Reuven may tell Shimon to leave, but he may not damage him.
(Rava or Rav Papa): If two people were both acting in a permitted way or both in a forbidden way and Heziku each other, they are liable. If Huzku (they got hurt) through each other, they are exempt.
(Inference): This is because they were both the same. If only one had permission, he is exempt and the other is liable.
Rishonim
Rif (16a): Presumably, we follow the version that R. Chanina explained the first Beraisa, that totally exempt one who brought himself to be damaged.
Rosh (3:11): The Rif did not decide which of the first two versions the Halachah follows, for it is not relevant nowadays. They argue only about exile or how to expound verses.
Pilpulei Charifta (3): The Rosh's final words connote that the Rif decided.
Rosh (ibid.): I say that the Halachah follows Version #1, which is like the Stam Gemara, whereas Rava taught Version #2. Rava himself explained Version #1, challenged it and answered for it. The Ramah rules like the latter version. Even nowadays there is a difference. Version #1 holds that R. Chanina explained the Seifa, but in the Reisha, he is exempt from the four payments, and even from Nezek. The Gemara did not say this, because the Beraisa primarily discusses exile. The Rif holds that it is reasonable to totally exempt only when the victim brought himself to be damaged. In the first cases, he should pay four damages. This is like Version #2. It is primary, for in Version #1 R. Chanina does not refer to what the Beraisa teaches (i.e. Misah, which the Beraisa primarily teaches about - Pilpulei Charifta 6).
Rambam (Hilchos Chovel u'Mazik 1:16): If two people acted with permission, or neither had permission, and they damaged each other, they are exempt.
Magid Mishneh: Rav Papa taught that if two Heziku each other, they are liable. If Huzku, they are exempt. Rashi explains that Heziku means that they overtly damaged each other, even without intent, they are liable. Regarding Nezikim we do not distinguish between with and without intent. If Huzku, i.e. they were damaged by one another, they are exempt . A Mishnah (32a) exempts two who Heziku each other. It really refers to a case of Huzku.
Rosh (3:11): Rashi explains that if David entered without Reshus, Levi pays just Nezek. He obligates Nezek, for later we say that he entered l'Da'as Levi (he was aware). On 48a, we say that he is liable if he was aware. However, we can say that he is exempt even from Nezek. It says (regarding when he had Reshus) that he entered l'Da'as Levi. I.e. he one may him to enter, but he did not see him.
Poskim
Shulchan Aruch (CM 378:6): Anyone who damages must pay, whether in Reshus ha'Rabim or the victim's Reshus. Even in the damager's Reshus, if David entered Levi's Reshus without permission and Levi damaged David's body or property, he is liable. Granted, he may expel him, but he may not damage him. This is if he damaged him b'Mezid. If he was Shogeg, he is exempt. If David damaged Levi, even b'Shogeg, he is liable, since he entered without permission. Some say that this is only if Levi did not know that David entered, but if he saw him and was damaged by him, David is exempt.
Gra (18): The Ramah says that if the Levi knew that David entered, it is as if both have Reshus. This is a printing mistake. It should say 'it is as if neither has Reshus.' This is clear from the Mishnah (32a. Two who collide are exempt, for each is allowed to walk. If one said 'stop!', the other is liable.)
Shulchan Aruch (7): If both of them had permission or neither had permission and they were damaged through each other's body or property, if they did not know that the other is there, they are exempt. If they saw each other, even though they did not intend, they are liable.
SMA (8): If Levi entered without permission, the Ba'al ha'Bayis had no reason to suspect that anyone entered, therefore Levi is liable even if the Ba'al ha'Bayis was hurt through Levi.
Shulchan Aruch (421:7): If David entered Levi's Chatzer without permission and Levi did not know, and Levi damaged him without intent, he is exempt. If Levi was damaged by him, David is liable, since he entered without Reshus. If Levi saw him, he is exempt, for he damaged himself.
SMA (421:7): The Tur taught an additional clause saying that if David was damaged, Levi is exempt. The Beis Yosef said that it is a mistake, for the Tur already exempted Levi even for overt damage without intent. Really, it is needed. The Tur exempts Levi for overt damage without intent when he did not know that David was there. If David was damaged, he is exempt even if Levi knew that he was there.