Gnu prolog compiler download




















In that case, the existing elements of the array are not initialized. Finally, an array can be automatically expanded when needed. The programmer does not need to explicitly control the expansion of an automatic array. An array is expanded as soon as an index is outside the current size of this array. Some examples using global variables are presented later section 8. This assignment is not undone when backtracking occurs. This allows the user to give a name to any Prolog term in particular non-ground terms.

Such an assignment is always undone when backtracking occurs since the term may no longer exist. See common errors detailed in the introduction section 8. Fails if GVarName is not an array. Bit numbers range from 0 to the maximum number allowed for integers this is architecture dependent. If Bit is greater than this limit, the modulo with this limit is taken.

The query test Old will succeed unifying Old with 1 and on backtracking with 2 i. The query testb Old will succeed unifying Old with 1 and on backtracking with 1 i. Simple array definition : here are some queries to show how arrays can be handled:. Prolog flags : a Prolog flag is an atom which is associated with a value that is either implementation defined or defined by the user.

The following two tables present available flags, the possible values, a description and if they are ISO or an extension. The first table presents unchangeable flags while the second one the changeable flags. For flags whose default values is machine independent, this value is underlined.

When turned off the following relaxations apply:. This allows a sub-process written in Prolog to read this file and then process any Prolog term as done by the parent process. This file can also be passed as argument of the --pl-state option when invoking gplc section 4. More precisely the following elements are saved:. Each file is compiled for byte-code using the GNU Prolog compiler section 4.

It is possible to specify user as a file name to directly enter the program from the terminal. Files can be also a single file name i.

Refer to the section concerning the consult of a Prolog program for more information section 4. See section 4. Each file must have been previously compiled for byte-code using the GNU Prolog compiler section 4.

Pred can also be a single atom in which case all predicates whose name is Pred are listed of any arity. Value a list of two elements. Times are in milliseconds, sizes of areas in bytes. If both Base and Max are integers Number will be an integer, otherwise Number will be a floating point number. Most predicates using a file name implicitly call this predicate to obtain the desired file, e. The current implementation does not check the validity of PathName. More precisely File2 is computed as follows:.

The first argument is always the name of the running program and its number is 0. File permissions : Permission can be a single permission or a list of permissions. A permission is an atom among:. If PathName does not exists or if its permissions do not include Permission this predicate fails. Template should contain a pathname with six trailing X s.

PathName is Template with the six X s replaced with a letter and the process identifier. This predicate is an interface to the C Unix function mktemp 3. This predicate is an interface to the C Unix function tempnam 3.

If the sockets are available section 8. The control is returned to Prolog upon termination of the called process. The control is returned to Prolog upon termination of the shell process.

This predicate is an interface to the C Unix function system 3. The control is returned to Prolog upon termination of the command. This predicate is an interface to the C Unix function popen 3. StreamIn is unified with the stream-term associated with the standard input stream of Command it is an output stream. StreamOut is unified with the stream-term associated with the standard output stream of Command it is an input stream.

StreamErr is unified with the stream-term associated with the standard error stream of Command it is an input stream. Pid is unified with the process identifier of the new process. In the parent process Pid is unified with the PID of the child while in the child process Pid is unified with 0.

This predicate is an interface to the C Unix function fork 2. StreamIn is unified with the stream-term associated with the input side of the pipe and StreamOut is unified with the stream-term associated with output side. This predicate is an interface to the C Unix function pipe 2. Status is then unified with the exit status. This predicate is an interface to the C Unix function waitpid 2. Signal can be specified directly as an integer or symbolically as an atom. Allowed atoms depend on the machine e.

This predicate is an interface to the C Unix function kill 2. This predicate is an interface to the C Unix function usleep 3. ReadyReads is unified with the list of elements listed in Reads that have characters available for reading. Similarly ReadyWrites is unified with the list of elements of Writes that are ok for immediate writing. The elements of Reads and Writes are either stream-terms or aliases or integers considered as file descriptors, e.

