You can edit almost every page by Creating an account. Otherwise, see the FAQ.

# Epilog (programming language)

Script error: No such module "Draft topics". Script error: No such module "AfC topic".

Epilog[1] (also known as Dynamic Prolog) is a knowledge representation language based on Dynamic Logic Programming. Epilog is similar to Functional Programming languages (like Lisp) and Logic Programming languages (like Datalog and Prolog) in that it allows its users to define functions and relations. However, it differs from such languages in that it also allows users to define operations (as transformations on datasets). The upshot is a declarative approach to formalizing knowledge about dynamic worlds that is conceptually simple yet computationally practical. In its ability to represent dynamic information, Epilog is closely related to Transaction Logic and Logic Production Systems (LPS)[2][3].

## Dynamic Logic Programming

Datasets. The theory of Dynamic Logic Programming (DLP) begins with the concept of a dataset. A dataset is a collection of facts about some aspect of the world expressed in the form of ground atomic sentences (i.e. simple sentences with no variables).

For example, one can represent a state of the Blocks World with a dataset like the one shown below. Block a is on block b; block b is on block c; and block d is on block e. Blocks a and d are clear. Blocks c and e are resting on the table.

on(a,b)
on(b,c)
on(d,e)
clear(a)
clear(d)
table(c)
table(e)

Datasets can be used by themselves to encode information. They can also be used in combination with logic programs to form more complex information systems (similar to deductive databases, except with function symbols).

Relations. In Epilog, new relations are defined as views of datasets by writing rules in a syntax similar to that of Prolog. For example, the following rules define the above relation in terms of the on relation. A block X is above a block Z if X is on Z or if X is on Y and Y is above Z.

above(X,Z) :- on(X,Z)
above(X,Z) :- on(X,Y) & above(Y,Z)

Functions. Epilog also provides its users with the ability to define evaluable functions. For example, the following rule defines the volume of a block to be the product of its width and its height and its depth.

volume(B) := times(width(B),height(B),depth(B))

Operations. Operations are defined as transformations on datasets. For example, the stack operation can be defined as shown below. If one stacks a block X on Y and if both X and Y are clear of other blocks and X in on the table, then afterward block X is on block Y, X is no longer on the table, and Y is no longer clear.

stack(X,Y) ::
clear(X) & clear(Y) & table(Y)
==> on(X,Y) & ~table(X) & ~clear(Y)

In Epilog, all of the results of an operation are computed before any changes are made. This differs from most production systems and various implementations of assert and retract in Prolog (where changes are computed and executed one at a time).

A formal specification of the syntax and semantics of Epilog can be found in[4] and[5]. The semantics is strictly declarative, i.e. it is defined without reference to a particular interpreter for that language. That said,[5] also provides details of practical interpreter for the language.

## Implementation

EpilogJS[6] is a collection of Javascript subroutines and variables developed to support processing of Epilog datasets and rulesets. It includes an interpreter, an optimizer, and a rudimentary compiler.

Sierra[7] is a browser-based interactive development environment (IDE) for Epilog. It allows users to view and edit datasets, relation definitions, function definitions, and operation definitions. It provides a variety of tools for manually querying and modifying datasets, and it automatically updates visual displays of datasets in spreadsheet-like fashion in accordance with the user's rules. It also provides tools for analyzing datasets and rule sets, tools for tracing program execution, and tools for saving and loading files.

## Applications

Epilog has been used as the basis for research in a number of areas related to logic programming, viz. unification theory[8], the representation of aggregates[9], data integration[10][11], database reformulation[12], paraconsistent reasoning[13], logic program completion[14], and Communication Theory[15].

Epilog has also been used in development projects in various application areas, e.g. Enterprise Management, Financial Services[16], Software Configuration Management[17], Security Policies[18], System Management[19], Computational Law[20][21], Computable Contracts[22][23][24], and General Game Playing[25].

Epilog is used as a language for teaching Logic Programming. It is the basis for a textbook on Logic Programming[5] and a corresponding website[26]. It is also used in teaching Computational Law[27][28]

## History

