HomeAboutDOWNLOADNewsInformationChatGamesSupport AI - Project

This program is dedicated to our teacher, Prof. Dimiter Skordev.
Strawberry Prolog
version 6.1
from August 23, 2023

This Prolog compiler is part of AI - Project.

Download Strawberry Prolog Light. This is our free edition.

Strawberry Prolog is being developed in the Institute of Mathematics and InformaticsBulgarian Academy of Sciences, in the Faculty of Mathematics and InformaticsUniversity of Sofia and in New Bulgarian University.

New sample programs

  Metro – We present a new scheme for the movement of metro trains which will increase the capacity of the metro tube with 50%.
This will decrease the traveling time by 33% and the power consumption by 30%.
With the new scheme, the waiting time at the stations increases, but this problem is solved in a clever way (version 5.0 from 23 August, 2023).

  AI Unravels Chess – This is an attempt to build AI. First, we need to learn how to describe the world. For this purpose, we need a special language for description of worlds.
This program is an attempt to create such a special language and describe through it the world of chess game (last version from 7 March, 2023), read this article.

  WarCraft – Action game! One epic battle in an infinite forest. (The map is really infinite. This is not a joke!)

  3D Studio – You can create your own 3D world and to move in it in order to see everything from a different point of view.

  Digital TV – Compression and decompression of video signal. New format for the Digital TV of the future.

  Fractals – You will see an infinite fractals field in which you can move and even get lost.

  MultiTetris – New variant of the game Tetris where several figures fail down simultaneously.

  Chess – You will see how easy it is to make a Chess Playing Program with Strawberry Prolog.

  Galvanic Line – Real program for real galvanic line.

What do we do right now?

Currently, at Sofia University, together with our students, we write a program demonstrating the Event-Driven models. These models are the basic models in Artificial Intelligence. You can see the current variant of this program.

What is new in the last versions?

  New syntax of some of the built-in predicates. For example the predicate window has about 20 arguments. Of course, it would be terrible to write all of them to create a simple window. Instead, you can write only these parameters which are important for you, others will be filled by default. For example you can write window(icon("Icon.ico"), size(100, 120) ) or even only window( ).

  Better debugger and better visualization in the Proof Tree window.

  You can embed ActiveX objects in your Prolog program by the predicate embed_server. Also you can receive events from OLE servers (ActiveX objects). When your Prolog program is OLE server then by the predicate raise_event it can send events to its client program.

  You can call external functions from DLL files and from OLE servers. You can call Prolog program as OLE server but for the moment you cannot call it as DLL.

  A special tool called Object Browser which gives you the possibility to view the methods and properties of the OLE servers which are installed on your computer (like MS Word, Corel Draw, etc.). This will make easier the task for creating Prolog programs which are using these servers.

  You can use ODBC is order to work with databases. The support of ODBC is made through OLE server ADODB.Connection.

  You have support of Unicode. Also, you can use different char sets and you can change the char set in the time of program execution by the predicate char_set.

  You will find some new and very powerful predicates like print_file. By this predicates and functions you can create really exiting text processing programs. For example the software of Second-Box is made entirely on Strawberry Prolog.

  Strawberry Prolog now has Syntax Coloring.

  Support of Object Oriented Programming (this feature is still under development).

  You already have the possibility to define your own built-in predicates, functions and constants and even if you like you can specify the types of their arguments. This extension of the Prolog language is so convenient that we are sure it soon will be accepted also from the other Prolog compilers.

  Global variables which give you the possibility to access their values in different places of your program. Use of global variables is so powerful that with them you can avoid the use of assert in the most cases. This innovation already is accepted from some of the competitor’s Prolog compilers.

  Support of SQL servers, TCP/IP Sockets and Cookies. These innovations are important for creating Prolog CGI Scripts.

  Many new predicates for work with window's messages. (Look at sample program Fractals.pro in order to see them.)

  Predicate := is now working with any type of terms. (In the previous versions it was not possible to use it with open terms, which was a serious restriction.)

  A new powerful cut predicate. For example, cut(1) is the same as !, cut(2) cuts more than ! and cut(0.5) cuts less than !.

