[STATEMENT]
lemma dimension_vector[code_unfold]: "vec.dimension TYPE('a::{field}) TYPE('rows::{mod_type})=CARD('rows)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_dimensional_vector_space.dimension cart_basis = CARD('rows)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite_dimensional_vector_space.dimension cart_basis = CARD('rows)
[PROOF STEP]
let ?f="\<lambda>x. axis (from_nat x) 1::'a^'rows::{mod_type}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite_dimensional_vector_space.dimension cart_basis = CARD('rows)
[PROOF STEP]
have "vec.dimension TYPE('a::{field}) TYPE('rows::{mod_type}) = card (cart_basis::('a^'rows::{mod_type}) set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_dimensional_vector_space.dimension cart_basis = card cart_basis
[PROOF STEP]
unfolding vec.dimension_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card cart_basis = card cart_basis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
finite_dimensional_vector_space.dimension cart_basis = card cart_basis

goal (1 subgoal):
 1. finite_dimensional_vector_space.dimension cart_basis = CARD('rows)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
finite_dimensional_vector_space.dimension cart_basis = card cart_basis

goal (1 subgoal):
 1. finite_dimensional_vector_space.dimension cart_basis = CARD('rows)
[PROOF STEP]
have "... = card{..<CARD('rows)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card cart_basis = card {..<CARD('rows)}
[PROOF STEP]
unfolding cart_basis_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {axis i (1::'a) |i. i \<in> UNIV} = card {..<CARD('rows)}
[PROOF STEP]
proof (rule bij_betw_same_card[symmetric, of ?f], unfold bij_betw_def, unfold inj_on_def axis_eq_axis, auto)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x < CARD('rows); y < CARD('rows); mod_type_class.from_nat x = mod_type_class.from_nat y\<rbrakk> \<Longrightarrow> x = y
 2. \<And>i. axis i (1::'a) \<in> (\<lambda>x. axis (mod_type_class.from_nat x) (1::'a)) ` {..<CARD('rows)}
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x < CARD('rows); y < CARD('rows); mod_type_class.from_nat x = mod_type_class.from_nat y\<rbrakk> \<Longrightarrow> x = y
 2. \<And>i. axis i (1::'a) \<in> (\<lambda>x. axis (mod_type_class.from_nat x) (1::'a)) ` {..<CARD('rows)}
[PROOF STEP]
assume x: "x < CARD('rows)" and y: "y < CARD('rows)" and eq: "from_nat x = (from_nat y::'rows)"
[PROOF STATE]
proof (state)
this:
x < CARD('rows)
y < CARD('rows)
mod_type_class.from_nat x = mod_type_class.from_nat y

goal (2 subgoals):
 1. \<And>x y. \<lbrakk>x < CARD('rows); y < CARD('rows); mod_type_class.from_nat x = mod_type_class.from_nat y\<rbrakk> \<Longrightarrow> x = y
 2. \<And>i. axis i (1::'a) \<in> (\<lambda>x. axis (mod_type_class.from_nat x) (1::'a)) ` {..<CARD('rows)}
[PROOF STEP]
show "x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
using from_nat_eq_imp_eq[OF eq x y]
[PROOF STATE]
proof (prove)
using this:
x = y

goal (1 subgoal):
 1. x = y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x = y

goal (1 subgoal):
 1. \<And>i. axis i (1::'a) \<in> (\<lambda>x. axis (mod_type_class.from_nat x) (1::'a)) ` {..<CARD('rows)}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. axis i (1::'a) \<in> (\<lambda>x. axis (mod_type_class.from_nat x) (1::'a)) ` {..<CARD('rows)}
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. axis i (1::'a) \<in> (\<lambda>x. axis (mod_type_class.from_nat x) (1::'a)) ` {..<CARD('rows)}
[PROOF STEP]
show "axis i 1 \<in> (\<lambda>x. axis (from_nat x::'rows) 1) ` {..<CARD('rows)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. axis i (1::'b) \<in> (\<lambda>x. axis (mod_type_class.from_nat x) (1::'b)) ` {..<CARD('rows)}
[PROOF STEP]
unfolding image_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. axis i (1::'b) \<in> {y. \<exists>x\<in>{..<CARD('rows)}. y = axis (mod_type_class.from_nat x) (1::'b)}
[PROOF STEP]
by (auto, metis lessThan_iff to_nat_from_nat to_nat_less_card)
[PROOF STATE]
proof (state)
this:
axis i (1::?'b1) \<in> (\<lambda>x. axis (mod_type_class.from_nat x) (1::?'b1)) ` {..<CARD('rows)}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card cart_basis = card {..<CARD('rows)}

goal (1 subgoal):
 1. finite_dimensional_vector_space.dimension cart_basis = CARD('rows)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card cart_basis = card {..<CARD('rows)}

goal (1 subgoal):
 1. finite_dimensional_vector_space.dimension cart_basis = CARD('rows)
[PROOF STEP]
have "... = CARD('rows)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {..<CARD('rows)} = CARD('rows)
[PROOF STEP]
by (metis card_lessThan)
[PROOF STATE]
proof (state)
this:
card {..<CARD('rows)} = CARD('rows)

goal (1 subgoal):
 1. finite_dimensional_vector_space.dimension cart_basis = CARD('rows)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
finite_dimensional_vector_space.dimension cart_basis = CARD('rows)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite_dimensional_vector_space.dimension cart_basis = CARD('rows)

goal (1 subgoal):
 1. finite_dimensional_vector_space.dimension cart_basis = CARD('rows)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
finite_dimensional_vector_space.dimension cart_basis = CARD('rows)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "(\<exists>x. P(x)) \<and>
       (\<forall>x. L(x) \<longrightarrow> \<not> (M(x) \<and> R(x))) \<and>
       (\<forall>x. P(x) \<longrightarrow> (M(x) \<and> L(x))) \<and>
       ((\<forall>x. P(x)\<longrightarrow>Q(x)) \<or> (\<exists>x. P(x)\<and>R(x)))
   \<longrightarrow> (\<exists>x. Q(x)\<and>P(x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. P x) \<and> (\<forall>x. L x \<longrightarrow> \<not> (M x \<and> R x)) \<and> (\<forall>x. P x \<longrightarrow> M x \<and> L x) \<and> ((\<forall>x. P x \<longrightarrow> Q x) \<or> (\<exists>x. P x \<and> R x)) \<longrightarrow> (\<exists>x. Q x \<and> P x)
[PROOF STEP]
by iprover


[STATEMENT]
lemma proots_card_fcompose_bij_eq:
  fixes p::"'a::field poly"
  assumes bij:"bij_betw (\<lambda>x. poly q1 x/poly q2 x) A B" and "p\<noteq>0"
      and nzero:"\<forall>x\<in>A. poly q2 x\<noteq>0"
      and max_deg: "max (degree q1) (degree q2) \<le> 1"
      and nconst:"\<forall>c. q1 \<noteq> smult c q2"
      and infi:"infinite (UNIV::'a set)"
  shows "card (proots_within p B) = card (proots_within (fcompose p q1 q2) A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within p B) = card (proots_within (fcompose p q1 q2) A)
[PROOF STEP]
using \<open>p\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. card (proots_within p B) = card (proots_within (fcompose p q1 q2) A)
[PROOF STEP]
proof (induct p rule:poly_root_induct_alt)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. 0 \<noteq> 0 \<Longrightarrow> card (proots_within 0 B) = card (proots_within (fcompose 0 q1 q2) A)
 2. \<And>p. \<lbrakk>\<And>a. poly p a \<noteq> (0::'a); p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A)
 3. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (fcompose ([:- a, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 \<noteq> 0

goal (3 subgoals):
 1. 0 \<noteq> 0 \<Longrightarrow> card (proots_within 0 B) = card (proots_within (fcompose 0 q1 q2) A)
 2. \<And>p. \<lbrakk>\<And>a. poly p a \<noteq> (0::'a); p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A)
 3. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (fcompose ([:- a, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<noteq> 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 \<noteq> 0

goal (1 subgoal):
 1. card (proots_within 0 B) = card (proots_within (fcompose 0 q1 q2) A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (proots_within 0 B) = card (proots_within (fcompose 0 q1 q2) A)

goal (2 subgoals):
 1. \<And>p. \<lbrakk>\<And>a. poly p a \<noteq> (0::'a); p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A)
 2. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (fcompose ([:- a, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>p. \<lbrakk>\<And>a. poly p a \<noteq> (0::'a); p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A)
 2. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (fcompose ([:- a, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
case (no_proots p)
[PROOF STATE]
proof (state)
this:
poly p ?a \<noteq> (0::'a)
p \<noteq> 0

goal (2 subgoals):
 1. \<And>p. \<lbrakk>\<And>a. poly p a \<noteq> (0::'a); p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A)
 2. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (fcompose ([:- a, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
have "proots_within p B = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within p B = {}
[PROOF STEP]
using no_proots
[PROOF STATE]
proof (prove)
using this:
poly p ?a \<noteq> (0::'a)
p \<noteq> 0

goal (1 subgoal):
 1. proots_within p B = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_within p B = {}

goal (2 subgoals):
 1. \<And>p. \<lbrakk>\<And>a. poly p a \<noteq> (0::'a); p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A)
 2. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (fcompose ([:- a, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
proots_within p B = {}

goal (2 subgoals):
 1. \<And>p. \<lbrakk>\<And>a. poly p a \<noteq> (0::'a); p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A)
 2. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (fcompose ([:- a, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
have "proots_within (fcompose p q1 q2) A = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within (fcompose p q1 q2) A = {}
[PROOF STEP]
using no_proots fcompose_poly
[PROOF STATE]
proof (prove)
using this:
poly p ?a \<noteq> (0::'a)
p \<noteq> 0
poly ?q2.0 ?x \<noteq> (0::?'a) \<Longrightarrow> poly ?p (poly ?q1.0 ?x / poly ?q2.0 ?x) = poly (fcompose ?p ?q1.0 ?q2.0) ?x / poly (?q2.0 ^ degree ?p) ?x

goal (1 subgoal):
 1. proots_within (fcompose p q1 q2) A = {}
[PROOF STEP]
by (smt Collect_empty_eq divide_eq_0_iff nzero proots_within_def)
[PROOF STATE]
proof (state)
this:
proots_within (fcompose p q1 q2) A = {}

goal (2 subgoals):
 1. \<And>p. \<lbrakk>\<And>a. poly p a \<noteq> (0::'a); p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A)
 2. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (fcompose ([:- a, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
proots_within p B = {}
proots_within (fcompose p q1 q2) A = {}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
proots_within p B = {}
proots_within (fcompose p q1 q2) A = {}

goal (1 subgoal):
 1. card (proots_within p B) = card (proots_within (fcompose p q1 q2) A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (proots_within p B) = card (proots_within (fcompose p q1 q2) A)

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (fcompose ([:- a, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (fcompose ([:- a, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
case (root b p)
[PROOF STATE]
proof (state)
this:
p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A)
[:- b, 1::'a:] * p \<noteq> 0

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (fcompose ([:- a, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A)
[:- b, 1::'a:] * p \<noteq> 0
[PROOF STEP]
have [simp]:"p\<noteq>0"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A)
[:- b, 1::'a:] * p \<noteq> 0

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

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (fcompose ([:- a, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
have ?case when "b\<notin>B \<or> poly p b=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
have "proots_within ([:- b, 1:] * p) B = proots_within p B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within ([:- b, 1::'a:] * p) B = proots_within p B
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
b \<notin> B \<or> poly p b = (0::'a)

goal (1 subgoal):
 1. proots_within ([:- b, 1::'a:] * p) B = proots_within p B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_within ([:- b, 1::'a:] * p) B = proots_within p B

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
proots_within ([:- b, 1::'a:] * p) B = proots_within p B

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
have "proots_within (fcompose ([:- b, 1:] * p) q1 q2) A
        = proots_within (fcompose p q1 q2) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A = proots_within (fcompose p q1 q2) A
[PROOF STEP]
using that nzero
[PROOF STATE]
proof (prove)
using this:
b \<notin> B \<or> poly p b = (0::'a)
\<forall>x\<in>A. poly q2 x \<noteq> (0::'a)

goal (1 subgoal):
 1. proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A = proots_within (fcompose p q1 q2) A
[PROOF STEP]
unfolding fcompose_mult proots_within_times
[PROOF STATE]
proof (prove)
using this:
b \<notin> B \<or> poly p b = (0::'a)
\<forall>x\<in>A. poly q2 x \<noteq> (0::'a)

goal (1 subgoal):
 1. proots_within (fcompose [:- b, 1::'a:] q1 q2) A \<union> proots_within (fcompose p q1 q2) A = proots_within (fcompose p q1 q2) A
[PROOF STEP]
apply (auto simp add: poly_fcompose)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>x\<in>A. poly q2 x \<noteq> (0::'a); poly q1 x / poly q2 x \<notin> B; x \<in> A; b = poly q1 x / poly q2 x\<rbrakk> \<Longrightarrow> poly p (poly q1 x / poly q2 x) = (0::'a)
[PROOF STEP]
using bij bij_betwE
[PROOF STATE]
proof (prove)
using this:
bij_betw (\<lambda>x. poly q1 x / poly q2 x) A B
bij_betw ?f ?A ?B \<Longrightarrow> \<forall>a\<in>?A. ?f a \<in> ?B

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>x\<in>A. poly q2 x \<noteq> (0::'a); poly q1 x / poly q2 x \<notin> B; x \<in> A; b = poly q1 x / poly q2 x\<rbrakk> \<Longrightarrow> poly p (poly q1 x / poly q2 x) = (0::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A = proots_within (fcompose p q1 q2) A

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
proots_within ([:- b, 1::'a:] * p) B = proots_within p B
proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A = proots_within (fcompose p q1 q2) A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
proots_within ([:- b, 1::'a:] * p) B = proots_within p B
proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A = proots_within (fcompose p q1 q2) A

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
using root
[PROOF STATE]
proof (prove)
using this:
proots_within ([:- b, 1::'a:] * p) B = proots_within p B
proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A = proots_within (fcompose p q1 q2) A
p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A)
[:- b, 1::'a:] * p \<noteq> 0

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
b \<notin> B \<or> poly p b = (0::'a) \<Longrightarrow> card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (fcompose ([:- a, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
b \<notin> B \<or> poly p b = (0::'a) \<Longrightarrow> card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (fcompose ([:- a, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
have ?case when "b\<in>B" "poly p b\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
define bb where "bb=[:- b, 1:]"
[PROOF STATE]
proof (state)
this:
bb = [:- b, 1::'a:]

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
have "card (proots_within (bb * p) B) = card {b} + card (proots_within p B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within (bb * p) B) = card {b} + card (proots_within p B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (proots_within (bb * p) B) = card {b} + card (proots_within p B)
[PROOF STEP]
have "proots_within bb B = {b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within bb B = {b}
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
b \<in> B
poly p b \<noteq> (0::'a)

goal (1 subgoal):
 1. proots_within bb B = {b}
[PROOF STEP]
unfolding bb_def
[PROOF STATE]
proof (prove)
using this:
b \<in> B
poly p b \<noteq> (0::'a)

goal (1 subgoal):
 1. proots_within [:- b, 1::'a:] B = {b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
proots_within bb B = {b}

goal (1 subgoal):
 1. card (proots_within (bb * p) B) = card {b} + card (proots_within p B)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
proots_within bb B = {b}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
proots_within bb B = {b}

goal (1 subgoal):
 1. card (proots_within (bb * p) B) = card {b} + card (proots_within p B)
[PROOF STEP]
unfolding proots_within_times
[PROOF STATE]
proof (prove)
using this:
proots_within bb B = {b}

goal (1 subgoal):
 1. card (proots_within bb B \<union> proots_within p B) = card {b} + card (proots_within p B)
[PROOF STEP]
apply (subst card_Un_disjoint)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. proots_within bb B = {b} \<Longrightarrow> finite (proots_within bb B)
 2. proots_within bb B = {b} \<Longrightarrow> finite (proots_within p B)
 3. proots_within bb B = {b} \<Longrightarrow> proots_within bb B \<inter> proots_within p B = {}
 4. proots_within bb B = {b} \<Longrightarrow> card (proots_within bb B) + card (proots_within p B) = card {b} + card (proots_within p B)
[PROOF STEP]
by (use that in auto)
[PROOF STATE]
proof (state)
this:
card (proots_within (bb * p) B) = card {b} + card (proots_within p B)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card (proots_within (bb * p) B) = card {b} + card (proots_within p B)

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (proots_within (bb * p) B) = card {b} + card (proots_within p B)

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
have "... = 1 + card (proots_within (fcompose p q1 q2) A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {b} + card (proots_within p B) = 1 + card (proots_within (fcompose p q1 q2) A)
[PROOF STEP]
using root.hyps
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A)

goal (1 subgoal):
 1. card {b} + card (proots_within p B) = 1 + card (proots_within (fcompose p q1 q2) A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {b} + card (proots_within p B) = 1 + card (proots_within (fcompose p q1 q2) A)

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {b} + card (proots_within p B) = 1 + card (proots_within (fcompose p q1 q2) A)

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
have "... = card (proots_within (fcompose (bb * p) q1 q2) A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + card (proots_within (fcompose p q1 q2) A) = card (proots_within (fcompose (bb * p) q1 q2) A)
[PROOF STEP]
unfolding proots_within_times fcompose_mult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + card (proots_within (fcompose p q1 q2) A) = card (proots_within (fcompose bb q1 q2) A \<union> proots_within (fcompose p q1 q2) A)
[PROOF STEP]
proof (subst card_Un_disjoint)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. finite (proots_within (fcompose bb q1 q2) A)
 2. finite (proots_within (fcompose p q1 q2) A)
 3. proots_within (fcompose bb q1 q2) A \<inter> proots_within (fcompose p q1 q2) A = {}
 4. 1 + card (proots_within (fcompose p q1 q2) A) = card (proots_within (fcompose bb q1 q2) A) + card (proots_within (fcompose p q1 q2) A)
[PROOF STEP]
obtain a where b_poly:"b=poly q1 a / poly q2 a" and "a\<in>A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. \<lbrakk>b = poly q1 a / poly q2 a; a \<in> A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis (no_types, lifting) \<open>b \<in> B\<close> bij bij_betwE bij_betw_the_inv_into
            f_the_inv_into_f_bij_betw)
[PROOF STATE]
proof (state)
this:
b = poly q1 a / poly q2 a
a \<in> A

goal (4 subgoals):
 1. finite (proots_within (fcompose bb q1 q2) A)
 2. finite (proots_within (fcompose p q1 q2) A)
 3. proots_within (fcompose bb q1 q2) A \<inter> proots_within (fcompose p q1 q2) A = {}
 4. 1 + card (proots_within (fcompose p q1 q2) A) = card (proots_within (fcompose bb q1 q2) A) + card (proots_within (fcompose p q1 q2) A)
[PROOF STEP]
define bbq pq where "bbq=fcompose bb q1 q2" and "pq=fcompose p q1 q2"
[PROOF STATE]
proof (state)
this:
bbq = fcompose bb q1 q2
pq = fcompose p q1 q2

goal (4 subgoals):
 1. finite (proots_within (fcompose bb q1 q2) A)
 2. finite (proots_within (fcompose p q1 q2) A)
 3. proots_within (fcompose bb q1 q2) A \<inter> proots_within (fcompose p q1 q2) A = {}
 4. 1 + card (proots_within (fcompose p q1 q2) A) = card (proots_within (fcompose bb q1 q2) A) + card (proots_within (fcompose p q1 q2) A)
[PROOF STEP]
have bbq_0:"poly bbq a=0" and bbq_deg: "degree bbq\<le>1" and "bbq\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly bbq a = (0::'a) &&& degree bbq \<le> 1 &&& bbq \<noteq> 0
[PROOF STEP]
unfolding bbq_def bb_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (fcompose [:- b, 1::'a:] q1 q2) a = (0::'a) &&& degree (fcompose [:- b, 1::'a:] q1 q2) \<le> 1 &&& fcompose [:- b, 1::'a:] q1 q2 \<noteq> 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (fcompose [:- b, 1::'a:] q1 q2) a = (0::'a)
[PROOF STEP]
using \<open>a \<in> A\<close> b_poly nzero poly_fcompose
[PROOF STATE]
proof (prove)
using this:
a \<in> A
b = poly q1 a / poly q2 a
\<forall>x\<in>A. poly q2 x \<noteq> (0::'a)
poly ?q2.0 ?x \<noteq> (0::?'a) \<Longrightarrow> poly (fcompose ?p ?q1.0 ?q2.0) ?x = poly ?p (poly ?q1.0 ?x / poly ?q2.0 ?x) * poly ?q2.0 ?x ^ degree ?p

goal (1 subgoal):
 1. poly (fcompose [:- b, 1::'a:] q1 q2) a = (0::'a)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. degree (fcompose [:- b, 1::'a:] q1 q2) \<le> 1
 2. fcompose [:- b, 1::'a:] q1 q2 \<noteq> 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (fcompose [:- b, 1::'a:] q1 q2) \<le> 1
[PROOF STEP]
by (metis (no_types, lifting) degree_add_le degree_pCons_eq_if degree_smult_le
           dual_order.trans fcompose_const fcompose_pCons max.boundedE max_deg mult_cancel_left2
           one_neq_zero one_poly_eq_simps(1) power.simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fcompose [:- b, 1::'a:] q1 q2 \<noteq> 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fcompose [:- b, 1::'a:] q1 q2 \<noteq> 0
[PROOF STEP]
by (metis \<open>a \<in> A\<close> \<open>poly (fcompose [:- b, 1:] q1 q2) a = 0\<close> fcompose_nzero infi
                  nconst nzero one_neq_zero pCons_eq_0_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
poly bbq a = (0::'a)
degree bbq \<le> 1
bbq \<noteq> 0

goal (4 subgoals):
 1. finite (proots_within (fcompose bb q1 q2) A)
 2. finite (proots_within (fcompose p q1 q2) A)
 3. proots_within (fcompose bb q1 q2) A \<inter> proots_within (fcompose p q1 q2) A = {}
 4. 1 + card (proots_within (fcompose p q1 q2) A) = card (proots_within (fcompose bb q1 q2) A) + card (proots_within (fcompose p q1 q2) A)
[PROOF STEP]
show "finite (proots_within bbq A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (proots_within bbq A)
[PROOF STEP]
using \<open>bbq\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
bbq \<noteq> 0

goal (1 subgoal):
 1. finite (proots_within bbq A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (proots_within bbq A)

goal (3 subgoals):
 1. finite (proots_within (fcompose p q1 q2) A)
 2. proots_within (fcompose bb q1 q2) A \<inter> proots_within (fcompose p q1 q2) A = {}
 3. 1 + card (proots_within (fcompose p q1 q2) A) = card (proots_within (fcompose bb q1 q2) A) + card (proots_within (fcompose p q1 q2) A)
[PROOF STEP]
show "finite (proots_within pq A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (proots_within pq A)
[PROOF STEP]
unfolding pq_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (proots_within (fcompose p q1 q2) A)
[PROOF STEP]
by (metis \<open>a \<in> A\<close> \<open>p \<noteq> 0\<close> fcompose_nzero finite_proots infi nconst nzero poly_0 pq_def)
[PROOF STATE]
proof (state)
this:
finite (proots_within pq A)

goal (2 subgoals):
 1. proots_within (fcompose bb q1 q2) A \<inter> proots_within (fcompose p q1 q2) A = {}
 2. 1 + card (proots_within (fcompose p q1 q2) A) = card (proots_within (fcompose bb q1 q2) A) + card (proots_within (fcompose p q1 q2) A)
[PROOF STEP]
have bbq_a:"proots_within bbq A = {a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within bbq A = {a}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. proots_within bbq A = {a}
[PROOF STEP]
have "a\<in>proots_within bbq A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> proots_within bbq A
[PROOF STEP]
by (simp add: \<open>a \<in> A\<close> bbq_0)
[PROOF STATE]
proof (state)
this:
a \<in> proots_within bbq A

goal (1 subgoal):
 1. proots_within bbq A = {a}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a \<in> proots_within bbq A

goal (1 subgoal):
 1. proots_within bbq A = {a}
[PROOF STEP]
have "card (proots_within bbq A) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within bbq A) = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (proots_within bbq A) = 1
[PROOF STEP]
have "card (proots_within bbq A) \<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within bbq A) \<noteq> 0
[PROOF STEP]
using \<open>a\<in>proots_within bbq A\<close> \<open>finite (proots_within bbq A)\<close>
[PROOF STATE]
proof (prove)
using this:
a \<in> proots_within bbq A
finite (proots_within bbq A)

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

goal (1 subgoal):
 1. card (proots_within bbq A) = 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (proots_within bbq A) \<noteq> 0

goal (1 subgoal):
 1. card (proots_within bbq A) = 1
[PROOF STEP]
have "card (proots_within bbq A) \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (proots_within bbq A) \<le> 1
[PROOF STEP]
by (meson \<open>bbq \<noteq> 0\<close> card_proots_within_leq le_trans proots_count_leq_degree bbq_deg)
[PROOF STATE]
proof (state)
this:
card (proots_within bbq A) \<le> 1

goal (1 subgoal):
 1. card (proots_within bbq A) = 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card (proots_within bbq A) \<noteq> 0
card (proots_within bbq A) \<le> 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (proots_within bbq A) \<noteq> 0
card (proots_within bbq A) \<le> 1

goal (1 subgoal):
 1. card (proots_within bbq A) = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (proots_within bbq A) = 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card (proots_within bbq A) = 1

goal (1 subgoal):
 1. proots_within bbq A = {a}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a \<in> proots_within bbq A
card (proots_within bbq A) = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<in> proots_within bbq A
card (proots_within bbq A) = 1

goal (1 subgoal):
 1. proots_within bbq A = {a}
[PROOF STEP]
by (metis card_1_singletonE singletonD)
[PROOF STATE]
proof (state)
this:
proots_within bbq A = {a}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
proots_within bbq A = {a}

goal (2 subgoals):
 1. proots_within (fcompose bb q1 q2) A \<inter> proots_within (fcompose p q1 q2) A = {}
 2. 1 + card (proots_within (fcompose p q1 q2) A) = card (proots_within (fcompose bb q1 q2) A) + card (proots_within (fcompose p q1 q2) A)
[PROOF STEP]
show "proots_within (bbq) A \<inter> proots_within (pq) A = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_within bbq A \<inter> proots_within pq A = {}
[PROOF STEP]
using b_poly bbq_a fcompose_poly nzero pq_def that(2)
[PROOF STATE]
proof (prove)
using this:
b = poly q1 a / poly q2 a
proots_within bbq A = {a}
poly ?q2.0 ?x \<noteq> (0::?'a) \<Longrightarrow> poly ?p (poly ?q1.0 ?x / poly ?q2.0 ?x) = poly (fcompose ?p ?q1.0 ?q2.0) ?x / poly (?q2.0 ^ degree ?p) ?x
\<forall>x\<in>A. poly q2 x \<noteq> (0::'a)
pq = fcompose p q1 q2
poly p b \<noteq> (0::'a)

goal (1 subgoal):
 1. proots_within bbq A \<inter> proots_within pq A = {}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
proots_within bbq A \<inter> proots_within pq A = {}

goal (1 subgoal):
 1. 1 + card (proots_within (fcompose p q1 q2) A) = card (proots_within (fcompose bb q1 q2) A) + card (proots_within (fcompose p q1 q2) A)
[PROOF STEP]
show "1 + card (proots_within pq A) = card (proots_within bbq A) + card (proots_within pq A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + card (proots_within pq A) = card (proots_within bbq A) + card (proots_within pq A)
[PROOF STEP]
using bbq_a
[PROOF STATE]
proof (prove)
using this:
proots_within bbq A = {a}

goal (1 subgoal):
 1. 1 + card (proots_within pq A) = card (proots_within bbq A) + card (proots_within pq A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 + card (proots_within pq A) = card (proots_within bbq A) + card (proots_within pq A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
1 + card (proots_within (fcompose p q1 q2) A) = card (proots_within (fcompose (bb * p) q1 q2) A)

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (proots_within (bb * p) B) = card (proots_within (fcompose (bb * p) q1 q2) A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (proots_within (bb * p) B) = card (proots_within (fcompose (bb * p) q1 q2) A)

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
unfolding bb_def
[PROOF STATE]
proof (prove)
using this:
card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>b \<in> B; poly p b \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>p \<noteq> 0 \<Longrightarrow> card (proots_within p B) = card (proots_within (fcompose p q1 q2) A); [:- a, 1::'a:] * p \<noteq> 0\<rbrakk> \<Longrightarrow> card (proots_within ([:- a, 1::'a:] * p) B) = card (proots_within (fcompose ([:- a, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
b \<notin> B \<or> poly p b = (0::'a) \<Longrightarrow> card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
\<lbrakk>b \<in> B; poly p b \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
b \<notin> B \<or> poly p b = (0::'a) \<Longrightarrow> card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
\<lbrakk>b \<in> B; poly p b \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)

goal (1 subgoal):
 1. card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (proots_within ([:- b, 1::'a:] * p) B) = card (proots_within (fcompose ([:- b, 1::'a:] * p) q1 q2) A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in pseudo_hoop_lattice) sup_impl_inf:
  "(a \<squnion> b) l\<rightarrow> c = (a l\<rightarrow> c) \<sqinter> (b l\<rightarrow>c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<squnion> b) l\<rightarrow> c = (a l\<rightarrow> c) \<sqinter> (b l\<rightarrow> c)
[PROOF STEP]
apply (cut_tac A = "{a, b}" and a = "a \<squnion> b" and b = c in lemma_2_8_i)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a \<squnion> b \<in> supremum {a, b}
 2. (a \<squnion> b) l\<rightarrow> c \<in> infimum ((\<lambda>x. x l\<rightarrow> c) ` {a, b}) \<Longrightarrow> (a \<squnion> b) l\<rightarrow> c = (a l\<rightarrow> c) \<sqinter> (b l\<rightarrow> c)
[PROOF STEP]
by simp_all


[STATEMENT]
lemma bisim_compose_conv_relcomp:
  "case_prod (bisim_compose bisim12 bisim23) = (\<lambda>x. x \<in> relcomp (Collect (case_prod bisim12)) (Collect (case_prod bisim23)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). (bisim12 \<circ>\<^sub>B bisim23) x y) = (\<lambda>x. x \<in> {(x, y). bisim12 x y} O {(x, y). bisim23 x y})
[PROOF STEP]
by(auto simp add: relcomp_unfold)


[STATEMENT]
lemma length_ge_zero :" \<parallel>r\<parallel> \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> \<parallel>r\<parallel>
[PROOF STEP]
using Rep_real_int left.rep_eq right.rep_eq length_def
[PROOF STATE]
proof (prove)
using this:
Rep_real_int ?x \<in> {r. fst r \<le> snd r}
left ?x = fst (Rep_real_int ?x)
right ?x = snd (Rep_real_int ?x)
\<parallel>?r\<parallel> \<equiv> right ?r - left ?r

goal (1 subgoal):
 1. 0 \<le> \<parallel>r\<parallel>
[PROOF STEP]
by auto


[STATEMENT]
lemma cong_add:
  "[b = c] (mod a) \<Longrightarrow> [d = e] (mod a) \<Longrightarrow> [b + d = c + e] (mod a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>[b = c] (mod a); [d = e] (mod a)\<rbrakk> \<Longrightarrow> [b + d = c + e] (mod a)
[PROOF STEP]
by (auto simp add: cong_def intro: mod_add_cong)


[STATEMENT]
lemma zip_same: "((a,b) \<in> set (zip xs xs)) = (a \<in> set xs \<and> a = b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((a, b) \<in> set (zip xs xs)) = (a \<in> set xs \<and> a = b)
[PROOF STEP]
by(induct xs) auto


[STATEMENT]
lemma (in Module) same_together:"\<lbrakk>ideal R A; H \<subseteq> carrier M;
       s \<in> {j. j \<le> (n::nat)} \<rightarrow> A; f \<in> {j. j \<le> n} \<rightarrow> H\<rbrakk> \<Longrightarrow>
 \<exists>t \<in> {j. j \<le> (card (f ` {j. j \<le> (n::nat)}) - Suc 0)} \<rightarrow> A.
 \<exists>g \<in> {j. j \<le> (card (f ` {j. j \<le> n}) - Suc 0)} \<rightarrow> f ` {j. j \<le> n}.
       surj_to g {j. j \<le> (card (f ` {j. j \<le> n}) - Suc 0)} (f ` {j. j \<le> n}) \<and>
  \<Sigma>\<^sub>e M (\<lambda>j. s j \<cdot>\<^sub>s (f j)) n =
                  \<Sigma>\<^sub>e M (\<lambda>k. t k \<cdot>\<^sub>s (g k)) (card (f ` {j. j \<le> n}) - Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ideal R A; H \<subseteq> carrier M; s \<in> {j. j \<le> n} \<rightarrow> A; f \<in> {j. j \<le> n} \<rightarrow> H\<rbrakk> \<Longrightarrow> \<exists>t\<in>{j. j \<le> card (f ` {j. j \<le> n}) - Suc 0} \<rightarrow> A. \<exists>g\<in>{j. j \<le> card (f ` {j. j \<le> n}) - Suc 0} \<rightarrow> f ` {j. j \<le> n}. surj_to g {j. j \<le> card (f ` {j. j \<le> n}) - Suc 0} (f ` {j. j \<le> n}) \<and> \<Sigma>\<^sub>e M (\<lambda>j. s j \<cdot>\<^sub>s f j) n = \<Sigma>\<^sub>e M (\<lambda>k. t k \<cdot>\<^sub>s g k) (card (f ` {j. j \<le> n}) - Suc 0)
