[STATEMENT]
lemma fcompose_add_eq:
  assumes "degree p1 = degree p2"
  shows "q2^(degree p1 - degree (p1+p2)) * fcompose (p1+p2) q1 q2
            = fcompose p1 q1 q2 + fcompose p2 q1 q2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q2 ^ (degree p1 - degree (p1 + p2)) * fcompose (p1 + p2) q1 q2 = fcompose p1 q1 q2 + fcompose p2 q1 q2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
degree p1 = degree p2

goal (1 subgoal):
 1. q2 ^ (degree p1 - degree (p1 + p2)) * fcompose (p1 + p2) q1 q2 = fcompose p1 q1 q2 + fcompose p2 q1 q2
[PROOF STEP]
proof (induction p1 p2 rule: poly_induct2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. degree 0 = degree 0 \<Longrightarrow> q2 ^ (degree 0 - degree (0 + 0)) * fcompose (0 + 0) q1 q2 = fcompose 0 q1 q2 + fcompose 0 q1 q2
 2. \<And>a p b q. \<lbrakk>degree p = degree q \<Longrightarrow> q2 ^ (degree p - degree (p + q)) * fcompose (p + q) q1 q2 = fcompose p q1 q2 + fcompose q q1 q2; degree (pCons a p) = degree (pCons b q)\<rbrakk> \<Longrightarrow> q2 ^ (degree (pCons a p) - degree (pCons a p + pCons b q)) * fcompose (pCons a p + pCons b q) q1 q2 = fcompose (pCons a p) q1 q2 + fcompose (pCons b q) q1 q2
[PROOF STEP]
case (pCons a1 p1 a2 p2)
[PROOF STATE]
proof (state)
this:
degree p1 = degree p2 \<Longrightarrow> q2 ^ (degree p1 - degree (p1 + p2)) * fcompose (p1 + p2) q1 q2 = fcompose p1 q1 q2 + fcompose p2 q1 q2
degree (pCons a1 p1) = degree (pCons a2 p2)

goal (2 subgoals):
 1. degree 0 = degree 0 \<Longrightarrow> q2 ^ (degree 0 - degree (0 + 0)) * fcompose (0 + 0) q1 q2 = fcompose 0 q1 q2 + fcompose 0 q1 q2
 2. \<And>a p b q. \<lbrakk>degree p = degree q \<Longrightarrow> q2 ^ (degree p - degree (p + q)) * fcompose (p + q) q1 q2 = fcompose p q1 q2 + fcompose q q1 q2; degree (pCons a p) = degree (pCons b q)\<rbrakk> \<Longrightarrow> q2 ^ (degree (pCons a p) - degree (pCons a p + pCons b q)) * fcompose (pCons a p + pCons b q) q1 q2 = fcompose (pCons a p) q1 q2 + fcompose (pCons b q) q1 q2
[PROOF STEP]
have ?case when "p1+p2=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
have "p2=-p1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p2 = - p1
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
p1 + p2 = 0

goal (1 subgoal):
 1. p2 = - p1
[PROOF STEP]
by algebra
[PROOF STATE]
proof (state)
this:
p2 = - p1

goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p2 = - p1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p2 = - p1

goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
by (simp add:fcompose_pCons fcompose_uminus smult_add_left)
[PROOF STATE]
proof (state)
this:
q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
p1 + p2 = 0 \<Longrightarrow> q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2

goal (2 subgoals):
 1. degree 0 = degree 0 \<Longrightarrow> q2 ^ (degree 0 - degree (0 + 0)) * fcompose (0 + 0) q1 q2 = fcompose 0 q1 q2 + fcompose 0 q1 q2
 2. \<And>a p b q. \<lbrakk>degree p = degree q \<Longrightarrow> q2 ^ (degree p - degree (p + q)) * fcompose (p + q) q1 q2 = fcompose p q1 q2 + fcompose q q1 q2; degree (pCons a p) = degree (pCons b q)\<rbrakk> \<Longrightarrow> q2 ^ (degree (pCons a p) - degree (pCons a p + pCons b q)) * fcompose (pCons a p + pCons b q) q1 q2 = fcompose (pCons a p) q1 q2 + fcompose (pCons b q) q1 q2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p1 + p2 = 0 \<Longrightarrow> q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2

goal (2 subgoals):
 1. degree 0 = degree 0 \<Longrightarrow> q2 ^ (degree 0 - degree (0 + 0)) * fcompose (0 + 0) q1 q2 = fcompose 0 q1 q2 + fcompose 0 q1 q2
 2. \<And>a p b q. \<lbrakk>degree p = degree q \<Longrightarrow> q2 ^ (degree p - degree (p + q)) * fcompose (p + q) q1 q2 = fcompose p q1 q2 + fcompose q q1 q2; degree (pCons a p) = degree (pCons b q)\<rbrakk> \<Longrightarrow> q2 ^ (degree (pCons a p) - degree (pCons a p + pCons b q)) * fcompose (pCons a p + pCons b q) q1 q2 = fcompose (pCons a p) q1 q2 + fcompose (pCons b q) q1 q2
[PROOF STEP]
have ?case when "p1=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
have "p2=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p2 = 0
[PROOF STEP]
using pCons(2) that
[PROOF STATE]
proof (prove)
using this:
degree (pCons a1 p1) = degree (pCons a2 p2)
p1 = 0

goal (1 subgoal):
 1. p2 = 0
[PROOF STEP]
by (auto split:if_splits)
[PROOF STATE]
proof (state)
this:
p2 = 0

goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p2 = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p2 = 0

goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
p2 = 0
p1 = 0

goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
p1 = 0 \<Longrightarrow> q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2

goal (2 subgoals):
 1. degree 0 = degree 0 \<Longrightarrow> q2 ^ (degree 0 - degree (0 + 0)) * fcompose (0 + 0) q1 q2 = fcompose 0 q1 q2 + fcompose 0 q1 q2
 2. \<And>a p b q. \<lbrakk>degree p = degree q \<Longrightarrow> q2 ^ (degree p - degree (p + q)) * fcompose (p + q) q1 q2 = fcompose p q1 q2 + fcompose q q1 q2; degree (pCons a p) = degree (pCons b q)\<rbrakk> \<Longrightarrow> q2 ^ (degree (pCons a p) - degree (pCons a p + pCons b q)) * fcompose (pCons a p + pCons b q) q1 q2 = fcompose (pCons a p) q1 q2 + fcompose (pCons b q) q1 q2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p1 = 0 \<Longrightarrow> q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2

goal (2 subgoals):
 1. degree 0 = degree 0 \<Longrightarrow> q2 ^ (degree 0 - degree (0 + 0)) * fcompose (0 + 0) q1 q2 = fcompose 0 q1 q2 + fcompose 0 q1 q2
 2. \<And>a p b q. \<lbrakk>degree p = degree q \<Longrightarrow> q2 ^ (degree p - degree (p + q)) * fcompose (p + q) q1 q2 = fcompose p q1 q2 + fcompose q q1 q2; degree (pCons a p) = degree (pCons b q)\<rbrakk> \<Longrightarrow> q2 ^ (degree (pCons a p) - degree (pCons a p + pCons b q)) * fcompose (pCons a p + pCons b q) q1 q2 = fcompose (pCons a p) q1 q2 + fcompose (pCons b q) q1 q2
[PROOF STEP]
have ?case when "p1\<noteq>0" "p1+p2\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
define d1 d2 dp where "d1=degree (pCons a1 p1)" and "d2=degree (pCons a2 p2)"
                            and "dp = degree p1 - degree (p1+p2)"
[PROOF STATE]
proof (state)
this:
d1 = degree (pCons a1 p1)
d2 = degree (pCons a2 p2)
dp = degree p1 - degree (p1 + p2)

goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
define fp1 fp2 where "fp1= fcompose p1 q1 q2" and "fp2=fcompose p2 q1 q2"
[PROOF STATE]
proof (state)
this:
fp1 = fcompose p1 q1 q2
fp2 = fcompose p2 q1 q2

goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
have "q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) *
             fcompose (pCons a1 p1 + pCons a2 p2) q1 q2
                = q2 ^ dp * fcompose (pCons (a1+a2) (p1 +p2)) q1 q2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = q2 ^ dp * fcompose (pCons (a1 + a2) (p1 + p2)) q1 q2
[PROOF STEP]
unfolding dp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = q2 ^ (degree p1 - degree (p1 + p2)) * fcompose (pCons (a1 + a2) (p1 + p2)) q1 q2
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
p1 \<noteq> 0
p1 + p2 \<noteq> 0

goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = q2 ^ (degree p1 - degree (p1 + p2)) * fcompose (pCons (a1 + a2) (p1 + p2)) q1 q2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = q2 ^ dp * fcompose (pCons (a1 + a2) (p1 + p2)) q1 q2

goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = q2 ^ dp * fcompose (pCons (a1 + a2) (p1 + p2)) q1 q2

goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
have "... = smult (a1 + a2) (q2 ^ d1) + q1 * (q2 ^ dp * fcompose (p1 + p2) q1 q2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q2 ^ dp * fcompose (pCons (a1 + a2) (p1 + p2)) q1 q2 = smult (a1 + a2) (q2 ^ d1) + q1 * (q2 ^ dp * fcompose (p1 + p2) q1 q2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. q2 ^ dp * fcompose (pCons (a1 + a2) (p1 + p2)) q1 q2 = smult (a1 + a2) (q2 ^ d1) + q1 * (q2 ^ dp * fcompose (p1 + p2) q1 q2)
[PROOF STEP]
have "degree p1 \<ge> degree (p1 + p2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (p1 + p2) \<le> degree p1
[PROOF STEP]
by (metis degree_add_le degree_pCons_eq_if not_less_eq_eq order_refl pCons.prems zero_le)
[PROOF STATE]
proof (state)
this:
degree (p1 + p2) \<le> degree p1

goal (1 subgoal):
 1. q2 ^ dp * fcompose (pCons (a1 + a2) (p1 + p2)) q1 q2 = smult (a1 + a2) (q2 ^ d1) + q1 * (q2 ^ dp * fcompose (p1 + p2) q1 q2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
degree (p1 + p2) \<le> degree p1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
degree (p1 + p2) \<le> degree p1

goal (1 subgoal):
 1. q2 ^ dp * fcompose (pCons (a1 + a2) (p1 + p2)) q1 q2 = smult (a1 + a2) (q2 ^ d1) + q1 * (q2 ^ dp * fcompose (p1 + p2) q1 q2)
[PROOF STEP]
unfolding fcompose_pCons dp_def d1_def
[PROOF STATE]
proof (prove)
using this:
degree (p1 + p2) \<le> degree p1

goal (1 subgoal):
 1. q2 ^ (degree p1 - degree (p1 + p2)) * (smult (a1 + a2) (q2 ^ degree (pCons (a1 + a2) (p1 + p2))) + q1 * fcompose (p1 + p2) q1 q2) = smult (a1 + a2) (q2 ^ degree (pCons a1 p1)) + q1 * (q2 ^ (degree p1 - degree (p1 + p2)) * fcompose (p1 + p2) q1 q2)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
degree (p1 + p2) \<le> degree p1
p1 \<noteq> 0
p1 + p2 \<noteq> 0

goal (1 subgoal):
 1. q2 ^ (degree p1 - degree (p1 + p2)) * (smult (a1 + a2) (q2 ^ degree (pCons (a1 + a2) (p1 + p2))) + q1 * fcompose (p1 + p2) q1 q2) = smult (a1 + a2) (q2 ^ degree (pCons a1 p1)) + q1 * (q2 ^ (degree p1 - degree (p1 + p2)) * fcompose (p1 + p2) q1 q2)
[PROOF STEP]
by (simp add:algebra_simps power_add[symmetric])
[PROOF STATE]
proof (state)
this:
q2 ^ dp * fcompose (pCons (a1 + a2) (p1 + p2)) q1 q2 = smult (a1 + a2) (q2 ^ d1) + q1 * (q2 ^ dp * fcompose (p1 + p2) q1 q2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
q2 ^ dp * fcompose (pCons (a1 + a2) (p1 + p2)) q1 q2 = smult (a1 + a2) (q2 ^ d1) + q1 * (q2 ^ dp * fcompose (p1 + p2) q1 q2)

goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
q2 ^ dp * fcompose (pCons (a1 + a2) (p1 + p2)) q1 q2 = smult (a1 + a2) (q2 ^ d1) + q1 * (q2 ^ dp * fcompose (p1 + p2) q1 q2)

goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
have "... =  smult (a1 + a2) (q2 ^ d1) + q1 * (fp1 + fp2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult (a1 + a2) (q2 ^ d1) + q1 * (q2 ^ dp * fcompose (p1 + p2) q1 q2) = smult (a1 + a2) (q2 ^ d1) + q1 * (fp1 + fp2)
[PROOF STEP]
apply (subst pCons(1)[folded dp_def fp1_def fp2_def])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. degree p1 = degree p2
 2. smult (a1 + a2) (q2 ^ d1) + q1 * (fp1 + fp2) = smult (a1 + a2) (q2 ^ d1) + q1 * (fp1 + fp2)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree p1 = degree p2
[PROOF STEP]
by (metis degree_pCons_eq_if diff_Suc_Suc diff_zero not_less_eq_eq pCons.prems zero_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult (a1 + a2) (q2 ^ d1) + q1 * (fp1 + fp2) = smult (a1 + a2) (q2 ^ d1) + q1 * (fp1 + fp2)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult (a1 + a2) (q2 ^ d1) + q1 * (fp1 + fp2) = smult (a1 + a2) (q2 ^ d1) + q1 * (fp1 + fp2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
smult (a1 + a2) (q2 ^ d1) + q1 * (q2 ^ dp * fcompose (p1 + p2) q1 q2) = smult (a1 + a2) (q2 ^ d1) + q1 * (fp1 + fp2)

goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
smult (a1 + a2) (q2 ^ d1) + q1 * (q2 ^ dp * fcompose (p1 + p2) q1 q2) = smult (a1 + a2) (q2 ^ d1) + q1 * (fp1 + fp2)

goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
have "... = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult (a1 + a2) (q2 ^ d1) + q1 * (fp1 + fp2) = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. smult (a1 + a2) (q2 ^ d1) + q1 * (fp1 + fp2) = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
have *:"d1 = degree (pCons a2 p2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d1 = degree (pCons a2 p2)
[PROOF STEP]
unfolding d1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (pCons a1 p1) = degree (pCons a2 p2)
[PROOF STEP]
using pCons(2)
[PROOF STATE]
proof (prove)
using this:
degree (pCons a1 p1) = degree (pCons a2 p2)

goal (1 subgoal):
 1. degree (pCons a1 p1) = degree (pCons a2 p2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
d1 = degree (pCons a2 p2)

goal (1 subgoal):
 1. smult (a1 + a2) (q2 ^ d1) + q1 * (fp1 + fp2) = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult (a1 + a2) (q2 ^ d1) + q1 * (fp1 + fp2) = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
unfolding fcompose_pCons
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult (a1 + a2) (q2 ^ d1) + q1 * (fp1 + fp2) = smult a1 (q2 ^ degree (pCons a1 p1)) + q1 * fcompose p1 q1 q2 + (smult a2 (q2 ^ degree (pCons a2 p2)) + q1 * fcompose p2 q1 q2)
[PROOF STEP]
apply (fold d1_def fp1_def fp2_def *)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult (a1 + a2) (q2 ^ d1) + q1 * (fp1 + fp2) = smult a1 (q2 ^ d1) + q1 * fp1 + (smult a2 (q2 ^ d1) + q1 * fp2)
[PROOF STEP]
by (simp add:smult_add_left algebra_simps)
[PROOF STATE]
proof (state)
this:
smult (a1 + a2) (q2 ^ d1) + q1 * (fp1 + fp2) = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
smult (a1 + a2) (q2 ^ d1) + q1 * (fp1 + fp2) = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2

goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2

goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>p1 \<noteq> 0; p1 + p2 \<noteq> 0\<rbrakk> \<Longrightarrow> q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2

goal (2 subgoals):
 1. degree 0 = degree 0 \<Longrightarrow> q2 ^ (degree 0 - degree (0 + 0)) * fcompose (0 + 0) q1 q2 = fcompose 0 q1 q2 + fcompose 0 q1 q2
 2. \<And>a p b q. \<lbrakk>degree p = degree q \<Longrightarrow> q2 ^ (degree p - degree (p + q)) * fcompose (p + q) q1 q2 = fcompose p q1 q2 + fcompose q q1 q2; degree (pCons a p) = degree (pCons b q)\<rbrakk> \<Longrightarrow> q2 ^ (degree (pCons a p) - degree (pCons a p + pCons b q)) * fcompose (pCons a p + pCons b q) q1 q2 = fcompose (pCons a p) q1 q2 + fcompose (pCons b q) q1 q2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p1 + p2 = 0 \<Longrightarrow> q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
p1 = 0 \<Longrightarrow> q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
\<lbrakk>p1 \<noteq> 0; p1 + p2 \<noteq> 0\<rbrakk> \<Longrightarrow> q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
p1 + p2 = 0 \<Longrightarrow> q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
p1 = 0 \<Longrightarrow> q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
\<lbrakk>p1 \<noteq> 0; p1 + p2 \<noteq> 0\<rbrakk> \<Longrightarrow> q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2

goal (1 subgoal):
 1. q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
q2 ^ (degree (pCons a1 p1) - degree (pCons a1 p1 + pCons a2 p2)) * fcompose (pCons a1 p1 + pCons a2 p2) q1 q2 = fcompose (pCons a1 p1) q1 q2 + fcompose (pCons a2 p2) q1 q2

goal (1 subgoal):
 1. degree 0 = degree 0 \<Longrightarrow> q2 ^ (degree 0 - degree (0 + 0)) * fcompose (0 + 0) q1 q2 = fcompose 0 q1 q2 + fcompose 0 q1 q2
[PROOF STEP]
qed simp


[STATEMENT]
lemma infsetsum_cong [cong]:
  "(\<And>x. x \<in> A \<Longrightarrow> f x = g x) \<Longrightarrow> A = B \<Longrightarrow> infsetsum f A = infsetsum g B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x. x \<in> A \<Longrightarrow> f x = g x; A = B\<rbrakk> \<Longrightarrow> infsetsum f A = infsetsum g B
[PROOF STEP]
unfolding infsetsum_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x. x \<in> A \<Longrightarrow> f x = g x; A = B\<rbrakk> \<Longrightarrow> integral\<^sup>L (count_space A) f = integral\<^sup>L (count_space B) g
[PROOF STEP]
by (intro Bochner_Integration.integral_cong) auto


[STATEMENT]
lemma primes_characterization'_int [rule_format]:
  "finite {p. p \<ge> 0 \<and> 0 < f (p::int)} \<Longrightarrow> \<forall>p. 0 < f p \<longrightarrow> prime p \<Longrightarrow>
      prime_factors (\<Prod>p | p \<ge> 0 \<and> 0 < f p. p ^ f p) = {p. p \<ge> 0 \<and> 0 < f p}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite {p. 0 \<le> p \<and> 0 < f p}; \<forall>p. 0 < f p \<longrightarrow> prime p\<rbrakk> \<Longrightarrow> prime_factors (\<Prod>p\<in>{p. 0 \<le> p \<and> 0 < f p}. p ^ f p) = {p. 0 \<le> p \<and> 0 < f p}
[PROOF STEP]
by (rule prime_factors_characterization_int) (auto simp: abs_prod prime_ge_0_int)


[STATEMENT]
lemma ae_filter_eq_bot_iff: "ae_filter M = bot \<longleftrightarrow> emeasure M (space M) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ae_filter M = bot) = (emeasure M (space M) = 0)
[PROOF STEP]
by (simp add: AE_iff_measurable trivial_limit_def)


[STATEMENT]
lemma list_slice2_nth_nth_eq2: "
  \<lbrakk> m = length xs div k; n < length xs mod k \<rbrakk> \<Longrightarrow>
  (list_slice2 xs k) ! m ! n = xs ! (m * k + n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m = length xs div k; n < length xs mod k\<rbrakk> \<Longrightarrow> list_slice2 xs k ! m ! n = xs ! (m * k + n)
[PROOF STEP]
by (simp add: mult.commute[of _ k] minus_mod_eq_mult_div [symmetric] list_slice2_last)


[STATEMENT]
lemma not_add_less_right: assumes "Ord y" shows "\<not> (x + y < x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> x + y < x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Ord y

goal (1 subgoal):
 1. \<not> x + y < x
[PROOF STEP]
proof (induction rule: Ord_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>Ord xa; \<And>y. y \<in> elts xa \<Longrightarrow> \<not> x + y < x\<rbrakk> \<Longrightarrow> \<not> x + xa < x
[PROOF STEP]
case (step i)
[PROOF STATE]
proof (state)
this:
Ord i
?y \<in> elts i \<Longrightarrow> \<not> x + ?y < x

goal (1 subgoal):
 1. \<And>xa. \<lbrakk>Ord xa; \<And>y. y \<in> elts xa \<Longrightarrow> \<not> x + y < x\<rbrakk> \<Longrightarrow> \<not> x + xa < x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Ord i
?y \<in> elts i \<Longrightarrow> \<not> x + ?y < x
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Ord i
?y \<in> elts i \<Longrightarrow> \<not> x + ?y < x

goal (1 subgoal):
 1. \<not> x + i < x
[PROOF STEP]
by (metis less_le_not_le plus sup_ge1)
[PROOF STATE]
proof (state)
this:
\<not> x + i < x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma padic_add_zero:
assumes "prime p"
shows "\<And>x. x \<in> carrier (padic_int p) \<Longrightarrow> \<zero>\<^bsub>padic_int p\<^esub> \<oplus>\<^bsub>padic_int p\<^esub> x = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier (padic_int p) \<Longrightarrow> \<zero>\<^bsub>padic_int p\<^esub> \<oplus>\<^bsub>padic_int p\<^esub> x = x
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier (padic_int p) \<Longrightarrow> \<zero>\<^bsub>padic_int p\<^esub> \<oplus>\<^bsub>padic_int p\<^esub> x = x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier (padic_int p) \<Longrightarrow> \<zero>\<^bsub>padic_int p\<^esub> \<oplus>\<^bsub>padic_int p\<^esub> x = x
[PROOF STEP]
assume Ax: "x \<in> carrier (padic_int p)"
[PROOF STATE]
proof (state)
this:
x \<in> carrier (padic_int p)

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (padic_int p) \<Longrightarrow> \<zero>\<^bsub>padic_int p\<^esub> \<oplus>\<^bsub>padic_int p\<^esub> x = x
[PROOF STEP]
show " \<zero>\<^bsub>padic_int p\<^esub> \<oplus>\<^bsub>padic_int p\<^esub> x = x "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<zero>\<^bsub>padic_int p\<^esub> \<oplus>\<^bsub>padic_int p\<^esub> x = x
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. (\<zero>\<^bsub>padic_int p\<^esub> \<oplus>\<^bsub>padic_int p\<^esub> x) xa = x xa
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. (\<zero>\<^bsub>padic_int p\<^esub> \<oplus>\<^bsub>padic_int p\<^esub> x) xa = x xa
[PROOF STEP]
have A: "(padic_zero p) n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_zero p n = 0
[PROOF STEP]
by (simp add: padic_zero_def)
[PROOF STATE]
proof (state)
this:
padic_zero p n = 0

goal (1 subgoal):
 1. \<And>xa. (\<zero>\<^bsub>padic_int p\<^esub> \<oplus>\<^bsub>padic_int p\<^esub> x) xa = x xa
[PROOF STEP]
have "((padic_zero p) \<oplus>\<^bsub>padic_int p\<^esub> x) n = x n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (padic_zero p \<oplus>\<^bsub>padic_int p\<^esub> x) n = x n
[PROOF STEP]
using Ax padic_int_simps(5) padic_set_res_closed residue_ring_def
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier (padic_int p)
carrier (padic_int ?p) = padic_set ?p
?f \<in> padic_set ?p \<Longrightarrow> ?f ?m \<in> carrier (residue_ring (?p ^ ?m))
residue_ring ?m = \<lparr>carrier = {0..?m - 1}, monoid.mult = \<lambda>x y. x * y mod ?m, one = 1, zero = 0, add = \<lambda>x y. (x + y) mod ?m\<rparr>

goal (1 subgoal):
 1. (padic_zero p \<oplus>\<^bsub>padic_int p\<^esub> x) n = x n
[PROOF STEP]
by(auto simp add: padic_zero_def padic_int_simps padic_add_res residue_ring_def)
[PROOF STATE]
proof (state)
this:
(padic_zero p \<oplus>\<^bsub>padic_int p\<^esub> x) n = x n

goal (1 subgoal):
 1. \<And>xa. (\<zero>\<^bsub>padic_int p\<^esub> \<oplus>\<^bsub>padic_int p\<^esub> x) xa = x xa
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(padic_zero p \<oplus>\<^bsub>padic_int p\<^esub> x) n = x n
[PROOF STEP]
show "(\<zero>\<^bsub>padic_int p\<^esub> \<oplus>\<^bsub>padic_int p\<^esub> x) n = x n"
[PROOF STATE]
proof (prove)
using this:
(padic_zero p \<oplus>\<^bsub>padic_int p\<^esub> x) n = x n

goal (1 subgoal):
 1. (\<zero>\<^bsub>padic_int p\<^esub> \<oplus>\<^bsub>padic_int p\<^esub> x) n = x n
[PROOF STEP]
by (simp add: padic_int_def)
[PROOF STATE]
proof (state)
this:
(\<zero>\<^bsub>padic_int p\<^esub> \<oplus>\<^bsub>padic_int p\<^esub> x) n = x n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<zero>\<^bsub>padic_int p\<^esub> \<oplus>\<^bsub>padic_int p\<^esub> x = x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prime_ge_Suc_0_nat: "prime p \<Longrightarrow> p \<ge> Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p \<Longrightarrow> Suc 0 \<le> p
[PROOF STEP]
using prime_ge_1_nat [of p]
[PROOF STATE]
proof (prove)
using this:
prime p \<Longrightarrow> 1 \<le> p

goal (1 subgoal):
 1. prime p \<Longrightarrow> Suc 0 \<le> p
[PROOF STEP]
by simp


[STATEMENT]
lemma bij_lift:
  assumes "bij_betw f A B"
  shows "bij_betw (\<lambda>e. f ` e) (Pow A) (Pow B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw ((`) f) (Pow A) (Pow B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bij_betw ((`) f) (Pow A) (Pow B)
[PROOF STEP]
have f: "inj_on f A" "f ` A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f A &&& f ` A = B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bij_betw f A B

goal (1 subgoal):
 1. inj_on f A &&& f ` A = B
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
inj_on f A \<and> f ` A = B

goal (1 subgoal):
 1. inj_on f A &&& f ` A = B
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
inj_on f A
f ` A = B

goal (1 subgoal):
 1. bij_betw ((`) f) (Pow A) (Pow B)
[PROOF STEP]
have "inj_on (\<lambda>e. f ` e) (Pow A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on ((`) f) (Pow A)
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>Pow A. \<forall>y\<in>Pow A. f ` x = f ` y \<longrightarrow> x = y
[PROOF STEP]
by clarify (metis f(1) inv_into_image_cancel)
[PROOF STATE]
proof (state)
this:
inj_on ((`) f) (Pow A)

goal (1 subgoal):
 1. bij_betw ((`) f) (Pow A) (Pow B)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
inj_on ((`) f) (Pow A)

goal (1 subgoal):
 1. bij_betw ((`) f) (Pow A) (Pow B)
[PROOF STEP]
have "(\<lambda>e. f ` e) ` (Pow A) = (Pow B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (`) f ` Pow A = Pow B
[PROOF STEP]
by (metis f(2) image_Pow_surj)
[PROOF STATE]
proof (state)
this:
(`) f ` Pow A = Pow B

goal (1 subgoal):
 1. bij_betw ((`) f) (Pow A) (Pow B)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
inj_on ((`) f) (Pow A)
(`) f ` Pow A = Pow B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inj_on ((`) f) (Pow A)
(`) f ` Pow A = Pow B

goal (1 subgoal):
 1. bij_betw ((`) f) (Pow A) (Pow B)
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
inj_on ((`) f) (Pow A)
(`) f ` Pow A = Pow B

goal (1 subgoal):
 1. inj_on ((`) f) (Pow A) \<and> (`) f ` Pow A = Pow B
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
bij_betw ((`) f) (Pow A) (Pow B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prime_product:
  fixes p::nat
  assumes "prime (p * q)"
  shows "p = 1 \<or> q = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = 1 \<or> q = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p = 1 \<or> q = 1
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
prime (p * q)
[PROOF STEP]
have
    "1 < p * q" and P: "\<And>m. m dvd p * q \<Longrightarrow> m = 1 \<or> m = p * q"
[PROOF STATE]
proof (prove)
using this:
prime (p * q)

goal (1 subgoal):
 1. 1 < p * q &&& (\<And>m. m dvd p * q \<Longrightarrow> m = 1 \<or> m = p * q)
[PROOF STEP]
unfolding prime_nat_iff
[PROOF STATE]
proof (prove)
using this:
1 < p * q \<and> (\<forall>m. m dvd p * q \<longrightarrow> m = 1 \<or> m = p * q)

goal (1 subgoal):
 1. 1 < p * q &&& (\<And>m. m dvd p * q \<Longrightarrow> m = 1 \<or> m = p * q)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 < p * q
?m dvd p * q \<Longrightarrow> ?m = 1 \<or> ?m = p * q

goal (1 subgoal):
 1. p = 1 \<or> q = 1
[PROOF STEP]
from \<open>1 < p * q\<close>
[PROOF STATE]
proof (chain)
picking this:
1 < p * q
[PROOF STEP]
have "p \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
1 < p * q

goal (1 subgoal):
 1. p \<noteq> 0
[PROOF STEP]
by (cases p) auto
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (1 subgoal):
 1. p = 1 \<or> q = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 0
[PROOF STEP]
have Q: "p = p * q \<longleftrightarrow> q = 1"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. (p = p * q) = (q = 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(p = p * q) = (q = 1)

goal (1 subgoal):
 1. p = 1 \<or> q = 1
[PROOF STEP]
have "p dvd p * q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p dvd p * q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p dvd p * q

goal (1 subgoal):
 1. p = 1 \<or> q = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p dvd p * q
[PROOF STEP]
have "p = 1 \<or> p = p * q"
[PROOF STATE]
proof (prove)
using this:
p dvd p * q

goal (1 subgoal):
 1. p = 1 \<or> p = p * q
[PROOF STEP]
by (rule P)
[PROOF STATE]
proof (state)
this:
p = 1 \<or> p = p * q

goal (1 subgoal):
 1. p = 1 \<or> q = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p = 1 \<or> p = p * q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p = 1 \<or> p = p * q

goal (1 subgoal):
 1. p = 1 \<or> q = 1
[PROOF STEP]
by (simp add: Q)
[PROOF STATE]
proof (state)
this:
p = 1 \<or> q = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma octo_product_nonassociative :
  "\<not>(\<forall> x y z::octo. x * (y * z) = (x * y) * z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (\<forall>x y z. x * (y * z) = x * y * z)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (\<forall>x y z. x * (y * z) = x * y * z)
[PROOF STEP]
define x where "x = Octo 1 0 0 0 1 0 0 0"
[PROOF STATE]
proof (state)
this:
x = Octo 1 0 0 0 1 0 0 0

goal (1 subgoal):
 1. \<not> (\<forall>x y z. x * (y * z) = x * y * z)
[PROOF STEP]
define y where "y = Octo 1 3 0 0 0 1 0 0"
[PROOF STATE]
proof (state)
this:
y = Octo 1 3 0 0 0 1 0 0

goal (1 subgoal):
 1. \<not> (\<forall>x y z. x * (y * z) = x * y * z)
[PROOF STEP]
define z where "z = Octo 0 1 0 1 1 1 0 0"
[PROOF STATE]
proof (state)
this:
z = Octo 0 1 0 1 1 1 0 0

goal (1 subgoal):
 1. \<not> (\<forall>x y z. x * (y * z) = x * y * z)
[PROOF STEP]
have "x * (y * z) \<noteq> (x * y) * z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * (y * z) \<noteq> x * y * z
[PROOF STEP]
by (simp add: octo_eq_iff octo_mult_components x_def y_def z_def)
[PROOF STATE]
proof (state)
this:
x * (y * z) \<noteq> x * y * z

goal (1 subgoal):
 1. \<not> (\<forall>x y z. x * (y * z) = x * y * z)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x * (y * z) \<noteq> x * y * z

goal (1 subgoal):
 1. \<not> (\<forall>x y z. x * (y * z) = x * y * z)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<not> (\<forall>x y z. x * (y * z) = x * y * z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bezout_nat:
  fixes a :: nat
  assumes a: "a \<noteq> 0"
  shows "\<exists>x y. a * x = b * y + gcd a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x y. a * x = b * y + gcd a b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x y. a * x = b * y + gcd a b
[PROOF STEP]
obtain d x y where d: "d dvd a" "d dvd b" and eq: "a * x = b * y + d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>d x y. \<lbrakk>d dvd a; d dvd b; a * x = b * y + d\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using bezout_add_strong_nat [OF a, of b]
[PROOF STATE]
proof (prove)
using this:
\<exists>d x y. d dvd a \<and> d dvd b \<and> a * x = b * y + d

goal (1 subgoal):
 1. (\<And>d x y. \<lbrakk>d dvd a; d dvd b; a * x = b * y + d\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
d dvd a
d dvd b
a * x = b * y + d

goal (1 subgoal):
 1. \<exists>x y. a * x = b * y + gcd a b
[PROOF STEP]
from d
[PROOF STATE]
proof (chain)
picking this:
d dvd a
d dvd b
[PROOF STEP]
have "d dvd gcd a b"
[PROOF STATE]
proof (prove)
using this:
d dvd a
d dvd b

goal (1 subgoal):
 1. d dvd gcd a b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
d dvd gcd a b

goal (1 subgoal):
 1. \<exists>x y. a * x = b * y + gcd a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
d dvd gcd a b
[PROOF STEP]
obtain k where k: "gcd a b = d * k"
[PROOF STATE]
proof (prove)
using this:
d dvd gcd a b

goal (1 subgoal):
 1. (\<And>k. gcd a b = d * k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding dvd_def
[PROOF STATE]
proof (prove)
using this:
\<exists>k. gcd a b = d * k

goal (1 subgoal):
 1. (\<And>k. gcd a b = d * k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
gcd a b = d * k

goal (1 subgoal):
 1. \<exists>x y. a * x = b * y + gcd a b
[PROOF STEP]
from eq
[PROOF STATE]
proof (chain)
picking this:
a * x = b * y + d
[PROOF STEP]
have "a * x * k = (b * y + d) * k"
[PROOF STATE]
proof (prove)
using this:
a * x = b * y + d

goal (1 subgoal):
 1. a * x * k = (b * y + d) * k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a * x * k = (b * y + d) * k

goal (1 subgoal):
 1. \<exists>x y. a * x = b * y + gcd a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a * x * k = (b * y + d) * k
[PROOF STEP]
have "a * (x * k) = b * (y * k) + gcd a b"
[PROOF STATE]
proof (prove)
using this:
a * x * k = (b * y + d) * k

goal (1 subgoal):
 1. a * (x * k) = b * (y * k) + gcd a b
[PROOF STEP]
by (algebra add: k)
[PROOF STATE]
proof (state)
this:
a * (x * k) = b * (y * k) + gcd a b

goal (1 subgoal):
 1. \<exists>x y. a * x = b * y + gcd a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a * (x * k) = b * (y * k) + gcd a b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a * (x * k) = b * (y * k) + gcd a b

goal (1 subgoal):
 1. \<exists>x y. a * x = b * y + gcd a b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>x y. a * x = b * y + gcd a b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_on_neq_split:
  fixes f :: "'a::linear_continuum_topology \<Rightarrow> 'b::linorder_topology"
  assumes "\<forall>x\<in>s. f x\<noteq>y" "continuous_on s f" "connected s"
  shows "(\<forall>x\<in>s. f x>y) \<or> (\<forall>x\<in>s. f x<y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>s. y < f x) \<or> (\<forall>x\<in>s. f x < y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<forall>x\<in>s. y < f x) \<or> (\<forall>x\<in>s. f x < y)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<forall>x\<in>s. y < f x) \<or> (\<forall>x\<in>s. f x < y)
[PROOF STEP]
fix aa :: 'a and aaa :: 'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<forall>x\<in>s. y < f x) \<or> (\<forall>x\<in>s. f x < y)
[PROOF STEP]
have "y \<notin> f ` s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<notin> f ` s
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>s. f x \<noteq> y

goal (1 subgoal):
 1. y \<notin> f ` s
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
y \<notin> f ` s

goal (1 subgoal):
 1. (\<forall>x\<in>s. y < f x) \<or> (\<forall>x\<in>s. f x < y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<notin> f ` s
[PROOF STEP]
have "(aa \<notin> s \<or> y < f aa) \<or> aaa \<notin> s \<or> f aaa < y"
[PROOF STATE]
proof (prove)
using this:
y \<notin> f ` s

goal (1 subgoal):
 1. (aa \<notin> s \<or> y < f aa) \<or> aaa \<notin> s \<or> f aaa < y
[PROOF STEP]
by (meson Topological_Spaces.connected_continuous_image assms(2) assms(3)
          connectedD_interval image_eqI linorder_not_le)
[PROOF STATE]
proof (state)
this:
(aa \<notin> s \<or> y < f aa) \<or> aaa \<notin> s \<or> f aaa < y

goal (1 subgoal):
 1. (\<forall>x\<in>s. y < f x) \<or> (\<forall>x\<in>s. f x < y)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(?aa2 \<notin> s \<or> y < f ?aa2) \<or> ?aaa2 \<notin> s \<or> f ?aaa2 < y

goal (1 subgoal):
 1. (\<forall>x\<in>s. y < f x) \<or> (\<forall>x\<in>s. f x < y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(?aa2 \<notin> s \<or> y < f ?aa2) \<or> ?aaa2 \<notin> s \<or> f ?aaa2 < y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(?aa2 \<notin> s \<or> y < f ?aa2) \<or> ?aaa2 \<notin> s \<or> f ?aaa2 < y

goal (1 subgoal):
 1. (\<forall>x\<in>s. y < f x) \<or> (\<forall>x\<in>s. f x < y)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<forall>x\<in>s. y < f x) \<or> (\<forall>x\<in>s. f x < y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma countable_product_event_const:
  fixes F::"('a::countable) \<Rightarrow> 'b set" and b::'b
  assumes "\<And>i. countable (F i)"
  shows "countable {f::('a \<Rightarrow> 'b). (\<forall>i. f i \<in> F i) \<and> (finite {i. f i \<noteq> b})}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable {f. (\<forall>i. f i \<in> F i) \<and> finite {i. f i \<noteq> b}}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. countable {f. (\<forall>i. f i \<in> F i) \<and> finite {i. f i \<noteq> b}}
[PROOF STEP]
define G where "G = (\<Union>i. F i) \<union> {b}"
[PROOF STATE]
proof (state)
this:
G = \<Union> (range F) \<union> {b}

goal (1 subgoal):
 1. countable {f. (\<forall>i. f i \<in> F i) \<and> finite {i. f i \<noteq> b}}
[PROOF STEP]
have "countable G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable G
[PROOF STEP]
unfolding G_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable (\<Union> (range F) \<union> {b})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
countable (F ?i)

goal (1 subgoal):
 1. countable (\<Union> (range F) \<union> {b})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
countable G

goal (1 subgoal):
 1. countable {f. (\<forall>i. f i \<in> F i) \<and> finite {i. f i \<noteq> b}}
[PROOF STEP]
have "b \<in> G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<in> G
[PROOF STEP]
unfolding G_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<in> \<Union> (range F) \<union> {b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b \<in> G

goal (1 subgoal):
 1. countable {f. (\<forall>i. f i \<in> F i) \<and> finite {i. f i \<noteq> b}}
[PROOF STEP]
define pi where "pi = (\<lambda>(x::(nat \<Rightarrow> 'b)). (\<lambda> i::'a. x ((to_nat::('a \<Rightarrow> nat)) i)))"
[PROOF STATE]
proof (state)
this:
pi = (\<lambda>x i. x (to_nat i))

goal (1 subgoal):
 1. countable {f. (\<forall>i. f i \<in> F i) \<and> finite {i. f i \<noteq> b}}
[PROOF STEP]
have "{f::('a \<Rightarrow> 'b). (\<forall>i. f i \<in> F i) \<and> (finite {i. f i \<noteq> b})}
        \<subseteq> pi`{g::(nat \<Rightarrow> 'b). (\<forall>j. g j \<in> G) \<and> (finite {j. g j \<noteq> b})}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f. (\<forall>i. f i \<in> F i) \<and> finite {i. f i \<noteq> b}} \<subseteq> pi ` {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}
[PROOF STEP]
proof (auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>i. x i \<in> F i; finite {i. x i \<noteq> b}\<rbrakk> \<Longrightarrow> x \<in> pi ` {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}
[PROOF STEP]
fix f
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>i. x i \<in> F i; finite {i. x i \<noteq> b}\<rbrakk> \<Longrightarrow> x \<in> pi ` {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}
[PROOF STEP]
assume H: "\<forall>i. f i \<in> F i" "finite {i. f i \<noteq> b}"
[PROOF STATE]
proof (state)
this:
\<forall>i. f i \<in> F i
finite {i. f i \<noteq> b}

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>i. x i \<in> F i; finite {i. x i \<noteq> b}\<rbrakk> \<Longrightarrow> x \<in> pi ` {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}
[PROOF STEP]
define I where "I = {i. f i \<noteq> b}"
[PROOF STATE]
proof (state)
this:
I = {i. f i \<noteq> b}

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>i. x i \<in> F i; finite {i. x i \<noteq> b}\<rbrakk> \<Longrightarrow> x \<in> pi ` {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}
[PROOF STEP]
define g where "g = (\<lambda>j. if j \<in> to_nat`I then f (from_nat j) else b)"
[PROOF STATE]
proof (state)
this:
g = (\<lambda>j. if j \<in> to_nat ` I then f (from_nat j) else b)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>i. x i \<in> F i; finite {i. x i \<noteq> b}\<rbrakk> \<Longrightarrow> x \<in> pi ` {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}
[PROOF STEP]
have "{j. g j \<noteq> b} \<subseteq> to_nat`I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {j. g j \<noteq> b} \<subseteq> to_nat ` I
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {j. (if j \<in> to_nat ` I then f (from_nat j) else b) \<noteq> b} \<subseteq> to_nat ` I
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{j. g j \<noteq> b} \<subseteq> to_nat ` I

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>i. x i \<in> F i; finite {i. x i \<noteq> b}\<rbrakk> \<Longrightarrow> x \<in> pi ` {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{j. g j \<noteq> b} \<subseteq> to_nat ` I
[PROOF STEP]
have "finite {j. g j \<noteq> b}"
[PROOF STATE]
proof (prove)
using this:
{j. g j \<noteq> b} \<subseteq> to_nat ` I

goal (1 subgoal):
 1. finite {j. g j \<noteq> b}
[PROOF STEP]
unfolding I_def
[PROOF STATE]
proof (prove)
using this:
{j. g j \<noteq> b} \<subseteq> to_nat ` {i. f i \<noteq> b}

goal (1 subgoal):
 1. finite {j. g j \<noteq> b}
[PROOF STEP]
using H(2)
[PROOF STATE]
proof (prove)
using this:
{j. g j \<noteq> b} \<subseteq> to_nat ` {i. f i \<noteq> b}
finite {i. f i \<noteq> b}

goal (1 subgoal):
 1. finite {j. g j \<noteq> b}
[PROOF STEP]
using finite_surj
[PROOF STATE]
proof (prove)
using this:
{j. g j \<noteq> b} \<subseteq> to_nat ` {i. f i \<noteq> b}
finite {i. f i \<noteq> b}
\<lbrakk>finite ?A; ?B \<subseteq> ?f ` ?A\<rbrakk> \<Longrightarrow> finite ?B

goal (1 subgoal):
 1. finite {j. g j \<noteq> b}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite {j. g j \<noteq> b}

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>i. x i \<in> F i; finite {i. x i \<noteq> b}\<rbrakk> \<Longrightarrow> x \<in> pi ` {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite {j. g j \<noteq> b}

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>i. x i \<in> F i; finite {i. x i \<noteq> b}\<rbrakk> \<Longrightarrow> x \<in> pi ` {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}
[PROOF STEP]
have "g j \<in> G" for j
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g j \<in> G
[PROOF STEP]
unfolding g_def G_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if j \<in> to_nat ` I then f (from_nat j) else b) \<in> \<Union> (range F) \<union> {b}
[PROOF STEP]
using H
[PROOF STATE]
proof (prove)
using this:
\<forall>i. f i \<in> F i
finite {i. f i \<noteq> b}

goal (1 subgoal):
 1. (if j \<in> to_nat ` I then f (from_nat j) else b) \<in> \<Union> (range F) \<union> {b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g ?j \<in> G

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>i. x i \<in> F i; finite {i. x i \<noteq> b}\<rbrakk> \<Longrightarrow> x \<in> pi ` {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite {j. g j \<noteq> b}
g ?j \<in> G
[PROOF STEP]
have "g \<in> {g::(nat \<Rightarrow> 'b). (\<forall>j. g j \<in> G) \<and> (finite {j. g j \<noteq> b})}"
[PROOF STATE]
proof (prove)
using this:
finite {j. g j \<noteq> b}
g ?j \<in> G

goal (1 subgoal):
 1. g \<in> {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g \<in> {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>i. x i \<in> F i; finite {i. x i \<noteq> b}\<rbrakk> \<Longrightarrow> x \<in> pi ` {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
g \<in> {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>i. x i \<in> F i; finite {i. x i \<noteq> b}\<rbrakk> \<Longrightarrow> x \<in> pi ` {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}
[PROOF STEP]
have "f = pi g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = pi g
[PROOF STEP]
unfolding pi_def g_def I_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = (\<lambda>i. if to_nat i \<in> to_nat ` {i. f i \<noteq> b} then f (from_nat (to_nat i)) else b)
[PROOF STEP]
using H
[PROOF STATE]
proof (prove)
using this:
\<forall>i. f i \<in> F i
finite {i. f i \<noteq> b}

goal (1 subgoal):
 1. f = (\<lambda>i. if to_nat i \<in> to_nat ` {i. f i \<noteq> b} then f (from_nat (to_nat i)) else b)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
f = pi g

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>i. x i \<in> F i; finite {i. x i \<noteq> b}\<rbrakk> \<Longrightarrow> x \<in> pi ` {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
g \<in> {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}
f = pi g
[PROOF STEP]
show "f \<in> pi`{g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}"
[PROOF STATE]
proof (prove)
using this:
g \<in> {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}
f = pi g

goal (1 subgoal):
 1. f \<in> pi ` {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f \<in> pi ` {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{f. (\<forall>i. f i \<in> F i) \<and> finite {i. f i \<noteq> b}} \<subseteq> pi ` {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}

goal (1 subgoal):
 1. countable {f. (\<forall>i. f i \<in> F i) \<and> finite {i. f i \<noteq> b}}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{f. (\<forall>i. f i \<in> F i) \<and> finite {i. f i \<noteq> b}} \<subseteq> pi ` {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{f. (\<forall>i. f i \<in> F i) \<and> finite {i. f i \<noteq> b}} \<subseteq> pi ` {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}

goal (1 subgoal):
 1. countable {f. (\<forall>i. f i \<in> F i) \<and> finite {i. f i \<noteq> b}}
[PROOF STEP]
using countable_nat_product_event_const[OF \<open>b \<in> G\<close> \<open>countable G\<close>]
[PROOF STATE]
proof (prove)
using this:
{f. (\<forall>i. f i \<in> F i) \<and> finite {i. f i \<noteq> b}} \<subseteq> pi ` {g. (\<forall>j. g j \<in> G) \<and> finite {j. g j \<noteq> b}}
countable {x. (\<forall>i. x i \<in> G) \<and> finite {i. x i \<noteq> b}}

goal (1 subgoal):
 1. countable {f. (\<forall>i. f i \<in> F i) \<and> finite {i. f i \<noteq> b}}
[PROOF STEP]
by (meson countable_image countable_subset)
[PROOF STATE]
proof (state)
this:
countable {f. (\<forall>i. f i \<in> F i) \<and> finite {i. f i \<noteq> b}}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dvd_mult_imp_degree: fixes p :: "'a poly"
  assumes "p dvd q * r"
  and "degree p > 0"
shows "\<exists> s t. irreducible s \<and> p = s * t \<and> (s dvd q \<or> s dvd r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>s t. irreducible s \<and> p = s * t \<and> (s dvd q \<or> s dvd r)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>s t. irreducible s \<and> p = s * t \<and> (s dvd q \<or> s dvd r)
[PROOF STEP]
from irreducible\<^sub>d_factor[OF assms(2)]
[PROOF STATE]
proof (chain)
picking this:
\<exists>q r. irreducible\<^sub>d q \<and> p = q * r \<and> degree r < degree p
[PROOF STEP]
obtain s t
  where irred: "irreducible s" and p: "p = s * t"
[PROOF STATE]
proof (prove)
using this:
\<exists>q r. irreducible\<^sub>d q \<and> p = q * r \<and> degree r < degree p

goal (1 subgoal):
 1. (\<And>s t. \<lbrakk>irreducible s; p = s * t\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
irreducible s
p = s * t

goal (1 subgoal):
 1. \<exists>s t. irreducible s \<and> p = s * t \<and> (s dvd q \<or> s dvd r)
[PROOF STEP]
from \<open>p dvd q * r\<close> p
[PROOF STATE]
proof (chain)
picking this:
p dvd q * r
p = s * t
[PROOF STEP]
have s: "s dvd q * r"
[PROOF STATE]
proof (prove)
using this:
p dvd q * r
p = s * t

goal (1 subgoal):
 1. s dvd q * r
[PROOF STEP]
unfolding dvd_def
[PROOF STATE]
proof (prove)
using this:
\<exists>k. q * r = p * k
p = s * t

goal (1 subgoal):
 1. \<exists>k. q * r = s * k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
s dvd q * r

goal (1 subgoal):
 1. \<exists>s t. irreducible s \<and> p = s * t \<and> (s dvd q \<or> s dvd r)
[PROOF STEP]
from s p irred
[PROOF STATE]
proof (chain)
picking this:
s dvd q * r
p = s * t
irreducible s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
s dvd q * r
p = s * t
irreducible s

goal (1 subgoal):
 1. \<exists>s t. irreducible s \<and> p = s * t \<and> (s dvd q \<or> s dvd r)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>s t. irreducible s \<and> p = s * t \<and> (s dvd q \<or> s dvd r)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_rows: "finite (rows A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (rows A)
[PROOF STEP]
using finite_Atleast_Atmost_nat[of "\<lambda>i. row i A"]
[PROOF STATE]
proof (prove)
using this:
finite {row x A |x. x \<in> UNIV}

goal (1 subgoal):
 1. finite (rows A)
[PROOF STEP]
unfolding rows_def
[PROOF STATE]
proof (prove)
using this:
finite {row x A |x. x \<in> UNIV}

goal (1 subgoal):
 1. finite {row i A |i. i \<in> UNIV}
[PROOF STEP]
.


[STATEMENT]
lemma card_finite_spectrum: assumes A: "(A :: 'a :: field mat) \<in> carrier_mat n n"
  shows "finite (spectrum A)" "card (spectrum A) \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (spectrum A) &&& card (spectrum A) \<le> n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite (spectrum A)
 2. card (spectrum A) \<le> n
[PROOF STEP]
define CP where "CP = char_poly A"
[PROOF STATE]
proof (state)
this:
CP = char_poly A

goal (2 subgoals):
 1. finite (spectrum A)
 2. card (spectrum A) \<le> n
[PROOF STEP]
from spectrum_root_char_poly[OF A]
[PROOF STATE]
proof (chain)
picking this:
spectrum A = {k. poly (char_poly A) k = (0::'a)}
[PROOF STEP]
have id: "spectrum A = { k. poly CP k = 0}"
[PROOF STATE]
proof (prove)
using this:
spectrum A = {k. poly (char_poly A) k = (0::'a)}

goal (1 subgoal):
 1. spectrum A = {k. poly CP k = (0::'a)}
[PROOF STEP]
unfolding CP_def
[PROOF STATE]
proof (prove)
using this:
spectrum A = {k. poly (char_poly A) k = (0::'a)}

goal (1 subgoal):
 1. spectrum A = {k. poly (char_poly A) k = (0::'a)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
spectrum A = {k. poly CP k = (0::'a)}

goal (2 subgoals):
 1. finite (spectrum A)
 2. card (spectrum A) \<le> n
[PROOF STEP]
from degree_monic_char_poly[OF A]
[PROOF STATE]
proof (chain)
picking this:
degree (char_poly A) = n \<and> coeff (char_poly A) n = (1::'a)
[PROOF STEP]
have d: "degree CP = n" and c: "coeff CP n = 1"
[PROOF STATE]
proof (prove)
using this:
degree (char_poly A) = n \<and> coeff (char_poly A) n = (1::'a)

goal (1 subgoal):
 1. degree CP = n &&& coeff CP n = (1::'a)
[PROOF STEP]
unfolding CP_def
[PROOF STATE]
proof (prove)
using this:
degree (char_poly A) = n \<and> coeff (char_poly A) n = (1::'a)

goal (1 subgoal):
 1. degree (char_poly A) = n &&& coeff (char_poly A) n = (1::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree CP = n
coeff CP n = (1::'a)

goal (2 subgoals):
 1. finite (spectrum A)
 2. card (spectrum A) \<le> n
[PROOF STEP]
from c
[PROOF STATE]
proof (chain)
picking this:
coeff CP n = (1::'a)
[PROOF STEP]
have "CP \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
coeff CP n = (1::'a)

goal (1 subgoal):
 1. CP \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
CP \<noteq> 0

goal (2 subgoals):
 1. finite (spectrum A)
 2. card (spectrum A) \<le> n
[PROOF STEP]
from poly_roots_finite[OF this]
[PROOF STATE]
proof (chain)
picking this:
finite {x. poly CP x = (0::'a)}
[PROOF STEP]
show "finite (spectrum A)"
[PROOF STATE]
proof (prove)
using this:
finite {x. poly CP x = (0::'a)}

goal (1 subgoal):
 1. finite (spectrum A)
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
using this:
finite {x. poly CP x = (0::'a)}

goal (1 subgoal):
 1. finite {k. poly CP k = (0::'a)}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
finite (spectrum A)

goal (1 subgoal):
 1. card (spectrum A) \<le> n
[PROOF STEP]
from poly_roots_degree[OF \<open>CP \<noteq> 0\<close>]
[PROOF STATE]
proof (chain)
picking this:
card {x. poly CP x = (0::'a)} \<le> degree CP
[PROOF STEP]
show "card (spectrum A) \<le> n"
[PROOF STATE]
proof (prove)
using this:
card {x. poly CP x = (0::'a)} \<le> degree CP

goal (1 subgoal):
 1. card (spectrum A) \<le> n
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
using this:
card {x. poly CP x = (0::'a)} \<le> degree CP

goal (1 subgoal):
 1. card {k. poly CP k = (0::'a)} \<le> n
[PROOF STEP]
using d
[PROOF STATE]
proof (prove)
using this:
card {x. poly CP x = (0::'a)} \<le> degree CP
degree CP = n

goal (1 subgoal):
 1. card {k. poly CP k = (0::'a)} \<le> n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (spectrum A) \<le> n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma path_image_rectpath:
  assumes "Re a1 \<le> Re a3" "Im a1 \<le> Im a3"
  shows "path_image (rectpath a1 a3) =
           {z. Re z \<in> {Re a1, Re a3} \<and> Im z \<in> {Im a1..Im a3}} \<union>
           {z. Im z \<in> {Im a1, Im a3} \<and> Re z \<in> {Re a1..Re a3}}" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image (rectpath a1 a3) = {z. Re z \<in> {Re a1, Re a3} \<and> Im z \<in> {Im a1..Im a3}} \<union> {z. Im z \<in> {Im a1, Im a3} \<and> Re z \<in> {Re a1..Re a3}}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. path_image (rectpath a1 a3) = {z. Re z \<in> {Re a1, Re a3} \<and> Im z \<in> {Im a1..Im a3}} \<union> {z. Im z \<in> {Im a1, Im a3} \<and> Re z \<in> {Re a1..Re a3}}
[PROOF STEP]
define a2 a4 where "a2 = Complex (Re a3) (Im a1)" and "a4 = Complex (Re a1) (Im a3)"
[PROOF STATE]
proof (state)
this:
a2 = Complex (Re a3) (Im a1)
a4 = Complex (Re a1) (Im a3)

goal (1 subgoal):
 1. path_image (rectpath a1 a3) = {z. Re z \<in> {Re a1, Re a3} \<and> Im z \<in> {Im a1..Im a3}} \<union> {z. Im z \<in> {Im a1, Im a3} \<and> Re z \<in> {Re a1..Re a3}}
[PROOF STEP]
have "?lhs = closed_segment a1 a2 \<union> closed_segment a2 a3 \<union>
                  closed_segment a4 a3 \<union> closed_segment a1 a4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image (rectpath a1 a3) = closed_segment a1 a2 \<union> closed_segment a2 a3 \<union> closed_segment a4 a3 \<union> closed_segment a1 a4
[PROOF STEP]
by (simp_all add: rectpath_def Let_def path_image_join closed_segment_commute
                      a2_def a4_def Un_assoc)
[PROOF STATE]
proof (state)
this:
path_image (rectpath a1 a3) = closed_segment a1 a2 \<union> closed_segment a2 a3 \<union> closed_segment a4 a3 \<union> closed_segment a1 a4

goal (1 subgoal):
 1. path_image (rectpath a1 a3) = {z. Re z \<in> {Re a1, Re a3} \<and> Im z \<in> {Im a1..Im a3}} \<union> {z. Im z \<in> {Im a1, Im a3} \<and> Re z \<in> {Re a1..Re a3}}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
path_image (rectpath a1 a3) = closed_segment a1 a2 \<union> closed_segment a2 a3 \<union> closed_segment a4 a3 \<union> closed_segment a1 a4

goal (1 subgoal):
 1. path_image (rectpath a1 a3) = {z. Re z \<in> {Re a1, Re a3} \<and> Im z \<in> {Im a1..Im a3}} \<union> {z. Im z \<in> {Im a1, Im a3} \<and> Re z \<in> {Re a1..Re a3}}
[PROOF STEP]
have "\<dots> = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_segment a1 a2 \<union> closed_segment a2 a3 \<union> closed_segment a4 a3 \<union> closed_segment a1 a4 = {z. Re z \<in> {Re a1, Re a3} \<and> Im z \<in> {Im a1..Im a3}} \<union> {z. Im z \<in> {Im a1, Im a3} \<and> Re z \<in> {Re a1..Re a3}}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Re a1 \<le> Re a3
Im a1 \<le> Im a3

goal (1 subgoal):
 1. closed_segment a1 a2 \<union> closed_segment a2 a3 \<union> closed_segment a4 a3 \<union> closed_segment a1 a4 = {z. Re z \<in> {Re a1, Re a3} \<and> Im z \<in> {Im a1..Im a3}} \<union> {z. Im z \<in> {Im a1, Im a3} \<and> Re z \<in> {Re a1..Re a3}}
[PROOF STEP]
by (auto simp: rectpath_def Let_def path_image_join a2_def a4_def
          closed_segment_same_Re closed_segment_same_Im closed_segment_eq_real_ivl)
[PROOF STATE]
proof (state)
this:
closed_segment a1 a2 \<union> closed_segment a2 a3 \<union> closed_segment a4 a3 \<union> closed_segment a1 a4 = {z. Re z \<in> {Re a1, Re a3} \<and> Im z \<in> {Im a1..Im a3}} \<union> {z. Im z \<in> {Im a1, Im a3} \<and> Re z \<in> {Re a1..Re a3}}

goal (1 subgoal):
 1. path_image (rectpath a1 a3) = {z. Re z \<in> {Re a1, Re a3} \<and> Im z \<in> {Im a1..Im a3}} \<union> {z. Im z \<in> {Im a1, Im a3} \<and> Re z \<in> {Re a1..Re a3}}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
path_image (rectpath a1 a3) = {z. Re z \<in> {Re a1, Re a3} \<and> Im z \<in> {Im a1..Im a3}} \<union> {z. Im z \<in> {Im a1, Im a3} \<and> Re z \<in> {Re a1..Re a3}}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
path_image (rectpath a1 a3) = {z. Re z \<in> {Re a1, Re a3} \<and> Im z \<in> {Im a1..Im a3}} \<union> {z. Im z \<in> {Im a1, Im a3} \<and> Re z \<in> {Re a1..Re a3}}

goal (1 subgoal):
 1. path_image (rectpath a1 a3) = {z. Re z \<in> {Re a1, Re a3} \<and> Im z \<in> {Im a1..Im a3}} \<union> {z. Im z \<in> {Im a1, Im a3} \<and> Re z \<in> {Re a1..Re a3}}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
path_image (rectpath a1 a3) = {z. Re z \<in> {Re a1, Re a3} \<and> Im z \<in> {Im a1..Im a3}} \<union> {z. Im z \<in> {Im a1, Im a3} \<and> Re z \<in> {Re a1..Re a3}}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma variation_congr:
  assumes "sgn x=sgn x'" "sgn y=sgn y'"
  shows "variation x y=variation x' y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. variation x y = variation x' y'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
sgn x = sgn x'
sgn y = sgn y'

goal (1 subgoal):
 1. variation x y = variation x' y'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>sgn x = sgn x'; sgn y = sgn y'\<rbrakk> \<Longrightarrow> variation x y = variation x' y'
[PROOF STEP]
have " 0 \<le> x * y =  (0\<le> x' * y')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<le> x * y) = (0 \<le> x' * y')
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
sgn x = sgn x'
sgn y = sgn y'

goal (1 subgoal):
 1. (0 \<le> x * y) = (0 \<le> x' * y')
[PROOF STEP]
by (metis Real_Vector_Spaces.sgn_mult zero_le_sgn_iff)
[PROOF STATE]
proof (state)
this:
(0 \<le> x * y) = (0 \<le> x' * y')

goal (1 subgoal):
 1. \<lbrakk>sgn x = sgn x'; sgn y = sgn y'\<rbrakk> \<Longrightarrow> variation x y = variation x' y'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(0 \<le> x * y) = (0 \<le> x' * y')

goal (1 subgoal):
 1. \<lbrakk>sgn x = sgn x'; sgn y = sgn y'\<rbrakk> \<Longrightarrow> variation x y = variation x' y'
[PROOF STEP]
hence "\<not> 0\<le>x * y \<Longrightarrow> x < y = (x' < y')"
[PROOF STATE]
proof (prove)
using this:
(0 \<le> x * y) = (0 \<le> x' * y')

goal (1 subgoal):
 1. \<not> 0 \<le> x * y \<Longrightarrow> (x < y) = (x' < y')
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(0 \<le> x * y) = (0 \<le> x' * y')
sgn x = sgn x'
sgn y = sgn y'

goal (1 subgoal):
 1. \<not> 0 \<le> x * y \<Longrightarrow> (x < y) = (x' < y')
[PROOF STEP]
by (metis less_eq_real_def mult_nonneg_nonneg mult_nonpos_nonpos not_le order.strict_trans2
      zero_le_sgn_iff)
[PROOF STATE]
proof (state)
this:
\<not> 0 \<le> x * y \<Longrightarrow> (x < y) = (x' < y')

goal (1 subgoal):
 1. \<lbrakk>sgn x = sgn x'; sgn y = sgn y'\<rbrakk> \<Longrightarrow> variation x y = variation x' y'
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(0 \<le> x * y) = (0 \<le> x' * y')
\<not> 0 \<le> x * y \<Longrightarrow> (x < y) = (x' < y')
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(0 \<le> x * y) = (0 \<le> x' * y')
\<not> 0 \<le> x * y \<Longrightarrow> (x < y) = (x' < y')

goal (1 subgoal):
 1. variation x y = variation x' y'
[PROOF STEP]
unfolding variation_def
[PROOF STATE]
proof (prove)
using this:
(0 \<le> x * y) = (0 \<le> x' * y')
\<not> 0 \<le> x * y \<Longrightarrow> (x < y) = (x' < y')

goal (1 subgoal):
 1. (if 0 \<le> x * y then 0 else if x < y then 1 else - 1) = (if 0 \<le> x' * y' then 0 else if x' < y' then 1 else - 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
variation x y = variation x' y'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma multiple_point_rep_num: "(multiple_blocks n) rep x = (\<B> rep x) * n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiple_blocks n rep x = \<B> rep x * n
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. multiple_blocks 0 rep x = \<B> rep x * 0
 2. \<And>n. multiple_blocks n rep x = \<B> rep x * n \<Longrightarrow> multiple_blocks (Suc n) rep x = \<B> rep x * Suc n
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. multiple_blocks 0 rep x = \<B> rep x * 0
 2. \<And>n. multiple_blocks n rep x = \<B> rep x * n \<Longrightarrow> multiple_blocks (Suc n) rep x = \<B> rep x * Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiple_blocks 0 rep x = \<B> rep x * 0
[PROOF STEP]
by (simp add: point_replication_number_def)
[PROOF STATE]
proof (state)
this:
multiple_blocks 0 rep x = \<B> rep x * 0

goal (1 subgoal):
 1. \<And>n. multiple_blocks n rep x = \<B> rep x * n \<Longrightarrow> multiple_blocks (Suc n) rep x = \<B> rep x * Suc n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. multiple_blocks n rep x = \<B> rep x * n \<Longrightarrow> multiple_blocks (Suc n) rep x = \<B> rep x * Suc n
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
multiple_blocks n rep x = \<B> rep x * n

goal (1 subgoal):
 1. \<And>n. multiple_blocks n rep x = \<B> rep x * n \<Longrightarrow> multiple_blocks (Suc n) rep x = \<B> rep x * Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
multiple_blocks n rep x = \<B> rep x * n
[PROOF STEP]
have "multiple_blocks (Suc n) rep x = \<B> rep x * n + (\<B> rep x)"
[PROOF STATE]
proof (prove)
using this:
multiple_blocks n rep x = \<B> rep x * n

goal (1 subgoal):
 1. multiple_blocks (Suc n) rep x = \<B> rep x * n + \<B> rep x
[PROOF STEP]
using Suc.IH Suc.prems
[PROOF STATE]
proof (prove)
using this:
multiple_blocks n rep x = \<B> rep x * n
multiple_blocks n rep x = \<B> rep x * n

goal (1 subgoal):
 1. multiple_blocks (Suc n) rep x = \<B> rep x * n + \<B> rep x
[PROOF STEP]
by (simp add: union_commute point_replication_number_def)
[PROOF STATE]
proof (state)
this:
multiple_blocks (Suc n) rep x = \<B> rep x * n + \<B> rep x

goal (1 subgoal):
 1. \<And>n. multiple_blocks n rep x = \<B> rep x * n \<Longrightarrow> multiple_blocks (Suc n) rep x = \<B> rep x * Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
multiple_blocks (Suc n) rep x = \<B> rep x * n + \<B> rep x
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
multiple_blocks (Suc n) rep x = \<B> rep x * n + \<B> rep x

goal (1 subgoal):
 1. multiple_blocks (Suc n) rep x = \<B> rep x * Suc n
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
multiple_blocks (Suc n) rep x = \<B> rep x * Suc n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_poly_pCons_0_as_mult:
  fixes p :: "'a :: comm_semiring_1 poly poly"
  shows "map_poly (pCons 0) p = [:pCons 0 1:] * p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly (pCons (0::'a)) p = [:pCons (0::'a) 1:] * p
[PROOF STEP]
apply (subst(1) pCons_0_as_mult)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly ((*) (pCons (0::'a) 1)) p = [:pCons (0::'a) 1:] * p
[PROOF STEP]
apply (fold smult_as_map_poly)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult (pCons (0::'a) 1) p = [:pCons (0::'a) 1:] * p
[PROOF STEP]
by simp


[STATEMENT]
lemma suminf_diff: "summable f \<Longrightarrow> summable g \<Longrightarrow> suminf f - suminf g = (\<Sum>n. f n - g n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>summable f; summable g\<rbrakk> \<Longrightarrow> suminf f - suminf g = (\<Sum>n. f n - g n)
[PROOF STEP]
by (intro sums_unique sums_diff summable_sums)


[STATEMENT]
lemma no_embedding_sphere_lowdim:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes contf: "continuous_on (sphere a r) f" and injf: "inj_on f (sphere a r)" and "r > 0"
   shows "DIM('a) \<le> DIM('b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. DIM('a) \<le> DIM('b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. DIM('a) \<le> DIM('b)
[PROOF STEP]
have "False" if "DIM('a) > DIM('b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. False
[PROOF STEP]
have "compact (f ` sphere a r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact (f ` sphere a r)
[PROOF STEP]
using compact_continuous_image
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>continuous_on ?s ?f; compact ?s\<rbrakk> \<Longrightarrow> compact (?f ` ?s)

goal (1 subgoal):
 1. compact (f ` sphere a r)
[PROOF STEP]
by (simp add: compact_continuous_image contf)
[PROOF STATE]
proof (state)
this:
compact (f ` sphere a r)

goal (1 subgoal):
 1. False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
compact (f ` sphere a r)
[PROOF STEP]
have "\<not> open (f ` sphere a r)"
[PROOF STATE]
proof (prove)
using this:
compact (f ` sphere a r)

goal (1 subgoal):
 1. \<not> open (f ` sphere a r)
[PROOF STEP]
using compact_open
[PROOF STATE]
proof (prove)
using this:
compact (f ` sphere a r)
(compact ?S \<and> open ?S) = (?S = {})

goal (1 subgoal):
 1. \<not> open (f ` sphere a r)
[PROOF STEP]
by (metis assms(3) image_is_empty not_less_iff_gr_or_eq sphere_eq_empty)
[PROOF STATE]
proof (state)
this:
\<not> open (f ` sphere a r)

goal (1 subgoal):
 1. False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> open (f ` sphere a r)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<not> open (f ` sphere a r)

goal (1 subgoal):
 1. False
[PROOF STEP]
using invariance_of_domain_sphere_affine_set [OF contf injf subset_UNIV] \<open>r > 0\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> open (f ` sphere a r)
\<lbrakk>?r \<noteq> 0; affine UNIV; aff_dim UNIV < int DIM('a); openin (top_of_set (sphere ?a ?r)) (sphere a r)\<rbrakk> \<Longrightarrow> openin (top_of_set UNIV) (f ` sphere a r)
0 < r

goal (1 subgoal):
 1. False
[PROOF STEP]
by (metis aff_dim_UNIV affine_UNIV less_irrefl of_nat_less_iff open_openin openin_subtopology_self subtopology_UNIV that)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
DIM('b) < DIM('a) \<Longrightarrow> False

goal (1 subgoal):
 1. DIM('a) \<le> DIM('b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
DIM('b) < DIM('a) \<Longrightarrow> False
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
DIM('b) < DIM('a) \<Longrightarrow> False

goal (1 subgoal):
 1. DIM('a) \<le> DIM('b)
[PROOF STEP]
using not_less
[PROOF STATE]
proof (prove)
using this:
DIM('b) < DIM('a) \<Longrightarrow> False
(\<not> ?x < ?y) = (?y \<le> ?x)

goal (1 subgoal):
 1. DIM('a) \<le> DIM('b)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
DIM('a) \<le> DIM('b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dagger_of_id_is_id [simp]:
  "(1\<^sub>m n)\<^sup>\<dagger> = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1\<^sub>m n\<^sup>\<dagger> = 1\<^sub>m n
[PROOF STEP]
using dagger_def one_mat_def
[PROOF STATE]
proof (prove)
using this:
?M\<^sup>\<dagger> \<equiv> mat (dim_col ?M) (dim_row ?M) (\<lambda>(i, j). cnj (?M $$ (j, i)))
1\<^sub>m ?n \<equiv> mat ?n ?n (\<lambda>(i, j). if i = j then 1::?'a else (0::?'a))

goal (1 subgoal):
 1. 1\<^sub>m n\<^sup>\<dagger> = 1\<^sub>m n
[PROOF STEP]
by auto


[STATEMENT]
lemma bw_diff_minus [simp]: "bw_diff (\<lambda>x. f x - g x) = (\<lambda>x. bw_diff f x - bw_diff g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bw_diff (\<lambda>x. f x - g x) = (\<lambda>x. bw_diff f x - bw_diff g x)
[PROOF STEP]
by (rule ext) (simp add: bw_diff_def)


[STATEMENT]
lemma fps_sin_fps_exp_ii: "fps_sin c = (fps_exp (\<i> * c) - fps_exp (- \<i> * c)) / fps_const (2*\<i>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_sin c = (fps_exp (\<i> * c) - fps_exp (- \<i> * c)) / fps_const (2 * \<i>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_sin c = (fps_exp (\<i> * c) - fps_exp (- \<i> * c)) / fps_const (2 * \<i>)
[PROOF STEP]
have th: "fps_const \<i> * fps_sin c + fps_const \<i> * fps_sin c = fps_sin c * fps_const (2 * \<i>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_const \<i> * fps_sin c + fps_const \<i> * fps_sin c = fps_sin c * fps_const (2 * \<i>)
[PROOF STEP]
by (simp add: fps_eq_iff numeral_fps_const)
[PROOF STATE]
proof (state)
this:
fps_const \<i> * fps_sin c + fps_const \<i> * fps_sin c = fps_sin c * fps_const (2 * \<i>)

goal (1 subgoal):
 1. fps_sin c = (fps_exp (\<i> * c) - fps_exp (- \<i> * c)) / fps_const (2 * \<i>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_sin c = (fps_exp (\<i> * c) - fps_exp (- \<i> * c)) / fps_const (2 * \<i>)
[PROOF STEP]
unfolding fps_exp_ii_sin_cos minus_mult_commute
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_sin c = (fps_cos c + fps_const \<i> * fps_sin c - (fps_cos (- c) + fps_const \<i> * fps_sin (- c))) / fps_const (2 * \<i>)
[PROOF STEP]
by (simp add: fps_sin_even fps_cos_odd fps_divide_unit fps_const_inverse th)
[PROOF STATE]
proof (state)
this:
fps_sin c = (fps_exp (\<i> * c) - fps_exp (- \<i> * c)) / fps_const (2 * \<i>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem eval_prim[simp]: assumes e1:"E e1 = E (ENat n1)" and e2:"E e2 = E (ENat n2)"
  shows "E(EPrim f e1 e2)=E(ENat (f n1 n2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. E (EPrim f e1 e2) = E (ENat (f n1 n2))
[PROOF STEP]
using e1 e2
[PROOF STATE]
proof (prove)
using this:
E e1 = E (ENat n1)
E e2 = E (ENat n2)

goal (1 subgoal):
 1. E (EPrim f e1 e2) = E (ENat (f n1 n2))
[PROOF STEP]
by auto


[STATEMENT]
lemma evimage_if [simp]: "((\<lambda>x. if x \<in> B then c else d) \<inverse>\<^bsub>n\<^esub> A) =
   (if c \<in> A then (if d \<in> A then carrier (R\<^bsup>n\<^esup>) else B \<inter> carrier (R\<^bsup>n\<^esup>) )
    else if d \<in> A then B\<^sup>c\<^bsub>n\<^esub>  else {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<in> B then c else d) \<inverse>\<^bsub>n\<^esub> A = (if c \<in> A then if d \<in> A then carrier (R\<^bsup>n\<^esup>) else B \<inter> carrier (R\<^bsup>n\<^esup>) else if d \<in> A then B \<^sup>c\<^bsub>n\<^esub> else {})
[PROOF STEP]
unfolding evimage_def euminus_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<in> B then c else d) -` A \<inter> carrier (R\<^bsup>n\<^esup>) = (if c \<in> A then if d \<in> A then carrier (R\<^bsup>n\<^esup>) else B \<inter> carrier (R\<^bsup>n\<^esup>) else if d \<in> A then carrier (R\<^bsup>n\<^esup>) - B else {})
[PROOF STEP]
using vimage_if[of B c d A]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. if x \<in> B then c else d) -` A = (if c \<in> A then if d \<in> A then UNIV else B else if d \<in> A then - B else {})

goal (1 subgoal):
 1. (\<lambda>x. if x \<in> B then c else d) -` A \<inter> carrier (R\<^bsup>n\<^esup>) = (if c \<in> A then if d \<in> A then carrier (R\<^bsup>n\<^esup>) else B \<inter> carrier (R\<^bsup>n\<^esup>) else if d \<in> A then carrier (R\<^bsup>n\<^esup>) - B else {})
[PROOF STEP]
by (metis Diff_Compl Diff_UNIV Diff_empty Int_commute double_compl)