13.08.2013 Views

State Machines in Artificial Intelligence - Find and develop open ...

State Machines in Artificial Intelligence - Find and develop open ...

State Machines in Artificial Intelligence - Find and develop open ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Giovanni Alestra

STATE MACHINES

IN ARTIFICIAL

INTELLIGENCE

Graph, Hash, Mathematical Inference,

State Analysis

@ Copyright 2010 Giovanni Alestra


to my father

3


Contents

Introduction 7

1.1 Definition and graph representation 8

1.2 Linking data 9

1.3 A real example of graph application 10

1.4 Subgraph 12

1.5 An algoritm to individuate subgraph 13

1.6 Sliding Connections 17

1.7 Filtering connections 18

1.8 Fractal triangle 19

1.9 Keeping a subgraph 19

1.10Query as subgraph 20

1.11Graph programming 22

2.1 Bit definitions 24

2.2 Transcription 24

2.3 Transcription graph 26

2.4 Memory 26

2.5 Transformation 27

2.6 Paths, and circuits 28

2.7 Inverse transcription 30

3.1 Algoritm to calculate the hash of a graph 32

3.2 Counting 34

4.1 Introduction to linked hash 36

4.2 Example of discrimination 39

4.3 Hash links 42

4.4 How to dimensionete the hash space 43

4.5 Identity Transformation 45

4.6 Hash links collision (T,T+1 rule) 45

4.7 Deletion of zero-record 47

4.8 File system 47

4.9 Identity table 48

5.1 Mathematical problem representation 49

5.2 First examples of mathematical deduction 52

5


5.3 Further examples of mathematical deduction 55

5.4 Structured Pieces 57

5.5 Reaching the goal (checkmate) 60

6.1 States of the problem 63

6.2 Invariance 65

6.3 Problem setting 66

6.4 How to demonstrate a rule 67

6.5 Forcing variant 67

6.6 Real states of problem 70

6.7 A mate variant 70

6.8 Objective functions 61

6.9 All in a number 72

6.10Considerations 72

7.1 Reasoning with graph 73

Conclusions 75

6


INTRODUCTION

The aim of this book is to build and implement intelligent state machines for the

information management, The data structure, the memorization and inference

techniques are proposed in order to have and effective implementation in real

contexts, another purpose of this book is to explore states computing and to obtain

notable advantages in application development. We are going to show a coherent

and realizable theory that can improve the knowledge of engineers. The reader can

further contribute to the content of this book in order to bring this project in to

reality.

7


PART I

DATA STRUCTURE

CHAPTER 1 : GRAPH

1.1 Definition and graph representation

A graph is defined as Set ( Vertices, edges ) where the edges connect the vertices. A

graph is represented matematically in the form of matrix VxV in witch each entry

is either zero and one. If a connection exists between vertexs i and vertex j a one is

present at position (i,j) in the matrix. If connection between thes vertices does not

exist we write a zero at position (i,j). If a connection exists between i and i, at

8


position (i,i) we have a one, and this is possible for all vertices. It is easy to

individuate this kind of connection from-to the same vertex looking for the values

on the diagonal. An example of graph is :

In this example graph, bi-directional edges are represented like an edge without

arrow, in the graph, but it's evident that we have two different values in the

matrix..

1.2 Linking data

In ooperations research the values in the matix are tipically associated with the

flow from a vertex A to a vertex B. In this book the approach to the assocition of

data in edges and vertices is different The reason is simple, we want to have the

possibilty to associate an indeterminate number of information to verteces and

edges.

We can connect more than one information to verteces and edges and this data is

9


stored in two different tables. The first table is about the information connected to

verteces, where we have the vertex identifier and the list of information associated

to the vertex. In the second table we have the edges, each of witch has an identifier

formed by the union of origin vertex identifier and the destination vertex

identifier . For every edge there is a list of information associated with the edge.

1.3 A real example of graph application

Suppose we have an application for travelling. For example a travel agency

operating in Italy, with many travel destinations. For example:

10


We can model this situation through a graph, in which we have the state, the

regions, the provinces and the tourist places. In this graph are also present airline

compani train and buses operating between these places. We can model all

problems wtih the aid of a graph and create a tool application for maintenance of

the travel to tourist places. This application assist the user with addinf, modify or

deleting routes and tourist places. We can paint the following graph to represent

this problem. :

We interpose a node between two places, that indicates how we can travel (by

airbus, train or bus) and we have another edge and node in witch indicating

running time / travel time in order to have a complete inference about time of

departure and travel time.

11


Throught such a graph we can query the system with the following question :

– How can I travel from Trapani at 7 a.m. to Milan at 8 p.m. ?

The query has as response something like this :

You can go:

from Trapani to Palermo at 9:00 o'clock by Train ,

from Palermo to Pisa at 12:00 o'clock by Airbus,

from Pisa to Milano at 5.30 p.m. by Train arriving at 7.30 p.m.

...

The inferntial engine can be builded using algoritm that finds subgraphs. This

concept is shown below. By simply adding vertices and edges we can model any

kind of situation.

1.4 Subgraph

A subgraph is a graph with this property : Set ( V, E ) Subgraph = Sub Set ( V, E )

graph. A subgraph is a selection of graph vertices with a selection of edges related

to selected vertices. If we have data linked to vertices and edges the information on

the subgraph must be a selection of the information of the related vertices and

edges.

12


also if the concept is simple, findind a subgraph is a complex problem. Hereafier

we show an algoritm that helps finding a subgraph in graph. Identifying a subgraph

is a fundamental operation in graph theory.

1.5 An algoritm to individute a subgraph

Suppose we have a graph and a subgraph :

The algorithm to find a subgraph in a graph operates like this. At the first step we

select a vertex in the subgraph. The selection can be random or intelligent. A

random selection can select for example the vertices with information B, an