This predicate is an interface to the C Unix function select 2. This set of predicates provides a way to manipulate sockets. The predicates are straightforward interfaces to the corresponding BSD-type socket functions. This facility is available if the sockets part of GNU Prolog has been installed.

A reader familiar with BSD sockets will understand them immediately otherwise a study of sockets is needed.

HostName is an atom denoting a machine name, Port is a port number and SocketName is an atom denoting a socket. By default, streams associated with sockets are block buffered. They are also text streams by default. This predicate is an interface to the C Unix function socket 2.

This predicate should not be used if Socket has given rise to a stream, e. If Port is uninstantiated, it is unified to a port number picked by the operating system. This predicate is an interface to the C Unix function bind 2. StreamIn is unified with a stream-term associated with the input of the connection it is an input stream. Reading from this stream gets data from the socket.

StreamOut is unified with a stream-term associated with the output of the connection it is an output stream. Writing to this stream sends data to the socket.

This predicate is an interface to the C Unix function connect 2. This predicate is an interface to the C Unix function listen 2. This predicate is an interface to the C Unix function accept 2.

Hostname can be given as a fully qualified name, or an unqualified name or an alias of the machine. The predicate will fail if the machine name or address cannot be resolved. The following predicates are only available if the linedit part of GNU Prolog has been installed. By default all other reads have an empty prompt. This prompt will be displayed for reads from a terminal except for top-level reads.

Only words containing letters, digits and the underscore character are added if Word does not respect this restriction the predicate fails. The solver is an instance of the Constraint Logic Programming scheme introduced by Jaffar and Lassez in [ 7 ]. Constraints on FD are solved using propagation techniques, in particular arc-consistency AC. Van Hentenryck [ 8 ].

The solver is based on the clp FD solver [ 4 ]. The GNU Prolog FD solver offers arithmetic constraints, boolean constraints, reified constraints and symbolic constraints on an new kind of variables: Finite Domain variables. A new type of data is introduced: FD variables which can only take values in their domains.

The initial domain of an FD variable is The domain of an FD variable X is reduced step by step by constraints in a monotonic way: when a value has been removed from the domain of X it will never reappear in the domain of X.

An FD variable is fully compatible with both Prolog integers and Prolog variables. Namely, when an FD variable is expected by an FD constraint it is possible to pass a Prolog integer considered as an FD variable whose domain is a singleton or a Prolog variable immediately bound to an initial range This avoids the need for specific type declaration.

Although it is not necessary to declare the initial domain of an FD variable since it will be bound This overflow causes a negative result for the upper bound and the constraint then fails. Once a variable uses a sparse representation it will not switch back to an interval representation even if there are no longer holes in its domain.

This flag is updated on every operations. The domain of an extra-constrained FD variable is output followed by the symbol. When a constraint fails on a extra-constrained variable a message Warning: Vector too small - maybe lost solutions FD Var: N is displayed N is the address of the involved variable. Finally, bit-vectors are not dynamic, i. Unfortunately, in some cases it cannot detect the lost of values and no message is emitted.

So the user should always take care to this parameter to be sure that it is large to encode any vector. This predicate is generally used to set the initial domain of variables to an interval. Vars can be also a single FD variable or a single Prolog variable. This predicate is generally used to set the initial domain of variables to a set of values.

The domain of each variable of Vars uses a sparse representation. These predicate allow the user to get some information about FD variables. They are not constraints, they only return the current state of a variable.

An FD arithmetic expression is a Prolog term built from integers, variables Prolog or FD variables , and functors or operators that represent arithmetic functions.

The following table details the components of an FD arithmetic expression:. FD expressions are not restricted to be linear. However non-linear constraints usually yield less constraint propagation than linear constraints. These predicates post arithmetic constraints that are managed by the solver using a partial arc-consistency algorithm to reduce the domain of involved variables.

In this scheme only the bounds of the domain of variables are updated. This leads to less propagation than full arc-consistency techniques section 9. These arithmetic constraints can be reified section 9. Refer to the syntax of arithmetic FD expressions for possible errors section 9. These predicates post arithmetic constraints that are managed by the solver using a full arc-consistency algorithm to reduce the domain of involved variables.

