Propositional Logic

CSC 447 - Artificial Intelligence I

Propositions

  • A proposition is a declarative sentence that is either true or false

Propositional Variables

  • A propositional variable (p, q, r, s, ...) is a mathematical variable representing a proposition

  • The value of a propositional variable is true, denoted by T, or false, denoted by F

Compound Propositions

  • A compound proposition is a proposition constructed by combining propositions with logical operators

  • Logical operators:

    • \(\neg\): Negation

    • \(\vee\): Disjunction

    • \(\wedge\): Conjunction

    • \(\oplus\): Exclusive Or

    • \(\rightarrow\): Conditional

    • \(\leftrightarrow\): Biconditional

Truth Tables

  • A truth table is used to summarize some or all of the possible values of one or more propositions in conjunction with any number of logical operations on those propositions.

Negation

  • The negation of a proposition \(p\) is denoted by \(\neg p\) and has the following truth table:

    \(p\) \(\neg p\)
    T F
    F T

Conjunction

  • The conjunction of a propositions \(p\) and \(q\) is denoted by \(p \wedge q\) and has the following truth table:

    \(p\) \(q\) \(p \wedge q\)
    T T T
    T F F
    F T F
    F F F

Disjunction

  • The disjunction of propositions \(p\) and \(q\) is denoted by \(p \vee q\) and has the following truth table:

    \(p\) \(q\) \(p \vee q\)
    T T T
    T F T
    F T T
    F F F

Exclusive Or

  • The exclusive or of propositions \(p\) and \(q\) is denoted by \(p \oplus q\) and has the following truth table:

    \(p\) \(q\) \(p \oplus q\)
    T T F
    T F T
    F T T
    F F F

Implication

  • The conditional statement or implication of propositions \(p\) and \(q\) is denoted by \(p \rightarrow q\) and has the following truth table:

    \(p\) \(q\) \(p \rightarrow q\)
    T T T
    T F F
    F T T
    F F T
  • \(p \rightarrow q\) is read “If \(p\) then \(q\)

  • In \(p \rightarrow q\), \(p\) is the hypothesis (antecedent or premise) and \(q\) is the conclusion (or consequence)

Converse, Contrapositive, and Inverse

  • From \(p \rightarrow q\) we can form new conditional statements

    • \(q \rightarrow p\) is the converse of \(p \rightarrow q\)

    • \(\neg q \rightarrow \neg p\) is the contrapositive of \(p \rightarrow q\)

    • \(\neg p \rightarrow \neg q\) is the inverse of \(p \rightarrow q\)

Biconditional

  • The biconditional of propositions \(p\) and \(q\) is denoted by \(p \leftrightarrow q\) and has the following truth table:

    \(p\) \(q\) \(p \leftrightarrow q\)
    T T T
    T F F
    F T F
    F F T
  • \(p \leftrightarrow q\) is read “\(p\) if and only if \(q\)

Truth Tables for Compound Propositions

  • Truth table construction:

    • We need a row for every possible combination of truth values for the atomic propositions

    • We need a column for the compound proposition

    • We need a column for each subexpression (including the atomic propositions)

Equivalent Propositions

  • Two propositions are equivalent if they always have the same truth value

  • Example: the conditional is equivalent to the contrapositive

    \(p\) \(q\) \(\neg p\) \(\neg q\) \(p \rightarrow q\) \(\neg q \rightarrow \neg p\)
    T T F F T T
    T F F T F F
    F T T F T T
    F F T T T T

Precedence of Logical Operators

Operator Precedence
\(\neg\) 1
\(\wedge\) 2
\(\vee\) 3
\(\rightarrow\) 4
\(\leftrightarrow\) 5

Tautologies, Contradictions, and Contingencies

  • A tautology is a proposition that is always true

    • Example: \(p \vee \neg p\)
  • A contradiction is a proposition that is always false

    • Example: \(p \wedge \neg p\)
  • A contingency is a proposition that is neither a tautology nor a contradiction

Logic Equivalence

  • Two compound propositions \(p\) and \(q\) are logically equivalent if \(p \leftrightarrow q\) is a tautology

  • This is denoted as \(p \equiv q\)

  • Logical equivalence can be shown with a truth table; the compound propositions \(p\) and \(q\) are equivalent if and only if the columns in the truth table agree

