Types 伊莎贝尔类型错误

Types 伊莎贝尔类型错误,types,isabelle,Types,Isabelle,我是伊莎贝尔的新手,在大学里做运动。我需要证明Isabelle中的一个反向函数 在Haskell中,函数如下所示: rev [] = [] rev (x:xs) = rev xs ++ [x] 我现在试图在Isabelle中定义这个函数“rev”。类型列表和函数“app”(追加) 伊莎贝尔给我的错误是: Type unification failed: Clash of types "_ ⇒ _" and "_ Exercise5.list" Type error in

我是伊莎贝尔的新手,在大学里做运动。我需要证明Isabelle中的一个反向函数

在Haskell中,函数如下所示:

rev [] = []
rev (x:xs) = rev xs ++ [x]
我现在试图在Isabelle中定义这个函数“rev”。类型列表和函数“app”(追加)

伊莎贝尔给我的错误是:

Type unification failed: Clash of types "_
          ⇒ _" and "_ Exercise5.list"

Type error in application: incompatible operand type

Operator:  app (rev xs) ::
  'a Exercise5.list ⇒ 'a Exercise5.list
Operand:   Exercise5.list.Cons ::
  ??'a ⇒ ??'a Exercise5.list ⇒ ??'a Exercise5.list
问题在哪里?据我所知,Isabelle告诉我“嘿,buddy应用程序需要两个类型为a'list的参数,但这里不是这种情况”

但是为什么呢xs显然属于a'列表的类型,使用Cons操作符,我是否也将x作为列表


谢谢你的帮助

考虑一下括号应该放在哪里
app rev xs Cons x Nil
:目前您似乎在其参数
Nil
上应用了函数
x
,谢谢!Cons(x Nil)应该是解决我的小问题的(Cons x Nil)。谢谢:)