[STATEMENT]
lemma bijective_eq_bij: "bijective f = bij f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bijective f = bij f
[PROOF STEP]
proof(intro iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. bijective f \<Longrightarrow> bij f
 2. bij f \<Longrightarrow> bijective f
[PROOF STEP]
assume "bijective f"
[PROOF STATE]
proof (state)
this:
bijective f

goal (2 subgoals):
 1. bijective f \<Longrightarrow> bij f
 2. bij f \<Longrightarrow> bijective f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bijective f
[PROOF STEP]
interpret bijective f
[PROOF STATE]
proof (prove)
using this:
bijective f

goal (1 subgoal):
 1. bijective f
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. bijective f \<Longrightarrow> bij f
 2. bij f \<Longrightarrow> bijective f
[PROOF STEP]
show "bij f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij f
[PROOF STEP]
using injectivity surj
[PROOF STATE]
proof (prove)
using this:
f ?x = f ?y \<Longrightarrow> ?x = ?y
surj f

goal (1 subgoal):
 1. bij f
[PROOF STEP]
by (auto intro!: bijI injI)
[PROOF STATE]
proof (state)
this:
bij f

goal (1 subgoal):
 1. bij f \<Longrightarrow> bijective f
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bij f \<Longrightarrow> bijective f
[PROOF STEP]
assume "bij f"
[PROOF STATE]
proof (state)
this:
bij f

goal (1 subgoal):
 1. bij f \<Longrightarrow> bijective f
[PROOF STEP]
from this[unfolded bij_def]
[PROOF STATE]
proof (chain)
picking this:
inj f \<and> surj f
[PROOF STEP]
show "bijective f"
[PROOF STATE]
proof (prove)
using this:
inj f \<and> surj f

goal (1 subgoal):
 1. bijective f
[PROOF STEP]
by (unfold_locales, auto dest: injD)
[PROOF STATE]
proof (state)
this:
bijective f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma one_reducible_to_via_refl: "one_reducible_to_via A A (\<lambda> x. x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. one_reducible_to_via A A (\<lambda>x. x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. one_reducible_to_via A A (\<lambda>x. x)
[PROOF STEP]
have is_pr: "(\<lambda> x. x) \<in> PrimRec1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x) \<in> PrimRec1
[PROOF STEP]
by (rule pr_id1_1)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x) \<in> PrimRec1

goal (1 subgoal):
 1. one_reducible_to_via A A (\<lambda>x. x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. x) \<in> PrimRec1
[PROOF STEP]
have is_tr: "total_recursive (\<lambda> x. x)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. x) \<in> PrimRec1

goal (1 subgoal):
 1. total_recursive (\<lambda>x. x)
[PROOF STEP]
by (rule pr_is_total_rec)
[PROOF STATE]
proof (state)
this:
total_recursive (\<lambda>x. x)

goal (1 subgoal):
 1. one_reducible_to_via A A (\<lambda>x. x)
[PROOF STEP]
have is_inj: "inj (\<lambda> x. x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (\<lambda>x. x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inj (\<lambda>x. x)

goal (1 subgoal):
 1. one_reducible_to_via A A (\<lambda>x. x)
[PROOF STEP]
have L1: "\<forall> x. (x \<in> A) = (((\<lambda> x. x) x) \<in> A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. (x \<in> A) = (x \<in> A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>x. (x \<in> A) = (x \<in> A)

goal (1 subgoal):
 1. one_reducible_to_via A A (\<lambda>x. x)
[PROOF STEP]
with is_tr is_inj
[PROOF STATE]
proof (chain)
picking this:
total_recursive (\<lambda>x. x)
inj (\<lambda>x. x)
\<forall>x. (x \<in> A) = (x \<in> A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
total_recursive (\<lambda>x. x)
inj (\<lambda>x. x)
\<forall>x. (x \<in> A) = (x \<in> A)

goal (1 subgoal):
 1. one_reducible_to_via A A (\<lambda>x. x)
[PROOF STEP]
by (unfold one_reducible_to_via_def, auto)
[PROOF STATE]
proof (state)
this:
one_reducible_to_via A A (\<lambda>x. x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma product_of_basic_semialgs_is_semialg':
  assumes "A \<in> (basic_semialgs n)"
  assumes "B \<in> (basic_semialgs m)"
  shows "is_semialgebraic (n + m) (cartesian_product A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_semialgebraic (n + m) (cartesian_product A B)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. is_semialgebraic (n + m) (cartesian_product A B)
[PROOF STEP]
obtain k a where ka_def: "k > 0 \<and> a \<in> carrier (Q\<^sub>p[\<X>\<^bsub>n\<^esub>]) \<and> A = (basic_semialg_set n k a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k a. 0 < k \<and> a \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>]) \<and> A = basic_semialg_set n k a \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> {S. is_basic_semialg n S}
B \<in> {S. is_basic_semialg m S}

goal (1 subgoal):
 1. (\<And>k a. 0 < k \<and> a \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>]) \<and> A = basic_semialg_set n k a \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis is_basic_semialg_def mem_Collect_eq neq0_conv)
[PROOF STATE]
proof (state)
this:
0 < k \<and> a \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>]) \<and> A = basic_semialg_set n k a

goal (1 subgoal):
 1. is_semialgebraic (n + m) (cartesian_product A B)
[PROOF STEP]
obtain l b where lb_def: "l > 0 \<and> b \<in> carrier (Q\<^sub>p[\<X>\<^bsub>m\<^esub>]) \<and> B = (basic_semialg_set m l b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>l b. 0 < l \<and> b \<in> carrier (Q\<^sub>p [\<X>\<^bsub>m\<^esub>]) \<and> B = basic_semialg_set m l b \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis assms(2) gr_zeroI is_basic_semialg_def mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
0 < l \<and> b \<in> carrier (Q\<^sub>p [\<X>\<^bsub>m\<^esub>]) \<and> B = basic_semialg_set m l b

goal (1 subgoal):
 1. is_semialgebraic (n + m) (cartesian_product A B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_semialgebraic (n + m) (cartesian_product A B)
[PROOF STEP]
using ka_def lb_def assms product_of_basic_semialgs_is_semialg
[PROOF STATE]
proof (prove)
using this:
0 < k \<and> a \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>]) \<and> A = basic_semialg_set n k a
0 < l \<and> b \<in> carrier (Q\<^sub>p [\<X>\<^bsub>m\<^esub>]) \<and> B = basic_semialg_set m l b
A \<in> {S. is_basic_semialg n S}
B \<in> {S. is_basic_semialg m S}
\<lbrakk>0 < ?k; 0 < ?l; ?a \<in> carrier (Q\<^sub>p [\<X>\<^bsub>?n\<^esub>]); ?b \<in> carrier (Q\<^sub>p [\<X>\<^bsub>?m\<^esub>])\<rbrakk> \<Longrightarrow> is_semialgebraic (?n + ?m) (cartesian_product (basic_semialg_set ?n ?k ?a) (basic_semialg_set ?m ?l ?b))

goal (1 subgoal):
 1. is_semialgebraic (n + m) (cartesian_product A B)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
is_semialgebraic (n + m) (cartesian_product A B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in semiring_0) pnormal_last_nonzero: "pnormal p \<Longrightarrow> last p \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pnormal p \<Longrightarrow> last p \<noteq> (0::'a)
[PROOF STEP]
by (induct p) (simp_all add: pnormal_def split: if_split_asm)


[STATEMENT]
lemma proj_Eps:
  assumes "equiv A r" and "X \<in> A//r"
  shows "proj r (Eps (\<lambda>x. x \<in> X)) = X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj r (SOME x. x \<in> X) = X
[PROOF STEP]
unfolding proj_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r `` {SOME x. x \<in> X} = X
[PROOF STEP]
proof auto
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. (SOME x. x \<in> X, x) \<in> r \<Longrightarrow> x \<in> X
 2. \<And>x. x \<in> X \<Longrightarrow> (SOME x. x \<in> X, x) \<in> r
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. (SOME x. x \<in> X, x) \<in> r \<Longrightarrow> x \<in> X
 2. \<And>x. x \<in> X \<Longrightarrow> (SOME x. x \<in> X, x) \<in> r
[PROOF STEP]
assume x: "x \<in> X"
[PROOF STATE]
proof (state)
this:
x \<in> X

goal (2 subgoals):
 1. \<And>x. (SOME x. x \<in> X, x) \<in> r \<Longrightarrow> x \<in> X
 2. \<And>x. x \<in> X \<Longrightarrow> (SOME x. x \<in> X, x) \<in> r
[PROOF STEP]
thus "(Eps (\<lambda>x. x \<in> X), x) \<in> r"
[PROOF STATE]
proof (prove)
using this:
x \<in> X

goal (1 subgoal):
 1. (SOME x. x \<in> X, x) \<in> r
[PROOF STEP]
using assms equiv_Eps_in in_quotient_imp_in_rel
[PROOF STATE]
proof (prove)
using this:
x \<in> X
equiv A r
X \<in> A // r
\<lbrakk>equiv ?A ?r; ?X \<in> ?A // ?r\<rbrakk> \<Longrightarrow> (SOME x. x \<in> ?X) \<in> ?X
\<lbrakk>equiv ?A ?r; ?X \<in> ?A // ?r; {?x, ?y} \<subseteq> ?X\<rbrakk> \<Longrightarrow> (?x, ?y) \<in> ?r

goal (1 subgoal):
 1. (SOME x. x \<in> X, x) \<in> r
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
(SOME x. x \<in> X, x) \<in> r

goal (1 subgoal):
 1. \<And>x. (SOME x. x \<in> X, x) \<in> r \<Longrightarrow> x \<in> X
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (SOME x. x \<in> X, x) \<in> r \<Longrightarrow> x \<in> X
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (SOME x. x \<in> X, x) \<in> r \<Longrightarrow> x \<in> X
[PROOF STEP]
assume "(Eps (\<lambda>x. x \<in> X),x) \<in> r"
[PROOF STATE]
proof (state)
this:
(SOME x. x \<in> X, x) \<in> r

goal (1 subgoal):
 1. \<And>x. (SOME x. x \<in> X, x) \<in> r \<Longrightarrow> x \<in> X
[PROOF STEP]
thus "x \<in> X"
[PROOF STATE]
proof (prove)
using this:
(SOME x. x \<in> X, x) \<in> r

goal (1 subgoal):
 1. x \<in> X
[PROOF STEP]
using in_quotient_imp_closed[OF assms equiv_Eps_in[OF assms]]
[PROOF STATE]
proof (prove)
using this:
(SOME x. x \<in> X, x) \<in> r
(SOME x. x \<in> X, ?y) \<in> r \<Longrightarrow> ?y \<in> X

goal (1 subgoal):
 1. x \<in> X
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
x \<in> X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_list_of_pdevs_domain_eq:
  "sorted_list_of_set (pdevs_domain X) = filter ((\<noteq>) 0 o pdevs_apply X) [0..<degree X]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_list_of_set (pdevs_domain X) = filter ((\<noteq>) (0::'a) \<circ> pdevs_apply X) [0..<degree X]
[PROOF STEP]
by (auto simp: degree_gt intro!: sorted_distinct_set_unique sorted_filter[of "\<lambda>x. x", simplified])


[STATEMENT]
lemma exp_lower_taylor_2:
  fixes x::real
  shows "1 + x + (1/2)*x^2 + (1/6)*x^3 \<le> exp x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + x + 1 / 2 * x\<^sup>2 + 1 / 6 * x ^ 3 \<le> exp x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 + x + 1 / 2 * x\<^sup>2 + 1 / 6 * x ^ 3 \<le> exp x
[PROOF STEP]
have "even (4::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. even 4
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
even 4

goal (1 subgoal):
 1. 1 + x + 1 / 2 * x\<^sup>2 + 1 / 6 * x ^ 3 \<le> exp x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
even 4
[PROOF STEP]
have "(\<Sum>m<4. x ^ m / (fact m)) \<le> exp x"
[PROOF STATE]
proof (prove)
using this:
even 4

goal (1 subgoal):
 1. (\<Sum>m<4. x ^ m / fact m) \<le> exp x
[PROOF STEP]
by (rule exp_lower_taylor_even)
[PROOF STATE]
proof (state)
this:
(\<Sum>m<4. x ^ m / fact m) \<le> exp x

goal (1 subgoal):
 1. 1 + x + 1 / 2 * x\<^sup>2 + 1 / 6 * x ^ 3 \<le> exp x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>m<4. x ^ m / fact m) \<le> exp x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>m<4. x ^ m / fact m) \<le> exp x

goal (1 subgoal):
 1. 1 + x + 1 / 2 * x\<^sup>2 + 1 / 6 * x ^ 3 \<le> exp x
[PROOF STEP]
by (auto simp add: numeral_eq_Suc)
[PROOF STATE]
proof (state)
this:
1 + x + 1 / 2 * x\<^sup>2 + 1 / 6 * x ^ 3 \<le> exp x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dim_solution_set_not_zero_imp_infinite_solutions_homogeneous:
fixes A::"'a::{field, semiring_char_0}^'n::{mod_type}^'rows::{mod_type}"
assumes dim_not_zero: "vec.dim (solution_set A 0) > 0"
shows "infinite (solution_set A 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite (solution_set A 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite (solution_set A 0)
[PROOF STEP]
have "solution_set A 0 \<noteq> {0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. solution_set A 0 \<noteq> {0}
[PROOF STEP]
using vec.dim_zero_subspace_eq[of "solution_set A 0"] dim_not_zero
[PROOF STATE]
proof (prove)
using this:
vec.subspace (solution_set A 0) \<Longrightarrow> (vec.dim (solution_set A 0) = 0) = (solution_set A 0 = {0})
0 < vec.dim (solution_set A 0)

