递归函数的证明性质

时间:2018-06-29 20:35:25

标签: lean

试图证明正数之和为正。

-- some function
variable {w : nat -> int}

-- sum of w's from 0 to i
def sw : nat -> int
| 0     := w 0
| (i+1) := sw i + w (i+1)

-- w is always positive
axiom w_pos : ∀ i : nat, 0 < w i

-- sum of w's is always positive
lemma sw_pos : ∀ i : nat, 0 < sw i // error here
| 0     := w_pos 0
| (i+1) :=
have h₁ : 0 + w (i+1) < sw (i+1), from add_lt_add_right (sw_pos i) (w (i+1)),
have h₂ : 0 < 0 + w (i+1), from add_lt_add_left (w_pos (i+1)) 0,
show 0 < sw (i+1), from lt_trans h₂ 

sw_pos的声明中,Lean抱怨说它“不知道如何为sw合成占位符上下文”。

如何解决此错误?

0 个答案:

没有答案