WIN-PROLOG 8.1 - Details

WIN-PROLOG 8.1 is both the latest version of LPA's true 32-bit Prolog compiler, and also the first version of LPA's brand new 64-bit Prolog compiler. The 32-bit version is available for all versions of Microsoft Windows, from Windows 98SE right up to Windows 11, and everything in-between, while the 64-bit version has been built for Windows 7 and later. Key features of WIN-PROLOG include:

  • AES Encryption and Big Integer Support: New to version 8.0 is direct support for the Advanced Encryption Standard (AES) algorithm, which is also now used to generate high-quality pseudo random numbers. Linked to this, is brand-new support for arbitrary precision big-integer arithmetic, which in turn enables Rivest/Shamir/Adleman (RSA) encryption
  • Unlimited Memory (X64): Gone forever is the pain of trying to squeeze large data sets or huge structures into just 2Gb of memory. With the 64-bit version of WIN-PROLOG, the only limit to directly addressable memory is how much is installed on a given computer
  • Huge File Support: Gone is the old 2Gb limit on individual file sizes, WIN-PROLOG now directly supports data files of up to 2^53-1 (X86) or 2^64-1 (X64) bytes in size, up to 64 of which can be open at any one time. This new feature gives WIN-PROLOG the capability to access vast file-based datasets, as well as perform more mundane tasks such as managing large video and other media files
  • Native x87 Floating Point Package: A brand new high-precision, floating point maths package has been written to replace the previously-used emulation library that was used since the earliest days of 386-PROLOG. The new package is faster, more accurate, and has been extensively tested for over a year prior to public release
  • Enhanced HTML Help: the HTML-based Help subsystem has been greatly improved, with proper layout and typsetting of examples, to make them easiter to read. Meanwhile, cross-links to other pages are now listed with comments and descriptions, as in the main index, providing instant on-line, context-senstive access to the same information as presented in the main body of the WIN-PROLOG Technical Reference
  • Multi-Touch Support: Full support is given to multi-touch messages in Windows 8 and Windows 7, allowing intuitive touch applications to be written for touch-screen tablet computers
  • XML Support: Extended Markup Language (XML) import and export is supported through a collection of special predicates, which allow XML files or streams to be read as tokens or nested terms, and written with or without indented formatting, to support web-centric and other data processing applications
  • JSON Support: JavaScript Object Notation (JSON) import and export is supported through a collection of special predicates, which allow JSON files or streams to be read and written as nested terms, to support AJAX and web-based technologies
  • Soft Meta-Predicate Definitions: the meta_system/2 predicate can now be modified by the user, in order to produce improved program listings, debugging, call-graph and cross-referencing behaviour where user-defined meta-predicates are employed
  • Windows 11 Support: WIN-PROLOG is now fully compatible with Windows 11, while still working great on all versions of the operating system since Windows 98SE
  • Word Wrap Option: users can now choose whether to scroll the console and program windows in order to view long lines of text, or to have the text automatically wrap to the window, with the ability to swap back and forth between viewing modes as required
  • Musical Instrument Digital Interface (MIDI): comprehensive support for the Musical Instrument Digital Interface (MIDI) opens up a whole new world of experimental research and analysis of music, as well real-time recording and playback
  • Windows Sockets (WinSock) Support: a set of predicates and special system events makes the programming of client and server TCP/IP applications easy, giving WIN-PROLOG programs full access to the Internet
  • Dynamic Memory Reallocation: all heaps, stacks and major memory buffers can be reconfigured at runtime, during execution of any query, to allow flexible use of resources during large, complex computations
  • Easy Installation: the entire WIN-PROLOG system comes on a single CD-ROM, together with all documentation and associated toolkits (flex, Prolog++, Intelligence Server, etc)
  • Common Control Support: WIN-PROLOG provides easy programmable access to a wide assortment of Windows controls and common controls, including tooltips, trackbars, spinboxes and tab controls
  • Rich Edit 3.0 Support: WIN-PROLOG works together with Rich Edit 3.0, a Microsoft subsystem which provides multiple-font, colour text windows with full support for RTF, Plain and Unicode text
  • Rich Syntax Colouring: using Rich Edit 3.0, source code text is coloured, in real time, during editing, clearly identifying different data and code items and typing errors.
  • Full Unicode Support: WIN-PROLOG supports the full Unicode 3.1 character set in files, in addition to the byte-oriented ASCII and ISO/IEC 8859-1 character sets, as well as an arbitrary 32-bit character set
  • True Hashed Compilation: WIN-PROLOG includes a special mode of compilation, in which hash tables can be produced for huge Prolog databases to provide highly efficient execution of applications such as WordNet
  • Automatic Configuration: the same files run on Win_10, Win_8, Win_7, Vista, WinXP, Win2k, WinNT, WinME and Win98, and fully support features of each version of the platform
  • Multiple Document Interface: any number of program edit windows can simultaneously opened in an MDI-standard development environment
  • Common Dialog Boxes: these are used for all file open/save, print setup and similar operations to provide a familiar look and feel customised for each supported version of Windows
  • Source Level and Box Model Debuggers: these make full use of windows and other GUI features to make program testing and debugging as easy as possible
  • Fully Programmable GUI: a large library of GUI functions, providing for the creation and control of windows, dialogs, controls, menus, fonts and more, are directly programmable from within Prolog
  • Rich Graphics Facilities: powerful graphics predicates give the ability to create charts, diagrams, as well as graphical buttons and tools; graphics facilities include vector, polygon, bitmap, icon, metafile and cursor display control, together with scaling and scrolling functions
  • Efficient Runtime System: WIN-PROLOG is implemented in 32-bit assembler language (MASM), and employs advanced techniques to achieve outstanding runtime performance, easily attaining speeds of around 10 megalips on faster Celeron and Pentium II machines
  • Dynamic Link Libraries: WIN-PROLOG can load and access code in DLLs written using standard Windows development languages, including Visual C/C++, Visual Basic and Delphi
  • Direct Windows API interface: virtually any Windows API function, or third-party DLL function, can be directly called from WIN-PROLOG, without the need to resort to C/C++ programming
  • Dynamic Data Exchange: ready-to-go DDE interface allows direct communication between Prolog and Visual Basic, Microsoft Word, Excel or any other DDE-aware Windows application
  • Language Interfaces: the Intelligence Server option provides ready-built interfaces to C/C++, Visual Basic (VBX), Delphi, Java, with others planned for the near future
  • Comprehensive Help: a fully cross-referenced version of the Technical Reference manual is supplied as a Microsoft Help file, providing complete on-line documentation of all system predicates and functions
  • True 32-bit Implementation: a genuine Win32 application makes up to 4Gb (4096Mb) of memory is directly addressable, without complex internal segmented addressing schemes
  • Small Memory Requirements: needs as little as 4Mb of memory: as much space as possible is made available for use by user's applications code
  • Edinburgh Standard Syntax: fully conforms to the industry standard syntax, including support for DCGs, term expansion and other advanced features
  • Quintus Prolog Compatibility: the system was designed from the outset with QP compatibility as a key objective
  • 64-bit Arithmetic: full-featured, efficient double precision built-in floating point maths library complements the 32-bit integer arithmetic
  • Incremental and Optimised Compilation: all the flexibility of a traditional interpreter is combined with the runtime speed of fully compiled code
  • Operating System Control: full featured access to the operating system gives Prolog programs full control of files, directories, environment variables, time and date, and allows other applications to be executed
  • User-definable System Hooks: many events, such as errors, spypoints, timers and messages can be directly programmed in Prolog
  • Special Data Types: efficient text manipulation is supported by a true string data type, and four linked data types efficiently support compound terms
  • Sophisticated Data Compression: Lempel/Ziv data compression and decompression routines are built in, and are used both for saving/loading system files, and for general user-specified applications
  • Powerful Data Encryption: data can be encrypted or decrypted with a unique and uncrackable algorithm, using a comb-filtered Marsaglia/Zaman random number generator whose key size is an amazing 1185 bits
  • Secure Hashing and Message Digests: full support is given for a number of industry standard data integrity checks, including the CRC-32 Cyclic Redundancy Check, MD5 Message Digest and SHA-256 Secure Hash Algorithm
  • Stand-alone Applications: the Developer edition of WIN-PROLOG allows self-contained, stand-alone applications to be built and distributed; end users need never know that their systems are implemented in Prolog
  • Full Range of Options: as well as Programmer and Developer editions of WIN-PROLOG, the flex expert system toolkit, Prolog++ object-oriented toolkit, ProData (ODBC) and ProWeb (HTML) options are available now

