l ogics for d ata and k nowledge r epresentation
DESCRIPTION
L ogics for D ata and K nowledge R epresentation. Propositional Logic: Reasoning. Outline. Review Reasoning DP Procedure Properties Decidability Summary. Reasoning Services. Basic reasoning tasks for a PL-based system : Model checking - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/1.jpg)
LLogics for DData and KKnowledgeRRepresentation
Propositional Logic: Reasoning
First version by Alessandro Agostini and Fausto Giunchiglia
Second version by Fausto Giunchiglia and Rui Zhang
![Page 2: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/2.jpg)
OutlineReviewReasoning
DP ProcedureProperties
DecidabilitySummary
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/20092
![Page 3: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/3.jpg)
Reasoning ServicesBasic reasoning tasks for a PL-based system :
Model checking Satisfiability reduced to model checking
(choose assignment first) Validity reduced to model checking (try all
assignments) Unsatisfiability reduced to model checking
(try all assignments) Entailment reduced to previous problems
SAT/UNSAT/VAL reduced to SAT/UNSAT/VAL of CNF formulas
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/20093
![Page 4: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/4.jpg)
Reasoning ServicesSAT/UNSAT/VAL reduced to SAT/UNSAT/VAL
of CNF formulas
See for instance: http://www.satisfiability.org
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/20094
![Page 5: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/5.jpg)
OutlineReviewReasoning
DP ProcedureProperties
DecidabilitySummary
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/20095
![Page 6: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/6.jpg)
PSAT-Problem (Boolean SAT)Definition.
PSAT = find ν such that ν |= P. Satisfiability Problem: Is PSAT decidable? Theorem [Cook,1971] PSAT is NP-complete
The theorem established a “limitative result” of PL (and Logic). A problem is NP-complete when it is very difficult to be computed!
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/20096
![Page 7: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/7.jpg)
Background ConceptsTo understand the DPLL procedure we first
require to know some background concepts: literal (negative / positive) clause (unit / empty) conjunctive normal form (CNF) the conversion procedure to rewrite a formula to
its equivalent CNF.
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/20097
![Page 8: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/8.jpg)
LiteralsA 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
Examples: ‘inLab-monkey’, ‘airplane’, ‘¬highBox=1mt’, ‘¬inLab-monkey’, ...
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/20098
![Page 9: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/9.jpg)
ClausesA clause is the disjunction of literals.
Example: B∨¬C∨¬D, Being∨¬Being, ...A unit clause is a clause that contains only a
single literal. Example: B,¬C are unit clauses, B∨¬C isn’t
A empty clause does not contain literals
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/20099
![Page 10: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/10.jpg)
Conjunctive Normal Form (CNF)A proposition is in conjunctive normal form
(CNF) if it is a (finite) conjunction of clauses. Examples: (A∨¬B) ∧ (B ∨¬C ∨¬D),
¬A ∧ B, A ∧ (B ∨ C ∨¬D), ... Counter-examples:
¬(A ∧ B) : ¬ is the outmost operatorA ∧ (B ∨ C ∧ ¬D) : ∧ is nested within ∨
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200910
![Page 11: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/11.jpg)
Conversion to CNF
Every formula P has a CNF, i.e., 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).
Proof: See e.g. (Mendelson, 1987) [Prop. 1.4, Ex. 1.41(a)].
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200911
![Page 12: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/12.jpg)
Conversion to CNF(Remark)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 ↔ (see the next slide)
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200912
![Page 13: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/13.jpg)
Conversion to CNF Basic Tautologies
¬(¬α) ↔ α double-negation elimination
¬(α ∧ β) ↔ (¬α∨¬β) De Morgan’s Law for ∧
¬(α ∨ β) ↔ (¬α∧¬β) De Morgan’s Law for ∨
(α ∧ (β ∨ γ)) ↔ ((α ∧ β) ∨ (α ∧ γ)) distributivity of ∧ over ∨ (α ∨ (β ∧ γ)) ↔ ((α ∨ β) ∧ (α ∨ γ)) distributivity of ∨ over ∧ (α →β)↔ (¬α ∨ β) →-elimination (α ↔β)↔((α →β)∧(β →α)) ↔-elimination
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200913
![Page 14: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/14.jpg)
ExampleConversion to CNF of ‘A↔(B∨C)’1.Eliminate ↔: (A→(B ∨C)) ∧ ((B ∨C) →A)2.Eliminate →: (¬A∨B ∨C) ∧ (¬(B ∨C) ∨A)3.Move ¬ inwards using de Morgan’s laws:(¬A∨B ∨C) ∧ ((¬B ∧¬C) ∨A)
2.Apply distributivity of ∨ over ∧ and flatten: (¬A∨B ∨C) ∧ (¬B ∨A) ∧ (¬C ∨A) (*)
3.(*) in CNF and equivalent to ‘A↔(B∨C)’.
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200914
![Page 15: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/15.jpg)
Disjunctive Normal Form (DNF)Although not necessary to the DPLL
procedure, we mention also the DNFs.Premise: A conjunctive clause is a (finite)
conjunction of literals. NB: it is not a clause!A proposition is in disjunctive normal form
(DNF) if it is a (finite) disjunction of conjunctive clauses.
Examples: ¬A ∨ B, A ∨ (B ∧ C ∧ ¬D), ...
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200915
![Page 16: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/16.jpg)
CNFSAT-Problem
Definition.
CNFSAT = find ν s.t. ν |= P, with P in CNF.
CNFSAT-Problem: Is CNFSAT decidable?
Like PSAT, CNFSAT is NP-complete.
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200916
![Page 17: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/17.jpg)
DPLL ProcedureDPLL employs a backtracking search to
explore the space of propositional variables truth-valuations of an proposition P in CNF, looking for a satisfying truth-valuation of P.
DPLL solves the CNFSAT-Problem by searching a truth-assignment that satisfies all clauses in the input proposition.
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200917
![Page 18: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/18.jpg)
DPLL ProcedureMain Steps1. The DPLL procedure does the following:
1. chooses a literal in the input proposition P2. assignes a truth-value (*) to its variable as to satisfy it3. simplifies P by removing all clauses in P which become true under the truth-assignment in step 2. and all literals in P that become false from the remaining clauses4. recursively checks if the simplified proposition obtained in step 3. is satisfiable; if this is the case, then P is satisfiable. Otherwise, the same recursive checking is done assuming the opposite truth value (*).
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200918
![Page 19: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/19.jpg)
DPLL Procedure Input: a propositin P in CNF. Output: "P satisfiable" or " P unsatisfiable".Step 1 : Unit Propagation
While there is no empty clause and an unit clause exists, select an unit clause and assign a variable in it to satisfy it.
Step 2 : Satisfiability Checking If all clauses are satisfied, return "satisfiable".
Steps 3 and 4 : see the next slide.
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200919
![Page 20: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/20.jpg)
DPLL Procedure (cont’)Step 3 : Unsatisfiability Checking If an empty clause exists, return "unsatisfiable". Step 4 : Splitting Rule - Select a variable whose value is not assigned. - Assign True to the variable and call DPLL. If the result is "satisfiable" then return "satisfiable". - Otherwise, assign False to the variable an call DPLL again.Return the result of it.
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200920
![Page 21: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/21.jpg)
DPLL ProcedureExample 1Take P = A ∧ (A ∨ ¬A) ∧ B The DPLL procedure does the following:
1. chooses a literal in P, e.g., A2. assignes a truth-value to A, e.g., ν(A) = T3.1 simplifies P by removing all clauses in P which become true under ν(A) = T in step 2: remove A and (A∨¬A)[ in fact: by assuming ν(A) = T we have ν(A∨¬A) = T ]3.2 simplifies P by removing all literals in P that become false from the remaining clauses: nothing to remove [ in fact: B is the only remaining clause, and ν(B) = ? ]
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200921
![Page 22: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/22.jpg)
DPLL ProcedureExample 1 (cont’) 4. recursively checks if the simplified proposition
obtained in step 3. is satisfiable:- simplified proposition from step 3: B- is B satisfiable? Yes: just define ν(B) = T, hence ν |= B.
4.1 if this is the case, the original formula is satisfiable:- Yes, this is the case: a model for it is ν s.t. ν(A) = T and ν(B) = T;
4.2 otherwise, the same recursive check is done assuming the opposite truth value:- No, not the case, DPLL did terminate in 4.1.
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200922
![Page 23: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/23.jpg)
DPLL ProcedureExample 2Take P = C ∧ (A ∨ ¬A) ∧ B The DPLL procedure does the following:
1. chooses a literal in P, e.g., C2. assignes a truth-value to C, e.g., ν(C) = T3.1 simplifies P by removing all clauses in P which become true under ν(C) = T in step 2: remove C
3.2 simplifies P by removing all literals in P that become false from the remaining clauses: nothing to remove [ the remaining clauses were not assigned a truth-value ]
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200923
![Page 24: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/24.jpg)
DPLL ProcedureExample 2 (cont’) 4. recursively checks if the simplified proposition
obtained in step 3. is satisfiable:- simplified proposition from step 3: (A∨¬A) ∧ B- is (A∨¬A) ∧ B satisfiable?
Call DPLL from step 1:1. choose a literal in (A∨¬A) ∧ B, e.g., A2. assign a truth-value to A, e.g., ν(A) = T3.1 simplify by removing all clauses in (A∨¬A) ∧ B which become true under ν(A) = T: remove (A∨¬A)
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200924
![Page 25: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/25.jpg)
DPLL ProcedureExample 2 (cont’) 3.2 simplify by removing all literals in (A∨¬A) ∧ B that
become false from the remaining clauses: nothing to remove
4. recursively checks if the simplified proposition obtained in step 3. is satisfiable:- simplified proposition from step 3: B- is B satisfiable? Yes: just define ν(B) = T, hence ν |= B4.1 if this is the case, the original formula is satisfiable:- Yes, this is the case: a model for it is ν s.t. ν(A) = T and ν(B) = T
DPLL terminate with output: "C∧(A∨¬A)∧B satisfiable"
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200925
![Page 26: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/26.jpg)
OutlineReviewReasoning
DP ProcedureProperties
ObservationsSummary
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200926
![Page 27: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/27.jpg)
ObservationsFinding solutions to propositional logic
formulas is an NP-complete problem.A DPLL SAT solver employs a systematic
backtracking search procedure to explore the (exponentially-sized) space of variable assignments looking for satisfying assignments.
Modern SAT solvers (developed in the last ten years) come in two flavors: "conflict-driven" and "look-ahead".
9/2009First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
27
![Page 28: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/28.jpg)
OutlineReviewReasoning
DP ProcedureProperties
DecidabilitySummary
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200928
![Page 29: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/29.jpg)
Pros and Cons - Pros
PL is declarative: syntax captures facts. PL allows disjunctive (partial) /negated
knowledge (unlike most databases). PL is compositional: |=A∧B from |=A and |=B.PSAT fundamental in important applications.
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200929
![Page 30: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/30.jpg)
Pros and Cons - ConsPL has limited expressive power! (yet useful
in lots of applications, see later) Example 1: In PL you cannot say “pits cause
breezes in all adjacent squares” except by writing one sentence for each square.
Example 2 (De Morgan, 1864): inferences like “All horses are animals; therefore, the head of a horse is the head of an animal” cannot be handled in PL.
9/2009First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
30
![Page 31: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/31.jpg)
Example (KB)1. AreaManager → Manager2. TopManager → Manager3. Manager → Employee4. TopManager(John)
Observe: 1,2,3, 4 are propositions.
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200931
![Page 32: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/32.jpg)
Example (cont’)
1. Manager(John)2. Employee(John)
9/2009First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
32
We can’t deduce the following:
![Page 33: L ogics for D ata and K nowledge R epresentation](https://reader036.vdocuments.us/reader036/viewer/2022062814/56816835550346895dddecac/html5/thumbnails/33.jpg)
Example (cont’)1. AreaManager(x) → Manager(x)2. TopManager(x) → Manager(x)3. Manager(x) → Employee(x)4. TopManager(John)
NB: 1,2,3 are not propositions, because of
variables!
First version by Alessandro Agostini and Fausto Giunchiglia Second version by Fausto Giunchiglia and
Rui Zhang
9/200933