On the Elementary Affine Lambda-Calculus with and Without Fixed Points
L\^e Th\`anh D\~ung Nguyen (LIPN, Universit\'e Paris 13)

TL;DR
This paper investigates the elementary affine lambda-calculus, demonstrating that removing type fixpoints limits its expressive power to regular languages, and proposes improvements for characterizing complexity classes with recursive types.
Contribution
It shows that without recursive types, the calculus characterizes regular languages, and introduces an aesthetic enhancement for representing FP and k-FEXPTIME with recursive types.
Findings
Without fixpoints, the calculus characterizes regular languages.
Semantic evaluation method proves the necessity of fixpoints for complexity classes.
Improved characterization of FP and k-FEXPTIME with recursive types.
Abstract
The elementary affine lambda-calculus was introduced as a polyvalent setting for implicit computational complexity, allowing for characterizations of polynomial time and hyperexponential time predicates. But these results rely on type fixpoints (a.k.a. recursive types), and it was unknown whether this feature of the type system was really necessary. We give a positive answer by showing that without type fixpoints, we get a characterization of regular languages instead of polynomial time. The proof uses the semantic evaluation method. We also propose an aesthetic improvement on the characterization of the function classes FP and k-FEXPTIME in the presence of recursive types.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
On the Elementary Affine Lambda-calculus
with and Without Type Fixpoints
Lê Thành Dũng Nguyễn Partially supported by the ANR project ELICA (ANR-14-CE25-0005).LIPN, UMR 7030 CNRS, Université Paris 13, France [email protected]
Abstract
The elementary affine -calculus was introduced as a polyvalent setting for implicit computational complexity, allowing for characterizations of polynomial time and hyperexponential time predicates. But these results rely on type fixpoints (a.k.a. recursive types), and it was unknown whether this feature of the type system was really necessary. We give a positive answer by showing that without type fixpoints, we get a characterization of regular languages instead of polynomial time. The proof uses the semantic evaluation method. We also propose an aesthetic improvement on the characterization of the function classes FP and -FEXPTIME in the presence of recursive types.
1 Introduction
The elementary affine -calculus
Elementary Linear Logic (ELL), introduced by Girard [10], is a logic that can be seen as a typed functional programming language through the proof-as-programs correspondence. Its typing rules ensure that a function can be expressed if and only if it is elementary recursive (as is expounded in detail in [7]), hence the name. (This is an instance of the “type-theoretic” or “Curry–Howard” approach to implicit computational complexity.) This was refined by Baillot [2] into a characterization of each level of the -EXPTIME hierarchy, in an affine variant of ELL.
A later improvement by Baillot, De Benedetti and Ronchi [3] consisted in turning this logic into an actual type system for a functional calculus with good properties (e.g. subject reduction), called the elementary affine -calculus. In this paper, we shall call their system – the reason for the will soon become clear. The main result about it is:
Theorem 1.1** ([3]).**
The programs of type in decide exactly the languages in the class -EXPTIME. In particular corresponds to polynomial time (P) predicates.
Here are some indications for the reader unfamiliar with linear or affine type systems:
- •
a program of type uses its input of type at most once to produce its output of type ;
- •
means roughly “as many ’s as you want”, so a function which uses its argument multiple times can be given a type of the form ;
- •
in usual linear or affine logic, one can convert a into a ; however, in the elementary affine -calculus, there is a restriction which makes the exponential depth (number of ‘’ modalities) meaningful, one cannot perform such a depth-changing operation – this is why the depth of the output (i.e. with ‘’) controls the complexity;
- •
the type of booleans is defined as , and it has two inhabitants;
- •
, with , is the type of Church encodings of binary strings: the string is represented as the function which, for any type , takes as input and , and returns .
Type fixpoints and Scott encodings
We wish to draw attention to a particular feature of this language: the presence of type fixpoints111A remark for the readers acquainted with typed -calculi: there is no “positivity” constraint imposed, yet those recursive types are harmless for the normalization property, as the untyped version of the elementary affine -calculus is already normalizing. The analogous property for ELL was already remarked in [10]., a.k.a. recursive types. An example is the type of Scott binary strings:
[TABLE]
In the elementary affine -calculus as defined in [3], this recursive equation can be turned into a valid type definition, by using a fixed point operator on types (this explains our name ):
[TABLE]
The idea is that strings are represented by their “pattern-matching” function (destructor): if is a Scott binary string, then morally means “if represents the empty word, return ; else, return applied to where is the first letter and represents the suffix”. Formally, we associate to each string a -term of type :
[TABLE]
This encoding of strings has been used to give a characterization of function classes in :
Theorem 1.2** ([3]).**
The programs of type in compute exactly the functions in the class -FEXPTIME. In particular corresponds to FP.
Our contributions
There are two natural questions concerning the necessity of type fixpoints:
- •
In the interface: it is possible to characterize this hierarchy of function classes using a function type involving only Church encodings?
- •
In the implementation: the extensional completeness proof for the predicate classes (Theorem 1.1) makes use of the type (to represent configurations of Turing machines), even though this type does not appear in the statement; could one avoid recursive types in the proof? This question has been raised by Baillot in the conclusion of [2].
In this paper, we answer both questions. The first one has a positive answer:
Theorem 1.3**.**
The programs of type in compute exactly the functions in the class -FEXPTIME. In particular corresponds to FP.
An advantage of this characterization is that it reflects the fact that composing a -FEXPTIME function with a -FEXPTIME function gives a -FEXPTIME function: since any -term of type lifts to a term of type (this is called “functorial promotion”, cf. Proposition 2.2), we can compose the terms and to obtain a term of type . In particular FP is closed under composition. A characterization of FP in by a function type whose input and output types coincide was proposed in [3], but it is less natural: a string is represented as a pair of its length (Church-encoded) and its contents (Scott-encoded).
As for the second question, we should first mention that Girard’s original characterization of elementary recursive functions in ELL does not involve type fixpoints. This can be replayed in the elementary affine -calculus without type fixpoints, which we shall denote by .
Theorem 1.4** ([2]).**
The class of elementary recursive functions is the union, over , of the classes of functions computed by programs of type in .
(The detailed proof given in [2] is for Elementary Affine Logic; it can be directly transposed to .)
However, the characterization of P by fails in , as we show:
Theorem 1.5**.**
The programs of type in decide exactly the regular languages. This is also the case for the -terms of type .
This result is surprising for a few reasons: the class of languages obtained is unexpectedly small, and it hints at connections between and formal language theory (the conclusion will discuss this further). The proof techniques for the above theorem are quite different from those used in [3]: instead of bounding the syntactic normalization process, we take inspiration from the tradition of implicit complexity in the simply typed -calculus (), in particular from:
Theorem 1.6** (Hillebrand & Kanellakis [15]).**
In the simply typed -calculus, the languages decided by terms of type – is a simple type that may be chosen depending on the language – are exactly the regular languages.
Here and , where is a base type. This is proved using the semantic evaluation method (see [20] and references therein). To make this method work in our case, we need a new result in denotational semantics:
Lemma 1.7**.**
The second-order affine -calculus – i.e. the subsystem of without the exponential modality ‘’ – admits a non-trivial finite semantics.
By “non-trivial” we mean distinguishing the two inhabitants of . The term “second-order” refers to the (impredicative) polymorphism supported by both and – indeed, the types , and all contain second-order quantifiers (). The lemma means morally that one cannot represent infinite data types in without using the exponential modality – whereas in , the exponential-free type encodes the infinite set .
Thus, motivated by this question in implicit complexity, we set out to establish the above lemma, and came up with two approaches:
- •
a “category-theoretic” solution consists in showing the finiteness of a pre-existing model based on coherence spaces and normal functors; this is the subject of another paper [16];
- •
a “syntactic” solution, developed in a joint work with P. Pistone, T. Seiller and L. Tortora de Falco, relies on a careful combinatorial study of second-order proof nets; it will be written up in an upcoming paper.
The further development of these semantic tools has led to more results on and/or on Elementary Linear Logic without type fixpoints, which are beyond the scope of the present paper. This includes an already published joint work with P. Pradic [17] on logarithmic space.
Plan of the paper
We recall from [3] the definitions of and in Section 2, and then quickly prove Theorem 1.3 in Section 3. The bulk of the paper is Section 4, dedicated to proving Theorem 1.5. The conclusion (Section 5) discusses the above-mentioned new perspectives on opened up by our results and by refinements of Lemma 1.7.
Acknowledgments
This work owes a great deal to Thomas Seiller’s supervision. Thanks also to Patrick Baillot, Alexis Ghyselen, Damiano Mazza (an extremely fruitful discussion with Thomas and him triggered this work) and Pierre Pradic.
2 The elementary affine -calculus
The syntax of elementary affine -terms and the reduction rules are given by
[TABLE]
where is taken in a countable set of variables, and refers to the substitution of all free occurrences of in by . The reduction rules and are actually the contextual closure of the rules given above, for the obvious notion of context (see [3] for details).
We shall also write for (this is just some “syntactic sugar”). The notion of depth of a subterm in a term, defined as the number of exponential modalities (“exponentials” for short) surrounding the subterm, will play an important role.
As an example, let us formally define the Church-encoded binary strings:
[TABLE]
The above is essentially Simpson’s linear -calculus with thunks [19]. (Other examples of linear -calculi with explicit exponentials are given in [13].) We shall now turn this untyped calculus into by endowing it with its type system – an adaptation of Coppola et al.’s Elementary Type Assignment System [8]. The grammar of types for is
[TABLE]
The two first classes of types are called respectively linear and strictly linear. (We follow the terminology of [3]; “linear” does not mean exponential-free, it merely means that the head connective is not an exponential.) The reason for restricting quantification to strictly linear types is a technical subtlety related to subject reduction (see [8, §7.2]).
The typing judgements involve a context split into three parts: they are of the form . The idea is that the partial assignements , and of variables to types correspond respectively to linear, non-linear and “temporary” variables; accordingly, maps variables to linear types (denoted above), maps variables to types of the form , while maps variables to arbitrary types. The domains of , and are required to be pairwise disjoint. The derivation rules for are:
[TABLE]
[TABLE]
[TABLE]
[TABLE]
[TABLE]
In these rules, following the conventions established above, stands for a linear type, stands for a strictly linear type and and stand for arbitrary types. In particular, in the quantifier elimination rule, can only be instantiated by a linear type. So, for instance, one cannot give the type to through a quantifier introduction followed by a quantifier elimination; indeed, as one would expect, the only normal term of this type is . (Despite this, the polymorphism is still impredicative.)
Coming back to the example of Church binary strings, one can show by induction that
[TABLE]
and deduce from this that (recall that ).
The system is obtained by extending the grammar of types with , and adding new derivation rules for the type fixpoint operator :
[TABLE]
Let us recall two basic properties satisfied both by and , all proved in [3].
Proposition 2.1** (Stratification and linearity [3, Lemma 27]).**
Let be a typable term.
- •
for any subterm of the form of , all the occurrences of must be at depth 1 in ;
- •
for any subterm of , there is at most one occurrence of in , whose depth must be 0 in .
As a consequence, the reduction rules are depth-preserving.
Proposition 2.2** **(-fold functorial promotion
[3, Proposition 28]).
Let is a closed elementary affine -term and . There is a term such that and have the same normal form for all closed terms ().
3 The -FEXPTIME hierarchy in (proof of
Theorem 1.3)
First, the soundness part of Theorem 1.3 follows immediately from Theorem 1.2.
Proposition 3.1**.**
All functions represented by -terms of type are in -FEXPTIME.
Proof.
There exists a coercion (by completeness part of Theorem 1.2 applied to the identity function in FP) which lifts by functorial promotion (Proposition 2.2) to . So any function represented by a term of type is also represented by a term of type . Thus the soundness part of Theorem 1.2 applies. ∎
For the extensional completeness, we also take Theorem 1.2 as our starting point. The idea is to convert into with the help of an auxiliary integer which provides an upper bound on the length of the string. (Similar ideas appear in [4].)
We shall use the type of Church natural numbers and the usual second-order encoding of pairs:
[TABLE]
The aforementioned upper bound will be an inhabitant of the type . An integer is represented in by the iterator (formally, with times ).
To help readability we extend the syntax with the abbreviation
- •
so that if and
given in [3], and introduce some additional syntactic sugar:
- •
for , and
- •
for
The affine projections () are also defined in [3].
Remark 3.2**.**
Our definition of is much simpler that the one given in [3], but the drawback is that it only works when the type of is linear, i.e. its head connective is not an exponential. Indeed, can be instantiated to by the quantifier elimination rule only when is linear. This condition will hold in our use cases below.
Now that we are equipped with all these data types, we can make progress on our proof.
Lemma 3.3**.**
There exists a -term which converts a Scott encoding into a Church encoding, provided that the integer argument is greater or equal to the length of the string.
Proof.
Our implementation of instantiates the input on where is the eigenvariable of the in the output (recall that refers to the Scott encoding of the empty word):
[TABLE]
[TABLE]
To explain this functional program, let us reformulate it as an imperative algorithm: can be considered as the body of a for loop which alters two mutable variables and . At each iteration, if is non-empty, its first letter is popped (viewing as a mutable stack) and is post-composed with either or depending on this letter.
After iterations starting from and , if is the Scott encoding of , the result obtained is where . In particular, if , the first component will be – which corresponds to the definition of the Church encoding. ∎
To obtain the desired upper bound, we recall a lemma from [3]. It is used in the proof of Theorem 1.2 in order to simulate Turing machines.
Lemma 3.4** ([3]).**
Let be a -FEXPTIME Turing machine. There is a -term computing an upper bound on the running time of on the given input string.
We now have all the ingredients for the extensional completeness proof.
Theorem 3.5**.**
All -FEXPTIME functions can be represented by -terms of type .
Proof.
Consider any function computed by a -FEXPTIME Turing machine . By the completeness part of Theorem 1.2, we can choose a -term computing this function. We also choose a term satisfying the conditions of the above lemma. Then the term
[TABLE]
– where is the -fold functorial promotion of – computes the same function as . Indeed, the assumption of Lemma 3.3 is satisfied, since for a Turing machine, the length of the output is bounded by the running time. ∎
4 Regular languages in (proof of Theorem 1.5)
In this section, we wish to show that, in (without fixpoints):
- •
all terms decide regular languages;
- •
moreover, all regular languages can be decided by terms .
By functorial promotion, the class of languages characterized by is included in the class corresponding to , so this will entail that both are exactly the class of regular languages. The situation is the opposite of the previous section: the second item (extensional completeness) is easy, while the first (soundness) is hard.
Regular languages admit many well-known equivalent definitions, e.g. regular expressions and finite automata (with many variants: non-determinism, bidirectionality, etc.). The classic characterization which will prove useful for us is:
Theorem 4.1**.**
A language is regular if and only if it can be expressed as , where is a monoid morphism, is a finite monoid and .
4.1 Extensional completeness
Proposition 4.2**.**
All regular languages can be decided by -terms of type .
Proof.
Let be a morphism to a finite monoid . Without loss of generality, we may assume that the underlying set of is , and the identity element of the monoid is . We represent the monoid elements in as inhabitants of the type ; the element is mapped to the term . We define:
- •
for
- •
for , where (resp. ) if (resp. ).
Then the language is decided by the term . ∎
Next, to prepare the ground for our proof of soundness in , we review our direct inspiration in the simply typed -calculus: the proof of one direction of Theorem 1.6. The goal is to show that any simply typed -term , where is an arbitrary simple type, decides a language which is regular. This was done using automata in [15], but we find it simpler to work with monoid morphisms (though this is, in the end, merely a different presentation of the same proof).
4.2 A short soundness proof for Hillebrand and Kanellakis’s theorem
(sketch)
We shall omit the subscripts in the types and in this subsection.
Let us fix a simple type . The fundamental idea is that, given any denotational semantics \left\llbracket-\right\rrbracket:
- •
the denotation \left\llbracket\overline{w}\right\rrbracket\in\left\llbracket\mathtt{Str}[A]\right\rrbracket of the encoding of is enough to determine \left\llbracket t\,\overline{w}\right\rrbracket\in\left\llbracket\mathtt{Bool}\right\rrbracket – this is simply the compositionality of the semantics;
- •
provided the semantics is non-trivial, i.e. \left\llbracket\mathtt{true}\right\rrbracket\neq\left\llbracket\mathtt{false}\right\rrbracket, this subsequently determines .
Formally, let us define \varphi_{\_}A:\{0,1\}^{*}\to\left\llbracket\mathtt{Str}[A]\right\rrbracket by \varphi_{\_}A(w)=\left\llbracket\overline{w}\right\rrbracket; then if \left\llbracket-\right\rrbracket is non-trivial,
[TABLE]
To show that is regular, we shall apply Theorem 4.1 to this equation. We must make sure that:
- •
\left\llbracket\mathtt{Str}[A]\right\rrbracket can be endowed with a monoid structure, in such a way that is a monoid morphism – this is caused by the use of Church encodings;
- •
\left\llbracket\mathtt{Str}[A]\right\rrbracket is finite – thanks to the existence of a finite semantics for the simply typed -calculus.
Our choice of semantics, to satisfy both conditions, is the usual interpretation of types by mere sets (called the “full type frame” in [15]): \left\llbracket A\to B\right\rrbracket=\left\llbracket B\right\rrbracket^{\left\llbracket A\right\rrbracket}, with \left\llbracket o\right\rrbracket=\{0,1\} for the base type. Any choice for \left\llbracket o\right\rrbracket with at least two elements makes the semantics non-trivial. Furthermore, since \left\llbracket o\right\rrbracket is finite, the denotations of all types are also finite.
Finally, in order to define a monoid structure on \left\llbracket\mathtt{Str}[A]\right\rrbracket, observe that
[TABLE]
where \mathrm{End}(\left\llbracket A\right\rrbracket) is the monoid of maps from \left\llbracket A\right\rrbracket to itself, endowed with function composition. Thus, the right-hand side can be seen as a product of monoids. Proving that is a morphism can then be done componentwise; the condition to be checked can be expressed as:
[TABLE]
By definition, (where ) so
[TABLE]
therefore is none other than the product, over all (f_{\_}0,f_{\_}1)\in\mathrm{End}(\left\llbracket A\right\rrbracket)^{2}, of the monoid morphisms \{0,1\}^{*}\to\mathrm{End}(\left\llbracket A\right\rrbracket) defined by for .
Remark 4.3**.**
This reasoning can be made to work with any finite semantics of , not just sets. An interesting choice is the “linearized Scott model”444This model is obtained from a semantics of linear logic as its exponential co-Kleisli category, i.e. via the translation . The resulting category embeds fully and faithfully into the usual category of Scott domains and continuous functions, hence the name. See [20] for a short self-contained definition.: as remarked by Terui [20], in that semantics, the points in the denotation of a Church-encoded word correspond to nondeterministic finite automata accepting that word. This idea is also at the heart of Grellois and Melliès’s semantic approach to higher-order model checking [12, 11].
4.3 Soundness for regular languages in
Our goal is now to emulate the above proof to show that the -terms of type decide regular languages. (The result for then follows by functorial promotion.) While the core of the semantic evaluation argument is similar, we need to do some syntactic analysis first before coming to this point.
4.3.1 Some lemmas and a truncation operation
Our proof relies on some general properties of . The two following ones were established in [3].
Proposition 4.4** **(Reading property for booleans
[3, Lemma 31(i)]).
The only closed inhabitants of the type are and . ( and )
Proposition 4.5** (-inversion [3, Lemma 29(i)]).**
If , then for some term .
We will also make use of a truncation operation on -terms. (To our knowledge, it has not appeared previously in the literature.) Its purpose is to erase all exponentials. This will be how the stratification property of (cf. Proposition 2.1) comes into play.
Definition 4.6**.**
The truncation at depth 0 is defined inductively on terms as:
[TABLE]
and on types as (using the abbreviation555This is justified as is the unit to the tensor product used in Section 3. ):
[TABLE]
Proposition 4.7**.**
If a typing judgment is derivable in , then, writing for if , the judgment is derivable. In particular, if is a closed term, then .
Proof.
By a mostly straightforward induction on the type derivation. Even so, let us treat a case involving a small subtlety: when the derivation ends with a quantifier elimination. In that case, the induction hypothesis gives us the typing judgment , and from this we must derive . What the same instantiation rule can give us from our premise is . One is therefore led to hope that . Indeed, this can be checked by distinguishing, for each occurrence of in , two possible cases: either it is at depth 0 and remains in , or at depth and is erased in . ∎
Remark 4.8**.**
The above proof is the reason why we do not generalize here our truncation operation to a “truncation at depth ” for , which would erase all exponentials of depth . Indeed, a typical example for which the above reasoning would fail is the truncation at depth 1 of instantiated with . So these higher depths truncations would need additional conditions to be well-behaved.
Proposition 4.9**.**
For all and all -terms , if , then (this also applies to untyped terms which satisfy the stratification property, i.e. the conclusions of Proposition 2.1).
Proof.
If the redex contracted in to obtain is at depth , then one can prove that .
Otherwise, by induction on the context of the redex, one can restrict to the case where and the application of to is the contracted redex. We proceed by case analysis:
- •
If , then . We use the fact that appears only at depth zero in (Proposition 2.1) to show that . The latter is a reduct of .
- •
If , then and . Moreover, appears only at depth 1 in (again by Proposition 2.1). Therefore, does not contain as a free variable; thus, is a reduct of .∎
A final general observation (unrelated to truncation) before delving into the soundness proof itself:
Proposition 4.10**.**
Let be a term a free variable . Suppose that , where each appears only once in (so is the number of occurrences of in ), and , where is linear (i.e. not of the form ). Then . We write for this situation. (Such a always exists given .)
Proof.
By induction on typing derivations, replacing each rule of the form by a rule of the form for some . ∎
4.3.2 Syntactic analysis
We can now start looking at the languages decided by -terms.
Lemma 4.11**.**
For any -term , there exists (for some ) such that, for all , and have the same normal form.
Proof.
First, one may take to be in normal form. In that case, the only possible redex in is the application at the root. Moreover, must be reducible since it is neither nor , cf. Proposition 4.4. Therefore, (the case can be excluded because then would be of type where is linear, in particular ).
The next step is to prove that for some -term . According to the typing rules, the judgment can only be proven by first establishing . According to the -inversion property (Proposition 4.5), since the first and third part of the typing context are empty and the head connective of the type is ‘’, must be of the form .
Finally, since must hold (it is the only premise which can lead to the above judgement on ), we can apply Proposition 4.10 to (indeed, the type is linear). Then, the term (where occurs times in ) enjoys the property claimed in the lemma statement. ∎
Let us focus on the case for a moment, and do the same kind of analysis again.
Lemma 4.12**.**
Let be an -term, and let .
There exist -terms , and (with times , for some ) such that for all , if , then and have the same normal form.
Proof.
We assume that is in normal form. Since the head connective of is not ‘’, and . We may assume that contains as a free variable; otherwise, is a constant function and the conclusion we want holds trivially (take ).
Let us examine in general the shape of in normal form (where is not necessarily ) such that appears free in and . By [3, Lemma 29(ii)], must be an application: where is not an application and . Observe that cannot be of the form , since would then be a redex. There are two possible cases:
- •
, and then , and the closed -terms must be of the form by -inversion (Proposition 4.5)
- •
, in which case must appear free in . Indeed, suppose for the sake of contradiction that is closed; then for some , therefore -inversion gives us for some , so would be a redex.
In the second case, we may furthermore take w.l.o.g.: if , then for all , the term has the same normal form as (this is analogous to Regnier’s -equivalence by redex permutations [18]). And since , the normal form of is of the form (this is again an application of -inversion).
To recapitulate, either or where appears free in , but not in . In the latter case, we have . So, by induction on the size of terms,
[TABLE]
As a consequence, for all , if (recall that are closed) then
[TABLE]
(Morally, we are still trying to permute redexes; the reader may check that there is an analogy between the above operation and Carraro and Guerrieri’s rule [5] for the call-by-value -calculus.)
Let , where is a fresh variable, so that the right-hand side can be written as . Since is a closed subterm of (we are using subject reduction here), then it must be true that . Let us now apply Proposition 4.10, using the fact that is linear: for some , .
Finally, we take . The lemma statement holds with the , , and that we have constructed. ∎
The last purely syntactic step is to use the truncation operation to formulate a variation of the above lemma. The point is to be able to decide the membership in the language defined by an -term by computing purely in . This sets the stage for the use of a semantics of .
Lemma 4.13**.**
Let be an -term, and let .
There exist -terms , and (with times , for some ) such that for all , if , then and have the same normal form.
(Recall that is the Church encoding of in .)
Proof.
Thanks to the previous lemma, there exist , and with times , for some , such that the conclusion holds by replacing by and by . The only issue is that might not be in . The idea is therefore to take , and , and to check that this works.
Let be such that . Since ,
[TABLE]
So if is such that , then by confluence [3, Lemma 8], and have the same normal form. Therefore, and have the same normal form. But the latter is none other than .
To conclude, observe that:
- •
the normal form of is the same as that of by the previous lemma;
- •
by Proposition 4.4, the normal form of is some ;
- •
since , has the same normal form as .
By the discussion above, this means that and have the same normal form, as desired. ∎
4.3.3 Semantic evaluation
We are now ready to conclude our proof of soundness by adapting Hillebrand and Kanellakis’s argument. Let \left\llbracket-\right\rrbracket be any non-trivial finite semantics of – the notion of finiteness we need is that \left\llbracket A\right\rrbracket has finitely semantic inhabitants for all types . (Equivalently, if our semantics is a category with a terminal object , we require \mathrm{Hom}(1,\left\llbracket A\right\rrbracket) to be finite for all .) Recall that although such a semantics is a central ingredient in our proof, we have simply assumed its existence, which is proved elsewhere (see Lemma 1.7 and the subsequent discussion).
Definition 4.14**.**
Let be a type. We define for and (\gamma_{\_}0,\gamma_{\_}1)\in\mathrm{End}(\left\llbracket A\right\rrbracket)^{2}. In other words, \Phi_{\_}{A}:\{0,1\}^{*}\to\mathrm{End}(\left\llbracket A\right\rrbracket)^{\mathrm{End}(\left\llbracket A\right\rrbracket)^{2}} is the monoid morphism sending to .
Here \mathrm{End}(\left\llbracket A\right\rrbracket) refers to the monoid of endomorphisms of \left\llbracket A\right\rrbracket in the semantics.
Proposition 4.15**.**
Let and be its encoding. For any type and -terms , normalizes into some with , and \Phi_{A}(w)(\left\llbracket f_{\_}0\right\rrbracket,\left\llbracket f_{\_}1\right\rrbracket)=\left\llbracket g\right\rrbracket.
Proof.
As in the case of the simply typed -calculus, this is by definition of the Church encoding. ∎
Lemma 4.16**.**
Let .
For all , the normal form of is completely determined by the functions . As a consequence, the following language is regular:
[TABLE]
Proof.
We start with the case , in which . Let , and be given by Lemma 4.13, where . For all , if , then for some such that . Since , and are in , so is (provided it is normal), and \left\llbracket g\,h\,\ldots\,h\right\rrbracket=\left\llbracket g\right\rrbracket(\left\llbracket h\right\rrbracket,\ldots,\left\llbracket h\right\rrbracket) by compositionality. Therefore
[TABLE]
thanks to the previous proposition. Since our semantics is non-trivial, i.e. \left\llbracket b\right\rrbracket=\left\llbracket\mathtt{true}\right\rrbracket\iff b=\mathtt{true}, thus determines the normal form of .
The result for arbitrary is obtained by induction on by repeatedly applying the case .
The consequence is that the language can be written using only conditions on (), so it is the preimage of some subset of \prod_{\_}{i=1}^{n}\mathrm{End}(\left\llbracket\sigma_{\_}i\right\rrbracket)^{\mathrm{End}(\left\llbracket\sigma_{\_}i\right\rrbracket)^{2}} by the monoid morphism . ∎
This suffices to conclude the soundness proof. Let . Then, by Lemma 4.11,
[TABLE]
for some . The regularity of this language then follows from the above lemma.
4.4 Overcoming the expressivity barrier
Analyzing the our soundness proof for regular languages in reveals that fundamentally, what restricts the computational power is a conjunction of two facts:
the input is instantiated on some types known in advance; 2. 2.
these are morally finite data types, since they admit finite semantics.
This makes it impossible to iterate over, say, the configurations of a Turing machine, since their size depends on the input and the type cannot “grow” to accomodate data of variable size.
If we stay at depth 2 in , there is no way of avoiding the second fact (one can always truncate the to exponential-free types), so if we want to retrieve a larger complexity class than regular languages without resorting to type fixpoints, we should try to circumvent the first obstacle. That means that the should vary with the input. Thus, we are led to consider that inputs should provide types:
- •
the encoding of an input would be a term , for some type with one parameter;
- •
this would then be given as argument to a program of type .
In other words, we are considering existential input types. Indeed, if we were to extend with existential quantifiers666The reason this extension is not incorporated is that existentials can be encoded: ., there would be an isomorphism .
Remark 4.17**.**
In fact there is a third fact which plays a role in bridling the complexity: the shape of the type which codes sequential iterations (but the same could be said of Church encodings of free algebras – with such inputs one characterizes regular tree languages).
For instance, let us consider as inputs circuits represented by the type
[TABLE]
where corresponds to constants, corresponds to gates, and corresponds to duplication gates used to represent fan-out. Then instantiating this with and the obvious evaluation maps gives us an encoding of the circuit value problem, which is P-complete.
Although this input type seems morally less legitimate than Church encodings, it is hard to pinpoint precisely why it should be rejected.
5 Conclusion
This paper started with a positive result: there exists a characterization of FP and -FEXPTIME in whose statement is very simple. However, the characterization of regular languages in , which takes up the rest of the paper, could be seen as a negative result: it demonstrates the lack of expressivity of without type fixpoints. (This is the spirit of Section 4.4.) Indeed, the small class of regular languages not quite a well-behaved complexity class, e.g. it is not closed under reductions.
That said, one can also read Theorem 1.5 as positive evidence of a connection between affine typing and automata. This connection clearly depends on the use of Church encodings – in other words, on the representation of strings by their iterators. This opens up two avenues for investigation:
- •
One can search for other automata-theoretic classes of interest that can be characterized in .
- •
On the other hand, one can hope to obtain a well-behaved sub-polynomial complexity class by changing the representation of inputs, following the suggestions of Section 4.4.
We are currently working on the first research direction, by attempting to capture classes of transductions, i.e. of functions computed by automata with output. As of the time of writing, it seems likely that in , captures the well-known class of regular functions (see [9] for an overview of classical transduction classes, including regular functions), and that the class defined by also admits an automata-theoretic characterization.
As for the second one, it is the topic of a sequel777This sequel has been published first, although the results in the present paper were mostly obtained before. paper [17] (joint work with P. Pradic) which studies an input type inspired by finite model theory, following Hillebrand’s thesis [14]. We obtain what we believe to be a characterization of deterministic logarithmic space (L), and manage to prove that the class we capture is between L and NL888Actually, a more precise upper bound is L with an oracle for unambiguous non-deterministic logarithmic space..
The importance of semantics
A novelty in our approach is that we betray the original spirit of “light logics” such as Light Linear Logic and Elementary Linear Logic [10], which consisted in bounding the complexity of normalization “geometrically”, independently of types. Here:
- •
geometry still plays an important structuring role, reflected by our use of a “truncation at depth zero” operation, which may be of independent interest;
- •
but our fine-grained analysis also requires to take into account the influence of types through semantics.
Though we are not the first to apply semantics to obtain inexpressivity results in light logics (cf. e.g. [6]), our recent discovery of a finite semantics of linear polymorphism (cf. the discussion below the statement of Lemma 1.7) opens up new possibilities. The above-mentioned sequel on logarithmic space is an illustration of this new way of working in and its variants: the best upper bound that we have is obtained using the effectiveness of the second-order coherence space model studied in [16].
Open questions
Aside from the perspectives already mentioned, there is an obvious question that remains after Theorem 1.5: what about (resp. ) for ? For now, what we know about the corresponding complexity class is that:
- •
it is contained in -EXPTIME (resp. -FEXPTIME), since the soundness results for apply a fortiori to ;
- •
it contains -EXPTIME (resp. -FEXPTIME), by adapting the proofs given in [2].
We must confess that we have no idea about what class corresponds to, let alone about a proof strategy. Our only guesses is that the first containment is strict, and that semantics can prove useful for this problem.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1]
- 2[2] Patrick Baillot (2015): On the expressivity of elementary linear logic: Characterizing Ptime and an exponential time hierarchy . Information and Computation 241, pp. 3–31, 10.1016/j.ic.2014.10.005 . · doi ↗
- 3[3] Patrick Baillot, Erika De Benedetti & Simona Ronchi Della Rocca (2018): Characterizing polynomial and exponential complexity classes in elementary lambda-calculus . Information and Computation 261, pp. 55–77, 10.1016/j.ic.2018.05.005 . · doi ↗
- 4[4] Patrick Baillot & Alexis Ghyselen (2018): Combining Linear Logic and Size Types for Implicit Complexity . In: 27th EACSL Annual Conference on Computer Science Logic (CSL 2018) , pp. 9:1–9:21, 10.4230/LIP Ics.CSL.2018.9 . · doi ↗
- 5[5] Alberto Carraro & Giulio Guerrieri (2014): A Semantical and Operational Account of Call-by-Value Solvability . In: Foundations of Software Science and Computation Structures (Fo S Sa CS’14) , pp. 103–118, 10.1007/978-3-642-54830-77 . · doi ↗
- 6[6] Ugo Dal Lago & Patrick Baillot (2006): On light logics, uniform encodings and polynomial time . Mathematical Structures in Computer Science 16(4), pp. 713–733, 10.1017/S 0960129506005421 . · doi ↗
- 7[7] Vincent Danos & Jean-Baptiste Joinet (2003): Linear logic and elementary time . Information and Computation 183(1), pp. 123–137, 10.1016/S 0890-5401(03)00010-5 . · doi ↗
- 8[8] Simona Ronchi Della Rocca, Ugo Dal Lago & Paolo Coppola (2008): Light Logics and the Call-by-Value Lambda Calculus . Logical Methods in Computer Science Volume 4, Issue 4, 10.2168/LMCS-4(4:5)2008 . · doi ↗
