lean是否具有用于签名声明的语法?

时间:2018-11-21 03:40:12

标签: lean

我看过但没有找到文档中描述的任何机制,该机制使您可以通过其签名来描述一个部分。例如,在下面的部分中,def的语法要求在右侧(此处抱歉)

section
  variable A : Type
  def ident : A → A := sorry
end

是否有签名之类的东西可以让您转发声明节的内容?例如以下组成语法

signature
  variable A : Type
  def ident : A → A
end

以下是我使用实际语法得出的最接近的结果: 两次声明证明,第二次将证明放在右边尽可能短。

section
  variables A B : Type
  def ident' {A : Type} : A → A := (λ x, x)
  def mp' {A B : Type}: (A → B) → A → B := (λ f, λ x, f x)

  /- Signature-/
  def ident : A → A := ident'
  def mp : (A → B) → A → B := mp'
end

1 个答案:

答案 0 :(得分:0)

否,通常不允许前向声明。像大多数其他ITP一样,精益依赖于终止检查的声明顺序。前向声明将允许您引入任意的相互递归,精益3仅在明确分隔的上下文中接受:

mutual def even, odd
with even : nat → bool
| 0     := tt
| (a+1) := odd a
with odd : nat → bool
| 0     := ff
| (a+1) := even a

(来自Theorem Proving in Lean