# Logics in mathematics and in daily life: a statistical programming example

Refresh some basic logical propositions (or statements):

implication:       if       P then       Q (P>Q)

inverse:            if not P then not Q (-P>-Q)

converse:         if       Q then       P (Q>P)

contrapositive: if not Q then not P (-Q>-P)

contradition:    if       P then not Q (P>-Q)

Mathematically or logically speaking, if the implication statement holds, then the contrapositive holds, but the inverse does not hold, i.e., if P then Q, then we can get if not Q then not P, but we can not get if not P then not Q.

That’s all logics needed here and Let’s turn to the ambiguous English in daily life. James R. Munkres of MIT gave an example in _Topology_ (2nd edition, 2000, P.7):

Mr. Jones, if  you get a grade below  70 on  the final, you are going to flunk  this course.

We adapt it in a logical implication form:

Mr. Jones, if P then Q, where

P: you get a grade below  70 on  the final

Q: you are going to flunk  this course

Considering the context, we can also get that the inverse holds: if you get a grade above er or equal to 70, then you are going to pass this course(if not P then not Q ).

Question: when do statistical programming, what types of logics you use?

Answer: Not all mathematically. see

if score<70 then grade="flunk";  ***_if P then Q_**;
else                    grade=“pass”;  *if not P then not Q;