Strawberry Prolog and Internet.
  Strawberry Prolog already covers one of the main problems connected with the creating Web sites and this is the problem for creating programs which can run directly on the server to provide service for your web site visitors. All functionality on this site is made as Strawberry Prolog CGI Scripts. To receive an idea of them you can go to play some games or to visit our chat room (all this is made on Strawberry Prolog).

  Strawberry Prolog will cover soon also the second fundamental problem in the web design: How to include in your site programs which will run on the computer of your web site visitor. To cope with this problem Strawberry Prolog will support the Plug-In technology. In order to handle this task people use Java applets or ActiveX controls for the moment .

What is Strawberry Prolog?
Prolog is a language of a higher level. This turns out to be an advantage and disadvantage at the same time. On one hand it shortens the time of your program development and on the other it may sometimes affect the efficiency. Prolog programs usually work slower than the programs written on language like C but the problem is not in the language but in the Prolog compilers.
What does it mean "a higher level"?
On a low level you describe the way for solving your problem. In Assembler (the lowest level) you describe everything in the style: "get the contents from this register and put it in that one". In C you do not care about the registers (leaving this to the compiler) and write in the style: "get the contents from this memory box (variable) and put it in that one". In Prolog the approach is different. You describe your problem but do not say how it can be solved (leaving this to the compiler). For example, you can say that you need the answer to a question.
Why are low-level programs more efficient?
Because you are cleverer than the compiler. If you take care of the registers you will do it better than any compiler. Of course, this is true only for small programs. If the program is too large then the optimizer will do this routine work better than you will.
Does it matter to work on the low level?
Yes, sometimes but only for very short and responsible subroutines which will run billions of times. Sometimes you can achieve the opposite effect. This happens often with different software companies. They have a program written on C and rewrite it on an assembler to achieve higher efficiency, however they obtain a slower one instead. This is because sometimes when the source is very big the compiler manages to find better solution than the human being and because the C compilers are already quite good and it is not easy to write a more optimal program than the compiler.
Are the Prolog compilers good enough?
The answer is no. We believe that Strawberry Prolog is the best choice but it is still far from being perfect, either. For this reason (so far) if you write two programs, one in C and second in Prolog, then the first will be the faster one. Nevertheless you will waste too much time writing a C program that it does not worth the effort. Even if you are working on a big and complicated project it may be impossible to do it in C (Pascal, FORTRAN) because you will be lost in small details and  the idea of your project will become vague. If you want to use the Windows interface it will take plenty of time to study environments like Visual Basic, Delphi or Visual C++, it will be easier to do this with Strawberry Prolog where there is no need to study (just look at the examples). For the moment we give you less possibilities than Visual C++ and even less than Visual Basic. However, this product is a quickly developing one and soon we will bridge the gaps.

How are we going to develop a Prolog language?
Prolog is a high-level language and employing it you describe the nature of your problem but not the way to its solution. The compiler has to find this way itself. Unfortunately the compiler is not very clever and searches the answer in the tree from left to right, depth first. This way of searching often causes infinite loops. Many of these loops are absolutely ridiculous like A=B if B=A, B=A if A=B and so on. Other loops are much more complicated. Our goal is to build in the compiler the possibility to catch all foolish loops and make in this way Prolog language much more powerful. You can read more about loop checking (the most important Strawberry Prolog feature) in the "Periodical Cyclings in Prolog" (zipped PostScript file). This is the Master's thesis of Dimiter Dobrev (the leader of our team). The Loop Checking implementation will be available in version 3.0. Presently we are working on the theoretical part of the Loop Checker.

Open source Prolog compiler under the AntiGNU license.

Other sites made by us: Free e-mail without SPAM, Club “Everybody Knows Your Name”, A book with illustrations, Transliteration and Applied Electrochemistry.