ESC (Chomik based Expert System)

Chomik based Expert System (Esc) is an expert system written entirely in the Chomik programming language. It deals with the application of the pythagorean theorem, but can be generally applied as an extension of the OOP technique. It is not finished yet.

Rationale

Ever wondered why the OOP based programming languages like C++ or Java are not suitable for expressing certain mathematical concepts? For example the identity - are two objects (in OOP) that contain exactly the same attribute values are they equal or not? The C++ default operator== would say they are equal, but how come they exist in two copies? Or more? Another example - the existance. Can we consider an object that does not exist? In OOP we can only instantiate it, and then it seems to exist. What if we define something that cannot exist? How to define something that exists, and is very well defined, but cannot be constructed? What about the constructability? We know objects that exist and in principle could be constructed (like the decimal representation of the PI number), but cannot be constructed in finite time, with finite resources. Or within reasonable time. What about the constructability of the code? Yes, there are some interpreters with the "eval" function, but we are still far away from manipulating code otherwise than asking a programmer to do it. How can we program in languages that do not deal with these simple mathematical concepts? None of them does. Fortunately there is Chomik with the powerful recursive enumeration types, which allows putting more knowledge into the actual program, rather than keep it in the programmer's heads only. At least more than the classical OOP.

How it works

Download and unpack the Esc tarball. Configure it (./configure) and type "make run". In the file main/domain_knowledge.chomik you will find the description of the problem - a classical case with the pythagorean theorem application. The user stores some info about the classes (like "triangle" or "length" or "sum") and objects ("ABC", "AB", "length of AB", "BC", "length of BC", "CA", "length of CA"). Also the informations that the objects/real numbers defined exist. Then the program iteratively defines new real numbers - for example "sum(length of AB, length of BC)" or "square(length of AB)". So the classes are used like constructors known from the OOP. When the system defines a new object it considers its existance, constructability, realistic constructability (given the resources we have), existance of the codes that are able to construct it and so on. Currently the program displays a list of the real numbers defined and whether they are known to exist (after the first iteration). Please keep in mind that "known to exist" does not mean "existing" - a real number may exist but we may not know it does.

real zero is known to exist: true
real one is known to exist: true
length of AB is known to exist: true
length of BC is known to exist: true
length of CA is known to exist: true
square ( real zero )  is known to exist: false
square root ( real zero )  is known to exist: false
square ( real one )  is known to exist: false
square root ( real one )  is known to exist: false
square ( length of AB )  is known to exist: false
square root ( length of AB )  is known to exist: false
square ( length of BC )  is known to exist: false
square root ( length of BC )  is known to exist: false
square ( length of CA )  is known to exist: false
square root ( length of CA )  is known to exist: false
sum ( real zero , real zero )  is known to exist: false
sum ( real zero , real one )  is known to exist: false
sum ( real zero , length of AB )  is known to exist: false
sum ( real zero , length of BC )  is known to exist: false
sum ( real zero , length of CA )  is known to exist: false
sum ( real one , real zero )  is known to exist: false
sum ( real one , real one )  is known to exist: false
sum ( real one , length of AB )  is known to exist: false
sum ( real one , length of BC )  is known to exist: false
sum ( real one , length of CA )  is known to exist: false
sum ( length of AB , real zero )  is known to exist: false
sum ( length of AB , real one )  is known to exist: false
sum ( length of AB , length of AB )  is known to exist: false
sum ( length of AB , length of BC )  is known to exist: false
sum ( length of AB , length of CA )  is known to exist: false
sum ( length of BC , real zero )  is known to exist: false
sum ( length of BC , real one )  is known to exist: false
sum ( length of BC , length of AB )  is known to exist: false
sum ( length of BC , length of BC )  is known to exist: false
sum ( length of BC , length of CA )  is known to exist: false
sum ( length of CA , real zero )  is known to exist: false
sum ( length of CA , real one )  is known to exist: false
sum ( length of CA , length of AB )  is known to exist: false
sum ( length of CA , length of BC )  is known to exist: false
sum ( length of CA , length of CA )  is known to exist: false
        

In the file main/engine.chomik you will find the guts of the Esc. The most important are the type definitions, in fact being recursive enumeration definitions (lines 16-194).

Download

You may get the esc from: https://www.perkun.org/resources/binaries/esc-0.0.0.tar.gz.



Copyright by Pawel Biernacki, 2024 Vantaa