There are a number of issues here.
First of all, the statement you are trying to show simply does not hold for all x
. If x = 0
and y
is nonconstant, e.g. y = [:0,1:]
, you have
degree (y * [: x :]) = degree 0 = 0 ≠ 1 = degree y
The obvious way to fix this is to assume x ≠ 0
.
However, this is not sufficient either, since you only assumed 'a
to be a commutative ring. However, in a commutative ring, in general, you can have zero divisors. Consider the commutative ring ℤ/4ℤ
. Let x = 2
and y = [:0,2:]
.
Then y * [:x:] = [:0,4:]
, but 4 = 0
in ℤ/4ℤ
. Therefore y * [:x:] = 0
, and therefore, again,
degree (y * [: x :]) = degree 0 = 0 ≠ 1 = degree y
So, what you really need is one of the following two:
- the assumption
x ≠ 0
and 'a::idom instead of 'a::comm_ring. idom stands for “integral domain” and, that is simply a commutative ring with a 1 and without zero divisors
- more generally, the assumption that
x
is not a zero divisor
- even more generally, the assumption that
x * y ≠ 0
or, equivalently, x
times the leading coefficient of y is not 0
Also, the usage of ⋀ in Isar proofs is somewhat problematic at times. The “proper“ Isar way of doing this would be:
fix x :: "'a::idom" and y :: "'a poly"
assume "x ≠ 0"
hence "degree (y * [:x:]) = degree y" by simp
The relevant lemmas are degree_mult_eq
and degree_smult_eq
, you will see that they require the coefficient type to be an idom. This works for the first case I described above, the other two will require some more manual reasoning, I think.
EDIT: just a small hint: you can find theorems like this by typing
find_theorems "degree (_ * _)"
If you try to apply the degree_mult_eq
it shows to your situation (with comm_ring), you will find that it fails, even though the terms seem to match. If that is the case, it is usually a type issue, so you can write something like
from [[show_sorts]] degree_mult_eq
to see what the types and sorts required by the lemma are, and it says idom
.