Marriage Problem Your the sovereign in a small kingdom. One of your jobs is to marry off the people...

36
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.

Transcript of Marriage Problem Your the sovereign in a small kingdom. One of your jobs is to marry off the people...

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 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}.

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).

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.

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.

Example

Nick, Victoria, Patricia

Daniel

Olga, Victor, Patricia

Patrick, Leo, Nick

Danielle, Oleg

Lenore, Nick

Nicole

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.

Example

Nick, Victoria, Patricia

Daniel

Olga, Victor, Patricia

Patrick, Leo, Nick

Danielle, Oleg

Lenore, Nick

Theorem

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

family cannot be created.

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.

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.

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.

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.

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.

Course-of-Values Induction

We prove the theorem by course-of-values induction.

We assume that the theorem is true for all towns

which have fewer than n excess people and then

show it is true for a town with exactly n excess

people.

We begin by assuming the theorem (No Social Club -

> Can find the perfect family) for any town with

fewer than n excess people.

Case 1

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.

Case 1 (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.

Case 2

We must show that the theorem is true if the town

has n > 0 excess people. We have assumed that:

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

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

perfect family.

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.)

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

“Samantha” 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.

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?

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.

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.

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 Sam 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.

Theorem Proved

Thus we can create the perfect family if and only if

there's no social club in both cases.

What does this have to do with this class?

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.

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.

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.

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} }.

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}.

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.

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

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.

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.

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.

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.