Epilog began life at Stanford University in the late 1970s as a language called MRS (for metalevel representation system). The key feature of the language was its support for representing metaknowledge without modal operators (an idea inspired by John McCarthy's work on circumscription). The first interpreter was implemented in Lisp.

In the late 1980s, the AI research community (as part of the DARPA Knowledge Sharing initiative) began investigating the possibility of a standard language for the interchange of knowledge between computer systems. This led to two variants - Description Logic and Knowledge Interchange Format (better known as KIF). MRS was adopted as an initial version of KIF because of its support for the representation of metalevel information. KIF eventually went on to become a draft ANSI standard and formed the basis for another language, called Common Logic.

While KIF was useful as an interchange format for knowledge, many users found it less than ideal as an authoring language for knowledge systems. In response to this need, in the late 1990s, the Logic group at Stanford created a simplified variant. This version was similar to pure Prolog except with purely declarative semantics rather than semantics based on SLD-resolution. The new language was called Epilog in acknowledgement to its similarity to Prolog.

In the mid 2000s, Epilog began to be used to represent knowledge about dynamics in enterprise management, computational law, computable contracts, and general game playing. In order to support these applications, Epilog was expanded to include operation definitions as well as view definitions and function definitions.

As part of the transition from MRS to Epilog, the Logic Group at Stanford developed an interpreter for Epilog, called EpilogJS, and a compatible interactive development environment, called Sierra, along with various analysis and optimization tools. This time the software was written in JavaScript to facilitate the use of Epilog in web browsers.

## References

1. http://epilog.stanford.edu
2. Kowalski, R. A. et al.: Combining Logic Programming and Imperative Programming in LPS, in Warren, D., Dahl, V., Eiter, T., Her- menegildo, M., Kowalski, R. and Rossi, F. (eds.) Prolog - The Next 50 Years. LNCS, vol. 13900. Springer (2023). https://www.doc.ic.ac.uk/~rak/papers/Combining%20LP%20and%20IP%20in%20LPS.pdf
3. Kowalski, R. A. et al.: Logic Production Systems. http://lps.doc.ic.ac.uk
4. Genesereth, M.: Dynamic Logic Programming. In: Warren, D., Dahl, V., Eiter, T., Hermenegildo, M., Kowalski, R. and Rossi, F. (eds.) Prolog - The Next 50 Years. LNCS, vol. 13900. Springer (2023).
5. Genesereth, Michael; Chaudhri, Vinay K.: Introduction to logic programming, (2020). https://www.morganclaypool.com/doi/10.2200/S00966ED1V01Y201911AIM044
6. "EpilogJS User Guide".
7. T. Kutsia: Pattern Unification with Sequence Variables and Flexible Arity Symbols, Electronic Notes in Theoretical Computer Science Volume 66, Issue 5, December 2002, Pages 52-69. https://www.sciencedirect.com/science/article/pii/S1571066104805140
9. Dimopoulos, Y. and Kakas, A.: Information Integration and Computational Logic, https://arxiv.org/pdf/cs/0106025.pdf
10. Adham mohsin saeed: Data Integration in Multi-sources Information Systems, ISSN (e): 2250 – 3005 || Vol, 05 || Issue, 01 || January – 2015 || International Journal of Computational Engineering Research (IJCER). http://www.ijceronline.com/papers/Vol5_issue1/I051063069.pdf
11. M. Genesereth and A. Mohapatra, "Practical Reformulation of Deductive Databases," 2019 IEEE Second International Conference on Artificial Intelligence and Knowledge Engineering (AIKE), 2019, pp. 65-72. https://doi.org/10.1109/AIKE.2019.00020
12. Kassoff, M., Genesereth, M.: Paraconsistent inference from data using existential Ω-entailment, International Journal of Semantic Computing, Vol. 05, No. 03, pp. 257-269 (2011) Special Issue: Managing and Reasoning in the Presence of Inconsistency. https://doi.org/10.1142/S1793351X11001249
13. Hinrichs, T., Genesereth, M.: "Injecting the How into the What: Investigating a Finite Classical Logic", Proceedings of the 11th International Conference on Principles of Knowledge Representation and Reasoning, 2008. https://www.aaai.org/Papers/KR/2008/KR08-010.pdf
14. W. Davies, P. Edwards: The Communication of Inductive Inferences. Department of Computing Science, Kings College, University of Aberdeen. https://aura.abdn.ac.uk/bitstream/handle/2164/10945/davies_DAIMML_97.pdf;jsessionid=1F6E0878AC7FA023BDC284EDC932A211?sequence=1
15. Chaudhri, V.: Computable Contracts in the Financial Services Industry. https://arxiv.org/pdf/2208.04685.pdf
16. T. Hinrichs et al.: Using Object-Oriented Management for Automated Configuration Generation, in Utility Computing: 15th IFIP/IEEE International Workshop on Distributed Computing, 2004. https://books.google.com/books?id=n9XzBwAAQBAJ&pg=PA
17. Hinrichs, T.: System and a method for automatically detecting security vulnerabilities in client-server applications. https://patents.google.com/patent/US9118713
18. Sow Kum Wong: An adaptive agent architecture for the design of complex decision support system with applications to power system protection, Victoria University, 1996. https://vuir.vu.edu.au/15346/3/WONG%20Sow%20Kum-thesis_nosignature.pdf
19. Genesereth, M.: "What is Computational Law?", Complaw Corner, Codex: The Stanford Center for Legal Informatics, 2021. https://law.stanford.edu/2021/03/10/what-is-computational-law/
20. Megan Ma. L’histoire du codex(t) juridique : écrire le droit en code. Droit. Institut d’études politiques de paris - Sciences Po, 2021. https://theses.hal.science/tel-03618704v1/document
21. Genesereth, M.: Contract Definition Language, Computable Contracts Session of the 2021 FutureLaw Conference. https://laptrinhx.com/news/contract-definition-language-4BM8r3n/
22. Doulcet, P-L.: Standardization of Insurance Product Representation. https://law.stanford.edu/2021/11/09/standardization-of-insurance-product-representation/
23. Claudia Morelli: Computable contracts. Altalex, 2021. https://www.altalex.com/documents/news/2021/04/19/computable-contracts
24. Genesereth, M., Love, N., & Pell, B. (2005). General Game Playing: Overview of the AAAI Competition. AI Magazine, 26(2), 62. https://doi.org/10.1609/aimag.v26i2.1813
25. http://logicprogramming.stanford.edu
26. Barczentewicz, M.: Teaching Technology to (Future) Lawyers. https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3957137
27. http://complaw.stanford.edu

This article "Epilog (programming language)" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Epilog (programming language). Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.