Informatics 1 SATisfaction revision Michael Fourman 1 0 1 1 - - PowerPoint PPT Presentation

informatics 1
SMART_READER_LITE
LIVE PREVIEW

Informatics 1 SATisfaction revision Michael Fourman 1 0 1 1 - - PowerPoint PPT Presentation

Informatics 1 SATisfaction revision Michael Fourman 1 0 1 1 B for booleans A B = 0 A iff A B S If we have a chain of n-1 implications R between n variables we can draw the line in n+1 places making


slide-1
SLIDE 1

Informatics 1

SATisfaction revision

Michael Fourman

1

slide-2
SLIDE 2

1 A B

0 ≤ 1 ⊥ ≤ ⊤ for booleans A → B = ⊤ iff A ≤ B

slide-3
SLIDE 3

S R Q P

⊤ ⊥

If we have a chain of n-1 implications between n variables we can draw the line in n+1 places making any number, from 0 to n,

  • f these variables true.
slide-4
SLIDE 4

S ¬R Q ¬P

⊤ ⊥

If some of the variables are negated we can do the same (but making the negated variables false when they fall above the line and true when they fall below)

slide-5
SLIDE 5

S P Q ¬P

⊤ ⊥

If a variable appears together with its negation, we have to draw the line between them. Here, P must be true. (¬P → P) →P is a tautology

slide-6
SLIDE 6

S ¬R Q R

⊤ ⊥

If a variable appears together with its negation, we have to draw the line between them. Here, R must be false. (R → ¬R) →¬R is a tautology

slide-7
SLIDE 7

S ¬R Q ¬P

⊤ ⊥

The same trick works if

  • ur implications form a

partial order. But we have more

  • ptions since we can

draw a wavy line. ¬W V The arrow rule says that, whenever our line cuts an arrow, then the head must be on the side of true and the tail on the side of false.

slide-8
SLIDE 8

S ¬R Q ¬P

⊤ ⊥

The same trick works if

  • ur implications form a

partial order. But we have more

  • ptions since we can

draw a wavy line. Not all of the valid truth assignments are represented in this diagram. How many are missing? ¬W V

slide-9
SLIDE 9

Clausal Form

9

Clausal form is a set of sets of literals

{ {¬A,C}, {¬B,D}, {¬E,B}, {¬E,A}, {A,E}, {E,B},{¬B, ¬C, ¬D} }

A (partial) truth assignment makes a clause true iff it makes at least one of its literals true (so it can never make the empty clause {} true) A (partial) truth assignment makes a clausal form true iff it makes all of its clauses true ( so the empty clausal form {} is always true ).

slide-10
SLIDE 10

A clausal form with at most two literals per clause. Corresponds to a conjunction of implications. We can draw the directed graph and count the satisfying valuations. When 3 or more are involved, satisfaction gets complicated. In general, we must search for satisfaction.

2-SAT

slide-11
SLIDE 11

11

¬A⋁C ¬B⋁D ¬B⋁¬C⋁¬D

A AB ABC ABC̅ ABCD ABCD̅ AB̅ A̅

¬A ⋁ C ¬B ⋁ D ¬B ⋁ ¬C ⋁ ¬D ¬E ⋁ B E ⋁ B A ⋁ E ¬E ⋁ A Naive search

slide-12
SLIDE 12

Naive search

function Naive(V, Φ) if V ⊨ ¬Φ then return false; if V ⊨ Φ¬then return true;

  • therwise,

choose an A mentioned in Φ but not mentioned in V return Naive(V^A, Φ) || Naive(V^¬A, Φ) (call Naive(∅, Φ))

slide-13
SLIDE 13

13

¬A⋁C ¬B⋁D ¬B⋁¬C⋁¬D ¬E⋁B E⋁B

A AB ABC ABC̅ ABCD ABCD̅ AB̅ AB̅C AB̅C̅ AB̅CD AB̅CD̅

¬A⋁C

AB̅CDE AB̅CDE̅ AB̅CD̅E AB̅CD̅E̅

¬E⋁B E⋁B

Naive search

slide-14
SLIDE 14

14

