Introduction to Propositional Logic - Home - CECS - ANU

220
Introduction to Propositional Logic Jinbo Huang Australian National University Jinbo Huang Introduction to Propositional Logic

Transcript of Introduction to Propositional Logic - Home - CECS - ANU

Introduction to Propositional Logic

Jinbo Huang

Australian National University

Jinbo Huang Introduction to Propositional Logic

Overview

I Syntax and semantics

I Reasoning methods

Jinbo Huang Introduction to Propositional Logic

Propositional Logic: Ingredients

Burglary ∨ Earthquake → Alarm

Variables

I A,B ,C , . . .

I Burglary ,Earthquake,Alarm, . . .

Connectives

I ¬ (not, negation)

I ∧ (and, conjunction)

I ∨ (or, disjunction)

I → (implication)

I ↔ (biconditional)

Jinbo Huang Introduction to Propositional Logic

Propositional Logic: Sentences

Every variable is a sentence

If α and β are sentences, so are

I ¬(α)

I (α) ∧ (β)

I (α) ∨ (β)

I (α)→ (β)

I (α)↔ (β)

Parentheses omitted where no confusion arises

Jinbo Huang Introduction to Propositional Logic

Propositional Sentences

Burglary ∨ Earthquake → Alarm

(A ∨ B) ∧ (A ∨ ¬B)→ A

¬(A ∧ B)↔ (¬A ∨ ¬B)

Jinbo Huang Introduction to Propositional Logic

Semantics: Worlds

World, interpretation, evaluation, truth assignment,variable instantiation

I Map from variables to {true, false} / {1, 0}I ω1(A) = 1, ω1(B) = 0, ω1(C ) = 1, . . .

I ω2(A) = 0, ω2(B) = 1, ω2(C ) = 1, . . .

I 2n possible worlds for n variables

Jinbo Huang Introduction to Propositional Logic

Semantics: Worlds

World, interpretation, evaluation, truth assignment,variable instantiation

I Map from variables to {true, false} / {1, 0}I ω1(A) = 1, ω1(B) = 0, ω1(C ) = 1, . . .

I ω2(A) = 0, ω2(B) = 1, ω2(C ) = 1, . . .

I 2n possible worlds for n variables

Jinbo Huang Introduction to Propositional Logic

Semantics: Truth of Sentences, Models

Given world ω, ω |= α: α evaluates to 1 under ω

I ω |= X iff ω(X ) = 1

I ω |= ¬α iff ω 6|= α

I ω |= α ∧ β iff ω |= α and ω |= β

I ω |= α ∨ β iff ω |= α or ω |= β

I α→ β ≡ ¬α ∨ βI α↔ β ≡ (α→ β) ∧ (β → α)

ω |= α: ω is a model of α, ω satisfies α

Jinbo Huang Introduction to Propositional Logic

Semantics: Truth of Sentences, Models

Given world ω, ω |= α: α evaluates to 1 under ω

I ω |= X iff ω(X ) = 1

I ω |= ¬α iff ω 6|= α

I ω |= α ∧ β iff ω |= α and ω |= β

I ω |= α ∨ β iff ω |= α or ω |= β

I α→ β ≡ ¬α ∨ βI α↔ β ≡ (α→ β) ∧ (β → α)

ω |= α: ω is a model of α, ω satisfies α

Jinbo Huang Introduction to Propositional Logic

Semantics: Truth of Sentences, Models

Given world ω, ω |= α: α evaluates to 1 under ω

I ω |= X iff ω(X ) = 1

I ω |= ¬α iff ω 6|= α

I ω |= α ∧ β iff ω |= α and ω |= β

I ω |= α ∨ β iff ω |= α or ω |= β

I α→ β ≡ ¬α ∨ βI α↔ β ≡ (α→ β) ∧ (β → α)

ω |= α: ω is a model of α, ω satisfies α

Jinbo Huang Introduction to Propositional Logic

Semantics: Truth of Sentences, Models

Given world ω, ω |= α: α evaluates to 1 under ω

I ω |= X iff ω(X ) = 1

I ω |= ¬α iff ω 6|= α

I ω |= α ∧ β iff ω |= α and ω |= β

I ω |= α ∨ β iff ω |= α or ω |= β

I α→ β ≡ ¬α ∨ βI α↔ β ≡ (α→ β) ∧ (β → α)

ω |= α: ω is a model of α, ω satisfies α

Jinbo Huang Introduction to Propositional Logic

Semantics: Truth of Sentences, Models

Given world ω, ω |= α: α evaluates to 1 under ω

I ω |= X iff ω(X ) = 1

I ω |= ¬α iff ω 6|= α

I ω |= α ∧ β iff ω |= α and ω |= β

I ω |= α ∨ β iff ω |= α or ω |= β

I α→ β ≡ ¬α ∨ βI α↔ β ≡ (α→ β) ∧ (β → α)

ω |= α: ω is a model of α, ω satisfies α

Jinbo Huang Introduction to Propositional Logic

Semantics: Truth of Sentences, Models

Given world ω, ω |= α: α evaluates to 1 under ω

I ω |= X iff ω(X ) = 1

I ω |= ¬α iff ω 6|= α

I ω |= α ∧ β iff ω |= α and ω |= β

I ω |= α ∨ β iff ω |= α or ω |= β

I α→ β ≡ ¬α ∨ βI α↔ β ≡ (α→ β) ∧ (β → α)

ω |= α: ω is a model of α, ω satisfies α

Jinbo Huang Introduction to Propositional Logic

Semantics: Truth of Sentences, Models

Given world ω, ω |= α: α evaluates to 1 under ω

I ω |= X iff ω(X ) = 1

I ω |= ¬α iff ω 6|= α

I ω |= α ∧ β iff ω |= α and ω |= β

I ω |= α ∨ β iff ω |= α or ω |= β

I α→ β ≡ ¬α ∨ βI α↔ β ≡ (α→ β) ∧ (β → α)

ω |= α: ω is a model of α, ω satisfies α

Jinbo Huang Introduction to Propositional Logic

Truth of Sentences

Burglary ∨ Earthquake → Alarm

I ω1 = {Burglary ,Earthquake,Alarm}

I ω2 = {Burglary ,Earthquake,Alarm}

Jinbo Huang Introduction to Propositional Logic

Truth of Sentences

Burglary ∨ Earthquake → Alarm

I ω1 = {Burglary ,Earthquake,Alarm}

I ω2 = {Burglary ,Earthquake,Alarm}

Jinbo Huang Introduction to Propositional Logic

Sentences as Boolean Functions

Each sentence is a function

I Plug in values (1/0) for variables

I Get value (1/0) for whole sentence

Function depends only on the mapping, notcomposition of sentence

Different sentences can define same function

I A ∨ (B ∧ C )

I (A ∨ B) ∧ (A ∨ C )

Jinbo Huang Introduction to Propositional Logic

Sentences as Boolean Functions

Each sentence is a function

I Plug in values (1/0) for variables

I Get value (1/0) for whole sentence

Function depends only on the mapping, notcomposition of sentence

Different sentences can define same function

I A ∨ (B ∧ C )

I (A ∨ B) ∧ (A ∨ C )

Jinbo Huang Introduction to Propositional Logic

Sentences as Boolean Functions

Each sentence is a function

I Plug in values (1/0) for variables

I Get value (1/0) for whole sentence

Function depends only on the mapping, notcomposition of sentence

Different sentences can define same function

I A ∨ (B ∧ C )

I (A ∨ B) ∧ (A ∨ C )

Jinbo Huang Introduction to Propositional Logic

Sentences as Boolean Functions

Set of models determines function

For n variables

I # possible sentences infinite

I # possible worlds 2n

I # possible sets of models 22n

I # possible functions 22n

Jinbo Huang Introduction to Propositional Logic

Sentences as Boolean Functions

Set of models determines function

For n variables

I # possible sentences

infinite

I # possible worlds 2n

I # possible sets of models 22n

I # possible functions 22n

Jinbo Huang Introduction to Propositional Logic

Sentences as Boolean Functions

Set of models determines function

For n variables

I # possible sentences infinite

I # possible worlds 2n

I # possible sets of models 22n

I # possible functions 22n

Jinbo Huang Introduction to Propositional Logic

Sentences as Boolean Functions

Set of models determines function

For n variables

I # possible sentences infinite

I # possible worlds

2n

I # possible sets of models 22n

I # possible functions 22n

Jinbo Huang Introduction to Propositional Logic

Sentences as Boolean Functions

Set of models determines function

For n variables

I # possible sentences infinite

I # possible worlds 2n

I # possible sets of models 22n

I # possible functions 22n

Jinbo Huang Introduction to Propositional Logic

Sentences as Boolean Functions

Set of models determines function

For n variables

I # possible sentences infinite

I # possible worlds 2n

I # possible sets of models

22n

I # possible functions 22n

Jinbo Huang Introduction to Propositional Logic

Sentences as Boolean Functions

Set of models determines function

For n variables

I # possible sentences infinite

I # possible worlds 2n

I # possible sets of models 22n

I # possible functions 22n

Jinbo Huang Introduction to Propositional Logic

Sentences as Boolean Functions

Set of models determines function

For n variables

I # possible sentences infinite

