Logics for Data and Knowledge Representation - PowerPoint PPT Presentation

About This Presentation
Title:

Logics for Data and Knowledge Representation

Description:

Title: Logics for Data and Knowledge Representation Last modified by: admin Document presentation format: Custom Other titles: Gill Sans Arial Bookman Old Style Gill ... – PowerPoint PPT presentation

Number of Views:25
Avg rating:3.0/5.0
Slides: 30
Provided by: disiUnit6
Category:

less

Transcript and Presenter's Notes

Title: Logics for Data and Knowledge Representation


1
Logics for Data and KnowledgeRepresentation
  • Propositional Logic Reasoning

Originally by Alessandro Agostini and Fausto
Giunchiglia Modified by Fausto Giunchiglia, Rui
Zhang and Vincenzo Maltese
2
Outline
  • Review of PL Syntax and semantics
  • Reasoning in PL
  • Typical tasks
  • Calculus
  • Problems with reasoning
  • Calculus using tableaux
  • The DPLL Procedure for PSAT
  • Main steps
  • The algorithm
  • Examples
  • Observations about the DPLL
  • Conclusions on PL
  • Pros and cons
  • Examples

3
Summary about PL so far
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • PROPOSITIONS
  • Propositional logic (PL) is the simplest logic
    which deals with propositions (no individuals, no
    quantifiers)
  • Propositions are something true or false
  • SYNTAX
  • We need to provide a language, including the
    alphabet of symbols and formation rules to
    articulate complex formulas (sentences)
  • A propositional theory is formed by a set of PL
    formulas
  • SEMANTICS
  • Providing semantics means providing a pair (M,?),
    namely a formal model satisfying the theory
  • A truth valuation ? is a mapping L ? T, F
  • Logical implication (?)
  • Normal Forms CNF - DNF

3
4
Reasoning Services
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • Basic reasoning tasks for a PL-based system
  • Model checking (EVAL)
  • Satisfiability (SAT) reduced to model checking
    (we choose an assignment first)
  • Validity (VAL) reduced to model checking (try for
    all possible assignments)
  • Unsatisfiability (unSAT) reduced to model
    checking (try for all possible assignments)
  • Entailment (ENT) reduced to previous problems
  • NOTE SAT/UNSAT/VAL on generic formulas can be
    reduced to SAT/UNSAT/VAL on CNF formulas
  • See for instance http//www.satisfiability.org

5
Reasoning in PL
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • Reasoning in PL is the simplest case of reasoning
  • We use truth tables
  • In model checking we just verify a given
    assignment ?
  • In SAT we try with all possible assignments but
    we stop when we find the first one which makes
    the formula true.

Given ?(A) T, ?(B) F is the formula A ? B
true? YES!
Is A ? B satisfiable? With ?(A)T, ?(B)F we
have ?(A ? B) F With ?(A)F, ?(B)T we have ?(A
? B) F With ?(A)T, ?(B)T we have ?(A ? B) T
STOP!
5
6
Calculus
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • Semantic tableau is a decision procedure to
    determine the satisfiability of finite sets of
    formulas.
  • There are rules for handling each of the logical
    connectives thus generating a truth tree.
  • A branch in the tree is closed if a contradiction
    is present along the path (i.e. of an atomic
    formula, e.g. B and ?B)
  • If all branches close, the proof is complete and
    the set of formulas are unsatisfiable, otherwise
    are satisfiable.
  • With refutation tableaux the objective is to show
    that the negation of a formula is unsatisfiable.

G (A ??B), B
B
A ? ?B
A
?B
closed
6
7
Rules of the semantic tableaux
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • Conjunctions lie on the same branch
  • Disjunctions generate new branches
  • The initial set of formulas are considered in
    conjunction and are put in the same branch of the
    tree
  • (?) A ? B (?) A ? B
  • --------- ---------
  • A A B
  • B
  • (?) ? ? A A
  • --------- ---------
  • A ? ? A

??(A ??B) ? B
B
??(A ? ?B)
A ? ?B
A
?B
closed
7
8
What is the problem in reasoning in PL? (I)
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • Given a proposition P with n atomic formulas, we
    have 2n possible assignments ? !
  • SAT is NP-complete
  • In the worst case reasoning time is exponential
    in n (in the case we test all possible
    assignments), but potentially less if we find a
    way to look for good assignments (if there is
    at least an assignment such that ? ? P. We stop
    when we find it.)
  • NOTE the worst case is when the formula is
    unsatisfiable
  • Testing validity (VAL) of a formula P is even
    harder, since we necessarily need to try ALL the
    assignments. We stop when we find a ? such that ?
    ? P

8
9
What is the problem in reasoning in PL? (II)
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • Reducing unSAT to SAT
  • Unsatisfiability is the opposite of SAT. We stop
    when we find an assignment ? such that ? ? P.
  • SAT, VAL, unSAT are search problems
  • How complex is the task?
  • Notice that what makes reasoning exponential are
    disjunctions (?) because we need to test all
    possible options
  • Trivially, in case of conjunctions (?) all the
    variables must be true
  • IMPORTANT Often (when we do not use individuals
    or quantifiers) we can reduce reasoning in
    complex logics to reasoning in PL