WIN-PROLOG: Easy to Install!

The entire WIN-PROLOG 8.1 system comes as a download, packed with useful goodies, direct from our own secure server. These include all current versions of LPA toolkits, such as the flex expert system, the object-oriented Prolog++, the Intelligence Server, and more. All current documentation is included, Adobe Reader format (.PDF). You can read any or all of the documents directly from the CD-ROM, even before you install your software.

When you order your WIN-PROLOG system, you will be sent the CD-ROM, complete with a unique serial number and set of "key codes" and "CD locks": when you type these into the SETUP program, you will be able to gain instant access to those parts of the LPA software range that you have licensed. Should you decide to upgrade your software level (say, from Programmer to Developer edition), or to add additional toolkits to your library, all you require is a revised CD lock code from LPA, which means that you can gain access to the additional resources instantly, without waiting for CDs to arrive by post.

WIN-PROLOG: for Windows 11, 10, 8, 7, Vista, XP, 2000, NT, ME and 98SE

In this section we will look a little more closely at some of the special features of CON-PROLOG. The system comes as a true 64-bit application for Windows 11 and 10, and also as a 32-bit application for all versions of Windows systems right back to 98SE. It is totally integrated with the Windows operating system, and utilises a Multiple Document Interface (MDI) environment for editing, compiling, debugging and running programs.

