Informatics 1 Lecture 10 All Change Michael Fourman 1 A C E D - - PowerPoint PPT Presentation

informatics 1
SMART_READER_LITE
LIVE PREVIEW

Informatics 1 Lecture 10 All Change Michael Fourman 1 A C E D - - PowerPoint PPT Presentation

Informatics 1 Lecture 10 All Change Michael Fourman 1 A C E D F A B D C D F A B C B D F D E F B D F C D F B D F Make B


slide-1
SLIDE 1

Informatics 1

Lecture 10 All Change

Michael Fourman

1

slide-2
SLIDE 2

A ∨ C ∨ ¬E A ∨ B ∨ D ¬A ∨ ¬B ∨ C ¬B ∨ ¬D ∨ ¬F ¬B ∨ ¬D ∨ F ¬B ∨ D ∨ ¬F B ∨ ¬D ∨ ¬F ¬C ∨ D ∨ F ¬D ∨ E ∨ F ¬C ∨ ¬D ∨ F

¬D ∨ ¬F ¬C ∨ D ∨ F ¬D ∨ E ∨ F ¬C ∨ ¬D ∨ F

Make C false D false E F can be chosen freely make both true Make B false; A true

slide-3
SLIDE 3

A A ∨ C ∨ ¬E A ∨ B ∨ D ¬A ∨ ¬B ∨ C ¬B ∨ ¬D ∨ ¬F ¬B ∨ ¬D ∨ F ¬B ∨ D ∨ ¬F B ∨ ¬D ∨ ¬F ¬C ∨ D ∨ F ¬D ∨ E ∨ F ¬C ∨ ¬D ∨ F

slide-4
SLIDE 4

A A ∨ C ∨ ¬E A ∨ B ∨ D ¬A ∨ ¬B ∨ C ¬B ∨ ¬D ∨ ¬F ¬B ∨ ¬D ∨ F ¬B ∨ D ∨ ¬F B ∨ ¬D ∨ ¬F ¬C ∨ D ∨ F ¬D ∨ E ∨ F ¬C ∨ ¬D ∨ F

(A ∨ Γ) ∧ (¬A ∨ ∆) ∧ Ω

(Γ ∨ ∆) ∧ Ω

slide-5
SLIDE 5

A A ∨ C ∨ ¬E C ∨ ¬E ∨ ¬B ∨ C A ∨ B ∨ D B ∨ D ∨ ¬B ∨ C ¬A ∨ ¬B ∨ C ¬B ∨ ¬D ∨ ¬F ¬B ∨ ¬D ∨ F ¬B ∨ D ∨ ¬F B ∨ ¬D ∨ ¬F ¬C ∨ D ∨ F ¬D ∨ E ∨ F ¬C ∨ ¬D ∨ F

slide-6
SLIDE 6

A

AA ∨ C ∨ ¬E

C ∨ ¬E ∨ ¬B ∨ C

AA ∨ B ∨ D

B ∨ D ∨ ¬B ∨ C

A¬A ∨ ¬B ∨ C

¬B ∨ ¬D ∨ ¬F ¬B ∨ ¬D ∨ F ¬B ∨ D ∨ ¬F B ∨ ¬D ∨ ¬F ¬C ∨ D ∨ F ¬D ∨ E ∨ F ¬C ∨ ¬D ∨ F

slide-7
SLIDE 7

A C

AA ∨ C ∨ ¬E CC ∨ ¬E ∨ ¬B

D ∨ F ∨ ¬E ∨ ¬B

AA ∨ B ∨ D

B ∨ D ∨ ¬B ∨ C ¬D ∨ F ∨ ¬E ∨ ¬B

A¬A ∨ ¬B ∨ C

¬B ∨ ¬D ∨ ¬F ¬B ∨ ¬D ∨ F ¬B ∨ D ∨ ¬F B ∨ ¬D ∨ ¬F

C¬C ∨ D ∨ F

¬D ∨ E ∨ F

C¬C ∨ ¬D ∨ F

slide-8
SLIDE 8

When does resolution stop? What does a set of clauses look like when there are no

  • pportunities for resolution?

