0% found this document useful (0 votes)
201 views55 pages

I2209 Propositional Logic

The document discusses propositional logic and logical reasoning. It defines logic and propositional logic, describes the vocabulary and syntax of propositional logic, and discusses semantic concepts like truth tables, interpretations, models and literals. It provides an example truth table and discusses logically equivalent formulas and the converse, inverse and contrapositive of conditional formulas.
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)
201 views55 pages

I2209 Propositional Logic

The document discusses propositional logic and logical reasoning. It defines logic and propositional logic, describes the vocabulary and syntax of propositional logic, and discusses semantic concepts like truth tables, interpretations, models and literals. It provides an example truth table and discusses logically equivalent formulas and the converse, inverse and contrapositive of conditional formulas.
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/ 55

I2209

Introduction
to Logic and
Logic
Programming

Rami
EL-BAÏDA I2209 Introduction to Logic and Logic
Summary Programming
What is Logic Propositional Logic
Propositional
Logic

Logical
Reasoning Rami EL-BAÏDA
Quine and
Reduction
Algorithms

Normal Forms
March 01, 2020
Resolution
Principle

Tree Method
I2209
Introduction
to Logic and
Logic 1 What is Logic
Programming

Rami
EL-BAÏDA 2 Propositional Logic
Summary
3 Logical Reasoning
What is Logic

Propositional
Logic 4 Quine and Reduction Algorithms
Logical
Reasoning
5 Normal Forms
Quine and
Reduction
Algorithms
6 Resolution Principle
Normal Forms

Resolution
Principle 7 Tree Method
Tree Method
What is Logic

I2209
Introduction
to Logic and
Logic
Programming

Rami
EL-BAÏDA
Logic is a language for reasoning.
Summary
It is a collection of rules that we use when doing logical
What is Logic

Propositional
reasoning
Logic
Human reasoning has been observed over centuries from
Logical
Reasoning at least the times of Greeks, and patterns appearing in
Quine and reasoning have been extracted and abstracted
Reduction
Algorithms

Normal Forms

Resolution
Principle

Tree Method
What is Propositional Logic

I2209
Introduction A propositional logic is a formal mathematical system for
to Logic and
Logic reasoning about propositions (allow the study of
Programming
propositions)
Rami
EL-BAÏDA A proposition is a statement or sentence that is either true
Summary
or false
What is Logic
Example:
Propositional p: The prof looks tired
Logic q: We’re hungry and not able to eat
Logical
Reasoning An atomic proposition cannot be further subdivided (p)
Quine and A compound proposition can be subdivided (q)
Reduction
Algorithms h: We are hungry
Normal Forms e: We are able to eat
Resolution The logical connectives ”and” and ”not” determine how
Principle the atomic proposition affects q:
Tree Method
q : h ∧ ¬e
Vocabulary of Propositional Logic

I2209
Introduction
to Logic and
Logic
Programming 1 An infinite set of propositions designated by a letter,
Rami eventually indexed: p, q, p1 , ...
EL-BAÏDA
2 A set of logic connectives
Summary
Name Usual Symbol Other symbols
What is Logic

Propositional
Negation ¬ − , ∼, not

Logic Conjunction ∧ &, ., and


Logical
Reasoning
Disjunction ∨ |, or
Quine and Implication → ⇒, ⊃
Reduction
Algorithms Equivalence ↔ ⇔, ≡
Normal Forms
3 (, )
Resolution
Principle Formula is obtained by using 1, 2, 3, and some rules
Tree Method
Syntax of Propositional Logic