intelligent selection is the node A. In this example we operate in intelligent way. If

we have selected the vertices with information A we must find all vertices with the

same information in the graph. If we cannot find vertices with the same

information we cannot create any hypothesis of association between the vertex and

the algorithm terminates with fault. In our example we have an only vertex with

information A, so we have the hypothesis:

H:[10=1]

At the second step we select for each hypothesis the connection with vertices that

are not in the hypothesis. We call connection an edge with the destination vertex.

Now we enumerate the connection by information of edge and information of

13


destination vertex. We have these connections :

A → B with multiplicity 3 in graph and subgraph

A → D with multiplicity 1 in graph and subgraph

A → E with multiplicity 1 in graph and subgraph

If a multiplicity of subgraph is greater of a multiplicity of a graph the algorithm

terminates with fault. If this does happen, with must associate the combinations of

vertices of graph and subgraph. In this example we have:

A → B

[2=11; 3=12; 4=13]

[2=11; 3=13; 4=12]

[2=12; 3=11; 4=13]

[2=12; 3=13; 4=11]

[2=13; 3=11; 4=12]

[2=13; 3=12; 4=11]

A → D

[6=15]

A → E

[7=16]

The final hypothesis are:

[2=11; 3=12; 4=13; 6=15;7=16]

[2=11; 3=13; 4=12; 6=15;7=16]

[2=12; 3=11; 4=13; 6=15;7=16]

[2=12; 3=13; 4=11; 6=15;7=16]

[2=13; 3=11; 4=12; 6=15;7=16]

[2=13; 3=12; 4=11; 6=15;7=16]

14


At the next step we repeat the previous step looking for those vertices not present

in the hypothesis. In this case we have only one connection:

B → C

For the first hypothesis we have:

[2=11; 3=12; 4=13; 6=15;7=16] [5=14]

for the second hypothesis we have :

[2=11; 3=13; 4=12; 6=15;7=16] [5=14]

the other hypothesis has a fault:

[2=12; 3=11; 4=13; 6=15;7=16] [ 5=/ ]

in fact if we associate the vertex 3 to vertex 11 there are no desired connections.

Finally we have:

[2=11; 3=12; 4=13; 6=15;7=16] [5=14]

[2=11; 3=13; 4=12; 6=15;7=16] [5=14]

[2=12; 3=11; 4=13; 6=15;7=16] [5=/]

[2=12; 3=13; 4=11; 6=15;7=16] [5=/]

[2=13; 3=11; 4=12; 6=15;7=16] [5=/]

[2=13; 3=12; 4=11; 6=15;7=16] [5=/]

At this point we have no vertex without hypothesis and we can perform the

matching step within the matrix where the identifier has changed according to the

hypothesis

H 1 : [2=11; 3=12; 4=13; 6=15;7=16;5=14].

15


Matrix: Graph-Subgraph

Since the matrices are the same we have found a subgraph.

H 2 : [2=11; 3=13; 4=12; 6=15;7=16;5=14].

Matrix: Graph-Subgraph

The matching is negative which means that we do not have a subgraph for this

hypothesis.

16


1.7 Sliding connections

A sliding connection is a connection of one or more edges that connect two

verteces with defined information. For example:

The sliding connection indicates a connection of one or multiple edges that connect

the vertex with information A to the vertex with information B. Suppose we have

the following graph:

The resulting connection is composed by two connections: A → X and X → B

We have two different kinds of sliding connections: kind 1 and kind 2. The kind of

connection is indicated in the graph by a number above the connection, like this:

With the connection of kind 1 we are able to find only the first occurrence of the

destination vertex, while with the connection of kind 2 we are able to find all the

occurrence of destination vertex. For example:

17


.

The connection of kind 1 finds only the first occurrence of connection between A

and B, the connection of kind 2 find the first and the second occurrence of

connection between A and B.

1.9 Filtering connections

Different informatuib can be associtated to an edge. If information is associated to

a sliding connection it occurs that only compatible connection can be selectedith

sliding happen that only compatible conncetion can be selected. We call this

concept “filtering connections”. This example shows the concept:

The concept is simple, filtering connection means to select only edges having the

18


information of the sliding connection. This is really useful, indeed since we can use

a simple sliding connection without information if we want to select all the edges,

and adding information if we want a selection with major semantics.

1.8 Fractal triangle

The fractal triangle is often shown as a game of intelligence and used to

determinate the I.Q. of humans. By the use of sliding connection we can solve the

problem to determinate how many triangles are present in a fractal triangle. The

problem is to find subgraph with sliding connection of kind 2. The number of

subgraphs that we find is the number of triangles in a fractal triangle.

The image shows the subgraph definition and the fractal triangle.

Finding subgraphs we find the number of triangles in the fractal triangle.

1.9 Keeping a subgraph

When we solve a sliding connection we can keep all vertices that are in the path

from origin vertex to the destination vertex. This operation is called “Keeping a

Subgraph”. Keeping Subgraph is really useful and adds notable power to our

19


system. For example:

The resulting subgraph is:

We show by an example the power of keeping subgraph. We recall the first

example in this book.

1.10 Query as a subgraph

In the first example we showed how to model a travel problem by using a graph.

Now we show queries mat be represented as subgraphs with sliding connections h

sliding and the query respose may be obtained from a graph..

20


Suppose we want to go from Trapani to Pisa. The query graph is this subgraph:

The response of the query is the keeping graph:

To have a string as response with the calculation of the correct travel time we need

a graph programming, a programming with function to visit the graph and extract

information about the problem. In order to make the reader able to program using

graph functions, it is necessary to discuss a bit graph programming.

21


1.11 Graph programming

To implement graph programming functions we need a software library with the

following methods :

1. Editing Graph

2. Finding Subgraph

3. Keeping Subgraph

4. Surfing Subgraph