If we produce the empty clause {} by resolving {X} and {¬X}
 then the constraints are not satisfiable. If resolution stops without producing the empty clause, then every remaining literal is pure – its negation does not appear. So, we can construct a satisfying valuation. This shows that the resolution procedure is complete – if a set

  • f constraints is inconsistent we will produce the empty clause.

Otherwise we can produce a satisfying valuation.

slide-9
SLIDE 9

To produce conjunctive normal form (CNF)
 eliminate ——— 
 push negations in
 push ⋁ inside ⋀

¬(a → b) = a ∧ ¬b a ↔ b = (a → b) ∧ (b → a) a → b = ¬a ∨ b ¬(a ∨ b) = ¬a ∧ ¬b ¬(a ∨ b) = ¬a ∧ ¬b ¬0 = 1 ¬¬a = a ¬1 = 0 a ∨ 1 = 1 a ∨ (b ∧ c) = (a ∨ b) ∧ (a ∨ c) a ∧ 0 = 0 a ∨ 0 = a a ∨ ¬a = 1 a ∧ ¬a = 0 a ∧ 1 = a

↔ →

slide-10
SLIDE 10

10

slide-11
SLIDE 11

11

slide-12
SLIDE 12

12

A farmer has to get a wolf, a goose, and a sack of corn across a river. She has a boat, which can only carry her and one other thing. If the wolf and the goose are left together, the wolf will eat the goose. If the goose and the corn are left together, the goose will eat the corn.

How does she do it?

slide-13
SLIDE 13

13

❌ ❌

slide-14
SLIDE 14

14

slide-15
SLIDE 15

15

❌ ❌

GW WW CW FE

slide-16
SLIDE 16

16

GE WW CW FE

slide-17
SLIDE 17

17

GE WW CW FB

slide-18
SLIDE 18

West East

WW WB WE CW CB CE GW GB GE FW FB FE

18

We have a dozen propositions. Each proposition may be true or false. Each combination of truth values defines a state of the system.

slide-19
SLIDE 19

West East

WW WB WE CW CB CE GW GB GE FW FB FE

19

These 12 propositions allow 4096 = 212 states. Some of these are impossible - each thing can only be in one place at a time. There only 81 possible states. How do we arrive at this number? How can we use logic to specify the possible states?

slide-20
SLIDE 20

West East

WW WB WE CW CB CE GW GB GE FW FB FE

20

Some of the 81 possible states are not legal. The farmer can only take one load in the boat. How many of the possible states have at most the farmer and one load in the boat? How can we use logic to specify the legal states?

slide-21
SLIDE 21

West East

WW WB WE CW CB CE GW GB GE FW FB FE

21

Some of the legal, possible states are not safe. The farmer cannot safely leave the wolf with the goose or the goose with the corn. How many of the legal, possible states are safe? How can we use logic to specify the safe states?

slide-22
SLIDE 22

West East

WW WB WE CW CB CE GW GB GE FW FB FE

22

Once you have identified the safe, legal, possible states, you can draw a diagram showing the possible transitions from one state to another.

slide-23
SLIDE 23

West East

WW WB WE CW CB CE GW GB GE FW FB FE

23

A farmer has to get a wolf, a goose, and a sack of corn across a river. She has a boat, which can only carry her and one other thing. If the wolf and the goose are left together, the wolf will eat the goose. If the goose and the corn are left together, the chicken will eat the corn.

slide-24
SLIDE 24

24

A farmer has to get a wolf, a goose, and a sack of corn across a river. How can we use logic to specify the transitions?

WW WW WE CW CE GW FW GE FE FB CW GB WW FB CW GE WB FB CW GE WW FE CW GE WE FE CW GE WE FB CW GB WW FW CW GE WW FB CB GE

slide-25
SLIDE 25

25

How can we use propositional logic to model the jealous husbands problem? How many legal safe states are there for this problem? Can we use propositional logic to model the missionaries and cannibals problem?

slide-26
SLIDE 26

26

slide-27
SLIDE 27

West East

WW WB WE CW CB CE GW GB GE FW FB FE

27

