Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

# Helping Johnny to find his ideal woman (a problem in Set Theory, and Mathematica)

9 views

### Gilmar Rodríguez Pierluissi

Sep 18, 2003, 10:01:46 AM9/18/03
to
The following is a Set Theory Problem, that I have attempted to solve
using the standard, Mathematica set theoretic tools (i.e. Union, Intersection,
and Complement). This is NOT an assignment, nor task due of any sort.
I'm simply curious about the manner in which a problem like this can be solved,
using Mathematica, not knowing if the above mentioned tools are enough to solve
it, or if fancier tools are needed.
Here is the problem:

Johnny is looking for his ideal girfriend, which (according to him; and not meant

to favor any preconceived biases) must be red-haired, green-eyed, slender, and tall.

He knows four women: Adele, Betty, Carol, and Doris.

Here is a list of caveats:

0. Only one of the four women has all four characteristics that Johnny requires.

1. Only three of the women are both green-eyed and slender.

2. Only two of the women are both red-haired and tall.

3. Only two of the women are both slender and tall.

4. Only one of the women is both green-eyed and red haired.

5. Adele and Betty have the same color eyes.

6. Betty and Carol have the same color hair.

7. Carol and Doris have different builds.

8. Doris and Adele are the same height.

Which one of the four women satisfies all of Johnny's requirements?

Your assistance in solving this problem using the Mathematica software

will be greatly appreciated!

### Julian V. Noble

