0% found this document useful (0 votes)
76 views9 pages

07a Logic 4p

The document discusses propositional logic and its key components. It defines logic constants, propositional variables, logical connectives, logical sentences, and logical interpretations. It then explains properties of logical connectives like conjunction, disjunction, negation, and their relationships. It introduces concepts like negation normal form, conjunctive normal form, logical interpretations, models, validity, and satisfiability. It provides examples like the 8-queen problem formulated in propositional logic. Finally, it discusses inference systems and reasoning tools for propositional logic.

Uploaded by

Hilorious Guy
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)
76 views9 pages

07a Logic 4p

The document discusses propositional logic and its key components. It defines logic constants, propositional variables, logical connectives, logical sentences, and logical interpretations. It then explains properties of logical connectives like conjunction, disjunction, negation, and their relationships. It introduces concepts like negation normal form, conjunctive normal form, logical interpretations, models, validity, and satisfiability. It provides examples like the 8-queen problem formulated in propositional logic. Finally, it discusses inference systems and reasoning tools for propositional logic.

Uploaded by

Hilorious Guy
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/ 9

Components of Propositional Logic Artificial Intelligence

Logic constants: True (1), and False (0)


Propositional variables: X = {p1 , q2 , ...}, a set of
Boolean variables
Logical connectives: F = {¬, ∧, ∨, ⇒, ⇔, ...}
Logic and Inferences
Logical sentences: L(X, F ), expressions built from X
and F
Logical interpretations: a mapping θ from X to {0, 1} Readings: Chapter 7 of Russell &
Logical evaluations: a process of applying a mapping θ
to sentences in L(X, F ) (to obtain a value in {0, 1}) Norvig.

Artificial Intelligence – p.2/34 Artificial Intelligence – p.1/34

Properties of Logical Connectives Propositional Variables


∧ and ∨ are commutative Also called Boolean variables, 0-1 variables.
ϕ1 ∧ ϕ2 ≡ ϕ2 ∧ ϕ1 Every statement can be represented by a propositional
ϕ1 ∨ ϕ2 ≡ ϕ2 ∨ ϕ1 variable:
∧ and ∨ are associative p1 = “It is sunny today”
ϕ1 ∧ (ϕ2 ∧ ϕ3 ) ≡ (ϕ1 ∧ ϕ2 ) ∧ ϕ3 p2 = “Tom went to school yesterday”
ϕ1 ∨ (ϕ2 ∨ ϕ3 ) ≡ (ϕ1 ∨ ϕ2 ) ∨ ϕ3 p3 = “f (x) = 0 has two solutions”
∧ and ∨ are mutually distributive p4 = “point A is on line BC ”
ϕ1 ∧ (ϕ2 ∨ ϕ3 ) ≡ (ϕ1 ∧ ϕ2 ) ∨ (ϕ1 ∧ ϕ3 ) p5 = “place a queen at position (1, 2) on a 8 by 8
ϕ1 ∨ (ϕ2 ∧ ϕ3 ) ≡ (ϕ1 ∨ ϕ2 ) ∧ (ϕ1 ∨ ϕ3 ) chessboard”
...
∧ and ∨ are related by ¬ (DeMorgan’s Laws)
¬(ϕ1 ∧ ϕ2 ) ≡ ¬ϕ1 ∨ ¬ϕ2
¬(ϕ1 ∨ ϕ2 ) ≡ ¬ϕ1 ∧ ¬ϕ2
Artificial Intelligence – p.4/34 Artificial Intelligence – p.3/34
Negation Normal Form (NNF) Properties of Logical Connectives
A propositional sentence is said to be in Negation Normal
Form if it contains no connectives other than ∨, ∧, ¬, and
∧, ⇒, and ⇔ are actually redundant:
if ¬(α) appears in the sentence, then α must be a
propositional variable. ϕ1 ∧ ϕ2 ≡ ¬(¬ϕ1 ∨ ¬ϕ2 )
¬p, p ∨ q, p ∨ (q ∧ ¬r) are NNF. ϕ1 ⇒ ϕ2 ≡ ¬ϕ1 ∨ ϕ2
p ⇔ q, ¬(p ∨ q) are not NNF. ϕ1 ⇔ ϕ2 ≡ (ϕ1 ⇒ ϕ2 ) ∧ (ϕ2 ⇒ ϕ1 )

Every propositional sentence can be transformed into an We keep them all mainly for convenience.
equivalent NNF.
Exercise Use the truth tables to prove all the logical
ϕ1 ⇔ ϕ2 ≡ (ϕ1 ⇒ ϕ2 ) ∧ (ϕ2 ⇒ ϕ1 )
equivalences seen so far.
ϕ1 ⇒ ϕ2 ≡ ¬ϕ1 ∨ ϕ2
¬(ϕ1 ∧ ϕ2 ) ≡ ¬ϕ1 ∨ ¬ϕ2
¬(ϕ1 ∨ ϕ2 ) ≡ ¬ϕ1 ∧ ¬ϕ2 Artificial Intelligence – p.6/34 Artificial Intelligence – p.5/34

