[STATEMENT]
theorem sorted_on_sort_key_on [simp]:
  assumes "f ` set xs \<subseteq> Field r"
  shows "sorted_on r (map f (sort_key_on r f xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_on r (map f (sort_key_on r f xs))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f ` set xs \<subseteq> Field r

goal (1 subgoal):
 1. sorted_on r (map f (sort_key_on r f xs))
[PROOF STEP]
by (induct xs) (simp_all add: sorted_on_insort_key_on)


[STATEMENT]
lemma finite_at_most_singleton:
  assumes "\<And>x y. x \<in> F \<Longrightarrow> y \<in> F \<Longrightarrow> x = y"
  shows "finite F \<and> card F \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite F \<and> card F \<le> 1
[PROOF STEP]
proof (cases "F = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. F = {} \<Longrightarrow> finite F \<and> card F \<le> 1
 2. F \<noteq> {} \<Longrightarrow> finite F \<and> card F \<le> 1
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
F = {}

goal (2 subgoals):
 1. F = {} \<Longrightarrow> finite F \<and> card F \<le> 1
 2. F \<noteq> {} \<Longrightarrow> finite F \<and> card F \<le> 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
F = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
F = {}

goal (1 subgoal):
 1. finite F \<and> card F \<le> 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite F \<and> card F \<le> 1

goal (1 subgoal):
 1. F \<noteq> {} \<Longrightarrow> finite F \<and> card F \<le> 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. F \<noteq> {} \<Longrightarrow> finite F \<and> card F \<le> 1
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
F \<noteq> {}

goal (1 subgoal):
 1. F \<noteq> {} \<Longrightarrow> finite F \<and> card F \<le> 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
F \<noteq> {}
[PROOF STEP]
obtain x where "x \<in> F"
[PROOF STATE]
proof (prove)
using this:
F \<noteq> {}

goal (1 subgoal):
 1. (\<And>x. x \<in> F \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> F

goal (1 subgoal):
 1. F \<noteq> {} \<Longrightarrow> finite F \<and> card F \<le> 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> F
[PROOF STEP]
have "F = {x}"
[PROOF STATE]
proof (prove)
using this:
x \<in> F

goal (1 subgoal):
 1. F = {x}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> F
\<lbrakk>?x \<in> F; ?y \<in> F\<rbrakk> \<Longrightarrow> ?x = ?y

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

goal (1 subgoal):
 1. F \<noteq> {} \<Longrightarrow> finite F \<and> card F \<le> 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
F = {x}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
F = {x}

goal (1 subgoal):
 1. finite F \<and> card F \<le> 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite F \<and> card F \<le> 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma append_Cons_nth_right:
  assumes "i > length xs"
  shows "(xs @ u # ys) ! i = (xs @ z # ys) ! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xs @ u # ys) ! i = (xs @ z # ys) ! i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (xs @ u # ys) ! i = (xs @ z # ys) ! i
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
length xs < i
[PROOF STEP]
have "i - length xs > 0"
[PROOF STATE]
proof (prove)
using this:
length xs < i

goal (1 subgoal):
 1. 0 < i - length xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < i - length xs

goal (1 subgoal):
 1. (xs @ u # ys) ! i = (xs @ z # ys) ! i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < i - length xs
[PROOF STEP]
obtain j where j: "i - length xs = Suc j"
[PROOF STATE]
proof (prove)
using this:
0 < i - length xs

goal (1 subgoal):
 1. (\<And>j. i - length xs = Suc j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases "i - length xs", auto)
[PROOF STATE]
proof (state)
this:
i - length xs = Suc j

goal (1 subgoal):
 1. (xs @ u # ys) ! i = (xs @ z # ys) ! i
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
i - length xs = Suc j

goal (1 subgoal):
 1. (xs @ u # ys) ! i = (xs @ z # ys) ! i
[PROOF STEP]
by (simp add: nth_append)
[PROOF STATE]
proof (state)
this:
(xs @ u # ys) ! i = (xs @ z # ys) ! i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma p1_not_equil:
  shows " p1 x y \<le> 0 \<Longrightarrow> gx x y \<noteq> 0 \<or> gy x y \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p1 x y \<le> 0 \<Longrightarrow> gx x y \<noteq> 0 \<or> gy x y \<noteq> 0
[PROOF STEP]
unfolding gx_def gy_def p1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (21 / 34) - 69 * x / 38 + 19 * x\<^sup>2 / 15 - 9 * x ^ 3 / 28 - 6 * x ^ 4 / 43 + 14 * y / 29 + 31 * x * y / 21 + 182 * x\<^sup>2 * y / 47 - 35 * x ^ 3 * y / 16 - 3 * y\<^sup>2 / 17 - 2 * x * y\<^sup>2 / 9 - 31 * x\<^sup>2 * y\<^sup>2 / 20 + y ^ 3 / 102 + x * y ^ 3 / 59 \<le> 0 \<Longrightarrow> - x + 8 / 10\<^sup>2 * y + x\<^sup>2 * y \<noteq> 0 \<or> 6 / 10 - 8 / 10\<^sup>2 * y - x\<^sup>2 * y \<noteq> 0
[PROOF STEP]
by (sos "()")


[STATEMENT]
lemma real_poly_add:
  assumes "set (coeffs p) \<subseteq> \<real>" "set (coeffs q) \<subseteq> \<real>"
  shows "set (coeffs (p + q)) \<subseteq> \<real>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (coeffs (p + q)) \<subseteq> \<real>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set (coeffs (p + q)) \<subseteq> \<real>
[PROOF STEP]
define pp where "pp = coeffs p"
[PROOF STATE]
proof (state)
this:
pp = coeffs p

goal (1 subgoal):
 1. set (coeffs (p + q)) \<subseteq> \<real>
[PROOF STEP]
define qq where "qq = coeffs q"
[PROOF STATE]
proof (state)
this:
qq = coeffs q

goal (1 subgoal):
 1. set (coeffs (p + q)) \<subseteq> \<real>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (coeffs (p + q)) \<subseteq> \<real>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set (coeffs p) \<subseteq> \<real>
set (coeffs q) \<subseteq> \<real>

goal (1 subgoal):
 1. set (coeffs (p + q)) \<subseteq> \<real>
[PROOF STEP]
unfolding coeffs_plus_eq_plus_coeffs pp_def[symmetric] qq_def[symmetric]
[PROOF STATE]
proof (prove)
using this:
set pp \<subseteq> \<real>
set qq \<subseteq> \<real>

goal (1 subgoal):
 1. set (plus_coeffs pp qq) \<subseteq> \<real>
[PROOF STEP]
by (induct pp qq rule: plus_coeffs.induct, auto simp: cCons_def)
[PROOF STATE]
proof (state)
this:
set (coeffs (p + q)) \<subseteq> \<real>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma neg_numeral_less_ceiling [simp]: "- numeral v < \<lceil>x\<rceil> \<longleftrightarrow> - numeral v < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- numeral v < \<lceil>x\<rceil>) = (- numeral v < x)
[PROOF STEP]
by (simp add: less_ceiling_iff)


[STATEMENT]
lemma equiv_selfloop_per_union_id: "equiv S F \<Longrightarrow> x\<in>S \<Longrightarrow> per_union F x x = F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>equiv S F; x \<in> S\<rbrakk> \<Longrightarrow> per_union F x x = F
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>equiv S F; x \<in> S\<rbrakk> \<Longrightarrow> per_union F x x \<subseteq> F
 2. \<lbrakk>equiv S F; x \<in> S\<rbrakk> \<Longrightarrow> F \<subseteq> per_union F x x
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>equiv S F; x \<in> S\<rbrakk> \<Longrightarrow> per_union F x x \<subseteq> F
[PROOF STEP]
unfolding per_union_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>equiv S F; x \<in> S\<rbrakk> \<Longrightarrow> F \<union> {(xa, y). (xa, x) \<in> F \<and> (y, x) \<in> F} \<union> {(y, xa). (xa, x) \<in> F \<and> (y, x) \<in> F} \<subseteq> F
[PROOF STEP]
using equiv_class_eq_iff
[PROOF STATE]
proof (prove)
using this:
equiv ?A ?r \<Longrightarrow> ((?x, ?y) \<in> ?r) = (?r `` {?x} = ?r `` {?y} \<and> ?x \<in> ?A \<and> ?y \<in> ?A)

goal (1 subgoal):
 1. \<lbrakk>equiv S F; x \<in> S\<rbrakk> \<Longrightarrow> F \<union> {(xa, y). (xa, x) \<in> F \<and> (y, x) \<in> F} \<union> {(y, xa). (xa, x) \<in> F \<and> (y, x) \<in> F} \<subseteq> F
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>equiv S F; x \<in> S\<rbrakk> \<Longrightarrow> F \<subseteq> per_union F x x
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>equiv S F; x \<in> S\<rbrakk> \<Longrightarrow> F \<subseteq> per_union F x x
[PROOF STEP]
unfolding per_union_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>equiv S F; x \<in> S\<rbrakk> \<Longrightarrow> F \<subseteq> F \<union> {(xa, y). (xa, x) \<in> F \<and> (y, x) \<in> F} \<union> {(y, xa). (xa, x) \<in> F \<and> (y, x) \<in> F}
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma poly_mult_comm:
  assumes "set p1 \<subseteq> carrier R" "set p2 \<subseteq> carrier R"
  shows "poly_mult p1 p2 = poly_mult p2 p1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mult p1 p2 = poly_mult p2 p1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_mult p1 p2 = poly_mult p2 p1
[PROOF STEP]
let ?c1 = "coeff p1" and ?c2 = "coeff p2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_mult p1 p2 = poly_mult p2 p1
[PROOF STEP]
have "\<And>i. (\<Oplus>k \<in> {..i}. ?c1 k \<otimes> ?c2 (i - k)) = (\<Oplus>k \<in> {..i}. ?c2 k \<otimes> ?c1 (i - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))
[PROOF STEP]
fix i :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))
[PROOF STEP]
let ?f = "\<lambda>k. ?c1 k \<otimes> ?c2 (i - k)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))
[PROOF STEP]
have in_carrier: "\<And>i. ?c1 i \<in> carrier R" "\<And>i. ?c2 i \<in> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. local.coeff p1 i \<in> carrier R) &&& (\<And>i. local.coeff p2 i \<in> carrier R)
[PROOF STEP]
using coeff_in_carrier[OF assms(1)] coeff_in_carrier[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
local.coeff p1 ?i \<in> carrier R
local.coeff p2 ?i \<in> carrier R

goal (1 subgoal):
 1. (\<And>i. local.coeff p1 i \<in> carrier R) &&& (\<And>i. local.coeff p2 i \<in> carrier R)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.coeff p1 ?i \<in> carrier R
local.coeff p2 ?i \<in> carrier R

goal (1 subgoal):
 1. \<And>i. (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))
[PROOF STEP]
have reindex_inj: "inj_on (\<lambda>k. i - k) {..i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on ((-) i) {..i}
[PROOF STEP]
using inj_on_def
[PROOF STATE]
proof (prove)
using this:
inj_on ?f ?A = (\<forall>x\<in>?A. \<forall>y\<in>?A. ?f x = ?f y \<longrightarrow> x = y)

goal (1 subgoal):
 1. inj_on ((-) i) {..i}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
inj_on ((-) i) {..i}

goal (1 subgoal):
 1. \<And>i. (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
inj_on ((-) i) {..i}

goal (1 subgoal):
 1. \<And>i. (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))
[PROOF STEP]
have "(\<lambda>k. i - k) ` {..i} \<subseteq> {..i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (-) i ` {..i} \<subseteq> {..i}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(-) i ` {..i} \<subseteq> {..i}

goal (1 subgoal):
 1. \<And>i. (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))
[PROOF STEP]
hence "(\<lambda>k. i - k) ` {..i} = {..i}"
[PROOF STATE]
proof (prove)
using this:
(-) i ` {..i} \<subseteq> {..i}

goal (1 subgoal):
 1. (-) i ` {..i} = {..i}
[PROOF STEP]
using reindex_inj endo_inj_surj[of "{..i}" "\<lambda>k. i - k"]
[PROOF STATE]
proof (prove)
using this:
(-) i ` {..i} \<subseteq> {..i}
inj_on ((-) i) {..i}
\<lbrakk>finite {..i}; (-) i ` {..i} \<subseteq> {..i}; inj_on ((-) i) {..i}\<rbrakk> \<Longrightarrow> (-) i ` {..i} = {..i}

goal (1 subgoal):
 1. (-) i ` {..i} = {..i}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(-) i ` {..i} = {..i}

goal (1 subgoal):
 1. \<And>i. (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
inj_on ((-) i) {..i}
(-) i ` {..i} = {..i}
[PROOF STEP]
have "(\<Oplus>k \<in> {..i}. ?f k) = (\<Oplus>k \<in> {..i}. ?f (i - k))"
[PROOF STATE]
proof (prove)
using this:
inj_on ((-) i) {..i}
(-) i ` {..i} = {..i}

goal (1 subgoal):
 1. (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p1 (i - k) \<otimes> local.coeff p2 (i - (i - k)))
[PROOF STEP]
using add.finprod_reindex[of ?f "\<lambda>k. i - k" "{..i}"] in_carrier
[PROOF STATE]
proof (prove)
using this:
inj_on ((-) i) {..i}
(-) i ` {..i} = {..i}
\<lbrakk>(\<lambda>k. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) \<in> (-) i ` {..i} \<rightarrow> carrier R; inj_on ((-) i) {..i}\<rbrakk> \<Longrightarrow> (\<Oplus>k\<in>(-) i ` {..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>x\<in>{..i}. local.coeff p1 (i - x) \<otimes> local.coeff p2 (i - (i - x)))
local.coeff p1 ?i \<in> carrier R
local.coeff p2 ?i \<in> carrier R

goal (1 subgoal):
 1. (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p1 (i - k) \<otimes> local.coeff p2 (i - (i - k)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p1 (i - k) \<otimes> local.coeff p2 (i - (i - k)))

goal (1 subgoal):
 1. \<And>i. (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p1 (i - k) \<otimes> local.coeff p2 (i - (i - k)))

goal (1 subgoal):
 1. \<And>i. (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))
[PROOF STEP]
have "\<And>k. k \<in> {..i} \<Longrightarrow> ?f (i - k) = ?c2 k \<otimes> ?c1 (i - k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. k \<in> {..i} \<Longrightarrow> local.coeff p1 (i - k) \<otimes> local.coeff p2 (i - (i - k)) = local.coeff p2 k \<otimes> local.coeff p1 (i - k)
[PROOF STEP]
using in_carrier m_comm
[PROOF STATE]
proof (prove)
using this:
local.coeff p1 ?i \<in> carrier R
local.coeff p2 ?i \<in> carrier R
\<lbrakk>?x \<in> carrier R; ?y \<in> carrier R\<rbrakk> \<Longrightarrow> ?x \<otimes> ?y = ?y \<otimes> ?x

goal (1 subgoal):
 1. \<And>k. k \<in> {..i} \<Longrightarrow> local.coeff p1 (i - k) \<otimes> local.coeff p2 (i - (i - k)) = local.coeff p2 k \<otimes> local.coeff p1 (i - k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?k \<in> {..i} \<Longrightarrow> local.coeff p1 (i - ?k) \<otimes> local.coeff p2 (i - (i - ?k)) = local.coeff p2 ?k \<otimes> local.coeff p1 (i - ?k)

goal (1 subgoal):
 1. \<And>i. (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))
[PROOF STEP]
hence "(\<Oplus>k \<in> {..i}. ?f (i - k)) = (\<Oplus>k \<in> {..i}. ?c2 k \<otimes> ?c1 (i - k))"
[PROOF STATE]
proof (prove)
using this:
?k \<in> {..i} \<Longrightarrow> local.coeff p1 (i - ?k) \<otimes> local.coeff p2 (i - (i - ?k)) = local.coeff p2 ?k \<otimes> local.coeff p1 (i - ?k)

goal (1 subgoal):
 1. (\<Oplus>k\<in>{..i}. local.coeff p1 (i - k) \<otimes> local.coeff p2 (i - (i - k))) = (\<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))
[PROOF STEP]
using add.finprod_cong'[of "{..i}" "{..i}"] in_carrier
[PROOF STATE]
proof (prove)
using this:
?k \<in> {..i} \<Longrightarrow> local.coeff p1 (i - ?k) \<otimes> local.coeff p2 (i - (i - ?k)) = local.coeff p2 ?k \<otimes> local.coeff p1 (i - ?k)
\<lbrakk>{..i} = {..i}; ?g \<in> {..i} \<rightarrow> carrier R; \<And>ia. ia \<in> {..i} \<Longrightarrow> ?f ia = ?g ia\<rbrakk> \<Longrightarrow> finsum R ?f {..i} = finsum R ?g {..i}
local.coeff p1 ?i \<in> carrier R
local.coeff p2 ?i \<in> carrier R

goal (1 subgoal):
 1. (\<Oplus>k\<in>{..i}. local.coeff p1 (i - k) \<otimes> local.coeff p2 (i - (i - k))) = (\<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Oplus>k\<in>{..i}. local.coeff p1 (i - k) \<otimes> local.coeff p2 (i - (i - k))) = (\<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))

goal (1 subgoal):
 1. \<And>i. (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p1 (i - k) \<otimes> local.coeff p2 (i - (i - k)))
(\<Oplus>k\<in>{..i}. local.coeff p1 (i - k) \<otimes> local.coeff p2 (i - (i - k))) = (\<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))
[PROOF STEP]
show "(\<Oplus>k \<in> {..i}. ?f k) = (\<Oplus>k \<in> {..i}. ?c2 k \<otimes> ?c1 (i - k))"
[PROOF STATE]
proof (prove)
using this:
(\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p1 (i - k) \<otimes> local.coeff p2 (i - (i - k)))
(\<Oplus>k\<in>{..i}. local.coeff p1 (i - k) \<otimes> local.coeff p2 (i - (i - k))) = (\<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))

