Discrete Mathematics: Propositional Logic and Applications

Fundamentals of Propositional Logic

  • Definition of a Proposition:

    • A proposition is a declarative sentence that is either true (TT) or false (FF), but not both simultaneously.

    • The truth value of a proposition is denoted by TT if it is a true statement and by FF if it is a false statement.

  • Examples of Declarative Sentences that are Propositions:

    • "The Moon is made of green cheese." (A false proposition; truth value is FF)

    • "Trenton is the capital of New Jersey." (A true proposition; truth value is TT)

    • "Toronto is the capital of Canada." (A false proposition; truth value is FF, as Ottawa is the capital)

    • "1+0=11 + 0 = 1" (A true mathematical proposition; truth value is TT)

    • "0+0=20 + 0 = 2" (A false mathematical proposition; truth value is FF)

  • Examples of Sentences that are NOT Propositions:

    • "Sit down!" (An imperative sentence/command; does not assert a fact and cannot be assigned a truth value)

    • "What time is it?" (An interrogative sentence/question; neither true nor false)

    • "x+1=2x + 1 = 2" (An open statement containing a variable; its truth or falsehood cannot be established without a specific value assigned to xx)

    • "x+y=zx + y = z" (An open statement containing multiple variables; not a proposition without specific value bindings or universal/existential quantifiers)

  • Constructing Propositions and Variable Conventions:

    • Propositional Variables: Conventional lowercase letters such as pp, qq, rr, ss, and so on, are utilized to represent propositional variables.

    • Constant Truth Values:

    • The proposition that is always true is denoted by TT.

    • The proposition that is always false is denoted by FF.

Logical Operators and Compound Propositions

  • Compound Propositions:

    • Compound propositions are constructed by combining one or more existing propositions using logical operators (also called logical connectives).

    • Fundamental connectives include:

    • Negation: denoted by ¬\neg

    • Conjunction: denoted by ∧\wedge

    • Disjunction: denoted by ∨\vee

    • Exclusive Or: denoted by ⊕\oplus

    • Implication (Conditional): denoted by →\rightarrow

    • Biconditional: denoted by ↔\leftrightarrow

  • Negation (¬p\neg p):

    • The negation of a proposition pp is denoted by ¬p\neg p and is read as "not pp" or "It is not the case that pp".

    • The truth value of ¬p\neg p is the opposite of the truth value of pp.

    • Example:

    • Let pp be "The earth is round."

    • Then ¬p\neg p is "It is not the case that the earth is round," or simply "The earth is not round."

    • Truth Table for Negation:

Truth table for negation
* When pp is TT, ¬p\neg p is FF.
* When pp is FF, ¬p\neg p is TT.
  • Conjunction (p∧qp \wedge q):

    • The conjunction of propositions pp and qq is denoted by p∧qp \wedge q and is read as "pp and qq".

    • The conjunction p∧qp \wedge q is true when both pp and qq are true; otherwise, it evaluates to false.

    • Example:

    • Let pp be "I am at home."

    • Let qq be "It is raining."

    • Then p∧qp \wedge q is "I am at home and it is raining."

    • Truth Table for Conjunction:

Truth table for conjunction
* p=Tp = T, q=T  ⟹  p∧q=Tq = T \implies p \wedge q = T
* p=Tp = T, q=F  ⟹  p∧q=Fq = F \implies p \wedge q = F
* p=Fp = F, q=T  ⟹  p∧q=Fq = T \implies p \wedge q = F
* p=Fp = F, q=F  ⟹  p∧q=Fq = F \implies p \wedge q = F
  • Disjunction (p∨qp \vee q):

    • The disjunction (also known as inclusive or) of propositions pp and qq is denoted by p∨qp \vee q and is read as "pp or qq".

    • The disjunction p∨qp \vee q is false when both pp and qq are false; otherwise, it evaluates to true.

    • Example:

    • Let pp be "I am at home."

    • Let qq be "It is raining."

    • Then p∨qp \vee q is "I am at home or it is raining."

    • Truth Table for Disjunction:

