Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Tutorial on Satisfiability and Resolution in Informatics 1 - Computation & Logic, Schemes and Mind Maps of Logic

A tutorial on satisfiability and resolution for Informatics 1 - Computation & Logic. It includes information on entailment, state transitions for a traffic light system, and modifications to the ATM PIN-checking section. Students are expected to attempt the homework and bring their work to the tutorial.

What you will learn

  • How can resolution be used to determine the validity of an entailment?
  • What is the meaning of entailment in the context of this tutorial?
  • What are the legal state transitions for the extended traffic light system with a car presence sensor?

Typology: Schemes and Mind Maps

2021/2022

Uploaded on 09/27/2022

mrbean3
mrbean3 🇬🇧

4

(5)

214 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Informatics 1 - Computation & Logic:
Tutorial 5 v:1.10 28th October 2017 23:01:07
Satisfiability and Resolution
Week 7: 30 October–3 November 2017
Please attempt the entire worksheet in advance of the tutorial, and bring
all work with you. Tutorials cannot function properly unless you study
the material in advance. Attendance at tutorials is obligatory; please let
the ITO know if you cannot attend.
You may work with others, indeed you should do so; but you must develop
your own understanding; you can’t phone a friend during the exam. If
you do not master the coursework you are unlikely to pass the exams.
We say that Γ|= iff every state that satisfies every expression in Γsatisfies at least
one expression in . In particular, |= (the LHS is empty) iff Wis a tautology,
and Σ|=(the RHS is empty) iff Σis not satisfiable.
We represent a state as (the conjunction of) the set Vof literals true in that state.
For any formula φeither V|=φor V|=¬φ as Vmakes φeither true or false.
So, Γ|= iff for all states V.
(for all ϕΓ. V |=ϕ)(for some ψ. V |=ψ)
Γ6|= iff there is a counterexample Vsuch that
(for all ϕΓ. V |=ϕ)and, (for all ψ. V |=¬ψ)
Homework
1. Which of the following statements are true?
In each false case give a counterexample (specify values for Γ,that make one
entailment valid, then give values for ϕ, ψ that show the other is invalid).
(a) Γ|= , ϕ iff Γ,¬ϕ|=
(b) Γ|= ,¬ϕiff Γ, ϕ |=
(c) Γ|= , ϕ ψiff Γ|= , ϕ, ψ
(d) Γ|= , ϕ ψiff Γ|= , ϕ, ψ
(e) Γ, ϕ ψ|= iff Γ, ϕ, ψ |=
(f) Γ, ϕ ψ|= iff Γ, ϕ, ψ |=
1
pf3
pf4
pf5

Partial preview of the text

Download Tutorial on Satisfiability and Resolution in Informatics 1 - Computation & Logic and more Schemes and Mind Maps Logic in PDF only on Docsity!

Informatics 1 - Computation & Logic:

Tutorial 5 v:1.10 28th October 2017 23:01:

Satisfiability and Resolution

Week 7: 30 October–3 November 2017

Please attempt the entire worksheet in advance of the tutorial, and bring all work with you. Tutorials cannot function properly unless you study the material in advance. Attendance at tutorials is obligatory; please let the ITO know if you cannot attend. You may work with others, indeed you should do so; but you must develop your own understanding; you can’t phone a friend during the exam. If you do not master the coursework you are unlikely to pass the exams.

We say that Γ |= ∆ iff every state that satisfies every expression in Γ satisfies at least one expression in ∆. In particular, |= ∆ (the LHS is empty) iff

∆ is a tautology, and Σ |= (the RHS is empty) iff Σ is not satisfiable. We represent a state as (the conjunction of) the set V of literals true in that state. For any formula φ either V |= φ or V |= ¬φ — as V makes φ either true or false.

