Content deleted Content added
No edit summary |
straightening parentheses |
||
Line 19:
}}
Gödel is a general-purpose, [[declarative programming language]] based on one of the four main programming paradigms, namely, [[logic programming]]. It was developed by Patricia M. Hill and John W. Lloyd. Basic ideas and features of Gödel are mainly taken from [[Prolog]] language. It is named in honour of logician [[Kurt Gödel]], although the acronym
Gödel is a [[strongly typed]] system based on many-sorted logic with parametric polymorphism. It involves many data types and modules, supports integers and floating-point numbers of an arbitrary precision (including infinite precision. The Gödel language enables to solve constraint problems over finite domains of integers or rationals. It supports processing of finite sets. It offers a flexible computation rule and a pruning operator which generalises the commit of the concurrent logic programming languages. The declarative nature of Gödel programs makes Gödel well suited as a teaching language (because students can concentrate much more on writing down what it is they want to compute without being so concerned about how to compute it). Gödel narrows the gap between theory and practice in logic programming, since it reduces a significant number of non-logical features without useful semantics, and so Gödel language provides a bridge between theory and practice.
Very detailed overview of Gödel programming language, precise descriptions and formal definitions of the syntax and semantics of the language with many examples and background material on logic can be found in the book <ref name=HillLloyd></ref>.
Line 33:
Currently in the Information (Computer or Digital) Age, programming languages are crucial communication tools to computers, mobile (smart) telephones and other devices. Programming languages can be divided into three dominant groups: general purpose programming languages, ___domain specific programming languages and modelling languages. Usage of a particular type of programming language depends on the project and knowledge of particular languages. The initial point of the programming process is the understanding of a particular problem that a programmer is trying to solve. The problem is then formalised as an intended interpretation of a language which in case of Gödel is a first-order language. The intended interpretation specifies the various domains and the meaning of the symbols of the language in these domains.
The first-order language (as
Obviously, [[higher-order logic]] exists where, typically, predicates have other predicates or functions as arguments, or in which one or both of predicate quantifiers or function quantifiers are permitted. In first-order theories, predicates are often associated with sets. In interpreted higher-order theories, predicates may be interpreted as sets of sets. No first-order theory, however, can fully and categorically describe structures with an infinite ___domain, such as the natural numbers or the real numbers. Categorical axiom systems for these structures can be obtained in stronger logic such as second-order logic.
Line 43:
Declarative programming in general can be understood in a weak and a strong sense. In the weak sense, declarative programming means that programs are theories, but that a programmer may have to supply control information to produce an efficient program. Declarative programming, in the strong sense, means that programs are theories and all control information is supplied automatically by the system. In other words, for declarative programming in the strong sense, the programmer only has to provide the intended interpretation (or, perhaps, a theory which has the intended interpretation as a model). Gödel itself is a contribution to declarative programming in the weak sense. Thus Gödel programs are theories, but programmers are largely responsible for providing suitable control information.
Declarative programming is much more concerned with expressing the logic of a computation without describing its control, i.e. describing what the program should do, rather than describing how (that is the control part) it should be computed. Logical sentences can also be understood procedurally as goal-reduction procedures (also known as routines, subroutines, methods, or functions) with well set series of computational steps to be carried out. The Gödel programming language is not a procedural language. Although, the main advantage of the procedural semantics is portability, so that one could port a program from one implementation to another and be confident of identical behaviour of the program in the two systems,
[[Prolog]], [[HTML]], [[SQL]] together with Gödel rank among [[declarative programming languages]], while [[C/C++]], [[Fortran]] and [[Pascal]] are examples of [[procedural programming languages]].
Line 58:
[[Parametric polymorphism]] is the second most important aspect of the type system. It is common for programmer to want to write a definition of a predicate for which the arguments of the predicate vary in used types. For example, the Append predicate is normally written so that it can append lists of any type. A symbol is polymorphic if its declaration contains a parameter; otherwise it is monomorphic. A polymorphic symbol can be understood as representing a collection of (monomorphic) symbols.
=== Modules ===
A module system simply provides a way of writing large programs so that various pieces of the program
The Gödel language include modules that process numbers, lists, strings and sets, modules that provide input/output, and modules that provide meta-programming facilities. Gödel also makes significant use of abstract data types, which are implemented by means of the module and type systems. An abstract data type consists of a type and a collection of operations on the type. Abstract data types have many advantages for software engineering, including the provision of a higher level of abstraction for programmers and the ability to change the implementation of a type without affecting existing code. The Gödel system modules provide a number of important abstract data types, including Unit (the type of units which are term-like structures), Flock (the type of ordered collections of units), Program (the type of terms representing Gödel programs), and Theory (the type of terms representing polymorphic many-sorted first order theories). The corresponding module provides a collection of operations on the type and the module system is used to hide the implementation details of these operations. Furthermore, a number of other Gödel system modules provide types which are at least partly abstract.
Line 75:
Gödel has constraint-solving capabilities in the domains of integers and rational numbers. It can solve systems of (not necessarily linear) constraints which involve integers, variables which range over bounded intervals of integers, and the usual functions and predicates with integer arguments. It can also solve systems of linear rational constraints involving rationals, variables ranging over the rationals, and the usual functions and predicates with rational arguments.
The Gödel pruning operator (a difference from
The other facility provided by Gödel that gives a form of control is the IF-THEN-ELSE construct, which has several variations. This construct has a declarative meaning, but also provides the important control information that the condition in the IF part should be computed only once. This can result in an important saving if this condition is computationally expensive. One variation omits the ELSE part and another allows existentially quantified variables to appear in the IF and THEN parts. The IF-THEN-ELSE facility figures prominently in the Gödel programming style.
Line 85:
=== Input/Output ===
Unfortunately, at the interface between a program and the external world, the declarative semantics of a program can be severely compromised. To try to ameliorate such difficulties, it is recommended that programmers exploit
Input/output and pruning facilities adversely affect the declarative semantics of Gödel programs. Input/output introduces side-effects via read predicates. However, this problem can be ameliorated by appropriate use of the module system. Commit affects the declarative semantics because it can cause correct answers to be pruned. Fortunately, Gödel programs generally need few uses of pruning. Except where use is made of either of these two facilities, Gödel programs are declarative.
Line 96:
In general, any programming language should satisfy five properties. It should be: high level (providing concepts as close as possible to those which people like to use to express their thoughts and ideas), expressive (providing concepts that can be used to model real-world situations easily and concisely), efficient (programs run at speeds and memory costs similar to competing languages), practical (that can be used for large-scale, real-world applications), and of a simple (mathematical) semantics (for which programmers can relatively easily verify and debug their programs and be assured of the correctness of program transformations, optimalisations, and so on).
Prolog is high level, efficient and practical. However, it is not sufficiently expressive as the logic it uses is untyped. Then,
The solution to these semantic problems it to take more seriously the central thesis of logic programming, which is that
Line 105:
Gödel directly addresses these semantics problems of Prolog. The main design aim of Gödel is to have functionality and expressiveness similar to Prolog, but to have greatly improved declarative semantics compared with Prolog. Gödel is intended to have the same relation to Prolog as Pascal does to Fortran. Prolog was designed at the birth of logic programming before researchers had a clear understanding of how best to handle many facilities. Consequently, these facilities compromised its declarative semantics.
Example of meta-program: the standard solve interpreter. This interpreter consists of the following definition for solve.
Line 136:
Prolog uses the cut as its pruning operator. However, cut has a number of semantic problems. The first of these problems is that cut, at least as it is employed in existing Prolog systems, allows considerable uncertainty about what the underlying logic component of the program is. This is because programmers can exploit the sequential nature of cut to leave “tests” out and when this is done the logic component of the program cannot be obtained by simply removing all the cuts from the program. Furthermore, there is no convention for systematically putting back the omitted tests so as to define the logic component precisely. The second problem with cut is that its use, in the presence of negation, can be unsound, in the sense that a computed answer may not be correct with respect to the completion of the logic component of the program.
For these reasons and because the commit of the concurrent logic programming languages has better semantics,
M <- Q | R.
Line 214:
Gödel programming language benefits from previous designed languages and work of many authors. It is based on, and supposed to be a successor of Prolog that was developed by Alain Colmerauer in 1972. Gödel then contains:
* the intensional set terms developed from set processing facilities introduced around 1980 into Prolog by David H.D. Warren
* pruning operator first appeared in the Relational Language of Keith Clark and Steve Gregory in the early
* the if-then-else construct and the when control declaration taken from NU-Prolog introduced by Lee Naish around 1986
* the type system based on many-sorted first order logic with the addition of polymorphism through parameters and constructors
* the ideas of the polymorphic component are made by Robin Milner (introduced in ML in the
* the module system is based on standard ideas of Modula-2
* the constraint solving facilities are partially developed by Alain Colmerauer, Joxan Jaffar, Jean-Luis Lassez (influenced by work of Kenneth Bowen and Robert Kowalski which itself relies on work of Kurt Gödel)
|