在Isar风格的Isabelle样张中,这很有效:
from `a ∨ b` have foo
proof
assume a
show foo sorry
next
assume b
show foo sorry
qed
此处proof
调用的隐式规则是rule conjE
。但是我应该把它放在那里使其不仅仅是一个分离:
from `a ∨ b ∨ c` have foo
proof(?)
assume a
show foo sorry
next
assume b
show foo sorry
next
assume c
show foo sorry
qed
答案 0 :(得分:3)
在写这个问题时,我有了一个想法,结果证明是我想要的:
from `a ∨ b ∨ c` have foo
proof(elim disjE)
assume a
show foo sorry
next
assume b
show foo sorry
next
assume c
show foo sorry
qed
答案 1 :(得分:3)
进行此类案例分析的另一种规范方法如下:
{ assume a
have foo sorry }
moreover
{ assume b
have foo sorry }
moreover
{ assume c
have foo sorry }
ultimately
have foo using `a ∨ b ∨ c` by blast
也就是说,让一个自动工具“弄清楚”最后的细节。在考虑算术案例时(by arith
作为最后一步),这种方法尤其有效。
更新:使用新的consider
语句,可按以下方式完成:
notepad
begin
fix A B C assume "A ∨ B ∨ C"
then consider A | B | C by blast
then have "something"
proof (cases)
case 1
show ?thesis sorry
next
case 2
show ?thesis sorry
next
case 3
show ?thesis sorry
qed
end
答案 2 :(得分:1)
除了区分大小写之外,您似乎可以使用更通用的induct
方法来进行出价。对于三种情况,这可以这样工作:证明引理disjCases3
:
lemma disjCases3[consumes 1, case_names 1 2 3]:
assumes ABC: "A ∨ B ∨ C"
and AP: "A ⟹ P"
and BP: "B ⟹ P"
and CP: "C ⟹ P"
shows "P"
proof -
from ABC AP BP CP show ?thesis by blast
qed
您可以按如下方式使用此引理:
from `a ∨ b ∨ c` have foo
proof(induct rule: disjCases3)
case 1 thus ?case
sorry
next
case 2 thus ?case
sorry
next
case 3 thus ?case
sorry
qed
缺点是您需要一堆引理来涵盖任意数量的案例,disjCases2
,disjCases3
,disjCases4
,disjCases5
等等,但其他情况似乎如此工作得很好。