35
Marriage Problem Your the sovereign in a small kingdom. One of your jobs is to marry off the people in kingdom. There are three rules that apply.

Marriage Problem

  • Upload
    pelham

  • View
    24

  • Download
    0

Embed Size (px)

DESCRIPTION

Your the sovereign in a small kingdom. One of your jobs is to marry off the people in kingdom. There are three rules that apply. Marriage Problem. - PowerPoint PPT Presentation

Citation preview

Page 1: Marriage Problem

Marriage Problem

Your the sovereign in a small kingdom. One of your

jobs is to marry off the people in kingdom. There

are three rules that apply.

Page 2: Marriage Problem

Marriage Rule

Only a male and female with corresponding names,

e.g., Robert and Roberta, may marry. (Assume a

one-to-one correspondence of male/female names).

Marriages are between two families. The married

couple leaves (town) and the remaining members of

the two families are joined into big, new family.

Example: Marrying {Robert, Sam, Josephine} to

{Roberta, John, Jack} yields {Sam, Josephine,

John, Jack}.

Page 3: Marriage Problem

Clone Rule

You may clone a family at any time. This creates an

identical copy of the family (in case the family is

used in a later marriage, a copy is kept intact).

Page 4: Marriage Problem

Murder Rule

The night before a wedding, one person in a family

with the same name as some one else in that family

may murder the other person, i.e., remove him or

her from the family. So, {Robert, Joe, Robert,

Robert, Sam} may become {Robert, Joe, Sam}.

Essentially this rule means that you can treat

families as set.

Page 5: Marriage Problem

Goal

Since marriage is an honorable and esteemed state,

the goal is to marry off everyone in a family. Thus

the perfect family is the empty family. Your goal as

sovereign is to create a perfect family by using the

three rules. Note that you don't need to marry off

everybody in town, just create one perfect family.

Page 6: Marriage Problem

Example

Nick, Victoria, Patricia

Daniel

Olga, Victor, Patricia

Patrick, Leo, Nick

Danielle, Oleg

Lenore, Nick

Nicole

Page 7: Marriage Problem

Social Club

A social club is really an anti-marriage club. There

are two rules:Only one member of each marriageable pair are

eligible members of the social club and all that are

eligible are members.Each family must have one member in the social

club.

Page 8: Marriage Problem

Example

Nick, Victoria, Patricia

Daniel

Olga, Victor, Patricia

Patrick, Leo, Nick

Danielle, Oleg

Lenore, Nick

Page 9: Marriage Problem

Theorem

A town has a social club if and only if the perfect

family cannot be created.

Page 10: Marriage Problem

Proof: SC -> no perfect family

Suppose a town has a social club. Then every family

has at least one member who is in the social club.

Each of the rules, marriage, clone, and murder,

creates a new family which also has a member in

the social club. Clone – obvious. Murder – must

leave at least one person with the given name.

Marriage – think about it.

Page 11: Marriage Problem