I # possible worlds 2n

I # possible sets of models 22n

I # possible functions

22n

Jinbo Huang Introduction to Propositional Logic

Sentences as Boolean Functions

Set of models determines function

For n variables

I # possible sentences infinite

I # possible worlds 2n

I # possible sets of models 22n

I # possible functions 22n

Jinbo Huang Introduction to Propositional Logic

Completeness of Connectives

Is every Boolean function represented by somesentence?

Depends on the connectives allowed

Not if only {∧,∨} allowed, e.g.

I Cannot express ¬A

I Proof by noting monotonicity

Jinbo Huang Introduction to Propositional Logic

Completeness of Connectives

Is every Boolean function represented by somesentence?

Depends on the connectives allowed

Not if only {∧,∨} allowed, e.g.

I Cannot express ¬A

I Proof by noting monotonicity

Jinbo Huang Introduction to Propositional Logic

Completeness of Connectives

Is every Boolean function represented by somesentence?

Depends on the connectives allowed

Not if only {∧,∨} allowed, e.g.

I Cannot express ¬A

I Proof by noting monotonicity

Jinbo Huang Introduction to Propositional Logic

Completeness of Connectives: {∧,∨,¬}

Function ≡ set of models

{ABC ,ABC ,ABC}I ¬A ∧ B ∧ C

I A ∧ ¬B ∧ C

I A ∧ B ∧ C

(¬A ∧ B ∧ C ) ∨ (A ∧ ¬B ∧ C ) ∨ (A ∧ B ∧ C )

Set of models ⇒ sentence using only {∧,∨,¬}

Jinbo Huang Introduction to Propositional Logic

Completeness of Connectives: {∧,∨,¬}

Function ≡ set of models

{ABC ,ABC ,ABC}I ¬A ∧ B ∧ C

I A ∧ ¬B ∧ C

I A ∧ B ∧ C

(¬A ∧ B ∧ C ) ∨ (A ∧ ¬B ∧ C ) ∨ (A ∧ B ∧ C )

Set of models ⇒ sentence using only {∧,∨,¬}

Jinbo Huang Introduction to Propositional Logic

Completeness of Connectives: {∧,∨,¬}

Function ≡ set of models

{ABC ,ABC ,ABC}

I ¬A ∧ B ∧ C

I A ∧ ¬B ∧ C

I A ∧ B ∧ C

(¬A ∧ B ∧ C ) ∨ (A ∧ ¬B ∧ C ) ∨ (A ∧ B ∧ C )

Set of models ⇒ sentence using only {∧,∨,¬}

Jinbo Huang Introduction to Propositional Logic

Completeness of Connectives: {∧,∨,¬}

Function ≡ set of models

{ABC ,ABC ,ABC}I ¬A ∧ B ∧ C

I A ∧ ¬B ∧ C

I A ∧ B ∧ C

(¬A ∧ B ∧ C ) ∨ (A ∧ ¬B ∧ C ) ∨ (A ∧ B ∧ C )

Set of models ⇒ sentence using only {∧,∨,¬}

Jinbo Huang Introduction to Propositional Logic

Completeness of Connectives: {∧,∨,¬}

Function ≡ set of models

{ABC ,ABC ,ABC}I ¬A ∧ B ∧ C

I A ∧ ¬B ∧ C

I A ∧ B ∧ C

(¬A ∧ B ∧ C ) ∨ (A ∧ ¬B ∧ C ) ∨ (A ∧ B ∧ C )

Set of models ⇒ sentence using only {∧,∨,¬}

Jinbo Huang Introduction to Propositional Logic

Completeness of Connectives: {∧,∨,¬}

Function ≡ set of models

{ABC ,ABC ,ABC}I ¬A ∧ B ∧ C

I A ∧ ¬B ∧ C

I A ∧ B ∧ C

(¬A ∧ B ∧ C ) ∨ (A ∧ ¬B ∧ C ) ∨ (A ∧ B ∧ C )

Set of models ⇒ sentence using only {∧,∨,¬}

Jinbo Huang Introduction to Propositional Logic

Completeness of Connectives: {∧,∨,¬}

Function ≡ set of models

{ABC ,ABC ,ABC}I ¬A ∧ B ∧ C

I A ∧ ¬B ∧ C

I A ∧ B ∧ C

(¬A ∧ B ∧ C ) ∨ (A ∧ ¬B ∧ C ) ∨ (A ∧ B ∧ C )

Set of models ⇒ sentence using only {∧,∨,¬}

Jinbo Huang Introduction to Propositional Logic

Completeness of Connectives: {∧,¬}

Can express ∨ using {∧,¬}

A ∨ B ≡ ¬(¬A ∧ ¬B)

Similarly, {∨,¬} is complete

A ∧ B ≡ ¬(¬A ∨ ¬B)

Jinbo Huang Introduction to Propositional Logic

Completeness of Connectives: {∧,¬}

Can express ∨ using {∧,¬}

A ∨ B ≡ ¬(¬A ∧ ¬B)

Similarly, {∨,¬} is complete

A ∧ B ≡ ¬(¬A ∨ ¬B)

Jinbo Huang Introduction to Propositional Logic

Completeness of Connectives: {↑}

NAND: A ↑ Bdef= ¬(A ∧ B)

∧,∨,¬ can be expressed with ↑ alone

I A ∧ B ≡ (A ↑ B) ↑ >I A ∨ B ≡ (A ↑ >) ↑ (B ↑ >)

I ¬A ≡ A ↑ >

>: true

⊥: false

Similarly, {↓} (NOR alone) is complete

Jinbo Huang Introduction to Propositional Logic

Completeness of Connectives: {↑}

NAND: A ↑ Bdef= ¬(A ∧ B)

∧,∨,¬ can be expressed with ↑ alone

I A ∧ B ≡ (A ↑ B) ↑ >I A ∨ B ≡ (A ↑ >) ↑ (B ↑ >)

I ¬A ≡ A ↑ >

>: true

⊥: false

Similarly, {↓} (NOR alone) is complete

Jinbo Huang Introduction to Propositional Logic

Completeness of Connectives: {↑}

NAND: A ↑ Bdef= ¬(A ∧ B)

∧,∨,¬ can be expressed with ↑ alone

I A ∧ B ≡ (A ↑ B) ↑ >I A ∨ B ≡ (A ↑ >) ↑ (B ↑ >)

I ¬A ≡ A ↑ >

>: true

⊥: false

Similarly, {↓} (NOR alone) is complete

Jinbo Huang Introduction to Propositional Logic

Useful Identities

DeMorgan’s

I ¬(A ∧ B) ≡ ¬A ∨ ¬B

I ¬(A ∨ B) ≡ ¬A ∧ ¬B

Distribution

I A ∧ (B ∨ C ) ≡ (A ∧ B) ∨ (A ∧ C )

I A ∨ (B ∧ C ) ≡ (A ∨ B) ∧ (A ∨ C )

Jinbo Huang Introduction to Propositional Logic

Reasoning Tasks

Satisfiability (SAT)

I Given α, does α have a model?

I ∃ω, ω |= α

Validity

I Given α, is α 1 in all worlds?

I ∀ω, ω |= α

I Reducible to SAT: α is valid iff ¬α is not SAT

Jinbo Huang Introduction to Propositional Logic

Reasoning Tasks

Entailment

I Given α and β, is β 1 whenever α is 1?

I α |= β: models(α) ⊆ models(β)

I Reducible to validity: α |= β iff α→ β is valid

Equivalence

I α ≡ β: models(α) = models(β)

I Reducible to entailment: α |= β and β |= α

Jinbo Huang Introduction to Propositional Logic

How is Logic Useful?

Knowledge base ∆

I okX → (A↔ ¬B)

I okY → (B ↔ ¬C )

Is AC normal?

I Is it possible for okX and okY to be both 1?

I Is (A ∧ ¬C ∧ okX ∧ okY ∧∆) SAT?

Jinbo Huang Introduction to Propositional Logic

How is Logic Useful?

Knowledge base ∆

I okX → (A↔ ¬B)

I okY → (B ↔ ¬C )

Is AC normal?

I Is it possible for okX and okY to be both 1?

I Is (A ∧ ¬C ∧ okX ∧ okY ∧∆) SAT?

Jinbo Huang Introduction to Propositional Logic

How is Logic Useful?

Knowledge base ∆

I okX → (A↔ ¬B)

I okY → (B ↔ ¬C )

Is AC normal?

I Is it possible for okX and okY to be both 1?

I Is (A ∧ ¬C ∧ okX ∧ okY ∧∆) SAT?

Jinbo Huang Introduction to Propositional Logic

How is Logic Useful?

Diagnosis

I Is observation normal?

I What components might be broken?

Verification

I Does circuit/program correctly implementspecification?

I Can some “bad” behavior happen?

Planning

I Is there sequence of actions to reach goal?

Jinbo Huang Introduction to Propositional Logic

Reasoning Methods: Is α SAT?

Semantic reasoning

I Search for ω such that ω |= α

Syntactic reasoning (inference, proof)

I Create new sentences from α by applyingsyntactic rules

I Stop when proof of UNSAT is producedI Rules should be sound and complete

I UNSAT proof will be produced iff α is not SAT