So, Γ |= ∆ iff for all states V. ( (for all ϕ ∈ Γ. V |= ϕ) ⇒ (for some ψ ∈ ∆. V |= ψ)

Γ 6 |= ∆ iff there is a counterexample V such that (for all ϕ ∈ Γ. V |= ϕ) and, (for all ψ ∈ ∆. V |= ¬ψ)

Homework

  1. Which of the following statements are true? In each false case give a counterexample (specify values for Γ, ∆ that make one entailment valid, then give values for ϕ, ψ that show the other is invalid).

(a) Γ |= ∆, ϕ iff Γ, ¬ϕ |= ∆ (b) Γ |= ∆, ¬ϕ iff Γ, ϕ |= ∆ (c) Γ |= ∆, ϕ ∧ ψ iff Γ |= ∆, ϕ, ψ (d) Γ |= ∆, ϕ ∨ ψ iff Γ |= ∆, ϕ, ψ (e) Γ, ϕ ∨ ψ |= ∆ iff Γ, ϕ, ψ |= ∆ (f) Γ, ϕ ∧ ψ |= ∆ iff Γ, ϕ, ψ |= ∆

You should have found that 1(a) is true: Γ |= ∆, ϕ iff Γ, ¬ϕ |= ∆. For example (in this example ∆ = ∅),

D → (A ∨ B), E ∨ (C? ¬A : B), (B? E → D : C ∨ E) |= (D ∧ C) → (B ∨ E) iff D → (A ∨ B), E ∨ (C? ¬A : B), (B? E → D : C ∨ E), ¬

(D ∧ C) → (B ∨ E)

In general, if we write ∆¬^ for {¬ψ | ψ ∈ ∆}, Γ |= ∆ iff Γ, ∆¬^ |= This means that, Γ |= ∆ iff Γ, ∆¬^ is inconsistent.

Resolution is a procedure used to search for a state that satisfies a given set of constraints, Σ. If there is no state satisfying Σ — which means that Σ is inconsistent — then resolution will produce the empty clause.

So, we can test whether Γ |= ∆ by converting Σ = Γ, ∆¬^ to CNF and then using resolution. If resolution of Σ produces the empty clause then the entailment is valid; otherwise a satisfying valuation for Σ provides a counterexample to the entailment.

In the examples below there is only one conclusion — ∆ is a singleton.

  1. Use resolution to determine whether the following entailment is valid.

A → (B ∨ C), ¬D → ¬(B ∧ C) |= A → D

(a) First convert each assumption and the negation of each conclusion to clausal form. i. A → (B ∨ C) ii. ¬D → ¬(B ∧ C) iii. ¬(A → D) (b) Check whether this set of constraints is consistent:

Entailment

Γ |= ∆ iff for all states V. ( (for all ϕ ∈ Γ. V |= ϕ) ⇒ (for some ψ ∈ ∆. V |= ψ)

Γ 6 |= ∆ iff there is a counterexample V such that (for all ϕ ∈ Γ. V |= ϕ) and, (for all ψ ∈ ∆. V |= ¬ψ)

We will normally omit the set-brackets {}, and other set-notation, when writing entailments. For example, if ϕ, ψ, θ are expressions, we write

Γ |= ϕ for Γ |= {ϕ} Γ, θ |= ϕ, ψ for Γ ∪ {θ} |= {ϕ, ψ}

Now consider what this definition of |= means in some special cases.

  • The case where ∆ is empty. Γ |= (Γ |= ∅) means that the conjunction

Γ of all expressions in Γ is contradictory.

  • The case where Γ is empty. |= ∆ (∅ |= ∆) means that the disjunction

∆ of all expressions in ∆ is a tautology.

  • The case in which Γ is a non-contradictory set of literals. A non-contradictory set of literals determines a truth valuation of the atoms it mentions. In this case, Γ |= ϕ means that the valuation determined by

Γ makes ϕ true.

  • If both Γ and ∆ are sets of literals, and Γ is non-contradictory, we can view Γ as representing a valuation V and ∆ as representing a clause Γ |= ∆ iff Γ ∩ ∆ is non-empty: (Γ ∩ ∆ 6 = ∅), which means that V satisfies ∆.

Tutorial Activity

  1. As usual, you should start by working as a group to identify and resolve any problems with the homework.
  2. Consider the simple Traffic Light, introduced in class, with a cycle of four states. The four legal states of the light are captured by the four states of the variables R, A representing the red and amber lights. The Green light is on only in the state represented by ¬R ∧ ¬A. In this question, you will extend the model by adding one more state variable C, representing the presence of a car – there is normally a sensor in the road that indicates a car is passing or waiting at the light, C could be the output of this sensor. The new system will have eight states – each each legal state of the lights, with a car present C or absent ¬C.

(a) Assume that the lights cycle through the proper sequence, and that cars always obey the traffic regulations, draw a diagram of the legal state tran- sitions. Give a logical description of the legal transitions. (b) Can you remove some transitions to describe a system in which the lights will not change to green unless there is a car waiting? Give a logical description of the transitions you allow. (c) How might you model an intersection with two pairs of lights? What should be the states of this system? What conditions on the states and transitions do we need to specify a safe and efficient system?

  1. Modify the PIN-checking section of the ATM to allow more than one attempt to enter the PIN. Your machine should retain the card after three wrong PIN entries.

current

next

R A G R^0 A^0 G^0 5

A

D

B

C

current

next

A B C D B C D A

ATM

£

ok? yes

choose a/c

balance

withdraw

insert card

wrong PIN PIN ok

take money amount no

return card

return card

4

withdraw

This tutorial exercise sheet was written by Dave Cochran and Michael Fourman, draw- ing on material from an earlier tutorials produced by Paolo Besana, Thomas French, and Areti Manataki. Send comments to Michael.Fourman@ed.ac.uk