LogicalMethodsinComputerScience Vol.4(1:1)2008,pp.1–19 Submitted Nov.21,2006 www.lmcs-online.org Published Jan. 7,2008 ARE THERE HILBERT-STYLE PURE TYPE SYSTEMS? MARTINW. BUNDERa ANDWIL J. M. DEKKERSb a SchoolofMathematicsandAppliedStatistics,UniversityofWollongong,Wollongong,NSW2522, Australia e-mail address: martin [email protected] b Department of Computer Science, Radboud University Nijmegen, Toernooiveld 1, 6525 ED Nij- megen, The Netherlands e-mail address: [email protected] Abstract. For many a natural deduction style logic thereis a Hilbert-style logic that is equivalenttoitinthatithasthesametheorems(i.e.validjudgementsΓ⊢P whereΓ=∅). For intuitionistic implicational logic, the axioms of the equivalent Hilbert-style logic can bepropositions which are also known as thetypesof thecombinators I, K and S. Naturaldeductionversionsofillativecombinatorylogicshaveformulationswithaxioms that are actual type statements for I, K and S. As pure type systems (PTSs) are, in a sense,equivalenttosystemsofillativecombinatorylogic,itmightbethoughtthatHilbert style PTSs (HPTSs) could be based in a similar way. ThispapershowsthatsomePTSshaveverytrivialequivalentHPTSs,withonlytheax- iomsastheoremsandthatformanyPTSsnoequivalentHPTSscanexist. Mostcommonly used PTSs belong to thesetwo classes. For some PTSs however, including λ∗ and the PTS at the basis of the proof assistant Coq,thereisanontrivialequivalentHPTS,withaxiomsthataretypestatementsforI,K and S. Introduction Most early logical systems (for propositional and predicate logic) allowed no hypotheses and so had no rules for introducing or cancelling them. These could be represented by a finite set of axiom schemes and rules of inference such as modus ponens and generalisation. Later natural deduction systems which did allow hypotheses had fewer axiom schemes but required introduction and elimination rules for hypotheses. Herbrand showed that classical Hilbert style and natural deduction style propositional and predicate logics had the same theorems (i.e. judgements with empty contexts). 1998 ACM Subject Classification: F.4.1. 2000 Mathematics Subject Classification: 03B40, 03B70, 68N18. Key words and phrases: Hilbert-style logics, pure type systems, type theory, lambda calculus, illative combinatory logic. a,b The authorswould like to thank theanonymous referees for their useful comments. LOGICALMETHODS (cid:13)c M.W.BunderandW..J.M.Dekkers lINCOMPUTERSCIENCE DOI:10.2168/LMCS-4(1:1)2008 (cid:13)CC CreativeCommons 2 M.W.BUNDERANDW..J.M.DEKKERS Puretypesystems(PTSs),definedbelow, havetworulesthatintroducehypothesesand twothatcancelthem. InthispaperweansweraquestionofFairouzKamareddine“Arethere Hilbert style PTSs?”. When we define Hilbert style PTSs (HPTSs) as PTSs with empty contexts, with a finite set of extra axiom schemes, with s ,s ,s ,... representing arbitrary 1 2 3 sorts, and some extra rules, it is obvious that there are HPTSs. We will be interested in whether, for PTSs, there are theorem equivalent HPTSs. We will answer this question for a number of classes of PTSs which include all the PTSs, from the standard literature, that we have examined. The methods we use, for proving that a HPTS is equivalent to a PTS, are along the lines of those of Herbrand, but rather more complex. Just as combinator based programming languages, requiring no free, or in fact, no variables, have proved useful in practice, perhaps an HPTS, which also requires no (free) variables, that is theorem equivalent to a PTS may be useful. Also, perhaps some metathe- oretical results may be proved more easily for an HPTS than for the equivalent PTS. 1. Pure Type Systems Each Pure Type System (PTS) λX has a set of variables V, a set of constants C, a set of “sorts”S ⊆ C. IthasaclassofpseudotermsgivenbyT =V |C|(ΠV :T.T)|(λV :T.T)|TT. If M and N are pseudoterms, M : A is a statement, Γ is a context if it is a sequence of statements; Γ ⊢ M : A is then called a judgement. A PTS has a set of axioms A each of the form c: s where c ∈ C and s ∈ S. Then it has a set R of triples (s ,s ,s ) ∈ S3, which 1 2 3 determine under what conditions a term Πx:A.B is in a sort. Most PTSs are known by a “specification” (S,A,R) (as usually C = S). The PTS postulates are as follows: c:s∈A (axiom) ⊢c:s Γ⊢A : s (start) Γ,x : A⊢x : A Γ⊢M : B Γ⊢A : s x∈/ FV(Γ) (weakening) Γ,x : A⊢M : B Γ⊢M : (Πx:A.B) Γ⊢N : A (application) Γ⊢MN :B[x:=N] Γ,x : A⊢M : B Γ⊢(Πx:A.B):s (abstraction) Γ⊢(λx:A.M) : (Πx:A.B) Γ,x : A⊢B : s2 Γ⊢A : s1 (s1,s2,s3)∈R (product) Γ⊢(Πx:A.B):s3 Γ⊢M : A Γ⊢B : s A= B β (conversion) . Γ⊢M : B When there are two judgements as premises in a rule, we call theleft one themajor premise and the right one the minor premise. Later we will need the following definition: HILBERT-STYLE PURE TYPE SYSTEMS? 3 Definition 1.1 (Inhabited and Normal Form Inhabited Sorts). s is an inhabited sort (s ∈ I) if ⊢ A : s for some A. s is a normal form inhabited sort (s ∈ N) if for some term A in normal form, ⊢A : s. Thetranslation[ ]ofBunderandDekkers[3]translatesthepseudotermsandstatements of PTSs into terms of illative combinatory logic (ICL) as follows: [x] = x, [c] = c, [XY] = [X][Y] [X : A]= [A][X], [Πx:X.Yx]= G[X][Y] (x∈/ FV(XY)) where G = λxyz.Ξx(Syz) (S is the combinator equivalent to λxyz.xz(yz)). Terms in ICL can be represented without any free variables at all using the combinators S and K (equivalent to λxy.x). Ξxy represents roughly (∀u ∈x)y(u) or x⊆ y. ICL, designed as a foundation for logic and mathematics, has a rule like (abstraction) which was derived in Bunder [2] from a set of axioms. In Section 6 we will see how the methods developed there lead to the ones used here. The main difference between PTSs and standard ICLs, other than the lack of distinction between terms and types, lies in the (abstraction) rule. The direct counterpart to the ICL rule would have Γ ⊢ A : s, for Γ ⊢ (Πx:A.B): s. Thisisthemostimportantfactor in makingitdifficultto haveequivalent Hilbert-style PTSs. 2. Hilbert-style PTSs We define Hilbert-style PTSs as follows: Definition 2.1 (HPTS). Each Hilbert style Pure Type System (HPTS) has V, C, S, T, statements, contexts and judgements as for PTSs, except that the contexts are always empty. A HPTS has a set of sorts S and a set of axioms A, as for PTSs, and an additional finite set B of axiom schemes in which “sort variables” can be replaced by sorts. Most HPTSs are known by a “specification” (S,A,B) (as usually C = S). A HPTS has the PTS (application) and (conversion) rules (with empty contexts) as well as: ⊢M : A A→ B β (type reduction) ⊢M : B. ⊢M : A M → N β (subject reduction) ⊢N : A. Note the latter rules are derivable for all PTSs, for HPTSs neither is, even using (con- version). Definition 2.2 (Equivalent HPTS). If λX is a PTS with specification (S,A,R), a HPTS λXh, with specification (S,A,B) will be equivalent if (∀M,A)(⊢X M : A ⇔ ⊢Xh M : A). Here ⊢X stands for provability in λX and ⊢Xh in λXh. If the PTS is arbitrary or obvious from the context we use ⊢ and ⊢h. B will a function of R, i.e. it will include axioms such as ⊢h [λu:s .λv:(Πx:u.s ).Πx:u.vx] : [Πu:s .Πv:(Πx:u.s ).s ] if (s ,s ,s ) ∈ R. 1 2 1 2 3 1 2 3 4 M.W.BUNDERANDW..J.M.DEKKERS Below are some PTSs that have been studied in the literature (particularly Barendregt [1] and Geuvers [4]). In λτ,S = {∗}, C = {∗,0}, in all other cases C = S consists of all the constants visible in A and R. (s ,s ) is used as an abbreviation for (s ,s ,s ). 1 2 1 2 2 λ→ A={∗:(cid:3)} R={(∗,∗)} λτ A={0:∗} R={(∗,∗)} ∗ λ A={∗:∗} R={(∗,∗)} λ2 A={∗:(cid:3)} R={(∗,∗),((cid:3),∗)} λP A={∗:(cid:3)} R={(∗,∗),(∗,(cid:3))} λω A={∗:(cid:3)} R={(∗,∗),((cid:3),(cid:3))} λω A={∗:(cid:3)} R={(∗,∗),((cid:3),∗),((cid:3),(cid:3))} λP2 A={∗:(cid:3)} R={(∗,∗),((cid:3),∗),(∗,(cid:3))} λPω A={∗:(cid:3)} R={(∗,∗),(∗,(cid:3)),((cid:3),(cid:3))} λPω =λC A={∗:(cid:3)} R={(∗,∗),(∗,(cid:3)),((cid:3),∗),((cid:3),(cid:3))} λAUT-68 A={∗:(cid:3)} R={(∗,∗),(∗,(cid:3),△),((cid:3),∗,△),((cid:3),(cid:3),△),(∗,△),((cid:3),△)} λAUT-QE A={∗:(cid:3)} R={(∗,∗),(∗,(cid:3)),((cid:3),∗,△),((cid:3),(cid:3),△),(∗,△),((cid:3),△)} λPAL A={∗:(cid:3)} R={(∗,∗,△),(∗,(cid:3),△),((cid:3),∗,△),((cid:3),(cid:3),△),(∗,△),((cid:3),△)} λU A={∗:(cid:3),(cid:3):△} R={(∗,∗),((cid:3),∗),((cid:3),(cid:3)),(△,(cid:3)),(△,∗)} λHOL A={∗:(cid:3),(cid:3):△} R={(∗,∗),((cid:3),∗),((cid:3),(cid:3))} The PTS used in the proof assistant Coq we will call λCoq. It has as axioms: ⊢∗ : (cid:3) ⊢∗ : (cid:3) ∀i ∈IN ⊢(cid:3) : (cid:3) . p 1 s 1 i i+1 More axioms are generated by A : B,B : C ∈ A ⇒ A : C ∈ A. In early versions R is given by (∗ ,∗ ),(∗ ,∗ ),(∗ ,∗ ),(∗ ,∗ ),(∗ ,(cid:3) ),(∗ ,(cid:3) ),((cid:3) ,∗ ),((cid:3) ,∗ ),((cid:3) ,(cid:3) ,(cid:3) ) ∈ R. s s p p s p p s p i s i i p i s i j max(i,j) for all i,j ∈ IN. Coq 8.0 replaces ((cid:3) ,∗ )∈ R by ((cid:3) ,∗ ,(cid:3) ) ∈ R. i s i s i We will be able to determine whether or not there are equivalent HPTSs for all of the above. HILBERT-STYLE PURE TYPE SYSTEMS? 5 3. Some PTS Lemmas and Definitions We now state a number of standard lemmas for PTSs. Most proofs can be found in Baren- dregt [1] or Bunder and Dekkers [3]. Lemma 3.1 (Free Variable Lemma). If x : A ,...,x : A ⊢M : B, then 1 1 n n (i) x ,...,x are distinct; 1 n (ii) FV(M,B) ⊆ {x ,...,x }; 1 n (iii) FV(Ai)⊆ {x1...,xi−1} for 1 ≤ i ≤ n. Lemma 3.2 (Substitution Lemma). If Γ ,x : A, Γ ⊢ M : B and Γ ⊢ N : A then 1 2 1 Γ ,Γ [x:= N]⊢ M[x:= N] : B[x:= N]. 1 2 Lemma 3.3 (Condensing Lemma). If Γ ,x : A,Γ ⊢ M : B, where x ∈/ FV(Γ ,M,B), 1 2 2 then Γ ,Γ ⊢ M : B. 1 2 Lemma 3.4 (Generation Lemma). Let Γ ⊢ M : B. Then (i) M ≡ c ∈C ⇒ (∃s ∈ S) B = s & c : s∈ A; β (ii) M ≡ x ⇒ (∃C) B = C & x : C ∈ Γ; β (iii) M ≡ Πx:C.D ⇒ (∃s ,s ,s ) (s ,s ,s ) ∈ R & Γ ⊢ C :s 1 2 3 1 2 3 1 & Γ,x : C ⊢ D : s & B = s ; 2 β 3 (iv) M ≡ λx:C.N ⇒ (∃s ∈ S)(∃D)Γ,x : C ⊢ N : D & B = Πx:C.D β & Γ ⊢ (Πx:C.D) :s; (v) M ≡ PQ ⇒ (∃C,D)Γ ⊢ P : Πx:C.D & Γ ⊢ Q : C & B = D[x:= Q]. β In each case the derivations, of the judgements of the form Γ ⊢ R : E in (iii) to (v), are shorter than that of Γ ⊢ M : B. Lemma 3.5 (Correctness of Types Lemma). If Γ ⊢ M : B then (∃s ∈ S) [B ≡ s or Γ ⊢ B : s]. Lemma 3.6 (Subject and Type Reduction Lemma). If Γ ⊢ M : B, then (i) M →→ N implies Γ ⊢ N : B, β (ii) and B →→ A implies Γ ⊢ M : A. β Lemma 3.7 (Start Lemma). If Γ ⊢M : B, then (i) (c :s)∈ A implies Γ ⊢ c : s, (ii) Γ ≡ x : A ,...,x : A implies that for 0 ≤ i < n there is an s ∈ S such that 1 1 n n x : A ,...,x : A ⊢ A : s. 1 1 i i i+1 4. PTSs where A is the Set of Theorems The following lemma specifies a set of PTSs whose axioms are its only theorems. The equivalent HPTS is then trivially one with no extra axioms, i.e. with B = ∅. Lemma 4.1. In a PTS satisfying (∀c,s1)(cid:0)(c : s1)∈ A ⇒ ∼ (∃s2,s3)[(s1,s2,s3) ∈ R](cid:1) ($) we have ⊢ M : A ⇔ M : A ∈ A. 6 M.W.BUNDERANDW..J.M.DEKKERS Proof. We show M : A∈ A by induction on the derivation of ⊢ M : A. (4.1) (4.1) clearly does not come by (start) or (weakening). If (4.1) comes by (application) from ⊢ P :(Πx:C.D) and ⊢ Q : C whereM ≡ PQandA≡ D[x := Q],wehavebytheinductionhypothesisP :(Πx:C.D) ∈ A, which is impossible. If (4.1) comes by (abstraction) from x : B ⊢ N : C and ⊢ (Πx:B.C): s where M ≡ λx:B.N and A ≡ Πx:B.C, then by the induction hypothesis (Πx:B.C):s ∈ A, which is impossible. If (4.1) comes by (product) from x : B ⊢ C : s , ⊢ B : s and (s ,s ,s ) ∈ R 2 1 1 2 3 where M ≡ Πx:B.C and A ≡ s , then, by the induction hypothesis, (B : s ) ∈ A, which is 3 1 impossible by ($). If (4.1) comes by (conversion) from ⊢M : B , ⊢ A : s and A = B β then by the induction hypothesis (M : B),(A : s) ∈A. However then A and B must be in normal form and so A≡ B and (M : A) ∈ A. If (4.1) is an axiom, the result holds trivially. This implies the following theorem and corollary. Theorem 4.2. A PTS satisfying ($) has an equivalent HPTS, with B = ∅, but this is trivial in that it has only its axioms as theorems. Corollary 4.3. λ→ and λP each have an equivalent HPTS, but ⊢ ∗ : (cid:3) is the only theorem of both systems. 5. PTSs with no Equivalent HPTS In λ→ and λP there is no term A such that ⊢ A: ∗ and the only theorem is ⊢ ∗ :(cid:3). Wecanshow,byasingle(product)rulepreceededbytwousesofanaxiomanda(start) or (weakening) rule, that in the other PTSs, given in Section 2, there are theorems that are not axioms. Most of these are given below. Lemma 5.1. (i) In λτ we have ⊢ (Πx:0.0) : ∗. ∗ (ii) In λ , λ2, λP2, λω, λC, λU and λHOL, we have ⊢(Πx:∗.x) :∗. (iii) In λω and λPω, we have ⊢ (Πx:∗.∗) : (cid:3). (iv) In λAUT-68, λAUT-QE and λPAL we have ⊢ (Πx:∗.∗) : △. HILBERT-STYLE PURE TYPE SYSTEMS? 7 We now give a condition under which, in a PTS, certain sorts have an infinite number of inhabitants of the form Πx:A.B that are not substitution instances of each other. We show later that many PTSs with this property cannot be equivalent to HPTSs. Lemma 5.2. Assume that in a PTS there is a finite sequence s ,s ,...,s ∈ S such that: 1 2 n ′ ′ (∃n ∈ IN) n> 1 & s1 = sn ∈ N & (∀i)(cid:0)1 ≤ i < n⇒ (∃s ∈I & (s,si,si+1) ∈ R)(cid:1) ($s ,...,s ) 1 n then ⊢ (Πx:A.B): s 1 for an infinite number of β-distinct terms Πx:A.B which are not (s for s ) substitution i j instances of each other. Proof. Assume that we have ($s ,...,s ) for s ,s ,··· ∈ S. 1 n 1 2 As s ∈ N we have, for some A , in normal form 1 1 ⊢ A :s . 1 1 Now we show, by induction on i that, for 1 < i ≤ n, there is a Bi−1 and an Ai = Πxi−1:Bi−1.Ai−1 such that ⊢ A :s . (5.1) i i ′ ′ For each i we have, by ($s1,...,sn), an s such that (s,si−1,si) ∈ R and a Bi−1 such that ′ ⊢ Bi−1 :s. When i = 2 we have ⊢ A1 : s1 above, otherwise we have ⊢ Ai−1 : si−1 by the induction hypothesis. By (weakening) we have xi−1 : Bi−1 ⊢ Ai−1 :si−1 and by (product) we have (5.1). So (5.1) holds for 1 ≤ i ≤ n and, as we have s = s , 1 n ⊢ A :s . n 1 Repeating the above, with An for A1, we get ⊢A2n−1 : s1 and similarly ⊢ A3n−2 :s1,... If Ain−i+1 =β Ajn−j+1 for i < j, then Πxin−i:Bin−i.Ain−i =β Πxjn−j:Bjn−j.Ajn−j and so Ain−i =β Ajn−j and eventually A1 =β A(j−i)(n−1)+1. But A1 is a proper part of A(j−i)(n−1)+1 and is in normal form, which is impossible. Hence An,A2n−1,A3n−2,... are β-distinct inhabitants of s all of the form Πx:A.B, which are not substitution instances of each other. ($s ,...,s ) is satisfied for many sequences s ,s ,....,s and many PTSs. Here we list 1 n 1 2 n one such sequence and sort for most of the PTSs given in Section 2. Lemma 5.3. (i) λτ, λ∗ and λ2 satisfy ($∗,∗). (ii) λω, λω, λP2, λPω, λC, λU and λHOL satisfy ($(cid:3),(cid:3)). (iii) λAUT-68, λAUT-QE and λPAL satisfy ($△,△). 8 M.W.BUNDERANDW..J.M.DEKKERS Proof. ′ (i) By Lemma 5.1(i), (ii) with s = ∗. (ii) For λP2, by Lemma 5.1(ii), with s′ = ∗. For the others with s′ = (cid:3). (iii) By Lemma 5.1(iv) with s′ =(cid:3). Now we can prove the main result in the section. Theorem 5.4. If, in a PTS λX, ($s ,...,s ) holds for some s ,...,s ∈ S and 1 n 1 n ′ ′ ′ ′ ′ ′ ′ (∀s1,s2,s3)(cid:0)(s1,s2,s3) ∈ R⇒ (s1 : s2)6∈ A(cid:1), ($$s1) then there is no HPTS equivalent to λX. Proof. By Lemma 5.2, if ($s ,...,s ) holds we have, for an infinite number of β - distinct 1 n terms Πx:A.B, which are not substitution instances of each other ⊢(Πx:A.B) :s . 1 Suppose that there is an equivalent λXh. As a HPTS has only a finite set of axioms B, at least some must be derived, in λXh, by (application) and perhaps (conversion), (type reduction) and (subject reduction) from ⊢h P :(Πy:D.E) and ⊢h Q :D where PQ → Πx:A.B and E[y := Q]→ s . By the equivalence of λX and λXh also: β β 1 ⊢P :(Πy:D.E) and ⊢ Q : D. (5.2) ′ So by correctness of types (Lemma 3.5), for some s ∈ S 3 ′ ⊢ (Πy:D.E) : s 3 and by the Generation Lemma (Lemma 3.4(iii)) we have: ′ ′ ⊢D : s and y : D ⊢ E : s 1 2 ′ ′ ′ where (s ,s ,s ) ∈ R. 1 2 3 Now by the substitution lemma (Lemma 3.2), (5.2) and, if needed, subject reduction ′ (Lemma 3.6) ⊢s :s . 1 2 By Lemma 3.4(i) this contradicts ($$s ), so λX has no HPTS equivalent. 1 Theorem 5.5. λτ, λ2, λω, λω, λP2, λPω, λC, λAUT-68, λAUT-QE, λPAL, λU and λHOL have no equivalent HPTSs. Proof. By Lemma 5.3 and Theorem 5.4. ∗ → Note that ($$s) is not satisfied by any sort s in λ and λCoq. For λ ($$∗) holds but ($∗,s ,...,∗) does not for any s ,... For λP ($$∗) fails, ($$(cid:3)) holds but ($(cid:3),s ,...,(cid:3)) 2 2 2 does not for any s ,... 2 HILBERT-STYLE PURE TYPE SYSTEMS? 9 6. How to Prove (abstraction) and (product) In implicational logic the ⊃-introduction rule is Γ,A ⊢ B ⇒ Γ ⊢ A⊃ B. The hypothesis A in Γ,A ⊢ B is cancelled in Γ ⊢ A ⊃ B. This rule is proved in a Hilbert-style system by induction on the number of steps in a derivation that allows hypotheses. We assume that an hypothesis can be cancelled in the previous step (or steps) and use this to show it can be cancelled in the next. In intuitionistic and classical implicational logic three cases are needed and each requires the Hilbert-style system to have a particular axiom or theorem. If the hypothesis p is itself the step in the deduction we need ⊢p ⊃ p. If the deduction step is an axiom or another hypothesis than p we need ⊢ q ⊃ p ⊃ q. If the deduction step comes by modus ponens from p ⊢ q and p ⊢ q ⊃ r , we need ⊢ (p ⊃ q ⊃ r) ⊃ (p ⊃ q)⊃ p ⊃ r. Note that the three theorems we require represent the simple types of the combinators I, K and S (when ⊃ is replaced by →). Inillativecombinatorylogic,theintroductionruleforΞ(restrictedgenerality)isΓ,Ax⊢ Bx ⇒ Γ,LA ⊢ ΞAB, where L is a constant, x ∈/ FV(Γ,A,B) and Ax is the hypothesis being cancelled. In the proof of this rule in a Hilbert-style system,(see Bunder[2]), the first two cases are similar to those for the proof of implicational introduction. The third is the case where Γ,Ax ⊢ DM is derived from Γ,Ax ⊢ ΞCD and Γ,Ax ⊢ CM. Again, by induction, we assume that the Ξ-introduction step can be applied to the previous steps. The axioms of the Hilbert-style system, when rewritten with U → V for FUV ≡ λx.ΞU(λy.V(xy)) are: ⊢ ... [(A → A)I] ⊢ ... [(A → B → A)K] ⊢ ... [((A → B → C)→ (A → B)→ A → C)S] where ... represent conditions involving L on A,B and C. These are type assignment statements for I, K and S. It might be thought that this same technique could be employed for PTSs, using type assignment statements for I, K and S, of the form ⊢ (...I) : (...A → A) etc and with hypotheses of the form x : A. This however may not work. If we have a PTS with (c :s ) ∈ A and can prove x : c⊢ B : s and/or x : c⊢ M : B, 1 2 perhaps with M ≡ x, c≡ B, it may be that (product) and (abstraction) cannot be applied because (s ,s ,s )6∈ R for any s . 1 2 3 3 This does not mean that x : c can never be cancelled. We may obtain: x : c ⊢ P : (Πy:D.E) and x : c ⊢ Q : D where x : c cannot be cancelled, as, even if we have x : c ⊢ (Πy:D.E) : s and x : c ⊢ D : s , 2 3 10 M.W.BUNDERANDW..J.M.DEKKERS (s ,s ,s ) and (s ,s ,s ) may not be in R for any s ,s ∈ S. However if 1 2 4 1 3 5 4 5 x : c ⊢PQ :E[y := Q] , x : c ⊢E[y := Q] :s and also (s ,s ,s ) ∈ R, 6 1 6 7 so that ⊢(Πx:c.PQ) : s , we can cancel x : c to give 7 ⊢ (λx:c.PQ) : (Πx:c.E[y := Q]). This PTS therefore does have theorems not in A, but it is hard to determine the HPTS corresponding to it. 7. Supersorted PTSs ∗ PTSs that have equivalent HPTSs are λ and λCoq (both versions), but these belong to a larger class that has the following property: Definition 7.1 (Supersorted). A PTS is said to be supersorted if: (∀c∈ C)(∃s ∈ S) (c : s)∈ A and (∀s ,s ∈ S) (∃s ∈ S) (s ,s ,s )∈ R. 1 2 3 1 2 3 For supersorted PTSs (abstraction) can be simplified. Theorem 7.2. In every supersorted PTS (abstraction) can be replaced by: Γ,x : A⊢ M : B Γ ⊢ (λx:A.M) : (Πx:A.B). Proof. If Γ,x : A⊢ M : B by Lemmas 3.7(ii) and 3.5 we have, for some s ,s ∈ S: 1 2 Γ ⊢A : s and either Γ,x : A⊢ B : s or B = s for some s ∈ S. 1 2 If the PTS is supersorted we have, for some s , (s : s ) ∈A in the latter (B = s) case, and 2 2 so the result of the former case by Lemma 3.7(i). Hence by (product) and supersortedness we have, for some s ∈S, 3 Γ ⊢ (Πx:A.B) : s 3 and by (abstraction) we have Γ ⊢ (λx:A.M) : (Πx:A.B). For a supersorted PTS λX we define a corresponding HPTS λXh, which in Theorem 9.4 is shown to be equivalent to λXh. Definition 7.3 (Corresponding HPTS). If λX is a supersorted PTS with specification (S,A,R) the corresponding HPTS λXh has specification (S,A,B), with as members of B the following theorems of λX: Axiom Π1 ⊢h [λu:s .λv:(Πx:u.s ) . Πx:u.vx] : [Πu:s .Πv:(Πx:u.s ).s ] for (s ,s ,s ) ∈ R. 1 2 1 2 3 1 2 3 Axiom I1 ⊢h [λx:s .λy:x.y] :[Πx:s .Πy:x.x]. 1 1 Axiom K1 ⊢h [λx:s .λy:s .λz:x.λu:y.z] :[Πx:s .Πy:s .Πz:x.Πu:y.x]. 1 2 1 2 Axiom S1 ⊢h [λu:s .λv:(Πx:u.s ).λt:(Πx:u.(Πy:vx.s )).λw:(Πx:u.Πy:vx.txy). 1 2 3 λz:(Πx:u.vx).λx:u.wx(zx)]: [Πu:s .Πv:(Πx:u.s ).Πt : (Πx:u.(Πy:vx.s )).Πw:(Πx:u.Πy:vx.txy). 1 2 3 Πz:(Πx:u.vx).Πx:u.tx(zx)]. and additional axioms of B generated by (I) and (II):