[STATEMENT]
lemma rearrange_real_euclid_B_2:
  fixes a b c :: "real^('n::finite)"
  assumes "l \<noteq> 0"
  shows "b - a = l *\<^sub>R (c - a) \<longleftrightarrow> c = (1/l) *\<^sub>R b + (1 - 1/l) *\<^sub>R a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b - a = l *\<^sub>R (c - a)) = (c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. b - a = l *\<^sub>R (c - a) \<Longrightarrow> c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a
 2. c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a \<Longrightarrow> b - a = l *\<^sub>R (c - a)
[PROOF STEP]
from scaleR_right_diff_distrib [of "1/l" b a]
[PROOF STATE]
proof (chain)
picking this:
(1 / l) *\<^sub>R (b - a) = (1 / l) *\<^sub>R b - (1 / l) *\<^sub>R a
[PROOF STEP]
have "(1/l) *\<^sub>R (b - a) = c - a \<longleftrightarrow> (1/l) *\<^sub>R b - (1/l) *\<^sub>R a + a = c"
[PROOF STATE]
proof (prove)
using this:
(1 / l) *\<^sub>R (b - a) = (1 / l) *\<^sub>R b - (1 / l) *\<^sub>R a

goal (1 subgoal):
 1. ((1 / l) *\<^sub>R (b - a) = c - a) = ((1 / l) *\<^sub>R b - (1 / l) *\<^sub>R a + a = c)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((1 / l) *\<^sub>R (b - a) = c - a) = ((1 / l) *\<^sub>R b - (1 / l) *\<^sub>R a + a = c)

