Translate

Saturday, May 28, 2005

Understanding logic

Here's a post where I go "beyond" and talk about logic, which plays a major role in computer development, but I think there are a lot of misconceptions about logic and what it is.

Essentially, a logical statement links a truth to itself.

Easily people are confused on this point possibly because of the way logic is taught, so like if you have something like:

"if A=B, and B=C, then A=C."

And there it appears that you have different things, but if A=B, then does that not mean they are the same? But the letter 'A' is NOT the letter 'B'!!!

What gives?

Well for programmers it's easy because we know about references. The letter 'A' is just a reference to something else, kind of like if you put a yellow sticky note on a car that says, 'A'.

With that sticky note on the car you can say, put A over in that parking lot, or A really needs a new paint job!

But 'A' is not the car.

It's a reference to the car.

If you get confused on that point then you may see contradiction in logic from the start, so it's an essential point, learning about references.

Now let's move on to more advanced topics with some basic truths or axioms about logic itself, and I'll show you how a supposed paradox is handled, just so you can see the effectiveness of the axioms.

And, oh yeah, what's the point?

Well, for developers, understanding logic is crucial for writing programs that are themselves logical, less buggy, and less likely to do weird and bizarre things that confound everyone!

LOGICAL FORMEDNESS AXIOMS


1. Identical sets are identical.

2. Different sets are different.

3. Statements contradicting axioms 1 or 2 are false or malformed.

4. A malformed statement is one for which a conclusion does not follow given its structure.

5. A false statement is one that while structurally correct is not true.

The "structure" I mean has to do with how the sentence is put together.

For instance, the following is a badly structured syllogism:

If x=1, and y=2, then x=y.

The basic structure for the syllogism--the well-formed structure--is,

if a=b, and b=c, then a=c,

and variations on that structure are to be considered malformed.

Notice that with the first given that x does not equal y, the conclusion is false, but the entire statement is malformed so that is secondary.

With the basic axioms established--and notice how simple they are--it's trivial to handle supposed paradoxes which reduce to attacking one of the first two axioms.

For instance, the so-called Russell Paradox reduces to the assertion that a set includes and excludes itself.

Let A be a set that includes itself, and let B be a set that excludes itself.

B is different from A.

Therefore, by axiom 2 any statement that B is A is malformed or false.

Stating that B is A and B is different from A is structurally wrong, so the full statement is malformed.

Notice also that the resolution to the supposed paradox is the well-formed statement:

Consider a set A that includes all sets, except itself, that exclude themselves.

Notice that the axioms prevent that set from including itself, as then you reduce to a set that both includes and excludes itself, against axiom 2 as I explained.


James Harris

No comments: