【问题标题】:Confusion about Morte (calculus of constructions) typing关于 Morte(结构演算)打字的困惑
【发布时间】:2018-11-28 09:42:03
【问题描述】:

Morte(构造演算的实现)中,这个表达式的类型很好:

$ morte
(  λ(Nat : *)
-> λ(Zero : Nat)
-> Zero
)
(∀(a : *) ->  (a ->  a) ->  a ->  a)
(λ(a : *) ->  λ(Succ : a ->  a) ->  λ(Zero : a) ->  Zero) 
^D
∀(a : *) → (a → a) → a → a

λ(a : *) → λ(Succ : a → a) → λ(Zero : a) → Zero

但这个明显等价的表达式不是:

$ morte
(  λ(Nat : *)
-> (  λ(Zero : Nat)
   -> Zero)
   (λ(a : *) ->  λ(Succ : a ->  a) ->  λ(Zero : a) ->  Zero)
)
(∀(a : *) ->  (a ->  a) ->  a ->  a)
^D
morte: 
Context:
Nat : *

Expression: (λ(Zero : Nat) → Zero) (λ(a : *) → λ(Succ : a → a) → λ(Zero : a) → Zero)

Error: Function applied to argument of the wrong type

Expected type: Nat
Argument type: ∀(a : *) → ∀(Succ : a → a) → ∀(Zero : a) → a

这是为什么?

【问题讨论】:

    标签: lambda-calculus morte


    【解决方案1】:

    你只是放错了括号。交换第 4 行和第 5 行,输入检查通过。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-31
      • 2013-08-11
      • 2015-10-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多