The development environment permits any number of program edit windows to be open at any one time, and you can cut and paste text between them. Standard search and replace edit facilities, together with special Prolog-related ones (such as "goto definition") make the maintenance of large, complex systems easy.

You can compile or optimise program edit windows individually or all together, and save your work as and when you want to. If you forget to save edit windows before attempting to exit from WIN-PROLOG, you are prompted to do so before quitting.

A full source-level debugger utilises a special dialog in which you can scroll through program source code, variable bindings, and other information. A multi-level break facility allows you to escape from the debugger to run supplementary queries before returning. A traditional box model debugger, together with a collection of small, special purpose debuggers, complements the source-level debugger to provide unprecedented flexibility in program testing.

Rich Syntax Colouring

Making use of the Rich Edit 3.0 subsystem, contained within the two Microsoft DLLs, RICHED20.DLL and MSLS31.DLL, WIN-PROLOG supports a powerful form of syntax colouring which goes well beyond the usual keyword identification of other editors. Its "Rich Syntax Colouring" recognises many special cases, for example, distinguishing between single-use and multi-use variables, and between operators, built-in predicate names, compiled and uncompiled user predicate names.

Rich Syntax Colouring is not limited to source code windows: console queries are also coloured, as is the code window in the Source Level Debugger; printed text is fully coloured too, and it is easy to export fully coloured program text as Rich Text (RTF) files, for loading into a wird processor for inclusion in reports and documents.

Unicode and Other Text Formats

By employing a custom text encoding format, known as "UTF-BS", WIN-PROLOG manages to support a full 32-bit character set, and hence Unicode, ISO/IEC 8859-1 and ASCII, with minimal space or processing overheads compared to previous 8-bit character support (typical text applications have no overhead at all, while 8-bit binary text requires an average of only 1.5% more storage than before).

Character-level filtering of input and output is supported on a file-by-file basis, allowing applications to handle multiple character sets simultaneously and transparently, in any of 11 file formats, including ASCII, ISO/IEC 8859-1, UTF-8, UTF-16BE, UTF-16LE, UTF-32BE and UTF-32LE among others. External API calls can be made with text in four formats, including WIDE (Windows Unicode), ANSI (Windows Multibyte) and ISO/IEC 8859-1. Altogether, WIN-PROLOG's text handling is second to none.

The Windows Interface