Jinbo Huang Introduction to Propositional Logic

Negation Normal Form (NNF)

{∧,∨,¬} only

¬ applied to variables only

NNF

I (A ∧ ¬B) ∨ C

I (A ∨ B) ∧ (B ∨ ¬C )

Not NNF

I A→ (B ∨ C )

I ¬(¬(A ∧ B) ∧ (C ∨ D))

Jinbo Huang Introduction to Propositional Logic

Negation Normal Form (NNF)

{∧,∨,¬} only

¬ applied to variables only

NNF

I (A ∧ ¬B) ∨ C

I (A ∨ B) ∧ (B ∨ ¬C )

Not NNF

I A→ (B ∨ C )

I ¬(¬(A ∧ B) ∧ (C ∨ D))

Jinbo Huang Introduction to Propositional Logic

Negation Normal Form (NNF)

{∧,∨,¬} only

¬ applied to variables only

NNF

I (A ∧ ¬B) ∨ C

I (A ∨ B) ∧ (B ∨ ¬C )

Not NNF

I A→ (B ∨ C )

I ¬(¬(A ∧ B) ∧ (C ∨ D))

Jinbo Huang Introduction to Propositional Logic

Conversion to NNF

Eliminate connectives other than ∧,∨,¬

I Always possible by completeness of {∧,∨,¬}

Push ¬ all the way to variables

I Always possible by DeMorgan’s laws

¬(¬(A ∧ B) ∧ (C ∨ D)) becomes

(A ∧ B) ∨ (¬C ∧ ¬D)

Jinbo Huang Introduction to Propositional Logic

Conversion to NNF

Eliminate connectives other than ∧,∨,¬I Always possible by completeness of {∧,∨,¬}

Push ¬ all the way to variables

I Always possible by DeMorgan’s laws

¬(¬(A ∧ B) ∧ (C ∨ D)) becomes

(A ∧ B) ∨ (¬C ∧ ¬D)

Jinbo Huang Introduction to Propositional Logic

Conversion to NNF

Eliminate connectives other than ∧,∨,¬I Always possible by completeness of {∧,∨,¬}

Push ¬ all the way to variables

I Always possible by DeMorgan’s laws

¬(¬(A ∧ B) ∧ (C ∨ D)) becomes

(A ∧ B) ∨ (¬C ∧ ¬D)

Jinbo Huang Introduction to Propositional Logic

Conversion to NNF

Eliminate connectives other than ∧,∨,¬I Always possible by completeness of {∧,∨,¬}

Push ¬ all the way to variables

I Always possible by DeMorgan’s laws

¬(¬(A ∧ B) ∧ (C ∨ D)) becomes

(A ∧ B) ∨ (¬C ∧ ¬D)

Jinbo Huang Introduction to Propositional Logic

Conversion to NNF

Eliminate connectives other than ∧,∨,¬I Always possible by completeness of {∧,∨,¬}

Push ¬ all the way to variables

I Always possible by DeMorgan’s laws

¬(¬(A ∧ B) ∧ (C ∨ D))

becomes

(A ∧ B) ∨ (¬C ∧ ¬D)

Jinbo Huang Introduction to Propositional Logic

Conversion to NNF

Eliminate connectives other than ∧,∨,¬I Always possible by completeness of {∧,∨,¬}

Push ¬ all the way to variables

I Always possible by DeMorgan’s laws

¬(¬(A ∧ B) ∧ (C ∨ D)) becomes

(A ∧ B) ∨ (¬C ∧ ¬D)

Jinbo Huang Introduction to Propositional Logic

Conjunctive Normal Form (CNF)

Literal: variable or its negation

I A,¬A,B ,¬B ,C ,¬C , . . .

Clause: disjunction (∨) of literals

I A ∨ ¬B ∨ C

I A,¬B ,C (unit clauses)

CNF: conjunction (∧) of clauses

I Often regard as set of clauses

Jinbo Huang Introduction to Propositional Logic

Conjunctive Normal Form (CNF)

Literal: variable or its negation

I A,¬A,B ,¬B ,C ,¬C , . . .

Clause: disjunction (∨) of literals

I A ∨ ¬B ∨ C

I A,¬B ,C (unit clauses)

CNF: conjunction (∧) of clauses

I Often regard as set of clauses

Jinbo Huang Introduction to Propositional Logic

Conjunctive Normal Form (CNF)

Literal: variable or its negation

I A,¬A,B ,¬B ,C ,¬C , . . .

Clause: disjunction (∨) of literals

I A ∨ ¬B ∨ C

I A,¬B ,C (unit clauses)

CNF: conjunction (∧) of clauses

I Often regard as set of clauses

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF

Start with NNF

Push ∨ all the way to literals

I Always possible by distribution laws

(A ∧ B) ∨ (¬C ∧ ¬D) becomes

(A ∨ ¬C ) ∧ (B ∨ ¬C ) ∧ (A ∨ ¬D) ∧ (B ∨ ¬D)

Potential issue?

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF

Start with NNF

Push ∨ all the way to literals

I Always possible by distribution laws

(A ∧ B) ∨ (¬C ∧ ¬D)

becomes

(A ∨ ¬C ) ∧ (B ∨ ¬C ) ∧ (A ∨ ¬D) ∧ (B ∨ ¬D)

Potential issue?

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF

Start with NNF

Push ∨ all the way to literals

I Always possible by distribution laws

(A ∧ B) ∨ (¬C ∧ ¬D) becomes

(A ∨ ¬C ) ∧ (B ∨ ¬C ) ∧ (A ∨ ¬D) ∧ (B ∨ ¬D)

Potential issue?

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF

Start with NNF

Push ∨ all the way to literals

I Always possible by distribution laws

(A ∧ B) ∨ (¬C ∧ ¬D) becomes

(A ∨ ¬C ) ∧ (B ∨ ¬C ) ∧ (A ∨ ¬D) ∧ (B ∨ ¬D)

Potential issue?

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Complexity

Can get too many clauses

I Can be exponential in size of original formula

CNF1 ∨ CNF2

I Result has |CNF1| · |CNF2| clauses

CNF1 ∨ CNF2 ∨ . . . ∨ CNFn

I If CNFi each has 2 clauses, result has 2n clauses

Exponential worst case inevitable

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Complexity

Can get too many clauses

I Can be exponential in size of original formula

CNF1 ∨ CNF2

I Result has |CNF1| · |CNF2| clauses

CNF1 ∨ CNF2 ∨ . . . ∨ CNFn

I If CNFi each has 2 clauses, result has 2n clauses

Exponential worst case inevitable

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Complexity

Can get too many clauses

I Can be exponential in size of original formula

CNF1 ∨ CNF2

I Result has |CNF1| · |CNF2| clauses

CNF1 ∨ CNF2 ∨ . . . ∨ CNFn

I If CNFi each has 2 clauses, result has 2n clauses

Exponential worst case inevitable

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Polynomial Method

Do not insist on equivalence

Convert ∆ to ∆′

I ∆′ is in CNF

I ∆′ has extra variables

I |∆′| is polynomial in |∆|

How can ∆′ be useful if ∆′ 6≡ ∆?

I All we need is SAT(∆) ≡ SAT(∆′)

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Polynomial Method

Do not insist on equivalence

Convert ∆ to ∆′

I ∆′ is in CNF

I ∆′ has extra variables

I |∆′| is polynomial in |∆|

How can ∆′ be useful if ∆′ 6≡ ∆?

I All we need is SAT(∆) ≡ SAT(∆′)

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Polynomial Method

Do not insist on equivalence

Convert ∆ to ∆′

I ∆′ is in CNF

I ∆′ has extra variables

I |∆′| is polynomial in |∆|

How can ∆′ be useful if ∆′ 6≡ ∆?

I All we need is SAT(∆) ≡ SAT(∆′)

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Polynomial Method

∆ = ∆1 ∨∆2, assume ∆1,∆2 already in CNF

I ∆1 = g1 ∧ g2 ∧ . . . ∧ gpI ∆2 = h1 ∧ h2 ∧ . . . ∧ hq

Original conversion of ∆1 ∨∆2 produces pq clauses

Introduce new variable X , let ∆′ have followingclauses

I X ∨ g1,X ∨ g2, . . . ,X ∨ gpI ¬X ∨ h1,¬X ∨ h2, . . . ,¬X ∨ hq

|∆′| = p + q

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Polynomial Method

∆ = ∆1 ∨∆2, assume ∆1,∆2 already in CNF

I ∆1 = g1 ∧ g2 ∧ . . . ∧ gpI ∆2 = h1 ∧ h2 ∧ . . . ∧ hq

Original conversion of ∆1 ∨∆2 produces pq clauses

Introduce new variable X , let ∆′ have followingclauses

I X ∨ g1,X ∨ g2, . . . ,X ∨ gpI ¬X ∨ h1,¬X ∨ h2, . . . ,¬X ∨ hq

|∆′| = p + q

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Polynomial Method

∆ = ∆1 ∨∆2, assume ∆1,∆2 already in CNF

I ∆1 = g1 ∧ g2 ∧ . . . ∧ gpI ∆2 = h1 ∧ h2 ∧ . . . ∧ hq

Original conversion of ∆1 ∨∆2 produces pq clauses

