[STATEMENT]
lemma ennexp_strict_mono:
  "strict_mono ennexp"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. strict_mono ennexp
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. strict_mono ennexp
[PROOF STEP]
have "ennexp x < ennexp y" if "x < y" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennexp x < ennexp y
[PROOF STEP]
apply (cases x, cases y)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>r ra. \<lbrakk>x = ereal r; y = ereal ra\<rbrakk> \<Longrightarrow> ennexp x < ennexp y
 2. \<And>r. \<lbrakk>x = ereal r; y = \<infinity>\<rbrakk> \<Longrightarrow> ennexp x < ennexp y
 3. \<And>r. \<lbrakk>x = ereal r; y = - \<infinity>\<rbrakk> \<Longrightarrow> ennexp x < ennexp y
 4. x = \<infinity> \<Longrightarrow> ennexp x < ennexp y
 5. x = - \<infinity> \<Longrightarrow> ennexp x < ennexp y
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x < y

goal (5 subgoals):
 1. \<And>r ra. \<lbrakk>x = ereal r; y = ereal ra\<rbrakk> \<Longrightarrow> ennexp x < ennexp y
 2. \<And>r. \<lbrakk>x = ereal r; y = \<infinity>\<rbrakk> \<Longrightarrow> ennexp x < ennexp y
 3. \<And>r. \<lbrakk>x = ereal r; y = - \<infinity>\<rbrakk> \<Longrightarrow> ennexp x < ennexp y
 4. x = \<infinity> \<Longrightarrow> ennexp x < ennexp y
 5. x = - \<infinity> \<Longrightarrow> ennexp x < ennexp y
[PROOF STEP]
apply (auto simp add: ennreal_less_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x = - \<infinity>; y \<noteq> - \<infinity>\<rbrakk> \<Longrightarrow> 0 < ennexp y
[PROOF STEP]
by (cases y, auto)
[PROOF STATE]
proof (state)
this:
?x < ?y \<Longrightarrow> ennexp ?x < ennexp ?y

goal (1 subgoal):
 1. strict_mono ennexp
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x < ?y \<Longrightarrow> ennexp ?x < ennexp ?y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?x < ?y \<Longrightarrow> ennexp ?x < ennexp ?y

goal (1 subgoal):
 1. strict_mono ennexp
[PROOF STEP]
unfolding strict_mono_def
[PROOF STATE]
proof (prove)
using this:
?x < ?y \<Longrightarrow> ennexp ?x < ennexp ?y

goal (1 subgoal):
 1. \<forall>x y. x < y \<longrightarrow> ennexp x < ennexp y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
strict_mono ennexp

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_at_topI:
  "(f \<longlongrightarrow> l) at_top" if "\<And>e. 0 < e \<Longrightarrow> \<exists>x0. \<forall>x\<ge>x0. dist (f x) l < e"
for f::"'a::linorder_topology \<Rightarrow> 'b::metric_space"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> l) at_top
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
0 < ?e \<Longrightarrow> \<exists>x0. \<forall>x\<ge>x0. dist (f x) l < ?e

goal (1 subgoal):
 1. (f \<longlongrightarrow> l) at_top