goal (1 subgoal):
 1. solution_set A 0 \<noteq> {0}
[PROOF STEP]
by (metis less_numeral_extra(3) vec.dim_zero_eq')
[PROOF STATE]
proof (state)
this:
solution_set A 0 \<noteq> {0}

goal (1 subgoal):
 1. infinite (solution_set A 0)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
solution_set A 0 \<noteq> {0}
[PROOF STEP]
obtain x where x: "x \<in> solution_set A 0" and x_not_0: "x \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
solution_set A 0 \<noteq> {0}

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> solution_set A 0; x \<noteq> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using vec.subspace_0[OF homogeneous_solution_set_subspace, of A]
[PROOF STATE]
proof (prove)
using this:
solution_set A 0 \<noteq> {0}
0 \<in> solution_set A 0

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> solution_set A 0; x \<noteq> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> solution_set A 0
x \<noteq> 0

goal (1 subgoal):
 1. infinite (solution_set A 0)
[PROOF STEP]
define f where "f = (\<lambda>n::nat. (of_nat n) *s x)"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>n. of_nat n *s x)

goal (1 subgoal):
 1. infinite (solution_set A 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite (solution_set A 0)
[PROOF STEP]
proof (unfold infinite_iff_countable_subset, rule exI[of _ f], rule conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj f
 2. range f \<subseteq> solution_set A 0
[PROOF STEP]
show "inj f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj f
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>UNIV. \<forall>y\<in>UNIV. f x = f y \<longrightarrow> x = y
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>xa\<in>UNIV. \<forall>y\<in>UNIV. of_nat xa *s x = of_nat y *s x \<longrightarrow> xa = y
[PROOF STEP]
using x_not_0
[PROOF STATE]
proof (prove)
using this:
x \<noteq> 0

goal (1 subgoal):
 1. \<forall>xa\<in>UNIV. \<forall>y\<in>UNIV. of_nat xa *s x = of_nat y *s x \<longrightarrow> xa = y
[PROOF STEP]
by (auto simp: vec_eq_iff)
[PROOF STATE]
proof (state)
this:
inj f

goal (1 subgoal):
 1. range f \<subseteq> solution_set A 0
[PROOF STEP]
show "range f \<subseteq> solution_set A 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range f \<subseteq> solution_set A 0
[PROOF STEP]
using homogeneous_solution_set_subspace
[PROOF STATE]
proof (prove)
using this:
vec.subspace (solution_set ?A 0)

goal (1 subgoal):
 1. range f \<subseteq> solution_set A 0
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
vec.subspace (solution_set ?A 0)
x \<in> solution_set A 0

goal (1 subgoal):
 1. range f \<subseteq> solution_set A 0
[PROOF STEP]
unfolding vec.subspace_def image_def f_def
[PROOF STATE]
proof (prove)
using this:
0 \<in> solution_set ?A 0 \<and> (\<forall>x\<in>solution_set ?A 0. \<forall>y\<in>solution_set ?A 0. x + y \<in> solution_set ?A 0) \<and> (\<forall>c. \<forall>x\<in>solution_set ?A 0. c *s x \<in> solution_set ?A 0)
x \<in> solution_set A 0

goal (1 subgoal):
 1. {y. \<exists>xa\<in>UNIV. y = of_nat xa *s x} \<subseteq> solution_set A 0
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
range f \<subseteq> solution_set A 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
infinite (solution_set A 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gcard_image_le:
  assumes "small A" shows "gcard (f ` A) \<le> gcard A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcard (f ` A) \<le> gcard A
[PROOF STEP]
using assms image_lepoll lepoll_imp_gcard_le
[PROOF STATE]
proof (prove)
using this:
small A
?f ` ?A \<lesssim> ?A
\<lbrakk>?A \<lesssim> ?B; small ?B\<rbrakk> \<Longrightarrow> gcard ?A \<le> gcard ?B

goal (1 subgoal):
 1. gcard (f ` A) \<le> gcard A
[PROOF STEP]
by blast


[STATEMENT]
lemma polyhedron_hyperplane:
  fixes a :: "'a :: euclidean_space"
  shows "polyhedron {x. a \<bullet> x = b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. polyhedron {x. a \<bullet> x = b}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. polyhedron {x. a \<bullet> x = b}
[PROOF STEP]
have "{x. a \<bullet> x = b} = {x. a \<bullet> x \<le> b} \<inter> {x. a \<bullet> x \<ge> b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. a \<bullet> x = b} = {x. a \<bullet> x \<le> b} \<inter> {x. b \<le> a \<bullet> x}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
{x. a \<bullet> x = b} = {x. a \<bullet> x \<le> b} \<inter> {x. b \<le> a \<bullet> x}

goal (1 subgoal):
 1. polyhedron {x. a \<bullet> x = b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{x. a \<bullet> x = b} = {x. a \<bullet> x \<le> b} \<inter> {x. b \<le> a \<bullet> x}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{x. a \<bullet> x = b} = {x. a \<bullet> x \<le> b} \<inter> {x. b \<le> a \<bullet> x}

goal (1 subgoal):
 1. polyhedron {x. a \<bullet> x = b}
[PROOF STEP]
by (simp add: polyhedron_halfspace_ge polyhedron_halfspace_le)
[PROOF STATE]
proof (state)
this:
polyhedron {x. a \<bullet> x = b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma DERIV_isconst2:
  fixes f :: "real \<Rightarrow> real"
  assumes "a < b" and contf: "continuous_on {a..b} f" and derf: "\<And>x. \<lbrakk>a < x; x < b\<rbrakk> \<Longrightarrow> DERIV f x :> 0"
    and "a \<le> x" "x \<le> b"
shows "f x = f a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x = f a
[PROOF STEP]
proof (cases "a < x")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a < x \<Longrightarrow> f x = f a
 2. \<not> a < x \<Longrightarrow> f x = f a
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a < x

goal (2 subgoals):
 1. a < x \<Longrightarrow> f x = f a
 2. \<not> a < x \<Longrightarrow> f x = f a
[PROOF STEP]
have *: "continuous_on {a..x} f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {a..x} f
[PROOF STEP]
using \<open>x \<le> b\<close> contf continuous_on_subset
[PROOF STATE]
proof (prove)
using this:
x \<le> b
continuous_on {a..b} f
\<lbrakk>continuous_on ?s ?f; ?t \<subseteq> ?s\<rbrakk> \<Longrightarrow> continuous_on ?t ?f

goal (1 subgoal):
 1. continuous_on {a..x} f
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
continuous_on {a..x} f

goal (2 subgoals):
 1. a < x \<Longrightarrow> f x = f a
 2. \<not> a < x \<Longrightarrow> f x = f a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x = f a
[PROOF STEP]
by (rule DERIV_isconst_end [OF True *]) (use \<open>x \<le> b\<close> derf in auto)
[PROOF STATE]
proof (state)
this:
f x = f a

goal (1 subgoal):
 1. \<not> a < x \<Longrightarrow> f x = f a
[PROOF STEP]
qed (use \<open>a \<le> x\<close> in auto)


[STATEMENT]
theorem second_mean_value_theorem_full:
  fixes f :: "real \<Rightarrow> real"
  assumes f: "f integrable_on {a..b}" and "a \<le> b"
    and g: "\<And>x y. \<lbrakk>a \<le> x; x \<le> y; y \<le> b\<rbrakk> \<Longrightarrow> g x \<le> g y"
  obtains c where "c \<in> {a..b}"
    and "((\<lambda>x. g x * f x) has_integral (g a * integral {a..c} f + g b * integral {c..b} f)) {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c. \<lbrakk>c \<in> {a..b}; ((\<lambda>x. g x * f x) has_integral g a * integral {a..c} f + g b * integral {c..b} f) {a..b}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>c. \<lbrakk>c \<in> {a..b}; ((\<lambda>x. g x * f x) has_integral g a * integral {a..c} f + g b * integral {c..b} f) {a..b}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have gab: "g a \<le> g b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g a \<le> g b
[PROOF STEP]
using \<open>a \<le> b\<close> g
[PROOF STATE]
proof (prove)
using this:
a \<le> b
\<lbrakk>a \<le> ?x; ?x \<le> ?y; ?y \<le> b\<rbrakk> \<Longrightarrow> g ?x \<le> g ?y

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

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>c \<in> {a..b}; ((\<lambda>x. g x * f x) has_integral g a * integral {a..c} f + g b * integral {c..b} f) {a..b}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g a \<le> g b
[PROOF STEP]
consider "g a < g b" | "g a = g b"
[PROOF STATE]
proof (prove)
using this:
g a \<le> g b

goal (1 subgoal):
 1. \<lbrakk>g a < g b \<Longrightarrow> thesis; g a = g b \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<lbrakk>g a < g b \<Longrightarrow> ?thesis; g a = g b \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>c \<in> {a..b}; ((\<lambda>x. g x * f x) has_integral g a * integral {a..c} f + g b * integral {c..b} f) {a..b}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>g a < g b \<Longrightarrow> ?thesis; g a = g b \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>g a < g b \<Longrightarrow> ?thesis; g a = g b \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. thesis
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. g a < g b \<Longrightarrow> thesis
 2. g a = g b \<Longrightarrow> thesis
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
g a < g b

goal (2 subgoals):
 1. g a < g b \<Longrightarrow> thesis
 2. g a = g b \<Longrightarrow> thesis
[PROOF STEP]
define h where "h \<equiv> \<lambda>x. if x < a then 0 else if b < x then 1
                             else (g x - g a) / (g b - g a)"
[PROOF STATE]
proof (state)
this:
h \<equiv> \<lambda>x. if x < a then 0 else if b < x then 1 else (g x - g a) / (g b - g a)

goal (2 subgoals):
 1. g a < g b \<Longrightarrow> thesis
 2. g a = g b \<Longrightarrow> thesis
[PROOF STEP]
obtain c where "a \<le> c" "c \<le> b" and c: "((\<lambda>x. h x *\<^sub>R f x) has_integral integral {c..b} f) {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c. \<lbrakk>a \<le> c; c \<le> b; ((\<lambda>x. h x *\<^sub>R f x) has_integral integral {c..b} f) {a..b}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof (rule SMVT_lemma4 [OF f \<open>a \<le> b\<close>, of h])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x y. \<lbrakk>\<And>c. \<lbrakk>a \<le> c; c \<le> b; ((\<lambda>x. h x *\<^sub>R f x) has_integral integral {c..b} f) {a..b}\<rbrakk> \<Longrightarrow> thesis; x \<le> y\<rbrakk> \<Longrightarrow> h x \<le> h y
 2. \<And>x. \<lbrakk>\<And>c. \<lbrakk>a \<le> c; c \<le> b; ((\<lambda>x. h x *\<^sub>R f x) has_integral integral {c..b} f) {a..b}\<rbrakk> \<Longrightarrow> thesis; a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> 0 \<le> h x \<and> h x \<le> 1
 3. \<And>c. \<lbrakk>\<And>c. \<lbrakk>a \<le> c; c \<le> b; ((\<lambda>x. h x *\<^sub>R f x) has_integral integral {c..b} f) {a..b}\<rbrakk> \<Longrightarrow> thesis; a \<le> c; c \<le> b; ((\<lambda>x. h x *\<^sub>R f x) has_integral integral {c..b} f) {a..b}\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "h x \<le> h y" "0 \<le> h x \<and> h x \<le> 1"  if "x \<le> y" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h x \<le> h y &&& 0 \<le> h x \<and> h x \<le> 1
[PROOF STEP]
using that gab
[PROOF STATE]
proof (prove)
using this:
x \<le> y
g a \<le> g b

goal (1 subgoal):
 1. h x \<le> h y &&& 0 \<le> h x \<and> h x \<le> 1
[PROOF STEP]
by (auto simp: divide_simps g h_def)
[PROOF STATE]
proof (state)
this:
?x \<le> ?y \<Longrightarrow> h ?x \<le> h ?y
?x \<le> ?y \<Longrightarrow> 0 \<le> h ?x \<and> h ?x \<le> 1

goal (1 subgoal):
 1. \<And>c. \<lbrakk>\<And>c. \<lbrakk>a \<le> c; c \<le> b; ((\<lambda>x. h x *\<^sub>R f x) has_integral integral {c..b} f) {a..b}\<rbrakk> \<Longrightarrow> thesis; a \<le> c; c \<le> b; ((\<lambda>x. h x *\<^sub>R f x) has_integral integral {c..b} f) {a..b}\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a \<le> c
c \<le> b
((\<lambda>x. h x *\<^sub>R f x) has_integral integral {c..b} f) {a..b}

goal (2 subgoals):
 1. g a < g b \<Longrightarrow> thesis
 2. g a = g b \<Longrightarrow> thesis
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. thesis
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?c \<in> {a..b}
 2. ((\<lambda>x. g x * f x) has_integral g a * integral {a..?c} f + g b * integral {?c..b} f) {a..b}
[PROOF STEP]
show "c \<in> {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<in> {a..b}
[PROOF STEP]
using \<open>a \<le> c\<close> \<open>c \<le> b\<close>
[PROOF STATE]
proof (prove)
using this:
a \<le> c
c \<le> b

goal (1 subgoal):
 1. c \<in> {a..b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c \<in> {a..b}

goal (1 subgoal):
 1. ((\<lambda>x. g x * f x) has_integral g a * integral {a..c} f + g b * integral {c..b} f) {a..b}
[PROOF STEP]
have I: "((\<lambda>x. g x * f x - g a * f x) has_integral (g b - g a) * integral {c..b} f) {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. g x * f x - g a * f x) has_integral (g b - g a) * integral {c..b} f) {a..b}
[PROOF STEP]
proof (subst has_integral_cong)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> {a..b} \<Longrightarrow> g x * f x - g a * f x = ?g x
 2. (?g has_integral (g b - g a) * integral {c..b} f) {a..b}
[PROOF STEP]
show "g x * f x - g a * f x = (g b - g a) * h x *\<^sub>R f x"
          if "x \<in> {a..b}" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g x * f x - g a * f x = (g b - g a) * h x *\<^sub>R f x
[PROOF STEP]
using 1 that
[PROOF STATE]
proof (prove)
using this:
g a < g b
x \<in> {a..b}

goal (1 subgoal):
 1. g x * f x - g a * f x = (g b - g a) * h x *\<^sub>R f x
[PROOF STEP]
by (simp add: h_def field_split_simps)
[PROOF STATE]
proof (state)
this:
?x \<in> {a..b} \<Longrightarrow> g ?x * f ?x - g a * f ?x = (g b - g a) * h ?x *\<^sub>R f ?x

goal (1 subgoal):
 1. ((\<lambda>x. (g b - g a) * h x *\<^sub>R f x) has_integral (g b - g a) * integral {c..b} f) {a..b}
[PROOF STEP]
show "((\<lambda>x. (g b - g a) * h x *\<^sub>R f x) has_integral (g b - g a) * integral {c..b} f) {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. (g b - g a) * h x *\<^sub>R f x) has_integral (g b - g a) * integral {c..b} f) {a..b}
[PROOF STEP]
using has_integral_mult_right [OF c, of "g b - g a"]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. (g b - g a) * h x *\<^sub>R f x) has_integral (g b - g a) * integral {c..b} f) {a..b}

goal (1 subgoal):
 1. ((\<lambda>x. (g b - g a) * h x *\<^sub>R f x) has_integral (g b - g a) * integral {c..b} f) {a..b}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((\<lambda>x. (g b - g a) * h x *\<^sub>R f x) has_integral (g b - g a) * integral {c..b} f) {a..b}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
((\<lambda>x. g x * f x - g a * f x) has_integral (g b - g a) * integral {c..b} f) {a..b}

goal (1 subgoal):
 1. ((\<lambda>x. g x * f x) has_integral g a * integral {a..c} f + g b * integral {c..b} f) {a..b}
[PROOF STEP]
have II: "((\<lambda>x. g a * f x) has_integral g a * integral {a..b} f) {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. g a * f x) has_integral g a * integral {a..b} f) {a..b}
[PROOF STEP]
using has_integral_mult_right [where c = "g a", OF integrable_integral [OF f]]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. g a * f x) has_integral g a * integral {a..b} f) {a..b}

goal (1 subgoal):
 1. ((\<lambda>x. g a * f x) has_integral g a * integral {a..b} f) {a..b}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((\<lambda>x. g a * f x) has_integral g a * integral {a..b} f) {a..b}

goal (1 subgoal):
 1. ((\<lambda>x. g x * f x) has_integral g a * integral {a..c} f + g b * integral {c..b} f) {a..b}
[PROOF STEP]
have "((\<lambda>x. g x * f x) has_integral (g b - g a) * integral {c..b} f + g a * integral {a..b} f) {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. g x * f x) has_integral (g b - g a) * integral {c..b} f + g a * integral {a..b} f) {a..b}
[PROOF STEP]
using has_integral_add [OF I II]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. g x * f x - g a * f x + g a * f x) has_integral (g b - g a) * integral {c..b} f + g a * integral {a..b} f) {a..b}