Many features of the Windows GUI are directly programmable and controllable from within WIN-PROLOG. Using built in predicates, you can create and destroy windows, modal and modeless dialogs, control items, menus and fonts. Windows can be renamed, resized, repositioned, hidden or shown, enabled or disabled. List boxes, combo boxes and menus can be added to, deleted from and inserted into. Text in edit controls can be selected by offset or line number, searched, scrolled, replaced, deleted and inserted into. Buttons can be restyled, grouped, checked or unchecked, selected or deselected, greyed or enabled. Fonts of any face, size and style can be applied to any control window, including edit, button, static, list box and combobox controls. Initialisation files can be created, written, read, added to and deleted from.

Links can be found from any given window to its parents, siblings and children, and top level windows can be searched for by class and name. All of the above operations can be applied to any window whose handle is known. You can read or write text from and to any window: thanks to the special string data type, the passing of large amounts of data between Prolog and Windows is both simple and efficient.

Powerful Graphics Functions

In addition its rich GUI features, WIN-PROLOG includes a comprehensive and carefully integrated Graphics subsystem. This provides both the graphics functions needed to draw lines, ellipses, rectangles, polygons, bitmaps, icons, metafiles and cursors, and those needed to maintain resources. Each graphic resource, be it a bitmap, icon, or whatever, is given a Prolog name which is maintained, automatically, in a dictionary. When such a resource is no longer required, it can be deleted simply to free up system memory. Icons, bitmaps and metafiles can be loaded direct from disk, and in the case of icons, extracted from any Windows executable file. Metafiles can also be created within WIN-PROLOG for exporting to other applications, such as Word for Windows or CorelDRAW!

The repainting of graphics windows is handled elegantly through the use of message handlers (see below), and all necessary housekeeping is carried out "behind the scenes". Graphics can be painted into any window, but special support is given both for buttons (allowing the creation of graphical toolboxes) and special "grafix" control windows.

Message Handlers and Hooks

As well as being able to create and manipulate highly complex dialogs and menus, WIN-PROLOG includes sophisticated ways to handle the messages generated by these and other GUI objects. Once you have created a dialog, filled it with controls, and placed initial data into them, you can use the dialog as often as you wish, either in a modal or modeless fashion. All button clicks, list and combo box selections, edit control changes, and scroll bar movements are reported to a special handler program whose job it is to process the dialog. Each dialog can have its own handler, or they can share handlers. You write these handlers, entirely in Prolog, to perform any actions you like.

Similarly, when you have built a menu, with or without submenus, you can install it on the main menu bar. Whenever selections are made, messages are sent to a special menu handler, again which you have written in Prolog, and which can perform any actions you like.

As well as the user dialog and menu handlers, several message "hooks" are provided to enable you to capture and process certain messages from the predefined modeless dialogs, DLL modules and the keyboard.

Direct Windows API Interface

As well as providing high-level access to around 100 Windows API (Application Programming Interface) functions, not to mention numerous subfunctions, WIN-PROLOG includes a special interface which allows your programs to call virtually any C function directly, whether defined in the Windows API or in a DLL or other module. The winapi/3 predicate allows any function, defined in any 32-bit module, to be called with any number of parameters. The parameters may be integers, string pointers, or arbitrary structures, and facilities exist for defining named "memory files". All memory allocation and stack frame creation is carried out automatically, so your only job as a programmer is to provide the relevant data and call the function.

The Windows API function means that your programs are no longer "limited" to using the 100-plus API functions built into WIN-PROLOG by LPA, but can add additional functions yourself as and when you need them. It also provides a direct way to invoke code in DLLs, without having to write parameter-translating ("glue") code in C/C++.

Memory Files

As well as creating or opening files on disk, WIN-PROLOG has the powerful ability to open "virtual" files in memory: these have no disk image, and can be of any size within available resources. Ideal as temporary scratchpads during complex data operations, they are both extremely fast (no need to bother the hard disk) and avoid the usual worries about how best to name a temporary file: they don't have external names!

Modelled on the original buffers that implemented to provide storage for use in conjunction with the winapi/3 predicate, these new memory files can be used with any and all of the standard Prolog input/output predicates, as well as to store virtually any data directly. Applications which require the storage of large numbers of small data items (such as bit tables) are especially helped by this feature.

