Danny King (kxrs26): Automated Reasoning

Report 4 Downloads 82 Views
0

Danny King (kxrs26): Automated Reasoning

Page 1 of 6

04/02/2012

Danny King (kxrs26): Automated Reasoning 1.

Apply resolution to prove that ¬𝒑 is a logical consequence of the following set of propositional formulas 𝝋 = {𝒑 β†’ ((𝒒 ∨ 𝒓) ∧ Β¬(𝒒 ∧ 𝒓)), 𝒑 β†’ ((𝒔 ∨ 𝒕 ) ∧ Β¬(𝒔 ∧ 𝒕)), 𝒔 β†’ 𝒒, ¬𝒓 β†’ 𝒕, 𝒕 β†’ 𝒔}.

A formula is a logical consequence of an axiom set if and only if the union of the negation of that formula with the axiom set is unsatisfiable. More concisely; If 𝝋 βˆͺ {𝒑} is unsatisfiable then {¬𝒑} is a logical consequence of 𝝋. First, each formula must be converted into conjunctive normal form. Let 𝑨 = 𝒑 β†’ ((𝒒 ∨ 𝒓) ∧ Β¬(𝒒 ∧ 𝒓)) ≑ ¬𝒑 ∨ ((𝒒 ∨ 𝒓) ∧ Β¬(𝒒 ∧ 𝒓)) ≑ ¬𝒑 ∨ ((𝒒 ∨ 𝒓) ∧ (¬𝒒 ∨ ¬𝒓)) ≑ ¬𝒑 ∨ 𝒒 ∨ 𝒓 ∧ ¬𝒑 ∨ (¬𝒒 ∨ ¬𝒓) ≑ (¬𝒑 ∨ 𝒒 ∨ 𝒓 ∧ (¬𝒑 ∨ ¬𝒒 ∨ ¬𝒓)

Let π‘ͺ = 𝒔 β†’ 𝒒 ≑ ¬𝒔 ∨ 𝒒

Let 𝑩 = 𝒑 β†’

Let 𝑬 = 𝒕 β†’ 𝒔 ≑ ¬𝒕 ∨ 𝒔

Let 𝑫 = ¬𝒓 β†’ 𝒕 ≑ π’“βˆ¨π’•

𝒔 ∨ 𝒕 ∧¬ 𝒔 βˆ§π’•

≑ ¬𝒑 ∨ 𝒔 ∨ 𝒕 ∧ Β¬ 𝒔 ∧ 𝒕 ≑ ¬𝒑 ∨ ((𝒔 ∨ 𝒕) ∧ (¬𝒔 ∨ ¬𝒕)) ≑ ¬𝒑 ∨ 𝒔 ∨ 𝒕 ∧ ¬𝒑 ∨ (¬𝒔 ∨ ¬𝒕) ≑ (¬𝒑 ∨ 𝒔 ∨ 𝒕 ∧ (¬𝒑 ∨ ¬𝒔 ∨ ¬𝒕)

So 𝝋 βˆͺ {𝒑} can be expressed as the following clause set:

𝝋 βˆͺ {𝒑} = { 𝒑, 𝒒, 𝒓 , 𝒑, 𝒒, 𝒓 , 𝒑, 𝒔, 𝒕 , 𝒑, 𝒔, 𝒕 , 𝒔, 𝒒 , 𝒓, 𝒕 , 𝒕, 𝒔 , {𝐩}}

Applying resolution on the first two clauses we can obtain ¬𝒑:

𝒑, 𝒒, 𝒓 , {𝒑, 𝒒, 𝒓} ¬𝒑

Applying resolution on the last clause and on the resulting ¬𝒑 from the previous resolution step we obtain the empty set. 𝒑, ¬𝒑

Hence 𝝋 βˆͺ 𝒑 is unsatisfiable and therefore ¬𝒑 is a logical consequence of 𝝋.

Danny King (undergraduate of Computer Science at Durham University) [email protected] www.dannyking.eu

Danny King (kxrs26): Automated Reasoning

0

Page 2 of 6

04/02/2012

2a. Consider the following clause-set F and select appropriate polynomial-time algorithms to decide whether it is renamable Horn.

𝑭 = {{¬𝒙, π’š, ¬𝒖}. {¬𝒕, 𝒛}, {Β¬π’š, 𝒛, 𝒕}, {𝒖}, {𝒙, π’š, 𝒛}, {¬𝒛, ¬𝒖}}

Unit propagation on 𝑭 has no effect because it contains no unit clauses so first we must define a clause set 𝑭′ consisting of all clauses 𝒍, π’Ž in 𝑭 such that the literals 𝒍 and π’Ž are contained in a clause in 𝑭.

𝑭′ = { 𝒙, π’š , 𝒙, 𝒖 , π’š, 𝒖 , 𝒕, 𝒛 , π’š, 𝒛 , π’š, 𝒕 , 𝒛, 𝒕 , 𝒙, π’š , 𝒙, 𝒛 , π’š, 𝒛 , 𝒛, 𝒖 }

𝑭 is renamable Horn if and only if 𝑭′ is satisfiable. Since 𝑭′ is an instance of 2-SAT it is therefore possible to determine in polynomial time whether it is satisfiable and hence to determine whether 𝑭 is renamable Horn in polynomial time. We can construct a directed graph 𝑫(𝑭′ ) where the nodes of 𝑫(𝑭′ ) are all literals occurring in 𝑭′ and where there is an edge between nodes 𝒍 and π’Ž if and only if 𝑭′ contains the clause 𝒍, π’Ž . Consider 𝑫(𝑭′ ) (figure 1). 𝑭′ is unsatisfiable if and only if there exists a variable 𝒙 of 𝑭′ such that 𝑫(𝑭′ ) contains a directed path from 𝒙 to 𝒙 and a directed path from 𝒙 to 𝒙. If for all variables in 𝑭′ this is not possible then 𝑭′ is satisfiable and therefore 𝑭 would be renable Horn. Note that directed paths between two nodes can be found in polynomial time and that there are πŸπ’ paths to be checked, hence we have a polynomial-time algorithm for 2-SAT. Figure 2 shows the edges reachable from each node in 𝑫(𝑭′ ). For each node π’Š ∈ {𝒙, π’š, 𝒛, 𝒕} there is no path to π’Š. For the node 𝒖, there is a path to 𝒖, however there is no path from 𝒖 to 𝒖. Therefore there is no path from any variable of 𝑭′ to its complement and back again and hence, 𝑭 is renamable Horn.

Figure1: 𝑫(𝑭′ ). Danny King (undergraduate of Computer Science at Durham University) [email protected] www.dannyking.eu

Danny King (kxrs26): Automated Reasoning

0

04/02/2012

Figure 2: edges reachable from each positive literal in 𝑫(𝑭′ ). Danny King (undergraduate of Computer Science at Durham University) [email protected] www.dannyking.eu

Page 3 of 6

0

Danny King (kxrs26): Automated Reasoning

Page 4 of 6

04/02/2012

2b. Consider the same clause-set F and select appropriate polynomial-time algorithms to decide whether it is satisfiable.

To determine whether a formula is satisfiable using a polynomial-time algorithm we must first rename it Horn as the satisfiability of a formula consisting only of horn clauses can be checked in polynomial-time using only unit propagation (UP). In the case of F, we only need to apply UP exhaustivly to determine satisfiability which only takes polynomial time. Consider 𝑭: 𝑭 = {{¬𝒙, π’š, ¬𝒖}. {¬𝒕, 𝒛}, {Β¬π’š, 𝒛, 𝒕}, {𝒖}, {𝒙, π’š, 𝒛}, {¬𝒛, ¬𝒖}}

All clauses in 𝑭 are Horn except for {Β¬π’š, 𝒛, 𝒕} and {𝒙, π’š, 𝒛}. Renaming 𝒛 to 𝒛 and 𝒛 to 𝒛 results in:

𝑭′ = {{¬𝒙, π’š, ¬𝒖}. {¬𝒕, ¬𝒛}, {Β¬π’š, ¬𝒛, 𝒕}, {𝒖}, {𝒙, π’š, ¬𝒛}, {𝒛, ¬𝒖}}

All clauses in 𝑭′ are Horn except for {𝒙, π’š, ¬𝒛}. Renaming π’š to π’š and π’š to π’š results in:

𝑭′′ = {{¬𝒙, Β¬π’š, ¬𝒖}. {¬𝒕, ¬𝒛}, {π’š, ¬𝒛, 𝒕}, {𝒖}, {𝒙, Β¬π’š, ¬𝒛}, {𝒛, ¬𝒖}}

All clauses in 𝑭′′ are Horn except for {π’š, ¬𝒛, 𝒕}. Renaming 𝒕 to 𝒕 and 𝒕 to 𝒕 results in:

𝑭′′′ = {{¬𝒙, Β¬π’š, ¬𝒖}. {𝒕, ¬𝒛}, {π’š, ¬𝒛, ¬𝒕}, {𝒖}, {𝒙, Β¬π’š, ¬𝒛}, {𝒛, ¬𝒖}}

All clauses in 𝑭′′′ are Horn clauses. As there are no pure literals in 𝑭′′′ we need only to apply exhaustive application of unit propagation to determine whether it is satisfiable because unit propagation will never result in a new pure literal. π‘ˆπ‘ƒ 𝑭′′′ = {{¬𝒙, Β¬π’š}. {𝒕, ¬𝒛}, {π’š, ¬𝒛, ¬𝒕}, {𝒙, Β¬π’š, ¬𝒛}, {𝒛}} π‘ˆπ‘ƒ π‘ˆπ‘ƒ 𝑭′′′

= {{¬𝒙, Β¬π’š}. {𝒕}, {π’š, ¬𝒕}, {𝒙, Β¬π’š}}

π‘ˆπ‘ƒ π‘ˆπ‘ƒ π‘ˆπ‘ƒ 𝑭′′′

= {{¬𝒙, Β¬π’š}, {π’š}, {𝒙, Β¬π’š}}

π‘ˆπ‘ƒ π‘ˆπ‘ƒ π‘ˆπ‘ƒ π‘ˆπ‘ƒ 𝑭′′′ π‘ˆπ‘ƒ π‘ˆπ‘ƒ π‘ˆπ‘ƒ π‘ˆπ‘ƒ π‘ˆπ‘ƒ 𝑭′′′

= {{¬𝒙}, {𝒙}} = {{

}}

Exhaustive application of unit propagation has resulted in the empty clause and therefore 𝑭 is unsatisfiable. A renamable Horn clause-set (i.e. F) is unsatisfiable if and only if F |-UR

Danny King (undergraduate of Computer Science at Durham University) [email protected] www.dannyking.eu

.

Danny King (kxrs26): Automated Reasoning

0

Page 5 of 6

04/02/2012

3.

Recall that PL and UP denote the result of exhaustive application of pure literal elimination and unit propagation, respectively. Give an example of a clause-set F such that 𝑷𝑳(𝑼𝑷(𝑷𝑳(𝑭))) β‰  𝑼𝑷(𝑷𝑳(𝑭)), with full justification.

Consider the clause set 𝑭:

𝑭 = {{𝒑, 𝒒}, {𝒑, 𝒒, 𝒓, 𝒔}, {𝒓, 𝒔}, {𝒔}, {𝒑, 𝒒, 𝒓, 𝒔, 𝒕}} 𝑭′ = 𝑃𝐿 𝑭 = {{𝒑, 𝒒}, {𝒑, 𝒒, 𝒓, 𝒔}, {𝒓, 𝒔}, {𝒔}} 𝑭′′ = π‘ˆπ‘ƒ(𝑃𝐿(𝑭)) = {{𝒑, 𝒒}, {𝒑, 𝒒, 𝒓}} 𝑭′′′ = 𝑃𝐿(π‘ˆπ‘ƒ(𝑃𝐿(𝑭))) = {{𝒑, 𝒒}}

This provides an example of where 𝑃𝐿(π‘ˆπ‘ƒ(𝑃𝐿(𝑭))) β‰  π‘ˆπ‘ƒ(𝑃𝐿(𝑭)) as 𝑭′′′ β‰  𝑭′′. Notice that unit propagation on a clause 𝝋 only has an effect when 𝝋 contains a unit clause. Also notice that pure literal elimination only removes clauses (not literals) and therefore can never cause new unit clauses to appear in 𝝋′ = 𝑃𝐿(𝝋). Unit propagation can however cause pure literals to appear in 𝝋′ = π‘ˆπ‘ƒ(𝝋) because it can both lead to clause and literal removal in 𝝋. In the given example, in 𝑭′′, unit propagation had caused 𝒓 to become a pure literal and so in the final step, pure literal elimination resulting in 𝑭′′′, the clause containing 𝒓 was removed.

4. Transform the following FO formula into clausal normal form. (Here R, S are predicate symbols, 𝒇 is a function symbol, and x, y, z are variables.) Show all steps in your computation.

𝑭 = βˆƒπ’™βˆ€π’šβˆƒπ’›[𝑹(𝒙, π’š) β†’ βˆ€π’™βˆƒπ’š(𝑺(𝒙, π’š) ∧ 𝑹(π’š, 𝒇(𝒛)))] = βˆƒπ’™βˆ€π’šβˆƒπ’›[¬𝑹(𝒙, π’š) ∨ βˆ€π’™βˆƒπ’š(𝑺(𝒙, π’š) ∧ 𝑹(π’š, 𝒇(𝒛)))] (Implication removed) = βˆƒπ’™βˆ€π’šβˆƒπ’›[¬𝑹 𝒙, π’š ∨ βˆ€π’‚βˆƒπ’ƒ(𝑺(𝒂, 𝒃) ∧ 𝑹(𝒃, 𝒇(𝒛)))] (Renamed inner bound variables: π‘₯ to π‘Ž and 𝑦 to 𝑏) = βˆƒπ’™βˆ€π’šβˆƒπ’›βˆ€π’‚βˆƒπ’ƒ[¬𝑹 𝒙, π’š ∨ (𝑺(𝒂, 𝒃) ∧ 𝑹(𝒃, 𝒇(𝒛)))] (Moved inner quantifiers outward) = βˆ€π’šβˆ€π’‚[¬𝑹 𝒄, π’š ∨ (𝑺(𝒂, π’ˆ(π’š, 𝒂)) ∧ 𝑹(π’ˆ(π’š, 𝒂), 𝒇(𝒉(π’š)))] (Skolemised: 𝒙 becomes the constant 𝒄, 𝒛 becomes 𝒉(π’š) and 𝒃 becomes π’ˆ(π’š, 𝒂).)

= βˆ€π’šβˆ€π’‚[(¬𝑹(𝒄, π’š) ∨ 𝑺(𝒂, π’ˆ(π’š, 𝒂))) ∧ (¬𝑹(𝒄, π’š) ∨ 𝑹(π’ˆ(π’š, 𝒂), 𝒇(𝒉(π’š))))] (Converted to conjunctive normal form)

= {{¬𝑹(𝒄, π’š), 𝑺(𝒂, π’ˆ(π’š, 𝒂)}, {¬𝑹(𝒄, π’š), 𝑹(π’ˆ(π’š, 𝒂), 𝒇(𝒉(π’š)))}} (Converted to clausal normal form)

Danny King (undergraduate of Computer Science at Durham University) [email protected] www.dannyking.eu

Danny King (kxrs26): Automated Reasoning

0

Page 6 of 6

04/02/2012

5. Give a closed semantic tree for the following FO clause-set where S; T are predicate symbols, f is a function symbol, a is a constant, and x, y are variables.) Explain your construction.

𝑭 = {{𝑻(𝒇(𝒙))}, {𝑺(𝒙, 𝒇(𝒂) ), ¬𝑻(π’š)}, {¬𝑺(𝒂, π’š)}} We construct a semantic tree from the ground atoms of 𝑭 where each node 𝑛 has exactly 0 or 2 complimentary ground atoms as children. Also, the child nodes of 𝑛 do not belong to a lower level of the Herband universe than 𝑛 and each path from the root node to 𝑛 (i.e. each Herbrand interpretation) contains no complementary pair of ground atoms. The tree is a closed semantic tree if each branch terminates at a failure vertex, i.e. the nodes on the path from the root to each leaf node falsifies a ground instance of a clause in 𝑭.

𝑯𝒆𝒓𝒃𝒓𝒂𝒏𝒅 π‘Όπ’π’Šπ’—π’†π’“π’”π’† 𝒐𝒇 𝑭 = {𝒂, 𝒇(𝒂), 𝒇(𝒇(𝒂) ), 𝒇(𝒇(𝒇(𝒂) ) ), … } 𝑯𝒆𝒓𝒃𝒓𝒂𝒏𝒅 𝑩𝒂𝒔𝒆 𝒐𝒇 𝑭 = {𝑻(𝒂), 𝑺(𝒂, 𝒂), 𝑺(𝒇(𝒂), 𝒂), 𝑺(𝒂, 𝒇(𝒂)), 𝑺(𝒇(𝒂), 𝒇(𝒂)), 𝑻(𝒇(𝒂)), … } π‘¬π’™π’‚π’Žπ’‘π’π’†π’” 𝒐𝒇 π’ˆπ’“π’π’–π’π’… π’Šπ’π’”π’•π’‚π’π’„π’†π’” 𝒐𝒇 𝒄𝒍𝒂𝒖𝒔𝒆𝒔 π’Šπ’ 𝑭 = {𝑻 𝒂 , 𝑻(𝒇(𝒂), 𝒔(𝒂, 𝒂), 𝒔(𝒂, 𝒇(𝒂) ), … }

Figure 3: Closed semantic tree for 𝑭.

The two leaves labelled 𝑺(𝒂, 𝒂) falsify the ground instance {¬𝑺(𝒂, 𝒂)}} of the third clause in 𝑭: {¬𝑺(𝒂, π’š)}}. The two leaves labelled¬𝑻(𝒇(𝒂)) falsify the ground instance {𝑻(𝒇(𝒂))} of the first clause in 𝑭: {𝑻(𝒇(𝒙)}. The two leaves labelled 𝑺(𝒂, 𝒇(𝒂)) falsify ground instance {¬𝑺(𝒂, 𝒇(𝒂))}} of the third clause in 𝑭: {¬𝑺(𝒂, π’š)}}. The two leaves labelled ¬𝑺(𝒂, 𝒇(𝒂)) falsify ground instance {𝑺(𝒂, 𝒇(𝒂)), ¬𝑻(𝒂)}} of the third clause in 𝑭: {¬𝑺(𝒂, π’š)}}.

Danny King (undergraduate of Computer Science at Durham University) [email protected] www.dannyking.eu