8
N V A E R Neighborhood Quality Robbery Vandalism Earthquake Alarm A R V E P (A | R,V,E) T T T T 0.98 F T T T 0.02 T T T F 0.75 F T T F 0.25 T T F T 0.65 F T F T 0.35 T T F F 0.70 F T F F 0.30 T F F F 0.05 F F F F 0.95 T F F T 0.10 F F F T 0.90 T F T F 0.55 F F T F 0.45 T F T T 0.35 F F T T 0.65 R N P (R | N ) T high .2 F high .8 T low .75 F low .25 V N P (V | N ) T high .2 F high .8 T low .75 F low .25 E P(E) T .05 F .95 N P(N) high .75 low .25 6. Use the Bayesian network in Figure 2 together with the conditional probability tables below to answer the following questions. Appendix 2 may be helpful to use. If you do not have a hand-held calculator with you, make sure you set up the solution to the problems appropriately for partial credit. (a) Write the formula for the full joint probability distribution P (A,R,V,E,N) in terms of (condi- tional) probabilities using the chain rule. [1p] (b) Write the formula for the full joint probability distribution P (A,R,V,E,N) in terms of (condi- tional) probabilities derived from the bayesian network below. [1p] (c) What is the probability, P (a, r, ¬v, e, N = high)? [1p] (d) What is the probability, P (a e, v)? [2p] 1 P(A, R, V, E, N )= P(A R, V, E, N )P(R V, E, N )P(V E, N ), P(E N )P(N ) a.) b.) Choose a topological order for nodes: (N, R, V, E, A) P(N )P(R N )P(V N )P(E )P(A R, V, E ) P(a, rv, e, N = high)= c.) P(N = high)P(r N = high)Pv N = high)P(e)P(a rv, e) = 0.75 * 0.2 * 0.8 * 0.05 * 0.65 = 0.0039 (a) Write the formula for the full joint probability distribution P (A,R,V,E,N ) in terms of (condi- tional) probabilities using the chain rule. [1p] (b) Write the formula for the full joint probability distribution P (A,R,V,E,N ) in terms of (condi- (b) Write the formula for the full joint probability distribution P (A,R,V,E,N ) in terms of (condi- tional) probabilities derived from the bayesian network below. [1p] (c) What is the probability, P (a, r, ¬v, e, N = high)? [1p] (d) What is the probability, P (a e, v)? [2p] (d) What is the probability, P (a e, v )? [2p] 2

TDDC17 Fo9 SomeExamQuestions

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: TDDC17 Fo9 SomeExamQuestions

N

V

A

ER

NeighborhoodQuality

Robbery

Vandalism

Earthquake

Alarm

6. Use the Bayesian network in Figure 2 together with the conditional probability tables below to answer

the following questions. Appendix 2 may be helpful to use. If you do not have a hand-held calculator

with you, make sure you set up the solution to the problems appropriately for partial credit.

(a) Write the formula for the full joint probability distribution P (A,R, V,E,N) in terms of (condi-

tional) probabilities using the chain rule. [1p]

(b) Write the formula for the full joint probability distribution P (A,R, V,E,N) in terms of (condi-

tional) probabilities derived from the bayesian network below. [1p]

(c) What is the probability, P (a, r,¬v, e,N = high)? [1p]

(d) What is the probability, P (a | ¬e, v)? [2p]

N

V

A

ER

NeighborhoodQuality

Robbery

Vandalism

Earthquake

Alarm

Figure 2: Bayesian Network Example

A R V E P (A | R, V,E)

T T T T 0.98

F T T T 0.02

T T T F 0.75

F T T F 0.25

T T F T 0.65

F T F T 0.35

T T F F 0.70

F T F F 0.30

T F F F 0.05

F F F F 0.95

T F F T 0.10

F F F T 0.90

T F T F 0.55

F F T F 0.45

T F T T 0.35

F F T T 0.65

R N P (R | N)

T high .2

F high .8

T low .75

F low .25

V N P (V | N)

T high .2

F high .8

T low .75

F low .25

E P(E)

T .05

F .95

N P(N)

high .75

low .25

4

6. Use the Bayesian network in Figure 2 together with the conditional probability tables below to answer

the following questions. Appendix 2 may be helpful to use. If you do not have a hand-held calculator

with you, make sure you set up the solution to the problems appropriately for partial credit.

(a) Write the formula for the full joint probability distribution P (A,R, V,E,N) in terms of (condi-

tional) probabilities using the chain rule. [1p]

(b) Write the formula for the full joint probability distribution P (A,R, V,E,N) in terms of (condi-

tional) probabilities derived from the bayesian network below. [1p]

(c) What is the probability, P (a, r,¬v, e,N = high)? [1p]

(d) What is the probability, P (a | ¬e, v)? [2p]

N

V

A

ER

NeighborhoodQuality

Robbery

Vandalism

Earthquake

Alarm

Figure 2: Bayesian Network Example

A R V E P (A | R, V,E)

T T T T 0.98

F T T T 0.02

T T T F 0.75

F T T F 0.25

T T F T 0.65

F T F T 0.35

T T F F 0.70

F T F F 0.30

T F F F 0.05

F F F F 0.95

T F F T 0.10

F F F T 0.90

T F T F 0.55

F F T F 0.45

T F T T 0.35

F F T T 0.65

R N P (R | N)

T high .2

F high .8

T low .75

F low .25

V N P (V | N)

T high .2

F high .8

T low .75

F low .25

E P(E)

T .05

F .95

N P(N)

high .75

low .25

4

1

P(A, R, V, E, N) =

P(A ∣ R, V, E, N)P(R ∣ V, E, N)P(V ∣ E, N), P(E ∣ N)P(N)a.)

b.) Choose a topological order for nodes: (N, R, V, E, A)

P(N )P(R ∣ N )P(V ∣ N )P(E)P(A ∣ R, V, E)

P(a, r, ¬v, e, N = high) =c.)P(N = high)P(r ∣ N = high)P(¬v ∣ N = high)P(e)P(a ∣ r, ¬v, e)

= 0.75 * 0.2 * 0.8 * 0.05 * 0.65 = 0.0039

6. Use the Bayesian network in Figure 2 together with the conditional probability tables below to answer

the following questions. Appendix 2 may be helpful to use. If you do not have a hand-held calculator

with you, make sure you set up the solution to the problems appropriately for partial credit.

(a) Write the formula for the full joint probability distribution P (A,R, V,E,N) in terms of (condi-

tional) probabilities using the chain rule. [1p]

(b) Write the formula for the full joint probability distribution P (A,R, V,E,N) in terms of (condi-

tional) probabilities derived from the bayesian network below. [1p]

(c) What is the probability, P (a, r,¬v, e,N = high)? [1p]

(d) What is the probability, P (a | ¬e, v)? [2p]

N

V

A

ER

NeighborhoodQuality

Robbery

Vandalism

Earthquake

Alarm

Figure 2: Bayesian Network Example

A R V E P (A | R, V,E)

T T T T 0.98

F T T T 0.02

T T T F 0.75

F T T F 0.25

T T F T 0.65

F T F T 0.35

T T F F 0.70

F T F F 0.30

T F F F 0.05

F F F F 0.95

T F F T 0.10

F F F T 0.90

T F T F 0.55

F F T F 0.45

T F T T 0.35

F F T T 0.65

R N P (R | N)

T high .2

F high .8

T low .75

F low .25

V N P (V | N)

T high .2

F high .8

T low .75

F low .25

E P(E)

T .05

F .95

N P(N)

high .75

low .25

4

6. Use the Bayesian network in Figure 2 together with the conditional probability tables below to answer

the following questions. Appendix 2 may be helpful to use. If you do not have a hand-held calculator

with you, make sure you set up the solution to the problems appropriately for partial credit.

(a) Write the formula for the full joint probability distribution P (A,R, V,E,N) in terms of (condi-

tional) probabilities using the chain rule. [1p]

(b) Write the formula for the full joint probability distribution P (A,R, V,E,N) in terms of (condi-

tional) probabilities derived from the bayesian network below. [1p]

(c) What is the probability, P (a, r,¬v, e,N = high)? [1p]

(d) What is the probability, P (a | ¬e, v)? [2p]

N

V

A

ER

NeighborhoodQuality

Robbery

Vandalism

Earthquake

Alarm

Figure 2: Bayesian Network Example

A R V E P (A | R, V,E)

T T T T 0.98

F T T T 0.02

T T T F 0.75

F T T F 0.25

T T F T 0.65

F T F T 0.35

T T F F 0.70

F T F F 0.30

T F F F 0.05

F F F F 0.95

T F F T 0.10

F F F T 0.90

T F T F 0.55

F F T F 0.45

T F T T 0.35

F F T T 0.65

R N P (R | N)

T high .2

F high .8

T low .75

F low .25

V N P (V | N)

T high .2

F high .8

T low .75

F low .25

E P(E)

T .05

F .95

N P(N)

high .75

low .25

4

6. Use the Bayesian network in Figure 2 together with the conditional probability tables below to answer

the following questions. Appendix 2 may be helpful to use. If you do not have a hand-held calculator

with you, make sure you set up the solution to the problems appropriately for partial credit.

(a) Write the formula for the full joint probability distribution P (A,R, V,E,N) in terms of (condi-

tional) probabilities using the chain rule. [1p]

(b) Write the formula for the full joint probability distribution P (A,R, V,E,N) in terms of (condi-

tional) probabilities derived from the bayesian network below. [1p]

(c) What is the probability, P (a, r,¬v, e,N = high)? [1p]

(d) What is the probability, P (a | ¬e, v)? [2p]

N

V

A

ER

NeighborhoodQuality

Robbery

Vandalism

Earthquake

Alarm

Figure 2: Bayesian Network Example

A R V E P (A | R, V,E)

T T T T 0.98

F T T T 0.02

T T T F 0.75

F T T F 0.25

T T F T 0.65

F T F T 0.35

T T F F 0.70

F T F F 0.30

T F F F 0.05

F F F F 0.95

T F F T 0.10

F F F T 0.90

T F T F 0.55

F F T F 0.45

T F T T 0.35

F F T T 0.65

R N P (R | N)

T high .2

F high .8

T low .75

F low .25

V N P (V | N)

T high .2

F high .8

