knights, spies, games and social networksuvah099/talks/kstalk.pdf · the spider interrogation...

45
Knights, Spies, Games and Social Networks Mark Wildon 16 February 2010

Upload: others

Post on 26-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Knights, Spies, Games and Social Networks

Mark Wildon

16 February 2010

Page 2: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

The Knights and Spies Problem

In a room there are 100 people.

I Each person is either a knight or a spy.

I Knights always tell the truth, but spies may lie ortell the truth as they see fit.

I Everyone in the room knows the identity of everyone else.

I Knights are in a strict majority.

Asking only questions of the form

‘Person i , what is the identity of person j?’

what is the least number of questions that will guarantee to findeveryone’s true identity?

Page 3: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

The Knights and Spies Problem

In a room there are 100 people.

I Each person is either a knight or a spy.

I Knights always tell the truth, but spies may lie ortell the truth as they see fit.

I Everyone in the room knows the identity of everyone else.

I Knights are in a strict majority.

Asking only questions of the form

‘Person i , what is the identity of person j?’

what is the least number of questions that will guarantee to findeveryone’s true identity?

Page 4: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Outline

1. Questioning strategiesI Can it be done at all?I Pairing Up: 200 questions sufficeI Spider Interrogation Strategy: 148 questions suffice

2. A two-player gameI 148 questions may be necessary in the worst case

3. Open problems and speculative applicationsI Public key distribution in public key cryptographyI Building networks of reputable companies

Page 5: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Section 1: A Simple Questioning Strategy

If we ask the other 99 people in the room about person 1, then themajority opinion is correct.

And everyone expressing the minority opinion is a spy.

But if person 1 turns out to be a spy, then we may not havemade much progress. Proceeding in this way could require 2500questions.

Page 6: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Section 1: A Simple Questioning Strategy

If we ask the other 99 people in the room about person 1, then themajority opinion is correct.

And everyone expressing the minority opinion is a spy.

But if person 1 turns out to be a spy, then we may not havemade much progress. Proceeding in this way could require 2500questions.

Page 7: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Section 1: A Simple Questioning Strategy

If we ask the other 99 people in the room about person 1, then themajority opinion is correct.

And everyone expressing the minority opinion is a spy.

But if person 1 turns out to be a spy, then we may not havemade much progress. Proceeding in this way could require 2500questions.

Page 8: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Pairing Up

Generalize: n people in the room

1. Put people into pairs, with one singleton if n is odd. Ask eachmember of the pair about the other.

S1 S2 S3 K4

K5 K6 S7 K8

K9 K10 K11 S12

Page 9: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Pairing Up

2. Keep the pairs whose members support one another andignore the rest. Choose a leader from each supportive pair.

S1 S2 S3 K4

K5 K6 S7 K8

K9 K10 K11 S12

Page 10: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Pairing Up

3. Repeat the first step by pairing up leaders, until only oneperson is left.

S1 S2 S3 K4

K5 K6 S7 K8

K9 K10 K11 S12

Page 11: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Pairing Up

4. The final leader is a knight.

S1 S2 S3 K4

K5 K6 S7 K8

K9 K10 K11 S12

Page 12: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Pairing Up

5. Use the final leader as an oracle to find all the identities thatremain ambiguous.

S1 S2 S3 K4

K5 K6 S7 K8

K9 K10 K11 S12

Page 13: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Pairing Up Uses O(n) Questions

ClaimThe final leader found byPairing Up is always a knight.This strategy uses at most 2nquestions to find all identitiesin a room with n people.

Proof.By induction on n. If after thefirst pairing up stage there arep pairs, then we are done after

n + 2p + (n − 2p) = 2n

questions.

Page 14: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Pairing Up Uses O(n) Questions

ClaimThe final leader found byPairing Up is always a knight.This strategy uses at most 2nquestions to find all identitiesin a room with n people.

