'Brainhat' is a project to model knowledge, inference, reason and
intuition, and to scale it. The objective of programming with
knowledge is to build a system that "knows" things, can evaluate new
information and react.
Is this AI?
The term Artificial Intelligence has come to mean high order
curve-fitting with predictive capabilities. AIs are trained. The
product is matrices whose contents represent the data they were
trained by, structured for the program that trained them. In that
sense, they're somewhat intransigent.
To update an AI one has to retrain it. Accordingly, in use, they're
read-only intelligence. Any sequential or stateful behavior has to be
simulated by adding code around an AI.
Brainhat could be that kind of code; Brainhat + AI would be a
powerful combination. But, Brainhat is not AI in the
current conventional sense of the term.
Is this Natural Language Processing?
Maybe! But, no.... In the 1970s, Brainhat would have been
called Natural Language Processing (NLP). That term has
been subsequently repurposed to represent language
translation, text summarization and bots. Brainhat, by
contrast, processes with deep knowledge representations.
Human language is valuable for conveying knowledge. But
once Brainhat compiles it into a knowledge representation,
the language is thrown away. So, in that sense, there's
no natural language processing at all—except when
communicating with you; Brainhat processes knowledge.
The Short Tour
Natural language makes knowledge portable. Here are some examples of
knowledge conveyed by simple English:
"You want a hamburger." (proposition)
"The dog is hungry." (attribute assignment)
"I was the king." (equivalence)
Brainhat "programs" are collections of statements like
these, compiled into binary form. Each statement conveys a
simple idea. Taken together, they form a context--the
collection of things known organized by the order in which
they happened, and indexed for retrieval.
Brainhat processing is dataflow-driven. That means that
when something becomes relevant, processing occurs
automatically. This includes execution of inferences,
memory loads and stores and data-sharing across the
network. This is an example of an explicit inference.
"if the dog is hungry then the dog wants to eat."
When knowledge that the "the dog is hungry" meets this inference
template, new knowledge will be created:
"the dog wants the dog to eat."
You probably have experience with procedural and imperative
programming languages such as C, Perl or Python. These kinds of
languages feature data types. The number 3, TRUE, and "11 Oak Street"
are examples of data of type integer, boolean and string. For a datum
to have meaning it has to be associated with a variable or table
entry, as in k=3, complete=TRUE or address="11 Oak Street." Data do
not live unbound; they don't float around on their own.
j = 2
k = 1
i = j + k
string = "here is a non-zero answer:"
if (i != 0)
print string, " ", i
Procedural languages also have flow control statements, such as 'if'
or 'while,' that implement branching. There may be subroutines or an
event loop. The program jumps from place to place, but execution will
always be somewhere within the code--somewhere that you can point to.
By contrast, there are no flow control statements within Brainhat.
There's no program in
a regular sense. There's no distinction between data and code.
Rather, the data themselves direct execution and are perhaps even the
result of execution. Data do float around, unattached.
Here is a larger example. This "program" is made up of three explicit
inferences, a proposition and an attribute assignment:
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 dog drops toy then dog does not have toy.
dog has a ball.
dog is in kitchen.
The lines making up the program can be entered interactively or
pre-compiled and invoked. Below, we continue interactively. The
statements preceded by '>>' are entered by the user:
>> dog is in bathroom.
dog is in bathroom.
a ball is in bathroom.
>> where is ball?
a ball is in bathroom.
>> dog sees cat.
dog in bathroom sees cat.
dog in bathroom drops toy.
dog in bathroom does not have toy.
dog in bathroom chases cat
>> dog is in bedroom.
dog is in bedroom.
>> where is ball?
a ball is in bathroom.
The dog had the ball at the outset, but now the dog is in the bedroom
and yet the ball remains in the bathroom. Why is that? The bathroom
is where the dog dropped the ball when the dog chased after the cat.
To read human language, Brainhat has to recognize the tokens (words)
and it has to make sense of their order. Tokens and order are
prescribed by a vocabulary and a grammar. The vocabulary says what
the tokens can be. The grammar says how they can be combined. The
vocabulary and grammar create the possibilities for, and define the
limits of, what Brainhat can understand.
Input: "I hear the mailman." The program tags parts of
speech--the subject, verb and object--and places them into a data
structure that represents the statement. The knowledge is captured
and the original English is discarded.
SUBJECT / | \ OBJECT
o | \
I | o mailman
In Brainhat terminology, each of the vocabulary elements--"I", "to
hear" and "mailman" is called a concept. Any combination of concepts
is called a complex concept or CC. Compiling the statement "I hear
the mailman" produces a CC data structure that resembles the diagram,
above. As a data structure, a CC can be indexed, stored, recalled,
compared and transformed:
>> i hear the mailman
You do hear the mailman.
>> what do i hear?
You do hear the mailman.
>> do i hear the mailman?
yes. You do hear the mailman.
>> what do i do?
You do ask do You hear the mailman.
Language makes knowledge portable, but it can be imprecise. When
I say "the dog has a ball," chances are that your mental image
differs from mine--a different kind of dog, ball and location.
The differences are a consequence of the knowledge we have
acquired previously. Because of the ambiguity of language,
contexts containing the same knowledge will often disagree on the
Brainhat can talk to non-Brainhat devices through a very
simple API. Devices that Brainhat talks to might include
robots or classifiers that we often call AIs. We can
leverage the observations of AIs as knowledge. API
interfaces are asynchronous. Anytime a remote device or
process wishes to speak, Brainhat will accept the input
and update the context. Brainhat may also request
information from a remote device or instruct it to do
something. The confirmation or answer can be a simple
"no" or "yes" or "blue" or "in the water", and so on, or
it can be complete simple English statement. Brainhat
provides a response ID so that a response received can be
correlated with a specific request.
Human language captures knowledge and makes
knowledge portable. Programming Brainhat with
simple English, then, is tantamount to programming
with simple knowledge. This is very different than
computing with data, which is what most of us are
familiar with. To highlight the difference, ask
yourself how would you program this in C, Perl or
"I love you."
In Brainhat programming, this can be just the right
thing to say. As a minimum, the new knowledge will
be stored and indexed. It may also cause changes in
preexisting stored knowledge, the exercise of
implicit and explicit inferences, the recall of
memories and some interprocess communication.
For some objectives, orchestrating knowledge and the
execution of inferences can be complicated. If you wanted
to teach Brainhat how to play a poker or make an ice cream
cone, for instance, it may be quicker to write a script.
For this, Brainhat has a scripting framework, that allows
the user to craft an agenda to pursue specific goals.
Scripts can follow many paths at once, gather information
from many sources and advance many agendas. Multiple
scripts can be active at one time; you may make ice
cream cones at the same time as you play poker. Scripts
can be traded across the network too, so it is possible to
have other copies of Brainhat do your work or benefit from
your scripting, and vice versa. So, if your copy of
Brainhat doesn't know how to make a cone, perhaps someone
else's can lend you a script.
Brainhat, the program
Brainhat is both a program and a programming environment.
It executes as a stand-alone application or as a network
daemon. As a program, Brainhat is a development platform
for knowledge and knowledge-based events. As a daemon,
Brainhat is a clearinghouse for knowledge events traded
through an arbitrary number of connections. The Brainhat
daemon may host external links to robots or sensors and
user interfaces, such as speech engines.
The Brainhat environment can include multiple copies of
Brainhat sharing interprocess communication. Within a
Brainhat environment, knowledge can be requested and
forwarded; what one copy of Brainhat knows, the other can
Brainhat can't see or hear, and it only knows what it
learns from interaction, through reading simple English or
from other Brainhats. But, combined with AI from cameras,
haptics, hearing and other senses, it can be the mind of a
system that draws conclusions, reacts, communicates and
changes the extant world. And, it can explain its
decisions. Or, if you need something less, Brainhat can
be a language parser, a human language interface, command
and control for processes or a model for thought and
cognition, and more. I make the piano; you play it as you
There's documentation, two GUIs, lots of QA. It's taking
years to get a release out. But, I plan for something in
The name Brainhat came from a spaghetti collandar with a
chin strap. In the 90s, I heard a story on the radio
about how students at the University of Auckland were
using brainwaves to control light bulbs. That sounded
interesting. I wired a pair of differential amplifiers and
mounted them on top of the collandar. It worked! But I
lost interest. The collandar ended up in a friend's
Questions? Write to firstname.lastname@example.org or follow on social