3. First-Order Logic Systems
This section reviews first-order logic. This section culminates with a discussion of aspects of legal reasoning in ErgoAI.
First-order logic expressions have logical binary connectives and a unary operator ¬. They also have variables and quantifiers . First-order logic quantifiers only apply to variables. Functions and predicates in first-order logic describe relationships. It is the variables, functions, and predicates that differentiates first-order logic from more basic logics. The logical connectives, quantifiers, functions, and predicates may all be applied to the variables. We assume all logic expressions are well-formed, finite, and in first-order logic.
Standard logic proofs are syntactic structures in first-order logic. Such proofs are sometimes called Hilbert-style proofs [
43]. First-order logic proofs can be laid out as trees. If the proof’s goal is to establish an expression
is provable, then the proof tree has
as its root. The vertices of a proof tree are facts, axioms, and expressions. The directed edges connect nodes by an application of an inference rule. If a logical formula is provable, then finding a proof often reduces to trial and error or exhaustive search. The inference rule for Prolog-like theorem proving systems for a subset of first-order logic is generally SLDC-resolution [
38]. To apply such inference rules may require substitution or unification. This is a mix of syntatic and semantic proofs, though ErgoAI can output the syntatic proof.
ErgoAI has frame-based syntax which adds structure and includes object oriented features [
3]. The ErgoAI or Prolog expression
H:-B is a rule. This rule indicates that if the body
B is true, then conclude the head
H is true.
Modern foundations of some tax laws are not all that different from ancient principles of tax law. Certain current US tax laws are analogous to those from past empires and republics [
35,
36,
37]. These tax laws in the past were written in different natural languages, but their underlying principles are the same. While the meaning of words evolves, ideally the semantics of particular tax laws remain the same over time. Modern tax law may be more complex than ancient tax law because modern US tax law requires millions of words to specify [
39]. Nonetheless, modern tax law ideas often subsume many of the ancient principles of tax law.
Under the legal theory of Originalism, the words in the tax law should be given the meaning those words had at the time the law was enacted. Scalia and Garner’s book is on how to interpret written laws [
40]. For example, they say,
“Words change meaning over time, and often in unpredictable ways.”
Assumption 1 (Originalism). A law should be interpreted based on the meaning of its words when the law was enacted.
Of course, tax law can be changed quickly by a legislature. Assuming originalism, the meaning of the words in the newly changed laws, when the new laws are enacted, is the basis of understanding these new laws.
Specifying meanings or words for theorem-proving systems uses variables that are expressed as atoms. The syntax of variables in most programming languages are specified by regular expressions. A regular language is all strings that can be generated by a particular regular expression. A context-free language is all strings can be generated by a particular context-free grammar. Regular languages are context-free languages.
Variables can be grouped together using context-free grammars. This holds true for the syntax of atoms in ErgoAI or Prolog. An atom is an identifier that represents a constant, a string, name or value. Atoms are alphanumeric characters provided the first character is a lower-case alphabetic character or the under-score character. Atoms can name predicates, but the focus here is on atoms representing items that are substituted for variables in first-order expressions.
In tax law, some of the inputs may be parenthesized expressions. For example, some amounts owed to the government are compounded quarterly based on the “applicable federal rate” published by the U.S. Treasury Department. Such an expression may be best written as a parenthesized expression since infix notation is commonly used for accounting and finance. So, the text of all inputs for the tax statutes are a subset of certain context free grammars. A context-free grammar can represent the syntax of parenthesized expressions and atoms in ErgoAI. Of course, logical expressions or computer programs can only approximate the meanings of laws or tax rules. There may be a great deal of context beyond originalism that supports the meaning in the natural language of law.
An example of “context beyond originalism the supports the meaning in the natural language of law” is, for federal statutes, the committee reports of the House and Senate committees that drafted, in some cased modified, and ultimately approved the bills sent to the floor of the House and Senate to be voted on by the members of those chamber.
Definition 2 (Context-free grammar (CFG)). A context-free grammar where N is a set of non-terminal variables, Σ is a set of terminals or fixed symbols, P is a set of production rules so is such that where and , and is the start symbol.
The language generated by a context-free grammar is all strings of terminals that can be generated by the production rules of a CFG. The number of strings in a language generated by a CFG is, at most, countably infinite.
Definition 3 (Countable and uncountable numbers). If all elements of any set T can be counted by some or all of the natural numbers , then T hascountablecardinality . Equality holds when there is a bijection between each element of the set T and a non-finite subset of . In this case, T is countably infinite. The real numbers have cardinality which isuncountable.
Cantor showed
while founding modern set theory. The assertion that there is no cardinality between
and
is the continuum hypothesis. Gödel and Cohn showed the independence of the continuum hypothesis from a standard set of axioms for set theory [
41,
42,
44].
The next theorem is classical. In our case, this result is useful for applications of the Löwenheim–Skolem (L-S) Theorems. See Theorem 8.
Theorem 1 (Domains from context free grammars). A context free grammar can generate an language with countably infinite strings.
Proof. Consider a context-free grammar made of a set of non-terminals , a set of terminals , a set of productions P, and the start symbol S. Let , be the empty symbol.
So, the CFG G can generate a string corresponding to any natural number in . All natural numbers form a countably infinite set, completing the proof. □
The language of regular expression captures the syntax of an atom in ErgoAI or Prolog. The language of well-formed expressions of atoms in ErgoAI or Prolog are in the language of context-free grammars. The language of regular expressions are a proper subset of the language of context-free grammars. So the cardinality of atoms or expressions of atoms in ErgoAI and Prolog is bounded above by .
In addition to representing all ErgoAI atoms, the proof of Theorem 1 uses a CFG that generates a language corresponding to all integers in . In other words, the language of this CFG contains strings.
Each individual word in the domain of all words used in the set Law can be uniquely numbered by an integer in . Indeed, each word can be represented by the numerical value of their UTF-8 representation. Separately, any numerical values required for computing taxes can also be represented using integers and parenthesized expressions. To represent positive or negative integers the grammar in the proof of Theorem 1 can be extended by adding two terminals to , two non-terminals and T to N. Where is the new start symbol and the additional rules: and to the set P.
The statement
indicates that the set of formulas
f is syntatically provable in the logical system at hand. That is, using a Hilbert-style proof. Therefore,
f is a tautology. A tautology is a formula that is always true. For example, consider a Boolean variable
X representing when an purchase is for business. So
X is over the domain of
. Then
must always be true so
f is a tautology. The formula
is a contradiction. Contradictions are always false.
Suppose g is a first-order logical formula. A formula may have free variables. A free variable is not bound or restricted. If a variable is quantified it is not a free variable. A quantifer Q is such that where g is a first-order formula. If , then this means . Or, if , then .
First-order logic Theorem proving languages such as ErgoAI or Prolog default to for any free variable x.
Definition 4 (Logical symbols of a first-order language [
41,
42,
43])
. The logical symbols of a first-order language are,
-
1.
variables
-
2.
binary logic operators and a unary logic operator ¬
-
3.
quantifiers
-
4.
scoping using () or [] or a such-that symbol :
-
5.
a concatenating symbol ,
-
6.
equality =
Scoping can be expressed using a context-free grammar.
Definition 5 (-language). If , then this is a first-order -language where L is the set of logical operators and quantifers, D is the domain, and σ is the signature of the system which is its constants, predicates, and functions.
The signature
of a first-order logic language is the set of all non-logical operators and quantifers of the language [
43]. That is, the signature includes constants, functions, and predicates.
A formula f is an expression of an -language and we write . A set of formulas of an -language is written simply as , if the index set is understood. A formula f has no free-variables if each variable in f is quantified by one of ∀ or ∃.
Definition 6 (Sentence). Consider a first-order logic language and a formula . If f has no free variables, then f is a sentence.
An interpretation defines a domain and semantics to constants, functions, and predicates for formulas or sentences. An interpretation that makes a formula f true is a model. Given an interpretation, a formula may be neither true nor false if the formula has free variables.
Definition 7 (First-order logic interpretation [
43])
. Consider a first-order logic language and a set I. The set I is an interpretation of iff the following holds:
-
1.
There is a interpretation domain made from the elements in I
-
2.
If there is a constant , then it maps uniquely to an element
-
3.
If there is a function where f takes n arguments, then there is a unique where F is an n-ary function.
-
4.
If there is a predicate where r takes n arguments, then there is a unique n-ary predicate .
An interpretation I of a first-order logic language is the domain in addition to the semantics of constants, functions, or predicates. The semantics of interpretations are defined with natural language, mathematics, and mathematical examples. Consider the domain D, signature , and an interpretation I. The interpretation I can be applied to a sentence f by substituting values from into , where F corresponds to . These substitutions are done while applying the constants, functions, and predicates as expected based on their semantics.
Suppose, corresponds to for the interpretation I. The expression , means values from I are substituted into giving .
Definition 8 (Logical model). Consider a first-order language and an interpretation I of , then is a model iff for all are so that each is true, where each corresponds uniquely with a .
Models are denoted and .
The expression indicates all interpretations make the formula f true. If is a set of formulas of a first-order -language and g is a single formula of , then holds exactly when all models of are models of g. For example, if an interpretation I has the positive integers in its domain for the sentence , then is true. However, if the domain of I is updated to include , then . Going further, if , then but .
Definition 9 (First-order logic definitions). Given a first-order logic formulas and an interpretation I and f’s corresponding , then f is:
Valid if every interpretation I is so that is true
Inconsistent or Unsatisfiable if F is false under all interpretations I
Consistent or Satisfiable if F is true under at least one interpretation I
If a set of formulas is valid for an interpretation I, then this is a semantic or model-theoretic proof of restricted to I.
The next result is classical for syntatic Hilbert-style proofs, see [
42,
43].
Theorem 2 (First-order logic is semi-decidable). Consider a set of first-order logic formulas f.
-
1.
If f is true, then there is an algorithm that can verify f’s syntatic truth in a finite number of steps.
-
2.
If f is false, then in the worst case there is no algorithm can verify f’s syntatic falsity in a finite number of steps.
Suppose is a set of first-order logic formulas. If is syntatically provable, then it is valid and hence semantically provable since it satisfies all interpretations. We write when all interpretations of are models of as well as models of c.
Theorem 3 (Logical soundness). For any set of one or more first-order logic formulas and a first-order formula c: If , then .
Gödel’s completeness theorem [
43] indicates if a first-order logic formulas is valid hence semantically provable, then it is syntatically provable. If
c is true for all models of
, then
c is semantically provable.
Theorem 4 (Logical completeness). For any set of one or more first-order logic formulas and a first-order logic formula c: If , then .
There are many rules that can be found in tax statutes. Many of these rules are complex. Currently there are about word instances in the US Federal tax statutes and about word instances in the US Federal case tax law. Of course most of these words are repeated many times, though they may be in different contexts.
3.1. Interpretation and Model
This subsection discusses interpretations used by the remainder of the paper. These interpretations are for first-order theorem-proving systems and LLMs. The focus here is on interpretations , assuming originalism, for ErgoAI.
Theorems 3 and 4 tell us that any set of first-order sentences that has a valid model can be syntatically proved. And symmetrically, any set of first-order sentences that can be syntatically proved has a valid model so it can be semantically proved.
A observation based on Theorem 2, if a set of first-order sentences is valid, then there is an algorithm that can find a syntactic proof of . However, if a set of first-order sentences is not valid, then in the worst case, there is no algorithm that can show is not valid. So, given a set of true first-order sentences , we can use resolution theorem proving algorithms to determine their truth. This extends to the subset of first-order logic found in ErgoAI or Prolog. This is because SLDC-resolution operates on a subset of first-order logic. This subset is first-order logic Horn-clauses.
The focus here is on ErgoAI as a syntatic theorem prover for first-order logic of Horn-clauses. In this case, all ErgoAI statements map to first-order logic Horn-clause sentences. Any first-order statement that is provable in ErgoAI has a valid model, see Theorem 3. Nonetheless, the Horn-clauses of first-order logic ErgoAI and Prolog work in is still semi-decidable, so Theorem 2 applies. Here we sketch a correspondence between ErgoAI statements and logical interpretations.
The interpretation is for first-order logic programs encoding tax law assuming originalism. In any case, the interpretation fixes all word and phrase meanings from when the laws were enacted, see Assumption A1. All first-order logic expressions using are sentences. This is because languages, such as ErgoAI or Prolog, assume universal quantification for any unbound variables. Of course, the ideas here can apply to many other areas besides tax law.
Unification and negation-as-failure add complexity to first-order logic programming interpretations [
49,
58]. Furthermore, facts can change. Handling a logic program’s database change in first-order logic programming can be done using additional semantics [
45].
3.2. Examples in ErgoAI
This subsection illustrates this section’s discussion using ErgoAI.
Listing can be expressed in terms of provability. In this regard, consider Listing . The ⊢ operator is from the logic of syntatic theorem proving.
| Listing 1: Applying a rule or axiom in pseudo-ErgoAI as a proof |
?X: Expenditure ∧ ?X[ ordinary −> true ] ∧ ?X[ necessary −> true ] ∧ ?X[ forBusiness −> true ] ⊢ ?X: Deduction |
So, if there is an ?X that is an expenditure, and it is ordinary, necessary, and forBusiess, then this is accepted as a proof that ?X is a deduction. This is because ErgoAI facts are axioms. ErgoAI rules may be axioms or logical inference rules. So, if the first four lines of the rule in Listing are satisfied, then we have a proof that ?X is a Deduction.
Listing is an ErgoAI rule for determining if an expenditure is a deduction. The notation ?X is that of a variable. The expression ?X:Class indicates the variable ?X is an instance of Class. In this listing, the variable ?X also has Boolean properties ordinary, necessary, and forBusiness.
| Listing 2: A rule in ErgoAI in frame-based syntax |
?X: Deduction :− ?X : Expenditure , ?X[ ordinary => boolean ] , ?X[ necessary => boolean ] , ?X[ f o r B u s i n e s s => boolean ]. |
The rule in Listing has a body indicating that if there is an ?X that is an expenditure with true properties ordinary, necessary, and forBusiness, then ?X is a deduction. This rule is taken as an axiom.
The ErgoAI code in Listing has three forBusiness expenses. It also has two donations that are not forBusiness. Since these two donations are not explicitly forBusiness, by negation-as-failure ErgoAI and Prolog systems assume they are not forBusiness. The facts are the first five lines. There is a rule on the last line. Together the facts and rules form the database of axioms for an ErgoAI program.
| Listing 3: Axioms in ErgoAI in frame-based syntax |
employeeCompensation : forBusiness . rent : forBusiness . robot : forBusiness . foodbank : donation . p o l i t i c a l P a r t y : donation .
?X: l i a b i l i t y : − ?X: forBusiness . |
A program in the form of a query of the database in Listing is in Listing . This listing shows three matches for the variable ?X.
| Listing 4: A program in ErgoAI in frame-based syntax |
ErgoAI> ?X:forBusiness.
>> employeeCompensation >> rent >> robot |
Hence an ErgoAI system can prove employeeCompensation, rent, and robot all are forBusiness. We can also query the liabilities which gives the same output as the bottom three lines of Listing .
5. Löwenheim–Skolem Theorems and Elementary Equivalence
This section gives the main results of this paper. Its final subsection gives highlights of the Neural Tax Networks system.
As before, our theorem-proving systems prove valid theorems in first-order logic. These results suppose tax law and clarifications are in a set Law and then translated to a first-order logic suitable for a legal theorem-proving system. We assume the semantics of the law is at most countable from when the laws were enacted. This is assuming originalism for the rules in a theorem proving system for first-order logic. The culmination of this section then shows: if new semantics are introduced by LLMs, then a first-order theorem-proving system will be able to prove the same results from the original semantics as well as the new semantics introduced by the LLMs. In traditional logic terms, first-order logic cannot differentiate between the original theorem-proving semantics and the new LLM semantics.
LLMs are trained on many natural language sentences or phrases. Currently, several LLMs are trained on greater than words instances or tokens.
Theorem 5 (Special-case of the upward Löwenheim–Skolem [
43])
. Consider a first-order set of formulas . If has a countably infinite model, then has an uncountable model.
Michel, et al. [
53] indicates that English adds about 8,500 new words per year. See also Petersen, et al. [
54]. Originalism indicates we must retain the meanings of words when laws are passed. The meanings, from different eras, may not remain in common use, but these meanings remain available for lookup. So, we assume words do not leave a language, rather they may fade from common use. These word meanings all remain a part of natural language given a suitable context. Since we are proposing automating semantic lookup, word meanings must be maintained by context. Particularly, this can be done so we can perform legal reasoning assuming originalism. Also a word may also change its meaning in common use while the word remains in common use but just with a different commonly-understood meaning.
A meaning is represented by a set of non-zero feature values. For example,
Figure 1 shows feature values for each row. Each row represents one or more words. Theorem 6 is based on adding new words with new meanings, or adding new meanings to current words over time. There are several ways we can represent new meanings: (1) a new meaning can be represented as a set of features with different values from any row, or (2) a new meaning may require new features. See the feature table in
Figure 1. We assume there will always be new meanings that require new features. So, we assume the number of feature columns is countable over all time. Just the same, we assume the number of words an LLM is trained on is countable over all time. In summary, over all time, we assume the number of rows and columns in this Figure are both countably infinite. Words that are synonyms have the same non-zero feature sets so they will be counted once. Similarly, synonyms can be on consecuitive rows of a feature table. Homonyms are each individually listed with their different feature sets since homonyms have different meanings. Furthmore, individual words may have many feature sets. Each feature set of a single word represents a different meaning.
The number of meanings is uncountable based on the next argument. Given all of these new words and their new features, they diagonalize.
Figure 1 shows a word
whose features must be different from any other word with a different meaning. Therefore, any new word or meaning or an additional meaning for a word is
. So
is a new word or new meaning and it will never have the same non-zero feature values of any of the other words or meanings. So, if there is a countable number of feature columns and a countable number of rows, there must always be additional meanings not listed.
In the case of Neural Tax Networks, some of these new words represent goods or services that are taxable. Ideally, the tax law and clarifications will not have to be changed for such new taxable goods or services. These new word meanings will supply new logical interpretations for tax law.
Assumption 2. In natural language some words will get new meanings over time. Also new words with new meanings will be added to natural language over time.
For LLMs, assuming languages always add new words and meanings over time, then it can be argued that natural language has an uncountable model if we take a limit over all time. This is even though this uncountable model may only add a few terms related to tax law each year. To understand the limits of our multimodal system, our assumption is that such language growth and change goes on forever. Some LLMs currently train on word instances or tokens. This is much larger than the number of atoms used by many theorem proving systems. Comparing countable and uncountable sets in these contexts may give us insight.
Recall Assumption A1 which states the original meaning of words for our theorem-proving system is fixed. In other words, the meaning of the words in law is fixed from when the laws were enacted. We assume originalism since we recognize that the meaning of words can change over time. An example is provided in Reading Law: The Interpretation of Legal Texts by Scalia and Garner [
40]. Under the section entitled “Semantic Cannons/Fixed Meaning Canon” Scalia and Garner note that the meaning of words change over time. Furthermore their meanings often change in unpredictable ways. They give as an example the statement attributed to Queen Anne about the architecture at St. Paul’s Cathedral was “awful, artificial and amusing.” By “awful” she meant “awe inspiring.” This contrasts with how the word “awful” is typically used today, in which it does not convey a positive impression of something but instead connotes a negative feeling about the thing being described. Thus, as Scalia and Garner state, it would be quite wrong to ascribe the Queen’s 18th century statement about the architecture of St. Paul’s Cathedral the 21st century meaning of her words.
Although this is a somewhat extreme example, it clearly shows that to properly determine the meaning of the words of a statute (and thus apply the statue in accordance with its terms) the statute must be interpreted and applied using meaning of the words at the time the statute was written. This is because originalism is the only way to determine what was intended by the legislative body that enacted the statute.
Homonyms can arise over time by having words used for one meaning at a particular point in time take on a second, unrelated but not contradictory, meaning when used in other contexts. The meanings of such words in legal writing can be determined by application of the “whole text” canon discussed by Scalia and Garner[
40], which requires the reader to consider the entire text of the document in which the word is used in order to determine its meaning. This is done in conjunction with the “presumption of consistent usage” canon, which states that a word or phrase is presumed to bear the same meaning throughout a text, and that a material variation in terms suggests a variation in the meaning. Salia and Garner, “Presumptive of Consistent Use” canon, [
40]. Taken together, these rules of statutory interpretation and application allow an expert system of the type being developed to use the capabilities of LLMs to determine, based on context, potential dual meanings is used. This will determine with an extremely high degree of accuracy what meaning should be assigned to that word. By way of example, the sentence “the light poll is bent and must be replaced” can readily be distinguished from the sentence “the voting poll closes at 8 PM.” This is only by the use of a different adjective immediately before the word “poll” but also by the use within the same sentence of the word “bent” (in the case of the “light poll”) and “closes” (in the case of the voting poll).
Theorem 1 shows context-free grammars can approximate countable infinite domains for theorem proving systems. This is by constructing a countable number of atoms or expressions of atoms. So using a similarity measure s suppose each word or token vector x has a subset of similar tokens where , for a constant integer .
Theorem 6. Taking a limit over all time, LLMs with similarity sets of constant bounded sizes have meanings.
In some sense, Theorem 6 assumes human knowledge will be extended forever. This assumption is based on the idea that as time progresses new meanings will continually be formed. This appears to be tantamount to assuming social constructs, science, engineering, and applied science will never stop evolving.
The next definitions relate different models to each other. The term `elementary’ can be interpreted as `fundamental.’
Definition 12 (Elementary extensions and substructures). Consider a first-order language . Let and be models and suppose .
Then is an elementary extension of or iff every first-order sentence is so that
Also, if , then is anelementary substructure
of .
The operator also can form elementary extensions. That is, by forming elementary model embeddings. For example, consider a sentence where f has n arguments, then construct where each argument is a pair.
This allows us to use a function
g so that if
corresponds to
and
g can be a similarity measure. So, for example, if
and
we have Since if
, then we can define
as
for all first-order sentences in
corresponds to
and
g is a similarity measure.
Definition 13 (Elementary equivalence)
. Consider a first-order language . Let mean and are elementary equivalent models of . Then iff every first-order sentence is so that
Given a model of a first-order language, then is the first-order theory of . See Definition 11.
Theorem 7 (Elementary and first-order theory equivalence)
. Consider a first-order language and two of its models and , then
Suppose a user input U is compatible with first-order logic rules and regulations R of our theorem proving system. These facts and rules are in the set . LLMs may help give the semantic expression G where . The formulas G are computed with (e.g., cosine) similarity along with any additional logical rules and facts. This also requires Assumption A2 giving a countable model for G.
The next version of the Löwenheim–Skolem (L-S) Theorems is from [
41,
55]. See also [
52].
Theorem 8 (Löwenheim–Skolem (L-S) Theorems). Consider a first-order language with an infinite model . Then there is a model so that and
Upward If , then is an elementary extension of , or ,
Downward If , then is an elementary substructure of , or .
A first-order language with an countably infinite model can encode tax law and clarifications in the set Law. This is because tax law is written down. Thus, it must be countable, even considering that over-all time, law may become of at most countably infinite size.
The next corollary applies to tax law as well as other areas.
Corollary 1 (Application of Upward L-S). Consider a first-order language with a countably infinite model for a first-order logic theorem proving system. Suppose this first-order theorem-proving system has a countably infinite domain from a countably infinite model where . Then there is a model that is an elementary extension of and .
Proof. There is a countably infinite number of elements in the domain from an interpretation of if these atoms can be specified by a regular expression or a context-free grammar by Theorem 1. So, apply Theorem 8 (upward) to the first-order logic theorem proving system for sentences of , with a countably infinite model . The upward L-S theorem indicates there is a countable infinite model so that . □
For the next result, a precondition is the model is a subset of .
Corollary 2 (Application of Downward L-S). Consider a first-order language and a countably infinite model , for a first-order logic theorem proving system. We assume an LLM with and a model so that . By the downward L-S theorem, is an elementary substructure of and .
Proof. Consider a first-order language and a first-order logic theorem-proving system with a countably infinite model . The elements or atoms of this model can be defined using context-free grammars or a regular language, see Theorem 1. This generates a countably infinite domain for the model so .
Suppose we have an uncountable model
based on the uncountability of LLM models by Theorem 6. That is,
Then by the downward Löwenheim–Skolem Theorem, there is an elementary substucture of where . This completes the proof. □
To apply this corollary, suppose the originalism-based legal first-order logic theorem proving system has a model whose elements are a subset of an LLM model. Then there is an equivalence between an LLM’s uncountable model and a first-order countable logic model. This equivalence is based on the logical theory of each of these models. In other words, a consequence of Theorem 7 is next.
Corollary 3.
Consider a language and two of its models and , where , then
5.1. Highlights of Our System Design
Definition 14 (Knowledge Authoring). Consider a set , of tax laws and clarifications in natural language, then finding equivalent first-order logic rules and facts is knowledge authoring. Performing knowledge authoring and placing the generated rules and facts in a set R is expressed as, .
Automated knowledge authoring is very challenging [
50]. We do not have an automated solution for knowledge authoring of tax law, even using LLMs. Consider the first sentence of US Federal Law defining a business expense [
51],
“26 §162 In general - There shall be allowed as a deduction all the ordinary and necessary expenses paid or incurred during the taxable year in carrying on any trade or business, including—”
The full definition, not including references to other sections, has many word instances. The semantics of each of the words must be defined in terms of legal facts and rules. Currently, our proof-of-technology has a basic highly structured user interface that allows a user to enter facts. The proof-of-technology also builds simple queries with the facts. Currently, this is done using our standard user interface. Our system is based on a cloud-based client-server architecture where the proofs are computed by ErgoAI on our backend. Our backend is in the cloud.
Figure 2 provides a sketch of the system architecture.
The front end is a React UI system. This React UI has users fill out details of their tax questions. The backend runs Java in a Spring-boot server. The Spring-boot server backend receives queries in JSON from the front end. These JSON queries are mapped to ErgoAI and executed by the Java backend. The answers are passed back to the React front end and presented using React.
A tax situation is entered by a user through the front end. A tax question is expressed by facts and a query. In response, the proofs are presented on the front end of our system.
Our goal is to have users enter their questions in a structured subset of natural language with the help of an LLM-based software bot. The user input is the set of natural language expressions U. The set U contains user supplied facts and a tax question. The first-order logic language is in the set R. The set R is based on the set Law of tax laws and clarifications. The set R was built using knowledge authoring, perhaps with a great deal of human labor. An LLM will help map these natural language statements and a tax question in U into ErgoAI facts and queries that are compatible with the logic rules and facts R in ErgoAI. We have not yet settled on how to leverage AI to map from user entered natural language tax questions into ErgoAI facts and queries.
Definition 15 (Determining facts and queries for R). Consider natural language facts and a tax question in a set U. We write for the map of U into into the set G of ErgoAI expressions that are compatible with the ErgoAI facts and rules R of tax law and clarifications (Law).
The expression indicates given , run an LLM to generate G.
Using LLMs, Definition 15 depends on natural language word similarity. The words and phrases in user queries must be mapped to a query and facts in our ErgoAI rules R so ErgoAI can work to derive a result.
Definition 14 and Definition 15 can be combined to give the next definition.
Definition 16.
Consider the ErgoAI rules and facts R representing the setLaw, tax law and clarifications, and the compatible ErgoAI user tax question as a query and facts . The query and facts are written as first-order logic sentences in G where since they must be compatible with the rules R. The sentences G must be built from to be compatible with R. Now a theorem prover such as ErgoAI can determine whether, .
Figure 3 shows our vision of the Neural Tax Networks system. Currently, we are not doing the LLM mapping automatically.
Figure 3 depicts knowledge authoring as
. Since
is the set of natural language laws and clarifications, they are based on the semantics of when the said laws were enacted by Assumption A1. Next, natural language facts and a tax question is placed in a set
U. Then
U is converted into first-order ErgoAI expressions in a set
G which are compatible with
R. That is, use an LLM to compute
. Finally, a theorem-proving system tries to find a proof
. A set
G will be computed for different natural language user input facts and questions
U.
The boxes in
Figure 4 indicate parts of our processing that may be repeated many times in one user session. Always in the order: a user enters their facts and query in
U and then the system uses an LLM to compute
giving
G. Next, the system attempts to prove
. This figure highlights knowledge authoring, the semantics of LLMs, and logical deduction.
We have several example user entered tax situations that we are currently using to test our system. As we add LLMs, we will add testing with similar words and measure how the system performs. These measurements will be based on correct proofs presented on the front end.