4

Isabelle 在证明陈述时是否支持自定义案例区分?假设我想证明所有自然数的陈述n,但证明是完全不同的,取决于n是偶数还是奇数。是否可以在证明中区分这种情况,例如

 proof(cases n) 
   assume "n mod 2 = 0"
   <proof>
   next assume "n mod 2 = 1"
   <proof>
qed

到目前为止,我将引理/定理分成两个单独的部分(假设n偶数/奇数),然后使用这些部分来证明所有自然数的陈述,但这似乎不是最佳解决方案。

4

2 回答 2

6

在 Isabelle2017 中,您可以轻松地证明 ad-hoc 案例区分规则,如下所示:

lemma "P (n::nat)"
proof -
  consider (odd) "odd n" | (even) "even n" by auto
  then show ?thesis
  proof cases
    case odd
    then show ?thesis sorry
  next
    case even
    then show ?thesis sorry
  qed
qed
于 2018-01-26T12:27:32.467 回答
0

You can probably try the following thing:

proof -
   have "your statement" when "n mod 2 = 0"
   <proof>
   moreover
   have "your statement" when "n mod 2 = 1"
   <proof>
   ultimately
   show "your statement"
     by <some tactic>
qed
于 2018-01-26T12:35:13.057 回答