True 32-bit Assembler-coded Implementation

The WIN-PROLOG kernel is implemented entirely in 32-bit assembler to provide the best overall performance possible on 386, 486, Pentium or Pentium Pro platforms, with just enough 32-bit C to interface it to the Win32 API of Windows Vista, XP, 2000, NT, ME and 98. Thanks to its tight implementation, the entire WIN-PROLOG system requires under 2Mb of disk space, and can be installed without having to modify any Windows or System directories, although two Microsoft files, RICHED20.DLL and MSLS31.DLL are updated with later versions on older versions of Windows.

32-bit Memory Access: the 4 Gigabyte "Limit"

A significant advantage of the true 32-bit implementation is that all pointers and integers are 32 bits wide, giving WIN-PROLOG the ability directly to address up to 4 gigabytes (4096 megabytes) of memory. You can divide memory in any way you like between program, text and dynamic data: there are no built-in limits or restrictions. WIN-PROLOG can directly use every single byte of memory on your computer.

Huge File Support

WIN-PROLOG uses special "floating integer" numbers to provide direct access to files up to 10^53-1 bytes in size: that's 9,007,199,254,740,991 bytes, or if you prefer, about 9 million gigabytes, or 9 thousand terabytes, in size. And moreover, it can open and handle up to 64 such files simultaneously, with full random access for both reading and writing. Such massive files greatly exceed the size of storage available today, so effective provide no upper limit to file size. On a more practical note, this means that items such as large video files can be processed easily.

Thorough Quintus Prolog Compatibility

WIN-PROLOG has been designed from scratch for Quintus Prolog (QP) compatibility. This extends well beyond the obvious requirement of duplicating the built in predicates of QP, as it includes special features such as logical file names, background housekeeping of predicates/file relationships, and much more. Most applications will port directly from QP to WIN-PROLOG, as the file management support isolates user programs from the intricacies of the host operating system.

Linear Garbage Collection

With all the memory available to the designers, it would have been tempting to skimp on garbage collection features. However, the garbage collection and memory management within WIN-PROLOG is more complete and advanced than in any other commercial Prolog system.

The evaluation stacks and heap are managed by a linear garbage collector: doubling the size of evaluation space roughly doubles the time taken to collect garbage on any one occasion, but garbage collection occurs only half as often. The result is that there is no degradation of performance, when even vastly different sizes of evaluation space are used. A fixed size cell allocation scheme avoids any risk of memory fragmentation.

Text space is used to store the bodies of atoms and strings, and is managed as a special heap. It too is fully garbage collectable. Program space is used to store clauses and optimised programs, and is totally reclaimable when these programs are abolished. Both text and program spaces use a special segmented heap format which guarantees that every last byte of memory can be used, with no fragmentation or degradation problems, however many times items have been added or removed.

The Incremental Compiler

WIN-PROLOG is based on an incremental compiler, whereby all clauses in a program are compiled at all times. Because the compiler is incremental, individual clauses can be added by programs - just as in a conventional interpreter. In fact, assert/1 is implemented as a call to the compiler. But WIN-PROLOG goes beyond simple clause level compilation, maintaining dynamic first argument indexing (even into compound terms), which can result in considerable runtime performance improvements over previous LPA Prologs.

Programs can be incrementally decompiled too, allowing predicates like clause/1 and retract/1 (and even listing/1) to be implemented. Both the incremental compilation and decompilation routines are written in assembler code, and are very fast, matching the speed of their interpreter equivalents - but the clauses they manage run some 3-4 times faster than they would in an interpreter.

The Optimising Compiler

The incremental compiler/decompiler does not perform multi-argument indexing, or the space-saving last clause and other optimisations - they would simply be too complex to change on the fly during assert/1 or retract/1. With this in mind, WIN-PROLOG provides an alternative optimising compiler.

The optimising compiler can perform all the optimisations just mentioned, and more. There is full support for multiple-argument indexing, which enable the very fast matching of clauses on any arbitrary argument (as opposed to the single first-argument indexing the incremental compiler and other Prolog systems), and a complete analysis of variable usage is performed on relations. Any variables which can be left in situ between calls are left so, substantially reducing the data traffic in most programs.