Truth table for disjunction
* p=Tp = T, q=T  ⟹  p∨q=Tq = T \implies p \vee q = T
* p=Tp = T, q=F  ⟹  p∨q=Tq = F \implies p \vee q = T
* p=Fp = F, q=T  ⟹  p∨q=Tq = T \implies p \vee q = T
* p=Fp = F, q=F  ⟹  p∨q=Fq = F \implies p \vee q = F
  • Exclusive Or (p⊕qp \oplus q):

    • The exclusive or (XOR) of propositions pp and qq is denoted by p⊕qp \oplus q.

    • The proposition p⊕qp \oplus q evaluates to true when exactly one of pp and qq is true, but not both.

    • Real-World Metaphor/Example:

    • "Soup or salad comes with this entrée." In standard dining context, a diner is entitled to choose soup or salad, but does not receive both soup and salad simultaneously.

    • Truth Table for Exclusive Or:

Truth table for exclusive or
* p=Tp = T, q=T  ⟹  p⊕q=Fq = T \implies p \oplus q = F
* p=Tp = T, q=F  ⟹  p⊕q=Tq = F \implies p \oplus q = T
* p=Fp = F, q=T  ⟹  p⊕q=Tq = T \implies p \oplus q = T
* p=Fp = F, q=F  ⟹  p⊕q=Fq = F \implies p \oplus q = F

Conditional Statements (Implications)

  • Definition and Structure:

    • If pp and qq are propositions, the conditional statement (or implication) is denoted by p→qp \rightarrow q and read as "if pp, then qq".

    • In the expression p→qp \rightarrow q:

    • pp is referred to as the hypothesis, antecedent, or premise.

    • qq is referred to as the conclusion or consequence.

    • Example:

    • Let pp be "I am at home."

    • Let qq be "It is raining."

    • The statement p→qp \rightarrow q denotes "If I am at home then it is raining."

  • Truth Table for Implication:

Truth table for implication
  • p=Tp = T, q=T  ⟹  p→q=Tq = T \implies p \rightarrow q = T

  • p=Tp = T, q=F  ⟹  p→q=Fq = F \implies p \rightarrow q = F

  • p=Fp = F, q=T  ⟹  p→q=Tq = T \implies p \rightarrow q = T

  • p=Fp = F, q=F  ⟹  p→q=Tq = F \implies p \rightarrow q = T

  • An implication is false only in the single scenario where the hypothesis pp is true and the conclusion qq is false.

    • Understanding the Nature of Implication:

  • The logical meaning of p→qp \rightarrow q depends strictly upon the truth values of pp and qq.

  • There does not need to be any causal relationship, intrinsic connection, or subject-matter relevance between antecedent pp and consequent qq.

  • Illustrative Hypothetical Statements:

    • "If the moon is made of green cheese, then I have more money than Bill Gates." (Since the antecedent is false, the implication evaluates to true regardless of personal wealth)

    • "If 1+1=31 + 1 = 3, then your grandma wears combat boots." (Since the antecedent is mathematically false, the overall implication evaluates to true)

    • The Contractual/Obligation Perspective:

  • A practical method to conceptualize logical implication is via a conditional obligation, pledge, or contract:

    • Campaign Pledge: "If I am elected, then I will lower taxes."

      • If the politician is elected and lowers taxes (T→TT \rightarrow T), the pledge is kept (TT).

      • If the politician is elected and does not lower taxes (T→FT \rightarrow F), the pledge is broken (FF).

      • If the politician is not elected (p=Fp = F), the promise cannot be violated whether taxes are lowered or not (F→T=TF \rightarrow T = T, F→F=TF \rightarrow F = T).

    • Grading Pledge: "If you get 100% on the final, then you will get an A."

      • The promise is violated only if a student receives 100% on the final but fails to receive an A.

      • If the student scores below 100%, the professor has not broken the contract regardless of the letter grade assigned.

    • Alternative Linguistic Formulations of p→qp \rightarrow q:

  • "if pp, then qq"

  • "pp implies qq"

  • "if pp, qq"

  • "pp only if qq"

  • "qq unless ¬p\neg p"

  • "qq when pp"

  • "qq if pp"

  • "qq whenever pp"

  • "pp is sufficient for qq"

  • "qq follows from pp"

  • "qq is necessary for pp"

  • "qq is a necessary condition for pp"

  • "pp is a sufficient condition for qq"

    • Necessary Versus Sufficient Conditions:

  • Necessary Condition:

    • In a→ba \rightarrow b, bb is a necessary condition for aa.

    • This means: if not bb, then not aa (¬b→¬a\neg b \rightarrow \neg a), which is logically equivalent to: if aa, then bb.

    • Concrete Example: A necessary condition for getting an A in BBM205 is that a student completes all the assignments.

      • Equivalent formulation 1: If a student does not complete all the assignments, then he/she cannot get an A in BBM205.

      • Equivalent formulation 2 (Contrapositive): If a student gets an A in BBM205, then he/she completes all the assignments.

      • Completing all assignments is required, but may not guarantee an A by itself.

  • Sufficient Condition:

    • In a→ba \rightarrow b, aa is a sufficient condition for bb.

    • This means: if condition aa is satisfied, outcome bb is fully guaranteed.

    • Concrete Example: A sufficient condition for getting an A in BBM205 is that a student gets an A from every piece of graded work.

      • Formulation: If a student gets an A from every piece of graded work, then he/she gets an A in BBM205.

