【发布时间】:2017-01-24 03:13:01
【问题描述】:
我是 Isabelle 的新手,我正在尝试定义原始递归函数。我已经尝试过加法,但乘法有问题。
datatype nati = Zero | Suc nati
primrec add :: "nati ⇒ nati ⇒ nati" where
"add Zero n = n" |
"add (Suc m) n = Suc(add m n)"
primrec mult :: "nati ⇒ nati ⇒ nati" where
"mult Suc(Zero) n = n" |
"mult (Suc m) n = add((mult m n) m)"
上述代码出现以下错误
类型统一失败:类型“_ ⇒ _”和“nati”的冲突
应用程序中的类型错误:运算符不是函数类型
运算符:mult m n :: nati
操作数:m :: nati
有什么想法吗?
【问题讨论】:
标签: isabelle