带扭曲的递归函数的归纳

时间:2013-09-25 17:23:55

标签: isabelle

我试图证明这个定理是n > 0然后是g n b = True(见下文)。情况就是这样,因为g (Suc n) b只调用g 0 True。不幸的是,当我尝试证明g 0 b时,我的归纳中没有这个事实。如何完成证明(我需要用sorry代替什么?)

fun g :: "nat ⇒ bool ⇒ bool" where
  "g (Suc n) b = g n True" |
  "g 0 b = b"

theorem 
    fixes n::nat and b::bool
    assumes "n > 0"
    shows "g n b"
proof (induct n b rule: g.induct)
    fix n 
    fix b
    assume "g n True"
    thus "g (Suc n) b" by (metis g.simps(1))
next
    fix b
    show "g 0 b" sorry
qed

1 个答案:

答案 0 :(得分:6)

您忘了在导入中使用假设n > 0

例如,你可以写

theorem 
  fixes n::nat and b::bool
  assumes "n > 0"
  shows "g n b"
using assms (* this is important *)
proof (induct n b rule: g.induct)
  case (1 n b)
  thus ?case by (cases n) auto
next
  case (2 b)
  thus ?case by auto
qed

或者你可以立即开始这样的定理 并进一步缩短:

theorem "n > 0 ==> g n b"
proof (induct n b rule: g.induct)
  case (1 n b)
  thus ?case by (cases n) auto
qed auto