9
10
PSAT-Problem (Boolean SAT)
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • Definition PSAT find ? such that ? ? P
    (Satisfiability problem)
  • Is PSAT decidable? YES, BUT EXPENSIVE!
  • Theorem Cook,1971 PSAT is NP-completeThe
    theorem established a limitative result of PL
    (and Logic). A problem is NP-complete when it is
    very difficult to be computed!
  • DPLL (Davis-Putnam-Logemann-Loveland, 1962)
  • It is the most widely used algorithm for PSAT
  • It works on CNF formulas
  • It can take from constant to exponential time

11
CNFSAT-Problem
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • Definition CNFSAT find ? s.t. ? ? P, with P in
    CNF
  • Is CNFSAT decidable? YES, BUT STILL EXPENSIVE!
  • Like PSAT, CNFSAT is NP-complete.
  • Converting a formula in CNF
  • It is always possible to convert a generic
    formula in CNF, but in exponential time
    (polynomial in most of the cases).
  • It causes an exponential blow up in the length of
    the formula.

12
The DPLL Procedure
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • DPLL employs a backtracking search to explore the
    space of propositional variables truth-valuations
    of a 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 ?i in
    the input proposition P ?1 ? ? ?n
  • The basic intuition behind DPLL is that we can
    save time if we first test for some assignments
    before others

13
DPLL Procedure Main Steps
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • 1. It identifies all literal in the input
    proposition P
  • 2. It assigns a truth-value to each variable to
    satisfy them
  • 3. It simplifies P by removing all clauses in P
    which become true under the truth-assignments at
    step 2 and all literals in P that become false
    from the remaining clauses (this may generate
    empty clauses)
  • 4. It 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 ().

B ? C ? (B ? A ? C) ? ( B ? D)
B ? C ? (B ? A ? C) ? ( B ? D) ?(B) T
?(C) F
D
D YES, it is satisfiable for ?(D) T. NOTE
?(A) can be T/F
14
DPLL algorithm
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • Input a proposition P in CNF
  • Output true if "P satisfiable" or false if "P
    unsatisfiable"
  • boolean function DPLL(P)
  • if consistent(P) then return true
  • if hasEmptyClause(P) then return false
  • foreach unit clause C in P do
  • P unit-propagate(C, P)
  • foreach pure-literal L in P do
  • P pure-literal-assign(L, P)
  • L choose-literal(P)
  • return DPLL(P ? L) OR DPLL(P ? ?L)

14
15
DPLL algorithm
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • Input a proposition P in CNF
  • Output true if "P satisfiable" or false if "P
    unsatisfiable"
  • boolean function DPLL(P)
  • if consistent(P) then return true
  • if hasEmptyClause(P) then return false
  • foreach unit clause C in P do
  • P unit-propagate(C, P)
  • foreach pure-literal L in P do
  • P pure-literal-assign(L, P)
  • L choose-literal(P)
  • return DPLL(P ? L) OR DPLL(P ? ?L)

It tests the formula P for consistency, namely it
does not contain contradictions (e.g. A ? ?A)
and all clauses are unit clauses.
15
16
DPLL algorithm
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • Input a proposition P in CNF
  • Output true if "P satisfiable" or false if "P
    unsatisfiable"
  • boolean function DPLL(P)
  • if consistent(P) then return true
  • if hasEmptyClause(P) then return false
  • foreach unit clause C in P do
  • P unit-propagate(C, P)
  • foreach pure-literal L in P do
  • P pure-literal-assign(L, P)
  • L choose-literal(P)
  • return DPLL(P ? L) OR DPLL(P ? ?L)

An empty clause does not contain literals. It
can be due to previous iterations of the
algorithm where some simplifications has been
done. If any of them exists then P is
unsatisfiable.
16
17
DPLL algorithm
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • Input a proposition P in CNF
  • Output true if "P satisfiable" or false if "P
    unsatisfiable"
  • boolean function DPLL(P)
  • if consistent(P) then return true
  • if hasEmptyClause(P) then return false
  • foreach unit clause C in P do
  • P unit-propagate(C, P)
  • foreach pure-literal L in P do
  • P pure-literal-assign(L, P)
  • L choose-literal(P)
  • return DPLL(P ? L) OR DPLL(P ? ?L)

(a) It assigns the right truth value to each
literal (true for positives and false for
negatives). (b) It simplifies P by removing all
clauses in P which become true under the
truth-assignment and all literals in P that
become false from the remaining clauses.
17
18
DPLL algorithm
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • Input a proposition P in CNF
  • Output true if "P satisfiable" or false if "P
    unsatisfiable"
  • boolean function DPLL(P)
  • if consistent(P) then return true
  • if hasEmptyClause(P) then return false
  • foreach unit clause C in P do
  • P unit-propagate(C, P)
  • foreach pure-literal L in P do
  • P pure-literal-assign(L, P)
  • L choose-literal(P)
  • return DPLL(P ? L) OR DPLL(P ? ?L)

