Discrete Mathematics: Principles of Logic and Propositional Logic

Foundations of Mathematical and Automated Reasoning

  • Logic serves as the fundamental basis for all mathematical reasoning as well as all automated reasoning.
  • Standard mathematical logic is essential for providing precisely formulated statements that would otherwise be expressed in natural language.
  • The application of logical principles allows for the development of sets of laws that remain internally consistent.
  • Within the field of computer science, mathematical logic is utilized to:
    • Construct specific computer programs.
    • Provide verification that programs perform exactly what they were designed to do.

Propositional Logic

  • A proposition is defined as a statement or sentence that declares a specific fact.
  • A proposition must evaluate to exactly one of two truth values: TRUE or FALSE, but it cannot be both.
  • Truth values are typically denoted by letters:
    • If a proposition is true, it is denoted by TT.
    • If a proposition is false, it is denoted by FF.
Examples of Quantitative and Factual Propositions
  • True Propositions:
    • There are seven days in a week.
    • Accra is the capital of Ghana.
    • 2+4=62 + 4 = 6
  • False Propositions:
    • The angles of a triangle add up to 360∘360^\circ.
    • London is the capital of France.
    • 2−4=72 - 4 = 7
Sentences That Are Not Propositions
  • Sentences that do not declare a fact are not considered propositions.
  • Questions: "Who are you?"
  • Commands or Exclamations: "Read this chapter before the next class."
  • Sentences with Unassigned Variables: "x+1=2x + 1 = 2" is not a proposition because its truth value depends on the value of xx. However, if values are assigned to variables, such sentences can become propositions.

Mathematical Notation for Propositions

  • Letters are used to denote specific propositional statements. Common examples include:
    • PP : Jane drives a Ford
    • QQ : Bob has grey hair
    • RR : Joe likes computer science

Logical Connectives and Truth Tables

  • Logical connectives are operators used to combine propositions into compound statements.
  • These connectives provide precise semantic meanings to words used in natural language such as "AND" and "OR."
  • Semantic meaning for these connectives is defined using truth tables, which list the resulting truth value for every possible combination of values of the individual component statements.
Negation (The NOT Operator)
  • If PP is a proposition, "not PP" is the negation, represented by the symbols ¬P\neg P or ∼P\sim P.
  • The negation yields a value opposite to that of the original proposition.
  • Example: If PP represents "I like dogs," then ∼P\sim P represents "I do not like dogs."
  • Truth Table for Negation:
PP∼P\sim P
TTFF
FFTT
Conjunction (The AND Operator)
  • The conjunction of propositions PP and QQ is represented by the symbol ∧\wedge.
  • The compound statement is written as P∧QP \wedge Q.
  • Example: If PP is "I like shopping" and QQ is "The sun is shining," then P∧QP \wedge Q is "I like shopping and the sun is shining."
  • Truth Table for Conjunction:
PPQQP∧QP \wedge Q
TTTTTT
TTFFFF
FFTTFF
FFFFFF
Disjunction (The OR Operator)
  • The disjunction of propositions PP and QQ is represented by the symbol ∨\vee.
  • The compound statement is written as P∨QP \vee Q.
  • This is an inclusive OR, meaning it is true if either or both propositions are true.
  • Example: If PP is "I do the gardening" and QQ is "Today is Wednesday," then P∨QP \vee Q can represent "I do gardening every Wednesday" (or "I do gardening or it is Wednesday").
  • Truth Table for Disjunction:
PPQQP∨QP \vee Q
TTTTTT
TTFFTT
FFTTTT
FFFFFF
Exclusive OR (The XOR Operator)
  • The exclusive or connects propositions PP and QQ to result in "PP or QQ (but not both)."
  • The symbol for exclusive or is ⊕\oplus.
  • The statement is true only when one proposition is true and the other is false.
  • Example: P=P = "I will earn an A in this course," Q=Q = "I will drop this course." P⊕Q=P \oplus Q = "I will either earn an A in this course, or I will drop it (but not both!)."
  • Truth Table for Exclusive OR:
PPQQP⊕QP \oplus Q
TTTTFF
TTFFTT
FFTTTT
FFFFFF

Conditional Statements and Implications

The Implication Operator
  • The implication operator gives meaning to the expression "PP implies QQ," represented by the symbol ⇒\Rightarrow.
  • This is also known as a conditional statement, often expressed as "if PP then QQ."
  • Components:
    • PP is the hypothesis, antecedent, or premise.
    • QQ is the conclusion, consequence, or result.
  • Alternative phrasings for P⇒QP \Rightarrow Q:
    • If PP, then QQ
    • PP is sufficient for QQ
    • A necessary condition for PP is QQ
    • PP only if QQ
    • QQ unless ¬P\neg P
    • QQ follows from PP
  • Example: "If you get an A (PP), then I'll give you a dollar (QQ)."
    • If both are true, the promise is kept (TT).
    • If PP is true but QQ is false, the promise is broken (FF).
    • If PP is false, the promise hasn't been broken regardless of QQ. Thus, in two-valued logic, it is considered true (TT).
  • Truth Table for Implication:
PPQQP⇒QP \Rightarrow Q
TTTTTT
TTFFFF
FFTTTT
FFFFTT
Converse, Contrapositive, and Inverse

From an original conditional statement P⇒QP \Rightarrow Q, we can derive three related statements:

  1. Converse: Q⇒PQ \Rightarrow P
  2. Contrapositive: ¬Q⇒¬P\neg Q \Rightarrow \neg P
  3. Inverse: ¬P⇒¬Q\neg P \Rightarrow \neg Q

