[STATEMENT]
lemma upper_triangular_imp_lin_indpt_rows:
  assumes A: "A \<in> carrier_mat n n"
    and tri: "upper_triangular A"
    and diag: "0 \<notin> set (diag_mat A)"
  shows "lin_indpt (set (rows A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lin_indpt (set (rows A))
[PROOF STEP]
using det_not_0_imp_lin_indpt_rows upper_triangular_imp_det_eq_0_iff assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> carrier_mat n n; det ?A \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> lin_indpt (set (rows ?A))
\<lbrakk>?A \<in> carrier_mat ?n ?n; upper_triangular ?A\<rbrakk> \<Longrightarrow> (det ?A = (0::?'a)) = ((0::?'a) \<in> set (diag_mat ?A))
A \<in> carrier_mat n n
upper_triangular A
(0::'a) \<notin> set (diag_mat A)

goal (1 subgoal):
 1. lin_indpt (set (rows A))
[PROOF STEP]
by auto


[STATEMENT]
lemma exp_add: "exp (x + y) = exp x * exp y"
  for x y :: "'a::{real_normed_field,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (x + y) = exp x * exp y
[PROOF STEP]
by (rule exp_add_commuting) (simp add: ac_simps)


[STATEMENT]
lemma hmsetmset_plus: "hmsetmset (M + N) = hmsetmset M + hmsetmset N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hmsetmset (M + N) = hmsetmset M + hmsetmset N
[PROOF STEP]
by (simp add: plus_hmultiset_def)


[STATEMENT]
lemma finprod_Un_disjoint:
  "\<lbrakk>finite A; finite B; A Int B = {};
      g \<in> A \<rightarrow> carrier G; g \<in> B \<rightarrow> carrier G\<rbrakk>
   \<Longrightarrow> finprod G g (A Un B) = finprod G g A \<otimes> finprod G g B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite B; A \<inter> B = {}; g \<in> A \<rightarrow> carrier G; g \<in> B \<rightarrow> carrier G\<rbrakk> \<Longrightarrow> finprod G g (A \<union> B) = finprod G g A \<otimes> finprod G g B
[PROOF STEP]
by (metis Pi_split_domain finprod_Un_Int finprod_closed finprod_empty r_one)


[STATEMENT]
lemma abs_non_negative: " abs x \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> Preliminaries.abs x
[PROOF STEP]
using abs_def diff_0 le_cases neg_0_le_iff_le
[PROOF STATE]
proof (prove)
using this:
Preliminaries.abs ?x \<equiv> if 0 \<le> ?x then ?x else 0 - ?x
(0::?'a) - ?a = - ?a
\<lbrakk>?x \<le> ?y \<Longrightarrow> ?P; ?y \<le> ?x \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P
((0::?'a) \<le> - ?a) = (?a \<le> (0::?'a))

goal (1 subgoal):
 1. 0 \<le> Preliminaries.abs x
[PROOF STEP]
by auto


[STATEMENT]
lemma diagonal_to_Smith_PQ_JNF_dim:
  assumes "A \<in> carrier_mat m n"
    and PSQ: "diagonal_to_Smith_PQ_JNF A bezout = (P,S,Q)"
  shows "P \<in> carrier_mat m m \<and> S \<in> carrier_mat m n \<and> Q \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<in> carrier_mat m m \<and> S \<in> carrier_mat m n \<and> Q \<in> carrier_mat n n
[PROOF STEP]
by (rule diagonal_to_Smith_aux_PQ_JNF_dim, insert assms,
      auto simp add: diagonal_to_Smith_PQ_JNF_def)


[STATEMENT]
lemma gcd_of_int_gauss_int: "gcd (of_int a :: gauss_int) (of_int b) = of_int (gcd a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (of_int a) (of_int b) = of_int (gcd a b)
[PROOF STEP]
proof (induction "nat \<bar>b\<bar>" arbitrary: a b rule: less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b a. (\<And>ba a. nat \<bar>ba\<bar> < nat \<bar>b\<bar> \<Longrightarrow> gcd (of_int a) (of_int ba) = of_int (gcd a ba)) \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
[PROOF STEP]
case (less b a)
[PROOF STATE]
proof (state)
this:
nat \<bar>?b\<bar> < nat \<bar>b\<bar> \<Longrightarrow> gcd (of_int ?a) (of_int ?b) = of_int (gcd ?a ?b)

goal (1 subgoal):
 1. \<And>b a. (\<And>ba a. nat \<bar>ba\<bar> < nat \<bar>b\<bar> \<Longrightarrow> gcd (of_int a) (of_int ba) = of_int (gcd a ba)) \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (of_int a) (of_int b) = of_int (gcd a b)
[PROOF STEP]
proof (cases "b = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. b = 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
 2. b \<noteq> 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
b \<noteq> 0

goal (2 subgoals):
 1. b = 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
 2. b \<noteq> 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
[PROOF STEP]
have "of_int (gcd a b) = (of_int (gcd b (a mod b)) :: gauss_int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (gcd a b) = of_int (gcd b (a mod b))
[PROOF STEP]
by (subst gcd_red_int) auto
[PROOF STATE]
proof (state)
this:
of_int (gcd a b) = of_int (gcd b (a mod b))

goal (2 subgoals):
 1. b = 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
 2. b \<noteq> 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int (gcd a b) = of_int (gcd b (a mod b))

goal (2 subgoals):
 1. b = 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
 2. b \<noteq> 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
[PROOF STEP]
have "\<dots> = gcd (of_int b) (of_int (a mod b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (gcd b (a mod b)) = gcd (of_int b) (of_int (a mod b))
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
b \<noteq> 0

goal (1 subgoal):
 1. of_int (gcd b (a mod b)) = gcd (of_int b) (of_int (a mod b))
[PROOF STEP]
by (intro less [symmetric]) (auto intro!: abs_mod_less)
[PROOF STATE]
proof (state)
this:
of_int (gcd b (a mod b)) = gcd (of_int b) (of_int (a mod b))

goal (2 subgoals):
 1. b = 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
 2. b \<noteq> 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int (gcd b (a mod b)) = gcd (of_int b) (of_int (a mod b))

goal (2 subgoals):
 1. b = 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
 2. b \<noteq> 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
[PROOF STEP]
have "a mod b = (a - a div b * b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a mod b = a - a div b * b
[PROOF STEP]
by (simp add: minus_div_mult_eq_mod)
[PROOF STATE]
proof (state)
this:
a mod b = a - a div b * b

goal (2 subgoals):
 1. b = 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
 2. b \<noteq> 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a mod b = a - a div b * b

goal (2 subgoals):
 1. b = 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
 2. b \<noteq> 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
[PROOF STEP]
have "of_int \<dots> = of_int (-(a div b)) * of_int b + (of_int a :: gauss_int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (a - a div b * b) = of_int (- (a div b)) * of_int b + of_int a
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
of_int (a - a div b * b) = of_int (- (a div b)) * of_int b + of_int a

goal (2 subgoals):
 1. b = 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
 2. b \<noteq> 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int (a - a div b * b) = of_int (- (a div b)) * of_int b + of_int a

goal (2 subgoals):
 1. b = 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
 2. b \<noteq> 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
[PROOF STEP]
have "gcd (of_int b) \<dots> = gcd (of_int b) (of_int a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (of_int b) (of_int (- (a div b)) * of_int b + of_int a) = gcd (of_int b) (of_int a)
[PROOF STEP]
by (rule gcd_add_mult)
[PROOF STATE]
proof (state)
this:
gcd (of_int b) (of_int (- (a div b)) * of_int b + of_int a) = gcd (of_int b) (of_int a)

goal (2 subgoals):
 1. b = 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
 2. b \<noteq> 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
of_int (gcd a b) = gcd (of_int b) (of_int a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
of_int (gcd a b) = gcd (of_int b) (of_int a)

goal (1 subgoal):
 1. gcd (of_int a) (of_int b) = of_int (gcd a b)
[PROOF STEP]
by (simp add: gcd.commute)
[PROOF STATE]
proof (state)
this:
gcd (of_int a) (of_int b) = of_int (gcd a b)

goal (1 subgoal):
 1. b = 0 \<Longrightarrow> gcd (of_int a) (of_int b) = of_int (gcd a b)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
gcd (of_int a) (of_int b) = of_int (gcd a b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma s2r_inter_hom: "s2r (A \<inter> B) = s2r A \<inter> s2r B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s2r (A \<inter> B) = s2r A \<inter> s2r B
[PROOF STEP]
by (auto simp: Id_on_def)


[STATEMENT]
theorem countable_datatype:
  fixes Rep :: "'b \<Rightarrow> ('a::countable) Old_Datatype.item"
  fixes Abs :: "('a::countable) Old_Datatype.item \<Rightarrow> 'b"
  fixes rep_set :: "('a::countable) Old_Datatype.item \<Rightarrow> bool"
  assumes type: "type_definition Rep Abs (Collect rep_set)"
  assumes finite_item: "\<And>x. rep_set x \<Longrightarrow> finite_item x"
  shows "OFCLASS('b, countable_class)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. OFCLASS('b, countable_class)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>to_nat. inj to_nat
[PROOF STEP]
define f where "f y = (LEAST n. nth_item n = Rep y)" for y
[PROOF STATE]
proof (state)
this:
f ?y = (LEAST n. nth_item n = Rep ?y)

goal (1 subgoal):
 1. \<exists>to_nat. inj to_nat
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
f ?y = (LEAST n. nth_item n = Rep ?y)

goal (1 subgoal):
 1. \<exists>to_nat. inj to_nat
[PROOF STEP]
fix y :: 'b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>to_nat. inj to_nat
[PROOF STEP]
have "rep_set (Rep y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rep_set (Rep y)
[PROOF STEP]
using type_definition.Rep [OF type]
[PROOF STATE]
proof (prove)
using this:
Rep ?x \<in> Collect rep_set

goal (1 subgoal):
 1. rep_set (Rep y)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
rep_set (Rep y)

goal (1 subgoal):
 1. \<exists>to_nat. inj to_nat
[PROOF STEP]
hence "finite_item (Rep y)"
[PROOF STATE]
proof (prove)
using this:
rep_set (Rep y)

goal (1 subgoal):
 1. finite_item (Rep y)
[PROOF STEP]
by (rule finite_item)
[PROOF STATE]
proof (state)
this:
finite_item (Rep y)

goal (1 subgoal):
 1. \<exists>to_nat. inj to_nat
[PROOF STEP]
hence "\<exists>n. nth_item n = Rep y"
[PROOF STATE]
proof (prove)
using this:
finite_item (Rep y)

goal (1 subgoal):
 1. \<exists>n. nth_item n = Rep y
[PROOF STEP]
by (rule nth_item_covers)
[PROOF STATE]
proof (state)
this:
\<exists>n. nth_item n = Rep y

goal (1 subgoal):
 1. \<exists>to_nat. inj to_nat
[PROOF STEP]
hence "nth_item (f y) = Rep y"
[PROOF STATE]
proof (prove)
using this:
\<exists>n. nth_item n = Rep y

goal (1 subgoal):
 1. nth_item (f y) = Rep y
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
using this:
\<exists>n. nth_item n = Rep y

goal (1 subgoal):
 1. nth_item (LEAST n. nth_item n = Rep y) = Rep y
[PROOF STEP]
by (rule LeastI_ex)
[PROOF STATE]
proof (state)
this:
nth_item (f y) = Rep y

goal (1 subgoal):
 1. \<exists>to_nat. inj to_nat
[PROOF STEP]
hence "Abs (nth_item (f y)) = y"
[PROOF STATE]
proof (prove)
using this:
nth_item (f y) = Rep y

goal (1 subgoal):
 1. Abs (nth_item (f y)) = y
[PROOF STEP]
using type_definition.Rep_inverse [OF type]
[PROOF STATE]
proof (prove)
using this:
nth_item (f y) = Rep y
Abs (Rep ?x) = ?x

goal (1 subgoal):
 1. Abs (nth_item (f y)) = y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Abs (nth_item (f y)) = y

goal (1 subgoal):
 1. \<exists>to_nat. inj to_nat
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
Abs (nth_item (f ?y2)) = ?y2

goal (1 subgoal):
 1. \<exists>to_nat. inj to_nat
[PROOF STEP]
hence "inj f"
[PROOF STATE]
proof (prove)
using this:
Abs (nth_item (f ?y2)) = ?y2

goal (1 subgoal):
 1. inj f
[PROOF STEP]
by (rule inj_on_inverseI)
[PROOF STATE]
proof (state)
this:
inj f

goal (1 subgoal):
 1. \<exists>to_nat. inj to_nat
[PROOF STEP]
thus "\<exists>f::'b \<Rightarrow> nat. inj f"
[PROOF STATE]
proof (prove)
using this:
inj f

goal (1 subgoal):
 1. \<exists>f. inj f
[PROOF STEP]
by - (rule exI)
[PROOF STATE]
proof (state)
this:
\<exists>f. inj f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma simple_closed_path_abs_winding_number_inside:
  assumes "simple_path \<gamma>" "z \<in> inside(path_image \<gamma>)"
    shows "\<bar>Re (winding_number \<gamma> z)\<bar> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>Re (winding_number \<gamma> z)\<bar> = 1
[PROOF STEP]
by (metis assms norm_minus_cancel norm_one one_complex.simps(1) real_norm_def simple_closed_path_winding_number_inside uminus_complex.simps(1))


[STATEMENT]
lemma card_POS: "card POS = m choose k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card POS = m choose k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card POS = m choose k
[PROOF STEP]
have "m choose k =
    card {B. B \<subseteq> [m] \<and> card B = k}" (is "_ = card ?A")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m choose k = card {B. B \<subseteq> [m] \<and> card B = k}
[PROOF STEP]
by (subst n_subsets[of "[m]" k], auto simp: numbers_def)
[PROOF STATE]
proof (state)
this:
m choose k = card {B. B \<subseteq> [m] \<and> card B = k}

goal (1 subgoal):
 1. card POS = m choose k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
m choose k = card {B. B \<subseteq> [m] \<and> card B = k}

goal (1 subgoal):
 1. card POS = m choose k
[PROOF STEP]
have "\<dots> = card (sameprod ` ?A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {B. B \<subseteq> [m] \<and> card B = k} = card (sameprod ` {B. B \<subseteq> [m] \<and> card B = k})
[PROOF STEP]
proof (rule card_image[symmetric])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inj_on sameprod {B. B \<subseteq> [m] \<and> card B = k}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inj_on sameprod {B. B \<subseteq> [m] \<and> card B = k}
[PROOF STEP]
fix A
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inj_on sameprod {B. B \<subseteq> [m] \<and> card B = k}
[PROOF STEP]
assume "A \<in> ?A"
[PROOF STATE]
proof (state)
this:
A \<in> {B. B \<subseteq> [m] \<and> card B = k}

goal (1 subgoal):
 1. inj_on sameprod {B. B \<subseteq> [m] \<and> card B = k}
[PROOF STEP]
hence "v (sameprod A) = A"
[PROOF STATE]
proof (prove)
using this:
A \<in> {B. B \<subseteq> [m] \<and> card B = k}

goal (1 subgoal):
 1. v A^\<two> = A
[PROOF STEP]
using k2
[PROOF STATE]
proof (prove)
using this:
A \<in> {B. B \<subseteq> [m] \<and> card B = k}
2 < k

goal (1 subgoal):
 1. v A^\<two> = A
[PROOF STEP]
by (subst v_sameprod, auto)
[PROOF STATE]
proof (state)
this:
v A^\<two> = A

goal (1 subgoal):
 1. inj_on sameprod {B. B \<subseteq> [m] \<and> card B = k}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?A2 \<in> {B. B \<subseteq> [m] \<and> card B = k} \<Longrightarrow> v ?A2^\<two> = ?A2

goal (1 subgoal):
 1. inj_on sameprod {B. B \<subseteq> [m] \<and> card B = k}
[PROOF STEP]
thus "inj_on sameprod ?A"
[PROOF STATE]
proof (prove)
using this:
?A2 \<in> {B. B \<subseteq> [m] \<and> card B = k} \<Longrightarrow> v ?A2^\<two> = ?A2

goal (1 subgoal):
 1. inj_on sameprod {B. B \<subseteq> [m] \<and> card B = k}
[PROOF STEP]
by (rule inj_on_inverseI)
[PROOF STATE]
proof (state)
this:
inj_on sameprod {B. B \<subseteq> [m] \<and> card B = k}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card {B. B \<subseteq> [m] \<and> card B = k} = card (sameprod ` {B. B \<subseteq> [m] \<and> card B = k})

goal (1 subgoal):
 1. card POS = m choose k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {B. B \<subseteq> [m] \<and> card B = k} = card (sameprod ` {B. B \<subseteq> [m] \<and> card B = k})

goal (1 subgoal):
 1. card POS = m choose k
[PROOF STEP]
have "sameprod ` {B. B \<subseteq> [m] \<and> card B = k} = POS"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sameprod ` {B. B \<subseteq> [m] \<and> card B = k} = POS
[PROOF STEP]
unfolding \<K>_altdef
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sameprod ` {B. B \<subseteq> [m] \<and> card B = k} = {V^\<two> |V. V \<subseteq> [m] \<and> card V = k}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sameprod ` {B. B \<subseteq> [m] \<and> card B = k} = POS

goal (1 subgoal):
 1. card POS = m choose k
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
m choose k = card POS
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m choose k = card POS

goal (1 subgoal):
 1. card POS = m choose k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card POS = m choose k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bij_betw_from_nat_into_finite: "finite S \<Longrightarrow> bij_betw (from_nat_into S) {..< card S} S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite S \<Longrightarrow> bij_betw (from_nat_into S) {..<card S} S
[PROOF STEP]
unfolding from_nat_into_def[abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite S \<Longrightarrow> bij_betw (\<lambda>n. if n \<in> to_nat_on S ` S then inv_into S (to_nat_on S) n else SOME s. s \<in> S) {..<card S} S
[PROOF STEP]
using to_nat_on_finite[of S]
[PROOF STATE]
proof (prove)
using this:
finite S \<Longrightarrow> bij_betw (to_nat_on S) S {..<card S}

goal (1 subgoal):
 1. finite S \<Longrightarrow> bij_betw (\<lambda>n. if n \<in> to_nat_on S ` S then inv_into S (to_nat_on S) n else SOME s. s \<in> S) {..<card S} S
[PROOF STEP]
apply (subst bij_betw_cong)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a. \<lbrakk>finite S; finite S \<Longrightarrow> bij_betw (to_nat_on S) S {..<card S}; a \<in> {..<card S}\<rbrakk> \<Longrightarrow> (if a \<in> to_nat_on S ` S then inv_into S (to_nat_on S) a else SOME s. s \<in> S) = ?g1 a
 2. \<lbrakk>finite S; finite S \<Longrightarrow> bij_betw (to_nat_on S) S {..<card S}\<rbrakk> \<Longrightarrow> bij_betw ?g1 {..<card S} S
[PROOF STEP]
apply (split if_split)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a. \<lbrakk>finite S; finite S \<Longrightarrow> bij_betw (to_nat_on S) S {..<card S}; a \<in> {..<card S}\<rbrakk> \<Longrightarrow> (a \<in> to_nat_on S ` S \<longrightarrow> inv_into S (to_nat_on S) a = ?g1 a) \<and> (a \<notin> to_nat_on S ` S \<longrightarrow> (SOME s. s \<in> S) = ?g1 a)
 2. \<lbrakk>finite S; finite S \<Longrightarrow> bij_betw (to_nat_on S) S {..<card S}\<rbrakk> \<Longrightarrow> bij_betw ?g1 {..<card S} S
[PROOF STEP]
apply (simp add: bij_betw_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite S; finite S \<Longrightarrow> bij_betw (to_nat_on S) S {..<card S}\<rbrakk> \<Longrightarrow> bij_betw (inv_into S (to_nat_on S)) {..<card S} S
[PROOF STEP]
apply (auto cong: bij_betw_cong
              intro: bij_betw_inv_into to_nat_on_finite)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma det_col_sum: "det (upd_col M i (\<Sum>s\<in>S. a s)) = (\<Sum>s\<in>S. det (upd_col M i (a s)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Square_Matrix.det (upd_col M i (sum a S)) = (\<Sum>s\<in>S. Square_Matrix.det (upd_col M i (a s)))
[PROOF STEP]
by (induction S rule: infinite_finite_induct) (simp_all add: det_col_0 det_col_add)


[STATEMENT]
lemma is_swap_values:
  assumes "is_swap"
  shows "f 0 = 1" and "f 1 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f 0 = 1 &&& f 1 = 0
[PROOF STEP]
using assms is_swap_def
[PROOF STATE]
proof (prove)
using this:
is_swap
is_swap = (\<forall>x\<in>{0, 1}. f x = 1 - x)

goal (1 subgoal):
 1. f 0 = 1 &&& f 1 = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma unit_ball_vol_pos [simp]: "n \<ge> 0 \<Longrightarrow> unit_ball_vol n > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> n \<Longrightarrow> 0 < unit_ball_vol n
[PROOF STEP]
by (force simp: unit_ball_vol_def intro: divide_nonneg_pos)


[STATEMENT]
lemma mat_block_size_MM_Rel:
  assumes "MM_Rel A B"
  assumes " j < dim_col A"
  shows "mat_block_size (mat_mod A) j = mat_block_size B j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_block_size (local.mat_mod A) j = mat_block_size B j
[PROOF STEP]
unfolding mat_block_size_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_vec (col (local.mat_mod A) j) 1 = count_vec (col B j) 1
[PROOF STEP]
using vec_count_MV_Rel_direct assms MM_Rel_MV_Rel_col
[PROOF STATE]
proof (prove)
using this:
MV_Rel ?v1.0 ?v2.0 \<Longrightarrow> count_vec ?v2.0 ?i = count_vec (vec_mod ?v1.0) (to_int_mod_ring ?i)
MM_Rel A B
j < dim_col A
\<lbrakk>MM_Rel ?A ?B; ?j < dim_col ?A\<rbrakk> \<Longrightarrow> MV_Rel (col ?A ?j) (col ?B ?j)

goal (1 subgoal):
 1. count_vec (col (local.mat_mod A) j) 1 = count_vec (col B j) 1
[PROOF STEP]
by (metis mat_mod_vec_mod_col to_int_mod_ring_hom.hom_one)


[STATEMENT]
lemma (in abelian_group) add_additive_subgroups:
  assumes subH: "additive_subgroup H G"
    and subK: "additive_subgroup K G"
  shows "additive_subgroup (H <+> K) G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. additive_subgroup (H <+> K) G
[PROOF STEP]
unfolding set_add_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. additive_subgroup (H <#>\<^bsub>add_monoid G\<^esub> K) G
[PROOF STEP]
using add.mult_subgroups additive_subgroup_def subH subK
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>subgroup ?H (add_monoid G); subgroup ?K (add_monoid G)\<rbrakk> \<Longrightarrow> subgroup (?H <#>\<^bsub>add_monoid G\<^esub> ?K) (add_monoid G)
additive_subgroup ?H ?G \<equiv> subgroup ?H (add_monoid ?G)
additive_subgroup H G
additive_subgroup K G

goal (1 subgoal):
 1. additive_subgroup (H <#>\<^bsub>add_monoid G\<^esub> K) G
[PROOF STEP]
by (blast intro: additive_subgroup.intro)


[STATEMENT]
lemma subcocycle_avg_ereal_cmult:
  assumes "subcocycle u" "c \<ge> (0::real)"
  shows "subcocycle_avg_ereal (\<lambda>n x. c * u n x) = c * subcocycle_avg_ereal u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
[PROOF STEP]
proof (cases "c = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. c = 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
 2. c \<noteq> 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
c = 0

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
 2. c \<noteq> 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
[PROOF STEP]
have *: "ereal (\<integral>x. (c * u n x) / n \<partial>M) = 0" if "n>0" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal (LINT x|M. c * u n x / real n) = 0
[PROOF STEP]
by (subst True, auto)
[PROOF STATE]
proof (state)
this:
0 < ?n3 \<Longrightarrow> ereal (LINT x|M. c * u ?n3 x / real ?n3) = 0

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
 2. c \<noteq> 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
[PROOF STEP]
have "(\<lambda>n. ereal (\<integral>x. (c * u n x) / n \<partial>M)) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. ereal (LINT x|M. c * u n x / real n)) \<longlonglongrightarrow> 0
[PROOF STEP]
by (subst lim_explicit, metis * less_le_trans zero_less_one)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ereal (LINT x|M. c * u n x / real n)) \<longlonglongrightarrow> 0

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
 2. c \<noteq> 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ereal (LINT x|M. c * u n x / real n)) \<longlonglongrightarrow> 0

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
 2. c \<noteq> 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
[PROOF STEP]
have "(\<lambda>n. ereal (\<integral>x. (c * u n x) / n \<partial>M)) \<longlonglongrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. ereal (LINT x|M. c * u n x / real n)) \<longlonglongrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x)
[PROOF STEP]
using subcocycle_int_tendsto_avg_ereal[OF subcocycle_cmult[OF assms]]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. ereal (LINT xa|M. c * u x xa / real x)) \<longlonglongrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x)

goal (1 subgoal):
 1. (\<lambda>n. ereal (LINT x|M. c * u n x / real n)) \<longlonglongrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ereal (LINT x|M. c * u n x / real n)) \<longlonglongrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x)

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
 2. c \<noteq> 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. ereal (LINT x|M. c * u n x / real n)) \<longlonglongrightarrow> 0
(\<lambda>n. ereal (LINT x|M. c * u n x / real n)) \<longlonglongrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x)
[PROOF STEP]
have "subcocycle_avg_ereal (\<lambda>n x. c * u n x) = 0"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ereal (LINT x|M. c * u n x / real n)) \<longlonglongrightarrow> 0
(\<lambda>n. ereal (LINT x|M. c * u n x / real n)) \<longlonglongrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x)

