[STATEMENT]
lemma gauss_poly_div_gauss_poly_iff_1:
  fixes l m :: nat
  assumes "l > 0"
  shows "(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<longleftrightarrow> l dvd m"
    (is "?lhs \<longleftrightarrow> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
define q where "q = m div l"
[PROOF STATE]
proof (state)
this:
q = m div l

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
define r where "r = m mod l"
[PROOF STATE]
proof (state)
this:
r = m mod l

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
have m_def: "m = q * l + r" and r_range: "r < l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m = q * l + r &&& r < l
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < l

goal (1 subgoal):
 1. m = q * l + r &&& r < l
[PROOF STEP]
by (auto simp add:q_def r_def)
[PROOF STATE]
proof (state)
this:
m = q * l + r
r < l

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
have pow_sum_carr:"(\<Oplus>\<^bsub>P\<^esub>i\<in>{..<q}. (X [^]\<^bsub>P\<^esub> l)[^]\<^bsub>P\<^esub> i) \<in> carrier P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum P (([^]\<^bsub>P\<^esub>) (X [^]\<^bsub>P\<^esub> l)) {..<q} \<in> carrier P
[PROOF STEP]
using var_pow_closed
[PROOF STATE]
proof (prove)
using this:
X [^]\<^bsub>P\<^esub> ?n \<in> carrier P

goal (1 subgoal):
 1. finsum P (([^]\<^bsub>P\<^esub>) (X [^]\<^bsub>P\<^esub> l)) {..<q} \<in> carrier P
[PROOF STEP]
by (intro p.finsum_closed, simp)
[PROOF STATE]
proof (state)
this:
finsum P (([^]\<^bsub>P\<^esub>) (X [^]\<^bsub>P\<^esub> l)) {..<q} \<in> carrier P

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
have "(X [^]\<^bsub>P\<^esub> (q*l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = ((X [^]\<^bsub>P\<^esub> l)[^]\<^bsub>P\<^esub> q) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = (X [^]\<^bsub>P\<^esub> l) [^]\<^bsub>P\<^esub> q \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>
[PROOF STEP]
using var_closed
[PROOF STATE]
proof (prove)
using this:
X \<in> carrier P
polynomial (carrier R) X

goal (1 subgoal):
 1. X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = (X [^]\<^bsub>P\<^esub> l) [^]\<^bsub>P\<^esub> q \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>
[PROOF STEP]
by (subst p.nat_pow_pow, simp_all add:algebra_simps)
[PROOF STATE]
proof (state)
this:
X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = (X [^]\<^bsub>P\<^esub> l) [^]\<^bsub>P\<^esub> q \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = (X [^]\<^bsub>P\<^esub> l) [^]\<^bsub>P\<^esub> q \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
have "... =
    (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<otimes>\<^bsub>P\<^esub> (\<Oplus>\<^bsub>P\<^esub>i\<in>{..<q}. (X [^]\<^bsub>P\<^esub> l) [^]\<^bsub>P\<^esub> i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l) [^]\<^bsub>P\<^esub> q \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<otimes>\<^bsub>P\<^esub> finsum P (([^]\<^bsub>P\<^esub>) (X [^]\<^bsub>P\<^esub> l)) {..<q}
[PROOF STEP]
using var_pow_closed
[PROOF STATE]
proof (prove)
using this:
X [^]\<^bsub>P\<^esub> ?n \<in> carrier P

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l) [^]\<^bsub>P\<^esub> q \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<otimes>\<^bsub>P\<^esub> finsum P (([^]\<^bsub>P\<^esub>) (X [^]\<^bsub>P\<^esub> l)) {..<q}
[PROOF STEP]
by (subst p.geom[symmetric], simp_all)
[PROOF STATE]
proof (state)
this:
(X [^]\<^bsub>P\<^esub> l) [^]\<^bsub>P\<^esub> q \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<otimes>\<^bsub>P\<^esub> finsum P (([^]\<^bsub>P\<^esub>) (X [^]\<^bsub>P\<^esub> l)) {..<q}

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<otimes>\<^bsub>P\<^esub> finsum P (([^]\<^bsub>P\<^esub>) (X [^]\<^bsub>P\<^esub> l)) {..<q}
[PROOF STEP]
have pow_sum_fact: "(X [^]\<^bsub>P\<^esub> (q*l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) =
    (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<otimes>\<^bsub>P\<^esub> (\<Oplus>\<^bsub>P\<^esub>i\<in>{..<q}. (X\<^bsub>R\<^esub> [^]\<^bsub>P\<^esub> l) [^]\<^bsub>P\<^esub> i)"
[PROOF STATE]
proof (prove)
using this:
X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<otimes>\<^bsub>P\<^esub> finsum P (([^]\<^bsub>P\<^esub>) (X [^]\<^bsub>P\<^esub> l)) {..<q}

goal (1 subgoal):
 1. X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<otimes>\<^bsub>P\<^esub> finsum P (([^]\<^bsub>P\<^esub>) (X [^]\<^bsub>P\<^esub> l)) {..<q}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<otimes>\<^bsub>P\<^esub> finsum P (([^]\<^bsub>P\<^esub>) (X [^]\<^bsub>P\<^esub> l)) {..<q}

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
have "(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) divides\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q*l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) divides\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
[PROOF STEP]
by (rule dividesI[OF pow_sum_carr pow_sum_fact])
[PROOF STATE]
proof (state)
this:
(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) divides\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
hence c:"(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) divides\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)"
[PROOF STATE]
proof (prove)
using this:
(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) divides\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) divides\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
[PROOF STEP]
using var_pow_closed
[PROOF STATE]
proof (prove)
using this:
(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) divides\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
X [^]\<^bsub>P\<^esub> ?n \<in> carrier P

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) divides\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
[PROOF STEP]
by (intro p.divides_prod_l, auto)
[PROOF STATE]
proof (state)
this:
(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) divides\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
have "(X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = X [^]\<^bsub>P\<^esub> (r + q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> (r + q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>
[PROOF STEP]
unfolding m_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X [^]\<^bsub>P\<^esub> (q * l + r) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> (r + q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>
[PROOF STEP]
using add.commute
[PROOF STATE]
proof (prove)
using this:
?a + ?b = ?b + ?a

goal (1 subgoal):
 1. X [^]\<^bsub>P\<^esub> (q * l + r) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> (r + q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> (r + q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> (r + q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
have "... = (X [^]\<^bsub>P\<^esub> r) \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q*l)) \<oplus>\<^bsub>P\<^esub> (\<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X [^]\<^bsub>P\<^esub> (r + q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> (q * l) \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>
[PROOF STEP]
using var_closed
[PROOF STATE]
proof (prove)
using this:
X \<in> carrier P
polynomial (carrier R) X

goal (1 subgoal):
 1. X [^]\<^bsub>P\<^esub> (r + q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> (q * l) \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>
[PROOF STEP]
by (subst p.nat_pow_mult, auto simp add:a_minus_def)
[PROOF STATE]
proof (state)
this:
X [^]\<^bsub>P\<^esub> (r + q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> (q * l) \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
X [^]\<^bsub>P\<^esub> (r + q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> (q * l) \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
have "... = ((X [^]\<^bsub>P\<^esub> r) \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q*l) \<oplus>\<^bsub>P\<^esub> (\<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>))
    \<oplus>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> r)) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> (q * l) \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>
[PROOF STEP]
using var_pow_closed
[PROOF STATE]
proof (prove)
using this:
X [^]\<^bsub>P\<^esub> ?n \<in> carrier P

goal (1 subgoal):
 1. X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> (q * l) \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>
[PROOF STEP]
by algebra
[PROOF STATE]
proof (state)
this:
X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> (q * l) \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> (q * l) \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
have "... = (X [^]\<^bsub>P\<^esub> r) \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q*l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
    \<oplus>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> r) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>
[PROOF STEP]
by algebra
[PROOF STATE]
proof (state)
this:
X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
have "... = (X [^]\<^bsub>P\<^esub> r) \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q*l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
    \<oplus>\<^bsub>P\<^esub> ((X [^]\<^bsub>P\<^esub> r) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
[PROOF STEP]
unfolding a_minus_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> r \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> r \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
[PROOF STEP]
using var_pow_closed
[PROOF STATE]
proof (prove)
using this:
X [^]\<^bsub>P\<^esub> ?n \<in> carrier P

goal (1 subgoal):
 1. X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> r \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> r \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
[PROOF STEP]
by (subst p.a_assoc, auto)
[PROOF STATE]
proof (state)
this:
X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
[PROOF STEP]
have a:"(X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) =
    (X [^]\<^bsub>P\<^esub> r) \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q*l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)"
    (is "_ = ?x")
[PROOF STATE]
proof (prove)
using this:
X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)

goal (1 subgoal):
 1. X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
have xn_m_1_deg': "degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n"
    if "n > 0" for n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
have "degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = degree (X [^]\<^bsub>P\<^esub> n \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = degree (X [^]\<^bsub>P\<^esub> n \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
[PROOF STEP]
by (simp add:a_minus_def)
[PROOF STATE]
proof (state)
this:
degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = degree (X [^]\<^bsub>P\<^esub> n \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)

goal (1 subgoal):
 1. degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = degree (X [^]\<^bsub>P\<^esub> n \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)

goal (1 subgoal):
 1. degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
have "... = max (degree (X [^]\<^bsub>P\<^esub> n)) (degree (\<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (X [^]\<^bsub>P\<^esub> n \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = max (degree (X [^]\<^bsub>P\<^esub> n)) (degree (\<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>))
[PROOF STEP]
using var_pow_closed var_pow_carr var_pow_degree
[PROOF STATE]
proof (prove)
using this:
X [^]\<^bsub>P\<^esub> ?n \<in> carrier P
X [^]\<^bsub>P\<^esub> ?n \<in> carrier P - {\<zero>\<^bsub>P\<^esub>}
degree (X [^]\<^bsub>P\<^esub> ?n) = ?n

goal (1 subgoal):
 1. degree (X [^]\<^bsub>P\<^esub> n \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = max (degree (X [^]\<^bsub>P\<^esub> n)) (degree (\<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>))
[PROOF STEP]
using univ_poly_a_inv_degree degree_one that
[PROOF STATE]
proof (prove)
using this:
X [^]\<^bsub>P\<^esub> ?n \<in> carrier P
X [^]\<^bsub>P\<^esub> ?n \<in> carrier P - {\<zero>\<^bsub>P\<^esub>}
degree (X [^]\<^bsub>P\<^esub> ?n) = ?n
?p \<in> carrier P \<Longrightarrow> degree (\<ominus>\<^bsub>P\<^esub> ?p) = degree ?p
degree \<one>\<^bsub>?K [X]\<^esub> = 0
0 < n

goal (1 subgoal):
 1. degree (X [^]\<^bsub>P\<^esub> n \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = max (degree (X [^]\<^bsub>P\<^esub> n)) (degree (\<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>))
[PROOF STEP]
by (subst degree_add_distinct, auto)
[PROOF STATE]
proof (state)
this:
degree (X [^]\<^bsub>P\<^esub> n \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = max (degree (X [^]\<^bsub>P\<^esub> n)) (degree (\<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>))

goal (1 subgoal):
 1. degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
degree (X [^]\<^bsub>P\<^esub> n \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = max (degree (X [^]\<^bsub>P\<^esub> n)) (degree (\<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>))

goal (1 subgoal):
 1. degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
have "... = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max (degree (X [^]\<^bsub>P\<^esub> n)) (degree (\<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)) = n
[PROOF STEP]
using var_pow_degree degree_one univ_poly_a_inv_degree
[PROOF STATE]
proof (prove)
using this:
degree (X [^]\<^bsub>P\<^esub> ?n) = ?n
degree \<one>\<^bsub>?K [X]\<^esub> = 0
?p \<in> carrier P \<Longrightarrow> degree (\<ominus>\<^bsub>P\<^esub> ?p) = degree ?p

goal (1 subgoal):
 1. max (degree (X [^]\<^bsub>P\<^esub> n)) (degree (\<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)) = n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
max (degree (X [^]\<^bsub>P\<^esub> n)) (degree (\<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)) = n

goal (1 subgoal):
 1. degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n

goal (1 subgoal):
 1. degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < ?n \<Longrightarrow> degree (X [^]\<^bsub>P\<^esub> ?n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = ?n

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
have xn_m_1_deg: "degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n" for n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
proof (cases "n > 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < n \<Longrightarrow> degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
 2. \<not> 0 < n \<Longrightarrow> degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
0 < n

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
 2. \<not> 0 < n \<Longrightarrow> degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
using xn_m_1_deg'
[PROOF STATE]
proof (prove)
using this:
0 < n
0 < ?n \<Longrightarrow> degree (X [^]\<^bsub>P\<^esub> ?n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = ?n

goal (1 subgoal):
 1. degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n

goal (1 subgoal):
 1. \<not> 0 < n \<Longrightarrow> degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> 0 < n \<Longrightarrow> degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> 0 < n

goal (1 subgoal):
 1. \<not> 0 < n \<Longrightarrow> degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
hence "n = 0"
[PROOF STATE]
proof (prove)
using this:
\<not> 0 < n

goal (1 subgoal):
 1. n = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n = 0

goal (1 subgoal):
 1. \<not> 0 < n \<Longrightarrow> degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
hence "degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = degree (\<zero>\<^bsub>P\<^esub>)"
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = degree \<zero>\<^bsub>P\<^esub>
[PROOF STEP]
by (intro arg_cong[where f="degree"], simp)
[PROOF STATE]
proof (state)
this:
degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = degree \<zero>\<^bsub>P\<^esub>

goal (1 subgoal):
 1. \<not> 0 < n \<Longrightarrow> degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = degree \<zero>\<^bsub>P\<^esub>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = degree \<zero>\<^bsub>P\<^esub>

goal (1 subgoal):
 1. degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = degree \<zero>\<^bsub>P\<^esub>
\<not> 0 < n

goal (1 subgoal):
 1. degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n
[PROOF STEP]
by (simp add:univ_poly_zero)
[PROOF STATE]
proof (state)
this:
degree (X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
degree (X [^]\<^bsub>P\<^esub> ?n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = ?n

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
have b: "degree (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) > degree (X\<^bsub>R\<^esub> [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) < degree (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
[PROOF STEP]
using r_range
[PROOF STATE]
proof (prove)
using this:
r < l

goal (1 subgoal):
 1. degree (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) < degree (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
[PROOF STEP]
unfolding xn_m_1_deg
[PROOF STATE]
proof (prove)
using this:
r < l

goal (1 subgoal):
 1. r < l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) < degree (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
have xn_m_1_carr: "X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> \<in> carrier P" for n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X [^]\<^bsub>P\<^esub> n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> \<in> carrier P
[PROOF STEP]
unfolding a_minus_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X [^]\<^bsub>P\<^esub> n \<oplus>\<^bsub>P\<^esub> \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> \<in> carrier P
[PROOF STEP]
by (intro p.a_closed var_pow_closed, simp)
[PROOF STATE]
proof (state)
this:
X [^]\<^bsub>P\<^esub> ?n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> \<in> carrier P

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
have "?lhs \<longleftrightarrow> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides ?x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>))
[PROOF STEP]
by (subst a, simp)
[PROOF STATE]
proof (state)
this:
(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>))

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>))

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
have "... \<longleftrightarrow> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)) = (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
[PROOF STEP]
unfolding pdivides_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) divides\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)) = (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) divides\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
[PROOF STEP]
by (intro p.div_sum_iff c var_pow_closed
        xn_m_1_carr p.a_closed p.m_closed)
[PROOF STATE]
proof (state)
this:
(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)) = (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> (q * l) \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) \<oplus>\<^bsub>P\<^esub> (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)) = (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
have "... \<longleftrightarrow> r = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
[PROOF STEP]
proof (cases "r = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. r = 0 \<Longrightarrow> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
 2. r \<noteq> 0 \<Longrightarrow> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
r = 0

goal (2 subgoals):
 1. r = 0 \<Longrightarrow> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
 2. r \<noteq> 0 \<Longrightarrow> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
[PROOF STEP]
have "(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides \<zero>\<^bsub>P\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides \<zero>\<^bsub>P\<^esub>
[PROOF STEP]
unfolding univ_poly_zero
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides []
[PROOF STEP]
by (intro pdivides_zero xn_m_1_carr)
[PROOF STATE]
proof (state)
this:
(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides \<zero>\<^bsub>P\<^esub>

goal (2 subgoals):
 1. r = 0 \<Longrightarrow> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
 2. r \<noteq> 0 \<Longrightarrow> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides \<zero>\<^bsub>P\<^esub>

goal (2 subgoals):
 1. r = 0 \<Longrightarrow> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
 2. r \<noteq> 0 \<Longrightarrow> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
[PROOF STEP]
have "... = (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<zero>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>
[PROOF STEP]
by (simp add:a_minus_def True) algebra
[PROOF STATE]
proof (state)
this:
\<zero>\<^bsub>P\<^esub> = X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>

goal (2 subgoals):
 1. r = 0 \<Longrightarrow> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
 2. r \<noteq> 0 \<Longrightarrow> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
r = 0

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)

goal (1 subgoal):
 1. r \<noteq> 0 \<Longrightarrow> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r \<noteq> 0 \<Longrightarrow> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
r \<noteq> 0

goal (1 subgoal):
 1. r \<noteq> 0 \<Longrightarrow> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
[PROOF STEP]
hence "degree (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) > 0"
[PROOF STATE]
proof (prove)
using this:
r \<noteq> 0

goal (1 subgoal):
 1. 0 < degree (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
[PROOF STEP]
using xn_m_1_deg
[PROOF STATE]
proof (prove)
using this:
r \<noteq> 0
degree (X [^]\<^bsub>P\<^esub> ?n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = ?n

goal (1 subgoal):
 1. 0 < degree (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < degree (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)

goal (1 subgoal):
 1. r \<noteq> 0 \<Longrightarrow> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
[PROOF STEP]
hence "X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
0 < degree (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)

goal (1 subgoal):
 1. X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> \<noteq> []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> \<noteq> []

goal (1 subgoal):
 1. r \<noteq> 0 \<Longrightarrow> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
[PROOF STEP]
hence "\<not>(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)"
[PROOF STATE]
proof (prove)
using this:
X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> \<noteq> []

goal (1 subgoal):
 1. \<not> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
[PROOF STEP]
using pdivides_imp_degree_le b xn_m_1_carr
[PROOF STATE]
proof (prove)
using this:
X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> \<noteq> []
\<lbrakk>?p \<in> carrier P; ?q \<in> carrier P; ?q \<noteq> []; ?p pdivides ?q\<rbrakk> \<Longrightarrow> degree ?p \<le> degree ?q
degree (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) < degree (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
X [^]\<^bsub>P\<^esub> ?n \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub> \<in> carrier P

goal (1 subgoal):
 1. \<not> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
[PROOF STEP]
by (metis le_antisym less_or_eq_imp_le nat_neq_iff)
[PROOF STATE]
proof (state)
this:
\<not> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)

goal (1 subgoal):
 1. r \<noteq> 0 \<Longrightarrow> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<not> (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>)
r \<noteq> 0

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> r \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (r = 0)

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
have "... \<longleftrightarrow> l dvd m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r = 0) = (l dvd m)
[PROOF STEP]
unfolding m_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r = 0) = (l dvd q * l + r)
[PROOF STEP]
using r_range assms
[PROOF STATE]
proof (prove)
using this:
r < l
0 < l

goal (1 subgoal):
 1. (r = 0) = (l dvd q * l + r)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(r = 0) = (l dvd m)

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)

goal (1 subgoal):
 1. (X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(X [^]\<^bsub>P\<^esub> l \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) pdivides (X [^]\<^bsub>P\<^esub> m \<ominus>\<^bsub>P\<^esub> \<one>\<^bsub>P\<^esub>) = (l dvd m)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unit_register_domain_tensor_unit:
  fixes U :: \<open>'a::domain update \<Rightarrow> _\<close>
  assumes \<open>is_unit_register U\<close>
  shows \<open>\<exists>I :: 'b::domain update \<Rightarrow> ('a*'b) update. iso_register I\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>I. iso_register I
[PROOF STEP]
(* Can we show that I = (\<lambda>x. tensor_update id_update x) ? It would be nice but I do not see how to prove it. *)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>I. iso_register I
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>I. iso_register I
[PROOF STEP]
have \<open>equivalent_registers (id :: 'b update \<Rightarrow> _) (complement id; id)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. equivalent_registers id (complement id;id)
[PROOF STEP]
using id_complement_is_unit_register iso_register_equivalent_id register_id unit_register_pair
[PROOF STATE]
proof (prove)
using this:
is_unit_register (complement id)
equivalent_registers id ?F = iso_register ?F
register id
\<lbrakk>is_unit_register ?U; register ?X\<rbrakk> \<Longrightarrow> equivalent_registers ?X (?U;?X)

goal (1 subgoal):
 1. equivalent_registers id (complement id;id)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
equivalent_registers id (complement id;id)

goal (1 subgoal):
 1. \<exists>I. iso_register I
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
equivalent_registers id (complement id;id)
[PROOF STEP]
obtain J :: \<open>'b update \<Rightarrow> ((('b, 'b) complement_domain * 'b) update)\<close> where \<open>iso_register J\<close>
[PROOF STATE]
proof (prove)
using this:
equivalent_registers id (complement id;id)

goal (1 subgoal):
 1. (\<And>J. iso_register J \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using equivalent_registers_def iso_register_inv
[PROOF STATE]
proof (prove)
using this:
equivalent_registers id (complement id;id)
equivalent_registers ?F ?G = (register ?F \<and> (\<exists>I. iso_register I \<and> ?F \<circ> I = ?G))
iso_register ?F \<Longrightarrow> iso_register (inv ?F)

goal (1 subgoal):
 1. (\<And>J. iso_register J \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
iso_register J

goal (1 subgoal):
 1. \<exists>I. iso_register I
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
iso_register J

goal (1 subgoal):
 1. \<exists>I. iso_register I
[PROOF STEP]
obtain K :: \<open>('b, 'b) complement_domain update \<Rightarrow> 'a update\<close> where \<open>iso_register K\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>K. iso_register K \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms id_complement_is_unit_register unit_register_domains_isomorphic
[PROOF STATE]
proof (prove)
using this:
is_unit_register U
is_unit_register (complement id)
\<lbrakk>is_unit_register ?F; is_unit_register ?G\<rbrakk> \<Longrightarrow> \<exists>I. iso_register I

goal (1 subgoal):
 1. (\<And>K. iso_register K \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
iso_register K

goal (1 subgoal):
 1. \<exists>I. iso_register I
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
iso_register J
iso_register K
[PROOF STEP]
have \<open>iso_register ((K \<otimes>\<^sub>r id) o J)\<close>
[PROOF STATE]
proof (prove)
using this:
iso_register J
iso_register K

goal (1 subgoal):
 1. iso_register (K \<otimes>\<^sub>r id \<circ> J)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
iso_register (K \<otimes>\<^sub>r id \<circ> J)

goal (1 subgoal):
 1. \<exists>I. iso_register I
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
iso_register (K \<otimes>\<^sub>r id \<circ> J)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
iso_register (K \<otimes>\<^sub>r id \<circ> J)

goal (1 subgoal):
 1. \<exists>I. iso_register I
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>I. iso_register I

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bit_0:
  \<open>bit a 0 \<longleftrightarrow> odd a\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit a 0 = odd a
[PROOF STEP]
by (simp add: bit_iff_odd)


[STATEMENT]
lemma iterates_above_le_f: "\<lbrakk> x \<in> iterates_above a; a \<in> Field leq \<rbrakk> \<Longrightarrow> (x, f x) \<in> leq"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> iterates_above a; a \<in> Field leq\<rbrakk> \<Longrightarrow> (x, f x) \<in> leq
[PROOF STEP]
by(induction x rule: iterates_above.induct)(blast intro: increasing FieldI2 lub_in_Field)+


[STATEMENT]
lemma ins_inv1_inv2:
  assumes "inv1 t" "inv2 t"
  shows "inv2 (rbt_ins f k x t)" "bheight (rbt_ins f k x t) = bheight t"
  "color_of t = B \<Longrightarrow> inv1 (rbt_ins f k x t)" "inv1l (rbt_ins f k x t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (inv2 (rbt_ins f k x t) &&& bheight (rbt_ins f k x t) = bheight t) &&& (color_of t = B \<Longrightarrow> inv1 (rbt_ins f k x t)) &&& inv1l (rbt_ins f k x t)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
inv1 t
inv2 t

goal (1 subgoal):
 1. (inv2 (rbt_ins f k x t) &&& bheight (rbt_ins f k x t) = bheight t) &&& (color_of t = B \<Longrightarrow> inv1 (rbt_ins f k x t)) &&& inv1l (rbt_ins f k x t)
[PROOF STEP]
by (induct f k x t rule: rbt_ins.induct) (auto simp: balance_inv1 balance_inv2 balance_bheight)


[STATEMENT]
lemma right_adjoint_preserved_by_iso':
    assumes "is_right_adjoint g" and "g \<cong> g'"
    shows "is_right_adjoint g'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_right_adjoint g'
[PROOF STEP]
using assms isomorphic_def right_adjoint_preserved_by_iso
[PROOF STATE]
proof (prove)
using this:
is_right_adjoint g
g \<cong> g'
(?a \<cong> ?a') = (\<exists>f. \<guillemotleft>f : ?a \<Rightarrow> ?a'\<guillemotright> \<and> local.iso f)
\<lbrakk>is_right_adjoint ?g; \<guillemotleft>?\<phi> : ?g \<Rightarrow> ?g'\<guillemotright>; local.iso ?\<phi>\<rbrakk> \<Longrightarrow> is_right_adjoint ?g'

goal (1 subgoal):
 1. is_right_adjoint g'
[PROOF STEP]
by blast


[STATEMENT]
lemma Stirling_fps_aux: "(fps_exp 1 - 1) ^ m $ n * fact n = fact m * real (Stirling n m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fps_exp 1 - 1) ^ m $ n * fact n = fact m * real (Stirling n m)
[PROOF STEP]
proof (induction m arbitrary: n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n. (fps_exp 1 - 1) ^ 0 $ n * fact n = fact 0 * real (Stirling n 0)
 2. \<And>m n. (\<And>n. (fps_exp 1 - 1) ^ m $ n * fact n = fact m * real (Stirling n m)) \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>n. (fps_exp 1 - 1) ^ 0 $ n * fact n = fact 0 * real (Stirling n 0)
 2. \<And>m n. (\<And>n. (fps_exp 1 - 1) ^ m $ n * fact n = fact m * real (Stirling n m)) \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fps_exp 1 - 1) ^ 0 $ n * fact n = fact 0 * real (Stirling n 0)
[PROOF STEP]
by (simp add: Stirling_n_0)
[PROOF STATE]
proof (state)
this:
(fps_exp 1 - 1) ^ 0 $ n * fact n = fact 0 * real (Stirling n 0)

goal (1 subgoal):
 1. \<And>m n. (\<And>n. (fps_exp 1 - 1) ^ m $ n * fact n = fact m * real (Stirling n m)) \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m n. (\<And>n. (fps_exp 1 - 1) ^ m $ n * fact n = fact m * real (Stirling n m)) \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
case (Suc m n)
[PROOF STATE]
proof (state)
this:
(fps_exp 1 - 1) ^ m $ ?n * fact ?n = fact m * real (Stirling ?n m)

goal (1 subgoal):
 1. \<And>m n. (\<And>n. (fps_exp 1 - 1) ^ m $ n * fact n = fact m * real (Stirling n m)) \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
proof (cases n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
 2. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
n = 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
 2. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
case (Suc n')
[PROOF STATE]
proof (state)
this:
n = Suc n'

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
hence "(fps_exp 1 - 1 :: real fps) ^ Suc m $ n * fact n =
              fps_deriv ((fps_exp 1 - 1) ^ Suc m) $ n' * fact n'"
[PROOF STATE]
proof (prove)
using this:
n = Suc n'

goal (1 subgoal):
 1. (fps_exp 1 - 1) ^ Suc m $ n * fact n = fps_deriv ((fps_exp 1 - 1) ^ Suc m) $ n' * fact n'
[PROOF STEP]
by (simp_all add: algebra_simps del: power_Suc)
[PROOF STATE]
proof (state)
this:
(fps_exp 1 - 1) ^ Suc m $ n * fact n = fps_deriv ((fps_exp 1 - 1) ^ Suc m) $ n' * fact n'

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(fps_exp 1 - 1) ^ Suc m $ n * fact n = fps_deriv ((fps_exp 1 - 1) ^ Suc m) $ n' * fact n'

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
have "fps_deriv ((fps_exp 1 - 1 :: real fps) ^ Suc m) =
                 fps_const (real (Suc m)) * ((fps_exp 1 - 1) ^ m * fps_exp 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_deriv ((fps_exp 1 - 1) ^ Suc m) = fps_const (real (Suc m)) * ((fps_exp 1 - 1) ^ m * fps_exp 1)
[PROOF STEP]
by (subst fps_deriv_power) simp_all
[PROOF STATE]
proof (state)
this:
fps_deriv ((fps_exp 1 - 1) ^ Suc m) = fps_const (real (Suc m)) * ((fps_exp 1 - 1) ^ m * fps_exp 1)

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fps_deriv ((fps_exp 1 - 1) ^ Suc m) = fps_const (real (Suc m)) * ((fps_exp 1 - 1) ^ m * fps_exp 1)

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
have "\<dots> $ n' * fact n' =
      real (Suc m) * ((\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i / fact (n' - i)) * fact n')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fps_const (real (Suc m)) * ((fps_exp 1 - 1) ^ m * fps_exp 1)) $ n' * fact n' = real (Suc m) * ((\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i / fact (n' - i)) * fact n')
[PROOF STEP]
unfolding fps_mult_left_const_nth
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (Suc m) * ((fps_exp 1 - 1) ^ m * fps_exp 1) $ n' * fact n' = real (Suc m) * ((\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i / fact (n' - i)) * fact n')
[PROOF STEP]
by (simp add: fps_mult_nth Suc.IH sum_distrib_right del: of_nat_Suc)
[PROOF STATE]
proof (state)
this:
(fps_const (real (Suc m)) * ((fps_exp 1 - 1) ^ m * fps_exp 1)) $ n' * fact n' = real (Suc m) * ((\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i / fact (n' - i)) * fact n')

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(fps_const (real (Suc m)) * ((fps_exp 1 - 1) ^ m * fps_exp 1)) $ n' * fact n' = real (Suc m) * ((\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i / fact (n' - i)) * fact n')

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
have "(\<Sum>i = 0..n'. (fps_exp 1 - 1 :: real fps) ^ m $ i / fact (n' - i)) * fact n' =
                 (\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i * fact n' / fact (n' - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i / fact (n' - i)) * fact n' = (\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i * fact n' / fact (n' - i))
[PROOF STEP]
by (subst sum_distrib_right, rule sum.cong) (simp_all add: divide_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i / fact (n' - i)) * fact n' = (\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i * fact n' / fact (n' - i))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i / fact (n' - i)) * fact n' = (\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i * fact n' / fact (n' - i))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
have "\<dots> = (\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i * fact i * (n' choose i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i * fact n' / fact (n' - i)) = (\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i * fact i * real (n' choose i))
[PROOF STEP]
by (intro sum.cong refl) (simp_all add: binomial_fact)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i * fact n' / fact (n' - i)) = (\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i * fact i * real (n' choose i))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i * fact n' / fact (n' - i)) = (\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i * fact i * real (n' choose i))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
have "\<dots> = (\<Sum>i = 0..n'. fact m * real (Stirling i m) * real (n' choose i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i * fact i * real (n' choose i)) = (\<Sum>i = 0..n'. fact m * real (Stirling i m) * real (n' choose i))
[PROOF STEP]
by (simp only: Suc.IH)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i * fact i * real (n' choose i)) = (\<Sum>i = 0..n'. fact m * real (Stirling i m) * real (n' choose i))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n'. (fps_exp 1 - 1) ^ m $ i * fact i * real (n' choose i)) = (\<Sum>i = 0..n'. fact m * real (Stirling i m) * real (n' choose i))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
have "real (Suc m) * \<dots> = fact (Suc m) *
                 (\<Sum>i = 0..n'. real (Stirling i m) * real (n' choose i))" (is "_ = _ * ?S")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (Suc m) * (\<Sum>i = 0..n'. fact m * real (Stirling i m) * real (n' choose i)) = fact (Suc m) * (\<Sum>i = 0..n'. real (Stirling i m) * real (n' choose i))
[PROOF STEP]
by (simp add: sum_distrib_left sum_distrib_right mult_ac del: of_nat_Suc)
[PROOF STATE]
proof (state)
this:
real (Suc m) * (\<Sum>i = 0..n'. fact m * real (Stirling i m) * real (n' choose i)) = fact (Suc m) * (\<Sum>i = 0..n'. real (Stirling i m) * real (n' choose i))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (Suc m) * (\<Sum>i = 0..n'. fact m * real (Stirling i m) * real (n' choose i)) = fact (Suc m) * (\<Sum>i = 0..n'. real (Stirling i m) * real (n' choose i))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
have "?S = Stirling (Suc n') (Suc m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..n'. real (Stirling i m) * real (n' choose i)) = real (Stirling (Suc n') (Suc m))
[PROOF STEP]
by (subst sum_Stirling_binomial) simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n'. real (Stirling i m) * real (n' choose i)) = real (Stirling (Suc n') (Suc m))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n'. real (Stirling i m) * real (n' choose i)) = real (Stirling (Suc n') (Suc m))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
have "Suc n' = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc n' = n
[PROOF STEP]
by (simp add: Suc)
[PROOF STATE]
proof (state)
this:
Suc n' = n

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))

goal (1 subgoal):
 1. (fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(fps_exp 1 - 1) ^ Suc m $ n * fact n = fact (Suc m) * real (Stirling n (Suc m))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma flowstoE:
  assumes "flowsto X0 T CX X1" "(x0, d0) \<in> X0"
  obtains h where "h \<in> T" "h \<in> existence_ivl0 x0" "(flow0 x0 h, Dflow x0 h o\<^sub>L d0) \<in> X1"
    "\<And>h'. h' \<in> open_segment 0 h \<Longrightarrow> (flow0 x0 h', Dflow x0 h' o\<^sub>L d0) \<in> CX"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>h. \<lbrakk>h \<in> T; h \<in> existence_ivl0 x0; (flow0 x0 h, Dflow x0 h o\<^sub>L d0) \<in> X1; \<And>h'. h' \<in> {0<--<h} \<Longrightarrow> (flow0 x0 h', Dflow x0 h' o\<^sub>L d0) \<in> CX\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
flowsto X0 T CX X1
(x0, d0) \<in> X0

goal (1 subgoal):
 1. (\<And>h. \<lbrakk>h \<in> T; h \<in> existence_ivl0 x0; (flow0 x0 h, Dflow x0 h o\<^sub>L d0) \<in> X1; \<And>h'. h' \<in> {0<--<h} \<Longrightarrow> (flow0 x0 h', Dflow x0 h' o\<^sub>L d0) \<in> CX\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: flowsto_def)


[STATEMENT]
lemma SA_Units_closed_fun:
  assumes "f \<in> Units (SA m)"
  assumes "x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>)"
  shows "f x \<in> carrier Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x \<in> carrier Q\<^sub>p
[PROOF STEP]
using SA_Units_closed SA_car_closed assms
[PROOF STATE]
proof (prove)
using this:
?f \<in> Units (SA ?n) \<Longrightarrow> ?f \<in> carrier (SA ?n)
\<lbrakk>?f \<in> carrier (SA ?m); ?x \<in> carrier (Q\<^sub>p\<^bsup>?m\<^esup>)\<rbrakk> \<Longrightarrow> ?f ?x \<in> carrier Q\<^sub>p
f \<in> Units (SA m)
x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>)

goal (1 subgoal):
 1. f x \<in> carrier Q\<^sub>p
[PROOF STEP]
by blast


[STATEMENT]
lemma SA_constant_res_set_semialg:
  assumes "l \<in> carrier (Zp_res_ring n)"
  assumes "f \<in> carrier (SA m)"
  shows "is_semialgebraic m {x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>). f x \<in> \<O>\<^sub>p \<and> Qp_res (f x) n = l}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_semialgebraic m {x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>). f x \<in> \<O>\<^sub>p \<and> Qp_res (f x) n = l}
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. is_semialgebraic m {x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>). f x \<in> \<O>\<^sub>p \<and> Qp_res (f x) n = l}
[PROOF STEP]
have 0: "{x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>). f x \<in> \<O>\<^sub>p \<and> Qp_res (f x) n = l} = f  \<inverse>\<^bsub>m\<^esub> {x \<in> \<O>\<^sub>p. Qp_res x n = l}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>). f x \<in> \<O>\<^sub>p \<and> Qp_res (f x) n = l} = f \<inverse>\<^bsub>m\<^esub> {x \<in> \<O>\<^sub>p. Qp_res x n = l}
[PROOF STEP]
unfolding evimage_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>). f x \<in> \<O>\<^sub>p \<and> Qp_res (f x) n = l} = f -` {x \<in> \<O>\<^sub>p. Qp_res x n = l} \<inter> carrier (Q\<^sub>p\<^bsup>m\<^esup>)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>). f x \<in> \<O>\<^sub>p \<and> Qp_res (f x) n = l} = f \<inverse>\<^bsub>m\<^esub> {x \<in> \<O>\<^sub>p. Qp_res x n = l}

goal (1 subgoal):
 1. is_semialgebraic m {x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>). f x \<in> \<O>\<^sub>p \<and> Qp_res (f x) n = l}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_semialgebraic m {x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>). f x \<in> \<O>\<^sub>p \<and> Qp_res (f x) n = l}
[PROOF STEP]
unfolding 0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_semialgebraic m (f \<inverse>\<^bsub>m\<^esub> {x \<in> \<O>\<^sub>p. Qp_res x n = l})
[PROOF STEP]
by(rule evimage_is_semialg, rule assms, rule constant_res_set_semialg, rule assms)
[PROOF STATE]
proof (state)
this:
is_semialgebraic m {x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>). f x \<in> \<O>\<^sub>p \<and> Qp_res (f x) n = l}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ex1_eqI: "\<lbrakk>\<exists>!x. P x; P a; P b\<rbrakk> \<Longrightarrow> a=b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>!x. P x; P a; P b\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
by blast


[STATEMENT]
lemma Extend_SNOCs_zero_satisfies: "\<lbrakk>wf (SUC k idx) \<phi>; #\<^sub>V \<AA> = idx; lformula \<phi>\<rbrakk> \<Longrightarrow>
  Extend k 0 ((SNOC (zero (#\<^sub>V \<AA>)) ^^ i) \<AA>) P \<Turnstile> \<phi> \<longleftrightarrow> Extend k 0 \<AA> P \<Turnstile> \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>local.wf (SUC k idx) \<phi>; #\<^sub>V \<AA> = idx; lformula \<phi>\<rbrakk> \<Longrightarrow> (Extend k 0 ((SNOC (zero (#\<^sub>V \<AA>)) ^^ i) \<AA>) P \<Turnstile> \<phi>) = (Extend k 0 \<AA> P \<Turnstile> \<phi>)
[PROOF STEP]
by (rule satisfies_eqI)
   (auto simp: nvars_Extend nvars_SNOCs assigns_Extend assigns_SNOCs_zero LEQ_0 LESS_SUC
     dec_def gr0_conv_Suc)


[STATEMENT]
lemma smcf_dghm_smcf_proj_snd[slicing_commute]:
  "\<pi>\<^sub>D\<^sub>G\<^sub>.\<^sub>2 (smc_dg \<AA>) (smc_dg \<BB>) = smcf_dghm (\<pi>\<^sub>S\<^sub>M\<^sub>C\<^sub>.\<^sub>2 \<AA> \<BB>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi>\<^sub>D\<^sub>G\<^sub>.\<^sub>2 (smc_dg \<AA>) (smc_dg \<BB>) = smcf_dghm (\<pi>\<^sub>S\<^sub>M\<^sub>C\<^sub>.\<^sub>2 \<AA> \<BB>)
[PROOF STEP]
unfolding
    smcf_proj_snd_def dghm_proj_snd_def slicing_commute[symmetric] if_distrib
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi>\<^sub>D\<^sub>G (2\<^sub>\<nat>) (\<lambda>i. if i = []\<^sub>\<circ> \<Rightarrow> smc_dg \<AA> | otherwise \<Rightarrow> smc_dg \<BB>) (1\<^sub>\<nat>) = \<pi>\<^sub>D\<^sub>G (2\<^sub>\<nat>) (\<lambda>i. if i = []\<^sub>\<circ> \<Rightarrow> smc_dg \<AA> | otherwise \<Rightarrow> smc_dg \<BB>) (1\<^sub>\<nat>)
[PROOF STEP]
..