Introduce new variable X , let ∆′ have followingclauses

I X ∨ g1,X ∨ g2, . . . ,X ∨ gpI ¬X ∨ h1,¬X ∨ h2, . . . ,¬X ∨ hq

|∆′| = p + q

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Polynomial Method

∆ = ∆1 ∨∆2, assume ∆1,∆2 already in CNF

I ∆1 = g1 ∧ g2 ∧ . . . ∧ gpI ∆2 = h1 ∧ h2 ∧ . . . ∧ hq

Original conversion of ∆1 ∨∆2 produces pq clauses

Introduce new variable X , let ∆′ have followingclauses

I X ∨ g1,X ∨ g2, . . . ,X ∨ gpI ¬X ∨ h1,¬X ∨ h2, . . . ,¬X ∨ hq

|∆′| = p + q

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Preservation of SAT

∆′ with new variable X

I X ∨ g1,X ∨ g2, . . . ,X ∨ gpI ¬X ∨ h1,¬X ∨ h2, . . . ,¬X ∨ hq

SAT(∆ = ∆1 ∨∆2) ⇒ SAT(∆′)

I ∃ω, ω |= ∆

I ω |= ∆1 or ω |= ∆2, assume former

I ∀i , ω |= giI Let ω′(X ) = 0 and ω′ = ω otherwise

I ω′ |= ∆′

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Preservation of SAT

∆′ with new variable X

I X ∨ g1,X ∨ g2, . . . ,X ∨ gpI ¬X ∨ h1,¬X ∨ h2, . . . ,¬X ∨ hq

SAT(∆ = ∆1 ∨∆2) ⇒ SAT(∆′)

I ∃ω, ω |= ∆

I ω |= ∆1 or ω |= ∆2, assume former

I ∀i , ω |= giI Let ω′(X ) = 0 and ω′ = ω otherwise

I ω′ |= ∆′

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Preservation of SAT

∆′ with new variable X

I X ∨ g1,X ∨ g2, . . . ,X ∨ gpI ¬X ∨ h1,¬X ∨ h2, . . . ,¬X ∨ hq

SAT(∆ = ∆1 ∨∆2) ⇒ SAT(∆′)

I ∃ω, ω |= ∆

I ω |= ∆1 or ω |= ∆2, assume former

I ∀i , ω |= giI Let ω′(X ) = 0 and ω′ = ω otherwise

I ω′ |= ∆′

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Preservation of SAT

∆′ with new variable X

I X ∨ g1,X ∨ g2, . . . ,X ∨ gpI ¬X ∨ h1,¬X ∨ h2, . . . ,¬X ∨ hq

SAT(∆ = ∆1 ∨∆2) ⇒ SAT(∆′)

I ∃ω, ω |= ∆

I ω |= ∆1 or ω |= ∆2, assume former

I ∀i , ω |= gi

I Let ω′(X ) = 0 and ω′ = ω otherwise

I ω′ |= ∆′

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Preservation of SAT

∆′ with new variable X

I X ∨ g1,X ∨ g2, . . . ,X ∨ gpI ¬X ∨ h1,¬X ∨ h2, . . . ,¬X ∨ hq

SAT(∆ = ∆1 ∨∆2) ⇒ SAT(∆′)

I ∃ω, ω |= ∆

I ω |= ∆1 or ω |= ∆2, assume former

I ∀i , ω |= giI Let ω′(X ) = 0 and ω′ = ω otherwise

I ω′ |= ∆′

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Preservation of SAT

∆′ with new variable X

I X ∨ g1,X ∨ g2, . . . ,X ∨ gpI ¬X ∨ h1,¬X ∨ h2, . . . ,¬X ∨ hq

SAT(∆ = ∆1 ∨∆2) ⇒ SAT(∆′)

I ∃ω, ω |= ∆

I ω |= ∆1 or ω |= ∆2, assume former

I ∀i , ω |= giI Let ω′(X ) = 0 and ω′ = ω otherwise

I ω′ |= ∆′

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Preservation of SAT

∆′ with new variable X

I X ∨ g1,X ∨ g2, . . . ,X ∨ gpI ¬X ∨ h1,¬X ∨ h2, . . . ,¬X ∨ hq

SAT(∆′) ⇒ SAT(∆ = ∆1 ∨∆2)

I ∃ω′, ω′ |= ∆′

I ω′(X ) = 0 or ω′(X ) = 1, assume former

I ∀i , ω′ |= giI ω′ |= ∆1

I ω′ |= ∆

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Preservation of SAT

∆′ with new variable X

I X ∨ g1,X ∨ g2, . . . ,X ∨ gpI ¬X ∨ h1,¬X ∨ h2, . . . ,¬X ∨ hq

SAT(∆′) ⇒ SAT(∆ = ∆1 ∨∆2)

I ∃ω′, ω′ |= ∆′

I ω′(X ) = 0 or ω′(X ) = 1, assume former

I ∀i , ω′ |= giI ω′ |= ∆1

I ω′ |= ∆

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Preservation of SAT

∆′ with new variable X

I X ∨ g1,X ∨ g2, . . . ,X ∨ gpI ¬X ∨ h1,¬X ∨ h2, . . . ,¬X ∨ hq

SAT(∆′) ⇒ SAT(∆ = ∆1 ∨∆2)

I ∃ω′, ω′ |= ∆′

I ω′(X ) = 0 or ω′(X ) = 1, assume former

I ∀i , ω′ |= giI ω′ |= ∆1

I ω′ |= ∆

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Preservation of SAT

∆′ with new variable X

I X ∨ g1,X ∨ g2, . . . ,X ∨ gpI ¬X ∨ h1,¬X ∨ h2, . . . ,¬X ∨ hq

SAT(∆′) ⇒ SAT(∆ = ∆1 ∨∆2)

I ∃ω′, ω′ |= ∆′

I ω′(X ) = 0 or ω′(X ) = 1, assume former

I ∀i , ω′ |= gi

I ω′ |= ∆1

I ω′ |= ∆

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Preservation of SAT

∆′ with new variable X

I X ∨ g1,X ∨ g2, . . . ,X ∨ gpI ¬X ∨ h1,¬X ∨ h2, . . . ,¬X ∨ hq

SAT(∆′) ⇒ SAT(∆ = ∆1 ∨∆2)

I ∃ω′, ω′ |= ∆′

I ω′(X ) = 0 or ω′(X ) = 1, assume former

I ∀i , ω′ |= giI ω′ |= ∆1

I ω′ |= ∆

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF: Preservation of SAT

∆′ with new variable X

I X ∨ g1,X ∨ g2, . . . ,X ∨ gpI ¬X ∨ h1,¬X ∨ h2, . . . ,¬X ∨ hq

SAT(∆′) ⇒ SAT(∆ = ∆1 ∨∆2)

I ∃ω′, ω′ |= ∆′

I ω′(X ) = 0 or ω′(X ) = 1, assume former

I ∀i , ω′ |= giI ω′ |= ∆1

I ω′ |= ∆

Jinbo Huang Introduction to Propositional Logic

Conversion to CNF

Any sentence can be put in CNF (using extravariables) in polynomial time preserving SAT

Will assume input to reasoning task is in CNF

Jinbo Huang Introduction to Propositional Logic

Reasoning Methods: Is α SAT?

Semantic reasoning

I Search for ω such that ω |= α

Syntactic reasoning (inference, proof)

I Create new sentences from α by applyingsyntactic rules

I Stop when proof of UNSAT is producedI Rules should be sound and complete

I UNSAT proof will be produced iff α is not SAT

Jinbo Huang Introduction to Propositional Logic

Syntactic Reasoning: Resolution

A ∨ ¬B ∨ C , ¬C ∨ D ∨ ¬E

A ∨ ¬B ∨ D ∨ ¬E

g ∨ X , ¬X ∨ h

g ∨ h

New clause called resolvent

If g = h = ∅, empty clause ∅ is generated

Jinbo Huang Introduction to Propositional Logic

Syntactic Reasoning: Resolution

A ∨ ¬B ∨ C , ¬C ∨ D ∨ ¬E

A ∨ ¬B ∨ D ∨ ¬E

g ∨ X , ¬X ∨ h

g ∨ h

New clause called resolvent

If g = h = ∅, empty clause ∅ is generated

Jinbo Huang Introduction to Propositional Logic

Syntactic Reasoning: Resolution

A ∨ ¬B ∨ C , ¬C ∨ D ∨ ¬E

A ∨ ¬B ∨ D ∨ ¬E

g ∨ X , ¬X ∨ h

g ∨ h

New clause called resolvent

If g = h = ∅, empty clause ∅ is generated

Jinbo Huang Introduction to Propositional Logic

Resolution

Repeat until saturation or generation of ∅

I Will always terminate as # clauses is finite

Sound and complete

I CNF ∆ is SAT iff ∅ is not generated

Jinbo Huang Introduction to Propositional Logic

Resolution

Repeat until saturation or generation of ∅I Will always terminate as # clauses is finite

Sound and complete

I CNF ∆ is SAT iff ∅ is not generated

Jinbo Huang Introduction to Propositional Logic

Resolution

Repeat until saturation or generation of ∅I Will always terminate as # clauses is finite

Sound and complete