goal (1 subgoal):
 1. subcocycle_avg_ereal (\<lambda>n x. c * u n x) = 0
[PROOF STEP]
using LIMSEQ_unique
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ereal (LINT x|M. c * u n x / real n)) \<longlonglongrightarrow> 0
(\<lambda>n. ereal (LINT x|M. c * u n x / real n)) \<longlonglongrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x)
\<lbrakk>?X \<longlonglongrightarrow> ?a; ?X \<longlonglongrightarrow> ?b\<rbrakk> \<Longrightarrow> ?a = ?b

goal (1 subgoal):
 1. subcocycle_avg_ereal (\<lambda>n x. c * u n x) = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
subcocycle_avg_ereal (\<lambda>n x. c * u n x) = 0

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
 2. c \<noteq> 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
subcocycle_avg_ereal (\<lambda>n x. c * u n x) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
subcocycle_avg_ereal (\<lambda>n x. c * u n x) = 0

goal (1 subgoal):
 1. subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
subcocycle_avg_ereal (\<lambda>n x. c * u n x) = 0
c = 0

goal (1 subgoal):
 1. subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u

goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
c \<noteq> 0

goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
[PROOF STEP]
have int: "\<And>n. integrable M (u n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. integrable M (u n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
subcocycle u
0 \<le> c

