1. Introduction
Epochal changes and new possibilities in the interaction between humans and artificial systems capable of processing information have been brought about by the recent advances in Natural Language Processing (NLP), which are based on Machine Learning and Artificial Neural Networks [
1,
2,
3,
4]. Large Language Models (LLMs) [
5,
6], in particular, represent the start of a new line of development that will have enormous implications for the entire field of artificial intelligence and numerous applications involving our societies globally. LLMs are the foundation of recent systems that are widely available to the public.
The kind of “understanding” that these systems are capable of achieving in conversation with humans is among their most contentious features. There are a wide range of opinions in the current debate between the extremes that they (i) converse without really understanding the other person and (ii) converse while gaining knowledge that could eventually approach that of humans and animals. In any event, these systems do display intelligent characteristics, making consideration of broad approaches to natural language text interpretation a critical theme for the development of LLM systems in the future.
Semantics is a very old topic; Leibniz is credited with the earliest modern mathematical formulation of it in his
Characteristica Universalis [
7].
After millennia of development, the logical representation of natural language texts is today a well developed field with a vast body of books and articles. Specifically, in the 1970s, Richard Montague, a student of Alfred Tarski (who founded both set-theoretic model theory and logical semantics [
8]), developed a valuable theory proving that higher-order predicate logic generates coherent and comprehensive representations of texts [
9,
10,
11]. Richard Montague’s famous article “English as a Formal Language” was followed by similar works. Montague’s theory s formally complex, using
intensional logic and Alonzo Church’s lambda abstraction [
12].
In short, from Montague’s point of view every linguistic element has a semantic that is provided by a high-order function that is represented in an appropriate space by a lambda term. Our formalism, as we will demonstrate, enables us to formalize sentences in natural languages by decomposing them into their component parts—all predicates associated with words—and joining these parts with constants and logical operations (connected concepts are provided in [
13]). A logical operator of “predicate abstraction”, which is present neither in Montague’s work nor in analogous subsequent logical approaches [
14,
15], provides an advancement of Montague’s grammars in terms of simplification of the logical apparatus and adherence to the linguistic structures. Moreover, monadic high-order predicates allow us to eliminate variables.
Apart from Montague’s approach, formalisms of logical representation constitute a large field of investigation in artificial intelligence [
16,
17]. However, the spirit and the finalities of these systems are very different from those of the present work. In fact, they are essentially oriented towards knowledge representation (KR), very often focusing on specific knowledge domains (e.g., programming, datasets, query languages, semantic webs, belief revision, medicine). In these contexts, natural language is considered an instrument on which representations are based rather than an object of investigation in itself. Moreover, they use variables, first-order or second-order logic, and modal or temporal operators, and the rules of composition are very complex, making KR languages comparable to programming languages. In certain cases they differ radically from classical predicate logic, and can follow very different principles and presuppositions [
17].
Although the basis of our formalism is logically sophisticated (high-order predicate logic, logical types, lambda abstraction), we can explain the method in a very intuitive way because monadic predicates naturally resemble the conceptual organization of words and completely avoid variables. The ability to produce correct logical representations lies essentially in the choice of the involved constants, the right aggregation of parts by means of parentheses, and the right logical types of the constituents, which is managed using the operator of predicate abstraction. The simplicity of the formalism is proven by the conversation with ChatGPT 3.5 reported in the final section, where, after one page of conversation, the chatbot is able to show a basic familiarity with the presented formalism.
The main ingredients of our logical representations are words, constants, parentheses, and predicate abstraction. This means that semantics reduces to a relational system of words from which morphology and syntax are removed and the logical essence of the relationship between words is extracted. The relevance of this for LLM models could be considerable, and surely needs further analyses and experiments that can be developed using the most recent chatbots. In addition, as addressed in our conclusions, this fact raises a number of problems around the proprietary nature of these systems, as training strategies and finalities are under the control of the companies producing and maintaining them.
2. Materials and Methods
In this section, we first define the main aspects of logical semantics, then outline predicate high-order logic by providing the first examples of the logical representation of sentences.
2.1. Logical Semantics
Let us begin by observing the intrinsic principle of duality in semantics. Meanings denote both objects and relations between them; therefore, when associating meanings with symbolic expressions of a certain type, it is necessary to presuppose both objects and relations.
What is essential is the
application of a predicate to complementary entities of the application, called
arguments. The
proposition obtained as result of this application expresses the occurrence of relationships between the two types of entities. We can write
to express the validity of a relation associated with
P on the
arguments (in the order they appear).
P is called a
predicate, and denotes a relation; thus,
is called a
predication or
atomic proposition. The
individual constants designate the arguments of the predicate
P.
However, because a predicate can be an argument for a predicate of a higher type, predicates are arranged along a hierarchy of levels, or
logical types; according to Russell’s theory of logical types, this situation can occur indefinitely [
18,
19].
In addition, it is possible to conceive of relations that are simultaneously both objects and relations. However, as these possibilities often lead to logical inconsistencies, they should only be considered in specific and well-controlled contexts with appropriate precautions. We exclude them from the following discussion, assuming individuals at level zero and predicates of levels 1, 2, 3, …(the semantics of natural languages rarely require predicates of order higher than 3).
The
negation of
,
indicates the opposite of
i.e., its non-validity. The
disjunction is a proposition,
indicating that at least one of the two propositions connected by ∨ is true, while the
conjunction
indicates that both propositions connected by ∧ are true. The arrow → denotes
implication; thus, the proposition
read as “if P(a, b), then P(b, a)” is equivalent to
and finally
is the logical
equivalence equal to
.
The symbols are called connectives (negation, disjunction, conjunction, implication, equivalence), while the symbols ∀ and ∃ are called quantifiers (universal, existential).
If we consider a variable
x, then
asserts that, for every value
a taken by
x,
holds, while
asserts that there exists a value
a of
x for which
holds. Connectives between propositions can be extended to predicates. In particular, if
P and
Q are predicates with only one argument, then
denotes the predicate such that
holds when proposition
holds.
2.2. Formalizing Natural Language Sentences
Predicate logic [
10,
12,
20] is a formal system used to represent the logical structure of propositions. Chapter 6 of [
20] develops, in more than 100 pages, the first modern attempt at logical analysis of natural language in terms of predicate logic. It provides a way to express relationships between objects and describe actions, properties, and concepts. In this text, we explore how high-order predicate logic can be used to represent the meaning of sentences and concepts in natural language in a systematic and agile way. The method is independent from any specific language, and is adequate for teaching logical analysis to artificial systems.
In predicate logic, we have three main components.
Predicates, Objects, and Logical Symbols
Predicates: these are symbols that represent relationships or properties. They describe how objects are related to each other or specify attributes of objects; for example, “love”, “eat”, and “happy” are predicates.
Objects: these are the entities to which predicates are applied. They can be individuals, things, or concepts. In natural language, objects can include people and animals as well as relations and properties. In this sense, there is a need for both predicates that can be applied to objects and for objects that are predicates to which other predicates can be applied.
Logical Symbols: connectives and quantifiers are used to express the logical operations . Parentheses and commas are additional symbols that are needed for writing logical formulas.
Objects and predicates are denoted by: (i) constants (letters or strings) denoting objects and relations (at every level) and (ii) variables (letters or strings, different from those used for constants) ranging over objects and relations (at every level). We adopt a convention that we call of implicit typification, in which: (i) lowercase letters denote individuals (objects at zero level); (ii) strings of letters with one uppercase letter denote first-order predicates (over individuals); (iii) strings with two uppercase letters denote second-order predicates (over first-order predicates); and (iv) analogously for the third order and higher orders. Strings of letters including x, y, z, X, Y, Z (possibly with subscripts or superscripts) are variables, while strings including other letters (lowercase or uppercase, possibly with subscripts or superscripts) are constants. In this way, the form of a string assigns to it the role of a constant or a variable and determines its logical type.
Predicates are associated with words in a given language. In this case, the logical types of such predicates can be deduced from the types of their arguments.
A predicative theory is provided by a list of propositions (as indicated below, on subsequent lines).
Below, we affirm a principle whose validity has been proven by the applications of Mathematical Logic from the late 19th century to the present day.
The semantics of every symbolic expression can always be reduced to an appropriate predicative theory.
In practice, predicative theories use additional symbols to make them easier to read and write. For example, the equality symbol = is used to affirm that two symbolic expressions have the same meaning. In formal terms, equality is defined by the following proposition:
However, all symbols extending the kernel of Predicate Logic can be formally defined in the basic setting provided above, and can be reduced to Frege’s logical basis of negation, universal quantifier, and implication ().
Predicates associated with words include: (i) lexemes from a dictionary (in a predefined language), including proper names; and (ii) grammatical elements, called grammemes.
Obviously, the choice of dictionary determines the lexemes, while grammatical predicates depend on the terminological choices of the reference grammar. For example, we could use “ComplOgg” to indicate the role of an object complement or consider transitive verbs as predicates with two arguments (subject and object). For example, “a loves b” becomes , or: .
Furthermore, we can consider the predicate “I” or a predicate such as “1st-Pers-sing” (first-person, singular), and analogously for pronouns, prepositions, and conjunctions. Even a proper noun is a predicate; thus, Julia(a) indicates that “a” is named “Julia”.
Thus, in predicative theory, the simple sentence “I love Helen” is expressed as
I(a): this indicates that the individual constant a is the “I” of the sentence.
Helen(b): this indicates that the individual constant b denotes an individual named “Helen”.
Love(a, b): this asserts that “a loves b”.
Of course, grammatical terminology is entirely arbitrary, and any equivalent terminology essentially express the same logical relationships between objects and predicates.
Let us consider the sentence “Yesterday, I was walking without shoes”. Its predicative representation is as follows, where denotes the predicate abstraction of “Walk”, which we explain in the next section:
I(a)
(P)
PastProgressive(P)
YesterDay(P)
P(a).
Intuitively, the formalization of the sentence can be paraphrased as: (1) P is a walking motion; (2) a is without shoes (any object that a is wearing is not a shoe); (3) P is yesterday and is in the past (imperfect); (4) the constant a is the “I” of the sentence; (5) a satisfies predicate P.
3. Results
In this section, the logical operator of predicate abstraction in introduced, which is related to Church’s lambda abstraction. Logical representations of a Chinese sentence are provided and High-order Monadic Logic (HML) is introduced, which is a special kind of high-order Predicate Logic. Finally, many examples of logical representations in HML are provided.
3.1. Predicate Abstraction
Predicate abstraction is a powerful logical operation in the context of natural languages. It allows us to elevate the logical order of a predicate. When we say , we mean that individual a loves someone; however, when (P) holds, this means that P possesses the property of loving. Thus, P is a predicate including all the typical characteristics of loving, because denotes a predicate over first-order predicates, which is a second order predicate.
We present the following informal definition of the Predicate Abstraction operator:
Given a first-order predicate , the second-order predicate is a predicate expressing the property of all predicates that imply the predicate .
In general, when applied to a predicate of order
i, the predicate abstraction operator provides a new predicate of order
. The sentence “Every man is mortal” has the following very simple representation showing the expressive power of predicate abstraction:
namely, the predicate
has the property of all predicates that imply mortality.
By using predicate abstraction, the sentence “I love Helen” becomes:
I(a)
Helen(b)
(P)
P(a, b).
Apparently, this seems a way of making difficult a very simple proposition: . However, in the representation above it is possible to add other propositions having a P as argument, which can enrich P with other particular aspects.
For example, the sentence “I love Helen very much” is obtained by adding a further second-order predication to P:
I(a)
Helen(b)
(P)
VeryMuch(P)
P(a, b).
A formal definition of Predicate Abstraction can be provided by means of “lambda abstraction”, introduced by Alonzo Church around 1920. Today, we prefer to express it in Python notation. Let us consider a Python expression built with some operations applied to data and variables, such as , where a is an integer, B is a list of integers, and i is an index (integer):
result =
return result.
This is essentially a way of expressing the function corresponding to the expression , independently from the choice of variables occurring in as well as from the particular values assumed by the variables, that is, the result produced by the function is the evaluation of when the variables occurring in it are instantiated with the arguments of funct. This mechanism is essential in programming languages, as it distinguishes the definition of a function from its application (the calling of function) in many possible contexts. It is a basic logical mechanism on which high-order predicate logic can be founded, together with application and implication.
The following is the formalization of the prior sentence regarding “walking without shoes” using predicate abstraction:
(P)
(P)
I(a)
PassImperf(P)
Yesterday(P)
P(a).
This second representation of the sentence is more correct than the previous one; because has P as argument, it is not expressing a property of the individual a (who sometimes may wear shoes), and instead characterizes P as a property of the walking of a (together with the predicates and ).
It can be verified that any discourse can be rigorously represented within the logical structure outlined here.
The number of basic words in a natural language is only a few thousand, while grammatical predicates are a few hundred and logical symbols a few dozen. By adding letters for constants and variables, it is possible to express the meanings of natural language texts with predicates of logical types that generally do not exceed the third level. However, with respect to Montague’s approach, predicate abstraction permits a very simple way of constructing meanings incrementally by taking a basic predication and adding other propositions with high-order predicates that provide further characterizations to P. As we show, this modularity avoids many complications of Montague’s semantics by providing logical representations that are very close to the linguistic form of sentences.
3.3. High-Order Monadic Logic
High-order predicate logic with only monadic (unary) predicates (HML) is a powerful environment for developing logical representations of natural language sentences. This short section provides a rigorous basis for the analysis of the logical types of high-order predicate logic. As it is more technical, readers who are not interested in the foundations of our formalizations can skip it without compromising their understanding of the following discourse.
High-order Monadic Logic (HML) can be expressed using three logical symbols:
(1) for (functional) abstraction;
(2) → for implication;
(3) parentheses ( ).
In HML, there are two categories of expressions, namely, objects and types. An object is associated with one and only one type.
There are two kinds of basic objects, individuals and truth values, with respective types and .
If denote generic types, then is a type denoting functions transforming objects of type into objects of type .
For any type , there is an infinite list of constants and variables of that type (with as a subscript indicating the type).
The constants F (false) and T (true) denote the two possible truth values (of type ).
In HML, there are three rules for obtaining expressions denoting objects starting from logical symbols, constants, and variables:
Abstraction rule: if is a -variable and denotes a -object, then denotes an object of type .
Application rule: if
denotes an object of type
and
denotes an object of type
, then
denotes an object of type
. Moreover, if
is an expression of type
including a variable
on which no
-abstraction is applied and
is an expression of type
, then
where
denotes the expression
after replacing all the occurrences of
with
.
Implication rule: if
and
denote truth values, then
denotes a truth value. In general, if
and
are predicates of type
, then
is a predicate of the same type, such that for any expression
of type
it is the case that
It can be shown that all the logical operators of high-order predicate logic can be expressed in HML. In particular, using the symbols , negation is expressed by and quantification is expressed by .
Expressions denoting truth values are called propositions (a predication can be considered as an “atomic proposition”), while those denoting objects of type , which we indicate with , denote (unary) predicates of type . Objects of type correspond to first-order predicates, and are simply indicated by , while objects of type are second-order predicates.
3.4. Predicate Abstraction in HML
Let us consider a binary predicate
P over two individuals and the predication
of
P over the arguments
. We can express this proposition by means of two unary applications:
, where
is the monadic predicate
obtained by
P when its first argument is put equal to
a, which holds on
b when
holds:
Therefore,
is a function taking an individual as argument and providing the unary predicate
.
Let
be a second-order predicate satisfied by the monadic predicates
holding on
b. Consequently,
However,
means that
therefore,
In other words, the monadic reduction of a first-order binary predicate is definable in term of predicate abstraction. In conclusion,
is completely represented by
and we can simply write
Of course, the mechanism described for binary predicates can be naturally extended to predicates of any number of arguments.
Place, time, manner, instrument, possession, and other natural language complements logically relate to an (implicit) application of predicate abstraction. Specifically, we employ an implicit predicate abstraction (after accepting an individual as an argument) to express verb complements by supplying a predicate’s property. As an illustration, the predication states that P has the property (a property of properties), the logical type of is (in fact. has type ), and finally, is a proposition (of type ).
The monadic nature of HML enables a very synthetic way of expressing the predicative structure of sentences: enumerating all constants and listing for each of them the predicates taking a given constant as argument. For example, the previously considered sentence “Yesterday I was walking without shoes” becomes:
The above formalization corresponds to a Python dictionary structure of the following type (where “abs” stands for predicative abstraction):
It is apparent that, by avoiding the explicit use of variables, the monadic setting of HML forces the formalization to fit closely with the linguistic form. Specifically, unary predicates naturally impose high-order logical types, with consequent elimination of variables. Moreover, a constant may occur as an argument and as a predicate at the same time ().
Certain aspects are crucial in the determination of the above Python dictionary: (1) the introduction of the right constants to which the predicates refer; (2) possible “hidden predicates” that do not occur as words in the sentence, which generally are of grammatical nature but in the case above include the lexical term “Wear”; and (3) the logical type of predicates and the pattern according to which they apply. For example,
implicitly provides the following type assignments, where
abbreviates the type
:
In natural languages, complements, modifiers (adjectival and adverbial forms), and pronouns realize the reference mechanism, usually based on grammatical marks and morphological concordance (gender, number, tense …). A pronoun refers to a component having the same marks. Moreover, the aggregation of components is realized on the basis of concordance, which corresponds to the use of parentheses in mathematical expressions. In HML, reference is realized by means of constants and aggregation is realized by parentheses, with the different levels of application expressing the logical levels of predicates in a rigorous way.
The sentence “Mary goes home with the bike” provides the following HML translation:
A more complex example involving a relative clause is the sentence “I am searching for a bike with a leather saddle”.
We can consider the logical definition of
as a function of type
satisfying the condition
Progressive-present
.
We collected a number of translation exercises involving different kinds of linguistic constructions, several of which were long and complex, to confirm the power and adequacy of HML to represent natural language logic. The expressive mechanisms of lambda abstraction, high-order types, application, and implication, together with parentheses and constants, apply to any kind of natural language.
5. Discussion
The ability of predicate logic to represent human thought within a minimal set of symbols is a remarkable achievement with a millennia-long history. It traces back to the earliest systems of writing, through Aristotle’s syllogism and medieval logic dealing with problems of interpretation and modality, up to Renaissance logic focused on combinations of symbols.
Leibniz had a profound and visionary understanding of symbolic systems and mathematical notation. Over time, great minds such as De Morgan, Boole, Schröder, Peirce, Frege, Peano, Hilbert, Russell, Church, Tarski, and Gödel laid the foundations for an alphabet of ideas. As mathematical logic proves, this alphabet, consisting of a few logical symbols and rules for their combinations, is capable of formally representing human reasoning.
This distilled form of reason has a deep and enduring history, serving as the foundation for various mathematical and scientific theories. In particular, it provides a secure framework for set theories such as ZF (Zermelo–Fränkel) and NBG (von Neumann–Bernays–Gödel), which can express nearly all of mathematics using specific axioms.
Formalisms for representing knowledge, particularly those that are universal in nature, are applicable in a vast array of contexts. This implies that a formalism has a good chance of developing and becoming a valuable tool in scientific communication if it is more straightforward and grounded in science than others.
The examples presented in this paper and the reported conversation with ChatGPT 3.5 suggest an intriguing possibility for the development of systems exhibiting dialogue abilities, such as ChatGPT, BARD, BERT, and others; see [
21,
22] for analogous proposals from different perspectives.
An artificial system able to provide HML formalization of linguistic texts must provide an elaboration of an input string expressing a sentence, then yield as output the correct dictionary expressing HML propositions involving the words of the sentence. While the words occurring in the dictionary take the form of lexicon entries (lexemes), grammatical items need to appear in the dictionary of logical representations as well. This requires basic linguistic ability on the part of the system, similar to that of LLM models.
The conversation with ChatGPT shows that even when we provided the formal basis of our formalism for motivating its logical structure and links with classical predicate logic, during the interaction with ChatGPT the formalism was explained in plain English and essentially transmitted by examples and comments on concrete cases of logical analysis. It is apparent that the system shows flexibility and the ability to abstract from single cases, which are surely supported by its ability to dominate abstract structures thanks to its grounding in the logical basis of HML.
Not only was the chatbot able to follow a very constructive conversation, it correctly addressed the point of incremental learning, which of course is a strategic topic, though beyond the scope of the present paper. However, formalisms of knowledge representation, especially those of general-purpose nature, apply to an enormous number of situations. This means that if a formalism is simpler and more scientifically well-founded than others, it can surely develop and become an important instrument in scientific communication.
In the case of systematic training of chatbots by human experts, the trainers need to understand the formalism; in this case, a Python version of HML might be more appropriate. We have already noted that a logical representation reduces to a Python dictionary, and it would not be difficult to translate lambda abstractions and all the logical basis of HML into terms of suitable Python functions, classes and methods.
A critical point emerged during the last part of the conversation, namely, that whatever ChatGPT learns during a teaching interaction is completely lost at the end of the conversation. In fact, for reasons of security, even if a learning system can develop a capability of incremental learning, this cannot be free until chatbots are able to develop internal mechanisms for decision-making and control of their learning. In other words, the actual systems are closed, and training can only be developed within the companies to which these systems belong. This means that at present experiments with significant impact could only be possible in accordance with the research that is planned on these systems.
Of course, this does not mean that proposals and suggestions from external researchers are useless. On the contrary, it is important to debate and promote the circulation of new ideas that can be assimilated and integrated with those of other scientists up to the level of design and implementation that the companies acting in AI and machine learning decide to realize.
With the availability of an artificial neural network already trained in basic dialogue competence, after training the ANN to acquire competence in HML representation, an evaluation of its impact on the quality and level of language comprehension could be carried out, which may be of fundamental importance for the whole of artificial intelligence.
Surely, the epochal passage to the latest chatbots tells us that language is the main tool for knowledge acquisition and organization; therefore, a correct understanding of the logical structure of language could be the next step toward a further level of “conscious” linguistic ability.