Not sure what exactly you mean by 'logically correct'. The two terms that we use to describe an argument are: valid and sound. An argument is valid if there are no issues with the structure of the argument, and the conclusion must follow from the stated premises. An argument is sound if, in addition to being valid, each premise contained with the argument is true, so that the conclusion is true. Note that a valid argument need not be sound. ('P1. If Melbourne is in China, then it is also in Asia. P2. Melbourne is in China. C. Therefore, Melbourne is in Asia.' constitutes a perfectly valid argument, since the conclusion follows from the premises, but the argument is by no means sound, since, although P1 is true, P2 is not, so the conclusion is not true.) However, a sound argument must be valid.
I may be misinterpreting your argument, but the argument that you presented above seems neither valid nor true. If you cause the keys on a keyboard to move, and you are rational, does it automatically follow that the event of 'keys on a keyboard moving' is rational? By the looks of things, A seems to be an autonomous agent, e.g. human, but B seems to be an event. An event, in general cannot be rational.
What you are after may be the following. There are four common argument structures that philosophers often invoke.
P1. If P, then Q.
P2. P.
C. Therefore, Q.
This is called modus ponens. It is not hard to see that modus ponens constitutes a valid argument. If Melbourne is in Victoria, then it is in Australia. Melbourne is in Victoria, therefore Melbourne is in Australia. No issues there.
P1. If P, then Q.
P2. Not Q.
P2. Therefore, not P.
This is called modus tollens. This also constitutes a valid argument, and mathematicians like to invoke this kind of logic when constructing a proof by contrapositive. If Melbourne is in Guangdong, then it is in China. Melbourne is not in China. Therefore, Melbourne is not in Guangdong. Again, no issues there.
P1. If P, then Q.
P2. Q.
P3. Therefore, P.
This is called affirming the consequent. This does not constitute a valid argument. It is easy to see why: If Melbourne is in NSW, then it is in Australia. Melbourne is in Australia. Therefore, it is in NSW. True? Certainly not.
P1. If P, then Q.
P2. Not P.
C. Therefore, not Q.
This is called denying the antecedent. Such arguments are also no good. If Melbourne is in NSW, it is in Australia. Melbourne is not in NSW. Therefore, it is not in Australia. True? Again, certainly not!