# Lecture 36: Logic

• Logical formulas (inductive definition)
• Meta language versus object language
• Semantics:
• atoms, interpretations, $$eval$$, truth tables
• satisfiability, validity, entailment
• Reading: Pass and Tseng, 6.1

## Metalogic

In this section of the course, we will turn our attention to formal logic. Just as we reasoned about sets and functions in the first section of the course, or probability spaces, events, etc. in the next section, strings, machines, etc while talking about automata, in this section our objects of study will be logical formulae and proofs.

This can lead to some confusion, because in addition to being the objects of study, proofs and logic will also be our tools for studying them. We will be making claims about claims and proving things about proofs.

To keep this all straight, it helps to make a distinction between formulas and proofs as objects of study and claims and proofs about those objects. We will refer to the objects of study as the object language and the proofs and definitions we use to reason about the objects as the meta language.

## Propositional logic

Propositional formulas are built up from atoms $$P$$, $$Q$$, that we will treat as uninterpreted variables. The intent is that these variables represent statements like "it is raining" or "Socrates is a man" that might be true or false.

We can combine the formulas using the connectives $$∧$$, $$∨$$, $$→$$, and $$¬$$. We want to think of these as "and", "or", "not", and "implies" respectively, but at the outset, we will treat them as meaningless symbols. Thus, formulas are just elements of an inductively defined set:

$φ,ψ ∈ Formulae ::= P \mid φ∧ψ \mid φ∨ψ \mid φ → ψ \mid ¬φ \quad \text{where} \quad P ∈ Atoms$

## Semantics

To ascribe meaning to formulae, we inductively define function that explains how to interpret formulae. In order to do so, we need to know how to interpret the base propositions $$P$$, $$Q$$, $$R$$, etc.

An interpretation is a function $$I : Atoms → \{T,F\}$$. The evaluation of $$φ$$ in interpretation $$I$$ is given inductively by $$eval : Formulae \times Interpretation → \{T,F\}$$ by the rules

\begin{aligned} eval(P, I) &::= I(P) \\ eval(φ∧ψ, I) &::= \left\{\begin{array}{ll}T & \text{ if eval(φ,I) = T and eval(ψ,I) = T} \\ F & \text{ otherwise}\end{array}\right. \\ eval(φ∨ψ, I) &::= \left\{\begin{array}{ll}T & \text{ if eval(φ,I) = T or eval(ψ,I) = T} \\ F & \text{ otherwise}\end{array}\right. \\ eval(φ→ψ, I) &::= \left\{\begin{array}{ll}F & \text{ if eval(φ,I) = T and eval(ψ,I) = F} \\ T & \text{ otherwise}\end{array}\right. \\ eval(¬φ, I) &::= \left\{\begin{array}{ll}T & \text{ if eval(φ,I) = F} \\ F & \text{ otherwise}\end{array}\right. \\ \end{aligned}

This can be stated more concisely as follows: to evaluate a formula, first recursively/inductively evaluate its substructures, then look them up in the following table:

$$eval(φ,I)$$ $$eval(ψ,I)$$ $$P$$ $$φ∧ψ$$ $$φ∨ψ$$ $$φ→ψ$$ $$¬φ$$
T T $$I(P)$$ T T T F
T F $$I(P)$$ F T F F
F T $$I(P)$$ F T T T
F F $$I(P)$$ F F T T

Notation: We abbreviate $$eval(φ,I)$$ as $$φ[I]$$, and refer to it as the value of $$φ$$ in interpretation $$I$$.

We often write the value of $$φ$$ in all possible interpretations in a table:

$$I(P)$$ $$I(Q)$$ $$I(R)$$ $$φ[I]$$
T T T ?
T T F ?
T F T ?
T F F ?
F T T ?
F T F ?
F F T ?
F F F ?

This is called the truth table of $$φ$$. Each row corresponds to an interpretation.

## Satisfaction, Validity, Entailment

Definition: If $$I$$ is an interpretation and $$φ$$ a formula, we say $$I$$ satisfies $$φ$$ if $$φ[I] = T$$. We write I ⊨ φ.

Definition: If $$I⊨φ$$ for all $$I$$, we say $$φ$$ is valid or a tautology. We write $$⊨φ$$.

Definition: If $$I ⊨ φ$$ for all $$I$$ that satisfy $$ψ$$, we say that $$ψ$$ entails $$φ$$, written $$ψ⊨φ$$.

## Implication and entailment

Students often confuse implication ($$φ→ψ$$) and entailment $$φ ⊨ ψ$$. They are two different kinds of symbols; one is a symbol in the object language and the other is a statement in the meta language.

$$φ → ψ$$ is just a symbol; it does not have any definition. If I ask "what does $$φ → ψ$$ mean?", the answer is "$$φ → ψ$$". It's like asking "what does '$$aabac$$' mean?" The answer depends on context; the string itself has no intrinsic meaning.

$$φ ⊨ ψ$$ does have a definition, given above. It is a statement about the behavior of the evaluation function on the two formulas $$φ$$ and $$ψ$$.

$$φ → ψ$$ is a statement in the object language; $$φ ⊨ ψ$$ is a statement in the metalanguage.

However, the two notions are related, as we can prove in the metalanguage (we can't even talk about the relationship in the object language, because $$⊨$$ isn't a symbol available in the object language).

Claim: $$⊨ φ → ψ$$ if and only if $$φ ⊨ ψ$$.

Note: While talking about logic, it's important to be careful with your use of logic of terms and symbols. The following would be a meaningless thing to say:

Nonsense claim: $$(⊨ φ → ψ) ↔ (φ ⊨ ψ)$$.

Proof of claim: suppose that $$⊨ φ → ψ$$. We wish to show that $$φ⊨ψ$$; in other words, for every $$I$$ with $$I⊨φ$$, we also have $$I⊨ψ$$. Suppose this was false. Then there is some interpretation $$I$$ with $$eval(φ,I) = T$$ and $$eval(ψ,I) = F$$. But in this same interpretation, by definition, $$eval(φ→ψ,I) = F$$; this contradicts the fact that $$⊨ φ → ψ$$.

Conversely, suppose that $$φ ⊨ ψ$$. We now wish to show that $$⊨ φ→ψ$$. Consider any interpretation $$I$$. We want to show $$eval(φ→ψ,I) = T$$. We know that $$φ[I]$$ is either T or F. If it is F, then $$eval(φ→ψ,I) = T$$, by definition. If it is T, then since $$φ⊨ψ$$, $$eval(ψ,I)$$ must also be T. Therefore, by definition, $$eval(φ→ψ,I)$$ is true, as required.