[STATEMENT]
lemma fmax_decr:
  fixes X :: "nat fset"
  assumes "fBex X (\<lambda>x. x \<ge> k)"
  shows "fMax ((\<lambda>x. x - k) |`| X) = fMax X - k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fMax ((\<lambda>x. x - k) |`| X) = fMax X - k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
fBex X ((\<le>) k)

goal (1 subgoal):
 1. fMax ((\<lambda>x. x - k) |`| X) = fMax X - k
[PROOF STEP]
by transfer (rule max_decr)


[STATEMENT]
lemma mult_eq_0_not_zero_divisor_right[simp]:
  fixes a b :: "'a :: {ab_semigroup_mult,mult_zero}" (* No need for associativity! *)
  assumes "\<not> zero_divisor b"
  shows "a * b = 0 \<longleftrightarrow> a = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a * b = (0::'a)) = (a = (0::'a))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<not> zero_divisor b

goal (1 subgoal):
 1. (a * b = (0::'a)) = (a = (0::'a))
[PROOF STEP]
unfolding zero_divisor_def
[PROOF STATE]
proof (prove)
using this:
\<nexists>ba. ba \<noteq> (0::'a) \<and> b * ba = (0::'a)

goal (1 subgoal):
 1. (a * b = (0::'a)) = (a = (0::'a))
[PROOF STEP]
by (force simp: ac_simps)


[STATEMENT]
lemma uniformly_continuous_on_cmul[continuous_intros]:
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
  assumes "uniformly_continuous_on s f"
  shows "uniformly_continuous_on s (\<lambda>x. c *\<^sub>R f(x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uniformly_continuous_on s (\<lambda>x. c *\<^sub>R f x)
[PROOF STEP]
using bounded_linear_scaleR_right assms
[PROOF STATE]
proof (prove)
using this:
bounded_linear ((*\<^sub>R) ?r)
uniformly_continuous_on s f

goal (1 subgoal):
 1. uniformly_continuous_on s (\<lambda>x. c *\<^sub>R f x)
[PROOF STEP]
by (rule bounded_linear.uniformly_continuous_on)


[STATEMENT]
lemma of_nat_totient_aux1:
  assumes "\<And>p. p \<in> set ps \<Longrightarrow> prime p" "\<And>p. p \<in> set ps \<Longrightarrow> p dvd n" "distinct ps"
  shows   "real (totient_aux1 n ps) = real n * (\<Prod>p\<in>set ps. 1 - 1 / real p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (totient_aux1 n ps) = real n * (\<Prod>p\<in>set ps. 1 - 1 / real p)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?p \<in> set ps \<Longrightarrow> prime ?p
?p \<in> set ps \<Longrightarrow> ?p dvd n
distinct ps

goal (1 subgoal):
 1. real (totient_aux1 n ps) = real n * (\<Prod>p\<in>set ps. 1 - 1 / real p)
[PROOF STEP]
proof (induction ps arbitrary: n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>\<And>p. p \<in> set [] \<Longrightarrow> prime p; \<And>p. p \<in> set [] \<Longrightarrow> p dvd n; distinct []\<rbrakk> \<Longrightarrow> real (totient_aux1 n []) = real n * (\<Prod>p\<in>set []. 1 - 1 / real p)
 2. \<And>a ps n. \<lbrakk>\<And>n. \<lbrakk>\<And>p. p \<in> set ps \<Longrightarrow> prime p; \<And>p. p \<in> set ps \<Longrightarrow> p dvd n; distinct ps\<rbrakk> \<Longrightarrow> real (totient_aux1 n ps) = real n * (\<Prod>p\<in>set ps. 1 - 1 / real p); \<And>p. p \<in> set (a # ps) \<Longrightarrow> prime p; \<And>p. p \<in> set (a # ps) \<Longrightarrow> p dvd n; distinct (a # ps)\<rbrakk> \<Longrightarrow> real (totient_aux1 n (a # ps)) = real n * (\<Prod>p\<in>set (a # ps). 1 - 1 / real p)
[PROOF STEP]
case (Cons p ps n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<And>p. p \<in> set ps \<Longrightarrow> prime p; \<And>p. p \<in> set ps \<Longrightarrow> p dvd ?n; distinct ps\<rbrakk> \<Longrightarrow> real (totient_aux1 ?n ps) = real ?n * (\<Prod>p\<in>set ps. 1 - 1 / real p)
?p \<in> set (p # ps) \<Longrightarrow> prime ?p
?p \<in> set (p # ps) \<Longrightarrow> ?p dvd n
distinct (p # ps)

goal (2 subgoals):
 1. \<And>n. \<lbrakk>\<And>p. p \<in> set [] \<Longrightarrow> prime p; \<And>p. p \<in> set [] \<Longrightarrow> p dvd n; distinct []\<rbrakk> \<Longrightarrow> real (totient_aux1 n []) = real n * (\<Prod>p\<in>set []. 1 - 1 / real p)
 2. \<And>a ps n. \<lbrakk>\<And>n. \<lbrakk>\<And>p. p \<in> set ps \<Longrightarrow> prime p; \<And>p. p \<in> set ps \<Longrightarrow> p dvd n; distinct ps\<rbrakk> \<Longrightarrow> real (totient_aux1 n ps) = real n * (\<Prod>p\<in>set ps. 1 - 1 / real p); \<And>p. p \<in> set (a # ps) \<Longrightarrow> prime p; \<And>p. p \<in> set (a # ps) \<Longrightarrow> p dvd n; distinct (a # ps)\<rbrakk> \<Longrightarrow> real (totient_aux1 n (a # ps)) = real n * (\<Prod>p\<in>set (a # ps). 1 - 1 / real p)
[PROOF STEP]
from Cons.prems
[PROOF STATE]
proof (chain)
picking this:
?p \<in> set (p # ps) \<Longrightarrow> prime ?p
?p \<in> set (p # ps) \<Longrightarrow> ?p dvd n
distinct (p # ps)
[PROOF STEP]
have p: "prime p" "p dvd n"
[PROOF STATE]
proof (prove)
using this:
?p \<in> set (p # ps) \<Longrightarrow> prime ?p
?p \<in> set (p # ps) \<Longrightarrow> ?p dvd n
distinct (p # ps)

goal (1 subgoal):
 1. prime p &&& p dvd n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prime p
p dvd n

goal (2 subgoals):
 1. \<And>n. \<lbrakk>\<And>p. p \<in> set [] \<Longrightarrow> prime p; \<And>p. p \<in> set [] \<Longrightarrow> p dvd n; distinct []\<rbrakk> \<Longrightarrow> real (totient_aux1 n []) = real n * (\<Prod>p\<in>set []. 1 - 1 / real p)
 2. \<And>a ps n. \<lbrakk>\<And>n. \<lbrakk>\<And>p. p \<in> set ps \<Longrightarrow> prime p; \<And>p. p \<in> set ps \<Longrightarrow> p dvd n; distinct ps\<rbrakk> \<Longrightarrow> real (totient_aux1 n ps) = real n * (\<Prod>p\<in>set ps. 1 - 1 / real p); \<And>p. p \<in> set (a # ps) \<Longrightarrow> prime p; \<And>p. p \<in> set (a # ps) \<Longrightarrow> p dvd n; distinct (a # ps)\<rbrakk> \<Longrightarrow> real (totient_aux1 n (a # ps)) = real n * (\<Prod>p\<in>set (a # ps). 1 - 1 / real p)
[PROOF STEP]
have "real (totient_aux1 n (p # ps)) = real (totient_aux1 (n - n div p) ps)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (totient_aux1 n (p # ps)) = real (totient_aux1 (n - n div p) ps)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (totient_aux1 n (p # ps)) = real (totient_aux1 (n - n div p) ps)

goal (2 subgoals):
 1. \<And>n. \<lbrakk>\<And>p. p \<in> set [] \<Longrightarrow> prime p; \<And>p. p \<in> set [] \<Longrightarrow> p dvd n; distinct []\<rbrakk> \<Longrightarrow> real (totient_aux1 n []) = real n * (\<Prod>p\<in>set []. 1 - 1 / real p)
 2. \<And>a ps n. \<lbrakk>\<And>n. \<lbrakk>\<And>p. p \<in> set ps \<Longrightarrow> prime p; \<And>p. p \<in> set ps \<Longrightarrow> p dvd n; distinct ps\<rbrakk> \<Longrightarrow> real (totient_aux1 n ps) = real n * (\<Prod>p\<in>set ps. 1 - 1 / real p); \<And>p. p \<in> set (a # ps) \<Longrightarrow> prime p; \<And>p. p \<in> set (a # ps) \<Longrightarrow> p dvd n; distinct (a # ps)\<rbrakk> \<Longrightarrow> real (totient_aux1 n (a # ps)) = real n * (\<Prod>p\<in>set (a # ps). 1 - 1 / real p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (totient_aux1 n (p # ps)) = real (totient_aux1 (n - n div p) ps)

goal (2 subgoals):
 1. \<And>n. \<lbrakk>\<And>p. p \<in> set [] \<Longrightarrow> prime p; \<And>p. p \<in> set [] \<Longrightarrow> p dvd n; distinct []\<rbrakk> \<Longrightarrow> real (totient_aux1 n []) = real n * (\<Prod>p\<in>set []. 1 - 1 / real p)
 2. \<And>a ps n. \<lbrakk>\<And>n. \<lbrakk>\<And>p. p \<in> set ps \<Longrightarrow> prime p; \<And>p. p \<in> set ps \<Longrightarrow> p dvd n; distinct ps\<rbrakk> \<Longrightarrow> real (totient_aux1 n ps) = real n * (\<Prod>p\<in>set ps. 1 - 1 / real p); \<And>p. p \<in> set (a # ps) \<Longrightarrow> prime p; \<And>p. p \<in> set (a # ps) \<Longrightarrow> p dvd n; distinct (a # ps)\<rbrakk> \<Longrightarrow> real (totient_aux1 n (a # ps)) = real n * (\<Prod>p\<in>set (a # ps). 1 - 1 / real p)
[PROOF STEP]
have "\<dots> = real (n - n div p) * (\<Prod>p\<in>set ps. 1 - 1 / real p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (totient_aux1 (n - n div p) ps) = real (n - n div p) * (\<Prod>p\<in>set ps. 1 - 1 / real p)
[PROOF STEP]
proof (rule Cons.IH)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>p. p \<in> set ps \<Longrightarrow> prime p
 2. \<And>pa. pa \<in> set ps \<Longrightarrow> pa dvd n - n div p
 3. distinct ps
[PROOF STEP]
fix q
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>p. p \<in> set ps \<Longrightarrow> prime p
 2. \<And>pa. pa \<in> set ps \<Longrightarrow> pa dvd n - n div p
 3. distinct ps
[PROOF STEP]
assume q: "q \<in> set ps"
[PROOF STATE]
proof (state)
this:
q \<in> set ps

goal (3 subgoals):
 1. \<And>p. p \<in> set ps \<Longrightarrow> prime p
 2. \<And>pa. pa \<in> set ps \<Longrightarrow> pa dvd n - n div p
 3. distinct ps
[PROOF STEP]
define m where "m = n div p"
[PROOF STATE]
proof (state)
this:
m = n div p

goal (3 subgoals):
 1. \<And>p. p \<in> set ps \<Longrightarrow> prime p
 2. \<And>pa. pa \<in> set ps \<Longrightarrow> pa dvd n - n div p
 3. distinct ps
[PROOF STEP]
from p
[PROOF STATE]
proof (chain)
picking this:
prime p
p dvd n
[PROOF STEP]
have m: "n = p * m"
[PROOF STATE]
proof (prove)
using this:
prime p
p dvd n

goal (1 subgoal):
 1. n = p * m
[PROOF STEP]
by (simp add: m_def)
[PROOF STATE]
proof (state)
this:
n = p * m

goal (3 subgoals):
 1. \<And>p. p \<in> set ps \<Longrightarrow> prime p
 2. \<And>pa. pa \<in> set ps \<Longrightarrow> pa dvd n - n div p
 3. distinct ps
[PROOF STEP]
from Cons.prems q
[PROOF STATE]
proof (chain)
picking this:
?p \<in> set (p # ps) \<Longrightarrow> prime ?p
?p \<in> set (p # ps) \<Longrightarrow> ?p dvd n
distinct (p # ps)
q \<in> set ps
[PROOF STEP]
have "prime q" "q dvd n" "p \<noteq> q"
[PROOF STATE]
proof (prove)
using this:
?p \<in> set (p # ps) \<Longrightarrow> prime ?p
?p \<in> set (p # ps) \<Longrightarrow> ?p dvd n
distinct (p # ps)
q \<in> set ps

goal (1 subgoal):
 1. prime q &&& q dvd n &&& p \<noteq> q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prime q
q dvd n
p \<noteq> q

goal (3 subgoals):
 1. \<And>p. p \<in> set ps \<Longrightarrow> prime p
 2. \<And>pa. pa \<in> set ps \<Longrightarrow> pa dvd n - n div p
 3. distinct ps
[PROOF STEP]
hence "q dvd m"
[PROOF STATE]
proof (prove)
using this:
prime q
q dvd n
p \<noteq> q

goal (1 subgoal):
 1. q dvd m
[PROOF STEP]
using primes_dvd_imp_eq[of q p]  p
[PROOF STATE]
proof (prove)
using this:
prime q
q dvd n
p \<noteq> q
\<lbrakk>prime q; prime p; q dvd p\<rbrakk> \<Longrightarrow> q = p
prime p
p dvd n

goal (1 subgoal):
 1. q dvd m
[PROOF STEP]
by (auto simp add: m prime_dvd_mult_iff)
[PROOF STATE]
proof (state)
this:
q dvd m

goal (3 subgoals):
 1. \<And>p. p \<in> set ps \<Longrightarrow> prime p
 2. \<And>pa. pa \<in> set ps \<Longrightarrow> pa dvd n - n div p
 3. distinct ps
[PROOF STEP]
thus "q dvd n - n div p"
[PROOF STATE]
proof (prove)
using this:
q dvd m

goal (1 subgoal):
 1. q dvd n - n div p
[PROOF STEP]
unfolding m_def
[PROOF STATE]
proof (prove)
using this:
q dvd n div p

goal (1 subgoal):
 1. q dvd n - n div p
[PROOF STEP]
using p \<open>q dvd n\<close>
[PROOF STATE]
proof (prove)
using this:
q dvd n div p
prime p
p dvd n
q dvd n

goal (1 subgoal):
 1. q dvd n - n div p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
q dvd n - n div p

goal (2 subgoals):
 1. \<And>p. p \<in> set ps \<Longrightarrow> prime p
 2. distinct ps
[PROOF STEP]
qed (insert Cons.prems, auto)
[PROOF STATE]
proof (state)
this:
real (totient_aux1 (n - n div p) ps) = real (n - n div p) * (\<Prod>p\<in>set ps. 1 - 1 / real p)

goal (2 subgoals):
 1. \<And>n. \<lbrakk>\<And>p. p \<in> set [] \<Longrightarrow> prime p; \<And>p. p \<in> set [] \<Longrightarrow> p dvd n; distinct []\<rbrakk> \<Longrightarrow> real (totient_aux1 n []) = real n * (\<Prod>p\<in>set []. 1 - 1 / real p)
 2. \<And>a ps n. \<lbrakk>\<And>n. \<lbrakk>\<And>p. p \<in> set ps \<Longrightarrow> prime p; \<And>p. p \<in> set ps \<Longrightarrow> p dvd n; distinct ps\<rbrakk> \<Longrightarrow> real (totient_aux1 n ps) = real n * (\<Prod>p\<in>set ps. 1 - 1 / real p); \<And>p. p \<in> set (a # ps) \<Longrightarrow> prime p; \<And>p. p \<in> set (a # ps) \<Longrightarrow> p dvd n; distinct (a # ps)\<rbrakk> \<Longrightarrow> real (totient_aux1 n (a # ps)) = real n * (\<Prod>p\<in>set (a # ps). 1 - 1 / real p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (totient_aux1 (n - n div p) ps) = real (n - n div p) * (\<Prod>p\<in>set ps. 1 - 1 / real p)

goal (2 subgoals):
 1. \<And>n. \<lbrakk>\<And>p. p \<in> set [] \<Longrightarrow> prime p; \<And>p. p \<in> set [] \<Longrightarrow> p dvd n; distinct []\<rbrakk> \<Longrightarrow> real (totient_aux1 n []) = real n * (\<Prod>p\<in>set []. 1 - 1 / real p)
 2. \<And>a ps n. \<lbrakk>\<And>n. \<lbrakk>\<And>p. p \<in> set ps \<Longrightarrow> prime p; \<And>p. p \<in> set ps \<Longrightarrow> p dvd n; distinct ps\<rbrakk> \<Longrightarrow> real (totient_aux1 n ps) = real n * (\<Prod>p\<in>set ps. 1 - 1 / real p); \<And>p. p \<in> set (a # ps) \<Longrightarrow> prime p; \<And>p. p \<in> set (a # ps) \<Longrightarrow> p dvd n; distinct (a # ps)\<rbrakk> \<Longrightarrow> real (totient_aux1 n (a # ps)) = real n * (\<Prod>p\<in>set (a # ps). 1 - 1 / real p)
[PROOF STEP]
have "real (n - n div p) = real n * (1 - 1 / real p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (n - n div p) = real n * (1 - 1 / real p)
[PROOF STEP]
by (simp add: of_nat_diff real_of_nat_div p field_simps)
[PROOF STATE]
proof (state)
this:
real (n - n div p) = real n * (1 - 1 / real p)

goal (2 subgoals):
 1. \<And>n. \<lbrakk>\<And>p. p \<in> set [] \<Longrightarrow> prime p; \<And>p. p \<in> set [] \<Longrightarrow> p dvd n; distinct []\<rbrakk> \<Longrightarrow> real (totient_aux1 n []) = real n * (\<Prod>p\<in>set []. 1 - 1 / real p)
 2. \<And>a ps n. \<lbrakk>\<And>n. \<lbrakk>\<And>p. p \<in> set ps \<Longrightarrow> prime p; \<And>p. p \<in> set ps \<Longrightarrow> p dvd n; distinct ps\<rbrakk> \<Longrightarrow> real (totient_aux1 n ps) = real n * (\<Prod>p\<in>set ps. 1 - 1 / real p); \<And>p. p \<in> set (a # ps) \<Longrightarrow> prime p; \<And>p. p \<in> set (a # ps) \<Longrightarrow> p dvd n; distinct (a # ps)\<rbrakk> \<Longrightarrow> real (totient_aux1 n (a # ps)) = real n * (\<Prod>p\<in>set (a # ps). 1 - 1 / real p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (n - n div p) = real n * (1 - 1 / real p)

goal (2 subgoals):
 1. \<And>n. \<lbrakk>\<And>p. p \<in> set [] \<Longrightarrow> prime p; \<And>p. p \<in> set [] \<Longrightarrow> p dvd n; distinct []\<rbrakk> \<Longrightarrow> real (totient_aux1 n []) = real n * (\<Prod>p\<in>set []. 1 - 1 / real p)
 2. \<And>a ps n. \<lbrakk>\<And>n. \<lbrakk>\<And>p. p \<in> set ps \<Longrightarrow> prime p; \<And>p. p \<in> set ps \<Longrightarrow> p dvd n; distinct ps\<rbrakk> \<Longrightarrow> real (totient_aux1 n ps) = real n * (\<Prod>p\<in>set ps. 1 - 1 / real p); \<And>p. p \<in> set (a # ps) \<Longrightarrow> prime p; \<And>p. p \<in> set (a # ps) \<Longrightarrow> p dvd n; distinct (a # ps)\<rbrakk> \<Longrightarrow> real (totient_aux1 n (a # ps)) = real n * (\<Prod>p\<in>set (a # ps). 1 - 1 / real p)
[PROOF STEP]
have "\<dots> * (\<Prod>p\<in>set ps. 1 - 1 / real p) = real n * (\<Prod>p\<in>set (p#ps). 1 - 1 / real p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n * (1 - 1 / real p) * (\<Prod>p\<in>set ps. 1 - 1 / real p) = real n * (\<Prod>p\<in>set (p # ps). 1 - 1 / real p)
[PROOF STEP]
using Cons.prems
[PROOF STATE]
proof (prove)
using this:
?p \<in> set (p # ps) \<Longrightarrow> prime ?p
?p \<in> set (p # ps) \<Longrightarrow> ?p dvd n
distinct (p # ps)

goal (1 subgoal):
 1. real n * (1 - 1 / real p) * (\<Prod>p\<in>set ps. 1 - 1 / real p) = real n * (\<Prod>p\<in>set (p # ps). 1 - 1 / real p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real n * (1 - 1 / real p) * (\<Prod>p\<in>set ps. 1 - 1 / real p) = real n * (\<Prod>p\<in>set (p # ps). 1 - 1 / real p)

goal (2 subgoals):
 1. \<And>n. \<lbrakk>\<And>p. p \<in> set [] \<Longrightarrow> prime p; \<And>p. p \<in> set [] \<Longrightarrow> p dvd n; distinct []\<rbrakk> \<Longrightarrow> real (totient_aux1 n []) = real n * (\<Prod>p\<in>set []. 1 - 1 / real p)
 2. \<And>a ps n. \<lbrakk>\<And>n. \<lbrakk>\<And>p. p \<in> set ps \<Longrightarrow> prime p; \<And>p. p \<in> set ps \<Longrightarrow> p dvd n; distinct ps\<rbrakk> \<Longrightarrow> real (totient_aux1 n ps) = real n * (\<Prod>p\<in>set ps. 1 - 1 / real p); \<And>p. p \<in> set (a # ps) \<Longrightarrow> prime p; \<And>p. p \<in> set (a # ps) \<Longrightarrow> p dvd n; distinct (a # ps)\<rbrakk> \<Longrightarrow> real (totient_aux1 n (a # ps)) = real n * (\<Prod>p\<in>set (a # ps). 1 - 1 / real p)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (totient_aux1 n (p # ps)) = real n * (\<Prod>p\<in>set (p # ps). 1 - 1 / real p)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
real (totient_aux1 n (p # ps)) = real n * (\<Prod>p\<in>set (p # ps). 1 - 1 / real p)

goal (1 subgoal):
 1. real (totient_aux1 n (p # ps)) = real n * (\<Prod>p\<in>set (p # ps). 1 - 1 / real p)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real (totient_aux1 n (p # ps)) = real n * (\<Prod>p\<in>set (p # ps). 1 - 1 / real p)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<And>p. p \<in> set [] \<Longrightarrow> prime p; \<And>p. p \<in> set [] \<Longrightarrow> p dvd n; distinct []\<rbrakk> \<Longrightarrow> real (totient_aux1 n []) = real n * (\<Prod>p\<in>set []. 1 - 1 / real p)
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma rk_ABA' :
  assumes "rk {A, B, P} = 3" and "rk {A, A'} = 2" and "rk {A, A', P} = 2"
  shows "rk {A, B, A'} = 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk {A, B, A'} = 3
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rk {A, B, A'} = 3
[PROOF STEP]
have "rk {A, B, A', P} + rk {A, A'} \<le> rk {A, B, A'} + rk {A, A', P}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk {A, B, A', P} + rk {A, A'} \<le> rk {A, B, A'} + rk {A, A', P}
[PROOF STEP]
using matroid_ax_3_alt[of "{A, A'}" "{A, B, A'}" "{A, A', P}"]
[PROOF STATE]
proof (prove)
using this:
{A, A'} \<subseteq> {A, B, A'} \<inter> {A, A', P} \<Longrightarrow> rk ({A, B, A'} \<union> {A, A', P}) + rk {A, A'} \<le> rk {A, B, A'} + rk {A, A', P}

goal (1 subgoal):
 1. rk {A, B, A', P} + rk {A, A'} \<le> rk {A, B, A'} + rk {A, A', P}
[PROOF STEP]
by (simp add: insert_commute)
[PROOF STATE]
proof (state)
this:
rk {A, B, A', P} + rk {A, A'} \<le> rk {A, B, A'} + rk {A, A', P}

goal (1 subgoal):
 1. rk {A, B, A'} = 3
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rk {A, B, A', P} + rk {A, A'} \<le> rk {A, B, A'} + rk {A, A', P}
[PROOF STEP]
have "rk {A, B, A'} \<ge> 3"
[PROOF STATE]
proof (prove)
using this:
rk {A, B, A', P} + rk {A, A'} \<le> rk {A, B, A'} + rk {A, A', P}

goal (1 subgoal):
 1. 3 \<le> rk {A, B, A'}
[PROOF STEP]
using assms matroid_ax_2
[PROOF STATE]
proof (prove)
using this:
rk {A, B, A', P} + rk {A, A'} \<le> rk {A, B, A'} + rk {A, A', P}
rk {A, B, P} = 3
rk {A, A'} = 2
rk {A, A', P} = 2
?X \<subseteq> ?Y \<longrightarrow> rk ?X \<le> rk ?Y

goal (1 subgoal):
 1. 3 \<le> rk {A, B, A'}
[PROOF STEP]
by (smt eq_iff insert_absorb2 insert_commute non_colinear_A'B'P rk_couple)
[PROOF STATE]
proof (state)
this:
3 \<le> rk {A, B, A'}

goal (1 subgoal):
 1. rk {A, B, A'} = 3
[PROOF STEP]
thus "rk {A, B, A'} = 3"
[PROOF STATE]
proof (prove)
using this:
3 \<le> rk {A, B, A'}

goal (1 subgoal):
 1. rk {A, B, A'} = 3
[PROOF STEP]
by (simp add: le_antisym rk_triple_le)
[PROOF STATE]
proof (state)
this:
rk {A, B, A'} = 3

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Lagrange_lemma: fixes x1 :: "'a::comm_ring" shows
  "(sq x1 + sq x2 + sq x3 + sq x4) * (sq y1 + sq y2 + sq y3 + sq y4) =
   sq (x1*y1 - x2*y2 - x3*y3 - x4*y4)  +
   sq (x1*y2 + x2*y1 + x3*y4 - x4*y3)  +
   sq (x1*y3 - x2*y4 + x3*y1 + x4*y2)  +
   sq (x1*y4 + x2*y3 - x3*y2 + x4*y1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sq x1 + sq x2 + sq x3 + sq x4) * (sq y1 + sq y2 + sq y3 + sq y4) = sq (x1 * y1 - x2 * y2 - x3 * y3 - x4 * y4) + sq (x1 * y2 + x2 * y1 + x3 * y4 - x4 * y3) + sq (x1 * y3 - x2 * y4 + x3 * y1 + x4 * y2) + sq (x1 * y4 + x2 * y3 - x3 * y2 + x4 * y1)
[PROOF STEP]
by (simp only: sq_def algebra_simps)


[STATEMENT]
lemma DERIV_inverse'[derivative_intros]:
  assumes "(f has_field_derivative D) (at x within s)"
    and "f x \<noteq> 0"
  shows "((\<lambda>x. inverse (f x)) has_field_derivative - (inverse (f x) * D * inverse (f x)))
    (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. inverse (f x)) has_field_derivative - (inverse (f x) * D * inverse (f x))) (at x within s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. inverse (f x)) has_field_derivative - (inverse (f x) * D * inverse (f x))) (at x within s)
[PROOF STEP]
have "(f has_derivative (\<lambda>x. x * D)) = (f has_derivative (*) D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_derivative (\<lambda>x. x * D)) = (f has_derivative (*) D)
[PROOF STEP]
by (rule arg_cong [of "\<lambda>x. x * D"]) (simp add: fun_eq_iff)
[PROOF STATE]
proof (state)
this:
(f has_derivative (\<lambda>x. x * D)) = (f has_derivative (*) D)

goal (1 subgoal):
 1. ((\<lambda>x. inverse (f x)) has_field_derivative - (inverse (f x) * D * inverse (f x))) (at x within s)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
(f has_field_derivative D) (at x within s)
f x \<noteq> (0::'a)
(f has_derivative (\<lambda>x. x * D)) = (f has_derivative (*) D)
[PROOF STEP]
have "(f has_derivative (\<lambda>x. x * D)) (at x within s)"
[PROOF STATE]
proof (prove)
using this:
(f has_field_derivative D) (at x within s)
f x \<noteq> (0::'a)
(f has_derivative (\<lambda>x. x * D)) = (f has_derivative (*) D)

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

goal (1 subgoal):
 1. ((\<lambda>x. inverse (f x)) has_field_derivative - (inverse (f x) * D * inverse (f x))) (at x within s)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(f has_derivative (\<lambda>x. x * D)) (at x within s)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(f has_derivative (\<lambda>x. x * D)) (at x within s)

goal (1 subgoal):
 1. ((\<lambda>x. inverse (f x)) has_field_derivative - (inverse (f x) * D * inverse (f x))) (at x within s)
[PROOF STEP]
using \<open>f x \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
(f has_derivative (\<lambda>x. x * D)) (at x within s)
f x \<noteq> (0::'a)

goal (1 subgoal):
 1. ((\<lambda>x. inverse (f x)) has_field_derivative - (inverse (f x) * D * inverse (f x))) (at x within s)
[PROOF STEP]
by (auto intro: has_derivative_imp_has_field_derivative has_derivative_inverse)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. inverse (f x)) has_field_derivative - (inverse (f x) * D * inverse (f x))) (at x within s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma product_simps[simp]:
      "alphabet\<^sub>3 (product A B) = alphabet\<^sub>1 A \<inter> alphabet\<^sub>2 B"
      "initial\<^sub>3 (product A B) = (initial\<^sub>1 A, initial\<^sub>2 B)"
      "transition\<^sub>3 (product A B) a (p, q) = (transition\<^sub>1 A a p, transition\<^sub>2 B a q)"
      "condition\<^sub>3 (product A B) = condition (condition\<^sub>1 A) (condition\<^sub>2 B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (alphabet\<^sub>3 (product A B) = alphabet\<^sub>1 A \<inter> alphabet\<^sub>2 B &&& initial\<^sub>3 (product A B) = (initial\<^sub>1 A, initial\<^sub>2 B)) &&& transition\<^sub>3 (product A B) a (p, q) = (transition\<^sub>1 A a p, transition\<^sub>2 B a q) &&& condition\<^sub>3 (product A B) = condition (condition\<^sub>1 A) (condition\<^sub>2 B)
[PROOF STEP]
unfolding product_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (alphabet\<^sub>3 (automaton\<^sub>3 (alphabet\<^sub>1 A \<inter> alphabet\<^sub>2 B) (initial\<^sub>1 A, initial\<^sub>2 B) (\<lambda>a (p, q). (transition\<^sub>1 A a p, transition\<^sub>2 B a q)) (condition (condition\<^sub>1 A) (condition\<^sub>2 B))) = alphabet\<^sub>1 A \<inter> alphabet\<^sub>2 B &&& initial\<^sub>3 (automaton\<^sub>3 (alphabet\<^sub>1 A \<inter> alphabet\<^sub>2 B) (initial\<^sub>1 A, initial\<^sub>2 B) (\<lambda>a (p, q). (transition\<^sub>1 A a p, transition\<^sub>2 B a q)) (condition (condition\<^sub>1 A) (condition\<^sub>2 B))) = (initial\<^sub>1 A, initial\<^sub>2 B)) &&& transition\<^sub>3 (automaton\<^sub>3 (alphabet\<^sub>1 A \<inter> alphabet\<^sub>2 B) (initial\<^sub>1 A, initial\<^sub>2 B) (\<lambda>a (p, q). (transition\<^sub>1 A a p, transition\<^sub>2 B a q)) (condition (condition\<^sub>1 A) (condition\<^sub>2 B))) a (p, q) = (transition\<^sub>1 A a p, transition\<^sub>2 B a q) &&& condition\<^sub>3 (automaton\<^sub>3 (alphabet\<^sub>1 A \<inter> alphabet\<^sub>2 B) (initial\<^sub>1 A, initial\<^sub>2 B) (\<lambda>a (p, q). (transition\<^sub>1 A a p, transition\<^sub>2 B a q)) (condition (condition\<^sub>1 A) (condition\<^sub>2 B))) = condition (condition\<^sub>1 A) (condition\<^sub>2 B)
[PROOF STEP]
by auto


[STATEMENT]
lemma vec_first_add:
  assumes "dim_vec x \<ge> n"
    and "dim_vec y \<ge> n"
  shows"vec_first (x + y) n = vec_first x n + vec_first y n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_first (x + y) n = vec_first x n + vec_first y n
[PROOF STEP]
unfolding vec_first_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec n (($) (x + y)) = vec n (($) x) + vec n (($) y)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
n \<le> dim_vec x
n \<le> dim_vec y

goal (1 subgoal):
 1. vec n (($) (x + y)) = vec n (($) x) + vec n (($) y)
[PROOF STEP]
by auto


[STATEMENT]
theorem VSEquality_3_times : "\<forall>xs. eval (VSEquality_3_times \<phi>) xs = eval \<phi> xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>xs. eval (VSEquality_3_times \<phi>) xs = eval \<phi> xs
[PROOF STEP]
using VSEquality
[PROOF STATE]
proof (prove)
using this:
\<forall>xs. eval (VSEquality ?\<phi>) xs = eval ?\<phi> xs

goal (1 subgoal):
 1. \<forall>xs. eval (VSEquality_3_times \<phi>) xs = eval \<phi> xs
[PROOF STEP]
unfolding VSEquality_3_times_def
[PROOF STATE]
proof (prove)
using this:
\<forall>xs. eval (VSEquality ?\<phi>) xs = eval ?\<phi> xs

goal (1 subgoal):
 1. \<forall>xs. eval ((VSEquality \<circ> VSEquality \<circ> VSEquality) \<phi>) xs = eval \<phi> xs
[PROOF STEP]
by auto


[STATEMENT]
lemma t1_space_expansive:
   "\<lbrakk>topspace Y = topspace X; \<And>U. openin X U \<Longrightarrow> openin Y U\<rbrakk> \<Longrightarrow> t1_space X \<Longrightarrow> t1_space Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>topspace Y = topspace X; \<And>U. openin X U \<Longrightarrow> openin Y U; t1_space X\<rbrakk> \<Longrightarrow> t1_space Y
[PROOF STEP]
by (metis t1_space_def)


[STATEMENT]
lemma dirichlet_prod'_floor_conv_sum_upto:
  "dirichlet_prod' f (\<lambda>x. real_of_int (floor x)) x = sum_upto (\<lambda>n. sum_upto f (x / n)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dirichlet_prod' f (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x = sum_upto (\<lambda>xa. sum_upto f (x / real xa)) x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dirichlet_prod' f (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x = sum_upto (\<lambda>xa. sum_upto f (x / real xa)) x
[PROOF STEP]
have [simp]: "sum_upto (\<lambda>_. 1 :: real) x = real (nat \<lfloor>x\<rfloor>)" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>_. 1) x = real (nat \<lfloor>x\<rfloor>)
[PROOF STEP]
by (simp add: sum_upto_altdef)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>_. 1) ?x = real (nat \<lfloor>?x\<rfloor>)

goal (1 subgoal):
 1. dirichlet_prod' f (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x = sum_upto (\<lambda>xa. sum_upto f (x / real xa)) x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dirichlet_prod' f (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x = sum_upto (\<lambda>xa. sum_upto f (x / real xa)) x
[PROOF STEP]
using sum_upto_dirichlet_prod[of "\<lambda>n. 1::real" f] sum_upto_dirichlet_prod[of f "\<lambda>n. 1::real"]
[PROOF STATE]
proof (prove)
using this:
sum_upto (dirichlet_prod (\<lambda>n. 1) f) ?x = sum_upto (\<lambda>d. 1 * sum_upto f (?x / real d)) ?x
sum_upto (dirichlet_prod f (\<lambda>n. 1)) ?x = sum_upto (\<lambda>d. f d * sum_upto (\<lambda>n. 1) (?x / real d)) ?x

goal (1 subgoal):
 1. dirichlet_prod' f (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x = sum_upto (\<lambda>xa. sum_upto f (x / real xa)) x
[PROOF STEP]
by (simp add: dirichlet_prod'_def dirichlet_prod_commutes)
[PROOF STATE]
proof (state)
this:
dirichlet_prod' f (\<lambda>x. real_of_int \<lfloor>x\<rfloor>) x = sum_upto (\<lambda>xa. sum_upto f (x / real xa)) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sin_pi2_plus_odd_kpi [simp]:
  fixes k::int
  assumes "odd k"
  shows "sin (pi / 2 + k * pi) = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin (pi / 2 + real_of_int k * pi) = - 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
odd k

goal (1 subgoal):
 1. sin (pi / 2 + real_of_int k * pi) = - 1
[PROOF STEP]
by (simp add: sin_add)


[STATEMENT]
theorem complement_finite:
    assumes "finite (nodes A)"
    shows "finite (nodes (complement A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (nodes (complement A))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (nodes (complement A))
[PROOF STEP]
let ?lrs = "{f. dom f \<subseteq> nodes A \<and> ran f \<subseteq> {0 .. 2 * card (nodes A)}}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (nodes (complement A))
[PROOF STEP]
have 1: "finite ?lrs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {f. dom f \<subseteq> nodes A \<and> ran f \<subseteq> {0..2 * card (nodes A)}}
[PROOF STEP]
using finite_set_of_finite_maps' assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?A; finite ?B\<rbrakk> \<Longrightarrow> finite {m. dom m \<subseteq> ?A \<and> ran m \<subseteq> ?B}
finite (nodes A)

goal (1 subgoal):
 1. finite {f. dom f \<subseteq> nodes A \<and> ran f \<subseteq> {0..2 * card (nodes A)}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {f. dom f \<subseteq> nodes A \<and> ran f \<subseteq> {0..2 * card (nodes A)}}

goal (1 subgoal):
 1. finite (nodes (complement A))
[PROOF STEP]
let ?states = "Pow (nodes A)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (nodes (complement A))
[PROOF STEP]
have 2: "finite ?states"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (Pow (nodes A))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite (nodes A)

goal (1 subgoal):
 1. finite (Pow (nodes A))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (Pow (nodes A))

goal (1 subgoal):
 1. finite (nodes (complement A))
[PROOF STEP]
have "nodes (complement A) \<subseteq> ?lrs \<times> ?states"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nodes (complement A) \<subseteq> {f. dom f \<subseteq> nodes A \<and> ran f \<subseteq> {0..2 * card (nodes A)}} \<times> Pow (nodes A)
[PROOF STEP]
by (force dest: dom_nodes ran_nodes states_nodes)
[PROOF STATE]
proof (state)
this:
nodes (complement A) \<subseteq> {f. dom f \<subseteq> nodes A \<and> ran f \<subseteq> {0..2 * card (nodes A)}} \<times> Pow (nodes A)

goal (1 subgoal):
 1. finite (nodes (complement A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
nodes (complement A) \<subseteq> {f. dom f \<subseteq> nodes A \<and> ran f \<subseteq> {0..2 * card (nodes A)}} \<times> Pow (nodes A)

goal (1 subgoal):
 1. finite (nodes (complement A))
[PROOF STEP]
have "finite \<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ({f. dom f \<subseteq> nodes A \<and> ran f \<subseteq> {0..2 * card (nodes A)}} \<times> Pow (nodes A))
[PROOF STEP]
using 1 2
[PROOF STATE]
proof (prove)
using this:
finite {f. dom f \<subseteq> nodes A \<and> ran f \<subseteq> {0..2 * card (nodes A)}}
finite (Pow (nodes A))

goal (1 subgoal):
 1. finite ({f. dom f \<subseteq> nodes A \<and> ran f \<subseteq> {0..2 * card (nodes A)}} \<times> Pow (nodes A))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite ({f. dom f \<subseteq> nodes A \<and> ran f \<subseteq> {0..2 * card (nodes A)}} \<times> Pow (nodes A))

goal (1 subgoal):
 1. finite (nodes (complement A))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
finite (nodes (complement A))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite (nodes (complement A))

goal (1 subgoal):
 1. finite (nodes (complement A))
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
finite (nodes (complement A))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Ring) ring_distrib2:"\<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R \<rbrakk>
                \<Longrightarrow> (y \<plusminus> z) \<cdot>\<^sub>r x = y \<cdot>\<^sub>r x \<plusminus>  z \<cdot>\<^sub>r x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> (y \<plusminus> z) \<cdot>\<^sub>r x = y \<cdot>\<^sub>r x \<plusminus> z \<cdot>\<^sub>r x
[PROOF STEP]
apply (subst tp_commute[of "y \<plusminus> z" "x"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> y \<plusminus> z \<in> carrier R
 2. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> x \<in> carrier R
 3. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r (y \<plusminus> z) = y \<cdot>\<^sub>r x \<plusminus> z \<cdot>\<^sub>r x
[PROOF STEP]
apply (cut_tac ring_is_ag, simp add:aGroup.ag_pOp_closed)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> x \<in> carrier R
 2. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r (y \<plusminus> z) = y \<cdot>\<^sub>r x \<plusminus> z \<cdot>\<^sub>r x
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r (y \<plusminus> z) = y \<cdot>\<^sub>r x \<plusminus> z \<cdot>\<^sub>r x
[PROOF STEP]
apply (subst ring_distrib1, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r y \<plusminus> x \<cdot>\<^sub>r z = y \<cdot>\<^sub>r x \<plusminus> z \<cdot>\<^sub>r x
[PROOF STEP]
apply (simp add:tp_commute)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma mat_inv_transpose:
  shows "mat_transpose (mat_inv M) = mat_inv (mat_transpose M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_transpose (mat_inv M) = mat_inv (mat_transpose M)
[PROOF STEP]
by (cases M) auto


[STATEMENT]
lemma linear_iff: "linear s1 s2 f \<longleftrightarrow>
  (vector_space s1 \<and> vector_space s2 \<and> (\<forall>x y. f (x + y) = f x + f y) \<and> (\<forall>c x. f (s1 c x) = s2 c (f x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear s1 s2 f = (vector_space s1 \<and> vector_space s2 \<and> (\<forall>x y. f (x + y) = f x + f y) \<and> (\<forall>c x. f (s1 c x) = s2 c (f x)))
[PROOF STEP]
unfolding linear_def module_hom_iff vector_space_def module_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((((\<forall>a x y. s1 a (x + y) = s1 a x + s1 a y) \<and> (\<forall>a b x. s1 (a + b) x = s1 a x + s1 b x)) \<and> (\<forall>a b x. s1 a (s1 b x) = s1 (a * b) x) \<and> (\<forall>x. s1 (1::'a) x = x)) \<and> (((\<forall>a x y. s2 a (x + y) = s2 a x + s2 a y) \<and> (\<forall>a b x. s2 (a + b) x = s2 a x + s2 b x)) \<and> (\<forall>a b x. s2 a (s2 b x) = s2 (a * b) x) \<and> (\<forall>x. s2 (1::'a) x = x)) \<and> (((\<forall>a x y. s1 a (x + y) = s1 a x + s1 a y) \<and> (\<forall>a b x. s1 (a + b) x = s1 a x + s1 b x)) \<and> (\<forall>a b x. s1 a (s1 b x) = s1 (a * b) x) \<and> (\<forall>x. s1 (1::'a) x = x)) \<and> (((\<forall>a x y. s2 a (x + y) = s2 a x + s2 a y) \<and> (\<forall>a b x. s2 (a + b) x = s2 a x + s2 b x)) \<and> (\<forall>a b x. s2 a (s2 b x) = s2 (a * b) x) \<and> (\<forall>x. s2 (1::'a) x = x)) \<and> (\<forall>x y. f (x + y) = f x + f y) \<and> (\<forall>c x. f (s1 c x) = s2 c (f x))) = ((((\<forall>a x y. s1 a (x + y) = s1 a x + s1 a y) \<and> (\<forall>a b x. s1 (a + b) x = s1 a x + s1 b x)) \<and> (\<forall>a b x. s1 a (s1 b x) = s1 (a * b) x) \<and> (\<forall>x. s1 (1::'a) x = x)) \<and> (((\<forall>a x y. s2 a (x + y) = s2 a x + s2 a y) \<and> (\<forall>a b x. s2 (a + b) x = s2 a x + s2 b x)) \<and> (\<forall>a b x. s2 a (s2 b x) = s2 (a * b) x) \<and> (\<forall>x. s2 (1::'a) x = x)) \<and> (\<forall>x y. f (x + y) = f x + f y) \<and> (\<forall>c x. f (s1 c x) = s2 c (f x)))
[PROOF STEP]
by auto


[STATEMENT]
lemma bij_comp:
  assumes "is_bij x" and "is_bij y"
  shows "is_bij (x ; y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_bij (x ; y)
[PROOF STEP]
by (metis assms is_bij_def inj_compose map_comp sur_comp)


[STATEMENT]
lemma mem_card1_singleton: "\<lbrakk> u \<in> U; card U = 1 \<rbrakk> \<Longrightarrow> U = {u}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u \<in> U; card U = 1\<rbrakk> \<Longrightarrow> U = {u}
[PROOF STEP]
by (metis card_1_singletonE singletonD)


[STATEMENT]
lemma is_splitting_blin_def': "is_splitting_blin X Q R \<longleftrightarrow>
  X = Q - R \<and> invertible\<^sub>L Q \<and> nonneg_blinfun (inv\<^sub>L Q) \<and> nonneg_blinfun R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_splitting_blin X Q R = (X = Q - R \<and> invertible\<^sub>L Q \<and> nonneg_blinfun (inv\<^sub>L Q) \<and> nonneg_blinfun R)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. is_splitting_blin X Q R = (X = Q - R \<and> invertible\<^sub>L Q \<and> nonneg_blinfun (inv\<^sub>L Q) \<and> nonneg_blinfun R)
[PROOF STEP]
have "blinfun_to_matrix X = blinfun_to_matrix Q - blinfun_to_matrix R \<longleftrightarrow> X = Q - R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (blinfun_to_matrix X = blinfun_to_matrix Q - blinfun_to_matrix R) = (X = Q - R)
[PROOF STEP]
using  blinfun_to_matrix_diff matrix_to_blinfun_inv
[PROOF STATE]
proof (prove)
using this:
blinfun_to_matrix (?f - ?g) = blinfun_to_matrix ?f - blinfun_to_matrix ?g
matrix_to_blinfun (blinfun_to_matrix ?f) = ?f

goal (1 subgoal):
 1. (blinfun_to_matrix X = blinfun_to_matrix Q - blinfun_to_matrix R) = (X = Q - R)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
(blinfun_to_matrix X = blinfun_to_matrix Q - blinfun_to_matrix R) = (X = Q - R)

goal (1 subgoal):
 1. is_splitting_blin X Q R = (X = Q - R \<and> invertible\<^sub>L Q \<and> nonneg_blinfun (inv\<^sub>L Q) \<and> nonneg_blinfun R)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(blinfun_to_matrix X = blinfun_to_matrix Q - blinfun_to_matrix R) = (X = Q - R)

goal (1 subgoal):
 1. is_splitting_blin X Q R = (X = Q - R \<and> invertible\<^sub>L Q \<and> nonneg_blinfun (inv\<^sub>L Q) \<and> nonneg_blinfun R)
[PROOF STEP]
unfolding is_splitting_blin_def is_splitting_mat_def
[PROOF STATE]
proof (prove)
using this:
(blinfun_to_matrix X = blinfun_to_matrix Q - blinfun_to_matrix R) = (X = Q - R)

goal (1 subgoal):
 1. (blinfun_to_matrix X = blinfun_to_matrix Q - blinfun_to_matrix R \<and> invertible (blinfun_to_matrix Q) \<and> 0 \<le> matrix_inv (blinfun_to_matrix Q) \<and> nonneg_blinfun R) = (X = Q - R \<and> invertible\<^sub>L Q \<and> nonneg_blinfun (inv\<^sub>L Q) \<and> nonneg_blinfun R)
[PROOF STEP]
using blinfun_to_matrix_inverse[of Q] matrix_to_blinfun_inv
[PROOF STATE]
proof (prove)
using this:
(blinfun_to_matrix X = blinfun_to_matrix Q - blinfun_to_matrix R) = (X = Q - R)
invertible\<^sub>L Q \<Longrightarrow> invertible (blinfun_to_matrix Q)
invertible\<^sub>L Q \<Longrightarrow> blinfun_to_matrix (inv\<^sub>L Q) = matrix_inv (blinfun_to_matrix Q)
matrix_to_blinfun (blinfun_to_matrix ?f) = ?f

goal (1 subgoal):
 1. (blinfun_to_matrix X = blinfun_to_matrix Q - blinfun_to_matrix R \<and> invertible (blinfun_to_matrix Q) \<and> 0 \<le> matrix_inv (blinfun_to_matrix Q) \<and> nonneg_blinfun R) = (X = Q - R \<and> invertible\<^sub>L Q \<and> nonneg_blinfun (inv\<^sub>L Q) \<and> nonneg_blinfun R)
[PROOF STEP]
by (fastforce simp: invertible_invertible\<^sub>L_I(1))
[PROOF STATE]
proof (state)
this:
is_splitting_blin X Q R = (X = Q - R \<and> invertible\<^sub>L Q \<and> nonneg_blinfun (inv\<^sub>L Q) \<and> nonneg_blinfun R)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma INTT_gen_INTT_full_length:
  assumes "length numbers =n"
  shows "INTT_gen n numbers = INTT numbers"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. INTT_gen n numbers = INTT numbers
[PROOF STEP]
unfolding INTT_gen_def intt_gen_def INTT_def intt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>i. \<Sum>j = 0..<length numbers. numbers ! j * \<mu> ^ (n div n * i * j)) [0..<length numbers] = map (\<lambda>i. \<Sum>j = 0..<n. numbers ! j * \<mu> ^ (i * j)) [0..<n]
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length numbers = n

goal (1 subgoal):
 1. map (\<lambda>i. \<Sum>j = 0..<length numbers. numbers ! j * \<mu> ^ (n div n * i * j)) [0..<length numbers] = map (\<lambda>i. \<Sum>j = 0..<n. numbers ! j * \<mu> ^ (i * j)) [0..<n]
[PROOF STEP]
by simp


[STATEMENT]
lemma fref_compI_PRE:
    "\<lbrakk> (f,g)\<in>fref P R1 R2; (g,h)\<in>fref Q S1 S2 \<rbrakk>
      \<Longrightarrow> (f,h) \<in> fref (comp_PRE S1 Q (\<lambda>_. P) (\<lambda>_. True)) (R1 O S1) (R2 O S2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f, g) \<in> [P]\<^sub>f R1 \<rightarrow> R2; (g, h) \<in> [Q]\<^sub>f S1 \<rightarrow> S2\<rbrakk> \<Longrightarrow> (f, h) \<in> [comp_PRE S1 Q (\<lambda>_. P) (\<lambda>_. True)]\<^sub>f R1 O S1 \<rightarrow> R2 O S2
[PROOF STEP]
using fref_compI[of P R1 R2 Q S1 S2]
[PROOF STATE]
proof (prove)
using this:
([P]\<^sub>f R1 \<rightarrow> R2) O ([Q]\<^sub>f S1 \<rightarrow> S2) \<subseteq> [\<lambda>x. Q x \<and> (\<forall>y. (y, x) \<in> S1 \<longrightarrow> P y)]\<^sub>f R1 O S1 \<rightarrow> R2 O S2

goal (1 subgoal):
 1. \<lbrakk>(f, g) \<in> [P]\<^sub>f R1 \<rightarrow> R2; (g, h) \<in> [Q]\<^sub>f S1 \<rightarrow> S2\<rbrakk> \<Longrightarrow> (f, h) \<in> [comp_PRE S1 Q (\<lambda>_. P) (\<lambda>_. True)]\<^sub>f R1 O S1 \<rightarrow> R2 O S2
[PROOF STEP]
unfolding comp_PRE_def
[PROOF STATE]
proof (prove)
using this:
([P]\<^sub>f R1 \<rightarrow> R2) O ([Q]\<^sub>f S1 \<rightarrow> S2) \<subseteq> [\<lambda>x. Q x \<and> (\<forall>y. (y, x) \<in> S1 \<longrightarrow> P y)]\<^sub>f R1 O S1 \<rightarrow> R2 O S2

goal (1 subgoal):
 1. \<lbrakk>(f, g) \<in> [P]\<^sub>f R1 \<rightarrow> R2; (g, h) \<in> [Q]\<^sub>f S1 \<rightarrow> S2\<rbrakk> \<Longrightarrow> (f, h) \<in> [\<lambda>x. True \<longrightarrow> Q x \<and> (\<forall>y. (y, x) \<in> S1 \<longrightarrow> P y)]\<^sub>f R1 O S1 \<rightarrow> R2 O S2
[PROOF STEP]
by auto


[STATEMENT]
lemma (in group) sub_subgroup_dvd_card:
  assumes "subgroup H G" "subgroup J G" "J \<subseteq> H"
  shows "card J dvd card H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card J dvd card H
[PROOF STEP]
by (metis subgroup_incl[of J H] subgroup_card_eq_order[of H]
            group.subgroup_card_dvd_group_ord[of "(G\<lparr>carrier := H\<rparr>)" J] assms
            subgroup.subgroup_is_group[of H G] group_axioms)


[STATEMENT]
lemma card_num1 [simp]: "CARD(num1) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD(num1) = 1
[PROOF STEP]
unfolding type_definition.card [OF type_definition_num1]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD(unit) = 1
[PROOF STEP]
by (simp only: card_UNIV_unit)


[STATEMENT]
lemma divisor_count_0 [simp]: "divisor_count 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_count 0 = 0
[PROOF STEP]
by (simp add: divisor_count_def)


[STATEMENT]
lemma real_sqrt_less_mono: "x < y \<Longrightarrow> sqrt x < sqrt y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < y \<Longrightarrow> sqrt x < sqrt y
[PROOF STEP]
unfolding sqrt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < y \<Longrightarrow> root 2 x < root 2 y
[PROOF STEP]
by (rule real_root_less_mono [OF pos2])


[STATEMENT]
lemma aff_dim_inner_basis_exists:
  fixes V :: "('n::euclidean_space) set"
  shows "\<exists>B. B \<subseteq> V \<and> affine hull B = affine hull V \<and>
    \<not> affine_dependent B \<and> of_nat (card B) = aff_dim V + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B\<subseteq>V. affine hull B = affine hull V \<and> \<not> affine_dependent B \<and> int (card B) = aff_dim V + 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>B\<subseteq>V. affine hull B = affine hull V \<and> \<not> affine_dependent B \<and> int (card B) = aff_dim V + 1
[PROOF STEP]
obtain B where B: "\<not> affine_dependent B" "B \<subseteq> V" "affine hull B = affine hull V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B. \<lbrakk>\<not> affine_dependent B; B \<subseteq> V; affine hull B = affine hull V\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using affine_basis_exists[of V]
[PROOF STATE]
proof (prove)
using this:
\<exists>B\<subseteq>V. \<not> affine_dependent B \<and> affine hull V = affine hull B

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>\<not> affine_dependent B; B \<subseteq> V; affine hull B = affine hull V\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> affine_dependent B
B \<subseteq> V
affine hull B = affine hull V

goal (1 subgoal):
 1. \<exists>B\<subseteq>V. affine hull B = affine hull V \<and> \<not> affine_dependent B \<and> int (card B) = aff_dim V + 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> affine_dependent B
B \<subseteq> V
affine hull B = affine hull V
[PROOF STEP]
have "of_nat(card B) = aff_dim V+1"
[PROOF STATE]
proof (prove)
using this:
\<not> affine_dependent B
B \<subseteq> V
affine hull B = affine hull V

goal (1 subgoal):
 1. int (card B) = aff_dim V + 1
[PROOF STEP]
using aff_dim_unique
[PROOF STATE]
proof (prove)
using this:
\<not> affine_dependent B
B \<subseteq> V
affine hull B = affine hull V
affine hull ?B = affine hull ?V \<and> \<not> affine_dependent ?B \<Longrightarrow> int (card ?B) = aff_dim ?V + 1

goal (1 subgoal):
 1. int (card B) = aff_dim V + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
int (card B) = aff_dim V + 1

goal (1 subgoal):
 1. \<exists>B\<subseteq>V. affine hull B = affine hull V \<and> \<not> affine_dependent B \<and> int (card B) = aff_dim V + 1
[PROOF STEP]
with B
[PROOF STATE]
proof (chain)
picking this:
\<not> affine_dependent B
B \<subseteq> V
affine hull B = affine hull V
int (card B) = aff_dim V + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> affine_dependent B
B \<subseteq> V
affine hull B = affine hull V
int (card B) = aff_dim V + 1

goal (1 subgoal):
 1. \<exists>B\<subseteq>V. affine hull B = affine hull V \<and> \<not> affine_dependent B \<and> int (card B) = aff_dim V + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>B\<subseteq>V. affine hull B = affine hull V \<and> \<not> affine_dependent B \<and> int (card B) = aff_dim V + 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem eval_equality:
  "eval i (Eql' p q) =
    (
      if eval i p = eval i q then Det True else
      if eval i p = Det True then eval i q else
      if eval i q = Det True then eval i p else
      if eval i p = Det False then eval i (Neg' q) else
      if eval i q = Det False then eval i (Neg' p) else
      Det False
    )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval i (Eql' p q) = (if eval i p = eval i q then Det True else if eval i p = Det True then eval i q else if eval i q = Det True then eval i p else if eval i p = Det False then eval i (Neg' q) else if eval i q = Det False then eval i (Neg' p) else Det False)
[PROOF STEP]
by (cases "eval i p"; cases "eval i q") simp_all


[STATEMENT]
lemma sqrt_function:
  assumes "0 \<le> (x::int)"
    and "r' = sqrt x"
  shows "r'*r' \<le> x \<and> x < (r'+1)*(r'+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r' * r' \<le> x \<and> x < (r' + 1) * (r' + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r' * r' \<le> x \<and> x < (r' + 1) * (r' + 1)
[PROOF STEP]
let ?P = "\<lambda>r' . r'*r' \<le> x \<and> x < (r'+1)*(r'+1)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r' * r' \<le> x \<and> x < (r' + 1) * (r' + 1)
[PROOF STEP]
have "?P (SOME z . ?P z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SOME z. z * z \<le> x \<and> x < (z + 1) * (z + 1)) * (SOME z. z * z \<le> x \<and> x < (z + 1) * (z + 1)) \<le> x \<and> x < ((SOME z. z * z \<le> x \<and> x < (z + 1) * (z + 1)) + 1) * ((SOME z. z * z \<le> x \<and> x < (z + 1) * (z + 1)) + 1)
[PROOF STEP]
by (metis (mono_tags, lifting) assms(1) sqrt_exists some_eq_imp)
[PROOF STATE]
proof (state)
this:
(SOME z. z * z \<le> x \<and> x < (z + 1) * (z + 1)) * (SOME z. z * z \<le> x \<and> x < (z + 1) * (z + 1)) \<le> x \<and> x < ((SOME z. z * z \<le> x \<and> x < (z + 1) * (z + 1)) + 1) * ((SOME z. z * z \<le> x \<and> x < (z + 1) * (z + 1)) + 1)

goal (1 subgoal):
 1. r' * r' \<le> x \<and> x < (r' + 1) * (r' + 1)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(SOME z. z * z \<le> x \<and> x < (z + 1) * (z + 1)) * (SOME z. z * z \<le> x \<and> x < (z + 1) * (z + 1)) \<le> x \<and> x < ((SOME z. z * z \<le> x \<and> x < (z + 1) * (z + 1)) + 1) * ((SOME z. z * z \<le> x \<and> x < (z + 1) * (z + 1)) + 1)

goal (1 subgoal):
 1. r' * r' \<le> x \<and> x < (r' + 1) * (r' + 1)
[PROOF STEP]
using assms(2) sqrt_def
[PROOF STATE]
proof (prove)
using this:
(SOME z. z * z \<le> x \<and> x < (z + 1) * (z + 1)) * (SOME z. z * z \<le> x \<and> x < (z + 1) * (z + 1)) \<le> x \<and> x < ((SOME z. z * z \<le> x \<and> x < (z + 1) * (z + 1)) + 1) * ((SOME z. z * z \<le> x \<and> x < (z + 1) * (z + 1)) + 1)
r' = sqrt x
sqrt ?x \<equiv> SOME r'. r' * r' \<le> ?x \<and> ?x < (r' + 1) * (r' + 1)

goal (1 subgoal):
 1. r' * r' \<le> x \<and> x < (r' + 1) * (r' + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
r' * r' \<le> x \<and> x < (r' + 1) * (r' + 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem (in group) inverse_inverse: "inverse (inverse x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (inverse x) = x
[PROOF STEP]
proof (rule group_inverse_equality)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x * inverse x = (1::'a)
[PROOF STEP]
show "x * inverse x = one"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * inverse x = (1::'a)
[PROOF STEP]
by (simp only: group_right_inverse)
[PROOF STATE]
proof (state)
this:
x * inverse x = (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Liminf_ereal_mult_right:
  assumes "F \<noteq> bot" "(c::real) \<ge> 0"
  shows   "Liminf F (\<lambda>n. f n * ereal c) = Liminf F f * ereal c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Liminf F (\<lambda>n. f n * ereal c) = Liminf F f * ereal c
[PROOF STEP]
proof (rule Liminf_compose_continuous_mono)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. continuous_on UNIV (\<lambda>a. a * ereal c)
 2. mono (\<lambda>a. a * ereal c)
 3. F \<noteq> bot
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
F \<noteq> bot
0 \<le> c
[PROOF STEP]
show "continuous_on UNIV (\<lambda>a. a * ereal c)"
[PROOF STATE]
proof (prove)
using this:
F \<noteq> bot
0 \<le> c

goal (1 subgoal):
 1. continuous_on UNIV (\<lambda>a. a * ereal c)
[PROOF STEP]
using tendsto_cmult_ereal[of "ereal c" "\<lambda>x. x" ]
[PROOF STATE]
proof (prove)
using this:
F \<noteq> bot
0 \<le> c
\<lbrakk>\<bar>ereal c\<bar> \<noteq> \<infinity>; ((\<lambda>x. x) \<longlongrightarrow> ?x) ?F\<rbrakk> \<Longrightarrow> ((*) (ereal c) \<longlongrightarrow> ereal c * ?x) ?F

goal (1 subgoal):
 1. continuous_on UNIV (\<lambda>a. a * ereal c)
[PROOF STEP]
by (force simp: continuous_on_def mult_ac)
[PROOF STATE]
proof (state)
this:
continuous_on UNIV (\<lambda>a. a * ereal c)

goal (2 subgoals):
 1. mono (\<lambda>a. a * ereal c)
 2. F \<noteq> bot
[PROOF STEP]
qed (use assms in \<open>auto simp: mono_def ereal_mult_right_mono\<close>)


[STATEMENT]
lemma powreal_less_anti_mono:
  assumes "r < s"
  and "0 < a"
  and "a < 1"
shows "a pow\<^sub>\<real> r > a pow\<^sub>\<real> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a pow\<^sub>\<real> s < a pow\<^sub>\<real> r
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a pow\<^sub>\<real> s < a pow\<^sub>\<real> r
[PROOF STEP]
have "inverse a > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < inverse a
[PROOF STEP]
by (simp add: assms(2, 3) one_less_inverse_iff)
[PROOF STATE]
proof (state)
this:
1 < inverse a

goal (1 subgoal):
 1. a pow\<^sub>\<real> s < a pow\<^sub>\<real> r
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
1 < inverse a

goal (1 subgoal):
 1. a pow\<^sub>\<real> s < a pow\<^sub>\<real> r
[PROOF STEP]
have "inverse a powa r < inverse a powa s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse a powa r < inverse a powa s
[PROOF STEP]
using assms(1) powa_less_mono
[PROOF STATE]
proof (prove)
using this:
r < s
\<lbrakk>?r < ?s; 1 < ?a\<rbrakk> \<Longrightarrow> ?a powa ?r < ?a powa ?s

goal (1 subgoal):
 1. inverse a powa r < inverse a powa s
[PROOF STEP]
using calculation
[PROOF STATE]
proof (prove)
using this:
r < s
\<lbrakk>?r < ?s; 1 < ?a\<rbrakk> \<Longrightarrow> ?a powa ?r < ?a powa ?s
1 < inverse a

goal (1 subgoal):
 1. inverse a powa r < inverse a powa s
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
inverse a powa r < inverse a powa s

goal (1 subgoal):
 1. a pow\<^sub>\<real> s < a pow\<^sub>\<real> r
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
1 < inverse a
inverse a powa r < inverse a powa s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 < inverse a
inverse a powa r < inverse a powa s

goal (1 subgoal):
 1. a pow\<^sub>\<real> s < a pow\<^sub>\<real> r
[PROOF STEP]
using powreal_eq_powa powreal_inverse powreal_le_anti_mono powreal_less_cancel
[PROOF STATE]
proof (prove)
using this:
1 < inverse a
inverse a powa r < inverse a powa s
1 \<le> ?a \<Longrightarrow> ?a pow\<^sub>\<real> ?x = ?a powa ?x
inverse (?a pow\<^sub>\<real> ?x) = inverse ?a pow\<^sub>\<real> ?x
\<lbrakk>?r \<le> ?s; 0 < ?a; ?a < 1\<rbrakk> \<Longrightarrow> ?a pow\<^sub>\<real> ?s \<le> ?a pow\<^sub>\<real> ?r
\<lbrakk>?a pow\<^sub>\<real> ?r < ?a pow\<^sub>\<real> ?s; 1 \<le> ?a\<rbrakk> \<Longrightarrow> ?r < ?s

goal (1 subgoal):
 1. a pow\<^sub>\<real> s < a pow\<^sub>\<real> r
[PROOF STEP]
by (metis assms(2,3) le_less less_irrefl)
[PROOF STATE]
proof (state)
this:
a pow\<^sub>\<real> s < a pow\<^sub>\<real> r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma diag_block_pow_mat: assumes sq: "Ball (set As) square_mat"
  shows "diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda> A. A ^\<^sub>m n) As)" (is "?As ^\<^sub>m _ = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As)
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. diag_block_mat As ^\<^sub>m 0 = diag_block_mat (map (\<lambda>A. A ^\<^sub>m 0) As)
 2. \<And>n. diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) \<Longrightarrow> diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. diag_block_mat As ^\<^sub>m 0 = diag_block_mat (map (\<lambda>A. A ^\<^sub>m 0) As)
 2. \<And>n. diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) \<Longrightarrow> diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)
[PROOF STEP]
have "?As ^\<^sub>m 0 = 1\<^sub>m (dim_row ?As)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_block_mat As ^\<^sub>m 0 = 1\<^sub>m (dim_row (diag_block_mat As))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
diag_block_mat As ^\<^sub>m 0 = 1\<^sub>m (dim_row (diag_block_mat As))

goal (2 subgoals):
 1. diag_block_mat As ^\<^sub>m 0 = diag_block_mat (map (\<lambda>A. A ^\<^sub>m 0) As)
 2. \<And>n. diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) \<Longrightarrow> diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
diag_block_mat As ^\<^sub>m 0 = 1\<^sub>m (dim_row (diag_block_mat As))

goal (2 subgoals):
 1. diag_block_mat As ^\<^sub>m 0 = diag_block_mat (map (\<lambda>A. A ^\<^sub>m 0) As)
 2. \<And>n. diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) \<Longrightarrow> diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)
[PROOF STEP]
have "dim_row ?As = sum_list (map dim_row As)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (diag_block_mat As) = sum_list (map dim_row As)
[PROOF STEP]
using diag_block_mat_square[OF sq]
[PROOF STATE]
proof (prove)
using this:
square_mat (diag_block_mat As)

goal (1 subgoal):
 1. dim_row (diag_block_mat As) = sum_list (map dim_row As)
[PROOF STEP]
unfolding dim_diag_block_mat
[PROOF STATE]
proof (prove)
using this:
square_mat (diag_block_mat As)

goal (1 subgoal):
 1. sum_list (map dim_row As) = sum_list (map dim_row As)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_row (diag_block_mat As) = sum_list (map dim_row As)

goal (2 subgoals):
 1. diag_block_mat As ^\<^sub>m 0 = diag_block_mat (map (\<lambda>A. A ^\<^sub>m 0) As)
 2. \<And>n. diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) \<Longrightarrow> diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dim_row (diag_block_mat As) = sum_list (map dim_row As)

goal (2 subgoals):
 1. diag_block_mat As ^\<^sub>m 0 = diag_block_mat (map (\<lambda>A. A ^\<^sub>m 0) As)
 2. \<And>n. diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) \<Longrightarrow> diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)
[PROOF STEP]
have "1\<^sub>m \<dots> = diag_block_mat (map (\<lambda>A. 1\<^sub>m (dim_row A)) As)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1\<^sub>m (sum_list (map dim_row As)) = diag_block_mat (map (\<lambda>A. 1\<^sub>m (dim_row A)) As)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1\<^sub>m (sum_list (map dim_row As)) = diag_block_mat (map (\<lambda>A. 1\<^sub>m (dim_row A)) As)

goal (2 subgoals):
 1. diag_block_mat As ^\<^sub>m 0 = diag_block_mat (map (\<lambda>A. A ^\<^sub>m 0) As)
 2. \<And>n. diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) \<Longrightarrow> diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1\<^sub>m (sum_list (map dim_row As)) = diag_block_mat (map (\<lambda>A. 1\<^sub>m (dim_row A)) As)

goal (2 subgoals):
 1. diag_block_mat As ^\<^sub>m 0 = diag_block_mat (map (\<lambda>A. A ^\<^sub>m 0) As)
 2. \<And>n. diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) \<Longrightarrow> diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)
[PROOF STEP]
have "\<dots> = diag_block_mat (map (\<lambda> A. A ^\<^sub>m 0) As)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_block_mat (map (\<lambda>A. 1\<^sub>m (dim_row A)) As) = diag_block_mat (map (\<lambda>A. A ^\<^sub>m 0) As)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
diag_block_mat (map (\<lambda>A. 1\<^sub>m (dim_row A)) As) = diag_block_mat (map (\<lambda>A. A ^\<^sub>m 0) As)

goal (2 subgoals):
 1. diag_block_mat As ^\<^sub>m 0 = diag_block_mat (map (\<lambda>A. A ^\<^sub>m 0) As)
 2. \<And>n. diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) \<Longrightarrow> diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
diag_block_mat As ^\<^sub>m 0 = diag_block_mat (map (\<lambda>A. A ^\<^sub>m 0) As)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
diag_block_mat As ^\<^sub>m 0 = diag_block_mat (map (\<lambda>A. A ^\<^sub>m 0) As)

goal (1 subgoal):
 1. diag_block_mat As ^\<^sub>m 0 = diag_block_mat (map (\<lambda>A. A ^\<^sub>m 0) As)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
diag_block_mat As ^\<^sub>m 0 = diag_block_mat (map (\<lambda>A. A ^\<^sub>m 0) As)

goal (1 subgoal):
 1. \<And>n. diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) \<Longrightarrow> diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) \<Longrightarrow> diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As)

goal (1 subgoal):
 1. \<And>n. diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) \<Longrightarrow> diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)
[PROOF STEP]
let ?An = "\<lambda> As. diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) \<Longrightarrow> diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)
[PROOF STEP]
let ?Asn = "\<lambda> As. diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) \<Longrightarrow> diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)
[PROOF STEP]
from Suc
[PROOF STATE]
proof (chain)
picking this:
diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As)
[PROOF STEP]
have "?case = (?An As * diag_block_mat As = ?Asn As)"
[PROOF STATE]
proof (prove)
using this:
diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As)

goal (1 subgoal):
 1. (diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)) = (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)) = (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As))

goal (1 subgoal):
 1. \<And>n. diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) \<Longrightarrow> diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)) = (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As))

goal (1 subgoal):
 1. \<And>n. diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) \<Longrightarrow> diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)
[PROOF STEP]
have "\<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As)
[PROOF STEP]
using sq
[PROOF STATE]
proof (prove)
using this:
Ball (set As) square_mat

goal (1 subgoal):
 1. diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As)
[PROOF STEP]
proof (induct As)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Ball (set []) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) []) * diag_block_mat [] = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) [])
 2. \<And>a As. \<lbrakk>Ball (set As) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As); Ball (set (a # As)) square_mat\<rbrakk> \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) (a # As)) * diag_block_mat (a # As) = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) (a # As))
[PROOF STEP]
case (Cons A As)
[PROOF STATE]
proof (state)
this:
\<forall>a\<in>set As. square_mat a \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As)
\<forall>a\<in>set (A # As). square_mat a

goal (2 subgoals):
 1. Ball (set []) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) []) * diag_block_mat [] = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) [])
 2. \<And>a As. \<lbrakk>Ball (set As) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As); Ball (set (a # As)) square_mat\<rbrakk> \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) (a # As)) * diag_block_mat (a # As) = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) (a # As))
[PROOF STEP]
hence IH: "?An As * diag_block_mat As = ?Asn As"
      and sq: "Ball (set As) square_mat" and A: "dim_col A = dim_row A"
[PROOF STATE]
proof (prove)
using this:
\<forall>a\<in>set As. square_mat a \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As)
\<forall>a\<in>set (A # As). square_mat a

goal (1 subgoal):
 1. diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As) &&& Ball (set As) square_mat &&& dim_col A = dim_row A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As)
Ball (set As) square_mat
dim_col A = dim_row A

goal (2 subgoals):
 1. Ball (set []) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) []) * diag_block_mat [] = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) [])
 2. \<And>a As. \<lbrakk>Ball (set As) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As); Ball (set (a # As)) square_mat\<rbrakk> \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) (a # As)) * diag_block_mat (a # As) = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) (a # As))
[PROOF STEP]
have sq2: "Ball (set (List.map (\<lambda>A. A ^\<^sub>m n) As)) square_mat"
      and sq3: "Ball (set (List.map (\<lambda>A. A ^\<^sub>m n * A) As)) square_mat"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ball (set (map (\<lambda>A. A ^\<^sub>m n) As)) square_mat &&& Ball (set (map (\<lambda>A. A ^\<^sub>m n * A) As)) square_mat
[PROOF STEP]
using sq
[PROOF STATE]
proof (prove)
using this:
Ball (set As) square_mat

goal (1 subgoal):
 1. Ball (set (map (\<lambda>A. A ^\<^sub>m n) As)) square_mat &&& Ball (set (map (\<lambda>A. A ^\<^sub>m n * A) As)) square_mat
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Ball (set (map (\<lambda>A. A ^\<^sub>m n) As)) square_mat
Ball (set (map (\<lambda>A. A ^\<^sub>m n * A) As)) square_mat

goal (2 subgoals):
 1. Ball (set []) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) []) * diag_block_mat [] = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) [])
 2. \<And>a As. \<lbrakk>Ball (set As) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As); Ball (set (a # As)) square_mat\<rbrakk> \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) (a # As)) * diag_block_mat (a # As) = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) (a # As))
[PROOF STEP]
define n1 where "n1 = dim_row A"
[PROOF STATE]
proof (state)
this:
n1 = dim_row A

goal (2 subgoals):
 1. Ball (set []) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) []) * diag_block_mat [] = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) [])
 2. \<And>a As. \<lbrakk>Ball (set As) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As); Ball (set (a # As)) square_mat\<rbrakk> \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) (a # As)) * diag_block_mat (a # As) = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) (a # As))
[PROOF STEP]
define n2 where "n2 = sum_list (map dim_row As)"
[PROOF STATE]
proof (state)
this:
n2 = sum_list (map dim_row As)

goal (2 subgoals):
 1. Ball (set []) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) []) * diag_block_mat [] = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) [])
 2. \<And>a As. \<lbrakk>Ball (set As) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As); Ball (set (a # As)) square_mat\<rbrakk> \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) (a # As)) * diag_block_mat (a # As) = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) (a # As))
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
dim_col A = dim_row A
[PROOF STEP]
have A: "A \<in> carrier_mat n1 n1"
[PROOF STATE]
proof (prove)
using this:
dim_col A = dim_row A

goal (1 subgoal):
 1. A \<in> carrier_mat n1 n1
[PROOF STEP]
unfolding n1_def carrier_mat_def
[PROOF STATE]
proof (prove)
using this:
dim_col A = dim_row A

goal (1 subgoal):
 1. A \<in> {m. dim_row m = dim_row A \<and> dim_col m = dim_row A}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat n1 n1

goal (2 subgoals):
 1. Ball (set []) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) []) * diag_block_mat [] = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) [])
 2. \<And>a As. \<lbrakk>Ball (set As) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As); Ball (set (a # As)) square_mat\<rbrakk> \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) (a # As)) * diag_block_mat (a # As) = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) (a # As))
[PROOF STEP]
have [simp]: "dim_col (?An As) = n2" "dim_row (?An As) = n2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As)) = n2 &&& dim_row (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As)) = n2
[PROOF STEP]
unfolding n2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As)) = sum_list (map dim_row As) &&& dim_row (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As)) = sum_list (map dim_row As)
[PROOF STEP]
using diag_block_mat_square[OF sq2,unfolded square_mat.simps]
[PROOF STATE]
proof (prove)
using this:
dim_col (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As)) = dim_row (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As))

goal (1 subgoal):
 1. dim_col (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As)) = sum_list (map dim_row As) &&& dim_row (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As)) = sum_list (map dim_row As)
[PROOF STEP]
unfolding dim_diag_block_mat map_map
[PROOF STATE]
proof (prove)
using this:
sum_list (map (dim_col \<circ> (\<lambda>A. A ^\<^sub>m n)) As) = sum_list (map (dim_row \<circ> (\<lambda>A. A ^\<^sub>m n)) As)

goal (1 subgoal):
 1. sum_list (map (dim_col \<circ> (\<lambda>A. A ^\<^sub>m n)) As) = sum_list (map dim_row As) &&& sum_list (map (dim_row \<circ> (\<lambda>A. A ^\<^sub>m n)) As) = sum_list (map dim_row As)
[PROOF STEP]
by (auto simp:o_def)
[PROOF STATE]
proof (state)
this:
dim_col (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As)) = n2
dim_row (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As)) = n2

goal (2 subgoals):
 1. Ball (set []) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) []) * diag_block_mat [] = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) [])
 2. \<And>a As. \<lbrakk>Ball (set As) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As); Ball (set (a # As)) square_mat\<rbrakk> \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) (a # As)) * diag_block_mat (a # As) = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) (a # As))
[PROOF STEP]
have [simp]: "dim_col (?Asn As) = n2" "dim_row (?Asn As) = n2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As)) = n2 &&& dim_row (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As)) = n2
[PROOF STEP]
unfolding n2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As)) = sum_list (map dim_row As) &&& dim_row (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As)) = sum_list (map dim_row As)
[PROOF STEP]
using diag_block_mat_square[OF sq3,unfolded square_mat.simps]
[PROOF STATE]
proof (prove)
using this:
dim_col (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As)) = dim_row (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As))

goal (1 subgoal):
 1. dim_col (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As)) = sum_list (map dim_row As) &&& dim_row (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As)) = sum_list (map dim_row As)
[PROOF STEP]
unfolding dim_diag_block_mat map_map
[PROOF STATE]
proof (prove)
using this:
sum_list (map (dim_col \<circ> (\<lambda>A. A ^\<^sub>m n * A)) As) = sum_list (map (dim_row \<circ> (\<lambda>A. A ^\<^sub>m n * A)) As)

goal (1 subgoal):
 1. sum_list (map (dim_col \<circ> (\<lambda>A. A ^\<^sub>m n * A)) As) = sum_list (map dim_row As) &&& sum_list (map (dim_row \<circ> (\<lambda>A. A ^\<^sub>m n * A)) As) = sum_list (map dim_row As)
[PROOF STEP]
by (auto simp:o_def)
[PROOF STATE]
proof (state)
this:
dim_col (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As)) = n2
dim_row (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As)) = n2

goal (2 subgoals):
 1. Ball (set []) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) []) * diag_block_mat [] = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) [])
 2. \<And>a As. \<lbrakk>Ball (set As) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As); Ball (set (a # As)) square_mat\<rbrakk> \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) (a # As)) * diag_block_mat (a # As) = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) (a # As))
[PROOF STEP]
have [simp]:
      "dim_row (diag_block_mat As) = n2"
      "dim_col (diag_block_mat As) = n2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (diag_block_mat As) = n2 &&& dim_col (diag_block_mat As) = n2
[PROOF STEP]
unfolding n2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (diag_block_mat As) = sum_list (map dim_row As) &&& dim_col (diag_block_mat As) = sum_list (map dim_row As)
[PROOF STEP]
using diag_block_mat_square[OF sq,unfolded square_mat.simps]
[PROOF STATE]
proof (prove)
using this:
dim_col (diag_block_mat As) = dim_row (diag_block_mat As)

goal (1 subgoal):
 1. dim_row (diag_block_mat As) = sum_list (map dim_row As) &&& dim_col (diag_block_mat As) = sum_list (map dim_row As)
[PROOF STEP]
unfolding dim_diag_block_mat
[PROOF STATE]
proof (prove)
using this:
sum_list (map dim_col As) = sum_list (map dim_row As)

goal (1 subgoal):
 1. sum_list (map dim_row As) = sum_list (map dim_row As) &&& sum_list (map dim_col As) = sum_list (map dim_row As)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_row (diag_block_mat As) = n2
dim_col (diag_block_mat As) = n2

goal (2 subgoals):
 1. Ball (set []) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) []) * diag_block_mat [] = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) [])
 2. \<And>a As. \<lbrakk>Ball (set As) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As); Ball (set (a # As)) square_mat\<rbrakk> \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) (a # As)) * diag_block_mat (a # As) = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) (a # As))
[PROOF STEP]
have [simp]: "diag_block_mat As \<in> carrier_mat n2 n2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_block_mat As \<in> carrier_mat n2 n2
[PROOF STEP]
unfolding carrier_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_block_mat As \<in> {m. dim_row m = n2 \<and> dim_col m = n2}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
diag_block_mat As \<in> carrier_mat n2 n2

goal (2 subgoals):
 1. Ball (set []) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) []) * diag_block_mat [] = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) [])
 2. \<And>a As. \<lbrakk>Ball (set As) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As); Ball (set (a # As)) square_mat\<rbrakk> \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) (a # As)) * diag_block_mat (a # As) = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) (a # As))
[PROOF STEP]
have [simp]: "?An As \<in> carrier_mat n2 n2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) \<in> carrier_mat n2 n2
[PROOF STEP]
unfolding carrier_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) \<in> {m. dim_row m = n2 \<and> dim_col m = n2}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) \<in> carrier_mat n2 n2

goal (2 subgoals):
 1. Ball (set []) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) []) * diag_block_mat [] = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) [])
 2. \<And>a As. \<lbrakk>Ball (set As) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As); Ball (set (a # As)) square_mat\<rbrakk> \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) (a # As)) * diag_block_mat (a # As) = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) (a # As))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) (A # As)) * diag_block_mat (A # As) = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) (A # As))
[PROOF STEP]
unfolding diag_block_mat.simps Let_def list.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. four_block_mat (A ^\<^sub>m n) (0\<^sub>m (dim_row (A ^\<^sub>m n)) (dim_col (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As)))) (0\<^sub>m (dim_row (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As))) (dim_col (A ^\<^sub>m n))) (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As)) * four_block_mat A (0\<^sub>m (dim_row A) (dim_col (diag_block_mat As))) (0\<^sub>m (dim_row (diag_block_mat As)) (dim_col A)) (diag_block_mat As) = four_block_mat (A ^\<^sub>m n * A) (0\<^sub>m (dim_row (A ^\<^sub>m n * A)) (dim_col (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As)))) (0\<^sub>m (dim_row (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As))) (dim_col (A ^\<^sub>m n * A))) (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As))
[PROOF STEP]
by (subst mult_four_block_mat[of _ n1 n1 _ n2 _ n2 _ _ n1 _ n2],
      insert A, auto simp: IH)
[PROOF STATE]
proof (state)
this:
diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) (A # As)) * diag_block_mat (A # As) = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) (A # As))

goal (1 subgoal):
 1. Ball (set []) square_mat \<Longrightarrow> diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) []) * diag_block_mat [] = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) [])
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) * diag_block_mat As = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As)

goal (1 subgoal):
 1. \<And>n. diag_block_mat As ^\<^sub>m n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n) As) \<Longrightarrow> diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)) = (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As) = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)) = (diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As) = diag_block_mat (map (\<lambda>A. A ^\<^sub>m n * A) As))

goal (1 subgoal):
 1. diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
diag_block_mat As ^\<^sub>m Suc n = diag_block_mat (map (\<lambda>A. A ^\<^sub>m Suc n) As)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_infinite_inj_on: assumes A: "finite (A :: 'a set)" and inf: "infinite (UNIV :: 'b set)"
  shows "\<exists> f :: 'a \<Rightarrow> 'b. inj_on f A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. inj_on f A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>f. inj_on f A
[PROOF STEP]
from inf
[PROOF STATE]
proof (chain)
picking this:
infinite UNIV
[PROOF STEP]
obtain B :: "'b set" where B: "finite B" "card B = card A"
[PROOF STATE]
proof (prove)
using this:
infinite UNIV

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>finite B; card B = card A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson infinite_arbitrarily_large)
[PROOF STATE]
proof (state)
this:
finite B
card B = card A

goal (1 subgoal):
 1. \<exists>f. inj_on f A
[PROOF STEP]
from A B
[PROOF STATE]
proof (chain)
picking this:
finite A
finite B
card B = card A
[PROOF STEP]
obtain f :: "'a \<Rightarrow> 'b" where "bij_betw f A B"
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
card B = card A

goal (1 subgoal):
 1. (\<And>f. bij_betw f A B \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis bij_betw_iff_card)
[PROOF STATE]
proof (state)
this:
bij_betw f A B

goal (1 subgoal):
 1. \<exists>f. inj_on f A
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
bij_betw f A B

goal (1 subgoal):
 1. \<exists>f. inj_on f A
[PROOF STEP]
by (intro exI[of _ f], auto simp: bij_betw_def)
[PROOF STATE]
proof (state)
this:
\<exists>f. inj_on f A

goal:
No subgoals!
[PROOF STEP]
qed