(**Reasoningaboutthesyntaxandsemanticsofprogramminglanguagesisapopularapplicationofproofassistants.Beforeprovingthefirsttheoremofthiskind,itisnecessarytochooseaformalencodingoftheinformalnotionsofsyntax,dealingwithsuchissuesas%\index{variablebinding}%variablebindingconventions.Ibelievethepragmaticquestionsinthisdomainarefarfromsettledandremainasimportantopenresearchproblems.However,inthischapter,Iwilldemonstratetwounderusedencodingapproaches.NotethatIamnotrecommendingeitherapproachasasilverbullet!Mileagewillvaryacrossconcreteproblems,andIexpecttheretobesignificantfutureadvancesinourknowledgeofencodingtechniques.Forabroaderintroductiontoprogramminglanguageformalization,usingmoreelementarytechniques,see%\emph{%#<ahref="http://www.cis.upenn.edu/~bcpierce/sf/"><i>#SoftwareFoundations#</i></a>#%}\footnote{\url{http://www.cis.upenn.edu/~bcpierce/sf/}}% by Pierce et al.
(**Reasoningaboutthesyntaxandsemanticsofprogramminglanguagesisapopularapplicationofproofassistants.Beforeprovingthefirsttheoremofthiskind,itisnecessarytochooseaformalencodingoftheinformalnotionsofsyntax,dealingwithsuchissuesas%\index{variablebinding}%variablebindingconventions.Ibelievethepragmaticquestionsinthisdomainarefarfromsettledandremainasimportantopenresearchproblems.However,inthischapter,Iwilldemonstratetwounderusedencodingapproaches.NotethatIamnotrecommendingeitherapproachasasilverbullet!Mileagewillvaryacrossconcreteproblems,andIexpecttheretobesignificantfutureadvancesinourknowledgeofencodingtechniques.Forabroaderintroductiontoprogramminglanguageformalization,usingmoreelementarytechniques,see%\emph{%{{http://www.cis.upenn.edu/~bcpierce/sf/}Software Foundations}%}% by Pierce et al.
Asanexampleofatrickytransformation,consideronethatremovesallusesof%``%#"#[let x = e1 in e2]#"#%''%bysubstituting[e1]for[x]in[e2].Wewillimplementthetranslationbypairingthe%``%#"#compile-time#"#%''%typingenvironmentwitha%``%#"#run-time#"#%''%valueenvironmentor_substitution_,mappingeachvariabletoavaluetobesubstitutedforit.Suchasubstitutetermmaybeplacedwithinaprograminapositionwithalargertypingenvironmentthanappliedatthepointwherethesubstitutetermwaschosen.Tosupportsuchcontexttransplantation,weneed_lifting_,astandarddeBruijnindicesoperation.Withdependenttyping,liftingcorrespondstoweakeningfortypingjudgments.
Asanexampleofatrickytransformation,consideronethatremovesallusesof"[let x = e1 in e2]"bysubstituting[e1]for[x]in[e2].Wewillimplementthetranslationbypairingthe"compile-time"typingenvironmentwitha"run-time"valueenvironmentor_substitution_,mappingeachvariabletoavaluetobesubstitutedforit.Suchasubstitutetermmaybeplacedwithinaprograminapositionwithalargertypingenvironmentthanappliedatthepointwherethesubstitutetermwaschosen.Tosupportsuchcontexttransplantation,weneed_lifting_,astandarddeBruijnindicesoperation.Withdependenttyping,liftingcorrespondstoweakeningfortypingjudgments.