Sep 18, 2003, 10:42:50 AM9/18/03
to
Gilmar Rodríguez Pierluissi wrote:
>
> The following is a Set Theory Problem, that I have attempted to solve
> using the standard, Mathematica set theoretic tools (i.e. Union, Intersection,
> and Complement). This is NOT an assignment, nor task due of any sort.
> I'm simply curious about the manner in which a problem like this can be solved,
> using Mathematica, not knowing if the above mentioned tools are enough to solve
> it, or if fancier tools are needed.
> Here is the problem:
>
> Johnny is looking for his ideal girfriend, which (according to him; and not meant
>

A mathematician I spoke with treated it as a problem in game theory.
He compared the problem to a game in which a jar contains currency in
various denominations. You are allowed to put your hand in and remove
a banknote, and decide whether to keep it or return it to the jar.
If you keep it, that is the end of the game. If you return it, you
can try again. Your number of attempts is N or fewer. What is the

The answer turns out to be "Sample without keeping a banknote for
N/e tries (e is 2.71828...). Record the denomination D of the largest
bill you find. Now sample again and when you get a bill of denomination
D or greater, keep it.

He figured he had 10 years to date and meet his future wife. Did he apply
this strategy? He never said. But, interestingly, he got married about 3
years later.

--
Julian V. Noble
Professor Emeritus of Physics
j...@lessspamformother.virginia.edu
^^^^^^^^^^^^^^^^^^
http://galileo.phys.virginia.edu/~jvn/

"Science knows only one commandment: contribute to science."
-- Bertolt Brecht, "Galileo".

### Robert Israel

Sep 18, 2003, 12:10:10 PM9/18/03
to

Gilmar Rodríguez Pierluissi <gilmar.r...@nwfwmd.state.fl.us> wrote:
>Johnny is looking for his ideal girfriend, which (according to him; and
>not meant
>to favor any preconceived biases) must be red-haired, green-eyed,
>slender, and tall.

>He knows four women: Adele, Betty, Carol, and Doris.

So there are 2^16 cases in all (a case involves saying which attribute is
present in each woman). That should be a manageable number. Generate
them one by one, test each of the conditions, and see which cases survive
all the tests.

Robert Israel isr...@math.ubc.ca
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia

### raphae...@free.fr

Sep 25, 2003, 2:07:57 PM9/25/03
to
gilmar.r...@nwfwmd.state.fl.us wrote:

This kind of problem can be addressed with Groebner bases in Z/2Z.
Mathematica certainly provides this.

First you've got to translate the constraints into boolean expressions.
I've assumed the precise statements to be "X and only x" instead of
just "Only x" in each item. Here is the resulting input (in meditor
syntax):

groebner({

// defining equations
r[a]^2+r[a],
g[a]^2+g[a],
s[a]^2+s[a],
t[a]^2+t[a],
r[b]^2+r[b],
g[b]^2+g[b],
s[b]^2+s[b],
t[b]^2+t[b],
r[c]^2+r[c],
g[c]^2+g[c],
s[c]^2+s[c],
t[c]^2+t[c],
r[d]^2+r[d],
g[d]^2+g[d],
s[d]^2+s[d],
t[d]^2+t[d],

// contraint 0.
// only one
r[a]*g[a]*s[a]*t[a]*((r[b]*g[b]*s[b]*t[b]+1)*(r[c]*g[c]*s[c]*t[c]+1)*(r[d]*g[d]*s[d]*t[d]+1)+1),
r[b]*g[b]*s[b]*t[b]*((r[c]*g[c]*s[c]*t[c]+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d]*((r[a]*g[a]+1)*(r[b]*g[b]+1)*(r[c]*g[c]+1)+1),
// at least one
(r[a]*g[a]+1)*(r[b]*g[b]+1)*(r[c]*g[c]+1)*(r[d]*g[d]+1),

// contraint 5.
g[a]+g[b],

// contraint 6.
r[b]+r[c],

// contraint 7.
s[c]+s[d]+1,

// contraint 8.
t[d]+t[a]},
{r[a],g[a],s[a],t[a],
r[b],g[b],s[b],t[b],
r[c],g[c],s[c],t[c],
r[d],g[d],s[d],t[d]},lex,2)

(Note : meditor needs the comments to be removed manually.)
Here is the result:

groebner({1+r[a], 1+g[a], 1+s[a], 1+t[a], r[b], 1+g[b], 1+s[b],
t[b]+t[b]^2, r[c], 1+g[c], 1+s[c], 1+t[b]+t[c], 1+r[d], g[d], s[d],
1+t[d]}, {r[a], g[a], s[a], t[a], r[b], g[b], s[b], t[b], r[c], g[c],
s[c], t[c], r[d], g[d], s[d], t[d]}, lex, 2)

It follows that Adele is the one.
We see that the system isn't completely constrained so that Betty and
Carol have an unspecified height (they have to have different heights
each, though).

This makes me think of the following anecdote : I couldn't understand
genetics until I finally catched on that dominant genes can be seen
as "one"s, recessive genes as "zero"es, and the phenotype of an
individual as a logical "or" between the alleles from the parents.

Raphael

### Shing Hing Man

Sep 27, 2003, 8:54:36 AM9/27/03
to
Gilmar Rodríguez Pierluissi wrote:

From the statement of problem, we may assume

* colour of hair is black, red or blonde
* colour of eye is brown or green
* build is plump or slender
* height is short, average or tall

I have used a rule engine called Jess (Please see

http://herzberg.ca.sandia.gov/jess/docs/index.shtml
)
to work out all the possible solutions.
Jess is more suitable for solving this kind of problem
than say C++ or Java.
The possible solutions are as follows.
(The Jess script that produces the following is at
http://uk.geocities.com/~matmsh/homepage/jess/idealGirlFriend/idealGirlFriend.html.)

name | eye hair build height
----------------------------------
Betty |green blonde slender tall
Carol |green blonde slender short
Doris |brown red plump tall

name | eye hair build height
----------------------------------
Betty |green blonde slender short
Carol |green blonde slender tall
Doris |brown red plump tall

name | eye hair build height
----------------------------------
Betty |green blonde slender average
Carol |green blonde slender tall
Doris |brown red plump tall

name | eye hair build height
----------------------------------
Betty |green blonde slender tall
Carol |green blonde slender average
Doris |brown red plump tall

name | eye hair build height
----------------------------------
Betty |green black slender short
Carol |green black slender tall
Doris |brown red plump tall

name | eye hair build height
----------------------------------
Betty |green black slender tall
Carol |green black slender short
Doris |brown red plump tall

name | eye hair build height
----------------------------------
Betty |green black slender average
Carol |green black slender tall
Doris |brown red plump tall

name | eye hair build height
----------------------------------
Betty |green black slender tall
Carol |green black slender average
Doris |brown red plump tall

So Adele is the only one that meets the required.

regards
Shing

### Shing Hing Man

Sep 27, 2003, 8:59:04 AM9/27/03
to
Shing Hing Man wrote:

Oohs ! I have given an invalid to the Jess script in my last email. Here is
http://uk.geocities.com/matmsh/jess/idealGirlFriend/idealGirlFriend.html

Shing

### Peter L. Montgomery

Sep 27, 2003, 12:40:05 PM9/27/03
to
In article <3f732efc\$0\$28913\$626a...@news.free.fr>
raphae...@free.fr writes:
>gilmar.r...@nwfwmd.state.fl.us wrote:

>>Johnny is looking for his ideal girfriend,

[question truncated -- last word assumed to be girlfriend.]

As John and his bride commute down the aisle, guests will see
right and left identities, but ring theory ensures they are one and the same.

--
Wanted: Experts at choosing the best of 100+ applicants for a position.
Register as a California voter by September 22, and vote on October 7.
Peter-Lawren...@cwi.nl Home: San Rafael, California
Microsoft Research and CWI

0 new messages