T low .75

F low .25

E P(E)

T .05

F .95

N P(N)

high .75

low .25

4

6. Use the Bayesian network in Figure 2 together with the conditional probability tables below to answer

the following questions. Appendix 2 may be helpful to use. If you do not have a hand-held calculator

with you, make sure you set up the solution to the problems appropriately for partial credit.

(a) Write the formula for the full joint probability distribution P (A,R, V,E,N) in terms of (condi-

tional) probabilities using the chain rule. [1p]

(b) Write the formula for the full joint probability distribution P (A,R, V,E,N) in terms of (condi-

tional) probabilities derived from the bayesian network below. [1p]

(c) What is the probability, P (a, r,¬v, e,N = high)? [1p]

(d) What is the probability, P (a | ¬e, v)? [2p]

N

V

A

ER

NeighborhoodQuality

Robbery

Vandalism

Earthquake

Alarm

Figure 2: Bayesian Network Example

A R V E P (A | R, V,E)

T T T T 0.98

F T T T 0.02

T T T F 0.75

F T T F 0.25

T T F T 0.65

F T F T 0.35

T T F F 0.70

F T F F 0.30

T F F F 0.05

F F F F 0.95

T F F T 0.10

F F F T 0.90

T F T F 0.55

F F T F 0.45

T F T T 0.35

F F T T 0.65

R N P (R | N)

T high .2

F high .8

T low .75

F low .25

V N P (V | N)

T high .2

F high .8

T low .75

F low .25

E P(E)

T .05

F .95

N P(N)

high .75

low .25

4

2

Page 2: TDDC17 Fo9 SomeExamQuestions

d). An Inference Example

Query: P(alarm ∣ ¬earthquake, vandalism)

P(X ∣ e) = α * P(X, e) = α * ∑y

P(X, e, y)

X = {Alarm}E = {Vandalism, Earthquake}e = {¬earthquake, vandalism}Y = {Robbery, Nquality}

= α∑r,n

P(alarm, ¬earthquake, vandalism, r, n)

= α[P(a, ¬e, v, r, N = h) + P(a, ¬e, v, r, N = l) + P(a, ¬e, v, ¬r, N = h) + P(a, ¬e, v, ¬r, N = l)]

3

P(alarm ∣ ¬earthquake, vandalism) =P(alarm, ¬earthquake, vandalism)

P(¬earthquake, vandalism)

= α P(alarm, ¬earthquake, vandalism)

where α =1

P(¬e, v)=

1∑a,r,n P(¬e, v, a, r, n)

3

where α =1

P(¬e, v)=

1∑a,r,n P(¬e, v, a, r, n)

We know how to compute each probability:

P(a, ¬e, v, r, N = h)

= P(N = h)P(r ∣ N = high)P(v ∣ N = high)P(¬e)P(a ∣ r, v, ¬e)

= α[P(a, ¬e, v, r, N = h) + P(a, ¬e, v, r, N = l) + P(a, ¬e, v, ¬r, N = h) + P(a, ¬e, v, ¬r, N = l)]

And

∑a,r,n

P(¬e, v, a, r, n) = P(¬e, v, a, r, N = h) + … + P(¬e, v, ¬a, ¬r, N = l)

= 0.75 * 0.2 * 0.2 * 0.95 * 0.75 = 0.021375

To avoid computing in this way, compute instead where,

α P(A ∣ ¬e, v) = αP(A¬e, v)

α =1

P(a, ¬e, v) + P(¬a, ¬e, v)

4

Page 3: TDDC17 Fo9 SomeExamQuestions

Question:DPLL [Total points: [6p]]

The following questions pertain to the extended Davis-Putnam algorithm (DPLL) considered in the course

book. DPLL takes as input a formula in propositional logic, transforms it to its equivalent conjunctive

normal form (CNF) representation and determines whether the formula is satisfiable or not. The questions

pertain to the di↵erent heuristics used in DPLL.

(When asked to ”complete the table . . . ” in the questions below, write your own complete table in the answer

page. Do not fill in these tables on the exam page.)

a. Complete the table below by applying the Splitting rule to variable B and CNF: [1p]

↵ = (A _B _ C _D) ^ (¬A _B _ ¬C) ^ (¬B _ ¬C _D) ^ (A _ ¬B _ C _D)

^ (B _ ¬C _ ¬D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D) ^ (A _ ¬B)

Table 1:

Heuristic Model1 Simplified CNF1 Model2 Simplified CNF2

Initial call {} ↵ - -

SR[B] {B : True} {B : False}

b. Complete the table below by applying the Unit Clause Heuristic (UCH) as long as possible to the CNF:

[1.5p]

↵ = ¬P ^ (¬Q _R _ S) ^ (¬P _Q) ^ (P _ ¬R)

Use one row for each call and state the variable the heuristic is being applied to in the 1st column, the

extension to the model in the 2nd column and the resulting formula in the 3rd column. Add as many

additional rows as required.

Table 2:

Heuristic Model Simplified CNF

Initial call {} ↵

UCH[�]

UCH[�]

UCH[�]

c. Complete the table below by applying the Pure Symbol Heuristic (PSH) as long as possible to the CNF:

[1.5p]

