HiLog is a programming
logic
Logic is the study of correct reasoning. It includes both formal and informal logic. Formal logic is the science of deductively valid inferences or of logical truths. It is a formal science investigating how conclusions follow from premises ...
with higher-order syntax, which allows arbitrary terms to appear in predicate and function positions.
However, the
model theory
In mathematical logic, model theory is the study of the relationship between formal theories (a collection of sentences in a formal language expressing statements about a mathematical structure), and their models (those structures in which the s ...
of HiLog is first-order. Although syntactically HiLog strictly extends
first order logic
First-order logic—also known as predicate logic, quantificational logic, and first-order predicate calculus—is a collection of formal systems used in mathematics, philosophy, linguistics, and computer science. First-order logic uses quantifie ...
, HiLog can be embedded into this logic.
HiLog was first described in 1989. It was later extended in the direction of
many-sorted logic
Many-sorted logic can reflect formally our intention not to handle the universe as a homogeneous collection of objects, but to partition it in a way that is similar to types in typeful programming. Both functional and assertive "parts of speech" i ...
.
The
XSB
XSB is the name of a dialect of the Prolog programming language and its implementation developed at Stony Brook University in collaboration with the Katholieke Universiteit Leuven, the New University of Lisbon, Uppsala University and software ve ...
system parses HiLog syntax, but the integration of HiLog into XSB is only partial. In particular, HiLog is not integrated with the XSB module system. A full implementation of HiLog is available in the
Flora-2 Flora-2 is an open source semantic rule-based system for knowledge representation and reasoning.
The language of the system is derived from F-logic, HiLog,
W. Chen, M. Kifer and D.S. Warren (1993)''HiLog: A Foundation for Higher-Order Logic Programm ...
system.
It has been shown that HiLog can be embedded into
first-order logic
First-order logic—also known as predicate logic, quantificational logic, and first-order predicate calculus—is a collection of formal systems used in mathematics, philosophy, linguistics, and computer science. First-order logic uses quantifie ...
through a fairly simple transformation.
For instance,
p(X)(Y,Z(V)(W))
gets embedded as the following first-order term:
apply(p(X),Y,apply(apply(Z,V),W))
.
The
Framework for Logic-Based Dialects (RIF-FLD) of the
Rule Interchange Format
The Rule Interchange Format (RIF) is a W3C Recommendation. RIF is part of the infrastructure for the semantic web, along with (principally) SPARQL, RDF and OWL. Although originally envisioned by many as a "rules layer" for the semantic web, in ...
(RIF) is largely based on the ideas underlying HiLog and
F-logic F-logic (frame logic) is a knowledge representation and ontology language. F-logic combines the advantages of conceptual modeling with object-oriented, frame-based languages and offers a declarative, compact and simple syntax, as well as the well-de ...
.
Examples
In all the examples below, capitalized symbols denote variables and the comma denotes
logical conjunction
In logic, mathematics and linguistics, And (\wedge) is the truth-functional operator of logical conjunction; the ''and'' of a set of operands is true if and only if ''all'' of its operands are true. The logical connective that represents this ...
, as in most
logic programming
Logic programming is a programming paradigm which is largely based on formal logic. Any program written in a logic programming language is a set of sentences in logical form, expressing facts and rules about some problem domain. Major logic prog ...
languages. The first and the second examples show that variables can appear in predicate positions. Predicates can even be complex terms, such as
closure(P)
or
maplist(F)
below. The third example shows that variables can also appear in place of atomic formulas, while the fourth example illustrates the use of variables in place of function symbols. The first example defines a generic
transitive closure
In mathematics, the transitive closure of a binary relation on a set is the smallest relation on that contains and is transitive. For finite sets, "smallest" can be taken in its usual sense, of having the fewest related pairs; for infinite s ...
operator, which can be applied to an arbitrary binary predicate. The second example is similar. It defines a
LISP
A lisp is a speech impairment in which a person misarticulates sibilants (, , , , , , , ). These misarticulations often result in unclear speech.
Types
* A frontal lisp occurs when the tongue is placed anterior to the target. Interdental lisping ...
-like mapping operator, which applies to an arbitrary binary predicate. The third example shows that the
Prolog
Prolog is a logic programming language associated with artificial intelligence and computational linguistics.
Prolog has its roots in first-order logic, a formal logic, and unlike many other programming languages, Prolog is intended primarily ...
meta-predicate
call/1
can be expressed in HiLog in a natural way and without the use of extra-logical features. The last example defines a predicate that traverses arbitrary binary trees represented as
first-order terms.
closure(P)(X,Y) <- P(X,Y).
closure(P)(X,Y) <- P(X,Z), closure(P)(Z,Y).
maplist(F)([],[]).
maplist(F)([X, R],[Y, Z]) <- F(X,Y), maplist(F)(R,Z).
call(X) <- X.
traverse(X(L,R)) <- traverse(L), traverse(R).
References
Further reading
*
* {{cite journal , last1=Bruijn , first1=Jos , last2=Heymans , first2=Stijn , date=January 2008 , title=On the relationship between description logic-based and F-logic-based ontologies , journal=
Fundamenta Informaticae
''Fundamenta Informaticae'' is a peer-reviewed scientific journal covering computer science. The editor-in-chief is Damian Niwiński. It was established in 1977 by the Polish Mathematical Society as Series IV of the '' Annales Societatis Mathemati ...
, volume=82 , issue=3 , pages=213–236 , url=https://content.iospress.com/articles/fundamenta-informaticae/fi82-3-02
Logic programming languages
Declarative programming languages
Knowledge representation