SOFTWARE VERIFICATION RESEARCH CENTRE DEPARTMENT OF COMPUTER SCIENCE THE UNIVERSITY OF QUEENSLAND. Queensland 4072 Australia TECHNICAL REPORT. No.

Size: px
Start display at page:

Download "SOFTWARE VERIFICATION RESEARCH CENTRE DEPARTMENT OF COMPUTER SCIENCE THE UNIVERSITY OF QUEENSLAND. Queensland 4072 Australia TECHNICAL REPORT. No."

Transcription

1 SOFTWARE VERIFICATION RESEARCH CENTRE DEPARTMENT OF COMPUTER SCIENCE THE UNIVERSITY OF QUEENSLAND Queensland 4072 Australia TECHNICAL REPORT No. 190 Higher Level Meta Programming in Qu-Prolog 3.0 A.S.K. Cheng, P.J. Robinson and J. Staples October 1990 Phone: Fax:

2 Higher Level Meta Programming in Qu-Prolog 3.0 Anthony S.K. Cheng, Peter J. Robinson and John Staples Software Verication Research Centre Department of Computer Science University of Queensland, 4072, Australia Abstract For representing high level knowledge, such as the mathematical knowledge used in interactive theorem provers and verication systems, it is desirable to extend Prolog's concept of data object. A basic reason is that Prolog data objects Herbrand objects are terms of a minimal object language, which does not include its own object variables, or quantication over those variables. Qu-Prolog (Quantier Prolog) is an extended logic programming concept which takes as its data objects, object terms which may include object level variables, free or bound, and arbitrary quantiers to bind those variables. Qu-Prolog is unique in allowing its data objects to include free occurrences of object variables. This paper describes Qu-Prolog's data objects and its facilities for computing on those objects. The Qu-Prolog unication algorithm unies Qu- Prolog terms up to changes of bound variables. The power of Qu-Prolog unication is greatly increased by the inclusion in the language of an evaluable substitution operator which correctly substitutes at unication time for free occurrences of object variables. Some related Qu-Prolog facilities for implementing theorem proving algorithms are described, including a new method for persisting data across queries. Qu-Prolog 3.0 is a compiled implementation which is in experimental use, supporting the development of interactive reasoning systems. 1 Introduction Prolog-like languages are highly successful theorem provers, within the scope of their vocabulary and inference algorithms; but how good are Prolog-like languages for implementing theorem provers in general, and other symbolic algorithms? A basic limitation of most Prolog-like languages, considered as a means for implementing symbolic algorithms, is that Prolog's symbolic data objects Herbrand objects have minimal syntactic structure, which does not directly represent very much of the structure of knowledge in logic, mathematics and science. For example, Prolog does not directly compute with symbolic objects which have their own object variables, and quantiers 1

