Thursday, January 22, 2009

More Logic

Continuing from this post.

I have learnt, and now I may teach! Behold: logic and a story, combined into one!

1. All camels, whether they be dromedary or bactrian, live in the desert.

2. The Iron Sheik, who rules the land of Ælythia, rides the desert on the same mount as his elite cavalry.

3. Creatures that live in the desert need little water to live; should they be otherwise, they would not have survived in the harsh climates that characterize such regions!

4. The realm of the Iron Sheik is entirely composed of desert, broken only by a few, well-guarded oases scattered about the wastes.

5. Only mounts that need little water are used in desert militaries. (I trust this needs no explanation!)

The Iron Sheik rides a camel.

Don't see the logic, necessarily? Think some of those statements were extraneous, unnecessary, or quite the opposite of helpful? Let's... break it down!

The earlier logic I showed you was propositional logic - logic which connects variables with things like AND, OR, or IF/THEN. But there are other kinds of logic - more advanced types, capable of shattering the barriers of space and time themselves! The type of logic being employed here is called predicate logic - merely capable of shattering a man into a thousand mewling pieces. Predicate logic revolves around the manipulation of predicates - essentially, functions that transform one or more variables into a boolean TRUE or FALSE - and quantifiers, ∀ which means "for all of", and ∃ which means "for at least one of". (We'll be using these a bit.) So, in this case, we can break down the statements given to the following:

1. ∀c ∈ (in the set of) camels, LivesInTheDesert(c) is true.
2. Ælythia'sCavalryMount=Sheik'sMount. (Those are just variables.)
3. ∀a∈animals, LivesInTheDesert(a)→NeedsLittleWater(a).
4. IsDesert(Ælythia). (This also implies that Ælythia's military is a desert military; a bit of a cheat, logically!)
5. ∀m∈mounts, UsedInDesertMilitary(m)→NeedsLittleWater(m).

Now, we can re-arrange these to make somewhat more sense; but you may have already spotted an error. If an animal is used in Ælythia's military, it must need little water, because Ælythia is in the desert. That makes sense. Camels need little water. But that does not imply that camels are used in Ælythia's military! It means that they could be - perhaps even that they probably are. But statement 5 works only in one direction - it does not mean that cacti or desert rats are given employment in desert militaries! That would make no sense. So it's possible that camels are used in Ælythia's military - but it's also possible that they aren't, and giant scorpions are used instead, or the rare and deadly desert alpacas. The conclusion does not follow from the premises.

For the next example, let's add a premise to the previous one establishing that camels are the only mount in use in Ælythia's military. Now we do know that the Iron Sheik rides a camel, and we may proceed with undaunted confidence. A new set of premises:

  1. Royalty only respect other royalty if their peers ride mounts neither handsomer nor uglier than their own. (Strange folk, royalty.)
  2. All camels are ugly, spitting beasts.
  3. Well-bred animals are handsome. (Or close enough, for our purposes.)
  4. No ugly animal is handsome, and vice versa.
  5. The princes of the East only ride well-bred horses.
∴The Iron Sheik and the princes of the East look down upon each-other, with corresponding effects for international politics. (The effects are not very good.)

This one is actually a bit clearer than the last one - my apologies! But let's sort it out anyway, just for fun.

First, let's define some predicates, as I really should have done for the last one.
U(a) is true if and only if a is ugly.
H(a) is true if and only if a is handsome.
R(a,b) is true if and only if a and b respect one another.
W(a) is true if and only if a is well-bred.
And finally, C(a) is true if and only if a is a camel.

So, in terms of those, our premises look something like:
1. ∀a,b∈royalty.∃m∈(a's mounts) and ∃n∈(b's mounts), (U(m)∧U(n))∨(H(m)∧H(n))→R(a,b). That is, royalty respect one another only if they both have ugly mounts or both have handsome mounts.
2. C(a)→U(a). Camels are ugly.
3. W(a)→H(a). Well-bred animals aren't. (Optimism, perhaps.)
4. U(a)→~H(a). This does imply that something can be neither handsome nor ugly, but that fits well enough, so we'll let it alone.
5. ∀m∈(mounts of the Princes of the East), W(m). Sorry about the ugly syntax, I should probably fix that.

So, let's plug things in. The Iron Sheik, as we know, has a camel; C(a)→U(a), so the Sheik's mounts are ugly. The Princes of the East have well-bred horses, and W(a)→H(a), so their mounts are handsome. Therefore, in no cases will R(Iron Sheik, Prince of the East) be true; they hate each-others' guts! And all because of camels and horses. To think of it!

That's the power of logic, right there. (And messy syntax. Sorry, sorry, I swear I'll clean it up next time. Honest.)

Let's move a bit closer to home now. Another list, ho! And this time, let's state the conclusion first:
Mr. Zhang is the same person as David.
  1. Mr. Zhang is a poster on the blag.
  2. There are a limited number of people who post on the blag.
  3. Mr. Zhang's stories are always about 'womons'.
  4. Only people that are obsessed about something only write about that thing.
  5. David has been very unlucky in love.
  6. People never become obsessed about 'womons' unless they have fared very poorly with them.
  7. No poster on the blag, aside from David, has fared exceptionally poorly with persons of the distaff sex.
See how the conclusion follows from the premises? It probably does!

Now try proving your own! Using the techniques I've demonstrated here today, try to construct a set of premises that proves that Lehi, famed prophet of the Book of Mormon, journeyed to the Americas around the year 600 BCE. Bonus points if the proof is six premises long - or longer!

Until next time...
LOGIC OUT!

(woooooo)

No comments: