I am trying to learn isabelle/Isar and make sense out of the following simple proof about mod
from Rings.thy
. I made a copy of the type class to avoid clashing with the original:
class semiring_modulo1 = comm_semiring_1_cancel + divide + modulo +
assumes div_mult_mod_eq: "a div b * b + a mod b = a"
begin
Then this is the lemma whose proof confuses me. The first line makes sense as it uses a previous theorem and rewrites it by symmetry. But the next two lines look really strange. Each of them states the same thing equals itself (e.g. "a div b = a div b"
). They seem useless/meaningless. They do not connect to the q
or r
in the lemma to prove (q
and r
were never mentioned in the proof).
lemma mod_div_decomp:
fixes a b
obtains q r where "q = a div b" and "r = a mod b"
and "a = q * b + r"
proof -
from div_mult_mod_eq have "a = a div b * b + a mod b" by simp
moreover have "a div b = a div b" ..
moreover have "a mod b = a mod b" ..
note that ultimately show thesis by blast
qed
My questions are:
Why are these empty equalities necessary (and leaving them out breaks the proof)?
What is the equivalent statement of these in English/Mizar?
Are there alternative ways in Isar to write the proof in a way that is closer to English (e.g. take q = a div b ...)?