goal (1 subgoal):
 1. (\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Oplus>k\<in>{..?i}. local.coeff p1 k \<otimes> local.coeff p2 (?i - k)) = (\<Oplus>k\<in>{..?i}. local.coeff p2 k \<otimes> local.coeff p1 (?i - k))

goal (1 subgoal):
 1. poly_mult p1 p2 = poly_mult p2 p1
[PROOF STEP]
hence "coeff (poly_mult p1 p2) = coeff (poly_mult p2 p1)"
[PROOF STATE]
proof (prove)
using this:
(\<Oplus>k\<in>{..?i}. local.coeff p1 k \<otimes> local.coeff p2 (?i - k)) = (\<Oplus>k\<in>{..?i}. local.coeff p2 k \<otimes> local.coeff p1 (?i - k))

goal (1 subgoal):
 1. local.coeff (poly_mult p1 p2) = local.coeff (poly_mult p2 p1)
[PROOF STEP]
using poly_mult_coeff[OF assms] poly_mult_coeff[OF assms(2,1)]
[PROOF STATE]
proof (prove)
using this:
(\<Oplus>k\<in>{..?i}. local.coeff p1 k \<otimes> local.coeff p2 (?i - k)) = (\<Oplus>k\<in>{..?i}. local.coeff p2 k \<otimes> local.coeff p1 (?i - k))
local.coeff (poly_mult p1 p2) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p2 (i - k))
local.coeff (poly_mult p2 p1) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p1 (i - k))

goal (1 subgoal):
 1. local.coeff (poly_mult p1 p2) = local.coeff (poly_mult p2 p1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.coeff (poly_mult p1 p2) = local.coeff (poly_mult p2 p1)

goal (1 subgoal):
 1. poly_mult p1 p2 = poly_mult p2 p1
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
local.coeff (poly_mult p1 p2) = local.coeff (poly_mult p2 p1)

goal (1 subgoal):
 1. poly_mult p1 p2 = poly_mult p2 p1
[PROOF STEP]
using coeff_iff_polynomial_cond[OF poly_mult_is_polynomial[OF _ assms]
                                       poly_mult_is_polynomial[OF _ assms(2,1)]]
          carrier_is_subring
[PROOF STATE]
proof (prove)
using this:
local.coeff (poly_mult p1 p2) = local.coeff (poly_mult p2 p1)
\<lbrakk>subring (carrier R) R; subring (carrier R) R\<rbrakk> \<Longrightarrow> (poly_mult p1 p2 = poly_mult p2 p1) = (local.coeff (poly_mult p1 p2) = local.coeff (poly_mult p2 p1))
subring (carrier R) R

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma convergent_mult_const_iff:
  assumes "c \<noteq> 0"
  shows "convergent (\<lambda>n. c * f n :: 'a::{field,topological_semigroup_mult}) \<longleftrightarrow> convergent f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent (\<lambda>n. c * f n) = convergent f
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. convergent (\<lambda>n. c * f n) \<Longrightarrow> convergent f
 2. convergent f \<Longrightarrow> convergent (\<lambda>n. c * f n)
[PROOF STEP]
assume "convergent (\<lambda>n. c * f n)"
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. c * f n)

goal (2 subgoals):
 1. convergent (\<lambda>n. c * f n) \<Longrightarrow> convergent f
 2. convergent f \<Longrightarrow> convergent (\<lambda>n. c * f n)
[PROOF STEP]
from assms convergent_mult[OF this convergent_const[of "inverse c"]]
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> (0::'a)
convergent (\<lambda>n. c * f n * inverse c)
[PROOF STEP]
show "convergent f"
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a)
convergent (\<lambda>n. c * f n * inverse c)

goal (1 subgoal):
 1. convergent f
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
convergent f

