Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
11 views68 pages

Propositional Logic Appunti

The document provides an overview of propositional logic, detailing its syntax, semantics, and inferencing apparatus. It defines the components of a formal logical system, introduces the concepts of propositions and well-formed formulas, and explains the evaluation of propositional formulas in different interpretations. Additionally, it discusses the use of inductive definitions and the relationships between logical connectives.

Uploaded by

mesfin.hype
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views68 pages

Propositional Logic Appunti

The document provides an overview of propositional logic, detailing its syntax, semantics, and inferencing apparatus. It defines the components of a formal logical system, introduces the concepts of propositions and well-formed formulas, and explains the evaluation of propositional formulas in different interpretations. Additionally, it discusses the use of inductive definitions and the relationships between logical connectives.

Uploaded by

mesfin.hype
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 68

Propositional Logic

Propositional Logic - Syntax and Semantics and Inferences

Luciano Serafini(1) – Maurizio Lenzerini(2)


(1) FBK, Trento, Italy – (2) Sapienza Università di Roma

Logica e Informatica – A.A. 2024/25

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Formal logical system

A formal logical system is constituted by several components, including:


The language, with its
syntax (how to form sentences)
semantics (how to assign meaning to sentences)
pragmatics (how to use the logic for a specific objective)
that enables forming the sentences that are acceptable in the formal
system
The inferencing apparatus, that enables studying all the relevant
relationships between sentences of the language

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Propositional logic - Intuition

The first formal logical system that we study is propositional logic.


Propositional logic is the logic of propositions
Intuitively, a proposition is anything that has a true value (i.e., can be
true or false) in a state of the world (context) of interest.
The same proposition can be expressed in different ways.
E.g.
“B. Obama is drinking a beer”
“The former U.S.A. president is drinking a beer”, and
“B. Obama si sta facendo una birra”
express the same proposition.
Warning: obviously, not all sentences in natural language are propositions!
The language of propositional logic allows us to use atomic propositions
and to compose complex sentences (formulas) on the basis of atomic
propositions and connectives.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Syntax of propositional logic language: the alphabet
To define the syntax of the propositional logic language, we define the alphabet (set of
atomic symbols that can be used in the language), and then the set of sentences that
can be formed using the alphabet.

Definition (Propositional alphabet)


Non logical symbols: A countable set P of symbols called propositional variables, or
propositional atoms
Logical symbols (connectives): ¬, ∧, ∨, → and ≡
Separator symbols: “(” and “)”

The intuitive meaning of the connectives are as follows:


¬ is the negation symbol: ¬A has the opposite truth value as A
∧ is the conjunction symbol: A ∧ B is true exactly when both A and B are true
∨ is the disjunction symbol: A ∨ B is true exactly when at least one between A
and B is true
→ (sometimes written ⊃) denotes the material implication symbol: A → B
means that whenever A is true, B is true as well
≡ is the material equivalence symbol: A ≡ B is true if A and B have the same
truth value.
Luciano Serafini – Maurizio Lenzerini Propositional Logic
The notion of inductive definition

In what follows, we will often define sets and functions inductively. In


particular, since from a syntactic point of view a language is a set of sentences,
we will often define the syntax of languages inductively.

An inductive definition of a set S specifies which are the elements of S by using


one or more base steps, that directly specify that some elements belong to
S
one or more inductive steps, each of the form if x ∈ S, then y ∈ S, where
y is related somehow with x.
a closure condition, asserting that nothing else is in S (i.e., anything not
derived from the base or inductive steps is not in S)
Whenever we indicate that a certain definition is inductive, its closure condition
is implicit, and therefore we can avoid specifying such condition explicitly.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Example of inductive definition

Example
The set Nat of natural numbers is defined inductively as follows:
1 0 ∈ Nat
2 if x ∈ Nat then s(x) ∈ Nat

Note that with the inductive definition of Nat, we can also


define inductively any function F of the form F : Nat −→ C , using the
following scheme:
1 Base step We directly provide the definition of F (0)
2 Inductive step Starting from F (x), we provide the definition of F (s(x))
prove that a certain property T holds for every natural numbers, using the
following scheme:
1 Base step We directly prove that T (0) holds
2 Inductive step Based on the assumption that T (x) holds, we provide the
proof that T (s(x)) holds as well

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Syntax of propositional logic language: the formulas

Definition (Well formed formulas (or simply formulas))


A propositional logic formula on the alphabet P is a finite expression build
according to the following inductive definition:
every P ∈ P is an atomic formula, and every atomic formula is a formula
if A and B are formulas, then the following are formulas:
(A)
¬A
A∧B
A∨B
A → B (also written as A ⊃ B)
A≡B

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Formulas cont’d

Example (formulas and non formulas)