Existence of CNF Conjunctive Normal Form (CNF)


A propositional sentence φ is said to be in Conjunctive
Normal Form if φ is True, False, or a conjunction of αi ’s:
Every propositional sentence can be transformed into an
equivalent CNF. That is, from NNF, using α1 ∧ α2 ∧ · · · ∧ αn ,

(ϕ1 ∧ ϕ2 ) ∨ ϕ3 ≡ (ϕ1 ∨ ϕ3 ) ∧ (ϕ2 ∨ ϕ3 ) where each α is a clause (a disjunction of βj ’s):

α = (β1 ∨ β2 ∨ · · · ∨ βm ),

where each β is called a literal, which is either a


variable or the negation of a variable: β = p or β = ¬(p).
¬p, p ∨ q , p ∧ (q ∨ ¬r) are CNF.
p ∨ (q ∧ ¬r) are not CNF.
Every CNF is an NNF but the opposite does not hold.

Artificial Intelligence – p.8/34 Artificial Intelligence – p.7/34


Interpretations and Models Example: The 8-Queen Problem
A (partial) interpretation is a mapping from variables to {0, 1}. 1 ≤ i, j ≤ 8. qij is true iff a queen is placed in the
Variables: qi,j ,

An complete interpretation is if it maps every variables to {0, 1}. square at row i and column j.
Clauses:
An interpretation θ can be extended to be a mapping from
propositional sentences to {0, 1} if it obeys the following rules: Every row has a queen: For each 1 ≤ i ≤ 8,

θ(¬p) = 1 if and only if θ(p) = 0; qi,1 ∨ qi,2 ∨ qi,3 ∨ qi,4 ∨ qi,5 ∨ qi,6 ∨ qi,7 ∨ qi,8
if θ(p) = 1 or θ(q) = 1 then θ(p ∨ q) = 1;
if θ(p) = 1 and θ(q) = 1 then θ(p ∧ q) = 1; ... Two queens from the same row cannot see each other:

Computing this interpretation is called evaluation. ¬qi,1 ∨ ¬qi,2 , ...


For any propositional sentence Φ, if there exists an interpreation θ
such that θ(Φ) = 1, then θ is a model of Φ and Φ is said to be Two queens from the same column cannot see each other:
satisfiable.
¬q1,j ∨ ¬q2,j , ...
If every complete interpretation is a model for Φ, then Φ is said to be
valid. Two queens on the same diagonal cannot see each other:
Artificial Intelligence – p.10/34 Artificial Intelligence – p.9/34
¬q1,1 ∨ ¬q2,2 , ...

Inference Systems Validity vs. Satisfiability


A sentence is
In practice, an inference system I for PL is a procedure satisfiable if it is true in some interpretation,
that given a set Γ = {α1 , . . . , αm } of sentences and a
valid if it is true in every possible interpretation.
sentence ϕ, may reply “yes”, “no”, or run forever.
If I replies “yes” on input (Γ, ϕ), we say that Γ derives ϕ
in I , Or, I derives ϕ from Γ, or, ϕ is deduced (derived) Reasoning Tools for Propositional Logic:
from Γ in I . and write
A tool to prove a sentence is valid needs only to return
Γ ⊢I ϕ yes or no.

Intuitively, I should be such that it replies “yes” on input A tool to prove a sentence is satisfiable often returns an
(Γ, ϕ) only if ϕ is in fact deduced from Γ by I . interpretation under which the sentence is true.
A sentence φ is valid if and only if ¬φ is unsatisfiable.

Artificial Intelligence – p.12/34 Artificial Intelligence – p.11/34


All These Fancy Symbols! All These Fancy Symbols!
A∧B ⇒C
is a sentence (an expression built from variables and
In other words,
logical connectives) where ⇒ is a logical connective.
⇒ is a formal symbol of the logic, which is used by the A ∧ B |= C
inference system. is a mathematical abbreviation standing for the statement:
|= is a shorthand for the entailment of formal sentences “every interpretation that makes A ∧ B true, makes C also
that we use to talk about the meaning of formal true.” We say that the sentence A ∧ B entails C.
sentences. A ∧ B ⊢I C
⊢I is a shorthand for the inference procedure that we use is a mathematical abbreviation standing for the statement:
to talk about the output of the inference system I. “I returns yes on input (A ∧ B, C)” [C is deduced from
A ∧ B in I].
The formal symbol ⇒ and the shorthands |=, ⊢I are related.
Artificial Intelligence – p.14/34 Artificial Intelligence – p.13/34

Soundness and Completeness All These Fancy Symbols!


