8C The search algorithm1238C6.1 Example (cf. Example 8B3.) Applying the search algorithm to the typeproduces the following sets:SI(T, 0) = {VTj,T - (a-*b--*c)-+(a--+b)->a--+c{1x1-b-cxz-bx3.xa-b-cVl Vzd(T,2) = l 1 2 3 1 3( 2a-.b-.c a-.b a, a-b-c a a-b a(T, 3) = 1x2 x3 x1 x3(x2 x3)}8C6.2 Example (cf. Example 8B4.) Applying the search algorithm to the typeT =_ a-+ ... --+a-+a(with m+1 a's) produces the following sets:sd(T,0) = {VT},(T,1) = {(2xi ... xm'xi), ... , (Axj ... xmxm)}.8C6.3 Example (cf. Example 8B6.) Applying the search algorithm to the typeT((a-+b)-+a)->aproduces the following sets:,%/(T,0) = {VT},,V(T 1)d(T, 2) = 0.= {Ax(a-.b)-.a,x(a-+b)-ava_.b}1 1 18C6.4 Exercise* List members of the sets sad(T,0),szl(T,1).... for all the types inTable 8B7a.8C6.5 Comments (i) Besides Ben-Yelles' 1979 search algorithm there are othersin Zaionc 1985 and 1988 and in Takahashi, Akama and Hirokawa 1994. Alsoprocedures essentially equivalent to the main parts of 8C6 are used in some decisionalgorithmsfor provability in intuitionist logic, cf. 6B7.3, and in algorithms that seekto unify pairs of typed A-terms, for example the original one in Huet 1975 §3.(ii) The algorithm in 8C6 can be viewed as a context-free grammar for generatinga language whose expressions are exactly the inhabitants of T. In the standardnotation for context-free grammars (see for example Hopcroft and Ullman 1979Ch. 4) the meta-variables in 8C6 would be called non-terminal variables and eachsuitable replacement defined in Subsubstep Ila of 8C6 would determine a productionin the grammar. The set of all such productions need not be finite, however, so theoriginal definition of "grammar" must be relaxed if this view is to be made precise.This view was taken in Huet 1975 §3, Zaionc 1985 §3 and 1988 §5, and was usedand analysed in detail in Takahashi, Akama and Hirokawa 1994.(iii) A very smooth description of a search algorithm in terms of solving sets ofpolynomial equations over the domain {0, 1, 2, ... , co} is in Zaionc 199-.
124 8 Counting a type's inhabitants8D The Counting algorithmIn this section the search algorithm will be extended to count and enumerate normalinhabitants. The extension will be very simple indeed to state; but the proof that itworks will need some care and will be postponed to Sections 8E-F.As noted in 8A2, it does not matter whether typed or untyped inhabitants arecounted since there is a one-to-one correspondence between the two: in this section"Long(T)" and "Nhabs(T)" will denote sets of typed terms.8D1 Definition (i) For the sets .QI(T, d) and dterms(T, d) introduced in 8C5, defined(T, < d)= S /(T, 0) U ... U a (T, d),dterms(T, < d) = dterms(T, 0) U ... U Wterms(T, d).(ii) For any T, recall from 2A2 that ITI is the <strong>number</strong> of atom-occurrences in Tand IITII is the <strong>number</strong> of distinct atoms in T; define®(T) = ITI X IITII.8D2 Stretching Lemma If Long(T) has a member MT with depth d >_ lit II then it hasmembers with depths greater than any given integer, and hence is infinite.Proof-note The proof will be given in 8F2 (cf. Ben-Yelles 1979 §§3.20-3.21). It willshow that if MT is in Long(T) and has depth d >_ lit Ii then MT must contain twodistinct components B and B' with the same type and with one inside the other. Thenreplacing the smaller one by the larger will change MT to a new term M`T deeper thanMT, and it will be easy to check that M'T is a genuine typed term and is in Long(T).Then a similar replacement in M'T will change it to a still deeper term, and so on.18D3 Shrinking Lemma If Long(T) has a member MT with depth >_ 11(T) then it hasa member NT with®(T) - IITII < Depth(NT) < ®(T).Proof-note The proof will be given in 8F3 (cf. Ben-Yelles 1979 Thm. 3.28). Justas for the previous lemma, MT will be seen to contain two components B and B'with the same type and one inside the other; but now M*T will be constructed byreplacing the larger by the smaller. A problem is that if B and B' are not chosencarefully this replacement risks deleting some abstractors and giving a non-closedM*T: to prevent this, and to ensure that the depth of M*r lies in the range required,MT.2B and B' will be chosen only after a close analysis of the structure ofThis lemma is very like the pumping lemma in the <strong>theory</strong> of context-free grammars and regularlanguages, see for example Hopcroft and Ullman 1979 §3.1 and Comment 8C6.5(ii) above. And thenext lemma will also be very like one in that <strong>theory</strong>, see Hopcroft and Ullman 1979 §3.3 Theorem 3.7,though its proof here will be more complicated due to the presence of bound variables. For aprecise statement of the analogy between typed 2-calculus and the <strong>theory</strong> of context-free grammarssee Takahashi et al. 1994, where a generalised concept of context-free grammar is introduced andgeneralizations of the classical results are proved which imply the corresponding 2-results.Ben-Yelles 1979 Thm. 3.28, whose lines the proof in 8173 will follow, was actually slightly weaker thanthe above lemma. The first proof of a full-strength shrinking lemma was outlined in Hirokawa 1993c;it was different from the one to be given in 8F3.I2
- Page 2 and 3:
BASIC SIMPLE TYPE THEORY
- Page 4 and 5:
BASIC SIMPLE TYPE THEORYJ. Roger Hi
- Page 6:
To Carol
- Page 9 and 10:
VlllContents7C The converse PT proo
- Page 11 and 12:
xIntroductionhave proved themselves
- Page 14 and 15:
1The type-free A-calculusThe R-calc
- Page 16 and 17:
1A A-terms and their structure 31A6
- Page 18 and 19:
I B #-reduction and #-normal forms
- Page 20 and 21:
IC rl- and firs-reductions 7Proof S
- Page 22 and 23:
IC q- and iq-reductions93TFig. lC7a
- Page 24 and 25:
1D Restricted A-terms 11(ii) The BC
- Page 26 and 27:
2A The system TAA 132A2 Definition
- Page 28 and 29:
2A The system TA, 152A5.1 Notation
- Page 30 and 31:
2A The system TA2172A8.3 Example Le
- Page 32 and 33:
Proof Trivial from 2A9.2A The syste
- Page 34 and 35:
2B The subject-construction theorem
- Page 36 and 37:
2B The subject-construction theorem
- Page 38 and 39:
2C Subject reduction and expansion2
- Page 40 and 41:
2D The typable terms 27However, Cha
- Page 42 and 43:
2D The typable terms 292D8.1 Note T
- Page 44 and 45:
3A Principal types and their histor
- Page 46 and 47:
3A Principal types and their histor
- Page 48 and 49:
3B Type-substitutions 353B1 Notatio
- Page 50 and 51:
3B Type-substitutions 37Then r U (s
- Page 52 and 53:
3C Motivating the PT algorithm 39(i
- Page 54 and 55:
3D Unification 41this pair was show
- Page 56 and 57:
3D Unification 43If pk * Tk and the
- Page 58 and 59:
A' _ §(Ap) for some s; hence in pa
- Page 60 and 61:
3E The PT algorithm 47Let r - rl U
- Page 62 and 63:
3E The PT algorithm 49for some subs
- Page 64 and 65:
3E The PT algorithm 513E4 Further R
- Page 66 and 67:
4A The equality rule 53The name "TA
- Page 68 and 69:
(M).4A The equality rule 554A3 Weak
- Page 70 and 71:
4B Semantics and completeness 574A1
- Page 72 and 73:
4B Semantics and completeness 59413
- Page 74 and 75:
4B Semantics and completeness 61Pro
- Page 76 and 77:
5A version using typed termsIn Chap
- Page 78 and 79:
5A Typed terms 655A1.5 Warning If M
- Page 80 and 81:
5B Reducing typed terms(ii) if MT E
- Page 82 and 83:
5B Reducing typed terms 695B5.1 Not
- Page 84 and 85:
5C Normalization theorems 71of rede
- Page 86 and 87: SC Normalization theorems 73in leng
- Page 88 and 89: 6A Intuitionist implicational logic
- Page 90 and 91: 6A Intuitionist implicational logic
- Page 92 and 93: 6B The Curry-Howard isomorphism 79T
- Page 94 and 95: 6B The Curry-Howard isomorphism 816
- Page 96 and 97: 6B The Curry-Howard isomorphism 83t
- Page 98 and 99: 6C Some weaker logics 85for some cl
- Page 100 and 101: 6C Some weaker logics 87logic in 6A
- Page 102 and 103: 6D Axiom-based versions 89Deduction
- Page 104 and 105: 6D Axiom-based versions 916D6.1 Not
- Page 106 and 107: The converse principal-type algorit
- Page 108 and 109: 7B Identifications 957A3 Converse P
- Page 110 and 111: 7C The converse PT proofNext, suppo
- Page 112 and 113: Since (a-+b)* __ a--+b, we must pro
- Page 114 and 115: 7C The converse PT proof 101Conside
- Page 116 and 117: instance, construct an m.g.c.i. V -
- Page 118 and 119: AD-7D Condensed detachment 1057D6 M
- Page 120 and 121: 7D Condensed detachment 107Proof By
- Page 122 and 123: 8A Inhabitants 109A Pq-normal inhab
- Page 124 and 125: 8A Inhabitants 1118A7.1 Example Let
- Page 126 and 127: 8A Inhabitants113Fig. 8A12a.8A11.2
- Page 128 and 129: 8B Examples of the search strategy
- Page 130 and 131: 8B Examples of the search strategy
- Page 132 and 133: 8C The search algorithm 119Long(s)
- Page 134 and 135: 8C The search algorithm 121Note. Th
- Page 138 and 139: 8D The Counting algorithm 1258D3.1
- Page 140 and 141: 8E The structure of a nf-scheme 127
- Page 142 and 143: 8E The structure of a nf-scheme129x
- Page 144 and 145: 8E The structure of a nf-scheme131T
- Page 146 and 147: 8F Stretching, shrinking and comple
- Page 148 and 149: 8F Stretching, shrinking and comple
- Page 150 and 151: 8F Stretching, shrinking and comple
- Page 152 and 153: 8F Stretching, shrinking and comple
- Page 154 and 155: 9A The structure of a term 1419A2 D
- Page 156 and 157: 9A The structure of a term(ii) if r
- Page 158 and 159: 9B Residuals 145Proof-note Two case
- Page 160 and 161: 9B Residuals 1479134.1 Lemma Every
- Page 162 and 163: 9C The structure of a TAR-deduction
- Page 164 and 165: 9D The structure of a type 151below
- Page 166 and 167: 9E The condensed structure of a typ
- Page 168 and 169: 9E The condensed structure of a typ
- Page 170 and 171: 9F Imitating combinatory logic in A
- Page 172: [x].N*Before constructing9F Imitati
- Page 175 and 176: 162 Answers to starred exerciseswit
- Page 177 and 178: 164 Answers to starred exercisesIf
- Page 179 and 180: 166 Answers to starred exercisesTo
- Page 182 and 183: BibliographyReferences to unpublish
- Page 184 and 185: Bibliography 171DOSEN, K. [1992a] M
- Page 186 and 187:
Bibliography 173KALMAN, J. A. [1983
- Page 188 and 189:
Bibliography 175SCEDROV, A. [1990]
- Page 190 and 191:
Table of principal typesThis table
- Page 192 and 193:
IndexA-logics (see axiom-based logi
- Page 194 and 195:
Index 181D-incompleteness of BCI, B
- Page 196 and 197:
Index183PT algorithm, converse (see
- Page 198 and 199:
Index185#-contraction 4of typed ter