¬A⋁C ¬B⋁D ¬B⋁¬C⋁¬D ¬E⋁B E⋁B A⋁E A⋁¬E

A AB ABC ABC̅ ABCD ABCD̅ AB̅ AB̅C AB̅C̅ AB̅CD AB̅CD̅

¬A⋁C

AB̅CDE AB̅CDE̅ AB̅CD̅E AB̅CD̅E̅

¬E⋁B E⋁B

A̅ A̅XXX A̅XXXE A̅XXXE̅

slide-15
SLIDE 15

function Naive(V, Φ) if V ⊨ ¬Φ then return false; if V ⊨ Φ¬then return true; if V, C ⊨ X,

where X is literal and clause C ∈ Φ

return Naive(V^X, Φ)

  • therwise,

choose an A mentioned in Φ but not mentioned in V return Naive(V^A, Φ) || Naive(V^¬A, Φ) (call Naive(∅, Φ))

Davis Putnam Logemann Loveland (DPLL)

slide-16
SLIDE 16

16

¬A⋁C ¬B⋁D ¬B⋁¬C⋁¬D ¬E⋁B E⋁B A⋁E ¬E⋁A Idea! Use the problem to simplify the search A ¬A ¬B⋁D ¬B ¬E⋁B E⋁B A⋁E ¬E⋁A C ¬B⋁ ⋁¬D B ¬A ¬B ¬B ¬E⋁B E⋁B A⋁E ¬E⋁A ¬B D C D Unit Propagation

slide-17
SLIDE 17

Davis Putnam Logemann Loveland (DPLL) implementation - add V to Φ unit propagation

function DPLL(Φ) if Φ is a consistent set of literals then return true; if Φ contains an empty clause then return false; for every unit clause l in Φ Φ ← unit-propagate(l, Φ); l ← choose-literal(Φ); return DPLL(Φ ∪ {l}) or DPLL(Φ ∪ {not(l)});

slide-18
SLIDE 18

18

Clausal form is a set of sets of literals X = { X0, X1, … , Xn-1 }

Resolution rule for clauses

X Y where ¬A ∈ X, A ∈ Y (X ⋃ Y) \ { ¬A, A } If either X or Y is a singleton then this is just unit propagation. So, resolution is a generalisation of unit propagation. Search is no longer needed

slide-19
SLIDE 19

19

¬A⋁C ¬B⋁D ¬B⋁¬C⋁¬D

AB ABC ABC̅ ABCD ABCD̅

¬B⋁¬C⋁¬D ¬B⋁D ¬B⋁¬C Premises Conclusion Any assignment of truth values that makes all the premises true will make the conclusion true. The conclusion follows from the premises A valid inference

slide-20
SLIDE 20

20

¬A⋁C ¬B⋁D ¬B⋁¬C⋁¬D

AB ABC ABC̅ ABCD ABCD̅

¬B⋁¬C⋁¬D ¬B⋁D ¬B⋁¬C Premises Conclusion Any assignment of truth values that makes the conclusion false will make at least one of the premises false. For any valid inference

slide-21
SLIDE 21

21

¬A⋁C ¬B⋁D ¬B⋁¬C⋁¬D

AB ABC ABC̅ ABCD ABCD̅

¬B⋁¬C⋁¬D ¬B⋁D ¬B⋁¬C Premises Conclusion If some assignment XYZ of values for ABC makes the conclusion false then the assignments XYZD and XYZD̅ each make one or other of the two premises false. A special property

  • f this inference

¬B⋁¬C

slide-22
SLIDE 22

A B C D E ¬A⋁B ¬B⋁C ¬C⋁D ¬D⋁E ¬A⋁C ¬A⋁D ¬B⋁D B C D ¬A⋁E ¬B⋁E ¬C⋁E We keep adding clauses obtained by resolution. Davis Putnam - choose a variable then add all instances. Different orders for resolution will give the same results.

slide-23
SLIDE 23

Davis Putnam Take a collection of clauses. For each propositional letter, A For each pair ∊⋀∊⋀A∊⋀A∊

  • if Areturn UNSAT

if Ais consistent return SAT Where AA, A Heuristic: start with variables that occur seldom.