Editing a graph is a graphic tool; Finding a subgraph and keeping a subgraph are

two algorithms. Surfing subgraph is a system using cursor as pointer to point a

vertex can surf throw the edges and keep information about vertices and edges.

The complete program solves the travel example like this:

MAIN FUNCTION

1. Print “Start Form:”; Input StartPlace;

2. Print “At:”; Input StartTime

3. Print “To:”; Input ToPlace

4. Graph Query = new Graph (StartPlace, 1);

5. Query.AddConnection (1, SECONDKIND, “” , 2 );

6. Query.AddDataToNode ( 2, EndPlace );

7. Graph[] KeeptedGraph = FindAndKeepSubgraph ( MainGraph, Query );

8. For Each KeeptedGraph KG { SolvePath ( StartPlace, StartTime, KG,

ToPlace ); }

9. End

SOLVEPATH FUNCTION : String SolvePath ( String StartPlace, Time StartTime,

Graph KG, String To Place )

10. if (StartPlace==ToPlace) Return “.”;

11. Cursor P = KG.FindVertex ( StartPlace );

12. String By; Time UsefulTime

22


13. Return “From “ + StartPlace + “ by “ + GetInformation ( Cursor.moveTo

(NEXT) , StartTime, By, UsefulTime + “ At “ + UsefulTime + “ To “ +

(ArriveAt=Cursor.moveTo (NEXT).GetData()) + “\n” + SolvePath

( ArriveAt, UsefulTime, KG, ToPlace );

14. End

GETINFORMATION FUNCTION : void GetInformation ( Cursor C, Time

StartTime, String & By, Time & UsefulTime )

15. String[] Inf = C.GetData();

16. int FirstRun = null;

17. for ( int i = 0; i < inf.lentgh(); i++ ) { if ( Inf[i] == “Train” ) By= “Train

else if ( Inf[i] == “Airbus” ) By = “Airbus”; else if ( FirstRun == null }

FirstRun = Inf[i]; else if ( FirstRun > Inf[i] ) FirstRun=Inf[i]; if

( StartTime < Inf[i] and (Inf[i] < UsefulTime or UsefultTime == null ) )

Usefultime = Inf[i]; }

18. if ( UsefulTime = null ) UsefulTime = FirstRun; //Next day

19. Return

20. End

So our example is completely solved

Start From: Trapani At: 8:00 To: Pisa

– From Trapani by Airbus at 8 a.m. To Rome, From Rome by Airbus at 12

a.m To Milan From Milan by Train at 3,30 p.m. To Pisa

23


CHAPTER 2 : SEMANTIC GRAPH

2.1 Bit definitions

A bit definition is associated to information of a single vertex or a single edge. If

we have a vertex with defined information we can add a semantic information. For

example, we can associate a unique semantic information to different vertices

:

The semantic information added means that the vertex is a delimitator.

Conventionally we indicate this concept with the simbol -|-. Bit definitions are very

fast to solve and can be applied to vertices and edges. They are really powerful in

the transcription process..

2.2 Transcription

A transctipyion is a continuous process of finding subgraphs to whom vertices and

edges are added, since we have a complete representation characterized by

impossibility to find subgraphs not transcripted before.

24


y transcription, semantic informatuin is added automatically to a graph and it is

very powerful in creating graphs with regularity that are fundamental in our

system.. Suppose we have defined a set of graphs with respective processes of

adding vertices and edges as following picture:

Based on these definitions the following graph:

is transcripted with the next one graph:

25


The first graph, the graph without transcription can be created automatically from

assertions. For example the assertion :

– Set Colours ( Red, Green, Blue )

The graph transcripted has a regular structure and a major semantics of the simple

assertion graph. Now we show how a defined graph or a transcription of a graph

can be associated to a simple expression or to a simple subgraph.

2.3 Transcription graph

A graph composed of more graphs is called “Transcription graph”. The

transcription graph definition is a list of graphs that we find in the transcription

process. By the transcription graph definition we can get all the structure of a

transcripted graph and so is more useful as we show the next paragraph.

2.4 Memory

When we find a subgraph we can link this subgraph with a graph in memory. This

is a process of associative memory and is very powerful in analysing the meaning

of an assertion. For example we can associate to the simple graph Set Colours the

entire transcription of the Set Colours shown before:

26


In this way, when we have an assertion or a representation of reality, we are able to

recall a great number of concets in order to have a good inference or an upgrade of

the knowledge of our system.

2.5 Transformation

A transformation is a process associated tipically to the recognition of a subgraph

or to a command called trigger in a session of graph programming. A

transformation modifies a graph by adding or deleting vertices and edges. The

concept of transformation is very easy to understand by an example. An example of

transformation can be the deletion of the last element of a SET.

27


Associated with assertion :

It is evident that the process of transformation is a process of graph programming

that must be implemented, but more complex processes can be obtained by the reuse

of transformation functions. For example the delection of all elements of a set

can be considered as the iteration of process of deleting the last element since the

set is empty.

2.6 Paths and circuits

If we delete a vertex of a graph we obtain a minor of a graph but in the process of

deleting vertices and edges we can compromise the structure of the graph.

28


This problem can be solved by the definition of paths and circuits. Paths,and

circuits are graphs having tipically sliding connections and their definition can

solve the problem of maintenance of the coherence of the graph. We show the

concept by an example. Suppose we want to delete the second element of a set. We

obtain a graph like the previous : If we define two subgraphs with sliding

connection like this :

We obtained the graph

By the fusion of two consecutive delimitators we have:

29


The circuits are graphs with sliding connections having circles. The concept is the

same, we can define paths, and circuits to have the maintenance of the structure of

the graph after deleting of vertices and edges.

2.6 Inverse transcription

The inverse trascription is the process to extract a string from a graph. If the graph

has a regular structure the inverse transcription can be a composed function. How

to define an inverse transcription is a problem of graph programming. Now we are

going to explain the concept. Suppose we have the graph:

We want that the output of the inverse transcription is:

– The Set Colours has the elements : red , green , blue

we can easily define a function for the inverse transcription like this:

1. Graph ITSubgraphs = FindSubgraph ( MainGraph, TranscriptionOfSet )

2. If ( ITSubgraphs == null ) Return

3. For Each ITSubgraph SET { InverseTranscriptionOfSet ( SET );

FUNCTION InverseTranscriptionOfSet ( Graph SET )

4. Cursor C = SET.FindVertex ( “Set” );

30


5. Print “The Set “; String ( C.moveTo ( “NEXT” ) ); Print “ has elements : “

6. Graph FirstElement = FindSubgraph ( FirstSetElement );

7. Cursor E = FirstSetElement.FindVertex ( “Sete”);

8. PrintElementsOfSet ( E )

FUNCTION PrintElementsOfSet ( Cursor E )

9. Print String ( E.moveTo ( “Begin” ) );

10. E = E.moveTo ( next ); if ( E == null ) return else { Print “,”;

PrintElementsOfSet ( E );

11. End

The library function String prints the String between two delimitators.

31


CHAPTER 3 : HASH OF A GRAPH

3.1 Algorithm to calculate the hash of a graph

It is possible to calculate the hash of a graph with a simple algorithm. We indicate

in this book the hash of a representation with a letter between two pipes like this:

Hash = | R |. If we use a function based on trucament we have this property :

| x 1 + x 2 + ... + x n | = | | x 1 | + | x 2 | + | ... | + | x n | |

This expression can be read as the hash of sum that is equal to the hash of sum of

the hash and introduce the commutative property of the sum to the sum of the hash.

Based on this function if we have a graph like this, we can calculate the hash on

this way :

In the first step of the algorithm we change the rows and columns and associate the

vertex idenfifier to the values, from major to minor or viceversa, of the hash of the

information linked to the vertex. We can see that there are values of hash that are

equals. In this case we must calculate all combinatory association between

32


idenfier and values. Finally we apply the hash of the hash sum calculate the final

hash value of the graph. Now we show an example of application.

In the first step we associate the identifier to the value of the hash of information

from the minor to major.

H : 0403 : O → C

H : 3789 : O → B

H : 8532 : O → A

H : 9111 : O → D

we can have a first association of vertices like this:

[1=2] , [ 2=1; 3=3; 4=5] , [5=6; 6=7], [7=4]

The matrix changes on this way :

Now we must calculate all combinatory associative combination as:

[1=2] , [ 2=3; 3=1; 4=5] , [ 5=6, 6=7] , [ 7=4 ]

[1=2] , [ 2=3; 3=4; 4=3] , [ 5=6, 6=7] , [ 7=4 ]

...

33


[1=2] , [ 4=1; 3=3; 2=5] , [ 5=7; 6=5 ] , [ 7=4 ]

We show the last combinatory association as follows. Every association as an hash

that is component of the final hash of the sum of the hash.

For the last combinatory association :

[1=2] , [ 4=1; 3=3; 2=5] , [ 5=7; 6=6 ] ,[ 7=4 ]

we have this matrix :

The final value of the hash is : | |4333| + |...| + …. + |...| + |2121| |.

3.2 Counting

Pratically, without the counting process we are not able to apply the algorithm

shown before because the combinations of combinatory process, in case we have a

number of information replied around twenty, are too much to computate. With the

counting process that consist in the association of a numeric information to the

vertex having equals information, the problem can be solved. Suppose we have the

Set graph, we can add the counting information so :

34


The counting is a graph programming process very easy to implement but having

fundamental function.

35


PART II

SPACE OF STATES

CHAPTER 4 : LINKED HASH

4.1 Introduction to linked hash

If we have a graph or a representation we know how to calculate correctly the hash,

and this representation is related to a logical context characterized by logic

transformation; we can store the evolution of the states of the logical representation

just by storing the hash value of all states and linking these values toghether.

36


Suppose, for example, we have a chessboard and we want to memorize the opening

moves for chess game. We can operate in this way :

We see that the hash value is composed of :

| | Transformation | + | Transformed Representation | |

We can delete the reppresentation and leave only the hash linked. Suppose we have

a structure like this, in which we have multiple values of the same hash related to a

different rappresentation.

37


How can we determinate if a representation is related to one of the multiple hash

values ?

An example of collision can be this :

To determinate the hash relative to actual representation we can take into account

the following logical steps. If the hash correctly corresponds the first value to |234|,

(the value on the top), then a trasformation that produces |987| must exist. If such

trasformation exists the transformed representation releated to |987| may be further

transformed to obtain |864|. It is possibile to visit the entire structure with certain

pair to :

Hs is the Hash space tipically 2 k

m

Hs m /∏ T i

i=1

, m is the number consecutive link we

analize and T i the number of possible trasformation of each step.

The error rate is equal to :

38


m

Hs m /∏ i=1

Ti −1

We can set the error according to our task, for example 10 −10

4.2 Example of discrimination

Suppose we have a situation like this :

Suppose we have a chessboard in the initial configuration.. In order to discriminate

the hash |234| we operate in this way : We calculate all possible transformation of

the representation, and apply the rule we learn above. If the representation is really

what we search, there must exist a transformation that produce |987|. The appliable

transformation produces hash |987|, |877| and again |987|. I this case we can

observe a collision. Applying the same rule we are able to discriminate in this

case :

.

39


How we can see, there exist two transformation having the desired value. For the

discrimination of the two, we calculate the transformation for each one :

Possible Transformation of : d2-d4


41

The existence of the desired transformation is evident. Now we can see that the

disired information for the other representation does not exist.

Possible Transformation of : c2-c4

We have shown how the discrimination process works. And we have to

demonstrate the formulas of centain and error that we remember are :

and

m

Hs m /∏ T i

i=1

m

Hs m /∏ i=1

Ti −1

After the analysis of ten links we have a certain around : 20 10 and the error rate

is around 1/20 10

.

41


4.3 Hash links

We can realize hash links and create a simple record for every reppresentation we

want to store in our system composed by the hash of the representation and the

hash links. We can realize hash links by the use of four prime numbers two, three,

five and seven.

Suppose we have a structure like this :

For each level of the tree we have a repetition of the sequence : two-six-three-six.

To delete the link you need operate as follow:

42


We have a connection between two representation if there exists one and only one

prime number common in the hash link and the hashes of the link sre different If

we want to delete a connection we can insert another prime number like five or

seven. The number of bits necessary for the implementation are four.

4.4 How to dimesionate the hash space

The record space is the number of records (hash) we can store in memory. It is

related to the memory and to the number of bits necessary to store a record. The

hash space must be dimensioned using this formula :

Hs≫T max∗Rs

43


T max is the maximum number of transformations applicsble to the

representation. We can call dim the ratio :

so that Hs=dim∗Rs .

dim=Hs/Rs

When we operate the hash of link the certain and the error rate change. The

certain,in the worst case, is equal to :

m

Hs/N r m /∏ i=1

2∗T i

N r is the number of records stored in a memory. If the hash space has been

dimensionated correctly, then we have:

and error rate is equal to :

If N r=R s we have:

R s / N r m ∗dim m /∏ 2∗T i i=1

R s / N r m ∗dim m /∏ 2∗T i i=1

−1

m

dim m /∏ i=1

m

m

2∗T i .

.

44


4.5 Identity Transformation

The identity transformation associate another hash value based to a transformation

that modifies the representation in order to obtain a different hash value. We

indicate the identity transformation as :

Identity=∣T R∣

In this way an inderminate number of identity hash values can be associated to a

transformation doing more transformation of tranformation. For example :

Identity=∣T T R∣

4.6 Hash links collision (T, T+1 rule)

When we store in memory a record composed by the hash of representatio and the

hash of links it could happen that the record is stored have hash representation

equals and different hash links. In this case we must not store the record in a

memory and we must apply the T, T+1 rule. This rule says that we can store the

record using an identity transformation for the hash of the representation in order

to not have collisions. So we must define an algorithm for the correct storiang. I

want to explain the algorithm with an example.

Suppose we have an empty record space.. We can store the first record as follows.

00100110010-0001

At this point we must store another record that is composed by the identity

transformation hash value, by the zero in the hash of links.

10101001010-0000.

This last record is called zero-record. The rule says that if we have a

representation R 1 its transformation R 2 is related to R 1 if and

45


only if the Identity transformation of R 2 ,is stored as a zero-record.

Suppose we have another record we want to store and we have an hash links

collision :

00100110010-0001

10101001010-0000.

00100110010-0101

in this case we cannot store the record but we store its Identity transformation and

we add a zero record with the identity transformation of the identity

transformation.

00100110010-0001

10101001010-0000.

01110110010-0101

11010101010-0000

Suppose we have the hash relative to the first record have stored in a memory.

Applying the rule we can determinate its relation. If we have the hash relative to

the second record stored in memory, the rule has negative result for the first record.

In fact the identity transformation of the second record is not a zero-record, but it is

the record we are searching. So we can consider it as hash related to the

representation if its identity transformation is a zero-record.. So we can reassume

that the T,T+1 rule, say that in order to stare a record we must to find a

transformation or an indentity trasformation with this storing property :

T R=Unique ,T 1 R=Unique

T+1(R) is the zero-record. When we want to discriminate the relation, we must

apply the same rule :

∃T R ,∃T 1 R as zero−record

46


4.7 Deletion of zero-record

When we have stored all the records in memory we can delete the zero records.

The T,T+1 rule changes and become:

∃T R not zero−record , not ∃T 1 R

Not all zero records can be deleted, Suppose we have a record:

000101001010-0000

and we cannot store the record :

000101001010-0010

so we store the records based on identity transformation and T,T+1 rule:

011110101101-0010

10001010100-0000

So the forst zero-record is not deletable, while the last zero-record is deletable. We

can mark the deletable of a record using a bit.

4.8 File System

The file system is structred as follows. The file name is the most significative bit of

the hash of the representation.

In the file we have the remaining bits of the hash of representation with the four

bits of the hash of links. The physical or logical position of the record represents

the identifier:

File Name : 1011010101111010001010111

47


01011111-00000011

11101010-00000110

11100001-00001010

11101010-00001010

The values are not sorted because the phical or logical position is the identifier, but

we can have multiple values of the same hash relative to different representation.

We know how the system works. If we want to use a database engine and a

database table to store the records, then the identifier can be a primary key.

4.6 Identity Table

We know that the hash value is composed by the sum of two hash values :

| | Transformation | + | Transformed Representation | |

So two equal representations can be a different hash because they have different

transformations. In this situation we use a table called “Identity Table”, that

indicates two hashes have the same representation. The Identity Table is so

composed :

The identity table and his processes about are fundamental for finding a solution

for loop problems in recursive process.

48


PART III

LOGICAL INFERENCE

CHAPTER 5 : Mathematic demostrations

5.1 Mathematical problem representation

Through a methematical problem representation we can solve a problem using the

mathematical logics taht is int the mathematical formulas. We are going to analize

chess inferences.

49


mathematical representation that consists in formulas about possibile moves of

pieces, and concept about the winning or losing. After we have the mathematical

representation is evident that we can apply all mathematic theories, proofs and

algebra.

We analize a chess final, the final of rook composed by the interaction of two

pieces, king and rook of a colour, and the only king of the opponent. The formulas

express that the possibile moves are :

Possible Move of King:

X k t1=X k t∏ 1

b

a

−1∗X j ∗T :1 X k t18

Y k t1=Y k t∏ −1∗Y j∗T :1Y k t18

1

with a∈[1,2]

with b∈[1,2]

with 1 X jY j2with X j∈[0,1]∧Y j∈[0,1] with T ∈[0,1]

a indicate the direction of moving to the left or to the right

b indicate the direction of up or down movement

X j indicate if we want to move on the selected direction to the left or to the

right

Y j indicates if we want to move on the selected direction up or down

1 X j Y j 2 means that we must move in one of the selected directions

T indicates if we can move or if the opponent can move

50


Possible Move of Rook:

X r t1= X r t X d ∗a∗1−T :1 X r t18

Y r t1=Y r t Y d ∗1−a∗1−T :1Y r t18

with a∈[0,1]

with−7 X d −1∨1 X d 7

with−7Y d −1∨1Y d 7

with T ∈[0,1]

a indicates the perpendicular or parallel direction

X d is a discrete number that indicates how many positions we want to move

Y d has the same function of X d

T indicate if we can move or if the opponent can move

The concept about winning or losing is the possible capture of the pieces. We have:

The King captures the Rook

X k t1=X rt ,Y k t1=Y rt

The Rook captures the King

X rt1=X k t ,Y rt1=Y k t

51


This is the representation of the problem. After the representation we are able to

deduce matematically rules for the game.

5.2 First examples of mathematical deduction

With the first example, we introduce a fundamental concept called : “Condition

sine qua non”, that is a condition taht can be used in the reasoning process. We

want to deduce when a rook can capture viceversa. For humans the concept is very

simple and obvious, but the computer needs to do a mathematical computation to

understand when it is possible.

In the first example we can find the answer of when the rook can capture the king

by solving this formula :

X r t ∗T X r t1∗1−T = X k t∗1−T X k t1∗T

and

Y r t ∗T Y r t1∗1−T =Y k t∗1−T Y k t1∗T

that for T =0 becomes :

X r t =X k t1∗T

Y r t =Y k t1∗T

and for T =1 becomes:

X r t1= X k t

Y r t1=Y k t

we must analize all the combinations of possible variable state in order to find the

conditio sine qua non.

Case T =1

52


X r t X d ∗a= X k t

Y r t Y d ∗1−a=Y k t

Case a=0

X r t =X k t This is a condition IF

Y r t Y d =Y k t

Case a=1

X r t X d = X k t

Y r t =Y k t This is a condition IF

The conditions we have found are conditio sine qua non.

We have the first answer : it is possible to capture the rook if T =1 and

X r t =X k t or Y r t =Y k t .

It is clear that for T =1 it is not possible to capture the king.

A second example is the possible capture of the rook by the king.

a

X k t ∏ 1

b

Y k t ∏ 1

−1∗X j ∗T = X r t

−1∗Y j ∗T =Y r t

we analize only the case that T =0

Case a=1 b=1 X j =1 Y j =0

53


X k t −1= X r t X k t= X r t 1

Y k t =Y r t

Case a=1b=1 X j =0Y j =1

X r t =X k t

Y r t −1=Y k t Y r t=Y k t 1

Case a=1 b=1 X j =1 Y j =1

X k t −1= X r t X k t= X r t 1

Y r t −1=Y k t Y r t=Y k t 1

Case a=2 b=1 X j =1Y j =0

X k t 1= X r t X k t= X r t −1

Y k t =Y r t

Case a=2 b=1 X j =0Y j =1

X r t =X k t

Y r t −1=Y k t Y r t=Y k t 1 equals to previous case

….

By the complete analysis of the combination we find eight positions in which the

rook can be captured. Now we can deduce that the capture is possible if :

∣X r t− X k t ∣1∧∣Y r t−Y k t∣1

After that we have the inverse concept, that is when it is not possible to capture the

roook..

∣X r t− X k t ∣1∨∣Y r t−Y k t∣1

54


X r t − X k t Y r t −Y k t

-1 0

-1 -1

0 -1

1 -1

1 0

1 1

0 1

-1 1

5.3 Further examples of matematical

deduction

How to move to defence the rook from the attack of the opponent's king ?

We know that a rook can be captured if :

∣X r t− X k t ∣1∧∣Y r t−Y k t∣1

So we can say that we choose correctly :

X d ∧Y d :∣X r t− X k t ∣1∨∣Y r t−Y k t∣1

Another way to solve this problem is to calculate a unique formula derived from

the system of two formulas :

55


X r t1= X r t X d ∗a :∣X r t1− X k t∣1

Y r t1=Y r t Y d ∗1−a:∣Y r t1−Y k t∣1

Case a=0 :

X r t1= X r t X d

X r t11 X k t X r t1=2 X k t X a with X a ≥0

2 X k t X a =X r t X d

X d =2 X k t −X r t X a

X r t1=2 X k t X r t− X r t X a

X r t1=2 X k t X a

Case a=1 :

Y r t1=Y r t Y d

Y r t11Y k t Y r t1=2Y k tY a with Y a ≥0

2Y k tY a =Y r tY d

Y d =2Y k t −Y r tY a

Y r t1=2Y k t Y r t−Y r tY a

Y r t1=2Y k t Y a

The absolute value impose to analize −X d ,−Y d we will find :

X r t1=−2X k t− X a

Y r t1=−2Y k t−Y a

This demonstration shows how we must move the rook in order not to have a

sacrifice. The picture shows the concept :

56


5.4 Structured Pieces

A rook can have a position near the opponent's king, if and only if the capture of

the rook implicates the capure of the king. I want to leave this demonstration to the

reader and write a table for the three cases represented :

X rt=−1 X k1t∧Y rt−Y k t=−1

in this case

57


X k2 t Y k2t

X k2 t= X rt−1 Y k2t=Y rt−1

X k2 t= X rt−1 Y k2t=Y rt

X k2 t= X rt−1 Y k2t=Y rt1

It is easy to demonstrate that in this case reassumed in the table, the opponent king

can move only to a=2, b=2 because if a=1∧ X j=1∨b=1∧Y j=1

we have the capture of the king. I want to demonstrate this inference because it is

fundamental in the process of finding the forcing variant I explain in the next

chapter :

X k1t1=X k1t ∏ 1

Y k1t1=Y k1t∏ 1

a 1

b 1

−1∗X j1

−1∗Y j1

a=1, X j1=1 impossible, and b=1,Y j1=1 impossible. Now we can

consider to solve the problem the position we have found. We must demonstrate

that there exists a possible move of the rook that implies the capture of the rook in

the direction we analyze. Remember that the capture of the rook occurs when :

X rt1=X k1t X r t Xd∗a= X k1t withY rt=Y k1t

or

Y rt1=Y k1tY rtYd∗1−a=Y k1t with X rt=X k1t

58


if

X rt=−1 X k1t∧Y rt−Y k1t=−1

we have

−1X k1t Xd∗a= X k1t with Y rt=Y k1t

solved for X d=1 ,a=1

and

−1Y k1tYd∗1−a=Y k1twith X rt= X k1t

solved for Yd =1 , a=0

We must analize the case : a=1, X j1=1 , in this case :

X rt= X k1t ,Y rt=Y k t−1Y d=1 , a=0 capture.

case b=1,Y j1=1

Y rt=Y k1t , X rt=X k1t−1 Xd =1,a=1 capture

case a=1, X j1=1,b=1,Y j1=1 implicates the capture of the opponent's

king. We have to demonstrate that for T =0 moves the king, and it exists a

position in witch:

X k1t1=X k1t 1

or / and

Y k1t1=Y k1t1

59

59


5.5 Reaching goal (checkmate)

Before showing how we can reach the checkmate in the rook's final , we must

demonstrate when a king cannot move in the opponent's direction. The condition

is:

with: a=1 and X j =1

X k2 t ∏ 1

b2

Y k2 t ∏ 1

a2

a

X k t ∏ 1

b

Y k t ∏ 1

−1∗X j ∗T

−1∗Y j ∗T

X k t −1∗T capture

−1∗X j2 ∗T = X k1 t−1∗1−T

−1∗Y j2 ∗T =Y k2 t∏ 1

b1

−1∗Y j1 1−T

60


The capture is possible when :

we begin analizying the first condition :

X k2 t1∏ 1

we analize for T =0

is solved for :

a2

X k2 t1= X k1 t1

Y k2 t1=Y k t1

−1∗ X j2 ∗T = X k1 t1−1∗1−T

X k2 t =X k1 t−1

b1

Y k2 t =Y k2 t∏ 1

X k2 t =X k1 t−1

Y k2 t =Y k2 t

−1∗Y j1

Indeed, to determine this last formula we analize all possible cases of combination

of the variable b 1, b 2, Y j1 , Y j2 . We can compile a table and verify the only

case possible to capture for T =0 and T =1 in all cases is

Y k2 t =Y k2 t

61


1 Y j1 Y k2 =Y k1 Y k2 =Y k1 −1 Y k2 =Y k1 1

1 0 OK OK OK

1 1 OK OK --

2 1 OK -- OK

2 0 OK OK OK

We can inference that :

Y k2 t =Y k2 t

So the goal of the game can be calculated by this reasoning :

If X k1 =8 a=2, X j1 =1 impossible

if X k2= X k1−1∧Y k2=Y k1 a=1, x j1=1 impossible

if Y r =Y k1 ± 2 X a b=1 ,Y j1 =1 impossible and b=2, y j1 =1

impossible.

This means that there does not exist a ,b , X j1 , Y j1 without capture. The

position is checkmate. The system can calculate automatically the goal of the

game.

62


PART IV

STATE ANALYSIS

CHAPTER 6 : THE PROBLEM SOLVER

6.1 States of the problem

The number of states of the problem is related to all possible configurations of the

pieces. A configuration can be expressed by the use of distance variables. In our

problem we have six significative distances like the following picture shows.

Therefore a state of the problem can be represented by a tuple :

d 1, d 2, d 3,d 4, d 5, d 6

63


All possible states are : 1310848. The next picture shows the significative

distances:

An evalutation of the number of states can be done considering that :

0≤d1≤7

0≤d2≤7

−7≤d3≤7

−7≤d4≤7

−7≤d5≤7

−7≤d6≤7

the number of the states without considering the real possible configurations can be

calculated as follow : 8 2 15 4 =3240000 . In order to obtain the only

consistent configuration of pieces we must add the following conditions:

d1∣d3∣≤7

d2∣d4∣≤7

d1∣d5∣≤7

d2∣d6∣≤7

not d3=0∧d4=0

64


not d5=0∧d6=0

not d5=d6∧d7=d8

In this way we can obtain the number of states we have mentioned above.

6.2 Invariance

Rotationg the chessboard we obtain another one that is logically related to the first

one and we can apply all knowledge about of problem to one or the other

chessboard. This concept is called invariance.

Now we choose the instance of the chessboard where d 1 ∧d 2 are inferior. We

can see that the correct move in this example is Y rt1=Y rt2 .

65


The invariance reduces the number of possible states so that the distances

d3 ,d4 become positive 0≤d3≤7 , 0≤d4≤7 .

In this way have a reduction of the number of possible states.

6.3 Problem Setting

We can represent the problem as a different sequence of possible moves of white

and black pieces. The move of the white pieces is indicated with W i , while the

move of black pieces is indicated with B i . Thus, the interaction of three pieces

two of the same colour and one of a different one can be set as follow :

W i=W 0i ,W 1i:W 0iW 1i=1∗T with w 0∈[0,1] , w 1∈[0,1]

B i=B 0i : B 0i=1∗1−T with B 0i∈[0,1]

T =m mod 2

W 0a , b , X j ,Y j indicate all possible moves of white king

W 1a , Xd ,Yd indicate all possible moves of white rook

B 0a ,b , X j ,Y j indicate all possible moves of black king

we can create two different sequences of movies, one of white moves and one of

black moves :

SW i=[W 0,W 1,... ,W m]

SB i=[B 0, B 1,... , B m]

the index indicates the move, considering T =m mod 2 the sequence has this

structure:

66


SW i=[1,0 ,0,0 ,0,1 ,0,0 ,1,0 ,... ,0,0 ,0,1]

SB i=[1 ,0 ,1 ,0 ,1 ,... ,0 ,1]

a set of possible sequences of moves of white or black pieces are indicated like

this:

SW =[SW 0, SW 1,... , SW p]

SB=[SB 0, SB 1,... , SB p]

6.4 How to demonstrate a rule

In our system we try to demonstrate some rules that can be used in reasoning by

the inference machine. A process demonstrating the rules rules is this :

∃m , SW :∀ SB i∈SB ∃ SW i∈SW goal

In other words we can affirm the existence of a number of moves “m” and a set of

possible moves of white pieces. This implicate that to every move of black piece

corresponds one or more sequences of white moves

6.5 Forcing variant

The forcing variant is the sequence of possible moves that implicate d 1=0 .

The invariance implicates that d 1=0 or d 2=0 , so the forcing variant has

as goal the condition d 1=0∨d 2=0 .Now we must demonstrate the existence

of a number of moves necessary to achieve this goal.

∃m , SW :∀ SB i∈SB ∃ SW i∈Sw d 1=0∨d 2=0

67


The problem solver finds a several number of possible sequences of moves like

this:

68



We can write the formulas we have found based on the distance by this sobstitution

:

X k1=8−d1 ,Y k2=8−d 2

X k2=8−d1−d3 ,Y k2=8−d2−d4

X r=8−d1−d5 ,Y r=8−d2−d6

by this substitution we can inference that the forcing variant is not the function of

variables d 1 , d 2 . For example in the case we have show in paragraph about

structured pieces we have :

X rt=−1 X k1t∧Y rt−Y k t=−1

becomes

8−d1−d5=−18−d1∧8−d2−d6−8−d2=−1

d5=1∧d6=1

69


And the same occurs for the rest of formulas. That implicates the indipendence of

the goal from variables d 1 , d 2.

6.6 Real states of the problem

At this point we can say that the states of the problem are related only to the

condiction: d 1=0∨d 2=0 and the significative distances are only

d 3, d 4,d 5,d 6 . Thus the number of states of the problem is : 10108. The

optimal solution for the rook's final in the chess game are around 10 4

states.

6.7 A mate variant

The mate variant has the condition d 1=0 , and states related to the distances

d 3, d 4,d 5,d 6 . The picture shows the sequence of correnct movies :

70


Therefore we know how the system works to find the solution of the problem. The

number of states is 10108.

6.8 Objective functions

We can analize a problem and insert the distance for the problem solution in every

state. Choosing a state means to select, from the current state,

71


the one having the inferior distance from the solution of the problem. If we have

the same states for more problems we can insert a lot of objective functions in the

states. So a state becomes :

| | Obj. Fun. 1 : Dist. 1 | + | Obj. Fun. 2 : Dist. 2 | … + | Transform. | + | Rapp. | |

6.9 All in a number

We can memorize all the object functions with relative distances, the

transformation and the representation in a number. If we want to move from a state

to another state we must to do the hypothesis related to the distance of all objective

function and not only of the function in which we are interested. In our example we

can operate like this :When we have a representation in order to find the state

stored in memory we must to do an hypothesis about the possible transformation

that produces the representation and the hypothesis of object function distances.

We do not need to use identity table for this application.

6.10 Considerations

The current memory size is terabytes. How many abilities we can store in memory

of terabytes using the methods showed in this book? For a memory of only one

terabyte I evaluete that we can store around 10000000 of abilities of medium

complexity. I think this is the moment to implement intelligent state machines.

72


PART V

HUMAN KNOWLEDGE

CHAPTER 7 : KNOW REPRESENTATION

7.1 Reasoning with graph

When we do not have a mathematic representation of a problem or it it is not

sufficient we can create a system using only graphs or an hybrid system using

graphs and mathematical representations.

73


We know that it is possible to do the hash of a graph so that a graph can be used to

represent a state. If it is possible to have transformation functions of a graph we

can link the hash of graph with the the transformed graph in order to have a state

machine that solve a problem. These methods use massively graphs and subgraphs

with sliding connections. The nature of the problem is determinable by the kind of

subgraph and it's combination found in the graph of the problem. Methods like

transcription are more useful, and we can apply all graph theories. The problem

solver by using graph is simple and it is related to abstaction of graph in witch

trannsformations are applicable.

74


CONCLUSIONS

At the beginnig of the present work we explained how a data structure like a graph

can be used for the representation of real world. If we can apply a hash operation

on a representation in order to store his evolution through different states then we

can build a stete machine. Applying mathematical logics to inference rules and

goals assists in solving mathematical representation problems. The number of

states of a problem can be reduce by identifying subgoals, rules and inference

methods. If a mathematical representation does not exist and we need knowledge

concerning the problem we can use graphs as literature to teach.

In an only server using memory of several terabytes we can store a great number of

problems solutions. Which i's the most important success of this theory. How to

build the inferential engine requires an entire book for the game game and a lot of

books for problems of different nature.

75

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!