We develop a formal theory of finite structures, motivated in part by an imperative programming language for transforming such structures.
Our point of departure is to posit finite structures as a fundamental artifact of computing and programming. It is a truism that a database is a finite structure. But elements of infinite data-types, such as the natural numbers or binary strings, are also finite-structures that obey certain requirements. Computing over such a data-type can thus be construed as a transformation process driven by those structures’ internal making. Viewed from that angle, a function computed by a transducer-program is perceived as a mapping over the space of finite-structures, rather than a function within a particular infinite structure. Thus, finite partial-structures form a common platform for computing both within particular finite structures, and in the aggregate for computing over infinite data-types, as long as their elements are not infinite themselves (e.g. streams).
Our theory is second-order, in that we quantify over structures (via a quantification over finite functions). The well-known second-order nature of inductive data is thus manifested in the computation objects being themselves second-order, albeit finite ones. The atoms, from which our finite structures are built, are the first-order elements. They are nameless and structure-less, and there must be an unlimited supply of them to permit unhindered structure extension during computation. One intends to identify structures that differ only by the choice of atoms, i.e. ones that are isomorphic to each other, though it turns out that we can often convey that intent implicitly, without complicating matters with permanent references to equivalence classes.
Since referencing objects by constant and function identifiers is central to imperative programming, we choose to base our structures on partial-functions, rather than sets or relations. That is, each one of our structures is a finite set of finite partial-functions. The Tarskian notion of an explicit structure universe is superfluous here: the only atoms that matter are the ones that appear as inputs and/or outputs of a structure’s functions, a set we shall call the structure’s scope.
Finally, as we base our finite structures on finite partial-functions, the basic operations on structures must be function-updates of some form. This is analogous to the operation of adjoining an element to a set, which underlies several existing theories of finite sets (see below).
In fact, the idea that inductive data-objects, such as the natural numbers, can be construed as being composed of underlying units, goes back all the way to Euclid, who defined a number as “a multitude composed of units” [4, 7th book, definition 2]. The logicist project of Frege, Dedekind and Russell, which attempted to reduce mathematics to logic’s first principles, included this very same reduction of natural numbers to finite sets. The current predominant view of natural numbers as irreducible primal objects was advocated by opponents of the logicist project, notably Poincaré  and Kronecker, whose critique was subsequently advanced by the emergence of Tarskian semantics and by Gödel’s incompleteness theorems.
Philosophical considerations aside, the kinship between natural numbers and finite sets raises interesting questions about the formalization of finite set theory, and the mutual interpretation of such a theory with formal theories for arithmetic. Several formal theories proposed for finite set theory are based on ZF with the Axiom of Infinity replaced by its negation, which we denote here by .  shows that can be interpreted in PA (Theorem 3.1), and that PA can be interpreted in (Theorem 4.5), but not by the inverse of the former. That inverse would work for the interpretation of PA provided is augmented with a Transitive Containment axiom, asserting that every set is contained in a transitive set (Theorem 6.5). A result analogous to the latter111Wang removes from ZF Infinity without replacing it with its negation, since he does not interpret finite set theory in PA. was proved by Wang already in 1953 , where he uses an axiom (ALG) analogous to Transitive Containment, stating the enumerability of the collection of all finite sets.
It seems, though, that is somewhat of an oxymoron, in that it embraces ZF, a theory designed specifically to reason about infinity, only to eviscerate it off the bat by excluding infinity.222The subtext is, of course, the conviction that ZFC is the canonical formal framework for all of mathematics. An approach more germane to finiteness was proposed already by Zermelo [24, Theorem 3], Whitehead and Russell [23, *120.23], Sierpiński [18, p.106], Kuratowski , and Tarski . It enforces finiteness by an induction principle for sets: if satisfies a property and whenever satisfies then so does for each , then all sets satisfy . This induction principle corresponds to the inductive definition of finite sets as the objects generated by successively joining elements to .
Mayberry  defines an arithmetic based on induction on sets, which he deftly dubs Euclidean Arithmetic. He considers a number of induction principles derived from the set-induction principle above, but allows for neither set quantifiers nor unbounded atomic quantifiers in the induction formula. Consequently, his system is mutually interpretable with a weak number theory, namely extended with an exponentiation function (detailed proof in ). Pettigrew [15, 16] shows that these two theories are also equipollent with a bounded version of .
Our approach differs from the ones above in several respects. Our theory FS of finite structures is based on finite structures rather than finite sets, and is formally second-order, in contrast to theories based on ZF, which on the one hand are first-order, and on the other hand refer to a cumulative hierarchy of sets. At the same time, FS’s second-order nature is weak, in that its induction principle implies that its second-order object are finite. As a result, our theory of finite structures, although based on a variant of set induction (and not ) is equipollent to full Peano Arithmetic.
Principally, our motivation is to develop new natural tools for the analysis and verification or computing and programming. We are particularly interested in novel forms of calibrating computational resources by syntactic methods. In  we already show that, by using finite structures as focal concept, one obtains an abstract characterization of primitive recursive mathematics based on the concept of loop variant, familiar from program verification.
The remaining of the paper is organized as follows. In §2 we lay out our fundamental concepts and notations. Our theory FS of finite structures is presented in §3, followed by its programming language counterpart ST in §4. We then prove in §5 an abstract generalization of Kleene’s classical theorem about the existential definability of computability, and use it in §6 to show that FS is mutually interpretable in Peano Arithmetic.
2 Finite structures
2.1 Finite functions
Our basic notion is the finite partial structure, in which function-identifiers are interpreted as partial-functions. For example, we construe binary strings as structures over the vocabulary with a constant and unary function identifiers and . E.g., is taken to be the four element structure
Here is interpreted as the partial-function defined only for the leftmost atom, and as the partial-function defined only for the second and third. As in Gurevich’s ASM, we posit our finite structures to live within a denumerable set of atoms, i.e. unspecified and unstructured objects. To accommodate non-denoting terms we extend to a flat domain , where in addition to the atoms we posit a fresh object , intended to denote “undefined.” The elements of are the standard elements of .333We refer neither to boolean values not to “background structures”  on top of atoms.
By an -function we mean a finite -ary partial-function over , where ; thus, the nullary -functions are the atoms. We identify an A-function with the total function satisfying
Note that is necessarily strict, i.e. its output is whenever one of its inputs is. For each we let be the empty -ary -function, i.e. the one that returns for every input. When in no danger of confusion we write for . The scope of is the set of atoms occurring in its entries.
Function partiality provides a natural representation of finite relations over by partial functions, without recourse to booleans. We represent a finite -ary relation over () by -ary -functions whose domain is , notably the function
2.2 -structures over a vocabulary
A vocabulary is a finite set of function-identifiers, with each assigned an arity . We refer to nullary function-identifiers as tokens and to unary ones as pointers.
For the moment we might think of these identifiers as reserved names, but they can be construed just the same as (permanently free) variables.
An entry of an -function is a tuple where . is an -structure over if it is a mapping that to each , assigns a -ary -function , said to be a component of . The scope of is the union of the scopes of its components.
If is an -structure over , and an -structure over , then is an expansion of (to ), and a reduct of (to ), if the two structures have the same interpretation for identifiers in (the scope of may be strictly larger than that of ). For -structures and over the same vocabulary, we say that is a substructure of if every entry of is an entry of .
A finite collection of structures is itself a structure: if is a structure over (), then the collection is the union over the disjoint union of the vocabularies.
Given a vocabulary , the set of -terms is generated by
If , and then
Note that we write function application in formal terms without parentheses and commas, as in or . We optionally superscript function identifiers by their arity, and implicitly posit that the arity of a function matches the number of arguments displayed; thus writing assumes that
is a vector of length, and (with no superscript) that the vector is as long as ’s arity. A term is standard if does not occur in it.
Given an -structure over , the value of a -term t in , denoted , is obtained by recurrence on t:
An atom is -accessible in if for some . An A-structure over is accessible if every atom in the scope of is -accessible. For example, if is without tokens then no atom of a -structure can be accessible. If every atom in the scope of an accessible structure is the value of a unique -term we say that is free. Note that an accessible A-structure can fail to be free even if all its components are injective:
However, we have the straightforward observation:
An accessible A-structure over is free iff there is a finite set of -terms, closed under taking sub-terms, such that the function is injective.
If q is a standard -term, and consists of the sub-terms of q, then we write for the resulting free -structure. It is often convenient to fix a reserved token, say , to denote in each structure its root, i.e. the term q as a whole. For example, for nullary and , unary , and binary , the structures , , , are, respectively,
2.3 A second-order language
We wish to present a formal theory of finite structures, that deals not only with one structure at a time, but with structure transformation, in particular by suitable imperative programs. To that end, we generalize our discussion from a single vocabulary to a vocabulary “on demand.” We posit for each a denumerable sets of -ary variables, intended to range over the -ary -functions. The variables of arity and are dubbed atomic and functional, respectively. When a particular vocabulary is of interest (with the exhibited ordering of its identifiers), we write (with the vocabulary’s name as superscript) for a vector of variables , with . We update our definitions of the set Tm of terms, and of their semantics in a structure , by referring to function variables rather than identifiers of a fixed vocabulary.
An equation is a phrase of the form , where . The set Fm of formulas is generated inductively by
Every equation is a formula;
Fm is closed under the propositional operators ( and ).
If is a formula, then so are and ().
Given an -structure for a set of variables, a variable , and -ary -function , we write for the structure which is identical to , except that . Given a formula and a structure , where all variables free in are in the domain of , the truth of in , denoted , is defined by recurrence on formulas, as follows.
When we also say that verifies . Clearly, depends only on for variables occurring free in .
Recall from (1) that we identify a finite with its strict extension , so the quantifiers range over all strict -valued functions, which for the nullary case means that atomic variables may take any value in . This definition departs from Tarski’s semantics in that quantification ranges over all -functions, regardless of the scope of .
2.4 First-order formulas
We call quantification over atomic variables first-order, and quantification over functional variables second-order. A formula is first-order if all its quantifiers are first-order.
We use notation conventions for some important first-order formulas:
for . We overload this convention, and write to mean , where .
states that the atom denoted by is in the scope of . Thus
means that is true “within” , which is not the same as . For example, is true for all -structures, whereas is false for all -structures.
Let . The -structures that model the following formula are precisely the structures for the natural numbers, described in §2.2.444We disregard here the token
The following observation is a variant of a basic result of Finite Model Theory. We shall not use it in this paper.
Let be a first-order formula. The following problem is decidable in polynomial time (in the size of the input structure presentation). We assume that -structure are given as tables.
Given an A-structure , is true for .
Proof. The proof is by induction on .
Absent second-order quantifiers,
the only case of interest is when the main operator of is an atomic quantifier, say . The input’s format
provides direct scanning of all entries that are in the scope of ,
and the denotations of the A-functions all yield
for all other entries. From this the calculation of
the truth in of is immediate.
3 A theory of finite structures
3.1 On axiomatizing finiteness
Since our -structure are built of functions, we refer to a generative process that extends functions rather than sets ore relations. The set of -ary -functions is generated by:
The empty -ary function is in ;
If , , and , then extending with an entry yields an -function in .
From this inductive definition we obtain an Induction Schema for -functions. Using the abbreviations
Induction for a formula (with a distinguished function-variable ) reads
Since the components of -structures are -functions, without constraints that relate them, there is no need to articulate a separate induction principle for -structures. Indeed, every -structure for a vocabulary is obtained by first generating the entries of , then those for , and so on. Note that this would no longer be the case for an inductive definition of the class of accessible structures, whose components must be generated in tandem:555We shall discuss the class in detail elsewhere.
If is in , is in the scope of , , and ,
then extending with an entry yields a structure in .
3.2 The theory Fs
Our axiomatic theory FS for -functions has free and bound variables for atoms and free and bound variables for functions of arbitrary positive arity. We use as syntactic parameters for atomic variables, and as syntactic parameters for functional variables, optionally superscripted with their arity when convenient.
The axiom schemas are the universal closures of the following templates, for all arities , terms t, and formulas . For a function variable and variables we write for .
Note that this states that is infinite (unbounded), and has no bearing on the finiteness of -functions.
This schema combines Zermelo’s Separation Schema with an Explicit Definition principle: is defined by the term t, for arguments in the domain of .
[f-Induction] Recalling (6) above:
For each of the schemas [Empty-function], [Function-extension], and [Explicit-definition], the function asserted to exist is trivially unique, and so adding identifiers for these functions is conservative over FS. We write , and , respectively, for these functions (one for every arity ).
The relevant axiom-schemas above can be rephrased using these three constructs as primitives:
Also note the contra-positive form of f-Induction:
3.3 Some derived schemas
The proof is by f-Induction on and Extension.
This follows from Explicit-definition and Union.
The universal closure with respect to is proved by inductions on and , using Extension.
This is the dual of Extension. The proof of (refeq:contraction) is by induction on for the universal closure of (9) with respect to .
Much of the expressive and proof theoretic power of arithmetic is due to the representation of finite sequences and finite sets of numbers by numbers. The Function-pairing schema provides a representation of two -ary -functions by a single -ary -function. Namely, are “tagged” withing by the tags respectively. In other words, writing for , we have and . (We might require, in addition, that for all atoms , but this is inessential if we include explicitly in the representation.)
[Atomic-choice] A more interesting form of tagging is provided by the following principles of Choice.
This is analogous to [14, Lemma 2(e)], and is straightforward by induction on . Suppose the schema holds for , yielding the function . To show the schema true for suppose it satisfies the premise
where abbreviates Note that Atomic-choice is a special case of Function-choice, with nullary.
Note that the bounding condition in the choice schemas above is essential: even the simplest case
is false already for , since the identity function over is not finite.
4 Imperative programs over -structures
We define a variant of Gurevich’s abstract state machines (ASMs) [2, 6, 8], for the transformation of -structures. Transducer-programs define mappings between structures, which are akin to the mappings underlying Fraenkel’s Replacement Axiom, and more generally the proper classes of Bernays-Gödel set theory. Namely, these mappings are not -functions, and are referred to in the theory FS via the formulas that define them.
4.1 Structure revisions
Our structure transformation programming language, ST, is designed to be a Turing-complete computing system for the transformation of finite partial-structures, using the simplest possible building blocks while maintaining expressiveness. An ST-program takes an -structure as input, and successively applies basic structure revisions to it. The process may terminate with a final -structure when no further revision is called for. For example, addition over might be computed by a program that takes as input a structure representing two natural numbers and , and grafting the second on top of the first. Doubling a number might be performed by copying the input before grafting the copy over the input, or alternatively generating a new structure by repeatedly extending it with two atoms while depleting the input.
We start by defining the basic operations of ST, to handle entries. Each such operation maps a structure into a structure which is identical to with the exceptions noted.
An extension is a phrase where the ’s are standard terms and q is a term. The intent is that is identical to , except that if then .
An inception is a phrase of the form , where c is a token. A common alternative notation is . The intent is that is identical to , except that if , then is an atom not in the scope of . A more general form of inception, with a fresh atom assigned to a term t is obtained as the composition
where c is a reserved token.
We allow extensions and inceptions to refer to an identifier f not in the vocabulary of , in which case the vocabulary of extends that of , and we posit that .
A contraction, the dual of an extension, is a phrase of the form . The intent is that is identical to , except that .
A deletion, the dual of an inception, is a phrase of the form , where c is a token. The intent is that is obtained by removing . That is, is identical to , except that for all -functions present and all , if , then .
Note that a deletion cannot be obtained via the composition of contractions, because might be reached by -functions of from atoms that are not accessible, in which case the atom cannot be eliminated from the scope of by contractions alone.
We refer to extensions, contractions, inceptions and deletions as revisions. Extensions and inceptions are then constructive revisions, whereas contractions and deletions are the destructive revisions.
An extension and a contraction can be combined into an assignment, i.e. a phrase of the form . This can be viewed as an abbreviation, with a fresh token, for the composition of four revisions:
(Note that the atom denoted by q (when defined) is being memorized by , since q may become inaccessible due to the contraction .) Although assignments are common and useful, we prefer contractions and extensions as basic constructs, for two reasons. First, these constructs are truly elemental. More concretely, the distinction between constructive and destructive revisions plays a role in implicit characterizations of computational complexity classes, as for example in .
4.2 St programs
Our programming language ST for structure transformation consists of guarded iterative programs using revisions as basic operations. Define a guard to be a quantifier-free formula.666Taking for guards arbitrary first-order formulas would not make a difference anywhere. The programs of ST are generated inductively as follows.
A structure-revision is a program.
If and are programs and is a guard, then , and are programs.
For a program we define the binary yield relation between structures by recurrence on . For a revision the definition follows the intended semantics described informally above. The cases for composition, branching, and iteration, are straightforward as usual.
Let be a partial-mapping from a class of A-structures to a class of A-structures. A program computes if for every , for some expansion of . Note that the vocabulary of the output structure need not be related to the input vocabulary.
4.3 Turing completeness
Guarded iterative programs are well known to be sound and complete for Turing computability, and proofs of the Turing completeness of abstract state machines have been given before (see for example [7, §3.1]). To dispel any concern that those proofs need more than finite structures and our simple revision operations, we outline a proof here.
Let be a Turing transducer computing a partial-function . There is an ST-program that, for every , transforms to .
Proof. Suppose uses an extended alphabet , set of states , start state , print state , and transition function . Recall that for we write for the structure .
Define to be the vocabulary with , and each state in as tokens; and with and each symbol in as pointers. The intent is that a configuration (i.e. with cursored) be represented by the -structure
All remaining tokens are undefined.
We define the program to implement the following phases:
Convert the input structure into the structure for the initial configuration, and initialize to the initial input element. Use a loop to initialize a fresh pointer to be the destructor function for the input string, to be used for backwards movements of the cursor.
Main loop: configurations are revised as called for by . The loop’s guard is (the “print” state) being undefined.
Convert the final configuration into the output.
5 Computability implies existential definability
5.1 Expressing relation iteration
Suppose is a formula, with variable-vectors , both for the vocabulary . Define the relation as the least fixpoint of the closure conditions:
for all .
If and then .
For every formula there is a formula that defines the relation .
Proof. By definition, just in case there are () such that
The function-vectors can be bundled jointly into a single vector , using a vocabulary with a fresh variable for each in . We also refer to two fresh auxiliary variables and , and let the bundled vector be defined by
For a term t let abbreviate .
Example. Let be a vocabulary with identifiers of arity , and etc. be vectors of atomic variables. Take for the following formula (where and are construed as sets).
That is, is identical to except that it may contain additional atoms, all obtained by applying some to elements of . Then the existential formula
defines the set of -accessible atoms. Consequently,
is true for a -structure iff is -accessible.
5.2 Existential definability of computable relations between -structures
For every ST-program over -structures, there is an existential formula that holds iff .
Proof. By induction on .
If is a revision then is in fact first-order, and trivially defined.
If is , then by IH there are existential formulas and that hold just in case and . We thus define
which is existential if and are.
If is we define
which is existential if and are. Note that here is first-order, so the negation is harmless.
If is , let
Here is the existential formula defined in (14).
Theorem 5 defines a binary relation between the initial and final configurations of an ST-program. Given a convention on which program variables are to be considered inputs and which output, the formula can be modified to express the input-output relation computed by the program. For instance, if uses variables , of which and are used for the inputs, and and are used for the outputs, then the I/O relation defined by is
6 Equipollence of Fs and Pa
6.1 Interpretation of arithmetic formulas in finite structures
The intended model of FS has no “universe” in the traditional, Tarskian, sense. Using the structures as the target “elements” falls short of the natural embedding, where natural numbers are interpreted as equivalence classes of such structures. Note that we cannot take one representative from each equivalence class because there is no way to formally identify such representatives. Consequently, we depart from the traditional definition of interpretations between languages and between formal theories, (see e.g. [3, §2.7]), relax the requirement that the source universe be interpreted by a definable subset of the target universe, and interpret the natural numbers instead by equivalence classes of structures satisfying (as defined in (4)).
The representation of natural numbers by equivalence classes of structures can now be formalized as follows. Take PA to be based on logic without equality, that is with equality considered a binary relation identifier rather than a logical constant, which for PA happens to be interpreted as identity. The point is that our interpretation of PA in FS must now include a definition of the interpretation of equality, though not as the identity relation between the atoms of FS, but rather as structure isomorphism. The property of a unary function being an isomorphism between structures over the vocabulary can be defined by
Given that (as defined in (16)) is assumed true for and , and that must be strict, the condition above implies that the function must be a bijection. We now define the interpretation of the equality relation of PA as the relation
between structures representing natural numbers.
We interpret the remaining non-logical constants of PA, namely 0, successor, addition and multiplication, via basic equations for them. For each variable of PA let and be FS-variables. In any given context only finitely many -variables will be present, so the collection of all corresponding FS-variables will be finite as well. Every equation of PA is equivalent to a formula involving only equation of one of the following five forms:
We define the following interpretation for such equations.
where Iso is as in (16).
where is the existential formula defined by (15) for the ST-program computing addition,
( is defined similarly, referring to the ST-program for multiplication.
Combining the previous cases, we easily define (by discourse-level induction on terms) an interpretation for all terms t,q.
We let the mapping commute with the connectives: is , etc.
For the quantifiers we let
Let be the standard model of PA, with zero, successor, addition, and multiplication as functions.
The interpretation is semantically sound and complete: for every closed formula of PA, is true in iff is true for all -structures.
Proof. Consider the following fixed interpretation of the natural numbers as -structures. Let be an atom (to interpret 0), and an injective unary partial-function