Optimised programs can run some 2-3 or more times faster than incrementally compiled ones, and use less space during execution. Decompilation of these programs is not possible, so your source code will remain completely hidden in applications.

64-bit Floating Point and 32-bit Integer Arithmetic

A fully-featured, 64-bit double precision floating point arithmetic library is built in to WIN-PROLOG. This is accessed directly by the is/2 predicate, which in turn is implemented entirely in 32-bit assembler. The library provides high-speed, high-precision arithmetic computations, and includes support for standard "calculator" functions, trigonometric and logarithmic functions, floating point to integer conversion and truncation functions, maximum and minimum functions, and pseudo random numbers. Direct support is also provided for 32-bit integer style shift, rotate and bitwise logical functions. The most common use of the is/2 predicate is for the simple adding or subtracting of two integers, and this case is specially optimised, being handled entirely in the integer domain wherever possible.

For special systems applications, a 32-bit integer, reverse polish notation evaluator is provided, once again implemented in 32-bit assembler. This evaluator provides very high speed computation of integer expressions, and supports the standard "calculator" functions, bitwise logical functions, and pseudo random numbers.

The carefully researched, pseudo random number generator is useful in a variety of applications, including games, simulations and data encryption. For speed, it is implemented in integer arithmetic, and uses a very high potency linear congruential algorithm, with a period of 2^64. The single, seedable generator is shared between the floating point and integer evaluators, so switching portions of code between these two domains will not violate the integrity of a pseudo random sequence.

Powerful Input and Output Features

One of WIN-PROLOG's great strengths is its powerful collection input and output subsystems. As well as the standard see/1, tell/1, read/1 and write/1 style predicates, support is given for formatted I/O, binary I/O, and the manipulation of a number of special I/O streams, including device and string streams as well as disk files.

Formatted I/O primitives provide complete control of the output of atoms, strings, numbers and other items. Fixed field display, with left or right justification, optional truncation, and free field formats are all supported. Numbers can be output in fixed point, signed or unsigned integer, and even non-decimal base formats (anything from base 2 (binary), through base 16 (hexadecimal) right up to base 36).

Matching formatted input allows structured records to be read in with automatic type checking. As well as the obvious applications such as writing or reading data in tabular formats, the formatted I/O predicates make it easy to build interfaces to ASCII files from other applications.

Text String Data Type

While the traditional Prolog "string", namely a list of 8-bit integers, is a powerful means by which to manipulate small pieces of text, it is extremely inefficient as a way of storing text. This inefficiency would be compounded in a 32-bit Prolog system, where each one-character element of the list would need 10 bytes of storage on the dynamic heap. To enable bulk text handling applications, WIN-PROLOG includes a true text string type. Any number of such strings may exist in Prolog terms, and each may contain up to 64Kb of text. Because of the way these strings are stored, garbage collection is still quick and efficient, and even string space cannot become fragmented.

Many built in predicates use strings as a means of passing large amounts of text or binary data around, for example between a window buffer and a disk file. In addition, strings may be used as input and output streams: for example, the call:

?- listing ~> String.

would bind the variable String to a string containing the entire text of a program listing. This string could be manipulated, displayed in a window, and processed in virtually any fashion.

Strings provide a data type with a high bandwidth for communications between WIN-PROLOG and low-level data types, such as files and screen buffers. They are of particular importance as parameters in WIN-PROLOG's extensive library of Windows GUI predicates.

LZSS Data Compression

An interesting feature in WIN-PROLOG is the provision of a pair of routines for LZSS data compression and decompression. These are used internally by the system state save and restore predicates, but are also available for general use in user programs through two special I/O predicates. A modified version of the original LZ77 algorithm, LZSS uses a sliding window to hold processed data, while a look-ahead buffer peeks into the stream of data yet to be compressed. Depending upon the sizes of sliding window and look-ahead buffer, compression ratios of up to 64:1 are theoretically possible for highly patterned data; in practice, ratios of 2:1 to 4:1 are more usual.

