(...) using an incompatible license like the MIT license.
In general, I like to work with this baseline:
- GPL + MIT => GPL
- MIT + GPL => GPL
- (anything else) + GPL => GPL
- GPL + (anything else) => GPL
In other words, if you mix GPL with anything else, you get GPL'ed code. There are some exceptions, but not at the level of actually mixing code. Note that you can do as you please as long as you keep the code to yourself -- only when you distribute your code you must adhere to the rules of the GPL.
You copy & paste a method from a GPL library - blatantly a violation assuming the GPL library created the method themselves.
Not a violation as long as you release your code under the GPL and quote the original author. This is called a derivative work (one that has all parts but one removed).
You create a function with a similar purpose but you create it from scratch -
presumably not a violation
If you see a GPLed program and think to yourself, "gee, that would be useful if it were not GPLed" and the go and write your own program without copying any code and other protected parts, probably not a direct violation. Very much depends on the jurisdiction.
You use the same code as a GPL library, but you improve on it (optimize performance for example) - is this a violation?
As long as you put your code under the GPL that's one of the core ideas of GPL - allow you to improve on the previous work, freely, as you see fit. As long as you stick to the rules, of course.
You use the same code as a GPL library, but you superficially refactor it (e.g. rename variables for clarity, add comments, but don't really change the underlying logic) - is this a violation?
Again, as long as you keep the result GPL'ed and quoting the original author, that's probably fine.
You translate code from a GPL library to another language but keep the logic exactly the same - presumably not a violation?
It's still copying, right? If your intention is to take a GPL'd program in language A and transform it to language B just to get rid of the GPL, think again. That is at least plagiarism, if not worse, in most jurisdictions.
Disclaimer: IANAL