Tetranary Logic.
Logic for self programming software or hardware.
I could have cold this 'Quaternary logic' but this term is already occupied for calculation with two bits, boolean operations with two bits at a time, and interfacing integrated circuits with four different stages.
The logic that I want to present here is not meant for quantative operations, but for the programming of the logic in a learning proces.
The values that it works with are:
? (means don't know)
+ (means: the answer is positive)
- (means: the answer is negative)
X (means: the answer is 'yes and no')

To give an exemple: A person arives in a rainy land as The Netherlands and wants to find out under what condition there will be a rainbow in the sky.
He thinks it has to do whith rainy waether and sunshine. He makes a truth table and wants to fill out the experimental data in the table. His table lookes like this:
rainy wheather
 noyes
sunlightno  
yes  
Now the person wants to fill out the table. He goes outside and it is night and no rainy wheather so he fills out a - in the first open cell. He would have put a + there if he had seen a rainbow. Here I would say there are three possible values for each cell, because at the start they were all blank. This situation were no value is given I want to code with a '?'.
Now after some time he will have his table filled out with a '-' in the four cells.
Than one day he walks outside and he sees a rainbow. There is sunlight and it is rainy wheather. He wants to put the information in the truth table, but that cell is already filled with a '-'. Now what to do. He can change the '-' in a '+', but than there's a good chance he has to change it in a '-' again the next day, and the information would be lost. Actually he had to fill out a '+' and a '-' in the cell. The correct answer has to be 'yes and no'. There is no word for this in the English language. In German they have a word for this. It is written as 'jein' (pronounced as yein).
The problem with the English 'yes and no' is that when a politician says it one could think he answerd 'yes' and he answered 'no', while in German it is very clear that he neither answered 'yes', nor did he answer 'no'.
This 'X' value is a very different value than the '?' value, because '?' means you don't know because you don't have the information to decide whether the answer is yes or no, while 'X' means you know it can be yes and it can be no.
This brings us to the four values in a real truthful truth table.
Note that a '?' can change in a '-' or a '+', and a '-' and a '+' can change in a 'X'.
Other changes are not possible without a loss of information.
  The value of B is now: =
Memory cells-+

  The value of A is now: =
-
+

Teach input value is =
The output is now:
representing: