How to Make a Fifth Generation Operating System

Introduction: How to Make a Fifth Generation Operating System

Fifth Generation was not a new technology already long ago, but it is still not implemented in widely available system software. Don't worry. You can easily add these wonderful features yourself.
This technology is usually regarded as a classical implementation of discrete Artificial Intelligence and associated with the ability of automatic problem solving and natural language interface. That is, you don't need to code algorithms manually. Just explain what you want in plain English and the machine will generate, then perform them. Obviously, this requires system software of a principally different type. Just another clone of Unix is not sufficient. Let's try and create a prototype of such a system. We will call it RobOS.

At present, an Operating System is conceived as software which handles low-level details of hardware. If robots are poised to work in the open world, they will face similar challenges, only on a greater scale. A future OS will handle low-level details of the real world. RobOS does not replace existing Operating Systems. Instead, it extends them. Unix became so popular because it used C programming language. It combined 2 important features. On one hand, it is low-level, maximally approaching hardware. On the other - universal, worked on many different computers. Similarly, we will use natural language - an universal tool developed by Evolution. Many think that natural language programming is rubbish, just a toy for minors. You will see that with a proper approach it may be as powerful as able to implement a new Operating System. When Chomsky and his colleagues tried to create languages for newborn computers, they quickly discovered that received human language doesn't fit and decided to make everything from scratch. This decision was partly justified by the fact that their machines were too weak, had not much resources. Nowadays, the situation is principally different. If you use programming tools of that time, you will employ just a miserable fraction of available speed and memory. Nevertheless, using raw human language is still unprofitable because of its indefiniteness. Thus the term 'natural language' - a formalized subset of a human variant. Such formalization was completed in WinNB - a knowledge base shell which works under Windows.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Install Development Environment.

You can download it here https://www.softpedia.com/get/Programming/Other-Programming-Files/WinNB.shtml Installation takes literally a minute and requires a few megabytes of disk space. It is better to install into the root directory as suggested by default because the latest versions of Windows have tough protection and you may have troubles with installation into Program Files. In any case, you can always remove the program by standard means.
NB implements a virtual machine with an associative processor. RobOS runs on this machine and concentrates on the outer world rather than on the inner parts of a computer. The principle is the same. When you use a function which writes a variable into a disk file, you don't bother about cylinders and sectors where data will be stored. Likewise, when you tell robot: "put box on table.", you don't specify where exactly. It is RobOS that must handle details for you.

Step 2: Find HOME_ROBO.SCP.

It implements a servant robot operating in a virtual flat. Its main assignment - to bring various things to the user. The algorithm for each task may be rather sophisticated. The robot must find the path, open necessary doors, and of course it must perform actions in the proper sequence. All this is computed automatically. The file is in the subdirectory RSanbox. It is well structured for better understanding and full of useful comments. They begin with '%' character an run till the next '.' (full stop). Let's look what is inside.

Step 3: Virtual Machine.

For robots driven by step motors the concept of a Finite State Automaton is very useful. Each motion may take many steps so the system just switches to a new state and decrements the counter until it reaches zero.
_dec_nsteps(@N) if

@N>0;

@N1=@N-1;

forget: _nsteps(@N);

remember: _nsteps(@N1);

#cut().

...

Each of such states implements an elementary instruction of the machine and you can define any number of them.

block:"compile to" "goals".

_chng_operator if

_oper_ready.

_move1(@Dir) if

_dir(@Dir);

_nsteps(@N);

_dec_nsteps(@N);

#cut().

_move_dx1dy1(@DX1,@DY1) if

_dx1dy1(@DX1,@DY1);

_nsteps(@N);

_dec_nsteps(@N);

#cut().

_bypass_obstacle if

_obstacle;

forget: _obstacle.

_chng_instruction if

_ready.

#wait().

end block:"compile".

Here, we have 3 instructions: move a fixed step horizontally or vertically on screen, move a regulated step (@DX1,@DY1), and bypass an obstacle according to a fixed algorithm. The other 2 rules are used to propel the machine. When the current instruction is completed, it sets the flag _ready and the next instruction will be loaded from the queue.

Step 4: Operating System.

This is only a prototype to illustrate the principle. Here, it exists in source code marked by comments
%****Operating System****************************************************************.

It contains a set of general-purpose predicates which may be useful for different applications. With this approach, you need to include this text into your program and compile together with your own source.

Step 5: Intermediate-level Programming Language and Operators.

There are 3 tiers of programming here. You may immediately use instructions of the virtual machine. Can use natural language for abstract reasoning. It is also convenient to have yet another, intermediate language. Its operators are usually spelled as Prolog predicates _move_to("room table"). They must start with the underscore character here. This is an usual solution for natural language interface. Machine functions are evoked using formal constructs while the user deals with more human-like syntax. The intermediate language is interpreted, not compiled. The process is managed by the virtual machine too. Operators are stored in another queue:

_operator("go to kitchen door") _operator("go to kitchen stock") ...

When the previous operator is completed, the next one is loaded from the queue and interpreted. That is the corresponding instructions are pushed into the empty instruction queue and executed one by one. When the last instruction is ready, the flag _oper_ready is set and the process repeats.

Step 6: Natural Language Programming.

Using a raw human language for this purpose is a bad idea. Ambiguity is not the main obstacle. Present-day computer resources are sufficient for large dictionaries and extended syntax, but even if you purify these basic levels, you will discover that human language have not resolved important problems of computing. Take, for example, logical functions: and, or, not. They are processed differently in comparison to formal logic, and this is not some distinct difference - just indecision. There are much bigger issues such as Object-Oriented Programming. To make natural language workable, you must specify some human-like syntax, then choose definite semantics for it. Sometimes there are only 2 simple alternatives. Just need to make a decision.
Our computers are based on algorithms. They perform various sequences of actions. An alternative is declarative programming. What is it? This style is sometimes associated with rule-based approach, but it is not exact. Many procedural programming languages have the IF-THEN-ELSE operator, but you insert it into some point of the algorithm. Its conditions will be checked at the definite moment. In true declarative programming, facts and rules form the body of knowledge. They will be used when necessary by a sophisticated inference engine. That's why such programs may produce surprising solutions. When WinNB receives a natural language order, it tries to perform it immediately. That's why declarative knowledge requires a different representation. The modification is miserable. Just add 'i' at the beginning. Instead of

go to room table

use

i go to room table

This 'i' stands for the machine. The robot looks at itself from the side. This representation also makes it possible to communicate procedural knowledge between computers. The program may be stored and analyzed rather than performed immediately. Rules can use variables. Each of them keeps a numeric value (3, 7.81), a string ("abcde"), or a whole phrase of the natural sentence (table that stands in room). The convention for variables is as follows. Take, for example, @np1Smth. It begins with '@'. Everything from this character to the first capital letter designates the type. 'np' stands for the noun phrase. '1' is linked to list processing. In programming languages, you can declare a variable as having the 'list' type. In natural language, all members of the sentence are lists, may be represented by several homogeneous members (big, green apple). You use '1' to tell WinNB to take just 1 element from the list. @np1Smth and @npSmth are incompatible. You can read more details in WinNB Help. How does declarative programming work? When the user issues an order: "bring Cola.", the Operating System converts it into the declarative form: "i bring Cola.", then uses the inference engine so as to find a solution. The resulting algorithm is stored in the operator queue and used as described in the Step 5.

Step 7: How to Run the Application.

After installation, double-click the WinNB icon and run the program. Use the menu Browse\Command\Notebook. You will get the screen shown in the Step 1. Click in the Command window, then open HOME_ROBO.SCP from the RSandbox subdirectory.
If you installed it as RSandbox product, there is a simpler way. You will see: "Use File\Dialogue to start." at the bottom left. Do it and you will instantly get the desired result. Now you are ready to analyze the application. As soon as you made it clear for yourself, compile it. WinNB does not load programs into operative memory, keeps them in its knowledge base on the disk and runs immediately from this location. By this reason, the previous program will not disappear when you switch off the computer and first of all you need to erase it. Set the cursor in front of 'erase knowledge.' and click 'GO' button at the left. Then, put the cursor on the next, empty line and click GO again. The compilation should be completed in a matter of seconds. Also you will see the plan of some flat in the top left window. Now you are in the section of the program which is user interface. 2 more manual actions are required. Perform them like you erased knowledge. Turn on the virtual machine. Then start the Operating System. The last action does not load anything. It is already here. Just tells the shell to use it properly. At the end of your exercises, turn them off:

#stop_os(). stop. turn off virtual machine. stop.

Enjoy.

Step 8: The Next Step.

In the previous version, the Operating System was linked to the particular flat. As a generalization, it is preferable to have a separate description for the structure of rooms and furniture while the System would read necessary parameters from this description. You can see it with WinNB version 5.21. Further improvement is up to your imagination.

Be the First to Share

    Recommendations

    • Magnets Challenge

      Magnets Challenge
    • Makey Makey Contest

      Makey Makey Contest
    • Instrument Contest

      Instrument Contest

    Discussions