Converse, Contrapositive, Inverse, and Biconditional

  • Derived Conditional Statements:

    • Given an original conditional statement p→qp \rightarrow q:

    • Inverse: ¬p→¬q\neg p \rightarrow \neg q

    • Converse: q→pq \rightarrow p

    • Contrapositive: ¬q→¬p\neg q \rightarrow \neg p

  • Worked Translation Example:

    • Statement to analyze: "It raining is a sufficient condition for my not going to town."

    • Original Implication (p→qp \rightarrow q): "If it is raining, then I will not go to town."

    • Inverse (¬p→¬q\neg p \rightarrow \neg q): "If it is not raining, then I will go to town."

    • Converse (q→pq \rightarrow p): "If I do not go to town, then it is raining."

    • Contrapositive (¬q→¬p\neg q \rightarrow \neg p): "If I go to town, then it is not raining."

  • The Biconditional Statement (p↔qp \leftrightarrow q):

    • If pp and qq are propositions, the biconditional proposition p↔qp \leftrightarrow q is read as "pp if and only if qq" (commonly written as "pp iff qq").

    • The biconditional statement p↔qp \leftrightarrow q evaluates to true when pp and qq have identical truth values, and evaluates to false when they possess differing truth values.

    • Example:

    • Let pp be "I am at home."

    • Let qq be "It is raining."

    • Then p↔qp \leftrightarrow q represents "I am at home if and only if it is raining."

    • Alternative English expressions for p↔qp \leftrightarrow q:

    • "pp is necessary and sufficient for qq"

    • "if pp then qq, and conversely"

    • "pp iff qq"

    • Truth Table for Biconditional:

Truth table for biconditional
* p=Tp = T, q=T  ⟹  p↔q=Tq = T \implies p \leftrightarrow q = T
* p=Tp = T, q=F  ⟹  p↔q=Fq = F \implies p \leftrightarrow q = F
* p=Fp = F, q=T  ⟹  p↔q=Fq = T \implies p \leftrightarrow q = F
* p=Fp = F, q=F  ⟹  p↔q=Tq = F \implies p \leftrightarrow q = T

Truth Tables, Logical Equivalence, and Operator Precedence

  • Principles of Truth Table Construction:

    • Rows: A truth table requires a row for every possible combination of truth values of the atomic propositions. For nn propositional variables, exactly 2n2^n rows are required.

    • With nn propositional variables, exactly 2n2^n distinct truth assignments exist, allowing the construction of distinct (non-equivalent) propositions.

    • Columns:

    • A column for each basic atomic proposition.

    • Intermediate columns for the truth values of each subexpression that occurs in the compound proposition as it is built up.

    • A column for the complete compound proposition, typically positioned at the far right.

  • Comprehensive Construction Example: (p∨q)→¬r(p \vee q) \rightarrow \neg r:

    • For 33 variables (pp, qq, rr), the truth table requires 23=82^3 = 8 rows.