Formulas Non formulas
P→Q PQ
P → (Q → R) (P → ∧((Q → R)
P ∧Q →R P ∧ Q → ¬R¬

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Reading formulas
Problem
How do we read the formula P ∧ Q → R?
One might think that the formula P ∧ Q → R can be read in two ways:
1 (P ∧ Q) → R
2 P ∧ (Q → R)

Symbol priority
Priorities solve the problem: ¬ has higher priority, then ∧, ∨, → and ≡.
Parenthesis can be used around formulas to stress or change the priority.
Symbol Priority
¬ 1
∧ 2
∨ 3
→ 4
≡ 5

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Formulas as trees

Tree form of a formula


A formula can be seen as a tree. Leaf nodes are associated to propositional
variables, while intermediate (non-leaf) nodes are associated to connectives.
For instance the formula (A ∧ ¬B) ≡ (B → C ) can be represented as the tree

∧ !

A ¬ B C

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Subformulas

Definition ((Proper) Subformula)


A is a subformula of itself
A is a subformula of ¬A, and A is a subformula of (A)
A, B are subformulas of A ∧ B, A ∨ B, A → B, A ≡ B
if A is a subformula of B and B is a subformula of C , then A is a
subformula of C .
A is a proper subformula of B if A is a subformula of B and A is different
from B.

Remark
The subformulas of a formula represented as a tree correspond to all the
different subtrees of the tree associated to the formula, one for each node.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Subformulas

Example
The subformulas of (p → (q ∨ r )) → (p ∧ ¬p) are

(p → (q ∨ r )) → (p ∧ ¬p)
(p → (q ∨ r )), (p ∧ ¬p), p → (q ∨ r ), (q ∨ r )
p ∧ ¬p, q∨r
p, ¬p, q, r

Theorem
Every formula has a finite number of subformulas.

Note that the above is a meta-sentence, i.e., a sentence telling something


about the formal logical system. In general, when we claim that a
meta-sentence is a theorem, we should prove that such a meta-sentence is
indeed true. When we do so, we use logic for proving properties of logic!

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Propositional logic language: semantics

How can we specify the meaning of the sentences of propositional logic?


The simplicity of the propositional language leads naturally to deciding
that the meaning of any sentence coincides with its truth value, i.e., is
either true or false.
But, for example, a sentence like P1 ∧ P2 is either true or false depending
of the truth value of P1 and P2 . So, the meaning of a sentence depends
on the truth value of the propositional variables in it!
In turn, the truth value of a propositional variable depends on the specific
intended meaning of the variable in the considered context. For example,
if “piove” is a propositional variable, its truth value depends on the
“world” (context, i.e., time and space) that we are considering.
In order to capture the notion of world (or, context), propositional logic
introduces the notion of interpretation.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Propositional logic language: semantics

The notion of interpretation is central to the semantics of propositional logic.

Definition (Propositional interpretation (or simply intepretation))


Given a propositional alphabet with propositional variables P, a propositional
interpretation is a function I : P → {True, False}

Remark
A propositional interpretation I for a formula can be actually seen as the set
of propositional variables such that I(P) = True. Adopting this set theoretic
representation, we will often represent an interpretation by such set.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Interpretation in propositional logic: example
Consider the following sentence over the alphabet {p, q, r }:

(p ∧ (¬q ∨ r )) ∨ (p ∧ r )

Some possibile interpretations for the above sentence:


Example
p q r Set theoretic representation
I1 True True True {p, q, r }
I2 True False True {p, r }
I3 True False False {p}
I4 False False False {}

In the above picture, the table shoud be read as follows: I1 is the


interpretation function such that I1 (p) = True, I1 (q) = True, I1 (r ) = True,
and so on.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Evaluation of a propositional formula in an interpretation

We now illustrate the rules for deciding whether the formula A is true in the
intepretation I (or, equivalently, whether I satisfies A, written as I |= A).

Definition (I |= A)
I |= A is inductively defined as follows:
If A is P, where P ∈ P, then I |= A if and only if I(P) = True
I |= (A) if and only if I |= A
I |= ¬A if and only if it is not the case that I |= A (also written I ̸|= A)
I |= A ∧ B if and only if both I |= A and I |= B
I |= A ∨ B if and only if I |= A or I |= B
I |= A → B if and only if it is not the case that I |= A and I ̸|= B
I |= A ≡ B if and only if both I |= A → B and I |= B → A

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Evaluation of a propositional formula: example

Example
Let I = {P}, and let us check if I |= (P ∧ Q) ∨ (R → S).

We replace each occurrence of each primitive propositions of the formula with


the truth value assigned by I, and apply the definition for connectives.

(True ∧ False) ∨ (False → False) (1)


False ∨ True (2)
True (3)

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Observations on connectives
A → B has the same meaning as ¬A ∨ B
¬(A ∨ B) has the same meaning as ¬A ∧ ¬B (De Morgan law 1)
¬(A ∧ B) has the same meaning as ¬A ∨ ¬B (De Morgan law 2)
A → B has the same meaning as ¬B → ¬A
A → ¬B has the same meaning as B → ¬A
A is a sufficient condition for B can be written as A → B, and can read
as “if A then B”
A is a necessary condition for B can be written as B → A
A is a necessary and sufficient for B can be written as A ≡ B, and can be
read as “A if and only if B”
NAND is another connective that is defined as A NAND B is defined as
¬(A ∧ B)
NOR is another connective that is defined as A NOR B is defined as
¬(A ∨ B)

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Exercise

Prove the following proposition (i.e., prove that the following meta-sentence is
true).

Proposition
Let I and I ′ be two interpretations for a formula A. If for every propositional
variable P appearing in A it holds that I(P) = I ′ (P), then I |= A if and only
if I ′ |= A.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Algorithm for checking if I |= A

Lazy evaluation algorithm (1/2)


check(I |= p):
(A is p)
if I(p) = true
then return YES
else return NO

check(I |= B ∧ C ):
(A is B ∧ C )
if check(I |= B)
then return check(I |= C )
else return NO

check(I |= B ∨ C ):
(A is B ∨ C )
if check(I |= B)
then return YES
else return check(I |= C )

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Checking if I |= A

Lazy evaluation algorithm (2/2)

check(I |= B → C ):
(A is B → C ) if check(I |= B)
then return check(I |= C )
else return YES

(A is B ≡ C ) check(I |= B ≡ C ):
if check(I |= B)
then return check(I |= C )
else return not(check(I |= C )

Question: which is the computational complexity of the algorithm?

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Formalizing natural language sentences

Exercise
Let’s consider a propositional language where p means ”Paola is happy”, q means
”Paola paints a picture”, and r means ”Renzo is happy”. Formalize the following
sentences:
1 ”if Paola is happy and paints a picture then Renzo isn’t happy”
2 ”if Paola is happy, then she paints a picture”
3 ”Paola is happy only if she paints a picture”
The precision of formal languages avoids the ambiguities of natural languages.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Formalizing natural language sentences

Exercise
Let’s consider a propositional language where p means ”Paola is happy”, q means
”Paola paints a picture”, and r means ”Renzo is happy”. Formalize the following
sentences:
1 ”if Paola is happy and paints a picture then Renzo isn’t happy”
p ∧ q → ¬r
2 ”if Paola is happy, then she paints a picture”
3 ”Paola is happy only if she paints a picture”
The precision of formal languages avoid the ambiguities of natural languages.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Formalizing natural language sentences

Exercise
Let’s consider a propositional language where p means ”Paola is happy”, q means
”Paola paints a picture”, and r means ”Renzo is happy”. Formalize the following
sentences:
1 ”if Paola is happy and paints a picture then Renzo isn’t happy”
p ∧ q → ¬r
2 ”if Paola is happy, then she paints a picture”
p→q
3 ”Paola is happy only if she paints a picture”
The precision of formal languages avoid the ambiguities of natural languages.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Formalizing natural language sentences

Exercise
Let’s consider a propositional language where p means ”Paola is happy”, q means
”Paola paints a picture”, and r means ”Renzo is happy”. Formalize the following
sentences:
1 ”if Paola is happy and paints a picture then Renzo isn’t happy”
p ∧ q → ¬r
2 ”if Paola is happy, then she paints a picture”
p→q
3 ”Paola is happy only if she paints a picture”
¬(p ∧ ¬q) which is equivalent to ¬q → ¬p, which is equivalent to p → q
The precision of formal languages avoids the ambiguities of natural languages.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Formalizing natural language sentences

Exercise
Let’s consider a propositional language where r means ”rigore nei conti pubblici”, e
means ”sviluppo dell’economia”, s means “stagnazione” and f means “spesa facile”.
Formalize the following sentences:
1 ”il rigore nei conti pubblici contraddice lo sviluppo economico”
2 ”se c’è stagnazione, allora non c’è sviluppo economico”
3 ”se c’è sviluppo economico, allora non c’è stagnazione”
4 ”la spesa facile è il contrario del rigore nei conti pubblici”

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Formalizing natural language sentences

Exercise
Let’s consider a propositional language where r means ”rigore nei conti pubblici”, e
means ”sviluppo dell’economia”, s means “stagnazione” and f means “spesa facile”.
Formalize the following sentences:
1 ”il rigore nei conti pubblici contraddice lo sviluppo economico”
r → ¬e
2 ”se c’è stagnazione, allora non c’è sviluppo economico”
3 ”se c’è sviluppo economico, allora non c’è stagnazione”
4 ”la spesa facile è il contrario del rigore nei conti pubblici”

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Formalizing natural language sentences

Exercise
Let’s consider a propositional language where r means ”rigore nei conti pubblici”, e
means ”sviluppo dell’economia”, s means “stagnazione” and f means “spesa facile”.
Formalize the following sentences:
1 ”il rigore nei conti pubblici contraddice lo sviluppo economico”
r → ¬e
2 ”se c’è stagnazione, allora non c’è sviluppo economico”
s → ¬e
3 ”se c’è sviluppo economico, allora non c’è stagnazione”
4 ”la spesa facile è il contrario del rigore nei conti pubblici”

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Formalizing natural language sentences

Exercise
Let’s consider a propositional language where r means ”rigore nei conti pubblici”, e
means ”sviluppo dell’economia”, s means “stagnazione” and f means “spesa facile”.
Formalize the following sentences:
1 ”il rigore nei conti pubblici contraddice lo sviluppo economico”
r → ¬e
2 ”se c’è stagnazione, allora non c’è sviluppo economico”
s → ¬e
3 ”se c’è sviluppo economico, allora non c’è stagnazione”
e → ¬s
4 ”la spesa facile è il contrario del rigore nei conti pubblici”

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Formalizing natural language sentences

Exercise
Let’s consider a propositional language where r means ”rigore nei conti pubblici”, e
means ”sviluppo dell’economia”, s means “stagnazione” and f means “spesa facile”.
Formalize the following sentences:
1 ”il rigore nei conti pubblici contraddice lo sviluppo economico”
r → ¬e
2 ”se c’è stagnazione, allora non c’è sviluppo economico”
s → ¬e
3 ”se c’è sviluppo economico, allora non c’è stagnazione”
e → ¬s
4 ”la spesa facile è il contrario del rigore nei conti pubblici”
f ≡ ¬r

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Evaluation of a formula as a function

The algorithm for checking whether a formula A is satisfied by an


interpretation I makes it clear the relationship between an interpretation and a
formula, and shows that an interpretation can be extended to a function from
the set of formulas to the set {True, False}:
I(A) = True if I |= A
I(A) = False if I ̸|= A
For example, it is easy to see that, if I(p) = True and I(q) = False, then
I(p ∨ q) = True.
Note that it is common to regard the truth values as numbers, usually with the
following convention:
True corresponds to 1
False corresponds to 0
Thus, an intepretation can also be seen as a function from the set of formulas
to the set {0, 1}. This is the basis for the development of Boolean algebra.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Truth tables
The meaning of the connectives we have considered in propositional logic (¬,
∨, ∧, →, ≡) can be represented as a table, called truth table. For example:
Example: truth table for the ∧ binary connective (n = 2)

A B A∧B A B A∧B
False False False 0 0 0
False True False 0 1 0
True False False 1 0 0
True True True 1 1 1

In principles, we could think of other connectives whose semantics is specified


through truth tables: if a connective is n-ary (i.e., it applies to n operands),
the truth table has as many rows as the possibile vectors of n values, each
value being True or False, and n + 1 columns, one for each operand plus one
for representing the truth value that the formula has if the truth values of the
various components are the ones specified by the vector fixing the truth value
of the operands.
Luciano Serafini – Maurizio Lenzerini Propositional Logic
Boolean functions
More generally, any Boolean function can be specified through a truth table,
where a Boolean function is a function of type

{False, True}n → {False, True}

or {0, 1}n → {0, 1}, and the corresponding truth table has again as many rows
as the possible vectors of n values, and n + 1 columns.
Example of Boolean function f (n = 3)

A B C f (A, B, C )
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Boolean functions and connectives
It follows that for any connective, there is a corresponding Boolean function
capturing its semantics, and viceversa.
Boolean functions with 0 argument:
fT :→ 1 corresponds to the new connective T (for every I, I (T) = True)
fF :→ 0 corresponds to the new connective F (for every I, I (F) = False)
Boolean functions with 1 argument:

A fid A f¬ A f1,1 A f0,0


0 0 0 1 0 1 0 0
1 1 1 0 1 1 1 0

Note that f¬ correspond to the connective ¬. The other 1-argument


functions do not correspond to interesting connectives.
Semantics of unary connectives expressed through Boolean functions
If ◦ is a 1-argument connective, and f◦ is the corresponding Boolean function,
we have that, for every interpretation I, and every formula A,
I(◦A) = f◦ (I(A)).
Luciano Serafini – Maurizio Lenzerini Propositional Logic
Boolean functions and connectives

Obviously, for every binary connective, there is a corresponding Boolean


function, and viceversa.
Boolean functions with 2 arguments corresponding to our connectives:

A B f∧ A B f∨ A B f→ A B f≡
0 0 0 0 0 0 0 0 1 0 0 1
0 1 0 0 1 1 0 1 1 0 1 0
1 0 0 1 0 1 1 0 0 1 0 0
1 1 1 1 1 1 1 1 1 1 1 1

Semantics of binary connectives expressed through Boolean functions


If ◦ is a 2-argument connective, and f◦ is the corresponding Boolean function,
then for every interpretation I, and every formulas A, B,
I(A ◦ B) = f◦ (I(A), I(B)).

Luciano Serafini – Maurizio Lenzerini Propositional Logic


How many Boolean functions?

How many Boolean functions (or connectives) with n arguments we have?

n = 0 −→ 2

fT fF
1 0

n = 1 −→ 4

A fid A f¬ A f1,1 A f0,1


0 0 0 1 0 1 0 0
1 1 1 0 1 1 1 0

Luciano Serafini – Maurizio Lenzerini Propositional Logic


How many Boolean functions?
How many Boolean functions (or connectives) with n arguments we have?
In general, all the truth tables of the various Boolean functions with the same
number n of arguments have a number of rows equal to the number of
interpretations that we can define on n propositional variables, i.e., 2n . Two
n
such truth tables differ only in the last columns. Now, since there are 22
n
possible columns of values 0,1 with 2n rows, it follows that there are 22
possible Boolean functions with n arguments.
n = 2 −→ 16
the number of tables with all possible combinations of {0, 1} in 2
columns, i.e., number of tables with 22 = 4 rows, and 2 + 1 columns, i.e.,
the number of {0, 1} vectors of 4 elements, i.e., 24 = 16.
n
n generic −→ 22
the number of tables with all possible combinations of {0, 1} in n
columns, i.e., number of tables with 2n rows, and n + 1 columns, i.e., the
n
number of {0, 1} vectors of 2n elements, i.e., 22 .

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Truth tables for formulas

It is immediate to build a truth table for a formula: if the formula has n


propositional variables, the table has one row for each interpretation of the
formula (assigning truth values to all the propositional variables), and n + 1
columns, where for a row corresponding to an interpretation I, the last column
will contain I(A).
Example
Truth table for (F ∨ G ) ∧ ¬(F ∧ G ).

F G (F ∨ G ) ∧ ¬(F ∧ G )
True True False
True False True
False True True
False False False

Note: intuitively, what does the formula in the example represent?

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Truth tables for formulas: exercises
Suggestion: to simplify the process of building a truth table for a formula, we can add
columns to the table corresponding to the various subformulas

Example: Truth table for (F ∨ G ) ∧ ¬(F ∧ G )


F G F ∨G F ∧G ¬(F ∧ G ) (F ∨ G ) ∧ ¬(F ∧ G )
True True True True False False
True False True False True True
False True True False True True
False False False False True False

Exercise: build the truth tables for the following propositional formulas:
(p → p) → p
p → (p → p)
p∨q →p∧q
p ∨ (q ∧ r ) → (p ∧ r ) ∨ q
p → (q → p)
(p ∧ ¬q) ∨ ¬(p ↔ q)

Luciano Serafini – Maurizio Lenzerini Propositional Logic


From formulas to Boolean functions

It can be shown that there is a total correspondence between Boolean


functions and formulas. One direction is easy to prove.

Proposition
For every formula A with n propositional variables p1 , . . . , pn , one can define a
Boolean function fA with n arguments such that for every combination of truth
values for p1 , . . . , pn corresponding to the interpretation I,
fA (I(p1 ), . . . , I(pn )) = I(A).

The proof of the above proposition is based on the fact that the truth table for
a formula directly specifies the corresponding Boolean formula.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


From Boolean functions to formulas

It can be shown that there is a total correspondence between Boolean functions


and formulas. The other direction is represented by the following proposition.

Proposition
For every Boolean function f with n arguments, there is a corresponding
formula Af with n propositional variables p1 , . . . , pn , such that for every
interpretation I, I(Af ) = f (I(p1 ), . . . , I(pn )).

The above proposition is more difficult to prove.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


From Boolean functions to formulas: first formulation
Given the truth table of a Boolean function ϕ with n arguments (n > 0), we can build
the formula with n + 1 propositional variables p0 , p1 , . . . , pn of the form
(p0 ∧ ¬p0 ) ∨ α1 ∨ · · · ∨ αk
with one αi for each row with the value 1 for ϕ, where each αi has the form
γ1 ∧ · · · ∧ γn
where γj is pj if the row has 1 in column j, and is ¬pj if the row has the value 0 in
column j. Note that (p0 ∧ ¬p0 ) takes care of the case where all rows for ϕ have no 1.
Example: formula corresponding to the Boolean function ϕ
p1 p2 p3 ϕ(p1 , p2 , p3 )
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 1 =⇒ (p0 ∧¬p0 )∨(¬p1 ∧¬p2 ∧¬p3 )∨(¬p1 ∧p2 ∧p3 )
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 0

Luciano Serafini – Maurizio Lenzerini Propositional Logic


From Boolean functions to formulas: second formulation
Given the truth table of a Boolean function ψ with n arguments (n > 0), we can build
the formula with n + 1 propositional variables p0 , p1 , . . . , pn of the form
¬((p0 ∧ ¬p0 ) ∨ β1 ∨ · · · ∨ βk )
with one βi for each row with the value 0 for ψ, where each βi has the form
γ1 ∧ · · · ∧ γn
where γj is pj if the row has 1 in column j, and is ¬pj if the row has the value 0 in
column j. Note that (p0 ∧ ¬p0 ) takes care of the case where all rows for ϕ have no 0.
Example: formula corresponding to the Boolean function ψ
p1 p2 p3 ψ(p1 , p2 , p3 )
0 0 0 1
0 0 1 0
0 1 0 1 ¬((p0 ∧ ¬p0 ) ∨ (¬p1 ∧ ¬p2 ∧ p3 ) ∨ (p1 ∧ ¬p2 ∧ ¬p3 ))
0 1 1 1 =⇒ by De Morgan, equivalent to
1 0 0 0 (¬p0 ∨ p0 ) ∧ (p1 ∨ p2 ∨ ¬p3 ) ∧ (¬p1 ∨ p2 ∨ p3 )
1 0 1 1
1 1 0 1
1 1 1 1

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Complete sets of connectives

The two formulations above are at the basis of the proof that every Boolean
function can be represented by a propositional formula. Such proof shows that
the following proposition is true.
Proposition
Every formula of propositional logic can be written using only the connectives
¬, ∨ and ∧.

In other words, the set of connectives {¬, ∨, ∧} is complete, because they allow
to express any formula that corresponds to a Boolean function. Note that this
implies that the set of our connectives, i.e., {¬, ∨, ∧, →, ≡} is also complete.

Even more specifically, it can be shown that at least two normal forms exist for
propositional formulas.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Normal form for formulas
Proposition
Every Boolean function can be expressed by a formula of propositional logic in
the so-called disjunctive normal form, i.e., as
α1 ∨ · · · ∨ αk
where each αi is a minterm, i.e., has the form
γ1 ∧ · · · ∧ γn
where each γj is a literal, i.e., either a propositional variable or the negation of
a propositional variable.

Proposition
Every Boolean function can be expressed by a formula of propositional logic in
the so-called conjunctive normal form, i.e., as
β1 ∧ · · · ∧ βk
where each βi is a clause, i.e., has the form
γ1 ∨ · · · ∨ γn
where each γj is a literal.
Luciano Serafini – Maurizio Lenzerini Propositional Logic
Are all our connectives necessary?

We leave as an exercise to prove the following propositions, regarding other


complete sets of connectives.
Proposition
Every formula of propositional logic can be written using only the connectives
¬ and ∨.

Proposition
Every formulas of propositional logic can be written using only the connectives
¬ and ∧.
Also, the following proposition holds.
Proposition
Every formulas of propositional logic can be written using only the connective
NAND or only the connective NOR.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Valid, satisfiable, and unsatisfiable formulas

Definition (Model of a formula)


An interpretation I that satisfies a formula A, i.e., such that I |= A, is called a
model of A.

Definition
A formula A is
Valid (or a tautology) if for every interpretation I, I |= A
i.e., every interpretation for A is a model of A
Satisfiable if there is an interpretation I s.t. I |= A
i.e., A has at least one interpretation that is a model, i.e.. A
has at least one model
Unsatisfiable if for no interpretation I, I |= A
i.e., A has no interpretation that is a model, i.e., A does not
have any model

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Valid, satisfiable, and unsatisfiable formulas

Proposition
A valid −→ A satisfiable ←→ A not unsatisfiable
A unsatisfiable ←→ A not satisfiable −→ A not Valid

Proposition
if A is then ¬A is
Valid Unsatisfiable
Satisfiable not Valid
not Valid Satisfiable
Unsatisfiable Valid

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Cheking validity and (un)satisfiability of a formula
Truth table
Checking (un)satisfiability and validity of a formula A can be done by
enumerating all the interpretations which are relevant for S, and for each
interpretation I checking if I |= A.

Example (using truth table)


A B C A → (B ∨ ¬C )
True True True True
True True False True
True False True False
True False False True
False True True True
False True False True
False False True True
False False False True

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Valid, satisfiable, and unsatisfiable formulas

Example


A→A


 




 A ∨ ¬A 



¬¬A ≡ A

 

 Valid
 ¬(A ∧ ¬A) 


 Prove that the blue formu-
Satisfiable A∧B →A 


 las are valid, that the ma-
A → A ∨ B

 

  genta formulas are satisfi-
A∨B



able but not valid, and that
 




 A B 

the red formulas are unsat-

 

¬(A ∨ B) → C


isfiable.
 

 A ∧ ¬A Not Valid
¬(A → A) 
 
Unsatisfiable


A ≡ ¬A



 

¬(A ≡ A)
 

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Valid, satisfiable, and unsatisfiable sets of formulas

Definition (Model of a set of formula)


An interpretation I that satisfies all the formula of a set Γ, i.e., such that
I |= A for all formulas A ∈ Γ, is called a model of Γ (written I |= Γ).

Definition
A set of formulas Γ is
Valid if for all I, I |= Γ, i.e., every interpretation is a model of Γ
Satisfiable if there is an I s.t. I |= Γ, i.e., Γ has at least one model
Unsatisfiable if for no I, I |= Γ, i.e., Γ has no model

Proposition
For any finite set of formulas Γ, (i.e., Γ = {A1 , . . . , An } for some n ≥ 1), Γ is
valid (resp., satisfiable and unsatisfiable) if and only if A1 ∧ · · · ∧ An is valid
(resp., satisfiable and unsatisfiable).

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Validity check by truth tables: Example

We use the truth tables method to determine whether (p → q) ∨ (p → ¬q) is valid.

p q p→q ¬q p → ¬q (p → q) ∨ (p → ¬q)
True True True False False True
True False False True True True
False True True False True True
False False True True True True

The formula is valid since it is satisfied by every interpretation.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Satisfiablity check by truth tables: Example

We use the truth tables method to determine whether


(¬p ∨ q) ∧ (q → ¬r ∧ ¬p) ∧ (p ∨ r ) (denoted with ϕ) is satisfiable.

p q r ¬p ∨ q ¬r ∧ ¬p q → ¬r ∧ ¬p (p ∨ r ) ϕ
True True True True False False True False
True True False True False False True False
True False True False False True True False
True False False False False True True False
False True True True False False True False
False True False True True True False False
False False True True False True True True
False False False True True True False False

There exists an interpretation satisfying ϕ, thus ϕ is satisfiable.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Truth tables: Exercises

Use the truth table method to verify whether the following formulas are valid,
satisfiable or unsatisfiable:
(p → q) ∧ ¬q → ¬p
(p → q) → (p → ¬q)
(p ∨ q → r ) ∨ p ∨ q
(p ∨ q) ∧ (p → r ∧ q) ∧ (q → ¬r ∧ p)
(p → (q → r )) → ((p → q) → (p → r ))
(p ∨ q) ∧ (¬q ∧ ¬p)
(¬p → q) ∨ ((p ∧ ¬r ) ↔ q)
(p → q) ∧ (p → ¬q)
(p → (q ∨ r )) ∨ (r → ¬p)

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Logical consequence (or logical implication)

Definition (Logical consequence or logically implication)


A formula A is a logical consequence of (or, is logically implied by) a set of
formulas Γ (or, Γ logically implies A), denoted by Γ |= A, if every model of Γ is
also a model of A, i.e.,
for all I, I |= Γ implies I |= A.

We write |= A to mean ∅ |= A, i.e., to mean that A is valid. We write Γ ̸|= A


to mean that A is not logically implied by Γ. Thus, ̸|= A means A not valid.

Observation
Γ ̸|= A means that there exists at least one model of Γ where A is false.

If Γ1 and Γ2 are sets of formulas, we also define Γ1 |= Γ2 simply as Γ1 |= A for


every A ∈ Γ2 . Thus, ∅ |= Γ, ̸|= Γ, and Γ1 ̸|= Γ2 are defined accordingly.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Overloading of |=

Note that the symbol |= is overloaded:


when |= has an intepretation I on the left, then it means satisfaction, i.e.,
I |= α means that I satisfies α;
when |= has a formula or a set of formulas Γ on the left, then it means
logical implication, i.e., Γ |= α means that Γ logically implies α.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Logical equivalence

Definition (Logical equivalence)


Two formulas F and G are logically equivalent (denoted with F |==| G ) if
both F |= G and G |= F , i.e., for every interpretation I, I(F ) = I(G ) (in
other words, if the set of models of F and G coincide).

Logical equivalence is naturally extended to sets of formulas: Γ1 |==| Γ2 if


both Γ1 |= Γ2 and Γ2 |= Γ2 .
Sometimes, logical equivalence is denoted by the same symbol used for
“material equivalence”, i.e., ≡. However, it is important not to confuse the
two notions:
material implication and material equivalence are in the language of
propositional logic
logical implication and logical equivalence are in the meta-language, i.e.,
the language “speaking” about formulas of propositional logic, and are
therefore outside the language of propositional logic.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Exercises on logical implication

Check that the following logical implications hold


p |= p ∨ q
q ∨ p |= p ∨ q
{p ∨ q, p → r , q → r } |= r
{p → q, p} |= q

Hint: base your check on the definition of “satisfaction”, i.e., check that every
model of the formulas on the left is also a model of the formula on the right.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Solution: checking logical consequence in a direct manner

Verify that p |= p ∨ q Suppose that I |= p, then by definition I |= p ∨ q.


Verify that q ∨ p |= p ∨ q Suppose that I |= q ∨ p, then either I |= q or
I |= p. In both cases we have that I |= p ∨ q.
Verify that {p ∨ q, p → r , q → r } |= r Suppose that I |= p ∨ q and
I |= p → r and I |= q → r . Then either I |= p or I |= q. In the
first case, since I |= p → r , then I |= r , In the second case,
since I |= q → r , then I |= r .
Verify that {p → q, p} |= q Suppose that I |= p → q and I |= p. By the
semantics of →, I |= p → q means that I |= ¬p ∨ q. Therefore,
I |= q.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Logical consequence and equivalence using truth tables
Use the truth tables method to determine whether ¬p |= p ∧ ¬q → p ∧ q.

p q ¬p p ∧ ¬q p∧q p ∧ ¬q → p ∧ q
True True False False True True
True False False True False False
False True True False False True
False False True False False True

Use the truth tables method to determine whether p → (q ∧ ¬q) |==| ¬p.

p q q ∧ ¬q p → (q ∧ ¬q) ¬p
True True False False False
True False False False False
False True False True True
False False False True True

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Truth tables: exercises

Use the truth table method to determine whether the following logical consequences
and logical equivalences hold:
(p → q) |= ¬p → ¬q
(p → q) ∧ ¬q |= ¬p
p → q ∧ r |= (p → q) → r
p ∨ (¬q ∧ r ) |= q ∨ ¬r → p
¬(p ∧ q) |==| ¬p ∨ ¬q
(p ∨ q) ∧ (¬p → ¬q) |==| q
(p ∧ q) ∨ r |==| (p → ¬q) → r
(p ∨ q) ∧ (¬p → ¬q) |==| p
((p → q) → q) → q |==| p → q

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Properties of propositional logical consequence

Proposition
If Γ and Σ are two sets of propositional formulas, and A and B are two
formulas, then the following properties hold:
Reflexivity If A ∈ Γ, then Γ |= A
Ex falso sequitur quodlibet If Γ is unsatisfiable, then Γ |= A for all A
Monotonicity If Γ |= A then Γ ∪ Σ |= A
Cut If Γ |= A and Σ ∪ {A} |= B then Γ ∪ Σ |= B
Compactness If Γ |= A, then there is a finite subset Γ0 ⊆ Γ, such that Γ0 |= A
Deduction theorem If Γ ∪ {A} |= B then Γ |= A → B
Deduction principle Γ ∪ {A} |= B if and only if Γ |= A → B
Refutation principle Γ |= A if and only if Γ ∪ {¬A} is unsatisfiable

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Properties of propositional logical consequence
Reflexivity If A ∈ Γ, then Γ |= A.
PROOF: If A ∈ Γ, and I |= Γ, then obviously I |= A.
Ex falso sequitur quodlibet If Γ is unsatisfiable, then Γ |= A for all A
PROOF: Recall that Γ ̸|= A means that there is a model of Γ
where A is false. But if Γ is unsatisfiable there is no model of Γ,
and therefore it cannot be that Γ ̸|= A. Thus we conclude that
Γ |= A.
Monotonicity If Γ |= A then Γ ∪ Σ |= A
PROOF: Every model of Γ ∪ Σ is clearly a model Γ. Therefore, If
Γ |= A, then every model of Γ ∪ Σ is also a model of A, i.e.,
Γ ∪ Σ |= A.
Cut If Γ |= A and Σ ∪ {A} |= B then Σ ∪ Γ |= B.
PROOF: For all I, if I |= Γ ∪ Σ, then I |= Γ and I |= Σ. The
hypothesis Γ |= A implies that I |= A. Since I |= Σ, then
I |= Σ ∪ {A}. The hypothesis Σ ∪ {A} |= B, implies that
I |= B. We can therefore conclude that Σ ∪ Γ |= B.
Luciano Serafini – Maurizio Lenzerini Propositional Logic
Properties of propositional logical consequence

Compactness If Γ |= A, then there is a finite subset Γ0 ⊆ Γ, such that


Γ0 |= A.
PROOF: Let PA be the propositional variables occurring in A.
Let I1 , . . . , In (with n ≤ 2|PA | ), be all the interpretations of the
language PA that do not satisfy A. Since Γ |= A, then there
should be I1′ , . . . , In′ interpretations of the language of Γ, which
are extensions of I1 , . . . , In , and such that Ik′ ̸|= γk for some
γk ∈ Γ. Let Γ0 = {γ1 , . . . , γk }. Then Γ0 |= A. Indeed if I |= Γ0
then I is an extension of an interpretation J of PA that satisfies
A, and therefore I |= A.
Deduction theorem If Γ ∪ {A} |= B then Γ |= A → B
PROOF: Assume Γ ∪ {A} |= B. Consider an interpretation I,
and suppose that I |= Γ. If I ̸|= A, then I |= A → B. If instead
I |= A, then I |= Γ ∪ {A}. But since Γ ∪ {A} |= B, we conclude
that I |= B. We can therefore conclude that Γ |= A → B.

Luciano Serafini – Maurizio Lenzerini Propositional Logic


Properties of propositional logical consequence
Deduction principle Γ ∪ {A} |= B if and only if Γ |= A → B
PROOF: One direction coincides with the deduction theorem.
The other direction amount to prove that if Γ |= A → B, then
Γ ∪ {A} |= B. But Γ |= A → B means that every model of Γ is a
model of ¬A ∨ B. This means that every model of Γ where A is
true must have B true, and thus every model of Γ ∪ {A} is a
model of B, which means Γ ∪ {A} |= B.
Refutation principle Γ |= A if and only if Γ ∪ {¬A} is unsatisfiable
PROOF:
(=⇒) Suppose by contradiction that Γ ∪ {¬A} is satisfiable.
This implies that there is an interpretation I such that I |= Γ
and I |= ¬A, i.e., I ̸|= A. This contradicts that fact that for all
interpretations that satisfies Γ, they satisfy A
(⇐=) Let I |= Γ, then by the fact that Γ ∪ {¬A} is unsatisfiable,
we have that I ̸|= ¬A, and therefore I |= A. We can conclude
that Γ |= A.
Luciano Serafini – Maurizio Lenzerini Propositional Logic
Logic and questions
If we pose a dichotomic question in the form of a formula Q and we refer
to a specific intepretation I, then the formalization in logic corresponds
to checking whether I |= Q. It follows that we are dealing with evaluating
a formula (representing the Boolean question) in an interpretation, and
the possible answers are:
yes, if I |= Q
no, if I ̸|= Q
Example: “Did Juventus win the Champions League last year”? no
If we pose a dichotomic question in the form of a formula Q and we refer
to a set Σ of more than one interpretation, often denoted by a set of
formulas Γ whose models are exactly those interpretations in Σ, then the
formalization in logic corresponds to provide an account of whether
Γ |= Q. It follows that we are dealing with logical implication, and the
possible answers are:
yes, if Γ |= Q (Q is true in every model of Γ)
no, if Γ |= ¬Q (Q is false in every model of Γ)
don’t know, if Γ ̸|= Q and Γ ̸|= ¬Q
Example: If Γ represents all we know today, “Will A.S. Roma win the
Champions League next year”? don’t know
Luciano Serafini – Maurizio Lenzerini Propositional Logic
Logical implication and formal reasoning
We discuss two basic forms of reasoning based on semantics, i.e., based on
logical implication.
Deductive reasoning (deduction) via logical implication
Deductive reasoning allows us to conclude A on the basis of a set of
formulas Γ, by checking whether the formula A can be deduced from a set
of formulas Γ, i.e., by checking whether
Γ |= A
Abductive reasoning (abduction) via logical implication
Abductive reasoning allows us to conclude that a formula can be used to
deduce another formula A in the context of a background knowledge
represented by a set of formulas Γ (that does not logically imply A), by
checking whether there esists a formula B such that:
Γ ∪ {B} is satisfiable, and
Γ ∪ {B} |= A
In other words, we are checking whether B can be abduced from A (or,
can be used for explaining A) in the context of Γ. Usually, we additionally
impose that the formula B belongs to a certain class.
Luciano Serafini – Maurizio Lenzerini Propositional Logic
Logical implication and argumentation

We discuss two basic forms of argumentation and its formalization using


logical implication.
Support
To support a sentence S while arguing, one can exhibit a set of sentences
Γ (accepted as valid) that logically implies S
Γ supports S if Γ |= S
Example: “Paolo è maggiorenne” is supported by “Paolo ha la patente”
and “patente → maggiorenne”.
Refutation
To refute a sentence S while arguing, one can exhibit a set of sentences Γ
(accepted as valid) that logically implies the negation of S
Γ refutes S if Γ |= ¬S
Example: “Paolo è minorenne” is refuted by “Paolo ha la patente”,
“patente → maggiorenne”, “maggiorenne → ¬ minorenne”.

Luciano Serafini – Maurizio Lenzerini Propositional Logic

You might also like