IF GRAMMATICAL STRUCTURE, p3
In plain English the "if grammatical structure" is a matter of saying "I expect to do this, or else if I do not do this, I will do that; if not that I will do something else; if not something else, then ......" We might write it out in plain English as a plan for an itinerary with one line after the other as in C:

If it is Thursday then I will first try to tour the London Museum;

Or else, if I can't do that I will go to Westminster Abbey;

If not that, I will visit the Tower of London;

Or else, if I can't do that I will take a bus to Stonehenge.

SOME GRAMATICAL ANALYSIS

The complete grammatical structure for saying such things could be analyzed in English. In C, it is analyzed in the GGF which A&J give. Augie Hansen, in "A Complete Guide to Mastering the C Language" (1989) provides a few more components of the C grammar. The action specified which ends with a semi-colon is called a C STATEMENT. "A statement specifies an action ... A C statement takes one of several forms. THE ESSENTIAL C STATEMENT IS AN EXPRESSION FOLLOWED BY A SEMICOLON AND IS CLASSIFIED AS AN EXPRESSION STATEMENT." (p. 62, blocks are mine). "Expression" is a more general term and it means the same in C as in Standard English. Hansen says "An expression performs a calculation and produces a result, or causes some action (called a side-effect) to occur." (p.62). IMO that is overly complex. An expression is anything in any language from the smallest punnctuation mark to the lengthiest tome. Everthing which a language produces can be called an expression. The previous period is an expression. But the concept of a STATEMENT is more specific, in English and in C. In C, an expression which ends in a semi-colon is called a statement.

This analysis may seem tedious to those who find grammatical analysis to be a dry subject. But such analyses have contributed to the science of grammatical study since Dionysius Thrax, for those involved in the subject. Presently it helps us to understand how, as astonishing as that may seem to the uninitiated, we can use one of the languages of the machine (C) to communicate with it, instruct it and teach a machine ... and impart intelligence to it. Hansen also refers to "...the lexical elements of C programs...." (p. 61). Lexicon is vocabulary. The word "if" (without the quotes) is a C word, one of its lexical elements.

Thus we have expressions, statements and lexical elements in C.

IF-ELSE LADDER or CHAIN

Bronson and Menconi tell us "...an extremely useful construction occurs when the else part of an if statement contains another if-else statement. This takes the form:

if (expression_1)
   statement 1;
else
    if (expression_2)
         statement_2;
     else
          statement_3;

This constructionis called an if-else chain. It is used extensively in applications programs. Each condition is evaluated in order, and if any condition is true, the corresponding statement is executed and the remainder of the chain is terminated. The final else statement is only executed if none of the previous conditions are satisfied." (pp. 131-32 of Gary J. Bronson and Stephen J. Menconi, "A First Book of C: Fundamentals of C Programming", West Publishing Co. 1988/1991).

The "if-else ladder" seems to be more common terminology based on the texts I have here but either is correct.

TEACHING A MACHINE

Going back to the A&J example, what if you were to teach a human student in the early grades of K-12 to do this kind of arithmetic? "Class, I want to teach you how to compare any two numbers I will call x and y. If they are equal I want you to write out that they are equal. If they are not equal, I want you to tell me if x is greater than y or less than y and in either case to write out which it is. The numbers can be of any size. They may contain decimals." There is no doubt that this would be an impressive exhibit of learned behaviour if demonstrated in such human students. And we would certainly say it is a manifestation of intelligence. IT IS NO LESS A DEMONSTRATION OF LEARNING AND INTELLIGENCE WHEN THE STUDENT IS A MACHINE.

How did we teach the human students? We used their language to communicate and teach them. That is how we taught the machine student.

The if grammatical structures above can easily be worked into a complete C program which will allow the machine to receive the arithmetic values as input and issue the output statements based on the DECISIONS  it has made. Thus we have at least three manifestations of AI now: arithmetic ability, expressive ability in making output verbal expressions and decision-making.



Add your text here
Hosted by www.Geocities.ws

1