In verified generic programming, one cannot exploit the structure of concrete data types but has to rely on well chosen sets of specifications or abstract data types (ADTs). Functors and monads are at the core of many applications of functional programming. This raises the question of what useful ADTs for verified functors and monads could look like. The functorial map of many important monads preserves extensional equality. For instance, if $f, g : A \rightarrow B$ are extensionally equal, that is, $\forall x \in A, \ f \ x = g \ x$, then $map \ f : List \ A \rightarrow List \ B$ and $map \ g$ are also extensionally equal. This suggests that preservation of extensional equality could be a useful principle in verified generic programming. We explore this possibility with a minimalist approach: we deal with (the lack of) extensional equality in Martin-L\"of's intensional type theories without extending the theories or using full-fledged setoids. Perhaps surprisingly, this minimal approach turns out to be extremely useful. It allows one to derive simple generic proofs of monadic laws but also verified, generic results in dynamical systems and control theory. In turn, these results avoid tedious code duplication and ad-hoc proofs. Thus, our work is a contribution towards pragmatic, verified generic programming.
翻译:在经过核实的通用编程中,人们无法利用具体数据类型的结构,但必须依赖精心选择的成套规格或抽象数据类型(ADTs)。 调料和调味物是功能性编程许多应用的核心。 这就提出了一个问题,即对经核实的调料和调味物来说,ADTs有什么用处。 许多重要的调味物的调料地图可以保存扩展性平等。 例如,如果 $f, g :\ rightrow B$是扩展式的, 也就是说, $\f\ f=x g = x $, 然后 $map\ f: 列表\\\ 直观列表\ B$ 和 $map\ gads 也可以是扩展式的。 这表明, 维护扩展性平等可能是经过核实的通用编程中的一项有用原则。 我们探索这种可能性, 最起码的方法是: 我们处理( ) 马丁- L\ 的扩展性编程中缺乏) 扩展性理论, \ f= g= gxxxxxxxxxxxxxxxxxxxxx, 然后 y- surrendational rogreal rogresulational rogresulationsurviewsurview.