• Non ci sono risultati.

!uanti"ed Boolean Formulas

N/A
N/A
Protected

Academic year: 2021

Condividi "!uanti"ed Boolean Formulas"

Copied!
32
0
0

Testo completo

(1)

Quantified Boolean Formulas

(2)

QBF (Quantified Boolean Formulas)

Vocabulary Propositional variables: Σ = {p, q, r, …}

    Boolean connectives:        ∨, ∧, ¬, →, Quantifiers: ∃, ∀

(3)

QBF (Quantified Boolean Formulas)

Vocabulary Propositional variables: Σ = {p, q, r, …}

    Boolean connectives:        ∨, ∧, ¬, →, Quantifiers: ∃, ∀

Syntax φ :    p    |  …   |   φ ∨ φ   |   φ ∧ φ   |   ¬φ   |   φ → φ   |   φ φ ∃p φ | ∀p φ | …

(4)

QBF (Quantified Boolean Formulas)

Vocabulary Propositional variables: Σ = {p, q, r, …}

    Boolean connectives:        ∨, ∧, ¬, →, Quantifiers: ∃, ∀

Syntax φ :    p    |  …   |   φ ∨ φ   |   φ ∧ φ   |   ¬φ   |   φ → φ   |   φ φ ∃p φ | ∀p φ | …

Semantics Requires a model  M : FreeVar(φ) → {true, false}

Describes when  φ holds on M (M ⊨ φ)

(5)

QBF (Quantified Boolean Formulas)

Vocabulary Propositional variables: Σ = {p, q, r, …}

    Boolean connectives:        ∨, ∧, ¬, →, Quantifiers: ∃, ∀

Syntax φ :    p    |  …   |   φ ∨ φ   |   φ ∧ φ   |   ¬φ   |   φ → φ   |   φ φ ∃p φ | ∀p φ | …

Semantics Requires a model  M : FreeVar(φ) → {true, false}

Describes when  φ holds on M (M ⊨ φ) iff

M ⊨ p M(p) = true

iff

M ⊨ φ1∨φ2 M ⊨ φ1  or  M ⊨ φ2

iff

M ⊨ ∃p φ M’ ⊨ φ for some M’∈ {M[p:=true], M[p:=false]}

iff

M ⊨ ∀p φ M’ ⊨ φ for every M’∈ {M[p:=true], M[p:=false]}

(6)

Free variables and renaming

Syntax φ :    p    |  …   |   φ ∨ φ   |   φ ∧ φ   |   ¬φ   |   φ → φ   |   φ φ ∃p φ | ∀p φ | …

(7)

Free variables and renaming

Occurrence p is bound in φ if it appears under ∃p or ∀p is free in φ if it is not bound

Syntax φ :    p    |  …   |   φ ∨ φ   |   φ ∧ φ   |   ¬φ   |   φ → φ   |   φ φ ∃p φ | ∀p φ | …

(8)

Free variables and renaming

Occurrence p is bound in φ if it appears under ∃p or ∀p is free in φ if it is not bound

φ(p1,…,pk) means all free variables of φ are among p1,…,pk

Syntax φ :    p    |  …   |   φ ∨ φ   |   φ ∧ φ   |   ¬φ   |   φ → φ   |   φ φ ∃p φ | ∀p φ | …

(9)

Free variables and renaming

Occurrence p is bound in φ if it appears under ∃p or ∀p is free in φ if it is not bound

φ(p1,…,pk) means all free variables of φ are among p1,…,pk

φ[p/α] denotes the formula obtained by

replacing all free occurrences of p by α Syntax φ :    p    |  …   |   φ ∨ φ   |   φ ∧ φ   |   ¬φ   |   φ → φ   |   φ φ ∃p φ | ∀p φ | …

(10)

Free variables and renaming

Occurrence p is bound in φ if it appears under ∃p or ∀p is free in φ if it is not bound

φ(p1,…,pk) means all free variables of φ are among p1,…,pk

φ[p/α] denotes the formula obtained by

replacing all free occurrences of p by α

Notation abuse: given φ(p) φ[q] is shorthand for φ[p/q]

Syntax φ :    p    |  …   |   φ ∨ φ   |   φ ∧ φ   |   ¬φ   |   φ → φ   |   φ φ ∃p φ | ∀p φ | …

(11)

Free variables and renaming

Occurrence p is bound in φ if it appears under ∃p or ∀p is free in φ if it is not bound

φ(p1,…,pk) means all free variables of φ are among p1,…,pk

φ[p/α] denotes the formula obtained by

replacing all free occurrences of p by α

(12)

Free variables and renaming

Occurrence p is bound in φ if it appears under ∃p or ∀p is free in φ if it is not bound

φ(p1,…,pk) means all free variables of φ are among p1,…,pk

φ[p/α] denotes the formula obtained by

replacing all free occurrences of p by α

Lemma (compositionality) Let φ, α be some QBF and p a variable         Suppose that  M ⊨ p  iff  M ⊨ α

        Then  M ⊨ φ  iff  M ⊨ φ[p/α]