In this scheme the full domain of variables is updated. This leads to more propagation than partial arc-consistency techniques section 9.

This constraint enforces a sparse representation for the domain of X section 9. An boolean FD expression is a Prolog term built from integers 0 for false, 1 for true , variables Prolog or FD variables , partial AC arithmetic constraints section 9.

When a sub-expression of a boolean expression is an arithmetic constraint c , it is reified. Namely, as soon as the solver detects that c is true i. Similarly when the solver detects that c is false i. While neither the entailment nor the disentailment can be detected the sub-expression is evaluated as a domain The following table details the components of an FD boolean expression:. Upper ] in the boolean variable B. These predicates post boolean constraints that are managed by the FD solver using a partial arc-consistency algorithm to reduce the domain of involved variables.

The dis entailment of reified constraints is detected using either the bounds for partial AC arithmetic constraints or the full domain for full AC arithmetic constraints. Refer to the syntax of boolean FD expressions for possible errors section 9. Each C i must be a boolean FD expression section 9. This is equivalent to posting an inequality constraint for each pair of variables.

This constraint is triggered when a variable becomes ground, removing its value from the domain of the other variables. A tuple is represented by a list. A column is represented by a list. Vars can be also a single FD variable. FD labeling options : Options is a list of labeling options.

When a failure occurs either because there are no remaining choice-points for Goal or because the added constraint is inconsistent with the rest of the store the last solution is recomputed since it is optimal. The interface also performs automatic error detection depending on the actual type of the passed argument. An important feature is the ability to write non-deterministic code in C.

It is also possible to call or callback a Prolog predicate from a C function and to manage Prolog non-determinism: the C code can ask for next solutions, remove all remaining solutions or terminate and keep alternatives for the calling Prolog predicate. The C code should include gprolog. Include this files as follows:. If the installation has been correctly done nothing else is needed. New in GNU Prolog 1. All these prefixes should be avoided by the foreign C-code to prevent name clashes.

To ensure a backward compatibility, the names used by the old API are available thanks to a set of define. However, this deprecated API should not be used by recent code. It is also possible to prevent the definition of the compatibility macros using:. If you need to write code which depends on a specific version, you must be more careful. Recall these macros appeared in GNU Prolog 1. This interface can then be used to write both simple and complex C routines.

A simple routine uses either input or output arguments which type is simple. To manipulate complex terms lists, structures a set of functions is provided. Finally it is also possible to write non-deterministic C code. The general form is foreign Template, Options which defines an interface predicate whose prototype is Template according to the options given by Options.

Foreign options : Options is a list of foreign options. Foreign modes and types : each argument of Template specifies the foreign mode and type of the corresponding argument. Each argument of Template is formed with a mode symbol followed by a type name.

Possible foreign modes are:. Simple foreign type : a simple type is any foreign type listed in the above tabled except term. A simple foreign type is an atomic term character and character-code lists are in fact lists of constants. Complex foreign type : type foreign type term refers to any Prolog term e.

Several functions are provided to manipulate PlTerm variables section Since the original term is passed to the function it is possible to read its value or to unify it.

So the meaning of the mode symbol is less significant. For this reason it is possible to omit the mode symbol. The type returned by the C function depends on the value of the return foreign option section If the return option is none the C function is of type void. Finally if it is jump , the function shall return the address of a Prolog predicate and, at the exit of the function, the control is given to that predicate.

The type of the arguments of the C function depends on the mode and type declaration specified in Template for the corresponding argument as explained in the following sections. An input argument is tested at run-time to check if its type conforms to the foreign type and then it is passed to the C function.

The type of the associated C argument is given by the above table section It is also the case when term is specified without any mode symbol. An output argument is tested at run-time to check if its type conforms to the foreign type and it is unified with the value set by the C function. The type of the associated C argument is a pointer to the type given by the above table section For instance, the effective argument Arg associated with -positive foreign declaration is handled as follows:.

