Discrete Mathematics Study Notes (3)

Several common logic operations (2)

1. Definition 5: Conditional statement (implication)

      There is a proposition p and a proposition q. The compound proposition p→q means "if p, then q". When p is true (T) and q is false (F), its true value is false (F), otherwise it is true (T).

    In conditional sentences, we call the p proposition as the hypothesis (premise or antecedent), and the q proposition as the conclusion (postpart).

    Example 1: If tomorrow is sunny, my family and I will go to the botanical garden for barbecue.

                Suppose proposition p is: tomorrow is a sunny day, and proposition q is: my family and I will go to the botanical garden to have a barbecue. We analyze 4 situations of the combination of these two propositions:

                a: The proposition p is T: tomorrow is sunny, and the proposition q is T: my family and I will go to the botanical garden for barbecue, which is in line with the meaning to be expressed, p→q is T;

                b: proposition p is T: tomorrow is sunny, proposition q is F: my family and I will not go to the botanical garden for barbecue, which violates the meaning to be expressed (lied), p→q is F;

                c: The proposition p is F: tomorrow is not sunny, and the proposition q is T: my family and I will go to the botanical garden for barbecue. Because the restriction p is not established, I can or may not go barbecue. There is no lying. Meaning, p→q is T;

                d: The proposition p is F: tomorrow is not a sunny day, and the proposition q is F: my family and I will not go to the botanical garden for barbecue. In the same situation c, p→q is T.

 

    There are also common ways of expressing conditions in daily life:

    If p, then q p implies q

    If p, q when p, q

    q, if p

 

    For ease of understanding, we can think of conditional statements as obligations or contracts. For example, we often write in contracts as follows:

    If I do not receive the goods within 10 days, then I will deduct a certain amount of liquidated damages.

    "Deduction of a certain amount of liquidated damages" will definitely happen when the condition of "no delivery of goods within 10 days" is established. If it does not happen, it means that the contract has not been done. This conditional statement is false (F), but when the condition does not happen (When it is not established), this matter may happen (the penalty for other breaches of the contract has been deducted) or may not happen. This does not violate the terms of the contract, so the conditional statement is also true (T).

Truth table:

                   

 

    Inverse proposition of conditional statement:

    If there is a conditional sentence p→q, we call q→p its inverse proposition.

    The inverse proposition of Example 1 is: If tomorrow my family and I will go to the botanical garden to barbecue, then tomorrow will be sunny.

    From Example 1, we know that if tomorrow is not sunny, we might also go to barbecue. Obviously, we cannot determine the weather tomorrow by whether or not we have barbecued. Therefore, the inverse proposition of the conditional statement has a different meaning from the original conditional statement.

                 

    From the truth table, we can also see that the truth table of p→q is different from the truth table of q→p.

    Anti-proposition of conditional statement:

    If there is a conditional sentence p→q, we call p→ q its inverse proposition.

    The counter-proposition of Example 1 is: If tomorrow is not sunny, then my family and I will not go to the botanical garden for barbecue.

    From Example 1, we know that if tomorrow is not sunny, we may also go to barbecue, so the inverse proposition of the conditional statement has different meanings from the original conditional statement.

                    

    Also from the truth table, we can also see that the truth table of p→ q is different from the truth table of p→ q.

    The inverse proposition of conditional sentences:

    If there is a conditional sentence p→q, we call q→ p its inverse negation proposition.

    The inverse proposition of Example 1 is: If my family and I do not go to the botanical garden for barbecue tomorrow, it will not be sunny tomorrow.

    By truth table, we can prove the inverse of the conditional statement whether the original propositions proposition has the same truth table, as this has the same truth table of the compound proposition, which we call the equivalent of

                       


Two, conditional statement application

     We often use conditional statements in programming. For example, in C++, we write:

//取x的绝对值
if ( x < 0 ){
  x *= -1;
}

When x is a negative number, its absolute value is its opposite number. In other cases, no transformation is required.

Guess you like

Origin blog.csdn.net/hn_tzy/article/details/103021733