headtail2n62归纳和余归纳余归纳定义的数据和函数的性质.PPTVIP

  • 20
  • 0
  • 约9.11千字
  • 约 43页
  • 2017-12-22 发布于天津
  • 举报

headtail2n62归纳和余归纳余归纳定义的数据和函数的性质.PPT

headtail2n62归纳和余归纳余归纳定义的数据和函数的性质

* * * * * * * * * * * * * * * * * * * * * * * 6.3 递 归 类 型 自然数类型的递归定义 nat ? unit+(unit+(unit+(unit+(unit+…+nat)…))) 自然数0和1的定义如下 ?0? ? fold(Inleft?) ?1? ? fold(Inright fold(Inleft?)) 对任何自然数n ? 0,可以类似地定义如下 ?n?? fold(Inright fold(Inright…fold(Inleft?)…)) 后继函数正好使用fold和Inright: succ ? ?x:nat. fold(Inright x) 6.3 递 归 类 型 自然数表的类型 list ? unit + (nat ? list) list ? ? t.unit + (nat ? t) nil ? fold(Inleft ?) cons x l ? fold(Inright ?x, l?) 根据表的形式进行分支的函数listcase定义如下 listcase? ?x:list.?y:?.?f:list??. Caseunit, list, ?(unfold x) (?w:uni

文档评论(0)

1亿VIP精品文档

相关文档