↵ = (¬P _Q) ^ (R _ ¬Q) ^ (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

Use one row for each call and state the variable the heuristic is being applied to in the 1st column, the

extension to the model in the 2nd column and the resulting formula in the 3rd column. Add as many

additional rows as required.

Table 3:

Heuristic Model Simplified CNF

Initial call {} ↵

PSH[�]

PSH[�]

PSH[�]

d. Suppose we had three formulas in propositional logic, F1, F2 and F3. Explain how one would show

whether F1 ^ F2 |= F3 using the DPLL algorithm. In doing this, it is important to show the formal

relation between |= and satisfaction. [2p]

9

Question:DPLL [Total points: [6p]]

The following questions pertain to the extended Davis-Putnam algorithm (DPLL) considered in the course

book. DPLL takes as input a formula in propositional logic, transforms it to its equivalent conjunctive

normal form (CNF) representation and determines whether the formula is satisfiable or not. The questions

pertain to the di↵erent heuristics used in DPLL.

(When asked to ”complete the table . . . ” in the questions below, write your own complete table in the answer

page. Do not fill in these tables on the exam page.)

a. Complete the table below by applying the Splitting rule to variable B and CNF: [1p]

↵ = (A _B _ C _D) ^ (¬A _B _ ¬C) ^ (¬B _ ¬C _D) ^ (A _ ¬B _ C _D)

^ (B _ ¬C _ ¬D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D) ^ (A _ ¬B)

Table 1:

Heuristic Model1 Simplified CNF1 Model2 Simplified CNF2

Initial call {} ↵ - -

SR[B] {B : True} {B : False}

b. Complete the table below by applying the Unit Clause Heuristic (UCH) as long as possible to the CNF:

[1.5p]

↵ = ¬P ^ (¬Q _R _ S) ^ (¬P _Q) ^ (P _ ¬R)

Use one row for each call and state the variable the heuristic is being applied to in the 1st column, the

extension to the model in the 2nd column and the resulting formula in the 3rd column. Add as many

additional rows as required.

Table 2:

Heuristic Model Simplified CNF

Initial call {} ↵

UCH[�]

UCH[�]

UCH[�]

c. Complete the table below by applying the Pure Symbol Heuristic (PSH) as long as possible to the CNF:

[1.5p]

↵ = (¬P _Q) ^ (R _ ¬Q) ^ (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

Use one row for each call and state the variable the heuristic is being applied to in the 1st column, the

extension to the model in the 2nd column and the resulting formula in the 3rd column. Add as many

additional rows as required.

Table 3:

Heuristic Model Simplified CNF

Initial call {} ↵

PSH[�]

PSH[�]

PSH[�]

d. Suppose we had three formulas in propositional logic, F1, F2 and F3. Explain how one would show

whether F1 ^ F2 |= F3 using the DPLL algorithm. In doing this, it is important to show the formal

relation between |= and satisfaction. [2p]

9

Question:DPLL [Total points: [6p]]

The following questions pertain to the extended Davis-Putnam algorithm (DPLL) considered in the course

book. DPLL takes as input a formula in propositional logic, transforms it to its equivalent conjunctive

normal form (CNF) representation and determines whether the formula is satisfiable or not. The questions

pertain to the di↵erent heuristics used in DPLL.

(When asked to ”complete the table . . . ” in the questions below, write your own complete table in the answer

page. Do not fill in these tables on the exam page.)

a. Complete the table below by applying the Splitting rule to variable B and CNF: [1p]

↵ = (A _B _ C _D) ^ (¬A _B _ ¬C) ^ (¬B _ ¬C _D) ^ (A _ ¬B _ C _D)

^ (B _ ¬C _ ¬D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D) ^ (A _ ¬B)

Table 1:

Heuristic Model1 Simplified CNF1 Model2 Simplified CNF2

Initial call {} ↵ - -

SR[B] {B : True} {B : False}

b. Complete the table below by applying the Unit Clause Heuristic (UCH) as long as possible to the CNF:

[1.5p]

↵ = ¬P ^ (¬Q _R _ S) ^ (¬P _Q) ^ (P _ ¬R)

Use one row for each call and state the variable the heuristic is being applied to in the 1st column, the

extension to the model in the 2nd column and the resulting formula in the 3rd column. Add as many

additional rows as required.

Table 2:

Heuristic Model Simplified CNF

Initial call {} ↵

UCH[�]

UCH[�]

UCH[�]

c. Complete the table below by applying the Pure Symbol Heuristic (PSH) as long as possible to the CNF:

[1.5p]

↵ = (¬P _Q) ^ (R _ ¬Q) ^ (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

Use one row for each call and state the variable the heuristic is being applied to in the 1st column, the

extension to the model in the 2nd column and the resulting formula in the 3rd column. Add as many

additional rows as required.

Table 3:

Heuristic Model Simplified CNF

Initial call {} ↵

PSH[�]

PSH[�]

PSH[�]

d. Suppose we had three formulas in propositional logic, F1, F2 and F3. Explain how one would show

whether F1 ^ F2 |= F3 using the DPLL algorithm. In doing this, it is important to show the formal

relation between |= and satisfaction. [2p]

9

Question:DPLL [Total points: [6p]]

The following questions pertain to the extended Davis-Putnam algorithm (DPLL) considered in the course

book. DPLL takes as input a formula in propositional logic, transforms it to its equivalent conjunctive

normal form (CNF) representation and determines whether the formula is satisfiable or not. The questions

pertain to the di↵erent heuristics used in DPLL.

(When asked to ”complete the table . . . ” in the questions below, write your own complete table in the answer

page. Do not fill in these tables on the exam page.)

a. Complete the table below by applying the Splitting rule to variable B and CNF: [1p]

↵ = (A _B _ C _D) ^ (¬A _B _ ¬C) ^ (¬B _ ¬C _D) ^ (A _ ¬B _ C _D)

^ (B _ ¬C _ ¬D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D) ^ (A _ ¬B)

Table 1:

Heuristic Model1 Simplified CNF1 Model2 Simplified CNF2

Initial call {} ↵ - -

SR[B] {B : True} {B : False}

b. Complete the table below by applying the Unit Clause Heuristic (UCH) as long as possible to the CNF:

[1.5p]

↵ = ¬P ^ (¬Q _R _ S) ^ (¬P _Q) ^ (P _ ¬R)

Use one row for each call and state the variable the heuristic is being applied to in the 1st column, the

extension to the model in the 2nd column and the resulting formula in the 3rd column. Add as many

additional rows as required.

Table 2:

Heuristic Model Simplified CNF

Initial call {} ↵

UCH[�]

UCH[�]

UCH[�]

c. Complete the table below by applying the Pure Symbol Heuristic (PSH) as long as possible to the CNF:

[1.5p]

↵ = (¬P _Q) ^ (R _ ¬Q) ^ (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

Use one row for each call and state the variable the heuristic is being applied to in the 1st column, the

extension to the model in the 2nd column and the resulting formula in the 3rd column. Add as many

additional rows as required.

Table 3:

Heuristic Model Simplified CNF

Initial call {} ↵

PSH[�]

PSH[�]

PSH[�]

d. Suppose we had three formulas in propositional logic, F1, F2 and F3. Explain how one would show

whether F1 ^ F2 |= F3 using the DPLL algorithm. In doing this, it is important to show the formal

relation between |= and satisfaction. [2p]

9

Question:DPLL [Total points: [6p]]

The following questions pertain to the extended Davis-Putnam algorithm (DPLL) considered in the course

book. DPLL takes as input a formula in propositional logic, transforms it to its equivalent conjunctive

normal form (CNF) representation and determines whether the formula is satisfiable or not. The questions

pertain to the di↵erent heuristics used in DPLL.

(When asked to ”complete the table . . . ” in the questions below, write your own complete table in the answer

page. Do not fill in these tables on the exam page.)

a. Complete the table below by applying the Splitting rule to variable B and CNF: [1p]

↵ = (A _B _ C _D) ^ (¬A _B _ ¬C) ^ (¬B _ ¬C _D) ^ (A _ ¬B _ C _D)

^ (B _ ¬C _ ¬D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D) ^ (A _ ¬B)

Table 1:

Heuristic Model1 Simplified CNF1 Model2 Simplified CNF2

Initial call {} ↵ - -

SR[B] {B : True} {B : False}

b. Complete the table below by applying the Unit Clause Heuristic (UCH) as long as possible to the CNF:

[1.5p]

↵ = ¬P ^ (¬Q _R _ S) ^ (¬P _Q) ^ (P _ ¬R)

Use one row for each call and state the variable the heuristic is being applied to in the 1st column, the

extension to the model in the 2nd column and the resulting formula in the 3rd column. Add as many

additional rows as required.

Table 2:

Heuristic Model Simplified CNF

Initial call {} ↵

UCH[�]

UCH[�]

UCH[�]

c. Complete the table below by applying the Pure Symbol Heuristic (PSH) as long as possible to the CNF:

[1.5p]

↵ = (¬P _Q) ^ (R _ ¬Q) ^ (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

Use one row for each call and state the variable the heuristic is being applied to in the 1st column, the

extension to the model in the 2nd column and the resulting formula in the 3rd column. Add as many

additional rows as required.

Table 3:

Heuristic Model Simplified CNF

Initial call {} ↵

PSH[�]

PSH[�]

PSH[�]

d. Suppose we had three formulas in propositional logic, F1, F2 and F3. Explain how one would show

whether F1 ^ F2 |= F3 using the DPLL algorithm. In doing this, it is important to show the formal

relation between |= and satisfaction. [2p]

9

5

Question:DPLL [Total points: [6p]]

The following questions pertain to the extended Davis-Putnam algorithm (DPLL) considered in the course

book. DPLL takes as input a formula in propositional logic, transforms it to its equivalent conjunctive

normal form (CNF) representation and determines whether the formula is satisfiable or not. The questions

pertain to the di↵erent heuristics used in DPLL.

(When asked to ”complete the table . . . ” in the questions below, write your own complete table in the answer

page. Do not fill in these tables on the exam page.)

a. Complete the table below by applying the Splitting rule to variable B and CNF: [1p]

↵ = (A _B _ C _D) ^ (¬A _B _ ¬C) ^ (¬B _ ¬C _D) ^ (A _ ¬B _ C _D)

^ (B _ ¬C _ ¬D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D) ^ (A _ ¬B)

Table 1:

Heuristic Model1 Simplified CNF1 Model2 Simplified CNF2

Initial call {} ↵ - -

SR[B] {B : True} {B : False}

b. Complete the table below by applying the Unit Clause Heuristic (UCH) as long as possible to the CNF:

[1.5p]

↵ = ¬P ^ (¬Q _R _ S) ^ (¬P _Q) ^ (P _ ¬R)

Use one row for each call and state the variable the heuristic is being applied to in the 1st column, the

extension to the model in the 2nd column and the resulting formula in the 3rd column. Add as many

additional rows as required.

Table 2:

Heuristic Model Simplified CNF

Initial call {} ↵

UCH[�]

UCH[�]

UCH[�]

c. Complete the table below by applying the Pure Symbol Heuristic (PSH) as long as possible to the CNF:

[1.5p]

↵ = (¬P _Q) ^ (R _ ¬Q) ^ (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

Use one row for each call and state the variable the heuristic is being applied to in the 1st column, the

extension to the model in the 2nd column and the resulting formula in the 3rd column. Add as many

additional rows as required.

Table 3:

Heuristic Model Simplified CNF

Initial call {} ↵

PSH[�]

PSH[�]

PSH[�]

d. Suppose we had three formulas in propositional logic, F1, F2 and F3. Explain how one would show

whether F1 ^ F2 |= F3 using the DPLL algorithm. In doing this, it is important to show the formal

relation between |= and satisfaction. [2p]

9

Answers:DPLL [Total points: [6p]]

a. -

↵ = (A _B _ C _D) ^ (¬A _B _ ¬C) ^ (¬B _ ¬C _D) ^ (A _ ¬B _ C _D)

^(B _ ¬C _ ¬D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D) ^ (A _ ¬B)

Table 4:

Heuristic Model1 Simplified CNF1 Model2 Simplified CNF2

Initial call {} ↵ - -

SR[B] {B : True} � {B : False} �

� = (¬C _D) ^ (A _ C _D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D) ^ (A)

� = (A _ C _D) ^ (¬A _ ¬C) ^ (¬C _ ¬D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D)

b. -

↵ = ¬P ^ (¬Q _R _ S) ^ (¬P _Q) ^ (P _ ¬R)

Table 5:

Heuristic Model Simplified CNF

Initial call {} ↵

UCH[¬P ] {P : False} (¬Q _R _ S) ^ (¬R)

UCH[¬R] {C : False,R : False} (¬Q _ S)

c. -

↵ = (¬P _Q) ^ (R _ ¬Q) ^ (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

Table 6:

Heuristic Model Simplified CNF

Initial call {} ↵

PSH[P ] {P : False} (R _ ¬Q) ^ (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

PSH[R] {P : False,R : True} (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

PSH[Q] {P : False,R : True,Q : True} (M _ ¬N) ^ (N _ ¬M)

Initially, P , R are pure symbols. Choose one: (P )

R is a pure symbol. Choose one: (R)

Q is a pure symbol. Choose one: (Q)

d. The answer uses the Deduction Theorem and the relationship between satisfiability and validity.

1. The deduction theorem states that If � |= ↵ then |= � ! ↵.

2. � ! ↵ is valid i↵ ¬(� ! ↵) which is the same as saying that � ^ ¬↵ is unsatisfiable.

11

6

Page 4: TDDC17 Fo9 SomeExamQuestions

Question:DPLL [Total points: [6p]]

The following questions pertain to the extended Davis-Putnam algorithm (DPLL) considered in the course

book. DPLL takes as input a formula in propositional logic, transforms it to its equivalent conjunctive

normal form (CNF) representation and determines whether the formula is satisfiable or not. The questions

pertain to the di↵erent heuristics used in DPLL.

(When asked to ”complete the table . . . ” in the questions below, write your own complete table in the answer

page. Do not fill in these tables on the exam page.)

a. Complete the table below by applying the Splitting rule to variable B and CNF: [1p]

↵ = (A _B _ C _D) ^ (¬A _B _ ¬C) ^ (¬B _ ¬C _D) ^ (A _ ¬B _ C _D)

^ (B _ ¬C _ ¬D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D) ^ (A _ ¬B)

Table 1:

Heuristic Model1 Simplified CNF1 Model2 Simplified CNF2

Initial call {} ↵ - -

SR[B] {B : True} {B : False}

b. Complete the table below by applying the Unit Clause Heuristic (UCH) as long as possible to the CNF:

[1.5p]

↵ = ¬P ^ (¬Q _R _ S) ^ (¬P _Q) ^ (P _ ¬R)

Use one row for each call and state the variable the heuristic is being applied to in the 1st column, the

extension to the model in the 2nd column and the resulting formula in the 3rd column. Add as many

additional rows as required.

Table 2:

Heuristic Model Simplified CNF

Initial call {} ↵

UCH[�]

UCH[�]

UCH[�]

c. Complete the table below by applying the Pure Symbol Heuristic (PSH) as long as possible to the CNF:

[1.5p]

↵ = (¬P _Q) ^ (R _ ¬Q) ^ (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

Use one row for each call and state the variable the heuristic is being applied to in the 1st column, the

extension to the model in the 2nd column and the resulting formula in the 3rd column. Add as many

additional rows as required.

Table 3:

Heuristic Model Simplified CNF

Initial call {} ↵

PSH[�]

PSH[�]

PSH[�]

d. Suppose we had three formulas in propositional logic, F1, F2 and F3. Explain how one would show

whether F1 ^ F2 |= F3 using the DPLL algorithm. In doing this, it is important to show the formal

relation between |= and satisfaction. [2p]

9

Answers:DPLL [Total points: [6p]]

a. -

↵ = (A _B _ C _D) ^ (¬A _B _ ¬C) ^ (¬B _ ¬C _D) ^ (A _ ¬B _ C _D)

^(B _ ¬C _ ¬D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D) ^ (A _ ¬B)

Table 4:

Heuristic Model1 Simplified CNF1 Model2 Simplified CNF2

Initial call {} ↵ - -

SR[B] {B : True} � {B : False} �

� = (¬C _D) ^ (A _ C _D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D) ^ (A)

� = (A _ C _D) ^ (¬A _ ¬C) ^ (¬C _ ¬D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D)

b. -

↵ = ¬P ^ (¬Q _R _ S) ^ (¬P _Q) ^ (P _ ¬R)

Table 5:

Heuristic Model Simplified CNF

Initial call {} ↵

UCH[¬P ] {P : False} (¬Q _R _ S) ^ (¬R)

UCH[¬R] {P : False,R : False} (¬Q _ S)

c. -

↵ = (¬P _Q) ^ (R _ ¬Q) ^ (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

Table 6:

Heuristic Model Simplified CNF

Initial call {} ↵

PSH[P ] {P : False} (R _ ¬Q) ^ (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

PSH[R] {P : False,R : True} (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

PSH[Q] {P : False,R : True,Q : True} (M _ ¬N) ^ (N _ ¬M)

Initially, P , R are pure symbols. Choose one: (P )

R is a pure symbol. Choose one: (R)

Q is a pure symbol. Choose one: (Q)

d. The answer uses the Deduction Theorem and the relationship between satisfiability and validity.

1. The deduction theorem states that If � |= ↵ then |= � ! ↵.

2. � ! ↵ is valid i↵ ¬(� ! ↵) which is the same as saying that � ^ ¬↵ is unsatisfiable.

11

7

Question:DPLL [Total points: [6p]]

The following questions pertain to the extended Davis-Putnam algorithm (DPLL) considered in the course

book. DPLL takes as input a formula in propositional logic, transforms it to its equivalent conjunctive

normal form (CNF) representation and determines whether the formula is satisfiable or not. The questions

pertain to the di↵erent heuristics used in DPLL.

(When asked to ”complete the table . . . ” in the questions below, write your own complete table in the answer

page. Do not fill in these tables on the exam page.)

a. Complete the table below by applying the Splitting rule to variable B and CNF: [1p]

↵ = (A _B _ C _D) ^ (¬A _B _ ¬C) ^ (¬B _ ¬C _D) ^ (A _ ¬B _ C _D)

^ (B _ ¬C _ ¬D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D) ^ (A _ ¬B)

Table 1:

Heuristic Model1 Simplified CNF1 Model2 Simplified CNF2

Initial call {} ↵ - -

SR[B] {B : True} {B : False}

b. Complete the table below by applying the Unit Clause Heuristic (UCH) as long as possible to the CNF:

[1.5p]

↵ = ¬P ^ (¬Q _R _ S) ^ (¬P _Q) ^ (P _ ¬R)

Use one row for each call and state the variable the heuristic is being applied to in the 1st column, the

extension to the model in the 2nd column and the resulting formula in the 3rd column. Add as many

additional rows as required.

Table 2:

Heuristic Model Simplified CNF

Initial call {} ↵

UCH[�]

UCH[�]

UCH[�]

c. Complete the table below by applying the Pure Symbol Heuristic (PSH) as long as possible to the CNF:

[1.5p]

↵ = (¬P _Q) ^ (R _ ¬Q) ^ (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

Use one row for each call and state the variable the heuristic is being applied to in the 1st column, the

extension to the model in the 2nd column and the resulting formula in the 3rd column. Add as many

additional rows as required.

Table 3:

Heuristic Model Simplified CNF

Initial call {} ↵

PSH[�]

PSH[�]

PSH[�]

d. Suppose we had three formulas in propositional logic, F1, F2 and F3. Explain how one would show

whether F1 ^ F2 |= F3 using the DPLL algorithm. In doing this, it is important to show the formal

relation between |= and satisfaction. [2p]

9

Answers:DPLL [Total points: [6p]]

a. -

↵ = (A _B _ C _D) ^ (¬A _B _ ¬C) ^ (¬B _ ¬C _D) ^ (A _ ¬B _ C _D)

^(B _ ¬C _ ¬D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D) ^ (A _ ¬B)

Table 4:

Heuristic Model1 Simplified CNF1 Model2 Simplified CNF2

Initial call {} ↵ - -

SR[B] {B : True} � {B : False} �

� = (¬C _D) ^ (A _ C _D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D) ^ (A)

� = (A _ C _D) ^ (¬A _ ¬C) ^ (¬C _ ¬D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D)

b. -

↵ = ¬P ^ (¬Q _R _ S) ^ (¬P _Q) ^ (P _ ¬R)

Table 5:

Heuristic Model Simplified CNF

Initial call {} ↵

UCH[¬P ] {P : False} (¬Q _R _ S) ^ (¬R)

UCH[¬R] {C : False,R : False} (¬Q _ S)

c. -

↵ = (¬P _Q) ^ (R _ ¬Q) ^ (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

Table 6:

Heuristic Model Simplified CNF

Initial call {} ↵

PSH[P ] {P : False} (R _ ¬Q) ^ (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

PSH[R] {P : False,R : True} (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

PSH[Q] {P : False,R : True,Q : True} (M _ ¬N) ^ (N _ ¬M)

Initially, P , R are pure symbols. Choose one: (P )

R is a pure symbol. Choose one: (R)

Q is a pure symbol. Choose one: (Q)

d. The answer uses the Deduction Theorem and the relationship between satisfiability and validity.

1. The deduction theorem states that If � |= ↵ then |= � ! ↵.

2. � ! ↵ is valid i↵ ¬(� ! ↵) which is the same as saying that � ^ ¬↵ is unsatisfiable.

11

8

Page 5: TDDC17 Fo9 SomeExamQuestions

Question:DPLL [Total points: [6p]]

The following questions pertain to the extended Davis-Putnam algorithm (DPLL) considered in the course

book. DPLL takes as input a formula in propositional logic, transforms it to its equivalent conjunctive

normal form (CNF) representation and determines whether the formula is satisfiable or not. The questions

pertain to the di↵erent heuristics used in DPLL.

(When asked to ”complete the table . . . ” in the questions below, write your own complete table in the answer

page. Do not fill in these tables on the exam page.)

a. Complete the table below by applying the Splitting rule to variable B and CNF: [1p]

↵ = (A _B _ C _D) ^ (¬A _B _ ¬C) ^ (¬B _ ¬C _D) ^ (A _ ¬B _ C _D)

^ (B _ ¬C _ ¬D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D) ^ (A _ ¬B)

Table 1:

Heuristic Model1 Simplified CNF1 Model2 Simplified CNF2

Initial call {} ↵ - -

SR[B] {B : True} {B : False}

b. Complete the table below by applying the Unit Clause Heuristic (UCH) as long as possible to the CNF:

[1.5p]

↵ = ¬P ^ (¬Q _R _ S) ^ (¬P _Q) ^ (P _ ¬R)

Use one row for each call and state the variable the heuristic is being applied to in the 1st column, the

extension to the model in the 2nd column and the resulting formula in the 3rd column. Add as many

additional rows as required.

Table 2:

Heuristic Model Simplified CNF

Initial call {} ↵

UCH[�]

UCH[�]

UCH[�]

c. Complete the table below by applying the Pure Symbol Heuristic (PSH) as long as possible to the CNF:

[1.5p]

↵ = (¬P _Q) ^ (R _ ¬Q) ^ (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

Use one row for each call and state the variable the heuristic is being applied to in the 1st column, the

extension to the model in the 2nd column and the resulting formula in the 3rd column. Add as many

additional rows as required.

Table 3:

Heuristic Model Simplified CNF

Initial call {} ↵

PSH[�]

PSH[�]

PSH[�]

d. Suppose we had three formulas in propositional logic, F1, F2 and F3. Explain how one would show

whether F1 ^ F2 |= F3 using the DPLL algorithm. In doing this, it is important to show the formal

relation between |= and satisfaction. [2p]

9

Answers:DPLL [Total points: [6p]]

a. -

↵ = (A _B _ C _D) ^ (¬A _B _ ¬C) ^ (¬B _ ¬C _D) ^ (A _ ¬B _ C _D)

^(B _ ¬C _ ¬D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D) ^ (A _ ¬B)

Table 4:

Heuristic Model1 Simplified CNF1 Model2 Simplified CNF2

Initial call {} ↵ - -

SR[B] {B : True} � {B : False} �

� = (¬C _D) ^ (A _ C _D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D) ^ (A)

� = (A _ C _D) ^ (¬A _ ¬C) ^ (¬C _ ¬D) ^ (¬A _ ¬C _D) ^ (¬A _ ¬D)

b. -

↵ = ¬P ^ (¬Q _R _ S) ^ (¬P _Q) ^ (P _ ¬R)

Table 5:

Heuristic Model Simplified CNF

Initial call {} ↵

UCH[¬P ] {P : False} (¬Q _R _ S) ^ (¬R)

UCH[¬R] {C : False,R : False} (¬Q _ S)

c. -

↵ = (¬P _Q) ^ (R _ ¬Q) ^ (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

Table 6:

Heuristic Model Simplified CNF

Initial call {} ↵

PSH[P ] {P : False} (R _ ¬Q) ^ (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

PSH[R] {P : False,R : True} (M _ ¬N) ^ (N _ ¬M) ^ (Q _N)

PSH[Q] {P : False,R : True,Q : True} (M _ ¬N) ^ (N _ ¬M)

Initially, P , R are pure symbols. Choose one: (P )

R is a pure symbol. Choose one: (R)

Q is a pure symbol. Choose one: (Q)

d. The answer uses the Deduction Theorem and the relationship between satisfiability and validity.

1. The deduction theorem states that If � |= ↵ then |= � ! ↵.

2. � ! ↵ is valid i↵ ¬(� ! ↵) which is the same as saying that � ^ ¬↵ is unsatisfiable.

11

3. Let � be F1 ^ F2 ^ ¬F3 in CNF.

4. If DPLL-Satisfiable?(�) is true then F1 ^ F2 |= F3 is false

5. If DPLL-Satisfiable?(�) is false then F1 ^ F2 |= F3 is true

12

9

Σ = ⟨𝒪 = {𝗃𝗂𝗆, 𝗌𝖺𝗋𝖺𝗁}, 𝒫 = {𝗌𝖺𝗆𝖾𝖭𝖾𝗂𝗀𝗁𝖻𝗈𝗋𝗁𝗈𝗈𝖽, 𝗌𝗍𝗋𝖺𝗇𝗀𝖾𝗋𝗌, 𝗉𝖾𝗋𝗌𝗈𝗇, 𝖼𝗋𝗂𝗆𝗂𝗇𝖺𝗅, 𝗀𝗈𝗈𝖽𝖭𝖾𝗂𝗀𝗁𝖻𝗈𝗋}, 𝒱 = {X, Y}⟩

Answer set question [propositionalization or grounding]:Assume the following signature:

Answer:

Prop(⇧):

r1: person(jim).

r2: person(sarah).

r3: sameNeighborhood(jim, jim).

r4: sameNeighborhood(sarah, sarah).

r5: strangers(jim, jim) not sameNeighborhood(jim, jim), person(jim), person(jim).

r6 strangers(sarah, sarah) not sameNeighborhood(sarah, sarah), person(sarah), person(sarah).

r7: strangers(jim, sarah) not sameNeighborhood(jim, sarah), person(jim), person(sarah).

r8: strangers(sarah, jim) not sameNeighborhood(sarah, jim), person(sarah), person(jim).

r9: goodNeighbor(jim) not criminal(jim), person(jim).

r10: goodNeighbor(sarah) not criminal(sarah), person(sarah).

(Q1) Given the positive answer set program ⇧1, consisting of the following rules:

r1: p(1).

r2: p(2).

r3: p(3).

r4: q(3) not r(3).

r5: r(1) p(1),not q(1).

r6: r(2) p(2),not q(2).

r7: r(3) p(3),not q(3).

What are the number of possible answer sets for ⇧1? Explain why.

(A1):

• 27since there are 7 unique literals in the heads of the rules and an ASP can only generate

literals in heads of rules.

(Q2) Given the following possible answer sets:

1. S1 = {r(2), r(1), p(1), p(2), p(3), r(3)}

2. S2 = {r(1), p(1), p(2), p(3), r(3)}

3. S3 = {r(2), r(1), p(1), p(2), p(3), q(3)}

For each possible answer set Si above, provide the reduct, ⇧Si1 for ⇧1:

(A2):

Rule ⇧S11

r1: p(1).r2: p(2).r3: p(3).r4: deleter5: r(1) p(1).r6: r(2) p(2).r7: r(3) p(3)).

Rule ⇧S21

r1: p(1).r2: p(2).r3: p(3).r4: deleter5: r(1) p(1).r6: r(2) p(2).r7: r(3) p(3).

Rule ⇧S31

r1: p(1).r2: p(2).r3: p(3).r4: q(3).r5: r(1) p(1).r6: r(2) p(2).r7: delete

2

TDDC17: Some Answer Set questions and answers

P. Doherty

September 19, 2021

The following questions assume we are using normal answer set programs.

(Q0) : Some grounding examples (also called propositionalization).

Suppose you are given the following signature

⌃ = hO = {sam, jane},P = {republican, democrat},V = {X}i.

Propositionalize the following answer set program ⇧:

r1: democrat(X) not republican(X).

r2: republican(X) not democrat(X).

Answer:

Prop(⇧):

r1: democrat(sam) not republican(sam).

r2: republican(sam) not democrat(sam).

r3: democrat(jane not republican(jane).

r4: republican(jane) not democrat(jane).

Suppose you are given the following signature

⌃ = hO = {jim, sarah},P = {sameNeighborhood, strangers, person, criminal, goodNeighbor},V =

{X,Y }i.

Propositionalize (ground) the following answer set program ⇧:

r1: person(X).

r2: sameNeighborhood(X,X).

r3: strangers(X,Y ) not sameNeighborhood(X,Y ), person(X), person(Y ).

r4: goodNeighbor(X) not criminal(X), person(X).

1

10

Page 6: TDDC17 Fo9 SomeExamQuestions

Question:Answer Sets [Total points: [8p]]

The following questions pertain to Answer Set Programming.

Assume the answer set program below ⇧1, has the following signature:

hO = {a, b},P = {p, q, r, s},V = {X}i.

Given the positive answer set program ⇧1, consisting of the following rules:

r1: s(a).

r2: p(X) not q(X), s(X).

r3: q(X) not p(X).

r4: r(X) p(X).

r5: r(X) q(X).

a. Propositionalize the answer set program ⇧1. Refer to the propositionalized version of ⇧1 as ⇧p. [1p]

b. What is the cardinality of the possible answer sets for ⇧p? Explain why. [1p]

Given the following possible answer sets for ⇧p :

S1 = {s(a), q(b), r(b), q(a), r(a)}

S2 = {s(a), r(b), q(a), r(a), p(a), p(b)}

S3 = {s(a), q(b), r(b), p(a), r(a))}

c. For each Si, provide the reduct, ⇧Sip for ⇧p. [1.5p]

d. Generate Cn(⇧Sip ) for each reduct ⇧Si

1 of ⇧p. [1.5p]

e. Which of the three answer sets S1, S2, S3 are actual answer sets for ⇧p? (Explain why)[1p]

f. The consequence relation, |=, for classical logic is said to be monotonic. What does this mean? (Be preciseand succinct in your explanation) [1p]

g. Why is Answer Set Programming considered to be a nonmonotonic reasoning formalism (Be precise anduse an example)? [1p]

16

11Question:Answer Sets [Total points: [8p]]

The following questions pertain to Answer Set Programming.

Assume the answer set program below ⇧1, has the following signature:

hO = {a, b},P = {p, q, r, s},V = {X}i.

Given the positive answer set program ⇧1, consisting of the following rules:

r1: s(a).

r2: p(X) not q(X), s(X).

r3: q(X) not p(X).

r4: r(X) p(X).

r5: r(X) q(X).

a. Propositionalize the answer set program ⇧1. Refer to the propositionalized version of ⇧1 as ⇧p. [1p]

b. What is the cardinality of the possible answer sets for ⇧p? Explain why. [1p]

Given the following possible answer sets for ⇧p :

S1 = {s(a), q(b), r(b), q(a), r(a)}

S2 = {s(a), r(b), q(a), r(a), p(a), p(b)}

S3 = {s(a), q(b), r(b), p(a), r(a))}

c. For each Si, provide the reduct, ⇧Sip for ⇧p. [1.5p]

d. Generate Cn(⇧Sip ) for each reduct ⇧Si

1 of ⇧p. [1.5p]

e. Which of the three answer sets S1, S2, S3 are actual answer sets for ⇧p? (Explain why)[1p]

f. The consequence relation, |=, for classical logic is said to be monotonic. What does this mean? (Be preciseand succinct in your explanation) [1p]

g. Why is Answer Set Programming considered to be a nonmonotonic reasoning formalism (Be precise anduse an example)? [1p]

16

Answer: Question:Answer Sets

a. -

r1: s(a).

r2: p(a) not q(a), s(a).

r3: q(a) not p(a).

r4: r(a) p(a).

r5: r(a) q(a).

r6: p(b) not q(b), s(b).

r7: q(b) not p(b).

r8: r(b) p(b).

r9: r(b) q(b).

b. 27 = 128. Seven unique literals in the heads of the rules.

c. -

S1 = {s(a), q(b), r(b), q(a), r(a)}

S2 = {s(a), r(b), q(a), r(a), p(a), p(b)}

S3 = {s(a), q(b), r(b), p(a), r(a))}

Rule ⇧S11

r1: s(a).r2: delete

r3: q(a).r4: r(a) p(a).r5: r(a) q(a).r6: delete

r7: q(b).r8: r(b) p(b).r9: r(b) q(b).

Rule ⇧S21

r1: s(a).r2: delete.

r3: delete

r4: r(a) p(a).r5: r(a) q(a).r6: p(b) s(b).r7: delete

r8: r(b) p(b).r9: r(b) q(b).

Rule ⇧S31

r1: s(a).r2: p(a) s(a).r3: delete

r4: r(a) p(a).r5: r(a) q(a).r6: delete

r7: q(b).r8: r(b) p(b).r9: r(b) q(b).

d. -

• Cn(⇧S1p ) : {}, {s(a), q(a), q(b)}, {s(a), q(a), q(b), r(a), r(b)}

• Cn(⇧S2p ) : {}, {s(a)}

• Cn(⇧S3p ) : {}, {s(a), q(b)}, {s(a), q(b), p(a), r(b)}, {s(a), q(b), p(a), r(b), r(a)}

e. Cn(⇧S1p ) = S1, Cn(⇧S2

p ) 6= S2, Cn(⇧S3p ) = S3. S1 and S3 are answer sets.

f. Intuitively, this means that once something is proven relative to a theory, if one extends the theory,anything previously proven will still be proven in the extended theory. This is a form of locality.� |= ↵ implies that � [ �0

|= ↵.

g. ASP is considered to be a nonmonotonic formalism, because something inferable from a program ⇧, maynot be inferable when the program is extended with new rules. By inferable, we mean true in all answersets for the program ⇧. As an example ⇧ = {b not a} entails b since it has one answer set {b}. If ⇧is extended with the rule a , then b is no longer entailed since the answer set for the new programis {a}.

17

Answer: Question:Answer Sets

a. -

r1: s(a).

r2: p(a) not q(a), s(a).

r3: q(a) not p(a).

r4: r(a) p(a).

r5: r(a) q(a).

r6: p(b) not q(b), s(b).

r7: q(b) not p(b).

r8: r(b) p(b).

r9: r(b) q(b).

b. 27 = 128. Seven unique literals in the heads of the rules.

c. -

S1 = {s(a), q(b), r(b), q(a), r(a)}

S2 = {s(a), r(b), q(a), r(a), p(a), p(b)}

S3 = {s(a), q(b), r(b), p(a), r(a))}

Rule ⇧S11

r1: s(a).r2: delete

r3: q(a).r4: r(a) p(a).r5: r(a) q(a).r6: delete

r7: q(b).r8: r(b) p(b).r9: r(b) q(b).

Rule ⇧S21

r1: s(a).r2: delete.

r3: delete

r4: r(a) p(a).r5: r(a) q(a).r6: p(b) s(b).r7: delete

r8: r(b) p(b).r9: r(b) q(b).

Rule ⇧S31

r1: s(a).r2: p(a) s(a).r3: delete

r4: r(a) p(a).r5: r(a) q(a).r6: delete

r7: q(b).r8: r(b) p(b).r9: r(b) q(b).

d. -

• Cn(⇧S1p ) : {}, {s(a), q(a), q(b)}, {s(a), q(a), q(b), r(a), r(b)}

• Cn(⇧S2p ) : {}, {s(a)}

• Cn(⇧S3p ) : {}, {s(a), q(b)}, {s(a), q(b), p(a), r(b)}, {s(a), q(b), p(a), r(b), r(a)}

e. Cn(⇧S1p ) = S1, Cn(⇧S2

p ) 6= S2, Cn(⇧S3p ) = S3. S1 and S3 are answer sets.

f. Intuitively, this means that once something is proven relative to a theory, if one extends the theory,anything previously proven will still be proven in the extended theory. This is a form of locality.� |= ↵ implies that � [ �0

|= ↵.

g. ASP is considered to be a nonmonotonic formalism, because something inferable from a program ⇧, maynot be inferable when the program is extended with new rules. By inferable, we mean true in all answersets for the program ⇧. As an example ⇧ = {b not a} entails b since it has one answer set {b}. If ⇧is extended with the rule a , then b is no longer entailed since the answer set for the new programis {a}.

17

Question:Answer Sets [Total points: [8p]]

The following questions pertain to Answer Set Programming.

Assume the answer set program below ⇧1, has the following signature:

hO = {a, b},P = {p, q, r, s},V = {X}i.

Given the positive answer set program ⇧1, consisting of the following rules:

r1: s(a).

r2: p(X) not q(X), s(X).

r3: q(X) not p(X).

r4: r(X) p(X).

r5: r(X) q(X).

a. Propositionalize the answer set program ⇧1. Refer to the propositionalized version of ⇧1 as ⇧p. [1p]

b. What is the cardinality of the possible answer sets for ⇧p? Explain why. [1p]

Given the following possible answer sets for ⇧p :

S1 = {s(a), q(b), r(b), q(a), r(a)}

S2 = {s(a), r(b), q(a), r(a), p(a), p(b)}

S3 = {s(a), q(b), r(b), p(a), r(a))}

c. For each Si, provide the reduct, ⇧Sip for ⇧p. [1.5p]

d. Generate Cn(⇧Sip ) for each reduct ⇧Si

1 of ⇧p. [1.5p]

e. Which of the three answer sets S1, S2, S3 are actual answer sets for ⇧p? (Explain why)[1p]

f. The consequence relation, |=, for classical logic is said to be monotonic. What does this mean? (Be preciseand succinct in your explanation) [1p]

g. Why is Answer Set Programming considered to be a nonmonotonic reasoning formalism (Be precise anduse an example)? [1p]

16

Question:Answer Sets [Total points: [8p]]

The following questions pertain to Answer Set Programming.

Assume the answer set program below ⇧1, has the following signature:

hO = {a, b},P = {p, q, r, s},V = {X}i.

Given the positive answer set program ⇧1, consisting of the following rules:

r1: s(a).

r2: p(X) not q(X), s(X).

r3: q(X) not p(X).

r4: r(X) p(X).

r5: r(X) q(X).

a. Propositionalize the answer set program ⇧1. Refer to the propositionalized version of ⇧1 as ⇧p. [1p]

b. What is the cardinality of the possible answer sets for ⇧p? Explain why. [1p]

Given the following possible answer sets for ⇧p :

S1 = {s(a), q(b), r(b), q(a), r(a)}

S2 = {s(a), r(b), q(a), r(a), p(a), p(b)}

S3 = {s(a), q(b), r(b), p(a), r(a))}

c. For each Si, provide the reduct, ⇧Sip for ⇧p. [1.5p]

d. Generate Cn(⇧Sip ) for each reduct ⇧Si

1 of ⇧p. [1.5p]

e. Which of the three answer sets S1, S2, S3 are actual answer sets for ⇧p? (Explain why)[1p]

f. The consequence relation, |=, for classical logic is said to be monotonic. What does this mean? (Be preciseand succinct in your explanation) [1p]

g. Why is Answer Set Programming considered to be a nonmonotonic reasoning formalism (Be precise anduse an example)? [1p]

16

12

Page 7: TDDC17 Fo9 SomeExamQuestions

Answer: Question:Answer Sets

a. -

r1: s(a).

r2: p(a) not q(a), s(a).

r3: q(a) not p(a).

r4: r(a) p(a).

r5: r(a) q(a).

r6: p(b) not q(b), s(b).

r7: q(b) not p(b).

r8: r(b) p(b).

r9: r(b) q(b).

b. 27 = 128. Seven unique literals in the heads of the rules.

c. -

S1 = {s(a), q(b), r(b), q(a), r(a)}

S2 = {s(a), r(b), q(a), r(a), p(a), p(b)}

S3 = {s(a), q(b), r(b), p(a), r(a))}

Rule ⇧S11

r1: s(a).r2: delete

r3: q(a).r4: r(a) p(a).r5: r(a) q(a).r6: delete

r7: q(b).r8: r(b) p(b).r9: r(b) q(b).

Rule ⇧S21

r1: s(a).r2: delete.

r3: delete

r4: r(a) p(a).r5: r(a) q(a).r6: p(b) s(b).r7: delete

r8: r(b) p(b).r9: r(b) q(b).

Rule ⇧S31

r1: s(a).r2: p(a) s(a).r3: delete

r4: r(a) p(a).r5: r(a) q(a).r6: delete

r7: q(b).r8: r(b) p(b).r9: r(b) q(b).

d. -

• Cn(⇧S1p ) : {}, {s(a), q(a), q(b)}, {s(a), q(a), q(b), r(a), r(b)}

• Cn(⇧S2p ) : {}, {s(a)}

• Cn(⇧S3p ) : {}, {s(a), q(b)}, {s(a), q(b), p(a), r(b)}, {s(a), q(b), p(a), r(b), r(a)}

e. Cn(⇧S1p ) = S1, Cn(⇧S2

p ) 6= S2, Cn(⇧S3p ) = S3. S1 and S3 are answer sets.

f. Intuitively, this means that once something is proven relative to a theory, if one extends the theory,anything previously proven will still be proven in the extended theory. This is a form of locality.� |= ↵ implies that � [ �0

|= ↵.

g. ASP is considered to be a nonmonotonic formalism, because something inferable from a program ⇧, maynot be inferable when the program is extended with new rules. By inferable, we mean true in all answersets for the program ⇧. As an example ⇧ = {b not a} entails b since it has one answer set {b}. If ⇧is extended with the rule a , then b is no longer entailed since the answer set for the new programis {a}.

17

Question:Answer Sets [Total points: [8p]]

The following questions pertain to Answer Set Programming.

Assume the answer set program below ⇧1, has the following signature:

hO = {a, b},P = {p, q, r, s},V = {X}i.

Given the positive answer set program ⇧1, consisting of the following rules:

r1: s(a).

r2: p(X) not q(X), s(X).

r3: q(X) not p(X).

r4: r(X) p(X).

r5: r(X) q(X).

a. Propositionalize the answer set program ⇧1. Refer to the propositionalized version of ⇧1 as ⇧p. [1p]

b. What is the cardinality of the possible answer sets for ⇧p? Explain why. [1p]

Given the following possible answer sets for ⇧p :

S1 = {s(a), q(b), r(b), q(a), r(a)}

S2 = {s(a), r(b), q(a), r(a), p(a), p(b)}

S3 = {s(a), q(b), r(b), p(a), r(a))}

c. For each Si, provide the reduct, ⇧Sip for ⇧p. [1.5p]

d. Generate Cn(⇧Sip ) for each reduct ⇧Si

1 of ⇧p. [1.5p]

e. Which of the three answer sets S1, S2, S3 are actual answer sets for ⇧p? (Explain why)[1p]

f. The consequence relation, |=, for classical logic is said to be monotonic. What does this mean? (Be preciseand succinct in your explanation) [1p]

g. Why is Answer Set Programming considered to be a nonmonotonic reasoning formalism (Be precise anduse an example)? [1p]

16

Question:Answer Sets [Total points: [8p]]

The following questions pertain to Answer Set Programming.

Assume the answer set program below ⇧1, has the following signature:

hO = {a, b},P = {p, q, r, s},V = {X}i.

Given the positive answer set program ⇧1, consisting of the following rules:

r1: s(a).

r2: p(X) not q(X), s(X).

r3: q(X) not p(X).

r4: r(X) p(X).

r5: r(X) q(X).

a. Propositionalize the answer set program ⇧1. Refer to the propositionalized version of ⇧1 as ⇧p. [1p]

b. What is the cardinality of the possible answer sets for ⇧p? Explain why. [1p]

Given the following possible answer sets for ⇧p :

S1 = {s(a), q(b), r(b), q(a), r(a)}

S2 = {s(a), r(b), q(a), r(a), p(a), p(b)}

S3 = {s(a), q(b), r(b), p(a), r(a))}

c. For each Si, provide the reduct, ⇧Sip for ⇧p. [1.5p]

d. Generate Cn(⇧Sip ) for each reduct ⇧Si

1 of ⇧p. [1.5p]

e. Which of the three answer sets S1, S2, S3 are actual answer sets for ⇧p? (Explain why)[1p]

f. The consequence relation, |=, for classical logic is said to be monotonic. What does this mean? (Be preciseand succinct in your explanation) [1p]

g. Why is Answer Set Programming considered to be a nonmonotonic reasoning formalism (Be precise anduse an example)? [1p]

16

Answer: Question:Answer Sets

a. -

r1: s(a).

r2: p(a) not q(a), s(a).

r3: q(a) not p(a).

r4: r(a) p(a).

r5: r(a) q(a).

r6: p(b) not q(b), s(b).

r7: q(b) not p(b).

r8: r(b) p(b).

r9: r(b) q(b).

b. 27 = 128. Seven unique literals in the heads of the rules.

c. -

S1 = {s(a), q(b), r(b), q(a), r(a)}

S2 = {s(a), r(b), q(a), r(a), p(a), p(b)}

S3 = {s(a), q(b), r(b), p(a), r(a))}

Rule ⇧S11

r1: s(a).r2: delete

r3: q(a).r4: r(a) p(a).r5: r(a) q(a).r6: delete

r7: q(b).r8: r(b) p(b).r9: r(b) q(b).

Rule ⇧S21

r1: s(a).r2: delete.

r3: delete

r4: r(a) p(a).r5: r(a) q(a).r6: p(b) s(b).r7: delete

r8: r(b) p(b).r9: r(b) q(b).

Rule ⇧S31

r1: s(a).r2: p(a) s(a).r3: delete

r4: r(a) p(a).r5: r(a) q(a).r6: delete

r7: q(b).r8: r(b) p(b).r9: r(b) q(b).

d. -

• Cn(⇧S1p ) : {}, {s(a), q(a), q(b)}, {s(a), q(a), q(b), r(a), r(b)}

• Cn(⇧S2p ) : {}, {s(a)}

• Cn(⇧S3p ) : {}, {s(a), q(b)}, {s(a), q(b), p(a), r(b)}, {s(a), q(b), p(a), r(b), r(a)}

e. Cn(⇧S1p ) = S1, Cn(⇧S2

p ) 6= S2, Cn(⇧S3p ) = S3. S1 and S3 are answer sets.

f. Intuitively, this means that once something is proven relative to a theory, if one extends the theory,anything previously proven will still be proven in the extended theory. This is a form of locality.� |= ↵ implies that � [ �0

|= ↵.

g. ASP is considered to be a nonmonotonic formalism, because something inferable from a program ⇧, maynot be inferable when the program is extended with new rules. By inferable, we mean true in all answersets for the program ⇧. As an example ⇧ = {b not a} entails b since it has one answer set {b}. If ⇧is extended with the rule a , then b is no longer entailed since the answer set for the new programis {a}.

17

13

Answer: Question:Answer Sets

a. -

r1: s(a).

r2: p(a) not q(a), s(a).

r3: q(a) not p(a).

r4: r(a) p(a).

r5: r(a) q(a).

r6: p(b) not q(b), s(b).

r7: q(b) not p(b).

r8: r(b) p(b).

r9: r(b) q(b).

b. 27 = 128. Seven unique literals in the heads of the rules.

c. -

S1 = {s(a), q(b), r(b), q(a), r(a)}

S2 = {s(a), r(b), q(a), r(a), p(a), p(b)}

S3 = {s(a), q(b), r(b), p(a), r(a))}

Rule ⇧S11

r1: s(a).r2: delete

r3: q(a).r4: r(a) p(a).r5: r(a) q(a).r6: delete

r7: q(b).r8: r(b) p(b).r9: r(b) q(b).

Rule ⇧S21

r1: s(a).r2: delete.

r3: delete

r4: r(a) p(a).r5: r(a) q(a).r6: p(b) s(b).r7: delete

r8: r(b) p(b).r9: r(b) q(b).

Rule ⇧S31

r1: s(a).r2: p(a) s(a).r3: delete

r4: r(a) p(a).r5: r(a) q(a).r6: delete

r7: q(b).r8: r(b) p(b).r9: r(b) q(b).

d. -

• Cn(⇧S1p ) : {}, {s(a), q(a), q(b)}, {s(a), q(a), q(b), r(a), r(b)}

• Cn(⇧S2p ) : {}, {s(a)}

• Cn(⇧S3p ) : {}, {s(a), q(b)}, {s(a), q(b), p(a), r(b)}, {s(a), q(b), p(a), r(b), r(a)}

e. Cn(⇧S1p ) = S1, Cn(⇧S2

p ) 6= S2, Cn(⇧S3p ) = S3. S1 and S3 are answer sets.

f. Intuitively, this means that once something is proven relative to a theory, if one extends the theory,anything previously proven will still be proven in the extended theory. This is a form of locality.� |= ↵ implies that � [ �0

|= ↵.

g. ASP is considered to be a nonmonotonic formalism, because something inferable from a program ⇧, maynot be inferable when the program is extended with new rules. By inferable, we mean true in all answersets for the program ⇧. As an example ⇧ = {b not a} entails b since it has one answer set {b}. If ⇧is extended with the rule a , then b is no longer entailed since the answer set for the new programis {a}.

17

Question:Answer Sets [Total points: [8p]]

The following questions pertain to Answer Set Programming.

Assume the answer set program below ⇧1, has the following signature:

hO = {a, b},P = {p, q, r, s},V = {X}i.

Given the positive answer set program ⇧1, consisting of the following rules:

r1: s(a).

r2: p(X) not q(X), s(X).

r3: q(X) not p(X).

r4: r(X) p(X).

r5: r(X) q(X).

a. Propositionalize the answer set program ⇧1. Refer to the propositionalized version of ⇧1 as ⇧p. [1p]

b. What is the cardinality of the possible answer sets for ⇧p? Explain why. [1p]

Given the following possible answer sets for ⇧p :

S1 = {s(a), q(b), r(b), q(a), r(a)}

S2 = {s(a), r(b), q(a), r(a), p(a), p(b)}

S3 = {s(a), q(b), r(b), p(a), r(a))}

c. For each Si, provide the reduct, ⇧Sip for ⇧p. [1.5p]

d. Generate Cn(⇧Sip ) for each reduct ⇧Si

1 of ⇧p. [1.5p]

e. Which of the three answer sets S1, S2, S3 are actual answer sets for ⇧p? (Explain why)[1p]

f. The consequence relation, |=, for classical logic is said to be monotonic. What does this mean? (Be preciseand succinct in your explanation) [1p]

g. Why is Answer Set Programming considered to be a nonmonotonic reasoning formalism (Be precise anduse an example)? [1p]

16

Answer: Question:Answer Sets

a. -

r1: s(a).

r2: p(a) not q(a), s(a).

r3: q(a) not p(a).

r4: r(a) p(a).

r5: r(a) q(a).

r6: p(b) not q(b), s(b).

r7: q(b) not p(b).

r8: r(b) p(b).

r9: r(b) q(b).

b. 27 = 128. Seven unique literals in the heads of the rules.

c. -

S1 = {s(a), q(b), r(b), q(a), r(a)}

S2 = {s(a), r(b), q(a), r(a), p(a), p(b)}

S3 = {s(a), q(b), r(b), p(a), r(a))}

Rule ⇧S11

r1: s(a).r2: delete

r3: q(a).r4: r(a) p(a).r5: r(a) q(a).r6: delete

r7: q(b).r8: r(b) p(b).r9: r(b) q(b).

Rule ⇧S21

r1: s(a).r2: delete.

r3: delete

r4: r(a) p(a).r5: r(a) q(a).r6: p(b) s(b).r7: delete

r8: r(b) p(b).r9: r(b) q(b).

Rule ⇧S31

r1: s(a).r2: p(a) s(a).r3: delete

r4: r(a) p(a).r5: r(a) q(a).r6: delete

r7: q(b).r8: r(b) p(b).r9: r(b) q(b).

d. -

• Cn(⇧S1p ) : {}, {s(a), q(a), q(b)}, {s(a), q(a), q(b), r(a), r(b)}

• Cn(⇧S2p ) : {}, {s(a)}

• Cn(⇧S3p ) : {}, {s(a), q(b)}, {s(a), q(b), p(a), r(b)}, {s(a), q(b), p(a), r(b), r(a)}

e. Cn(⇧S1p ) = S1, Cn(⇧S2

p ) 6= S2, Cn(⇧S3p ) = S3. S1 and S3 are answer sets.

f. Intuitively, this means that once something is proven relative to a theory, if one extends the theory,anything previously proven will still be proven in the extended theory. This is a form of locality.� |= ↵ implies that � [ �0

|= ↵.

g. ASP is considered to be a nonmonotonic formalism, because something inferable from a program ⇧, maynot be inferable when the program is extended with new rules. By inferable, we mean true in all answersets for the program ⇧. As an example ⇧ = {b not a} entails b since it has one answer set {b}. If ⇧is extended with the rule a , then b is no longer entailed since the answer set for the new programis {a}.

17

Question:Answer Sets [Total points: [8p]]

The following questions pertain to Answer Set Programming.

Assume the answer set program below ⇧1, has the following signature:

hO = {a, b},P = {p, q, r, s},V = {X}i.

Given the positive answer set program ⇧1, consisting of the following rules:

r1: s(a).

r2: p(X) not q(X), s(X).

r3: q(X) not p(X).

r4: r(X) p(X).

r5: r(X) q(X).

a. Propositionalize the answer set program ⇧1. Refer to the propositionalized version of ⇧1 as ⇧p. [1p]

b. What is the cardinality of the possible answer sets for ⇧p? Explain why. [1p]

Given the following possible answer sets for ⇧p :

S1 = {s(a), q(b), r(b), q(a), r(a)}

S2 = {s(a), r(b), q(a), r(a), p(a), p(b)}

S3 = {s(a), q(b), r(b), p(a), r(a))}

c. For each Si, provide the reduct, ⇧Sip for ⇧p. [1.5p]

d. Generate Cn(⇧Sip ) for each reduct ⇧Si

1 of ⇧p. [1.5p]

e. Which of the three answer sets S1, S2, S3 are actual answer sets for ⇧p? (Explain why)[1p]

f. The consequence relation, |=, for classical logic is said to be monotonic. What does this mean? (Be preciseand succinct in your explanation) [1p]

g. Why is Answer Set Programming considered to be a nonmonotonic reasoning formalism (Be precise anduse an example)? [1p]

16

Answer: Question:Answer Sets

a. -

r1: s(a).

r2: p(a) not q(a), s(a).

r3: q(a) not p(a).

r4: r(a) p(a).

r5: r(a) q(a).

r6: p(b) not q(b), s(b).

r7: q(b) not p(b).

r8: r(b) p(b).

r9: r(b) q(b).

b. 27 = 128. Seven unique literals in the heads of the rules.

c. -

S1 = {s(a), q(b), r(b), q(a), r(a)}

S2 = {s(a), r(b), q(a), r(a), p(a), p(b)}

S3 = {s(a), q(b), r(b), p(a), r(a))}

Rule ⇧S11

r1: s(a).r2: delete

r3: q(a).r4: r(a) p(a).r5: r(a) q(a).r6: delete

r7: q(b).r8: r(b) p(b).r9: r(b) q(b).

Rule ⇧S21

r1: s(a).r2: delete.

r3: delete

r4: r(a) p(a).r5: r(a) q(a).r6: p(b) s(b).r7: delete

r8: r(b) p(b).r9: r(b) q(b).

Rule ⇧S31

r1: s(a).r2: p(a) s(a).r3: delete

r4: r(a) p(a).r5: r(a) q(a).r6: delete

r7: q(b).r8: r(b) p(b).r9: r(b) q(b).

d. -

• Cn(⇧S1p ) : {}, {s(a), q(a), q(b)}, {s(a), q(a), q(b), r(a), r(b)}

• Cn(⇧S2p ) : {}, {s(a)}

• Cn(⇧S3p ) : {}, {s(a), q(b)}, {s(a), q(b), p(a), r(b)}, {s(a), q(b), p(a), r(b), r(a)}

e. Cn(⇧S1p ) = S1, Cn(⇧S2

p ) 6= S2, Cn(⇧S3p ) = S3. S1 and S3 are answer sets.

f. Intuitively, this means that once something is proven relative to a theory, if one extends the theory,anything previously proven will still be proven in the extended theory. This is a form of locality.� |= ↵ implies that � [ �0

|= ↵.

g. ASP is considered to be a nonmonotonic formalism, because something inferable from a program ⇧, maynot be inferable when the program is extended with new rules. By inferable, we mean true in all answersets for the program ⇧. As an example ⇧ = {b not a} entails b since it has one answer set {b}. If ⇧is extended with the rule a , then b is no longer entailed since the answer set for the new programis {a}.

17

14

Page 8: TDDC17 Fo9 SomeExamQuestions

Question:Answer Sets [Total points: [8p]]

The following questions pertain to Answer Set Programming.

Assume the answer set program below ⇧1, has the following signature:

hO = {a, b},P = {p, q, r, s},V = {X}i.

Given the positive answer set program ⇧1, consisting of the following rules:

r1: s(a).

r2: p(X) not q(X), s(X).

r3: q(X) not p(X).

r4: r(X) p(X).

r5: r(X) q(X).

a. Propositionalize the answer set program ⇧1. Refer to the propositionalized version of ⇧1 as ⇧p. [1p]

b. What is the cardinality of the possible answer sets for ⇧p? Explain why. [1p]

Given the following possible answer sets for ⇧p :

S1 = {s(a), q(b), r(b), q(a), r(a)}

S2 = {s(a), r(b), q(a), r(a), p(a), p(b)}

S3 = {s(a), q(b), r(b), p(a), r(a))}

c. For each Si, provide the reduct, ⇧Sip for ⇧p. [1.5p]

d. Generate Cn(⇧Sip ) for each reduct ⇧Si

1 of ⇧p. [1.5p]

e. Which of the three answer sets S1, S2, S3 are actual answer sets for ⇧p? (Explain why)[1p]

f. The consequence relation, |=, for classical logic is said to be monotonic. What does this mean? (Be preciseand succinct in your explanation) [1p]

g. Why is Answer Set Programming considered to be a nonmonotonic reasoning formalism (Be precise anduse an example)? [1p]

16

Answer: Question:Answer Sets

a. -

r1: s(a).

r2: p(a) not q(a), s(a).

r3: q(a) not p(a).

r4: r(a) p(a).

r5: r(a) q(a).

r6: p(b) not q(b), s(b).

r7: q(b) not p(b).

r8: r(b) p(b).

r9: r(b) q(b).

b. 27 = 128. Seven unique literals in the heads of the rules.

c. -

S1 = {s(a), q(b), r(b), q(a), r(a)}

S2 = {s(a), r(b), q(a), r(a), p(a), p(b)}

S3 = {s(a), q(b), r(b), p(a), r(a))}

Rule ⇧S11

r1: s(a).r2: delete

r3: q(a).r4: r(a) p(a).r5: r(a) q(a).r6: delete

r7: q(b).r8: r(b) p(b).r9: r(b) q(b).

Rule ⇧S21

r1: s(a).r2: delete.

r3: delete

r4: r(a) p(a).r5: r(a) q(a).r6: p(b) s(b).r7: delete

r8: r(b) p(b).r9: r(b) q(b).

Rule ⇧S31

r1: s(a).r2: p(a) s(a).r3: delete

r4: r(a) p(a).r5: r(a) q(a).r6: delete

r7: q(b).r8: r(b) p(b).r9: r(b) q(b).

d. -

• Cn(⇧S1p ) : {}, {s(a), q(a), q(b)}, {s(a), q(a), q(b), r(a), r(b)}

• Cn(⇧S2p ) : {}, {s(a)}

• Cn(⇧S3p ) : {}, {s(a), q(b)}, {s(a), q(b), p(a), r(b)}, {s(a), q(b), p(a), r(b), r(a)}

e. Cn(⇧S1p ) = S1, Cn(⇧S2

p ) 6= S2, Cn(⇧S3p ) = S3. S1 and S3 are answer sets.

f. Intuitively, this means that once something is proven relative to a theory, if one extends the theory,anything previously proven will still be proven in the extended theory. This is a form of locality.� |= ↵ implies that � [ �0

|= ↵.

g. ASP is considered to be a nonmonotonic formalism, because something inferable from a program ⇧, maynot be inferable when the program is extended with new rules. By inferable, we mean true in all answersets for the program ⇧. As an example ⇧ = {b not a} entails b since it has one answer set {b}. If ⇧is extended with the rule a , then b is no longer entailed since the answer set for the new programis {a}.

17

Question:Answer Sets [Total points: [8p]]

The following questions pertain to Answer Set Programming.

Assume the answer set program below ⇧1, has the following signature:

hO = {a, b},P = {p, q, r, s},V = {X}i.

Given the positive answer set program ⇧1, consisting of the following rules:

r1: s(a).

r2: p(X) not q(X), s(X).

r3: q(X) not p(X).

r4: r(X) p(X).

r5: r(X) q(X).

a. Propositionalize the answer set program ⇧1. Refer to the propositionalized version of ⇧1 as ⇧p. [1p]

b. What is the cardinality of the possible answer sets for ⇧p? Explain why. [1p]

Given the following possible answer sets for ⇧p :

S1 = {s(a), q(b), r(b), q(a), r(a)}

S2 = {s(a), r(b), q(a), r(a), p(a), p(b)}

S3 = {s(a), q(b), r(b), p(a), r(a))}

c. For each Si, provide the reduct, ⇧Sip for ⇧p. [1.5p]

d. Generate Cn(⇧Sip ) for each reduct ⇧Si

1 of ⇧p. [1.5p]

e. Which of the three answer sets S1, S2, S3 are actual answer sets for ⇧p? (Explain why)[1p]

f. The consequence relation, |=, for classical logic is said to be monotonic. What does this mean? (Be preciseand succinct in your explanation) [1p]

g. Why is Answer Set Programming considered to be a nonmonotonic reasoning formalism (Be precise anduse an example)? [1p]

16

Answer: Question:Answer Sets

a. -

r1: s(a).

r2: p(a) not q(a), s(a).

r3: q(a) not p(a).

r4: r(a) p(a).

r5: r(a) q(a).

r6: p(b) not q(b), s(b).

r7: q(b) not p(b).

r8: r(b) p(b).

r9: r(b) q(b).

b. 27 = 128. Seven unique literals in the heads of the rules.

c. -

S1 = {s(a), q(b), r(b), q(a), r(a)}

S2 = {s(a), r(b), q(a), r(a), p(a), p(b)}

S3 = {s(a), q(b), r(b), p(a), r(a))}

Rule ⇧S11

r1: s(a).r2: delete

r3: q(a).r4: r(a) p(a).r5: r(a) q(a).r6: delete

r7: q(b).r8: r(b) p(b).r9: r(b) q(b).

Rule ⇧S21

r1: s(a).r2: delete.

r3: delete

r4: r(a) p(a).r5: r(a) q(a).r6: p(b) s(b).r7: delete

r8: r(b) p(b).r9: r(b) q(b).

Rule ⇧S31

r1: s(a).r2: p(a) s(a).r3: delete

r4: r(a) p(a).r5: r(a) q(a).r6: delete

r7: q(b).r8: r(b) p(b).r9: r(b) q(b).

d. -

• Cn(⇧S1p ) : {}, {s(a), q(a), q(b)}, {s(a), q(a), q(b), r(a), r(b)}

• Cn(⇧S2p ) : {}, {s(a)}

• Cn(⇧S3p ) : {}, {s(a), q(b)}, {s(a), q(b), p(a), r(b)}, {s(a), q(b), p(a), r(b), r(a)}

e. Cn(⇧S1p ) = S1, Cn(⇧S2

p ) 6= S2, Cn(⇧S3p ) = S3. S1 and S3 are answer sets.

f. Intuitively, this means that once something is proven relative to a theory, if one extends the theory,anything previously proven will still be proven in the extended theory. This is a form of locality.� |= ↵ implies that � [ �0

|= ↵.

g. ASP is considered to be a nonmonotonic formalism, because something inferable from a program ⇧, maynot be inferable when the program is extended with new rules. By inferable, we mean true in all answersets for the program ⇧. As an example ⇧ = {b not a} entails b since it has one answer set {b}. If ⇧is extended with the rule a , then b is no longer entailed since the answer set for the new programis {a}.

1715