3 binding those variables. It is of course possible to represent these structures logically in Prolog (for example, the `ground representation' of Prolog terms in meta-programming), but that leads to poor eciency, clumsy low level algorithms and a failure to exploit in the language primitives, the inherent structure of the data. Qu-Prolog (Quantier Prolog) is an extended logic programming concept which takes as its data objects, object terms which may include object level variables, free or bound, and arbitrary quantiers to bind those variables. More precisely, Qu-Prolog objects are equivalence classes of such terms, where the equivalence relation is -equivalence, that is equivalence up to changes of bound variables. The basic semantics for Qu-Prolog is in the same style as for Prolog: a Qu-Prolog program is a free-variable, rst order theory of a specic, well-known universe of discourse (equivalence classes of object level terms). The Clark semantics of Qu-Prolog programs is dened in essentially the same way as for Prolog. The main dierence is that in the Qu-Prolog case, the axioms for equality in the completion of the program, and which characterise the deductive power of unication, are more complex. Partly that is because -equivalence of quantied terms is a more complex concept than identity of ground, free-variable terms. A more important reason however is that Qu-Prolog unication performs much more powerful pattern matching than does Prolog unication. That is because the vocabulary used to describe schemes of Qu-Prolog terms includes a parallel substitution operator which is evaluated at unication time. This operator describes substitution of object terms for object variables. It formalises a notation which is widely used in meta level reasoning, and is at the heart of the deductive power of Qu-Prolog. It is beyond the scope of this paper to discuss the Clark semantics of Qu- Prolog in detail, but see [13] for properties of Qu-Prolog equality which are suitable as axioms for the completion of Qu-Prolog programs. Note however that [13] refers to a previous version, Qu-Prolog 2.0; the version described here requires stronger equality axioms. Since Prolog and Qu-Prolog semantics are dierent, it is not to be expected that their properties will be identical. For example, Qu-Prolog uni- cation is undecidable [10]; it is made practical by delaying dicult unication subproblems. Accordingly, Qu-Prolog does not have the same strong completeness properties as Prolog. A weaker notion of completeness can be dened and established, however. It is beyond the scope of this paper to discuss that in detail, but see [11]. The representation of terms in Qu-Prolog is described in section 2. Section 3 discusses the unication of Qu-Prolog terms. The use of Qu-Prolog terms is demonstrated in section 4. Qu-Prolog's persistent variables, and the language's support for them are described in section 5.

4 2 The Language Qu-Prolog uses Edinburgh Prolog syntax for constants and structures, and for ordinary variables which are intended to range over arbitrary object level terms. These variables will be referred to as meta variables, in recognition of the meta level status of the Qu-Prolog language relative to the object language. In addition, Qu-Prolog introduces syntax to represent object level variables and quantiers, as follows. 2.1 Object Variables Since object level variables are simply part of the object level syntax, it might seem natural to name them at the Qu-Prolog (meta) level by constants. Instead, Qu-Prolog 3.0 refers to object level variables only by a type of Qu-Prolog (meta) level variable, called object-var variables. The semantics of object-var variables is that they range over object level variables. The success of this approach reects the well-known intuition that object level variables are interchangeable. The phrase `object variable' is commonly used to abbreviate `object-var variable' since it has no other use in describing Qu-Prolog syntax. For an occasional reference to a variable of the object language, the phrase `object level variable' will be used. Qu-Prolog 3.0 object variables have the same lexical conventions as constants. In order to distinguish them, object variable notations must be declared by object var/1. The declaration convention is that an explicit declaration of an object variable name also implicitly declares all variant names derived by appending an underscore followed by a positive integer. Warning: This lexical convention for object variables makes it easy to think that object variables are meta level constants. That is not so, as explained above. As each object variable is intended to range over all object level variables, it is important to know whether two object variables denote the same object level variable. This information can be supplied implicitly or by explicit use of the predicate distinct from/2. For example, x distinct from y asserts that x and y do not denote the same object level variable. By default, all object variables occurring in the same clause/query are distinct from each other. Distinctness of object level variables is a special case of more fundamental relationship between object level variables x and object level terms t in general: that x does not occur free in t. To represent this relationship Qu-Prolog 3.0 uses the built-in predicate not free in/2. The predicate distinct from/2 can be regarded as being dened by the following, where x and y are assumed to be declared as object variable names: x distinct from y :- x not free in y.

5 For eciency reasons however, this is not the actual implementation of distinct from in Qu-Prolog 3.0. Remark: In fact Qu-Prolog 3.0 makes internal use of some meta level constants representing object level variables. These terms, called local object variables, are discussed below. Their key role is as `new' variables, for use when changing bound variables. This newness is implemented by a convention that they are excluded from instantiations of user accessible meta variables and object-var variables. 2.2 Quantiers Qu-Prolog can reason about object level terms which include arbitrary quantiers, in much the same way that Prolog can reason about terms which include arbitrary function symbols. The user declares quantier notations as needed. So, it is possible to have representations of R for integral calculus as well as 8; 9 for rst order logic. This capability is demonstrated later (section 4) in a Qu-Prolog interpreter for the full (type-free) lambda calculus, by declaring a lambda quantier. Distinct quantier notations in Qu-Prolog represent distinct object level quantiers. Qu-Prolog uses the traditional prex notation for quantied terms. Quantiers are declared explicitly by executing op(precedence; quant; Q) where Q is the representation for the quantier; Q must have the same lexical structure as a Prolog constant. Qu-Prolog treats quantiers as arbitrary binders of object variables, whereas Prolog [6] treats its quantiers as labelled lambda abstractions. Both these languages should be distinguished from NU-Prolog [8] and Meta Prolog [1], in which specic (meta level) quantiers (e.g. 8) form part of the programming language, but are not part of the object level syntax. 2.3 Substitutions Throughout logical reasoning, the need for substitutions arises naturally. Qu-Prolog directly supports parallel substitution for free occurrences of object level variables. By contrast, Prolog implicitly supports substitution by supporting reduction of beta redexes in the lambda calculus. The syntax for substitutions in Qu-Prolog is [t 1 =x 1 ; : : :; t n =x n ] term where x 1 ; : : : ; x n are object variables and t 1 ; : : : ; t n are arbitrary Qu-Prolog terms. As an example, consider an inference rule If 8 x A is a theorem then for each B, [B=x] A is a theorem.

6 This can be represented directly by a Qu-Prolog rule such as theorem([b/x] * A) :- theorem(forall x A). Qu-Prolog substitutions are evaluated at unication time, in accordance with the standard concept of correct substitution into quantied terms, which substitutes only for free occurrences of variables and which changes bound variables to avoid capture of free variables from the substituted terms. For a term s 1 : : : s n y where s 1 ; : : :; s n is a sequence of substitutions, the substitutions are applied from right to left. That is, s n is applied to y rst. The eect of applying a substitution to a term can be observed with this example [t 1 =x 1 ; : : :; t n =x n ] y: After applying the substitution, the result will be: t i if for some i = 1; : : : ; n; x i = y, or y if for all i = 1; : : :; n; x i distinct from y. It is also possible that there is insucient information at a particular stage to determine which of these cases applies. In that case evaluation of the substitution will be delayed. That may lead to delaying of unication subproblems, perhaps extending beyond the current unication call. To clarify this idea, consider [b=x 0 ] [f(x 0 )=x 1 ; g(x 0 )=x 2 ] y. One of the following will result: g(b) if y = x 2. f(b) if y distinct from x 2 and y = x 1. b if y distinct from x 1 and y distinct from x 2 and y = x 0. y if y distinct from x 0 and y distinct from x 1 and y distinct from x 2. [b=x 0 ] y if y distinct from x 1 and y distinct from x 2 and no information is known about the relationship between y and x 0. [b=x 0 ] [f(x 0 )=x 1 ; g(x 0 )=x 2 ] y if no information is known about the relationship between y and x 1, x 2. As well as substitutions appearing in user inputs, the system can generate substitutions via unication. For example, the problem has the solution A = [x=y] B. forall x A = forall y B

7 3 Unication Qu-Prolog extends Prolog unication to cover the new data objects in the language, and to take account of the evaluation of the substitution operation. Since unication for Prolog terms is not changed (except that Qu-Prolog includes occurs checking), our discussion will concentrate on the new features. 3.1 Object Variables Since an object variable is intended to range over object level variables, and since object variables are the only Qu-Prolog terms of this type, an object variable can be instantiated only to another object variable. Further, unication fails if the object variables denote distinct object level variables. Also, whenever a meta variable is unied with an object variable, the meta variable is bound to the object variable. 3.2 Quantiers To motivate the treatment of unication for quantied terms, consider forall x x = forall y y Intuitively, the two terms are uniable without instantiation of x or y, because the terms are the same up to change of bound variable. To unify x and y would destroy the completeness of Qu-Prolog's unication. Hence during quantier unication, Qu-Prolog uses substitution to rename the bound variables to a common bound variable. The bound variable must not appear in the unied terms. This is where the local object variables mentioned previously are used. Once bound variables for both terms are renamed to the same local variable, the two substituted terms are unied. Here is how the approach applies to the example, ( is a local object variable). forall x x = forall y y forall [=x] x = forall [=y] y As another example, consider [=x] x = [=y] y = (success) forall x A = forall y y It is initially simplied to [=x] A = [=y] y

8 Unication should produce the answer A = x. Qu-Prolog inverts substitutions containing only local object variables. In this example inversion results in A = [x=] [=y] y and the correct answer A = x is obtained after evaluating the substitution. As a further example, consider f orall x A = f orall y x. Since x does occur free on the right and cannot occur free on the left, this unication problem should fail. In Qu-Prolog unication, that failure is detected when, at the time of calculation of A = [x=] [=y] x, the constraint x not free in [=y] x is generated and tested; and after substitution evaluation, this test fails. Such not f ree in constraints may be delayed, as discussed below, if they cannot be immediately decided. 3.3 Occurs Check and Delayed Problems Unlike Prolog, occurs checking is included as standard in Qu-Prolog unication. Implementation of occurs checking uses two tests for occurrence called direct and static occurrence, as described below. Direct occurrence is a suf- cient condition for occurrence and so causes failure of unication. On the other hand `no static occurrence' is sucient for `no occurrence'. If occurs checking is not resolved, delaying of the unication sub-problem occurs. A meta variable X directly occurs in a term t (in which substitutions have been evaluated as far as possible) if t = s X, or t = f(t 1 ; : : :; t n ) and X directly occurs in one of t 1 ; : : : ; t n, or t = q x t 0 where q is a quantier, and X directly occurs in t 0. The unication of X and t fails if t is not of the form sx and X directly occurs in t. But, for example, it is impossible to determine whether X occurs in the term [X=y] Z without knowing more information about Z. If Z is bound to y, X occurs in the term. On the other hand, if Z is bound to a constant c, X does not occur. A meta variable X statically occurs in a term t (in which substitutions have been evaluated as far as possible) if t = s X, or t = f(t 1 ; : : :; t n ) and X statically occurs in one of t 1 ; : : :; t n, or t = q x t 0 where q is a quantier, and X statically occurs in t 0, or t = s [t 1 =x 1 ; : : : ; t n =x n ] Y where Y is a meta variable other than X, and X statically occurs in one of in s t 1 ; : : : ; s t n. t = s [t 1 =x 1 ; : : : ; t n =x n ] x 0 and X statically occurs in one of s t 1 ; : : :; s t n.

9 Occurs checking is not the only source of delayed problems in Qu-Prolog unication. As a simple example, consider the unication problem [X=y] Z = c, where c is a constant. The unication can succeed in one of two ways: Imitation: Z = c. Here the substitution has a null eect on Z. Projection: Z = y and X = c. Hence it is impossible to determine a unique most general unier. Rather than branch the unication problem, Qu-Prolog delays it until the binding of Z is known. Delayed problems are not restricted to unication. They may also arise during not f ree in checks. For example, the unication problem forall x A = forall y [x=z] Z gives the solution A = [x=] [=y] [x=z] Z provided : x not free in [=y] [x=z] Z Without knowing more information about Z, the not free in test must be delayed. Paterson [10] has shown that Qu-Prolog unication is semi-decidable, but not decidable. On the other hand, Qu-Prolog's ability to delay dicult unication sub-problems enables unication to be useful in practice. 4 An Example a Lambda Calculus Interpreter As a small illustration of the capabilities of Qu-Prolog, a Qu-Prolog implementation of a lambda calculus interpreter is presented. The naturalness of the Qu-Prolog approach is indicated by the fact that the interpreter code is virtually identical to the standard theoretical denition of lambda evaluation. Because the traditional notation (t u) for lambda application is not available in Qu-Prolog syntax, the list notation [t; u] is used. To be denite, we give rst a recogniser of lambda terms. This too is virtually identical to a standard theoretical recursive denition of lambda terms.?- op(525, quant, lambda). % define lambda as a quantifier?- object_var(x). % define x as an object variable name

10 lambda_term(x). lambda_term(lambda x T) :- lambda_term([t, U]) :- lambda_term(t), lambda_term(u). % each object variable is a lambda term lambda_term(t). Recall that we are using the phrase `object variable' loosely, to refer to object-var variables. An object-var variable is a type of meta level variable which is intended to range over object level variables. Hence the above clause lambda term(x), with x declared as a notation for an object-var variable, asserts that all object level variables are lambda terms. Leftmost-outermost lambda reduction is chosen for the interpreter. This is determined by the order in which the clauses of the reduction predicate are arranged.?- op(600, xfx, =>*). % reduction?- op(600, xfx, =>). % single reduction step A =>* B :- A => C, C =>* B. A =>* A. [lambda x T, U] => [U/x]*T. % reduction lambda x [A, x] => A :- x not_free_in A. % reduction lambda x T => lambda x U :- T => U. [T, U] => [V, U] :- T => V. [T, U] => [T, V] :- U => V. These Qu-Prolog clauses show a remarkable correspondence to the standard theoretical denition of lambda evaluation. Here are some examples of the operations of the interpreter. 1. [lambda y y, z] =>* Result. The query matches with the rst clause of =>/2. T binds to x and U binds to z. The substitution is formed and evaluated and the answer z is obtained. 2. lambda w [lambda y lambda z y, w] =>* lambda u lambda z u. After applying the second clause of =>/2 (i.e. reduction), the query is simplied to lambda y lambda z y =>* lambda u lambda z u. At this point, the second clause of the predicate =>*/2 applies since lambda y lambda z y and lambda u lambda z u are uniable.

11 5 Persistent Variables in Qu-Prolog 3.0 Prolog's orientation towards closed worlds and complete databases has to be reconciled with a need in many applications to accumulate additional knowledge. Qu-Prolog's persistent variables [12] provide a simple mechanism for achieving a reconciliation. Intuitively, in a program in which persistent variables appear, the scope of a persistent variable is the whole program and all queries that depend on it. The program may be thought of as a scheme of ordinary programs. More specic instances of the scheme may be selected by instantiating the persistent variables. To provide a logical semantics for persistent variables, we recall that the Clark semantics for Prolog [4] considers processing of a query Q(X) where X stands for all the query variables can be considered as a proof of the assertion P! Q(X), where P stands for the completed program and is a closed formula. This semantics may be extended to cover persistent variables as follows. The processing of a query Q(X; #Y ) where #Y stands for all the persistent variables which occur in the program and query can be considered as a proof of the assertion P (#Y )! Q(X; #Y ). Here P (#Y ) stands for the completed program, in much the same way as for the Clark semantics, but without binding of the persistent variables. Qu-Prolog's persistent meta variables and persistent object variables are distinguished from ordinary variables by having a # prex. Wherever a persistent variable with the same name is mentioned, the same persistent variable is being referred to. A data structure that is bound to a persistent variable can be accessed randomly by the name of the persistent variable. Consider the following program:?- op(600, xfx, likes). amy likes #X. #X likes bo. The program states that Amy likes someone who likes Bo. The query Y likes Y will return Y = amy and Y = bo as (alternative) results. As illustrated by this query, persistent variables behave identically to ordinary variables during unication. Beyond the basic logical semantics of persistent variables outlined above, some pragmatic (non-logical) predicates are provided in Qu-Prolog 3.0, primarily to manage the accumulation of knowledge within bindings of persistent variables. For example, bindings of persistent variables created during processing of a query are not carried forward by default to the next query. In order to maintain the bindings, the user must issue the commit command. All variables contained in the committed term will be promoted to persistent status. Successive calls on commit create a sequence of commit stages; the initial stage is 0. The current commit stage is returned by the command

12 commit_stage(n). When the current bindings of persistent variables are no longer needed, they can be discarded by giving the command back_to(m), where M is a non-negative integer; the bindings between M+1 and the current commit stage will be removed and the persistent variables bound during those stages will reset to unbound. The following is a Qu-Prolog session with the above program which demonstrates the use of the commit mechanism.?- commit_stage(n). N = 0; no (more) solutions?- #X = carol, commit, commit_stage(n). N = 1, #X = carol; no (more) solutions?- Y likes Z. Z = carol, Y = amy; Z = bo, Y = carol; no (more) solutions?- back_to(0). yes?- Y likes Z. Z = #X, Y = amy; Z = bo, Y = #X; no (more) solutions The predicates commit/0, commit_stage/1 and back_to/1 allow an orderly management of persistent bindings, independent of the depth rst backtracking mechanism in Qu-Prolog. Moat and Gray [7] proposed a persistent data store, which is similar to persistent variables in some respects. They interfaced Prolog to an external database into which the committed terms are stored. Committed terms are determined by a table where the user enters name:reference pairs and the terms are managed by normal dynamic database predicates (i.e. assert/1 and retract/1). Thus, the management of the respective schemes are different. The only similarity is the global naming. The approach of [7] lacks Qu-Prolog's commit facilities for managing persistent bindings. Davison's [3] survey of object orientation in logic programming reviews some proposals related to Qu-Prolog's persistent variables. In particular,

13 Newton and Watkins [9] proposed global variables for a logic programming based object oriented language. An implementation of the idea was done by McCabe [5]. Clauses in the language are grouped together into objects which can have parameters. When an object is called, the actual value of the parameter of the object will be known to all the clauses in this object, but not to other objects. For example, there may be two objects triangle and square, which have the parameter Side. When an object square(10) is called, all the clauses in square will have Side instantiated to 10, while the parameter in triangle is not aected. The persistent variables of Qu-Prolog 3.0 are not supported by such a modular structure, but on the other hand [9] lacks Qu-Prolog's commit mechanism for managing persistent instantiations. An integration of these two capabilities would seem desirable. 6 Conclusion Qu-Prolog's enhanced data objects are full quantied terms, which support natural and powerful knowledge representation and logic programming, as illustrated by the above implementation of a lambda calculus interpreter. Qu-Prolog's unication algorithm provides powerful pattern-matching appropriate to the extended vocabulary. Persistent variables allow incomplete databases and non-separable data which persists across queries. A compiler for Qu-Prolog 3.0 has been implemented in the SUN 3 environment, based on an appropriate extension [2] of the Warren Abstract Machine [15]. The extended abstract machine will be discussed separately. The language, including the extensions and features mentioned here, has been motivated particularly by the need to rapidly prototype interactive proof systems. Currently it is the implementation language for a substantial experimental proof system [14]. Acknowledgements Ross Paterson and Gerard Ellis have made substantial contributions to the design and implementation of Qu-Prolog 3.0. This research was supported by the Australian Research Council. References [1] K.A. Bowen and T. Weinberg. A Meta Level Extension of Prolog. Proc. of IEEE 2nd International Symposium on Logic Programming, Boston, July [2] A.S.K. Cheng and R.A. Paterson. The Qu-Prolog Abstract Machine. Technical Report No. 149, Key Centre for Software Technology, Department of Computer Science, University of Queensland, February 1990.

14 [3] A. Davison. Design Issues for Logic Programming Based Object Oriented Languages. Research Report, Department of Computing, Imperial College, London, England, Jan [4] J.W. Lloyd. Foundations of Logic Programming. Springer-Verlag, [5] F.G. McCabe. Logic and Objects. Research Report DOC 86/9, Department of Computing, Imperial College, London, England, May [6] D. Miller and G. Nadathur. A Logic Programming Approach to Manipulating Formulas and Programs. Proc. of IEEE 4th Symposium on Logic Programming, pp. 379{388, San Francisco, Sept [7] D.S. Moat and P.M.D. Gray. Interfacing Prolog to a Persistent Data Store. Proc. of 3rd International Conference on Logic Programming, pp. 577{584, London, July [8] L. Naish. Negation and Quantiers in NU-Prolog. Proc. of 3rd International Conference on Logic Programming, pp.624{634, London, July [9] M. Newton and J. Watkins. The Combination of Logic and Objects for Knowledge Representation. Journal of Object Oriented Programming, 1:7{10, Nov [10] R.A. Paterson. Unication of Schemes of Quantied Terms. Technical Report No. 154, Key Centre for Software Technology, Department of Computer Science, University of Queensland, Dec [11] R.A. Paterson and J. Staples. Unication and Constraint Solution for Meta-Programming: an Overview. Proc. of the Second Workshop on Meta-Programming in Logic, pp. 367{380, (ed. M. Bruynooghe), K.U. Leuven, [12] J. Staples, P.J. Robinson and G.R. Ellis. Persistent Variables in Qu- Prolog. Australian Computer Science Communications, pp. 362{369, 12, [13] J. Staples, P.J. Robinson, R.A. Paterson, R.A. Hagen, A.J. Craddock and P.C. Wallis. Qu-Prolog: an Extended Prolog for Meta Level Programming. Meta Programming in Logic Programming, pp , (eds. H. Abramson and M.H. Rogers), MIT Press, [14] T.G. Tang, P.J. Robinson and J. Staples. The Demonstration Proof Editor Demo2. Technical Report No. 175, Key Centre for Software Technology, Department of Computer Science, University of Queensland, Oct

15 [15] D.H.D. Warren. An Abstract Prolog Instruction Set. Technical Note 309, Articial Intelligence Center, Computer Science and Technology Division, SRI International, 1983.

Higher-Order Conditional Term Rewriting. In this paper, we extend the notions of rst-order conditional rewrite systems

Higher-Order Conditional Term Rewriting. In this paper, we extend the notions of rst-order conditional rewrite systems Higher-Order Conditional Term Rewriting in the L Logic Programming Language Preliminary Results Amy Felty AT&T Bell Laboratories 600 Mountain Avenue Murray Hill, NJ 07974 Abstract In this paper, we extend

More information

(Refer Slide Time: 4:00)

(Refer Slide Time: 4:00) Principles of Programming Languages Dr. S. Arun Kumar Department of Computer Science & Engineering Indian Institute of Technology, Delhi Lecture - 38 Meanings Let us look at abstracts namely functional

More information

The Metalanguage λprolog and Its Implementation

The Metalanguage λprolog and Its Implementation The Metalanguage λprolog and Its Implementation Gopalan Nadathur Computer Science Department University of Minnesota (currently visiting INRIA and LIX) 1 The Role of Metalanguages Many computational tasks

More information

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution Foundations of AI 9. Predicate Logic Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution Wolfram Burgard, Andreas Karwath, Bernhard Nebel, and Martin Riedmiller 09/1 Contents Motivation

More information

Higher-Order Logic. Specification and Verification with Higher-Order Logic

Higher-Order Logic. Specification and Verification with Higher-Order Logic Higher-Order Logic Specification and Verification with Higher-Order Logic Arnd Poetzsch-Heffter (Slides by Jens Brandt) Software Technology Group Fachbereich Informatik Technische Universität Kaiserslautern

More information

Part I Logic programming paradigm

Part I Logic programming paradigm Part I Logic programming paradigm 1 Logic programming and pure Prolog 1.1 Introduction 3 1.2 Syntax 4 1.3 The meaning of a program 7 1.4 Computing with equations 9 1.5 Prolog: the first steps 15 1.6 Two

More information

Operational Semantics

Operational Semantics 15-819K: Logic Programming Lecture 4 Operational Semantics Frank Pfenning September 7, 2006 In this lecture we begin in the quest to formally capture the operational semantics in order to prove properties

More information

Extracting the Range of cps from Affine Typing

Extracting the Range of cps from Affine Typing Extracting the Range of cps from Affine Typing Extended Abstract Josh Berdine, Peter W. O Hearn Queen Mary, University of London {berdine, ohearn}@dcs.qmul.ac.uk Hayo Thielecke The University of Birmingham

More information

1.3. Conditional expressions To express case distinctions like

1.3. Conditional expressions To express case distinctions like Introduction Much of the theory developed in the underlying course Logic II can be implemented in a proof assistant. In the present setting this is interesting, since we can then machine extract from a

More information

Implementação de Linguagens 2016/2017

Implementação de Linguagens 2016/2017 Implementação de Linguagens Ricardo Rocha DCC-FCUP, Universidade do Porto ricroc @ dcc.fc.up.pt Ricardo Rocha DCC-FCUP 1 Logic Programming Logic programming languages, together with functional programming

More information

Module 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur

Module 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur Module 6 Knowledge Representation and Logic (First Order Logic) 6.1 Instructional Objective Students should understand the advantages of first order logic as a knowledge representation language Students

More information

MMT Objects. Florian Rabe. Computer Science, Jacobs University, Bremen, Germany

MMT Objects. Florian Rabe. Computer Science, Jacobs University, Bremen, Germany MMT Objects Florian Rabe Computer Science, Jacobs University, Bremen, Germany Abstract Mmt is a mathematical knowledge representation language, whose object layer is strongly inspired by OpenMath. In fact,

More information

Meta-programming with Names and Necessity p.1

Meta-programming with Names and Necessity p.1 Meta-programming with Names and Necessity Aleksandar Nanevski Carnegie Mellon University ICFP, Pittsburgh, 05 October 2002 Meta-programming with Names and Necessity p.1 Meta-programming Manipulation of

More information

Programming Languages Third Edition

Programming Languages Third Edition Programming Languages Third Edition Chapter 12 Formal Semantics Objectives Become familiar with a sample small language for the purpose of semantic specification Understand operational semantics Understand

More information

the application rule M : x:a: B N : A M N : (x:a: B) N and the reduction rule (x: A: B) N! Bfx := Ng. Their algorithm is not fully satisfactory in the

the application rule M : x:a: B N : A M N : (x:a: B) N and the reduction rule (x: A: B) N! Bfx := Ng. Their algorithm is not fully satisfactory in the The Semi-Full Closure of Pure Type Systems? Gilles Barthe Institutionen for Datavetenskap, Chalmers Tekniska Hogskola, Goteborg, Sweden Departamento de Informatica, Universidade do Minho, Braga, Portugal

More information

Implementation of Axiomatic Language

Implementation of Axiomatic Language Implementation of Axiomatic Language Walter W. Wilson 1 1 Dept. of Computer Science & Engineering The University of Texas at Arlington Arlington, Texas 76019, USA wwwilson@acm.org Abstract This report

More information

CMPUT 325 : Lambda Calculus Basics. Lambda Calculus. Dr. B. Price and Dr. R. Greiner. 13th October 2004

CMPUT 325 : Lambda Calculus Basics. Lambda Calculus. Dr. B. Price and Dr. R. Greiner. 13th October 2004 CMPUT 325 : Lambda Calculus Basics Dr. B. Price and Dr. R. Greiner 13th October 2004 Dr. B. Price and Dr. R. Greiner CMPUT 325 : Lambda Calculus Basics 1 Lambda Calculus Lambda calculus serves as a formal

More information

A taxonomy of race. D. P. Helmbold, C. E. McDowell. September 28, University of California, Santa Cruz. Santa Cruz, CA

A taxonomy of race. D. P. Helmbold, C. E. McDowell. September 28, University of California, Santa Cruz. Santa Cruz, CA A taxonomy of race conditions. D. P. Helmbold, C. E. McDowell UCSC-CRL-94-34 September 28, 1994 Board of Studies in Computer and Information Sciences University of California, Santa Cruz Santa Cruz, CA

More information

X-KIF New Knowledge Modeling Language

X-KIF New Knowledge Modeling Language Proceedings of I-MEDIA 07 and I-SEMANTICS 07 Graz, Austria, September 5-7, 2007 X-KIF New Knowledge Modeling Language Michal Ševčenko (Czech Technical University in Prague sevcenko@vc.cvut.cz) Abstract:

More information

Safe Stratified Datalog With Integer Order Does not Have Syntax

Safe Stratified Datalog With Integer Order Does not Have Syntax Safe Stratified Datalog With Integer Order Does not Have Syntax Alexei P. Stolboushkin Department of Mathematics UCLA Los Angeles, CA 90024-1555 aps@math.ucla.edu Michael A. Taitslin Department of Computer

More information

has developed a specication of portions of the IEEE 854 oating-point standard in PVS [7]. In PVS, the injective function space injection can be dened

has developed a specication of portions of the IEEE 854 oating-point standard in PVS [7]. In PVS, the injective function space injection can be dened PVS: Combining Specication, Proof Checking, and Model Checking? To appear in CAV'96 S. Owre, S. Rajan, J. M. Rushby, N. Shankar, and M. Srivas Computer Science Laboratory, SRI International, Menlo Park

More information

CS 242. Fundamentals. Reading: See last slide

CS 242. Fundamentals. Reading: See last slide CS 242 Fundamentals Reading: See last slide Syntax and Semantics of Programs Syntax The symbols used to write a program Semantics The actions that occur when a program is executed Programming language

More information

Theorem proving. PVS theorem prover. Hoare style verification PVS. More on embeddings. What if. Abhik Roychoudhury CS 6214

Theorem proving. PVS theorem prover. Hoare style verification PVS. More on embeddings. What if. Abhik Roychoudhury CS 6214 Theorem proving PVS theorem prover Abhik Roychoudhury National University of Singapore Both specification and implementation can be formalized in a suitable logic. Proof rules for proving statements in

More information

Program Design in PVS. Eindhoven University of Technology. Abstract. Hoare triples (precondition, program, postcondition) have

Program Design in PVS. Eindhoven University of Technology. Abstract. Hoare triples (precondition, program, postcondition) have Program Design in PVS Jozef Hooman Dept. of Computing Science Eindhoven University of Technology P.O. Box 513, 5600 MB Eindhoven, The Netherlands e-mail: wsinjh@win.tue.nl Abstract. Hoare triples (precondition,

More information

On Meaning Preservation of a Calculus of Records

On Meaning Preservation of a Calculus of Records On Meaning Preservation of a Calculus of Records Emily Christiansen and Elena Machkasova Computer Science Discipline University of Minnesota, Morris Morris, MN 56267 chri1101, elenam@morris.umn.edu Abstract

More information

8. Relational Calculus (Part II)

8. Relational Calculus (Part II) 8. Relational Calculus (Part II) Relational Calculus, as defined in the previous chapter, provides the theoretical foundations for the design of practical data sub-languages (DSL). In this chapter, we

More information

SAT solver of Howe & King as a logic program

SAT solver of Howe & King as a logic program SAT solver of Howe & King as a logic program W lodzimierz Drabent June 6, 2011 Howe and King [HK11b, HK11a] presented a SAT solver which is an elegant and concise Prolog program of 22 lines. It is not

More information

HANDBOOK OF LOGIC IN ARTIFICIAL INTELLIGENCE AND LOGIC PROGRAMMING

HANDBOOK OF LOGIC IN ARTIFICIAL INTELLIGENCE AND LOGIC PROGRAMMING HANDBOOK OF LOGIC IN ARTIFICIAL INTELLIGENCE AND LOGIC PROGRAMMING Volume 5 Logic Programming Edited by DOV M. GABBAY and C. J. HOGGER Imperial College of Science, Technology and Medicine London and J.

More information

Thunks (continued) Olivier Danvy, John Hatcli. Department of Computing and Information Sciences. Kansas State University. Manhattan, Kansas 66506, USA

Thunks (continued) Olivier Danvy, John Hatcli. Department of Computing and Information Sciences. Kansas State University. Manhattan, Kansas 66506, USA Thunks (continued) Olivier Danvy, John Hatcli Department of Computing and Information Sciences Kansas State University Manhattan, Kansas 66506, USA e-mail: (danvy, hatcli)@cis.ksu.edu Abstract: Call-by-name

More information

Beluga: A Framework for Programming and Reasoning with Deductive Systems (System Description)

Beluga: A Framework for Programming and Reasoning with Deductive Systems (System Description) Beluga: A Framework for Programming and Reasoning with Deductive Systems (System Description) Brigitte Pientka and Joshua Dunfield McGill University, Montréal, Canada {bpientka,joshua}@cs.mcgill.ca Abstract.

More information

Tidying up the Mess around the Subsumption Theorem in Inductive Logic Programming Shan-Hwei Nienhuys-Cheng Ronald de Wolf bidewolf

Tidying up the Mess around the Subsumption Theorem in Inductive Logic Programming Shan-Hwei Nienhuys-Cheng Ronald de Wolf bidewolf Tidying up the Mess around the Subsumption Theorem in Inductive Logic Programming Shan-Hwei Nienhuys-Cheng cheng@cs.few.eur.nl Ronald de Wolf bidewolf@cs.few.eur.nl Department of Computer Science, H4-19

More information

Functional Languages. Hwansoo Han

Functional Languages. Hwansoo Han Functional Languages Hwansoo Han Historical Origins Imperative and functional models Alan Turing, Alonzo Church, Stephen Kleene, Emil Post, etc. ~1930s Different formalizations of the notion of an algorithm

More information

7. Relational Calculus (Part I) 7.1 Introduction

7. Relational Calculus (Part I) 7.1 Introduction 7. Relational Calculus (Part I) 7.1 Introduction We established earlier the fundamental role of relational algebra and calculus in relational databases (see 5.1). More specifically, relational calculus

More information

Logic as a framework for NL semantics. Outline. Syntax of FOL [1] Semantic Theory Type Theory

Logic as a framework for NL semantics. Outline. Syntax of FOL [1] Semantic Theory Type Theory Logic as a framework for NL semantics Semantic Theory Type Theory Manfred Pinkal Stefan Thater Summer 2007 Approximate NL meaning as truth conditions. Logic supports precise, consistent and controlled

More information

sketchy and presupposes knowledge of semantic trees. This makes that proof harder to understand than the proof we will give here, which only needs the

sketchy and presupposes knowledge of semantic trees. This makes that proof harder to understand than the proof we will give here, which only needs the The Subsumption Theorem in Inductive Logic Programming: Facts and Fallacies Shan-Hwei Nienhuys-Cheng Ronald de Wolf cheng@cs.few.eur.nl bidewolf@cs.few.eur.nl Department of Computer Science, H4-19 Erasmus

More information

Chapter 2 The Language PCF

Chapter 2 The Language PCF Chapter 2 The Language PCF We will illustrate the various styles of semantics of programming languages with an example: the language PCF Programming language for computable functions, also called Mini-ML.

More information

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine. 1. true / false By a compiler we mean a program that translates to code that will run natively on some machine. 2. true / false ML can be compiled. 3. true / false FORTRAN can reasonably be considered

More information

The Formal Semantics of Programming Languages An Introduction. Glynn Winskel. The MIT Press Cambridge, Massachusetts London, England

The Formal Semantics of Programming Languages An Introduction. Glynn Winskel. The MIT Press Cambridge, Massachusetts London, England The Formal Semantics of Programming Languages An Introduction Glynn Winskel The MIT Press Cambridge, Massachusetts London, England Series foreword Preface xiii xv 1 Basic set theory 1 1.1 Logical notation

More information

Polymorphic lambda calculus Princ. of Progr. Languages (and Extended ) The University of Birmingham. c Uday Reddy

Polymorphic lambda calculus Princ. of Progr. Languages (and Extended ) The University of Birmingham. c Uday Reddy 06-02552 Princ. of Progr. Languages (and Extended ) The University of Birmingham Spring Semester 2016-17 School of Computer Science c Uday Reddy2016-17 Handout 6: Polymorphic Type Systems 1. Polymorphic

More information

SOFTWARE VERIFICATION RESEARCH CENTRE DEPARTMENT OF COMPUTER SCIENCE THE UNIVERSITY OF QUEENSLAND. Queensland 4072 Australia TECHNICAL REPORT

SOFTWARE VERIFICATION RESEARCH CENTRE DEPARTMENT OF COMPUTER SCIENCE THE UNIVERSITY OF QUEENSLAND. Queensland 4072 Australia TECHNICAL REPORT SOFTWARE VERIFICATION RESEARCH CENTRE DEPARTMENT OF COMPUTER SCIENCE THE UNIVERSITY OF QUEENSLAND Queensland 4072 Australia TECHNICAL REPORT No. 93-4 The demonstration interactive theorem prover Demo3.3

More information

The underlying idea for the proposed proof procedure is to transform a formula into a Shannon graph and compile this graph into Horn clauses When run

The underlying idea for the proposed proof procedure is to transform a formula into a Shannon graph and compile this graph into Horn clauses When run Towards First-order Deduction Based on Shannon Graphs Joachim Posegga & Bertram Ludascher Universitat Karlsruhe Institut fur Logik, Komplexitat und Deduktionssysteme Am Fasanengarten 5, 75 Karlsruhe, Germany

More information

Logic Programming in the LF Logical Framework. Frank Pfenning. School of Computer Science. Carnegie Mellon University

Logic Programming in the LF Logical Framework. Frank Pfenning. School of Computer Science. Carnegie Mellon University Logic Programming in the LF Logical Framework Frank Pfenning School of Computer Science Carnegie Mellon University Pittsburgh, Pennsylvania 15213-3890 Internet: fp@cs.cmu.edu Revised draft for the Proceedings

More information

15-819M: Data, Code, Decisions

15-819M: Data, Code, Decisions 15-819M: Data, Code, Decisions 08: First-Order Logic André Platzer aplatzer@cs.cmu.edu Carnegie Mellon University, Pittsburgh, PA André Platzer (CMU) 15-819M/08: Data, Code, Decisions 1 / 40 Outline 1

More information

The Programming Language Core

The Programming Language Core The Programming Language Core Wolfgang Schreiner Research Institute for Symbolic Computation (RISC-Linz) Johannes Kepler University, A-4040 Linz, Austria Wolfgang.Schreiner@risc.uni-linz.ac.at http://www.risc.uni-linz.ac.at/people/schreine

More information

Three Applications of Strictness in the Efficient Implementaton of Higher-Order Terms

Three Applications of Strictness in the Efficient Implementaton of Higher-Order Terms Three Applications of Strictness in the Efficient Implementaton of Higher-Order Terms Frank Pfenning Workshop on Implementation of Logic Réunion Island, France November 11, 2000 Joint work with Carsten

More information

LOGIC AND DISCRETE MATHEMATICS

LOGIC AND DISCRETE MATHEMATICS LOGIC AND DISCRETE MATHEMATICS A Computer Science Perspective WINFRIED KARL GRASSMANN Department of Computer Science University of Saskatchewan JEAN-PAUL TREMBLAY Department of Computer Science University

More information

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter p. 1/27

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter p. 1/27 CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 2.1-2.7 p. 1/27 CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer

More information

OpenMath and SMT-LIB

OpenMath and SMT-LIB James, Matthew England, Roberto Sebastiani & Patrick Trentin 1 Universities of Bath/Coventry/Trento/Trento J.H.@bath.ac.uk 17 July 2017 1 Thanks to EU H2020-FETOPEN-2016-2017-CSA project SC 2 (712689)

More information

,, 1{48 () c Kluwer Academic Publishers, Boston. Manufactured in The Netherlands. Optimal Representations of Polymorphic Types with Subtyping * ALEXAN

,, 1{48 () c Kluwer Academic Publishers, Boston. Manufactured in The Netherlands. Optimal Representations of Polymorphic Types with Subtyping * ALEXAN ,, 1{48 () c Kluwer Academic Publishers, Boston. Manufactured in The Netherlands. Optimal Representations of Polymorphic Types with Subtyping * ALEXANDER AIKEN aiken@cs.berkeley.edu EECS Department, University

More information

Dept. of Comp. Eng. and Info. Sc.,Bilkent University, Bilkent,Ankara,Turkey

Dept. of Comp. Eng. and Info. Sc.,Bilkent University, Bilkent,Ankara,Turkey Variable Ages In A WAM Based System Ilyas Cicekli Dept. of Comp. Eng. and Info. Sc.,Bilkent University, 06533 Bilkent,Ankara,Turkey Abstract We present a new method to represent variable bindings in the

More information

Dynamic Logic David Harel, The Weizmann Institute Dexter Kozen, Cornell University Jerzy Tiuryn, University of Warsaw The MIT Press, Cambridge, Massac

Dynamic Logic David Harel, The Weizmann Institute Dexter Kozen, Cornell University Jerzy Tiuryn, University of Warsaw The MIT Press, Cambridge, Massac Dynamic Logic David Harel, The Weizmann Institute Dexter Kozen, Cornell University Jerzy Tiuryn, University of Warsaw The MIT Press, Cambridge, Massachusetts, 2000 Among the many approaches to formal reasoning

More information

LP attracted two kinds of enthousiasts engineers/programmers \Never had I experienced such ease in getting a complex program coded and running" D.H.D.

LP attracted two kinds of enthousiasts engineers/programmers \Never had I experienced such ease in getting a complex program coded and running D.H.D. Logic Programming Revisited Logic Programs as Inductive Denitions An engineers' view Maurice Bruynooghe Katholieke Universiteit Leuven, Belgium Partly based on work of Marc Denecker In the beginning (1974),

More information

Lambda Calculus and Type Inference

Lambda Calculus and Type Inference Lambda Calculus and Type Inference Björn Lisper Dept. of Computer Science and Engineering Mälardalen University bjorn.lisper@mdh.se http://www.idt.mdh.se/ blr/ October 13, 2004 Lambda Calculus and Type

More information

KeyNote: Trust Management for Public-Key. 180 Park Avenue. Florham Park, NJ USA.

KeyNote: Trust Management for Public-Key. 180 Park Avenue. Florham Park, NJ USA. KeyNote: Trust Management for Public-Key Infrastructures Matt Blaze 1 Joan Feigenbaum 1 Angelos D. Keromytis 2 1 AT&T Labs { Research 180 Park Avenue Florham Park, NJ 07932 USA fmab,jfg@research.att.com

More information

Let v be a vertex primed by v i (s). Then the number f(v) of neighbours of v which have

Let v be a vertex primed by v i (s). Then the number f(v) of neighbours of v which have Let v be a vertex primed by v i (s). Then the number f(v) of neighbours of v which have been red in the sequence up to and including v i (s) is deg(v)? s(v), and by the induction hypothesis this sequence

More information

An Implementation of the Language Lambda Prolog Organized around Higher-Order Pattern Unification

An Implementation of the Language Lambda Prolog Organized around Higher-Order Pattern Unification An Implementation of the Language Lambda Prolog Organized around Higher-Order Pattern Unification SUBMITTED TO THE FACULTY OF THE GRADUATE SCHOOL OF THE UNIVERSITY OF MINNESOTA BY Xiaochu Qi IN PARTIAL

More information

Chapter 3. Describing Syntax and Semantics

Chapter 3. Describing Syntax and Semantics Chapter 3 Describing Syntax and Semantics Chapter 3 Topics Introduction The General Problem of Describing Syntax Formal Methods of Describing Syntax Attribute Grammars Describing the Meanings of Programs:

More information

Logic Programming and Resolution Lecture notes for INF3170/4171

Logic Programming and Resolution Lecture notes for INF3170/4171 Logic Programming and Resolution Lecture notes for INF3170/4171 Leif Harald Karlsen Autumn 2015 1 Introduction This note will explain the connection between logic and computer programming using Horn Clauses

More information

Notes for Chapter 12 Logic Programming. The AI War Basic Concepts of Logic Programming Prolog Review questions

Notes for Chapter 12 Logic Programming. The AI War Basic Concepts of Logic Programming Prolog Review questions Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions The AI War How machines should learn: inductive or deductive? Deductive: Expert => rules =>

More information

A Small Interpreted Language

A Small Interpreted Language A Small Interpreted Language What would you need to build a small computing language based on mathematical principles? The language should be simple, Turing equivalent (i.e.: it can compute anything that

More information

CS112 Lecture: Primitive Types, Operators, Strings

CS112 Lecture: Primitive Types, Operators, Strings CS112 Lecture: Primitive Types, Operators, Strings Last revised 1/24/06 Objectives: 1. To explain the fundamental distinction between primitive types and reference types, and to introduce the Java primitive

More information

Hoare Logic. COMP2600 Formal Methods for Software Engineering. Rajeev Goré

Hoare Logic. COMP2600 Formal Methods for Software Engineering. Rajeev Goré Hoare Logic COMP2600 Formal Methods for Software Engineering Rajeev Goré Australian National University Semester 2, 2016 (Slides courtesy of Ranald Clouston) COMP 2600 Hoare Logic 1 Australian Capital

More information

Chapter 3. Semantics. Topics. Introduction. Introduction. Introduction. Introduction

Chapter 3. Semantics. Topics. Introduction. Introduction. Introduction. Introduction Topics Chapter 3 Semantics Introduction Static Semantics Attribute Grammars Dynamic Semantics Operational Semantics Axiomatic Semantics Denotational Semantics 2 Introduction Introduction Language implementors

More information

Cover Page. The handle holds various files of this Leiden University dissertation

Cover Page. The handle   holds various files of this Leiden University dissertation Cover Page The handle http://hdl.handle.net/1887/22891 holds various files of this Leiden University dissertation Author: Gouw, Stijn de Title: Combining monitoring with run-time assertion checking Issue

More information

Lecture Notes on Data Representation

Lecture Notes on Data Representation Lecture Notes on Data Representation 15-814: Types and Programming Languages Frank Pfenning Lecture 9 Tuesday, October 2, 2018 1 Introduction In this lecture we ll see our type system in action. In particular

More information

1 Scope, Bound and Free Occurrences, Closed Terms

1 Scope, Bound and Free Occurrences, Closed Terms CS 6110 S18 Lecture 2 The λ-calculus Last time we introduced the λ-calculus, a mathematical system for studying the interaction of functional abstraction and functional application. We discussed the syntax

More information

perform. If more storage is required, more can be added without having to modify the processor (provided that the extra memory is still addressable).

perform. If more storage is required, more can be added without having to modify the processor (provided that the extra memory is still addressable). How to Make Zuse's Z3 a Universal Computer Raul Rojas January 14, 1998 Abstract The computing machine Z3, built by Konrad Zuse between 1938 and 1941, could only execute xed sequences of oating-point arithmetical

More information

Algebraic Properties of CSP Model Operators? Y.C. Law and J.H.M. Lee. The Chinese University of Hong Kong.

Algebraic Properties of CSP Model Operators? Y.C. Law and J.H.M. Lee. The Chinese University of Hong Kong. Algebraic Properties of CSP Model Operators? Y.C. Law and J.H.M. Lee Department of Computer Science and Engineering The Chinese University of Hong Kong Shatin, N.T., Hong Kong SAR, China fyclaw,jleeg@cse.cuhk.edu.hk

More information

Contents. Chapter 1 SPECIFYING SYNTAX 1

Contents. Chapter 1 SPECIFYING SYNTAX 1 Contents Chapter 1 SPECIFYING SYNTAX 1 1.1 GRAMMARS AND BNF 2 Context-Free Grammars 4 Context-Sensitive Grammars 8 Exercises 8 1.2 THE PROGRAMMING LANGUAGE WREN 10 Ambiguity 12 Context Constraints in Wren

More information

CMSC 330: Organization of Programming Languages. Formal Semantics of a Prog. Lang. Specifying Syntax, Semantics

CMSC 330: Organization of Programming Languages. Formal Semantics of a Prog. Lang. Specifying Syntax, Semantics Recall Architecture of Compilers, Interpreters CMSC 330: Organization of Programming Languages Source Scanner Parser Static Analyzer Operational Semantics Intermediate Representation Front End Back End

More information

Propositional Logic. Part I

Propositional Logic. Part I Part I Propositional Logic 1 Classical Logic and the Material Conditional 1.1 Introduction 1.1.1 The first purpose of this chapter is to review classical propositional logic, including semantic tableaux.

More information

CS 321 Programming Languages and Compilers. Prolog

CS 321 Programming Languages and Compilers. Prolog CS 321 Programming Languages and Compilers Prolog Prolog PROgramming LOGic Algorithm = Logic + Control Logic programming deals with computing relations rather than functions. To understand Prolog one must

More information

Functional Logic Programming. Kristjan Vedel

Functional Logic Programming. Kristjan Vedel Functional Logic Programming Kristjan Vedel Imperative vs Declarative Algorithm = Logic + Control Imperative How? Explicit Control Sequences of commands for the computer to execute Declarative What? Implicit

More information

Going beyond propositional logic

Going beyond propositional logic Going beyond propositional logic Consider the following statements: p: Ling took CS245 q: Ling passed CS245 r: Ling failed CS245 Taken literally, these are all atomic statements, and formally they have

More information

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011 CS152: Programming Languages Lecture 11 STLC Extensions and Related Topics Dan Grossman Spring 2011 Review e ::= λx. e x e e c v ::= λx. e c τ ::= int τ τ Γ ::= Γ, x : τ (λx. e) v e[v/x] e 1 e 1 e 1 e

More information

Basic concepts. Chapter Toplevel loop

Basic concepts. Chapter Toplevel loop Chapter 3 Basic concepts We examine in this chapter some fundamental concepts which we will use and study in the following chapters. Some of them are specific to the interface with the Caml language (toplevel,

More information

An Intelligent Backtracking Schema. in A Logic Programming Environment. Ilyas Cicekli. Dept. of Comp. Eng. and Info. Sc., Bilkent University.

An Intelligent Backtracking Schema. in A Logic Programming Environment. Ilyas Cicekli. Dept. of Comp. Eng. and Info. Sc., Bilkent University. An Intelligent Backtracking Schema in A Logic Programming Environment Ilyas Cicekli Dept. of Comp. Eng. and Info. Sc., Bilkent University 06533 Bilkent, Ankara, Turkey, e-mail: ilyas@bilkent.edu.tr Abstract

More information

Formal Systems and their Applications

Formal Systems and their Applications Formal Systems and their Applications Dave Clarke (Dave.Clarke@cs.kuleuven.be) Acknowledgment: these slides are based in part on slides from Benjamin Pierce and Frank Piessens 1 Course Overview Introduction

More information

Axioms: Semantics Aspects of C++ Concepts

Axioms: Semantics Aspects of C++ Concepts Doc no: N2887=09-0077 Date: 2009-06-21 Project: ISO/IEC JTC1/SC22/WG21 Reply-To: Gabriel Dos Reis gdr@cs.tamu.edu Axioms: Semantics Aspects of C++ Concepts Gabriel Dos Reis Bjarne Stroustrup Alisdair Meredith

More information

Software Paradigms (Lesson 6) Logic Programming

Software Paradigms (Lesson 6) Logic Programming Software Paradigms (Lesson 6) Logic Programming Table of Contents 1 Introduction... 2 2 Facts... 3 3 Predicates (Structured Terms)... 4 3.1 General Structures... 4 3.2 Predicates (Syntax)... 4 3.3 Simple

More information

Reasoning About Loops Using Vampire

Reasoning About Loops Using Vampire EPiC Series in Computing Volume 38, 2016, Pages 52 62 Proceedings of the 1st and 2nd Vampire Workshops Reasoning About Loops Using Vampire Laura Kovács and Simon Robillard Chalmers University of Technology,

More information

Formal Predicate Calculus. Michael Meyling

Formal Predicate Calculus. Michael Meyling Formal Predicate Calculus Michael Meyling May 24, 2013 2 The source for this document can be found here: http://www.qedeq.org/0_04_07/doc/math/qedeq_formal_logic_v1.xml Copyright by the authors. All rights

More information

Incremental Flow Analysis. Andreas Krall and Thomas Berger. Institut fur Computersprachen. Technische Universitat Wien. Argentinierstrae 8

Incremental Flow Analysis. Andreas Krall and Thomas Berger. Institut fur Computersprachen. Technische Universitat Wien. Argentinierstrae 8 Incremental Flow Analysis Andreas Krall and Thomas Berger Institut fur Computersprachen Technische Universitat Wien Argentinierstrae 8 A-1040 Wien fandi,tbg@mips.complang.tuwien.ac.at Abstract Abstract

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Operational Semantics CMSC 330 Summer 2018 1 Formal Semantics of a Prog. Lang. Mathematical description of the meaning of programs written in that language

More information

Computer-supported Modeling and Reasoning. First-Order Logic. 1 More on Isabelle. 1.1 Isabelle System Architecture

Computer-supported Modeling and Reasoning. First-Order Logic. 1 More on Isabelle. 1.1 Isabelle System Architecture Dipl-Inf Achim D Brucker Dr Burkhart Wolff Computer-supported Modeling and easoning http://wwwinfsecethzch/ education/permanent/csmr/ (rev 16814) Submission date: First-Order Logic In this lecture you

More information

Typed Lambda Calculus for Syntacticians

Typed Lambda Calculus for Syntacticians Department of Linguistics Ohio State University January 12, 2012 The Two Sides of Typed Lambda Calculus A typed lambda calculus (TLC) can be viewed in two complementary ways: model-theoretically, as a

More information

Infinite Derivations as Failures

Infinite Derivations as Failures Infinite Derivations as Failures Andrea Corradi and Federico Frassetto DIBRIS, Università di Genova, Italy name.surname@dibris.unige.it Abstract. When operating on cyclic data, programmers have to take

More information

when a process of the form if be then p else q is executed and also when an output action is performed. 1. Unnecessary substitution: Let p = c!25 c?x:

when a process of the form if be then p else q is executed and also when an output action is performed. 1. Unnecessary substitution: Let p = c!25 c?x: URL: http://www.elsevier.nl/locate/entcs/volume27.html 7 pages Towards Veried Lazy Implementation of Concurrent Value-Passing Languages (Abstract) Anna Ingolfsdottir (annai@cs.auc.dk) BRICS, Dept. of Computer

More information

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic 3.4 Deduction and Evaluation: Tools 3.4.1 Conditional-Equational Logic The general definition of a formal specification from above was based on the existence of a precisely defined semantics for the syntax

More information

QUTE: A PROLOG/LISP TYPE LANGUAGE FOR LOGIC PROGRAMMING

QUTE: A PROLOG/LISP TYPE LANGUAGE FOR LOGIC PROGRAMMING QUTE: A PROLOG/LISP TYPE LANGUAGE FOR LOGIC PROGRAMMING Masahiko Sato Takafumi Sakurai Department of Information Science, Faculty of Science University of Tokyo 7-3-1 Hongo, Bunkyo-ku, Tokyo 113, JAPAN

More information

once. A at term is a variable or a term of the form f(x 1 ; : : : ; x n ), where n 0 and the x i are distinct variables. Atoms are denoted by h, queri

once. A at term is a variable or a term of the form f(x 1 ; : : : ; x n ), where n 0 and the x i are distinct variables. Atoms are denoted by h, queri Preventing Instantiation Errors and Loops for Logic Programs with Several Modes Using block Declarations Jan{Georg Smaus y Pat Hill Andy King Extended abstract 1 Introduction Delay declarations are provided

More information

Proving the Correctness of Distributed Algorithms using TLA

Proving the Correctness of Distributed Algorithms using TLA Proving the Correctness of Distributed Algorithms using TLA Khushboo Kanjani, khush@cs.tamu.edu, Texas A & M University 11 May 2007 Abstract This work is a summary of the Temporal Logic of Actions(TLA)

More information

EXTENDING LOGIC PROGRAMMING WITH COINDUCTION APPROVED BY SUPERVISORY COMMITTEE: Gopal Gupta, Chair. Dung T. Huynh. R. Chandrasekaran.

EXTENDING LOGIC PROGRAMMING WITH COINDUCTION APPROVED BY SUPERVISORY COMMITTEE: Gopal Gupta, Chair. Dung T. Huynh. R. Chandrasekaran. EXTENDING LOGIC PROGRAMMING WITH COINDUCTION APPROVED BY SUPERVISORY COMMITTEE: Gopal Gupta, Chair Dung T. Huynh R. Chandrasekaran Neeraj Mittal Copyright 2006 Luke Evans Simon All Rights Reserved To my

More information

Bliksem 1.10 User Manual

Bliksem 1.10 User Manual Bliksem 1.10 User Manual H. de Nivelle January 2, 2003 Abstract Bliksem is a theorem prover that uses resolution with paramodulation. It is written in portable C. The purpose of Bliksem was to develope

More information

CS4215 Programming Language Implementation. Martin Henz

CS4215 Programming Language Implementation. Martin Henz CS4215 Programming Language Implementation Martin Henz Thursday 26 January, 2012 2 Chapter 4 The Language simpl In this chapter, we are exting the language epl in order to provide a more powerful programming

More information

Outcome-Oriented Programming (5/12/2004)

Outcome-Oriented Programming (5/12/2004) 1 Outcome-Oriented Programming (5/12/2004) Daniel P. Friedman, William E. Byrd, David W. Mack Computer Science Department, Indiana University Bloomington, IN 47405, USA Oleg Kiselyov Fleet Numerical Meteorology

More information

Last class. CS Principles of Programming Languages. Introduction. Outline

Last class. CS Principles of Programming Languages. Introduction. Outline Last class CS6848 - Principles of Programming Languages Principles of Programming Languages V. Krishna Nandivada IIT Madras Interpreters A Environment B Cells C Closures D Recursive environments E Interpreting

More information

perspective, logic programs do have a notion of control ow, and the in terms of the central control ow the program embodies.

perspective, logic programs do have a notion of control ow, and the in terms of the central control ow the program embodies. Projections of Logic Programs Using Symbol Mappings Ashish Jain Department of Computer Engineering and Science Case Western Reserve University Cleveland, OH 44106 USA email: jain@ces.cwru.edu Abstract

More information

CS 6110 S14 Lecture 1 Introduction 24 January 2014

CS 6110 S14 Lecture 1 Introduction 24 January 2014 CS 6110 S14 Lecture 1 Introduction 24 January 2014 1 Introduction What is a program? Is it just something that tells the computer what to do? Yes, but there is much more to it than that. The basic expressions

More information

CIS24 Project #3. Student Name: Chun Chung Cheung Course Section: SA Date: 4/28/2003 Professor: Kopec. Subject: Functional Programming Language (ML)

CIS24 Project #3. Student Name: Chun Chung Cheung Course Section: SA Date: 4/28/2003 Professor: Kopec. Subject: Functional Programming Language (ML) CIS24 Project #3 Student Name: Chun Chung Cheung Course Section: SA Date: 4/28/2003 Professor: Kopec Subject: Functional Programming Language (ML) 1 Introduction ML Programming Language Functional programming

More information