Brainhat Brainhat Basic Knowledge Programming


October 1999

Introduction

Brainhat programming centers about a collection of definitions known as the Basic Knowledge Pool. The Basic Knowledge Pool describes the words and concepts that Brainhat knows at start-up, and details their relationships to one another. The lineage that makes a ball a toy, and makes a toy a thing, for instance, can be traced back to the basic knowledge pool.

In addition to the Basic Knowledge Pool, Brainhat also depends upon propositions to motivate inference or cause-and-effect. These are not (generally) programmed into the basic knowledge pool. Instead, Brainhat learns these through English statements, once the program has bootstrapped (see Building Brainhat Scenarios). You might tell the program "if thing1 is near thing2 then thing2 is near thing1," for instance. Note that constructs for describing propositions from within the concept definitions do exist--you may discover a few if you examine the basic knowledge definitions in the distribution. However support for these load-time propositions will disappear in the future. Please don't use them.

In addition to concept definitions, the Basic Knowledge Pool contains rules that tell Brainhat how to parse input and how to recognize ideas floating about in core. Rule definition isn't covered in this document. Fortunately, you shouldn't have to fool with parsing rules in order to create a vocabulary to match your application.

Most concept definitions can be found in a file called words, located within the data subdirectory.

Concept Definitions

Concept definitions can appear in any order. One definition ends and another begins whenever Brainhat encounters a define statement. The name given to the definition must be unique. By convention, I have been cardinally ordering different definitions of the same word, e.g. ball-1, ball-2, etc., where the first might describe a toy, the second a grand social event.

define   ball-1
         label           ball
         child           toy-1
	 wants           color-1
	 wants           size-1
         typically       round-1

The block above shows some of the basic elements of a concept definition. Statements subsequent to define can appear in any order. Tab characters position the columns. Most other characters count, so when defining concepts, take care to avoid trailing blanks.

label

Concepts can have one or more labels, each representing a synonym for the concept. The labels can be from one to three words long.

define   poison-ivy-1
         label          itchweed
         label          toxico dendrens radicans
         label          poison ivy
         child          weed-1

The definition above shows three synonyms for poison-ivy-1. Behind the scenes, the program will also add a fourth synonym--a label to track copies of poison-ivy-1 as it gets used and modified.

child

A child link identifies a concept as a more specific instance of some other concept:

define   frenchfry-1
         label          french fry
         child          potato-1
         child          fast-food-1

The block above defines frenchfry-1 as children of concepts potato-1 and fast-food-1. When you create a child relationship, the inverse parent relationship is automatically generated. The rightmost field lists a concept name, as specified in a a define statement (not a label) elsewhere.

Concepts cited in child references must exist. Furthermore, you must take care to assure that no concept is its own ancestor.

wants

Brainhat selects a complex concept (CC) from among a field of contenders by weighing its components against each other, and by and comparing it against CCs that came before. This is how Brainhat chooses between multiple definitions of a word. As an example, the adjective "red" could mean "communist" or it could stand for a "color." Similarly, a "red ball" could either be a toy or communist gayla. Words describing color and toys may hang together quite well, and make sense within the current context. Accordingly, Brainhat's scoring routines will favor the combination over, say, a communist toy.

One of the mechanisms Brainhat uses for scoring CCs is hints provided by the programmer. If you think that color is a likely attribute to be associated with a ball, then you can tell Brainhat to score the combination well. This is the purpose of a wants tag. It lists other concepts that, in combination with the one currently being defined, will win Brainhat's favor.

Be careful here: a wants tag does not reflect the needs of the object being defined. A real-life cow might want hay, for instance, but the Brainhat definition of a cow would be more interested in the features of the cow--things like hooves or fur.

define   ball-1
         label         ball
         child         toy-1
         wants         color-1
         wants         size-1
         typically     round-1

The definition above shows the use of a wants tag. As with child tags, the rightmost field lists a concept name, not a label.

typically

Like a wants tag, a typically flag specifies a feature of the object being defined. The difference is that satisfying a typically flag scores lower than satisfying a wants tag.

orthogonal

Two concepts are "orthogonal" when they cannot exist together. If you require that something cannot be both red and blue at the same, for instance, then you can declare concepts "red" and "blue" to be orthogonal with respect to "color."

define   blue-1
         label         blue
         child         color-1
         orthogonal    color-1

define   red-1
         label         red
         child         color-1
         orthogonal    color-1

define   pink-1
         label         pink
         child         red-1
         orthogonal    color-1

Any concept can serve as the basis for the orthogonality of others. And a given concept can be orthogonal along many axes--color, size, whatever. Note too that orthogonality takes lineage into account. You may say, for example, say that children of red-1, such as pink-1, are orthogonal to color-1, just as red-1 is. But this will not imply that pink-1 is orthogonal to red-1.

related

A related tag helps Brainhat score a concept against other related concepts already committed to the context buffer. An example probably explains this best:

define   fun-1
         label          fun
         child          things
         related        happy-1

A previous reference to a "happy" in the context buffer will help the above definition of "fun" score favorably. Note that related tag is different than the wants and typically tags we looked at previously: the concept nominated by a related tag does not need to appear in direct combination "fun." Rather, "fun" would have to be part of the on-going context.

tense

The tense tag is primarily for use with verbs and auxiliary verbs ("enablers") (can, will, does, did). Possible values include past, present, future imperfect, and so-on).

number

The number tag is commonly used with verbs and nouns. Possible values include single and plural. Other possibilities will follow as Brainhat grows up.

person

Used primarily with verbs, the person tag can take the values first, second and third.

Definition Guidelines

Definitions for a few types of speech should follow conventions spelled out in this section. This will allow Brainhat relate specific forms back to more general forms.

verbs

All verbs must be able to trace their lineage back to action. This means that, by following child links, you should be able to find action as an ancestor.

Verbs should be organized so that the infinitive form is a parent to all of subordinate forms, as in this set of definitions:

define   tosee-1
         label       to see
         child       sense-1

define   see-1
         label       see
         child       tosee-1
         number      plural
         tense       present
         person      third

define   sees-1
         label       sees
         tense       present
         person      third
         number      single
         child       tosee-1

define   saw-1
         label       saw
         child       tosee-1
         number      single
         tense       past
         person      third

There is no requirement that any of the subordinate forms be present. However, at a minimum, it is good idea that you define the infinitive and the third-person-present forms. Notice how the forms are linked together; the subordinate froms are children of the inifinitive.

nouns

All nouns must be able to trace their lineage back to things. This means that, by following child links, you should be able to find things as an ancestor.

Single and plural forms of nouns may be linked such that Brainhat understands their relationship to each other

define   spider-1
         label      spider
         number     single
         child      spiders-1

define   spiders-1
         label      spiders
         number     plural
         child      insect-1

Above we see how spider is related to spiders; the former is the child of the latter.

prepositions

All prepositions must be able to trace their lineage back to prepositions. This means that, by following child links, you should be able to find preposition as an ancestor.

attributes

All attributes must be able to trace their lineage back to attribute-1. This means that, by following child links, you should be able to find attribute-1 as an ancestor.

articles

All aarticles must be able to trace their lineage back to article. This means that, by following child links, you should be able to find article as an ancestor.


Return to Brainhat Programming Return to Home Kevin Dowd
Copyright © 1998, 1999, Kevin Dowd