I2209
Introduction
to Logic and
Logic
Programming
Rules to obtain a wff (well-formed formula1 )
Rami
EL-BAÏDA 1 Any atomic or elementary proposition is a wff
Summary
2 True (T ) and False (F ) are wff
3 If A is a wff, then (A) is a wff
What is Logic
4 If A and B are wffs, then ¬A, A ∧ B, A ∨ B, A → B
Propositional
Logic A ↔ B are wffs.
Logical 5 A wff is exclusively obtained by applying 1, 2, 3, and 4
Reasoning
Example:
Quine and
Reduction (¬A) → (B ∨ C ) is a wff
Algorithms
(A ∨ BC ( is not a wff
Normal Forms

Resolution
Principle

Tree Method

1
Compound or Complex proposition
Syntax of Propositional Logic (cont.)

I2209
Introduction
For ease of reading, there is some rules to eliminate the ()
to Logic and
Logic
Elimination of external ()
Programming Use the precedence conventions (higher order have a
Rami tighter binding):
EL-BAÏDA
stronger
Summary

What is Logic

Propositional
Logic

Logical
Reasoning
weaker
Quine and
Reduction
Algorithms
Association from left to right of the same connector
Normal Forms
a ∨ b ∨ c ≡ ((a ∨ b) ∨ c)
Resolution
Principle So the formula ((p → (q ∨ r )) ∧ ((¬q) ↔ (T ∨ p))) could
Tree Method be written as: (p → q ∨ r ) ∧ (¬q ↔ T ∨ p)
But the expression p ∧ q ∨ r would be ambiguous
Semantic of Propositional Logic

I2209
Introduction
to Logic and
Logic
Programming

Rami
EL-BAÏDA
Give a meaning to a wff in the semantics’ domain {T , F }
Summary
Interpret a wff ≡ Assign one of the 2 values
What is Logic

Propositional
Compositional semantic (value of wff depends on its
Logic
constituents)
Logical
Reasoning Teri-functional connectives: value of (x ∨ y ) known as
Quine and soon as values of x and y are known
Reduction
Algorithms

Normal Forms

Resolution
Principle

Tree Method
Truth Table

I2209
Introduction
to Logic and
Logic
Programming
The truth values of a formula and its constituents can be
Rami
represented by a table, called a truth table
EL-BAÏDA
X ¬X
Summary

What is Logic
T F
Propositional
F T
Logic

Logical X Y X ∧Y X ∨Y X →Y X ↔Y
Reasoning
T T T T T T
Quine and
Reduction T F F T F F
Algorithms
F T F T T F
Normal Forms

Resolution
F F F F T T
Principle

Tree Method
Interpretation, Model, and Literal

I2209
Introduction
to Logic and
Logic
Programming

Rami
EL-BAÏDA
An interpretation function, or interpretation, is a function
Summary
I that associates to each proposition p a truth value.
What is Logic

Propositional
An interpretation that makes a formula true is a model of
Logic that formula.
Logical
Reasoning A literal is an elementary proposition or the negation of a
Quine and proposition; literals p and ¬p are opposes.
Reduction
Algorithms

Normal Forms

Resolution
Principle

Tree Method
Example

I2209
Introduction
to Logic and
Logic
Programming
f : (p → (q → r )) ≡ ((p ∧ q) → r )
Rami
EL-BAÏDA

Summary
p q r q→r p → (q → r ) p∧q (p ∧ q) → r f
What is Logic
T T T T T T T T
Propositional
Logic T T F F F T F T
Logical T F T T T F T T
Reasoning
T F F T T F T T
Quine and
Reduction
F T T T T F T T
Algorithms F T F F T F T T
Normal Forms F F T T T F T T
Resolution F F F T T F T T
Principle

Tree Method
Logical Equivalent Formulas

I2209
Introduction
to Logic and
Logic
Programming

Rami
EL-BAÏDA Two formulas A and B are logically equivalent (written
Summary
A ∼ B), if and only if, they have identical truth values for
What is Logic
each possible substitution of formulas for their variables
Propositional For example: ¬¬P ∼ P
Logic

Logical P ¬P ¬¬P
Reasoning
T F T
Quine and
Reduction F T F
Algorithms

Normal Forms

Resolution
Principle

Tree Method
Converse, Inverse, and Contrapositive of
Conditional Formula
I2209
Introduction
to Logic and
Logic
For the formula A → B, the formula B → A is called its
Programming converse, the formula ¬A → ¬B is its inverse, and the
Rami
EL-BAÏDA
formula ¬B → ¬A is its contrapositive
For example, ”If it rains, then I get wet”.
Summary
The converse is: ”If I get wet, then it rains”.
What is Logic
The contrapositive: ”If I don’t get wet, then it does not
Propositional
Logic rain”.
Logical
Reasoning
The converse (inverse) of a formula is not logically
Quine and
equivalent to the formula.
Reduction
Algorithms The converse and the inverse of a conditional statement
Normal Forms are logically equivalent to each other.
Resolution
Principle The contrapositive of a formula is always logically
Tree Method equivalent to the formula.
Truth table of Contrapositive

I2209
Introduction
to Logic and
Logic
Programming

Rami
EL-BAÏDA

Summary
A B A→B ¬B ¬A ¬B → ¬A
What is Logic T T T F F T
Propositional T F F T F F
Logic
F T T F T T
Logical
Reasoning F F T T T T
Quine and
Reduction
Algorithms

Normal Forms

Resolution
Principle

Tree Method
From English to Propositional Logic

I2209
Introduction
to Logic and
Logic
Programming English sentences
Rami
EL-BAÏDA
1 ”It is not hot but it is sunny”
2 ”It is neither hot nor sunny”
Summary
Let p be the proposition: ”It is hot”, q be the proposition:
What is Logic
”It is sunny”
Propositional
Logic 1 ¬p ∧ q
Logical 2 ¬p ∧ ¬q
Reasoning
Suppose x is a number, Let p, q, and r be: ”0 < x”,
Quine and
Reduction ”x < 3”, and ”x = 3” respectively
Algorithms

Normal Forms
1 x ≤3 2 0<x <3 3 0<x ≤3
Resolution
q∨r p∧q p ∧ (q ∨ r )
Principle

Tree Method
From English to Propositional Logic (cont.)

I2209
Introduction
to Logic and
”I will go to the beach if it is not snowing” or ”If it is not
Logic
Programming
snowing, I will go to the beach”
Rami Let p be the proposition ”It is snowing”, q be the
EL-BAÏDA
proposition ”I will go to the beach”,
Summary
Then symbols p and q are substituted for the respective
What is Logic
sentence to obtain
Propositional
Logic ¬p → q
Logical
Reasoning ”If it is not snowing and I have time, then I will go to the
Quine and beach”,
Reduction
Algorithms
Let r be the proposition ”I have time”
Normal Forms

Resolution
The sentence can be converted to
Principle

Tree Method (¬p ∧ r ) → q


Many ways to say: A → B

I2209
Introduction
to Logic and
Logic
Programming
If A, then B
Rami
EL-BAÏDA A implies B
Summary A, therefore B
What is Logic
A only if B
Propositional
Logic B follows from A
Logical
Reasoning B whenever A
Quine and B if A
Reduction
Algorithms
A is a sufficient condition for B
Normal Forms

Resolution
B is a necessary condition for A
Principle

Tree Method
Propositional Calculus and Natural Language

I2209
Introduction
to Logic and
Logic Five connectors have ”equivalents” in natural language
Programming
(NL)
Rami
EL-BAÏDA Ressemblance limit between logical connectors and those
Summary
of NL
What is Logic NL: ”not”, ”and”, ”or”, ”if ... then”, ”if and only if” are
Propositional veri-functional
Logic

Logical
Reasoning The weather is good or it He took fright and killed
Quine and is raining the thief
Reduction
Algorithms
It is raining or the weather He killed the thief and
Normal Forms
is good took fright
Resolution
Principle Synonyms Not synonyms because of
Tree Method causal and temporal nuance
Propositional Calculus and Natural Language
(cont.)
I2209
Introduction
to Logic and
Logic
Programming

Rami
It is raining (proposition p)
EL-BAÏDA
The ground is wet (proposition q)
Summary

What is Logic q because of p (admissible)


Propositional
Logic
p because of q (not admissible)
Logical
Reasoning
An integer number is even or odd
Quine and
Reduction
Algorithms
(exclusive or)
Normal Forms

Resolution
Principle

Tree Method
Propositional Calculus and Natural Language
(cont.)
I2209
Introduction
to Logic and
Logic
Programming

Rami
EL-BAÏDA Implication (mathematical reasoning)
antecedent → consequent
Summary

What is Logic
Rules:
Propositional If the first operand is true, the truth value is that of the
Logic
second operand
Logical
Reasoning
The truth value depend on both operands
Connector is not commutative
Quine and
Reduction
Algorithms Material implication
Normal Forms

Resolution
Principle

Tree Method
Propositional Calculus and Natural Language
(cont.)
I2209
Introduction
to Logic and
Logic
Programming

Rami
EL-BAÏDA
The truth table of a connector with n operands has 2n
Summary lines
What is Logic All connectors can be expressed using ¬ and →
Propositional
Logic
(A ∨ B) ≡ (¬A → B),
Logical
(A ∧ B) ≡ ¬(A → ¬B),
Reasoning (A ↔ B) ≡ ((A → B) ∧ (B → A))
Quine and
Reduction We read ≡ as a definition symbol
Algorithms

Normal Forms

Resolution
Principle

Tree Method
Propositional Calculus and Natural Language
(cont.)
I2209
Introduction
to Logic and
Logic
Programming

Rami Any other connector can be defined using these five


EL-BAÏDA connectors
Summary Exclusive disjunction of A and B
What is Logic

Propositional
(A ∧ ¬B) ∨ (¬A ∧ B)
Logic

Logical If A then B else C


Reasoning

Quine and (A → B) ∧ (¬A → C )


Reduction
Algorithms

Normal Forms
The only two connectors of 0 operand are T and F
Resolution
Principle

Tree Method
Consistent and Valid Formula

I2209
Introduction
to Logic and
Logic
Programming
A formula is consistent, if it has a model (we can interpret
Rami it to the value T )
EL-BAÏDA
Ex: (p ∧ q) and (p ∨ q) are consistent (true if p and q are
Summary true)
What is Logic
A non consistent formula is called inconsistent or a
Propositional
Logic contradiction.
Logical
Reasoning Ex: (p ∧ ¬p) is inconsistent
Quine and A formula is valid if it is always true, independently from
Reduction
Algorithms truth values assigned to its propositions
Normal Forms
Ex: (p ∨ ¬p), (p → p) and (¬¬p ≡ p)
Resolution
Principle A non valid formula is sometimes called invalid
Tree Method
Consistency and Validity

I2209
Introduction
to Logic and
Logic
Programming The negation of a valid formula is inconsistent
Rami
EL-BAÏDA The negation of a consistent formula is invalid
Summary
A contingent formula is neither valid, nor inconsistent
What is Logic A formula that has k different propositions has 2K
Propositional interpretations
Logic

Logical Using these 2k interpretations, we can immediately


Reasoning
determine if the formula is consistent, valid, contingent,
Quine and
Reduction invalid, or inconsistent
Algorithms

Normal Forms
The formula (f ) is valid
Resolution Formulas (p ∧ q) and (p → (q → r )) are contingents
Principle

Tree Method
Tautology and Logical Consequence

I2209
Introduction A tautology is a valid formula of propositional calculus
to Logic and
Logic
Programming Notation: |= A
Rami
EL-BAÏDA

Summary Example: p ∨ ¬p is always true regardless of the truth


What is Logic value of the proposition p
Propositional A contradiction is a formula that is always false
Logic
Example: p ∧ ¬p is always false regardless of the truth
Logical
Reasoning value of the proposition p
Quine and
Reduction
A formula A is a logical Consequence of a set of formulas
Algorithms E if any interpretation that makes true all formulas in E
Normal Forms makes A true
Resolution
Principle
Notation: E ⊢ A
Tree Method

B ⊢ A ⇔|= (B → A) (CNS)
Tautological Equivalences

I2209
Introduction Idempotence properties
to Logic and
Logic A∨A ≡A A∧A ≡A
Programming

Rami
Commutative properties
EL-BAÏDA A∨B ≡ B ∨A A∧B ≡B ∧A
Summary Associative properties
What is Logic (A ∨ B) ∨ C ≡ A ∨ (B ∨ C ) (A ∧ B) ∧ C ≡ A ∧ (B ∧ C )
Propositional
Logic Distributive properties
Logical A∨(B ∧C ) ≡ (A∨B)∧(A∨C ) A∧(B ∨C ) ≡ (A∧B)∨(A∧C )
Reasoning

Quine and Identity properties


Reduction
Algorithms A ∨ false ≡ A A ∧ true ≡ A
Normal Forms Complement properties
Resolution
Principle
A ∨ ¬A ≡ true A ∧ ¬A ≡ false
Tree Method De Morgan’s Law
¬(A ∨ B) ≡ ¬A ∧ ¬B ¬(A ∧ B) ≡ ¬A ∨ ¬B
Tautological Equivalences (cont.)

I2209
Introduction Absorption
to Logic and
Logic A ∨ (A ∧ B) ≡ A A ∧ (A ∨ B) ≡ A
Programming

Rami
Double negation
EL-BAÏDA A ≡ ¬(¬A)
Summary Implication
What is Logic (A → B) ≡ (¬A ∨ B)
Propositional
Logic Equivalence
Logical A ↔ B ≡ [(A → B) ∧ (B → A)]
Reasoning

Quine and Exportation


Reduction
Algorithms [(A ∧ B) → C ] ≡ [A → (B → C )]
Normal Forms Absurdity
Resolution
Principle
[(A → B) ∧ (A → ¬B)] ≡ ¬A
Tree Method Contrapositive
(A → B) ≡ (¬B → ¬A)
Prove Logical Equivalences

I2209
Introduction
to Logic and
Logic
Programming

Rami
EL-BAÏDA
Using truth table
E.g., to prove De Morgan’s Law
Summary

What is Logic
A B ¬B ¬A ¬(A ∨ B) ¬A ∧ ¬B
Propositional
Logic T T F F F F
Logical
Reasoning
T F T F F F
Quine and
F T F T F F
Reduction
Algorithms
F F T T T T
Normal Forms

Resolution
Principle

Tree Method
Logical Reasoning

I2209
Introduction
to Logic and
Logic
Programming

Rami
EL-BAÏDA
Logical reasoning is the process of drawing conclusions
from premises using rules of inference
Summary

What is Logic
These inference rules are results of observations of human
Propositional
reasoning over centuries
Logic
They have contributed significantly to the scientific and
Logical
Reasoning engineering progress of the mankind
Quine and
Reduction
Today they are universally accepted as the rules of logical
Algorithms
reasoning and they should be followed in our reasoning
Normal Forms

Resolution
Principle

Tree Method
Reasoning with Propositions

I2209
Introduction
The basic inference rule is modus ponens. It states that if
to Logic and
Logic
both A → B and A hold, then B can be concluded, and it
Programming is written as
Rami A, A → B
EL-BAÏDA
∴B
Summary A and A → B are premises and B is the conclusion drawn
What is Logic from premises.
Propositional modus tollens
Logic
¬B, A → B
Logical
Reasoning ∴ ¬A
Quine and Conjunctive Simplification
Reduction
Algorithms A∧B
Normal Forms
∴A
Resolution
Principle Conjunctive Addition
Tree Method A, B
∴ A∧B
Reasoning with Propositions (cont.)

I2209
Introduction
Rule of contradiction
to Logic and ¬A → c
Logic
Programming
, where c is a contradiction
∴A
Rami
EL-BAÏDA
Disjunctive Addition
Summary
A
What is Logic ∴ A∨B
Propositional Disjunctive Syllogism
Logic
A ∨ B, ¬B
Logical
Reasoning ∴A
Quine and
Reduction
Hypothetical Syllogism
Algorithms
A → B, B → C
Normal Forms
∴A→C
Resolution
Principle Dilemma: proof by division into cases
Tree Method
A ∨ B, A → C , B → C
∴C
A Complex Example

I2209
Introduction
to Logic and
Logic 1 if my glasses are on the kitchen table, then I saw them at
Programming
breakfast.
Rami
EL-BAÏDA 2 I was reading the newspaper in the living room or I was
Summary reading the newspaper in the kitchen.
What is Logic 3 If I was reading the newspaper in the living room, then my
Propositional
Logic
glasses are on the coffee table.
Logical 4 I did not see my glasses at breakfast.
Reasoning

Quine and
5 If I was reading my book in bed, then my glasses are on
Reduction
Algorithms
the bed table.
Normal Forms 6 If I was reading the newspaper in the kitchen, then my
Resolution glasses are on the kitchen table.
Principle

Tree Method Where are the glasses?


Translate them into Formulas

I2209
Introduction
to Logic and
Logic p = my glasses are on the kitchen table
Programming
q = I saw my glasses at breakfast
Rami
EL-BAÏDA
r = I was reading the newspaper in the living room
Summary s = I was reading the newspaper in the kitchen
What is Logic
t = my glasses are on the coffee table
Propositional
Logic
u = I was reading my book in bed
Logical
Reasoning v = my glasses are on the bed table.
Quine and
Reduction Statements in the previous slide are translated as follows:
Algorithms

Normal Forms 1 p→q 4 ¬q


Resolution
2 r ∨s 5 u→v
Principle

Tree Method 3 r →t 6 s→p


Deduction

I2209
Introduction
to Logic and
Logic p→q by (1)
Programming
¬q by (4)
Rami
EL-BAÏDA ∴ ¬p by modus tollens
Summary s →p by (6)
What is Logic ¬p by the conclusion above
Propositional ∴ ¬s by modus tollens
Logic

Logical
r ∨s by (2)
Reasoning
¬s by the conclusion above
Quine and
Reduction ∴r by disjunctive syllogism
Algorithms

Normal Forms
r →t by (3)
Resolution
r by the conclusion above
Principle ∴t by modus ponens
Tree Method
Deduction problem and Deduction principle

I2209
Introduction Deduction problem: Establish if a formula C is a logical
to Logic and
Logic consequence of a set E of formulas
Programming

Rami
EL-BAÏDA
{H1 , ..., Hn } |= C ⇐⇒|= {H1 , ..., Hn } → C
Summary
A Set E is semantically consistent if all its elements have
What is Logic
a common model; if not, it is inconsistent. A set of
Propositional
Logic formulas is then assimilated, from a semantic point of view
Logical to the conjunction of its elements
Reasoning

Quine and
Deduction principle: C is a logical consequence of a finite
Reduction
Algorithms
set E iff E ∪ {¬C } is inconsistent
Normal Forms E is inconsistent iff F (false) is a logical consequence, or if
Resolution each formula is a logical consequence
Principle

Tree Method
{H1 , ..., Hn } ⊢ C ⇐⇒ {H1 , ..., Hn, ¬C } ⊢ F
Uniform Substitution

I2209
Introduction
to Logic and
Logic A and B are logical consequence one from the other
Programming
(logically equivalent) iff the formula (A ↔ B) is a
Rami
EL-BAÏDA tautology.
Summary Substitution means uniform substitution of formulas for
What is Logic variables.
Propositional
Logic
F (H1 , ..., Hn ) means: substitute Hi for each occurrence of
Logical
Pi in F (P1 , ..., Pn ).
Reasoning
Example: if F (p, q) is p → (q → p) then F (¬p ∨ r , ¬p) is
Quine and
Reduction ¬p ∨ r → (¬p → ¬p ∨ r )
Algorithms

Normal Forms
Rule of uniform substitution: if X is a tautology, p a
Resolution proposition and A a formula, then the statement obtained
Principle
by replacing p by A in X is a tautology
Tree Method
Algorithmic point of view

I2209
Introduction
to Logic and
Logic
Programming Algorithm: a set of instructions (orders) allowing to realize
Rami a given task
EL-BAÏDA
Task: verify the consistency or the validity of a formula
Summary

What is Logic
Definition: Given a finite set of propositions, noted
P = {p1 , ..., pn , ...}, a semantic tree is a binary tree
Propositional
Logic respecting the following conditions:
Logical Each arc is labeled by a literal (positive or negative) issued
Reasoning
from P
Quine and
Reduction Literals labeling two arcs issued from the same node are
Algorithms opposed
Normal Forms No branch has more than one occurrence of each literal
Resolution No branch has a pair of opposed literals
Principle

Tree Method
Algorithmic point of view (cont.)

I2209
Introduction
to Logic and
Logic
Programming

Rami
EL-BAÏDA

Summary

What is Logic

Propositional
Logic

Logical
Reasoning

Quine and
Reduction
Algorithms

Normal Forms

Resolution Figure: Example of a semantic tree


Principle

Tree Method
Algorithmic point of view (cont.)

I2209
Introduction
to Logic and
If P is finite, any semantic tree is then finite.
Logic
Programming If P is infinite, then there exists finite and infinite semantic
Rami trees. An infinite binary tree has at least one infinite
EL-BAÏDA
branch.
Summary
To each node N of a semantic tree correspond a partial
What is Logic
interpretation (function IN associating a truth value to
Propositional
Logic some elements in P). The partial interpretation IN assign
Logical the value T (F ) to proposition p if an arc of the path
Reasoning
connecting N to the root is labeled by p (¬p); it is not
Quine and
Reduction defined for p if neither p nor ¬p appear on that path.
Algorithms

Normal Forms A finite semantic tree is complete if each leaf corresponds


Resolution to a total interpretation (defined everywhere).
Principle

Tree Method
An infinite semantic tree is complete if each branch issued
from the root establish a total interpretation.
Algorithmic point of view (cont.)

I2209
Introduction
to Logic and
Logic
Programming

Rami
EL-BAÏDA Is the formula A consistent or satisfiable?
Summary Let’s consider the complete semantic tree composed of all
What is Logic propositions (finite) in A. For each leaf, we evaluate A
Propositional
according to corresponding interpretation.
Logic The formula is consistent if for at least one leaf, the value
Logical obtained is true.
Reasoning
Pb: inefficient algorithm: A has n different propositions
Quine and
Reduction ⇒ 2n interpretations to consider.
Algorithms

Normal Forms

Resolution
Principle

Tree Method
Quine Algorithm

I2209
Introduction
to Logic and
Logic
Programming

Rami
EL-BAÏDA Optimization of trivial algorithm
Summary
If all possible extensions of a partial interpretation
What is Logic
attribute the same truth value to the formula tested, then
there is no need to construct the sub-graph issued from
Propositional
Logic the node corresponding to this partial interpretation
Logical
Reasoning
Ex: For (p ∨ q ∨ r ) every path having a positive literal
Quine and correspond to an interpretation that makes the formula
Reduction
Algorithms true.
Normal Forms

Resolution
Principle

Tree Method
Quine Algorithm

I2209
Introduction
to Logic and
Example:
Logic
Programming
[((p ∧ q) → r ) ∧ (p → q)] → (p → r )
Rami
EL-BAÏDA

Summary
1 Order the set {p, q, r }
What is Logic
2 First consider interpretations that make p true. Thus
Propositional
Logic
partially interpreted, the formula becomes
Logical
Reasoning [(q → r ) ∧ q] → r
Quine and
Reduction 3 If now q has the value true, we obtain (r → r ) which is
Algorithms
valid; on the contrary, if q is assigned to false, we got
Normal Forms
F → r ), which is also valid.
Resolution
Principle 4 After consider the interpretations that make p false. The
Tree Method
formula becomes [(F → r ) ∧ T ] → T , which is always true.
⇒ The formula is valid
Quine Algorithm (cont.)

I2209
Introduction
to Logic and
Logic
Programming

Rami
EL-BAÏDA

Summary

What is Logic

Propositional
Logic

Logical
Reasoning

Quine and
Reduction
Algorithms

Normal Forms
Figure: Incomplete semantic tree
Resolution
Principle

Tree Method
Quine Algorithm (cont.)

I2209
Introduction
to Logic and
Logic
Programming

Rami
EL-BAÏDA

Summary

What is Logic

Propositional
Logic

Logical
Reasoning

Quine and
Reduction
Algorithms

Normal Forms

Resolution Figure: Complete semantic tree


Principle

Tree Method
Reduction Algorithm

I2209
Introduction
Prove by contradiction the validity of a formula
to Logic and
Logic
Advantageous when the formula has numerous
Programming
implications
Rami
EL-BAÏDA [(p ∧ q) → r ] → [p → (q → r )]
Summary
Suppose that an interpretation I assign the value F to this
What is Logic
formula. From the truth table of the implication, a
Propositional
Logic conditional is false if and only if the second part is false
Logical and the first part is true. we deduce that
Reasoning

Quine and I ((p ∧ q) → r ) = T , I (p → (q → r )) = F


Reduction
Algorithms
The same rule, applied to the first line, establish I ; we
Normal Forms
obtain:
Resolution
Principle I (p) = T , I (q) = T , I (r ) = F
Tree Method
⇒ contradiction with I ((p ∧ q) → r ) = T . This contadiction
prove the validity of the formula
Normal Forms

I2209
Introduction
to Logic and Clauses and Conjunctive Normal Form
Logic
Programming A clause is the disjunction of a finite number of literals, i.e.
Rami a formula of type (l1 ∨ l2 ... ∨ ln )
EL-BAÏDA
The empty clause is the only inconsistent clause (F of [])
Summary A conjunctive normal form is a conjunction of a finite
What is Logic number of clauses
Propositional Every formula A has a conjunctive normal form that is
Logic logically equivalent to A
Logical
Reasoning Cube and Disjunctive Normal Form
Quine and A cube is the conjunction of a finite number of literals, i.e.
Reduction
Algorithms
a formula of type (l1 ∧ l2 ... ∧ ln )
Normal Forms
A disjunctive normal form is a disjunction of a finite
Resolution
number of cubes
Principle Every formula A has a disjunctive normal form that is
Tree Method logically equivalent to A
Normal Form (cont.)

I2209
Introduction Normalization Algorithm
to Logic and
Logic Replace X ↔ Y by (X → Y ) ∧ (Y → X )
Programming
Replace X → Y by ¬X ∨ Y
Rami
EL-BAÏDA
Apply De Morgan’s Theorem: Replace
¬(X ∧ Y ) by ¬X ∨ ¬Y and
Summary
¬(X ∨ Y ) by ¬X ∧ ¬Y
What is Logic Replace ¬¬X by X
Propositional
Logic
Apply the distributivity rules: Replace
X ∨ (Y ∧ Z ) by (X ∨ Y ) ∧ (X ∨ Z ) and
Logical
Reasoning X ∧ (Y ∨ Z ) by (X ∧ Y ) ∨ (X ∧ Z )
Quine and
Reduction
Example:
Algorithms

Normal Forms (p → (q → r )) → ((p ∧ s) → r )


Resolution
Principle
becomes
Tree Method
q ∨ ¬p ∨ ¬s ∨ r
Davis and Putnam Algorithm

I2209
Introduction
to Logic and
Logic
Programming
Goal: Tell if a set S of clauses is consistent or inconsistent
Rami if S = ∅, then S is consistent
EL-BAÏDA
if S = {F }, then S is inconsistent
Summary
Else,
What is Logic
select a proposition p in S
Propositional ′′
Logic calculate Sp , S¬p and S = S \ {Sp ∪ S¬p )

Logical obtain S p whose clauses are those of Sp without the
Reasoning
literal p
Quine and ′
Reduction obtain S ¬p whose clauses are those of S¬p without the
Algorithms literal ¬p
Normal Forms ′ ′′
Then, the set S is inconsistent iff sets (S p ∪ S ) and
Resolution ′ ′′
Principle (S ¬p ∪ S ) are inconsistents
Tree Method
Davis and Putnam Algorithm (cont.)

I2209
Introduction
to Logic and
Logic
Programming

Rami
EL-BAÏDA
Select p in priority in each following cases:
Summary
S contains one of clauses with literal p or ¬p
What is Logic
Only one of literals p and ¬p appears in S
Propositional
Logic Examples:
Logical S = {p ∨ q, p ∨ r , ¬q ∨ ¬r , ¬p}
Reasoning
{h, h → (p ∨ q), p → c, q → c} ⊢ c
Quine and
Reduction
Algorithms

Normal Forms

Resolution
Principle

Tree Method
Resolution Principle

I2209
Introduction
Used to verify the inconsistency of a set of clauses
to Logic and
Logic S is inconsistent iff the empty clause [] is a logical
Programming
consequence of S
Rami
EL-BAÏDA Method: Engender logical consequences of S till obtaining
the empty clause
Summary

What is Logic
Resolution rule: {A ∨ X , B ∨ ¬X } ⊢ A ∨ B
Propositional s1 ∈ S and s2 ∈ S and l is a literal. If l ∈ s1 and ¬l ∈ s2 ,
Logic
then the clause R = (s1 \ {l }) ∨ (s2 \ {¬l }) is a logical
Logical
Reasoning consequence of the normal form of S
Quine and S and S ∪ {r } are equivalents
Reduction
Algorithms r is called the resolvant of s1 and s2
Normal Forms
Algorithm:
Resolution While [] 6∈ S,
Principle
choose l, s1 , s2 such that l ∈ s1 and ¬l ∈ s2 ;
Tree Method
calculate the resolvant clause r ;
replace S with S ∪ {r }.
Resolution Applications

I2209
Introduction
to Logic and
Logic
Programming

Rami
To prove that C is a logical consequence of {H1 , ..., Hn },
EL-BAÏDA we apply the resolution principle to {H1 , ..., Hn , ¬C }.
Summary Hypotheses and the negation of the conclusion should be
What is Logic clauses.
Propositional
Logic Proof = suite of elementary reasoning, where the last
Logical element is the conclusion []
Reasoning

Quine and
The relation between steps is a partial order relation ⇒
Reduction
Algorithms
proof = tree
Normal Forms Example: {h, ¬h ∨ p ∨ q, ¬p ∨ c, ¬q ∨ c} ⊢ c
Resolution
Principle

Tree Method
Tree Method

I2209
Introduction
to Logic and
Logic
Programming

Rami Also called ”Tableau Method”


EL-BAÏDA
An analytic proof method: complex formulas are
Summary
decomposed into simpler forumulas
What is Logic

Propositional
Link with proof by reduction: To prove that C follows
Logic from H1 , ..., Hn , show that ¬C is inconsistent with all of
Logical
Reasoning
H1 , ..., Hn
Quine and There is two types of formulas:
Reduction
Algorithms Alpha type: give only one successor
Normal Forms Beta type: give two successors
Resolution
Principle

Tree Method
Tree Method (cont.)

I2209
Introduction
to Logic and
Logic
Programming

Rami
EL-BAÏDA

Summary

What is Logic

Propositional
Logic

Logical
Reasoning

Quine and
Reduction
Algorithms

Normal Forms

Resolution
Principle

Tree Method
Figure: Decomposing Rules
Tree Construction

I2209
Introduction
to Logic and
To prove that H1 , ..., Hn ⊢ C , build the root tree
Logic
Programming
H1 , ..., Hn , ¬C
Rami Extend the root tree by applying the decomposing rules to
EL-BAÏDA
the first root formula, and iterate until no further
Summary extension can be done from that formula (mark it then)
What is Logic
If a branch contains a formula and its negation: close it off
Propositional
Logic (by X)
Logical
Reasoning
Repeat step 2 from branches that are still open with the
Quine and
next root formula
Reduction
Algorithms Stop when all branches are closed, or when all root
Normal Forms formulas have been used
Resolution
Principle
Example:
Tree Method Show that ¬p ∨ ¬q follows from p → r , q → s, ¬r ∨ ¬s
Does (p ∧ q, ¬p → r ) ⊢ r ?
Application to Tautologies

I2209
Introduction
to Logic and
Logic
Programming
How to check whether a formula f is a tautology or not?
Rami Just build the tree for ¬f !
EL-BAÏDA
If all branches are closed, it is a tautology. If there is an
Summary
open branch, ¬f is consistent or satisfiable, and f is not
What is Logic
valid
Propositional
Logic Example: show that |= (p → (q → p))
Logical
Reasoning Exercise: Use the tree method to determine whether the
Quine and following formulas are tautologies:
Reduction
Algorithms 1 ((p → q) → p) → p
Normal Forms
2 (p → ¬p) → ¬p
Resolution
3 ((p ∨ q) → r ) → (p → r ) ∧ (q → r )
Principle 4 ((p ∨ q) → r ) → (p → r )
Tree Method

You might also like