For all literals which appear pure in the formula
(i.e. with only one polarity) assign the
corresponding value - true if positive
literal - false if negative Not all DPLL
versions perform this step.
18
19
DPLL algorithm
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • Input a proposition P in CNF
  • Output true if "P satisfiable" or false if "P
    unsatisfiable"
  • boolean function DPLL(P)
  • if consistent(P) then return true
  • if hasEmptyClause(P) then return false
  • foreach unit clause C in P do
  • P unit-propagate(C, P)
  • foreach pure-literal L in P do
  • P pure-literal-assign(L, P)
  • L choose-literal(P)
  • return DPLL(P ? L) OR DPLL(P ? ?L)

The splitting rule Select a variable whose
value is not assigned yet. Recursively call
DPLL for the cases in which the literal is true
or false.
19
20
DPLL Procedure Example 1
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • P A ? (A ? A) ? B
  • There are still variables and clauses to analyze,
    go ahead
  • P does not contain empty clauses, go ahead
  • It assigns the right truth-value to A and B ?(A)
    T, ?(B) T
  • It simplifies P by removing all clauses in P
    which become true under ?(A) T and ?(B) T
  • This causes the removal of all the clauses in P
  • It simplifies P by removing all literals in the
    clauses of P that become false from the remaining
    clauses nothing to remove
  • It assigns values to pure literals. nothing to
    assign
  • All variables are assigned it returns true

20
21
DPLL Procedure Example 2
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • P C ? (A ? A) ? B
  • There are still variables and clauses to analyze,
    go ahead
  • P does not contain empty clauses, go ahead
  • It assigns the right truth-value to C and B ?(C)
    T, ?(B) T
  • It simplifies P by removing all clauses in P
    which become true under ?(C) T and ?(B) T.
  • P is then simplified to (A ? A)
  • It simplifies P by removing all literals in the
    clauses of P that become false from the remaining
    clauses nothing to remove
  • It assigns values to pure literals nothing to
    assign
  • It selects A and applies the splitting rule by
    calling DPLL on
  • A ? (A ? A) AND A ? (A ? A)
  • which are both true (the first call is enough).
    It returns true

21
22
DPLL Procedure Example 3
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • P A ? B ? (A ? B)
  • There are still variables and clauses to analyze,
    go ahead
  • P does not contain empty clauses, go ahead
  • It assigns the right truth-value to A and B
  • ?(A) T, ?(B) F
  • It simplifies P by removing all clauses in P
    which become true under ?(A) T and ?(B) F.
  • P is simplified to (A ? B)
  • It simplifies P by removing all literals in the
    clauses of P that become false from the remaining
    clauses the last clause becomes empty
  • It assigns values to pure literals nothing to
    assign
  • All variables are assigned but there is an empty
    clause it returns false

22
23
The branching literal
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • The branching literal is the literal considered
    in the backtracking step (the one chosen for the
    splitting rule)
  • The DPLL algorithm (and corresponding efficiency)
    highly depends on the choice of the branching
    literal
  • DPLL as a family of algorithms
  • One for each possible way of choosing the
    branching literal
  • The running time can be constant or exponential
    depending on the choice of the branching literals
  • Researches mainly focus on smart choices for the
    branching literal

24
Final observations on the DPLL
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • There are several versions of the DPLL. We
    presented one.
  • Finding solutions to propositional logic formulas
    is an NP-complete problem
  • A DPLL SAT solver
  • works on formulas in CNF
  • 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 approaches

24
25
Using DPLL for reasoning tasks
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • Model checking Does ? satisfy P? (? ? P?)
  • Check if ?(P) true
  • Satisfiability Is there any ? such that ? ? P?
  • Check that DPLL(P) succeeds and returns a ?
  • Unsatisfiability Is it true that there are no ?
    satisfying P?
  • Check that DPLL(P) fails
  • Validity Is P a tautology? (true for all ?)
  • Check that DPLL(?P) fails
  • NOTE typical DPLL implementations take two
    parameters the proposition P and a model ?.
    Therefore, in case of model checking the real
    call would be DPLL(P, ?) and check that it
    succeeds

25
26
Pros and Cons of PL
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • PROS
  • PL is declarative the syntax captures facts
  • PL allows disjunctive (partial) and negated
    knowledge (unlike most databases)
  • PSAT is fundamental in important applications
  • CONS
  • PL has limited expressive power (yet useful in
    lots of applications)
  • No enumerations
  • No qualifiers (exists, for all)
  • No instances

27
Example (KB)
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • Consider the following propositions
  • AreaManager ? Manager TopManager ? Manager
  • Manager ? Employee TopManager(John)
  • Since we cannot reason on instances, we cant
    deduce the following
  • Manager(John), Employee(John)

28
Example (KB)
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • Consider the following
  • AreaManager(x) ? Manager(x) Manager(x) ?
    Employee(x)
  • TopManager(x) ? Manager(x) TopManager(John)
  • They are not propositions because of the
    variables.

28
29
Example (DB)
REVIEW REASONING IN PL THE DPLL PROCEDURE
OBSERVATIONS CONCLUSIONS
  • If we codify it as a database
  • No negations
  • No disjunctions
  • the reasoning is polynomial.

29
Write a Comment
User Comments (0)
About PowerShow.com