Jaysen Tsao
Discrete Mathematics for Computer Science

Propositional Logic

The system of propositional logic allows us to express statements mathematically and reason about their truth values.

Language of Propositional Logic

We must first define the syntax we will use to express propositions in propositional logic.

A proposition, in fact, is defined as follows:

Definition 1: Proposition

A proposition is a statement that can be true or false.

Terminology: Synonyms for Proposition

Mathematical papers often use the following terms to more concisely refer to propositions:

  • A theorem is a significant proposition that has been proven to be true.
  • A lemma is a proposition used to progress towards proving a larger theorem.
  • A corollary is a proposition that follows directly from a previously proven theorem.
  • A proposition, in general, is a statement that can be proven true or false.

“True” and “False” are the two truth values that propositions can take on.

Propositional Variables

Propositional variables are used to abstract propositions into a symbolic form. Since we are interested in the syntax used to express propositions, we cannot associate a propositional variable with a specific proposition. Instead, we treat propositional variables as placeholders that can represent any proposition.

Definition 2: Propositional Variable

A propositional variable 𝑝 is a variable that can potentially take on a truth value. That is, 𝑝 can be assigned either true or false.

Remark

Note that a propositional variable 𝑝 itself is not “either true or false” directly. Rather it is merely “possible” to assign 𝑝 a truth value of either true or false, and we manipulate 𝑝 as if we don’t know which truth value it has been assigned.

Example.
The assertion that 𝑥 is a square can be assigned a propositional variable 𝑝, since it would hold that 𝑝 is true if 𝑥 is a square, and false otherwise.

Notation: Truth Values

We can denote the truth values as  𝖳  for true and  𝖥  for false.

Complex Propositions

Although propositional variables can abstract individual propositions, we can express more complex propositions by combining propositional variables using logical connectives.

Definition 3: Logical Connective

A logical connective is an operator that takes one or more propositions as input and produces a new proposition as output.

Definition 4: Atomic and Compound Propositions

An compound proposition is a proposition that can be formed by combining one or more propositions using logical connectives. A proposition that is not compound is called an atomic proposition.

Resource 1: Semantics of the Standard Logical Connectives

If 𝑃 and 𝑄 are propositions, then the following are common logical connectives:

  • ¬𝑃, called the negation of 𝑃, read “not 𝑃.”
  • 𝑃𝑄, called the conjunction of 𝑃 and 𝑄, read “𝑃 and 𝑄.”
  • 𝑃𝑄, called the disjunction of 𝑃 and 𝑄, read “𝑃 or 𝑄.”
  • 𝑃𝑄, called the implication from 𝑃 to 𝑄, read “if 𝑃 then 𝑄 or 𝑃 implies 𝑄.”
  • 𝑃𝑄, called the biconditional between 𝑃 and 𝑄, read 𝑃 if and only if 𝑄.”

The above connectives are listed in order of binding precedence. Also, the implication operator is right-associative, while the other binary connectives are left-associative.

Example.
The compound proposition 𝑝𝑞𝑟 unambigously denotes (𝑝𝑞)𝑟 since binds more tightly than .
Example.
The compound proposition 𝑝𝑞𝑟 unambiguously denotes 𝑝(𝑞𝑟) since is right-associative.

Terminology: Tautology and Contradiction

A proposition is a tautology, denoted 𝐭 or , if it is assumed to be true under all circumstances. A proposition is a contradiction, denoted 𝐜 or , if it is assumed to be false under all circumstances.

Well-Formed Propositional Formulae

Formally, we can define the syntax of compound propositions using the notion of propositional formulae. A propositional formula is an abstract syntactic object that represents a proposition. Propositional formulae are built from propositional variables and logical connectives according to the following rules:

Definition 5: Well-Formed Propositional Formula