I CNF ∆ is SAT iff ∅ is not generated

Jinbo Huang Introduction to Propositional Logic

Resolution: Soundness

Generation of ∅ ⇒ UNSAT(∆)

g∨X , ¬X∨hg∨hI (ω |= g ∨ X ) and (ω |= ¬X ∨ h) ⇒

(ω |= g ∨ h)

I (ω |= ∆) ⇒ (ω |= all added clauses)

I (ω |= X ) and (ω |= ¬X ) impossible

I SAT(∆) ⇒ no ∅

Jinbo Huang Introduction to Propositional Logic

Resolution: Soundness

Generation of ∅ ⇒ UNSAT(∆)

g∨X , ¬X∨hg∨hI (ω |= g ∨ X ) and (ω |= ¬X ∨ h) ⇒

(ω |= g ∨ h)

I (ω |= ∆) ⇒ (ω |= all added clauses)

I (ω |= X ) and (ω |= ¬X ) impossible

I SAT(∆) ⇒ no ∅

Jinbo Huang Introduction to Propositional Logic

Resolution: Soundness

Generation of ∅ ⇒ UNSAT(∆)

g∨X , ¬X∨hg∨hI (ω |= g ∨ X ) and (ω |= ¬X ∨ h) ⇒

(ω |= g ∨ h)

I (ω |= ∆) ⇒ (ω |= all added clauses)

I (ω |= X ) and (ω |= ¬X ) impossible

I SAT(∆) ⇒ no ∅

Jinbo Huang Introduction to Propositional Logic

Resolution: Soundness

Generation of ∅ ⇒ UNSAT(∆)

g∨X , ¬X∨hg∨hI (ω |= g ∨ X ) and (ω |= ¬X ∨ h) ⇒

(ω |= g ∨ h)

I (ω |= ∆) ⇒ (ω |= all added clauses)

I (ω |= X ) and (ω |= ¬X ) impossible

I SAT(∆) ⇒ no ∅

Jinbo Huang Introduction to Propositional Logic

Resolution: Soundness

Generation of ∅ ⇒ UNSAT(∆)

g∨X , ¬X∨hg∨hI (ω |= g ∨ X ) and (ω |= ¬X ∨ h) ⇒

(ω |= g ∨ h)

I (ω |= ∆) ⇒ (ω |= all added clauses)

I (ω |= X ) and (ω |= ¬X ) impossible

I SAT(∆) ⇒ no ∅

Jinbo Huang Introduction to Propositional Logic

Resolution: Completeness

UNSAT(∆) ⇒ generation of ∅

No ∅ ⇒ SAT(∆)

Consider all clauses at termination, repeat fori = 1, . . . , n

I Set ω(Xi) to either 1/0 without any clausebeing falsified by assignments so far

I Will always succeed

ω |= all clauses; hence SAT(∆)

Jinbo Huang Introduction to Propositional Logic

Resolution: Completeness

UNSAT(∆) ⇒ generation of ∅

No ∅ ⇒ SAT(∆)

Consider all clauses at termination, repeat fori = 1, . . . , n

I Set ω(Xi) to either 1/0 without any clausebeing falsified by assignments so far

I Will always succeed

ω |= all clauses; hence SAT(∆)

Jinbo Huang Introduction to Propositional Logic

Resolution: Completeness

UNSAT(∆) ⇒ generation of ∅

No ∅ ⇒ SAT(∆)

Consider all clauses at termination, repeat fori = 1, . . . , n

I Set ω(Xi) to either 1/0 without any clausebeing falsified by assignments so far

I Will always succeed

ω |= all clauses; hence SAT(∆)

Jinbo Huang Introduction to Propositional Logic

Resolution: Completeness

Can always set ω(Xi) to 1/0 without any clausefalsified by assignments so far, because otherwise

I ∃ Xi ∨ g , ¬Xi ∨ h, g and h are falsified

I But g ∨ h exists (due to saturation), so failuremust have occurred earlier

I Base case is the first iteration (i = 1), whichcannot fail because there are no X and ¬X

Jinbo Huang Introduction to Propositional Logic

Resolution: Completeness

Can always set ω(Xi) to 1/0 without any clausefalsified by assignments so far, because otherwise

I ∃ Xi ∨ g , ¬Xi ∨ h, g and h are falsified

I But g ∨ h exists (due to saturation), so failuremust have occurred earlier

I Base case is the first iteration (i = 1), whichcannot fail because there are no X and ¬X

Jinbo Huang Introduction to Propositional Logic

Resolution: Completeness

Can always set ω(Xi) to 1/0 without any clausefalsified by assignments so far, because otherwise

I ∃ Xi ∨ g , ¬Xi ∨ h, g and h are falsified

I But g ∨ h exists (due to saturation), so failuremust have occurred earlier

I Base case is the first iteration (i = 1), whichcannot fail because there are no X and ¬X

Jinbo Huang Introduction to Propositional Logic

Resolution

Will always prove SAT/UNSAT

Purely syntactic, not directly concerned withexistence of models

How well does it work in practice?

Jinbo Huang Introduction to Propositional Logic

Resolution: Practical Considerations

Can generate exponential # resolvents

Many may not contribute to proof (i.e., ∅)

How do we decide which resolvents to generate?

Let’s come back to this issue

Jinbo Huang Introduction to Propositional Logic

Reasoning Methods: Is α SAT?

Semantic reasoning

I Search for ω such that ω |= α

Syntactic reasoning (inference, proof)

I Create new sentences from α by applyingsyntactic rules

I Stop when proof of UNSAT is producedI Rules should be sound and complete

I UNSAT proof will be produced iff α is not SAT

Jinbo Huang Introduction to Propositional Logic

Semantic Reasoning: Searching for Model

{A ∨ B ,B ∨ C} (alternative notation A forcompactness)

Is formula SAT?

8 assignments to ABC : enumerate & check, untilmodel found, e.g., A = B = C = 1

Exponential in # variables in worst case (fine, butcan try to do better in average case)

Jinbo Huang Introduction to Propositional Logic

Semantic Reasoning: Searching for Model

{A ∨ B ,B ∨ C} (alternative notation A forcompactness)

Is formula SAT?

8 assignments to ABC : enumerate & check, untilmodel found, e.g., A = B = C = 1

Exponential in # variables in worst case (fine, butcan try to do better in average case)

Jinbo Huang Introduction to Propositional Logic

Semantic Reasoning: Searching for Model

{A ∨ B ,B ∨ C} (alternative notation A forcompactness)

Is formula SAT?

8 assignments to ABC : enumerate & check, untilmodel found, e.g., A = B = C = 1

Exponential in # variables in worst case (fine, butcan try to do better in average case)

Jinbo Huang Introduction to Propositional Logic

Search

{A ∨ B ,B ∨ C}

Jinbo Huang Introduction to Propositional Logic

Conditioning

{A ∨ B ,B ∨ C}|A

'&

$%

Jinbo Huang Introduction to Propositional Logic

Conditioning

{A ∨ B ,B ∨ C}|A {B ,B ∨ C}

'&

$%

Jinbo Huang Introduction to Propositional Logic

Conditioning

{A ∨ B ,B ∨ C}|A {B ,B ∨ C}|B

'&

$%

Jinbo Huang Introduction to Propositional Logic

Conditioning

{A ∨ B ,B ∨ C}|A {B ,B ∨ C}|B {C}

'&

$%

Jinbo Huang Introduction to Propositional Logic

Conditioning

{A ∨ B ,B ∨ C}|A {B ,B ∨ C}|B {C}

Simplifies formula

I false literal disappears from clause

I true literal makes clause disappear

Leaves of search tree

I empty clause generated: formula falsified

I all clauses gone: formula satisfied

Not necessarily 2n leaves, even in case of UNSAT

Jinbo Huang Introduction to Propositional Logic

Early Backtracking

Backtrack as soon as empty clause generated

Can we do even better?

What about unit clauses?{A ∨ B ,B ∨ C}|A {B ,B ∨ C}

B must be true, no need for two branches

Setting B = 1 may lead to more unit clauses, repeattill no more (or till empty clause)

Known as unit propagation

Jinbo Huang Introduction to Propositional Logic

Early Backtracking

Backtrack as soon as empty clause generated

Can we do even better?

What about unit clauses?{A ∨ B ,B ∨ C}|A {B ,B ∨ C}

B must be true, no need for two branches

Setting B = 1 may lead to more unit clauses, repeattill no more (or till empty clause)

Known as unit propagation

Jinbo Huang Introduction to Propositional Logic

Early Backtracking

Backtrack as soon as empty clause generated

Can we do even better?

What about unit clauses?{A ∨ B ,B ∨ C}|A {B ,B ∨ C}

B must be true, no need for two branches

Setting B = 1 may lead to more unit clauses, repeattill no more (or till empty clause)

Known as unit propagation

Jinbo Huang Introduction to Propositional Logic

Early Backtracking

Backtrack as soon as empty clause generated

Can we do even better?

What about unit clauses?{A ∨ B ,B ∨ C}|A {B ,B ∨ C}

B must be true, no need for two branches

Setting B = 1 may lead to more unit clauses, repeattill no more (or till empty clause)

Known as unit propagation

Jinbo Huang Introduction to Propositional Logic