Proof.By induction on n. If after thefirst pairing up stage there arep pairs, then we are done after

n + 2p + (n − 2p) = 2n

questions.

Page 15: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

The Spider Interrogation Strategy

Form spiders, rejecting candidates as soon as they are accusedmore often than they are supported.

Example room with 21 people: S1,S2,K3,K4, . . .

Choose the spy S1 as first candidate.

S1S2

1

Page 16: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

The Spider Interrogation Strategy

Form spiders, rejecting candidates as soon as they are accusedmore often than they are supported.

Example room with 21 people: S1,S2,K3,K4, . . .

Choose the spy S1 as first candidate.

S1S2

K3

1

2

Page 17: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

The Spider Interrogation Strategy

Form spiders, rejecting candidates as soon as they are accusedmore often than they are supported.

Example room with 21 people: S1,S2,K3,K4, . . .

The spy S1 is rejected after 3 questions.

S1S2

K3

K4

1

2

3

Page 18: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

The Spider Interrogation StrategyCandidates are accepted according to a (varying) threshold forsupport. After S1, K5 and S13 are rejected, K15 is accepted.

K5

K6S7

K8

K9

S10

S11

S12

S1S2

K3

K4

S13

K14

K15

K16

S17S18

K19

K20

S21

12

3

4

6

7

58

9

10

11

12

13

14

15

Page 19: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

The Spider Interrogation StrategyCandidates are accepted according to a (varying) threshold forsupport. After S1, K5 and S13 are rejected, K15 is accepted.

K5

K6S7

K8

K9

S10

S11

S12

S1S2

K3

K4

S13

K14

K15

K16

S17S18

K19

K20

S21

Page 20: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

The Spider Interrogation StrategyUse the successful candidate to identify the rejected candidates,and those not yet involved in proceedings. Then identify peoplewithin spiders.

K5

K6S7

K8

K9

S10

S11

S12

S1S2

K3

K4

S13

K14

K15

K16

S17S18

K19

K20

S21

Page 21: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

The Spider Interrogation StrategyUse the successful candidate to identify the rejected candidates,and those not yet involved in proceedings. Then identify peoplewithin spiders.

K5

K6S7

K8

K9

S10

S11

S12

S1S2

K3

K4

S13

K14

K15

K16

S17S18

K19

K20

S21

Page 22: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

The Spider Interrogation StrategyThe Spider Interrogation Strategy uses < 3n/2 questions in an nperson room, no matter how the spies behave.

K5

K6S7

K8

K9

S10

S11

S12

S1S2

K3

K4

S13

K14

K15

K16

S17S18

K19

K20

S21

Page 23: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Section 2: A Two-Player GameIn the game of Knights and Spies, an Interrogator plays against aSpy Master.

I The Interrogator decides which questions to ask.

I The Spy Master supplies the answers, and (indirectly)determines who is a spy.

Let

f (n) =

