Anyway, my biggest question is this... doesn't Gavin get absolutely
nothing out of this? Obviously, they didn't issue the ruling in this episode, but even in the judge comes down on Richard, it shouldn't matter
at all. At least from what I can surmise, Pied Piper was a completely different program when he was working at Hooli. The whole middle-out thing happened after the infamous Dick Stroking Discussion in episode 10 of season 1. So, if Gavin is given the IP rights, he gets the rights to the algorithm that Richard was working on at that point, which he (or rather his employees) already stole in season 1.
Of course, I can't say that I'm an attorney... or an IP lawyer

... but that seems the most logical to me.