Embedding Prolog in Haskell
نویسندگان
چکیده
The distinctive merit of the declarative reading of logic programs is the validity of all the laws of reasoning supplied by the predicate calculus with equality Surprisingly many of these laws are still valid for the procedural reading they can therefore be used safely for algebraic manipulation program transformation and optimisation of executable logic programs This paper lists a number of common laws and proves their validity for the standard depth rst search procedural reading of Prolog They also hold for alternative search strategies e g breadth rst search Our proofs of the laws are based on the standard algebra of functional program ming after the strategies have been given a rather simple implementation in Haskell
منابع مشابه
Functional Reading of Logic Programs
We propose an embedding of logic programming into lazy functional programming in which each predicate in a Prolog program becomes a Haskell function, in such a way that both the declarative and the procedural reading of the Prolog predicate are preserved. The embedding computes by means of operations on lazy lists. The state of each step in computation is passed on as a stream of answer substit...
متن کاملTyped Logical Variables in Haskell
We describe how to embed a simple typed functional logic programming language in Haskell. The embedding is a natural extension of the Prolog embedding by Seres and Spivey [16]. To get full static typing we need to use the Haskell extensions of quantified types and the ST-monad.
متن کاملWhy It's Nice to be Quoted: Quasiquoting for Prolog
Prolog’s support for dynamic programming, meta programming and text processing using context free grammars make the language highly suitable for defining domain specific languages (DSL) as well as analysing, refactoring or generating expression states in other (programming) languages. Well known DSLs are the DCG (Definite Clause Grammar) notation and constraint languages such as CHR. These exte...
متن کاملEquational Reasoning for Prolog
Equational Reasoning is a feature of Functional Programming much envied by Logic Programmers. We argue that logic programmers should not shy away from adopting equational reasoning because of perceived pitfalls, but rather embrace it to indulge in its many benefits. We propose and illustrate two approaches: a cumbersome indirection via Haskell and a more insightful approach directly in Prolog.
متن کاملFunctional Counterparts of some Logic Programming Techniques
Drawing on experience of translating a Prolog program into Haskell, a range of correspondences between logic and functional programs are discussed. Despite the diierences of underlying paradigms, in many cases we can nd close counterparts between the two programming schemes.
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 1999