Example Application:

  • Original Statement: "The home team wins whenever it is raining" (If it is raining, then the home team wins).
  • Converse: "If the home team wins, then it is raining."
  • Contrapositive: "If the home team does not win, then it is not raining."
  • Inverse: "If it is not raining, then the home team does not win."
Biconditional (The Equivalence Operator)
  • The biconditional combines two propositions to express that they share the same truth value.
  • Represented by the symbol ⇔\Leftrightarrow, often read as "PP if and only if (iff) QQ."
  • It is true if PP and QQ are both true, or if PP and QQ are both false.
  • Example: PP: "David is son of Ricky (male)." QQ: "Ricky is father of David." This can be written as P⇔QP \Leftrightarrow Q.
  • Truth Table for Biconditional:
PPQQP⇔QP \Leftrightarrow Q
TTTTTT
TTFFFF
FFTTFF
FFFFTT

Three-Valued Logic

In both computing and mathematics, expressions sometimes cannot be evaluated precisely (e.g., the square root of a negative integer). In these cases, a three-valued logic is defined using truth values: TRUE (TT), FALSE (FF), and UNDEFINED.

Three-Valued Conjunction (∧\wedge)
PPQQP∧QP \wedge Q
TTTTTT
TTFFFF
TTUndefinedUndefined
FFTTFF
FFFFFF
FFUndefinedFF
UndefinedTTUndefined
UndefinedFFFF
UndefinedUndefinedUndefined
Three-Valued Disjunction (∨\vee)
PPQQP∨QP \vee Q
TTTTTT
TTFFTT
TTUndefinedTT
FFTTTT
FFFFFF
FFUndefinedUndefined
UndefinedTTTT
UndefinedFFUndefined
UndefinedUndefinedUndefined
Three-Valued Implication (⇒\Rightarrow)
PPQQP⇒QP \Rightarrow Q
TTTTTT
TTFFFF
TTUndefinedUndefined
FFTTTT
FFFFTT
FFUndefinedTT
UndefinedTTTT
UndefinedFFUndefined
UndefinedUndefinedUndefined
Three-Valued Exclusive OR (⊕\oplus) and Biconditional (⇔\Leftrightarrow)

Truth Table for P⊕QP \oplus Q:

PPQQP⊕QP \oplus Q
TTTTFF
TTFFTT
TTUndefinedUndefined
FFTTTT
FFFFFF
FFUndefinedUndefined
UndefinedTTUndefined
UndefinedFFUndefined
UndefinedUndefinedUndefined

Truth Table for P⇔QP \Leftrightarrow Q:

PPQQP⇔QP \Leftrightarrow Q
TTTTTT
TTFFFF
TTUndefinedUndefined
FFTTFF
FFFFTT
FFUndefinedUndefined
UndefinedTTUndefined
UndefinedFFUndefined
UndefinedUndefinedUndefined

Working with Compound Statements

  • Compound statements involve two or more logical operations.
  • Order of Operations (Precedence):
    1. Parenthetical Expressions: ()() (evaluated innermost to outermost).
    2. Negation (NOT): ∼\sim
    3. Conjunction (AND): ∧\wedge
    4. Disjunction (OR): ∨\vee
    5. Conditional (Implication): ⇒\Rightarrow
  • Operations with equal precedence are evaluated from left to right.
Creating a Truth Table
  1. Row Count: Determined by 2n2^n, where nn is the number of propositional variables. (e.g., 33 variables =23=8= 2^3 = 8 rows).
  2. Column Count: Number of variables plus one column for each logical operation.
  3. General Steps:
    • Assign variables to basic statements.
    • Symbolize the compound statement.
    • Identify the order of operations based on precedence.
    • Fill the table left to right.
Walkthrough Example

Statement: "If the tire is flat then I will have to remove it and take it to the gas station."

  • Step 1 (Variables):
    • PP: The tire is flat.
    • QQ: I have to remove the tire.
    • RR: I have to take the tire to the gas station.
  • Step 2 (Symbolism): P⇒(Q∧R)P \Rightarrow (Q \wedge R). (Parentheses are used for clarity, though conjunction naturally has higher precedence than implication).
  • Step 3 (Precedence Checking):
    1. AND (Q∧RQ \wedge R)
    2. Conditional (P⇒(Q∧R)P \Rightarrow (Q \wedge R))
  • Final Truth Table Construction:
PPQQRRQ∧RQ \wedge RP⇒(Q∧R)P \Rightarrow (Q \wedge R)
TTTTTTTTTT
TTTTFFFFFF
TTFFTTFFFF
TTFFFFFFFF
FFTTTTTTTT
FFTTFFFFTT
FFFFTTFFTT
FFFFFFFFTT

Logical Equivalence, Tautology, and Contradiction

Logical Equivalence
  • Two compound propositions are logically equivalent (≡\equiv) if they produce identical results in their truth tables.
  • Example 1: ∼∼P≡P\sim\sim P \equiv P (Double negation).
  • Example 2 (De Morgan's Laws derivation): ∼(P∧Q)≡∼P∨∼Q\sim(P \wedge Q) \equiv \sim P \vee \sim Q.
Tautology
  • A tautology is a statement that is always TRUE regardless of the truth values of its components. All rows of the truth table evaluate to TT.
  • Example 1: P∨∼PP \vee \sim P
  • Example 2: (P⇒Q)∨(Q⇒P)(P \Rightarrow Q) \vee (Q \Rightarrow P)
Contradiction
  • A contradiction is a statement that is always FALSE. All rows of the truth table evaluate to FF.
  • Example: P∧∼PP \wedge \sim P