我创建了一个小证明,目的是创建一个用于next
证明案例的示例:
theory RedGreen
imports Main
begin
datatype color = RED | GREEN
fun green :: "color => color"
where
"green RED = GREEN"
| "green GREEN = GREEN"
lemma disj_not: "P \<or> Q \<Longrightarrow> \<not>P \<longrightarrow> Q"
proof
assume disj: "P \<or> Q"
assume "\<not>P"
from this show "Q" using `P \<or> Q` by (simp)
qed
lemma redgreen: "x \<noteq> RED \<longrightarrow> x = GREEN"
proof
assume notred: "x \<noteq> RED"
have "x = RED \<or> x = GREEN" by (simp only: color.nchotomy)
from this show "x = GREEN" using notred by (simp add: disj_not)
qed
lemma "green x = GREEN"
proof cases
assume "x = RED"
from this show "green x = GREEN" by (simp)
next
assume "x \<noteq> RED"
from this have "x = GREEN" by (simp add: redgreen)
from this show "green x = GREEN" by (simp)
qed
这可以在不丢失细节的情况下简化吗?使用一些神奇的技巧不是我想要的。欢迎改进使用 Isar 的风格。