{"title":"Mystery functions: making specifications, unit tests, and implementations coexist in the mind of undergraduate students","authors":"O. Danvy","doi":"10.1145/3412932.3412934","DOIUrl":null,"url":null,"abstract":"This article documents how to make the concepts of specification, properties of specifications, unit tests, soundness of unit tests, implementation, and satisfaction coexist correctly, harmoniously, and effectively in the mind of undergraduate students, using an off-the-shelf proof assistant. The concepts are instilled through a family of puzzles: given the specification of a mystery function (i.e., conditions this function should satisfy), which functions---if any---satisfy this specification? Each puzzle is solved using a combination of informal induction (as in machine learning), structural recursion (to implement the function), and formal induction (to prove satisfaction), and in a consolidating way such that each concept has a place that makes sense, instead of being perceived as vague, alien, arbitrary, and irreproducible. The eureka moment that concludes each informal induction and the subsequent formal induction that confirms that the student was right make mystery functions rewarding, and repetition makes them addictive. Mystery functions can also be used as a vector for expansion as well as for reflection.","PeriodicalId":235054,"journal":{"name":"Proceedings of the 31st Symposium on Implementation and Application of Functional Languages","volume":"92 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2019-09-25","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"1","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 31st Symposium on Implementation and Application of Functional Languages","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3412932.3412934","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 1
Abstract
This article documents how to make the concepts of specification, properties of specifications, unit tests, soundness of unit tests, implementation, and satisfaction coexist correctly, harmoniously, and effectively in the mind of undergraduate students, using an off-the-shelf proof assistant. The concepts are instilled through a family of puzzles: given the specification of a mystery function (i.e., conditions this function should satisfy), which functions---if any---satisfy this specification? Each puzzle is solved using a combination of informal induction (as in machine learning), structural recursion (to implement the function), and formal induction (to prove satisfaction), and in a consolidating way such that each concept has a place that makes sense, instead of being perceived as vague, alien, arbitrary, and irreproducible. The eureka moment that concludes each informal induction and the subsequent formal induction that confirms that the student was right make mystery functions rewarding, and repetition makes them addictive. Mystery functions can also be used as a vector for expansion as well as for reflection.