goal (1 subgoal):
 1. ((\<lambda>x. g x * f x) has_integral (g b - g a) * integral {c..b} f + g a * integral {a..b} f) {a..b}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>x. g x * f x) has_integral (g b - g a) * integral {c..b} f + g a * integral {a..b} f) {a..b}

goal (1 subgoal):
 1. ((\<lambda>x. g x * f x) has_integral g a * integral {a..c} f + g b * integral {c..b} f) {a..b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. g x * f x) has_integral (g b - g a) * integral {c..b} f + g a * integral {a..b} f) {a..b}
[PROOF STEP]
show "((\<lambda>x. g x * f x) has_integral g a * integral {a..c} f + g b * integral {c..b} f) {a..b}"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. g x * f x) has_integral (g b - g a) * integral {c..b} f + g a * integral {a..b} f) {a..b}

goal (1 subgoal):
 1. ((\<lambda>x. g x * f x) has_integral g a * integral {a..c} f + g b * integral {c..b} f) {a..b}
[PROOF STEP]
by (simp add: algebra_simps flip: integral_combine [OF \<open>a \<le> c\<close> \<open>c \<le> b\<close> f])
[PROOF STATE]
proof (state)
this:
((\<lambda>x. g x * f x) has_integral g a * integral {a..c} f + g b * integral {c..b} f) {a..b}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
thesis

goal (1 subgoal):
 1. g a = g b \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. g a = g b \<Longrightarrow> thesis
[PROOF STEP]
case 2
[PROOF STATE]
proof (state)
this:
g a = g b

goal (1 subgoal):
 1. g a = g b \<Longrightarrow> thesis
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. thesis
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?c \<in> {a..b}
 2. ((\<lambda>x. g x * f x) has_integral g a * integral {a..?c} f + g b * integral {?c..b} f) {a..b}
[PROOF STEP]
show "a \<in> {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> {a..b}
[PROOF STEP]
by (simp add: \<open>a \<le> b\<close>)
[PROOF STATE]
proof (state)
this:
a \<in> {a..b}

goal (1 subgoal):
 1. ((\<lambda>x. g x * f x) has_integral g a * integral {a..a} f + g b * integral {a..b} f) {a..b}
[PROOF STEP]
have "((\<lambda>x. g x * f x) has_integral g a * integral {a..b} f) {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. g x * f x) has_integral g a * integral {a..b} f) {a..b}
[PROOF STEP]
proof (rule has_integral_eq)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> {a..b} \<Longrightarrow> ?f x = g x * f x
 2. (?f has_integral g a * integral {a..b} f) {a..b}
[PROOF STEP]
show "((\<lambda>x. g a * f x) has_integral g a * integral {a..b} f) {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. g a * f x) has_integral g a * integral {a..b} f) {a..b}
[PROOF STEP]
using f has_integral_mult_right
[PROOF STATE]
proof (prove)
using this:
f integrable_on {a..b}
(?f has_integral ?y) ?i \<Longrightarrow> ((\<lambda>x. ?c * ?f x) has_integral ?c * ?y) ?i

goal (1 subgoal):
 1. ((\<lambda>x. g a * f x) has_integral g a * integral {a..b} f) {a..b}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
((\<lambda>x. g a * f x) has_integral g a * integral {a..b} f) {a..b}

goal (1 subgoal):
 1. \<And>x. x \<in> {a..b} \<Longrightarrow> g a * f x = g x * f x
[PROOF STEP]
show "g a * f x = g x * f x"
          if "x \<in> {a..b}" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g a * f x = g x * f x
[PROOF STEP]
by (metis atLeastAtMost_iff g less_eq_real_def not_le that 2)
[PROOF STATE]
proof (state)
this:
?x \<in> {a..b} \<Longrightarrow> g a * f ?x = g ?x * f ?x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
((\<lambda>x. g x * f x) has_integral g a * integral {a..b} f) {a..b}

goal (1 subgoal):
 1. ((\<lambda>x. g x * f x) has_integral g a * integral {a..a} f + g b * integral {a..b} f) {a..b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. g x * f x) has_integral g a * integral {a..b} f) {a..b}
[PROOF STEP]
show "((\<lambda>x. g x * f x) has_integral g a * integral {a..a} f + g b * integral {a..b} f) {a..b}"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. g x * f x) has_integral g a * integral {a..b} f) {a..b}

goal (1 subgoal):
 1. ((\<lambda>x. g x * f x) has_integral g a * integral {a..a} f + g b * integral {a..b} f) {a..b}
[PROOF STEP]
by (simp add: 2)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. g x * f x) has_integral g a * integral {a..a} f + g b * integral {a..b} f) {a..b}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Pring_add_zero:
  assumes "a \<in> carrier (Pring R I)"
  shows "a \<oplus>\<^bsub>Pring R I\<^esub> \<zero>\<^bsub>Pring R I\<^esub> = a"
        "\<zero>\<^bsub>Pring R I\<^esub> \<oplus>\<^bsub>Pring R I\<^esub> a  = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<oplus>\<^bsub>Pring R I\<^esub> \<zero>\<^bsub>Pring R I\<^esub> = a &&& \<zero>\<^bsub>Pring R I\<^esub> \<oplus>\<^bsub>Pring R I\<^esub> a = a
[PROOF STEP]
using assms Pring_zero Pring_add
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (Pring R I)
\<zero>\<^bsub>Pring R ?I\<^esub> = indexed_const \<zero>
?a \<oplus>\<^bsub>Pring R ?I\<^esub> ?b = ?a \<Oplus> ?b

goal (1 subgoal):
 1. a \<oplus>\<^bsub>Pring R I\<^esub> \<zero>\<^bsub>Pring R I\<^esub> = a &&& \<zero>\<^bsub>Pring R I\<^esub> \<oplus>\<^bsub>Pring R I\<^esub> a = a
[PROOF STEP]
apply (metis Pring_carrier_coeff indexed_padd_zero(1))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<zero>\<^bsub>Pring R I\<^esub> \<oplus>\<^bsub>Pring R I\<^esub> a = a
[PROOF STEP]
using assms Pring_zero Pring_add
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (Pring R I)
\<zero>\<^bsub>Pring R ?I\<^esub> = indexed_const \<zero>
?a \<oplus>\<^bsub>Pring R ?I\<^esub> ?b = ?a \<Oplus> ?b

goal (1 subgoal):
 1. \<zero>\<^bsub>Pring R I\<^esub> \<oplus>\<^bsub>Pring R I\<^esub> a = a
[PROOF STEP]
by (metis Pring_carrier_coeff indexed_padd_zero(2))


[STATEMENT]
lemma dirichlet_prod_mangoldt1_floor_bigo:
  includes prime_counting_notation
  shows "(\<lambda>x. dirichlet_prod' (\<lambda>n. ind prime n * ln n) floor x - x * ln x) \<in> O(\<lambda>x. x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. dirichlet_prod' (\<lambda>n. ind prime n * ln (real n)) (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x) \<in> O(\<lambda>x. x)
[PROOF STEP]
proof -
  \<comment> \<open>This is a perhaps somewhat roundabout way of proving this statement. We show this using
      the asymptotics of \<open>\<MM>\<close>: $\mathfrak{M}(x) = \ln x + O(1)$

      We proved this before (which was a bit of work, but not that much).
      Apostol, on the other hand, shows the following statement first and then deduces the
      asymptotics of \<open>\<MM>\<close> with Shapiro's Tauberian theorem instead. This might save a bit of
      work, but it is probably negligible.\<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. dirichlet_prod' (\<lambda>n. ind prime n * ln (real n)) (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x) \<in> O(\<lambda>x. x)
[PROOF STEP]
define R where "R = (\<lambda>x. sum_upto (\<lambda>i. ind prime i * ln i * frac (x / i)) x)"
[PROOF STATE]
proof (state)
this:
R = (\<lambda>x. sum_upto (\<lambda>i. ind prime i * ln (real i) * frac (x / real i)) x)

goal (1 subgoal):
 1. (\<lambda>x. dirichlet_prod' (\<lambda>n. ind prime n * ln (real n)) (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x) \<in> O(\<lambda>x. x)
[PROOF STEP]
have *: "R x \<in> {0..ln 4 * x}" if "x \<ge> 1" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R x \<in> {0..ln 4 * x}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. R x \<in> {0..ln 4 * x}
[PROOF STEP]
have "R x \<le> \<theta> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R x \<le> \<theta> x
[PROOF STEP]
unfolding R_def prime_sum_upto_altdef1 sum_upto_def \<theta>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i | 0 < i \<and> real i \<le> x. ind prime i * ln (real i) * frac (x / real i)) \<le> (\<Sum>p\<in>{i. 0 < i \<and> real i \<le> x}. ind prime p * ln (real p))
[PROOF STEP]
by (intro sum_mono) (auto simp: ind_def less_imp_le[OF frac_lt_1] dest!: prime_gt_1_nat)
[PROOF STATE]
proof (state)
this:
R x \<le> \<theta> x

goal (1 subgoal):
 1. R x \<in> {0..ln 4 * x}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
R x \<le> \<theta> x

goal (1 subgoal):
 1. R x \<in> {0..ln 4 * x}
[PROOF STEP]
have "\<dots> < ln 4 * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<theta> x < ln 4 * x
[PROOF STEP]
by (rule \<theta>_upper_bound) fact+
[PROOF STATE]
proof (state)
this:
\<theta> x < ln 4 * x

goal (1 subgoal):
 1. R x \<in> {0..ln 4 * x}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
R x < ln 4 * x
[PROOF STEP]
have "R x \<le> ln 4 * x"
[PROOF STATE]
proof (prove)
using this:
R x < ln 4 * x

goal (1 subgoal):
 1. R x \<le> ln 4 * x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
R x \<le> ln 4 * x

goal (1 subgoal):
 1. R x \<in> {0..ln 4 * x}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
R x \<le> ln 4 * x

goal (1 subgoal):
 1. R x \<in> {0..ln 4 * x}
