ldk r logics for data and knowledge representation propositional logic originally by alessandro...
TRANSCRIPT
LLogics for DData and KKnowledgeRRepresentation
Propositional Logic
Originally by Alessandro Agostini and Fausto GiunchigliaModified by Fausto Giunchiglia, Rui Zhang and Vincenzo Maltese
2
Outline Introduction Syntax Semantics
Truth valuation Satisfiability Validity Entailment
Logical implication Reasoning Services Normal Forms
2
Introduction: propositions All knowledge representation languages deal with
sentences
Sentences denote propositions (by definition), namely they express something true or false (the mental image of what you mean when you write the sentence)
Logic languages deal with propositions
Propositional logic is the simplest logic that does this (no individuals, no quantifiers)
3
“All men are mortals” “Obama is the president of the USA”
¬ Mortal ∨ Man President
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Introduction: example
4
World
SEMANTICGAP
Monkey
MentalModel
LanguageL
PROPOSITION SENTENCE
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Introduction: the famous triangle
5
CONCEPT(what we have in mind)
SYMBOL(what we write)
REFERENT(the real object)
Monkey
stands for
refers to symbolizes
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Language (Syntax) Alphabet of symbols: The first step in setting up a
formal language is to list the symbols of the alphabet Propositional Logic (PL) is a symbolic language Σ0: the alphabet of a PL language
6
Σ0
Descriptive Logical, , , …
Constants one proposition
only
A, B, C …
Variables they can be substituted
by any proposition or formula
P, Q, ψ …
NOTE: not only characters but also words (composed by several characters) like “monkey” are descriptive symbols
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Additional Symbols Auxiliary symbols
Parentheses: ( )
Defined symbols Logical defined constants are, for all propositions P:
⊥ (falsehood symbol, false, bottom) ⊥ =df P∧¬PT (truth symbol, true, top) T =df ¬⊥
Defined symbols are not strictly necessary However, they increase the usability by reducing the
syntactic complexity of propositions
7
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Formation Rules (FR): well formed formulas Well formed formulas (wff) in PL can be described by
the following BNF (*) grammar (codifying the rules):
<Atomic Formula> ::= A | B | ... | P | Q | ... | ⊥ | ⊤
<wff> ::= <Atomic Formula> | ¬<wff> | <wff>∧ <wff> | <wff> ∨ <wff>
Atomic formulas are also called atomic propositions Wff are propositional formulas (or just propositions) A formula is correct if and only if it is a wff
Σ0 + FR define a propositional language
(*) BNF = Backus–Naur form (formal grammar)8
PARSERψ, PLYes, ψ is correct!
No
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Example: the Monkey-Banana problem
Significant data: monkey, bananas, box Significant knowledge: Low, High, Climb, GetBanana All other data and knowledge are irrelevant! Both data and knowledge are codified as (atomic or more
complex) formulas in the language
Language (any language you want to define):
MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana
“ There is a monkey in a laboratory with some bananas hanging out of reach from the ceiling. A box is available that will enable the monkey to reach the bananas if he climbs on it. The monkey and box have height Low, but if the monkey climbs onto the box he will have height High, the same as the bananas. At this point the monkey can get a banana [...]”
9
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Examples of formulas
10
Formula Correct
inLab-Monkey
inlab-monkey
in-lab-monkey
inLab(Monkey)
(Monkey ∧ GetBanana) ∨ ¬ High
Yes
(wff)
inLab(Monkey)∧
P ¬∧Q
No
NOTE: In PL we do not have individuals (it is not so expressive). Parentheses in inLab(Monkey) are not the auxiliary symbols like in e.g. (Monkey ∧ GetBanana) ∨ ¬ High (problem of ambiguity)
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Propositional TheoryPropositional (or sentential) theory
A set of propositions It is a (propositional) knowledge base (containing
true facts) It corresponds to a TBox (terminology) only,
where no meaning is specified yet: it is a syntactic notion
Recall that: knowledge is a set of facts, i.e. statements we assumed statements are propositions
11
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Propositional Theories and DatabasesA propositional theory is not a database!
Propositions don’t show data explicitly (no individuals)
In PL the form P(a) must be interpreted as P-a (so the use of form P(a) is ambiguous).
Example: In the sentence ‘inLab(Monkey)’, the string ‘Monkey’ does not refer to an individual from some data domain
12
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Example: the Monkey-Banana problem
13
L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana,
, , }
T = { (MonkeyLow BananaHigh MonkeyGetBanana)
(MonkeyLow MonkeyClimbBox)
( MonkeyLow BananaHigh MonkeyGetBanana)}
NOTE: We still need to assign semantics to the symbols in the language.
“ There is a monkey in a laboratory with some bananas hanging out of reach from the ceiling. A box is available that will enable the monkey to reach the bananas if he climbs on it. The monkey and box have height Low, but if the monkey climbs onto the box he will have height High, the same as the bananas. At this point the monkey can get a banana [...]”
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Semantics means providing an interpretationSo far the elements of our propositional
language are simply strings of symbols
without formal meaning
The meanings which are intended to be attached to the symbols and propositions form the intended interpretation ν (nu) of the language
14
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Semantics: formal model Intensional interpretation
We must make sure to assign the formal meanings out of our intended interpretation to the (symbols of the) language, so that formulas (propositions) really express what we intended.
The mental model: What we have in mind?
In our mind (mental model) we have a set of properties that we associate to propositions. We need to make explicit (as much as possible) what we mean.
The formal modelThis is done by defining a formal model M. Technically: we have to define a pair (M,⊨) for our propositional language
Truth-values
In PL a sentence A is true (false) iff A denotes a formal object which satisfies (does not satisfy) the properties of the object in the real world.
15
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Example: Banana (I) Bananas may differ in many ways, but when
using the proposition Banana we have in mind some specific properties: e.g. a given shape, a given color ...
These specific properties determine the intension of the proposition Banana
The intentional interpretation of the proposition Banana determines its truth-value (true or false).
16
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Example: Banana (II)
17
World
SEMANTICGAP
Banana
MentalModel
LanguageL
PROPOSITION
What we have in mind?1) There is at least a banana2) The banana is yellow3) The banana has curve shape4) No matter if opened
SENTENCE
Banana (Yellow Curve)
LanguageL’
SENTENCE
OUR MENTAL MODEL MATCHES WITH THE REAL WORLD, SO THE SENTENCES ARE TRUE
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Example: Banana (III)
18
World
SEMANTICGAP
Banana
MentalModel
LanguageL
PROPOSITION
What we have in mind?1) There is at least a banana2) The banana is yellow3) The banana has curve shape4) No matter if opened
SENTENCE
Banana (Yellow Curve)
LanguageL’
SENTENCE
OUR MENTAL MODEL DOES NOT MATCH WITH THE REAL WORLD, SO THE SENTENCES ARE FALSE
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Example: Banana (IV)
19
I mean banana as something yellow
and curve, no matter if partially
opened
I mean banana as something yellow or red, which can be one or many together, no matter how big they are, and whether they are opened or not
FORMAL MODEL M1 FORMAL MODEL M2
T F T F
MENTAL MODEL MENTAL MODEL
THE WORLD
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Truth-values Definition: a truth valuation on a propositional
language L is a mapping ν assigning to each formula A of L a truth value ν(A), namely in the domain D = {T, F}
ν(A) = T or F according to the modeler, with A atomic ν(¬A) = T iff ν(A) = F ν(A∧B) = T iff ν(A) = T and ν(B) = T ν(A∨B) = T iff ν(A) = T or ν(B) = T
ν(⊥) = F (since ⊥=df P∧¬P) ν(⊤) = T (since ⊤=df ¬⊥)
20
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Example of truth valuation ν
21
L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana,
, , }
T = { (MonkeyLow BananaHigh MonkeyGetBanana)
(MonkeyLow MonkeyClimbBox)
( MonkeyLow BananaHigh MonkeyGetBanana)}
Informal Semantics:
“If the monkey is low and the banana is high in position, then the monkey cannot get the banana. “
Formal Semantics:
ν(MonkeyLow) = T
ν(BananaHigh) = T
ν(MonkeyClimbBox) = F
ν(MonkeyGetBanana) = F
MODEL
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Truth Tables To compute (in polynomial time) truth valuations, the method of truth tables was introduced
(Wittgenstein, 1921).
Truth tables are well-known:
Truth-table (TT) for the
logical constants
¬ , ∧, ∨
22
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Truth Relation (Satisfaction Relation) Let ν be a truth valuation on language L, we define
the truth-relation (or satisfaction-relation) ⊨ and write
ν ⊨ A
(read: ν satisfies A) iff ν(A) = True
Given a set of propositions Γ, we define
ν ⊨ Γ
iff if ν ⊨ θ for all formulas θ ∈ Γ 23
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Model and Satisfiability
Let ν be a truth valuation on language L. ν is a model of a proposition P (set of propositions Γ) iff ν satisfies P (Γ).
P (Γ) is satisfiable if there is some (at least one) truth valuation ν such that ν ⊨ P (ν ⊨ Γ).
24
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Truth and Validity
Let ν be a truth valuation on language L.
P is true under ν if ν ⊨ P
P is valid if ν ⊨ P for all ν (notation: ⊨ P)P is called a tautology
25
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Example
26
L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana,
, , }
Informal Semantics:
“If the monkey is low and the banana is high in position, then the monkey cannot get the banana. “
Formal Semantics:
ν(MonkeyLow) = T
ν(BananaHigh) = T
ν(MonkeyClimbBox) = F
ν(MonkeyGetBanana) = F
MODEL
ν ⊨ MonkeyLow and ν ⊨ BananaHigh [SATISFIABLE]
ν ⊨ MonkeyClimbBox and ν ⊨ MonkeyGetBanana [SATISFIABLE]
MonkeyLow MonkeyLow is a tautology [VALID]
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Entailment Propositional entailment
⊨ ψ
where = {θ1, ..., θn} is a finite set of propositions
ν ⊨ θi for all θi in implies ν ⊨ ψ
27
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Example
28
L = {MonkeyLow, BananaHigh, MonkeyClimbBox, MonkeyGetBanana,
, , }
Informal Semantics:
“If the monkey is low and the banana is high in position, then the monkey cannot get the banana. “
Formal Semantics:
ν(MonkeyLow) = T
ν(BananaHigh) = T
ν(MonkeyClimbBox) = F
ν(MonkeyGetBanana) = F
MODEL
= {MonkeyLow, BananaHigh}
ν ⊨ MonkeyLow and ν ⊨ BananaHigh implies ν ⊨ MonkeyGetBanana
therefore ⊨ MonkeyGetBanana [ENTAILMENT]
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Entailment Difference in notation
⊨ ψ iff ⊨ ψ
Left side means we have already filtered out all the models that do not satisfy
Right side means that we start from all models.
In any case the final result is the same.
29
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Implication: Premise (I) Propositional entailment in the finite, i.e.
⊨ ψ
where = {θ1, ..., θn} is a finite set of propositions
How to embed such a notion directly in the language?
As we will see, this would allow us to use truth tables and directly reformulate entailment in terms of the other reasoning services
30
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Implication: Premise (II)
Entailment can be viewed as the logical implication
(θ1 ∧ θ2 ∧ ... ∧ θn) → ψ
to be read θ1 ∧ θ2 ∧ ... ∧ θn logically implies ψ
→ is a new symbol that we add to the language
31
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
We extend our alphabet of symbols with the following defined logical constants:→ (implication)↔ (double implication or equivalence)
<Atomic Formula> ::= A | B | ... | P | Q | ... | ⊥ | ⊤
<wff> ::= <Atomic Formula> | ¬<wff> | <wff>∧ <wff> | <wff>∨ <wff> |
<wff> → <wff> | <wff> ↔ <wff> (new rules) The operator precedence is (from higher to lower): ¬, ∧, ∨, →,
↔ Let propositions ψ, θ, and finite set {θ1,...,θn} of propositions
be given. We define: ⊨ θ → ψ iff θ ⊨ ψ ⊨ (θ1∧...∧θn) → ψ iff {θ1,...,θn} ⊨ ψ ⊨ θ ↔ ψ iff θ → ψ and ψ → θ
Implication and equivalence
32
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Truth Table of → By defining the semantics of → in terms of ⊨
we have the following truth-table for the logical implication P→Q:
REMEMBER: Given ν, P ⊨ Q iff ν ⊨ P then ν ⊨ Q.
33
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Three Properties of Logical Implication Property 1:
For all ψ and θ: ψ → θ iff ¬ψ ∨ θ
Property 2: For all ψ: ¬ψ iff ψ →⊥
Property 3: For all ψ: ⊥ ⊨ ψ(inconsistent theories imply any proposition)
34
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Examples (tautologies) Laws for ∧, ¬ and →:
(A ∧ ¬B) → ¬(A → B) ¬(A → B) → (A ∧ ¬B)
Pierce’s law: ((A → B) → A) → A
De Morgan’s laws: ¬(A ∨ B) → (¬A ∧ ¬B)
(¬A ∧ ¬B) → ¬(A ∨ B) ¬(A ∧ B) → (¬A ∨ ¬B)
(¬A ∨ ¬B) → ¬(A ∧ B)
35
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Exercise (tautologies)Prove the following double implications (i.e.,
logical equivalences) by using truth tables.
36
(α ∧ β) ↔ (β ∧ α) Commutativity of ∧
(α ∨ β) ↔ (β ∨ α) Commutativity of ∨
((α ∧ β) ∧ γ) ↔ (α ∧ (β ∧ γ)) Associativity of ∧
((α ∨ β) ∨ γ) ↔ (α ∨ (β ∨ γ)): Associativity of ∨
¬(¬α) ↔ α Double-negation elimination
(α →β) ↔ (¬β →¬α) Contraposition
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Exercise (tautologies)Prove the following double implications (i.e.,
logical equivalences) by using truth tables.
37
(α → β) ↔ (¬α ∨ β) →-elimination
(α ↔ β) ↔ ((α → β) ∧ (β → α)) ↔-elimination
¬(α ∧ β) ↔ (¬α ∨ ¬β) DeMorgan Law for ∧
¬(α ∨ β) ↔ (¬α ∧ ¬β) DeMorgan Law for ∨
(α ∧ (β ∨ γ)) ↔ ((α ∧ β) ∨ (α ∧ γ)) Distributivity of ∧ over ∨
(α ∨ (β ∧ γ)) ↔ ((α ∨ β) ∧ (α ∨ γ)) Distributivity of ∨ over ∧
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Reasoning ServicesThe basic reasoning tasks (or “services”) we
can represent (and compute) using ⊨ are: Model Checking (EVAL) Satisfiability (SAT) Unsatisfiability (UnSAT) Validity (VAL) Entailment (ENT)
38
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Reasoning Services: EVALModel Checking (EVAL)
Is a proposition P true under a truth-valuation ν?
Check ν ⊨ P
EVALP , νYes
No
Does ν ⊨ MonkeyLow MonkeyGetBanana ?
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
39
Reasoning Services: SATSatisfiability (SAT)
Is there a truth-valuation ν where P is true?
find ν such that ν ⊨ P
SATPν
No
Find a ν that ν ⊨ MonkeyLow GetBanana
For instance, the truth-valuation ν where both are true
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
40
Reasoning Services (unSAT)Unsatisfiability is the impossibility to find a
truth-valuation ν
41
Monkey is satisfiable.Monkey ∨¬ Monkey is satisfiable.
Monkey ∧¬ Monkey is unsatisfiable (inconsistent). In fact, for every truth-valuation ν, either
ν(A) = T, so ν(¬A) = F, hence ν(P) = F; or ν(A) = F, so ν(¬A) = T, hence ν(P) = T.
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Reasoning Services: VALValidity (VAL)
Is P true according to all possible truth-valuation ν?
Check whether for all ν, ν ⊨ P
VALPYes
No
Is P = MonkeyLow ∨ MonkeyLow valid? Yes!
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
42
Reasoning Services (Entailment) A set Γ (eventually empty) of propositions θ
entails a proposition ψ, written: Γ ⊨ ψ
if ν ⊨ θ for all θ ∈ Γ, then ν ⊨ ψ (for a given ν or for all ν)
If Γ ⊨ ψ, then we say that ψ is a logical consequence of Γ, and that Γ logically implies ψ.
NOTE: ⊨ P is the same as {} ⊨ P 43
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Reasoning Services: ENTEntailment (ENT)
All θ ∈ Γ true in ν (in all ν) implies ψ true in ν (in all ν)
check Γ ⊨ ψ in ν (in all ν ) by checking that: given that ν ⊨ θ for all θ ∈ Γ implies ν ⊨ ψ
ENTΓ , ψ, ν Yes
No
Does MonkeyLow ⊨ MonkeyGetBanana ? No!
Does MonkeyLow BananaHigh ⊨ MonkeyGetBanana? Yes!
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
44
Reasoning Services (Entailment)Exercises:
Demonstrate that {today} ⊨ today ∨ tomorrow
Demonstrate that {today} ⊭ tomorrow
Suppose P = today ∨ tomorrow. Then: Define Γ such that Γ ⊨ P Define Γ such that Γ ⊭ P
45
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Reasoning Services: properties (I) EVAL is the easiest task. We just test one assignment.
SAT is NP complete. We need to test in the worst case all the assignments. We stop when we find one which is true.
UnSAT is CO-NP. We need to test in the worst case all the assignments. We stop when we find one which is true.
VAL is CO-NP. We need to test all the assignments and verify that they are all true. We stop when we find one which is false.
ENT is CO-NP. It can be computed using VAL (see next slide)
46
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Reasoning Services: properties (II) VAL(ψ) iff UnSAT( ψ)
SAT(ψ) VAL(ψ) iff SAT( ψ) VAL( ψ)
⊨ ψ, where = {θ1, …, θn} iff VAL(θ1 … θn ψ)
47
ψ = (A A) is valid, while ( A A) is unsatisfiable
ψ = A is satisfiable in all models where ν(A) = T. Informally, the left side says that there is at least an assignment which makes A true and there is at least an assignment which makes A false; the right side says that there is at least an assignment which makes A true (in other words it makes A false) and there is at least an assignment which makes A false (in other words it makes A true). This means that not all assignments make A true (false).
Take A ⊨ A B. the formula (A A B) is valid.
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Reasoning Services: properties (III) EVAL is easy.
ENT can be computed using VAL
VAL can be computed using UnSAT
UnSAT is the opposite of SAT
All reasoning tasks can be reduced to SAT!!!SAT is the most important reasoning service.
48
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Normal Forms: Literals A literal is either an atomic proposition or the
negation of an atomic proposition, i.e., for all propositional variables P
P and ¬P are literals.
P is a positive literal¬P is a negative literal
49
Monkey HighBanana ¬GetBanana ¬ClimbBox
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Normal Forms: Clauses A (disjunctive) clause is a disjunction of literals α1
… αn
A unit clause is a clause that contains only a single literal
An empty clause does not contain literals
50
B ∨ ¬C ∨ ¬D Monkey ∨ ¬Monkey
B and ¬C are unit clausesB ∨ ¬C is not
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Conjunctive Normal Form (CNF)A proposition is in conjunctive normal form (CNF)
if it is a (finite) conjunction of (disjunctive) clauses
51
Examples of formulas in CNF:
¬A ∧ B
(A ∨ ¬B) ∧ (B ∨ ¬C ∨ ¬D)
A ∧ (B ∨ C ∨ ¬D)
A B (¬ A C) (B ¬ D E)
Examples of formulas NOT in CNF:¬(A ∧ B) ¬ is the outmost operatorA ∧ (B ∨ C ∧ ¬D) ∧ is nested within ∨
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Conversion of a formula to CNF Theorem (e.g. Mendelson, 1987 [Prop. 1.4, Ex. 1.41(a)])
Every formula P has an equivalent CNF, namely P can be converted (in polynomial time) into a proposition Q such that: Q is in CNF P and Q are equivalent (i.e., have the same truth table)
A conversion to a CNF that operates as in the theorem above is said to be complete
The algorithm implementing the conversion to a CNF is based on the tautologies about logical equivalence (or double implication): Double-negation law (i.e. elimination of ¬¬) De Morgan’s laws Distributive laws Elimination of → and
52
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Conversion to CNF: Basic Tautologies
53
(α → β) ↔ (¬α ∨ β)c →-elimination
(α ↔ β) ↔ ((α → β) ∧ (β → α)) ↔-elimination
¬(α ∧ β) ↔ (¬α ∨ ¬β) DeMorgan Law for ∧
¬(α ∨ β) ↔ (¬α ∧ ¬β) DeMorgan Law for ∨
(α ∧ (β ∨ γ)) ↔ ((α ∧ β) ∨ (α ∧ γ))
Distributivity of ∧ over ∨
(α ∨ (β ∧ γ)) ↔ ((α ∨ β) ∧ (α ∨ γ))
Distributivity of ∨ over ∧
¬(¬α) ↔ α Double-negation elimination
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Example: Conversion to CNF of A ↔ (B ∨ C)
1. Eliminate ↔:
(A→(B ∨C)) ∧ ((B ∨C) →A)
2. Eliminate →:
(¬A∨B ∨C) ∧ (¬(B ∨C) ∨A) Move ¬ inwards using de Morgan’s laws:
(¬A∨B ∨C) ∧ ((¬B ∧¬C) ∨A) Apply distributivity of ∨ over ∧ and flatten:
(¬A∨B ∨C) ∧ (¬B ∨A) ∧ (¬C ∨A) (*)
(*) in CNF and equivalent to ‘A↔(B∨C)’.
54
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Normal Forms: Conjunctive clauses A conjunctive clause is a conjunction of literals α1
… αn
NOTE: a conjunctive clause IS NOT a clause!
55
B ¬C ¬D Monkey ¬Monkey
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS
Disjunctive Normal Form (DNF)A proposition is in disjunctive normal form (DNF) if
it is a (finite) disjunction of conjunctive clauses
56
Examples of formulas in DNF:
¬A ∨ B
(A ∧ ¬B) ∨ (B ∧ ¬C ∧ ¬D)
A ∨ (B ∧ C ∧ ¬D)
A ∨ B ∨ (¬ A ∧ C) ∨ (B ∧ ¬ D ∧ E)
Examples of formulas NOT in DNF:¬(A ∨ B) ¬ is the outmost operatorA ∨ (B ∨ C ∧ ¬D) ∧ is nested within ∨
INTRODUCTION :: SYNTAX :: SEMANTICS :: LOGICAL IMPLICATION :: REASONING SERVICES :: NORMAL FORMS