The sentence ϕ1 ⇒ ϕ2 is valid (always true) if and only
if ϕ1 |= ϕ2 .
An inference system I is sound if it derives only
sentences that logically follow from a given set of Example: A ⇒ (A ∨ B) is valid and A |= (A ∨ B)
sentences:
A B A ∨ B A ⇒ (A ∨ B)
if Γ ⊢I ϕ then Γ |= ϕ. 1. False False False True
2. False True True True
An inference system I is complete if it derives all
sentences that logically follow from a given set of 3. True False True True
sentences: 4. True True True True
if Γ |= ϕ then Γ ⊢I ϕ.
or equivalently,
if Γ 6⊢I ϕ then Γ 6|= ϕ.
Artificial Intelligence – p.16/34 Artificial Intelligence – p.15/34
Inference by Truth Tables Inference in Propositional Logic
The truth-tables-based inference system is sound:
α1 , . . . , αm ⊢T T ϕ implies truth table of (α1 ∧ · · · ∧ αm ) ⇒ ϕ all true
There are two (equivalent) types of inference systems of
implies (α1 ∧ · · · ∧ αm ) ⇒ ϕ is valid
Propositional Logic:
implies (α1 ∧ · · · ∧ αm ) |= ϕ
one based on truth tables (T T )
implies α1 , . . . , αm |= ϕ
one based on derivation rules (R)
It is also complete (exercise: prove it).
Its time complexity is O(2n ) where n is the number of propositional
Truth Tables The inference system T T is specified as
variables in α1 , . . . , αm , ϕ.
follows:
We cannot hope to do better because a related, simpler problem
(determining the satisfiability of a sentence) is NP-complete. {α1 , . . . , αm } ⊢T T ϕ iff all the values in the truth table of
However, the really hard cases of propositional inference when we (α1 ∧ · · · ∧ αm ) ⇒ ϕ are True.
need O(2n ) time are somewhat rare.

Artificial Intelligence – p.18/34 Artificial Intelligence – p.17/34

Rule-Based Inference System Rule-Based Inference System


Inference Rules

And-Introduction An inference system in Propositional Logic can also be


specified as a set R of inference (or derivation) rules.
α β
α∧β Each rule is actually a pattern premises/conclusion.
A rule applies to Γ and derives ϕ if
And-Elimination
α∧β α∧β some of the sentences in Γ match with the premises
of the rule and
α β
ϕ matches with the conclusion.
Or-Introduction
A rule is sound it the set of its premises entails its
α α
conclusion.
α∨β β∨α

Artificial Intelligence – p.20/34 Artificial Intelligence – p.19/34


Rule-Based Inference Systems Rule-Based Inference System
Inference Rules (cont’d.) Inference Rules (cont’)

Double-Negation-Elimination Implication-Elimination (aka Modus Ponens)


¬¬α α⇒β α
α β
False-Introduction Unit Resolution
α ∧ ¬α α∨β ¬β
False α
False-Elimination Resolution
α∨β ¬β ∨ γ
False α∨γ
β
¬α ⇒ β, β⇒γ
or, equivalently,
¬α ⇒ γ
Artificial Intelligence – p.22/34 Artificial Intelligence – p.21/34

Inference by Proof Inference by Proof

We can represent a proof more visually as a proof tree: We say there is a proof of ϕ from Γ in R if we can derive ϕ
by applying the rules of R repeatedly to Γ and its derived
Example: sentences.
(P ∨ H) ∧ ¬H (P ∨ H) ∧ ¬H
Example: a proof of P from {(P ∨ H) ∧ ¬H}
P ∨H ¬H
1. (P ∨ H) ∧ ¬H by assumption
P
2. P ∨H by ∧-elimination applied to (1)
3. ¬H by ∧-elimination applied to (1)
4. P by unit resolution applied to (2),(3)

Artificial Intelligence – p.24/34 Artificial Intelligence – p.23/34


Soundness of Rule-Based Inferences Rule-Based Inference System
R is sound if all of its rules are sound.
α ∨ β, ¬β ∨ γ
Example: the Resolution rule More formally, there is a proof of ϕ from Γ in R if
α∨γ
1. ϕ ∈ Γ or,
α β γ ¬β α∨β ¬β ∨ γ α∨γ
1. False False False True False True False
2. there is a rule in R that applies to Γ and produces ϕ or,
2. False False True True False True True 3. there is a proof of each ϕ1 , . . . , ϕm from Γ in R and
3. False True False False True False False a rule that applies to {ϕ1 , . . . , ϕm } and produces ϕ.
4. False True True False True True True
5. True False False True True True True
Then, the inference system R is specified as follows:
6. True False True True True True True
7. True True False False True False True Γ ⊢R ϕ iff there is a proof of ϕ from Γ in R
8. True True True False True True True