Early Backtracking

Backtrack as soon as empty clause generated

Can we do even better?

What about unit clauses?{A ∨ B ,B ∨ C}|A {B ,B ∨ C}

B must be true, no need for two branches

Setting B = 1 may lead to more unit clauses, repeattill no more (or till empty clause)

Known as unit propagation

Jinbo Huang Introduction to Propositional Logic

Algorithm: DPLL

Same kind of search tree, each node augmentedwith unit propagation

I multiple assignments in one levelI decision & implications

I may not need n levels to reach leaf

What (completely) determines search tree?

Jinbo Huang Introduction to Propositional Logic

Algorithm: DPLL

Same kind of search tree, each node augmentedwith unit propagation

I multiple assignments in one levelI decision & implications

I may not need n levels to reach leaf

What (completely) determines search tree?

Jinbo Huang Introduction to Propositional Logic

DPLL: Variable Ordering

Can have huge impact on efficiency

Example: unit propagation lookahead, as in satz

I short clauses are good, more likely to result inunit propagation

I tentatively try each variable, count new binaryclauses generated

I select variable with highest score:w(X ) · w(X ) · 1024 + w(X ) + w(X )

Generally different orders down different branches:dynamic ordering

Jinbo Huang Introduction to Propositional Logic

Enhancement

Given variable ordering, search tree is fixed

How can we possibly reduce search tree further?

Backtrack earlier

Backtracking occurs (only) when empty clausegenerated

Empty clause generated (only) by unit propagation

Jinbo Huang Introduction to Propositional Logic

Enhancement

Given variable ordering, search tree is fixed

How can we possibly reduce search tree further?

Backtrack earlier

Backtracking occurs (only) when empty clausegenerated

Empty clause generated (only) by unit propagation

Jinbo Huang Introduction to Propositional Logic

Enhancement

Given variable ordering, search tree is fixed

How can we possibly reduce search tree further?

Backtrack earlier

Backtracking occurs (only) when empty clausegenerated

Empty clause generated (only) by unit propagation

Jinbo Huang Introduction to Propositional Logic

Empowering Unit Propagation

Unit propagation determined by set of clauses

More clauses ⇒ (potentially) more propagation,earlier empty clause (backtrack), smaller search tree

What clauses to add?

I not already in CNF

I logically entailed by CNF (or correctness lost)

I empower UP

Jinbo Huang Introduction to Propositional Logic

Empowering Unit Propagation

Unit propagation determined by set of clauses

More clauses ⇒ (potentially) more propagation,earlier empty clause (backtrack), smaller search tree

What clauses to add?

I not already in CNF

I logically entailed by CNF (or correctness lost)

I empower UP

Jinbo Huang Introduction to Propositional Logic

Empowering Unit Propagation

Unit propagation determined by set of clauses

More clauses ⇒ (potentially) more propagation,earlier empty clause (backtrack), smaller search tree

What clauses to add?

I not already in CNF

I logically entailed by CNF (or correctness lost)

I empower UP

Jinbo Huang Introduction to Propositional Logic

Empowering Unit Propagation

Unit propagation determined by set of clauses

More clauses ⇒ (potentially) more propagation,earlier empty clause (backtrack), smaller search tree

What clauses to add?

I not already in CNF

I logically entailed by CNF (or correctness lost)

I empower UP

Jinbo Huang Introduction to Propositional Logic

Empowering Unit Propagation

Unit propagation determined by set of clauses

More clauses ⇒ (potentially) more propagation,earlier empty clause (backtrack), smaller search tree

What clauses to add?

I not already in CNF

I logically entailed by CNF (or correctness lost)

I empower UP

Jinbo Huang Introduction to Propositional Logic

Clause Learning

∆|A

A,BB ,CA,X ,YA,X ,ZA,Y ,ZA,X ,ZA,Y ,Z

∆|A

A,B

B ,C

A,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C ,X

A,BB ,CA,X ,

Y

A,X ,ZA,

Y ,Z

A,X ,ZA,

Y ,Z

I Conflict in level 3: ∆|A,B,C ⇒ XI B ,C irrelevant: ∆|A ⇒ XI What clause would have allowed UP to derive

X in level 0? A ∨ X (A→ X )

Jinbo Huang Introduction to Propositional Logic

Clause Learning

∆|A

A,BB ,CA,X ,YA,X ,ZA,Y ,ZA,X ,ZA,Y ,Z

∆|A

A,B

B ,C

A,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C ,X

A,BB ,CA,X ,

Y

A,X ,ZA,

Y ,Z

A,X ,ZA,

Y ,Z

I Conflict in level 3: ∆|A,B,C ⇒ XI B ,C irrelevant: ∆|A ⇒ XI What clause would have allowed UP to derive

X in level 0? A ∨ X (A→ X )

Jinbo Huang Introduction to Propositional Logic

Clause Learning

∆|A

A,BB ,CA,X ,YA,X ,ZA,Y ,ZA,X ,ZA,Y ,Z

∆|A

A,B

B ,C

A,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C ,X

A,BB ,CA,X ,

Y

A,X ,ZA,

Y ,Z

A,X ,ZA,

Y ,Z

I Conflict in level 3: ∆|A,B,C ⇒ XI B ,C irrelevant: ∆|A ⇒ XI What clause would have allowed UP to derive

X in level 0? A ∨ X (A→ X )

Jinbo Huang Introduction to Propositional Logic

Clause Learning

∆|A

A,BB ,CA,X ,YA,X ,ZA,Y ,ZA,X ,ZA,Y ,Z

∆|A

A,B

B ,C

A,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C ,X

A,BB ,CA,X ,

Y

A,X ,ZA,

Y ,Z

A,X ,ZA,

Y ,Z

I Conflict in level 3: ∆|A,B,C ⇒ XI B ,C irrelevant: ∆|A ⇒ XI What clause would have allowed UP to derive

X in level 0? A ∨ X (A→ X )

Jinbo Huang Introduction to Propositional Logic

Clause Learning

∆|A

A,BB ,CA,X ,YA,X ,ZA,Y ,ZA,X ,ZA,Y ,Z

∆|A

A,B

B ,C

A,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C ,X

A,BB ,CA,X ,

Y

A,X ,ZA,

Y ,Z

A,X ,ZA,

Y ,Z

I Conflict in level 3: ∆|A,B,C ⇒ XI B ,C irrelevant: ∆|A ⇒ XI What clause would have allowed UP to derive

X in level 0? A ∨ X (A→ X )

Jinbo Huang Introduction to Propositional Logic

Clause Learning

∆|A

A,BB ,CA,X ,YA,X ,ZA,Y ,ZA,X ,ZA,Y ,Z

∆|A

A,B

B ,C

A,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C ,X

A,BB ,CA,X ,

Y

A,X ,ZA,

Y ,Z

A,X ,ZA,

Y ,Z

I Conflict in level 3: ∆|A,B,C ⇒ XI B ,C irrelevant: ∆|A ⇒ XI What clause would have allowed UP to derive

X in level 0? A ∨ X (A→ X )

Jinbo Huang Introduction to Propositional Logic

Clause Learning

∆|A

A,BB ,CA,X ,YA,X ,ZA,Y ,ZA,X ,ZA,Y ,Z

∆|A

A,B

B ,C

A,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C ,X

A,BB ,CA,X ,

Y

A,X ,ZA,

Y ,Z

A,X ,ZA,

Y ,Z

I Conflict in level 3: ∆|A,B,C ⇒ XI B ,C irrelevant: ∆|A ⇒ XI What clause would have allowed UP to derive

X in level 0? A ∨ X (A→ X )

Jinbo Huang Introduction to Propositional Logic

Clause Learning

∆|A

A,BB ,CA,X ,YA,X ,ZA,Y ,ZA,X ,ZA,Y ,Z

∆|A

A,B

B ,C

A,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C ,X

A,BB ,CA,X ,

Y

A,X ,ZA,

Y ,Z

A,X ,ZA,

Y ,Z

I Conflict in level 3: ∆|A,B,C ⇒ XI B ,C irrelevant: ∆|A ⇒ XI What clause would have allowed UP to derive

X in level 0? A ∨ X (A→ X )

Jinbo Huang Introduction to Propositional Logic

Clause Learning

∆|A

A,BB ,CA,X ,YA,X ,ZA,Y ,ZA,X ,ZA,Y ,Z

∆|A

A,B

B ,C

A,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C ,X

A,BB ,CA,X ,

Y

A,X ,ZA,

Y ,Z

A,X ,ZA,

Y ,Z

I Conflict in level 3: ∆|A,B,C ⇒ XI B ,C irrelevant: ∆|A ⇒ XI What clause would have allowed UP to derive

X in level 0? A ∨ X (A→ X )

Jinbo Huang Introduction to Propositional Logic

Clause Learning

∆|A

A,BB ,CA,X ,YA,X ,ZA,Y ,ZA,X ,ZA,Y ,Z

∆|A

A,B

B ,C

A,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C ,X

A,BB ,CA,X ,

Y

A,X ,ZA,

Y ,Z

A,X ,ZA,

Y ,Z

I Conflict in level 3: ∆|A,B,C ⇒ X

I B ,C irrelevant: ∆|A ⇒ XI What clause would have allowed UP to derive