Let Φ a set of propositional variables, and let Ψ be a set of logical connectives over Φ. The set of well-formed propositional formulae over Ψ, denoted 𝒲(Φ,Ψ), is the smallest set such that the following rules hold:

  1. Trivial Formulae. 𝐭𝒲(Φ,Ψ) and 𝐜𝒲(Φ,Ψ).
  2. Atomic Formulae. If 𝑝Φ, then 𝑝𝒲(Φ,Ψ).
  3. Unary Connectives. For all 𝑃𝒲(Φ,Ψ) and for all unary connectives Ψ, we have (𝑃)𝒲(Φ,Ψ).
  4. Binary Connectives. For all 𝑃,𝑄𝒲(Φ,Ψ) and for all binary connectives Ψ, we have (𝑃𝑄)𝒲(Φ,Ψ).

This definition of a well-formed propositional formula rigorously defines a syntax under which we can write compound propositions.

Example.
If Φ={,,} and Ψ={,} where is a unary connective and is a binary connective, then 𝒲(Φ,Ψ) would include formulae such as (), (), and (()). 𝒲(Φ,Ψ) would not include (), since there is no connective between and .

Proposition 1: Unique Readability of Propositional Formulae

Let 𝑃𝒲(Φ,Ψ). Then exactly one of the following holds:

  • 𝑃=𝐭 or 𝑃=𝐜.
  • 𝑃Φ.
  • !𝑄𝒲(Φ,Ψ) such that 𝑃=(𝑄) for some unary connective Ψ.
  • !𝑄,𝑅𝒲(Φ,Ψ) such that 𝑃=(𝑄𝑅) for some binary connective Ψ.

The definition of well-formed formulae is a bit abstract, so it would be useful to restrict it to the set of familiar connectives we want to eventually assign semantics to. Define a set of standard logical connectives Ψ that we will implicitly assume:

Definition 6: Standard Logical Connectives

Let ¬ be a unary connective, and let , , , and be binary connectives. Then the set of standard logical connectives is defined as Ψ={¬,,,,}.

Notation: Precendence and Associativity

When unambiguous, we will often omit parentheses in propositional formulae, relying on the standard binding precedence and associativity of the logical connectives to disambiguate:

  • Define the binding strength from tightest to loosest of the standard logical connectives as (¬,,,,).
  • Define (¬¬𝑃) to mean (¬(¬𝑃)).
  • Define (𝑃𝑄𝑅) to mean ((𝑃𝑄)𝑅) for the connectives , , and .
  • Define (𝑃𝑄𝑅) to mean (𝑃(𝑄𝑅)).

Notation

Unless specified, assume that the set of propositional formulae is defined under the standard logical connectives from Definition 6. Consequently, let 𝒲(Φ) denote the set of well-formed propositional formulae over Φ under the standard logical connectives.

Definition 7: Subformula

Let 𝑃𝒲(Φ,Ψ). A subformula of 𝑃 is any formula that appears as a part of 𝑃. Formally, the set of subformulae of 𝑃, denoted Sub(𝑃), is defined recursively as follows:

  1. If 𝑃=𝐭, 𝑃=𝐜, or 𝑃Φ, then Sub(𝑃)={𝑃}.
  2. If 𝑃=(𝑄) for some unary connective Ψ, then Sub(𝑃)={𝑃}Sub(𝑄).
  3. If 𝑃=(𝑄𝑅) for some binary connective Ψ, then Sub(𝑃)={𝑃}Sub(𝑄)Sub(𝑅).
Example.
Sub(𝑝(𝑞𝑟))={𝑝,𝑞,𝑟,𝑞𝑟,𝑝(𝑞𝑟)}.

Definition 8: Complexity and Depth of a Propositional Formula

The complexity of a propositional formula 𝑃, denoted complexity(𝑃), is the total number of logical connectives in 𝑃. Formally, if 𝑃𝒲(Φ,Ψ), then:

{complexity(𝑝)=0 if 𝑝=𝐭 or 𝑝=𝐜 or 𝑝Φcomplexity(𝑃)=1+complexity(𝑃) if 𝑃𝒲(Φ,Ψ) and Ψcomplexity(𝑃𝑄)=1+complexity(𝑃)+complexity(𝑄) if 𝑃,𝑄𝒲(Φ,Ψ) and Ψ

The depth of a propositional formula 𝑃, denoted depth(𝑃), is the length of the longest path from the root of 𝑃 to any leaf in the parse tree of 𝑃. Formally, if 𝑃𝒲(Φ,Ψ), then:

{depth(𝑝)=0 if 𝑝=𝐭 or 𝑝=𝐜 or 𝑝Φdepth(𝑃)=1+depth(𝑃) if 𝑃𝒲(Φ,Ψ) and Ψdepth(𝑃𝑄)=1+max(depth(𝑃),depth(𝑄)) if 𝑃,𝑄𝒲(Φ,Ψ) and Ψ
Example.
Let 𝑃=𝑝(𝑞𝑟). Then complexity(𝑃)=2 since there are two logical connectives in 𝑃, and depth(𝑃)=2.

Truth Assignments and Semantics

While propositional formulae are syntactic objects, we can assign them meaning by defining truth assignments that specify the truth value of each propositional variable.

Definition 9: Truth Assignment

A truth assignment 𝜎 over a set of propositional variables Φ is a function that assigns a truth value to each propositional variable in Φ (and by extension, to all propositional formulae over Φ).

Formally, a truth assignment 𝜎 over Φ is a function that satisfies:

𝜎:𝒲(Φ){ 𝖳 , 𝖥 }.

where 𝒲(Φ) denotes the set of all propositional formulae over Φ.

Example.
By saying 𝜎(𝑝)= 𝖳 , we are asserting that the propositional variable 𝑝 is true under the truth assignment 𝜎.
Example.

Let Φ={𝑝,𝑞} be a set of propositional variables. Then a truth assignment 𝜎 over Φ could be defined as follows:

𝜎(𝑝)= 𝖳 ,𝜎(𝑞)= 𝖥 ,𝜎(𝑝𝑞)= 𝖥 ,𝜎(𝑝𝑞)= 𝖳 ,

Another truth assignment over Φ, say 𝜉, could be defined differently as:

𝜉(𝑝)= 𝖥 ,𝜉(𝑞)= 𝖥 ,𝜉(𝑝𝑞)= 𝖥 ,𝜉(𝑝𝑞)= 𝖥 ,

There are many possible truth assignments over a set of propositional variables. Specifically, if Φ is a set of 𝑛 propositional variables, then there are 2𝑛 possible truth assignments over Φ, since each propositional variable can be assigned one of two values ( 𝖳  or  𝖥 ) independently.

Corollary 1: Number of Truth Assignments

Let Φ be a set of 𝑛 propositional variables. Then there are 2𝑛 possible truth assignments over Φ.

Definition 10: Satisfaction of Propositional Formulae

A propositional formula 𝑃 is satisfied under a truth assignment 𝜎, denoted 𝜎𝑃, if 𝜎(𝑃)= 𝖳 . Otherwise, if 𝜎(𝑃)= 𝖥 , we say that 𝑃 is not satisfied under 𝜎, denoted 𝜎𝑃.

Terminology: Satisfiability of Propositional Formulae

A propositional formula 𝑃 is satisfiable if there exists a truth assignment 𝜎 such that 𝜎𝑃. Otherwise, 𝑃 is unsatisfiable.

We can now rigorously define tautologies and contradictions in terms of truth assignments:

Definition 11: Tautology and Contradiction

Let Φ be a set of propositional variables. A propositional formula 𝑃 over Φ is a tautology if 𝜎𝑃 for all truth assignments 𝜎 over Φ.

On the other hand, a propositional formula 𝑃 is a contradiction if 𝜎𝑃 for all truth assignments 𝜎 over Φ.

Boolean Functions and Truth Tables

Definition 12: Boolean Parameterization

The Boolean parameterization 𝑓:{ 𝖳 , 𝖥 }𝑛{ 𝖳 , 𝖥 } of a propositional formula 𝑃 over the variables Φ={𝑝1,𝑝2,,𝑝𝑛} is the Boolean function defined by:

𝑓(𝜎(𝑝1),𝜎(𝑝2),,𝜎(𝑝𝑛))=𝜎(𝑃) for all truth assignments 𝜎 over Φ.
Example.

Let 𝑃=𝑝1¬𝑝2 be a propositional formula over the variables Φ={𝑝1,𝑝2}. Then the Boolean parameterization of 𝑃 is the function 𝑓:{ 𝖳 , 𝖥 }2{ 𝖳 , 𝖥 } defined by:

𝑓( 𝖳 , 𝖳 )= 𝖥 ,𝑓( 𝖳 , 𝖥 )= 𝖳 ,𝑓( 𝖥 , 𝖳 )= 𝖥 ,𝑓( 𝖥 , 𝖥 )= 𝖥 .

Definition 13: Truth Table

The truth table of a propositional formula 𝑃 over the variables Φ={𝑝1,𝑝2,,𝑝𝑛} is a tabular representation of all possible truth assignments. Specifically, each row corresponds to a possible truth assignment over Φ, and the last column gives the truth value of 𝑃 under that assignment:

𝑝1 𝑝2 𝑝𝑛 𝑃
𝜎1(𝑝1) 𝜎1(𝑝2) 𝜎1(𝑝𝑛) 𝜎1(𝑃)
𝜎2(𝑝1) 𝜎2(𝑝2) 𝜎2(𝑝𝑛) 𝜎2(𝑃)
𝜎𝑚(𝑝1) 𝜎𝑚(𝑝2) 𝜎𝑚(𝑝𝑛) 𝜎𝑚(𝑃)

Where 𝜎1,𝜎2,,𝜎𝑚 are the 2𝑛 possible truth assignments over Φ. Auxiliary columns of the truth table may be added to show the truth values of subformulae of 𝑃 under each truth assignment.

Example.

A truth table for the propositional formula (𝑝𝑞)𝑝 is:

𝑝𝑞𝑝𝑞(𝑝𝑞)𝑝
 𝖳  𝖳  𝖳  𝖳 
 𝖳  𝖥  𝖥  𝖳 
 𝖥  𝖳  𝖳  𝖥 
 𝖥  𝖥  𝖳  𝖥 

Notice that all rows have the same truth value in the 𝑝 and (𝑝𝑞)𝑝 columns. In other words, 𝑝 and (𝑝𝑞)𝑝 have the same truth value under every possible truth assignment, so 𝑝(𝑝𝑞)𝑝.

Property

Let 𝑃 be the propositional formula corresponding to a column of a truth table. 𝑃 is a tautology iff all entries in the column are  𝖳 , and 𝑃 is a contradiction iff all entries in the column are  𝖥 . 𝑃 is satisfiable iff at least one entry in the column is  𝖳 .

Semantics of Logical Connectives

Until now, logical connectives like ¬, , and have been treated as syntactic objects that can be used to build propositional formulae, but they have not been given any meaning. Under a truth assignment, we can properly define the semantics of the logical connectives.

Definition 14: Negation

Under a truth assignment 𝜎, the negation of a propositional formula 𝑃, denoted ¬𝑃 and read “not 𝑃”, is defined by:

𝜎(¬𝑃)={ 𝖳  if 𝜎𝑃 𝖥  otherwise

Definition 15: Conjunction

Under a truth assignment 𝜎, the conjunction of two propositional formulae 𝑃 and 𝑄, denoted 𝑃𝑄 and read “𝑃 and 𝑄”, is defined by:

𝜎(𝑃𝑄)={𝜎(𝑄) if 𝜎𝑃 𝖥  otherwise

Definition 16: Disjunction

The disjunction of two propositional formulae 𝑃 and 𝑄, denoted 𝑃𝑄 and read “𝑃 or 𝑄”, is defined by:

𝜎(𝑃𝑄)={𝜎(𝑄) if 𝜎𝑃 𝖳  otherwise

Definition 17: Implication

The implication from a propositional formula 𝑃 to a propositional formula 𝑄, denoted 𝑃𝑄 and read “if 𝑃 then 𝑄”, is defined by:

𝜎(𝑃𝑄)={ 𝖳  if 𝜎𝑃𝜎(𝑄) otherwise

When 𝜎(𝑃)= 𝖥 , the implication 𝑃𝑄 is true regardless of the truth value of 𝑄, in which case we say that 𝑃𝑄 is vacuously true.

Definition 18: Biconditional

The biconditional between two propositional formulae 𝑃 and 𝑄, denoted 𝑃𝑄 and read 𝑃 if and only if 𝑄”, is defined by:

𝜎(𝑃𝑄)={ 𝖳  if 𝜎(𝑃)=𝜎(𝑄) 𝖥  otherwise

Logical Equivalences

Definition 19: Logical Equivalence

Two propositional formulae 𝑃 and 𝑄 are logically equivalent, denoted 𝑃𝑄, iff 𝑃 and 𝑄 have the same truth value under every possible truth assignment. That is,

𝑃𝑄 iff 𝜎(𝑃)=𝜎(𝑄) for all possible truth assignments 𝜎.

Corollary 2: Logical Equivalence as a Biconditional

Let 𝑃 and 𝑄 be propositional formulae. Then 𝑃𝑄 iff 𝑃𝑄 is a tautology.

Property

Let 𝑃 and 𝑄 be propositional formulae corresponding to columns of a truth table. 𝑃𝑄 iff the entries in the 𝑃 and 𝑄 columns are the same for every row.

Definition 20: Propositional Axioms

For all propositional formulae 𝑃, 𝑄, and 𝑅, the following laws hold:

  1. Associativity.

    𝑃(𝑄𝑅)(𝑃𝑄)𝑅 and 𝑃(𝑄𝑅)(𝑃𝑄)𝑅.
  2. Commutativity.

    𝑃𝑄𝑄𝑃 and 𝑃𝑄𝑄𝑃.
  3. Distributivity.

    𝑃(𝑄𝑅)(𝑃𝑄)(𝑃𝑅) and 𝑃(𝑄𝑅)(𝑃𝑄)(𝑃𝑅).
  4. Identity.

    𝑃𝐜𝑃 and 𝑃𝐭𝑃.
  5. Existence of Complements.

    𝑃¬𝑃𝐭 and 𝑃¬𝑃𝐜.

To simplify propositional formulae, we can use logical equivalences to rewrite them in simpler forms.

Theorem 1: Double Negation Law

For all propositional formulae 𝑃, it holds that ¬¬𝑃𝑃.

Proof: Double Negation Law.
Suppose 𝑃 is a propositional formula. Then:

Theorem 2: De Morgan’s Laws

For all propositional formulae 𝑃 and 𝑄, the following equivalences hold:

¬(𝑃𝑄)¬𝑃¬𝑄 and ¬(𝑃𝑄)¬𝑃¬𝑄.

Resource 2: Logical Equivalences

Name Equivalence
Axioms Commutativity over 𝑃𝑄𝑄𝑃
Commutativity over 𝑃𝑄𝑄𝑃
Associativity over 𝑃(𝑄𝑅)(𝑃𝑄)𝑅
Associativity over 𝑃(𝑄𝑅)(𝑃𝑄)𝑅
Distributivity of over 𝑃(𝑄𝑅)(𝑃𝑄)(𝑃𝑅)
Distributivity of over 𝑃(𝑄𝑅)(𝑃𝑄)(𝑃𝑅)
Identity for 𝑃𝐭𝑃
Identity for 𝑃𝐜𝑃
Equivalences over ¬,, Law of Excluded Middle 𝑃¬𝑃𝐭
Law of Non-Contradiction 𝑃¬𝑃𝐜
Domination of 𝑃𝐭𝐭
Domination of 𝑃𝐜𝐜
Double Negation ¬¬𝑃𝑃
De Morgan’s Law over ¬(𝑃𝑄)¬𝑃¬𝑄
De Morgan’s Law over ¬(𝑃𝑄)¬𝑃¬𝑄
Absorption Law over 𝑃(𝑃𝑄)𝑃
Absorption Law over 𝑃(𝑃𝑄)𝑃
Idempotency of 𝑃𝑃𝑃
Idempotency of 𝑃𝑃𝑃
Implication Equivalences Material Implication 𝑃𝑄¬𝑃𝑄
Contraposition of 𝑃𝑄¬𝑄¬𝑃
Exportation of (𝑃𝑄)𝑅𝑃(𝑄𝑅)
Elimination using 𝑃𝑄¬𝑃𝑄
Biconditional Equivalences Definition of Biconditional 𝑃𝑄(𝑃𝑄)(¬𝑃¬𝑄)
Material Biconditional 𝑃𝑄(𝑃𝑄)(𝑄𝑃)
Contraposition of 𝑃𝑄¬𝑃¬𝑄
Exportation of (𝑃𝑄)𝑅𝑃(𝑄𝑅)
Negation of Biconditional ¬(𝑃𝑄)𝑃¬𝑄

Normal Forms

Definition 21: Literal

A literal over a set of propositional variables Φ is either a propositional variable 𝑝Φ or the negation of a propositional variable ¬𝑝 for some 𝑝Φ.

Definition 22: Negation Normal Form

A propositional formula is in negation normal form (NNF) if the negation operator ¬ only applies to propositional variables, and the only logical connectives are conjunctions and disjunctions.

Definition 23: Disjunctive Normal Form

A propositional formula is in disjunctive normal form (DNF) if it is a disjunction of conjunctions of literals.

Definition 24: Conjunctive Normal Form

A propositional formula is in conjunctive normal form (CNF) if it is a conjunction of disjunctions of literals.

Theorem 3: Existence of Normal Forms

For all propositional formulae 𝑃, there exist propositional formulae in NNF, DNF, and CNF that are logically equivalent to 𝑃.

Proposition 2: Length Complexity of Normal Forms

The number of symbols needed to express a propositional formula 𝑃 in CNF or DNF has a length complexity of 𝒪(2𝑛), where 𝑛 is the number of propositional variables in 𝑃.

Counting Formulae

Functional Completeness

Definition 25: Functionally Complete Set of Connectives

A set of logical connectives Ψ1 over Φ is functionally complete over Ψ2 iff for every propositional formula 𝑃𝒲(Φ,Ψ2), there exists a propositional formula 𝑄𝒲(Φ,Ψ1) such that 𝑃𝑄.

Theorem 4: Alternative Characterization of Functional Completeness

A set of logical connectives Ψ over a set Φ={𝑝1,𝑝2,,𝑝𝑛} iff for every truth assignment 𝜎 over Φ

Theorem 5: Functional Completeness over Standard Logical Connectives

Each of {¬,}, {¬,}, and {¬,} is functionally complete over the set of standard logical connectives.

Definition 26: Sheffer Stroke and Peirce’s Arrow

The Sheffer stroke (also called the NAND operator) is a binary connective denoted by and defined by 𝑃𝑄¬(𝑃𝑄). Peirce’s arrow (also called the NOR operator) is a binary connective denoted by and defined by 𝑃𝑄¬(𝑃𝑄).

Theorem 6: Functional Completeness of Sheffer Stroke and Peirce’s Arrow

Each of {,} is functionally complete over the set of standard logical connectives.

Resolution

Exercises

Exercise 1.
Compute the truth table for the proposition (𝑝𝑞)(¬𝑞¬𝑝).
Exercise 2.
Convert ¬(𝑝(𝑞¬𝑟)) to NNF, DNF, and CNF.
Exercise 3.
Show that (𝑝𝑞)𝑟(𝑝𝑟)(𝑞𝑟).
Exercise 4.
Show that (𝑝𝑞𝑟)(𝑝𝑞)𝑝𝑟 is a tautology.
Exercise 5.
Show that {} is not functionally complete over the set of standard logical connectives.
Exercise 6.