The Yoneda Reduction of Polymorphic Types (Extended Version)
Paolo Pistone, Luca Tranchini

TL;DR
This paper investigates Yoneda-inspired type isomorphisms in System F, enabling quantifier elimination through a process called Yoneda reduction, with applications in counting inhabitants and program equivalence.
Contribution
It introduces Yoneda reduction as a novel type rewriting technique that eliminates quantifiers in polymorphic types, extending the understanding of type isomorphisms in System F.
Findings
Yoneda reduction can eliminate quantifiers from polymorphic types.
Conditions for full quantifier elimination are established.
Applications include counting inhabitants and checking program equivalence.
Abstract
In this paper we explore a family of type isomorphisms in System F whose validity corresponds, semantically, to some form of the Yoneda isomorphism from category theory. These isomorphisms hold under theories of equivalence stronger than beta-eta-equivalence, like those induced by parametricity and dinaturality. We show that the Yoneda type isomorphisms yield a rewriting over types, that we call Yoneda reduction, which can be used to eliminate quantifiers from a polymorphic type, replacing them with a combination of monomorphic type constructors. We establish some sufficient conditions under which quantifiers can be fully eliminated from a polymorphic type, and we show some application of these conditions to count the inhabitants of a type and to compute program equivalence in some fragments of System F.
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.
The Yoneda Reduction of Polymorphic Types
(extended version)
Paolo Pistone
DISI, Università di Bologna,
Mura Anteo Zamboni,7, 40126, Bologna (Italy)
Luca Tranchini
Wilhelm-Schickard-Institut, Universität Tübingen,
Sand 13, D-72076, Tübingen (Germany)
\url [email protected]
Abstract
In this paper we explore a family of type isomorphisms in System F whose validity corresponds, semantically, to some form of the Yoneda isomorphism from category theory. These isomorphisms hold under theories of equivalence stronger than -equivalence, like those induced by parametricity and dinaturality. We show that the Yoneda type isomorphisms yield a rewriting over types, that we call Yoneda reduction, which can be used to eliminate quantifiers from a polymorphic type, replacing them with a combination of monomorphic type constructors. We establish some sufficient conditions under which quantifiers can be fully eliminated from a polymorphic type, and we show some application of these conditions to count the inhabitants of a type and to compute program equivalence in some fragments of System F.
Contents
-
1.2 Program Equivalence in System F with Finite Characteristic
-
5 Yoneda Reduction and the Characteristic of a Polymorphic Type
1 Introduction
The study of type isomorphisms is a fundamental one both in the theory of programming languages and in logic, through the well-known proofs-as-programs correspondence: type isomorphisms supply programmers with transformations allowing them to obtain simpler and more optimized code, and offer new insights to understand and refine the syntax of type- and proof-systems.
Roughly speaking, two types are isomorphic when one can transform any call by a program to an object of type into a call to an object of type , without altering the behavior of the program. Thus, type isomorphisms are tightly related to theories of program equivalence, which describe what counts as the observable behavior of a program, so that programs with the same behavior can be considered equivalent.
The connection between type isomorphisms and program equivalence is of special importance for polymorphic type systems like System F (hereafter ). In fact, while standard -equivalence for and the related isomorphisms are well-understood [12, 14], stronger notions of equivalence (as those based on parametricity or free theorems [43, 22, 1]) are often more useful in practice but are generally intractable or difficult to compute, and little is known about the type isomorphisms holding under such theories.
A cornerstone result of category theory, the Yoneda lemma, is sometimes invoked [7, 19, 9, 41, 20] to justify some type isomorphisms in like e.g.
[TABLE]
which do not hold under -equivalence, but only under stronger equivalences. Such isomorphisms are usually justified by reference to the interpretation of polymorphic programs as (di)natural transformations [7], a well-known semantics of related to both parametricity [32] and free-theorems [42], and yielding a not yet well-understood equational theory over the programs of [18, 13, 28], that we call here the -theory. Other isomorphisms, like those in Fig. 1, can be justified in a similar way as soon as the language of is enriched with other type constructors like and least/greatest fixpoints .
All such type isomorphisms have the effect of eliminating a quantifier, replacing it with a combination of monomorphic type constructors, and can be used to test if a polymorphic type has a finite number of inhabitants (as illustrated in Fig. 2) or, as suggested in [9], to devise decidable tests for program equivalence.
In this paper we develop a formal study of the elimination of quantifiers from polymorphic types using a class of type isomorphisms, that we will call Yoneda type isomorphisms, which generalize the examples above. Then, we explore the application of such type isomorphisms to establish properties of program equivalence for polymorphic programs.
1.1 A Type-Rewriting Theory of Polymorphic Types
In the first part of the paper (Sections 3-5) we investigate the type-rewriting arising from Yoneda type isomorphisms and its connection with proof-theoretic techniques to count type inhabitants.
Counting type inhabitants with type isomorphisms
Examples like the one in Fig. 2 suggest that, while arising from a categorical reading of polymorphic programs, Yoneda Type Isomorphisms have a proof-theoretic flavor. To demonstrate this, we show that the use of such isomorphisms to count type inhabitants can be compared with some well-known proof-theoretic sufficient conditions for a simple type to have a unique or finitely many inhabitants [2, 11], namely the balancedness, negatively-non duplicated and positively-non duplicated conditions. We show that whenever an inhabited simple type satisfies any of the first two conditions (resp. a special case of the third), then its universal closure can be converted to 1 by applying Yoneda type isomorphisms and usual -isomorphisms, and when satisfies a special case of the third, then it can be converted to . Furthermore, we suggest that the appearance of the fixpoints in isomorphisms like can be related to a well-known approach to counting type inhabitants by solving systems of polynomial fixpoint equations [44].
Eliminating Quantifiers with Yoneda Reduction
We then turn to investigate in a more systematic way the quantifier-eliminating rewriting over types arising from the left-to-right orientation of Yoneda type isomorphisms. A major obstacle here is that the rewriting must take into account possible applications of -isomorphisms, whose axiomatization is well-known to be challenging in presence of the constructors [16, 21] (not to say of ). For this reason we introduce a family of rewrite rules, that we call Yoneda reduction, defined not directly over types but over a class of finite trees which represent the types of (but crucially not those made with ) up to -isomorphism.
Using this rewriting we establish some sufficient conditions for eliminating quantifiers, based on elementary graph-theoretic properties of such trees, which in turn provide some new sufficient conditions for the finiteness of type inhabitants of polymorphic types. First, we prove quantifier-elimination for the types satisfying a certain coherence condition which can be seen as an instance of the 2-SAT problem. We then introduce a more refined condition by associating each polymorphic type with a value , that we call the characteristic of , so that whenever , rewrites into a monomorphic type, and when furthermore , converges to a finite type. In the last case our method provides an effective way to count the inhabitants of .
The computation of is somehow reminiscent of linear logic proof-nets, as it is obtained by inspecting the existence of cyclic paths in a graph obtained by adding some “axiom-links” to the tree-representation of .
1.2 Program Equivalence in System F with Finite Characteristic
In the second part of the paper (Sections 6-8) we direct our attention to programs rather than types, and we exploit our results on type isomorphisms to establish some non-trivial properties of program equivalence for polymorphic programs in some suitable fragments of .
Computing equivalence with type isomorphisms
Computing program equivalence under the -theory can be a challenging task, as this theory involves global permutations of rules which are difficult to detect and apply [13, 28, 40, 31, 42]. Things are even worse at the semantic level, since computing with dinatural transformations can be rather cumbersome, due to the well-known fact that such transformations need not compose [7, 25].
Nevertheless, our approach to quantifier-elimination based on the notion of characteristic provides a way to compute program equivalence without the appeal to -rules, free theorems and parametricity, since all polymorphic programs having types of finite characteristic can be embedded inside well-known monomorphic systems. To demonstrate this fact, we introduce two fragments and of in which types have a fixed finite characteristic, and we prove that these are equivalent, under the -theory, respectively, to the simply typed -calculus with finite products and co-products (or, equivalently, to the free bicartesian closed category ), and to its extension with -types (that is, to the free cartesian closed -bicomplete category [34, 8]). Using well-known facts about and [36, 8, 27], we finally establish that the -theory is decidable in and undecidable in .
Program equivalence and predicativity
We provide an example of how the correspondence between polymorphic types of finite characteristic and -types can be used to prove non-trivial properties of program equivalence. A main source of difficulty with is that polymorphic programs are impredicative, that is, a program of universal type can be instantiated at any type , yielding a program of type . It is thus useful to be able to predict when a complex type instantiation can be replaced by a one of smaller complexity, without altering the program behavior.
Using the fact that a universal type of finite characteristic in which is of the form is isomorphic to the initial algebra of some appropriate functor , we establish a sufficient condition under which a program containing an instantiation of as can be transformed into one with instantiations of types strictly less complex than .
We finally use this condition to provide a simpler proof of a result from [31], showing that all programs in a certain fragment of (the fragment freely generated by the embedding of finite sums and products) can be transformed into predicative programs only containing atomic type instantiations, a result related to some recent investigations on atomic polymorphism [15].
Preliminaries and Notations
We will presuppose familiarity with the syntax of (in the version à la Church) and its extensions with sum and product types, as well as and -types. We indicate by their respective quantifier-free fragments. We recall the syntax of these systems in some more detail in Sec. 6. We let indicate the countable set of type variables.
Let indicate any of the type systems above. We let indicate that the judgement is derivable in . We indicate as a term with a unique free variable , and we let be shorthand for .
A theory of is a class of equations over well-typed terms satisfying usual congruence rules. Standard theories of are those generated by -equivalence and by contextual equivalence, recalled in Sec.. 6. We will also consider a less standard theory, the -theory, also described in Sec. 6. For all theory including -equivalence, we let be the category whose objects are the types of and whose arrows are the -equivalence classes of terms . is cartesian closed as soon as contains products, meaning in particular that .
By a -isomorphism, indicated as , we mean a pair of terms , such that and (where is ).
2 Yoneda Type Isomorphisms
In this section we introduce an axiomatization for a class of type isomorphisms that we call Yoneda type isomorphisms. For this we will rely on a standard axiomatization of the -isomorphisms of (recalled in Fig. 4(a)-4(c) in Sec. 6)111Note that while this axiomatization is complete for the -isomorphisms of [14], it fails to be complete (already at the propositional level) in presence of sums and the empty type [16, 21]. and on the well-known distinction between positive and negative occurrences of a variable in a type .
Notation 2.1**.**
Throughout the text we will indicate as {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}} a positive occurrence of , and as {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}} a negative occurrence of . When occurs within a larger type , we will often note as B\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle to indicate that all occurrences of the variable in are positive occurrences in , or as B\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\right\rangle to indicate that all occurrences of the variable in are negative occurrences in . So for instance, when only contains positive occurrences of , we write the type as {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\Rightarrow B\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle (since all positive occurrences of in are positive in ) and the type as B\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\right\rangle\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}} (since all positive occurrences of in are negative in ) .
The focus on positive/negative occurrences highlights a connection with to the so-called functorial semantics of [7, 18], in which types are interpreted as functors and typed programs as (di)natural transformations between such functors. More precisely, any positive type A\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle gives rise to a functor , any negative type A\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\right\rangle gives rise to a functor and, more generally, any type gives rise to a functor . In all such cases, the action of the functor on a type is obtained by replacing positive/negative occurrences of by , and the action on programs can be defined inductively (we recall this construction in Sec. 6, see also [13, 29]).
With types being interpreted as functors, a polymorphic term is interpreted as a transformation satisfying an appropriate naturality condition: when and have the same variance, is interpreted as an ordinary natural transformation; instead, if and have mixed variances, then is interpreted as a dinatural transformation.
In the framework of syntactic categories, such (di)naturality conditions are expressed by families of equational rules over typed programs [13, 28], generating, along with the usual -equations, a theory of program equivalence that we here call the -theory (and which we define formally in Sec. 6). These equational rules are usually interpreted as parametricity conditions [32], or as instances of free theorems [42].
As mentioned in the introduction, our goal in these first sections is not that of investigating the -theory directly, but rather to explore a class of type isomorphisms that hold under this theory (that is, of isomorphisms in the syntactic categories , with ). For example, in functorial semantics a type of the form \forall X.A\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\right\rangle\Rightarrow B\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle is interpreted as the set of natural transformations between the functors A\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle and B\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle. Now, if A\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle is of the form A_{0}\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}} (i.e. it is a representable functor), using the -theory we can deduce (see App. A) a “Yoneda lemma” in the form of the quantifier-eliminating isomorphism below:
[TABLE]
Similarly, if A\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\right\rangle,B\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\right\rangle are both negative and A\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\right\rangle is of the form {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\Rightarrow A_{0} (i.e. it is a co-representable functor), we can deduce another quantifier-eliminating isomorphism:
[TABLE]
Observe that both isomorphisms ( ‣ 1) from the Introduction are instances of (1) or (2).
As we admit more type-constructors in the language, we can use the -theory to deduce stronger schemas for eliminating quantifiers. For instance, using least and greatest fixed points \mu X.A\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle,\nu X.A\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle of positive types, we can deduce the stronger schemas [41] below.
[TABLE]
Note that (1) and (2) can be deduced from (3) and (4) using the isomorphisms , when does not occur in . Moreover, adding sum and product types enables the elimination of the quantifier also from a type of the form A=\forall X.(A_{11}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle\Rightarrow A_{12}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}})\Rightarrow(A_{21}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle\Rightarrow A_{22}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}})\Rightarrow B\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle by using -isomorphisms, as follows:
A\equiv_{\beta\eta}\forall X.\left({\left(\sum_{i=1,2}\prod_{j=1,2}A_{ij}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle\right)}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\right)\Rightarrow B\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle\equiv B\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\mapsto\mu X.\left(\sum_{i=1,2}\prod_{j=1,2}A_{ij}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle\right)\right\rangle
These considerations lead to introduce the following class of isomorphisms.
Notation 2.2**.**
Given a list , and an -indexed list of types , we will use as a shorthand for .
Definition 2.1**.**
A Yoneda type isomorphism is any instance of the schemas \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}}, \equiv_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}} in Fig. 3, where the expressions , indicate that the binder (resp. ) is applied only if {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}} (resp. {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}) actually occurs in some of the (resp. ), and is a shorthand for .
For all types of , we write when can be converted to using \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}},\equiv_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}} and the (partial, see f.n. 1) axiomatization of -isomorphisms in Fig. 4(a)-4(c).
In App. A we prove in detail that the two schemas \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}},\equiv_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}} are valid under the -theory, and thus that whenever , and are interpreted as isomorphic objects in all dinatural and parametric models of .
3 Counting Type Inhabitants with Yoneda Type Isomorphisms
In the previous section we introduced and motivated Yoneda Type Isomorphisms as arising from a categorical reading of polymorphic programs as (di)natural transformations. However, such isomorphisms also have a proof-theoretic flavor since, as we observed in the Introduction, they can be used to check if a closed polymorphic type has a finite number of inhabitants (up to contextual equivalence), by showing that can be transformed into a closed quantifier-free type , and in this case to effectively count such inhabitants (by reducing to a finite sum ).
At least in some simple cases, the way in which a quantifier is eliminated by applying the schemas \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}},\equiv_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}} can be related with the structure of the -normal -long terms of type . For instance, suppose is the simple type (where none of the contains occurrences of ) and is a -normal -long term of type . Then must be of one of the following forms:
[TABLE]
Since does not occur in the we can suppose that do not occur in the terms , so that is a closed term of type . Hence a closed term of is obtained from closed terms of and , or from closed terms of and , and we deduce that the number of inhabitants of must be the same as the number of inhabitants of , which is precisely the type we would obtain by applying \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}} to .
The situation becomes tricker if we admit the types to have positive occurrences of , so that \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}} yields the fixpoint type \mu X.\sum_{i}\prod_{j}C_{ij}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle. In this case all we can say is that the closed terms have type . In the concluding section we suggest that a purely proof-theoretic explanation of \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}} could be developed also in this case by considering a technique of counting type-inhabitants of simple types by solving a system of polynomial fixpoint equations [44].
A natural question about counting type inhabitants using type isomorphisms is whether this approach can be compared with existing proof-theoretic criteria for having a finite number of inhabitants. We provide a first answer to this question by comparing the use of Yoneda Type Isomorphism with some well-known criteria for the finiteness/uniqueness of the inhabitants of a simple type.
Let us start with a “warm-up” example.
Example 3.1**.**
In [11] it is proved that the type A=(((({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Y}})\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Z}})\Rightarrow({\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Y}}\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Z}})\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{W}})\Rightarrow({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Z}})\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{W}} has a unique inhabitant. Here’s a quick proof of :
[TABLE]
The literature on counting simple type inhabitants is vast (e.g. [2, 11, 10, 37]) and includes both complete algorithms and simpler sufficient conditions for a given type to have a unique or finite number of inhabitants. The latter provide then an ideal starting point to test our axiomatic theory of type isomorphisms, as several of these conditions are based on properties like the number of positive/negative occurrences of variables.
We tested Yoneda type isomorphisms on two well-known sufficient conditions for unique inhabitation. A simple type is balanced when any variable occurring free in occurs exactly once as {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}} and exactly once as {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}. is negatively non-duplicated if no variable occurs twice in as {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}. An inhabited simple type which is either balanced or negatively duplicated has exactly one inhabitant [2]. The isomorphisms subsume these two conditions in the following sense:
Proposition 3.1**.**
*Let be an inhabited simple type with free variables . If is either balanced or negatively non-duplicated, then . *
Proof.
Write as and suppose is a closed term of type in -long -normal form. This forces , with , and implies that the terms have type .
We argue by induction on the size of .
- •
suppose is balanced. Since occurs positively in the rightmost position of and negatively in the rightmost position of , it cannot occur in any other , for . We deduce that the variable cannot occur in any of the terms . Then, up to some -isomorphisms, we can write as \forall\vec{X}_{v\neq u}.\forall X_{v}.\left(\langle A_{jv}\rangle_{j\in J_{v}}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}_{u}\right)\Rightarrow\left(\langle A_{w}\rangle_{w\neq v}\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{u}\right), and by applying isomorphism \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}} we obtain the type .
Since the terms have the balanced type , by the induction hypothesis we deduce , and thus we deduce .
- •
Suppose is negatively non-duplicated; we will exploit the fact that admits at most one -long -normal term up to equivalence (see [2]). We argue by induction that reduces to using -isomorphisms and isomorphisms of the form , where the variable occurs negatively exactly once. Since occurs negatively once in rightmost position of , it can only occur positively in the and negatively in the for .
Moreover, we claim that cannot occur in the . In fact, suppose some contains . Since it is -long it contains a subterm of the form , where cannot be -equivalent to . Then by replacing with in we obtain a new term of type . It is clear that this process can be repeated yielding infinitely many distinct -normal and -long terms of type . This is impossible because admits only one term up to -equivalence.
Hence, up to some -isomorphisms, we can write as \forall\vec{X}_{w\neq u}.\forall X_{v}.\left(\langle A_{jv}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{u}\right\rangle\rangle_{j\in J_{v}}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}_{u}\right)\Rightarrow\left(\langle A_{w}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{u}\right\rangle\rangle_{w\neq v}\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{u}\right), and by applying \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}} we obtain the type \forall\vec{X}_{w\neq u}.\langle A_{w}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{u}\mapsto\alpha\right\rangle\rangle_{w\neq v}\Rightarrow\alpha, where \alpha=\mu X_{u}.\prod_{j\in J_{v}}A_{jv}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{u}\right\rangle, which is -isomorphic to \forall\vec{X}_{w\neq u}.\langle A_{w}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{u}\mapsto\alpha\right\rangle\rangle_{w\neq v}\Rightarrow\Pi_{j\in J_{v}}A_{jv}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\mapsto\alpha\right\rangle, and finally to \prod_{j\in J_{v}}\left(\forall\vec{X}_{w\neq u}.\langle A_{w}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{u}\mapsto\alpha\right\rangle\rangle_{w\neq v}\Rightarrow A_{jv}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\mapsto\alpha\right\rangle\right).
Since the terms have the negatively non-duplicated type A_{j}^{*}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{u}\right\rangle=\langle A_{w}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{u}\right\rangle\rangle_{w\neq v}\Rightarrow A_{jv}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{u}\right\rangle, by the induction hypothesis we deduce \forall\vec{X}.A_{j}^{*}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{u}\right\rangle\equiv_{\mathsf{Y}}1 using -isomorphisms and isomorphisms of the form , where , so we deduce that also \forall\vec{X}_{w\neq u}A_{j}^{*}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{u}\mapsto\alpha\right\rangle\equiv_{\mathsf{Y}}1 holds. We can then conclude \forall\vec{X}.A\equiv_{\mathsf{Y}}\prod_{j\in J_{v}}\forall\vec{X}_{v\neq u}A_{j}^{*}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{u}\mapsto\alpha\right\rangle\equiv_{\mathsf{Y}}\prod_{j\in J_{v}}1\equiv_{\beta\eta}1.
∎
Observe that, since the type in Example 3.1 is neither balanced nor negatively non-duplicated, type isomorphisms provide a stronger condition than the two above.
We tested another well-known property, dual to one of the previous ones: a simple type is positively non-duplicated if no variable occurs twice in as {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}. A positively non-duplicated simple type has a finite number of proofs [11]. We reproved this fact using type isomorphisms, but this time only in a restricted case. Let the depth of a simple type be defined by , .
Proposition 3.2**.**
Let be an inhabited simple type with free variables . If is positively non-duplicated and , then .
We need the following lemma:
Lemma 3.3**.**
Suppose has free variables , where the are -free -types and is a closed type constructed using only 0 and 1. Then .
Proof.
We argue by induction on the number of variables freely occurring in . If is 0 then the list is empty, so the claim is obvious. Otherwise, suppose has a first element , so that can be written, up to some -isomorphism, as \langle A_{u}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{i_{0}}\right\rangle\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}_{i_{0}}\rangle_{u}\Rightarrow\langle B_{v}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{i_{0}}\right\rangle\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Y}}_{v}\rangle_{v}\Rightarrow U where the A_{u}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{i_{0}}\right\rangle and A_{u}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{i_{0}}\right\rangle are -free types and . Then \forall X_{1}\dots\forall X_{n}.A\equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{i_{0}}}\forall X_{1}\dots\widehat{\forall X}_{i_{0}}\dots\forall X_{n}.\langle B_{v}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{i_{0}}\right\rangle\theta\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Y}}_{v}\rangle_{v}\Rightarrow U, where \theta:{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{i_{0}}\mapsto\mu X_{i_{0}}.\sum_{u}A\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{i_{0}}\right\rangle_{u}, so we can conclude by the induction hypothesis. ∎
Proof of Proposition 3.2.
We will establish the following stronger claim. Let a quasi-polynomial be a type of the form , where , the are simple types of depth (hence of the form ) and the are either variables or 0,1. We claim that for any quasi-polynomial , if is positively non-duplicated, then .
We argue by induction on the number of variables occurring among the .
If all are either [math] or , then any is -isomorphic to so we can apply Lemma 3.3 yielding .
Suppose now . Since is positively non-duplicated, we can write , up to some -isomorphisms, as \langle\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Z}}_{lm}\rangle_{l}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Z}}\rangle_{m}\Rightarrow\langle B_{m^{\prime}}\rangle_{m^{\prime}}\Rightarrow\sum_{i=1}^{p}\prod_{j=1}^{p_{i}}u_{ij} where none of coincides with and does not occur in any of the . Then we deduce \forall X_{1}\dots\forall X_{n}.P\equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Z}}}\forall X_{1}\dots\widehat{\forall Z}\dots\forall X_{n}.\langle B_{m^{\prime}}\rangle_{m^{\prime}}\Rightarrow\sum_{i=1}^{p}\prod_{j=1}^{p_{i}}u_{ij}\theta, where \theta:{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Z}}\mapsto\sum_{m}\prod_{l}{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Z}}_{lm}. Observe that the type is positively non-duplicated, has one variable less than , and moreover, reduces using -isomorphisms to a type of the form , where the are among . We can thus apply the induction hypothesis. ∎
4 From Polymorphic Types to Polynomial Trees
As we already observed, read from left to right, the schemas \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}},\equiv_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}} yield rewriting rules over -types which eliminate occurrences of polymorphic quantifiers. Yet, a major obstacle to study this rewriting is that the application of \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}},\equiv_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}} might depend on the former application of -isomorphisms (as we did for instance in the previous section). Already for the propositional fragment , the -isomorphisms are not finitely axiomatizable and it is not yet clear if a decision algorithm exists at all (see [16, 21]). This implies in particular that a complete criterion for the conversion of a -type to a monomorphic (or even finite) type can hardly be computable.
For this reason, we will restrict our goal to establishing some efficiently recognizable (in fact, polytime) sufficient conditions for quantifier-elimination. Moreover, we will exploit the well-known fact that the constructors can be encoded inside to describe our rewriting entirely within (a suitable representation of) -types, for which -isomorphisms can be finitely axiomatized [14].
Even if one restricts to -types, recognizing if one of the schemas \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}},\equiv_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}} applies to a -type might still require to first apply some -isomorphisms. For example, consider the -type A=\forall X.(({\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Y}}\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}})\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Y}})\Rightarrow({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}})\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}. In order to eliminate the quantifier using \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}}, we first need to apply the -isomorphism , turning into \forall X.({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}})\Rightarrow(({\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Y}}\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}})\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Y}})\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}, which is now of the form \forall X.(B\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}})\Rightarrow C\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle, with B\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle={\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}} and C\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle=(({\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Y}}\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}})\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Y}})\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}. We can then apply \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}}, yielding (({\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Y}}\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}})\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Y}})\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}.
To obviate this problem, we introduce below a representation of -types as labeled trees so that -isomorphic types are represented by the same tree. In the next section we will reformulate the schemas \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}},\equiv_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}} as reduction rules over such trees. This approach drastically simplifies the study of this rewriting, and will allow us to establish conditions for quantifier-elimination based on elementary graph-theoretic properties.
4.1 A -invariant representation of -types
We introduce a representations of -types as rooted trees whose leaves are labeled by colored variables, with colors being any c\in\mathsf{Colors}=\{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathrm{blue}}},{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathrm{red}}}\}. We indicate such variables as either or simply as {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}},{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}. Moreover, we indicate as the unique color different from .
By a rooted tree we indicate a finite connected acyclic graph with a chosen vertex, called its root. If is a finite family of rooted trees, we indicate as
\big{\{}\mathscr{G}_{i}\big{\}}_{i\in I}$$u
the tree with root obtained by adding an edge from any of the roots of the trees to .
Definition 4.1**.**
The sets {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathcal{E}}} and {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathcal{E}}} of positive and negative -trees are inductively defined by:
{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}\quad:=\quad\leavevmode\hbox to63.37pt{\vbox to38pt{\pgfpicture\makeatletter\hbox{\hskip 16.11737pt\lower-29.66751pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ } {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-12.78436pt}{-2.5pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small\Big{{}{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{E}}}{i}\Big{}}{i\in I}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{35.75244pt}{-3.07498pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{16.64775pt}{-26.3345pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small\vec{Y}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} { {}{}{}}{}{ {}{}{}} {{{{{}}{ {}{}}{}{}{{}{}}}}}{}{{{{{}}{ {}{}}{}{}{{}{}}}}}{{}}{}{}{}{}\pgfsys@moveto{7.4652pt}{-8.533pt}\pgfsys@lineto{13.70021pt}{-15.65706pt}\pgfsys@stroke\pgfsys@invoke{ } { {}{}{}}{}{ {}{}{}} {{{{{}}{ {}{}}{}{}{{}{}}}}}{}{{{{{}}{ {}{}}{}{}{{}{}}}}}{{}}{}{}{}{}\pgfsys@moveto{34.05261pt}{-6.60799pt}\pgfsys@lineto{26.13347pt}{-15.65706pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}\qquad\qquad\qquad\qquad{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{E}}}\quad:=\quad\leavevmode\hbox to63.37pt{\vbox to38pt{\pgfpicture\makeatletter\hbox{\hskip 16.11737pt\lower-29.66751pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ } {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-12.78436pt}{-2.5pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small\Big{{}{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}{i}\Big{}}{i\in I}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{35.75244pt}{-3.07498pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{16.64775pt}{-26.3345pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small\vec{Y}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} { {}{}{}}{}{ {}{}{}} {{{{{}}{ {}{}}{}{}{{}{}}}}}{}{{{{{}}{ {}{}}{}{}{{}{}}}}}{{}}{}{}{}{}\pgfsys@moveto{7.4652pt}{-8.533pt}\pgfsys@lineto{13.70021pt}{-15.65706pt}\pgfsys@stroke\pgfsys@invoke{ } { {}{}{}}{}{ {}{}{}} {{{{{}}{ {}{}}{}{}{{}{}}}}}{}{{{{{}}{ {}{}}{}{}{{}{}}}}}{{}}{}{}{}{}\pgfsys@moveto{34.05261pt}{-6.60799pt}\pgfsys@lineto{26.13347pt}{-15.65706pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}
*where is a variable, indicates a finite set of variables, and the edge in {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}} (resp. {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{E}}}) with label {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}} (resp. {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}) is called the head of {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}} (resp. of {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{E}}}). The trees *
\{\ \}_{\emptyset}$${\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}$$\emptyset *
and *
\{\ \}_{\emptyset}$${\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}$$\emptyset *
are indicated simply as {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}} and {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}.*
Free and bound variables of a tree
\Big{\{}\mathsf{E}_{i}\Big{\}}_{i\in I}$$X$$\vec{Y}
are defined by and .
We can associate a positive and a negative -tree to any -type as follows. Let us say that a type of is in normal form (shortly, in NF) if where each of the variables in occurs in at least once, and the types are in normal form.
We will show that the tree-representation of -types captures -isomorphism classes, in the sense that iff {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(A)={\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(B). For instance, the two -isomorphic types \forall XY.({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}})\Rightarrow(\forall Z.{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Z}})\Rightarrow({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}})\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}} and \forall X.({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}})\Rightarrow\forall Y.({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}})\Rightarrow({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\Rightarrow\forall Z.{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Z}})\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}} translate into the same -tree, shown in Fig. 7(b) (where underlined node labels and dashed edges can be ignored, for now).
The -isomorphisms of are completely axiomatized as shown in Fig. 4(a). A type of is in normal form (shortly, in NF) if where each variable in occurs at least once in , and the types are in normal form. Let be the set of -types in NF.
Given , with and , let when , , and there exists such that for .
Lemma 4.1**.**
- i.
For all , there exists a type such that .
- ii.
For all , iff .
Proof.
Claim is a consequence of applying the isomorphisms when does not occur in and the isomorphisms to push quantifiers in leftmost position. Claim follows then since the only other isomorphism rule is the permutation . ∎
The definition of the tree-type {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(A) only depends on . Moreover, it can be checked by induction on that holds iff {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(A)={\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(B). Hence, we deduce from Lemma 4.1 that iff {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(A)={\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(B).
Definition 4.2**.**
For all , with , let
{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(A)=\leavevmode\hbox to91.04pt{\vbox to40.98pt{\pgfpicture\makeatletter\hbox{\hskip 26.71696pt\lower-32.51253pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ } {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-23.38396pt}{-2.36401pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small\Big{{}{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{t}}}(A_{i})\Big{}}{i=1,\dots,n}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \par{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{52.82428pt}{-3.07498pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \par{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{25.18367pt}{-29.17952pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small{\vec{Y}}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \par{ {}{}{}}{}{ {}{}{}} {{{{{}}{ {}{}}{}{}{{}{}}}}}{}{{{{{}}{ {}{}}{}{}{{}{}}}}}{{}}{}{}{}{}\pgfsys@moveto{49.564pt}{-6.60799pt}\pgfsys@lineto{35.25485pt}{-19.4864pt}\pgfsys@stroke\pgfsys@invoke{ } { {}{}{}}{}{ {}{}{}} {{{{{}}{ {}{}}{}{}{{}{}}}}}{}{{{{{}}{ {}{}}{}{}{{}{}}}}}{{}}{}{}{}{}\pgfsys@moveto{9.6313pt}{-8.66899pt}\pgfsys@lineto{21.65067pt}{-19.4864pt}\pgfsys@stroke\pgfsys@invoke{ } \par \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}\qquad\qquad{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{t}}}(A)=\leavevmode\hbox to91.04pt{\vbox to40.98pt{\pgfpicture\makeatletter\hbox{\hskip 26.71696pt\lower-32.51253pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ } {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-23.38396pt}{-2.36401pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small\Big{{}{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(A{i})\Big{}}_{i=1,\dots,n}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \par{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{52.82428pt}{-3.07498pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \par{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{25.18367pt}{-29.17952pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small{\vec{Y}}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \par{ {}{}{}}{}{ {}{}{}} {{{{{}}{ {}{}}{}{}{{}{}}}}}{}{{{{{}}{ {}{}}{}{}{{}{}}}}}{{}}{}{}{}{}\pgfsys@moveto{49.564pt}{-6.60799pt}\pgfsys@lineto{35.25485pt}{-19.4864pt}\pgfsys@stroke\pgfsys@invoke{ } { {}{}{}}{}{ {}{}{}} {{{{{}}{ {}{}}{}{}{{}{}}}}}{}{{{{{}}{ {}{}}{}{}{{}{}}}}}{{}}{}{}{}{}\pgfsys@moveto{9.6313pt}{-8.66899pt}\pgfsys@lineto{21.65067pt}{-19.4864pt}\pgfsys@stroke\pgfsys@invoke{ } \par \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}
4.2 Polynomial Trees
To formulate the schemas \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}},\equiv_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}} in the language of rooted trees we exploit an encoding of the types of the form \mu X.\exists\vec{Y}.\sum_{i\in I}\prod_{j\in J_{i}}A_{ij}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle and \nu X.\forall\vec{Y}.\prod_{j\in J}A_{j}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle as certain special trees employing two new constants and . This encoding is easily seen to be a small variant, in the language of finite trees, of the usual second-order encodings.
We first introduce a handy notation for “polynomial” types, i.e. types corresponding to a generalized sum of generalized products. Following [17], any such type is completely determined by a diagram of finite sets and a -indexed family of types , so that , where . In the following, we will call the given of a finite diagram , and an -indexed family a polynomial family, and indicate it simply as .
We now enrich the class of -trees as follows:
Definition 4.3** (Polynomial trees).**
Let indicate two new constants.
- •
the set {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathcal{P}}} of positive polynomial trees is defined by adding to the clauses defining positive -trees two new clauses:
\left\{\leavevmode\hbox{\set@color\ignorespaces\minipage{433.62pt} \leavevmode\hbox to74.74pt{\vbox to41.84pt{\pgfpicture\makeatletter\hbox{\hskip 35.01793pt\lower-33.38753pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-31.68492pt}{-2.38501pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small\Big{{}{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}{jk}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\mapsto{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\bullet}}\right\rangle\Big{}}{j}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{31.89322pt}{-2.0pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\bullet}}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{12.41148pt}{-28.30452pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small\vec{X}_{k}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \par{ {}{}{}}{}{ {}{}{}} {{{{{}}{ {}{}}{}{}{{}{}}}}}{}{{{{{}}{ {}{}}{}{}{{}{}}}}}{{}}{}{}{}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.8pt}\pgfsys@invoke{ }{}\pgfsys@moveto{0.1105pt}{-8.648pt}\pgfsys@lineto{9.09233pt}{-17.62708pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{ {}{}{}}{}{ {}{}{}} {{{{{}}{ {}{}}{}{}{{}{}}}}}{}{{{{{}}{ {}{}}{}{}{{}{}}}}}{{}}{}{}{}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.8pt}\pgfsys@invoke{ }{}\pgfsys@moveto{30.45537pt}{-5.533pt}\pgfsys@lineto{22.39128pt}{-17.62708pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\par\par \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}} \endminipage }\right\}_{k}$${\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\bullet}}$$\bullet \Big{\{}{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}_{j}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\mapsto{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\blacktriangle}}\right\rangle\Big{\}}_{j}$${\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\blacktriangle}}$$\vec{X}
{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\blacktriangle}}$$\blacktriangle
** where is some variable, ({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}_{jk}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle)_{k,j} (resp. ({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}_{j}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle)_{j}) is a polynomial family (resp. a family) of positive polynomial trees with no occurrence of {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}, and is a -indexed family of finite sets of variables.*
- •
the set {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathcal{P}}} of negative polynomial trees is defined by adding to the clauses defining negative -trees two new clauses:
\left\{\leavevmode\hbox{\set@color\ignorespaces\minipage{433.62pt} \leavevmode\hbox to74.74pt{\vbox to41.84pt{\pgfpicture\makeatletter\hbox{\hskip 35.01793pt\lower-33.38753pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-31.68492pt}{-2.38501pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small\Big{{}{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{E}}}{jk}\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\mapsto{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\bullet}}\right\rangle\Big{}}{j}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{31.89322pt}{-2.0pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\bullet}}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{12.41148pt}{-28.30452pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small\vec{X}_{k}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \par{ {}{}{}}{}{ {}{}{}} {{{{{}}{ {}{}}{}{}{{}{}}}}}{}{{{{{}}{ {}{}}{}{}{{}{}}}}}{{}}{}{}{}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.8pt}\pgfsys@invoke{ }{}\pgfsys@moveto{0.1105pt}{-8.648pt}\pgfsys@lineto{9.09233pt}{-17.62708pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{ {}{}{}}{}{ {}{}{}} {{{{{}}{ {}{}}{}{}{{}{}}}}}{}{{{{{}}{ {}{}}{}{}{{}{}}}}}{{}}{}{}{}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.8pt}\pgfsys@invoke{ }{}\pgfsys@moveto{30.45537pt}{-5.533pt}\pgfsys@lineto{22.39128pt}{-17.62708pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\par\par \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}} \endminipage }\right\}_{k}$${\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\bullet}}$$\bullet \Big{\{}{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{E}}}_{j}\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\mapsto{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\blacktriangle}}\right\rangle\Big{\}}_{j}$${\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\blacktriangle}}$$\vec{X}
{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\blacktriangle}}$$\blacktriangle
** where is some variable, ({\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{E}}}_{jk}\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\right\rangle)_{k,j} (resp. ({\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{E}}}_{j}\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\right\rangle)_{j}) is a polynomial family (resp. a family) of negative polynomial trees with no occurrence of {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}, and is a -indexed family of finite sets of variables.*
We indicate by the set of all polynomial trees, and by the set of all polynomial trees with no bound variables, which are called simple.
Any polynomial tree can be converted into a type of as illustrated in Fig. 5. It is easily checked that, whenever is simple, has no quantifier. Moreover, one can check that for all -type, \tau({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(A))=A.
We conclude this section with some basic example of polynomial trees.
Example 4.1**.**
- •
*The constant types [math] and are represented as positive/negative trees by {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathbf{0}}}=\leavevmode\hbox to11.17pt{\vbox to24.89pt{\pgfpicture\makeatletter\hbox{\hskip 5.58301pt\lower-19.55939pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ } {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.25pt}{-2.0pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\bullet}}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.25pt}{-16.22638pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small\bullet}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} { {}{}{}}{}{ {}{}{}} {{{{{}}{ {}{}}{}{}{{}{}}}}}{}{{{{{}}{ {}{}}{}{}{{}{}}}}}{{}}{}{}{}{}\pgfsys@moveto{0.0pt}{-5.533pt}\pgfsys@lineto{0.0pt}{-8.69337pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}, {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathbf{0}}}=\leavevmode\hbox to11.17pt{\vbox to24.89pt{\pgfpicture\makeatletter\hbox{\hskip 5.58301pt\lower-19.55939pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ } {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.25pt}{-2.0pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\bullet}}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.25pt}{-16.22638pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small\bullet}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} { {}{}{}}{}{ {}{}{}} {{{{{}}{ {}{}}{}{}{{}{}}}}}{}{{{{{}}{ {}{}}{}{}{{}{}}}}}{{}}{}{}{}{}\pgfsys@moveto{0.0pt}{-5.533pt}\pgfsys@lineto{0.0pt}{-8.69337pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}} and {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathbf{1}}}=\leavevmode\hbox to28.24pt{\vbox to24.89pt{\pgfpicture\makeatletter\hbox{\hskip 14.11891pt\lower-19.55939pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ } {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-10.7859pt}{-2.0pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\bullet}}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{6.2859pt}{-2.0pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\bullet}}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.25pt}{-16.22638pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small\bullet}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} { {}{}{}}{}{ {}{}{}} {{{{{}}{ {}{}}{}{}{{}{}}}}}{}{{{{{}}{ {}{}}{}{}{{}{}}}}}{{}}{}{}{}{}\pgfsys@moveto{5.21608pt}{-5.533pt}\pgfsys@lineto{3.31932pt}{-8.69337pt}\pgfsys@stroke\pgfsys@invoke{ } { {}{}{}}{}{ {}{}{}} {{{{{}}{ {}{}}{}{}{{}{}}}}}{}{{{{{}}{ {}{}}{}{}{{}{}}}}}{{}}{}{}{}{}\pgfsys@moveto{-5.21608pt}{-5.533pt}\pgfsys@lineto{-3.31932pt}{-8.69337pt}\pgfsys@stroke\pgfsys@invoke{ } \par \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}, {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathbf{1}}}=\leavevmode\hbox to28.24pt{\vbox to24.89pt{\pgfpicture\makeatletter\hbox{\hskip 14.11891pt\lower-19.55939pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ } {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-10.7859pt}{-2.0pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\bullet}}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{6.2859pt}{-2.0pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\bullet}}}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.25pt}{-16.22638pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{\small\bullet}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} { {}{}{}}{}{ {}{}{}} {{{{{}}{ {}{}}{}{}{{}{}}}}}{}{{{{{}}{ {}{}}{}{}{{}{}}}}}{{}}{}{}{}{}\pgfsys@moveto{5.21608pt}{-5.533pt}\pgfsys@lineto{3.31932pt}{-8.69337pt}\pgfsys@stroke\pgfsys@invoke{ } { {}{}{}}{}{ {}{}{}} {{{{{}}{ {}{}}{}{}{{}{}}}}}{}{{{{{}}{ {}{}}{}{}{{}{}}}}}{{}}{}{}{}{}\pgfsys@moveto{-5.21608pt}{-5.533pt}\pgfsys@lineto{-3.31932pt}{-8.69337pt}\pgfsys@stroke\pgfsys@invoke{ } \par \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}. *
- •
*The diagram , along with the family , yields the polynomial family ({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}_{jk})_{k,j}, with {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}_{11}={\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}_{32}={\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{1} and {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}_{21}={\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{2}, and yields the polynomial tree *
{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\bullet}}$${\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{2}$${\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\bullet}}$$\emptyset$${\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\bullet}}$${\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\bullet}}$$\emptyset$${\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\bullet}}$$\bullet *
- encoding the type .*
- •
*The diagram with the same family as above yields the polynomial tree *
{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\blacktriangle}}$${\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\blacktriangle}}$$\emptyset$${\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}_{2}$${\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\blacktriangle}}$$\emptyset$${\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\blacktriangle}}$$\blacktriangle *
- encoding the type .*
5 Yoneda Reduction and the Characteristic of a Polymorphic Type
In this section we introduce a family of rewriting rules \leadsto_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}},\leadsto_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}} over polynomial trees, that we call Yoneda reduction, which correspond to the left-to-right orientation of the isomorphisms \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}},\equiv_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}}. We will then exploit Yoneda reduction to establish two sufficient conditions to convert a -type into a quantifier-free type such that .
5.1 Yoneda Reduction
We will adopt the following conventions:
Notation 5.1**.**
We make the assumption that all bound variables of a polynomial tree are distinct. More precisely, for any , we suppose there exist unique nodes and such that , for some set of variable such that , and is the head of the sub-tree whose root is .
We will call two distinct nodes parallel if they are immediate successors of the same node, and we let the distance between two nodes in a polynomial tree be the number of edges of the unique path from to .
Using polynomial trees we can identify when a quantifier can be eliminated from a type independently from -isomorphisms, by inspecting a simple condition on the tree-representation of the type based on the notion of modular node, introduced below.
Definition 5.1**.**
For all , a terminal node in is said modular if , and has no parallel node of label . A pair of nodes of the form (\alpha:{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}},\beta:{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}) is called a -pair, and a -pair is said modular if one of its nodes is modular.
In the trees in Fig. 7 the modular nodes are underlined and the modular pairs are indicated as dashed edges.
Definition 5.2**.**
A variable is said eliminable when every -pair of is modular. For every color , we furthermore call -eliminable if every node is modular.
We let {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathrm{eliminable}}} be a shorthand for “{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathrm{blue}}}}-eliminable” and {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathrm{eliminable}}} be a shorthand for “{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathrm{red}}}}-eliminable”. These notions are related as follows:
Lemma 5.1**.**
* is eliminable iff it is either {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathrm{eliminable}}} or {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathrm{eliminable}}}.*
Proof.
If is neither {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathrm{eliminable}}} nor {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathrm{eliminable}}}, then there exist non-modular nodes \alpha:{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}},\beta:{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}, whence the -pair is not modular. Conversely, suppose is eliminable but not {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathrm{eliminable}}}. Hence there is a non modular node \alpha:{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}. For all node \beta:{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}, since the -pair is modular, is modular. We deduce that is {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathrm{eliminable}}}. ∎
Example 5.1**.**
*The variable is {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathrm{eliminable}}} but not {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathrm{eliminable}}} in the tree in Fig. 7(a), and it is both {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathrm{eliminable}}} and {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathrm{eliminable}}} in the tree in Fig. 7(b). *
The proposition below shows that a variable is {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathrm{eliminable}}} (resp. {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathrm{eliminable}}}) in the tree of a -type exactly when matches, up to -isomorphisms, with the left-hand type of the schema \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}} (resp. \equiv_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}}).
Proposition 5.2**.**
- •
* is {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathrm{eliminable}}} in {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}} iff {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}} is as in Fig. 6(a) left, for some polynomial family ({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{D}}}_{jk}\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\rangle)_{k\in K,j\in J_{k}}, family ({\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{F}}}_{l}\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\rangle)_{l\in L} and blue variable {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}} (possibly {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}} itself).*
- •
* is {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathrm{eliminable}}} in {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}} iff {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}} is as in Fig. 6(b) left, for some polynomial family ({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{D}}}_{jk}\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\rangle)_{k\in K,j\in J_{k}}, family ({\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{E}}}_{k}\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\rangle)_{k\in K}, family ({\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{F}}}_{l}\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\rangle)_{l\in L} and blue variable {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}\neq{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}.*
- •
* is {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathrm{eliminable}}} in {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{E}}} iff {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{E}}} is as in Fig. 6(c) left, for some polynomial family ({\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{D}}}_{jk}\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\rangle)_{k\in K,j\in J_{k}}, family ({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}_{k}\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\rangle)_{k\in K}, family ({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{F}}}_{l}\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\rangle)_{l\in L} and red variable {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Y}}\neq{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}.*
- •
* is {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathrm{eliminable}}} in {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{E}}} iff {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{E}}} is as in Fig. 6(d) left, for some polynomial family ({\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{D}}}_{jk}\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\rangle)_{k\in K,j\in J_{k}}, family ({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{F}}}_{l}\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\rangle)_{l\in L} and red variable {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Y}} (possibly {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}} itself).*
Proof.
If is {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathrm{eliminable}}} in a positive tree {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}=
\Big{\{}{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{E}}}_{i}\Big{\}}_{i\in I}$${\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}$${\vec{Y}}X
, then let us split the negative subtrees {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{E}}}_{i} into those which do not contain terminal nodes with label {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}, that we indicate as {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{F}}}_{l}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle, and those which contain a (necessarily unique) modular node of label {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}, that we indicate as {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{G}}}_{k}. Since {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{G}}}_{k} contains a unique modular node \alpha_{k}:{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}} which is no more than two edges far away from the root of {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}, then {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{G}}}_{k} is of the form
\Big{\{}{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{D}}}_{jk}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle\Big{\}}_{i\in I}$${\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}$${\vec{Z}_{k}}
, where possibly , (so that {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{G}}}_{k}={\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}).
If is {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathrm{eliminable}}} in a positive tree {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}=
\Big{\{}{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{E}}}_{i}\Big{\}}_{i\in I}$${\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}$$\vec{Y}X
, then, since all nodes \alpha:{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}} are modular, it must be {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}\neq{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}. Let us split the positive subtrees {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}_{i} into those which do not contain terminal nodes with label {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}, that we indicate as {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{F}}}_{l}\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\right\rangle, and those which contain a (necessarily unique) modular node of label {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}, that we indicate as {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{G}}_{k}. Since {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{G}}_{k} contains a unique modular node \alpha_{k}:{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\alpha}} which is no more than two edges far away from the root of {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}, then {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{G}}_{k} is of the form
{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}$$\Big{\{}{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{D}}}_{jk}\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\right\rangle\Big{\}}_{i\in I}$${\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}_{k}\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\right\rangle$${\vec{{Z}}_{k}}
.
The two cases with a negative tree are described in a dual way (i.e. by switching blue and red everywhere). ∎
For all four cases of Prop. 5.2 we define a rewriting rule which eliminates .
Definition 5.3** (Yoneda reduction).**
Let and be an eliminable variable. The rules consist in replacing the subtree of rooted in as illustrated in Fig. 6.
Example 5.2**.**
The tree in Fig. 7(b) rewrites as illustrated in Fig. 8.
By inspecting the rules in Fig. 6 one can check that implies . From this we can deduce by induction:
Lemma 5.3**.**
For all -type , if {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(A)\leadsto^{*}\mathsf{E}\in\mathcal{P}_{0}, then .
The lemma above suggests to study the elimination of quantifiers from -types by studying the convergence of -trees onto simple polynomial trees. This will be our next goal.
5.2 The Coherence Condition
When a reduction is applied to , several sub-trees of can be either erased or copied and moved elsewhere. Hence, the resulting tree might well have a greater size and even a larger number of bound variables than . Nevertheless, sequences of Yoneda reductions always terminate, as one can define a measure which decreases at each step.
Proposition 5.4**.**
There is no infinite sequence of Yoneda reductions.
Proof.
Let be the number of terminal nodes of and, for all bound variable of , let be the number of terminal nodes of the subtree of with root . Fix some and let be the sum of all , for all bound variable . If , then the elimination of comes at the cost of possibly duplicating the bound variables which are at distance at least one from the root of . These are no more than and can be duplicated for no more than times. Since for each such variable , it must be , we deduce that is obtained by replacing in the summand by a sum of no more than summands which are bounded by . Hence, if we write as , then . We deduce that the measure strictly decreases under reduction, and so, if an infinite sequence of reductions exists, then after a large enough number of step one must obtain a tree such that , which is impossible. ∎
Although sequences of reductions always terminate, they need not terminate on a simple polynomial tree, that is, on the encoding of a monomorphic type. This can be due to several reasons. Firstly, one bound variable might not be eliminable. Secondly, even if all variables are eliminable, this property need not be preserved by reduction. For example, take the type A=\forall X.\forall Y.({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}})\Rightarrow(({\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Y}}\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}})\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{W}})\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Z}}: although and are both eliminable (in the associated tree), if we apply a reduction to , then ceases to be eliminable, and similarly if we reduce first. Such conflicts can be controlled by imposing a suitable coherence relation on variables.
Definition 5.4**.**
Let be a polynomial tree, and . and are said coherent if there exists no parallel modular nodes of the form in .
Example 5.3**.**
In the tree in Fig. 7(b), {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Y}} and {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Z}} are coherent, while {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}} and {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Y}} are not.
Definition 5.5** (coherence condition).**
Let be a polynomial tree. A valuation of is any map . For all valuation of , we call -coherent if for all , is -eliminable, and moreover for all , is coherent with . We call coherent if it is -coherent for some valuation of .
Remark 5.1** (Coherence is an instance of 2-SAT).**
The problem of checking if a polynomial tree is coherent can be formulated as an instance of 2-SAT (a well-known polytime problem): consider Boolean variables (one for each bound variable of ), and let be if c={\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathrm{blue}}} and if c={\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathrm{red}}}. Consider then the 2-CNF , where is the conjunction of all such that is not -eliminable in , and is the conjunction of all , for all incoherent and . Then a coherent valuation of is the same as a model of .
As observed before, a reduction might copy or erase some bound variables of . One can then define a map associating any variable in with the corresponding variable in of which it is a copy. A sequence of reductions induces then, for , maps , and we let be .
The rewriting properties of coherent trees are captured by the following notion:
Definition 5.6** (standard reduction).**
A sequence of reductions is said standard if for all , is coherent with in . We say that strongly converges under standard reduction if all standard reductions starting from terminate on a simple polynomial tree.
We indicate a standard reduction as . We will show that standard reduction preserves coherence.
Lemma 5.5**.**
If is coherent, and , then is coherent.
Proof.
For any node of there exists a unique node, that we indicate as , from which “comes from” through the reduction step. Moreover, for each bound variable there exists a unique bound variable from which “comes from” through the reduction step.
We indicate as the tree-order relation on the nodes of (so that the root of is the minimum node). Suppose is -coherent and . We will show that is -coherent.
Let be the sub-tree of with root , fix a variable in . We must consider four possible cases, corresponding to the four reduction rules. Each rule requires itself four subcases. We only consider the case of the first rule (hence with positive), as the other three cases can be proved in a similar way.
({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{F}}}\leadsto_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}}{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{F}^{\prime}}})
We first show that is -eliminable in {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{F}}}^{\prime}, by showing that any modular node in {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{F}}} is transformed into a modular node in {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{F}}}^{\prime}. We argue by considering the relative position of and in {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}:
()
Since {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}} and are coherent in {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}, and all nodes are modular, each such node must be a terminal node of some of the {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{F}}}_{l}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle (see Fig. 6(a)). In fact, if were a terminal node of some {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{D}}}_{jk}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle, then either {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{D}}}_{jk}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle=g(Y)^{\mathbin{\overline{\phi(g(Y))}}}, which contradicts the assumption that {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}} and are coherent, or its distance from is greater than 2, against the assumption that is modular. Now, since all nodes in {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{F}}}_{l}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle which are not labeled with {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}} are not “moved” by the reduction rule (see Fig. 6(a)), and no new node labeled is created by (since otherwise it should come from a node with same label in some {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{D}}}_{jk}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle), all nodes in {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{F}^{\prime}}} are modular, whence is -eliminable in .
()
First, if occurs within either the {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{D}}}_{jk}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle or the {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{F}}}_{l}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle, then one can check that, by the transformation from {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{F}}} to {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{F}^{\prime}}}, the relative positions between the nodes and in coincide with the relative positions between the nodes and , and thus all modular nodes in {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{F}}} yield modular nodes in {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{F}}}^{\prime}.
Suppose now is among some set (see Fig. 6(a)). One can check that for all node occurring in within one of the {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{D}}_{jk}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle, if, in the transformation of {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{F}}} in {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{F}}}^{\prime}, is transformed into , then in {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}} is the same as in {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}^{\prime}. Moreover, it is clear that cannot be the head of the sub-tree rooted in , and that if has no parallel node with same label, so does . Hence, if is modular, so is .
()
If a modular node in {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}} is transformed into some node in {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}^{\prime}, then is modular too. In fact, no such can be actually moved by the reduction rule, since the only possibilities are that either or coincides with one of the {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{F}}}_{l}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle. Since neither the node is moved, we deduce that has the same distance from than has from , that it has no parallel node with same label and cannot be the head of the sub-tree rooted in , whence is modular.
(
We can argue as in the case above, since the transformation from {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{F}}} to {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{F}^{\prime}}} cannot move any node .
We conclude then that, for all , is -eliminable. It remains to check that for all , and are coherent. It can be checked that for any parallel nodes in , and are parallel in . Hence, if and are not coherent, then and are not coherent, against the assumption.
∎
Let us call a -eliminable variable -canceling in the following cases:
- •
is the root of a positive tree as in Fig. 6(a) left, where c={\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathrm{blue}}}, and no node in any sub-tree {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{F}}_{l}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle has label {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}};
- •
is the root of a positive tree as in Fig. 6(b) left, c={\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathrm{red}}} and no node in any sub-tree {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{F}}_{l}\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\right\rangle has label {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}};
- •
is the root of a negative tree as in Fig. 6(c) left, c={\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathrm{blue}}} and no node in any sub-tree {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{F}}_{l}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle has label {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}};
- •
is the root of a negative tree as in Fig. 6(d), c={\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathrm{red}}}, and no node in any sub-tree {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{F}}_{l}\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\right\rangle has label {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}.
In fact, is -canceling precisely when by applying a -reduction step, the action of the substitution from Fig. 6 is empty, so that the whole left-hand part of the tree, including some of its bound variables, is erased. Observe that, if is not -canceling, and , then the application from a bound variable of to a bound variables of from which “comes from” is a surjective function .
Moreover, let us call a standard reduction least-canceling if for all -canceling variable , a reduction is performed only after all bound variables occurring above the node are eliminated. Let us indicate by that reduces to by a sequence of least-canceling standard reductions.
Using Lemma 5.5 we can prove:
Theorem 5.6**.**
* is coherent iff strongly converges under standard reduction.*
Proof.
Suppose is coherent. From Lemma 5.5 we deduce that if , then either or for some . Since sequences of standard reductions terminate, we deduce that must in the end converge onto some simple tree.
Conversely, suppose strongly converges under . Since all standard reductions converge, there must be a converging least-canceling standard reduction . Let and . Using the fact that the variables are pairwise coherent and include all bound variables of , one can check that and are well-defined and is -coherent. ∎
Using Lemma 5.3 we further deduce:
Corollary 5.1**.**
Let be a type of . If {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(A) is coherent, then there exists a -type such that .
5.3 The Characteristic
We now introduce a refined condition for coherent trees, which can be used to predict whether a type rewrites into a finite type (i.e. one made up from only) or into one using -constructors.
An intuition from Section 2 is that, for a type of the form \forall X.(A\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}})\Rightarrow B\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle (which rewrites into B\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\mapsto\mu X.A\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle\right\rangle) to reduce to one without -types, the variable must not occur in at all. However, the property “ does not occur in ” need not be preserved under reduction. Instead, we will define a stronger condition that is preserved by standard reduction by inspecting a class of paths in the tree of a type.
Definition 5.7**.**
Let be a polynomial -tree and let indicate the natural order on the nodes of having the root of as its minimum. A down-move in is a pair , such that, for some bound variable , is an -pair and is modular. An up-move in is a pair such that , is a modular node with immediate predecessor , for some , and . An alternating path in is a sequence of nodes such that is a down-move and is an up-move.
In Fig. 9(b) are illustrated some alternating paths. Observe that whenever {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}} occurs in A\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle, we can construct a cyclic alternate path in the tree of \forall X.(A\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}})\Rightarrow B\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle: down-move from an occurrence of {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}} in to the modular node labeled {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}, then up-move back to {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}. We deduce that if no cyclic alternate path exists, then any subtype of the form above must be such that {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}} does not occur in . This leads to introduce the following:
Definition 5.8**.**
For any polynomial tree , the characteristic of , is defined as follows: if is coherent, then if it has no cyclic alternating path, and if it has a cyclic alternating path; if is not coherent, .
The characteristic is indeed stable under standard reduction:
Lemma 5.7**.**
For all , if reduces to by standard reduction, then .
Proof.
If the claim is trivial. If , then by Lemma 5.5, .
Suppose now . We must show that there is no cyclic alternate path in , on the assumption that there is no cyclic path in . Suppose is obtained by a reduction as the one in Fig. 6(a). As in the proof of Lemma 5.5, for any node of , let be the unique node in “comes from”. We will show that any alternating path from to in induces an alternate path from to in . From this fact it immediately follows that , since any cyclic path in would induce a cyclic path in , against the assumption that .
First observe that if is a modular node in , then is a modular node in . In fact one can check that:
- •
if is the head of the sub-tree of rooted in , then also is the head of the sub-tree of rooted in (it suffices to check for the cases and );
- •
if , then (again, one has to check the cases and );
- •
if has a parallel node , then also has a parallel node with .
From this it follows that if is a down-move in ; then is a down-move in . Moreover, if is an up-move in , then two possibilities arise:
- •
is a modular node occurring either in some of the {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{D}}}_{jk}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\mapsto{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\bullet}}\right\rangle or of the {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{F}}}_{l}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\theta\right\rangle, and is a terminal node in the same sub-tree. Then is a modular node occurring either in some copy of {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{D}}}_{jk}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle or in {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{F}}}_{l}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle and is a terminal node in the same sub-tree, so we conclude that is an up-move in .
- •
is a modular node occurring in some copy of {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{F}}}_{l}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\theta\right\rangle, and is a terminal node in the sub-tree {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{D}}}_{jk}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\mapsto{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\bullet}}\right\rangle which is on top of {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{F}}}_{l}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\theta\right\rangle. Then is modular in and by construction there exists a terminal node \alpha:{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}} in {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{\mathsf{F}}}_{l}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\theta\right\rangle, a modular node \beta:{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}} in {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{D}}}_{jk}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle, so that there is an alternate path in , as illustrated in Fig. 10.
We conclude that if is an alternate path in , then we can find an alternate path in .
A similar argument can be developed for the other tree reduction rules. ∎
Using the observation above and Lemma 5.7 we can easily prove:
Proposition 5.8**.**
Suppose and reduces to by standard reduction. If , then , and if , then .
For a -type , we can define its characteristic as \kappa(A)=\kappa({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(A)). From Prop. 5.8 and Lemma 5.3 we deduce then a new criterion for finiteness:
Corollary 5.2**.**
Let be a closed -type. If , then .
The criterion based on the characteristic can be used to capture yet more finite -types. In fact, whenever a type reduces to a type with characteristic [math], we can deduce that . Note that such a type need not even be coherent. For instance, the (tree of) the type A=\forall XY.(\forall Z.(({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Z}}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Z}})\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}})\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}})\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Y}}\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}, is not coherent (since the variable is not eliminable), but reduces, by eliminating , to (the tree of) \forall Y.{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Y}}\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}, which has characteristic [math], and in fact we have that .
As this example shows, a type can reduce to a finite sum even if some of its subtypes cannot be similarly reduced. In fact, while we can eliminate all quantifiers from the type above, we cannot do this from its subtype \forall Z.(({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Z}}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Z}})\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}})\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}). By contrast, in the next section we show that the characteristic satisfies nice compositionality conditions that will allow us to define suitable fragments of .
6 Preliminaries on Theories of Program Equivalences
After developing the rewriting theory of Yoneda Type Isomorphisms, our goal in the next section will be to exploit the correspondence it provides between polymorphic and monomorphic types to investigate properties of program equivalence in . In this section we introduce the fundamental notions of type systems and program equivalence we will be concerned with.
The terms of are generated by usual -calculus constructors, i.e. variables , application and abstraction , plus polymorphic constructors , for all type and for all . The terms of (and its -free fragment ) involve, in addition to the constructors for , the following constructors: product constructors , (); sum constructors () and for all type ; the constructor ; the 0 destructors , for all type ; fixpoints constructors for any type .
Notation 6.1**.**
Let be a list. If is a -indexed list of terms, we let for any term , be shorthand for ; if is a -indexed list of variables, we let for any term , be shorthand for .
The typing rules of and are recalled in Fig. 11(a)-11(b). and -rules are recalled in Fig. 11(c)-11(d) and 11(e). We let the -theory of (and its fragments) be the smallest congruent theory closed under and rules.
In addition to the -theory, in the next sections we will investigate two other theories: the one arising from contextual equivalence and the -theory.
Definition 6.1**.**
The contextual equivalence relation for and is defined by
* iff for all context , *
The contextual equivalence relation for is defined by
* iff for all context , *
It is a standard result that contextual equivalence (for either or ) is closed under congruence rules and thus generates an equational theory .
An equational theory for is consistent when it does not contain the equation . Similarly, an equational theory for is consistent when it does not contain the equation . It is well-known that is the maximum consistent theory (both for and ).
To introduce the -theory we first recall how positive types A\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle and negative type B\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\right\rangle are associated with functors and . We let , and for all ,
[TABLE]
One can check that and \Phi_{A}^{X}(t[u[x]])\simeq_{\beta}\Phi_{A}^{X}(t)\Big{[}x\mapsto\Phi_{A}^{X}(u)\Big{]}.
The definition above can be extended to the types defined using all other constructors, yielding functors and .
For simplicity, we will define the -theory for an ad-hoc fragment of , in which types are restricted so that a universal type is always of one of the two forms below:
[TABLE]
As this set of types is stable by substitution, all type rules and equational rules of scale well to . We will meet again this subsystem of in the next section as well as in App. B.
To each universal type of as in Eq. (10) left we can associate an equational rule, that we call a -rule, illustrated in Fig. 12(a); similarly, to each type as in Eq. (10) right we can associate a -rule as illustrated in Fig. 12(b).222Observe that might well be of both forms (10) left and right. From the viewpoint of category theory, the two -rules for a type correspond to requiring that the transformations induced by a polymorphic programs of type are strongly dinatural [41], or, in other words, that the diagrams illustrated in Fig. 12(c) and Fig. 12(d) commute.
Definition 6.2** (-theory).**
The -theory of is the smallest congruent equational theory closed under -, -equations as well as -rules.
For the interested reader, in App. A we check in detail that the isomorphisms \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}},\equiv_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}} hold under the -theory of .
We recall in Fig. 13(a) and 13(b) the usual embedding ♯ of into . It is well-known that -equivalent terms of translate under ♯ into -equivalent terms of , and that -equivalent terms of translate under ♯ into terms which are equivalent up to dinaturality (see [32, 19]), that is, into -equivalent terms of . Moreover, for all -type we can define terms \mathsf{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{A}}[x]:A\vdash_{\mathsf{\Lambda 2p_{\mu\nu}}}A^{\sharp} and \mathsf{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}^{-1}_{A}}[x]:A^{\sharp}\vdash_{\mathsf{\Lambda 2p_{\mu\nu}}}A (as illustrated in Fig. 14). It is a good exercise with -rules to check that and hold.
Remark 6.1**.**
It is easily checked that for all type of , holds, the only non immediate case being
[TABLE]
7 System F with Finite Characteristic
In this section we show that Yoneda reduction can be used to characterize the -theory in some fragments of . We introduce two fragments of in which types have a fixed finite characteristic, and we show that the -theory for such fragment can be computed by embedding polymorphic programs into well-known monomorphic systems.
We recall that the free bicartesian closed category is the category and the free cartesian closed -bicomplete category [34, 8] is the category . We will show that, under the -theory, is equivalent to and is equivalent to . We will then use this embedding to establish that this theory is decidable in the fragment of characteristic 0 (where it also coincides with contextual equivalence) and undecidable in the fragment of characteristic 1.
7.1 The Systems and
We first have to check that the types with a fixed finite characteristic do yield well-defined fragments of . This requires to check two properties. First, the characteristic has to be compositional: a subtype of a type of characteristic cannot have a higher characteristic, since every subtype of a type of the fragment must be in the fragment itself. Second, since a universally quantified variable can be instantiated with any other type of the fragment, the characteristic must be closed by instantiation: if and have characteristic , then must have characteristic (at most) .
Lemma 7.1**.**
(compositionality)
If is a sub-type of , then .
(closure by instantiation)
.
Proof.
If and {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(B) is -coherent, then {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(A) is -coherent, where is the restriction of to . Moreover, it is clear that any cyclic alternate path in {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(A) yields a cyclic alternate path in {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(B).
The set can be identified with , where indicates disjoint union is the number of occurrences of in . Suppose {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(\forall X.A) is -coherent and {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(B) is -coherent, and let ; we claim that {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(A[B/X]) is -coherent. First, any bound variable in is coherent with any bound variable within any of the copies of in . Moreover, one can check that if an alternate path starts somewhere in the tree of and enters the sub-tree corresponding to a copy of , then the path must end within this sub-tree, since in any alternate path starting from (a copy of) all labels are bound variables of (this copy of) , which are disjoint from all other bound variables. We deduce then that a cyclic alternate path in the tree of can only be a cyclic alternate path in either {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(A) or in one copy of {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(B). Since both cases are excluded by assumption, no alternate cyclic path exists. ∎
Thanks to Lemma 7.1 the following fragments can be seen to be well-defined.
Definition 7.1** (Systems ).**
For , let be the subsystem of with same typing rules and types restricted to the types of of characteristic .
7.2 Embedding and into Monomorphic Systems
The standard embedding ♯ of into recalled in the previous section restricts to an embedding of and in and , respectively. As this embedding preserves and -rules up to the -theory, it yields then a functor , which restricts to a functor from to .
We will now define a converse embedding from (resp. ) into (resp. ), yielding a functor , restricting to a functor from to .
The embedding of types
Recall that from Proposition 5.8 we already know that the types of (resp. ) are isomorphic, modulo the -theory, to types of (resp. ). In fact, since all isomorphisms are valid under the -theory, we can obtain from any standard reduction of the tree of , using Prop. 5.8. However, since our goal is to also embed the terms of into , we cannot define ♭ starting from an arbitrary standard reduction, since we need the map to satisfy two additional properties. First, it has to commute with substitutions, i.e. ; second, we need the embedding to be compositional, meaning that the translation of a complex type can be reconstructed from the translation of its subtypes.
When is a valuation of such that is -coherent, we call simply a coherent valuation of . We call a reduction uniform if it is standard and satisfies the following two properties:
- •
for all , no bound variable occurs in in the scope of the quantified variable ;
- •
if , then .
We indicate a uniform reduction as . In other words, a uniform reduction only eliminates a quantifier after having eliminating all quantifiers in its scope, and when a quantified variable is copied by the effect of some other reduction, all copies of are reduced using the same rule.
Any uniform reduction that converges to a simple polynomial trees induces a coherent valuation of , where is the unique such that for all such that , . We call the valuation the skeleton of the reduction. Conversely, given a coherent valuation of one can construct a uniform reduction of of which is the skeleton.
The following lemma states that the normal form of a uniform reduction is completely determined by its skeleton.
Lemma 7.2**.**
If two convergent uniform reductions , and have the same skeleton , then .
Proof.
Let the depth of a variable be the number of distinct bound variables within its scope. Let us call a uniform reduction hierarchical if any variable of depth is eliminated only after all variables of depth have already been eliminated. It is not difficult to check by induction on the length of reductions that (1) any uniform reduction can be transformed into a hierarchical uniform reduction converging onto the same polynomial tree, (2) two hierarchical uniform reductions with same skeleton converge onto the same polynomial tree. The claim then follows from (1) and (2). ∎
We indicate the unique result of a converging uniform reduction from with skeleton simply as .
For all polynomial tree , let be the tree obtained by switching colors on all labels. For all polynomial trees , and variable , we let be the result of replacing all terminal nodes of labeled {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}} by and all terminal nodes of labeled {\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}} by .
Lemma 7.3**.**
- i.
If and , then .
- ii.
If , then .
Let be a coherent polynomial tree. We define a coherent valuation using the well-known strongly connected components algorithm for 2-SAT [3] (see Remark 5.1). We recall that a direct graph is skew symmetric if there exists an involution such that for all , iff .
Let be the directed skew-symmetric graph with vertices the colored variables , for all and , symmetry , and with edges if is not -eliminable and , if is incoherent with . Let if there is a directed path in from to and a directed path from to . The equivalence classes of are usually called strong connected components of . Observe that a strong connected component cannot contain both and (otherwise would not be coherent). Let be the directed graph with vertices the strong connected components of and an edge if there is and and an edge in . is then a directed acyclic graph, inducing thus an order relation on . We now define a map as follows: let us split in its connected components ; for each component , choose a linear ordering of its vertices, compatible with the order . We define a partial function by induction on :
- •
for all , set ;
- •
for all , if is not yet defined, set .
Finally let . One can check then that is a coherent valuation of .
Lemma 7.4**.**
If and are coherent and , then is coherent and .
Proof.
We have that , where occurs times in . Observe that in any bound variable coming from a copy of is coherent with any bound variables coming from . Hence, if we construct the graph of the strongly connected components, the variables from and those from the copies of belong to different connected components of . Thus, since by construction the value only depends on the connected component of in , we deduce that .
Using this fact along with Lemma 7.3 we deduce the existence of two uniform reductions and with the same skeleton, so using Lemma 7.2 we deduce our claim. ∎
We can now define as follows:
Definition 7.2**.**
For all , we let A^{\flat}:=\tau(\phi_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(A)}({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(A))).
From Lemma 7.4 we immediately deduce that . Moreover, we can check that if , then and that, if , then since is obtained by uniform reduction, we can suppose that {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{t}}}(A)\leadsto_{\mathsf{\mathsf{uni}}}{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}^{\prime}\leadsto_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}}{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}^{\prime\prime}, where \tau({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}^{\prime\prime})=A^{\flat} and \tau({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}^{\prime})=\forall X.C^{\flat}, and since is eliminable in {\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{\mathsf{E}}}^{\prime}, must have one of forms below
[TABLE]
for given types which are strictly less complex than .
The Embedding of Terms
Using the properties of the embedding of type just defined as well as the terms for the Yoneda type isomorphisms from App. A, we can define the embedding of terms from to .
Given (resp. ), we define a term such that (resp. ) holds by induction on . If , we let , if , we let and if , we let . The case of and are less obvious:
- •
if , then and by the induction hypothesis . Moreover, we can suppose that is of one of the forms of Eq. (11). Hence we must consider two cases:
- a.
A^{\flat}=B^{\flat}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\mapsto\mu X.\sum_{k}\prod_{j}A_{jk}^{\flat}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle\right\rangle. Then we let t^{\flat}=\mathtt{s}_{{A_{jk}^{\flat}},{B^{\flat}}}\Big{[}u^{\flat}[X\mapsto\mu X.\sum_{k}\prod_{j}A_{jk}^{\flat}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle]\Big{]}.
- b.
A^{\flat}=B^{\flat}\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\mapsto\nu X.\prod_{j}A_{j}^{\flat}\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\right\rangle\right\rangle. Then we let t^{\flat}=\mathtt{u}_{{A_{j}^{\flat}},{B^{\flat}}}\Big{[}u^{\flat}[X\mapsto\nu X.\prod_{j}A_{j}^{\flat}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle]\Big{]}.
where for the terms and see App. A.
- •
if , then and by the induction hypothesis we have . Moreover we have and as above we can suppose that is in one of the forms in Eq. (11), so we consider again two cases:
- a.
If (\forall X.C)^{\flat}=B^{\flat}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\mapsto\mu X.\sum_{i}\prod_{j}A_{jk}^{\flat}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle\right\rangle, then we let .
- b.
If (\forall X.C)^{\flat}=B^{\flat}\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\mapsto\nu X.\prod_{j}A_{j}^{\flat}\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\right\rangle\right\rangle, then we let .
where for the terms and see App. A.
Using the constructions above it is a simple exercise to define explicit isomorphisms ({\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{d}}_{A}[x],\mathtt{d}_{A}^{-1}[x]):A\vdash A^{\flat} for all type of .
7.3 The equivalence of with
The two functors ♯ and ♭ preserve all the relevant structure (products, coproducts, exponentials, initial algebras, final coalgebras), but they are not strictly inverse: is not equal to , but only -isomorphic to it (e.g. for A=\forall X.((\forall Y.{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{Y}}\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}})\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}})\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}, we have and (A^{\flat})^{\sharp}=\forall X.{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}). Nevertheless, we will establish that the following equivalences hold:
Theorem 7.5**.**
- i.
. 2. ii.
.
The proof of Theorem 7.5 is done by checking (by way of -, - and -rules) that both and embed fully in , using the lemma below (with , , and ).
Lemma 7.6**.**
Let be full subcategories of a category . Let be surjective and suppose there is a map associating each object of with an isomorphism in . Then extends to an equivalence of categories .
Proof.
Let and . is clearly faithful and surjective. It is also full since for any there exists such that .∎
Let , and let . We know that there is a surjective map as well as isomorphisms in . Thus, to apply Lemma 7.6 it remains to check that and are full subcategories of . Concretely, this means checking that:
- •
for any term in which are -types we can find a term such that holds;
- •
for any term in which are types of we can find a term such that holds.
This is where we will actually use our embeddings, since we take in the first case and in the second case. The verification of involves both - and -equations and is postponed to App. B.
7.4 Program Equivalence in is decidable.
Theorem 7.5 can be used to deduce properties of program equivalence in and from well-known properties of program equivalence for and . In fact, it is known that -equivalence in (i.e. arrow equivalence in ) is decidable and coincides with contextual equivalence [36], while contextual equivalence for is undecidable [8]. Using Theorem 7.5 we obtain similar facts for and :
Theorem 7.7**.**
The -theory for is decidable and coincides with contextual equivalence.
The first claim of Theorem 7.7 is proved by defining a new embedding of into , exploiting the well-known fact that for the terms of the system one can obtain a normal form under -reduction and commutative conversions [39]333Actually, [39] does not consider commuting conversions for [math], but these can be added without altering the existence of normal forms.. Using the isomorphisms between and , a term such that holds is first translated into (where ), and then is defined as the normal form of . From the fact that and that is in normal form, we can deduce that holds, so the embedding is well-defined.
Using the embedding we prove the proposition below, from which the claim of Theorem 7.7 descends (using the fact that and coincide and are decidable in ).
Proposition 7.8**.**
The following are equivalent:
- i.
*; *
- ii.
.
- iii.
.
Proof.
(i. ii.)
Since is the maximal consistent theory, it is clear that .
(ii. iii.)
Suppose . Since and coincide in , there exists a context such that . Observe that this also implies , where .
Let be , where . Then and .
Let now be the context , so that . We also have by Th. B.2 in App. B. We now have , so we can conclude that .
(iii. i.)
This immediately follows from the fact are obtained from by applying isomorphisms relative to -equivalence.
∎
7.5 Program Equivalence in is undecidable.
It is well-known that contextual equivalence is undecidable in [8]. From this fact we can easily deduce, using the encoding ♯, that contextual equivalence is also undecidable in .
We do not know if the -theory and contextual equivalence coincide in , as it is not clear whether the embedding scales to : this depends on the existence of normal forms for commutative conversions, which are not known to hold in presence of -types (although this is conjectured in [24]).
For this reason, we think it’s worth to provide a direct argument for the undecidability of the -theory in . The correspondence between universal types in and -types provides a way to compute -equivalence in an indirect way. In fact, the -rule for a type of can be interpreted as a principle expressing the uniqueness of a function defined by an inductive/co-inductive principle. For example, in the case of the type \mathtt{int}=\forall X.({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}})\Rightarrow({\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}), from the isomorphism \mathtt{int}\equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}}\mu X(X+1) we deduce the validity of the -rule in Fig. 15(a). Let , , (the successor function) and {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}} be given by some function . Then the -rule yields the uniqueness rule in Fig. 15(b), which expresses the uniqueness of functions defined by iterations.
We will exploit this correspondence to establish the undecidability of the equivalence generated by -rules from the result below.
Theorem 7.9** (Okada, Scott).**
Let be a system containing the type of integers (with terms and ), closed by arrow types and having, for all type a recursor satisfying
[TABLE]
Let be an equivalence over containing and closed by the following rule:
[TABLE]
for all and . Then is undecidable.
Let us first show that we can restrict to a weaker rule:
Lemma 7.10**.**
The rule (U) is deducible from the rule
[TABLE]
Proof.
Let . Since and , by (wU) we deduce .
Now, if holds, by (wU) we deduce and by composing this with the equivalence above we finally get . ∎
We now establish some preliminary properties of -equivalence over the type . For simplicity, we will work in an extension of with product types. We let and , .
Lemma 7.11**.**
- •
.
- •
.
Proof.
We prove both results as a consequence of unicity of iteration. If , then and , whence by unicity .
Let {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}[x]:=x(\mathtt{int}\times\mathtt{int})\lambda y.\langle\mathsf{s}(\pi_{1}y),\pi_{1}y\rangle\langle\mathsf{0},\mathsf{0}\rangle. We have and, since \mathsf{P}(\mathsf{s}x)\simeq_{\beta}\pi_{1}{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}[x], and \pi_{1}{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}[\mathsf{s}x]\simeq_{\beta}\mathsf{s}(\pi_{1}{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}[x]), we have \mathsf{P}(\mathsf{s}(\mathsf{s}x))\simeq_{\beta}\mathsf{s}(\pi_{1}{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}[x])\simeq_{\beta}\mathsf{s}(\mathsf{P}(\mathsf{s}x)), so by unicity we conclude . ∎
To apply Theorem 7.9 we will exploit the type . Observe that is isomorphic to the non-polymorphic type . Using Lemma 7.11, it can be checked by induction that the term given by yields, for all types of , a recursor in under .
Proposition 7.12**.**
The rule (U) holds in under with as recursor.
Proof.
Let be the term . We claim that . In fact , by Lemma 7.11. Let now . If , we deduce, by the -rule in Fig. 16 with , that . By what we just proved this implication corresponds to the rule (wU), so we can conclude by Lemma 7.10. ∎
We can thus finally conclude:
Theorem 7.13**.**
Both the -theory and contextual equivalence for are undecidable.
8 Program Equivalence and Predicativity
In this section we sketch an example of how the correspondence between the polymorphic system and the monomorphic system can be used to prove non-trivial properties of program equivalence in .
A main source of difficulty to compute program equivalence of polymorphic programs is that, while these can be instantiated at any type, programs with different type instantiations can behave in the same way. This is made evident by the -rules from Fig. 12(a) and Fig. 12(b), which allow one to permute an instantiation on a type into one on any type , provided there is a suitable term {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}t}[x]:A\vdash^{\Gamma}B.
A natural question is thus whether one can use such rules to turn a program into one with instantiations of lower complexity. This cannot be possible in all cases since the so-called predicative fragments of , that is the subsystems of in which type instantiations must satisfy some complexity bound, are known to be strictly less expressive than (see for instance [23]). However, using the correspondence between universal types in and initial algebras, we will deduce a useful sufficient condition under which this simplifications can be put forward in .
After presenting this condition, we will use it to provide a quick proof based on type isomorphisms of a result that was established in [31] by the same authors by computing -rules directly: any polymorphic program in a certain fragment of (in fact, a fragment of ) arising from the encoding of finite sum and product types, can be transformed into one containing only atomic instantiations.
We first illustrate our idea with an example.
Example 8.1** (pointwise induction).**
Suppose we recursively define a function by “-induction on ”: we let be some fixed function and we let be the function , for some . In fact, since the variable is used as a parameter, we could equivalently define by “-induction on ”: we let be some fixed , and be , so that .
A bit more formally, the argument from Example 8.1 shows the equivalence of the two contexts {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{C}_{1}}=[\ ](A\Rightarrow B)(\lambda fx.h(fx))(u) and {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{C}_{2}}=\lambda x.[\ ](B)(h)(ux) of type . Observe that these two contexts are not -equivalence and, in particular, that they differ for the fact that the second contains a type instantiation which is strictly less complex than the one of the first.
We can formalize the notion of being “less complex” as follows: given a type of , we let the set of right simplifications of be inductively as follows:
[TABLE]
Moreover, for all type , we let indicate the rightmost variable of .
The reasoning from Example 8.1 can be justified at a more abstract level by exploiting the isomorphism \mathtt{int}\equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}}\mu X.{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}+1, which shows that is isomorphic to the initial -algebra. In fact, by appealing to initial algebras we can justify similar arguments for a large class of inductive types like , that we define as follows (essentially following a terminology from [31]): let us call a type polynomial when it is of the form
[TABLE]
and let us call constant if does not occur in any of the . This terminology is justified by the isomorphism
[TABLE]
showing that the universal type coincides (under the -theory) with the initial \sum_{k}\prod_{j}A_{jk}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle-algebra. Note that the fixpoint binder occurs precisely when is non-constant.
Let a -algebra be a triple made of a context , a type and terms u_{k}:\langle x_{j}:A_{jk}\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\mapsto C\right\rangle\rangle_{j}\vdash^{\Gamma}C, and a -algebra morphism from to be an inclusion 444We consider here context inclusions for simplicity but one might rather consider a context morphism. and a term such that
[TABLE]
The pair , where is the term
[TABLE]
is the initial -algebra, that is, the initial object in the category of -algebras and -algebra morphisms. This means in particular, that for all -algebra , one can define a context
[TABLE]
called -induction on , which is a -algebra morphism which satisfies the following universal property: for all -algebra morphism from the initial -algebra to , .
In Example 8.1 first observe that the type is of the form , where is a polynomial type. The two ways of defining our function correspond to two -algebras and . These are related by the -algebra morphism ; moreover, the two contexts {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{C}}_{1} and {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{C}}_{2} correspond to the associated -induction morphisms (respectively on and ). We can then deduce the equivalence {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{C}}_{1}\simeq_{\varepsilon}{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{C}_{2}} from the fact that is the initial -algebra.
The moral of this argument is that one can simplify the type of a -induction whenever one has a -algebra morphism which is an elimination context.
Definition 8.1** (elimination and introduction contexts).**
Elimination contexts* and introduction contexts for are defined by the grammars*
[TABLE]
A pair of dual contexts (noted ({\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{El}},{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{In}})_{A\vdash B}) is a pair made by an elimination context {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{E}}:A\vdash B and an introduction context {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{I}}:B\vdash A such that {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{I}}\circ{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{E}}\simeq_{\eta}[\ ].
For any type and right simplification , we can always construct a pair of dual contexts ({\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{El}},{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{In}})_{A\vdash B} by letting {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{El}} be followed by type and term variable applications and {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{In}} be made of abstractions on the same variables. For example, if and , then we can let {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{El}}=[\ ]XyZ and {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{In}}=\Lambda X.\lambda y.\Lambda Z.[\ ].
The lemma below generalizes to an arbitrary polynomial type the reasoning of Example 8.1, allowing to turn a induction on into a -induction on , for :
Lemma 8.1** (simplification lemma).**
Let be a polynomial type, be a -type, , and ({\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{El}},{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{In}})_{A\vdash B} be a pair of dual contexts. If {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{El}} is a morphism between two -algebras and , then
[TABLE]
Proof.
Since {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{El}}\big{[}[\ ](A)\langle\lambda\langle x_{j}\rangle_{j}.u_{k}^{A}[\langle x_{j}\rangle_{j}]\rangle_{k}\big{]} and are both -algebra morphisms from the initial -algebra to , initiality implies that they are -equivalent. The claim then follows by applying -equivalences. ∎
When is a constant polynomial type, from Lemma 8.1 we can deduce a rather striking fact: any type instantiation of the initial algebra on a type can be atomized, i.e. transformed into a term using a type instantiation on the variable .
Let us fix, for all type , a pair of dual contexts ({\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{El}}_{A},{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{In}}_{A})_{A\vdash\mathsf{at}(A)}.
Lemma 8.2** (atomization lemma).**
For all constant polynomial type and type of ,
[TABLE]
Proof.
Since is constant, for any choice of , A_{jk}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\mapsto B\right\rangle=A_{jk} and . This implies that, given the context \Gamma=\{\big{\langle}y_{k}:\langle{A_{jk}}\rangle_{j}\Rightarrow B\big{\rangle}_{k}\}, {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{El}}_{B} is trivially a -algebra morphism from to (\Gamma,\mathsf{at}(B),\langle{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{El}}_{B}[y_{k}\langle x_{j}\rangle_{j}\rangle_{k}]). We then have
[TABLE]
[TABLE]
where the last term is the desired one. ∎
While the lemma above is rather technical, it has a rather intuitive explanation: it permits to transform any instantiations of a type of the form , where is a constant polynomial type, into an atomic instantiation, preserving the contextual behavior of the program. This property can be restated as the existence of an embedding between the fragment (see [31]) of (in fact, of ) in which all universal types are of the form , for some polynomial type , and the predicative fragment of (see [15]), in which all type instantiations are atomic.
Theorem 8.3** (atomizing embedding).**
If , then there exists a term such that and .
Proof.
is obtained by replacing in any subterm of the form , with non-atomic, as in Eq. (14).
∎
Remark 8.1** (Comparing predicative and impredicative embeddings of ).**
The result above is discussed in [31] in connection with some results from [15], which describes a variant FF of the standard embedding ♯ of into whose target is the predicative systems . In fact, by composing ♯ with atomization one obtains an embedding of into which is -equivalent to FF. From this fact we deduce that the standard embedding and the predicative variant from [15] are indeed -equivalent.
9 Conclusion
Related Work
The connection between parametricity, dinaturality and the Yoneda isomorphism is well-known [7, 32, 19]. The extension of this correspondence to initial algebras comes from [41]. [9] exploits this connection to define a schema to test the equivalence of two programs of type \forall X.(F\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}})\Rightarrow(G\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle\Rightarrow X^{\prime})\Rightarrow H\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle by first instantiating as \alpha=\mu X.F\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle and then applying to the canonical morphism F\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\mapsto\alpha\right\rangle\Rightarrow\alpha (in fact, this is exactly how one side of the isomorphisms \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}} are constructed). The possibility of expressing program equivalence through naturality conditions has recently attracted new attention due to [4], where these are investigated using ideas from homotopy type theory. Type isomorphisms in with the Yoneda lemma are also discussed in [20]. In [30] a similar restriction based on the Yoneda isomorphism is used by the first author to describe a fragment of second order multiplicative linear logic with a decidable program equivalence.
Future Work
The definition of the characteristic employs an acyclicity condition which is reminiscent of linear logic proof-nets. In particular, we would like to investigate whether the alternating paths can be related to the cyclic proofs for linear logic systems with -types [6]. Moreover, the notion of characteristic seems likely to scale to second order multiplicative-exponential linear logic, an extension which might lead to better expose the intrinsic duality in the tree-shapes in Fig. 6.
The connection between Yoneda type isomorphisms and proof-search techniques suggests to look for canonical proof-search algorithms for and (for instance using focusing as suggested in [35]). Moreover, the appeal to least/greatest fixpoints suggests a connection with the technique to count inhabitants by computing fixpoints of polynomial equations [44]. For example, given A=({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}_{1}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}})\Rightarrow({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}_{2}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}})\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}, one can show by proof-theoretic reasoning that the number of inhabitants of is a solution of the fixpoint equation , where A_{Y_{i}}=({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}_{1}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}})\Rightarrow({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}_{2}\Rightarrow{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}})\Rightarrow{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}_{i}, which implies , since . On the other hand, Yoneda type isomorphisms yield the strikingly similar computation \forall\vec{Y}X.A\equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}}\forall\vec{Y}.\mu X.{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}_{1}+({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\times{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}_{2})\equiv_{\vec{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{Y}}}}\mu X.0+({\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\times 0)\equiv 0.
Finally, we would like to explore an apparent correspondence between Yoneda type isomorphisms of the form
[TABLE]
and the so-called inversion principles discussed in the proof-theoretic literature (see [26]), which relate introduction and elimination rules for generalized connectives [33, 38, 5] (for example, the isomorphism
[TABLE]
encodes the symmetry between rules for a ternary connective as shown in Fig. 17).
Appendix A The -Theory and the Yoneda Isomorphisms
We prove that the isomorphisms \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}} and \equiv_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}} hold under the -theory. Let us start from \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}}, recalled below:
[TABLE]
In the case of Eq. (15) we can construct terms
[TABLE]
where T\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle=\sum_{k}\exists\vec{Y}_{k}.\prod_{j}A_{jk}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle and \alpha=\mu X.T\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle, and are defined composing usual sum and product constructors, and is defined as follows:
[TABLE]
With such terms we can then construct a term
[TABLE]
Moreover, using sum and product destructors we can construct terms
[TABLE]
where \Delta=\{\langle f_{k}:\forall\vec{Y}_{k}.\langle A_{jk}\left\langle{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}\mapsto Z\right\rangle\rangle_{j}\Rightarrow Z\rangle_{k}\} and
[TABLE]
where and indicate suitable generalized product and sum destructors which can be defined inductively using product and sum destructors, and the term is defined as follows:
[TABLE]
One can check that \mathtt{b}[x,{\alpha}]\big{[}\langle f_{k}\mapsto\hat{\mathtt{a}}_{k}\rangle_{k}\big{]}:T\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\mapsto\alpha\right\rangle\vdash\alpha is -equivalent to , from which we deduce
[TABLE]
In this way the isomorphism \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}} are realized in by the two terms below:555We are here supposing that does occur in at least some of the (so that actually occurs in the left-hand type of \equiv_{{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}}). If this is not the case, the construction can be done in a similar (and simpler) way.
[TABLE]
We can compute then
[TABLE]
and
[TABLE]
[TABLE]
where the central -equivalence is justified using the -rule in Fig. 12(a) with , , and , with the last premise given by the computation below:
[TABLE]
[TABLE]
[TABLE]
where the last -equation can be checked by unrolling the definition of :
[TABLE]
Let us now consider the isomorphism \equiv_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}}, recalled below:
[TABLE]
We can define terms666We are here supposing that does occur in at least some of the (so that actually occurs in the left-hand type of \equiv_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}}). If this is not the case, the construction can be done in a similar (and simpler) way.
[TABLE]
where U\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle=\forall\vec{Y}_{j}.\prod_{j}A_{j}\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle and \beta=\nu X.U\left\langle{\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}{X}}\right\rangle, and a term
[TABLE]
Moreover, using product constructors we can construct a term
[TABLE]
with and a term
[TABLE]
where \mathtt{v}_{A_{j},B}[x,Z]=\lambda\langle f_{j}\rangle_{j}.\Phi_{B}^{X}\big{(}\mathsf{unfold}_{U}(\mathtt{d}[\langle f_{j}\rangle_{j},Z])x\big{)}.
In this way the isomorphism \equiv_{{\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}{X}}} are realized in by the two terms below:
[TABLE]
We leave it the reader to check that and , using an argument similar to the one for and and using the -rule in Fig. 12(b).
Appendix B and are full subcategories of
Given a term with free variables and terms \vec{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}u}_{i}}[x], we let t\circ_{\mathsf{m}}\vec{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}u}} be shorthand for t[{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}u}_{1}[x_{1}]/x_{1},\dots,{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}u}_{n}[x_{n}]/x_{n}].
In this section we prove the following commutations:
Proposition B.1**.**
If , then \Gamma\vdash_{\mathsf{\Lambda 2p_{\mu,\nu}^{*}}}{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{A}[t]}\simeq_{\varepsilon}{t^{\sharp}\circ_{\mathsf{m}}\vec{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}}_{\Gamma}}:A^{\sharp}. 2. 2.
If , then \Gamma\vdash_{\mathsf{\Lambda 2p_{\mu,\nu}^{*}}}{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{d}}_{A}[t]}\simeq_{\varepsilon}{t^{\flat}\circ_{\mathsf{m}}\vec{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{d}}}_{\Gamma}}:A^{\flat}.
In fact, from Proposition B.1 we immediately deduce our fullness claims:
Theorem B.2**.**
If and are -types, then there exists such that and . 2. 2.
If and are -types, then there exists such that and .
Proof.
In the first case let , and in the second case let . ∎
We limit ourselves to check the first statement of Prop. B.1, as the other one is established by computing -equivalences in a similar way. We need the following two technical lemmas.
Lemma B.3**.**
For all as in (15) and type ,
[TABLE]
Proof.
From {xC\vec{Y}\ (\Phi_{A_{1}}^{X}({\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}^{-1}_{C})[z_{1}])\dots(\Phi_{A_{k}}^{X}({\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}^{-1}_{C})[z_{k}])}\simeq_{\varepsilon}^{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}^{-1}_{C}}{\Phi_{P}^{X}({\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}^{-1}_{C})\big{[}xC^{\sharp}\vec{Y}z_{1}\dots z_{k}\big{]}} we deduce t\simeq_{\varepsilon}{\Lambda\vec{Y}.\lambda\vec{z}.\Phi_{P}^{X}({\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{C})\circ\Phi_{P}^{X}({\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}^{-1}_{C})\big{[}xC^{\sharp}\vec{Y}\ z_{1}\dots z_{k}\big{]}}\simeq_{\varepsilon}{\Lambda\vec{Y}.\lambda\vec{z}.xC^{\sharp}\vec{Y}z_{1}\dots z_{k}}\simeq_{\eta}{xC^{\sharp}}, where is the lefthand term in Equation 17. ∎
Lemma B.4**.**
Let be as in Lemma B.3. Then for all type , {{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{\forall X.A}C^{\sharp}}\simeq_{\varepsilon}{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{A[C/X]}}.
Proof.
By a simple calculation we can deduce {{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{\forall X.A}C^{\sharp}}\simeq_{\beta}{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{A}[xC^{\sharp}]} and
{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{A[C/X]}}\simeq_{\beta}{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{A}\Big{[}\Lambda\vec{Y}.\lambda\vec{z}.\Phi_{F}^{X}({\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{C})\big{[}xC\vec{Y}\ (\Phi_{A_{f(i_{1})}}^{X}({\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}^{-1}_{C})[z_{1}])\dots(\Phi_{A_{f(i_{k})}}^{X}({\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}^{-1}_{C})[z_{k}])\big{]}\Big{]}}, so we can conclude by Lemma B.3. ∎
Proof of Proposition B.1.
By induction on , we only consider some interesting cases:
- •
if , then , and by the induction hypothesis {{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{\forall Y.B}[u]}\simeq_{\varepsilon}{u^{\sharp}\circ_{\mathsf{m}}{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{\Gamma}}. By Lemma B.4 and the induction hypothesis we have {{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{B[C/Y]}[u]}\simeq_{\varepsilon}{({\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{\forall Y.B}[u])C^{\sharp}}\simeq_{\varepsilon}{(u^{\sharp}\circ_{\mathsf{m}}{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{\Gamma})C^{\sharp}}={t^{\sharp}\circ_{\mathsf{m}}{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{\Gamma}} (as ).
- •
if , then and by the induction hypothesis we have {{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{B_{1}+B_{2}}[u]}\simeq_{\varepsilon}{u^{\sharp}\circ_{\mathsf{m}}{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{\Gamma}} and {{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{C}[v_{i}]}\simeq_{\varepsilon}{v_{i}^{\sharp}\circ_{\mathsf{m}}{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{\Gamma,{x}:B_{i}}}. We can compute then
[TABLE]
- •
if , then and by the induction hypothesis {{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{0}[u]}\simeq_{\varepsilon}{u^{\sharp}\circ_{\mathsf{m}}{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{\Gamma}} so we have {t^{\sharp}\circ_{\mathsf{m}}{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{\Gamma}}={(u^{\sharp}\circ_{\mathsf{m}}{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{\Gamma})C}\simeq_{\varepsilon}{({\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{C}[u])C}\simeq_{\varepsilon}{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{C}[uC]} where the last step is an application of Lemma B.4.
- •
if , then and by the induction hypothesis {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{P[\mu X.P]}[u]\simeq_{\varepsilon}u^{\sharp}\circ_{\mathsf{m}}\vec{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{\Gamma}}. Moreover we have that and {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{\mu X.P}[t]=\mathsf{fold}_{P}({\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{f}}\circ{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{P}[\beta/X]) where and {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{f}}[x]=\Lambda X.\lambda f.f(\Phi_{P^{\sharp}}^{X}(xXf)). The equivalence (t^{\sharp}\circ\vec{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}}_{\Gamma})Xf\simeq_{\varepsilon}{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{\mu X.P}[t]Xf is then seen from the diagram in Fig. 18(a), where commutes by the induction hypothesis, commutes since {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{P[\mu X.P/X]}\simeq_{\beta\eta}{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{P}[\beta/X]\circ\Phi_{P}^{X}({\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{\mu X.P}), and commutes by an instance of a -rule.
- •
if , then and by the induction hypothesis we know that {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{\mu X.P}[v]\simeq_{\varepsilon}v^{\sharp}\circ_{\mathsf{m}}\vec{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}}_{\Gamma} and {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{P(C)\Rightarrow C}[u]\simeq u^{\sharp}\circ_{\mathsf{m}}\vec{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}}_{\Gamma}. The equivalence between {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{C}[\mathsf{fold}_{P}(u)v] and t^{\sharp}\circ_{\mathsf{m}}\vec{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}}_{\Gamma}=(v^{\sharp}C^{\sharp}u^{\sharp})\circ_{\mathsf{m}}\vec{{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}}_{\Gamma} can be seen from the diagram in Fig. 18(b), where and commute by the induction hypothesis and the commutation of follows from {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{C}[\mathsf{fold}_{P}(u)]\simeq_{\varepsilon}\mathsf{fold}_{P}(u^{\sharp}{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{P}[C^{\sharp}]) and \mathsf{fold}_{P}(u^{\sharp}{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{P})\simeq_{\varepsilon}C^{\sharp}u^{\sharp}{\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{\mu X.P}, where the latter holds since {\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@color@gray@fill{0}\mathtt{c}}_{\mu X.P} is an isomorphism of initial algebras.
∎
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] Amal Ahmed, Dustin Jamner, Jeremy G. Siek, and Philip Wadler. Theorems for free for free: parametricity, with and without types. In Proceedings of the ACM on Programming Languages , volume 1 of ICFP , page Article No. 39, New York, 2017.
- 2[2] T. Aoto. Uniqueness of normal proofs in implicational intuitionistic logic. Journal of Logic, Language and Information , 8:217–242, 1999.
- 3[3] Bengt Aspvall, Michael F. Plass, and Robert Endre Tarjan. A linear-time algorithm for testing the truth of certain quantified boolean formulas. Information Processing Letters , 8(3):121 – 123, 1979.
- 4[4] Steve Awodey, Jonas Frey, and Sam Speight. Impredicative encodings of (higher) inductive types. In LICS 2018 , 2018.
- 5[5] Roland C. Backhouse. On the meaning and construction of the rules in Martin-Löf’s theory of types. In Computing Science Notes CS 8606 . Department of Mathematics and Computing Science, University of Groningen, 1986.
- 6[6] David Baelde, Amina Doumane, and Alexis Saurin. Infinitary proof theory: the multiplicative-additive case. In 25th EACSL Annual Conference on Computer Science Logic (CSL 2016) , volume 62 of Leibniz International Proceedings in Informatics (LIP Ics) , pages 42:1–42:17, Germany, 2016. Dagstuhl.
- 7[7] E.S. Bainbridge, Peter J. Freyd, Andre Scedrov, and Philip J. Scott. Functorial polymorphism. Theoretical Computer Science , 70:35–64, 1990.
- 8[8] Henning Basold and Helle Hvid Hansen. Well-definedness and observational equivalence for inductive-coinductive programs. Journal of Logic and Computation , exw 091, 2016.