Truth table for compound proposition
  • Step-by-step row evaluations:

    • Row 1: p=T,q=T,r=T  ⟹  ¬r=F,p∨q=T  ⟹  (p∨q)→¬r=Fp = T, q = T, r = T \implies \neg r = F, p \vee q = T \implies (p \vee q) \rightarrow \neg r = F

    • Row 2: p=T,q=T,r=F  ⟹  ¬r=T,p∨q=T  ⟹  (p∨q)→¬r=Tp = T, q = T, r = F \implies \neg r = T, p \vee q = T \implies (p \vee q) \rightarrow \neg r = T

    • Row 3: p=T,q=F,r=T  ⟹  ¬r=F,p∨q=T  ⟹  (p∨q)→¬r=Fp = T, q = F, r = T \implies \neg r = F, p \vee q = T \implies (p \vee q) \rightarrow \neg r = F

    • Row 4: p=T,q=F,r=F  ⟹  ¬r=T,p∨q=T  ⟹  (p∨q)→¬r=Tp = T, q = F, r = F \implies \neg r = T, p \vee q = T \implies (p \vee q) \rightarrow \neg r = T

    • Row 5: p=F,q=T,r=T  ⟹  ¬r=F,p∨q=T  ⟹  (p∨q)→¬r=Fp = F, q = T, r = T \implies \neg r = F, p \vee q = T \implies (p \vee q) \rightarrow \neg r = F

    • Row 6: p=F,q=T,r=F  ⟹  ¬r=T,p∨q=T  ⟹  (p∨q)→¬r=Tp = F, q = T, r = F \implies \neg r = T, p \vee q = T \implies (p \vee q) \rightarrow \neg r = T

    • Row 7: p=F,q=F,r=T  ⟹  ¬r=F,p∨q=F  ⟹  (p∨q)→¬r=Tp = F, q = F, r = T \implies \neg r = F, p \vee q = F \implies (p \vee q) \rightarrow \neg r = T

    • Row 8: p=F,q=F,r=F  ⟹  ¬r=T,p∨q=F  ⟹  (p∨q)→¬r=Tp = F, q = F, r = F \implies \neg r = T, p \vee q = F \implies (p \vee q) \rightarrow \neg r = T

    • Operator Precedence:

  • To minimize the number of parentheses needed in complex expressions, logical operators are evaluated in order of strict precedence.

Precedence of logical operators
  • Order of precedence:

    1. ¬\neg (Precedence level 1; highest precedence)

    2. ∧\wedge (Precedence level 2)

    3. ∨\vee (Precedence level 3)

    4. →\rightarrow (Precedence level 4)

    5. ↔\leftrightarrow (Precedence level 5; lowest precedence)

  • Example Application: In the expression p∨q→¬rp \vee q \rightarrow \neg r, the disjunction p∨qp \vee q and negation ¬r\neg r have higher precedence than →\rightarrow, meaning the expression is interpreted as (p∨q)→¬r(p \vee q) \rightarrow \neg r.

  • If the intended logical operation is p∨(q→¬r)p \vee (q \rightarrow \neg r), parentheses must be explicitly provided.

    • Determining Logical Equivalence:

  • Two propositions are defined as logically equivalent if they exhibit identical truth values under every possible assignment of truth values to their variables.

  • Equivalence of Implication and Contrapositive:

Equivalence of implication and contrapositive
* When evaluating p→qp \rightarrow q versus ¬q→¬p\neg q \rightarrow \neg p across all assignments:
  * p=T,q=T  ⟹  ¬p=F,¬q=F  ⟹  p→q=Tp = T, q = T \implies \neg p = F, \neg q = F \implies p \rightarrow q = T and ¬q→¬p=T\neg q \rightarrow \neg p = T
  * p=T,q=F  ⟹  ¬p=F,¬q=T  ⟹  p→q=Fp = T, q = F \implies \neg p = F, \neg q = T \implies p \rightarrow q = F and ¬q→¬p=F\neg q \rightarrow \neg p = F
  * p=F,q=T  ⟹  ¬p=T,¬q=F  ⟹  p→q=Tp = F, q = T \implies \neg p = T, \neg q = F \implies p \rightarrow q = T and ¬q→¬p=T\neg q \rightarrow \neg p = T
  * p=F,q=F  ⟹  ¬p=T,¬q=T  ⟹  p→q=Tp = F, q = F \implies \neg p = T, \neg q = T \implies p \rightarrow q = T and ¬q→¬p=T\neg q \rightarrow \neg p = T
* Because the truth values of p→qp \rightarrow q and ¬q→¬p\neg q \rightarrow \neg p are identical in every single row, the conditional statement is logically equivalent to its contrapositive.
  • Demonstrating Non-Equivalence (Converse and Inverse):