At the exit of the function this term will be unified with the actual predicate argument. This value can be tested by the C function to determine which treatment to perform. The field unify controls whether the effective argument must be unified at the exit of the C function.

The field value stores the value of the argument. It is declared as a C union since there are several kinds of value types. For instance, the effective argument Arg associated with? The interface allows the user to write non-deterministic C code. When a C function is non-deterministic, a choice-point is created for this function.

When a failure occurs, if all more recent non-deterministic code are finished, the function is re-invoked. It is then important to inform Prolog when there is no more solution i. So, when no more choices remains the function must remove the choice-point. The interface increments a counter each time the function is re-invoked. At the first call this counter is equal to 0. This information allows the function to detect its first call. When writing non-deterministic code, it is often useful to record data between consecutive re-invocations of the function.

The interface maintains a buffer to record such an information. This size is the number of consecutive PlLong s needed by the C function. All examples presented here can be found in the ExamplesC sub-directory of the distribution, in the files examp. The predicate must fail if C does not appear in A. We here define a predicate occurrence A, C, P which unifies P with the position from 0 of one occurrence of the character C in the atom A. The predicate will fail if C does not appear in A.

The predicate is re-executable on backtracking. The information that must be recorded between two invocations of the function is the next starting position in A to search for C. It is possible to improve this behavior by deleting the choice-point when there is no more occurrence. To do this it is necessary to do one search ahead. The information stored is the position of the next occurrence.

If Char is instantiated it is necessary to enforce the unification of Code since it could be instantiated. The way to raise Prolog errors is described later section In the following we presents a set of functions to manipulate Prolog terms.

For simple foreign terms the functions manipulate simple C types section Functions managing lists handle an array of 2 elements of type PlTerm containing the terms corresponding to the head and the tail of the list.

For the empty list NULL is passed as the array. These functions require to flatten a list in each sub-list. To simplify the management of proper lists i. The caller of these functions must provide the array.

Indeed many functions check if the Prolog argument is correct. For each of these functions there is a also check-free version called Name. We then only present the name of checking functions. Each atom has a unique internal key an integer which corresponds to its index in the GNU Prolog atom table. It is possible to obtain the information about an atom and to create new atoms using:. If the atom already exists its key is simply returned. The string str passed to the function should not be modified later.

It simply makes a dynamic copy of str using strdup 3. They all check the validity of the Prolog term to read emitting appropriate errors if necessary.

Simple foreign types : for each simple foreign type section Refer to the introduction of this section for more information about the arguments of complex functions section They all check the validity of the Prolog term to unify emitting appropriate errors if necessary.

The following functions perform a general unification between 2 terms. The second one performs a occurs-check test while the first one does not. Complex terms : the following functions accept the sub-arguments terms of complex terms as an array of PlTerm. All these functions check the type of the term to unify and return the result of the unification.

So a good method is to check the validity of all arguments to unify and later to do the unification using check-free functions. Obviously if there is only one to unify it is more efficient to use a unify function checking the argument. Biden to send military medical teams to help hospitals. GameStop PS5 in-store restock. N95, KN95, KF94 masks. Microsoft is done with Xbox One. Windows Windows.

Most Popular. New Releases. Desktop Enhancements. Networking Software. Trending from CNET. Download Now. Developer's Description By Daniel Diaz. Full Specifications. What's new in version 1. The program provides support for unicode character sets, which makes it suitable for creating web-based and multilingual applications.

Multi-threading support run multiple prolog engines on the same database , compiled code tracing, a set of specialized instructions and built-in predicates, attributed and global variables, unit testing using PiDoc, support for creating LaTeX documentation are other advantages that this application brings you.

Its array of features are enough to please the experienced users, since advanced programming knowledge is required in order to use it. Download Win-Prolog for free. GNU Prolog for Windows x64 bit 1. Daw Reaper Free Download. Therefore, deterministic tail-recursive predicates are executed with constant stack space, like loops in other languages.

