Take your first form:
If John shot James, then John had a gun.
John had a gun.
Therefore, John shot James.
So write P for "John shot James" and Q for "John had a gun". Then your proposition reads:
If P, then Q.
Q.
Therefore, P.
The most important feature of propositional logic is that it doesn't look at the meaning of the sub-arguments. Therefore you can test your claim by replacing the used propositions by arbitrary others. Let's use:
- P = "a and b are positive integers whose product is 5"
- Q = "a and b are positive integers whose sum is 6"
Now the first line of your first form reads:
If a and b are positive integers whose product is 5, then a and b are positive integers whose sum is 6."
This is clearly a true statement, because the only positive integers whose product is 5 are 1 and 5, and the sum of those is 6.
The second line of your first form reads:
a and b are positive integers whose sum is 6.
The truth of this statement depends on the values of a and b, but it is easy to choose a and b so that this statement is true; say a=2, b=4. Note that this choice of a and b does not invalidate the first statement.
The last form of your first form reads:
Therefore, a and b are positive integers whose product is 5.
But with a=2 and b=4, the product is 8, not 5. Therefore if that form were valid, you could derive a false statement. Thus the form is not valid.
However note that the following form is valid:
If John shot James, then John had a gun.
John had no gun.
Therefore John did not shoot James.
Your second form is, of course, valid. It is a direct application of the most basic rule of reasoning, modus ponens.