De Morgan’s Laws

  • \(\neg (p \wedge q) \equiv \neg p \vee \neg q\)

  • \(\neg (p \vee q) \equiv \neg p \wedge \neg q\)

  • Truth table for second law:

    \(p\) \(q\) \(\neg p\) \(\neg q\) \(p \vee q\) \(\neg (p \vee q)\) \(\neg p \wedge \neg q\)
    T T F F T F F
    T F F T T F F
    F T T F T F F
    F F T T F T T

Key Logical Equivalences

Identity Laws: \(p \wedge T \equiv p, \quad p \vee F \equiv p\)
Domination Laws: \(p \vee T \equiv T, \quad p \wedge F \equiv F\)
Idempotent Laws: \(p \vee p \equiv p, \quad p \wedge p \equiv p\)
Double Negation Law: \(\neg (\neg p) \equiv p\)
Negation Laws: \(p \vee \neg p \equiv T, \quad p \wedge \neg p \equiv F\)
Commutative Laws: \(p \vee q \equiv q \vee p, \quad p \wedge q \equiv q \wedge p\)
Associative Laws: \((p \wedge q) \wedge r \equiv p \wedge (q \wedge r)\)
\((p \vee q) \vee r \equiv p \vee (q \vee r)\)
Distributive Laws: \((p \vee (q \wedge r)) \equiv (p \vee q) \wedge (p \vee r)\)
\((p \wedge (q \vee r)) \equiv (p \wedge q) \vee (p \wedge r)\)
Absorption Laws: \(p \vee (p \wedge q) \equiv p\)
\(p \wedge (p \vee q) \equiv p\)

Logical Equivalences Involving Conditional Statements

  • \(p \rightarrow q \equiv \neg p \vee q\)

  • \(p \rightarrow q \equiv \neg q \rightarrow \neg p\)

  • \(p \vee q \equiv \neg p \rightarrow q\)

  • \(p \wedge q \equiv \neg (p \rightarrow \neg q)\)

  • \(\neg (p \rightarrow q) \equiv p \wedge \neg q\)

  • \((p \rightarrow q) \wedge (p \rightarrow r) \equiv p \rightarrow (q \wedge r)\)

  • \((p \rightarrow r) \wedge (q \rightarrow r) \equiv (p \vee q) \rightarrow r\)

  • \((p \rightarrow q) \vee (p \rightarrow r) \equiv p \rightarrow (q \vee r)\)

  • \((p \rightarrow r) \vee (q \rightarrow r) \equiv (p \wedge q) \rightarrow r\)

Equivalence Proofs

  • A compound proposition can be replaced by a logically equivalent compound proposition without changing its truth value

  • We can show that two propositions are logically equivalent by developing a series of logically equivalent statements

  • To prove that \(A \equiv B\), we can develop a series of equivalences beginning with \(A\) and ending with \(B\):

    \[\begin{array}{lll} A & \equiv & A_1 \\ & \equiv & A_2 \\ & \vdots & \\ & \equiv & B \\ \end{array} \]

Equivalence Proof Example

Show that \(\neg (p \vee (\neg p \wedge q))\) is logically equivalent to \(\neg p \wedge \neg q\)

\[\begin{array}{llll} \neg (p \vee (\neg p \wedge q)) & \equiv & \neg p \wedge \neg( \neg p \wedge q) & \text{by De Morgan's law} \\ & \equiv & \neg p \wedge (\neg(\neg p) \vee \neg q) & \text{by De Morgan's law} \\ & \equiv & \neg p \wedge (p \vee \neg q) & \text{by the double negation law} \\ & \equiv & (\neg p \wedge p) \vee (\neg p \wedge \neg q) & \text{by the distributive law} \\ & \equiv & F \vee(\neg p \wedge \neg q) & \text{by the negation law} \\ & \equiv & (\neg p \wedge \neg q) \vee F & \text{by the commutative law} \\ & \equiv & (\neg p \wedge \neg q) & \text{by the identity law} \\ \end{array}\]

Equivalence Proof Example

Show that \((p \wedge q) \rightarrow (p \vee q)\) is a tautology

\[\begin{array}{llll} (p \wedge q) \rightarrow (p \vee q) & \equiv & \neg(p \wedge q) \vee (p \vee q) & \text{by} p \rightarrow q \equiv \neg p \vee q \\ & \equiv & (\neg p \vee \neg q) \vee (p \vee q) & \text{by De Morgan's law} \\ & \equiv & (\neg p \vee p) \vee (\neg q \vee q) & \text{by the associative and} \\ & \vdots & & \text{commutative laws} \\ & \equiv & T \vee T & \text{by the negation law} \\ & \equiv & T & \text{by the domination law} \\ \end{array}\]