Kevin Dowd (14)

Hello World

Unpacking and Running Brainhat In this "how-to" we unpack Brainhat and introduce the command line interface. To start, you will need a copy of "make" installed. In a Debian environment, which includes Mint and Ubuntu, become superuser and install "make" like so: # apt-get install make Move the Brainhat download, brainhat_linux.4-xxxxxx.tgz, file to a working directory and unpack with tar: # apt-get install make A handful of files and directories will appear: $ ls brainhat constant.h data DATE LICENSE README run simplecpp…

Explicit Inferences

This is an example of an explicit inference: If I see you then you see me. Explicit inferences are executable code. They will execute when the conditions of the inference match something in the context: >> if i see you then you see me if You see Me then I see You. >> i see you You see Me. I see You. Infererence templates are retriggerable: >> if an animal sees the princess then the animal is happy if a animal sees…

Saving the Context

The context from a Brainhat session can be saved and resurrected at a later time. Below, we interact with Brainhat. Upon exit, the context is saved. We start Brainhat a second time and restore the context. Then, we check to see that the context has been restored. To tell Brainhat that we want to save the context, we invoke it with the -S flag, like so: $ ./brainhat -S /tmp/foo.mbin +repeat >> hello hello. >> i like you You like Me. >>…

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.

Disbelief

It can be valuable to run Brainhat in a mode where it does not automatically believe everything it is told. This gives Brainhat the ability to evaluate knowledge against its own belief system. Let's start with an example where Brainhat believes everything it is told: $ ./run make: 'data' is up to date. Initializing >> i like you You like Me. >> debug xspeak 1 You say You like Me. You like Me. >> do i like you? yes. You like Me.

Entering and exiting debug

From the Brainhat commandline, you can enter debug at any time. Debug has no side-effects; you can execute any commands with causing a change in the context. To enter debug, enter one of "debug" or "break" at the ">>" prompt: $ ./run make: 'data' is up to date. Initializing >> debug Break in debug at the start: debug> help Commands: debug symbol [ location] -or- debug symbol [ location] -or- set symbol [ location] Increment debug count for routine/process/flag, and optionally stop…

Setting Flags

Brainhat maintains a collection of around 260 state flags. Some are for debug. Others are for other purposes. You can see which flags are set under debug: $ ./run make: 'data' is up to date. Initializing >> debug Break in debug at the start: debug> flags Global match level = 1 Match level = 1 creditspkr verbatim repeat debug, start debug> The same flag may be set multiple times. It is only "unset" when there are no copies of the flag left…

Level-1 Memories

Memories come in several types. Level-1 memories are about attributes, simple propositions and equivalences. To create a level-1 memory, use the -1 flag: $ ./brainhat -1 +repeat Starting new memory hash. >> the princess is pretty the princess is pretty. >> the dog wants a glass of milk the dog wants a glass belonging to milk. >> i was king You were king. >> bye ################# goodbye! When execution completes, indexed memory files will be left behind. These can be resurrected in…

Level-2 Memories

Level-2 memories are explicit inference templates, such as "if i see a person then the person sees me." A level-2 memory will be resurrected when any of its conditions are similar to CCs in the newest portion of the context. To create a level-2 memory, use the "-2" flag. $ ./brainhat -2 +repeat Starting new memory hash. >> if i see a person then the person sees me if You see a person then the person sees You. >> bye # goodbye!…

Level-3 Memories (implicit inferences)

Level-3 memories, or "vignettes", are collections of CCs where the presence of some imply the presence of all. Level-3 memories can be arbitrarily large. We record a level-3 memory with the "-3" or "-V" flag. $ ./brainhat -3 +repeat Starting new memory hash. >> the weather was beautiful. the weather was pretty. >> the sun was shining. the sun shines. >> i walked on the beach You did walk on the beach. >> i lost my dog. You did lose your dog.

 Brainhat Monitor GUI

Brainhat has an interface from which you can test interactions and monitor inter-process communications. You can start the GUI with the following command line: $ ./brainhat -W +repeat >> The internal webserver listens on port 4145. If you wish to use a different port, add the "-p" flag and a different port number. Connect to the GUI at: http://localhost:4145/gui.html You should see a page that looks similar to this: This screen shares a session with the command line; what you update here…

Embedded Webserver Commands

Brainhat serves web content from the html subdirectory. Some commands can be embedded in html content. This is how an embedded command is structured: <?brainhat ...some command... ?> Any debug command can be embedded. Here is a sample web page demonstrating with the debug command "version": <html> <head> <title>Brainhat Web Page</title> </head> <body> This page tests debug through the web interface. <p> The output appears below: <div class="command-output"> &nbsp; <p> <pre> <?brainhat debug version?> </pre> <p> &nbsp; </div> <p> End of test. <p>…

Heads or Tails

We teach Brainhat to play heads-or-tails. The first to reach a score of 5 wins: >> your score is 0. my score belonging to I is 0. >> my score is 0. your score belonging to You is 0. >> if i say heads then add 1 to your score. if You say head then add 1 number to my score. >> if i say tails then add 1 to my score. if You say tail then add 1 number to your score.

Where is the Ball?

This program is made up of three explicit inferences: $ ./run make: 'data' is up to date. Initializing >> if dog has toy and dog is in room then toy is in room. if dog has toy and dog is in room then toy is in room. >> if a dog sees a cat then dog drops toy and dog chases cat. if a dog sees a cat then dog drops toy and dog chases cat. >> if dog drops toy then…