【发布时间】:2021-01-16 22:42:51
【问题描述】:
我决定证明以下定理:
theory Scratch
imports Main
begin
lemma "(3::int)^k mod 4 = 1 ⟷ even k"
proof (cases "even k")
case True
then obtain l where "2*l = k" by auto
then show ?thesis
using power_mult [of "(3::int)" 2 l]
and power_mod [of "(9::int)" 4 l] by auto
next
case False
then obtain l where "2*l + 1 = k" using odd_two_times_div_two_succ by blast
then have "(3::int)^k mod 4 = 3"
using power_mult [of "(3::int)" 2 l ]
and mod_mult_right_eq [of "(3::int)" "9^l" 4]
and power_mod [of "(9::int)" 4 l]
by auto
then show ?thesis using `odd k` by auto
qed
end
Isabelle 接受了证明,但在我看来,关于如何执行 mod 4 的计算有太多琐碎的细节:
then have "(3::int)^k mod 4 = 3"
using power_mult [of "(3::int)" 2 l ]
and mod_mult_right_eq [of "(3::int)" "9^l" 4]
and power_mod [of "(9::int)" 4 l]
by auto
除了power_mult的应用,这只是各种规则的应用
部分表达式可以安全地减少。有没有一种证明方法可以自动推断出这样的细节?
(对于我的证明风格,我也对任何其他 cmets 持开放态度 - 困扰我的一件事是重复的 ::int)
【问题讨论】:
-
对于那个精确的证明,
lemma "(3::int)^k mod 4 = 1 ⟷ even k" apply (cases ‹even k›) apply (auto elim!: oddE simp: power_mult simp flip: mod_mult_right_eq[of 3 ‹9^_›] power_mod[of 9]) done确实有效。但是您通常不想像那样压缩您的证明。而且我没有找到一种方法来折磨 simp 在没有实例化的情况下进行简化。 Simprocs 会很有用……
标签: isabelle modular-arithmetic