Finding clauses that are unifiable with a term in a query is linear in the number of clauses. Term indexing uses a data structure that enables sub-linear-time lookups.

Most Prologs only use indexing on the first term, as indexing on all terms is expensive, but techniques based on field-encoded words or superimposed codewords provide fast indexing across the full query and head. This tends to yield very large performance gains when working with large corpora such as WordNet. Subgoals encountered in a query evaluation are maintained in a table, along with answers to these subgoals.

If a subgoal is re-encountered, the evaluation reuses information from the table rather than re-performing resolution against program clauses. Tabling is a space—time tradeoff; execution time can be reduced by using more memory to store intermediate results. During the Fifth Generation Computer Systems project, there were attempts to implement Prolog in hardware with the aim of achieving faster execution with dedicated architectures. Although Prolog is widely used in research and education, Prolog and other logic programming languages have not had a significant impact on the computer industry in general.

Software developed in Prolog has been criticised for having a high performance penalty compared to conventional programming languages. In particular, Prolog's non-deterministic evaluation strategy can be problematic when programming deterministic computations, or when even using 'don't care non-determinism' where a single choice is made instead of backtracking over all possibilities.

Cuts and other language constructs may have to be used to achieve desirable performance, destroying one of Prolog's main attractions, the ability to run programs 'backwards and forwards'. Prolog is not purely declarative: because of constructs like the cut operator, a procedural reading of a Prolog program is needed to understand it. As a result, many practical Prolog programs are written to conform to Prolog's depth-first search order, rather than as purely declarative logic programs.

Various implementations have been developed from Prolog to extend logic programming capabilities in numerous directions. These include types, modes, constraint logic programming CLP , object-oriented logic programming OOLP , concurrency, linear logic LLP , functional and higher-order logic programming capabilities, plus interoperability with knowledge bases:. Prolog is an untyped language. Attempts to introduce types date back to the s, [55] [56] and as of there are still attempts to extend Prolog with types.

The syntax of Prolog does not specify which arguments of a predicate are inputs and which are outputs. Constraint logic programming extends Prolog to include concepts from constraint satisfaction. It is suited to large-scale combinatorial optimisation problems [64] and is thus useful for applications in industrial settings, such as automated time-tabling and production scheduling. Most Prolog systems ship with at least one constraint solver for finite domains, and often also with solvers for other domains like rational numbers.

Flora-2 is an object-oriented knowledge representation and reasoning system based on F-logic and incorporates HiLog, Transaction logic, and defeasible reasoning. Logtalk is an object-oriented logic programming language that can use most Prolog implementations as a back-end compiler. As a multi-paradigm language, it includes support for both prototypes and classes.

Support for other platforms was added, and a second version was released in Cedar is a free and basic Prolog interpreter. This provides a new platform to programming in Prolog through ActionScript. Visual Prolog 7. The goal of Visual Prolog is to support industrial strength programming of complex knowledge emphasized problems. It supports advanced client-server and three-tier solutions is especially well suited for dealing with complex knowledge.

There is library support for: file system, console, registry, environment variables and GUI programs. The Personal Edition has limited library support compared to the Commercial Edition. All informations about programs or games on this website have been found in open sources on the Internet. All programs and games not hosted on our site. When visitor click 'Download now' button files will downloading directly from official sources owners sites. QP Download is strongly against the piracy, we do not support any manifestation of piracy.

We are DMCA-compliant and gladly to work with you. You can find a lot of useful information about the different software on our QP Download Blog page. Additional information about license you can found on owners sites. It's easy! Just click the free Visual Prolog download button at the top left of the page.

Clicking this link will start the installer to download Visual Prolog free for Windows. Gnu Prolog Download Redirected from Prolog programming language. Programming in Prolog. Berlin ; New York: Springer-Verlag. ISBN Prolog programming for artificial intelligence 4th ed. Natural language processing for Prolog programmers. Englewood Cliffs, N. Foundations of logic programming.

Berlin: Springer-Verlag.



0コメント

  • 1000 / 1000