用Isabelle中的归纳证明形式~pvq的定理

时间:2017-05-17 07:10:41

标签: isabelle

我有一个叫做反馈的函数,它计算3的幂(即)

feedback(t)= 3 ^ t

primrec feedback :: "nat ⇒ nat" where
"feedback 0 = Suc(0)"|
"feedback (Suc t) = (feedback t)*3"

我想证明

  

如果t> 5然后反馈(t)> 200

使用归纳

lemma th2: "¬(t>5) ∨ ((feedback t) > 200)" (is "?H(t)" is "?P(t)∨?Q(t)" is "(?P(t))∨(?F(t) > 200)")  
proof(induct t) 
   case 0 show "?P 0 ∨ ?Q 0" by simp
next 
   assume a:" ?F(t) > 200"
   assume d: "?P(t) = False"
   have b: "?F (Suc(t)) ≥ ?F(t)" by simp
   from b and a have c: "?F(Suc(t)) > 200" by simp
   from c have e: "?Q(Suc(t))" by simp
   from d have f:"?P(Suc(t)) = False" by simp
   from f and e have g: "?P(Suc(t))∨?Q(Suc(t))" by simp
   from a and d and g have h: "?P(t)∨?Q(t) ⟹ ?P(Suc(t))∨?Q(Suc(t))" by simp 
   from a and d have "?H(Suc(t))" by simp
qed

首先我证明了

  • feedback(t + 1)> = feedback(t)
  • 然后假设反馈(t)> 200,所以反馈(t + 1)> 200
  • 假设t> 5
  • 这意味着(t + 1)> 5
  • 也〜((t + 1)> 5)V(反馈(t + 1)> 200)为真
  • 因此,如果P(t)为真,则P(t + 1)为真

但这不起作用。我不知道问题是什么

1 个答案:

答案 0 :(得分:1)

嗯,首先,你不能简单地假设伊萨尔的任意事物。或者更确切地说,你可以做到这一点,但是在你做完之后你就无法展示你的目标。伊萨尔允许你承担的事情是非常严格的;就你而言,它是¬ 5 < t ∨ 200 < feedback t

我建议使用case命令,它为您提供正确的选择。然后,您可以对该分离进行区分,然后另一个区分t = 5

lemma th2: "¬(t>5) ∨ ((feedback t) > 200)"  
proof (induct t) 
  case 0
  show ?case by simp
next
  case (Suc t)
  thus ?case
  proof
    assume "¬t > 5"
    moreover have "feedback 6 = 729" by code_simp 
      -- ‹"simp add: eval_nat_numeral" would also work›
    ultimately show ?thesis
      by (cases "t = 5") auto
  next
    assume "feedback t > 200"
    thus ?thesis by simp
  qed
qed

或者,更紧凑:

lemma th2: "¬(t>5) ∨ ((feedback t) > 200)"  
proof (induct t) 
  case (Suc t)
  moreover have "feedback 6 = 729" by code_simp
  ultimately show ?case by (cases "t = 5") auto
qed simp_all

如果您的反馈功能实际上是单调的,我建议首先证明这一点,然后证明变得不那么乏味了。