X in level 0? A ∨ X (A→ X )

Jinbo Huang Introduction to Propositional Logic

Clause Learning

∆|A

A,BB ,CA,X ,YA,X ,ZA,Y ,ZA,X ,ZA,Y ,Z

∆|A

A,B

B ,C

A,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C ,X

A,BB ,CA,X ,

Y

A,X ,ZA,

Y ,Z

A,X ,ZA,

Y ,Z

I Conflict in level 3: ∆|A,B,C ⇒ XI B ,C irrelevant

: ∆|A ⇒ XI What clause would have allowed UP to derive

X in level 0? A ∨ X (A→ X )

Jinbo Huang Introduction to Propositional Logic

Clause Learning

∆|A

A,BB ,CA,X ,YA,X ,ZA,Y ,ZA,X ,ZA,Y ,Z

∆|A

A,B

B ,C

A,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C ,X

A,BB ,CA,X ,

Y

A,X ,ZA,

Y ,Z

A,X ,ZA,

Y ,Z

I Conflict in level 3: ∆|A,B,C ⇒ XI B ,C irrelevant: ∆|A ⇒ X

I What clause would have allowed UP to deriveX in level 0? A ∨ X (A→ X )

Jinbo Huang Introduction to Propositional Logic

Clause Learning

∆|A

A,BB ,CA,X ,YA,X ,ZA,Y ,ZA,X ,ZA,Y ,Z

∆|A

A,B

B ,C

A,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C ,X

A,BB ,CA,X ,

Y

A,X ,ZA,

Y ,Z

A,X ,ZA,

Y ,Z

I Conflict in level 3: ∆|A,B,C ⇒ XI B ,C irrelevant: ∆|A ⇒ XI What clause would have allowed UP to derive

X in level 0?

A ∨ X (A→ X )

Jinbo Huang Introduction to Propositional Logic

Clause Learning

∆|A

A,BB ,CA,X ,YA,X ,ZA,Y ,ZA,X ,ZA,Y ,Z

∆|A

A,B

B ,C

A,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C

A,BB ,CA,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

∆|A,B,C ,X

A,BB ,CA,X ,

Y

A,X ,ZA,

Y ,Z

A,X ,ZA,

Y ,Z

I Conflict in level 3: ∆|A,B,C ⇒ XI B ,C irrelevant: ∆|A ⇒ XI What clause would have allowed UP to derive

X in level 0? A ∨ X (A→ X )Jinbo Huang Introduction to Propositional Logic

Clause Learning

∆|A

A,BB ,CA,X ,YA,X ,ZA,Y ,ZA,X ,ZA,Y ,ZA,X

∆|A

A,B

B ,C

A,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

A,

X

A ∨ X satisfies criteria

I not in CNF

I entailed by CNF

I empowers UP

Learn clause in level 3

Backtrack to level 0, start over

How to learn? How far tobacktrack?

Jinbo Huang Introduction to Propositional Logic

Clause Learning

∆|A

A,BB ,CA,X ,YA,X ,ZA,Y ,ZA,X ,ZA,Y ,ZA,X

∆|A

A,B

B ,C

A,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

A,

X

A ∨ X satisfies criteria

I not in CNF

I entailed by CNF

I empowers UP

Learn clause in level 3

Backtrack to level 0, start over

How to learn? How far tobacktrack?

Jinbo Huang Introduction to Propositional Logic

Clause Learning

∆|A

A,BB ,CA,X ,YA,X ,ZA,Y ,ZA,X ,ZA,Y ,ZA,X

∆|A

A,B

B ,C

A,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

A,

X

A ∨ X satisfies criteria

I not in CNF

I entailed by CNF

I empowers UP

Learn clause in level 3

Backtrack to level 0, start over

How to learn? How far tobacktrack?

Jinbo Huang Introduction to Propositional Logic

Clause Learning

∆|A

A,BB ,CA,X ,YA,X ,ZA,Y ,ZA,X ,ZA,Y ,ZA,X

∆|A

A,B

B ,C

A,

X ,Y

A,

X ,Z

A,

Y ,Z

A,

X ,Z

A,

Y ,Z

A,

X

A ∨ X satisfies criteria

I not in CNF

I entailed by CNF

I empowers UP

Learn clause in level 3

Backtrack to level 0, start over

How to learn? How far tobacktrack?

Jinbo Huang Introduction to Propositional Logic

Implication Graph

1 : A,B2 : B ,C3 : A,X ,Y4 : A,X ,Z5 : A,Y ,Z6 : A,X ,Z7 : A,Y ,Z

8 : A,X

Jinbo Huang Introduction to Propositional Logic

Implication Graph

1 : A,B2 : B ,C3 : A,X ,Y4 : A,X ,Z5 : A,Y ,Z6 : A,X ,Z7 : A,Y ,Z8 : A,X

Jinbo Huang Introduction to Propositional Logic

Implication Graph

1 : A,B2 : B ,C3 : A,X ,Y4 : A,X ,Z5 : A,Y ,Z6 : A,X ,Z7 : A,Y ,Z8 : A,X

Jinbo Huang Introduction to Propositional Logic

Conflict Analysis

1 : A,B2 : B ,C3 : A,X ,Y4 : A,X ,Z5 : A,Y ,Z6 : A,X ,Z7 : A,Y ,Z

I Cut: roots (decisions) on one side, sink(contradiction) on other

I Arrows across cut together responsible forcontradiction

I Conflict set: tail points of arrows

Jinbo Huang Introduction to Propositional Logic

Conflict Set

1 : A,B2 : B ,C3 : A,X ,Y4 : A,X ,Z5 : A,Y ,Z6 : A,X ,Z7 : A,Y ,Z

I Cut 1: {A,X}I Cut 2: {A,Y }I Cut 3: {A,Y ,Z}

Jinbo Huang Introduction to Propositional Logic

Conflict Clause

1 : A,B2 : B ,C3 : A,X ,Y4 : A,X ,Z5 : A,Y ,Z6 : A,X ,Z7 : A,Y ,Z

I Cut 1: {A,X} ⇒ A ∨ X

I Cut 2: {A,Y } ⇒ A ∨ Y

I Cut 3: {A,Y ,Z} ⇒ A ∨ Y ∨ Z (existing)

Jinbo Huang Introduction to Propositional Logic

Conflict Clause

1 : A,B2 : B ,C3 : A,X ,Y4 : A,X ,Z5 : A,Y ,Z6 : A,X ,Z7 : A,Y ,Z

I Cut 1: {A,X} ⇒ A ∨ X

I Cut 2: {A,Y } ⇒ A ∨ Y

I Which clause to learn?

Jinbo Huang Introduction to Propositional Logic

Unique Implication Point (UIP)

Prefer shorter explanation

I shorter clause closer to unit, more empowering

Never need > 1 node from latest level

I latest decision + history always suffices

UIP: lies on all paths from decision to contradiction

Jinbo Huang Introduction to Propositional Logic

Unique Implication Point (UIP)

Prefer shorter explanation

I shorter clause closer to unit, more empowering

Never need > 1 node from latest level

I latest decision + history always suffices

UIP: lies on all paths from decision to contradiction

Jinbo Huang Introduction to Propositional Logic

1-UIP Learning

Work from sink backwardsStop when conflict set includes a UIP, and no othernodes, of latest level: 1-UIP clause (A ∨ Y )

I 2-UIP, 3-UIP, . . ., All-UIP

Empirically shown effective, most common choice

Jinbo Huang Introduction to Propositional Logic

Backtracking to Assertion Level

Learned clause: A ∨ Y

I becomes unit (Y ) when erasing current level

I asserting clause: UP will assert Y(empowerment)

Jinbo Huang Introduction to Propositional Logic

Backtracking to Assertion Level

Backtrack as far as possible, as long as UP remainsempowered

Assertion level: 2nd highest level in learned clause,or -1 if learned clause is unit

I A0 ∨ B1 ∨ C1 ∨ X4: aLevel = 1

I X4: aLevel = −1

I learned unit clause asserted before any decision

Empirically shown effective, most common choice

Jinbo Huang Introduction to Propositional Logic

Clause Learning: Putting It Together

repeatif no free variablereturn SAT

pick free variable X and set either X or Xif contradictionif level < 0return UNSAT

learn clausebacktrack anywhere learned clause 6= ∅

I No more branching, unlike DPLL

I Conflict-driven, repeated probing

Jinbo Huang Introduction to Propositional Logic

Clause Learning: Putting It Together

repeatif no free variablereturn SAT

pick free variable X and set either X or Xif contradictionif level < 0return UNSAT

learn clausebacktrack anywhere learned clause 6= ∅

I No more branching, unlike DPLL

I Conflict-driven, repeated probing

Jinbo Huang Introduction to Propositional Logic

Clause Learning: Putting It Together

repeatif no free variablereturn SAT

pick free variable X and set either X or Xif contradictionif level < 0return UNSAT

learn clausebacktrack anywhere learned clause 6= ∅

I Completeness?

I Completeness?

Jinbo Huang Introduction to Propositional Logic

Clause Learning: Putting It Together

repeatif no free variablereturn SAT

pick free variable X and set either X or Xif contradictionif level < 0return UNSAT

