(original) (raw)

%!PS-Adobe-2.0 %%Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %%Title: \\Theory\jcm\b\fpl-chap2.dvi %%CreationDate: Thu Jan 09 15:35:53 2003 %%Pages: 83 %%PageOrder: Ascend %%BoundingBox: 0 0 596 842 %%DocumentPaperSizes: a4 %%EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: C:\PROGRA~1\MiKTeX\miktex\bin\dvips.exe %+ -ofpl-chap2.ps \\Theory\jcm\b\fpl-chap2.dvi %DVIPSParameters: dpi=600, compressed %DVIPSSource: TeX output 1995.07.24:1401 %%BeginProcSet: texc.pro %! /TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72 mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0 0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{ landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[ matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{ statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0] N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin /FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array /BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2 array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get }B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub} B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr 1 add N}if}B/id 0 N/rw 0 N/rc 0 N/gp 0 N/cp 0 N/G 0 N/CharBuilder{save 3 1 roll S A/base get 2 index get S/BitMaps get S get/Cd X pop/ctr 0 N Cdx 0 Cx Cy Ch sub Cx Cw add Cy setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx sub Cy .1 sub]/id Ci N/rw Cw 7 add 8 idiv string N/rc 0 N/gp 0 N/cp 0 N{ rc 0 ne{rc 1 sub/rc X rw}{G}ifelse}imagemask restore}B/G{{id gp get/gp gp 1 add N A 18 mod S 18 idiv pl S get exec}loop}B/adv{cp add/cp X}B /chg{rw cp id gp 4 index getinterval putinterval A gp add/gp X adv}B/nd{ /cp 0 N rw exit}B/lsh{rw cp 2 copy get A 0 eq{pop 1}{A 255 eq{pop 254}{ A A add 255 and S 1 and or}ifelse}ifelse put 1 adv}B/rsh{rw cp 2 copy get A 0 eq{pop 128}{A 255 eq{pop 127}{A 2 idiv S 128 and or}ifelse} ifelse put 1 adv}B/clr{rw cp 2 index string putinterval adv}B/set{rw cp fillstr 0 4 index getinterval putinterval adv}B/fillstr 18 string 0 1 17 {2 copy 255 put pop}for N/pl[{adv 1 chg}{adv 1 chg nd}{1 add chg}{1 add chg nd}{adv lsh}{adv lsh nd}{adv rsh}{adv rsh nd}{1 add adv}{/rc X nd}{ 1 add set}{1 add clr}{adv 2 chg}{adv 2 chg nd}{pop nd}]A{bind pop} forall N/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn /BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put }if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{ bop-hook}if/SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N/eop{ SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{ userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X 1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4 index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N /p{show}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 N/Ry 0 N/V{}B/RV/v{ /Ry X/Rx X V}B statusdict begin/product where{pop false[(Display)(NeXT) (LaserWriter 16/600)]{A length product length le{A length product exch 0 exch getinterval eq{pop true exit}if}{pop}ifelse}forall}{false}ifelse end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{BDot}imagemask grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat{BDot} imagemask grestore}}ifelse B/QV{gsave newpath transform round exch round exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 rlineto fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B/M{S p delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M}B/g{0 M} B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p -3 w}B/n{ p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{0 S rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end %%EndProcSet TeXDict begin 39158280 55380996 1000 600 600 (\\Theory\jcm\b\fpl-chap2.dvi) @start %DVIPSBitmapFont: Fa cmsy6 6 1 /Fa 1 64 df<14181438B3AD007FB612FEB7FC7E27237CA231>63 D E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fb cmcsc10 10.95 2 /Fb 2 119 df101 D118 D E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fc cmmi6 6 2 /Fc 2 111 df<13F8EA0FF0A21200A2485AA4485AA43807801E147FEB81C3EB8387380F 060F495A1318EB700E4848C7FCA213FCEA1E7EEA3C0F80EB0781158039780F0300A21402 EB070600F0138CEB03F8386000F019247CA221>107 D<000F13FC381FC3FF3931C70780 3861EC0301F813C0EAC1F0A213E03903C00780A3EC0F00EA0780A2EC1E041506D80F0013 0C143C15181538001EEB1C70EC1FE0000CEB07801F177D9526>110 D E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fd cmr6 6 1 /Fd 1 50 df<13E01201120712FF12F91201B3A7487EB512C0A212217AA01E>49 D E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fe cmmi12 12 1 /Fe 1 111 df<01F8EB03FCD803FEEB1FFFD8071F90387C0FC03B0E0F80E007E03A0C07 C3C003001CD9C7007F001801CE1301003801DC80003013D8EB0FF800705B00605BA200E0 491303D8C01F5D5C12001607013F5D91C7FCA2160F495D137E161F5F13FE49143F94C7FC 187000014B136049147E16FE4C13E0000317C049150104F81380170300071700495D170E EE781C000FED7C3849EC1FF0D80380EC07C0342D7DAB3A>110 D E %EndDVIPSBitmapFont %DVIPSBitmapFont: Ff cmti7 6 4 /Ff 4 117 df<137E3801FF80380781C0EA0E005A5A3878018038700F00EAFFFE13F000 F0C7FC5AA41440007013C0EB0380383C1F00EA1FFCEA07E0121579941B>101 D<143EEC7F8014E7EB01C7ECC300EB03C0A3495AA549C7FC3801FFFCA2D8000FC7FCA213 1EA55BA55BA55BA45B1201A2EA71C0EAF18012F3007FC8FC123C192D81A212>I<13F0EA 0FE0A21201A2EA03C0A4EA0780A4EA0F00A4121EA45AA45AA2138013C0EAF180A3EA7300 127F121C0C237BA20F>108 D<13E01201A4EA03C0A4EA0780EAFFFEA2EA0780EA0F00A4 121EA45AA213041306EA780C13181338EA3870EA3FC0EA0F800F1F7B9E14>116 D E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fg line10 10 5 /Fg 5 83 df<1C0C1C1E1C3E1C7E1CFCF301F8F303F0F307E0F30FC0F31F80F33F001B7E 63505A505A505A505A505A50C7FC1A7E624F5A4F5A4F5A4F5A4F5A4FC8FC197E614E5A4E 5A4E5A4E5A4E5A4EC9FC187E604D5A4D5A4D5A4D5A4D5A4DCAFC177E5F4C5A4C5A4C5A4C 5A4C5A4CCBFC167E5E4B5A4B5A4B5A4B5A4B5A4BCCFC157E5D4A5A4A5A4A5A4A5A4A5A4A CDFC147E5C495A495A495A495A495A49CEFC137E5B485A485A485A485A485A48CFFC127E 5A5A1260575782D453>0 D<1302130380497E8080497E8080497E15804913C015E015F0 4913F815FC90B512FE15FF4814F815C048EBFE0014F84813C091C7FCEA0FFC13F0EA1FC0 90C8FC123C123012405A2020809F53>9 D63 D<126012F87E127E7E6C7E6C7E6C7E6C7E6C7E6C7E137E7F6D7E6D7E6D7E6D7E6D7E6D7E 147E806E7E6E7E6E7E6E7E6E7E6E7E157E816F7E6F7E6F7E6F7E6F7E6F7E167E82707E70 7E707E707E707E707E177E83717E717E717E717E717E717E187E84727E727E727E727E72 7E727E197E85737E737E737E737E737E737E1A7E86747E747E747E747E747E747E1B7E87 F31F80F30FC0F307E0F303F0F301F8F300FC1C7E1C3E1C1E1C0C575782D453>I<144014 C01301497E1307130F497E133F137F497E5A487F5A5A487F5A487FB6FC001F14801203C6 6C13C0131F010313E01300EC3FF0140FEC03F81400153C150C1502150120204D9F53>82 D E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fh cmex10 10 11 /Fh 11 63 df40 D50 DI<12FCB3B3B3B3B3B3B3B0B612F0A61C94668237>II<12FCB3B3B00634668037>I<12FCB3B3B006346A8037>II58 D60 D62 D E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fi cmsy8 8 6 /Fi 6 78 df0 D<006015C000E014016C14030078EC07806CEC 0F006C141E6C5C6C6C5B6C6C5B6C6C485A6C6C485A90387807806D48C7FCEB1E1E6D5AEB 07F86D5A6D5A497E497EEB0F3CEB1E1E497E496C7E496C7E48486C7E48486C7E48481378 48C77E001E80488048EC078048EC03C048140100601400222376A137>2 D<170EA3170F8384170384170184717E1878187C84180FF007C0BA12F819FC19F8CBEA07 C0F00F00183E601878604D5A60170360170795C7FC5F170EA33E237CA147>33 D<137813FE1201A3120313FCA3EA07F8A313F0A2EA0FE0A313C0121F1380A3EA3F00A312 3E127E127CA35AA35A0F227EA413>48 D<4A7E1403B3B3A6007FB712FEB8FC7E2F2E7CAD 38>63 D<0378172003F81760020118E01A01A26FEE03C01A071A0F0203171F1A3F037E16 7FF2FF80A2DA073EED01EFDA063FED03DFF1079FF10F1FDA0E1F151E020C6D023E130019 7C19F84A6C6C49485A19E0F003C0DA3007EC078070EB0F00181E02604B133E6F6C137C02 E05D02C04A48137E6F6C485AD901804A5A70485A0103010049C7FC91C7EAFE3E49EC7EFC 0106EC7FF8010E6E5A010C5DD8301C6E5AD83C385DD87FF86EC8EA7F0849020C16F84848 91C913E01BC06C48F03E006C4895C7FC000FCEFC4D317FAD54>77 D E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fj cmti8 8 15 /Fj 15 123 df97 D<13F8121FA21201A25BA21203A25BA21207A25BA2120FEBC7C0EB9FF0EBF878381FF03C EBE03EEBC01EEB801FEA3F00A2123EA2007E133FA2127CA2147F00FC137E5AA214FCA214 F8130114F0EB03E0EA780714C0383C0F80381E3E00EA0FF8EA03E0182F78AD21>I<153E EC07FEA2EC007EA2157CA215FCA215F8A21401A215F0A21403EB07C390381FF3E0EB7C3B EBF81FEA01F03903E00FC0EA07C0120FEA1F801580EA3F00141F5A007E1400A25C12FE48 133EA2EC7E18153848137CA214FCD878011378397C03F870A2393C0F78E0381E1E3D390F F81FC03903E00F001F2F79AD24>100 DII<14F8EB03FE9038 0F873890381F03F8137EEB7C0113F81201EA03F015F0EA07E01403120F01C013E0A21407 121F018013C0A2140FA21580141F120F143FEC7F006C6C5AEA03C33801FFBF38007E3E13 00147EA2147CA214FC00385BEAFC015C495A48485A38F01F80D87FFEC7FCEA1FF01D2C7C 9D21>I<130E131FEB3F80A2EB1F00130E90C7FCA9EA03E0EA0FF0EA1E78EA1C7C123812 78127013FCEAF0F812E012E1EAC1F0120112035B12075BA2120F13831387121F13075BEA 3F0E123EEA1E1C133C1338EA0FF0EA03C0112E7AAC16>105 D<137CEA0FFCA21200A213 F8A21201A213F0A21203A213E0A21207A213C0A2120FA21380A2121FA21300A25AA2123E A2127EA2127CA2EAFC30137012F8A213F013E012F012F113C012FBEA7F80EA1E000E2F7A AD12>108 D<3907801FC0391FE07FF0393DF1E0F83938F3C0783978FF007CEA70FEA2EA F1FCEAE1F8A25B00C314FC00035C5BA2000713015D13C01403000FECE0C015E1EB800715 C1001F14C3020F13800100138391380787005A158E003EEB03FC001CEB00F0221F7A9D28 >110 DI<3807803E391FE0FF80393C F3C1C03938F781E03878FF07EA70FE13FC12F139E1F8038091C7FC5B12C312035BA21207 A25BA2120FA25BA2121FA290C8FCA25AA2123E121C1B1F7A9D1E>114 D<131C133EA2137EA2137CA213FCA25BA21201A2B512E0A23803F000A25BA21207A25BA2 120FA25BA2121FA290C7FCA24813C01301123E130314801307003C1300130E131E6C5AEA 0FF0EA07C0132B7AA918>116 DI121 D<010F13E0EB3F80EBFFC1ECE3C048EBF3803803E0FF9038C03F00EB801E00075B C7123814785C495A495A495A49C7FC131E5B5B9038F001803801E003EA03C03807800739 0F000F00EA1FE0EBF83E383C7FFE486C5A38701FF838F00FF038E007C01B1F7C9D1D>I E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fk cmbx10 10.95 45 /Fk 45 122 df12 D46 D48 D<140F143F5C495A130F48B5FCB6FCA313F7 EAFE071200B3B3A8B712F0A5243C78BB34>I<903803FF80013F13F890B512FE00036E7E 4881260FF80F7F261FC0037F4848C67F486C6D7E6D6D7E487E6D6D7EA26F1380A46C5A6C 5A6C5A0007C7FCC8FC4B1300A25E153F5E4B5AA24B5A5E4A5B4A5B4A48C7FC5D4A5AEC1F E04A5A4A5A9139FF000F80EB01FC495A4948EB1F00495AEB1F8049C7FC017E5C5B48B7FC 485D5A5A5A5A5AB7FC5EA4293C7BBB34>I<903801FFE0010F13FE013F6D7E90B612E048 01817F3A03FC007FF8D807F06D7E82D80FFC131F6D80121F7FA56C5A5E6C48133FD801F0 5CC8FC4B5A5E4B5A4A5B020F5B902607FFFEC7FC15F815FEEDFFC0D9000113F06E6C7E6F 7E6F7E6F7E1780A26F13C0A217E0EA0FC0487E487E487E487EA317C0A25D491580127F49 491300D83FC0495A6C6C495A3A0FFE01FFF86CB65A6C5DC61580013F49C7FC010313E02B 3D7CBB34>II<00071538 D80FE0EB01F801FE133F90B6FC5E5E5E5E93C7FC5D15F85D15C04AC8FC0180C9FCA9ECFF C0018713FC019F13FF90B67E020113E09039F8007FF0496D7E01C06D7E5B6CC77FC8120F 82A31780A21207EA1FC0487E487E12FF7FA21700A25B4B5A6C5A01805C6CC7123F6D495A D81FE0495A260FFC075B6CB65A6C92C7FCC614FC013F13F0010790C8FC293D7BBB34>I< EC07FF023F13C049B512F001078049EB03FC90383FF80090397FE001FE9038FFC0034849 487E48495AA2485A120FA2485A6F5A003F6E5A6F5A92C8FC485AA21402EC3FFE00FF496C 7E01F9B512E001FB809138E03FF89039FF800FFC4A6C7E825B6F13804915C0A317E05BA4 127FA5123FA26D15C0121FA2000F4A13806D150012076C6C495A6C6D485A6C9038E07FF8 6DB55A6D5C6D1480010749C7FC010013F02B3D7CBB34>I<121F7F13F890B712F0A45A17 E017C0178017005E5E5A007EC7EA01F84B5A007C4A5A4B5A4B5A93C7FC485C157E5DC748 5A4A5AA24A5A140F5D141F143F5D147FA214FF92C8FC5BA25BA3495AA3130FA5131FAA6D 5A6D5A6D5A2C3F7ABD34>II<903801FFE0010F13FC013F13 FF90B612C04801E07F489038003FF048486D7E000F6E7E485A6F7E123F48488081178012 FFA217C0A517E0A4007F5CA4003F5C6C7E5D6C7E00075C3903FF80FB6C13FF6C6C13F36D 13C3010F018313C090380008031400A24B1380EA03F0487E486C1500487E4B5AA25E151F 4B5A495C6C48EBFFE049485B2607FC0F5B6CB6C7FC6C14FC6C14F06D13C0D90FFEC8FC2B 3D7CBB34>I<16FCA24B7EA24B7EA34B7FA24B7FA34B7FA24B7FA34B7F157C03FC7FEDF8 7FA2020180EDF03F0203804B7E02078115C082020F814B7E021F811500824A81023E7F02 7E81027C7FA202FC814A147F49B77EA34982A2D907E0C7001F7F4A80010F835C83011F83 91C87E4983133E83017E83017C81B500FC91B612FCA5463F7CBE4F>65 D<922607FFC0130E92B500FC131E020702FF133E023FEDC07E91B7EAE1FE01039138803F FB499039F80003FF4901C01300013F90C8127F4948151FD9FFF8150F48491507485B4A15 03481701485B18004890CAFC197E5A5B193E127FA349170012FFAC127F7F193EA2123FA2 7F6C187E197C6C7F19FC6C6D16F86C6D150119F06C6D15036C6DED07E0D97FFEED0FC06D 6CED3F80010F01C0ECFF006D01F8EB03FE6D9039FF801FFC010091B55A023F15E0020715 80020002FCC7FC030713C03F407ABE4C>67 DIII73 D76 D80 D82 D<903A03FFC001C0011FEBF803017FEBFE0748B6128F4815DF480100 13FFD80FF8130F48481303497F4848EB007F127F49143F161F12FF160FA27F1607A27F7F 01FC91C7FCEBFF806C13F8ECFFC06C14FCEDFF806C15E016F86C816C816C816C16806C6C 15C07F010715E0EB007F020714F0EC003F1503030013F8167F163F127800F8151FA2160F A27EA217F07E161F6C16E06D143F01E015C001F8EC7F8001FEEB01FF9026FFE007130048 90B55A486C14F8D8F81F5CD8F00314C027E0003FFEC7FC2D407ABE3A>I<003FB912FCA5 903BFE003FFE003FD87FF0EE0FFE01C0160349160190C71500197E127EA2007C183EA400 FC183F48181FA5C81600B3AF010FB712F8A5403D7CBC49>I<903807FFC0013F13F848B6 FC48812607FE037F260FF8007F6DEB3FF0486C806F7EA36F7EA26C5A6C5AEA01E0C8FC15 3F91B5FC130F137F3901FFFE0F4813E0000F1380381FFE00485A5B485A12FF5BA4151F7F 007F143F6D90387BFF806C6C01FB13FE391FFF07F36CEBFFE100031480C6EC003FD91FF8 90C7FC2F2B7DA933>97 D<13FFB5FCA512077EAFEDFFE0020713FC021FEBFF80027F80DA FF8113F09139FC003FF802F06D7E4A6D7E4A13074A80701380A218C082A318E0AA18C0A2 5E1880A218005E6E5C6E495A6E495A02FCEB7FF0903AFCFF01FFE0496CB55AD9F01F91C7 FCD9E00713FCC7000113C033407DBE3A>IIIII<903A03FF8007F0013F9038F83FF8499038FCFFFC48B712FE48018313F93A07FC00 7FC34848EB3FE1001FEDF1FC4990381FF0F81700003F81A7001F5DA26D133F000F5D6C6C 495A3A03FF83FF8091B5C7FC4814FC01BF5BD80F03138090CAFCA2487EA27F13F06CB6FC 16F016FC6C15FF17806C16C06C16E01207001F16F0393FE000034848EB003F49EC1FF800 FF150F90C81207A56C6CEC0FF06D141F003F16E001F0147FD81FFC903801FFC02707FF80 0F13006C90B55AC615F8013F14E0010101FCC7FC2F3D7DA834>I<13FFB5FCA512077EAF ED1FF8EDFFFE02036D7E4A80DA0FE07F91381F007F023C805C4A6D7E5CA25CA35CB3A4B5 D8FE0FB512E0A5333F7CBE3A>III<13FFB5FCA512077EB3B3AFB512FCA5163F7CBE1D>108 D<01FFD91FF8ECFFC0B590B5010713F80203DAC01F13FE4A6E487FDA0FE09026F07F077F 91261F003FEBF8010007013EDAF9F0806C0178ECFBC04A6DB4486C7FA24A92C7FC4A5CA3 4A5CB3A4B5D8FE07B5D8F03FEBFF80A551297CA858>I<01FFEB1FF8B5EBFFFE02036D7E 4A80DA0FE07F91381F007F0007013C806C5B4A6D7E5CA25CA35CB3A4B5D8FE0FB512E0A5 33297CA83A>II<01FFEBFFE0B500 0713FC021FEBFF80027F80DAFF8113F09139FC007FF8000701F06D7E6C496D7E4A130F4A 6D7E1880A27013C0A38218E0AA4C13C0A318805E18005E6E5C6E495A6E495A02FCEBFFF0 DAFF035B92B55A029F91C7FC028713FC028113C00280C9FCACB512FEA5333B7DA83A>I< 3901FE01FE00FF903807FF804A13E04A13F0EC3F1F91387C3FF8000713F8000313F0EBFF E0A29138C01FF0ED0FE091388007C092C7FCA391C8FCB3A2B6FCA525297DA82B>114 D<90383FFC1E48B512BE000714FE5A381FF00F383F800148C7FC007E147EA200FE143EA2 7E7F6D90C7FC13F8EBFFE06C13FF15C06C14F06C806C806C806C80C61580131F13000207 13C014000078147F00F8143F151F7EA27E16806C143F6D140001E013FF9038F803FE90B5 5A15F0D8F87F13C026E00FFEC7FC222B7DA929>III119 DII E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fl cmtt10 10.95 25 /Fl 25 122 df<141E147F14FF5BEB03FEEB07FCEB0FF0EB1FE0EB3FC0EB7F80EBFF0048 5A5B12035B485A120F5BA2485AA2123F5BA2127F90C7FCA412FEAD127FA47F123FA27F12 1FA26C7EA27F12076C7E7F12017F6C7EEB7F80EB3FC0EB1FE0EB0FF0EB07FCEB03FEEB01 FF7F147F141E184771BE30>40 D<127812FE7E7F6C7E6C7EEA0FF06C7E6C7E6C7E6C7EEB 7F80133F14C0131FEB0FE014F01307A2EB03F8A214FC1301A214FE1300A4147FAD14FEA4 130114FCA2130314F8A2EB07F0A2130F14E0EB1FC0133F1480137FEBFF00485A485A485A 485AEA3FE0485A485A90C7FC5A1278184778BE30>I44 D<120FEA3FC0EA7FE0A2EAFFF0A4EA7FE0A2EA3FC0EA0F000C 0C6E8B30>46 D77 DI<007FB512F0B612FE6F7E16E0826C813903F8 003FED0FFCED03FE15016F7EA2821780163FA6167F17005EA24B5A1503ED0FFCED3FF890 B6FC5E5E16804BC7FC15F001F8C9FCB0387FFFC0B57EA46C5B29387EB730>80 D97 D99 D<913801FFE04A7F5CA28080EC0007 AAEB03FE90381FFF874913E790B6FC5A5A481303380FFC00D81FF0133F49131F485A150F 4848130790C7FCA25AA25AA87E6C140FA27F003F141F6D133F6C7E6D137F390FF801FF26 07FE07EBFFC06CB712E06C16F06C14F76D01C713E0011F010313C0D907FCC8FC2C397DB7 30>I<49B4FC010713E0011F13F8017F7F90B57E488048018113803A07FC007FC0484813 3FD81FE0EB1FE0150F484814F0491307127F90C7FCED03F85A5AB7FCA516F048C9FC7E7E A27F003FEC01F06DEB03F86C7E6C7E6D1307D807FEEB1FF03A03FFC07FE06C90B5FC6C15 C0013F14806DEBFE00010713F8010013C0252A7CA830>II104 D<14E0EB03F8A2497EA3 6D5AA2EB00E091C8FCA9381FFFF8487F5AA27E7EEA0001B3A9003FB612C04815E0B7FCA2 7E6C15C023397AB830>I<387FFFF8B57EA47EEA0001B3B3A8007FB612F0B712F8A46C15 F025387BB730>108 D110 D<49B4FC010F13E0013F 13F8497F90B57E0003ECFF8014013A07FC007FC04848EB3FE0D81FE0EB0FF0A24848EB07 F8491303007F15FC90C71201A300FEEC00FEA86C14016C15FCA26D1303003F15F86D1307 6D130F6C6CEB1FF06C6CEB3FE06D137F3A07FF01FFC06C90B512806C15006C6C13FC6D5B 010F13E0010190C7FC272A7CA830>II114 D<90381FFC1E48B5129F000714FF5A5A5A387FF007EB8001 00FEC7FC4880A46C143E007F91C7FC13E06CB4FC6C13FC6CEBFF806C14E0000114F86C6C 7F01037F9038000FFF02001380007C147F00FEEC1FC0A2150F7EA27F151F6DEB3F806D13 7F9039FC03FF0090B6FC5D5D00FC14F0D8F83F13C026780FFEC7FC222A79A830>III<3B3FFFC07FFF80486DB512C0B515E0A26C16C06C496C13803B01F800 03F000A26D130700005DA26D130F017E5CA2017F131F6D5CA2EC803F011F91C7FCA26E5A 010F137EA2ECE0FE01075BA214F101035BA3903801FBF0A314FF6D5BA36E5A6E5A2B277E A630>I<3B3FFFC01FFFE0486D4813F0B515F8A26C16F06C496C13E0D807E0C7EA3F00A2 6D5C0003157EA56D14FE00015DEC0F80EC1FC0EC3FE0A33A00FC7FF1F8A2147DA2ECFDF9 017C5C14F8A3017E13FBA290393FF07FE0A3ECE03FA2011F5C90390F800F802D277FA630 >I<3B3FFFC07FFF80486DB512C0B515E0A26C16C06C496C13803B01FC0003F000A20000 14076D5C137E150F017F5C7F151FD91F805BA214C0010F49C7FCA214E00107137EA2EB03 F0157C15FCEB01F85DA2EB00F9ECFDF0147D147FA26E5AA36E5AA35DA2143F92C8FCA25C 147EA2000F13FE486C5AEA3FC1EBC3F81387EB8FF0EBFFE06C5B5C6C90C9FC6C5AEA01F0 2B3C7EA630>121 D E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fm cmmi8 8 29 /Fm 29 121 df11 D26 D<0103B512F0131F137F90B612E03A 01FC1F80003903F00FC03807C00748486C7E121F1300123EA25AA2140700FC5C5AA2140F 5D141F92C7FC143E0078133C147C007C5B383C01E0381F07C0D807FFC8FCEA01F8241E7D 9C28>I<90B6128012035A481500261E00E0C7FC5A00705B130112E012C0EA0003A25CA2 1307A349C8FCA35BA2131E133EA45BA21338211E7E9C1F>I<123C127E12FFA4127E123C 08087A8714>58 D<123C127EB4FCA21380A2127F123D1201A312031300A25A1206120E5A 5A5A126009157A8714>I<92387FC003913903FFF80791391FC03E0F91397E00071FD901 F8EB03BF4948EB01FED90FC013004948147E49C8FC017E157C49153C485A120348481538 485AA2485A173048481500A2127F90CAFCA35A5AA5EE018016031700A2007E5D1606160E 6C5D5E6C6C5C000F5D6C6C495A6C6CEB0780D801F8011EC7FCD8007E13F890381FFFE001 0390C8FC302F7CAD32>67 D<013FB7FCA2D900FEC7127F171F4A140FA20101150717065C A21303A25C16300107147017004A136016E0130F15019138C007C091B5FC5BECC0074A6C 5AA2133FA2020090C7FCA25B92C8FC137EA213FEA25BA21201A25BA21203B512F0A2302D 7DAC2D>70 D77 D<013FB6FC17E0903A00FE0007F0EE01FC4AEB007EA2010181A25C1880010316005F5CA2 010715FEA24A5C4C5A010F4A5A4C5A4AEB1F8004FFC7FC91B512F84914C00280C9FCA313 3F91CAFCA35B137EA313FE5BA312015BA21203B512E0A2312D7DAC2D>80 D86 D96 DI<151FEC03FFA2EC003FA2153EA2157EA2157CA215FCA215F8A21401EB07 E190381FF9F0EB7C1DEBF80FEA01F03903E007E0EA07C0120FEA1F8015C0EA3F00140F5A 007E1480A2141F12FE481400A2EC3F021506143E5AEC7E0E007CEBFE0C14FC0101131C39 3E07BE18391F0E1E38390FFC0FF03903F003C0202F7DAD24>100 DI<157C4AB4FC9138 07C380EC0F87150FEC1F1FA391383E0E0092C7FCA3147E147CA414FC90383FFFF8A2D900 F8C7FCA313015CA413035CA413075CA5130F5CA4131F91C8FCA4133EA3EA383C12FC5BA2 5B12F0EAE1E0EA7FC0001FC9FC213D7CAE22>I<14FCEB03FF90380F839C90381F01BC01 3E13FCEB7C005B1201485A15F8485A1401120F01C013F0A21403121F018013E0A21407A2 15C0A2000F130F141F0007EB3F80EBC07F3803E1FF3800FF9F90383E1F0013005CA2143E A2147E0038137C00FC13FC5C495A38F807E038F00F80D87FFEC7FCEA1FF81E2C7E9D22> I<1307EB0F80EB1FC0A2EB0F80EB070090C7FCA9EA01E0EA07F8EA0E3CEA1C3E12381230 1270EA607EEAE07C12C013FC485A120012015B12035BA21207EBC04014C0120F13801381 381F01801303EB0700EA0F06131EEA07F8EA01F0122E7EAC18>105 D<15E0EC01F01403A3EC01C091C7FCA9147CEB03FE9038078F80EB0E07131C013813C013 30EB700F0160138013E013C0EB801F13001500A25CA2143EA2147EA2147CA214FCA25CA2 1301A25CA21303A25CA2130700385BEAFC0F5C49C7FCEAF83EEAF0F8EA7FF0EA1F801C3B 81AC1D>I<131FEA03FFA2EA003FA2133EA2137EA2137CA213FCA25BA2120115F89038F0 03FCEC0F0E0003EB1C1EEC387EEBE07014E03807E1C09038E3803849C7FC13CEEA0FDC13 F8A2EBFF80381F9FE0EB83F0EB01F81300481404150C123EA2007E141C1518007CEBF038 ECF83000FC1470EC78E048EB3FC00070EB0F801F2F7DAD25>I<137CEA0FFCA21200A213 F8A21201A213F0A21203A213E0A21207A213C0A2120FA21380A2121FA21300A25AA2123E A2127EA2127CA2EAFC08131812F8A21338133012F01370EAF860EA78E0EA3FC0EA0F000E 2F7DAD15>I<27078007F0137E3C1FE01FFC03FF803C18F0781F0783E03B3878E00F1E01 263079C001B87F26707F8013B00060010013F001FE14E000E015C0485A4914800081021F 130300015F491400A200034A13076049133E170F0007027EEC8080188149017C131F1801 000F02FCEB3F03053E130049495C180E001F0101EC1E0C183C010049EB0FF0000E6D48EB 03E0391F7E9D3E>I<3907C007E0391FE03FF83918F8783E393879E01E39307B801F3870 7F00126013FEEAE0FC12C05B00815C0001143E5BA20003147E157C5B15FC0007ECF80816 18EBC00115F0000F1538913803E0300180147016E0001F010113C015E390C7EAFF00000E 143E251F7E9D2B>II<90 387C01F89038FE07FE3901CF8E0F3A03879C0780D907B813C0000713F000069038E003E0 EB0FC0000E1380120CA2D8081F130712001400A249130F16C0133EA2017EEB1F80A2017C 14005D01FC133E5D15FC6D485A3901FF03E09038FB87C0D9F1FFC7FCEBF0FC000390C8FC A25BA21207A25BA2120FA2EAFFFCA2232B829D24>I<903807E03090381FF87090387C1C F0EBF80D3801F00F3903E007E0EA07C0000F1303381F800715C0EA3F00A248130F007E14 80A300FE131F481400A35C143E5A147E007C13FE5C1301EA3E07EA1F0E380FFCF8EA03F0 C7FC13015CA313035CA21307A2EBFFFEA21C2B7D9D20>I<3807C01F390FF07FC0391CF8 E0E0383879C138307B8738707F07EA607E13FC00E0EB03804848C7FCA2128112015BA212 03A25BA21207A25BA2120FA25BA2121FA290C8FC120E1B1F7E9D20>I<130E131FA25BA2 133EA2137EA2137CA213FCA2B512F8A23801F800A25BA21203A25BA21207A25BA2120FA2 5BA2001F1310143013001470146014E0381E01C0EB0380381F0700EA0F0EEA07FCEA01F0 152B7EA919>116 D<013F137C9038FFC1FF3A01C1E383803A0380F703C0390700F60F00 0E13FE4813FC12180038EC0700003049C7FCA2EA200100005BA313035CA301075B5D14C0 00385CD87C0F130600FC140E011F130C011B131C39F03BE038D8707113F0393FE0FFC026 0F803FC7FC221F7E9D28>120 D E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fn cmmi10 10.95 58 /Fn 58 123 df11 DI14 D17 D<133F14E0EB07F0EB03FC13016D7EA3147FA26E7EA36E7EA36E 7EA36E7EA36E7EA26E7EA36E7EA3157FA36F7E157F15FF4A7F5C913807CFE0EC0F8FEC1F 0F91383E07F0147C14FC49486C7EEB03F0EB07E049486C7EEB1F80EB3F00496D7E13FE48 48147F485A485A4848EC3F80485A123F4848EC1FC048C8FC4816E048150F48ED07F00070 15032C407BBE35>21 DI26 D<020FB512FE027F14FF49B7FC1307011F15FE903A3FE03FE00090387F000F01FE6D7E48 48130348488048481301485A5B121F5B123F90C7FC5A127EA2150300FE5D5AA24B5AA215 0F5E4B5AA2007C4AC7FC157E157C6C5C001E495A001FEB07E0390F800F802603E07EC8FC 3800FFF8EB3FC030287DA634>I<011FB612C090B7FC5A5A481680260FC007C8FC48C65A 123E003C130E48131E5A5AA2C75AA3147CA2147814F8A4495AA31303A25CA21307A3495A A3131FA25C6DC9FC2A287DA628>I<19301978197C193CA2193E191E191F737EA2737E73 7EA2737E737E861A7E86F21F80F20FC0F207E0F203F8007FBB12FCBDFCA27E501A7BAE5B >42 D<121EEA7F80A2EAFFC0A4EA7F80A2EA1E000A0A798919>58 D<121EEA7F8012FF13C0A213E0A3127FEA1E601200A413E013C0A312011380120313005A 120E5A1218123812300B1C798919>I<180E183F18FFEF03FEEF0FF8EF3FE0EFFF809338 03FE00EE0FF8EE3FE0EEFF80DB03FEC7FCED1FF8ED7FE0913801FF80DA07FEC8FCEC1FF0 EC7FC04948C9FCEB07FCEB1FF0EB7FC04848CAFCEA07FCEA1FF0EA7FC048CBFCA2EA7FC0 EA1FF0EA07FCEA01FF38007FC0EB1FF0EB07FCEB01FF9038007FC0EC1FF0EC07FE913801 FF809138007FE0ED1FF8ED03FE923800FF80EE3FE0EE0FF8EE03FE933800FF80EF3FE0EF 0FF8EF03FEEF00FF183F180E383679B147>II<127012FCB4FCEA7FC0EA1FF0EA07 FCEA01FF38007FC0EB1FF0EB07FCEB01FF9038007FC0EC1FF8EC07FE913801FF80913800 7FE0ED0FF8ED03FE923800FF80EE3FE0EE0FF8EE03FE933800FF80EF3FE0EF0FF8EF03FE EF00FFA2EF03FEEF0FF8EF3FE0EFFF80933803FE00EE0FF8EE3FE0EEFF80DB03FEC7FCED 0FF8ED7FE0913801FF80DA07FEC8FCEC1FF8EC7FC04948C9FCEB07FCEB1FF0EB7FC04848 CAFCEA07FCEA1FF0EA7FC048CBFC12FC1270383679B147>I<17075F84171FA2173F177F A217FFA25E5EA24C6C7EA2EE0E3F161E161C1638A21670A216E0ED01C084ED0380171FED 07005D150E5DA25D157815705D844A5A170F4A5A4AC7FC92B6FC5CA2021CC7120F143C14 384A81A24A140713015C495AA249C8FC5B130E131E4982137C13FED807FFED1FFEB500F0 0107B512FCA219F83E417DC044>65 D<49B712F818FF19E090260001FEC7EA3FF0F007F8 4B6E7E727E850203815D1A80A20207167F4B15FFA3020F17004B5C611803021F5E4B4A5A 180FF01FE0023F4B5A4B4A5ADD01FEC7FCEF07F8027FEC7FE092B6C8FC18E092C7EA07F8 4AEC01FE4A6E7E727E727E13014A82181FA213034A82A301075F4A153FA261010F167F4A 5E18FF4D90C7FC011F5E4A14034D5A013FED1FF04D5A4AECFFC0017F020790C8FCB812FC 17F094C9FC413E7DBD45>II<49 B9FCA3D9000190C7120718004B157F193F191E14035DA314075D191CA2140F5D17074D13 3C021F020E13384B1500A2171E023F141C4B133C177C17FC027FEB03F892B5FCA39139FF 8003F0ED00011600A2495D5CA2160101035D5CA293C9FC13075CA3130F5CA3131F5CA213 3FA25C497EB612F8A3403E7DBD3A>70 DI<49B6D8C03FB512F81BF01780D900010180C7383FF00093 C85B4B5EA2197F14034B5EA219FF14074B93C7FCA260140F4B5DA21803141F4B5DA21807 143F4B5DA2180F4AB7FC61A20380C7121F14FF92C85BA2183F5B4A5EA2187F13034A5EA2 18FF13074A93C8FCA25F130F4A5DA21703131F4A5DA2013F1507A24A5D496C4A7EB6D8E0 1FB512FCA2614D3E7DBD4C>I<49B600C090387FFFF896B5FC5FD900010180C7000F1300 93C813F84B16E01A804FC7FC0203163C4B15F84E5AF003C002074B5A4B021FC8FC183E18 78020F5D4BEB03E0EF07804DC9FC021F143E4B5B17F04C5A023F1307EDC00F4C7E163F02 7FEBFFF8ED81EFED83CF92388F87FC9138FF9F0792383C03FE15784B6C7E4913E0158092 C77F5C01036F7E5C717EA213074A6E7EA2717E130F4A6E7EA284011F15035C717E133F85 5C496C4A13E0B600E0017F13FFA34D3E7DBD4D>75 D<49B612F0A3D900010180C7FC93C8 FC5DA314035DA314075DA3140F5DA3141F5DA3143F5DA3147F5DA314FF92C9FCA35B5C18 0C181E0103161C5C183C183813074A1578187018F0130F4AEC01E0A21703011FED07C04A 140F171F013FED3F8017FF4A1303017F021F1300B9FCA25F373E7DBD3E>I<49B56C9338 3FFFF05113E098B5FCD90001F1E000704B5B03DF933803BF80A2F2077F1403039F040E90 C7FC1A1CDB8FE05E02075F030F4C5AA21AE1020FEE01C1020E606F6CEC03811A83021EEE 0703021C040E5BA2F11C07023C16380238606F6C1470F1E00F14780270DB01C05BA29538 03801F02F0ED07004A6C6C5E180E4E133F130102C04B5C601A7F01036D6C5B4A95C8FC4D 5A4D485B130791C749C75A170E047F1401495D010E4B5CA24D1303131E011C4B5C5F013C 023F1407017C5D01FE92C75BD803FF4D7EB500FC013E011FB512F8163C041C5E5C3E7DBD 58>I<49B56C49B512F81BF0A290C76D9039000FFE004AEE03F0705D735A03DF15030203 7F038F5E82190791380787FC030793C7FC1503705C140F91260E01FF140EA26F151E021E 80021C017F141C83193C023C6D7E02381638161F711378147802706D6C1370A2040714F0 02F0804A01035C8318010101EC01FF4A5E82188313034A91387FC380A2EF3FC7010716E7 91C8001F90C8FC18F718FF4981010E5E1707A2131E011C6F5AA2013C1501137C01FE6F5A EA03FFB512FC187818704D3E7DBD49>I<49B712F018FF19C0D9000190C76C7EF00FF84B EC03FC1801020382727E5DA214071A805DA2140F4E13005DA2021F5E18034B5D1807023F 5E4E5A4B4A5A4E5A027F4B5A06FEC7FC4BEB03FCEF3FF091B712C005FCC8FC92CBFCA25B A25CA21303A25CA21307A25CA2130FA25CA2131FA25CA2133FA25C497EB612E0A3413E7D BD3A>80 DI<49B77E18F818FFD90001D900017F 9438003FE04BEC0FF0727E727E14034B6E7EA30207825DA3020F4B5A5DA24E5A141F4B4A 5A614E5A023F4B5A4B4A5A06FEC7FCEF03FC027FEC0FF04BEBFF8092B500FCC8FC5F9139 FF8001FE92C7EA7F80EF1FC084496F7E4A1407A28413035CA2170F13075C60171F130F5C A3011F033F5B4AEE038018E0013F17071A004A021F5B496C160EB600E090380FF01E0507 5B716C5ACBEAFFE0F03F8041407DBD45>II<00 7FB500F090387FFFFE19FC5D26007FE0C7000313804A913800FC004A5D187001FF16F0A2 91C95AA2481601605BA200031603605BA20007160795C7FC5BA2000F5E170E5BA2001F16 1E171C5BA2003F163C17385BA2007F1678A2491570A200FF16F0A290C95AA216015F5A16 035F16074CC8FC160E161E5E007F5D5E6C4A5A6D495A6C6C495A6C6C011FC9FC6C6C137E 3903FC03F8C6B512E0013F1380D907FCCAFC3F407ABD3E>85 DI89 D<027FB712F0A3DAFFFCC7EA3FE003E0EC7FC092C8EAFF8049484A 13004A4A5A5C4A4A5A49484A5A4A4A5A4D5A49484A5A4D5A91C74890C7FC5B010E4A5A4C 5A4C5A011E4A5A90C8485A4C5A4C5A4B90C8FCA24B5A4B5A4B5A4B5A4B5A4B5A4B5AA24A 90C9FC4A5A4A5A4A5A4A4814704A4814F04A485C14FF5D4990C7120149485D4948140349 5A49485D49481407495A4DC7FC49485C4890C8FC48485D4848157E484815FE4848140348 48EC0FFC16FF48B7FCB8FC5F3C3E7BBD3E>I<151EED7F80913801F1C0EC03C1EC07C0ED 80E0EC0F005C141E91383E01C0147CA214F81503D901F01380A21303ECE007010714005D 90380FC00EA2151E90381F801C153C5D133F4A5A5D140149485A017E5B14074AC7FCEBFE 1E13FC5C5C5C3801F9E0EBFBC0A2EBFF8091C8FC5B5B5B5BA212031207120F121F123D12 7800F0140300E0EC0780C66CEB0F000178131E157C6D13F04A5A90381E0F80D90FFEC7FC EB03F823417FBF26>96 DIIIII<163EEEFFC0923803E1E09238 07C0F0ED0F811687ED1F8F160F153FA217E092387E038093C7FCA45DA514015DA30103B5 12FCA390260003F0C7FCA314075DA4140F5DA5141F5DA4143F92C8FCA45C147EA414FE5C A413015CA4495AA35CEA1E07127F5C12FF495AA200FE90C9FCEAF81EEA703EEA7878EA1F F0EA07C02C537CBF2D>III<143C14FEA21301A314FCEB00701400AD137E3801FF803803C7C0 EA0703000F13E0120E121C13071238A2EA780F007013C0A2EAF01F14801200133F14005B 137EA213FE5BA212015B0003130E13F0A20007131EEBE01CA2143CEBC0381478147014E0 13C13803E3C03801FF00EA007C173E7EBC1F>IIIIII112 D<91381F800C9138FFE01C903903F0707C90390FC0387890391F801CF89038 3F000F137E4914F000011407485A485A16E0485A121F150F484814C0A3007F141F491480 A300FF143F90C71300A35D48147EA315FE007E495A1403A26C13074A5A381F801D000F13 793807C1F33901FFC3F038007F03130014075DA3140F5DA3141F5DA2143F147F90381FFF FE5BA2263A7DA729>III<147014FC1301A25CA21303A2 5CA21307A25CA2130FA25CA2007FB512F0B6FC15E039001F8000133FA291C7FCA25BA213 7EA213FEA25BA21201A25BA21203A25BA21207EC01C013E01403000F1480A2EBC0071500 140E141E5C000713385C3803E1E03801FF80D8003EC7FC1C3A7EB821>I<137C48B4EC03 802603C7C0EB0FC0EA0703000F7F000E151F121C010715801238163FEA780F0070491400 A2D8F01F5C5C0000157E133F91C712FEA2495C137E150113FE495CA215030001161C4914 F0A21507173CEEE038150F031F1378000016706D133F017C017313F0017E01E313E0903A 3F03C1F1C0903A0FFF007F80D901FCEB1F002E297EA734>I<017E147848B4EB01FC2603 C7C013FED807031303000F13E0120E121C0107130100381400167ED8780F143E00705B16 1EEAF01F4A131C1200133F91C7123C16385B137E167801FE14705B16F016E0120149EB01 C0A2ED0380A2ED0700A20000140E5D6D133C017C5B6D5B90381F03C0903807FF80D901FC C7FC27297EA72C>I120 D<137C48B4EC03802603C7C0EB0FC0EA070300 0F7F000E151F001C168013071238163FD8780F150000705BA2D8F01F5C4A137E1200133F 91C712FE5E5B137E150113FE495CA2150300015D5BA215075EA2150F151F00005D6D133F 017C137F017E13FF90393F03DF8090380FFF1FEB01FC90C7123F93C7FCA25DD80380137E D80FE013FE001F5C4A5AA24848485A4A5A6CC6485A001C495A001E49C8FC000E137C3807 81F03803FFC0C648C9FC2A3B7EA72D>I<02F8130ED903FE131ED90FFF131C49EB803C49 EBC0784914F090397E07F1E09038F800FF49EB1FC049EB07800001EC0F006C48131E90C7 5A5D5D4A5A4A5A4A5A4AC7FC143E14785C495A495A495A49C8FC011E14E05B5B49130148 48EB03C0485AD807F8EB078048B4131F3A1F87E07F00391E03FFFE486C5B00785CD87000 5B00F0EB7FC048011FC7FC27297DA72A>I E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fo cmbx12 12 48 /Fo 48 123 df12 D45 DI49 DII<163FA25E5E5D5DA25D5D 5D5DA25D92B5FCEC01F7EC03E7140715C7EC0F87EC1F07143E147E147C14F8EB01F0EB03 E0130714C0EB0F80EB1F00133E5BA25B485A485A485A120F5B48C7FC123E5A12FCB91280 A5C8000F90C7FCAC027FB61280A531417DC038>I<0007150301E0143F01FFEB07FF91B6 FC5E5E5E5E5E16804BC7FC5D15E092C8FC01C0C9FCAAEC3FF001C1B5FC01C714C001DF14 F09039FFE03FFC9138000FFE01FC6D7E01F06D13804915C0497F6C4815E0C8FC6F13F0A3 17F8A4EA0F80EA3FE0487E12FF7FA317F05B5D6C4815E05B007EC74813C0123E003F4A13 80D81FC0491300D80FF0495AD807FEEBFFFC6CB612F0C65D013F1480010F01FCC7FC0101 13C02D427BC038>I<4AB47E021F13F0027F13FC49B6FC01079038807F8090390FFC001F D93FF014C04948137F4948EBFFE048495A5A1400485A120FA248486D13C0EE7F80EE1E00 003F92C7FCA25B127FA2EC07FC91381FFF8000FF017F13E091B512F89039F9F01FFC9039 FBC007FE9039FF8003FF17804A6C13C05B6F13E0A24915F0A317F85BA4127FA5123FA217 F07F121FA2000F4A13E0A26C6C15C06D4913806C018014006C6D485A6C9038E01FFC6DB5 5A011F5C010714C0010191C7FC9038003FF02D427BC038>I65 DIIIII73 D76 D78 D<923807FFC092B512FE0207ECFFC0021F15F091 267FFE0013FC902601FFF0EB1FFF01070180010313C04990C76C7FD91FFC6E6C7E49486F 7E49486F7E01FF8348496F7E48496F1380A248496F13C0A24890C96C13E0A24819F04982 003F19F8A3007F19FC49177FA400FF19FEAD007F19FC6D17FFA3003F19F8A26D5E6C19F0 A26E5D6C19E0A26C6D4B13C06C19806E5D6C6D4B13006C6D4B5A6D6C4B5A6D6C4B5A6D6C 4A5B6D01C001075B6D01F0011F5B010101FE90B5C7FC6D90B65A023F15F8020715C00200 4AC8FC030713C047467AC454>II82 DI<003FBA12E0A59026FE000FEB8003D87FE09338003FF0 49171F90C71607A2007E1803007C1801A300781800A400F819F8481978A5C81700B3B3A2 0107B8FCA545437CC24E>II<903801FFE0011F13FE017F6D7E48B612E03A03FE007FF84848EB1FFC6D6D7E486C 6D7EA26F7FA36F7F6C5A6C5AEA00F090C7FCA40203B5FC91B6FC1307013F13F19038FFFC 01000313E0000F1380381FFE00485A5B127F5B12FF5BA35DA26D5B6C6C5B4B13F0D83FFE 013EEBFFC03A1FFF80FC7F0007EBFFF86CECE01FC66CEB8007D90FFCC9FC322F7DAD36> 97 DIIIIII< EB7FC0B5FCA512037EB1ED07FE92383FFF8092B512E002C114F89139C7F03FFC9138CF80 1F9139DF000FFE14DE14FC4A6D7E5CA25CA35CB3A7B60083B512FEA537457CC43E>I<13 7C48B4FC4813804813C0A24813E0A56C13C0A26C13806C1300EA007C90C7FCAAEB7FC0EA 7FFFA512037EB3AFB6FCA518467CC520>I108 D<90277F8007FEEC0FFCB590263FFFC090387FFF8092B5D8F001B512E0 02816E4880913D87F01FFC0FE03FF8913D8FC00FFE1F801FFC0003D99F009026FF3E007F 6C019E6D013C130F02BC5D02F86D496D7EA24A5D4A5DA34A5DB3A7B60081B60003B512FE A5572D7CAC5E>I<90397F8007FEB590383FFF8092B512E0028114F8913987F03FFC9138 8F801F000390399F000FFE6C139E14BC02F86D7E5CA25CA35CB3A7B60083B512FEA5372D 7CAC3E>II<90397FC00FF8 B590B57E02C314E002CF14F89139DFC03FFC9139FF001FFE000301FCEB07FF6C496D1380 4A15C04A6D13E05C7013F0A2EF7FF8A4EF3FFCACEF7FF8A318F017FFA24C13E06E15C06E 5B6E4913806E4913006E495A9139DFC07FFC02CFB512F002C314C002C091C7FCED1FF092 C9FCADB67EA536407DAC3E>II<90387F807FB53881FFE0028313F0028F13F8ED8FFC91389F1FFE000313BE 6C13BC14F8A214F0ED0FFC9138E007F8ED01E092C7FCA35CB3A5B612E0A5272D7DAC2E> I<90391FFC038090B51287000314FF120F381FF003383FC00049133F48C7121F127E00FE 140FA215077EA27F01E090C7FC13FE387FFFF014FF6C14C015F06C14FC6C800003806C15 806C7E010F14C0EB003F020313E0140000F0143FA26C141F150FA27EA26C15C06C141FA2 6DEB3F8001E0EB7F009038F803FE90B55A00FC5CD8F03F13E026E007FEC7FC232F7CAD2C >IIIIIII<001FB71280A49026FC001F130001E0495A5B49495A90C748 5A48495B123E4A5B4A5B003C495BA24A90C7FC4A5A4A5AC7FC4A5A495B495BA2495B4990 38800780491300A2495A4948130F49481400A2485B48495B485BA248495B4890C75A4848 5C15034848EB1FFEB7FCA4292C7DAB32>I E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fp cmr8 8 10 /Fp 10 94 df<13031307130E131C1338137013F0EA01E013C01203EA0780A2EA0F00A2 121EA35AA45AA512F8A25AAB7EA21278A57EA47EA37EA2EA0780A2EA03C0120113E0EA00 F013701338131C130E1307130310437AB11B>40 D<12C07E12707E7E7E120FEA07801203 13C0EA01E0A2EA00F0A21378A3133CA4131EA5131FA2130FAB131FA2131EA5133CA41378 A313F0A2EA01E0A2EA03C013801207EA0F00120E5A5A5A5A5A10437CB11B>I43 D48 D<130C133C137CEA03FC12FFEAFC7C1200B3B113FE387FFFFEA2172C7AAB23>III<123C127E12FFA4127E123C1200AD123C127E12FFA4 127E123C081D7A9C14>58 D91 D93 D E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fq cmsl10 10.95 27 /Fq 27 122 df12 D<007FB5FCA2B512FEA418067C961E>45 D<121EEA3F80EA7FC012FFA41380EA7F00123C 0A0A788919>I<013FB812E0A3903A007FF000016E48EB003F180F4B14071803A3180114 7F4B15C0A514FF92C71270A395C7FC17F0495D5C160116031607161F49B65AA39138FC00 3F160F160701075D4A1303A5010F4AC8FC5C93C9FCA4131F5CA5133F5CA3137FEBFFF0B6 12F8A33B3E7DBD3B>70 D<013FB512FEA25E9026007FF8C8FCEC3FE0A25DA5147F5DA514 FF92C9FCA55B5CA513035CA513075CA21838A21870130F5CA218E0A3011F15014A15C017 03A21707EF0F80013F151F4A143F177FEFFF00017F140301FF143FB9FC5FA2353E7DBD39 >76 D<013FB612FEEFFFE018F8903B007FF0000FFC6E48EB01FF7113804BEC7FC0183F19 E0F01FF0A2147F5D19F8A402FFED3FF092C8FCA219E0A2F07FC05B4AEDFF8019004D5A4D 5AEF0FF80103ED3FE04A903801FF8091B648C7FC17F002FCCAFCA213075CA5130F5CA513 1F5CA5133F5CA3137F497EB612E0A25D3D3E7DBD3E>80 D97 D99 DIII<177C913907F803FE91393FFE0F8F9139FC0F9C3F903901F007F89039 07E003E0D90FC013F0011F903801F80C02801400133FD97F007FA315035B495CA3017E49 5A5E150F6D5C6D495A90263F803EC7FCECC0FC903871FFF09038E07F8091C9FC485AA47F A27F90B512F8EDFF806C15E016F86D8048B6FC3A07E0000FFED80F801300003FC8127F00 3E815A00FC815AA25E163EA25E6C15FC007C4A5A6C4A5A6CEC0FC0D80FC0013FC7FC3903 F801FCC6B512F0010F90C8FC303D7FA82D>I<147FEB3FFFA313017FA25CA513015CA513 035CA4ED07F80107EB1FFF9139F0781FC09138F1E00F9139F38007E0ECF70002FE14F049 5A5CA25CA24A130F131F4A14E0A4161F133F4A14C0A4163F137F91C71380A4167F5B4915 00A300015D486C491380B5D8F87F13FCA32E3F7DBE33>I<1478EB01FE130314FFA25B14 FE130314FCEB00F01400ACEB03F8EA01FF14F0A2EA001F130FA314E0A5131F14C0A5133F 1480A5137F1400A55B5BA4EA03FF007F13F0A2B5FC183E7DBD1A>I<143FEB1FFF5BA213 017FA214FEA5130114FCA5130314F8A5130714F0A5130F14E0A5131F14C0A5133F1480A5 137F1400A55B5BA4EA03FF007F13F8A2B5FC183F7DBE1A>108 D<902707F007F8EB03FC D803FFD91FFF90380FFF80913CE0781FC03C0FE09126E1E00FEBF0073E001FE38007E1C0 03F090260FE700EBE38002EEDAF70013F802FC14FE02D85C14F84A5CA24A5C011F020F14 074A4A14F0A5013F021F140F4A4A14E0A5017F023F141F91C74914C0A549027F143F4992 C71380A300014B147F486C496DEBFFC0B5D8F87FD9FC3F13FEA347287DA74C>I<903907 F007F8D803FFEB1FFF9139E0781FC09138E1E00F3B001FE38007E090380FE70002EE14F0 14FC14D814F85CA24A130F131F4A14E0A4161F133F4A14C0A4163F137F91C71380A4167F 5B491500A300015D486C491380B5D8F87F13FCA32E287DA733>II<91387F01FE903A7FFF0FFFC09139FE3E03F09238F801F8903A03FFE000FE6D49137F 4B7F92C713804A15C04A141FA218E0A20103150F5C18F0A3171F010716E05CA3173F18C0 130F4A147F1880A2EFFF004C5A011F5D16034C5A6E495AEE1FC06E495AD93FDC017EC7FC 91388F01F8913883FFE0028090C8FC92C9FC137FA291CAFCA45BA25BA31201487EB512F8 A3343A81A733>I<903907F01F80D803FFEB7FE09138E1E1F09138E387F839001FE707EB 0FE614EE02FC13F002D813E09138F801804AC7FCA25C131FA25CA4133F5CA5137F91C8FC A55B5BA31201487EB512FEA325287EA724>114 D<9138FF81C0010713E390381F807F90 397C003F8049131F4848130F5B00031407A248481400A27FA27F6D90C7FCEBFF8014FC6C 13FF6C14C015F06C6C7F011F7F13079038007FFE1403140100381300157EA2123C153E15 7E007C147CA2007E147815F8007F495A4A5A486C485A26F9E01FC7FC38E0FFFC38C01FE0 222A7DA824>II<01FE147F00FF EC7FFF4914FEA20007140300031401A34914FCA4150312074914F8A41507120F4914F0A4 150F121F4914E0A2151FA3153F4914C0157F15FFEC01DF3A0FC003BFE09138073FFF3803 F01E3801FFF826003FE01380282977A733>III<48B539 C07FFFC0A33C000FFE003FF8006D48EB1FE0010315800101023EC7FC6E133C01005C027F 5B6F5A91383F81C0EDC380DA1FC7C8FC15EFEC0FFE6E5A5D140381A24A7E140FEC1E7F02 3C7FEC383F02707FECE01F010180903803C00F49486C7ED90F007F491303017E80D801FE 80D807FF497EB5D8803F13F8A332277FA630>I<90B539E007FFF05E18E0902707FE0003 13006D48EB01FC705A5F01014A5A5F16036E5C0100140794C7FC160E805E805E1678ED80 70023F13F05EED81C015C191381FC38015C793C8FC15EF15EEEC0FFCA25DA26E5AA25DA2 6E5A5DA24AC9FC5C140E141E141C5C121C003F5B5A485B495A130300FE5B4848CAFCEA70 1EEA783CEA3FF0EA0FC0343A80A630>I E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fr cmsy10 10.95 40 /Fr 40 107 df<007FB812FEBAFCA26C17FE3804799847>0 D<121EEA7F80A2EAFFC0A4 EA7F80A2EA1E000A0A799B19>I<0060166000F816F06C1501007E15036CED07E06C6CEC 0FC06C6CEC1F806C6CEC3F006C6C147E6C6C5C6C6C495A017E495A6D495A6D6C485A6D6C 485A6D6C48C7FC903803F07E6D6C5A903800FDF8EC7FF06E5A6E5AA24A7E4A7EECFDF890 3801F8FC903803F07E49487E49486C7E49486C7E49486C7E017E6D7E496D7E48486D7E48 48147E4848804848EC1F804848EC0FC048C8EA07E0007EED03F048150148150000601660 2C2C73AC47>II14 DI<007FB912E0BA12F0A26C18E0CDFCAE007FB912E0BA12F0A26C18E0CDFCAE007FB912E0 BA12F0A26C18E03C287BAA47>17 D<0203B612FE023F15FF91B8FC010316FED90FFEC9FC EB1FE0EB7F8001FECAFCEA01F8485A485A485A5B48CBFCA2123EA25AA21278A212F8A25A A87EA21278A2127CA27EA27EA26C7E7F6C7E6C7E6C7EEA00FEEB7F80EB1FE0EB0FFE0103 B712FE010016FF143F020315FE91CAFCAE001FB812FE4817FFA26C17FE384879B947>I< 007FB612C0B712FC16FF6C16C0C9EA7FF0EE07F8EE01FEEE007FEF1F80EF0FC0EF07E0EF 03F01701EF00F8A2187CA2183EA2181EA2181FA2180FA8181FA2181EA2183EA2187CA218 F8A2EF01F01703EF07E0EF0FC0EF1F80EF7F00EE01FEEE07F8EE7FF0007FB712C0B8C7FC 16FC6C15C0CCFCAE007FB812F8B912FCA26C17F8384879B947>I<180E183F18FFEF03FE EF0FF8EF3FE0EFFF80933803FE00EE0FF8EE3FE0EEFF80DB03FEC7FCED0FF8ED7FE09138 01FF80DA07FEC8FCEC1FF8EC7FC04948C9FCEB07FCEB1FF0EB7FC04848CAFCEA07FCEA1F F0EA7FC048CBFCA2EA7FC0EA1FF0EA07FCEA01FF38007FC0EB1FF0EB07FCEB01FF903800 7FC0EC1FF0EC07FE913801FF809138007FE0ED1FF8ED03FE923800FF80EE3FE0EE0FF8EE 03FE933800FF80EF3FE0EF0FF8EF03FEEF00FF183F180E1800AE007FB812FEBAFCA26C17 FE384879B947>I<127012FCB4FCEA7FC0EA1FF0EA07FCEA01FF38007FC0EB1FF0EB07FC EB01FF9038007FC0EC1FF0EC07FE913801FF809138007FE0ED1FF8ED03FE923800FF80EE 3FE0EE0FF8EE03FE933800FF80EF3FE0EF0FF8EF03FEEF00FFA2EF03FEEF0FF8EF3FE0EF FF80933803FE00EE0FF8EE3FE0EEFF80DB03FEC7FCED0FF8ED7FE0913801FF80DA07FEC8 FCEC1FF8EC7FC04948C9FCEB07FCEB1FF0EB7FC04848CAFCEA07FCEA1FF0EA7FC048CBFC 12FC1270CCFCAE007FB812FEBAFCA26C17FE384879B947>I24 D<19301978A2197C193CA2193E191EA2191F737EA2737E737EA2737E737E1A7C1A7EF21F 80F20FC0F207F0007FBB12FCBDFCA26C1AFCCDEA07F0F20FC0F21F80F27E001A7C624F5A 4F5AA24F5A4F5AA24FC7FC191EA2193E193CA2197C1978A2193050307BAE5B>33 D39 D41 D49 D<0203B512F8023F14FC91B6FC010315F8D90FFEC8FCEB1FE0EB7F8001FEC9FCEA01F848 5A485A485A5B48CAFCA2123EA25AA21278A212F8A25AA2B812F817FCA217F800F0CAFCA2 7EA21278A2127CA27EA27EA26C7E7F6C7E6C7E6C7EEA00FEEB7F80EB1FE0EB0FFE0103B6 12F8010015FC143F020314F82E3679B13D>I<1718173C177CA217F8A2EE01F0A2EE03E0 A2EE07C0160F1780EE1F00A2163EA25EA25EA24B5AA24B5AA24B5AA24B5AA24BC7FCA215 3E157E157C5DA24A5AA24A5AA24A5AA24A5AA24AC8FCA2143EA25CA25C13015C495AA249 5AA2495AA249C9FCA2133EA25BA25BA2485AA2485AA2485A120F5B48CAFCA2123EA25AA2 5AA25A12602E5474C000>54 D<126012F0AE12FCA412F0AE126006227BA700>I<0060EE 018000F0EE03C06C1607A200781780007C160FA2003C1700003E5EA26C163EA26C163C6D 157CA2000716786D15F8A26C6C4A5AA200015E6D140390B7FC6C5EA3017CC7EA0F80A201 3C92C7FC013E5CA2011E141E011F143EA26D6C5BA2010714786E13F8A26D6C485AA20101 5CECF003A201005CECF807A291387C0F80A2023C90C8FCEC3E1FA2EC1E1EEC1F3EA2EC0F FCA26E5AA36E5AA36E5A6E5A324180BE33>I<007FB612FEB8FCA27EC9120FB3A7001FB7 FC127FA3C9120FB3A8007FB7FCB8FCA26C15FE283F7BBE33>I<007FB81280B912C0A27E CA1203B3A232187B9F3D>I<1506150FB3B3B3007FB912E0BA12F0A26C18E03C3C7BBB47> 63 D67 D<0438198004F81801030119030303190770180F1D1FF53F00A2030761706064525A1C07 A24B6C170F1C1F525A030E187F7017FD031E6DED01F91CFB031CEF03F3983807E3F89226 3C3FC0ED0FC3F31F830338EF3F03F37E079238781FE009FC5B0370EE01F8F203F09226F0 0FF0EC07E003E093380FC00FF21F800201173F4B6C6C03005B1A7E02035F03806D495A04 034A48131F02074C5A03004B5A706C131F020E4C5A4FC75B021E6E13FE021C6D495AF083 F84ADB87F0143F94387FCFE00278EDDFC002706EB45A96C8FC4A6E5A6001016F5A49485D 0030705A267C07805DD87F0F6F5AB5C86CC9EBE1C094CA13E749F3FF80491C00F41FFC49 1BF06C48F20FC0D81FE097C8FCEA078062457DBF6D>77 DI<4AB6FC023F15F849B712FE0107EEFF80011F17E090287FE1FC007F 13F02601FC01020313F8D803F0030013FC2607C003ED3FFED80F80160FD81F00160748EF 03FF484A80127E12FE488300F0130712C0C74915FEA319FC020F15014B15F8A2F003F0A2 021FED07E04B15C0F00F80F01F00183E4A485C4D5AEF03E0EF0FC04AC7007FC7FCEE0FFE 923807FFF8DA7E1F13C0DAFE3F90C8FCED7FF84BC9FC4948CAFCA35C1303A25C1307A25C 130F5CA2131F5C133FA291CBFC5B137EA25B13F013C040437EBD3F>80 D<4AB612C0023F15FE49B812C0010717F0011F8390287FE1FC001F7F2601FC0102007FD8 03F0161FD807C0EE07FF260F800381D81F00825A4883007E5C12FE486012F000C01307C7 5F4B140161611803020F4B5A4B5D4E5A4EC8FC183E4A4814FCEF01F0EF0FE0EFFF809126 3F803F90C9FCEEFFFC038113E015834A487F1500EE3FF8027E131F02FE6D7EA24A6D7E13 0116034A80010380845C01078072EB01804A027F140F010F70EB1F00624A6E6C137E011F 187C4A6E6C5B72485A013F92390FFF0FE091C8ECFF80496F91C7FC017E6F13FC01786F13 E001E06F6CC8FC49407EBD4D>82 D<0060EE018000F0EE03C0B3B3A36C1607A200781780 007C160FA26CEE1F00003F5E6C6C157E6C6C5DD807F0EC03F8D803FCEC0FF06CB4EC3FE0 3B007FF003FF80011FB548C7FC010714F8010114E09026001FFEC8FC32397BB63D>91 D<15C04A7E4A7EA24A7EA34A7EA2EC1F3EA2EC3E1FA2EC3C0F027C7FA24A6C7EA249486C 7EA2ECE001010380A249486C7EA24948137CA249C77EA2011E141E013E141FA2496E7EA2 496E7EA2491403000182A248486E7EA248486E7EA2491578000F167CA248C97EA2003E82 A2003C82007C1780A248EE07C0A24816030060EE018032397BB63D>94 D<0060EE018000F0EE03C06C1607A2007CEE0F80A2003C1700003E5EA26C163EA26C6C5D A2000716786D15F8A26C6C4A5AA26C6C4A5AA200005E6D1407A2017C4A5AA26D4AC7FCA2 011E141E011F143EA26D6C5BA26D6C5BA26D6C485AA201015CECF003A26D6C485AA29138 7C0F80A2023C90C8FCEC3E1FA2EC1F3EA2EC0FFCA26E5AA36E5AA26E5A6E5A32397BB63D >I<126012F0B3B3B3B3ADB512FCA37E165A71C328>98 D<1418143CB3B3B3B3ADB512FC A314F8165A7EC328>I<387FFFFCB5FCA300F0C7FCB3B3B3B3AD1260165A71C328>II<153FEC03FFEC0FE0EC3F80EC7E0049 5A5C495AA2495AB3AA130F5C131F495A91C7FC13FEEA03F8EA7FE048C8FCEA7FE0EA03F8 EA00FE133F806D7E130F801307B3AA6D7EA26D7E80EB007EEC3F80EC0FE0EC03FFEC003F 205B7AC32D>I<12FCEAFFC0EA07F0EA01FCEA007E6D7E131F6D7EA26D7EB3AA80130380 6D7E1300147FEC1FC0EC07FEEC00FFEC07FEEC1FC0EC7F0014FC1301495A5C13075CB3AA 495AA2495A133F017EC7FC485AEA07F0EAFFC000FCC8FC205B7AC32D>I<146014F01301 A214E01303A214C01307A2EB0F80A214005BA2131E133EA25BA2137813F8A25B1201A25B 1203A2485AA25B120FA290C7FC5AA2123EA2123C127CA2127812F8A41278127CA2123C12 3EA27EA27E7FA212077FA26C7EA212017FA212007FA21378137CA27FA2131E131FA27F14 80A2EB07C0A2130314E0A2130114F0A213001460145A77C323>I<126012F07EA2127812 7CA2123C123EA27EA27E7FA212077FA26C7EA212017FA212007FA21378137CA27FA2131E 131FA27F1480A2EB07C0A2130314E0A2130114F0A414E01303A214C01307A2EB0F80A214 005BA2131E133EA25BA2137813F8A25B1201A25B1203A2485AA25B120FA290C7FC5AA212 3EA2123C127CA2127812F8A25A1260145A7BC323>I<126012F0B3B3B3B3B11260045B76 C319>I E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fs cmti10 10.95 57 /Fs 57 123 df11 D<933807FF80043F13E09338FE00F8DB01F0133EDB07E0130E4B48131F4C137F031F14FF 4BC7FCA218FE157E1878180015FE5DA31401A25DA414030103B712F0A218E0903A0003F0 00070207140F4B14C0A3171F020F15805DA2173F1800141F5D5F177EA2143F92C712FE5F A34A1301027EECF81CA3160302FEECF03C4A1538A21878187013014A010113F018E09338 00F1C0EF7F804948EC1F0094C7FCA35C1307A2001E5B127F130F00FF5BA249CAFC12FEEA F81EEA703CEA7878EA1FF0EA07C0385383BF33>II39 DI< 14031580A2EC01C0EC00E0A21570A215781538153CA3151EA4151FA2150FA7151FA9153F A2153EA3157EA2157CA215FCA215F8A21401A215F0A2140315E0A2140715C0A2EC0F80A2 141F15005C143EA25CA25CA2495A5C1303495A5C130F49C7FC131E5B137C5B5B485A485A 485A48C8FC121E5A12705A5A205A7FC325>I44 D<387FFFFEA3B5FCA21705799521>I<120FEA3FC0127FA212FFA31380EA 7F00123C0A0A77891C>I<131EEB3F80137FEBFFC05AA214806C13005B133C90C7FCB312 0FEA3FC0127FA212FFA35B6CC7FC123C122777A61C>58 DI<14 7F903801FFC090380780F090381E00784913380170133C49131C4848131E485A120790C7 FC120E121E121C003C143E0038143C0078147C1270007C14F8B41301EC03F01407EC0FE0 48EB1FC0EC3F800078EBFF00C6485AEB03F8495AEB1FE0495A49C7FC13FE485A485A13E0 485A1470EB80F0000F5B1300495AEA0703495A019FC7FCEA03FCEA00F090C8FCA8EA0780 EA1FE0123FA2127FA35B6C5A001EC8FC1F416FC02E>63 D<171C173C177CA217FCA21601 1603A21607A24C7EA2161DA216391679167116E1A2ED01C1A2ED038115071601150EA203 1C7FA24B7EA25D15F05D4A5AA24A5AA24AC7FC5C140E5C021FB6FC4A81A20270C7127FA2 5C13015C495AA249C8FCA2130E131E131C133C5B01F882487ED807FEEC01FFB500E0017F EBFF80A25C39417BC044>65 D<9339FF8001C0030F13E0033F9038F803809239FF807E07 913A03FC001F0FDA0FF0EB071FDA1FC0ECBF00DA7F806DB4FC4AC77E495AD903F86E5A49 5A130F4948157E4948157C495A13FF91C9FC4848167812035B1207491670120FA2485A95 C7FC485AA3127F5BA312FF5BA490CCFCA2170FA2170EA2171E171C173C173817786C1670 6D15F04C5A003F5E6D1403001F4B5A6D4AC8FC000F151E6C6C5C6C6C14F86C6C495A6C6C EB07C090397FC03F8090261FFFFEC9FC010713F0010013803A4272BF41>67 D<49B712C018F818FE903B0003FE0003FF9438007F804BEC1FC0F00FE0F007F014074BEC 03F8F001FCA2140F4BEC00FEA3141F4B15FFA3143F5DA3027F5D5DA219FE14FF92C81203 A34917FC4A1507A219F813034A150F19F0A20107EE1FE05CF03FC0A2010FEE7F804A1600 6060011F4B5A4A4A5A4D5AA2013F4B5A4AEC3FC04DC7FC017F15FEEE03FC4AEB0FF001FF EC7FE0B8128004FCC8FC16E0403E7BBD45>I<49B812F8A390260003FEC7121F18074B14 031801F000F014075DA3140F5D19E0A2141F4B1338A2EF7801023F027013C04B91C7FCA2 17F0027F5CED80011603160F91B65AA3ED001F49EC07805CA3010392C8FC5CF003804C13 070107020E14005C93C75A180E010F161E4A151C183CA2011F5E5C60A2013F15014A4A5A 1707017F150F4D5A4A147F01FF913807FF80B9FCA295C7FC3D3E7BBD3E>I<49B812F0A3 90260003FEC7123F180F4B1403A2F001E014075DA3140F5D19C0A2141F5D1770EFF00302 3F02E013804B91C7FCA21601027F5CED8003A2160702FFEB1F8092B5FCA349D9003FC8FC 4A7F82A20103140E5CA2161E0107141C5CA293C9FC130F5CA3131F5CA3133F5CA2137FA2 5C497EB612E0A33C3E7BBD3B>I<49B648B6FC495DA2D9000390C7000313004B5D4B5DA2 180714074B5DA2180F140F4B5DA2181F141F4B5DA2183F143F4B5DA2187F147F4B5DA218 FF91B8FC96C7FCA292C712015B4A5DA2170313034A5DA2170713074A5DA2170F130F4A5D A2171F131F4A5DA2173F133F4A5DA2017F157FA24A5D496C4A7EB66CB67EA3483E7BBD44 >72 D<49B6FC5BA2D9000313005D5DA314075DA3140F5DA3141F5DA3143F5DA3147F5DA3 14FF92C7FCA35B5CA313035CA313075CA3130F5CA3131F5CA3133F5CA2137FA25C497EB6 7EA3283E7BBD23>I<49B6903807FFFE605ED9000390C7000113E04B6E13004B15FC4E5A 19E002074B5A4BEC0F804EC7FC183C020F5D4B5C4D5AEF07C0021F4AC8FC4B131E5F5F02 3F5C9238C003E0EE07804CC9FC027F5B4B5AEEFF801581ECFF834B7FED0F7FED1E3F4901 7C7FECFEF89138FFE01F03C07F491380ED000F4A805C010714074A80A21603010F815C16 0183131F4A6D7FA2177F013F825C173F017F82A24A81496C4A7EB6D8800FB512C0A26147 3E7BBD46>75 D<49B612C0A25FD9000390C8FC5D5DA314075DA3140F5DA3141F5DA3143F 5DA3147F5DA314FF92C9FCA35B5CA313035C18C0EF01E0010716C05C17031880130F4A14 0718005F131F4A141EA2173E013F5D4A14FC1601017F4A5A16074A131F01FFECFFF0B8FC A25F333E7BBD39>I<49B5933807FFFC496062D90003F0FC00505ADBBF805E1A771AEF14 07033F923801CFE0A2F1039F020FEE071F020E606F6C140E1A3F021E161C021C04385BA2 F1707F143C023804E090C7FCF001C0629126780FE0495A02705FF00700F00E0114F002E0 031C5BA2F03803010116704A6C6C5D18E019070103ED01C00280DA03805BA2943807000F 13070200020E5C5FDB03F8141F495D010E4B5CA24D133F131E011CDAF9C05CEEFB80197F 013C6DB4C7FC013895C8FC5E01784A5C13F8486C4A5CD807FE4C7EB500F04948B512FE16 E01500563E7BBD52>I<902601FFFE020FB5FC496D5CA2D900016D010013C04AEE3F0019 3E70141C193CEC07BFDB3FE01438151F1978020F7FDA0E0F15708219F0EC1E07021C6D5C A203031401023C7FDA38015DA2701303EC7800027002805BA2047F130702F014C04A013F 91C7FCA2715A0101141F4AECF00EA2040F131E010315F84A151C1607EFFC3C0107140391 C7143817FE040113784915FF010E16708218F0131E011C6F5AA2173F133C01385E171F13 7813F8486C6F5AEA07FEB500F01407A295C8FC483E7BBD44>II<49B77E18F018FC 903B0003FE0003FEEF00FF4BEC7F80F03FC00207151F19E05DA2020F16F0A25DA2141FF0 3FE05DA2023F16C0187F4B1580A2027FEDFF00604B495A4D5A02FF4A5A4D5A92C7EA3FC0 4CB4C7FC4990B512FC17E04ACAFCA21303A25CA21307A25CA2130FA25CA2131FA25CA213 3FA25CA2137FA25C497EB67EA33C3E7BBD3E>I<49B612FCEFFF8018F0903B0003FE000F F8EF03FE4BEB00FF8419800207ED3FC05DA219E0140F5DA3021FED7FC05DA2F0FF80143F 4B15004D5A60027F4A5A4B495A4D5AEF3F8002FF02FEC7FC92380007F892B512E0178049 9038000FE04A6D7E707E707E0103814A130083A213075CA25E130F5C5F1603131F5CA301 3F020714404A16E05F017F160119C04A01031303496C1680B6D8800113079438FE0F0093 38007E1ECAEA3FFCEF07F03B407BBD42>82 D<92390FF001C0ED7FFE4AB5EA0380913907 F80FC791390FC003EF91391F8001FF4AC71300027E805C495A4948143EA2495AA2010F15 3C5CA3011F1538A38094C7FC80A214FC6DB4FC15F015FE6DEBFFC06D14F06D14FC6D8014 3F020F7F020180EC001F150303007F167F163FA2161FA212075A5F120EA2001E153F94C7 FCA2163E003E157E167C003F15FC4B5A486C5C4B5A6D495AD87DE0EB1F80D8F8F849C8FC 017F13FE39F03FFFF8D8E00F13E048C690C9FC32427ABF33>I<48B9FCA25A903AFE001F F00101F89138E0007FD807E0163E49013F141E5B48C75BA2001E147FA2001C4B131C123C 003814FFA2007892C7FC12704A153C00F01738485CC716001403A25DA21407A25DA2140F A25DA2141FA25DA2143FA25DA2147FA25DA214FFA292C9FCA25BA25CA21303A25CEB0FFE 003FB67E5AA2383D71BC41>I<001FB500F090B512F0485DA226003FF0C7380FFC004AEC 03F04A5D715A017F1503A24A5DA201FF150795C7FC91C8FCA2485E170E5BA20003161E17 1C5BA20007163C17385BA2000F167817705BA2001F16F05F5BA2003F1501A2495DA2007F 1503A2495DA2160794C8FC48C8FC5E160E161E6C151C163C5E5E5E6C6C13014B5A001F4A 5A6C6C011FC9FC6D133E6C6C13F83903FC07F0C6B512C0013F90CAFCEB07F83C406FBD44 >II<91B690383FFFFC60 5E020101E0010F13006E49EB07F84C6D5A19C06F6C495A96C7FC033F140E705B183C031F 5C705B4D5A030F5C70485A4DC8FC0307130EEEFC1E5F03035BEEFE705F6F6C5A5FA26F90 C9FC83A2707EA216FF4B7F5DED079FEE1FF0150EED1C0F03387F1578EDF007DA01E07F15 C09138038003DA07007F140E021E13014A805C02707F4A81495A4948147F01078249C8FC 013F6F7E496C147F2603FFC049487EB500F8011FEBFFE0A261463E7CBD44>88 D<147E49B47E903907C1C38090391F80EFC090383F00FF017E137F4914804848133F485A A248481400120F5B001F5C157E485AA215FE007F5C90C7FCA21401485C5AA21403EDF038 5AA21407EDE078020F1370127C021F13F0007E013F13E0003E137FECF3E1261F01E313C0 3A0F8781E3803A03FF00FF00D800FC133E252977A72E>97 DIIII<167C4BB4FC923807C78092380F83 C0ED1F87161FED3F3FA2157EA21780EE0E004BC7FCA414015DA414035DA30103B512F8A3 90260007E0C7FCA3140F5DA5141F5DA4143F92C8FCA45C147EA414FE5CA413015CA4495A A4495AA4495A121E127F5C12FF49C9FCA2EAFE1EEAF83C1270EA7878EA3FE0EA0F802A53 83BF1C>III<14 78EB01FCA21303A314F8EB00E01400AD137C48B4FC38038F80EA0707000E13C0121E121C EA3C0F1238A2EA781F00701380A2EAF03F140012005B137E13FE5BA212015BA212035B14 38120713E0000F1378EBC070A214F0EB80E0A2EB81C01383148038078700EA03FEEA00F8 163E79BC1C>I<1507ED1FC0A2153FA31680ED0E0092C7FCADEC07C0EC3FF0EC78F8ECE0 7CEB01C01303EC807EEB0700A2010E13FE5D131E131CEB3C01A201005BA21403A25DA214 07A25DA2140FA25DA2141FA25DA2143FA292C7FCA25CA2147EA214FEA25CA213015CA212 1C387F03F012FF495A5C495A4848C8FCEAF83EEA707CEA3FF0EA0FC0225083BC1C>IIII< D801F0EB3F803A07FC01FFE03A0F3E07C1F83A0E1F0F00FC001E011C137C001C49137E00 3C13F012385C38783FC012705C91C7FC00F015FE495CEA007EA2150101FE5C5BA2150300 015D5B15075E0003020F13704914C0A2031F13F00007ED80E05B1681EE01C0120F49EC03 80A2EE0700001FEC0F0E49EB07FC0007C7EA01F02C2979A733>II<903903E001F890390FF807FE903A1E7C1E0F80903A1C3E3C07C0013C137801 389038E003E0EB783F017001C013F0ED80019038F07F0001E015F8147E1603000113FEA2 C75AA20101140717F05CA20103140F17E05CA20107EC1FC0A24A1480163F010F15005E16 7E5E131F4B5A6E485A4B5A90393FB80F80DA9C1FC7FCEC0FFCEC03E049C9FCA2137EA213 FEA25BA21201A25BA21203A2387FFFE0B5FCA22D3A80A72E>I<027E1360903901FF81E0 903807C1C390391F80E7C090383F00F7017E137F5B4848EB3F80485AA2485A000F15005B 121F5D4848137EA3007F14FE90C75AA3481301485CA31403485CA314074A5A127C141F00 7E133F003E495A14FF381F01EF380F879F3903FF1F80EA00FC1300143F92C7FCA35C147E A314FE5CA21301130390B512F05AA2233A77A72A>III< EB01C0EB03F01307A25CA2130FA25CA2131FA25CA2133FA291C7FCA2007FB51280B6FC15 00D8007EC7FC13FEA25BA21201A25BA21203A25BA21207A25BA2120FA25BA2121F141C13 80A2003F133C1438EB0078147014F05C495AEA1F03495A6C48C7FCEA07FCEA01F0193A78 B81E>I<137C48B4141C26038F80137EEA0707000E7F001E15FE121CD83C0F5C12381501 EA781F007001805BA2D8F03F1303140000005D5B017E1307A201FE5C5B150F1201495CA2 151F0003EDC1C0491481A2153F1683EE0380A2ED7F07000102FF13005C01F8EBDF0F0000 9038079F0E90397C0F0F1C90391FFC07F8903907F001F02A2979A731>I<017CEB01C048 B4EB07F038038F80EA0707000E01C013F8121E001C1403EA3C0F0038EC01F0A2D8781F13 0000705BA2EAF03F91C712E012005B017E130116C013FE5B1503000115805BA2ED070012 03495B150EA25DA25D1578000114706D5B0000495A6D485AD97E0FC7FCEB1FFEEB03F025 2979A72A>I<017C167048B491387001FC3A038F8001F8EA0707000E01C015FE001E1403 001CEDF000EA3C0F0038177C1507D8781F4A133C00701380A2D8F03F130F020049133812 005B017E011F14784C137013FE5B033F14F0000192C712E05BA2170100034A14C049137E 17031880A2EF070015FE170E00010101141E01F86D131C0000D9039F5BD9FC076D5A903A 3E0F07C1E0903A1FFC03FFC0902703F0007FC7FC372979A73C>I<903903F001F890390F FC07FE90393C1E0E0F9026780F1C138001F0EBB83FD801E013F89039C007F07FEA038000 0714E0D9000F140048151C000E4AC7FCA2001E131FA2C75BA2143F92C8FCA35C147EA314 FE4A131CA30101143C001E1538003F491378D87F811470018314F000FF5D9039077801C0 39FE0F7C033A7C0E3C078027783C1E1EC7FC391FF80FFC3907E003F029297CA72A>I<13 7C48B4143826038F8013FCEA0707000E7F001E1401001C15F8EA3C0F12381503D8781F14 F000701380A2D8F03F1307020013E012005B017E130F16C013FE5B151F1201491480A215 3F000315005BA25D157EA315FE5D00011301EBF8030000130790387C1FF8EB3FF9EB07E1 EB00035DA21407000E5CEA3F80007F495AA24A5AD8FF0090C7FC143E007C137E00705B38 7801F0383803E0381E0FC06CB4C8FCEA03F8263B79A72C>II E %EndDVIPSBitmapFont %DVIPSBitmapFont: Ft cmr10 10.95 85 /Ft 85 124 df0 D2 D5 DI<4AB4EB0FE0021F9038E03FFC913A7F00F8FC1E D901FC90383FF03FD907F090397FE07F80494801FF13FF4948485BD93F805C137F0200ED 7F00EF003E01FE6D91C7FC82ADB97EA3C648C76CC8FCB3AE486C4A7E007FD9FC3FEBFF80 A339407FBF35>11 D<4AB4FC021F13C091387F01F0903901FC0078D907F0131C4948133E 494813FF49485A137F1400A213FE6F5A163893C7FCAA167FB8FCA33900FE00018182B3AC 486CECFF80007FD9FC3F13FEA32F407FBF33>I<4AB47E021F13F791387F00FFEB01F890 3807F001EB0FE0EB1FC0EB3F80137F14008101FE80AEB8FCA3C648C77EB3AE486CECFF80 007FD9FC3F13FEA32F407FBF33>I<4AB4ECFF80021FD9C00F13E0913B7F01F03F80F890 3C01F80078FE003CD907F0D93FF8130E49484948131F49484948EB7F804948484913FF13 7F02005CA201FE92C7FC6FED7F0070141C96C7FCAAF13F80BBFCA3C648C76CC7FC197F19 3FB3AC486C4A6CEB7FC0007FD9FC3FD9FE1FB5FCA348407FBF4C>I<121EEA7F80EAFFC0 A9EA7F80ACEA3F00AC121EAB120CC7FCA8121EEA7F80A2EAFFC0A4EA7F80A2EA1E000A41 79C019>33 D<001E130F397F803FC000FF137F01C013E0A201E013F0A3007F133F391E60 0F3000001300A401E01370491360A3000114E04913C00003130101001380481303000EEB 070048130E0018130C0038131C003013181C1C7DBE2D>I<121EEA7F8012FF13C0A213E0 A3127FEA1E601200A413E013C0A312011380120313005A120E5A1218123812300B1C79BE 19>39 D<1430147014E0EB01C0EB03801307EB0F00131E133E133C5B13F85B12015B1203 A2485AA2120F5BA2121F90C7FCA25AA3123E127EA6127C12FCB2127C127EA6123E123FA3 7EA27F120FA27F1207A26C7EA212017F12007F13787F133E131E7FEB07801303EB01C0EB 00E014701430145A77C323>I<12C07E12707E7E121E7E6C7E7F12036C7E7F12007F1378 137CA27FA2133F7FA21480130FA214C0A3130714E0A6130314F0B214E01307A614C0130F A31480A2131F1400A25B133EA25BA2137813F85B12015B485A12075B48C7FC121E121C5A 5A5A5A145A7BC323>I<1506150FB3A9007FB912E0BA12F0A26C18E0C8000FC9FCB3A915 063C3C7BB447>43 D<121EEA7F8012FF13C0A213E0A3127FEA1E601200A413E013C0A312 011380120313005A120E5A1218123812300B1C798919>II<121E EA7F80A2EAFFC0A4EA7F80A2EA1E000A0A798919>IIIIII< 150E151E153EA2157EA215FE1401A21403EC077E1406140E141CA214381470A214E0EB01 C0A2EB0380EB0700A2130E5BA25B5BA25B5B1201485A90C7FC5A120E120C121C5AA25A5A B8FCA3C8EAFE00AC4A7E49B6FCA3283E7EBD2D>I<00061403D80780131F01F813FE90B5 FC5D5D5D15C092C7FC14FCEB3FE090C9FCACEB01FE90380FFF8090383E03E090387001F8 496C7E49137E497F90C713800006141FC813C0A216E0150FA316F0A3120C127F7F12FFA4 16E090C7121F12FC007015C012780038EC3F80123C6CEC7F00001F14FE6C6C485A6C6C48 5A3903F80FE0C6B55A013F90C7FCEB07F8243F7CBC2D>II<1238123C123F90B612FCA316F85A16F016E00078C712010070EC 03C0ED078016005D48141E151C153C5DC8127015F04A5A5D14034A5A92C7FC5C141EA25C A2147C147814F8A213015C1303A31307A3130F5CA2131FA6133FAA6D5A0107C8FC26407B BD2D>III<121EEA7F80A2EAFFC0A4EA7F80A2EA1E00C7FC B3121EEA7F80A2EAFFC0A4EA7F80A2EA1E000A2779A619>I<121EEA7F80A2EAFFC0A4EA 7F80A2EA1E00C7FCB3121E127FEAFF80A213C0A4127F121E1200A412011380A312031300 5A1206120E120C121C5A1230A20A3979A619>I<007FB912E0BA12F0A26C18E0CDFCAE00 7FB912E0BA12F0A26C18E03C167BA147>61 D63 D<15074B7EA34B7EA34B7EA34B7E A34B7E15E7A2913801C7FC15C3A291380381FEA34AC67EA3020E6D7EA34A6D7EA34A6D7E A34A6D7EA34A6D7EA349486D7E91B6FCA249819138800001A249C87EA24982010E157FA2 011E82011C153FA2013C820138151FA2017882170F13FC00034C7ED80FFF4B7EB500F001 0FB512F8A33D417DC044>65 DIIIIIIII<011FB512FCA3D90007 13006E5A1401B3B3A6123FEA7F80EAFFC0A44A5A1380D87F005B007C130700385C003C49 5A6C495A6C495A2603E07EC7FC3800FFF8EB3FC026407CBD2F>IIIIIII82 DI<003FB91280A3 903AF0007FE001018090393FC0003F48C7ED1FC0007E1707127C00781703A300701701A5 48EF00E0A5C81600B3B14B7E4B7E0107B612FEA33B3D7DBC42>IIII89 D91 D<486C13C00003130101001380481303000EEB070048130E00 18130C0038131C003013180070133800601330A300E01370481360A400CFEB678039FFC0 7FE001E013F0A3007F133FA2003F131F01C013E0390F0007801C1C73BE2D>II97 DI<49B4FC010F13E090383F00F8017C131E48 48131F4848137F0007ECFF80485A5B121FA24848EB7F00151C007F91C7FCA290C9FC5AAB 6C7EA3003FEC01C07F001F140316806C6C13076C6C14000003140E6C6C131E6C6C137890 383F01F090380FFFC0D901FEC7FC222A7DA828>IIII<167C9039 03F801FF903A1FFF078F8090397E0FDE1F9038F803F83803F001A23B07E000FC0600000F 6EC7FC49137E001F147FA8000F147E6D13FE00075C6C6C485AA23901F803E03903FE0FC0 26071FFFC8FCEB03F80006CAFC120EA3120FA27F7F6CB512E015FE6C6E7E6C15E06C8100 03813A0FC0001FFC48C7EA01FE003E140048157E825A82A46C5D007C153E007E157E6C5D 6C6C495A6C6C495AD803F0EB0FC0D800FE017FC7FC90383FFFFC010313C0293D7EA82D> III<1478EB01FEA2EB03FFA4EB01FEA2EB00781400AC147FEB7F FFA313017F147FB3B3A5123E127F38FF807E14FEA214FCEB81F8EA7F01387C03F0381E07 C0380FFF803801FC00185185BD1C>III<2701F801FE14FF00FF902707FFC00313E0913B1E07E00F03F0913B7803F03C 01F80007903BE001F87000FC2603F9C06D487F000101805C01FBD900FF147F91C75B13FF 4992C7FCA2495CB3A6486C496CECFF80B5D8F87FD9FC3F13FEA347287DA74C>I<3901F8 01FE00FF903807FFC091381E07E091387803F000079038E001F82603F9C07F0001138001 FB6D7E91C7FC13FF5BA25BB3A6486C497EB5D8F87F13FCA32E287DA733>I<14FF010713 E090381F81F890387E007E01F8131F4848EB0F804848EB07C04848EB03E0000F15F04848 EB01F8A2003F15FCA248C812FEA44815FFA96C15FEA36C6CEB01FCA3001F15F86C6CEB03 F0A26C6CEB07E06C6CEB0FC06C6CEB1F80D8007EEB7E0090383F81FC90380FFFF0010090 C7FC282A7EA82D>I<3901FC03FC00FF90381FFF8091387C0FE09039FDE003F03A07FFC0 01FC6C496C7E6C90C7127F49EC3F805BEE1FC017E0A2EE0FF0A3EE07F8AAEE0FF0A4EE1F E0A2EE3FC06D1580EE7F007F6E13FE9138C001F89039FDE007F09039FC780FC0DA3FFFC7 FCEC07F891C9FCAD487EB512F8A32D3A7EA733>I<02FF131C0107EBC03C90381F80F090 397F00387C01FC131CD803F8130E4848EB0FFC150748481303121F485A1501485AA448C7 FCAA6C7EA36C7EA2001F14036C7E15076C6C130F6C7E6C6C133DD8007E137990383F81F1 90380FFFC1903801FE0190C7FCAD4B7E92B512F8A32D3A7DA730>I<3901F807E000FFEB 1FF8EC787CECE1FE3807F9C100031381EA01FB1401EC00FC01FF1330491300A35BB3A548 7EB512FEA31F287EA724>I<90383FC0603901FFF8E03807C03F381F000F003E1307003C 1303127C0078130112F81400A27E7E7E6D1300EA7FF8EBFFC06C13F86C13FE6C7F6C1480 000114C0D8003F13E0010313F0EB001FEC0FF800E01303A214017E1400A27E15F07E1401 6C14E06CEB03C0903880078039F3E01F0038E0FFFC38C01FE01D2A7DA824>I<131CA613 3CA4137CA213FCA2120112031207001FB512C0B6FCA2D801FCC7FCB3A215E0A912009038 FE01C0A2EB7F03013F138090381F8700EB07FEEB01F81B397EB723>IIIIII<001FB61280A2EBE0000180140049485A001E495A121C 4A5A003C495A141F00385C4A5A147F5D4AC7FCC6485AA2495A495A130F5C495A90393FC0 0380A2EB7F80EBFF005A5B484813071207491400485A48485BA248485B4848137F00FF49 5A90B6FCA221277EA628>II E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fu cmbx12 14.4 41 /Fu 41 122 df44 DII<157815FC14031407141F14FF130F0007B5FCB6 FCA2147F13F0EAF800C7FCB3B3B3A6007FB712FEA52F4E76CD43>49 DI<91380FFFC091B512FC0107ECFF80011F15E09026 3FF8077F9026FF800113FC4848C76C7ED803F86E7E491680D807FC8048B416C080486D15 E0A4805CA36C17C06C5B6C90C75AD801FC1680C9FC4C13005FA24C5A4B5B4B5B4B13C04B 5BDBFFFEC7FC91B512F816E016FCEEFF80DA000713E0030113F89238007FFE707E701380 7013C018E07013F0A218F8A27013FCA218FEA2EA03E0EA0FF8487E487E487EB57EA318FC A25E18F891C7FC6C17F0495C6C4816E001F04A13C06C484A1380D80FF84A13006CB44A5A 6CD9F0075BC690B612F06D5D011F1580010302FCC7FCD9001F1380374F7ACD43>I<177C 17FEA2160116031607160FA2161F163F167FA216FF5D5DA25D5DED1FBFED3F3F153E157C 15FCEC01F815F0EC03E01407EC0FC01580EC1F005C147E147C5C1301495A495A5C495A13 1F49C7FC133E5B13FC485A5B485A1207485A485A90C8FC123E127E5ABA12C0A5C96C48C7 FCAF020FB712C0A53A4F7CCE43>III<932601FFFC EC01C0047FD9FFC013030307B600F81307033F03FE131F92B8EA803F0203DAE003EBC07F 020F01FCC7383FF0FF023F01E0EC0FF94A01800203B5FC494848C9FC4901F88249498249 49824949824949824990CA7E494883A2484983485B1B7F485B481A3FA24849181FA3485B 1B0FA25AA298C7FC5CA2B5FCAE7EA280A2F307C07EA36C7FA21B0F6C6D1980A26C1A1F6C 7F1C006C6D606C6D187EA26D6C606D6D4C5A6D6D16036D6D4C5A6D6D4C5A6D01FC4C5A6D 6DEE7F806D6C6C6C4BC7FC6E01E0EC07FE020F01FEEC1FF80203903AFFE001FFF0020091 B612C0033F93C8FC030715FCDB007F14E0040101FCC9FC525479D261>67 D69 DI73 D76 D80 D82 D<91260FFF80130791B500F85B010702FF5B011FEDC03F49EDF07F9026FFFC006D5A4801 E0EB0FFD4801800101B5FC4848C87E48488149150F001F824981123F4981007F82A28412 FF84A27FA26D82A27F7F6D93C7FC14C06C13F014FF15F86CECFF8016FC6CEDFFC017F06C 16FC6C16FF6C17C06C836C836D826D82010F821303010082021F16801400030F15C0ED00 7F040714E01600173F050F13F08383A200788200F882A3187FA27EA219E07EA26CEFFFC0 A27F6D4B13806D17006D5D01FC4B5A01FF4B5A02C04A5A02F8EC7FF0903B1FFFC003FFE0 486C90B65AD8FC0393C7FC48C66C14FC48010F14F048D9007F90C8FC3C5479D24B>I<00 3FBC1280A59126C0003F9038C0007F49C71607D87FF8060113C001E08449197F49193F90 C8171FA2007E1A0FA3007C1A07A500FC1BE0481A03A6C994C7FCB3B3AC91B912F0A55351 7BD05E>I86 D97 DI<913801FFF8021FEBFF8091B612F0010315FC01 0F9038C00FFE903A1FFE0001FFD97FFC491380D9FFF05B4817C048495B5C5A485BA2486F 138091C7FC486F1300705A4892C8FC5BA312FFAD127F7FA27EA2EF03E06C7F17076C6D15 C07E6E140F6CEE1F806C6DEC3F006C6D147ED97FFE5C6D6CEB03F8010F9038E01FF00103 90B55A01001580023F49C7FC020113E033387CB63C>I<4DB47E0407B5FCA5EE001F1707 B3A4913801FFE0021F13FC91B6FC010315C7010F9038E03FE74990380007F7D97FFC0101 B5FC49487F4849143F484980485B83485B5A91C8FC5AA3485AA412FFAC127FA36C7EA37E A26C7F5F6C6D5C7E6C6D5C6C6D49B5FC6D6C4914E0D93FFED90FEFEBFF80903A0FFFC07F CF6D90B5128F0101ECFE0FD9003F13F8020301C049C7FC41547CD24B>I<913803FFC002 3F13FC49B6FC010715C04901817F903A3FFC007FF849486D7E49486D7E4849130F48496D 7E48178048497F18C0488191C7FC4817E0A248815B18F0A212FFA490B8FCA318E049CAFC A6127FA27F7EA218E06CEE01F06E14037E6C6DEC07E0A26C6DEC0FC06C6D141F6C6DEC3F 806D6CECFF00D91FFEEB03FE903A0FFFC03FF8010390B55A010015C0021F49C7FC020113 F034387CB63D>IIII<137F497E000313E0487FA2487FA76C5BA26C5BC613806DC7FC90C8FC ADEB3FF0B5FCA512017EB3B3A6B612E0A51B547BD325>I108 DII<913801FFE0021F13FE91B612C0010315F0010F9038807FFC903A1FFC000FFED97FF8 6D6C7E49486D7F48496D7F48496D7F4A147F48834890C86C7EA24883A248486F7EA3007F 1880A400FF18C0AC007F1880A3003F18006D5DA26C5FA26C5F6E147F6C5F6C6D4A5A6C6D 495B6C6D495B6D6C495BD93FFE011F90C7FC903A0FFF807FFC6D90B55A010015C0023F91 C8FC020113E03A387CB643>I<903A3FF001FFE0B5010F13FE033FEBFFC092B612F002F3 01017F913AF7F8007FFE0003D9FFE0EB1FFFC602806D7F92C76C7F4A824A6E7F4A6E7FA2 717FA285187F85A4721380AC1A0060A36118FFA2615F616E4A5BA26E4A5B6E4A5B6F495B 6F4990C7FC03F0EBFFFC9126FBFE075B02F8B612E06F1480031F01FCC8FC030313C092CB FCB1B612F8A5414D7BB54B>I<90397FE003FEB590380FFF80033F13E04B13F09238FE1F F89139E1F83FFC0003D9E3E013FEC6ECC07FECE78014EF150014EE02FEEB3FFC5CEE1FF8 EE0FF04A90C7FCA55CB3AAB612FCA52F367CB537>114 D<903903FFF00F013FEBFE1F90 B7FC120348EB003FD80FF81307D81FE0130148487F4980127F90C87EA24881A27FA27F01 F091C7FC13FCEBFFC06C13FF15F86C14FF16C06C15F06C816C816C81C681013F1580010F 15C01300020714E0EC003F030713F015010078EC007F00F8153F161F7E160FA27E17E07E 6D141F17C07F6DEC3F8001F8EC7F0001FEEB01FE9039FFC00FFC6DB55AD8FC1F14E0D8F8 07148048C601F8C7FC2C387CB635>I<143EA6147EA414FEA21301A313031307A2130F13 1F133F13FF5A000F90B6FCB8FCA426003FFEC8FCB3A9EE07C0AB011FEC0F8080A26DEC1F 0015806DEBC03E6DEBF0FC6DEBFFF86D6C5B021F5B020313802A4D7ECB34>IIII<007FB500F090387FFFFEA5C66C48C7000F 90C7FC6D6CEC07F86D6D5C6D6D495A6D4B5A6F495A6D6D91C8FC6D6D137E6D6D5B91387F FE014C5A6E6C485A6EEB8FE06EEBCFC06EEBFF806E91C9FCA26E5B6E5B6F7E6F7EA26F7F 834B7F4B7F92B5FCDA01FD7F03F87F4A486C7E4A486C7E020F7FDA1FC0804A486C7F4A48 6C7F02FE6D7F4A6D7F495A49486D7F01076F7E49486E7E49486E7FEBFFF0B500FE49B612 C0A542357EB447>II E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fv cmbx12 24.88 11 /Fv 11 118 df[<0803B500C0EE01F00703B600FEEE03F8077FDBFFE015070607B800FC 150F063F05FF151F4DBA00E0143F050F07F8147F053F07FE14FF94BC5B04039326F8000F ECC003040F4BC86CEBF007043F03C0030F6D5A93B648C900036D5A4B03F09339007FFF3F 030703C0051F90B5FC4B92CB7E033F02FC18034B02F08492B648844A0380193F4A92CD7E 4A4A864A4A864A02F0864A4A864A8991B65A494B874992CF7E4C885B494A885E498B494A 88A2495C8D90B65A8D5A5E48217FA24892D1FC223FA25A5DA248211FA3485CFA0FF09FC7 FCA25AA45DA3B6FCB27EA381A47EA46C80FA07F0FA0FF87EA2817EA36C6F1D1F23F07E82 7E223F6D6E1EE0A26D6E1D7F23C06D6E1DFF7F705213806D806D55130070646D6F646D6F 515A6E6E1B1F6E6E515A6E6E515A6E6E1BFF6E6E505B6E6E505B6E6F4F5B6E03E04F90C7 FC6F6EF13FFE6F02FC4F5A030F02FF4E485A6F03C005075B030103F0051F5B6F03FE057F 1380043FDAFFE00303B5C8FC040F03FE033F13FC0403DBFFF80107B55A040093B812E005 3F1A80050F4FC9FC050119F8DD003F18C0060795CAFCDE007F16F0070393CBFCDF000314 C0>141 146 115 271 168 67 D[127 141 120 268 146 70 D[121 142 120 269 140 76 D[137 142 120 269 159 80 D[<000FC312F8A6488EA304C0C700 1F4AC7120103F8C8F0000F03C01C0192C9737E02FC1E1F4A1E0702E08A4A8A4A8A4890CA 757EA249203F49201FA349200FA2492007A4492003007F8EA4498CA848487A1380A6CC99 C7FCB3B3B3B3AA030FBD12FCA9>145 140 120 267 162 84 D<93B512FC037FECFFF002 07B8FC023F17E091B912F84918FE0107727E499126C0007F14E04901E0C7000F80496D02 0380496D020014FE6F6F7F90B570806F6F8085486E6F807380A27380A28885886C5CA26D 4982886D5B6D5B010713C0010190CAFC90CCFCA90603B7FC050FB8FC0403B9FC167F0307 BAFC153F4AB7EA807F020FEDE000023F02FCC7FC91B612E0010392C8FC4914FC011F14F0 4914C0495C90B548C9FC485C485C485C485C5A5D485CA24891CAFCA3B6FC5CA397B6FCA4 61806C60F107EF6C6E150F6F16CF6C183F6FDB7F8F806C6EDBFF0F14E06C02FCDA03FE15 FE6C6E91260FFC0791B5FC6C6E6CD93FF817806C923AF803FFF003013F91B6487E010FEF 8000010394C77E010004FC141F021F03F0140702010380DA007F1400DA000701F8CDFC69 5F79DD71>97 D<94387FFFC0040FB6FC93B712E0030716FC031F16FF037F17C04AB912F0 0207DAF80380021F912680003F13FE4A49C7000F7F4A01F802038049B5486E804902C06E 6C7F494A6F7F4991C9FC49727F4949707F4B84498490B548707F5A4B198048855D481CC0 86481CE05D5A871DF05AA25D5AA21DF887A2B6FCA392BBFCA51DF00380CDFCA77EA4817E A37EA2817EA26CF307F06FF00FF87E816C1B1F6F19F06C1B3F6D6DF07FE06D7FF4FFC06D 6E4C13806D6E5E6D02F04C13006D6EEE1FFE6D6E4C5A6D6C01FFEEFFF86E02E002035B6E 02FC021F5B02079126FFC003B55A6E92B7C7FC020060033F17F8030F17E003011780DB00 3F03FCC8FC040315C0DC000F01F8C9FC5D5F7ADD6A>101 D103 D[114 143 119 270 129 I110 D117 D E %EndDVIPSBitmapFont %DVIPSBitmapFont: Fw cmbx12 20.74 8 /Fw 8 117 df<92380FFFE04AB67E020F15F0027F15FE49B87E4917E0010F17F8013F83 49D9C01F14FF9027FFFC0001814801E06D6C80480180021F804890C86C8048486F804848 6F8001FF6F804801C06E8002F081486D18806E816E18C0B5821BE06E81A37214F0A56C5B A36C5B6C5B6C5B000313C0C690C9FC90CA15E060A34E14C0A21B80601B0060626295B55A 5F624D5C624D5C4D91C7FC614D5B4D13F04D5B6194B55A4C49C8FC4C5B4C5B4C13E04C5B 604C90C9FCEE7FFC4C5A4B5B4B5B4B0180EC0FF04B90C8FC4B5A4B5A4B48ED1FE0EDFFE0 4A5B4A5B4A90C9FC4A48163F4A5ADA3FF017C05D4A48167F4A5A4990CA12FFD903FC1607 49BAFC5B4919805B5B90BBFC5A5A5A5A481A005A5ABCFCA462A44C7176F061>50 D<96267FFFE01670063FB6ED01F80503B700F01403053F04FC14074CB96C130F040706E0 131F043F72133F93BA00FC137F0303DC00076D13FF030F03C09039003FFF814B02FCC800 0713C3037F02E0030113F792B600806F6CB5FC02034ACA121F4A02F8834A02E0834A4A17 01027F4A8391B548CC7E494A85495C4C854988494A85494A85495C8A4991CDFC90B54886 A2484A1B7FA2481E3F5D481E1F5D5A1F0FA2485CA3481E075DA2F703F0489BC7FCA45DA2 B6FCB27EA281A47EA2F703F06FF307F87EA36C80A21F0F7E6F1CF07E6F1B1F7E20E06C6E 1B3F816DF57FC06D80F7FF806D806D6E4F13006D6E616D525A826D6E4F5A6D6E4F5A6E6D 6C4E5A021F6EF0FFE06E6E4D5B6E02F84D5B6E02FE050F90C7FC02006E6CEE3FFE6F02F0 EEFFFC031F02FE03035B6FDAFFC0021F13E0030303FF0103B55A030093B7C8FC043F18FC 040718F0040118C0DC003F94C9FC050316F8DD003F1580DE007F01F0CAFC757A75F78C> 67 D<92383FFFF80207B612E0027F15FC49B87E010717E0011F83499026F0007F13FC49 48C7000F7F90B502036D7E486E6D806F6D80727F486E6E7F8486727FA28684A26C5C7280 6C5C6D90C8FC6D5AEB0FF8EB03E090CAFCA70507B6FC041FB7FC0303B8FC157F0203B9FC 021FECFE0391B612800103ECF800010F14C04991C7FC017F13FC90B512F04814C0485C48 91C8FC485B5A485B5C5A5CA2B5FC5CA360A36E5DA26C5F6E5D187E6C6D846E4A48806C6D 4A4814FC6C6ED90FF0ECFFFC6C02E090263FE07F14FE00019139FC03FFC06C91B6487E01 3F4B487E010F4B1307010303F01301D9003F0280D9003F13FC020101F8CBFC57507ACE5E >97 D<93387FFF80030FB512FC037FECFF804AB712E0020716F8021F16FE027FD9F8077F 49B5D8C000804991C7003F13E04901FC020F7F49496E7F49498049496E7F49496E7F90B5 5A48727E92C914804884485B1BC048841BE0485BA27313F05AA25C5AA21BF885A2B5FCA3 91BAFCA41BF002F8CCFCA67EA3807EA47E806CF103F0F207F86C7F1A0F6C6E17F06C191F 6F17E06C6E163F6D6DEE7FC06D6D16FF6D6D4B13806D6D4B13006D6D6CEC0FFE6D02E0EC 3FFC6D02F8ECFFF86D9126FFC00F5B023F91B65A020F178002034CC7FC020016F8031F15 E0030392C8FCDB000F13E04D507BCE58>101 D<903801FFFCB6FCA8C67E131F7FB3AD95 380FFFE095B512FE05036E7E050F15E0053F15F84D81932701FFF01F7F4CD900077FDC07 FC6D80DC0FF06D80DC1FC07F4C48824CC8FC047E6F7F5EEDFDF85E03FF707F5EA25EA25E A293C9FCA45DB3B3A6B8D8E003B81280A8617879F76C>104 D<902601FFFCEC7FFEB602 0FB512F0057F14FE4CB712C0040716F0041F82047F16FE93B5C66C7F92B500F0010F14C0 C66C0380010380011F4AC76C806D4A6E8004F06F7F4C6F7F4C6F7F4C8193C915804B7014 C0861DE0A27414F0A27414F8A47513FCA57513FEAF5113FCA598B512F8A31DF0621DE062 1DC0621D806F5E701800704B5B505B704B5B7092B55A04FC4A5C704A5C706C010F5C05E0 013F49C7FC9227FE7FFC01B55A70B712F0040F16C0040393C8FC040015F8053F14C00503 01F0C9FC94CCFCB3A6B812E0A85F6F7ACD6C>112 D<902601FFF8EB07FEB691383FFFC0 94B512F00403804C14FE4C8093261FFC3F138093263FE07F13C0DC7F80B5FCC66C5D011F DAFE0114E06DEBF9FC16F815FB16F016E015FF16C07114C05E72138095381FFE0093C76C 5AF001E095C8FCA25DA65DB3B3A2B812F8A8434E7ACD4F>114 D<15FFA75CA55CA45CA2 5CA25CA25CA25C91B5FCA25B5B5B131F5B90B9FC120FBAFCA6D8000791C9FCB3B3A3F01F E0AE183F7014C07F187F7014806D16FF826D4B13006E6D485AEEFE0F6E90B55A020F5D6E 5D020115C06E6C5C031F49C7FC030113F03B6E7CEC4B>116 D E %EndDVIPSBitmapFont end %%EndProlog %%BeginSetup %%Feature: *Resolution 600dpi TeXDict begin %%BeginPaperSize: a4 a4 %%EndPaperSize %%EndSetup %%Page: 50 1 50 0 bop 0 714 a Fw(Chapter)65 b(2)0 1129 y Fv(The)77 b(Language)h(PCF)0 1611 y Fu(2.1)135 b(In)l(tro)t(duction)0 1814 y Ft(This)35 b(c)m(hapter)i(presen)m(ts)f(a)h(language)g(for)f Fs(Pr)-5 b(o)g(gr)g(amming)41 b(Computable)f(F)-7 b(unctions)44 b Ft(called)36 b(PCF,)h(originally)0 1926 y(form)m(ulated)25 b(b)m(y)g(Dana)h(Scott)g(in)e(an)h(in\015uen)m(tial)e(unpublished)e (man)m(uscript)i([Sco69)r(].)39 b(It)26 b(is)e(a)i(t)m(yp)s(ed)f (functional)0 2039 y(language)35 b(based)g(on)f(lam)m(b)s(da)g (calculus.)52 b(The)35 b(language)g(is)e(designed)h(to)i(b)s(e)e (easily)g(analyzed,)i(rather)e(than)0 2152 y(as)28 b(a)g(practical)g (language)g(for)f(writing)f(large)i(programs.)39 b(Ho)m(w)m(ev)m(er,)31 b(with)c(certain)g(extensions)h(to)g(the)g(surface)0 2265 y(syn)m(tax,)34 b(it)e(is)g(p)s(ossible)f(to)i(write)f(man)m(y)h (functional)e(programs)i(in)e(a)i(comfortable)g(st)m(yle.)49 b(The)32 b(presen)m(tation)0 2378 y(of)i(PCF)g(here)g(is)f(informal)f (in)h(the)h(sense)g(that)h(w)m(e)f(will)e(discuss)g(the)i(constructs)g (of)g(the)h(language,)g(and)f(the)0 2491 y(axiomatic,)26 b(op)s(erational)e(and)f(denotational)h(seman)m(tics,)i(without)e (going)g(in)m(to)g(the)h(pro)s(ofs)e(of)i(basic)e(theorems.)0 2604 y(The)30 b(main)f(topics)h(of)h(the)f(c)m(hapter)h(are:)136 2792 y Fr(\017)46 b Ft(In)m(tro)s(duction)41 b(to)h(syn)m(tax)h(and)e (seman)m(tics)h(of)g(t)m(yp)s(ed)f(lam)m(b)s(da)g(calculus)f(and)h (related)h(languages)g(b)m(y)227 2904 y(example.)136 3092 y Fr(\017)k Ft(T)-8 b(reatmen)m(t)32 b(of)f(recursiv)m(e)e (de\014nitions)f(b)m(y)i(\014xed-p)s(oin)m(t)g(op)s(erators.)136 3280 y Fr(\017)46 b Ft(Discussion)c(of)j(axiomatic,)i(op)s(erational)c (and)h(denotational)f(seman)m(tics,)48 b(with)43 b(a)h(summary)f(of)h (the)227 3393 y(relationships)28 b(b)s(et)m(w)m(een)j(them.)136 3580 y Fr(\017)46 b Ft(Demonstration)25 b(that)g(basic)e(programming)g (metho)s(ds)h(ma)m(y)g(b)s(e)g(carried)f(out)i(in)e(a)h(simpli\014ed)d (functional)227 3693 y(language.)136 3881 y Fr(\017)46 b Ft(Study)29 b(of)i(expressiv)m(e)f(p)s(o)m(w)m(er)g(and)g (limitations)e(of)j(the)f(language)h(using)e(op)s(erational)h(seman)m (tics.)141 4068 y(The)d(main)f(goals)i(are)g(to)g(dev)m(elop)f(a)h (feel)f(for)g(the)g(programming)f(capabilities)g(of)h(lam)m(b)s (da-calculus-based)0 4181 y(languages)34 b(and)f(summarize)g(general)g (prop)s(erties)f(and)h(tec)m(hniques)h(that)g(apply)e(to)j(a)f(v)-5 b(ariet)m(y)34 b(of)f(languages.)0 4294 y(Op)s(erational)26 b(seman)m(tics)j(are)f(considered)f(in)f(more)i(depth)g(than)f (denotational)h(seman)m(tics,)h(since)e(later)h(c)m(hap-)0 4407 y(ters)j(fo)s(cus)f(on)g(the)h(denotational)f(and)g(axiomatic)h (seman)m(tics.)41 b(W)-8 b(e)31 b(discuss)e(\\programming)h(tec)m (hniques")g(at)0 4520 y(some)g(length,)f(to)h(giv)m(e)g(some)g(in)m (tuition)d(for)i(the)g(w)m(a)m(y)i(that)f(familiar)d(programming)h (constructs)i(ma)m(y)f(b)s(e)g(rep-)0 4633 y(resen)m(ted)h(in)f(lam)m (b)s(da)g(calculus)g(and)g(pro)m(v)m(e)i(b)s(oth)e(p)s(ositiv)m(e)g (and)h(negativ)m(e)h(results)e(ab)s(out)g(the)i(expressiv)m(eness)0 4746 y(of)26 b(PCF.)h(The)e(c)m(hapter)i(concludes)e(with)g(a)i(brief)d (o)m(v)m(erview)j(of)f(extensions)g(and)g(v)-5 b(ariations)25 b(of)h(PCF)g(that)h(ha)m(v)m(e)0 4859 y(either)h(practical)h(or)f (theoretical)i(signi\014cance.)39 b(The)28 b(tec)m(hnical)h(theorems)g (ab)s(out)f(PCF)h(that)g(are)h(not)f(pro)m(v)m(ed)0 4972 y(in)g(this)g(c)m(hapter)i(are)g(pro)m(v)m(ed)g(in)e(Chapters)h(5)g (and)g(8,)h(as)g(sp)s(ecial)e(cases)i(of)f(more)h(general)f(results.) 141 5085 y(F)-8 b(or)39 b(those)g(familiar)e(with)g(denotational)h (seman)m(tics,)j(w)m(e)e(p)s(oin)m(t)f(out)h(sev)m(eral)g (di\013erences)f(b)s(et)m(w)m(een)h(the)0 5198 y(use)h(of)h(lam)m(b)s (da)e(calculus)g(in)h(this)f(b)s(o)s(ok)h(and)g(the)h(traditional)d (use)j(of)f(lam)m(b)s(da)g(calculus)f(in)g(denotational)0 5310 y(seman)m(tics.)56 b(One)35 b(is)g(t)m(yping.)55 b(The)35 b(meta-language)i(in)d(standard)h(texts)h(on)g(denotational)f (seman)m(tics,)i(suc)m(h)1905 5589 y(50)p eop %%Page: 51 2 51 1 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(51)0 91 y(as)38 b([Gor79)r(,)f(MS76)q(,)h(Sc)m (h86)q(,)g(Sto77)q(],)i(is)d(not)h(explicitly)d(t)m(yp)s(ed.)63 b(In)37 b(con)m(trast,)k(w)m(e)d(use)g(only)f(t)m(yp)s(ed)g(lam)m(b)s (da)0 204 y(calculus.)g(This)20 b(clari\014es)i(the)g(kind)f(of)i(v)-5 b(alue)22 b(eac)m(h)h(expression)f(de\014nes,)h(and)f(simpli\014es)d (the)k(tec)m(hnical)f(analysis)0 317 y(in)i(sev)m(eral)h(w)m(a)m(ys.)40 b(Another)25 b(di\013erence)g(is)f(that)i(w)m(e)f(regard)h(PCF)e (itself)g(as)i(a)f(language)h(for)f(writing)e(programs,)0 430 y(rather)29 b(than)h(solely)e(as)i(a)g(meta-language)h(for)f (giving)e(seman)m(tics)i(to)g(other)g(languages.)41 b(One)29 b(reason)h(for)f(this)0 543 y(approac)m(h)24 b(is)g(to)h(dev)m(elop)f (some)g(in)m(tuition)e(for)i(the)g(expressiv)m(e)g(p)s(o)m(w)m(er)g(of) h(t)m(yp)s(ed)f(lam)m(b)s(da)f(calculus.)37 b(Another)24 b(is)0 656 y(to)29 b(suggest)g(that)g(lam)m(b)s(da)d(calculus)h(ma)m(y) i(b)s(e)e(used)h(not)g(only)f(for)h(denotational)g(seman)m(tics,)h(but) f(for)g(studying)0 769 y(op)s(erational)i(and)f(pragmatic)i(issues)e (in)g(programming)g(language)i(analysis)e(and)h(design.)141 882 y(The)g(ev)-5 b(aluation)29 b(order)g(used)g(in)g(PCF)h(is)f Fs(lazy)38 b Ft(or)30 b Fs(left-most.)41 b Ft(This)28 b(is)h(the)h(ev)-5 b(aluation)30 b(order)f(used)g(in)g(the)0 995 y(pure)h(functional)f(programming)g(languages)i(Hask)m(ell)g([HF92) q(,)g(H)2303 962 y Fp(+)2371 995 y Ft(92)q(])g(and)f(Miranda)f([T)-8 b(ur85)q(].)42 b(\(See)31 b([P)m(ey87)r(])0 1108 y(for)37 b(information)f(on)h(the)h(implemen)m(tation)e(of)h(lazy)h(functional)d (languages.\))63 b(In)36 b(con)m(trast,)41 b(the)d(languages)0 1220 y(Lisp)30 b([McC60)r(,)i(McC78)q(,)g(Ste84)q(])g(and)f(ML)h ([Mil85b,)g(MTH90)q(,)g(MT91)q(,)g(Ull94)o(])g(use)g(an)g Fs(e)-5 b(ager)42 b Ft(form)31 b(of)h(ev)-5 b(alu-)0 1333 y(ation.)42 b(While)30 b(most)h(practical)g(languages)g(use)g (eager)h(ev)-5 b(aluation,)31 b(there)g(are)g(some)h(adv)-5 b(an)m(tages)32 b(\(as)g(w)m(ell)e(as)0 1446 y(disadv)-5 b(an)m(tages\))37 b(to)f(dev)m(eloping)f(a)h(basic)g(theory)g(using)e (lazy)i(ev)-5 b(aluation.)57 b(T)-8 b(o)36 b(a)g(\014rst)f(appro)m (ximation,)i(the)0 1559 y(c)m(hoice)h(b)s(et)m(w)m(een)h(ev)-5 b(aluation)37 b(orders)g(is)g(a)h(matter)g(of)g(taste.)64 b(Since)37 b(w)m(e)h(can)g(sim)m(ulate)f(eager)i(reduction)d(in)0 1672 y(a)h(lazy)g(language,)i(and)d(con)m(v)m(ersely)i([Plo75],)h(the)e (reduction)f(systems)h(are)g(theoretically)f(equiv)-5 b(alen)m(t.)59 b(The)0 1785 y(denotational)28 b(seman)m(tics)h(are)g (also)f(in)m(terde\014nable,)f(although)h(there)g(are)h(some)g (simpli\014cations)c(in)i(the)i(eager)0 1898 y(case.)41 b(On)29 b(the)g(other)h(hand,)e(the)h(axiomatic)h(seman)m(tics)f(of)h (eager)g(languages)g(seem)f(more)g(complicated.)40 b(The)0 2011 y(main)30 b(reasons)h(w)m(e)g(prefer)g(to)g(study)f(lazy)h(PCF)g (in)f(this)g(b)s(o)s(ok)g(are)h(that)h(this)e(giv)m(es)h(the)g (simplest)e(corresp)s(on-)0 2124 y(dence)h(b)s(et)m(w)m(een)h (axiomatic,)g(op)s(erational,)e(and)g(denotational)h(seman)m(tics,)h (and)e(also)h(the)h(most)f(\015exibilit)m(y)d(in)0 2237 y(op)s(erational)32 b(seman)m(tics)h(since)g(w)m(e)g(ha)m(v)m(e)h (equiv)-5 b(alen)m(t)33 b(deterministic,)f(nondeterministic)e(and)i (parallel)g(forms)0 2350 y(of)e(program)g(execution.)41 b(The)30 b(theory)g(is)f(also)i(older)e(and)g(more)i(fully)d(dev)m (elop)s(ed.)40 b(Since)29 b(similar)e(tec)m(hniques)0 2462 y(apply)j(in)g(b)s(oth)h(cases,)i(the)f(ideas)f(describ)s(ed)e(in) h(this)g(b)s(o)s(ok)h(are)h(useful)e(for)h(analyzing)g(b)s(oth)g(forms) g(of)g(ev)-5 b(alu-)0 2575 y(ation.)41 b(A)30 b(general)h(setting)f (for)g(considering)f(b)s(oth)g(ev)-5 b(aluation)30 b(orders)g(is)f(the) i(extension)f(of)g(PCF)g(with)f(lifted)0 2688 y(t)m(yp)s(es,)i(describ) s(ed)d(in)h(Section)h(2.6.4.)0 2975 y Fu(2.2)135 b(Syn)l(tax)46 b(of)f(PCF)0 3181 y Fo(2.2.1)112 b(Ov)m(erview)0 3353 y Ft(Ev)m(ery)31 b(expression)e(of)h(PCF)h(has)f(a)g(unique)f(t)m(yp)s (e.)41 b(Therefore,)30 b(w)m(e)h(ma)m(y)g(summarize)e(the)i(constructs) g(of)f(PCF)0 3465 y(b)m(y)37 b(listing)e(the)i(t)m(yp)s(es)g(of)g(the)g (language.)62 b(The)36 b(basic)h(v)-5 b(alues)36 b(are)h(natural)f(n)m (um)m(b)s(ers)g(and)g(b)s(o)s(oleans)g(\(truth)0 3578 y(v)-5 b(alues)36 b Fs(true)44 b Ft(and)37 b Fs(false)7 b Ft(\),)39 b(whic)m(h)d(ha)m(v)m(e)i(t)m(yp)s(es)46 b Fs(nat)54 b Ft(and)45 b Fs(b)-5 b(o)g(ol)20 b Ft(,)39 b(resp)s(ectiv)m(ely)-8 b(.)60 b(PCF)37 b(also)g(has)g(pairs,)g(whic)m (h)0 3691 y(b)s(elong)31 b(to)h(cartesian)g(pro)s(duct)f(t)m(yp)s(es,)h (and)f(functions,)g(b)s(elonging)f(to)j(function)d(t)m(yp)s(es.)45 b(The)31 b(PCF)h(notation)0 3804 y(for)38 b(the)g(cartesian)h(pro)s (duct)e(of)h(t)m(yp)s(es)47 b Fn(\033)i Ft(and)d Fn(\034)57 b Ft(is)45 b Fn(\033)19 b Fr(\002)14 b Fn(\034)19 b Ft(.)64 b(F)-8 b(or)39 b(example,)h(the)e(t)m(yp)s(e)h(of)f(natural)f(n)m(um)m (b)s(er)0 3917 y(pairs)32 b(is)g(written)40 b Fs(nat)25 b Fr(\002)15 b Fs(nat)j Ft(.)48 b(The)33 b(t)m(yp)s(e)g(of)h(a)f (function)f(with)g(domain)40 b Fn(\033)45 b Ft(and)32 b(range)42 b Fn(\034)51 b Ft(is)33 b(written)40 b Fn(\033)3710 3911 y Fr(!)3816 3917 y Fn(\034)19 b Ft(.)0 4030 y(Some)29 b(notational)f(con)m(v)m(en)m(tions)i(regarding)e(t)m(yp)s(e)h (expressions)e(are)i(that)2594 4024 y Fr(!)2721 4030 y Ft(asso)s(ciates)h(to)f(the)g(righ)m(t,)g(and)36 b Fr(\002)0 4143 y Ft(has)28 b(higher)e(precedence)i(than)1110 4137 y Fr(!)1209 4143 y Ft(.)40 b(Th)m(us)35 b Fn(\033)1581 4137 y Fr(!)1687 4143 y Fn(\034)1752 4137 y Fr(!)1858 4143 y Fn(\032)h Ft(is)27 b(paren)m(thesized)g(as)37 b Fn(\033)2784 4137 y Fr(!)2875 4143 y Ft(\()p Fn(\034)2975 4137 y Fr(!)3081 4143 y Fn(\032)p Ft(\))8 b(,)30 b(and)35 b Fn(\033)19 b Fr(\002)14 b Fn(\034)3630 4137 y Fr(!)3736 4143 y Fn(\032)36 b Ft(as)0 4256 y(\()p Fn(\033)19 b Fr(\002)c Fn(\034)10 b Ft(\))292 4250 y Fr(!)398 4256 y Fn(\032)e Ft(.)141 4369 y(One)24 b(prop)s(ert)m(y)g(of)g(PCF)g(is)g (that)g(only)g(expressions)f(that)i(satisfy)e(certain)i(t)m(yping)e (constrain)m(ts)i(are)f(actually)0 4482 y(considered)j(part)i(of)g(the) f(language.)41 b(F)-8 b(or)29 b(example,)g(although)f(PCF)g(has)h (addition,)e(the)i(expression)36 b Fs(true)23 b Ft(+)17 b(1)0 4595 y(is)30 b(not)g(considered)g(w)m(ell)f(formed.)41 b(\(It)30 b(do)s(es)h(not)f(mak)m(e)i(sense)e(to)i(add)d(a)i(truth)f(v) -5 b(alue)30 b(to)h(a)g(natural)f(n)m(um)m(b)s(er.\))0 4707 y(With)k(v)-5 b(ariables,)34 b(the)h(t)m(yping)f(conditions)e(dep) s(end)h(on)h(the)h(con)m(text)h(in)d(whic)m(h)g(an)i(expression)e(is)g (used.)52 b(F)-8 b(or)0 4820 y(example,)33 b Fn(x)5 b Ft(+)g(5)32 b(only)22 b(mak)m(es)i(sense)f(if)f(the)h(v)-5 b(ariable)30 b Fn(x)h Ft(is)22 b(declared)g(to)i(ha)m(v)m(e)g(t)m(yp)s (e)32 b Fs(nat)17 b Ft(.)39 b(A)23 b(precise)f(description)0 4933 y(of)k(PCF,)f(using)f(t)m(yping)h(rules)f(and)h(assumptions)e(ab)s (out)j(the)f(t)m(yp)s(es)h(of)f(v)-5 b(ariables,)26 b(is)e(giv)m(en)i (using)d(t)m(yping)i(rules)0 5046 y(in)k(Chapter)h(4.)42 b(In)30 b(the)g(follo)m(wing)f(informal)g(presen)m(tation,)i(w)m(e)g (assume)f(w)m(e)h(ha)m(v)m(e)h(in\014nitely)c(man)m(y)i(v)-5 b(ariables)0 5159 y(of)26 b(eac)m(h)h(t)m(yp)s(e)f(and)f(that)i(w)m(e)f (can)g(tell)g(what)f(t)m(yp)s(e)h(eac)m(h)h(v)-5 b(ariable)25 b(has.)39 b(When)26 b(w)m(e)g(write)34 b Fn(\025x)p Ft(:)15 b Fn(\033)d Ft(,)26 b(it)g(is)f(implicitly)0 5272 y(assumed)30 b(that)39 b Fn(x)g Ft(is)30 b(a)h(v)-5 b(ariable)29 b(of)i(t)m(yp)s(e) 39 b Fn(\033)12 b Ft(.)41 b(When)31 b(w)m(e)g(need)f(to)i(refer)e(to)h (the)g(t)m(yp)s(es)g(of)g(a)g(v)-5 b(ariable)29 b(that)j(are)p eop %%Page: 52 3 52 2 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(52)0 91 y(not)30 b(lam)m(b)s(da)f(b)s(ound,)g(w)m (e)h(will)e(simply)g(write)h(t)m(yping)h(assumptions)37 b Fn(x)2478 105 y Fp(1)2517 91 y Ft(:)15 b Fn(\033)2609 105 y Fp(1)2649 91 y Fn(;)g(:)g(:)g(:)h(;)f(x)2902 106 y Fm(k)2945 91 y Ft(:)g Fn(\033)3037 106 y Fm(k)3119 91 y Ft(in)29 b(paren)m(theses)h(or)g(in)0 204 y(the)h(text.)141 317 y(A)40 b(general)f(syn)m(tactic)i(issue)d(that)i(man)m(y)g(readers) f(will)e(b)s(e)i(familiar)f(with)g(is)g(the)i(distinction)d(b)s(et)m(w) m(een)0 430 y(ob)5 b(ject)36 b(notation)e(and)g(meta-notation.)55 b(The)35 b(syn)m(tax)g(of)g(PCF,)f(lik)m(e)g(other)h(languages)g(w)m(e) g(will)d(consider,)j(is)0 543 y(de\014ned)i(using)f(some)j(set)g Fs(V)-7 b(ar)48 b Ft(of)38 b(v)-5 b(ariables,)39 b(some)g(set)f Fs(Cst)47 b Ft(of)39 b(constan)m(t)g(sym)m(b)s(ols,)g(and)e(other)i (classes)f(of)0 656 y(sym)m(b)s(ols.)46 b(W)-8 b(e)34 b(do)f(not)g(need)f(to)i(b)s(e)e(concerned)h(with)e(what)i(the)g (elemen)m(ts)g(of)f(the)h(set)h Fs(V)-7 b(ar)42 b Ft(actually)33 b(are,)h(as)0 769 y(long)j(as)g(w)m(e)g(ha)m(v)m(e)h(in\014nitely)c (man)m(y)j(of)h(them)f(\(so)g(w)m(e)h(don't)f(run)e(out\))j(and)e(w)m (e)h(can)h(tell)e(whether)g(t)m(w)m(o)j(are)0 882 y(distinct)22 b(or)i(the)f(same.)39 b(W)-8 b(e)25 b(sa)m(y)f(that)h(the)f(sym)m(b)s (ols)e(and)h(expressions)f(of)i(PCF)f(b)s(elong)g(to)h(the)g Fs(obje)-5 b(ct)27 b(language)0 995 y Ft(since)33 b(PCF)h(is)f(the)i (ob)5 b(ject)35 b(of)f(study)-8 b(.)51 b(In)34 b(studying)e(PCF,)i(it)g (is)f(con)m(v)m(enien)m(t)i(to)g(use)f(additional)e(sym)m(b)s(ols)g(to) 0 1108 y(stand)f(for)h(arbitrary)f(sym)m(b)s(ols)f(and)h(expressions)g (of)h(the)g(ob)5 b(ject)32 b(language.)46 b(These)32 b(are)g(said)f(to)h(b)s(e)f(sym)m(b)s(ols)0 1220 y(of)g(the)f Fs(meta-language,)h Ft(the)g(language)g(w)m(e)f(use)g(in)f(our)h(study) g(of)g(the)h(ob)5 b(ject)31 b(language.)141 1333 y(W)-8 b(e)40 b(use)e(letters)46 b Fn(x;)15 b(y)s(;)g(z)t(;)g(:)g(:)g(:)c Ft(,)40 b(p)s(ossibly)c(with)h(subscripts,)h(primes)f(or)h(sup)s (erscripts,)f(as)i(meta-v)-5 b(ariables)0 1446 y(for)44 b(arbitrary)g(v)-5 b(ariables)43 b(of)i(PCF)f(\(elemen)m(ts)i(of)f Fs(V)-7 b(ar)10 b Ft(\))45 b(and)f(letters)53 b Fn(M)5 b(;)15 b(N)5 b(;)15 b(P)s(;)g(:)g(:)g(:)10 b Ft(,)49 b(again)44 b(p)s(ossibly)e(with)0 1559 y(subscripts,)31 b(primes)f(or)i(sup)s(erscripts,)e(as)j(meta-v)-5 b(ariables)32 b(for)g(expressions)f(of)h(PCF.)g(It)h(is)e(p)s(ossible)f(for)i(t)m(w)m (o)0 1672 y(meta)m(v)-5 b(ariables,)38 b Fn(x)f Ft(and)g Fn(y)12 b Ft(,)29 b(to)h(stand)f(for)g(the)g(same)h(ob)5 b(ject)30 b(v)-5 b(ariable.)39 b(W)-8 b(e)30 b(use)f(the)h(sym)m(b)s (ol)36 b Fr(\021)h Ft(for)29 b(syn)m(tactic)0 1785 y(equalit)m(y)k(of)g (ob)5 b(ject)35 b(expressions,)e(writing)39 b Fn(x)30 b Fr(\021)g Fn(y)45 b Ft(if)40 b Fn(x)i Ft(and)f Fn(y)j Ft(stand)33 b(for)g(the)h(same)g(v)-5 b(ariable)32 b(of)h(PCF)h(and)0 1898 y Fn(x)25 b Fr(6\021)h Fn(y)41 b Ft(to)32 b(indicate)d(that)i (they)g(are)g(distinct)e(v)-5 b(ariables.)40 b(If)30 b(w)m(e)h(sa)m(y)-8 b(,)32 b(\\let)39 b Fn(x)g Ft(and)f Fn(y)k Ft(b)s(e)29 b(v)-5 b(ariables")30 b(or)h(\\let)39 b Fn(M)0 2011 y Ft(and)f Fn(N)49 b Ft(b)s(e)29 b(terms,")i(then)f (these)h(could)f(b)s(e)f(distinct)g(v)-5 b(ariables)29 b(or)i(expressions,)e(or)h(syn)m(tactically)g(iden)m(tical.)0 2254 y Fo(2.2.2)112 b(Bo)s(oleans)38 b(and)g(natural)g(n)m(um)m(b)s (ers)0 2426 y Ft(The)26 b(basic)g(b)s(o)s(olean)g(expressions)g(are)h (the)g(constan)m(ts)h Fs(true)33 b Ft(and)26 b Fs(false)7 b Ft(,)28 b(and)f(the)f(b)s(o)s(olean-v)-5 b(alued)26 b(conditional)0 2539 y(expressions)1038 2652 y Fl(if)47 b Fr(h)p Fs(b)-5 b(o)g(ole)g(an)10 b Fr(i)48 b Fl(then)e Fr(h)p Fs(b)-5 b(o)g(ole)g(an)10 b Fr(i)48 b Fl(else)f Fr(h)p Fs(b)-5 b(o)g(ole)g(an)10 b Fr(i)p Fn(:)0 2819 y Ft(The)30 b(basic)g(natural)f(n)m(um)m(b)s(er)g(expressions)g (include)f Fs(numer)-5 b(als)1705 3023 y Ft(0)p Fn(;)15 b Ft(1)p Fn(;)g Ft(2)p Fn(;)g Ft(3)p Fn(;)g(:)g(:)g(:)20 b(;)0 3227 y Ft(the)34 b(usual)f(sym)m(b)s(ols)g(for)h(natural)f(n)m (um)m(b)s(ers,)h(and)g(addition,)g(written)41 b(+)8 b(.)53 b(Th)m(us)33 b(if)41 b Fn(M)53 b Ft(and)42 b Fn(N)52 b Ft(are)35 b(natural)0 3340 y(n)m(um)m(b)s(er)29 b(expressions,)g(so)i (is)38 b Fn(M)30 b Ft(+)20 b Fn(N)e Ft(.)41 b(W)-8 b(e)31 b(can)g(also)f(compute)h(natural)e(n)m(um)m(b)s(ers)g(using)g (conditional)g(tests,)717 3544 y Fl(if)47 b Fr(h)p Fs(b)-5 b(o)g(ole)g(an)10 b Fr(i)48 b Fl(then)e Fr(h)p Fs(natur)-5 b(al)p 1835 3544 28 4 v 45 w(numb)g(er)11 b Fr(i)48 b Fl(else)f Fr(h)p Fs(natur)-5 b(al)p 2817 3544 V 45 w(numb)g(er)10 b Fr(i)0 3748 y Ft(and)35 b(compare)g(natural)g(n)m(um)m(b)s(ers)f(for) h(equalit)m(y)-8 b(.)55 b(The)35 b(equalit)m(y)g(test)44 b Fs(Eq)8 b Ft(?)43 b(on)35 b(natural)g(n)m(um)m(b)s(ers)f(returns)g(a) 0 3861 y(b)s(o)s(olean)e(v)-5 b(alue.)46 b(F)-8 b(or)34 b(example,)41 b Fs(Eq)8 b Ft(?)32 b(3)h(0)41 b(has)33 b(the)f(b)s(o)s(olean)g(v)-5 b(alue)32 b Fs(false)7 b Ft(,)34 b(since)40 b(3)h(is)32 b(di\013eren)m(t)g(from)g(0,)i(but)0 3974 y Fs(Eq)8 b Ft(?)30 b(5)h(5)25 b(=)g Fs(true)15 b Ft(.)141 4087 y(The)30 b(t)m(yping)g(rules)f(of)h(PCF)g(prev)m(en)m (t)h(conditional)e(expressions)g(suc)m(h)h(as)1293 4291 y Fl(if)47 b Fr(h)p Fs(b)-5 b(o)g(ole)g(an)10 b Fr(i)48 b Fl(then)f Ft(3)h Fl(else)f Fs(true)7 b Fn(;)0 4496 y Ft(with)35 b(one)h(case)i(returning)c(a)j(b)s(o)s(olean)e(and)h(the)g (other)h(a)f(natural)f(n)m(um)m(b)s(er.)58 b(In)35 b(general,)j(PCF)e (allo)m(ws)g(an)m(y)0 4609 y(conditional)30 b(expression)38 b Fl(if)47 b Fr(h)p Fs(b)-5 b(o)g(ole)g(an)10 b Fr(i)48 b Fl(then)f Fn(M)58 b Fl(else)46 b Fn(N)19 b Ft(,)32 b(pro)m(vided)e(alternativ)m(es)40 b Fn(M)49 b Ft(and)39 b Fn(N)50 b Ft(ha)m(v)m(e)33 b(the)0 4721 y(same)e(t)m(yp)s(e.)41 b(This)28 b(allo)m(ws)i(us)g(to)h(c)m(ho)s(ose)g(b)s(et)m(w)m(een)g(n)m (umeric)e(functions)g(b)m(y)i(writing)1004 4926 y Fl(if)47 b Fr(h)p Fs(b)-5 b(o)g(ole)g(an)10 b Fr(i)48 b Fl(then)e Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:M)58 b Fl(else)47 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:N)5 b(;)0 5130 y Ft(for)30 b(example.)p eop %%Page: 53 4 53 3 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(53)141 91 y(T)-8 b(o)28 b(summarize)e(the)h (expressions)f(w)m(e)i(ha)m(v)m(e)g(considered)e(so)h(far,)h(the)g (basic)e(natural)g(n)m(um)m(b)s(er)g(and)h(b)s(o)s(olean)0 204 y(expressions)40 b(are)i(giv)m(en)f(b)m(y)g(the)h(follo)m(wing)e (pro)s(ductions.)71 b(While)41 b(w)m(e)g(ha)m(v)m(e)i(not)f(discussed)d (arbitrary)h(ex-)0 317 y(pressions)33 b(of)j(t)m(yp)s(e)43 b Fn(\033)12 b Ft(,)36 b(w)m(e)g(include)d(conditional)g(expressions)h (b)s(elo)m(w)g(since)h(conditional)e(is)h(most)i(naturally)0 430 y(considered)29 b(a)i(b)s(o)s(olean)e(op)s(eration.)652 612 y Fr(h)p Fs(b)-5 b(o)g(ol)p 849 612 28 4 v 44 w(exp)7 b Fr(i)83 b Ft(::=)g Fr(h)p Fs(b)-5 b(o)g(ol)p 1534 612 V 45 w(var)11 b Fr(i)k(j)g Fs(true)23 b Fr(j)15 b Fs(false)23 b Fr(j)15 b Fs(Eq)8 b Ft(?)15 b Fr(h)p Fs(nat)p 2598 612 V 43 w(exp)6 b Fr(i)15 b(h)p Fs(nat)p 2989 612 V 44 w(exp)6 b Fr(i)15 b(j)1337 725 y Fl(if)47 b Fr(h)p Fs(b)-5 b(o)g(ol)p 1677 725 V 45 w(exp)7 b Fr(i)48 b Fl(then)e Fr(h)p Fs(b)-5 b(o)g(ol)p 2362 725 V 45 w(exp)6 b Fr(i)48 b Fl(else)f Fr(h)p Fs(b)-5 b(o)g(ol)p 3047 725 V 45 w(exp)6 b Fr(i)652 955 y(h)p Fs(nat)p 828 955 V 43 w(exp)g Fr(i)105 b Ft(::=)83 b Fr(h)p Fs(nat)p 1513 955 V 43 w(var)11 b Fr(i)k(j)g Ft(0)g Fr(j)g Ft(1)g Fr(j)g Ft(2)g Fr(j)34 b Fn(:)15 b(:)g(:)31 b Fr(j)15 b(h)p Fs(nat)p 2440 955 V 44 w(exp)6 b Fr(i)21 b Ft(+)f Fr(h)p Fs(nat)p 2929 955 V 43 w(exp)6 b Fr(i)15 b(j)1337 1068 y Fl(if)47 b Fr(h)p Fs(b)-5 b(o)g(ol)p 1677 1068 V 45 w(exp)7 b Fr(i)48 b Fl(then)e Fr(h)p Fs(nat)p 2341 1068 V 43 w(exp)7 b Fr(i)48 b Fl(else)e Fr(h)p Fs(nat)p 3004 1068 V 44 w(exp)6 b Fr(i)652 1298 y(h)p Fn(\033)p 748 1298 V 37 w Fs(exp)g Fr(i)186 b Ft(::=)83 b Fn(:)15 b(:)g(:)32 b Fr(j)15 b Fl(if)47 b Fr(h)p Fs(b)-5 b(o)g(ol)p 1854 1298 V 45 w(exp)6 b Fr(i)48 b Fl(then)f Fr(h)p Fn(\033)p 2438 1298 V 37 w Fs(exp)6 b Fr(i)48 b Fl(else)f Fr(h)p Fn(\033)p 3020 1298 V 37 w Fs(exp)6 b Fr(i)0 1480 y Ft(Since)34 b(b)s(oth)f(natural)h(n)m(um)m(b)s(ers)f(and)h(b)s(o)s(oleans)f(ma)m(y) i(also)g(b)s(e)f(computed)g(b)m(y)h(function)e(calls,)i(these)g(are)g (not)0 1593 y Fs(al)5 b(l)40 b Ft(of)30 b(the)h(natural)e(n)m(um)m(b)s (er)g(and)g(b)s(o)s(olean)g(expressions)g(of)h(PCF.)h(The)e(additional) f(forms)i(will)d(presen)m(ted)j(in)0 1706 y(subsequen)m(t)g(sections)g (discussing)e(pro)s(duct)h(t)m(yp)s(es,)i(function)e(t)m(yp)s(es)h(and) g(recursiv)m(e)g(de\014nitions.)141 1819 y(The)37 b(equational)g (axioms)g(for)h(natural)e(n)m(um)m(b)s(er)g(and)h(b)s(o)s(olean)g (expressions)f(are)i(straigh)m(tforw)m(ard.)62 b(W)-8 b(e)0 1932 y(ha)m(v)m(e)32 b(an)e(in\014nite)e(collection)i(of)h(basic) e(axioms)922 2121 y(0)21 b(+)f(0)25 b(=)g(0)p Fn(;)47 b Ft(0)20 b(+)g(1)26 b(=)f(1)p Fn(;)46 b(:)15 b(:)g(:)h(;)46 b Ft(1)21 b(+)e(0)26 b(=)f(1)p Fn(;)46 b Ft(1)21 b(+)f(1)26 b(=)f(2)p Fn(;)46 b(:)15 b(:)g(:)0 2311 y Ft(for)34 b(addition,)f (giving)g(us)h(all)f(true)g(equations)h(of)h(the)f(form)42 b Fn(n)22 b Ft(+)g Fn(m)32 b Ft(=)f Fn(p)8 b Ft(,)35 b(for)f(n)m(umerals)41 b Fn(n)8 b Ft(,)43 b Fn(m)g Ft(and)e Fn(p)8 b Ft(,)36 b(and)0 2424 y(t)m(w)m(o)c(axiom)e(sc)m(hemes)h(for)f (conditional)f(expressions)g(of)h(eac)m(h)i(t)m(yp)s(e)1232 2605 y Fl(if)47 b Fs(true)55 b Fl(then)47 b Fn(M)58 b Fl(else)46 b Fn(N)111 b Ft(=)82 b Fn(M)5 b(;)1232 2718 y Fl(if)47 b Fs(false)56 b Fl(then)46 b Fn(M)58 b Fl(else)47 b Fn(N)93 b Ft(=)82 b Fn(N)5 b(:)0 2900 y Ft(There)30 b(are)h(in\014nitely)c(man)m(y)j(axioms)g(for)h(equalit)m(y)f(test,)h (determined)e(as)i(follo)m(ws)1068 3082 y Fs(Eq)8 b Ft(?)15 b Fn(n)g(n)107 b Ft(=)83 b Fs(true)7 b Fn(;)131 b Ft(eac)m(h)32 b(n)m(umeral)d Fn(n;)1068 3194 y Fs(Eq)8 b Ft(?)15 b Fn(m)g(n)82 b Ft(=)h Fs(false)8 b Fn(;)83 b(m;)15 b(n)30 b Ft(distinct)f(n)m(umerals.)141 3376 y(The)34 b(op)s(erational)f (seman)m(tics)i(of)f(natural)f(n)m(um)m(b)s(er)g(and)h(b)s(o)s(olean)f (expressions)g(are)h(de\014ned)f(using)g(a)h(set)0 3489 y(of)41 b Fs(r)-5 b(e)g(duction)45 b(axioms,)g Ft(eac)m(h)d(obtained)f (b)m(y)g(reading)f(one)i(of)f(the)h(equational)e(axioms)h(from)g(left)g (to)h(righ)m(t.)0 3602 y(In)g(lam)m(b)s(da)h(calculus,)i(these)e(are)h (usually)d(called)h(reduction)h(rules,)i(since)d(they)i(are)f(\\rules") g(telling)f(y)m(ou)0 3715 y(ho)m(w)36 b(to)h(reduce)f(a)h(term.)58 b(Ho)m(w)m(ev)m(er,)40 b(when)35 b(w)m(e)i(axiomatize)g(the)f (reduction)g(relation,)h(the)f(axioms)g(are)h(the)0 3828 y(basic)e(reduction)g(\\rules")g(obtained)g(b)m(y)g(reading)g(an)g (equational)h(axiom)f(from)g(left)h(to)g(righ)m(t.)56 b(Some)36 b(useful)0 3941 y(terminology)30 b(is)f(that)i(a)g(term)f (matc)m(hing)h(the)f(left-hand)g(side)f(of)i(a)f(reduction)g(axiom)g (is)f(called)h(a)h Fs(r)-5 b(e)g(dex.)141 4054 y Ft(In)36 b(the)h(op)s(erational)f(seman)m(tics)h(\(reduction)f(system\),)j(w)m (e)e(ma)m(y)h(ev)-5 b(aluate)37 b(an)g(expression)e(b)m(y)i(applying)0 4167 y(reduction)29 b(axioms)h(to)h(an)m(y)g(sub)s(expression.)38 b(T)-8 b(o)31 b(see)g(ho)m(w)f(this)g(w)m(orks,)g(consider)f(the)i (expression)1136 4356 y Fl(if)47 b Fs(Eq)8 b Ft(?)15 b(\(6)21 b(+)f(5\))15 b(17)49 b Fl(then)e Ft(\(1)21 b(+)f(1\))48 b Fl(else)f Ft(27)0 4546 y(W)-8 b(e)32 b(cannot)f(simplify)d(the)j (conditional)e(without)h(\014rst)g(pro)s(ducing)f(a)i(b)s(o)s(olean)f (constan)m(t)i Fs(true)37 b Ft(or)31 b Fs(false)7 b Ft(.)43 b(This)0 4659 y(in)31 b(turn)g(requires)f(n)m(umerals)h(for)h(b)s(oth)f (argumen)m(ts)i(to)41 b Fs(Eq)8 b Ft(?)g(,)32 b(so)h(w)m(e)f(b)s(egin)f (b)m(y)h(applying)e(the)i(reduction)f(rule)0 4772 y(6)21 b(+)f(5)25 b Fr(!)g Ft(11)8 b(.)42 b(This)29 b(giv)m(es)i(us)e(the)i (expression)1227 4961 y Fl(if)47 b Fs(Eq)8 b Ft(?)15 b(11)g(17)49 b Fl(then)e Ft(\(1)21 b(+)f(1\))49 b Fl(else)d Ft(27)0 5151 y(whic)m(h)29 b(is)h(simpli\014ed)c(using)j(a)i(reduction) e(rule)g(for)39 b Fs(Eq)8 b Ft(?)38 b(to)1319 5340 y Fl(if)47 b Fs(false)55 b Fl(then)46 b Ft(\(1)21 b(+)f(1\))49 b Fl(else)e Ft(27)p eop %%Page: 54 5 54 4 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(54)0 91 y(Finally)-8 b(,)23 b(one)g(of)g(the)f (rules)g(for)g(conditional)f(applies,)h(and)g(w)m(e)i(pro)s(duce)d(the) i(n)m(umeral)30 b(27)8 b(.)39 b(In)22 b(order)g(to)h(simplify)0 204 y(this)29 b(expression,)g(w)m(e)h(needed)g(to)h(ev)-5 b(aluate)30 b(the)g(test)h(b)s(efore)f(simplifying)c(the)k (conditional.)39 b(Ho)m(w)m(ev)m(er,)32 b(it)e(w)m(as)0 317 y(not)35 b(necessary)g(to)g(simplify)c(the)j(n)m(um)m(b)s(er)f (expression)42 b(1)23 b(+)g(1)43 b(since)34 b(this)f(is)h(discarded)e (b)m(y)j(the)f(conditional.)0 430 y(Since)20 b(w)m(e)i(ma)m(y)g(c)m(ho) s(ose)g(to)g(reduce)f(an)m(y)h(subterm)e(at)i(an)m(y)g(p)s(oin)m(t,)h (w)m(e)e(could)g(ha)m(v)m(e)h(simpli\014ed)k(1)r(+)r(1)g Fr(!)f Ft(2)30 b(b)s(et)m(w)m(een)0 543 y(an)m(y)22 b(t)m(w)m(o)h(of)f (the)g(reduction)f(steps)h(giv)m(en.)38 b(With)21 b(the)h(exception)g (of)g(this)e(\\nondeterministic)g(c)m(hoice,")25 b(the)d(steps)0 656 y(in)m(v)m(olv)m(ed)37 b(mimic)e(the)i(action)g(of)g(an)m(y)h (ordinary)d(in)m(terpreter)h(fairly)f(closely)-8 b(.)60 b(W)-8 b(e)39 b(will)34 b(discuss)h(connections)0 769 y(b)s(et)m(w)m(een)c(nondeterministic)d(and)h(deterministic)g (reduction)g(in)g(Section)h(2.3.4.)141 882 y(The)40 b(reader)g(ma)m(y)g (ha)m(v)m(e)h(noticed)f(that)h(w)m(e)f(do)g Fs(not)49 b Ft(ha)m(v)m(e)41 b(the)g(equational)e(axiom)48 b Fs(Eq)8 b Ft(?)15 b Fn(M)25 b(M)52 b Ft(=)40 b Fs(true)16 b Ft(,)0 995 y(for)30 b(arbitrary)g(natural-n)m(um)m(b)s(er)f(expression)38 b Fn(M)18 b Ft(.)42 b(One)30 b(reason)h(is)f(that)h(the)g(reduction)e (axiom)39 b Fs(Eq)8 b Ft(?)15 b Fn(M)25 b(M)36 b Fr(!)0 1108 y Fs(true)49 b Ft(w)m(ould)32 b(lead)h(to)i(a)e(non-con\015uen)m (t)h(reduction)e(system)i(for)f(PCF)h(\(see)g(Section)g(2.3.4\).)52 b(In)33 b(reducing)f(an)0 1220 y(expression)43 b Fs(Eq)8 b Ft(?)14 b Fn(M)26 b(N)18 b Ft(,)37 b(w)m(e)g(m)m(ust)e(\014rst)g (simplify)41 b Fn(M)54 b Ft(and)43 b Fn(N)54 b Ft(to)37 b(n)m(umerals.)56 b(This)34 b(corresp)s(onds)g(to)j(actual)0 1333 y(implemen)m(tations,)29 b(where)h(a)h(test)g(for)f(natural)g(n)m (um)m(b)s(er)f(equalit)m(y)h(in)m(v)m(olv)m(es)g(ev)-5 b(aluating)30 b(b)s(oth)g(expressions.)141 1446 y(The)38 b(denotational)f(seman)m(tics)h(of)g(the)h(basic)e(natural)g(n)m(um)m (b)s(er)f(and)i(b)s(o)s(olean)f(expressions)f(falls)g(under)0 1559 y(the)d(general)g(pattern)f(of)h(algebraic)f(terms)h(and)f(their)g (in)m(terpretation)g(in)f(a)i(m)m(ulti-sorted)f(algebra,)i(whic)m(h)d (is)0 1672 y(co)m(v)m(ered)36 b(in)e(detail)g(in)f(Chapter)i(3.)54 b(T)-8 b(o)36 b(giv)m(e)f(a)g(hin)m(t)f(of)h(things)f(to)h(come,)i(w)m (e)f(will)c(summarize)i(some)h(of)g(the)0 1785 y(main)i(ideas)h(here.) 65 b(W)-8 b(e)40 b(assign)e(a)g(\\mathematical)i(meaning,")g(or)f Fs(denotation)47 b Ft(to)39 b(ev)m(ery)h(natural)d(n)m(um)m(b)s(er)0 1898 y(and)28 b(b)s(o)s(olean)f(expression)g(b)m(y)i(\014rst)e(c)m(ho)s (osing)h(a)h(set)37 b Fn(N)47 b Ft(of)28 b(natural-n)m(um)m(b)s(er)f(v) -5 b(alues)28 b(and)f(a)i(set)37 b Fn(B)k Ft(of)29 b(b)s(o)s(olean)0 2011 y(v)-5 b(alues.)38 b(In)25 b(the)g(standard)f(seman)m(tics)h(of)h (natural-n)m(um)m(b)s(er)d(and)h(b)s(o)s(olean)g(expressions)g(alone,)i (these)g(w)m(ould)e(b)s(e)0 2124 y(the)i(usual)e(set)j(of)f(natural)e (n)m(um)m(b)s(ers)h(and)g(the)h(usual)e(set)j(of)e(b)s(o)s(oleans.)39 b(Ho)m(w)m(ev)m(er,)29 b(in)24 b(the)i(con)m(text)i(of)e(PCF,)f(w)m(e)0 2237 y(will)g(also)i(include)e(an)i(extra)g(elemen)m(t)h(in)e(eac)m(h)i (set)g(to)g(accoun)m(t)h(for)d(the)i(fact)g(that)g(PCF)f(has)g(partial) f(recursiv)m(e)0 2350 y(functions)h(on)h(natural)f(n)m(um)m(b)s(ers,)h (in)e(addition)h(to)i(total)g(functions,)e(and)h(similarly)d(for)j(b)s (o)s(oleans.)39 b(The)27 b(extra)0 2462 y(elemen)m(t)i(arises)g(from)f (the)h(fact)h(that)g(w)m(e)f(ma)m(y)h(treat)g(a)f(partial)f(function)g (from)37 b Fn(N)47 b Ft(to)38 b Fn(N)47 b Ft(as)29 b(a)g(total)h (function)0 2575 y(from)38 b Fn(N)49 b Ft(to)39 b Fn(N)30 b Fr([)20 b(f1g)8 b Ft(,)32 b(as)e(is)g(sometimes)g(done)g(in)f (recursiv)m(e)h(function)f(theory)-8 b(.)141 2688 y(Once)42 b(w)m(e)g(ha)m(v)m(e)h(c)m(hosen)f(a)g(set)g(of)g(v)-5 b(alues)41 b(for)g(eac)m(h)i(t)m(yp)s(e,)i(w)m(e)d(can)g(giv)m(e)g (meaning)f(to)i(expressions)d(b)m(y)0 2801 y(c)m(ho)s(osing)31 b(a)h(v)-5 b(alue)31 b(for)g(eac)m(h)i(free)f(v)-5 b(ariable.)43 b(Then,)31 b(using)f(induction)f(on)i(expressions,)g(w)m(e)h(sp)s (ecify)e(a)i(unique)0 2914 y(mathematical)38 b(v)-5 b(alue)38 b(\(elemen)m(t)g(of)h(the)f(appropriate)f(set\))i(for)e(eac)m(h)i (expression.)63 b(In)37 b(the)h(standard)f(in)m(ter-)0 3027 y(pretation)32 b(of)g(natural)f(n)m(um)m(b)s(ers)f(and)h(b)s(o)s (olean)g(expressions,)40 b(2)21 b(+)g(3)41 b(has)32 b(its)f(usual)f(v) -5 b(alue,)41 b(5)8 b(,)33 b(and)e(so)h(on,)h(so)0 3140 y(there)f(is)g(nothing)f(v)m(ery)h(surprising)d(in)i(this)g(case.)47 b(Since)31 b(the)i(denotational)f(seman)m(tics)g(of)g(basic)g(data)h(t) m(yp)s(es)0 3253 y(are)39 b(a)g(sp)s(ecial)e(case)i(of)g(\014rst-order) f(seman)m(tics)h(\(or)f(mo)s(del)g(theory\),)j(the)e(basic)f(idea)g(is) f(probably)g(familiar)0 3366 y(from)29 b(logic.)40 b(The)29 b(main)f(reason)h(for)g(men)m(tioning)g(the)g(denotational)g(seman)m (tics)h(at)g(this)e(p)s(oin)m(t)g(is)h(to)h(con)m(trast)0 3479 y(this)f(with)h(the)g(axiomatic)h(seman)m(tics)g(\(equational)f (pro)s(of)g(system\))h(and)f(op)s(erational)g(seman)m(tics)h (\(reduction)0 3592 y(rules\),)f(whic)m(h)f(are)h(en)m(tirely)g(syn)m (tactic.)0 3832 y Fk(De\014nable)35 b(functions)0 4003 y Ft(Ev)m(en)21 b(without)e(lam)m(b)s(da)g(abstraction,)k(w)m(e)e(can)f (think)f(of)i(basic)f(PCF)g(natural-n)m(um)m(b)s(er)e(expressions)h(as) i(de\014ning)0 4116 y(n)m(umeric)29 b(functions.)39 b(T)-8 b(o)30 b(describ)s(e)e(this)h(precisely)-8 b(,)29 b(w)m(e)i(need)e(to)i (distinguish)26 b(b)s(et)m(w)m(een)k(the)g(natural)f(n)m(um)m(b)s(ers)0 4229 y(and)35 b(the)h(sym)m(b)s(ols)e(\(called)h Fs(numer)-5 b(als\))41 b Ft(used)34 b(in)g(PCF.)i(If)43 b Fn(n)34 b Fr(2)f(N)57 b Ft(is)35 b(a)h(natural)e(n)m(um)m(b)s(er,)i(then)f(one) h(of)g(the)0 4342 y(sym)m(b)s(ols)42 b(0)p Fn(;)15 b Ft(1)p Fn(;)g Ft(2)p Fn(;)g(:)g(:)g(:)47 b Ft(of)35 b(PCF)f(is)g(the)i (n)m(umeral)d(for)43 b Fn(n)8 b Ft(,)37 b Fs(i.e.)p Ft(,)e(the)g(sym)m (b)s(ol)f(w)m(e)i(usually)c(use)j(to)h(write)42 b Fn(n)h Ft(on)35 b(a)0 4455 y(piece)d(of)g(pap)s(er.)45 b(F)-8 b(or)33 b(an)m(y)40 b Fn(n)28 b Fr(2)g(N)21 b Ft(,)33 b(let)f(us)f(write)39 b Fr(d)p Fn(n)p Fr(e)i Ft(for)32 b(this)f(n)m(umeral.)45 b(Using)31 b(this)g(notation,)i(w)m(e)f(sa)m(y) h(an)0 4568 y(expression)d Fn(M)10 b Ft(:)15 b Fs(nat)42 b Ft(with)22 b(natural)g(n)m(um)m(b)s(er)g(v)-5 b(ariable)31 b Fn(x)g Fs(de\014nes)c(a)f(numeric)g(function)39 b Fn(f)10 b Ft(:)15 b Fr(N)38 b(!)25 b(N)45 b Fs(implicitly)0 4681 y Ft(if,)31 b(for)g(ev)m(ery)i(natural)d(n)m(um)m(b)s(er)39 b Fn(n)27 b Fr(2)f(N)c Ft(,)32 b(w)m(e)g(ha)m(v)m(e)41 b([)p Fr(d)p Fn(n)p Fr(e)p Fn(=x)p Ft(])p Fn(M)d Fr(!)-61 b(!)28 b(d)p Fn(f)10 b Ft(\()p Fn(n)p Ft(\))p Fr(e)e Ft(.)44 b(In)31 b(w)m(ords,)h(w)m(e)g(can)g(simplify)c(the)0 4794 y(expression)38 b([)p Fr(d)p Fn(n)p Fr(e)p Fn(=x)p Ft(])p Fn(M)20 b Ft(,)31 b(with)f(the)h(n)m(umeral)f(for)39 b Fn(n)g Ft(in)30 b(place)h(of)39 b Fn(x)8 b Ft(,)32 b(to)g(the)f(n)m(umeral)f(for)h(the)g(function)e(v)-5 b(alue)0 4907 y Fn(f)10 b Ft(\()p Fn(n)p Ft(\))e(.)0 5119 y Fk(Example)34 b(2.2.1)46 b Ft(The)29 b(n)m(umeric)f(function)36 b Fn(f)10 b Ft(\()p Fn(n)p Ft(\))25 b(=)g Fn(n)17 b Ft(+)g(5)38 b(is)28 b(de\014ned)g(implicitly)d(b)m(y)k(the)h(expression)36 b Fn(x)18 b Ft(+)f(5)8 b(,)0 5232 y(where)38 b Fn(x)h Ft(ranges)30 b(o)m(v)m(er)i(natural)d(n)m(um)m(b)s(ers.)p 3861 5232 40 40 v eop %%Page: 55 6 55 5 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(55)141 91 y(The)25 b(notion)g(of)h(implicit)d (de\014nition)g(ma)m(y)j(b)s(e)f(extended)h(to)g(other)g(t)m(yp)s(es.) 39 b(A)26 b(b)s(o)s(olean)f(expression)32 b Fn(M)10 b Ft(:)15 b Fs(b)-5 b(o)g(ol)0 204 y Ft(with)37 b(b)s(o)s(olean)g(v)-5 b(ariable)45 b Fn(x)h Fs(de\014nes)40 b(a)g(b)-5 b(o)g(ole)g(an)42 b(function)54 b Fn(f)i Fs(implicitly)47 b Ft(if)e([)p Fs(true)7 b Fn(=x)p Ft(])p Fn(M)49 b Fr(!)-61 b(!)38 b(d)p Fn(f)10 b Ft(\()p Fs(true)d Ft(\))p Fr(e)48 b Ft(and)0 317 y([)p Fs(false)8 b Fn(=x)p Ft(])p Fn(M)47 b Fr(!)-61 b(!)36 b(d)p Fn(f)10 b Ft(\()p Fs(false)d Ft(\))p Fr(e)h Ft(.)62 b(It)37 b(is)f(easy)h(to)h(see)g(that)f(negation)g(is)f (de\014ned)g(implicitly)d(b)m(y)k(the)g(expression)0 430 y Fl(if)47 b Fn(x)h Fl(then)e Fs(false)56 b Fl(else)46 b Fs(true)16 b Ft(.)39 b(Binary)28 b(functions)f(ma)m(y)h(also)h(b)s(e) e(de\014ned)g(implicitly)-8 b(,)26 b(as)i(in)f(Exercises)h(2.2.2)0 543 y(and)i(2.2.3.)141 656 y(With)j(recursion,)h(w)m(e)g(will)e(b)s(e)h (able)g(to)i(de\014ne)e(all)g(computable)g(n)m(umeric)g(functions)f(in) h(PCF.)h(Ho)m(w)m(ev)m(er,)0 769 y(using)28 b(only)h(the)g(basic)g (natural-n)m(um)m(b)s(er)f(and)h(b)s(o)s(olean)g(expressions)f(giv)m (en)h(in)g(this)f(section,)i(there)g(are)g(man)m(y)0 882 y(functions)f(that)i(cannot)g(b)s(e)f(de\014ned.)39 b(One)30 b(example)g(is)f(giv)m(en)i(in)e(Exercise)h(2.2.3.)0 1094 y Fk(Exercise)35 b(2.2.2)47 b Ft(W)-8 b(rite)44 b(expressions)f(with)f(b)s(o)s(olean)i(v)-5 b(ariables)50 b Fn(x)j Ft(and)e Fn(y)k Ft(whic)m(h)43 b(implicitly)d(de\014ne)k(the)0 1207 y(conjunction)29 b(\()8 b Fn(x)21 b Fr(^)f Fn(y)12 b Ft(\))30 b(and)g(disjunction)d(\()8 b Fn(x)21 b Fr(_)f Fn(y)12 b Ft(\))30 b(of)39 b Fn(x)f Ft(and)g Fn(y)12 b Ft(.)0 1420 y Fk(Exercise)35 b(2.2.3)47 b Ft(Sho)m(w)29 b(that)i(the)f(exp)s(onen)m(tiation)g(function)f(is)g(not)h(implicitly) c(de\014nable)j(using)f(PCF)i(nat-)0 1533 y(ural)e(n)m(um)m(b)s(er)f (and)i(b)s(o)s(olean)f(expressions.)39 b(In)28 b(other)h(w)m(ords,)g (pro)m(v)m(e)h(that)g(there)f(is)f(no)h(basic)f(natural)g(n)m(um)m(b)s (er)0 1645 y(expression)37 b Fn(M)49 b Ft(with)29 b(n)m(umeric)g(v)-5 b(ariables)38 b Fn(x)g Ft(and)g Fn(y)k Ft(suc)m(h)30 b(that)39 b([)15 b Fr(d)p Fn(n)p Fr(e)p Fn(=x)p Ft(])g(\([)g Fr(d)p Fn(m)p Fr(e)p Fn(=y)s Ft(])p Fn(M)10 b Ft(\))43 b(has)30 b(v)-5 b(alue)38 b Fr(d)p Fn(n)3635 1613 y Fm(m)3702 1645 y Fr(e)8 b Ft(.)0 1889 y Fo(2.2.3)112 b(P)m(airing)36 b(and)i(functions)0 2061 y Ft(In)21 b(PCF,)h(w)m(e)g(can)g(form)f (ordered)g(pairs)f(and)i(functions)e(of)i(an)m(y)g(t)m(yp)s(e.)38 b(If)29 b Fn(M)40 b Ft(and)30 b Fn(N)39 b Ft(are)23 b(an)m(y)f(PCF)f (expressions,)0 2173 y(then)51 b Fr(h)p Fn(M)5 b(;)15 b(N)10 b Fr(i)52 b Ft(is)41 b(the)i(ordered)f(pair)g(whose)g(\014rst)g (comp)s(onen)m(t)h(has)g(the)f(same)h(v)-5 b(alue)43 b(as)51 b Fn(M)61 b Ft(and)42 b(second)0 2286 y(comp)s(onen)m(t)h(has)f (the)h(same)g(v)-5 b(alue)43 b(as)51 b Fn(N)18 b Ft(.)78 b(Ev)m(ery)43 b(PCF)f(pair)g(has)g(a)h(cartesian)g(pro)s(duct)f(t)m(yp) s(e)g(whic)m(h)g(is)0 2399 y(determined)25 b(b)m(y)g(the)i(follo)m (wing)d(simple)g(rule:)37 b(if)c Fn(M)44 b Ft(has)26 b(t)m(yp)s(e)35 b Fn(\033)i Ft(and)d Fn(N)44 b Ft(has)25 b(t)m(yp)s(e)35 b Fn(\034)18 b Ft(,)27 b(then)f(the)g(pair)33 b Fr(h)p Fn(M)5 b(;)15 b(N)10 b Fr(i)0 2512 y Ft(has)30 b(t)m(yp)s(e)39 b Fn(\033)19 b Fr(\002)c Fn(\034)j Ft(.)41 b(F)-8 b(or)31 b(example,)39 b Fr(h)p Ft(3)p Fn(;)15 b Ft(5)p Fr(i)41 b Ft(is)29 b(an)i(ordered)f(pair)f(of)i(natural)e(n)m (um)m(b)s(ers,)h(with)37 b Fr(h)p Ft(3)p Fn(;)15 b Ft(5)p Fr(i)28 b Ft(:)e Fs(nat)e Fr(\002)15 b Fs(nat)j Ft(,)0 2625 y(and)30 b(the)g(\\nested)h(pair")38 b Fr(h)p Ft(3)p Fn(;)15 b Fr(h)p Ft(5)p Fn(;)g Ft(7)p Fr(ii)42 b Ft(has)30 b(t)m(yp)s(e)39 b Fs(nat)25 b Fr(\002)o Ft(\()p Fs(nat)g Fr(\002)15 b Fs(nat)10 b Ft(\))e(.)141 2738 y(In)33 b(addition)f(to)i (forming)e(pairs,)h(w)m(e)h(can)g(also)f(\\tak)m(e)j(pairs)c(apart")i (using)e(pro)5 b(jection)33 b(op)s(erations.)49 b(The)0 2851 y(pro)5 b(jection)30 b(op)s(erations)38 b Fk(Pro)6 b(j)1088 2873 y Fp(1)1166 2851 y Ft(and)38 b Fk(Pro)6 b(j)1556 2873 y Fp(2)1634 2851 y Ft(return)30 b(the)g(\014rst)g(and)g (second)h(comp)s(onen)m(ts)f(of)h(a)g(pair.)40 b(This)29 b(is)0 2964 y(formalized)g(in)g(the)i(t)m(w)m(o)h(equational)d(axioms) 39 3168 y(\()p Fs(pr)-5 b(oj)15 b Ft(\))887 b Fk(Pro)6 b(j)1369 3191 y Fp(1)1408 3168 y Fr(h)p Fn(M)f(;)15 b(N)10 b Fr(i)27 b Ft(=)e Fn(M)5 b(;)76 b Fk(Pro)6 b(j)2215 3191 y Fp(2)2255 3168 y Fr(h)p Fn(M)f(;)15 b(N)10 b Fr(i)26 b Ft(=)f Fn(N)5 b(:)0 3372 y Ft(The)39 b(\014nal)f(axiom)h(for)h (pairing)d(is)i(based)g(on)g(the)h(idea)f(that)h(t)m(w)m(o)h(pairs)d (with)g(the)h(same)h(\014rst)f(and)g(second)0 3485 y(comp)s(onen)m(ts) 33 b(m)m(ust)g(b)s(e)f(equal)g(\()p Fs(i.e.)p Ft(,)i(the)f(same)g (pair\).)47 b(Since)32 b(an)m(y)42 b Fn(P)13 b Ft(:)i Fn(\033)j Fr(\002)d Fn(\034)51 b Ft(is)32 b(a)i(pair,)e(w)m(e)h(can)h (form)e(a)h(pair)0 3598 y Fr(h)p Ft(\()p Fk(Pro)6 b(j)275 3621 y Fp(1)315 3598 y Fn(P)13 b Ft(\))p Fn(;)i Ft(\()p Fk(Pro)6 b(j)701 3621 y Fp(2)741 3598 y Fn(P)13 b Ft(\))p Fr(i)41 b Ft(from)31 b(the)h(\014rst)g(and)f(second)h(comp)s(onen)m(ts) g(of)40 b Fn(P)22 b Ft(.)45 b(This)30 b(m)m(ust)i(b)s(e)f(the)i(same)f (as)40 b Fn(P)22 b Ft(,)0 3711 y(since)30 b(it)g(has)g(the)g(same)h (comp)s(onen)m(ts.)41 b(This)29 b(giv)m(es)h(us)g(the)g(equational)g (axiom)39 3915 y(\()p Fs(sp)6 b Ft(\))1222 b Fr(h)p Ft(\()p Fk(Pro)6 b(j)1695 3938 y Fp(1)1735 3915 y Fn(P)13 b Ft(\))p Fn(;)i Ft(\()p Fk(Pro)6 b(j)2122 3938 y Fp(2)2161 3915 y Fn(P)13 b Ft(\))p Fr(i)26 b Ft(=)f Fn(P)s(:)141 4120 y Ft(One)k(p)s(oin)m(t)g(ab)s(out)h(the)38 b(\()p Fs(sp)6 b Ft(\))39 b(axiom,)30 b(called)f Fs(surje)-5 b(ctive)31 b(p)-5 b(airing,)31 b Ft(is)e(that)h(this)f(is)g(redundan)m(t)f(for)i (explicit)0 4232 y(pair)36 b(terms)i(of)g(the)g(form)45 b Fr(h)p Fn(M)5 b(;)15 b(N)10 b Fr(i)e Ft(.)64 b(This)36 b(is)h(easily)g(demonstrated)h(b)m(y)f(substituting)44 b Fr(h)p Fn(M)5 b(;)15 b(N)10 b Fr(i)47 b Ft(for)f Fn(P)59 b Ft(and)0 4345 y(applying)28 b(equational)i(axioms)g(to)h(subterms:) 1293 4542 y Fr(h)p Ft(\()p Fk(Pro)6 b(j)1568 4564 y Fp(1)1607 4542 y Fr(h)p Fn(M)f(;)15 b(N)10 b Fr(i)p Ft(\))p Fn(;)15 b Ft(\()p Fk(Pro)6 b(j)2210 4564 y Fp(2)2250 4542 y Fr(h)p Fn(M)f(;)15 b(N)10 b Fr(i)p Ft(\))p Fr(i)1293 4655 y Ft(=)25 b Fr(h)p Fn(M)5 b(;)15 b Ft(\()p Fk(Pro)6 b(j)1797 4677 y Fp(2)1837 4655 y Fr(h)p Fn(M)f(;)15 b(N)10 b Fr(i)p Ft(\))p Fr(i)1293 4767 y Ft(=)25 b Fr(h)p Fn(M)5 b(;)15 b(N)10 b Fr(i)0 4969 y Ft(Ho)m(w)m(ev)m(er,)32 b(if)k Fn(x)p Ft(:)15 b Fn(\033)k Fr(\002)c Fn(\034)48 b Ft(is)28 b(a)i(v)-5 b(ariable)28 b(of)h(pro)s(duct)f(t)m(yp)s(e,)i(then)f(w)m(e) h(cannot)g(pro)m(v)m(e)38 b Fr(h)p Ft(\()p Fk(Pro)6 b(j)3158 4992 y Fp(1)3197 4969 y Fn(x)p Ft(\))p Fn(;)15 b Ft(\()p Fk(Pro)6 b(j)3565 4992 y Fp(2)3604 4969 y Fn(x)p Ft(\))p Fr(i)26 b Ft(=)f Fn(x)0 5082 y Ft(without)37 b(the)i(axiom)f(that)g (giv)m(es)h(us)e(this)g(equation)h(directly)-8 b(.)64 b(This)36 b(is)h(demonstrated)i(in)e(Example)g(2.4.3,)0 5195 y(whic)m(h)26 b(app)s(ears)h(in)f(a)i(later)f(section)h(since)f (it)g(dep)s(ends)e(on)i(prop)s(erties)f(of)i(con\015uen)m(t)f (reduction)g(systems.)39 b(The)0 5308 y(reason)28 b(the)f(axiom)g(is)f (called)h(surjectiv)m(e)g(pairing)e(is)i(that)h(it)f(implies)d(that)k (the)f(pairing)f(function)g(is)g(surjectiv)m(e)p eop %%Page: 56 7 56 6 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(56)0 91 y(on)m(to)37 b(the)f(set)g(of)g(elemen)m (ts)g(of)f(pro)s(duct)g(t)m(yp)s(e.)56 b(A)36 b(consequence)h(of)44 b(\()p Fs(sp)6 b Ft(\))45 b(is)34 b(giv)m(en)i(in)e(part)i(\(a\))g(of)g (Exercise)0 204 y(2.2.7.)141 317 y(As)j(for)f(natural)f(n)m(um)m(b)s (er)g(and)h(b)s(o)s(olean)f(expressions,)j(the)e(reduction)g(rules)f (for)h(pairs)f(are)i(deriv)m(ed)e(b)m(y)0 430 y(reading)32 b(the)h(equational)g(axioms)g(from)f(left)h(to)h(righ)m(t.)48 b(Ho)m(w)m(ev)m(er,)36 b(w)m(e)e(only)e(include)f(reduction)h(rules)f (corre-)0 543 y(sp)s(onding)k(to)j(the)46 b(\()p Fs(pr)-5 b(oj)15 b Ft(\))46 b(axioms.)61 b(There)37 b(is)f(no)46 b(\()p Fs(sp)7 b Ft(\))46 b(reduction)36 b(rule)g(in)g(the)i(op)s (erational)e(seman)m(tics)i(of)0 656 y(PCF)30 b(for)g(t)m(w)m(o)h (reasons.)41 b(The)29 b(\014rst)h(is)f(that)i(it)e(is)g(not)i (necessary)-8 b(,)31 b(as)f(demonstrated)h(b)m(y)e(the)i(adequacy)f(of) h(the)0 769 y(op)s(erational)25 b(seman)m(tics)g(without)33 b(\()p Fs(sp)7 b Ft(\))h(,)27 b(discussed)d(in)g(Sections)h(2.3)i(and)e (5.4.1.)40 b(The)25 b(second)h(is)e(that)j(the)e(rule)0 882 y(causes)k(con\015uence)g(to)g(fail,)f(when)f(com)m(bined)h(with)g (recursiv)m(e)g(de\014nitions)e(of)i(functions)g(\(see)h(Section)g (4.4.3\).)0 1122 y Fk(F)-9 b(unctions)0 1293 y Ft(PCF)25 b(functions)g(are)h(written)e(using)g(lam)m(b)s(da)h(abstraction,)i (and)e(most)h(of)g(the)f(examples)h(giv)m(en)f(in)f(Section)i(1.2)0 1406 y(are)e(PCF)g(expressions.)37 b(F)-8 b(or)24 b(example,)h(since)e (w)m(e)i(ha)m(v)m(e)g(n)m(umerals)d(and)h(addition)f(in)h(PCF,)g(b)s (oth)32 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)7 b Ft(+)g(1)0 1519 y(and)34 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b Ft(5)36 b(are)27 b(acceptable)g(PCF,)g(with)e(t)m(yp)s(e)35 b Fs(nat)1974 1513 y Fr(!)2081 1519 y Fs(nat)9 b Fn(:)35 b Ft(In)26 b(general,)h(a)g(PCF)g(function)e(ma)m(y)i(ha)m(v)m(e)h(an)m (y)0 1632 y(PCF)42 b(t)m(yp)s(e)g(as)h(domain)e(or)h(range.)76 b(Since)41 b(w)m(e)i(can)f(ha)m(v)m(e)h(functions)e(that)i(tak)m(e)h (functions)c(as)j(argumen)m(ts)0 1745 y(and)34 b(return)f(functions)g (as)i(results,)f(PCF)g(is)f(more)i(\015exible)e(\(in)g(this)g (direction\))h(than)g(man)m(y)g(programming)0 1858 y(languages.)41 b(A)30 b(simple)f(higher-order)g(function)g(is)g(comp)s(osition)g(of)i (n)m(umeric)e(functions)903 2085 y Fs(c)-5 b(omp)1139 2030 y Fj(def)1156 2085 y Ft(=)42 b Fn(\025f)10 b Ft(:)15 b Fs(nat)1568 2079 y Fr(!)1675 2085 y Fs(nat)9 b Fn(:)15 b(\025g)s Ft(:)g Fs(nat)2143 2079 y Fr(!)2249 2085 y Fs(nat)9 b Fn(:)15 b(\025x)p Ft(:)g Fs(nat)c Fn(:)k(f)10 b Ft(\()p Fn(g)s(x)p Ft(\))p Fn(:)0 2289 y Ft(T)-8 b(o)36 b(see)g(ho)m(w)f(this)f(w)m(orks,)j(supp)s(ose)42 b Fn(f)53 b Ft(and)43 b Fn(g)k Ft(are)36 b(n)m(umeric)e(functions.)54 b(Then)43 b Fs(c)-5 b(omp)43 b Fn(f)h(g)j Ft(is)35 b(the)g(function)0 2402 y Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(f)10 b Ft(\()p Fn(g)s(x)p Ft(\))e(;)32 b(the)e(function)f(whic)m(h,)h(on)g (argumen)m(t)39 b Fn(x)8 b Ft(,)31 b(returns)37 b Fn(f)10 b Ft(\()p Fn(g)s(x)p Ft(\))e(.)42 b(Th)m(us)37 b Fs(c)-5 b(omp)38 b Fn(f)h(g)k Ft(de\014nes)37 b Fn(f)30 b Fr(\016)21 b Fn(g)12 b Ft(.)141 2515 y(As)30 b(men)m(tioned)g(in)f(Section)i(1.3,) g(w)m(e)g(ha)m(v)m(e)h(the)e(equational)g(axiom)39 2719 y(\()p Fn(\013)p Ft(\))966 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)36 b Ft(=)25 b Fn(\025y)s Ft(:)15 b Fn(\033)n(:)p Ft([)p Fn(y)s(=x)p Ft(])p Fn(M)5 b(;)77 b(y)33 b Ft(not)e(free)f(in)g Fn(M)0 2924 y Ft(for)g(renaming)f(b)s(ound)f(v)-5 b(ariables.)39 b(This)29 b(axiom)h(is)f(related)h(only)f(to)i(the)f(fact)h(that)39 b Fn(\025)g Ft(is)29 b(a)h(binding)d(op)s(erator,)0 3037 y(and)k(do)s(es)f(not)i(ha)m(v)m(e)g(an)m(ything)f(to)h(do)f(with)f (the)h(w)m(a)m(y)h(that)g(lam)m(b)s(da)e(abstraction)h(de\014nes)g(a)g (function.)42 b(Since)0 3150 y(renaming)35 b(of)g(b)s(ound)f(v)-5 b(ariables)34 b(is)h(so)h(basic,)h(it)e(is)g(useful)f(to)i(ha)m(v)m(e)h (a)f(sp)s(ecial)e(name)i(for)f(it:)51 b(w)m(e)36 b(ma)m(y)h(write)0 3262 y Fn(M)e Ft(=)194 3276 y Fm(\013)269 3262 y Fn(N)48 b Ft(if)30 b(terms)38 b Fn(M)49 b Ft(and)38 b Fn(N)48 b Ft(di\013er)30 b(only)f(in)g(the)i(names)f(of)g(b)s(ound)f(v)-5 b(ariables.)39 b(It)31 b(is)e(often)i(con)m(v)m(enien)m(t)g(to)0 3375 y(write)40 b Fn(F)13 b(V)20 b Ft(\()p Fn(M)10 b Ft(\))42 b(for)32 b(the)h(free)g(v)-5 b(ariables)31 b(of)41 b Fn(M)18 b Ft(,)34 b Fs(i.e.)p Ft(,)e(the)h(v)-5 b(ariables)31 b(app)s(earing)h(in)39 b Fn(M)51 b Ft(that)33 b(are)g(not)g(b)s(ound)0 3488 y(b)m(y)39 b Fn(\025)8 b Ft(.)141 3601 y(The)30 b(second)g(axiom,)39 3805 y(\()p Fn(\014)5 b Ft(\))1332 b(\()p Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)10 b Ft(\))p Fn(N)37 b Ft(=)25 b([)p Fn(N)r(=x)p Ft(])p Fn(M)5 b(;)0 4010 y Ft(giv)m(es)27 b(us)g(a)g(w)m(a)m(y)i(of)e(computing)f(the)h (result)f(of)i(function)e(application)f(b)m(y)i(substitution.)37 b(T)-8 b(o)28 b(a)m(v)m(oid)g(an)m(y)f(confu-)0 4123 y(sion)32 b(ab)s(out)h(substitution)e(and)i(b)s(ound)e(v)-5 b(ariables,)33 b(w)m(e)h(de\014ne)f(substitution)e(on)i(t)m(yp)s(ed)g (lam)m(b)s(da)f(expressions)0 4235 y(precisely)-8 b(,)25 b(b)m(y)f(the)h(follo)m(wing)e(induction,)g(with)g(three)i(sub)s(cases) f(for)g(di\013eren)m(t)g(forms)g(of)g(lam)m(b)s(da)g(abstractions:)713 4432 y([)p Fn(N)r(=x)p Ft(])p Fn(x)84 b Ft(=)f Fn(N)717 4545 y Ft([)p Fn(N)r(=x)p Ft(])p Fn(a)h Ft(=)f Fn(a;)46 b Ft(for)30 b(constan)m(t)h(of)g(v)-5 b(ariable)29 b Fn(a)c Fr(6)p Ft(=)g Fn(x)551 4658 y Ft([)p Fn(N)r(=x)p Ft(]\()p Fn(P)13 b(Q)p Ft(\))85 b(=)e(\([)p Fn(N)r(=x)p Ft(])p Fn(P)13 b Ft(\)\([)p Fn(N)r(=x)p Ft(])p Fn(Q)p Ft(\))446 4771 y([)p Fn(N)r(=x)p Ft(])p Fn(\025x)p Ft(:)i Fn(\033)n(:M)95 b Ft(=)83 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)450 4883 y Ft([)p Fn(N)r(=x)p Ft(])p Fn(\025y)s Ft(:)g Fn(\033)n(:M)95 b Ft(=)83 b Fn(\025y)s Ft(:)15 b Fn(\033)n(:)p Ft([)p Fn(N)r(=x)p Ft(])p Fn(M)5 b(;)48 b Ft(pro)m(vided)28 b Fn(x)e Fr(6)p Ft(=)f Fn(y)33 b Ft(and)d Fn(y)e Fr(62)d Fn(F)13 b(V)20 b Ft(\()p Fn(N)10 b Ft(\))450 4996 y([)p Fn(N)r(=x)p Ft(])p Fn(\025y)s Ft(:)15 b Fn(\033)n(:M)95 b Ft(=)83 b(\()p Fn(\025z)t Ft(:)15 b Fn(\033)n(:)p Ft([)p Fn(N)r(=x)p Ft(][)p Fn(z)t(=y)s Ft(])p Fn(M)10 b Ft(\))p Fn(;)50 b Ft(where)30 b Fn(z)f Fr(62)c Fn(F)13 b(V)20 b Ft(\()p Fn(M)10 b(N)g Ft(\))31 b(and)61 b Fn(y)s(;)15 b(z)29 b Fr(6)p Ft(=)c Fn(x)0 5193 y Ft(While)i(most)h(of)g(these)h (clauses)e(are)i(easily)e(understo)s(o)s(d,)g(it)g(ma)m(y)i(b)s(e)e(w)m (orth)h(sa)m(ying)g(a)h(few)f(more)g(w)m(ords)f(ab)s(out)0 5306 y(the)39 b(last)g(three)h(lines.)65 b(The)38 b(fourth)h(line)e (mak)m(es)j(sense)f(when)f(w)m(e)i(remem)m(b)s(er)e(that)i(a)g (substitution)45 b([)p Fn(N)r(=x)p Ft(])p eop %%Page: 57 8 57 7 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(57)0 91 y(only)35 b(replaces)g Fs(fr)-5 b(e)g(e)43 b Ft(o)s(ccurrences)36 b(of)44 b Fn(x)g Ft(b)m(y)g Fn(N)18 b Ft(.)57 b(Since)43 b Fn(x)h Ft(is)34 b(b)s(ound)g(in)43 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)k Ft(,)37 b(the)f(substitution)42 b([)p Fn(N)r(=x)p Ft(])0 204 y(has)37 b(no)g(e\013ect)i(on)f(this)e (term.)62 b(The)36 b(last)i(t)m(w)m(o)g(clauses)f(tell)g(ho)m(w)g(to)h (substitute)f(for)g(a)h(free)f(v)-5 b(ariable)36 b(inside)0 317 y(the)d(binding)c(op)s(erator)41 b Fn(\025)8 b Ft(.)47 b(If)40 b Fn(y)j Ft(is)32 b(not)h(free)f(in)f(the)i(term)40 b Fn(N)51 b Ft(w)m(e)33 b(are)g(inserting)d(in)m(to)41 b Fn(M)18 b Ft(,)33 b(then)f(w)m(e)h(ma)m(y)g(go)0 430 y(ahead)e(and)g(p)s(erform)e(the)j(substitution.)40 b(This)29 b(is)h(the)i(in)m(ten)m(t)f(of)g(the)g(\014fth)f(line)g(of)h(the)g (de\014nition.)41 b(Ho)m(w)m(ev)m(er,)0 543 y(if)48 b Fn(y)j Ft(is)39 b(free)h(in)48 b Fn(N)18 b Ft(,)43 b(then)d(w)m(e)g(ha) m(v)m(e)i(a)f(con\015ict)f(and)f(w)m(e)i(m)m(ust)f(rename)49 b Fn(y)i Ft(to)41 b(some)g(other)f(v)-5 b(ariable)47 b Fn(z)53 b Ft(to)0 656 y(a)m(v)m(oid)35 b(capturing)e(the)h(free)43 b Fn(y)i Ft(in)d Fn(N)18 b Ft(.)52 b(The)34 b(option)g(is)f(pro)m (vided)g(b)m(y)h(the)g(last)g(line)f(of)h(the)h(de\014nition.)50 b(Since)0 769 y(substitution)30 b(ma)m(y)i(in)m(v)m(olv)m(e)h (arbitrary)d(renaming,)i(substitution)e(is)h(only)g(de\014ned)f(up)h (to)41 b Fn(\013)9 b Ft(-equiv)-5 b(alence.)46 b(In)0 882 y(other)31 b(w)m(ords,)f(if)f(w)m(e)i(compute)40 b([)p Fn(N)r(=x)p Ft(])p Fn(M)50 b Ft(b)m(y)30 b(this)g(de\014nition,)e (w)m(e)j(ma)m(y)g(end)f(up)f(with)h(an)m(y)g(one)h(of)g(an)f (in\014nite)0 995 y(n)m(um)m(b)s(er)d(of)h(p)s(ossible)d(terms.)40 b(Ho)m(w)m(ev)m(er,)31 b(all)c(of)h(the)g(p)s(ossibilities)c(are)36 b(=)2541 1009 y Fm(\013)2627 995 y Ft(to)28 b(eac)m(h)h(other.)41 b(Since)27 b(w)m(e)h(consider)0 1108 y Fn(\013)9 b Ft(-equiv)-5 b(alen)m(t)36 b(terms)h(as)f(essen)m(tially)g(the)h(same,)h(and)e(they) h(are)g(pro)m(v)-5 b(ably)36 b(equal)g(in)f(the)i(simplest)d(p)s (ossible)0 1220 y(w)m(a)m(y)-8 b(,)46 b(this)40 b(\\nondeterminism")f (in)h(the)i(de\014nition)d(of)j(substitution)d(is)h(completely)h (harmless.)72 b(It)42 b(is)e(easy)0 1333 y(to)d(see)g(that)g (substitution)d(resp)s(ects)44 b Fn(\013)9 b Ft(-equiv)-5 b(alence,)38 b(in)d(the)h(sense)g(that)46 b([)p Fn(N)r(=x)p Ft(])p Fn(M)g Ft(=)3108 1347 y Fm(\013)3192 1333 y Ft([)p Fn(N)r(=x)p Ft(])p Fn(P)59 b Ft(whenev)m(er)0 1446 y Fn(M)35 b Ft(=)194 1460 y Fm(\013)269 1446 y Fn(P)21 b Ft(.)141 1559 y(Substitution)32 b(is)i(extended)g(to)h(PCF)g(b)m(y)f (adding)f(cases)j(for)e(addition,)g(conditional,)g(etc.)55 b(These)34 b(are)h(all)0 1672 y(straigh)m(tforw)m(ard,)40 b(and)e(follo)m(w)f(the)i(pattern)f(of)g(the)h(application)d(case)j(ab) s(o)m(v)m(e:)58 b(w)m(e)39 b(substitute)45 b([)p Fn(N)r(=x)p Ft(])j(in)37 b(a)0 1785 y(comp)s(ound)k(expression)g(b)m(y)i(applying)d (this)h(substitution)g(to)i(eac)m(h)g(of)g(its)f(parts,)j Fs(e.g.)p Ft(,)54 b([)p Fn(N)r(=x)p Ft(]\()p Fn(P)43 b Ft(+)28 b Fn(Q)p Ft(\))45 b(=)0 1898 y(\([)p Fn(N)r(=x)p Ft(])p Fn(P)13 b Ft(\))27 b(+)f(\([)p Fn(N)r(=x)p Ft(])p Fn(Q)p Ft(\))8 b(.)66 b(Exercise)38 b(2.2.6,)k(whic)m(h)37 b(ma)m(y)h(b)s(e)g(useful)e(to)j(remem)m(b)s(er,)h(asks)e(y)m(ou)h(to)g (pro)m(v)m(e)g(the)0 2011 y(follo)m(wing)29 b(iden)m(tities)g(in)m(v)m (olving)g(substitution.)561 2184 y([)p Fn(M)5 b(=x)p Ft(]\([)p Fn(N)r(=x)p Ft(])p Fn(P)13 b Ft(\))86 b(=)d([\([)p Fn(M)5 b(=x)p Ft(])p Fn(N)10 b Ft(\))p Fn(=x)p Ft(])p Fn(P)s(;)561 2297 y Ft([)p Fn(M)5 b(=x)p Ft(]\([)p Fn(N)r(=y)s Ft(])p Fn(P)13 b Ft(\))90 b(=)83 b([\([)p Fn(M)5 b(=x)p Ft(])p Fn(N)10 b Ft(\))p Fn(=y)s Ft(]\([)p Fn(M)5 b(=x)p Ft(])p Fn(P)13 b Ft(\))34 b(if)c Fn(y)e Fr(6\021)d Fn(x)30 b Ft(and)g Fn(y)e Fr(62)d Fn(F)13 b(V)20 b Ft(\()p Fn(M)10 b Ft(\))0 2470 y(The)23 b(com)m(bination)g(of)32 b Fn(\013)9 b Ft(-con)m(v)m(ersion)23 b(and)g(renaming)g(b)s(ound)e(v)-5 b(ariables)22 b(in)g(substitution)f(pro)m(vide)i Fs(static)k(sc)-5 b(op)g(e)0 2583 y Ft(in)29 b(PCF,)h(as)h(illustrated)d(in)h(Exercise)h (2.2.13.)141 2696 y(The)36 b(\014nal)g(equational)g(axiom)h(for)f (functions)g(is)f(based)i(on)f(the)h(idea)g(that)g(t)m(w)m(o)h (functions)e(are)h(equal)f(if)0 2809 y(they)27 b(pro)s(duce)e(equal)h (v)-5 b(alues)25 b(on)i(all)e(argumen)m(ts.)40 b(T)-8 b(o)27 b(see)g(ho)m(w)f(this)f(arises,)i(supp)s(ose)33 b Fn(M)10 b Ft(:)15 b Fn(\033)3224 2803 y Fr(!)3330 2809 y Fn(\034)45 b Ft(is)25 b(a)i(function)0 2922 y(expression,)f(and)34 b Fn(x)p Ft(:)15 b Fn(\033)37 b Ft(is)25 b(some)i(v)-5 b(ariable)25 b(not)h(app)s(earing)e(in)33 b Fn(M)19 b Ft(.)39 b(The)25 b(condition)g(on)34 b Fn(x)g Ft(is)25 b(to)i(mak)m(e)g(sure)e(that)0 3035 y(w)m(e)j(do)f(not)g(use)36 b Fn(x)f Ft(in)26 b(t)m(w)m(o)j(di\013eren)m(t)d(w)m(a)m(ys.)41 b(Then)26 b(since)35 b(\()p Fn(M)10 b(x)p Ft(\):)15 b Fn(\034)20 b Ft(,)28 b(the)f(expression)35 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:)p Ft(\()p Fn(M)10 b(x)p Ft(\))37 b(also)27 b(de\014nes)0 3148 y(a)i(function)f(from)37 b Fn(\033)k Ft(to)d Fn(\034)18 b Ft(.)40 b(F)-8 b(or)30 b(an)m(y)g(argumen)m(t)38 b Fn(N)10 b Ft(:)15 b Fn(\033)d Ft(,)29 b(w)m(e)h(can)f(apply)f(either)g(function)g(to)38 b Fn(N)19 b Ft(.)40 b(Ho)m(w)m(ev)m(er,)31 b(w)m(e)0 3261 y(get)h(the)e(same)h(result)e(in)g(either)h(case,)i(since)1537 3442 y(\()p Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)10 b(x)p Ft(\))p Fn(N)36 b Ft(=)25 b Fn(M)10 b(N)0 3623 y Ft(b)m(y)47 b(\()p Fn(\014)5 b Ft(\))j(.)67 b(\(Notice)40 b(that)f(w)m(e)g(get)49 b(\([)p Fn(N)r(=x)p Ft(])p Fn(M)10 b Ft(\))p Fn(N)20 b Ft(,)41 b(whic)m(h)c(is)h(di\013eren)m(t,)j(if)c(w)m(e)j(drop)d(the)i (assumption)e(that)48 b Fn(x)0 3736 y Ft(is)34 b(not)h(free)f(in)42 b Fn(M)18 b Ft(.\))54 b(Since)34 b(the)h(t)m(w)m(o)h(functions)d (return)h(the)h(same)g(result)e(on)i(all)e(argumen)m(ts,)k(w)m(e)e(ha)m (v)m(e)h(the)0 3849 y(equational)30 b(axiom)39 4030 y(\()p Fn(\021)s Ft(\))1154 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)10 b(x)26 b Ft(=)f Fn(M)5 b(;)76 b(x)30 b Ft(not)h(free)f(in)f Fn(M)0 4211 y Ft(Just)35 b(as)h(the)g(\014nal)e(axiom)i(for)f(pairing)f (is)h(redundan)m(t)f(for)i(explicit)e(pairs,)h(the)45 b(\()p Fn(\021)s Ft(\))g(axiom)35 b(for)h(functions)e(is)0 4324 y(redundan)m(t)c(for)g(explicit)g(function)f(expressions.)41 b(Sp)s(eci\014cally)-8 b(,)29 b(if)39 b Fn(M)49 b Ft(has)31 b(the)g(form)39 b Fn(\025y)s Ft(:)15 b Fn(\033)n(:)g(P)22 b Ft(,)31 b(and)39 b Fn(x)g Ft(is)30 b(not)0 4437 y(free)c(in)33 b Fn(M)19 b Ft(,)27 b(then)f(w)m(e)g(can)h(pro)m(v)m(e)35 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)10 b(x)26 b Ft(=)f Fn(M)45 b Ft(using)32 b(\()p Fn(\014)5 b Ft(\))j(.)41 b(Ho)m(w)m(ev)m(er,)29 b(w)m(e)e(cannot)g(pro)m(v)m(e)35 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)10 b(x)26 b Ft(=)f Fn(M)0 4550 y Ft(if)37 b Fn(M)48 b Ft(is)28 b(a)i(v)-5 b(ariable)28 b(of)i(function)e(t)m(yp)s(e)i(without)f(using)36 b(\()p Fn(\021)s Ft(\))8 b(.)42 b(A)29 b(consequence)i(of)38 b(\()p Fn(\021)s Ft(\))g(is)29 b(giv)m(en)h(in)e(part)h(\(b\))h(of)0 4663 y(Exercise)g(2.2.7.)141 4775 y(Both)39 b(\()p Fn(\014)5 b Ft(\))40 b(and)e(\()p Fn(\021)s Ft(\))h(could)30 b(b)s(e)f(used)h(as) g(reduction)f(rules,)g(read)h(left)g(to)h(righ)m(t.)41 b(When)30 b(it)f(is)h(imp)s(ortan)m(t)f(to)0 4888 y(distinguish)f(b)s (et)m(w)m(een)k(the)g(equational)g(axioms,)g(w)m(e)g(use)39 b(\()p Fn(\014)5 b Ft(\))2176 4902 y Fm(eq)2288 4888 y Ft(and)40 b(\()p Fn(\021)s Ft(\))2593 4902 y Fm(eq)2704 4888 y Ft(for)32 b(the)g(equational)f(axioms)h(and)0 5001 y(\()p Fn(\014)5 b Ft(\))126 5016 y Fm(r)r(ed)276 5001 y Ft(and)42 b(\()p Fn(\021)s Ft(\))583 5016 y Fm(r)r(ed)734 5001 y Ft(for)34 b(the)g(reduction)g(rules.)51 b(While)41 b Fn(\021)12 b Ft(-reduction)33 b(is)g(used)h(in)f(man)m(y)h(v)m (ersions)g(of)g(lam)m(b)s(da)0 5114 y(calculus,)g(w)m(e)g(will)e Fs(not)43 b Ft(use)g(\()p Fn(\021)s Ft(\))1145 5129 y Fm(r)r(ed)1295 5114 y Ft(in)33 b(PCF)h(reduction)f(since)g(it)h(is)f (not)h(needed.)52 b(As)34 b(discussed)e(in)h(Section)0 5227 y(1.3,)g(w)m(e)g(k)m(eep)40 b(\()p Fn(\013)p Ft(\))h(as)32 b(the)g(single)f(equational)g(axiom)h(of)f(the)h(reduction)f(system)h (for)f(PCF.)h(In)f(other)h(w)m(ords,)0 5340 y(PCF)e(reduction)f(is)h(a) h(relation)e(on)39 b Fn(\013)9 b Ft(-equiv)-5 b(alence)30 b(classes)g(of)h(expressions.)p eop %%Page: 58 9 58 8 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(58)141 91 y(F)-8 b(or)38 b(easy)g(reference,)h (the)f(syn)m(tax)f(of)h(PCF)f(is)f(summarized)g(in)f(Section)i(2.2.6.) 63 b(The)37 b(equational)g(pro)s(of)0 204 y(system)31 b(app)s(ears)e(in)g(T)-8 b(able)30 b(2.1)i(and)d(the)i(reduction)e (system)i(in)e(T)-8 b(able)30 b(2.2.)0 440 y Fk(Currying)0 612 y Ft(A)43 b(traditional)f(topic)h(in)f(lam)m(b)s(da)g(calculus)g (is)h(the)g(relationship)e(b)s(et)m(w)m(een)j(m)m(ulti-argumen)m(t)e (and)h(higher-)0 725 y(order)i(functions.)86 b(If)46 b(w)m(e)g(ha)m(v)m(e)i(a)e(mathematical)g(function)f(of)h(t)m(w)m(o)h (argumen)m(ts,)k(suc)m(h)45 b(as)i(the)f(addition)0 838 y(function)h Fs(add)10 b Ft(\()p Fn(x;)15 b(y)s Ft(:)g Fs(nat)c Ft(\))40 b(=)h Fn(x)26 b Ft(+)g Fn(y)12 b Ft(,)41 b(then)e(w)m(e)h(generally)f(think)f(of)i(this)e(as)i(a)g(function)e (on)h(ordered)g(pairs)0 951 y Fs(add)11 b Ft(:)k(\()p Fs(nat)25 b Fr(\002)15 b Fs(nat)9 b Ft(\))648 945 y Fr(!)755 951 y Fs(nat)18 b Ft(.)40 b(This)29 b(t)m(yp)s(e)h(of)h(addition)e (function)g(ma)m(y)i(b)s(e)e(written)h(as)g(the)h(PCF)f(expression)1122 1130 y Fs(add)36 b Ft(=)25 b Fn(\025p)p Ft(:)15 b Fs(nat)25 b Fr(\002)15 b Fs(nat)9 b Fn(:)15 b Ft(\()p Fk(Pro)6 b(j)2186 1152 y Fp(1)2225 1130 y Fn(p)p Ft(\))20 b(+)g(\()p Fk(Pro)6 b(j)2657 1152 y Fp(2)2697 1130 y Fn(p)p Ft(\))0 1308 y(In)33 b(w)m(ords,)h(this)e Fs(add)44 b Ft(is)33 b(the)g(function)f(whic)m(h)h(tak)m(es)h(a)g(pair)e(of)i(natural)f(n)m (um)m(b)s(ers,)g(and)f(returns)h(the)g(sum)g(of)0 1421 y(its)d(t)m(w)m(o)h(comp)s(onen)m(ts.)141 1534 y(A)g(related)f (function)f(is)g(called)h(the)h(\\curried")e(addition)g(function)1233 1713 y Fs(Curry)8 b Ft(\()p Fs(add)k Ft(\))25 b(=)g Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(\025y)s Ft(:)g Fs(nat)10 b Fn(:)15 b(x)21 b Ft(+)e Fn(y)0 1892 y Ft(after)i(lam)m(b)s(da)f (calculus)f(pioneer)h(Hask)m(ell)g(Curry)-8 b(.)36 b(The)20 b(curried)f(addition)g(function)g(yields)28 b Fn(x)q Ft(+)q Fn(y)i Ft(when)20 b(applied)0 2005 y(to)45 b Fn(x)e Ft(and)g Fn(y)12 b Ft(,)36 b(but)f(the)h(form)f(of)g(parameterization)h (is)f(di\013eren)m(t.)55 b(Lik)m(e)35 b(man)m(y)h(other)g(lam)m(b)s(da) e(expressions,)0 2118 y(it)39 b(is)g(easiest)h(to)g(read)48 b Fs(Curry)9 b Ft(\()p Fs(add)i Ft(\))48 b(from)39 b(righ)m(t)g(to)i (left.)68 b(The)39 b(\014nal)f(result)h(of)g(applying)f(the)i(function) e(is)0 2231 y(the)43 b(expression)f(to)h(the)g(righ)m(t)g(of)g(all)e (of)i(the)52 b Fn(\025)8 b Ft('s,)46 b(whic)m(h)c(is)50 b Fn(x)29 b Ft(+)f Fn(y)12 b Ft(.)77 b(The)42 b(next)h(smallest)f (expression)g(is)0 2344 y Fn(\025y)s(:)15 b(x)27 b Ft(+)g Fn(y)12 b Ft(.)70 b(This)39 b(function)g(adds)48 b Fn(x)8 b Ft(,)44 b(whose)c(v)-5 b(alue)40 b(is)g(not)h(determined)e(within)f (this)h(expression,)j(to)g(the)0 2457 y(function)30 b(argumen)m(t.)44 b(So)32 b(w)m(e)g(migh)m(t)f(call)g(this)f(the)h(\\add)40 b Fn(x)8 b Ft(")32 b(function.)43 b(Since)30 b(this)g(function)h(tak)m (es)h(a)g(single)0 2570 y(natural-n)m(um)m(b)s(er)c(argumen)m(t)j(and)f (returns)f(a)i(natural)e(n)m(um)m(b)s(er)g(result,)h(w)m(e)h(ha)m(v)m (e)1526 2748 y Fn(\025y)s(:)15 b(x)21 b Ft(+)f Fn(y)28 b Ft(:)d Fs(nat)2106 2742 y Fr(!)2212 2748 y Fs(nat)9 b Fn(:)0 2927 y Ft(No)m(w)25 b(let)f(us)g(lo)s(ok)g(again)g(at)h(the)g (whole)e(function)31 b Fs(Curry)9 b Ft(\()p Fs(add)i Ft(\))d(.)40 b(On)23 b(argumen)m(t)33 b Fn(x)8 b Ft(,)26 b(the)f(function)31 b Fs(Curry)9 b Ft(\()p Fs(add)i Ft(\))0 3040 y(returns)31 b(the)h(\\add)41 b Fn(x)8 b Ft(")33 b(function.)44 b(So)d Fs(Curry)8 b Ft(\()p Fs(add)k Ft(\))40 b(is)32 b(a)g(function)f(of)h(a)h(single)e(natural-n)m(um)m(b)s(er)f (argumen)m(t,)0 3153 y(returning)e(a)j(n)m(umeric)e(function.)40 b(This)28 b(is)i(re\015ected)h(in)e(the)h(t)m(yp)s(e)h(of)f(the)h (function)1332 3332 y Fs(Curry)9 b Ft(\()p Fs(add)i Ft(\):)k Fs(nat)1987 3326 y Fr(!)2078 3332 y Ft(\()p Fs(nat)2264 3326 y Fr(!)2371 3332 y Fs(nat)9 b Ft(\))p Fn(:)0 3511 y Ft(Th)m(us)35 b(the)h(curried)e(addition)f(function)i(yields)42 b Fn(x)24 b Ft(+)f Fn(y)47 b Ft(when)35 b(applied)e(to)k(t)m(w)m(o)g (natural)e(n)m(um)m(b)s(ers)42 b Fn(x)i Ft(and)g Fn(y)12 b Ft(,)0 3624 y(but)31 b(as)h(the)g(t)m(yp)s(e)g(indicates,)40 b Fs(Curry)8 b Ft(\()p Fs(add)j Ft(\))41 b(tak)m(es)33 b(t)m(w)m(o)g(natural)e(n)m(um)m(b)s(er)f(argumen)m(ts)i(one)g(at)h(a)f (time,)g(rather)0 3737 y(than)e(all)f(at)i(once.)141 3850 y(As)f(suggested)h(b)m(y)f(the)g(notation)38 b Fs(Curry)9 b Ft(\()p Fs(add)i Ft(\))d(,)31 b(there)f(is)f(a)i(higher-order)d (transformation)i Fs(Curry)38 b Ft(whic)m(h)0 3963 y(maps)27 b(an)m(y)i(binary)d(natural-)h(n)m(um)m(b)s(er)g(function)35 b Fn(f)45 b Ft(to)29 b(its)e(curried)f(form)36 b Fs(Curry)8 b Ft(\()p Fn(f)i Ft(\))e(.)41 b(This)26 b(map)h(can)h(actually)0 4075 y(b)s(e)i(written)f(in)g(PCF,)i(as)f(the)h(lam)m(b)s(da)e (expression)858 4254 y Fs(Curry)34 b Ft(=)24 b Fn(\025f)10 b Ft(:)15 b(\()p Fs(nat)25 b Fr(\002)15 b Fs(nat)9 b Ft(\))1828 4248 y Fr(!)1935 4254 y Fs(nat)g Fn(:)15 b(\025x)p Ft(:)g Fs(nat)c Fn(:)k(\025y)s Ft(:)g Fs(nat)10 b Fn(:)15 b(f)10 b Fr(h)p Fn(x;)15 b(y)s Fr(i)p Fn(:)0 4433 y Ft(Using)32 b(the)i(axiom)f(of)42 b Fn(\014)13 b Ft(-equiv)-5 b(alence,)34 b(it)f(is)f(easy)i(to)g(see)g(that)g(when)e(applied)f(to)j Fs(add)9 b Ft(,)36 b(the)d(function)f Fs(Curry)0 4546 y Ft(pro)s(duces)d(the)i(lam)m(b)s(da)e(expression)g(written)g(ab)s(o)m (v)m(e.)439 4717 y Fs(Curry)9 b Ft(\()p Fs(add)i Ft(\))84 b(=)e(\()p Fn(\025f)10 b Ft(:)15 b(\()p Fs(nat)25 b Fr(\002)15 b Fs(nat)10 b Ft(\))1781 4711 y Fr(!)1887 4717 y Fs(nat)f Fn(:\025x)p Ft(:)15 b Fs(nat)c Fn(:\025y)s Ft(:)k Fs(nat)9 b Fn(:)15 b(f)10 b Fr(h)p Fn(x;)15 b(y)s Fr(i)p Ft(\))32 b Fs(add)985 4830 y Ft(=)82 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:\025y)s Ft(:)15 b Fs(nat)10 b Fn(:)15 b Fs(add)26 b Fr(h)p Fn(x;)15 b(y)s Fr(i)985 4943 y Ft(=)82 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:\025y)s Ft(:)15 b Fs(nat)10 b Fn(:)15 b Ft(\()p Fn(\025p)p Ft(:)g Fs(nat)25 b Fr(\002)15 b Fs(nat)10 b Fn(:)15 b Ft(\()p Fk(Pro)6 b(j)2592 4965 y Fp(1)2631 4943 y Fn(p)p Ft(\))21 b(+)f(\()p Fk(Pro)6 b(j)3064 4965 y Fp(2)3103 4943 y Fn(p)p Ft(\)\))31 b Fr(h)p Fn(x;)15 b(y)s Fr(i)985 5056 y Ft(=)82 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:\025y)s Ft(:)15 b Fs(nat)10 b Fn(:)15 b Fk(Pro)6 b(j)1968 5078 y Fp(1)2007 5056 y Fr(h)p Fn(x;)15 b(y)s Fr(i)21 b Ft(+)f Fk(Pro)6 b(j)2534 5078 y Fp(2)2573 5056 y Fr(h)p Fn(x;)15 b(y)s Fr(i)985 5169 y Ft(=)82 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:\025y)s Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)21 b Ft(+)e Fn(y)0 5340 y Ft(Some)30 b(prop)s(erties)f(of)i(currying)d(are)j(giv)m(en)f (in)g(Exercise)g(2.2.8.)p eop %%Page: 59 10 59 9 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(59)0 91 y Fk(Exercise)35 b(2.2.4)47 b Ft(W)-8 b(rite)39 b(a)g(PCF)g(expression)f(to)i(tak)m(e)g(an)m(y)f(n) m(umeric)f(function)46 b Fn(f)57 b Ft(and)38 b(return)g(a)h(n)m(umeric) 0 204 y(function)e Fn(g)43 b Ft(suc)m(h)30 b(that)h(for)f(an)m(y)39 b Fn(n)8 b Ft(,)30 b(the)h(v)-5 b(alue)30 b(of)38 b Fn(g)s Ft(\()p Fn(n)p Ft(\))i(is)29 b(t)m(wice)40 b Fn(f)10 b Ft(\()p Fn(n)p Ft(\))e(.)0 417 y Fk(Exercise)35 b(2.2.5)47 b Ft(P)m(erform)30 b(the)h(follo)m(wing)d(substitution.)39 b(\(Do)31 b(not)g(reduce)f(the)h(expression.\))735 621 y([\()p Fn(y)24 b Ft(+)c(3\))p Fn(=x)p Ft(])26 b(\(\()p Fn(\025f)10 b Ft(:)15 b Fs(nat)1553 615 y Fr(!)1660 621 y Fs(nat)9 b Fn(:)15 b(\025y)s Ft(:)g Fs(nat)10 b Fn(:)15 b(f)10 b Ft(\()p Fn(x)20 b Ft(+)g Fn(y)s Ft(\)\)\()p Fn(\025x)p Ft(:)15 b Fs(nat)c Fn(:)k(x)20 b Ft(+)g Fn(y)s Ft(\)\))0 834 y Fk(Exercise)35 b(2.2.6)47 b Ft(Pro)m(v)m(e)31 b(the)g(follo)m(wing)e(substitution)f(iden)m(tities.)39 1038 y(\()p Fn(a)p Ft(\))1130 b([)p Fn(M)5 b(=x)p Ft(]\([)p Fn(N)r(=x)p Ft(])p Fn(P)13 b Ft(\))28 b(=)d([\([)p Fn(M)5 b(=x)p Ft(])p Fn(N)10 b Ft(\))p Fn(=x)p Ft(])p Fn(P)s(;)39 1242 y Ft(\()p Fn(b)p Ft(\))476 b([)p Fn(M)5 b(=x)p Ft(]\([)p Fn(N)r(=y)s Ft(])p Fn(P)13 b Ft(\))28 b(=)d([\([)p Fn(M)5 b(=x)p Ft(])p Fn(N)10 b Ft(\))p Fn(=y)s Ft(]\([)p Fn(M)5 b(=x)p Ft(])p Fn(P)13 b Ft(\))34 b(if)29 b Fn(y)f Fr(6\021)d Fn(x)31 b Ft(and)e Fn(y)g Fr(62)24 b Fn(F)13 b(V)21 b Ft(\()p Fn(M)10 b Ft(\))p Fn(:)0 1455 y Fk(Exercise)35 b(2.2.7)47 b Ft(Sho)m(w)28 b(that)h(the)f(follo)m(wing)f(t)m(w)m(o)j (inference)d(rules)g(are)i(deriv)-5 b(able,)27 b Fs(i.e.)p Ft(,)i(the)f(equation)h(b)s(elo)m(w)0 1567 y(the)h(line)d(is)i(pro)m(v) -5 b(able)28 b(from)h(the)h(equation\(s\))f(ab)s(o)m(v)m(e)i(the)e (line.)39 b(F)-8 b(or)30 b(\(a\),)h(y)m(ou)f(ma)m(y)g(assume)f(that)h (from)37 b Fn(x)25 b Ft(=)g Fn(u)0 1680 y Ft(and)38 b Fn(y)28 b Ft(=)d Fn(v)42 b Ft(it)30 b(is)f(p)s(ossible)f(to)j(pro)m(v)m (e)40 b Fr(h)p Fn(x;)15 b(y)s Fr(i)26 b Ft(=)f Fr(h)p Fn(u;)15 b(v)s Fr(i)8 b Ft(.)39 1943 y(\()p Fn(a)p Ft(\))1218 1882 y Fk(Pro)e(j)1423 1904 y Fp(1)1462 1882 y Fn(p)25 b Ft(=)g Fk(Pro)6 b(j)1834 1904 y Fp(1)1873 1882 y Fn(q)s(;)46 b Fk(Pro)6 b(j)2192 1904 y Fp(2)2232 1882 y Fn(p)25 b Ft(=)g Fk(Pro)6 b(j)2603 1904 y Fp(2)2643 1882 y Fn(q)p 1218 1922 1469 4 v 1847 2005 a(p)25 b Ft(=)g Fn(q)39 2279 y Ft(\()p Fn(b)p Ft(\))1749 2217 y Fn(M)10 b(x)26 b Ft(=)f Fn(N)10 b(x)p 1749 2258 407 4 v 1801 2340 a(M)36 b Ft(=)25 b Fn(N)2199 2279 y(x)g Fr(62)g Fs(FV)17 b Ft(\()p Fn(M)5 b(;)15 b(N)10 b Ft(\))0 2545 y Fk(Exercise)35 b(2.2.8)47 b Ft(W)-8 b(rite)41 b(a)f(PCF)h(expression)e Fs(Uncurry)48 b Ft(whic)m(h)40 b(\\uncurries")e(natural)i(n)m(um)m(b)s (er)f(functions.)0 2658 y(More)d(sp)s(eci\014cally)-8 b(,)36 b(if)43 b Fn(f)53 b Ft(is)35 b(a)h(curried)e(function)42 b Fn(f)10 b Ft(:)15 b Fs(nat)2027 2652 y Fr(!)2118 2658 y Ft(\()p Fs(nat)2305 2652 y Fr(!)2411 2658 y Fs(nat)10 b Ft(\))e(,)38 b(then)43 b Fs(Uncurry)8 b Ft(\()p Fn(f)i Ft(\))44 b(should)34 b(b)s(e)h(an)0 2771 y(ordinary)43 b(binary)g(function)51 b Fs(Uncurry)9 b Ft(\()p Fn(f)h Ft(\):)15 b(\()p Fs(nat)25 b Fr(\002)15 b Fs(nat)9 b Ft(\))2022 2765 y Fr(!)2129 2771 y Fs(nat)62 b Ft(taking)45 b(a)g(pair)e(of)i(n)m(um)m(b)s(ers)e(and)h(pro)s(duc-)0 2884 y(ing)d(a)h(natural)e(n)m(um)m(b)s(er)h(result.)73 b(Use)42 b(the)g(axioms)f(for)h(functions)e(and)h(pairing)f(to)i(pro)m (v)m(e)g(the)g(equations)0 2997 y Fs(Uncurry)8 b Ft(\()p Fs(Curry)24 b Fn(g)s Ft(\))35 b(=)f Fn(g)48 b Ft(and)43 b Fs(Curry)9 b Ft(\()p Fs(Uncurry)24 b Fn(f)10 b Ft(\))33 b(=)h Fn(f)18 b Ft(,)37 b(for)f(an)m(y)g(ordinary)e(binary)42 b Fn(g)s Ft(:)15 b(\()p Fs(nat)26 b Fr(\002)15 b Fs(nat)9 b Ft(\))3657 2991 y Fr(!)3764 2997 y Fs(nat)0 3110 y Ft(and)30 b(an)m(y)g(curried)37 b Fn(f)10 b Ft(:)15 b Fs(nat)912 3104 y Fr(!)1003 3110 y Ft(\()p Fs(nat)1189 3104 y Fr(!)1295 3110 y Fs(nat)10 b Ft(\))e(.)0 3353 y Fo(2.2.4)112 b(Declarations)37 b(and)h(syn)m(tactic)e(sugar)0 3525 y Ft(One)29 b(of)g(the)g(app)s(eals)f(of)i(lam)m(b)s(da)e (calculus,)g(as)h(a)h(mo)s(del)e(programming)g(language,)i(is)e(the)h (w)m(a)m(y)h(that)g(lam)m(b)s(da)0 3637 y(abstraction)k(corresp)s(onds) e(to)i(v)-5 b(ariable)33 b(binding)d(in)i(common)i(programming)f (languages.)50 b(This)32 b(is)h(immedi-)0 3750 y(ately)23 b(clear)g(for)f(Lisp)g(and)g(its)g(dialects,)i(whic)m(h)d(are)i(based)g (on)f(lam)m(b)s(da)g(notation.)38 b(It)23 b(is)f(also)h(true)f(for)h (Algol-lik)m(e)0 3863 y(languages,)31 b(suc)m(h)f(as)h(P)m(ascal.)41 b(F)-8 b(or)31 b(example,)f(consider)g(the)g(follo)m(wing)f(Algol-lik)m (e)h(program)g(fragmen)m(t)227 4051 y Fk(b)s(egin)h(function)39 b Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)10 b Ft(\))30 b Fs(nat)10 b Ft(;)506 4164 y Fk(return)38 b Fn(x)p Ft(;)506 4277 y Fk(end)p Ft(;)236 4390 y Fr(h)p Fs(b)-5 b(o)g(dy)8 b Fr(i)227 4503 y Fk(end)0 4690 y Ft(with)29 b(a)h(function)f (declaration)h(at)g(the)h(b)s(eginning)c(of)j(a)g(blo)s(c)m(k.)41 b(W)-8 b(e)31 b(can)f(easily)f(write)h(the)g(function)37 b Fn(f)47 b Ft(as)31 b(the)0 4803 y(lam)m(b)s(da)26 b(expression)33 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)8 b Ft(.)40 b(W)-8 b(e)28 b(will)c(also)j(see)g(that)h(the)f(en)m(tire)f(blo)s(c)m (k)h(ma)m(y)g(b)s(e)f(translated)g(in)m(to)h(lam)m(b)s(da)0 4916 y(notation.)41 b(The)30 b(translation)f(ma)m(y)i(b)s(e)f (simpli\014ed)d(b)m(y)j(adopting)g(a)g(general)h(notational)f(con)m(v)m (en)m(tion.)141 5029 y(A)h(reasonable)f(t)m(yp)s(ed)g(syn)m(tax)h(for)f (declarations)g(is)1524 5233 y Fl(let)47 b Fn(x)p Ft(:)15 b Fn(\033)29 b Ft(=)c Fn(M)58 b Fl(in)47 b Fn(N)5 b(;)p eop %%Page: 60 11 60 10 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(60)0 91 y(whic)m(h)37 b(binds)45 b Fn(x)h Ft(to)i Fn(M)57 b Ft(within)36 b(the)j(declaration)f(b)s(o)s (dy)45 b Fn(N)18 b Ft(.)65 b(In)38 b(other)h(w)m(ords,)h(the)f(v)-5 b(alue)38 b(of)47 b Fl(let)g Fn(x)p Ft(:)15 b Fn(\033)42 b Ft(=)0 204 y Fn(M)58 b Fl(in)47 b Fn(N)i Ft(is)30 b(the)i(v)-5 b(alue)30 b(of)40 b Fn(N)49 b Ft(with)38 b Fn(x)h Ft(set)32 b(to)40 b Fn(M)18 b Ft(.)43 b(W)-8 b(e)32 b(consider)e(this)g(w)m (ell-t)m(yp)s(ed)g(only)g(if)39 b Fn(M)49 b Ft(has)31 b(t)m(yp)s(e)39 b Fn(\033)12 b Ft(.)0 317 y(Using)30 b Fl(let)p Ft(,)f(w)m(e)i(can)g(no)m(w)f(write)g(the)g(Algol-lik)m(e)g (blo)s(c)m(k)g(ab)s(o)m(v)m(e)h(as)1138 500 y Fl(let)47 b Fn(f)10 b Ft(:)15 b Fs(nat)1575 494 y Fr(!)1681 500 y Fs(nat)35 b Ft(=)25 b Fn(\025x)p Ft(:)15 b Fs(nat)9 b Fn(:x)48 b Fl(in)g Fr(h)p Fs(b)-5 b(o)g(dy)8 b Fr(i)r Fn(:)141 683 y Ft(Instead)37 b(of)h(adding)d Fl(let)i Ft(declarations)f(to)i(PCF)f(directly)-8 b(,)39 b(w)m(e)e(will)e(treat) j Fl(let)f Ft(as)g(an)g(abbreviation,)h(or)0 796 y(what)f(is)f(often)h (called)f(\\syn)m(tactic)j(sugar")e(in)f(computer)g(science.)61 b(This)35 b(means)i(that)h(w)m(e)f(will)d(feel)j(free)g(to)0 909 y(use)29 b Fl(let)f Ft(in)g(writing)g(PCF)h(expressions,)f(but)h(w) m(e)h(do)f(not)g(consider)f Fl(let)h Ft(part)g(of)g(the)h(actual)g(syn) m(tax)f(of)h(PCF.)0 1022 y(Instead,)g(w)m(e)h(will)d(think)h(of)h Fl(let)g Ft(as)h(an)f(abbreviation)f(for)h(a)h(lam)m(b)s(da)e (expression,)g(according)i(to)g(the)f(rule)1159 1228 y Fl(let)47 b Fn(x)p Ft(:)15 b Fn(\033)29 b Ft(=)c Fn(M)58 b Fl(in)47 b Fn(N)2077 1173 y Fj(def)2094 1228 y Ft(=)103 b(\()p Fn(\025x)p Ft(:)15 b Fn(\033)n(:N)10 b Ft(\))p Fn(M)0 1411 y Ft(This)31 b(treatmen)m(t)j(of)f Fl(let)e Ft(allo)m(ws)h(us)g(to)h(k)m(eep)g(the)g(size)f(of)h(PCF)f(relativ)m (ely)g(small,)g(whic)m(h)f(will)f(pa)m(y)j(o\013)g(when)0 1524 y(w)m(e)k(come)h(to)g(pro)m(ving)e(things)g(ab)s(out)h(the)g (language.)61 b(In)36 b(addition,)h(w)m(e)g(need)g(not)g(sp)s(ecify)f (an)m(y)h(additional)0 1637 y(equational)23 b(axioms)g(or)h(reduction)f (rules,)g(as)h(these)g(are)g(inherited)e(directly)g(from)31 b Fn(\025)8 b Ft(.)39 b(T)-8 b(o)24 b(distinguish)c(abbrevi-)0 1773 y(ations)j(from)g(actual)g(PCF)g(syn)m(tax,)j(w)m(e)d(will)e(use)i (the)g(sym)m(b)s(ol)2157 1718 y Fj(def)2175 1773 y Ft(=)i(,)g(as)e(ab)s (o)m(v)m(e,)j(when)c(de\014ning)g(meta-notational)0 1909 y(con)m(v)m(en)m(tions.)58 b(In)35 b(general,)46 b Fn(M)1148 1854 y Fj(def)1165 1909 y Ft(=)52 b Fn(N)i Ft(means)36 b(that)g(whenev)m(er)g(w)m(e)g(write)f(a)h(term)g(of)g(the)h(form)43 b Fn(M)19 b Ft(,)37 b(this)e(is)0 2022 y(shorthand)29 b(for)h(a)h(term)f(of)h(form)38 b Fn(N)18 b Ft(.)0 2213 y Fk(Example)34 b(2.2.9)46 b Ft(W)-8 b(e)25 b(will)c(translate)j(the)g (follo)m(wing)e(\\sugared")j(PCF)e(expression)g(in)m(to)g(pure)g(PCF)h (\(without)0 2326 y(syn)m(tactic)31 b(sugar\))738 2507 y Fl(let)e Fs(c)-5 b(omp)g(ose)35 b Ft(=)24 b Fn(\025f)10 b Ft(:)15 b Fs(nat)1664 2501 y Fr(!)1770 2507 y Fs(nat)9 b Fn(:\025g)s Ft(:)15 b Fs(nat)2223 2501 y Fr(!)2329 2507 y Fs(nat)10 b Fn(:\025x)p Ft(:)15 b Fs(nat)10 b Fn(:f)g Ft(\()p Fn(g)18 b(x)p Ft(\))31 b Fl(in)889 2619 y(let)f Fn(h)25 b Ft(=)g Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)21 b Ft(+)f Fn(x)30 b Fl(in)1041 2732 y Fs(c)-5 b(omp)g(ose)24 b Fn(h)15 b(h)g Ft(3)0 2908 y(and)26 b(simplify)e(b)m(y)j(applying)d(the)j(appropriate)f(reduction)g(rules.) 38 b(The)27 b(\\de-sugared,")h(pure)e(PCF)h(expression,)0 3021 y(written)i(using)g(the)i(same)g(names)f(for)g(b)s(ound)e(v)-5 b(ariables,)30 b(is:)924 3196 y(\()p Fn(\025)p Fs(c)-5 b(omp)g(ose)9 b Ft(:)15 b(\()p Fs(nat)1572 3190 y Fr(!)1678 3196 y Fs(nat)9 b Ft(\))1864 3190 y Fr(!)1956 3196 y Ft(\()p Fs(nat)2143 3190 y Fr(!)2249 3196 y Fs(nat)g Ft(\))2435 3190 y Fr(!)2542 3196 y Fs(nat)2693 3190 y Fr(!)2799 3196 y Fs(nat)h Fn(:)1076 3309 y Ft(\()p Fn(\025h)p Ft(:)15 b Fs(nat)1408 3303 y Fr(!)1514 3309 y Fs(nat)10 b Fn(:)25 b Fs(c)-5 b(omp)g(ose)35 b Fn(h)25 b(h)h Ft(3\))61 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)21 b Ft(+)e Fn(x)p Ft(\))1076 3422 y Fn(\025f)10 b Ft(:)15 b Fs(nat)1375 3416 y Fr(!)1481 3422 y Fs(nat)9 b Fn(:)15 b(\025g)s Ft(:)g Fs(nat)1949 3416 y Fr(!)2055 3422 y Fs(nat)10 b Fn(:)15 b(\025x)p Ft(:)g Fs(nat)10 b Fn(:)15 b(f)10 b Ft(\()p Fn(g)34 b(x)p Ft(\))p Fn(:)0 3597 y Ft(This)29 b(reduces)h(as)g(follo)m(ws:)211 3749 y Fr(!)400 3755 y Ft(\()p Fn(\025h)p Ft(:)15 b Fs(nat)733 3749 y Fr(!)839 3755 y Fs(nat)10 b Fn(:)15 b Ft(\()p Fn(\025f)10 b Ft(:)15 b Fs(nat)1351 3749 y Fr(!)1457 3755 y Fs(nat)9 b Fn(:)15 b(\025g)s Ft(:)g Fs(nat)1925 3749 y Fr(!)2031 3755 y Fs(nat)10 b Fn(:)15 b(\025x)p Ft(:)g Fs(nat)10 b Fn(:)15 b(f)10 b Ft(\()p Fn(g)34 b(x)p Ft(\)\))d Fn(h)f(h)h Ft(3\)\()p Fn(\025x)p Ft(:)15 b Fs(nat)c Fn(:)k(x)21 b Ft(+)f Fn(x)p Ft(\))211 3862 y Fr(!)400 3868 y Ft(\()p Fn(\025f)10 b Ft(:)15 b Fs(nat)735 3862 y Fr(!)841 3868 y Fs(nat)10 b Fn(:)15 b(\025g)s Ft(:)g Fs(nat)1310 3862 y Fr(!)1416 3868 y Fs(nat)9 b Fn(:)15 b(\025x)p Ft(:)g Fs(nat)10 b Fn(:)15 b(f)10 b Ft(\()p Fn(g)34 b(x)p Ft(\)\))d(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)21 b Ft(+)f Fn(x)p Ft(\))30 b(\()p Fn(\025x)p Ft(:)15 b Fs(nat)c Fn(:)k(x)20 b Ft(+)g Fn(x)p Ft(\))31 b(3)196 3981 y Fr(!)-61 b(!)83 b Ft(\()p Fn(\025x)p Ft(:)15 b Fs(nat)c Fn(:)k(x)20 b Ft(+)g Fn(x)p Ft(\)\(\()p Fn(\025x)p Ft(:)15 b Fs(nat)c Fn(:)k(x)20 b Ft(+)g Fn(x)p Ft(\))31 b(3\))211 4088 y Fr(!)400 4094 y Ft(\(\()p Fn(\025x)p Ft(:)15 b Fs(nat)c Fn(:)k(x)20 b Ft(+)g Fn(x)p Ft(\))31 b(3\))21 b(+)f(\(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)21 b Ft(+)f Fn(x)p Ft(\))31 b(3\))196 4207 y Fr(!)-61 b(!)83 b Ft(\(3)21 b(+)f(3\))h(+)f(\(3)h(+)f(3\))196 4320 y Fr(!)-61 b(!)83 b Ft(12)p Fn(:)p 3861 4471 40 40 v 141 4663 a Ft(The)30 b(notion)f(of)h(\\syn)m(tactic)i(sugar")e(is)f(v)m(ery)h(useful)e(in)h (programming)g(language)h(analysis.)39 b(By)31 b(consider-)0 4775 y(ing)i(certain)h(constructs)g(as)h(syn)m(tactic)g(sugar)f(for)f (others,)j(w)m(e)e(can)g(write)g(program)f(examples)h(in)f(a)h (familiar)0 4888 y(notation,)i(and)d(analyze)i(these)g(programs)e(as)i (if)e(they)h(are)h(written)e(using)g(simpler)f(or)i(less)g(troubling)e (prim-)0 5001 y(itiv)m(es.)59 b(Ho)m(w)m(ev)m(er,)40 b(this)35 b(tec)m(hnique)i(m)m(ust)f(b)s(e)g(used)g(with)f(care.)60 b(Since)35 b(computation)i(ma)m(y)g(b)s(e)f(mo)s(deled)f(b)m(y)0 5114 y(substitution,)27 b(as)h(in)f(the)h(reduction)g(rules)e(for)i (PCF,)h(w)m(e)f(do)h(not)f(w)m(an)m(t)h(to)g(mak)m(e)g(to)s(o)g(man)m (y)g(transformations)0 5227 y(under)k(the)i(um)m(brella)e(of)h(syn)m (tactic)i(sugar.)53 b(Three)34 b(indications)f(that)i(the)g (de\014nition)d(of)j Fl(let)e Ft(do)s(es)i(not)g(add)0 5340 y(an)m(y)c(computational)f(p)s(o)m(w)m(er)g(to)h(PCF)f(are:)p eop %%Page: 61 12 61 11 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(61)86 91 y(\(i\))54 b Fl(let)46 b Fn(x)p Ft(:)15 b Fn(\033)32 b Ft(=)27 b Fn(M)58 b Fl(in)47 b Fn(N)j Ft(and)31 b(the)h(lam)m(b)s(da)f(expression)39 b(\()p Fn(\025x)p Ft(:)15 b Fn(\033)n(:N)10 b Ft(\))p Fn(M)51 b Ft(ha)m(v)m(e)33 b(appro)m(ximately)f(the)g(same)227 204 y(size)e(\(coun)m(ting)h(sym)m(b)s(ols\);)61 392 y(\(ii\))44 b(b)s(oth)30 b(ha)m(v)m(e)i(the)e(same)h(t)m(yping)f (constrain)m(ts;)35 579 y(\(iii\))44 b(the)31 b(t)m(w)m(o)h (expressions)d(ha)m(v)m(e)i(the)g(same)f(immediate)g(sub)s(expressions) d(\(syn)m(tactic)32 b(constituen)m(ts\).)0 767 y(While)24 b(these)h(conditions)f(are)h(not)g(absolute)g(rules)e(ab)s(out)i(syn)m (tactic)h(sugar,)g(they)f(are)h(a)f(useful)e(guide)h(to)m(w)m(ards)0 880 y(go)s(o)s(d)30 b(use)g(of)h(syn)m(tactic)g(sugar.)141 993 y(Another)f(syn)m(tactic)h(extension)e(allo)m(ws)g(us)g(to)i(write) e(function)f(declaration)i(in)e(a)i(more)g(familiar)e(form,)i(as)0 1106 y(follo)m(ws)677 1219 y Fl(let)47 b Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fn(\034)10 b Ft(\):)15 b Fn(\033)30 b Ft(=)25 b Fn(M)57 b Fl(in)48 b Fn(N)1810 1163 y Fj(def)1828 1219 y Ft(=)103 b Fl(let)47 b Fn(f)10 b Ft(:)15 b Fn(\034)2352 1213 y Fr(!)2459 1219 y Fn(\033)28 b Ft(=)d Fn(\025x)p Ft(:)15 b Fn(\034)5 b(:M)58 b Fl(in)48 b Fn(N)0 1386 y Ft(W)-8 b(e)32 b(can)e(also)h(add)e(m)m(ulti-argumen)m(t)h(function)f (de\014nitions,)f(as)j(in)e(Exercise)h(2.2.12)j(b)s(elo)m(w.)0 1598 y Fk(Example)h(2.2.10)46 b Ft(The)20 b(language)h(ISWIM,)f (describ)s(ed)e(in)h([Lan66)q(],)k(has)d(an)g(expression)f(form)28 b Fn(M)j Fl(where)18 b Fn(x)p Ft(:)d Fn(\033)29 b Ft(=)0 1711 y Fn(N)18 b Ft(.)40 b(In)m(tuitiv)m(ely)-8 b(,)29 b(the)g(v)-5 b(alue)28 b(of)h(this)f(expression)g(is)f(the)i(v)-5 b(alue)29 b(of)37 b Fn(M)47 b Ft(when)28 b(the)h(v)-5 b(ariable)36 b Fn(x)h Ft(is)28 b(set)h(to)38 b Fn(N)19 b Ft(.)40 b(W)-8 b(e)0 1824 y(can)31 b(easily)e(add)h Fl(where)f Ft(to)i(PCF)f(b)m(y)g(the)h(abbreviation)1011 2051 y Fn(M)40 b Fl(where)29 b Fn(x)p Ft(:)15 b Fn(\033)29 b Ft(=)c Fn(N)1846 1996 y Fj(def)1863 2051 y Ft(=)103 b Fl(let)47 b Fn(x)p Ft(:)15 b Fn(\033)29 b Ft(=)c Fn(N)58 b Fl(in)47 b Fn(M)5 b(:)p 3861 2255 40 40 v 0 2468 a Fk(Exercise)35 b(2.2.11)47 b Ft(Whic)m(h)40 b(PCF)h(reduction)f(rule)f (is)h(applicable)f(to)i(an)m(y)h(term)e(of)h(the)g(form)49 b Fl(let)e Fn(x)p Ft(:)15 b Fn(\033)46 b Ft(=)0 2581 y Fn(M)58 b Fl(in)47 b Fn(N)18 b Ft(,)31 b(and)f(what)g(is)f(the)i (result)e(of)i(a)f(single)f(application)g(of)i(this)e(rule?)0 2793 y Fk(Exercise)35 b(2.2.12)0 2906 y Ft(\(a\))c(Sho)m(w)f(ho)m(w)h (to)g(add)f(t)m(w)m(o-argumen)m(t)i(functions)d(to)i(PCF)f(b)m(y)h (de\014ning)1651 3111 y Fn(\025)p Fr(h)p Fn(x)p Ft(:)15 b Fn(\033)n(;)31 b(y)s Ft(:)15 b Fn(\034)10 b Fr(i)p Fn(:)15 b(M)0 3315 y Ft(as)27 b(syn)m(tactic)g(sugar.)40 b(If)34 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:)g(\025y)s Ft(:)g Fn(\034)5 b(:)15 b(M)47 b Ft(has)26 b(t)m(yp)s(e)35 b Fn(\033)1894 3309 y Fr(!)2000 3315 y Fn(\034)2066 3309 y Fr(!)2172 3315 y Fn(\032)8 b Ft(,)28 b(then)34 b Fn(\025)p Fr(h)p Fn(x)p Ft(:)15 b Fn(\033)n(;)32 b(y)s Ft(:)15 b Fn(\034)10 b Fr(i)p Fn(:)15 b(M)46 b Ft(has)26 b(t)m(yp)s(e)35 b Fn(\033)18 b Fr(\002)d Fn(\034)3713 3309 y Fr(!)3819 3315 y Fn(\032)8 b Ft(.)0 3428 y(Y)-8 b(ou)31 b(ma)m(y)g(w)m(an)m(t)g (to)g(use)f(the)h(results)e(of)h(Exercise)h(2.2.8.)0 3541 y(\(b\))g(In)m(tro)s(duce)e(a)i(t)m(w)m(o-argumen)m(t)i(function)c (form)h(of)g Fl(let)1334 3745 y(let)46 b Fn(f)10 b Fr(h)p Fn(x)p Ft(:)15 b Fn(\033)n(;)31 b(y)s Ft(:)15 b Fn(\034)10 b Fr(i)p Ft(:)15 b Fn(\032)26 b Ft(=)f Fn(M)58 b Fl(in)47 b Fn(N)0 3949 y Ft(as)e(syn)m(tactic)g(sugar,)k(using)43 b(the)i(result)e(of)i(part)f(\(a\).)85 b(Illustrate)43 b(the)i(induced)e(reduction)g(rule)h(for)g(this)0 4062 y(de\014nition)28 b(form)i(b)m(y)g(expanding)37 b Fl(let)47 b Fn(f)10 b Fr(h)p Fn(x)p Ft(:)15 b Fn(\033)n(;)31 b(y)s Ft(:)15 b Fn(\032)p Fr(i)p Ft(:)g Fn(\034)36 b Ft(=)25 b Fn(M)58 b Fl(in)47 b Fn(N)i Ft(in)m(to)30 b(pure)f(PCF)i(and)e (reducing.)p eop %%Page: 62 13 62 12 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(62)0 91 y Fk(Exercise)35 b(2.2.13)47 b Ft(This)36 b(exercise)j(is)e(concerned)i(with)e Fs(static)j(sc)-5 b(op)g(e)47 b Ft(and)37 b(renaming)g(of)i(b)s(ound)d(v)-5 b(ariables.)0 204 y(In)m(tuitiv)m(ely)d(,)27 b(static)h(scoping)f(of)g (v)-5 b(ariables)26 b(means)h(that)h(the)g(binding)c(of)j(a)h(v)-5 b(ariable)26 b(is)g(alw)m(a)m(ys)i(determined)e(b)m(y)0 317 y(\014nding)f(the)i(closest)g(enclosing)f(binding)e(op)s(erator)j (for)g(that)g(v)-5 b(ariable.)39 b(Moreo)m(v)m(er,)30 b(the)d(binding)d(of)j(a)g(v)-5 b(ariable)0 430 y(do)s(es)38 b(not)h(c)m(hange)g(during)e(ev)-5 b(aluation)37 b(of)i(expressions.)63 b(With)38 b Fs(dynamic)k(sc)-5 b(oping,)41 b Ft(the)d(w)m(a)m(y)i(a)f (v)-5 b(ariable)37 b(is)0 543 y(b)s(ound)i(ma)m(y)j(c)m(hange)h(during) c(ev)-5 b(aluation.)73 b(This)39 b(distinction)g(will)g(b)s(e)i(in)m (tuitiv)m(ely)e(familiar)g(to)j(computer)0 656 y(scien)m(tists)30 b(who)g(ha)m(v)m(e)h(studied)e(programming)g(languages.)66 844 y(\(a\))46 b(Under)30 b(static)i(scop)s(e,)f(the)g(free)39 b Fn(x)h Ft(in)29 b(the)i(declaration)g(of)39 b Fn(f)48 b Ft(is)30 b(b)s(ound)f(b)m(y)i(the)g(outer)g(declaration.)42 b(As)227 956 y(a)31 b(result,)f(the)g(function)37 b Fn(f)48 b Ft(alw)m(a)m(ys)31 b(adds)38 b(3)h(to)31 b(its)f(argumen)m(t,)h(no)g (matter)g(where)f(it)g(is)f(called.)1398 1153 y Fl(let)47 b Fn(x)p Ft(:)15 b Fs(nat)35 b Ft(=)25 b(3)48 b Fl(in)1489 1266 y(let)f Fn(f)10 b Ft(\()p Fn(y)s Ft(:)15 b Fs(nat)9 b Ft(\):)15 b Fs(nat)36 b Ft(=)24 b Fn(x)d Ft(+)f Fn(y)50 b Fl(in)1580 1379 y(let)d Fn(x)p Ft(:)15 b Fs(nat)35 b Ft(=)25 b(4)48 b Fl(in)1671 1491 y Fn(f)24 b Ft(5)227 1688 y(Use)38 b(reduction)f(to)i(simplify)34 b(this)i(PCF)i(expression) f(to)h(8.)63 b(Y)-8 b(ou)38 b(ma)m(y)h(sa)m(v)m(e)g(y)m(ourself)e(the)h (trouble)f(of)227 1801 y(rewriting)29 b Fl(let)p Ft('s)g(to)40 b Fn(\025)8 b Ft('s)30 b(b)m(y)h(using)e(the)h(deriv)m(ed)g(rule)37 b Fl(let)47 b Fn(x)p Ft(:)15 b Fn(\033)29 b Ft(=)c Fn(M)57 b Fl(in)48 b Fn(N)35 b Fr(!)25 b Ft([)p Fn(M)5 b(=x)p Ft(])p Fn(N)19 b Ft(.)61 1989 y(\(b\))45 b(Supp)s(ose)28 b(that)i(in)e(reducing)g(the)i(expression)e(in)g(part)h(\(a\),)i(y)m (ou)f(b)s(egin)e(b)m(y)i(substituting)35 b Fn(\025y)s Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)20 b Ft(+)g Fn(y)227 2102 y Ft(for)33 b Fn(f)42 b Ft(in)24 b(the)g(inner)f(expression,)33 b Fl(let)47 b Fn(x)p Ft(:)15 b Fs(nat)35 b Ft(=)25 b(4)48 b Fl(in)g Fn(f)24 b Ft(5)8 b(.)39 b(\(This)24 b(actually)g(corresp)s (onds)f(to)j(the)e(usual)227 2214 y(implemen)m(tations,)32 b(since)g(w)m(e)i(b)s(egin)d(ev)-5 b(aluation)32 b(of)42 b Fn(f)24 b Ft(5)41 b(b)m(y)33 b(passing)40 b(5)h(to)34 b(the)f(b)s(o)s(dy)e(of)41 b Fn(f)18 b Ft(.\))48 b(Explain)227 2327 y(ho)m(w)30 b(renaming)f(b)s(ound)f(v)-5 b(ariables)28 b(pro)m(vides)h(static)i(scop)s(e.)40 b(In)29 b(particular,)g(sa)m(y)h (whic)m(h)f(v)-5 b(ariable)29 b(ab)s(o)m(v)m(e)227 2440 y(\()8 b Fn(x)g Ft(,)52 b Fn(f)57 b Ft(or)48 b Fn(y)12 b Ft(\))39 b(m)m(ust)g(b)s(e)g(renamed,)j(and)d(ho)m(w)g(a)h(sp)s (eci\014c)f(o)s(ccurrence)g(of)h(this)e(v)-5 b(ariable)39 b(is)f(therefore)227 2553 y(resolv)m(ed)31 b(statically)-8 b(.)71 2741 y(\(c\))46 b(Under)34 b(dynamic)g(scop)s(e,)j(the)e (binding)d(for)43 b Fn(x)g Ft(in)34 b(the)h(b)s(o)s(dy)e(of)44 b Fn(f)52 b Ft(c)m(hanges)36 b(when)42 b Fn(f)53 b Ft(is)34 b(called)g(in)g(the)227 2854 y(scop)s(e)28 b(of)f(the)g(inner)f (binding)e(of)36 b Fn(x)8 b Ft(.)40 b(Therefore,)28 b(under)d(dynamic)h (scop)s(e,)i(the)g(v)-5 b(alue)27 b(of)g(this)f(expression)227 2967 y(will)35 b(b)s(e)45 b(4)25 b(+)f(5)37 b(=)f(9)8 b(.)62 b(Sho)m(w)37 b(ho)m(w)g(y)m(ou)g(can)h(reduce)f(the)g (expression)f(to)i(9)f(b)m(y)h Fs(not)46 b Ft(renaming)36 b(b)s(ound)227 3080 y(v)-5 b(ariables)29 b(when)h(y)m(ou)g(p)s(erform)f (substitution.)61 3267 y(\(d\))45 b(In)24 b(the)g(usual)f(statically)h (scop)s(ed)g(lam)m(b)s(da)f(calculus,)33 b Fn(\013)9 b Ft(-con)m(v)m(ersion)24 b(\(renaming)g(b)s(ound)e(v)-5 b(ariables\))23 b(do)s(es)227 3380 y(not)33 b(c)m(hange)h(the)e(v)-5 b(alue)32 b(of)h(an)f(expression.)46 b(Use)33 b(the)f(example)g (expression)g(from)g(part)g(\(a\))h(to)h(explain)227 3493 y(wh)m(y)i Fn(\013)9 b Ft(-con)m(v)m(ersion)28 b(ma)m(y)g(c)m (hange)g(the)g(v)-5 b(alue)27 b(of)h(an)f(expression)f(if)h(v)-5 b(ariables)26 b(are)i(dynamically)d(scop)s(ed.)71 3681 y(\(e\))46 b(Sho)m(w)30 b(that)h(con\015uence)g(fails)d(for)j (dynamically-scop)s(ed)d(PCF.)0 3924 y Fo(2.2.5)112 b(Recursion)37 b(and)h(\014xed-p)s(oin)m(t)g(op)s(erators)0 4096 y Ft(The)d(\014nal)f (construct)i(of)f(PCF)g(pro)m(vides)g(de\014nition)e(b)m(y)i (recursion.)54 b(Rather)36 b(than)f(add)g(a)g(new)g(declaration)0 4209 y(form,)41 b(w)m(e)f(will)d(treat)k(recursiv)m(e)e(declarations)g (as)g(a)h(com)m(bination)f(of)48 b Fl(let)f Ft(and)38 b(one)i(new)f(basic)g(function,)0 4322 y(a)i(\014xed-p)s(oin)m(t)f(op)s (erator)50 b Fs(\014x)1044 4343 y Fm(\033)1140 4322 y Ft(for)41 b(eac)m(h)h(t)m(yp)s(e)49 b Fn(\033)12 b Ft(.)72 b(The)40 b(reader)h(should)e(b)s(e)i(w)m(arned)f(that)i(this)e (construct)0 4434 y(raises)29 b(more)g(subtle)f(issues)h(than)g(the)g (parts)g(of)h(the)f(language)h(w)m(e)g(ha)m(v)m(e)h(already)e (discussed.)38 b(T)-8 b(o)30 b(b)s(egin)e(with,)0 4547 y(recursion)41 b(mak)m(es)i(it)f(p)s(ossible)e(to)j(write)e (expressions)g(with)g(no)h(normal)g(form.)76 b(This)40 b(c)m(hanges)k(our)e(basic)0 4660 y(in)m(tuition)29 b(ab)s(out)i(the)g (w)m(a)m(y)i(that)f(an)f(expression)f(de\014nes)g(a)i(mathematical)f(v) -5 b(alue.)43 b(In)31 b(addition,)e(when)i(there)0 4773 y(are)h(sev)m(eral)f(p)s(ossible)e(reductions)h(that)i(could)f(b)s(e)f (applied)g(to)i(a)f(term,)h(the)g(c)m(hoice)g(b)s(et)m(w)m(een)g(these) g(b)s(ecomes)0 4886 y(imp)s(ortan)m(t.)141 4999 y(W)-8 b(e)29 b(will)24 b(see)k(ho)m(w)g(\014xed-p)s(oin)m(t)e(op)s(erators)h (pro)m(vide)f(recursion)g(b)m(y)h(b)s(eginning)e(with)h(the)i (declaration)e(form)1451 5203 y Fl(letrec)46 b Fn(f)10 b Ft(:)15 b Fn(\033)29 b Ft(=)c Fn(M)57 b Fl(in)48 b Fn(N)5 b(:)p eop %%Page: 63 14 63 13 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(63)0 91 y(This)32 b(has)h(the)g(in)m(tended)f (meaning)h(that)h(within)39 b Fn(N)18 b Ft(,)34 b(the)g(v)-5 b(ariable)40 b Fn(f)51 b Ft(denotes)34 b(a)g(solution)e(to)i(the)f (equation)0 204 y Fn(f)42 b Ft(=)32 b Fn(M)18 b Ft(.)54 b(In)34 b(general,)44 b Fn(f)52 b Ft(ma)m(y)36 b(o)s(ccur)e(in)42 b Fn(M)18 b Ft(.)54 b(The)34 b(main)f(t)m(yping)i(constrain)m(t)f(for)h (this)e(declaration)i(is)e(that)0 317 y Fn(M)58 b Ft(m)m(ust)40 b(ha)m(v)m(e)h(t)m(yp)s(e)48 b Fn(\033)12 b Ft(,)42 b(since)d (otherwise)g(the)h(equation)48 b Fn(f)i Ft(=)41 b Fn(M)58 b Ft(do)s(es)40 b(not)g(mak)m(e)g(sense.)69 b(W)-8 b(e)41 b(will)c(see)0 430 y(that)28 b Fl(letrec)e Ft(ma)m(y)j(b)s(e)e(treated) h(as)g(syn)m(tactic)h(sugar)f(for)f(a)h(com)m(bination)f(of)h(ordinary) e Fl(let)h Ft(and)g(a)h(\014xed-p)s(oin)m(t)0 543 y(op)s(erator.)141 656 y(W)-8 b(e)35 b(can)f(see)g(ho)m(w)g Fl(letrec)e Ft(w)m(orks)h(b)m(y)h(writing)d(the)j(factorial)g(function.)49 b(T)-8 b(o)34 b(simplify)c(the)k(notation,)h(let)0 769 y(us)28 b(write)37 b Fn(x)17 b Fr(\000)h Ft(1)38 b(for)28 b(the)i(predecessor)f(of)37 b Fn(x)8 b Ft(,)30 b(and)37 b Fn(x)17 b Fr(\003)h Fn(y)40 b Ft(for)29 b(the)g(pro)s(duct)f(of)38 b Fn(x)f Ft(and)g Fn(y)12 b Ft(.)39 b(\(T)-8 b(o)30 b(sta)m(y)g(within) d(the)0 882 y(natural-n)m(um)m(b)s(ers,)j(w)m(e)h(consider)39 b(0)21 b Fr(\000)g Ft(1)27 b(=)f(0)8 b(.\))45 b(W)-8 b(e)32 b(will)d(see)j(later)f(ho)m(w)g(to)h(de\014ne)f(predecessor)g (and)g(natural)0 995 y(n)m(um)m(b)s(er)38 b(m)m(ultiplication)f(in)h (PCF)h(using)f(recursion.)67 b(With)39 b(these)h(extra)g(op)s (erations,)h(w)m(e)f(can)g(de\014ne)f(the)0 1108 y(factorial)30 b(function)f(and)h(compute)39 b(5!)g(b)m(y)31 b(writing)372 1293 y Fl(letrec)46 b Fn(f)10 b Ft(:)15 b Fs(nat)952 1287 y Fr(!)1058 1293 y Fs(nat)35 b Ft(=)25 b Fn(\025y)s Ft(:)15 b Fs(nat)10 b Fn(:)30 b Ft(\()p Fl(if)48 b Fs(Eq)8 b Ft(?)14 b Fn(y)k Ft(0)48 b Fl(then)f Ft(1)h Fl(else)f Fn(y)23 b Fr(\003)e Fn(f)10 b Ft(\()p Fn(y)22 b Fr(\000)e Ft(1\)\))49 b Fl(in)e Fn(f)25 b Ft(5)0 1479 y(Since)38 b(the)h(v)-5 b(ariable)45 b Fn(f)56 b Ft(o)s(ccurs)39 b(free)g(in)e(the)i(expression)e(on)i(the)g(righ)m(t-hand)e(side)h(of)h (the)f(equals)g(sign,)i(w)m(e)0 1592 y(cannot)34 b(simply)c(tak)m(e)43 b Fn(f)51 b Ft(to)34 b(refer)f(to)h(the)f(expression)f(on)h(the)g(righ) m(t.)49 b(Instead,)34 b(w)m(e)f(w)m(an)m(t)42 b Fn(f)51 b Ft(in)32 b(the)h(function)0 1704 y(b)s(o)s(dy)e(to)i(refer)e (\\recursiv)m(ely")h(to)h(the)f(function)f(b)s(eing)g(de\014ned.)45 b(W)-8 b(e)33 b(ma)m(y)g(summarize)e(this)g(b)m(y)h(sa)m(ying)g(that)0 1817 y Fn(f)48 b Ft(m)m(ust)30 b(b)s(e)g(a)h(solution)e(to)i(the)f (equation)944 2003 y Fn(f)35 b Ft(=)25 b Fn(\025y)s Ft(:)15 b Fs(nat)10 b Fn(:)30 b Fl(if)47 b Fs(Eq)8 b Ft(?)15 b Fn(y)j Ft(0)48 b Fl(then)f Ft(1)h Fl(else)f Fn(y)23 b Fr(\003)d Fn(f)10 b Ft(\()p Fn(y)23 b Fr(\000)d Ft(1\))0 2189 y(with)26 b(t)m(w)m(o)i(o)s(ccurrences)f(of)h(the)f(function)f(v) -5 b(ariable)34 b Fn(f)17 b Ft(.)40 b(F)-8 b(rom)27 b(a)h(mathematical) f(p)s(oin)m(t)f(of)i(view,)f(it)f(is)h(not)g(clear)0 2301 y(that)35 b(ev)m(ery)g(equation)42 b Fn(f)10 b Ft(:)15 b Fn(\033)34 b Ft(=)d Fn(M)53 b Ft(in)m(v)m(olving)32 b(an)i(arbitrary)f(PCF)h(expression)41 b Fn(M)52 b Ft(should)32 b(ha)m(v)m(e)k(a)e(solution,)0 2414 y(or)e(whic)m(h)g(solution)f(to)i (c)m(ho)s(ose)h(if)d(sev)m(eral)i(exist.)47 b(W)-8 b(e)33 b(will)d(consider)i(these)h(questions)e(more)i(carefully)e(when)0 2527 y(w)m(e)i(in)m(v)m(estigate)h(the)f(denotational)g(seman)m(tics)g (of)g(PCF)g(in)f(Chapter)g(5.)49 b(Ho)m(w)m(ev)m(er,)35 b(recursiv)m(e)e(function)e(dec-)0 2640 y(larations)f(ha)m(v)m(e)h(a)g (clear)f(computational)g(in)m(terpretation.)41 b(Therefore,)30 b(w)m(e)h(will)d(assume)i(that)h(ev)m(ery)g(de\014ning)0 2753 y(equation)f(has)f Fs(some)37 b Ft(solution)29 b(and)g(add)g(syn)m (tax)h(to)h(PCF)e(for)h(expressing)e(this.)40 b(The)29 b(asso)s(ciated)h(equational)0 2866 y(axiom)f(and)g(rewrite)g(rule)f (will)f(allo)m(w)i(us)g(to)h(think)e(op)s(erationally)g(ab)s(out)h (recursiv)m(e)g(de\014nitions)e(and)i(pro)m(vide)0 2979 y(a)i(useful)d(guide)i(in)f(discussing)f(denotational)i(seman)m(tics)g (in)g(Chapter)f(5.)141 3092 y(Using)35 b(lam)m(b)s(da)g(abstraction,)j (w)m(e)e(can)g(represen)m(t)g(an)m(y)h(recursiv)m(e)e(de\014nition)42 b Fn(f)10 b Ft(:)15 b Fn(\033)38 b Ft(=)c Fn(M)54 b Ft(b)m(y)36 b(a)g(function)0 3205 y Fn(\025f)10 b Ft(:)15 b Fn(\033)n(:)g(M)k Ft(.)56 b(Rather)36 b(than)g(lo)s(oking)e(for)i(a)g(solution)e(to)j(a)f (recursiv)m(e)f(de\014ning)f(equation,)j(w)m(e)f(will)d(pro)s(duce)i(a) 0 3318 y(\014xed)26 b(p)s(oin)m(t)f(of)i(the)f(asso)s(ciated)h (function.)38 b(In)26 b(general,)h(if)34 b Fn(F)13 b Ft(:)i Fn(\033)2235 3312 y Fr(!)2341 3318 y Fn(\033)38 b Ft(is)25 b(a)i(function)e(from)h(some)h(t)m(yp)s(e)g(to)g(itself,)0 3431 y(a)39 b Fs(\014xe)-5 b(d)40 b(p)-5 b(oint)41 b(of)49 b Fn(F)59 b Ft(is)37 b(a)i(v)-5 b(alue)46 b Fn(x)p Ft(:)15 b Fn(\033)50 b Ft(suc)m(h)38 b(that)47 b Fn(F)13 b Ft(\()p Fn(x)p Ft(\))39 b(=)f Fn(x)8 b Ft(.)64 b(F)-8 b(or)39 b(example,)h(returning)d(to)i(the)f(factorial)0 3543 y(function,)29 b(w)m(e)i(can)g(see)g(that)g(factorial)f(is)f(a)i (\014xed)f(p)s(oin)m(t)f(of)i(the)f(op)s(erator)597 3752 y Fn(F)724 3696 y Fj(def)741 3752 y Ft(=)73 b Fn(\025f)10 b Ft(:)15 b Fs(nat)1184 3746 y Fr(!)1290 3752 y Fs(nat)10 b Fn(:)15 b(\025y)s Ft(:)g Fs(nat)10 b Fn(:)30 b Fl(if)47 b Fs(Eq)8 b Ft(?)15 b Fn(y)j Ft(0)48 b Fl(then)f Ft(1)h Fl(else)f Fn(y)23 b Fr(\003)d Fn(f)10 b Ft(\()p Fn(y)23 b Fr(\000)d Ft(1\))0 3938 y(on)29 b(natural-n)m(um)m(b)s(er)e (functions.)38 b(W)-8 b(e)30 b(sho)m(w)f(ho)m(w)g(factorial)f(is)g (de\014ned)g(and)g(computed)g(in)g(PCF)g(b)m(y)h(applying)0 4050 y(a)i(\014xed-p)s(oin)m(t)e(op)s(erator)h(to)i(this)d(function.) 141 4163 y(The)h(last)g(basic)g(construct)h(of)f(PCF)g(is)g(a)h(family) d(of)j(functions)1587 4349 y Fs(\014x)1691 4371 y Fm(\033)1763 4349 y Ft(:)26 b(\()p Fn(\033)1920 4343 y Fr(!)2026 4349 y Fn(\033)s Ft(\))2131 4343 y Fr(!)2237 4349 y Fn(\033)n(;)0 4534 y Ft(one)42 b(for)g(eac)m(h)i(t)m(yp)s(e)50 b Fn(\033)12 b Ft(.)76 b(The)41 b(function)49 b Fs(\014x)1614 4556 y Fm(\033)1711 4534 y Ft(pro)s(duces)41 b(a)h(\014xed)g(p)s(oin)m(t)f (of)h(an)m(y)h(function)e(from)49 b Fn(\033)54 b Ft(to)d Fn(\033)12 b Ft(.)0 4647 y(Using)38 b(lam)m(b)s(da)f(abstraction)i(and) 46 b Fs(\014x)1376 4669 y Fm(\033)1431 4647 y Ft(,)41 b(w)m(e)e(can)g(regard)g(the)f(recursiv)m(e)g Fl(letrec)f Ft(declaration)h(form)g(as)h(an)0 4760 y(abbreviation:)658 4946 y Fl(letrec)46 b Fn(f)10 b Ft(:)15 b Fn(\033)28 b Ft(=)d Fn(M)58 b Fl(in)47 b Fn(N)1721 4890 y Fj(def)1739 4946 y Ft(=)102 b Fl(let)47 b Fn(f)10 b Ft(:)15 b Fn(\033)28 b Ft(=)d(\()p Fs(\014x)2514 4968 y Fm(\033)2591 4946 y Fn(\025f)10 b Ft(:)15 b Fn(\033)n(:M)10 b Ft(\))49 b Fl(in)e Fn(N)5 b(:)0 5131 y Ft(Since)29 b(w)m(e)i(often)g(use)f Fl(letrec)f Ft(to)i(de\014ne)e(functions,)h(w)m(e)g(also)h(adopt)f(the) h(syn)m(tactic)g(sugar)524 5340 y Fl(letrec)46 b Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fn(\034)10 b Ft(\):)15 b Fn(\033)30 b Ft(=)25 b Fn(M)57 b Fl(in)48 b Fn(N)1800 5285 y Fj(def)1818 5340 y Ft(=)103 b Fl(letrec)46 b Fn(f)10 b Ft(:)15 b Fn(\034)2486 5334 y Fr(!)2592 5340 y Fn(\033)28 b Ft(=)d Fn(\025x)p Ft(:)15 b Fn(\034)5 b(:M)58 b Fl(in)48 b Fn(N)5 b(:)p eop %%Page: 64 15 64 14 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(64)0 91 y(The)30 b(equational)g(axiom)g(for)38 b Fs(\014x)1151 113 y Fm(\033)1198 91 y Ft(:)15 b(\()p Fn(\033)1344 85 y Fr(!)1450 91 y Fn(\033)s Ft(\))1555 85 y Fr(!)1661 91 y Fn(\033)42 b Ft(is)30 b(that)h(it)f(pro)s(duces)f (a)h(\014xed)g(p)s(oin)m(t)39 296 y(\()p Fs(\014x)11 b Ft(\))1223 b Fs(\014x)1540 317 y Fm(\033)1613 296 y Ft(=)25 b Fn(\025f)10 b Ft(:)15 b Fn(\033)1927 290 y Fr(!)2033 296 y Fn(\033)n(:f)25 b Ft(\()p Fs(\014x)2317 317 y Fm(\033)2379 296 y Fn(f)10 b Ft(\))p Fn(:)0 500 y Ft(Using)38 b(\()p Fn(\014)5 b Ft(\))j(,)32 b(it)e(is)f(easy)i(to)g (deriv)m(e)f(the)h(more)f(in)m(tuitiv)m(e)f(equation)1533 704 y Fs(\014x)1637 726 y Fm(\033)1699 704 y Fn(M)36 b Ft(=)25 b Fn(M)g Ft(\()p Fs(\014x)2171 726 y Fm(\033)2233 704 y Fn(M)10 b Ft(\))0 908 y(for)32 b(an)m(y)41 b Fn(M)10 b Ft(:)15 b Fn(\033)532 902 y Fr(!)638 908 y Fn(\033)d Ft(.)45 b(The)32 b(\()p Fs(\014x)11 b Ft(\))33 b(reduction)e(rule)g(is) g(obtained)h(b)m(y)g(reading)f(the)i(equational)e(axiom)h(from)g(left)0 1021 y(to)c(righ)m(t.)40 b(Some)27 b(reasonable,)h(non-equational)f (prop)s(erties)f(of)36 b Fs(\014x)2324 1043 y Fm(\033)2407 1021 y Ft(are)28 b(more)f(subtle,)g(and)g(will)e(b)s(e)i(discussed)0 1134 y(in)i(Sections)h(5.2)i(and)d(5.3.)141 1247 y(T)-8 b(o)38 b(see)g(ho)m(w)g(\()p Fs(\014x)11 b Ft(\))38 b(reduction)f(w)m (orks,)i(w)m(e)f(will)d(con)m(tin)m(ue)j(the)g(factorial)f(example.)62 b(Using)45 b Fs(\014x)3555 1269 y Fj(nat)3674 1265 y Fi(!)3756 1269 y Fj(nat)3875 1247 y Ft(,)0 1388 y(the)31 b(factorial)g(function)f(ma)m(y)i(b)s(e)e(written)39 b Fs(fact)1733 1332 y Fj(def)1751 1388 y Ft(=)74 b Fs(\014x)2000 1410 y Fj(nat)2119 1406 y Fi(!)2201 1410 y Fj(nat)2343 1388 y Fn(F)s(;)39 b Ft(where)g Fn(F)53 b Ft(is)30 b(written)g(out)h (ab)s(o)m(v)m(e.)44 b(As)32 b(a)0 1501 y(t)m(yp)s(ographical)26 b(simpli\014cation,)e(w)m(e)j(will)d(drop)i(the)g(subscript)f(of)h Fs(\014x)38 b Ft(in)25 b(the)i(calculation)f(b)s(elo)m(w.)39 b(T)-8 b(o)27 b(compute)0 1614 y Fs(fact)39 b Fn(n)8 b Ft(,)31 b(w)m(e)g(ma)m(y)g(expand)e(the)i(de\014nition,)d(and)i(use)g (reduction)f(to)i(obtain)f(the)h(follo)m(wing.)254 1810 y Fs(fact)39 b Fn(n)83 b Fr(\021)133 b Ft(\()p Fs(\014x)42 b Fn(F)13 b Ft(\))31 b Fn(n)577 1923 y Fr(!)-61 b(!)83 b Fn(F)43 b Ft(\()p Fs(\014x)27 b Fn(F)13 b Ft(\))31 b Fn(n)577 2036 y Fr(\021)133 b Ft(\()p Fn(\025f)10 b Ft(:)15 b Fs(nat)1116 2030 y Fr(!)1222 2036 y Fs(nat)9 b Fn(:)15 b(\025y)s Ft(:)g Fs(nat)10 b Fn(:)31 b Fl(if)47 b Fs(Eq)8 b Ft(?)15 b Fn(y)j Ft(0)48 b Fl(then)e Ft(1)j Fl(else)d Fn(y)23 b Fr(\003)e Fn(f)10 b Ft(\()p Fn(y)23 b Fr(\000)d Ft(1\)\))31 b(\()p Fs(\014x)c Fn(F)13 b Ft(\))30 b Fn(n)577 2149 y Fr(!)-61 b(!)83 b Fl(if)47 b Fs(Eq)8 b Ft(?)15 b Fn(n)g Ft(0)48 b Fl(then)e Ft(1)j Fl(else)d Fn(n)20 b Fr(\003)h Ft(\()p Fs(\014x)26 b Fn(F)13 b Ft(\)\()p Fn(n)21 b Fr(\000)f Ft(1\))0 2351 y(Note)35 b(that)g(apart)f(from)f(\() p Fs(\014x)11 b Ft(\))35 b(reduction,)f(w)m(e)g(ha)m(v)m(e)h(used)e (only)g(ordinary)41 b Fn(\014)13 b Ft(-reduction.)51 b(When)41 b Fn(n)31 b Ft(=)g(0)8 b(,)35 b(w)m(e)0 2463 y(can)e(use)f(the)h(axiom)f(for)h(conditional)d(to)k(simplify)j Fs(fact)42 b Ft(0)f(to)g(1)8 b(.)48 b(F)-8 b(or)42 b Fn(n)28 b(>)h Ft(0)8 b(,)34 b(w)m(e)f(can)g(simplify)c(the)k(test)g(to) 0 2576 y(obtain)45 b Fn(n)24 b Fr(\003)h Ft(\()p Fs(\014x)i Fn(F)13 b Ft(\)\()p Fn(n)25 b Fr(\000)f Ft(1\))46 b(and)36 b(con)m(tin)m(ue)h(as)g(ab)s(o)m(v)m(e.)62 b(F)-8 b(or)38 b(an)m(y)f(natural)f(n)m(um)m(b)s(er)44 b Fn(n)8 b Ft(,)39 b(it)d(is)g(clear)h(that)g(w)m(e)0 2689 y(will)d(ev)m(en)m(tually)j (compute)45 b Fs(fact)g Fn(n)36 b Ft(=)f Fn(n)p Ft(!)8 b(.)59 b(Put)37 b(more)f(formally)-8 b(,)38 b(w)m(e)f(ma)m(y)g(use)f (ordinary)f(natural-)h(n)m(um)m(b)s(er)0 2802 y(induction)24 b(to)j(pro)m(v)m(e)g(the)f(theorem)g(ab)s(out)g(PCF)g(that)h(for)f(ev)m (ery)h(natural)e(n)m(um)m(b)s(er)33 b Fn(n)h Ft(the)26 b(application)e(of)35 b Fs(fact)0 2915 y Ft(to)c(the)g(PCF)f(n)m (umeral)f(for)39 b Fn(n)f Ft(ma)m(y)31 b(b)s(e)e(reduced)h(to)h(the)g (n)m(umeral)e(for)38 b Fn(n)p Ft(!)8 b(.)141 3028 y(As)40 b(men)m(tioned)g(ab)s(o)m(v)m(e,)k(\014xed-p)s(oin)m(t)38 b(op)s(erators)i(raise)g(mathematical)g(problems.)68 b(If)40 b(w)m(e)g(think)f(of)h(the)0 3141 y(functions)30 b(from)39 b Fs(nat)768 3135 y Fr(!)875 3141 y Fs(nat)48 b Ft(to)41 b Fs(nat)1322 3135 y Fr(!)1428 3141 y Fs(nat)49 b Ft(as)32 b(ordinary)d(set-theoretic)k(functions,)e(then)g(it)f(do)s (es)h(not)h(mak)m(e)0 3254 y(sense)i(to)g(p)s(ostulate)g(that)g(ev)m (ery)43 b Fn(f)10 b Ft(:)15 b(\()p Fs(nat)1486 3248 y Fr(!)1592 3254 y Fs(nat)9 b Ft(\))1778 3248 y Fr(!)1870 3254 y Ft(\()p Fs(nat)2057 3248 y Fr(!)2163 3254 y Fs(nat)g Ft(\))43 b(has)33 b(a)i(\014xed)e(p)s(oin)m(t)41 b Fn(x)h Ft(with)33 b(the)h(prop)s(ert)m(y)0 3367 y Fn(x)39 b Ft(=)f Fn(f)10 b Ft(\()p Fn(x)p Ft(\))e(.)65 b(Ho)m(w)m(ev)m(er,)43 b(as)c(sho)m(wn)e(in)h(Exercise)g(2.2.16,)43 b(w)m(e)c(ha)m(v)m(e)g (\014xed)f(p)s(oin)m(ts)f(of)i(this)e(t)m(yp)s(e)i(i\013)f(w)m(e)g (allo)m(w)0 3480 y(n)m(umeric)d(functions)g(to)i(b)s(e)f(de\014ned)f(b) m(y)h(recursion.)57 b(Since)36 b(recursion)f(is)g(fundamen)m(tal)g(to)i (computation,)h(it)0 3593 y(is)31 b(imp)s(ortan)m(t)g(to)i(ha)m(v)m(e)h (\014xed-p)s(oin)m(t)c(op)s(erators)j(in)d(PCF.)i(The)g(w)m(a)m(y)h(to) g(mak)m(e)g(mathematical)f(sense)g(of)h Fs(\014x)43 b Ft(is)0 3705 y(to)35 b(realize)e(that)h(when)f(w)m(e)h(ha)m(v)m(e)h (recursion,)f(w)m(e)g(ma)m(y)g(write)f(algorithms)g(that)h(de\014ne)f (partial)g(functions.)49 b(If)0 3818 y Fn(f)10 b Ft(:)15 b(\()p Fs(nat)282 3812 y Fr(!)388 3818 y Fs(nat)9 b Ft(\))574 3812 y Fr(!)665 3818 y Ft(\()p Fs(nat)852 3812 y Fr(!)958 3818 y Fs(nat)h Ft(\))e(,)35 b(then)e(its)h(\014xed)e(p)s(oin)m(t)h(ma) m(y)h(b)s(e)f(a)h Fs(p)-5 b(artial)46 b Ft(function,)33 b(suc)m(h)h(as)f(the)h(function)0 3931 y(whic)m(h)42 b(is)h(unde\014ned)e(on)j(all)e(in)m(teger)i(argumen)m(ts.)81 b(Th)m(us,)46 b(when)c(w)m(e)i(add)f(recursion)f(to)i(PCF,)g(w)m(e)g(m) m(ust)0 4044 y(understand)34 b(that)j(an)f(expression)f(of)h(t)m(yp)s (e)44 b Fn(\033)k Ft(de\014nes)35 b(an)h(algorithm)f(for)h(computing)f (an)h(elemen)m(t)h(of)f(t)m(yp)s(e)0 4157 y Fn(\033)12 b Ft(.)56 b(In)35 b(the)h(case)g(that)g(this)f(algorithm)g(do)s(es)g (not)h(terminate,)h(the)f(expression)e(ma)m(y)i(not)g(de\014ne)f(one)h (of)g(the)0 4270 y(standard)28 b(v)-5 b(alues)27 b(of)i(that)g(t)m(yp)s (e.)40 b(\(A)29 b(note)g(for)f(recursion)f(theorists)h(is)f(that)i(if)e (w)m(e)i(replace)f Fs(\014x)40 b Ft(b)m(y)28 b(some)h(other)0 4383 y(construct)i(that)f(do)s(es)g(not)h(allo)m(w)e(us)h(to)g(write)g (non)m(terminating)f(functions,)g(there)h(w)m(ould)f(b)s(e)h(total)h (recursiv)m(e)0 4496 y(functions)g(w)m(e)i(could)f(not)h(write)f(in)f (PCF.)i(This)d(follo)m(ws)i(from)g(the)h(fact)h(that)f(the)g(set)g(of)g (all)e(total)j(recursiv)m(e)0 4609 y(functions)29 b(is)g(not)i Fs(r.e.)p Ft(\))141 4722 y(Although)j Fs(\014x)46 b Ft(tak)m(es)37 b(the)e(\014xed)f(p)s(oin)m(t)g(of)h(a)h(simple)d(function,)i(w)m(e)g (can)g(actually)g(use)g Fs(\014x)46 b Ft(to)35 b(de\014ne)g(an)m(y)0 4835 y(n)m(um)m(b)s(er)26 b(of)h(m)m(utually)f(recursiv)m(e)g (functions.)39 b(This)25 b(is)h(most)i(easily)e(illustrated)f(for)i (the)g(case)i(of)e(t)m(w)m(o)i(recursiv)m(e)0 4947 y(functions.)39 b(Supp)s(ose)29 b(w)m(e)i(w)m(an)m(t)g(to)g(de\014ne)f(recursiv)m(e)f (functions)38 b Fn(f)48 b Ft(and)38 b Fn(g)k Ft(satisfying)29 b(the)h(equations)1703 5144 y Fn(f)92 b Ft(=)83 b Fn(F)28 b(f)d(g)1703 5257 y(g)94 b Ft(=)83 b Fn(G)15 b(f)24 b(g)p eop %%Page: 65 16 65 15 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(65)0 91 y(where)31 b(w)m(e)g(assume)g(that)h (neither)38 b Fn(f)48 b Ft(nor)39 b Fn(g)k Ft(app)s(ears)31 b(free)g(in)38 b Fn(F)52 b Ft(or)39 b Fn(G)8 b Ft(.)43 b(Let)32 b(us)e(assume)h(that)40 b Fn(F)13 b Ft(:)i Fn(\033)3567 85 y Fr(!)3674 91 y Fn(\034)3739 85 y Fr(!)3845 91 y Fn(\033)0 204 y Ft(and)49 b Fn(G)p Ft(:)15 b Fn(\033)378 198 y Fr(!)484 204 y Fn(\034)549 198 y Fr(!)655 204 y Fn(\034)59 b Ft(so)41 b(that)h(b)s(oth)e(equations)g(are)i(t)m(yp)s(e)f (correct.)73 b(W)-8 b(e)42 b(ma)m(y)f(then)g(apply)48 b Fs(\014x)3439 226 y Fm(\033)14 b Fi(\002)e Fm(\034)3652 204 y Ft(to)42 b(the)0 317 y(function)29 b(on)h(pairs)1423 430 y Fn(\025)p Fr(h)p Fn(f)10 b Ft(:)15 b Fn(\033)n(;)g(g)s Ft(:)g Fn(\034)10 b Fr(i)p Fn(:)15 b Fr(h)p Fn(F)32 b(f)24 b(g)s(;)41 b(G)15 b(f)24 b(g)s Fr(i)p Fn(:)0 583 y Ft(This)41 b(giv)m(es)i(us)f(a)h(recursiv)m(ely-de\014ned)d(pair)h(whose)i (\014rst)f(and)g(second)g(comp)s(onen)m(ts)h(satisfy)f(the)h(original)0 696 y(de\014ning)26 b(equations.)40 b(The)27 b(details)g(are)h(left)g (as)g(Exercise)f(2.2.15.)43 b(An)27 b(alternativ)m(e)h(approac)m(h)h (whic)m(h)d(do)s(es)i(not)0 809 y(use)i(pairing)e(is)i(giv)m(en)g(in)f (Exercise)h(5.3.5.)0 993 y Fk(Exercise)35 b(2.2.14)47 b Ft(Assuming)29 b(w)m(e)h(ha)m(v)m(e)i(subtraction)e(in)f(PCF,)h (write)g(a)g Fl(letrec)f Ft(expression)g(of)i(the)f(form)1141 1168 y Fl(letrec)46 b Fs(\014b)6 b Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)10 b Ft(\):)15 b Fs(nat)35 b Ft(=)56 b Fn(:)15 b(:)g(:)94 b Fl(in)47 b Fs(\014b)6 b Ft(\(4\))0 1344 y(whic)m(h)28 b(de\014nes)h(the)g(Fib)s(onacci)g(function)f(and)h (applies)e(it)i(to)38 b(4)h(to)30 b(compute)f(the)h(fourth)f(Fib)s (onacci)f(n)m(um)m(b)s(er.)0 1457 y(\(Recall)f(that)h(the)f(zero-th)h (Fib)s(onacci)e(n)m(um)m(b)s(er)f(is)h(1,)j(the)e(\014rst)f(Fib)s (onacci)g(n)m(um)m(b)s(er)g(is)g(1,)i(and)f(after)g(that)h(eac)m(h)0 1570 y(Fib)s(onacci)i(n)m(um)m(b)s(er)f(is)h(the)h(sum)e(of)i(the)g (preceding)f(t)m(w)m(o.\))43 b(Sho)m(w)30 b(ho)m(w)h(y)m(our)g Fl(letrec)d Ft(expression)i(reduces)g(to)0 1683 y(the)38 b(4th)g(Fib)s(onacci)e(n)m(um)m(b)s(er.)62 b(Y)-8 b(ou)38 b(should)e(giv)m(e)i(appro)m(ximately)f(the)h(same)g(amoun)m(t)g(of)g (detail)e(as)i(in)f(the)0 1796 y(factorial)30 b(example)g(of)h(this)e (section.)0 1980 y Fk(Exercise)35 b(2.2.15)47 b Ft(Consider)29 b(the)h(pair)f(of)i(equations)1703 2148 y Fn(f)92 b Ft(=)83 b Fn(F)28 b(f)d(g)1703 2261 y(g)94 b Ft(=)83 b Fn(G)15 b(f)24 b(g)0 2429 y Ft(where)43 b Fn(F)13 b Ft(:)i Fn(\033)458 2423 y Fr(!)564 2429 y Fn(\034)629 2423 y Fr(!)735 2429 y Fn(\033)d Ft(,)45 b Fn(G)p Ft(:)15 b Fn(\033)1051 2423 y Fr(!)1157 2429 y Fn(\034)1222 2423 y Fr(!)1328 2429 y Fn(\034)54 b Ft(and)34 b(neither)43 b Fn(f)53 b Ft(nor)43 b Fn(g)k Ft(app)s(ears)34 b(free)i(in)42 b Fn(F)57 b Ft(or)43 b Fn(G)8 b Ft(.)55 b(Sho)m(w)35 b(that)h(the)0 2542 y(\014rst)30 b(and)f(second)i(comp)s(onen)m(ts)f(of)1259 2718 y Fs(\014x)1363 2740 y Fm(\033)15 b Fi(\002)c Fm(\034)1543 2718 y Ft(\()p Fn(\025)p Fr(h)p Fn(f)f Ft(:)15 b Fn(\033)n(;)g(g)s Ft(:)g Fn(\034)10 b Fr(i)p Fn(:)15 b Fr(h)p Fn(F)31 b(f)24 b(g)s(;)42 b(G)15 b(f)24 b(g)s Fr(i)p Ft(\))0 2894 y(satisfy)45 b(these)g(equations.)85 b(\(An)45 b(alternativ)m(e)g(approac)m(h)g(to)h (m)m(utually-recursiv)m(e)d(de\014nitions)g(is)h(giv)m(en)h(in)0 3006 y(Exercise)30 b(5.3.5.\))0 3191 y Fk(Exercise)35 b(2.2.16)47 b Ft(In)28 b(this)f(section,)j(w)m(e)f(de\014ned)e Fl(letrec)g Ft(as)i(syn)m(tactic)g(sugar)g(using)e Fs(\014x.)40 b Ft(The)28 b(p)s(oin)m(t)f(of)i(this)0 3303 y(exercise)i(is)e(to)i (demonstrate)g(that)g Fs(\014x)42 b Ft(is)29 b(also)h(de\014nable)f (from)h Fl(letrec.)66 3467 y Ft(\(a\))46 b(W)-8 b(rite)34 b(an)f(expression)f Fs(FIX)47 b Ft(using)32 b Fl(letrec)f Ft(with)h(the)i(prop)s(ert)m(y)e(that)i(if)e(w)m(e)i(expand)40 b Fl(letrec)46 b Fn(f)10 b Ft(:)15 b Fn(\033)33 b Ft(=)227 3580 y Fn(M)58 b Fl(in)47 b Fn(N)57 b Ft(to)48 b(\()p Fn(\025f)10 b Ft(:)15 b Fn(\033)n(:N)10 b Ft(\)\()p Fs(\014x)1290 3602 y Fm(\033)1376 3580 y Ft(\()p Fn(\025f)g Ft(:)15 b Fn(\033)n(:M)10 b Ft(\)\))e(,)43 b(w)m(e)c(can)g(reduce)g Fs(FIX)53 b Ft(to)39 b Fs(\014x)50 b Ft(using)37 b(only)46 b Fn(\014)13 b Ft(-reduction)227 3693 y(and)38 b Fn(\021)12 b Ft(-reduction.)61 3871 y(\(b\))45 b(W)-8 b(rite)31 b(a)g(reduction)e(rule)g(for)h Fl(letrec)f Ft(of)i(the)f(form)1441 4047 y Fl(letrec)46 b Fn(f)10 b Ft(:)15 b Fn(\033)28 b Ft(=)d Fn(M)58 b Fl(in)47 b Fn(N)2464 4041 y Fr(!)2600 4047 y Fn(P)s(;)227 4223 y Ft(where)38 b Fn(P)50 b Ft(is)29 b(an)h(expression)e(con)m(taining)37 b Fn(M)19 b Ft(,)38 b Fn(N)48 b Ft(and)29 b Fl(letrec)p Ft(,)f(but)h(not)h Fs(\014x)11 b Ft(.)40 b(As)30 b(a)g(c)m(hec)m(k)h(that)f(this)f(is)227 4336 y(plausible,)f(sho)m(w)i(that)39 b Fn(P)52 b Ft(is)29 b(pro)m(v)-5 b(ably)30 b(equal)g(to)1450 4512 y([)15 b([\()p Fs(FIX)31 b Ft(\()p Fn(\025f)10 b Ft(:)15 b Fn(\033)n(:M)10 b Ft(\)\))p Fn(=f)g Ft(])p Fn(M)g Ft(])15 b Fn(=)g(f)10 b Ft(])p Fn(N)5 b(;)227 4687 y Ft(whic)m(h)31 b(corresp)s(onds)g(to)j (the)e(result)f(of)i(doing)f(one)g Fs(\014x)44 b Ft(reduction)31 b(and)h(one)41 b Fn(\014)13 b Ft(-reduction)32 b(to)h(the)g(term)227 4800 y(\()p Fn(\025f)10 b Ft(:)15 b Fn(\033)n(:N)10 b Ft(\)\()p Fs(\014x)744 4822 y Fm(\033)816 4800 y Ft(\()p Fn(\025f)g Ft(:)15 b Fn(\033)n(:M)10 b Ft(\)\))40 b(men)m(tioned)30 b(in)f(part)h Fs(\(a\).)71 4979 y Ft(\(c\))46 b(Sho)m(w)30 b(that)i(if)d(w)m(e)i(tak)m(e)h Fl(letrec)d Ft(as)i(basic,)f(and)g(use) h(the)g(reduction)e(rule)g(giv)m(en)i(in)e(part)i Fs(\(b\))s Ft(,)g(the)g(term)227 5091 y Fs(FIX)41 b Ft(y)m(ou)26 b(ga)m(v)m(e)j(in)c(answ)m(er)h(to)h(part)f Fs(\(a\))k Ft(is)c(a)g(\014xed-p)s(oin)m(t)f(op)s(erator.)40 b(That)26 b(is,)g(sho)m(w)g(that)h(for)f(an)m(y)h(term)227 5204 y Fn(M)51 b Ft(of)33 b(the)g(correct)g(t)m(yp)s(e,)42 b Fs(FIX)30 b Fn(M)39 b Fr(!)-61 b(!)29 b Fn(M)10 b(F)21 b Ft(,)34 b(where)40 b Fn(F)54 b Ft(is)32 b(the)g(result)g(of)h (applying)d(one)41 b Fn(\014)13 b Ft(-reduction)227 5317 y(to)40 b(\()p Fs(FIX)30 b Fn(M)10 b Ft(\))e(.)p eop %%Page: 66 17 66 16 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(66)0 91 y Fo(2.2.6)112 b(PCF)38 b(syn)m(tax)g(summary)f(and)h(collected)e(examples)0 263 y Fk(Pure)f(PCF)0 435 y Ft(The)25 b(syn)m(tax)i(of)f(pure)f(PCF,)h (without)f(extension)g(b)m(y)h(syn)m(tactic)h(sugar,)g(is)e(summarized) f(b)s(elo)m(w)h(b)m(y)h(a)g(BNF-lik)m(e)0 547 y(grammar.)38 b(The)20 b(\014rst)g(set)h(of)g(pro)s(ductions)e(describ)s(e)g(the)i (expressions)f(of)h(an)g(arbitrary)e(t)m(yp)s(e)30 b Fn(\033)12 b Ft(.)37 b(These)20 b(include)0 660 y(v)-5 b(ariables,)26 b(conditional)e(expressions,)i(and)f(the)i(results)e(of) h(function)f(application,)g(pro)5 b(jection)26 b(functions,)g(and)0 773 y(\014xed-p)s(oin)m(t)j(application.)452 970 y Fr(h)p Fn(\033)p 548 970 28 4 v 37 w Fs(exp)6 b Fr(i)384 b Ft(::=)84 b Fr(h)p Fn(\033)p 1432 970 V 37 w Fs(var)10 b Fr(i)15 b(j)g Fl(if)48 b Fr(h)p Fs(b)-5 b(o)g(ol)p 2027 970 V 45 w(exp)6 b Fr(i)48 b Fl(then)f Fr(h)p Fn(\033)p 2611 970 V 37 w Fs(exp)6 b Fr(i)48 b Fl(else)f Fr(h)p Fn(\033)p 3193 970 V 37 w Fs(exp)6 b Fr(i)15 b(j)1336 1083 y(h)p Fn(\033)p 1432 1083 V 37 w Fs(applic)-5 b(ation)9 b Fr(i)15 b(j)g(h)p Fn(\033)p 2082 1083 V 38 w Fs(pr)-5 b(oje)g(ction)9 b Fr(i)15 b(j)g(h)p Fn(\033)p 2693 1083 V 38 w Fs(\014xe)-5 b(d)p 2913 1083 V 44 w(p)g(oint)10 b Fr(i)452 1274 y(h)p Fn(\033)p 548 1274 V 37 w Fs(applic)-5 b(ation)10 b Fr(i)83 b Ft(::=)h Fr(h)p Fn(\034)1436 1268 y Fr(!)1542 1274 y Fn(\033)p 1603 1274 V 37 w Fs(exp)6 b Fr(ih)p Fn(\034)p 1893 1274 V 44 w Fs(exp)g Fr(i)452 1465 y(h)p Fn(\033)p 548 1465 V 37 w Fs(pr)-5 b(oje)g(ction)9 b Fr(i)124 b Ft(::=)84 b Fk(Pro)6 b(j)1540 1487 y Fp(1)1580 1465 y Fr(h)p Fn(\033)18 b Fr(\002)d Fn(\034)p 1827 1465 V 44 w Fs(exp)6 b Fr(i)15 b(j)g Fk(Pro)6 b(j)2286 1487 y Fp(2)2326 1465 y Fr(h)p Fn(\034)25 b Fr(\002)15 b Fn(\033)p 2573 1465 V 37 w Fs(exp)6 b Fr(i)452 1656 y(h)p Fn(\033)p 548 1656 V 37 w Fs(\014xe)-5 b(d)p 767 1656 V 44 w(p)g(oint)10 b Fr(i)94 b Ft(::=)84 b Fs(\014x)1440 1678 y Fm(\033)1502 1656 y Fr(h)p Fn(\033)1607 1650 y Fr(!)1714 1656 y Fn(\033)p 1775 1656 V 36 w Fs(exp)6 b Fr(i)0 1853 y Ft(F)-8 b(or)31 b(function)e(and)h(pro)s(duct)f(t)m(yp)s(es,)i(w)m(e)g(also)f(ha)m(v)m (e)i(lam)m(b)s(da)d(abstraction)h(and)g(explicit)f(pairing.)1202 2049 y Fr(h)p Fn(\033)1307 2043 y Fr(!)1413 2049 y Fn(\034)p 1469 2049 V 44 w Fs(exp)6 b Fr(i)84 b Ft(::=)f Fn(\025x)p Ft(:)15 b Fn(\033)s(:)q Fr(h)p Fn(\034)p 2273 2049 V 43 w Fs(exp)7 b Fr(i)1202 2240 y(h)p Fn(\033)18 b Fr(\002)d Fn(\034)p 1449 2240 V 44 w Fs(exp)6 b Fr(i)104 b Ft(::=)83 b Fr(h)15 b(h)p Fn(\033)p 2102 2240 V 37 w Fs(exp)6 b Fr(i)p Fn(;)31 b Fr(h)p Fn(\034)p 2448 2240 V 44 w Fs(exp)6 b Fr(i)15 b(i)0 2437 y Ft(The)34 b(constan)m(ts)i(and)e(functions)f (for)i(natural)e(n)m(um)m(b)s(ers)h(and)g(b)s(o)s(oleans)f(are)i(co)m (v)m(ered)i(b)m(y)d(the)h(follo)m(wing)e(pro-)0 2550 y(ductions.)908 2637 y Fr(h)p Fs(b)-5 b(o)g(ol)p 1105 2637 V 45 w(exp)6 b Fr(i)83 b Ft(::=)g Fs(true)23 b Fr(j)15 b Fs(false)23 b Fr(j)15 b Fs(Eq)8 b Ft(?)15 b Fr(h)p Fs(nat)p 2400 2637 V 43 w(exp)6 b Fr(i)15 b(h)p Fs(nat)p 2791 2637 V 44 w(exp)6 b Fr(i)908 2868 y(h)p Fs(nat)p 1084 2868 V 43 w(exp)g Fr(i)105 b Ft(::=)83 b(0)15 b Fr(j)g Ft(1)g Fr(j)g Ft(2)g Fr(j)34 b Fn(:)15 b(:)g(:)31 b Fr(j)15 b(h)p Fs(nat)p 2264 2868 V 44 w(exp)6 b Fr(i)20 b Ft(+)g Fr(h)p Fs(nat)p 2752 2868 V 43 w(exp)7 b Fr(i)0 3027 y Ft(This)31 b(concludes)h(the)h(de\014nition)e(of)i(PCF.)g(An)f (alternate)i(de\014nition)c(of)j(the)g(syn)m(tax)h(of)f(PCF)f(ma)m(y)i (b)s(e)e(giv)m(en)0 3140 y(using)d(the)h(t)m(yping)g(rule)f(st)m(yle)i (of)g(Chapter)e(4.)0 3380 y Fk(Syn)m(tactic)35 b(extensions)0 3551 y Ft(The)c(most)h(commonly)f(used)g(extensions)g(of)h(PCF)g(b)m(y) f(syn)m(tactic)i(sugar)e(are)h(listed)e(b)s(elo)m(w,)i(along)g(with)e (their)0 3687 y(de\014nitions.)38 b(T)-8 b(o)30 b(distinguish)c (abbreviations)i(from)i(actual)g(PCF)f(syn)m(tax,)i(w)m(e)f(use)f(the)h (sym)m(b)s(ol)3414 3632 y Fj(def)3431 3687 y Ft(=)55 b(to)31 b(de\014ne)0 3823 y(meta-notational)f(con)m(v)m(en)m(tions.)41 b(The)27 b(de\014nition)35 b Fn(M)1903 3768 y Fj(def)1920 3823 y Ft(=)43 b Fn(N)j Ft(means)28 b(that)h(whenev)m(er)f(w)m(e)h (write)e(a)i(term)f(of)h(the)0 3936 y(form)38 b Fn(M)19 b Ft(,)30 b(this)f(is)h(short-hand)f(for)h(the)h(corresp)s(onding)d (term)j(of)f(the)h(form)38 b Fn(N)18 b Ft(.)p eop %%Page: 67 18 67 17 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(67)163 301 y Fl(let)47 b Fn(x)p Ft(:)15 b Fn(\033)29 b Ft(=)c Fn(M)58 b Fl(in)47 b Fn(N)1437 245 y Fj(def)1454 301 y Ft(=)100 b(\()p Fn(\025x)p Ft(:)15 b Fn(\033)t(:)g(N)10 b Ft(\))p Fn(M)163 523 y Fl(let)47 b Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fn(\033)s Ft(\):)g Fn(\034)37 b Ft(=)25 b Fn(M)57 b Fl(in)48 b Fn(N)1437 467 y Fj(def)1454 523 y Ft(=)100 b Fl(let)47 b Fn(f)10 b Ft(:)15 b Fn(\033)1981 517 y Fr(!)2087 523 y Fn(\034)35 b Ft(=)25 b Fn(\025x)p Ft(:)15 b Fn(\033)t(:)g(M)58 b Fl(in)47 b Fn(N)1437 611 y Fj(def)1454 667 y Ft(=)100 b(\()p Fn(\025f)10 b Ft(:)15 b Fn(\033)1879 661 y Fr(!)1985 667 y Fn(\034)10 b(:)15 b(N)10 b Ft(\)\()p Fn(\025x)p Ft(:)15 b Fn(\033)t(:)h(M)10 b Ft(\))163 889 y Fl(letrec)46 b Fn(f)10 b Ft(:)15 b Fn(\033)29 b Ft(=)c Fn(M)57 b Fl(in)48 b Fn(N)1437 833 y Fj(def)1454 889 y Ft(=)100 b Fl(let)47 b Fn(f)10 b Ft(:)15 b Fn(\033)28 b Ft(=)d(\()p Fs(\014x)2227 911 y Fm(\033)2304 889 y Ft(\()p Fn(\025f)10 b Ft(:)15 b Fn(\033)s(:)h(M)10 b Ft(\)\))48 b Fl(in)f Fn(N)1437 977 y Fj(def)1454 1033 y Ft(=)100 b(\()p Fn(\025f)10 b Ft(:)15 b Fn(\033)s(:)h(N)10 b Ft(\)\()p Fs(\014x)2162 1054 y Fm(\033)2234 1033 y Ft(\()p Fn(\025f)g Ft(:)15 b Fn(\033)s(:)g(M)10 b Ft(\)\))163 1255 y Fl(letrec)46 b Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fn(\034)10 b Ft(\):)15 b Fn(\033)30 b Ft(=)25 b Fn(M)58 b Fl(in)47 b Fn(N)1437 1199 y Fj(def)1454 1255 y Ft(=)100 b Fl(letrec)46 b Fn(f)10 b Ft(:)15 b Fn(\034)2119 1249 y Fr(!)2225 1255 y Fn(\033)29 b Ft(=)c Fn(\025x)p Ft(:)15 b Fn(\034)10 b(:)15 b(M)58 b Fl(in)47 b Fn(N)1437 1343 y Fj(def)1454 1398 y Ft(=)100 b Fl(let)47 b Fn(f)10 b Ft(:)15 b Fn(\034)1976 1392 y Fr(!)2082 1398 y Fn(\033)28 b Ft(=)d(\()p Fs(\014x)2398 1420 y Fm(\034)2449 1416 y Fi(!)2531 1420 y Fm(\033)2608 1398 y Ft(\()p Fn(\025f)10 b Ft(:)15 b Fn(\034)2856 1392 y Fr(!)2962 1398 y Fn(\033)t(:)g(\025x)p Ft(:)g Fn(\034)c(:)k(M)10 b Ft(\)\))48 b Fl(in)g Fn(N)1437 1487 y Fj(def)1454 1542 y Ft(=)100 b(\()p Fn(\025f)10 b Ft(:)15 b Fn(\034)1873 1536 y Fr(!)1979 1542 y Fn(\033)t(:)g(N)10 b Ft(\)\()p Fs(\014x)2333 1564 y Fm(\034)2384 1560 y Fi(!)2466 1564 y Fm(\033)2538 1542 y Ft(\()p Fn(\025f)g Ft(:)15 b Fn(\034)2786 1536 y Fr(!)2892 1542 y Fn(\033)t(:)g(\025x)p Ft(:)g Fn(\034)10 b(:)16 b(M)10 b Ft(\)\))163 1764 y Fn(\025)p Fr(h)p Fn(x)p Ft(:)15 b Fn(\033)n(;)g(y)s Ft(:)g Fn(\034)10 b Fr(i)r Fn(:)16 b(M)1437 1709 y Fj(def)1454 1764 y Ft(=)100 b Fn(\025p)p Ft(:)15 b Fn(\033)k Fr(\002)14 b Fn(\034)c(:)q Ft(\()p Fn(\025x)p Ft(:)15 b Fn(\033)t(:)g(\025y)s Ft(:)g Fn(\034)10 b(:)16 b(M)10 b Ft(\)\()p Fk(Pro)c(j)2877 1787 y Fp(1)2932 1764 y Fn(p)p Ft(\)\()p Fk(Pro)g(j)3253 1787 y Fp(2)3307 1764 y Fn(p)p Ft(\))163 1986 y Fl(let)47 b Fr(h)p Fn(x)p Ft(:)15 b Fn(\033)n(;)g(y)s Ft(:)g Fn(\034)10 b Fr(i)27 b Ft(=)e Fn(M)58 b Fl(in)47 b Fn(N)1437 1931 y Fj(def)1454 1986 y Ft(=)100 b(\()p Fn(\025)p Fr(h)p Fn(x)p Ft(:)15 b Fn(\033)n(;)g(y)s Ft(:)g Fn(\034)10 b Fr(i)r Fn(:)16 b(N)10 b Ft(\))p Fn(M)0 2188 y Ft(A)23 b(useful)f(con)m(v)m(en)m(tion)i(is)e(to)i(write)31 b Fn(M)1312 2155 y Fm(n)1359 2188 y Fn(N)42 b Ft(for)23 b(the)g(term)32 b Fn(M)25 b Ft(\()p Fn(M)41 b(:)15 b(:)g(:)h Ft(\()p Fn(M)26 b(N)10 b Ft(\))15 b Fn(:)g(:)g(:)q Ft(\))32 b(constructed)23 b(b)m(y)h(applying)29 b Fn(M)0 2329 y Ft(to)37 b Fn(N)47 b Ft(a)28 b(total)h(of)37 b Fn(n)f Ft(times.)k(A)28 b(more)h(precise)e(de\014nition)f(is)i(that)37 b Fn(M)2415 2296 y Fp(0)2454 2329 y Fn(N)2563 2274 y Fj(def)2580 2329 y Ft(=)42 b Fn(N)47 b Ft(and)36 b Fn(M)3094 2296 y Fm(n)p Fp(+1)3231 2329 y Fn(N)3339 2274 y Fj(def)3356 2329 y Ft(=)43 b Fn(M)10 b Ft(\()p Fn(M)3701 2296 y Fm(n)3748 2329 y Fn(N)g Ft(\))e(.)0 2569 y Fk(Examples)0 2741 y Ft(Bo)s(olean)31 b(and)f(natural-n)m(um)m(b)s(er)e(expressions.)682 2937 y Fl(if)47 b Fs(Eq)8 b Ft(?)14 b(\(4)21 b(+)f(5\))15 b(9)50 b Fl(then)c Ft(27)j Fl(else)d Ft(42)682 3105 y Fl(if)h Ft(\()p Fl(if)g Fs(Eq)8 b Ft(?)15 b(\(4)21 b(+)f(5\))15 b(9)49 b Fl(then)e Fs(false)55 b Fl(else)46 b Fs(true)7 b Ft(\))49 b Fl(then)d Ft(42)j Fl(else)d Ft(27)682 3273 y(\()p Fl(if)h Fs(Eq)8 b Ft(?)15 b(\()p Fn(x)20 b Ft(+)g Fn(y)s Ft(\))15 b Fn(z)53 b Fl(then)61 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)16 b(x)k Ft(+)g(5)48 b Fl(else)62 b Fn(\025y)s Ft(:)15 b Fs(nat)9 b Fn(:)16 b(y)23 b Ft(+)d(7\))833 3385 y(\()p Fl(if)48 b Fs(Eq)8 b Ft(?)14 b(\()p Fn(x)21 b Ft(+)f Fn(y)s Ft(\))15 b Fn(z)52 b Fl(then)47 b Ft(7)h Fl(else)f Ft(5\))0 3582 y(Lam)m(b)s(da)30 b(abstraction)g(and)g (application.)950 3778 y Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)950 3946 y(\025x)p Ft(:)g Fs(nat)10 b Fn(:)15 b(x)20 b Ft(+)g(1)950 4114 y(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)21 b Ft(+)f(1\)\(\()p Fn(\025y)s Ft(:)15 b Fs(nat)c Fn(:)k Ft(5)21 b(+)f Fn(y)s Ft(\))15 b(3\))950 4282 y(\()p Fn(\025f)10 b Ft(:)15 b Fs(nat)1285 4276 y Fr(!)1391 4282 y Fs(nat)9 b Fn(:)15 b(\025x)p Ft(:)g Fs(nat)10 b Fn(:)16 b(f)10 b Ft(\()p Fn(f)g Ft(\()p Fn(f)g(x)p Ft(\)\)\))15 b(\()p Fn(\025y)s Ft(:)g Fs(nat)9 b Fn(:)16 b Ft(5)k(+)g Fn(y)s Ft(\))15 b(3)p eop %%Page: 68 19 68 18 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(68)0 91 y(P)m(airing)29 b(and)h(functions.)115 288 y Fn(\025x)p Ft(:)15 b Fs(nat)25 b Fr(\002)15 b Fs(nat)9 b Fn(:)q Fr(h)p Fk(Pro)d(j)900 310 y Fp(1)954 288 y Fn(x)20 b Ft(+)g(1)p Fn(;)15 b Fk(Pro)6 b(j)1408 310 y Fp(2)1462 288 y Fn(x)20 b Ft(+)g(1)p Fr(i)329 b Ft(:)119 b(\()p Fs(nat)25 b Fr(\002)15 b Fs(nat)10 b Ft(\))2638 282 y Fr(!)2729 288 y Ft(\()p Fs(nat)25 b Fr(\002)15 b Fs(nat)9 b Ft(\))115 455 y Fn(\025x)p Ft(:)15 b Fn(\033)k Fr(\002)c Fn(\034)10 b(:)p Fr(h)p Fk(Pro)c(j)732 478 y Fp(2)787 455 y Fn(x;)15 b Fk(Pro)6 b(j)1084 478 y Fp(1)1138 455 y Fn(x)p Fr(i)809 b Ft(:)119 b(\()p Fn(\033)19 b Fr(\002)c Fn(\034)10 b Ft(\))2470 449 y Fr(!)2561 455 y Ft(\()p Fn(\034)26 b Fr(\002)15 b Fn(\033)s Ft(\))115 623 y Fn(\025x)p Ft(:)g Fs(nat)25 b Fr(\002)15 b Fs(nat)9 b Fn(:)267 736 y Fl(if)47 b Fs(Eq)8 b Ft(?)15 b(\()p Fk(Pro)6 b(j)819 758 y Fp(1)874 736 y Fn(x)p Ft(\))15 b(0)49 b Fl(then)d Fk(Pro)6 b(j)1513 758 y Fp(2)1567 736 y Fn(x)48 b Fl(else)f Ft(0)83 b(:)119 b Fs(nat)25 b Fr(\002)15 b Fs(nat)2567 730 y Fr(!)2673 736 y Fs(nat)115 904 y Fn(\025f)10 b Ft(:)15 b Fs(nat)415 898 y Fr(!)521 904 y Fs(nat)9 b Fn(:)15 b(\025g)s Ft(:)g Fs(nat)989 898 y Fr(!)1095 904 y Fs(nat)10 b Fn(:)15 b(\025x)p Ft(:)g Fs(nat)10 b Fn(:)15 b(f)10 b Ft(\()p Fn(g)19 b(x)p Ft(\))201 b(is)82 b(comp)s(osition)30 b(of)g(n)m(umeric)f(functions)115 1071 y Fn(\025f)10 b Ft(:)15 b Fs(nat)415 1065 y Fr(!)521 1071 y Fs(nat)9 b Fn(:)15 b(\025g)s Ft(:)g Fs(nat)989 1065 y Fr(!)1095 1071 y Fs(nat)10 b Fn(:)15 b(\025x)p Ft(:)g Fs(nat)10 b Fn(:)267 1184 y Fl(if)47 b Fs(Eq)8 b Ft(?)15 b(\()p Fn(f)24 b(x)p Ft(\))15 b(0)49 b Fl(then)e Fn(g)18 b(x)48 b Fl(else)f Ft(0)470 b(:)119 b(\()p Fs(nat)2365 1178 y Fr(!)2471 1184 y Fs(nat)10 b Ft(\))2658 1178 y Fr(!)2749 1184 y Ft(\()p Fs(nat)2936 1178 y Fr(!)3042 1184 y Fs(nat)g Ft(\))3229 1178 y Fr(!)3320 1184 y Ft(\()p Fs(nat)3507 1178 y Fr(!)3613 1184 y Fs(nat)f Ft(\))115 1352 y Fn(\025f)h Ft(:)15 b(\()p Fs(nat)25 b Fr(\002)15 b Fs(nat)9 b Ft(\))722 1346 y Fr(!)829 1352 y Fs(nat)g Fn(:)16 b(\025x)p Ft(:)f Fs(nat)9 b Fn(:)16 b(\025y)s Ft(:)f Fs(nat)9 b Fn(:)16 b(f)10 b Fr(h)p Fn(x;)15 b(y)s Fr(i)123 b Ft(is)82 b(Curry)29 b(for)h(n)m(umeric)f(functions)0 1549 y(Declarations)i(and)f (recursion.)822 1727 y Fl(let)f Fs(c)-5 b(omp)8 b Ft(:)15 b(\()p Fn(\034)1346 1721 y Fr(!)1453 1727 y Fn(\032)p Ft(\))1550 1721 y Fr(!)1641 1727 y Ft(\()p Fn(\033)1747 1721 y Fr(!)1853 1727 y Fn(\034)10 b Ft(\))1953 1721 y Fr(!)2044 1727 y Ft(\()p Fn(\033)2150 1721 y Fr(!)2256 1727 y Fn(\032)p Ft(\))973 1840 y(=)25 b Fn(\025f)10 b Ft(:)15 b Fn(\034)1282 1834 y Fr(!)1388 1840 y Fn(\032:)h(\025g)s Ft(:)f Fn(\033)1686 1834 y Fr(!)1792 1840 y Fn(\034)10 b(:)16 b(\025x)p Ft(:)f Fn(\033)s(:)h(f)10 b Ft(\()p Fn(g)18 b(x)p Ft(\))973 1953 y Fl(in)30 b Fs(c)-5 b(omp)22 b Fn(f)j(g)822 2121 y Fl(let)k Fs(add)11 b Ft(:)k(\()p Fs(nat)25 b Fr(\002)15 b Fs(nat)10 b Ft(\))1644 2115 y Fr(!)1750 2121 y Fs(nat)973 2234 y Ft(=)25 b Fn(\025x)p Ft(:)15 b Fs(nat)25 b Fr(\002)15 b Fs(nat)10 b Fn(:)p Ft(\()p Fk(Pro)c(j)1854 2256 y Fp(1)1908 2234 y Fn(x)p Ft(\))21 b(+)f(\()p Fk(Pro)6 b(j)2347 2256 y Fp(2)2401 2234 y Fn(x)p Ft(\))973 2347 y Fl(in)30 b(let)g Fs(curry)8 b Ft(:)15 b(\(\()p Fs(nat)26 b Fr(\002)15 b Fs(nat)9 b Ft(\))2027 2341 y Fr(!)2134 2347 y Fs(nat)g Ft(\))2320 2341 y Fr(!)2427 2347 y Fs(nat)2578 2341 y Fr(!)2684 2347 y Fs(nat)2836 2341 y Fr(!)2942 2347 y Fs(nat)1125 2460 y Ft(=)25 b Fn(\025f)10 b Ft(:)15 b(\()p Fs(nat)24 b Fr(\002)15 b Fs(nat)10 b Ft(\))1828 2454 y Fr(!)1934 2460 y Fs(nat)g Fn(:)15 b(\025x)p Ft(:)g Fs(nat)10 b Fn(:)15 b(\025y)s Ft(:)g Fs(nat)10 b Fn(:)15 b(f)10 b Fr(h)p Fn(x;)15 b(y)s Fr(i)1125 2572 y Fl(in)60 b Fs(curry)24 b(add)h Ft(5)15 b(7)141 2769 y(Assuming)33 b(w)m(e)j(ha)m(v)m(e)g(a)g (predecessor)f(function)e Fs(pr)-5 b(e)g(d)46 b Ft(whic)m(h)34 b(maps)h(eac)m(h)44 b Fn(n)33 b(>)g Ft(0)43 b(to)h Fn(n)23 b Fr(\000)g Ft(1)44 b(and)34 b(zero)i(to)0 2882 y(zero,)d(w)m(e)g(can)f (write)g(m)m(ultiplication)d(as)j(follo)m(ws.)45 b(A)32 b(de\014nition)d(of)k Fs(pr)-5 b(e)g(d)43 b Ft(is)31 b(giv)m(en)h(in)f(Section)h(2.5.2,)i(using)d(a)0 2995 y(general)f(metho)s(d)g(describ)s(ed)e(there.)289 3191 y Fl(letrec)h Fs(mult)9 b Ft(:)15 b(\()p Fs(nat)25 b Fr(\002)15 b Fs(nat)9 b Ft(\))1290 3185 y Fr(!)1397 3191 y Fs(nat)441 3304 y Ft(=)25 b Fn(\025p)p Ft(:)15 b Fs(nat)24 b Fr(\002)15 b Fs(nat)9 b Fn(:)592 3417 y Fl(if)47 b Fs(Eq)8 b Ft(?)15 b(\()p Fk(Pro)6 b(j)1145 3440 y Fp(1)1199 3417 y Fn(p)p Ft(\))15 b(0)49 b Fl(then)d Ft(0)j Fl(else)d Ft(\()p Fk(Pro)6 b(j)2199 3440 y Fp(2)2254 3417 y Fn(p)p Ft(\))20 b(+)g Fs(mult)9 b Fr(h)p Fs(pr)-5 b(e)g(d)27 b Ft(\()p Fk(Pro)6 b(j)3095 3440 y Fp(1)3149 3417 y Fn(p)p Ft(\))p Fn(;)15 b Fk(Pro)6 b(j)3475 3440 y Fp(2)3530 3417 y Fn(p)p Fr(i)441 3530 y Fl(in)29 b Fs(mult)9 b Fr(h)p Ft(6)p Fn(;)15 b Ft(7)p Fr(i)0 3727 y Ft(W)-8 b(e)32 b(ma)m(y)f(rewrite)e(this)g(last)i(example)f(using)f(more)h(syn) m(tactic)h(sugar)g(to)g(mak)m(e)g(it)f(clearer:)374 3923 y Fl(letrec)f Fs(mult)9 b Fr(h)p Fn(x)p Ft(:)15 b Fs(nat)10 b Fn(;)15 b(y)s Ft(:)g Fs(nat)10 b Fr(i)p Ft(:)15 b Fs(nat)36 b Ft(=)25 b Fl(if)47 b Fs(Eq)8 b Ft(?)15 b Fn(x)g Ft(0)48 b Fl(then)e Ft(0)j Fl(else)d Fn(y)23 b Ft(+)d Fs(mult)9 b Fr(h)p Fs(pr)-5 b(e)g(d)27 b Fn(x;)15 b(y)s Fr(i)526 4036 y Fl(in)30 b Fs(mult)9 b Fr(h)p Ft(6)p Fn(;)15 b Ft(7)p Fr(i)0 4233 y Ft(F)-8 b(or)31 b(further)e(examples,)h(see)h (Section)g(2.5)g(and)f(the)g(exercises.)p eop %%Page: 69 20 69 19 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(69)0 91 y Fu(2.3)135 b(PCF)45 b(Programs)g(and)g (Their)g(Seman)l(tics)0 298 y Fo(2.3.1)112 b(Programs)37 b(and)h(results)0 469 y Ft(No)m(w)27 b(that)g(w)m(e)g(ha)m(v)m(e)h (seen)f(all)e(of)i(the)g(constructs)g(of)f(PCF,)h(w)m(e)g(will)d(tak)m (e)k(a)f(step)g(bac)m(k)g(and)f(discuss)f(the)i(mean-)0 582 y(ing,)k(or)h Fs(semantics,)h Ft(of)e(PCF)h(in)e(a)i(general)g(w)m (a)m(y)g(that)g(is)f(in)m(tended)g(to)h(apply)e(to)i(a)g(v)-5 b(ariet)m(y)32 b(of)g(programming)0 695 y(languages.)53 b(This)32 b(should)g(put)i(the)g(equational)g(axioms)g(and)f(reduction) g(rules)g(that)i(w)m(ere)g(presen)m(ted)f(along)0 808 y(with)24 b(the)i(syn)m(tax)g(of)f(PCF)g(in)f(p)s(ersp)s(ectiv)m(e.)39 b(The)24 b(three)i(forms)f(of)g(seman)m(tics)h(w)m(e)g(will)d(consider) h(are)i(axiomatic)0 921 y(seman)m(tics,)i(giv)m(en)e(b)m(y)h(a)g(pro)s (of)e(system,)j(op)s(erational)e(seman)m(tics)g(arising)f(from)h(a)h (set)g(of)g(reduction)e(rules,)i(and)0 1034 y(denotational)h(seman)m (tics)g(\(with)g(details)f(put)g(o\013)i(to)g(Chapter)e(4\).)41 b(Eac)m(h)29 b(form)f(of)g(seman)m(tics)g(has)g(adv)-5 b(an)m(tages)0 1147 y(and)31 b(disadv)-5 b(an)m(tages)32 b(for)f(understanding)e(prop)s(erties)h(of)h(programs.)44 b(In)31 b(addition,)f(there)i(are)g(standard)e(con-)0 1260 y(nections)25 b(b)s(et)m(w)m(een)i(the)f(three)g(forms)f(of)h (seman)m(tics)g(that)h(should)c(hold)i(for)g(an)m(y)i(programming)d (language.)40 b(W)-8 b(e)0 1372 y(discuss)28 b(a)h(few)g(syn)m(tactic)i (distinctions)26 b(in)j(this)f(brief)g(subsection)g(b)s(efore)h (stating)g(the)h(connections)f(precisely)0 1485 y(in)g(the)i(next)f (three)h(subsections.)141 1598 y(Most)38 b(programming)e(languages)h (ha)m(v)m(e)h(sev)m(eral)g(di\013eren)m(t)e(syn)m(tactic)i(categories,) i(or)d(\\kinds)f(of)h(expres-)0 1711 y(sions.")50 b(These)33 b(ma)m(y)h(include)e(expressions)g(as)i(used)f(in)f(assignmen)m(ts)h (or)h(function)e(calls,)i(imp)s(erativ)m(e)e(state-)0 1824 y(men)m(ts,)e(declarations)e(or)h(mo)s(dules.)38 b(Ho)m(w)m(ev)m(er,)32 b(not)d(all)f(w)m(ell-formed)f(syn)m(tactic)j (en)m(tities)f(can)g(b)s(e)f(executed)i(or)0 1937 y(ev)-5 b(aluated)32 b(b)m(y)g(themselv)m(es.)47 b(Therefore,)32 b(in)f(an)m(y)h(programming)f(language,)i(w)m(e)g(distinguish)28 b Fs(pr)-5 b(o)g(gr)g(ams)43 b Ft(from)0 2050 y(other)36 b(syn)m(tactic)i(forms)d(that)i(ma)m(y)g(b)s(e)e(used)h(only)f(as)h (parts)g(of)h(programs.)57 b(The)36 b(t)m(w)m(o)i(c)m(haracteristics)e (that)0 2163 y(distinguish)25 b(a)k(program)f(from)g(an)h(arbitrary)e (syn)m(tactic)i(form)f(are)h(that)g(a)g(program)g(should)d(not)j(refer) f(to)i(an)m(y)0 2276 y(undeclared)e(or)h(un)m(b)s(ound)d(v)-5 b(ariables)28 b(and)g(a)i(program)e(should)f(ha)m(v)m(e)k(the)e (appropriate)f(t)m(yp)s(e)h(or)g(form)g(to)h(yield)0 2389 y(a)h(prin)m(table)d(v)-5 b(alue)30 b(or)h(observ)-5 b(able)29 b(e\013ect.)141 2502 y(In)i(PCF,)h(the)g(t)m(w)m(o)i(syn)m (tactic)f(categories)g(are)f(t)m(yp)s(es)g(and)g(terms)g(\(expressions) f(that)h(ha)m(v)m(e)h(t)m(yp)s(es\).)46 b(If)31 b(w)m(e)0 2614 y(think)i(of)i(giving)e(a)i(closed)g(natural)f(n)m(um)m(b)s(er)f (or)i(b)s(o)s(olean)e(term)i(to)g(an)g(in)m(terpreter,)g(then)g(w)m(e)g (could)e(exp)s(ect)0 2727 y(the)h(in)m(terpreter)g(to)h(prin)m(t)e(its) h(v)-5 b(alue.)51 b(Therefore,)35 b(w)m(e)g(consider)e(closed)h(b)s(o)s (olean)g(and)f(n)m(umeric)g(expressions)0 2840 y(programs.)53 b(But)35 b(if)e(w)m(e)i(giv)m(e)g(an)g(op)s(en)f(natural)f(n)m(um)m(b)s (er)g(term)i(suc)m(h)f(as)43 b Fn(x)23 b Ft(+)g(5)43 b(to)35 b(an)g(in)m(terpreter,)g(there)g(is)0 2953 y(no)i(correct)h(v) -5 b(alue)36 b(since)g(the)h(v)-5 b(alue)36 b(of)45 b Fn(x)g Ft(is)36 b(not)h(giv)m(en.)60 b(In)36 b(addition,)h(w)m(e)g (cannot)g(exp)s(ect)g(the)g(v)-5 b(alue)37 b(of)g(a)0 3066 y(function)24 b(expression)g(to)i(b)s(e)f(prin)m(ted)f(with)g(the) h(same)h(degree)g(of)f(accuracy)i(as)e(a)h(natural)e(n)m(um)m(b)s(er)g (or)i(b)s(o)s(olean.)0 3179 y(Although)33 b(an)h(in)m(terpreter)g (could)f(certainly)g(prin)m(t)g(bac)m(k)i(the)f(function)f(expression)g (w)m(e)h(giv)m(e)h(it,)g(or)f(p)s(erhaps)0 3292 y(prin)m(t)f(some)i (kind)d(of)j(\\optimized")f(co)s(de,)i(no)e(in)m(terpreter)g(can)g (prin)m(t)f(function)g(expressions)g(in)g(a)i(w)m(a)m(y)g(that)0 3405 y(w)m(ould)c(tell)g(us)h(exactly)g(whic)m(h)f(mathematical)i (function)d(is)i(de\014ned)e(b)m(y)i(the)h(function)d(expression)h(t)m (yp)s(ed)h(in.)0 3518 y(This)37 b(is)h(b)s(ecause)h(equalit)m(y)f(for)h (partial)e(recursiv)m(e)h(functions)g(is)g(undecidable)e(and,)k(as)g (pro)m(v)m(ed)f(in)e(Section)0 3631 y(2.5.5,)44 b(ev)m(ery)c(partial)e (recursiv)m(e)h(function)f(is)g(de\014nable)g(in)g(PCF.)i(F)-8 b(or)40 b(this)e(reason,)k(w)m(e)e(sa)m(y)g(that)g(natural)0 3744 y(n)m(um)m(b)s(er)29 b(and)h(b)s(o)s(olean)f(v)-5 b(alues)30 b(are)h Fs(observable,)g Ft(but)38 b Fs(nat)2054 3738 y Fr(!)2160 3744 y Fs(nat)48 b Ft(v)-5 b(alues)30 b(are)h(not.)141 3857 y(W)-8 b(e)23 b(giv)m(e)e(a)h(precise)f (de\014nition)e(of)i(PCF)h Fs(pr)-5 b(o)g(gr)g(am)31 b Ft(b)m(y)21 b(de\014ning)f(the)h(t)m(yp)s(es)h(of)f(observ)-5 b(able)21 b(v)-5 b(alues.)37 b(Although)0 3969 y(a)d(pair)f(of)h (observ)-5 b(able)33 b(v)-5 b(alues)33 b(could)f(b)s(e)i(considered)e (observ)-5 b(able,)34 b(since)f(an)h(in)m(terpreter)f(can)h(easily)f (prin)m(t)g(a)0 4082 y(pair)f(of)i(prin)m(table)e(v)-5 b(alues,)34 b(w)m(e)g(will)d(simplify)f(sev)m(eral)k(tec)m(hnical)g (argumen)m(ts)g(b)m(y)f(c)m(ho)s(osing)g(a)h(simpler)e(set)i(of)0 4195 y(observ)-5 b(able)40 b(t)m(yp)s(es.)71 b(This)39 b(will)e(not)k(ha)m(v)m(e)h(an)m(y)f(signi\014can)m(t)e(e\013ect)j(on)f (our)f(theory)-8 b(,)43 b(as)e(sho)m(wn)f(in)f(Exercise)0 4308 y(2.3.5.)k(W)-8 b(e)32 b(sa)m(y)39 b Fn(\034)49 b Ft(is)29 b(an)i Fs(observable)i(typ)-5 b(e)38 b Ft(if)g Fn(\034)49 b Ft(is)29 b(either)39 b Fs(nat)48 b Ft(or)39 b Fs(b)-5 b(o)g(ol)19 b Ft(.)41 b(A)31 b(PCF)f Fs(pr)-5 b(o)g(gr)g(am)40 b Ft(is)30 b(a)h(w)m(ell-formed,)0 4421 y(closed)j(term)f(of)h(observ)-5 b(able)33 b(t)m(yp)s(e.)51 b(One)34 b(p)s(oten)m(tially)e(confusing)h(asp)s(ect)h(of)g(this)e (de\014nition)g(is)h(that)h(it)f(do)s(es)0 4534 y(not)j(consider)e (input)g(or)i(output;)i(it)d(migh)m(t)g(b)s(e)g(more)h(accurate)h(to)f (call)f(these)h(\\programs)g(that)g(require)e(no)0 4647 y(additional)d(input)f(and)i(pro)s(duce)g(one)h(output.")47 b(The)32 b(reason)h(w)m(e)g(fo)s(cus)f(on)h(programs)f(whic)m(h)f (already)i(ha)m(v)m(e)0 4760 y(whatev)m(er)e(input)e(they)i(require)f (is)f(that)j(w)m(e)f(use)f(these)h(programs)g(to)g(compare)g (axiomatic,)h(op)s(erational)e(and)0 4873 y(denotational)k(seman)m (tics.)52 b(F)-8 b(or)35 b(this)e(purp)s(ose,)h(it)g(is)f(su\016cien)m (t)h(for)g(eac)m(h)h(program)f(to)h(yield)d(a)j(single)e(\\data)0 4986 y(p)s(oin)m(t")d(ab)s(out)g(the)g(seman)m(tics.)141 5099 y(Another)37 b(general)g(term)f(w)m(e)i(use)e(in)g(comparing)g (seman)m(tics)h(is)f Fs(r)-5 b(esult.)60 b Ft(In)m(tuitiv)m(ely)-8 b(,)37 b(a)h(result)d(is)h(an)h(ob-)0 5211 y(serv)-5 b(able)31 b(e\013ect)j(of)e(ev)-5 b(aluating)32 b(or)g(executing)g(a)h (program.)45 b(In)32 b(a)g(functional)f(setting,)i(this)e(generally)g (means)0 5324 y(a)36 b(term)f(giving)f(an)h(exp)s(ected)h(\014nal)e (result)g(of)h(program)g(ev)-5 b(aluation.)55 b(F)-8 b(or)36 b(PCF,)f(w)m(e)h(mak)m(e)g(this)e(precise)h(b)m(y)p eop %%Page: 70 21 70 20 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(70)0 91 y(sa)m(ying)34 b(that)i(a)f Fs(r)-5 b(esult)44 b Ft(is)33 b(a)i(closed)f(normal)g(form)g(of)h (observ)-5 b(able)34 b(t)m(yp)s(e.)53 b(In)34 b(other)h(w)m(ords,)g (the)g(PCF)f(results)0 204 y(are)d(the)f(n)m(umerals,)38 b(0)p Fn(;)15 b Ft(1)p Fn(;)g Ft(2)p Fn(;)g(:)g(:)g(:)42 b Ft(and)30 b(b)s(o)s(olean)f(constan)m(ts)40 b Fs(true)46 b Ft(and)38 b Fs(false)16 b Ft(.)141 317 y(With)31 b(this)f (terminology)-8 b(,)31 b(w)m(e)h(can)f(giv)m(e)h(a)f(general)g (de\014nition)e(of)i(seman)m(tics,)h(at)g(least)f(for)g(programming)0 430 y(languages:)41 b(a)31 b Fs(semantics)j(of)f(pr)-5 b(o)g(gr)g(ams)41 b Ft(is)30 b(a)h(relation)e(b)s(et)m(w)m(een)j (programs)e(and)g(results.)40 b(This)28 b(is)i(a)h(minimal)0 543 y(condition;)45 b(all)39 b(of)i(the)g(seman)m(tics)g(w)m(e)g (consider)f(giv)m(e)h(more)g(information)e(than)h(the)h(result)f(of)g (ev)-5 b(aluating)0 656 y(eac)m(h)31 b(program.)41 b(T)m(ypically)-8 b(,)28 b(axiomatic)j(and)e(denotational)h(seman)m(tics)g(giv)m(e)h (more)f(useful)e(information)g(than)0 769 y(op)s(erational)34 b(seman)m(tics)i(when)e(it)h(comes)h(to)g(expressions)e(that)i(ma)m(y)g (o)s(ccur)f(in)f(programs)h(but)g(are)h(not)f(full)0 882 y(programs)30 b(themselv)m(es.)0 1125 y Fo(2.3.2)112 b(Axiomatic)35 b(seman)m(tics)0 1297 y Ft(In)c(general,)h(an)f (axiomatic)h(seman)m(tics)f(consists)g(of)h(a)g(pro)s(of)e(system)i (for)f(deducing)f(prop)s(erties)g(of)h(programs)0 1410 y(and)c(their)g(parts.)40 b(These)28 b(prop)s(erties)e(ma)m(y)j(b)s(e)e (equations,)h(as)g(in)f(the)h(PCF)g(pro)s(of)f(system)h(\(review)m(ed)g (b)s(elo)m(w\),)0 1523 y(assertions)42 b(ab)s(out)g(the)g(output)g(of)g (programs,)j(giv)m(en)d(certain)g(inputs,)i(or)e(other)g(prop)s (erties.)75 b(Since)41 b(it)h(is)0 1635 y(di\016cult)22 b(to)i(discuss)e(all)h(forms)g(of)h(axiomatic)h(seman)m(tics)f(in)e (general,)k(w)m(e)e(will)d(fo)s(cus)i(on)h(equational)g(axiomatic)0 1748 y(seman)m(tics.)50 b(W)-8 b(e)35 b(ma)m(y)e(apply)f(this)h (discussion)e(to)j(axiomatic)f(seman)m(tics)h(that)g(address)e(other)i (prop)s(erties)e(of)0 1861 y(programs)e(b)m(y)g(sa)m(ying)g(that)h(t)m (w)m(o)h(programs)e(are)h(equiv)-5 b(alen)m(t)30 b(in)f(an)h(axiomatic) g(seman)m(tics)h(whenev)m(er)f(exactly)0 1974 y(the)h(same)f (assertions)g(are)h(deriv)-5 b(able)29 b(ab)s(out)h(eac)m(h)h(of)g (them.)141 2087 y(There)h(are)g(three)g(general)g(prop)s(erties)f(of)h (axiomatic)g(seman)m(tics)g(that)h(hold)e(for)g(PCF.)i(The)e(\014rst)g (is)g(that)0 2200 y(the)23 b(axiomatic)g(seman)m(tics)f(de\014nes)g (program)g(b)s(eha)m(vior)g(in)f(some)i(w)m(a)m(y)-8 b(.)40 b(The)22 b(other)h(t)m(w)m(o)h(are)f(relations)e(b)s(et)m(w)m (een)0 2313 y(the)31 b(axiomatic)f(and)g(op)s(erational)g(or)g (denotational)g(seman)m(tics.)136 2501 y Fr(\017)46 b Ft(The)32 b(axiomatic)h(seman)m(tics)g(determine)f(the)h(result)f(\(or) h(output)f(or)g(observ)-5 b(able)32 b(e\013ect,)j(in)d(general\))h(of) 227 2613 y(an)m(y)e(program)f(that)h(has)f(one.)136 2801 y Fr(\017)46 b Ft(When)36 b(t)m(w)m(o)h(expressions)d(are)j(equiv)-5 b(alen)m(t,)36 b(according)g(to)h(the)f(axiomatic)g(seman)m(tics,)i(w)m (e)e(ma)m(y)g(safely)227 2914 y(substitute)f(one)g(for)h(the)f(other)h (in)e(an)m(y)i(program)f(without)f(c)m(hanging)i(the)f(op)s(erational)g (seman)m(tics)h(of)227 3027 y(that)h(program.)57 b(This)35 b(could)g(b)s(e)g(called)g(\\soundness)g(of)i(the)f(axiomatic)g(seman)m (tics)g(with)f(resp)s(ect)h(to)227 3140 y(the)31 b(op)s(erational)e (seman)m(tics.")136 3327 y Fr(\017)46 b Ft(The)24 b(axiomatic)h(seman)m (tics)g(are)h(sound)d(with)g(resp)s(ect)i(to)h(the)e(denotational)h (seman)m(tics.)39 b(Sp)s(eci\014cally)-8 b(,)24 b(if)227 3440 y(w)m(e)29 b(can)g(pro)m(v)m(e)g(an)m(y)f(pair)f(of)i(PCF)f(terms) g(equal,)h(then)f(these)g(terms)h(m)m(ust)f(ha)m(v)m(e)h(the)g(same)g (denotation,)227 3553 y(regardless)h(of)h(whic)m(h)e(v)-5 b(alues)29 b(w)m(e)i(giv)m(e)g(to)g(their)f(free)g(v)-5 b(ariables.)0 3741 y(The)34 b(PCF)h(axiomatic)g(seman)m(tics)g (satis\014es)f(the)h(\014rst)f(requiremen)m(t)f(since,)j(for)e(an)m(y)h (full)e(program)h(that)h(ter-)0 3854 y(minates)c(according)g(to)h(the)f (op)s(erational)f(seman)m(tics,)i(w)m(e)g(ma)m(y)f(pro)m(v)m(e)h(that)g (this)e(expression)g(is)g(equal)h(to)h(the)0 3967 y(appropriate)26 b(n)m(umeral)g(\()8 b(0)p Fn(;)15 b Ft(1)p Fn(;)g Ft(2)p Fn(;)g(:)g(:)g(:)e Ft(\))27 b(or)g(b)s(o)s(olean)f(constan)m(t)i(\()8 b Fs(true)43 b Ft(or)36 b Fs(false)15 b Ft(\).)40 b(This)26 b(is)g(a)h(simple)e(consequence)0 4080 y(of)h(the)g(fact)h(that)f(the)g (PCF)g(reduction)f(axioms)g(are)i(a)f(subset)f(of)h(the)g(equational)g (axioms.)39 b(It)26 b(follo)m(ws)f(from)g(ei-)0 4193 y(ther)i(of)g(the)g(last)g(t)m(w)m(o)h(conditions)e(that,)i(unless)e (the)h(op)s(erational)f(or)h(denotational)g(seman)m(tics)g(is)f (degenerate,)0 4305 y(the)31 b(axiomatic)f(seman)m(tics)h(do)s(es)f (not)h(equate)g(all)e(expressions)g(of)i(eac)m(h)g(t)m(yp)s(e.)141 4418 y(The)j(axiomatic)i(seman)m(tics)f(of)g(PCF)f(is)g(giv)m(en)h(b)m (y)g(the)g(pro)s(of)f(system)h(whose)g(axioms)f(are)h(describ)s(ed)e (in)0 4531 y(Sections)22 b(2.2.2)i(through)d(2.2.5)j(and)e(listed)e (again)j(in)d(T)-8 b(able)22 b(2.1.)39 b(These)22 b(axioms)g(are)h(com) m(bined)e(with)g(inference)0 4644 y(rules)j(that)i(mak)m(e)h(pro)m(v)-5 b(able)25 b(equalit)m(y)g(a)h(congruence,)i(also)d(included)e(in)h(T)-8 b(able)26 b(2.1.)40 b Fs(Congruenc)-5 b(e)33 b Ft(means)25 b(that)0 4757 y(pro)m(v)-5 b(able)27 b(equalit)m(y)g(is)g(an)g(equiv)-5 b(alence)27 b(relation)g(\(re\015exiv)m(e,)i(symmetric)e(and)g (transitiv)m(e\),)h(and)f(that)h(equalit)m(y)0 4870 y(is)h(preserv)m (ed)i(if)e(w)m(e)i(replace)f(an)m(y)h(sub)s(expression)d(b)m(y)i(an)g (equiv)-5 b(alen)m(t)30 b(one.)41 b(W)-8 b(e)32 b(do)e(not)h(need)f(a)h (pro)s(of)f(system)0 4983 y(for)g(t)m(yp)s(es,)h(since)f(t)m(w)m(o)h(t) m(yp)s(es)g(are)f(equal)g(i\013)g(they)g(are)h(syn)m(tactically)f(iden) m(tical.)141 5096 y(All)25 b(of)i(the)g(congruence)g(rules)e(in)g(T)-8 b(able)27 b(2.1,)h(except)g(the)f(t)m(w)m(o)g(concerned)g(with)e(lam)m (b)s(da)h(abstraction)h(and)0 5209 y(application)j(\(the)h(t)m(w)m(o)i (at)f(the)f(b)s(ottom)h(of)f(the)h(table\))f(are)h(in)e(fact)i (redundan)m(t.)42 b(The)30 b(reason)i(is)e(that)i(w)m(e)g(can)0 5322 y(use)h(lam)m(b)s(da)g(abstraction)h(and)f(application)f(to)j(ac)m (hiev)m(e)g(the)f(same)g(e\013ect.)52 b(F)-8 b(or)35 b(example,)f(supp)s(ose)e(w)m(e)j(can)p eop %%Page: 71 22 71 21 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(71)50 550 y Fk(Axioms)50 741 y Ft(Equalit)m(y)50 854 y(\()p Fs(r)-5 b(ef)20 b Ft(\))620 b(M)30 b(=)g(M)50 1045 y Fs(nat)40 b Ft(and)29 b Fs(b)-5 b(o)g(ol)50 1158 y Ft(\()p Fs(add)9 b Ft(\))596 b(0)20 b(+)g(0)26 b(=)f(0,)31 b(0)20 b(+)g(1)26 b(=)f(1,)31 b(.)15 b(.)h(.)f(,)31 b(3)20 b(+)g(5)26 b(=)f(8,)31 b(.)15 b(.)h(.)50 1271 y(\()p Fs(Eq)8 b Ft(?\))588 b Fs(Eq)8 b Ft(?)14 b Fn(n)h(n)25 b Ft(=)g Fs(true)7 b Ft(,)30 b Fs(Eq)8 b Ft(?)15 b Fn(n)g(m)25 b Ft(=)f Fs(false)38 b Ft(\()p Fn(n;)15 b(m)31 b Ft(distinct)d(n)m (umerals\))50 1384 y(\()p Fs(c)-5 b(ond)9 b Ft(\))554 b Fl(if)47 b Fs(true)54 b Fl(then)47 b Fn(M)58 b Fl(else)46 b Fn(N)36 b Ft(=)25 b Fn(M)10 b Ft(,)30 b Fl(if)47 b Fs(false)56 b Fl(then)46 b Fn(M)58 b Fl(else)47 b Fn(N)35 b Ft(=)25 b Fn(N)50 1575 y Ft(P)m(airs)30 b(\()p Fn(\033)18 b Fr(\002)d Fn(\034)10 b Ft(\))50 1688 y(\()p Fs(pr)-5 b(oj)13 b Ft(\))626 b Fk(Pro)6 b(j)1117 1710 y Fp(1)1156 1688 y Fr(h)p Fn(M)f(;)15 b(N)10 b Fr(i)27 b Ft(=)e Fn(M)109 b Fk(Pro)6 b(j)1967 1710 y Fp(2)2006 1688 y Fr(h)p Fn(M)f(;)15 b(N)10 b Fr(i)27 b Ft(=)e Fn(N)50 1801 y Ft(\()p Fs(sp)6 b Ft(\))654 b Fr(h)p Fk(Pro)6 b(j)1102 1823 y Fp(1)1142 1801 y Fn(P)s(;)15 b Fk(Pro)6 b(j)1448 1823 y Fp(2)1487 1801 y Fn(P)13 b Fr(i)26 b Ft(=)f Fn(P)50 1992 y Ft(Binding)50 2105 y(\()p Fn(\013)p Ft(\))685 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)36 b Ft(=)25 b Fn(\025y)s Ft(:)15 b Fn(\033)n(:)p Ft([)p Fn(y)s(=x)p Ft(])p Fn(M)10 b Ft(,)32 b(pro)m(vided)d Fn(y)k Ft(not)d(free)h(in)e Fn(M)10 b Ft(.)50 2296 y(F)-8 b(unctions)30 b(\()p Fn(\033)571 2290 y Fr(!)677 2296 y Fn(\034)10 b Ft(\))50 2409 y(\()p Fn(\014)5 b Ft(\))687 b(\()p Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)10 b Ft(\))p Fn(N)36 b Ft(=)25 b([)p Fn(N)r(=x)p Ft(])p Fn(M)50 2522 y Ft(\()p Fn(\021)s Ft(\))695 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)10 b(x)26 b Ft(=)f Fn(M)10 b Ft(,)30 b(pro)m(vided)f Fn(x)h Ft(not)h(free)g(in)e Fn(M)50 2713 y Ft(Recursion)50 2826 y(\()p Fs(\014x)11 b Ft(\))639 b Fs(\014x)967 2848 y Fm(\033)1039 2826 y Ft(=)25 b Fn(\025f)10 b Ft(:)15 b Fn(\033)1353 2820 y Fr(!)1459 2826 y Fn(\033)n(:f)10 b Ft(\()p Fs(\014x)1728 2848 y Fm(\033)1790 2826 y Fn(f)g Ft(\))50 3017 y Fk(Inference)35 b(Rules)50 3208 y Fs(Equivalenc)-5 b(e)50 3383 y Ft(\()p Fs(sym)7 b Ft(\),)32 b(\()p Fs(tr)-5 b(ans)7 b Ft(\))922 3321 y Fn(M)36 b Ft(=)25 b Fn(N)p 922 3362 303 4 v 922 3444 a(N)35 b Ft(=)25 b Fn(M)1526 3321 y(M)35 b Ft(=)25 b Fn(N)5 b(;)15 b(N)36 b Ft(=)25 b Fn(P)p 1526 3362 613 4 v 1687 3444 a(M)36 b Ft(=)24 b Fn(P)50 3574 y Fs(Congruenc)-5 b(e)50 3827 y(nat)40 b Ft(and)29 b Fs(b)-5 b(o)g(ol)955 3765 y Fn(M)35 b Ft(=)25 b Fn(N)5 b(;)15 b(P)39 b Ft(=)25 b Fn(Q)p 922 3806 668 4 v 922 3888 a(M)31 b Ft(+)20 b Fn(P)38 b Ft(=)25 b Fn(N)30 b Ft(+)20 b Fn(Q)1997 3765 y(M)36 b Ft(=)25 b Fn(N)5 b(;)15 b(P)38 b Ft(=)25 b Fn(Q)p 1891 3806 815 4 v 1891 3888 a Fs(Eq)8 b Ft(?)15 b Fn(M)25 b(P)38 b Ft(=)25 b Fs(Eq)8 b Ft(?)15 b Fn(N)25 b(Q)1427 4018 y(M)1515 4032 y Fp(1)1580 4018 y Ft(=)g Fn(M)1764 4032 y Fp(2)1803 4018 y Fn(;)15 b(N)1916 4032 y Fp(1)1981 4018 y Ft(=)25 b Fn(N)2150 4032 y Fp(2)2190 4018 y Fn(;)15 b(P)2288 4032 y Fp(1)2353 4018 y Ft(=)25 b Fn(P)2507 4032 y Fp(2)p 872 4059 2229 4 v 872 4141 a Fl(if)48 b Fn(M)1104 4155 y Fp(1)1191 4141 y Fl(then)f Fn(N)1503 4155 y Fp(1)1590 4141 y Fl(else)f Fn(P)1886 4155 y Fp(1)1952 4141 y Ft(=)24 b Fl(if)48 b Fn(M)2279 4155 y Fp(2)2366 4141 y Fl(then)f Fn(N)2678 4155 y Fp(2)2765 4141 y Fl(else)g Fn(P)3062 4155 y Fp(2)50 4332 y Ft(P)m(airs)1155 4271 y Fn(M)35 b Ft(=)25 b Fn(N)p 922 4311 768 4 v 922 4394 a Fk(Pro)6 b(j)1127 4416 y Fm(i)1155 4394 y Fn(M)35 b Ft(=)25 b Fk(Pro)6 b(j)1579 4416 y Fm(i)1607 4394 y Fn(N)2019 4271 y(M)36 b Ft(=)24 b Fn(N)5 b(;)15 b(P)39 b Ft(=)25 b Fn(Q)p 1991 4311 658 4 v 1991 4394 a Fr(h)p Fn(M)5 b(;)15 b(P)e Fr(i)27 b Ft(=)e Fr(h)p Fn(N)5 b(;)15 b(Q)p Fr(i)50 4585 y Ft(F)-8 b(unctions)1158 4524 y Fn(M)36 b Ft(=)25 b Fn(N)p 922 4564 775 4 v 922 4646 a(\025x)p Ft(:)15 b Fn(\033)n(:)g(M)37 b Ft(=)25 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:)g(N) 1998 4524 y(M)35 b Ft(=)25 b Fn(N)5 b(;)15 b(P)39 b Ft(=)25 b Fn(Q)p 1998 4564 602 4 v 2076 4646 a(M)10 b(P)38 b Ft(=)25 b Fn(N)10 b(Q)1070 4852 y Ft(T)-8 b(able)30 b(2.1:)42 b(Equational)29 b(pro)s(of)h(system)g(for)g(PCF)p eop %%Page: 72 23 72 22 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(72)0 91 y(pro)m(v)m(e)38 b Fn(M)d Ft(=)25 b Fn(N)47 b Ft(and)37 b Fn(P)h Ft(=)25 b Fn(Q)8 b Ft(,)30 b(for)e(four)h(natural-n)m(um)m(b)s(er)e(expressions)35 b Fn(M)19 b Ft(,)38 b Fn(N)18 b Ft(,)37 b Fn(P)22 b Ft(,)29 b(and)37 b Fn(Q)8 b Ft(.)40 b(W)-8 b(e)30 b(can)f(deriv)m(e)0 204 y Fn(M)h Ft(+)20 b Fn(P)38 b Ft(=)25 b Fn(N)31 b Ft(+)19 b Fn(Q)39 b Ft(as)31 b(follo)m(ws.)39 b(By)31 b(the)g(re\015exivit)m(y)e(axiom,)i(w)m(e)f(ha)m(v)m(e)i(the)f (equation)1042 408 y Fn(\025x)p Ft(:)15 b Fs(nat)9 b Fn(:\025y)s Ft(:)15 b Fn(nat:)g(x)21 b Ft(+)f Fn(y)28 b Ft(=)d Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:\025y)s Ft(:)15 b Fn(nat:)g(x)20 b Ft(+)g Fn(y)s(:)0 613 y Ft(Therefore,)30 b(b)m(y)h(the)f(congruence)h(rule)e(for)h(application,)f(w)m(e)i(can)g (pro)m(v)m(e)868 817 y(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:\025y)s Ft(:)15 b Fn(nat:)g(x)21 b Ft(+)e Fn(y)s Ft(\))c Fn(M)36 b Ft(=)25 b(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:\025y)s Ft(:)15 b Fn(nat:)g(x)21 b Ft(+)f Fn(y)s Ft(\))15 b Fn(N)5 b(:)0 1021 y Ft(Then,)30 b(b)m(y)g(axiom)g(sc) m(heme)40 b(\()p Fn(\014)5 b Ft(\))39 b(and)30 b(transitivit)m(y)-8 b(,)1310 1225 y Fn(\025y)s Ft(:)15 b Fn(nat:)g(M)31 b Ft(+)20 b Fn(y)28 b Ft(=)d Fn(\025y)s Ft(:)15 b Fn(nat:)g(N)30 b Ft(+)20 b Fn(y)s(:)0 1430 y Ft(Rep)s(eating)32 b(application,)39 b(\()p Fn(\014)5 b Ft(\))41 b(and)31 b(transitivit)m(y)f(w)m(e)j(ma)m (y)f(complete)g(the)g(pro)s(of)g(of)40 b Fn(M)31 b Ft(+)21 b Fn(P)41 b Ft(=)27 b Fn(N)k Ft(+)21 b Fn(Q)8 b Ft(.)45 b(The)0 1543 y(reason)36 b(that)g(the)g(congruence)g(rules)e(are)i (listed)f(is)f(that)i(these)g(are)h(imp)s(ortan)m(t)d(prop)s(erties)g (of)i(equalit)m(y)-8 b(.)57 b(In)0 1655 y(addition,)25 b(if)g(w)m(e)i(w)m(ere)f(to)h(dev)m(elop)f(a)g(\014rst-order)f(theory)i (of)f(natural)f(n)m(um)m(b)s(ers)f(and)i(b)s(o)s(oleans,)g(in)e(the)i (absence)0 1768 y(of)31 b(lam)m(b)s(da)e(abstraction,)i(w)m(e)f(w)m (ould)g(need)g(axioms)g(expressing)f(these)i(prop)s(erties.)141 1881 y(It)f(is)f(w)m(orth)h(men)m(tioning)f(that)i(although)f(the)g (axiomatic)g(seman)m(tics)g(is)g(p)s(o)m(w)m(erful)e(enough)i(to)h (determine)0 1994 y(the)j(meaning)g(of)g(programs,)h(this)f(pro)s(of)f (system)h(is)g(not)g(as)h(p)s(o)m(w)m(erful)e(as)h(one)h(migh)m(t)f (initially)c(exp)s(ect.)53 b(F)-8 b(or)0 2107 y(example,)32 b(w)m(e)g(cannot)g(ev)m(en)g(pro)m(v)m(e)h(that)f(addition)e(is)g(comm) m(utativ)m(e.)46 b(Nor)32 b(can)g(w)m(e)g(pro)m(v)m(e)g(man)m(y)g(in)m (teresting)0 2220 y(equiv)-5 b(alences)27 b(b)s(et)m(w)m(een)i (recursiv)m(e)f(functions.)38 b(F)-8 b(or)29 b(these)f(kinds)e(of)j (prop)s(erties,)e(the)h(most)h(natural)e(approac)m(h)0 2333 y(w)m(ould)i(b)s(e)h(to)i(add)e(induction)e(rules.)40 b(Induction)29 b(on)h(natural)g(n)m(um)m(b)s(ers)f(w)m(ould)g(let)i(us) f(pro)m(v)m(e)h(comm)m(utativit)m(y)0 2446 y(quite)d(easily)-8 b(,)28 b(and)g(a)g(form)g(of)h(induction)d(called)h(\\\014xed-p)s(oin)m (t)g(induction")g(w)m(ould)g(allo)m(w)g(us)h(to)h(pro)m(v)m(e)g(a)g (great)0 2559 y(man)m(y)36 b(more)g(equations)g(b)s(et)m(w)m(een)g (recursiv)m(ely-de\014ned)e(functions.)56 b(F)-8 b(or)37 b(further)d(information)h(on)h(natural-)0 2672 y(n)m(um)m(b)s(er)31 b(induction,)f(the)i(reader)g(ma)m(y)h(consult)e(Section)h(1.8)h(or)g (almost)f(an)m(y)g(b)s(o)s(ok)g(on)g(mathematical)g(logic,)0 2785 y(suc)m(h)22 b(as)g([End72].)38 b(Since)21 b(\014xed-p)s(oin)m(t)g (induction)e(is)j(sp)s(eci\014cally)d(related)j(to)h(programs,)h(and)d (not)h(a)h(traditional)0 2897 y(topic)38 b(in)e(mathematical)j(logic,)h (w)m(e)e(consider)f(this)g(in)f(Section)i(5.3.)64 b(A)38 b(rudimen)m(tary)f(form)g(of)h(\014xed-p)s(oin)m(t)0 3010 y(induction)28 b(is)h(discussed)g(in)g(Exercise)h(2.3.3)i(b)s(elo) m(w.)0 3223 y Fk(Exercise)j(2.3.1)47 b Ft(Use)31 b(the)g(equational)g (pro)s(of)f(system)h(to)h(pro)m(v)m(e)f(that)h(the)f(follo)m(wing)f(t)m (w)m(o)i(terms)f(are)g(equal,)0 3336 y(for)f(an)m(y)39 b Fn(M)19 b Ft(.)40 b(Y)-8 b(ou)31 b(do)f(not)h(need)f(an)m(y)h(axioms) f(ab)s(out)g(subtraction)g(to)h(carry)f(out)h(the)f(pro)s(of.)624 3540 y Fl(letrec)46 b Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)10 b Ft(\):)15 b Fs(nat)35 b Ft(=)25 b Fl(if)47 b Fs(Eq)8 b Ft(?)15 b Fn(x)g Ft(0)48 b Fl(then)f Ft(1)h Fl(else)e Fn(f)10 b Ft(\()p Fn(x)20 b Fr(\000)g Ft(1\))49 b Fl(in)e Fn(M)331 3741 y Fl(let)30 b Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)9 b Ft(\):)15 b Fs(nat)36 b Ft(=)25 b Fl(if)k Fs(Eq)8 b Ft(?)15 b Fn(x)g Ft(0)31 b Fl(then)e Ft(1)483 3854 y Fl(else)g(letrec)46 b Fn(g)s Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)c Ft(\):)k Fs(nat)35 b Ft(=)25 b Fl(if)48 b Fs(Eq)8 b Ft(?)14 b Fn(x)h Ft(0)48 b Fl(then)f Ft(1)h Fl(else)f Fn(g)s Ft(\()p Fn(x)21 b Fr(\000)f Ft(1\))48 b Fl(in)g Fn(g)s Ft(\()p Fn(x)21 b Fr(\000)f Ft(1\))331 3967 y Fl(in)30 b Fn(M)0 4172 y Fk(Exercise)35 b(2.3.2)47 b Ft(A)29 b(system)g(for)g(pro)m(ving)f(equations)h(is)f Fs(inc)-5 b(onsistent)39 b Ft(if)28 b(ev)m(ery)i(equation)38 b Fn(M)d Ft(=)25 b Fn(N)47 b Ft(b)s(et)m(w)m(een)0 4285 y(w)m(ell-formed)39 b(expressions)47 b Fn(M)59 b Ft(and)48 b Fn(N)59 b Ft(of)40 b(the)h(same)f(t)m(yp)s(e)h(is)e(pro)m(v)-5 b(able.)70 b(Sho)m(w)40 b(that)h(if)48 b Fs(true)g Ft(=)42 b Fs(false)56 b Ft(is)0 4398 y(pro)m(v)-5 b(able)34 b(from)f(the)i (axioms)e(and)h(inference)f(rules)g(of)h(PCF,)g(then)g(the)h(pro)s(of)e (system)h(is)f(inconsisten)m(t.)52 b(Use)0 4511 y(the)26 b(same)g(idea)f(to)h(sho)m(w)f(that)h(if)f(w)m(e)h(can)f(pro)m(v)m(e)35 b Fn(m)25 b Ft(=)g Fn(n)33 b Ft(for)26 b(distinct)e(n)m(umerals)32 b Fn(m)i Ft(and)f Fn(n)8 b Ft(,)26 b(the)g(pro)s(of)f(system)0 4624 y(is)k(also)i(inconsisten)m(t.)0 4836 y Fk(Exercise)k(2.3.3)47 b Ft(While)36 b(w)m(e)h(can)h(pro)m(v)m(e)g(some)f(simple)e(equations)i (in)m(v)m(olving)f(recursion,)h(suc)m(h)g(as)g(the)h(one)0 4949 y(giv)m(en)d(in)e(Exercise)h(2.3.1,)k(man)m(y)c(similar-lo)s (oking)d(equations)k(cannot)g(b)s(e)f(pro)m(v)m(ed)h(in)e(the)i (equational)f(pro)s(of)0 5062 y(system)44 b(giv)m(en)f(here.)80 b(The)43 b(reason)h(is)e(subtle)g(but)h(imp)s(ortan)m(t.)79 b(Consider)42 b(t)m(w)m(o)j(recursiv)m(e)e(de\014nitions)e(of)0 5175 y(factorial,)e(for)d(example,)47 b Fn(f)978 5189 y Fp(1)1053 5175 y Ft(=)35 b Fs(\014x)27 b Fn(F)1337 5189 y Fp(1)1421 5175 y Ft(and)45 b Fn(f)1658 5189 y Fp(2)1733 5175 y Ft(=)35 b Fs(\014x)27 b Fn(F)2017 5189 y Fp(2)2065 5175 y Ft(.)60 b(The)36 b(t)m(w)m(o)i(functions)44 b Fn(f)2973 5189 y Fp(1)3057 5175 y Ft(and)g Fn(f)3293 5189 y Fp(2)3377 5175 y Ft(ma)m(y)37 b(giv)m(e)h(the)0 5288 y(same)i(result)f(for)h(an)m(y)g(natural)f(n)m(um)m(b)s(er)g (argumen)m(t,)k(ev)m(en)d(though)g(the)g(functions)47 b Fn(F)3111 5302 y Fp(1)3199 5288 y Ft(and)g Fn(F)3451 5302 y Fp(2)3539 5288 y Ft(are)41 b(quite)p eop %%Page: 73 24 73 23 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(73)0 91 y(di\013eren)m(t.)40 b(Ho)m(w)m(ev)m(er,) 31 b(the)e(pro)s(of)g(system)g(do)s(es)f(not)i(seem)f(to)h(pro)m(vide)e (an)m(y)h(w)m(a)m(y)h(to)g(deduce)37 b Fn(f)3311 105 y Fp(1)3375 91 y Ft(=)25 b Fn(f)3516 105 y Fp(2)3592 91 y Ft(without)0 204 y(essen)m(tially)k(sho)m(wing)h(that)39 b Fn(F)1045 218 y Fp(1)1124 204 y Ft(and)f Fn(F)1367 218 y Fp(2)1445 204 y Ft(are)31 b(closely)f(related.)141 317 y(A)h(pro)s(of)e(rule)g(that)i(helps)e(pro)m(v)m(e)i(equations)f (in)m(v)m(olving)f(\014xed)h(p)s(oin)m(ts)f(is)h(the)g(follo)m(wing.)39 572 y(\()p Fs(\014x)44 b(ind)10 b Ft(\))1727 511 y Fn(M)35 b Fr(!)-61 b(!)26 b Fn(N)10 b(M)p 1727 551 451 4 v 1742 634 a(M)35 b Ft(=)25 b Fs(\014x)h Fn(N)2221 572 y(:)0 827 y Ft(The)44 b(in)m(tuitiv)m(e)f(explanation)h(of)g(this)g(rule,)j (whic)m(h)c(is)g(lo)s(osely)h(based)g(on)g(McCarth)m(y's)i(rule)d(of)i Fs(r)-5 b(e)g(cursion)0 940 y(induction)49 b Ft([McC61)r(,)41 b(McC63)q(],)k(is)40 b(that)i(when)49 b Fn(M)60 b Ft(b)s(eha)m(v)m(es) 42 b(computationally)e(lik)m(e)h(a)h(\014xed)e(p)s(oin)m(t)h(of)49 b Fn(N)19 b Ft(,)0 1053 y(then)30 b(w)m(e)h(conclude)f(that)39 b Fn(M)49 b Ft(and)38 b Fs(\014x)26 b Fn(N)48 b Ft(ha)m(v)m(e)32 b(the)f(same)f(v)-5 b(alue.)41 b(The)29 b(computational)h(nature)g(of)h (reduction)0 1166 y(is)36 b(imp)s(ortan)m(t)h(here,)i(since)e(the)h (rule)e(b)s(ecomes)i(unsound)d(if)h(the)i(h)m(yp)s(othesis)e(is)g (replaced)h(b)m(y)g(the)h(equation)0 1279 y Fn(M)e Ft(=)26 b Fn(N)10 b(M)19 b Ft(,)31 b(as)g(ma)m(y)h(b)s(e)e(seen)h(b)m(y)g (taking)39 b Fn(N)50 b Ft(to)31 b(b)s(e)g(the)g(iden)m(tit)m(y)-8 b(.)42 b(F)-8 b(or)32 b(further)e(discussion)e(of)j(this)f(rule,)g(see) 0 1392 y(Exercise)g(5.4.9.)141 1505 y(Pro)m(v)m(e)38 b(the)f(follo)m(wing)e(equations)h(using)f(\()p Fs(\014x)k(ind)9 b Ft(\))38 b(in)d(com)m(bination)h(with)g(the)h(other)f(equational)h (pro)s(of)0 1618 y(rules.)66 1803 y(\(a\))55 b Fs(\014x)11 b Ft(\()p Fn(f)30 b Fr(\016)20 b Fn(g)s Ft(\))27 b(=)d Fn(f)10 b Ft(\()p Fs(\014x)h Ft(\()p Fn(g)25 b Fr(\016)20 b Fn(f)10 b Ft(\)\))e(.)61 1990 y(\(b\))54 b Fs(\014x)340 2012 y Fm(\033)412 1990 y Ft(=)25 b Fs(\014x)612 2012 y Fp(\()p Fm(\033)694 2008 y Fi(!)776 2012 y Fm(\033)r Fp(\))858 2008 y Fi(!)941 2012 y Fm(\033)987 1990 y Fn(\025f)10 b Ft(:)15 b(\()p Fn(\033)1241 1984 y Fr(!)1347 1990 y Fn(\033)s Ft(\))1452 1984 y Fr(!)1559 1990 y Fn(\033)n(:\025g)s Ft(:)g Fn(\033)1845 1984 y Fr(!)1951 1990 y Fn(\033)n(:g)s Ft(\()p Fn(f)10 b(g)s Ft(\))40 b(where)e Fn(\033)29 b Fr(\021)24 b Fn(\033)2782 2004 y Fp(1)2837 1984 y Fr(!)2943 1990 y Fn(\033)2995 2004 y Fp(2)3043 1990 y Ft(.)0 2233 y Fo(2.3.3)112 b(Denotational)37 b(seman)m(tics)0 2404 y Ft(The)k(PCF)g(denotational)g(seman)m(tics)g(assigns)g(a)g(natural)g (n)m(um)m(b)s(er)f(v)-5 b(alue)40 b(\(or)i(a)f(sp)s(ecial)f(additional) f(v)-5 b(alue)0 2517 y(corresp)s(onding)26 b(to)i(non)m(termination\))f (to)h(eac)m(h)h(expression)e(of)h(t)m(yp)s(e)36 b Fs(nat)18 b Ft(,)28 b(a)g(b)s(o)s(olean)f(v)-5 b(alue)27 b(\(or)h(sp)s(ecial)e(v) -5 b(alue)0 2630 y(for)28 b(non)m(termination\))g(to)h(eac)m(h)h (expression)d(of)i(t)m(yp)s(e)37 b Fs(b)-5 b(o)g(ol)19 b Ft(,)29 b(and)f(a)h(mathematical)g(function)e(or)i(pair)e(of)i(v)-5 b(alues)0 2743 y(to)32 b(an)m(y)f(function)f(expression)g(or)h (expression)f(of)h(cartesian)h(pro)s(duct)e(t)m(yp)s(e.)43 b(The)31 b(mathematical)g(v)-5 b(alue)31 b(of)g(an)0 2856 y(expression)26 b(is)g(called)g(its)g Fs(denotation.)42 b Ft(If)26 b(a)h(term)g(has)g(free)g(v)-5 b(ariables,)27 b(its)f(denotation)h(will)d(generally)j(dep)s(end)0 2969 y(on)32 b(the)g(v)-5 b(alues)32 b(assumed)f(for)h(the)g(free)g(v)-5 b(ariables.)45 b(While)31 b(w)m(e)h(will)e(not)i(go)h(in)m(to)f (details)f(in)g(this)g(c)m(hapter,)i(w)m(e)0 3082 y(will)d(giv)m(e)i(a) h(brief)e(o)m(v)m(erview)h(of)h(the)f(denotational)g(seman)m(tics)h(of) f(PCF)g(so)h(that)f(w)m(e)h(can)g(compare)f(the)h(three)0 3195 y(forms)d(of)g(seman)m(tics.)141 3308 y(W)-8 b(e)36 b(giv)m(e)f(denotations)g(to)g(terms)g(b)m(y)g(\014rst)f(c)m(ho)s (osing)g(a)h(set)h(of)e(v)-5 b(alues)35 b(for)f(eac)m(h)i(t)m(yp)s(e.) 54 b(In)34 b(the)h(standard)0 3421 y(seman)m(tics,)c(the)f(set)h(of)f (mathematical)h(v)-5 b(ales)30 b(for)g(t)m(yp)s(e)39 b Fs(nat)48 b Ft(will)27 b(include)h(all)i(of)g(the)g(natural)g(n)m(um) m(b)s(ers,)f(plus)0 3533 y(a)42 b(sp)s(ecial)e(elemen)m(t)51 b Fr(?)821 3547 y Fj(nat)981 3533 y Ft(represen)m(ting)41 b(non)m(termination.)73 b(This)39 b(extra)k(v)-5 b(alue)41 b(is)f(needed)i(since)f(w)m(e)h(ha)m(v)m(e)0 3646 y(PCF)f(expressions)e (of)i(t)m(yp)s(e)50 b Fs(nat)59 b Ft(suc)m(h)40 b(as)50 b Fl(letrec)c Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)9 b Ft(\):)15 b Fs(nat)53 b Ft(=)43 b Fn(f)10 b Ft(\()p Fn(x)27 b Ft(+)g(1\))48 b Fl(in)f Fn(f)10 b Ft(\(0\))50 b(whic)m(h)40 b(do)h(not)0 3759 y(terminate)36 b(under)f(the)h (standard)f(in)m(terpreter,)i(and)f(do)g(not)g(denote)h(an)m(y)f (standard)f(natural)h(n)m(um)m(b)s(er.)56 b(F)-8 b(or)0 3872 y(similar)29 b(reasons,)j(the)g(set)g(of)g(denotations)g(of)g(t)m (yp)s(e)40 b Fs(b)-5 b(o)g(ol)51 b Ft(includes)37 b Fs(true)15 b Ft(,)41 b Fs(false)47 b Ft(and)31 b(an)h(extra)g(v)-5 b(alue)39 b Fr(?)3739 3887 y Fj(b)l(o)l(ol)3875 3872 y Ft(.)0 3985 y(The)f(mathematical)g(v)-5 b(alues)38 b(of)g(a)h(pro)s(duct)e(t)m(yp)s(e)47 b Fn(\033)18 b Fr(\002)d Fn(\034)57 b Ft(are)38 b(ordered)g(pairs,)h(as)g(y)m(ou)f(w)m (ould)f(exp)s(ect.)65 b(The)0 4098 y(mathematical)26 b(v)-5 b(alues)25 b(of)g(t)m(yp)s(e)34 b Fn(\033)1208 4092 y Fr(!)1315 4098 y Fn(\034)43 b Ft(are)26 b(functions)e(from)33 b Fn(\033)k Ft(to)e Fn(\034)43 b Ft(with)25 b(the)g(prop)s(ert)m(y)g (that)h(if)33 b Fn(\034)i Ft(=)25 b Fn(\033)12 b Ft(,)26 b(then)0 4211 y(eac)m(h)j(function)d(has)h(a)h(\014xed)f(p)s(oin)m(t.) 39 b(The)27 b(precise)g(w)m(a)m(y)h(of)g(obtaining)e(suc)m(h)h(a)h(set) g(of)g(functions)e(is)h(discussed)e(in)0 4324 y(Chapter)f(5.)40 b(W)-8 b(e)26 b(in)m(terpret)e(addition)f(and)h(other)h(PCF)g (functions)f(in)f(the)i(usual)f(w)m(a)m(y)-8 b(,)27 b(for)e(argumen)m (ts)g(that)h(are)0 4437 y(ordinary)h(natural)h(n)m(um)m(b)s(ers,)h(and) f(as)h(the)g(sp)s(ecial)f(v)-5 b(alue)37 b Fr(?)2122 4451 y Fj(nat)2269 4437 y Ft(when)28 b(one)i(of)f(the)g(argumen)m(ts)h (is)36 b Fr(?)3539 4451 y Fj(nat)3658 4437 y Ft(.)k(This)0 4550 y(is)33 b(b)s(ecause)h(w)m(e)g(cannot)h(compute)f(an)g(ordinary)e (natural)h(n)m(um)m(b)s(er)g(b)m(y)g(adding)g(a)h(n)m(um)m(b)s(er)f(to) h(an)g(expression)0 4663 y(that)d(do)s(es)f(not)h(de\014ne)e(a)i (terminating)e(computation.)141 4775 y(Once)36 b(w)m(e)g(ha)m(v)m(e)h (c)m(hosen)g(a)f(set)h(of)f(v)-5 b(alues)35 b(for)h(eac)m(h)h(t)m(yp)s (e,)g(w)m(e)g(assign)e(meanings)g(to)i(terms)e(b)m(y)h(c)m(ho)s(osing)0 4888 y(an)h Fs(envir)-5 b(onment,)40 b Ft(whic)m(h)35 b(is)h(a)h(mapping)f(from)g(v)-5 b(ariables)36 b(to)h(v)-5 b(alues.)60 b(If)45 b Fn(x)g Ft(is)36 b(a)h(v)-5 b(ariable)36 b(of)h(t)m(yp)s(e)45 b Fn(\033)12 b Ft(,)39 b(and)0 5001 y Fn(\021)46 b Ft(is)34 b(an)h(en)m(vironmen)m(t,)g(then)43 b Fn(\021)s Ft(\()p Fn(x)p Ft(\))h(m)m(ust)34 b(b)s(e)g(a)h (mathematical)g(v)-5 b(alue)34 b(from)h(t)m(yp)s(e)43 b Fn(\033)12 b Ft(.)53 b(W)-8 b(e)35 b(then)g(de\014ne)f(the)0 5114 y(meaning)e([)-15 b([)p Fn(M)10 b Ft(])-15 b(])p Fn(\021)36 b Ft(of)25 b(term)32 b Fn(M)43 b Ft(in)23 b(en)m(vironmen)m(t)32 b Fn(\021)k Ft(b)m(y)24 b(induction,)f(in)g(the) i(manner)e(that)i(ma)m(y)g(b)s(e)e(familiar)f(from)0 5227 y(\014rst-order)i(logic.)39 b(Sp)s(eci\014cally)-8 b(,)24 b(the)h(meaning)33 b([)-15 b([)p Fn(x)p Ft(])g(])p Fn(\021)37 b Ft(is)24 b(the)h(v)-5 b(alue)25 b(giv)m(en)g(to)h(v)-5 b(ariable)32 b Fn(x)h Ft(b)m(y)25 b(the)g(en)m(vironmen)m(t,)0 5340 y(namely)40 b Fn(\021)s Ft(\()p Fn(x)p Ft(\))8 b(.)48 b(The)32 b(meaning)g(of)h(an)f(application)39 b([)-15 b([)p Fn(M)10 b(N)g Ft(])-15 b(])p Fn(\021)45 b Ft(is)31 b(obtained)h(b)m(y)g(applying)f(the)h(function)40 b([)-15 b([)p Fn(M)10 b Ft(])-15 b(])p Fn(\021)p eop %%Page: 74 25 74 24 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(74)0 91 y(denoted)26 b(b)m(y)35 b Fn(M)44 b Ft(to)27 b(the)f(argumen)m(t)35 b([)-15 b([)p Fn(N)10 b Ft(])-15 b(])p Fn(\021)38 b Ft(denoted)27 b(b)m(y)34 b Fn(N)18 b Ft(.)39 b(Other)26 b(cases)h(are)g(handled)d(in)h(a)h (similar)e(w)m(a)m(y)-8 b(.)40 b(An)0 204 y(imp)s(ortan)m(t)26 b(prop)s(ert)m(y)f(is)h(that)h(the)g(meaning)e(of)i(a)g(term)f(of)h(t)m (yp)s(e)35 b Fn(\033)j Ft(will)24 b(alw)m(a)m(ys)j(b)s(e)f(one)g(of)h (the)g(mathematical)0 317 y(v)-5 b(alues)34 b(asso)s(ciated)i(with)d (this)h(t)m(yp)s(e.)54 b(Therefore,)37 b(in)c(the)i(case)h(of)f(an)g (application)42 b Fn(M)10 b(N)18 b Ft(,)36 b(for)f(example,)h(the)0 430 y(t)m(yping)h(rules)g(of)h(PCF)f(guaran)m(tee)j(that)e(the)g (denotation)h(of)46 b Fn(M)56 b Ft(will)35 b(b)s(e)j(a)g(function)e (and)i(the)g(denotation)0 543 y(of)k Fn(N)51 b Ft(will)31 b(b)s(e)i(a)g(v)-5 b(alue)33 b(in)f(its)h(domain.)48 b(In)33 b(this)f(w)m(a)m(y)-8 b(,)36 b(the)d(syn)m(tactic)h(t)m(yping)f (rules)f(of)h(PCF)h(a)m(v)m(oid)f(p)s(ossible)0 656 y(complications)c (in)g(the)i(denotational)f(seman)m(tics)h(of)f(the)h(language.)141 769 y(There)43 b(are)h(sev)m(eral)f(prop)s(erties)f(of)h(denotational)g (seman)m(tics)h(that)g(generally)e(hold.)78 b(The)43 b(\014rst)g(is)f(an)0 882 y(in)m(trinsic)28 b(prop)s(ert)m(y)h(of)i (denotational)f(seman)m(tics)h(that)g(distinguishes)c(it)j(from)g (other)g(forms)g(of)g(seman)m(tics.)136 1064 y Fr(\017)46 b Ft(The)24 b(denotational)f(seman)m(tics)h(is)f Fs(c)-5 b(omp)g(ositional,)29 b Ft(whic)m(h)23 b(means)g(that)i(the)f(meaning)f (of)h(an)m(y)g(expression)227 1177 y(is)30 b(determined)f(from)h(the)g (meanings)g(of)g(its)g(sub)s(expressions.)38 b(F)-8 b(or)31 b(example,)926 1484 y([)-15 b([)p Fl(if)47 b Fn(B)53 b Fl(then)46 b Fn(M)58 b Fl(else)47 b Fn(N)10 b Ft(])-15 b(])p Fn(\021)29 b Ft(=)2137 1287 y Fh(8)2137 1362 y(>)2137 1387 y(<)2137 1536 y(>)2137 1561 y(:)2252 1371 y Ft([)-15 b([)p Fn(M)10 b Ft(])-15 b(])p Fn(\021)87 b Ft(if)30 b([)-15 b([)p Fn(B)5 b Ft(])-15 b(])p Fn(\021)33 b Ft(is)d(true,)2252 1484 y([)-15 b([)p Fn(N)10 b Ft(])-15 b(])p Fn(\021)102 b Ft(if)30 b([)-15 b([)p Fn(B)5 b Ft(])-15 b(])p Fn(\021)33 b Ft(is)d(false,)2252 1597 y Fr(?)229 b Ft(otherwise.)227 1792 y(where)42 b Fr(?)f Ft(is)32 b(used)h(as)h(the)f(meaning)g(of)h (the)f(expression)f(in)h(the)g(case)i(that)f(ev)-5 b(aluation)33 b(of)g(the)h(test)42 b Fn(B)227 1905 y Ft(do)s(es)33 b(not)h(terminate.)49 b(An)33 b(immediate)g(consequence)h(of)f(the)h (comp)s(ositional)e(form)h(of)g(this)f(de\014nition)227 2018 y(is)e(that)h(if)37 b Fn(B)681 1985 y Fi(0)712 2018 y Ft(,)i Fn(M)874 1985 y Fi(0)936 2018 y Ft(and)f Fn(N)1204 1985 y Fi(0)1266 2018 y Ft(ha)m(v)m(e)32 b(the)e(same)h(denotations)g (as)38 b Fn(B)13 b Ft(,)39 b Fn(M)49 b Ft(and)38 b Fn(N)18 b Ft(,)31 b(resp)s(ectiv)m(ely)-8 b(,)30 b(then)866 2216 y([)-15 b([)p Fl(if)47 b Fn(B)53 b Fl(then)46 b Fn(M)58 b Fl(else)47 b Fn(N)10 b Ft(])-15 b(])p Fn(\021)29 b Ft(=)c([)-15 b([)p Fl(if)47 b Fn(B)2329 2178 y Fi(0)2400 2216 y Fl(then)f Fn(M)2736 2178 y Fi(0)2808 2216 y Fl(else)g Fn(N)3129 2178 y Fi(0)3152 2216 y Ft(])-15 b(])p Fn(\021)s(:)227 2413 y Ft(The)35 b(reason)h(these)g(t)m(w)m(o)g(m)m(ust)g(b)s(e)f (equiv)-5 b(alen)m(t)34 b(is)h(that)h(the)g(meaning)e(of)i(the)f (conditional)f(expression)227 2526 y Fl(if)47 b Fn(B)53 b Fl(then)46 b Fn(M)58 b Fl(else)47 b Fn(N)i Ft(cannot)33 b(dep)s(end)c(on)j(factors)g(suc)m(h)f(as)h(the)f(syn)m(tactic)i(form)e (of)40 b Fn(B)13 b Ft(,)40 b Fn(M)50 b Ft(and)227 2639 y Fn(N)19 b Ft(,)30 b(only)g(their)f(seman)m(tic)i(meaning.)136 2824 y Fr(\017)46 b Ft(If)36 b(w)m(e)h(can)f(pro)m(v)m(e)h(the)f(same)h (assertions)e(ab)s(out)45 b Fn(M)54 b Ft(and)44 b Fn(N)54 b Ft(in)35 b(the)h(axiomatic)h(seman)m(tics,)h(then)44 b Fn(M)227 2937 y Ft(and)36 b Fn(N)46 b Ft(m)m(ust)27 b(ha)m(v)m(e)i(the)f(same)h(meaning)e(in)f(the)i(denotational)g(seman)m (tics.)40 b(This)26 b(is)h(called)g Fs(soundness,)227 3050 y Ft(for)37 b(an)h(equational)f(pro)s(of)f(system.)62 b(This)36 b(is)g(a)i(minimal)c(prop)s(ert)m(y)j(in)f(the)i(sense)f (that)h(if)f(soundness)227 3163 y(fails,)27 b(w)m(e)h(w)m(ould)e (conclude)h(that)g(something)g(w)m(as)h(wrong)f(with)f(either)h(the)g (axiomatic)h(or)f(denotational)227 3276 y(seman)m(tics.)41 b(It)30 b(follo)m(ws)g(from)f(soundness,)g(b)m(y)h(connections)g(b)s (et)m(w)m(een)h(the)f(axiomatic)g(and)g(op)s(erational)227 3389 y(seman)m(tics)38 b(of)f(PCF,)h(that)f(if)45 b Fn(M)i Fr(!)-61 b(!)37 b Fn(N)18 b Ft(,)39 b(then)45 b Fn(M)56 b Ft(and)45 b Fn(N)55 b Ft(m)m(ust)38 b(ha)m(v)m(e)g(the)g(same)f (meaning)g(in)f(the)227 3502 y(denotational)31 b(seman)m(tics.)0 3684 y(Both)d(of)f(these)h(prop)s(erties)d(hold)h(for)h(the)h(standard) e(denotational)h(seman)m(tics)g(of)h(PCF.)f(F)-8 b(urther)27 b(connections)0 3797 y(b)s(et)m(w)m(een)k(op)s(erational,)f (denotational)g(and)g(axiomatic)g(seman)m(tics)h(are)g(summarized)e(in) g(Section)h(2.3.5.)0 4039 y Fo(2.3.4)112 b(Op)s(erational)37 b(seman)m(tics)0 4211 y Ft(An)31 b(op)s(erational)g(seman)m(tics)g(ma)m (y)h(b)s(e)f(giv)m(en)g(in)f(sev)m(eral)i(w)m(a)m(ys.)45 b(The)30 b(most)i(common)g(mathematical)f(presen-)0 4324 y(tations)j(are)g(pro)s(of)f(systems)h(for)g(either)f(deducing)f(the)i (\014nal)e(result)h(of)h(ev)-5 b(aluation)33 b(or)h(for)g(transforming) e(an)0 4437 y(expression)24 b(through)g(a)h(sequence)g(of)g(steps.)39 b(An)24 b(alternativ)m(e)h(that)h(ma)m(y)f(pro)m(vide)f(more)h(insigh)m (t)f(in)m(to)g(practical)0 4550 y(implemen)m(tation)35 b(is)g(to)h(de\014ne)g(an)g(abstract)h(mac)m(hine,)g(whic)m(h)e(is)g(a) h(theoretical)g(computing)g(mac)m(hine)f(that)0 4663 y(ev)-5 b(aluates)29 b(programs)e(b)m(y)h(progressing)f(through)h(a)g (series)g(of)g(mac)m(hine)g(states.)41 b(The)27 b(most)i(common)f (practical)0 4775 y(presen)m(tations)f(of)g(op)s(erational)f(seman)m (tics)i(are)f(in)m(terpreters)f(and)h(compilers.)38 b(In)26 b(this)g(b)s(o)s(ok,)h(w)m(e)h(concen)m(trate)0 4888 y(on)j(the)g(\014rst)f(forms)g(of)i(op)s(erational)e(seman)m(tics,)h (pro)s(of)f(systems)h(de\014ning)e(either)i(complete)g(or)g(step-b)m (y-step)0 5001 y(ev)-5 b(aluation.)141 5114 y(The)38 b(op)s(erational)g(seman)m(tics)h(of)g(PCF)f(are)h(giv)m(en)g(b)m(y)f (the)h(reduction)f(axioms)g(men)m(tioned)g(in)f(Sections)0 5227 y(2.2.2)28 b(through)d(2.2.5,)k(whic)m(h)c(are)i(summarized)e(in)f (T)-8 b(able)26 b(2.2.)41 b(The)25 b(reduction)g(axioms)h(are)h (written)e(with)g(the)0 5340 y(sym)m(b)s(ol)319 5334 y Fr(!)448 5340 y Ft(instead)k(of)38 b(=)8 b(,)30 b(to)h(emphasize)e (the)h(direction)e(of)i(reduction.)40 b(In)m(tuitiv)m(ely)-8 b(,)37 b Fn(M)f Fr(!)25 b Fn(N)48 b Ft(means)29 b(that)p eop %%Page: 75 26 75 25 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(75)50 79 y Fs(nat)40 b Ft(and)29 b Fs(b)-5 b(o)g(ol)50 192 y Ft(\()p Fs(add)9 b Ft(\))859 b(0)21 b(+)f(0)25 b Fr(!)h Ft(0,)31 b(0)20 b(+)g(1)26 b Fr(!)f Ft(1,)31 b(.)15 b(.)h(.)f(,)31 b(3)21 b(+)e(5)26 b Fr(!)f Ft(8,)31 b(.)16 b(.)f(.)50 305 y(\()p Fs(Eq)8 b Ft(?\))851 b Fs(Eq)8 b Ft(?)15 b Fn(n)g(n)24 b Fr(!)i Fs(true)6 b Ft(,)31 b Fs(Eq)8 b Ft(?)15 b Fn(n)g(m)24 b Fr(!)i Fs(false)37 b Ft(\()p Fn(n;)15 b(m)31 b Ft(distinct)e(n)m (umerals\))50 418 y(\()p Fs(c)-5 b(ond)9 b Ft(\))817 b Fl(if)47 b Fs(true)55 b Fl(then)47 b Fn(M)58 b Fl(else)46 b Fn(N)35 b Fr(!)26 b Fn(M)10 b Ft(,)30 b Fl(if)47 b Fs(false)56 b Fl(then)46 b Fn(M)58 b Fl(else)47 b Fn(N)35 b Fr(!)25 b Fn(M)50 609 y Ft(P)m(airs)30 b(\()p Fn(\033)18 b Fr(\002)d Fn(\034)10 b Ft(\))50 722 y(\()p Fs(pr)-5 b(oj)13 b Ft(\))890 b Fk(Pro)6 b(j)1381 744 y Fp(1)1420 722 y Fr(h)p Fn(M)f(;)15 b(N)10 b Fr(i)26 b(!)g Fn(M)109 b Fk(Pro)6 b(j)2251 744 y Fp(2)2290 722 y Fr(h)p Fn(M)f(;)15 b(N)10 b Fr(i)27 b(!)e Fn(N)50 913 y Ft(Rename)31 b(b)s(ound)d(v)-5 b(ariables)50 1026 y(\()p Fn(\013)p Ft(\))948 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)36 b Ft(=)25 b Fn(\025y)s Ft(:)15 b Fn(\033)n(:)p Ft([)p Fn(y)s(=x)p Ft(])p Fn(M)10 b Ft(,)32 b(pro)m(vided)d Fn(y)34 b Ft(not)c(free)h(in)e Fn(M)10 b Ft(.)50 1217 y(F)-8 b(unctions)30 b(\()p Fn(\033)571 1211 y Fr(!)677 1217 y Fn(\034)10 b Ft(\))50 1330 y(\()p Fn(\014)5 b Ft(\))950 b(\()p Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)10 b Ft(\))p Fn(N)37 b Fr(!)25 b Ft([)p Fn(N)r(=x)p Ft(])p Fn(M)50 1521 y Ft(Recursion)50 1634 y(\()p Fs(\014x)11 b Ft(\))902 b Fs(\014x)1230 1656 y Fm(\033)1303 1634 y Fr(!)25 b Fn(\025f)10 b Ft(:)15 b Fn(\033)1637 1628 y Fr(!)1743 1634 y Fn(\033)n(:f)10 b Ft(\()p Fs(\014x)2012 1656 y Fm(\033)2074 1634 y Fn(f)g Ft(\))1200 1901 y(T)-8 b(able)30 b(2.2:)42 b(Reduction)30 b(axioms)g(for)g(PCF)0 2145 y(with)j(one)i(ev)-5 b(aluation)35 b(step,)h(the)f(expression)42 b Fn(M)53 b Ft(ma)m(y)35 b(b)s(e)f(transformed)g(to)h(the)g(expression) 42 b Fn(N)18 b Ft(.)54 b(While)42 b Fn(N)0 2257 y Ft(ma)m(y)30 b(not)g(b)s(e)f(shorter)h(than)38 b Fn(M)18 b Ft(,)30 b(most)g(of)g(the)g(rules)e(ha)m(v)m(e)j(the)f(\\feel")g(of)g(program)g (execution;)g(it)f(seems)h(that)0 2370 y(w)m(e)35 b(are)g(making)f (progress)h(to)m(w)m(ards)g(a)g(simpler)e(expression)g(in)h(some)h(w)m (a)m(y)-8 b(.)55 b(W)-8 b(e)36 b(ma)m(y)f(de\014ne)f(an)h Fs(evaluation)0 2483 y(p)-5 b(artial)32 b(function)i Ft(from)26 b(the)h(reduction)f(system)h(b)m(y)35 b Fs(eval)10 b Ft(\()p Fn(M)g Ft(\))26 b(=)f Fn(N)45 b Ft(i\013)34 b Fn(M)45 b Ft(ma)m(y)28 b(b)s(e)e(reduced)g(to)i(normal)d(form)0 2596 y Fn(N)49 b Ft(in)29 b(zero)i(or)f(more)h(steps.)141 2709 y(This)i(relativ)m(ely)h(abstract)h(op)s(erational)f(seman)m (tics,)i(whic)m(h)d(lac)m(ks)i(an)m(y)g(sp)s(eci\014c)e(ev)-5 b(aluation)34 b(order,)h(ma)m(y)0 2822 y(b)s(e)24 b(re\014ned)f(in)g (sev)m(eral)i(w)m(a)m(ys.)39 b(W)-8 b(e)26 b(will)c(discuss)g(three)j (forms)f(of)g(\\sym)m(b)s(olic)f(in)m(terpreters")h(in)g(Section)g (2.4,)j(one)0 2935 y(deterministic,)33 b(one)h(nondeterministic,)e(and) h(the)h(third)e(a)i(form)f(of)h(parallel)e(in)m(terpreter.)51 b(While)32 b(all)h(of)h(the)0 3048 y(in)m(terpreters)28 b(are)h(de\014ned)e(from)i(reduction)e(axioms,)i(eac)m(h)h(applies)d (reduction)g(axioms)i(to)g(sub)s(expressions)d(of)0 3161 y(programs)33 b(in)f(a)i(di\013eren)m(t)f(w)m(a)m(y)-8 b(.)52 b(The)33 b(deterministic)e(in)m(terpreter)i(is)f(de\014ned)g(b)m (y)i(c)m(ho)s(osing)f(a)h(sp)s(eci\014c)e(\\next)0 3274 y(reduction)j(step")h(at)h(eac)m(h)g(p)s(oin)m(t)d(in)h(program)g(ev)-5 b(aluation,)37 b(while)d(the)i(nondeterministic)d(in)m(terpreter)i(ma)m (y)0 3387 y(c)m(ho)s(ose)e(to)g(reduce)e(an)m(y)i(sub)s(expression,)d (or)i(c)m(ho)s(ose)h(to)f(halt.)45 b(The)32 b(parallel)e(in)m (terpreter)h(ma)m(y)i(apply)e(sev)m(eral)0 3499 y(reductions)38 b(sim)m(ultaneously)e(to)k(disjoin)m(t)d(sub)s(expressions.)63 b(All)38 b(determine)g(the)h(same)g(partial)e(ev)-5 b(aluation)0 3612 y(function.)141 3725 y(With)33 b(three)g(exceptions,)i(the)e(PCF)g (reduction)g(axioms)g(are)g(exactly)h(the)g(left-to-righ)m(t)g (readings)e(of)i(the)0 3838 y(equational)e(axioms.)45 b(The)32 b(\014rst)f(exception)h(is)f(that)i(w)m(e)f(allo)m(w)g (renaming)f(of)h(b)s(ound)e(v)-5 b(ariables)31 b(at)i(an)m(y)f(p)s(oin) m(t)0 3951 y(during)h(reduction,)i(without)f(considering)f(this)g(as)i (a)h(reduction)d(step.)55 b(F)-8 b(rom)35 b(a)g(tec)m(hnical)g(standp)s (oin)m(t,)g(the)0 4064 y(reason)d(is)e(that)i(w)m(e)f(cannot)h(alw)m(a) m(ys)g(do)f(substitution)e(without)i(renaming.)42 b(The)31 b(other)g(exceptions)h(are)f(that)0 4177 y(w)m(e)41 b(do)f(not)g(ha)m (v)m(e)h(reductions)e(corresp)s(onding)f(to)j(the)g Fs(surje)-5 b(ctive)41 b(p)-5 b(airing)49 b Ft(axioms)g(\()p Fn(sp)p Ft(\))f(for)40 b(pairs)f(or)h(the)0 4290 y Fs(extensionality)f Ft(axiom)e(\()p Fn(\021)s Ft(\))h(for)29 b(functions.)39 b(The)29 b(reason)g(for)g(these)g(t)m(w)m(o)i(omissions)c(is)h(largely) h(tec)m(hnical)g(and)0 4403 y(discussed)f(brie\015y)h(in)g(Section)h (2.4.1.)136 4595 y Fr(\017)46 b Ft(In)41 b(general,)j(if)k Fn(M)60 b Ft(is)40 b(a)h(program)g(\(closed)h(expression)e(of)h(observ) -5 b(able)40 b(t)m(yp)s(e\))i(and)49 b Fs(eval)10 b Ft(\()p Fn(M)g Ft(\))44 b(=)e Fn(N)19 b Ft(,)227 4708 y(then)50 b Fn(N)60 b Ft(should)40 b(b)s(e)h(something)h(that)g(cannot)h(b)s(e)e (further)g(ev)-5 b(aluated.)75 b(In)41 b(PCF)h(in)f(particular,)i(if) 227 4821 y Fs(eval)10 b Ft(\()p Fn(M)g Ft(\))36 b(=)f Fn(N)18 b Ft(,)38 b(then)44 b Fn(N)55 b Ft(is)35 b(either)h(a)g(n)m (umeral)44 b(0)p Fn(;)15 b Ft(1)p Fn(;)g Ft(2)p Fn(;)g(:)g(:)g(:)48 b Ft(or)36 b(a)h(b)s(o)s(olean)e(constan)m(t,)k(dep)s(ending)34 b(on)227 4933 y(the)d(t)m(yp)s(e)f(of)39 b Fn(M)19 b Ft(.)136 5114 y Fr(\017)46 b Ft(If)35 b Fs(eval)9 b Ft(\()p Fn(M)h Ft(\))27 b(=)e Fn(N)18 b Ft(,)27 b(then)35 b Fn(M)45 b Ft(and)34 b Fn(N)45 b Ft(are)27 b(equiv)-5 b(alen)m(t)26 b(according)h(to)g(b)s(oth)f(the)h(axiomatic)g(and)f(denota-)227 5227 y(tional)j(seman)m(tics.)41 b(This)28 b(is)h(true)g(for)h(PCF,)g (since)f(eac)m(h)i(term)f(is)f(pro)m(v)-5 b(ably)28 b(equal)i(to)g(its) f(normal)g(form,)227 5340 y(and)h(the)h(pro)s(of)e(rules)g(are)i(sound) e(for)h(the)h(denotational)f(seman)m(tics.)p eop %%Page: 76 27 76 26 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(76)136 91 y Fr(\017)46 b Ft(If)33 b Fn(M)43 b Ft(is)23 b(a)i(program)f(and)33 b Fn(M)42 b Ft(has)25 b(the)f(same)h(denotation)g(as)g(a)g(result)32 b Fn(N)18 b Ft(,)26 b(then)e(the)h(result)e(of)i(executing)227 204 y(program)31 b Fn(M)42 b Ft(in)22 b(the)h(op)s(erational)f(seman)m (tics)i(is)30 b Fn(N)19 b Ft(.)38 b(This)21 b(is)h(commonly)h(referred) f(to)i(as)g Fs(c)-5 b(omputational)227 317 y(ade)g(quacy)32 b Ft(since,)23 b(if)f(w)m(e)h(tak)m(e)h(the)f(denotational)f(seman)m (tics)h(as)f(our)g(guide,)i(it)e(sa)m(ys)h(that)g(w)m(e)f(ha)m(v)m(e)i (enough)227 430 y(reduction)31 b(rules)g(to)i(prop)s(erly)d(determine)h (the)h(v)-5 b(alue)32 b(of)g(an)m(y)g(program.)46 b(If)32 b(computational)f(adequacy)227 543 y(fails,)40 b(w)m(e)f(generally)f (lo)s(ok)g(to)i(see)f(if)f(w)m(e)h(are)g(missing)e(some)i(reduction)f (rules,)h(or)g(consider)f(whether)227 656 y(the)f(denotational)g(seman) m(tics)g(giv)m(es)g(to)s(o)g(man)m(y)g(expressions)f(equal)g(meaning.) 59 b(It)37 b(generally)f(follo)m(ws)227 769 y(from)e(connections)h(b)s (et)m(w)m(een)g(the)f(axiomatic)h(and)f(denotational)g(seman)m(tics)h (that)g(if)e(the)i(op)s(erational)227 882 y(seman)m(tics)i(are)g (adequate)h(with)e(resp)s(ect)g(to)i(the)f(denotational)f(seman)m (tics,)j(they)e(are)g(also)g(adequate)227 995 y(with)29 b(resp)s(ect)i(to)g(the)f(axiomatic)h(seman)m(tics.)0 1238 y Fo(2.3.5)112 b(Equiv)-6 b(alence)37 b(relations)f(de\014ned)j(b) m(y)e(eac)m(h)h(form)f(of)h(seman)m(tics)0 1410 y Ft(W)-8 b(e)28 b(ma)m(y)g(summarize)e(the)i(basic)e(connections)i(b)s(et)m(w)m (een)f(axiomatic,)i(op)s(erational)d(and)h(denotational)g(seman-)0 1523 y(tics)k(b)m(y)g(comparing)g(the)g(equiv)-5 b(alence)31 b(relations)f(de\014ned)g(b)m(y)h(eac)m(h)i(one.)43 b(Since)30 b(the)i(axiomatic)f(seman)m(tics)h(of)0 1635 y(PCF)24 b(is)g(a)h(logical)f(system)h(for)g(deriving)d(equations,)k(the)f(ob)m (vious)f(equiv)-5 b(alence)24 b(relation)g(is)f(pro)m(v)-5 b(able)25 b(equalit)m(y)-8 b(.)0 1748 y(The)25 b(denotational)g(seman)m (tics)g(giv)m(es)g(us)g(the)g(relation)f(of)i Fs(denotational)k(e)-5 b(quivalenc)g(e:)43 b Ft(t)m(w)m(o)27 b(terms)e(are)g(denota-)0 1861 y(tionally)f(equiv)-5 b(alen)m(t)25 b(if)f(they)h(ha)m(v)m(e)i (the)e(same)h(denotation)g(\(for)f(an)m(y)h(asso)s(ciation)f(of)g(v)-5 b(alues)25 b(to)h(free)g(v)-5 b(ariables\).)0 1974 y(The)28 b(natural)f(equiv)-5 b(alence)27 b(relation)g(asso)s(ciated)i(with)d (the)j(op)s(erational)e(seman)m(tics)h(in)m(v)m(olv)m(es)g (substitution)e(of)0 2087 y(terms)k(in)m(to)h(full)d(programs,)i (describ)s(ed)e(b)s(elo)m(w.)141 2200 y(W)-8 b(e)29 b(sa)m(y)e(that)h (t)m(w)m(o)h(programs)e(of)g(PCF,)g(or)g(an)m(y)h(similar)c(language,) 29 b(are)e(op)s(erationally)f(equiv)-5 b(alen)m(t)27 b(if)f(they)0 2313 y(ha)m(v)m(e)33 b(the)f(same)h(v)-5 b(alue)31 b(under)g(the)h(op)s(erational)f(seman)m(tics.)46 b(In)31 b(sym)m(b)s(olic)f(form,)i(programs)40 b Fn(M)51 b Ft(and)39 b Fn(N)51 b Ft(are)0 2426 y(op)s(erationally)25 b(equiv)-5 b(alen)m(t)26 b(if)34 b Fs(eval)9 b Ft(\()p Fn(M)h Ft(\))26 b Fr(')f Fs(eval)10 b Ft(\()p Fn(N)g Ft(\))e(.)40 b(The)26 b(\\Kleene)h(equation")35 b Fs(eval)10 b Ft(\()p Fn(M)g Ft(\))26 b Fr(')f Fs(eval)10 b Ft(\()p Fn(N)g Ft(\))35 b(means)0 2539 y(that)d(either)40 b Fn(M)50 b Ft(and)40 b Fn(N)50 b Ft(b)s(oth)31 b(ev)-5 b(aluate)32 b(to)h(the)f(same)g(term,)h(or)f(neither)f(ev)-5 b(aluation)31 b(is)g(de\014ned.)44 b(Ho)m(w)m(ev)m(er,)0 2652 y(this)33 b(is)g(only)g(an)g(equiv)-5 b(alence)34 b(relation)f(on)g(programs,)i (not)f(arbitrary)e(terms.)51 b(W)-8 b(e)36 b(extend)d(this)g(relation)g (to)0 2765 y(terms)k(that)h(ma)m(y)g(ha)m(v)m(e)g(free)g(v)-5 b(ariables)36 b(or)h(non-observ)-5 b(able)36 b(t)m(yp)s(es)i(using)e (an)h(imp)s(ortan)m(t)f(syn)m(tactic)i(notion)0 2877 y(called)30 b(a)g(con)m(text.)141 2990 y(A)36 b Fs(c)-5 b(ontext)54 b Fr(C)5 b Ft([)36 b(])44 b(is)34 b(a)i(term)g(with)f(a)h (\\hole")g(in)e(it,)j(written)e(as)h(a)g(pair)e(of)i(empt)m(y)g(square) f(brac)m(k)m(ets.)58 b(An)0 3103 y(example)30 b(is)f(the)i(con)m(text) 1475 3239 y Fr(C)1523 3253 y Fp(0)1562 3239 y Ft([)g(])1698 3184 y Fj(def)1716 3239 y Ft(=)72 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)21 b Ft(+)f([)30 b(])0 3406 y(If)23 b(w)m(e)h(insert)f(a)h(term)g(in)m(to)f(a)h(con)m(text,)k(then) 23 b(this)f(is)h(done)h Fs(without)33 b Ft(renaming)23 b(b)s(ound)e(v)-5 b(ariables.)38 b(F)-8 b(or)24 b(example,)0 3519 y Fr(C)48 3533 y Fp(0)87 3519 y Ft([)p Fn(x)p Ft(])41 b(is)e Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)22 b Ft(+)f Fn(x)8 b Ft(.)46 b(W)-8 b(e)33 b(can)f(think)f(of)h(a)g(con)m (text)i(as)e(an)g(incomplete)g(program,)g(sitting)f(in)g(the)h (bu\013er)0 3632 y(of)39 b(a)g(text)h(editor.)65 b(Inserting)38 b(a)h(program)f(in)m(to)h(a)g(con)m(text)i(corresp)s(onds)c(to)i(using) f(the)h(text)g(editor)g(to)g(\014ll)0 3745 y(in)34 b(the)i(rest)f(of)h (the)f(program.)56 b(A)35 b(sp)s(ecial)f(case)j(is)d(the)i(empt)m(y)f (con)m(text)46 b([)36 b(])8 b(,)37 b(whic)m(h)d(corresp)s(onds)g(to)i (a)g(text)0 3858 y(editor)f(con)m(taining)h(no)f(program)h(at)g(all.)56 b(In)35 b(Exercise)g(2.3.4)j(b)s(elo)m(w,)e(the)g(empt)m(y)g(con)m (text)i(is)d(used)g(to)h(sho)m(w)0 3971 y(that)31 b(ev)-5 b(aluation)30 b(resp)s(ects)g(op)s(erational)g(equiv)-5 b(alence)29 b(for)i(programs.)141 4084 y(Using)c(con)m(texts,)k(w)m(e)e (de\014ne)e Fs(op)-5 b(er)g(ational)34 b(e)-5 b(quivalenc)g(e)35 b Ft(on)28 b(arbitrary)f(terms,)i(as)f(follo)m(ws.)39 b(T)-8 b(erms)36 b Fn(M)47 b Ft(and)0 4196 y Fn(N)f Ft(of)27 b(the)h(same)g(t)m(yp)s(e)f(are)h(op)s(erationally)e(equiv)-5 b(alen)m(t)27 b(if,)g(for)g(ev)m(ery)i(con)m(text)37 b Fr(C)5 b Ft([)28 b(])36 b(suc)m(h)27 b(that)h(b)s(oth)35 b Fr(C)5 b Ft([)p Fn(M)10 b Ft(])37 b(and)0 4309 y Fr(C)5 b Ft([)p Fn(N)10 b Ft(])37 b(are)29 b(programs,)g(w)m(e)g(ha)m(v)m(e)38 b Fs(eval)10 b Ft(\()p Fr(C)5 b Ft([)p Fn(M)10 b Ft(]\))27 b Fr(')e Fs(eval)10 b Ft(\()p Fr(C)5 b Ft([)p Fn(N)10 b Ft(]\))e(.)41 b(In)28 b(the)h(literature,)f(op)s(erational)g(equiv)-5 b(alence)28 b(is)0 4422 y(sometimes)i(called)g(\\observ)-5 b(ational)30 b(equiv)-5 b(alence")30 b(or)h(\\observ)-5 b(ational)30 b(congruence.")141 4535 y(If)k(w)m(e)h(write)42 b Fn(M)h Ft(=)821 4549 y Fm(ax)934 4535 y Fn(N)53 b Ft(for)34 b(pro)m(v)-5 b(able)34 b(equalit)m(y)g(in)f(the)i(axiomatic)g(seman)m (tics,)44 b Fn(M)f Ft(=)3266 4550 y Fm(den)3414 4535 y Fn(N)53 b Ft(for)34 b(deno-)0 4648 y(tational)d(equiv)-5 b(alence,)32 b(and)39 b Fn(M)e Ft(=)1228 4662 y Fm(op)1329 4648 y Fn(N)50 b Ft(for)31 b(op)s(erational)f(equiv)-5 b(alence,)32 b(then)f(the)h(minimal)c(requiremen)m(t)j(on)0 4761 y(the)g(three)f(seman)m(tics,)h(called)f Fs(ade)-5 b(quacy)39 b Ft(or)30 b Fs(c)-5 b(omputational)36 b(ade)-5 b(quacy,)32 b Ft(is)535 4965 y(\()p Fr(8)25 b Fs(pr)-5 b(o)g(gr)g(ams)36 b Fn(M)10 b Ft(\))26 b(\()p Fr(8)f Fs(r)-5 b(esults)34 b Fn(N)10 b Ft(\))61 b Fn(M)35 b Ft(=)1962 4979 y Fm(ax)2068 4965 y Fn(N)71 b Ft(i\013)60 b Fn(M)35 b Ft(=)2545 4980 y Fm(den)2686 4965 y Fn(N)71 b Ft(i\013)60 b Fn(M)35 b Ft(=)3163 4979 y Fm(op)3262 4965 y Fn(N)5 b(:)0 5169 y Ft(W)-8 b(e)37 b(also)f(exp)s(ect)h(that)f (for)g(arbitrary)f(terms,)i(the)f(axiomatic)h(seman)m(tics)f(are)g (sound)f(for)h(the)g(denotational)0 5282 y(seman)m(tics,)j(and)c(that)j (denotationally)d(equiv)-5 b(alen)m(t)36 b(terms)h(are)g(op)s (erationally)e(equiv)-5 b(alen)m(t.)58 b(These)36 b(ma)m(y)i(b)s(e)p eop %%Page: 77 28 77 27 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(77)0 91 y(written)29 b(as)i(the)g(follo)m(wing)d (inclusions)g(b)s(et)m(w)m(een)j(relations)e(on)h(terms:)1491 293 y(=)1562 307 y Fm(ax)1704 293 y Fr(\022)60 b Ft(=)1906 308 y Fm(den)2083 293 y Fr(\022)g Ft(=)2285 307 y Fm(op)2384 293 y Fn(:)0 494 y Ft(In)33 b(general,)h(op)s(erational)f(equiv)-5 b(alence)33 b(is)f(the)i(coarsest)h(of)e(the)h(three,)h Fs(i.e.)p Ft(,)f(more)f(terms)h(are)g(op)s(erationally)0 607 y(equiv)-5 b(alen)m(t)38 b(than)g(denotationally)g(equiv)-5 b(alen)m(t)38 b(or)g(pro)m(v)-5 b(ably)38 b(equiv)-5 b(alen)m(t.)64 b(This)37 b(is)g(not)i(an)f(acciden)m(tal)h(fact)0 720 y(ab)s(out)28 b(op)s(erational)f(seman)m(tics,)i(but)e(a)i (consequence)g(of)f(the)g(w)m(a)m(y)h(that)g(op)s(erational)e(equiv)-5 b(alence)28 b(is)f(de\014ned.)0 833 y(F)-8 b(or)32 b(example,)g(if)f(t) m(w)m(o)i(terms)40 b Fn(M)50 b Ft(and)39 b Fn(N)50 b Ft(are)32 b(not)g(op)s(erationally)e(equiv)-5 b(alen)m(t)31 b(in)g(PCF,)h(then)f(there)h(is)f(some)0 946 y(con)m(text)48 b Fr(C)5 b Ft([)39 b(])47 b(with)e Fr(C)5 b Ft([)p Fn(M)10 b Ft(])47 b(and)f Fr(C)5 b Ft([)p Fn(N)10 b Ft(])47 b(di\013eren)m(t)38 b(n)m(umerals)f(or)h(b)s(o)s(olean)g(constan)m(ts.)65 b(Consequen)m(tly)-8 b(,)40 b(if)d(w)m(e)0 1058 y(equate)48 b Fn(M)56 b Ft(and)47 b Fn(N)56 b Ft(in)37 b(the)i(axiomatic)g(seman)m (tics,)h(w)m(e)f(w)m(ould)e(ha)m(v)m(e)j(an)e(inconsisten)m(t)g(pro)s (of)g(system;)k(see)0 1171 y(Exercise)f(2.3.2.)74 b(Similar)38 b(reasoning)i(applies)f(to)j(the)f(denotational)f(seman)m(tics,)k(so)e (in)d(general)49 b(=)3623 1185 y Fm(ax)3754 1171 y Ft(and)0 1284 y(=)71 1299 y Fm(den)227 1284 y Ft(cannot)34 b(b)s(e)d(an)m(y)i (coarser)g(than)41 b(=)1432 1298 y Fm(op)1514 1284 y Ft(.)47 b(The)32 b(reason)h(wh)m(y)f(w)m(e)h(usually)d(ha)m(v)m(e)42 b(=)2995 1298 y Fm(ax)3141 1284 y Fr(\022)64 b Ft(=)3347 1299 y Fm(den)3504 1284 y Ft(is)31 b(that)i(w)m(e)0 1397 y(usually)e(justify)h(our)g(axiom)h(system)h(b)m(y)f(sho)m(wing)f(it)h (is)f(sound)g(for)h(denotational)g(seman)m(tics)h(\(whic)m(h)e(is)h (just)0 1510 y(what)39 b(=)307 1524 y Fm(ax)450 1510 y Fr(\022)61 b Ft(=)653 1525 y Fm(den)808 1510 y Ft(means\).)43 b(Since)30 b(denotational)h(equiv)-5 b(alence)30 b(is)g(usually)f(not)i (recursiv)m(ely)e(en)m(umerable,)0 1623 y(w)m(e)39 b(do)f(not)h(t)m (ypically)e(ha)m(v)m(e)i(complete)g(axiom)g(systems)f(\(systems)h (where)46 b(=)2789 1637 y Fm(ax)2916 1623 y Ft(and)h(=)3181 1638 y Fm(den)3343 1623 y Ft(are)39 b(the)f(same\))0 1736 y(for)32 b(languages)h(with)e(recursion)g(\(\014xed-p)s(oin)m(t)h (op)s(erators\).)47 b(A)33 b(related)f(fact)i(for)e(PCF)g(is)g(giv)m (en)h(as)f(Corollary)0 1849 y(2.5.16)d(in)c(Section)h(2.5.5.)41 b(The)26 b(relationship)d(b)s(et)m(w)m(een)35 b(=)2026 1864 y Fm(den)2177 1849 y Ft(and)f(=)2429 1863 y Fm(op)2537 1849 y Ft(is)25 b(discussed)f(in)h(the)i(next)f(paragraph.)141 1962 y(A)41 b(denotational)g(seman)m(tics)h(with)48 b Fn(M)53 b Ft(=)1648 1977 y Fm(den)1807 1962 y Fn(N)40 b Ft(i\013)30 b Fn(M)53 b Ft(=)2241 1976 y Fm(op)2358 1962 y Fn(N)18 b Ft(,)44 b(for)d(arbitrary)f(terms,)k(is)c(called)g Fs(ful)5 b(ly)0 2075 y(abstr)-5 b(act.)63 b Ft(A)37 b(fully)e(abstract) k(denotational)e(seman)m(tics)g(ma)m(y)h(b)s(e)f(v)m(ery)h(useful,)f (since)g(reasoning)g(ab)s(out)g(the)0 2188 y(denotational)44 b(seman)m(tics)h(therefore)f(allo)m(ws)g(us)f(to)i(reason)g(ab)s(out)52 b(=)2552 2202 y Fm(op)2634 2188 y Ft(.)82 b(This)42 b(is)h(imp)s(ortan) m(t)h(since)52 b(=)3827 2202 y Fm(op)0 2300 y Ft(is)42 b(generally)g(di\016cult)f(to)j(reason)f(ab)s(out)g(directly)-8 b(,)45 b(y)m(et)f(it)f(is)f(the)h(most)g(useful)e(form)i(of)g(equiv)-5 b(alence)42 b(for)0 2413 y(program)28 b(optimization)f(or)g (transformation.)40 b(Ho)m(w)m(ev)m(er,)30 b(it)e(is)f(generally)g(a)h (di\016cult)e(mathematical)j(problem)0 2526 y(to)37 b(construct)g (fully-abstract)f(denotational)h(seman)m(tics.)59 b(The)36 b(cp)s(o)h(seman)m(tics)g(of)g(PCF)f(in)f(Chapter)h(5,)j(for)0 2639 y(example,)e(is)d(sho)m(wn)h Fs(not)45 b Ft(to)36 b(b)s(e)f(fully)e(abstract)j(in)e(Section)h(5.4.2.)58 b(On)35 b(the)g(other)h(hand,)g(it)f(is)f(also)i(sho)m(wn)0 2752 y(in)g(Section)g(5.4.2)j(that)e(this)f(seman)m(tics)h(is)f(fully)e (abstract)k(for)f(an)f(extension)h(of)g(PCF.)g(Some)g(general)g(and)0 2865 y(historical)29 b(references)h(on)h(full)d(abstraction)i(are)h ([Cur86,)f(Mil77,)h(Plo77,)g(Sto88)q(].)0 3075 y Fk(Exercise)k(2.3.4)47 b Ft(This)22 b(exercise)j(demonstrates)g(general)f(prop)s(erties)f(of)h (ev)-5 b(aluation)24 b(and)g(op)s(erational)g(equiv-)0 3188 y(alence)36 b(that)g(hold)e(for)i(a)g(v)-5 b(ariet)m(y)36 b(of)f(languages.)57 b(F)-8 b(or)37 b(concreteness,)h(ho)m(w)m(ev)m (er,)g(the)e(problem)e(is)h(stated)h(for)0 3300 y(PCF.)j(Y)-8 b(ou)38 b(ma)m(y)h(assume)g(that)g(the)f(PCF)h(reduction)e(rules)g(are) i(con\015uen)m(t)f(and)g(that)48 b Fs(eval)56 b Ft(is)37 b(the)i(partial)0 3413 y(function)30 b(from)h(PCF)g(terms)g(to)h(PCF)f (terms)g(suc)m(h)g(that)40 b Fs(eval)10 b Ft(\()p Fn(M)g Ft(\))28 b(=)e Fn(N)50 b Ft(i\013)39 b Fn(N)49 b Ft(is)30 b(the)i(unique)d(normal)h(form)0 3526 y(of)42 b Fn(M)19 b Ft(.)51 b(Sho)m(w)34 b(that)g(if)f(programs)42 b Fn(M)52 b Ft(and)42 b Fn(N)52 b Ft(are)35 b(op)s(erationally)d(equiv)-5 b(alen)m(t,)34 b(then)42 b Fs(eval)10 b Ft(\()p Fn(M)g Ft(\))32 b Fr(')f Fs(eval)10 b Ft(\()p Fn(N)g Ft(\))e(.)0 3639 y(Assuming)34 b(that)j(all)e(programs)h(with)e(no)i(normal)f(form) h(are)g(op)s(erationally)f(equiv)-5 b(alen)m(t,)37 b(whic)m(h)e(is)g (justi\014ed)0 3752 y(for)e(PCF)g(in)g(Exercise)g(2.5.27,)j(sho)m(w)e (that)g(if)40 b Fn(M)52 b Ft(and)41 b Fn(N)52 b Ft(are)34 b(programs)f(with)40 b Fs(eval)10 b Ft(\()p Fn(M)g Ft(\))31 b Fr(')f Fs(eval)10 b Ft(\()p Fn(N)g Ft(\))e(,)35 b(then)0 3865 y Fn(M)49 b Ft(and)38 b Fn(N)48 b Ft(are)31 b(op)s(erationally)e (equiv)-5 b(alen)m(t.)0 4075 y Fk(Exercise)35 b(2.3.5)47 b Ft(In)22 b(Section)h(2.3.1,)k(w)m(e)c(de\014ned)f(programs)h(as)g (closed)g(terms)g(of)g(observ)-5 b(able)22 b(t)m(yp)s(e,)j(and)e(c)m (hose)0 4188 y Fs(nat)49 b Ft(and)39 b Fs(b)-5 b(o)g(ol)51 b Ft(as)32 b(observ)-5 b(able.)43 b(Sho)m(w)31 b(that)h(the)g(relation) 39 b(=)2165 4202 y Fm(op)2278 4188 y Ft(remains)30 b(the)i(same)g(if)e (w)m(e)i(c)m(hange)h(the)f(set)g(of)0 4300 y(observ)-5 b(able)30 b(t)m(yp)s(es)g(in)f(the)i(follo)m(wing)e(w)m(a)m(ys.)66 4486 y(\(a\))46 b(Only)37 b Fs(nat)48 b Ft(is)30 b(considered)f(observ) -5 b(able.)61 4672 y(\(b\))45 b(W)-8 b(e)22 b(sa)m(y)30 b Fn(\034)40 b Ft(is)20 b(an)h(observ)-5 b(able)20 b(t)m(yp)s(e)h(if)29 b Fn(\034)39 b Ft(is)20 b(either)29 b Fs(nat)17 b Ft(,)32 b Fs(b)-5 b(o)g(ol)19 b Ft(,)k(or)e(the)g(pro)s(duct)28 b Fn(\034)2982 4686 y Fp(1)3037 4672 y Fr(\002)15 b Fn(\034)3163 4686 y Fp(2)3231 4672 y Ft(of)21 b(t)m(w)m(o)i(observ)-5 b(able)227 4785 y(t)m(yp)s(es)39 b Fn(\034)516 4799 y Fp(1)594 4785 y Ft(and)f Fn(\034)819 4799 y Fp(2)866 4785 y Ft(.)0 4995 y Fk(Exercise)d(2.3.6)47 b Ft(Sho)m(w)30 b(that)i(if)39 b Fs(eval)49 b Ft(is)30 b(a)h(partial)f(recursiv)m(e)h (function)f(on)h(a)g(recursiv)m(ely)f(en)m(umerable)g(lan-)0 5108 y(guage,)i(then)d(op)s(erational)g(equiv)-5 b(alence)30 b(is)37 b(\005)1613 5075 y Fp(0)1613 5131 y(2)1661 5108 y Ft(.)k(\(This)28 b(assumes)i(some)g(familiarit)m(y)e(with)h(recursiv) m(e)g(function)0 5221 y(theory)-8 b(.\))p eop %%Page: 78 29 78 28 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(78)0 91 y Fu(2.4)135 b(PCF)45 b(Reduction)g(and)g (Sym)l(b)t(olic)g(In)l(terpreters)0 298 y Fo(2.4.1)112 b(Nondeterministic)34 b(reduction)0 469 y Ft(The)j(op)s(erational)g (seman)m(tics)h(giv)m(en)g(b)m(y)f(reduction)g(ma)m(y)h(b)s(e)f (regarded)h(as)g(a)g(\\nondeterministic)e(sym)m(b)s(olic)0 582 y(in)m(terpreter.")81 b(Ho)m(w)m(ev)m(er,)49 b(only)43 b(the)h(order)f(in)f(whic)m(h)h(subterms)f(are)i(reduced)f(is)g (nondeterministic,)i(not)0 695 y(the)38 b(\014nal)f(result)g(of)h (reducing)f(all)g(p)s(ossible)f(subterms.)63 b(Section)38 b(2.4.3)i(presen)m(ts)e(a)g(deterministic)e(form)i(of)0 808 y(reduction)31 b(that)h(giv)m(es)g(the)g(same)g(\014nal)e(results)h (for)g(terminating)g(PCF)g(programs,)h(and)g(Section)f(2.4.4)j(giv)m (es)0 921 y(a)i(related)f(\\parallel")g(form)g(of)g(reduction.)55 b(An)35 b(inequiv)-5 b(alen)m(t)34 b(but)h(often)h(used)e (deterministic)g(reduction)g(is)0 1034 y(considered)29 b(in)g(Section)h(2.4.5.)141 1147 y(In)k(general,)h(giv)m(en)f(an)m(y)h (set)f(of)g(reduction)g(rules,)f(w)m(e)i(sa)m(y)43 b Fn(M)53 b Fs(r)-5 b(e)g(duc)g(es)37 b(to)79 b Fn(N)52 b Fs(in)36 b(one)h(step,)70 b Ft(and)34 b(write)0 1260 y Fn(M)50 b Fr(!)39 b Fn(N)19 b Ft(,)41 b(if)46 b Fn(N)58 b Ft(ma)m(y)39 b(b)s(e)g(obtained)f(from)47 b Fn(M)57 b Ft(b)m(y)39 b(applying)e(one)i(reduction)f(rule)g(to)i(one)f Fs(sub)-5 b(expr)g(ession.)0 1372 y Ft(F)d(or)43 b(an)m(y)g(notion)50 b Fr(!)g Ft(of)43 b(reduction,)h(the)f(corresp)s(onding)d(m)m (ulti-step)h(reduction)g(relation)50 b Fr(!)-61 b(!)51 b Ft(is)41 b(de\014ned)0 1485 y(inductiv)m(ely)28 b(b)m(y)1152 1590 y Fn(M)35 b Fr(!)-61 b(!)25 b Fn(N)124 b Ft(if)112 b Fn(M)35 b Ft(=)1978 1604 y Fm(\013)2053 1590 y Fn(N)5 b(;)46 b Ft(or)1784 1703 y Fn(M)35 b Fr(!)26 b Fn(M)2122 1670 y Fi(0)2175 1703 y Ft(and)k Fn(M)2450 1670 y Fi(0)2499 1703 y Fr(!)-61 b(!)25 b Fn(N)5 b(:)0 1863 y Ft(In)28 b(other)h(w)m(ords,)37 b Fr(!)-61 b(!)38 b Ft(is)27 b(the)i(least)h (re\015exiv)m(e)e(and)g(transitiv)m(e)h(relation)f(on)37 b Fn(\013)9 b Ft(-equiv)-5 b(alence)28 b(classes)h(of)g(expres-)0 1975 y(sions)g(that)i(con)m(tains)g(one-step)g(reduction.)0 2188 y Fk(Example)j(2.4.1)46 b Ft(Some)34 b(di\013erences)g(b)s(et)m(w) m(een)h(one-step)g(reduction)e(\()8 b Fr(!)g Ft(\),)36 b(equalit)m(y)e(\()8 b(=)g(\),)36 b(and)e(m)m(ulti-step)0 2301 y(reduction)29 b(\()8 b Fr(!)-61 b(!)8 b Ft(\))32 b(are)f(illustrated)d(using)h(PCF)h(b)s(elo)m(w.)49 2502 y(\()p Fn(a)p Ft(\))84 b(\()p Fl(if)47 b Fn(M)58 b Fl(then)47 b Ft(3)20 b(+)g(4)48 b Fl(else)f Ft(7\))26 b(=)f(\()p Fl(if)48 b Fn(M)57 b Fl(then)47 b Ft(7)h Fl(else)f Ft(3)21 b(+)e(4\))104 b(since)30 b(w)m(e)h(ha)m(v)m(e)h(3)20 b(+)g(4)26 b(=)f(7)31 b(and)2739 2615 y(equations)g(can)f(b)s(e)g(used) g(in)2739 2728 y(either)g(direction)49 2919 y(\()p Fn(b)p Ft(\))93 b(\()p Fl(if)47 b Fn(M)58 b Fl(then)47 b Ft(3)20 b(+)g(4)48 b Fl(else)f Ft(7\))26 b Fr(6!)f Ft(\()p Fl(if)48 b Fn(M)58 b Fl(then)46 b Ft(7)i Fl(else)f Ft(3)21 b(+)f(4\))83 b(since)30 b(7)c Fr(6!)f Ft(3)c(+)f(4)49 3111 y(\()p Fn(c)p Ft(\))93 b(5)20 b(+)g(2)26 b Fr(!)-61 b(!)25 b Ft(5)c(+)f(2)31 b(but)e(5)21 b(+)f(2)26 b Fr(6!)f Ft(5)20 b(+)g(2)1171 b(since)30 b(one-step)h(reduction)2739 3223 y(is)f(not)h(re\015exiv)m(e)49 3415 y(\()p Fn(d)p Ft(\))85 b Fl(if)47 b Ft(\()p Fs(Eq)8 b Ft(?)15 b(3)g(4\))49 b Fl(then)e Ft(5)20 b(+)g(2)48 b Fl(else)f Ft(9)26 b Fr(!)-61 b(!)25 b Ft(9)962 b(b)m(y)31 b(\014rst)e(reducing)g(\()p Fs(Eq)8 b Ft(?)15 b(3)g(4\))p 3861 3587 40 40 v 0 3800 a(It)31 b(is)f(easy)i(to)f(see)h(from)f(the)g(de\014nition)d(of)k (reduction)d(that)j(if)38 b Fn(M)f Fr(!)-61 b(!)26 b Fn(N)18 b Ft(,)32 b(then)e(w)m(e)i(can)f(pro)m(v)m(e)h(the)f(equation)0 3913 y Fn(M)k Ft(=)25 b Fn(N)19 b Ft(.)40 b(It)31 b(follo)m(ws)e(that)i (if)38 b Fn(M)d Fr(!)-61 b(!)26 b Fn(N)48 b Ft(and)38 b Fn(P)h Fr(!)-61 b(!)25 b Fn(N)18 b Ft(,)31 b(w)m(e)g(can)f(also)h (pro)m(v)m(e)39 b Fn(M)c Ft(=)25 b Fn(P)d Ft(.)141 4026 y(F)-8 b(or)37 b(most)f(notions)f(of)h(reduction,)g(a)g(term)g(ma)m(y)h (b)s(e)e(reduced)g(in)f(sev)m(eral)i(w)m(a)m(ys.)58 b(The)35 b(reason)h(is)f(that)i(a)0 4139 y(term)32 b(ma)m(y)g(ha)m(v)m(e)g(man)m (y)g(di\013eren)m(t)f(subterms,)g(eac)m(h)h(matc)m(hing)g(the)g (left-hand)e(side)h(of)g(a)h(di\013eren)m(t)f(reduction)0 4251 y(rule.)39 b(W)-8 b(e)29 b(ma)m(y)f(think)f(of)h(reduction)f(as)h (de\014ning)e(a)i(nondeterministic)d(sym)m(b)s(olic)i(in)m(terpreter)g (that)h(ev)-5 b(aluates)0 4364 y(an)25 b(expression)32 b Fn(M)44 b Ft(b)m(y)25 b(rep)s(eatedly)f(c)m(ho)s(osing)h(a)h (reduction)e(to)i(apply)d(or)j(c)m(ho)s(osing)e(to)i(halt.)39 b(A)m(t)26 b(eac)m(h)g(step,)h(the)0 4477 y(\\state")k(of)d(the)h(in)m (terpreter)e(is)h(c)m(haracterized)h(b)m(y)g(the)f(expression)f(that)i (is)f(pro)s(duced.)38 b(W)-8 b(e)30 b(ha)m(v)m(e)f(a)g(reduction)0 4590 y(sequence)40 b Fn(M)c Fr(!)-61 b(!)26 b Fn(N)49 b Ft(i\013)30 b(this)g(nondeterministic)e(in)m(terpreter,)j(executing) 39 b Fn(M)19 b Ft(,)31 b(ma)m(y)g(c)m(ho)s(ose)h(to)g(halt)e(in)g (state)0 4703 y Fn(N)18 b Ft(.)39 b(A)25 b(necessarily)f(halting)g (state,)k(whic)m(h)c(is)g(a)h(term)34 b Fn(N)43 b Ft(with)32 b Fn(N)j Fr(6!)25 b Fn(P)47 b Ft(for)24 b(an)m(y)34 b Fn(P)21 b Ft(,)27 b(is)d(called)g(a)i Fs(normal)j(form.)0 4816 y Ft(Some)k(example)f(PCF)h(normal)f(forms)g(are)h(the)g(truth)g (v)-5 b(alues)40 b Fs(true)48 b Ft(and)41 b Fs(false)15 b Ft(,)34 b(the)f(n)m(umerals)40 b(0)p Fn(;)15 b Ft(1)p Fn(;)g Ft(2)p Fn(;)g(:)g(:)g(:)d Ft(,)34 b(a)0 4929 y(tuple)48 b Fr(h)p Fn(M)374 4943 y Fp(1)414 4929 y Fn(;)15 b(:)g(:)g(:)i(;)e(M) 704 4944 y Fm(k)747 4929 y Fr(i)49 b Ft(of)41 b(distinct)e(normal)h (forms,)j(and)d(an)m(y)h(function)e(expression)48 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)60 b Ft(with)47 b Fn(M)59 b Ft(in)0 5042 y(normal)31 b(form.)44 b(W)-8 b(e)33 b(consider)d(the)i(result)f (of)g(nondeterministic)e(ev)-5 b(aluation)32 b(to)g(b)s(e)f(the)h(set)g (of)g(normal)f(forms)0 5155 y(pro)s(duced.)50 b(As)34 b(w)m(e)g(shall)f(see)h(b)s(elo)m(w,)g(there)h(is)e(at)h(most)h(one)f (normal)f(form)g(of)i(an)m(y)f(PCF)g(term,)h(in)d(spite)i(of)0 5268 y(the)d(nondeterministic)c(c)m(hoices)k(in)m(v)m(olv)m(ed.)p eop %%Page: 79 30 79 29 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(79)141 91 y(A)36 b(useful)e(prop)s(ert)m(y)g(of)i (man)m(y)g(sets)g(of)g(reduction)e(rules,)i(and)f(PCF)g(reduction)f(in) h(particular,)g(is)g(called)0 204 y Fs(c)-5 b(on\015uenc)g(e,)34 b Ft(or)f(the)h Fs(Chur)-5 b(ch-R)g(osser)37 b(pr)-5 b(op)g(erty,)70 b Ft(also)33 b(men)m(tioned)f(in)g(Section)h(1.3.)49 b(This)32 b(prop)s(ert)m(y)g(ma)m(y)i(b)s(e)0 317 y(sk)m(etc)m(hed)e (graphically)c(as)j(follo)m(ws.)1735 490 y Fn(M)1748 1207 y(P)1331 816 y(N)1404 830 y Fp(1)2124 816 y Fn(N)2197 830 y Fp(2)1701 584 y Fg(\000)1618 667 y(\000)1535 750 y(\000)1485 800 y(\000)-83 b(\011)1701 584 y(\000)1618 667 y(\000)1535 750 y(\000)1502 783 y(\000)g(\011)1784 584 y(@)1867 667 y(@)1950 750 y(@)2000 800 y(@)g(R)1784 584 y(@)1867 667 y(@)1950 750 y(@)1983 783 y(@)g(R)1468 891 y(@)1551 974 y(@)1635 1057 y(@)1684 1107 y(@)g(R)1468 891 y(@)1551 974 y(@)1635 1057 y(@)1668 1090 y(@)g(R)2016 891 y(\000)1933 974 y(\000)1850 1057 y(\000)1801 1107 y(\000)g(\011)2016 891 y(\000)1933 974 y(\000)1850 1057 y(\000)1817 1090 y(\000)g(\011)0 1436 y Ft(In)28 b(this)g(picture,)h (the)g(top)g(t)m(w)m(o)h(arro)m(ws)f(are)h(univ)m(ersally)c(quan)m (ti\014ed,)j(and)f(the)h(b)s(ottom)h(t)m(w)m(o)g(are)f(existen)m (tially)0 1549 y(quan)m(ti\014ed.)46 b(So)33 b(the)g(picture)f(\\sa)m (ys")i(that)f(whenev)m(er)41 b Fn(M)e Fr(!)-61 b(!)29 b Fn(N)2310 1563 y Fp(1)2391 1549 y Ft(and)40 b Fn(M)f Fr(!)-61 b(!)30 b Fn(N)2929 1563 y Fp(2)2976 1549 y Ft(,)k(there)f (exists)f(a)h(term)41 b Fn(P)0 1662 y Ft(with)g Fn(N)292 1676 y Fp(1)364 1662 y Fr(!)-61 b(!)32 b Fn(P)55 b Ft(and)43 b Fn(N)893 1676 y Fp(2)964 1662 y Fr(!)-61 b(!)32 b Fn(P)21 b Ft(.)53 b(F)-8 b(rom)35 b(Theorem)f(8.3.24)j(in)c(Section)h(8.3.4,)j (w)m(e)e(ha)m(v)m(e)h(the)e(follo)m(wing)f(fact)0 1774 y(ab)s(out)d(PCF.)0 1987 y Fk(Prop)s(osition)36 b(2.4.2)47 b Fs(PCF)32 b(r)-5 b(e)g(duction)34 b(is)f(c)-5 b(on\015uent.)141 2199 y Ft(If)248 2193 y Fr(!)385 2199 y Ft(is)37 b(determined)g(b)m(y)h (directing)e(a)j(set)f(of)g(equational)g(axioms,)i(then)d(con\015uence) h(implies)d(that)k(an)0 2312 y(equation)c(is)f(pro)m(v)-5 b(able)35 b(i\013)f(b)s(oth)h(terms)g(reduce)g(to)h(a)f(common)h(form.) 54 b(A)35 b(corollary)g(is)f(that)i(if)e(t)m(w)m(o)j(distinct)0 2425 y(terms)j(cannot)h(b)s(e)e(reduced)h(at)h(all,)h(they)e(cannot)h (b)s(e)e(pro)m(v)m(ed)i(equal.)69 b(This)39 b(pro)m(vides)g(a)i(useful) d(syn)m(tactic)0 2538 y(tec)m(hnique)43 b(for)g(sho)m(wing)g(that)h(an) f(equational)g(pro)s(of)f(system)i(do)s(es)f(not)g(pro)m(v)m(e)h(all)f (equations.)79 b(Another)0 2651 y(simple)33 b(corollary)i(of)h (con\015uence)f(is)g(that)h(no)f(term)g(has)h(more)f(than)g(one)h (normal)e(form.)56 b(These)35 b(and)g(other)0 2764 y(general)30 b(consequences)h(of)g(con\015uence)f(are)h(pro)m(v)m(ed)g(in)e(Section) h(3.7.2.)141 2877 y(T)-8 b(o)36 b(illustrate)f(the)h(v)-5 b(alue)35 b(of)h(con\015uence)g(in)f(analyzing)g(a)h(pro)s(of)f (system,)j(w)m(e)e(justify)e(the)j(statemen)m(t)g(in)0 2990 y(Section)30 b(2.2.3)i(that)40 b(\()p Fs(sp)6 b Ft(\))39 b(is)30 b(not)g(deriv)-5 b(able)29 b(from)38 b(\()p Fs(pr)-5 b(oj)15 b Ft(\))8 b(.)0 3202 y Fk(Example)34 b(2.4.3)46 b Ft(Consider)28 b(the)i(reduction)f(system)h(with)f(only)g (t)m(w)m(o)j(reduction)c(axioms,)39 b Fk(Pro)6 b(j)3457 3225 y Fp(1)3497 3202 y Fr(h)p Fn(M)f(;)15 b(N)10 b Fr(i)26 b(!)0 3315 y Fn(M)61 b Ft(and)50 b Fk(Pro)6 b(j)550 3338 y Fp(2)590 3315 y Fr(h)p Fn(M)f(;)15 b(N)10 b Fr(i)46 b(!)f Fn(N)18 b Ft(.)76 b(This)41 b(system)h(ma)m(y)h(b)s(e)f(pro)m(v)m (ed)g(con\015uen)m(t)h(and)e(therefore)i(an)f(equation)0 3428 y(is)f(pro)m(v)-5 b(able)41 b(from)g(the)h(t)m(w)m(o)h(equational) f(axioms)49 b Fk(Pro)6 b(j)2039 3451 y Fp(1)2078 3428 y Fr(h)p Fn(M)f(;)15 b(N)10 b Fr(i)46 b Ft(=)e Fn(M)60 b Ft(and)49 b Fk(Pro)6 b(j)3074 3451 y Fp(2)3113 3428 y Fr(h)p Fn(M)f(;)15 b(N)10 b Fr(i)46 b Ft(=)d Fn(N)60 b Ft(using)0 3541 y(re\015exivit)m(y)31 b(and)h(the)g(PCF)h(equational) e(inference)h(rules)f(i\013)g(the)h(t)m(w)m(o)i(terms)e(reduce)g(to)h (a)g(common)f(term.)47 b(It)0 3654 y(follo)m(ws)34 b(that)i(the)f (equation)43 b Fn(x)33 b Ft(=)g Fr(h)p Fk(Pro)6 b(j)1479 3677 y Fp(1)1518 3654 y Fn(x;)15 b Fk(Pro)6 b(j)1815 3677 y Fp(2)1855 3654 y Fn(x)p Fr(i)43 b Ft(cannot)36 b(b)s(e)e(pro)m(v)m(ed)h(from)43 b Fk(Pro)6 b(j)3149 3677 y Fp(1)3188 3654 y Fr(h)p Fn(M)f(;)15 b(N)10 b Fr(i)34 b Ft(=)f Fn(M)54 b Ft(and)0 3767 y Fk(Pro)6 b(j)205 3789 y Fp(2)244 3767 y Fr(h)p Fn(M)f(;)15 b(N)10 b Fr(i)26 b Ft(=)f Fn(N)19 b Ft(,)30 b(since)38 b Fn(x)h Ft(and)f Fr(h)p Fk(Pro)6 b(j)1546 3789 y Fp(1)1585 3767 y Fn(x;)15 b Fk(Pro)6 b(j)1882 3789 y Fp(2)1921 3767 y Fn(x)p Fr(i)39 b Ft(are)31 b(distinct)e(normal)g(forms.)p 3861 3767 40 40 v 141 3979 a(While)i(most)i(of)f(us)g(are)g(used)g(to)h (deterministic)d(execution,)j(there)f(are)h(some)g(reasons)f(to)h (consider)e(non-)0 4092 y(deterministic)j(ev)-5 b(aluation.)58 b(A)36 b(common)h(reason)f(for)g(the)h(designers)e(of)h(a)h (programming)e(language)i(not)f(to)0 4205 y(sp)s(ecify)j(the)h(order)g (of)h(ev)-5 b(aluation)40 b(completely)g(is)f(that)i(this)e(allo)m(ws)h (greater)h(\015exibilit)m(y)d(in)h(optimization.)0 4318 y(An)d(example)g(of)h(optimization)e(is)h(common)g(sub)s(expression)e (elimination,)h(whic)m(h)h(e\013ectiv)m(ely)h(reorders)f(the)0 4431 y(ev)-5 b(aluation)34 b(of)g(parts)g(of)h(an)f(expression.)52 b(A)34 b(related)g(issue)f(is)h(parallelism.)49 b(If)34 b(w)m(e)h(are)g(allo)m(w)m(ed)f(to)h(ev)-5 b(aluate)0 4544 y(parts)34 b(of)g(an)g(expression)e(in)h(an)m(y)h(order,)h(then)e (it)h(w)m(ould)e(b)s(e)i(p)s(ossible)d(to)k(ev)-5 b(aluate)34 b(parts)g(of)g(the)g(expression)0 4657 y(in)f(parallel,)h(without)f (concern)i(for)f(the)h(relativ)m(e)g(sp)s(eeds)e(of)i(the)f(pro)s (cessors)g(in)m(v)m(olv)m(ed.)53 b(Ho)m(w)m(ev)m(er,)38 b(in)33 b(man)m(y)0 4770 y(languages)i(where)g(the)h(design)e(do)s(es)h (not)g(fully)e(determine)h(the)i(order)e(of)i(ev)-5 b(aluation,)36 b(the)f(output)g(of)h(some)0 4883 y(programs)i(accepted)i(b)m(y)e(the)h (compiler)e(ma)m(y)i(dep)s(end)d(on)j(ev)-5 b(aluation)37 b(order.)65 b(In)37 b(con)m(trast,)42 b(con\015uence)d(of)0 4996 y(PCF)f(guaran)m(tees)i(that)e(the)h(\014nal)e(result)g(do)s(es)h (not)g(dep)s(end)e(on)i(the)h(order)f(in)e(whic)m(h)h(sub)s (expressions)f(are)0 5109 y(ev)-5 b(aluated.)141 5221 y(The)26 b(reason)h(w)m(e)h(do)e(not)h(use)g(reduction)e(axioms)i (corresp)s(onding)e(to)i(equational)f(axioms)35 b(\()p Fn(\021)s Ft(\))h(and)f(\()p Fn(sp)p Ft(\))g(is)0 5334 y(that)e(these)g(w)m(ould)e(destro)m(y)h(con\015uence.)47 b(It)32 b(is)g(acceptable)h(to)g(omit)f(these)h(t)m(w)m(o)g(reductions) e(since)h(these)h(are)p eop %%Page: 80 31 80 30 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(80)0 91 y(not)24 b(necessary)g(for)g(reducing)e (programs;)k(reduction)d(based)h(on)32 b(\()p Fn(\021)s Ft(\))h(and)e(\()p Fn(sp)p Ft(\))h(only)23 b(a\013ects)j(the)e(normal)f (forms)0 204 y(of)31 b(terms)g(that)g(either)f(ha)m(v)m(e)i(free)f(v)-5 b(ariables)30 b(or)h(are)g(not)g(of)g(observ)-5 b(able)30 b(t)m(yp)s(e.)42 b(This)29 b(is)h(an)h(easy)g(consequence)0 317 y(of)c(computational)f(adequacy)h(\(Corollary)f(5.4.7\).)42 b(In)m(tuitiv)m(ely)-8 b(,)26 b(the)h(reason)g(that)36 b(\()p Fn(\021)s Ft(\))g(is)26 b(unnecessary)g(is)f(that)0 430 y(if)k(w)m(e)i(ha)m(v)m(e)h(a)f(reduction)e(of)h(the)h(form)874 628 y Fn(M)65 b Fr(!)-61 b(!)56 b Ft(\()15 b Fn(:)g(:)g(:)32 b Ft(\()p Fn(\025x)p Ft(:)15 b Fn(\033)t(:)g(M)10 b(x)p Ft(\))31 b Fn(:)15 b(:)g(:)h Ft(\))2085 622 y Fr(!)2206 628 y Ft(\()f Fn(:)g(:)g(:)32 b Ft(\()p Fn(M)10 b Ft(\))31 b Fn(:)15 b(:)g(:)h Ft(\))56 b Fr(!)-61 b(!)56 b Ft(5)0 825 y(for)26 b(example,)h(then)f(since)f(the)i(result)33 b(5)i(do)s(es)26 b(not)h(con)m(tain)f(an)m(y)h(function)e(expressions,) h(the)g(function)f(expres-)0 938 y(sion)36 b Fn(M)46 b Ft(m)m(ust)29 b(ev)m(en)m(tually)f(b)s(e)g(applied)e(to)j(an)f (argumen)m(t)h(or)f(discarded)f(in)g(the)i(reduction)35 b(\()15 b Fn(:)g(:)g(:)32 b Ft(\()p Fn(M)10 b Ft(\))31 b Fn(:)15 b(:)g(:)h Ft(\))26 b Fr(!)0 1051 y(!)34 b Ft(5)8 b(.)57 b(If)44 b Fn(M)53 b Ft(is)35 b(applied,)g(sa)m(y)h(in)f(a)h (subterm)43 b Fn(M)10 b(N)18 b Ft(,)37 b(then)e(w)m(e)h(w)m(ould)f(get) i(the)e(same)h(result)f(if)g(w)m(e)h(had)f(not)0 1164 y(used)f(\()p Fn(\021)s Ft(\))i(and)26 b(had)h(stuc)m(k)g(with)34 b Fn(\025x)p Ft(:)15 b Fn(\033)s(:)h(M)10 b(x)35 b Ft(in)25 b(place)i(of)35 b Fn(M)18 b Ft(,)28 b(since)34 b(\()p Fn(\025x)p Ft(:)15 b Fn(\033)t(:)h(M)10 b(x)p Ft(\))p Fn(N)45 b Ft(reduces)26 b(to)36 b Fn(M)10 b(N)45 b Ft(b)m(y)35 b(\()p Fn(\014)5 b Ft(\))0 1277 y(alone.)41 b(The)30 b(situation)f(for)h(surjectiv)m(e)g(pairing)f(is)g(essen)m(tially)g (similar.)0 1483 y Fk(Example)34 b(2.4.4)46 b Ft(Consider)29 b(the)h(expression)530 1681 y Fl(letrec)46 b Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)9 b Ft(\):)15 b Fs(nat)35 b Ft(=)25 b Fl(if)48 b Fs(Eq)8 b Ft(?)14 b Fn(x)h Ft(0)48 b Fl(then)f Ft(0)h Fl(else)f Fn(x)20 b Ft(+)g Fn(f)10 b Ft(\()p Fn(x)20 b Fr(\000)g Ft(1\))48 b Fl(in)f Fn(f)25 b(n)0 1879 y Ft(whic)m(h)h(w)m(e)i(w)m(ould)d(exp)s(ect)j(to)g(pro)s (duce)e(the)h(natural)g(n)m(um)m(b)s(er)34 b Fn(n)p Ft(\()p Fn(n)14 b Ft(+)g(1\))p Fn(=)p Ft(2)8 b(,)29 b(under)c(an)m(y)j (ordinary)d(in)m(terpreter.)0 1991 y(W)-8 b(e)38 b(can)g(see)f(ho)m(w)h (the)f(nondeterministic)d(PCF)j(in)m(terpreter)g(w)m(orks)g(b)m(y)g (eliminating)d(syn)m(tactic)39 b(sugar)e(and)0 2104 y(reducing.)i (Letting)599 2325 y Fn(F)726 2270 y Fj(def)743 2325 y Ft(=)73 b Fn(\025f)10 b Ft(:)15 b Fs(nat)1186 2319 y Fr(!)1292 2325 y Fs(nat)9 b Fn(:\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)p Fl(if)48 b Fs(Eq)8 b Ft(?)15 b Fn(x)g Ft(0)48 b Fl(then)e Ft(0)j Fl(else)d Fn(x)20 b Ft(+)g Fn(f)10 b Ft(\()p Fn(x)20 b Fr(\000)g Ft(1\))0 2523 y(and)30 b(taking)38 b Fn(n)25 b Ft(=)g(2)8 b(,)31 b(w)m(e)g(ha)m(v)m(e)h(the)e (follo)m(wing)f(reduction)h(sequence.)219 2713 y(\()p Fs(\014x)42 b Fn(F)13 b Ft(\))i(2)84 b Fr(!)-61 b(!)84 b Ft(\()p Fn(\025f)10 b Ft(:)15 b Fs(nat)1178 2707 y Fr(!)1284 2713 y Fs(nat)10 b Fn(:\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)p Fl(if)47 b Fs(Eq)8 b Ft(?)15 b Fn(x)g Ft(0)48 b Fl(then)f Ft(0)h Fl(else)f Fn(x)20 b Ft(+)g Fn(f)10 b Ft(\()p Fn(x)19 b Fr(\000)h Ft(1\)\))15 b(\()p Fs(\014x)44 b Fn(F)13 b Ft(\))i(2)639 2825 y Fr(!)-61 b(!)84 b Fl(if)47 b Fs(Eq)8 b Ft(?)14 b(2)h(0)49 b Fl(then)e Ft(0)h Fl(else)f Ft(2)20 b(+)g(\()p Fs(\014x)42 b Fn(F)13 b Ft(\)\(1\))639 2938 y Fr(!)-61 b(!)84 b Ft(2)20 b(+)g Fl(if)47 b Fs(Eq)8 b Ft(?)15 b(1)g(0)49 b Fl(then)d Ft(0)j Fl(else)d Ft(1)21 b(+)f(\()p Fs(\014x)42 b Fn(F)13 b Ft(\)\(0\))639 3051 y Fr(!)-61 b(!)84 b Ft(2)20 b(+)g(1)h(+)f(\()p Fs(\014x)42 b Fn(F)13 b Ft(\)\(0\))639 3164 y Fr(!)-61 b(!)84 b Ft(2)20 b(+)g(1)h(+)f(0)25 b Fr(!)-61 b(!)26 b Ft(3)0 3354 y(Of)k(course,)g (other)h(reduction)e(sequences)h(ma)m(y)h(b)s(e)f(obtained)f(b)m(y)h(c) m(ho)s(osing)g Fs(\014x)11 b Ft(-reduction)30 b(in)f(place)h(of)g(an)m (y)h(of)0 3467 y(the)26 b(reduction)f(steps)g(used)g(here.)39 b(Ho)m(w)m(ev)m(er,)29 b(b)m(y)d(the)g(con\015uence)g(of)f(PCF)h (reduction,)g(an)m(y)g(\014nite)f(in)m(terlea)m(ving)0 3580 y(of)31 b Fs(\014x)11 b Ft(-reductions)29 b(w)m(ould)g(still)g (yield)f(an)j(expression)e(that)i(reduces)f(to)39 b(3)8 b(.)p 3861 3580 40 40 v 0 3786 a Fk(Example)34 b(2.4.5)46 b Ft(Consider)30 b(the)j(expression)39 b Fl(letrec)46 b Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)9 b Ft(\):)15 b Fs(nat)39 b Ft(=)27 b Fn(f)10 b Ft(\()p Fn(x)21 b Ft(+)g(1\))49 b Fl(in)e Fn(f)24 b Ft(1)8 b(.)47 b(If)32 b(w)m(e)g(write)g(a)0 3899 y(similar)d(function)h(declaration)h(in)f(another)i(language)g (lik)m(e)f(Lisp)e(or)j(P)m(ascal,)h(w)m(e)f(w)m(ould)e(exp)s(ect)40 b Fn(f)10 b Ft(\()p Fn(n)p Ft(\))39 b(not)32 b(to)0 4012 y(terminate)j(\(except)h(with)d(stac)m(k)k(o)m(v)m(er\015o)m(w\),)g (regardless)e(of)f(the)h(v)-5 b(alue)35 b(of)43 b Fn(n)8 b Ft(.)54 b(This)33 b(is)g(re\015ected)j(in)d(the)i(fact)0 4125 y(that)c(the)g(PCF)f(expression)f(has)h(no)g(normal)g(form.)40 b(Letting)1160 4346 y Fn(F)1316 4290 y Fj(def)1334 4346 y Ft(=)103 b Fn(\025f)10 b Ft(:)15 b Fs(nat)1807 4340 y Fr(!)1913 4346 y Fs(nat)9 b Fn(:\025x)p Ft(:)15 b Fs(nat)10 b Fn(:f)g Ft(\()p Fn(x)21 b Ft(+)e(1\))p Fn(;)0 4543 y Ft(w)m(e)42 b(can)f(de{sugar)h(the)f Fl(letrec)f Ft(expression)g(to) 51 b(\()p Fn(\025f)10 b Ft(:)15 b Fs(nat)2122 4537 y Fr(!)2228 4543 y Fs(nat)10 b Fn(:)15 b(f)24 b Ft(1\)\()p Fs(\014x)54 b Fn(F)13 b Ft(\))8 b(.)74 b(Then)41 b(w)m(e)g(can)h (reduce)f(to)0 4656 y(\()p Fs(\014x)h Fn(F)13 b Ft(\)1)26 b Fr(!)f Fn(F)13 b Ft(\()p Fs(\014x)42 b Fn(F)13 b Ft(\)1)8 b(.)42 b(A)m(t)31 b(this)f(p)s(oin)m(t,)f(there)i(are)g(t)m(w)m(o)g(p)s (ossibilities)1103 4944 y Fn(F)13 b Ft(\()p Fs(\014x)41 b Fn(F)13 b Ft(\)1)27 b Fr(!)1637 4772 y Fh(8)1637 4847 y(<)1637 4996 y(:)1752 4858 y Fn(F)h Ft(\()p Fn(F)13 b Ft(\()p Fs(\014x)43 b Fn(F)13 b Ft(\)\))i(1)1752 5030 y(\()p Fn(\025x)p Ft(:)g Fs(nat)10 b Fn(:)p Ft(\()p Fs(\014x)42 b Fn(F)13 b Ft(\)\()p Fn(x)21 b Ft(+)f(1\)\))15 b(1)0 5227 y(one)29 b(using)f Fs(\014x)11 b Ft(-reduction,)29 b(and)g(the)g(other)38 b Fn(\014)13 b Ft(-reduction.)40 b(By)29 b(con\015uence,)h(these)f(t)m(w)m(o)i(m)m(ust)e(reduce)g(to)h (some)0 5340 y(common)i(form.)43 b(This)30 b(common)h(form)g(ma)m(y)h (b)s(e)f(found)f(b)m(y)h(taking)g(eac)m(h)i(term)e(and)g(applying)e (the)j(reduction)p eop %%Page: 81 32 81 31 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(81)0 91 y(used)32 b(to)i(pro)s(duce)d(the)j (other.)48 b(Applying)39 b Fn(\014)13 b Ft(-reduction)32 b(to)i(the)f(\014rst)f(and)h Fs(\014x)11 b Ft(-reduction)32 b(to)i(the)f(second,)g(w)m(e)0 204 y(obtain)1382 317 y(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)p Ft(\()p Fn(F)j Ft(\()p Fs(\014x)43 b Fn(F)13 b Ft(\)\)\()p Fn(x)21 b Ft(+)f(1\)\))15 b(1)0 484 y(F)-8 b(rom)25 b(here,)h(w)m(e)f(could)e (either)h(apply)f Fs(\014x)11 b Ft(-reduction)24 b(or)33 b(\()p Fn(\014)5 b Ft(\))j(.)40 b(In)23 b(either)h(case,)j(w)m(e)e (obtain)f(a)h(term)f(that)h(reduces)0 597 y(to)1698 710 y(\()p Fn(F)1804 672 y Fp(2)1844 710 y Ft(\()p Fs(\014x)42 b Fn(F)13 b Ft(\)\)2)0 877 y(Con)m(tin)m(uing)42 b(in)g(this)h(w)m(a)m (y)-8 b(,)48 b(w)m(e)c(can)g(see)g(that)g(regardless)f(of)h(our)f(c)m (hoice)h(of)g(reduction,)i(w)m(e)e(cannot)g(ev)m(er)0 990 y(pro)s(duce)30 b(an)g(expression)g(that)h(do)s(es)f(not)h(con)m (tain)40 b(\()p Fs(\014x)i Fn(F)13 b Ft(\))39 b(as)31 b(a)g(subterm.)41 b(Th)m(us)d Fl(letrec)46 b Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)9 b Ft(\):)15 b Fs(nat)36 b Ft(=)0 1103 y Fn(f)10 b Ft(\()p Fn(x)28 b Ft(+)g(1\))48 b Fl(in)f Fn(f)25 b Ft(1)51 b(has)42 b(no)g(normal)f(form)h(and)g(the)g (nondeterministic)e(PCF)i(in)m(terpreter)g(need)g(not)g(halt.)0 1215 y(Although)27 b(this)f(brief)g(argumen)m(t)i(is)e(not)i(a)g (complete)g(pro)s(of)f(that)h(the)f(term)h(has)f(no)h(normal)e(form,)i (a)g(rigorous)0 1328 y(pro)s(of)42 b(can)h(b)s(e)g(dev)m(elop)s(ed)f (along)h(these)h(lines.)76 b(A)43 b(simpler)e(pro)s(of)h(metho)s(d)h (is)f(to)h(use)g(the)g(deterministic)0 1441 y(ev)-5 b(aluator)31 b(describ)s(ed)d(in)h(Section)h(2.4.3)i(\(see)g(Exercise)e(2.4.18\).)p 3861 1441 40 40 v 0 1654 a Fk(Example)k(2.4.6)46 b Ft(While)d(PCF)g (reduction)g(agrees)i(with)d(the)i(axiomatic)g(seman)m(tics)g(of)g (PCF,)g(this)e(form)0 1767 y(of)f(program)f(execution)h(ma)m(y)g(b)s(e) e(sligh)m(tly)g(di\013eren)m(t)h(from)g(what)h(most)f(readers)h(are)f (familiar)f(with.)69 b(The)0 1880 y(di\013erence)30 b(ma)m(y)h(b)s(e)f (illustrated)e(b)m(y)i(considering)e(the)j(follo)m(wing)e(program.)1011 2076 y Fl(let)g Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)10 b Ft(\):)15 b Fs(nat)35 b Ft(=)25 b(3)31 b Fl(in)1162 2189 y(letrec)46 b Fn(g)s Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)c Ft(\):)k Fs(nat)35 b Ft(=)25 b Fn(g)s Ft(\()p Fn(x)c Ft(+)f(1\))49 b Fl(in)e Fn(f)10 b Ft(\()p Fn(g)19 b Ft(5\))0 2391 y(In)41 b(most)g(familiar)f(programming)g(languages,)k(this)d (program)g(w)m(ould)f(not)i(halt,)i(since)c(the)i(call)49 b Fn(f)10 b Ft(\()p Fn(g)18 b Ft(5\))51 b(is)0 2503 y(compiled)41 b(or)i(in)m(terpreted)f(as)i(co)s(de)f(that)g(computes)51 b Fn(g)19 b Ft(5)52 b(b)s(efore)42 b(calling)50 b Fn(f)18 b Ft(.)78 b(Since)42 b(the)h(call)f(to)52 b Fn(g)j Ft(runs)0 2616 y(forev)m(er,)28 b(the)f(program)f(do)s(es)g(not)g(halt.)39 b(Ho)m(w)m(ev)m(er,)30 b(in)25 b(PCF,)h(w)m(e)h(can)f(reduce)h(the)f (function)f(call)h(to)35 b Fn(f)44 b Ft(without)0 2729 y(reducing)39 b Fn(g)19 b Ft(5)8 b(.)47 b(Since)40 b Fn(f)50 b Ft(disregards)31 b(its)h(argumen)m(t,)h(w)m(e)g(obtain)f(the) g(v)-5 b(alue)41 b(3)8 b(.)47 b(Although)32 b(this)f(explanation)0 2842 y(of)e(termination)f(uses)h(the)g(abilit)m(y)f(to)i(reduce)f(an)m (y)g(sub)s(expression,)e(this)h(is)g(not)h(essen)m(tial.)40 b(In)29 b(particular,)f(the)0 2955 y(deterministic)j(ev)-5 b(aluator)33 b(de\014ned)f(in)g(Section)g(2.4.3)j(will)30 b(also)j(reduce)g(the)g(term)g(ab)s(o)m(v)m(e)i(to)e(the)g(n)m(umeral)f (3.)0 3068 y(\(See)f(Exercise)f(2.4.17.\))43 b(F)-8 b(urther)30 b(comparison)g(of)h(ev)-5 b(aluation)29 b(orders)h(app)s(ears)g(in)f (the)h(next)h(section.)p 3861 3068 V 141 3281 a(As)43 b(men)m(tioned)f(earlier)f(in)h(Section)g(2.3.4,)48 b(it)42 b(is)f(imp)s(ortan)m(t)h(that)h(the)g(axiomatic)g(seman)m(tics)g(resp)s (ect)0 3393 y(the)e(op)s(erational)f(seman)m(tics.)73 b(Sp)s(eci\014cally)-8 b(,)42 b(if)d(w)m(e)j(can)f(pro)m(v)m(e)50 b Fn(M)j Ft(=)43 b Fn(N)18 b Ft(,)44 b(then)c(these)i(t)m(w)m(o)g (terms)f(should)0 3506 y(pro)s(duce)28 b(the)i(same)f(result)g(when)f (placed)h(inside)e(an)m(y)j(PCF)f(program.)40 b(The)29 b(reader)g(ma)m(y)h(w)m(onder)f(ab)s(out)g(the)0 3619 y(extensionalit)m(y)h(axiom)39 b(\()p Fn(\021)s Ft(\))8 b(,)32 b(whic)m(h)d(is)38 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)10 b(x)26 b Ft(=)g Fn(M)49 b Ft(for)38 b Fn(x)h Ft(not)31 b(free)f(in)38 b Fn(M)18 b Ft(.)42 b(This)28 b(equation)j(seems)g(v)m (ery)0 3732 y(reasonable)40 b(when)e(view)m(ed)i(as)g(a)g(statemen)m(t) i(ab)s(out)d(mathematical)h(functions,)h(but)e(it)g(is)g(not)h (completely)0 3845 y(ob)m(vious)k(that)53 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)10 b(x)54 b Ft(and)e Fn(M)63 b Ft(are)45 b(in)m(terc)m(hangeable)g(with)f(resp)s(ect)g(to)h(the)g (nondeterministic)d(PCF)0 3958 y(in)m(terpreter.)59 b(Since)36 b(PCF)g(reduction)g(do)s(es)g(not)h(include)42 b Fn(\021)12 b Ft(-reduction,)38 b(the)f(nondeterministic)d(in)m(terpreter)0 4071 y(is)j(forced)g(to)i(halt)e(on)45 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:y)s(x)8 b Ft(,)41 b(for)c(example,)j(whic)m(h)c(is)h (di\013eren)m(t)g(from)45 b Fn(y)12 b Ft(;)41 b(clearly)k Fn(\025x)p Ft(:)15 b Fn(\033)n(:y)s(x)46 b Ft(and)f Fn(y)k Ft(do)0 4184 y(not)34 b(ha)m(v)m(e)h(the)f(same)g(normal)e(form)h(if)g (w)m(e)h(omit)42 b(\()p Fn(\021)s Ft(\))8 b(.)52 b(Ho)m(w)m(ev)m(er,)36 b(when)d(placed)g(inside)e(a)j(con)m(text)44 b Fr(C)5 b Ft([)34 b(])42 b(suc)m(h)0 4297 y(that)32 b(b)s(oth)40 b Fr(C)5 b Ft([)p Fn(\025x)p Ft(:)15 b Fn(\033)n(:y)s(x)p Ft(])41 b(and)f Fr(C)5 b Ft([)p Fn(y)s Ft(])40 b(are)33 b(programs,)f(w)m(e)g(ha)m(v)m(e)h(already)f(observ)m(ed)g(that)41 b Fr(C)5 b Ft([)p Fn(\025x)p Ft(:)15 b Fn(\033)n(:y)s(x)p Ft(])41 b(and)e Fr(C)5 b Ft([)p Fn(y)s Ft(])0 4410 y(will)37 b(ha)m(v)m(e)k(the)f(same)h(normal)e(form,)j(if)c(an)m(y)-8 b(.)70 b(\(The)40 b(situation)f(for)48 b(\()p Fs(sp)7 b Ft(\))h(,)43 b(surjectiv)m(e)d(pairing,)g(is)f(similar.\))0 4523 y(Th)m(us,)33 b(the)f(equational)h(pro)s(of)f(system)h(of)g(PCF)f (is)g(sound)f(for)i(reasoning)f(ab)s(out)g(program)h(mo)s (di\014cation,)f(or)0 4635 y(in)m(terc)m(hangeabilit)m(y)e(of)g (program)g(\\parts.")0 4848 y Fk(Exercise)35 b(2.4.7)47 b Ft(Sho)m(w)38 b(that)48 b(\()p Fs(\014x)11 b Ft(\))48 b(reduction)37 b(ma)m(y)j(b)s(e)e(applied)e(inde\014nitely)g(to)j(an)m (y)g(expression)f(of)h(the)0 4961 y(form)51 b Fl(letrec)46 b Fn(f)10 b Ft(:)15 b Fn(\033)48 b Ft(=)e Fn(M)58 b Fl(in)47 b Fn(N)18 b Ft(.)78 b(Do)s(es)43 b(this)f(mean)h(that)g(recursiv)m(e)f (functions)g(nev)m(er)h(\\terminate")g(in)0 5074 y(PCF?)0 5286 y Fk(Exercise)35 b(2.4.8)47 b Ft(Compute)30 b(normal)f(forms)h (for)g(the)g(follo)m(wing)f(terms.)p eop %%Page: 82 33 82 32 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(82)66 91 y(\(a\))55 b Fs(c)-5 b(omp)22 b Ft(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)i Ft(+)f(1\))f(\()p Fn(\025x)p Ft(:)g Fs(nat)d Fn(:)j(x)i Ft(+)f(1\))f(5)8 b(,)31 b(where)d(the)h(de\014nition)d(of)j(natural)e (n)m(um)m(b)s(er)h(function)f(com-)227 204 y(p)s(osition)i(is)g(giv)m (en)i(in)e(Section)h(2.2.3.)61 392 y(\(b\))54 b Fl(let)29 b Fs(not)35 b Ft(=)25 b Fn(\025x)p Ft(:)15 b Fs(b)-5 b(o)g(ol)11 b Fn(:)k Fl(if)48 b Fn(x)f Fl(then)g Fs(false)55 b Fl(else)47 b Fs(true)37 b Fl(in)227 505 y(letrec)29 b Fn(f)34 b Ft(=)25 b Fn(\025x)p Ft(:)15 b Fs(b)-5 b(o)g(ol)12 b Fn(:)j Fl(if)47 b Fn(x)h Fl(then)f Fs(true)55 b Fl(else)46 b Fn(f)10 b Ft(\()p Fs(not)24 b Fn(x)p Ft(\))31 b Fl(in)227 618 y Fn(f)25 b Fs(false)0 830 y Fk(Exercise)35 b(2.4.9)47 b Ft(Sho)m(w)39 b(that)h(tak)m(en)g(together)h(the)f(follo)m(wing)e (three)h(reduction)g(rules)f(for)h(t)m(yp)s(ed)g(lam)m(b)s(da)0 943 y(calculus)29 b(with)g(\014xed)h(p)s(oin)m(ts)f(are)i(not)f (con\015uen)m(t.)39 1147 y(\()p Fn(\014)5 b Ft(\))1332 b(\()p Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)10 b Ft(\))p Fn(N)37 b Fr(!)25 b Ft([)p Fn(N)r(=x)p Ft(])p Fn(M)39 1352 y Ft(\()p Fn(\021)s Ft(\))1144 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)10 b(x)26 b Fr(!)f Fn(M)5 b(;)76 b(x)30 b Ft(not)h(free)f(in)f Fn(M)39 1518 y Ft(\()p Fs(\014x)11 b Ft(\))213 1533 y Fm(al)q(t)1561 1518 y Fs(\014x)1665 1540 y Fm(\033)1712 1518 y Fn(M)35 b Fr(!)25 b Fn(M)10 b Ft(\()p Fs(\014x)2189 1540 y Fm(\033)2236 1518 y Fn(M)g Ft(\))0 1685 y(More)36 b(sp)s(eci\014cally)-8 b(,)35 b(\014nd)f(a)h(term)44 b Fn(M)54 b Ft(that)36 b(ma)m(y)g(b)s(e)e (reduced)h(in)f(one)h(step)h(to)44 b Fn(N)54 b Ft(or)43 b Fn(P)22 b Ft(,)36 b(where)43 b Fn(N)54 b Ft(and)43 b Fn(P)0 1798 y Ft(cannot)36 b(b)s(e)e(reduced)g(to)i(a)f(common)g (term.)55 b Fs(Hint:)g Ft(It)35 b(is)f(p)s(ossible)e(to)k(\014nd)d(suc) m(h)i(an)43 b Fn(M)53 b Ft(whic)m(h)34 b(has)h(no)43 b(\()p Fn(\014)5 b Ft(\))0 1911 y(redexes.)42 b(Y)-8 b(our)31 b(coun)m(terexample)g(will)e(not)i(w)m(ork)g(if)f(w)m(e)h(use) 39 b(\()p Fs(\014x)11 b Ft(\))40 b(reduction,)e Fs(\014x)2931 1933 y Fm(\033)3004 1911 y Fr(!)26 b Fn(\025f)10 b Ft(:)15 b Fn(\033)3339 1905 y Fr(!)3445 1911 y Fn(\033)n(:)g(f)10 b Ft(\()p Fs(\014x)3730 1933 y Fm(\033)3777 1911 y Fn(f)g Ft(\))e(,)0 2024 y(as)31 b(in)e(the)h(text.)0 2268 y Fo(2.4.2)112 b(Reduction)37 b(strategies)0 2439 y Ft(W)-8 b(e)23 b(will)c(discuss)h(v)-5 b(arious)21 b(deterministic)f(in)m (terpreters)h(using)f(the)i(notion)f(of)h(reduction)f(strategy)-8 b(.)40 b(A)21 b Fs(r)-5 b(e)g(duction)0 2552 y(str)g(ate)g(gy)45 b Ft(is)33 b(a)i(partial)f(function)42 b Fn(F)56 b Ft(from)34 b(terms)h(to)g(terms)g(with)e(the)i(prop)s(ert)m(y)f(that)h(if)42 b Fn(F)13 b Ft(\()p Fn(M)d Ft(\))34 b(=)e Fn(N)18 b Ft(,)36 b(then)0 2665 y Fn(M)44 b Fr(!)34 b Fn(N)18 b Ft(.)56 b(This)34 b(is)h(called)g(a)h(\\strategy")i(since)c(the)i(function)f (ma)m(y)h(b)s(e)f(used)f(to)j(c)m(ho)s(ose)f(one)g(out)g(of)g(man)m(y)0 2778 y(p)s(ossible)g(reductions.)62 b(F)-8 b(or)39 b(an)m(y)f (reduction)f(strategy)48 b Fn(F)21 b Ft(,)40 b(w)m(e)f(ma)m(y)g (de\014ne)e(a)h Fs(p)-5 b(artial)50 b(evaluation)41 b(function)0 2891 y(eval)163 2905 y Fm(F)221 2891 y Ft(:)15 b Fs(PCF)38 b Fr(!)25 b Fs(PCF)51 b Ft(on)30 b(PCF)h(expressions)d(b)m(y)829 3155 y Fs(eval)991 3169 y Fm(F)1050 3155 y Ft(\()p Fn(M)10 b Ft(\))26 b(=)1340 3011 y Fh(\()1448 3099 y Fn(M)93 b Ft(if)30 b Fn(F)13 b Ft(\()p Fn(M)d Ft(\))31 b(is)e(not)i(de\014ned) 1448 3212 y Fn(N)108 b Ft(if)30 b Fn(F)13 b Ft(\()p Fn(M)d Ft(\))26 b(=)f Fn(M)2172 3179 y Fi(0)2226 3212 y Ft(and)k Fs(eval)2565 3226 y Fm(F)2624 3212 y Ft(\()p Fn(M)2757 3179 y Fi(0)2780 3212 y Ft(\))d(=)f Fn(N)0 3420 y Ft(The)35 b(ev)-5 b(aluation)34 b(function)42 b Fs(eval)1165 3434 y Fm(F)1267 3420 y Ft(is)34 b(the)h(mathematical)h(equiv)-5 b(alen)m(t)34 b(of)h(a)h(deterministic)d(in)m(terpreter)h(that)0 3533 y(rep)s(eats)29 b(single)e(reduction)h(steps,)i(follo)m(wing)d (the)i(strategy)38 b Fn(F)22 b Ft(,)29 b(un)m(til)e(this)h(strategy)i (cannot)g(b)s(e)e(follo)m(w)m(ed)h(an)m(y)0 3646 y(further)34 b(\()p Fs(i.e.)p Ft(,)i(w)m(e)f(reac)m(h)h(a)f(term)g(where)g(the)g (partial)f(function)42 b Fn(F)56 b Ft(is)34 b(unde\014ned\).)52 b(If)35 b(the)g(strategy)h(can)g(b)s(e)0 3759 y(follo)m(w)m(ed)k (inde\014nitely)d(from)48 b Fn(M)18 b Ft(,)43 b(then)d(the)g(function) 48 b Fs(eval)2170 3773 y Fm(F)2277 3759 y Ft(will)38 b(b)s(e)h(unde\014ned)f(on)49 b Fn(M)18 b Ft(,)43 b(and)d(an)g(actual)0 3872 y(in)m(terpreter)30 b(follo)m(wing)37 b Fn(F)52 b Ft(w)m(ould)29 b(run)g(forev)m(er.)42 b(\(See)31 b(Exercise)f(2.4.10) i(b)s(elo)m(w)e(for)g(further)f(discussion)f(of)j(the)0 3984 y(w)m(a)m(y)44 b Fs(eval)360 3998 y Fm(F)461 3984 y Ft(is)33 b(de\014ned)h(from)42 b Fn(F)22 b Ft(.\))53 b(As)35 b(a)f(notational)h(con)m(v)m(enience,)i(w)m(e)e(will)d(omit)i (the)h(subscript)40 b Fn(F)56 b Ft(if)34 b(the)0 4097 y(reduction)29 b(strategy)j(is)d(clear)i(from)f(con)m(text)i(or)e (irrelev)-5 b(an)m(t.)141 4210 y(In)31 b(general,)h(w)m(e)g(will)c(b)s (e)j(in)m(terested)h(in)e(reduction)g(strategies)i(that)g(c)m(ho)s(ose) h(a)f(reduction)e(whenev)m(er)h(p)s(os-)0 4323 y(sible,)e(at)h(least)h (if)e(the)h(term)g(is)f(a)i(program.)40 b(F)-8 b(or)31 b(suc)m(h)f(reduction)f(strategies,)i(the)g(ev)-5 b(aluation)37 b Fs(eval)10 b Ft(\()p Fn(M)g Ft(\))39 b(of)31 b(a)0 4436 y(program)37 b Fn(M)47 b Ft(will)27 b(either)h(b)s(e)h(the)g (normal)f(form)g(of)38 b Fn(M)18 b Ft(,)29 b(or)g(unde\014ned.)38 b(In)29 b(the)g(terminology)f(of)h([Bar84)r(],)h(the)0 4549 y(reduction)c(strategies)i(w)m(e)g(consider)e(are)i Fs(one-step)33 b Ft(reduction)26 b(strategies,)k(since)c(they)i(c)m(ho) s(ose)g(a)f(single)f(reduc-)0 4662 y(tion)35 b(step)h(based)f(on)h(the) g(form)f(of)h(the)g(term)f(alone.)57 b(F)-8 b(or)37 b(discussion)c(of)i (m)m(ulti-step)g(reduction)g(strategies,)0 4775 y(the)c(reader)f(ma)m (y)h(consult)e([Bar84)r(].)141 4888 y(It)d(is)f(p)s(ossible)e(to)j (de\014ne)f(a)h(\\brute)f(force")i(reduction)e(strategy)35 b Fn(F)47 b Ft(with)24 b(the)i(prop)s(ert)m(y)f(that)h(for)g(an)m(y)g (term)0 5001 y Fn(M)18 b Ft(,)42 b Fs(eval)9 b Ft(\()p Fn(M)h Ft(\))42 b(is)31 b(either)g(the)i(normal)e(form)h(of)40 b Fn(M)51 b Ft(or)32 b(unde\014ned.)44 b(Giv)m(en)c Fn(M)19 b Ft(,)33 b(w)m(e)f(can)h(compute)41 b Fn(F)13 b Ft(\()p Fn(M)d Ft(\))41 b(b)m(y)0 5114 y(en)m(umerating)34 b(\(in)g(parallel\)) f(all)g(reduction)h(paths)g(from)42 b Fn(M)53 b Ft(and)34 b(seeing)g(if)g(an)m(y)h(pro)s(duces)e(a)i(normal)e(form.)0 5226 y(If)f(w)m(e)h(\014nd)e(one)i(reduction)f(path,)h(sa)m(y)42 b Fn(M)d Fr(!)29 b Fn(M)1732 5240 y Fp(1)1801 5226 y Fr(!)g Fn(M)2009 5240 y Fp(2)2078 5226 y Fr(!)f Fn(:)15 b(:)g(:)31 b Fr(!)e Fn(N)18 b Ft(,)33 b(leading)f(to)h(a)g(normal)f (form,)h(w)m(e)g(let)0 5339 y Fn(F)13 b Ft(\()p Fn(M)d Ft(\))34 b(=)g Fn(M)466 5353 y Fp(1)549 5339 y Ft(b)s(e)g(the)i (\014rst)f(term)g(along)g(this)g(reduction)f(path.)55 b(This)34 b(is)g(not)i(a)f(v)m(ery)h(satisfying)e(reduction)p eop %%Page: 83 34 83 33 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(83)0 91 y(strategy)-8 b(,)28 b(ho)m(w)m(ev)m(er,)f (since)e(it)f(ma)m(y)h(tak)m(e)i(a)e(long)f(time)h(to)g(compute)34 b Fn(F)13 b Ft(\()p Fn(M)d Ft(\))e(;)28 b(it)c(is)g(not)h(ev)m(en)g (decidable)f(whether)0 204 y Fn(F)13 b Ft(\()p Fn(M)d Ft(\))49 b(is)40 b(de\014ned.)69 b(Ho)m(w)m(ev)m(er,)44 b(w)m(e)d(will)d(see)i(b)s(elo)m(w)g(that)h(there)f(is)f(an)h (e\016cien)m(tly)g(computable)g(reduction)0 317 y(strategy)32 b(whic)m(h)d(will)f(alw)m(a)m(ys)i(\014nd)f(the)i(normal)e(form)h(of)h (a)f(term.)141 430 y(An)d(imp)s(ortan)m(t)f(prop)s(ert)m(y)g(of)h(PCF)g (is)f(that)i(the)f(idealized)e(nondeterministic)f(in)m(terpreter)j(ma)m (y)g(b)s(e)g(imple-)0 543 y(men)m(ted)d(deterministically)c(in)j(an)g (e\016cien)m(t)h(manner.)38 b(More)25 b(sp)s(eci\014cally)-8 b(,)23 b(there)h(is)e(an)i(e\016cien)m(tly)f(computable)0 656 y(reduction)g(strategy)34 b Fn(F)46 b Ft(suc)m(h)24 b(that)h(whenev)m(er)32 b Fn(M)43 b Ft(reduces)24 b(to)h(a)g(normal)e (form)32 b Fn(N)19 b Ft(,)25 b(w)m(e)g(ha)m(v)m(e)34 b Fs(eval)3435 670 y Fm(F)3493 656 y Ft(\()p Fn(M)10 b Ft(\))27 b(=)d Fn(N)19 b Ft(.)0 769 y(This)35 b(reduction)h(strategy) i(is)e(called)h Fs(left-most)i(outer-most)47 b Ft(or,)39 b(more)e(simply)-8 b(,)36 b Fs(left-most)k(r)-5 b(e)g(duction)7 b Ft(.)62 b(It)37 b(is)0 882 y(de\014ned)29 b(precisely)g(in)g(the)h (next)h(section.)40 b(Another)31 b(name)f(that)h(is)e(sometimes)h(used) g(is)f Fs(c)-5 b(al)5 b(l-by-name)37 b Ft(reduc-)0 995 y(tion,)27 b(but)e(this)g(is)h(sometimes)g(confusing)f(since)h(call-b)m (y-name)g(is)f(also)h(used)g(to)h(refer)f(to)h(a)f(parameter-passing)0 1108 y(mec)m(hanism)f(implemen)m(ted)f(b)m(y)h(\\th)m(unks")h(\(see)g ([ASU86)q(],)h(for)e(example\).)39 b(The)25 b(di\013erence)g(b)s(et)m (w)m(een)h(left-most)0 1220 y(reduction)20 b(and)h(other)g(alternativ)m (es)h(ma)m(y)f(b)s(e)g(illustrated)e(b)m(y)i(considering)e(an)i (expression)28 b(\()p Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)10 b Ft(\))p Fn(N)20 b Ft(,)j(where)0 1333 y Fn(M)35 b Fr(!)26 b Fn(M)338 1300 y Fi(0)400 1333 y Ft(and)38 b Fn(N)d Fr(!)25 b Fn(N)892 1300 y Fi(0)924 1333 y Ft(.)40 b(There)30 b(are)h(three)f(p)s(ossible)e(w)m(a)m(ys)k(to)f(reduce)f(this)f (expression:)1548 1664 y(\()p Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)10 b Ft(\))p Fn(N)1623 2242 y Ft([)p Fn(N)r(=x)p Ft(])p Fn(M)948 1997 y Ft(\()p Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)10 b Ft(\))p Fn(N)1419 1964 y Fi(0)2124 1997 y Ft(\()p Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)2477 1964 y Fi(0)2502 1997 y Ft(\))p Fn(N)1701 1766 y Fg(\000)1618 1849 y(\000)1535 1932 y(\000)1485 1982 y(\000)-83 b(\011)1784 1766 y(@)1867 1849 y(@)1950 1932 y(@)2000 1982 y(@)g(R)p 1782 2181 4 499 v 1784 2181 a(?)0 2452 y Ft(The)24 b(\014rst)g(alternativ)m(e)h(is)e(a)i(form)f(of) h(what)f(is)g(called)f Fs(e)-5 b(ager)28 b(r)-5 b(e)g(duction,)27 b Ft(or)e Fs(c)-5 b(al)5 b(l-by-value.)38 b Ft(\(Lik)m(e)25 b(call-b)m(y-name,)0 2565 y(call-b)m(y-v)-5 b(alue)32 b(has)g(other)g(meanings.\))46 b(The)31 b(second)i(is)e(called)g Fs(lazy)41 b Ft(or)32 b Fs(left-most)42 b Ft(reduction,)32 b(and)f(the)i(third)0 2678 y(ma)m(y)27 b(b)s(e)g(regarded)g(as)g(an)f (attempt)i(to)g(\\optimize")f(the)g(function)34 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)46 b Ft(b)s(efore)27 b(supplying)c(the)k (argumen)m(t)0 2791 y Fn(N)18 b Ft(.)41 b(There)30 b(is)f(no)h(guaran)m (tee)i(that)f(suc)m(h)f(an)h(\\optimization")f(shortens)g(the)g (reduction)g(to)h(normal)e(form.)141 2904 y(An)h(eager)h(strategy)-8 b(,)32 b(whic)m(h)d(ma)m(y)i(c)m(ho)s(ose)g(to)g(reduce)f(a)g(function) f(argumen)m(t)i(b)s(efore)e(doing)38 b Fn(\014)13 b Ft(-reduction,)0 3016 y(sometimes)36 b(leads)f(to)i(shorter)f(reductions.)56 b(The)36 b(reason)g(is)f(that)i(a)f(function)f(b)s(o)s(dy)42 b Fn(M)55 b Ft(ma)m(y)36 b(ha)m(v)m(e)i(sev)m(eral)0 3129 y(o)s(ccurrences)c(of)h(the)f(formal)g(parameter)43 b Fn(x)8 b Ft(.)52 b(In)33 b(this)h(case,)i(substituting)k Fn(N)53 b Ft(for)42 b Fn(x)g Ft(duplicates)f Fn(N)19 b Ft(,)35 b(and)f(so)0 3242 y(an)m(y)i(later)g(reduction)f(of)45 b Fn(N)54 b Ft(m)m(ust)36 b(b)s(e)g(rep)s(eated)g(for)g(eac)m(h)h(of)f (the)g(resulting)e(copies.)58 b(On)35 b(the)h(other)h(hand,)0 3355 y(if)j Fn(x)g Ft(do)s(es)32 b(not)h(o)s(ccur)f(in)39 b Fn(M)18 b Ft(,)33 b(then)f(there)h(is)e(no)i(p)s(oin)m(t)e(in)g (reducing)39 b Fn(N)18 b Ft(.)47 b(An)32 b(extreme)h(but)e(imp)s(ortan) m(t)h(case)0 3468 y(o)s(ccurs)h(when)40 b Fn(N)51 b Ft(has)33 b(no)g(normal)f(form.)48 b(In)33 b(this)f(situation,)h(an)g(eager)h(in) m(terpreter)e(will)f(not)i(terminate)g(on)0 3581 y(\()p Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)10 b Ft(\))p Fn(N)20 b Ft(,)29 b(since)g(it)f(will)e(reduce)37 b Fn(N)47 b Ft(inde\014nitely)-8 b(.)38 b(Ho)m(w)m(ev)m(er,)31 b(if)37 b Fn(N)47 b Ft(is)28 b(not)h(used)f(in)f(the)j(\014nal)d(result)h(\()p Fs(e.g.)p Ft(,)0 3694 y Fn(x)33 b Ft(do)s(es)24 b(not)g(o)s(ccur)h(in) 31 b Fn(M)18 b Ft(\),)27 b(a)d(left-most)h(in)m(terpreter)f(ma)m(y)h (terminate)g(without)e(reducing)31 b Fn(N)19 b Ft(.)38 b(Some)25 b(common)0 3807 y(optimization)37 b(tec)m(hniques,)i(suc)m(h) f(as)g(\\co)s(de)h(motion")f(and)f(\\in-line)e(substitution")h(fall)h (in)m(to)h(the)g(category)0 3920 y(corresp)s(onding)28 b(to)j(the)g(third)e(alternativ)m(e)h(in)f(the)i(picture)e(ab)s(o)m(v)m (e.)141 4033 y(Since)34 b(most)i(of)g(the)f(PCF)g(programming)f (examples)h(w)m(e)h(consider)e(are)i(aimed)e(at)i(pro)s(ducing)d(a)j (normal)0 4146 y(form)c(as)h(a)g(\014nal)e(result,)h(w)m(e)h(can)g (think)e(of)i(the)f(PCF)h(in)m(terpreter)f(as)g(either)g(a)h (nondeterministic)d(reduction)0 4258 y(mac)m(hine,)23 b(or)f(a)g(deterministic)e(ev)-5 b(aluator)22 b(follo)m(wing)e(a)j (left-most)f(reduction)e(strategy)-8 b(.)40 b(The)21 b(latter)i(alternativ)m(e)0 4371 y(is)k(particularly)f(useful)g(if)h(w) m(e)i(wish)d(to)j(sho)m(w)f(that)h(a)f(PCF)g(expression)f(has)h(no)g (normal)f(form.)39 b(In)28 b(doing)f(hand)0 4484 y(calculations,)35 b(ho)m(w)m(ev)m(er,)h(the)f(nondeterministic)c(execution)k(mo)s(del)e (lets)h(us)g(c)m(ho)s(ose)h(reduction)e(steps)h(whic)m(h)0 4597 y(lead)c(more)g(quic)m(kly)g(to)h(normal)e(form.)0 4810 y Fk(Exercise)35 b(2.4.10)47 b Ft(The)24 b(de\014nition)f(of)33 b Fs(eval)1575 4824 y Fm(F)1667 4810 y Ft(at)25 b(the)g(b)s(eginning)d (of)j(this)f(section)h(app)s(ears)f(to)h(b)s(e)f(a)h(de\014nition)0 4923 y(b)m(y)43 b(induction.)75 b(Ho)m(w)m(ev)m(er,)48 b(it)43 b(is)e(not)i(clear)g(that)h(the)f(de\014nition)d(is)i(w)m (ell-founded.)76 b(Giv)m(e)43 b(an)f(equiv)-5 b(alen)m(t)0 5036 y(inductiv)m(e)36 b(de\014nition)e(of)j(the)g(follo)m(wing)f (form.)60 b(F)-8 b(or)37 b(eac)m(h)h(natural)e(n)m(um)m(b)s(er)44 b Fn(n)8 b Ft(,)39 b(de\014ne)d(a)h(partial)f(function)0 5148 y Fs(eval)163 5112 y Fp([)p Fm(n)p Fp(])257 5148 y Ft(.)42 b(In)m(tuitiv)m(ely)-8 b(,)38 b Fs(eval)955 5112 y Fp([)p Fm(n)p Fp(])1041 5148 y Ft(\()p Fn(M)10 b Ft(\))40 b(will)28 b(b)s(e)i(de\014ned)g(if)38 b Fn(M)49 b Ft(reduces)30 b(to)i(normal)e(form)g(in)38 b Fn(n)g Ft(\(or)31 b(few)m(er\))h(steps,)0 5261 y(and)g(unde\014ned)f (otherwise.)47 b(Y)-8 b(our)33 b(de\014nition)d(of)j(the)42 b Fs(eval)2110 5225 y Fp([)p Fm(n)p Fp(])2205 5261 y Ft('s)33 b(should)d(use)j(induction)d(on)41 b Fn(n)8 b Ft(.)48 b(Then)32 b(de\014ne)p eop %%Page: 84 35 84 34 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(84)0 91 y Fs(eval)163 105 y Fm(F)263 91 y Ft(as)35 b(the)f(union)e(of)i(the)42 b Fs(eval)1233 54 y Fp([)p Fm(n)p Fp(])1327 91 y Ft('s.)51 b(\(Recall)34 b(that)h(a)f(partial)e(function)h(is)g(a)h(set)g(of)g(ordered)g(pairs,) f(so)h(it)0 204 y(mak)m(es)d(sense)g(to)g(tak)m(e)h(the)e(union)f(of)h (a)h(set)g(of)f(partial)g(functions.\))0 448 y Fo(2.4.3)112 b(The)38 b(left-most)e(and)j(lazy)e(reduction)f(strategies)0 644 y Ft(W)-8 b(e)38 b(will)c(de\014ne)i(a)i(deterministic)c(in)m (terpreter)j(b)m(y)f(de\014ning)f(a)i(sp)s(ecialized)e(reduction)h (relation)3488 588 y Fj(left)3494 644 y Fr(!)50 b Ft(that)38 b(is)0 757 y(a)f(subset)f(of)h(nondeterministic)d(PCF)i(reduction.)59 b(An)36 b(optimization)g(of)h(left-most)g(reduction,)g(called)f Fs(lazy)0 870 y(r)-5 b(e)g(duction)44 b Ft(is)34 b(also)h(describ)s(ed) e(in)h(this)g(section.)55 b(While)34 b(lazy)h(reduction)f(do)s(es)h (not)g(\014nd)f(a)h(normal)f(form)h(for)0 983 y(ev)m(ery)j(term)f(that) h(has)f(one,)j(lazy)d(reduction)f(has)h(the)h(same)f(e\013ect)i(as)e (left-most)h(reduction)e(for)h(programs)0 1096 y(\(closed)31 b(terms)f(of)g(observ)-5 b(able)30 b(t)m(yp)s(e\))h(that)g(reduce)f(to) h(results.)141 1209 y(In)m(tuitiv)m(ely)-8 b(,)27 b(left-most)g (reduction)f(w)m(orks)h(b)m(y)f(applying)f(the)i(reduction)e(step)i (that)h(in)m(v)m(olv)m(es)f(the)f(left-most)0 1321 y(sym)m(b)s(ol)40 b(in)g(the)h(term.)73 b(Another)41 b(w)m(a)m(y)h(to)g(describ)s(e)e (this)g(is)g(that)i(w)m(e)f(compare)h(t)m(w)m(o)g(p)s(ossible)d (reductions)0 1434 y(b)m(y)j(lo)s(oking)f(at)h(the)h(set)f(of)g(sym)m (b)s(ols)f(in)g(the)h(term)g(that)h(matc)m(h)f(the)h(left-hand)e(side)g (of)h(the)g(appropriate)0 1547 y(reduction)26 b(axiom.)40 b(In)26 b(left-most)i(reduction,)f(w)m(e)h(apply)e(the)h(reduction)g (that)h(in)m(v)m(olv)m(es)f(the)g(left-most)h(sym)m(b)s(ol)0 1683 y(p)s(ossible.)43 b(The)32 b(relation)915 1628 y Fj(left)920 1683 y Fr(!)47 b Ft(is)31 b(de\014ned)g(in)f(T)-8 b(able)32 b(2.3)h(b)m(y)f(a)h(set)f(of)g(inference)g(rules,)f(follo)m (wing)g(a)h(st)m(yle)g(that)0 1796 y(is)c(commonly)g(called)g Fs(structur)-5 b(e)g(d)32 b(op)-5 b(er)g(ational)35 b(semantics.)41 b Ft(The)28 b(de\014nition)e(is)i(structured)f(in)h(the)h(sense)f(that) 0 1909 y(eac)m(h)33 b(rule)d(applies)g(to)i(exactly)h(one)f(form)f(of)h (term,)g(so)g(that)g(w)m(e)g(can)g(see)g(whic)m(h)f(rule)f(applies)g(b) m(y)h(examining)0 2022 y(the)d(structure)f(of)h(a)g(term.)40 b(The)28 b(\014rst)f(rule)f(in)h(the)h(table)f(sa)m(ys)i(that)f(if)35 b Fn(M)h Fr(!)25 b Fn(N)46 b Ft(is)27 b(a)h(reduction)e(axiom)i (\(these)0 2135 y(are)h(collected)g(in)f(T)-8 b(able)29 b(2.2\),)h(then)f(this)f(is)g(a)h(left-most)g(reduction)f(step.)40 b(In)28 b(other)h(w)m(ords,)g(if)36 b Fn(M)48 b Ft(is)28 b(a)h(redex,)0 2248 y(then)37 b(the)g(left-most)g(reduction)f(of)46 b Fn(M)55 b Ft(is)36 b(to)i(reduce)45 b Fn(M)19 b Ft(.)60 b(The)37 b(remaining)e(rules)h(describ)s(e)f(reductions)h(on)0 2361 y(subterms.)k(An)29 b(in)m(tuitiv)m(e)h(w)m(a)m(y)h(to)g(read)f(a) h(rule)e(suc)m(h)h(as)1766 2588 y Fn(M)1889 2532 y Fj(left)1895 2588 y Fr(!)i Fn(M)2116 2550 y Fi(0)p 1683 2628 539 4 v 1683 2742 a Fn(M)10 b(N)1889 2686 y Fj(left)1895 2742 y Fr(!)32 b Fn(M)2116 2704 y Fi(0)2139 2742 y Fn(N)0 2938 y Ft(is)20 b(in)g(a)i(coun)m(ter-clo)s(c)m(kwise)g(direction,)g (starting)f(from)f(the)i(b)s(ottom)f(left.)38 b(If)21 b(w)m(e)g(w)m(an)m(t)h(to)g(reduce)f(an)h(application)0 3051 y Fn(M)10 b(N)18 b Ft(,)35 b(then)e(w)m(e)h(p)s(erform)e(the)i (left-most)g(reduction)f(step)g(in)41 b Fn(M)18 b Ft(.)50 b(If)33 b(this)g(results)f(in)g(a)i(term)42 b Fn(M)3472 3018 y Fi(0)3504 3051 y Ft(,)34 b(then)g(the)0 3164 y(left-most)f (reduction)e(step)h(from)40 b Fn(M)10 b(N)51 b Ft(is)31 b(the)i(one)f(taking)h(us)e(from)40 b Fn(M)10 b(N)51 b Ft(to)41 b Fn(M)2918 3131 y Fi(0)2942 3164 y Fn(N)18 b Ft(.)46 b(Multi-step)31 b(left-most)0 3300 y(reduction,)f(written)765 3244 y Fj(left)756 3300 y Fr(!)-61 b(!)9 b Ft(,)30 b(is)g(the)g (re\015exiv)m(e)h(and)e(transitiv)m(e)h(closure)g(of)2543 3244 y Fj(left)2549 3300 y Fr(!)14 b Ft(,)30 b(as)h(usual.)141 3413 y(In)37 b(order)f(to)i(simplify)c(the)k(table,)h(some)f(side)e (conditions)g(are)h(omitted.)62 b(The)37 b(con)m(v)m(en)m(tion)h(to)g (b)s(e)f(used)0 3526 y(in)g(reading)h(the)h(rules)e(in)h(T)-8 b(able)38 b(2.3)i(is)e(that)h(the)g(reductions)f(on)g(subterms)g(are)h (to)g(b)s(e)f(applied)f(only)h(if)g(a)0 3639 y(reduction)c(axiom)h(do)s (es)g(not)g(apply)f(to)i(the)f(en)m(tire)g(term.)55 b(Th)m(us)34 b(the)h(left-most)h(reduction)e(of)43 b(\()p Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)10 b Ft(\))p Fn(N)0 3752 y Ft(yields)39 b([)p Fn(N)r(=x)p Ft(])p Fn(M)20 b Ft(,)33 b(as)g(opp)s(osed)f(to)h (some)g(reduction)e(of)41 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)k Ft(.)48 b(An)32 b(alternate)h(presen)m(tation)g(of)f(left-most)0 3864 y(reduction)26 b(ma)m(y)h(b)s(e)f(giv)m(en)h(using)e(what)i(are)g (called)f(\\ev)-5 b(aluation)26 b(con)m(texts,")k(whic)m(h)c(are)h (discussed)e(in)g(Section)0 3977 y(2.5.6.)141 4090 y(F)-8 b(or)35 b(an)m(y)42 b Fn(M)19 b Ft(,)35 b(there)f(is)f(at)i(most)f(one) g(term)43 b Fn(N)52 b Ft(with)41 b Fn(M)2203 4035 y Fj(left)2209 4090 y Fr(!)c Fn(N)18 b Ft(.)52 b(This)32 b(means)i(that)3207 4035 y Fj(left)3213 4090 y Fr(!)48 b Ft(is)33 b(a)h(reduction)0 4226 y(strategy)-8 b(,)30 b(and)c(w)m(e)i(ma)m(y)f(write)1102 4171 y Fj(left)1108 4226 y Fr(!)k Ft(\()p Fn(M)10 b Ft(\))26 b(=)f Fn(N)45 b Ft(in)26 b(place)g(of)36 b Fn(M)2201 4171 y Fj(left)2207 4226 y Fr(!)31 b Fn(N)45 b Ft(when)26 b(desired.)39 b(Ho)m(w)m(ev)m(er,)29 b(the)f(notation)0 4367 y Fn(M)123 4312 y Fj(left)129 4367 y Fr(!)j Fn(N)49 b Ft(generally)30 b(seems)g(more)h(suggestiv)m(e.)0 4580 y Fk(Example)j(2.4.11)46 b Ft(The)28 b(left-most)g(reduction)f(of)h (the)g(term)37 b(\(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)16 b(\025y)s Ft(:)f Fs(nat)9 b Fn(:)16 b(x)f Ft(+)g Fn(y)s Ft(\))g(7\))g(5)i(+)f(\()p Fn(\025x)p Ft(:)f Fs(nat)10 b Fn(:)15 b(x)p Ft(\))g(3)p eop %%Page: 85 36 85 35 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(85)50 829 y Fs(Axioms)1628 942 y Fn(M)36 b Fr(!)25 b Fn(N)p 1622 983 335 4 v 1622 1096 a(M)1746 1041 y Fj(left)1752 1096 y Fr(!)31 b Fn(N)2149 1004 y(M)k Fr(!)25 b Fn(N)75 b Fs(is)33 b(a)g(r)-5 b(e)g(duction)34 b(axiom)50 1209 y(Subterm)f(R)n(ules)50 1493 y(nat)40 b Ft(and)29 b Fs(b)-5 b(o)g(ol)1072 1431 y Fn(M)1195 1376 y Fj(left)1201 1431 y Fr(!)31 b Fn(M)1421 1394 y Fi(0)p 878 1472 761 4 v 878 1585 a Fn(M)f Ft(+)20 b Fn(N)1195 1529 y Fj(left)1201 1585 y Fr(!)31 b Fn(M)1421 1547 y Fi(0)1465 1585 y Ft(+)20 b Fn(N)2134 1431 y(M)2258 1376 y Fj(left)2264 1431 y Fr(!)31 b Fn(M)2484 1394 y Fi(0)p 1940 1472 V 1940 1585 a Fn(N)f Ft(+)20 b Fn(M)2258 1529 y Fj(left)2264 1585 y Fr(!)31 b Fn(N)f Ft(+)20 b Fn(M)2678 1547 y Fi(0)2893 1493 y Fs(N)65 b(a)33 b(normal)h(form)1029 1729 y Fn(M)1152 1673 y Fj(left)1158 1729 y Fr(!)d Fn(M)1378 1691 y Fi(0)p 791 1769 848 4 v 791 1882 a Fs(Eq)8 b Ft(?)p Fn(M)i(N)1152 1827 y Fj(left)1158 1882 y Fr(!)31 b Fs(Eq)8 b Ft(?)p Fn(M)1533 1845 y Fi(0)1556 1882 y Fn(N)2178 1729 y(M)2301 1673 y Fj(left)2307 1729 y Fr(!)31 b Fn(M)2527 1691 y Fi(0)p 1940 1769 V 1940 1882 a Fs(Eq)8 b Ft(?)p Fn(N)i(M)2301 1827 y Fj(left)2307 1882 y Fr(!)31 b Fs(Eq)8 b Ft(?)p Fn(N)i(M)2765 1845 y Fi(0)2980 1790 y Fs(N)64 b(a)33 b(normal)i(form)1603 2026 y Fn(M)1727 1971 y Fj(left)1732 2026 y Fr(!)d Fn(M)1953 1989 y Fi(0)p 733 2067 2113 4 v 733 2180 a Fl(if)48 b Fn(M)57 b Fl(then)47 b Fn(N)58 b Fl(else)46 b Fn(P)1727 2124 y Fj(left)1732 2180 y Fr(!)32 b Fl(if)47 b Fn(M)2096 2142 y Fi(0)2167 2180 y Fl(then)g Fn(N)57 b Fl(else)47 b Fn(P)1618 2324 y(N)1727 2268 y Fj(left)1732 2324 y Fr(!)32 b Fn(N)1938 2286 y Fi(0)p 733 2364 V 733 2477 a Fl(if)48 b Fn(M)57 b Fl(then)47 b Fn(N)58 b Fl(else)46 b Fn(P)1727 2422 y Fj(left)1732 2477 y Fr(!)32 b Fl(if)47 b Fn(M)58 b Fl(then)46 b Fn(N)2465 2440 y Fi(0)2536 2477 y Fl(else)h Fn(P)3038 2385 y Fs(M)64 b(a)33 b(normal)i(form)1630 2621 y Fn(P)1727 2566 y Fj(left)1732 2621 y Fr(!)d Fn(P)1926 2584 y Fi(0)p 733 2662 V 733 2775 a Fl(if)48 b Fn(M)57 b Fl(then)47 b Fn(N)58 b Fl(else)46 b Fn(P)1727 2720 y Fj(left)1732 2775 y Fr(!)32 b Fl(if)47 b Fn(M)58 b Fl(then)46 b Fn(N)58 b Fl(else)47 b Fn(P)2823 2738 y Fi(0)3038 2683 y Fs(M,N)64 b(normal)34 b(forms)50 3006 y Ft(P)m(airs)1089 2944 y Fn(M)1212 2889 y Fj(left)1218 2944 y Fr(!)d Fn(M)1438 2907 y Fi(0)p 897 2985 756 4 v 897 3098 a Fr(h)p Fn(M)5 b(;)15 b(N)10 b Fr(i)1210 3042 y Fj(left)1216 3098 y Fr(!)31 b(h)p Fn(M)1471 3060 y Fi(0)1494 3098 y Fn(;)15 b(N)10 b Fr(i)2147 2944 y Fn(N)2255 2889 y Fj(left)2261 2944 y Fr(!)31 b Fn(N)2466 2907 y Fi(0)p 1954 2985 728 4 v 1954 3098 a Fr(h)p Fn(M)5 b(;)15 b(N)10 b Fr(i)2267 3042 y Fj(left)2273 3098 y Fr(!)31 b(h)p Fn(M)5 b(;)15 b(N)10 b Fr(i)2874 3006 y Fs(M)64 b(a)33 b(normal)i(form)1603 3242 y Fn(M)1727 3186 y Fj(left)1732 3242 y Fr(!)d Fn(M)1953 3204 y Fi(0)p 1370 3282 839 4 v 1370 3395 a Fk(Pro)6 b(j)1575 3418 y Fm(i)1603 3395 y Fn(M)1727 3340 y Fj(left)1732 3395 y Fr(!)32 b Fk(Pro)6 b(j)2059 3418 y Fm(i)2087 3395 y Fn(M)2185 3358 y Fi(0)50 3626 y Ft(F)-8 b(unctions)1183 3564 y Fn(M)1306 3509 y Fj(left)1312 3564 y Fr(!)32 b Fn(M)1533 3527 y Fi(0)p 1100 3605 539 4 v 1100 3718 a Fn(M)10 b(N)1306 3663 y Fj(left)1312 3718 y Fr(!)32 b Fn(M)1533 3681 y Fi(0)1556 3718 y Fn(N)2038 3564 y(N)2147 3509 y Fj(left)2153 3564 y Fr(!)f Fn(N)2358 3527 y Fi(0)p 1940 3605 V 1940 3718 a Fn(M)10 b(N)2147 3663 y Fj(left)2153 3718 y Fr(!)31 b Fn(M)10 b(N)2456 3681 y Fi(0)2671 3626 y Fs(M)64 b(a)33 b(normal)i(form)1603 3862 y Fn(M)1727 3806 y Fj(left)1732 3862 y Fr(!)d Fn(M)1953 3824 y Fi(0)p 1367 3902 845 4 v 1367 4016 a Fn(\025x)p Ft(:)15 b Fn(\033)n(:)g(M)1727 3960 y Fj(left)1732 4016 y Fr(!)32 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:)g(M)2188 3978 y Fi(0)0 4168 y Ft(Subterm)37 b(rules)f(apply)h(only)g(when)g(no)i(axiom)e(applies)g(to)i(the)f(en)m (tire)g(term.)64 b(F)-8 b(or)39 b(example,)48 b Fk(Pro)6 b(j)3633 4190 y Fm(i)3661 4168 y Fn(M)3797 4112 y Fj(left)3803 4168 y Fr(!)0 4281 y Fk(Pro)g(j)205 4303 y Fm(i)233 4281 y Fn(M)331 4248 y Fi(0)396 4281 y Ft(only)32 b(when)40 b Fn(M)52 b Ft(is)32 b(not)h(of)h(the)f(form)41 b Fr(h)p Fn(M)1859 4295 y Fp(1)1899 4281 y Fn(;)15 b(M)2027 4295 y Fp(2)2067 4281 y Fr(i)42 b Ft(and)f Fn(M)10 b(N)51 b Ft(reduces)33 b(to)42 b Fn(M)3101 4248 y Fi(0)3124 4281 y Fn(N)52 b Ft(only)32 b(when)40 b Fn(M)52 b Ft(is)0 4394 y(not)31 b(of)f(the)h(form)38 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:)g(M)968 4408 y Fp(1)1017 4394 y Ft(.)1150 4590 y(T)-8 b(able)30 b(2.3:)41 b(Left-most)32 b(reduction)d(for)h (PCF.)p eop %%Page: 86 37 86 36 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(86)0 91 y(is)29 b(written)h(b)s(elo)m(w,)g(with)f (the)h(left-most)h(redex)f(underlined)d(in)i(eac)m(h)j(step.)1085 288 y(\(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)16 b(\025y)s Ft(:)f Fs(nat)9 b Fn(:)16 b(x)k Ft(+)g Fn(y)s Ft(\))15 b(7)p 1155 324 948 4 v 1 w(\))g(5)21 b(+)f(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)p Ft(\))g(3)1085 381 y Fj(left)1091 437 y Fr(!)122 b Ft(\()p Fn(\025y)s Ft(:)15 b Fs(nat)10 b Fn(:)15 b Ft(7)21 b(+)f Fn(y)s Ft(\))15 b(5)p 1304 473 654 4 v 21 w(+)20 b(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)p Ft(\))g(3)1085 531 y Fj(left)1091 586 y Fr(!)122 b Ft(\(7)21 b(+)f(5)p 1339 607 203 4 v(\))h(+)f(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)p Ft(\))g(3)1085 674 y Fj(left)1091 730 y Fr(!)122 b Ft(12)21 b(+)f(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)p Ft(\))g(3)p 1506 766 506 4 v 1085 824 a Fj(left)1091 879 y Fr(!)122 b Ft(12)21 b(+)f(3)p 1304 900 248 4 v 1085 967 a Fj(left)1091 1023 y Fr(!)122 b Ft(15)0 1220 y(A)30 b(second)h(example,)f(not)h(pro)s(ducing)d(a)j(n) m(umeral,)e(follo)m(ws.)908 1416 y(\()p Fn(\025x)p Ft(:)15 b Fs(nat)c Fn(:)k(\025y)s Ft(:)g Fs(nat)10 b Fn(:)15 b(x)20 b Ft(+)g(\()p Fn(x)h Ft(+)f Fn(y)s Ft(\)\))15 b(\(\()p Fn(\025z)t Ft(:)g Fs(nat)c Fn(:)k(z)t Ft(\))g(12\))p 943 1452 1746 4 v 908 1510 a Fj(left)914 1565 y Fr(!)122 b Fn(\025y)s Ft(:)15 b Fs(nat)10 b Fn(:)p Ft(\(\()p Fn(\025z)t Ft(:)15 b Fs(nat)c Fn(:)16 b(z)t Ft(\))f(12)p 1465 1601 540 4 v 1 w(\))21 b(+)f(\(\(\()p Fn(\025z)t Ft(:)15 b Fs(nat)c Fn(:)k(z)t Ft(\))g(12\))22 b(+)e Fn(y)s Ft(\))908 1659 y Fj(left)914 1714 y Fr(!)122 b Fn(\025y)s Ft(:)15 b Fs(nat)10 b Fn(:)15 b Ft(12)22 b(+)d(\(\(\()p Fn(\025z)t Ft(:)c Fs(nat)d Fn(:)j(z)t Ft(\))g(12)p 1717 1750 V 2 w(\))20 b(+)g Fn(y)s Ft(\))908 1808 y Fj(left)914 1864 y Fr(!)122 b Fn(\025y)s Ft(:)15 b Fs(nat)10 b Fn(:)15 b Ft(12)22 b(+)d(\(12)j(+)e Fn(y)s Ft(\))0 2060 y(The)34 b(last)g(term)h(is)e(a)i(normal)f(form.)52 b(Neither)34 b(sum)g(can)h(b)s(e)e(reduced)h(since)g(the)h(paren)m(theses)f(asso)s (ciate)i(the)0 2173 y(sums)27 b(to)j(the)f(righ)m(t.)39 b(If)28 b(w)m(e)h(had)37 b(\(12)18 b(+)e(12\))i(+)e Fn(y)40 b Ft(instead,)28 b(the)h(b)s(o)s(dy)e(of)i(this)e(lam)m(b)s(da)g(term)i (could)f(b)s(e)g(reduced)0 2286 y(to)39 b(24)22 b(+)d Fn(y)12 b Ft(.)p 3861 2286 40 40 v 141 2499 a(As)25 b(stated)h(in)e (the)h(follo)m(wing)e(prop)s(osition,)h(left-most)h(reduction)f(will)f (\014nd)g(the)i(normal)f(form)g(of)i(an)m(y)f(term)0 2612 y(that)31 b(has)f(one.)0 2799 y Fk(Prop)s(osition)36 b(2.4.12)47 b Fs(L)-5 b(et)42 b Fn(M)53 b Fs(b)-5 b(e)33 b(a)i(PCF)e(term)i(of)f(any)h(typ)-5 b(e.)46 b(Then)34 b(for)h(any)f(normal)i(form)43 b Fn(N)18 b Fs(,)34 b(we)g(have)0 2935 y Fn(M)133 2880 y Fj(left)123 2935 y Fr(!)-61 b(!)26 b Fn(N)51 b Fs(i\013)40 b Fn(M)35 b Fr(!)-61 b(!)26 b Fn(N)18 b Fs(.)0 3123 y Ft(This)35 b(follo)m(ws)h(from)h(Theorem)f (8.3.26)j(in)d(Section)h(8.3.4,)j(whic)m(h)c(giv)m(es)h(a)h(general)f (condition)e(guaran)m(teeing)0 3236 y(completeness)30 b(of)h(left-most)g(reduction)e(for)h(PCF-lik)m(e)g(languages.)141 3372 y(Since)395 3316 y Fj(left)400 3372 y Fr(!)53 b Ft(is)37 b(a)h(reduction)f(strategy)-8 b(,)42 b(w)m(e)d(ma)m(y)g(apply) d(the)j(general)f(de\014nition)d(of)k(ev)-5 b(aluation)37 b(function)0 3484 y(from)26 b(Section)g(2.4.2)j(to)e(obtain)f(an)g(ev) -5 b(aluation)26 b(\(partial\))h(function)33 b Fs(eval)2564 3496 y Ff(left)2571 3540 y Fi(!)2662 3484 y Ft(.)39 b(F)-8 b(or)27 b(t)m(yp)s(ographical)f(reasons,)h(w)m(e)0 3612 y(will)j(write)41 b Fs(eval)581 3627 y Fj(left)729 3612 y Ft(instead)33 b(of)41 b Fs(eval)1323 3624 y Ff(left)1330 3667 y Fi(!)1421 3612 y Ft(.)49 b(A)33 b(corollary)f(of)i(Prop)s (osition)d(2.4.12)k(is)d(that)i(this)e(ev)-5 b(aluator)34 b(\014nds)0 3739 y(the)d(normal)e(form)h(of)g(an)m(y)h(term)f(that)h (has)g(one.)0 3951 y Fk(Prop)s(osition)36 b(2.4.13)47 b Fs(L)-5 b(et)40 b Fn(M)51 b Fs(b)-5 b(e)32 b(a)g(PCF)g(term)g(of)h (any)f(typ)-5 b(e.)43 b(Then)d(eval)2719 3966 y Fj(left)2826 3951 y Ft(\()p Fn(M)10 b Ft(\))26 b(=)f Fn(N)50 b Fs(i\013)40 b Fn(M)35 b Fr(!)-61 b(!)26 b Fn(N)50 b Fs(and)0 4064 y Fn(N)h Fs(is)32 b(a)h(normal)i(form.)141 4277 y Ft(If)42 b(w)m(e)i(only)e(w)m(an)m(t)h(Prop)s(ositions)e(2.4.12)k(and)d(2.4.13)j (to)e(hold)f(for)g(PCF)h(programs)f(\(closed)h(terms)g(of)0 4389 y(observ)-5 b(able)45 b(t)m(yp)s(e\),)50 b(then)45 b(w)m(e)h(ma)m(y)g(omit)f(man)m(y)h(of)f(the)h(reductions)e(on)h (subterms.)85 b(The)45 b(result)f(is)h Fs(lazy)0 4502 y(r)-5 b(e)g(duction,)43 b Ft(whic)m(h)38 b(is)g(far)h(more)g(commonly) g(implemen)m(ted)e(in)h(practice)h(than)g(left-most)h(reduction.)66 b(This)0 4638 y(is)34 b(giv)m(en)h(b)m(y)g(axioms)f(and)g(inference)g (rules)g(in)f(T)-8 b(able)35 b(2.4.)55 b(As)35 b(usual,)g(w)m(e)g (write)2921 4583 y Fj(lazy)2922 4638 y Fr(!)-61 b(!)45 b Ft(for)35 b(the)g(re\015exiv)m(e)g(and)0 4774 y(transitiv)m(e)27 b(closure)g(of)812 4719 y Fj(lazy)828 4774 y Fr(!)e Ft(.)40 b(W)-8 b(e)28 b(sa)m(y)h(a)e(term)36 b Fn(M)46 b Ft(is)26 b(in)h Fs(lazy)j(normal)i(form)j Ft(if)27 b(there)h(is)e(no)36 b Fn(N)45 b Ft(with)35 b Fn(M)3634 4719 y Fj(lazy)3651 4774 y Fr(!)41 b Fn(N)19 b Ft(.)0 4887 y(Note)27 b(that)f(the)g(lazy)g (normal)f(forms)g(of)h(t)m(yp)s(es)34 b Fs(nat)43 b Ft(and)34 b Fs(b)-5 b(o)g(ol)45 b Ft(are)26 b(exactly)h(the)f(normal)e(forms)i (of)f(these)i(t)m(yp)s(es.)0 5000 y(Ho)m(w)m(ev)m(er,)38 b(the)d(lazy)f(normal)g(forms)g(of)g(function)g(or)g(pro)s(duct)g(t)m (yp)s(es)g(ma)m(y)h(ha)m(v)m(e)h(subterms)d(that)i(are)g(not)g(in)0 5113 y(normal)29 b(form)h(\(lazy)h(or)f(otherwise\),)h(as)f (illustrated)e(in)i(the)g(follo)m(wing)f(example.)p eop %%Page: 87 38 87 37 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(87)50 79 y Fs(Axioms)1639 192 y Fn(M)35 b Fr(!)26 b Fn(N)p 1622 232 356 4 v 1622 346 a(M)1746 290 y Fj(lazy)1762 346 y Fr(!)42 b Fn(N)2170 254 y(M)35 b Fr(!)26 b Fn(N)75 b Fs(is)32 b(a)h(r)-5 b(e)g(duction)34 b(axiom)50 459 y(Subterm)f(R)n(ules)50 742 y(nat)40 b Ft(and)29 b Fs(b)-5 b(o)g(ol)1090 681 y Fn(M)1213 625 y Fj(lazy)1230 681 y Fr(!)42 b Fn(M)1461 643 y Fi(0)p 896 721 783 4 v 896 834 a Fn(M)30 b Ft(+)20 b Fn(N)1213 779 y Fj(lazy)1230 834 y Fr(!)42 b Fn(M)1461 797 y Fi(0)1504 834 y Ft(+)20 b Fn(N)2145 681 y(M)2268 625 y Fj(lazy)2285 681 y Fr(!)42 b Fn(M)2516 643 y Fi(0)p 1979 721 726 4 v 1979 834 a Fn(n)20 b Ft(+)g Fn(M)2268 779 y Fj(lazy)2285 834 y Fr(!)42 b Fn(n)20 b Ft(+)g Fn(M)2682 797 y Fi(0)2897 742 y Fs(n)65 b(a)33 b(numer)-5 b(al)1046 978 y Fn(M)1170 923 y Fj(lazy)1186 978 y Fr(!)42 b Fn(M)1417 941 y Fi(0)p 809 1019 870 4 v 809 1132 a Fs(Eq)8 b Ft(?)o Fn(M)i(N)1170 1076 y Fj(lazy)1186 1132 y Fr(!)42 b Fs(Eq)8 b Ft(?)p Fn(M)1572 1094 y Fi(0)1595 1132 y Fn(N)2188 978 y(M)2312 923 y Fj(lazy)2328 978 y Fr(!)42 b Fn(M)2559 941 y Fi(0)p 1979 1019 813 4 v 1979 1132 a Fs(Eq)8 b Ft(?)p Fn(nM)2312 1076 y Fj(lazy)2328 1132 y Fr(!)42 b Fs(Eq)8 b Ft(?)p Fn(nM)2769 1094 y Fi(0)2983 1040 y Fs(n)66 b(a)33 b(numer)-5 b(al)1603 1276 y Fn(M)1727 1220 y Fj(lazy)1743 1276 y Fr(!)42 b Fn(M)1974 1238 y Fi(0)p 733 1316 2134 4 v 733 1430 a Fl(if)48 b Fn(M)57 b Fl(then)47 b Fn(N)58 b Fl(else)46 b Fn(P)1727 1374 y Fj(lazy)1743 1430 y Fr(!)c Fl(if)47 b Fn(M)2117 1392 y Fi(0)2188 1430 y Fl(then)g Fn(N)58 b Fl(else)46 b Fn(P)50 1635 y Ft(P)m(airs)1603 1573 y Fn(M)1727 1518 y Fj(lazy)1743 1573 y Fr(!)c Fn(M)1974 1536 y Fi(0)p 1370 1614 860 4 v 1370 1727 a Fk(Pro)6 b(j)1575 1750 y Fm(i)1603 1727 y Fn(M)1727 1672 y Fj(lazy)1743 1727 y Fr(!)42 b Fk(Pro)6 b(j)2081 1750 y Fm(i)2109 1727 y Fn(M)2207 1690 y Fi(0)50 1958 y Ft(F)-8 b(unctions)1603 1896 y Fn(M)1727 1841 y Fj(lazy)1743 1896 y Fr(!)42 b Fn(M)1974 1859 y Fi(0)p 1520 1937 561 4 v 1520 2050 a Fn(M)10 b(N)1727 1994 y Fj(lazy)1743 2050 y Fr(!)42 b Fn(M)1974 2012 y Fi(0)1997 2050 y Fn(N)1246 2288 y Ft(T)-8 b(able)30 b(2.4:)42 b(Lazy)31 b(reduction)e(for)h(PCF.)0 2547 y Fk(Example)k(2.4.14)46 b Ft(The)36 b(lazy)h(reduction)e(of)i(the)g(term)44 b(\(\()p Fn(\025x)p Ft(:)15 b Fs(nat)c Fn(:)k(\025y)s Ft(:)g Fs(nat)10 b Fn(:)15 b(x)25 b Ft(+)f Fn(y)s Ft(\))15 b(7\))g(5)26 b(+)e(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)p Ft(\))g(3)46 b(is)0 2660 y(exactly)38 b(the)f(left-most)g(reduction)f (giv)m(en)h(in)e(Example)h(2.4.11.)63 b(F)-8 b(or)37 b(the)g(second)g(term)g(giv)m(en)g(in)f(Example)0 2773 y(2.4.11,)i(lazy)d(reduction)f(terminates)g(so)s(oner,)i(since)e(lazy)h (reduction)f(do)s(es)g(not)h(c)m(hange)h(an)m(y)f(sub)s(expression)0 2886 y(inside)28 b(the)j(scop)s(e)f(of)h(a)39 b Fn(\025)f Ft(or)31 b(inside)d(a)j(pair)e(of)h(the)h(form)38 b Fr(h)15 b(\001)g Fn(;)31 b Fr(\001)15 b(i)8 b Ft(.)898 3063 y(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(\025y)s Ft(:)g Fs(nat)10 b Fn(:)15 b(x)20 b Ft(+)g(\()p Fn(x)h Ft(+)f Fn(y)s Ft(\)\))15 b(\(\()p Fn(\025z)t Ft(:)g Fs(nat)c Fn(:)16 b(z)t Ft(\))f(12\))p 933 3099 1746 4 v 898 3157 a Fj(lazy)914 3212 y Fr(!)133 b Fn(\025y)s Ft(:)15 b Fs(nat)10 b Fn(:)p Ft(\(\()p Fn(\025z)t Ft(:)15 b Fs(nat)c Fn(:)k(z)t Ft(\))g(12\))22 b(+)e(\(\(\()p Fn(\025z)t Ft(:)15 b Fs(nat)d Fn(:)j(z)t Ft(\))g(12\))22 b(+)e Fn(y)s Ft(\))0 3385 y(The)30 b(last)g(term)h(is)e(a)i(lazy)f(normal)f(form,)i (since)e(there)i(is)e(no)i(lazy)f(reduction)f(of)i(this)e(term.)p 3861 3385 40 40 v 141 3573 a(The)h(main)g(prop)s(ert)m(y)g(of)h(lazy)g (reduction,)f(in)g(comparison)g(with)f(left-most)i(reduction,)f(follo)m (ws)g(from)h(the)0 3686 y(follo)m(wing)e(prop)s(osition.)0 3874 y Fk(Prop)s(osition)36 b(2.4.15)47 b Fs(If)31 b Fn(M)42 b Fs(is)23 b(a)h(close)-5 b(d)24 b(PCF)g(term)g(that)g(do)-5 b(es)25 b(not)f(have)g(the)f(form)33 b Fn(\025x)p Ft(:)15 b Fn(\033)s(:)h(M)3340 3888 y Fp(1)3411 3874 y Fs(or)32 b Fr(h)p Fn(M)3650 3888 y Fp(1)3690 3874 y Fn(;)15 b(M)3818 3888 y Fp(2)3858 3874 y Fr(i)8 b Fs(,)0 4015 y(then)33 b(for)g(any)h(term)41 b Fn(N)18 b Fs(,)33 b(we)f(have)42 b Fn(M)1374 3960 y Fj(lazy)1391 4015 y Fr(!)g Fn(N)51 b Fs(i\013)40 b Fn(M)1895 3960 y Fj(left)1901 4015 y Fr(!)31 b Fn(N)19 b Fs(.)0 4227 y Fk(Pro)s(of)72 b Ft(It)34 b(is)e(easy)i(to)g(see)g(that)g(if)41 b Fn(M)1411 4171 y Fj(lazy)1428 4227 y Fr(!)47 b Fn(N)k Ft(then)42 b Fn(M)2037 4171 y Fj(left)2043 4227 y Fr(!)36 b Fn(N)18 b Ft(.)50 b(W)-8 b(e)34 b(pro)m(v)m(e)g(the)g(con)m(v)m(erse)h(b)m(y)e(induction) e(on)0 4362 y(the)g(pro)s(of)f(\(using)f(the)i(rules)e(that)j(app)s (ear)e(in)f(T)-8 b(able)30 b(2.3\))j(that)39 b Fn(M)2410 4307 y Fj(left)2416 4362 y Fr(!)32 b Fn(N)18 b Ft(.)41 b(The)31 b(base)f(case)i(is)e(that)40 b Fn(M)35 b Fr(!)26 b Fn(N)0 4503 y Ft(is)j(a)i(reduction)e(axiom,)i(in)e(whic)m(h)g(case) 40 b Fn(M)1557 4448 y Fj(lazy)1574 4503 y Fr(!)i Fn(N)18 b Ft(.)141 4616 y(The)35 b(induction)d(step)j(for)g(eac)m(h)h (inference)e(rule)g(that)h(app)s(ears)f(in)g(b)s(oth)g(in)g(T)-8 b(able)34 b(2.3)i(and)e(T)-8 b(able)35 b(2.4)h(is)0 4752 y(straigh)m(tforw)m(ard.)46 b(The)32 b(only)f(observ)-5 b(ation)32 b(that)h(is)e(required,)g(in)g(the)i(case)41 b Fn(N)32 b Ft(+)21 b Fn(M)3024 4697 y Fj(left)3030 4752 y Fr(!)34 b Fn(N)e Ft(+)21 b Fn(M)3450 4719 y Fi(0)3514 4752 y Ft(with)39 b Fn(N)51 b Ft(a)0 4888 y(normal)29 b(form,)g(is)g(that)h(since)38 b Fn(N)47 b Ft(is)29 b(closed,)h(it)f(m) m(ust)h(b)s(e)f(a)h(n)m(umeral.)39 b(Therefore,)f Fn(N)29 b Ft(+)19 b Fn(M)3228 4833 y Fj(lazy)3245 4888 y Fr(!)42 b Fn(N)28 b Ft(+)19 b Fn(M)3667 4855 y Fi(0)3699 4888 y Ft(,)30 b(and)0 5024 y(similarly)d(for)38 b Fs(Eq)8 b Ft(?)15 b Fn(N)25 b(M)910 4969 y Fj(left)916 5024 y Fr(!)32 b Fs(Eq)8 b Ft(?)14 b Fn(N)25 b(M)1404 4991 y Fi(0)1436 5024 y Ft(.)141 5137 y(If)30 b(the)h(left-most)f(reduction)g (is)f(b)m(y)894 5340 y Fl(if)47 b Fn(M)58 b Fl(then)46 b Fn(N)58 b Fl(else)47 b Fn(P)1887 5285 y Fj(left)1893 5340 y Fr(!)31 b Fl(if)47 b Fn(M)58 b Fl(then)47 b Fn(N)2626 5302 y Fi(0)2697 5340 y Fl(else)f Fn(P)p eop %%Page: 88 39 88 38 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(88)0 91 y(with)42 b Fn(M)53 b Ft(a)35 b(normal)f(form,)i(then)f(the)g(assumption)e(that)j(the)f(en)m(tire)g (term)g(is)e(closed)i(means)g(that)44 b Fn(M)53 b Ft(m)m(ust)0 204 y(b)s(e)37 b Fs(true)46 b Ft(or)38 b Fs(false)15 b Ft(.)41 b(Therefore,)30 b(the)g(left-most)g(reduction)f(should)f(ha)m (v)m(e)j(b)s(een)e(to)h(eliminate)f(the)h(conditional)0 317 y(and)g(pro)s(ceed)g(with)37 b Fn(N)49 b Ft(or)38 b Fn(P)22 b Ft(.)141 430 y(The)42 b(h)m(yp)s(othesis)f(that)51 b Fn(M)60 b Ft(is)42 b(neither)f(a)51 b Fn(\025)8 b Ft(-abstraction)43 b(or)f(pair)f(rules)g(out)h(the)g(cases)i(for)d(left-most)0 543 y(reduction)29 b(inside)f(a)39 b Fn(\025)8 b Ft(-abstraction)32 b(or)e(pair.)141 679 y(The)f(\014nal)g(case)i(is)e(the)h(reduction)e (of)i(a)h(closed)e(term)38 b Fn(M)10 b(N)2249 623 y Fj(left)2255 679 y Fr(!)31 b Fn(M)10 b(N)2558 646 y Fi(0)2619 679 y Ft(where)38 b Fn(M)48 b Ft(is)29 b(a)h(normal)f(form.)40 b(But)0 792 y(since)35 b Fn(M)47 b Ft(m)m(ust)27 b(b)s(e)g(closed,)i (it)e(m)m(ust)h(ha)m(v)m(e)h(the)f(form)36 b Fn(M)f Fr(\021)25 b Fn(\025x)p Ft(:)15 b Fn(\033)s(:)h(M)2439 806 y Fp(1)2515 792 y Ft(or)36 b Fn(M)f Fr(\021)25 b Fs(\014x)h Fn(M)3058 806 y Fp(1)3106 792 y Ft(.)40 b(In)27 b(either)g(case,)j(this)0 928 y(con)m(tradicts)h(the)f(assumption)f(that)40 b Fn(M)10 b(N)1517 872 y Fj(left)1523 928 y Fr(!)31 b Fn(M)10 b(N)1826 895 y Fi(0)1858 928 y Ft(,)30 b(concluding)f(the)h(pro)s(of.)p 3861 928 40 40 v 0 1133 a Fk(Corollary)35 b(2.4.16)47 b Fs(If)40 b Fn(P)53 b Fs(is)32 b(a)h(PCF)f(pr)-5 b(o)g(gr)g(am)35 b(and)41 b Fn(R)g Fs(a)33 b(r)-5 b(esult)33 b(\(close)-5 b(d)33 b(normal)h(form)f(of)g(the)f(same)h(typ)-5 b(e\),)0 1274 y(then)41 b Fn(P)307 1218 y Fj(lazy)308 1274 y Fr(!)-61 b(!)27 b Fn(R)42 b Fs(i\013)e Fn(P)797 1218 y Fj(left)787 1274 y Fr(!)-61 b(!)26 b Fn(R)9 b Fs(.)0 1479 y Fk(Exercise)35 b(2.4.17)47 b Ft(Sho)m(w,)32 b(b)m(y)g(p)s(erforming)e(left-most)j (reduction,)e(that)i(the)f(deterministic)e(ev)-5 b(aluator)33 b(halts)0 1592 y(with)c(v)-5 b(alue)38 b(3)h(on)31 b(the)f(program)g (giv)m(en)h(in)e(Example)g(2.4.6.)0 1797 y Fk(Exercise)35 b(2.4.18)47 b Ft(Sho)m(w)40 b(that)g(the)g(PCF)g(expression)47 b Fl(letrec)g Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)9 b Ft(\):)15 b Fs(nat)51 b Ft(=)42 b Fn(f)10 b Ft(\()p Fn(x)26 b Ft(+)g(1\))49 b Fl(in)e Fn(f)24 b Ft(1)8 b(,)44 b(de-)0 1910 y(scrib)s(ed)28 b(in)h(Example)h(2.4.5,)i(has)e(no)h (normal)e(form.)0 2152 y Fo(2.4.4)112 b(P)m(arallel)36 b(reduction)0 2324 y Ft(The)d(general)g(idea)g(b)s(ehind)d(parallel)i (ev)-5 b(aluation)33 b(of)g(PCF)g(is)g(that)h(whenev)m(er)f(w)m(e)h (can)f(reduce)g(either)g(of)h(t)m(w)m(o)0 2436 y(subterms)25 b(indep)s(enden)m(tly)-8 b(,)25 b(w)m(e)h(ma)m(y)h(reduce)f(b)s(oth)f (sim)m(ultaneously)-8 b(.)38 b(W)-8 b(e)27 b(migh)m(t)f(reac)m(h)h(a)g (normal)e(form)h(faster)0 2549 y(this)32 b(w)m(a)m(y)-8 b(,)35 b(although)e(of)g(course)g(this)f(is)g(not)h(guaran)m(teed.)50 b(Ho)m(w)m(ev)m(er,)36 b(there)d(is)f(no)h(harm)f(in)g(doing)g(so:)47 b(since)0 2662 y(PCF)31 b(reduction)f(is)h(con\015uen)m(t,)h(w)m(e)g (will)c(not)k(reac)m(h)g(a)g(di\013eren)m(t)f(normal)f(form)h(b)m(y)g (doing)g(extra)h(reduction)e(in)0 2775 y(parallel.)141 2888 y(W)-8 b(e)37 b(will)32 b(de\014ne)j(a)h(parallel)d(reduction)i (relation)43 b Fr(\))g Ft(from)35 b(nondeterministic)e(reduction)h (using)g(t)m(w)m(o)j(in-)0 3001 y(ference)31 b(rules.)39 b(The)30 b(\014rst)g(rule)f(b)s(elo)m(w)g(sa)m(ys)i(that)g(a)g(single)e (reduction)h(ma)m(y)h(b)s(e)e(considered)h(a)g(sp)s(ecial)f(case)j(of)0 3114 y(parallel)c(reduction.)1791 3303 y Fn(M)36 b Fr(!)25 b Fn(N)p 1791 3343 323 4 v 1791 3426 a(M)36 b Fr(\))25 b Fn(N)0 3615 y Ft(where)35 b(w)m(e)i(in)m(tend)43 b Fn(M)h Fr(!)34 b Fn(N)54 b Ft(to)37 b(indicate)e(that)45 b Fn(N)54 b Ft(results)34 b(from)i(a)g(single)e(reduction)h(to)45 b Fn(M)54 b Ft(itself)35 b(or)h(one)0 3728 y(of)c(its)g(subterms.)45 b(If)c Fr(C)5 b Ft([)32 b Fn(:)15 b(:)g(:)33 b Ft(])41 b(is)32 b(a)g(con)m(text)i(with)d(places)h(for)41 b Fn(k)j Ft(terms)32 b(to)h(b)s(e)e(inserted,)h(then)g(a)h(term)f(of)h(the)0 3841 y(form)42 b Fr(C)5 b Ft([)p Fn(M)393 3855 y Fp(1)433 3841 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)722 3856 y Fm(k)766 3841 y Ft(])42 b(will)31 b(ha)m(v)m(e)k(nono)m(v)m(erlapping)e (subterms)41 b Fn(M)2349 3855 y Fp(1)2389 3841 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)2678 3856 y Fm(k)2730 3841 y Ft(.)51 b(In)33 b(this)g(case,)j(it)d(mak)m(es)i(sense)0 3953 y(to)i(reduce)e(these)i(subterms)e(sim)m(ultaneously)-8 b(,)35 b(p)s(ossibly)f(in)g(parallel.)56 b(This)34 b(is)h(expressed)g (b)m(y)h(the)g(follo)m(wing)0 4066 y(rule.)1467 4238 y Fn(M)1555 4252 y Fp(1)1620 4238 y Fr(\))25 b Fn(N)1809 4252 y Fp(1)1848 4238 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)2138 4253 y Fm(k)2206 4238 y Fr(\))26 b Fn(N)2396 4253 y Fm(k)p 1302 4278 1301 4 v 1302 4360 a Fr(C)5 b Ft([)p Fn(M)1468 4374 y Fp(1)1509 4360 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)1798 4375 y Fm(k)1841 4360 y Ft(])56 b Fr(\))g(C)5 b Ft([)p Fn(N)2220 4374 y Fp(1)2260 4360 y Fn(;)15 b(:)g(:)g(:)h(;)f(N)2534 4375 y Fm(k)2577 4360 y Ft(])0 4550 y(As)43 b(usual,)i(m)m(ulti-step)d (parallel)f(reduction)50 b Fr(\))-61 b(\))51 b Ft(is)42 b(the)h(re\015exiv)m(e)g(and)f(transitiv)m(e)g(closure)h(of)g (single-step)0 4663 y(parallel)28 b(reduction.)141 4775 y(This)d(parallel)g(reduction)h(relation)g(giv)m(es)h(us)f(a)i (nondeterministic)c(form)i(of)h(reduction)f(with)g(the)h(prop)s(ert)m (y)0 4888 y(that)k Fn(M)k Fr(!)-61 b(!)26 b Fn(N)40 b Ft(b)m(y)22 b(ordinary)e(PCF)i(reduction)e(i\013)30 b Fn(M)35 b Fr(\))-61 b(\))26 b Fn(N)40 b Ft(b)m(y)22 b(parallel)e (reduction)h(steps.)37 b(It)23 b(is)d(also)i(p)s(ossible)0 5001 y(to)h(de\014ne)e(parallel)e(reduction)i(strategies)i(whic)m(h)d (giv)m(e)j(the)f(same)g(normal)e(form)i(as)g(sequen)m(tial)f (reduction.)37 b(This)0 5114 y(ma)m(y)25 b(b)s(e)e(done)h(in)f(a)h(w)m (a)m(y)h(that)g(maximizes)e(parallelism,)f(optionally)g(up)h(to)i(some) g(b)s(ound)d(whic)m(h)g(w)m(e)j(ma)m(y)f(think)0 5227 y(of)33 b(as)h(the)f(maxim)m(um)f(feasible)g(n)m(um)m(b)s(er)g(of)h (parallel)e(pro)s(cesses)i(for)g(some)h(parallel)d(arc)m(hitecture.)50 b(Ho)m(w)m(ev)m(er,)0 5340 y(w)m(e)31 b(will)d(not)i(go)h(in)m(to)g (the)f(details.)p eop %%Page: 89 40 89 39 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(89)0 91 y Fk(Exercise)35 b(2.4.19)47 b Ft(This)29 b(exercise)h(asks)h(y)m(ou)f(to)h(compare)g(parallel)e (and)h(sequen)m(tial)f(reduction.)66 279 y(\(a\))46 b(Pro)m(v)m(e)33 b(that)40 b Fn(M)c Fr(\))-61 b(\))27 b Fn(N)49 b Ft(i\013)39 b Fn(M)d Fr(!)-61 b(!)27 b Fn(N)18 b Ft(.)43 b(Y)-8 b(ou)31 b(ma)m(y)h(use)f(the)g(fact)h(that)g(for)f(an)m(y)g(con)m(text)41 b Fr(C)5 b Ft([)32 b(])8 b(,)32 b(the)f(term)227 392 y Fr(C)5 b Ft([)p Fn(M)393 406 y Fp(1)433 392 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)723 407 y Fm(k)766 392 y Ft(])42 b(has)33 b(indep)s(enden)m(t)d(subterms)41 b Fn(M)2005 406 y Fp(1)2044 392 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)2334 407 y Fm(k)2418 392 y Ft(whic)m(h)32 b(ma)m(y)i(b)s(e)e(replaced)h (separately)g(b)m(y)227 505 y Fn(N)300 519 y Fp(1)340 505 y Fn(;)15 b(:)g(:)g(:)h(;)f(N)614 520 y Fm(k)696 505 y Ft(to)31 b(yield)37 b Fr(C)5 b Ft([)p Fn(N)1186 519 y Fp(1)1226 505 y Fn(;)15 b(:)g(:)g(:)i(;)e(N)1501 520 y Fm(k)1544 505 y Ft(])8 b(.)61 692 y(\(b\))45 b(Supp)s(ose)36 b Fn(M)f Fr(!)-61 b(!)25 b Fn(N)47 b Ft(and)37 b Fn(N)47 b Ft(is)28 b(a)h(normal)f(form.)40 b(Use)29 b(con\015uence)g(of)37 b Fr(!)-61 b(!)37 b Ft(and)28 b(part)h(\(a\))h(to)g(sho)m(w)e(that)227 805 y(if)38 b Fn(M)d Fr(\))-61 b(\))26 b Fn(P)21 b Ft(,)31 b(then)38 b Fn(P)g Fr(\))-61 b(\))26 b Fn(N)18 b Ft(.)71 993 y(\(c\))46 b(Sho)m(w)37 b(b)m(y)f(coun)m(terexample)i(that)f(part)g (\(b\))g(fails)e(if)44 b Fr(!)-61 b(!)46 b Ft(is)35 b(not)j(con\015uen) m(t.)60 b(In)36 b(other)h(w)m(ords,)h(giv)m(e)g(a)227 1106 y(single-step)d(reduction)g(relation)1436 1100 y Fr(!)1571 1106 y Ft(on)h(some)h(set)f(of)h(terms)f(suc)m(h)f(that)i (there)f(exist)45 b Fn(M)18 b Ft(,)46 b Fn(N)54 b Ft(and)44 b Fn(P)227 1219 y Ft(with)d Fn(M)h Fr(!)-61 b(!)32 b Fn(N)18 b Ft(,)35 b(term)42 b Fn(N)53 b Ft(not)34 b(reducible,)f(and)42 b Fn(M)f Fr(\))-61 b(\))32 b Fn(P)55 b Ft(with)42 b Fn(P)55 b Ft(not)34 b(reducible)e(to)43 b Fn(N)52 b Ft(b)m(y)34 b(either)227 1332 y(parallel)29 b(or)h(sequen)m(tial)g(reduction.)0 1575 y Fo(2.4.5)112 b(Eager)38 b(PCF)0 1747 y Ft(Left-most)21 b(reduction)f(matc)m(hes)h(the)g(axiomatic)f(seman)m(tics)h(of)f(PCF)g (and)g(allo)m(ws)g(nondeterministic)d(or)k(parallel)0 1860 y(implemen)m(tations.)37 b(Ho)m(w)m(ev)m(er,)28 b(most)d(implemen)m(tations)d(of)j(existing)e(programming)g(languages)i (do)f(not)h(follo)m(w)0 1973 y(this)g(ev)-5 b(aluation)25 b(order.)39 b(\(An)25 b(exception)h(is)f(Algol)g(60,)j(whose)e(\\cop)m (y)h(rule")e(pro)s(cedure-call)f(seman)m(tics)i(matc)m(h)0 2085 y(PCF)36 b(reduction;)j(more)e(mo)s(dern)e(examples)h(are)h(Hask)m (ell)g(and)f(Miranda,)h(as)g(noted)g(in)e(Section)i(2.1.\))60 b(The)0 2198 y(more)35 b(common)g(order)f(is)g(eager)i(ev)-5 b(aluation,)35 b(whic)m(h)f(do)s(es)g Fs(not)44 b Ft(matc)m(h)36 b(the)f(PCF)f(axiomatic)h(seman)m(tics,)i(as)0 2311 y(illustrated)g(in) g(Example)h(2.4.6)j(\(see)f(also)e(Example)g(2.4.21)k(b)s(elo)m(w\).)65 b(In)38 b(this)g(section,)k(w)m(e)d(giv)m(e)g(a)h(precise)0 2424 y(de\014nition)29 b(of)i(eager)h(ev)-5 b(aluation)31 b(for)g(PCF)g(and)f(consider)g(a)i(few)f(prop)s(erties.)41 b(Eager)32 b(PCF)f(is)f(also)h(discussed)0 2537 y(in)e(Section)h(2.6.4) i(in)d(connection)i(with)e(\\explicit)g(lifting.")141 2650 y(An)g(imp)s(ortan)m(t)f(idea)g(in)g(eager)i(reduction)e(is)g(the) h(notion)g(of)g Fs(value,)g Ft(whic)m(h)f(is)g(a)h(term)g(that)h(is)e (not)h(further)0 2763 y(reduced)k(b)m(y)g(eager)h(reduction.)49 b(The)33 b(terms)g(that)h(are)g(not)f(v)-5 b(alues)33 b(are)h(function)e(applications)f(and)i(pairs)f(of)0 2876 y(non-v)-5 b(alues.)39 b(The)26 b(main)g(di\013erence)g(b)s(et)m (w)m(een)i(eager)g(reduction)e(and)g(other)h(reduction)f(strategies)i (considered)0 2989 y(in)41 b(this)g(c)m(hapter)i(is)e(that)i(under)d (eager)k(reduction,)g(w)m(e)f(only)e(apply)49 b Fn(\014)13 b Ft(-reduction)42 b(and)50 b Fk(Pro)6 b(j)3459 3011 y Fm(i)3496 2989 y Ft(-reduction)0 3102 y(when)31 b(a)i(function)e (argumen)m(t)h(is)g(a)g(v)-5 b(alue.)46 b(There)32 b(is)f(also)h(a)h(c) m(hange)g(in)39 b Fs(\014x)52 b Ft(reduction)31 b(to)i(halt)f (reduction)f(of)0 3215 y(the)36 b(argumen)m(t)f(to)i Fs(\014x)11 b Ft(,)37 b(as)e(explained)f(b)s(elo)m(w.)55 b(The)35 b(name)g(\\v)-5 b(alue")36 b(comes)g(from)f(the)h(fact)g(that) g(v)-5 b(alues)35 b(are)0 3327 y(considered)24 b(\\fully)g(ev)-5 b(aluated.")39 b(One-step)26 b Fs(e)-5 b(ager)35 b Ft(or)26 b Fs(c)-5 b(al)5 b(l-by-value)28 b(r)-5 b(e)g(duction)33 b Ft(is)25 b(de\014ned)f(in)g(T)-8 b(able)25 b(2.5.)40 b(Lik)m(e)0 3440 y(lazy)31 b(reduction,)g(eager)i(reduction)d(is)h (only)f(in)m(tended)h(to)h(pro)s(duce)e(a)i(n)m(umeral)e(or)h(b)s(o)s (olean)g(constan)m(t)i(from)e(a)0 3553 y(full)f(\(closed\))j(program;)h (it)e(is)f(not)i(in)m(tended)e(to)j(pro)s(duce)d(normal)g(forms)h(or)h (fully)d(reduce)i(op)s(en)g(terms)g(that)0 3666 y(ma)m(y)38 b(ha)m(v)m(e)g(free)f(v)-5 b(ariables.)60 b(This)35 b(can)j(b)s(e)e (seen)i(in)e(the)h(rules)f(for)h(addition:)52 b(there)37 b(is)g(no)g(eager)h(reduction)0 3779 y(from)30 b(a)h(term)f(of)h(the)f (form)38 b Fn(x)21 b Ft(+)e Fn(M)g Ft(,)30 b(ev)m(en)h(though)39 b Fn(M)49 b Ft(could)29 b(b)s(e)h(further)f(reduced.)141 3892 y(A)24 b(signi\014can)m(t)e(restriction)g(on)h(eager)i(PCF)e(is)f (that)i Fq(w)m(e)g(only)e(ha)m(v)m(e)j(\014xed-p)s(oin)m(t)d(op)s (erator)32 b Fs(\014x)3364 3914 y Fm(\033)3442 3892 y Fq(for)23 b(function)0 4005 y(t)m(yp)s(es)32 b Fn(\033)d Ft(=)c Fn(\033)471 4019 y Fp(1)525 3999 y Fr(!)631 4005 y Fn(\033)683 4019 y Fp(2)731 4005 y Fq(.)39 b Ft(The)23 b(in)m(tuitiv)m(e)g(reason)h(is)f(that)i(since)e(a)i(recursiv)m (ely-de\014ned)d(natural)h(n)m(um)m(b)s(er,)h(b)s(o)s(olean)0 4118 y(or)37 b(pair)e(w)m(ould)g(b)s(e)h(fully)f(ev)-5 b(aluated)37 b(b)s(efore)f(an)m(y)h(function)e(could)h(b)s(e)g(applied) e(to)k(it,)g(an)m(y)f(suc)m(h)f(expression)0 4231 y(w)m(ould)d(cause)h (the)g(program)g(con)m(taining)f(it)h(to)h(div)m(erge.)51 b(In)33 b(more)h(detail,)g(reduction)f(of)h(closed)g(terms)g(only)0 4344 y(halts)c(on)h(lam)m(b)s(da)f(abstractions,)i(pairs)d(of)i(v)-5 b(alues)31 b(and)f(constan)m(ts.)44 b(While)30 b(lam)m(b)s(da)g (abstractions)h(and)f(pairs)0 4457 y(of)g(v)-5 b(alues)30 b(could)f(con)m(tain)h(o)s(ccurrences)g(of)h Fs(\014x)11 b Ft(,)30 b(analysis)f(of)h(a)h(pair)37 b Fr(h)p Fn(V)2491 4471 y Fp(1)2531 4457 y Fn(;)15 b(V)2624 4471 y Fp(2)2664 4457 y Fr(i)38 b Ft(with)f Fn(V)3005 4471 y Fp(1)3083 4457 y Ft(and)h Fn(V)3321 4471 y Fp(2)3399 4457 y Ft(v)-5 b(alues)29 b(sho)m(ws)0 4569 y(that)g(an)m(y)g(o)s(ccurrence)f(of)h Fs(\014x)39 b Ft(m)m(ust)28 b(o)s(ccur)h(inside)d(a)i(lam)m(b)s(da)g (abstraction.)40 b(Therefore,)29 b(the)f(only)g(v)-5 b(alues)27 b(that)0 4682 y(could)e(in)m(v)m(olv)m(e)h(recursion)f(are)h (functions.)38 b(If)25 b(w)m(e)i(c)m(hanged)g(the)f(system)g(so)g(that) h(a)f(pair)33 b Fr(h)p Fn(M)5 b(;)15 b(N)10 b Fr(i)35 b Ft(w)m(ere)27 b(a)f(v)-5 b(alue,)0 4795 y(for)35 b(an)m(y)h(terms)44 b Fn(M)54 b Ft(and)43 b Fn(N)18 b Ft(,)37 b(then)e(it)g(w)m(ould)g(mak) m(e)h(sense)g(to)g(ha)m(v)m(e)g(a)g(\014xed-p)s(oin)m(t)f(op)s(erator) 44 b Fs(\014x)3491 4817 y Fm(\033)3581 4795 y Ft(for)36 b(eac)m(h)0 4908 y(pro)s(duct)29 b(t)m(yp)s(e)39 b Fn(\033)28 b Ft(=)d Fn(\033)782 4922 y Fp(1)837 4908 y Fr(\002)15 b Fn(\033)975 4922 y Fp(2)1023 4908 y Ft(.)141 5021 y(It)31 b(is)f(easy)h(to)h(v)m(erify)-8 b(,)31 b(b)m(y)g(examination)f(of)h(T) -8 b(able)30 b(2.5,)i(that)g(for)e(an)m(y)40 b Fn(M)18 b Ft(,)31 b(there)g(is)f(at)i(most)f(one)39 b Fn(N)49 b Ft(with)0 5134 y Fn(M)123 5079 y Fj(e)l(ager)162 5134 y Fr(!)64 b Fn(N)18 b Ft(.)40 b(Since)25 b(no)i(v)-5 b(alues)26 b(are)h(reduced,)1613 5079 y Fj(e)l(ager)1652 5134 y Fr(!)73 b Ft(is)26 b(a)h(partial)e(function)h(on)g(terms)h (whose)f(domain)g(con)m(tains)0 5247 y(only)j(non-v)-5 b(alues.)p eop %%Page: 90 41 90 40 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(90)50 938 y Fs(V)-7 b(alues)1054 1051 y Fn(V)50 b Ft(is)30 b(a)g Fs(value)38 b Ft(if)29 b Fn(V)51 b Ft(is)29 b(a)i(constan)m(t,)h(v)-5 b(ariable,)1145 1164 y(lam)m(b)s(da)29 b(abstraction)h(or)h(pair)e(of)h(v)-5 b(alues.)1054 1308 y Fs(delay)1264 1330 y Fm(\033)1318 1326 y Fi(!)1401 1330 y Fm(\034)1444 1308 y Ft([)p Fn(M)10 b Ft(])1648 1252 y Fj(def)1665 1308 y Ft(=)73 b Fn(\025x)p Ft(:)15 b Fn(\033)t(:)g(M)10 b(x)121 b(x)31 b Ft(not)f(free)h(in)e Fn(M)10 b Ft(:)15 b Fn(\033)3055 1302 y Fr(!)3161 1308 y Fn(\034)50 1421 y Fs(Axioms)1053 1547 y Ft(\()p Fn(\025x)p Ft(:)g Fn(\033)n(:M)10 b Ft(\))p Fn(V)1541 1492 y Fj(e)l(ager)1579 1547 y Fr(!)64 b Ft([)p Fn(V)10 b(=x)p Ft(])p Fn(M)669 b(V)50 b Ft(a)31 b(v)-5 b(alue)1053 1732 y Fk(Pro)6 b(j)1257 1755 y Fm(i)1285 1732 y Fr(h)p Fn(V)1373 1746 y Fp(1)1413 1732 y Fn(;)15 b(V)1506 1746 y Fp(2)1546 1732 y Fr(i)1607 1677 y Fj(e)l(ager)1645 1732 y Fr(!)64 b Fn(V)1853 1746 y Fm(i)2701 1732 y Fn(V)2754 1746 y Fp(1)2793 1732 y Ft(,)31 b Fn(V)2902 1746 y Fp(2)2971 1732 y Ft(v)-5 b(alues)1053 1917 y Fs(\014x)1157 1939 y Fm(\033)1211 1935 y Fi(!)1294 1939 y Fm(\034)1352 1917 y Fn(V)1450 1862 y Fj(e)l(ager)1489 1917 y Fr(!)64 b Fn(V)20 b Ft(\()p Fs(delay)1963 1939 y Fm(\033)2017 1935 y Fi(!)2100 1939 y Fm(\034)2143 1917 y Ft([)p Fs(\014x)2272 1939 y Fm(\033)2327 1935 y Fi(!)2409 1939 y Fm(\034)2467 1917 y Fn(V)g Ft(]\))101 b Fn(V)50 b Ft(a)31 b(v)-5 b(alue)1238 2156 y(0)21 b(+)f(0)1465 2101 y Fj(e)l(ager)1504 2156 y Fr(!)64 b Ft(0)p Fn(;)15 b Ft(0)22 b(+)e(1)1972 2101 y Fj(e)l(ager)2011 2156 y Fr(!)64 b Ft(1)p Fn(;)15 b(:)g(:)g(:)i(;)e Ft(3)21 b(+)f(5)2641 2101 y Fj(e)l(ager)2679 2156 y Fr(!)64 b Ft(8)p Fn(;)15 b(:)g(:)g(:)853 2282 y Fs(Eq)8 b Ft(?)15 b Fn(n)g(n)1172 2227 y Fj(e)l(ager)1211 2282 y Fr(!)64 b Fs(true)7 b Fn(;)45 b Fs(Eq)8 b Ft(?)15 b Fn(n)g(m)1947 2227 y Fj(e)l(ager)1986 2282 y Fr(!)63 b Fs(false)220 b Fn(n)p Ft(,)p Fn(m)30 b Ft(distinct)f(n)m(umerals)723 2409 y Fl(if)48 b Fs(true)54 b Fl(then)47 b Fn(M)58 b Fl(else)46 b Fn(N)1812 2353 y Fj(e)l(ager)1850 2409 y Fr(!)64 b Fn(M)10 b Ft(,)31 b Fl(if)47 b Fs(false)55 b Fl(then)47 b Fn(M)58 b Fl(else)46 b Fn(N)3264 2353 y Fj(e)l(ager)3303 2409 y Fr(!)64 b Fn(N)50 2600 y Fs(Subterm)33 b(R)n(ules)50 2788 y(nat)1287 2726 y Fn(M)1410 2671 y Fj(e)l(ager)1449 2726 y Fr(!)64 b Fn(M)1702 2689 y Fi(0)p 1092 2767 827 4 v 1092 2862 a Fn(M)31 b Ft(+)20 b Fn(N)1410 2807 y Fj(e)l(ager)1449 2862 y Fr(!)64 b Fn(M)1702 2825 y Fi(0)1745 2862 y Ft(+)20 b Fn(N)2386 2726 y(M)2509 2671 y Fj(e)l(ager)2548 2726 y Fr(!)64 b Fn(M)2801 2689 y Fi(0)p 2220 2767 770 4 v 2220 2862 a Fn(n)20 b Ft(+)g Fn(M)2509 2807 y Fj(e)l(ager)2548 2862 y Fr(!)64 b Fn(n)20 b Ft(+)g Fn(M)2967 2825 y Fi(0)3182 2788 y Fs(n)65 b(a)33 b(numer)-5 b(al)50 3050 y(b)g(o)g(ol)1243 2989 y Fn(M)1367 2933 y Fj(e)l(ager)1405 2989 y Fr(!)64 b Fn(M)1658 2951 y Fi(0)p 1006 3029 914 4 v 1006 3125 a Fs(Eq)8 b Ft(?)o Fn(M)i(N)1367 3069 y Fj(e)l(ager)1405 3125 y Fr(!)64 b Fs(Eq)8 b Ft(?)p Fn(M)1813 3087 y Fi(0)1836 3125 y Fn(N)2429 2989 y(M)2553 2933 y Fj(e)l(ager)2591 2989 y Fr(!)64 b Fn(M)2844 2951 y Fi(0)p 2220 3029 857 4 v 2220 3125 a Fs(Eq)8 b Ft(?)p Fn(nM)2553 3069 y Fj(e)l(ager)2591 3125 y Fr(!)64 b Fs(Eq)8 b Ft(?)p Fn(nM)3054 3087 y Fi(0)3269 3050 y Fs(n)65 b(a)33 b(numer)-5 b(al)1822 3251 y Fn(M)1945 3196 y Fj(e)l(ager)1984 3251 y Fr(!)64 b Fn(M)2237 3214 y Fi(0)p 952 3292 2179 4 v 952 3387 a Fl(if)47 b Fn(M)58 b Fl(then)47 b Fn(N)58 b Fl(else)46 b Fn(P)1945 3332 y Fj(e)l(ager)1984 3387 y Fr(!)64 b Fl(if)47 b Fn(M)2380 3350 y Fi(0)2451 3387 y Fl(then)g Fn(N)58 b Fl(else)46 b Fn(P)50 3579 y Ft(P)m(airs)1310 3517 y Fn(M)1433 3462 y Fj(e)l(ager)1472 3517 y Fr(!)64 b Fn(M)1725 3480 y Fi(0)p 1118 3558 822 4 v 1118 3654 a Fr(h)p Fn(M)5 b(;)15 b(N)10 b Fr(i)1431 3598 y Fj(e)l(ager)1469 3654 y Fr(!)64 b(h)p Fn(M)1757 3616 y Fi(0)1781 3654 y Fn(;)15 b(N)10 b Fr(i)2399 3517 y Fn(N)2507 3462 y Fj(e)l(ager)2546 3517 y Fr(!)64 b Fn(N)2784 3480 y Fi(0)p 2241 3558 724 4 v 2241 3654 a Fr(h)p Fn(V)5 b(;)15 b(N)10 b Fr(i)2519 3598 y Fj(e)l(ager)2557 3654 y Fr(!)64 b(h)p Fn(V)5 b(;)15 b(N)10 b Fr(i)3156 3579 y Fs(V)65 b(a)33 b(value)1822 3783 y Fn(M)1945 3728 y Fj(e)l(ager)1984 3783 y Fr(!)64 b Fn(M)2237 3746 y Fi(0)p 1589 3824 904 4 v 1589 3920 a Fk(Pro)6 b(j)1794 3942 y Fm(i)1822 3920 y Fn(M)1945 3864 y Fj(e)l(ager)1984 3920 y Fr(!)64 b Fk(Pro)6 b(j)2344 3942 y Fm(i)2372 3920 y Fn(M)2470 3882 y Fi(0)50 4150 y Ft(F)-8 b(unctions)1394 4089 y Fn(M)1518 4033 y Fj(e)l(ager)1556 4089 y Fr(!)64 b Fn(M)1809 4051 y Fi(0)p 1311 4129 605 4 v 1311 4225 a Fn(M)10 b(N)1518 4169 y Fj(e)l(ager)1556 4225 y Fr(!)64 b Fn(M)1809 4187 y Fi(0)1833 4225 y Fn(N)2290 4089 y(N)2398 4033 y Fj(e)l(ager)2437 4089 y Fr(!)g Fn(N)2675 4051 y Fi(0)p 2217 4129 555 4 v 2217 4225 a Fn(V)20 b(N)2398 4169 y Fj(e)l(ager)2437 4225 y Fr(!)64 b Fn(V)20 b(N)2748 4187 y Fi(0)2963 4150 y Fs(V)65 b(a)33 b(value)1296 4463 y Ft(T)-8 b(able)30 b(2.5:)42 b(Eager)31 b(PCF)f(reduction.)p eop %%Page: 91 42 91 41 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(91)141 91 y(The)33 b(use)f(of)i Fs(delay)42 b Ft(and)32 b Fs(\014x)44 b Ft(reduction)32 b(requires)g(some)h(explanation.)48 b(Since)32 b(eager)i(reduction)e (do)s(es)h(not)0 204 y(reduce)40 b(under)e(a)j(lam)m(b)s(da)e (abstraction,)k(a)d(term)g(of)h(the)f(form)48 b Fs(delay)2532 226 y Fm(\033)2587 222 y Fi(!)2669 226 y Fm(\034)2712 204 y Ft([)p Fn(M)10 b Ft(])42 b Fr(\021)f Fn(\025x)p Ft(:)15 b Fn(\033)t(:)g(M)10 b(x)49 b Ft(will)37 b(not)k(b)s(e)0 317 y(reduced.)46 b(This)31 b(explains)f(wh)m(y)i(w)m(e)h(call)f(the)g (mapping)39 b Fn(M)g Fr(7!)29 b Fn(\025x)p Ft(:)15 b Fn(\033)s(:)h(M)10 b(x)40 b Ft(\\dela)m(y)-8 b(.")48 b(The)32 b(reason)h(that)g Fs(delay)0 430 y Ft(is)e(used)h(in)f Fs(\014x)44 b Ft(reduction)31 b(is)g(to)j(halt)d(reduction)h(of)g(a)h (recursiv)m(e)f(function)f(de\014nition)f(un)m(til)h(an)h(argumen)m(t)h (is)0 543 y(supplied.)k(An)30 b(example)g(is)g(giv)m(en)g(in)f (Exercise)h(2.4.24;)j(see)e(also)g(Exercise)f(2.4.25.)0 741 y Fk(Example)k(2.4.20)46 b Ft(Some)40 b(of)g(the)g(c)m (haracteristics)h(of)f(eager)h(reduction)e(are)h(illustrated)e(b)m(y)h (reducing)g(the)0 854 y(term)971 967 y(\()p Fs(\014x)27 b Ft(\()p Fn(\025x)p Ft(:)15 b Fs(nat)1458 961 y Fr(!)1564 967 y Fs(nat)9 b Fn(:)16 b(\025y)s Ft(:)f Fs(nat)9 b Fn(:)16 b(y)s Ft(\)\))31 b(\(\()p Fn(\025z)t Ft(:)15 b Fs(nat)c Fn(:)k(z)24 b Ft(+)c(1\))15 b(2\))0 1127 y(to)34 b(a)g(v)-5 b(alue.)50 b(This)32 b(is)g(only)h(a)h(trivial)d(\014xed)i (p)s(oin)m(t,)h(but)e(the)i(term)g(do)s(es)f(giv)m(e)h(us)f(a)h(c)m (hance)g(to)h(see)f(the)f(order)0 1240 y(of)g(ev)-5 b(aluation.)49 b(The)32 b(\014rst)g(step)i(in)d(determining)g(whic)m(h)h(reduction)g (to)i(apply)e(is)g(to)i(c)m(hec)m(k)g(the)g(en)m(tire)f(term.)0 1352 y(This)g(has)i(the)g(form)f(of)h(an)g(application)41 b Fn(M)10 b(N)19 b Ft(,)36 b(but)e(neither)g(the)h(function)42 b Fn(M)53 b Ft(nor)34 b(the)h(argumen)m(t)44 b Fn(N)53 b Ft(is)34 b(a)0 1465 y(v)-5 b(alue.)58 b(According)36 b(to)h(the)f(rule)f(at)j(the)e(b)s(ottom)h(left)f(of)g(T)-8 b(able)36 b(2.5,)j(w)m(e)e(m)m(ust)f(eager-reduce)i(the)e(function)0 1578 y Fn(M)43 b Fr(\021)33 b Fs(\014x)26 b Ft(\()p Fn(\025x)p Ft(:)15 b Fs(nat)687 1572 y Fr(!)793 1578 y Fs(nat)9 b Fn(:)16 b(\025y)s Ft(:)f Fs(nat)9 b Fn(:)16 b(y)s Ft(\))8 b(.)55 b(Since)34 b(the)h(argumen)m(t)h(to)g Fs(\014x)46 b Ft(is)34 b(a)h(v)-5 b(alue,)36 b(w)m(e)g(apply)e(the)h(reduction)0 1691 y(axiom)f(for)g Fs(\014x)11 b Ft(.)52 b(F)-8 b(ollo)m(w)m(ed)35 b(b)m(y)42 b Fn(\014)13 b Ft(-reduction,)35 b(since)42 b Fs(delay)9 b Ft([)p Fn(:)15 b(:)g(:)r Ft(])42 b(is)34 b(a)g(v)-5 b(alue,)35 b(this)e(giv)m(es)i(us)e(a)i(function)d(v)-5 b(alue)0 1804 y(\(lam)m(b)s(da)30 b(abstraction\))g(as)h(follo)m(ws:) 551 1991 y Fs(\014x)26 b Ft(\()p Fn(\025x)p Ft(:)15 b Fs(nat)1002 1985 y Fr(!)1109 1991 y Fs(nat)9 b Fn(:)15 b(\025y)s Ft(:)g Fs(nat)10 b Fn(:)15 b(y)s Ft(\))551 2062 y Fj(e)l(ager)590 2117 y Fr(!)154 b Ft(\()p Fn(\025x)p Ft(:)15 b Fs(nat)1168 2111 y Fr(!)1274 2117 y Fs(nat)9 b Fn(:)15 b(\025y)s Ft(:)g Fs(nat)10 b Fn(:)16 b(y)s Ft(\))30 b(\()p Fs(delay)10 b Ft([)p Fs(\014x)26 b Ft(\()p Fn(\025x)p Ft(:)15 b Fs(nat)2604 2111 y Fr(!)2711 2117 y Fs(nat)9 b Fn(:)15 b(\025y)s Ft(:)g Fs(nat)10 b Fn(:)15 b(y)s Ft(\)]\))551 2188 y Fj(e)l(ager)590 2244 y Fr(!)154 b Fn(\025y)s Ft(:)15 b Fs(nat)10 b Fn(:)15 b(y)0 2431 y Ft(Note)32 b(that)f(without)37 b Fs(delay)10 b Ft([)30 b(])8 b(,)31 b(the)g(eager)g(strategy)h(w)m(ould)d(ha)m(v)m(e)j(con)m (tin)m(ued)38 b Fs(\014x)50 b Ft(reduction)29 b(inde\014nitely)-8 b(.)141 2544 y(W)g(e)38 b(ha)m(v)m(e)f(no)m(w)g(reduced)f(the)g (original)f(term)45 b Fn(M)10 b(N)54 b Ft(to)37 b(a)g(term)45 b Fn(V)20 b(N)55 b Ft(with)35 b(function)43 b Fn(V)56 b Fr(\021)35 b Fn(\025y)s Ft(:)15 b Fs(nat)10 b Fn(:)15 b(y)48 b Ft(a)0 2657 y(v)-5 b(alue)31 b(but)g(argumen)m(t)40 b Fn(N)d Fr(\021)27 b Ft(\()p Fn(\025z)t Ft(:)15 b Fs(nat)10 b Fn(:)16 b(z)25 b Ft(+)20 b(1\))15 b(2)42 b(not)31 b(a)h(v)-5 b(alue.)44 b(According)31 b(to)h(the)g(rule)e(at)i(the)g(b)s(ottom)f (righ)m(t)0 2770 y(of)38 b(T)-8 b(able)37 b(2.5,)k(w)m(e)d(m)m(ust)f (eager-reduce)i(the)f(function)e(argumen)m(t.)63 b(Since)45 b Fn(\025z)t Ft(:)15 b Fs(nat)10 b Fn(:)15 b(z)29 b Ft(+)c(1)46 b(and)f(2)i(are)38 b(b)s(oth)0 2883 y(v)-5 b(alues,)30 b(w)m(e)h(can)f(apply)38 b Fn(\014)13 b Ft(-reduction,)30 b(follo)m(w)m(ed)g(b)m(y)g(reduction)g(of)g(the)h(sum)e(of)i(t)m(w)m(o) g(n)m(umerals:)1161 3072 y(\()p Fn(\025z)t Ft(:)15 b Fs(nat)10 b Fn(:)16 b(z)24 b Ft(+)c(1\))15 b(2)1897 3017 y Fj(e)l(ager)1936 3072 y Fr(!)125 b Ft(2)20 b(+)g(1)2439 3017 y Fj(e)l(ager)2478 3072 y Fr(!)125 b Ft(3)0 3262 y(This)32 b(no)m(w)h(giv)m(es)h(us)e(the)i(application)40 b(\()p Fn(\025y)s Ft(:)15 b Fs(nat)10 b Fn(:)15 b(y)s Ft(\))g(3)43 b(of)33 b(one)h(v)-5 b(alue)33 b(to)h(another,)g(whic)m(h) e(can)i(b)s(e)f(reduced)f(to)0 3375 y(3)8 b(.)p 3861 3375 40 40 v 0 3573 a Fk(Example)34 b(2.4.21)46 b Ft(Div)m(ergence)32 b(of)e(eager)i(ev)-5 b(aluation)30 b(can)h(b)s(e)e(seen)i(in)e(the)h (term)1011 3755 y Fl(let)f Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)10 b Ft(\):)15 b Fs(nat)35 b Ft(=)25 b(3)31 b Fl(in)1162 3868 y(letrec)46 b Fn(g)s Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)c Ft(\):)k Fs(nat)35 b Ft(=)25 b Fn(g)s Ft(\()p Fn(x)c Ft(+)f(1\))49 b Fl(in)e Fn(f)10 b Ft(\()p Fn(g)19 b Ft(5\))0 4050 y(from)32 b(Example)f(2.4.6.)48 b(Exercise)32 b(2.4.22)j(asks)d(y)m(ou)h(to)g(reduce)f(this)f(term.)46 b(Since)32 b(w)m(e)g(can)h(easily)e(pro)m(v)m(e)i(that)0 4163 y(this)d(term)h(is)f(equal)g(to)40 b(3)8 b(,)32 b(this)d(term)i(sho)m(ws)g(that)g(the)g(equational)g(pro)s(of)f(system) h(of)g(PCF)g(is)e(not)j(sound)d(for)0 4276 y(pro)m(ving)34 b(equiv)-5 b(alence)34 b(under)f(eager)j(ev)-5 b(aluation.)52 b(It)35 b(is)f(p)s(ossible)e(to)j(dev)m(elop)g(an)f(alternativ)m(e)h (pro)s(of)f(system)0 4389 y(for)c(eager)h(equiv)-5 b(alence,)30 b(restricting)38 b Fn(\014)13 b Ft(-con)m(v)m(ersion)31 b(to)g(the)f(case)i(where)d(the)i(function)e(argumen)m(t)h(is)g(a)g(v) -5 b(alue,)0 4502 y(for)26 b(example.)39 b(Ho)m(w)m(ev)m(er,)29 b(due)c(to)i(restrictions)e(on)h(replacing)f(sub)s(expressions,)f(the)i (resulting)e(system)j(is)e(more)0 4615 y(complicated)30 b(than)g(the)h(equational)f(system)g(for)g(PCF.)p 3861 4615 V 141 4813 a(The)35 b(deterministic)e(call-b)m(y-v)-5 b(alue)35 b(ev)-5 b(aluator)44 b Fs(eval)1990 4827 y Fm(V)2095 4813 y Ft(is)34 b(de\014ned)g(from)2738 4758 y Fj(e)l(ager)2776 4813 y Fr(!)83 b Ft(in)34 b(the)i(usual)e(w)m(a)m(y) -8 b(.)57 b(Since)0 4926 y(the)36 b(partial)g(function)832 4870 y Fj(e)l(ager)871 4926 y Fr(!)83 b Ft(selects)36 b(a)h(reduction)e(step)i(i\013)e(the)i(term)f(is)f(not)i(a)f(v)-5 b(alue,)46 b Fs(eval)3310 4940 y Fm(V)3415 4926 y Ft(ma)m(y)37 b(also)g(b)s(e)0 5039 y(de\014ned)29 b(as)i(follo)m(ws.)848 5271 y Fs(eval)1011 5285 y Fm(V)1072 5271 y Ft(\()p Fn(M)10 b Ft(\))26 b(=)1362 5127 y Fh(\()1470 5208 y Fn(M)93 b Ft(if)30 b Fn(M)40 b Ft(is)30 b(a)g(v)-5 b(alue)1470 5334 y Fn(N)108 b Ft(if)30 b Fn(M)1858 5279 y Fj(e)l(ager)1897 5334 y Fr(!)64 b Fn(M)2150 5301 y Fi(0)2204 5334 y Ft(and)29 b Fs(eval)2543 5348 y Fm(V)2604 5334 y Ft(\()p Fn(M)2737 5301 y Fi(0)2761 5334 y Ft(\))c(=)g Fn(N)p eop %%Page: 92 43 92 42 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(92)141 91 y(There)42 b(seem)h(to)g(b)s(e)e(t)m(w)m (o)j(main)d(reasons)h(for)g(implemen)m(ting)f(eager)i(rather)f(than)g (left-most)h(\(or)g(lazy\))0 204 y(ev)-5 b(aluation)35 b(in)f(practice.)55 b(The)35 b(\014rst)f(is)h(that)g(ev)m(en)h(for)f(a) h(purely)d(functional)h(language)i(suc)m(h)e(as)i(PCF)f(\()p Fs(i.e.)p Ft(,)0 317 y(a)c(language)g(without)f(assignmen)m(t)h(or)f (other)h(op)s(erations)f(with)g(side)f(e\013ects\),)k(the)e(usual)e (implemen)m(tation)h(of)0 430 y(left-most)40 b(reduction)e(is)g(less)g (e\016cien)m(t.)68 b(The)38 b(reason)h(for)g(the)h(ine\016ciency)e(app) s(ears)g(to)i(b)s(e)e(that)i(when)e(an)0 543 y(argumen)m(t)e(suc)m(h)e (as)44 b Fn(f)25 b(x)43 b Ft(is)34 b(passed)h(to)h(a)f(function)42 b Fn(g)12 b Ft(,)37 b(it)d(is)h(necessary)g(to)h(pass)f(a)g(p)s(oin)m (ter)g(to)g(the)h(co)s(de)f(for)0 656 y Fn(f)52 b Ft(and)35 b(to)g(k)m(eep)h(a)f(record)g(of)g(the)g(appropriate)e(lexical)h(en)m (vironmen)m(t.)54 b(As)35 b(a)g(result,)g(there)g(is)f(signi\014can)m (tly)0 769 y(more)h(o)m(v)m(erhead)g(to)g(implemen)m(ting)e(function)g (calls.)52 b(It)34 b(w)m(ould)g(b)s(e)f(simpler)f(just)i(to)h(call)42 b Fn(f)52 b Ft(with)33 b(argumen)m(t)0 882 y Fn(x)48 b Ft(immediately)38 b(and)h(then)g(pass)g(the)h(resulting)e(in)m (teger,)k(for)e(example,)i(to)48 b Fn(g)12 b Ft(.)69 b(The)39 b(second)g(reason)h(that)0 995 y(left-most)c(reduction)f(is)f (not)i(usually)e(implemen)m(ted)g(has)h(to)i(do)e(with)g(side)f (e\013ects.)58 b(As)36 b(illustrated)d(b)m(y)j(the)0 1108 y(man)m(y)43 b(tric)m(ks)f(used)f(in)h(Algol)g(60,)k(the)d(com)m (bination)f(of)g(left-most)h(ev)-5 b(aluation)42 b(and)g(assignmen)m(t) g(is)g(often)0 1220 y(confusing.)47 b(In)32 b(addition,)g(in)f(the)i (presence)g(of)g(side)f(e\013ects,)j(left-most)e(ev)-5 b(aluation)33 b(do)s(es)f(not)h(coincide)f(with)0 1333 y(nondeterministic)38 b(or)j(parallel)e(ev)-5 b(aluation.)71 b(The)40 b(reason)h(is)f(that)h(the)g(order)f(in)g(whic)m(h)f (assignmen)m(ts)i(are)0 1446 y(made)32 b(to)g(a)h(v)-5 b(ariable)30 b(will)f(generally)i(a\013ect)j(the)e(program)f(output.)45 b(W)-8 b(e)33 b(cannot)f(exp)s(ect)g(di\013eren)m(t)g(orders)f(of)0 1559 y(ev)-5 b(aluation)34 b(to)g(pro)s(duce)f(the)h(same)h(result.)51 b(Since)33 b(most)h(languages)g(in)f(common)h(use)g(include)e (assignmen)m(t,)0 1672 y(man)m(y)e(of)h(the)g(adv)-5 b(an)m(tages)32 b(of)e(left-most)h(or)f(lazy)h(ev)-5 b(aluation)30 b(are)g(lost.)0 1885 y Fk(Exercise)35 b(2.4.22)47 b Ft(Sho)m(w,)27 b(b)m(y)g(p)s(erforming)d(eager)k(reduction,)e(that)h (the)g(eager)h(in)m(terpreter)e(do)s(es)g(not)h(halt)f(on)0 1998 y(the)31 b(program)f(giv)m(en)g(in)f(Example)h(2.4.21.)0 2210 y Fk(Exercise)35 b(2.4.23)47 b Ft(Assuming)31 b(appropriate)h (reduction)g(rules)g(for)h(the)g(function)f(sym)m(b)s(ols)g(used)g(in)g (the)h(fac-)0 2323 y(torial)d(function)37 b Fs(fact)48 b Ft(of)30 b(Section)g(2.2.5,)j(sho)m(w)d(that)39 b Fs(fact)24 b Ft(3)2136 2267 y Fj(e)l(ager)2160 2323 y Fr(!)-61 b(!)49 b Ft(6)8 b(.)0 2535 y Fk(Exercise)35 b(2.4.24)47 b Ft(An)30 b(alternate)h(eager)h(reduction)d(for)38 b Fs(\014x)50 b Ft(migh)m(t)30 b(b)s(e)1141 2740 y Fs(\014x)1246 2762 y Fm(\033)1308 2740 y Ft(\()p Fn(\025x)p Ft(:)15 b Fn(\033)t(:)g(M)10 b Ft(\))1743 2684 y Fj(e)l(ager)1782 2740 y Fr(!)63 b Ft([)p Fs(\014x)2066 2762 y Fm(\033)2128 2740 y Ft(\()p Fn(\025x)p Ft(:)15 b Fn(\033)t(:)g(M)10 b Ft(\))p Fn(=x)p Ft(])p Fn(M)0 2944 y Ft(Find)25 b(a)h(term)35 b Fn(\025x)p Ft(:)15 b Fn(\033)s(:)h(M)44 b Ft(where)26 b(eager)h(reduction)e(as)h (de\014ned)f(in)g(T)-8 b(able)26 b(2.5)h(w)m(ould)e(terminate,)i(but)e (the)i(alter-)0 3057 y(nate)32 b(form)g(giv)m(en)f(b)m(y)h(this)f(rule) f(w)m(ould)h(not.)45 b(Explain)29 b(wh)m(y)-8 b(,)33 b(for)e(programs)h(of)g(the)f(form)40 b Fl(letrec)46 b Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fn(\033)s Ft(\))28 b(=)0 3170 y Fn(M)58 b Fl(in)47 b Fn(N)h Ft(with)29 b Fs(\014x)41 b Ft(not)31 b(o)s(ccurring)d(in)38 b Fn(M)48 b Ft(or)38 b Fn(N)19 b Ft(,)30 b(it)g(do)s(es)f(not)i(seem)f(p)s (ossible)e(to)j(distinguish)26 b(b)s(et)m(w)m(een)31 b(the)0 3283 y(t)m(w)m(o)h(p)s(ossible)c(eager)j(reductions)e(for)39 b Fs(\014x)19 b Ft(.)0 3495 y Fk(Exercise)35 b(2.4.25)47 b Ft(Eager)24 b(or)f(call-b)m(y-v)-5 b(alue)23 b(reduction)f(ma)m(y)i (also)g(b)s(e)e(applied)f(to)j(un)m(t)m(yp)s(ed)f(lam)m(b)s(da)f (calculus.)0 3631 y(With)36 b(ordinary)f(\(left-most\))j(reduction,)g (an)e(un)m(t)m(yp)s(ed)g(\014xed-p)s(oin)m(t)f(op)s(erator,)48 b Fn(Y)28 b Ft(,)38 b(ma)m(y)g(b)s(e)e(written)44 b Fn(Y)3795 3576 y Fj(def)3812 3631 y Ft(=)0 3744 y Fn(\025f)5 b(:)p Ft(\()p Fn(\025x:)15 b(f)10 b Ft(\()p Fn(xx)p Ft(\)\)\()p Fn(\025x:)16 b(f)10 b Ft(\()p Fn(xx)p Ft(\)\))e(.)66 b(Under)37 b(eager,)42 b(or)c(call-b)m(y-v)-5 b(alue)38 b(reduction,)i(the)e(standard)g(un)m(t)m(yp)s(ed)f(\014xed-)0 3885 y(p)s(oin)m(t)d(op)s(erator)g(is)g(written)42 b Fn(Z)1140 3829 y Fj(def)1157 3885 y Ft(=)49 b Fn(\025f)5 b(:)p Ft(\()p Fn(\025x:)15 b(f)10 b Ft(\()p Fs(delay)f Ft([)p Fn(xx)p Ft(]\)\)\()p Fn(\025x:)17 b(f)10 b Ft(\()p Fs(delay)f Ft([)p Fn(xx)p Ft(]\)\))44 b(where)e Fs(delay)9 b Ft([)p Fn(U)h Ft(])3499 3829 y Fj(def)3516 3885 y Ft(=)49 b Fn(\025z)t(:)16 b(U)10 b(x)0 4026 y Ft(for)45 b Fn(x)g Ft(not)38 b(free)f(in)e(un)m(t)m(yp)s(ed)i(term)45 b Fn(U)18 b Ft(.)61 b(Sho)m(w)36 b(that)i(for)45 b Fn(M)2210 3970 y Fj(def)2228 4026 y Ft(=)53 b Fn(\025x:)15 b(\025y)s(:)h(y)c Ft(,)38 b(the)f(application)44 b Fn(Y)20 b(M)55 b Ft(lazy)37 b(or)0 4139 y(left-most)d(reduces)e(to)i(a)g(term)f(b)s(eginning)d (with)i(a)h(lam)m(b)s(da,)g(and)g(similarly)d(for)41 b Fn(Z)7 b(M)51 b Ft(using)31 b(un)m(t)m(yp)s(ed)i(eager)0 4252 y(reduction.)40 b(What)31 b(happ)s(ens)d(when)i(w)m(e)g(apply)f (eager)j(reduction)d(to)40 b Fn(Y)20 b(M)e Ft(?)p eop %%Page: 93 44 93 43 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(93)0 91 y Fu(2.5)135 b(PCF)47 b(Programming)i (Examples,)h(Expressiv)l(e)f(P)l(o)l(w)l(er)g(and)e(Limita-)306 241 y(tions)0 447 y Fo(2.5.1)112 b(Records)38 b(and)46 b Fe(n)8 b Fo(-tuples.)0 619 y Ft(Records)43 b(are)h(a)g(useful)e(data) i(t)m(yp)s(e)f(in)f(P)m(ascal)j(and)d(man)m(y)i(other)g(languages.)80 b(W)-8 b(e)44 b(will)d(see)j(that)g(record)0 732 y(expressions)33 b(ma)m(y)i(b)s(e)f(translated)g(in)m(to)h(PCF)f(using)f(pairing)g(and)h (pro)5 b(jection.)52 b(Essen)m(tially)-8 b(,)35 b(a)g(record)f(is)g(an) 0 844 y(aggregate)d(of)e(one)f(or)g(more)h Fs(c)-5 b(omp)g(onents,)31 b Ft(eac)m(h)e(with)e(a)i(di\013eren)m(t)f(lab)s(el.)38 b(W)-8 b(e)29 b(can)g(com)m(bine)f(an)m(y)g(expressions)0 957 y Fn(M)88 971 y Fp(1)128 957 y Ft(:)15 b Fn(\033)220 971 y Fp(1)259 957 y Fn(;)g(:)g(:)g(:)i(;)e(M)549 972 y Fm(k)592 957 y Ft(:)g Fn(\033)684 972 y Fm(k)759 957 y Ft(and)23 b(form)g(a)h(record)31 b Fr(f)p Fn(`)1568 971 y Fp(1)1633 957 y Ft(=)25 b Fn(M)1817 971 y Fp(1)1857 957 y Fn(;)15 b(:)g(:)g(:)i(;)e(`)2097 972 y Fm(k)2165 957 y Ft(=)25 b Fn(M)2349 972 y Fm(k)2392 957 y Fr(g)32 b Ft(whose)f Fn(`)2776 971 y Fm(i)2836 957 y Ft(comp)s(onen)m(t)24 b(has)f(the)h(v)-5 b(alue)23 b(of)0 1070 y Fn(M)88 1084 y Fm(i)125 1070 y Ft(.)38 b(The)24 b(t)m(yp)s(e)g(of)g(this)f(record)i (ma)m(y)f(b)s(e)g(written)31 b Fk(record)q Fr(f)p Fn(`)2110 1084 y Fp(1)2150 1070 y Ft(:)15 b Fn(\033)2242 1084 y Fp(1)2282 1070 y Fn(;)g(:)g(:)g(:)h(;)f(`)2521 1085 y Fm(k)2564 1070 y Ft(:)g Fn(\033)2656 1085 y Fm(k)2699 1070 y Fr(g)8 b Ft(.)40 b(W)-8 b(e)25 b(select)g(the)32 b Fn(`)3405 1084 y Fm(i)3466 1070 y Ft(comp)s(onen)m(t)0 1183 y(of)j(an)m(y)f(record)43 b Fn(r)i Ft(of)35 b(this)e(t)m(yp)s(e)i (\()8 b(0)33 b Fr(\024)f Fn(i)g Fr(\024)g Fn(k)11 b Ft(\))35 b(using)e(the)i(\\dot")g(notation)43 b Fn(r)p 2755 1183 16 14 v 34 w(`)2824 1197 y Fm(i)2860 1183 y Ft(.)53 b(F)-8 b(or)35 b(example,)g(the)g(record)0 1296 y Fr(f)p Fn(A)30 b Ft(=)g(3)p Fn(;)15 b(B)35 b Ft(=)29 b Fs(true)7 b Fr(g)42 b Ft(with)32 b(comp)s(onen)m(ts)h(lab)s(eled)40 b Fn(A)h Ft(and)g Fn(B)46 b Ft(has)32 b(t)m(yp)s(e)42 b Fk(record)q Fr(f)p Fn(A)p Ft(:)15 b Fs(nat)10 b Fn(;)15 b(B)5 b Ft(:)15 b Fs(b)-5 b(o)g(ol)12 b Fr(g)c Ft(.)49 b(The)41 b Fn(A)0 1409 y Ft(comp)s(onen)m(t)31 b(is)e(selected)i(b)m(y)f(writing)37 b Fr(f)p Fn(A)26 b Ft(=)f(3)p Fn(;)15 b(B)30 b Ft(=)25 b Fs(true)7 b Fr(g)p 2069 1409 V 31 w Fn(A)h Ft(.)42 b(In)29 b(general,)i(w)m(e)g(ha)m(v)m(e)g(the)g(equational)f(axiom)39 1613 y(\()p Fs(r)-5 b(e)g(c)g(or)g(d)12 b Ft(\))969 b Fr(f)p Fn(`)1405 1627 y Fp(1)1470 1613 y Ft(=)25 b Fn(M)1654 1627 y Fp(1)1694 1613 y Fn(;)15 b(:)g(:)g(:)h(;)f(`)1933 1628 y Fm(k)2002 1613 y Ft(=)25 b Fn(M)2186 1628 y Fm(k)2228 1613 y Fr(g)p 2273 1613 V 31 w Fn(`)2342 1627 y Fm(i)2396 1613 y Ft(=)g Fn(M)2580 1627 y Fm(i)0 1817 y Ft(for)30 b(comp)s(onen)m(t)h(selection,)f(whic)m(h)f(ma)m(y)i(b)s(e)f(used)g(as) g(a)h(reduction)e(rule)g(from)h(left)g(to)h(righ)m(t.)141 1930 y(One)h(con)m(v)m(enien)m(t)h(asp)s(ect)f(of)h(records)e(is)g (that)i(comp)s(onen)m(t)f(order)g(do)s(es)g(not)g(matter)h(\(in)e(the)h (syn)m(tax)h(just)0 2043 y(in)m(tro)s(duced)27 b(and)i(in)e(most)i (languages\).)41 b(W)-8 b(e)30 b(can)f(access)i(the)37 b Fn(A)g Ft(comp)s(onen)m(t)29 b(of)g(a)h(record)37 b Fn(r)i Ft(without)28 b(ha)m(ving)0 2156 y(to)i(remem)m(b)s(er)e(whic)m (h)g(comp)s(onen)m(t)h(w)m(e)g(listed)e(\014rst)i(in)e(de\014ning)35 b Fn(r)11 b Ft(.)40 b(In)29 b(addition,)e(w)m(e)j(ma)m(y)f(c)m(ho)s (ose)h(mnemonic)0 2269 y(names)g(for)g(lab)s(els,)f(as)i(in)703 2473 y Fl(let)f Fs(p)-5 b(erson)34 b Ft(=)25 b Fk(record)p Fr(f)p Fs(name)8 b Ft(:)15 b Fs(string)9 b Fn(;)15 b Fs(age)8 b Ft(:)15 b Fs(nat)10 b Fn(;)15 b Fs(marrie)-5 b(d)11 b Ft(:)k Fs(b)-5 b(o)g(ol)12 b Fn(;)j(:)g(:)g(:)q Fr(g)0 2678 y Ft(Ho)m(w)m(ev)m(er,)45 b(these)40 b(are)g(the)g(only)g (substan)m(tiv)m(e)f(di\013erences)h(b)s(et)m(w)m(een)g(records)g(and)f (cartesian)h(pro)s(ducts;)k(b)m(y)0 2790 y(c)m(ho)s(osing)e(an)h (ordering)e(of)i(comp)s(onen)m(ts,)i(w)m(e)e(can)g(translate)g(records) f(and)g(record)g(t)m(yp)s(es)h(in)m(to)f(pairs)g(and)0 2903 y(pro)s(duct)29 b(t)m(yp)s(es)g(of)h(PCF.)g(F)-8 b(or)31 b(records)e(with)g(t)m(w)m(o)i(comp)s(onen)m(ts,)f(suc)m(h)g (as)38 b Fk(record)q Fr(f)p Fn(A)p Ft(:)15 b Fs(nat)10 b Fn(;)15 b(B)5 b Ft(:)15 b Fs(b)-5 b(o)g(ol)12 b Fr(g)c Ft(,)30 b(w)m(e)h(can)0 3016 y(translate)c(directly)e(in)m(to)i(pairs)e (b)m(y)i(c)m(ho)s(osing)f(one)h(comp)s(onen)m(t)g(to)h(b)s(e)e (\014rst.)39 b(Ho)m(w)m(ev)m(er,)29 b(for)e(records)f(with)g(more)0 3129 y(than)k(t)m(w)m(o)i(comp)s(onen)m(ts,)f(w)m(e)f(m)m(ust)h (translate)f(in)m(to)h(\\nested")g(pairs.)141 3242 y(T)-8 b(o)34 b(simplify)c(the)j(translation)f(of)42 b Fn(n)8 b Ft(-comp)s(onen)m(t)33 b(records)g(in)m(to)h(PCF,)f(w)m(e)g(will)e (de\014ne)41 b Fn(n)8 b Ft(-tuples)32 b(as)h(syn-)0 3355 y(tactic)f(sugar.)40 b(F)-8 b(or)31 b(an)m(y)g(sequence)g(of)f(t)m(yp)s (es)39 b Fn(\033)1647 3369 y Fp(1)1686 3355 y Fn(;)15 b(:)g(:)g(:)i(;)e(\033)1940 3369 y Fm(n)1996 3355 y Ft(,)30 b(w)m(e)h(in)m(tro)s(duce)e(the)39 b Fn(n)8 b Ft(-ary)31 b(pro)s(duct)e(notation)991 3582 y Fn(\033)1043 3596 y Fp(1)1098 3582 y Fr(\002)14 b Fn(:)h(:)g(:)i Fr(\002)d Fn(\033)1442 3596 y Fm(n)1575 3527 y Fj(def)1593 3582 y Ft(=)102 b Fn(\033)1818 3596 y Fp(1)1873 3582 y Fr(\002)p Ft(\()p Fn(\033)2031 3596 y Fp(2)2086 3582 y Fr(\002)14 b Fn(:)h(:)g(:)i Ft(\()p Fn(\033)2380 3596 y Fm(n)p Fi(\000)p Fp(1)2532 3582 y Fr(\002)e Fn(\033)2670 3596 y Fm(n)2717 3582 y Ft(\))g Fn(:)g(:)g(:)r Ft(\))0 3787 y(b)m(y)31 b(asso)s(ciating)f(to)i(the)e(righ)m(t.)42 b(\(This)29 b(is)h(an)g(arbitrary)g(decision.)40 b(W)-8 b(e)32 b(could)e(just)g(as) h(easily)f(asso)s(ciate)40 b Fn(n)8 b Ft(-ary)0 3899 y(pro)s(ducts)29 b(to)i(the)g(left.\))40 b(T)-8 b(o)31 b(de\014ne)f(elemen)m(ts)h(of)f(an)39 b Fn(n)8 b Ft(-ary)30 b(pro)s(duct,)g(w)m(e)h(use)f(the)g(tupling)e(notation)978 4132 y Fr(h)p Fn(M)1101 4146 y Fp(1)1141 4132 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)1431 4146 y Fm(n)1478 4132 y Fr(i)1569 4076 y Fj(def)1587 4132 y Ft(=)72 b Fr(h)p Fn(M)1853 4146 y Fp(1)1893 4132 y Fn(;)15 b Fr(h)p Fn(M)2056 4146 y Fp(2)2097 4132 y Fn(;)g(:)g(:)g(:)h Fr(h)p Fn(M)2381 4146 y Fm(n)p Fi(\000)p Fp(1)2519 4132 y Fn(;)f(M)2647 4146 y Fm(n)2694 4132 y Fr(i)g Fn(:)g(:)g(:)r Fr(ii)0 4336 y Ft(as)31 b(syn)m(tactic)g(sugar)f(for)g(a)h(nested)f(pair.)40 b(It)30 b(is)g(easy)h(to)g(c)m(hec)m(k)h(that)f(if)37 b Fn(M)2582 4350 y Fm(i)2611 4336 y Ft(:)15 b Fn(\033)2703 4350 y Fm(i)2740 4336 y Ft(,)30 b(then)1383 4540 y Fr(h)p Fn(M)1506 4554 y Fp(1)1546 4540 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)1835 4554 y Fm(n)1883 4540 y Fr(i)30 b Ft(:)46 b Fn(\033)2071 4554 y Fp(1)2126 4540 y Fr(\002)14 b Fn(:)h(:)g(:)i Fr(\002)e Fn(\033)2471 4554 y Fm(n)0 4744 y Ft(T)-8 b(o)27 b(retriev)m(e)g(the)g (comp)s(onen)m(ts)g(of)g(an)34 b Fn(n)8 b Ft(-tuple,)27 b(w)m(e)g(use)g(the)g(follo)m(wing)e(notation)i(for)f(com)m(binations)g (of)h(binary)0 4857 y(pro)5 b(jection)30 b(functions.)594 5085 y Fk(Pro)6 b(j)798 5044 y Fm(\033)838 5053 y Fd(1)885 5044 y Fi(\002)p Fm(:::)k Fi(\002)i Fm(\033)1117 5052 y Fc(n)798 5110 y Fm(i)1247 5029 y Fj(def)1264 5085 y Ft(=)100 b Fn(\025x)p Ft(:)15 b Fn(\033)1632 5099 y Fp(1)1687 5085 y Fr(\002)g Fn(:)g(:)g(:)h Fr(\002)f Fn(\033)2032 5099 y Fm(n)2079 5085 y Fn(:)p Fk(Pro)6 b(j)2309 5107 y Fp(1)2348 5085 y Ft(\()p Fk(Pro)g(j)2588 5046 y Fm(i)p Fi(\000)p Fp(1)2588 5109 y(2)2707 5085 y Fn(x)p Ft(\))234 b(\()p Fn(i)26 b(<)f(n)p Ft(\))594 5228 y Fk(Pro)6 b(j)798 5191 y Fm(\033)838 5200 y Fd(1)885 5191 y Fi(\002)p Fm(:::)k Fi(\002)i Fm(\033)1117 5199 y Fc(n)798 5251 y Fm(n)1247 5173 y Fj(def)1264 5228 y Ft(=)100 b Fn(\025x)p Ft(:)15 b Fn(\033)1632 5242 y Fp(1)1687 5228 y Fr(\002)g Fn(:)g(:)g(:)h Fr(\002)f Fn(\033)2032 5242 y Fm(n)2079 5228 y Fn(:)p Ft(\()p Fk(Pro)6 b(j)2344 5190 y Fm(n)p Fi(\000)p Fp(1)2344 5253 y(2)2481 5228 y Fn(x)p Ft(\))p eop %%Page: 94 45 94 44 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(94)0 91 y(W)-8 b(e)32 b(lea)m(v)m(e)f(it)f(as)h (an)f(exercise)h(to)g(c)m(hec)m(k)h(that)1240 296 y Fk(Pro)6 b(j)1445 255 y Fm(\033)1485 264 y Fd(1)1532 255 y Fi(\002)p Fm(:::)k Fi(\002)i Fm(\033)1764 263 y Fc(n)1445 321 y Fm(i)1811 296 y Fr(h)p Fn(M)1934 310 y Fp(1)1974 296 y Fn(;)j(:)g(:)g(:)h(;)f(M)2263 310 y Fm(n)2311 296 y Fr(i)25 b(!)-61 b(!)26 b Fn(M)2606 310 y Fm(i)2634 296 y Fn(;)0 500 y Ft(justifying)k(the)j(use)f(of)g(this)f(notation.)47 b(A)33 b(useful)d(piece)i(of)h(meta-notation)h(is)d(to)i(write)40 b Fn(\033)3206 467 y Fm(k)3290 500 y Ft(for)32 b(the)g(pro)s(duct)0 613 y Fn(\033)18 b Fr(\002)d Fn(:)g(:)g(:)h Fr(\002)f Fn(\033)42 b Ft(of)d Fn(k)50 b(\033)12 b Ft('s.)141 726 y(Using)38 b Fn(n)8 b Ft(-tuples,)30 b(w)m(e)i(can)f(no)m(w)f (translate)h(records)g(with)e(more)i(than)f(t)m(w)m(o)i(comp)s(onen)m (ts)f(in)m(to)g(PCF)g(quite)0 839 y(easily)-8 b(.)64 b(If)38 b(w)m(e)g(w)m(an)m(t)h(to)g(eliminate)e(records)h(of)g(some)h (t)m(yp)s(e)47 b Fk(record)p Fr(f)p Fn(`)2556 853 y Fp(1)2596 839 y Ft(:)15 b Fn(\033)2688 853 y Fp(1)2728 839 y Fn(;)g(:)g(:)g(:)i (;)e(`)2968 854 y Fm(k)3011 839 y Ft(:)g Fn(\033)3103 854 y Fm(k)3146 839 y Fr(g)8 b Ft(,)41 b(w)m(e)d(c)m(ho)s(ose)i(some)0 951 y(ordering)35 b(of)i(the)f(lab)s(els)43 b Fn(`)945 965 y Fp(1)984 951 y Fn(;)15 b(:)g(:)g(:)i(;)e(`)1224 966 y Fm(k)1311 951 y Ft(and)36 b(write)g(eac)m(h)h(t)m(yp)s(e)g (expression)e(and)h(record)g(expression)f(using)g(this)0 1064 y(order.)49 b(\(An)m(y)34 b(ordering)e(will)e(do,)35 b(as)e(long)g(as)h(w)m(e)f(are)h(consisten)m(t.)50 b(F)-8 b(or)34 b(concreteness,)h(w)m(e)f(could)f(use)g(alpha-)0 1177 y(n)m(umeric)c(lexicographical)g(order.\))41 b(W)-8 b(e)31 b(then)f(translate)h(expressions)e(with)g(records)h(in)m(to)g (PCF)h(as)f(follo)m(ws.)978 1410 y Fk(record)q Fr(f)p Fn(`)1352 1424 y Fp(1)1392 1410 y Ft(:)15 b Fn(\033)1484 1424 y Fp(1)1523 1410 y Fn(;)g(:)g(:)g(:)i(;)e(`)1763 1425 y Fm(k)1806 1410 y Ft(:)g Fn(\033)1898 1425 y Fm(k)1941 1410 y Fr(g)2070 1354 y Fj(def)2087 1410 y Ft(=)100 b Fn(\033)2310 1424 y Fp(1)2364 1410 y Fr(\002)15 b Fn(:)g(:)g(:)i Fr(\002)d Fn(\033)2709 1425 y Fm(k)1035 1553 y Fr(f)p Fn(`)1118 1567 y Fp(1)1183 1553 y Ft(=)25 b Fn(M)1367 1567 y Fp(1)1406 1553 y Fn(;)15 b(:)g(:)g(:)i(;)e(`)1646 1568 y Fm(k)1714 1553 y Ft(=)25 b Fn(M)1898 1568 y Fm(k)1941 1553 y Fr(g)2070 1498 y Fj(def)2087 1553 y Ft(=)100 b Fr(h)p Fn(M)2381 1567 y Fp(1)2421 1553 y Fn(;)15 b(:)g(:)g(:)i(;)e(M) 2711 1568 y Fm(k)2754 1553 y Fr(i)1792 1697 y Fn(M)p 1890 1697 16 14 v 40 w(`)1958 1711 y Fm(i)2070 1642 y Fj(def)2087 1697 y Ft(=)100 b Fk(Pro)6 b(j)2462 1654 y Fm(\033)2502 1663 y Fd(1)2549 1654 y Fi(\002)p Fm(:::)11 b Fi(\002)g Fm(\033)2781 1666 y Fc(k)2462 1723 y Fm(i)2824 1697 y Fn(M)0 1894 y Ft(If)33 b(an)h(expression)f(con)m(tains)h(more)g (than)f(one)h(t)m(yp)s(e)g(of)g(records,)h(w)m(e)f(apply)f(the)h(same)g (pro)s(cess)f(to)i(eac)m(h)g(t)m(yp)s(e)0 2007 y(indep)s(enden)m(tly)-8 b(.)0 2219 y Fk(Example)34 b(2.5.1)46 b Ft(W)-8 b(e)32 b(will)27 b(translate)k(the)f(expression)311 2423 y Fl(let)47 b Fn(r)s Ft(:)15 b Fr(f)p Fn(A)p Ft(:)g Fs(int)9 b Fn(;)31 b(B)5 b Ft(:)15 b Fs(b)-5 b(o)g(ol)11 b Fr(g)26 b Ft(=)f Fr(f)p Fn(A)h Ft(=)e(3)p Fn(;)31 b(B)f Ft(=)25 b Fs(true)7 b Fr(g)48 b Fl(in)g(if)f Fn(r)p 2472 2423 V 33 w(B)52 b Fl(then)47 b Fn(r)p 2906 2423 V 33 w(A)h Fl(else)e Fn(r)p 3334 2423 V 34 w(A)20 b Ft(+)g(1)0 2628 y(in)m(to)39 b(PCF.)g(The)f(\014rst)g(step)h(is)f(to)i(n)m(um)m(b)s(er)e(the)h (record)f(lab)s(els.)65 b(Using)38 b(the)h(n)m(um)m(b)s(er)46 b(1)i(for)f Fn(A)g Ft(and)g(2)g(for)0 2741 y Fn(B)13 b Ft(,)33 b(the)f(t)m(yp)s(e)41 b Fr(f)p Fn(A)p Ft(:)15 b Fs(int)9 b Fn(;)31 b(B)5 b Ft(:)15 b Fs(b)-5 b(o)g(ol)11 b Fr(g)41 b Ft(b)s(ecomes)g Fs(int)23 b Fr(\002)15 b Fs(b)-5 b(o)g(ol)52 b Ft(and)31 b(a)i(record)40 b Fr(f)p Fn(A)29 b Ft(=)f Fn(x;)j(B)h Ft(=)c Fn(y)s Fr(g)h Ft(:)f Fr(f)p Fn(A)p Ft(:)15 b Fs(int)10 b Fn(;)31 b(B)5 b Ft(:)15 b Fs(b)-5 b(o)g(ol)11 b Fr(g)0 2853 y Ft(b)s(ecomes)31 b(a)f(pair)38 b Fr(h)p Fn(x;)15 b(y)s Fr(i)26 b Ft(:)f Fs(int)f Fr(\002)15 b Fs(b)-5 b(o)g(ol)19 b Ft(.)41 b(F)-8 b(ollo)m(wing)30 b(the)g(general)h(pro)s(cedure)e(outlined)f(ab)s(o)m (v)m(e,)k(w)m(e)f(desugar)f(the)0 2966 y(expression)f(with)g(records)h (to)h(the)g(follo)m(wing)e(expression)g(with)g(pro)s(duct)g(t)m(yp)s (es)i(and)e(pairing:)396 3171 y Fl(let)47 b Fn(r)s Ft(:)15 b Fs(int)24 b Fr(\002)15 b Fs(b)-5 b(o)g(ol)36 b Ft(=)25 b Fr(h)p Ft(3)p Fn(;)32 b Fs(true)7 b Fr(i)48 b Fl(in)f(if)g Fk(Pro)6 b(j)2046 3193 y Fp(2)2085 3171 y Fn(r)50 b Fl(then)d Fk(Pro)6 b(j)2620 3193 y Fp(1)2659 3171 y Fn(r)50 b Fl(else)d Ft(\()p Fk(Pro)6 b(j)3229 3193 y Fp(1)3268 3171 y Fn(r)s Ft(\))20 b(+)g(1)0 3375 y(Some)30 b(sligh)m(tly)f(more)i(complicated)f (examples)g(are)g(giv)m(en)h(in)e(the)h(exercise.)p 3861 3375 40 40 v 0 3587 a Fk(Exercise)35 b(2.5.2)47 b Ft(Desugar)30 b(the)g(follo)m(wing)e(expressions)g(with)h(records)g(to)i(expressions) d(with)g(pro)s(duct)h(t)m(yp)s(es)0 3700 y(and)h(pairing.)66 3861 y(\(a\))638 4062 y Fl(let)g Fn(r)s Ft(:)15 b Fr(f)p Fn(A)p Ft(:)g Fs(int)10 b Fn(;)15 b(B)5 b Ft(:)15 b Fs(b)-5 b(o)g(ol)11 b Fn(;)k(C)7 b Ft(:)15 b Fs(int)1765 4056 y Fr(!)1871 4062 y Fs(int)9 b Fr(g)26 b Ft(=)f Fr(f)p Fn(A)h Ft(=)f(5)p Fn(;)15 b(B)30 b Ft(=)25 b Fs(false)8 b Fn(;)15 b(C)32 b Ft(=)25 b Fn(\025x)p Ft(:)15 b Fs(int)9 b Fn(:)15 b(x)p Fr(g)638 4175 y Fl(in)30 b(if)47 b Fn(r)p 951 4175 16 14 v 34 w(B)52 b Fl(then)46 b Fn(r)p 1385 4175 V 34 w(A)h Fl(else)g Ft(\()p Fn(r)p 1849 4175 V 34 w(C)7 b Ft(\)\()p Fn(r)p 2066 4175 V 33 w(A)p Ft(\))61 4406 y(\(b\))761 4607 y Fl(let)30 b Fn(f)10 b Ft(\()p Fn(r)s Ft(:)15 b Fr(f)p Fn(A)p Ft(:)g Fs(int)9 b Fn(;)15 b(C)7 b Ft(:)15 b Fs(b)-5 b(o)g(ol)12 b Fr(g)p Ft(\):)j Fr(f)p Fn(A)p Ft(:)g Fs(int)c Fn(;)k(B)5 b Ft(:)15 b Fs(b)-5 b(o)g(ol)11 b Fr(g)26 b Ft(=)f Fr(f)p Fn(A)h Ft(=)f Fn(r)p 2842 4607 V 33 w(A;)15 b(B)30 b Ft(=)25 b Fn(r)p 3219 4607 V 33 w(C)7 b Fr(g)761 4720 y Fl(in)30 b Fn(f)10 b Fr(f)p Fn(A)25 b Ft(=)g(3)p Fn(;)15 b(C)33 b Ft(=)25 b Fs(true)7 b Fr(g)227 4917 y Ft(Y)-8 b(ou)35 b(ma)m(y)f(wish)e(to)i(eliminate)f(one)h(t)m(yp)s(e)g(of)g(records)f (\014rst)g(and)g(then)h(the)g(other.)51 b(If)33 b(y)m(ou)h(do)g(this,)g (the)227 5030 y(in)m(termediate)c(term)h(should)d(b)s(e)i(a)h(w)m (ell-t)m(yp)s(ed)e(expression)g(with)g(only)h(one)g(t)m(yp)s(e)h(of)f (records.)p eop %%Page: 95 46 95 45 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(95)0 91 y Fo(2.5.2)112 b(Searc)m(hing)38 b(the)f(natural)h(n)m(um)m(b)s(ers.)0 263 y Ft(One)e(useful)g (programming)f(tec)m(hnique)i(in)e(PCF)i(is)f(to)i(\\searc)m(h")g(the)f (natural)f(n)m(um)m(b)s(ers,)h(starting)g(from)f(0.)0 376 y(In)g(recursiv)m(e)g(function)f(theory)-8 b(,)39 b(this)c(metho)s(d)h(is)g(called)g Fs(minimization,)j Ft(and)d(written)g(using)f(the)i(op)s(erator)0 489 y Fn(\026)8 b Ft(.)40 b(Sp)s(eci\014cally)-8 b(,)27 b(if)36 b Fn(p)g Ft(is)28 b(a)h(computable)f(predicate)g(on)h(the)g(natural)e (n)m(um)m(b)s(ers)g(\(whic)m(h)h(means)g(a)h(computable)0 602 y(function)i(from)40 b Fs(nat)50 b Ft(to)41 b Fs(b)-5 b(o)g(ol)19 b Ft(\),)33 b(then)41 b Fn(\026x)p Ft([)p Fn(p)15 b(x)p Ft(])40 b(is)31 b(the)i(least)f(natural)f(n)m(um)m(b)s (er)40 b Fn(n)g Ft(suc)m(h)31 b(that)41 b Fn(p)15 b(n)28 b Ft(=)g Fs(true)48 b Ft(and)0 715 y Fn(p)15 b(n)116 682 y Fi(0)170 715 y Ft(=)31 b Fs(false)50 b Ft(for)34 b(all)41 b Fn(n)834 682 y Fi(0)888 715 y Fn(<)31 b(n)8 b Ft(.)52 b(If)34 b(there)g(is)f(no)h(suc)m(h)42 b Fn(n)8 b Ft(,)35 b(then)42 b Fn(\026x)p Ft([)p Fn(p)15 b(x)p Ft(])43 b(is)33 b(\\unde\014ned,")h(whic)m(h)e(means)i(that)0 827 y(there)d(is)e(no)h(natural)g(n)m(um)m(b)s(er)37 b Fn(n)h Ft(with)g Fn(\026x)p Ft([)p Fn(p)15 b(x)p Ft(])25 b(=)g Fn(n)8 b Ft(.)141 940 y(In)39 b(PCF,)h(giv)m(en)f(a)h(natural)f (n)m(um)m(b)s(er)f(predicate)48 b Fn(p)p Ft(:)15 b Fs(nat)2164 934 y Fr(!)2270 940 y Fs(b)-5 b(o)g(ol)20 b Ft(,)42 b(w)m(e)e(can)g (compute)48 b Fn(\026x)p Ft([)p Fn(p)15 b(x)p Ft(])48 b(using)38 b(the)0 1053 y(expression)667 1166 y Fl(letrec)46 b Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)9 b Ft(\):)15 b Fs(nat)36 b Ft(=)25 b Fl(if)47 b Fn(p)15 b(x)47 b Fl(then)g Fn(x)h Fl(else)e Fn(f)10 b Ft(\()p Fn(x)20 b Ft(+)g(1\))79 b Fl(in)e Fn(f)25 b Ft(0)0 1333 y(In)m(tuitiv)m(ely)-8 b(,)27 b(the)h(recursiv)m(e)e(function)35 b Fn(f)45 b Ft(tests)28 b(to)g(see)g(if)e(its)h(argumen)m(t)36 b Fn(x)f Ft(is)27 b(has)g(the)g(prop)s(ert)m(y)35 b Fn(p)8 b Ft(.)40 b(If)27 b(so,)h(then)0 1446 y(this)d(is)f(the)i(result)f(of)g (the)h(function)f(call.)38 b(Otherwise,)26 b(the)f(function)33 b Fn(f)43 b Ft(is)25 b(called)g(recursiv)m(ely)f(on)34 b Fn(x)11 b Ft(+)g(1)d(.)39 b(Since)0 1559 y(the)31 b(\014rst)f(call)g (is)g(to)40 b Fn(f)25 b Ft(0)8 b(,)32 b(w)m(e)f(start)h(with)38 b(0)h(and)31 b(test)g(all)f(natural)g(n)m(um)m(b)s(ers)g(in)f (succession.)42 b(Ho)m(w)m(ev)m(er,)33 b(if)39 b Fn(p)15 b(n)0 1672 y Ft(ma)m(y)37 b(b)s(e)g(reduced)f(inde\014nitely)d(without) j(pro)s(ducing)f(either)h Fs(true)44 b Ft(or)36 b Fs(false)7 b Ft(,)39 b(then)e(it)f(is)g(p)s(ossible)f(to)i(reduce)0 1785 y(this)29 b(expression)g(inde\014nitely)f(without)h(testing)39 b Fn(p)p Ft(\()p Fn(n)20 b Ft(+)g(1\))8 b(.)141 1898 y(Since)30 b(w)m(e)g(will)e(use)i(minimization)e(sev)m(eral)i(times,)h (w)m(e)f(will)e(adopt)j(the)f(abbreviation)139 2125 y Fs(se)-5 b(ar)g(ch)414 2069 y Fj(def)431 2125 y Ft(=)42 b Fn(\025p)p Ft(:)15 b Fs(nat)835 2119 y Fr(!)941 2125 y Fs(b)-5 b(o)g(ol)11 b Fn(:)31 b Fl(letrec)46 b Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)9 b Ft(\):)15 b Fs(nat)35 b Ft(=)25 b Fl(if)48 b Ft(\()p Fn(p)15 b(x)p Ft(\))48 b Fl(then)f Fn(x)g Fl(else)g Fn(f)10 b Ft(\()p Fn(x)20 b Ft(+)g(1\))63 b Fl(in)g Fn(f)24 b Ft(0)0 2329 y(The)i(main)g(prop)s (ert)m(y)g(of)h Fs(se)-5 b(ar)g(ch)36 b Ft(is)26 b(describ)s(ed)f(b)m (y)i(the)g(follo)m(wing)e(prop)s(osition,)g(whic)m(h)h(relies)g(on)g (the)i(fact)f(that)0 2442 y(no)j(expression)f(reduces)h(to)h(b)s(oth)f Fs(true)37 b Ft(and)30 b Fs(false)7 b Ft(.)0 2630 y Fk(Prop)s(osition) 36 b(2.5.3)47 b Fs(L)-5 b(et)42 b Fn(M)10 b Ft(:)15 b Fs(nat)1282 2624 y Fr(!)1388 2630 y Fs(b)-5 b(o)g(ol)54 b(b)-5 b(e)33 b(any)i(PCF)f(pr)-5 b(e)g(dic)g(ate)36 b(on)f(the)f(natur)-5 b(al)36 b(numb)-5 b(ers.)46 b(If)c Fn(M)26 b(n)h Fr(!)-61 b(!)0 2743 y Fs(true)48 b(and)42 b Fn(M)25 b(n)560 2710 y Fi(0)608 2743 y Fr(!)-61 b(!)25 b Fs(false)49 b(for)33 b(al)5 b(l)41 b Fn(n)1317 2710 y Fi(0)1365 2743 y Fn(<)25 b(n)8 b Fs(,)33 b(then)41 b(se)-5 b(ar)g(ch)41 b Fn(M)36 b Fr(!)-61 b(!)25 b Fn(n)8 b Fs(.)141 2930 y Ft(The)43 b(astute)i(reader)e(ma)m(y)i(notice)f(a)g (con)m(v)m(enien)m(t)h(pun)d(in)g(the)i(statemen)m(t)i(of)d(this)g (prop)s(osition.)78 b(The)0 3043 y(statemen)m(t)27 b(includes)22 b(a)j(condition)32 b Fn(n)1287 3010 y Fi(0)1335 3043 y Fn(<)25 b(n)33 b Ft(on)g Fn(n)g Ft(and)f Fn(n)1970 3010 y Fi(0)2026 3043 y Ft(of)25 b(PCF,)g(not)g(natural)f(n)m(um)m(b)s (ers.)37 b(T)-8 b(o)26 b(b)s(e)e(precise,)h(w)m(e)0 3156 y(should)i(distinguish)f(b)s(et)m(w)m(een)k(n)m(umerals,)e(sym)m(b)s (ols)g(used)h(in)f(expressions)g(of)h(PCF,)h(and)f(the)g (\\mathematical)0 3269 y(ob)5 b(jects")33 b(w)m(e)f(usually)d(refer)j (to)g(b)m(y)g(these)g(sym)m(b)s(ols.)43 b(Ho)m(w)m(ev)m(er,)34 b(it)e(is)e(con)m(v)m(enien)m(t)j(to)g(order)e(the)h(n)m(umerals)e(b)m (y)0 3382 y(the)d(usual)f(ordering)g(on)h(natural)g(n)m(um)m(b)s(ers,)f (use)h(induction)e(on)i(n)m(umerals,)g(and)g(transfer)g(other)g(prop)s (erties)f(of)0 3495 y(the)k(natural)g(n)m(um)m(b)s(ers)f(to)i(n)m (umerals.)39 b(This)29 b(mak)m(es)i(man)m(y)f(statemen)m(ts)i(ab)s(out) e(PCF,)g(suc)m(h)g(as)h(the)f(inductiv)m(e)0 3608 y(argumen)m(t)h(in)e (the)h(pro)s(of)g(b)s(elo)m(w,)g(m)m(uc)m(h)g(easier)h(to)g(phrase.)0 3721 y Fk(Pro)s(of)66 b Ft(W)-8 b(e)32 b(will)27 b(pro)m(v)m(e)32 b(the)e(follo)m(wing)f(statemen)m(t)j(b)m(y)e(induction)e(on)39 b Fn(n)8 b Ft(:)39 4030 y(\()p Fr(\003)p Ft(\))619 3917 y(If)30 b Fn(M)25 b(n)878 3884 y Fi(0)926 3917 y Fr(!)-61 b(!)26 b Fs(false)37 b Ft(for)31 b(all)e Fn(n)1607 3884 y Fi(0)1655 3917 y Fn(<)c(n;)45 b Ft(then)771 4030 y Fs(se)-5 b(ar)g(ch)39 b Fn(M)c Fr(!)-61 b(!)25 b Fl(if)48 b Ft(\()p Fn(M)10 b(n)p Ft(\))48 b Fl(then)e Fn(n)i Fl(else)e Ft(\()p Fs(\014x)c Fn(F)13 b Ft(\)\()p Fn(n)21 b Ft(+)f(1\))p Fn(;)619 4143 y Ft(where)30 b Fn(F)43 b Ft(is)30 b Fn(\025f)10 b Ft(:)15 b Fs(nat)1374 4137 y Fr(!)1480 4143 y Fs(nat)9 b Fn(:\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b Fl(if)48 b Ft(\()p Fn(M)10 b(x)p Ft(\))49 b Fl(then)d Fn(x)i Fl(else)f Fn(f)10 b Ft(\()p Fn(x)19 b Ft(+)h(1\))p Fn(:)0 4344 y Ft(The)43 b(prop)s(osition)e(follo)m(ws)i(from)52 b(\()p Fr(\003)p Ft(\))h(b)m(y)43 b(noticing)g(that)h(if)51 b Fn(M)10 b(n)47 b Fr(!)-61 b(!)48 b Fs(true)15 b Ft(,)47 b(the)d(conditional)e(expression)0 4457 y(reduces)30 b(to)39 b Fn(n)8 b Ft(.)141 4570 y(The)32 b(inductiv)m(e)f(pro)s(of)h (b)s(egins)f(with)g(the)h(base)h(case)42 b Fn(n)28 b Ft(=)g(0)8 b(.)48 b(By)32 b(expanding)f(de\014nitions)f(and)i (reducing,)0 4683 y(w)m(e)f(ha)m(v)m(e)933 4770 y Fs(se)-5 b(ar)g(ch)39 b Fn(M)93 b Fr(!)-61 b(!)84 b Ft(\()p Fn(\025f)10 b Ft(:)15 b Fs(nat)1933 4764 y Fr(!)2039 4770 y Fs(nat)10 b Fn(:)15 b(f)25 b Ft(0\)\()p Fs(\014x)42 b Fn(F)13 b Ft(\))1394 4883 y Fr(!)-61 b(!)84 b Ft(\()p Fs(\014x)42 b Fn(F)13 b Ft(\))i(0)1394 4996 y Fr(!)-61 b(!)84 b Fn(F)28 b Ft(\()p Fs(\014x)42 b Fn(F)13 b Ft(\))i(0)1394 5109 y Fr(!)-61 b(!)84 b Fl(if)47 b Ft(\()p Fn(M)10 b Ft(0\))49 b Fl(then)d Ft(0)j Fl(else)d Ft(\()p Fs(\014x)c Fn(F)13 b Ft(\)\(1\))p eop %%Page: 96 47 96 46 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(96)0 91 y(T)-8 b(o)22 b(pro)m(v)m(e)g(the)g (inductiv)m(e)e(step,)j(supp)s(ose)d(the)i(claim)e(holds)g(for)29 b Fn(n)8 b Ft(,)24 b(and)c(that)31 b Fn(M)25 b(n)2829 58 y Fi(0)2877 91 y Fr(!)-61 b(!)25 b Fs(false)37 b Ft(for)22 b(all)28 b Fn(n)3547 58 y Fi(0)3595 91 y Fn(<)d(n)r Ft(+)r(1)8 b(.)0 204 y(Starting)28 b(with)f(the)i(inductiv)m(e)e(h)m(yp)s(othesis) h(and)g(con)m(tin)m(uing)f(with)h(the)g(assumption)g(that)37 b Fn(M)25 b(n)g Fr(!)-61 b(!)26 b Fs(false)15 b Ft(,)29 b(w)m(e)0 317 y(ha)m(v)m(e)516 404 y Fs(se)-5 b(ar)g(ch)39 b Fn(M)93 b Fr(!)-61 b(!)83 b Fl(if)47 b Ft(\()p Fn(M)10 b(n)p Ft(\))48 b Fl(then)f Fn(n)g Fl(else)g Ft(\()p Fs(\014x)42 b Fn(F)13 b Ft(\)\()p Fn(n)20 b Ft(+)g(1\))977 517 y Fr(!)-61 b(!)83 b Ft(\()p Fs(\014x)42 b Fn(F)13 b Ft(\)\()p Fn(n)20 b Ft(+)g(1\))977 630 y Fr(!)-61 b(!)83 b Fn(F)28 b Ft(\()p Fs(\014x)42 b Fn(F)13 b Ft(\)\()p Fn(n)21 b Ft(+)f(1\))977 743 y Fr(!)-61 b(!)83 b Fl(if)47 b Ft(\()p Fn(M)26 b Ft(\()p Fn(n)20 b Ft(+)g(1\)\))49 b Fl(then)d Fn(n)20 b Ft(+)g(1)48 b Fl(else)f Ft(\()p Fs(\014x)42 b Fn(F)13 b Ft(\)\(\()p Fn(n)21 b Ft(+)e(1\))j(+)d(1\))p Fn(:)0 902 y Ft(Since)34 b Fn(n)g Ft(is)25 b(a)i(meta-v)-5 b(ariable)26 b(for)g(some)h(n)m(umeral)34 b(0)p Fn(;)15 b Ft(1)p Fn(;)g Ft(2)p Fn(;)g(:)g(:)g(:)38 b Ft(of)26 b(PCF,)h(w)m(e)g(can)f(simplify)31 b Fn(n)12 b Ft(+)g(1)35 b(to)27 b(a)g(n)m(umeral,)0 1015 y(obtaining)i(an)h(expression)f(of)i (the)g(desired)d(form.)41 b(This)28 b(pro)m(v)m(es)40 b(\()p Fr(\003)p Ft(\))8 b(,)32 b(and)d(hence)i(the)f(prop)s(osition.)p 3861 1015 40 40 v 0 1228 a Fk(Example)k(2.5.4)46 b Ft(The)23 b(de\014nition)e(of)j(factorial)f(uses)g(a)h Fs(pr)-5 b(e)g(de)g(c)g(essor)37 b Ft(function)30 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)7 b Fr(\000)g Ft(1)h(,)25 b(whic)m(h)d(is)h(not)h(a)0 1341 y(basic)h(op)s(eration)g(of)h(PCF.)f (Ho)m(w)m(ev)m(er,)k(using)24 b Fs(se)-5 b(ar)g(ch,)29 b Ft(it)c(is)f(easy)j(to)f(compute)g(the)g(predecessor)f(of)h(an)m(y)g (natural)0 1454 y(n)m(um)m(b)s(er)39 b Fn(x)8 b Ft(.)45 b(W)-8 b(e)33 b(simply)d(searc)m(h)i(for)g(the)g(\014rst)39 b Fn(y)k Ft(satisfying)c Fn(y)24 b Ft(+)d(1)28 b(=)f Fn(x)8 b Ft(.)46 b(Accoun)m(ting)32 b(for)f(the)h(sp)s(ecial)f(case)0 1567 y Fn(x)d Ft(=)f(0)8 b(,)33 b(whose)f(\\predecessor")g(is)40 b(0)g(b)m(y)32 b(con)m(v)m(en)m(tion,)h(w)m(e)g(de\014ne)e(the)h (predecessor)g(function)e(on)i(the)g(natural)0 1680 y(n)m(um)m(b)s(ers) d(b)m(y)h(the)h(PCF)f(expression)512 1907 y Fs(pr)-5 b(e)g(d)711 1851 y Fj(def)728 1907 y Ft(=)42 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)16 b Fl(if)47 b Fs(Eq)8 b Ft(?)14 b Fn(x)h Ft(0)49 b Fl(then)d Ft(0)i Fl(else)f Ft(\()p Fs(se)-5 b(ar)g(ch)39 b Fn(\025y)s Ft(:)15 b Fs(nat)10 b Fn(:)15 b Fs(Eq)8 b Ft(?)15 b(\()p Fn(y)24 b Ft(+)19 b(1\))c Fn(x)p Ft(\))0 2111 y(Using)34 b(Prop)s(osition)g (2.5.3)j(and)d(prop)s(erties)g(of)44 b Fs(Eq)8 b Ft(?)g(,)36 b(it)f(is)f(straigh)m(tforw)m(ard)h(to)h(sho)m(w)g(that)f Fs(pr)-5 b(e)g(d)47 b Ft(computes)0 2224 y(the)31 b(predecessor)f (function.)p 3861 2224 V 0 2436 a Fk(Exercise)35 b(2.5.5)47 b Ft(W)-8 b(rite)27 b(a)f(PCF)h(function)33 b Fs(half)20 b Ft(:)15 b Fs(nat)1924 2430 y Fr(!)2030 2436 y Fs(nat)44 b Ft(mapping)25 b(an)m(y)i(n)m(umeral)34 b Fn(n)g Ft(to)27 b(the)g(n)m(umeral)e(for)0 2549 y Fr(b)p Fn(n=)p Ft(2)p Fr(c)8 b Ft(,)32 b(the)f(greatest)h(natural)d(n)m(um)m(b)s(er)g(not)i (exceeding)39 b Fn(n=)p Ft(2)8 b(.)0 2762 y Fk(Exercise)35 b(2.5.6)47 b Ft(W)-8 b(rite)46 b(a)g(function)f Fs(c)-5 b(omp)53 b Ft(that)47 b(maps)e(an)m(y)h(natural)f(n)m(um)m(b)s(er)53 b Fn(n)h Ft(to)47 b(the)54 b Fn(n)8 b Ft(-fold)45 b(com-)0 2875 y(p)s(osition)d(function)51 b Fn(\025f)10 b Ft(:)15 b Fs(nat)1037 2869 y Fr(!)1143 2875 y Fs(nat)10 b Fn(:\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(f)1682 2842 y Fm(n)1728 2875 y Fn(x)8 b Ft(,)48 b(where)k Fn(f)2201 2842 y Fm(n)2247 2875 y Fn(x)g Ft(is)43 b(an)h(abbreviation)f(for)g(the)i(application)0 2988 y Fn(f)10 b Ft(\()p Fn(f)g Ft(\()p Fn(:)15 b(:)g(:)h Ft(\()p Fn(f)10 b(x)p Ft(\))15 b Fn(:)g(:)g(:)q Ft(\)\))29 b(of)g Fn(f)37 b Ft(to)30 b Fn(x)e Ft(a)21 b(total)g(of)29 b Fn(n)f Ft(times.)37 b(Use)20 b(this)f(to)i(de\014ne)f(m)m (ultiplication)26 b Fs(mult)9 b Ft(:)15 b Fs(nat)25 b Fr(\002)15 b Fs(nat)3686 2982 y Fr(!)3792 2988 y Fs(nat)0 3101 y Ft(in)29 b(PCF.)h(\(Hin)m(t:)41 b(m)m(ultiply)36 b Fn(m)20 b Fr(\001)h Fn(n)38 b Ft(b)m(y)30 b(rep)s(eatedly)g(adding)37 b Fn(n)h Ft(to)31 b(itself.\))0 3313 y Fk(Exercise)k(2.5.7)47 b Ft(This)35 b(question)i(is)g(ab)s(out)g(a)h(restricted)f(form)g(of)h (recursion)e(called)h Fs(primitive)j(r)-5 b(e)g(cursion.)0 3426 y Ft(One)35 b(prop)s(ert)m(y)g(of)h(primitiv)m(e)e(recursion)g(is) h(that)h(if)43 b Fn(f)54 b Ft(is)34 b(de\014ned)h(from)44 b Fn(g)j Ft(and)d Fn(h)g Ft(b)m(y)36 b(primitiv)m(e)d(recursion,)0 3539 y(and)46 b Fn(g)k Ft(and)c Fn(h)h Ft(are)38 b(b)s(oth)g(total)g (functions)f(\()p Fs(i.e.)p Ft(,)j(yield)d(natural-n)m(um)m(b)s(er)f (results)h(for)h(all)f(natural)g(n)m(um)m(b)s(er)0 3652 y(argumen)m(ts\),)31 b(then)39 b Fn(f)48 b Ft(is)29 b(also)h(total.)66 3840 y(\(a\))46 b(A)31 b(function)37 b Fn(f)10 b Ft(:)15 b Fs(nat)936 3834 y Fr(!)1042 3840 y Fn(\033)42 b Ft(is)30 b Fs(de\014ne)-5 b(d)33 b(fr)-5 b(om)40 b Fn(g)s Ft(:)15 b Fn(\033)43 b Fs(and)d Fn(h)p Ft(:)15 b(\()p Fn(\033)k Fr(\002)c Fs(nat)10 b Ft(\))2590 3834 y Fr(!)2696 3840 y Fn(\033)42 b Fs(by)32 b(primitive)i(r)-5 b(e)g(cursion)31 b Ft(if)1563 4041 y Fn(f)25 b Ft(0)304 b(=)83 b Fn(g)1563 4154 y(f)10 b Ft(\()p Fn(n)20 b Ft(+)g(1\))83 b(=)g Fn(h)15 b Fr(h)p Ft(\()p Fn(f)26 b(n)p Ft(\))p Fn(;)15 b(n)p Fr(i)227 4356 y Ft(W)-8 b(rite)26 b(a)h(PCF)e(function)33 b Fs(prim)1313 4377 y Fm(\033)1360 4356 y Ft(:)15 b Fn(\033)1470 4350 y Fr(!)1561 4356 y Ft(\()p Fn(\033)k Fr(\002)c Fs(nat)1905 4350 y Fr(!)2011 4356 y Fn(\033)s Ft(\))2116 4350 y Fr(!)2207 4356 y Ft(\()p Fs(nat)2394 4350 y Fr(!)2500 4356 y Fn(\033)s Ft(\))35 b(suc)m(h)25 b(that)h(for)g(an)m(y)34 b Fn(g)k Ft(and)33 b Fn(h)i Ft(of)26 b(the)227 4468 y(appropriate)f(t)m(yp)s (es,)i(the)f(function)33 b(\()p Fs(prim)1716 4490 y Fm(\033)1778 4468 y Fn(g)19 b(h)p Ft(\))35 b(satis\014es)25 b(the)h(equations)f(for) 34 b Fn(f)43 b Ft(ab)s(o)m(v)m(e.)e(Y)-8 b(ou)26 b(will)d(need)227 4581 y(to)31 b(use)f(the)h(fact)g(that)g(PCF)f(allo)m(ws)g(conditional) f(expressions)g(of)h(an)m(y)h(t)m(yp)s(e.)61 4769 y(\(b\))45 b(In)32 b(PCF,)h(b)s(oth)g(addition)e(and)h(equalit)m(y)h(test)g(are)h (basic)e(op)s(erations.)48 b(Ho)m(w)m(ev)m(er,)36 b(if)31 b(w)m(e)j(add)e(primitiv)m(e)227 4882 y(recursion)d(to)h(PCF,)g(w)m(e)g (ma)m(y)g(remo)m(v)m(e)40 b(+)e(and)f Fs(Eq)8 b Ft(?)38 b(from)29 b(PCF)g(and)h(replace)f(them)h(with)e(the)i(simpler)227 4995 y(functions)36 b(of)i(successor)f(and)g(zero)h(test,)i(without)c (c)m(hanging)h(the)h(set)g(of)f(de\014nable)f(functions.)60 b(This)227 5108 y(ma)m(y)32 b(b)s(e)e(pro)m(v)m(ed)i(b)m(y)f(sho)m (wing)f(that)i(addition)d(and)h(equalit)m(y)h(test)h(are)g(de\014nable) d(in)h(a)h(v)m(ersion)g(of)g(PCF)227 5221 y(with)40 b(addition)e(and)i (equalit)m(y)g(replaced)h(b)m(y)f(primitiv)m(e)e(recursion,)k (successor)f(and)f(zero)h(test.)73 b(This)p eop %%Page: 97 48 97 47 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(97)227 91 y(problem)27 b(asks)i(y)m(ou)g(to)g(pro) m(v)m(e)h(sligh)m(tly)d(more.)40 b(Using)28 b(functions)35 b Fs(suc)-5 b(c)5 b Ft(:)15 b Fs(nat)2889 85 y Fr(!)2995 91 y Fs(nat)j Ft(,)38 b Fs(zer)-5 b(o)6 b Ft(?:)15 b Fs(nat)3602 85 y Fr(!)3708 91 y Fs(b)-5 b(o)g(ol)20 b Ft(,)227 204 y(and)38 b Fs(prim)8 b Ft(:)15 b Fn(\033)717 198 y Fr(!)808 204 y Ft(\()p Fn(\033)k Fr(\002)c Fs(nat)1151 198 y Fr(!)1257 204 y Fn(\033)s Ft(\))1362 198 y Fr(!)1469 204 y Fs(nat)1621 198 y Fr(!)1727 204 y Fn(\033)d Ft(,)30 b(satisfying)f(the)h(in\014nite)e(collection)i(of)h(equations)1353 380 y Fs(suc)-5 b(c)20 b Ft(0)26 b(=)f(1)1353 493 y Fs(suc)-5 b(c)20 b Ft(1)26 b(=)f(2)1353 587 y(.)1353 620 y(.)1353 653 y(.)1353 766 y Fs(zer)-5 b(o)6 b Ft(?)16 b(0)25 b(=)g Fs(true)1353 879 y(zer)-5 b(o)6 b Ft(?)16 b(1)25 b(=)g Fs(false)1353 972 y Ft(.)1353 1005 y(.)1353 1039 y(.)1353 1152 y Fs(prim)e Fn(g)c(h)c Ft(0)26 b(=)f Fn(g)1353 1264 y Fs(prim)e Fn(g)c(h)c Ft(\()p Fs(suc)-5 b(c)21 b Fn(n)p Ft(\))k(=)g Fn(h)15 b Fr(h)p Fs(prim)24 b Fn(g)19 b(h)c(n;)g(n)p Fr(i)p Fn(;)227 1441 y Ft(along)33 b(with)f(the)h(other)g(basic)g(op)s (erations)f(of)h(PCF)g(\(except)43 b(+)8 b(,)42 b Fs(Eq)8 b Ft(?)40 b(and)33 b Fs(\014x)11 b Ft(\),)34 b(sho)m(w)f(ho)m(w)g(to)h (de\014ne)227 1554 y(predecessor,)28 b(addition)e(and)g(equalit)m(y)h (test.)41 b(Since)26 b Fl(letrec)g Ft(is)g(de\014ned)g(using)g Fs(\014x)11 b Ft(,)28 b(do)f(not)g(use)g Fl(letrec)p Ft(.)227 1667 y(\()p Fs(Hint:)46 b Ft(T)-8 b(ry)30 b(predecessor)g (\014rst.\))0 1906 y Fo(2.5.3)112 b(Iteration)37 b(and)h(tail)e (recursion.)0 2078 y Ft(Man)m(y)30 b(algorithms,)e(when)g(written)g(in) g(an)h(imp)s(erativ)m(e)f(language)h(lik)m(e)g(P)m(ascal,)h(use)f(the)g (follo)m(wing)f(pattern)h(of)0 2191 y(initialization)e(and)j (iteration.)1397 2278 y Fs(Initialize)8 b Ft(;)1397 2391 y Fk(while)30 b Fr(:)p Fs(Done)37 b Fk(do)31 b Fs(Stmt)40 b Fk(end)0 2538 y Ft(If)25 b(the)g(sections)g Fs(Initialize)33 b Ft(and)25 b Fs(Stmt)34 b Ft(only)25 b(c)m(hange)h(the)f(v)-5 b(alues)25 b(of)g(a)h(\014xed,)g(\014nite)e(set)i(of)f(v)-5 b(ariables,)25 b(and)g Fs(Done)0 2651 y Ft(is)j(a)h(side-e\013ect-free) i(test)f(dep)s(ending)c(on)j(the)g(v)-5 b(alues)29 b(of)g(these)g(v)-5 b(ariables,)28 b(then)h(w)m(e)h(ma)m(y)f(easily)f(transform)h(a)0 2764 y(program)k(segmen)m(t)i(of)f(this)f(form)g(in)m(to)g(a)h (functional)e(program.)51 b(Let)34 b(us)f(assume)g(for)h(simplicit)m(y) c(that)35 b(there)0 2876 y(is)c(only)h(one)h(v)-5 b(ariable)31 b(in)m(v)m(olv)m(ed;)i(there)g(is)e(no)h(loss)g(of)h(generalit)m(y)f (in)f(this)h(since)f(w)m(e)i(can)g(replace)f(a)h(\014nite)e(set)0 2989 y(of)38 b(v)-5 b(ariables)37 b(b)m(y)h(a)h(record)f(or)47 b Fn(n)8 b Ft(-tuple)37 b(con)m(taining)h(their)f(v)-5 b(alues.)64 b(T)-8 b(o)38 b(put)g(this)f(in)g(the)h(con)m(text)i(of)f (PCF,)0 3102 y(supp)s(ose)29 b(w)m(e)i(ha)m(v)m(e)g(PCF)g(expressions) 1649 3207 y Fs(init)i Ft(:)26 b Fn(\033)1649 3320 y Fs(next)34 b Ft(:)25 b Fn(\033)1969 3314 y Fr(!)2075 3320 y Fn(\033)1649 3433 y Fs(done)32 b Ft(:)26 b Fn(\033)1987 3427 y Fr(!)2093 3433 y Fs(b)-5 b(o)g(ol)0 3580 y Ft(so)31 b(that)g(the)f(iteration)g (could)g(b)s(e)f(written)1182 3733 y Fn(x)c Ft(:=)g Fs(init)9 b Ft(;)1182 3846 y Fk(while)30 b Fr(:)p Ft(\()p Fs(done)22 b Fn(x)p Ft(\))31 b Fk(do)g Fn(x)25 b Ft(:=)g(\()p Fs(next)g Fn(x)p Ft(\))30 b Fk(end)0 4018 y Ft(using)40 b(an)h(assignable)f(v)-5 b(ariable)49 b Fn(x)h Ft(of)41 b(t)m(yp)s(e)50 b Fn(\033)12 b Ft(.)73 b(W)-8 b(e)43 b(ma)m(y)f(compute)f(the)h(\014nal)e(v)-5 b(alue)41 b(of)50 b Fn(x)f Ft(pro)s(duced)40 b(b)m(y)0 4131 y(this)26 b(lo)s(op,)h(using)e(essen)m(tially)h(the)i(same)f (sequence)g(of)g(op)s(erations,)h(with)d(the)i(expression)35 b Fs(lo)-5 b(op)22 b(init)i(next)g(done)0 4244 y Ft(de\014ned)29 b(b)m(y)-8 b(.)296 4446 y Fs(lo)j(op)23 b(init)g(next)h(done)1100 4390 y Fj(def)1118 4446 y Ft(=)100 b Fl(letrec)28 b Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fn(\033)s Ft(\))26 b(=)f Fl(if)47 b Ft(\()p Fs(done)23 b Fn(x)p Ft(\))48 b Fl(then)f Fn(x)h Fl(else)e Fn(f)25 b Ft(\()p Fs(next)f Fn(x)p Ft(\))31 b Fl(in)1440 4559 y Ft(\()p Fn(f)25 b Fs(init)9 b Ft(\))0 4730 y(Since)19 b Fs(lo)-5 b(op)28 b Ft(is)20 b(a)h(straigh)m(tforw)m (ard)f(generalization)g(of)g(the)h(function)e Fs(se)-5 b(ar)g(ch,)24 b Ft(the)d(analysis)d(giv)m(en)j(in)e(Prop)s(osition)0 4843 y(2.5.3)43 b(applies.)72 b(T)-8 b(o)42 b(b)s(e)f(more)g(sp)s (eci\014c,)i(writing)48 b Fs(next)1980 4810 y Fm(n)2042 4843 y Fn(x)h Ft(for)42 b(the)f(result)49 b Fs(next)9 b Ft(\()p Fs(next)g Ft(\()p Fn(:)15 b(:)g(:)i Ft(\()p Fs(next)24 b Fn(x)p Ft(\))15 b Fn(:)g(:)g(:)q Ft(\)\))51 b(of)0 4956 y(applying)28 b Fs(next)39 b Ft(to)h Fn(x)e Ft(a)31 b(total)g(of)39 b Fn(n)f Ft(times,)31 b(w)m(e)f(w)m(e)h(ha)m(v) m(e)h(the)e(follo)m(wing)f(prop)s(osition.)0 5143 y Fk(Prop)s(osition) 36 b(2.5.8)47 b Fs(If)37 b(done)23 b Ft(\()p Fs(next)1344 5110 y Fm(i)1387 5143 y Fs(init)9 b Ft(\))25 b Fr(!)-61 b(!)26 b Fs(false)45 b(for)30 b(al)5 b(l)39 b Fn(i)26 b(<)e(n)38 b Fs(and)h(done)23 b Ft(\()p Fs(next)3083 5110 y Fm(n)3145 5143 y Fs(init)9 b Ft(\))26 b Fr(!)-61 b(!)25 b Fs(true)15 b(,)30 b(then)1280 5322 y(lo)-5 b(op)23 b(init)h(next)g(done)65 b Fr(!)-61 b(!)58 b Fs(next)2412 5285 y Fm(n)2474 5322 y Fs(init)p eop %%Page: 98 49 98 48 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(98)141 91 y(The)30 b(translation)g(of)h(iterativ)m (e)g(lo)s(ops)f(in)m(to)g(recursiv)m(e)g(functions)g(alw)m(a)m(ys)h (pro)s(duces)e(a)i(recursiv)m(e)f(function)0 204 y(with)f(a)i (particular)e(form.)40 b(A)30 b(recursiv)m(e)g(function)f(with)g(a)i (de\014nition)d(of)j(the)f(form)1210 395 y Fn(f)10 b Ft(\()p Fn(x)p Ft(\))56 b(=)f Fl(if)47 b Fn(B)52 b Fl(then)47 b Fn(M)58 b Fl(else)47 b Fn(f)10 b Ft(\()p Fn(N)g Ft(\))p Fn(;)0 585 y Ft(where)35 b(neither)42 b Fn(B)13 b Ft(,)45 b Fn(M)53 b Ft(nor)43 b Fn(N)54 b Ft(con)m(tains)44 b Fn(f)17 b Ft(,)37 b(is)d(called)g(a)i Fs(tail-r)-5 b(e)g(cursive)38 b(function.)55 b Ft(In)34 b(languages)i(suc)m(h)f(as)0 698 y(Lisp)30 b(and)g(Sc)m(heme,)j(where)e(recursiv)m(e)f(functions)g (are)i(used)e(extensiv)m(ely)-8 b(,)32 b(tail-recursiv)m(e)f(functions) f(are)i(often)0 811 y(recognized)27 b(b)m(y)g(the)g(compiler.)38 b(The)27 b(reason)g(for)g(treating)g(tail-recursiv)m(e)f(functions)g (separately)h(is)f(that)h(these)0 924 y(ma)m(y)33 b(b)s(e)g(compiled)e (in)m(to)i(e\016cien)m(t)g(iterativ)m(e)g(co)s(de)g(that)h(do)s(es)e (not)h(require)f(a)h(new)f(activ)-5 b(ation)33 b(record)g(\(stac)m(k)0 1037 y(frame\))e(for)f(eac)m(h)h(recursiv)m(e)f(call)g(in)f(the)h (source)h(program.)0 1235 y Fk(Example)j(2.5.9)46 b Ft(Using)30 b(pairing,)e(w)m(e)j(ma)m(y)g(translate)g(the)f(follo)m(wing)f (iterativ)m(e)i(algorithm)e(in)m(to)i(PCF.)236 1411 y Fn(x)25 b Ft(:=)g(100;)227 1524 y Fn(y)j Ft(:)q(=)d(0;)227 1637 y Fk(while)38 b Fr(:)p Ft(\()p Fs(Eq)8 b Ft(?)15 b Fn(x)g(y)s Ft(\))39 b Fk(do)g Fn(x)25 b Ft(:=)g Fn(x)20 b Fr(\000)g Ft(1;)15 b Fn(y)29 b Ft(:)q(=)c Fn(y)e Ft(+)c(1)40 b Fk(end)0 1813 y Ft(The)d(initial)d(v)-5 b(alue)37 b(of)g(the)g(pair) 45 b Fr(h)p Fn(x;)15 b(y)s Fr(i)46 b Ft(is)f Fr(h)p Ft(100)p Fn(;)15 b Ft(0)p Fr(i)8 b Ft(.)64 b(Using)36 b(the)i(syn)m(tactic)g (sugar)f(in)m(tro)s(duced)e(in)h(Exercise)0 1926 y(2.2.12,)d(w)m(e)e (ma)m(y)g(write)e(the)i(b)s(o)s(dy)e(of)h(the)h Fk(while)f Ft(lo)s(op)f(as)i(the)f(follo)m(wing)f(\\next")j(function)1142 2139 y Fs(next)1371 2084 y Fj(def)1388 2139 y Ft(=)73 b Fn(\025)p Fr(h)p Fn(x)p Ft(:)15 b Fs(nat)10 b Fn(;)15 b(y)s Ft(:)g Fs(nat)10 b Fr(i)p Fn(:)15 b Fr(h)p Fn(x)21 b Fr(\000)f Ft(1)p Fn(;)31 b(x)20 b Ft(+)g(1)p Fr(i)p Fn(:)0 2358 y Ft(The)37 b(test)i(for)f(lo)s(op)f(termination)g(ma)m(y)h (b)s(e)f(written)g(similarly)e(as)46 b Fs(done)2672 2302 y Fj(def)2690 2358 y Ft(=)92 b Fn(\025)p Fr(h)p Fn(x)p Ft(:)15 b Fs(nat)10 b Fn(;)15 b(y)s Ft(:)g Fs(nat)10 b Fr(i)p Fn(:)15 b Ft(\()p Fs(Eq)8 b Ft(?)16 b Fn(x)f(y)s Ft(\))8 b(.)0 2471 y(Putting)30 b(these)g(together,)j(the)d Fk(while)g Ft(lo)s(op)f(ma)m(y)i(b)s(e)f(written)g(as)1346 2684 y Fn(L)1494 2628 y Fj(def)1511 2684 y Ft(=)103 b Fs(lo)-5 b(op)23 b Fr(h)p Ft(100)p Fn(;)15 b Ft(0)p Fr(i)g Fs(next)27 b(done)0 2874 y Ft(If)j(w)m(e)h(let)38 b Fn(F)52 b Ft(b)s(e)30 b(the)g(term)266 3064 y Fn(F)392 3009 y Fj(def)410 3064 y Ft(=)72 b Fn(\025f)10 b Ft(:)15 b Fs(nat)24 b Fr(\002)15 b Fs(nat)1090 3058 y Fr(!)1196 3064 y Fs(nat)24 b Fr(\002)15 b Fs(nat)10 b Fn(:)15 b(\025p)p Ft(:)g Fs(nat)25 b Fr(\002)15 b Fs(nat)9 b Fn(:)15 b Fl(if)48 b Ft(\()p Fs(done)23 b Fn(p)p Ft(\))48 b Fl(then)e Fn(p)i Fl(else)e Fn(f)10 b Ft(\()p Fs(next)24 b Fn(p)p Ft(\))p Fn(:)0 3255 y Ft(then)30 b(w)m(e)h(ma)m(y)g(reduce)f(the)h(PCF)f(expression)f (represen)m(ting)h(the)g Fl(while)f Ft(lo)s(op)h(as)g(follo)m(ws:)666 3437 y Fn(L)93 b Fr(\021)g Ft(\()p Fn(\025f)10 b Ft(:)15 b Fs(nat)24 b Fr(\002)15 b Fs(nat)1557 3431 y Fr(!)1663 3437 y Fs(nat)24 b Fr(\002)15 b Fs(nat)9 b Fn(:)15 b(f)10 b Fr(h)p Ft(100)p Fn(;)15 b Ft(0)p Fr(i)p Ft(\)\()p Fs(\014x)45 b Fn(F)13 b Ft(\))811 3544 y Fr(!)985 3550 y Ft(\()p Fs(\014x)41 b Fn(F)13 b Ft(\))p Fr(h)p Ft(100)p Fn(;)i Ft(0)p Fr(i)811 3657 y(!)985 3663 y Fn(F)e Ft(\()p Fs(\014x)42 b Fn(F)13 b Ft(\))p Fr(h)p Ft(100)p Fn(;)i Ft(0)p Fr(i)811 3770 y(!)985 3776 y Ft(\()p Fn(\025p)p Ft(:)g Fs(nat)25 b Fr(\002)15 b Fs(nat)9 b Fn(:)15 b Fl(if)47 b Fs(Eq)8 b Ft(?\()p Fs(Pr)-5 b(oj)2089 3798 y Fp(1)2129 3776 y Fn(p)p Ft(\)\()p Fs(Pr)g(oj)2428 3798 y Fp(2)2467 3776 y Fn(p)p Ft(\))48 b Fl(then)f Fn(p)1123 3889 y Fl(else)g Ft(\()p Fs(\014x)42 b Fn(F)13 b Ft(\))p Fr(h)p Ft(\()p Fs(Pr)-5 b(oj)1892 3911 y Fp(1)1931 3889 y Fn(p)p Ft(\))20 b Fr(\000)g Ft(1)p Fn(;)15 b Ft(\()p Fs(Pr)-5 b(oj)2427 3911 y Fp(2)2467 3889 y Fn(p)p Ft(\))20 b(+)g(1)p Fr(i)p Ft(\))p Fr(h)p Ft(100)p Fn(;)15 b Ft(0)p Fr(i)811 3996 y(!)985 4002 y Fl(if)47 b Fs(Eq)8 b Ft(?)o(\()p Fs(Pr)-5 b(oj)1500 4024 y Fp(1)1540 4002 y Fr(h)p Ft(100)p Fn(;)15 b Ft(0)p Fr(i)p Ft(\)\()p Fs(Pr)-5 b(oj)2086 4024 y Fp(2)2126 4002 y Fr(h)p Ft(100)p Fn(;)15 b Ft(0)p Fr(i)p Ft(\))51 b Fl(then)46 b Fr(h)p Ft(100)p Fn(;)15 b Ft(0)p Fr(i)1123 4115 y Fl(else)47 b Ft(\()p Fs(\014x)42 b Fn(F)13 b Ft(\))p Fr(h)p Ft(\()p Fs(Pr)-5 b(oj)1892 4137 y Fp(1)1931 4115 y Fr(h)p Ft(100)p Fn(;)15 b Ft(0)p Fr(i)p Ft(\))24 b Fr(\000)c Ft(1)p Fn(;)15 b Ft(\()p Fs(Pr)-5 b(oj)2675 4137 y Fp(2)2714 4115 y Fr(h)p Ft(100)p Fn(;)15 b Ft(0)p Fr(i)p Ft(\))24 b(+)19 b(1)p Fr(i)0 4297 y Ft(A)m(t)31 b(this)e(p)s(oin)m(t,)g(w)m(e)i(depart)e(from)h(left-most)g(reduction)f (order)h(and)f(ev)-5 b(aluate)31 b(all)e(the)h(pro)5 b(jections,)30 b(additions)0 4410 y(and)g(subtractions)f(b)s(efore)h (con)m(tin)m(uing.)898 4593 y Fr(!)-61 b(!)84 b Fl(if)47 b Fs(Eq)8 b Ft(?)14 b(100)h(0)50 b Fl(then)d Fr(h)p Ft(100)p Fn(;)15 b Ft(0)p Fr(i)50 b Fl(else)d Ft(\()p Fs(\014x)42 b Fn(F)13 b Ft(\))p Fr(h)p Ft(99)p Fn(;)i Ft(1)p Fr(i)913 4700 y(!)1103 4706 y Fl(if)47 b Fs(false)55 b Fl(then)46 b Fr(h)p Ft(100)p Fn(;)15 b Ft(0)p Fr(i)51 b Fl(else)c Ft(\()p Fs(\014x)42 b Fn(F)13 b Ft(\))p Fr(h)p Ft(99)p Fn(;)i Ft(1)p Fr(i)913 4813 y(!)1103 4819 y Ft(\()p Fs(\014x)41 b Fn(F)13 b Ft(\))p Fr(h)p Ft(99)p Fn(;)i Ft(1)p Fr(i)0 5001 y Ft(A)m(t)37 b(this)f(p)s(oin)m(t,)h(w)m(e)g(ha)m(v)m(e)h (completed)e(\\execution")i(of)e(one)h(iteration)f(of)h(the)f Fl(while)f Ft(lo)s(op.)58 b(Con)m(tin)m(uing)35 b(in)0 5114 y(this)g(manner,)i(w)m(e)g(can)f(see)h(that)f(the)h(functional)d (expression)h(computes)i(the)f(\014nal)f(v)-5 b(alues)35 b(of)45 b Fn(x)f Ft(and)g Fn(y)j Ft(b)m(y)0 5227 y(appro)m(ximately)31 b(the)h(same)g(sequence)h(of)f(additions,)e(subtractions)h(and)g(tests) i(as)f(the)g(iterativ)m(e)g Fk(while)g Ft(lo)s(op.)p 0 5340 40 40 v eop %%Page: 99 50 99 49 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2165 b Ft(99)141 91 y(W)-8 b(e)32 b(ma)m(y)f(compare)g(the)g (sequence)g(of)g(op)s(erations)f(in)m(v)m(olv)m(ed)g(in)g(a)h Fk(while)f Ft(lo)s(op)f(and)h(its)h(PCF)f(translation)0 204 y(b)m(y)41 b(giving)e(a)i(reduction)f(rule)f(for)h Fk(while)h Ft(lo)s(ops.)70 b(A)41 b(natural)f(rule)f(whic)m(h)g (corresp)s(onds)g(to)j(the)f(w)m(a)m(y)g(that)0 317 y(iteration)30 b(is)f(actually)h(implemen)m(ted)f(is)505 521 y Fk(while)g Fr(:)p Fn(B)35 b Fk(do)c Fn(S)k Fk(end)86 b Fr(!)f Fk(if)41 b Fn(B)35 b Fk(then)30 b Fs(skip)36 b Fk(else)p Ft(\()p Fn(S)5 b Ft(;)15 b Fk(while)31 b Fr(:)p Fn(B)j Fk(do)d Fn(S)k Fk(end)p Ft(\))0 726 y(where)e Fs(skip)39 b Ft(is)32 b(a)i(statemen)m(t)h(that)e(do)s(es)g(nothing.)48 b(W)-8 b(e)35 b(ma)m(y)e(use)g(this)f(reduction)g(rule)g(to)i(argue)g (informally)0 839 y(that)d(an)f(iterativ)m(e)h(algorithm)1182 1035 y Fn(x)25 b Ft(:=)g Fs(init)9 b Ft(;)1182 1148 y Fk(while)30 b Fr(:)p Ft(\()p Fs(done)22 b Fn(x)p Ft(\))31 b Fk(do)g Fn(x)25 b Ft(:=)g(\()p Fs(next)g Fn(x)p Ft(\))30 b Fk(end)0 1344 y Ft(and)f(its)h(translation)e(in)m(to)i(PCF)g(p)s (erform)e(the)j(same)f(sequence)g(of)g(ev)-5 b(aluations)29 b(of)h Fs(init,next)39 b Ft(and)29 b Fs(done.)41 b Ft(The)0 1457 y(reader)30 b(is)g(encouraged)h(to)g(w)m(ork)f(this)g(out)g(in)f (Exercise)h(2.5.10.)0 1670 y Fk(Exercise)35 b(2.5.10)47 b Ft(T)-8 b(ranslate)30 b(the)h(imp)s(erativ)m(e)e(algorithm)236 1857 y Fn(q)f Ft(:=)d(0)8 b(;)236 1970 y Fn(r)27 b Ft(:)q(=)e Fn(m)8 b Ft(;)227 2083 y Fl(while)38 b Fn(r)27 b Fr(\025)e Fn(n)69 b Fl(do)505 2196 y Fn(q)28 b Ft(:=)d Fn(q)e Ft(+)d(1)8 b(;)505 2309 y Fn(r)27 b Ft(:)q(=)e Fn(r)d Fr(\000)e Fn(n)8 b Ft(;)496 2422 y Fl(od)0 2610 y Ft(in)m(to)32 b(PCF)f(b)m(y)g(de\014ning)f(functions)g Fs(init)56 b(next)f(done)7 b Ft(.)45 b(\(Y)-8 b(ou)33 b(will)c(ha)m(v)m(e)j(to)h(use)e(recursion)f (to)j(implemen)m(t)d(the)0 2723 y(test)39 b Fn(r)28 b Fr(\025)d Fn(n)8 b Ft(.\))40 b(Use)30 b(the)g(reduction)e(rule)h(for)g Fk(while)g Ft(lo)s(ops)g(to)h(argue)g(informally)d(that)j(the)g(lo)s (op)e(and)h(its)g(PCF)0 2835 y(translation)h(in)m(v)m(olv)m(e)h(essen)m (tially)f(the)g(same)i(arithmetic)e(op)s(erations.)41 b(Y)-8 b(ou)31 b(ma)m(y)h(assume)e(left-most)h(order)g(of)0 2948 y(PCF)f(ev)-5 b(aluation.)0 3161 y Fk(Exercise)35 b(2.5.11)47 b Ft(T)-8 b(ranslate)36 b(the)g(follo)m(wing)e(imp)s (erativ)m(e)h(algorithm)g(to)i(compute)f(the)g(greatest)i(common)0 3274 y(divisor)28 b(in)m(to)j(PCF)f(b)m(y)g(de\014ning)e(functions)h Fs(init)54 b(next)h(done)7 b Ft(.)227 3461 y Fl(while)38 b Fn(n)24 b Fr(6)p Ft(=)h(0)70 b Fl(do)505 3574 y Fn(r)27 b Ft(:)q(=)e Fn(m)p Ft(;)496 3687 y Fl(while)37 b Fn(r)28 b Fr(\025)d Fn(n)69 b Fl(do)773 3800 y Fn(r)28 b Ft(:=)d Fn(r)e Fr(\000)d Fn(n)p Ft(;)765 3913 y Fl(od)505 4026 y Fn(m)25 b Ft(:=)g Fn(n)p Ft(;)505 4139 y Fn(n)f Ft(:)q(=)h Fn(r)s Ft(;)496 4252 y Fl(od)0 4439 y Ft(Think)j(of)j(this)e(program)h (as)h(using)37 b Fn(m)h Ft(and)g Fn(n)h Ft(as)30 b(input,)f(and)h(pro)s (ducing)e(a)i(new)g(v)-5 b(alue)30 b(of)39 b Fn(m)f Ft(as)31 b(output.)p eop %%Page: 100 51 100 50 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(100)0 91 y Fo(2.5.4)112 b(T)-9 b(otal)37 b(recursiv)m(e)f(functions)0 263 y Ft(In)30 b(this)g(section)h(and)f (the)h(next,)g(w)m(e)g(compare)h(the)f(natural-n)m(um)m(b)s(er)e (functions)g(de\014nable)g(in)h(PCF)g(with)g(the)0 376 y(classes)j(of)g(total)g(and)f(partial)g(recursiv)m(e)g(functions)f (\(de\014ned)h(b)s(elo)m(w)g(and)g(in)g(the)h(next)f(section\).)49 b(The)32 b(main)0 489 y(results)k(are)h(that)g(all)f(recursiv)m(e)g (total)i(and)e(partial)g(functions)f(on)i(the)g(natural)f(n)m(um)m(b)s (ers)g(are)h(de\014nable)e(in)0 602 y(PCF.)30 b(Similar)e(pro)s(ofs)h (using)g(T)-8 b(uring)29 b(mac)m(hines)h(are)h(giv)m(en)f(in)f(the)i (exercises.)141 715 y(A)44 b(commonly)f(accepted)i(b)s(elief,)g(called) e Fs(Chur)-5 b(ch's)46 b(thesis,)h Ft(is)c(that)h(ev)m(ery)g(n)m (umeric)e(function)h(that)h(is)0 827 y(computable)f(b)m(y)h(an)m(y)g (practical)f(computer)h(is)f(recursiv)m(e.)80 b(This)42 b(thesis)h(w)m(as)h(form)m(ulated)f(in)g(the)h(1930's,)0 940 y(b)s(efore)30 b(electronic)h(computers,)g(during)e(a)i(p)s(erio)s (d)e(when)h(mathematicians)g(w)m(ere)i(activ)m(ely)f(in)m(v)m (estigating)g(the)0 1053 y(p)s(ossibilit)m(y)21 b(and)i(imp)s (ossibilit)m(y)d(of)k(solving)f(problems)f(b)m(y)i(systematic)h (algorithms.)38 b(One)23 b(reason)i(for)e(b)s(elieving)0 1166 y(Ch)m(urc)m(h's)30 b(thesis)g(is)g(that)h(all)f(of)h(the)g (formalisms)d(for)j(de\014ning)e(computable)h(functions)g(that)h(w)m (ere)g(prop)s(osed)0 1279 y(in)g(the)i(1930's,)i(and)d(since,)g(giv)m (e)h(rise)e(to)j(the)e(same)h(set)g(of)g(functions)e(on)h(the)h (natural)e(n)m(um)m(b)s(ers.)45 b(The)32 b(early)0 1392 y(formalisms)c(include)h(the)h(recursiv)m(e)g(functions,)f(T)-8 b(uring)29 b(mac)m(hines,)i(and)e(lam)m(b)s(da)h(calculus.)39 b(It)31 b(follo)m(ws)e(from)0 1505 y(Ch)m(urc)m(h's)f(thesis)f (\(although)h(this)g(is)f(no)h(w)m(a)m(y)i(to)f(pro)m(v)m(e)g (something)f(rigorously\),)f(that)i(ev)m(ery)h(partial)d(or)h(total)0 1618 y(function)37 b(de\014nable)f(in)h(PCF)g(is)g(recursiv)m(e.)63 b(The)38 b(reason)g(is)f(that)i(w)m(e)f(ha)m(v)m(e)h(an)f(algorithm)f (for)h(computing)0 1731 y(an)m(y)32 b(de\014nable)f(function,)g(namely) g(reduction.)45 b(It)32 b(is)f(not)h(hard)f(to)h(giv)m(e)h(a)f (rigorous)f(pro)s(of)h(that)g(ev)m(ery)h(PCF-)0 1844 y(de\014nable)e(function)g(is)h(recursiv)m(e,)h(although)f(w)m(e)h (will)d(not)i(do)h(so)g(since)f(this)f(in)m(v)m(olv)m(es)i(tric)m(ks)f (with)g(recursiv)m(e)0 1957 y(functions)27 b(and)i(do)s(es)f(not)h (shed)f(m)m(uc)m(h)h(ligh)m(t)f(on)h(PCF)f(itself.)39 b(One)29 b(reason)g(for)f(pro)m(ving)g(that)i(ev)m(ery)g(recursiv)m(e)0 2070 y(total)35 b(or)g(partial)e(function)h(is)f(de\014nable)g(in)h (PCF)g(is)g(that,)i(via)f(Ch)m(urc)m(h's)e(thesis,)i(this)f(giv)m(es)h (evidence)f(that)0 2182 y(ev)m(ery)f(computable)f(function)f(on)i(the)g (natural)e(n)m(um)m(b)s(ers)g(is)h(de\014nable)f(in)g(PCF.)h(In)g (other)h(w)m(ords,)g(this)e(is)h(as)0 2295 y(close)k(as)f(w)m(e)h(can)f (get)h(to)g(sho)m(wing)f(that,)i(at)f(least)f(for)g(natural-n)m(um)m(b) s(er)f(functions,)h(PCF)g(is)f(a)i(\\univ)m(ersal")0 2408 y(programming)43 b(language.)83 b(The)43 b(second)i(reason)f(is)f (that,)49 b(b)m(y)44 b(app)s(ealing)e(to)j(undecidable)d(prop)s(erties) h(of)0 2521 y(recursiv)m(e)30 b(functions,)f(w)m(e)i(obtain)f(in)m (teresting)f(undecidabilit)m(y)e(prop)s(erties)i(of)i(PCF.)141 2634 y(A)25 b(subtle)e(issue)h(that)h(is)f(not)h(often)g(discussed)e (in)g(basic)h(courses)h(on)f(computabilit)m(y)g(or)g(complexit)m(y)h (theory)0 2747 y(is)f(the)g(limitation)f(of)h(Ch)m(urc)m(h's)g(thesis)g (for)g(functions)f(on)i(t)m(yp)s(es)f(other)h(than)f(the)h(natural)f(n) m(um)m(b)s(ers.)37 b(F)-8 b(or)26 b(basic)0 2860 y(data)36 b(suc)m(h)f(as)h(b)s(o)s(oleans,)g(strings)e(or)h(arra)m(ys)h(of)g(suc) m(h)f(data,)i(it)e(mak)m(es)i(sense)e(to)h(think)e(of)i(the)f (computable)0 2973 y(functions)29 b(as)h(precisely)f(those)i(functions) e(w)m(e)i(can)f(compute)h(when)e(w)m(e)i(co)s(de)g(eac)m(h)g(b)s(o)s (olean,)f(string)f(or)h(arra)m(y)0 3086 y(b)m(y)40 b(a)h(natural)f(n)m (um)m(b)s(er.)69 b(By)41 b(this)e(reasoning,)k(w)m(e)e(can)f(see)h (that)g(an)m(y)g(programming)e(language)i(that)g(lets)0 3199 y(us)f(asso)s(ciate)h(natural)e(n)m(um)m(b)s(ers)g(with)g(its)h (basic)g(data)h(t)m(yp)s(es,)i(and)d(compute)g(all)f(recursiv)m(e)h (functions)f(on)0 3312 y(the)32 b(natural)f(n)m(um)m(b)s(ers,)g(is)g (\\univ)m(ersal")g(for)h(de\014ning)e(computable)h(functions)g(on)h (all)f(the)h(basic)f(data)i(t)m(yp)s(es.)0 3424 y(Ho)m(w)m(ev)m(er,)51 b(for)45 b(\\in\014nite")f(v)-5 b(alues,)49 b(suc)m(h)44 b(as)i(functions,)i(the)d(issue)f(is)g(not)i(as)f(clear)g(cut.)86 b(In)44 b(particular,)0 3537 y(mathematical)h(logicians)e(ha)m(v)m(e)i (iden)m(ti\014ed)e(sev)m(eral)i(distinct)d(classes)j(of)f(\\computable) h(functions)d(on)j(the)0 3650 y(natural-n)m(um)m(b)s(er)38 b(functions")g(and)h(ha)m(v)m(e)i(not)f(b)s(een)f(able)g(to)h(pro)m(v)m (e)h(that)f(these)g(are)g(iden)m(tical.)67 b(A)40 b(related)0 3763 y(phenomenon)26 b(is)g(discussed)f(in)h(Section)h(2.5.6,)i(where)e (w)m(e)g(sho)m(w)g(that)h(certain)f(\\parallel")f(op)s(erations)g(are)i (not)0 3876 y(de\014nable)h(in)g(PCF,)h(in)f(spite)h(of)h(the)f(abilit) m(y)f(to)i(de\014ne)f(all)f(recursiv)m(e)h(functions)f(on)h(the)h (natural)e(n)m(um)m(b)s(ers.)141 3989 y(Since)44 b(there)g(are)h(some)g (subtle)f(p)s(oin)m(ts)f(ab)s(out)h(termination)f(and)h(function)g (comp)s(osition)f(for)h(partial)0 4102 y(functions,)d(w)m(e)g(b)s(egin) d(with)h(the)h(simple)e(case)j(of)f(total)h(functions.)68 b(Since)39 b(w)m(e)i(ha)m(v)m(e)g(pairing)d(in)g(PCF,)i(w)m(e)0 4215 y(will)e(consider)h(total)j(recursiv)m(e)e(functions)f(of)i(more)f (than)h(one)g(argumen)m(t.)71 b(A)41 b(function)48 b Fn(f)58 b Ft(is)39 b Fs(numeric)46 b Ft(if)0 4328 y Fn(f)10 b Ft(:)15 b Fr(N)183 4295 y Fm(k)251 4328 y Fr(!)25 b(N)51 b Ft(for)30 b(some)40 b Fn(k)28 b(>)d Ft(0)8 b(.)41 b(If)e Fr(C)k Ft(is)30 b(a)h(class)f(of)g(n)m(umeric)f(functions,)h(w)m(e)g (sa)m(y)40 b Fr(C)k Ft(is)136 4476 y Fr(\017)i Fs(Close)-5 b(d)33 b(under)e(c)-5 b(omp)g(osition)39 b Ft(if,)28 b(for)h(ev)m(ery)38 b Fn(f)1811 4490 y Fp(1)1850 4476 y Fn(;)15 b(:)g(:)g(:)h(;)f(f)2096 4491 y Fm(`)2129 4476 y Ft(:)g Fr(N)2257 4443 y Fm(k)2326 4476 y Fr(!)25 b(N)50 b Ft(and)36 b Fn(g)s Ft(:)15 b Fr(N)2924 4443 y Fm(`)2984 4476 y Fr(!)25 b(N)50 b Ft(from)36 b Fr(C)14 b Ft(,)29 b(the)g(class)227 4589 y Fr(C)44 b Ft(also)30 b(con)m(tains)h(the)g (function)37 b Fn(h)i Ft(de\014ned)29 b(b)m(y)1028 4745 y Fn(h)p Ft(\()p Fn(n)1170 4759 y Fp(1)1210 4745 y Fn(;)15 b(:)g(:)g(:)h(;)f(n)1466 4760 y Fm(k)1509 4745 y Ft(\))25 b(=)g Fn(g)s Ft(\()p Fn(f)1791 4759 y Fp(1)1831 4745 y Ft(\()p Fn(n)1921 4759 y Fp(1)1961 4745 y Fn(;)15 b(:)g(:)g(:)h(;)f (n)2217 4760 y Fm(k)2260 4745 y Ft(\))p Fn(;)g(:)g(:)g(:)i(;)e(f)2542 4760 y Fm(`)2575 4745 y Ft(\()p Fn(n)2665 4759 y Fp(1)2704 4745 y Fn(;)g(:)g(:)g(:)i(;)e(n)2961 4760 y Fm(k)3003 4745 y Ft(\)\))p Fn(;)136 4931 y Fr(\017)46 b Fs(Close)-5 b(d)30 b(under)g(primitive)f(r)-5 b(e)g(cursion)34 b Ft(if,)26 b(for)g(ev)m(ery)35 b Fn(f)10 b Ft(:)15 b Fr(N)2214 4899 y Fm(k)2272 4925 y Fn(*)2378 4931 y Fr(N)47 b Ft(and)34 b Fn(g)s Ft(:)15 b Fr(N)2855 4899 y Fm(k)r Fp(+2)3004 4925 y Fn(*)3110 4931 y Fr(N)47 b Ft(from)34 b Fr(C)14 b Ft(,)27 b(the)f(class)227 5044 y Fr(C)44 b Ft(con)m(tains)31 b(the)f(function)38 b Fn(h)h Ft(de\014ned)29 b(b)m(y)882 5193 y Fn(h)p Ft(\(0)p Fn(;)15 b(n)1109 5207 y Fp(1)1150 5193 y Fn(;)g(:)g(:)g(:)h(;)f(n)1406 5208 y Fm(k)1449 5193 y Ft(\))274 b(=)83 b Fn(f)10 b Ft(\()p Fn(n)2057 5207 y Fp(1)2096 5193 y Fn(;)15 b(:)g(:)g(:)h(;)f(n)2352 5208 y Fm(k)2395 5193 y Ft(\))882 5306 y Fn(h)p Ft(\()p Fn(m)21 b Ft(+)f(1)p Fn(;)15 b(n)1301 5320 y Fp(1)1341 5306 y Fn(;)g(:)g(:)g(:)h(;)f(n)1597 5321 y Fm(k)1640 5306 y Ft(\))83 b(=)g Fn(g)s Ft(\()p Fn(h)p Ft(\()p Fn(m;)15 b(n)2255 5320 y Fp(1)2296 5306 y Fn(;)g(:)g(:)g(:)i(;)e(n)2553 5321 y Fm(k)2595 5306 y Ft(\))p Fn(;)g(m;)g(n)2845 5320 y Fp(1)2885 5306 y Fn(;)g(:)g(:)g(:)i(;)e(n)3142 5321 y Fm(k)3184 5306 y Ft(\))p Fn(;)p eop %%Page: 101 52 101 51 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(101)136 91 y Fr(\017)46 b Fs(Close)-5 b(d)34 b(under)f(minimization)39 b Ft(if,)30 b(for)g(ev)m(ery)40 b Fn(f)10 b Ft(:)15 b Fr(N)2014 58 y Fm(k)r Fp(+1)2171 91 y Fr(!)26 b(N)51 b Ft(from)38 b Fr(C)44 b Ft(suc)m(h)30 b(that)227 204 y Fr(8)p Fn(n)333 218 y Fp(1)372 204 y Fn(;)15 b(:)g(:)g(:)h(;)f(n)628 219 y Fm(k)671 204 y Fn(:)g Fr(9)p Fn(m:)g(f)10 b Ft(\()p Fn(m;)15 b(n)1147 218 y Fp(1)1186 204 y Fn(;)g(:)g(:)g(:)i(;)e(n)1443 219 y Fm(k)1485 204 y Ft(\))26 b(=)f(0)8 b(,)31 b(the)g(class)38 b Fr(C)44 b Ft(con)m(tains)31 b(the)f(function)37 b Fn(g)43 b Ft(de\014ned)29 b(b)m(y)892 408 y Fn(g)s Ft(\()p Fn(n)1028 422 y Fp(1)1068 408 y Fn(;)15 b(:)g(:)g(:)h(;)f(n)1324 423 y Fm(k)1367 408 y Ft(\))26 b(=)f(the)30 b(least)h Fn(m)f Ft(suc)m(h)g(that)h Fn(f)10 b Ft(\()p Fn(m;)15 b(n)2670 422 y Fp(1)2709 408 y Fn(;)g(:)g(:)g(:)h(;)f(n)2965 423 y Fm(k)3008 408 y Ft(\))26 b(=)f(0)p Fn(:)0 650 y Ft(The)35 b(class)44 b Fr(R)g Ft(of)36 b Fs(total)k(r)-5 b(e)g(cursive)38 b(functions)43 b Ft(is)35 b(the)h(least)g(class)g(of)g (n)m(umeric)f(functions)f(that)j(con)m(tains)f(the)0 763 y(pro)5 b(jection)22 b(functions)29 b Fk(Pro)6 b(j)1021 726 y Fm(k)1021 785 y(i)1063 763 y Ft(\()p Fn(n)1153 777 y Fp(1)1193 763 y Fn(;)15 b(:)g(:)g(:)h(;)f(n)1449 778 y Fm(k)1492 763 y Ft(\))25 b(=)g Fn(n)1703 777 y Fm(i)1739 763 y Ft(,)f(the)f(successor)f(function)30 b Fn(\025x)p Ft(:)15 b Fs(nat)9 b Fn(:)15 b(x)t Ft(+)t(1)8 b(,)25 b(the)e(constan)m(t)g(zero)0 876 y(function)37 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b Ft(0)8 b(,)32 b(and)e(that)h(is)e(closed)h(under)f(comp)s(osition,)g(primitiv)m(e)g (recursion,)g(and)g(minimization.)141 989 y(W)-8 b(e)37 b(can)f(sho)m(w)g(that)g(ev)m(ery)h(total)g(recursiv)m(e)e(function)f (is)h(de\014nable)f(in)h(PCF,)h(in)e(the)i(follo)m(wing)f(precise)0 1102 y(sense.)40 b(F)-8 b(or)28 b(an)m(y)g(natural)e(n)m(um)m(b)s(er)34 b Fn(n)25 b Fr(2)g(N)c Ft(,)29 b(let)e(us)g(write)34 b Fr(d)p Fn(n)p Fr(e)i Ft(for)28 b(the)f(corresp)s(onding)e(n)m(umeral) i(of)g(PCF.)h(W)-8 b(e)0 1215 y(sa)m(y)32 b(a)f(n)m(umeric)e(function) 38 b Fn(f)10 b Ft(:)15 b Fr(N)1128 1182 y Fm(k)1197 1215 y Fr(!)26 b(N)52 b Ft(is)30 b Fs(PCF-de\014nable,)h Ft(or)g(simply)d Fs(de\014nable,)k Ft(if)d(there)i(is)f(a)h(closed)g(PCF)0 1328 y(expression)37 b Fn(M)10 b Ft(:)15 b Fs(nat)721 1295 y Fm(k)779 1322 y Fr(!)885 1328 y Fs(nat)j Ft(,)30 b(where)39 b Fn(nat)1493 1295 y Fm(k)1573 1328 y Ft(is)30 b(the)39 b Fn(k)11 b Ft(-ary)31 b(pro)s(duct)e(t)m(yp)s(e)39 b Fs(nat)24 b Fr(\002)15 b Fn(:)g(:)g(:)h Fr(\002)f Fs(nat)j Ft(,)31 b(suc)m(h)f(that)866 1532 y Fr(8)p Fn(n)972 1546 y Fp(1)1011 1532 y Fn(;)15 b(:)g(:)g(:)h(;)f(n)1267 1547 y Fm(k)1335 1532 y Fr(2)25 b(N)13 b Fn(:)31 b(M)10 b Fr(hd)p Fn(n)1793 1546 y Fp(1)1832 1532 y Fr(e)p Fn(;)15 b(:)g(:)g(:)i(;)e Fr(d)p Fn(n)2169 1547 y Fm(k)2213 1532 y Fr(ei)26 b Ft(=)e Fr(d)p Fn(f)10 b Ft(\()p Fn(n)2594 1546 y Fp(1)2634 1532 y Fn(;)15 b(:)g(:)g(:)h(;)f(n)2890 1547 y Fm(k)2933 1532 y Ft(\))p Fr(e)p Fn(:)0 1744 y Fk(Theorem)34 b(2.5.12)47 b Fs(Every)32 b(total)i(r)-5 b(e)g(cursive)33 b(function)g(is)f(de\014nable)i(in)e(PCF.)0 1957 y Fk(Pro)s(of)54 b Ft(T)-8 b(o)25 b(sho)m(w)g(that)g(ev)m(ery)h (total)f(recursiv)m(e)f(function)g(is)g(de\014nable)f(in)g(PCF,)i(w)m (e)g(m)m(ust)g(giv)m(e)g(the)g(pro)5 b(jection)0 2070 y(functions)41 b Fk(Pro)6 b(j)609 2033 y Fm(k)609 2092 y(i)660 2070 y Ft(,)35 b(the)f(successor)h(function,)f(and)g(the)g (constan)m(t)i(zero)f(function,)f(and)g(sho)m(w)g(closure)f(under)0 2183 y(comp)s(osition,)j(primitiv)m(e)e(recursion,)i(and)f (minimization.)54 b(Some)36 b(of)g(the)g(w)m(ork)g(has)f(already)h(b)s (een)f(done)g(in)0 2296 y(Exercise)30 b(2.5.7)i(and)e(Prop)s(osition)e (2.5.3.)43 b(F)-8 b(ollo)m(wing)30 b(the)g(de\014nitions)e(in)h (Section)h(2.5.1,)j(w)m(e)e(let)887 2523 y Fk(Pro)6 b(j)1092 2486 y Fp(1)1092 2545 y(1)1217 2467 y Fj(def)1235 2523 y Ft(=)100 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)887 2667 y Fk(Pro)6 b(j)1092 2630 y Fm(k)1092 2689 y Fp(1)1217 2611 y Fj(def)1235 2667 y Ft(=)100 b Fn(\025x)p Ft(:)15 b Fs(nat)1688 2634 y Fm(k)1730 2667 y Fn(:)h Fk(Pro)6 b(j)1975 2689 y Fp(1)2030 2667 y Fn(x)643 b Ft(\(1)26 b Fn(<)f(k)s Ft(\))887 2810 y Fk(Pro)6 b(j)1092 2774 y Fm(k)1092 2833 y(i)1217 2755 y Fj(def)1235 2810 y Ft(=)100 b Fn(\025x)p Ft(:)15 b Fs(nat)1688 2777 y Fm(k)1730 2810 y Fn(:)h Fk(Pro)6 b(j)1975 2772 y Fm(k)r Fi(\000)p Fp(1)1975 2836 y Fm(i)p Fi(\000)p Fp(1)2108 2810 y Ft(\()p Fk(Pro)g(j)2348 2833 y Fp(2)2402 2810 y Fn(x)p Ft(\))84 b(\(1)26 b Fn(<)f(i)g Fr(\024)g Fn(k)s Ft(\))0 3007 y(As)d(in)e(the)i(de\014nition)d(of)j(the)g(class)g(of)f (total)i(recursiv)m(e)e(functions,)h(w)m(e)g(ma)m(y)h(de\014ne)e (successor)h(and)f(the)h(constan)m(t)0 3120 y(function)29 b(returning)g(zero)i(b)m(y)1451 3256 y Fs(suc)-5 b(c)1704 3200 y Fj(def)1722 3256 y Ft(=)100 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)20 b Ft(+)g(1)p Fn(;)1451 3400 y Fs(zer)-5 b(o)1704 3344 y Fj(def)1722 3400 y Ft(=)100 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b Ft(0)p Fn(:)0 3575 y Ft(If)39 b Fn(f)145 3589 y Fp(1)199 3575 y Fn(:)15 b(:)g(:)i(f)366 3590 y Fm(`)398 3575 y Ft(:)e Fr(N)526 3542 y Fm(k)584 3569 y Fr(!)690 3575 y(N)53 b Ft(and)39 b Fn(g)s Ft(:)15 b Fr(N)1178 3542 y Fm(`)1227 3569 y Fr(!)1334 3575 y(N)52 b Ft(are)32 b(represen)m(ted)g(b)m(y)f(the)h(PCF) f(terms)40 b Fn(M)2953 3589 y Fp(1)3007 3575 y Fn(:)15 b(:)g(:)i(M)3217 3590 y Fm(`)3290 3575 y Ft(and)39 b Fn(N)18 b Ft(,)32 b(resp)s(ec-)0 3688 y(tiv)m(ely)-8 b(,)31 b(then)f(the)g(function)38 b Fn(h)h Ft(de\014ned)29 b(b)m(y)h(comp)s(osition)f(is)h(represen)m(ted)g(b)m(y)g(the)h(term) 1386 3892 y Fn(\025x)p Ft(:)15 b Fs(nat)1667 3854 y Fm(k)1710 3892 y Fn(:)g(N)10 b Fr(h)p Fn(M)1956 3906 y Fp(1)1996 3892 y Fn(x;)31 b(:)15 b(:)g(:)31 b(;)15 b(M)2368 3907 y Fm(`)2402 3892 y Fn(x)p Fr(i)p Fn(:)0 4096 y Ft(If)46 b Fn(f)10 b Ft(:)15 b Fr(N)290 4063 y Fm(k)348 4090 y Fr(!)454 4096 y(N)59 b Ft(and)46 b Fn(g)s Ft(:)15 b Fr(N)955 4063 y Fm(k)r Fp(+2)1104 4090 y Fr(!)1210 4096 y(N)60 b Ft(are)38 b(represen)m(ted)h(b)m(y)46 b Fn(M)57 b Ft(and)46 b Fn(N)18 b Ft(,)40 b(then)e(the)h(function)45 b Fn(h)i Ft(de\014ned)37 b(b)m(y)0 4209 y(primitiv)m(e)28 b(recursion)h(is)g (represen)m(ted)i(b)m(y)693 4413 y Fn(\025)p Fr(h)p Fn(x)p Ft(:)15 b Fs(nat)10 b Fn(;)15 b(y)s Ft(:)g Fs(nat)1275 4376 y Fm(k)1317 4413 y Fr(i)q Fn(:)g Fs(prim)23 b Ft(\()p Fn(M)j(y)s Ft(\))15 b(\()p Fn(\025)p Fr(h)p Fn(m)p Ft(:)g Fs(nat)c Fn(;)k(n)p Ft(:)g Fs(nat)9 b Fr(i)q Fn(:)15 b(N)25 b Fr(h)p Fn(m;)15 b Fr(h)p Fn(n;)g(y)s Fr(ii)p Ft(\))g Fn(x;)0 4618 y Ft(where)45 b Fs(prim)53 b Ft(is)44 b(as)i(in)e(Exercise)h(2.5.7.)87 b(Finally)-8 b(,)48 b(to)e(establish)e(closure)g(under)g(minimization,)i(supp)s(ose)0 4731 y Fn(f)10 b Ft(:)15 b Fr(N)183 4698 y Fm(k)r Fp(+1)331 4725 y Fr(!)437 4731 y(N)41 b Ft(is)20 b(represen)m(ted)g(b)m(y)28 b Fn(M)19 b Ft(,)j(and)e(for)g(ev)m(ery)29 b Fn(n)1975 4745 y Fp(1)2029 4731 y Fn(:)15 b(:)g(:)i(n)2206 4746 y Fm(k)2276 4731 y Ft(there)k(exists)f(an)28 b Fn(m)g Ft(suc)m(h)20 b(that)30 b Fn(f)10 b Ft(\()p Fn(m;)15 b(n)3628 4745 y Fp(1)3682 4731 y Fn(:)g(:)g(:)h(n)3858 4746 y Fm(k)3900 4731 y Ft(\))26 b(=)0 4843 y(0)8 b(.)41 b(By)31 b(Prop)s(osition)d(2.5.3,)33 b(the)d(function)38 b Fn(g)k Ft(de\014ned)29 b(b)m(y)h(minimization)e(is)h(represen)m(ted)i (b)m(y)1267 5048 y Fn(\025x)p Ft(:)15 b Fs(nat)1549 5010 y Fm(k)1591 5048 y Fn(:)h Fs(se)-5 b(ar)g(ch)8 b Ft(\()p Fn(\025n)p Ft(:)15 b Fs(nat)10 b Fn(:)16 b(M)25 b Fr(h)p Fn(n;)15 b(x)p Fr(i)p Ft(\))p Fn(:)p 3861 5252 40 40 v eop %%Page: 102 53 102 52 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(102)0 91 y Fk(Exercise)35 b(2.5.13)47 b Ft(Although)33 b(a)h(T)-8 b(uring)32 b(mac)m(hine)h(ma)m(y)h(compute) g(a)g(partial)f(function,)g(there)h(is)f(a)h(natural)0 204 y(total)i(function)e(asso)s(ciated)h(with)f(ev)m(ery)i(T)-8 b(uring)34 b(mac)m(hine,)i(namely)-8 b(,)36 b(the)g(function)e(giving)g (the)h(con)m(ten)m(ts)i(of)0 317 y(the)f(tap)s(e)g(after)44 b Fn(n)f Ft(steps.)57 b(This)33 b(exercise)j(asks)g(y)m(ou)g(to)g(sho)m (w)f(directly)g(that)h(this)e(function)h(is)f(de\014nable)g(in)0 430 y(PCF)i(and)f(conclude)h(that)g(ev)m(ery)h(function)e(computed)h(b) m(y)g(a)g(T)-8 b(uring)34 b(mac)m(hine)i(that)h(halts)e(on)h(all)f (input)f(is)0 543 y(de\014nable)29 b(in)g(PCF.)141 656 y(There)37 b(are)g(a)h(n)m(um)m(b)s(er)e(of)h(equiv)-5 b(alen)m(t)36 b(de\014nitions)f(of)i(T)-8 b(uring)36 b(mac)m(hines.)60 b(As)37 b(a)h(reminder,)f(and)g(to)g(set)0 769 y(notation,)g(w)m(e)f(brie\015y)e(review)g(one)i(standard)f (de\014nition)e(\(from)i([HU79)q(]\))h(b)s(efore)f(stating)h(the)g (problem.)54 b(A)0 882 y Fs(T)-7 b(uring)33 b(machine)38 b Ft(is)29 b(giv)m(en)h(b)m(y)h(a)f(tuple)1577 1084 y Fr(h)p Fn(Q;)15 b Ft(\006)p Fn(;)g Ft(\000)p Fn(;)g(\016)n(;)g(q)2046 1098 y Fp(1)2087 1084 y Fn(;)g Fr(6)10 b Fn(b;)15 b(F)e Fr(i)0 1287 y Ft(where)43 b Fn(Q)32 b Ft(=)h Fr(f)p Fn(q)570 1301 y Fp(1)609 1287 y Fn(;)15 b(:::;)g(q)805 1301 y Fm(n)853 1287 y Fr(g)44 b Ft(is)33 b(a)j(\014nite)d(set)j(of)f Fs(states;)51 b Ft(\006)43 b(is)34 b(the)h(\(\014nite\))f(input)f (alphab)s(et,)i(not)g(including)40 b Fr(6)17 b Fn(b)8 b Ft(,)0 1400 y(the)31 b(\\blank")e(sym)m(b)s(ol;)38 b(\000)h(is)29 b(the)i(\(\014nite\))f(tap)s(e)g(alphab)s(et)f(with)38 b(\000)25 b Fr(\023)g Ft(\006)8 b(;)1415 1602 y Fn(\016)30 b Ft(:)25 b Fn(Q)15 b Fr(\002)g Ft(\000)25 b Fn(*)g(Q)15 b Fr(\002)g Ft(\000)g Fr(\002f)p Fn(L;)g(R)q Fr(g)0 1805 y Ft(is)29 b(a)i(partial)f(function)f(telling)g(the)h(next)h(state,)h (sym)m(b)s(ol)d(to)i(write)f(on)g(the)h(tap)s(e,)g(and)f(direction)f (to)i(mo)m(v)m(e)h(the)0 1918 y(tap)s(e)g(head;)42 b Fn(q)501 1932 y Fp(1)580 1918 y Ft(is)32 b(the)g(start)h(state;)43 b Fr(6)13 b Fn(b)41 b Ft(is)31 b(the)h(\\blank")g(sym)m(b)s(ol;)g(and) 40 b Fn(F)i Fr(\022)28 b Fn(Q)40 b Ft(is)31 b(the)i(set)g(of)f(\014nal) f Fs(ac)-5 b(c)g(epting)0 2031 y(states.)41 b Ft(Since)35 b Fn(\016)41 b Ft(ma)m(y)29 b(b)s(e)f(a)g(partial)g(function,)36 b Fn(\016)s Ft(\()p Fn(q)s(;)15 b(g)s Ft(\))39 b(ma)m(y)29 b(b)s(e)e(unde\014ned)g(for)h(some)g(state)39 b Fn(q)28 b Fr(2)c Fn(Q)37 b Ft(and)28 b(tap)s(e)0 2144 y(sym)m(b)s(ol)42 b Fn(g)36 b Fr(2)c Ft(\000)8 b(.)54 b(In)34 b(this)g(case,)j(the)e(mac) m(hine)f(halts)g(and)g(do)s(es)h(not)g(mo)m(v)m(e.)55 b(\(The)35 b(mac)m(hine)f(also)h(halts)f(if)f(it)0 2256 y(mo)m(v)m(es)d(o\013)g(the)f(left)g(end)g(of)g(the)g(tap)s(e.\))41 b(The)29 b(mac)m(hine)f(accepts)j(its)d(input)f(if)h(it)h(halts)g(in)e (a)j(\014nal)e(state)38 b Fn(q)29 b Fr(2)24 b Fn(F)e Ft(.)0 2369 y(Since)41 b Fn(Q)8 b Ft(,)43 b(\000)e(and)h Fr(f)p Fn(L;)15 b(R)q Fr(g)42 b Ft(are)34 b(all)f(\014nite,)g(the)h (transition)e(function)40 b Fn(\016)46 b Ft(is)33 b(a)h(\014nite)e (set.)51 b(There)33 b(is)f(no)i(loss)f(of)0 2482 y(generalit)m(y)i(in)f (assuming)f(that)j(there)f(is)f(exactly)i(one)f(\014nal)f(state)45 b Fn(q)2442 2497 y Fm(f)2520 2482 y Fr(2)32 b Fn(F)57 b Ft(and)34 b(that)44 b Fn(\016)s Ft(\()p Fn(q)s(;)15 b(g)s Ft(\))46 b(is)34 b(de\014ned)g(i\013)0 2595 y Fn(q)h Fr(6)p Ft(=)e Fn(q)221 2610 y Fm(f)274 2595 y Ft(.)54 b(This)33 b(mak)m(es)44 b Fn(\016)i Ft(a)36 b(total)f(function)f(from) 42 b(\()p Fn(Q)24 b Fr(\000)e(f)p Fn(q)2137 2610 y Fm(f)2183 2595 y Fr(g)p Ft(\))15 b Fr(\002)h Ft(\000)42 b(to)i Fn(Q)15 b Fr(\002)g Ft(\000)g Fr(\002f)p Fn(L;)g(R)q Fr(g)8 b Ft(.)55 b(W)-8 b(e)36 b(ma)m(y)f(assume)0 2708 y(that)44 b(\006)34 b(=)f Fr(f)p Ft(0)p Fn(;)15 b Ft(1)p Fr(g)46 b Ft(and)d(\000)33 b(=)g(\006)24 b Fr([)f(f6)c Fn(b)p Fr(g)8 b Ft(,)37 b(since)e(an)m(y)h(sym)m(b)s(ol)e(ma)m(y)i(b)s (e)e(co)s(ded)h(b)m(y)h(a)g(sequence)f(of)h(bits)e(\(using)0 2821 y(ASCI)s(I,)29 b(for)h(example\).)41 b(In)30 b(this)f(problem,)g (y)m(ou)i(ma)m(y)g(represen)m(t)38 b Fr(6)10 b Fn(b)39 b Ft(b)m(y)30 b(the)h(n)m(um)m(b)s(er)37 b(2)8 b(.)66 3032 y(\(a\))46 b(W)-8 b(e)30 b(will)c(co)s(de)k(a)f(T)-8 b(uring)27 b(mac)m(hine)h(tap)s(e)h(using)f(a)h(co)s(ding)f(of)h(pairs) e(as)i(natural)f(n)m(um)m(b)s(ers.)39 b(Sp)s(eci\014cally)-8 b(,)227 3145 y(a)31 b(pair)e(of)i(natural)e(n)m(um)m(b)s(ers)37 b Fr(h)p Fn(n;)15 b(m)p Fr(i)39 b Ft(ma)m(y)31 b(b)s(e)f(co)s(ded)g(b)m (y)h(the)f(natural)g(n)m(um)m(b)s(er)1285 3347 y Fs(pr)11 b Ft(\()p Fn(n;)k(m)p Ft(\))25 b(=)g(\()p Fn(n)20 b Ft(+)g Fn(m)p Ft(\)\()p Fn(n)h Ft(+)e Fn(m)i Ft(+)e(1\))p Fn(=)p Ft(2)j(+)e Fn(m:)227 3550 y Ft(This)34 b(ma)m(y)i(b)s(e)f(understo)s(o) s(d)e(b)m(y)j(arranging)e(all)h(the)g(pairs)f(of)i(natural)e(n)m(um)m (b)s(ers)g(in)g(an)i(in\014nite)d(table,)227 3663 y(with)42 b Fr(h)p Ft(0)p Fn(;)15 b Ft(0)p Fr(i)45 b Ft(in)33 b(the)i(upp)s(er)d (left)j(corner)f(and)g(\014rst)g(and)g(second)h(co)s(ordinates)f (increasing)g(as)g(w)m(e)h(mo)m(v)m(e)227 3776 y(do)m(wn)23 b(and)f(righ)m(t)h(in)f(the)h(table)g(\(resp)s(ectiv)m(ely\).)38 b(If)23 b(w)m(e)g(\\w)m(alk")h(through)e(this)g(table)h(along)g(the)h (northeast)227 3889 y(diagonals,)34 b(mo)m(ving)f(to)g(the)h(next)f (diagonal)g(when)f(w)m(e)i(reac)m(h)f(the)h(top)f(b)s(order,)g(then)g (the)g(pair)41 b Fr(h)p Fn(n;)15 b(m)p Fr(i)227 4002 y Ft(is)36 b(reac)m(hed)i(after)46 b Fs(pr)10 b Ft(\()p Fn(n;)15 b(m)p Ft(\))46 b(steps.)60 b(Sho)m(w)36 b(that)i(the)f (pairing)e(function)44 b Fs(pr)56 b Ft(and)36 b(the)h(corresp)s(onding) 227 4114 y(pro)5 b(jection)30 b(functions)38 b Fn(p)1106 4128 y Fp(1)1183 4114 y Ft(and)g Fn(p)1414 4128 y Fp(2)1492 4114 y Ft(mapping)f Fs(pr)11 b Ft(\()p Fn(n;)k(m)p Ft(\))39 b(to)g Fn(n)g Ft(and)f Fn(m)g Ft(are)31 b(de\014nable)e(in)g(PCF.)61 4302 y(\(b\))45 b(W)-8 b(e)32 b(ma)m(y)f(co)s(de)f(a)h(\014nite)e (sequence)i(of)g(natural)e(n)m(um)m(b)s(ers)g(as)i(follo)m(ws:)1294 4501 y Fs(se)-5 b(q)8 b Ft(\(\))181 b(=)82 b Fs(pr)11 b Ft(\(0)p Fn(;)k Ft(0\))1294 4614 y Fs(se)-5 b(q)8 b Ft(\()p Fn(ns)p Ft(\))83 b(=)f Fs(pr)11 b Ft(\(\()p Fn(k)24 b Ft(+)c(1\))p Fn(;)31 b Fs(pr)11 b Ft(\()p Fn(n;)30 b Fs(se)-5 b(q)9 b Ft(\()p Fn(s)p Ft(\)\)\))227 4814 y(where)32 b(in)e(the)41 b Fs(se)-5 b(q)8 b Ft(\()p Fn(ns)p Ft(\))40 b(case)33 b(w)m(e)f(ma)m(y)h(follo)m(w)e(the)h(con)m(v)m(en)m (tion)h(that)41 b Fn(k)j Ft(is)31 b(the)h(length)f(of)h(sequence)41 b Fn(s)8 b Ft(.)227 4927 y(Sho)m(w)28 b(that)g(if)35 b Fn(m)25 b Ft(=)g Fs(se)-5 b(q)9 b Ft(\()p Fn(ns)p Ft(\))f(,)28 b(w)m(e)h(ma)m(y)f(compute)37 b Fn(n)f Ft(from)f Fn(m)h Ft(in)27 b(PCF.)h(Sho)m(w)f(that)i(if)35 b Fn(m)25 b Ft(=)g Fs(se)-5 b(q)8 b Ft(\()p Fn(s)p Ft(\))g(,)29 b(w)m(e)227 5040 y(ma)m(y)i(compute)39 b Fs(se)-5 b(q)8 b Ft(\()p Fn(ns)p Ft(\))39 b(from)f Fn(m)h Ft(and)f Fn(n)g Ft(in)29 b(PCF.)71 5227 y(\(c\))46 b(Let)53 b Fr(M)f Ft(b)s(e)43 b(a)i(T)-8 b(uring)42 b(mac)m(hine,)47 b(as)d(describ)s(ed)e(ab)s(o)m (v)m(e,)48 b(with)43 b(states)i(n)m(um)m(b)s(ered)51 b(1)h(through)g Fn(q)3788 5241 y Fm(M)3875 5227 y Ft(.)227 5340 y(Supp)s(ose)41 b Fn(q)35 b Fr(\024)d Fn(q)816 5354 y Fm(M)937 5340 y Ft(is)i(a)h(natural)e(n)m(um)m(b)s(er)g(represen)m (ting)h(a)h(state)h(of)43 b Fr(M)8 b Ft(,)36 b(natural)d(n)m(um)m(b)s (er)42 b Fn(n)3610 5355 y Fm(`)3685 5340 y Ft(co)s(des)p eop %%Page: 103 54 103 53 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(103)227 91 y(the)31 b(sequence)h(of)f(tap)s(e)g (sym)m(b)s(ols)e(to)j(the)f(left)g(of)g(the)g(tap)s(e)g(head,)g(as)g (in)f(\(b\))h(ab)s(o)m(v)m(e,)h(and)39 b Fn(n)3451 105 y Fm(r)3528 91 y Ft(co)s(des)31 b(the)227 204 y(sequence)h(of)f(tap)s (e)g(sym)m(b)s(ols)e(under)h(and)g(to)i(the)f(righ)m(t)g(of)g(the)g (tap)s(e)g(head.)42 b(Sho)m(w)31 b(that)g(the)g(next)h(state)227 317 y(and)d(t)m(w)m(o)i(n)m(um)m(b)s(ers)c(represen)m(ting)i(the)g(con) m(ten)m(ts)i(of)f(the)f(T)-8 b(uring)28 b(mac)m(hine)h(tap)s(e)g(are)h (computable)e(from)227 430 y(the)39 b Fn(q)12 b Ft(,)38 b Fn(n)563 445 y Fm(`)634 430 y Ft(and)g Fn(n)874 444 y Fm(r)950 430 y Ft(in)30 b(PCF.)61 618 y(\(d\))45 b(Sho)m(w)30 b(that)h(for)f(an)m(y)h(T)-8 b(uring)29 b(mac)m(hine)38 b Fr(M)8 b Ft(,)31 b(the)g(function)346 822 y Fn(f)391 836 y Fi(M)478 822 y Ft(\()p Fn(j;)15 b(s;)g(n)p Ft(\))27 b(=)55 b(the)39 b Fn(j)14 b Ft(th)30 b(tap)s(e)h(sym)m(b)s(ol)e(after) 39 b Fn(n)f Ft(computation)31 b(steps)f(of)39 b Fr(M)f Ft(on)31 b(initial)c(tap)s(e)39 b Fn(s)227 1026 y Ft(is)30 b(represen)m(table)g(in)f(PCF,)h(where)g(the)h(initial)c(tap)s(e)k(con) m(ten)m(ts)h(are)f(co)s(ded)f(as)g(a)h(natural)f(n)m(um)m(b)s(er.)71 1214 y(\(e\))46 b(A)25 b(T)-8 b(uring)23 b(mac)m(hine)32 b Fr(M)h Ft(computes)25 b(a)g(total)g(n)m(umeric)f(function)31 b Fn(f)10 b Ft(:)15 b Fr(N)38 b(!)25 b(N)46 b Ft(if,)25 b(when)e(started)i(with)f(the)227 1327 y(binary)30 b(represen)m(tation) j(of)40 b Fn(n)g Ft(on)32 b(the)g(tap)s(e,)h(the)f(mac)m(hine)f(halts)h (with)e(the)j(binary)d(represen)m(tation)i(of)227 1440 y Fn(f)10 b Ft(\()p Fn(n)p Ft(\))36 b(on)28 b(the)g(tap)s(e.)40 b(Sho)m(w)27 b(that)i(ev)m(ery)f(total)h(function)d(computed)i(b)m(y)g (a)g(T)-8 b(uring)26 b(mac)m(hine)i(is)e(de\014nable)227 1553 y(in)j(PCF.)0 1796 y Fo(2.5.5)112 b(P)m(artial)36 b(recursiv)m(e)h(functions)0 1968 y Ft(In)21 b(this)g(section,)j(w)m(e) e(sho)m(w)f(that)i(ev)m(ery)f(partial)f(recursiv)m(e)g(function)g(is)f (de\014nable)h(in)f(PCF.)i(Since)f(it)g(is)g(generally)0 2080 y(b)s(eliev)m(ed)27 b(that)i(all)f(mec)m(hanically)f(computable)i (functions)e(are)i(partial)e(recursiv)m(e)h(functions,)g(as)h (discussed)d(in)0 2193 y(Section)g(2.5.4,)i(the)e(main)f(theorem)h(of)g (this)e(section)i(suggests)h(that)f(ev)m(ery)h(function)d(on)i(the)g (natural)e(n)m(um)m(b)s(ers)0 2306 y(that)36 b(could)e(b)s(e)g (computed)h(b)m(y)g(an)m(y)h(ordinary)d(computer)j(is)e(de\014nable)f (in)h(PCF.)h(Tw)m(o)h(corollaries)e(are)h(that)0 2419 y(there)29 b(is)e(no)i(algorithm)f(to)h(determine)f(whether)g(a)h(PCF)f (expression)f(has)i(a)g(normal)e(form)h(and)g(no)h(algorithm)0 2532 y(to)i(determine)f(whether)f(t)m(w)m(o)j(PCF)e(expressions)f(are)i (pro)m(v)-5 b(ably)29 b(equal.)141 2645 y(Although)e(w)m(e)h(ma)m(y)g (pro)m(v)m(e)h(the)e(main)g(theorem)h(of)g(this)e(section)i(without)f (rep)s(eating)g(the)g(inductiv)m(e)g(argu-)0 2758 y(men)m(t)34 b(of)g(Theorem)f(2.5.12,)k(there)d(are)g(t)m(w)m(o)h(reasons)f(for)f (giving)f(a)j(direct)e(inductiv)m(e)f(pro)s(of.)50 b(The)33 b(\014rst)g(is)f(to)0 2871 y(emphasize)27 b(the)i(di\013erence)e(b)s (et)m(w)m(een)i(represen)m(ting)e(a)h(total)h(function)e(and)g (represen)m(ting)g(a)h(partial)f(one.)40 b(The)0 2984 y(second)34 b(is)g(to)h(gain)f(further)f(in)m(tuition)f(for)i(the)g(ev) -5 b(aluation)34 b(mec)m(hanism)g(of)g(PCF)h(and)e(its)h(relation)f(to) j(stan-)0 3097 y(dard)24 b(mathematical)h(con)m(v)m(en)m(tions)g(ab)s (out)g(partial)e(functions.)37 b(This)23 b(in)m(tuition)g(ma)m(y)i(b)s (e)f(useful)f(in)g(considering)0 3210 y(\\parallel")29 b(functions)g(in)g(the)i(next)f(section.)141 3322 y(W)-8 b(e)34 b(discuss)c(the)j(represen)m(tation)f(of)h(partial)e(functions)g (b)s(efore)h(de\014ning)e(the)j(class)f(of)g(partial)g(recursiv)m(e)0 3435 y(functions.)141 3548 y(Supp)s(ose)42 b(w)m(e)h(ha)m(v)m(e)i(some) e(partial)f(function)50 b Fn(f)10 b Ft(:)15 b Fr(N)60 b Fn(*)46 b Fr(N)64 b Ft(whic)m(h)42 b(w)m(e)i(w)m(ould)e(lik)m(e)g(to) i(represen)m(t)f(b)m(y)h(a)0 3661 y(PCF)32 b(expression.)45 b(W)-8 b(e)33 b(clearly)e(w)m(an)m(t)i(a)g(closed)f(term)40 b Fn(M)10 b Ft(:)15 b Fs(nat)2237 3655 y Fr(!)2343 3661 y Fs(nat)50 b Ft(suc)m(h)32 b(that)41 b Fn(M)10 b Fr(d)p Fn(n)p Fr(e)40 b Ft(giv)m(es)33 b(the)f(v)-5 b(alue)32 b(of)0 3774 y Fn(f)10 b Ft(\()p Fn(n)p Ft(\))43 b(when)g Fn(f)10 b Ft(\()p Fn(n)p Ft(\))43 b(is)34 b(de\014ned.)55 b(Ho)m(w)m(ev)m(er,)39 b(it)34 b(is)h(not)g(as)h(clear)f(what)h(prop)s (ert)m(y)43 b Fn(M)53 b Ft(should)34 b(ha)m(v)m(e)i(if)43 b Fn(f)10 b Ft(\()p Fn(n)p Ft(\))43 b(is)0 3887 y Fs(not)i Ft(de\014ned.)54 b(One)35 b(p)s(ossibilit)m(y)-8 b(,)34 b(of)h(course,)i(is)e(to)h(not)f(to)h(require)f(an)m(y)g(prop)s(ert)m (y)g(of)44 b Fn(M)10 b Fr(d)p Fn(n)p Fr(e)e Ft(.)56 b(Ho)m(w)m(ev)m (er,)39 b(an)0 4000 y(accurate)29 b(represen)m(tation)f(of)g(a)g (partial)f(function)f(is)h(a)h(term)36 b Fn(M)46 b Ft(with)35 b Fn(M)10 b Fr(d)p Fn(n)p Fr(e)36 b Ft(\\de\014ned")27 b(i\013)36 b Fn(f)10 b Ft(\()p Fn(n)p Ft(\))35 b(is)27 b(de\014ned.)0 4113 y(This)32 b(requires)g(some)j(notion)e(of)h (\\unde\014ned)e(term.")52 b(A)34 b(con)m(v)m(enien)m(t)h(represen)m (tation)f(of)g(unde\014nedness,)e(or)0 4226 y(non)m(termination,)27 b(is)g(that)36 b Fn(M)10 b Fr(d)p Fn(n)p Fr(e)36 b Ft(should)26 b(ha)m(v)m(e)i(no)g(normal)e(form)h(when)35 b Fn(f)10 b Ft(\()p Fn(n)p Ft(\))35 b(is)27 b(unde\014ned.)37 b(W)-8 b(e)29 b(will)c(adopt)0 4339 y(this)k(b)s(elo)m(w)h(for)g(terms)g(that) h(represen)m(t)g(n)m(umeric)e(functions.)141 4452 y(W)-8 b(e)30 b(sa)m(y)g(a)g(partial)e(function)36 b Fn(f)10 b Ft(:)15 b Fr(N)1365 4419 y Fm(k)1432 4452 y Fn(*)25 b Fr(N)51 b Ft(is)28 b Fs(PCF-de\014nable,)h Ft(or)h(simply)c Fs(de\014nable,)k Ft(if)e(there)i(is)e(a)h(closed)0 4565 y(PCF)h(expression)38 b Fn(M)10 b Ft(:)15 b Fs(nat)939 4532 y Fm(k)996 4559 y Fr(!)1102 4565 y Fs(nat)48 b Ft(suc)m(h)30 b(that)h(for)g(all)37 b Fn(n)2008 4579 y Fp(1)2047 4565 y Fn(;)15 b(:)g(:)g(:)i(;)e(n)2304 4580 y Fm(k)2372 4565 y Fr(2)24 b(N)e Ft(,)30 b(w)m(e)h(ha)m(v)m(e)469 4829 y Fn(M)10 b Fr(hd)p Fn(n)697 4843 y Fp(1)737 4829 y Fr(e)p Fn(;)15 b(:)g(:)g(:)i(;)e Fr(d)p Fn(n)1074 4844 y Fm(k)1117 4829 y Fr(ei)26 b Ft(=)1314 4685 y Fh(\()1423 4772 y Fr(d)p Fn(f)10 b Ft(\()p Fn(n)1608 4786 y Fp(1)1647 4772 y Fn(;)15 b(:)g(:)g(:)h(;)f(n)1903 4787 y Fm(k)1946 4772 y Ft(\))p Fr(e)296 b Ft(if)30 b Fn(f)10 b Ft(\()p Fn(n)2546 4786 y Fp(1)2584 4772 y Fn(;)15 b(:)g(:)g(:)i(;)e(n)2841 4787 y Fm(k)2884 4772 y Ft(\))30 b(is)g(de\014ned,)1423 4885 y(has)g(no)g(normal)f(form)83 b(otherwise)0 5094 y(The)30 b(reader)g(familiar)e(with)g(un)m(t)m(yp)s(ed)i(lam)m(b)s(da)f (calculus)f(ma)m(y)j(kno)m(w)f(that)h(the)f(con)m(v)m(en)m(tion)i(for)e (partial)f(func-)0 5207 y(tions)i(is)f(to)i(represen)m(t)f (unde\014nedness)d(b)m(y)k(lac)m(k)f(of)h(a)f(head)g(normal)f(form.)43 b(F)-8 b(or)32 b(PCF,)f(a)h Fs(he)-5 b(ad)35 b(normal)g(form)7 b Ft(,)0 5319 y(is)33 b(either)g(a)h(n)m(umeral,)f(a)h(b)s(o)s(olean)f (constan)m(t)i(\()8 b Fs(true)50 b Ft(or)41 b Fs(false)16 b Ft(\),)35 b(or)f(term)f(of)h(the)g(form)42 b Fn(\025x)p Ft(:)15 b Fn(\033)n(:M)52 b Ft(or)42 b Fr(h)p Fn(M)5 b(;)15 b(N)10 b Fr(i)e Ft(,)p eop %%Page: 104 55 104 54 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(104)0 91 y(according)29 b(to)i(its)d(t)m(yp)s(e.) 41 b(Since)28 b(a)i(term)g(of)f(t)m(yp)s(e)38 b Fs(nat)47 b Ft(or)38 b Fs(b)-5 b(o)g(ol)49 b Ft(has)29 b(a)h(normal)e(form)h (i\013)g(it)g(has)g(a)h(head)f(normal)0 204 y(form,)34 b(the)f(t)m(yp)s(e)h(constrain)m(ts)f(of)h(PCF)f(mak)m(e)h(the)f(t)m(w) m(o)i(p)s(ossible)c(de\014nitions)g(equiv)-5 b(alen)m(t.)49 b(Those)33 b(in)m(terested)0 317 y(in)38 b(un)m(t)m(yp)s(ed)g(lam)m(b)s (da)f(calculus)h(ma)m(y)h(wish)e(to)j(consult)e([Bar84)r(,)j(Section)e (8.4])h(for)f(a)g(discussion)d(of)j(partial)0 430 y(recursiv)m(e)30 b(functions)f(in)g(the)h(pure,)g(un)m(t)m(yp)s(ed)f(lam)m(b)s(da)h (calculus.)141 543 y(T)-8 b(o)34 b(sho)m(w)f(that)g(ev)m(ery)h(partial) e(recursiv)m(e)h(function)e(is)i(de\014nable)e(in)h(PCF,)h(w)m(e)h(giv) m(e)f(a)h(precise)e(de\014nition)0 656 y(of)j(the)h(class)f(of)g(all)f (partial)g(recursiv)m(e)h(functions.)54 b(A)35 b(partial)f(function)42 b Fn(f)53 b Ft(is)34 b Fs(numeric)40 b Ft(if)j Fn(f)10 b Ft(:)15 b Fr(N)3460 623 y Fm(k)3536 656 y Fn(*)33 b Fr(N)56 b Ft(for)0 769 y(some)39 b Fn(k)29 b(>)24 b Ft(0)8 b(.)42 b(If)c Fr(C)44 b Ft(is)29 b(a)i(class)f(of)h(partial)e(n)m (umeric)g(functions,)g(w)m(e)i(sa)m(y)39 b Fr(C)44 b Ft(is)136 955 y Fr(\017)i Fs(Close)-5 b(d)41 b(under)g(c)-5 b(omp)g(osition)47 b Ft(if,)40 b(for)e(all)f(partial)f(functions)45 b Fn(f)2453 969 y Fp(1)2492 955 y Fn(;)15 b(:)g(:)g(:)i(;)e(f)2739 970 y Fm(`)2772 955 y Ft(:)g Fr(N)2900 922 y Fm(k)2981 955 y Fn(*)38 b Fr(N)59 b Ft(and)46 b Fn(g)s Ft(:)15 b Fr(N)3611 922 y Fm(`)3683 955 y Fn(*)38 b Fr(N)227 1068 y Ft(from)g Fr(C)14 b Ft(,)31 b(the)f(class)39 b Fr(C)k Ft(also)31 b(con)m(tains)f(the)h(partial)e(function)37 b Fn(h)i Ft(de\014ned)29 b(b)m(y)569 1380 y Fn(h)p Ft(\()p Fn(n)711 1394 y Fp(1)751 1380 y Fn(;)15 b(:)g(:)g(:)i(;)e(n)1008 1395 y Fm(k)1050 1380 y Ft(\))26 b(=)1207 1183 y Fh(8)1207 1257 y(>)1207 1282 y(<)1207 1432 y(>)1207 1457 y(:)1322 1267 y Fn(g)s Ft(\()p Fn(m)1483 1281 y Fp(1)1523 1267 y Fn(;)15 b(:)g(:)g(:)i(;)e(m)1805 1282 y Fm(`)1838 1267 y Ft(\))84 b(if)29 b Fn(m)2120 1281 y Fm(i)2173 1267 y Ft(=)c Fn(f)2314 1281 y Fm(i)2342 1267 y Ft(\()p Fn(n)2432 1281 y Fp(1)2471 1267 y Fn(;)15 b(:)g(:)g(:)i(;)e(n)2728 1282 y Fm(k)2771 1267 y Ft(\))30 b(de\014ned)f(1)d Fr(\024)f Fn(i)h Fr(\024)f Fn(`)1957 1380 y Ft(and)k Fn(g)s Ft(\()p Fn(m)2294 1394 y Fp(1)2335 1380 y Fn(;)15 b(:)g(:)g(:)h(;)f(m)2616 1395 y Fm(`)2650 1380 y Ft(\))30 b(is)g(de\014ned,)1322 1493 y(unde\014ned)249 b(otherwise.)136 1745 y Fr(\017)46 b Fs(Close)-5 b(d)30 b(under)g(primitive)f(r)-5 b(e)g(cursion)34 b Ft(if,)26 b(for)g(ev)m(ery)35 b Fn(f)10 b Ft(:)15 b Fr(N)2214 1712 y Fm(k)2272 1739 y Fn(*)2378 1745 y Fr(N)47 b Ft(and)34 b Fn(g)s Ft(:)15 b Fr(N)2855 1712 y Fm(k)r Fp(+2)3004 1739 y Fn(*)3110 1745 y Fr(N)47 b Ft(from)34 b Fr(C)14 b Ft(,)27 b(the)f(class)227 1858 y Fr(C)44 b Ft(con)m(tains)31 b(the)f(partial)f(function)38 b Fn(h)h Ft(de\014ned)29 b(b)m(y)434 2120 y Fn(h)p Ft(\(0)p Fn(;)15 b(n)661 2134 y Fp(1)702 2120 y Fn(;)g(:)g(:)g(:)h(;)f(n)958 2135 y Fm(k)1001 2120 y Ft(\))274 b(=)1464 1976 y Fh(\()1572 2064 y Fn(f)10 b Ft(\()p Fn(n)1717 2078 y Fp(1)1756 2064 y Fn(;)15 b(:)g(:)g(:)i(;)e(n)2013 2079 y Fm(k)2055 2064 y Ft(\))84 b(if)29 b Fn(f)10 b Ft(\()p Fn(n)2402 2078 y Fp(1)2441 2064 y Fn(;)15 b(:)g(:)g(:)h(;)f(n)2697 2079 y Fm(k)2740 2064 y Ft(\))30 b(de\014ned)1572 2177 y(unde\014ned)216 b(otherwise.)434 2557 y Fn(h)p Ft(\()p Fn(m)21 b Ft(+)f(1)p Fn(;)15 b(n)853 2571 y Fp(1)893 2557 y Fn(;)g(:)g(:)g(:)h(;)f(n)1149 2572 y Fm(k)1192 2557 y Ft(\))83 b(=)1464 2335 y Fh(8)1464 2410 y(>)1464 2435 y(>)1464 2460 y(<)1464 2609 y(>)1464 2634 y(>)1464 2659 y(:)1579 2415 y Fn(g)s Ft(\()p Fn(p;)15 b(m;)g(n)1921 2429 y Fp(1)1962 2415 y Fn(;)g(:)g(:)g(:)h(;)f(n)2218 2430 y Fm(k)2261 2415 y Ft(\))p Fn(;)83 b Ft(if)30 b Fn(p)25 b Ft(=)g Fn(h)p Ft(\()p Fn(m;)15 b(n)2917 2429 y Fp(1)2957 2415 y Fn(;)g(:)g(:)g(:)h(;)f(n)3213 2430 y Fm(k)3256 2415 y Ft(\))31 b(and)2404 2528 y Fn(g)s Ft(\()p Fn(p;)15 b(m;)g(n)2746 2542 y Fp(1)2787 2528 y Fn(;)g(:)g(:)g(:)h(;)f(n)3043 2543 y Fm(k)3086 2528 y Ft(\))31 b(are)f(de\014ned,)1579 2699 y(unde\014ned)439 b(otherwise.)136 2947 y Fr(\017)46 b Fs(Close)-5 b(d)37 b(under)g(minimization)42 b Ft(if,)34 b(for)f(ev)m(ery)i(partial)41 b Fn(f)10 b Ft(:)15 b Fr(N)2331 2914 y Fm(k)r Fp(+1)2494 2947 y Fn(*)31 b Fr(N)55 b Ft(from)42 b Fr(C)14 b Ft(,)34 b(the)g(class)42 b Fr(C)47 b Ft(con)m(tains)227 3060 y(the)31 b(partial)e(function)37 b Fn(g)43 b Ft(de\014ned)29 b(b)m(y)906 3407 y Fn(g)s Ft(\()p Fn(n)1042 3421 y Fp(1)1082 3407 y Fn(;)15 b(:)g(:)g(:)i(;)e(n)1339 3422 y Fm(k)1381 3407 y Ft(\))26 b(=)1538 3185 y Fh(8)1538 3259 y(>)1538 3284 y(>)1538 3309 y(<)1538 3459 y(>)1538 3484 y(>)1538 3508 y(:)1653 3254 y Ft(the)31 b(least)f Fn(m)g Ft(with)f Fn(f)10 b Ft(\()p Fn(m;)15 b(n)2604 3268 y Fp(1)2643 3254 y Fn(;)g(:)g(:)g(:)i(;)e(n)2900 3269 y Fm(k)2943 3254 y Ft(\))25 b(=)g(0)p Fn(;)1653 3367 y Ft(when)k(suc)m(h)h(an)h Fn(m)f Ft(exists,)1653 3559 y(unde\014ned)e(otherwise.)0 3790 y(The)c(class)33 b Fr(P)7 b(R)33 b Ft(of)25 b Fs(p)-5 b(artial)29 b(r)-5 b(e)g(cursive)28 b(functions)k Ft(is)24 b(the)h(least)g(class)f(of)h(partial)e(n)m(umeric)g(functions)g(con)m (taining)0 3903 y(the)i(pro)5 b(jection)25 b(functions)32 b Fk(Pro)6 b(j)1177 3866 y Fm(k)1177 3925 y(i)1220 3903 y Ft(\()p Fn(n)1310 3917 y Fp(1)1349 3903 y Fn(;)15 b(:)g(:)g(:)i(;)e (n)1606 3918 y Fm(k)1649 3903 y Ft(\))25 b(=)g Fn(n)1860 3917 y Fm(i)1896 3903 y Ft(,)i(the)e(successor)g(function)32 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)10 b Ft(+)g(1)e(,)26 b(the)g(constan)m(t)0 4016 y(zero)31 b(function)38 b Fn(\025x)p Ft(:)15 b Fs(nat)9 b Fn(:)15 b Ft(0)8 b(,)32 b(and)e(closed)g(under)f(comp)s(osition,)g(primitiv)m(e)f(recursion,)h (and)h(minimization.)0 4226 y Fk(Theorem)k(2.5.14)47 b Fs(Every)32 b(p)-5 b(artial)35 b(r)-5 b(e)g(cursive)33 b(function)g(is)f(de\014nable)h(in)g(PCF)0 4437 y Fk(Pro)s(of)51 b Ft(The)24 b(pro)s(of)e(is)h(similar)e(to)j(the)g(pro)s(of)f(of)h (Theorem)f(2.5.12,)k(except)e(that)f(the)g(term)f(represen)m(ting)g(a)h (par-)0 4550 y(tial)e(recursiv)m(e)g(function)f(m)m(ust)i(not)g(ha)m(v) m(e)g(a)g(normal)f(form)g(when)g(the)g(partial)g(recursiv)m(e)g (function)f(is)h(unde\014ned.)0 4663 y(W)-8 b(e)37 b(can)f(see)g(that)g (this)e(requires)g(some)i(c)m(hanges)h(b)m(y)e(considering)f(the)h (comp)s(osition)g(case.)57 b(If)43 b Fn(f)5 b(;)15 b(g)s Ft(:)g Fr(N)3706 4657 y Fn(*)3812 4663 y Fr(N)0 4775 y Ft(are)34 b(unary)f(partial)g(recursiv)m(e)h(functions,)f(represen)m (ted)h(b)m(y)g(PCF)g(terms)42 b Fn(M)53 b Ft(and)41 b Fn(N)19 b Ft(,)35 b(then)f(in)e(the)i(pro)s(of)g(of)0 4888 y(Theorem)27 b(2.5.12,)j(w)m(e)d(represen)m(t)g(the)g(comp)s (osition)33 b Fn(h)p Ft(\()p Fn(n)p Ft(\))26 b(=)f Fn(g)s Ft(\()p Fn(f)10 b Ft(\()p Fn(n)p Ft(\)\))36 b(b)m(y)27 b(the)g(term)35 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(N)25 b Ft(\()p Fn(M)10 b(x)p Ft(\))e(.)41 b(Ho)m(w-)0 5001 y(ev)m(er,)30 b(this)d(do)s(es)h(not)g(ha)m(v)m(e)i(the)e(correct) i(termination)d(b)s(eha)m(vior)g(when)36 b Fn(f)46 b Ft(ma)m(y)29 b(b)s(e)e(partial.)39 b(F)-8 b(or)29 b(example,)g(let)0 5114 y Fn(g)44 b Ft(b)s(e)31 b(the)h(constan)m(t)h(function)39 b Fn(g)s Ft(\()p Fn(x)p Ft(\))29 b(=)e(3)40 b(and)g Fn(f)49 b Ft(a)32 b(partial)f(function)f(with)39 b Fn(f)10 b Ft(\(5\))41 b(unde\014ned.)h(The)32 b(ordinary)0 5227 y(mathematical)25 b(con)m(v)m(en)m(tion)g(is)e(to)i(consider)32 b Fn(h)p Ft(\(5\))27 b(=)e Fn(g)s Ft(\()p Fn(f)10 b Ft(\(5\)\))34 b(unde\014ned)22 b(since)32 b Fn(f)10 b Ft(\(5\))33 b(is)23 b(unde\014ned.)37 b(Ho)m(w)m(ev)m(er,)0 5340 y(the)31 b(application)37 b(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(N)25 b Ft(\()p Fn(M)10 b(x)p Ft(\)\))27 b(5)39 b(reduces)30 b(to)39 b(3)g(in)29 b(PCF.)p eop %%Page: 105 56 105 55 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(105)141 91 y(A)33 b(simple)f(tric)m(k)h(is)f(to)i (de\014ne)e(a)i(function)40 b Fs(cnvg)49 b Ft(that)34 b(ma)m(y)g(b)s(e)e(used)h(to)h(force)f(non)m(termination)f(in)g(PCF)0 204 y(when)24 b(required.)37 b(Due)25 b(to)h(t)m(yping)f(restrictions,) g(w)m(e)g(will)e(de\014ne)h(a)h(separate)h(function)32 b Fs(cnvg)3203 226 y Fm(k)3279 204 y Ft(for)25 b(eac)m(h)h(natural)0 317 y(n)m(um)m(b)s(er)39 b Fn(k)30 b(>)d Ft(0)8 b(.)45 b(If)39 b Fn(f)49 b Ft(and)40 b Fn(g)j Ft(are)32 b(n)m(umeric)e (functions)g(of)40 b Fn(k)j Ft(argumen)m(ts,)33 b(then)39 b Fs(cnvg)3073 339 y Fm(k)3131 317 y Fn(f)24 b(g)44 b Ft(will)28 b(b)s(eha)m(v)m(e)33 b(lik)m(e)0 430 y Fn(g)12 b Ft(,)35 b(except)f(that)h(an)e(application)f(to)43 b Fn(k)i Ft(argumen)m(ts)34 b(will)d(only)i(ha)m(v)m(e)i(a)f(normal)e (form)i(\(or)g(\\halt"\))g(when)f(the)0 543 y(application)27 b(of)37 b Fn(f)47 b Ft(has)28 b(a)h(normal)f(form.)40 b(F)-8 b(or)29 b(an)m(y)38 b Fn(k)28 b(>)d Ft(0)8 b(,)30 b(the)f(function)36 b Fs(cnvg)2783 565 y Fm(k)2862 543 y Ft(ma)m(y)30 b(b)s(e)e(written)g(as)h(follo)m(ws:)807 757 y Fs(cnvg)992 779 y Fm(k)1050 757 y Fn(f)24 b(g)1221 701 y Fj(def)1239 757 y Ft(=)72 b Fn(\025x)p Ft(:)15 b Fs(nat)1664 719 y Fm(k)1707 757 y Fn(:)g Fl(if)47 b Fs(Eq)8 b Ft(?)15 b(\()p Fn(f)10 b(x)p Ft(\))15 b(0)48 b Fl(then)f Fn(g)s(x)h Fl(else)f Fn(g)s(x:)0 943 y Ft(F)-8 b(or)36 b(an)m(y)44 b Fn(x)8 b Ft(,)38 b(if)k Fn(f)10 b(x)43 b Ft(can)36 b(b)s(e)f(reduced)g(to)h(normal)e(form)h(then)h (\(whether)f(this)f(is)h(equal)g(to)h(zero)g(or)g(not\))g(the)0 1056 y(result)31 b(is)40 b Fn(g)s(x)8 b Ft(.)47 b(Ho)m(w)m(ev)m(er,)35 b(if)40 b Fn(f)10 b(x)40 b Ft(cannot)33 b(b)s(e)f(reduced)f(to)i(a)g (normal)e(form,)i(then)f(the)g(conditional)f(can)i(nev)m(er)0 1169 y(b)s(e)c(eliminated)f(and)37 b Fs(cnvg)936 1191 y Fm(k)994 1169 y Fn(f)24 b(g)42 b Ft(will)27 b(not)j(ha)m(v)m(e)h(a)f (normal)e(form.)40 b(The)30 b(main)e(reason)i(wh)m(y)f(this)g(w)m(orks) h(is)e(that)0 1282 y(w)m(e)j(cannot)g(reduce)38 b Fs(Eq)8 b Ft(?)15 b(\()p Fn(f)10 b(x)p Ft(\))15 b(0)39 b(to)g Fs(true)46 b Ft(or)39 b Fs(false)46 b Ft(without)29 b(reducing)37 b Fn(f)10 b(x)38 b Ft(to)31 b(normal)f(form.)141 1395 y(Using)i Fs(cnvg,)g Ft(w)m(e)g(can)h(de\014ne)e(a)i(comp)s(osition)39 b Fn(f)50 b Ft(and)40 b Fn(g)k Ft(that)33 b(is)e(de\014ned)g(only)h (when)39 b Fn(f)50 b Ft(is)31 b(de\014ned.)45 b(F)-8 b(or)0 1508 y(example,)37 b(if)42 b Fn(f)5 b(;)15 b(g)s Ft(:)g Fr(N)764 1502 y Fn(*)870 1508 y Fr(N)57 b Ft(are)35 b(unary)g(partial)f(recursiv)m(e)h(functions)f(represen)m(ted)h(b)m(y)g (PCF)g(terms)44 b Fn(M)54 b Ft(and)0 1621 y Fn(N)18 b Ft(,)31 b(w)m(e)g(represen)m(t)g(their)f(comp)s(osition)g(b)m(y)g(the)h (term)39 b Fs(cnvg)23 b Fn(M)i Ft(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)q Ft(\()p Fn(N)g Ft(\()p Fn(M)g(x)p Ft(\)\)\))e(.)44 b(The)30 b(generalization)g(to)0 1734 y(the)36 b(comp)s(osition)f(of)i(partial)e(functions)43 b Fn(f)1536 1748 y Fp(1)1575 1734 y Fn(;)15 b(:)g(:)g(:)h(;)f(f)1821 1749 y Fm(`)1854 1734 y Ft(:)g Fr(N)1982 1701 y Fm(k)2060 1734 y Fn(*)35 b Fr(N)57 b Ft(and)44 b Fn(g)s Ft(:)15 b Fr(N)2683 1701 y Fm(`)2752 1734 y Fn(*)35 b Fr(N)57 b Ft(is)36 b(straigh)m(tforw)m(ard)g(and)0 1847 y(left)30 b(to)h(the)g(reader.)141 1960 y(The)38 b(remaining)f(cases)j(of)f(the)g (pro)s(of)f(are)h(treated)h(similarly)-8 b(,)38 b(using)45 b Fs(cnvg)2850 1981 y Fm(k)2940 1960 y Ft(for)38 b(appropriate)46 b Fn(k)11 b Ft(.)66 b(The)0 2072 y(reader)45 b(is)e(encouraged)j(to)f (write)f(out)h(the)g(argumen)m(t)g(for)g(primitiv)m(e)d(recursion,)47 b(and)d(con)m(vince)h(him-)f(or)0 2185 y(herself)29 b(that)i(no)f(mo)s (di\014cation)f(is)g(needed)i(for)f(minimization.)p 3861 2185 40 40 v 141 2298 a(This)43 b(theorem)i(has)g(some)g(imp)s(ortan)m (t)f(corollaries.)82 b(Both)46 b(of)f(the)g(corollaries)e(b)s(elo)m(w)h (follo)m(w)g(from)h(a)0 2411 y(w)m(ell-kno)m(wn)39 b(undecidabilit)m(y) d(prop)s(ert)m(y)j(of)h(recursiv)m(e)f(functions.)67 b(Sp)s(eci\014cally)-8 b(,)40 b(there)g(is)f(no)g(recursiv)m(e,)j(or)0 2524 y(algorithmic,)26 b(metho)s(d)g(for)h(deciding)e(whether)h(a)h (recursiv)m(e)f(partial)f(function)h(is)f(de\014ned)h(on)g(some)h (argumen)m(t.)0 2637 y(This)i(fact)i(is)e(often)i(referred)f(to)h(as)g (the)f(recursiv)m(e)g(unsolv)-5 b(abilit)m(y)27 b(of)k(the)f Fs(Halting)j(Pr)-5 b(oblem.)42 b Ft(Exercise)30 b(2.5.18)0 2750 y(describ)s(es)f(a)h(direct)g(pro)s(of)g(that)h(the)f(PCF)h (halting)e(problem)f(is)i(not)g(solv)-5 b(able)30 b(in)f(PCF.)0 2945 y Fk(Corollary)35 b(2.5.15)47 b Fs(Ther)-5 b(e)25 b(is)f(no)h(algorithm)i(for)e(de)-5 b(ciding)25 b(whether)h(a)f(given)f (PCF)g(expr)-5 b(ession)27 b(has)e(a)g(normal)0 3058 y(form.)0 3253 y Fk(Pro)s(of)64 b Ft(If)29 b(there)h(w)m(ere)g(suc)m(h) f(an)h(algorithm,)f(then)g(b)m(y)g(Theorem)g(2.5.14,)k(w)m(e)d(could)e (decide)h(whether)g(a)h(giv)m(en)0 3366 y(partial)c(recursiv)m(e)g (function)g(w)m(as)i(de\014ned)e(on)h(some)g(argumen)m(t,)h(simply)d(b) m(y)i(writing)e(the)i(function)f(applied)f(to)0 3479 y(its)30 b(argumen)m(t)h(in)e(PCF.)p 3861 3479 V 0 3674 a Fk(Corollary)35 b(2.5.16)47 b Fs(Ther)-5 b(e)33 b(is)g(no)g (algorithm)h(for)g(de)-5 b(ciding)33 b(e)-5 b(quality)33 b(b)-5 b(etwe)g(en)33 b(PCF)g(expr)-5 b(essions.)0 3868 y Fk(Pro)s(of)64 b Ft(If)29 b(there)h(w)m(ere)g(suc)m(h)f(an)h (algorithm,)f(then)g(b)m(y)g(Theorem)g(2.5.14,)k(w)m(e)d(could)e (decide)h(whether)g(a)h(giv)m(en)0 3981 y(partial)20 b(recursiv)m(e)g(function)f(w)m(as)i(de\014ned)f(on)g(some)i(argumen)m (t.)38 b(Sp)s(eci\014cally)-8 b(,)20 b(giv)m(en)h(a)g(description)e(of) i(a)g(partial)0 4094 y(function)30 b Fn(f)18 b Ft(,)25 b(w)m(e)e(ma)m(y)h(pro)s(duce)e(PCF)h(term)32 b Fn(M)42 b Ft(represen)m(ting)22 b(the)i(application)29 b Fn(f)10 b Ft(\()p Fn(n)p Ft(\))32 b(b)m(y)23 b(the)g(straigh)m(tforw)m(ard)0 4207 y(algorithm)28 b(outlined)e(in)i(the)g(pro)s(of)g(of)h(Theorem)f (2.5.14,)k(for)c(an)m(y)37 b Fn(n)8 b Ft(.)40 b(Then,)28 b(using)g(the)g(supp)s(osed)f(algorithm)0 4320 y(to)g(determine)f (whether)33 b Fl(if)48 b Fs(Eq)8 b Ft(?)14 b Fn(M)26 b(M)57 b Fl(then)47 b Ft(0)h Fl(else)f Ft(0)26 b(=)e(0)8 b(,)29 b(w)m(e)d(could)g(decide)f(whether)34 b Fn(f)10 b Ft(\()p Fn(n)p Ft(\))35 b(is)25 b(de\014ned.)p 0 4433 V 0 4628 a Fk(Exercise)35 b(2.5.17)47 b Ft(A)23 b Fs(primitive)j(r)-5 b(e)g(cursive)27 b(function)j Ft(is)22 b(a)h(total)h(recursiv)m(e)e (function)g(that)h(is)f(de\014ned)g(without)0 4741 y(using)30 b(minimization.)42 b(The)32 b(Kleene)f(normal)g(form)g(theorem)h (states)h(that)g(ev)m(ery)f(partial)f(recursiv)m(e)g(function)0 4854 y Fn(f)10 b Ft(:)15 b Fr(N)183 4821 y Fm(k)251 4854 y Fn(*)25 b Fr(N)51 b Ft(ma)m(y)31 b(b)s(e)f(written)f(in)h(the)g(form) 797 5040 y Fn(f)10 b Ft(\()p Fn(n)942 5054 y Fp(1)980 5040 y Fn(;)15 b(:)g(:)g(:)i(;)e(n)1237 5055 y Fm(k)1280 5040 y Ft(\))25 b(=)g Fn(p)p Ft(\(the)31 b(least)39 b Fn(n)f Ft(with)29 b Fn(t)2228 5055 y Fm(k)2271 5040 y Ft(\()p Fn(i;)15 b(n)2432 5054 y Fp(1)2472 5040 y Fn(;)g(:)g(:)g(:)h(;) f(n)2728 5055 y Fm(k)2771 5040 y Fn(;)g(n)p Ft(\))25 b(=)g(1\))0 5227 y(where)39 b Fn(p)g Ft(and)f Fn(t)575 5242 y Fm(k)657 5227 y Ft(are)31 b(primitiv)m(e)e(recursiv)m(e)h (functions)g(that)h(are)h(indep)s(enden)m(t)d(of)39 b Fn(f)18 b Ft(,)31 b(and)38 b Fn(i)i Ft(dep)s(ends)29 b(on)39 b Fn(f)18 b Ft(.)0 5340 y(This)k(is)h(called)g(the)h Fs(Kle)-5 b(ene)27 b(normal)h(form)g(of)52 b Fn(f)17 b Ft(,)26 b(after)e(Stephen)f(C.)h(Kleene,)h(and)e(the)h(n)m(um)m(b)s (er)31 b Fn(i)i Ft(is)23 b(called)g(the)p eop %%Page: 106 57 106 56 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(106)0 91 y Fs(index)41 b Ft(of)29 b(partial)g(recursiv)m(e)g(function)36 b Fn(f)18 b Ft(.)40 b(The)29 b(Kleene)g(normal)g(form)g(theorem)g(ma)m(y)i(b)s(e)d(found)h (in)f(standard)0 204 y(b)s(o)s(oks)i(on)g(computabilit)m(y)f(or)h (recursion)f(theory)-8 b(,)31 b(suc)m(h)f(as)h([Rog67)r(].)66 392 y(\(a\))46 b(Use)26 b(the)f(Kleene)g(normal)f(form)h(theorem)g(and) g(Theorem)g(2.5.12)i(to)f(sho)m(w)f(that)h(ev)m(ery)g(partial)e (recursiv)m(e)227 505 y(function)29 b(is)h(de\014nable)f(in)g(PCF.)61 692 y(\(b\))45 b(Using)31 b(the)i(results)e(of)h(Exercise)f(2.5.13,)k (sho)m(w)d(that)h(ev)m(ery)g(partial)e(function)f(computed)i(b)m(y)g(a) h(T)-8 b(uring)227 805 y(mac)m(hine)30 b(is)g(de\014nable)f(in)g(PCF.)0 1018 y Fk(Exercise)35 b(2.5.18)47 b Ft(It)22 b(is)e(easy)i(to)h(sho)m (w)e(the)h(halting)e(problem)g(for)h(PCF)g(is)g(not)h(solv)-5 b(able)20 b(in)g(PCF.)i(Sp)s(eci\014cally)-8 b(,)0 1131 y(the)23 b Fs(halting)j(function)g(on)g(typ)-5 b(e)34 b Fn(\033)12 b Fs(,)32 b Fn(H)1306 1145 y Fm(\033)1361 1131 y Ft(,)24 b(is)e(a)h(function)e(whic)m(h,)i(when)f(applied)e(to)j (an)m(y)g(PCF)g(term)30 b Fn(M)3511 1145 y Fm(\033)3567 1131 y Ft(,)24 b(returns)0 1244 y Fs(true)34 b Ft(if)g Fn(M)46 b Ft(has)26 b(a)i(normal)e(form)g(\(\\halts"\),)j(and)e Fs(false)34 b Ft(otherwise.)39 b(In)27 b(this)f(exercise,)i(y)m(ou)f (are)h(ask)m(ed)f(to)h(sho)m(w)0 1357 y(that)i(there)h(is)e(no)g(PCF)h (term)38 b Fn(H)1163 1372 y Fj(b)l(o)l(ol)1328 1357 y Ft(de\014ning)28 b(the)i(halting)f(function)f(on)i(t)m(yp)s(e)39 b Fs(b)-5 b(o)g(ol)19 b Ft(,)30 b(using)f(a)h(v)-5 b(arian)m(t)30 b(of)g(the)0 1469 y(diagonalization)22 b(argumen)m(t)h(from)f(recursiv) m(e)g(function)f(theory)-8 b(.)39 b(Since)21 b(the)i(pro)s(of)f(pro)s (ceeds)g(b)m(y)h(con)m(tradiction,)0 1582 y(assume)30 b(there)h(is)e(a)i(PCF)f(term)39 b Fn(H)1233 1597 y Fj(b)l(o)l(ol)1360 1582 y Ft(:)15 b Fs(b)-5 b(o)g(ol)1573 1576 y Fr(!)1679 1582 y Fs(b)g(o)g(ol)50 b Ft(de\014ning)28 b(the)j(halting)e(function.) 66 1770 y(\(a\))46 b(Sho)m(w)31 b(that)h(using)38 b Fn(H)989 1785 y Fj(b)l(o)l(ol)1124 1770 y Ft(,)31 b(w)m(e)h(ma)m(y)g(write)e(a)i (PCF)f(term)39 b Fn(G)p Ft(:)15 b Fs(b)-5 b(o)g(ol)2552 1764 y Fr(!)2658 1770 y Fs(b)g(o)g(ol)51 b Ft(with)30 b(the)h(prop)s(ert)m(y)f(that)i(for)227 1883 y(an)m(y)f(PCF)f(term)39 b Fn(M)10 b Ft(:)15 b Fs(b)-5 b(o)g(ol)20 b Ft(,)30 b(the)h (application)37 b Fn(GM)48 b Ft(has)30 b(a)h(normal)e(form)h(i\013)38 b Fn(M)49 b Ft(do)s(es)30 b(not.)61 2071 y(\(b\))45 b(Deriv)m(e)31 b(a)g(con)m(tradiction)f(b)m(y)g(considering)f(whether)h(or)g(not)39 b Fs(\014x)26 b Fn(G)38 b Ft(has)31 b(a)f(normal)g(form.)p eop %%Page: 107 58 107 57 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(107)0 91 y Fo(2.5.6)112 b(Non-de\014nabilit)m(y)37 b(of)g(parallel)f(op)s(erations)0 263 y Ft(W)-8 b(e)30 b(ha)m(v)m(e)f(seen)g(in)e(Sections)h(2.5.4)i(and)e(2.5.5)i(that)f(the) g(PCF-de\014nable)e(functions)g(on)h(n)m(umerals)f(corresp)s(ond)0 376 y(exactly)c(to)g(the)g(recursiv)m(e)f(functions)f(and)h(\(in)f(the) i(exercises\))g(the)f(n)m(umeric)f(functions)g(computable)h(b)m(y)h(T) -8 b(uring)0 489 y(mac)m(hines.)66 b(By)39 b(Ch)m(urc)m(h's)f(thesis,)j (as)e(discussed)e(in)g(Section)i(2.5.4,)k(this)38 b(suggests)i(that)f (all)f(mec)m(hanically)0 602 y(computable)e(functions)f(on)h(the)h (natural)f(n)m(um)m(b)s(ers)f(are)i(de\014nable)e(in)g(PCF.)h(Ho)m(w)m (ev)m(er,)41 b(as)36 b(w)m(e)h(shall)e(see)i(in)0 715 y(this)20 b(section,)k(there)d Fs(ar)-5 b(e)29 b Ft(op)s(erations)20 b(that)i(are)g(computable)e(in)g(a)i(reasonable)f(w)m(a)m(y)-8 b(,)24 b(but)d Fs(not)30 b Ft(de\014nable)20 b(in)g(PCF.)0 827 y(The)k(main)g(theorem)h(and)g(the)g(basic)f(idea)g(of)h(Lemma)g (2.5.24)i(are)f(due)e(to)h(Plotkin)f([Plo77].)39 b(A)25 b(seman)m(tic)h(pro)s(of)0 940 y(of)h(Theorem)f(2.5.19)j(app)s(ears)c (as)i(Example)f(8.6.3,)j(using)c(logical)h(relations)g(and)g(the)g (denotational)h(seman)m(tics)0 1053 y(of)k(PCF.)141 1166 y(The)f(main)g(example)h(w)m(e)g(consider)f(in)f(this)h(section)h(is)f (called)g Fs(p)-5 b(ar)g(al)5 b(lel-or.)45 b Ft(Before)32 b(discussing)c(this)i(func-)0 1279 y(tion,)37 b(it)e(is)f(w)m(orth)i (remem)m(b)s(ering)e(that)i(for)g(a)g(PCF)f(term)h(to)g(represen)m(t)g (a)44 b Fn(k)11 b Ft(-ary)36 b(function)f(on)g(the)h(natural)0 1392 y(n)m(um)m(b)s(ers,)e(w)m(e)h(only)e(consider)g(the)i(result)e(of) h(applying)e(the)j(PCF)f(term)g(to)h(a)f(tuple)g(of)g(n)m(umerals.)51 b(It)34 b(is)g(not)0 1505 y(imp)s(ortan)m(t)h(ho)m(w)g(the)h(PCF)f (term)g(b)s(eha)m(v)m(es)h(when)f(applied)e(to)j(expressions)e(that)i (are)g(not)g(in)e(normal)g(form.)0 1618 y(The)28 b(di\013erence)f(b)s (et)m(w)m(een)i(the)f(p)s(ositiv)m(e)g(results)f(on)h(represen)m(ting)f (n)m(umeric)g(functions)g(in)g(Sections)h(2.5.4)i(and)0 1731 y(2.5.5)37 b(and)d(the)h(negativ)m(e)h(result)d(in)h(this)g (section)h(is)e(that)j(w)m(e)f(no)m(w)g(tak)m(e)h(in)m(to)f(accoun)m(t) h(the)f(w)m(a)m(y)h(a)f(function)0 1844 y(ev)-5 b(aluates)31 b(its)f(argumen)m(ts.)141 1957 y(It)37 b(is)f(easiest)i(to)g(describ)s (e)d(the)j(parallel-or)d(function)h(algorithmically)-8 b(.)59 b(Supp)s(ose)35 b(w)m(e)j(are)f(giv)m(en)g(closed)0 2070 y(terms)51 b Fn(M)5 b(;)15 b(N)10 b Ft(:)15 b Fs(b)-5 b(o)g(ol)63 b Ft(and)42 b(wish)f(to)j(compute)f(the)g(logical)f (disjunction,)52 b Fn(M)38 b Fr(_)28 b Fn(N)18 b Ft(.)78 b(W)-8 b(e)44 b(kno)m(w)f(that)g(either)0 2182 y Fn(M)f Fr(!)-61 b(!)33 b Fs(true)15 b Ft(,)44 b Fn(M)f Fr(!)-61 b(!)32 b Fs(false)16 b Ft(,)36 b(or)43 b Fn(M)52 b Ft(has)35 b(no)f(normal)g(form,)h(and)f(similarly)d(for)43 b Fn(N)18 b Ft(.)54 b(One)34 b(w)m(a)m(y)h(to)h(compute)0 2295 y Fn(M)e Fr(_)24 b Fn(N)54 b Ft(is)35 b(to)i(\014rst)e(reduce)h(b)s (oth)44 b Fn(M)54 b Ft(and)44 b Fn(N)55 b Ft(to)36 b(normal)g(form,)h (then)f(return)f Fs(true)43 b Ft(if)35 b(either)g(is)h Fs(true)43 b Ft(and)0 2408 y Fs(false)33 b Ft(otherwise.)39 b(This)24 b(algorithm)h(computes)h(what)f(is)g(called)g(the)h Fs(se)-5 b(quential-or)37 b Ft(of)d Fn(M)44 b Ft(and)34 b Fn(N)18 b Ft(;)27 b(it)f(will)d(only)0 2521 y(terminate)32 b(if)f(b)s(oth)39 b Fn(M)50 b Ft(and)40 b Fn(N)50 b Ft(ha)m(v)m(e)33 b(a)g(normal)d(form.)45 b(F)-8 b(or)33 b Fs(p)-5 b(ar)g(al)5 b(lel-or,)35 b Ft(w)m(e)d(wish)e(to)j(return)e Fs(true)39 b Ft(if)30 b(either)0 2634 y Fn(M)47 b Ft(or)37 b Fn(N)47 b Ft(reduces)29 b(to)g Fs(true,)h Ft(regardless)e(of)h(whether)f(the)h (other)g(term)g(has)g(a)g(normal)f(form.)39 b(It)29 b(is)f(easy)i(to)f (see)0 2747 y(ho)m(w)d(to)i(compute)e(parallel-or)f(in)g(a)i (computational)f(setting)h(with)e(explicit)f(parallelism.)37 b(W)-8 b(e)27 b(b)s(egin)e(reducing)0 2860 y Fn(M)52 b Ft(and)42 b Fn(N)52 b Ft(in)32 b(parallel.)49 b(If)34 b(either)f(terminates)h(with)e(v)-5 b(alue)42 b Fs(true)15 b Ft(,)35 b(w)m(e)f(ab)s(ort)g(the)g(other)g(computation)g(and)0 2973 y(return)d Fs(true.)45 b Ft(Otherwise)31 b(w)m(e)h(con)m(tin)m(ue) g(to)h(reduce)f(b)s(oth,)g(hoping)e(to)j(pro)s(duce)e(t)m(w)m(o)i (normal)e(forms.)45 b(If)32 b(b)s(oth)0 3086 y(reduce)d(to)39 b Fs(false)15 b Ft(,)30 b(then)f(w)m(e)h(return)37 b Fs(false)16 b Ft(.)40 b(T)-8 b(o)30 b(summarize,)f(the)g(parallel-or)f (of)38 b Fn(M)48 b Ft(and)37 b Fn(N)48 b Ft(is)36 b Fs(true)45 b Ft(if)28 b(either)0 3199 y Fn(M)49 b Ft(or)38 b Fn(N)49 b Ft(reduces)30 b(to)39 b Fs(true)16 b Ft(,)38 b Fs(false)46 b Ft(if)30 b(b)s(oth)f(reduce)i(to)39 b Fs(false)16 b Ft(,)30 b(and)g(non)m(terminating)f(otherwise.)141 3312 y(The)j(rest)h(of)g(this)e(section)i(will)d(b)s(e)i(dev)m(oted)i(to)f (pro)m(ving)f(that)h(parallel-or)e(is)h(not)h(de\014nable)e(in)g(PCF,)i (as)0 3424 y(stated)e(in)e(the)i(follo)m(wing)e(theorem.)0 3627 y Fk(Theorem)34 b(2.5.19)47 b Fs(Ther)-5 b(e)33 b(is)f(no)i(PCF)e(expr)-5 b(ession)34 b(POR)i(with)e(the)f(fol)5 b(lowing)33 b(b)-5 b(ehavior)624 3931 y(POR)18 b Fn(M)25 b(N)36 b Fr(!)-61 b(!)1208 3733 y Fh(8)1208 3808 y(>)1208 3833 y(<)1208 3983 y(>)1208 4007 y(:)1323 3818 y Fs(true)554 b(if)32 b Fn(M)k Fr(!)-61 b(!)25 b Fs(true)40 b(or)33 b Fn(N)i Fr(!)-61 b(!)26 b Fs(true)1323 3930 y(false)537 b(if)32 b Fn(M)k Fr(!)-61 b(!)25 b Fs(false)40 b(and)34 b Fn(N)h Fr(!)-61 b(!)25 b Fs(false)1323 4043 y(no)34 b(normal)g(form)84 b(otherwise)0 4235 y(for)33 b(al)5 b(l)33 b(close)-5 b(d)34 b(b)-5 b(o)g(ole)g(an)35 b(expr)-5 b(essions)43 b Fn(M)51 b Fs(and)42 b Fn(N)18 b Fs(.)141 4437 y Ft(W)-8 b(e)30 b(will)25 b(pro)m(v)m(e)30 b(Theorem)e(2.5.19)i (b)m(y)f(analyzing)e(the)i(op)s(erational)e(seman)m(tics)i(of)g(PCF.)f (This)f(giv)m(es)h(us)g(an)0 4550 y(opp)s(ortunit)m(y)23 b(to)j(dev)m(elop)e(some)h(general)g(to)s(ols)g(for)f(op)s(erational)g (reasoning.)38 b(The)25 b(\014rst)f(imp)s(ortan)m(t)g(decision)f(is)0 4663 y(to)32 b(c)m(ho)s(ose)h(a)f(deterministic)e(reduction)g(strategy) k(instead)d(of)g(reasoning)h(ab)s(out)f(arbitrary)g(reduction)f(order.) 0 4775 y(Since)21 b(w)m(e)i(will)d(only)h(b)s(e)h(in)m(terested)g(in)f (reduction)g(on)h(terms)g(of)h(t)m(yp)s(e)30 b Fs(nat)40 b Ft(or)31 b Fs(b)-5 b(o)g(ol)19 b Ft(,)24 b(w)m(e)f(can)g(use)e(lazy)i (reduction,)0 4888 y(de\014ned)g(in)h(Section)g(2.4.3,)k(instead)c(of)h (the)g(more)f(complicated)h(left-most)g(reduction)e(strategy)-8 b(.)41 b(A)25 b(con)m(v)m(enien)m(t)0 5001 y(w)m(a)m(y)32 b(to)f(analyze)g(the)g(reduction)e(of)i(subterms)f(is)f(to)j(w)m(ork)e (with)g(con)m(texts.)43 b(T)-8 b(o)31 b(iden)m(tify)e(a)i(critical)f (subterm,)0 5114 y(w)m(e)k(de\014ne)e(a)i(sp)s(ecial)e(form)h(of)g(con) m(text)j(called)c(an)i Fs(evaluation)i(c)-5 b(ontext.)50 b Ft(While)32 b(the)i(analysis)e(of)h(parallel-or)0 5227 y(only)i(requires)f(ev)-5 b(aluation)36 b(con)m(texts)h(for)f(b)s(o)s (olean)f(terms,)i(w)m(e)f(giv)m(e)h(the)f(general)g(de\014nition)d(for) j(use)f(in)g(the)0 5340 y(exercises)30 b(and)g(in)f(Section)h(5.4.2.)43 b(The)30 b(ev)-5 b(aluation)30 b(con)m(texts)i(of)e(PCF)h(are)f (de\014ned)f(in)h(T)-8 b(able)30 b(2.6.)p eop %%Page: 108 59 108 58 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(108)801 179 y Fb(ev)q Ft([)30 b(])84 b(::=)f([)30 b(])92 b Fr(j)f Fb(ev)p Ft([)31 b(])20 b(+)g Fn(M)101 b Fr(j)91 b Fn(n)20 b Ft(+)g Fb(ev)q Ft([)30 b(])h(for)f(n)m(umeral)f Fn(n)1277 350 y Fr(j)h Fs(Eq)8 b Ft(?)15 b Fb(ev)q Ft([)30 b(])15 b Fn(M)102 b Fr(j)91 b Fs(Eq)8 b Ft(?)14 b Fn(n)h Fb(ev)q Ft([)30 b(])h(for)f(n)m(umeral)f Fn(n)1277 522 y Fr(j)h Fl(if)48 b Fb(ev)p Ft([)31 b(])48 b Fl(then)e Fn(N)58 b Fl(else)47 b Fn(P)1277 694 y Fr(j)30 b Fk(Pro)6 b(j)1537 716 y Fm(i)1565 694 y Fb(ev)q Ft([)30 b(])91 b Fr(j)h Fb(ev)p Ft([)31 b(])15 b Fn(M)853 973 y Ft(T)-8 b(able)30 b(2.6:)42 b(Ev)-5 b(aluation)29 b(con)m(texts)j (for)e(lazy)h(PCF)f(reduction.)141 1225 y(An)22 b(example)f(app)s(ears) g(b)s(elo)m(w,)i(after)f(t)m(w)m(o)h(basic)f(lemmas.)37 b(T)-8 b(o)22 b(mak)m(e)h(the)f(outline)e(of)i(the)g(pro)s(of)f(of)h (Theorem)0 1338 y(2.5.19)33 b(as)d(clear)h(as)f(p)s(ossible,)e(w)m(e)j (p)s(ostp)s(one)f(the)g(pro)s(ofs)g(of)g(the)h(lemmas)f(to)h(the)f(end) g(of)h(the)f(section.)141 1474 y(There)35 b(are)g(t)m(w)m(o)h(main)e (prop)s(erties)g(of)h(ev)-5 b(aluation)34 b(con)m(texts.)57 b(The)34 b(\014rst)g(is)g(that)i(if)42 b Fn(M)3272 1418 y Fj(lazy)3289 1474 y Fr(!)49 b Fn(N)19 b Ft(,)36 b(then)43 b Fn(M)0 1586 y Ft(matc)m(hes)32 b(the)e(form)g(of)h(some)f(ev)-5 b(aluation)30 b(con)m(text)i(and)38 b Fn(N)49 b Ft(is)29 b(obtained)h(b)m(y)g(reducing)f(the)i(indicated)e(term.)0 1768 y Fk(Lemma)k(2.5.20)46 b Fs(If)52 b Fn(M)942 1712 y Fj(lazy)958 1768 y Fr(!)62 b Fn(N)19 b Fs(,)46 b(then)e(ther)-5 b(e)45 b(is)e(a)h(unique)f(evaluation)i(c)-5 b(ontext)53 b Fb(ev)q Ft([)44 b(])52 b Fs(such)44 b(that)53 b Fn(M)i Fr(\021)0 1881 y Fb(ev)p Ft([)p Fn(M)230 1848 y Fi(0)254 1881 y Ft(])8 b Fs(,)42 b(the)f(r)-5 b(e)g(duction)49 b Fn(M)1025 1848 y Fi(0)1087 1881 y Fr(!)39 b Fn(N)1300 1848 y Fi(0)1371 1881 y Fs(is)h(an)g(instanc)-5 b(e)41 b(of)f(one)h(of)f(the)g(PCF)g(r)-5 b(e)g(duction)42 b(axioms,)h(and)49 b Fn(N)f Fr(\021)0 1993 y Fb(ev)p Ft([)p Fn(N)215 1960 y Fi(0)239 1993 y Ft(])8 b Fs(.)0 2152 y Ft(Since)21 b(w)m(e)i(can)g(determine)e(the)i(unique)d(ev)-5 b(aluation)22 b(con)m(text)i(men)m(tioned)e(in)f(the)h(lemma)g(b)m(y)g(pattern)h (matc)m(hing,)0 2265 y(ev)-5 b(aluation)30 b(con)m(texts)i(pro)m(vide)d (a)i(complete)g(c)m(haracterization)h(of)e(lazy)h(reduction.)141 2378 y(The)25 b(second)h(basic)g(prop)s(ert)m(y)f(of)h(ev)-5 b(aluation)25 b(con)m(texts)j(is)d(that)h(the)g(lazy)g(reduction)f(of) 34 b Fb(ev)p Ft([)p Fn(M)10 b Ft(])35 b(is)25 b(the)h(lazy)0 2490 y(reduction)j(of)39 b Fn(M)19 b Ft(,)30 b(when)38 b Fn(M)48 b Ft(has)31 b(one.)41 b(This)28 b(is)i(stated)h(more)f (precisely)f(in)g(the)i(follo)m(wing)e(lemma.)0 2672 y Fk(Lemma)k(2.5.21)46 b Fs(If)41 b Fn(M)910 2616 y Fj(lazy)927 2672 y Fr(!)h Fn(M)1158 2639 y Fi(0)1222 2672 y Fs(then,)33 b(for)g(any)h(evaluation)f(c)-5 b(ontext)42 b Fb(ev)q Ft([)33 b(])8 b Fs(,)33 b(we)f(have)42 b Fb(ev)p Ft([)p Fn(M)10 b Ft(])3421 2616 y Fj(lazy)3438 2672 y Fr(!)41 b Fb(ev)q Ft([)p Fn(M)3801 2639 y Fi(0)3825 2672 y Ft(])8 b Fs(.)0 2830 y Ft(A)41 b(subtle)e(p)s(oin)m(t)h(is)f(that)j(when)48 b Fn(M)59 b Ft(is)39 b(a)i(lazy)g(normal)e(form,)k(the)e(lazy)g (reduction)e(of)49 b Fb(ev)q Ft([)p Fn(M)10 b Ft(])49 b(ma)m(y)42 b(b)s(e)e(a)0 2943 y(reduction)29 b(that)i(do)s(es)f(not)h (in)m(v)m(olv)m(e)39 b Fn(M)18 b Ft(.)0 3120 y Fk(Example)34 b(2.5.22)46 b Ft(The)28 b(left-most)g(reduction)f(of)h(the)g(term)37 b(\(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)16 b(\025y)s Ft(:)f Fs(nat)9 b Fn(:)16 b(x)f Ft(+)g Fn(y)s Ft(\))g(7\))g(5)i(+)f(\() p Fn(\025x)p Ft(:)f Fs(nat)10 b Fn(:)15 b(x)p Ft(\))g(3)0 3233 y(is)34 b(giv)m(en)h(in)e(Example)h(2.4.11.)56 b(As)35 b(observ)m(ed)f(in)g(Example)g(2.4.14)j(this)c(is)h(also)h(the)g(lazy)f (reduction)g(of)h(this)0 3346 y(term.)42 b(W)-8 b(e)32 b(illustrate)d(the)i(use)f(of)h(ev)-5 b(aluation)30 b(con)m(texts)i(b)m (y)f(writing)e(the)i(ev)-5 b(aluation)30 b(con)m(text)j(for)d(eac)m(h)i (term)0 3459 y(in)h(the)i(reduction)f(sequence.)54 b(Since)34 b(w)m(e)h(underline)c(the)k(activ)m(e)h(redex,)g(the)f(ev)-5 b(aluation)34 b(con)m(text)i(is)e(exactly)0 3572 y(the)d(part)f(of)g (the)h(term)f(that)h(is)f(not)g(underlined.)416 3733 y(\(\()p Fn(\025x)p Ft(:)15 b Fs(nat)c Fn(:)k(\025y)s Ft(:)g Fs(nat)10 b Fn(:)15 b(x)21 b Ft(+)e Fn(y)s Ft(\))c(7)p 486 3769 948 4 v 1 w(\))g(5)21 b(+)f(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)16 b(x)p Ft(\))f(3)84 b Fb(ev)p Ft([)31 b(])83 b Fr(\021)g Ft(\([)31 b(])15 b(5\))21 b(+)f(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)16 b(x)p Ft(\))f(3)416 3827 y Fj(left)422 3882 y Fr(!)122 b Ft(\()p Fn(\025y)s Ft(:)15 b Fs(nat)10 b Fn(:)16 b Ft(7)k(+)g Fn(y)s Ft(\))15 b(5)p 635 3918 654 4 v 21 w(+)20 b(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)16 b(x)p Ft(\))f(3)325 b Fb(ev)p Ft([)31 b(])83 b Fr(\021)g Ft([)30 b(])21 b(+)f(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)p Ft(\))g(3)416 3976 y Fj(left)422 4031 y Fr(!)122 b Ft(\(7)21 b(+)f(5)p 670 4052 203 4 v 1 w(\))g(+)g(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)16 b(x)p Ft(\))f(3)706 b Fb(ev)p Ft([)31 b(])83 b Fr(\021)g Ft([)30 b(])21 b(+)f(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)p Ft(\))g(3)416 4120 y Fj(left)422 4175 y Fr(!)122 b Ft(12)22 b(+)d(\()p Fn(\025x)p Ft(:)c Fs(nat)c Fn(:)k(x)p Ft(\))g(3)p 837 4211 506 4 v 888 w Fb(ev)p Ft([)31 b(])83 b Fr(\021)g Ft(12)21 b(+)f([)30 b(])416 4269 y Fj(left)422 4324 y Fr(!)122 b Ft(12)22 b(+)d(3)p 635 4345 248 4 v 1348 w Fb(ev)p Ft([)31 b(])83 b Fr(\021)g Ft([)30 b(])416 4413 y Fj(left)422 4468 y Fr(!)122 b Ft(15)0 4634 y(If)41 b(w)m(e)h(lo)s(ok)f(at)h(the)g(second)g (ev)-5 b(aluation)41 b(con)m(text,)54 b Fb(ev)q Ft([)41 b(])k Fr(\021)e Ft([)f(])28 b(+)f(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)p Ft(\))g(3)8 b(,)46 b(then)41 b(it)g(is)g(easy)h(to)g(see)0 4775 y(that)37 b(when)43 b Fn(M)587 4720 y Fj(lazy)604 4775 y Fr(!)51 b Fn(M)844 4742 y Fi(0)912 4775 y Ft(the)36 b(lazy)h(reduction)e(of)44 b Fb(ev)q Ft([)p Fn(M)10 b Ft(])45 b(will)33 b(b)s(e)44 b Fb(ev)p Ft([)p Fn(M)10 b Ft(])2704 4720 y Fj(lazy)2721 4775 y Fr(!)51 b Fb(ev)p Ft([)p Fn(M)3093 4742 y Fi(0)3117 4775 y Ft(])8 b(,)38 b(as)f(guaran)m(teed)g(b)m(y)0 4888 y(Lemma)k(2.5.21.)73 b(Ho)m(w)m(ev)m(er,)45 b(if)39 b(w)m(e)i(insert)e (a)i(lazy)f(normal)g(form)g(suc)m(h)g(as)49 b(2)g(in)m(to)40 b(the)h(con)m(text,)k(then)40 b(the)0 5001 y(resulting)25 b(term,)37 b Fb(ev)p Ft([2])26 b Fr(\021)f Ft(2)14 b(+)g(\()p Fn(\025x)p Ft(:)h Fs(nat)c Fn(:)k(x)p Ft(\))g(3)8 b(,)29 b(will)c(ha)m(v)m(e)j(its)f(lazy)g(reduction)f(completely)h(to)h(the)g (righ)m(t)e(of)i(the)0 5114 y(p)s(osition)j(mark)m(ed)j(b)m(y)f(the)g (placeholder)40 b([)34 b(])42 b(in)31 b(the)j(con)m(text.)51 b(Another)33 b(case)h(arises)f(with)f(the)h(\014rst)g(con)m(text,)0 5227 y Fb(ev)p Ft([)h(])c Fr(\021)f Ft(\([)k(])15 b(5\))24 b(+)d(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)16 b(x)p Ft(\))f(3)8 b(.)50 b(If)32 b(w)m(e)i(insert)d(the)j(lazy)f(normal)f (form)40 b Fn(M)g Fr(\021)30 b Fn(\025y)s Ft(:)15 b Fs(nat)9 b Fn(:)16 b Ft(7)22 b(+)g Fn(y)12 b Ft(,)33 b(w)m(e)g(obtain)g(a)0 5340 y(term)39 b Fb(ev)p Ft([)p Fn(M)10 b Ft(])39 b(whose)31 b(lazy)f(reduction)f(in)m(v)m(olv)m(es)i(a)f(larger)h(subterm)e(than)38 b Fn(M)19 b Ft(.)p 3861 5340 40 40 v eop %%Page: 109 60 109 59 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(109)141 91 y(W)-8 b(e)33 b(note)g(here)e(that)i (left-most)f(reduction)e(can)i(also)g(b)s(e)f(c)m(haracterized)i(using) e(ev)-5 b(aluation)31 b(con)m(texts.)46 b(T)-8 b(o)0 204 y(do)28 b(so,)i(w)m(e)f(add)f(six)f(more)i(forms)f(to)h(the)g (de\014nition)d(of)i(ev)-5 b(aluation)28 b(con)m(text,)j(corresp)s (onding)c(to)i(the)g(six)e(rules)0 317 y(that)i(app)s(ear)f(in)f(T)-8 b(able)29 b(2.3)g(but)f(not)h(in)e(T)-8 b(able)28 b(2.4.)42 b(Lemma)28 b(2.5.20)j(extends)e(easily)e(to)j(left-most)f(reduction,)0 430 y(but)g(Lemma)g(2.5.21)j(requires)27 b(the)j(additional)d(h)m(yp)s (othesis)h(that)38 b Fn(M)48 b Ft(do)s(es)29 b(not)h(ha)m(v)m(e)g(the)g (form)37 b Fn(\025x)p Ft(:)15 b Fn(\033)s(:)h(M)3742 444 y Fp(1)3819 430 y Ft(or)0 543 y Fr(h)p Fn(M)123 557 y Fp(1)163 543 y Fn(;)f(M)291 557 y Fp(2)331 543 y Fr(i)8 b Ft(.)141 656 y(W)-8 b(e)40 b(use)d(Lemma)i(2.5.21)h(in)d(the)i (analysis)d(of)j(parallel-or)d(b)m(y)j(sho)m(wing)e(that)i(if)e(the)h (normal)f(form)h(of)h(a)0 769 y(comp)s(ound)27 b(term)h(dep)s(ends)e (on)i(the)h(subterms)35 b Fn(M)1767 783 y Fp(1)1807 769 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)2096 784 y Fm(k)2148 769 y Ft(,)29 b(as)f(w)m(e)h(exp)s(ect)g(the)f(parallel-or)f(of)36 b Fn(M)3513 783 y Fp(1)3589 769 y Ft(and)g Fn(M)3860 783 y Fp(2)0 882 y Ft(to)22 b(dep)s(end)e(on)30 b Fn(M)623 896 y Fp(1)692 882 y Ft(and)g Fn(M)957 896 y Fp(2)1005 882 y Ft(,)23 b(then)f(w)m(e)g(ma)m(y)g(reduce)f(the)h(term)g(to)g(the) g(form)29 b Fb(ev)q Ft([)p Fn(M)2886 896 y Fm(i)2914 882 y Ft(])8 b(,)24 b(for)e(some)30 b Fn(i)g Ft(indep)s(enden)m(t)0 995 y(of)g(the)g(form)g(of)38 b Fn(M)673 1009 y Fp(1)713 995 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)1002 1010 y Fm(k)1054 995 y Ft(.)40 b(The)30 b(in)m(tuition)d(b)s(ehind)g(this)i(is)g(that)i (some)f(n)m(um)m(b)s(er)f(of)h(reduction)f(steps)g(ma)m(y)0 1108 y(b)s(e)i(indep)s(enden)m(t)e(of)i(the)h(c)m(hosen)g(subterms.)42 b(But)31 b(if)g(an)m(y)g(of)h(these)f(subterms)g(has)g(an)m(y)g (e\013ect)i(on)e(the)h(result,)0 1220 y(then)26 b(ev)m(en)m(tually)h(w) m(e)g(m)m(ust)g(come)h(to)f(some)h(term)35 b Fb(ev)p Ft([)p Fn(M)1989 1234 y Fm(i)2018 1220 y Ft(])g(where)26 b(the)h(next)g(reduction)f(dep)s(ends)f(on)h(the)h(form)0 1333 y(of)34 b Fn(M)195 1347 y Fm(i)232 1333 y Ft(.)39 b(The)25 b(\\sequen)m(tial")h(nature)f(of)h(PCF)f(is)g(that)h(when)e(w) m(e)j(reac)m(h)f(a)g(term)f(of)h(the)g(form)33 b Fb(ev)q Ft([)p Fn(M)3432 1347 y Fm(i)3460 1333 y Ft(])8 b(,)28 b(it)d(follo)m(ws)0 1446 y(from)39 b(Lemma)h(2.5.21)h(that)f(if)47 b Fn(M)1224 1460 y Fm(i)1300 1446 y Ft(is)39 b(not)g(a)h(lazy)g(normal) e(form,)k(w)m(e)e(con)m(tin)m(ue)f(to)i(reduce)47 b Fn(M)3453 1460 y Fm(i)3529 1446 y Ft(un)m(til)38 b(this)0 1559 y(subterm)29 b(term)i(do)s(es)f(not)g(lazy-reduce)h(further.)141 1672 y(Since)i(w)m(e)g(are)h(in)m(terested)g(in)e(analyzing)h(the)g (reduction)g(steps)g(applied)e(to)j(a)g(function)e(of)i(sev)m(eral)g (argu-)0 1785 y(men)m(ts,)42 b(w)m(e)f(will)36 b(use)k(con)m(texts)h (with)d(more)i(than)f(one)h(\\hole")g(\(place)g(for)g(inserting)d(a)j (term\).)69 b(A)40 b Fs(c)-5 b(ontext)0 1898 y Fr(C)5 b Ft([)15 b Fr(\001)g Fn(;)32 b(:)15 b(:)g(:)31 b(;)f Fr(\001)15 b Ft(])42 b Fs(with)h Fn(k)h Fs(holes)c Ft(is)30 b(a)h(syn)m(tactic)h(expression)e(with)f(exactly)j(the)f(same)h(form)e (as)h(a)h(term,)f(but)f(con-)0 2011 y(taining)24 b(zero)j(or)e(more)h (o)s(ccurrences)f(of)h(the)g(placeholders)32 b([)26 b(])2149 2025 y Fp(1)2189 2011 y Fn(;)15 b(:)g(:)g(:)h(;)f Ft([)26 b(])2466 2026 y Fm(k)2518 2011 y Ft(,)g(eac)m(h)h(assumed)e(to)h(ha)m (v)m(e)h(a)f(\014xed)f(t)m(yp)s(e)0 2124 y(within)i(this)h(expression.) 39 b(As)29 b(for)g(con)m(texts)h(with)e(a)i(single)e(hole,)h(w)m(e)g (write)37 b Fr(C)5 b Ft([)p Fn(M)2846 2138 y Fp(1)2886 2124 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)3176 2139 y Fm(k)3219 2124 y Ft(])38 b(for)28 b(the)i(result)e(of)0 2237 y(replacing)h(the)39 b Fn(i)8 b Ft(th)31 b(placeholder)37 b([)31 b(])1279 2251 y Fm(i)1346 2237 y Ft(b)m(y)38 b Fn(M)1568 2251 y Fm(i)1605 2237 y Ft(,)31 b(without)e(renaming)g(b)s(ound)f(v)-5 b(ariables.)141 2350 y(Our)33 b(\014rst)h(lemma)g(ab)s(out)g(reduction) g(in)f(arbitrary)g(con)m(texts)j(is)e(that)h(the)g(lazy)f(reduction)g (of)g(a)h(term)g(of)0 2462 y(the)f(form)42 b Fr(C)5 b Ft([)p Fn(M)553 2476 y Fp(1)593 2462 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)882 2477 y Fm(k)925 2462 y Ft(])43 b(is)32 b(either)i(a)g(reduction)e(on)42 b Fr(C)14 b Ft(,)35 b(indep)s(enden)m(t)c(of)j(the)g(terms)42 b Fn(M)3233 2476 y Fp(1)3273 2462 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)3562 2477 y Fm(k)3647 2462 y Ft(placed)0 2575 y(in)29 b(the)i(con)m(text,)h (or)e(a)h(reduction)f(that)g(dep)s(ends)f(on)h(the)h(form)f(of)g(one)h (of)f(the)h(terms)39 b Fn(M)3129 2589 y Fp(1)3168 2575 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)3458 2590 y Fm(k)3509 2575 y Ft(.)0 2768 y Fk(Lemma)33 b(2.5.23)46 b Fs(L)-5 b(et)44 b Fr(C)5 b Ft([)15 b Fr(\001)g Fn(;)32 b(:)15 b(:)g(:)31 b(;)g Fr(\001)15 b Ft(])44 b Fs(b)-5 b(e)36 b(a)f(c)-5 b(ontext)37 b(with)45 b Fn(k)h Fs(holes.)52 b(Supp)-5 b(ose)37 b(that)f(ther)-5 b(e)37 b(exist)e(close)-5 b(d)37 b(terms)0 2881 y Fn(N)73 2895 y Fp(1)112 2881 y Fn(;)15 b(:)g(:)g(:)i(;)e(N)387 2896 y Fm(k)475 2881 y Fs(of)36 b(the)h(appr)-5 b(opriate)40 b(typ)-5 b(es)38 b(such)e(that)46 b Fr(C)5 b Ft([)p Fn(N)2018 2895 y Fp(1)2058 2881 y Fn(;)15 b(:)g(:)g(:)i(;)e(N)2333 2896 y Fm(k)2376 2881 y Ft(])45 b Fs(is)36 b(not)h(in)f(lazy)i(normal)g(form.)54 b(Then)45 b Fr(C)0 2994 y Fs(must)33 b(have)g(one)g(of)g(the)g(fol)5 b(lowing)34 b(two)f(pr)-5 b(op)g(erties:)80 3165 y(\(i\))45 b(Ther)-5 b(e)34 b(is)e(a)h(c)-5 b(ontext)42 b Fr(C)1038 3132 y Fi(0)1061 3165 y Ft([)15 b Fr(\001)g Fn(;)31 b(:)15 b(:)g(:)32 b(;)e Fr(\001)15 b Ft(])42 b Fs(such)32 b(that)i(for)f(al)5 b(l)33 b(close)-5 b(d)34 b(terms)41 b Fn(M)2778 3179 y Fp(1)2818 3165 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)3108 3180 y Fm(k)3192 3165 y Fs(of)32 b(the)h(appr)-5 b(opriate)227 3306 y(typ)g(es)42 b Fr(C)5 b Ft([)p Fn(M)629 3320 y Fp(1)669 3306 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)959 3321 y Fm(k)1002 3306 y Ft(])1053 3251 y Fj(lazy)1069 3306 y Fr(!)42 b(C)1255 3273 y Fi(0)1279 3306 y Ft([)p Fn(M)1392 3320 y Fp(1)1432 3306 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)1721 3321 y Fm(k)1764 3306 y Ft(])8 b Fs(.)52 3487 y(\(ii\))45 b(Ther)-5 b(e)36 b(is)g(some)44 b Fn(i)g Fs(such)35 b(that)i(for)f(al)5 b(l)36 b(close)-5 b(d)36 b(terms)45 b Fn(M)2210 3501 y Fp(1)2249 3487 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)2539 3502 y Fm(k)2626 3487 y Fs(of)36 b(the)f(appr)-5 b(opriate)39 b(typ)-5 b(es)37 b(ther)-5 b(e)36 b(is)227 3600 y(an)d(evaluation)h(c) -5 b(ontext)42 b Fb(ev)q Ft([)32 b(])41 b Fs(with)h Fr(C)5 b Ft([)p Fn(M)1717 3614 y Fp(1)1757 3600 y Fn(;)15 b(:)g(:)g(:)i(;)e(M) 2047 3615 y Fm(k)2090 3600 y Ft(])26 b Fr(\021)f Fb(ev)p Ft([)p Fn(M)2457 3614 y Fm(i)2486 3600 y Ft(])8 b Fs(.)0 3793 y Ft(W)-8 b(e)32 b(use)e(Lemma)g(2.5.23)j(to)e(pro)m(v)m(e)g(the)g (follo)m(wing)d(statemen)m(t)33 b(ab)s(out)d(sequences)g(of)h(lazy)f (reductions.)0 3986 y Fk(Lemma)j(2.5.24)46 b Fs(L)-5 b(et)43 b Fr(C)5 b Ft([)15 b Fr(\001)g Fn(;)31 b(:)15 b(:)g(:)32 b(;)e Fr(\001)15 b Ft(])43 b Fs(b)-5 b(e)33 b(a)h(c)-5 b(ontext)35 b(with)43 b Fn(k)i Fs(holes,)35 b(let)42 b Fn(M)2625 4000 y Fp(1)2665 3986 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)2954 4001 y Fm(k)3040 3986 y Fs(b)-5 b(e)33 b(close)-5 b(d)35 b(terms)g(of)f(the)0 4099 y(appr)-5 b(opriate)31 b(typ)-5 b(es)29 b(for)37 b Fr(C)k Fs(and)29 b(supp)-5 b(ose)37 b Fr(C)5 b Ft([)p Fn(M)1612 4113 y Fp(1)1652 4099 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)1942 4114 y Fm(k)1985 4099 y Ft(])36 b Fs(is)28 b(a)g(pr)-5 b(o)g(gr)g(am)31 b(with)e(normal)g(form)37 b Fn(N)18 b Fs(.)40 b(Then)28 b(either)0 4212 y Fr(C)5 b Ft([)p Fn(M)176 4179 y Fi(0)166 4235 y Fp(1)206 4212 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)506 4179 y Fi(0)496 4238 y Fm(k)539 4212 y Ft(])46 b Fs(r)-5 b(e)g(duc)g(es)39 b(to)47 b Fn(N)56 b Fs(for)39 b(al)5 b(l)38 b(close)-5 b(d)47 b Fn(M)1844 4179 y Fi(0)1834 4235 y Fp(1)1874 4212 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)2174 4179 y Fi(0)2164 4238 y Fm(k)2253 4212 y Fs(of)38 b(the)h(appr)-5 b(opriate)41 b(typ)-5 b(es)39 b(or)g(ther)-5 b(e)38 b(is)g(some)0 4325 y(inte)-5 b(ger)37 b Fn(i)g Fs(such)29 b(that)h(for)g(al)5 b(l)29 b(close)-5 b(d)38 b Fn(M)1393 4292 y Fi(0)1383 4348 y Fp(1)1423 4325 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)1722 4292 y Fi(0)1712 4351 y Fm(k)1792 4325 y Fs(of)29 b(the)g(appr)-5 b(opriate)33 b(typ)-5 b(es)30 b(ther)-5 b(e)29 b(is)g(an)g(evaluation)h (c)-5 b(ontext)0 4470 y Fb(ev)p Ft([)33 b(])41 b Fs(with)h Fr(C)5 b Ft([)p Fn(M)613 4437 y Fi(0)603 4493 y Fp(1)643 4470 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)943 4437 y Fi(0)933 4496 y Fm(k)976 4470 y Ft(])1027 4414 y Fj(lazy)1028 4470 y Fr(!)-61 b(!)27 b Fb(ev)q Ft([)p Fn(M)1407 4437 y Fi(0)1397 4494 y Fm(i)1430 4470 y Ft(])8 b Fs(.)0 4663 y Ft(An)26 b(in)m(tuitiv)m(e)g(reading)f(of)i(this)f(lemma)g(is)g(that) h(some)g(n)m(um)m(b)s(er)e(of)i(reduction)e(steps)i(of)g(a)g(term)35 b Fr(C)5 b Ft([)p Fn(M)3502 4677 y Fp(1)3542 4663 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)3831 4678 y Fm(k)3875 4663 y Ft(])0 4775 y(ma)m(y)36 b(b)s(e)g(indep)s(enden)m(t)d(of)j(all)f(the)45 b Fn(M)1352 4789 y Fm(i)1388 4775 y Ft(.)57 b(If)36 b(this)f(do)s(es)g (not)h(pro)s(duce)f(a)h(normal)f(form,)i(then)f(ev)m(en)m(tually)g(the) 0 4888 y(reduction)22 b(of)31 b Fr(C)5 b Ft([)p Fn(M)667 4902 y Fp(1)707 4888 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)996 4903 y Fm(k)1040 4888 y Ft(])31 b(will)20 b(reac)m(h)j(a)g(step)g(that) g(dep)s(ends)e(on)i(the)g(form)f(of)h(some)31 b Fn(M)3165 4902 y Fm(i)3202 4888 y Ft(,)24 b(with)d(the)i(n)m(um)m(b)s(er)0 5001 y Fn(i)39 b Ft(dep)s(ending)28 b(only)h(on)39 b Fr(C)14 b Ft(.)141 5114 y(If)29 b(w)m(e)g(replace)h(lazy)f(reduction)f (with)g(left-most)h(reduction,)g(then)g(w)m(e)g(ma)m(y)h(c)m(hange)g (lazy)f(normal)g(form)f(to)0 5227 y(normal)c(form)g(in)g(Lemma)h (2.5.23)i(and)d(drop)g(the)h(assumption)e(that)34 b Fr(C)5 b Ft([)p Fn(M)2559 5241 y Fp(1)2599 5227 y Fn(;)15 b(:)g(:)g(:)i(;)e(M) 2889 5242 y Fm(k)2932 5227 y Ft(])33 b(is)24 b(a)i(program)e(in)g (Lemma)0 5340 y(2.5.24.)p eop %%Page: 110 61 110 60 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(110)141 91 y(Using)30 b(Lemmas)g(2.5.21)j(and)c (2.5.24,)k(w)m(e)e(no)m(w)g(pro)m(v)m(e)g(Theorem)f(2.5.19.)0 204 y Fk(Pro)s(of)46 b(of)f(Theorem)f(2.5.19)85 b Ft(Supp)s(ose)38 b(w)m(e)h(ha)m(v)m(e)i(a)e(PCF)g(expression)f Fs(POR)43 b Ft(de\014ning)37 b(parallel-or)h(and)0 340 y(consider)32 b(the)h(con)m(text)44 b Fr(C)5 b Ft([)15 b Fr(\001)g Fn(;)31 b Fr(\001)15 b Ft(])1135 285 y Fj(def)1153 340 y Ft(=)47 b Fs(POR)18 b Ft([)33 b(])1570 354 y Fp(1)1625 340 y Ft([)g(])1708 354 y Fp(2)1756 340 y Ft(.)49 b(Since)32 b Fs(POR)k Ft(de\014nes)c(parallel-or,)41 b Fr(C)5 b Ft([)p Fs(true)j Fn(;)15 b Fs(true)7 b Ft(])30 b Fr(!)-61 b(!)30 b Fs(true)0 453 y Ft(and)39 b Fr(C)5 b Ft([)p Fs(false)j Fn(;)15 b Fs(false)7 b Ft(])27 b Fr(!)-61 b(!)27 b Fs(false)15 b Ft(.)43 b(By)31 b(Lemma)g(2.5.24,)j(there)d(are) h(t)m(w)m(o)g(p)s(ossibilities)27 b(for)k(the)g(lazy)g(reduction)f(of)0 566 y Fr(C)5 b Ft([)p Fs(true)i Fn(;)15 b Fs(true)8 b Ft(])32 b(to)h Fs(true)16 b Ft(.)38 b(The)24 b(\014rst)f(implies)e (that)33 b Fr(C)5 b Ft([)p Fn(M)1888 580 y Fp(1)1928 566 y Fn(;)15 b(M)2056 580 y Fp(2)2096 566 y Ft(])26 b Fr(!)-61 b(!)25 b Fs(true)40 b Ft(for)23 b(all)g(closed)h(b)s(o)s (olean)f(terms)33 b Fn(M)3682 580 y Fp(1)3754 566 y Ft(and)0 679 y Fn(M)88 693 y Fp(2)136 679 y Ft(.)39 b(But)26 b(this)f(con)m (tradicts)35 b Fr(C)5 b Ft([)p Fs(false)i Fn(;)15 b Fs(false)8 b Ft(])26 b Fr(!)-61 b(!)25 b Fs(false)16 b Ft(.)39 b(Therefore,)27 b(there)f(is)f(an)h(in)m(teger)34 b Fn(i)26 b Fr(2)e(f)p Ft(1)p Fn(;)15 b Ft(2)p Fr(g)37 b Ft(suc)m(h)25 b(that)0 820 y(for)20 b(all)g(closed)g(b)s(o)s(olean)g(terms)28 b Fn(M)1172 834 y Fp(1)1212 820 y Fn(;)15 b(M)1340 834 y Fp(2)1388 820 y Ft(,)23 b(there)e(is)e(an)i(ev)-5 b(aluation)20 b(con)m(text)30 b Fb(ev)q Ft([)20 b(])29 b(with)f Fr(C)5 b Ft([)p Fn(M)3184 834 y Fp(1)3224 820 y Fn(;)15 b(M)3352 834 y Fp(2)3392 820 y Ft(])3443 764 y Fj(lazy)3444 820 y Fr(!)-61 b(!)27 b Fb(ev)q Ft([)p Fn(M)3813 834 y Fm(i)3841 820 y Ft(])8 b(.)0 933 y(But,)29 b(b)m(y)f(Lemma)g(2.5.21,)i(this)d (implies)e(that)k(if)e(w)m(e)h(apply)35 b Fs(POR)k Ft(to)e Fs(true)43 b Ft(and)27 b(the)i(term)36 b Fs(\014x)3291 955 y Fj(b)l(o)l(ol)3433 933 y Ft(\()p Fn(\025x)p Ft(:)15 b Fs(b)-5 b(o)g(ol)12 b Fn(:)k(x)p Ft(\))0 1046 y(with)26 b(no)i(normal)e(form,)i(making)35 b Fs(\014x)1301 1067 y Fj(b)l(o)l(ol)1444 1046 y Ft(\()p Fn(\025x)p Ft(:)15 b Fs(b)-5 b(o)g(ol)12 b Fn(:)j(x)p Ft(\))36 b(the)g Fn(i)8 b Ft(th)28 b(argumen)m(t,)h(w)m(e)f(cannot)g(reduce)f(the)h(resulting)0 1159 y(term)i(to)40 b Fs(true)15 b Ft(.)41 b(This)28 b(con)m(tradicts)j(the)g(assumption)e(that)39 b Fs(POR)j Ft(de\014nes)29 b(parallel-or.)p 3861 1159 40 40 v 141 1271 a(The)37 b(reader)h(ma)m(y)h(reasonably)e(ask)h(whether)f(the)h (non-de\014nabilit)m(y)d(of)j(parallel-or)e(is)h(a)h(p)s(eculiarit)m(y) e(of)0 1384 y(PCF)i(or)g(a)h(basic)f(prop)s(ert)m(y)g(shared)f(b)m(y)h (sequen)m(tial)g(programming)f(languages)i(suc)m(h)f(as)h(P)m(ascal)g (and)e(Lisp.)0 1497 y(The)j(main)f(complicating)h(factor)i(in)d (comparing)h(PCF)g(to)h(these)g(languages)g(is)f(the)g(order)g(of)h(ev) -5 b(aluation.)0 1610 y(Since)35 b(a)h(P)m(ascal)h(function)d(call)h Fl(P\(M,N\))f Ft(is)h(compiled)g(so)h(that)g(expressions)f Fl(M)g Ft(and)g Fl(N)h Ft(are)g(ev)-5 b(aluated)36 b Fs(b)-5 b(efor)g(e)0 1723 y Fl(P)33 b Ft(is)f(called,)h(it)f(is)g (clear)h(that)g(no)g(b)s(o)s(olean)f(function)g Fl(P)g Ft(could)g(compute)h(parallel-or.)47 b(Ho)m(w)m(ev)m(er,)36 b(w)m(e)e(can)f(ask)0 1836 y(whether)k(parallel-or)f(is)g(de\014nable)g (b)m(y)i(a)f(P)m(ascal)i(\(or)e(Lisp\))g(con)m(text)i(with)d(t)m(w)m(o) j(b)s(o)s(olean)d(p)s(ositions.)60 b(More)0 1949 y(precisely)-8 b(,)34 b(consider)f(a)i(P)m(ascal)f(program)g(con)m(text)44 b Fl(P)p Ft([)15 b Fr(\001)g Fn(;)32 b Fr(\001)15 b Ft(])42 b(with)33 b(t)m(w)m(o)j(\\holes")e(for)g(b)s(o)s(olean)f(expressions)g (\(or)0 2062 y(b)s(o)s(dies)f(of)i(functions)f(that)i(return)e(b)s(o)s (olean)g(v)-5 b(alues\).)51 b(An)34 b(imp)s(ortan)m(t)f(part)h(of)g (the)h(execution)f(of)42 b Fl(P)p Ft([)p Fl(M)p Fn(;)31 b Fl(N)p Ft(])42 b(is)0 2175 y(what)29 b(happ)s(ens)e(when)h Fl(M)g Ft(or)h Fl(N)g Ft(ma)m(y)h(run)d(forev)m(er.)41 b(Therefore,)29 b(it)g(is)f(sensible)e(and)j(non)m(trivial)e(to)i(ask)h (whether)0 2288 y(parallel-or)d(is)g(de\014nable)g(b)m(y)h(a)g(P)m (ascal)h(or)f(Lisp)f(con)m(text.)42 b(If)27 b(w)m(e)i(w)m(ere)g(to)g (go)g(to)g(the)f(e\013ort)h(of)f(formalizing)f(the)0 2401 y(execution)36 b(of)g(P)m(ascal)g(programs)f(in)f(the)i(w)m(a)m(y) h(that)f(w)m(e)g(ha)m(v)m(e)h(formalized)d(PCF)i(ev)-5 b(aluation,)37 b(it)e(seems)h(v)m(ery)0 2513 y(lik)m(ely)31 b(that)j(w)m(e)f(could)f(pro)m(v)m(e)i(that)f(parallel-or)f(is)f(not)j (de\014nable)d(b)m(y)i(an)m(y)g(con)m(text.)50 b(The)32 b(reader)h(ma)m(y)g(enjo)m(y)0 2626 y(trying)23 b(to)i(demonstrate)g (otherwise)f(b)m(y)g(constructing)f(a)i(P)m(ascal)g(con)m(text)h(that)f (de\014nes)e(parallel-or)g(and)g(seeing)0 2739 y(what)31 b(obstacles)h(are)g(in)m(v)m(olv)m(ed.)43 b(In)30 b(Lisp,)h(it)f(is)h (p)s(ossible)e(to)j(de\014ne)e(parallel-or)g(b)m(y)h(de\014ning)f(y)m (our)h(o)m(wn)g Fl(eval)0 2852 y Ft(function.)52 b(Ho)m(w)m(ev)m(er,)39 b(the)c(apparen)m(t)f(need)h(to)g(de\014ne)f(a)i(non-standard)d Fl(eval)h Ft(illustrates)f(the)h(sequen)m(tialit)m(y)0 2965 y(of)d(standard)e(Lisp)g(ev)-5 b(aluation.)0 3101 y Fk(Pro)s(of)26 b(of)f(Lemma)e(2.5.20)47 b Ft(W)-8 b(e)23 b(use)e(induction)f(on)h(the)h(pro)s(of,)h(in)d(the)i(system)g(of)g(T) -8 b(able)21 b(2.4,)k(that)31 b Fn(M)3634 3046 y Fj(lazy)3651 3101 y Fr(!)41 b Fn(N)19 b Ft(.)0 3214 y(The)29 b(base)g(case)h(is)e (that)39 b Fn(M)986 3208 y Fr(!)1092 3214 y Fn(N)47 b Ft(is)28 b(one)i(of)f(the)h(reduction)e(axioms)h(\(these)h(are)f (listed)f(in)g(T)-8 b(able)29 b(2.2\).)41 b(If)29 b(this)0 3327 y(is)j(so,)i(then)e(the)h(lemma)g(holds)e(with)40 b Fb(ev)p Ft([)33 b(])d Fr(\021)f Ft([)k(])8 b(.)48 b(The)33 b(induction)d(steps)j(for)f(the)h(inference)f(rules)g(in)f(T)-8 b(able)0 3468 y(2.4)29 b(are)e(all)g(similar)e(and)i(essen)m(tially)f (straigh)m(tforw)m(ard.)40 b(F)-8 b(or)28 b(example,)g(if)e(w)m(e)i(ha) m(v)m(e)37 b Fn(P)28 b Ft(+)14 b Fn(R)3224 3412 y Fj(lazy)3241 3468 y Fr(!)41 b Fn(Q)14 b Ft(+)g Fn(R)37 b Ft(b)m(y)28 b(the)0 3581 y(rule)1794 3790 y Fn(P)1890 3735 y Fj(lazy)1907 3790 y Fr(!)41 b Fn(Q)p 1613 3831 680 4 v 1613 3944 a(P)33 b Ft(+)20 b Fn(R)1890 3888 y Fj(lazy)1907 3944 y Fr(!)41 b Fn(Q)21 b Ft(+)e Fn(R)2336 3852 y(;)0 4147 y Ft(then)26 b(b)m(y)f(the)h(induction)e(h)m(yp)s(othesis)g(there)j(is)d(a)j(unique) d(ev)-5 b(aluation)25 b(con)m(text)36 b Fb(ev)2864 4114 y Fi(0)2887 4147 y Ft([)26 b(])34 b(suc)m(h)26 b(that)35 b Fn(P)j Fr(\021)25 b Fb(ev)3699 4114 y Fi(0)3722 4147 y Ft([)p Fn(P)3818 4114 y Fi(0)3841 4147 y Ft(])8 b(,)0 4260 y Fn(P)71 4227 y Fi(0)120 4260 y Fr(!)25 b Fn(Q)308 4227 y Fi(0)368 4260 y Ft(is)i(a)i(reduction)f(axioms,)h(and)36 b Fn(Q)25 b Fr(\021)g Fb(ev)1748 4227 y Fi(0)1771 4260 y Ft([)p Fn(Q)1868 4227 y Fi(0)1892 4260 y Ft(])8 b(.)40 b(The)28 b(lemma)h(follo)m(ws)e(b)m(y)i(taking)37 b Fb(ev)p Ft([)29 b(])d Fr(\021)f Fb(ev)3591 4227 y Fi(0)3613 4260 y Ft([)k(])17 b(+)g Fn(R)9 b Ft(.)p 0 4373 40 40 v 0 4486 a Fk(Pro)s(of)25 b(of)f(Lemma)d(2.5.21)46 b Ft(W)-8 b(e)22 b(pro)m(v)m(e)g(the)f(lemma)f(b)m(y)g(induction)f(on)i(the)f (structure)h(of)g(ev)-5 b(aluation)20 b(con)m(texts.)0 4599 y(In)30 b(the)h(base)f(case,)i(w)m(e)g(ha)m(v)m(e)f(an)g(ev)-5 b(aluation)30 b(con)m(text)41 b Fb(ev)p Ft([)31 b(])26 b Fr(\021)f Ft([)31 b(])8 b(.)42 b(Since)c Fb(ev)q Ft([)p Fn(M)10 b Ft(])26 b Fr(\021)f Fn(M)49 b Ft(and)39 b Fb(ev)p Ft([)p Fn(M)3574 4566 y Fi(0)3598 4599 y Ft(])26 b Fr(\021)f Fn(M)3843 4566 y Fi(0)3875 4599 y Ft(,)0 4740 y(it)30 b(is)f(easy)i(to)g(see)g(that)g(under)e(the)i(h)m(yp)s(otheses)f(of)g (the)h(lemma,)38 b Fb(ev)q Ft([)p Fn(M)10 b Ft(])2583 4684 y Fj(lazy)2599 4740 y Fr(!)42 b Fb(ev)q Ft([)p Fn(M)2963 4707 y Fi(0)2986 4740 y Ft(])8 b(.)141 4853 y(There)31 b(are)h(a)f(n)m(um)m(b)s(er)f(of)i(induction)d(cases,)j(corresp)s (onding)d(to)j(the)g(p)s(ossible)d(syn)m(tactic)j(forms)f(of)39 b Fb(ev)q Ft([)31 b(])8 b(.)0 4966 y(Since)29 b(the)i(analysis)e(of)h (eac)m(h)i(of)e(these)h(is)f(similar,)e(w)m(e)j(consider)e(three)h (represen)m(tativ)m(e)i(cases.)141 5079 y(The)e(case)39 b Fb(ev)q Ft([)30 b(])55 b Fr(\021)g Fb(ev)1005 5046 y Fi(0)1028 5079 y Ft([)30 b(])20 b(+)g Fn(M)1307 5093 y Fp(1)1385 5079 y Ft(is)29 b(similar)e(to)k(most)g(of)f(the)g(comp)s (ound)f(ev)-5 b(aluation)29 b(con)m(texts.)43 b(In)29 b(this)0 5220 y(case,)41 b Fb(ev)p Ft([)p Fn(M)10 b Ft(])27 b Fr(\021)f Fb(ev)714 5187 y Fi(0)737 5220 y Ft([)p Fn(M)10 b Ft(])22 b(+)e Fn(M)1086 5234 y Fp(1)1165 5220 y Ft(and,)31 b(b)m(y)g(the)g(induction)e(h)m(yp)s(othesis,)38 b Fb(ev)2647 5187 y Fi(0)2670 5220 y Ft([)p Fn(M)10 b Ft(])2845 5164 y Fj(lazy)2862 5220 y Fr(!)43 b Fb(ev)3104 5187 y Fi(0)3126 5220 y Ft([)p Fn(M)3249 5187 y Fi(0)3273 5220 y Ft(])8 b(.)43 b(Since)c Fb(ev)3729 5187 y Fi(0)3751 5220 y Ft([)p Fn(M)10 b Ft(])0 5333 y(is)28 b(not)h(syn)m(tactically)g(a)g(n)m (umeral,)g(no)g(axiom)f(can)i(apply)d(to)j(the)f(en)m(tire)g(term)37 b Fb(ev)2885 5300 y Fi(0)2908 5333 y Ft([)p Fn(M)10 b Ft(])18 b(+)f Fn(M)3250 5347 y Fp(1)3298 5333 y Ft(.)40 b(Therefore)29 b(the)p eop %%Page: 111 62 111 61 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(111)0 91 y(only)29 b(rule)h(in)f(T)-8 b(able)30 b(2.4)h(that)g(applies)e(is)1574 316 y Fb(ev)1682 279 y Fi(0)1705 316 y Ft([)p Fn(M)10 b Ft(])1879 261 y Fj(lazy)1895 316 y Fr(!)42 b Fb(ev)2136 279 y Fi(0)2159 316 y Ft([)p Fn(M)2282 279 y Fi(0)2306 316 y Ft(])p 1335 357 1235 4 v 1335 470 a Fb(ev)1443 433 y Fi(0)1466 470 y Ft([)p Fn(M)10 b Ft(])21 b(+)f Fn(M)1814 484 y Fp(1)1879 415 y Fj(lazy)1895 470 y Fr(!)42 b Fb(ev)2136 433 y Fi(0)2159 470 y Ft([)p Fn(M)2282 433 y Fi(0)2306 470 y Ft(])20 b(+)g Fn(M)2530 484 y Fp(1)2613 378 y Fn(:)0 711 y Ft(This)29 b(giv)m(es)h(us)38 b Fb(ev)q Ft([)p Fn(M)10 b Ft(])837 656 y Fj(lazy)853 711 y Fr(!)42 b Fb(ev)q Ft([)p Fn(M)1217 678 y Fi(0)1240 711 y Ft(])8 b(.)141 824 y(The)47 b(t)m(w)m(o)j(other)e (cases)g(w)m(e)h(will)c(consider)h(are)j(pro)5 b(jection)47 b(and)g(function)g(application.)91 b(A)48 b(con)m(text)0 937 y Fb(ev)p Ft([)42 b(])84 b Fr(\021)f Fk(Pro)6 b(j)642 960 y Fm(i)670 937 y Fb(ev)778 904 y Fi(0)801 937 y Ft([)41 b(])49 b(is)40 b(an)h(ev)-5 b(aluation)41 b(con)m(text)i(only)d(if)48 b Fb(ev)2382 904 y Fi(0)2405 937 y Ft([)41 b(])49 b(do)s(es)41 b(not)g(ha)m(v)m(e)h(the)f(syn)m(tactic)h(form)0 1078 y(of)30 b(a)h(pair.)39 b(Since)f Fn(M)770 1023 y Fj(lazy)787 1078 y Fr(!)k Fn(M)1018 1045 y Fi(0)1079 1078 y Ft(implies)28 b(that)39 b Fn(M)48 b Ft(is)30 b(not)g(a)g(pair,)g(w)m(e)g(kno)m(w)g (that)40 b Fb(ev)p Ft([)p Fn(M)10 b Ft(])39 b(and)f Fb(ev)3433 1045 y Fi(0)3456 1078 y Ft([)p Fn(M)10 b Ft(])39 b(do)30 b(not)0 1191 y(ha)m(v)m(e)38 b(the)f(syn)m(tactic)h(form)f(of)g(a)g (pair.)59 b(It)37 b(follo)m(ws)f(that)i(no)f(reduction)e(axiom)i (applies)e(to)j(the)f(en)m(tire)g(term)0 1327 y Fk(Pro)6 b(j)205 1349 y Fm(i)233 1327 y Fb(ev)341 1294 y Fi(0)363 1327 y Ft([)p Fn(M)k Ft(])e(.)50 b(Therefore,)34 b(b)m(y)e(the)i (induction)c(h)m(yp)s(othesis)i(that)42 b Fb(ev)2496 1294 y Fi(0)2519 1327 y Ft([)p Fn(M)10 b Ft(])2697 1272 y Fj(lazy)2714 1327 y Fr(!)46 b Fb(ev)2959 1294 y Fi(0)2981 1327 y Ft([)p Fn(M)3104 1294 y Fi(0)3128 1327 y Ft(])8 b(,)35 b(w)m(e)e(conclude)f(that)0 1468 y Fb(ev)p Ft([)p Fn(M)10 b Ft(])26 b Fr(\021)f Fk(Pro)6 b(j)582 1490 y Fm(i)610 1468 y Fb(ev)718 1435 y Fi(0)741 1468 y Ft([)p Fn(M)k Ft(])915 1412 y Fj(lazy)931 1468 y Fr(!)42 b Fk(Pro)6 b(j)1269 1490 y Fm(i)1297 1468 y Fb(ev)1405 1435 y Fi(0)1428 1468 y Ft([)p Fn(M)1551 1435 y Fi(0)1574 1468 y Ft(])26 b Fr(\021)f Fb(ev)p Ft([)p Fn(M)1951 1435 y Fi(0)1975 1468 y Ft(])8 b(.)141 1581 y(The)37 b(last)h(case)g(w)m(e)h(consider)d (is)45 b Fb(ev)q Ft([)37 b(])76 b Fr(\021)e Fb(ev)1848 1548 y Fi(0)1871 1581 y Ft([)38 b(])15 b Fn(N)j Ft(.)63 b(This)36 b(is)g(similar)f(to)k(the)f(pro)5 b(jection)37 b(case.)63 b(The)0 1694 y(con)m(text)47 b Fb(ev)446 1661 y Fi(0)469 1694 y Ft([)37 b(])45 b(cannot)38 b(b)s(e)e(a)i(lam)m(b)s (da)d(abstraction,)k(b)m(y)e(the)g(de\014nition)e(of)i(ev)-5 b(aluation)37 b(con)m(texts,)j(and)45 b Fn(M)0 1835 y Ft(is)33 b(not)h(a)g(lam)m(b)s(da)e(abstraction)i(since)41 b Fn(M)1507 1779 y Fj(lazy)1524 1835 y Fr(!)47 b Fn(M)1760 1802 y Fi(0)1791 1835 y Ft(.)k(It)34 b(follo)m(ws)e(that)43 b Fb(ev)2587 1802 y Fi(0)2610 1835 y Ft([)p Fn(M)10 b Ft(])42 b(do)s(es)33 b(not)h(ha)m(v)m(e)h(the)f(syn)m(tactic)0 1948 y(form)i(of)g(a)g(lam)m(b)s(da)f(abstraction.)58 b(Since)35 b(the)i(reduction)e(axiom)44 b(\()p Fn(\014)5 b Ft(\))45 b(do)s(es)36 b(not)g(apply)f(to)i(the)f(en)m(tire)g(term)0 2089 y Fb(ev)108 2056 y Fi(0)131 2089 y Ft([)p Fn(M)10 b Ft(])15 b Fn(N)k Ft(,)27 b(w)m(e)g(use)f(the)g(induction)e(h)m(yp)s (othesis)33 b Fb(ev)1833 2056 y Fi(0)1856 2089 y Ft([)p Fn(M)10 b Ft(])2030 2033 y Fj(lazy)2046 2089 y Fr(!)42 b Fb(ev)2287 2056 y Fi(0)2310 2089 y Ft([)p Fn(M)2433 2056 y Fi(0)2457 2089 y Ft(])34 b(and)26 b(the)g(de\014nition)e(of)j (lazy)f(reduction)0 2230 y(in)j(T)-8 b(able)30 b(2.4)i(to)f(conclude)e (that)40 b Fb(ev)p Ft([)p Fn(M)10 b Ft(])1474 2174 y Fj(lazy)1491 2230 y Fr(!)41 b Fb(ev)q Ft([)p Fn(M)1854 2197 y Fi(0)1878 2230 y Ft(])8 b(.)p 3861 2230 40 40 v 0 2342 a Fk(Pro)s(of)35 b(of)f(Lemma)e(2.5.23)64 b Ft(W)-8 b(e)31 b(pro)m(v)m(e)f(the)g(lemma)f(b)m(y)g(induction)f(on)h (the)h(structure)f(of)g(con)m(texts.)43 b(If)37 b Fr(C)43 b Ft(is)0 2455 y(a)29 b(single)e(sym)m(b)s(ol,)h(then)g(it)g(is)f (either)h(one)h(of)g(the)f(placeholders,)36 b([)29 b(])2347 2469 y Fm(i)2383 2455 y Ft(,)g(a)g(v)-5 b(ariable)27 b(or)i(a)g(constan)m(t.)41 b(It)29 b(is)e(easy)i(to)0 2568 y(see)i(that)39 b Fr(C)44 b Ft(has)30 b(prop)s(ert)m(y)g(\()p Fs(ii)9 b Ft(\))31 b(if)e(it)h(is)g(a)g(placeholder)f(and)h(prop)s(ert) m(y)g(\()p Fs(i)9 b Ft(\))31 b(if)e(it)h(is)g(some)g(other)h(sym)m(b)s (ol.)141 2681 y(F)-8 b(or)24 b(a)g(con)m(text)33 b Fr(C)738 2695 y Fp(1)777 2681 y Ft([)15 b Fr(\001)g Fn(;)32 b(:)15 b(:)g(:)31 b(;)g Fr(\001)15 b Ft(])6 b(+)g Fr(C)1302 2695 y Fp(2)1341 2681 y Ft([)15 b Fr(\001)g Fn(;)32 b(:)15 b(:)g(:)31 b(;)g Fr(\001)15 b Ft(])8 b(,)25 b(w)m(e)f(consider)e(t)m(w) m(o)j(cases,)h(eac)m(h)e(dividing)c(in)m(to)j(t)m(w)m(o)i(sub)s(cases)0 2794 y(when)38 b(w)m(e)i(apply)d(the)j(induction)c(h)m(yp)s(othesis.)66 b(If)38 b(there)i(exist)f(terms)47 b Fn(M)2658 2808 y Fp(1)2697 2794 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)2987 2809 y Fm(k)3078 2794 y Ft(with)46 b Fr(C)3350 2808 y Fp(1)3389 2794 y Ft([)p Fn(M)3502 2808 y Fp(1)3542 2794 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)3831 2809 y Fm(k)3875 2794 y Ft(])0 2935 y(not)40 b(in)e(lazy)i(normal)f(form,)j(then)d(w)m(e)h(apply)e (the)i(induction)e(h)m(yp)s(othesis)g(to)49 b Fr(C)2887 2949 y Fp(1)2934 2935 y Ft(.)69 b(If)48 b Fr(C)3185 2949 y Fp(1)3224 2935 y Ft([)p Fn(M)3337 2949 y Fp(1)3377 2935 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)3666 2950 y Fm(k)3710 2935 y Ft(])3776 2880 y Fj(lazy)3792 2935 y Fr(!)0 3048 y(C)53 3015 y Fi(0)48 3071 y Fp(1)87 3048 y Ft([)p Fn(M)200 3062 y Fp(1)240 3048 y Fn(;)g(:)g(:)g(:)i(;)e(M)530 3063 y Fm(k)573 3048 y Ft(])38 b(for)28 b(all)36 b Fn(M)994 3062 y Fp(1)1034 3048 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)1324 3063 y Fm(k)1375 3048 y Ft(,)30 b(then)e(it)h(is)f(easy)i(to)f(see)h (from)e(the)i(de\014nition)c(of)j(lazy)g(reduction)f(that)555 3278 y Fr(C)603 3292 y Fp(1)642 3278 y Ft([)p Fn(M)755 3292 y Fp(1)795 3278 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)1085 3293 y Fm(k)1128 3278 y Ft(])20 b(+)g Fr(C)1312 3292 y Fp(2)1352 3278 y Ft([)p Fn(M)1465 3292 y Fp(1)1505 3278 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)1794 3293 y Fm(k)1837 3278 y Ft(])1888 3223 y Fj(lazy)1905 3278 y Fr(!)41 b(C)2090 3241 y Fi(0)2085 3301 y Fp(1)2125 3278 y Ft([)p Fn(M)2238 3292 y Fp(1)2278 3278 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)2567 3293 y Fm(k)2610 3278 y Ft(])21 b(+)f Fr(C)2795 3292 y Fp(2)2834 3278 y Ft([)p Fn(M)2947 3292 y Fp(1)2987 3278 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)3277 3293 y Fm(k)3320 3278 y Ft(])0 3481 y(for)35 b(all)43 b Fn(M)372 3495 y Fp(1)411 3481 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)701 3496 y Fm(k)752 3481 y Ft(.)56 b(On)34 b(the)i(other)f(hand,)h(if)e(for)h (ev)m(ery)44 b Fn(M)2225 3495 y Fp(1)2265 3481 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)2555 3496 y Fm(k)2641 3481 y Ft(w)m(e)36 b(can)g(write)43 b Fr(C)3246 3495 y Fp(1)3285 3481 y Ft([)p Fn(M)3398 3495 y Fp(1)3438 3481 y Fn(;)15 b(:)g(:)g(:)h(;)f(M) 3727 3496 y Fm(k)3771 3481 y Ft(])33 b Fr(\021)0 3593 y Fb(ev)p Ft([)p Fn(M)220 3607 y Fm(i)249 3593 y Ft(])8 b(,)31 b(then)744 3706 y Fr(C)792 3720 y Fp(1)831 3706 y Ft([)p Fn(M)944 3720 y Fp(1)984 3706 y Fn(;)15 b(:)g(:)g(:)h(;)f(M) 1273 3721 y Fm(k)1317 3706 y Ft(])20 b(+)g Fr(C)1501 3720 y Fp(2)1540 3706 y Ft([)p Fn(M)1653 3720 y Fp(1)1693 3706 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)1983 3721 y Fm(k)2026 3706 y Ft(])26 b Fr(\021)f Fb(ev)p Ft([)p Fn(M)2393 3720 y Fm(i)2422 3706 y Ft(])20 b(+)g Fr(C)2606 3720 y Fp(2)2645 3706 y Ft([)p Fn(M)2758 3720 y Fp(1)2798 3706 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)3088 3721 y Fm(k)3131 3706 y Ft(])0 3872 y(and)33 b(w)m(e)h(ha)m(v)m(e)h(an)f(ev)-5 b(aluation)33 b(con)m(text)j(for)42 b Fn(M)1666 3886 y Fm(i)1702 3872 y Ft(.)51 b(The)34 b(second)f(case)i(is)e(that)43 b Fr(C)2813 3886 y Fp(1)2852 3872 y Ft([)p Fn(M)2965 3886 y Fp(1)3005 3872 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)3295 3887 y Fm(k)3338 3872 y Ft(])42 b(is)33 b(a)h(n)m(umeral)0 3985 y(and)h(therefore)45 b Fn(M)666 3999 y Fp(1)706 3985 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)995 4000 y Fm(k)1083 3985 y Ft(do)36 b(not)g(o)s(ccur)g(in)43 b Fr(C)1801 3999 y Fp(1)1840 3985 y Ft([)p Fn(M)1953 3999 y Fp(1)1993 3985 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)2283 4000 y Fm(k)2326 3985 y Ft(])8 b(.)58 b(In)35 b(this)g(case,)k(w)m(e)d (apply)f(the)h(induction)0 4098 y(h)m(yp)s(othesis)29 b(to)39 b Fr(C)615 4112 y Fp(2)693 4098 y Ft(and)30 b(reason)h(as)f(ab) s(o)m(v)m(e.)141 4211 y(The)g(induction)e(steps)j(for)38 b Fs(Eq)8 b Ft(?)38 b(and)h Fl(if)62 b Fn(:)15 b(:)g(:)64 b Fl(then)e Fn(:)15 b(:)g(:)64 b Fl(else)d Fn(:)15 b(:)g(:)40 b Ft(are)31 b(similar)d(to)j(the)g(addition)e(case.)0 4324 y(The)39 b(induction)f(steps)i(for)f(pairing)f(and)i(lam)m(b)s(da) e(abstraction)i(are)h(trivial,)f(since)f(these)i(are)f(lazy)g(normal)0 4437 y(forms.)141 4550 y(F)-8 b(or)48 b(a)f(con)m(text)56 b Fk(Pro)6 b(j)965 4572 y Fm(i)993 4550 y Fr(C)f Ft([)15 b Fr(\001)g Fn(;)32 b(:)15 b(:)g(:)31 b(;)g Fr(\001)15 b Ft(])8 b(,)51 b(w)m(e)d(m)m(ust)e(consider)g(the)h(form)f(of)55 b Fr(C)14 b Ft(.)89 b(If)54 b Fr(C)5 b Ft([)15 b Fr(\001)g Fn(;)32 b(:)15 b(:)g(:)31 b(;)g Fr(\001)15 b Ft(])53 b Fr(\021)f Ft([)47 b(])3830 4564 y Fm(j)3875 4550 y Ft(,)0 4663 y(then)i Fk(Pro)6 b(j)431 4685 y Fm(i)459 4663 y Fr(C)f Ft([)15 b Fr(\001)g Fn(;)31 b(:)15 b(:)g(:)32 b(;)e Fr(\001)15 b Ft(])50 b(satis\014es)41 b(condition)f(\()p Fs(ii)9 b Ft(\))42 b(of)f(the)g(lemma)g(since)g(this)f(is)g(an)h(ev)-5 b(aluation)41 b(con)m(text.)0 4775 y(If)52 b Fr(C)5 b Ft([)15 b Fr(\001)g Fn(;)32 b(:)15 b(:)g(:)31 b(;)g Fr(\001)15 b Ft(])49 b Fr(\021)g(hC)812 4789 y Fp(1)852 4775 y Ft([)15 b Fr(\001)g Fn(;)31 b(:)15 b(:)g(:)31 b(;)g Fr(\001)15 b Ft(])p Fn(;)31 b Fr(C)1349 4789 y Fp(2)1388 4775 y Ft([)15 b Fr(\001)g Fn(;)32 b(:)15 b(:)g(:)31 b(;)g Fr(\001)15 b Ft(])p Fr(i)8 b Ft(,)49 b(then)k Fk(Pro)6 b(j)2333 4798 y Fm(i)2361 4775 y Fr(C)f Ft([)15 b Fr(\001)g Fn(;)32 b(:)15 b(:)g(:)31 b(;)g Fr(\001)15 b Ft(])53 b(satis\014es)44 b(condition)f(\()p Fs(i)9 b Ft(\).)84 b(If)0 4888 y Fr(C)5 b Ft([)15 b Fr(\001)g Fn(;)32 b(:)15 b(:)g(:)31 b(;)f Fr(\001)15 b Ft(])43 b(has)33 b(some)g(other)h(form,)g(then)41 b Fk(Pro)6 b(j)1792 4911 y Fm(i)1820 4888 y Fr(C)f Ft([)p Fn(M)1986 4902 y Fp(1)2026 4888 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)2316 4903 y Fm(k)2359 4888 y Ft(])42 b(cannot)34 b(b)s(e)e(a)i(\()p Fs(pr)-5 b(oj)13 b Ft(\))36 b(redex.)49 b(Therefore,)0 5001 y(w)m(e)31 b(apply)e(the)h(induction)e(h)m(yp)s(othesis)h(to)40 b Fr(C)k Ft(and)29 b(reason)i(as)g(in)e(the)h(earlier)f(cases.)141 5114 y(The)h(induction)e(step)j(for)f(a)h(con)m(text)41 b Fr(C)1520 5128 y Fp(1)1559 5114 y Ft([)15 b Fr(\001)g Fn(;)32 b(:)15 b(:)g(:)31 b(;)g Fr(\001)15 b Ft(])g Fr(C)2016 5128 y Fp(2)2056 5114 y Ft([)g Fr(\001)g Fn(;)31 b(:)15 b(:)g(:)32 b(;)e Fr(\001)15 b Ft(])40 b(is)29 b(similar)f(to)j(the)39 b Fk(Pro)6 b(j)3360 5137 y Fm(i)3427 5114 y Ft(case,)32 b(except)0 5227 y(that)d(w)m(e)g(will)d(need)j(to)g(use)f(the)h (assumption)e(that)i(all)f(the)h(terms)f(w)m(e)h(place)g(in)e(con)m (texts)k(are)e(closed.)40 b(Sp)s(eci\014-)0 5340 y(cally)-8 b(,)22 b(if)28 b Fr(C)354 5354 y Fp(1)393 5340 y Ft([)15 b Fr(\001)g Fn(;)31 b(:)15 b(:)g(:)32 b(;)e Fr(\001)15 b Ft(])26 b Fr(\021)f Fn(\025x)p Ft(:)15 b Fn(\033)t(:)g Fr(C)1197 5354 y Fp(3)1237 5340 y Ft([)g Fr(\001)g Fn(;)31 b(:)15 b(:)g(:)31 b(;)g Fr(\001)15 b Ft(])8 b(,)23 b(then)d(let)29 b Fr(C)2066 5307 y Fi(0)2118 5340 y Ft(b)s(e)19 b(the)i(con)m(text)30 b Fr(C)2752 5307 y Fi(0)2776 5340 y Ft([)15 b Fr(\001)g Fn(;)g(:)g(:)g(:)32 b(;)f Fr(\001)15 b Ft(])26 b Fr(\021)f Ft([)p Fr(C)3349 5354 y Fp(2)3388 5340 y Ft([)15 b Fr(\001)g Fn(;)g(:)g(:)g(:)33 b(;)d Fr(\001)15 b Ft(])p Fn(=x)p Ft(])p Fr(C)3936 5354 y Fp(1)3977 5340 y Ft([)g Fr(\001)g Fn(;)g(:)g(:)g(:)33 b(;)d Fr(\001)15 b Ft(])8 b(.)p eop %%Page: 112 63 112 62 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(112)0 91 y(F)-8 b(or)31 b(all)e Fs(close)-5 b(d)50 b Fn(M)658 105 y Fp(1)697 91 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)987 106 y Fm(k)1069 91 y Ft(w)m(e)31 b(ha)m(v)m(e)784 317 y(\()p Fn(\025x)p Ft(:)15 b Fn(\033)t(:)h Fr(C)1109 331 y Fp(3)1148 317 y Ft([)p Fn(M)1261 331 y Fp(1)1301 317 y Fn(;)f(:)g(:)g(:)i(;)e(M)1591 332 y Fm(k)1634 317 y Ft(]\))p Fr(C)1742 331 y Fp(2)1782 317 y Ft([)p Fn(M)1895 331 y Fp(1)1935 317 y Fn(;)g(:)g(:)g(:)h(;)f(M)2224 332 y Fm(k)2268 317 y Ft(])2348 262 y Fj(lazy)2365 317 y Fr(!)72 b(C)2581 280 y Fi(0)2605 317 y Ft([)p Fn(M)2718 331 y Fp(1)2757 317 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)3047 332 y Fm(k)3090 317 y Ft(])0 520 y(and)25 b(the)g(con)m(text)j (satis\014es)d(condition)f(\()p Fs(i)9 b Ft(\))26 b(of)g(the)f(lemma.) 39 b(If)33 b Fr(C)2218 534 y Fp(1)2257 520 y Ft([)15 b Fr(\001)g Fn(;)32 b(:)15 b(:)g(:)31 b(;)g Fr(\001)15 b Ft(])26 b Fr(\021)f Ft([)g(])2848 534 y Fm(i)2885 520 y Ft(,)i(then)e(as)g(in)g(the)g(pro)5 b(jection)0 633 y(case,)33 b(the)f(application)d(con)m(text)34 b(satis\014es)c (condition)h(\()p Fs(ii)9 b Ft(\))32 b(of)f(the)h(lemma.)43 b(Finally)-8 b(,)31 b(if)38 b Fr(C)3137 647 y Fp(1)3176 633 y Ft([)15 b Fr(\001)g Fn(;)32 b(:)15 b(:)g(:)31 b(;)g Fr(\001)15 b Ft(])40 b(is)31 b(some)0 746 y(con)m(text)43 b(that)g(is)d(not)i(of)g(one)g(of)f(these)h(t)m(w)m(o)h(forms,)h(w)m(e) e(reason)g(as)g(in)e(the)i(addition)e(case,)45 b(applying)40 b(the)0 859 y(induction)25 b(h)m(yp)s(othesis)h(to)j(either)35 b Fr(C)1266 873 y Fp(1)1341 859 y Ft(or,)29 b(if)35 b Fr(C)1613 873 y Fp(1)1652 859 y Ft([)p Fn(M)1765 873 y Fp(1)1805 859 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)2094 874 y Fm(k)2138 859 y Ft(])36 b(is)26 b(a)i(lazy)g(a)g(normal)f(form)g(for) g(all)35 b Fn(M)3494 873 y Fp(1)3534 859 y Fn(;)15 b(:)g(:)g(:)h(;)f(M) 3823 874 y Fm(k)3875 859 y Ft(,)0 972 y(the)31 b(con)m(text)40 b Fr(C)536 986 y Fp(2)584 972 y Ft(.)g(This)29 b(completes)i(the)f(pro) s(of.)p 3861 972 40 40 v 0 1085 a Fk(Pro)s(of)47 b(of)g(Lemma)e(2.5.24) 88 b Ft(Let)49 b Fr(C)5 b Ft([)15 b Fr(\001)g Fn(;)32 b(:)15 b(:)g(:)31 b(;)g Fr(\001)15 b Ft(])49 b(b)s(e)40 b(a)h(con)m(text)h(with)48 b Fn(k)k Ft(holes)40 b(and)g(let)48 b Fn(M)3385 1099 y Fp(1)3425 1085 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)3715 1100 y Fm(k)3807 1085 y Ft(b)s(e)0 1198 y(closed)33 b(terms)h(of)f(the) h(appropriate)e(t)m(yp)s(es)i(suc)m(h)f(that)42 b Fr(C)5 b Ft([)p Fn(M)2113 1212 y Fp(1)2154 1198 y Fn(;)15 b(:)g(:)g(:)h(;)f(M) 2443 1213 y Fm(k)2486 1198 y Ft(])42 b(has)34 b(normal)e(form)41 b Fn(N)52 b Ft(of)34 b(observ)-5 b(able)0 1339 y(t)m(yp)s(e.)57 b(Then)44 b Fr(C)5 b Ft([)p Fn(M)674 1353 y Fp(1)714 1339 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)1003 1354 y Fm(k)1046 1339 y Ft(])1106 1283 y Fj(lazy)1108 1339 y Fr(!)-61 b(!)1230 1353 y Fm(n)1312 1339 y Fn(N)18 b Ft(,)37 b(where)44 b Fn(n)g Ft(indicates)35 b(the)h(n)m(um)m(b)s(er)e(of)i(reduction)f (steps.)57 b(W)-8 b(e)37 b(pro)m(v)m(e)0 1452 y(the)31 b(lemma)e(b)m(y)i(induction)d(on)38 b Fn(n)8 b Ft(.)141 1565 y(In)31 b(the)h(base)f(case,)42 b Fr(C)5 b Ft([)p Fn(M)1011 1579 y Fp(1)1051 1565 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)1340 1580 y Fm(k)1384 1565 y Ft(])27 b Fr(\021)g Fn(N)49 b Ft(is)31 b(in)f(normal)h(form.)43 b(There)31 b(are)h(t)m(w)m(o)h(cases) f(to)g(consider.)43 b(The)0 1677 y(degenerate)e(one)e(is)g(that)48 b Fr(C)5 b Ft([)p Fn(M)1130 1644 y Fi(0)1120 1701 y Fp(1)1160 1677 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)1460 1644 y Fi(0)1450 1704 y Fm(k)1493 1677 y Ft(])48 b(is)38 b(in)g(normal)g(form)h(for)g (all)g(closed)g(terms)47 b Fn(M)3251 1644 y Fi(0)3241 1701 y Fp(1)3281 1677 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)3580 1644 y Fi(0)3570 1704 y Fm(k)3661 1677 y Ft(of)40 b(the)0 1790 y(appropriate)f(t)m(yp)s(es.)69 b(But)40 b(since)f(the)h(only)f (results)g(are)h(n)m(umerals)f(and)g(b)s(o)s(olean)g(constan)m(ts,)51 b Fn(M)3537 1757 y Fi(0)3527 1813 y Fp(1)3567 1790 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)3867 1757 y Fi(0)3857 1817 y Fm(k)0 1903 y Ft(m)m(ust)38 b(not)g(app)s(ear)f(in)44 b Fn(N)56 b Ft(and)37 b(the)h(lemma)g(easily)f(follo)m(ws.)62 b(The)37 b(second)h(case)g(is)f(that)47 b Fr(C)5 b Ft([)p Fn(M)3405 1870 y Fi(0)3395 1926 y Fp(1)3435 1903 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)3734 1870 y Fi(0)3724 1930 y Fm(k)3768 1903 y Ft(])46 b(is)0 2016 y(not)30 b(in)f(normal)g(form)g(for)h(some) 39 b Fn(M)1262 1983 y Fi(0)1252 2039 y Fp(1)1291 2016 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)1591 1983 y Fi(0)1581 2043 y Fm(k)1633 2016 y Ft(.)40 b(Since)d Fr(C)5 b Ft([)p Fn(M)2109 2030 y Fp(1)2150 2016 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)2439 2031 y Fm(k)2482 2016 y Ft(])39 b(is)29 b(in)g(normal)g(form,)g (condition)g(\()p Fs(i)9 b Ft(\))31 b(of)0 2129 y(Lemma)f(2.5.23)j (cannot)e(hold.)39 b(Therefore)g Fr(C)5 b Ft([)p Fn(M)1719 2096 y Fi(0)1709 2152 y Fp(1)1749 2129 y Fn(;)15 b(:)g(:)g(:)i(;)e(M) 2049 2096 y Fi(0)2039 2155 y Fm(k)2082 2129 y Ft(])25 b Fr(\021)g Fb(ev)q Ft([)p Fn(M)2459 2096 y Fi(0)2449 2153 y Fm(i)2482 2129 y Ft(])8 b(.)141 2274 y(In)35 b(the)h(induction)d (step,)k(with)42 b Fr(C)5 b Ft([)p Fn(M)1441 2288 y Fp(1)1481 2274 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)1771 2289 y Fm(k)1814 2274 y Ft(])1873 2218 y Fj(lazy)1875 2274 y Fr(!)-61 b(!)1997 2288 y Fm(m)p Fp(+1)2188 2274 y Fn(N)18 b Ft(,)37 b(Lemma)e(2.5.23)j(giv)m(es)e(us)f(t)m(w)m(o)i(cases.)56 b(The)0 2387 y(simpler)28 b(is)i(that)h(there)g(is)f(some)39 b Fn(i)h Ft(suc)m(h)30 b(that)h(for)g(all)e(closed)i(terms)39 b Fn(M)2537 2354 y Fi(0)2527 2410 y Fp(1)2567 2387 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)2866 2354 y Fi(0)2856 2413 y Fm(k)2938 2387 y Ft(of)31 b(the)g(appropriate)f(t)m(yp)s(es)0 2531 y Fr(C)5 b Ft([)p Fn(M)176 2498 y Fi(0)166 2554 y Fp(1)206 2531 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)506 2498 y Fi(0)496 2558 y Fm(k)539 2531 y Ft(])43 b(has)34 b(the)g(form)42 b Fb(ev)p Ft([)p Fn(M)1390 2498 y Fi(0)1380 2555 y Fm(i)1414 2531 y Ft(])8 b(.)53 b(But)34 b(then)g(clearly)42 b Fr(C)5 b Ft([)p Fn(M)2399 2498 y Fi(0)2389 2554 y Fp(1)2429 2531 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)2729 2498 y Fi(0)2719 2558 y Fm(k)2762 2531 y Ft(])2819 2476 y Fj(lazy)2820 2531 y Fr(!)-61 b(!)34 b Fb(ev)p Ft([)p Fn(M)3205 2498 y Fi(0)3195 2555 y Fm(i)3229 2531 y Ft(])42 b(and)34 b(the)g(lemma)0 2644 y(holds.)43 b(The)31 b(remaining)f(case)j(is)d (that)i(there)g(is)f(some)h(con)m(text)42 b Fr(C)2317 2611 y Fi(0)2340 2644 y Ft([)15 b Fr(\001)g Fn(;)g(:)g(:)g(:)33 b(;)d Fr(\001)15 b Ft(])41 b(suc)m(h)31 b(that)h(for)g(all)38 b Fn(M)3537 2611 y Fi(0)3527 2667 y Fp(1)3567 2644 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)3867 2611 y Fi(0)3857 2671 y Fm(k)0 2757 y Ft(of)31 b(appropriate)e(t)m(yp)s(es,)i(w)m(e)f(ha)m(v) m(e)i(a)f(reduction)e(of)i(the)f(form)1115 2983 y Fr(C)5 b Ft([)p Fn(M)1281 2997 y Fp(1)1321 2983 y Fn(;)15 b(:)g(:)g(:)h(;)f(M) 1610 2998 y Fm(k)1653 2983 y Ft(])1704 2928 y Fj(lazy)1721 2983 y Fr(!)41 b(C)1906 2946 y Fi(0)1930 2983 y Ft([)p Fn(M)2043 2997 y Fp(1)2083 2983 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)2372 2998 y Fm(k)2416 2983 y Ft(])2466 2928 y Fj(lazy)2468 2983 y Fr(!)-61 b(!)2590 2997 y Fm(m)2682 2983 y Fn(N)5 b(:)0 3186 y Ft(The)30 b(lemma)g(follo)m(ws)f(b)m(y)i(the)f(induction)e (h)m(yp)s(othesis)h(for)39 b Fr(C)2114 3153 y Fi(0)2137 3186 y Ft([)15 b Fr(\001)31 b Fn(:)15 b(:)g(:)31 b(;)15 b Fr(\001)g Ft(])8 b(.)42 b(This)29 b(concludes)h(the)g(pro)s(of.)p 3861 3186 V 0 3397 a Fk(Exercise)35 b(2.5.25)47 b Ft(Sho)m(w)32 b(that)h(Lemma)f(2.5.24)j(fails)30 b(if)i(w)m(e)g(drop)g(the)g (assumption)f(that)41 b Fr(C)5 b Ft([)p Fn(M)3400 3411 y Fp(1)3440 3397 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)3730 3412 y Fm(k)3773 3397 y Ft(])41 b(is)0 3510 y(a)31 b(program.)0 3722 y Fk(Exercise)k(2.5.26)47 b Ft(This)25 b(exercise)j(asks)f(y)m(ou) g(to)h(pro)m(v)m(e)g(that)f(parallel-conditional)d(is)i(not)i (de\014nable)d(in)h(PCF.)0 3834 y(Use)21 b(Lemmas)f(2.5.21)i(and)e (2.5.24)j(to)e(sho)m(w)f(that)h(there)f(is)f(no)i(PCF)f(expression)27 b Fs(PIF)2921 3848 y Fj(nat)3057 3834 y Ft(:)e Fs(b)-5 b(o)g(ol)3281 3828 y Fr(!)3387 3834 y Fs(nat)3538 3828 y Fr(!)3644 3834 y Fs(nat)3796 3828 y Fr(!)3902 3834 y Fs(nat)0 3947 y Ft(suc)m(h)30 b(that)h(for)f(all)f(closed)i(b)s(o)s (olean)e(expressions)37 b Fn(M)10 b Ft(:)15 b Fs(b)-5 b(o)g(ol)50 b Ft(and)39 b Fn(N)5 b(;)15 b(P)s(;)g(Q)p Ft(:)g Fs(nat)48 b Ft(with)38 b Fn(Q)g Ft(in)29 b(normal)h(form,)508 4260 y Fs(PIF)676 4274 y Fj(nat)802 4260 y Fn(M)25 b(N)g(P)39 b Fr(!)-61 b(!)25 b Fn(Q)61 b Ft(i\013)1543 4067 y Fh(2)1543 4213 y(6)1543 4266 y(4)1640 4147 y Fn(M)35 b Fr(!)-61 b(!)25 b Fs(true)38 b Ft(and)29 b Fn(N)41 b Ft(has)30 b(normal)f(form)h Fn(Q)g Ft(or,)1640 4260 y Fn(M)35 b Fr(!)-61 b(!)25 b Fs(false)38 b Ft(and)30 b Fn(P)43 b Ft(has)30 b(normal)g(form)f Fn(Q)i Ft(or,)1640 4373 y Fn(N)5 b(;)15 b(P)43 b Ft(b)s(oth)30 b(ha)m(v)m(e)h(normal)f(form)g Fn(Q:)3336 4067 y Fh(3)3336 4213 y(7)3336 4266 y(5)0 4579 y Ft(\(If)k(w)m(e)g(extend)h(Lemmas)f(2.5.21)i(and)d(2.5.24)k(to)e (left-most)f(reduction,)g(the)g(same)h(pro)s(of)e(sho)m(ws)h(that)43 b Fs(PIF)3853 4593 y Fm(\033)0 4692 y Ft(is)29 b(not)i(de\014nable)e (for)h(an)m(y)h(t)m(yp)s(e)39 b Fn(\033)12 b Ft(.\))0 4903 y Fk(Exercise)35 b(2.5.27)47 b Ft(The)37 b(op)s(erational)h(equiv) -5 b(alence)37 b(relation)45 b(=)2314 4917 y Fm(op)2434 4903 y Ft(on)38 b(terms)g(is)f(de\014ned)f(in)h(Section)h(2.3.5.)0 5016 y(Sho)m(w)33 b(that)h(if)40 b Fn(M)52 b Ft(and)41 b Fn(N)51 b Ft(are)34 b(either)f(closed)g(terms)g(of)h(t)m(yp)s(e)42 b Fs(nat)50 b Ft(or)34 b(closed)f(terms)g(of)h(t)m(yp)s(e)41 b Fs(b)-5 b(o)g(ol)20 b Ft(,)34 b(neither)0 5129 y(ha)m(ving)c(a)h (normal)e(form,)h(then)39 b Fn(M)c Ft(=)1327 5143 y Fm(op)1426 5129 y Fn(N)18 b Ft(.)0 5340 y Fk(Exercise)35 b(2.5.28)47 b Ft(A)30 b(plausible)e(statemen)m(t)k(that)f(is)e(stronger)i(than)f (Lemma)h(2.5.24)h(is)e(this:)p eop %%Page: 113 64 113 63 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(113)227 91 y(Let)34 b Fr(C)5 b Ft([)15 b Fr(\001)g Fn(;)g(:)g(:)g(:)33 b(;)d Fr(\001)15 b Ft(])34 b(b)s(e)25 b(a)g(con)m(text)i(with)32 b Fn(k)37 b Ft(holes,)26 b(let)33 b Fn(M)2130 105 y Fp(1)2170 91 y Fn(;)15 b(:)g(:)g(:)h(;)f(M) 2459 106 y Fm(k)2536 91 y Ft(b)s(e)24 b(closed)h(terms)g(of)h(the)f (appro-)227 232 y(priate)i(t)m(yp)s(es)h(for)36 b Fr(C)41 b Ft(and)27 b(supp)s(ose)34 b Fr(C)5 b Ft([)p Fn(M)1646 246 y Fp(1)1686 232 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)1976 247 y Fm(k)2019 232 y Ft(])2069 177 y Fj(lazy)2071 232 y Fr(!)-61 b(!)27 b Fn(N)18 b Ft(,)28 b(where)36 b Fn(N)46 b Ft(do)s(es)27 b(not)h(further)e(reduce)227 345 y(b)m(y)d(lazy)f (reduction.)38 b(Then)21 b(either)31 b Fr(C)5 b Ft([)p Fn(M)1629 312 y Fi(0)1619 368 y Fp(1)1659 345 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)1958 312 y Fi(0)1948 372 y Fm(k)1992 345 y Ft(])31 b(reduces)22 b(to)32 b Fn(N)40 b Ft(for)23 b(all)e(closed)31 b Fn(M)3206 312 y Fi(0)3196 368 y Fp(1)3236 345 y Fn(;)15 b(:)g(:)g(:)h(;)f(M)3535 312 y Fi(0)3525 372 y Fm(k)3599 345 y Ft(of)227 458 y(the)21 b(appropriate)f(t)m(yp)s (es)g(or)h(there)g(is)e(some)i(in)m(teger)29 b Fn(i)h Ft(suc)m(h)20 b(that)h(for)f(all)g(closed)28 b Fn(M)3061 425 y Fi(0)3051 481 y Fp(1)3091 458 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)3391 425 y Fi(0)3381 485 y Fm(k)3453 458 y Ft(of)20 b(the)227 603 y(appropriate)30 b(t)m(yp)s(es)g(there)h(is)e(an)h(ev)-5 b(aluation)30 b(con)m(text)41 b Fb(ev)p Ft([)31 b(])39 b(with)e Fr(C)5 b Ft([)p Fn(M)2795 570 y Fi(0)2785 626 y Fp(1)2825 603 y Fn(;)15 b(:)g(:)g(:)i(;)e(M)3125 570 y Fi(0)3115 629 y Fm(k)3158 603 y Ft(])3208 547 y Fj(lazy)3210 603 y Fr(!)-61 b(!)27 b Fb(ev)p Ft([)p Fn(M)3588 570 y Fi(0)3578 627 y Fm(i)3612 603 y Ft(])8 b(.)0 790 y(The)28 b(only)f(di\013erence)h(is)g(that)h(w)m(e)g(do)f(not)g(require)36 b Fn(N)46 b Ft(to)30 b(b)s(e)d(in)g(normal)h(form.)39 b(Sho)m(w)28 b(that)h(this)f(statemen)m(t)i(is)0 903 y Fs(false)j Ft(b)m(y)25 b(giving)f(a)h(coun)m(terexample.)40 b(This)23 b(ma)m(y)j(b)s(e)e(done)h(using)f(a)i(con)m(text)35 b Fr(C)5 b Ft([)26 b(])33 b(with)24 b(only)h(one)g(placeholder.)0 1116 y Fk(Exercise)35 b(2.5.29)47 b Ft([Sto91a)r(])20 b(This)f(problem)g(asks)h(y)m(ou)g(to)h(sho)m(w)g(that)g(parallel-or,)g (b)s(o)s(olean)e(parallel-conditional)0 1229 y(and)35 b(natural-n)m(um)m(b)s(er)e(parallel-conditional)f(are)k(all)f(in)m (terde\014nable.)53 b(P)m(arallel-or)35 b(is)f(de\014ned)h(in)f(the)h (state-)0 1342 y(men)m(t)26 b(of)g(Theorem)g(2.5.19)i(and)d (parallel-conditional)e(is)i(de\014ned)f(in)h(Exercise)g(2.5.26.)42 b(An)25 b(in)m(termediate)h(step)0 1455 y(in)m(v)m(olv)m(es)k (parallel-and,)f(de\014ned)g(b)s(elo)m(w.)66 1642 y(\(a\))46 b(Sho)m(w)30 b(ho)m(w)h(to)g(de\014ne)e Fs(POR)34 b Ft(from)k Fs(PIF)1653 1657 y Fj(b)l(o)l(ol)1819 1642 y Ft(b)m(y)30 b(writing)f(a)h(PCF)h(expression)e(con)m(taining)38 b Fs(PIF)3608 1657 y Fj(b)l(o)l(ol)3744 1642 y Ft(.)61 1830 y(\(b\))45 b(Sho)m(w)30 b(ho)m(w)h(to)g(de\014ne)38 b Fs(PIF)1207 1845 y Fj(b)l(o)l(ol)1373 1830 y Ft(from)g Fs(PIF)1764 1844 y Fj(nat)1913 1830 y Ft(using)29 b(an)h(expression)f (of)i(the)g(form)1111 2034 y Fn(\025x)p Ft(:)15 b Fs(b)-5 b(o)g(ol)12 b Fn(:)j(\025y)s Ft(:)g Fs(b)-5 b(o)g(ol)11 b Fn(:)16 b(\025z)t Ft(:)f Fs(b)-5 b(o)g(ol)11 b Fn(:)16 b Fs(Eq)8 b Ft(?)14 b(1)h(\()p Fs(PIF)2567 2048 y Fj(nat)2692 2034 y Fn(x)g(M)26 b(N)10 b Ft(\))p Fn(:)71 2276 y Ft(\(c\))46 b(P)m(arallel-and,)30 b Fs(P)-7 b(AND,)28 b Ft(has)i(the)h(follo)m (wing)e(b)s(eha)m(vior:)718 2595 y Fs(P)-7 b(AND)22 b Fn(M)j(N)36 b Fr(!)-61 b(!)1368 2398 y Fh(8)1368 2473 y(>)1368 2498 y(<)1368 2647 y(>)1368 2672 y(:)1483 2482 y Fs(true)544 b Ft(if)29 b Fn(M)35 b Fr(!)-61 b(!)26 b Fs(true)37 b Ft(and)30 b Fn(N)35 b Fr(!)-61 b(!)26 b Fs(true)7 b Fn(;)1483 2595 y Fs(false)527 b Ft(if)29 b Fn(M)35 b Fr(!)-61 b(!)26 b Fs(false)38 b Ft(or)30 b Fn(N)35 b Fr(!)-61 b(!)26 b Fs(false)7 b Fn(;)1483 2708 y Ft(no)31 b(normal)e(form)83 b(otherwise.)227 2909 y(Sho)m(w)30 b(ho)m(w)h(to)g(de\014ne)e Fs(P)-7 b(AND)38 b Ft(from)g Fs(POR)k Ft(b)m(y)30 b(writing)e(a)j(PCF)f(expression)f (con)m(taining)39 b Fs(POR)11 b Ft(.)61 3097 y(\(d\))45 b(Sho)m(w)30 b(ho)m(w)h(to)g(de\014ne)38 b Fs(PIF)1207 3111 y Fj(nat)1356 3097 y Ft(from)g Fs(POR)k Ft(using)29 b(an)h(expression)f(of)i(the)f(form)1406 3301 y Fn(\025x)p Ft(:)15 b Fs(b)-5 b(o)g(ol)12 b Fn(:)j(\025y)s Ft(:)g Fs(nat)10 b Fn(:)15 b(\025z)t Ft(:)g Fs(nat)c Fn(:)k Fs(se)-5 b(ar)g(ch)24 b Fn(P)227 3506 y Ft(where)52 b Fn(P)13 b Ft(:)i Fs(nat)775 3500 y Fr(!)881 3506 y Fs(b)-5 b(o)g(ol)63 b Ft(has)52 b Fn(x;)15 b(y)s(;)g(z)57 b Ft(free)43 b(and)h(con)m(tains)g Fs(POR,)f(P)-7 b(AND,)42 b Ft(and)51 b Fs(Eq)8 b Ft(?)g(.)81 b(The)43 b(essen)m(tial)227 3618 y(prop)s(erties)29 b(of)39 b Fs(se)-5 b(ar)g(ch)47 b Ft(are)31 b(summarized)e(in)g(Prop)s(osition)f(2.5.3)k(on)f(page)g(95.) p eop %%Page: 114 65 114 64 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(114)0 91 y Fu(2.6)135 b(V)-11 b(ariations)46 b(and)f(Extensions)h(of)f(PCF)0 298 y Fo(2.6.1)112 b(Summary)38 b(of)f(extensions)0 469 y Ft(This)31 b(section)j(brie\015y)d (summarizes)h(sev)m(eral)i(imp)s(ortan)m(t)e(extensions)h(of)g(PCF.)g (All)f(are)i(obtained)e(b)m(y)h(adding)0 582 y(new)26 b(t)m(yp)s(es.)39 b(The)26 b(\014rst)f(extension)h(is)f(a)i(v)m(ery)f (simple)e(one,)k(a)e(t)m(yp)s(e)35 b Fs(unit)43 b Ft(with)25 b(only)g(one)h(elemen)m(t.)40 b(The)26 b(second)0 695 y(extension)36 b(is)f Fs(sum,)j Ft(or)e(disjoin)m(t)f(union,)h(t)m(yp)s (es.)58 b(With)36 b(unit)e(and)i(disjoin)m(t)e(unions,)i(w)m(e)h(can)f (de\014ne)44 b Fs(b)-5 b(o)g(ol)56 b Ft(as)0 808 y(the)36 b(disjoin)m(t)d(union)h(of)44 b Fs(unit)52 b Ft(and)43 b Fs(unit)17 b Ft(.)56 b(This)33 b(mak)m(es)k(the)e(primitiv)m(e)f(t)m (yp)s(e)43 b Fs(b)-5 b(o)g(ol)55 b Ft(unnecessary)-8 b(.)56 b(The)35 b(next)0 921 y(extension)26 b(is)f(recursiv)m(e)g(t)m (yp)s(e)h(de\014nitions.)37 b(With)26 b(recursiv)m(e)f(t)m(yp)s(e)i (de\014nitions,)33 b Fs(unit)42 b Ft(and)26 b(sum)f(t)m(yp)s(es,)i(w)m (e)g(can)0 1034 y(de\014ne)39 b Fs(nat)49 b Ft(and)31 b(its)f(op)s(erations,)h(making)g(the)h(primitiv)m(e)d(t)m(yp)s(e)40 b Fs(nat)49 b Ft(also)31 b(unnecessary)-8 b(.)43 b(Other)31 b(commonly-)0 1147 y(used)h(t)m(yp)s(es)h(that)h(ha)m(v)m(e)g(straigh)m (tforw)m(ard)e(recursiv)m(e)h(de\014nitions)d(are)k(stac)m(ks,)h(lists) c(and)h(trees.)49 b(Another)33 b(use)0 1260 y(of)e(recursiv)m(e)f(t)m (yp)s(es)h(is)f(that)i(w)m(e)f(can)g(de\014ne)f(the)h(\014xed-p)s(oin)m (t)f(op)s(erator)39 b Fs(\014x)51 b Ft(on)31 b(an)m(y)g(t)m(yp)s(e.)42 b(Th)m(us)30 b(with)38 b Fs(unit)17 b Ft(,)0 1372 y(sums)29 b(and)h(recursiv)m(e)g(t)m(yp)s(es,)h(w)m(e)f(ma)m(y)h(de\014ne)f(all)f (of)i(the)f(t)m(yp)s(e)h(and)f(term)g(constan)m(ts)i(of)e(PCF.)141 1485 y(The)42 b(\014nal)f(language)i(is)e(a)i(v)-5 b(arian)m(t)42 b(of)h(PCF)f(with)f(lifted)g(t)m(yp)s(es,)k(whic)m(h)c(giv)m(e)i(us)f (a)g(di\013eren)m(t)g(view)g(of)0 1598 y(non)m(termination.)55 b(With)35 b(lifted)f(t)m(yp)s(es,)j(written)e(in)f(the)i(form)43 b Fn(\033)2319 1613 y Fi(?)2387 1598 y Ft(,)37 b(w)m(e)f(can)g (distinguish)31 b(b)s(et)m(w)m(een)37 b(natural-)0 1711 y(n)m(um)m(b)s(er)j(expressions)h(that)h(necessarily)e(ha)m(v)m(e)j(a)f (normal)f(form)g(and)g(those)h(that)g(ma)m(y)g(not.)75 b(Sp)s(eci\014cally)-8 b(,)0 1824 y(natural-n)m(um)m(b)s(er)35 b(terms)h(that)i(do)e(not)h(in)m(v)m(olv)m(e)46 b Fs(\014x)56 b Ft(ma)m(y)37 b(ha)m(v)m(e)h(t)m(yp)s(e)45 b Fs(nat)18 b Ft(,)38 b(while)d(terms)i(that)g(in)m(v)m(olv)m(e)45 b Fs(\014x)20 b Ft(,)0 1937 y(and)30 b(therefore)h(ma)m(y)g(not)f(ha)m (v)m(e)i(a)f(normal)e(form,)h(ha)m(v)m(e)i(the)e(lifted)f(t)m(yp)s(e)39 b Fs(nat)2702 1952 y Fi(?)2769 1937 y Ft(.)i(Th)m(us)29 b(the)i(t)m(yp)s(e)39 b Fs(nat)48 b Ft(of)30 b(PCF)0 2050 y(corresp)s(onds)f(to)h(t)m(yp)s(e)39 b Fs(nat)958 2065 y Fi(?)1055 2050 y Ft(in)29 b(this)g(language.)41 b(The)29 b(syn)m(tax)i(of)f(man)m(y)g(common)g(programs)g(b)s(ecomes)g (more)0 2163 y(complicated,)h(since)f(the)h(distinction)d(b)s(et)m(w)m (een)k(lifted)d(and)h(unlifted)f(t)m(yp)s(es)i(forces)g(us)f(to)h (include)e(additional)0 2276 y(lifting)24 b(op)s(erations)h(in)f (terms.)39 b(Ho)m(w)m(ev)m(er,)29 b(the)d(re\014nemen)m(t)g(ac)m(hiev)m (ed)g(with)f(lifted)f(t)m(yp)s(es)i(has)f(some)i(theoretical)0 2389 y(adv)-5 b(an)m(tages.)42 b(One)30 b(is)e(that)j(man)m(y)f(more)f (equational)h(or)f(reduction)g(axioms)h(b)s(ecome)g(consisten)m(t)g (with)e(recur-)0 2502 y(sion.)39 b(Another)29 b(is)f(that)h(w)m(e)g(ma) m(y)g(study)f(di\013eren)m(t)g(ev)-5 b(aluation)29 b(orders)f(within)e (a)j(single)e(framew)m(ork.)41 b(F)-8 b(or)29 b(this)0 2614 y(reason,)i(explicit)e(lifting)f(seems)i(useful)f(in)g (meta-languages)j(for)e(studying)f(other)h(programming)f(languages.)141 2727 y(All)22 b(of)i(the)f(extensions)g(summarized)f(here)h(ma)m(y)h(b) s(e)e(com)m(bined)h(with)f(p)s(olymorphism,)f(treated)k(in)d(Chapter)0 2840 y(9)31 b(and)f(other)g(t)m(yping)g(ideas)g(in)f(Chapters)g(10)j (and)d(11.)0 3084 y Fo(2.6.2)112 b(Unit)37 b(and)h(sum)g(t)m(yp)s(es)0 3255 y Ft(W)-8 b(e)35 b(add)e(the)g(one-elemen)m(t)i(t)m(yp)s(e)42 b Fs(unit)50 b Ft(to)35 b(PCF,)e(or)h(an)m(y)g(language)g(based)f(on)g (t)m(yp)s(ed)h(lam)m(b)s(da)e(calculus,)h(b)m(y)0 3368 y(adding)39 b Fs(unit)50 b Ft(to)33 b(the)g(t)m(yp)s(e)f(expressions)f (and)h(adding)f(the)i(constan)m(t)42 b Fr(\003)p Ft(:)15 b Fs(unit)50 b Ft(to)33 b(the)g(syn)m(tax)g(of)g(terms.)46 b(The)0 3481 y(equational)30 b(axiom)g(for)39 b Fr(\003)g Ft(is)1714 3594 y Fn(M)c Ft(=)25 b Fr(\003)p Ft(:)15 b Fs(unit)0 3761 y Ft(for)33 b(an)m(y)h(term)42 b Fn(M)10 b Ft(:)15 b Fs(unit)i Ft(.)50 b(In)m(tuitiv)m(ely)-8 b(,)34 b(this)e(axiom)i(sa)m(ys)g(that)g(ev)m(ery)g(elemen)m(t)g(of)g (t)m(yp)s(e)42 b Fs(unit)50 b Ft(is)32 b(equal)h(to)43 b Fr(\003)8 b Ft(.)0 3874 y(This)25 b(ma)m(y)i(b)s(e)f(used)g(as)g(a)h (reduction)f(rule,)g(read)h(left)f(to)h(righ)m(t.)39 b(While)34 b Fs(unit)43 b Ft(ma)m(y)28 b(not)e(seem)h(v)m(ery)g(in)m (teresting,)0 3987 y(it)j(is)f(surprisingly)d(useful)j(in)g(com)m (bination)h(with)f(sums)g(and)h(other)g(forms)g(of)h(t)m(yp)s(es.)141 4100 y(It)j(should)d(b)s(e)i(men)m(tioned)f(that)i(the)g(reduction)e (rule)g(for)41 b Fs(unit)51 b Ft(terms)33 b(causes)h(con\015uence)f(to) h(fail,)f(when)0 4213 y(com)m(bined)27 b(with)35 b Fn(\021)12 b Ft(-reduction)27 b([CD91)r(,)h(LS86].)40 b(This)27 b(do)s(es)g(not)i(ha)m(v)m(e)g(an)f(immediate)f(consequence)i(for)f (PCF,)0 4326 y(since)i(w)m(e)h(do)f(not)g(use)39 b Fn(\021)12 b Ft(-reduction.)141 4438 y(In)m(tuitiv)m(ely)-8 b(,)30 b(the)g Fs(sum)j(typ)-5 b(e)46 b Fn(\033)23 b Ft(+)d Fn(\034)48 b Ft(is)30 b(the)g(disjoin)m(t)f(union)f(of)j(t)m(yp)s(es)38 b Fn(\033)k Ft(and)c Fn(\034)18 b Ft(.)41 b(The)30 b(di\013erence)f(b)s (et)m(w)m(een)0 4551 y(a)f(disjoin)m(t)e(union)g(and)h(an)g(ordinary)f (set)i(union)e(is)h(that)h(with)e(a)i(disjoin)m(t)e(union,)h(w)m(e)h (can)g(tell)e(whic)m(h)h(t)m(yp)s(e)h(an)m(y)0 4664 y(elemen)m(t)36 b(comes)g(from.)55 b(This)33 b(is)i(particularly)d(noticeable)k(when)e (the)h(t)m(w)m(o)i(t)m(yp)s(es)e(o)m(v)m(erlap)h(or)f(are)h(iden)m (tical.)0 4777 y(F)-8 b(or)38 b(example,)h(if)d(w)m(e)i(tak)m(e)h(the)e (set)h(union)d(of)46 b Fs(int)54 b Ft(and)45 b Fs(int)17 b Ft(,)40 b(w)m(e)d(just)g(get)47 b Fs(int)17 b Ft(.)61 b(In)37 b(con)m(trast,)j(the)e(disjoin)m(t)0 4890 y(union)25 b(of)35 b Fs(int)44 b Ft(and)34 b Fs(int)44 b Ft(has)26 b(t)m(w)m(o)i(\\copies")g(of)35 b Fs(int)17 b Ft(.)40 b(Informally)-8 b(,)26 b(w)m(e)h(think)e(of)i(the)g(sum)f(t)m(yp)s(e)35 b Fs(int)21 b Ft(+)13 b Fs(int)44 b Ft(as)27 b(the)0 5003 y(collection)h(of)g(\\tagged")j(in)m(tegers,)e(with)e(eac)m(h)j (tag)f(indicating)d(whether)i(the)g(in)m(teger)h(comes)g(from)f(the)g (left)g(or)0 5116 y(righ)m(t)38 b Fs(int)48 b Ft(in)29 b(the)h(sum.)p eop %%Page: 115 66 115 65 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(115)141 91 y(The)28 b(term)h(forms)e(asso)s (ciated)i(with)e(sums)h(are)h(injection)e(and)h(case)h(functions.)39 b(F)-8 b(or)29 b(an)m(y)g(t)m(yp)s(es)36 b Fn(\033)k Ft(and)c Fn(\034)19 b Ft(,)0 204 y(the)31 b(injection)e(functions)37 b Fk(Inleft)1175 167 y Fm(\033)n(;\034)1315 204 y Ft(and)h Fk(Inrigh)m(t)1818 167 y Fm(\033)n(;\034)1959 204 y Ft(ha)m(v)m(e)31 b(t)m(yp)s(es)1438 396 y Fk(Inleft)1685 360 y Fm(\033)n(;\034)1941 396 y Ft(:)83 b Fn(\033)28 b Fr(!)e Fn(\033)d Ft(+)d Fn(\034)1438 568 y Fk(Inrigh)m(t)1756 531 y Fm(\033)n(;\034)1941 568 y Ft(:)83 b Fn(\034)35 b Fr(!)25 b Fn(\033)f Ft(+)c Fn(\034)0 760 y Ft(In)m(tuitiv)m(ely)-8 b(,)27 b(the)h(injection)e (functions)g(map)35 b Fn(\033)k Ft(or)d Fn(\034)45 b Ft(to)37 b Fn(\033)17 b Ft(+)d Fn(\034)45 b Ft(b)m(y)28 b(\\tagging")h(elemen)m(ts.)40 b(Ho)m(w)m(ev)m(er,)30 b(since)d(the)0 873 y(op)s(erations)h(on)i(tags)g(are)f(encapsulated)g (in)f(the)h(injection)f(and)h(case)h(functions,)e(w)m(e)i(nev)m(er)f (sa)m(y)h(exactly)g(what)0 986 y(the)h(tags)g(actually)f(are.)141 1099 y(The)49 b Fk(Case)54 b Ft(function)40 b(applies)g(one)h(of)h(t)m (w)m(o)h(functions)d(to)i(an)g(elemen)m(t)g(of)f(a)h(sum)f(t)m(yp)s(e.) 74 b(The)41 b(c)m(hoice)0 1212 y(b)s(et)m(w)m(een)35 b(functions)e(dep)s(ends)g(on)h(whic)m(h)f(t)m(yp)s(e)i(of)f(the)h(sum) e(the)i(elemen)m(t)g(comes)g(from.)52 b(F)-8 b(or)35 b(all)f(t)m(yp)s(es)42 b Fn(\033)n(;)15 b(\034)0 1325 y Ft(and)38 b Fn(\032)8 b Ft(,)31 b(the)f(case)i(function)37 b Fk(Case)1225 1289 y Fm(\033)n(;\034)t(;\032)1417 1325 y Ft(has)30 b(t)m(yp)s(e)999 1525 y Fk(Case)1215 1489 y Fm(\033)n(;\034)t(;\032)1451 1525 y Ft(:)83 b(\()p Fn(\033)24 b Ft(+)c Fn(\034)10 b Ft(\))26 b Fr(!)f Ft(\()p Fn(\033)2094 1519 y Fr(!)2200 1525 y Fn(\032)p Ft(\))g Fr(!)g Ft(\()p Fn(\034)2524 1519 y Fr(!)2630 1525 y Fn(\032)p Ft(\))h Fr(!)f Fn(\032)0 1725 y Ft(In)m(tuitiv)m(ely)-8 b(,)40 b Fk(Case)686 1689 y Fm(\033)n(;\034)t(;\032)854 1725 y Fn(x)15 b(f)25 b(g)44 b Ft(insp)s(ects)31 b(the)i(tag)g(on)41 b Fn(x)f Ft(and)32 b(applies)39 b Fn(f)50 b Ft(if)40 b Fn(x)g Ft(is)31 b(from)41 b Fn(\033)i Ft(and)e Fn(g)j Ft(if)39 b Fn(x)i Ft(is)31 b(from)0 1838 y Fn(\034)18 b Ft(.)41 b(The)30 b(main)f(equational)h(axioms)g(are)1242 2030 y Fk(Case)1458 1994 y Fm(\033)n(;\034)t(;\032)1626 2030 y Ft(\()p Fk(Inleft)1909 1993 y Fm(\033)n(;\034)2026 2030 y Fn(x)p Ft(\))15 b Fn(f)24 b(g)158 b Ft(=)82 b Fn(f)10 b(x)1242 2143 y Fk(Case)1458 2107 y Fm(\033)n(;\034)t(;\032) 1626 2143 y Ft(\()p Fk(Inrigh)m(t)1980 2106 y Fm(\033)n(;\034)2096 2143 y Fn(x)p Ft(\))15 b Fn(f)25 b(g)87 b Ft(=)82 b Fn(g)s(x)0 2335 y Ft(Both)28 b(of)f(these)h(giv)m(e)g(us)e(reduction)h(axioms,)g (read)h(left)f(to)h(righ)m(t.)39 b(There)27 b(is)f(also)h(an)g (extensionalit)m(y)g(axiom)g(for)0 2448 y(sum)i(t)m(yp)s(es,)958 2561 y Fk(Case)1173 2524 y Fm(\033)n(;\034)t(;\032)1342 2561 y Fn(x)15 b Ft(\()p Fn(f)30 b Fr(\016)20 b Fk(Inleft)1832 2524 y Fm(\033)n(;\034)1933 2561 y Ft(\))15 b(\()p Fn(f)30 b Fr(\016)21 b Fk(Inrigh)m(t)2477 2524 y Fm(\033)n(;\034)2579 2561 y Ft(\))55 b(=)h Fn(f)24 b(x;)0 2726 y Ft(where)45 b Fn(f)10 b Ft(:)15 b(\()p Fn(\033)28 b Ft(+)c Fn(\034)10 b Ft(\))683 2720 y Fr(!)775 2726 y Ft(\()p Fn(\033)28 b Ft(+)c Fn(\034)10 b Ft(\))e(.)62 b(Some)37 b(consequences)g(of)h (this)d(axiom)i(are)h(giv)m(en)f(in)f(Exercise)g(2.6.3.)63 b(Since)0 2839 y(the)37 b(extensionalit)m(y)g(axiom)g(leads)g(to)h (inconsistency)-8 b(,)38 b(when)e(com)m(bined)h(with)f Fs(\014x,)j Ft(w)m(e)e(do)h(not)f(include)e(this)0 2952 y(equational)f(axiom)g(in)e(the)j(extension)e(of)i(PCF)f(with)f(sum)g (t)m(yp)s(es)h(\(see)h(Exercise)f(2.6.4\).)54 b(W)-8 b(e)35 b(will)d(drop)h(the)0 3065 y(t)m(yp)s(e)26 b(sup)s(erscripts)d (from)i(injection)g(and)g(case)i(functions)d(when)h(the)h(t)m(yp)s(e)g (is)e(either)i(irrelev)-5 b(an)m(t)25 b(or)g(determined)0 3177 y(b)m(y)30 b(con)m(text.)141 3290 y(As)e(an)f(illustration)d(of)36 b Fs(unit)44 b Ft(and)27 b(sum)g(t)m(yp)s(es,)h(w)m(e)g(will)d(sho)m(w) i(ho)m(w)36 b Fs(b)-5 b(o)g(ol)46 b Ft(ma)m(y)28 b(b)s(e)f(eliminated)f (if)34 b Fs(unit)45 b Ft(and)0 3403 y(sum)29 b(t)m(yp)s(es)i(are)g (added)e(to)i(PCF.)g(W)-8 b(e)31 b(de\014ne)38 b Fs(b)-5 b(o)g(ol)50 b Ft(b)m(y)1510 3626 y Fs(b)-5 b(o)g(ol)1754 3571 y Fj(def)1772 3626 y Ft(=)102 b Fs(unit)29 b Ft(+)20 b Fs(unit)0 3826 y Ft(and)30 b(b)s(o)s(olean)f(v)-5 b(alues)38 b Fs(true)46 b Ft(and)38 b Fs(false)46 b Ft(b)m(y)1531 4049 y Fs(true)1798 3994 y Fj(def)1815 4049 y Ft(=)100 b Fk(Inleft)19 b Fr(\003)1531 4193 y Fs(false)1798 4138 y Fj(def)1815 4193 y Ft(=)100 b Fk(Inrigh)m(t)19 b Fr(\003)0 4385 y Ft(The)28 b(remaining)f(basic)h(b)s(o)s(olean)g(expression)g(is) g(conditional,)36 b Fl(if)62 b Fn(:)15 b(:)g(:)64 b Fl(then)e Fn(:)15 b(:)g(:)64 b Fl(else)d Fn(:)15 b(:)g(:)10 b Ft(.)40 b(W)-8 b(e)30 b(ma)m(y)f(con-)0 4498 y(sider)g(this)g(sugar)h(for)39 b Fk(Case)12 b Ft(,)30 b(as)h(follo)m(ws:)551 4721 y Fl(if)47 b Fn(M)58 b Fl(then)46 b Fn(N)58 b Fl(else)47 b Fn(P)1604 4666 y Fj(def)1622 4721 y Ft(=)103 b Fk(Case)2011 4684 y Fj(unit)6 b Fm(;)p Fj(unit)g Fm(;\032)2366 4721 y Fn(M)25 b Ft(\()p Fn(K)2591 4735 y Fm(\032;)p Fj(unit)2782 4721 y Fn(N)10 b Ft(\))15 b(\()p Fn(K)3027 4735 y Fm(\032;)p Fj(unit)3218 4721 y Fn(P)e Ft(\))p Fn(;)0 4921 y Ft(where)37 b Fn(N)5 b(;)15 b(P)e Ft(:)i Fn(\032)38 b Ft(and)e Fn(K)844 4935 y Fm(\032;)p Fj(unit)1072 4921 y Ft(is)28 b(the)h(lam)m(b)s(da)f (term)37 b Fn(\025x)p Ft(:)15 b Fn(\032:)h(\025y)s Ft(:)f Fs(unit)9 b Fn(:)15 b(x)37 b Ft(that)30 b(pro)s(duces)d(a)j(constan)m (t)g(function.)0 5034 y(T)-8 b(o)31 b(sho)m(w)f(that)h(this)e(w)m (orks,)i(w)m(e)g(m)m(ust)f(c)m(hec)m(k)i(the)f(t)m(w)m(o)g(equational)f (axioms)g(for)g(conditional:)1232 5226 y Fl(if)47 b Fs(true)55 b Fl(then)47 b Fn(M)58 b Fl(else)46 b Fn(N)111 b Ft(=)82 b Fn(M)5 b(;)1232 5339 y Fl(if)47 b Fs(false)56 b Fl(then)46 b Fn(M)58 b Fl(else)47 b Fn(N)93 b Ft(=)82 b Fn(N)5 b(:)p eop %%Page: 116 67 116 66 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(116)0 91 y(The)27 b(reader)g(ma)m(y)h(easily)e(v)m (erify)h(that)h(when)e(w)m(e)i(eliminate)e(syn)m(tactic)i(sugar,)g(the) g(\014rst)e(equational)h(axiom)g(for)0 204 y Fk(Case)40 b Ft(yields)34 b Fl(if)47 b Fs(true)55 b Fl(then)47 b Fn(M)57 b Fl(else)47 b Fn(N)35 b Ft(=)25 b Fn(K)1778 218 y Fm(\032;)p Fj(unit)1968 204 y Fn(M)h Fr(\003)f Ft(=)g Fn(M)19 b Ft(,)28 b(and)g(similarly)c(for)k(the)g(second)g (equation.)141 317 y(Other)j(uses)f(of)h(sum)f(t)m(yp)s(es)h(include)e Fs(variants)40 b Ft(and)30 b Fs(enumer)-5 b(ation)35 b(typ)-5 b(es,)32 b Ft(considered)e(in)g(Exercises)g(2.6.1)0 430 y(and)g(2.6.2.)0 642 y Fk(Exercise)35 b(2.6.1)47 b Ft(A)39 b Fs(variant)j(typ)-5 b(e)47 b Ft(is)38 b(a)h(form)g(of)g (lab)s(eled)e(sum,)k(b)s(earing)d(the)h(same)h(relationship)c(to)k(sum) 0 755 y(t)m(yp)s(es)30 b(as)h(records)f(do)g(to)h(pro)s(duct)e(t)m(yp)s (es.)41 b(A)30 b(v)-5 b(arian)m(t)30 b(t)m(yp)s(e)h(de\014ning)d(a)j (sum)e(of)h(t)m(yp)s(es)39 b Fn(\033)3146 769 y Fp(1)3185 755 y Fn(;)15 b(:)g(:)g(:)i(;)e(\033)3439 770 y Fm(k)3521 755 y Ft(is)29 b(written)0 868 y([)p Fn(`)63 882 y Fp(1)103 868 y Ft(:)15 b Fn(\033)195 882 y Fp(1)234 868 y Fn(;)g(:)g(:)g(:)i(;)e (`)474 883 y Fm(k)517 868 y Ft(:)g Fn(\033)609 883 y Fm(k)652 868 y Ft(])8 b(,)30 b(where)38 b Fn(`)1049 882 y Fp(1)1088 868 y Fn(;)15 b(:)g(:)g(:)i(;)e(`)1328 883 y Fm(k)1408 868 y Ft(are)30 b(distinct)e(syn)m(tactic)j(lab)s(els.)39 b(As)29 b(for)g(records,)h(the)g(order)f(in)f(whic)m(h)0 981 y(w)m(e)35 b(write)f(the)h(lab)s(el/t)m(yp)s(e)e(pairs)g(do)s(es)h (not)h(matter.)54 b(F)-8 b(or)36 b(example,)44 b([)p Fn(A)p Ft(:)15 b Fs(int)9 b Fn(;)15 b(B)5 b Ft(:)15 b Fs(b)-5 b(o)g(ol)12 b Ft(])43 b(is)33 b(the)i(same)g(t)m(yp)s(e)g(as)0 1093 y([)p Fn(B)5 b Ft(:)15 b Fs(b)-5 b(o)g(ol)11 b Fn(;)k(A)p Ft(:)g Fs(int)10 b Ft(])e(.)141 1206 y(In)m(tuitiv)m(ely)-8 b(,)24 b(an)g(elemen)m(t)g(of)g(the)g(v)-5 b(arian)m(t)23 b(t)m(yp)s(e)32 b([)p Fn(`)1861 1220 y Fp(1)1901 1206 y Ft(:)15 b Fn(\033)1993 1220 y Fp(1)2033 1206 y Fn(;)g(:)g(:)g(:)h(;)f (`)2272 1221 y Fm(k)2315 1206 y Ft(:)g Fn(\033)2407 1221 y Fm(k)2450 1206 y Ft(])33 b(is)22 b(an)i(elemen)m(t)g(of)g(one)g(of)f (the)h(t)m(yp)s(es)32 b Fn(\033)3838 1220 y Fm(i)3875 1206 y Ft(,)0 1335 y(for)i(1)26 b Fr(\024)f Fn(i)h Fr(\024)f Fn(k)11 b Ft(,)27 b(tagged)h(with)e(lab)s(el)33 b Fn(`)1328 1349 y Fm(i)1364 1335 y Ft(.)39 b(More)27 b(precisely)-8 b(,)27 b(if)33 b Fn(M)10 b Ft(:)15 b Fn(\033)2323 1349 y Fm(i)2360 1335 y Ft(,)28 b(then)e(the)g(expression)34 b Fn(`)3249 1287 y Fp([)p Fm(`)3298 1296 y Fd(1)3332 1287 y Fp(:)p Fm(\033)3392 1296 y Fd(1)3426 1287 y Fm(;:::)o(;`)3554 1299 y Fc(k)3591 1287 y Fp(:)p Fm(\033)3651 1299 y Fc(k)3689 1287 y Fp(])3249 1361 y Fm(i)3713 1335 y Ft(\()p Fn(M)3836 1349 y Fm(i)3865 1335 y Ft(\))0 1448 y(is)29 b(an)i(expression)e(of)h (t)m(yp)s(e)39 b([)p Fn(`)1035 1462 y Fp(1)1075 1448 y Ft(:)15 b Fn(\033)1167 1462 y Fp(1)1207 1448 y Fn(;)g(:)g(:)g(:)h(;)f (`)1446 1463 y Fm(k)1489 1448 y Ft(:)g Fn(\033)1581 1463 y Fm(k)1624 1448 y Ft(])8 b(.)41 b(The)30 b(case)i(function)d(for)38 b([)p Fn(`)2669 1462 y Fp(1)2709 1448 y Ft(:)15 b Fn(\033)2801 1462 y Fp(1)2840 1448 y Fn(;)g(:)g(:)g(:)i(;)e(`)3080 1463 y Fm(k)3123 1448 y Ft(:)g Fn(\033)3215 1463 y Fm(k)3258 1448 y Ft(])39 b(has)30 b(t)m(yp)s(e)552 1652 y Fk(Case)767 1614 y Fp([)p Fm(`)816 1623 y Fd(1)850 1614 y Fp(:)p Fm(\033)910 1623 y Fd(1)945 1614 y Fm(;:::)n(;`)1072 1626 y Fc(k)1110 1614 y Fp(:)p Fm(\033)1170 1626 y Fc(k)1208 1614 y Fp(])p Fm(;)11 b(\032)1329 1652 y Ft(:)46 b([)p Fn(`)1463 1666 y Fp(1)1502 1652 y Ft(:)15 b Fn(\033)1594 1666 y Fp(1)1634 1652 y Fn(;)g(:)g(:)g(:)i(;)e(`)1874 1667 y Fm(k)1917 1652 y Ft(:)g Fn(\033)2009 1667 y Fm(k)2052 1652 y Ft(])2092 1646 y Fr(!)2183 1652 y Ft(\()p Fn(\033)2270 1666 y Fp(1)2325 1646 y Fr(!)2431 1652 y Fn(\032)p Ft(\))2528 1646 y Fr(!)2635 1652 y Fn(:)g(:)g(:)2756 1646 y Fr(!)2847 1652 y Ft(\()p Fn(\033)2934 1667 y Fm(k)2992 1646 y Fr(!)3098 1652 y Fn(\032)p Ft(\))3195 1646 y Fr(!)3301 1652 y Fn(\032)0 1855 y Ft(and)30 b(satis\014es)g(the)g(equation)1060 2058 y Fk(Case)1276 2021 y Fp([)p Fm(`)1325 2030 y Fd(1)1359 2021 y Fp(:)p Fm(\033)1419 2030 y Fd(1)1453 2021 y Fm(;:::)o(;`)1581 2033 y Fc(k)1618 2021 y Fp(:)p Fm(\033)1678 2033 y Fc(k)1716 2021 y Fp(])p Fm(;)11 b(\032)1823 2058 y Fn(`)1861 2072 y Fm(i)1889 2058 y Ft(\()p Fn(M)2012 2072 y Fm(i)2040 2058 y Ft(\))k Fn(f)2135 2072 y Fp(1)2205 2058 y Fn(:)g(:)g(:)31 b(f)2386 2073 y Fm(k)2484 2058 y Ft(=)55 b Fn(f)2655 2072 y Fm(i)2698 2058 y Fn(M)2786 2072 y Fm(i)2815 2058 y Fn(:)0 2262 y Ft(\(Although)30 b(the)h(lab)s(el/t)m(yp)s(e)f(pairs)g (are)h(unordered)e(in)38 b([)p Fn(`)2018 2276 y Fp(1)2058 2262 y Ft(:)15 b Fn(\033)2150 2276 y Fp(1)2190 2262 y Fn(;)g(:)g(:)g(:)h(;)f(`)2429 2277 y Fm(k)2472 2262 y Ft(:)g Fn(\033)2564 2277 y Fm(k)2607 2262 y Ft(])8 b(,)32 b(the)f(order)f(of)h(argumen)m(ts)h(clearly)0 2375 y(matters)23 b(for)31 b Fk(Case)681 2339 y Fp([)p Fm(`)730 2348 y Fd(1)764 2339 y Fp(:)p Fm(\033)824 2348 y Fd(1)859 2339 y Fm(;:::)n(;`)986 2351 y Fc(k)1024 2339 y Fp(:)p Fm(\033)1084 2351 y Fc(k)1122 2339 y Fp(])p Fm(;)11 b(\032)1221 2375 y Ft(.\))39 b(F)-8 b(ollo)m(wing)22 b(the)g(pattern)h(w)m(e)g(use)f(to) h(treat)h(records)e(as)h(sugar)f(for)g(pro)s(ducts)0 2488 y(\(see)44 b(Section)f(2.5.1\),)49 b(sho)m(w)43 b(ho)m(w)g(to)h(treat)h(v)-5 b(arian)m(ts)43 b(as)g(syn)m(tactic)i (sugar)e(for)g(sums.)78 b(Illustrate)42 b(this)g(b)m(y)0 2601 y(translating)24 b(an)h(expression)f(con)m(taining)g(o)s (ccurrences)h(of)g(t)m(w)m(o)i(di\013eren)m(t)d(v)-5 b(arian)m(t)25 b(t)m(yp)s(es)g(in)m(to)g(PCF)g(with)f(sums.)0 2812 y Fk(Exercise)35 b(2.6.2)47 b Fs(Enumer)-5 b(ation)25 b(typ)-5 b(es)30 b Ft(app)s(ear)20 b(in)g(P)m(ascal)i(and)e(some)h (subsequen)m(t)g(programming)e(languages.)0 2925 y(The)32 b(elemen)m(ts)h(of)g(an)g(en)m(umeration)f(t)m(yp)s(e)42 b(\()p Fn(`)1612 2939 y Fp(1)1651 2925 y Fn(;)15 b(:)g(:)g(:)i(;)e(`) 1891 2939 y Fm(n)1938 2925 y Ft(\))42 b(are)33 b(the)g(literals)39 b Fn(`)2675 2939 y Fp(1)2715 2925 y Fn(;)15 b(:)g(:)g(:)h(;)f(`)2954 2939 y Fm(n)3010 2925 y Ft(,)33 b(whic)m(h)f(are)h(considered)0 3038 y(distinct)43 b(v)-5 b(alues)44 b(not)h(equal)f(to)i(an)m(y)f(v)-5 b(alues)44 b(of)g(an)m(y)h(other)g(t)m(yp)s(e.)84 b(\(W)-8 b(e)46 b(do)f(not)g(consider)e(subranges)h(or)0 3151 y(subt)m(yp)s(es)37 b(of)h(en)m(umeration)g(t)m(yp)s(es)g(here.\))65 b(Sho)m(w)37 b(ho)m(w)i(to)f(regard)h(the)f(en)m(umeration)g(t)m(yp)s (e)46 b(\()p Fn(`)3410 3165 y Fp(1)3450 3151 y Fn(;)15 b(:)g(:)g(:)i(;)e(`)3690 3165 y Fm(n)3737 3151 y Ft(\))47 b(as)0 3264 y(syn)m(tactic)30 b(sugar)f(for)h(the)f(v)-5 b(arian)m(t)38 b([)p Fn(`)1298 3278 y Fp(1)1337 3264 y Ft(:)15 b Fs(unit)9 b Fn(;)15 b(:)g(:)g(:)i(;)e(`)1784 3279 y Fm(k)1827 3264 y Ft(:)g Fs(unit)9 b Ft(])38 b(and)28 b(illustrate)g(y)m(our)h(tec)m(hnique)g(b)m(y)g(sho)m(wing)g(ho)m(w)0 3377 y(to)37 b(translate)f(an)g(expression)e(con)m(taining)i(en)m (umeration)f(t)m(yp)s(es)h(and)f(literals)g(in)m(to)h(a)g(PCF)g (expression)e(with)0 3490 y Fs(unit)47 b Ft(and)30 b(v)-5 b(arian)m(ts.)0 3702 y Fk(Exercise)35 b(2.6.3)47 b Ft(Pro)m(v)m(e)28 b(the)f(follo)m(wing)f(consequences)i(of)f(the)h(extensionalit)m(y)e (axiom)h(for)g(sum)f(t)m(yp)s(es,)i(using)0 3815 y(the)j(equational)e (axioms)i(and)e(inference)h(rules)f(of)h(PCF)h(as)f(needed.)66 4002 y(\(a\))55 b Fk(Case)18 b Fn(x)d Fk(Inleft)k(Inrigh)m(t)60 b Ft(=)55 b Fn(x)8 b Ft(.)61 4189 y(\(b\))54 b Fn(f)10 b Ft(\()p Fk(Case)18 b Fn(x)d Ft(\()p Fn(g)24 b Fr(\016)d Fk(Inleft)s Ft(\))15 b(\()p Fn(g)25 b Fr(\016)c Fk(Inrigh)m(t)t Ft(\)\))56 b(=)f Fk(Case)19 b Fn(x)c Ft(\()p Fn(f)30 b Fr(\016)21 b Fn(g)j Fr(\016)c Fk(Inleft)t Ft(\))15 b(\()p Fn(f)30 b Fr(\016)21 b Fn(g)i Fr(\016)e Fk(Inrigh)m(t)t Ft(\))8 b(.)71 4376 y(\(c\))55 b Fn(f)10 b Ft(\()p Fl(if)46 b Fn(M)58 b Fl(then)47 b Fn(N)58 b Fl(else)46 b Fn(P)13 b Ft(\))30 b(=)f Fl(if)47 b Fn(M)58 b Fl(then)46 b Fn(f)10 b(N)57 b Fl(else)47 b Fn(f)10 b(P)21 b Ft(,)33 b(when)f(desugared)g(in) m(to)h(sum)f(op)s(era-)227 4489 y(tions)e(as)h(describ)s(ed)d(in)h (this)g(section.)61 4677 y(\(d\))54 b Fn(M)72 b Ft(=)61 b Fn(\025z)t Ft(:)15 b Fn(\033)24 b Ft(+)c Fn(\034)10 b(:)16 b Fk(Case)j Fn(z)g(N)25 b(P)42 b Ft(:)30 b(\()p Fn(\033)25 b Ft(+)d Fn(\034)10 b Ft(\))1779 4671 y Fr(!)1870 4677 y Ft(\()p Fn(\033)26 b Ft(+)21 b Fn(\034)10 b Ft(\))42 b(is)31 b(pro)m(v)-5 b(able)33 b(whenev)m(er)41 b Fn(\025x)p Ft(:)15 b Fn(\033)s(:)h(M)10 b Ft(\()p Fk(Inleft)19 b Fn(x)p Ft(\))29 b(=)227 4789 y Fn(N)42 b Ft(:)32 b Fn(\033)469 4783 y Fr(!)560 4789 y Ft(\()p Fn(\033)26 b Ft(+)d Fn(\034)10 b Ft(\))43 b(and)f Fn(\025y)s Ft(:)15 b Fn(\034)10 b(:)15 b(M)10 b Ft(\()p Fk(Inrigh)m(t)20 b Fn(y)s Ft(\))32 b(=)f Fn(P)45 b Ft(:)32 b Fn(\034)2228 4783 y Fr(!)2319 4789 y Ft(\()p Fn(\033)26 b Ft(+)d Fn(\034)10 b Ft(\))43 b(are)34 b(b)s(oth)g(pro)m(v)-5 b(able)34 b(and)42 b Fn(z)k Ft(is)34 b(not)227 4902 y(free)d(in)37 b Fn(N)49 b Ft(or)38 b Fn(P)22 b Ft(.)0 5114 y Fk(Exercise)35 b(2.6.4)47 b Ft(This)26 b(exercise)j(asks)g(y)m(ou)g(to)g(sho)m(w)g(that)g(the)g(extensionalit) m(y)f(axiom)g(for)g(sums)g(is)g(inconsis-)0 5227 y(ten)m(t)g(with)e (the)h(equational)g(axiom)g(for)g Fs(\014x,)g Ft(when)g(com)m(bined)f (with)g(the)h(rest)g(of)g(the)h(equational)e(pro)s(of)h(system)0 5340 y(of)k(PCF.)f(The)g(\014rst)f(observ)-5 b(ation)31 b(of)f(this)f(phenomenon)h(is)f(generally)h(credited)f(to)j(La)m(wv)m (ere)f([La)m(w69)r(].)p eop %%Page: 117 68 117 67 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(117)66 91 y(\(a\))46 b(De\014ne)31 b(functions)38 b Fs(not)9 b Ft(:)15 b Fs(b)-5 b(o)g(ol)1260 85 y Fr(!)1366 91 y Fs(b)g(o)g(ol)50 b Ft(and)39 b Fs(e)-5 b(q)8 b Ft(?:)15 b Fs(b)-5 b(o)g(ol)2092 85 y Fr(!)2198 91 y Fs(b)g(o)g(ol)2371 85 y Fr(!)2478 91 y Fs(b)g(o)g(ol)50 b Ft(and)30 b(sho)m(w)h(that)g(when)f(w)m(e)h(regard)227 204 y Fs(b)-5 b(o)g(ol)43 b Ft(as)24 b(sugar)g(for)32 b Fs(unit)16 b Ft(+)7 b Fs(unit)16 b Ft(,)26 b(w)m(e)e(can)g(pro)m(v)m (e)h(the)f(follo)m(wing)e(three)i(equations)g(with)e(b)s(o)s(olean)h(v) -5 b(ariable)227 317 y Fn(x)8 b Ft(:)1610 404 y Fs(not)25 b Ft(\()p Fs(not)g Fn(x)p Ft(\))144 b(=)83 b Fn(x)1610 517 y Fs(e)-5 b(q)8 b Ft(?)15 b Fn(x)g Ft(\()p Fs(not)25 b Fn(x)p Ft(\))84 b(=)f Fs(false)1610 630 y(e)-5 b(q)8 b Ft(?)15 b Fn(x)g(x)306 b Ft(=)83 b Fs(true)227 790 y Ft(Y)-8 b(ou)31 b(ma)m(y)g(use)f(the)h(results)e(of)h(Exercise)h (2.6.3.)61 977 y(\(b\))45 b(Recall)27 b(from)f(Exercise)h(2.3.2)i(that) e(ev)m(ery)h(equation)f(b)s(et)m(w)m(een)g(w)m(ell-formed)f(terms)h(of) g(the)g(same)h(t)m(yp)s(e)f(is)227 1090 y(pro)m(v)-5 b(able)25 b(from)33 b Fs(true)f Ft(=)25 b Fs(false)40 b Ft(b)m(y)25 b(the)g(axioms)g(and)g(inference)f(rules)f(of)i(PCF.)g (Use)h(the)f(three)g(equations)227 1203 y(pro)m(v)m(ed)f(in)f(part)h (\(a\))h(to)f(pro)m(v)m(e)33 b Fs(true)g Ft(=)24 b Fs(false)16 b Ft(.)39 b(Y)-8 b(ou)24 b(can)g(do)g(this)f(b)m(y)g(substituting)f(a)i (b)s(o)s(olean)f(expression)227 1316 y(of)31 b(the)f(form)39 b Fs(\014x)26 b Fn(B)43 b Ft(for)c Fn(x)f Ft(in)29 b(t)m(w)m(o)j(of)e (the)h(equations.)0 1559 y Fo(2.6.3)112 b(Recursiv)m(e)37 b(t)m(yp)s(es)0 1731 y Ft(In)24 b(some)h(programming)e(languages,)j(it) e(is)f(p)s(ossible)f(to)k(de\014ne)d(t)m(yp)s(es)i(recursiv)m(ely)-8 b(.)38 b(An)24 b(example)g(is)f(ML,)i(whic)m(h)0 1844 y(has)30 b(recursiv)m(e)f Fl(datatype)e Ft(declarations)j(\(see)h (Exercise)e(2.6.8\).)43 b(W)-8 b(e)31 b(ma)m(y)f(add)g(recursiv)m (ely-de\014ned)d(t)m(yp)s(es)j(to)0 1957 y(PCF,)g(or)f(an)m(y)h (related)g(language)g(based)f(on)h(lam)m(b)s(da)e(calculus,)h(b)m(y)h (adding)e(t)m(yp)s(e)i(v)-5 b(ariables)36 b Fn(r)m(;)15 b(s;)g(t;)g(:)g(:)g(:)40 b Ft(to)31 b(the)0 2070 y(syn)m(tax)25 b(of)f(t)m(yp)s(e)h(expressions)e(and)g(a)i(new)f(form)g(of)g(t)m(yp)s (e)h(expression,)32 b Fn(\026t:\033)12 b Ft(.)38 b(In)m(tuitiv)m(ely)-8 b(,)33 b Fn(\026t:\033)j Ft(is)23 b(the)i(smallest)0 2183 y(t)m(yp)s(e)31 b(\(collection)f(of)g(v)-5 b(alues\))31 b(satisfying)e(the)h(equation)1805 2387 y Fn(t)55 b Ft(=)h Fn(\033)n(;)0 2591 y Ft(where)48 b Fn(t)g Ft(will)37 b(generally)j(o)s(ccur)g(in)47 b Fn(\033)12 b Ft(.)69 b(As)40 b(with)f(recursiv)m(e)g(de\014nitions)f(in)h(PCF,)h(w)m(e)g (could)g(in)m(tro)s(duce)f(a)0 2704 y(\014xed-p)s(oin)m(t)c(op)s (erator)h(and)f(write)43 b Fs(\014x)27 b Ft(\()p Fn(\025t:)15 b(\033)s Ft(\))45 b(for)35 b(a)h(solution)f(to)h(the)g(equation)44 b Fn(t)34 b Ft(=)h Fn(\033)12 b Ft(.)56 b(The)35 b(syn)m(tax)45 b Fn(\026t:\033)0 2817 y Ft(could)34 b(b)s(e)g(considered)g(sugar)h (for)43 b Fs(\014x)26 b Ft(\()p Fn(\025t:)16 b(\033)s Ft(\))8 b(.)55 b(Ho)m(w)m(ev)m(er,)38 b(w)m(e)e(will)c(a)m(v)m(oid)k (lam)m(b)s(da)d(abstraction)i(in)f(t)m(yp)s(es)h(b)m(y)0 2930 y(taking)46 b Fn(\026)f Ft(as)38 b(primitiv)m(e.)60 b(W)-8 b(e)39 b(consider)d(the)i(denotational)f(seman)m(tics)h(of)g (recursiv)m(e)f(t)m(yp)s(e)g(declarations)g(in)0 3043 y(Section)30 b(7.4.)141 3156 y(The)e(op)s(erator)37 b Fn(\026)f Ft(binds)e Fn(t)i Ft(in)f Fn(\026t:\033)12 b Ft(,)28 b(so)g(w)m(e)h(ha)m(v)m(e)g(b)s(oth)f(free)g(and)g(b)s(ound)e (t)m(yp)s(e)i(v)-5 b(ariables)27 b(in)g(t)m(yp)s(e)h(expres-)0 3269 y(sions.)53 b(Ho)m(w)m(ev)m(er,)39 b(since)34 b(no)h(term)g (constructs)g(bind)e(t)m(yp)s(e)i(v)-5 b(ariables,)35 b(w)m(e)h(only)e(use)g(closed)h(t)m(yp)s(es)g(in)f(terms.)0 3381 y(More)i(sp)s(eci\014cally)-8 b(,)34 b(the)h(t)m(yp)s(e)g (expressions)f(of)h(PCF)g(with)42 b Fs(nat)52 b Ft(and)43 b Fs(b)-5 b(o)g(ol)54 b Ft(eliminated)33 b(but)42 b Fs(unit)17 b Ft(,)37 b(sum)d(and)0 3494 y(recursiv)m(e)c(t)m(yp)s(es)g(added)g (are)h(the)f Fs(close)-5 b(d)41 b Ft(t)m(yp)s(e)31 b(expressions)e (generated)i(b)m(y)f(the)h(follo)m(wing)e(grammar:)1101 3699 y Fn(\033)59 b Ft(::=)c Fn(t)25 b Fr(j)h Fs(unit)34 b Fr(j)25 b Fn(\033)f Ft(+)c Fn(\033)28 b Fr(j)e Fn(\033)18 b Fr(\002)d Fn(\033)28 b Fr(j)e Fn(\033)2394 3693 y Fr(!)2500 3699 y Fn(\033)j Fr(j)c Fn(\026t:\033)0 3903 y Ft(Since)30 b(terms)i(that)f(con)m(tain)h(t)m(yp)s(es)f(with)f(free)i(t)m(yp)s(e)f (v)-5 b(ariables)30 b(lead)h(to)h(p)s(olymorphism,)c(these)k(are)g (discussed)0 4016 y(in)c(Chapter)g(9.)41 b(W)-8 b(e)30 b(consider)d(t)m(yp)s(e)j(expressions)d(that)j(di\013er)d(in)h(the)h (names)g(of)g(b)s(ound)e(v)-5 b(ariables)27 b(equiv)-5 b(alen)m(t.)141 4129 y(With)36 b(recursiv)m(e)g(t)m(yp)s(es,)j(w)m(e)e (m)m(ust)g(consider)e(the)i(issue)f(of)h(t)m(yp)s(e)f(equalit)m(y)h (with)e(some)i(care.)61 b(Although)0 4242 y(in)m(tuitiv)m(ely)34 b Fn(\026t:\033)39 b Ft(in)m(tro)s(duces)26 b(a)i(solution)e(to)i(the)g (equation)35 b Fn(t)25 b Ft(=)g Fn(\033)12 b Ft(,)28 b(there)g(are)g(t)m(w)m(o)g(p)s(ossible)d(in)m(terpretations.)0 4354 y(One)32 b(is)f(that)i(these)g(are)g(truly)e(indistinguishable)c (t)m(yp)s(es.)46 b(In)32 b(this)f(view,)i(t)m(yp)s(e)f(equalit)m(y)g(b) s(ecomes)h(relativ)m(ely)0 4467 y(complicated,)k(since)43 b Fn(t)33 b Ft(=)g Fn(\033)47 b Ft(implies)33 b(that)44 b Fn(t)33 b Ft(=)h([)p Fn(\033)s(=t)p Ft(])p Fn(\033)12 b Ft(.)56 b(W)-8 b(ritten)36 b(using)d(the)44 b Fn(\026)g Ft(syn)m(tax,)37 b(this)d(giv)m(es)i(us)f(the)0 4580 y(equation)1599 4693 y Fn(\026t:\033)59 b Ft(=)c([)p Fn(\026t:\033)s(=t)p Ft(])p Fn(\033)0 4860 y Ft(Man)m(y)44 b(other)f(equations)f(follo)m(w,)k(including)39 b(some)k(that)h(are)f (not)g(directly)f(deriv)-5 b(able)41 b(from)h(an)h(axiom)g(of)0 4973 y(this)35 b(form)g([A)m(C91)q(].)58 b(While)34 b(the)i(t)m(yp)s(e) g(equalit)m(y)g(view)f(has)g(some)h(app)s(eal,)h(this)d(mak)m(es)j(it)e (more)h(di\016cult)e(to)0 5086 y(determine)k(whether)h(terms)g(are)h(w) m(ell)e(t)m(yp)s(ed.)68 b(Sp)s(eci\014cally)-8 b(,)39 b(w)m(e)h(m)m(ust)f(consider)f(t)m(yp)s(e)i(equalit)m(y)f(in)f(terms,)0 5199 y(allo)m(wing)29 b(a)h(term)g(of)g(one)h(t)m(yp)s(e)f(to)g(b)s(e)g (used)f(wherev)m(er)h(a)g(term)g(of)h(equal)e(but)g(syn)m(tactically)h (di\013eren)m(t)g(t)m(yp)s(e)g(is)0 5312 y(required.)39 b(W)-8 b(e)31 b(ma)m(y)g(a)m(v)m(oid)g(this)f(b)m(y)g(taking)g(the)h (second)f(view)g(of)g(t)m(yp)s(e)h(recursion.)p eop %%Page: 118 69 118 68 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(118)141 91 y(The)32 b(alternate)h(view)f(is)g(to)h (solv)m(e)g(an)f(equation)41 b Fn(t)28 b Ft(=)h Fn(\033)43 b Ft(b)m(y)33 b(\014nding)d(a)j(t)m(yp)s(e)41 b Fn(t)f Ft(that)33 b(is)f Fs(isomorphic)40 b Ft(to)h Fn(\033)12 b Ft(.)0 204 y(Isomorphic,)28 b(in)f(this)h(con)m(text,)j(means)e(that) g(there)g(is)f(a)h(function)e(from)37 b Fn(\026t:\033)j Ft(to)d([)p Fn(\026t:\033)19 b(=)c(t)p Ft(])p Fn(\033)d Ft(,)29 b(and)f(one)h(in)f(the)0 317 y(opp)s(osite)i(direction,)f(eac)m (h)i(the)g(in)m(v)m(erse)f(of)h(the)f(other.)41 b(W)-8 b(e)32 b(express)e(this)f(b)m(y)h(writing)1599 516 y Fn(\026t:\033)1823 491 y Fr(\030)1823 520 y Ft(=)1949 516 y([)p Fn(\026t:\033)s(=t)p Ft(])p Fn(\033)0 714 y Ft(where)273 689 y Fr(\030)273 718 y Ft(=)384 714 y(indicates)i(an)g (isomorphism.)43 b(In)32 b(the)g(isomorphism)e(view,)40 b Fn(\026t:\033)k Ft(is)31 b(not)i Fs(e)-5 b(qual)42 b Ft(to)f([)p Fn(\026t:\033)s(=t)p Ft(])p Fn(\033)12 b Ft(,)34 b(but)0 827 y(there)i(are)g(functions)f(that)h(allo)m(w)f(us) g(to)i(\\con)m(v)m(ert")h(a)f(v)-5 b(alue)35 b(of)h(t)m(yp)s(e)44 b Fn(\026t:\033)j Ft(to)e([)p Fn(\026t:\033)s(=t)p Ft(])p Fn(\033)12 b Ft(,)38 b(and)d(vice)h(v)m(ersa.)0 940 y(With)23 b(recursiv)m(e)f(t)m(yp)s(es)h(satisfying)f(isomorphisms)e(instead)i (of)h(equations,)i(w)m(e)e(ma)m(y)h(con)m(tin)m(ue)f(to)h(use)f(syn)m (tactic)0 1053 y(equalit)m(y)j(for)h(t)m(yp)s(e)f(equalit)m(y)h (\(except)h(for)e(renaming)g(of)g(b)s(ound)f(t)m(yp)s(e)i(v)-5 b(ariables\).)38 b(The)26 b(price)g(is)g(that)h(w)m(e)g(m)m(ust)0 1166 y(write)i(the)g(con)m(v)m(ersion)h(functions)e(b)s(et)m(w)m(een)38 b Fn(\026t:\033)j Ft(and)c([)p Fn(\026t:\033)s(=t)p Ft(])p Fn(\033)k Ft(in)28 b(terms)i(so)f(that)h(w)m(e)g(kno)m(w)f(the)h(syn)m (tactic)0 1279 y(t)m(yp)s(e)h(of)f(eac)m(h)i(term)e(exactly)-8 b(.)141 1392 y(The)28 b(term)g(forms)f(asso)s(ciated)h(with)f(recursiv) m(e)g(t)m(yp)s(es)h(allo)m(w)g(us)f(to)i(con)m(v)m(ert)g(a)f(term)g(of) g(t)m(yp)s(e)37 b Fn(\026t:\033)i Ft(to)29 b(t)m(yp)s(e)0 1504 y([)p Fn(\026t:\033)s(=t)p Ft(])p Fn(\033)12 b Ft(,)31 b(and)f(vice)g(v)m(ersa.)1317 1617 y(If)f Fn(M)10 b Ft(:)15 b([)p Fn(\026t:\033)s(=t)p Ft(])p Fn(\033)35 b Ft(then)30 b Fs(up)22 b Fn(M)10 b Ft(:)15 b Fn(\026t:\033)s(:)1315 1781 y Ft(If)30 b Fn(M)10 b Ft(:)15 b Fn(\026t:\033)34 b Ft(then)c Fs(dn)22 b Fn(M)10 b Ft(:)15 b([)p Fn(\026t:\033)s(=t)p Ft(])p Fn(\033)5 b(:)0 1945 y Ft(These)30 b(t)m(w)m(o)i(functions)d (are)i(in)m(v)m(erses,)f(as)h(stated)g(b)m(y)f(the)h(follo)m(wing)d (equational)i(axioms.)1253 2144 y Fs(dn)22 b Ft(\()p Fs(up)g Fn(M)10 b Ft(\))26 b(=)f Fn(M)5 b(;)106 b Fs(up)21 b Ft(\()p Fs(dn)i Fn(M)10 b Ft(\))26 b(=)f Fn(M)5 b(:)0 2342 y Ft(Only)28 b(the)j(\014rst)e(axiom)h(is)f(traditionally)f(used)h (as)h(a)h(reduction)e(rule)f(\(read)j(left)e(to)i(righ)m(t\).)41 b(While)29 b(the)h(op)s(era-)0 2455 y(tions)40 b Fs(up)61 b Ft(and)39 b Fs(dn)63 b Ft(disam)m(biguate)31 b(the)i(t)m(yp)s(es)e (of)i(terms,)f(these)g(are)h(often)f(cum)m(b)s(ersome)g(to)g(write.)45 b(In)31 b(later)0 2568 y(c)m(hapters,)g(w)m(e)g(will)d(o)s(ccasionally) h(omit)39 b Fs(up)59 b Ft(and)38 b Fs(dn)62 b Ft(from)30 b(examples)g(to)h(impro)m(v)m(e)f(readabilit)m(y)-8 b(.)141 2681 y(W)g(e)42 b(will)c(sho)m(w)j(that)g(with)f(recursiv)m(e)g(t)m(yp) s(e)h(de\014nitions,)50 b Fs(unit)57 b Ft(and)41 b(sum)f(t)m(yp)s(es,)j (w)m(e)f(can)f(de\014ne)48 b Fs(nat)18 b Ft(,)0 2794 y(n)m(umerals)i(for)29 b(0)p Fn(;)15 b Ft(1)p Fn(;)g Ft(2)p Fn(;)g(:)g(:)g(:)d Ft(,)23 b(and)e(the)g(successor,)j (predecessor)d(and)f(zero-test)k(functions.)36 b(As)21 b(sho)m(wn)f(in)g(Exercise)0 2907 y(2.5.7,)31 b(w)m(e)e(ma)m(y)g (replace)g(addition)e(and)h(equalit)m(y)g(test)i(\()8 b Fs(Eq)g Ft(?)g(\))29 b(of)g(PCF)f(b)m(y)h(successor,)g(predecessor)g (and)f(zero-)0 3020 y(test)i(without)f(c)m(hanging)h(the)f(set)h(of)g (de\014nable)e(functions.)39 b(Therefore,)30 b(w)m(e)g(can)g(translate) g(an)m(y)f(expression)g(of)0 3133 y(PCF)h(in)m(to)h(the)f(language)h (with)e(recursiv)m(e)h(t)m(yp)s(e)g(de\014nitions,)37 b Fs(unit)47 b Ft(and)30 b(sum)f(t)m(yp)s(es.)141 3246 y(A)k(distinguishing)28 b(feature)33 b(of)f(the)h(natural)e(n)m(um)m(b) s(ers)g(is)h(that)h(if)e(w)m(e)i(add)f(one)h(more)g(elemen)m(t)g(to)g (the)f(set)0 3358 y(of)d(natural)f(n)m(um)m(b)s(ers,)g(w)m(e)h(obtain)f (a)i(set)f(that)g(is)f(in)g(one-to-one)j(corresp)s(ondence,)e(or)f (isomorphic,)g(to)h(the)g(set)0 3471 y(of)e(natural)g(n)m(um)m(b)s (ers.)38 b(Since)26 b(the)i(sum)34 b Fs(unit)23 b Ft(+)14 b Fn(\034)45 b Ft(has)27 b(one)g(more)h(elemen)m(t)f(than)36 b Fn(\034)18 b Ft(,)28 b(w)m(e)g(therefore)g(exp)s(ect)36 b Fs(nat)0 3584 y Ft(to)31 b(satisfy)f(the)h(isomorphism)1584 3697 y Fs(nat)1776 3672 y Fr(\030)1776 3701 y Ft(=)1902 3697 y Fs(unit)e Ft(+)20 b Fs(nat)0 3861 y Ft(This)29 b(leads)g(us)h(to)h(the)g(follo)m(wing)e(de\014nition)f(of)38 b Fs(nat)48 b Ft(as)31 b(a)g(recursiv)m(e)f(t)m(yp)s(e)1554 4083 y Fs(nat)1746 4027 y Fj(def)1764 4083 y Ft(=)72 b Fn(\026t:)15 b Fs(unit)29 b Ft(+)20 b Fn(t)0 4281 y Ft(In)m(tuitiv)m(ely)-8 b(,)30 b(this)f(ma)m(y)i(b)s(e)f(understo)s(o)s (d)e(b)m(y)i(considering)f(the)h(isomorphisms)690 4472 y Fs(nat)910 4447 y Fr(\030)910 4476 y Ft(=)1063 4472 y Fs(unit)f Ft(+)20 b Fs(nat)910 4560 y Fr(\030)910 4589 y Ft(=)1063 4585 y Fs(unit)29 b Ft(+)20 b(\()p Fs(unit)29 b Ft(+)20 b Fs(nat)10 b Ft(\))910 4672 y Fr(\030)910 4702 y Ft(=)1063 4697 y Fs(unit)29 b Ft(+)20 b(\()p Fs(unit)29 b Ft(+)20 b(\()p Fs(unit)29 b Ft(+)20 b Fs(nat)10 b Ft(\)\))910 4785 y Fr(\030)910 4815 y Ft(=)1063 4810 y Fn(:)15 b(:)g(:)910 4898 y Fr(\030)910 4927 y Ft(=)1063 4923 y Fs(unit)29 b Ft(+)20 b(\()p Fs(unit)29 b Ft(+)20 b(\()p Fs(unit)29 b Ft(+)20 b(\()p Fs(unit)29 b Ft(+)20 b(\()p Fs(unit)30 b Ft(+)19 b Fn(:)c(:)g(:)22 b Ft(+)e Fs(nat)k Fn(:)15 b(:)g(:)q Ft(\)\)\)\))0 5114 y(Since)38 b(w)m(e)h(can)g(con)m(tin)m(ue) g(this)f(expansion)f(as)j(long)e(as)h(w)m(e)g(lik)m(e,)i(w)m(e)e(can)g (think)e(in)m(tuitiv)m(ely)g(of)47 b Fs(nat)57 b Ft(as)39 b(the)0 5227 y(disjoin)m(t)g(union)f(of)i(in\014nitely)d(man)m(y)k (one-elemen)m(t)g(t)m(yp)s(es.)70 b(W)-8 b(e)42 b(can)e(think)f(of)h (the)g(natural)g(n)m(um)m(b)s(er)47 b(0)i(as)0 5340 y(coming)26 b(from)f(the)h(\014rst)33 b Fs(unit)43 b Ft(in)24 b(this)h(sum,)34 b(1)h(from)25 b(the)h(second)34 b Fs(unit)17 b Ft(,)27 b(and)e(so)h(on)g(for)f(eac)m(h)i(natural)e(n)m(um)m(b)s(er.)p eop %%Page: 119 70 119 69 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(119)141 91 y(T)-8 b(o)37 b(a)m(v)m(oid)f (confusion)f(b)s(et)m(w)m(een)i(natural)e(n)m(um)m(b)s(ers)g(and)g(the) i(terms)f(that)g(w)m(e)h(use)f(to)h(represen)m(t)f(natural)0 204 y(n)m(um)m(b)s(ers,)27 b(w)m(e)h(will)d(write)34 b Fr(d)p Fn(n)p Fr(e)i Ft(for)28 b(the)f(n)m(umeral)g(\(term\))h(for)35 b Fn(n)8 b Ft(.)40 b(F)-8 b(ollo)m(wing)27 b(the)g(in)m(tuitiv)m(e)g (picture)f(ab)s(o)m(v)m(e,)j(w)m(e)0 317 y(let)h(the)h(n)m(umeral)37 b Fr(d)p Ft(0)p Fr(e)j Ft(for)30 b(natural)g(n)m(um)m(b)s(er)37 b(0)i(b)s(e)30 b(the)h(term)1517 549 y Fr(d)p Ft(0)p Fr(e)1698 494 y Fj(def)1716 549 y Ft(=)72 b Fs(up)37 b Ft(\()p Fk(Inleft)s Fr(\003)p Ft(\))p Fn(:)0 754 y Ft(F)-8 b(or)31 b(an)m(y)g(natural)e(n)m(um)m(b)s(er)38 b Fn(n)24 b(>)h Ft(0)8 b(,)32 b(w)m(e)f(ma)m(y)g(similarly)c(de\014ne)i (the)i(n)m(umeral)37 b Fr(d)p Fn(n)p Fr(e)i Ft(b)m(y)857 986 y Fr(d)p Fn(n)p Fr(e)1048 930 y Fj(def)1065 986 y Ft(=)72 b Fs(up)37 b Ft(\()p Fk(Inrigh)m(t)19 b Fs(up)37 b Ft(\()p Fk(Inrigh)m(t)d Fn(:)15 b(:)g(:)i Fs(up)36 b Ft(\()p Fk(Inleft)t Fr(\003)p Ft(\))15 b Fn(:)g(:)g(:)r Ft(\)\))0 1190 y(with)37 b Fn(n)i Ft(o)s(ccurrences)30 b(of)39 b Fk(Inrigh)m(t)k Ft(and)38 b Fn(n)20 b Ft(+)g(1)39 b(applications)29 b(of)39 b Fs(up)29 b Ft(.)41 b(The)30 b(successor)h(function)e(just)h(applies)0 1303 y Fs(up)60 b Ft(and)38 b Fk(Inrigh)m(t)12 b Ft(:)1308 1439 y Fs(suc)-5 b(c)1533 1383 y Fj(def)1551 1439 y Ft(=)72 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b Fs(up)21 b Ft(\()p Fk(Inrigh)m(t)f Fn(x)p Ft(\))0 1606 y(W)-8 b(e)42 b(can)e(c)m(hec)m(k)i(that)f(this)f (has)g(the)h(righ)m(t)f(t)m(yp)s(e)g(b)m(y)h(noting)f(that)h(if)47 b Fn(x)p Ft(:)15 b Fs(nat)j Ft(,)44 b(then)k Fk(Inrigh)m(t)19 b Fn(x)49 b Ft(b)s(elongs)39 b(to)0 1719 y Fs(unit)32 b Ft(+)23 b Fs(nat)17 b Ft(.)54 b(Therefore,)45 b Fs(up)21 b Ft(\()p Fk(Inrigh)m(t)e Fn(x)p Ft(\):)c Fs(nat)k Ft(.)54 b(The)34 b(reader)h(ma)m(y)g(v)m(erify)g(that)43 b Fn(S)5 b Fr(d)p Fn(n)p Fr(e)34 b Ft(=)e Fr(d)p Fn(n)23 b Ft(+)g(1)p Fr(e)44 b Ft(for)35 b(an)m(y)0 1832 y(natural)29 b(n)m(um)m(b)s(er)38 b Fn(n)8 b Ft(.)141 1945 y(The)45 b(zero-test)j(op)s(eration)d(w)m (orks)g(b)m(y)g(taking)54 b Fn(x)p Ft(:)15 b Fs(nat)63 b Ft(and)45 b(applying)52 b Fs(dn)76 b Ft(to)47 b(obtain)d(an)i(elemen) m(t)g(of)0 2057 y Fs(unit)30 b Ft(+)22 b Fs(nat)c Ft(,)33 b(then)g(using)39 b Fk(Case)45 b Ft(to)33 b(see)h(whether)e(the)h (result)e(is)h(an)h(elemen)m(t)g(of)41 b Fs(unit)50 b Ft(\()p Fs(i.e.)p Ft(,)33 b(equal)f(to)42 b(0)8 b(\))34 b(or)0 2170 y(not.)538 2283 y Fs(zer)-5 b(o)6 b Ft(?)802 2228 y Fj(def)819 2283 y Ft(=)72 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)16 b Fk(Case)1500 2246 y Fj(unit)6 b Fm(;)p Fj(nat)g Fm(;)p Fj(b)l(o)l(ol)1918 2283 y Ft(\()p Fs(dn)39 b Fn(x)p Ft(\))15 b(\()p Fn(\025y)s Ft(:)g Fs(unit)9 b Fn(:)16 b Fs(true)7 b Ft(\))15 b(\()p Fn(\025z)t Ft(:)g Fs(nat)c Fn(:)k Fs(false)7 b Ft(\))0 2450 y(The)30 b(reader)g(ma)m(y)h (easily)f(c)m(hec)m(k)i(that)39 b Fs(zer)-5 b(o)6 b Ft(?)16 b Fr(d)p Ft(0)p Fr(e)26 b Ft(=)f Fs(true)46 b Ft(and)38 b Fs(zer)-5 b(o)6 b Ft(?)16 b Fr(d)p Fn(n)p Fr(e)26 b Ft(=)e Fs(false)46 b Ft(for)39 b Fn(n)25 b(>)g Ft(0)8 b(.)141 2563 y(The)26 b(\014nal)g(op)s(eration)g(w)m(e)h(need)g(is)f (predecessor.)39 b(Recall)27 b(that)g(although)f(there)h(is)f(no)h (predecessor)g(of)35 b(0)8 b(,)28 b(it)0 2676 y(is)j(con)m(v)m(en)m (tional)i(to)g(tak)m(e)43 b Fs(pr)-5 b(e)g(d)26 b Ft(0)j(=)f(0)8 b(.)47 b(The)32 b(predecessor)g(function)f(is)g(similar)f(to)j Fs(zer)-5 b(o?)58 b Ft(since)32 b(it)g(w)m(orks)g(b)m(y)0 2789 y(taking)41 b Fn(x)p Ft(:)15 b Fs(nat)51 b Ft(and)32 b(applying)39 b Fs(dn)31 b Ft(,)j(then)f(using)40 b Fk(Case)k Ft(to)34 b(see)g(whether)e(the)h(result)f(is)g(an)h(elemen)m(t)g(of)41 b Fs(unit)0 2902 y Ft(\()p Fs(i.e.)p Ft(,)c(equal)e(to)45 b(0)8 b(\))37 b(or)f(not.)57 b(If)35 b(so,)j(then)d(the)h(predecessor)g (is)43 b(0)8 b(;)40 b(otherwise,)c(the)g(elemen)m(t)h(of)44 b Fs(nat)53 b Ft(already)0 3015 y(obtained)30 b(b)m(y)g(applying)37 b Fs(dn)61 b Ft(is)29 b(the)i(predecessor.)684 3242 y Fs(pr)-5 b(e)g(d)913 3186 y Fj(def)930 3242 y Ft(=)73 b Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b Fk(Case)1612 3204 y Fj(unit)6 b Fm(;)p Fj(nat)g Fm(;)p Fj(b)l(o)l(ol)2030 3242 y Ft(\()p Fs(dn)38 b Fn(x)p Ft(\))15 b(\()p Fn(\025y)s Ft(:)g Fs(unit)10 b Fn(:)15 b Ft(0\))g(\()p Fn(\025z)t Ft(:)g Fs(nat)d Fn(:)j(z)t Ft(\))0 3446 y(The)26 b(reader)h(ma)m(y)g(v) m(erify)f(that)h(for)f(an)m(y)35 b Fn(x)p Ft(:)15 b Fs(nat)45 b Ft(w)m(e)27 b(ha)m(v)m(e)36 b Fs(pr)-5 b(e)g(d)11 b Ft(\()p Fs(suc)-5 b(c)21 b Fn(x)p Ft(\))k(=)g Fn(x)8 b Ft(.)40 b(\(This)25 b(is)h(part)g(of)h(Exercise)f(2.6.5)0 3559 y(b)s(elo)m(w.\))141 3672 y(A)44 b(second)f(illustration)d(of)k (the)g(use)f(of)g(recursiv)m(e)g(t)m(yp)s(es)g(has)g(a)h(v)m(ery)g (di\013eren)m(t)f(\015a)m(v)m(or.)80 b(While)43 b(most)0 3785 y(common)d(uses)f(of)g(recursiv)m(e)g(t)m(yp)s(es)h(in)m(v)m(olv)m (e)g(data)g(structures,)h(w)m(e)f(ma)m(y)g(also)g(write)e(recursiv)m(e) h(de\014nitions)0 3898 y(o)m(v)m(er)i(an)m(y)g(t)m(yp)s(e)f(using)e (recursiv)m(e)i(t)m(yp)s(es.)69 b(More)41 b(sp)s(eci\014cally)-8 b(,)41 b(w)m(e)f(ma)m(y)h(de\014ne)e(a)i(function)47 b Fs(\014x)3462 3920 y Fm(\033)3557 3898 y Ft(with)39 b(the)0 4011 y(reduction)c(prop)s(ert)m(y)44 b Fs(\014x)900 4033 y Fm(\033)982 4011 y Fr(!)-61 b(!)36 b Fn(\025f)10 b Ft(:)15 b Fn(\033)1357 4005 y Fr(!)1463 4011 y Fn(\033)s(:)g(f)10 b Ft(\()p Fs(\014x)1752 4033 y Fm(\033)1814 4011 y Fn(f)g Ft(\))44 b(using)35 b(only)h(t)m(yp)s(ed)g(lam)m(b)s(da)f(calculus)g (with)g(recursiv)m(e)0 4124 y(t)m(yp)s(es.)60 b(The)36 b(main)g(idea)g(is)g(to)i(use)e(\\self-application,")i(whic)m(h)d(is)h (not)h(p)s(ossible)e(without)g(recursiv)m(e)i(t)m(yp)s(es.)0 4237 y(More)27 b(sp)s(eci\014cally)-8 b(,)25 b(if)34 b Fn(M)45 b Ft(is)25 b(an)m(y)h(PCF)g(term,)i(the)e(application)33 b Fn(M)10 b(M)45 b Ft(cannot)27 b(b)s(e)e(w)m(ell-t)m(yp)s(ed.)39 b(The)25 b(reason)i(is)0 4349 y(simply)d(that)j(if)34 b Fn(M)10 b Ft(:)15 b Fn(\034)k Ft(,)28 b(then)34 b Fn(\034)45 b Ft(do)s(es)26 b(not)h(ha)m(v)m(e)h(enough)f(sym)m(b)s(ols)e(to)i(ha)m (v)m(e)h(the)f(form)34 b Fn(\034)3082 4343 y Fr(!)3189 4349 y Fn(\034)3239 4316 y Fi(0)3270 4349 y Ft(.)40 b(Ho)m(w)m(ev)m (er,)29 b(with)0 4462 y(recursiv)m(e)h(t)m(yp)s(es,)39 b(\()p Fs(dn)23 b Fn(M)10 b Ft(\))p Fn(M)49 b Ft(ma)m(y)31 b(b)s(e)f(w)m(ell-t)m(yp)s(ed,)f(since)h(the)h(t)m(yp)s(e)f(of)39 b Fn(M)49 b Ft(could)29 b(ha)m(v)m(e)j(the)e(form)39 b Fn(\026t:t)3690 4456 y Fr(!)3795 4462 y Fn(\034)19 b Ft(.)141 4575 y(W)-8 b(e)29 b(will)d(de\014ne)35 b Fs(\014x)837 4597 y Fm(\033)920 4575 y Ft(using)27 b(a)h(term)g(of)g (the)g(form)36 b Fs(dn)23 b Fn(M)10 b(M)18 b Ft(.)40 b(The)28 b(main)f(prop)s(ert)m(y)g(w)m(e)h(w)m(an)m(t)h(for)36 b Fs(dn)23 b Fn(M)10 b(M)0 4688 y Ft(is)29 b(that)1168 4801 y Fs(dn)23 b Fn(M)10 b(M)96 b Fr(!)-61 b(!)86 b Fn(\025f)10 b Ft(:)15 b Fn(\033)1995 4795 y Fr(!)2101 4801 y Fn(\033)s(:)g(f)10 b Ft(\()p Fs(dn)23 b Fn(M)10 b(M)25 b(f)10 b Ft(\))p Fn(:)0 4968 y Ft(This)25 b(reduction)g(giv)m (es)i(us)e(a)i(go)s(o)s(d)g(clue)e(ab)s(out)i(the)f(form)g(of)35 b Fn(M)18 b Ft(.)40 b(Sp)s(eci\014cally)-8 b(,)25 b(w)m(e)i(can)g(let) 34 b Fn(M)45 b Ft(ha)m(v)m(e)28 b(the)e(form)1130 5195 y Fn(M)1283 5140 y Fj(def)1301 5195 y Ft(=)72 b Fs(up)21 b Ft(\()26 b Fn(\025x)p Ft(:)15 b Fn(\034)10 b(:)16 b(\025f)10 b Ft(:)15 b Fn(\033)2075 5189 y Fr(!)2181 5195 y Fn(\033)s(:)h(f)10 b Ft(\()p Fs(dn)22 b Fn(x)15 b(x)g(f)10 b Ft(\))25 b(\))p eop %%Page: 120 71 120 70 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(120)0 91 y(if)25 b(w)m(e)h(can)g(\014nd)e(an)i (appropriate)e(t)m(yp)s(e)34 b Fn(\034)19 b Ft(.)39 b(Since)25 b(w)m(e)h(w)m(an)m(t)35 b Fs(dn)22 b Fn(M)10 b(M)26 b Ft(:)k(\()p Fn(\033)2565 85 y Fr(!)2671 91 y Fn(\033)s Ft(\))2776 85 y Fr(!)2883 91 y Fn(\033)12 b Ft(,)26 b(the)g(expression) 33 b Fs(dn)22 b Fn(x)15 b(x)g(f)0 204 y Ft(in)29 b(the)i(b)s(o)s(dy)d (of)39 b Fn(M)49 b Ft(m)m(ust)30 b(ha)m(v)m(e)i(t)m(yp)s(e)39 b Fn(\033)12 b Ft(.)40 b(Therefore,)f Fn(\034)48 b Ft(m)m(ust)30 b(satisfy)g(the)h(isomorphism)1507 395 y Fn(\034)1612 370 y Fr(\030)1612 400 y Ft(=)1738 395 y Fn(\034)1804 389 y Fr(!)1894 395 y Ft(\()p Fn(\033)2000 389 y Fr(!)2106 395 y Fn(\033)s Ft(\))2211 389 y Fr(!)2318 395 y Fn(\033)n(:)0 587 y Ft(W)-8 b(e)32 b(can)e(easily)g(ac)m(hiev)m(e)h(this)f(b)m(y)g (letting)1434 801 y Fn(\034)1539 745 y Fj(def)1557 801 y Ft(=)72 b Fn(\026t:)15 b(t)1876 795 y Fr(!)1967 801 y Ft(\()p Fn(\033)2073 795 y Fr(!)2179 801 y Fn(\033)s Ft(\))2284 795 y Fr(!)2391 801 y Fn(\033)n(:)0 1020 y Ft(W)-8 b(e)32 b(lea)m(v)m(e)f(it)f(to)h(the)g(reader)f(to)h(v)m(erify) f(that)h(if)e(w)m(e)i(de\014ne)38 b Fs(\014x)2171 1042 y Fm(\033)2243 965 y Fj(def)2261 1020 y Ft(=)k Fs(dn)23 b Fn(M)10 b(M)18 b Ft(,)31 b(or)f(more)h(simply)473 1238 y Fs(\014x)577 1260 y Fm(\033)707 1183 y Fj(def)725 1238 y Ft(=)100 b(\()p Fn(\025x)p Ft(:)15 b Fn(\034)10 b(:)16 b(\025f)10 b Ft(:)15 b Fn(\033)1385 1232 y Fr(!)1491 1238 y Fn(\033)s(:)h(f)10 b Ft(\()p Fs(dn)22 b Fn(x)15 b(x)g(f)10 b Ft(\)\))25 b(\()p Fs(up)d Ft(\()p Fn(\025x)p Ft(:)15 b Fn(\034)c(:)k(\025f)10 b Ft(:)15 b Fn(\033)2721 1232 y Fr(!)2827 1238 y Fn(\033)s(:)h(f)10 b Ft(\()p Fs(dn)22 b Fn(x)15 b(x)g(f)10 b Ft(\)\)\))0 1427 y(w)m(e)31 b(ha)m(v)m(e)g(a)g(w)m(ell-t)m(yp)s(ed)f(expression)f(with)37 b Fs(\014x)1616 1449 y Fm(\033)1719 1427 y Fr(!)-61 b(!)56 b Fn(\025f)10 b Ft(:)15 b Fn(\033)2114 1421 y Fr(!)2220 1427 y Fn(\033)s(:)g(f)10 b Ft(\()p Fs(\014x)2509 1449 y Fm(\033)2571 1427 y Fn(f)g Ft(\))e(.)141 1540 y(The)31 b(\014xed-p)s(oin)m(t)f(op)s(erator)h(w)m(e)h(ha)m(v)m(e)g(just)f (deriv)m(ed)f(is)h(a)g(t)m(yp)s(ed)g(v)m(ersion)g(of)g(the)h(\014xed-p) s(oin)m(t)d(op)s(erator)40 b(\002)0 1653 y(from)33 b(un)m(t)m(yp)s(ed)f (lam)m(b)s(da)g(calculus)g([Bar84)q(].)49 b(As)33 b(outlined)f(in)f (Exercise)i(2.6.7)i(b)s(elo)m(w,)e(an)m(y)h(un)m(t)m(yp)s(ed)e(lam)m(b) s(da)0 1766 y(term)e(ma)m(y)h(b)s(e)f(written)g(in)f(a)h(t)m(yp)s(ed)g (w)m(a)m(y)i(using)d(recursiv)m(e)g(t)m(yp)s(es.)0 1965 y Fk(Exercise)35 b(2.6.5)47 b Ft(Using)27 b(the)h(de\014nitions)e(giv)m (en)i(in)e(this)h(section,)i(sho)m(w)f(that)h(w)m(e)f(ha)m(v)m(e)i(the) e(follo)m(wing)e(reduc-)0 2078 y(tions)k(on)g(natural)f(n)m(um)m(b)s (er)g(terms.)66 2255 y(\(a\))46 b(F)-8 b(or)31 b(ev)m(ery)h(natural)d (n)m(um)m(b)s(er)37 b Fn(n)8 b Ft(,)31 b(w)m(e)g(ha)m(v)m(e)40 b Fn(S)5 b Fr(d)p Fn(n)p Fr(e)25 b(!)-61 b(!)26 b(d)p Fn(n)20 b Ft(+)g(1)p Fr(e)8 b Ft(.)61 2438 y(\(b\))54 b Fs(zer)-5 b(o)6 b Ft(?)16 b Fr(d)p Ft(0)p Fr(e)26 b(!)-61 b(!)26 b Fs(true)45 b Ft(and)38 b Fs(zer)-5 b(o)6 b Ft(?)16 b Fr(d)p Fn(n)p Fr(e)26 b(!)-61 b(!)25 b Fs(false)46 b Ft(for)39 b Fn(n)24 b(>)h Ft(0)8 b(.)71 2621 y(\(c\))46 b(If)38 b Fn(x)h Ft(is)29 b(a)i(natural)f(n)m(um)m(b)s(er)f(v)-5 b(ariable,)29 b(then)39 b Fs(pr)-5 b(e)g(d)11 b Ft(\()p Fs(suc)-5 b(c)20 b Fn(x)p Ft(\))26 b Fr(!)-61 b(!)25 b Fn(x)8 b Ft(.)0 2821 y Fk(Exercise)35 b(2.6.6)47 b Ft(W)-8 b(e)34 b(ma)m(y)g(de\014ne)f(the)h(t)m(yp)s(e)f(of)h(lists)e (of)i(natural)e(n)m(um)m(b)s(ers)g(using)g(the)i(follo)m(wing)e (recursiv)m(e)0 2934 y(t)m(yp)s(e:)1405 3070 y Fs(list)1588 3014 y Fj(def)1605 3070 y Ft(=)72 b Fn(\026t:)15 b Fs(unit)29 b Ft(+)20 b(\()p Fs(nat)25 b Fr(\002)15 b Fn(t)p Ft(\))0 3230 y(The)39 b(in)m(tuition)e(b)s(ehind)g(this)h(de\014nition)g(is)g (that)i(a)g(list)e(is)h(either)g(empt)m(y)-8 b(,)43 b(whic)m(h)38 b(w)m(e)i(represen)m(t)g(using)e(the)0 3343 y(elemen)m(t)h Fr(\003)p Ft(:)15 b Fs(unit)j Ft(,)30 b(or)h(ma)m(y)g(b)s(e)f(regarded) g(as)g(a)h(pair)e(consisting)g(of)i(a)g(natural)e(n)m(um)m(b)s(er)g (and)h(a)h(list.)66 3520 y(\(a\))46 b(De\014ne)c(the)g(empt)m(y)g(list) 49 b Fs(nil)10 b Ft(:)15 b Fs(list)59 b Ft(and)41 b(the)h(function)49 b Fs(c)-5 b(ons)8 b Ft(:)15 b Fs(nat)25 b Fr(\002)15 b Fs(list)2809 3514 y Fr(!)2915 3520 y Fs(list)59 b Ft(that)43 b(adds)e(a)h(natural)227 3633 y(n)m(um)m(b)s(er)29 b(to)i(a)g(list.)61 3816 y(\(b\))45 b(The)40 b(function)48 b Fs(c)-5 b(ar)60 b Ft(returns)39 b(the)i(\014rst)f(elemen)m(t)h(of)g(a)g(list)f(and)g (the)h(function)47 b Fs(c)-5 b(dr)60 b Ft(returns)39 b(the)i(list)227 3929 y(follo)m(wing)32 b(the)h(\014rst)f(elemen)m(t.) 48 b(W)-8 b(e)35 b(can)e(de\014ne)f(v)m(ersions)g(of)h(these)g (functions)f(that)h(mak)m(e)h(sense)f(when)227 4042 y(applied)28 b(to)k(the)e(empt)m(y)h(list)e(b)m(y)h(giving)f(them)i(t)m(yp)s(es)1561 4225 y Fs(c)-5 b(ar)94 b Ft(:)83 b Fs(list)34 b Fr(!)25 b Fs(unit)k Ft(+)20 b Fs(nat)1561 4338 y(c)-5 b(dr)94 b Ft(:)83 b Fs(list)34 b Fr(!)25 b Fs(unit)k Ft(+)20 b Fs(list)227 4521 y Ft(and)33 b(establishing)e(the)j(con)m(v)m(en)m (tion)h(that)f(when)e(applied)f(to)k(the)e(empt)m(y)h(list,)f(eac)m(h)i (returns)40 b Fk(Inleft)19 b Fr(\003)8 b Ft(.)227 4634 y(W)-8 b(rite)31 b(terms)f(de\014ning)f Fs(c)-5 b(ar)41 b Ft(and)30 b Fs(c)-5 b(dr)41 b Ft(functions)29 b(so)h(that)h(the)g (follo)m(wing)e(equations)h(are)g(pro)m(v)-5 b(able:)1531 4818 y Fs(c)g(ar)26 b(nil)351 b Ft(=)83 b Fk(Inleft)18 b Fr(\003)1531 4931 y Fs(c)-5 b(ar)26 b Ft(\()p Fs(c)-5 b(ons)23 b Fn(x)15 b(`)p Ft(\))84 b(=)f Fn(x)1531 5044 y Fs(c)-5 b(dr)26 b(nil)351 b Ft(=)83 b Fk(Inleft)18 b Fr(\003)1531 5156 y Fs(c)-5 b(dr)26 b Ft(\()p Fs(c)-5 b(ons)23 b Fn(x)15 b(`)p Ft(\))84 b(=)f Fn(`)227 5340 y Ft(for)39 b Fn(x)p Ft(:)15 b Fs(nat)48 b Ft(and)38 b Fn(`)p Ft(:)15 b Fs(list)j Ft(.)p eop %%Page: 121 72 121 71 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(121)71 91 y(\(c\))46 b(Using)34 b(recursion,)h(it)g(is)e(p)s(ossible)g(to)j(de\014ne)e(\\in\014nite")f (lists)h(of)h(t)m(yp)s(e)43 b Fs(list)17 b Ft(.)55 b(Sho)m(w)34 b(ho)m(w)h(to)h(use)e Fs(\014x)46 b Ft(to)227 204 y(de\014ne)30 b(a)h(list)37 b Fn(L)788 218 y Fm(n)843 204 y Ft(,)31 b(for)f(an)m(y)h(n)m(umeral)37 b Fn(n)8 b Ft(,)31 b(suc)m(h)f(that)39 b Fs(c)-5 b(ar)26 b Fn(L)2307 218 y Fm(n)2379 204 y Ft(=)f Fn(n)38 b Ft(and)g Fs(c)-5 b(dr)26 b Fn(L)2962 218 y Fm(n)3034 204 y Ft(=)f Fn(L)3192 218 y Fm(n)3247 204 y Ft(.)0 394 y Fk(Exercise)35 b(2.6.7)47 b Ft(The)27 b(terms)h(of)g(pure)f(un)m(t)m(yp)s(ed)g(lam)m(b)s(da)f(calculus)h (\(without)g(constan)m(t)i(sym)m(b)s(ols\))e(are)h(giv)m(en)0 507 y(b)m(y)i(the)h(grammar)1478 620 y Fn(U)95 b Ft(::=)86 b Fn(x)26 b Fr(j)f Fn(U)10 b(U)35 b Fr(j)41 b Fn(\025x:)15 b(U)0 776 y Ft(The)37 b(main)g(equational)h(prop)s(erties)e(of)i(un)m (t)m(yp)s(ed)f(lam)m(b)s(da)g(terms)h(are)g(un)m(t)m(yp)s(ed)f(v)m (ersions)g(of)47 b(\()p Fn(\013)p Ft(\))8 b(,)49 b(\()p Fn(\014)5 b Ft(\))48 b(and)0 888 y(\()p Fn(\021)s Ft(\))8 b(.)60 b(W)-8 b(e)38 b(ma)m(y)f(de\014ne)f(un)m(t)m(yp)s(ed)f(lam)m(b)s (da)h(terms)g(in)f(t)m(yp)s(ed)h(lam)m(b)s(da)g(calculus)f(with)g (recursiv)m(e)h(t)m(yp)s(es)g(using)0 1001 y(the)g(t)m(yp)s(e)44 b Fn(\026t:)15 b(t)556 995 y Fr(!)662 1001 y Fn(t)8 b Ft(.)58 b(In)m(tuitiv)m(ely)-8 b(,)36 b(the)g(reason)g(this)f(t)m(yp)s (e)h(w)m(orks)g(is)f(that)h(terms)g(of)g(t)m(yp)s(e)44 b Fn(\026t:)15 b(t)3421 995 y Fr(!)3527 1001 y Fn(t)44 b Ft(ma)m(y)37 b(b)s(e)0 1114 y(used)31 b(as)g(functions)f(on)h(this)f (t)m(yp)s(e,)i(and)f(con)m(v)m(ersely)-8 b(.)45 b(This)29 b(is)i(exactly)h(what)f(w)m(e)h(need)f(to)h(mak)m(e)g(sense)f(of)h(the) 0 1227 y(un)m(t)m(yp)s(ed)e(lam)m(b)s(da)f(calculus.)66 1417 y(\(a\))46 b(Sho)m(w)23 b(that)h(if)e(w)m(e)i(giv)m(e)g(ev)m(ery)g (free)f(or)g(b)s(ound)e(v)-5 b(ariable)22 b(t)m(yp)s(e)32 b Fn(\026t:)15 b(t)2526 1411 y Fr(!)2632 1417 y Fn(t)8 b Ft(,)25 b(w)m(e)f(ma)m(y)g(translate)f(an)m(y)h(un)m(t)m(yp)s(ed)227 1530 y(term)29 b(in)m(to)h(a)f(t)m(yp)s(ed)g(lam)m(b)s(da)f(term)h(of)g (t)m(yp)s(e)38 b Fn(\026t:)15 b(t)1983 1524 y Fr(!)2089 1530 y Fn(t)37 b Ft(b)m(y)29 b(inserting)36 b Fs(up)29 b Ft(,)38 b Fs(dn)31 b Ft(,)e(and)g(t)m(yp)s(e)g(designations)227 1643 y(on)24 b(lam)m(b)s(da)e(abstractions.)38 b(V)-8 b(erify)24 b(that)g(un)m(t)m(yp)s(ed)31 b(\()p Fn(\013)p Ft(\))i(follo)m(ws)22 b(from)h(t)m(yp)s(ed)32 b(\()p Fn(\013)p Ft(\))8 b(,)26 b(un)m(t)m(yp)s(ed)31 b(\()p Fn(\014)5 b Ft(\))33 b(follo)m(ws)227 1756 y(from)k Fs(dn)23 b Ft(\()p Fs(up)f Fn(M)10 b Ft(\))25 b(=)g Fn(M)48 b Ft(and)29 b(un)m(t)m(yp)s(ed)37 b(\()p Fn(\014)5 b Ft(\))38 b(and,)29 b(\014nally)-8 b(,)29 b(un)m(t)m(yp)s(ed)36 b(\()p Fn(\021)s Ft(\))j(follo)m(ws)29 b(from)f(t)m(yp)s(ed)38 b(\()p Fn(\021)s Ft(\))h(and)227 1869 y Fs(up)21 b Ft(\()p Fs(dn)i Fn(M)10 b Ft(\))26 b(=)f Fn(M)19 b Ft(.)61 2049 y(\(b\))45 b(Without)36 b(recursiv)m(e)g(t)m(yp)s(es,)i(ev)m(ery)f(t)m (yp)s(ed)f(lam)m(b)s(da)g(term)g(without)f(constan)m(ts)j(has)e(a)h (unique)d(normal)227 2162 y(form.)84 b(Sho)m(w)45 b(that)h(b)m(y)e (translating)53 b(\()p Fn(\025x:)15 b(xx)p Ft(\))g Fn(\025x:)h(xx)53 b Ft(in)m(to)45 b(t)m(yp)s(ed)g(lam)m(b)s(da)f(calculus,)j(w)m(e)f(can) f(use)227 2275 y(recursiv)m(e)30 b(t)m(yp)s(es)g(to)i(write)d(terms)h (with)g(no)g(normal)f(form.)71 2455 y(\(c\))46 b(A)31 b(w)m(ell-kno)m(wn)e(term)h(in)f(un)m(t)m(yp)s(ed)h(lam)m(b)s(da)f (calculus)g(is)h(the)g(\014xed-p)s(oin)m(t)f(op)s(erator)1398 2664 y Fn(Y)1526 2609 y Fj(def)1543 2664 y Ft(=)73 b Fn(\025f)5 b(:)o Ft(\()p Fn(\025x:)16 b(f)10 b Ft(\()p Fn(xx)p Ft(\)\)\()p Fn(\025x:)16 b(f)10 b Ft(\()p Fn(xx)p Ft(\)\))p Fn(:)227 2846 y Ft(Unlik)m(e)30 b(\002)8 b(,)25 b(this)c(term)i(is)f(only)g(an)g(equational)h(\014xed-p)s(oin)m(t)e(op) s(erator,)k Fs(i.e.)p Ft(,)32 b Fn(Y)20 b(f)35 b Ft(=)24 b Fn(f)10 b Ft(\()p Fn(Y)20 b(f)10 b Ft(\))31 b(but)f Fn(Y)20 b(f)40 b Ft(do)s(es)227 2959 y(not)d(reduce)f(to)46 b Fn(f)10 b Ft(\()p Fn(Y)19 b(f)10 b Ft(\))e(.)59 b(Use)37 b(a)g(v)-5 b(arian)m(t)37 b(of)f(the)h(translation)f(giv)m(en)g(in)f (part)i(\(a\))g(to)g(obtain)f(a)h(t)m(yp)s(ed)227 3072 y(equational)i(\014xed)f(p)s(oin)m(t)g(op)s(erator)h(from)47 b Fn(Y)28 b Ft(.)66 b(Y)-8 b(our)39 b(t)m(yp)s(ed)f(term)h(should)e(ha) m(v)m(e)j(t)m(yp)s(e)48 b(\()p Fn(\033)3493 3066 y Fr(!)3599 3072 y Fn(\033)s Ft(\))3704 3066 y Fr(!)3811 3072 y Fn(\033)12 b Ft(.)227 3185 y(Sho)m(w)39 b(that)g(although)47 b Fn(Y)20 b(f)56 b Ft(do)s(es)39 b(not)g(reduce)f(to)48 b Fn(f)10 b Ft(\()p Fn(Y)20 b(f)10 b Ft(\))e(,)49 b Fn(Y)20 b(f)57 b Ft(reduces)38 b(to)i(a)f(term)47 b Fn(M)3427 3200 y Fm(f)3520 3185 y Ft(suc)m(h)38 b(that)227 3298 y Fn(M)315 3313 y Fm(f)386 3298 y Fr(!)-61 b(!)26 b Fn(f)e(M)690 3313 y Fm(f)744 3298 y Ft(.)0 3488 y Fk(Exercise)35 b(2.6.8)47 b Ft(The)35 b(programming)g(language)i(ML)f(has)g(a)g(form)g(of)g (recursiv)m(e)g(t)m(yp)s(e)g(declaration,)i(called)0 3601 y Fl(datatype,)24 b Ft(that)i(com)m(bines)e(sums)h(and)f(t)m(yp)s (e)i(recursion.)37 b(In)25 b(general,)h(a)g(datat)m(yp)s(e)g (declaration)f(has)g(the)g(form)1165 3782 y Fl(datatype)j Fn(t)55 b Ft(=)g Fn(`)1829 3796 y Fp(1)1899 3782 y Fl(of)30 b Fn(\033)2077 3796 y Fp(1)2141 3782 y Fr(j)41 b Fn(:)15 b(:)g(:)42 b Fr(j)25 b Fn(`)2442 3797 y Fm(k)2515 3782 y Fl(of)30 b Fn(\033)2693 3797 y Fm(k)0 3964 y Ft(where)i(the)g(syn)m (tactic)h(lab)s(els)39 b Fn(`)1113 3978 y Fp(1)1152 3964 y Fn(;)15 b(:)g(:)g(:)i(;)e(`)1392 3979 y Fm(k)1475 3964 y Ft(are)33 b(used)e(in)g(the)h(same)h(w)m(a)m(y)g(as)f(in)f(v)-5 b(arian)m(t)32 b(t)m(yp)s(es)h(\(lab)s(eled)d(sums\).)0 4077 y(In)m(tuitiv)m(ely)-8 b(,)38 b(this)e(declaration)g(de\014nes)g (a)i(t)m(yp)s(e)45 b Fn(t)g Ft(that)38 b(is)e(the)h(sum)f(of)46 b Fn(\033)2648 4091 y Fp(1)2687 4077 y Fn(;)15 b(:)g(:)g(:)i(;)e(\033) 2941 4092 y Fm(k)2992 4077 y Ft(,)39 b(with)d(lab)s(els)43 b Fn(`)3578 4091 y Fp(1)3617 4077 y Fn(;)15 b(:)g(:)g(:)i(;)e(`)3857 4092 y Fm(k)0 4190 y Ft(used)34 b(as)g(injection)g(functions)f(as)h(in) g(Exercise)g(2.6.1.)55 b(If)34 b(the)g(declared)g(t)m(yp)s(e)43 b Fn(t)g Ft(o)s(ccurs)34 b(in)41 b Fn(\033)3318 4204 y Fp(1)3358 4190 y Fn(;)15 b(:)g(:)g(:)h(;)f(\033)3611 4205 y Fm(k)3663 4190 y Ft(,)35 b(then)0 4303 y(this)23 b(is)h(a)h(recursiv)m(e)f(declaration)g(of)h(t)m(yp)s(e)33 b Fn(t)8 b Ft(.)39 b(Note)26 b(that)f(the)f(v)m(ertical)h(bar)32 b Fr(j)i Ft(is)23 b(part)i(of)f(the)h(syn)m(tax)g(of)g(ML,)g(not)0 4416 y(the)34 b(meta-language)h(w)m(e)f(are)f(using)f(to)j(describ)s(e) c(ML.)j(A)g(similar)c(exercise)k(on)f(ML)h(datat)m(yp)s(e)g (declarations,)0 4528 y(using)c(algebraic)i(sp)s(eci\014cations)f (instead)g(of)h(recursiv)m(e)f(t)m(yp)s(es)h(and)g(sums,)f(app)s(ears)h (in)e(Chapter)i(3)g(\(Exercise)0 4641 y(3.6.4\).)141 4754 y(The)d(t)m(yp)s(e)h(of)g(binary)e(trees,)j(with)d(natural)h(n)m (um)m(b)s(ers)f(at)i(the)g(lea)m(v)m(es,)i(ma)m(y)e(b)s(e)f(declared)g (using)f Fl(datatype)0 4867 y Ft(b)m(y)932 4980 y Fl(datatype)g Fs(tr)-5 b(e)g(e)64 b Ft(=)55 b Fs(le)-5 b(af)50 b Fl(of)30 b Fs(nat)35 b Fr(j)25 b Fs(no)-5 b(de)38 b Fl(of)30 b Fs(tr)-5 b(e)g(e)23 b Fr(\002)15 b Fs(tr)-5 b(e)g(e)8 b Fn(:)0 5136 y Ft(Using)30 b(the)g(notation)h(for)f(v)-5 b(arian)m(ts)30 b(giv)m(en)g(in)g(Exercise)g(2.6.1,)i(this)d(declares)h (a)h(t)m(yp)s(e)39 b Fs(tr)-5 b(e)g(e)46 b Ft(satisfying)1251 5317 y Fs(tr)-5 b(e)g(e)1457 5292 y Fr(\030)1457 5321 y Ft(=)1583 5317 y([)p Fs(le)g(af)20 b Ft(:)15 b Fs(nat)10 b Fn(;)31 b Fs(no)-5 b(de)8 b Ft(:)15 b Fs(tr)-5 b(e)g(e)23 b Fr(\002)15 b Fs(tr)-5 b(e)g(e)7 b Ft(])p eop %%Page: 122 73 122 72 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(122)66 91 y(\(a\))46 b(Explain)38 b(ho)m(w)j(to)g(regard)f(a)h Fl(datatype)d Ft(declaration)i(as)g(a)h (recursiv)m(e)f(t)m(yp)s(e)g(expression)f(of)i(the)f(form)227 204 y Fn(\026t:)p Ft([)p Fn(:)15 b(:)g(:)q Ft(])35 b(using)24 b(v)-5 b(arian)m(ts)25 b(as)h(in)e(Exercise)i(2.6.1.)41 b(Illustrate)24 b(y)m(our)i(general)f(metho)s(d)g(on)h(the)g(t)m(yp)s (e)g(of)f(trees)227 317 y(ab)s(o)m(v)m(e.)61 505 y(\(b\))45 b(A)27 b(con)m(v)m(enien)m(t)g(feature)f(of)h(ML)f(is)f(the)h(w)m(a)m (y)h(that)g(pattern)f(matc)m(hing)h(ma)m(y)f(b)s(e)g(used)f(to)i (de\014ne)e(functions)227 618 y(o)m(v)m(er)33 b(declared)e(datat)m(yp)s (es.)44 b(A)31 b(function)f(o)m(v)m(er)j(trees)f(ma)m(y)f(b)s(e)g (declared)g(using)f(t)m(w)m(o)i(\\clauses,")h(one)e(for)227 731 y(eac)m(h)40 b(form)f(of)g(tree.)68 b(In)38 b(our)g(v)-5 b(arian)m(t)39 b(of)h(ML)f(syn)m(tax,)j(a)d(function)f(o)m(v)m(er)i Fs(tr)-5 b(e)g(e)7 b Ft('s)40 b(de\014ned)e(b)m(y)h(pattern)227 844 y(matc)m(hing)31 b(will)c(ha)m(v)m(e)32 b(the)f(form)1142 1040 y Fl(letrec)46 b(fun)82 b Fn(f)10 b Ft(\()p Fs(le)-5 b(af)20 b Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)10 b Ft(\)\))454 b(=)83 b Fn(M)1594 1153 y Fr(j)g Fn(f)10 b Ft(\()p Fs(no)-5 b(de)8 b Ft(\()p Fn(t)2048 1167 y Fp(1)2087 1153 y Ft(:)15 b Fs(tr)-5 b(e)g(e)8 b Fn(;)15 b(t)2350 1167 y Fp(2)2390 1153 y Ft(:)g Fs(tr)-5 b(e)g(e)8 b Ft(\)\))84 b(=)f Fn(N)1702 1266 y Fl(in)30 b Fn(P)227 1462 y Ft(where)35 b(v)-5 b(ariables)42 b Fn(x)p Ft(:)15 b Fs(nat)54 b Ft(and)43 b Fn(f)10 b Ft(:)15 b Fs(tr)-5 b(e)g(e)1607 1456 y Fr(!)1713 1462 y Fn(\033)47 b Ft(are)36 b(b)s(ound)d(in)42 b Fn(M)19 b Ft(,)45 b Fn(t)2583 1476 y Fp(1)2622 1462 y Fn(;)15 b(t)2695 1476 y Fp(2)2734 1462 y Ft(:)g Fs(tr)-5 b(e)g(e)52 b Ft(and)43 b Fn(f)53 b Ft(are)36 b(b)s(ound)d(in)42 b Fn(N)227 1575 y Ft(and)h Fn(f)52 b Ft(is)33 b(b)s(ound)g(in)g(the)i (the)f(declaration)h(b)s(o)s(dy)41 b Fn(P)21 b Ft(.)53 b(The)34 b(compiler)f(c)m(hec)m(ks)j(to)g(mak)m(e)f(sure)f(there)h(is) 227 1688 y(one)f(clause)g(for)f(eac)m(h)i(constructor)g(of)f(the)g (datat)m(yp)s(e.)51 b(F)-8 b(or)35 b(example,)f(w)m(e)h(ma)m(y)f (declare)g(a)g(function)41 b Fn(f)227 1801 y Ft(that)31 b(sums)f(up)f(the)h(v)-5 b(alues)30 b(of)h(all)e(the)h(lea)m(v)m(es)i (as)f(follo)m(ws.)938 1997 y Fl(letrec)46 b(fun)82 b Fn(f)10 b Ft(\()p Fs(le)-5 b(af)20 b Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)10 b Ft(\)\))454 b(=)83 b Fn(x)1390 2110 y Fr(j)g Fn(f)10 b Ft(\()p Fs(no)-5 b(de)8 b Ft(\()p Fn(t)1844 2124 y Fp(1)1883 2110 y Ft(:)15 b Fs(tr)-5 b(e)g(e)9 b Fn(;)15 b(t)2147 2124 y Fp(2)2186 2110 y Ft(:)g Fs(tr)-5 b(e)g(e)8 b Ft(\)\))84 b(=)f Fn(f)10 b Ft(\()p Fn(t)2807 2124 y Fp(1)2846 2110 y Ft(\))20 b(+)g Fn(f)10 b Ft(\()p Fn(t)3115 2124 y Fp(2)3154 2110 y Ft(\))227 2344 y(Explain)29 b(ho)m(w)i(to)h(regard)f(a)h(function)e(de\014nition)e(with)i(pattern)h (matc)m(hing)h(as)f(a)g(function)f(with)38 b Fk(Case)227 2457 y Ft(and)31 b(illustrate)f(y)m(our)i(general)f(metho)s(d)h(on)f (the)h(function)e(that)j(sums)d(up)h(the)h(v)-5 b(alues)30 b(of)i(all)f(the)h(lea)m(v)m(es)227 2570 y(of)f(a)g(tree.)p eop %%Page: 123 74 123 73 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(123)0 91 y Fo(2.6.4)112 b(Lifted)38 b(t)m(yp)s(es)0 263 y Ft(Lifted)30 b(t)m(yp)s(es)g(ma)m(y)h(b)s(e)f (used)g(to)h(distinguish)c(p)s(ossibly)h(non)m(terminating)h (computations)i(from)f(ones)g(that)i(are)0 376 y(guaran)m(teed)k(to)f (terminate.)54 b(W)-8 b(e)36 b(can)f(see)h(ho)m(w)f(lifted)e(t)m(yp)s (es)i(could)f(ha)m(v)m(e)i(b)s(een)e(used)g(in)f(PCF)i(b)m(y)f (recalling)0 489 y(that)k(ev)m(ery)h(term)e(that)h(do)s(es)g(not)f(con) m(tain)h Fs(\014x)49 b Ft(has)37 b(a)h(normal)f(form.)62 b(If)37 b(w)m(e)h(com)m(bine)f(basic)g(b)s(o)s(olean)g(and)0 602 y(natural)27 b(n)m(um)m(b)s(er)f(expressions,)h(pairs)f(and)h (functions,)g(w)m(e)h(therefore)g(ha)m(v)m(e)g(a)g(language)g(in)e (whic)m(h)h(ev)m(ery)h(term)0 715 y(has)j(a)h(normal)e(form.)43 b(Let)32 b(us)f(call)g(this)f(language)40 b(PCF)2005 729 y Fp(0)2052 715 y Ft(.)k(In)31 b(Section)g(2.2.5,)j(w)m(e)d (completed)h(the)f(de\014nition)0 827 y(of)37 b(PCF)g(b)m(y)g(adding)f Fs(\014x)48 b Ft(to)e(PCF)1226 841 y Fp(0)1274 827 y Ft(.)60 b(In)37 b(the)g(pro)s(cess,)h(w)m(e)g(extended)f(the)g(set)h (of)f(terms)g(of)g(eac)m(h)i(t)m(yp)s(e)e(in)f(a)0 940 y(non)m(trivial)31 b(w)m(a)m(y)-8 b(.)51 b(F)-8 b(or)34 b(example,)f(while)f(ev)m(ery)42 b(PCF)1867 954 y Fp(0)1947 940 y Ft(term)34 b(of)f(t)m(yp)s(e)42 b Fs(nat)50 b Ft(reduces)33 b(to)h(one)g(of)f(the)g(n)m(umerals)0 1053 y(0)p Fn(;)15 b Ft(1)p Fn(;)g Ft(2)p Fn(;)g(:)g(:)g(:)d Ft(,)37 b(PCF)f(con)m(tains)g (terms)f(suc)m(h)h(as)44 b Fs(\014x)27 b Ft(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b(x)p Ft(\))44 b(of)36 b(t)m(yp)s(e)45 b Fs(nat)53 b Ft(that)36 b(do)g(not)g(ha)m(v)m(e)h(an)m (y)f(normal)0 1166 y(form)43 b(and)g(are)h(not)g(pro)m(v)-5 b(ably)43 b(equal)g(to)i(an)m(y)f(n)m(umeral.)79 b(This)42 b(means)i(that)g(if)f(w)m(e)h(w)m(an)m(t)g(to)h(asso)s(ciate)g(a)0 1279 y(mathematical)38 b(v)-5 b(alue)37 b(with)g(ev)m(ery)i(PCF)e (term,)j(w)m(e)f(cannot)f(think)e(of)i(the)g(v)-5 b(alues)38 b(of)g(t)m(yp)s(e)46 b Fs(nat)55 b Ft(as)38 b(simply)0 1392 y(the)28 b(natural)e(n)m(um)m(b)s(ers.)39 b(W)-8 b(e)28 b(m)m(ust)g(consider)e(some)i(sup)s(erset)f(of)g(the)h(natural)f (n)m(um)m(b)s(ers)f(that)i(con)m(tains)g(v)-5 b(alues)0 1505 y(for)33 b(all)g(the)g(terms)h(without)e(normal)h(form.)49 b(\(Since)33 b(it)g(is)f(v)m(ery)i(reasonable)g(to)g(giv)m(e)g(all)40 b Fs(nat)52 b Ft(terms)33 b(without)0 1618 y(normal)26 b(form)h(the)h(same)g(v)-5 b(alue,)28 b(w)m(e)g(only)e(need)h(one)h (new)f(v)-5 b(alue,)28 b(represen)m(ting)f(non)m(termination,)g(in)f (addition)0 1731 y(to)k(the)f(usual)e(natural)h(n)m(um)m(b)s(ers.\))39 b(An)29 b(alternativ)m(e)g(w)m(a)m(y)h(of)f(extending)37 b(PCF)2752 1745 y Fp(0)2828 1731 y Ft(with)28 b(a)h(\014xed-p)s(oin)m (t)f(op)s(erator)0 1844 y(is)23 b(to)i(use)f(lifted)f(t)m(yp)s(es.)39 b(Although)23 b(lifted)g(t)m(yp)s(es)h(are)h(sometimes)f(syn)m (tactically)h(cum)m(b)s(ersome,)g(when)e(it)h(comes)0 1957 y(to)k(writing)d(common)i(functions)f(or)h(programs,)h(lifted)e(t) m(yp)s(es)h(ha)m(v)m(e)h(some)g(theoretical)f(adv)-5 b(an)m(tages)29 b(since)e(they)0 2070 y(let)j(us)g(clearly)g(iden)m (tify)e(the)j(sources)f(of)h(non)m(termination,)e(or)i (\\unde\014nedness,")e(in)g(expressions.)141 2182 y(One)37 b(reason)g(to)g(use)g(lifted)e(t)m(yp)s(es)i(is)f(that)h(man)m(y)g (equational)g(axioms)f(that)i(are)f(inconsisten)m(t)f(with)g Fs(\014x)0 2295 y Ft(ma)m(y)g(b)s(e)e(safely)g(com)m(bined)h(with)e (lifted)h(t)m(yp)s(es.)54 b(One)35 b(example,)h(whic)m(h)d(is)h (related)h(to)h(the)f(inconsistency)f(of)0 2408 y(sum)29 b(t)m(yp)s(es)i(and)f Fs(\014x)41 b Ft(outlined)29 b(in)g(Exercise)h (2.6.4,)i(is)e(the)g(pair)f(of)i(equations)882 2601 y Fs(Eq)8 b Ft(?)24 b Fn(x)h(x)320 b Ft(=)83 b Fs(true)7 b Fn(;)882 2714 y Fs(Eq)h Ft(?)24 b Fn(x)h Ft(\()p Fn(n)c Ft(+)f Fn(x)p Ft(\))83 b(=)g Fs(false)98 b Ft(n)m(umeral)29 b Fn(n)h Ft(di\013eren)m(t)g(from)g(0.)0 2907 y(While)f(these)h (equations)f(mak)m(e)i(go)s(o)s(d)e(sense)h(for)g(the)g(ordinary)e (natural)g(n)m(um)m(b)s(ers,)h(it)g(is)g(inconsisten)m(t)g(to)i(add)0 3020 y(them)k(to)g(PCF.)g(T)-8 b(o)35 b(see)g(this,)g(the)g(reader)f (ma)m(y)h(substitute)42 b Fs(\014x)27 b Ft(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b Ft(1)24 b(+)e Fn(x)p Ft(\))44 b(for)e Fn(x)h Ft(in)33 b(b)s(oth)h(equations)0 3132 y(and)39 b(deriv)m(e)48 b Fs(true)h Ft(=)41 b Fn(f)10 b(al)r(se)e Ft(.)69 b(In)39 b(con)m(trast,)45 b(it)39 b(follo)m(ws)g(from)h(the)g(seman)m(tic)h(construction)e(in)g(Section)h (5.2)0 3245 y(that)h(w)m(e)f(ma)m(y)h(consisten)m(tly)f(add)g(these)g (t)m(w)m(o)i(equations)e(to)g(the)h(v)-5 b(arian)m(t)40 b(of)g(PCF)g(with)f(lifted)g(t)m(yp)s(es)h(\(see)0 3358 y(Example)30 b(2.6.10\).)141 3471 y(Another)35 b(imp)s(ortan)m(t)g (reason)g(to)h(consider)e(lifted)g(t)m(yp)s(es)h(is)f(that)i(this)e (pro)m(vides)g(an)h(in)m(teresting)f(and)h(in-)0 3584 y(sigh)m(tful)40 b(w)m(a)m(y)j(to)g(incorp)s(orate)e(alternativ)m(e)h (reduction)f(orders)g(in)m(to)h(a)g(single)f(system.)75 b(In)41 b(particular,)j(as)0 3697 y(w)m(e)32 b(shall)f(see)h(b)s(elo)m (w,)g(b)s(oth)f(ordinary)f(\(nondeterministic)g(or)i(leftmost\))g(PCF)g (and)f(Eager)i(PCF)e(\(de\014ned)g(in)0 3810 y(Section)h(2.4.5\))i(can) e(b)s(e)f(expressed)g(in)g(PCF)g(with)g(lifted)f(t)m(yp)s(es.)45 b(This)30 b(has)i(an)f(in)m(teresting)h(consequence)g(for)0 3923 y(equational)h(reasoning)h(ab)s(out)f(eager)i(reduction.)50 b(The)34 b(equational)f(theory)h(of)g(Eager)h(PCF)e(is)g(not)h(giv)m (en)g(in)0 4036 y(Section)39 b(2.4.5)h(since)e(it)h(is)e(relativ)m(ely) h(subtle)g(and)g(has)h(a)g(di\013eren)m(t)f(form)g(from)h(the)f (equational)h(theory)g(of)0 4149 y(PCF.)33 b(An)g(adv)-5 b(an)m(tage)36 b(of)d(lifted)f(t)m(yp)s(es)h(is)f(that)i(w)m(e)g(ma)m (y)g(essen)m(tially)e(express)h(eager)i(reduction,)e(and)g(at)h(the)0 4262 y(same)h(time)f(allo)m(w)h(ordinary)e(equational)h(reasoning.)53 b(In)34 b(particular,)g(equational)h(axioms)f(ma)m(y)h(b)s(e)f(used)g (to)0 4374 y(\\optimize")i(a)g(term)g(without)e(c)m(hanging)i(its)f (normal)f(form.)57 b(This)33 b(follo)m(ws)i(from)g(con\015uence)h(of)g (PCF)f(with)0 4487 y(lifted)g(t)m(yp)s(es)h([Ho)m(w92)r(].)58 b(These)36 b(adv)-5 b(an)m(tages)38 b(not)m(withstanding,)f(the)f(use)g (of)g(lifted)f(t)m(yp)s(es)h(in)f(programming)0 4600 y(language)27 b(analysis)e(is)g(a)i(relativ)m(ely)e(recen)m(t)j(dev)m (elopmen)m(t)f(and)e(some)i(syn)m(tactic)h(and)d(seman)m(tic)i(issues)e (remain)0 4713 y(unresolv)m(ed.)40 b(Consequen)m(tly)-8 b(,)30 b(this)f(section)i(will)c(b)s(e)j(a)h(high-lev)m(el)e(and)h (somewhat)h(informal)d(o)m(v)m(erview.)141 4826 y(The)i(t)m(yp)s(es)g (of)h(the)g(language)39 b(PCF)1402 4841 y Fi(?)1470 4826 y Ft(,)30 b(called)g(\\PCF)h(with)e(lifted)f(t)m(yp)s(es,")k(are)e(giv) m(en)h(b)m(y)f(the)h(grammar)1200 5027 y Fn(\033)89 b Ft(::=)d Fs(b)-5 b(o)g(ol)37 b Fr(j)25 b Fs(nat)35 b Fr(j)25 b Fn(\033)19 b Fr(\002)c Fn(\033)28 b Fr(j)d Fn(\033)2352 5021 y Fr(!)2458 5027 y Fn(\033)j Fr(j)e Fn(\033)2641 5042 y Fi(?)0 5227 y Ft(These)33 b(are)g(the)g(t)m(yp)s (es)f(of)h(PCF,)g(plus)e(the)i(form)40 b Fn(\033)1803 5242 y Fi(?)1903 5227 y Ft(whic)m(h)32 b(is)g(read)g(\\)8 b Fn(\033)45 b Ft(lifted.")i(In)m(tuitiv)m(ely)-8 b(,)33 b(the)g(elemen)m(ts)0 5340 y(of)k Fn(\033)162 5355 y Fi(?)258 5340 y Ft(are)29 b(the)g(same)g(as)g(the)g(elemen)m(ts)g(of)38 b Fn(\033)12 b Ft(,)28 b(plus)f(the)i(p)s(ossibilit)m(y)c(of)k(\\non)m (termination")g(or)f(\\div)m(ergence".)p eop %%Page: 124 75 124 74 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(124)0 91 y(Mathematically)-8 b(,)31 b(w)m(e)f(can)g(in)m(terpret)38 b Fn(\033)1405 106 y Fi(?)1502 91 y Ft(as)30 b(the)g(union)e(of)38 b Fn(\033)j Ft(and)30 b(one)g(extra)g(elemen)m(t,)h(written)37 b Fr(?)3560 105 y Fm(\033)3615 91 y Ft(,)30 b(whic)m(h)0 204 y(serv)m(es)h(as)g(the)f(v)-5 b(alue)30 b(of)g(an)m(y)h(\\div)m (ergen)m(t")h(term)e(that)h(is)f(not)g(equal)g(to)h(an)f(elemen)m(t)h (of)g(t)m(yp)s(e)39 b Fn(\033)12 b Ft(.)141 317 y(The)27 b(terms)h(of)36 b(PCF)871 332 y Fi(?)966 317 y Ft(include)26 b(all)g(of)i(the)f(general)h(forms)f(of)g(PCF,)h(extended)g(to)36 b(PCF)3240 332 y Fi(?)3335 317 y Ft(t)m(yp)s(es.)k(Sp)s(eci\014-)0 430 y(cally)-8 b(,)29 b(w)m(e)g(ha)m(v)m(e)h(pairing,)d(pro)5 b(jection,)29 b(lam)m(b)s(da)f(abstraction)h(and)f(application)f(for)h (all)g(pro)s(duct)f(and)h(function)0 543 y(t)m(yp)s(es.)61 b(Since)37 b(w)m(e)h(can)f(use)45 b Fl(if)63 b Fn(:)15 b(:)g(:)64 b Fl(then)d Fn(:)15 b(:)g(:)64 b Fl(else)e Fn(:)15 b(:)g(:)47 b Ft(on)37 b(all)f(t)m(yp)s(es)h(in)f(PCF,)i(w)m(e)f (extend)h(this)e(to)i(all)0 656 y(PCF)187 671 y Fi(?)297 656 y Ft(t)m(yp)s(es.)78 b(More)44 b(sp)s(eci\014cally)-8 b(,)53 b Fl(if)47 b Fn(M)58 b Fl(then)47 b Fn(N)57 b Fl(else)47 b Fn(P)64 b Ft(is)42 b(w)m(ell-formed)g(whenev)m(er)51 b Fn(M)10 b Ft(:)15 b Fs(b)-5 b(o)g(ol)63 b Ft(and)0 769 y Fn(N)5 b(;)15 b(P)e Ft(:)i Fn(\033)d Ft(,)33 b(for)f(an)m(y)41 b Fn(\033)12 b Ft(.)46 b(Ho)m(w)m(ev)m(er,)35 b(the)e(basic)f(natural)f (n)m(um)m(b)s(er)g(and)h(b)s(o)s(olean)f(functions)g(of)h(PCF)h(\(n)m (umerals,)0 882 y(b)s(o)s(olean)c(constan)m(ts,)i(addition)d(and)h (equalit)m(y)g(test\))i(k)m(eep)f(the)g(same)g(t)m(yp)s(es)g(as)g(in)e (PCF.)i(F)-8 b(or)30 b(example,)38 b(5)20 b(+)e Fn(x)0 995 y Ft(is)32 b(a)42 b Fs(nat)51 b Ft(expression)33 b(of)41 b(PCF)1102 1010 y Fi(?)1203 995 y Ft(if)g Fn(x)p Ft(:)15 b Fs(nat)j Ft(;)35 b(it)e(is)f(not)i(an)f(expression)f(of)i(t)m (yp)s(e)41 b Fs(nat)2977 1010 y Fi(?)3044 995 y Ft(.)50 b(The)33 b(equational)g(and)0 1108 y(reduction)j(axioms)h(for)f(all)g (of)h(these)h(op)s(erations)e(are)h(the)g(same)h(as)f(for)g(PCF.)g(The) f(language)46 b(PCF)3644 1123 y Fi(?)3748 1108 y Ft(also)0 1220 y(has)35 b(t)m(w)m(o)h(op)s(erations)f(asso)s(ciated)g(with)f (lifted)f(t)m(yp)s(es)i(and)g(a)g(restricted)g(\014xed-p)s(oin)m(t)f (op)s(erator.)55 b(Since)34 b(b)s(oth)0 1333 y(in)m(v)m(olv)m(e)j(a)g (class)g(of)g(t)m(yp)s(es)f(called)g(the)h(\\p)s(oin)m(ted")g(t)m(yp)s (es,)h(w)m(e)g(discuss)d(these)i(b)s(efore)f(giving)g(the)h(remaining)0 1446 y(basic)30 b(op)s(erations)f(of)i(the)g(language.)141 1559 y(In)m(tuitiv)m(ely)-8 b(,)27 b(the)g(p)s(oin)m(ted)g(t)m(yp)s(es) g(of)35 b(PCF)1609 1574 y Fi(?)1704 1559 y Ft(are)27 b(the)g(t)m(yp)s(es)h(that)f(con)m(tain)h(terms)f(whic)m(h)f(do)h(not)g (yield)f(an)m(y)0 1672 y(meaningful)j(computational)i(v)-5 b(alue.)43 b(More)32 b(precisely)-8 b(,)31 b(w)m(e)h(can)g(sa)m(y)g (that)g(a)g(closed)f(term)39 b Fn(M)10 b Ft(:)15 b Fn(\033)44 b Ft(is)30 b Fs(noninfor-)0 1785 y(mative)45 b Ft(if,)39 b(for)f(ev)m(ery)h(con)m(text)48 b Fr(C)5 b Ft([)38 b(])46 b(of)38 b(observ)-5 b(able)38 b(t)m(yp)s(e,)i(if)45 b Fr(C)5 b Ft([)p Fn(M)10 b Ft(])47 b(has)38 b(a)g(normal)f(form,)i(then) 46 b Fr(C)5 b Ft([)p Fn(N)10 b Ft(])47 b(has)0 1898 y(the)37 b(same)g(normal)f(form)g(for)h(ev)m(ery)g(closed)45 b Fn(N)10 b Ft(:)15 b Fn(\033)d Ft(.)60 b(\(An)37 b(example)f (noninformativ)m(e)g(term)g(is)45 b Fs(\014x)11 b Ft(\()p Fn(\025x)p Ft(:)k Fn(\033)t(:)g(x)p Ft(\))8 b(;)0 2011 y(see)33 b(Lemma)f(2.5.24.\))49 b(F)-8 b(ormally)g(,)33 b(w)m(e)g(sa)m(y)f(a)h(t)m(yp)s(e)41 b Fn(\033)i Fs(is)35 b(p)-5 b(ointe)g(d)43 b Ft(if)31 b(either)40 b Fn(\033)32 b Fr(\021)c Fn(\034)2897 2026 y Fi(?)2964 2011 y Ft(,)41 b Fn(\033)32 b Fr(\021)c Fn(\033)3265 2025 y Fp(1)3319 2011 y Fr(\002)15 b Fn(\033)3457 2025 y Fp(2)3537 2011 y Ft(and)32 b(b)s(oth)0 2124 y Fn(\033)52 2138 y Fp(1)91 2124 y Fn(;)15 b(\033)183 2138 y Fp(2)267 2124 y Ft(are)35 b(p)s(oin)m(ted,)h(or)43 b Fn(\033)37 b Fr(\021)c Fn(\033)1152 2138 y Fp(1)1206 2118 y Fr(!)1312 2124 y Fn(\033)1364 2138 y Fp(2)1447 2124 y Ft(and)43 b Fn(\033)1689 2138 y Fp(2)1772 2124 y Ft(is)34 b(p)s(oin)m(ted.)54 b(The)34 b(reason)44 b Fn(\034)2774 2139 y Fi(?)2876 2124 y Ft(has)35 b(noninformativ)m(e)f(terms)0 2237 y(will)h(b)s(ecome)i(apparen)m(t)h (from)f(the)g(t)m(yp)s(e)h(of)f(the)h(\014xed-p)s(oin)m(t)e(op)s (erator.)61 b(F)-8 b(or)38 b(a)g(pro)s(duct)45 b Fn(\033)3319 2251 y Fp(1)3373 2237 y Fr(\002)15 b Fn(\033)3511 2251 y Fp(2)3559 2237 y Ft(,)39 b(w)m(e)f(can)0 2350 y(write)g(a)i (noninformativ)m(e)d(term)i(b)m(y)g(com)m(bining)f(noninformativ)m(e)f (terms)i(of)g(t)m(yp)s(es)48 b Fn(\033)3091 2364 y Fp(1)3177 2350 y Ft(and)f Fn(\033)3423 2364 y Fp(2)3471 2350 y Ft(.)66 b(If)47 b Fn(M)10 b Ft(:)15 b Fn(\033)3860 2364 y Fp(2)0 2462 y Ft(is)37 b(noninformativ)m(e,)h(and)46 b Fn(x)p Ft(:)15 b Fn(\033)1099 2476 y Fp(1)1185 2462 y Ft(is)36 b(not)i(free)g(in)45 b Fn(M)19 b Ft(,)39 b(then)46 b Fn(\025x)p Ft(:)15 b Fn(\033)2347 2476 y Fp(1)2387 2462 y Fn(:)g(M)57 b Ft(is)36 b(a)j(noninformativ)m(e)d(term)i(of)g(t)m (yp)s(e)0 2575 y Fn(\033)52 2589 y Fp(1)107 2569 y Fr(!)213 2575 y Fn(\033)265 2589 y Fp(2)312 2575 y Ft(.)52 b(The)34 b(name)g(\\p)s(oin)m(ted,")h(whic)m(h)e(is)g(not)h(v)m(ery)h (descriptiv)m(e,)f(comes)h(from)f(the)g(fact)h(that)g(a)f(p)s(oin)m (ted)0 2688 y(t)m(yp)s(e)d(has)f(a)g(distinguished)d(elemen)m(t)k(\(or) g(\\p)s(oin)m(t"\))f(represen)m(ting)g(the)g(v)-5 b(alue)30 b(of)h(an)m(y)f(noninformativ)m(e)f(term.)141 2801 y(The)h(language)39 b(PCF)902 2816 y Fi(?)1000 2801 y Ft(has)30 b(a)g(\014xed-p)s(oin)m(t)g (constan)m(t)h(for)f(eac)m(h)i(p)s(oin)m(ted)d(t)m(yp)s(e:)1354 3005 y Fs(\014x)1458 3027 y Fm(\033)1505 3005 y Ft(:)15 b(\()p Fn(\033)1651 2999 y Fr(!)1757 3005 y Fn(\033)s Ft(\))1862 2999 y Fr(!)1969 3005 y Fn(\033)133 b(\033)42 b Ft(p)s(oin)m(ted)0 3210 y(The)30 b(equational)g(axiom)g(and)g (reduction)f(axiom)h(for)39 b Fs(\014x)50 b Ft(are)30 b(as)h(in)e(PCF.)141 3323 y(The)h(\014rst)g(term)g(form)g(asso)s (ciated)h(with)e(lifted)g(t)m(yp)s(es)h(is)g(that)g(if)38 b Fn(M)10 b Ft(:)15 b Fn(\033)d Ft(,)31 b(then)1772 3527 y Fr(b)p Fn(M)10 b Fr(c)p Ft(:)15 b Fn(\033)2042 3542 y Fi(?)2103 3527 y Fn(:)0 3731 y Ft(In)m(tuitiv)m(ely)-8 b(,)38 b(since)f(the)g(elemen)m(ts)g(of)46 b Fn(\033)i Ft(are)38 b(included)c(in)44 b Fn(\033)2160 3746 y Fi(?)2228 3731 y Ft(,)39 b(the)e(term)46 b Fr(b)p Fn(M)10 b Fr(c)46 b Ft(de\014nes)36 b(an)h(elemen)m(t)h(of)45 b Fn(\033)12 b Ft(,)0 3844 y(considered)25 b(as)i(an)g(elemen)m(t)g(of)35 b Fn(\033)1164 3859 y Fi(?)1231 3844 y Ft(.)40 b(The)26 b(second)g(term)h(form)f(asso)s(ciated)h(with)f(lifting)e(allo)m(ws)i (us)g(to)h(ev)-5 b(aluate)0 3957 y(expressions)37 b(of)46 b Fn(\033)653 3972 y Fi(?)759 3957 y Ft(to)38 b(obtain)g(expressions)f (of)h(t)m(yp)s(e)46 b Fn(\033)12 b Ft(.)64 b(Since)37 b(some)h(terms)g(of)h(t)m(yp)s(e)46 b Fn(\033)3259 3972 y Fi(?)3364 3957 y Ft(do)38 b(not)h(de\014ne)0 4070 y(elemen)m(ts)h(of) 48 b Fn(\033)12 b Ft(,)41 b(this)e(is)f(formalized)g(in)h(a)h(careful)e (w)m(a)m(y)-8 b(.)70 b(If)47 b Fn(M)10 b Ft(:)15 b Fn(\033)2413 4085 y Fi(?)2520 4070 y Ft(and)48 b Fn(N)10 b Ft(:)15 b Fn(\034)j Ft(,)42 b(with)47 b Fn(\034)57 b Ft(p)s(oin)m(ted)39 b(and)47 b Fn(N)0 4183 y Ft(p)s(ossibly)27 b(con)m(taining)j(a)h(v)-5 b(ariable)38 b Fn(x)g Ft(of)31 b(t)m(yp)s(e)39 b Fn(\033)12 b Ft(,)30 b(then)1494 4387 y Fl(let)47 b Fr(b)p Fn(x)p Ft(:)15 b Fn(\033)s Fr(c)26 b Ft(=)f Fn(M)58 b Fl(in)47 b Fn(N)0 4591 y Ft(is)27 b(a)i(term)f(of)h(t)m(yp)s(e)37 b Fn(\034)18 b Ft(.)40 b(The)28 b(reader)g(familiar)e(with)h(ML)h(ma)m (y)h(recognize)g(this)f(syn)m(tax)h(as)f(a)h(form)f(of)g(\\pattern-)0 4704 y(matc)m(hing")e Fl(let)p Ft(.)38 b(In)m(tuitiv)m(ely)-8 b(,)25 b(the)h(in)m(ten)m(t)f(of)34 b Fl(let)47 b Fr(b)p Fn(x)p Ft(:)15 b Fn(\033)s Fr(c)26 b Ft(=)f Fn(M)58 b Fl(in)47 b Fn(N)d Ft(is)24 b(that)i(w)m(e)f(\\hop)s(e")h(that)34 b Fn(M)43 b Ft(is)24 b(equal)0 4817 y(to)43 b Fr(b)p Fn(M)261 4784 y Fi(0)285 4817 y Fr(c)f Ft(for)34 b(some)43 b Fn(M)848 4784 y Fi(0)879 4817 y Ft(.)52 b(If)33 b(so,)j(then)d(the)h (v)-5 b(alue)34 b(of)g(this)f(expression)g(is)g(the)h(v)-5 b(alue)33 b(of)43 b Fn(N)52 b Ft(when)41 b Fn(x)h Ft(has)34 b(the)0 4930 y(v)-5 b(alue)30 b(of)39 b Fn(M)445 4897 y Fi(0)476 4930 y Ft(.)141 5043 y(The)30 b(main)f(equational)h(axiom)g (for)39 b Fr(b)31 b(c)39 b Ft(and)f Fl(let)f Ft(is)39 5247 y(\()p Fl(let)29 b Fr(b)i(c)p Ft(\))792 b Fl(let)47 b Fr(b)p Fn(x)p Ft(:)15 b Fn(\033)s Fr(c)27 b Ft(=)e Fr(b)p Fn(M)10 b Fr(c)48 b Fl(in)g Fn(N)95 b Ft(=)86 b([)p Fn(M)5 b(=x)p Ft(])p Fn(N)p eop %%Page: 125 76 125 75 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(125)0 91 y(This)30 b(is)h(also)g(used)g(as)h(a)g (reduction)f(axiom,)h(read)f(left)h(to)g(righ)m(t.)44 b(In)m(tuitiv)m(ely)-8 b(,)31 b(the)h(v)-5 b(alue)31 b(of)40 b Fn(M)10 b Ft(:)15 b Fn(\033)3480 106 y Fi(?)3580 91 y Ft(is)30 b(either)0 204 y Fr(?)39 b Ft(or)30 b(an)h(elemen)m(t)g (of)39 b Fn(\033)12 b Ft(.)42 b(If)c Fn(M)e Ft(=)p Fr(?)8 b Ft(,)31 b(then)39 b Fl(let)47 b Fr(b)p Fn(x)p Ft(:)15 b Fn(\033)s Fr(c)27 b Ft(=)e Fn(M)58 b Fl(in)47 b Fn(N)i Ft(will)28 b(ha)m(v)m(e)k(v)-5 b(alue)39 b Fr(?)3221 218 y Fm(\034)3272 204 y Ft(.)j(In)30 b(op)s(erational)0 317 y(terms,)35 b(if)41 b Fn(M)53 b Ft(cannot)34 b(b)s(e)g(reduced)f (to)i(the)f(form)42 b Fr(b)p Fn(M)1930 284 y Fi(0)1954 317 y Fr(c)8 b Ft(,)36 b(then)42 b Fl(let)k Fr(b)p Fn(x)p Ft(:)15 b Fn(\033)s Fr(c)33 b Ft(=)e Fn(M)58 b Fl(in)47 b Fn(N)52 b Ft(not)35 b(b)s(e)e(reducible)0 430 y(to)e(a)f(useful)e (form)i(of)g(t)m(yp)s(e)39 b Fn(\034)18 b Ft(.)41 b(If)c Fn(M)49 b Ft(is)29 b(equal)g(to)i(some)39 b Fr(b)p Fn(M)2151 397 y Fi(0)2175 430 y Fr(c)8 b Ft(,)31 b(then)e(the)i(v)-5 b(alue)29 b(of)39 b Fl(let)46 b Fr(b)p Fn(x)p Ft(:)15 b Fn(\033)s Fr(c)27 b Ft(=)e Fn(M)58 b Fl(in)47 b Fn(N)0 543 y Ft(is)29 b(equal)h(to)40 b([)p Fn(M)574 510 y Fi(0)597 543 y Fn(=x)p Ft(])p Fn(N)19 b Ft(.)141 656 y(If)38 b(w)m(e)h(add)e(a)i (constan)m(t)48 b Fr(?)1104 670 y Fm(\034)1147 656 y Ft(:)38 b Fn(\034)57 b Ft(represen)m(ting)38 b(\\unde\014nedness")e(or) i(non)m(termination)g(at)h(eac)m(h)g(p)s(oin)m(ted)0 769 y(t)m(yp)s(e)g Fn(\034)18 b Ft(,)31 b(w)m(e)g(can)f(also)h(state)g (some)g(other)g(equational)f(prop)s(erties.)1268 973 y(\()p Fl(let)47 b Fr(b)p Fn(x)p Fr(c)27 b Ft(=)p Fr(?)1795 987 y Fm(\033)1835 999 y Fa(?)1964 973 y Fl(in)47 b Fn(M)10 b Ft(\))116 b(=)91 b Fr(?)2589 987 y Fm(\034)1279 1177 y Fn(M)36 b Fr(?)1474 1191 y Fm(\033)1514 1203 y Fa(?)1570 1177 y Ft(=)25 b Fn(N)35 b Fr(?)1845 1191 y Fm(\033)1885 1203 y Fa(?)2058 1177 y Fn(M)10 b Fr(b)p Fn(x)p Fr(c)26 b Ft(=)f Fn(N)10 b Fr(b)p Fn(x)p Fr(c)p 1279 1218 1347 4 v 1801 1300 a Fn(M)36 b Ft(=)25 b Fn(N)2669 1239 y(x)30 b Ft(not)h(free)f(in)g Fn(M)5 b(;)15 b(N)10 b Ft(:)15 b Fn(\033)3502 1254 y Fi(?)3587 1239 y Fr(!)25 b Fn(\034)0 1466 y Ft(In)m(tuitiv)m(ely)-8 b(,)30 b(the)g(\014rst)g(equation)g (re\015ects)h(the)g(fact)g(that)g(if)f(w)m(e)h(cannot)g(reduce)38 b Fn(M)49 b Ft(to)31 b(the)g(form)38 b Fr(b)p Fn(M)3595 1433 y Fi(0)3619 1466 y Fr(c)8 b Ft(,)31 b(then)0 1579 y Fl(let)47 b Fr(b)p Fn(x)p Fr(c)30 b Ft(=)e Fn(M)58 b Fl(in)47 b Fn(N)k Ft(is)32 b(\\unde\014ned.")46 b(The)32 b(inference)f(rule)h(is)f(a)i(form)f(of)h(reasoning)f(b)m(y)h(cases,)h (based)e(on)0 1692 y(the)39 b(in)m(tuitiv)m(e)e(idea)i(that)g(an)m(y)g (elemen)m(t)g(of)g(a)g(lifted)e(t)m(yp)s(e)47 b Fn(\033)2176 1707 y Fi(?)2282 1692 y Ft(is)38 b(either)g(the)h(result)f(of)g (lifting)f(an)h(elemen)m(t)0 1805 y(of)32 b(t)m(yp)s(e)40 b Fn(\033)j Ft(or)32 b(the)g(v)-5 b(alue)39 b Fr(?)1000 1820 y Fm(\033)r Fi(?)1142 1805 y Ft(represen)m(ting)31 b(\\unde\014nedness")f(or)h(non)m(termination)g(at)h(t)m(yp)s(e)40 b Fn(\033)12 b Ft(.)45 b(Ho)m(w)m(ev)m(er,)0 1918 y(w)m(e)40 b(will)c(not)k(use)f(constan)m(ts)i(of)e(the)h(form)47 b Fr(?)1653 1932 y Fm(\034)1743 1918 y Ft(or)39 b(either)g(of)h(these)g (prop)s(erties)d(in)h(the)i(remainder)e(of)h(this)0 2030 y(section.)h(In)29 b(general,)g(they)g(are)h(not)f(esp)s(ecially)e (useful)g(for)i(pro)m(ving)f(equations)g(b)s(et)m(w)m(een)i (expressions)e(unless)0 2143 y(w)m(e)j(ha)m(v)m(e)g(a)f(more)h(p)s(o)m (w)m(erful)d(pro)s(of)h(system)i(\(suc)m(h)f(as)g(the)g(one)h(using)d (\014xed-p)s(oin)m(t)h(induction)f(in)h(Section)g(5.3\))0 2256 y(for)h(pro)m(ving)g(that)h(terms)f(are)h(equal)f(to)39 b Fr(?)8 b Ft(.)141 2369 y(W)-8 b(e)32 b(will)d(illustrate)g(the)i(use) g(of)g(lifted)e(t)m(yp)s(es)i(b)m(y)g(translating)f(b)s(oth)h(PCF)f (and)h(Eager)g(PCF)g(in)m(to)40 b(PCF)3807 2384 y Fi(?)3875 2369 y Ft(.)0 2482 y(A)25 b(n)m(um)m(b)s(er)e(of)i(in)m(teresting)g (relationships)d(b)s(et)m(w)m(een)j(lifted)e(t)m(yp)s(es)i(and)f(sums)g (and)g(recursiv)m(e)h(t)m(yp)s(es)f(are)i(b)s(ey)m(ond)0 2595 y(the)g(scop)s(e)g(of)h(this)e(section)h(but)f(ma)m(y)i(b)s(e)f (found)e(in)h([Ho)m(w92)r(],)i(for)f(example.)39 b(Before)27 b(pro)s(ceeding,)f(w)m(e)h(consider)0 2708 y(some)k(simple)d(examples.) 0 2920 y Fk(Example)34 b(2.6.9)46 b Ft(While)38 b(there)h(is)f(only)g (one)h(natural)f(w)m(a)m(y)i(to)g(write)e(factorial)h(in)e(PCF,)i (there)g(are)h(some)0 3033 y(c)m(hoices)24 b(with)e(explicit)g (lifting.)36 b(This)22 b(example)h(sho)m(ws)g(t)m(w)m(o)h(essen)m (tially)f(equiv)-5 b(alen)m(t)23 b(w)m(a)m(ys)h(of)f(writing)f (factorial.)0 3146 y(F)-8 b(or)23 b(simplicit)m(y)-8 b(,)23 b(w)m(e)g(assume)f(w)m(e)i(ha)m(v)m(e)f(natural)f(n)m(um)m(b)s (er)g(subtraction)g(and)g(m)m(ultiplication)d(op)s(erations)j(so)h (that)0 3259 y(if)38 b Fn(M)5 b(;)15 b(N)10 b Ft(:)15 b Fs(nat)k Ft(,)31 b(then)39 b Fn(M)30 b Fr(\000)21 b Fn(N)10 b Ft(:)15 b Fs(nat)48 b Ft(and)39 b Fn(M)31 b Fr(\003)21 b Fn(N)10 b Ft(:)15 b Fs(nat)j Ft(.)42 b(Using)30 b(these,)i(w)m(e)f(can)g(write)f(a)h(factorial)g(function)f(as)0 3395 y Fs(fact)155 3417 y Fp(1)220 3340 y Fj(def)237 3395 y Ft(=)42 b Fs(\014x)455 3417 y Fj(nat)573 3413 y Fi(!)655 3417 y Fj(nat)761 3429 y Fa(?)818 3395 y Fn(F)876 3409 y Fp(1)924 3395 y Ft(,)31 b(where)587 3638 y Fn(F)645 3652 y Fp(1)768 3583 y Fj(def)786 3638 y Ft(=)100 b Fn(\025f)10 b Ft(:)15 b Fs(nat)1256 3632 y Fr(!)1362 3638 y Fs(nat)1498 3653 y Fi(?)1557 3638 y Fn(:)h(\025x)p Ft(:)f Fs(nat)10 b Fn(:)957 3751 y Fl(if)47 b Fs(Eq)8 b Ft(?)14 b Fn(x)h Ft(0)49 b Fl(then)d Fr(b)p Ft(1)p Fr(c)j Fl(else)e(let)g Fr(b)p Fn(y)s Fr(c)26 b Ft(=)f Fn(f)10 b Ft(\()p Fn(x)20 b Fr(\000)f Ft(1\))49 b Fl(in)e Fr(b)p Fn(x)21 b Fr(\003)f Fn(y)s Fr(c)0 3948 y Ft(In)32 b(the)h(de\014nition)d(here,)j(the)g(t)m (yp)s(e)g(of)f Fs(fact)42 b Ft(is)e Fs(nat)1818 3942 y Fr(!)1924 3948 y Fs(nat)2061 3963 y Fi(?)2128 3948 y Ft(.)47 b(This)31 b(is)h(a)h(p)s(oin)m(ted)e(t)m(yp)s(e,)j(whic)m(h)d (is)h(imp)s(ortan)m(t)0 4061 y(since)25 b(w)m(e)h(only)f(ha)m(v)m(e)i (\014xed)e(p)s(oin)m(ts)g(at)h(p)s(oin)m(ted)f(t)m(yp)s(es.)39 b(This)24 b(t)m(yp)s(e)i(for)34 b Fs(fact)2636 4082 y Fp(1)2709 4061 y Ft(is)25 b(also)h(the)g(t)m(yp)s(e)g(of)g(the)g(lam)m (b)s(da-)0 4174 y(b)s(ound)e(v)-5 b(ariable)34 b Fn(f)43 b Ft(in)34 b Fn(F)879 4188 y Fp(1)927 4174 y Ft(.)39 b(Since)34 b Fn(f)10 b Ft(:)15 b Fs(nat)1479 4168 y Fr(!)1585 4174 y Fs(nat)1721 4189 y Fi(?)1789 4174 y Ft(,)27 b(w)m(e)g(can)f (apply)33 b Fn(f)44 b Ft(to)27 b(argumen)m(ts)g(of)f(t)m(yp)s(e)35 b Fs(nat)17 b Ft(.)40 b(Ho)m(w)m(ev)m(er,)0 4286 y(the)f(result)45 b Fn(f)10 b Ft(\()p Fn(x)26 b Fr(\000)f Ft(1\))48 b(of)38 b(calling)46 b Fn(f)56 b Ft(will)35 b(b)s(e)j(an)h(elemen)m(t)g(of)47 b Fs(nat)2389 4301 y Fi(?)2456 4286 y Ft(,)41 b(and)d(therefore)h(w)m (e)g(m)m(ust)f(use)h Fl(let)e Ft(to)0 4399 y(extract)g(the)f(natural)f (n)m(um)m(b)s(er)g(v)-5 b(alue)35 b(from)h(the)g(recursiv)m(e)f(call)g (b)s(efore)h(m)m(ultiplying)c(b)m(y)44 b Fn(x)8 b Ft(.)57 b(If)36 b(w)m(e)g(wish)e(to)0 4512 y(apply)j Fs(fact)413 4534 y Fp(1)491 4512 y Ft(to)31 b(an)g(argumen)m(t)39 b Fn(M)49 b Ft(of)30 b(t)m(yp)s(e)39 b Fs(nat)1733 4527 y Fi(?)1801 4512 y Ft(,)30 b(w)m(e)h(do)f(so)h(b)m(y)f(writing)1452 4717 y Fl(let)47 b Fr(b)p Fn(x)p Fr(c)26 b Ft(=)f Fn(M)58 b Fl(in)47 b Fs(fact)2341 4738 y Fp(1)2396 4717 y Fn(x)141 4949 y Ft(An)30 b(alternativ)m(e)h(de\014nition)d(of)j(factorial)f(is) 38 b Fs(fact)1864 4971 y Fp(2)1928 4893 y Fj(def)1946 4949 y Ft(=)k Fs(\014x)2163 4971 y Fj(nat)2269 4982 y Fa(?)2333 4967 y Fi(!)2416 4971 y Fj(nat)2522 4982 y Fa(?)2578 4949 y Fn(F)2636 4963 y Fp(2)2685 4949 y Ft(,)30 b(where)591 5192 y Fn(F)649 5206 y Fp(2)772 5136 y Fj(def)789 5192 y Ft(=)100 b Fn(\025f)10 b Ft(:)15 b Fs(nat)1244 5207 y Fi(?)1318 5186 y Fr(!)1425 5192 y Fs(nat)1561 5207 y Fi(?)1620 5192 y Fn(:)g(\025x)p Ft(:)g Fs(nat)1942 5207 y Fi(?)2001 5192 y Fn(:)h Fl(let)46 b Fr(b)p Fn(z)t Fr(c)27 b Ft(=)e Fn(x)47 b Fl(in)960 5305 y(if)g Fs(Eq)8 b Ft(?)15 b Fn(z)k Ft(0)49 b Fl(then)d Fr(b)p Ft(1)p Fr(c)j Fl(else)e(let)g Fr(b)p Fn(y)s Fr(c)26 b Ft(=)f Fn(f)10 b Fr(b)p Fn(z)24 b Fr(\000)c Ft(1)p Fr(c)48 b Fl(in)f Fr(b)p Fn(z)25 b Fr(\003)c Fn(y)s Fr(c)p eop %%Page: 126 77 126 76 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(126)0 91 y(Here,)41 b(the)e(t)m(yp)s(e)g(of)f (factorial)h(is)f(di\013eren)m(t)g(since)f(the)i(domain)f(of)g(the)h (function)e(is)46 b Fs(nat)3182 106 y Fi(?)3288 91 y Ft(instead)38 b(of)47 b Fs(nat)18 b Ft(.)0 204 y(The)32 b(consequence)h(is)f(that)h(w)m(e)g(could)f(apply)40 b Fs(fact)1794 226 y Fp(2)1874 204 y Ft(to)33 b(a)g(p)s(ossibly)d(non)m (terminating)h(expression.)47 b(Ho)m(w)m(ev)m(er,)0 317 y(since)30 b(the)h(\014rst)f(thing)39 b Fs(fact)970 339 y Fp(2)1048 317 y Ft(do)s(es)31 b(with)e(an)i(argumen)m(t)40 b Fn(x)p Ft(:)15 b Fs(nat)2233 332 y Fi(?)2331 317 y Ft(is)30 b(force)h(it)g(to)g(some)h(v)-5 b(alue)38 b Fn(z)t Ft(:)15 b Fs(nat)k Ft(,)31 b(there)g(is)0 430 y(not)j(m)m(uc)m(h)f(\015exibilit)m(y)e(gained)i(in)f(this)h (de\014nition)e(of)i(factorial.)50 b(In)33 b(particular,)g(as)h (illustrated)d(b)s(elo)m(w,)j(b)s(oth)0 543 y(functions)27 b(calculate)37 b(3!)g(in)27 b(essen)m(tially)h(the)g(same)h(w)m(a)m(y) -8 b(.)41 b(The)28 b(reason)37 b Fs(fact)2641 565 y Fp(2)2717 543 y Ft(immediately)27 b(forces)37 b Fn(x)p Ft(:)15 b Fs(nat)3724 558 y Fi(?)3819 543 y Ft(to)0 656 y(some)29 b(natural)f(n)m(um)m(b)s(er)36 b Fn(z)t Ft(:)15 b Fs(nat)47 b Ft(is)28 b(that)i(equalit)m(y)e(test)38 b Fs(Eq)8 b Ft(?)37 b(requires)27 b(a)38 b Fs(nat)46 b Ft(argumen)m(t,)30 b(instead)e(of)h(a)38 b Fs(nat)3807 671 y Fi(?)3875 656 y Ft(.)141 769 y(F)-8 b(or)36 b(the)f(\014rst)e(de\014nition)g(of)i (factorial,)h(w)m(e)f(can)g(compute)43 b(3!)h(b)m(y)35 b(expanding)e(out)i(three)g(recursiv)m(e)f(calls)0 882 y(and)c(simplifying)c(as)31 b(follo)m(ws:)546 1069 y(\()p Fs(\014x)c Fn(F)759 1083 y Fp(1)799 1069 y Ft(\))15 b(3)546 1182 y Fr(!)-61 b(!)117 b Fl(if)47 b Fs(Eq)8 b Ft(?)14 b(3)h(0)49 b Fl(then)e Fr(b)p Ft(1)p Fr(c)i Fl(else)d(let)h Fr(b)p Fn(y)s Fr(c)26 b Ft(=)f(\()p Fs(\014x)i Fn(F)2555 1196 y Fp(1)2595 1182 y Ft(\)\(3)21 b Fr(\000)f Ft(1\))49 b Fl(in)e Fr(b)p Ft(3)21 b Fr(\003)g Fn(y)s Fr(c)546 1295 y(!)-61 b(!)117 b Fl(let)47 b Fr(b)p Fn(y)s Fr(c)25 b Ft(=)910 1408 y Fl(let)47 b Fr(b)p Fn(y)1189 1375 y Fi(0)1212 1408 y Fr(c)26 b Ft(=)f(\()p Fs(\014x)i Fn(F)1587 1422 y Fp(1)1627 1408 y Ft(\)\(1\))49 b Fl(in)e Fr(b)p Ft(2)21 b Fr(\003)g Fn(y)2189 1375 y Fi(0)2212 1408 y Fr(c)776 1521 y Fl(in)47 b Fr(b)p Ft(3)21 b Fr(\003)g Fn(y)s Fr(c)546 1634 y(!)-61 b(!)117 b Fl(let)47 b Fr(b)p Fn(y)s Fr(c)25 b Ft(=)910 1746 y Fl(let)47 b Fr(b)p Fn(y)1189 1713 y Fi(0)1212 1746 y Fr(c)26 b Ft(=)1001 1859 y Fl(let)47 b Fr(b)p Fn(y)1280 1826 y Fi(00)1322 1859 y Fr(c)26 b Ft(=)f(\()p Fs(\014x)i Fn(F)1697 1873 y Fp(1)1737 1859 y Ft(\)0)48 b Fl(in)f Fr(b)p Ft(1)21 b Fr(\003)g Fn(y)2228 1826 y Fi(00)2270 1859 y Fr(c)958 1972 y Fl(in)47 b Fr(b)p Ft(2)21 b Fr(\003)f Fn(y)1320 1939 y Fi(0)1344 1972 y Fr(c)776 2085 y Fl(in)47 b Fr(b)p Ft(3)21 b Fr(\003)g Fn(y)s Fr(c)0 2279 y Ft(Then,)30 b(once)h(w)m(e)h(ha)m(v)m(e)g(reduced) 38 b(\()p Fs(\014x)27 b Fn(F)1375 2293 y Fp(1)1414 2279 y Ft(\)0)g Fr(!)-61 b(!)26 b(b)p Ft(1)p Fr(c)8 b Ft(,)33 b(w)m(e)e(can)g(set)39 b Fn(y)2358 2246 y Fi(00)2440 2279 y Ft(to)31 b(1,)h(then)38 b Fn(y)2916 2246 y Fi(0)2978 2279 y Ft(to)32 b(1,)f(then)39 b Fn(y)j Ft(to)d(2)8 b(,)32 b(then)0 2392 y(p)s(erform)d(the)i(\014nal)e(m)m(ultiplication)e(and)j (pro)s(duce)f(the)h(\014nal)f(v)-5 b(alue)39 b(6)8 b(.)141 2505 y(F)-8 b(or)46 b(the)g(alternativ)m(e)f(de\014nition,)i(w)m(e)f (ha)m(v)m(e)g(essen)m(tially)f(the)g(same)h(expansion,)i(b)s(eginning) 42 b(with)53 b Fr(b)p Ft(3)p Fr(c)0 2618 y Ft(instead)30 b(of)38 b(3)i(for)30 b(t)m(yping)g(reasons:)522 2805 y(\()p Fs(\014x)d Fn(F)735 2819 y Fp(2)775 2805 y Ft(\))15 b Fr(b)p Ft(3)p Fr(c)522 2918 y(!)-61 b(!)117 b Fl(let)47 b Fr(b)p Fn(z)t Fr(c)26 b Ft(=)f Fr(b)p Ft(3)p Fr(c)49 b Fl(in)795 3031 y(if)e Fs(Eq)8 b Ft(?)15 b Fn(z)k Ft(0)48 b Fl(then)f Fr(b)p Ft(1)p Fr(c)i Fl(else)e(let)g Fr(b)p Fn(y)s Fr(c)25 b Ft(=)g(\()p Fs(\014x)i Fn(F)2567 3045 y Fp(2)2607 3031 y Ft(\))p Fr(b)p Fn(z)e Fr(\000)20 b Ft(1)p Fr(c)49 b Fl(in)e Fr(b)p Fn(z)25 b Fr(\003)20 b Fn(y)s Fr(c)522 3144 y(!)-61 b(!)117 b Fn(:)15 b(:)g(:)522 3257 y Fr(!)-61 b(!)117 b Fl(let)47 b Fr(b)p Fn(y)s Fr(c)25 b Ft(=)886 3370 y Fl(let)47 b Fr(b)p Fn(y)1165 3337 y Fi(0)1188 3370 y Fr(c)26 b Ft(=)977 3483 y Fl(let)47 b Fr(b)p Fn(y)1256 3450 y Fi(00)1298 3483 y Fr(c)26 b Ft(=)f(\()p Fs(\014x)i Fn(F)1673 3497 y Fp(2)1713 3483 y Ft(\))p Fr(b)p Ft(0)p Fr(c)49 b Fl(in)e Fr(b)p Ft(1)21 b Fr(\003)g Fn(y)2285 3450 y Fi(00)2327 3483 y Fr(c)934 3596 y Fl(in)47 b Fr(b)p Ft(2)21 b Fr(\003)g Fn(y)1297 3563 y Fi(0)1320 3596 y Fr(c)752 3709 y Fl(in)47 b Fr(b)p Ft(3)21 b Fr(\003)g Fn(y)s Fr(c)0 3896 y Ft(The)31 b(only)g (di\013erence)h(here)g(is)f(that)h(in)f(eac)m(h)i(recursiv)m(e)e(call,) h(the)g(argumen)m(t)h(is)e(lifted)f(to)j(matc)m(h)g(the)f(t)m(yp)s(e)g (of)0 4009 y(the)37 b(function.)59 b(Ho)m(w)m(ev)m(er,)41 b(the)c(b)s(o)s(dy)44 b Fn(F)1440 4023 y Fp(2)1525 4009 y Ft(immediately)35 b(uses)i Fl(let)f Ft(to)i(\\unlift")d(the)i (argumen)m(t,)i(so)f(the)f(net)0 4122 y(e\013ect)32 b(is)d(the)i(same)g (as)f(for)39 b Fs(fact)1130 4144 y Fp(1)1177 4122 y Ft(.)p 3861 4122 40 40 v 0 4326 a Fk(Example)34 b(2.6.10)46 b Ft(As)31 b(men)m(tioned)f(ab)s(o)m(v)m(e,)h(the)g(equations)882 4513 y Fs(Eq)8 b Ft(?)24 b Fn(x)h(x)320 b Ft(=)83 b Fs(true)7 b Fn(;)882 4626 y Fs(Eq)h Ft(?)24 b Fn(x)h Ft(\()p Fn(n)c Ft(+)f Fn(x)p Ft(\))83 b(=)g Fs(false)98 b Ft(n)m(umeral)29 b Fn(n)h Ft(di\013eren)m(t)g(from)g(0.)0 4813 y(are)e(consisten)m(t)g (with)35 b(PCF)969 4828 y Fi(?)1036 4813 y Ft(,)29 b(when)35 b Fn(x)p Ft(:)15 b Fs(nat)45 b Ft(is)27 b(a)h(natural)f(n)m(um)m(b)s (er)g(v)-5 b(ariable,)27 b(but)g(inconsisten)m(t)g(when)g(added)0 4926 y(to)d(PCF.)g(W)-8 b(e)25 b(will)c(see)j(ho)m(w)g(these)g (equations)f(could)g(b)s(e)g(used)g(in)31 b(PCF)2453 4941 y Fi(?)2544 4926 y Ft(b)m(y)23 b(considering)f(the)i(PCF)f (expression)621 5114 y Fl(letrec)46 b Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)9 b Ft(\):)15 b Fs(nat)36 b Ft(=)25 b Fl(if)47 b Fs(Eq)8 b Ft(?)14 b Fn(x)h Ft(0)49 b Fl(then)d Ft(1)i Fl(else)1621 5226 y(if)f Fs(Eq)8 b Ft(?)14 b Fn(f)c Ft(\()p Fn(x)20 b Fr(\000)g Ft(1\))15 b Fn(f)10 b Ft(\()p Fn(x)21 b Fr(\000)f Ft(1\))48 b Fl(then)f Ft(2)h Fl(else)f Ft(3)668 5339 y Fl(in)h Fn(f)10 b Ft(3)p eop %%Page: 127 78 127 77 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(127)0 91 y(If)30 b(w)m(e)h(apply)e(left-most)i (reduction)e(to)i(this)e(expression,)h(w)m(e)g(end)g(up)f(with)h(an)g (expression)f(of)h(the)h(form)850 296 y Fl(if)47 b Fs(Eq)8 b Ft(?)14 b(\(\()p Fs(\014x)27 b Fn(F)13 b Ft(\)\(3)22 b Fr(\000)e Ft(1\)\))15 b(\(\()p Fs(\014x)28 b Fn(F)13 b Ft(\)\(3)22 b Fr(\000)e Ft(1\)\))48 b Fl(then)f Ft(2)h Fl(else)f Ft(3)0 500 y(whic)m(h)30 b(requires)f(us)h(to)i(simplify)27 b(t)m(w)m(o)32 b(applications)d(of)i(the)g(recursiv)m(e)f(function)g (in)f(order)i(to)g(determine)f(that)0 613 y Fn(f)10 b Ft(\(2\))37 b(=)f Fn(f)10 b Ft(\(2\))e(.)62 b(W)-8 b(e)39 b(migh)m(t)e(lik)m(e)f(to)i(apply)e(some)i(\\optimization")f(whic)m(h)f (sa)m(ys)i(that)f(whenev)m(er)g(w)m(e)h(ha)m(v)m(e)h(a)0 726 y(sub)s(expression)31 b(of)k(the)f(form)42 b Fs(Eq)8 b Ft(?)15 b Fn(M)25 b(M)53 b Ft(w)m(e)35 b(can)f(simplify)d(this)i(to) 43 b Fs(true)16 b Ft(.)52 b(Ho)m(w)m(ev)m(er,)37 b(the)e(inconsistency) e(of)0 839 y(the)i(t)m(w)m(o)h(equations)e(ab)s(o)m(v)m(e)h(sho)m(ws)g (that)g(this)e(optimization)h(cannot)h(b)s(e)e(com)m(bined)h(with)f (other)i(reasonable)0 951 y(optimizations)29 b(of)i(this)e(form.)141 1064 y(W)-8 b(e)32 b(cannot)g(eliminate)e(the)h(need)g(to)h(compute)f (at)h(least)g(one)f(recursiv)m(e)g(call,)g(but)f(w)m(e)i(can)f (eliminate)f(the)0 1177 y(equalit)m(y)g(test)h(using)e(lifted)g(t)m(yp) s(es.)41 b(A)30 b(natural)g(and)f(routine)h(translation)f(of)i(this)e (expression)g(in)m(to)39 b(PCF)3738 1192 y Fi(?)3835 1177 y Ft(is)434 1374 y Fl(letrec)46 b Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)9 b Ft(\):)15 b Fs(nat)1299 1389 y Fi(?)1383 1374 y Ft(=)25 b Fl(if)47 b Fs(Eq)8 b Ft(?)15 b Fn(x)g Ft(0)48 b Fl(then)f Fr(b)p Ft(1)p Fr(c)h Fl(else)1252 1487 y(let)f Fr(b)p Fn(y)s Fr(c)26 b Ft(=)f Fn(f)10 b Ft(\()p Fn(x)20 b Fr(\000)g Ft(1\))48 b Fl(in)f(if)g Fs(Eq)8 b Ft(?)15 b Fn(y)j(y)51 b Fl(then)46 b Fr(b)p Ft(2)p Fr(c)j Fl(else)e Fr(b)p Ft(3)p Fr(c)482 1599 y Fl(in)g Fn(f)10 b Ft(3)0 1796 y(In)26 b(this)g(form,)i(w)m(e)f(ha)m(v)m (e)h(a)g(sub)s(expression)c(of)j(the)g(form)35 b Fs(Eq)8 b Ft(?)15 b Fn(y)j(y)38 b Ft(where)d Fn(y)s Ft(:)15 b Fs(nat)j Ft(.)39 b(With)27 b(the)g(equations)f(ab)s(o)m(v)m(e,)0 1909 y(w)m(e)44 b(can)g(replace)f(this)51 b(PCF)1034 1924 y Fi(?)1144 1909 y Ft(expression)42 b(b)m(y)i(an)f(equiv)-5 b(alen)m(t)43 b(one,)k(obtaining)42 b(the)i(pro)m(v)-5 b(ably)42 b(equiv)-5 b(alen)m(t)0 2022 y(expression)865 2127 y Fl(letrec)46 b Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)10 b Ft(\):)15 b Fs(nat)1730 2142 y Fi(?)1814 2127 y Ft(=)25 b Fl(if)47 b Fs(Eq)8 b Ft(?)15 b Fn(x)g Ft(0)48 b Fl(then)f Fr(b)p Ft(1)p Fr(c)i Fl(else)1865 2240 y(let)e Fr(b)p Fn(y)s Fr(c)26 b Ft(=)f Fn(f)10 b Ft(\()p Fn(x)20 b Fr(\000)g Ft(1\))48 b Fl(in)g Fr(b)p Ft(2)p Fr(c)913 2353 y Fl(in)f Fn(f)10 b Ft(3)0 2517 y(The)27 b(reason)g(w)m(e)h(cannot)g(exp)s(ect)f(to)h(simplify)k Fl(let)47 b Fr(b)p Fn(y)s Fr(c)26 b Ft(=)f Fn(f)10 b Ft(\()p Fn(x)k Fr(\000)g Ft(1\))47 b Fl(in)h Fr(b)p Ft(2)p Fr(c)36 b Ft(to)h Fr(b)p Ft(2)p Fr(c)f Ft(b)m(y)27 b(an)m(y)h(lo)s(cal) e(optimiza-)0 2630 y(tion)34 b(that)i(do)s(es)f(not)g(analyze)g(the)h (en)m(tire)f(declaration)f(of)44 b Fn(f)52 b Ft(is)34 b(that)i(when)42 b Fn(f)10 b Ft(\()p Fn(x)23 b Fr(\000)g Ft(1\))44 b(do)s(es)35 b(not)g(terminate)0 2743 y(\()p Fs(i.e.)p Ft(,)30 b(cannot)h(b)s(e)f(reduced)g(to)h(the)f(form)39 b Fr(b)p Fn(M)10 b Fr(c)e Ft(\),)32 b(the)e(t)m(w)m(o)i(are)f(not)f (equiv)-5 b(alen)m(t.)p 3861 2743 40 40 v 0 2983 a Fk(T)c(ranslation)35 b(of)g(PCF)g(in)m(to)43 b(PCF)1352 2998 y Fi(?)0 3155 y Ft(The)38 b(translation)g(of)h(PCF)f(in)m(to)47 b(PCF)1389 3170 y Fi(?)1495 3155 y Ft(has)38 b(t)m(w)m(o)i(parts.)65 b(The)38 b(\014rst)g(is)g(a)h(translation)e(of)i(t)m(yp)s(es.)66 b(W)-8 b(e)40 b(will)0 3267 y(map)31 b(expressions)f(of)i(t)m(yp)s(e)40 b Fn(\033)j Ft(from)31 b(PCF)h(to)g(expressions)e(of)i(t)m(yp)s(e)p 2433 3218 56 4 v 40 w Fn(\033)43 b Ft(in)38 b(PCF)2830 3282 y Fi(?)2898 3267 y Ft(,)32 b(where)p 3227 3218 V 39 w Fn(\033)43 b Ft(is)31 b(the)g(result)g(of)0 3380 y(replacing)44 b Fs(nat)54 b Ft(b)m(y)45 b Fs(nat)863 3395 y Fi(?)967 3380 y Ft(and)f Fs(b)-5 b(o)g(ol)56 b Ft(b)m(y)45 b Fs(b)-5 b(o)g(ol)1660 3395 y Fi(?)1728 3380 y Ft(.)59 b(More)38 b(sp)s(eci\014cally)-8 b(,)37 b(w)m(e)g(ma)m(y)g(de\014ne)p 3161 3331 V 45 w Fn(\033)48 b Ft(b)m(y)37 b(induction)d(on)0 3493 y(t)m(yp)s(es:)p 1528 3526 159 4 v 1528 3599 a Fs(b)-5 b(o)g(ol)240 b Ft(=)82 b Fs(b)-5 b(o)g(ol)2226 3614 y Fi(?)p 1528 3646 137 4 v 1528 3712 a Fs(nat)260 b Ft(=)82 b Fs(nat)2205 3727 y Fi(?)p 1528 3762 284 4 v 1528 3825 a Fn(\033)1580 3839 y Fp(1)1634 3825 y Fr(\002)15 b Fn(\033)1772 3839 y Fp(2)1915 3825 y Ft(=)p 2068 3776 92 4 v 82 w Fn(\033)2120 3839 y Fp(1)2175 3825 y Fr(\002)p 2261 3776 V 15 w Fn(\033)2313 3839 y Fp(2)p 1528 3888 304 4 v 1528 3938 a Fn(\033)1580 3952 y Fp(1)1634 3932 y Fr(!)1740 3938 y Fn(\033)1792 3952 y Fp(2)1915 3938 y Ft(=)p 2068 3889 92 4 v 82 w Fn(\033)2120 3952 y Fp(1)2175 3932 y Fr(!)p 2281 3889 V 2281 3938 a Fn(\033)2333 3952 y Fp(2)0 4097 y Ft(It)36 b(is)g(easy)g(to)h(c)m(hec)m(k)h(that)f(for)f(an)m(y)g(PCF)g(t)m(yp)s (e)45 b Fn(\033)12 b Ft(,)37 b(the)g(t)m(yp)s(e)p 2249 4048 56 4 v 44 w Fn(\033)48 b Ft(is)35 b(p)s(oin)m(ted.)57 b(This)35 b(giv)m(es)h(us)g(a)g(\014xed-p)s(oin)m(t)0 4210 y(op)s(erator)31 b(of)f(eac)m(h)i(t)m(yp)s(e)p 888 4161 V 39 w Fn(\033)11 b Ft(.)141 4323 y(The)33 b(translation)f(of)h (comp)s(ound)e(PCF)i(terms)g(in)m(to)41 b(PCF)2202 4338 y Fi(?)2303 4323 y Ft(is)32 b(essen)m(tially)g(straigh)m(tforw)m(ard.) 48 b(The)33 b(most)0 4436 y(in)m(teresting)26 b(part)h(of)g(the)h (translation)d(lies)h(in)g(the)h(basic)f(natural)g(n)m(um)m(b)s(er)g (and)h(b)s(o)s(olean)f(op)s(erations.)38 b(If)d Fn(M)10 b Ft(:)15 b Fn(\033)0 4549 y Ft(in)28 b(PCF,)i(w)m(e)g(m)m(ust)g (\014nd)e(some)i(suitable)f(term)p 1677 4477 99 4 v 38 w Fn(M)48 b Ft(of)30 b(t)m(yp)s(e)p 2128 4500 56 4 v 38 w Fn(\033)41 b Ft(in)c(PCF)2522 4564 y Fi(?)2589 4549 y Ft(.)j(The)30 b(translation)p 3309 4500 55 4 v 37 w Fn(n)37 b Ft(of)30 b(a)g(n)m(umeral)0 4662 y Fn(n)47 b Ft(is)f Fr(b)p Fn(n)p Fr(c)h Ft(and)38 b(the)h(translations)f(of)47 b Fs(true)54 b Ft(and)47 b Fs(false)54 b Ft(are)39 b(similarly)44 b Fr(b)p Fs(true)8 b Fr(c)47 b Ft(and)g Fr(b)p Fs(false)7 b Fr(c)h Ft(.)67 b(It)39 b(is)f(easy)h(to)0 4774 y(see)32 b(these)g(ha)m(v)m(e)h(the)e(righ)m(t)g(t)m(yp)s(es.)44 b(F)-8 b(or)32 b(eac)m(h)h(of)e(the)h(op)s(erations)39 b Fs(Eq)8 b Ft(?)o Fn(;)15 b Ft(+)40 b(and)31 b(conditional,)f(w)m(e)i (will)d(write)i(a)0 4887 y(lam)m(b)s(da)f(term)i(of)f(the)h (appropriate)39 b(PCF)1492 4902 y Fi(?)1590 4887 y Ft(t)m(yp)s(e.)44 b(Since)39 b Fs(Eq)8 b Ft(?)39 b(compares)32 b(t)m(w)m(o)h(natural)d(n) m(um)m(b)s(er)g(terms)i(and)0 5000 y(pro)s(duces)d(a)i(b)s(o)s(olean,)e (w)m(e)i(will)d(write)h(a)39 b(PCF)1630 5015 y Fi(?)1728 5000 y Ft(term)p 1953 4927 155 4 v 38 w Fs(Eq)8 b Ft(?)38 b(of)31 b(t)m(yp)s(e)39 b Fs(nat)2599 5015 y Fi(?)2673 4994 y Fr(!)2779 5000 y Fs(nat)2916 5015 y Fi(?)2990 4994 y Fr(!)3096 5000 y Fs(b)-5 b(o)g(ol)3254 5015 y Fi(?)3321 5000 y Ft(.)41 b(The)30 b(term)g(for)0 5113 y(equalit)m(y)g(test)h(is)p 460 5244 V 460 5317 a Fs(Eq)8 b Ft(?)85 b(=)g Fn(\025x)p Ft(:)15 b Fs(nat)1138 5332 y Fi(?)1197 5317 y Fn(:)h(\025y)s Ft(:)f Fs(nat)1515 5332 y Fi(?)1574 5317 y Fn(:)h Fl(let)47 b Fr(b)p Fn(x)1898 5280 y Fi(0)1921 5317 y Fr(c)26 b Ft(=)f Fn(x)48 b Fl(in)f(let)g Fr(b)p Fn(y)2605 5280 y Fi(0)2628 5317 y Fr(c)26 b Ft(=)f Fn(y)50 b Fl(in)e Fr(b)p Fs(Eq)8 b Ft(?)15 b Fn(x)3291 5280 y Fi(0)3329 5317 y Fn(y)3377 5280 y Fi(0)3400 5317 y Fr(c)p eop %%Page: 128 79 128 78 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(128)0 91 y(An)29 b(in)m(tuitiv)m(e)f(explanation)h (of)g(this)g(function)f(is)g(that)p 1929 18 155 4 v 39 w Fs(Eq)8 b Ft(?)37 b(tak)m(es)31 b(t)m(w)m(o)g(argumen)m(ts)e(of)h(t)m (yp)s(e)38 b Fs(nat)3416 106 y Fi(?)3484 91 y Ft(,)29 b(ev)-5 b(aluates)0 204 y(them)35 b(to)h(obtain)f(elemen)m(ts)g(of)g(t) m(yp)s(e)44 b Fs(nat)53 b Ft(\(if)34 b(p)s(ossible\),)g(and)h(then)g (compares)g(the)h(results)e(for)g(equalit)m(y)-8 b(.)55 b(If)0 317 y(either)30 b(argumen)m(t)g(do)s(es)g(not)g(reduce)g(to)h (the)g(form)38 b Fr(b)p Fn(M)10 b Fr(c)39 b Ft(for)f Fn(M)10 b Ft(:)15 b Fs(nat)j Ft(,)31 b(then)f(the)g(corresp)s(onding)e Fl(let)h Ft(cannot)0 430 y(b)s(e)i(reduced.)44 b(But)32 b(if)f(b)s(oth)g(argumen)m(ts)h(do)g(reduce)f(to)i(the)f(form)39 b Fr(b)p Fn(M)10 b Fr(c)e Ft(,)34 b(then)d(w)m(e)h(are)h(certain)e(to)i (b)s(e)e(able)g(to)0 543 y(reduce)i(b)s(oth)g(to)i(n)m(umerals,)e(and)g (hence)h(w)m(e)g(will)d(b)s(e)i(able)g(to)i(obtain)41 b Fr(b)p Fs(true)7 b Fr(c)43 b Ft(or)f Fr(b)p Fs(false)7 b Fr(c)43 b Ft(b)m(y)33 b(the)h(reduction)0 656 y(axiom)c(for)39 b Fs(Eq)8 b Ft(?)f(.)41 b(The)30 b(reader)g(is)g(encouraged)h(to)g(try) f(a)h(few)f(examples)g(in)f(Exercise)h(2.6.14.)141 769 y(The)39 b(terms)p 608 706 71 4 v 48 w(+)47 b(for)39 b(addition)f(and)p 1436 696 191 4 v 47 w Fs(c)-5 b(ond)58 b Ft(for)48 b Fl(if)62 b Fn(:)15 b(:)g(:)64 b Fl(then)e Fn(:)15 b(:)g(:)64 b Fl(else)e Fn(:)15 b(:)g(:)48 b Ft(are)40 b(similar)d(in)h(spirit)f(to)p 0 809 155 4 v 0 882 a Fs(Eq)8 b Ft(?)g(.)p 458 924 71 4 v 458 987 a(+)249 b(=)83 b Fn(\025x)p Ft(:)15 b Fs(nat)1214 1002 y Fi(?)1273 987 y Fn(:)g(\025y)s Ft(:)g Fs(nat)1591 1002 y Fi(?)1650 987 y Fn(:)g Fl(let)47 b Fr(b)p Fn(x)1973 954 y Fi(0)1997 987 y Fr(c)25 b Ft(=)g Fn(x)48 b Fl(in)f(let)g Fr(b)p Fn(y)2680 954 y Fi(0)2704 987 y Fr(c)25 b Ft(=)g Fn(y)51 b Fl(in)c Fr(b)p Fn(x)3196 954 y Fi(0)3240 987 y Ft(+)20 b Fn(y)3379 954 y Fi(0)3402 987 y Fr(c)p 458 1076 238 4 v 458 1149 a Fs(c)-5 b(ond)648 1163 y Fm(\033)778 1149 y Ft(=)83 b Fn(\025x)p Ft(:)15 b Fs(b)-5 b(o)g(ol)1235 1164 y Fi(?)1294 1149 y Fn(:)16 b(\025y)s Ft(:)p 1476 1100 56 4 v 15 w Fn(\033)s(:)g(\025z)t Ft(:)p 1711 1100 V 15 w Fn(\033)t(:)f Fl(let)47 b Fr(b)p Fn(x)2090 1116 y Fi(0)2114 1149 y Fr(c)25 b Ft(=)g Fn(x)48 b Fl(in)f(if)g Fn(x)2713 1116 y Fi(0)2784 1149 y Fl(then)g Fn(y)j Fl(else)d Fn(z)0 1309 y Ft(In)40 b(the)i(translation)e(of)h(conditional,)i(it)e (is)f(imp)s(ortan)m(t)g(to)i(notice)g(that)p 2647 1259 V 50 w Fn(\033)53 b Ft(is)40 b(p)s(oin)m(ted.)72 b(As)41 b(a)h(result,)h(the)0 1421 y(function)29 b(b)s(o)s(dy)37 b Fl(let)47 b Fr(b)p Fn(x)877 1388 y Fi(0)901 1421 y Fr(c)25 b Ft(=)g Fn(x)48 b Fl(in)f(if)g Fn(x)1500 1388 y Fi(0)1571 1421 y Fl(then)g Fn(y)k Fl(else)46 b Fn(z)d Ft(is)29 b(w)m(ell-t)m(yp)s(ed.)141 1534 y(F)-8 b(or)31 b(pairing)e(and)g(lam)m(b)s(da)h(abstraction,)g(w)m(e)h(let)p 1493 1658 288 4 v 1493 1736 a Fr(h)p Fn(M)5 b(;)15 b(N)10 b Fr(i)136 b Ft(=)82 b Fr(h)p 2103 1664 99 4 v Fn(M)11 b(;)p 2257 1664 83 4 v 30 w(N)f Fr(i)p 1493 1826 340 4 v 1493 1899 a Fn(\025x)p Ft(:)15 b Fn(\033)s(:)h(M)93 b Ft(=)82 b Fn(\025x)p Ft(:)p 2213 1850 56 4 v 15 w Fn(\033)t(:)p 2309 1827 99 4 v 15 w(M)0 2096 y Ft(and)20 b(similarly)d(for)j (application,)g(pro)5 b(jections)20 b(and)g(\014xed)g(p)s(oin)m(ts.)36 b(Some)20 b(examples)g(app)s(ear)g(in)f(Exercises)g(2.6.14)0 2208 y(and)30 b(2.6.16.)141 2321 y(The)g(main)f(prop)s(erties)g(of)i (this)e(translation)g(are)227 2509 y(\(i\))i(If)38 b Fn(M)10 b Ft(:)15 b Fn(\033)42 b Ft(in)29 b(PCF,)i(then)p 1249 2437 V 38 w Fn(M)10 b Ft(:)p 1387 2460 56 4 v 15 w Fn(\033)42 b Ft(in)c(PCF)1782 2524 y Fi(?)1850 2509 y Ft(.)227 2659 y(\(ii\))20 b(If)29 b Fn(M)5 b(;)15 b(N)40 b Ft(are)21 b(syn)m(tactically)g(distinct)e(terms)i(of)g(PCF,)g(then)p 2462 2587 99 4 v 29 w Fn(M)10 b(;)p 2600 2587 83 4 v 15 w(N)40 b Ft(are)21 b(syn)m(tactically)g(distinct)227 2772 y(terms)31 b(of)38 b(PCF)779 2787 y Fi(?)847 2772 y Ft(.)227 2922 y(\(iii\))28 b(If)36 b Fn(M)g Fr(!)25 b Fn(N)47 b Ft(in)27 b(PCF,)i(then)p 1419 2850 99 4 v 37 w Fn(M)35 b Fr(!)p 1658 2850 83 4 v 25 w Fn(N)47 b Ft(in)36 b(PCF)2078 2937 y Fi(?)2146 2922 y Ft(.)k(Con)m(v)m(ersely)-8 b(,)29 b(if)37 b Fn(M)47 b Ft(is)28 b(a)h(normal)f(form)g(in)227 3035 y(PCF,)j(then)p 685 2963 99 4 v 38 w Fn(M)49 b Ft(is)29 b(a)i(normal)e(form)h(in)38 b(PCF)1813 3050 y Fi(?)1881 3035 y Ft(.)227 3186 y(\(iv\))31 b(If)38 b Fn(M)d Ft(=)25 b Fn(N)49 b Ft(is)29 b(pro)m(v)-5 b(able)30 b(in)f(PCF,)h(then)p 1861 3114 V 39 w Fn(M)35 b Ft(=)p 2080 3114 83 4 v 25 w Fn(N)49 b Ft(is)29 b(pro)m(v)-5 b(able)30 b(in)37 b(PCF)2958 3201 y Fi(?)3026 3186 y Ft(.)0 3373 y(While)e(there)h(are)h(a)g(n)m(um) m(b)s(er)e(of)h(cases,)j(it)c(is)h(essen)m(tially)f(straigh)m(tforw)m (ard)h(to)h(v)m(erify)e(these)i(prop)s(erties.)57 b(It)0 3486 y(follo)m(ws)35 b(from)g(prop)s(erties)g(\(ii\))g(and)g(\(iii\))f (that)j(if)43 b Fn(M)5 b(;)15 b(N)54 b Ft(are)36 b(distinct)f(normal)g (forms)g(of)h(PCF,)g(then)p 3679 3414 99 4 v 44 w Fn(M)10 b(;)p 3817 3414 83 4 v 15 w(N)0 3599 y Ft(are)31 b(distinct)e(normal)g (forms)h(of)38 b(PCF)1338 3614 y Fi(?)1406 3599 y Ft(.)0 3839 y Fk(T)-9 b(ranslation)35 b(of)g(Eager)g(PCF)f(in)m(to)44 b(PCF)1649 3854 y Fi(?)0 4011 y Ft(Lik)m(e)32 b(the)g(translation)f(of) h(PCF)g(in)m(to)40 b(PCF)1525 4026 y Fi(?)1592 4011 y Ft(,)33 b(the)f(translation)f(of)h(Eager)h(PCF)f(in)m(to)40 b(PCF)3236 4026 y Fi(?)3335 4011 y Ft(has)32 b(t)m(w)m(o)h(parts.)0 4124 y(W)-8 b(e)32 b(b)s(egin)d(with)g(the)h(translation)g(of)g(t)m(yp) s(es.)141 4237 y(F)-8 b(or)36 b(an)m(y)g(t)m(yp)s(e)43 b Fn(\033)k Ft(of)35 b(Eager)h(PCF,)f(w)m(e)h(de\014ne)e(the)i(asso)s (ciated)f(t)m(yp)s(e)44 b Fn(\033)p 2644 4250 56 4 v 11 w Ft(.)55 b(In)m(tuitiv)m(ely)-8 b(,)44 b Fn(\033)p 3261 4250 V 47 w Ft(is)34 b(the)h(t)m(yp)s(e)h(of)0 4350 y(Eager)e(PCF)e(v)-5 b(alues)33 b(\(in)f(the)h(tec)m(hnical)f(sense)h (of)g(Section)g(2.4.5\))i(of)e(t)m(yp)s(e)42 b Fn(\033)12 b Ft(.)47 b(Since)32 b(an)m(y)i(Eager)f(PCF)g(term)0 4462 y(will)28 b(either)j(reduce)g(to)h(a)f(v)-5 b(alue,)31 b(or)h(div)m(erge)f(under)e(eager)k(reduction,)d(an)h(Eager)h(PCF)f (term)g(of)g(t)m(yp)s(e)40 b Fn(\033)j Ft(will)0 4575 y(b)s(e)29 b(translated)g(to)h(a)37 b(PCF)931 4590 y Fi(?)1028 4575 y Ft(term)29 b(of)h(t)m(yp)s(e)37 b Fn(\033)p 1558 4588 V 1614 4596 a Fi(?)1681 4575 y Ft(.)j(After)30 b(de\014ning)35 b Fn(\033)p 2333 4588 V 41 w Ft(b)m(y)29 b(induction)e(on)i(the)h(structure)e(of)i(t)m(yp)s(e)0 4688 y(expressions,)f(w)m(e)i(giv)m(e)g(an)f(informal)f(explanation.) 1576 4885 y Fs(nat)p 1576 4898 137 4 v 182 w Ft(=)83 b Fs(nat)1576 4998 y(b)-5 b(o)g(ol)p 1576 5011 159 4 v 162 w Ft(=)83 b Fs(b)-5 b(o)g(ol)1576 5110 y Fn(\033)1646 5104 y Fr(!)1752 5110 y Fn(\034)p 1576 5123 227 4 v 93 w Ft(=)83 b Fn(\033)p 2039 5123 56 4 v 2109 5104 a Fr(!)2215 5110 y Fn(\034)p 2215 5123 51 4 v 2265 5131 a Fi(?)1576 5223 y Fn(\033)18 b Fr(\002)d Fn(\034)p 1576 5244 207 4 v 113 w Ft(=)83 b Fn(\033)p 2039 5236 56 4 v 18 w Fr(\002)15 b Fn(\034)p 2195 5236 51 4 v eop %%Page: 129 80 129 79 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(129)0 91 y(The)34 b(Eager)h(PCF)f(v)-5 b(alues)33 b(of)h(t)m(yp)s(e)43 b Fs(nat)52 b Ft(or)42 b Fs(b)-5 b(o)g(ol)54 b Ft(corresp)s(ond)33 b(to)43 b(PCF)2553 106 y Fi(?)2654 91 y Ft(terms)35 b(of)f(t)m(yp)s(e)43 b Fs(nat)51 b Ft(or)43 b Fs(b)-5 b(o)g(ol)19 b Ft(.)52 b(An)0 204 y(Eager)34 b(PCF)g(function)e(v)-5 b(alue)33 b(of)h(t)m(yp)s(e)42 b Fn(\033)1474 198 y Fr(!)1580 204 y Fn(\034)52 b Ft(has)33 b(the)h(form)41 b Fn(\025x)p Ft(:)15 b Fn(\033)t(:)g(M)k Ft(,)35 b(where)e(for)g(an)m(y)h(argumen)m (t)43 b Fn(V)28 b Ft(,)35 b(the)0 317 y(b)s(o)s(dy)h([)p Fn(V)10 b(=x)p Ft(])p Fn(M)48 b Ft(ma)m(y)29 b(either)g(reduce)f(to)i (a)f(v)-5 b(alue)29 b(of)g(t)m(yp)s(e)37 b Fn(\034)47 b Ft(or)29 b(div)m(erge)g(under)f(eager)i(reduction.)39 b(Therefore,)0 430 y(in)e(PCF)301 445 y Fi(?)369 430 y Ft(,)30 b(the)h(v)-5 b(alues)29 b(of)i(t)m(yp)s(e)39 b Fn(\033)1238 424 y Fr(!)1344 430 y Fn(\034)49 b Ft(are)31 b(functions)e(from)38 b Fn(\033)p 2200 443 56 4 v 42 w Ft(to)h Fn(\034)p 2413 443 51 4 v 2463 451 a Fi(?)2530 430 y Ft(.)i(Finally)-8 b(,)29 b(the)i(Eager)g(PCF)f(v)-5 b(alues)30 b(of)0 543 y(t)m(yp)s(e)39 b Fn(\033)18 b Fr(\002)d Fn(\034)49 b Ft(are)30 b(pairs)f(of)i(v)-5 b(alues,)30 b(and)g(therefore)h(ha)m(v)m(e)g(t)m(yp)s(e)39 b Fn(\033)p 2213 556 56 4 v 18 w Fr(\002)15 b Fn(\034)p 2369 556 51 4 v 49 w Ft(in)37 b(PCF)2759 558 y Fi(?)2826 543 y Ft(.)141 656 y(W)-8 b(e)31 b(translate)e(a)h(term)37 b Fn(M)10 b Ft(:)15 b Fn(\033)42 b Ft(of)29 b(Eager)h(PCF)f(with)f (free)h(v)-5 b(ariables)37 b Fn(x)2598 670 y Fp(1)2637 656 y Ft(:)15 b Fn(\033)2729 670 y Fp(1)2769 656 y Fn(;)g(:)g(:)g(:)h (;)f(x)3022 671 y Fm(k)3065 656 y Ft(:)g Fn(\033)3157 671 y Fm(k)3238 656 y Ft(to)30 b(a)g(term)37 b Fn(M)p 3647 669 99 4 v 10 w Ft(:)15 b Fn(\033)p 3785 669 56 4 v 3841 677 a Fi(?)0 769 y Ft(of)39 b(PCF)299 784 y Fi(?)396 769 y Ft(with)29 b(free)i(v)-5 b(ariables)37 b Fn(x)1215 783 y Fp(1)1255 769 y Ft(:)15 b Fn(\033)p 1295 782 V 1350 790 a Fp(1)1390 769 y Fn(;)g(:)g(:)g(:)h(;)f(x)1643 784 y Fm(k)1686 769 y Ft(:)g Fn(\033)p 1726 782 V 1782 790 a Fm(k)1833 769 y Ft(,)30 b(as)h(follo)m(ws:)269 948 y Fn(x)p 269 961 52 4 v 999 w Ft(=)83 b Fr(b)p Fn(x)p Fr(c)269 1060 y Fn(n)p 269 1073 55 4 v 996 w Ft(=)g Fr(b)p Fn(n)p Fr(c)269 1173 y Fs(true)p 269 1186 166 4 v 892 w Ft(=)g Fr(b)p Fs(true)8 b Fr(c)269 1286 y Fs(false)p 269 1317 184 4 v 875 w Ft(=)83 b Fr(b)p Fs(false)8 b Fr(c)269 1400 y Fn(M)31 b Ft(+)20 b Fn(N)p 269 1420 293 4 v 768 w Ft(=)83 b Fl(let)47 b Fr(b)p Fn(x)p Fr(c)26 b Ft(=)f Fn(M)p 1919 1413 99 4 v 58 w Fl(in)47 b(let)g Fr(b)p Fn(y)s Fr(c)26 b Ft(=)f Fn(N)p 2649 1413 83 4 v 57 w Fl(in)48 b Fr(b)p Fn(x)20 b Ft(+)g Fn(y)s Fr(c)269 1513 y Fs(Eq)8 b Ft(?)p Fn(M)i(N)p 269 1544 336 4 v 725 w Ft(=)83 b Fl(let)47 b Fr(b)p Fn(x)p Fr(c)26 b Ft(=)f Fn(M)p 1919 1526 99 4 v 58 w Fl(in)47 b(let)g Fr(b)p Fn(y)s Fr(c)26 b Ft(=)f Fn(N)p 2649 1526 83 4 v 57 w Fl(in)48 b Fr(b)p Fs(Eq)8 b Ft(?)15 b Fn(x)g(y)s Fr(c)269 1626 y Fl(if)48 b Fn(M)57 b Fl(then)47 b Fn(N)58 b Fl(else)46 b Fn(P)p 269 1639 968 4 v 96 w Ft(=)83 b Fl(let)47 b Fr(b)p Fn(x)p Fr(c)26 b Ft(=)f Fn(M)p 1919 1639 99 4 v 58 w Fl(in)47 b(if)g Fn(x)h Fl(then)f Fn(N)p 2690 1639 83 4 v 57 w Fl(else)g Fn(P)p 3059 1639 71 4 v 269 1739 a(M)10 b(N)p 269 1752 182 4 v 880 w Ft(=)83 b Fl(let)47 b Fr(b)p Fn(f)10 b Fr(c)25 b Ft(=)g Fn(M)p 1921 1752 99 4 v 58 w Fl(in)47 b(let)g Fr(b)p Fn(x)p Fr(c)26 b Ft(=)f Fn(N)p 2655 1752 83 4 v 58 w Fl(in)47 b Fn(f)10 b(x)269 1852 y(\025x)p Ft(:)15 b Fn(\033)t(:)g(M)p 269 1865 340 4 v 722 w Ft(=)83 b Fr(b)p Fn(\025x)p Ft(:)15 b Fn(\033)p 1659 1865 56 4 v 4 w(:)h(M)p 1756 1865 99 4 v 10 w Fr(c)269 1965 y Fs(\014x)374 1986 y Fm(\033)428 1982 y Fi(!)510 1986 y Fm(\034)p 269 2000 285 4 v 1320 1965 a Ft(=)83 b Fr(b)p Fs(\014x)12 b Ft(\()p Fn(\025f)e Ft(:)15 b(\(\()p Fn(\033)1943 1959 y Fr(!)2049 1965 y Fn(\034)10 b Ft(\))2149 1959 y Fr(!)2240 1965 y Ft(\()p Fn(\033)2346 1959 y Fr(!)2452 1965 y Fn(\034)g Ft(\)\))2587 1959 y Fr(!)2679 1965 y Ft(\()p Fn(\033)2785 1959 y Fr(!)2891 1965 y Fn(\034)g Ft(\))p 1802 2001 1175 4 v Fn(:)1474 2083 y(\025g)s Ft(:)15 b(\()p Fn(\033)1720 2077 y Fr(!)1826 2083 y Fn(\034)10 b Ft(\))1926 2077 y Fr(!)2017 2083 y Ft(\()p Fn(\033)2123 2077 y Fr(!)2229 2083 y Fn(\034)g Ft(\))p 1613 2119 701 4 v 1 w Fn(:)15 b(g)s Ft(\()p Fn(\025x)p Ft(:)g Fn(\033)p 2581 2096 56 4 v 5 w(:)g Fl(let)47 b Fr(b)p Fn(h)p Fr(c)26 b Ft(=)f Fn(f)10 b(g)51 b Fl(in)c Fn(hx)p Ft(\)\))p Fr(c)0 2264 y Ft(The)30 b(translation)f(of)i(the)f (\014xed-p)s(oin)m(t)f(op)s(erator)i(needs)f(some)g(explanation.)40 b(As)30 b(discussed)f(in)g(Section)h(2.4.5,)0 2377 y(Eager)38 b(PCF)g(only)f(has)g(\014xed-p)s(oin)m(t)g(op)s(erators)h(on)f (function)g(t)m(yp)s(es.)62 b(The)38 b(translation)e(of)i(the)g (\014xed-p)s(oin)m(t)0 2490 y(op)s(erator)31 b(on)f(t)m(yp)s(e)39 b Fn(\033)776 2484 y Fr(!)882 2490 y Fn(\034)49 b Ft(is)29 b(recursiv)m(ely)g(de\014ned)g(to)j(satisfy)579 2674 y Fs(\014x)684 2696 y Fm(\033)738 2692 y Fi(!)820 2696 y Fm(\034)p 579 2709 285 4 v 889 2674 a Ft(=)25 b Fn(\025g)s Ft(:)15 b(\()p Fn(\033)1231 2668 y Fr(!)1337 2674 y Fn(\034)10 b Ft(\))1437 2668 y Fr(!)1528 2674 y Ft(\()p Fn(\033)1634 2668 y Fr(!)1740 2674 y Fn(\034)g Ft(\))p 1124 2710 701 4 v Fn(:)16 b(g)s Ft(\()p Fn(\025x)p Ft(:)f Fn(\033)p 2092 2687 56 4 v 4 w(:)h Fl(let)47 b Fr(b)p Fn(h)p Fr(c)26 b Ft(=)f Fs(\014x)2738 2696 y Fm(\033)2793 2692 y Fi(!)2875 2696 y Fm(\034)p 2634 2709 285 4 v 2943 2674 a Fn(g)52 b Fl(in)47 b Fn(hx)p Ft(\))0 2857 y(This)38 b(is)h(essen)m(tially)g (the)h(Eager)h(PCF)e(prop)s(ert)m(y)g(\\)8 b Fs(\014x)54 b Ft(=)40 b Fn(\025g)s Ft(:)15 b(\()p Fn(:)g(:)g(:)s Ft(\))p Fn(:)h(g)s Ft(\()p Fs(delay)10 b Ft([)p Fs(\014x)51 b Fn(g)s Ft(]\))8 b(")42 b(from)d(Section)h(2.4.5,)0 2970 y(where)30 b(with)37 b Fs(delay)9 b Ft([)p Fn(M)h Ft(])26 b Fr(\021)f Fn(\025x)p Ft(:)15 b(\()p Fn(:)g(:)g(:)r Ft(\))p Fn(:)h(M)10 b(x)e Ft(,)31 b(using)e(the)h(fact)h(that)1013 3151 y Fn(M)10 b(x)p 1013 3164 151 4 v 25 w Fr(\021)25 b Fl(let)47 b Fr(b)p Fn(f)10 b Fr(c)26 b Ft(=)e Fn(M)p 1731 3164 99 4 v 58 w Fl(in)47 b(let)g Fr(b)p Fn(y)s Fr(c)26 b Ft(=)f Fr(b)p Fn(x)p Fr(c)49 b Fl(in)e Fn(f)10 b(y)1013 3264 y Ft(=)116 b Fl(let)47 b Fr(b)p Fn(f)10 b Fr(c)25 b Ft(=)g Fn(M)p 1647 3277 V 58 w Fl(in)47 b Fn(f)10 b(x)0 3445 y Ft(b)m(y)30 b(axiom)39 b(\()p Fl(let)30 b Fr(b)g(c)p Ft(\))8 b(.)141 3558 y(In)28 b(the)h(next)g(t)m(w)m(o)h (examples,)f(w)m(e)g(discuss)e(the)i(w)m(a)m(y)g(that)g(eager)h (reduction)e(is)g(preserv)m(ed)g(b)m(y)h(this)e(transla-)0 3671 y(tion.)38 b(A)26 b(general)f(di\013erence)f(b)s(et)m(w)m(een)i (the)f(eager)h(reduction)e(strategy)i(giv)m(en)f(in)f(Section)h(2.4.5)i (and)d(reduction)0 3784 y(in)39 b(PCF)303 3799 y Fi(?)402 3784 y Ft(is)31 b(that)i(eager)h(reduction)d(is)g(deterministic.)43 b(In)32 b(particular,)f(eager)i(reduction)e(of)i(an)f(application)0 3897 y Fn(M)10 b(N)50 b Ft(sp)s(eci\014es)30 b(reduction)g(of)40 b Fn(M)50 b Ft(to)33 b(a)f(v)-5 b(alue)31 b(\()p Fs(e.g.)p Ft(,)40 b Fn(\025x)p Ft(:)15 b(\()p Fn(:)g(:)g(:)q Ft(\))q Fn(:)g(M)2356 3864 y Fi(0)2388 3897 y Ft(\))32 b(b)s(efore)f(reducing) 38 b Fn(N)50 b Ft(to)32 b(a)g(v)-5 b(alue.)44 b(Ho)m(w-)0 4010 y(ev)m(er,)31 b(from)e(the)h(p)s(oin)m(t)f(of)h(view)f(of)h (accurately)g(represen)m(ting)f(the)h(termination)f(b)s(eha)m(vior)f (and)i(v)-5 b(alues)29 b(of)h(an)m(y)0 4123 y(expression,)41 b(the)e(order)g(of)h(ev)-5 b(aluation)39 b(b)s(et)m(w)m(een)48 b Fn(M)58 b Ft(and)47 b Fn(N)58 b Ft(is)38 b(not)i(signi\014can)m(t.)67 b(When)39 b(an)h(application)0 4236 y Fn(M)10 b(N)47 b Ft(of)28 b(Eager)h(PCF)f(is)f(translated)h(in)m(to)37 b(PCF)1686 4251 y Fi(?)1753 4236 y Ft(,)29 b(it)f(will)d(b)s(e)j (necessary)h(to)g(reduce)f(b)s(oth)f(to)i(the)f(form)37 b Fr(b)p Fn(:)15 b(:)g(:)q Fr(c)8 b Ft(,)0 4348 y(in)m(tuitiv)m(ely)24 b(corresp)s(onding)g(to)i(the)g(translation)f(of)h(an)g(Eager)g(PCF)g (v)-5 b(alue,)27 b(b)s(efore)e(p)s(erforming)32 b Fn(\014)13 b Ft(-reduction.)0 4461 y(Ho)m(w)m(ev)m(er,)41 b(PCF)587 4476 y Fi(?)684 4461 y Ft(allo)m(ws)30 b(either)g(the)h(function)37 b Fn(M)49 b Ft(or)30 b(the)h(argumen)m(t)39 b Fn(N)48 b Ft(to)31 b(b)s(e)f(reduced)g(\014rst.)0 4653 y Fk(Example)k(2.6.11)46 b Ft(W)-8 b(e)31 b(ma)m(y)g(apply)e(this)g(translation)g(to)h(the)g (term)g(considered)f(in)g(Example)g(2.4.20.)43 b(Since)0 4766 y(this)29 b(will)f(help)h(preserv)m(e)i(the)f(structure)g(of)h (the)f(expression,)f(w)m(e)i(use)f(the)h(syn)m(tactic)g(sugar)902 4973 y Fn(M)36 b Fr(\001)25 b Fn(N)1245 4917 y Fj(def)1262 4973 y Ft(=)103 b Fl(let)47 b Fr(b)p Fn(f)10 b Fr(c)26 b Ft(=)f Fn(M)57 b Fl(in)48 b(let)e Fr(b)p Fn(x)p Fr(c)26 b Ft(=)f Fn(N)58 b Fl(in)47 b Fn(f)10 b(x)0 5156 y Ft(for)30 b(eager)i(application.)39 b(F)-8 b(or)31 b(readabilit)m(y)-8 b(,)29 b(w)m(e)i(will)d(also)i(use)g(the)h(simpli\014cation)632 5340 y Fn(u)21 b Ft(+)f Fn(v)p 632 5361 211 4 v 28 w Ft(=)25 b Fl(let)47 b Fr(b)p Fn(x)p Fr(c)26 b Ft(=)f Fr(b)p Fn(u)p Fr(c)49 b Fl(in)e Ft(\()p Fl(let)g Fr(b)p Fn(y)s Fr(c)26 b Ft(=)f Fr(b)p Fn(v)s Fr(c)49 b Fl(in)e Fr(b)p Fn(x)21 b Ft(+)e Fn(y)s Fr(c)p Ft(\))26 b(=)f Fr(b)p Fn(u)c Ft(+)f Fn(v)s Fr(c)p eop %%Page: 130 81 130 80 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(130)0 91 y(for)33 b(an)m(y)g(v)-5 b(ariables)31 b(or)i(constan)m(ts)42 b Fn(u)g Ft(and)e Fn(v)12 b Ft(,)33 b(since)g(this)e(consequence)j(of)f(our)f(equational) h(axioms)f(do)s(es)h(not)0 204 y(c)m(hange)f(the)e(b)s(eha)m(vior)g(of) g(the)h(resulting)d(term.)41 b(Applying)28 b(the)i(translation)g(to)h (the)f(term)971 408 y(\()p Fs(\014x)d Ft(\()p Fn(\025x)p Ft(:)15 b Fs(nat)1458 402 y Fr(!)1564 408 y Fs(nat)9 b Fn(:)16 b(\025y)s Ft(:)f Fs(nat)9 b Fn(:)16 b(y)s Ft(\)\))31 b(\(\()p Fn(\025z)t Ft(:)15 b Fs(nat)c Fn(:)k(z)24 b Ft(+)c(1\))15 b(2\))0 613 y(giv)m(es)31 b(us)628 726 y(\()p Fs(\014x)p 663 757 105 4 v 37 w Fr(\001)26 b(b)f Fn(\025x)p Ft(:)15 b Fs(nat)1206 720 y Fr(!)1312 726 y Fs(nat)1449 741 y Fi(?)1508 726 y Fn(:)p Fr(b)p Fn(\025y)s Ft(:)g Fs(nat)10 b Fn(:)p Fr(b)p Fn(y)s Fr(cc)27 b(c)p Ft(\))56 b Fr(\001)g Ft(\()p Fr(b)26 b Fn(\025z)t Ft(:)15 b Fs(nat)10 b Fn(:)p Fr(b)p Fn(z)25 b Ft(+)20 b(1)p Fr(c)26 b(c)g(\001)f(b)p Ft(2)p Fr(c)p Ft(\))0 892 y(A)30 b(useful)f(general)h (observ)-5 b(ation)31 b(is)e(that)1484 1097 y Fr(b)c Fn(M)36 b Fr(c)20 b(\001)h(b)p Fn(N)10 b Fr(c)86 b(!)-61 b(!)86 b Fn(M)10 b(N)0 1301 y Ft(but)24 b(that)h(w)m(e)g(cannot)g (simplify)c(a)k(form)32 b Fn(M)1495 1268 y Fi(0)1527 1301 y Fr(\001)8 b Fn(N)1643 1268 y Fi(0)1699 1301 y Ft(unless)31 b Fn(M)2068 1268 y Fi(0)2125 1301 y Ft(has)24 b(the)g(form)33 b Fr(b)p Fn(M)10 b Fr(c)33 b Ft(and)g Fn(N)3123 1268 y Fi(0)3179 1301 y Ft(has)24 b(the)g(form)33 b Fr(b)p Fn(N)10 b Fr(c)e Ft(.)0 1414 y(The)30 b(need)h(to)g(pro)s (duce)f(\\lifted)g(v)-5 b(alues")31 b(\(or,)g(more)g(precisely)-8 b(,)30 b(the)h(lifting)e(of)i(terms)g(that)g(reduce)g(to)g(v)-5 b(alues\))0 1527 y(is)26 b(imp)s(ortan)m(t)f(in)g(expressing)h(eager)h (reduction)f(with)f(lifted)g(t)m(yp)s(es.)39 b(W)-8 b(e)28 b(can)f(see)g(that)g(there)g(are)g(t)m(w)m(o)g(p)s(ossible)0 1640 y(reductions)h(of)i(the)g(term)g(ab)s(o)m(v)m(e,)h(one)f(in)m(v)m (olving)37 b Fs(\014x)p 1760 1671 V 49 w Ft(and)29 b(the)h(other)38 b(\()p Fr(b)p Fn(\025z)t Ft(:)15 b Fs(nat)c Fn(:)p Fr(b)p Fn(z)24 b Ft(+)18 b(1)p Fr(cc)27 b(\001)e(b)p Ft(2)p Fr(c)p Ft(\))i Fr(!)-61 b(!)25 b(b)p Ft(2)20 b(+)f(1)p Fr(c)8 b Ft(.)0 1753 y(The)28 b(reader)h(ma)m(y)g(enjo)m(y)g(leftmost)g (reducing)e(the)i(en)m(tire)f(expression)g(and)g(seeing)g(ho)m(w)h(the) g(steps)f(corresp)s(ond)0 1866 y(to)j(the)g(eager)g(reduction)f(steps)g (carried)f(out)i(in)e(Example)h(2.4.20.)p 3861 1866 40 40 v 0 2078 a Fk(Example)k(2.6.12)46 b Ft(W)-8 b(e)32 b(can)f(see)g(ho)m(w)f(div)m(ergence)h(is)e(preserv)m(ed)h(b)m(y)g (considering)f(the)h(term)1011 2274 y Fl(let)f Fn(f)10 b Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)10 b Ft(\):)15 b Fs(nat)35 b Ft(=)25 b(3)31 b Fl(in)1162 2387 y(letrec)46 b Fn(g)s Ft(\()p Fn(x)p Ft(:)15 b Fs(nat)c Ft(\):)k Fs(nat)35 b Ft(=)25 b Fn(g)s Ft(\()p Fn(x)c Ft(+)f(1\))49 b Fl(in)e Fn(f)10 b Ft(\()p Fn(g)19 b Ft(5\))0 2584 y(from)27 b(Example)f (2.4.21.)42 b(After)28 b(replacing)e Fl(let)p Ft('s)g(b)m(y)h(lam)m(b)s (da)f(abstraction)h(and)g(application,)g(the)g(translation)0 2697 y(of)k(this)e(term)h(is)1027 2784 y Fr(b)c Fn(\025f)10 b Ft(:)15 b Fs(nat)1392 2778 y Fr(!)1498 2784 y Fs(nat)1635 2799 y Fi(?)1694 2784 y Fn(:)p Fr(b)p Fn(\025g)s Ft(:)g Fs(nat)2051 2778 y Fr(!)2157 2784 y Fs(nat)2294 2799 y Fi(?)2353 2784 y Fn(:)p Fr(b)p Fn(f)10 b Fr(c)25 b(\001)h Ft(\()p Fn(g)19 b Ft(5\))26 b Fr(cc)1027 2897 y(\001)g(b)g Fn(\025x)p Ft(:)15 b Fs(nat)9 b Fn(:)q Fr(b)p Ft(3)p Fr(c)26 b(c)1027 3010 y(\001)g Ft(\()f Fs(\014x)p 1138 3041 105 4 v 37 w Fr(\001)g(b)15 b Fn(\025g)s Ft(:)g Fs(nat)1666 3004 y Fr(!)1772 3010 y Fs(nat)1908 3025 y Fi(?)1967 3010 y Fn(:)p Fr(b)p Fn(\025x)p Ft(:)g Fs(nat)c Fn(:)k(g)s Ft(\()p Fn(x)21 b Ft(+)f(1\))15 b Fr(cc)27 b Ft(\))0 3175 y(where)36 b(for)g(simplicit)m(y)e(w)m(e)j(ha)m(v)m(e)h (used)44 b Fr(b)p Fn(g)s Fr(c)25 b(\001)g(b)p Ft(5)p Fr(c)37 b Ft(=)e Fn(g)19 b Ft(5)45 b(and)f Fr(b)p Fn(g)s Fr(c)37 b(\001)f Ft(\()p Fn(x)20 b Ft(+)g(1)p 2484 3196 209 4 v 1 w(\))35 b(=)h Fr(b)p Fn(g)s Fr(c)h(\001)e(b)p Fn(x)25 b Ft(+)f(1)p Fr(c)36 b Ft(=)f Fn(g)s Ft(\()p Fn(x)26 b Ft(+)e(1\))8 b(.)0 3288 y(Recall)29 b(from)f(Examples)g (2.4.6)j(and)d(2.4.21)k(that)d(if)f(w)m(e)i(apply)e(leftmost)h (reduction)f(to)h(the)h(original)d(term,)i(w)m(e)0 3401 y(obtain)j(3,)i(while)d(eager)j(reduction)e(do)s(es)g(not)h(pro)s(duce) f(a)h(normal)e(form.)48 b(W)-8 b(e)34 b(can)f(see)g(ho)m(w)g(the)g (translation)0 3513 y(of)c(Eager)g(PCF)f(in)m(to)36 b(PCF)951 3528 y Fi(?)1047 3513 y Ft(preserv)m(es)28 b(the)h(absence)g(of)f (normal)g(forms)f(b)m(y)i(leftmost-reducing)e(the)h(result)g(of)0 3626 y(this)h(translation.)141 3739 y(Since)g(the)g(\014rst)g(argumen)m (t)h(and)f(the)g(main)g(function)f(ha)m(v)m(e)i(the)g(form)37 b Fr(b)p Fn(:)15 b(:)g(:)r Fr(c)8 b Ft(,)30 b(w)m(e)g(can)g(apply)36 b Fn(\014)13 b Ft(-reduction)0 3852 y(as)31 b(describ)s(ed)d(in)h (Example)g(2.6.11.)43 b(This)29 b(giv)m(es)i(us)939 4056 y Fr(b)p Fn(\025g)s Ft(:)15 b Fs(nat)1271 4050 y Fr(!)1377 4056 y Fs(nat)1514 4071 y Fi(?)1573 4056 y Fn(:)p Fr(b)p Fn(\025x)p Ft(:)g Fs(nat)10 b Fn(:)p Fr(b)p Ft(3)p Fr(cc)27 b(\001)f Ft(\()p Fn(g)19 b Ft(5\))26 b Fr(c)g(\001)f Ft(\()h Fs(\014x)p 2568 4087 105 4 v 36 w Fr(\001)g(b)p Fn(G)p Fr(c)f Ft(\))0 4300 y(where)42 b Fn(G)378 4245 y Fj(def)395 4300 y Ft(=)49 b Fn(\025g)s Ft(:)15 b Fs(nat)806 4294 y Fr(!)912 4300 y Fs(nat)1049 4315 y Fi(?)1108 4300 y Fn(:)p Fr(b)p Fn(\025x)p Ft(:)g Fs(nat)10 b Fn(:)15 b(g)s Ft(\()p Fn(x)24 b Ft(+)e(1\))p Fr(c)8 b Ft(.)54 b(Our)32 b(task)j(is)e(to)i(reduce)f(the)g(argumen)m(t)43 b(\()32 b Fs(\014x)p 3489 4331 V 42 w Fr(\001)g(b)p Fn(G)p Fr(c)g Ft(\))0 4413 y(to)f(the)g(form)38 b Fr(b)p Fn(:)15 b(:)g(:)q Fr(c)39 b Ft(b)s(efore)30 b(p)s(erforming)e(the)j(leftmost)39 b Fn(\014)13 b Ft(-reduction.)40 b(W)-8 b(e)32 b(do)e(this)f(using)g (the)i(that)481 4615 y Fs(\014x)585 4636 y Fj(nat)703 4632 y Fi(!)786 4636 y Fj(nat)p 481 4650 416 4 v 982 4615 a Ft(=)86 b Fr(b)25 b Fs(\014x)1309 4636 y Fj(nat)1427 4632 y Fi(!)1509 4636 y Fj(nat)1616 4648 y Fa(?)1702 4615 y Fn(F)39 b Fr(c)86 b(!)-61 b(!)481 4732 y(b)31 b Fn(\025g)s Ft(:)15 b(\()p Fs(nat)879 4726 y Fr(!)985 4732 y Fs(nat)1121 4747 y Fi(?)1180 4732 y Ft(\))1230 4726 y Fr(!)1322 4732 y Ft(\()p Fs(nat)1508 4726 y Fr(!)1615 4732 y Fs(nat)1751 4747 y Fi(?)1810 4732 y Ft(\))p Fn(:)h(g)s Ft(\()p Fn(\025x)p Ft(:)f Fs(nat)10 b Fn(:)16 b Fl(let)47 b Fr(b)p Fn(h)p Fr(c)26 b Ft(=)f Fs(\014x)42 b Fn(F)h(g)51 b Fl(in)d Fn(hx)p Ft(\))31 b Fr(c)0 4929 y Ft(where)443 5138 y Fn(F)600 5083 y Fj(def)617 5138 y Ft(=)103 b(\()p Fn(\025f)10 b Ft(:)15 b(\(\()p Fs(nat)1196 5132 y Fr(!)1303 5138 y Fs(nat)1439 5153 y Fi(?)1498 5138 y Ft(\))1548 5132 y Fr(!)1639 5138 y Ft(\()p Fs(nat)1826 5132 y Fr(!)1932 5138 y Fs(nat)2069 5153 y Fi(?)2128 5138 y Ft(\)\))2213 5132 y Fr(!)2305 5138 y Ft(\()p Fs(nat)2491 5132 y Fr(!)2598 5138 y Fs(nat)2734 5153 y Fi(?)2793 5138 y Ft(\))p Fn(:)807 5251 y(\025g)s Ft(:)g(\()p Fs(nat)1134 5245 y Fr(!)1240 5251 y Fs(nat)1376 5266 y Fi(?)1435 5251 y Ft(\))1485 5245 y Fr(!)1577 5251 y Ft(\()p Fs(nat)1763 5245 y Fr(!)1869 5251 y Fs(nat)2006 5266 y Fi(?)2065 5251 y Ft(\))p Fn(:)h(g)s Ft(\()p Fn(\025x)p Ft(:)f Fs(nat)10 b Fn(:)16 b Fl(let)47 b Fr(b)p Fn(h)p Fr(c)26 b Ft(=)f Fn(f)10 b(g)51 b Fl(in)c Fn(hx)p Ft(\)\))p eop %%Page: 131 82 131 81 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(131)0 91 y(Ho)m(w)m(ev)m(er,)32 b(w)m(e)d(will)d(see)k(in)e(the)h(pro)s(cess)f(that)i(the)f (application)e(to)j(5)f(resulting)e(from)37 b Fn(\014)13 b Ft(-reduction)29 b(cannot)h(b)s(e)0 204 y(reduced)c(to)i(the)f(form) 35 b Fr(b)p Fn(:)15 b(:)g(:)q Fr(c)8 b Ft(,)29 b(k)m(eeping)e(us)f (from)g(ev)m(ery)i(reac)m(hing)f(the)g(normal)f(form)35 b Fr(b)p Ft(3)p Fr(c)h Ft(for)27 b(the)g(en)m(tire)g(term.)141 317 y(The)j(expansion)f(of)39 b Fs(\014x)p 862 348 105 4 v 50 w Ft(ab)s(o)m(v)m(e)31 b(giv)m(es)g(us)734 530 y Fs(\014x)p 734 561 V 37 w Fr(\001)25 b(b)p Fn(G)p Fr(c)87 b(!)-61 b(!)86 b Fs(\014x)36 b Fn(F)i(G)734 643 y Fr(!)-61 b(!)117 b Fn(G)30 b Ft(\()p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b Fl(let)47 b Fr(b)p Fn(h)p Fr(c)26 b Ft(=)f Fs(\014x)37 b Fn(F)h(G)47 b Fl(in)h Fn(hx)p Ft(\))734 756 y Fr(!)-61 b(!)117 b(b)p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)p Ft(\(\()p Fn(\025x)p Ft(:)15 b Fs(nat)c Fn(:)k Fl(let)47 b Fr(b)p Fn(h)p Fr(c)26 b Ft(=)f Fs(\014x)37 b Fn(F)h(G)47 b Fl(in)h Fn(hx)p Ft(\))26 b(\()p Fn(x)20 b Ft(+)g(1\)\))p Fr(c)734 869 y(!)-61 b(!)117 b(b)p Fn(\025x)p Ft(:)15 b Fs(nat)10 b Fn(:)15 b Fl(let)47 b Fr(b)p Fn(h)p Fr(c)27 b Ft(=)e Fs(\014x)36 b Fn(F)j(G)47 b Fl(in)g Fn(h)p Ft(\()p Fn(x)21 b Ft(+)f(1\))p Fr(c)0 1071 y Ft(When)36 b(the)g(function)f(inside)e(the)45 b Fr(b)36 b(c)45 b Ft(is)35 b(applied)f(to)i(5,)j(the)d(result)f(m)m(ust)g(b)s(e)h (reduced)f(to)i(a)f(form)44 b Fr(b)p Fn(:)15 b(:)g(:)r Fr(c)44 b Ft(to)0 1184 y(complete)32 b(the)g(reduction)f(of)h(the)g(en) m(tire)f(term.)45 b(Ho)m(w)m(ev)m(er,)35 b(this)30 b(leads)i(us)f(to)h (again)g(reduce)40 b Fs(\014x)e Fn(F)j(G)f Ft(to)32 b(this)0 1297 y(form)i(and)f(apply)g(the)i(result)e(to)i(6.)53 b(Since)33 b(this)g(pro)s(cess)h(ma)m(y)h(b)s(e)e(con)m(tin)m(ued)h (inde\014nitely)-8 b(,)33 b(the)i(en)m(tire)f(term)0 1410 y(do)s(es)c(not)h(ha)m(v)m(e)g(a)g(normal)e(form.)p 3861 1410 40 40 v 141 1622 a(The)h(main)f(prop)s(erties)g(of)i(the)f (translation)g(from)f(Eager)j(PCF)e(in)m(to)38 b(PCF)2774 1637 y Fi(?)2872 1622 y Ft(are:)227 1810 y(\(i\))33 b(If)40 b Fn(M)10 b Ft(:)15 b Fn(\033)44 b Ft(in)31 b(Eager)j(PCF,)e(with)f (free)i(v)-5 b(ariables)39 b Fn(x)2130 1824 y Fp(1)2170 1810 y Ft(:)15 b Fn(\033)2262 1824 y Fp(1)2301 1810 y Fn(;)g(:)g(:)g(:)i(;)e(x)2555 1825 y Fm(k)2598 1810 y Ft(:)g Fn(\033)2690 1825 y Fm(k)2741 1810 y Ft(,)33 b(then)41 b Fn(M)p 3017 1823 99 4 v 10 w Ft(:)15 b Fn(\033)p 3155 1823 56 4 v 3211 1831 a Fi(?)3310 1810 y Ft(in)40 b(PCF)3614 1825 y Fi(?)227 1923 y Ft(with)29 b(free)i(v)-5 b(ariables)37 b Fn(x)1046 1937 y Fp(1)1086 1923 y Ft(:)15 b Fn(\033)p 1126 1936 V 1181 1943 a Fp(1)1221 1923 y Fn(;)g(:)g(:)g(:)h(;)f(x)1474 1938 y Fm(k)1517 1923 y Ft(:)g Fn(\033)p 1557 1936 V 1613 1943 a Fm(k)1664 1923 y Ft(.)227 2082 y(\(ii\))30 b(If)38 b Fn(M)601 2026 y Fj(e)l(ager)640 2082 y Fr(!)64 b Fn(N)49 b Ft(in)29 b(Eager)i(PCF,)f(then)39 b Fn(M)p 1740 2095 99 4 v 35 w Fr(!)-61 b(!)25 b Fn(N)p 2009 2095 83 4 v 49 w Ft(in)37 b(PCF)2432 2097 y Fi(?)2499 2082 y Ft(.)227 2232 y(\(iii\))25 b(If)35 b Fn(M)45 b Ft(is)26 b(a)h(closed)g(term)g(of)g(Eager)g(PCF)g(of)g(t)m(yp)s(e)35 b Fs(nat)45 b Ft(or)35 b Fs(b)-5 b(o)g(ol)46 b Ft(and)34 b Fn(c)i Ft(is)26 b(a)h(n)m(umeral)f(or)35 b Fs(true)227 2355 y Ft(or)k Fs(false)16 b Ft(,)30 b(then)39 b Fn(M)933 2300 y Fj(e)l(ager)957 2355 y Fr(!)-61 b(!)49 b Fn(c)39 b Ft(in)29 b(Eager)i(PCF)f(i\013)38 b Fn(M)p 1904 2368 99 4 v 35 w Fr(!)-61 b(!)26 b(b)p Fn(c)p Fr(c)39 b Ft(in)f(PCF)2634 2370 y Fi(?)2701 2355 y Ft(.)227 2505 y(\(iv\))27 b(If)f(w)m(e)h(let)35 b(=)822 2519 y Fm(eag)r(er)1033 2505 y Ft(b)s(e)26 b(op)s(erational)g (equiv)-5 b(alence)26 b(of)h(Eager)g(PCF)f(term,)i(de\014ned)d(in)g (the)i(same)227 2618 y(w)m(as)k(as)39 b(=)593 2632 y Fm(op)706 2618 y Ft(in)29 b(Section)h(2.3.5)i(but)e(using)f(eager)j(ev) -5 b(aluation,)30 b(and)g(let)39 b(=)2840 2633 y Fm(P)10 b(C)5 b(F)10 b Fi(?)3102 2618 y Ft(b)s(e)30 b(op)s(erational)227 2731 y(equiv)-5 b(alence)28 b(in)35 b(PCF)1004 2746 y Fi(?)1071 2731 y Ft(,)29 b(then)e(for)h(closed)g(terms)36 b Fn(M)19 b Ft(,)36 b Fn(N)47 b Ft(w)m(e)28 b(ha)m(v)m(e)38 b Fn(M)d Ft(=)2820 2745 y Fm(eag)r(er)3022 2731 y Fn(N)46 b Ft(i\013)36 b Fn(M)p 3256 2744 V 35 w Ft(=)3450 2746 y Fm(P)10 b(C)5 b(F)10 b Fi(?)227 2844 y Fn(N)p 227 2857 83 4 v 19 w Ft(.)0 3032 y(It)27 b(is)g(largely)f(straigh)m(tforw)m(ard) i(to)g(v)m(erify)e(prop)s(erties)g(\(i\){\(iii\).)39 b(Prop)s(ert)m(y)27 b(\(iv\),)h(ho)m(w)m(ev)m(er,)h(in)m(v)m(olv)m(es)f (construc-)0 3145 y(tion)h(of)h(fully)e(abstract)i(mo)s(dels)f (satisfying)f(the)i(prop)s(erties)e(describ)s(ed)g(in)g(Section)i (5.4.2.)42 b(A)30 b(pro)s(of)f(has)h(b)s(een)0 3258 y(dev)m(elop)s(ed)g (b)m(y)g(R.)g(Visw)m(anathan.)0 3470 y Fk(Exercise)35 b(2.6.13)47 b Ft(Supp)s(ose)21 b(that)j(instead)e(of)i(ha)m(ving)30 b Fs(\014x)2067 3492 y Fm(\033)2145 3470 y Ft(for)23 b(ev)m(ery)h(p)s(oin)m(ted)30 b Fn(\033)12 b Ft(,)24 b(w)m(e)g(only)e(ha)m(v)m(e)i(\014xed-p)s(oin)m(t)0 3583 y(op)s(erators)34 b(for)g(t)m(yp)s(es)g(of)g(the)g(form)42 b Fn(\034)1327 3598 y Fi(?)1394 3583 y Ft(.)51 b(Sho)m(w)34 b(that)g(it)g(is)f(still)f(p)s(ossible)f(to)k(write)e(a)h(term)g(with)f (no)h(normal)0 3696 y(form)c(of)g(eac)m(h)i(p)s(oin)m(ted)d(t)m(yp)s (e.)0 3909 y Fk(Exercise)35 b(2.6.14)47 b Ft(Reduce)e(the)h (application)e(of)p 1845 3835 155 4 v 54 w Fs(Eq)8 b Ft(?)53 b(to)46 b(the)g(follo)m(wing)e(pairs)g(of)h(terms.)86 b(Y)-8 b(ou)46 b(should)0 4021 y(con)m(tin)m(ue)37 b(un)m(til)e(y)m(ou) i(obtain)45 b Fr(b)p Fs(true)7 b Fr(c)45 b Ft(or)g Fr(b)p Fs(false)8 b Fr(c)46 b Ft(or)36 b(it)h(is)e(apparen)m(t)i(that)h(one)f (of)g(the)g Fl(let)p Ft('s)e(can)j(nev)m(er)f(b)s(e)0 4134 y(reduced.)66 4322 y(\(a\))55 b Fr(b)p Ft(3)21 b(+)f(2)p Fr(c)39 b Ft(and)f Fr(b)p Ft(5)p Fr(c)8 b Ft(.)61 4510 y(\(b\))54 b(\()p Fn(\025x)p Ft(:)15 b Fn(nat)552 4525 y Fi(?)611 4510 y Fn(:)g(x)p Ft(\))p Fr(b)p Ft(3)22 b(+)d(2)p Fr(c)40 b Ft(and)e Fr(b)p Ft(\()p Fn(\025x)p Ft(:)15 b Fs(nat)c Fn(:)k(x)20 b Ft(+)g(1\))15 b(3)p Fr(c)8 b Ft(.)71 4697 y(\(c\))55 b Fs(\014x)11 b Ft(\()p Fn(\025x)p Ft(:)k Fs(nat)657 4712 y Fi(?)716 4697 y Fn(:)g(x)p Ft(\))39 b(and)f Fr(b)p Ft(19)p Fr(c)8 b Ft(.)0 4910 y Fk(Exercise)35 b(2.6.15)47 b Ft(Carry)32 b(out)h(the)g(reduction)e(of)i(the)g(term)41 b Fs(\014x)p 2212 4941 105 4 v 40 w Fr(\001)30 b(b)f Fn(\025x)p Ft(:)15 b Fs(nat)2766 4904 y Fr(!)2872 4910 y Fs(nat)3008 4925 y Fi(?)3067 4910 y Fn(:)q Fr(b)p Fn(\025y)s Ft(:)g Fs(nat)10 b Fn(:)p Fr(b)p Fn(y)s Fr(c)30 b(cc)41 b Ft(from)0 5023 y(Example)30 b(2.6.11.)p eop %%Page: 132 83 132 82 bop 0 -208 a Fq(F)-8 b(oundations)30 b(for)g(Programming)g (Languages)2120 b Ft(132)0 110 y Fk(Exercise)35 b(2.6.16)47 b Ft(The)30 b(\014b)s(onacci)f(function)g(ma)m(y)i(b)s(e)f(written)f (in)g(PCF)i(as)39 b Fs(\014b)2857 54 y Fj(def)2875 110 y Ft(=)j Fs(\014x)3092 132 y Fj(nat)3210 128 y Fi(!)3293 132 y Fj(nat)3403 110 y Fn(F)22 b Ft(,)30 b(where)579 341 y Fn(F)733 286 y Fj(def)750 341 y Ft(=)100 b Fn(\025f)10 b Ft(:)15 b Fs(nat)1220 335 y Fr(!)1326 341 y Fs(nat)10 b Fn(:)15 b(\025x)p Ft(:)g Fs(nat)10 b Fn(:)921 454 y Fl(if)47 b Ft(\()p Fs(Eq)8 b Ft(?)15 b Fn(x)g Ft(0\))31 b Fs(or)41 b Ft(\()p Fs(Eq)8 b Ft(?)15 b Fn(x)g Ft(1\))49 b Fl(then)e Ft(1)h Fl(else)e Fn(f)10 b Ft(\()p Fn(x)20 b Fr(\000)g Ft(1\))h(+)f Fn(f)10 b Ft(\()p Fn(x)20 b Fr(\000)g Ft(2\))0 651 y(W)-8 b(e)32 b(assume)e(for)g(simplicit)m(y)d (that)k(w)m(e)g(ha)m(v)m(e)h(natural)d(n)m(um)m(b)s(er)g(subtraction)h (and)g(a)g(b)s(o)s(olean)g Fs(or)41 b Ft(function.)66 838 y(\(a\))46 b(T)-8 b(ranslate)31 b(the)g(de\014nition)d(from)i (\(ordinary\))f(PCF)i(in)m(to)39 b(PCF)2441 853 y Fi(?)2538 838 y Ft(and)30 b(describ)s(e)f(the)i(reduction)f(of)39 b Fs(\014b)21 b Ft(3)227 951 y(in)k(appro)m(ximately)g(the)h(same)h (detail)e(as)h(Example)f(2.6.9.)41 b(\(Subtraction)25 b(and)h Fs(or)36 b Ft(should)24 b(b)s(e)h(translated)227 1064 y(in)m(to)46 b(PCF)613 1079 y Fi(?)718 1064 y Ft(follo)m(wing)35 b(the)i(pattern)g(giv)m(en)g(for)45 b(+)g(and)g Fs(Eq)8 b Ft(?)g(.)60 b(Y)-8 b(ou)38 b(ma)m(y)f(simplify)42 b Fr(b)p Fn(M)10 b Fr(c)26 b(\000)e(b)p Fn(N)10 b Fr(c)46 b Ft(to)227 1177 y Fr(b)p Fn(M)13 b Fr(\000)s Fn(N)d Fr(c)e Ft(,)24 b(or)e(p)s(erform)e(other)i(simpli\014cations)c(that)k (are)g(similar)d(to)k(the)e(ones)h(used)f(in)f(Example)h(2.6.11.\))61 1365 y(\(b\))45 b(Same)31 b(as)f(part)h(\(a\),)g(but)f(use)g(the)h (translation)e(from)h(Eager)h(PCF)f(in)m(to)39 b(PCF)2962 1380 y Fi(?)3029 1365 y Ft(.)p eop %%Trailer end userdict /end-hook known{end-hook}if %%EOF