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 the princess then the animal is happy.
>> the dog sees the princess
 the dog sees the princess. the dog is happy.
>> the cat sees the princess
 the cat sees the princess. the cat is happy.

Inference templates can have as many as four conditions and four consequences.  Here is an example with three conditions and two consequences:

>> if the cat sleeps and the dog sleeps and the bird sleeps then i can sleep and you can go home
 if the cat sleeps and the dog sleeps and the bird sleeps then You sleep and I go home.
>> the cat is sleeping
 the cat sleeps.
>> the bird is sleeping
 the bird sleeps.
>> the dog is sleeping
 the dog sleeps. You sleep. I go home.

Inferences can chain, meaning the results of one can immediately feed another:

>> if i am happy then you are sad.
 if You are happy then I am sad.
>> if i see a toy then i am happy.
 if You see a toy then You are happy.
>> if i am at the beach then i see a ball.
 if You are at the beach then You see a ball.
>> if the weather is hot then i am at the beach
 if the weather is hot then You are at the beach.
>> the weather is hot
 the weather is hot. You are at the beach. You see ball. You are happy. I am sad.
>> why
 I am sad because You are happy.
>> why
 You are happy because You see ball.
>> why
 You see ball because You are at the beach.
>> why
 You are at the beach because the weather is hot.

When concepts in the inference template are the similar, we have to differentiate them (make them orthogonal) with attributes.  Here's a simple example.  There are two dogs in the template.  We use colors to tell them apart:

>> if a red dog sees a yellow dog then the red dog barks and the yellow dog runs
 if a red dog sees a yellow dog then the red dog barks and the yellow dog runs.
>> the red dog sees the yellow dog
 the red dog sees the yellow dog. the red dog barks. the yellow dog runs.

Naturally, we don't want to have to create inference templates for every possible combination of dog.  We can make templates more general by enumerating the concepts in the inference template with attributes like "former" and "latter" or "first" and "second":

>> if a thing is near another thing then the latter thing is near the former thing
 if a thing is by another thing then the thing is by the prior thing.
>> dog is near cat
 dog is by cat. cat is by dog. dog is by cat.
>> where is dog
 dog is by cat.
>> where is cat
 cat is by dog.