All the interpretations that make both α ∨ β and ¬β ∨ γ true (ie, 4,5,6,8)
make α ∨ γ also true.
Artificial Intelligence – p.26/34 Artificial Intelligence – p.25/34

One Rule Suffices! The Rules of R


α β α α
Assumptions:
α∧β α∨β β∨α
β ¬β α∨β ¬β
is a special case of when α
False α α∧β α∧β
is False.
α β
α∨β ¬β α∨β ¬β ∨ γ
is a special case of
α α∨γ
α⇒β α α∨β ¬β α∨β ¬β ∨ γ
when γ is False.
β α α∨γ
To prove that Γ ⇒ ϕ is valid,
Convert Γ ∧ ¬(ϕ) into a set of clauses. ¬¬α α ∧ ¬α False
Repeatedly apply the Resolution Rule on the clauses. α False β
If False is derived out, then (Γ ⇒ ϕ) is valid.

Artificial Intelligence – p.28/34 Artificial Intelligence – p.27/34


Proof by Contradiction Resolution Proof

Γ ∧ ¬ϕ ⊢R False Example: A proof of P from {(P ∨ H) ∧ ¬H}


implies (Γ ∧ ¬ϕ) ⇒ False is valid.
Convert {(P ∨ H) ∧ ¬H} ∧ ¬P into a set of clauses
implies ¬(Γ ∧ ¬ϕ) ∨ False is valid. (CNF):
implies ¬Γ ∨ ϕ is valid.
implies Γ ⇒ ϕ is valid. {(1) (P ∨ H), (2) ¬H, (3) ¬P }

Apply the Resolution Rule:


1. (1) (P ∨ H) and (2) ¬H produces (4) P
2. (3) ¬P and (4) P produces False
Since False is produced, so ((P ∨ H) ∧ ¬H) ⇒ P is valid.

Artificial Intelligence – p.30/34 Artificial Intelligence – p.29/34

How to get CNF from (p ⇔ q) ⇔ r An Example


Theorem: If (p ⇔ q) ⇔ r and p ⇔ r, then q.
(p ⇔ q) ⇔ r ≡ ((p ⇔ q) ⇒ r) ∧ (r ⇒ (p ⇔ q))
Obtain clauses from the premises and the negation of the conclusion.
(p ⇔ q) ⇒ r ≡ ¬(p ⇔ q) ∨ r From (p ⇔ q) ⇔ r, we obtain:
(1) p ∨ q ∨ r, (2) ¬p ∨ ¬q ∨ r, (3) p ∨ ¬q ∨ ¬r, (4) ¬p ∨ q ∨ ¬r.
≡ (¬p ⇔ q) ∨ r
From p ⇔ r we obtain:
≡ ((¬p ⇒ q) ∧ (q ⇒ ¬p)) ∨ r
(5) ¬p ∨ r, (6) p ∨ ¬r
≡ ((p ∨ q) ∧ (¬q ∨ ¬p)) ∨ r
From ¬q, we obtain:
≡ (p ∨ q ∨ r) ∧ (¬q ∨ ¬p ∨ r) (7) ¬q.
Apply Resolution to the clauses:
r ⇒ (p ⇔ q) ≡ ¬r ∨ (p ⇔ q) From (7), (1): (8) p ∨ r From (10), (6): (11) p
≡ ¬r ∨ ((p ⇒ q) ∧ (q ⇒ p)) From (7), (4): (9) ¬p ∨ ¬r From (10), (9): (12) ¬p
≡ ¬r ∨ ((¬p ∨ q) ∧ (¬q ∨ p)) From (5), (8): (10) r From (11), (12): (13) 
≡ (¬p ∨ q ∨ ¬r) ∧ (¬q ∨ p¬r)
Artificial Intelligence – p.32/34 Artificial Intelligence – p.31/34
Proof System for Satisfiability Some Resolution Strategies
The Davis-Putnam-Logemann-Loveland (DPLL) method Unit resolution: Unit resolution only.
takes a set of input clauses and converts them into an Input resolution: One of the two clauses must be an input
equivalent set of unit clauses if the set is satisfiable. clause.
Inference Rules: Set of support:
One of the two clauses must be from a
S ∪ {α ∨ β, ¬β} designed set called set of support. New resolvent are
: Unit Resolution added into the set of support.
S ∪ {α, ¬β}
Linear resolutionThe latest resolvent must be used in the
S ∪ {α ∨ β, β} current resolution.
: Unit Subsumption
S ∪ {β}
S Note: The first 3 strategies above are incomplete.
: Case Splitting The Unit resolution strategy is equivalent to the Input
S ∪ {α} or S ∪ {¬α} resolution strategy: a proof in one strategy can be
converted into a proof in the other strategy.
Artificial Intelligence – p.34/34 Artificial Intelligence – p.33/34

You might also like