Proof (cont'd)

Suppose we marry, say Robert and Roberta, from

two families. If Robert is not in the social club,

then some other member of Robert's family must

be. That member is in the new, joined family, so the

new family has a member in the social club. If

Robert is in the social club, then Roberta can't be,

and so another member of her family is – and that

person is in the new family.

Page 12: Marriage Problem

Proof (cont'd)

So, no matter what rule is used, the new family has a

member in the social club. By induction, after n

applications of the rules, the resulting family must

have a member in the social club. If we could create

the perfect family, then we would have a family

without a member in the social club, which is a

contradiction. So, we cannot create the perfect

famly.

Page 13: Marriage Problem

Proof: No SC -> Perfect family

This is the hard direction. Suppose that we have a

town and that it doesn't have a social club. We

prove by induction on the number of excess people

that we can create the perfect family.

Page 14: Marriage Problem

Number of Excess People

If a family has zero or one members, it has 0 excess

people.If a family has n people, where n > 1, then it has n-1

excess people.The number of excess people in a town is the sum

of the number of excess people in all the families of

the town.We use this as a measure in our induction proof.

Page 15: Marriage Problem

Base Case

We assume that we have a town with 0 excess

people. That means that all the families have 0

excess people, and hence each family consists of

zero or one person. If we have a family we zero

people, that's the perfect family, and we don't have

to do anything. We're done.

Page 16: Marriage Problem

Base Case (cont'd)

If no family has zero people, then all families must

have exactly one person. So, if there is a social club,

everyone would have to be in it (one member of

each family is everyone). So why doesn't this work?

The town must contain a marriageable pair. So,

marry off those two folks – they are the only people

in their respective families and you have the perfect

family.

Page 17: Marriage Problem

Inductive Case

We assume the induction hypothesis:

If we have a town with fewer than n excess people,

and there is no social club, we can always create the

perfect family.

We must show:

If we have a town with n > 0 excess people, and there

is no social club, we can create the perfect family.

We assume that we have a with n excess people and

no social club.

Page 18: Marriage Problem

Inductive Case (cont'd)

Since there is at least one excess person (n > 0) in

town, there must be a family with an excess person,

call him Sam. We do the following thought

experiment. We create a new town, a duplicate of

the first, but we remove all Sams, and we delete any

families with Samanthas. (Samanthas are useless

since there aren't any Sams to marry.)

Page 19: Marriage Problem

Inductive Case (cont'd)

Since Sam was an excess person in at least one

family, killing off all Sams lowers the number of

excess people in town. We claim that there isn't a

social club in the new town. If there were, adding

“Sam” to that social club would create a social club

for the original town. Thus, by induction, we know

that we can create the perfect family in the new

town.

Page 20: Marriage Problem

Inductive Case (cont'd)

Continuing this thought experiment: We have found

a set of marriages (and murders and clonings) that

produces a perfect family in the new town. We

perform the same acts, using the original families

from the first town (all the families in the new town

came from the original town, perhaps with Sam

killed off). What happens if we do the same

actions?

Page 21: Marriage Problem

Induction Case (cont'd)

We either end up with the perfect family, or the

family with just Sam by himself. Why? Because we

start with the same families in the old town as in the

new town, except that Sam might be in the family.

If so, Sam is retained in the family after a rule is

applied. Again, by induction, if that's the case, we

also get the same result, but perhaps with Sam

included.

Page 22: Marriage Problem

Inductive Case (cont'd)

So, if we were able to create the perfect family

(because Sam was not in any of the families we

used), then we're done. Otherwise, we created a

family with just Sam. Use that family to marry off

all the Samanthas in town. Now consider the new

town were all the Samanthas are gone and any

families with Sam are deleted.

Page 23: Marriage Problem

Inductive Case (finished!)

Since the family with Sam has been deleted, the new

town has fewer than n excess people and we can

apply the induction hypothesis. Again, there's no

social club (if there were, just add Samantha for a

social club for the original town). By induction we

can find the perfect family. Doing the same

marriages in the original town yields the perfect

family there.

Page 24: Marriage Problem

Theorem Proved

Thus we can create the perfect family if and only if

there's no social club.

What does this have to do with this class?

Page 25: Marriage Problem

Propositional Calculus

Remember the resolution rule?

~P, P v Q |- Q

It turns out this is an extremely useful rule all by

itself.

Before letting this rule loose, we need to put our

formulas into clause set form.

Page 26: Marriage Problem

Clause Set Form

Here are the sets to put a formula into clause set

form:

Rewrite the formula into conjunctive normal form

(uses only ^, v, and ~) Push the ~'s in as far as

possible, then use distributivity to move all the v's

inside of the ^'s.

Propositions and negated propositions are called

literals.

Page 27: Marriage Problem

Clause Set Form (cont'd)

Each conjunct becomes a set of literals – just rewrite

the literals in set format, dropping the v operator (it

is implied). This is called a clause and each clause

is an implicit disjunction.

The whole formula is taken to be a set of clauses –

again, write a set of clauses, dropping the ^

operator. A clause set is an implicit conjunction.

Page 28: Marriage Problem

Clause Set Form - Example

Consider the formula:

(p -> q) v ~(r -> s).

Use the rule (A -> B) is equivalent to (~A v B)

yields: (~p v q) v ~(~r v s).

Pushing the ~ inside gives: (~p v q) v (r ^ ~s).

Using the distributive law to move the ^ outside the v

yields: (~p v q v r) ^ (~p v q v ~s).

Putting this in clausal form gives us:

{ {~p,q,r}, {~p,q,~s} }.

Page 29: Marriage Problem

Resolution Rule

The resolution for propositional logic in clausal form

is straightforward: If we have two clauses, C1 and

C2, where P is in C

1 and ~P is in C

2, the resolvent is

C1\{P} U C

2\{~P}.

Page 30: Marriage Problem

Resolution

Given a formula, we negate the formula and then

put the result into clausal form. We then choose two

clauses from the set which have complementary

literals, e.g., P and ~P, and apply the resolution rule

to obtain a new clause which is then added to the

set. We repeat this process until the empty clause

(bottom, or contradiction is obtained). If we can

derive bottom, the original formula is a tautology.

Page 31: Marriage Problem

Example

Consider the clause set:

{ {N, ~V, ~P}, {D}, {~O, V, ~P}, {P, L, N}, {~D, O}, {~L, N},

{~N}}

8. {~V, ~P} 1,7

9. {~L} 6,7

10. {P, N} 4, 9

11. {O} 2, 5

12. {V, ~P} 3,11

13. {~P} 8,12

14. {N} 10, 13

15. {} 7, 14

Page 32: Marriage Problem

Soundness and Completeness

Resolution is both sound (if you can prove it, it's

true) and complete (if it's true, you can prove it).

How do we know resolution is sound and complete?

We proved a theorem showing that.

Page 33: Marriage Problem

Proof

A literal is a person. A positive literal is a male and a

negative literal is a female. There is a one-to-one

correspondence between literals and their negations.

A clause is a family.

A clause set is a town.

The marriage rule is the resolution rule. The murder

rules happens because clauses are sets. The clone

rule occurs because we keep copies of old clauses.

Page 34: Marriage Problem

Proof (cont'd)

The perfect family is the empty clause, or bottom. If

we can create the perfect family, then we can derive

bottom from the clause set.

The social club is an interpretation that satisfies the

clause set. That is, each literal or its negation is in

the set, i.e., is true. Each clause has at least one

literal which is true, so each clause is true as a

clause is a disjunction. So, the set is satisfiable.

Page 35: Marriage Problem

Proof (finished)

So, the theorem is “there is a social club if and only

if the perfect family cannot be created,” or

conversely, “you can create the perfect family iff

there is no social club.” Which means “you can

derive a contradiction iff the formula is

unsatisfiable, hence it's negative is a tautology.”

Thus resolution is sound and complete.