goal (1 subgoal):
 1. convergent f \<Longrightarrow> convergent (\<lambda>n. c * f n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convergent f \<Longrightarrow> convergent (\<lambda>n. c * f n)
[PROOF STEP]
assume "convergent f"
[PROOF STATE]
proof (state)
this:
convergent f

goal (1 subgoal):
 1. convergent f \<Longrightarrow> convergent (\<lambda>n. c * f n)
[PROOF STEP]
from convergent_mult[OF convergent_const[of c] this]
[PROOF STATE]
proof (chain)
picking this:
convergent (\<lambda>n. c * f n)
[PROOF STEP]
show "convergent (\<lambda>n. c * f n)"
[PROOF STATE]
proof (prove)
using this:
convergent (\<lambda>n. c * f n)

goal (1 subgoal):
 1. convergent (\<lambda>n. c * f n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. c * f n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fmsubset_restrict_fset_mono: "m \<subseteq>\<^sub>f n \<Longrightarrow> fmrestrict_fset A m \<subseteq>\<^sub>f fmrestrict_fset A n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<subseteq>\<^sub>f n \<Longrightarrow> fmrestrict_fset A m \<subseteq>\<^sub>f fmrestrict_fset A n
[PROOF STEP]
unfolding fmfilter_alt_defs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<subseteq>\<^sub>f n \<Longrightarrow> fmfilter (\<lambda>a. a |\<in>| A) m \<subseteq>\<^sub>f fmfilter (\<lambda>a. a |\<in>| A) n
[PROOF STEP]
by (rule fmsubset_filter_mono)


[STATEMENT]
lemma bin_rep_index_0:
  fixes n m:: nat
  assumes "m < 2^n" and "k > n"
  shows "(bin_rep k m) ! 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bin_rep k m ! 0 = 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bin_rep k m ! 0 = 0
[PROOF STEP]
have "m < 2^(k-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m < 2 ^ (k - 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
m < 2 ^ n
n < k

goal (1 subgoal):
 1. m < 2 ^ (k - 1)
[PROOF STEP]
by(smt Suc_diff_1 Suc_leI gr0I le_trans less_or_eq_imp_le linorder_neqE_nat not_less
one_less_numeral_iff power_strict_increasing semiring_norm(76))
[PROOF STATE]
proof (state)
this:
m < 2 ^ (k - 1)

goal (1 subgoal):
 1. bin_rep k m ! 0 = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m < 2 ^ (k - 1)
[PROOF STEP]
have f:"m div 2^(k-1) = 0"
[PROOF STATE]
proof (prove)
using this:
m < 2 ^ (k - 1)

goal (1 subgoal):
 1. m div 2 ^ (k - 1) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m div 2 ^ (k - 1) = 0

goal (1 subgoal):
 1. bin_rep k m ! 0 = 0
[PROOF STEP]
have "k \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> k
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
n < k

goal (1 subgoal):
 1. 1 \<le> k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 \<le> k

goal (1 subgoal):
 1. bin_rep k m ! 0 = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
1 \<le> k

goal (1 subgoal):
 1. bin_rep k m ! 0 = 0
[PROOF STEP]
have "bin_rep_aux k m = (m div 2^(k-1)) # (bin_rep_aux (k-1) (m mod 2^(k-1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bin_rep_aux k m = m div 2 ^ (k - 1) # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1))
[PROOF STEP]
using bin_rep_aux.simps(2)
[PROOF STATE]
proof (prove)
using this:
bin_rep_aux (Suc ?n) ?m = ?m div 2 ^ ?n # bin_rep_aux ?n (?m mod 2 ^ ?n)

goal (1 subgoal):
 1. bin_rep_aux k m = m div 2 ^ (k - 1) # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1))
[PROOF STEP]
by(metis Suc_diff_1 assms(2) diff_0_eq_0 neq0_conv zero_less_diff)
[PROOF STATE]
proof (state)
this:
bin_rep_aux k m = m div 2 ^ (k - 1) # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1))

goal (1 subgoal):
 1. bin_rep k m ! 0 = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
bin_rep_aux k m = m div 2 ^ (k - 1) # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1))

goal (1 subgoal):
 1. bin_rep k m ! 0 = 0
[PROOF STEP]
have "bin_rep k m = butlast ((m div 2^(k-1)) # (bin_rep_aux (k-1) (m mod 2^(k-1))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bin_rep k m = butlast (m div 2 ^ (k - 1) # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1)))
[PROOF STEP]
using bin_rep_def
[PROOF STATE]
proof (prove)
using this:
bin_rep ?n ?m = butlast (bin_rep_aux ?n ?m)

goal (1 subgoal):
 1. bin_rep k m = butlast (m div 2 ^ (k - 1) # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1)))
[PROOF STEP]
by (simp add: calculation(2))
[PROOF STATE]
proof (state)
this:
bin_rep k m = butlast (m div 2 ^ (k - 1) # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1)))

goal (1 subgoal):
 1. bin_rep k m ! 0 = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
bin_rep k m = butlast (m div 2 ^ (k - 1) # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1)))

goal (1 subgoal):
 1. bin_rep k m ! 0 = 0
[PROOF STEP]
have "\<dots> = butlast (0 # (bin_rep_aux (k-1) (m mod 2^(k-1))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. butlast (m div 2 ^ (k - 1) # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1))) = butlast (0 # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1)))
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
m div 2 ^ (k - 1) = 0

goal (1 subgoal):
 1. butlast (m div 2 ^ (k - 1) # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1))) = butlast (0 # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
butlast (m div 2 ^ (k - 1) # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1))) = butlast (0 # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1)))

goal (1 subgoal):
 1. bin_rep k m ! 0 = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
butlast (m div 2 ^ (k - 1) # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1))) = butlast (0 # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1)))

goal (1 subgoal):
 1. bin_rep k m ! 0 = 0
[PROOF STEP]
have "\<dots> = 0 # butlast (bin_rep_aux (k-1) (m mod 2^(k-1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. butlast (0 # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1))) = 0 # butlast (bin_rep_aux (k - 1) (m mod 2 ^ (k - 1)))
[PROOF STEP]
by(simp add: bin_rep_aux_neq_nil)
[PROOF STATE]
proof (state)
this:
butlast (0 # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1))) = 0 # butlast (bin_rep_aux (k - 1) (m mod 2 ^ (k - 1)))

goal (1 subgoal):
 1. bin_rep k m ! 0 = 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
1 \<le> k
bin_rep_aux k m = m div 2 ^ (k - 1) # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1))
bin_rep k m = butlast (m div 2 ^ (k - 1) # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1)))
butlast (m div 2 ^ (k - 1) # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1))) = butlast (0 # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1)))
butlast (0 # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1))) = 0 # butlast (bin_rep_aux (k - 1) (m mod 2 ^ (k - 1)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 \<le> k
bin_rep_aux k m = m div 2 ^ (k - 1) # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1))
bin_rep k m = butlast (m div 2 ^ (k - 1) # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1)))
butlast (m div 2 ^ (k - 1) # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1))) = butlast (0 # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1)))
butlast (0 # bin_rep_aux (k - 1) (m mod 2 ^ (k - 1))) = 0 # butlast (bin_rep_aux (k - 1) (m mod 2 ^ (k - 1)))

goal (1 subgoal):
 1. bin_rep k m ! 0 = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
bin_rep k m ! 0 = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coeff_sym_mpoly_monom_of_set [simp]:
  assumes "finite X" "Y \<subseteq> X" "card Y = k"
  shows   "MPoly_Type.coeff (sym_mpoly X k) (monom_of_set Y) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.coeff (sym_mpoly X k) (monom_of_set Y) = (1::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite X
Y \<subseteq> X
card Y = k

goal (1 subgoal):
 1. MPoly_Type.coeff (sym_mpoly X k) (monom_of_set Y) = (1::'a)
[PROOF STEP]
by (auto simp: coeff_sym_mpoly)


[STATEMENT]
lemma greaterThanLessThan_iff[simp]: "(i \<in> {l<\<^sub>a..<\<^sub>au}) = (l <\<^sub>a i \<and> i <\<^sub>a u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i \<in> {l<\<^sub>a..<\<^sub>au}) = (l <\<^sub>a i \<and> i <\<^sub>a u)
[PROOF STEP]
unfolding interval_def ray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i \<in> {x \<in> UNIV. l <\<^sub>a x} \<inter> {x \<in> UNIV. x <\<^sub>a u}) = (l <\<^sub>a i \<and> i <\<^sub>a u)
[PROOF STEP]
by simp


[STATEMENT]
lemma imirror_bounds_Un: "
  imirror_bounds (A \<union> B) l r =
  imirror_bounds A l r \<union> imirror_bounds B l r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. imirror_bounds (A \<union> B) l r = imirror_bounds A l r \<union> imirror_bounds B l r
[PROOF STEP]
by (simp add: imirror_bounds_def image_Un)


[STATEMENT]
lemma subst_compose_fv:
  assumes "fv (\<theta> x) = {}"
  shows "fv ((\<theta> \<circ>\<^sub>s \<sigma>) x) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fv ((\<theta> \<circ>\<^sub>s \<sigma>) x) = {}
[PROOF STEP]
using assms subst_apply_fv_empty
[PROOF STATE]
proof (prove)
using this:
fv (\<theta> x) = {}
fv ?t = {} \<Longrightarrow> fv (?t \<cdot> ?\<sigma>) = {}

goal (1 subgoal):
 1. fv ((\<theta> \<circ>\<^sub>s \<sigma>) x) = {}
[PROOF STEP]
unfolding subst_compose_def
[PROOF STATE]
proof (prove)
using this:
fv (\<theta> x) = {}
fv ?t = {} \<Longrightarrow> fv (?t \<cdot> ?\<sigma>) = {}

goal (1 subgoal):
 1. fv (\<theta> x \<cdot> \<sigma>) = {}
[PROOF STEP]
by fast


[STATEMENT]
lemma divisor_count_upper_bound_aux:
  fixes n :: nat
  shows "divisor_count n \<le> 2 * card {d. d dvd n \<and> d \<le> sqrt n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
proof (cases "n = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
 2. n \<noteq> 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
 2. n \<noteq> 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
hence n: "n > 0"
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

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

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
 2. n \<noteq> 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
have *: "x > 0" if "x dvd n" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x
[PROOF STEP]
using that n
[PROOF STATE]
proof (prove)
using this:
x dvd n
0 < n

goal (1 subgoal):
 1. 0 < x
[PROOF STEP]
by (auto intro!: Nat.gr0I)
[PROOF STATE]
proof (state)
this:
?x dvd n \<Longrightarrow> 0 < ?x

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
 2. n \<noteq> 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
have **: "real n = sqrt (real n) * sqrt (real n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n = sqrt (real n) * sqrt (real n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real n = sqrt (real n) * sqrt (real n)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
 2. n \<noteq> 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
have ***: "n < x * sqrt n \<longleftrightarrow> sqrt n < x" "x * sqrt n < n \<longleftrightarrow> x < sqrt n" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real n < x * sqrt (real n)) = (sqrt (real n) < x) &&& (x * sqrt (real n) < real n) = (x < sqrt (real n))
[PROOF STEP]
by (metis ** n of_nat_0_less_iff mult_less_iff1 real_sqrt_gt_0_iff)+
[PROOF STATE]
proof (state)
this:
(real n < ?x * sqrt (real n)) = (sqrt (real n) < ?x)
(?x * sqrt (real n) < real n) = (?x < sqrt (real n))

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
 2. n \<noteq> 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
have "divisor_count n = card {d. d dvd n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_count n = card {d. d dvd n}
[PROOF STEP]
by (simp add: divisor_count_def)
[PROOF STATE]
proof (state)
this:
divisor_count n = card {d. d dvd n}

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
 2. n \<noteq> 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
divisor_count n = card {d. d dvd n}

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
 2. n \<noteq> 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
have "{d. d dvd n} = {d. d dvd n \<and> d \<le> sqrt n} \<union> {d. d dvd n \<and> d > sqrt n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {d. d dvd n} = {d. d dvd n \<and> real d \<le> sqrt (real n)} \<union> {d. d dvd n \<and> sqrt (real n) < real d}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{d. d dvd n} = {d. d dvd n \<and> real d \<le> sqrt (real n)} \<union> {d. d dvd n \<and> sqrt (real n) < real d}

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
 2. n \<noteq> 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{d. d dvd n} = {d. d dvd n \<and> real d \<le> sqrt (real n)} \<union> {d. d dvd n \<and> sqrt (real n) < real d}

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
 2. n \<noteq> 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
have "card \<dots> = card {d. d dvd n \<and> d \<le> sqrt n} + card {d. d dvd n \<and> d > sqrt n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({d. d dvd n \<and> real d \<le> sqrt (real n)} \<union> {d. d dvd n \<and> sqrt (real n) < real d}) = card {d. d dvd n \<and> real d \<le> sqrt (real n)} + card {d. d dvd n \<and> sqrt (real n) < real d}
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. card ({d. d dvd n \<and> real d \<le> sqrt (real n)} \<union> {d. d dvd n \<and> sqrt (real n) < real d}) = card {d. d dvd n \<and> real d \<le> sqrt (real n)} + card {d. d dvd n \<and> sqrt (real n) < real d}
[PROOF STEP]
by (subst card_Un_disjoint) auto
[PROOF STATE]
proof (state)
this:
card ({d. d dvd n \<and> real d \<le> sqrt (real n)} \<union> {d. d dvd n \<and> sqrt (real n) < real d}) = card {d. d dvd n \<and> real d \<le> sqrt (real n)} + card {d. d dvd n \<and> sqrt (real n) < real d}

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
 2. n \<noteq> 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ({d. d dvd n \<and> real d \<le> sqrt (real n)} \<union> {d. d dvd n \<and> sqrt (real n) < real d}) = card {d. d dvd n \<and> real d \<le> sqrt (real n)} + card {d. d dvd n \<and> sqrt (real n) < real d}

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
 2. n \<noteq> 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
have "bij_betw (\<lambda>d. n div d) {d. d dvd n \<and> d > sqrt n} {d. d dvd n \<and> d < sqrt n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw ((div) n) {d. d dvd n \<and> sqrt (real n) < real d} {d. d dvd n \<and> real d < sqrt (real n)}
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. bij_betw ((div) n) {d. d dvd n \<and> sqrt (real n) < real d} {d. d dvd n \<and> real d < sqrt (real n)}
[PROOF STEP]
by (intro bij_betwI[of _ _ _ "\<lambda>d. n div d"])
               (auto simp: Real.real_of_nat_div real_sqrt_divide field_simps * ***)
[PROOF STATE]
proof (state)
this:
bij_betw ((div) n) {d. d dvd n \<and> sqrt (real n) < real d} {d. d dvd n \<and> real d < sqrt (real n)}

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
 2. n \<noteq> 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
hence "card {d. d dvd n \<and> d > sqrt n} = card {d. d dvd n \<and> d < sqrt n}"
[PROOF STATE]
proof (prove)
using this:
bij_betw ((div) n) {d. d dvd n \<and> sqrt (real n) < real d} {d. d dvd n \<and> real d < sqrt (real n)}

goal (1 subgoal):
 1. card {d. d dvd n \<and> sqrt (real n) < real d} = card {d. d dvd n \<and> real d < sqrt (real n)}
[PROOF STEP]
by (rule bij_betw_same_card)
[PROOF STATE]
proof (state)
this:
card {d. d dvd n \<and> sqrt (real n) < real d} = card {d. d dvd n \<and> real d < sqrt (real n)}

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
 2. n \<noteq> 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {d. d dvd n \<and> sqrt (real n) < real d} = card {d. d dvd n \<and> real d < sqrt (real n)}

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
 2. n \<noteq> 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
have "\<dots> \<le> card {d. d dvd n \<and> d \<le> sqrt n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {d. d dvd n \<and> real d < sqrt (real n)} \<le> card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. card {d. d dvd n \<and> real d < sqrt (real n)} \<le> card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
by (intro card_mono) auto
[PROOF STATE]
proof (state)
this:
card {d. d dvd n \<and> real d < sqrt (real n)} \<le> card {d. d dvd n \<and> real d \<le> sqrt (real n)}

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
 2. n \<noteq> 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x \<le> y \<Longrightarrow> card {d. d dvd n \<and> real d \<le> sqrt (real n)} + x \<le> card {d. d dvd n \<and> real d \<le> sqrt (real n)} + y) \<Longrightarrow> divisor_count n \<le> card {d. d dvd n \<and> real d \<le> sqrt (real n)} + card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
show "divisor_count n \<le> 2 * \<dots>"
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> card {d. d dvd n \<and> real d \<le> sqrt (real n)} + x \<le> card {d. d dvd n \<and> real d \<le> sqrt (real n)} + y) \<Longrightarrow> divisor_count n \<le> card {d. d dvd n \<and> real d \<le> sqrt (real n)} + card {d. d dvd n \<and> real d \<le> sqrt (real n)}

goal (1 subgoal):
 1. divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> divisor_count n \<le> 2 * card {d. d dvd n \<and> real d \<le> sqrt (real n)}
[PROOF STEP]
qed auto


[STATEMENT]
lemma less_imp_erf_real_less:
  assumes "a < (b::real)"
  shows   "erf a < erf b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. erf a < erf b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. erf a < erf b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
a < b
[PROOF STEP]
have "\<exists>z. z > a \<and> z < b \<and> erf b - erf a = (b - a) * (2 / sqrt pi * exp (- z\<^sup>2))"
[PROOF STATE]
proof (prove)
using this:
a < b

goal (1 subgoal):
 1. \<exists>z>a. z < b \<and> erf b - erf a = (b - a) * (2 / sqrt pi * exp (- z\<^sup>2))
[PROOF STEP]
by (intro MVT2) (auto intro!: derivative_eq_intros simp: field_simps)
[PROOF STATE]
proof (state)
this:
\<exists>z>a. z < b \<and> erf b - erf a = (b - a) * (2 / sqrt pi * exp (- z\<^sup>2))

goal (1 subgoal):
 1. erf a < erf b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>z>a. z < b \<and> erf b - erf a = (b - a) * (2 / sqrt pi * exp (- z\<^sup>2))
[PROOF STEP]
obtain z where z: "a < z" "z < b"
    and erf: "erf b - erf a = (b - a) * (2 / sqrt pi * exp (- z\<^sup>2))"
[PROOF STATE]
proof (prove)
using this:
\<exists>z>a. z < b \<and> erf b - erf a = (b - a) * (2 / sqrt pi * exp (- z\<^sup>2))

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>a < z; z < b; erf b - erf a = (b - a) * (2 / sqrt pi * exp (- z\<^sup>2))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a < z
z < b
erf b - erf a = (b - a) * (2 / sqrt pi * exp (- z\<^sup>2))

goal (1 subgoal):
 1. erf a < erf b
[PROOF STEP]
note erf
[PROOF STATE]
proof (state)
this:
erf b - erf a = (b - a) * (2 / sqrt pi * exp (- z\<^sup>2))

goal (1 subgoal):
 1. erf a < erf b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
erf b - erf a = (b - a) * (2 / sqrt pi * exp (- z\<^sup>2))

goal (1 subgoal):
 1. erf a < erf b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
a < b
[PROOF STEP]
have "(b - a) * (2 / sqrt pi * exp (- z\<^sup>2)) > 0"
[PROOF STATE]
proof (prove)
using this:
a < b

goal (1 subgoal):
 1. 0 < (b - a) * (2 / sqrt pi * exp (- z\<^sup>2))
[PROOF STEP]
by (intro mult_pos_pos divide_pos_pos) simp_all
[PROOF STATE]
proof (state)
this:
0 < (b - a) * (2 / sqrt pi * exp (- z\<^sup>2))

goal (1 subgoal):
 1. erf a < erf b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 < erf b - erf a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < erf b - erf a

goal (1 subgoal):
 1. erf a < erf b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
erf a < erf b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma norm_column_divide_by_norm:
  fixes A::"'a::{real_inner}^'cols^'rows"
  assumes a: "column a A \<noteq> 0"
  shows "norm (column a (divide_by_norm A)) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (column a (divide_by_norm A)) = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (column a (divide_by_norm A)) = 1
[PROOF STEP]
have not_0: "norm (\<chi> i. A $ i $ a) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<chi>i. A $ i $ a) \<noteq> 0
[PROOF STEP]
by (metis a column_def norm_eq_zero)
[PROOF STATE]
proof (state)
this:
norm (\<chi>i. A $ i $ a) \<noteq> 0

goal (1 subgoal):
 1. norm (column a (divide_by_norm A)) = 1
[PROOF STEP]
have "column a (divide_by_norm A) = (\<chi> i. (1 / norm (\<chi> i. A $ i $ a)) *\<^sub>R A $ i $ a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column a (divide_by_norm A) = (\<chi>i. (1 / norm (\<chi>i. A $ i $ a)) *\<^sub>R A $ i $ a)
[PROOF STEP]
unfolding divide_by_norm_def column_def normalize_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>i. (\<chi>a b. ((1 / norm (\<chi>i. A $ i $ b)) *\<^sub>R (\<chi>i. A $ i $ b)) $ a) $ i $ a) = (\<chi>i. (1 / norm (\<chi>i. A $ i $ a)) *\<^sub>R A $ i $ a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
column a (divide_by_norm A) = (\<chi>i. (1 / norm (\<chi>i. A $ i $ a)) *\<^sub>R A $ i $ a)

goal (1 subgoal):
 1. norm (column a (divide_by_norm A)) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
column a (divide_by_norm A) = (\<chi>i. (1 / norm (\<chi>i. A $ i $ a)) *\<^sub>R A $ i $ a)

goal (1 subgoal):
 1. norm (column a (divide_by_norm A)) = 1
[PROOF STEP]
have "... =  (1 / norm (\<chi> i. A $ i $ a)) *\<^sub>R (\<chi> i.  A $ i $ a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>i. (1 / norm (\<chi>i. A $ i $ a)) *\<^sub>R A $ i $ a) = (1 / norm (\<chi>i. A $ i $ a)) *\<^sub>R (\<chi>i. A $ i $ a)
[PROOF STEP]
unfolding vec_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. (\<chi>i. (1 / norm (\<chi>i. A $ i $ a)) *\<^sub>R A $ i $ a) $ i = ((1 / norm (\<chi>i. A $ i $ a)) *\<^sub>R (\<chi>i. A $ i $ a)) $ i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<chi>i. (1 / norm (\<chi>i. A $ i $ a)) *\<^sub>R A $ i $ a) = (1 / norm (\<chi>i. A $ i $ a)) *\<^sub>R (\<chi>i. A $ i $ a)

goal (1 subgoal):
 1. norm (column a (divide_by_norm A)) = 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
column a (divide_by_norm A) = (1 / norm (\<chi>i. A $ i $ a)) *\<^sub>R (\<chi>i. A $ i $ a)
[PROOF STEP]
have "norm (column a (divide_by_norm A)) = norm ((1 / norm (\<chi> i. A $ i $ a)) *\<^sub>R (\<chi> i.  A $ i $ a))"
[PROOF STATE]
proof (prove)
using this:
column a (divide_by_norm A) = (1 / norm (\<chi>i. A $ i $ a)) *\<^sub>R (\<chi>i. A $ i $ a)

goal (1 subgoal):
 1. norm (column a (divide_by_norm A)) = norm ((1 / norm (\<chi>i. A $ i $ a)) *\<^sub>R (\<chi>i. A $ i $ a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
norm (column a (divide_by_norm A)) = norm ((1 / norm (\<chi>i. A $ i $ a)) *\<^sub>R (\<chi>i. A $ i $ a))

goal (1 subgoal):
 1. norm (column a (divide_by_norm A)) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (column a (divide_by_norm A)) = norm ((1 / norm (\<chi>i. A $ i $ a)) *\<^sub>R (\<chi>i. A $ i $ a))

goal (1 subgoal):
 1. norm (column a (divide_by_norm A)) = 1
[PROOF STEP]
have "... = \<bar>1 / norm (\<chi> i. A $ i $ a)\<bar> * norm (\<chi> i. A $ i $ a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((1 / norm (\<chi>i. A $ i $ a)) *\<^sub>R (\<chi>i. A $ i $ a)) = \<bar>1 / norm (\<chi>i. A $ i $ a)\<bar> * norm (\<chi>i. A $ i $ a)
[PROOF STEP]
unfolding norm_scaleR
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>1 / norm (\<chi>i. A $ i $ a)\<bar> * norm (\<chi>i. A $ i $ a) = \<bar>1 / norm (\<chi>i. A $ i $ a)\<bar> * norm (\<chi>i. A $ i $ a)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
norm ((1 / norm (\<chi>i. A $ i $ a)) *\<^sub>R (\<chi>i. A $ i $ a)) = \<bar>1 / norm (\<chi>i. A $ i $ a)\<bar> * norm (\<chi>i. A $ i $ a)

goal (1 subgoal):
 1. norm (column a (divide_by_norm A)) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm ((1 / norm (\<chi>i. A $ i $ a)) *\<^sub>R (\<chi>i. A $ i $ a)) = \<bar>1 / norm (\<chi>i. A $ i $ a)\<bar> * norm (\<chi>i. A $ i $ a)

goal (1 subgoal):
 1. norm (column a (divide_by_norm A)) = 1
[PROOF STEP]
have "... = (1 / norm (\<chi> i. A $ i $ a)) * norm (\<chi> i. A $ i $ a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>1 / norm (\<chi>i. A $ i $ a)\<bar> * norm (\<chi>i. A $ i $ a) = 1 / norm (\<chi>i. A $ i $ a) * norm (\<chi>i. A $ i $ a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>1 / norm (\<chi>i. A $ i $ a)\<bar> * norm (\<chi>i. A $ i $ a) = 1 / norm (\<chi>i. A $ i $ a) * norm (\<chi>i. A $ i $ a)

goal (1 subgoal):
 1. norm (column a (divide_by_norm A)) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>1 / norm (\<chi>i. A $ i $ a)\<bar> * norm (\<chi>i. A $ i $ a) = 1 / norm (\<chi>i. A $ i $ a) * norm (\<chi>i. A $ i $ a)

goal (1 subgoal):
 1. norm (column a (divide_by_norm A)) = 1
[PROOF STEP]
have "... = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / norm (\<chi>i. A $ i $ a) * norm (\<chi>i. A $ i $ a) = 1
[PROOF STEP]
using not_0
[PROOF STATE]
proof (prove)
using this:
norm (\<chi>i. A $ i $ a) \<noteq> 0

goal (1 subgoal):
 1. 1 / norm (\<chi>i. A $ i $ a) * norm (\<chi>i. A $ i $ a) = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 / norm (\<chi>i. A $ i $ a) * norm (\<chi>i. A $ i $ a) = 1

goal (1 subgoal):
 1. norm (column a (divide_by_norm A)) = 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm (column a (divide_by_norm A)) = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm (column a (divide_by_norm A)) = 1

goal (1 subgoal):
 1. norm (column a (divide_by_norm A)) = 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm (column a (divide_by_norm A)) = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma strip_while_filter:
  shows "filter ((\<noteq>) 0) (strip_while ((=) 0) (lst::'a::zero list)) = filter ((\<noteq>) 0) lst"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter ((\<noteq>) (0::'a)) (strip_while ((=) (0::'a)) lst) = filter ((\<noteq>) (0::'a)) lst
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. filter ((\<noteq>) (0::'a)) (strip_while ((=) (0::'a)) lst) = filter ((\<noteq>) (0::'a)) lst
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. filter ((\<noteq>) (0::'a)) (strip_while ((=) (0::'a)) lst) = filter ((\<noteq>) (0::'a)) lst
[PROOF STEP]
fix lst::"'a list"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. filter ((\<noteq>) (0::'a)) (strip_while ((=) (0::'a)) lst) = filter ((\<noteq>) (0::'a)) lst
[PROOF STEP]
have "filter ((\<noteq>) 0) (dropWhile ((=) 0) lst) = filter ((\<noteq>) 0) lst"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter ((\<noteq>) (0::'a)) (dropWhile ((=) (0::'a)) lst) = filter ((\<noteq>) (0::'a)) lst
[PROOF STEP]
by (induct lst;auto)
[PROOF STATE]
proof (state)
this:
filter ((\<noteq>) (0::'a)) (dropWhile ((=) (0::'a)) lst) = filter ((\<noteq>) (0::'a)) lst

goal (1 subgoal):
 1. filter ((\<noteq>) (0::'a)) (strip_while ((=) (0::'a)) lst) = filter ((\<noteq>) (0::'a)) lst
[PROOF STEP]
hence "(filter ((\<noteq>) 0) (strip_while ((=) 0) (rev lst))) = filter ((\<noteq>) 0) (rev lst)"
[PROOF STATE]
proof (prove)
using this:
filter ((\<noteq>) (0::'a)) (dropWhile ((=) (0::'a)) lst) = filter ((\<noteq>) (0::'a)) lst

goal (1 subgoal):
 1. filter ((\<noteq>) (0::'a)) (strip_while ((=) (0::'a)) (rev lst)) = filter ((\<noteq>) (0::'a)) (rev lst)
[PROOF STEP]
unfolding strip_while_def
[PROOF STATE]
proof (prove)
using this:
filter ((\<noteq>) (0::'a)) (dropWhile ((=) (0::'a)) lst) = filter ((\<noteq>) (0::'a)) lst

goal (1 subgoal):
 1. filter ((\<noteq>) (0::'a)) ((rev \<circ> dropWhile ((=) (0::'a)) \<circ> rev) (rev lst)) = filter ((\<noteq>) (0::'a)) (rev lst)
[PROOF STEP]
by(simp)
[PROOF STATE]
proof (state)
this:
filter ((\<noteq>) (0::'a)) (strip_while ((=) (0::'a)) (rev lst)) = filter ((\<noteq>) (0::'a)) (rev lst)

goal (1 subgoal):
 1. filter ((\<noteq>) (0::'a)) (strip_while ((=) (0::'a)) lst) = filter ((\<noteq>) (0::'a)) lst
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
filter ((\<noteq>) (0::'a)) (strip_while ((=) (0::'a)) (rev ?lsta2)) = filter ((\<noteq>) (0::'a)) (rev ?lsta2)

goal (1 subgoal):
 1. filter ((\<noteq>) (0::'a)) (strip_while ((=) (0::'a)) lst) = filter ((\<noteq>) (0::'a)) lst
[PROOF STEP]
from this[of "rev lst"]
[PROOF STATE]
proof (chain)
picking this:
filter ((\<noteq>) (0::'a)) (strip_while ((=) (0::'a)) (rev (rev lst))) = filter ((\<noteq>) (0::'a)) (rev (rev lst))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
filter ((\<noteq>) (0::'a)) (strip_while ((=) (0::'a)) (rev (rev lst))) = filter ((\<noteq>) (0::'a)) (rev (rev lst))

goal (1 subgoal):
 1. filter ((\<noteq>) (0::'a)) (strip_while ((=) (0::'a)) lst) = filter ((\<noteq>) (0::'a)) lst
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
filter ((\<noteq>) (0::'a)) (strip_while ((=) (0::'a)) lst) = filter ((\<noteq>) (0::'a)) lst

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_differentiable_def:
  "f differentiable at x within s \<longleftrightarrow> (\<exists>D. (f has_real_derivative D) (at x within s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f differentiable at x within s) = (\<exists>D. (f has_real_derivative D) (at x within s))
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f differentiable at x within s \<Longrightarrow> \<exists>D. (f has_real_derivative D) (at x within s)
 2. \<And>D. (f has_real_derivative D) (at x within s) \<Longrightarrow> f differentiable at x within s
[PROOF STEP]
assume "f differentiable at x within s"
[PROOF STATE]
proof (state)
this:
f differentiable at x within s

goal (2 subgoals):
 1. f differentiable at x within s \<Longrightarrow> \<exists>D. (f has_real_derivative D) (at x within s)
 2. \<And>D. (f has_real_derivative D) (at x within s) \<Longrightarrow> f differentiable at x within s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f differentiable at x within s
[PROOF STEP]
obtain f' where *: "(f has_derivative f') (at x within s)"
[PROOF STATE]
proof (prove)
using this:
f differentiable at x within s

goal (1 subgoal):
 1. (\<And>f'. (f has_derivative f') (at x within s) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding differentiable_def
[PROOF STATE]
proof (prove)
using this:
\<exists>D. (f has_derivative D) (at x within s)

goal (1 subgoal):
 1. (\<And>f'. (f has_derivative f') (at x within s) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(f has_derivative f') (at x within s)

goal (2 subgoals):
 1. f differentiable at x within s \<Longrightarrow> \<exists>D. (f has_real_derivative D) (at x within s)
 2. \<And>D. (f has_real_derivative D) (at x within s) \<Longrightarrow> f differentiable at x within s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(f has_derivative f') (at x within s)
[PROOF STEP]
obtain c where "f' = ((*) c)"
[PROOF STATE]
proof (prove)
using this:
(f has_derivative f') (at x within s)

goal (1 subgoal):
 1. (\<And>c. f' = (*) c \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis real_bounded_linear has_derivative_bounded_linear mult.commute fun_eq_iff)
[PROOF STATE]
proof (state)
this:
f' = (*) c

goal (2 subgoals):
 1. f differentiable at x within s \<Longrightarrow> \<exists>D. (f has_real_derivative D) (at x within s)
 2. \<And>D. (f has_real_derivative D) (at x within s) \<Longrightarrow> f differentiable at x within s
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
(f has_derivative f') (at x within s)
f' = (*) c
[PROOF STEP]
show "\<exists>D. (f has_real_derivative D) (at x within s)"
[PROOF STATE]
proof (prove)
using this:
(f has_derivative f') (at x within s)
f' = (*) c

goal (1 subgoal):
 1. \<exists>D. (f has_real_derivative D) (at x within s)
[PROOF STEP]
unfolding has_field_derivative_def
[PROOF STATE]
proof (prove)
using this:
(f has_derivative f') (at x within s)
f' = (*) c

goal (1 subgoal):
 1. \<exists>D. (f has_derivative (*) D) (at x within s)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>D. (f has_real_derivative D) (at x within s)

goal (1 subgoal):
 1. \<And>D. (f has_real_derivative D) (at x within s) \<Longrightarrow> f differentiable at x within s
[PROOF STEP]
qed (auto simp: differentiable_def has_field_derivative_def)


[STATEMENT]
lemma lea123456_lta__lta:
  assumes "A B C LeA D E F" and
    "D E F LtA G H I"
  shows "A B C LtA G H I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A B C LtA G H I
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A B C LtA G H I
[PROOF STEP]
have "\<not> G H I LeA F E D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> G H I LeA F E D
[PROOF STEP]
by (metis (no_types) Tarski_neutral_dimensionless.lea__nlta Tarski_neutral_dimensionless.lta_left_comm Tarski_neutral_dimensionless_axioms assms(2))
[PROOF STATE]
proof (state)
this:
\<not> G H I LeA F E D

goal (1 subgoal):
 1. A B C LtA G H I
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> G H I LeA F E D
[PROOF STEP]
have "\<not> A B C CongA G H I"
[PROOF STATE]
proof (prove)
using this:
\<not> G H I LeA F E D

goal (1 subgoal):
 1. \<not> A B C CongA G H I
[PROOF STEP]
by (metis Tarski_neutral_dimensionless.lta_distincts Tarski_neutral_dimensionless_axioms assms(1) assms(2) conga_pseudo_refl l11_30)
[PROOF STATE]
proof (state)
this:
\<not> A B C CongA G H I

goal (1 subgoal):
 1. A B C LtA G H I
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> A B C CongA G H I

goal (1 subgoal):
 1. A B C LtA G H I
[PROOF STEP]
by (meson LtA_def Tarski_neutral_dimensionless.lea_trans Tarski_neutral_dimensionless_axioms assms(1) assms(2))
[PROOF STATE]
proof (state)
this:
A B C LtA G H I

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma telescope_sums:
  fixes c :: "'a::real_normed_vector"
  assumes "f \<longlonglongrightarrow> c"
  shows "(\<lambda>n. f (Suc n) - f n) sums (c - f 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. f (Suc n) - f n) sums (c - f 0)
[PROOF STEP]
unfolding sums_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>n<n. f (Suc n) - f n) \<longlonglongrightarrow> c - f 0
[PROOF STEP]
proof (subst filterlim_sequentially_Suc [symmetric])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. \<Sum>n<Suc x. f (Suc n) - f n) \<longlonglongrightarrow> c - f 0
[PROOF STEP]
have "(\<lambda>n. \<Sum>k<Suc n. f (Suc k) - f k) = (\<lambda>n. f (Suc n) - f 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k<Suc n. f (Suc k) - f k) = (\<lambda>n. f (Suc n) - f 0)
[PROOF STEP]
by (simp add: lessThan_Suc_atMost atLeast0AtMost [symmetric] sum_Suc_diff)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>k<Suc n. f (Suc k) - f k) = (\<lambda>n. f (Suc n) - f 0)

goal (1 subgoal):
 1. (\<lambda>x. \<Sum>n<Suc x. f (Suc n) - f n) \<longlonglongrightarrow> c - f 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>k<Suc n. f (Suc k) - f k) = (\<lambda>n. f (Suc n) - f 0)

goal (1 subgoal):
 1. (\<lambda>x. \<Sum>n<Suc x. f (Suc n) - f n) \<longlonglongrightarrow> c - f 0
[PROOF STEP]
have "\<dots> \<longlonglongrightarrow> c - f 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. f (Suc n) - f 0) \<longlonglongrightarrow> c - f 0
[PROOF STEP]
by (intro tendsto_diff LIMSEQ_Suc[OF assms] tendsto_const)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. f (Suc n) - f 0) \<longlonglongrightarrow> c - f 0

goal (1 subgoal):
 1. (\<lambda>x. \<Sum>n<Suc x. f (Suc n) - f n) \<longlonglongrightarrow> c - f 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. \<Sum>k<Suc n. f (Suc k) - f k) \<longlonglongrightarrow> c - f 0
[PROOF STEP]
show "(\<lambda>n. \<Sum>n<Suc n. f (Suc n) - f n) \<longlonglongrightarrow> c - f 0"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>k<Suc n. f (Suc k) - f k) \<longlonglongrightarrow> c - f 0

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>n<Suc n. f (Suc n) - f n) \<longlonglongrightarrow> c - f 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>n<Suc n. f (Suc n) - f n) \<longlonglongrightarrow> c - f 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma non_increasing_or:
  assumes "non_increasing (applies_eq A)"
      and "non_increasing (applies_eq B)"
    shows "non_increasing (applies_eq (Or A B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. non_increasing (applies_eq (Or A B))
[PROOF STEP]
proof (rule non_increasingI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<Delta> \<Delta>'. smaller_interp \<Delta> \<Delta>' \<Longrightarrow> smaller_interp (applies_eq (Or A B) \<Delta>') (applies_eq (Or A B) \<Delta>)
[PROOF STEP]
fix \<Delta> \<Delta>' :: "('c, 'd, 'a) interp"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<Delta> \<Delta>'. smaller_interp \<Delta> \<Delta>' \<Longrightarrow> smaller_interp (applies_eq (Or A B) \<Delta>') (applies_eq (Or A B) \<Delta>)
[PROOF STEP]
assume asm0: "smaller_interp \<Delta> \<Delta>'"
[PROOF STATE]
proof (state)
this:
smaller_interp \<Delta> \<Delta>'

goal (1 subgoal):
 1. \<And>\<Delta> \<Delta>'. smaller_interp \<Delta> \<Delta>' \<Longrightarrow> smaller_interp (applies_eq (Or A B) \<Delta>') (applies_eq (Or A B) \<Delta>)
[PROOF STEP]
show "smaller_interp (applies_eq (Or A B) \<Delta>') (applies_eq (Or A B) \<Delta>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smaller_interp (applies_eq (Or A B) \<Delta>') (applies_eq (Or A B) \<Delta>)
[PROOF STEP]
proof (rule smaller_interpI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>s x. x \<in> applies_eq (Or A B) \<Delta>' s \<Longrightarrow> x \<in> applies_eq (Or A B) \<Delta> s
[PROOF STEP]
fix s x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>s x. x \<in> applies_eq (Or A B) \<Delta>' s \<Longrightarrow> x \<in> applies_eq (Or A B) \<Delta> s
[PROOF STEP]
assume asm1: "x \<in> applies_eq (Or A B) \<Delta>' s"
[PROOF STATE]
proof (state)
this:
x \<in> applies_eq (Or A B) \<Delta>' s

goal (1 subgoal):
 1. \<And>s x. x \<in> applies_eq (Or A B) \<Delta>' s \<Longrightarrow> x \<in> applies_eq (Or A B) \<Delta> s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> applies_eq (Or A B) \<Delta>' s
[PROOF STEP]
show "x \<in> applies_eq (Or A B) \<Delta> s"
[PROOF STATE]
proof (prove)
using this:
x \<in> applies_eq (Or A B) \<Delta>' s

goal (1 subgoal):
 1. x \<in> applies_eq (Or A B) \<Delta> s
[PROOF STEP]
using asm0 assms(1) assms(2) non_increasing_def logic_axioms mem_Collect_eq sat.simps(8) smaller_interp_applies_cons
[PROOF STATE]
proof (prove)
using this:
x \<in> applies_eq (Or A B) \<Delta>' s
smaller_interp \<Delta> \<Delta>'
non_increasing (applies_eq A)
non_increasing (applies_eq B)
non_increasing ?f = (\<forall>\<Delta> \<Delta>'. smaller_interp \<Delta> \<Delta>' \<longrightarrow> smaller_interp (?f \<Delta>') (?f \<Delta>))
logic (\<oplus>) (\<odot>) smult sadd sinv one valid
(?a \<in> Collect ?P) = ?P ?a
(?\<sigma>, ?s, ?\<Delta> \<Turnstile> Exists ?x ?A) = (\<exists>v. ?\<sigma>, ?s(?x := v), ?\<Delta> \<Turnstile> ?A)
\<lbrakk>smaller_interp (applies_eq ?A ?\<Delta>) (applies_eq ?A ?\<Delta>'); ?a, ?s, ?\<Delta> \<Turnstile> ?A\<rbrakk> \<Longrightarrow> ?a, ?s, ?\<Delta>' \<Turnstile> ?A

goal (1 subgoal):
 1. x \<in> applies_eq (Or A B) \<Delta> s
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x \<in> applies_eq (Or A B) \<Delta> s

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
smaller_interp (applies_eq (Or A B) \<Delta>') (applies_eq (Or A B) \<Delta>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_update:
  "\<And>i. i < length xss \<Longrightarrow> map f (xss[i := xs]) = (map f xss) [i := f xs]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < length xss \<Longrightarrow> map f (xss[i := xs]) = (map f xss)[i := f xs]
[PROOF STEP]
apply (induct xss)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < length [] \<Longrightarrow> map f ([][i := xs]) = (map f [])[i := f xs]
 2. \<And>a xss i. \<lbrakk>\<And>i. i < length xss \<Longrightarrow> map f (xss[i := xs]) = (map f xss)[i := f xs]; i < length (a # xss)\<rbrakk> \<Longrightarrow> map f ((a # xss)[i := xs]) = (map f (a # xss))[i := f xs]
[PROOF STEP]
apply  simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xss i. \<lbrakk>\<And>i. i < length xss \<Longrightarrow> map f (xss[i := xs]) = (map f xss)[i := f xs]; i < length (a # xss)\<rbrakk> \<Longrightarrow> map f ((a # xss)[i := xs]) = (map f (a # xss))[i := f xs]
[PROOF STEP]
apply (case_tac i)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xss i. \<lbrakk>\<And>i. i < length xss \<Longrightarrow> map f (xss[i := xs]) = (map f xss)[i := f xs]; i < length (a # xss); i = 0\<rbrakk> \<Longrightarrow> map f ((a # xss)[i := xs]) = (map f (a # xss))[i := f xs]
 2. \<And>a xss i nat. \<lbrakk>\<And>i. i < length xss \<Longrightarrow> map f (xss[i := xs]) = (map f xss)[i := f xs]; i < length (a # xss); i = Suc nat\<rbrakk> \<Longrightarrow> map f ((a # xss)[i := xs]) = (map f (a # xss))[i := f xs]
[PROOF STEP]
apply  simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xss i nat. \<lbrakk>\<And>i. i < length xss \<Longrightarrow> map f (xss[i := xs]) = (map f xss)[i := f xs]; i < length (a # xss); i = Suc nat\<rbrakk> \<Longrightarrow> map f ((a # xss)[i := xs]) = (map f (a # xss))[i := f xs]
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma image_add_atLeast:
  "(\<lambda>n::nat. n+k) ` {i..} = {i+k..}" (is "?A = ?B")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. n + k) ` {i..} = {i + k..}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>n. n + k) ` {i..} \<subseteq> {i + k..}
 2. {i + k..} \<subseteq> (\<lambda>n. n + k) ` {i..}
[PROOF STEP]
show "?A \<subseteq> ?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. n + k) ` {i..} \<subseteq> {i + k..}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<lambda>n. n + k) ` {i..} \<subseteq> {i + k..}

goal (1 subgoal):
 1. {i + k..} \<subseteq> (\<lambda>n. n + k) ` {i..}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {i + k..} \<subseteq> (\<lambda>n. n + k) ` {i..}
[PROOF STEP]
show "?B \<subseteq> ?A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i + k..} \<subseteq> (\<lambda>n. n + k) ` {i..}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {i + k..} \<Longrightarrow> x \<in> (\<lambda>n. n + k) ` {i..}
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {i + k..} \<Longrightarrow> x \<in> (\<lambda>n. n + k) ` {i..}
[PROOF STEP]
assume a: "n : ?B"
[PROOF STATE]
proof (state)
this:
n \<in> {i + k..}

goal (1 subgoal):
 1. \<And>x. x \<in> {i + k..} \<Longrightarrow> x \<in> (\<lambda>n. n + k) ` {i..}
[PROOF STEP]
hence "n - k \<in> {i..}"
[PROOF STATE]
proof (prove)
using this:
n \<in> {i + k..}

goal (1 subgoal):
 1. n - k \<in> {i..}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n - k \<in> {i..}

goal (1 subgoal):
 1. \<And>x. x \<in> {i + k..} \<Longrightarrow> x \<in> (\<lambda>n. n + k) ` {i..}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
n - k \<in> {i..}

goal (1 subgoal):
 1. \<And>x. x \<in> {i + k..} \<Longrightarrow> x \<in> (\<lambda>n. n + k) ` {i..}
[PROOF STEP]
have "n = (n - k) + k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n = n - k + k
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
n \<in> {i + k..}

goal (1 subgoal):
 1. n = n - k + k
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
n = n - k + k

goal (1 subgoal):
 1. \<And>x. x \<in> {i + k..} \<Longrightarrow> x \<in> (\<lambda>n. n + k) ` {i..}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
n - k \<in> {i..}
n = n - k + k
[PROOF STEP]
show "n \<in> ?A"
[PROOF STATE]
proof (prove)
using this:
n - k \<in> {i..}
n = n - k + k

goal (1 subgoal):
 1. n \<in> (\<lambda>n. n + k) ` {i..}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
n \<in> (\<lambda>n. n + k) ` {i..}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{i + k..} \<subseteq> (\<lambda>n. n + k) ` {i..}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma disjoint_family_Suc:
  "(\<And>n. A n \<subseteq> A (Suc n)) \<Longrightarrow> disjoint_family (\<lambda>i. A (Suc i) - A i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. A n \<subseteq> A (Suc n)) \<Longrightarrow> disjoint_family (\<lambda>i. A (Suc i) - A i)
[PROOF STEP]
using lift_Suc_mono_le[of A]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>n. A n \<subseteq> A (Suc n); ?n \<le> ?n'\<rbrakk> \<Longrightarrow> A ?n \<subseteq> A ?n'

goal (1 subgoal):
 1. (\<And>n. A n \<subseteq> A (Suc n)) \<Longrightarrow> disjoint_family (\<lambda>i. A (Suc i) - A i)
[PROOF STEP]
by (auto simp add: disjoint_family_on_def)
     (metis insert_absorb insert_subset le_SucE le_antisym not_le_imp_less less_imp_le)


[STATEMENT]
lemma cdf_diff_eq:
  assumes "x < y"
  shows "cdf M y - cdf M x = measure M {x<..y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cdf M y - cdf M x = Sigma_Algebra.measure M {x<..y}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cdf M y - cdf M x = Sigma_Algebra.measure M {x<..y}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
x < y
[PROOF STEP]
have *: "{..x} \<union> {x<..y} = {..y}"
[PROOF STATE]
proof (prove)
using this:
x < y

goal (1 subgoal):
 1. {..x} \<union> {x<..y} = {..y}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{..x} \<union> {x<..y} = {..y}

goal (1 subgoal):
 1. cdf M y - cdf M x = Sigma_Algebra.measure M {x<..y}
[PROOF STEP]
have "measure M {..y} = measure M {..x} + measure M {x<..y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M {..y} = Sigma_Algebra.measure M {..x} + Sigma_Algebra.measure M {x<..y}
[PROOF STEP]
by (subst finite_measure_Union [symmetric], auto simp add: *)
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M {..y} = Sigma_Algebra.measure M {..x} + Sigma_Algebra.measure M {x<..y}

goal (1 subgoal):
 1. cdf M y - cdf M x = Sigma_Algebra.measure M {x<..y}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Sigma_Algebra.measure M {..y} = Sigma_Algebra.measure M {..x} + Sigma_Algebra.measure M {x<..y}

goal (1 subgoal):
 1. cdf M y - cdf M x = Sigma_Algebra.measure M {x<..y}
[PROOF STEP]
unfolding cdf_def
[PROOF STATE]
proof (prove)
using this:
Sigma_Algebra.measure M {..y} = Sigma_Algebra.measure M {..x} + Sigma_Algebra.measure M {x<..y}

goal (1 subgoal):
 1. Sigma_Algebra.measure M {..y} - Sigma_Algebra.measure M {..x} = Sigma_Algebra.measure M {x<..y}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cdf M y - cdf M x = Sigma_Algebra.measure M {x<..y}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma val_minus:
  assumes "a \<in>  carrier Q\<^sub>p"
  shows "val a = val (\<ominus>a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val a = val (\<ominus> a)
[PROOF STEP]
proof(cases "a = \<zero>")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = \<zero> \<Longrightarrow> val a = val (\<ominus> a)
 2. a \<noteq> \<zero> \<Longrightarrow> val a = val (\<ominus> a)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a = \<zero>

goal (2 subgoals):
 1. a = \<zero> \<Longrightarrow> val a = val (\<ominus> a)
 2. a \<noteq> \<zero> \<Longrightarrow> val a = val (\<ominus> a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = \<zero>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a = \<zero>

goal (1 subgoal):
 1. val a = val (\<ominus> a)
[PROOF STEP]
using Qp.minus_zero
[PROOF STATE]
proof (prove)
using this:
a = \<zero>
\<ominus> \<zero> = \<zero>

goal (1 subgoal):
 1. val a = val (\<ominus> a)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
val a = val (\<ominus> a)

goal (1 subgoal):
 1. a \<noteq> \<zero> \<Longrightarrow> val a = val (\<ominus> a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> \<zero> \<Longrightarrow> val a = val (\<ominus> a)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<noteq> \<zero>

goal (1 subgoal):
 1. a \<noteq> \<zero> \<Longrightarrow> val a = val (\<ominus> a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> \<zero>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<noteq> \<zero>

goal (1 subgoal):
 1. val a = val (\<ominus> a)
[PROOF STEP]
using Qp.domain_axioms assms cring.cring_simprules(21)
        cring.cring_simprules(22) domain.axioms(1) not_nonzero_Qp
        ord_minus val_def
[PROOF STATE]
proof (prove)
using this:
a \<noteq> \<zero>
domain Q\<^sub>p
a \<in> carrier Q\<^sub>p
\<lbrakk>cring ?R; ?x \<in> carrier ?R\<rbrakk> \<Longrightarrow> \<ominus>\<^bsub>?R\<^esub> (\<ominus>\<^bsub>?R\<^esub> ?x) = ?x
cring ?R \<Longrightarrow> \<ominus>\<^bsub>?R\<^esub> \<zero>\<^bsub>?R\<^esub> = \<zero>\<^bsub>?R\<^esub>
domain ?R \<Longrightarrow> cring ?R
\<lbrakk>?x \<in> carrier ?Q\<^sub>p; ?x \<notin> nonzero ?Q\<^sub>p\<rbrakk> \<Longrightarrow> ?x = \<zero>\<^bsub>?Q\<^sub>p\<^esub>
?a \<in> nonzero Q\<^sub>p \<Longrightarrow> ord ?a = ord (\<ominus> ?a)
val ?x = (if ?x = \<zero> then \<infinity> else eint (ord ?x))

goal (1 subgoal):
 1. val a = val (\<ominus> a)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
val a = val (\<ominus> a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nths'_single: "n < length xs \<Longrightarrow> nths' n (Suc n) xs = [xs ! n]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < length xs \<Longrightarrow> nths' n (Suc n) xs = [xs ! n]
[PROOF STEP]
apply (induct xs arbitrary: n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. n < length [] \<Longrightarrow> nths' n (Suc n) [] = [[] ! n]
 2. \<And>a xs n. \<lbrakk>\<And>n. n < length xs \<Longrightarrow> nths' n (Suc n) xs = [xs ! n]; n < length (a # xs)\<rbrakk> \<Longrightarrow> nths' n (Suc n) (a # xs) = [(a # xs) ! n]
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs n. \<lbrakk>\<And>n. n < length xs \<Longrightarrow> nths' n (Suc n) xs = [xs ! n]; n < length (a # xs)\<rbrakk> \<Longrightarrow> nths' n (Suc n) (a # xs) = [(a # xs) ! n]
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs n. \<lbrakk>\<And>n. n < length xs \<Longrightarrow> nths' n (Suc n) xs = [xs ! n]; n < Suc (length xs)\<rbrakk> \<Longrightarrow> 0 < n \<longrightarrow> nths' (n - Suc 0) n xs = [xs ! (n - Suc 0)]
[PROOF STEP]
apply (case_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xs n. \<lbrakk>\<And>n. n < length xs \<Longrightarrow> nths' n (Suc n) xs = [xs ! n]; n < Suc (length xs); n = 0\<rbrakk> \<Longrightarrow> 0 < n \<longrightarrow> nths' (n - Suc 0) n xs = [xs ! (n - Suc 0)]
 2. \<And>xs n nat. \<lbrakk>\<And>n. n < length xs \<Longrightarrow> nths' n (Suc n) xs = [xs ! n]; n < Suc (length xs); n = Suc nat\<rbrakk> \<Longrightarrow> 0 < n \<longrightarrow> nths' (n - Suc 0) n xs = [xs ! (n - Suc 0)]
[PROOF STEP]
apply (simp add: nths_n_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs n nat. \<lbrakk>\<And>n. n < length xs \<Longrightarrow> nths' n (Suc n) xs = [xs ! n]; n < Suc (length xs); n = Suc nat\<rbrakk> \<Longrightarrow> 0 < n \<longrightarrow> nths' (n - Suc 0) n xs = [xs ! (n - Suc 0)]
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma mydiv_cancel: "0 < k \<Longrightarrow> mydiv (k * i) k = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> mydiv (k * i) k = i
[PROOF STEP]
unfolding mydiv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> (if k dvd k * i then k * i div k else k * i div k + 1) = i
[PROOF STEP]
by auto


[STATEMENT]
lemma le_ge_imp_abs_diff_1:
  assumes
  "A1 <= (A::'a::lattice_ring)"
  "A <= A2"
  shows "\<bar>A-A1\<bar> <= A2-A1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>A - A1\<bar> \<le> A2 - A1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>A - A1\<bar> \<le> A2 - A1
[PROOF STEP]
have "0 <= A - A1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> A - A1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (0::'a) \<le> A - A1
[PROOF STEP]
from assms add_right_mono [of A1 A "- A1"]
[PROOF STATE]
proof (chain)
picking this:
A1 \<le> A
A \<le> A2
A1 \<le> A \<Longrightarrow> A1 + - A1 \<le> A + - A1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A1 \<le> A
A \<le> A2
A1 \<le> A \<Longrightarrow> A1 + - A1 \<le> A + - A1

goal (1 subgoal):
 1. (0::'a) \<le> A - A1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> A - A1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> A - A1

goal (1 subgoal):
 1. \<bar>A - A1\<bar> \<le> A2 - A1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(0::'a) \<le> A - A1
[PROOF STEP]
have "\<bar>A-A1\<bar> = A-A1"
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> A - A1

goal (1 subgoal):
 1. \<bar>A - A1\<bar> = A - A1
[PROOF STEP]
by (rule abs_of_nonneg)
[PROOF STATE]
proof (state)
this:
\<bar>A - A1\<bar> = A - A1

goal (1 subgoal):
 1. \<bar>A - A1\<bar> \<le> A2 - A1
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
A1 \<le> A
A \<le> A2
\<bar>A - A1\<bar> = A - A1
[PROOF STEP]
show "\<bar>A-A1\<bar> <= (A2-A1)"
[PROOF STATE]
proof (prove)
using this:
A1 \<le> A
A \<le> A2
\<bar>A - A1\<bar> = A - A1

goal (1 subgoal):
 1. \<bar>A - A1\<bar> \<le> A2 - A1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>A - A1\<bar> \<le> A2 - A1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma analz_insert_Pan [simp]:
     "analz (insert (Pan A) H) = insert (Pan A) (analz H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. analz (insert (Pan A) H) = insert (Pan A) (analz H)
[PROOF STEP]
apply (rule analz_insert_eq_I)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> analz (insert (Pan A) H) \<Longrightarrow> x \<in> insert (Pan A) (analz H)
[PROOF STEP]
apply (erule analz.induct, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma conjugate_square_greater_0 [simp]:
  fixes x :: "'a :: {conjugatable_ordered_ring,ring_no_zero_divisors}"
  shows "x * conjugate x > 0 \<longleftrightarrow> x \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((0::'a) < x * conjugate x) = (x \<noteq> (0::'a))
[PROOF STEP]
using conjugate_square_positive[of x]
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> x * conjugate x

goal (1 subgoal):
 1. ((0::'a) < x * conjugate x) = (x \<noteq> (0::'a))
[PROOF STEP]
by (auto simp: le_less)


[STATEMENT]
lemma distance_lengths_finite: "finite { length xs | xs. v\<leadsto>xs\<leadsto>w }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {length xs |xs. v \<leadsto>xs\<leadsto> w}
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {length xs |xs. v \<leadsto>xs\<leadsto> w}
[PROOF STEP]
have "{ length xs | xs. v\<leadsto>xs\<leadsto>w } \<subseteq> { n | n. n \<le> card V }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {length xs |xs. v \<leadsto>xs\<leadsto> w} \<subseteq> {n |n. n \<le> card V}
[PROOF STEP]
using path_length
[PROOF STATE]
proof (prove)
using this:
path ?xs \<Longrightarrow> length ?xs \<le> card V

goal (1 subgoal):
 1. {length xs |xs. v \<leadsto>xs\<leadsto> w} \<subseteq> {n |n. n \<le> card V}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{length xs |xs. v \<leadsto>xs\<leadsto> w} \<subseteq> {n |n. n \<le> card V}

goal (1 subgoal):
 1. finite {length xs |xs. v \<leadsto>xs\<leadsto> w}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{length xs |xs. v \<leadsto>xs\<leadsto> w} \<subseteq> {n |n. n \<le> card V}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{length xs |xs. v \<leadsto>xs\<leadsto> w} \<subseteq> {n |n. n \<le> card V}

goal (1 subgoal):
 1. finite {length xs |xs. v \<leadsto>xs\<leadsto> w}
[PROOF STEP]
using finite_Collect_le_nat
[PROOF STATE]
proof (prove)
using this:
{length xs |xs. v \<leadsto>xs\<leadsto> w} \<subseteq> {n |n. n \<le> card V}
finite {n. n \<le> ?k}

goal (1 subgoal):
 1. finite {length xs |xs. v \<leadsto>xs\<leadsto> w}
[PROOF STEP]
by (meson finite_subset)
[PROOF STATE]
proof (state)
this:
finite {length xs |xs. v \<leadsto>xs\<leadsto> w}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "fold/build":
  fixes g :: "('a, 'b) listfun"
  shows "foldr\<cdot>k\<cdot>z\<cdot>(build\<cdot>g) = listfun\<cdot>g\<cdot>k\<cdot>z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr\<cdot>k\<cdot>z\<cdot>(build\<cdot>g) = listfun\<cdot>g\<cdot>k\<cdot>z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. foldr\<cdot>k\<cdot>z\<cdot>(build\<cdot>g) = listfun\<cdot>g\<cdot>k\<cdot>z
[PROOF STEP]
from Rep_listfun
[PROOF STATE]
proof (chain)
picking this:
Rep_listfun ?x \<in> {(f, xs). f = (\<Lambda> c n. foldr\<cdot>c\<cdot>n\<cdot>xs)}
[PROOF STEP]
obtain f xs where
    "Rep_listfun g = (f, xs)" and "f = abstract_list xs"
[PROOF STATE]
proof (prove)
using this:
Rep_listfun ?x \<in> {(f, xs). f = (\<Lambda> c n. foldr\<cdot>c\<cdot>n\<cdot>xs)}

goal (1 subgoal):
 1. (\<And>f xs. \<lbrakk>Rep_listfun g = (f, xs); f = (\<Lambda> c n. foldr\<cdot>c\<cdot>n\<cdot>xs)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Rep_listfun g = (f, xs)
f = (\<Lambda> c n. foldr\<cdot>c\<cdot>n\<cdot>xs)

goal (1 subgoal):
 1. foldr\<cdot>k\<cdot>z\<cdot>(build\<cdot>g) = listfun\<cdot>g\<cdot>k\<cdot>z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Rep_listfun g = (f, xs)
f = (\<Lambda> c n. foldr\<cdot>c\<cdot>n\<cdot>xs)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Rep_listfun g = (f, xs)
f = (\<Lambda> c n. foldr\<cdot>c\<cdot>n\<cdot>xs)

goal (1 subgoal):
 1. foldr\<cdot>k\<cdot>z\<cdot>(build\<cdot>g) = listfun\<cdot>g\<cdot>k\<cdot>z
[PROOF STEP]
by (simp add: build_def listfun_def)
[PROOF STATE]
proof (state)
this:
foldr\<cdot>k\<cdot>z\<cdot>(build\<cdot>g) = listfun\<cdot>g\<cdot>k\<cdot>z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem (in finite_RedBlack) feasible_path_inclusion :
  assumes "RedBlack prb"
  shows   "feasible_paths (black prb) (confs prb (root (red prb))) \<subseteq> RedBlack_paths prb"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {as. \<exists>l. path (black prb) as l \<and> feasible (confs prb (root (red prb))) (trace as (labelling (black prb)))} \<subseteq> RedBlack_paths prb
[PROOF STEP]
using feasible_subpaths_preserved[OF assms, of "root (red prb)"] consistent_roots[OF assms]
[PROOF STATE]
proof (prove)
using this:
root (red prb) \<in> red_vertices prb \<Longrightarrow> feasible_subpaths_from (black prb) (confs prb (root (red prb))) (fst (root (red prb))) \<subseteq> RedBlack_paths prb
fst (root (red prb)) = init (black prb)

goal (1 subgoal):
 1. {as. \<exists>l. path (black prb) as l \<and> feasible (confs prb (root (red prb))) (trace as (labelling (black prb)))} \<subseteq> RedBlack_paths prb
[PROOF STEP]
by (simp add : vertices_def)


[STATEMENT]
lemma nodes_empty[simp]: "nodes empty = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nodes Graph.empty = {}
[PROOF STEP]
unfolding empty_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nodes \<lparr>nodes = {}, edges = {}\<rparr> = {}
[PROOF STEP]
by simp


[STATEMENT]
lemma auxiliary_ineq: fixes x::nat assumes "x \<ge> (2::nat)"
  shows " x+1 < (2::nat)*x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + 1 < 2 * x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
2 \<le> x

goal (1 subgoal):
 1. x + 1 < 2 * x
[PROOF STEP]
by linarith


[STATEMENT]
lemma lta_not_conga:
  assumes "A B C LtA D E F"
  shows "\<not> A B C CongA D E F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> A B C CongA D E F
[PROOF STEP]
using assms not_lta_and_conga
[PROOF STATE]
proof (prove)
using this:
A B C LtA D E F
\<not> (?A ?B ?C LtA ?D ?E ?F \<and> ?A ?B ?C CongA ?D ?E ?F)

goal (1 subgoal):
 1. \<not> A B C CongA D E F
[PROOF STEP]
by auto


[STATEMENT]
lemma translation_apply:
  "\<lbrakk> a \<in> G; b \<in> G \<rbrakk> \<Longrightarrow> (a)\<^sub>R b = b \<cdot> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> G; b \<in> G\<rbrakk> \<Longrightarrow> (a)\<^sub>R b = b \<cdot> a
[PROOF STEP]
unfolding translation_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> G; b \<in> G\<rbrakk> \<Longrightarrow> (\<lambda>a\<in>G. \<lambda>x\<in>G. x \<cdot> a) a b = b \<cdot> a
[PROOF STEP]
by auto


[STATEMENT]
lemma ccFromList_Cons[simp]: "ccFromList (x#xs) = ccProd {x} (set xs) \<squnion> ccFromList xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ccFromList (x # xs) = {x} G\<times> set xs \<squnion> ccFromList xs
[PROOF STEP]
by transfer (auto elim: list_pairs.cases intro: list_pairs.intros)


[STATEMENT]
lemma has_derivative_compose:
  "(f has_derivative f') (at x within s) \<Longrightarrow> (g has_derivative g') (at (f x)) \<Longrightarrow>
  ((\<lambda>x. g (f x)) has_derivative (\<lambda>x. g' (f' x))) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_derivative f') (at x within s); (g has_derivative g') (at (f x))\<rbrakk> \<Longrightarrow> ((\<lambda>x. g (f x)) has_derivative (\<lambda>x. g' (f' x))) (at x within s)
[PROOF STEP]
by (blast intro: has_derivative_in_compose has_derivative_subset)


[STATEMENT]
lemma (in Yoneda) sandwich_type:
  assumes A: "A \<in> Ob" and B: "B \<in> Ob"
  and "a \<in> F\<^bsub>\<o>\<^esub> A"
  shows "\<sigma>(A,a) B \<in> hom Set (Hom A B) (F\<^bsub>\<o>\<^esub> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<sigma>(A,a) B \<in> Hom\<^bsub>Set\<^esub> (Hom A B) F \<^bsub>\<o>\<^esub> B
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<sigma>(A,a) B \<in> Hom\<^bsub>Set\<^esub> (Hom A B) F \<^bsub>\<o>\<^esub> B
[PROOF STEP]
have "\<sigma>(A,a) \<in> Ob \<rightarrow> Ar\<^bsub>Set\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<sigma>(A,a) \<in> Ob \<rightarrow> Ar\<^bsub>Set\<^esub>
[PROOF STEP]
using A and \<open>a \<in> F\<^bsub>\<o>\<^esub> A\<close>
[PROOF STATE]
proof (prove)
using this:
A \<in> Ob
a \<in> F \<^bsub>\<o>\<^esub> A

goal (1 subgoal):
 1. \<sigma>(A,a) \<in> Ob \<rightarrow> Ar\<^bsub>Set\<^esub>
[PROOF STEP]
by (rule sandwich_funcset)
[PROOF STATE]
proof (state)
this:
\<sigma>(A,a) \<in> Ob \<rightarrow> Ar\<^bsub>Set\<^esub>

goal (1 subgoal):
 1. \<sigma>(A,a) B \<in> Hom\<^bsub>Set\<^esub> (Hom A B) F \<^bsub>\<o>\<^esub> B
[PROOF STEP]
hence "\<sigma>(A,a) B \<in> ar Set"
[PROOF STATE]
proof (prove)
using this:
\<sigma>(A,a) \<in> Ob \<rightarrow> Ar\<^bsub>Set\<^esub>

goal (1 subgoal):
 1. \<sigma>(A,a) B \<in> Ar\<^bsub>Set\<^esub>
[PROOF STEP]
using B
[PROOF STATE]
proof (prove)
using this:
\<sigma>(A,a) \<in> Ob \<rightarrow> Ar\<^bsub>Set\<^esub>
B \<in> Ob

goal (1 subgoal):
 1. \<sigma>(A,a) B \<in> Ar\<^bsub>Set\<^esub>
[PROOF STEP]
by (rule funcset_mem)
[PROOF STATE]
proof (state)
this:
\<sigma>(A,a) B \<in> Ar\<^bsub>Set\<^esub>

goal (1 subgoal):
 1. \<sigma>(A,a) B \<in> Hom\<^bsub>Set\<^esub> (Hom A B) F \<^bsub>\<o>\<^esub> B
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<sigma>(A,a) B \<in> Ar\<^bsub>Set\<^esub>

goal (1 subgoal):
 1. \<sigma>(A,a) B \<in> Hom\<^bsub>Set\<^esub> (Hom A B) F \<^bsub>\<o>\<^esub> B
[PROOF STEP]
using B
[PROOF STATE]
proof (prove)
using this:
\<sigma>(A,a) B \<in> Ar\<^bsub>Set\<^esub>
B \<in> Ob

goal (1 subgoal):
 1. \<sigma>(A,a) B \<in> Hom\<^bsub>Set\<^esub> (Hom A B) F \<^bsub>\<o>\<^esub> B
[PROOF STEP]
by (simp add: sandwich_def hom_def Set_def)
[PROOF STATE]
proof (state)
this:
\<sigma>(A,a) B \<in> Hom\<^bsub>Set\<^esub> (Hom A B) F \<^bsub>\<o>\<^esub> B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fun_mult_scalar_commute:
  assumes "f 0 = 0" and "\<And>x y. f (x + y) = f x + f y"
    and "\<And>c t. f (monom_mult c t p) = monom_mult c t (f p)"
  shows "f (q \<odot> p) = q \<odot> (f p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (q \<odot> p) = q \<odot> f p
[PROOF STEP]
by (simp add: mult_scalar_sum_monomials assms(3)[symmetric], rule fun_sum_commute, fact+)


[STATEMENT]
lemma points_index_gt0_impl_existance:
  assumes "B index ps > 0"
  shows "(\<exists> bl . (bl \<in># B \<and> ps \<subseteq> bl))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>bl. bl \<in># B \<and> ps \<subseteq> bl
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>bl. bl \<in># B \<and> ps \<subseteq> bl
[PROOF STEP]
have "size {#bl \<in># B . ps \<subseteq> bl#} > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < size (filter_mset ((\<subseteq>) ps) B)
[PROOF STEP]
by (metis assms points_index_def)
[PROOF STATE]
proof (state)
this:
0 < size (filter_mset ((\<subseteq>) ps) B)

goal (1 subgoal):
 1. \<exists>bl. bl \<in># B \<and> ps \<subseteq> bl
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < size (filter_mset ((\<subseteq>) ps) B)
[PROOF STEP]
obtain bl where "bl \<in># B" and "ps \<subseteq> bl"
[PROOF STATE]
proof (prove)
using this:
0 < size (filter_mset ((\<subseteq>) ps) B)

goal (1 subgoal):
 1. (\<And>bl. \<lbrakk>bl \<in># B; ps \<subseteq> bl\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis filter_mset_empty_conv nonempty_has_size)
[PROOF STATE]
proof (state)
this:
bl \<in># B
ps \<subseteq> bl

goal (1 subgoal):
 1. \<exists>bl. bl \<in># B \<and> ps \<subseteq> bl
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
bl \<in># B
ps \<subseteq> bl

goal (1 subgoal):
 1. \<exists>bl. bl \<in># B \<and> ps \<subseteq> bl
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>bl. bl \<in># B \<and> ps \<subseteq> bl

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sync_ok_blocks:
  "\<lbrakk> length vs = length pns; length Ts = length pns\<rbrakk>
  \<Longrightarrow> sync_ok (blocks pns Ts vs body) = sync_ok body"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length vs = length pns; length Ts = length pns\<rbrakk> \<Longrightarrow> sync_ok (blocks pns Ts vs body) = sync_ok body
[PROOF STEP]
by(induct pns Ts vs body rule: blocks.induct) auto


[STATEMENT]
lemma iT_Plus_neg_iWeakSince_conv: "(P t1. t1 \<B> t2 (I \<oplus>- k). Q t2) = (P (t1 - k). t1 \<B> t2 (I \<down>\<ge> k). Q (t2 - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P t1. t1 \<B> t2 I \<oplus>- k. Q t2) = (P (t1 - k). t1 \<B> t2 I \<down>\<ge> k. Q (t2 - k))
[PROOF STEP]
by (simp add: iWeakSince_iSince_conv iT_Plus_neg_iSince_conv iT_Plus_neg_iAll_conv)