provided no free variable of α occurs in φ

(13)

Free variables and renaming

Corollary (renaming) ∃p φ  is equivalent to  ∃q φ[p/q]

provided q does not occur in φ Occurrence p is bound in φ if it appears under ∃p or ∀p is free in φ if it is not bound

φ(p1,…,pk) means all free variables of φ are among p1,…,pk

φ[p/α] denotes the formula obtained by

replacing all free occurrences of p by α

Lemma (compositionality) Let φ, α be some QBF and p a variable         Suppose that  M ⊨ p  iff  M ⊨ α

        Then  M ⊨ φ  iff  M ⊨ φ[p/α]

provided no free variable of α occurs in φ

(14)

Economy of syntax

Lemma ∀  can be defined using  ∃, ¬

Syntax φ :    p    |  …   |   φ ∨ φ   |   φ ∧ φ   |   ¬φ   |   φ → φ   |   φ φ ∃p | ∀p | …

(15)

Economy of syntax

Lemma ∀  can be defined using  ∃, ¬

Syntax φ :    p    |  …   |   φ ∨ φ   |   φ ∧ φ   |   ¬φ   |   φ → φ   |   φ φ ∃p | ∀p | …

is equivalent to

∀p φ ¬(∃p ¬φ)

namely:

(16)

Algorithms

Model-check(φ, M) if φ = p then

return M(p)

else if φ = φ1 ∨ φ2 then

return Model-check(φ1, M) OR Model-check(φ2, M)

else if …

else if φ = ∃p φ’ then

return Model-check(φ’, M[p:=true]) OR Model-check(φ’, M[p:=false])

else if φ = ∀p φ’ then

return Model-check(φ’, M[p:=true]) AND Model-check(φ’, M[p:=false])

(17)

Algorithms

Model-check(φ, M) if φ = p then

return M(p)

else if φ = φ1 ∨ φ2 then

return Model-check(φ1, M) OR Model-check(φ2, M)

else if …

else if φ = ∃p φ’ then

return Model-check(φ’, M[p:=true]) OR Model-check(φ’, M[p:=false])

else if φ = ∀p φ’ then

return Model-check(φ’, M[p:=true]) AND Model-check(φ’, M[p:=false])

Complexity:    PSPACE-complete

(18)

Propositional satisfiability vs QBF model-checking

[∃p ∃q ∃r] φ(p,q,r)SAT QBF

∀p ∃q ∀r φ(p,q,r) p

q q

r r r r

0 0 1 1 1 1 0 1

p

q q

r r r r

0 0 1 1 1 1 0 1

(19)

Propositional satisfiability vs QBF model-checking

[∃p ∃q ∃r] φ(p,q,r)SAT QBF

∀p ∃q ∀r φ(p,q,r) p

q q

r r r r

0 0 1 1 1 1 0 1

p

q q

r r r r

0 0 1 1 1 1 0 1

(20)

Propositional satisfiability vs QBF model-checking

[∃p ∃q ∃r] φ(p,q,r)SAT QBF

∀p ∃q ∀r φ(p,q,r) p

q q

r r r r

0 0 1 1 1 1 0 1

p

q q

r r r r

0 0 1 1 1 1 0 1

(21)

Normal forms

Prenex φ :    ∃p φ   |   ∀p φ   |   α

α : p    |   α ∨ α   |   α ∧ α   |   ¬α   |   ...

(22)

Normal forms

Prenex φ :    ∃p φ   |   ∀p φ   |   α

α : p    |   α ∨ α   |   α ∧ α   |   ¬α   |   ...

Prenex-CNF/DNF when in addition α is in CNF/DNF

(23)

Normal forms

Prenex φ :    ∃p φ   |   ∀p φ   |   α

α : p    |   α ∨ α   |   α ∧ α   |   ¬α   |   ...

Prenex-CNF/DNF when in addition α is in CNF/DNF

Lemma 1 Prenex normal form can be computed in polynomial time

(24)

Normal forms

Prenex φ :    ∃p φ   |   ∀p φ   |   α

α : p    |   α ∨ α   |   α ∧ α   |   ¬α   |   ...

Prenex-CNF/DNF when in addition α is in CNF/DNF

Lemma 1 Prenex normal form can be computed in polynomial time

Lemma 2 Model-checking prenex QBFs with n quantifier alternations is in Σ = NP                or            ΠcoNP                            NP…                           … = coNP

(25)

Application example — compression

φreach =  ∃p̅1,...,p̅n  φinit[p̅1]  ∧  φgoal[p̅n]  ∧ Reachability in n = 2k steps:

i=2,...,n φtrans[p̅i-1,p̅i]

0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0

0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0

0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0

φinit(p̅) φtrans(p̅,p̅’) φgoal(p̅)

