Afewdetailshavebeenomittedabove.InChapter3,welearnedthatinductivetypefamiliesmayhaveboth%\index{parameters}\emph{%#<i>#parameters#</i>#%}%andregulararguments.Withinan[in]clause,aparameterpositionmusthavethewildcard[_]written,insteadofavariable.Furthermore,recentCoqversionsareaddingmoreandmoreheuristicstoinferdependent[match]annotationsincertainconditions.Thegeneralannotationinferenceproblemisundecidable,sotherewillalwaysbeseriouslimitationsonhowmuchworktheseheuristicscando.Whenindoubtaboutwhyaparticulardependent[match]isfailingtotype-check,addanexplicit[return]annotation!Atthatpoint,themechanicalrulesketchedinthissectionwillprovideacompleteaccountof%``%#"#what the type checker is thinking.#"#%''%Besuretoavoidthecommonpitfallofwritinga[return]annotationthatdoesnotmentionanyvariablesboundby[in]or[as];sucha[match]willneverrefinetypingrequirementsbasedonwhichpatternhasmatched.(Onesimpleexceptiontothisruleisthat,whenthediscrimineeisavariable,thatsamevariablemaybetreatedasifitwererepeatedasan[as]clause.)*)
Afewdetailshavebeenomittedabove.InChapter3,welearnedthatinductivetypefamiliesmayhaveboth%\index{parameters}\emph{%#<i>#parameters#</i>#%}%andregulararguments.Withinan[in]clause,aparameterpositionmusthavethewildcard[_]written,insteadofavariable.(Ingeneral,Coquseswildcard[_]'seithertoindicatepatternvariablesthatwillnotbementionedagainortoindicatepositionswherewewouldliketypeinferencetoinfertheappropriateterms.)Furthermore,recentCoqversionsareaddingmoreandmoreheuristicstoinferdependent[match]annotationsincertainconditions.Thegeneralannotationinferenceproblemisundecidable,sotherewillalwaysbeseriouslimitationsonhowmuchworktheseheuristicscando.Whenindoubtaboutwhyaparticulardependent[match]isfailingtotype-check,addanexplicit[return]annotation!Atthatpoint,themechanicalrulesketchedinthissectionwillprovideacompleteaccountof%``%#"#what the type checker is thinking.#"#%''%Besuretoavoidthecommonpitfallofwritinga[return]annotationthatdoesnotmentionanyvariablesboundby[in]or[as];sucha[match]willneverrefinetypingrequirementsbasedonwhichpatternhasmatched.(Onesimpleexceptiontothisruleisthat,whenthediscrimineeisavariable,thatsamevariablemaybetreatedasifitwererepeatedasan[as]clause.)*)