propositional logic syntax and semantics
TRANSCRIPT
Propositional LogicSyntax and Semantics
Mario Alviano
University of Calabria, Italy
A.Y. 2015/2016
1 / 37
Outline
1 SyntaxIntuitionDefinitionConvenient notationFormula structure
2 SemanticsMeaning of a formulaTruth valuationsInterpretationsModels
3 Exercises
2 / 37
Propositional Logic — Intuition
Assume basic statements (propositions) to be givenMake formulas out of them using a fixed set of connectivesTruth of propositions determines truth of formulas
Example
1 These are beans from the sack2 These are green beans3 These are beans from the sack and these are green beans
Propositions: 1 , 2
Formulas (not being propositions): 3
Knowing that 1 and 2 are true we can conclude that 3 is true!
5 / 37
Well-formed formulas (wff) (1)
Let V be a countable set of propositional variables
Countable means of the same cardinality of natural numbers, orsmaller
Example. V = {A,B,C,D,A0,A1, . . .}
Important!
No fixed meaning is associated to propositional variables!They can mean anythingTruth value of variables fixed by semantics lateron
The set FV of propositional formulas (or wff) for Vcan defined inductively (in the next slides)
7 / 37
Well-formed formulas (wff) (2)
Propositional variables are wff
If v ∈ V then v ∈ FV
Propositional variables are called atomic formulas, or(propositional) atoms
> is a wff
> ∈ FV
> is called verumIt is always true
⊥ is a wff
⊥ ∈ FV
⊥ is called falsumIt is always false
8 / 37
Well-formed formulas (wff) (3)
The negation of a wff is a wff
If φ is a wff then (¬φ) is a wffIf φ ∈ FV then (¬φ) ∈ FV
(¬φ) should always have the opposite truth value of φ
Warning! φ is a meta-symbol, a placeholder for a wff (not a wff itself)
9 / 37
Well-formed formulas (wff) (4)
The conjunction of two wffs is a wff
If φ and ψ are wffs then (φ ∧ ψ) is a wffIf φ, ψ ∈ FV then (φ ∧ ψ) ∈ FV
(φ ∧ ψ) should be true if both φ and ψ are true
The disjunction of two wffs is a wff
If φ and ψ are wffs then (φ ∨ ψ) is a wffIf φ, ψ ∈ FV then (φ ∨ ψ) ∈ FV
(φ ∨ ψ) should be true if φ, ψ or both φ and ψ are true∨ is also referred to as inclusive or
Warning! φ and ψ are meta-symbols, and they can also be equal!
10 / 37
Well-formed formulas (wff) (5)
Implication
If φ and ψ are wffs then (φ→ ψ) is a wffIf φ, ψ ∈ FV then (φ→ ψ) ∈ FV
(φ→ ψ) should be true if ψ is true whenever φ is true→ is sometimes written as ⊃
Equivalence
If φ and ψ are wffs then (φ↔ ψ) is a wffIf φ, ψ ∈ FV then (φ↔ ψ) ∈ FV
(φ↔ ψ) should be true if ψ and φ have the same truthvalue
Warning! φ and ψ are meta-symbols, and they can also be equal!
11 / 37
Well-formed formulas: Summaryφ ∈ FV if and only if
φ ∈ V or (atoms)φ = > or (verum)φ = ⊥ or (falsum)φ = (¬ψ) where ψ ∈ FV or (negation)φ = (ψ ∧ ψ′) where ψ,ψ′ ∈ FV or (conjunction)φ = (ψ ∨ ψ′) where ψ,ψ′ ∈ FV or (disjunction)φ = (ψ → ψ′) where ψ,ψ′ ∈ FV or (implication)φ = (ψ ↔ ψ′) where ψ,ψ′ ∈ FV (equivalence)
Warning! φ, ψ and ψ′ are meta-symbols, and they can also be equal!
Some wffs of V = {A,B,C}
A(A→ ⊥)(A→ A)
((A ∨ B)↔ (B ∨ A))((A ∨ B)↔ (¬(> → (A ∧ B))))
((¬(A→ B))→ ((¬A) ∧ C))
No wffs of V = {A,B,C}
A⊥A→ ⊥)A→ ¬(→)
((AB)↔ B)
((A ∨ ∧)↔ ¬(>)(¬A→ B → (¬A ∧ C ∨ B))?
12 / 37
Equivalent definitions
Formal grammar
Terminals: V ∪ {>,⊥} ∪{¬,∧,∨,→,↔} ∪ {(, )}
Nonterminals: FV
Start symbol: FV
Production rules:FV −→ v ∈ V | > | ⊥FV −→ (¬FV )
FV −→ (FV ∧ FV )
FV −→ (FV ∨ FV )
FV −→ (FV → FV )
FV −→ (FV ↔ FV )
Language elements
V : propositions>,⊥,¬,∧,∨,→,↔:logical connectives(, ): auxiliary symbols(parentheses, notcomma)
13 / 37
Eliminating parentheses
Too many parentheses!!!Can we omit a few of them?Let us agree on a precedence of connectives(also known as binding strength)
Usual assumption
¬ is stronger than∧ is stronger than∨ is stronger than→ is stronger than↔
Minimal parentheses
1 (A→ ⊥)2 (A→ A)3 ((A ∨ B)↔ (B ∨ A))4 ((A ∨ B)↔ (¬(> → (A ∧ B))))
5 (((¬A) ∨ B)→ ((¬A) ∧ C))
15 / 37
Formulas as trees
Every wff can be written as a formula tree
Example
Consider
¬A ∨ B → ¬A ∧ C
or equivalently
(((¬A) ∨ B)→ ((¬A) ∧ C))
→
∨ ∧
¬ B ¬ C
AA
17 / 37
Subformulas (1)
Immediate subformulas of a wff φ, denoted isf (φ)
If φ ∈ V ∪ {>,⊥} then isf (φ) = ∅If φ = ¬ψ then isf (φ) = {ψ}If φ = ψ ◦ ψ′ for ◦ ∈ {∧,∨,→,↔} then isf (φ) = {ψ,ψ′}
Subformulas of a wff φ, denoted sf (φ)
Inductive definition1 φ itself belong to sf (φ)2 If ψ ∈ sf (φ) then isf (ψ) ⊆ sf (φ)
sf (φ) is the minimal set satisfying conditions 1 and 2
18 / 37
Subformulas (2)
Example
Consider¬A ∨ B → ¬A ∧ C
Its subformulas are the following:
¬A ∨ B → ¬A ∧ C
¬A ∨ B ¬A ∧ C
¬A B ¬A C
A
19 / 37
Semantics
Associate a meaning to wffs in a formal way
We could associate “sentences” to variables(e.g. “It is raining.”)But we are interested only in the truth or falsity ofthese sentencesSentences are informal, truth values can be formalized!
Associate truth values to atoms, truth values for formulas follow
22 / 37
Truth valuations (1)
Truth values are 1 (true) and 0 (false)A (truth) valuation ν is a function
ν: V 7→ {0,1}
So for each A ∈ V , either ν(A) = 1 or ν(A) = 0, not both
We can extend ν (for atoms) to ν∗ (for wffs)
Simple formulas
ν∗(>) = 1ν∗(⊥) = 0If A ∈ V then ν∗(A) = ν(A)
24 / 37
Truth valuations (2)φ ψ ¬φ φ ∧ ψ φ ∨ ψ φ→ ψ φ↔ ψ0 0 1 0 0 1 11 0 0 0 1 0 00 1 1 0 1 1 01 1 0 1 1 1 1
Negation: ¬φ
Should always havethe opposite truthvalue of φ
ν∗(¬φ) = 1 if and onlyif ν∗(φ) = 0
Conjunction: φ ∧ ψ
Should be true if bothφ and ψ are true
ν∗(φ ∧ ψ) = 1 iffν∗(φ) = 1 andν∗(ψ) = 1
Disjunction: φ ∨ ψ
Should be true if φ orψ are true
ν∗(φ ∨ ψ) = 1 iffν∗(φ) = 1 orν∗(ψ) = 1
Implication: φ→ ψ
Should be true if ψ is truewhenever φ is true
ν∗(φ→ ψ) = 1 iffν∗(φ) = 1 and ν∗(ψ) = 1, or ifν∗(φ) = 0
Equivalence: φ↔ ψ
Should be true if φ has the sametruth value as ψ
ν∗(φ↔ ψ) = 1 iff ν∗(φ) = ν∗(ψ)
25 / 37
Interpretations
An interpretation I consists exactly of a truth valuation ν
Given a wff φ and an interpretation I consisting of valuation ν,let
I(φ) = ν∗(φ)
I associates a unique truth value to every formulaThe truth value is the meaning of the formula
I is usually represented as the set of variables interpreted astrue:
I = {A ∈ V | I(A) = 1}
27 / 37
Calculating truth values of formulas (1)Given a formula φ and interpretation I, how to determine I(φ)?
1 Look at the subformulas of φ2 Work bottom-up
Example (For interpretation I = {C,A})
Consider¬A ∨ B → ¬A ∧ C
Its subformulas are the following:
¬A ∨ B → ¬A ∧ CI(¬A ∨ B → ¬A ∧ C) = 1
¬A ∨ BI(¬A ∨ B) = 0 ¬A ∧ CI(¬A ∧ C) = 0
¬AI(¬A) = 0 BI(B) = 0¬AI(¬A) = 0CI(C) = 1
AI(A) = 1 AI(A) = 128 / 37
Calculating truth values of formulas (2)A truth table may be useful for calculating truth values for morethan one interpretation
Example
Consider¬A ∨ B → ¬A ∧ C
A B C ¬A ¬A ∨ B ¬A ∧ C ¬A ∨ B → ¬A ∧ C0 0 0 1 1 0 00 0 1 1 1 1 10 1 0 1 1 0 00 1 1 1 1 1 11 0 0 0 0 0 11 0 1 0 0 0 11 1 0 0 1 0 01 1 1 0 1 0 0
29 / 37
Models
1 An interpretation I is a model of a wff φ if I(φ) = 12 If I(φ) = 1 then I satisifies φ3 If I satisfies φ then we write I |= φ
1 , 2 and 3 are equivalent, i.e.,
I(φ) = 1⇔ I is a model of φ⇔ I satisfies φ⇔ I |= φ
An interpretation I is not a model of a wff φ if I(φ) = 0If I(φ) = 0 then I does not satisfy φIf I does not satisfy φ then we write I 6|= φ
I(φ) = 0⇔ I is not a model of φ⇔ I does not satisfy φ⇔ I 6|= φ
31 / 37
Exercises (1)
Let V = {x , y , z} be a set of propositional variables.Show whether the following are well-formed formulas (notconsidering operator preferences) in FV or not:
1 (¬(z ∧ x))2 ((x ← y) ∧ z)3 ((x ↔ (¬y)))4 (¬((¬(¬z)) ∨ (¬x)))5 ((x ↔ y) ∧ (¬¬x))6 ((y ∧ x)↔ (w ∧ (¬z)))7 ((x → (¬x)) ∨ (¬(y)→ (¬z)))
33 / 37
Exercises (2)
Let V = {x , y , z} be a set of propositional variables.Draw the parse tree and simplify (according to the standardpreferences) as much as possible each of the followingformulas:
1 (¬(y ∧ (¬(z → (x ∨ (¬y))))))2 (((¬x) ∨ (¬y))↔ ((¬y) ∧ (¬z)))3 ((x → (¬y))↔ (¬(y ∧ (¬z))))4 ((¬x) ∧ ((¬y)→ (¬(z ∨ (¬y)))))
34 / 37
Exercises (3)
Let V = {x , y , z} be a set of propositional variables.Find the full version (according to the standard preferences)and draw the parse trees of the following formulas:
1 x ∨ ¬y ∧ ¬z2 ¬x ∨ z ↔ y ∧ ¬z3 ¬x ↔ z → ¬y ∧ z4 x ↔ ¬y → ¬z ∧ ¬x ∨ y
35 / 37
Exercises (4)
1 List all subformulas of formulasx ∨ ¬y ∧ ¬z¬x ∨ z ↔ y ∧ ¬z
2 Given the interpretation I = {x , z},decide whether I is a model of
x ∨ ¬y ∧ ¬z3 Work out the truth table of formula
((¬x) ∧ ((¬y)→ (¬(z ∨ (¬y)))))
36 / 37