A farmer has to get a wolf, a goose, and a sack of corn across a river. She has a boat, which can only carry her and one other thing. If the wolf and the goose are left together, the wolf will eat the goose. If the goose and the corn are left together, the chicken will eat the corn.

slide-28
SLIDE 28

28

A farmer has to get a wolf, a goose, and a sack of corn across a river. How can we use logic to specify the transitions?

www.inf.ed.ac.uk/teaching/courses/inf1/cl/FWC/

slide-29
SLIDE 29

29

A farmer has to get a wolf, a goose, and a sack of corn across a river. How can we use logic to specify the transitions?

www.inf.ed.ac.uk/teaching/courses/inf1/cl/FWC/

slide-30
SLIDE 30

30

A farmer has to get a wolf, a goose, and a sack of corn across a river. How can we use logic to specify the transitions?

www.inf.ed.ac.uk/teaching/courses/inf1/cl/FWC/

slide-31
SLIDE 31

31

A farmer has to get a wolf, a goose, and a sack of corn across a river. How can we use logic to specify the transitions?

www.inf.ed.ac.uk/teaching/courses/inf1/cl/FWC/

slide-32
SLIDE 32

32

A farmer has to get a wolf, a goose, and a sack of corn across a river. How can we use logic to specify the transitions?

www.inf.ed.ac.uk/teaching/courses/inf1/cl/FWC/

slide-33
SLIDE 33

West East

WW WB WE CW CB CE GW GB GE FW FB FE

33

(WW ⊕ WB ⊕ WE) ∧ ¬(WW ∧ WB ∧ WE) GB → FB GW ∧ (WW ∨ CW) → FW ¬(GB ∧ CB) ∧ ¬(GB ∧ WB) ∧ ¬(WB ∧ CB)

  • ne place

not solo no conflict no overload

slide-34
SLIDE 34

West East

WW WB WE CW CB CE GW GB GE FW FB FE

34

  • ne place

not solo no conflict no overload ×4 (wolf,goose,corn,farmer) ×3 (wolf,goose,corn) ×2 (east, west) ×1 (WW ⊕ WB ⊕ WE) ∧ ¬(WW ∧ WB ∧ WE) GB → FB GW ∧ (WW ∨ CW) → FW ¬(GB ∧ CB) ∧ ¬(GB ∧ WB) ∧ ¬(WB ∧ CB)

slide-35
SLIDE 35

35

A farmer has to get a wolf, a goose, and a sack of corn across a river. How can we use logic to specify the transitions?

www.inf.ed.ac.uk/teaching/courses/inf1/cl/FWC/

slide-36
SLIDE 36

36

How can we use logic to specify the transitions? This is a non-deterministic system. We define a next state relation.

www.inf.ed.ac.uk/teaching/courses/inf1/cl/FWC/

slide-37
SLIDE 37

37

How can we use logic to specify the transitions? This is a non-deterministic system. We define a next state relation. Again we introduce next state variables WW′ etc. Here we have FW ∧ WW ∧ GW ∧ CW Is it possible that WE′ ?

www.inf.ed.ac.uk/teaching/courses/inf1/cl/FWC/

slide-38
SLIDE 38

38

How can we use logic to specify the transitions? This is a non-deterministic system. We define a next state relation. We introduce next state variables WW′ etc. and give conditions on the next state. Here we have FW ∧ WW ∧ GW ∧ CW Is it possible that WE′ ? NO One thing true in our model is that WE′ → WE ∨ WB What else do we need to say to give a complete description ?

What does it mean for a description to be complete?

www.inf.ed.ac.uk/teaching/courses/inf1/cl/FWC/

slide-39
SLIDE 39

39

How can we use logic to specify the transitions? This is a non-deterministic system. We define a next state relation. We introduce next state variables WW′ etc. and give conditions on the next state. We require: FE′ → FE ∨ FB WE′ → WE ∨ WB GE′ → GE ∨ GB CE′ → CE ∨ CB

What does it mean for a description to be complete?

www.inf.ed.ac.uk/teaching/courses/inf1/cl/FWC/

FW′ → FW ∨ FB WW′ → WW ∨ WB GW′ → GW ∨ GB CW′ → CW ∨ CB

There is a transition between a pair of states iff these conditions are satisfied