[PROOF STEP]
apply (intro tendstoI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<And>e. 0 < e \<Longrightarrow> \<exists>x0. \<forall>x\<ge>x0. dist (f x) l < e; 0 < e\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in at_top. dist (f x) l < e
[PROOF STEP]
unfolding eventually_at_top_linorder
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<And>e. 0 < e \<Longrightarrow> \<exists>x0. \<forall>x\<ge>x0. dist (f x) l < e; 0 < e\<rbrakk> \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. dist (f n) l < e
[PROOF STEP]
by auto


[STATEMENT]
lemma frontier_of_subtopology_subset:
  "U \<inter> (subtopology X U) frontier_of S \<subseteq> (X frontier_of S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U \<inter> subtopology X U frontier_of S \<subseteq> X frontier_of S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. U \<inter> subtopology X U frontier_of S \<subseteq> X frontier_of S
[PROOF STEP]
have "U \<inter> X interior_of S - subtopology X U interior_of S = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U \<inter> X interior_of S - subtopology X U interior_of S = {}
[PROOF STEP]
by (simp add: interior_of_subtopology_subset)
[PROOF STATE]
proof (state)
this:
U \<inter> X interior_of S - subtopology X U interior_of S = {}

goal (1 subgoal):
 1. U \<inter> subtopology X U frontier_of S \<subseteq> X frontier_of S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
U \<inter> X interior_of S - subtopology X U interior_of S = {}

goal (1 subgoal):
 1. U \<inter> subtopology X U frontier_of S \<subseteq> X frontier_of S
[PROOF STEP]
have "X closure_of S \<inter> subtopology X U closure_of S = subtopology X U closure_of S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X closure_of S \<inter> subtopology X U closure_of S = subtopology X U closure_of S
[PROOF STEP]
by (meson closure_of_subtopology_subset inf.absorb_iff2)
[PROOF STATE]
proof (state)
this:
X closure_of S \<inter> subtopology X U closure_of S = subtopology X U closure_of S

goal (1 subgoal):
 1. U \<inter> subtopology X U frontier_of S \<subseteq> X frontier_of S
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
U \<inter> X interior_of S - subtopology X U interior_of S = {}
X closure_of S \<inter> subtopology X U closure_of S = subtopology X U closure_of S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
U \<inter> X interior_of S - subtopology X U interior_of S = {}
X closure_of S \<inter> subtopology X U closure_of S = subtopology X U closure_of S

goal (1 subgoal):
 1. U \<inter> subtopology X U frontier_of S \<subseteq> X frontier_of S
[PROOF STEP]
unfolding frontier_of_def
[PROOF STATE]
proof (prove)
using this:
U \<inter> X interior_of S - subtopology X U interior_of S = {}
X closure_of S \<inter> subtopology X U closure_of S = subtopology X U closure_of S

goal (1 subgoal):
 1. U \<inter> (subtopology X U closure_of S - subtopology X U interior_of S) \<subseteq> X closure_of S - X interior_of S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
U \<inter> subtopology X U frontier_of S \<subseteq> X frontier_of S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closed_Times: "closed S \<Longrightarrow> closed T \<Longrightarrow> closed (S \<times> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>closed S; closed T\<rbrakk> \<Longrightarrow> closed (S \<times> T)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>closed S; closed T\<rbrakk> \<Longrightarrow> closed (S \<times> T)
[PROOF STEP]
have "S \<times> T = (fst -` S) \<inter> (snd -` T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<times> T = fst -` S \<inter> snd -` T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S \<times> T = fst -` S \<inter> snd -` T

goal (1 subgoal):
 1. \<lbrakk>closed S; closed T\<rbrakk> \<Longrightarrow> closed (S \<times> T)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<times> T = fst -` S \<inter> snd -` T
[PROOF STEP]
show "closed S \<Longrightarrow> closed T \<Longrightarrow> closed (S \<times> T)"
[PROOF STATE]
proof (prove)
using this:
S \<times> T = fst -` S \<inter> snd -` T

goal (1 subgoal):
 1. \<lbrakk>closed S; closed T\<rbrakk> \<Longrightarrow> closed (S \<times> T)
[PROOF STEP]
by (simp add: closed_vimage_fst closed_vimage_snd closed_Int)
[PROOF STATE]
proof (state)
this:
\<lbrakk>closed S; closed T\<rbrakk> \<Longrightarrow> closed (S \<times> T)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subprob_count_space_density_le_1:
  assumes "has_subprob_density M (count_space A) f" "x \<in> A"
  shows "f x \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x \<le> 1
[PROOF STEP]
proof (cases "f x > 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < f x \<Longrightarrow> f x \<le> 1
 2. \<not> 0 < f x \<Longrightarrow> f x \<le> 1
[PROOF STEP]
assume "f x > 0"
[PROOF STATE]
proof (state)
this:
0 < f x

goal (2 subgoals):
 1. 0 < f x \<Longrightarrow> f x \<le> 1
 2. \<not> 0 < f x \<Longrightarrow> f x \<le> 1
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
has_subprob_density M (count_space A) f
x \<in> A
[PROOF STEP]
interpret subprob_space M
[PROOF STATE]
proof (prove)
using this:
has_subprob_density M (count_space A) f
x \<in> A

goal (1 subgoal):
 1. subprob_space M
[PROOF STEP]
by (intro has_subprob_densityD)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < f x \<Longrightarrow> f x \<le> 1
 2. \<not> 0 < f x \<Longrightarrow> f x \<le> 1
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
has_subprob_density M (count_space A) f
x \<in> A
[PROOF STEP]
have M: "M = density (count_space A) f"
[PROOF STATE]
proof (prove)
using this:
has_subprob_density M (count_space A) f
x \<in> A

goal (1 subgoal):
 1. M = density (count_space A) f
[PROOF STEP]
by (intro has_subprob_densityD)
[PROOF STATE]
proof (state)
this:
M = density (count_space A) f

goal (2 subgoals):
 1. 0 < f x \<Longrightarrow> f x \<le> 1
 2. \<not> 0 < f x \<Longrightarrow> f x \<le> 1
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
has_subprob_density M (count_space A) f
x \<in> A
[PROOF STEP]
have "f x = emeasure M {x}"
[PROOF STATE]
proof (prove)
using this:
has_subprob_density M (count_space A) f
x \<in> A

goal (1 subgoal):
 1. f x = emeasure M {x}
[PROOF STEP]
by (intro emeasure_count_space_density_singleton[symmetric])
       (auto simp: has_subprob_density_def)
[PROOF STATE]
proof (state)
this:
f x = emeasure M {x}

goal (2 subgoals):
 1. 0 < f x \<Longrightarrow> f x \<le> 1
 2. \<not> 0 < f x \<Longrightarrow> f x \<le> 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f x = emeasure M {x}

goal (2 subgoals):
 1. 0 < f x \<Longrightarrow> f x \<le> 1
 2. \<not> 0 < f x \<Longrightarrow> f x \<le> 1
[PROOF STEP]
have "... \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M {x} \<le> 1
[PROOF STEP]
by (rule subprob_emeasure_le_1)
[PROOF STATE]
proof (state)
this:
emeasure M {x} \<le> 1

goal (2 subgoals):
 1. 0 < f x \<Longrightarrow> f x \<le> 1
 2. \<not> 0 < f x \<Longrightarrow> f x \<le> 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f x \<le> 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f x \<le> 1

goal (1 subgoal):
 1. f x \<le> 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
f x \<le> 1

goal (1 subgoal):
 1. \<not> 0 < f x \<Longrightarrow> f x \<le> 1
[PROOF STEP]
qed (auto simp: not_less intro: order.trans[of _ 0 1])


[STATEMENT]
lemma Stone_Weierstrass_real_polynomial_function:
  fixes f :: "'a::euclidean_space \<Rightarrow> real"
  assumes "compact S" "continuous_on S f" "0 < e"
  obtains g where "real_polynomial_function g" "\<And>x. x \<in> S \<Longrightarrow> \<bar>f x - g x\<bar> < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. \<lbrakk>real_polynomial_function g; \<And>x. x \<in> S \<Longrightarrow> \<bar>f x - g x\<bar> < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>g. \<lbrakk>real_polynomial_function g; \<And>x. x \<in> S \<Longrightarrow> \<bar>f x - g x\<bar> < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
interpret PR: function_ring_on "Collect real_polynomial_function"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. function_ring_on (Collect real_polynomial_function) S
[PROOF STEP]
proof unfold_locales
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. compact S
 2. \<And>f. f \<in> Collect real_polynomial_function \<Longrightarrow> continuous_on S f
 3. \<And>f g. \<lbrakk>f \<in> Collect real_polynomial_function; g \<in> Collect real_polynomial_function\<rbrakk> \<Longrightarrow> (\<lambda>x. f x + g x) \<in> Collect real_polynomial_function
 4. \<And>f g. \<lbrakk>f \<in> Collect real_polynomial_function; g \<in> Collect real_polynomial_function\<rbrakk> \<Longrightarrow> (\<lambda>x. f x * g x) \<in> Collect real_polynomial_function
 5. \<And>c. (\<lambda>_. c) \<in> Collect real_polynomial_function
 6. \<And>x y. \<lbrakk>x \<in> S; y \<in> S; x \<noteq> y\<rbrakk> \<Longrightarrow> \<exists>f\<in>Collect real_polynomial_function. f x \<noteq> f y
[PROOF STEP]
qed (use assms continuous_on_polymonial_function real_polynomial_function_eq
       in \<open>auto intro: real_polynomial_function_separable\<close>)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>g. \<lbrakk>real_polynomial_function g; \<And>x. x \<in> S \<Longrightarrow> \<bar>f x - g x\<bar> < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. thesis
[PROOF STEP]
using PR.Stone_Weierstrass_basic [OF \<open>continuous_on S f\<close> \<open>0 < e\<close>] that
[PROOF STATE]
proof (prove)
using this:
\<exists>g\<in>Collect real_polynomial_function. \<forall>x\<in>S. \<bar>f x - g x\<bar> < e
\<lbrakk>real_polynomial_function ?g; \<And>x. x \<in> S \<Longrightarrow> \<bar>f x - ?g x\<bar> < e\<rbrakk> \<Longrightarrow> thesis

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dickson_less_p_trans:
  assumes "dickson_less_p d m p q" and "dickson_less_p d m q r"
  shows "dickson_less_p d m p r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dickson_less_p d m p r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dickson_less_p d m p q
dickson_less_p d m q r

goal (1 subgoal):
 1. dickson_less_p d m p r
[PROOF STEP]
by (auto simp add: dickson_less_p_def)


[STATEMENT]
lemma le_lemma:
  "\<And>x y. rec_exec rec_le [x, y] = (if (x \<le> y) then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. rec_exec rec_le [x, y] = (if x \<le> y then 1 else 0)
[PROOF STEP]
by(auto simp: rec_le_def rec_exec.simps)


[STATEMENT]
lemma in_derived_set_of:
   "x \<in> X derived_set_of S \<longleftrightarrow> x \<in> topspace X \<and> (\<forall>T. x \<in> T \<and> openin X T \<longrightarrow> (\<exists>y\<noteq>x. y \<in> S \<and> y \<in> T))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> X derived_set_of S) = (x \<in> topspace X \<and> (\<forall>T. x \<in> T \<and> openin X T \<longrightarrow> (\<exists>y. y \<noteq> x \<and> y \<in> S \<and> y \<in> T)))
[PROOF STEP]
by (simp add: derived_set_of_def)


[STATEMENT]
lemma prop_nested_in_set: "D \<in> P C \<Longrightarrow> C \<in> {C. \<forall>D \<in> P C. A D \<or> B C D} \<Longrightarrow> A D \<or> B C D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>D \<in> P C; C \<in> {C. \<forall>D\<in>P C. A D \<or> B C D}\<rbrakk> \<Longrightarrow> A D \<or> B C D
[PROOF STEP]
by blast


[STATEMENT]
lemma abs_conv_abscissa_diff_le:
  "abs_conv_abscissa (f - g :: 'a :: dirichlet_series fds) \<le>
     max (abs_conv_abscissa f) (abs_conv_abscissa g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abs_conv_abscissa (f - g) \<le> max (abs_conv_abscissa f) (abs_conv_abscissa g)
[PROOF STEP]
using abs_conv_abscissa_add_le[of f "-g"]
[PROOF STATE]
proof (prove)
using this:
abs_conv_abscissa (f + - g) \<le> max (abs_conv_abscissa f) (abs_conv_abscissa (- g))

goal (1 subgoal):
 1. abs_conv_abscissa (f - g) \<le> max (abs_conv_abscissa f) (abs_conv_abscissa g)
[PROOF STEP]
by simp


[STATEMENT]
lemma iall_conj_distrib2: "
  (\<box> t1 I1. \<box> t2 (I2 t1). P t1 t2 \<and> Q t1 t2) =
  ((\<box> t1 I1. \<box> t2 (I2 t1). P t1 t2) \<and> (\<box> t1 I1. \<box> t2 (I2 t1). Q t1 t2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<box> t1 I1. \<box> t2 I2 t1. P t1 t2 \<and> Q t1 t2) = ((\<box> t1 I1. \<box> t2 I2 t1. P t1 t2) \<and> (\<box> t1 I1. \<box> t2 I2 t1. Q t1 t2))
[PROOF STEP]
by blast


[STATEMENT]
lemma poly_poly_poly_y_x [simp]:
  fixes p :: "'a :: idom poly poly"
  shows "poly (poly (poly_y_x p) [:y:]) x = poly (poly p [:x:]) y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (poly (poly_y_x p) [:y:]) x = poly (poly p [:x:]) y
[PROOF STEP]
proof (induction p)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. poly (poly (poly_y_x 0) [:y:]) x = poly (poly 0 [:x:]) y
 2. \<And>a p. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; poly (poly (poly_y_x p) [:y:]) x = poly (poly p [:x:]) y\<rbrakk> \<Longrightarrow> poly (poly (poly_y_x (pCons a p)) [:y:]) x = poly (poly (pCons a p) [:x:]) y
[PROOF STEP]
case (pCons a p)
[PROOF STATE]
proof (state)
this:
a \<noteq> 0 \<or> p \<noteq> 0
poly (poly (poly_y_x p) [:y:]) x = poly (poly p [:x:]) y

goal (2 subgoals):
 1. poly (poly (poly_y_x 0) [:y:]) x = poly (poly 0 [:x:]) y
 2. \<And>a p. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; poly (poly (poly_y_x p) [:y:]) x = poly (poly p [:x:]) y\<rbrakk> \<Longrightarrow> poly (poly (poly_y_x (pCons a p)) [:y:]) x = poly (poly (pCons a p) [:x:]) y
[PROOF STEP]
have "poly (poly (poly_y_x (pCons a p)) [:y:]) x =
          poly a y + poly (poly (map_poly (pCons 0) (poly_y_x p)) [:y:]) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (poly (poly_y_x (pCons a p)) [:y:]) x = poly a y + poly (poly (map_poly (pCons (0::'a)) (poly_y_x p)) [:y:]) x
[PROOF STEP]
by (simp add: poly_y_x_pCons eval_poly_def)
[PROOF STATE]
proof (state)
this:
poly (poly (poly_y_x (pCons a p)) [:y:]) x = poly a y + poly (poly (map_poly (pCons (0::'a)) (poly_y_x p)) [:y:]) x

goal (2 subgoals):
 1. poly (poly (poly_y_x 0) [:y:]) x = poly (poly 0 [:x:]) y
 2. \<And>a p. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; poly (poly (poly_y_x p) [:y:]) x = poly (poly p [:x:]) y\<rbrakk> \<Longrightarrow> poly (poly (poly_y_x (pCons a p)) [:y:]) x = poly (poly (pCons a p) [:x:]) y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly (poly (poly_y_x (pCons a p)) [:y:]) x = poly a y + poly (poly (map_poly (pCons (0::'a)) (poly_y_x p)) [:y:]) x

goal (2 subgoals):
 1. poly (poly (poly_y_x 0) [:y:]) x = poly (poly 0 [:x:]) y
 2. \<And>a p. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; poly (poly (poly_y_x p) [:y:]) x = poly (poly p [:x:]) y\<rbrakk> \<Longrightarrow> poly (poly (poly_y_x (pCons a p)) [:y:]) x = poly (poly (pCons a p) [:x:]) y
[PROOF STEP]
have "pCons 0 = (\<lambda>p::'a poly. Polynomial.monom 1 1 * p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pCons (0::'a) = (*) (Polynomial.monom (1::'a) 1)
[PROOF STEP]
by (simp add: Polynomial.monom_altdef)
[PROOF STATE]
proof (state)
this:
pCons (0::'a) = (*) (Polynomial.monom (1::'a) 1)

goal (2 subgoals):
 1. poly (poly (poly_y_x 0) [:y:]) x = poly (poly 0 [:x:]) y
 2. \<And>a p. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; poly (poly (poly_y_x p) [:y:]) x = poly (poly p [:x:]) y\<rbrakk> \<Longrightarrow> poly (poly (poly_y_x (pCons a p)) [:y:]) x = poly (poly (pCons a p) [:x:]) y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pCons (0::'a) = (*) (Polynomial.monom (1::'a) 1)

goal (2 subgoals):
 1. poly (poly (poly_y_x 0) [:y:]) x = poly (poly 0 [:x:]) y
 2. \<And>a p. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; poly (poly (poly_y_x p) [:y:]) x = poly (poly p [:x:]) y\<rbrakk> \<Longrightarrow> poly (poly (poly_y_x (pCons a p)) [:y:]) x = poly (poly (pCons a p) [:x:]) y
[PROOF STEP]
have "map_poly \<dots> (poly_y_x p) = Polynomial.smult (Polynomial.monom 1 1) (poly_y_x p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly ((*) (Polynomial.monom (1::'a) 1)) (poly_y_x p) = Polynomial.smult (Polynomial.monom (1::'a) 1) (poly_y_x p)
[PROOF STEP]
by (simp add: smult_conv_map_poly)
[PROOF STATE]
proof (state)
this:
map_poly ((*) (Polynomial.monom (1::'a) 1)) (poly_y_x p) = Polynomial.smult (Polynomial.monom (1::'a) 1) (poly_y_x p)

goal (2 subgoals):
 1. poly (poly (poly_y_x 0) [:y:]) x = poly (poly 0 [:x:]) y
 2. \<And>a p. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; poly (poly (poly_y_x p) [:y:]) x = poly (poly p [:x:]) y\<rbrakk> \<Longrightarrow> poly (poly (poly_y_x (pCons a p)) [:y:]) x = poly (poly (pCons a p) [:x:]) y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map_poly ((*) (Polynomial.monom (1::'a) 1)) (poly_y_x p) = Polynomial.smult (Polynomial.monom (1::'a) 1) (poly_y_x p)

goal (2 subgoals):
 1. poly (poly (poly_y_x 0) [:y:]) x = poly (poly 0 [:x:]) y
 2. \<And>a p. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; poly (poly (poly_y_x p) [:y:]) x = poly (poly p [:x:]) y\<rbrakk> \<Longrightarrow> poly (poly (poly_y_x (pCons a p)) [:y:]) x = poly (poly (pCons a p) [:x:]) y
[PROOF STEP]
have "poly \<dots> [:y:] = Polynomial.monom 1 1 * poly (poly_y_x p) [:y:]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (Polynomial.smult (Polynomial.monom (1::'a) 1) (poly_y_x p)) [:y:] = Polynomial.monom (1::'a) 1 * poly (poly_y_x p) [:y:]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly (Polynomial.smult (Polynomial.monom (1::'a) 1) (poly_y_x p)) [:y:] = Polynomial.monom (1::'a) 1 * poly (poly_y_x p) [:y:]

goal (2 subgoals):
 1. poly (poly (poly_y_x 0) [:y:]) x = poly (poly 0 [:x:]) y
 2. \<And>a p. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; poly (poly (poly_y_x p) [:y:]) x = poly (poly p [:x:]) y\<rbrakk> \<Longrightarrow> poly (poly (poly_y_x (pCons a p)) [:y:]) x = poly (poly (pCons a p) [:x:]) y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly (Polynomial.smult (Polynomial.monom (1::'a) 1) (poly_y_x p)) [:y:] = Polynomial.monom (1::'a) 1 * poly (poly_y_x p) [:y:]

goal (2 subgoals):
 1. poly (poly (poly_y_x 0) [:y:]) x = poly (poly 0 [:x:]) y
 2. \<And>a p. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; poly (poly (poly_y_x p) [:y:]) x = poly (poly p [:x:]) y\<rbrakk> \<Longrightarrow> poly (poly (poly_y_x (pCons a p)) [:y:]) x = poly (poly (pCons a p) [:x:]) y
[PROOF STEP]
have "poly a y + poly \<dots> x = poly (poly (pCons a p) [:x:]) y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly a y + poly (Polynomial.monom (1::'a) 1 * poly (poly_y_x p) [:y:]) x = poly (poly (pCons a p) [:x:]) y
[PROOF STEP]
by (simp add: pCons poly_monom)
[PROOF STATE]
proof (state)
this:
poly a y + poly (Polynomial.monom (1::'a) 1 * poly (poly_y_x p) [:y:]) x = poly (poly (pCons a p) [:x:]) y

goal (2 subgoals):
 1. poly (poly (poly_y_x 0) [:y:]) x = poly (poly 0 [:x:]) y
 2. \<And>a p. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; poly (poly (poly_y_x p) [:y:]) x = poly (poly p [:x:]) y\<rbrakk> \<Longrightarrow> poly (poly (poly_y_x (pCons a p)) [:y:]) x = poly (poly (pCons a p) [:x:]) y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
poly (poly (poly_y_x (pCons a p)) [:y:]) x = poly (poly (pCons a p) [:x:]) y
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
poly (poly (poly_y_x (pCons a p)) [:y:]) x = poly (poly (pCons a p) [:x:]) y

goal (1 subgoal):
 1. poly (poly (poly_y_x (pCons a p)) [:y:]) x = poly (poly (pCons a p) [:x:]) y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
poly (poly (poly_y_x (pCons a p)) [:y:]) x = poly (poly (pCons a p) [:x:]) y

goal (1 subgoal):
 1. poly (poly (poly_y_x 0) [:y:]) x = poly (poly 0 [:x:]) y
[PROOF STEP]
qed auto


[STATEMENT]
lemma Qp_funs_m_inv:
  assumes "x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
  assumes "f \<in> (Units (Fun\<^bsub>n\<^esub> Q\<^sub>p))"
  shows "(inv\<^bsub>Fun\<^bsub>n\<^esub> Q\<^sub>p\<^esub> f) x = inv\<^bsub>Q\<^sub>p\<^esub> (f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (inv\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f) x = inv f x
[PROOF STEP]
using Qp_funs_Units_memI(2)  Qp_funs_Units_memE(3) assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f \<in> carrier (function_ring (carrier (Q\<^sub>p\<^bsup>?n\<^esup>)) Q\<^sub>p); \<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>?n\<^esup>) \<Longrightarrow> ?f x \<noteq> \<zero>\<rbrakk> \<Longrightarrow> inv\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>?n\<^esup>)) Q\<^sub>p\<^esub> ?f = (\<lambda>x\<in>carrier (Q\<^sub>p\<^bsup>?n\<^esup>). inv ?f x)
\<lbrakk>?f \<in> Units (function_ring (carrier (Q\<^sub>p\<^bsup>?n\<^esup>)) Q\<^sub>p); ?x \<in> carrier (Q\<^sub>p\<^bsup>?n\<^esup>)\<rbrakk> \<Longrightarrow> ?f ?x \<noteq> \<zero>
x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
f \<in> Units (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)

goal (1 subgoal):
 1. (inv\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f) x = inv f x
[PROOF STEP]
by (metis (no_types, lifting) Qp_funs_is_monoid monoid.Units_closed restrict_apply)


[STATEMENT]
lemma (in VectorSpace) basis_im_defines_hom :
  fixes   smult'   :: "'f \<Rightarrow> 'w::ab_group_add \<Rightarrow> 'w" (infixr "\<star>" 70)
  and     lincomb' :: "'f list \<Rightarrow> 'w list \<Rightarrow> 'w" (infixr "\<bullet>\<star>" 70)
  defines lincomb'  : "lincomb' \<equiv> scalar_mult.lincomb smult'"
  assumes VSpW      : "VectorSpace smult' W"
  and     basisV    : "basis_for V vs"
  and     basisV_im : "set ws \<subseteq> W" "length ws = length vs"
  shows   "\<exists>! T. VectorSpaceHom smult V smult' T \<and> map T vs = ws"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!T. VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws
[PROOF STEP]
proof (rule ex_ex1I)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>T. VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws
 2. \<And>T y. \<lbrakk>VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws; VectorSpaceHom (\<cdot>) V (\<star>) y \<and> map y vs = ws\<rbrakk> \<Longrightarrow> T = y
[PROOF STEP]
define T where "T = restrict0 (\<lambda>v. (THE as. length as = length vs \<and> v = as \<bullet>\<cdot> vs) \<bullet>\<star> ws) V"
[PROOF STATE]
proof (state)
this:
T = (\<lambda>a. if a \<in> V then (THE as. length as = length vs \<and> a = as \<bullet>\<cdot> vs) \<bullet>\<star> ws else (0::'w))

goal (2 subgoals):
 1. \<exists>T. VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws
 2. \<And>T y. \<lbrakk>VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws; VectorSpaceHom (\<cdot>) V (\<star>) y \<and> map y vs = ws\<rbrakk> \<Longrightarrow> T = y
[PROOF STEP]
have "VectorSpaceHom (\<cdot>) V smult' T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. VectorSpaceHom (\<cdot>) V (\<star>) T
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>g g'. \<lbrakk>g \<in> V; g' \<in> V\<rbrakk> \<Longrightarrow> T (g + g') = T g + T g'
 2. supp T \<subseteq> V
 3. \<And>r m. \<lbrakk>r \<in> UNIV; m \<in> V\<rbrakk> \<Longrightarrow> T (r \<cdot> m) = r \<star> T m
[PROOF STEP]
fix v v'
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>g g'. \<lbrakk>g \<in> V; g' \<in> V\<rbrakk> \<Longrightarrow> T (g + g') = T g + T g'
 2. supp T \<subseteq> V
 3. \<And>r m. \<lbrakk>r \<in> UNIV; m \<in> V\<rbrakk> \<Longrightarrow> T (r \<cdot> m) = r \<star> T m
[PROOF STEP]
assume vv': "v \<in> V" "v' \<in> V"
[PROOF STATE]
proof (state)
this:
v \<in> V
v' \<in> V

goal (3 subgoals):
 1. \<And>g g'. \<lbrakk>g \<in> V; g' \<in> V\<rbrakk> \<Longrightarrow> T (g + g') = T g + T g'
 2. supp T \<subseteq> V
 3. \<And>r m. \<lbrakk>r \<in> UNIV; m \<in> V\<rbrakk> \<Longrightarrow> T (r \<cdot> m) = r \<star> T m
[PROOF STEP]
with T_def lincomb' basisV basisV_im(1)
[PROOF STATE]
proof (chain)
picking this:
T = (\<lambda>a. if a \<in> V then (THE as. length as = length vs \<and> a = as \<bullet>\<cdot> vs) \<bullet>\<star> ws else (0::'w))
(\<bullet>\<star>) \<equiv> scalar_mult.lincomb (\<star>)
set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs
set ws \<subseteq> W
v \<in> V
v' \<in> V
[PROOF STEP]
show "T (v + v') = T v + T v'"
[PROOF STATE]
proof (prove)
using this:
T = (\<lambda>a. if a \<in> V then (THE as. length as = length vs \<and> a = as \<bullet>\<cdot> vs) \<bullet>\<star> ws else (0::'w))
(\<bullet>\<star>) \<equiv> scalar_mult.lincomb (\<star>)
set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs
set ws \<subseteq> W
v \<in> V
v' \<in> V

goal (1 subgoal):
 1. T (v + v') = T v + T v'
[PROOF STEP]
using basis_for_obtain_unique_scalars theI'[
              of "\<lambda>ds. length ds = length vs \<and> v = ds \<bullet>\<cdot> vs"
            ]
            theI'[of "\<lambda>ds. length ds = length vs \<and> v' = ds \<bullet>\<cdot> vs"] add_closed
            add_unique_scalars VectorSpace.lincomb_sum[OF VSpW]
[PROOF STATE]
proof (prove)
using this:
T = (\<lambda>a. if a \<in> V then (THE as. length as = length vs \<and> a = as \<bullet>\<cdot> vs) \<bullet>\<star> ws else (0::'w))
(\<bullet>\<star>) \<equiv> scalar_mult.lincomb (\<star>)
set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs
set ws \<subseteq> W
v \<in> V
v' \<in> V
\<lbrakk>set ?vs \<subseteq> V \<and> V = RSpan ?vs \<and> R_lin_independent ?vs; ?v \<in> V\<rbrakk> \<Longrightarrow> \<exists>!as. length as = length ?vs \<and> ?v = as \<bullet>\<cdot> ?vs
\<exists>!x. length x = length vs \<and> v = x \<bullet>\<cdot> vs \<Longrightarrow> length (THE x. length x = length vs \<and> v = x \<bullet>\<cdot> vs) = length vs \<and> v = (THE x. length x = length vs \<and> v = x \<bullet>\<cdot> vs) \<bullet>\<cdot> vs
\<exists>!x. length x = length vs \<and> v' = x \<bullet>\<cdot> vs \<Longrightarrow> length (THE x. length x = length vs \<and> v' = x \<bullet>\<cdot> vs) = length vs \<and> v' = (THE x. length x = length vs \<and> v' = x \<bullet>\<cdot> vs) \<bullet>\<cdot> vs
\<lbrakk>?g \<in> V; ?h \<in> V\<rbrakk> \<Longrightarrow> ?g + ?h \<in> V
\<lbrakk>set ?vs \<subseteq> V \<and> V = RSpan ?vs \<and> R_lin_independent ?vs; ?v \<in> V; ?v' \<in> V\<rbrakk> \<Longrightarrow> (THE ds. length ds = length ?vs \<and> ?v + ?v' = ds \<bullet>\<cdot> ?vs) = map2 (+) (THE ds. length ds = length ?vs \<and> ?v = ds \<bullet>\<cdot> ?vs) (THE ds. length ds = length ?vs \<and> ?v' = ds \<bullet>\<cdot> ?vs)
\<lbrakk>set ?rs \<subseteq> UNIV; set ?ss \<subseteq> UNIV; set ?ms \<subseteq> W; length ?rs \<le> length ?ss\<rbrakk> \<Longrightarrow> scalar_mult.lincomb (\<star>) ?rs ?ms + scalar_mult.lincomb (\<star>) ?ss ?ms = scalar_mult.lincomb (\<star>) (map2 (+) ?rs ?ss @ drop (length ?rs) ?ss) ?ms

goal (1 subgoal):
 1. T (v + v') = T v + T v'
[PROOF STEP]
by    auto
[PROOF STATE]
proof (state)
this:
T (v + v') = T v + T v'

goal (2 subgoals):
 1. supp T \<subseteq> V
 2. \<And>r m. \<lbrakk>r \<in> UNIV; m \<in> V\<rbrakk> \<Longrightarrow> T (r \<cdot> m) = r \<star> T m
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. supp T \<subseteq> V
 2. \<And>r m. \<lbrakk>r \<in> UNIV; m \<in> V\<rbrakk> \<Longrightarrow> T (r \<cdot> m) = r \<star> T m
[PROOF STEP]
from T_def
[PROOF STATE]
proof (chain)
picking this:
T = (\<lambda>a. if a \<in> V then (THE as. length as = length vs \<and> a = as \<bullet>\<cdot> vs) \<bullet>\<star> ws else (0::'w))
[PROOF STEP]
show "supp T \<subseteq> V"
[PROOF STATE]
proof (prove)
using this:
T = (\<lambda>a. if a \<in> V then (THE as. length as = length vs \<and> a = as \<bullet>\<cdot> vs) \<bullet>\<star> ws else (0::'w))

goal (1 subgoal):
 1. supp T \<subseteq> V
[PROOF STEP]
using supp_restrict0
[PROOF STATE]
proof (prove)
using this:
T = (\<lambda>a. if a \<in> V then (THE as. length as = length vs \<and> a = as \<bullet>\<cdot> vs) \<bullet>\<star> ws else (0::'w))
supp (?f \<down> ?A) \<subseteq> ?A

goal (1 subgoal):
 1. supp T \<subseteq> V
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
supp T \<subseteq> V

goal (1 subgoal):
 1. \<And>r m. \<lbrakk>r \<in> UNIV; m \<in> V\<rbrakk> \<Longrightarrow> T (r \<cdot> m) = r \<star> T m
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r m. \<lbrakk>r \<in> UNIV; m \<in> V\<rbrakk> \<Longrightarrow> T (r \<cdot> m) = r \<star> T m
[PROOF STEP]
fix a v
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r m. \<lbrakk>r \<in> UNIV; m \<in> V\<rbrakk> \<Longrightarrow> T (r \<cdot> m) = r \<star> T m
[PROOF STEP]
assume v: "v \<in> V"
[PROOF STATE]
proof (state)
this:
v \<in> V

goal (1 subgoal):
 1. \<And>r m. \<lbrakk>r \<in> UNIV; m \<in> V\<rbrakk> \<Longrightarrow> T (r \<cdot> m) = r \<star> T m
[PROOF STEP]
with basisV basisV_im(1) T_def lincomb'
[PROOF STATE]
proof (chain)
picking this:
set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs
set ws \<subseteq> W
T = (\<lambda>a. if a \<in> V then (THE as. length as = length vs \<and> a = as \<bullet>\<cdot> vs) \<bullet>\<star> ws else (0::'w))
(\<bullet>\<star>) \<equiv> scalar_mult.lincomb (\<star>)
v \<in> V
[PROOF STEP]
show "T (a \<cdot> v) = a \<star> T v"
[PROOF STATE]
proof (prove)
using this:
set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs
set ws \<subseteq> W
T = (\<lambda>a. if a \<in> V then (THE as. length as = length vs \<and> a = as \<bullet>\<cdot> vs) \<bullet>\<star> ws else (0::'w))
(\<bullet>\<star>) \<equiv> scalar_mult.lincomb (\<star>)
v \<in> V

goal (1 subgoal):
 1. T (a \<cdot> v) = a \<star> T v
[PROOF STEP]
using smult_closed smult_unique_scalars VectorSpace.smult_lincomb[OF VSpW]
[PROOF STATE]
proof (prove)
using this:
set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs
set ws \<subseteq> W
T = (\<lambda>a. if a \<in> V then (THE as. length as = length vs \<and> a = as \<bullet>\<cdot> vs) \<bullet>\<star> ws else (0::'w))
(\<bullet>\<star>) \<equiv> scalar_mult.lincomb (\<star>)
v \<in> V
\<lbrakk>?r \<in> UNIV; ?m \<in> V\<rbrakk> \<Longrightarrow> ?r \<cdot> ?m \<in> V
\<lbrakk>set ?vs \<subseteq> V \<and> V = RSpan ?vs \<and> R_lin_independent ?vs; ?v \<in> V\<rbrakk> \<Longrightarrow> (THE cs. length cs = length ?vs \<and> ?a \<cdot> ?v = cs \<bullet>\<cdot> ?vs) = map ((*) ?a) (THE cs. length cs = length ?vs \<and> ?v = cs \<bullet>\<cdot> ?vs)
\<lbrakk>set ?rs \<subseteq> UNIV; ?s \<in> UNIV; set ?ms \<subseteq> W\<rbrakk> \<Longrightarrow> ?s \<star> scalar_mult.lincomb (\<star>) ?rs ?ms = scalar_mult.lincomb (\<star>) (map ((*) ?s) ?rs) ?ms

goal (1 subgoal):
 1. T (a \<cdot> v) = a \<star> T v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
T (a \<cdot> v) = a \<star> T v

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
VectorSpaceHom (\<cdot>) V (\<star>) T

goal (2 subgoals):
 1. \<exists>T. VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws
 2. \<And>T y. \<lbrakk>VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws; VectorSpaceHom (\<cdot>) V (\<star>) y \<and> map y vs = ws\<rbrakk> \<Longrightarrow> T = y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
VectorSpaceHom (\<cdot>) V (\<star>) T

goal (2 subgoals):
 1. \<exists>T. VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws
 2. \<And>T y. \<lbrakk>VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws; VectorSpaceHom (\<cdot>) V (\<star>) y \<and> map y vs = ws\<rbrakk> \<Longrightarrow> T = y
[PROOF STEP]
have "map T vs = ws"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map T vs = ws
[PROOF STEP]
proof (rule nth_equalityI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. length (map T vs) = length ws
 2. \<And>i. i < length (map T vs) \<Longrightarrow> map T vs ! i = ws ! i
[PROOF STEP]
from basisV_im(2)
[PROOF STATE]
proof (chain)
picking this:
length ws = length vs
[PROOF STEP]
show "length (map T vs) = length ws"
[PROOF STATE]
proof (prove)
using this:
length ws = length vs

goal (1 subgoal):
 1. length (map T vs) = length ws
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (map T vs) = length ws

goal (1 subgoal):
 1. \<And>i. i < length (map T vs) \<Longrightarrow> map T vs ! i = ws ! i
[PROOF STEP]
have "\<And>i. i<length (map T vs) \<Longrightarrow> map T vs ! i = ws ! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < length (map T vs) \<Longrightarrow> map T vs ! i = ws ! i
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < length (map T vs) \<Longrightarrow> map T vs ! i = ws ! i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < length (map T vs) \<Longrightarrow> map T vs ! i = ws ! i
[PROOF STEP]
assume i: "i < length (map T vs)"
[PROOF STATE]
proof (state)
this:
i < length (map T vs)

goal (1 subgoal):
 1. \<And>i. i < length (map T vs) \<Longrightarrow> map T vs ! i = ws ! i
[PROOF STEP]
define zs where "zs = (replicate (length vs) (0::'f))[i:=1]"
[PROOF STATE]
proof (state)
this:
zs = (replicate (length vs) (0::'f))[i := 1::'f]

goal (1 subgoal):
 1. \<And>i. i < length (map T vs) \<Longrightarrow> map T vs ! i = ws ! i
[PROOF STEP]
with basisV i
[PROOF STATE]
proof (chain)
picking this:
set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs
i < length (map T vs)
zs = (replicate (length vs) (0::'f))[i := 1::'f]
[PROOF STEP]
have "length zs = length vs \<and> vs!i = zs \<bullet>\<cdot> vs"
[PROOF STATE]
proof (prove)
using this:
set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs
i < length (map T vs)
zs = (replicate (length vs) (0::'f))[i := 1::'f]

goal (1 subgoal):
 1. length zs = length vs \<and> vs ! i = zs \<bullet>\<cdot> vs
[PROOF STEP]
using delta_scalars_lincomb_eq_nth
[PROOF STATE]
proof (prove)
using this:
set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs
i < length (map T vs)
zs = (replicate (length vs) (0::'f))[i := 1::'f]
\<lbrakk>set ?ms \<subseteq> V; ?n < length ?ms\<rbrakk> \<Longrightarrow> (replicate (length ?ms) (0::'f))[?n := 1::'f] \<bullet>\<cdot> ?ms = ?ms ! ?n

goal (1 subgoal):
 1. length zs = length vs \<and> vs ! i = zs \<bullet>\<cdot> vs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length zs = length vs \<and> vs ! i = zs \<bullet>\<cdot> vs

goal (1 subgoal):
 1. \<And>i. i < length (map T vs) \<Longrightarrow> map T vs ! i = ws ! i
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
length zs = length vs \<and> vs ! i = zs \<bullet>\<cdot> vs

goal (1 subgoal):
 1. \<And>i. i < length (map T vs) \<Longrightarrow> map T vs ! i = ws ! i
[PROOF STEP]
from basisV i
[PROOF STATE]
proof (chain)
picking this:
set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs
i < length (map T vs)
[PROOF STEP]
have "vs!i \<in> V"
[PROOF STATE]
proof (prove)
using this:
set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs
i < length (map T vs)

goal (1 subgoal):
 1. vs ! i \<in> V
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vs ! i \<in> V

goal (1 subgoal):
 1. \<And>i. i < length (map T vs) \<Longrightarrow> map T vs ! i = ws ! i
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
length zs = length vs \<and> vs ! i = zs \<bullet>\<cdot> vs
vs ! i \<in> V
[PROOF STEP]
show "(map T vs)!i = ws!i"
[PROOF STATE]
proof (prove)
using this:
length zs = length vs \<and> vs ! i = zs \<bullet>\<cdot> vs
vs ! i \<in> V

goal (1 subgoal):
 1. map T vs ! i = ws ! i
[PROOF STEP]
using basisV basisV_im T_def lincomb' zs_def i
              basis_for_obtain_unique_scalars[of vs "vs!i"]
              the1_equality[of "\<lambda>zs. length zs = length vs \<and> vs!i = zs \<bullet>\<cdot> vs"]
              VectorSpace.delta_scalars_lincomb_eq_nth[OF VSpW, of ws]
[PROOF STATE]
proof (prove)
using this:
length zs = length vs \<and> vs ! i = zs \<bullet>\<cdot> vs
vs ! i \<in> V
set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs
set ws \<subseteq> W
length ws = length vs
T = (\<lambda>a. if a \<in> V then (THE as. length as = length vs \<and> a = as \<bullet>\<cdot> vs) \<bullet>\<star> ws else (0::'w))
(\<bullet>\<star>) \<equiv> scalar_mult.lincomb (\<star>)
zs = (replicate (length vs) (0::'f))[i := 1::'f]
i < length (map T vs)
\<lbrakk>set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs; vs ! i \<in> V\<rbrakk> \<Longrightarrow> \<exists>!as. length as = length vs \<and> vs ! i = as \<bullet>\<cdot> vs
\<lbrakk>\<exists>!x. length x = length vs \<and> vs ! i = x \<bullet>\<cdot> vs; length ?a = length vs \<and> vs ! i = ?a \<bullet>\<cdot> vs\<rbrakk> \<Longrightarrow> (THE x. length x = length vs \<and> vs ! i = x \<bullet>\<cdot> vs) = ?a
\<lbrakk>set ws \<subseteq> W; ?n < length ws\<rbrakk> \<Longrightarrow> scalar_mult.lincomb (\<star>) ((replicate (length ws) (0::'f))[?n := 1::'f]) ws = ws ! ?n

goal (1 subgoal):
 1. map T vs ! i = ws ! i
[PROOF STEP]
by    force
[PROOF STATE]
proof (state)
this:
map T vs ! i = ws ! i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?i3 < length (map T vs) \<Longrightarrow> map T vs ! ?i3 = ws ! ?i3

goal (1 subgoal):
 1. \<And>i. i < length (map T vs) \<Longrightarrow> map T vs ! i = ws ! i
[PROOF STEP]
thus "\<And>i. i < length (map T vs) \<Longrightarrow> map T vs ! i = ws ! i"
[PROOF STATE]
proof (prove)
using this:
?i3 < length (map T vs) \<Longrightarrow> map T vs ! ?i3 = ws ! ?i3

goal (1 subgoal):
 1. \<And>i. i < length (map T vs) \<Longrightarrow> map T vs ! i = ws ! i
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
?i3 < length (map T vs) \<Longrightarrow> map T vs ! ?i3 = ws ! ?i3

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
map T vs = ws

goal (2 subgoals):
 1. \<exists>T. VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws
 2. \<And>T y. \<lbrakk>VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws; VectorSpaceHom (\<cdot>) V (\<star>) y \<and> map y vs = ws\<rbrakk> \<Longrightarrow> T = y
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
VectorSpaceHom (\<cdot>) V (\<star>) T
map T vs = ws
[PROOF STEP]
have "VectorSpaceHom (\<cdot>) V smult' T \<and> map T vs = ws"
[PROOF STATE]
proof (prove)
using this:
VectorSpaceHom (\<cdot>) V (\<star>) T
map T vs = ws

goal (1 subgoal):
 1. VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws

goal (2 subgoals):
 1. \<exists>T. VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws
 2. \<And>T y. \<lbrakk>VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws; VectorSpaceHom (\<cdot>) V (\<star>) y \<and> map y vs = ws\<rbrakk> \<Longrightarrow> T = y
[PROOF STEP]
thus "\<exists>T. VectorSpaceHom (\<cdot>) V smult' T \<and> map T vs = ws"
[PROOF STATE]
proof (prove)
using this:
VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws

goal (1 subgoal):
 1. \<exists>T. VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
\<exists>T. VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws

goal (1 subgoal):
 1. \<And>T y. \<lbrakk>VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws; VectorSpaceHom (\<cdot>) V (\<star>) y \<and> map y vs = ws\<rbrakk> \<Longrightarrow> T = y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>T y. \<lbrakk>VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws; VectorSpaceHom (\<cdot>) V (\<star>) y \<and> map y vs = ws\<rbrakk> \<Longrightarrow> T = y
[PROOF STEP]
fix S T
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>T y. \<lbrakk>VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws; VectorSpaceHom (\<cdot>) V (\<star>) y \<and> map y vs = ws\<rbrakk> \<Longrightarrow> T = y
[PROOF STEP]
assume
    "VectorSpaceHom (\<cdot>) V smult' S \<and> map S vs = ws"
    "VectorSpaceHom (\<cdot>) V smult' T \<and> map T vs = ws"
[PROOF STATE]
proof (state)
this:
VectorSpaceHom (\<cdot>) V (\<star>) S \<and> map S vs = ws
VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws

goal (1 subgoal):
 1. \<And>T y. \<lbrakk>VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws; VectorSpaceHom (\<cdot>) V (\<star>) y \<and> map y vs = ws\<rbrakk> \<Longrightarrow> T = y
[PROOF STEP]
with basisV
[PROOF STATE]
proof (chain)
picking this:
set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs
VectorSpaceHom (\<cdot>) V (\<star>) S \<and> map S vs = ws
VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws
[PROOF STEP]
show "S = T"
[PROOF STATE]
proof (prove)
using this:
set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs
VectorSpaceHom (\<cdot>) V (\<star>) S \<and> map S vs = ws
VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws

goal (1 subgoal):
 1. S = T
[PROOF STEP]
using VectorSpaceHom.same_image_on_spanset_imp_same_hom map_eq_conv
[PROOF STATE]
proof (prove)
using this:
set vs \<subseteq> V \<and> V = RSpan vs \<and> R_lin_independent vs
VectorSpaceHom (\<cdot>) V (\<star>) S \<and> map S vs = ws
VectorSpaceHom (\<cdot>) V (\<star>) T \<and> map T vs = ws
\<lbrakk>VectorSpaceHom ?smult ?V ?smult' ?T; VectorSpaceHom ?smult ?V ?smult' ?S; set ?ms \<subseteq> ?V; ?V = R_scalar_mult.RSpan UNIV ?smult ?ms; \<forall>m\<in>set ?ms. ?S m = ?T m\<rbrakk> \<Longrightarrow> ?S = ?T
(map ?f ?xs = map ?g ?xs) = (\<forall>x\<in>set ?xs. ?f x = ?g x)

goal (1 subgoal):
 1. S = T
[PROOF STEP]
by    fastforce
[PROOF STATE]
proof (state)
this:
S = T

goal:
No subgoals!
[PROOF STEP]
(* slow *)
[PROOF STATE]
proof (state)
this:
S = T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nlists_not_empty: "A\<noteq>{} \<Longrightarrow> \<exists>xs. xs \<in> nlists n A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> \<exists>xs. xs \<in> nlists n A
[PROOF STEP]
by (induct "n") (auto simp: in_nlists_Suc_iff)


[STATEMENT]
lemma "matcher_agree_on_exact_matches exact approx \<longleftrightarrow> (\<forall>p m. exact m p = the (ternary_to_bool (approx m p)) \<or> approx m p = TernaryUnknown)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matcher_agree_on_exact_matches exact approx = (\<forall>p m. exact m p = the (ternary_to_bool (approx m p)) \<or> approx m p = TernaryUnknown)
[PROOF STEP]
unfolding matcher_agree_on_exact_matches_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>p m. approx m p \<noteq> TernaryUnknown \<longrightarrow> exact m p = the (ternary_to_bool (approx m p))) = (\<forall>p m. exact m p = the (ternary_to_bool (approx m p)) \<or> approx m p = TernaryUnknown)
[PROOF STEP]
by blast


[STATEMENT]
lemma measurable_snth_PiM: "(\<lambda>\<omega> n. \<omega> !! n) \<in> measurable (stream_space M) (\<Pi>\<^sub>M i\<in>UNIV. M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (!!) \<in> stream_space M \<rightarrow>\<^sub>M Pi\<^sub>M UNIV (\<lambda>i. M)
[PROOF STEP]
by (auto intro!: measurable_vimage_algebra1
           simp: space_PiM streams_iff_sset sset_range image_subset_iff stream_space_def)


[STATEMENT]
lemma two_reduced_heads_imp_reduced_alt':
  assumes "s\<noteq>t" "reduced_word_for S w (s#as)" "reduced_word_for S w (t#bs)"
  shows "n \<le> relfun s t \<or> relfun s t = 0 \<Longrightarrow> (\<exists>cs.
          reduced_word_for S w (alternating_list n s t @ cs) \<or>
          reduced_word_for S w (alternating_list n t s @ cs)
        )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> add_order (s + t) \<or> add_order (s + t) = 0 \<Longrightarrow> \<exists>cs. S_reduced_for w (alternating_list n s t @ cs) \<or> S_reduced_for w (alternating_list n t s @ cs)
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> add_order (s + t) \<or> add_order (s + t) = 0 \<Longrightarrow> \<exists>cs. S_reduced_for w (alternating_list 0 s t @ cs) \<or> S_reduced_for w (alternating_list 0 t s @ cs)
 2. \<And>n. \<lbrakk>n \<le> add_order (s + t) \<or> add_order (s + t) = 0 \<Longrightarrow> \<exists>cs. S_reduced_for w (alternating_list n s t @ cs) \<or> S_reduced_for w (alternating_list n t s @ cs); Suc n \<le> add_order (s + t) \<or> add_order (s + t) = 0\<rbrakk> \<Longrightarrow> \<exists>cs. S_reduced_for w (alternating_list (Suc n) s t @ cs) \<or> S_reduced_for w (alternating_list (Suc n) t s @ cs)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 \<le> add_order (s + t) \<or> add_order (s + t) = 0

goal (2 subgoals):
 1. 0 \<le> add_order (s + t) \<or> add_order (s + t) = 0 \<Longrightarrow> \<exists>cs. S_reduced_for w (alternating_list 0 s t @ cs) \<or> S_reduced_for w (alternating_list 0 t s @ cs)
 2. \<And>n. \<lbrakk>n \<le> add_order (s + t) \<or> add_order (s + t) = 0 \<Longrightarrow> \<exists>cs. S_reduced_for w (alternating_list n s t @ cs) \<or> S_reduced_for w (alternating_list n t s @ cs); Suc n \<le> add_order (s + t) \<or> add_order (s + t) = 0\<rbrakk> \<Longrightarrow> \<exists>cs. S_reduced_for w (alternating_list (Suc n) s t @ cs) \<or> S_reduced_for w (alternating_list (Suc n) t s @ cs)
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
S_reduced_for w (s # as)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
S_reduced_for w (s # as)

goal (1 subgoal):
 1. \<exists>cs. S_reduced_for w (alternating_list 0 s t @ cs) \<or> S_reduced_for w (alternating_list 0 t s @ cs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>cs. S_reduced_for w (alternating_list 0 s t @ cs) \<or> S_reduced_for w (alternating_list 0 t s @ cs)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> add_order (s + t) \<or> add_order (s + t) = 0 \<Longrightarrow> \<exists>cs. S_reduced_for w (alternating_list n s t @ cs) \<or> S_reduced_for w (alternating_list n t s @ cs); Suc n \<le> add_order (s + t) \<or> add_order (s + t) = 0\<rbrakk> \<Longrightarrow> \<exists>cs. S_reduced_for w (alternating_list (Suc n) s t @ cs) \<or> S_reduced_for w (alternating_list (Suc n) t s @ cs)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> add_order (s + t) \<or> add_order (s + t) = 0 \<Longrightarrow> \<exists>cs. S_reduced_for w (alternating_list n s t @ cs) \<or> S_reduced_for w (alternating_list n t s @ cs); Suc n \<le> add_order (s + t) \<or> add_order (s + t) = 0\<rbrakk> \<Longrightarrow> \<exists>cs. S_reduced_for w (alternating_list (Suc n) s t @ cs) \<or> S_reduced_for w (alternating_list (Suc n) t s @ cs)
[PROOF STEP]
case (Suc m)
[PROOF STATE]
proof (state)
this:
m \<le> add_order (s + t) \<or> add_order (s + t) = 0 \<Longrightarrow> \<exists>cs. S_reduced_for w (alternating_list m s t @ cs) \<or> S_reduced_for w (alternating_list m t s @ cs)
Suc m \<le> add_order (s + t) \<or> add_order (s + t) = 0

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> add_order (s + t) \<or> add_order (s + t) = 0 \<Longrightarrow> \<exists>cs. S_reduced_for w (alternating_list n s t @ cs) \<or> S_reduced_for w (alternating_list n t s @ cs); Suc n \<le> add_order (s + t) \<or> add_order (s + t) = 0\<rbrakk> \<Longrightarrow> \<exists>cs. S_reduced_for w (alternating_list (Suc n) s t @ cs) \<or> S_reduced_for w (alternating_list (Suc n) t s @ cs)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
m \<le> add_order (s + t) \<or> add_order (s + t) = 0 \<Longrightarrow> \<exists>cs. S_reduced_for w (alternating_list m s t @ cs) \<or> S_reduced_for w (alternating_list m t s @ cs)
Suc m \<le> add_order (s + t) \<or> add_order (s + t) = 0

goal (1 subgoal):
 1. \<exists>cs. S_reduced_for w (alternating_list (Suc m) s t @ cs) \<or> S_reduced_for w (alternating_list (Suc m) t s @ cs)
[PROOF STEP]
using add_order_add_sym[of s t]
          two_reduced_heads_imp_reduced_alt_step[
            OF assms(1)[THEN not_sym] assms(2), of m
          ]
          two_reduced_heads_imp_reduced_alt_step[OF assms(1,3), of m]
[PROOF STATE]
proof (prove)
using this:
m \<le> add_order (s + t) \<or> add_order (s + t) = 0 \<Longrightarrow> \<exists>cs. S_reduced_for w (alternating_list m s t @ cs) \<or> S_reduced_for w (alternating_list m t s @ cs)
Suc m \<le> add_order (s + t) \<or> add_order (s + t) = 0
add_order (s + t) = add_order (t + s)
\<lbrakk>m < add_order (t + s) \<or> add_order (t + s) = 0; S_reduced_for w (alternating_list m t s @ ?cs)\<rbrakk> \<Longrightarrow> \<exists>ds. S_reduced_for w (alternating_list (Suc m) s t @ ds)
\<lbrakk>m < add_order (s + t) \<or> add_order (s + t) = 0; S_reduced_for w (alternating_list m s t @ ?cs)\<rbrakk> \<Longrightarrow> \<exists>ds. S_reduced_for w (alternating_list (Suc m) t s @ ds)

goal (1 subgoal):
 1. \<exists>cs. S_reduced_for w (alternating_list (Suc m) s t @ cs) \<or> S_reduced_for w (alternating_list (Suc m) t s @ cs)
[PROOF STEP]
by    fastforce
[PROOF STATE]
proof (state)
this:
\<exists>cs. S_reduced_for w (alternating_list (Suc m) s t @ cs) \<or> S_reduced_for w (alternating_list (Suc m) t s @ cs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_mult_Var:
  \<open>degree (A * Var x') x' = (if A = 0 then 0 else Suc (degree A x'))\<close> for A :: \<open>int mpoly\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.degree (A * Var x') x' = (if A = 0 then 0 else Suc (MPoly_Type.degree A x'))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. MPoly_Type.degree (A * Var x') x' = (if A = 0 then 0 else Suc (MPoly_Type.degree A x'))
[PROOF STEP]
have [simp]: \<open>A \<noteq> 0 \<Longrightarrow>
    Max (insert 0 ((\<lambda>x. Suc (lookup x x')) ` keys (mapping_of A))) =
    Max (insert (Suc 0) ((\<lambda>x. Suc (lookup x x')) ` keys (mapping_of A)))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<noteq> 0 \<Longrightarrow> Max (insert 0 ((\<lambda>x. Suc (lookup x x')) ` keys (mapping_of A))) = Max (insert (Suc 0) ((\<lambda>x. Suc (lookup x x')) ` keys (mapping_of A)))
[PROOF STEP]
unfolding image_image[of Suc \<open>\<lambda>x. lookup x x'\<close>, symmetric] image_insert[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<noteq> 0 \<Longrightarrow> Max (insert 0 (Suc ` (\<lambda>x. lookup x x') ` keys (mapping_of A))) = Max (Suc ` insert 0 ((\<lambda>x. lookup x x') ` keys (mapping_of A)))
[PROOF STEP]
by (subst Max_Suc_Suc_Max, use mapping_of_inject in fastforce, use mapping_of_inject in fastforce)+
      (simp add: Max.hom_commute)
[PROOF STATE]
proof (state)
this:
A \<noteq> 0 \<Longrightarrow> Max (insert 0 ((\<lambda>x. Suc (lookup x x')) ` keys (mapping_of A))) = Max (insert (Suc 0) ((\<lambda>x. Suc (lookup x x')) ` keys (mapping_of A)))

goal (1 subgoal):
 1. MPoly_Type.degree (A * Var x') x' = (if A = 0 then 0 else Suc (MPoly_Type.degree A x'))
[PROOF STEP]
have \<open>A \<noteq> 0 \<Longrightarrow>
    Max (insert 0
    ((\<lambda>x. lookup x x') `
    keys (mapping_of A * mapping_of (Var x')))) =
    Suc (Max (insert 0 ((\<lambda>m. lookup m x') ` keys (mapping_of A))))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<noteq> 0 \<Longrightarrow> Max (insert 0 ((\<lambda>x. lookup x x') ` keys (mapping_of A * mapping_of (Var x')))) = Suc (Max (insert 0 ((\<lambda>m. lookup m x') ` keys (mapping_of A))))
[PROOF STEP]
by (subst arg_cong[of _ \<open>insert 0
      (Suc ` ((\<lambda>x. lookup x x') ` keys (mapping_of A)))\<close> Max])
     (auto simp: image_image Var.rep_eq lookup_plus_fun in_mapping_mult_single
      hom_Max_commute Max_Suc_Suc_Max
      elim!: in_keys_timesE  split: if_splits)
[PROOF STATE]
proof (state)
this:
A \<noteq> 0 \<Longrightarrow> Max (insert 0 ((\<lambda>x. lookup x x') ` keys (mapping_of A * mapping_of (Var x')))) = Suc (Max (insert 0 ((\<lambda>m. lookup m x') ` keys (mapping_of A))))

goal (1 subgoal):
 1. MPoly_Type.degree (A * Var x') x' = (if A = 0 then 0 else Suc (MPoly_Type.degree A x'))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<noteq> 0 \<Longrightarrow> Max (insert 0 ((\<lambda>x. lookup x x') ` keys (mapping_of A * mapping_of (Var x')))) = Suc (Max (insert 0 ((\<lambda>m. lookup m x') ` keys (mapping_of A))))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A \<noteq> 0 \<Longrightarrow> Max (insert 0 ((\<lambda>x. lookup x x') ` keys (mapping_of A * mapping_of (Var x')))) = Suc (Max (insert 0 ((\<lambda>m. lookup m x') ` keys (mapping_of A))))

goal (1 subgoal):
 1. MPoly_Type.degree (A * Var x') x' = (if A = 0 then 0 else Suc (MPoly_Type.degree A x'))
[PROOF STEP]
by (auto simp: degree_def times_mpoly.rep_eq
      intro!: arg_cong[of _ \<open>insert 0
      (Suc ` ((\<lambda>x. lookup x x') ` keys (mapping_of A)))\<close> Max])
[PROOF STATE]
proof (state)
this:
MPoly_Type.degree (A * Var x') x' = (if A = 0 then 0 else Suc (MPoly_Type.degree A x'))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cf_cn_comp_ObjMap_app[cat_cn_cs_simps]:
  assumes "\<GG> : \<BB> \<^sub>C\<mapsto>\<mapsto>\<^bsub>\<alpha>\<^esub> \<CC>" and "\<FF> : \<AA> \<^sub>C\<mapsto>\<mapsto>\<^bsub>\<alpha>\<^esub> \<BB>" and "a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>"
  shows "(\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>\<lparr>a\<rparr> = \<GG>\<lparr>ObjMap\<rparr>\<lparr>\<FF>\<lparr>ObjMap\<rparr>\<lparr>a\<rparr>\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>\<lparr>a\<rparr> = \<GG>\<lparr>ObjMap\<rparr>\<lparr>\<FF>\<lparr>ObjMap\<rparr>\<lparr>a\<rparr>\<rparr>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>\<lparr>a\<rparr> = \<GG>\<lparr>ObjMap\<rparr>\<lparr>\<FF>\<lparr>ObjMap\<rparr>\<lparr>a\<rparr>\<rparr>
[PROOF STEP]
interpret L: is_functor \<alpha> \<open>op_cat \<BB>\<close> \<CC> \<GG>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<GG> : op_cat \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
[PROOF STEP]
by (rule assms(1))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>\<lparr>a\<rparr> = \<GG>\<lparr>ObjMap\<rparr>\<lparr>\<FF>\<lparr>ObjMap\<rparr>\<lparr>a\<rparr>\<rparr>
[PROOF STEP]
interpret R: is_functor \<alpha> \<open>op_cat \<AA>\<close> \<BB> \<FF>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<FF> : op_cat \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
by (rule assms(2))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>\<lparr>a\<rparr> = \<GG>\<lparr>ObjMap\<rparr>\<lparr>\<FF>\<lparr>ObjMap\<rparr>\<lparr>a\<rparr>\<rparr>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>\<lparr>a\<rparr> = \<GG>\<lparr>ObjMap\<rparr>\<lparr>\<FF>\<lparr>ObjMap\<rparr>\<lparr>a\<rparr>\<rparr>
[PROOF STEP]
by
      (
        rule smcf_cn_comp_ObjMap_app
          [
            OF
              L.cf_is_semifunctor[unfolded slicing_commute[symmetric]]
              R.cf_is_semifunctor[unfolded slicing_commute[symmetric]],
            unfolded slicing_commute slicing_simps,
            OF assms(3)
          ]
      )
[PROOF STATE]
proof (state)
this:
(\<GG> \<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ObjMap\<rparr>\<lparr>a\<rparr> = \<GG>\<lparr>ObjMap\<rparr>\<lparr>\<FF>\<lparr>ObjMap\<rparr>\<lparr>a\<rparr>\<rparr>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cf_cn_cov_rcomp_ObjMap_app[cat_cs_simps]:
  assumes "category \<alpha> \<BB>"
    and "\<GG> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>"
    and "b \<in>\<^sub>\<circ> op_cat \<BB>\<lparr>Obj\<rparr>"
    and "a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>"
  shows "cf_cn_cov_rcomp \<BB> \<SS> \<GG>\<lparr>ObjMap\<rparr>\<lparr>b, a\<rparr>\<^sub>\<bullet> = \<SS>\<lparr>ObjMap\<rparr>\<lparr>b, \<GG>\<lparr>ObjMap\<rparr>\<lparr>a\<rparr>\<rparr>\<^sub>\<bullet>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>cf_cn_cov_rcomp \<BB> \<SS> \<GG>\<^esub> a = b \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>\<SS>\<^esub> \<GG>\<lparr>ObjMap\<rparr>\<lparr>a\<rparr>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<BB>
\<GG> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
b \<in>\<^sub>\<circ> op_cat \<BB>\<lparr>Obj\<rparr>
a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. b \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>cf_cn_cov_rcomp \<BB> \<SS> \<GG>\<^esub> a = b \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>\<SS>\<^esub> \<GG>\<lparr>ObjMap\<rparr>\<lparr>a\<rparr>
[PROOF STEP]
unfolding cf_cn_cov_rcomp_def cat_op_simps
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<BB>
\<GG> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>
a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. b \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>cf_cn_cov_bcomp \<SS> (dghm_id \<BB>) \<GG>\<^esub> a = b \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>O\<^bsub>\<SS>\<^esub> \<GG>\<lparr>ObjMap\<rparr>\<lparr>a\<rparr>
[PROOF STEP]
by
    (
      cs_concl
        cs_simp: cat_cs_simps cat_op_simps
        cs_intro: cat_cs_intros cat_prod_cs_intros
    )


[STATEMENT]
theorem TBtheorem1a:
assumes "ine PQ E"
       and "subcomponents PQ = {P,Q}"
       and "correctCompositionIn PQ"
shows "ine P E  \<or> ine Q E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ine P E \<or> ine Q E
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
ine PQ E
subcomponents PQ = {P, Q}
correctCompositionIn PQ

goal (1 subgoal):
 1. ine P E \<or> ine Q E
[PROOF STEP]
by (simp add: ine_def correctCompositionIn_def, auto)


[STATEMENT]
lemma cong_iff_dvd_diff:
  "[a = b] (mod m) \<longleftrightarrow> m dvd (a - b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a = b] (mod m) = (m dvd a - b)
[PROOF STEP]
by (simp add: cong_0_iff [symmetric] cong_diff_iff_cong_0)


[STATEMENT]
lemma alg_dvd_mult [simp]:
  fixes a b c :: "'a :: field_char_0"
  shows "a alg_dvd c \<Longrightarrow> algebraic_int b \<Longrightarrow> a alg_dvd (b * c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a alg_dvd c; algebraic_int b\<rbrakk> \<Longrightarrow> a alg_dvd b * c
[PROOF STEP]
using alg_dvd_mono[of a c 1 b]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>a alg_dvd c; (1::'a) alg_dvd b\<rbrakk> \<Longrightarrow> a * (1::'a) alg_dvd c * b

goal (1 subgoal):
 1. \<lbrakk>a alg_dvd c; algebraic_int b\<rbrakk> \<Longrightarrow> a alg_dvd b * c
[PROOF STEP]
by (auto simp: mult.commute)


[STATEMENT]
lemma subrobdds_set_mono2 :
  "bs1 \<subseteq> bs2 \<Longrightarrow> (subrobdds_set bs1 \<subseteq> subrobdds_set bs2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bs1 \<subseteq> bs2 \<Longrightarrow> subrobdds_set bs1 \<subseteq> subrobdds_set bs2
[PROOF STEP]
unfolding subrobdds_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bs1 \<subseteq> bs2 \<Longrightarrow> \<Union> (subrobdds ` bs1) \<subseteq> \<Union> (subrobdds ` bs2)
[PROOF STEP]
by auto


[STATEMENT]
lemma bin_cat_inj: "(concat_bit n b a) = concat_bit n d c \<longleftrightarrow> a = c \<and> take_bit n b = take_bit n d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (concat_bit n b a = concat_bit n d c) = (a = c \<and> take_bit n b = take_bit n d)
[PROOF STEP]
by (auto intro: bin_cat_cong bin_cat_eqD1 bin_cat_eqD2)


[STATEMENT]
lemma Raise_Subst:
    shows "Raise (p + n) k (Subst p v t) = Subst p (Raise n k v) (Raise (Suc (p + n)) k t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Raise (p + n) k (Subst p v t) = Subst p (Raise n k v) (Raise (Suc (p + n)) k t)
[PROOF STEP]
using raise_Raise
[PROOF STATE]
proof (prove)
using this:
Raise 0 ?p (Raise ?n ?k ?t) = Raise (?p + ?n) ?k (Raise 0 ?p ?t)

goal (1 subgoal):
 1. Raise (p + n) k (Subst p v t) = Subst p (Raise n k v) (Raise (Suc (p + n)) k t)
[PROOF STEP]
apply (induct t arbitrary: v k n p, auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>t v k n p. \<lbrakk>\<And>v k n p. Raise (p + n) k (Subst p v t) = Subst p (Raise n k v) (Raise (Suc (p + n)) k t); \<And>p n k t. Raise 0 p (Raise n k t) = Raise (p + n) k (Raise 0 p t)\<rbrakk> \<Longrightarrow> Raise (Suc (p + n)) k (Subst (Suc p) v t) = Subst (Suc p) (Raise n k v) (Raise (Suc (Suc (p + n))) k t)
 2. \<And>t1 t2 v k n p. \<lbrakk>\<And>v k n p. Raise (p + n) k (Subst p v t1) = Subst p (Raise n k v) (Raise (Suc (p + n)) k t1); \<And>v k n p. Raise (p + n) k (Subst p v t2) = Subst p (Raise n k v) (Raise (Suc (p + n)) k t2); \<And>p n k t. Raise 0 p (Raise n k t) = Raise (p + n) k (Raise 0 p t)\<rbrakk> \<Longrightarrow> Raise (Suc (p + n)) k (Subst (Suc p) v t1) = Subst (Suc p) (Raise n k v) (Raise (Suc (Suc (p + n))) k t1)
[PROOF STEP]
by (metis add_Suc)+


[STATEMENT]
lemma not_iWeakSince: "
  (\<not> (P t1. t1 \<B> t2 I. Q t2)) =
  ((\<box> t I. (Q t \<longrightarrow> (\<diamond> t' (I \<down>> t). \<not> P t'))) \<and> (\<diamond> t I. \<not> P t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> (P t1. t1 \<B> t2 I. Q t2)) = ((\<box> t I. Q t \<longrightarrow> (\<diamond> t' I \<down>> t. \<not> P t')) \<and> (\<diamond> t I. \<not> P t))
[PROOF STEP]
by (simp add: iWeakSince_iSince_conv not_iSince)


[STATEMENT]
lemma arc_translation_eq:
  fixes g :: "real \<Rightarrow> 'a::euclidean_space"
  shows "arc((\<lambda>x. a + x) \<circ> g) = arc g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arc ((+) a \<circ> g) = arc g
[PROOF STEP]
by (auto simp: arc_def inj_on_def path_translation_eq)


[STATEMENT]
lemma walk_length_even_sym:
  assumes "is_walk w"
  assumes "hd w \<in> Y"
  assumes "last w \<in> Y"
  shows "even (walk_length w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. even (walk_length w)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. even (walk_length w)
[PROOF STEP]
interpret sym: bipartite_graph V E Y X
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bipartite_graph V E Y X
[PROOF STEP]
using bipartite_sym
[PROOF STATE]
proof (prove)
using this:
bipartite_graph V E Y X

goal (1 subgoal):
 1. bipartite_graph V E Y X
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. even (walk_length w)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. even (walk_length w)
[PROOF STEP]
using sym.walk_length_even assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>is_walk ?w; hd ?w \<in> Y; last ?w \<in> Y\<rbrakk> \<Longrightarrow> even (walk_length ?w)
is_walk w
hd w \<in> Y
last w \<in> Y

goal (1 subgoal):
 1. even (walk_length w)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
even (walk_length w)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma measurable_dens_ctxt_measure_eq:
    "measurable (dens_ctxt_measure (V,V',\<Gamma>,\<delta>) \<rho>) = measurable (state_measure (V\<union>V') \<Gamma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<rightarrow>\<^sub>M) (dens_ctxt_measure (V, V', \<Gamma>, \<delta>) \<rho>) = (\<rightarrow>\<^sub>M) (state_measure (V \<union> V') \<Gamma>)
[PROOF STEP]
by (intro ext measurable_cong_sets)
     (simp_all add: dens_ctxt_measure_def state_measure'_def)


[STATEMENT]
lemma col_cong_3_cong_3_eq:
  assumes "A \<noteq> B"
    and "Col A B C"
    and "A B C Cong3 A' B' C1"
    and  "A B C Cong3 A' B' C2"
  shows  "C1 = C2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C1 = C2
[PROOF STEP]
by (metis Tarski_neutral_dimensionless.Cong3_def Tarski_neutral_dimensionless.cong_diff Tarski_neutral_dimensionless.l4_18 Tarski_neutral_dimensionless_axioms assms(1) assms(2) assms(3) assms(4) cong_inner_transitivity l4_13)


[STATEMENT]
lemma uncross_negative_flip_inv: "uncross_negative_flip w1 w2 \<Longrightarrow> (kauff_mat w1) = (kauff_mat w2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uncross_negative_flip w1 w2 \<Longrightarrow> kauff_mat w1 = kauff_mat w2
[PROOF STEP]
unfolding uncross_negative_flip_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w1 = right_under \<and> w2 = left_under \<Longrightarrow> kauff_mat w1 = kauff_mat w2
[PROOF STEP]
using  negative_flip_kauff_mat
[PROOF STATE]
proof (prove)
using this:
kauff_mat left_under = kauff_mat right_under

goal (1 subgoal):
 1. w1 = right_under \<and> w2 = left_under \<Longrightarrow> kauff_mat w1 = kauff_mat w2
[PROOF STEP]
by auto


[STATEMENT]
lemma coplanar_translation_eq: "coplanar((\<lambda>x. a + x) ` S) \<longleftrightarrow> coplanar S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coplanar ((+) a ` S) = coplanar S
[PROOF STEP]
by (metis (no_types) coplanar_translation_imp translation_galois)


[STATEMENT]
lemma multisetLeTrans:
assumes
  "trans r"
  "multiset_le x y r"
  "multiset_le y z r"
shows
  "multiset_le x z r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiset_le x z r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
trans r
multiset_le x y r
multiset_le y z r

goal (1 subgoal):
 1. multiset_le x z r
[PROOF STEP]
unfolding multiset_le_def
[PROOF STATE]
proof (prove)
using this:
trans r
x = y \<or> (x, y) \<in> mult r
y = z \<or> (y, z) \<in> mult r

goal (1 subgoal):
 1. x = z \<or> (x, z) \<in> mult r
[PROOF STEP]
unfolding mult_def
[PROOF STATE]
proof (prove)
using this:
trans r
x = y \<or> (x, y) \<in> (mult1 r)\<^sup>+
y = z \<or> (y, z) \<in> (mult1 r)\<^sup>+

goal (1 subgoal):
 1. x = z \<or> (x, z) \<in> (mult1 r)\<^sup>+
[PROOF STEP]
by (blast intro: trancl_trans)


[STATEMENT]
lemma encode_not_Z_or_S: "encode f = prod_encode (a, b) \<Longrightarrow> a > 1 \<Longrightarrow> f \<noteq> Z \<and> f \<noteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>encode f = prod_encode (a, b); 1 < a\<rbrakk> \<Longrightarrow> f \<noteq> Z \<and> f \<noteq> S
[PROOF STEP]
by (metis encode.simps(1) encode.simps(2) less_numeral_extra(4) not_one_less_zero
    prod_encode_gr1)


[STATEMENT]
lemma Bernstein_changes_test:
  fixes P::"real poly"
  assumes "degree P \<le> p" and "P \<noteq> 0" and "c < d"
  shows "proots_count P {x. c < x \<and> x < d} \<le> Bernstein_changes p c d P \<and>
        even (Bernstein_changes p c d P - proots_count P {x. c < x \<and> x < d})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (proots_count P {x. c < x \<and> x < d}) \<le> Bernstein_changes p c d P \<and> even (Bernstein_changes p c d P - int (proots_count P {x. c < x \<and> x < d}))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. int (proots_count P {x. c < x \<and> x < d}) \<le> Bernstein_changes p c d P \<and> even (Bernstein_changes p c d P - int (proots_count P {x. c < x \<and> x < d}))
[PROOF STEP]
define Q where "Q=P \<circ>\<^sub>p [:c, 1:] \<circ>\<^sub>p [:0, d - c:]"
[PROOF STATE]
proof (state)
this:
Q = P \<circ>\<^sub>p [:c, 1:] \<circ>\<^sub>p [:0, d - c:]

goal (1 subgoal):
 1. int (proots_count P {x. c < x \<and> x < d}) \<le> Bernstein_changes p c d P \<and> even (Bernstein_changes p c d P - int (proots_count P {x. c < x \<and> x < d}))
[PROOF STEP]
have "int (proots_count Q {x. 0 < x \<and> x < 1})
          \<le> Bernstein_changes_01 p Q \<and>
              even (Bernstein_changes_01 p Q -
                  int (proots_count Q {x. 0 < x \<and> x < 1}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (proots_count Q {x. 0 < x \<and> x < 1}) \<le> Bernstein_changes_01 p Q \<and> even (Bernstein_changes_01 p Q - int (proots_count Q {x. 0 < x \<and> x < 1}))
[PROOF STEP]
unfolding Q_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (proots_count (P \<circ>\<^sub>p [:c, 1:] \<circ>\<^sub>p [:0, d - c:]) {x. 0 < x \<and> x < 1}) \<le> Bernstein_changes_01 p (P \<circ>\<^sub>p [:c, 1:] \<circ>\<^sub>p [:0, d - c:]) \<and> even (Bernstein_changes_01 p (P \<circ>\<^sub>p [:c, 1:] \<circ>\<^sub>p [:0, d - c:]) - int (proots_count (P \<circ>\<^sub>p [:c, 1:] \<circ>\<^sub>p [:0, d - c:]) {x. 0 < x \<and> x < 1}))
[PROOF STEP]
apply (rule Bernstein_changes_01_test)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. degree (P \<circ>\<^sub>p [:c, 1:] \<circ>\<^sub>p [:0, d - c:]) \<le> p
 2. P \<circ>\<^sub>p [:c, 1:] \<circ>\<^sub>p [:0, d - c:] \<noteq> 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (P \<circ>\<^sub>p [:c, 1:] \<circ>\<^sub>p [:0, d - c:]) \<le> p
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
degree P \<le> p
P \<noteq> 0
c < d

goal (1 subgoal):
 1. degree (P \<circ>\<^sub>p [:c, 1:] \<circ>\<^sub>p [:0, d - c:]) \<le> p
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<circ>\<^sub>p [:c, 1:] \<circ>\<^sub>p [:0, d - c:] \<noteq> 0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<circ>\<^sub>p [:c, 1:] \<circ>\<^sub>p [:0, d - c:] \<noteq> 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
degree P \<le> p
P \<noteq> 0
c < d

goal (1 subgoal):
 1. P \<circ>\<^sub>p [:c, 1:] \<circ>\<^sub>p [:0, d - c:] \<noteq> 0
[PROOF STEP]
by (auto simp: pcompose_eq_0)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
int (proots_count Q {x. 0 < x \<and> x < 1}) \<le> Bernstein_changes_01 p Q \<and> even (Bernstein_changes_01 p Q - int (proots_count Q {x. 0 < x \<and> x < 1}))

goal (1 subgoal):
 1. int (proots_count P {x. c < x \<and> x < d}) \<le> Bernstein_changes p c d P \<and> even (Bernstein_changes p c d P - int (proots_count P {x. c < x \<and> x < d}))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
int (proots_count Q {x. 0 < x \<and> x < 1}) \<le> Bernstein_changes_01 p Q \<and> even (Bernstein_changes_01 p Q - int (proots_count Q {x. 0 < x \<and> x < 1}))

goal (1 subgoal):
 1. int (proots_count P {x. c < x \<and> x < d}) \<le> Bernstein_changes p c d P \<and> even (Bernstein_changes p c d P - int (proots_count P {x. c < x \<and> x < d}))
[PROOF STEP]
have "proots_count P {x. c < x \<and> x < d} =
            proots_count Q {x. 0 < x \<and> x < 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_count P {x. c < x \<and> x < d} = proots_count Q {x. 0 < x \<and> x < 1}
[PROOF STEP]
unfolding Q_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proots_count P {x. c < x \<and> x < d} = proots_count (P \<circ>\<^sub>p [:c, 1:] \<circ>\<^sub>p [:0, d - c:]) {x. 0 < x \<and> x < 1}
[PROOF STEP]
proof (subst proots_pcompose)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. P \<circ>\<^sub>p [:c, 1:] \<noteq> 0
 2. degree [:0, d - c:] = 1
 3. proots_count P {x. c < x \<and> x < d} = proots_count (P \<circ>\<^sub>p [:c, 1:]) (poly [:0, d - c:] ` {x. 0 < x \<and> x < 1})
[PROOF STEP]
have "poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1} =
        {x. c < x \<and> x < d}" (is "?L = ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1} = {x. c < x \<and> x < d}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1} \<subseteq> {x. c < x \<and> x < d}
 2. {x. c < x \<and> x < d} \<subseteq> poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1}
[PROOF STEP]
have "c + x * (d - c) < d" if "x < 1" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c + x * (d - c) < d
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c + x * (d - c) < d
[PROOF STEP]
have "x * (d - c) < 1 * (d - c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * (d - c) < 1 * (d - c)
[PROOF STEP]
using \<open>c < d\<close> that
[PROOF STATE]
proof (prove)
using this:
c < d
x < 1

goal (1 subgoal):
 1. x * (d - c) < 1 * (d - c)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
x * (d - c) < 1 * (d - c)

goal (1 subgoal):
 1. c + x * (d - c) < d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x * (d - c) < 1 * (d - c)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x * (d - c) < 1 * (d - c)

goal (1 subgoal):
 1. c + x * (d - c) < d
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
c + x * (d - c) < d

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x < 1 \<Longrightarrow> c + ?x * (d - c) < d

goal (2 subgoals):
 1. poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1} \<subseteq> {x. c < x \<and> x < d}
 2. {x. c < x \<and> x < d} \<subseteq> poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x < 1 \<Longrightarrow> c + ?x * (d - c) < d
[PROOF STEP]
show "?L \<subseteq> ?R"
[PROOF STATE]
proof (prove)
using this:
?x < 1 \<Longrightarrow> c + ?x * (d - c) < d

goal (1 subgoal):
 1. poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1} \<subseteq> {x. c < x \<and> x < d}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x < 1 \<Longrightarrow> c + ?x * (d - c) < d
degree P \<le> p
P \<noteq> 0
c < d

goal (1 subgoal):
 1. poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1} \<subseteq> {x. c < x \<and> x < d}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1} \<subseteq> {x. c < x \<and> x < d}

goal (1 subgoal):
 1. {x. c < x \<and> x < d} \<subseteq> poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {x. c < x \<and> x < d} \<subseteq> poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1}
[PROOF STEP]
show "?R \<subseteq> ?L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. c < x \<and> x < d} \<subseteq> poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {x. c < x \<and> x < d} \<Longrightarrow> x \<in> poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1}
[PROOF STEP]
fix x::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {x. c < x \<and> x < d} \<Longrightarrow> x \<in> poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1}
[PROOF STEP]
assume "x \<in> ?R"
[PROOF STATE]
proof (state)
this:
x \<in> {x. c < x \<and> x < d}

goal (1 subgoal):
 1. \<And>x. x \<in> {x. c < x \<and> x < d} \<Longrightarrow> x \<in> poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1}
[PROOF STEP]
hence "c < x" and "x < d"
[PROOF STATE]
proof (prove)
using this:
x \<in> {x. c < x \<and> x < d}

goal (1 subgoal):
 1. c < x &&& x < d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c < x
x < d

goal (1 subgoal):
 1. \<And>x. x \<in> {x. c < x \<and> x < d} \<Longrightarrow> x \<in> poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1}
[PROOF STEP]
thus "x \<in> ?L"
[PROOF STATE]
proof (prove)
using this:
c < x
x < d

goal (1 subgoal):
 1. x \<in> poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1}
[PROOF STEP]
proof (subst image_eqI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<lbrakk>c < x; x < d\<rbrakk> \<Longrightarrow> x = poly [:c, 1:] ?x2
 2. \<lbrakk>c < x; x < d\<rbrakk> \<Longrightarrow> ?x2 \<in> poly [:0, d - c:] ` {x. 0 < x \<and> x < 1}
 3. \<lbrakk>c < x; x < d\<rbrakk> \<Longrightarrow> True
[PROOF STEP]
show "x = poly [:c, 1:] (x - c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = poly [:c, 1:] (x - c)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
x = poly [:c, 1:] (x - c)

goal (2 subgoals):
 1. \<lbrakk>c < x; x < d\<rbrakk> \<Longrightarrow> x - c \<in> poly [:0, d - c:] ` {x. 0 < x \<and> x < 1}
 2. \<lbrakk>c < x; x < d\<rbrakk> \<Longrightarrow> True
[PROOF STEP]
assume "c < x" and "x < d"
[PROOF STATE]
proof (state)
this:
c < x
x < d

goal (2 subgoals):
 1. \<lbrakk>c < x; x < d\<rbrakk> \<Longrightarrow> x - c \<in> poly [:0, d - c:] ` {x. 0 < x \<and> x < 1}
 2. \<lbrakk>c < x; x < d\<rbrakk> \<Longrightarrow> True
[PROOF STEP]
thus "x - c \<in> poly [:0, d - c:] ` {x. 0 < x \<and> x < 1}"
[PROOF STATE]
proof (prove)
using this:
c < x
x < d

goal (1 subgoal):
 1. x - c \<in> poly [:0, d - c:] ` {x. 0 < x \<and> x < 1}
[PROOF STEP]
proof (subst image_eqI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<lbrakk>c < x; x < d\<rbrakk> \<Longrightarrow> x - c = poly [:0, d - c:] ?x2
 2. \<lbrakk>c < x; x < d\<rbrakk> \<Longrightarrow> ?x2 \<in> {x. 0 < x \<and> x < 1}
 3. \<lbrakk>c < x; x < d\<rbrakk> \<Longrightarrow> True
[PROOF STEP]
show "x - c = poly [:0, d - c:] ((x - c)/(d - c))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - c = poly [:0, d - c:] ((x - c) / (d - c))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
degree P \<le> p
P \<noteq> 0
c < d

goal (1 subgoal):
 1. x - c = poly [:0, d - c:] ((x - c) / (d - c))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x - c = poly [:0, d - c:] ((x - c) / (d - c))

goal (2 subgoals):
 1. \<lbrakk>c < x; x < d\<rbrakk> \<Longrightarrow> (x - c) / (d - c) \<in> {x. 0 < x \<and> x < 1}
 2. \<lbrakk>c < x; x < d\<rbrakk> \<Longrightarrow> True
[PROOF STEP]
assume "c < x" and "x < d"
[PROOF STATE]
proof (state)
this:
c < x
x < d

goal (2 subgoals):
 1. \<lbrakk>c < x; x < d\<rbrakk> \<Longrightarrow> (x - c) / (d - c) \<in> {x. 0 < x \<and> x < 1}
 2. \<lbrakk>c < x; x < d\<rbrakk> \<Longrightarrow> True
[PROOF STEP]
thus "(x - c) / (d - c) \<in> {x. 0 < x \<and> x < 1}"
[PROOF STATE]
proof (prove)
using this:
c < x
x < d

goal (1 subgoal):
 1. (x - c) / (d - c) \<in> {x. 0 < x \<and> x < 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x - c) / (d - c) \<in> {x. 0 < x \<and> x < 1}

goal (1 subgoal):
 1. \<lbrakk>c < x; x < d\<rbrakk> \<Longrightarrow> True
[PROOF STEP]
qed fast
[PROOF STATE]
proof (state)
this:
x - c \<in> poly [:0, d - c:] ` {x. 0 < x \<and> x < 1}

goal (1 subgoal):
 1. \<lbrakk>c < x; x < d\<rbrakk> \<Longrightarrow> True
[PROOF STEP]
qed fast
[PROOF STATE]
proof (state)
this:
x \<in> poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{x. c < x \<and> x < d} \<subseteq> poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1} = {x. c < x \<and> x < d}

goal (3 subgoals):
 1. P \<circ>\<^sub>p [:c, 1:] \<noteq> 0
 2. degree [:0, d - c:] = 1
 3. proots_count P {x. c < x \<and> x < d} = proots_count (P \<circ>\<^sub>p [:c, 1:]) (poly [:0, d - c:] ` {x. 0 < x \<and> x < 1})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1} = {x. c < x \<and> x < d}
[PROOF STEP]
show "proots_count P {x. c < x \<and> x < d} =
        proots_count (P \<circ>\<^sub>p [:c, 1:])
        (poly [:0, d - c:] ` {x. 0 < x \<and> x < 1})"
[PROOF STATE]
proof (prove)
using this:
poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1} = {x. c < x \<and> x < d}

goal (1 subgoal):
 1. proots_count P {x. c < x \<and> x < d} = proots_count (P \<circ>\<^sub>p [:c, 1:]) (poly [:0, d - c:] ` {x. 0 < x \<and> x < 1})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
poly [:c, 1:] ` poly [:0, d - c:] ` {x. 0 < x \<and> x < 1} = {x. c < x \<and> x < d}
degree P \<le> p
P \<noteq> 0
c < d

goal (1 subgoal):
 1. proots_count P {x. c < x \<and> x < d} = proots_count (P \<circ>\<^sub>p [:c, 1:]) (poly [:0, d - c:] ` {x. 0 < x \<and> x < 1})
[PROOF STEP]
by (auto simp:proots_pcompose)
[PROOF STATE]
proof (state)
this:
proots_count P {x. c < x \<and> x < d} = proots_count (P \<circ>\<^sub>p [:c, 1:]) (poly [:0, d - c:] ` {x. 0 < x \<and> x < 1})

goal (2 subgoals):
 1. P \<circ>\<^sub>p [:c, 1:] \<noteq> 0
 2. degree [:0, d - c:] = 1
[PROOF STEP]
show "P \<circ>\<^sub>p [:c, 1:] \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<circ>\<^sub>p [:c, 1:] \<noteq> 0
[PROOF STEP]
by (simp add: pcompose_eq_0 assms(2))
[PROOF STATE]
proof (state)
this:
P \<circ>\<^sub>p [:c, 1:] \<noteq> 0

goal (1 subgoal):
 1. degree [:0, d - c:] = 1
[PROOF STEP]
show "degree [:0, d - c:] = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree [:0, d - c:] = 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
degree P \<le> p
P \<noteq> 0
c < d

goal (1 subgoal):
 1. degree [:0, d - c:] = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree [:0, d - c:] = 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
proots_count P {x. c < x \<and> x < d} = proots_count Q {x. 0 < x \<and> x < 1}

goal (1 subgoal):
 1. int (proots_count P {x. c < x \<and> x < d}) \<le> Bernstein_changes p c d P \<and> even (Bernstein_changes p c d P - int (proots_count P {x. c < x \<and> x < d}))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
proots_count P {x. c < x \<and> x < d} = proots_count Q {x. 0 < x \<and> x < 1}

goal (1 subgoal):
 1. int (proots_count P {x. c < x \<and> x < d}) \<le> Bernstein_changes p c d P \<and> even (Bernstein_changes p c d P - int (proots_count P {x. c < x \<and> x < d}))
[PROOF STEP]
have " Bernstein_changes p c d P = Bernstein_changes_01 p Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bernstein_changes p c d P = Bernstein_changes_01 p Q
[PROOF STEP]
unfolding Q_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bernstein_changes p c d P = Bernstein_changes_01 p (P \<circ>\<^sub>p [:c, 1:] \<circ>\<^sub>p [:0, d - c:])
[PROOF STEP]
apply (rule Bernstein_changes_eq_rescale)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. c \<noteq> d
 2. degree P \<le> p
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
degree P \<le> p
P \<noteq> 0
c < d

goal (2 subgoals):
 1. c \<noteq> d
 2. degree P \<le> p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Bernstein_changes p c d P = Bernstein_changes_01 p Q

goal (1 subgoal):
 1. int (proots_count P {x. c < x \<and> x < d}) \<le> Bernstein_changes p c d P \<and> even (Bernstein_changes p c d P - int (proots_count P {x. c < x \<and> x < d}))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
int (proots_count Q {x. 0 < x \<and> x < 1}) \<le> Bernstein_changes_01 p Q \<and> even (Bernstein_changes_01 p Q - int (proots_count Q {x. 0 < x \<and> x < 1}))
proots_count P {x. c < x \<and> x < d} = proots_count Q {x. 0 < x \<and> x < 1}
Bernstein_changes p c d P = Bernstein_changes_01 p Q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
int (proots_count Q {x. 0 < x \<and> x < 1}) \<le> Bernstein_changes_01 p Q \<and> even (Bernstein_changes_01 p Q - int (proots_count Q {x. 0 < x \<and> x < 1}))
proots_count P {x. c < x \<and> x < d} = proots_count Q {x. 0 < x \<and> x < 1}
Bernstein_changes p c d P = Bernstein_changes_01 p Q

goal (1 subgoal):
 1. int (proots_count P {x. c < x \<and> x < d}) \<le> Bernstein_changes p c d P \<and> even (Bernstein_changes p c d P - int (proots_count P {x. c < x \<and> x < d}))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
int (proots_count P {x. c < x \<and> x < d}) \<le> Bernstein_changes p c d P \<and> even (Bernstein_changes p c d P - int (proots_count P {x. c < x \<and> x < d}))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma norm_of_complex [simp]: "norm (of_complex c :: 'a::complex_normed_algebra_1) = cmod c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (of_complex c) = cmod c
[PROOF STEP]
by (simp add: of_complex_def)


[STATEMENT]
lemma coeff_mult_Var: "MPoly_Type.coeff (x * Var i ^ p) c = (MPoly_Type.coeff x (c - monomial p i) when lookup c i \<ge> p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.coeff (x * Var i ^ p) c = (MPoly_Type.coeff x (c - monomial p i) when p \<le> lookup c i)
[PROOF STEP]
by transfer'
    (auto simp: Var\<^sub>0_def pprod.monomial_power lookup_times_monomial_right
      of_nat_times_monomial monomial_adds_nat_iff)


[STATEMENT]
lemma sunflower_iff_intersect_Uniq:
  "sunflower S \<longleftrightarrow> (\<forall> x.  x \<in> \<Inter> S \<or> (\<exists>\<^sub>\<le>\<^sub>1 A. A \<in> S \<and> x \<in> A))"
  (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sunflower S = (\<forall>x. x \<in> \<Inter> S \<or> (\<exists>\<^sub>\<le>\<^sub>1 A. A \<in> S \<and> x \<in> A))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sunflower S \<Longrightarrow> \<forall>x. x \<in> \<Inter> S \<or> (\<exists>\<^sub>\<le>\<^sub>1 A. A \<in> S \<and> x \<in> A)
 2. \<forall>x. x \<in> \<Inter> S \<or> (\<exists>\<^sub>\<le>\<^sub>1 A. A \<in> S \<and> x \<in> A) \<Longrightarrow> sunflower S
[PROOF STEP]
assume ?l
[PROOF STATE]
proof (state)
this:
sunflower S

goal (2 subgoals):
 1. sunflower S \<Longrightarrow> \<forall>x. x \<in> \<Inter> S \<or> (\<exists>\<^sub>\<le>\<^sub>1 A. A \<in> S \<and> x \<in> A)
 2. \<forall>x. x \<in> \<Inter> S \<or> (\<exists>\<^sub>\<le>\<^sub>1 A. A \<in> S \<and> x \<in> A) \<Longrightarrow> sunflower S
[PROOF STEP]
from sunflower_imp_union_intersect_unique[OF this]
[PROOF STATE]
proof (chain)
picking this:
?x \<in> \<Union> S - \<Inter> S \<Longrightarrow> \<exists>!A. A \<in> S \<and> ?x \<in> A
[PROOF STEP]
show ?r
[PROOF STATE]
proof (prove)
using this:
?x \<in> \<Union> S - \<Inter> S \<Longrightarrow> \<exists>!A. A \<in> S \<and> ?x \<in> A

goal (1 subgoal):
 1. \<forall>x. x \<in> \<Inter> S \<or> (\<exists>\<^sub>\<le>\<^sub>1 A. A \<in> S \<and> x \<in> A)
[PROOF STEP]
unfolding ex1_iff_ex_Uniq
[PROOF STATE]
proof (prove)
using this:
?x \<in> \<Union> S - \<Inter> S \<Longrightarrow> (\<exists>A. A \<in> S \<and> ?x \<in> A) \<and> (\<exists>\<^sub>\<le>\<^sub>1 A. A \<in> S \<and> ?x \<in> A)

goal (1 subgoal):
 1. \<forall>x. x \<in> \<Inter> S \<or> (\<exists>\<^sub>\<le>\<^sub>1 A. A \<in> S \<and> x \<in> A)
[PROOF STEP]
by (metis (no_types, lifting) DiffI UnionI Uniq_I)
[PROOF STATE]
proof (state)
this:
\<forall>x. x \<in> \<Inter> S \<or> (\<exists>\<^sub>\<le>\<^sub>1 A. A \<in> S \<and> x \<in> A)

goal (1 subgoal):
 1. \<forall>x. x \<in> \<Inter> S \<or> (\<exists>\<^sub>\<le>\<^sub>1 A. A \<in> S \<and> x \<in> A) \<Longrightarrow> sunflower S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>x. x \<in> \<Inter> S \<or> (\<exists>\<^sub>\<le>\<^sub>1 A. A \<in> S \<and> x \<in> A) \<Longrightarrow> sunflower S
[PROOF STEP]
assume ?r
[PROOF STATE]
proof (state)
this:
\<forall>x. x \<in> \<Inter> S \<or> (\<exists>\<^sub>\<le>\<^sub>1 A. A \<in> S \<and> x \<in> A)

goal (1 subgoal):
 1. \<forall>x. x \<in> \<Inter> S \<or> (\<exists>\<^sub>\<le>\<^sub>1 A. A \<in> S \<and> x \<in> A) \<Longrightarrow> sunflower S
[PROOF STEP]
show ?l
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sunflower S
[PROOF STEP]
by (rule union_intersect_unique_imp_sunflower, insert \<open>?r\<close>, auto)
[PROOF STATE]
proof (state)
this:
sunflower S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_prod_list [simp]: "poly (prod_list ps) x = prod_list (map (\<lambda>p. poly p x) ps)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (prod_list ps) x = (\<Prod>p\<leftarrow>ps. poly p x)
[PROOF STEP]
by (induction ps) auto


[STATEMENT]
lemma two_powr_nat_float[simp]: "2 powr (real i) \<in> float" for i :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 powr real i \<in> float
[PROOF STEP]
by (intro floatI[of 1 i]) simp