{3m − 3 if n = 2m − 1

3m − 2 if n = 2m

If the Interrogator can be certain of everyone’s identity after asking< f (n) questions, then he wins. If exactly f (n) questions areneeded, the game is drawn. Otherwise the Spy Master wins.

If all consistent interpretations of the Spy Master’s answers requirespies to be in the majority, the Spy Master forfeits the game. Theprogram GameChecker.hs can be used to referee games.

Page 24: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Section 2: A Two-Player GameIn the game of Knights and Spies, an Interrogator plays against aSpy Master.

I The Interrogator decides which questions to ask.

I The Spy Master supplies the answers, and (indirectly)determines who is a spy.

Let

f (n) =

{3m − 3 if n = 2m − 1

3m − 2 if n = 2m

If the Interrogator can be certain of everyone’s identity after asking< f (n) questions, then he wins. If exactly f (n) questions areneeded, the game is drawn. Otherwise the Spy Master wins.

If all consistent interpretations of the Spy Master’s answers requirespies to be in the majority, the Spy Master forfeits the game. Theprogram GameChecker.hs can be used to referee games.

Page 25: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Section 2: A Two-Player GameIn the game of Knights and Spies, an Interrogator plays against aSpy Master.

I The Interrogator decides which questions to ask.

I The Spy Master supplies the answers, and (indirectly)determines who is a spy.

Let

f (n) =

{3m − 3 if n = 2m − 1

3m − 2 if n = 2m

If the Interrogator can be certain of everyone’s identity after asking< f (n) questions, then he wins. If exactly f (n) questions areneeded, the game is drawn. Otherwise the Spy Master wins.

If all consistent interpretations of the Spy Master’s answers requirespies to be in the majority, the Spy Master forfeits the game. Theprogram GameChecker.hs can be used to referee games.

Page 26: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

An Optimal Strategy for the Spy Master

Answer the first n/2− 2 questions with blanket accusations.

1

2

3

45

6

7

8

9

10

1112

12

3

4

Page 27: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

An Optimal Strategy for the Spy Master

Answer the first n/2− 2 questions with blanket accusations. Thenhide a single knight in each accusatory component.

1

2

3

45

6

7

8

9

10

1112

12

3

4

5

67

8

109

11

12

13

14

1516

Page 28: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

An Optimal Strategy for the Spy Master

Answer the first n/2− 2 questions with blanket accusations. Thenhide a single knight in each accusatory component.

1

2

3

45

6

7

8

9

10

1112

12

3

4

5

67

8

109

11

12

13

14

1516

Page 29: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

An Optimal Strategy for the Spy Master

This strategy ensures that the Interrogator cannot be certain ofevery identity until he has asked f (n) questions.

The Spider Interrogation Strategy uses at most f (n) questions.

Hence, with optimal play Knights and Spies is a draw. This solvesthe original problem: in an n person room, f (n) ≈ 3n/2 questionsare sufficient, and in the worst case, necessary.

Page 30: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Section 3: Open Problems and Speculative Applications

Is there a questioning strategy that never uses more than 3n/2questions, and on average uses αn questions for some constantα < 3/2?

Probably yes, but I can’t prove it.

One hopeful idea: build up long chains in the search for a knight,and later identify their members by repeated bisection.

Page 31: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Section 3: Open Problems and Speculative Applications

Is there a questioning strategy that never uses more than 3n/2questions, and on average uses αn questions for some constantα < 3/2?

Probably yes, but I can’t prove it.

One hopeful idea: build up long chains in the search for a knight,and later identify their members by repeated bisection.

Page 32: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Section 3: Open Problems and Speculative Applications

Is there a questioning strategy that never uses more than 3n/2questions, and on average uses αn questions for some constantα < 3/2?

Probably yes, but I can’t prove it.

One hopeful idea: build up long chains in the search for a knight,and later identify their members by repeated bisection.

K

Page 33: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Section 3: Open Problems and Speculative Applications

Is there a questioning strategy that never uses more than 3n/2questions, and on average uses αn questions for some constantα < 3/2?

Probably yes, but I can’t prove it.

One hopeful idea: build up long chains in the search for a knight,and later identify their members by repeated bisection.

K

Page 34: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Section 3: Open Problems and Speculative Applications

Is there a questioning strategy that never uses more than 3n/2questions, and on average uses αn questions for some constantα < 3/2?

Probably yes, but I can’t prove it.

One hopeful idea: build up long chains in the search for a knight,and later identify their members by repeated bisection.

K

Page 35: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Section 3: Open Problems and Speculative Applications

Is there a questioning strategy that never uses more than 3n/2questions, and on average uses αn questions for some constantα < 3/2?

Probably yes, but I can’t prove it.

One hopeful idea: build up long chains in the search for a knight,and later identify their members by repeated bisection.

K

Page 36: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Simulations of Chain BuildingNumber of questions asked in 100 person rooms with 49 randomlyallocated spies. Top: spies always lie. Bottom: spies always accuse.

freq

uen

cy

0

200

400

600

800

1000

1200

0

200

400

600

800

1000

1200

1400

1600

1800

120 125 130 135 140

Page 37: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Simulations of Chain Building

Number of questions asked in n person rooms in which knights arejust in the majority. Spies always lie. The interpolating line hasgradient 1.301.

num

ber

ofques

tion

s

0

200

400

600

800

1000

1200

1400

100 200 300 400 500 600 700 800 900 1000number of people

Page 38: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Public Key Distribution in Public Key CryptographyAlice would like to use the RSA Cryptosystem to email amessage M to Bob. She doesn’t know Bob’s public key PB ,but her friend Mallory does, and he sends her it.

Alice sends Bob the encrypted message EPB(M), and Bob

acknowledges receipt (by unencrypted email say). All iswell . . .

unless Mallory is not what he seems.

Page 39: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Public Key Distribution in Public Key CryptographyAlice would like to use the RSA Cryptosystem to email amessage M to Bob. She doesn’t know Bob’s public key PB ,but her friend Mallory does, and he sends her it.

Alice sends Bob the encrypted message EPB(M), and Bob

acknowledges receipt (by unencrypted email say). All iswell . . . unless Mallory is not what he seems.

Page 40: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Public Key Distribution in Public Key Cryptography

As time goes on, you will accumulate keys from otherpeople that you may want to designate as trustedintroducers. Everyone else will each choose their owntrusted introducers. And everyone will graduallyaccumulate and distribute with their key a collection ofcertifying signatures from other people, with theexpectation that anyone receiving it will trust at least oneor two of the signatures. This will cause the emergenceof a decentralized fault-tolerant web of confidence for allpublic keys.

Philip Zimmermann, Pretty-Good-Privacy Manual

Page 41: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Public Key Distribution in Public Key Cryptography

Potential difficulties:

I Doesn’t work well with small ad-hoc arrangements.

I Even people acting in good faith may unwittingly behave likespies.

I Have to think hard about who one trusts, and not lazilyaccept every key.

Idea: use algorithms from the Knights and Spies Problem to advisethe user.

Ideally most decisions would be safely handled by the computer.The user should only be bothered when a threat is stronglyindicated.

Page 42: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Building Networks of Reputable Companies

Consider companies offering a fairly specialised professional service,say print shops. Reputable operations tend to have some idea howgood their competitors are, and will preserve their reputation byanswering honestly when asked about them. Fraudulent operationsdon’t care, and anyway, are likely to lie. Spies are (hopefully) inthe minority.

The Knights and Spies framework could be used to decide who isreputable. No specialised knowledge of printing is required.

Application to cloud computing: we’d like to test our agents. Butmaybe the work required is so great, we have to find a way to letthe (untrustworthy) cloud do it for us.

Original suggestion due to Miranda Mowbray (HP Labs)

Page 43: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Thank you. Any questions?

For my paper, and programs for playing Knights and Spies andsimulating questioning strategies, go to

http://www.maths.bris.ac.uk/∼mazmjw.

Page 44: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Thank you. Any questions?

For my paper, and programs for playing Knights and Spies andsimulating questioning strategies, go to

http://www.maths.bris.ac.uk/∼mazmjw.

Page 45: Knights, Spies, Games and Social Networksuvah099/Talks/ksTalk.pdf · The Spider Interrogation Strategy uses at most f(n) questions. Hence, with optimal play Knights and Spies is a

Four More Open Problems

I What is the smallest number of questions it takes to becertain of at least one person’s identity?

I What is the smallest number of questions it takes to find aknight?

I Knights and Spies for logicians: ‘Person i , what is your viewon the formula j =⇒ (k ∧ `)?’

I Is the problem of deciding whether an incomplete game ofKnights and Spies is in a consistent state NP-complete?