Fixpoint Technique for Counting Terms in Typed Calculus

Typed calculus with denumerable set of ground types is considered. The aim of the paper is to show procedure for counting closed terms in long normal forms. It is shown that there is a surprising correspondence between the number of closed terms and the xpoint solution of the polynomial equation in some complete lattice. It is proved that counting of terms in typed lambda calculus can be reduced to the problem of nding least xpoint for the system of polynomial equations. The algorithm for nding the least xpoint of the system of polynomials is considered. By the well known Curry Howard isomorphism the result can be interpreted as a method for counting proofs in the implicational fragment of the propositional intuitionistic logic. The problem of number of terms was studied but never published by Ben-Yelles (see 3]). Similarly in 4] it was proved that complexity of the question whether given type possess an innnite number of normal terms is polynomial space complete. 1. Typed calculus. The set TY PES is deened as follows: there is a denumerable set of ground types fA;B;:::g and if and are types then ! is a type. We will use the following notation: if ; 1; :::; n are types then by n j=1 j ! we mean the type 1 ! (:::(n !):::). Therefore, every type has the form n j=1 j ! where is a ground type. If is a type of the form n j=1 j ! where is a ground type, then i for i n are called components of type and are denoted by i]. For any type we deene rank() and arg() as follows: arg() = rank() = 0 for every ground type and arg(n j=1 j] !) = n and rank(n j=1 j] !) = for 1 ik arg(i1; :::;ik?1]). Ground types and are equivalent (denoted by) if =. This relation is extended to all types by the following rules: (!) ii and (!) ii. For any type there is given a denumerable set of variables V (). Any variable of type is a term of type. If T is a term of type ! and S is a term of type , then TS is a term of type. If T is a term of type and x is a variable of type , then x:T is a term of type !. The axioms of equality between …