[PROOF STEP]
have "R x \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> R x
[PROOF STEP]
unfolding R_def sum_upto_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (\<Sum>i | 0 < i \<and> real i \<le> x. ind prime i * ln (real i) * frac (x / real i))
[PROOF STEP]
by (intro sum_nonneg mult_nonneg_nonneg) (auto simp: ind_def)
[PROOF STATE]
proof (state)
this:
0 \<le> R x

goal (1 subgoal):
 1. R x \<in> {0..ln 4 * x}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
R x \<le> ln 4 * x
0 \<le> R x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
R x \<le> ln 4 * x
0 \<le> R x

goal (1 subgoal):
 1. R x \<in> {0..ln 4 * x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
R x \<in> {0..ln 4 * x}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
1 \<le> ?x \<Longrightarrow> R ?x \<in> {0..ln 4 * ?x}

goal (1 subgoal):
 1. (\<lambda>x. dirichlet_prod' (\<lambda>n. ind prime n * ln (real n)) (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x) \<in> O(\<lambda>x. x)
[PROOF STEP]
have "eventually (\<lambda>x. \<bar>R x\<bar> \<le> ln 4 * \<bar>x\<bar>) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. \<bar>R x\<bar> \<le> ln 4 * \<bar>x\<bar>
[PROOF STEP]
using eventually_ge_at_top[of 1]
[PROOF STATE]
proof (prove)
using this:
eventually ((\<le>) (1::?'a1)) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. \<bar>R x\<bar> \<le> ln 4 * \<bar>x\<bar>
[PROOF STEP]
by eventually_elim (use * in auto)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. \<bar>R x\<bar> \<le> ln 4 * \<bar>x\<bar>

goal (1 subgoal):
 1. (\<lambda>x. dirichlet_prod' (\<lambda>n. ind prime n * ln (real n)) (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x) \<in> O(\<lambda>x. x)
[PROOF STEP]
hence "R \<in> O(\<lambda>x. x)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. \<bar>R x\<bar> \<le> ln 4 * \<bar>x\<bar>

goal (1 subgoal):
 1. R \<in> O(\<lambda>x. x)
[PROOF STEP]
by (intro landau_o.bigI[of "ln 4"]) auto
[PROOF STATE]
proof (state)
this:
R \<in> O(\<lambda>x. x)

goal (1 subgoal):
 1. (\<lambda>x. dirichlet_prod' (\<lambda>n. ind prime n * ln (real n)) (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x) \<in> O(\<lambda>x. x)
[PROOF STEP]
have "(\<lambda>x. dirichlet_prod' (\<lambda>n. ind prime n * ln n) floor x - x * ln x) =
          (\<lambda>x. x * (\<MM> x - ln x) - R x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. dirichlet_prod' (\<lambda>n. ind prime n * ln (real n)) (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x) = (\<lambda>x. x * (\<MM> x - ln x) - R x)
[PROOF STEP]
by (auto simp: primes_M_def dirichlet_prod'_def prime_sum_upto_altdef1 sum_upto_def
                   frac_def sum_subtractf sum_distrib_left sum_distrib_right algebra_simps R_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. dirichlet_prod' (\<lambda>n. ind prime n * ln (real n)) (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x) = (\<lambda>x. x * (\<MM> x - ln x) - R x)

goal (1 subgoal):
 1. (\<lambda>x. dirichlet_prod' (\<lambda>n. ind prime n * ln (real n)) (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x) \<in> O(\<lambda>x. x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. dirichlet_prod' (\<lambda>n. ind prime n * ln (real n)) (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x) = (\<lambda>x. x * (\<MM> x - ln x) - R x)

goal (1 subgoal):
 1. (\<lambda>x. dirichlet_prod' (\<lambda>n. ind prime n * ln (real n)) (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x) \<in> O(\<lambda>x. x)
[PROOF STEP]
have "\<dots> \<in> O(\<lambda>x. x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x * (\<MM> x - ln x) - R x) \<in> O(\<lambda>x. x)
[PROOF STEP]
proof (rule sum_in_bigo)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>x. x * (\<MM> x - ln x)) \<in> O(\<lambda>x. x)
 2. R \<in> O(\<lambda>x. x)
[PROOF STEP]
have "(\<lambda>x. x * (\<MM> x - ln x)) \<in> O(\<lambda>x. x * 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x * (\<MM> x - ln x)) \<in> O(\<lambda>x. x * 1)
[PROOF STEP]
by (intro landau_o.big.mult mertens_bounded) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x * (\<MM> x - ln x)) \<in> O(\<lambda>x. x * 1)

goal (2 subgoals):
 1. (\<lambda>x. x * (\<MM> x - ln x)) \<in> O(\<lambda>x. x)
 2. R \<in> O(\<lambda>x. x)
[PROOF STEP]
thus "(\<lambda>x. x * (\<MM> x - ln x)) \<in> O(\<lambda>x. x)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. x * (\<MM> x - ln x)) \<in> O(\<lambda>x. x * 1)

goal (1 subgoal):
 1. (\<lambda>x. x * (\<MM> x - ln x)) \<in> O(\<lambda>x. x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x * (\<MM> x - ln x)) \<in> O(\<lambda>x. x)

goal (1 subgoal):
 1. R \<in> O(\<lambda>x. x)
[PROOF STEP]
qed fact+
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x * (\<MM> x - ln x) - R x) \<in> O(\<lambda>x. x)

goal (1 subgoal):
 1. (\<lambda>x. dirichlet_prod' (\<lambda>n. ind prime n * ln (real n)) (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x) \<in> O(\<lambda>x. x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. dirichlet_prod' (\<lambda>n. ind prime n * ln (real n)) (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x) \<in> O(\<lambda>x. x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. dirichlet_prod' (\<lambda>n. ind prime n * ln (real n)) (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x) \<in> O(\<lambda>x. x)

goal (1 subgoal):
 1. (\<lambda>x. dirichlet_prod' (\<lambda>n. ind prime n * ln (real n)) (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x) \<in> O(\<lambda>x. x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>x. dirichlet_prod' (\<lambda>n. ind prime n * ln (real n)) (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x - x * ln x) \<in> O(\<lambda>x. x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ModPonP_eqvt [eqvt]: "(p \<bullet> ModPonP x y z) = ModPonP (p \<bullet> x) (p \<bullet> y) (p \<bullet> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<bullet> ModPonP x y z = ModPonP (p \<bullet> x) (p \<bullet> y) (p \<bullet> z)
[PROOF STEP]
by (simp add: ModPonP_def)


[STATEMENT]
lemma floor_neg_numeral [simp]: "\<lfloor>- numeral v\<rfloor> = - numeral v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>- numeral v\<rfloor> = - numeral v
[PROOF STEP]
using floor_of_int [of "- numeral v"]
[PROOF STATE]
proof (prove)
using this:
\<lfloor>of_int (- numeral v)\<rfloor> = - numeral v

goal (1 subgoal):
 1. \<lfloor>- numeral v\<rfloor> = - numeral v
[PROOF STEP]
by simp


[STATEMENT]
theorem wls_psubstEnv_compose:
assumes "wlsEnv rho" and "wlsEnv rho'" and "wlsEnv rho''"
shows "((rho &[rho']) &[rho'']) = (rho &[(rho' &[rho''])])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rho &[rho'] &[rho''] = rho &[rho' &[rho'']]
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wlsEnv rho
wlsEnv rho'
wlsEnv rho''

goal (1 subgoal):
 1. rho &[rho'] &[rho''] = rho &[rho' &[rho'']]
[PROOF STEP]
by(simp add: psubstEnv_compose)


[STATEMENT]
lemma coeff_int_eq_0: "i < 0 \<or> i > int (degree p) \<Longrightarrow> coeff_int p i = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < 0 \<or> int (degree p) < i \<Longrightarrow> coeff_int p i = (0::'a)
[PROOF STEP]
unfolding coeff_int_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < 0 \<or> int (degree p) < i \<Longrightarrow> (if i < 0 then 0::'a else coeff p (nat i)) = (0::'a)
[PROOF STEP]
by (cases "i < 0", auto intro: coeff_eq_0)


[STATEMENT]
lemma (in real_normed_algebra_1) scaleR_power [simp]: "(scaleR x y) ^ n = scaleR (x^n) (y^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x *\<^sub>R y) ^ n = x ^ n *\<^sub>R y ^ n
[PROOF STEP]
by (induct n) (simp_all add: scaleR_one scaleR_scaleR mult_ac)


[STATEMENT]
lemma img_subset:"f \<in> A \<rightarrow> B \<Longrightarrow> f ` A \<subseteq> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> A \<rightarrow> B \<Longrightarrow> f ` A \<subseteq> B
[PROOF STEP]
apply (rule subsetI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>f \<in> A \<rightarrow> B; x \<in> f ` A\<rbrakk> \<Longrightarrow> x \<in> B
[PROOF STEP]
apply (simp add:image_def, erule bexE, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>f \<in> A \<rightarrow> B; xa \<in> A; x = f xa\<rbrakk> \<Longrightarrow> f xa \<in> B
[PROOF STEP]
apply (simp add:funcset_mem)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma mat_diag_mult_right: assumes A: "A \<in> carrier_mat nr n"
  shows "A * mat_diag n f = Matrix.mat nr n (\<lambda> (i,j). A $$ (i,j) * f j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * mat_diag n f = mat nr n (\<lambda>(i, j). A $$ (i, j) * f j)
[PROOF STEP]
proof (rule eq_matI, insert A, auto simp: mat_diag_def scalar_prod_def, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < nr; j < n; A \<in> carrier_mat nr n\<rbrakk> \<Longrightarrow> (\<Sum>ia = 0..<n. A $$ (i, ia) * (if ia = j then f j else (0::'a))) = A $$ (i, j) * f j
[PROOF STEP]
case (1 i j)
[PROOF STATE]
proof (state)
this:
i < nr
j < n
A \<in> carrier_mat nr n

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < nr; j < n; A \<in> carrier_mat nr n\<rbrakk> \<Longrightarrow> (\<Sum>ia = 0..<n. A $$ (i, ia) * (if ia = j then f j else (0::'a))) = A $$ (i, j) * f j
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
i < nr
j < n
A \<in> carrier_mat nr n

goal (1 subgoal):
 1. (\<Sum>ia = 0..<n. A $$ (i, ia) * (if ia = j then f j else (0::'a))) = A $$ (i, j) * f j
[PROOF STEP]
by (subst sum.remove[of _ j], auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>ia = 0..<n. A $$ (i, ia) * (if ia = j then f j else (0::'a))) = A $$ (i, j) * f j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_V_ge2: "card V \<ge> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<le> card V
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 \<le> card V
[PROOF STEP]
have "2 = card {s,t}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 = card {s, t}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 = card {s, t}

goal (1 subgoal):
 1. 2 \<le> card V
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 = card {s, t}

goal (1 subgoal):
 1. 2 \<le> card V
[PROOF STEP]
have "{s,t} \<subseteq> V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {s, t} \<subseteq> V
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{s, t} \<subseteq> V

goal (1 subgoal):
 1. 2 \<le> card V
[PROOF STEP]
hence "card {s,t} \<le> card V"
[PROOF STATE]
proof (prove)
using this:
{s, t} \<subseteq> V

goal (1 subgoal):
 1. card {s, t} \<le> card V
[PROOF STEP]
by (rule_tac card_mono) auto
[PROOF STATE]
proof (state)
this:
card {s, t} \<le> card V

goal (1 subgoal):
 1. 2 \<le> card V
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
2 \<le> card V
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
2 \<le> card V

goal (1 subgoal):
 1. 2 \<le> card V
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
2 \<le> card V

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma uminus_float[simp]: "x \<in> float \<Longrightarrow> -x \<in> float"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> float \<Longrightarrow> - x \<in> float
[PROOF STEP]
apply (auto simp: float_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m e. x = real_of_int m * 2 powr real_of_int e \<Longrightarrow> \<exists>ma ea. - (real_of_int m * 2 powr real_of_int e) = real_of_int ma * 2 powr real_of_int ea
[PROOF STEP]
apply hypsubst_thin
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m e. \<exists>ma ea. - (real_of_int m * 2 powr real_of_int e) = real_of_int ma * 2 powr real_of_int ea
[PROOF STEP]
apply (rename_tac m e)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m e. \<exists>ma ea. - (real_of_int m * 2 powr real_of_int e) = real_of_int ma * 2 powr real_of_int ea
[PROOF STEP]
apply (rule_tac x="-m" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m e. \<exists>ea. - (real_of_int m * 2 powr real_of_int e) = real_of_int (- m) * 2 powr real_of_int ea
[PROOF STEP]
apply (rule_tac x="e" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m e. - (real_of_int m * 2 powr real_of_int e) = real_of_int (- m) * 2 powr real_of_int e
[PROOF STEP]
apply (simp add: field_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Max_mapping_coboundedI:
  assumes "finite X" "\<forall>Q \<in> X. dom Q = dom P" "P \<in> X"
  shows "rel_mapping (\<le>) P (Max_mapping X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_mapping (\<le>) P (Max_mapping X)
[PROOF STEP]
unfolding rel_mapping_alt
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dom P = dom (Max_mapping X) \<and> (\<forall>p\<in>dom P. the (P p) \<le> the (Max_mapping X p))
[PROOF STEP]
proof (intro conjI ballI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dom P = dom (Max_mapping X)
 2. \<And>p. p \<in> dom P \<Longrightarrow> the (P p) \<le> the (Max_mapping X p)
[PROOF STEP]
from assms(3)
[PROOF STATE]
proof (chain)
picking this:
P \<in> X
[PROOF STEP]
have "X \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
P \<in> X

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

goal (2 subgoals):
 1. dom P = dom (Max_mapping X)
 2. \<And>p. p \<in> dom P \<Longrightarrow> the (P p) \<le> the (Max_mapping X p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
X \<noteq> {}
[PROOF STEP]
show "dom P = dom (Max_mapping X)"
[PROOF STATE]
proof (prove)
using this:
X \<noteq> {}

goal (1 subgoal):
 1. dom P = dom (Max_mapping X)
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
X \<noteq> {}
\<forall>Q\<in>X. dom Q = dom P

goal (1 subgoal):
 1. dom P = dom (Max_mapping X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dom P = dom (Max_mapping X)

goal (1 subgoal):
 1. \<And>p. p \<in> dom P \<Longrightarrow> the (P p) \<le> the (Max_mapping X p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. p \<in> dom P \<Longrightarrow> the (P p) \<le> the (Max_mapping X p)
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. p \<in> dom P \<Longrightarrow> the (P p) \<le> the (Max_mapping X p)
[PROOF STEP]
assume "p \<in> dom P"
[PROOF STATE]
proof (state)
this:
p \<in> dom P

goal (1 subgoal):
 1. \<And>p. p \<in> dom P \<Longrightarrow> the (P p) \<le> the (Max_mapping X p)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite X
\<forall>Q\<in>X. dom Q = dom P
P \<in> X
p \<in> dom P
[PROOF STEP]
show "the (P p) \<le> the (Max_mapping X p)"
[PROOF STATE]
proof (prove)
using this:
finite X
\<forall>Q\<in>X. dom Q = dom P
P \<in> X
p \<in> dom P

goal (1 subgoal):
 1. the (P p) \<le> the (Max_mapping X p)
[PROOF STEP]
by (force simp add: Max_mapping_def intro!: Max.coboundedI imageI)
[PROOF STATE]
proof (state)
this:
the (P p) \<le> the (Max_mapping X p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma collinear_between_cases:
  fixes c :: "'a::euclidean_space"
  shows "collinear {a,b,c} \<longleftrightarrow> between (b,c) a \<or> between (c,a) b \<or> between (a,b) c"
         (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. collinear {a, b, c} = (between (b, c) a \<or> between (c, a) b \<or> between (a, b) c)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. collinear {a, b, c} \<Longrightarrow> between (b, c) a \<or> between (c, a) b \<or> between (a, b) c
 2. between (b, c) a \<or> between (c, a) b \<or> between (a, b) c \<Longrightarrow> collinear {a, b, c}
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
collinear {a, b, c}

goal (2 subgoals):
 1. collinear {a, b, c} \<Longrightarrow> between (b, c) a \<or> between (c, a) b \<or> between (a, b) c
 2. between (b, c) a \<or> between (c, a) b \<or> between (a, b) c \<Longrightarrow> collinear {a, b, c}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
collinear {a, b, c}
[PROOF STEP]
obtain u v where uv: "\<And>x. x \<in> {a, b, c} \<Longrightarrow> \<exists>c. x = u + c *\<^sub>R v"
[PROOF STATE]
proof (prove)
using this:
collinear {a, b, c}

goal (1 subgoal):
 1. (\<And>u v. (\<And>x. x \<in> {a, b, c} \<Longrightarrow> \<exists>c. x = u + c *\<^sub>R v) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: collinear_alt)
[PROOF STATE]
proof (state)
this:
?x \<in> {a, b, c} \<Longrightarrow> \<exists>c. ?x = u + c *\<^sub>R v

goal (2 subgoals):
 1. collinear {a, b, c} \<Longrightarrow> between (b, c) a \<or> between (c, a) b \<or> between (a, b) c
 2. between (b, c) a \<or> between (c, a) b \<or> between (a, b) c \<Longrightarrow> collinear {a, b, c}
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. between (b, c) a \<or> between (c, a) b \<or> between (a, b) c
[PROOF STEP]
using uv [of a] uv [of b] uv [of c]
[PROOF STATE]
proof (prove)
using this:
a \<in> {a, b, c} \<Longrightarrow> \<exists>c. a = u + c *\<^sub>R v
b \<in> {a, b, c} \<Longrightarrow> \<exists>c. b = u + c *\<^sub>R v
c \<in> {a, b, c} \<Longrightarrow> \<exists>ca. c = u + ca *\<^sub>R v

goal (1 subgoal):
 1. between (b, c) a \<or> between (c, a) b \<or> between (a, b) c
[PROOF STEP]
by (auto simp: between_1)
[PROOF STATE]
proof (state)
this:
between (b, c) a \<or> between (c, a) b \<or> between (a, b) c

goal (1 subgoal):
 1. between (b, c) a \<or> between (c, a) b \<or> between (a, b) c \<Longrightarrow> collinear {a, b, c}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. between (b, c) a \<or> between (c, a) b \<or> between (a, b) c \<Longrightarrow> collinear {a, b, c}
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
between (b, c) a \<or> between (c, a) b \<or> between (a, b) c

goal (1 subgoal):
 1. between (b, c) a \<or> between (c, a) b \<or> between (a, b) c \<Longrightarrow> collinear {a, b, c}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
between (b, c) a \<or> between (c, a) b \<or> between (a, b) c
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
between (b, c) a \<or> between (c, a) b \<or> between (a, b) c

goal (1 subgoal):
 1. collinear {a, b, c}
[PROOF STEP]
unfolding between_mem_convex_hull
[PROOF STATE]
proof (prove)
using this:
a \<in> convex hull {b, c} \<or> b \<in> convex hull {c, a} \<or> c \<in> convex hull {a, b}

goal (1 subgoal):
 1. collinear {a, b, c}
[PROOF STEP]
by (metis (no_types, opaque_lifting) collinear_closed_segment collinear_subset hull_redundant hull_subset insert_commute segment_convex_hull)
[PROOF STATE]
proof (state)
this:
collinear {a, b, c}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma split_block_commute_subblock:
  fixes B::"'a::comm_ring Matrix.mat"
  assumes "diagonal_mat D"
  and "D\<in> carrier_mat n n"
  and "B\<in> carrier_mat n n"
  and "a \<le> n"
  and "split_block B a a = (B1, B2, B3, B4)"
  and "split_block D a a = (D1, D2, D3, D4)"
  and "B * D = D * B"
shows "B4 * D4 = D4 * B4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B4 * D4 = D4 * B4
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (D4 * B4); j < dim_col (D4 * B4)\<rbrakk> \<Longrightarrow> (B4 * D4) $$ (i, j) = (D4 * B4) $$ (i, j)
 2. dim_row (B4 * D4) = dim_row (D4 * B4)
 3. dim_col (B4 * D4) = dim_col (D4 * B4)
[PROOF STEP]
have d4: "D4 \<in> carrier_mat (n-a) (n-a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. D4 \<in> carrier_mat (n - a) (n - a)
[PROOF STEP]
using assms
      split_block(4)[of D]
[PROOF STATE]
proof (prove)
using this:
diagonal_mat D
D \<in> carrier_mat n n
B \<in> carrier_mat n n
a \<le> n
split_block B a a = (B1, B2, B3, B4)
split_block D a a = (D1, D2, D3, D4)
B * D = D * B
\<lbrakk>split_block D ?sr1.0 ?sc1.0 = (?A1.0, ?A2.0, ?A3.0, ?A4.0); dim_row D = ?sr1.0 + ?sr2.0; dim_col D = ?sc1.0 + ?sc2.0\<rbrakk> \<Longrightarrow> ?A4.0 \<in> carrier_mat ?sr2.0 ?sc2.0

goal (1 subgoal):
 1. D4 \<in> carrier_mat (n - a) (n - a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
D4 \<in> carrier_mat (n - a) (n - a)

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (D4 * B4); j < dim_col (D4 * B4)\<rbrakk> \<Longrightarrow> (B4 * D4) $$ (i, j) = (D4 * B4) $$ (i, j)
 2. dim_row (B4 * D4) = dim_row (D4 * B4)
 3. dim_col (B4 * D4) = dim_col (D4 * B4)
[PROOF STEP]
have b4: "B4 \<in> carrier_mat (n-a) (n-a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B4 \<in> carrier_mat (n - a) (n - a)
[PROOF STEP]
using assms
      split_block(4)[of B]
[PROOF STATE]
proof (prove)
using this:
diagonal_mat D
D \<in> carrier_mat n n
B \<in> carrier_mat n n
a \<le> n
split_block B a a = (B1, B2, B3, B4)
split_block D a a = (D1, D2, D3, D4)
B * D = D * B
\<lbrakk>split_block B ?sr1.0 ?sc1.0 = (?A1.0, ?A2.0, ?A3.0, ?A4.0); dim_row B = ?sr1.0 + ?sr2.0; dim_col B = ?sc1.0 + ?sc2.0\<rbrakk> \<Longrightarrow> ?A4.0 \<in> carrier_mat ?sr2.0 ?sc2.0

goal (1 subgoal):
 1. B4 \<in> carrier_mat (n - a) (n - a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
B4 \<in> carrier_mat (n - a) (n - a)

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (D4 * B4); j < dim_col (D4 * B4)\<rbrakk> \<Longrightarrow> (B4 * D4) $$ (i, j) = (D4 * B4) $$ (i, j)
 2. dim_row (B4 * D4) = dim_row (D4 * B4)
 3. dim_col (B4 * D4) = dim_col (D4 * B4)
[PROOF STEP]
have "diagonal_mat D4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diagonal_mat D4
[PROOF STEP]
using assms split_block_diagonal[of D]
[PROOF STATE]
proof (prove)
using this:
diagonal_mat D
D \<in> carrier_mat n n
B \<in> carrier_mat n n
a \<le> n
split_block B a a = (B1, B2, B3, B4)
split_block D a a = (D1, D2, D3, D4)
B * D = D * B
\<lbrakk>diagonal_mat D; D \<in> carrier_mat ?n ?n; ?a \<le> ?n; split_block D ?a ?a = (?D1.0, ?D2.0, ?D3.0, ?D4.0)\<rbrakk> \<Longrightarrow> diagonal_mat ?D1.0 \<and> diagonal_mat ?D4.0

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

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (D4 * B4); j < dim_col (D4 * B4)\<rbrakk> \<Longrightarrow> (B4 * D4) $$ (i, j) = (D4 * B4) $$ (i, j)
 2. dim_row (B4 * D4) = dim_row (D4 * B4)
 3. dim_col (B4 * D4) = dim_col (D4 * B4)
[PROOF STEP]
show "dim_row (B4 * D4) = dim_row (D4 * B4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (B4 * D4) = dim_row (D4 * B4)
[PROOF STEP]
using d4 b4
[PROOF STATE]
proof (prove)
using this:
D4 \<in> carrier_mat (n - a) (n - a)
B4 \<in> carrier_mat (n - a) (n - a)

goal (1 subgoal):
 1. dim_row (B4 * D4) = dim_row (D4 * B4)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_row (B4 * D4) = dim_row (D4 * B4)

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (D4 * B4); j < dim_col (D4 * B4)\<rbrakk> \<Longrightarrow> (B4 * D4) $$ (i, j) = (D4 * B4) $$ (i, j)
 2. dim_col (B4 * D4) = dim_col (D4 * B4)
[PROOF STEP]
show "dim_col (B4 * D4) = dim_col (D4 * B4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (B4 * D4) = dim_col (D4 * B4)
[PROOF STEP]
using d4 b4
[PROOF STATE]
proof (prove)
using this:
D4 \<in> carrier_mat (n - a) (n - a)
B4 \<in> carrier_mat (n - a) (n - a)

goal (1 subgoal):
 1. dim_col (B4 * D4) = dim_col (D4 * B4)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_col (B4 * D4) = dim_col (D4 * B4)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (D4 * B4); j < dim_col (D4 * B4)\<rbrakk> \<Longrightarrow> (B4 * D4) $$ (i, j) = (D4 * B4) $$ (i, j)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (D4 * B4); j < dim_col (D4 * B4)\<rbrakk> \<Longrightarrow> (B4 * D4) $$ (i, j) = (D4 * B4) $$ (i, j)
[PROOF STEP]
assume "i < dim_row (D4 * B4)"
  and "j < dim_col (D4 * B4)"
[PROOF STATE]
proof (state)
this:
i < dim_row (D4 * B4)
j < dim_col (D4 * B4)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (D4 * B4); j < dim_col (D4 * B4)\<rbrakk> \<Longrightarrow> (B4 * D4) $$ (i, j) = (D4 * B4) $$ (i, j)
[PROOF STEP]
have "(B4*D4) $$(i,j) = (B*D) $$(i+a, j+a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (B4 * D4) $$ (i, j) = (B * D) $$ (i + a, j + a)
[PROOF STEP]
using split_block_times_diag_index[of D n B a] assms
      \<open>i < dim_row (D4 * B4)\<close> \<open>j < dim_col (D4 * B4)\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>diagonal_mat D; D \<in> carrier_mat n n; B \<in> carrier_mat n n; a \<le> n; split_block B a a = (?B1.0, ?B2.0, ?B3.0, ?B4.0); split_block D a a = (?D1.0, ?D2.0, ?D3.0, ?D4.0); ?i < dim_row (?D4.0 * ?B4.0); ?j < dim_col (?D4.0 * ?B4.0)\<rbrakk> \<Longrightarrow> (?B4.0 * ?D4.0) $$ (?i, ?j) = (B * D) $$ (?i + a, ?j + a)
\<lbrakk>diagonal_mat D; D \<in> carrier_mat n n; B \<in> carrier_mat n n; a \<le> n; split_block B a a = (?B1.0, ?B2.0, ?B3.0, ?B4.0); split_block D a a = (?D1.0, ?D2.0, ?D3.0, ?D4.0); ?i < dim_row (?D4.0 * ?B4.0); ?j < dim_col (?D4.0 * ?B4.0)\<rbrakk> \<Longrightarrow> (?D4.0 * ?B4.0) $$ (?i, ?j) = (D * B) $$ (?i + a, ?j + a)
diagonal_mat D
D \<in> carrier_mat n n
B \<in> carrier_mat n n
a \<le> n
split_block B a a = (B1, B2, B3, B4)
split_block D a a = (D1, D2, D3, D4)
B * D = D * B
i < dim_row (D4 * B4)
j < dim_col (D4 * B4)

goal (1 subgoal):
 1. (B4 * D4) $$ (i, j) = (B * D) $$ (i + a, j + a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(B4 * D4) $$ (i, j) = (B * D) $$ (i + a, j + a)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (D4 * B4); j < dim_col (D4 * B4)\<rbrakk> \<Longrightarrow> (B4 * D4) $$ (i, j) = (D4 * B4) $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(B4 * D4) $$ (i, j) = (B * D) $$ (i + a, j + a)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (D4 * B4); j < dim_col (D4 * B4)\<rbrakk> \<Longrightarrow> (B4 * D4) $$ (i, j) = (D4 * B4) $$ (i, j)
[PROOF STEP]
have "... = (D*B) $$ (i+a, j+a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (B * D) $$ (i + a, j + a) = (D * B) $$ (i + a, j + a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
diagonal_mat D
D \<in> carrier_mat n n
B \<in> carrier_mat n n
a \<le> n
split_block B a a = (B1, B2, B3, B4)
split_block D a a = (D1, D2, D3, D4)
B * D = D * B

goal (1 subgoal):
 1. (B * D) $$ (i + a, j + a) = (D * B) $$ (i + a, j + a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(B * D) $$ (i + a, j + a) = (D * B) $$ (i + a, j + a)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (D4 * B4); j < dim_col (D4 * B4)\<rbrakk> \<Longrightarrow> (B4 * D4) $$ (i, j) = (D4 * B4) $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(B * D) $$ (i + a, j + a) = (D * B) $$ (i + a, j + a)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (D4 * B4); j < dim_col (D4 * B4)\<rbrakk> \<Longrightarrow> (B4 * D4) $$ (i, j) = (D4 * B4) $$ (i, j)
[PROOF STEP]
have "... = (D4*B4) $$ (i, j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (D * B) $$ (i + a, j + a) = (D4 * B4) $$ (i, j)
[PROOF STEP]
using split_block_times_diag_index[of D n B a] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>diagonal_mat D; D \<in> carrier_mat n n; B \<in> carrier_mat n n; a \<le> n; split_block B a a = (?B1.0, ?B2.0, ?B3.0, ?B4.0); split_block D a a = (?D1.0, ?D2.0, ?D3.0, ?D4.0); ?i < dim_row (?D4.0 * ?B4.0); ?j < dim_col (?D4.0 * ?B4.0)\<rbrakk> \<Longrightarrow> (?B4.0 * ?D4.0) $$ (?i, ?j) = (B * D) $$ (?i + a, ?j + a)
\<lbrakk>diagonal_mat D; D \<in> carrier_mat n n; B \<in> carrier_mat n n; a \<le> n; split_block B a a = (?B1.0, ?B2.0, ?B3.0, ?B4.0); split_block D a a = (?D1.0, ?D2.0, ?D3.0, ?D4.0); ?i < dim_row (?D4.0 * ?B4.0); ?j < dim_col (?D4.0 * ?B4.0)\<rbrakk> \<Longrightarrow> (?D4.0 * ?B4.0) $$ (?i, ?j) = (D * B) $$ (?i + a, ?j + a)
diagonal_mat D
D \<in> carrier_mat n n
B \<in> carrier_mat n n
a \<le> n
split_block B a a = (B1, B2, B3, B4)
split_block D a a = (D1, D2, D3, D4)
B * D = D * B

goal (1 subgoal):
 1. (D * B) $$ (i + a, j + a) = (D4 * B4) $$ (i, j)
[PROOF STEP]
by (metis \<open>i < dim_row (D4 * B4)\<close> \<open>j < dim_col (D4 * B4)\<close>)
[PROOF STATE]
proof (state)
this:
(D * B) $$ (i + a, j + a) = (D4 * B4) $$ (i, j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (D4 * B4); j < dim_col (D4 * B4)\<rbrakk> \<Longrightarrow> (B4 * D4) $$ (i, j) = (D4 * B4) $$ (i, j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(B4 * D4) $$ (i, j) = (D4 * B4) $$ (i, j)
[PROOF STEP]
show "(B4*D4) $$(i,j) = (D4*B4) $$ (i, j)"
[PROOF STATE]
proof (prove)
using this:
(B4 * D4) $$ (i, j) = (D4 * B4) $$ (i, j)

goal (1 subgoal):
 1. (B4 * D4) $$ (i, j) = (D4 * B4) $$ (i, j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(B4 * D4) $$ (i, j) = (D4 * B4) $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zero_carrier_vec[simp]: "0\<^sub>v n \<in> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0\<^sub>v n \<in> carrier_vec n
[PROOF STEP]
unfolding zero_vec_def carrier_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec n (\<lambda>i. 0::'a) \<in> {v. dim_vec v = n}
[PROOF STEP]
by auto


[STATEMENT]
lemma n_distrib_alt: "n x \<cdot> n z = n y \<cdot> n z \<Longrightarrow> n x \<oplus> n z = n y \<oplus> n z \<Longrightarrow> n x = n y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n x \<cdot> n z = n y \<cdot> n z; n x \<oplus> n z = n y \<oplus> n z\<rbrakk> \<Longrightarrow> n x = n y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>n x \<cdot> n z = n y \<cdot> n z; n x \<oplus> n z = n y \<oplus> n z\<rbrakk> \<Longrightarrow> n x = n y
[PROOF STEP]
assume a: "n x \<cdot> n z = n y \<cdot> n z" and b: "n x \<oplus> n z = n y \<oplus> n z"
[PROOF STATE]
proof (state)
this:
n x \<cdot> n z = n y \<cdot> n z
n x \<oplus> n z = n y \<oplus> n z

goal (1 subgoal):
 1. \<lbrakk>n x \<cdot> n z = n y \<cdot> n z; n x \<oplus> n z = n y \<oplus> n z\<rbrakk> \<Longrightarrow> n x = n y
[PROOF STEP]
have "n x = n x \<oplus> n x \<cdot> n z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n x = n x \<oplus> n x \<cdot> n z
[PROOF STEP]
using n_absorb1
[PROOF STATE]
proof (prove)
using this:
n ?x \<oplus> n ?x \<cdot> n ?y = n ?x

goal (1 subgoal):
 1. n x = n x \<oplus> n x \<cdot> n z
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
n x = n x \<oplus> n x \<cdot> n z

goal (1 subgoal):
 1. \<lbrakk>n x \<cdot> n z = n y \<cdot> n z; n x \<oplus> n z = n y \<oplus> n z\<rbrakk> \<Longrightarrow> n x = n y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n x = n x \<oplus> n x \<cdot> n z

goal (1 subgoal):
 1. \<lbrakk>n x \<cdot> n z = n y \<cdot> n z; n x \<oplus> n z = n y \<oplus> n z\<rbrakk> \<Longrightarrow> n x = n y
[PROOF STEP]
have "... = n x \<oplus> n y \<cdot> n z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n x \<oplus> n x \<cdot> n z = n x \<oplus> n y \<cdot> n z
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
n x \<cdot> n z = n y \<cdot> n z

goal (1 subgoal):
 1. n x \<oplus> n x \<cdot> n z = n x \<oplus> n y \<cdot> n z
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
n x \<oplus> n x \<cdot> n z = n x \<oplus> n y \<cdot> n z

goal (1 subgoal):
 1. \<lbrakk>n x \<cdot> n z = n y \<cdot> n z; n x \<oplus> n z = n y \<oplus> n z\<rbrakk> \<Longrightarrow> n x = n y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n x \<oplus> n x \<cdot> n z = n x \<oplus> n y \<cdot> n z

goal (1 subgoal):
 1. \<lbrakk>n x \<cdot> n z = n y \<cdot> n z; n x \<oplus> n z = n y \<oplus> n z\<rbrakk> \<Longrightarrow> n x = n y
[PROOF STEP]
have "... = (n x \<oplus> n y) \<cdot> (n x \<oplus> n z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n x \<oplus> n y \<cdot> n z = (n x \<oplus> n y) \<cdot> (n x \<oplus> n z)
[PROOF STEP]
using n_distrib2
[PROOF STATE]
proof (prove)
using this:
n ?x \<oplus> n ?y \<cdot> n ?z = (n ?x \<oplus> n ?y) \<cdot> (n ?x \<oplus> n ?z)

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

goal (1 subgoal):
 1. \<lbrakk>n x \<cdot> n z = n y \<cdot> n z; n x \<oplus> n z = n y \<oplus> n z\<rbrakk> \<Longrightarrow> n x = n y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n x \<oplus> n y \<cdot> n z = (n x \<oplus> n y) \<cdot> (n x \<oplus> n z)

goal (1 subgoal):
 1. \<lbrakk>n x \<cdot> n z = n y \<cdot> n z; n x \<oplus> n z = n y \<oplus> n z\<rbrakk> \<Longrightarrow> n x = n y
[PROOF STEP]
have "... = (n y \<oplus> n x) \<cdot> (n y \<oplus> n z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n x \<oplus> n y) \<cdot> (n x \<oplus> n z) = (n y \<oplus> n x) \<cdot> (n y \<oplus> n z)
[PROOF STEP]
using n_add_op_def b n_comm
[PROOF STATE]
proof (prove)
using this:
?x \<oplus> ?y \<equiv> n (n ?x \<cdot> n ?y)
n x \<oplus> n z = n y \<oplus> n z
n ?x \<cdot> n ?y = n ?y \<cdot> n ?x

goal (1 subgoal):
 1. (n x \<oplus> n y) \<cdot> (n x \<oplus> n z) = (n y \<oplus> n x) \<cdot> (n y \<oplus> n z)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
(n x \<oplus> n y) \<cdot> (n x \<oplus> n z) = (n y \<oplus> n x) \<cdot> (n y \<oplus> n z)

goal (1 subgoal):
 1. \<lbrakk>n x \<cdot> n z = n y \<cdot> n z; n x \<oplus> n z = n y \<oplus> n z\<rbrakk> \<Longrightarrow> n x = n y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(n x \<oplus> n y) \<cdot> (n x \<oplus> n z) = (n y \<oplus> n x) \<cdot> (n y \<oplus> n z)

goal (1 subgoal):
 1. \<lbrakk>n x \<cdot> n z = n y \<cdot> n z; n x \<oplus> n z = n y \<oplus> n z\<rbrakk> \<Longrightarrow> n x = n y
[PROOF STEP]
have "... = n y \<cdot> (n x \<oplus> n z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n y \<oplus> n x) \<cdot> (n y \<oplus> n z) = n y \<cdot> (n x \<oplus> n z)
[PROOF STEP]
by (metis a b n_distrib1 n_distrib2 n_mult_idem)
[PROOF STATE]
proof (state)
this:
(n y \<oplus> n x) \<cdot> (n y \<oplus> n z) = n y \<cdot> (n x \<oplus> n z)

goal (1 subgoal):
 1. \<lbrakk>n x \<cdot> n z = n y \<cdot> n z; n x \<oplus> n z = n y \<oplus> n z\<rbrakk> \<Longrightarrow> n x = n y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(n y \<oplus> n x) \<cdot> (n y \<oplus> n z) = n y \<cdot> (n x \<oplus> n z)

goal (1 subgoal):
 1. \<lbrakk>n x \<cdot> n z = n y \<cdot> n z; n x \<oplus> n z = n y \<oplus> n z\<rbrakk> \<Longrightarrow> n x = n y
[PROOF STEP]
have "... = n y \<cdot> (n y \<oplus> n z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n y \<cdot> (n x \<oplus> n z) = n y \<cdot> (n y \<oplus> n z)
[PROOF STEP]
using b
[PROOF STATE]
proof (prove)
using this:
n x \<oplus> n z = n y \<oplus> n z

goal (1 subgoal):
 1. n y \<cdot> (n x \<oplus> n z) = n y \<cdot> (n y \<oplus> n z)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
n y \<cdot> (n x \<oplus> n z) = n y \<cdot> (n y \<oplus> n z)

goal (1 subgoal):
 1. \<lbrakk>n x \<cdot> n z = n y \<cdot> n z; n x \<oplus> n z = n y \<oplus> n z\<rbrakk> \<Longrightarrow> n x = n y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
n x = n y \<cdot> (n y \<oplus> n z)
[PROOF STEP]
show "n x = n y"
[PROOF STATE]
proof (prove)
using this:
n x = n y \<cdot> (n y \<oplus> n z)

goal (1 subgoal):
 1. n x = n y
[PROOF STEP]
using n_absorb2
[PROOF STATE]
proof (prove)
using this:
n x = n y \<cdot> (n y \<oplus> n z)
n ?x \<cdot> (n ?x \<oplus> n ?y) = n ?x

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prime_elem_imp_irreducible:
  assumes "prime_elem p"
  shows   "irreducible p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. irreducible p
[PROOF STEP]
proof (rule irreducibleI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. p \<noteq> (0::'a)
 2. \<not> p dvd (1::'a)
 3. \<And>a b. p = a * b \<Longrightarrow> a dvd (1::'a) \<or> b dvd (1::'a)
[PROOF STEP]
fix a b
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. p \<noteq> (0::'a)
 2. \<not> p dvd (1::'a)
 3. \<And>a b. p = a * b \<Longrightarrow> a dvd (1::'a) \<or> b dvd (1::'a)
[PROOF STEP]
assume p_eq: "p = a * b"
[PROOF STATE]
proof (state)
this:
p = a * b

goal (3 subgoals):
 1. p \<noteq> (0::'a)
 2. \<not> p dvd (1::'a)
 3. \<And>a b. p = a * b \<Longrightarrow> a dvd (1::'a) \<or> b dvd (1::'a)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
prime_elem p
p = a * b
[PROOF STEP]
have nz: "a \<noteq> 0" "b \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
prime_elem p
p = a * b

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

goal (3 subgoals):
 1. p \<noteq> (0::'a)
 2. \<not> p dvd (1::'a)
 3. \<And>a b. p = a * b \<Longrightarrow> a dvd (1::'a) \<or> b dvd (1::'a)
[PROOF STEP]
from p_eq
[PROOF STATE]
proof (chain)
picking this:
p = a * b
[PROOF STEP]
have "p dvd a * b"
[PROOF STATE]
proof (prove)
using this:
p = a * b

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

goal (3 subgoals):
 1. p \<noteq> (0::'a)
 2. \<not> p dvd (1::'a)
 3. \<And>a b. p = a * b \<Longrightarrow> a dvd (1::'a) \<or> b dvd (1::'a)
[PROOF STEP]
with \<open>prime_elem p\<close>
[PROOF STATE]
proof (chain)
picking this:
prime_elem p
p dvd a * b
[PROOF STEP]
have "p dvd a \<or> p dvd b"
[PROOF STATE]
proof (prove)
using this:
prime_elem p
p dvd a * b

goal (1 subgoal):
 1. p dvd a \<or> p dvd b
[PROOF STEP]
by (rule prime_elem_dvd_multD)
[PROOF STATE]
proof (state)
this:
p dvd a \<or> p dvd b

goal (3 subgoals):
 1. p \<noteq> (0::'a)
 2. \<not> p dvd (1::'a)
 3. \<And>a b. p = a * b \<Longrightarrow> a dvd (1::'a) \<or> b dvd (1::'a)
[PROOF STEP]
with \<open>p = a * b\<close>
[PROOF STATE]
proof (chain)
picking this:
p = a * b
p dvd a \<or> p dvd b
[PROOF STEP]
have "a * b dvd 1 * b \<or> a * b dvd a * 1"
[PROOF STATE]
proof (prove)
using this:
p = a * b
p dvd a \<or> p dvd b

goal (1 subgoal):
 1. a * b dvd (1::'a) * b \<or> a * b dvd a * (1::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a * b dvd (1::'a) * b \<or> a * b dvd a * (1::'a)

goal (3 subgoals):
 1. p \<noteq> (0::'a)
 2. \<not> p dvd (1::'a)
 3. \<And>a b. p = a * b \<Longrightarrow> a dvd (1::'a) \<or> b dvd (1::'a)
[PROOF STEP]
thus "a dvd 1 \<or> b dvd 1"
[PROOF STATE]
proof (prove)
using this:
a * b dvd (1::'a) * b \<or> a * b dvd a * (1::'a)

goal (1 subgoal):
 1. a dvd (1::'a) \<or> b dvd (1::'a)
[PROOF STEP]
by (simp only: dvd_times_left_cancel_iff[OF nz(1)] dvd_times_right_cancel_iff[OF nz(2)])
[PROOF STATE]
proof (state)
this:
a dvd (1::'a) \<or> b dvd (1::'a)

goal (2 subgoals):
 1. p \<noteq> (0::'a)
 2. \<not> p dvd (1::'a)
[PROOF STEP]
qed (insert assms, simp_all add: prime_elem_def)


[STATEMENT]
lemma gen_mono_inc_bdd_above_has_limit_at_topI:
  fixes f::"real \<Rightarrow> real"
  assumes "\<And>x y. x \<ge> b \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y"
  assumes "\<And>x. x \<ge> b \<Longrightarrow> f x \<le> u"
  shows "\<exists>l. (f \<longlongrightarrow> l) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>l. (f \<longlongrightarrow> l) at_top
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>l. (f \<longlongrightarrow> l) at_top
[PROOF STEP]
define ff where "ff = (\<lambda>x. if x \<ge> b then f x else f b)"
[PROOF STATE]
proof (state)
this:
ff = (\<lambda>x. if b \<le> x then f x else f b)

goal (1 subgoal):
 1. \<exists>l. (f \<longlongrightarrow> l) at_top
[PROOF STEP]
have m1:"mono ff"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono ff
[PROOF STEP]
unfolding ff_def mono_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. x \<le> y \<longrightarrow> (if b \<le> x then f x else f b) \<le> (if b \<le> y then f y else f b)
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>b \<le> ?x; ?x \<le> ?y\<rbrakk> \<Longrightarrow> f ?x \<le> f ?y

goal (1 subgoal):
 1. \<forall>x y. x \<le> y \<longrightarrow> (if b \<le> x then f x else f b) \<le> (if b \<le> y then f y else f b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mono ff

goal (1 subgoal):
 1. \<exists>l. (f \<longlongrightarrow> l) at_top
[PROOF STEP]
have m2:"\<And>x. ff x \<le> u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. ff x \<le> u
[PROOF STEP]
unfolding ff_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (if b \<le> x then f x else f b) \<le> u
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
b \<le> ?x \<Longrightarrow> f ?x \<le> u

goal (1 subgoal):
 1. \<And>x. (if b \<le> x then f x else f b) \<le> u
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ff ?x \<le> u

goal (1 subgoal):
 1. \<exists>l. (f \<longlongrightarrow> l) at_top
[PROOF STEP]
from mono_inc_bdd_above_has_limit_at_topI[OF m1 m2]
[PROOF STATE]
proof (chain)
picking this:
\<exists>l. (ff \<longlongrightarrow> l) at_top
[PROOF STEP]
obtain l where "(ff \<longlongrightarrow> l) at_top"
[PROOF STATE]
proof (prove)
using this:
\<exists>l. (ff \<longlongrightarrow> l) at_top

goal (1 subgoal):
 1. (\<And>l. (ff \<longlongrightarrow> l) at_top \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(ff \<longlongrightarrow> l) at_top

goal (1 subgoal):
 1. \<exists>l. (f \<longlongrightarrow> l) at_top
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(ff \<longlongrightarrow> l) at_top

goal (1 subgoal):
 1. \<exists>l. (f \<longlongrightarrow> l) at_top
[PROOF STEP]
by (meson \<open>(ff \<longlongrightarrow> l) at_top\<close> ff_def tendsto_at_top_eq_left)
[PROOF STATE]
proof (state)
this:
\<exists>l. (f \<longlongrightarrow> l) at_top

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma convergent_powser'_geometric:
  "convergent_powser' (msllist_of_msstream (mssalternate 1 (-1))) (\<lambda>x. inverse (1 + x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent_powser' (msllist_of_msstream (mssalternate 1 (- 1))) (\<lambda>x. inverse (1 + x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convergent_powser' (msllist_of_msstream (mssalternate 1 (- 1))) (\<lambda>x. inverse (1 + x))
[PROOF STEP]
have "(\<lambda>n. lcoeff (msllist_of_msstream (mssalternate 1 (-1))) n * x ^ n) sums (inverse (1 + x))"
    if "abs x < 1" for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. lcoeff (msllist_of_msstream (mssalternate 1 (- 1))) n * x ^ n) sums inverse (1 + x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. lcoeff (msllist_of_msstream (mssalternate 1 (- 1))) n * x ^ n) sums inverse (1 + x)
[PROOF STEP]
have "(\<lambda>n. (-1) ^ n * x ^ n) sums (inverse (1 + x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (- 1) ^ n * x ^ n) sums inverse (1 + x)
[PROOF STEP]
using that geometric_sums[of "-x"]
[PROOF STATE]
proof (prove)
using this:
\<bar>x\<bar> < 1
norm (- x) < 1 \<Longrightarrow> (^) (- x) sums (1 / (1 - - x))

goal (1 subgoal):
 1. (\<lambda>n. (- 1) ^ n * x ^ n) sums inverse (1 + x)
[PROOF STEP]
by (simp add: field_simps power_mult_distrib [symmetric])
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (- 1) ^ n * x ^ n) sums inverse (1 + x)

goal (1 subgoal):
 1. (\<lambda>n. lcoeff (msllist_of_msstream (mssalternate 1 (- 1))) n * x ^ n) sums inverse (1 + x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (- 1) ^ n * x ^ n) sums inverse (1 + x)

goal (1 subgoal):
 1. (\<lambda>n. lcoeff (msllist_of_msstream (mssalternate 1 (- 1))) n * x ^ n) sums inverse (1 + x)
[PROOF STEP]
have "(\<lambda>n. (-1) ^ n * x ^ n) =
                 (\<lambda>n. lcoeff (msllist_of_msstream (mssalternate 1 (-1))) n * x ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (- 1) ^ n * x ^ n) = (\<lambda>n. lcoeff (msllist_of_msstream (mssalternate 1 (- 1))) n * x ^ n)
[PROOF STEP]
by (auto simp add: mssnth_mssalternate fun_eq_iff)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (- 1) ^ n * x ^ n) = (\<lambda>n. lcoeff (msllist_of_msstream (mssalternate 1 (- 1))) n * x ^ n)

goal (1 subgoal):
 1. (\<lambda>n. lcoeff (msllist_of_msstream (mssalternate 1 (- 1))) n * x ^ n) sums inverse (1 + x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. lcoeff (msllist_of_msstream (mssalternate 1 (- 1))) n * x ^ n) sums inverse (1 + x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. lcoeff (msllist_of_msstream (mssalternate 1 (- 1))) n * x ^ n) sums inverse (1 + x)

goal (1 subgoal):
 1. (\<lambda>n. lcoeff (msllist_of_msstream (mssalternate 1 (- 1))) n * x ^ n) sums inverse (1 + x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>n. lcoeff (msllist_of_msstream (mssalternate 1 (- 1))) n * x ^ n) sums inverse (1 + x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<bar>?x\<bar> < 1 \<Longrightarrow> (\<lambda>n. lcoeff (msllist_of_msstream (mssalternate 1 (- 1))) n * ?x ^ n) sums inverse (1 + ?x)

goal (1 subgoal):
 1. convergent_powser' (msllist_of_msstream (mssalternate 1 (- 1))) (\<lambda>x. inverse (1 + x))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>?x\<bar> < 1 \<Longrightarrow> (\<lambda>n. lcoeff (msllist_of_msstream (mssalternate 1 (- 1))) n * ?x ^ n) sums inverse (1 + ?x)

goal (1 subgoal):
 1. convergent_powser' (msllist_of_msstream (mssalternate 1 (- 1))) (\<lambda>x. inverse (1 + x))
[PROOF STEP]
unfolding convergent_powser'_def
[PROOF STATE]
proof (prove)
using this:
\<bar>?x\<bar> < 1 \<Longrightarrow> (\<lambda>n. lcoeff (msllist_of_msstream (mssalternate 1 (- 1))) n * ?x ^ n) sums inverse (1 + ?x)

goal (1 subgoal):
 1. \<exists>R>0. \<forall>x. \<bar>x\<bar> < R \<longrightarrow> (\<lambda>n. lcoeff (msllist_of_msstream (mssalternate 1 (- 1))) n * x ^ n) sums inverse (1 + x)
[PROOF STEP]
by (force intro!: exI[of _ 1])
[PROOF STATE]
proof (state)
this:
convergent_powser' (msllist_of_msstream (mssalternate 1 (- 1))) (\<lambda>x. inverse (1 + x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dbm_entry_dbm_min3:
  assumes "dbm_entry_val u (Some c) None (min a b)"
  shows "dbm_entry_val u (Some c) None b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dbm_entry_val u (Some c) None b
[PROOF STEP]
using dbm_entry_val_mono_3[folded less_eq, OF assms]
[PROOF STATE]
proof (prove)
using this:
min a b \<le> ?b' \<Longrightarrow> dbm_entry_val u (Some c) None ?b'

goal (1 subgoal):
 1. dbm_entry_val u (Some c) None b
[PROOF STEP]
by auto


[STATEMENT]
lemma sgn_inf_sym:
  fixes p::"real poly"
  shows "sgn_pos_inf (pcompose p [:0,-1:]) = sgn_neg_inf p" (is "?L=?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn_pos_inf (p \<circ>\<^sub>p [:0, - 1:]) = sgn_neg_inf p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sgn_pos_inf (p \<circ>\<^sub>p [:0, - 1:]) = sgn_neg_inf p
[PROOF STEP]
have "?L= sgn (lead_coeff p * (- 1) ^ degree p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn_pos_inf (p \<circ>\<^sub>p [:0, - 1:]) = sgn (lead_coeff p * (- 1) ^ degree p)
[PROOF STEP]
unfolding sgn_pos_inf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn (lead_coeff (p \<circ>\<^sub>p [:0, - 1:])) = sgn (lead_coeff p * (- 1) ^ degree p)
[PROOF STEP]
by (subst lead_coeff_comp,auto)
[PROOF STATE]
proof (state)
this:
sgn_pos_inf (p \<circ>\<^sub>p [:0, - 1:]) = sgn (lead_coeff p * (- 1) ^ degree p)

goal (1 subgoal):
 1. sgn_pos_inf (p \<circ>\<^sub>p [:0, - 1:]) = sgn_neg_inf p
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
sgn_pos_inf (p \<circ>\<^sub>p [:0, - 1:]) = sgn (lead_coeff p * (- 1) ^ degree p)

goal (1 subgoal):
 1. sgn_pos_inf (p \<circ>\<^sub>p [:0, - 1:]) = sgn_neg_inf p
[PROOF STEP]
unfolding sgn_neg_inf_def
[PROOF STATE]
proof (prove)
using this:
sgn_pos_inf (p \<circ>\<^sub>p [:0, - 1:]) = sgn (lead_coeff p * (- 1) ^ degree p)

goal (1 subgoal):
 1. sgn_pos_inf (p \<circ>\<^sub>p [:0, - 1:]) = (if even (degree p) then sgn (lead_coeff p) else - sgn (lead_coeff p))
[PROOF STEP]
by (metis mult.right_neutral mult_minus1_right neg_one_even_power neg_one_odd_power sgn_minus)
[PROOF STATE]
proof (state)
this:
sgn_pos_inf (p \<circ>\<^sub>p [:0, - 1:]) = sgn_neg_inf p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nl3: assumes "(l'::real) \<ge> 1" "r' \<ge> 1" "lr \<ge> 1" "r \<ge> 1"
shows "4 * (l' + r')^2 * (lr + r) * (lr + r' + r)
       \<le> (l' + lr + r') * (l' + lr + r' + r)^3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 * (l' + r')\<^sup>2 * (lr + r) * (lr + r' + r) \<le> (l' + lr + r') * (l' + lr + r' + r) ^ 3
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 4 * (l' + r')\<^sup>2 * (lr + r) * (lr + r' + r) \<le> (l' + lr + r') * (l' + lr + r' + r) ^ 3
[PROOF STEP]
have 1: "l' + r' \<le> l' + lr + r'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l' + r' \<le> l' + lr + r'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> l'
1 \<le> r'
1 \<le> lr
1 \<le> r

goal (1 subgoal):
 1. l' + r' \<le> l' + lr + r'
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
l' + r' \<le> l' + lr + r'

goal (1 subgoal):
 1. 4 * (l' + r')\<^sup>2 * (lr + r) * (lr + r' + r) \<le> (l' + lr + r') * (l' + lr + r' + r) ^ 3
[PROOF STEP]
have 2: "0 \<le> (l' + lr + r' + r)^3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (l' + lr + r' + r) ^ 3
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> l'
1 \<le> r'
1 \<le> lr
1 \<le> r

goal (1 subgoal):
 1. 0 \<le> (l' + lr + r' + r) ^ 3
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> (l' + lr + r' + r) ^ 3

goal (1 subgoal):
 1. 4 * (l' + r')\<^sup>2 * (lr + r) * (lr + r' + r) \<le> (l' + lr + r') * (l' + lr + r' + r) ^ 3
[PROOF STEP]
have 3: "0 \<le> l' + r'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> l' + r'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> l'
1 \<le> r'
1 \<le> lr
1 \<le> r

goal (1 subgoal):
 1. 0 \<le> l' + r'
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
0 \<le> l' + r'

goal (1 subgoal):
 1. 4 * (l' + r')\<^sup>2 * (lr + r) * (lr + r' + r) \<le> (l' + lr + r') * (l' + lr + r' + r) ^ 3
[PROOF STEP]
from mult_mono[OF nl32[OF assms] 1 2 3]
[PROOF STATE]
proof (chain)
picking this:
4 * (l' + r') * (lr + r) * (lr + r' + r) * (l' + r') \<le> (l' + lr + r' + r) ^ 3 * (l' + lr + r')
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
4 * (l' + r') * (lr + r) * (lr + r' + r) * (l' + r') \<le> (l' + lr + r' + r) ^ 3 * (l' + lr + r')

goal (1 subgoal):
 1. 4 * (l' + r')\<^sup>2 * (lr + r) * (lr + r' + r) \<le> (l' + lr + r') * (l' + lr + r' + r) ^ 3
[PROOF STEP]
unfolding power2_eq_square
[PROOF STATE]
proof (prove)
using this:
4 * (l' + r') * (lr + r) * (lr + r' + r) * (l' + r') \<le> (l' + lr + r' + r) ^ 3 * (l' + lr + r')

goal (1 subgoal):
 1. 4 * ((l' + r') * (l' + r')) * (lr + r) * (lr + r' + r) \<le> (l' + lr + r') * (l' + lr + r' + r) ^ 3
[PROOF STEP]
by (simp only: ac_simps)
[PROOF STATE]
proof (state)
this:
4 * (l' + r')\<^sup>2 * (lr + r) * (lr + r' + r) \<le> (l' + lr + r') * (l' + lr + r' + r) ^ 3

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma proj_Eps:
  assumes "equiv A r" and "X \<in> A//r"
  shows "proj r (Eps (\<lambda>x. x \<in> X)) = X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj r (SOME x. x \<in> X) = X
[PROOF STEP]
unfolding proj_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r `` {SOME x. x \<in> X} = X
[PROOF STEP]
proof auto
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. (SOME x. x \<in> X, x) \<in> r \<Longrightarrow> x \<in> X
 2. \<And>x. x \<in> X \<Longrightarrow> (SOME x. x \<in> X, x) \<in> r
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. (SOME x. x \<in> X, x) \<in> r \<Longrightarrow> x \<in> X
 2. \<And>x. x \<in> X \<Longrightarrow> (SOME x. x \<in> X, x) \<in> r
[PROOF STEP]
assume x: "x \<in> X"
[PROOF STATE]
proof (state)
this:
x \<in> X

goal (2 subgoals):
 1. \<And>x. (SOME x. x \<in> X, x) \<in> r \<Longrightarrow> x \<in> X
 2. \<And>x. x \<in> X \<Longrightarrow> (SOME x. x \<in> X, x) \<in> r
[PROOF STEP]
thus "(Eps (\<lambda>x. x \<in> X), x) \<in> r"
[PROOF STATE]
proof (prove)
using this:
x \<in> X

goal (1 subgoal):
 1. (SOME x. x \<in> X, x) \<in> r
[PROOF STEP]
using assms equiv_Eps_in in_quotient_imp_in_rel
[PROOF STATE]
proof (prove)
using this:
x \<in> X
equiv A r
X \<in> A // r
\<lbrakk>equiv ?A ?r; ?X \<in> ?A // ?r\<rbrakk> \<Longrightarrow> (SOME x. x \<in> ?X) \<in> ?X
\<lbrakk>equiv ?A ?r; ?X \<in> ?A // ?r; {?x, ?y} \<subseteq> ?X\<rbrakk> \<Longrightarrow> (?x, ?y) \<in> ?r

goal (1 subgoal):
 1. (SOME x. x \<in> X, x) \<in> r
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
(SOME x. x \<in> X, x) \<in> r

goal (1 subgoal):
 1. \<And>x. (SOME x. x \<in> X, x) \<in> r \<Longrightarrow> x \<in> X
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (SOME x. x \<in> X, x) \<in> r \<Longrightarrow> x \<in> X
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (SOME x. x \<in> X, x) \<in> r \<Longrightarrow> x \<in> X
[PROOF STEP]
assume "(Eps (\<lambda>x. x \<in> X),x) \<in> r"
[PROOF STATE]
proof (state)
this:
(SOME x. x \<in> X, x) \<in> r

goal (1 subgoal):
 1. \<And>x. (SOME x. x \<in> X, x) \<in> r \<Longrightarrow> x \<in> X
[PROOF STEP]
thus "x \<in> X"
[PROOF STATE]
proof (prove)
using this:
(SOME x. x \<in> X, x) \<in> r

goal (1 subgoal):
 1. x \<in> X
[PROOF STEP]
using in_quotient_imp_closed[OF assms equiv_Eps_in[OF assms]]
[PROOF STATE]
proof (prove)
using this:
(SOME x. x \<in> X, x) \<in> r
(SOME x. x \<in> X, ?y) \<in> r \<Longrightarrow> ?y \<in> X

goal (1 subgoal):
 1. x \<in> X
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
x \<in> X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inj_adjoint_iff_surj [simp]:
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
  assumes "linear f"
  shows  "inj (adjoint f) \<longleftrightarrow> surj f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (adjoint f) = surj f
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj (adjoint f) \<Longrightarrow> surj f
 2. surj f \<Longrightarrow> inj (adjoint f)
[PROOF STEP]
assume "inj (adjoint f)"
[PROOF STATE]
proof (state)
this:
inj (adjoint f)

goal (2 subgoals):
 1. inj (adjoint f) \<Longrightarrow> surj f
 2. surj f \<Longrightarrow> inj (adjoint f)
[PROOF STEP]
have "(adjoint f) -` {0} = {0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint f -` {0::'m} = {0::'n}
[PROOF STEP]
by (metis \<open>inj (adjoint f)\<close> adjoint_linear assms surj_adjoint_iff_inj ker_orthogonal_comp_adjoint orthogonal_comp_UNIV)
[PROOF STATE]
proof (state)
this:
adjoint f -` {0::'m} = {0::'n}

goal (2 subgoals):
 1. inj (adjoint f) \<Longrightarrow> surj f
 2. surj f \<Longrightarrow> inj (adjoint f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
adjoint f -` {0::'m} = {0::'n}
[PROOF STEP]
have "(range(f))\<^sup>\<bottom> = {0}"
[PROOF STATE]
proof (prove)
using this:
adjoint f -` {0::'m} = {0::'n}

goal (1 subgoal):
 1. range f\<^sup>\<bottom> = {0::'n}
[PROOF STEP]
by (metis (no_types, opaque_lifting) adjoint_adjoint adjoint_linear assms ker_orthogonal_comp_adjoint set_zero)
[PROOF STATE]
proof (state)
this:
range f\<^sup>\<bottom> = {0::'n}

goal (2 subgoals):
 1. inj (adjoint f) \<Longrightarrow> surj f
 2. surj f \<Longrightarrow> inj (adjoint f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
range f\<^sup>\<bottom> = {0::'n}
[PROOF STEP]
show "surj f"
[PROOF STATE]
proof (prove)
using this:
range f\<^sup>\<bottom> = {0::'n}

goal (1 subgoal):
 1. surj f
[PROOF STEP]
by (metis \<open>inj (adjoint f)\<close> adjoint_adjoint adjoint_linear assms surj_adjoint_iff_inj)
[PROOF STATE]
proof (state)
this:
surj f

goal (1 subgoal):
 1. surj f \<Longrightarrow> inj (adjoint f)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. surj f \<Longrightarrow> inj (adjoint f)
[PROOF STEP]
assume "surj f"
[PROOF STATE]
proof (state)
this:
surj f

goal (1 subgoal):
 1. surj f \<Longrightarrow> inj (adjoint f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
surj f
[PROOF STEP]
have "range f = (adjoint f -` {0})\<^sup>\<bottom>"
[PROOF STATE]
proof (prove)
using this:
surj f

goal (1 subgoal):
 1. range f = adjoint f -` {0::'m}\<^sup>\<bottom>
[PROOF STEP]
by (simp add: adjoint_adjoint adjoint_linear assms ker_orthogonal_comp_adjoint)
[PROOF STATE]
proof (state)
this:
range f = adjoint f -` {0::'m}\<^sup>\<bottom>

goal (1 subgoal):
 1. surj f \<Longrightarrow> inj (adjoint f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
range f = adjoint f -` {0::'m}\<^sup>\<bottom>
[PROOF STEP]
have "{0} = adjoint f -` {0}"
[PROOF STATE]
proof (prove)
using this:
range f = adjoint f -` {0::'m}\<^sup>\<bottom>

goal (1 subgoal):
 1. {0::'n} = adjoint f -` {0::'m}
[PROOF STEP]
using \<open>surj f\<close> adjoint_adjoint adjoint_linear assms ker_orthogonal_comp_adjoint
[PROOF STATE]
proof (prove)
using this:
range f = adjoint f -` {0::'m}\<^sup>\<bottom>
surj f
linear ?f \<Longrightarrow> adjoint (adjoint ?f) = ?f
linear ?f \<Longrightarrow> linear (adjoint ?f)
linear f
linear ?f \<Longrightarrow> ?f -` {0::?'n} = range (adjoint ?f)\<^sup>\<bottom>

goal (1 subgoal):
 1. {0::'n} = adjoint f -` {0::'m}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
{0::'n} = adjoint f -` {0::'m}

goal (1 subgoal):
 1. surj f \<Longrightarrow> inj (adjoint f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{0::'n} = adjoint f -` {0::'m}
[PROOF STEP]
show "inj (adjoint f)"
[PROOF STATE]
proof (prove)
using this:
{0::'n} = adjoint f -` {0::'m}

goal (1 subgoal):
 1. inj (adjoint f)
[PROOF STEP]
by (simp add: \<open>surj f\<close> adjoint_adjoint adjoint_linear assms linear_surj_adj_imp_inj)
[PROOF STATE]
proof (state)
this:
inj (adjoint f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ordinal_exp_left_cancel_le [simp]:
"oSuc 0 < w \<Longrightarrow> (w ** x \<le> w ** y) = (x \<le> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. oSuc 0 < w \<Longrightarrow> (w ** x \<le> w ** y) = (x \<le> y)
[PROOF STEP]
by (rule normal.cancel_le[OF normal_exp])