{

k bits

(26)

Application example — compression

φreach =  ∃p̅1,...,p̅n  φinit[p̅1]  ∧  φgoal[p̅n]  ∧

Size: |φ |  ≈  |φ | + |φ | +                 can we do better?

Reachability in n = 2k steps:

i=2,...,n φtrans[p̅i-1,p̅i]

k⋅2k |φ |

0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0

0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0

0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0

φinit(p̅) φtrans(p̅,p̅’) φgoal(p̅)

{

k bits

(27)

∀s̅,s̅’

(⋁ ⋀

i=2,...,i=2,…,nn φ s̅s̅’=p̅trans[p̅i-1i-1,p̅i i

)

] → φtrans[s̅,s̅’]

Application example — compression

φreach =  ∃p̅1,...,p̅n  φinit[p̅1]  ∧  φgoal[p̅n]  ∧

Size: |φreach|  ≈  |φinit| + |φgoal| +                 can we do better?

Reachability in n = 2k steps:

k⋅2k ⋅ |φtrans|

0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0

0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0

0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0

φinit(p̅) φtrans(p̅,p̅’) φgoal(p̅)

{

k bits

(28)

∀s̅,s̅’

(⋁

i=2,…,n s̅s̅’=p̅i-1i

)

→ φtrans[s̅,s̅’]

k⋅2k |φ |

i=2,...,n φtrans[p̅i-1,p̅i]

Application example — compression

φreach =  ∃p̅1,...,p̅n  φinit[p̅1]  ∧  φgoal[p̅n]  ∧

Size: |φ |  ≈  |φ | + |φ | +                 can we do better?

Reachability in n = 2k steps:

k⋅2k + |φtrans|

0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0

0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0

0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0

φinit(p̅) φtrans(p̅,p̅’) φgoal(p̅)

{

k bits

(29)

∀s̅,s̅’

(⋁

i=2,…,n s̅s̅’=p̅i-1i

)

→ φtrans[s̅,s̅’]

k⋅2k ⋅ |φtrans|

i=2,...,n φtrans[p̅i-1,p̅i]

Application example — compression

φreach =  ∃p̅1,...,p̅n  φinit[p̅1]  ∧  φgoal[p̅n]  ∧

Size: |φreach|  ≈  |φinit| + |φgoal| +                 can we do better?

Reachability in n = 2k steps:

k⋅2k + |φtrans| φk[p̅1,p̅n]

φ1(p̅,q̅) = φtrans[p̅,q̅]

φi+1(p̅,q̅) = ∃r̅ ∀s̅,s̅’

s̅s̅’=p̅r̅ ∨ s̅s̅’=r̅q̅ → φi[s̅,s̅’]

0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0

0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0

0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0

φinit(p̅) φtrans(p̅,p̅’) φgoal(p̅)

{

k bits

(30)

k⋅2k + |φtrans|

∀s̅,s̅’

(⋁

i=2,…,n s̅s̅’=p̅i-1i

)

→ φtrans[s̅,s̅’]

k⋅2k |φ |

i=2,...,n φtrans[p̅i-1,p̅i]

Application example — compression

φreach =  ∃p̅1,...,p̅n  φinit[p̅1]  ∧  φgoal[p̅n]  ∧

Size: |φ |  ≈  |φ | + |φ | +                 can we do better?

Reachability in n = 2k steps:

φk[p̅1,p̅n] φ1(p̅,q̅) = φtrans[p̅,q̅]

φi+1(p̅,q̅) = ∃r̅ ∀s̅,s̅’

s̅s̅’=p̅r̅ ∨ s̅s̅’=r̅q̅ → φi[s̅,s̅’] k2 + |φtrans|

0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0

0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0

0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0

φinit(p̅) φtrans(p̅,p̅’) φgoal(p̅)

{

k bits

(31)

Things to remember

(32)

Things to remember

QBF logic is still simple

QBF model-checking generalises satisfiability & validity of prop. formulas (complexity is slightly higher and depends on quantifier alternation)

There is a trick to succinctly describe a reachability property

Riferimenti

Documenti correlati

3274 del 20 marzo 2003, “Primi elementi in materia di criteri generali per la classificazione sismica del territorio nazionale e di normative tecniche per le costruzioni

Markova, et al., Minimal residual disease detectable by quantitative assessment of WT1 gene before allogeneic stem cell transplantation in patients in first remission of acute

 In Section 2 we present linear theory predictions of the parallel fire hose, focusing in particular on the differences between proton and alpha contributions in driving the

Non ci vuole molto a capire che la lingua conta nelle scienze umane più che in altri campi, e questo non per un elemento estrinseco, ma proprio per la definizione degli

Romulea) Ȉ germination•photo-inhibition•in•Mediterranean•and•Temperate•plants Ȉ germination•ecology•and•seed•storage•in•Mediterranean•Temporary•Ponds

Il faut rappeler aussi que ce manuscrit est probablement le témoin le plus ancien de la Mélusine qui nous a été transmis (daté de la première décennie du XV e s., voir

We concluded that 78% unigenes of the MEET unigene dataset (20,447) correspond to newly identified Medfly transcripts, an higher effectiveness of transcriptome analyses when