[PROOF STEP]
apply (simp add:same_togetherTr[of A H])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma convex_same_rel_interior_closure_straddle:
  fixes S :: "'n::euclidean_space set"
  shows "\<lbrakk>convex S; convex T\<rbrakk>
         \<Longrightarrow> rel_interior S = rel_interior T \<longleftrightarrow>
             rel_interior S \<subseteq> T \<and> T \<subseteq> closure S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>convex S; convex T\<rbrakk> \<Longrightarrow> (rel_interior S = rel_interior T) = (rel_interior S \<subseteq> T \<and> T \<subseteq> closure S)
[PROOF STEP]
by (simp add: closure_eq_between convex_same_rel_interior_closure)


[STATEMENT]
lemma inner_0_0[simp]: "inner 0 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner 0 0 = (0::'a)
[PROOF STEP]
unfolding inner_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. inner_field (0 $ i) (0 $ i)) = (0::'a)
[PROOF STEP]
by auto


[STATEMENT]
lemma (in comm_monoid_mult) prod_list_map_remove1:
  "x \<in> set xs \<Longrightarrow> prod_list (map f xs) = f x * prod_list (map f (remove1 x xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> set xs \<Longrightarrow> prod_list (map f xs) = f x * prod_list (map f (remove1 x xs))
[PROOF STEP]
by (induct xs) (auto simp add: ac_simps)


[STATEMENT]
lemma array_sum_aux: "l\<^sub>0\<le>l \<Longrightarrow> {l\<^sub>0..<l + 1} = insert l {l\<^sub>0..<l}" for l\<^sub>0 l :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l\<^sub>0 \<le> l \<Longrightarrow> {l\<^sub>0..<l + 1} = insert l {l\<^sub>0..<l}
[PROOF STEP]
by auto


[STATEMENT]
lemma smult_sum2: "smult m (\<Sum>i \<in> S. f i) = (\<Sum>i \<in> S. smult m (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult m (sum f S) = (\<Sum>i\<in>S. smult m (f i))
[PROOF STEP]
by (induct S rule: infinite_finite_induct, auto simp add: smult_add_right)


[STATEMENT]
lemma fps_distr:
  "((f::('a::type,'b::{join_semilattice_zero,semiring}) fps) + g) * h = (f * h) + (g * h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f + g) \<cdot> h = f \<cdot> h + g \<cdot> h
[PROOF STEP]
by (simp add: fps_ext fps_mult_image distrib_right sum_fun_sum)


[STATEMENT]
lemma \<pi>_at_top: "filterlim primes_pi at_top at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim \<pi> at_top at_top
[PROOF STEP]
proof (rule filterlim_at_top_mono)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. filterlim ?f at_top at_top
 2. \<forall>\<^sub>F x in at_top. ?f x \<le> \<pi> x
[PROOF STEP]
show "eventually (\<lambda>x. primes_pi x \<ge> 1 / 6 * (x / ln x)) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 1 / 6 * (x / ln x) \<le> \<pi> x
[PROOF STEP]
using eventually_gt_at_top[of 2]
[PROOF STATE]
proof (prove)
using this:
eventually ((<) (2::?'a1)) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 1 / 6 * (x / ln x) \<le> \<pi> x
[PROOF STEP]
by eventually_elim (intro less_imp_le \<pi>_lower_bound)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. 1 / 6 * (x / ln x) \<le> \<pi> x

goal (1 subgoal):
 1. LIM x at_top. 1 / 6 * (x / ln x) :> at_top
[PROOF STEP]
qed real_asymp


[STATEMENT]
lemma invertible_transpose_mult:
  fixes A::"real^'cols::{mod_type}^'rows::{mod_type}"
  assumes r: "rank A = ncols A"
  shows "invertible (transpose A ** A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible (Finite_Cartesian_Product.transpose A ** A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. invertible (Finite_Cartesian_Product.transpose A ** A)
[PROOF STEP]
have null_eq: "null_space A = null_space (transpose A ** A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. null_space A = null_space (Finite_Cartesian_Product.transpose A ** A)
[PROOF STEP]
proof (auto)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> null_space A \<Longrightarrow> x \<in> null_space (Finite_Cartesian_Product.transpose A ** A)
 2. \<And>x. x \<in> null_space (Finite_Cartesian_Product.transpose A ** A) \<Longrightarrow> x \<in> null_space A
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> null_space A \<Longrightarrow> x \<in> null_space (Finite_Cartesian_Product.transpose A ** A)
 2. \<And>x. x \<in> null_space (Finite_Cartesian_Product.transpose A ** A) \<Longrightarrow> x \<in> null_space A
[PROOF STEP]
assume x: "x \<in> null_space A"
[PROOF STATE]
proof (state)
this:
x \<in> null_space A

goal (2 subgoals):
 1. \<And>x. x \<in> null_space A \<Longrightarrow> x \<in> null_space (Finite_Cartesian_Product.transpose A ** A)
 2. \<And>x. x \<in> null_space (Finite_Cartesian_Product.transpose A ** A) \<Longrightarrow> x \<in> null_space A
[PROOF STEP]
show "x \<in> null_space (transpose A ** A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> null_space (Finite_Cartesian_Product.transpose A ** A)
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
x \<in> null_space A

goal (1 subgoal):
 1. x \<in> null_space (Finite_Cartesian_Product.transpose A ** A)
[PROOF STEP]
unfolding null_space_def
[PROOF STATE]
proof (prove)
using this:
x \<in> {x. A *v x = 0}

goal (1 subgoal):
 1. x \<in> {x. Finite_Cartesian_Product.transpose A ** A *v x = 0}
[PROOF STEP]
by (metis (lifting, full_types) matrix_vector_mul_assoc matrix_vector_mult_0_right mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
x \<in> null_space (Finite_Cartesian_Product.transpose A ** A)

goal (1 subgoal):
 1. \<And>x. x \<in> null_space (Finite_Cartesian_Product.transpose A ** A) \<Longrightarrow> x \<in> null_space A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> null_space (Finite_Cartesian_Product.transpose A ** A) \<Longrightarrow> x \<in> null_space A
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> null_space (Finite_Cartesian_Product.transpose A ** A) \<Longrightarrow> x \<in> null_space A
[PROOF STEP]
assume x: "x \<in> null_space (transpose A ** A)"
[PROOF STATE]
proof (state)
this:
x \<in> null_space (Finite_Cartesian_Product.transpose A ** A)

goal (1 subgoal):
 1. \<And>x. x \<in> null_space (Finite_Cartesian_Product.transpose A ** A) \<Longrightarrow> x \<in> null_space A
[PROOF STEP]
show "x \<in> null_space A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> null_space A
[PROOF STEP]
by (metis is_solution_def matrix_vector_mul_assoc mem_Collect_eq
        norm_equivalence null_space_eq_solution_set solution_set_def x)
[PROOF STATE]
proof (state)
this:
x \<in> null_space A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
null_space A = null_space (Finite_Cartesian_Product.transpose A ** A)

goal (1 subgoal):
 1. invertible (Finite_Cartesian_Product.transpose A ** A)
[PROOF STEP]
have "rank A = vec.dim (UNIV::(real^'cols::{mod_type}) set) - vec.dim (null_space A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A = vec.dim UNIV - vec.dim (null_space A)
[PROOF STEP]
using rank_nullity_theorem_matrices[of A]
[PROOF STATE]
proof (prove)
using this:
ncols A = vec.dim (null_space A) + vec.dim (col_space A)

goal (1 subgoal):
 1. rank A = vec.dim UNIV - vec.dim (null_space A)
[PROOF STEP]
unfolding rank_eq_dim_col_space'[of A, symmetric]
[PROOF STATE]
proof (prove)
using this:
ncols A = vec.dim (null_space A) + vec.dim (col_space A)

goal (1 subgoal):
 1. vec.dim (col_space A) = vec.dim UNIV - vec.dim (null_space A)
[PROOF STEP]
by (simp only: add.commute diff_add_inverse2 ncols_def vec_dim_card)
[PROOF STATE]
proof (state)
this:
rank A = vec.dim UNIV - vec.dim (null_space A)

goal (1 subgoal):
 1. invertible (Finite_Cartesian_Product.transpose A ** A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
rank A = vec.dim UNIV - vec.dim (null_space A)

goal (1 subgoal):
 1. invertible (Finite_Cartesian_Product.transpose A ** A)
[PROOF STEP]
have "... = vec.dim (UNIV::(real^'cols::{mod_type}) set) - vec.dim (null_space (transpose A ** A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.dim UNIV - vec.dim (null_space A) = vec.dim UNIV - vec.dim (null_space (Finite_Cartesian_Product.transpose A ** A))
[PROOF STEP]
unfolding null_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.dim UNIV - vec.dim (null_space (Finite_Cartesian_Product.transpose A ** A)) = vec.dim UNIV - vec.dim (null_space (Finite_Cartesian_Product.transpose A ** A))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
vec.dim UNIV - vec.dim (null_space A) = vec.dim UNIV - vec.dim (null_space (Finite_Cartesian_Product.transpose A ** A))

goal (1 subgoal):
 1. invertible (Finite_Cartesian_Product.transpose A ** A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vec.dim UNIV - vec.dim (null_space A) = vec.dim UNIV - vec.dim (null_space (Finite_Cartesian_Product.transpose A ** A))

goal (1 subgoal):
 1. invertible (Finite_Cartesian_Product.transpose A ** A)
[PROOF STEP]
have "... = rank (transpose A ** A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.dim UNIV - vec.dim (null_space (Finite_Cartesian_Product.transpose A ** A)) = rank (Finite_Cartesian_Product.transpose A ** A)
[PROOF STEP]
by (metis add.commute diff_add_inverse2 ncols_def rank_eq_dim_col_space
        rank_nullity_theorem_matrices vec_dim_card)
[PROOF STATE]
proof (state)
this:
vec.dim UNIV - vec.dim (null_space (Finite_Cartesian_Product.transpose A ** A)) = rank (Finite_Cartesian_Product.transpose A ** A)

goal (1 subgoal):
 1. invertible (Finite_Cartesian_Product.transpose A ** A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
rank A = rank (Finite_Cartesian_Product.transpose A ** A)
[PROOF STEP]
have r_A: "rank A = rank (transpose A ** A)"
[PROOF STATE]
proof (prove)
using this:
rank A = rank (Finite_Cartesian_Product.transpose A ** A)

goal (1 subgoal):
 1. rank A = rank (Finite_Cartesian_Product.transpose A ** A)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
rank A = rank (Finite_Cartesian_Product.transpose A ** A)

goal (1 subgoal):
 1. invertible (Finite_Cartesian_Product.transpose A ** A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible (Finite_Cartesian_Product.transpose A ** A)
[PROOF STEP]
using full_rank_implies_invertible r
[PROOF STATE]
proof (prove)
using this:
rank ?A = nrows ?A \<Longrightarrow> invertible ?A
rank A = ncols A

goal (1 subgoal):
 1. invertible (Finite_Cartesian_Product.transpose A ** A)
[PROOF STEP]
unfolding ncols_def nrows_def r_A
[PROOF STATE]
proof (prove)
using this:
rank ?A = CARD(?'n) \<Longrightarrow> invertible ?A
rank (Finite_Cartesian_Product.transpose A ** A) = CARD('cols)

goal (1 subgoal):
 1. invertible (Finite_Cartesian_Product.transpose A ** A)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
invertible (Finite_Cartesian_Product.transpose A ** A)

goal:
No subgoals!
[PROOF STEP]
qed