You are on page 1of 17

FOUNDATIONS OF

COMPUTER SCIENCE
Propositional logic
Semantics & Formal Proofs
SEMANTICS
SEMANTICS

• We have talked about how to form syntactic phrases called


formulas
• What is the semantics (meaning) of a formula?
• a propositional variable can either be T(true) or F(alse)
• a formula φ will be T or F depending on the meaning of its
sub-formulas
• ie. the value of each point in the syntax tree depends on
the value of its children (function!)
• truth tables are a convenient way of expressing this
p q p→q

T T T

T F F
F T T
F F T
BASIC TRUTH TABLES
φ ¬φ

T F
F
F T

φ ψ φ ∧ψ φ ∨ψ φ →ψ
T T T T T
T F F T F
F T F T T
F F F F T
Question

• Implication has a causal connotation in natural language, but it’s logical


meaning is a simple truth table. It is important to separate causality from
logical argument. What can we say about the following situations?

• If it is raining I carry an umbrella. Am I being logically inconsistent if I carry


an umbrella when it is sunny?

• (often used by politicians) Policy X will result in Y. So clearly not pursuing


X will not result in Y. My opponent doesn’t support policy X so it must
mean that he/she doesn’t support Y.

• Policy X will result in Y. I don’t want Y so I don’t support X.


EXAMPLE
p q p → q q → p (p → q) ∨ (q → p)
T T T T T
T F F T T
F T T F T
F F T T T

• Each row corresponds to a particular truth value assignment to the


propositional variables
• this formula is an example of a tautology
SEMANTICS AS A FUNCTION

• Let 2 = { F, T }
• Let ¬ : 2 → 2, ∨: 2×2 → 2, ∧: 2×2 → 2, →: 2×2 → 2 be the
obvious functions (note: we are abusing notation)

• supposethat V is the set of propositional variables and there is some


assignment of truth values σ: V → 2.

• We will define a function ⟦-⟧σ: F → 2 that takes a formula to its truth


value, based on the truth assignments of propositional variables given
by σ
SEMANTICS AS A (RECURSIVELY
DEFINED)FUNCTION
⟦-⟧σ
• ⟦⊥⟧σ =F
• ⟦p⟧σ = σ(p)
• ⟦ φ ∨ ψ ⟧σ = ∨(⟦ φ ⟧σ, ⟦ ψ ⟧σ)
• ⟦ φ ∧ ψ ⟧σ = ∧(⟦ φ ⟧σ, ⟦ ψ ⟧σ)
• ⟦ φ → ψ ⟧σ = →(⟦ φ ⟧σ, ⟦ ψ ⟧σ)
• ⟦ ¬ φ ⟧σ = ¬(⟦ φ ⟧σ)

• Notice that the function depends on the particular assignment σ


Question

1. Define functions ¬ : 2 → 2, ∨: 2×2 → 2, ∧: 2×2 → 2, →:


2×2 → 2
2. Let σ(p)=T, σ(q)=T, σ(r)=F. Derive ⟦r →p ∧q⟧ by following
the recursion to the end.
TAUTOLOGIES

• a formula φ that evaluates to T for all possible values of


propositional variables is called a tautology, or is said to be
valid
• a formula φ that evaluates to T for at least one assignment of
truth values to propositional variables is said to be satisfiable
• two formulas are logically equivalent when they evaluate
to equal truth values for any assignment of truth values to
propositional variables
• note: logical equivalence is an equivalence relation on the
set of all formulas!
FORMAL PROOFS
Question

• A Martian visits earth and wants to understand the job of a


translator. It observes that an English to French translator
transforms strings of symbols (that satisfy the rules of English)
into other strings of symbols (that satisfy the rules of French).
What is missing in this description?
PROOFS VS FORMAL PROOFS
• Our proofs so far have been careful, rigorous arguments that relate some formal notion to another.
Proofs, in this sense (and in standard mathematical practice) are a sociological construct designed to
convince other people of the truth of some statement.

• Logicians are not happy with this state of affairs and devised a number of formal proof systems.
Here the proof itself is a mathematical object with strict rules: we can tell if something is a proof or not
a proof by examining is. There is a close connection between proofs and programs.

• An analogy can be made with recipe books (written for humans) and programs (written for machines).
When is a recipe not a well-formed recipe? When is a program not a well-formed program?

• The idea of a proof system raises a number of questions.

• When is a proof system correct?

• When is a proof system useful?


SEMANTIC ENTAILMENT
• Recallthat a tautology is a formula φ that evaluates to T for all truth
assignments to propositional variables
• write ⊧φ
• thesymbol ⊧ is called “semantic entailment”
• Suppose that Γ is a set of formulas.

• Γ ⊧ φ (read Γ semantically entails φ) means: any truth assignment that


makes all the formulas of Γ evaluate to T also makes φ evaluate to T

• so ⊧ φ is simply shorthand for ∅ ⊧ φ


• is Γ ⊧ φ a syntactic property or a semantic property of φ?
14
FORMAL PROOF SYSTEMS
• Suppose that we have some formal proof system.

• a collection of rules that allows us to form formal things called proofs —


taking some formulas as assumptions and producing a conclusion.

• natural deduction (Gentzen) is an example of a formal proof system (next


lecture), but there are several other proof systems

• Write Γ ⊦ φ when, taking the formulas in Γ as assumptions we can prove φ as


the conclusion.

• Write ⊦ φ when we can prove φ without using any assumptions (i.e. as shorthand
for ∅ ⊦ φ)
SOUNDNESS
• When is a proof system correct?

Γ ⊦ φ implies Γ ⊧ φ
• “whenever gamma proves phi, gamma semantically entails phi"

• So if we can prove that φ holds given from some assumptions, if those assumptions are
true then φ must be true also!

• i.e. if we can prove something in our proof system then it is true


COMPLETENESS

• When is a proof system most useful?

Γ ⊧ φ implies Γ ⊦ φ
• “whenever gamma semantically entails phi, gamma proves phi”

• whenever φ is true given that some formulas are true, then φ is also provable from those
formulas

• i.e. if something is true, the proof system is powerful enough to prove it.

You might also like