primrecapplistlistlistwhereappNilidjappConsxxsConsxappxsprimrecrevlistlistwhererevNilNiljrevConsxxsapprevxsConsxNilTheprimreccommandexpectstondanequationforeachofthedatatype ID: 145687
Download Pdf The PPT/PDF document "2Background:DatatypesAfundamentalconcept..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
2Background:DatatypesAfundamentalconceptinmostifnotalltypedfunctionalprogramminglanguagesisthatoffreelygenerateddatatypes.Theyarethemainwaytocreatenewtypesandcom-bineexistingtypesintomorecomplex(anduseful)types.Probablythemostpopularexampleisthedatatypeof(nite)listsoverelementtype,whichcanbedenedbydatatype_newlist(map:map)=null:NiljCons(hd:)(tl:list)Thedatatype_newcommandisprovidedbythenew(co)datatypepackage.Here,itintroducesthetypelistgeneratedfreelybytwoconstructors:Nil,whichrepresentsanemptylistandcanbetestedusingnull::list)bool;Cons,whichtakestwoargumentsoftypesandlistandconstructsanewlistfromasingleitem(thenewlist'shead)andtherestofthelist(itstail).Thissimpleexampleshowsabasicconceptofdatatypes:Theycanrecursivelycon-tainanumberofothertypes,includingthemselves.Afunctionthattakesa(recursive)datatypeasoneofitsargumenttypescanthusre-applyitselftothenestedvalue.Thedatatype_newcommandsupportsthedenitionofmutuallyrecursivedata-types.Thesearecharacterizedbythesimultaneousspecicationoftwoormoredata-typesthatrecursivelycontaineachotherinsomeoftheirconstructorarguments.Atypicalexampleisthetypeofnitelybranchingtreesofnitedepthandassociated(nite)foreststhatdonotuseauniversallisttype:datatype_newtree0=Node0(tval0:)(children0:forest)andforest=FNiljFCons(fhd:tree0)(ftl:forest)Thecommandrequiresthateachsetofmutuallyrecursivedatatypeshaveidenticaltypearguments(here,).Another,morecomplexexampleisarepresentationforasimplearithmeticexpressionlanguage:datatype_newexpr=XSumexpr_sumjXProdexpr_prodjXConstnatandexpr_sum=Sumexprexprandexpr_prod=ProdexprexprInadditiontomutualrecursion,itisoftendesirabletoincorporateexistingdatatypesintonewlydenedtypes.Thismakesitpossibletoreasonmoremodularlyaboutthedatatypeandtoreuseexistinglibraries.Forexample,themoremodularwaytospecifyatypesuchastree0reusesthegenericlisttypeconstructorinsteadofintroducingadedicatedforesttype:datatype_newtree=Node(tval:)(children:treelist)Similarly,binarytrees,canbedenedviadatatype_newoption=is_none:NonejSome(the:)datatype_newbtree=BNode(bval:)(left:btreeoption)(right:btreeoption) primrecapp::list)list)listwhereappNil=idjapp(Consxxs)=Consxappxsprimrecrev::list)listwhererevNil=Niljrev(Consxxs)=app(revxs)(ConsxNil)Theprimreccommandexpectstondanequationforeachofthedatatype'scon-structors;otherwise,itprintsawarning.Thenonexhaustiveoptioncanbeusedtosup-pressthewarning:primrec(nonexhaustive)hd::list)wherehd(Constx_)=x3.2MutualRecursionRecursionovermmutuallyrecursivedatatypes¯1,:::,¯mgenerallyrequiresmmu-tuallyrecursivefunctions.Thisisachievedusingthesyntaxprimrecf1::)¯1))1and...fm::)¯m))mwheref1:::(C11¯x11):::=:::...jf1:::(C1k1¯x1k1):::=:::...jfm:::(Cm1¯xm1):::=:::...jfm:::(Cmkm¯xmkm):::=:::Theright-handsidesmaycontainrecursivecallstoanyofthefunctionsfi.Forexam-ple,arithmeticexpressionsrepresentedbythedatatypesintroducedinSection2canbeevaluatedrecursivelyasfollows:primreceval::expr)natandeval_sum::expr_sum)natandeval_prod::expr_prod)natwhereeval(XSums)=eval_sumsjeval(XProdp)=eval_prodpjeval(XConstc)=cjeval_sum(Sumab)=evala+evalbjeval_prod(Prodab)=evalaevalb 4ImplementationofPrimitivelyRecursiveFunctionsIntheabsenceofprimrec,userscoulddenerecursivefunctionsusingsuitableargu-mentstorecursorsassociatedwiththedatatypesonwhichtheywanttorecurse.Usingthetheoremsassociatedwiththerecursors,itisthenpossibletoprovestatementsaboutthedenedfunctions.Theprimreccommandautomatesthisprocess:Givenhigh-levelspecicationsofafunction'sdesiredbehavior,itsynthesizesarecursor-baseddenitionandderivestheuserspecicationastheorems.4.1RecursorsRecursorsencodethemostgeneralformofprimitiverecursionoveradatatype.Forex-ample,thetypeslistandtreeintroducedinSection2areequippedwiththerecursorsrec_list::)()list))))list)rec_tree::)()(tree)list)))tree)characterizedbythefollowingequations:list.rec:rec_listn_Nil=nrec_listnc(Consyys)=cyys(rec_listncys)tree.rec:rec_treeenTEmpty=erec_treeen(Nodexts)=nx(map(t:(t;rec_treeent))ts)Givenarecursorthattakeskarguments,wewillrefertotherstk1argumentsasitsbehavioralfunctions.Forlist,thebehavioralfunctionsnandcencodethebehaviorfortheNilandConscases,respectively.Noticethatcisgivennotonlythehead(y)andtail(ys)ofthelistbutalsotheresultoftherecursivecallofrec_listnconthetail.Fortree,theresultsoftherecursivecallsarepairedwiththeirargumentsinsidealist,asreectedinthetype(tree)list.Usingtherecursorforlists,thelengthfunctioncanbedenedasfollows:denitionlength::list)natwherelength=rec_list0(__r:1+r)Fromthisdenitionandthelist.recproperties,itiseasytoderiveahigh-levelcharac-terizationofthelengthfunction:lemmalength_simps[simp]:lengthNil=0length(Consxxs)=1+lengthxsunfoldinglength_deflist.recbysafeAsetofrecursorsassociatedwithmutuallyrecursivedatatypestakesonebehavioralfunctionperconstructorasarguments.Theyserveasadescriptionofhowtheconstruc-torargumentsandtheresultsofrecursivecallsarecombinedtogivethedesiredreturnvalues.Ingeneral: Constructorargumentsonwhichrecursioncannotbeperformedarepassedasistothebehavioralfunctions.Constructorargumentsxonwhichdirectormutualrecursioncanbeperformedarepassedtogetherwiththeresultyofpassingxtoarecursivecall.Constructorargumentsonwhichnestedrecursionthroughamapfunctioncanbeperformedcontainpairs(x;y)thatcombinetheoriginalvaluexbeforetherecursion(theprevalue)andtherecursivecall'sresulty(thepostvalue).Inthemutualcase,eachdatatypepartakinginmutualrecursionhasitsownrecursor,buttherecursorsdifferonlyinthelastargumentandintheresulttype.Eachrecursorservesthusasitstype'sentrypointtomutualrecursion.4.2GeneralProcedureThegeneralprocedureimplementedbyprimrecperformsthefollowingsteps:1.Fromeachequation,extractthefollowinginformation:thefunctionthattheequationtalksabout;therecursivetype(deducedfromthefunction'sargumenttypesandthepositionoftheconstructorpattern);thepattern-matchedconstructorandthenamesofitsarguments;thenamesandtypesoftheotherarguments;theequation'sright-handside.2.Querythedatatypedatabasetoobtaintherelevantinformation(constructors,recur-sors,theorems)abouttherecursivetypes.Ifnested-as-mutualrecursiontakesplace(ascanbedetectedfromtherecursivetypesandtheshapeoftherecursivecallsontheright-handsides),suitablerecursorsandtheoremsarederivedatthisstage[2].3.Traversetheright-handsideofeachequationinordertolocaterecursivecallsandreplacethembyanonrecursivetermthatwilleventuallyusetheadditionalargu-mentstherecursorprovidestodescribetherecursion.4.Introduce-abstractionsinfrontofeachofthesemodiedright-handsidesandusethemasbehavioralfunctions,llingupmissingspecicationswithundened.5.Foreachrecursor,permutetheresultingterm'sargumentsusing-abstractionstopulltheconstructortothefrontanddenethedesiredfunctionasequaltothisterm.6.Usingtherecursortheorems,provethatthedenitionfulllstheuserspecication(thefunction'scharacteristictheorems).4.3EliminatingRecursiveCallsThesecondstepoftheproceduredescribedabovedependsoninformationaboutthestructureofrecursionintheupcomingdenition.Thisposesachicken-and-eggprob-lem,sinceitisspecicallythisstepthatsuppliesalltheinformationabouttheinvolvedtypesandtheirproperties.Toovercomethisdifculty,theprocessofeliminatingrecur-sionfromthespecicationisdividedintotwosteps.First,everythingthatlookslikea shouldallowargumentsbeforetherecursiveargument.Thisismadepossiblebyper-mutingtheargument.Aspecicationf::1))k1))k+1))nisinternallyconvertedtof0::)1))k1)k+1))nOnceadeni-tionforf0isobtained,fcaneasilybedenedasf=(a1:::ak1x:f0xa1:::ak1)5Background:CodatatypesThesyntaxfordeningcodatatypesisalmostidenticaltothatfordatatypes.Butunlikedatatypes,codatatypescanbebuiltbyapplyingconstructorsinnitely,resultinginin-niteterms.Thisisreectedinthegeneratedcharacteristictheorems:Acoinduction(orbisimulation)principlereplacesinduction.Asaresult,thereneednotbeabasecasethatforces(primitively)recursivefunctionstoterminate.Thus,thetypeofinnitestreamsofdatacanbedenedusingthecommandcodatatypestream(map:smap)=SCons(shd:)(stl:stream)whereasthecorrespondingdatatypewouldbeempty(andhenceimpossibletodeneinHOL).Everyinstanceofstreamhasaninnitenumberofconstructors.Thisimpliesthatanyfunctionthatconstructsastreamoneconstructoratatimemustcallitselfaninnitenumberoftimes.Otherexamplesarethecoinductivecounterpartstolistandnat:codatatypellist(map:lmap)=lnull:LNiljLCons(lhd:)(ltl:llist)codatatypeenat=EZerojESuc(epred:enat)Thetypellistrepresentslazy(orcoinductive)listswithaniteorinnitenumberofelements,whereasenatholdstheextendednaturalnumbers,consistingofnitetermsoftheformESuckEZeroandofthespecialvalueESuc(ESuc:::)representing¥.Analogouslytodatatypes,codatatypessupportmutuallycorecursiveandnestedco-recursivedenitions.Examplesincludeinnitelybranchingtreesofpotentiallyinnitedepth,whichcanbedenedbysimplysubstitutingcodatatypefordatatype_newandllistforlistinthemutualandnestedexamplesfromSection2:codatatypeltree0=LNode0(ltval0:)(lchildren0:lforest)andlforest=LFNiljLFCons(lfhd:ltree0)(lftl:lforest)codatatypeltree=LNode(ltval:)(lchildren:ltreellist)6SpecicationofPrimitivelyCorecursiveFunctionsCorecursivefunctionscanbespeciedusingprimcorecandprimcorecursive,whichsupportprimitivecorecursion,orusingthemoregeneralpartial_functioncommand.AlternativesbasedondomaintheoryandtopologyaredescribedbyLochbihlerandHölzl[6].Here,thefocusisonprimcorecandprimcorecursive.Whereasrecursivefunctionsconsumedatatypevaluesoneconstructoratatime,corecursivefunctionsproducepotentiallyinnitecodatatypevaluesoneconstructoratatime.Partlyreectingalackofagreementamongproponentsofcoinductivemethods,Isabellesupportsthreecompetingsyntaxesforspecifyingafunctionf: Syntacticrestrictionsontheselectorequationsensurethatprogressismadewitheachcorecursivecalli.e.,thefunctionisproductive.Productivityguaranteesthatevenwhentheresultoflappisinnite,prexesofarbitrarynitelengthcanbecomputedbyexpandinganitenumberofcorecursivecalls.This,inturn,ensuresthatthefunctioniswelldened.Themainsyntacticrestrictionontheselectorequations,beyondthexedformatoftheleft-handside,isthatanycorecursivecallontheright-handsideeitheroccupiestheentireright-handsideorappearsasabranchina`ifthenelse',`caseof',or`letin'construct.Becauseofthisrestriction,thefollowingspecicationmustberejected:primcorecwrong::nat)natllistwhere:lnull(wrongn)jlhd(wrongn)=njltl(wrongn)=ltl(wrong(n+1))Somecodatatypesreusethesameselectorfunctionsforseveralconstructors.Ambi-guitiescanthenarisewhenconnectingtheselectorstothecorrespondingconstructors.Toresolvethisissue,primcorecacceptsselectorequationsoftheformget(f:::)=:::ofCwheregetisanambiguousselectorandCisaconstructor.Toavoidtheneedoftediousmanualspecicationofan`else'predicateforthediscriminatorformulas,asingleunderscore_isacceptedasacatch-allwildcard.Itisunderstoodastheimplicitnegationofallconditionsfortherelevantfunctioninpreviousequations.Thus,inPx=):::Qx=):::_=):::thelastequation'sconditionistakentobe:Px^:Qx.Arelatedfunctionalityisprovidedbythesequentialoption.Itcausesthediscrimi-natorformulaconditionsforafunctiontoapplyinsequence,ratherthanindependentlyofeachother.Thisrelievestheuser(orauto)fromhavingtoshowmutualexclusion,butthegeneratedtheoremsthenfeaturemorecomplicatedconditions.Finally,theexhaustiveoptionsignalsthatthediscriminatorformulapremisescoverallcases.Specifyingthisoptionaddsanotherproofobligation,whichagainiseithersolvedautomaticallybyprimcorecorlefttotheuserbyprimcorecursive.Inexchange,strongertheoremsaregeneratedaboutthediscriminators,with !inplaceof=).Anotherwaytoenablethisbehavioristospecify_asthelastcondition,inwhichcaseexhaustivenessissyntacticallytrivial.6.2TheConstructorViewTheconstructorviewcombinesthediscriminatorformulaandtheselectorequationsassociatedwithaconstructorinasingleequation.ThegeneralformisP1¯x=)=)Pn¯x=)f¯x=Ci(g1¯x):::(gk¯x) 6.5NestedCorecursionFornestedcorecursion,weconsideramoreelaborateexample:thedenitionofamonadicstructureforltree.Unfortunately,thestandardwaytodenethebindoper-ator=::ltree)()ltree))ltree,asisdoneforthemonadinstanceMonadTreeintheHaskelllibraryData.Tree,isnotprimitivelycorecursive:t=f=(casef(ltvalt)ofLNodebus)LNodeb(lappus(lmap(t:t=f)(lchildrent))))Theproblemisthatthecorecursivecallto=nestedthroughlmapoccursnotdirectlyasanargumenttotheproducedconstructorLNode,butasanargumenttolapp.Fortu-nately,wecanmakethespecicationprimitivelycorecursivebymovingthecorecursivecallpastlapp.Weusethesumtypetodistinguishbetweenthesubtreesusspawnedbyf(Inl)andthesubtreeslchildrenttowhichthecorecursivecallistobeapplied(Inr):primcorec=::ltree)()ltree))ltreewheret=f=(casef(ltvalt)ofLNodebus)LNodeb(lmap(ut:caseutofInlu)ujInrt)t=f)(lapp(lmapInlus)(lmapInr(lchildrent)))))Fromthelemmalmapf(lappxsys)=lapp(lmapfxs)(lmapfys),itiseasytoderivetheHaskell-stylenonprimitivelycorecursivespecication.GivenreturnxdenedasLNodexLNil,provingthemonadiclawsreturnx=f=fxt=return=tt=f=g=t=(x:fx=g)isaninterestingexerciseincoinduction.6.6Nested-as-MutualCorecursionTodemonstratetheconvenienceofnested-as-mutualcoinduction,letusdenethe=functionagain,butthistimemutuallywiththeternarymixxoperator_Ñ__thatreturnsalazylist,insteadofreusinglapp:primcorec=::ltree)()ltree))ltreeand_Ñ__::ltreellist)ltreellist)()ltree))ltreellistwheret=f=(casef(ltvalt)ofLNodebus)LNodeb(usÑlchildrentf))jusÑtsf=(caseusofLNil)(casetsofLNil)LNiljLConstts0)LCons(t=f)(usÑts0f))jLConsuus0)LConsu(us0Ñtsf)Thenewoperator'sintendedsemanticsis 7.1CorecursorsCorecursorsencodethemostgeneralformofprimitivecorecursionoveracodatatype.ThetypesllistandltreeintroducedinSection5areequippedwiththecorecursorscorec_llist::()bool))()))()bool))()llist))())))llistcorec_ltree::()))()(ltree+)llist)))ltreecharacterizedbythefollowingequations:llist.corec:na=)corec_llistphseca=LNil:na=)corec_llistnhseca=LCons(ha)(ifsatheneaelsecorec_llistnhsec(ca))ltree.corec:corec_ltreelca=LNode(la)(lmap(x:casexofInlt)tjInrr)corec_treelcr)(ca))Givenacorecursorthattakeskarguments,wewillrefertotherstk1argumentsasitsbehavioralfunctions.Forllist,thepredicatenindicateswhetheraLNilconstructorshouldbeproduced.Nextfollowsh,afunctionthatcomputestheheadofanonemptylistfromtheinputa.Thenextthreefunctions,s,e,andc,specifythelist'stail:s(stop?)isapredicatethatdetermineswhetherthecorecursionendswithanoncorecursivetermorcontinuesfurther;e(end)givesthenoncorecursivetailifsissatised;c(continue)computestheargumenttoacorecursivecallifsisnotsatised,specifyingacorecursivetail.Forltree,thebehavioralfunctionconstructsalistofsumvaluesthatspecifyhowtoproduceeachsubtreeindividually.AnInlvalueisinterpretedasaliteralnoncorecursiveresult,whereasanInrvalueispassedtoacorecursivecall.Ingeneral,ifthecodatatypehasnconstructors,thecorecursorexpectsn1predicatespj::)boolthataretestedinsequencetodeterminewhichconstructorshouldbeproduced.Additionally,foreachconstructorargumentoftype,oneofthefollowingcasesapplies:Ifdoesnotcontain(oranyofitsmutuallycorecursivetypes),nocorecursionispossibleandthebehavioralfunctionissimplyafunctiong::)thatreturnstheconstructorargument'sunconditionalvalue.If'soutermosttypeconstructoris(oramutuallyrecursivetype),thisconstruc-torargumentallowsdirect(ormutual)corecursion.Thecorecursorexpectsthreebehavioralfunctions:s::)bool(stop?),e::)(end),andc::)(continue).IfnestsunderoneormoreBNFs,thecorecursortakesoneargumentthatreturnsavalueof'snestingtypewrappedaround+.Thesumtyperepresentseitheranoncorecursiveconstantresultoracorecursivecall'sargument. ConstructorViewfromDestructorView.Essentially,thisjustusesthereductiondescribedinSection7.2inreverse.Eachconstructoranditsassociateddiscriminatorformulapremisesandselectorequationright-handsidesarecollectedandcombinedtoformaconstructorview.However,noequationisgeneratedifsomeselectorequationsaremissingforagivenconstructor(e.g.,iftheheadofalistisspeciedbutnotthetail).CodeViewfromConstructorView.Analogously,thisstepreversesthereductioninSection7.2.Ittakestheconstructor-viewright-handsidesalongwiththeirpreconditionsandbuildsan`ifthenelseif'treefromthem.Iftheexhaustiveoptionisnotspecied,thegeneratedtheoremwillhavean`else'branchcontainingCode.abort,whichthrowsanexceptionatruntimeifnoneofthecasesapply.Eitherway,thenewlyassembledtermsareprovedastheorems,exploitingtheconstructor-viewtheorems.7.4GeneralProcedureThegeneralprocedureimplementedbyprimcorecperformsthefollowingsteps:1.Usethefunctions'typestoquerytheinvolvedconstructors,discriminators,andselectorsfromthecodatatypedatabase.2.Fromeachsuppliedformula'sstructure,determinethekindofformula.Forcon-structororcodeequations,calltherespectivereductionfunctionstoextractthesameinternal,destructor-basedrepresentationfromallthreeinputsyntaxes.Duringthisstep,theinterpretationof`_'wildcardsandthesequentialoptionareperformedandanyimplicitdiscriminatorformulasaregenerated.Afterthisstep,foreach(speciedorgenerated)formula,wehave:thefunction'sname,type,anditsarguments'namesandtypesasitoccuredinthisparticularterm;theconstructorthatthisformulaisrelevantto;theoriginaluserinput,andpossiblyifthisformulawasobtainedbyreducingfromadifferentviewthereduction'spreimage.Thespeciceldsfordiscriminatorformulasandselectorequationsarealistofpremisesandtheright-handside.3.Theselectorequationright-handsidesarescannedforcorecursivecallsandtheirstructureisrecorded.4.Usingthisnewinformation,gettherestofthecodatatypes'information(core-cursors,theorems,typesofcorecursion,etc.)fromthecodatatypedatabase.Thenested-to-mutualreductionisperformedinthisstepifnecessary.5.Denitionsforthespeciedfunctionsareobtained.Thisinvolvestranslatingselec-torequationright-handsidestobehavioralfunctions.6.Anyexclusivenessandexhaustivenesspropertiesareassembled.7.Fromthedenitions,exclusivenessandexhaustivenesstheorems,andcodatatype-andcorecursor-relatedtheorems,provethefunctions'characteristictheoremsinallofthesyntaxstyles. Liketherestofthe(co)datatypepackage,thecommandsarefullydenitional:Theyanalyzethespecicationsenteredbytheuser,synthesizedenitionsintermsofinter-nal(co)recursors,andgeneratecharacteristictheorems,allofthiswithoutintroducingaxiomsorextendingthelogic.Nestedrecursionishandledtrulymodularly.Nonetheless,theolderapproachofreducingnestedrecursiontomutualrecursionisalsosupported.Thetwoapproachescanbearbitrarilycombinedforbothrecursiveandcorecursivefunctions.Internally,suitable(co)recursorsand(co)inductionprinciplesarederivedtomakethispossible.Forfuturework,weareinterestedinstrongerformsofcorecursionaswellasmixedrecursivecorecursivedenitions.Wehavesomeideasalready,butweneedasolidtheoreticalfoundationsothatIsabelle'sinferencekernelcanacceptthedenitions.Acknowledgment.TobiasNipkowmadethisworkpossiblebyallowingtheseniorauthorstoneglecttheirdutieswhiletheydesignedandimplementedthenew(co)datatypepackage.AndreiPopescumastermindedthemetatheorybehindthepackage,withoutwhichtherewouldbeno(co)datatypes,no(co)recursors,andhenceno(co)recursivefunctiondenitions.FlorianHaft-mann,ChristianUrban,andMakariusWenzelprovidedgeneraladviceonIsabelleandpackagewriting.JohannesHölzlandAndreasLochbihlergavepreciousfeedbackattheearlystagesofprimcorec'simplementation.BlanchetteissupportedbytheDeutscheForschungsgemeinschaft(DFG)projectHardeningtheHammer(grantNi491/14-1).TraytelissupportedbytheDFGprogramProgramandModelAnalysis(PUMA,doctorateprogram1480).Theseniorauthorsarelistedalphabeticallyregard-lessofindividualcontributionsorrelativeseniority.References1.Berghofer,S.,Wenzel,M.:InductivedatatypesinHOLLessonslearnedinformal-logicen-gineering.In:Bertot,Y.,Dowek,G.,Hirschowitz,A.,Paulin,C.,Théry,L.(eds.)TPHOLs'99.LNCS,vol.1690,pp.1936.Springer(1999)2.Blanchette,J.C.,Hölzl,J.,Lochbihler,A.,Panny,L.,Popescu,A.,Traytel,D.:Trulymodular(co)datatypesforIsabelle/HOL.In:Klein,G.,Gamboa,R.(eds.)ITP2014.LNCS,Springer(2014)3.Blanchette,J.C.,Panny,L.,Popescu,A.,Traytel,D.:Dening(co)datatypesinIsabelle/HOL.http://isabelle.in.tum.de/dist/Isabelle/doc/datatypes.pdf(2013)4.Krauss,A.:Recursivedenitionsofmonadicfunctions.EPTCS43,113(2010)5.Krauss,A.:DeningrecursivefunctionsinIsabelle/HOL.http://isabelle.in.tum.de/doc/functions.pdf(2013)6.Lochbihler,A.,Hölzl,J.:Recursivefunctionsonlazylistsviadomainsandtopologies.In:Klein,G.,Gamboa,R.(eds.)ITP2014.LNCS,Springer(2014)7.Panny,L.:Primitively(Co)recursiveFunctionDenitionsforIsabelle/HOL.B.Sc.thesisdraft,TechnischeUniversitätMünchen(2014)8.Traytel,D.,Popescu,A.,Blanchette,J.C.:Foundational,compositional(co)datatypesforhigher-orderlogic:Categorytheoryappliedtotheoremproving.In:LICS2012,pp.596605.IEEE(2012)