DPLL, First-Order Logic




CS156

Chris Pollett

Oct 23, 2017

Outline

Introduction

Horn Clauses and Definite Clauses

Prolog

A Prolog Example Logic Program

Consider the Horn program:

a. /* lines end with a period, a rule without a tail is called a fact */
b:- a.
c:-b.
d:- a, b.

How Prolog computes its answers

Quiz

Which of the following is true?

  1. `A => B` and `B => A` are logically equivalent.
  2. The propositional formula `A ^^ B => C` is satisfiable.
  3. A resolution refutation of a set of clauses `Gamma` implies the conjunction of the clauses in `Gamma` is satisfiable.

DPLL Algorithm: A general resolution finding algorithm

DPLL Algorithm

function DPLL-Satisfiable?(s) returns true or false
   inputs: s a sentence in propositional logic

   clauses := the set of clauses in the CNF representation of s
   symbols := a list of the propositional symbols in s
   return DPLL(clauses, symbols, {})

function DPLL(clauses, symbols, model) returns true or false
   if every clause in clauses is true in model then return true
   if some clause in clauses is false in model then return false
   P, value := FIND-PURE-SYMBOL(symbols, clauses, model)
   if P is non-null then return DPLL(clauses, symbols - P, model ∪ {P=value})
   P, value := FIND-UNIT-CLAUSE(clauses, model)
   if P is non-null then return DPLL(clauses, symbols - P, model ∪ {P=value})
   P := FIRST(symbols); //symbols is a list, this get the first element in the list into P
   rest = REST(symbols); //all the elements in the list excluding the first element
   return DPLL(clauses, rest, model ∪ {P=true}) or
       DPLL(clauses, rest, model ∪ {P=false})

First-Order Logic

Examples