goal (1 subgoal):
 1. \<And>n. integrable M (u n)
[PROOF STEP]
unfolding subcocycle_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>n. integrable M (u n)) \<and> (\<forall>n m x. u (n + m) x \<le> u n x + u m ((T ^^ n) x))
0 \<le> c

goal (1 subgoal):
 1. \<And>n. integrable M (u n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integrable M (u ?n3)

goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
[PROOF STEP]
have "ereal (\<integral>x. c * u n x / n \<partial>M) = c * ereal (\<integral>x. u n x / n \<partial>M)" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal (LINT x|M. c * u n x / real n) = ereal c * ereal (LINT x|M. u n x / real n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ereal (LINT x|M. c * u ?n3 x / real ?n3) = ereal c * ereal (LINT x|M. u ?n3 x / real ?n3)

goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ereal (LINT x|M. c * u ?n3 x / real ?n3) = ereal c * ereal (LINT x|M. u ?n3 x / real ?n3)
[PROOF STEP]
have "(\<lambda>n. c * ereal (\<integral>x. u n x / n \<partial>M)) \<longlonglongrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x)"
[PROOF STATE]
proof (prove)
using this:
ereal (LINT x|M. c * u ?n3 x / real ?n3) = ereal c * ereal (LINT x|M. u ?n3 x / real ?n3)

goal (1 subgoal):
 1. (\<lambda>n. ereal c * ereal (LINT x|M. u n x / real n)) \<longlonglongrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x)
[PROOF STEP]
using subcocycle_int_tendsto_avg_ereal[OF subcocycle_cmult[OF assms]]
[PROOF STATE]
proof (prove)
using this:
ereal (LINT x|M. c * u ?n3 x / real ?n3) = ereal c * ereal (LINT x|M. u ?n3 x / real ?n3)
(\<lambda>x. ereal (LINT xa|M. c * u x xa / real x)) \<longlonglongrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x)

goal (1 subgoal):
 1. (\<lambda>n. ereal c * ereal (LINT x|M. u n x / real n)) \<longlonglongrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ereal c * ereal (LINT x|M. u n x / real n)) \<longlonglongrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x)

goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ereal c * ereal (LINT x|M. u n x / real n)) \<longlonglongrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x)

goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
[PROOF STEP]
have "(\<lambda>n. c * ereal (\<integral>x. u n x / n \<partial>M)) \<longlonglongrightarrow> c * subcocycle_avg_ereal u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. ereal c * ereal (LINT x|M. u n x / real n)) \<longlonglongrightarrow> ereal c * subcocycle_avg_ereal u
[PROOF STEP]
apply (rule tendsto_mult_ereal)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (\<lambda>x. ereal c) \<longlonglongrightarrow> ereal c
 2. (\<lambda>x. ereal (LINT xa|M. u x xa / real x)) \<longlonglongrightarrow> subcocycle_avg_ereal u
 3. \<not> (ereal c = 0 \<and> \<bar>subcocycle_avg_ereal u\<bar> = \<infinity> \<or> subcocycle_avg_ereal u = 0 \<and> \<bar>ereal c\<bar> = \<infinity>)
[PROOF STEP]
using False subcocycle_int_tendsto_avg_ereal[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
c \<noteq> 0
(\<lambda>x. ereal (LINT xa|M. u x xa / real x)) \<longlonglongrightarrow> subcocycle_avg_ereal u

goal (3 subgoals):
 1. (\<lambda>x. ereal c) \<longlonglongrightarrow> ereal c
 2. (\<lambda>x. ereal (LINT xa|M. u x xa / real x)) \<longlonglongrightarrow> subcocycle_avg_ereal u
 3. \<not> (ereal c = 0 \<and> \<bar>subcocycle_avg_ereal u\<bar> = \<infinity> \<or> subcocycle_avg_ereal u = 0 \<and> \<bar>ereal c\<bar> = \<infinity>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ereal c * ereal (LINT x|M. u n x / real n)) \<longlonglongrightarrow> ereal c * subcocycle_avg_ereal u

goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. ereal c * ereal (LINT x|M. u n x / real n)) \<longlonglongrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x)
(\<lambda>n. ereal c * ereal (LINT x|M. u n x / real n)) \<longlonglongrightarrow> ereal c * subcocycle_avg_ereal u
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ereal c * ereal (LINT x|M. u n x / real n)) \<longlonglongrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x)
(\<lambda>n. ereal c * ereal (LINT x|M. u n x / real n)) \<longlonglongrightarrow> ereal c * subcocycle_avg_ereal u

goal (1 subgoal):
 1. subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
[PROOF STEP]
using LIMSEQ_unique
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ereal c * ereal (LINT x|M. u n x / real n)) \<longlonglongrightarrow> subcocycle_avg_ereal (\<lambda>n x. c * u n x)
(\<lambda>n. ereal c * ereal (LINT x|M. u n x / real n)) \<longlonglongrightarrow> ereal c * subcocycle_avg_ereal u
\<lbrakk>?X \<longlonglongrightarrow> ?a; ?X \<longlonglongrightarrow> ?b\<rbrakk> \<Longrightarrow> ?a = ?b

goal (1 subgoal):
 1. subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
subcocycle_avg_ereal (\<lambda>n x. c * u n x) = ereal c * subcocycle_avg_ereal u

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bij_betw_msubset_of:
  assumes "finite A"
  shows "bij_betw (msubset_of A) ((A \<rightarrow>\<^sub>E B) // domain_permutation A B) {M. set_mset M \<subseteq> B \<and> size M = card A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (msubset_of A) ((A \<rightarrow>\<^sub>E B) // domain_permutation A B) {M. set_mset M \<subseteq> B \<and> size M = card A}
[PROOF STEP]
proof (rule bij_betw_byWitness[where f'="\<lambda>M. functions_of A M"])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<forall>a\<in>(A \<rightarrow>\<^sub>E B) // domain_permutation A B. functions_of A (msubset_of A a) = a
 2. \<forall>a'\<in>{M. set_mset M \<subseteq> B \<and> size M = card A}. msubset_of A (functions_of A a') = a'
 3. msubset_of A ` (A \<rightarrow>\<^sub>E B) // domain_permutation A B \<subseteq> {M. set_mset M \<subseteq> B \<and> size M = card A}
 4. functions_of A ` {M. set_mset M \<subseteq> B \<and> size M = card A} \<subseteq> (A \<rightarrow>\<^sub>E B) // domain_permutation A B
[PROOF STEP]
show "\<forall>F\<in>(A \<rightarrow>\<^sub>E B) // domain_permutation A B. functions_of A (msubset_of A F) = F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>F\<in>(A \<rightarrow>\<^sub>E B) // domain_permutation A B. functions_of A (msubset_of A F) = F
[PROOF STEP]
using \<open>finite A\<close>
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. \<forall>F\<in>(A \<rightarrow>\<^sub>E B) // domain_permutation A B. functions_of A (msubset_of A F) = F
[PROOF STEP]
by (auto simp add: functions_of_msubset_of)
[PROOF STATE]
proof (state)
this:
\<forall>F\<in>(A \<rightarrow>\<^sub>E B) // domain_permutation A B. functions_of A (msubset_of A F) = F

goal (3 subgoals):
 1. \<forall>a'\<in>{M. set_mset M \<subseteq> B \<and> size M = card A}. msubset_of A (functions_of A a') = a'
 2. msubset_of A ` (A \<rightarrow>\<^sub>E B) // domain_permutation A B \<subseteq> {M. set_mset M \<subseteq> B \<and> size M = card A}
 3. functions_of A ` {M. set_mset M \<subseteq> B \<and> size M = card A} \<subseteq> (A \<rightarrow>\<^sub>E B) // domain_permutation A B
[PROOF STEP]
show "\<forall>M\<in>{M. set_mset M \<subseteq> B \<and> size M = card A}. msubset_of A (functions_of A M) = M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>M\<in>{M. set_mset M \<subseteq> B \<and> size M = card A}. msubset_of A (functions_of A M) = M
[PROOF STEP]
using \<open>finite A\<close>
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. \<forall>M\<in>{M. set_mset M \<subseteq> B \<and> size M = card A}. msubset_of A (functions_of A M) = M
[PROOF STEP]
by (auto simp add: msubset_of_functions_of)
[PROOF STATE]
proof (state)
this:
\<forall>M\<in>{M. set_mset M \<subseteq> B \<and> size M = card A}. msubset_of A (functions_of A M) = M

goal (2 subgoals):
 1. msubset_of A ` (A \<rightarrow>\<^sub>E B) // domain_permutation A B \<subseteq> {M. set_mset M \<subseteq> B \<and> size M = card A}
 2. functions_of A ` {M. set_mset M \<subseteq> B \<and> size M = card A} \<subseteq> (A \<rightarrow>\<^sub>E B) // domain_permutation A B
[PROOF STEP]
show "msubset_of A ` ((A \<rightarrow>\<^sub>E B) // domain_permutation A B) \<subseteq> {M. set_mset M \<subseteq> B \<and> size M = card A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. msubset_of A ` (A \<rightarrow>\<^sub>E B) // domain_permutation A B \<subseteq> {M. set_mset M \<subseteq> B \<and> size M = card A}
[PROOF STEP]
using msubset_of
[PROOF STATE]
proof (prove)
using this:
?F \<in> (?A \<rightarrow>\<^sub>E ?B) // domain_permutation ?A ?B \<Longrightarrow> size (msubset_of ?A ?F) = card ?A
?F \<in> (?A \<rightarrow>\<^sub>E ?B) // domain_permutation ?A ?B \<Longrightarrow> set_mset (msubset_of ?A ?F) \<subseteq> ?B

goal (1 subgoal):
 1. msubset_of A ` (A \<rightarrow>\<^sub>E B) // domain_permutation A B \<subseteq> {M. set_mset M \<subseteq> B \<and> size M = card A}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
msubset_of A ` (A \<rightarrow>\<^sub>E B) // domain_permutation A B \<subseteq> {M. set_mset M \<subseteq> B \<and> size M = card A}

goal (1 subgoal):
 1. functions_of A ` {M. set_mset M \<subseteq> B \<and> size M = card A} \<subseteq> (A \<rightarrow>\<^sub>E B) // domain_permutation A B
[PROOF STEP]
show "functions_of A ` {M. set_mset M \<subseteq> B \<and> size M = card A} \<subseteq> (A \<rightarrow>\<^sub>E B) // domain_permutation A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. functions_of A ` {M. set_mset M \<subseteq> B \<and> size M = card A} \<subseteq> (A \<rightarrow>\<^sub>E B) // domain_permutation A B
[PROOF STEP]
using functions_of \<open>finite A\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?A; set_mset ?M \<subseteq> ?B; size ?M = card ?A\<rbrakk> \<Longrightarrow> functions_of ?A ?M \<in> (?A \<rightarrow>\<^sub>E ?B) // domain_permutation ?A ?B
finite A