Non-equivalence of converse and inverse to conditional
  • A truth table comparing p→qp \rightarrow q, the inverse ¬p→¬q\neg p \rightarrow \neg q, and the converse q→pq \rightarrow p shows:

    • For p=T,q=Fp = T, q = F: p→q=Fp \rightarrow q = F, whereas ¬p→¬q=T\neg p \rightarrow \neg q = T and q→p=Tq \rightarrow p = T.

    • For p=F,q=Tp = F, q = T: p→q=Tp \rightarrow q = T, whereas ¬p→¬q=F\neg p \rightarrow \neg q = F and q→p=Fq \rightarrow p = F.

  • Consequently, neither the converse nor the inverse is logically equivalent to the original conditional statement p→qp \rightarrow q.

  • Note that the converse and inverse are logically equivalent to each other, as each is the contrapositive of the other.

Applications of Propositional Logic

  • Overview of Application Areas:

    • Translating English sentences into formal logic

    • System specifications verification

    • Boolean searching

    • Logic puzzles

    • Logic circuits design

  • Translating English Sentences into Formal Propositions:

    • General procedure:

    1. Identify all atomic propositions within the sentence and assign propositional variables to each.

    2. Determine the appropriate logical connectives and respect grammatical grouping through parentheses.

    • Example 1:

    • Sentence: "If I go to Harry's or to the country, I will not go shopping."

    • Variable assignments:

      • Let pp represent "I go to Harry's."

      • Let qq represent "I go to the country."

      • Let rr represent "I will go shopping."

    • Structural breakdown: "If pp or qq then not rr."

    • Symbolic logic translation: (p∨q)→¬r(p \vee q) \rightarrow \neg r

    • Example 2:

    • Sentence: "You can access the Internet from campus only if you are a computer science major or you are not a freshman."

    • Variable assignments:

      • Let aa represent "You can access the Internet from campus."

      • Let cc represent "You are a computer science major."

      • Let ff represent "You are a freshman."

    • Structural breakdown: "aa only if (cc or not ff)"

    • Symbolic logic translation: a→(c∨¬f)a \rightarrow (c \vee \neg f)

  • System Specifications:

    • System and software engineers translate requirements expressed in natural language into formal, precise logical specifications to avoid ambiguity.

    • Example:

    • Requirement: "The automated reply cannot be sent when the file system is full."

    • Variable assignments:

      • Let pp represent "The automated reply can be sent."

      • Let qq represent "The file system is full."

    • The phrase "when the file system is full" identifies qq as the condition/premise.

    • Symbolic logic translation: q→¬pq \rightarrow \neg p

  • Consistent System Specifications:

    • Definition: A list of propositions is consistent if it is possible to assign truth values to the propositional variables such that every proposition in the specification is true simultaneously (i.e., a satisfying truth assignment exists).

    • Specification Analysis 1:

    • Statements:

      1. "The diagnostic message is stored in the buffer or it is retransmitted."

      2. "The diagnostic message is not stored in the buffer."

      3. "If the diagnostic message is stored in the buffer, then it is retransmitted."

    • Formalization:

      • Let pp represent "The diagnostic message is stored in the buffer."

      • Let qq represent "The diagnostic message is retransmitted."

      • The system of statements is: p∨qp \vee q, ¬p\neg p, p→qp \rightarrow q.

    • Evaluation:

      • To make ¬p\neg p true, pp must be assigned FF.

      • For p∨qp \vee q to be true with p=Fp = F, variable qq must be assigned TT.

      • Check p→qp \rightarrow q with p=Fp = F and q=Tq = T: F→T=TF \rightarrow T = T.

      • Under the assignment p=Fp = F and q=Tq = T, all three propositions evaluate to TT.

    • Result: The specification is consistent.

    • Specification Analysis 2 (Adding a fourth requirement):

    • Additional Statement: "The diagnostic message is not retransmitted."

    • Formalization: ¬q\neg q

    • The complete set of requirements becomes: p∨qp \vee q, ¬p\neg p, p→qp \rightarrow q, ¬q\neg q.

    • Evaluation:

      • Satisfying ¬p\neg p requires p=Fp = F.

      • Satisfying ¬q\neg q requires q=Fq = F.

      • Evaluating p∨qp \vee q under p=F,q=Fp = F, q = F gives F∨F=FF \vee F = F.

      • There exists no truth assignment that makes all specifications true simultaneously.

    • Result: The extended specification is not consistent.