Affirming the consequent

Affirming the consequent (or fallacious modus ponens) is a logical fallacy confusing the directionality of if-then propositions, and named after the consequent in the conditional statement (Q in "if P, then Q").

The fallacy is a formal fallacy.

Form
In formal terms, the fallacious argument is stated as $$\left(P\rightarrow Q\right), Q \vDash P$$.

Converting a Conditional
Converting a conditional occurs when the components of a compound if statement are switched.

False Conversion
This assumes that since all members of one group are part of a second group, all members of the second group must be part of the first group.

Examples:

Kafkatrapping
This is where a person's denial of being involved in a wrongdoing is used as further evidence of that wrongdoing taking place. These kinds of unfalsifiable accusations were commonplace during the times of McCarthyism and the witch hunts, and are especially popular among conspiracy theorists.

The form goes as follows:

Pointing out that guilty people usually plead innocent only shows that the accused could theoretically be guilty, not that they are. As always, the burden of proof lies on the person making the claim.

If and only if
Within logic the bi-conditional variant of affirming the consequent is technically non-fallacious (though it can be argued that it is not truly affirming the consequent to begin with). This takes the form of....

This is valid because the phrase "A if and only if B" is really equivalent to "If A then B and If B then A". So the "consequent" in this case is also a type of antecedent making the inference one of modus ponens.

Explanation
Affirming the consequent is related to the generic phrase that "all X are Y, but not all Y are X" in that the formal fallacy fails to recognise the "not all Y are X" part. Its statistical equivalent is confusion of the inverse, where two conditional probabilities are mistaken to be equal when this is not necessarily true.

As a formal fallacy, it is an error in the underlying logic of an argument or proposition and, similar to how denying the antecedent can be remedied, is corrected by replacing the directional condition "if" with the bidirectional equivalence of the "if and only if" statement or softening the conclusion to assert P as merely probable given Q. This would mean that P necessitates Q and, equally, Q necessitates P. While this will correct the formal logic and the hypothetical assertions made, it can still form a not even wrong argument if the "if and only if" premise happens to be not well founded.