goal (2 subgoals):
 1. b - a = l *\<^sub>R (c - a) \<Longrightarrow> c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a
 2. c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a \<Longrightarrow> b - a = l *\<^sub>R (c - a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((1 / l) *\<^sub>R (b - a) = c - a) = ((1 / l) *\<^sub>R b - (1 / l) *\<^sub>R a + a = c)

goal (2 subgoals):
 1. b - a = l *\<^sub>R (c - a) \<Longrightarrow> c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a
 2. c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a \<Longrightarrow> b - a = l *\<^sub>R (c - a)
[PROOF STEP]
with scaleR_left_diff_distrib [of 1 "1/l" a]
[PROOF STATE]
proof (chain)
picking this:
(1 - 1 / l) *\<^sub>R a = 1 *\<^sub>R a - (1 / l) *\<^sub>R a
((1 / l) *\<^sub>R (b - a) = c - a) = ((1 / l) *\<^sub>R b - (1 / l) *\<^sub>R a + a = c)
[PROOF STEP]
have "\<dots> \<longleftrightarrow> c = (1/l) *\<^sub>R b + (1 - 1/l) *\<^sub>R a"
[PROOF STATE]
proof (prove)
using this:
(1 - 1 / l) *\<^sub>R a = 1 *\<^sub>R a - (1 / l) *\<^sub>R a
((1 / l) *\<^sub>R (b - a) = c - a) = ((1 / l) *\<^sub>R b - (1 / l) *\<^sub>R a + a = c)

goal (1 subgoal):
 1. ((1 / l) *\<^sub>R b - (1 / l) *\<^sub>R a + a = c) = (c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((1 / l) *\<^sub>R b - (1 / l) *\<^sub>R a + a = c) = (c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a)

goal (2 subgoals):
 1. b - a = l *\<^sub>R (c - a) \<Longrightarrow> c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a
 2. c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a \<Longrightarrow> b - a = l *\<^sub>R (c - a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((1 / l) *\<^sub>R (b - a) = c - a) = (c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a)
[PROOF STEP]
have eq:
    "(1/l) *\<^sub>R (b - a) = c - a \<longleftrightarrow> c = (1/l) *\<^sub>R b + (1 - 1/l) *\<^sub>R a"
[PROOF STATE]
proof (prove)
using this:
((1 / l) *\<^sub>R (b - a) = c - a) = (c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a)

goal (1 subgoal):
 1. ((1 / l) *\<^sub>R (b - a) = c - a) = (c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((1 / l) *\<^sub>R (b - a) = c - a) = (c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a)

goal (2 subgoals):
 1. b - a = l *\<^sub>R (c - a) \<Longrightarrow> c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a
 2. c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a \<Longrightarrow> b - a = l *\<^sub>R (c - a)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
((1 / l) *\<^sub>R (b - a) = c - a) = (c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a)

goal (2 subgoals):
 1. b - a = l *\<^sub>R (c - a) \<Longrightarrow> c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a
 2. c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a \<Longrightarrow> b - a = l *\<^sub>R (c - a)
[PROOF STEP]
assume "b - a = l *\<^sub>R (c - a)"
[PROOF STATE]
proof (state)
this:
b - a = l *\<^sub>R (c - a)

goal (2 subgoals):
 1. b - a = l *\<^sub>R (c - a) \<Longrightarrow> c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a
 2. c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a \<Longrightarrow> b - a = l *\<^sub>R (c - a)
[PROOF STEP]
with \<open>l \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
l \<noteq> 0
b - a = l *\<^sub>R (c - a)
[PROOF STEP]
have "(1/l) *\<^sub>R (b - a) = c - a"
[PROOF STATE]
proof (prove)
using this:
l \<noteq> 0
b - a = l *\<^sub>R (c - a)

goal (1 subgoal):
 1. (1 / l) *\<^sub>R (b - a) = c - a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(1 / l) *\<^sub>R (b - a) = c - a

goal (2 subgoals):
 1. b - a = l *\<^sub>R (c - a) \<Longrightarrow> c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a
 2. c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a \<Longrightarrow> b - a = l *\<^sub>R (c - a)
[PROOF STEP]
with eq
[PROOF STATE]
proof (chain)
picking this:
((1 / l) *\<^sub>R (b - a) = c - a) = (c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a)
(1 / l) *\<^sub>R (b - a) = c - a
[PROOF STEP]
show "c = (1/l) *\<^sub>R b + (1 - 1/l) *\<^sub>R a"
[PROOF STATE]
proof (prove)
using this:
((1 / l) *\<^sub>R (b - a) = c - a) = (c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a)
(1 / l) *\<^sub>R (b - a) = c - a

goal (1 subgoal):
 1. c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a

goal (1 subgoal):
 1. c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a \<Longrightarrow> b - a = l *\<^sub>R (c - a)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
b - a = l *\<^sub>R (c - a) \<Longrightarrow> c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a

goal (1 subgoal):
 1. c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a \<Longrightarrow> b - a = l *\<^sub>R (c - a)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
b - a = l *\<^sub>R (c - a) \<Longrightarrow> c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a

goal (1 subgoal):
 1. c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a \<Longrightarrow> b - a = l *\<^sub>R (c - a)
[PROOF STEP]
assume "c = (1/l) *\<^sub>R b + (1 - 1/l) *\<^sub>R a"
[PROOF STATE]
proof (state)
this:
c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a

goal (1 subgoal):
 1. c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a \<Longrightarrow> b - a = l *\<^sub>R (c - a)
[PROOF STEP]
with eq
[PROOF STATE]
proof (chain)
picking this:
((1 / l) *\<^sub>R (b - a) = c - a) = (c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a)
c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a
[PROOF STEP]
have "(1/l) *\<^sub>R (b - a) = c - a"
[PROOF STATE]
proof (prove)
using this:
((1 / l) *\<^sub>R (b - a) = c - a) = (c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a)
c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a

goal (1 subgoal):
 1. (1 / l) *\<^sub>R (b - a) = c - a
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(1 / l) *\<^sub>R (b - a) = c - a

goal (1 subgoal):
 1. c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a \<Longrightarrow> b - a = l *\<^sub>R (c - a)
[PROOF STEP]
hence "l *\<^sub>R (1/l) *\<^sub>R (b - a) = l *\<^sub>R (c - a)"
[PROOF STATE]
proof (prove)
using this:
(1 / l) *\<^sub>R (b - a) = c - a

goal (1 subgoal):
 1. l *\<^sub>R (1 / l) *\<^sub>R (b - a) = l *\<^sub>R (c - a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
l *\<^sub>R (1 / l) *\<^sub>R (b - a) = l *\<^sub>R (c - a)

goal (1 subgoal):
 1. c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a \<Longrightarrow> b - a = l *\<^sub>R (c - a)
[PROOF STEP]
with \<open>l \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
l \<noteq> 0
l *\<^sub>R (1 / l) *\<^sub>R (b - a) = l *\<^sub>R (c - a)
[PROOF STEP]
show "b - a = l *\<^sub>R (c - a)"
[PROOF STATE]
proof (prove)
using this:
l \<noteq> 0
l *\<^sub>R (1 / l) *\<^sub>R (b - a) = l *\<^sub>R (c - a)

goal (1 subgoal):
 1. b - a = l *\<^sub>R (c - a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b - a = l *\<^sub>R (c - a)

goal:
No subgoals!
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
c = (1 / l) *\<^sub>R b + (1 - 1 / l) *\<^sub>R a \<Longrightarrow> b - a = l *\<^sub>R (c - a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_pderiv: "degree (pderiv p) = degree p - 1"
  for p :: "'a::{comm_semiring_1,semiring_no_zero_divisors,semiring_char_0} poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (pderiv p) = degree p - 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. degree (pderiv p) = degree p - 1
[PROOF STEP]
have "degree p - 1 \<le> degree (pderiv p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree p - 1 \<le> degree (pderiv p)
[PROOF STEP]
proof (cases "degree p")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. degree p = 0 \<Longrightarrow> degree p - 1 \<le> degree (pderiv p)
 2. \<And>nat. degree p = Suc nat \<Longrightarrow> degree p - 1 \<le> degree (pderiv p)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
degree p = Suc n

goal (2 subgoals):
 1. degree p = 0 \<Longrightarrow> degree p - 1 \<le> degree (pderiv p)
 2. \<And>nat. degree p = Suc nat \<Longrightarrow> degree p - 1 \<le> degree (pderiv p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
degree p = Suc n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
degree p = Suc n

goal (1 subgoal):
 1. degree p - 1 \<le> degree (pderiv p)
[PROOF STEP]
by (metis coeff_pderiv degree_0 diff_Suc_1 le_degree leading_coeff_0_iff mult_eq_0_iff nat.distinct(1) of_nat_eq_0_iff)
[PROOF STATE]
proof (state)
this:
degree p - 1 \<le> degree (pderiv p)

goal (1 subgoal):
 1. degree p = 0 \<Longrightarrow> degree p - 1 \<le> degree (pderiv p)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
degree p - 1 \<le> degree (pderiv p)

goal (1 subgoal):
 1. degree (pderiv p) = degree p - 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
degree p - 1 \<le> degree (pderiv p)

goal (1 subgoal):
 1. degree (pderiv p) = degree p - 1
[PROOF STEP]
have "\<forall>i>degree p - 1. coeff (pderiv p) i = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i>degree p - 1. coeff (pderiv p) i = (0::'a)
[PROOF STEP]
by (simp add: coeff_eq_0 coeff_pderiv)
[PROOF STATE]
proof (state)
this:
\<forall>i>degree p - 1. coeff (pderiv p) i = (0::'a)

goal (1 subgoal):
 1. degree (pderiv p) = degree p - 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
degree p - 1 \<le> degree (pderiv p)
\<forall>i>degree p - 1. coeff (pderiv p) i = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
degree p - 1 \<le> degree (pderiv p)
\<forall>i>degree p - 1. coeff (pderiv p) i = (0::'a)

goal (1 subgoal):
 1. degree (pderiv p) = degree p - 1
[PROOF STEP]
using order_antisym [OF degree_le]
[PROOF STATE]
proof (prove)
using this:
degree p - 1 \<le> degree (pderiv p)
\<forall>i>degree p - 1. coeff (pderiv p) i = (0::'a)
\<lbrakk>\<forall>i>?y. coeff ?p1 i = (0::?'a1); ?y \<le> degree ?p1\<rbrakk> \<Longrightarrow> degree ?p1 = ?y

goal (1 subgoal):
 1. degree (pderiv p) = degree p - 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
degree (pderiv p) = degree p - 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_on_inverse[continuous_intros]:
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_div_algebra"
  assumes "continuous_on s f"
    and "\<forall>x\<in>s. f x \<noteq> 0"
  shows "continuous_on s (\<lambda>x. inverse (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on s (\<lambda>x. inverse (f x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous_on s f
\<forall>x\<in>s. f x \<noteq> (0::'b)

goal (1 subgoal):
 1. continuous_on s (\<lambda>x. inverse (f x))
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>s. (f \<longlongrightarrow> f x) (at x within s)
\<forall>x\<in>s. f x \<noteq> (0::'b)

goal (1 subgoal):
 1. \<forall>x\<in>s. ((\<lambda>x. inverse (f x)) \<longlongrightarrow> inverse (f x)) (at x within s)
[PROOF STEP]
by (blast intro: tendsto_inverse)


[STATEMENT]
lemma mult_mat_vec_of_list:
  assumes "length ls = nc"
  assumes "list_all (\<lambda>r. length r = nc) rs"
  shows "mat_of_rows_list nc rs *\<^sub>v vec_of_list ls =
    vec_of_list (map (\<lambda>r. vec_of_list r \<bullet> vec_of_list ls) rs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_rows_list nc rs *\<^sub>v vec_of_list ls = vec_of_list (map (\<lambda>r. vec_of_list r \<bullet> vec_of_list ls) rs)
[PROOF STEP]
unfolding mult_mat_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec (dim_row (mat_of_rows_list nc rs)) (\<lambda>i. row (mat_of_rows_list nc rs) i \<bullet> vec_of_list ls) = vec_of_list (map (\<lambda>r. vec_of_list r \<bullet> vec_of_list ls) rs)
[PROOF STEP]
using row_mat_of_rows_list assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>list_all (\<lambda>r. length r = ?nc) ?rs; ?i < length ?rs\<rbrakk> \<Longrightarrow> row (mat_of_rows_list ?nc ?rs) ?i = vec_of_list (?rs ! ?i)
length ls = nc
list_all (\<lambda>r. length r = nc) rs

goal (1 subgoal):
 1. vec (dim_row (mat_of_rows_list nc rs)) (\<lambda>i. row (mat_of_rows_list nc rs) i \<bullet> vec_of_list ls) = vec_of_list (map (\<lambda>r. vec_of_list r \<bullet> vec_of_list ls) rs)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>nc rs i. \<lbrakk>list_all (\<lambda>r. length r = nc) rs; i < length rs\<rbrakk> \<Longrightarrow> row (mat_of_rows_list nc rs) i = vec_of_list (rs ! i); list_all (\<lambda>r. length r = length ls) rs; nc = length ls\<rbrakk> \<Longrightarrow> vec (dim_row (mat_of_rows_list (length ls) rs)) (\<lambda>i. row (mat_of_rows_list (length ls) rs) i \<bullet> vec_of_list ls) = map_vec (\<lambda>r. vec_of_list r \<bullet> vec_of_list ls) (vec_of_list rs)
[PROOF STEP]
by (smt dim_row_mat(1) dim_vec dim_vec_of_list eq_vecI index_map_vec(1) index_map_vec(2) index_vec list_all_length mat_of_rows_list_def row_mat_of_rows_list vec_of_list_index)


[STATEMENT]
lemma has_derivative_power[simp, derivative_intros]:
  fixes f :: "'a :: real_normed_vector \<Rightarrow> 'b :: real_normed_field"
  assumes f: "(f has_derivative f') (at x within S)"
  shows "((\<lambda>x. f x^n) has_derivative (\<lambda>y. of_nat n * f' y * f x^(n - 1))) (at x within S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f x ^ n) has_derivative (\<lambda>y. of_nat n * f' y * f x ^ (n - 1))) (at x within S)
[PROOF STEP]
using has_derivative_prod[OF f, of "{..< n}"]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. \<Prod>i<n. f x) has_derivative (\<lambda>y. \<Sum>i<n. f' y * (\<Prod>j\<in>{..<n} - {i}. f x))) (at x within S)

goal (1 subgoal):
 1. ((\<lambda>x. f x ^ n) has_derivative (\<lambda>y. of_nat n * f' y * f x ^ (n - 1))) (at x within S)
[PROOF STEP]
by (simp add: prod_constant ac_simps)


[STATEMENT]
lemma isUCont_Cauchy: "isUCont f \<Longrightarrow> Cauchy X \<Longrightarrow> Cauchy (\<lambda>n. f (X n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>isUCont f; Cauchy X\<rbrakk> \<Longrightarrow> Cauchy (\<lambda>n. f (X n))
[PROOF STEP]
by (rule uniformly_continuous_on_Cauchy[where S=UNIV and f=f]) simp_all


[STATEMENT]
lemma B_in_orthogonal_complement_of_orthogonal_complement:
  shows "B \<subseteq> orthogonal_complement (orthogonal_complement B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<subseteq> orthogonal_complement (orthogonal_complement B)
[PROOF STEP]
by (auto simp add: orthogonal_complement_def orthogonal_def inner_commute_zero)


[STATEMENT]
lemma in_open_segment_iff_line: "x \<in> {a <--< b} \<longleftrightarrow> (\<exists>c\<in>{0<..<1}. a \<noteq> b \<and> x = line a b c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> {a<--<b}) = (\<exists>c\<in>{0<..<1}. a \<noteq> b \<and> x = {a -- b}\<^bsub>c\<^esub>)
[PROOF STEP]
by (auto simp: in_segment line_def algebra_simps)


[STATEMENT]
lemma le_cSup_iff_less:
  fixes x :: "'a :: {conditionally_complete_linorder, dense_linorder}"
  shows "A \<noteq> {} \<Longrightarrow> bdd_above (f`A) \<Longrightarrow> x \<le> (SUP i\<in>A. f i) \<longleftrightarrow> (\<forall>y<x. \<exists>i\<in>A. y \<le> f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; bdd_above (f ` A)\<rbrakk> \<Longrightarrow> (x \<le> Sup (f ` A)) = (\<forall>y<x. \<exists>i\<in>A. y \<le> f i)
[PROOF STEP]
by (simp add: le_cSUP_iff)
     (blast intro: less_imp_le less_trans less_le_trans dest: dense)


[STATEMENT]
lemma non_neg_mat_mult_non_neg_vec: "non_neg_mat a \<Longrightarrow> non_neg_vec v \<Longrightarrow>
  non_neg_vec (a *v v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>non_neg_mat a; non_neg_vec v\<rbrakk> \<Longrightarrow> non_neg_vec (a *v v)
[PROOF STEP]
unfolding non_neg_mat_def non_neg_vec_def  elements_mat_h_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>a\<in>range (\<lambda>(i, y). a $h i $h y). (0::'a) \<le> a; \<forall>i. (0::'a) \<le> v $h i\<rbrakk> \<Longrightarrow> \<forall>i. (0::'a) \<le> (a *v v) $h i
[PROOF STEP]
by (auto simp: matrix_vector_mult_def intro!: sum_nonneg)


[STATEMENT]
lemma mat_transpose_mat_cnj:
  shows "mat_transpose (mat_cnj A) = mat_adj A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_transpose (mat_cnj A) = mat_adj A
[PROOF STEP]
by (cases A)  (auto simp add: mat_adj_def mat_cnj_def)


[STATEMENT]
lemma bounded_norm_le_SUP_norm:
  "bounded (range f) \<Longrightarrow> norm (f x) \<le> (SUP x. norm (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded (range f) \<Longrightarrow> norm (f x) \<le> (SUP x. norm (f x))
[PROOF STEP]
by (auto intro!: cSUP_upper bounded_imp_bdd_above simp: bounded_norm_comp)


[STATEMENT]
lemma interlaced_seq_bounded:
   "\<lbrakk> \<forall>n. of_rat (r n) < x; \<forall>n. of_rat (s n) < x\<rbrakk>
    \<Longrightarrow> of_rat (interlaced_seq r s n) < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>n. of_rat (r n) < x; \<forall>n. of_rat (s n) < x\<rbrakk> \<Longrightarrow> of_rat (interlaced_seq r s n) < x
[PROOF STEP]
unfolding interlaced_seq_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>n. of_rat (r n) < x; \<forall>n. of_rat (s n) < x\<rbrakk> \<Longrightarrow> of_rat (if odd n then r (interlaced_index r s n) else s (interlaced_index r s n)) < x
[PROOF STEP]
by auto


[STATEMENT]
lemma rHom_inv_inv:"\<lbrakk> Ring A; Ring R; x \<in> carrier A; f \<in> rHom A R \<rbrakk>
 \<Longrightarrow> f (-\<^sub>a\<^bsub>A\<^esub> x) = -\<^sub>a\<^bsub>R\<^esub> (f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ring A; Ring R; x \<in> carrier A; f \<in> rHom A R\<rbrakk> \<Longrightarrow> f (-\<^sub>a\<^bsub>A\<^esub> x) = -\<^sub>a\<^bsub>R\<^esub> f x
[PROOF STEP]
apply (frule Ring.ring_is_ag [of "A"],
       frule Ring.ring_is_ag [of "R"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ring A; Ring R; x \<in> carrier A; f \<in> rHom A R; aGroup A; aGroup R\<rbrakk> \<Longrightarrow> f (-\<^sub>a\<^bsub>A\<^esub> x) = -\<^sub>a\<^bsub>R\<^esub> f x
[PROOF STEP]
apply (simp add:rHom_def, erule conjE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Ring A; Ring R; x \<in> carrier A; aGroup A; aGroup R; f \<in> aHom A R; (\<forall>x\<in>carrier A. \<forall>y\<in>carrier A. f (x \<cdot>\<^sub>r\<^bsub>A\<^esub> y) = f x \<cdot>\<^sub>r\<^bsub>R\<^esub> f y) \<and> f 1\<^sub>r\<^bsub>A\<^esub> = 1\<^sub>r\<^bsub>R\<^esub>\<rbrakk> \<Longrightarrow> f (-\<^sub>a\<^bsub>A\<^esub> x) = -\<^sub>a\<^bsub>R\<^esub> f x
[PROOF STEP]
apply (simp add:aHom_inv_inv)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in Ring) npMulExp:"\<And>n m. x \<in> carrier R
        \<Longrightarrow>  npow R (npow R x n) m = npow R x (n * m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n m. x \<in> carrier R \<Longrightarrow> x^\<^bsup>R n\<^esup>^\<^bsup>R m\<^esup> = x^\<^bsup>R (n * m)\<^esup>
[PROOF STEP]
apply (induct_tac m)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n m. x \<in> carrier R \<Longrightarrow> x^\<^bsup>R n\<^esup>^\<^bsup>R 0\<^esup> = x^\<^bsup>R (n * 0)\<^esup>
 2. \<And>n m na. \<lbrakk>x \<in> carrier R; x^\<^bsup>R n\<^esup>^\<^bsup>R na\<^esup> = x^\<^bsup>R (n * na)\<^esup>\<rbrakk> \<Longrightarrow> x^\<^bsup>R n\<^esup>^\<^bsup>R Suc na\<^esup> = x^\<^bsup>R (n * Suc na)\<^esup>
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n m na. \<lbrakk>x \<in> carrier R; x^\<^bsup>R n\<^esup>^\<^bsup>R na\<^esup> = x^\<^bsup>R (n * na)\<^esup>\<rbrakk> \<Longrightarrow> x^\<^bsup>R n\<^esup>^\<^bsup>R Suc na\<^esup> = x^\<^bsup>R (n * Suc na)\<^esup>
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; x^\<^bsup>R n\<^esup>^\<^bsup>R na\<^esup> = x^\<^bsup>R (n * na)\<^esup>\<rbrakk> \<Longrightarrow> x^\<^bsup>R (n * na)\<^esup> \<cdot>\<^sub>r x^\<^bsup>R n\<^esup> = x^\<^bsup>R (n + n * na)\<^esup>
[PROOF STEP]
apply (simp add:npMulDistr)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na. \<lbrakk>x \<in> carrier R; x^\<^bsup>R n\<^esup>^\<^bsup>R na\<^esup> = x^\<^bsup>R (n * na)\<^esup>\<rbrakk> \<Longrightarrow> x^\<^bsup>R (n * na + n)\<^esup> = x^\<^bsup>R (n + n * na)\<^esup>
[PROOF STEP]
apply (simp add:add.commute)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma x_times_x_minus_1_nonpos: "x \<ge> 0 \<Longrightarrow> x \<le> 1 \<Longrightarrow> (x::_::linordered_idom) * (x - 1) \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(0::'a) \<le> x; x \<le> (1::'a)\<rbrakk> \<Longrightarrow> x * (x - (1::'a)) \<le> (0::'a)
[PROOF STEP]
by (intro mult_nonneg_nonpos) simp_all


[STATEMENT]
lemma is_balanced_union:
  fixes A B:: "nat set"
  assumes "A \<subseteq> {i::nat. i < 2^n}" and "B \<subseteq> {i::nat. i < 2^n}"
      and "card A = 2^(n-1)" and "card B = 2^(n-1)"
      and "A \<inter> B = {}"
  shows "A \<union> B = {i::nat. i < 2^n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<union> B = {i. i < 2 ^ n}
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<union> B = {i. i < 2 ^ n}
[PROOF STEP]
have "finite A" and "finite B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A &&& finite B
[PROOF STEP]
by (simp add: assms(3) card_ge_0_finite)
      (simp add: assms(4) card_ge_0_finite)
[PROOF STATE]
proof (state)
this:
finite A
finite B

goal (1 subgoal):
 1. A \<union> B = {i. i < 2 ^ n}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite A
finite B
[PROOF STEP]
have "card(A \<union> B) = 2 * 2^(n-1)"
[PROOF STATE]
proof (prove)
using this:
finite A
finite B

goal (1 subgoal):
 1. card (A \<union> B) = 2 * 2 ^ (n - 1)
[PROOF STEP]
using assms(3-5)
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
card A = 2 ^ (n - 1)
card B = 2 ^ (n - 1)
A \<inter> B = {}

goal (1 subgoal):
 1. card (A \<union> B) = 2 * 2 ^ (n - 1)
[PROOF STEP]
by (simp add: card_Un_disjoint)
[PROOF STATE]
proof (state)
this:
card (A \<union> B) = 2 * 2 ^ (n - 1)

goal (1 subgoal):
 1. A \<union> B = {i. i < 2 ^ n}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (A \<union> B) = 2 * 2 ^ (n - 1)
[PROOF STEP]
have "card(A \<union> B) = 2^n"
[PROOF STATE]
proof (prove)
using this:
card (A \<union> B) = 2 * 2 ^ (n - 1)

goal (1 subgoal):
 1. card (A \<union> B) = 2 ^ n
[PROOF STEP]
by (metis Nat.nat.simps(3) One_nat_def dim le_0_eq power_eq_if)
[PROOF STATE]
proof (state)
this:
card (A \<union> B) = 2 ^ n

goal (1 subgoal):
 1. A \<union> B = {i. i < 2 ^ n}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (A \<union> B) = 2 ^ n

goal (1 subgoal):
 1. A \<union> B = {i. i < 2 ^ n}
[PROOF STEP]
have "\<dots> = card({i::nat. i < 2^n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ n = card {i. i < 2 ^ n}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ n = card {i. i < 2 ^ n}

goal (1 subgoal):
 1. A \<union> B = {i. i < 2 ^ n}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
2 ^ n = card {i. i < 2 ^ n}

goal (1 subgoal):
 1. A \<union> B = {i. i < 2 ^ n}
[PROOF STEP]
have "A \<union> B \<subseteq> {i::nat. i < 2^n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<union> B \<subseteq> {i. i < 2 ^ n}
[PROOF STEP]
using assms(1,2)
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> {i. i < 2 ^ n}
B \<subseteq> {i. i < 2 ^ n}

goal (1 subgoal):
 1. A \<union> B \<subseteq> {i. i < 2 ^ n}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A \<union> B \<subseteq> {i. i < 2 ^ n}

goal (1 subgoal):
 1. A \<union> B = {i. i < 2 ^ n}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
A \<union> B \<subseteq> {i. i < 2 ^ n}

goal (1 subgoal):
 1. A \<union> B = {i. i < 2 ^ n}
[PROOF STEP]
have "finite ({i::nat. i < 2^n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {i. i < 2 ^ n}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {i. i < 2 ^ n}

goal (1 subgoal):
 1. A \<union> B = {i. i < 2 ^ n}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card (A \<union> B) = 2 ^ n
2 ^ n = card {i. i < 2 ^ n}
A \<union> B \<subseteq> {i. i < 2 ^ n}
finite {i. i < 2 ^ n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (A \<union> B) = 2 ^ n
2 ^ n = card {i. i < 2 ^ n}
A \<union> B \<subseteq> {i. i < 2 ^ n}
finite {i. i < 2 ^ n}

goal (1 subgoal):
 1. A \<union> B = {i. i < 2 ^ n}
[PROOF STEP]
using card_subset_eq[of "{i::nat. i < 2^n}" "A \<union> B"]
[PROOF STATE]
proof (prove)
using this:
card (A \<union> B) = 2 ^ n
2 ^ n = card {i. i < 2 ^ n}
A \<union> B \<subseteq> {i. i < 2 ^ n}
finite {i. i < 2 ^ n}
\<lbrakk>finite {i. i < 2 ^ n}; A \<union> B \<subseteq> {i. i < 2 ^ n}; card (A \<union> B) = card {i. i < 2 ^ n}\<rbrakk> \<Longrightarrow> A \<union> B = {i. i < 2 ^ n}

goal (1 subgoal):
 1. A \<union> B = {i. i < 2 ^ n}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A \<union> B = {i. i < 2 ^ n}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem cptn_iff_cptn_mod: "(c \<in> cptn) = (c \<in> cptn_mod)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c \<in> cptn) = (c \<in> cptn_mod)
[PROOF STEP]
apply(rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. c \<in> cptn \<Longrightarrow> c \<in> cptn_mod
 2. c \<in> cptn_mod \<Longrightarrow> c \<in> cptn
[PROOF STEP]
apply(erule cptn_onlyif_cptn_mod)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<in> cptn_mod \<Longrightarrow> c \<in> cptn
[PROOF STEP]
apply(erule cptn_if_cptn_mod)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Least_eq_0_iff: "(\<exists>i::nat. P i) \<Longrightarrow> (LEAST i. P i) = 0 \<longleftrightarrow> P 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i. P i \<Longrightarrow> ((LEAST i. P i) = 0) = P 0
[PROOF STEP]
by (metis LeastI_ex neq0_conv not_less_Least)


[STATEMENT]
lemma binomial_n_0 [simp]: "n choose 0 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n choose 0 = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n choose 0 = 1
[PROOF STEP]
have "{K \<in> Pow {0..<n}. card K = 0} = {{}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {K \<in> Pow {0..<n}. card K = 0} = {{}}
[PROOF STEP]
by (auto dest: finite_subset)
[PROOF STATE]
proof (state)
this:
{K \<in> Pow {0..<n}. card K = 0} = {{}}

goal (1 subgoal):
 1. n choose 0 = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{K \<in> Pow {0..<n}. card K = 0} = {{}}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{K \<in> Pow {0..<n}. card K = 0} = {{}}

goal (1 subgoal):
 1. n choose 0 = 1
[PROOF STEP]
by (simp add: binomial_def)
[PROOF STATE]
proof (state)
this:
n choose 0 = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mset_size2elem: "\<lbrakk>size P \<le> 2; {#q#}+{#q'#} \<subseteq># P\<rbrakk> \<Longrightarrow> P={#q#}+{#q'#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>size P \<le> 2; {#q#} + {#q'#} \<subseteq># P\<rbrakk> \<Longrightarrow> P = {#q#} + {#q'#}
[PROOF STEP]
by (auto elim: mset_le_addE)


[STATEMENT]
lemma pushforward_by_permutation_of_poly_list:
  assumes "is_poly_tuple k fs"
  assumes "\<sigma> permutes {..< length fs}"
  assumes "as \<in> carrier (R\<^bsup>k\<^esup>)"
  shows "poly_tuple_eval (permute_list \<sigma> fs) as = permute_list \<sigma> (poly_tuple_eval fs as)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_tuple_eval (permute_list \<sigma> fs) as = permute_list \<sigma> (poly_tuple_eval fs as)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_poly_tuple k fs
\<sigma> permutes {..<length fs}
as \<in> carrier (R\<^bsup>k\<^esup>)

goal (1 subgoal):
 1. poly_tuple_eval (permute_list \<sigma> fs) as = permute_list \<sigma> (poly_tuple_eval fs as)
[PROOF STEP]
unfolding poly_tuple_eval_def
[PROOF STATE]
proof (prove)
using this:
is_poly_tuple k fs
\<sigma> permutes {..<length fs}
as \<in> carrier (R\<^bsup>k\<^esup>)

goal (1 subgoal):
 1. map (eval_at_point R as) (permute_list \<sigma> fs) = permute_list \<sigma> (map (eval_at_point R as) fs)
[PROOF STEP]
by (metis permute_list_map)


[STATEMENT]
lemma le_diff_imp_gt_prod [rule_format]:
  fixes x::real and y::real and z::real and w::real
  assumes diff: "abs (x-y) < abs (z-w)" and sum: "x+y = z+w"
  shows "x*y > z*w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z * w < x * y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z * w < x * y
[PROOF STEP]
from sum
[PROOF STATE]
proof (chain)
picking this:
x + y = z + w
[PROOF STEP]
have "(x+y)^2 = (z+w)^2"
[PROOF STATE]
proof (prove)
using this:
x + y = z + w

goal (1 subgoal):
 1. (x + y)\<^sup>2 = (z + w)\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(x + y)\<^sup>2 = (z + w)\<^sup>2

goal (1 subgoal):
 1. z * w < x * y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(x + y)\<^sup>2 = (z + w)\<^sup>2

goal (1 subgoal):
 1. z * w < x * y
[PROOF STEP]
from diff
[PROOF STATE]
proof (chain)
picking this:
\<bar>x - y\<bar> < \<bar>z - w\<bar>
[PROOF STEP]
have "(x-y)^2 < (z-w)^2"
[PROOF STATE]
proof (prove)
using this:
\<bar>x - y\<bar> < \<bar>z - w\<bar>

goal (1 subgoal):
 1. (x - y)\<^sup>2 < (z - w)\<^sup>2
[PROOF STEP]
by (rule abs_less_imp_sq_less)
[PROOF STATE]
proof (state)
this:
(x - y)\<^sup>2 < (z - w)\<^sup>2

goal (1 subgoal):
 1. z * w < x * y
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(x + y)\<^sup>2 = (z + w)\<^sup>2
(x - y)\<^sup>2 < (z - w)\<^sup>2
[PROOF STEP]
have "(x+y)^2 - (x-y)^2 > (z+w)^2 - (z-w)^2"
[PROOF STATE]
proof (prove)
using this:
(x + y)\<^sup>2 = (z + w)\<^sup>2
(x - y)\<^sup>2 < (z - w)\<^sup>2

goal (1 subgoal):
 1. (z + w)\<^sup>2 - (z - w)\<^sup>2 < (x + y)\<^sup>2 - (x - y)\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(z + w)\<^sup>2 - (z - w)\<^sup>2 < (x + y)\<^sup>2 - (x - y)\<^sup>2

goal (1 subgoal):
 1. z * w < x * y
[PROOF STEP]
thus "x*y > z*w"
[PROOF STATE]
proof (prove)
using this:
(z + w)\<^sup>2 - (z - w)\<^sup>2 < (x + y)\<^sup>2 - (x - y)\<^sup>2

goal (1 subgoal):
 1. z * w < x * y
[PROOF STEP]
by (simp only: prod_exp [symmetric])
[PROOF STATE]
proof (state)
this:
z * w < x * y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bool_tests:
  "bool_taut_test b = (\<forall>s. val_bool_expr b s)" (is ?t1)
  "bool_sat_test b = (\<exists>s. val_bool_expr b s)" (is ?t2)
  "bool_impl_test b1 b2 = (\<forall>s. val_bool_expr b1 s \<longrightarrow> val_bool_expr b2 s)" (is ?t3)
  "bool_equiv_test b1 b2 = (\<forall>s. val_bool_expr b1 s \<longleftrightarrow> val_bool_expr b2 s)" (is ?t4)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (bool_taut_test b = (\<forall>s. val_bool_expr b s) &&& bool_sat_test b = (\<exists>s. val_bool_expr b s)) &&& bool_impl_test b1 b2 = (\<forall>s. val_bool_expr b1 s \<longrightarrow> val_bool_expr b2 s) &&& bool_equiv_test b1 b2 = (\<forall>s. val_bool_expr b1 s = val_bool_expr b2 s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. bool_taut_test b = (\<forall>s. val_bool_expr b s)
 2. bool_sat_test b = (\<exists>s. val_bool_expr b s)
 3. bool_impl_test b1 b2 = (\<forall>s. val_bool_expr b1 s \<longrightarrow> val_bool_expr b2 s)
 4. bool_equiv_test b1 b2 = (\<forall>s. val_bool_expr b1 s = val_bool_expr b2 s)
[PROOF STEP]
interpret reduced_bdt_checkers ifex_of val_bool_expr
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reduced_bdt_checkers ifex_of val_bool_expr
[PROOF STEP]
by (unfold_locales; insert val_ifex reduced_ifex; blast)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. bool_taut_test b = (\<forall>s. val_bool_expr b s)
 2. bool_sat_test b = (\<exists>s. val_bool_expr b s)
 3. bool_impl_test b1 b2 = (\<forall>s. val_bool_expr b1 s \<longrightarrow> val_bool_expr b2 s)
 4. bool_equiv_test b1 b2 = (\<forall>s. val_bool_expr b1 s = val_bool_expr b2 s)
[PROOF STEP]
show ?t1 ?t2 ?t3 ?t4
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (bool_taut_test b = (\<forall>s. val_bool_expr b s) &&& bool_sat_test b = (\<exists>s. val_bool_expr b s)) &&& bool_impl_test b1 b2 = (\<forall>s. val_bool_expr b1 s \<longrightarrow> val_bool_expr b2 s) &&& bool_equiv_test b1 b2 = (\<forall>s. val_bool_expr b1 s = val_bool_expr b2 s)
[PROOF STEP]
by (simp_all add: bool_taut_test_def bool_sat_test_def bool_impl_test_def bool_equiv_test_def taut_test sat_test impl_test equiv_test)
[PROOF STATE]
proof (state)
this:
bool_taut_test b = (\<forall>s. val_bool_expr b s)
bool_sat_test b = (\<exists>s. val_bool_expr b s)
bool_impl_test b1 b2 = (\<forall>s. val_bool_expr b1 s \<longrightarrow> val_bool_expr b2 s)
bool_equiv_test b1 b2 = (\<forall>s. val_bool_expr b1 s = val_bool_expr b2 s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma evnodd_iff: "(i, j) \<in> evnodd A b \<longleftrightarrow> (i, j) \<in> A  \<and> (i + j) mod 2 = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((i, j) \<in> evnodd A b) = ((i, j) \<in> A \<and> (i + j) mod 2 = b)
[PROOF STEP]
by (simp add: evnodd_def)


[STATEMENT]
lemma append_is_polynomial: "\<lbrakk> polynomial K p; p \<noteq> [] \<rbrakk> \<Longrightarrow> polynomial K (p @ (replicate n \<zero>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>polynomial K p; p \<noteq> []\<rbrakk> \<Longrightarrow> polynomial K (p @ replicate n \<zero>)
[PROOF STEP]
unfolding polynomial_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p = [] \<or> set p \<subseteq> K \<and> lead_coeff p \<noteq> \<zero>; p \<noteq> []\<rbrakk> \<Longrightarrow> p @ replicate n \<zero> = [] \<or> set (p @ replicate n \<zero>) \<subseteq> K \<and> lead_coeff (p @ replicate n \<zero>) \<noteq> \<zero>
[PROOF STEP]
using subringE(2)[OF K]
[PROOF STATE]
proof (prove)
using this:
\<zero> \<in> K

goal (1 subgoal):
 1. \<lbrakk>p = [] \<or> set p \<subseteq> K \<and> lead_coeff p \<noteq> \<zero>; p \<noteq> []\<rbrakk> \<Longrightarrow> p @ replicate n \<zero> = [] \<or> set (p @ replicate n \<zero>) \<subseteq> K \<and> lead_coeff (p @ replicate n \<zero>) \<noteq> \<zero>
[PROOF STEP]
by auto


[STATEMENT]
lemma rectangle__coplanar:
  assumes "Rectangle A B C D"
  shows "Coplanar A B C D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Coplanar A B C D
[PROOF STEP]
using Rectangle_def assms plg__coplanar
[PROOF STATE]
proof (prove)
using this:
Rectangle ?A ?B ?C ?D \<equiv> Plg ?A ?B ?C ?D \<and> Cong ?A ?C ?B ?D
Rectangle A B C D
Plg ?A ?B ?C ?D \<Longrightarrow> Coplanar ?A ?B ?C ?D

goal (1 subgoal):
 1. Coplanar A B C D
[PROOF STEP]
by blast


[STATEMENT]
lemma closure_ic_union_ci:
  assumes "a < (b::real)" "b < c"
  shows "closure ({a..<b} \<union> {b<..c})  = {a .. c}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure ({a..<b} \<union> {b<..c}) = {a..c}
[PROOF STEP]
using frontier_ic[OF assms(1)] frontier_ci[OF assms(2)] closure_Un assms
[PROOF STATE]
proof (prove)
using this:
frontier {a<..b} = {a, b}
frontier {b<..<c} = {b, c}
closure (?S \<union> ?T) = closure ?S \<union> closure ?T
a < b
b < c

goal (1 subgoal):
 1. closure ({a..<b} \<union> {b<..c}) = {a..c}
[PROOF STEP]
apply(simp add: frontier_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>{a..b} - {a<..<b} = {a, b}; {b..c} - {b<..<c} = {b, c}; a < b; b < c\<rbrakk> \<Longrightarrow> {a..b} \<union> {b..c} = {a..c}
[PROOF STEP]
by auto


[STATEMENT]
lemma while_least:
fixes q :: "'a::order"
assumes "\<forall>x\<in>L.\<forall>y\<in>L. x \<le> y \<longrightarrow> f x \<le> f y" and "\<forall>x. x \<in> L \<longrightarrow> f x \<in> L"
and "\<forall>x \<in> L. b \<le> x" and "b \<in> L" and "f q \<le> q" and "q \<in> L"
and "while_option P f b = Some p"
shows "p \<le> q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<le> q
[PROOF STEP]
using while_option_rule[OF _  assms(7)[unfolded pfp_def],
                        where P = "%x. x \<in> L \<and> x \<le> q"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>s. \<lbrakk>s \<in> L \<and> s \<le> q; P s\<rbrakk> \<Longrightarrow> f s \<in> L \<and> f s \<le> q; b \<in> L \<and> b \<le> q\<rbrakk> \<Longrightarrow> p \<in> L \<and> p \<le> q

goal (1 subgoal):
 1. p \<le> q
[PROOF STEP]
by (metis assms(1-6) order_trans)


[STATEMENT]
lemma floor_Fract [simp]: "\<lfloor>Fract a b\<rfloor> = a div b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>Fract a b\<rfloor> = a div b
[PROOF STEP]
by (simp add: Fract_of_int_quotient floor_divide_of_int_eq)


[STATEMENT]
lemma (in fin_bipartite_graph) bipartite_deg_square_eq:
  "\<forall> y \<in> Y. (\<Sum> x' \<in> X. \<Sum> x \<in> X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>y\<in>Y. (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)\<^sup>2
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. y \<in> Y \<Longrightarrow> (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)\<^sup>2
[PROOF STEP]
have hX: "finite X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite X
[PROOF STEP]
by (simp add: partitions_finite(1))
[PROOF STATE]
proof (state)
this:
finite X

goal (1 subgoal):
 1. \<And>y. y \<in> Y \<Longrightarrow> (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)\<^sup>2
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. y \<in> Y \<Longrightarrow> (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)\<^sup>2
[PROOF STEP]
assume hy: "y \<in> Y"
[PROOF STATE]
proof (state)
this:
y \<in> Y

goal (1 subgoal):
 1. \<And>y. y \<in> Y \<Longrightarrow> (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)\<^sup>2
[PROOF STEP]
have 1: "\<forall> x' \<in> X. \<forall> x \<in> X. indicator {z. vert_adj x z \<and> vert_adj x' z} y =
    indicator ({z. vert_adj x' z} \<inter> {z. vert_adj x z}) y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x'\<in>X. \<forall>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y = indicator ({z. vert_adj x' z} \<inter> {z. vert_adj x z}) y
[PROOF STEP]
by (metis (mono_tags, lifting) Int_Collect indicator_simps(1) indicator_simps(2) mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
\<forall>x'\<in>X. \<forall>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y = indicator ({z. vert_adj x' z} \<inter> {z. vert_adj x z}) y

goal (1 subgoal):
 1. \<And>y. y \<in> Y \<Longrightarrow> (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)\<^sup>2
[PROOF STEP]
have 2: "\<forall> x' \<in> X. \<forall> x \<in> X. (indicator ({z. vert_adj x' z} \<inter> {z. vert_adj x z}) y:: nat) =
    indicator {z. vert_adj x' z} y * indicator {z. vert_adj x z} y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x'\<in>X. \<forall>x\<in>X. indicator ({z. vert_adj x' z} \<inter> {z. vert_adj x z}) y = indicator {z. vert_adj x' z} y * indicator {z. vert_adj x z} y
[PROOF STEP]
using indicator_inter_arith
[PROOF STATE]
proof (prove)
using this:
indicator (?A \<inter> ?B) ?x = indicator ?A ?x * indicator ?B ?x

goal (1 subgoal):
 1. \<forall>x'\<in>X. \<forall>x\<in>X. indicator ({z. vert_adj x' z} \<inter> {z. vert_adj x z}) y = indicator {z. vert_adj x' z} y * indicator {z. vert_adj x z} y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x'\<in>X. \<forall>x\<in>X. indicator ({z. vert_adj x' z} \<inter> {z. vert_adj x z}) y = indicator {z. vert_adj x' z} y * indicator {z. vert_adj x z} y

goal (1 subgoal):
 1. \<And>y. y \<in> Y \<Longrightarrow> (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)\<^sup>2
[PROOF STEP]
have "(\<Sum> x' \<in> X. \<Sum> x \<in> X. (indicator {z. vert_adj x z \<and> vert_adj x' z} y:: nat)) =
    (\<Sum> x' \<in> X. \<Sum> x \<in> X. indicator ({z. vert_adj x' z} \<inter> {z. vert_adj x z}) y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator ({z. vert_adj x' z} \<inter> {z. vert_adj x z}) y)
[PROOF STEP]
using 1 sum.cong
[PROOF STATE]
proof (prove)
using this:
\<forall>x'\<in>X. \<forall>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y = indicator ({z. vert_adj x' z} \<inter> {z. vert_adj x z}) y
\<lbrakk>?A = ?B; \<And>x. x \<in> ?B \<Longrightarrow> ?g x = ?h x\<rbrakk> \<Longrightarrow> sum ?g ?A = sum ?h ?B

goal (1 subgoal):
 1. (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator ({z. vert_adj x' z} \<inter> {z. vert_adj x z}) y)
[PROOF STEP]
by (metis (no_types, lifting))
[PROOF STATE]
proof (state)
this:
(\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator ({z. vert_adj x' z} \<inter> {z. vert_adj x z}) y)

goal (1 subgoal):
 1. \<And>y. y \<in> Y \<Longrightarrow> (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator ({z. vert_adj x' z} \<inter> {z. vert_adj x z}) y)

goal (1 subgoal):
 1. \<And>y. y \<in> Y \<Longrightarrow> (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)\<^sup>2
[PROOF STEP]
have "... = (\<Sum> x' \<in> X. \<Sum> x \<in> X. indicator {z. vert_adj x' z} y *
    indicator {z. vert_adj x z} y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator ({z. vert_adj x' z} \<inter> {z. vert_adj x z}) y) = (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x' z} y * indicator {z. vert_adj x z} y)
[PROOF STEP]
using 2 sum.cong
[PROOF STATE]
proof (prove)
using this:
\<forall>x'\<in>X. \<forall>x\<in>X. indicator ({z. vert_adj x' z} \<inter> {z. vert_adj x z}) y = indicator {z. vert_adj x' z} y * indicator {z. vert_adj x z} y
\<lbrakk>?A = ?B; \<And>x. x \<in> ?B \<Longrightarrow> ?g x = ?h x\<rbrakk> \<Longrightarrow> sum ?g ?A = sum ?h ?B

goal (1 subgoal):
 1. (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator ({z. vert_adj x' z} \<inter> {z. vert_adj x z}) y) = (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x' z} y * indicator {z. vert_adj x z} y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator ({z. vert_adj x' z} \<inter> {z. vert_adj x z}) y) = (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x' z} y * indicator {z. vert_adj x z} y)

goal (1 subgoal):
 1. \<And>y. y \<in> Y \<Longrightarrow> (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator ({z. vert_adj x' z} \<inter> {z. vert_adj x z}) y) = (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x' z} y * indicator {z. vert_adj x z} y)

goal (1 subgoal):
 1. \<And>y. y \<in> Y \<Longrightarrow> (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)\<^sup>2
[PROOF STEP]
have "... = sum (\<lambda> x. indicator {z. vert_adj x z} y) X * sum (\<lambda> x. indicator {z. vert_adj x z} y) X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x' z} y * indicator {z. vert_adj x z} y) = (\<Sum>x\<in>X. indicator {z. vert_adj x z} y) * (\<Sum>x\<in>X. indicator {z. vert_adj x z} y)
[PROOF STEP]
using sum_product[of "(\<lambda> x. (indicator {z. vert_adj x z} y:: nat))" "X"
      "(\<lambda> x. indicator {z. vert_adj x z} y)" "X"]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>X. indicator {z. vert_adj x z} y) * (\<Sum>x\<in>X. indicator {z. vert_adj x z} y) = (\<Sum>i\<in>X. \<Sum>j\<in>X. indicator {z. vert_adj i z} y * indicator {z. vert_adj j z} y)

goal (1 subgoal):
 1. (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x' z} y * indicator {z. vert_adj x z} y) = (\<Sum>x\<in>X. indicator {z. vert_adj x z} y) * (\<Sum>x\<in>X. indicator {z. vert_adj x z} y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x' z} y * indicator {z. vert_adj x z} y) = (\<Sum>x\<in>X. indicator {z. vert_adj x z} y) * (\<Sum>x\<in>X. indicator {z. vert_adj x z} y)

goal (1 subgoal):
 1. \<And>y. y \<in> Y \<Longrightarrow> (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (\<Sum>x\<in>X. indicator {z. vert_adj x z} y) * (\<Sum>x\<in>X. indicator {z. vert_adj x z} y)
[PROOF STEP]
have 3: "(\<Sum> x' \<in> X. \<Sum> x \<in> X. (indicator {z. vert_adj x z \<and> vert_adj x' z} y:: nat)) =
    (sum (\<lambda> x. indicator {z. vert_adj x z} y) X) ^ 2"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (\<Sum>x\<in>X. indicator {z. vert_adj x z} y) * (\<Sum>x\<in>X. indicator {z. vert_adj x z} y)

goal (1 subgoal):
 1. (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (\<Sum>x\<in>X. indicator {z. vert_adj x z} y)\<^sup>2
[PROOF STEP]
using power2_eq_square
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (\<Sum>x\<in>X. indicator {z. vert_adj x z} y) * (\<Sum>x\<in>X. indicator {z. vert_adj x z} y)
?a\<^sup>2 = ?a * ?a

goal (1 subgoal):
 1. (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (\<Sum>x\<in>X. indicator {z. vert_adj x z} y)\<^sup>2
[PROOF STEP]
by (metis (no_types, lifting))
[PROOF STATE]
proof (state)
this:
(\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (\<Sum>x\<in>X. indicator {z. vert_adj x z} y)\<^sup>2

goal (1 subgoal):
 1. \<And>y. y \<in> Y \<Longrightarrow> (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)\<^sup>2
[PROOF STEP]
have "\<forall> x \<in> X. indicator {z. vert_adj x z} y = indicator {x. vert_adj x y} x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>X. indicator {z. vert_adj x z} y = indicator {x. vert_adj x y} x
[PROOF STEP]
by (simp add: indicator_def)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>X. indicator {z. vert_adj x z} y = indicator {x. vert_adj x y} x

goal (1 subgoal):
 1. \<And>y. y \<in> Y \<Longrightarrow> (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)\<^sup>2
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>X. indicator {z. vert_adj x z} y = indicator {x. vert_adj x y} x
[PROOF STEP]
have "(sum (\<lambda> x. indicator {z. vert_adj x z} y) X) = sum (\<lambda> x. indicator {x. vert_adj x y} x) X"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>X. indicator {z. vert_adj x z} y = indicator {x. vert_adj x y} x

goal (1 subgoal):
 1. (\<Sum>x\<in>X. indicator {z. vert_adj x z} y) = sum (indicator {x. vert_adj x y}) X
[PROOF STEP]
using sum.cong
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>X. indicator {z. vert_adj x z} y = indicator {x. vert_adj x y} x
\<lbrakk>?A = ?B; \<And>x. x \<in> ?B \<Longrightarrow> ?g x = ?h x\<rbrakk> \<Longrightarrow> sum ?g ?A = sum ?h ?B

goal (1 subgoal):
 1. (\<Sum>x\<in>X. indicator {z. vert_adj x z} y) = sum (indicator {x. vert_adj x y}) X
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>X. indicator {z. vert_adj x z} y) = sum (indicator {x. vert_adj x y}) X

goal (1 subgoal):
 1. \<And>y. y \<in> Y \<Longrightarrow> (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>X. indicator {z. vert_adj x z} y) = sum (indicator {x. vert_adj x y}) X

goal (1 subgoal):
 1. \<And>y. y \<in> Y \<Longrightarrow> (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)\<^sup>2
[PROOF STEP]
have "... = card ({x \<in> X. vert_adj x y})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (indicator {x. vert_adj x y}) X = card {x \<in> X. vert_adj x y}
[PROOF STEP]
using sum_indicator_eq_card hX
[PROOF STATE]
proof (prove)
using this:
finite ?A \<Longrightarrow> sum (indicator ?B) ?A = card (?A \<inter> ?B)
finite X

goal (1 subgoal):
 1. sum (indicator {x. vert_adj x y}) X = card {x \<in> X. vert_adj x y}
[PROOF STEP]
by (metis Collect_conj_eq Collect_mem_eq)
[PROOF STATE]
proof (state)
this:
sum (indicator {x. vert_adj x y}) X = card {x \<in> X. vert_adj x y}

goal (1 subgoal):
 1. \<And>y. y \<in> Y \<Longrightarrow> (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>x\<in>X. indicator {z. vert_adj x z} y) = card {x \<in> X. vert_adj x y}
[PROOF STEP]
show "(\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)^2"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>X. indicator {z. vert_adj x z} y) = card {x \<in> X. vert_adj x y}

goal (1 subgoal):
 1. (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)\<^sup>2
[PROOF STEP]
using 3 hy degree_neighbors_ssY neighbors_ss_def vert_adj_sym
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>X. indicator {z. vert_adj x z} y) = card {x \<in> X. vert_adj x y}
(\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (\<Sum>x\<in>X. indicator {z. vert_adj x z} y)\<^sup>2
y \<in> Y
?v \<in> Y \<Longrightarrow> degree ?v = card (neighbors_ss ?v X)
neighbors_ss ?x ?Y \<equiv> {y \<in> ?Y. vert_adj ?x y}
vert_adj ?v1.0 ?v2.0 = vert_adj ?v2.0 ?v1.0

goal (1 subgoal):
 1. (\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)\<^sup>2
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
(\<Sum>x'\<in>X. \<Sum>x\<in>X. indicator {z. vert_adj x z \<and> vert_adj x' z} y) = (degree y)\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vector_mul_lcancel[simp]: "a *s x = a *s y \<longleftrightarrow> a = (0::'a::field) \<or> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a *s x = a *s y) = (a = (0::'a) \<or> x = y)
[PROOF STEP]
by (metis eq_iff_diff_eq_0 vector_mul_eq_0 vector_ssub_ldistrib)


[STATEMENT]
theorem gram_schmidt_result:
  assumes ws: "set ws \<subseteq> carrier_vec n"
    and dist: "distinct ws"
    and ind: "~ lin_dep (set ws)"
    and us: "us = gram_schmidt n ws"
  shows "span (set ws) = span (set us)"
    and "corthogonal us"
    and "set us \<subseteq> carrier_vec n"
    and "length us = length ws"
    and "distinct us"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (local.span (set ws) = local.span (set us) &&& corthogonal us) &&& set us \<subseteq> carrier_vec n &&& length us = length ws &&& distinct us
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. local.span (set ws) = local.span (set us)
 2. corthogonal us
 3. set us \<subseteq> carrier_vec n
 4. length us = length ws
 5. distinct us
[PROOF STEP]
have main: "gram_schmidt_sub n [] ws = rev us"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gram_schmidt_sub n [] ws = rev us
[PROOF STEP]
using us
[PROOF STATE]
proof (prove)
using this:
us = gram_schmidt n ws

goal (1 subgoal):
 1. gram_schmidt_sub n [] ws = rev us
[PROOF STEP]
unfolding gram_schmidt_def
[PROOF STATE]
proof (prove)
using this:
us = rev (gram_schmidt_sub n [] ws)

goal (1 subgoal):
 1. gram_schmidt_sub n [] ws = rev us
[PROOF STEP]
using gram_schmidt_sub_eq
[PROOF STATE]
proof (prove)
using this:
us = rev (gram_schmidt_sub n [] ws)
rev (gram_schmidt_sub ?n ?us ?ws) = rev ?us @ gram_schmidt_sub2 ?n ?us ?ws

goal (1 subgoal):
 1. gram_schmidt_sub n [] ws = rev us
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
gram_schmidt_sub n [] ws = rev us

goal (5 subgoals):
 1. local.span (set ws) = local.span (set us)
 2. corthogonal us
 3. set us \<subseteq> carrier_vec n
 4. length us = length ws
 5. distinct us
[PROOF STEP]
have orth: "corthogonal []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. corthogonal []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
corthogonal []

goal (5 subgoals):
 1. local.span (set ws) = local.span (set us)
 2. corthogonal us
 3. set us \<subseteq> carrier_vec n
 4. length us = length ws
 5. distinct us
[PROOF STEP]
have "span (set ws) = span (set (rev us))"
   and orth2: "corthogonal (rev us)"
   and "set us \<subseteq> carrier_vec n"
   and "length us = length ws"
   and dist: "distinct us"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (local.span (set ws) = local.span (set (rev us)) &&& corthogonal (rev us)) &&& set us \<subseteq> carrier_vec n &&& length us = length ws &&& distinct us
[PROOF STEP]
using gram_schmidt_sub_result[OF main ws]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set [] \<subseteq> carrier_vec n; distinct ([] @ ws); lin_indpt (set ([] @ ws)); corthogonal []\<rbrakk> \<Longrightarrow> set (rev us) \<subseteq> carrier_vec n \<and> distinct (rev us) \<and> corthogonal (rev us) \<and> local.span (set ([] @ ws)) = local.span (set (rev us)) \<and> length (rev us) = length [] + length ws

goal (1 subgoal):
 1. (local.span (set ws) = local.span (set (rev us)) &&& corthogonal (rev us)) &&& set us \<subseteq> carrier_vec n &&& length us = length ws &&& distinct us
[PROOF STEP]
by (auto simp: assms orth)
[PROOF STATE]
proof (state)
this:
local.span (set ws) = local.span (set (rev us))
corthogonal (rev us)
set us \<subseteq> carrier_vec n
length us = length ws
distinct us

goal (5 subgoals):
 1. local.span (set ws) = local.span (set us)
 2. corthogonal us
 3. set us \<subseteq> carrier_vec n
 4. length us = length ws
 5. distinct us
[PROOF STEP]
thus "span (set ws) = span (set us)"
[PROOF STATE]
proof (prove)
using this:
local.span (set ws) = local.span (set (rev us))
corthogonal (rev us)
set us \<subseteq> carrier_vec n
length us = length ws
distinct us

goal (1 subgoal):
 1. local.span (set ws) = local.span (set us)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.span (set ws) = local.span (set us)

goal (4 subgoals):
 1. corthogonal us
 2. set us \<subseteq> carrier_vec n
 3. length us = length ws
 4. distinct us
[PROOF STEP]
show "set us \<subseteq> carrier_vec n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set us \<subseteq> carrier_vec n
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
set us \<subseteq> carrier_vec n

goal (3 subgoals):
 1. corthogonal us
 2. length us = length ws
 3. distinct us
[PROOF STEP]
show "length us = length ws"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length us = length ws
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
length us = length ws

goal (2 subgoals):
 1. corthogonal us
 2. distinct us
[PROOF STEP]
show "distinct us"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct us
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
distinct us

goal (1 subgoal):
 1. corthogonal us
[PROOF STEP]
show "corthogonal us"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. corthogonal us
[PROOF STEP]
using corthogonal_distinct[OF orth2]
[PROOF STATE]
proof (prove)
using this:
distinct (rev us)

goal (1 subgoal):
 1. corthogonal us
[PROOF STEP]
unfolding distinct_rev
[PROOF STATE]
proof (prove)
using this:
distinct us

goal (1 subgoal):
 1. corthogonal us
[PROOF STEP]
using corthogonal_sort[OF _ set_rev orth2]
[PROOF STATE]
proof (prove)
using this:
distinct us
distinct us \<Longrightarrow> corthogonal us

goal (1 subgoal):
 1. corthogonal us
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
corthogonal us

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma floorlog_leI:
  "x < b ^ w \<Longrightarrow> 0 \<le> w \<Longrightarrow> b > 1 \<Longrightarrow> floorlog b x \<le> w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x < b ^ w; 0 \<le> w; 1 < b\<rbrakk> \<Longrightarrow> floorlog b x \<le> w
[PROOF STEP]
by (drule less_imp_of_nat_less[where 'a=real])
    (auto simp: floorlog_def Suc_le_eq nat_less_iff floor_less_iff log_of_power_less)


[STATEMENT]
lemma floor_le_one [simp]: "\<lfloor>x\<rfloor> \<le> 1 \<longleftrightarrow> x < 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lfloor>x\<rfloor> \<le> 1) = (x < (2::'a))
[PROOF STEP]
by (simp add: floor_le_iff)


[STATEMENT]
lemma lcm_mult_gcd [simp]: "lcm a b * gcd a b = normalize a * normalize b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lcm a b * gcd a b = normalize a * normalize b
[PROOF STEP]
using gcd_mult_lcm [of a b]
[PROOF STATE]
proof (prove)
using this:
gcd a b * lcm a b = normalize a * normalize b

goal (1 subgoal):
 1. lcm a b * gcd a b = normalize a * normalize b
[PROOF STEP]
by (simp add: ac_simps)


[STATEMENT]
lemma eventually_at_left_field:
  "eventually P (at_left x) \<longleftrightarrow> (\<exists>b<x. \<forall>y>b. y < x \<longrightarrow> P y)"
  for x :: "'a::{linordered_field, linorder_topology}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (at_left x) = (\<exists>b<x. \<forall>y>b. y < x \<longrightarrow> P y)
[PROOF STEP]
using linordered_field_no_lb[rule_format, of x]
[PROOF STATE]
proof (prove)
using this:
\<exists>y. y < x

goal (1 subgoal):
 1. eventually P (at_left x) = (\<exists>b<x. \<forall>y>b. y < x \<longrightarrow> P y)
[PROOF STEP]
by (auto simp: eventually_at_left)


[STATEMENT]
theorem Discrete_sqrt_eq_newton_sqrt [code]: "Discrete.sqrt n = newton_sqrt n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Discrete.sqrt n = newton_sqrt n
[PROOF STEP]
unfolding newton_sqrt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Discrete.sqrt n = newton_sqrt_aux n n
[PROOF STEP]
by (simp add: newton_sqrt_aux_correct Discrete.sqrt_le)


[STATEMENT]
lemma list_slice2_nth_nth_eq1: "
  \<lbrakk> m < length xs div k; n < k \<rbrakk> \<Longrightarrow>
  (list_slice2 xs k) ! m ! n = xs ! (m * k + n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m < length xs div k; n < k\<rbrakk> \<Longrightarrow> list_slice2 xs k ! m ! n = xs ! (m * k + n)
[PROOF STEP]
by (simp add: list_slice2_list_slice_nth list_slice_nth_nth)


[STATEMENT]
lemma mtf2_forward_effect1':
  "q \<in> set xs \<Longrightarrow> distinct xs \<Longrightarrow> index xs q < index xs x \<and> index xs x < length xs
      \<Longrightarrow> index (mtf2 n q xs) x = index xs x \<and> index xs q < index (mtf2 n q xs) x \<and> index (mtf2 n q xs) x < length xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>q \<in> set xs; distinct xs; index xs q < index xs x \<and> index xs x < length xs\<rbrakk> \<Longrightarrow> index (mtf2 n q xs) x = index xs x \<and> index xs q < index (mtf2 n q xs) x \<and> index (mtf2 n q xs) x < length xs
[PROOF STEP]
using mtf2_forward_effect1[where xs=xs and i="index xs x"] yes
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?q \<in> set xs; distinct xs; index xs ?q < index xs x \<and> index xs x < length xs\<rbrakk> \<Longrightarrow> index (mtf2 ?n ?q xs) (xs ! index xs x) = index xs (xs ! index xs x) \<and> index xs ?q < index (mtf2 ?n ?q xs) (xs ! index xs x) \<and> index (mtf2 ?n ?q xs) (xs ! index xs x) < length xs
index ?xs ?x < length ?xs \<Longrightarrow> ?xs ! index ?xs ?x = ?x

goal (1 subgoal):
 1. \<lbrakk>q \<in> set xs; distinct xs; index xs q < index xs x \<and> index xs x < length xs\<rbrakk> \<Longrightarrow> index (mtf2 n q xs) x = index xs x \<and> index xs q < index (mtf2 n q xs) x \<and> index (mtf2 n q xs) x < length xs
[PROOF STEP]
by(auto)


[STATEMENT]
lemma is_prefix_append: "is_prefix (a@b) D = (is_prefix a D \<and> is_prefix b (drop (length a) D))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_prefix (a @ b) D = (is_prefix a D \<and> is_prefix b (drop (length a) D))
[PROOF STEP]
by (metis append_assoc is_prefix_cancel is_prefix_def is_prefix_unsplit)


[STATEMENT]
lemma matching_i_edges_as_sets:
  "edge_as_set ` matching_i i V E M L =
  { e1. \<exists> (u, v) \<in> matching_i i V E M L. edge_as_set (u, v) = e1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. edge_as_set ` matching_i i V E M L = {e1. \<exists>(u, v)\<in>matching_i i V E M L. edge_as_set (u, v) = e1}
[PROOF STEP]
by auto


[STATEMENT]
lemma bij_to_nat: "bij_betw to_nat (UNIV :: 'a :: finite set) {0 ..< CARD('a)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw to_nat UNIV {0..<CARD('a)}
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj to_nat \<and> range to_nat = {0..<CARD('a)}
[PROOF STEP]
by (auto simp: range_to_nat inj_to_nat)


[STATEMENT]
lemma times_p_pow_val:
  assumes "a \<in> carrier Q\<^sub>p"
  assumes "b = \<pp>[^]n \<otimes> a"
  shows "val b = val a + n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val b = val a + eint n
[PROOF STEP]
using  val_mult[of "\<pp>[^]n" a] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<pp> [^] n \<in> carrier Q\<^sub>p; a \<in> carrier Q\<^sub>p\<rbrakk> \<Longrightarrow> val (\<pp> [^] n \<otimes> a) = val (\<pp> [^] n) + val a
a \<in> carrier Q\<^sub>p
b = \<pp> [^] n \<otimes> a

goal (1 subgoal):
 1. val b = val a + eint n
[PROOF STEP]
unfolding assms(2) val_p_int_pow
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<pp> [^] n \<in> carrier Q\<^sub>p; a \<in> carrier Q\<^sub>p\<rbrakk> \<Longrightarrow> val (\<pp> [^] n \<otimes> a) = eint n + val a
a \<in> carrier Q\<^sub>p
\<pp> [^] n \<otimes> a = \<pp> [^] n \<otimes> a

goal (1 subgoal):
 1. val (\<pp> [^] n \<otimes> a) = val a + eint n
[PROOF STEP]
by (metis add.commute p_intpow_closed(1))


[STATEMENT]
lemma fst_snd_snd_echelon_form_of_column_k_det:
  assumes "k < ncols A"
  and "i \<le> nrows A"
  shows "snd (snd ((echelon_form_of_column_k_det bezout) (n,A,i) k))
  = fst (snd (snd (echelon_form_of_column_k_det_iarrays (n,matrix_to_iarray A, i, bezout) k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (snd (echelon_form_of_column_k_det bezout (n, A, i) k)) = fst (snd (snd (echelon_form_of_column_k_det_iarrays (n, matrix_to_iarray A, i, bezout) k)))
[PROOF STEP]
unfolding snd_echelon_form_of_column_k_det_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (echelon_form_of_column_k bezout (A, i) k) = fst (snd (snd (echelon_form_of_column_k_det_iarrays (n, matrix_to_iarray A, i, bezout) k)))
[PROOF STEP]
unfolding snd_echelon_form_of_column_k_det
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (echelon_form_of_column_k bezout (A, i) k) = fst (snd (echelon_form_of_column_k_iarrays (matrix_to_iarray A, i, bezout) k))
[PROOF STEP]
by (rule fst_snd_matrix_to_iarray_echelon_form_of_column_k[OF assms])


[STATEMENT]
lemma real_sqrt_divide: "sqrt (x / y) = sqrt x / sqrt y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (x / y) = sqrt x / sqrt y
[PROOF STEP]
unfolding sqrt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root 2 (x / y) = root 2 x / root 2 y
[PROOF STEP]
by (rule real_root_divide)


[STATEMENT]
lemma "((0::real) < x - y) = (y < x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < x - y) = (y < x)
[PROOF STEP]
by arith


[STATEMENT]
lemma mat_det_similarity [simp]:
  assumes "mat_det A \<noteq> 0"
  shows "mat_det (similarity A M) = mat_det M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_det (similarity A M) = mat_det M
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
mat_det A \<noteq> 0

goal (1 subgoal):
 1. mat_det (similarity A M) = mat_det M
[PROOF STEP]
unfolding similarity_def
[PROOF STATE]
proof (prove)
using this:
mat_det A \<noteq> 0

goal (1 subgoal):
 1. mat_det (mat_inv A *\<^sub>m\<^sub>m M *\<^sub>m\<^sub>m A) = mat_det M
[PROOF STEP]
by (simp add: mat_det_inv)


[STATEMENT]
lemma exp_of_real_inv:
  fixes x:: real
  shows "exp (-(\<i> * x)) = cos x - \<i> * (sin x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (- (\<i> * complex_of_real x)) = complex_of_real (cos x) - \<i> * complex_of_real (sin x)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Re (exp (- (\<i> * complex_of_real x))) = Re (complex_of_real (cos x) - \<i> * complex_of_real (sin x))
 2. Im (exp (- (\<i> * complex_of_real x))) = Im (complex_of_real (cos x) - \<i> * complex_of_real (sin x))
[PROOF STEP]
show "Re (exp (-(\<i> * x))) = Re ((cos x) - \<i> * (sin x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (exp (- (\<i> * complex_of_real x))) = Re (complex_of_real (cos x) - \<i> * complex_of_real (sin x))
[PROOF STEP]
using Re_exp
[PROOF STATE]
proof (prove)
using this:
Re (exp ?z) = exp (Re ?z) * cos (Im ?z)

goal (1 subgoal):
 1. Re (exp (- (\<i> * complex_of_real x))) = Re (complex_of_real (cos x) - \<i> * complex_of_real (sin x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Re (exp (- (\<i> * complex_of_real x))) = Re (complex_of_real (cos x) - \<i> * complex_of_real (sin x))

goal (1 subgoal):
 1. Im (exp (- (\<i> * complex_of_real x))) = Im (complex_of_real (cos x) - \<i> * complex_of_real (sin x))
[PROOF STEP]
show "Im (exp (-(\<i> * x))) = Im ((cos x) - \<i> * (sin x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (exp (- (\<i> * complex_of_real x))) = Im (complex_of_real (cos x) - \<i> * complex_of_real (sin x))
[PROOF STEP]
using Im_exp
[PROOF STATE]
proof (prove)
using this:
Im (exp ?z) = exp (Re ?z) * sin (Im ?z)

goal (1 subgoal):
 1. Im (exp (- (\<i> * complex_of_real x))) = Im (complex_of_real (cos x) - \<i> * complex_of_real (sin x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Im (exp (- (\<i> * complex_of_real x))) = Im (complex_of_real (cos x) - \<i> * complex_of_real (sin x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sq_norm_vec_as_cscalar_prod:
  fixes v :: "'a :: conjugatable_ring vec"
  shows "\<parallel>v\<parallel>\<^sup>2 = v \<bullet>c v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>v\<parallel>\<^sup>2 = v \<bullet>c v
[PROOF STEP]
by (induct v, simp_all add: sq_norm_vec_def)


[STATEMENT]
lemma islimpt_approachable_real:
  fixes s :: "real set"
  shows "x islimpt s \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in> s. x' \<noteq> x \<and> \<bar>x' - x\<bar> < e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x islimpt s = (\<forall>e>0. \<exists>x'\<in>s. x' \<noteq> x \<and> \<bar>x' - x\<bar> < e)
[PROOF STEP]
unfolding islimpt_approachable dist_norm
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>e>0. \<exists>x'\<in>s. x' \<noteq> x \<and> norm (x' - x) < e) = (\<forall>e>0. \<exists>x'\<in>s. x' \<noteq> x \<and> \<bar>x' - x\<bar> < e)
[PROOF STEP]
by simp


[STATEMENT]
lemma mem_cball_0 [simp]: "x \<in> cball 0 e \<longleftrightarrow> norm x \<le> e"
  for x :: "'a::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> cball (0::'a) e) = (norm x \<le> e)
[PROOF STEP]
by simp


[STATEMENT]
lemma order_trans: "\<lbrakk> order r; x \<sqsubseteq>\<^sub>r y; y \<sqsubseteq>\<^sub>r z \<rbrakk> \<Longrightarrow> x \<sqsubseteq>\<^sub>r z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>order r; x \<sqsubseteq>\<^bsub>r\<^esub> y; y \<sqsubseteq>\<^bsub>r\<^esub> z\<rbrakk> \<Longrightarrow> x \<sqsubseteq>\<^bsub>r\<^esub> z
[PROOF STEP]
by (unfold order_def) blast


[STATEMENT]
lemma qbs_uniform_distribution_expectation:
  assumes "f \<in> \<real>\<^sub>Q \<rightarrow>\<^sub>Q \<real>\<^sub>Q\<^sub>\<ge>\<^sub>0"
  shows "(\<integral>\<^sup>+\<^sub>Q x. f x \<partial>ab_qbs_uniform_distribution) = (\<integral>\<^sup>+x \<in> {a<..<b}. f x \<partial>lborel) / (b - a)"
        (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. qbs_prob_ennintegral local.ab_qbs_uniform_distribution f = set_nn_integral lborel {a<..<b} f / ennreal (b - a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. qbs_prob_ennintegral local.ab_qbs_uniform_distribution f = set_nn_integral lborel {a<..<b} f / ennreal (b - a)
[PROOF STEP]
have "?lhs = (\<integral>\<^sup>+x. f x \<partial>(interval_uniform_distribution a b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. qbs_prob_ennintegral local.ab_qbs_uniform_distribution f = integral\<^sup>N (interval_uniform_distribution a b) f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> \<real>\<^sub>Q \<rightarrow>\<^sub>Q \<real>\<^sub>Q\<^sub>\<ge>\<^sub>0

goal (1 subgoal):
 1. qbs_prob_ennintegral local.ab_qbs_uniform_distribution f = integral\<^sup>N (interval_uniform_distribution a b) f
[PROOF STEP]
by(auto simp: qbs_interval_uniform_distribution_def2 intro!:ab_u_dist.ennintegral_as_qbs_ennintegral dest:ab_u_dist.qbs_morphism_dest[simplified measure_to_qbs_cong_sets[OF sets_interval_uniform_distribution]])
[PROOF STATE]
proof (state)
this:
qbs_prob_ennintegral local.ab_qbs_uniform_distribution f = integral\<^sup>N (interval_uniform_distribution a b) f

goal (1 subgoal):
 1. qbs_prob_ennintegral local.ab_qbs_uniform_distribution f = set_nn_integral lborel {a<..<b} f / ennreal (b - a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
qbs_prob_ennintegral local.ab_qbs_uniform_distribution f = integral\<^sup>N (interval_uniform_distribution a b) f

goal (1 subgoal):
 1. qbs_prob_ennintegral local.ab_qbs_uniform_distribution f = set_nn_integral lborel {a<..<b} f / ennreal (b - a)
[PROOF STEP]
have "... = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (interval_uniform_distribution a b) f = set_nn_integral lborel {a<..<b} f / ennreal (b - a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> \<real>\<^sub>Q \<rightarrow>\<^sub>Q \<real>\<^sub>Q\<^sub>\<ge>\<^sub>0

goal (1 subgoal):
 1. integral\<^sup>N (interval_uniform_distribution a b) f = set_nn_integral lborel {a<..<b} f / ennreal (b - a)
[PROOF STEP]
by(auto simp: interval_uniform_distribution_def a_less_than_b intro!:nn_integral_uniform_measure[where M=lborel and S="{a<..<b}",simplified emeasure_lborel_Ioo[OF order.strict_implies_order[OF a_less_than_b]]])
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (interval_uniform_distribution a b) f = set_nn_integral lborel {a<..<b} f / ennreal (b - a)

goal (1 subgoal):
 1. qbs_prob_ennintegral local.ab_qbs_uniform_distribution f = set_nn_integral lborel {a<..<b} f / ennreal (b - a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
qbs_prob_ennintegral local.ab_qbs_uniform_distribution f = set_nn_integral lborel {a<..<b} f / ennreal (b - a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
qbs_prob_ennintegral local.ab_qbs_uniform_distribution f = set_nn_integral lborel {a<..<b} f / ennreal (b - a)

goal (1 subgoal):
 1. qbs_prob_ennintegral local.ab_qbs_uniform_distribution f = set_nn_integral lborel {a<..<b} f / ennreal (b - a)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
qbs_prob_ennintegral local.ab_qbs_uniform_distribution f = set_nn_integral lborel {a<..<b} f / ennreal (b - a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_adjoint_hermitian:
  fixes A::"'a::conjugatable_field Matrix.mat"
  assumes "A\<in> carrier_mat n m"
  shows "hermitian ((Complex_Matrix.adjoint A) * A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hermitian (Complex_Matrix.adjoint A * A)
[PROOF STEP]
unfolding hermitian_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.adjoint (Complex_Matrix.adjoint A * A) = Complex_Matrix.adjoint A * A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Complex_Matrix.adjoint (Complex_Matrix.adjoint A * A) = Complex_Matrix.adjoint A * A
[PROOF STEP]
define C where "C = (Complex_Matrix.adjoint A) * A"
[PROOF STATE]
proof (state)
this:
C = Complex_Matrix.adjoint A * A

goal (1 subgoal):
 1. Complex_Matrix.adjoint (Complex_Matrix.adjoint A * A) = Complex_Matrix.adjoint A * A
[PROOF STEP]
have "Complex_Matrix.adjoint C =
    Complex_Matrix.adjoint A * Complex_Matrix.adjoint (Complex_Matrix.adjoint A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.adjoint C = Complex_Matrix.adjoint A * Complex_Matrix.adjoint (Complex_Matrix.adjoint A)
[PROOF STEP]
using adjoint_mult assms C_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> carrier_mat ?n ?m; ?B \<in> carrier_mat ?m ?l\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (?A * ?B) = Complex_Matrix.adjoint ?B * Complex_Matrix.adjoint ?A
A \<in> carrier_mat n m
C = Complex_Matrix.adjoint A * A

goal (1 subgoal):
 1. Complex_Matrix.adjoint C = Complex_Matrix.adjoint A * Complex_Matrix.adjoint (Complex_Matrix.adjoint A)
[PROOF STEP]
by (metis adjoint_dim' assms)
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint C = Complex_Matrix.adjoint A * Complex_Matrix.adjoint (Complex_Matrix.adjoint A)

goal (1 subgoal):
 1. Complex_Matrix.adjoint (Complex_Matrix.adjoint A * A) = Complex_Matrix.adjoint A * A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint C = Complex_Matrix.adjoint A * Complex_Matrix.adjoint (Complex_Matrix.adjoint A)

goal (1 subgoal):
 1. Complex_Matrix.adjoint (Complex_Matrix.adjoint A * A) = Complex_Matrix.adjoint A * A
[PROOF STEP]
have "... = Complex_Matrix.adjoint A * A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.adjoint A * Complex_Matrix.adjoint (Complex_Matrix.adjoint A) = Complex_Matrix.adjoint A * A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n m

goal (1 subgoal):
 1. Complex_Matrix.adjoint A * Complex_Matrix.adjoint (Complex_Matrix.adjoint A) = Complex_Matrix.adjoint A * A
[PROOF STEP]
by (simp add: Complex_Matrix.adjoint_adjoint)
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint A * Complex_Matrix.adjoint (Complex_Matrix.adjoint A) = Complex_Matrix.adjoint A * A

goal (1 subgoal):
 1. Complex_Matrix.adjoint (Complex_Matrix.adjoint A * A) = Complex_Matrix.adjoint A * A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Complex_Matrix.adjoint C = Complex_Matrix.adjoint A * A
[PROOF STEP]
show "Complex_Matrix.adjoint C = C"
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.adjoint C = Complex_Matrix.adjoint A * A

goal (1 subgoal):
 1. Complex_Matrix.adjoint C = C
[PROOF STEP]
using C_def
[PROOF STATE]
proof (prove)
using this:
Complex_Matrix.adjoint C = Complex_Matrix.adjoint A * A
C = Complex_Matrix.adjoint A * A

goal (1 subgoal):
 1. Complex_Matrix.adjoint C = C
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint C = C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma matrix_to_iarray_Gram_Schmidt_matrix_efficient[code_unfold]:
  fixes A::"real^'n::{mod_type}^'m::{mod_type}"
  shows "matrix_to_iarray (Gram_Schmidt_matrix A)
  = Gram_Schmidt_matrix_iarrays_efficient (matrix_to_iarray A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_matrix A) = Gram_Schmidt_matrix_iarrays_efficient (matrix_to_iarray A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_matrix A) = Gram_Schmidt_matrix_iarrays_efficient (matrix_to_iarray A)
[PROOF STEP]
have n: "ncols A - 1 < ncols A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ncols A - 1 < ncols A
[PROOF STEP]
unfolding ncols_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('n) - 1 < CARD('n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ncols A - 1 < ncols A

goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_matrix A) = Gram_Schmidt_matrix_iarrays_efficient (matrix_to_iarray A)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
ncols A - 1 < ncols A

goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_matrix A) = Gram_Schmidt_matrix_iarrays_efficient (matrix_to_iarray A)
[PROOF STEP]
unfolding Gram_Schmidt_matrix_iarrays_efficient_def Gram_Schmidt_matrix_def
[PROOF STATE]
proof (prove)
using this:
ncols A - 1 < ncols A

goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_upt_k A (ncols A - 1)) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<ncols_iarray (matrix_to_iarray A)]
[PROOF STEP]
using matrix_to_iarray_Gram_Schmidt_upt_k_efficient[OF n]
[PROOF STATE]
proof (prove)
using this:
ncols A - 1 < ncols A
matrix_to_iarray (Gram_Schmidt_upt_k A (ncols A - 1)) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc (ncols A - 1)]

goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_upt_k A (ncols A - 1)) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<ncols_iarray (matrix_to_iarray A)]
[PROOF STEP]
unfolding matrix_to_iarray_ncols
[PROOF STATE]
proof (prove)
using this:
ncols_iarray (matrix_to_iarray A) - 1 < ncols_iarray (matrix_to_iarray A)
matrix_to_iarray (Gram_Schmidt_upt_k A (ncols_iarray (matrix_to_iarray A) - 1)) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<Suc (ncols_iarray (matrix_to_iarray A) - 1)]

goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_upt_k A (ncols_iarray (matrix_to_iarray A) - 1)) = foldl Gram_Schmidt_column_k_iarrays_efficient (matrix_to_iarray A) [0..<ncols_iarray (matrix_to_iarray A)]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_to_iarray (Gram_Schmidt_matrix A) = Gram_Schmidt_matrix_iarrays_efficient (matrix_to_iarray A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fps_right_inverse:
  fixes   f :: "'a::ring_1 fps"
  assumes f0: "f$0 * y = 1"
  shows   "f * fps_right_inverse f y = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f * fps_right_inverse f y = 1
[PROOF STEP]
proof (rule fps_ext)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (f * fps_right_inverse f y) $ n = 1 $ n
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (f * fps_right_inverse f y) $ n = 1 $ n
[PROOF STEP]
show "(f * fps_right_inverse f y) $ n = 1 $ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f * fps_right_inverse f y) $ n = 1 $ n
[PROOF STEP]
proof (cases n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (f * fps_right_inverse f y) $ n = 1 $ n
 2. \<And>nat. n = Suc nat \<Longrightarrow> (f * fps_right_inverse f y) $ n = 1 $ n
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
n = Suc k

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (f * fps_right_inverse f y) $ n = 1 $ n
 2. \<And>nat. n = Suc nat \<Longrightarrow> (f * fps_right_inverse f y) $ n = 1 $ n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
n = Suc k

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (f * fps_right_inverse f y) $ n = 1 $ n
 2. \<And>nat. n = Suc nat \<Longrightarrow> (f * fps_right_inverse f y) $ n = 1 $ n
[PROOF STEP]
from Suc
[PROOF STATE]
proof (chain)
picking this:
n = Suc k
[PROOF STEP]
have "fps_right_inverse f y $ n =
            - y * sum (\<lambda>i. f$i * fps_right_inverse_constructor f y (n - i)) {1..n}"
[PROOF STATE]
proof (prove)
using this:
n = Suc k

goal (1 subgoal):
 1. fps_right_inverse f y $ n = - y * (\<Sum>i = 1..n. f $ i * fps_right_inverse_constructor f y (n - i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_right_inverse f y $ n = - y * (\<Sum>i = 1..n. f $ i * fps_right_inverse_constructor f y (n - i))

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (f * fps_right_inverse f y) $ n = 1 $ n
 2. \<And>nat. n = Suc nat \<Longrightarrow> (f * fps_right_inverse f y) $ n = 1 $ n
[PROOF STEP]
hence
      "(f * fps_right_inverse f y) $ n =
        - 1 * sum (\<lambda>i. f$i * fps_right_inverse_constructor f y (n - i)) {1..n} +
        sum (\<lambda>i. f$i * (fps_right_inverse_constructor f y (n - i))) {1..n}"
[PROOF STATE]
proof (prove)
using this:
fps_right_inverse f y $ n = - y * (\<Sum>i = 1..n. f $ i * fps_right_inverse_constructor f y (n - i))

goal (1 subgoal):
 1. (f * fps_right_inverse f y) $ n = - (1::'a) * (\<Sum>i = 1..n. f $ i * fps_right_inverse_constructor f y (n - i)) + (\<Sum>i = 1..n. f $ i * fps_right_inverse_constructor f y (n - i))
[PROOF STEP]
by (simp add: fps_mult_nth sum.atLeast_Suc_atMost mult.assoc f0[symmetric])
[PROOF STATE]
proof (state)
this:
(f * fps_right_inverse f y) $ n = - (1::'a) * (\<Sum>i = 1..n. f $ i * fps_right_inverse_constructor f y (n - i)) + (\<Sum>i = 1..n. f $ i * fps_right_inverse_constructor f y (n - i))

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> (f * fps_right_inverse f y) $ n = 1 $ n
 2. \<And>nat. n = Suc nat \<Longrightarrow> (f * fps_right_inverse f y) $ n = 1 $ n
[PROOF STEP]
thus "(f * fps_right_inverse f y) $ n = 1 $ n"
[PROOF STATE]
proof (prove)
using this:
(f * fps_right_inverse f y) $ n = - (1::'a) * (\<Sum>i = 1..n. f $ i * fps_right_inverse_constructor f y (n - i)) + (\<Sum>i = 1..n. f $ i * fps_right_inverse_constructor f y (n - i))

goal (1 subgoal):
 1. (f * fps_right_inverse f y) $ n = 1 $ n
[PROOF STEP]
by (simp add: Suc)
[PROOF STATE]
proof (state)
this:
(f * fps_right_inverse f y) $ n = 1 $ n

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> (f * fps_right_inverse f y) $ n = 1 $ n
[PROOF STEP]
qed (simp add: f0 fps_inverse_def)
[PROOF STATE]
proof (state)
this:
(f * fps_right_inverse f y) $ n = 1 $ n

goal:
No subgoals!
[PROOF STEP]
qed

\<comment> \<open>
  It is possible in a ring for an element to have a left inverse but not a right inverse, or
  vice versa. But when an element has both, they must be the same.
\<close>


[STATEMENT]
lemma power_half_series: "(\<lambda>n. (1/2::real)^Suc n) sums 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (1 / 2) ^ Suc n) sums 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. (1 / 2) ^ Suc n) sums 1
[PROOF STEP]
have 2: "(\<lambda>n. (1/2::real)^n) sums 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (^) (1 / 2) sums 2
[PROOF STEP]
using geometric_sums [of "1/2::real"]
[PROOF STATE]
proof (prove)
using this:
norm (1 / 2) < 1 \<Longrightarrow> (^) (1 / 2) sums (1 / (1 - 1 / 2))

goal (1 subgoal):
 1. (^) (1 / 2) sums 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(^) (1 / 2) sums 2

goal (1 subgoal):
 1. (\<lambda>n. (1 / 2) ^ Suc n) sums 1
[PROOF STEP]
have "(\<lambda>n. (1/2::real)^Suc n) = (\<lambda>n. (1 / 2) ^ n / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (1 / 2) ^ Suc n) = (\<lambda>n. (1 / 2) ^ n / 2)
[PROOF STEP]
by (simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (1 / 2) ^ Suc n) = (\<lambda>n. (1 / 2) ^ n / 2)

goal (1 subgoal):
 1. (\<lambda>n. (1 / 2) ^ Suc n) sums 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. (1 / 2) ^ Suc n) = (\<lambda>n. (1 / 2) ^ n / 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. (1 / 2) ^ Suc n) = (\<lambda>n. (1 / 2) ^ n / 2)

goal (1 subgoal):
 1. (\<lambda>n. (1 / 2) ^ Suc n) sums 1
[PROOF STEP]
using sums_divide [OF 2, of 2]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. (1 / 2) ^ Suc n) = (\<lambda>n. (1 / 2) ^ n / 2)
(\<lambda>n. (1 / 2) ^ n / 2) sums (2 / 2)

goal (1 subgoal):
 1. (\<lambda>n. (1 / 2) ^ Suc n) sums 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (1 / 2) ^ Suc n) sums 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arctan_approx_def': "arctan_approx n (1/x) =
  (\<Sum>k<n. inverse (real (2 * k + 1) * (- x\<^sup>2) ^ k)) / x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan_approx n (1 / x) = (\<Sum>k<n. inverse (real (2 * k + 1) * (- x\<^sup>2) ^ k)) / x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. arctan_approx n (1 / x) = (\<Sum>k<n. inverse (real (2 * k + 1) * (- x\<^sup>2) ^ k)) / x
[PROOF STEP]
have "(-1)^k / b = 1 / ((-1)^k * b)" for k :: nat and b :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 1) ^ k / b = 1 / ((- 1) ^ k * b)
[PROOF STEP]
by (cases "even k") auto
[PROOF STATE]
proof (state)
this:
(- 1) ^ ?k / ?b = 1 / ((- 1) ^ ?k * ?b)

goal (1 subgoal):
 1. arctan_approx n (1 / x) = (\<Sum>k<n. inverse (real (2 * k + 1) * (- x\<^sup>2) ^ k)) / x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(- 1) ^ ?k / ?b = 1 / ((- 1) ^ ?k * ?b)

goal (1 subgoal):
 1. arctan_approx n (1 / x) = (\<Sum>k<n. inverse (real (2 * k + 1) * (- x\<^sup>2) ^ k)) / x
[PROOF STEP]
by (simp add: arctan_approx_def  field_simps power_minus')
[PROOF STATE]
proof (state)
this:
arctan_approx n (1 / x) = (\<Sum>k<n. inverse (real (2 * k + 1) * (- x\<^sup>2) ^ k)) / x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infpath_length:
  assumes "wf_infpath f"
  shows "length (f n) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (f n) = n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wf_infpath f

goal (1 subgoal):
 1. length (f n) = n
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. wf_infpath f \<Longrightarrow> length (f 0) = 0
 2. \<And>n. \<lbrakk>wf_infpath f \<Longrightarrow> length (f n) = n; wf_infpath f\<rbrakk> \<Longrightarrow> length (f (Suc n)) = Suc n
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
wf_infpath f

goal (2 subgoals):
 1. wf_infpath f \<Longrightarrow> length (f 0) = 0
 2. \<And>n. \<lbrakk>wf_infpath f \<Longrightarrow> length (f n) = n; wf_infpath f\<rbrakk> \<Longrightarrow> length (f (Suc n)) = Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
wf_infpath f
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
wf_infpath f

goal (1 subgoal):
 1. length (f 0) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (f 0) = 0

goal (1 subgoal):
 1. \<And>n. \<lbrakk>wf_infpath f \<Longrightarrow> length (f n) = n; wf_infpath f\<rbrakk> \<Longrightarrow> length (f (Suc n)) = Suc n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>wf_infpath f \<Longrightarrow> length (f n) = n; wf_infpath f\<rbrakk> \<Longrightarrow> length (f (Suc n)) = Suc n
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
wf_infpath f \<Longrightarrow> length (f n) = n
wf_infpath f

goal (1 subgoal):
 1. \<And>n. \<lbrakk>wf_infpath f \<Longrightarrow> length (f n) = n; wf_infpath f\<rbrakk> \<Longrightarrow> length (f (Suc n)) = Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
wf_infpath f \<Longrightarrow> length (f n) = n
wf_infpath f
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
wf_infpath f \<Longrightarrow> length (f n) = n
wf_infpath f

goal (1 subgoal):
 1. length (f (Suc n)) = Suc n
[PROOF STEP]
by (metis length_append_singleton)
[PROOF STATE]
proof (state)
this:
length (f (Suc n)) = Suc n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma foldl_snd_zip:
  "length xs \<ge> length ys \<Longrightarrow> foldl (\<lambda>b (x, y). f b y) b (zip xs ys) = foldl f b ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length ys \<le> length xs \<Longrightarrow> foldl (\<lambda>b (x, y). f b y) b (zip xs ys) = foldl f b ys
[PROOF STEP]
proof(induct ys arbitrary: xs b)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs b. length [] \<le> length xs \<Longrightarrow> foldl (\<lambda>b (x, y). f b y) b (zip xs []) = foldl f b []
 2. \<And>a ys xs b. \<lbrakk>\<And>xs b. length ys \<le> length xs \<Longrightarrow> foldl (\<lambda>b (x, y). f b y) b (zip xs ys) = foldl f b ys; length (a # ys) \<le> length xs\<rbrakk> \<Longrightarrow> foldl (\<lambda>b (x, y). f b y) b (zip xs (a # ys)) = foldl f b (a # ys)
[PROOF STEP]
case (Cons y ys)
[PROOF STATE]
proof (state)
this:
length ys \<le> length ?xs \<Longrightarrow> foldl (\<lambda>b a. case a of (x, a) \<Rightarrow> f b a) ?b (zip ?xs ys) = foldl f ?b ys
length (y # ys) \<le> length xs

goal (2 subgoals):
 1. \<And>xs b. length [] \<le> length xs \<Longrightarrow> foldl (\<lambda>b (x, y). f b y) b (zip xs []) = foldl f b []
 2. \<And>a ys xs b. \<lbrakk>\<And>xs b. length ys \<le> length xs \<Longrightarrow> foldl (\<lambda>b (x, y). f b y) b (zip xs ys) = foldl f b ys; length (a # ys) \<le> length xs\<rbrakk> \<Longrightarrow> foldl (\<lambda>b (x, y). f b y) b (zip xs (a # ys)) = foldl f b (a # ys)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
length ys \<le> length ?xs \<Longrightarrow> foldl (\<lambda>b a. case a of (x, a) \<Rightarrow> f b a) ?b (zip ?xs ys) = foldl f ?b ys
length (y # ys) \<le> length xs

goal (1 subgoal):
 1. foldl (\<lambda>b a. case a of (x, a) \<Rightarrow> f b a) b (zip xs (y # ys)) = foldl f b (y # ys)
[PROOF STEP]
by(cases xs) simp_all
[PROOF STATE]
proof (state)
this:
foldl (\<lambda>b a. case a of (x, a) \<Rightarrow> f b a) b (zip xs (y # ys)) = foldl f b (y # ys)

goal (1 subgoal):
 1. \<And>xs b. length [] \<le> length xs \<Longrightarrow> foldl (\<lambda>b (x, y). f b y) b (zip xs []) = foldl f b []
[PROOF STEP]
qed simp


[STATEMENT]
lemma cmod_add_real_less:
  assumes "Im z \<noteq> 0" "r\<noteq>0"
    shows "cmod (z + r) < cmod z + \<bar>r\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (z + complex_of_real r) < cmod z + \<bar>r\<bar>
[PROOF STEP]
proof (cases z)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x1 x2. z = Complex x1 x2 \<Longrightarrow> cmod (z + complex_of_real r) < cmod z + \<bar>r\<bar>
[PROOF STEP]
case (Complex x y)
[PROOF STATE]
proof (state)
this:
z = Complex x y

goal (1 subgoal):
 1. \<And>x1 x2. z = Complex x1 x2 \<Longrightarrow> cmod (z + complex_of_real r) < cmod z + \<bar>r\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z = Complex x y
[PROOF STEP]
have "0 < y * y"
[PROOF STATE]
proof (prove)
using this:
z = Complex x y

goal (1 subgoal):
 1. 0 < y * y
[PROOF STEP]
using assms mult_neg_neg
[PROOF STATE]
proof (prove)
using this:
z = Complex x y
Im z \<noteq> 0
r \<noteq> 0
\<lbrakk>?a < (0::?'a); ?b < (0::?'a)\<rbrakk> \<Longrightarrow> (0::?'a) < ?a * ?b

goal (1 subgoal):
 1. 0 < y * y
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
0 < y * y

goal (1 subgoal):
 1. \<And>x1 x2. z = Complex x1 x2 \<Longrightarrow> cmod (z + complex_of_real r) < cmod z + \<bar>r\<bar>
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
Im z \<noteq> 0
r \<noteq> 0
0 < y * y
[PROOF STEP]
have "r * x / \<bar>r\<bar> < sqrt (x*x + y*y)"
[PROOF STATE]
proof (prove)
using this:
Im z \<noteq> 0
r \<noteq> 0
0 < y * y

goal (1 subgoal):
 1. r * x / \<bar>r\<bar> < sqrt (x * x + y * y)
[PROOF STEP]
by (simp add: real_less_rsqrt power2_eq_square)
[PROOF STATE]
proof (state)
this:
r * x / \<bar>r\<bar> < sqrt (x * x + y * y)

goal (1 subgoal):
 1. \<And>x1 x2. z = Complex x1 x2 \<Longrightarrow> cmod (z + complex_of_real r) < cmod z + \<bar>r\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r * x / \<bar>r\<bar> < sqrt (x * x + y * y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
r * x / \<bar>r\<bar> < sqrt (x * x + y * y)

goal (1 subgoal):
 1. cmod (z + complex_of_real r) < cmod z + \<bar>r\<bar>
[PROOF STEP]
using assms Complex
[PROOF STATE]
proof (prove)
using this:
r * x / \<bar>r\<bar> < sqrt (x * x + y * y)
Im z \<noteq> 0
r \<noteq> 0
z = Complex x y

goal (1 subgoal):
 1. cmod (z + complex_of_real r) < cmod z + \<bar>r\<bar>
[PROOF STEP]
apply (simp add: cmod_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r * x / \<bar>r\<bar> < sqrt (x * x + y * y); y \<noteq> 0; r \<noteq> 0; z = Complex x y\<rbrakk> \<Longrightarrow> sqrt ((x + r)\<^sup>2 + y\<^sup>2) < sqrt (x\<^sup>2 + y\<^sup>2) + \<bar>r\<bar>
[PROOF STEP]
apply (rule power2_less_imp_less, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r * x / \<bar>r\<bar> < sqrt (x * x + y * y); y \<noteq> 0; r \<noteq> 0; z = Complex x y\<rbrakk> \<Longrightarrow> (x + r)\<^sup>2 + y\<^sup>2 < (sqrt (x\<^sup>2 + y\<^sup>2) + \<bar>r\<bar>)\<^sup>2
[PROOF STEP]
apply (simp add: power2_eq_square field_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
cmod (z + complex_of_real r) < cmod z + \<bar>r\<bar>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cot_less_zero:
  assumes lb: "- pi/2 < x" and "x < 0"
  shows "cot x < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cot x < 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cot x < 0
[PROOF STEP]
have "0 < cot (- x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < cot (- x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
- pi / 2 < x
x < 0

goal (1 subgoal):
 1. 0 < cot (- x)
[PROOF STEP]
by (simp only: cot_gt_zero)
[PROOF STATE]
proof (state)
this:
0 < cot (- x)

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

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma summable_on_cong_neutral:
  fixes f g :: \<open>'a \<Rightarrow> 'b::{comm_monoid_add, topological_space}\<close>
  assumes \<open>\<And>x. x\<in>T-S \<Longrightarrow> g x = 0\<close>
  assumes \<open>\<And>x. x\<in>S-T \<Longrightarrow> f x = 0\<close>
  assumes \<open>\<And>x. x\<in>S\<inter>T \<Longrightarrow> f x = g x\<close>
  shows "f summable_on S \<longleftrightarrow> g summable_on T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f summable_on S) = (g summable_on T)
[PROOF STEP]
using has_sum_cong_neutral[of T S g f, OF assms]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x. x \<in> T - S \<Longrightarrow> x \<in> T - S; \<And>x. x \<in> S - T \<Longrightarrow> x \<in> S - T; \<And>x. x \<in> S \<inter> T \<Longrightarrow> x \<in> S \<inter> T\<rbrakk> \<Longrightarrow> has_sum f S ?x = has_sum g T ?x

goal (1 subgoal):
 1. (f summable_on S) = (g summable_on T)
[PROOF STEP]
by (simp add: summable_on_def)


[STATEMENT]
lemma pairwise_imp_disjoint_family_on:
  assumes "pairwise R A"
  assumes "\<And>m n. m \<in> A \<Longrightarrow> n \<in> A \<Longrightarrow> R m n \<Longrightarrow> f m \<inter> f n = {}"
  shows   "disjoint_family_on f A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. disjoint_family_on f A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
pairwise R A
\<lbrakk>?m \<in> A; ?n \<in> A; R ?m ?n\<rbrakk> \<Longrightarrow> f ?m \<inter> f ?n = {}

goal (1 subgoal):
 1. disjoint_family_on f A
[PROOF STEP]
unfolding disjoint_family_on_def pairwise_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>A. \<forall>y\<in>A. x \<noteq> y \<longrightarrow> R x y
\<lbrakk>?m \<in> A; ?n \<in> A; R ?m ?n\<rbrakk> \<Longrightarrow> f ?m \<inter> f ?n = {}

goal (1 subgoal):
 1. \<forall>m\<in>A. \<forall>n\<in>A. m \<noteq> n \<longrightarrow> f m \<inter> f n = {}
[PROOF STEP]
by blast


[STATEMENT]
lemma real_interval_avoid_countable_set:
  fixes a b :: real and A :: "real set"
  assumes "a < b" and "countable A"
  shows "\<exists>x\<in>{a<..<b}. x \<notin> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<in>{a<..<b}. x \<notin> A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x\<in>{a<..<b}. x \<notin> A
[PROOF STEP]
from \<open>countable A\<close>
[PROOF STATE]
proof (chain)
picking this:
countable A
[PROOF STEP]
have *: "countable (A \<inter> {a<..<b})"
[PROOF STATE]
proof (prove)
using this:
countable A

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

goal (1 subgoal):
 1. \<exists>x\<in>{a<..<b}. x \<notin> A
[PROOF STEP]
with \<open>a < b\<close>
[PROOF STATE]
proof (chain)
picking this:
a < b
countable (A \<inter> {a<..<b})
[PROOF STEP]
have "\<not> countable {a<..<b}"
[PROOF STATE]
proof (prove)
using this:
a < b
countable (A \<inter> {a<..<b})

goal (1 subgoal):
 1. uncountable {a<..<b}
[PROOF STEP]
by (simp add: uncountable_open_interval)
[PROOF STATE]
proof (state)
this:
uncountable {a<..<b}

goal (1 subgoal):
 1. \<exists>x\<in>{a<..<b}. x \<notin> A
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
countable (A \<inter> {a<..<b})
uncountable {a<..<b}
[PROOF STEP]
have "A \<inter> {a<..<b} \<noteq> {a<..<b}"
[PROOF STATE]
proof (prove)
using this:
countable (A \<inter> {a<..<b})
uncountable {a<..<b}

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

goal (1 subgoal):
 1. \<exists>x\<in>{a<..<b}. x \<notin> A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<inter> {a<..<b} \<noteq> {a<..<b}
[PROOF STEP]
have "A \<inter> {a<..<b} \<subset> {a<..<b}"
[PROOF STATE]
proof (prove)
using this:
A \<inter> {a<..<b} \<noteq> {a<..<b}

goal (1 subgoal):
 1. A \<inter> {a<..<b} \<subset> {a<..<b}
[PROOF STEP]
by (intro psubsetI) auto
[PROOF STATE]
proof (state)
this:
A \<inter> {a<..<b} \<subset> {a<..<b}

goal (1 subgoal):
 1. \<exists>x\<in>{a<..<b}. x \<notin> A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<inter> {a<..<b} \<subset> {a<..<b}
[PROOF STEP]
have "\<exists>x. x \<in> {a<..<b} - A \<inter> {a<..<b}"
[PROOF STATE]
proof (prove)
using this:
A \<inter> {a<..<b} \<subset> {a<..<b}

goal (1 subgoal):
 1. \<exists>x. x \<in> {a<..<b} - A \<inter> {a<..<b}
[PROOF STEP]
by (rule psubset_imp_ex_mem)
[PROOF STATE]
proof (state)
this:
\<exists>x. x \<in> {a<..<b} - A \<inter> {a<..<b}

goal (1 subgoal):
 1. \<exists>x\<in>{a<..<b}. x \<notin> A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>x. x \<in> {a<..<b} - A \<inter> {a<..<b}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>x. x \<in> {a<..<b} - A \<inter> {a<..<b}

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

goal:
No subgoals!
[PROOF STEP]
qed