There are many potential applications of LZSS compression: these include the creation of stuffed archive files, which contain an accumulation of compressed files with their names, creation dates/times and attributes, the simple stuffing of individual files, such as bitmaps, which normally use large amounts of disk space, or the compacting of data which needs to be transmitted by modem or some other slow device. More advanced uses might include the creation of mixed database files consisting of uncompressed index information, and compressed data records.

MZSS Data Encryption

As its name suggests, MZSS encryption makes use of a Marsaglia/Zaman pseudo random number generator (PRANG), which has the primary benefit of offering a very large key size (1185 bits, compared with just 64 bits in WIN-PROLOG's existing linear-congruential PRANG!). The MZ/PRANG is seeded by a user-specified password of up to 148 characters, and successive numbers are then combined (XOR) with the plaintext in order to encrypt it, or with the cyphertext in order to decrypt it. Two special features of MZSS encryption make it especially secure: "comb filtering" and "sequence variation".

Although having excellent random properties, and a massively long cycle (well over 2^1180 numbers in the sequence), there is a weakness in the pure MZ/PRANG. If a history of the previous 37 numbers is visible, it is possible to guess the next one +/- 1 bit: if the first 37 characters of a document's plaintext are known, this is quite sufficient for an intelligent attack to decrypt the rest of the document. MZSS encryption prevents such an attack with the help of "comb filtering", in which only a random sample of numbers from the MZ/PRANG sequence are actually used.

Another common attack on simple cyphertext is to find some other document to which both the encrypted and decrypted version are available. Suppose that a document, VULNERABLE, is to be attacked, and the attacker has access to the PLAINTEXT and CYPHERTEXT versions of another document: on the (fairly reasonable) assumption that same password has been used to encode both VULNERABLE and CYPHERTEXT, it is possible to decode the former, at least as far as length of the PLAINTEXT document, by combinding PLAINTTEXT and CYPHERTEXT to obtain an intermediate KEYSEQUENCE, then combining this with VULNERABLE to generate the desired DISCOVERED document. MZSS encryption prevents such an attack by adding additional data to the user's password: this results in "sequence variation", so that even if the same password is used on more than one occasion, the random sequence it generates is completely different each time.

Term and Data Management

There are many special features in WIN-PROLOG geared towards term and data management. An assembler-coded, high speed list/merge sort algorithm gives truly stunning performance. Displaying ln2(X) performance characteristics, it is capable of sorting lists of 10,000 elements in around two seconds on a 25MHz 386. The sort/3 predicate goes beyond the functionality sort/2, by allowing you to define a sort key of arbitrary depth: if the elements in the list you are sorting are complex compound terms, you can uniquely identify which subterm you want to use for sorting. This powerful feature allows you, for example, to sort a given list of names and addresses by surname, street name, town or post code, simply by changing the search key parameter.

The Operating System Interface

As you would expect from LPA's Prolog implementations, WIN-PROLOG has a huge library of operating system interface functions, providing for disk file and directory management, program execution, the reading of environment variable strings, and time and date functions.

Predicates allow you to create, rename and remove files or directories, and you can test and modify file attributes and timestamps. File directories can be read according to file name and attribute matching, returning information about each file's size, time and date.

For specialist time and date applications, a built in predicate allows you to compute absolute day numbers for any given date, or vice versa, allowing days between dates, lunar phases, and other such calculations to be made.

Programmable Interrupt Timers

For special purposes, up to 64 completely independent, programmable timers may be set or tested. When a timer expires, it interrupts the execution of WIN-PROLOG, and calls a specially defined user "hook" predicate. This predicate can perform various operations, before resetting the timer. Because of the design of the timers, real-time synchronisation is maintained, even if an individual hook is delayed in its operation. Uses for timers include timeouts on user input, periodic updating of clock or calendar displays, the writing of sophisticated profile tools, and so on.

Try before you Buy!

You can try all of the features mentioned above, and many more, by downloading the special Free Trial version of WIN-PROLOG. All you need to do is enter your full name and email address, and optionally some other details about you and your work, and your own customised copy of the software is just a couple of mouse clicks away!