learn clausebacktrack anywhere learned clause 6= ∅

I Will terminate because learned clause must benew, |clauses| finite

Jinbo Huang Introduction to Propositional Logic

Clause Learning: Putting It Together

repeatif no free variablereturn SAT

pick free variable X and set either X or Xif contradictionif level < 0return UNSAT

learn clausebacktrack anywhere learned clause 6= ∅

I Components: decision heuristic, learningmethod, backtracking method

Jinbo Huang Introduction to Propositional Logic

Efficient Unit Propagation

Need to detect unit clauses

Naively, keep track of clause lengths: when settingX , decrement lengths of clauses that contain X

I inefficient when CNF is large

Pick 2 literals to watch in each clause

I watch A,B in A ∨ B ∨ C ∨ D

I clause cannot be unit unless A or B is set

I do nothing when C or D is assigned

Scales to millions of clauses in practice

Jinbo Huang Introduction to Propositional Logic

Efficient Unit Propagation

Need to detect unit clauses

Naively, keep track of clause lengths: when settingX , decrement lengths of clauses that contain X

I inefficient when CNF is large

Pick 2 literals to watch in each clause

I watch A,B in A ∨ B ∨ C ∨ D

I clause cannot be unit unless A or B is set

I do nothing when C or D is assigned

Scales to millions of clauses in practice

Jinbo Huang Introduction to Propositional Logic

Efficient Unit Propagation

Need to detect unit clauses

Naively, keep track of clause lengths: when settingX , decrement lengths of clauses that contain X

I inefficient when CNF is large

Pick 2 literals to watch in each clause

I watch A,B in A ∨ B ∨ C ∨ D

I clause cannot be unit unless A or B is set

I do nothing when C or D is assigned

Scales to millions of clauses in practice

Jinbo Huang Introduction to Propositional Logic

Clause Learning and Resolution

Each learning step corresponds to a sequence ofresolutions

Each learned clause is the final resolvent of thatsequence

Jinbo Huang Introduction to Propositional Logic

Syntactic and Semantic ReasoningCombined

Searching for model and performing resolutions atthe same time

Terminates as soon as either thread terminates

Solves our earlier issue with resolution (as purelysyntactic method)

I Search behavior guides generation of resolvents

Addition of new clauses also influences search

I Aim for “positive feedback loop”

Jinbo Huang Introduction to Propositional Logic

Syntactic and Semantic ReasoningCombined

Searching for model and performing resolutions atthe same time

Terminates as soon as either thread terminates

Solves our earlier issue with resolution (as purelysyntactic method)

I Search behavior guides generation of resolvents

Addition of new clauses also influences search

I Aim for “positive feedback loop”

Jinbo Huang Introduction to Propositional Logic

Syntactic and Semantic ReasoningCombined

Searching for model and performing resolutions atthe same time

Terminates as soon as either thread terminates

Solves our earlier issue with resolution (as purelysyntactic method)

I Search behavior guides generation of resolvents

Addition of new clauses also influences search

I Aim for “positive feedback loop”

Jinbo Huang Introduction to Propositional Logic

SAT Resources

I SAT conferences, www.satisfiability.org

I SAT competitions, www.satcompetition.org

I SAT Live, www.satlive.org

I Handbook of satisfiability

Jinbo Huang Introduction to Propositional Logic

Propositional Reasoning Beyond SAT

SAT answers a single query

Repeated queries on same knowledge base ∆?

I E.g., abnormality of different observations

I Each SAT query can be expensive

I Can we do some expensive work once, so thatfuture queries can all be answered quickly?

Compile ∆ into tractable form

Jinbo Huang Introduction to Propositional Logic

Propositional Reasoning Beyond SAT

SAT answers a single query

Repeated queries on same knowledge base ∆?

I E.g., abnormality of different observations

I Each SAT query can be expensive

I Can we do some expensive work once, so thatfuture queries can all be answered quickly?

Compile ∆ into tractable form

Jinbo Huang Introduction to Propositional Logic

Propositional Reasoning Beyond SAT

SAT answers a single query

Repeated queries on same knowledge base ∆?

I E.g., abnormality of different observations

I Each SAT query can be expensive

I Can we do some expensive work once, so thatfuture queries can all be answered quickly?

Compile ∆ into tractable form

Jinbo Huang Introduction to Propositional Logic

Propositional Reasoning Beyond SAT

SAT answers a single query

Repeated queries on same knowledge base ∆?

I E.g., abnormality of different observations

I Each SAT query can be expensive

I Can we do some expensive work once, so thatfuture queries can all be answered quickly?

Compile ∆ into tractable form

Jinbo Huang Introduction to Propositional Logic

Multiple Queries

Jinbo Huang Introduction to Propositional Logic

What to Compile To

Jinbo Huang Introduction to Propositional Logic

Target Compilation Forms

Representations of Boolean functions

Systematic space of normal forms

Satisfy different sets of properties

Support different sets of operations

Jinbo Huang Introduction to Propositional Logic

Reasoning by Knowledge Compilation

Identify forms that support desired operations

Pick most succinct one

Compile knowledge into target form

Perform reasoning

Jinbo Huang Introduction to Propositional Logic

Reasoning by Knowledge Compilation

Identify forms that support desired operations

Pick most succinct one

Compile knowledge into target form

Perform reasoning

Jinbo Huang Introduction to Propositional Logic

Reasoning by Knowledge Compilation

Identify forms that support desired operations

Pick most succinct one

Compile knowledge into target form

Perform reasoning

Jinbo Huang Introduction to Propositional Logic

Reasoning by Knowledge Compilation

Identify forms that support desired operations

Pick most succinct one

Compile knowledge into target form

Perform reasoning

Jinbo Huang Introduction to Propositional Logic

Negation Normal Form (NNF)

AND/OR circuit over literals

Jinbo Huang Introduction to Propositional Logic

Negation Normal Form (NNF)

Any Boolean function can be represented in NNF(completeness)

Impose conditions/properties over NNF

Obtain subsets/restrictions of NNF

Consider only complete subsets

Jinbo Huang Introduction to Propositional Logic

Decomposability

Jinbo Huang Introduction to Propositional Logic

Decomposable NNF (DNNF)

Jinbo Huang Introduction to Propositional Logic

Determinism

Jinbo Huang Introduction to Propositional Logic

Smoothness

Jinbo Huang Introduction to Propositional Logic

Deterministic DNNF (d-DNNF)

Jinbo Huang Introduction to Propositional Logic

Flatness

Jinbo Huang Introduction to Propositional Logic

Simple Disjunction

Jinbo Huang Introduction to Propositional Logic

Simple Conjunction

Jinbo Huang Introduction to Propositional Logic

CNF, DNF

Jinbo Huang Introduction to Propositional Logic

Prime Implicates (PI)

Conjunction of clauses

Includes every entailed clause

No clause subsumes another

Can obtain by running resolution to saturation,removing subsumed clauses

Jinbo Huang Introduction to Propositional Logic

Prime Implicates (PI)

Conjunction of clauses

Includes every entailed clause

No clause subsumes another

Can obtain by running resolution to saturation,removing subsumed clauses

Jinbo Huang Introduction to Propositional Logic

Prime Implicants (IP)

Disjunction of terms

Includes every entailing term

No term subsumes another

Can obtain by process dual to resolution

Jinbo Huang Introduction to Propositional Logic

Prime Implicants (IP)

Disjunction of terms

Includes every entailing term

No term subsumes another

Can obtain by process dual to resolution

Jinbo Huang Introduction to Propositional Logic

PI,IP

Jinbo Huang Introduction to Propositional Logic

Decision

Decision node: true, false, or following fragmentwhere α, β are decision nodes

Jinbo Huang Introduction to Propositional Logic

Decision

Jinbo Huang Introduction to Propositional Logic

Decision Drawn Compactly

Jinbo Huang Introduction to Propositional Logic

Binary Decision Diagrams (BDD)

Jinbo Huang Introduction to Propositional Logic

BDD

Jinbo Huang Introduction to Propositional Logic

Test-once

Jinbo Huang Introduction to Propositional Logic

Free BDDs (FBDD)

Jinbo Huang Introduction to Propositional Logic

Ordering

Jinbo Huang Introduction to Propositional Logic

Ordered BDDs (OBDD)

Jinbo Huang Introduction to Propositional Logic

Succinctness

F at least as succinct as G , F ≤ G , if

∀∆ ∈ G , ∃∆′ ∈ F , ∆′ ≡ ∆, |∆′| polynomial in |∆|

F more succinct than G , F < G , if F ≤ G , G 6≤ F

Jinbo Huang Introduction to Propositional Logic

Succinctness

F at least as succinct as G , F ≤ G , if

∀∆ ∈ G , ∃∆′ ∈ F , ∆′ ≡ ∆, |∆′| polynomial in |∆|

F more succinct than G , F < G , if F ≤ G , G 6≤ F

Jinbo Huang Introduction to Propositional Logic

Succinctness

Jinbo Huang Introduction to Propositional Logic

Further Topics

Operations supported by each form

Compiling knowledge into these forms

Reasoning with these forms

Jinbo Huang Introduction to Propositional Logic

THE END

Jinbo Huang Introduction to Propositional Logic