goal (1 subgoal):
 1. functions_of A ` {M. set_mset M \<subseteq> B \<and> size M = card A} \<subseteq> (A \<rightarrow>\<^sub>E B) // domain_permutation A B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
functions_of A ` {M. set_mset M \<subseteq> B \<and> size M = card A} \<subseteq> (A \<rightarrow>\<^sub>E B) // domain_permutation A B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma local_flow_sq_mtx_linear: "local_flow ((*\<^sub>V) A) UNIV UNIV (\<lambda>t s. exp (t *\<^sub>R A) *\<^sub>V s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local_flow ((*\<^sub>V) A) UNIV UNIV (\<lambda>t. (*\<^sub>V) (exp (t *\<^sub>R A)))
[PROOF STEP]
unfolding local_flow_def local_flow_axioms_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. picard_lindeloef (\<lambda>t. (*\<^sub>V) A) UNIV UNIV 0 \<and> (\<forall>t s. t \<in> UNIV \<longrightarrow> s \<in> UNIV \<longrightarrow>  D (\<lambda>t. exp (t *\<^sub>R A) *\<^sub>V s) = (\<lambda>t. A *\<^sub>V (exp (t *\<^sub>R A) *\<^sub>V s)) on {0--t}) \<and> (\<forall>s. s \<in> UNIV \<longrightarrow> exp (0 *\<^sub>R A) *\<^sub>V s = s) \<and> (\<forall>t s. t \<in> UNIV \<longrightarrow> s \<in> UNIV \<longrightarrow> (\<lambda>t. exp (t *\<^sub>R A) *\<^sub>V s) \<in> {0--t} \<rightarrow> UNIV)
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. picard_lindeloef (\<lambda>t. (*\<^sub>V) A) UNIV UNIV 0
 2. \<And>t s. \<lbrakk>t \<in> UNIV; s \<in> UNIV\<rbrakk> \<Longrightarrow>  D (\<lambda>t. exp (t *\<^sub>R A) *\<^sub>V s) = (\<lambda>t. A *\<^sub>V (exp (t *\<^sub>R A) *\<^sub>V s)) on {0--t}
 3. \<And>s. s \<in> UNIV \<Longrightarrow> exp (0 *\<^sub>R A) *\<^sub>V s = s
 4. \<And>t s x. \<lbrakk>t \<in> UNIV; s \<in> UNIV; x \<in> {0--t}\<rbrakk> \<Longrightarrow> exp (x *\<^sub>R A) *\<^sub>V s \<in> UNIV
