Examine a Complex Concept in the Context

Brainhat comes with a basic vocabulary and grammars. An individual knowledge entity is called a "concept."  A concept is similar to a vocabulary word.  For example, "dog" is a concept:

  >> dog
   dog.

 

When we combine two or more concepts, we create a "complex concept"
or CC:

  >> dog is happy
   happy dog is happy.
  >> dog
   dog is happy.

Enter debug to examine concepts and CCs

When the program starts, all concepts are clean, which means that none have been modified.  "Dog", for example, is represented in the vocabulary as a clean concept.  Here, we drop into debug and list all of the concepts for "dog".  There is just one, "dog-n1":

$ ./run
make: 'data' is up to date.
Initializing

>> break 

Break in debug at the start:
debug> list dog
Motive: default
  (clean text) dog->dog-n1 (clean), MID 10000
debug>

The command "sdump dog-n1" will show us the concept:

debug> sdump dog-n1
define	dog-n1 [8355] (74e8b140) /2710/ clean  
	label		dog
	label		dogs
	label		dog-n1
	orthogonal		mammal-n1
	orthogonal		pet-n1
	child-of		mammal-n1
	child-of		pet-n1

Now, let's exit debug and create a dirty copy of "dog".  We do this by modifying the clean copy with "the dog is happy".  After that, we return to debug to list the dogs Brainhat knows about:

>> the dog is happy
 the dog is happy.
>> break

Break in debug at the start:
debug> list dog
Motive: default
  (clean text) dog->dog-n1 (clean), MID 10000
  (context text) dog->dog-aab0 (dirty), MID 10000
debug>

There is a second copy of "dog" now--"dog-aab0".  This one is marked as dirty.  We dump the dirty dog using the command "cdump dog-aab0":

debug> cdump dog-aab0
define	dog-aab0 [8355] (76d0eb50) /2710/ dirty  
	label		dog
	label		dogs
	label		dog-n1
	attribute		happy-a1
	article		the-aab2
	orthogonal		mammal-n1
	orthogonal		pet-n1
	child-of		mammal-n1
	child-of		pet-n1

debug>

This copy of "dog" is the same as the clean copy we looked at a moment ago, except that it has new links to "happy" and "the." 

Next we look at the CC created by the input "the dog is happy".  In debug, we used the "xspeak 1" command to list the CCs in the context.  There are two.  We will examine the second one using the "xdump 2" command:

debug> xspeak 1
 You say the dog is happy. the dog is happy.

debug> xdump 2
define	Root-05f68b88 [100043656] (76d50550) /2710/ dirty - simple attribute
	label		sent-declare-attr2
	child-of		things
	auxtag		no-object-context
	person		third-person
	number		singular-number
	tense		present
	attribute		happy-a1
	verb		tobe
	subject		dog-aab0

debug>

Whenever possible, Brainhat will reuse dirty concepts.  So, when we say "the dog is happy", "the dog is hungry" and "the dog is brown," all of these describe attributes of the same dog.  A new dirty copy of "dog" will be created when some new attribute conflicts with the existing dirty copies, as would be the case if we were to say "the sad dog is hungry."   Now there is one clean dog and two dirty dogs:

$ ./run
make: 'data' is up to date.
Initializing

>> the dog is happy
 the dog is happy.
>> the dog is hungry
 the happy dog is hungry.
>> the sad dog is hungry
 the sad dog is hungry.
>> break

Break in debug at the start:
debug> list dog
Motive: default
  (clean text) dog->dog-n1 (clean), MID 10000
  (context text) dog->dog-aa5d (dirty), MID 10000
  (context text) dog->dog-ac99 (dirty), MID 10000
debug> 

Read about orthogonality to learn more.