[PROOF STEP]
using picard_lindeloef_sq_mtx_affine[of _ "\<lambda>t. A" "\<lambda>t. 0"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>continuous_on ?T (\<lambda>t. A); continuous_on ?T (\<lambda>t. 0); ?t\<^sub>0 \<in> ?T; is_interval ?T; open ?T; open ?S\<rbrakk> \<Longrightarrow> picard_lindeloef (\<lambda>t s. A *\<^sub>V s + 0) ?T ?S ?t\<^sub>0

goal (4 subgoals):
 1. picard_lindeloef (\<lambda>t. (*\<^sub>V) A) UNIV UNIV 0
 2. \<And>t s. \<lbrakk>t \<in> UNIV; s \<in> UNIV\<rbrakk> \<Longrightarrow>  D (\<lambda>t. exp (t *\<^sub>R A) *\<^sub>V s) = (\<lambda>t. A *\<^sub>V (exp (t *\<^sub>R A) *\<^sub>V s)) on {0--t}
 3. \<And>s. s \<in> UNIV \<Longrightarrow> exp (0 *\<^sub>R A) *\<^sub>V s = s
 4. \<And>t s x. \<lbrakk>t \<in> UNIV; s \<in> UNIV; x \<in> {0--t}\<rbrakk> \<Longrightarrow> exp (x *\<^sub>R A) *\<^sub>V s \<in> UNIV
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>t s. \<lbrakk>t \<in> UNIV; s \<in> UNIV\<rbrakk> \<Longrightarrow>  D (\<lambda>t. exp (t *\<^sub>R A) *\<^sub>V s) = (\<lambda>t. A *\<^sub>V (exp (t *\<^sub>R A) *\<^sub>V s)) on {0--t}
 2. \<And>s. s \<in> UNIV \<Longrightarrow> exp (0 *\<^sub>R A) *\<^sub>V s = s
 3. \<And>t s x. \<lbrakk>t \<in> UNIV; s \<in> UNIV; x \<in> {0--t}\<rbrakk> \<Longrightarrow> exp (x *\<^sub>R A) *\<^sub>V s \<in> UNIV
[PROOF STEP]
using has_vderiv_on_sq_mtx_linear[of 0]
[PROOF STATE]
proof (prove)
using this:
 D (\<lambda>t. exp ((t - 0) *\<^sub>R ?A) *\<^sub>V ?s) = (\<lambda>t. ?A *\<^sub>V (exp ((t - 0) *\<^sub>R ?A) *\<^sub>V ?s)) on {0--?t}

goal (3 subgoals):
 1. \<And>t s. \<lbrakk>t \<in> UNIV; s \<in> UNIV\<rbrakk> \<Longrightarrow>  D (\<lambda>t. exp (t *\<^sub>R A) *\<^sub>V s) = (\<lambda>t. A *\<^sub>V (exp (t *\<^sub>R A) *\<^sub>V s)) on {0--t}
 2. \<And>s. s \<in> UNIV \<Longrightarrow> exp (0 *\<^sub>R A) *\<^sub>V s = s
 3. \<And>t s x. \<lbrakk>t \<in> UNIV; s \<in> UNIV; x \<in> {0--t}\<rbrakk> \<Longrightarrow> exp (x *\<^sub>R A) *\<^sub>V s \<in> UNIV
[PROOF STEP]
by auto


[STATEMENT]
lemma elem_le_zlcms: "\<forall>i \<in> set is. i \<noteq> 0 \<Longrightarrow> i \<in> set is \<Longrightarrow> i \<le> zlcms is"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>i\<in>set is. i \<noteq> 0; i \<in> set is\<rbrakk> \<Longrightarrow> i \<le> zlcms is
[PROOF STEP]
by (metis dvd_zlcms zdvd_imp_le zlcms_pos)


[STATEMENT]
lemma antichain_obtain_foundation:
  assumes   "t \<in>\<^sub>A M"
  obtains s where "s \<in>\<^sub>A M \<and> s \<le> t \<and> (\<forall>u. u\<in>\<^sub>AM \<longrightarrow> \<not> u < s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>s. s \<in>\<^sub>A M \<and> s \<le> t \<and> (\<forall>u. u \<in>\<^sub>A M \<longrightarrow> \<not> u < s) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
t \<in>\<^sub>A M

goal (1 subgoal):
 1. (\<And>s. s \<in>\<^sub>A M \<and> s \<le> t \<and> (\<forall>u. u \<in>\<^sub>A M \<longrightarrow> \<not> u < s) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding member_antichain.rep_eq
[PROOF STATE]
proof (prove)
using this:
t \<in> set_antichain M

goal (1 subgoal):
 1. (\<And>s. s \<in> set_antichain M \<and> s \<le> t \<and> (\<forall>u. u \<in> set_antichain M \<longrightarrow> \<not> u < s) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by - (rule order_finite_set_obtain_foundation[of "set_antichain M" t]; auto)


[STATEMENT]
lemma minus_gt: "(a::'a) < b \<longleftrightarrow> 0 < b - a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a < b) = ((0::'a) < b - a)
[PROOF STEP]
using plus_less[of a b "-a"]
[PROOF STATE]
proof (prove)
using this:
a < b \<Longrightarrow> a + - a < b + - a

goal (1 subgoal):
 1. (a < b) = ((0::'a) < b - a)
[PROOF STEP]
using plus_less[of 0 "b-a" a]
[PROOF STATE]
proof (prove)
using this:
a < b \<Longrightarrow> a + - a < b + - a
(0::'a) < b - a \<Longrightarrow> (0::'a) + a < b - a + a

goal (1 subgoal):
 1. (a < b) = ((0::'a) < b - a)
[PROOF STEP]
by (auto simp add: add_assoc)


[STATEMENT]
lemma powr_closureI [simp]: "(\<lambda>x. f x powr p) \<in> powr_closure f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f x powr p) \<in> powr_closure f
[PROOF STEP]
unfolding powr_closure_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f x powr p) \<in> {\<lambda>x. f x powr p |p. True}
[PROOF STEP]
by force


[STATEMENT]
lemma facet_of_halfspace_ge:
    "F facet_of {x. a \<bullet> x \<ge> b} \<longleftrightarrow> a \<noteq> 0 \<and> F = {x. a \<bullet> x = b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F facet_of {x. b \<le> a \<bullet> x}) = (a \<noteq> (0::'a) \<and> F = {x. a \<bullet> x = b})
[PROOF STEP]
using facet_of_halfspace_le [of F "-a" "-b"]
[PROOF STATE]
proof (prove)
using this:
(F facet_of {x. - a \<bullet> x \<le> - b}) = (- a \<noteq> (0::'a) \<and> F = {x. - a \<bullet> x = - b})

goal (1 subgoal):
 1. (F facet_of {x. b \<le> a \<bullet> x}) = (a \<noteq> (0::'a) \<and> F = {x. a \<bullet> x = b})
[PROOF STEP]
by simp


[STATEMENT]
lemma power_poly_sum_mod_ring:
fixes f :: "'b \<Rightarrow> 'a mod_ring poly"
assumes f: "finite A"
shows "(sum f A) ^ CARD('a) = sum (\<lambda>i. (f i) ^ CARD('a)) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f A ^ CARD('a) = (\<Sum>i\<in>A. f i ^ CARD('a))
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. sum f A ^ CARD('a) = (\<Sum>i\<in>A. f i ^ CARD('a))
[PROOF STEP]
by (induct, auto simp add: add_power_poly_mod_ring)


[STATEMENT]
lemma rel_mset_Plus_gen:
  assumes "rel_mset A m m'"
  assumes "rel_mset A n n'"
  shows "rel_mset A (m+n) (m'+n')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_mset A (m + n) (m' + n')
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
rel_mset A m m'
rel_mset A n n'

goal (1 subgoal):
 1. rel_mset A (m + n) (m' + n')
[PROOF STEP]
by induction (auto simp: algebra_simps dest: rel_mset_Plus)


[STATEMENT]
lemma S'_LIMSEQ_Digamma:
  assumes x: "x \<noteq> 0"
  shows   "(\<lambda>n. ln (real n) - S' n x - 1/(2*x)) \<longlonglongrightarrow> Digamma x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> Digamma x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> Digamma x
[PROOF STEP]
define c where "c = (\<lambda>n. ln (real n) - (\<Sum>r<n. inverse (x + real r)))"
[PROOF STATE]
proof (state)
this:
c = (\<lambda>n. ln (real n) - (\<Sum>r<n. inverse (x + real r)))

goal (1 subgoal):
 1. (\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> Digamma x
[PROOF STEP]
have "eventually (\<lambda>n. 1 / (2 * (x + real n)) = c n - (ln (real n) - S' n x - 1/(2*x))) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. 1 / (2 * (x + real n)) = c n - (ln (real n) - S' n x - 1 / (2 * x))
[PROOF STEP]
using eventually_gt_at_top[of "0::nat"]
[PROOF STATE]
proof (prove)
using this:
eventually ((<) 0) sequentially

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. 1 / (2 * (x + real n)) = c n - (ln (real n) - S' n x - 1 / (2 * x))
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> 1 / (2 * (x + real n)) = c n - (ln (real n) - S' n x - 1 / (2 * x))
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> 1 / (2 * (x + real n)) = c n - (ln (real n) - S' n x - 1 / (2 * x))
[PROOF STEP]
assume n: "n > 0"
[PROOF STATE]
proof (state)
this:
0 < n

goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> 1 / (2 * (x + real n)) = c n - (ln (real n) - S' n x - 1 / (2 * x))
[PROOF STEP]
have "c n - (ln (real n) - S' n x - 1/(2*x)) =
            -(\<Sum>r<n. inverse (real r + x)) + (1/x + (\<Sum>r=1..<n. inverse (real r + x))) + 1/(2*(real n + x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c n - (ln (real n) - S' n x - 1 / (2 * x)) = - (\<Sum>r<n. inverse (real r + x)) + (1 / x + (\<Sum>r = 1..<n. inverse (real r + x))) + 1 / (2 * (real n + x))
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
x \<noteq> 0

goal (1 subgoal):
 1. c n - (ln (real n) - S' n x - 1 / (2 * x)) = - (\<Sum>r<n. inverse (real r + x)) + (1 / x + (\<Sum>r = 1..<n. inverse (real r + x))) + 1 / (2 * (real n + x))
[PROOF STEP]
by (simp add: S'_def c_def field_simps)
[PROOF STATE]
proof (state)
this:
c n - (ln (real n) - S' n x - 1 / (2 * x)) = - (\<Sum>r<n. inverse (real r + x)) + (1 / x + (\<Sum>r = 1..<n. inverse (real r + x))) + 1 / (2 * (real n + x))

goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> 1 / (2 * (x + real n)) = c n - (ln (real n) - S' n x - 1 / (2 * x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
c n - (ln (real n) - S' n x - 1 / (2 * x)) = - (\<Sum>r<n. inverse (real r + x)) + (1 / x + (\<Sum>r = 1..<n. inverse (real r + x))) + 1 / (2 * (real n + x))

goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> 1 / (2 * (x + real n)) = c n - (ln (real n) - S' n x - 1 / (2 * x))
[PROOF STEP]
have "1/x + (\<Sum>r=1..<n. inverse (real r + x)) = (\<Sum>r<n. inverse (real r + x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / x + (\<Sum>r = 1..<n. inverse (real r + x)) = (\<Sum>r<n. inverse (real r + x))
[PROOF STEP]
unfolding lessThan_atLeast0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / x + (\<Sum>r = 1..<n. inverse (real r + x)) = (\<Sum>r = 0..<n. inverse (real r + x))
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. 1 / x + (\<Sum>r = 1..<n. inverse (real r + x)) = (\<Sum>r = 0..<n. inverse (real r + x))
[PROOF STEP]
by (subst (2) sum.atLeast_Suc_lessThan) (simp_all add: field_simps)
[PROOF STATE]
proof (state)
this:
1 / x + (\<Sum>r = 1..<n. inverse (real r + x)) = (\<Sum>r<n. inverse (real r + x))

goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> 1 / (2 * (x + real n)) = c n - (ln (real n) - S' n x - 1 / (2 * x))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
c n - (ln (real n) - S' n x - 1 / (2 * x)) = - (\<Sum>r<n. inverse (real r + x)) + (\<Sum>r<n. inverse (real r + x)) + 1 / (2 * (real n + x))
[PROOF STEP]
show "1 / (2 * (x + real n)) = c n - (ln (real n) - S' n x - 1/(2*x))"
[PROOF STATE]
proof (prove)
using this:
c n - (ln (real n) - S' n x - 1 / (2 * x)) = - (\<Sum>r<n. inverse (real r + x)) + (\<Sum>r<n. inverse (real r + x)) + 1 / (2 * (real n + x))

goal (1 subgoal):
 1. 1 / (2 * (x + real n)) = c n - (ln (real n) - S' n x - 1 / (2 * x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 / (2 * (x + real n)) = c n - (ln (real n) - S' n x - 1 / (2 * x))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. 1 / (2 * (x + real n)) = c n - (ln (real n) - S' n x - 1 / (2 * x))

goal (1 subgoal):
 1. (\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> Digamma x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. 1 / (2 * (x + real n)) = c n - (ln (real n) - S' n x - 1 / (2 * x))

goal (1 subgoal):
 1. (\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> Digamma x
[PROOF STEP]
have "(\<lambda>n. 1 / (2 * (x + real n))) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 1 / (2 * (x + real n))) \<longlonglongrightarrow> 0
[PROOF STEP]
by (rule real_tendsto_divide_at_top tendsto_const filterlim_tendsto_pos_mult_at_top
          filterlim_tendsto_add_at_top filterlim_real_sequentially | simp)+
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 1 / (2 * (x + real n))) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> Digamma x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in sequentially. 1 / (2 * (x + real n)) = c n - (ln (real n) - S' n x - 1 / (2 * x))
(\<lambda>n. 1 / (2 * (x + real n))) \<longlonglongrightarrow> 0
[PROOF STEP]
have "(\<lambda>n. c n - (ln (real n) - S' n x - 1/(2*x))) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. 1 / (2 * (x + real n)) = c n - (ln (real n) - S' n x - 1 / (2 * x))
(\<lambda>n. 1 / (2 * (x + real n))) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. c n - (ln (real n) - S' n x - 1 / (2 * x))) \<longlonglongrightarrow> 0
[PROOF STEP]
by (blast intro: Lim_transform_eventually)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. c n - (ln (real n) - S' n x - 1 / (2 * x))) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> Digamma x
[PROOF STEP]
from tendsto_minus[OF this]
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>xa. - (c xa - (ln (real xa) - S' xa x - 1 / (2 * x)))) \<longlonglongrightarrow> - 0
[PROOF STEP]
have "(\<lambda>n. (ln (real n) - S' n x - 1/(2*x)) - c n) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>xa. - (c xa - (ln (real xa) - S' xa x - 1 / (2 * x)))) \<longlonglongrightarrow> - 0

goal (1 subgoal):
 1. (\<lambda>n. ln (real n) - S' n x - 1 / (2 * x) - c n) \<longlonglongrightarrow> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ln (real n) - S' n x - 1 / (2 * x) - c n) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> Digamma x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ln (real n) - S' n x - 1 / (2 * x) - c n) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> Digamma x
[PROOF STEP]
from Digamma_LIMSEQ[OF x]
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>m. of_real (ln (real m)) - (\<Sum>n<m. inverse (x + real n))) \<longlonglongrightarrow> Digamma x
[PROOF STEP]
have "c \<longlonglongrightarrow> Digamma x"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>m. of_real (ln (real m)) - (\<Sum>n<m. inverse (x + real n))) \<longlonglongrightarrow> Digamma x

goal (1 subgoal):
 1. c \<longlonglongrightarrow> Digamma x
[PROOF STEP]
by (simp add: c_def)
[PROOF STATE]
proof (state)
this:
c \<longlonglongrightarrow> Digamma x

goal (1 subgoal):
 1. (\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> Digamma x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. ln (real n) - S' n x - 1 / (2 * x) - c n) \<longlonglongrightarrow> 0
c \<longlonglongrightarrow> Digamma x
[PROOF STEP]
show "(\<lambda>n. ln (real n) - S' n x - 1/(2*x)) \<longlonglongrightarrow> Digamma x"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ln (real n) - S' n x - 1 / (2 * x) - c n) \<longlonglongrightarrow> 0
c \<longlonglongrightarrow> Digamma x

goal (1 subgoal):
 1. (\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> Digamma x
[PROOF STEP]
by (rule Lim_transform [rotated])
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ln (real n) - S' n x - 1 / (2 * x)) \<longlonglongrightarrow> Digamma x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inorder_balL:
  "inorder (balL l a r) = inorder l @ a # inorder r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Tree2.inorder (balL l a r) = Tree2.inorder l @ a # Tree2.inorder r
[PROOF STEP]
by (auto simp: node_def balL_def split:tree.splits)


[STATEMENT]
lemma card1_incident_imp_vert: "incident v e \<and> card e = 1 \<Longrightarrow> e = {v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. incident v e \<and> card e = 1 \<Longrightarrow> e = {v}
[PROOF STEP]
by (metis card_1_singletonE incident_def singleton_iff)


[STATEMENT]
lemma reflect_poly_prod: "reflect_poly (prod f A) = prod (\<lambda>x. reflect_poly (f x)) A"
  for f :: "_ \<Rightarrow> _::{comm_semiring_0,semiring_no_zero_divisors} poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reflect_poly (prod f A) = (\<Prod>x\<in>A. reflect_poly (f x))
[PROOF STEP]
by (induct A rule: infinite_finite_induct) (simp_all add: reflect_poly_mult)


[STATEMENT]
lemma LEAST_eq_floor:
  "(LEAST n. int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = floor((2::real) powr ((real(h)-1)/c))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (LEAST n. int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = \<lfloor>2 powr ((real h - 1) / c)\<rfloor>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. int (LEAST n. int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = \<lfloor>2 powr ((real h - 1) / c)\<rfloor>
[PROOF STEP]
have "int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>
      \<longleftrightarrow> 2 powr ((real(h)-1)/c) < real(n)+1" (is "?L = ?R") for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = (2 powr ((real h - 1) / c) < real n + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = (2 powr ((real h - 1) / c) < real n + 1)
[PROOF STEP]
have "?L \<longleftrightarrow> h < c * log 2 (real n + 1) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = (real h < c * log 2 (real n + 1) + 1)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
(int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = (real h < c * log 2 (real n + 1) + 1)

goal (1 subgoal):
 1. (int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = (2 powr ((real h - 1) / c) < real n + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = (real h < c * log 2 (real n + 1) + 1)

goal (1 subgoal):
 1. (int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = (2 powr ((real h - 1) / c) < real n + 1)
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (real h-1)/c < log 2 (real n + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real h < c * log 2 (real n + 1) + 1) = ((real h - 1) / c < log 2 (real n + 1))
[PROOF STEP]
using c1
[PROOF STATE]
proof (prove)
using this:
1 < c

goal (1 subgoal):
 1. (real h < c * log 2 (real n + 1) + 1) = ((real h - 1) / c < log 2 (real n + 1))
[PROOF STEP]
by(simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(real h < c * log 2 (real n + 1) + 1) = ((real h - 1) / c < log 2 (real n + 1))

goal (1 subgoal):
 1. (int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = (2 powr ((real h - 1) / c) < real n + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(real h < c * log 2 (real n + 1) + 1) = ((real h - 1) / c < log 2 (real n + 1))

goal (1 subgoal):
 1. (int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = (2 powr ((real h - 1) / c) < real n + 1)
[PROOF STEP]
have "\<dots> \<longleftrightarrow> 2 powr ((real h-1)/c) < 2 powr (log 2 (real n + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((real h - 1) / c < log 2 (real n + 1)) = (2 powr ((real h - 1) / c) < 2 powr log 2 (real n + 1))
[PROOF STEP]
by(simp del: powr_log_cancel)
[PROOF STATE]
proof (state)
this:
((real h - 1) / c < log 2 (real n + 1)) = (2 powr ((real h - 1) / c) < 2 powr log 2 (real n + 1))

goal (1 subgoal):
 1. (int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = (2 powr ((real h - 1) / c) < real n + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((real h - 1) / c < log 2 (real n + 1)) = (2 powr ((real h - 1) / c) < 2 powr log 2 (real n + 1))

goal (1 subgoal):
 1. (int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = (2 powr ((real h - 1) / c) < real n + 1)
[PROOF STEP]
have "\<dots> \<longleftrightarrow> ?R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 powr ((real h - 1) / c) < 2 powr log 2 (real n + 1)) = (2 powr ((real h - 1) / c) < real n + 1)
[PROOF STEP]
by(simp)
[PROOF STATE]
proof (state)
this:
(2 powr ((real h - 1) / c) < 2 powr log 2 (real n + 1)) = (2 powr ((real h - 1) / c) < real n + 1)

goal (1 subgoal):
 1. (int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = (2 powr ((real h - 1) / c) < real n + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = (2 powr ((real h - 1) / c) < real n + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = (2 powr ((real h - 1) / c) < real n + 1)

goal (1 subgoal):
 1. (int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = (2 powr ((real h - 1) / c) < real n + 1)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = (2 powr ((real h - 1) / c) < real n + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(int h \<le> \<lceil>c * log 2 (real ?n + 1)\<rceil>) = (2 powr ((real h - 1) / c) < real ?n + 1)

goal (1 subgoal):
 1. int (LEAST n. int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = \<lfloor>2 powr ((real h - 1) / c)\<rfloor>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(int h \<le> \<lceil>c * log 2 (real ?n + 1)\<rceil>) = (2 powr ((real h - 1) / c) < real ?n + 1)

goal (1 subgoal):
 1. int (LEAST n. int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = \<lfloor>2 powr ((real h - 1) / c)\<rfloor>
[PROOF STEP]
have "((LEAST n::nat. r < n+1) = nat(floor r))" for r :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST x. r < real x + 1) = nat \<lfloor>r\<rfloor>
[PROOF STEP]
by(rule Least_equality) linarith+
[PROOF STATE]
proof (state)
this:
(LEAST x. ?r < real x + 1) = nat \<lfloor>?r\<rfloor>

goal (1 subgoal):
 1. int (LEAST n. int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = \<lfloor>2 powr ((real h - 1) / c)\<rfloor>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(int h \<le> \<lceil>c * log 2 (real ?n + 1)\<rceil>) = (2 powr ((real h - 1) / c) < real ?n + 1)
(LEAST x. ?r < real x + 1) = nat \<lfloor>?r\<rfloor>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(int h \<le> \<lceil>c * log 2 (real ?n + 1)\<rceil>) = (2 powr ((real h - 1) / c) < real ?n + 1)
(LEAST x. ?r < real x + 1) = nat \<lfloor>?r\<rfloor>

goal (1 subgoal):
 1. int (LEAST n. int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = \<lfloor>2 powr ((real h - 1) / c)\<rfloor>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int (LEAST n. int h \<le> \<lceil>c * log 2 (real n + 1)\<rceil>) = \<lfloor>2 powr ((real h - 1) / c)\<rfloor>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "filter_bool_list bs xs = map snd (filter fst (zip bs xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter_bool_list bs xs = map snd (filter fst (zip bs xs))
[PROOF STEP]
by(induct bs xs rule: filter_bool_list.induct) auto


[STATEMENT]
lemma mssnth_mssalternate: "mssnth (mssalternate a b) n = (if even n then a else b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mssnth (mssalternate a b) n = (if even n then a else b)
[PROOF STEP]
by (induction n arbitrary: a b; subst mssalternate.code) simp_all


[STATEMENT]
lemma inj_trancl_image: assumes inj: "inj f"
  shows "(f i, f j) \<in> (map_prod f f ` R)\<^sup>+ = ((i,j) \<in> R\<^sup>+)" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((f i, f j) \<in> (map_prod f f ` R)\<^sup>+) = ((i, j) \<in> R\<^sup>+)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (f i, f j) \<in> (map_prod f f ` R)\<^sup>+ \<Longrightarrow> (i, j) \<in> R\<^sup>+
 2. (i, j) \<in> R\<^sup>+ \<Longrightarrow> (f i, f j) \<in> (map_prod f f ` R)\<^sup>+
[PROOF STEP]
assume ?r
[PROOF STATE]
proof (state)
this:
(i, j) \<in> R\<^sup>+

goal (2 subgoals):
 1. (f i, f j) \<in> (map_prod f f ` R)\<^sup>+ \<Longrightarrow> (i, j) \<in> R\<^sup>+
 2. (i, j) \<in> R\<^sup>+ \<Longrightarrow> (f i, f j) \<in> (map_prod f f ` R)\<^sup>+
[PROOF STEP]
from trancl_image[OF this]
[PROOF STATE]
proof (chain)
picking this:
(?f i, ?f j) \<in> (map_prod ?f ?f ` R)\<^sup>+
[PROOF STEP]
show ?l
[PROOF STATE]
proof (prove)
using this:
(?f i, ?f j) \<in> (map_prod ?f ?f ` R)\<^sup>+

goal (1 subgoal):
 1. (f i, f j) \<in> (map_prod f f ` R)\<^sup>+
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(f i, f j) \<in> (map_prod f f ` R)\<^sup>+

goal (1 subgoal):
 1. (f i, f j) \<in> (map_prod f f ` R)\<^sup>+ \<Longrightarrow> (i, j) \<in> R\<^sup>+
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f i, f j) \<in> (map_prod f f ` R)\<^sup>+ \<Longrightarrow> (i, j) \<in> R\<^sup>+
[PROOF STEP]
assume ?l
[PROOF STATE]
proof (state)
this:
(f i, f j) \<in> (map_prod f f ` R)\<^sup>+

goal (1 subgoal):
 1. (f i, f j) \<in> (map_prod f f ` R)\<^sup>+ \<Longrightarrow> (i, j) \<in> R\<^sup>+
[PROOF STEP]
from trancl_image[OF this, of "the_inv f"]
[PROOF STATE]
proof (chain)
picking this:
(the_inv f (f i), the_inv f (f j)) \<in> (map_prod (the_inv f) (the_inv f) ` map_prod f f ` R)\<^sup>+
[PROOF STEP]
show ?r
[PROOF STATE]
proof (prove)
using this:
(the_inv f (f i), the_inv f (f j)) \<in> (map_prod (the_inv f) (the_inv f) ` map_prod f f ` R)\<^sup>+

goal (1 subgoal):
 1. (i, j) \<in> R\<^sup>+
[PROOF STEP]
unfolding image_image prod.map_comp o_def the_inv_f_f[OF inj]
[PROOF STATE]
proof (prove)
using this:
(i, j) \<in> (map_prod (\<lambda>x. x) (\<lambda>x. x) ` R)\<^sup>+

goal (1 subgoal):
 1. (i, j) \<in> R\<^sup>+
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(i, j) \<in> R\<^sup>+

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma image_mset_subset_mono: "M \<subset># N \<Longrightarrow> image_mset f M \<subset># image_mset f N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M \<subset># N \<Longrightarrow> image_mset f M \<subset># image_mset f N
[PROOF STEP]
by (metis (no_types) Diff_eq_empty_iff_mset image_mset_Diff image_mset_is_empty_iff
    image_mset_subseteq_mono subset_mset.less_le_not_le)


[STATEMENT]
lemma direct_decomp_unique:
  "direct_decomp A ss \<Longrightarrow> qs \<in> listset ss \<Longrightarrow> qs' \<in> listset ss \<Longrightarrow> sum_list qs = sum_list qs' \<Longrightarrow>
    qs = qs'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>direct_decomp A ss; qs \<in> listset ss; qs' \<in> listset ss; sum_list qs = sum_list qs'\<rbrakk> \<Longrightarrow> qs = qs'
[PROOF STEP]
by (auto dest: direct_decompD simp: inj_on_def)


[STATEMENT]
lemma integrable_on_cong [cong]:
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x = g x" "A = B"
  shows   "f integrable_on A \<longleftrightarrow> g integrable_on B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f integrable_on A) = (g integrable_on B)
[PROOF STEP]
using has_integral_cong[of A f g, OF assms(1)] assms(2)
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> A \<Longrightarrow> x \<in> A) \<Longrightarrow> (f has_integral ?i) A = (g has_integral ?i) A
A = B

goal (1 subgoal):
 1. (f integrable_on A) = (g integrable_on B)
[PROOF STEP]
by (auto simp: integrable_on_def)


[STATEMENT]
lemma finsum_permutations_inverse:
  assumes f: "f \<in> {p. p permutes S} \<rightarrow> carrier R"
  shows "finsum R f {p. p permutes S} = finsum R (\<lambda>p. f(Hilbert_Choice.inv p)) {p. p permutes S}"
  (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum R f {p. p permutes S} = (\<Oplus>p\<in>{p. p permutes S}. f (inv p))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finsum R f {p. p permutes S} = (\<Oplus>p\<in>{p. p permutes S}. f (inv p))
[PROOF STEP]
let ?inv = "Hilbert_Choice.inv"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finsum R f {p. p permutes S} = (\<Oplus>p\<in>{p. p permutes S}. f (inv p))
[PROOF STEP]
let ?S = "{p . p permutes S}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finsum R f {p. p permutes S} = (\<Oplus>p\<in>{p. p permutes S}. f (inv p))
[PROOF STEP]
have th0: "inj_on ?inv ?S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on inv {p. p permutes S}
[PROOF STEP]
proof (auto simp add: inj_on_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x permutes S; y permutes S; inv x = inv y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix q r
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x permutes S; y permutes S; inv x = inv y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume q: "q permutes S"
      and r: "r permutes S"
      and qr: "?inv q = ?inv r"
[PROOF STATE]
proof (state)
this:
q permutes S
r permutes S
inv q = inv r

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x permutes S; y permutes S; inv x = inv y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q permutes S
r permutes S
inv q = inv r
[PROOF STEP]
have "?inv (?inv q) = ?inv (?inv r)"
[PROOF STATE]
proof (prove)
using this:
q permutes S
r permutes S
inv q = inv r

goal (1 subgoal):
 1. inv (inv q) = inv (inv r)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inv (inv q) = inv (inv r)

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x permutes S; y permutes S; inv x = inv y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
with permutes_inv_inv[OF q] permutes_inv_inv[OF r]
[PROOF STATE]
proof (chain)
picking this:
inv (inv q) = q
inv (inv r) = r
inv (inv q) = inv (inv r)
[PROOF STEP]
show "q = r"
[PROOF STATE]
proof (prove)
using this:
inv (inv q) = q
inv (inv r) = r
inv (inv q) = inv (inv r)

goal (1 subgoal):
 1. q = r
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
q = r

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inj_on inv {p. p permutes S}

goal (1 subgoal):
 1. finsum R f {p. p permutes S} = (\<Oplus>p\<in>{p. p permutes S}. f (inv p))
[PROOF STEP]
have th1: "?inv ` ?S = ?S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv ` {p. p permutes S} = {p. p permutes S}
[PROOF STEP]
using image_inverse_permutations
[PROOF STATE]
proof (prove)
using this:
{inv p |p. p permutes ?S} = {p. p permutes ?S}

goal (1 subgoal):
 1. inv ` {p. p permutes S} = {p. p permutes S}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
inv ` {p. p permutes S} = {p. p permutes S}

goal (1 subgoal):
 1. finsum R f {p. p permutes S} = (\<Oplus>p\<in>{p. p permutes S}. f (inv p))
[PROOF STEP]
have th2: "?rhs = finsum R (f \<circ> ?inv) ?S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>p\<in>{p. p permutes S}. f (inv p)) = finsum R (f \<circ> inv) {p. p permutes S}
[PROOF STEP]
by (simp add: o_def)
[PROOF STATE]
proof (state)
this:
(\<Oplus>p\<in>{p. p permutes S}. f (inv p)) = finsum R (f \<circ> inv) {p. p permutes S}

goal (1 subgoal):
 1. finsum R f {p. p permutes S} = (\<Oplus>p\<in>{p. p permutes S}. f (inv p))
[PROOF STEP]
from finsum_reindex[OF _ th0, of f]
[PROOF STATE]
proof (chain)
picking this:
f \<in> inv ` {p. p permutes S} \<rightarrow> carrier R \<Longrightarrow> finsum R f (inv ` {p. p permutes S}) = (\<Oplus>x\<in>{p. p permutes S}. f (inv x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f \<in> inv ` {p. p permutes S} \<rightarrow> carrier R \<Longrightarrow> finsum R f (inv ` {p. p permutes S}) = (\<Oplus>x\<in>{p. p permutes S}. f (inv x))

goal (1 subgoal):
 1. finsum R f {p. p permutes S} = (\<Oplus>p\<in>{p. p permutes S}. f (inv p))
[PROOF STEP]
unfolding th1 th2
[PROOF STATE]
proof (prove)
using this:
f \<in> {p. p permutes S} \<rightarrow> carrier R \<Longrightarrow> finsum R f {p. p permutes S} = finsum R (f \<circ> inv) {x. x permutes S}

goal (1 subgoal):
 1. finsum R f {p. p permutes S} = finsum R (f \<circ> inv) {p. p permutes S}
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
f \<in> {p. p permutes S} \<rightarrow> carrier R \<Longrightarrow> finsum R f {p. p permutes S} = finsum R (f \<circ> inv) {x. x permutes S}
f \<in> {p. p permutes S} \<rightarrow> carrier R

goal (1 subgoal):
 1. finsum R f {p. p permutes S} = finsum R (f \<circ> inv) {p. p permutes S}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
finsum R f {p. p permutes S} = (\<Oplus>p\<in>{p. p permutes S}. f (inv p))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma borel_eq_sigmaI2:
  fixes F :: "'i \<Rightarrow> 'j \<Rightarrow> 'a::topological_space set"
    and G :: "'l \<Rightarrow> 'k \<Rightarrow> 'a::topological_space set"
  assumes borel_eq: "borel = sigma UNIV ((\<lambda>(i, j). G i j)`B)"
  assumes X: "\<And>i j. (i, j) \<in> B \<Longrightarrow> G i j \<in> sets (sigma UNIV ((\<lambda>(i, j). F i j) ` A))"
  assumes F: "\<And>i j. (i, j) \<in> A \<Longrightarrow> F i j \<in> sets borel"
  shows "borel = sigma UNIV ((\<lambda>(i, j). F i j) ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. borel = sigma UNIV ((\<lambda>(i, j). F i j) ` A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
borel = sigma UNIV ((\<lambda>(i, j). G i j) ` B)
(?i, ?j) \<in> B \<Longrightarrow> G ?i ?j \<in> sets (sigma UNIV ((\<lambda>(i, j). F i j) ` A))
(?i, ?j) \<in> A \<Longrightarrow> F ?i ?j \<in> sets borel

goal (1 subgoal):
 1. borel = sigma UNIV ((\<lambda>(i, j). F i j) ` A)
[PROOF STEP]
by (intro borel_eq_sigmaI1[where X="(\<lambda>(i, j). G i j) ` B" and F="(\<lambda>(i, j). F i j)"]) auto


[STATEMENT]
lemma minus_one_word:
  "(-1 :: 'a :: len word) = 2 ^ LENGTH('a) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 1 = 2 ^ LENGTH('a) - 1
[PROOF STEP]
by simp


[STATEMENT]
lemma Cauchy_theorem_starlike:
 "\<lbrakk>open S; starlike S; finite k; continuous_on S f;
   \<And>x. x \<in> S - k \<Longrightarrow> f field_differentiable at x;
   valid_path g; path_image g \<subseteq> S; pathfinish g = pathstart g\<rbrakk>
   \<Longrightarrow> (f has_contour_integral 0)  g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>open S; starlike S; finite k; continuous_on S f; \<And>x. x \<in> S - k \<Longrightarrow> f field_differentiable at x; valid_path g; path_image g \<subseteq> S; pathfinish g = pathstart g\<rbrakk> \<Longrightarrow> (f has_contour_integral 0) g
[PROOF STEP]
by (metis holomorphic_starlike_primitive Cauchy_theorem_primitive at_within_open)


[STATEMENT]
theorem mono_imp_qfp_well_complete:
  assumes comp: "well_complete A (\<sqsubseteq>)"
    and f: "f ` A \<subseteq> A" and mono: "monotone_on A (\<sqsubseteq>) (\<sqsubseteq>) f"
  shows "well_complete {p \<in> A. f p \<sim> p} (\<sqsubseteq>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. well_complete {p \<in> A. f p \<sim> p} (\<sqsubseteq>)
[PROOF STEP]
apply (intro fixed_point_proof.attract_mono_imp_qfp_complete mono comp)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. fixed_point_proof A f
 2. attractive A (\<sqsubseteq>)
 3. \<forall>C\<subseteq>A. well_related_set C (\<sqsubseteq>) \<longrightarrow> C \<in> {X. well_related_set X (\<sqsubseteq>)}
 4. \<forall>X\<in>{X. well_related_set X (\<sqsubseteq>)}. \<forall>Y\<in>{X. well_related_set X (\<sqsubseteq>)}. setwise (\<sqsubseteq>) X Y \<longrightarrow> X \<union> Y \<in> {X. well_related_set X (\<sqsubseteq>)}
[PROOF STEP]
apply unfold_locales
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. f ` A \<subseteq> A
 2. \<forall>C\<subseteq>A. well_related_set C (\<sqsubseteq>) \<longrightarrow> C \<in> {X. well_related_set X (\<sqsubseteq>)}
 3. \<forall>X\<in>{X. well_related_set X (\<sqsubseteq>)}. \<forall>Y\<in>{X. well_related_set X (\<sqsubseteq>)}. setwise (\<sqsubseteq>) X Y \<longrightarrow> X \<union> Y \<in> {X. well_related_set X (\<sqsubseteq>)}
[PROOF STEP]
by (auto simp: f well_related_extend)


[STATEMENT]
lemma s1_s2_P1:  assumes "x < q" "xa < q" "xb < q" "xc < q" "y < q"
  shows "((x, xa, xb, (y + q - xc) mod q), (x * ((y + q - xc) mod q) + q - xb) mod q, ((x + xa) mod q * xc + q - (xa * xc + q - xb) mod q) mod q) =
         ((x, xa, xb, (y + q - xc) mod q), (x * ((y + q - xc) mod q) + q - xb) mod q, (x * y + q - (x * ((y + q - xc) mod q) + q - xb) mod q) mod q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((x, xa, xb, (y + q - xc) mod q), (x * ((y + q - xc) mod q) + q - xb) mod q, ((x + xa) mod q * xc + q - (xa * xc + q - xb) mod q) mod q) = ((x, xa, xb, (y + q - xc) mod q), (x * ((y + q - xc) mod q) + q - xb) mod q, (x * y + q - (x * ((y + q - xc) mod q) + q - xb) mod q) mod q)
[PROOF STEP]
using assms s1_s2
[PROOF STATE]
proof (prove)
using this:
x < q
xa < q
xb < q
xc < q
y < q
\<lbrakk>?x < q; ?a < q; ?b < q; ?r < q; ?y < q\<rbrakk> \<Longrightarrow> ((?x + ?a) mod q * ?b + q - (?a * ?b + q - ?r) mod q) mod q = (?x * ?y + q - (?x * ((?y + q - ?b) mod q) + q - ?r) mod q) mod q

goal (1 subgoal):
 1. ((x, xa, xb, (y + q - xc) mod q), (x * ((y + q - xc) mod q) + q - xb) mod q, ((x + xa) mod q * xc + q - (xa * xc + q - xb) mod q) mod q) = ((x, xa, xb, (y + q - xc) mod q), (x * ((y + q - xc) mod q) + q - xb) mod q, (x * y + q - (x * ((y + q - xc) mod q) + q - xb) mod q) mod q)
[PROOF STEP]
by metis


[STATEMENT]
lemma integral_measure_spmf_restrict:
  fixes f ::  "'a \<Rightarrow> 'b :: {banach, second_countable_topology}" shows
  "(\<integral> x. f x \<partial>measure_spmf M) = (\<integral> x. f x \<partial>restrict_space (measure_spmf M) (set_spmf M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L (measure_spmf M) f = integral\<^sup>L (restrict_space (measure_spmf M) (set_spmf M)) f
[PROOF STEP]
by(auto intro!: integral_cong_AE simp add: integral_restrict_space)


[STATEMENT]
lemma lcoeff_monom:
  assumes a: "a \<in> carrier R" and R_not_trivial: "(carrier R \<noteq> {\<zero>})"
  shows "lcoeff (monom P \<one>\<^bsub>R\<^esub> 1 \<ominus>\<^bsub>P\<^esub> monom P a 0) = \<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lcoeff (monom P \<one> 1 \<ominus>\<^bsub>P\<^esub> monom P a 0) = \<one>
[PROOF STEP]
using deg_minus_monom [OF a R_not_trivial]
[PROOF STATE]
proof (prove)
using this:
deg R (monom P \<one> 1 \<ominus>\<^bsub>P\<^esub> monom P a 0) = 1

goal (1 subgoal):
 1. lcoeff (monom P \<one> 1 \<ominus>\<^bsub>P\<^esub> monom P a 0) = \<one>
[PROOF STEP]
using coeff_minus a
[PROOF STATE]
proof (prove)
using this:
deg R (monom P \<one> 1 \<ominus>\<^bsub>P\<^esub> monom P a 0) = 1
\<lbrakk>?p \<in> carrier P; ?q \<in> carrier P\<rbrakk> \<Longrightarrow> coeff P (?p \<ominus>\<^bsub>P\<^esub> ?q) ?n = coeff P ?p ?n \<ominus> coeff P ?q ?n
a \<in> carrier R

goal (1 subgoal):
 1. lcoeff (monom P \<one> 1 \<ominus>\<^bsub>P\<^esub> monom P a 0) = \<one>
[PROOF STEP]
by auto algebra


[STATEMENT]
lemma exp_mtx_cnst_acc_simps:
  "exp (t *\<^sub>R K) $$ 1 $ 1 = 1" "exp (t *\<^sub>R K) $$ 1 $ 2 = t" "exp (t *\<^sub>R K) $$ 1 $ 3 = t^2/2"
  "exp (t *\<^sub>R K) $$ 2 $ 1 = 0" "exp (t *\<^sub>R K) $$ 2 $ 2 = 1" "exp (t *\<^sub>R K) $$ 2 $ 3 = t"
  "exp (t *\<^sub>R K) $$ 3 $ 1 = 0" "exp (t *\<^sub>R K) $$ 3 $ 2 = 0" "exp (t *\<^sub>R K) $$ 3 $ 3 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((exp (t *\<^sub>R K) $$ 1 $ 1 = 1 &&& exp (t *\<^sub>R K) $$ 1 $ 2 = t) &&& exp (t *\<^sub>R K) $$ 1 $ 3 = t\<^sup>2 / 2 &&& exp (t *\<^sub>R K) $$ 2 $ 1 = 0) &&& (exp (t *\<^sub>R K) $$ 2 $ 2 = 1 &&& exp (t *\<^sub>R K) $$ 2 $ 3 = t) &&& exp (t *\<^sub>R K) $$ 3 $ 1 = 0 &&& exp (t *\<^sub>R K) $$ 3 $ 2 = 0 &&& exp (t *\<^sub>R K) $$ 3 $ 3 = 1
[PROOF STEP]
unfolding exp_mtx_cnst_acc one_mtx3 pow2_scaleR_mtx_cnst_acc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (((mtx [[0, 0, t\<^sup>2], [0, 0, 0], [0, 0, 0]] /\<^sub>R 2 + t *\<^sub>R K + diag3 1 1 1) $$ 1 $ 1 = 1 &&& (mtx [[0, 0, t\<^sup>2], [0, 0, 0], [0, 0, 0]] /\<^sub>R 2 + t *\<^sub>R K + diag3 1 1 1) $$ 1 $ 2 = t) &&& (mtx [[0, 0, t\<^sup>2], [0, 0, 0], [0, 0, 0]] /\<^sub>R 2 + t *\<^sub>R K + diag3 1 1 1) $$ 1 $ 3 = t\<^sup>2 / 2 &&& (mtx [[0, 0, t\<^sup>2], [0, 0, 0], [0, 0, 0]] /\<^sub>R 2 + t *\<^sub>R K + diag3 1 1 1) $$ 2 $ 1 = 0) &&& ((mtx [[0, 0, t\<^sup>2], [0, 0, 0], [0, 0, 0]] /\<^sub>R 2 + t *\<^sub>R K + diag3 1 1 1) $$ 2 $ 2 = 1 &&& (mtx [[0, 0, t\<^sup>2], [0, 0, 0], [0, 0, 0]] /\<^sub>R 2 + t *\<^sub>R K + diag3 1 1 1) $$ 2 $ 3 = t) &&& (mtx [[0, 0, t\<^sup>2], [0, 0, 0], [0, 0, 0]] /\<^sub>R 2 + t *\<^sub>R K + diag3 1 1 1) $$ 3 $ 1 = 0 &&& (mtx [[0, 0, t\<^sup>2], [0, 0, 0], [0, 0, 0]] /\<^sub>R 2 + t *\<^sub>R K + diag3 1 1 1) $$ 3 $ 2 = 0 &&& (mtx [[0, 0, t\<^sup>2], [0, 0, 0], [0, 0, 0]] /\<^sub>R 2 + t *\<^sub>R K + diag3 1 1 1) $$ 3 $ 3 = 1
[PROOF STEP]
by simp_all


[STATEMENT]
lemma mdeg_alt: "max_deg (Node r xs) = Max (insert (fcard xs) (max_deg ` fst ` fset xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max_deg (Node r xs) = Max (insert (fcard xs) (max_deg ` fst ` fset xs))
[PROOF STEP]
using maxif_eq_Max[OF mdeg_img_fin, of xs "fcard xs"] mdeg_img_empty_iff[of xs]
[PROOF STATE]
proof (prove)
using this:
(if max_deg ` fst ` fset xs \<noteq> {} then max (fcard xs) (Max (max_deg ` fst ` fset xs)) else fcard xs) = Max (insert (fcard xs) (max_deg ` fst ` fset xs))
(max_deg ` fst ` fset xs = {}) = (xs = {||})

goal (1 subgoal):
 1. max_deg (Node r xs) = Max (insert (fcard xs) (max_deg ` fst ` fset xs))
[PROOF STEP]
by (auto split: if_splits)


[STATEMENT]
lemma eadd_gfp_partial_function_mono [partial_function_mono]:
  "\<lbrakk> monotone (fun_ord (\<ge>)) (\<ge>) f; monotone (fun_ord (\<ge>)) (\<ge>) g \<rbrakk>
  \<Longrightarrow> monotone (fun_ord (\<ge>)) (\<ge>) (\<lambda>x. f x + g x :: enat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>monotone (fun_ord (\<lambda>x y. y \<le> x)) (\<lambda>x y. y \<le> x) f; monotone (fun_ord (\<lambda>x y. y \<le> x)) (\<lambda>x y. y \<le> x) g\<rbrakk> \<Longrightarrow> monotone (fun_ord (\<lambda>x y. y \<le> x)) (\<lambda>x y. y \<le> x) (\<lambda>x. f x + g x)
[PROOF STEP]
by(rule mono2mono_gfp_eadd)


[STATEMENT]
lemma L8_Boiler:
  assumes h1:"SteamBoiler x s y"
         and h2:"ts x"
         and h3:"hd (x j) \<noteq> Zero"
  shows "(hd (s j)) + (10::nat) \<ge> hd (s (Suc j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hd (s (Suc j)) \<le> hd (s j) + 10
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. hd (s (Suc j)) \<le> hd (s j) + 10
[PROOF STEP]
from h1 and h2
[PROOF STATE]
proof (chain)
picking this:
SteamBoiler x s y
ts x
[PROOF STEP]
obtain r where
     a1:"r \<le> 10"  and
     a2:"hd (s (Suc j)) = (if hd (x j) = Zero then hd (s j) - r else hd (s j) + r)"
[PROOF STATE]
proof (prove)
using this:
SteamBoiler x s y
ts x

goal (1 subgoal):
 1. (\<And>r. \<lbrakk>r \<le> 10; hd (s (Suc j)) = (if hd (x j) = Zero then hd (s j) - r else hd (s j) + r)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (simp add: SteamBoiler_def, auto)
[PROOF STATE]
proof (state)
this:
r \<le> 10
hd (s (Suc j)) = (if hd (x j) = Zero then hd (s j) - r else hd (s j) + r)

goal (1 subgoal):
 1. hd (s (Suc j)) \<le> hd (s j) + 10
[PROOF STEP]
from a2 and h3
[PROOF STATE]
proof (chain)
picking this:
hd (s (Suc j)) = (if hd (x j) = Zero then hd (s j) - r else hd (s j) + r)
hd (x j) \<noteq> Zero
[PROOF STEP]
have "hd (s (Suc j)) = hd (s j) + r"
[PROOF STATE]
proof (prove)
using this:
hd (s (Suc j)) = (if hd (x j) = Zero then hd (s j) - r else hd (s j) + r)
hd (x j) \<noteq> Zero

goal (1 subgoal):
 1. hd (s (Suc j)) = hd (s j) + r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
hd (s (Suc j)) = hd (s j) + r

goal (1 subgoal):
 1. hd (s (Suc j)) \<le> hd (s j) + 10
[PROOF STEP]
from this and a1
[PROOF STATE]
proof (chain)
picking this:
hd (s (Suc j)) = hd (s j) + r
r \<le> 10
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
hd (s (Suc j)) = hd (s j) + r
r \<le> 10

goal (1 subgoal):
 1. hd (s (Suc j)) \<le> hd (s j) + 10
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
hd (s (Suc j)) \<le> hd (s j) + 10

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_var_list_monom_mult_list:  "sum_var_list (monom_mult_list m n) x = sum_var_list m x + sum_var_list n x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_var_list (monom_mult_list m n) x = sum_var_list m x + sum_var_list n x
[PROOF STEP]
proof (induct m n rule: monom_mult_list.induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n. sum_var_list (monom_mult_list [] n) x = sum_var_list [] x + sum_var_list n x
 2. \<And>xa p m n. \<lbrakk>\<And>x21 x22 xaa y. \<lbrakk>n = x21 # x22; (xaa, y) = x21; xa = xaa\<rbrakk> \<Longrightarrow> sum_var_list (monom_mult_list m x22) x = sum_var_list m x + sum_var_list x22 x; \<And>x21 x22 xaa y. \<lbrakk>n = x21 # x22; (xaa, y) = x21; xa \<noteq> xaa; xa < xaa\<rbrakk> \<Longrightarrow> sum_var_list (monom_mult_list m n) x = sum_var_list m x + sum_var_list n x; \<And>x21 x22 xaa y. \<lbrakk>n = x21 # x22; (xaa, y) = x21; xa \<noteq> xaa; \<not> xa < xaa\<rbrakk> \<Longrightarrow> sum_var_list (monom_mult_list ((xa, p) # m) x22) x = sum_var_list ((xa, p) # m) x + sum_var_list x22 x\<rbrakk> \<Longrightarrow> sum_var_list (monom_mult_list ((xa, p) # m) n) x = sum_var_list ((xa, p) # m) x + sum_var_list n x
[PROOF STEP]
case (2 x p m n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>n = ?x21.0 # ?x22.0; (?xa, ?y) = ?x21.0; x = ?xa\<rbrakk> \<Longrightarrow> sum_var_list (monom_mult_list m ?x22.0) x = sum_var_list m x + sum_var_list ?x22.0 x
\<lbrakk>n = ?x21.0 # ?x22.0; (?xa, ?y) = ?x21.0; x \<noteq> ?xa; x < ?xa\<rbrakk> \<Longrightarrow> sum_var_list (monom_mult_list m n) x = sum_var_list m x + sum_var_list n x
\<lbrakk>n = ?x21.0 # ?x22.0; (?xa, ?y) = ?x21.0; x \<noteq> ?xa; \<not> x < ?xa\<rbrakk> \<Longrightarrow> sum_var_list (monom_mult_list ((x, p) # m) ?x22.0) x = sum_var_list ((x, p) # m) x + sum_var_list ?x22.0 x

goal (2 subgoals):
 1. \<And>n. sum_var_list (monom_mult_list [] n) x = sum_var_list [] x + sum_var_list n x
 2. \<And>xa p m n. \<lbrakk>\<And>x21 x22 xaa y. \<lbrakk>n = x21 # x22; (xaa, y) = x21; xa = xaa\<rbrakk> \<Longrightarrow> sum_var_list (monom_mult_list m x22) x = sum_var_list m x + sum_var_list x22 x; \<And>x21 x22 xaa y. \<lbrakk>n = x21 # x22; (xaa, y) = x21; xa \<noteq> xaa; xa < xaa\<rbrakk> \<Longrightarrow> sum_var_list (monom_mult_list m n) x = sum_var_list m x + sum_var_list n x; \<And>x21 x22 xaa y. \<lbrakk>n = x21 # x22; (xaa, y) = x21; xa \<noteq> xaa; \<not> xa < xaa\<rbrakk> \<Longrightarrow> sum_var_list (monom_mult_list ((xa, p) # m) x22) x = sum_var_list ((xa, p) # m) x + sum_var_list x22 x\<rbrakk> \<Longrightarrow> sum_var_list (monom_mult_list ((xa, p) # m) n) x = sum_var_list ((xa, p) # m) x + sum_var_list n x
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n = ?x21.0 # ?x22.0; (?xa, ?y) = ?x21.0; x = ?xa\<rbrakk> \<Longrightarrow> sum_var_list (monom_mult_list m ?x22.0) x = sum_var_list m x + sum_var_list ?x22.0 x
\<lbrakk>n = ?x21.0 # ?x22.0; (?xa, ?y) = ?x21.0; x \<noteq> ?xa; x < ?xa\<rbrakk> \<Longrightarrow> sum_var_list (monom_mult_list m n) x = sum_var_list m x + sum_var_list n x
\<lbrakk>n = ?x21.0 # ?x22.0; (?xa, ?y) = ?x21.0; x \<noteq> ?xa; \<not> x < ?xa\<rbrakk> \<Longrightarrow> sum_var_list (monom_mult_list ((x, p) # m) ?x22.0) x = sum_var_list ((x, p) # m) x + sum_var_list ?x22.0 x

goal (1 subgoal):
 1. sum_var_list (monom_mult_list ((x, p) # m) n) x = sum_var_list ((x, p) # m) x + sum_var_list n x
[PROOF STEP]
by (cases n; cases "hd n", auto split: if_splits simp: sum_var_list_def)
[PROOF STATE]
proof (state)
this:
sum_var_list (monom_mult_list ((x, p) # m) n) x = sum_var_list ((x, p) # m) x + sum_var_list n x

goal (1 subgoal):
 1. \<And>n. sum_var_list (monom_mult_list [] n) x = sum_var_list [] x + sum_var_list n x
[PROOF STEP]
qed (auto simp: sum_var_list_def)


[STATEMENT]
lemma max_reg_gNot: "max_reg (gNot x) = max_reg x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. GExp.max_reg (gNot x) = GExp.max_reg x
[PROOF STEP]
by (simp add: max_reg_def gNot_def)


[STATEMENT]
lemma summable_cot_pfd_complex:
  fixes x :: complex
  shows "summable (\<lambda>n. 2 * x / (x ^ 2 - of_nat (Suc n) ^ 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2))
[PROOF STEP]
using sums_cot_pfd_complex[of x]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2)) sums cot_pfd x

goal (1 subgoal):
 1. summable (\<lambda>n. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2))
[PROOF STEP]
by (simp add: sums_iff)


[STATEMENT]
lemma Constrains_UN:
  assumes Co: "!!i. i \<in> I ==> F \<in> (A i) Co (A' i)"
  shows "F \<in> (\<Union>i \<in> I. A i) Co (\<Union>i \<in> I. A' i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F \<in> \<Union> (A ` I) Co \<Union> (A' ` I)
[PROOF STEP]
apply (unfold Constrains_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F \<in> {F. F \<in> reachable F \<inter> \<Union> (A ` I) co \<Union> (A' ` I)}
[PROOF STEP]
apply (rule CollectI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F \<in> reachable F \<inter> \<Union> (A ` I) co \<Union> (A' ` I)
[PROOF STEP]
apply (rule Co [unfolded Constrains_def, THEN CollectD, THEN constrains_UN,
                THEN constrains_weaken],   auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma closure_of_interior_of:
   "X closure_of S = topspace X - X interior_of (topspace X - S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X closure_of S = topspace X - X interior_of (topspace X - S)
[PROOF STEP]
by (simp add: interior_of_complement Diff_Diff_Int closure_of)


[STATEMENT]
lemma det_singleton:
  assumes A: "A \<in> carrier_mat 1 1"
  shows "det A = A $$ (0,0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det A = A $$ (0, 0)
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat 1 1

goal (1 subgoal):
 1. Determinant.det A = A $$ (0, 0)
[PROOF STEP]
unfolding carrier_mat_def Determinant.det_def
[PROOF STATE]
proof (prove)
using this:
A \<in> {m. dim_row m = 1 \<and> dim_col m = 1}

goal (1 subgoal):
 1. (if dim_row A = dim_col A then \<Sum>p | p permutes {0..<dim_row A}. of_int (sign p) * (\<Prod>i = 0..<dim_row A. A $$ (i, p i)) else (0::'b)) = A $$ (0, 0)
[PROOF STEP]
by auto


[STATEMENT]
lemma mat1_vert_wall_left:
assumes "is_tangle_diagram b"
shows
"rat_poly.matrix_mult  (blockmat (make_vert_block (nat (domain_wall b)))) (kauff_mat b)
             = (kauff_mat b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly.matrix_mult (blockmat (make_vert_block (nat (domain_wall b)))) (kauff_mat b) = kauff_mat b
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rat_poly.matrix_mult (blockmat (make_vert_block (nat (domain_wall b)))) (kauff_mat b) = kauff_mat b
[PROOF STEP]
have "mat (2^(nat (domain_wall b))) (length (kauff_mat b)) (kauff_mat b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (2 ^ nat (domain_wall b)) (length (kauff_mat b)) (kauff_mat b)
[PROOF STEP]
by (metis assms matrix_kauff_mat)
[PROOF STATE]
proof (state)
this:
mat (2 ^ nat (domain_wall b)) (length (kauff_mat b)) (kauff_mat b)

goal (1 subgoal):
 1. rat_poly.matrix_mult (blockmat (make_vert_block (nat (domain_wall b)))) (kauff_mat b) = kauff_mat b
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
mat (2 ^ nat (domain_wall b)) (length (kauff_mat b)) (kauff_mat b)

goal (1 subgoal):
 1. rat_poly.matrix_mult (blockmat (make_vert_block (nat (domain_wall b)))) (kauff_mat b) = kauff_mat b
[PROOF STEP]
have "(blockmat (make_vert_block (nat (domain_wall b))))
                       = mat1 (2^(nat (domain_wall b)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. blockmat (make_vert_block (nat (domain_wall b))) = mat1 (2 ^ nat (domain_wall b))
[PROOF STEP]
using make_vert_block_map_blockmat
[PROOF STATE]
proof (prove)
using this:
blockmat (make_vert_block ?n) = mat1 (2 ^ ?n)

goal (1 subgoal):
 1. blockmat (make_vert_block (nat (domain_wall b))) = mat1 (2 ^ nat (domain_wall b))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
blockmat (make_vert_block (nat (domain_wall b))) = mat1 (2 ^ nat (domain_wall b))

goal (1 subgoal):
 1. rat_poly.matrix_mult (blockmat (make_vert_block (nat (domain_wall b)))) (kauff_mat b) = kauff_mat b
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
mat (2 ^ nat (domain_wall b)) (length (kauff_mat b)) (kauff_mat b)
blockmat (make_vert_block (nat (domain_wall b))) = mat1 (2 ^ nat (domain_wall b))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mat (2 ^ nat (domain_wall b)) (length (kauff_mat b)) (kauff_mat b)
blockmat (make_vert_block (nat (domain_wall b))) = mat1 (2 ^ nat (domain_wall b))

goal (1 subgoal):
 1. rat_poly.matrix_mult (blockmat (make_vert_block (nat (domain_wall b)))) (kauff_mat b) = kauff_mat b
[PROOF STEP]
by (metis blockmat_make_vert mat1_mult_left prop_make_vert_equiv(1))
[PROOF STATE]
proof (state)
this:
rat_poly.matrix_mult (blockmat (make_vert_block (nat (domain_wall b)))) (kauff_mat b) = kauff_mat b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infsum_of_real:
  shows \<open>(\<Sum>\<^sub>\<infinity>x\<in>A. of_real (f x) :: 'b::{real_normed_vector, real_algebra_1}) = of_real (\<Sum>\<^sub>\<infinity>x\<in>A. f x)\<close>
  \<comment> \<open>This result has nothing to do with the bounded operator library but it
      uses @{thm [source] finite_span_closed} so it is proven here.\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>A. of_real (f x)) = of_real (infsum f A)
[PROOF STEP]
unfolding of_real_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>A. f x *\<^sub>R (1::'b)) = infsum f A *\<^sub>R (1::'b)
[PROOF STEP]
by (rule infsum_scaleR_left)


[STATEMENT]
lemma Proj_range_closed:
  assumes "is_Proj P"
  shows "closed (range (cblinfun_apply P))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed (range ((*\<^sub>V) P))
[PROOF STEP]
apply (rule is_projection_on_closed[where f=\<open>cblinfun_apply P\<close>])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> closure (range ((*\<^sub>V) P)) \<Longrightarrow> isCont ((*\<^sub>V) P) x
 2. is_projection_on ((*\<^sub>V) P) (range ((*\<^sub>V) P))
[PROOF STEP]
using assms is_Proj.rep_eq is_projection_on_image
[PROOF STATE]
proof (prove)
using this:
is_Proj P
is_Proj ?x = Ex (is_projection_on ((*\<^sub>V) ?x))
is_projection_on ?\<pi> ?M \<Longrightarrow> range ?\<pi> = ?M

goal (2 subgoals):
 1. \<And>x. x \<in> closure (range ((*\<^sub>V) P)) \<Longrightarrow> isCont ((*\<^sub>V) P) x
 2. is_projection_on ((*\<^sub>V) P) (range ((*\<^sub>V) P))
[PROOF STEP]
by auto


[STATEMENT]
lemma sets_Collect_single':
  "i \<in> I \<Longrightarrow> {x\<in>space (M i). P x} \<in> sets (M i) \<Longrightarrow> {x\<in>space (PiM I M). P (x i)} \<in> sets (PiM I M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i \<in> I; {x \<in> space (M i). P x} \<in> sets (M i)\<rbrakk> \<Longrightarrow> {x \<in> space (Pi\<^sub>M I M). P (x i)} \<in> sets (Pi\<^sub>M I M)
[PROOF STEP]
using sets_Collect_single[of i I "{x\<in>space (M i). P x}" M]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i \<in> I; {x \<in> space (M i). P x} \<in> sets (M i)\<rbrakk> \<Longrightarrow> {x \<in> space (Pi\<^sub>M I M). x i \<in> {x \<in> space (M i). P x}} \<in> sets (Pi\<^sub>M I M)

goal (1 subgoal):
 1. \<lbrakk>i \<in> I; {x \<in> space (M i). P x} \<in> sets (M i)\<rbrakk> \<Longrightarrow> {x \<in> space (Pi\<^sub>M I M). P (x i)} \<in> sets (Pi\<^sub>M I M)
[PROOF STEP]
by (simp add: space_PiM PiE_iff cong: conj_cong)


[STATEMENT]
lemma finite_subset_wf:
  shows "wf {(X, Y). X \<subset> Y \<and> finite Y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf {(X, Y). X \<subset> Y \<and> finite Y}
[PROOF STEP]
by (metis finite_psubset_def wf_finite_psubset)