[STATEMENT]
lemma liouville_lambda_altdef:
  "liouville_lambda n = (\<Sum>d | d ^ 2 dvd n. moebius_mu (n div d ^ 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
[PROOF STEP]
proof (cases "n = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
 2. n \<noteq> 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
 2. n \<noteq> 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
[PROOF STEP]
have "liouville_lambda n = fds_nth (fds liouville_lambda) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. liouville_lambda n = fds_nth (fds liouville_lambda) n
[PROOF STEP]
by (simp add: fds_nth_fds)
[PROOF STATE]
proof (state)
this:
liouville_lambda n = fds_nth (fds liouville_lambda) n

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
 2. n \<noteq> 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
liouville_lambda n = fds_nth (fds liouville_lambda) n

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
 2. n \<noteq> 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
[PROOF STEP]
have "fds liouville_lambda = fds_ind is_square * (fds moebius_mu :: 'a fds)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds liouville_lambda = fds_ind is_square * fds moebius_mu
[PROOF STEP]
by (rule fds_liouville_lambda)
[PROOF STATE]
proof (state)
this:
fds liouville_lambda = fds_ind is_square * fds moebius_mu

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
 2. n \<noteq> 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fds liouville_lambda = fds_ind is_square * fds moebius_mu

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
 2. n \<noteq> 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
[PROOF STEP]
have "fds_nth \<dots> n = (\<Sum>d | d dvd n. ind is_square d * moebius_mu (n div d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_nth (fds_ind is_square * fds moebius_mu) n = (\<Sum>d | d dvd n. ind is_square d * moebius_mu (n div d))
[PROOF STEP]
by (simp add: fds_nth_mult dirichlet_prod_def)
[PROOF STATE]
proof (state)
this:
fds_nth (fds_ind is_square * fds moebius_mu) n = (\<Sum>d | d dvd n. ind is_square d * moebius_mu (n div d))

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
 2. n \<noteq> 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fds_nth (fds_ind is_square * fds moebius_mu) n = (\<Sum>d | d dvd n. ind is_square d * moebius_mu (n div d))

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
 2. n \<noteq> 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
[PROOF STEP]
have "\<dots> = (\<Sum>d \<in> (\<lambda>d. d^2) ` {d. d ^ 2 dvd n}. moebius_mu (n div d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d | d dvd n. ind is_square d * moebius_mu (n div d)) = (\<Sum>d\<in>power2 ` {d. d\<^sup>2 dvd n}. moebius_mu (n div d))
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. (\<Sum>d | d dvd n. ind is_square d * moebius_mu (n div d)) = (\<Sum>d\<in>power2 ` {d. d\<^sup>2 dvd n}. moebius_mu (n div d))
[PROOF STEP]
by (intro sum.mono_neutral_cong_right) (auto simp: ind_def is_nth_power_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n. ind is_square d * moebius_mu (n div d)) = (\<Sum>d\<in>power2 ` {d. d\<^sup>2 dvd n}. moebius_mu (n div d))

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
 2. n \<noteq> 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>d | d dvd n. ind is_square d * moebius_mu (n div d)) = (\<Sum>d\<in>power2 ` {d. d\<^sup>2 dvd n}. moebius_mu (n div d))

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
 2. n \<noteq> 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
[PROOF STEP]
have "\<dots> = (\<Sum>d | d ^ 2 dvd n. moebius_mu (n div d ^ 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>d\<in>power2 ` {d. d\<^sup>2 dvd n}. moebius_mu (n div d)) = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
[PROOF STEP]
by (subst sum.reindex) (auto simp: inj_on_def dest: power2_eq_imp_eq)
[PROOF STATE]
proof (state)
this:
(\<Sum>d\<in>power2 ` {d. d\<^sup>2 dvd n}. moebius_mu (n div d)) = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
 2. n \<noteq> 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))

goal (1 subgoal):
 1. liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> liouville_lambda n = (\<Sum>d | d\<^sup>2 dvd n. moebius_mu (n div d\<^sup>2))
[PROOF STEP]
qed auto


[STATEMENT]
lemma nth_pow_wits_disjoint_pow_res:
  assumes  "m > 0"
  assumes "x \<in> nth_pow_wits m"
  assumes "y \<in> nth_pow_wits m"
  assumes "x \<noteq> y"
  shows "pow_res m x \<inter> pow_res m y =  {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pow_res m x \<inter> pow_res m y = {}
[PROOF STEP]
using assms nth_pow_wits_neq_pow_res disjoint_iff_not_equal
[PROOF STATE]
proof (prove)
using this:
0 < m
x \<in> nth_pow_wits m
y \<in> nth_pow_wits m
x \<noteq> y
\<lbrakk>0 < ?m; ?x \<in> nth_pow_wits ?m; ?y \<in> nth_pow_wits ?m; ?x \<noteq> ?y\<rbrakk> \<Longrightarrow> pow_res ?m ?x \<noteq> pow_res ?m ?y
(?A \<inter> ?B = {}) = (\<forall>x\<in>?A. \<forall>y\<in>?B. x \<noteq> y)

goal (1 subgoal):
 1. pow_res m x \<inter> pow_res m y = {}
[PROOF STEP]
by (metis (no_types, opaque_lifting) nth_pow_wits_closed(4) pow_res_classes_mem_eq)


[STATEMENT]
lemma integral_nonneg[simp]:
  fixes f :: "'a \<Rightarrow> real"
  shows "(\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> f x) \<Longrightarrow> 0 \<le> integral\<^sup>L M f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> f x) \<Longrightarrow> 0 \<le> integral\<^sup>L M f
[PROOF STEP]
by (intro integral_nonneg_AE) auto


[STATEMENT]
lemma graph_map_comp[simp]: "graph (m1 \<circ>\<^sub>m m2) = graph m2 O graph m1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. graph (m1 \<circ>\<^sub>m m2) = graph m2 O graph m1
[PROOF STEP]
unfolding graph_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(a, b) |a b. (m1 \<circ>\<^sub>m m2) a = Some b} = {(a, b) |a b. m2 a = Some b} O {(a, b) |a b. m1 a = Some b}
[PROOF STEP]
by (auto simp: map_comp_Some_iff relcomp_unfold)


[STATEMENT]
lemma QuadRes_set_prime:
  assumes "prime p" and "odd p"
  shows "{x . QuadRes p x \<and> x \<in> {0..<p}} = {x^2 mod p | x . x \<in> {0..(p-1) div 2}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. QuadRes p x \<and> x \<in> {0..<p}} = {x\<^sup>2 mod p |x. x \<in> {0..(p - 1) div 2}}
[PROOF STEP]
proof(safe, goal_cases)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>QuadRes p x; x \<in> {0..<p}\<rbrakk> \<Longrightarrow> \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}
 2. \<And>x xa. xa \<in> {0..(p - 1) div 2} \<Longrightarrow> QuadRes p (xa\<^sup>2 mod p)
 3. \<And>x xa. xa \<in> {0..(p - 1) div 2} \<Longrightarrow> xa\<^sup>2 mod p \<in> {0..<p}
[PROOF STEP]
case (1 x)
[PROOF STATE]
proof (state)
this:
QuadRes p x
x \<in> {0..<p}

goal (3 subgoals):
 1. \<And>x. \<lbrakk>QuadRes p x; x \<in> {0..<p}\<rbrakk> \<Longrightarrow> \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}
 2. \<And>x xa. xa \<in> {0..(p - 1) div 2} \<Longrightarrow> QuadRes p (xa\<^sup>2 mod p)
 3. \<And>x xa. xa \<in> {0..(p - 1) div 2} \<Longrightarrow> xa\<^sup>2 mod p \<in> {0..<p}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
QuadRes p x
x \<in> {0..<p}
[PROOF STEP]
obtain y where "[y\<^sup>2 = x] (mod p)"
[PROOF STATE]
proof (prove)
using this:
QuadRes p x
x \<in> {0..<p}

goal (1 subgoal):
 1. (\<And>y. [y\<^sup>2 = x] (mod p) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding QuadRes_def
[PROOF STATE]
proof (prove)
using this:
\<exists>y. [y\<^sup>2 = x] (mod p)
x \<in> {0..<p}

goal (1 subgoal):
 1. (\<And>y. [y\<^sup>2 = x] (mod p) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[y\<^sup>2 = x] (mod p)

goal (3 subgoals):
 1. \<And>x. \<lbrakk>QuadRes p x; x \<in> {0..<p}\<rbrakk> \<Longrightarrow> \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}
 2. \<And>x xa. xa \<in> {0..(p - 1) div 2} \<Longrightarrow> QuadRes p (xa\<^sup>2 mod p)
 3. \<And>x xa. xa \<in> {0..(p - 1) div 2} \<Longrightarrow> xa\<^sup>2 mod p \<in> {0..<p}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[y\<^sup>2 = x] (mod p)
[PROOF STEP]
have A: "[(y mod p)\<^sup>2 = x] (mod p)"
[PROOF STATE]
proof (prove)
using this:
[y\<^sup>2 = x] (mod p)

goal (1 subgoal):
 1. [(y mod p)\<^sup>2 = x] (mod p)
[PROOF STEP]
unfolding cong_def
[PROOF STATE]
proof (prove)
using this:
y\<^sup>2 mod p = x mod p

goal (1 subgoal):
 1. (y mod p)\<^sup>2 mod p = x mod p
[PROOF STEP]
by (simp add: power_mod)
[PROOF STATE]
proof (state)
this:
[(y mod p)\<^sup>2 = x] (mod p)

goal (3 subgoals):
 1. \<And>x. \<lbrakk>QuadRes p x; x \<in> {0..<p}\<rbrakk> \<Longrightarrow> \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}
 2. \<And>x xa. xa \<in> {0..(p - 1) div 2} \<Longrightarrow> QuadRes p (xa\<^sup>2 mod p)
 3. \<And>x xa. xa \<in> {0..(p - 1) div 2} \<Longrightarrow> xa\<^sup>2 mod p \<in> {0..<p}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[(y mod p)\<^sup>2 = x] (mod p)
[PROOF STEP]
have "[(-(y mod p))\<^sup>2 = x] (mod p)"
[PROOF STATE]
proof (prove)
using this:
[(y mod p)\<^sup>2 = x] (mod p)

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

goal (3 subgoals):
 1. \<And>x. \<lbrakk>QuadRes p x; x \<in> {0..<p}\<rbrakk> \<Longrightarrow> \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}
 2. \<And>x xa. xa \<in> {0..(p - 1) div 2} \<Longrightarrow> QuadRes p (xa\<^sup>2 mod p)
 3. \<And>x xa. xa \<in> {0..(p - 1) div 2} \<Longrightarrow> xa\<^sup>2 mod p \<in> {0..<p}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[(- (y mod p))\<^sup>2 = x] (mod p)
[PROOF STEP]
have B: "[(p - (y mod p))\<^sup>2 = x] (mod p)"
[PROOF STATE]
proof (prove)
using this:
[(- (y mod p))\<^sup>2 = x] (mod p)

goal (1 subgoal):
 1. [(p - y mod p)\<^sup>2 = x] (mod p)
[PROOF STEP]
unfolding cong_def
[PROOF STATE]
proof (prove)
using this:
(- (y mod p))\<^sup>2 mod p = x mod p

goal (1 subgoal):
 1. (p - y mod p)\<^sup>2 mod p = x mod p
[PROOF STEP]
using minus_mod_self1
[PROOF STATE]
proof (prove)
using this:
(- (y mod p))\<^sup>2 mod p = x mod p
(?b - ?a) mod ?b = - ?a mod ?b

goal (1 subgoal):
 1. (p - y mod p)\<^sup>2 mod p = x mod p
[PROOF STEP]
by (metis power_mod)
[PROOF STATE]
proof (state)
this:
[(p - y mod p)\<^sup>2 = x] (mod p)

goal (3 subgoals):
 1. \<And>x. \<lbrakk>QuadRes p x; x \<in> {0..<p}\<rbrakk> \<Longrightarrow> \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}
 2. \<And>x xa. xa \<in> {0..(p - 1) div 2} \<Longrightarrow> QuadRes p (xa\<^sup>2 mod p)
 3. \<And>x xa. xa \<in> {0..(p - 1) div 2} \<Longrightarrow> xa\<^sup>2 mod p \<in> {0..<p}
[PROOF STEP]
have "p = 1 + ((p - 1) div 2) * 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = 1 + (p - 1) div 2 * 2
[PROOF STEP]
using prime_gt_0_int[OF \<open>prime p\<close>] \<open>odd p\<close>
[PROOF STATE]
proof (prove)
using this:
0 < p
odd p

goal (1 subgoal):
 1. p = 1 + (p - 1) div 2 * 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p = 1 + (p - 1) div 2 * 2

goal (3 subgoals):
 1. \<And>x. \<lbrakk>QuadRes p x; x \<in> {0..<p}\<rbrakk> \<Longrightarrow> \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}
 2. \<And>x xa. xa \<in> {0..(p - 1) div 2} \<Longrightarrow> QuadRes p (xa\<^sup>2 mod p)
 3. \<And>x xa. xa \<in> {0..(p - 1) div 2} \<Longrightarrow> xa\<^sup>2 mod p \<in> {0..<p}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p = 1 + (p - 1) div 2 * 2
[PROOF STEP]
have C: "(p - (y mod p)) \<in> {0..(p - 1) div 2} \<or> y mod p \<in> {0..(p - 1) div 2}"
[PROOF STATE]
proof (prove)
using this:
p = 1 + (p - 1) div 2 * 2

goal (1 subgoal):
 1. p - y mod p \<in> {0..(p - 1) div 2} \<or> y mod p \<in> {0..(p - 1) div 2}
[PROOF STEP]
using prime_gt_0_int[OF \<open>prime p\<close>]
[PROOF STATE]
proof (prove)
using this:
p = 1 + (p - 1) div 2 * 2
0 < p

goal (1 subgoal):
 1. p - y mod p \<in> {0..(p - 1) div 2} \<or> y mod p \<in> {0..(p - 1) div 2}
[PROOF STEP]
by (clarsimp, auto simp: le_less)
[PROOF STATE]
proof (state)
this:
p - y mod p \<in> {0..(p - 1) div 2} \<or> y mod p \<in> {0..(p - 1) div 2}

goal (3 subgoals):
 1. \<And>x. \<lbrakk>QuadRes p x; x \<in> {0..<p}\<rbrakk> \<Longrightarrow> \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}
 2. \<And>x xa. xa \<in> {0..(p - 1) div 2} \<Longrightarrow> QuadRes p (xa\<^sup>2 mod p)
 3. \<And>x xa. xa \<in> {0..(p - 1) div 2} \<Longrightarrow> xa\<^sup>2 mod p \<in> {0..<p}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p - y mod p \<in> {0..(p - 1) div 2} \<or> y mod p \<in> {0..(p - 1) div 2}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
p - y mod p \<in> {0..(p - 1) div 2} \<or> y mod p \<in> {0..(p - 1) div 2}

goal (1 subgoal):
 1. \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p - y mod p \<in> {0..(p - 1) div 2} \<Longrightarrow> \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}
 2. y mod p \<in> {0..(p - 1) div 2} \<Longrightarrow> \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}
[PROOF STEP]
show ?thesis if "p - y mod p \<in> {0..(p - 1) div 2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}
[PROOF STEP]
using that B
[PROOF STATE]
proof (prove)
using this:
p - y mod p \<in> {0..(p - 1) div 2}
[(p - y mod p)\<^sup>2 = x] (mod p)

goal (1 subgoal):
 1. \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}
[PROOF STEP]
unfolding cong_def
[PROOF STATE]
proof (prove)
using this:
p - y mod p \<in> {0..(p - 1) div 2}
(p - y mod p)\<^sup>2 mod p = x mod p

goal (1 subgoal):
 1. \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}
[PROOF STEP]
using \<open>x \<in> {0..<p}\<close>
[PROOF STATE]
proof (prove)
using this:
p - y mod p \<in> {0..(p - 1) div 2}
(p - y mod p)\<^sup>2 mod p = x mod p
x \<in> {0..<p}

goal (1 subgoal):
 1. \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p - y mod p \<in> {0..(p - 1) div 2} \<Longrightarrow> \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}

goal (1 subgoal):
 1. y mod p \<in> {0..(p - 1) div 2} \<Longrightarrow> \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}
[PROOF STEP]
show ?thesis if "y mod p \<in> {0..(p - 1) div 2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}
[PROOF STEP]
using that A
[PROOF STATE]
proof (prove)
using this:
y mod p \<in> {0..(p - 1) div 2}
[(y mod p)\<^sup>2 = x] (mod p)

goal (1 subgoal):
 1. \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}
[PROOF STEP]
unfolding cong_def
[PROOF STATE]
proof (prove)
using this:
y mod p \<in> {0..(p - 1) div 2}
(y mod p)\<^sup>2 mod p = x mod p

goal (1 subgoal):
 1. \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}
[PROOF STEP]
using \<open>x \<in> {0..<p}\<close>
[PROOF STATE]
proof (prove)
using this:
y mod p \<in> {0..(p - 1) div 2}
(y mod p)\<^sup>2 mod p = x mod p
x \<in> {0..<p}

goal (1 subgoal):
 1. \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y mod p \<in> {0..(p - 1) div 2} \<Longrightarrow> \<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>xa. x = xa\<^sup>2 mod p \<and> xa \<in> {0..(p - 1) div 2}

goal (2 subgoals):
 1. \<And>x xa. xa \<in> {0..(p - 1) div 2} \<Longrightarrow> QuadRes p (xa\<^sup>2 mod p)
 2. \<And>x xa. xa \<in> {0..(p - 1) div 2} \<Longrightarrow> xa\<^sup>2 mod p \<in> {0..<p}
[PROOF STEP]
qed (auto simp: QuadRes_def cong_def)


[STATEMENT]
lemma zero_le_ceiling [simp]: "0 \<le> \<lceil>x\<rceil> \<longleftrightarrow> -1 < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<le> \<lceil>x\<rceil>) = (- (1::'a) < x)
[PROOF STEP]
by (simp add: le_ceiling_iff)


[STATEMENT]
lemma has_sum_0:
  assumes \<open>\<And>x. x\<in>M \<Longrightarrow> f x = 0\<close>
  shows \<open>has_sum f M 0\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_sum f M (0::'b)
[PROOF STEP]
unfolding has_sum_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sum f \<longlongrightarrow> (0::'b)) (finite_subsets_at_top M)
[PROOF STEP]
apply (subst tendsto_cong[where g=\<open>\<lambda>_. 0\<close>])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>\<^sub>F x in finite_subsets_at_top M. sum f x = (0::'b)
 2. ((\<lambda>_. 0::'b) \<longlongrightarrow> (0::'b)) (finite_subsets_at_top M)
[PROOF STEP]
apply (rule eventually_finite_subsets_at_top_weakI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>X. \<lbrakk>finite X; X \<subseteq> M\<rbrakk> \<Longrightarrow> sum f X = (0::'b)
 2. ((\<lambda>_. 0::'b) \<longlongrightarrow> (0::'b)) (finite_subsets_at_top M)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> M \<Longrightarrow> f ?x = (0::'b)

goal (2 subgoals):
 1. \<And>X. \<lbrakk>finite X; X \<subseteq> M\<rbrakk> \<Longrightarrow> sum f X = (0::'b)
 2. ((\<lambda>_. 0::'b) \<longlongrightarrow> (0::'b)) (finite_subsets_at_top M)
[PROOF STEP]
by (auto simp add: subset_iff)


[STATEMENT]
lemma mod_plus_minus_rep:
  obtains k where "x = k*b + x mod+- b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. x = k * b + x mod+- b \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding mod_plus_minus_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. x = k * b + ((x + \<lfloor>real_of_int b / 2\<rfloor>) mod b - \<lfloor>real_of_int b / 2\<rfloor>) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis add.commute add_diff_eq diff_eq_eq
  minus_mult_div_eq_mod mult.commute)


[STATEMENT]
lemma vec_smult_distr_left:
assumes "length as = length bs"
shows "vec_smult \<alpha> (vec_plus as bs) = vec_plus (vec_smult \<alpha> as) (vec_smult \<alpha> bs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_smult \<alpha> (vec_plus as bs) = vec_plus (vec_smult \<alpha> as) (vec_smult \<alpha> bs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length as = length bs

goal (1 subgoal):
 1. vec_smult \<alpha> (vec_plus as bs) = vec_plus (vec_smult \<alpha> as) (vec_smult \<alpha> bs)
[PROOF STEP]
proof (induction as arbitrary:bs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>bs. length [] = length bs \<Longrightarrow> vec_smult \<alpha> (vec_plus [] bs) = vec_plus (vec_smult \<alpha> []) (vec_smult \<alpha> bs)
 2. \<And>a as bs. \<lbrakk>\<And>bs. length as = length bs \<Longrightarrow> vec_smult \<alpha> (vec_plus as bs) = vec_plus (vec_smult \<alpha> as) (vec_smult \<alpha> bs); length (a # as) = length bs\<rbrakk> \<Longrightarrow> vec_smult \<alpha> (vec_plus (a # as) bs) = vec_plus (vec_smult \<alpha> (a # as)) (vec_smult \<alpha> bs)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
length [] = length bs

goal (2 subgoals):
 1. \<And>bs. length [] = length bs \<Longrightarrow> vec_smult \<alpha> (vec_plus [] bs) = vec_plus (vec_smult \<alpha> []) (vec_smult \<alpha> bs)
 2. \<And>a as bs. \<lbrakk>\<And>bs. length as = length bs \<Longrightarrow> vec_smult \<alpha> (vec_plus as bs) = vec_plus (vec_smult \<alpha> as) (vec_smult \<alpha> bs); length (a # as) = length bs\<rbrakk> \<Longrightarrow> vec_smult \<alpha> (vec_plus (a # as) bs) = vec_plus (vec_smult \<alpha> (a # as)) (vec_smult \<alpha> bs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length [] = length bs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length [] = length bs

goal (1 subgoal):
 1. vec_smult \<alpha> (vec_plus [] bs) = vec_plus (vec_smult \<alpha> []) (vec_smult \<alpha> bs)
[PROOF STEP]
unfolding vec_smult_def vec_plus_def
[PROOF STATE]
proof (prove)
using this:
length [] = length bs

goal (1 subgoal):
 1. map ((*) \<alpha>) (map2 (+) [] bs) = map2 (+) (map ((*) \<alpha>) []) (map ((*) \<alpha>) bs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
vec_smult \<alpha> (vec_plus [] bs) = vec_plus (vec_smult \<alpha> []) (vec_smult \<alpha> bs)

goal (1 subgoal):
 1. \<And>a as bs. \<lbrakk>\<And>bs. length as = length bs \<Longrightarrow> vec_smult \<alpha> (vec_plus as bs) = vec_plus (vec_smult \<alpha> as) (vec_smult \<alpha> bs); length (a # as) = length bs\<rbrakk> \<Longrightarrow> vec_smult \<alpha> (vec_plus (a # as) bs) = vec_plus (vec_smult \<alpha> (a # as)) (vec_smult \<alpha> bs)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a as bs. \<lbrakk>\<And>bs. length as = length bs \<Longrightarrow> vec_smult \<alpha> (vec_plus as bs) = vec_plus (vec_smult \<alpha> as) (vec_smult \<alpha> bs); length (a # as) = length bs\<rbrakk> \<Longrightarrow> vec_smult \<alpha> (vec_plus (a # as) bs) = vec_plus (vec_smult \<alpha> (a # as)) (vec_smult \<alpha> bs)
[PROOF STEP]
case (Cons a as')
[PROOF STATE]
proof (state)
this:
length as' = length ?bs \<Longrightarrow> vec_smult \<alpha> (vec_plus as' ?bs) = vec_plus (vec_smult \<alpha> as') (vec_smult \<alpha> ?bs)
length (a # as') = length bs

goal (1 subgoal):
 1. \<And>a as bs. \<lbrakk>\<And>bs. length as = length bs \<Longrightarrow> vec_smult \<alpha> (vec_plus as bs) = vec_plus (vec_smult \<alpha> as) (vec_smult \<alpha> bs); length (a # as) = length bs\<rbrakk> \<Longrightarrow> vec_smult \<alpha> (vec_plus (a # as) bs) = vec_plus (vec_smult \<alpha> (a # as)) (vec_smult \<alpha> bs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length as' = length ?bs \<Longrightarrow> vec_smult \<alpha> (vec_plus as' ?bs) = vec_plus (vec_smult \<alpha> as') (vec_smult \<alpha> ?bs)
length (a # as') = length bs
[PROOF STEP]
obtain b bs' where "bs = b # bs'"
[PROOF STATE]
proof (prove)
using this:
length as' = length ?bs \<Longrightarrow> vec_smult \<alpha> (vec_plus as' ?bs) = vec_plus (vec_smult \<alpha> as') (vec_smult \<alpha> ?bs)
length (a # as') = length bs

goal (1 subgoal):
 1. (\<And>b bs'. bs = b # bs' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis Suc_length_conv)
[PROOF STATE]
proof (state)
this:
bs = b # bs'

goal (1 subgoal):
 1. \<And>a as bs. \<lbrakk>\<And>bs. length as = length bs \<Longrightarrow> vec_smult \<alpha> (vec_plus as bs) = vec_plus (vec_smult \<alpha> as) (vec_smult \<alpha> bs); length (a # as) = length bs\<rbrakk> \<Longrightarrow> vec_smult \<alpha> (vec_plus (a # as) bs) = vec_plus (vec_smult \<alpha> (a # as)) (vec_smult \<alpha> bs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bs = b # bs'
[PROOF STEP]
have 0:"vec_smult \<alpha> (vec_plus (a # as') bs) = (\<alpha>*(a+b)) # vec_smult \<alpha> (vec_plus as' bs')"
[PROOF STATE]
proof (prove)
using this:
bs = b # bs'

goal (1 subgoal):
 1. vec_smult \<alpha> (vec_plus (a # as') bs) = \<alpha> * (a + b) # vec_smult \<alpha> (vec_plus as' bs')
[PROOF STEP]
unfolding vec_smult_def vec_plus_def
[PROOF STATE]
proof (prove)
using this:
bs = b # bs'

goal (1 subgoal):
 1. map ((*) \<alpha>) (map2 (+) (a # as') bs) = \<alpha> * (a + b) # map ((*) \<alpha>) (map2 (+) as' bs')
[PROOF STEP]
using Cons.IH[of bs']
[PROOF STATE]
proof (prove)
using this:
bs = b # bs'
length as' = length bs' \<Longrightarrow> vec_smult \<alpha> (vec_plus as' bs') = vec_plus (vec_smult \<alpha> as') (vec_smult \<alpha> bs')

goal (1 subgoal):
 1. map ((*) \<alpha>) (map2 (+) (a # as') bs) = \<alpha> * (a + b) # map ((*) \<alpha>) (map2 (+) as' bs')
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
vec_smult \<alpha> (vec_plus (a # as') bs) = \<alpha> * (a + b) # vec_smult \<alpha> (vec_plus as' bs')

goal (1 subgoal):
 1. \<And>a as bs. \<lbrakk>\<And>bs. length as = length bs \<Longrightarrow> vec_smult \<alpha> (vec_plus as bs) = vec_plus (vec_smult \<alpha> as) (vec_smult \<alpha> bs); length (a # as) = length bs\<rbrakk> \<Longrightarrow> vec_smult \<alpha> (vec_plus (a # as) bs) = vec_plus (vec_smult \<alpha> (a # as)) (vec_smult \<alpha> bs)
[PROOF STEP]
have "length bs' = length as'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length bs' = length as'
[PROOF STEP]
using Cons.prems \<open>bs = b # bs'\<close>
[PROOF STATE]
proof (prove)
using this:
length (a # as') = length bs
bs = b # bs'

goal (1 subgoal):
 1. length bs' = length as'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length bs' = length as'

goal (1 subgoal):
 1. \<And>a as bs. \<lbrakk>\<And>bs. length as = length bs \<Longrightarrow> vec_smult \<alpha> (vec_plus as bs) = vec_plus (vec_smult \<alpha> as) (vec_smult \<alpha> bs); length (a # as) = length bs\<rbrakk> \<Longrightarrow> vec_smult \<alpha> (vec_plus (a # as) bs) = vec_plus (vec_smult \<alpha> (a # as)) (vec_smult \<alpha> bs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length bs' = length as'
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length bs' = length as'

goal (1 subgoal):
 1. vec_smult \<alpha> (vec_plus (a # as') bs) = vec_plus (vec_smult \<alpha> (a # as')) (vec_smult \<alpha> bs)
[PROOF STEP]
unfolding 0
[PROOF STATE]
proof (prove)
using this:
length bs' = length as'

goal (1 subgoal):
 1. \<alpha> * (a + b) # vec_smult \<alpha> (vec_plus as' bs') = vec_plus (vec_smult \<alpha> (a # as')) (vec_smult \<alpha> bs)
[PROOF STEP]
unfolding  \<open>bs = b # bs'\<close> vec_smult_Cons vec_plus_Cons
[PROOF STATE]
proof (prove)
using this:
length bs' = length as'

goal (1 subgoal):
 1. \<alpha> * (a + b) # vec_smult \<alpha> (vec_plus as' bs') = (\<alpha> * a + \<alpha> * b) # vec_plus (vec_smult \<alpha> as') (vec_smult \<alpha> bs')
[PROOF STEP]
by (simp add: Cons.IH distrib_left)
[PROOF STATE]
proof (state)
this:
vec_smult \<alpha> (vec_plus (a # as') bs) = vec_plus (vec_smult \<alpha> (a # as')) (vec_smult \<alpha> bs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma algebraic_sum_list [intro]:
  "(\<And>x. x \<in> set xs \<Longrightarrow> algebraic x) \<Longrightarrow> algebraic (sum_list xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> set xs \<Longrightarrow> algebraic x) \<Longrightarrow> algebraic (sum_list xs)
[PROOF STEP]
by (induction xs) (auto intro!: algebraic_plus)


[STATEMENT]
lemma convex_halfspace_lt: "convex {x. inner a x < b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex {x. a \<bullet> x < b}
[PROOF STEP]
unfolding convex_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{x. a \<bullet> x < b}. \<forall>y\<in>{x. a \<bullet> x < b}. \<forall>u\<ge>0. \<forall>v\<ge>0. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> {x. a \<bullet> x < b}
[PROOF STEP]
by (auto simp: convex_bound_lt inner_add)


[STATEMENT]
lemma Arg2pi_cnj: "Arg2pi(cnj z) = (if z \<in> \<real> then Arg2pi z else 2*pi - Arg2pi z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg2pi (cnj z) = (if z \<in> \<real> then Arg2pi z else 2 * pi - Arg2pi z)
[PROOF STEP]
proof (cases "z=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z = 0 \<Longrightarrow> Arg2pi (cnj z) = (if z \<in> \<real> then Arg2pi z else 2 * pi - Arg2pi z)
 2. z \<noteq> 0 \<Longrightarrow> Arg2pi (cnj z) = (if z \<in> \<real> then Arg2pi z else 2 * pi - Arg2pi z)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
z \<noteq> 0

goal (2 subgoals):
 1. z = 0 \<Longrightarrow> Arg2pi (cnj z) = (if z \<in> \<real> then Arg2pi z else 2 * pi - Arg2pi z)
 2. z \<noteq> 0 \<Longrightarrow> Arg2pi (cnj z) = (if z \<in> \<real> then Arg2pi z else 2 * pi - Arg2pi z)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
z \<noteq> 0

goal (1 subgoal):
 1. Arg2pi (cnj z) = (if z \<in> \<real> then Arg2pi z else 2 * pi - Arg2pi z)
[PROOF STEP]
by (simp add: Arg2pi_cnj_eq_inverse Arg2pi_inverse)
[PROOF STATE]
proof (state)
this:
Arg2pi (cnj z) = (if z \<in> \<real> then Arg2pi z else 2 * pi - Arg2pi z)

goal (1 subgoal):
 1. z = 0 \<Longrightarrow> Arg2pi (cnj z) = (if z \<in> \<real> then Arg2pi z else 2 * pi - Arg2pi z)
[PROOF STEP]
qed auto


[STATEMENT]
lemma proj_list_5_same:
  assumes "proj_list_5 xs (ys, w, ws, z, zs) = (ys', w', ws', z', zs')"
    "length xs = length ys + 1 + length ws + 1 + length zs"
  shows "xs = ys' @ w' # ws' @ z' # zs'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs = ys' @ w' # ws' @ z' # zs'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. xs = ys' @ w' # ws' @ z' # zs'
[PROOF STEP]
have "xs ! length ys # take (length ws) (drop (Suc (length ys)) xs) = take (Suc (length ws)) (drop (length ys) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs ! length ys # take (length ws) (drop (Suc (length ys)) xs) = take (Suc (length ws)) (drop (length ys) xs)
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
length xs = length ys + 1 + length ws + 1 + length zs

goal (1 subgoal):
 1. xs ! length ys # take (length ws) (drop (Suc (length ys)) xs) = take (Suc (length ws)) (drop (length ys) xs)
[PROOF STEP]
by (simp add: list_eq_iff_nth_eq nth_Cons split: nat.split)
[PROOF STATE]
proof (state)
this:
xs ! length ys # take (length ws) (drop (Suc (length ys)) xs) = take (Suc (length ws)) (drop (length ys) xs)

goal (1 subgoal):
 1. xs = ys' @ w' # ws' @ z' # zs'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
xs ! length ys # take (length ws) (drop (Suc (length ys)) xs) = take (Suc (length ws)) (drop (length ys) xs)

goal (1 subgoal):
 1. xs = ys' @ w' # ws' @ z' # zs'
[PROOF STEP]
have "take (Suc (length ws)) (drop (length ys) xs) @ drop (Suc (length ys + length ws)) xs =
      drop (length ys) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take (Suc (length ws)) (drop (length ys) xs) @ drop (Suc (length ys + length ws)) xs = drop (length ys) xs
[PROOF STEP]
unfolding Suc_eq_plus1 add.assoc[of _ _ 1] add.commute[of _ "length ws + 1"]
      drop_drop[symmetric, of "length ws + 1"] append_take_drop_id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop (length ys) xs = drop (length ys) xs
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
take (Suc (length ws)) (drop (length ys) xs) @ drop (Suc (length ys + length ws)) xs = drop (length ys) xs

goal (1 subgoal):
 1. xs = ys' @ w' # ws' @ z' # zs'
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
xs ! length ys # take (length ws) (drop (Suc (length ys)) xs) = take (Suc (length ws)) (drop (length ys) xs)
take (Suc (length ws)) (drop (length ys) xs) @ drop (Suc (length ys + length ws)) xs = drop (length ys) xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
xs ! length ys # take (length ws) (drop (Suc (length ys)) xs) = take (Suc (length ws)) (drop (length ys) xs)
take (Suc (length ws)) (drop (length ys) xs) @ drop (Suc (length ys + length ws)) xs = drop (length ys) xs

goal (1 subgoal):
 1. xs = ys' @ w' # ws' @ z' # zs'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
xs ! length ys # take (length ws) (drop (Suc (length ys)) xs) = take (Suc (length ws)) (drop (length ys) xs)
take (Suc (length ws)) (drop (length ys) xs) @ drop (Suc (length ys + length ws)) xs = drop (length ys) xs
proj_list_5 xs (ys, w, ws, z, zs) = (ys', w', ws', z', zs')
length xs = length ys + 1 + length ws + 1 + length zs

goal (1 subgoal):
 1. xs = ys' @ w' # ws' @ z' # zs'
[PROOF STEP]
by (auto simp: Cons_nth_drop_Suc append_Cons[symmetric])
[PROOF STATE]
proof (state)
this:
xs = ys' @ w' # ws' @ z' # zs'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prod_prime_factors:
  assumes "n > 0"
  shows   "f n = (\<Prod>p\<in>prime_factors n. f (p ^ multiplicity p n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f n = (\<Prod>p\<in>prime_factors n. f (p ^ multiplicity p n))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f n = (\<Prod>p\<in>prime_factors n. f (p ^ multiplicity p n))
[PROOF STEP]
have "n = (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n = (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n)
[PROOF STEP]
using Primes.prime_factorization_nat assms
[PROOF STATE]
proof (prove)
using this:
0 < ?n \<Longrightarrow> ?n = (\<Prod>p\<in>prime_factors ?n. p ^ multiplicity p ?n)
0 < n

goal (1 subgoal):
 1. n = (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
n = (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n)

goal (1 subgoal):
 1. f n = (\<Prod>p\<in>prime_factors n. f (p ^ multiplicity p n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n = (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n)

goal (1 subgoal):
 1. f n = (\<Prod>p\<in>prime_factors n. f (p ^ multiplicity p n))
[PROOF STEP]
have "f \<dots> = (\<Prod>p\<in>prime_factors n. f (p ^ multiplicity p n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n) = (\<Prod>p\<in>prime_factors n. f (p ^ multiplicity p n))
[PROOF STEP]
by (rule prod_coprime) (auto simp add: in_prime_factors_imp_prime primes_coprime)
[PROOF STATE]
proof (state)
this:
f (\<Prod>p\<in>prime_factors n. p ^ multiplicity p n) = (\<Prod>p\<in>prime_factors n. f (p ^ multiplicity p n))

goal (1 subgoal):
 1. f n = (\<Prod>p\<in>prime_factors n. f (p ^ multiplicity p n))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f n = (\<Prod>p\<in>prime_factors n. f (p ^ multiplicity p n))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f n = (\<Prod>p\<in>prime_factors n. f (p ^ multiplicity p n))

goal (1 subgoal):
 1. f n = (\<Prod>p\<in>prime_factors n. f (p ^ multiplicity p n))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
f n = (\<Prod>p\<in>prime_factors n. f (p ^ multiplicity p n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fmrel_tranclp_trans_induct:
  "fmrel r\<^sup>+\<^sup>+ a b \<Longrightarrow>
   reflp r \<Longrightarrow>
   (\<And>x y. fmrel r x y \<Longrightarrow> P x y) \<Longrightarrow>
   (\<And>x y z. fmrel r\<^sup>+\<^sup>+ x y \<Longrightarrow> P x y \<Longrightarrow> fmrel r\<^sup>+\<^sup>+ y z \<Longrightarrow> P y z \<Longrightarrow> P x z) \<Longrightarrow>
   P a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>fmrel r\<^sup>+\<^sup>+ a b; reflp r; \<And>x y. fmrel r x y \<Longrightarrow> P x y; \<And>x y z. \<lbrakk>fmrel r\<^sup>+\<^sup>+ x y; P x y; fmrel r\<^sup>+\<^sup>+ y z; P y z\<rbrakk> \<Longrightarrow> P x z\<rbrakk> \<Longrightarrow> P a b
[PROOF STEP]
apply (drule fmrel_to_trancl, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>fmrel r\<^sup>+\<^sup>+ a b; \<And>x y. fmrel r x y \<Longrightarrow> P x y; \<And>x y z. \<lbrakk>fmrel r\<^sup>+\<^sup>+ x y; P x y; fmrel r\<^sup>+\<^sup>+ y z; P y z\<rbrakk> \<Longrightarrow> P x z; (fmrel r)\<^sup>+\<^sup>+ a b\<rbrakk> \<Longrightarrow> P a b
[PROOF STEP]
apply (erule tranclp_trans_induct, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y z. \<lbrakk>fmrel r\<^sup>+\<^sup>+ a b; \<And>x y. fmrel r x y \<Longrightarrow> P x y; \<And>x y z. \<lbrakk>fmrel r\<^sup>+\<^sup>+ x y; P x y; fmrel r\<^sup>+\<^sup>+ y z; P y z\<rbrakk> \<Longrightarrow> P x z; (fmrel r)\<^sup>+\<^sup>+ x y; P x y; (fmrel r)\<^sup>+\<^sup>+ y z; P y z\<rbrakk> \<Longrightarrow> P x z
[PROOF STEP]
using trancl_to_fmrel
[PROOF STATE]
proof (prove)
using this:
(fmrel ?f)\<^sup>+\<^sup>+ ?xm ?ym \<Longrightarrow> fmrel ?f\<^sup>+\<^sup>+ ?xm ?ym

goal (1 subgoal):
 1. \<And>x y z. \<lbrakk>fmrel r\<^sup>+\<^sup>+ a b; \<And>x y. fmrel r x y \<Longrightarrow> P x y; \<And>x y z. \<lbrakk>fmrel r\<^sup>+\<^sup>+ x y; P x y; fmrel r\<^sup>+\<^sup>+ y z; P y z\<rbrakk> \<Longrightarrow> P x z; (fmrel r)\<^sup>+\<^sup>+ x y; P x y; (fmrel r)\<^sup>+\<^sup>+ y z; P y z\<rbrakk> \<Longrightarrow> P x z
[PROOF STEP]
by blast


[STATEMENT]
lemma Fourier_coefficient_diff:
  assumes f: "f absolutely_integrable_on {-pi..pi}" and g: "g absolutely_integrable_on {-pi..pi}"
  shows "Fourier_coefficient (\<lambda>x. f x - g x) i = Fourier_coefficient f i - Fourier_coefficient g i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fourier_coefficient (\<lambda>x. f x - g x) i = Fourier_coefficient f i - Fourier_coefficient g i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Fourier_coefficient (\<lambda>x. f x - g x) i = Fourier_coefficient f i - Fourier_coefficient g i
[PROOF STEP]
have mg: "(\<lambda>x. - g x) absolutely_integrable_on {-pi..pi}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. - g x) absolutely_integrable_on {- pi..pi}
[PROOF STEP]
using g
[PROOF STATE]
proof (prove)
using this:
g absolutely_integrable_on {- pi..pi}

goal (1 subgoal):
 1. (\<lambda>x. - g x) absolutely_integrable_on {- pi..pi}
[PROOF STEP]
by (simp add: absolutely_integrable_measurable_real)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. - g x) absolutely_integrable_on {- pi..pi}

goal (1 subgoal):
 1. Fourier_coefficient (\<lambda>x. f x - g x) i = Fourier_coefficient f i - Fourier_coefficient g i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fourier_coefficient (\<lambda>x. f x - g x) i = Fourier_coefficient f i - Fourier_coefficient g i
[PROOF STEP]
using Fourier_coefficient_add [OF f mg] Fourier_coefficient_minus [OF g]
[PROOF STATE]
proof (prove)
using this:
Fourier_coefficient (\<lambda>x. f x + - g x) ?i = Fourier_coefficient f ?i + Fourier_coefficient (\<lambda>x. - g x) ?i
Fourier_coefficient (\<lambda>x. - g x) ?i = - Fourier_coefficient g ?i

goal (1 subgoal):
 1. Fourier_coefficient (\<lambda>x. f x - g x) i = Fourier_coefficient f i - Fourier_coefficient g i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Fourier_coefficient (\<lambda>x. f x - g x) i = Fourier_coefficient f i - Fourier_coefficient g i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cong_gcd_eq_1_nat:
  fixes a b :: nat
  assumes "0 < m" and cong_props: "[a ^ m = 1] (mod b)" "[a ^ n = 1] (mod b)"
  shows "[a ^ gcd m n = 1] (mod b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a ^ gcd m n = 1] (mod b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [a ^ gcd m n = 1] (mod b)
[PROOF STEP]
obtain c d where gcd: "m * c = n * d + gcd m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c d. m * c = n * d + gcd m n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using bezout_nat[of m n] \<open>0 < m\<close>
[PROOF STATE]
proof (prove)
using this:
m \<noteq> 0 \<Longrightarrow> \<exists>x y. m * x = n * y + gcd m n
0 < m

goal (1 subgoal):
 1. (\<And>c d. m * c = n * d + gcd m n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m * c = n * d + gcd m n

goal (1 subgoal):
 1. [a ^ gcd m n = 1] (mod b)
[PROOF STEP]
have cong_m: "[a ^ (m * c) = 1] (mod b)" and cong_n: "[a ^ (n * d) = 1] (mod b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a ^ (m * c) = 1] (mod b) &&& [a ^ (n * d) = 1] (mod b)
[PROOF STEP]
using cong_props
[PROOF STATE]
proof (prove)
using this:
[a ^ m = 1] (mod b)
[a ^ n = 1] (mod b)

goal (1 subgoal):
 1. [a ^ (m * c) = 1] (mod b) &&& [a ^ (n * d) = 1] (mod b)
[PROOF STEP]
by (simp_all only: cong_pow_1_nat power_mult)
[PROOF STATE]
proof (state)
this:
[a ^ (m * c) = 1] (mod b)
[a ^ (n * d) = 1] (mod b)

goal (1 subgoal):
 1. [a ^ gcd m n = 1] (mod b)
[PROOF STEP]
have "[1 * a ^ gcd m n = a ^ (n * d) * a ^ gcd m n] (mod b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [1 * a ^ gcd m n = a ^ (n * d) * a ^ gcd m n] (mod b)
[PROOF STEP]
by (rule cong_scalar_right, rule cong_sym) (fact cong_n)
[PROOF STATE]
proof (state)
this:
[1 * a ^ gcd m n = a ^ (n * d) * a ^ gcd m n] (mod b)

goal (1 subgoal):
 1. [a ^ gcd m n = 1] (mod b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[1 * a ^ gcd m n = a ^ (n * d) * a ^ gcd m n] (mod b)

goal (1 subgoal):
 1. [a ^ gcd m n = 1] (mod b)
[PROOF STEP]
have "[a ^ (n * d) * a ^ gcd m n = a ^ (m * c)] (mod b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a ^ (n * d) * a ^ gcd m n = a ^ (m * c)] (mod b)
[PROOF STEP]
using gcd
[PROOF STATE]
proof (prove)
using this:
m * c = n * d + gcd m n

goal (1 subgoal):
 1. [a ^ (n * d) * a ^ gcd m n = a ^ (m * c)] (mod b)
[PROOF STEP]
by (simp add: power_add)
[PROOF STATE]
proof (state)
this:
[a ^ (n * d) * a ^ gcd m n = a ^ (m * c)] (mod b)

goal (1 subgoal):
 1. [a ^ gcd m n = 1] (mod b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[a ^ (n * d) * a ^ gcd m n = a ^ (m * c)] (mod b)

goal (1 subgoal):
 1. [a ^ gcd m n = 1] (mod b)
[PROOF STEP]
have "[a ^ (m * c) = 1] (mod b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a ^ (m * c) = 1] (mod b)
[PROOF STEP]
using cong_m
[PROOF STATE]
proof (prove)
using this:
[a ^ (m * c) = 1] (mod b)

goal (1 subgoal):
 1. [a ^ (m * c) = 1] (mod b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[a ^ (m * c) = 1] (mod b)

goal (1 subgoal):
 1. [a ^ gcd m n = 1] (mod b)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[1 * a ^ gcd m n = 1] (mod b)
[PROOF STEP]
show "[a ^ gcd m n = 1] (mod b)"
[PROOF STATE]
proof (prove)
using this:
[1 * a ^ gcd m n = 1] (mod b)

goal (1 subgoal):
 1. [a ^ gcd m n = 1] (mod b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[a ^ gcd m n = 1] (mod b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cospoly_lower:
     "cospoly (Suc (Suc (Suc (4*n)))) x \<le> cos x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cospoly (Suc (Suc (Suc (4 * n)))) x \<le> cos x
[PROOF STEP]
proof (cases rule: le_cases [of 0 x])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> x \<Longrightarrow> cospoly (Suc (Suc (Suc (4 * n)))) x \<le> cos x
 2. x \<le> 0 \<Longrightarrow> cospoly (Suc (Suc (Suc (4 * n)))) x \<le> cos x
[PROOF STEP]
case le
[PROOF STATE]
proof (state)
this:
0 \<le> x

goal (2 subgoals):
 1. 0 \<le> x \<Longrightarrow> cospoly (Suc (Suc (Suc (4 * n)))) x \<le> cos x
 2. x \<le> 0 \<Longrightarrow> cospoly (Suc (Suc (Suc (4 * n)))) x \<le> cos x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> x

goal (1 subgoal):
 1. cospoly (Suc (Suc (Suc (4 * n)))) x \<le> cos x
[PROOF STEP]
by (simp add: cospoly_lower_nonneg)
[PROOF STATE]
proof (state)
this:
cospoly (Suc (Suc (Suc (4 * n)))) x \<le> cos x

goal (1 subgoal):
 1. x \<le> 0 \<Longrightarrow> cospoly (Suc (Suc (Suc (4 * n)))) x \<le> cos x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<le> 0 \<Longrightarrow> cospoly (Suc (Suc (Suc (4 * n)))) x \<le> cos x
[PROOF STEP]
case ge
[PROOF STATE]
proof (state)
this:
x \<le> 0

goal (1 subgoal):
 1. x \<le> 0 \<Longrightarrow> cospoly (Suc (Suc (Suc (4 * n)))) x \<le> cos x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<le> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<le> 0

goal (1 subgoal):
 1. cospoly (Suc (Suc (Suc (4 * n)))) x \<le> cos x
[PROOF STEP]
using cospoly_lower_nonneg [of "-x"]
[PROOF STATE]
proof (prove)
using this:
x \<le> 0
0 \<le> - x \<Longrightarrow> cospoly (Suc (Suc (Suc (4 * ?n)))) (- x) \<le> cos (- x)

goal (1 subgoal):
 1. cospoly (Suc (Suc (Suc (4 * n)))) x \<le> cos x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cospoly (Suc (Suc (Suc (4 * n)))) x \<le> cos x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cyclic_subset:
  "\<lbrakk> \<not> acyclic R; R \<subseteq> S \<rbrakk> \<Longrightarrow> \<not> acyclic S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> acyclic R; R \<subseteq> S\<rbrakk> \<Longrightarrow> \<not> acyclic S
[PROOF STEP]
unfolding acyclic_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> (\<forall>x. (x, x) \<notin> R\<^sup>+); R \<subseteq> S\<rbrakk> \<Longrightarrow> \<not> (\<forall>x. (x, x) \<notin> S\<^sup>+)
[PROOF STEP]
by (blast intro: trancl_mono)


[STATEMENT]
lemma ring_hom_zero:
  fixes R (structure) and S (structure)
  assumes "h \<in> ring_hom R S" "ring R" "ring S"
  shows "h \<zero> = \<zero>\<^bsub>S\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h \<zero> = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. h \<zero> = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
have "h \<zero> = h \<zero> \<oplus>\<^bsub>S\<^esub> h \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h \<zero> = h \<zero> \<oplus>\<^bsub>S\<^esub> h \<zero>
[PROOF STEP]
using ring_hom_add[OF assms(1), of \<zero> \<zero>] assms(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<zero> \<in> carrier R; \<zero> \<in> carrier R\<rbrakk> \<Longrightarrow> h (\<zero> \<oplus> \<zero>) = h \<zero> \<oplus>\<^bsub>S\<^esub> h \<zero>
ring R

goal (1 subgoal):
 1. h \<zero> = h \<zero> \<oplus>\<^bsub>S\<^esub> h \<zero>
[PROOF STEP]
by (simp add: ring.ring_simprules(2) ring.ring_simprules(15))
[PROOF STATE]
proof (state)
this:
h \<zero> = h \<zero> \<oplus>\<^bsub>S\<^esub> h \<zero>

goal (1 subgoal):
 1. h \<zero> = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
h \<zero> = h \<zero> \<oplus>\<^bsub>S\<^esub> h \<zero>

goal (1 subgoal):
 1. h \<zero> = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
by (metis abelian_group.l_neg assms ring.is_abelian_group ring.ring_simprules(18) ring.ring_simprules(2) ring_hom_closed)
[PROOF STATE]
proof (state)
this:
h \<zero> = \<zero>\<^bsub>S\<^esub>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inc_seq_greater:
  fixes f :: "nat seq"
  assumes "\<forall>i. f i < f (Suc i)"
  shows "\<exists>i. f i > N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i. N < f i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>i. f i < f (Suc i)

goal (1 subgoal):
 1. \<exists>i. N < f i
[PROOF STEP]
apply (induct N)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>i. f i < f (Suc i) \<Longrightarrow> \<exists>i. 0 < f i
 2. \<And>N. \<lbrakk>\<forall>i. f i < f (Suc i) \<Longrightarrow> \<exists>i. N < f i; \<forall>i. f i < f (Suc i)\<rbrakk> \<Longrightarrow> \<exists>i. Suc N < f i
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>i. f i < f (Suc i) \<Longrightarrow> \<exists>i. 0 < f i
 2. \<And>N i. \<lbrakk>\<forall>i. f i < f (Suc i); N < f i\<rbrakk> \<Longrightarrow> \<exists>i. Suc N < f i
[PROOF STEP]
apply (metis neq0_conv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>N i. \<lbrakk>\<forall>i. f i < f (Suc i); N < f i\<rbrakk> \<Longrightarrow> \<exists>i. Suc N < f i
[PROOF STEP]
by (metis Suc_lessI)


[STATEMENT]
lemma ordertype_nat_imp_finite:
  assumes "ordertype A r = ord_of_nat m" "small A" "wf r" "total_on A r"
  shows "finite A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite A
[PROOF STEP]
have "A \<approx> elts m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<approx> elts (ord_of_nat m)
[PROOF STEP]
using eqpoll_def assms ordermap_bij
[PROOF STATE]
proof (prove)
using this:
?A \<approx> ?B \<equiv> \<exists>f. bij_betw f ?A ?B
ordertype A r = ord_of_nat m
small A
wf r
total_on A r
\<lbrakk>wf ?r; total_on ?A ?r; small ?A\<rbrakk> \<Longrightarrow> bij_betw (ordermap ?A ?r) ?A (elts (ordertype ?A ?r))

goal (1 subgoal):
 1. A \<approx> elts (ord_of_nat m)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
A \<approx> elts (ord_of_nat m)

goal (1 subgoal):
 1. finite A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<approx> elts (ord_of_nat m)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A \<approx> elts (ord_of_nat m)

goal (1 subgoal):
 1. finite A
[PROOF STEP]
using eqpoll_finite_iff finite_Ord_omega
[PROOF STATE]
proof (prove)
using this:
A \<approx> elts (ord_of_nat m)
?A \<approx> ?B \<Longrightarrow> finite ?A = finite ?B
?\<alpha> \<in> elts \<omega> \<Longrightarrow> finite (elts ?\<alpha>)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem dfs_eq_reachable:
  assumes y: "is_node y"
    and xs: "list_all is_node xs"
  shows "memb y (dfs empt xs) = (y \<in> reachable (set xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. memb y (dfs empt xs) = (y \<in> reachable (set xs))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. memb y (dfs empt xs) \<Longrightarrow> y \<in> reachable (set xs)
 2. y \<in> reachable (set xs) \<Longrightarrow> memb y (dfs empt xs)
[PROOF STEP]
assume "memb y (dfs empt xs)"
[PROOF STATE]
proof (state)
this:
memb y (dfs empt xs)

goal (2 subgoals):
 1. memb y (dfs empt xs) \<Longrightarrow> y \<in> reachable (set xs)
 2. y \<in> reachable (set xs) \<Longrightarrow> memb y (dfs empt xs)
[PROOF STEP]
with dfs_subset_reachable_visit_nodes [OF empt_invariant xs] y
[PROOF STATE]
proof (chain)
picking this:
set_of (dfs empt xs) \<subseteq> reachable (set xs) \<union> set_of empt
is_node y
memb y (dfs empt xs)
[PROOF STEP]
show "y \<in> reachable (set xs)"
[PROOF STATE]
proof (prove)
using this:
set_of (dfs empt xs) \<subseteq> reachable (set xs) \<union> set_of empt
is_node y
memb y (dfs empt xs)

goal (1 subgoal):
 1. y \<in> reachable (set xs)
[PROOF STEP]
by (auto simp add: empt set_of_def)
[PROOF STATE]
proof (state)
this:
y \<in> reachable (set xs)

goal (1 subgoal):
 1. y \<in> reachable (set xs) \<Longrightarrow> memb y (dfs empt xs)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y \<in> reachable (set xs) \<Longrightarrow> memb y (dfs empt xs)
[PROOF STEP]
assume "y \<in> reachable (set xs)"
[PROOF STATE]
proof (state)
this:
y \<in> reachable (set xs)

goal (1 subgoal):
 1. y \<in> reachable (set xs) \<Longrightarrow> memb y (dfs empt xs)
[PROOF STEP]
with reachable_closed_dfs [OF xs]
[PROOF STATE]
proof (chain)
picking this:
reachable (set xs) \<subseteq> set_of (dfs empt xs)
y \<in> reachable (set xs)
[PROOF STEP]
show "memb y (dfs empt xs)"
[PROOF STATE]
proof (prove)
using this:
reachable (set xs) \<subseteq> set_of (dfs empt xs)
y \<in> reachable (set xs)

goal (1 subgoal):
 1. memb y (dfs empt xs)
[PROOF STEP]
by (auto simp add: set_of_def)
[PROOF STATE]
proof (state)
this:
memb y (dfs empt xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Span_eq_combine_set:
  assumes "set Us \<subseteq> carrier R" shows "Span K Us = { combine Ks Us | Ks. set Ks \<subseteq> K }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Span K Us = {combine Ks Us |Ks. set Ks \<subseteq> K}
[PROOF STEP]
using assms line_extension_of_combine_set
[PROOF STATE]
proof (prove)
using this:
set Us \<subseteq> carrier R
?u \<in> carrier R \<Longrightarrow> line_extension K ?u {combine Ks ?Us |Ks. set Ks \<subseteq> K} = {combine Ks (?u # ?Us) |Ks. set Ks \<subseteq> K}

goal (1 subgoal):
 1. Span K Us = {combine Ks Us |Ks. set Ks \<subseteq> K}
[PROOF STEP]
by (induct Us) (auto, metis empty_set empty_subsetI)


[STATEMENT]
lemma DERIV_mult[derivative_intros]:
  "(f has_field_derivative Da) (at x within s) \<Longrightarrow> (g has_field_derivative Db) (at x within s) \<Longrightarrow>
    ((\<lambda>x. f x * g x) has_field_derivative Da * g x + Db * f x) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_field_derivative Da) (at x within s); (g has_field_derivative Db) (at x within s)\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) has_field_derivative Da * g x + Db * f x) (at x within s)
[PROOF STEP]
by (rule has_derivative_imp_has_field_derivative[OF has_derivative_mult])
     (auto simp: field_simps dest: has_field_derivative_imp_has_derivative)


[STATEMENT]
lemma mssnth_ln_series_stream_aux:
  "mssnth (ln_series_stream_aux b x) n =
     (if b then - ((-1)^n) * inverse (x + real n) else ((-1)^n) * inverse (x + real n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mssnth (ln_series_stream_aux b x) n = (if b then - ((- 1) ^ n) * inverse (x + real n) else (- 1) ^ n * inverse (x + real n))
[PROOF STEP]
by (induction n arbitrary: b x; subst ln_series_stream_aux.code) simp_all


[STATEMENT]
lemma inv_ordermap_VWF_mono_le:
  assumes "inv_into M (ordermap M VWF) \<alpha> \<le> inv_into M (ordermap M VWF) \<beta>"
    and "M \<subseteq> ON" "small M" and \<alpha>: "\<alpha> \<in> elts (ordertype M VWF)" and \<beta>: "\<beta> \<in> elts (ordertype M VWF)"
  shows "\<alpha> \<le> \<beta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<alpha> \<le> \<beta>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<alpha> \<le> \<beta>
[PROOF STEP]
have "\<alpha> = ordermap M VWF (inv_into M (ordermap M VWF) \<alpha>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<alpha> = ordermap M VWF (inv_into M (ordermap M VWF) \<alpha>)
[PROOF STEP]
by (metis \<alpha> f_inv_into_f ordermap_surj subset_eq)
[PROOF STATE]
proof (state)
this:
\<alpha> = ordermap M VWF (inv_into M (ordermap M VWF) \<alpha>)

goal (1 subgoal):
 1. \<alpha> \<le> \<beta>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<alpha> = ordermap M VWF (inv_into M (ordermap M VWF) \<alpha>)

goal (1 subgoal):
 1. \<alpha> \<le> \<beta>
[PROOF STEP]
have "\<dots> \<le> ordermap M VWF (inv_into M (ordermap M VWF) \<beta>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordermap M VWF (inv_into M (ordermap M VWF) \<alpha>) \<le> ordermap M VWF (inv_into M (ordermap M VWF) \<beta>)
[PROOF STEP]
by (metis ON_imp_Ord VWF_iff_Ord_less assms dual_order.strict_implies_order elts_of_set eq_refl inv_into_into order.not_eq_order_implies_strict ordermap_mono_less ordertype_def replacement trans_VWF wf_VWF)
[PROOF STATE]
proof (state)
this:
ordermap M VWF (inv_into M (ordermap M VWF) \<alpha>) \<le> ordermap M VWF (inv_into M (ordermap M VWF) \<beta>)

goal (1 subgoal):
 1. \<alpha> \<le> \<beta>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ordermap M VWF (inv_into M (ordermap M VWF) \<alpha>) \<le> ordermap M VWF (inv_into M (ordermap M VWF) \<beta>)

goal (1 subgoal):
 1. \<alpha> \<le> \<beta>
[PROOF STEP]
have "\<dots> = \<beta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordermap M VWF (inv_into M (ordermap M VWF) \<beta>) = \<beta>
[PROOF STEP]
by (meson \<beta> f_inv_into_f in_mono ordermap_surj)
[PROOF STATE]
proof (state)
this:
ordermap M VWF (inv_into M (ordermap M VWF) \<beta>) = \<beta>

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

goal (1 subgoal):
 1. \<alpha> \<le> \<beta>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<alpha> \<le> \<beta>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma wlp_PC_fixed:
  "\<lbrakk> P \<tturnstile> wlp a R; Q \<tturnstile> wlp b R; 0 \<le> p; p \<le> 1 \<rbrakk> \<Longrightarrow>
  (\<lambda>s. p * P s + (1 - p) * Q s) \<tturnstile> wlp (a \<^bsub>(\<lambda>s. p)\<^esub>\<oplus> b) R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P \<tturnstile> wlp a R; Q \<tturnstile> wlp b R; 0 \<le> p; p \<le> 1\<rbrakk> \<Longrightarrow> \<lambda>s. p * P s + (1 - p) * Q s \<tturnstile> wlp (a \<^bsub>(\<lambda>s. p)\<^esub>\<oplus> b) R
[PROOF STEP]
by(simp add:wlp_def PC_fixed)


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


[STATEMENT]
lemma moebius_rotation_comp [simp]:
  shows "moebius_comp (moebius_rotation \<phi>1) (moebius_rotation \<phi>2) = moebius_rotation (\<phi>1 + \<phi>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_comp (moebius_rotation \<phi>1) (moebius_rotation \<phi>2) = moebius_rotation (\<phi>1 + \<phi>2)
[PROOF STEP]
unfolding moebius_rotation_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_comp (moebius_similarity (cis \<phi>1) 0) (moebius_similarity (cis \<phi>2) 0) = moebius_similarity (cis (\<phi>1 + \<phi>2)) 0
[PROOF STEP]
using moebius_similarity_comp[of "cis \<phi>1" "cis \<phi>2" 0 0]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>cis \<phi>1 \<noteq> 0; cis \<phi>2 \<noteq> 0\<rbrakk> \<Longrightarrow> moebius_comp (moebius_similarity (cis \<phi>1) 0) (moebius_similarity (cis \<phi>2) 0) = moebius_similarity (cis \<phi>1 * cis \<phi>2) (cis \<phi>1 * 0 + 0)

goal (1 subgoal):
 1. moebius_comp (moebius_similarity (cis \<phi>1) 0) (moebius_similarity (cis \<phi>2) 0) = moebius_similarity (cis (\<phi>1 + \<phi>2)) 0
[PROOF STEP]
by (simp add: cis_mult)


[STATEMENT]
lemma primorial_at_top: "filterlim primorial at_top at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim primorial sequentially at_top
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. filterlim primorial sequentially at_top
[PROOF STEP]
have "filterlim (\<lambda>x. real (primorial x)) at_top at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x at_top. real (primorial x) :> at_top
[PROOF STEP]
proof (rule filterlim_at_top_mono)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. filterlim ?f at_top at_top
 2. \<forall>\<^sub>F x in at_top. ?f x \<le> real (primorial x)
[PROOF STEP]
show "eventually (\<lambda>x. primorial x \<ge> 2 powr primes_pi x) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 2 powr primes_pi x \<le> real (primorial x)
[PROOF STEP]
by (intro always_eventually primorial_ge allI)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. 2 powr primes_pi x \<le> real (primorial x)

goal (1 subgoal):
 1. LIM x at_top. 2 powr primes_pi x :> at_top
[PROOF STEP]
have "filterlim (\<lambda>x. exp (ln 2 * primes_pi x)) at_top at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x at_top. exp (ln 2 * primes_pi x) :> at_top
[PROOF STEP]
by (intro filterlim_compose[OF exp_at_top]
                filterlim_tendsto_pos_mult_at_top[OF tendsto_const] \<pi>_at_top) auto
[PROOF STATE]
proof (state)
this:
LIM x at_top. exp (ln 2 * primes_pi x) :> at_top

goal (1 subgoal):
 1. LIM x at_top. 2 powr primes_pi x :> at_top
[PROOF STEP]
thus "filterlim (\<lambda>x. 2 powr primes_pi x) at_top at_top"
[PROOF STATE]
proof (prove)
using this:
LIM x at_top. exp (ln 2 * primes_pi x) :> at_top

goal (1 subgoal):
 1. LIM x at_top. 2 powr primes_pi x :> at_top
[PROOF STEP]
by (simp add: powr_def mult_ac)
[PROOF STATE]
proof (state)
this:
LIM x at_top. 2 powr primes_pi x :> at_top

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
LIM x at_top. real (primorial x) :> at_top

goal (1 subgoal):
 1. filterlim primorial sequentially at_top
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
LIM x at_top. real (primorial x) :> at_top

goal (1 subgoal):
 1. filterlim primorial sequentially at_top
[PROOF STEP]
unfolding filterlim_sequentially_iff_filterlim_real [symmetric]
[PROOF STATE]
proof (prove)
using this:
filterlim primorial sequentially at_top

goal (1 subgoal):
 1. filterlim primorial sequentially at_top
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
filterlim primorial sequentially at_top

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Lambert_W'_plus_Lambert_W'_eq:
  assumes "x \<in> {-exp(-1)..<0}" "y \<in> {-exp(-1)..<0}"
  shows   "Lambert_W' x + Lambert_W' y = Lambert_W' (x * y * (1 / Lambert_W' x + 1 / Lambert_W' y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lambert_W' x + Lambert_W' y = Lambert_W' (x * y * (1 / Lambert_W' x + 1 / Lambert_W' y))
[PROOF STEP]
proof (rule sym, rule Lambert_W'_eqI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Lambert_W' x + Lambert_W' y \<le> - 1
 2. (Lambert_W' x + Lambert_W' y) * exp (Lambert_W' x + Lambert_W' y) = x * y * (1 / Lambert_W' x + 1 / Lambert_W' y)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
x \<in> {- exp (- 1)..<0}
y \<in> {- exp (- 1)..<0}
[PROOF STEP]
show "(Lambert_W' x + Lambert_W' y) * exp (Lambert_W' x + Lambert_W' y) =
                     x * y * (1 / Lambert_W' x + 1 / Lambert_W' y)"
[PROOF STATE]
proof (prove)
using this:
x \<in> {- exp (- 1)..<0}
y \<in> {- exp (- 1)..<0}

goal (1 subgoal):
 1. (Lambert_W' x + Lambert_W' y) * exp (Lambert_W' x + Lambert_W' y) = x * y * (1 / Lambert_W' x + 1 / Lambert_W' y)
[PROOF STEP]
by (auto simp: field_simps exp_add exp_Lambert_W')
[PROOF STATE]
proof (state)
this:
(Lambert_W' x + Lambert_W' y) * exp (Lambert_W' x + Lambert_W' y) = x * y * (1 / Lambert_W' x + 1 / Lambert_W' y)

goal (1 subgoal):
 1. Lambert_W' x + Lambert_W' y \<le> - 1
[PROOF STEP]
have "Lambert_W' x + Lambert_W' y \<le> -1 + -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lambert_W' x + Lambert_W' y \<le> - 1 + - 1
[PROOF STEP]
by (intro add_mono Lambert_W'_le)
[PROOF STATE]
proof (state)
this:
Lambert_W' x + Lambert_W' y \<le> - 1 + - 1

goal (1 subgoal):
 1. Lambert_W' x + Lambert_W' y \<le> - 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Lambert_W' x + Lambert_W' y \<le> - 1 + - 1

goal (1 subgoal):
 1. Lambert_W' x + Lambert_W' y \<le> - 1
[PROOF STEP]
have "\<dots> \<le> -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 1 + - 1 \<le> - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- 1 + - 1 \<le> - 1

goal (1 subgoal):
 1. Lambert_W' x + Lambert_W' y \<le> - 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Lambert_W' x + Lambert_W' y \<le> - 1
[PROOF STEP]
show "Lambert_W' x + Lambert_W' y \<le> -1"
[PROOF STATE]
proof (prove)
using this:
Lambert_W' x + Lambert_W' y \<le> - 1

goal (1 subgoal):
 1. Lambert_W' x + Lambert_W' y \<le> - 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Lambert_W' x + Lambert_W' y \<le> - 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bigtheta_const_ln' [landau_simp]:
  "0 < a \<Longrightarrow> (\<lambda>x::real. ln (x * a)) \<in> \<Theta>(ln)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a \<Longrightarrow> (\<lambda>x. ln (x * a)) \<in> \<Theta>(ln)
[PROOF STEP]
by (subst mult.commute) (rule bigtheta_const_ln)


[STATEMENT]
lemma invfun_set:"\<lbrakk>f \<in> A \<rightarrow> B; bij_to f A B; C \<subseteq> B\<rbrakk> \<Longrightarrow>
                f ` ((invfun A B f)` C) = C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B; bij_to f A B; C \<subseteq> B\<rbrakk> \<Longrightarrow> f ` (f\<inverse>\<^bsub>B,A\<^esub>) ` C = C
[PROOF STEP]
apply (rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>f \<in> A \<rightarrow> B; bij_to f A B; C \<subseteq> B\<rbrakk> \<Longrightarrow> f ` (f\<inverse>\<^bsub>B,A\<^esub>) ` C \<subseteq> C
 2. \<lbrakk>f \<in> A \<rightarrow> B; bij_to f A B; C \<subseteq> B\<rbrakk> \<Longrightarrow> C \<subseteq> f ` (f\<inverse>\<^bsub>B,A\<^esub>) ` C
[PROOF STEP]
apply (rule subsetI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>f \<in> A \<rightarrow> B; bij_to f A B; C \<subseteq> B; x \<in> f ` (f\<inverse>\<^bsub>B,A\<^esub>) ` C\<rbrakk> \<Longrightarrow> x \<in> C
 2. \<lbrakk>f \<in> A \<rightarrow> B; bij_to f A B; C \<subseteq> B\<rbrakk> \<Longrightarrow> C \<subseteq> f ` (f\<inverse>\<^bsub>B,A\<^esub>) ` C
[PROOF STEP]
apply (simp add:image_def, erule exE,
        erule conjE, erule bexE, simp,
        frule_tac c = xb in subsetD[of "C" "B"], assumption+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x xa xb. \<lbrakk>f \<in> A \<rightarrow> B; bij_to f A B; C \<subseteq> B; x = f ((f\<inverse>\<^bsub>B,A\<^esub>) xb); xb \<in> C; xa = (f\<inverse>\<^bsub>B,A\<^esub>) xb; xb \<in> B\<rbrakk> \<Longrightarrow> f ((f\<inverse>\<^bsub>B,A\<^esub>) xb) \<in> C
 2. \<lbrakk>f \<in> A \<rightarrow> B; bij_to f A B; C \<subseteq> B\<rbrakk> \<Longrightarrow> C \<subseteq> f ` (f\<inverse>\<^bsub>B,A\<^esub>) ` C
[PROOF STEP]
apply (simp add:bij_to_def, erule conjE,
        simp add:invfun_r)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B; bij_to f A B; C \<subseteq> B\<rbrakk> \<Longrightarrow> C \<subseteq> f ` (f\<inverse>\<^bsub>B,A\<^esub>) ` C
[PROOF STEP]
apply (rule subsetI, simp add:image_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>f \<in> A \<rightarrow> B; bij_to f A B; C \<subseteq> B; x \<in> C\<rbrakk> \<Longrightarrow> \<exists>xa. (\<exists>x\<in>C. xa = (f\<inverse>\<^bsub>B,A\<^esub>) x) \<and> x = f xa
[PROOF STEP]
apply (frule_tac c = x in subsetD[of "C" "B"], assumption+,
        simp add:bij_to_def, erule conjE,
        frule_tac b = x in invfun_r[of "f" "A" "B"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>f \<in> A \<rightarrow> B; C \<subseteq> B; x \<in> C; x \<in> B; surj_to f A B; inj_on f A; f ((f\<inverse>\<^bsub>B,A\<^esub>) x) = x\<rbrakk> \<Longrightarrow> \<exists>xa. (\<exists>x\<in>C. xa = (f\<inverse>\<^bsub>B,A\<^esub>) x) \<and> x = f xa
[PROOF STEP]
apply (frule sym, thin_tac "f (invfun A B f x) = x")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>f \<in> A \<rightarrow> B; C \<subseteq> B; x \<in> C; x \<in> B; surj_to f A B; inj_on f A; x = f ((f\<inverse>\<^bsub>B,A\<^esub>) x)\<rbrakk> \<Longrightarrow> \<exists>xa. (\<exists>x\<in>C. xa = (f\<inverse>\<^bsub>B,A\<^esub>) x) \<and> x = f xa
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma repeat_mset_size [simp]: "size (repeat_mset n A) = n * size A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (repeat_mset n A) = n * size A
[PROOF STEP]
by (induction n) auto


[STATEMENT]
lemma (in Group) Qg_tassoc: "G \<triangleright> N \<Longrightarrow>
\<forall>X\<in>set_rcs G N. \<forall>Y\<in>set_rcs G N. \<forall>Z\<in>set_rcs G N. c_top G N X (c_top G N Y Z)
                                   = c_top G N (c_top G N X Y) Z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G \<triangleright> N \<Longrightarrow> \<forall>X\<in>set_rcs G N. \<forall>Y\<in>set_rcs G N. \<forall>Z\<in>set_rcs G N. c_top G N X (c_top G N Y Z) = c_top G N (c_top G N X Y) Z
[PROOF STEP]
apply (rule ballI)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>X Y Z. \<lbrakk>G \<triangleright> N; X \<in> set_rcs G N; Y \<in> set_rcs G N; Z \<in> set_rcs G N\<rbrakk> \<Longrightarrow> c_top G N X (c_top G N Y Z) = c_top G N (c_top G N X Y) Z
[PROOF STEP]
apply (simp add:set_rcs_def, (erule bexE)+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>X Y Z a aa ab. \<lbrakk>G \<triangleright> N; a \<in> carrier G; X = N \<bullet> a; aa \<in> carrier G; Y = N \<bullet> aa; ab \<in> carrier G; Z = N \<bullet> ab\<rbrakk> \<Longrightarrow> c_top G N X (c_top G N Y Z) = c_top G N (c_top G N X Y) Z
[PROOF STEP]
apply (simp add:Qg_tassocTr)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma absolutely_integrable_absolutely_integrable_ubound:
  fixes f :: "'m::euclidean_space \<Rightarrow> real"
  assumes fg: "f integrable_on S" "g absolutely_integrable_on S"
    and *: "\<And>x. x \<in> S \<Longrightarrow> f x \<le> g x"
  shows "f absolutely_integrable_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f absolutely_integrable_on S
[PROOF STEP]
by (rule absolutely_integrable_component_ubound [OF fg]) (simp add: *)


[STATEMENT]
lemma C1_differentiable_on_scaleR [simp, derivative_intros]:
  "f C1_differentiable_on S \<Longrightarrow> g C1_differentiable_on S \<Longrightarrow> (\<lambda>x. f x *\<^sub>R g x) C1_differentiable_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f C1_differentiable_on S; g C1_differentiable_on S\<rbrakk> \<Longrightarrow> (\<lambda>x. f x *\<^sub>R g x) C1_differentiable_on S
[PROOF STEP]
unfolding C1_differentiable_on_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<forall>x\<in>S. f differentiable at x) \<and> continuous_on S (\<lambda>x. vector_derivative f (at x)); (\<forall>x\<in>S. g differentiable at x) \<and> continuous_on S (\<lambda>x. vector_derivative g (at x))\<rbrakk> \<Longrightarrow> (\<forall>x\<in>S. (\<lambda>x. f x *\<^sub>R g x) differentiable at x) \<and> continuous_on S (\<lambda>x. vector_derivative (\<lambda>x. f x *\<^sub>R g x) (at x))
[PROOF STEP]
by (rule continuous_intros | simp add: continuous_at_imp_continuous_on differentiable_imp_continuous_within)+


[STATEMENT]
lemma poincare_between_rev:
  assumes "u \<in> unit_disc" and "v \<in> unit_disc" and "w \<in> unit_disc"
  shows "poincare_between u v w \<longleftrightarrow> poincare_between w v u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_between u v w = poincare_between w v u
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
u \<in> unit_disc
v \<in> unit_disc
w \<in> unit_disc

goal (1 subgoal):
 1. poincare_between u v w = poincare_between w v u
[PROOF STEP]
using inversion_noteq_unit_disc[of v w]
[PROOF STATE]
proof (prove)
using this:
u \<in> unit_disc
v \<in> unit_disc
w \<in> unit_disc
\<lbrakk>v \<in> unit_disc; w \<in> unit_disc\<rbrakk> \<Longrightarrow> inversion v \<noteq> w

goal (1 subgoal):
 1. poincare_between u v w = poincare_between w v u
[PROOF STEP]
using inversion_noteq_unit_disc[of v u]
[PROOF STATE]
proof (prove)
using this:
u \<in> unit_disc
v \<in> unit_disc
w \<in> unit_disc
\<lbrakk>v \<in> unit_disc; w \<in> unit_disc\<rbrakk> \<Longrightarrow> inversion v \<noteq> w
\<lbrakk>v \<in> unit_disc; u \<in> unit_disc\<rbrakk> \<Longrightarrow> inversion v \<noteq> u

goal (1 subgoal):
 1. poincare_between u v w = poincare_between w v u
[PROOF STEP]
using cross_ratio_commute_13[of u v w "inversion v"]
[PROOF STATE]
proof (prove)
using this:
u \<in> unit_disc
v \<in> unit_disc
w \<in> unit_disc
\<lbrakk>v \<in> unit_disc; w \<in> unit_disc\<rbrakk> \<Longrightarrow> inversion v \<noteq> w
\<lbrakk>v \<in> unit_disc; u \<in> unit_disc\<rbrakk> \<Longrightarrow> inversion v \<noteq> u
cross_ratio u v w (inversion v) = reciprocal (cross_ratio w v u (inversion v))

goal (1 subgoal):
 1. poincare_between u v w = poincare_between w v u
[PROOF STEP]
using cross_ratio_not_inf[of w "inversion v" v u]
[PROOF STATE]
proof (prove)
using this:
u \<in> unit_disc
v \<in> unit_disc
w \<in> unit_disc
\<lbrakk>v \<in> unit_disc; w \<in> unit_disc\<rbrakk> \<Longrightarrow> inversion v \<noteq> w
\<lbrakk>v \<in> unit_disc; u \<in> unit_disc\<rbrakk> \<Longrightarrow> inversion v \<noteq> u
cross_ratio u v w (inversion v) = reciprocal (cross_ratio w v u (inversion v))
\<lbrakk>w \<noteq> inversion v; v \<noteq> u\<rbrakk> \<Longrightarrow> cross_ratio w v u (inversion v) \<noteq> \<infinity>\<^sub>h

goal (1 subgoal):
 1. poincare_between u v w = poincare_between w v u
[PROOF STEP]
using cross_ratio_not_zero[of w v u "inversion v"]
[PROOF STATE]
proof (prove)
using this:
u \<in> unit_disc
v \<in> unit_disc
w \<in> unit_disc
\<lbrakk>v \<in> unit_disc; w \<in> unit_disc\<rbrakk> \<Longrightarrow> inversion v \<noteq> w
\<lbrakk>v \<in> unit_disc; u \<in> unit_disc\<rbrakk> \<Longrightarrow> inversion v \<noteq> u
cross_ratio u v w (inversion v) = reciprocal (cross_ratio w v u (inversion v))
\<lbrakk>w \<noteq> inversion v; v \<noteq> u\<rbrakk> \<Longrightarrow> cross_ratio w v u (inversion v) \<noteq> \<infinity>\<^sub>h
\<lbrakk>w \<noteq> v; u \<noteq> inversion v\<rbrakk> \<Longrightarrow> cross_ratio w v u (inversion v) \<noteq> 0\<^sub>h

goal (1 subgoal):
 1. poincare_between u v w = poincare_between w v u
[PROOF STEP]
using inf_or_of_complex[of "cross_ratio w v u (inversion v)"]
[PROOF STATE]
proof (prove)
using this:
u \<in> unit_disc
v \<in> unit_disc
w \<in> unit_disc
\<lbrakk>v \<in> unit_disc; w \<in> unit_disc\<rbrakk> \<Longrightarrow> inversion v \<noteq> w
\<lbrakk>v \<in> unit_disc; u \<in> unit_disc\<rbrakk> \<Longrightarrow> inversion v \<noteq> u
cross_ratio u v w (inversion v) = reciprocal (cross_ratio w v u (inversion v))
\<lbrakk>w \<noteq> inversion v; v \<noteq> u\<rbrakk> \<Longrightarrow> cross_ratio w v u (inversion v) \<noteq> \<infinity>\<^sub>h
\<lbrakk>w \<noteq> v; u \<noteq> inversion v\<rbrakk> \<Longrightarrow> cross_ratio w v u (inversion v) \<noteq> 0\<^sub>h
cross_ratio w v u (inversion v) = \<infinity>\<^sub>h \<or> (\<exists>x. cross_ratio w v u (inversion v) = of_complex x)

goal (1 subgoal):
 1. poincare_between u v w = poincare_between w v u
[PROOF STEP]
unfolding poincare_between_def
[PROOF STATE]
proof (prove)
using this:
u \<in> unit_disc
v \<in> unit_disc
w \<in> unit_disc
\<lbrakk>v \<in> unit_disc; w \<in> unit_disc\<rbrakk> \<Longrightarrow> inversion v \<noteq> w
\<lbrakk>v \<in> unit_disc; u \<in> unit_disc\<rbrakk> \<Longrightarrow> inversion v \<noteq> u
cross_ratio u v w (inversion v) = reciprocal (cross_ratio w v u (inversion v))
\<lbrakk>w \<noteq> inversion v; v \<noteq> u\<rbrakk> \<Longrightarrow> cross_ratio w v u (inversion v) \<noteq> \<infinity>\<^sub>h
\<lbrakk>w \<noteq> v; u \<noteq> inversion v\<rbrakk> \<Longrightarrow> cross_ratio w v u (inversion v) \<noteq> 0\<^sub>h
cross_ratio w v u (inversion v) = \<infinity>\<^sub>h \<or> (\<exists>x. cross_ratio w v u (inversion v) = of_complex x)

goal (1 subgoal):
 1. (u = v \<or> v = w \<or> (let cr = cross_ratio u v w (inversion v) in is_real (to_complex cr) \<and> Re (to_complex cr) < 0)) = (w = v \<or> v = u \<or> (let cr = cross_ratio w v u (inversion v) in is_real (to_complex cr) \<and> Re (to_complex cr) < 0))
[PROOF STEP]
by (auto simp add: Let_def Im_complex_div_eq_0 Re_divide divide_less_0_iff)


[STATEMENT]
lemma gen_sa_impl_rel_eext_def:
  "\<langle>Rm,Rl\<rangle>gen_sa_impl_rel_eext = { (
  \<lparr> sai_L = Li, \<dots>=mi \<rparr>,
  \<lparr> sa_L = L, \<dots>=m \<rparr>)
  | Li mi L m.
    (Li,L)\<in>Rl
  \<and> (mi,m)\<in>Rm
  }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>Rm, Rl\<rangle>gen_sa_impl_rel_eext = {(\<lparr>sai_L = Li, \<dots> = mi\<rparr>, \<lparr>sa_L = L, \<dots> = m\<rparr>) |Li mi L m. (Li, L) \<in> Rl \<and> (mi, m) \<in> Rm}
[PROOF STEP]
unfolding gen_sa_impl_rel_eext_def_internal relAPP_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(\<lparr>sai_L = Li, \<dots> = mi\<rparr>, \<lparr>sa_L = L, \<dots> = m\<rparr>) |Li mi L m. (Li, L) \<in> Rl \<and> (mi, m) \<in> Rm} = {(\<lparr>sai_L = Li, \<dots> = mi\<rparr>, \<lparr>sa_L = L, \<dots> = m\<rparr>) |Li mi L m. (Li, L) \<in> Rl \<and> (mi, m) \<in> Rm}
[PROOF STEP]
by simp


[STATEMENT]
lemma gHom_comp_gsurjec:"\<lbrakk>Group F; Group G; Group H; gsurj\<^bsub>F,G\<^esub> f;
  gsurj\<^bsub>G,H\<^esub> g\<rbrakk>  \<Longrightarrow> gsurj\<^bsub>F,H\<^esub> (g \<circ>\<^bsub>F\<^esub> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; Group H; gsurj\<^bsub>F,G\<^esub> f; gsurj\<^bsub>G,H\<^esub> g\<rbrakk> \<Longrightarrow> gsurj\<^bsub>F,H\<^esub> (g \<circ>\<^bsub>F\<^esub> f)
[PROOF STEP]
apply (simp add:gsurjec_def,
       simp add:gHomcomp,
       (erule conjE)+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; Group H; f \<in> gHom F G; surj_to f (carrier F) (carrier G); g \<in> gHom G H; surj_to g (carrier G) (carrier H)\<rbrakk> \<Longrightarrow> surj_to (g \<circ>\<^bsub>F\<^esub> f) (carrier F) (carrier H)
[PROOF STEP]
apply (simp add:cmpghom_def,
        simp add:gHom_def, (erule conjE)+,
        rule compose_surj, assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma csols_empty_iff: "csols t0 x0 = {} \<longleftrightarrow> t0 \<notin> T \<or> x0 \<notin> X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (csols t0 x0 = {}) = (t0 \<notin> T \<or> x0 \<notin> X)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> (csols t0 x0 = {}) = (t0 \<notin> T \<or> x0 \<notin> X)
 2. \<not> ?P \<Longrightarrow> (csols t0 x0 = {}) = (t0 \<notin> T \<or> x0 \<notin> X)
[PROOF STEP]
assume iv_defined: "t0 \<in> T \<and> x0 \<in> X"
[PROOF STATE]
proof (state)
this:
t0 \<in> T \<and> x0 \<in> X

goal (2 subgoals):
 1. ?P \<Longrightarrow> (csols t0 x0 = {}) = (t0 \<notin> T \<or> x0 \<notin> X)
 2. \<not> ?P \<Longrightarrow> (csols t0 x0 = {}) = (t0 \<notin> T \<or> x0 \<notin> X)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t0 \<in> T \<and> x0 \<in> X
[PROOF STEP]
have "(\<lambda>_. x0, t0) \<in> csols t0 x0"
[PROOF STATE]
proof (prove)
using this:
t0 \<in> T \<and> x0 \<in> X

goal (1 subgoal):
 1. (\<lambda>_. x0, t0) \<in> csols t0 x0
[PROOF STEP]
by (auto simp: csols_def intro!: solves_ode_singleton)
[PROOF STATE]
proof (state)
this:
(\<lambda>_. x0, t0) \<in> csols t0 x0

goal (2 subgoals):
 1. ?P \<Longrightarrow> (csols t0 x0 = {}) = (t0 \<notin> T \<or> x0 \<notin> X)
 2. \<not> ?P \<Longrightarrow> (csols t0 x0 = {}) = (t0 \<notin> T \<or> x0 \<notin> X)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>_. x0, t0) \<in> csols t0 x0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>_. x0, t0) \<in> csols t0 x0

goal (1 subgoal):
 1. (csols t0 x0 = {}) = (t0 \<notin> T \<or> x0 \<notin> X)
[PROOF STEP]
using \<open>t0 \<in> T \<and> x0 \<in> X\<close>
[PROOF STATE]
proof (prove)
using this:
(\<lambda>_. x0, t0) \<in> csols t0 x0
t0 \<in> T \<and> x0 \<in> X

goal (1 subgoal):
 1. (csols t0 x0 = {}) = (t0 \<notin> T \<or> x0 \<notin> X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(csols t0 x0 = {}) = (t0 \<notin> T \<or> x0 \<notin> X)

goal (1 subgoal):
 1. \<not> (t0 \<in> T \<and> x0 \<in> X) \<Longrightarrow> (csols t0 x0 = {}) = (t0 \<notin> T \<or> x0 \<notin> X)
[PROOF STEP]
qed (auto simp: solves_ode_domainD csols_def)


[STATEMENT]
lemma mat_row_transpose: "(mat\<^sub>r nr nc f)\<^sup>T = mat nc nr (\<lambda>(i,j). vec_index (f j) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat\<^sub>r nr nc f)\<^sup>T = Matrix.mat nc nr (\<lambda>(i, j). f j $v i)
[PROOF STEP]
by (rule eq_matI, auto)


[STATEMENT]
lemma fds_nth_mult_Suc_0 [simp]:
  "fds_nth (f * g) (Suc 0) = fds_nth f (Suc 0) * fds_nth g (Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_nth (f * g) (Suc 0) = fds_nth f (Suc 0) * fds_nth g (Suc 0)
[PROOF STEP]
by (simp add: fds_nth_mult)


[STATEMENT]
lemma DERIV_mult[derivative_intros]:
  "(f has_field_derivative Da) (at x within s) \<Longrightarrow> (g has_field_derivative Db) (at x within s) \<Longrightarrow>
    ((\<lambda>x. f x * g x) has_field_derivative Da * g x + Db * f x) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_field_derivative Da) (at x within s); (g has_field_derivative Db) (at x within s)\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) has_field_derivative Da * g x + Db * f x) (at x within s)
[PROOF STEP]
by (rule has_derivative_imp_has_field_derivative[OF has_derivative_mult])
     (auto simp: field_simps dest: has_field_derivative_imp_has_derivative)


[STATEMENT]
theorem p50: "\<forall>x. F(a,x) \<or> (\<forall>y. F(x,y)) \<Longrightarrow> \<exists>x. \<forall>y. F(x,y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. F (a, x) \<or> (\<forall>y. F (x, y)) \<Longrightarrow> \<exists>x. \<forall>y. F (x, y)
[PROOF STEP]
@proof
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. F (a, x) \<or> (\<forall>y. F (x, y)) \<Longrightarrow> \<exists>x. \<forall>y. F (x, y)
[PROOF STEP]
@case "\<forall>y. F(a,y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. F (a, x) \<or> (\<forall>y. F (x, y)) \<Longrightarrow> \<exists>x. \<forall>y. F (x, y)
[PROOF STEP]
@obtain y where "\<not>F(a,y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. F (a, x) \<or> (\<forall>y. F (x, y)) \<Longrightarrow> \<exists>x. \<forall>y. F (x, y)
[PROOF STEP]
@have (@rule) "\<forall>z. F(a,y) \<or> F(y,z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. F (a, x) \<or> (\<forall>y. F (x, y)) \<Longrightarrow> \<exists>x. \<forall>y. F (x, y)
[PROOF STEP]
@qed


[STATEMENT]
lemma discounted_mult_times_rfr:
  assumes "-1 < r"
  shows "discounted_value r (\<lambda>m w. (1+r) * X w) (Suc n) w = discounted_value r (\<lambda>m w. X w) n w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. discounted_value r (\<lambda>m w. (1 + r) * X w) (Suc n) w = discounted_value r (\<lambda>m. X) n w
[PROOF STEP]
unfolding discounted_value_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. discount_factor r (Suc n) w * ((1 + r) * X w) = discount_factor r n w * X w
[PROOF STEP]
using assms discount_factor_times_rfr discounted_mult
[PROOF STATE]
proof (prove)
using this:
- 1 < r
- 1 < ?r \<Longrightarrow> (1 + ?r) * discount_factor ?r (Suc ?n) ?w = discount_factor ?r ?n ?w
\<forall>n w. discounted_value ?r (\<lambda>m x. ?X m x * ?Y m x) n w = ?X n w * discounted_value ?r ?Y n w

goal (1 subgoal):
 1. discount_factor r (Suc n) w * ((1 + r) * X w) = discount_factor r n w * X w
[PROOF STEP]
by (simp add: discount_factor_times_rfr mult.commute)


[STATEMENT]
lemma set_of_sub_inc:
  "set_of (A - B) \<subseteq> set_of (A' - B')"
  if "set_of A \<subseteq> set_of A'" "set_of B \<subseteq> set_of B'"
  for A :: "'a::linordered_idom interval"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_of (A - B) \<subseteq> set_of (A' - B')
[PROOF STEP]
using set_of_sub_inc_left[OF that(1)] set_of_sub_inc_right[OF that(2)]
[PROOF STATE]
proof (prove)
using this:
set_of (A - ?B) \<subseteq> set_of (A' - ?B)
set_of (?A - B) \<subseteq> set_of (?A - B')

goal (1 subgoal):
 1. set_of (A - B) \<subseteq> set_of (A' - B')
[PROOF STEP]
by auto


[STATEMENT]
lemma mset_list_by_index: "mset (xs) = image_mset (\<lambda> i . (xs ! i)) (mset_set {..<length xs})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset xs = image_mset ((!) xs) (mset_set {..<length xs})
[PROOF STEP]
by (metis map_nth mset_map mset_set_upto_eq_mset_upto)


[STATEMENT]
lemma if_same_eq_not: "(If p x y = (\<not> If p u v)) = (if p then x = (\<not> u) else y = (\<not> v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((if p then x else y) = (\<not> (if p then u else v))) = (if p then x = (\<not> u) else y = (\<not> v))
[PROOF STEP]
by auto


[STATEMENT]
lemma cart_product_add_1_filter_eq: "{#m \<in># ((add_mset a M) \<times># N) . (fst m \<in> snd m) #} =
    {#m \<in># (M \<times># N) . (fst m \<in> snd m) #} + ({#a#} \<times># {# n \<in># N . a \<in> n #})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {#m \<in># add_mset a M \<times># N. fst m \<in> snd m#} = {#m \<in># M \<times># N. fst m \<in> snd m#} + {#a#} \<times># filter_mset ((\<in>) a) N
[PROOF STEP]
unfolding add_mset_add_single [of a M] Sigma_mset_plus_distrib1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {#m \<in># M \<times># N + {#a#} \<times># N. fst m \<in> snd m#} = {#m \<in># M \<times># N. fst m \<in> snd m#} + {#a#} \<times># filter_mset ((\<in>) a) N
[PROOF STEP]
using cart_product_singleton_left cart_product_add_1_filter
[PROOF STATE]
proof (prove)
using this:
{#m \<in># {#?a#} \<times># ?N. fst m \<in> snd m#} = {#?a#} \<times># filter_mset ((\<in>) ?a) ?N
filter_mset ?P (add_mset ?a ?M \<times># ?N) = filter_mset ?P (?M \<times># ?N) + filter_mset ?P ({#?a#} \<times># ?N)

goal (1 subgoal):
 1. {#m \<in># M \<times># N + {#a#} \<times># N. fst m \<in> snd m#} = {#m \<in># M \<times># N. fst m \<in> snd m#} + {#a#} \<times># filter_mset ((\<in>) a) N
[PROOF STEP]
by fastforce


[STATEMENT]
lemma unit_ball_vol_1 [simp]: "unit_ball_vol 1 = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unit_ball_vol 1 = 2
[PROOF STEP]
using unit_ball_vol_odd[of 0]
[PROOF STATE]
proof (prove)
using this:
unit_ball_vol (real (2 * 0 + 1)) = 2 ^ (2 * Suc 0) * fact (Suc 0) / fact (2 * Suc 0) * pi ^ 0

goal (1 subgoal):
 1. unit_ball_vol 1 = 2
[PROOF STEP]
by simp


[STATEMENT]
lemma to_fract_eq_iff [simp]: "to_fract x = to_fract y \<longleftrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (to_fract x = to_fract y) = (x = y)
[PROOF STEP]
by (simp add: to_fract_def eq_fract)


[STATEMENT]
lemma evimage_Int [simp]: "f \<inverse>\<^bsub>n\<^esub> (A \<inter> B) = (f \<inverse>\<^bsub>n\<^esub> A) \<inter> (f \<inverse>\<^bsub>n\<^esub> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<inverse>\<^bsub>n\<^esub> (A \<inter> B) = f \<inverse>\<^bsub>n\<^esub> A \<inter> f \<inverse>\<^bsub>n\<^esub> B
[PROOF STEP]
unfolding evimage_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f -` (A \<inter> B) \<inter> carrier (R\<^bsup>n\<^esup>) = f -` A \<inter> carrier (R\<^bsup>n\<^esup>) \<inter> (f -` B \<inter> carrier (R\<^bsup>n\<^esup>))
[PROOF STEP]
by blast


[STATEMENT]
lemma C_below_C[simp]: "(C\<^bsup>i\<^esup> \<sqsubseteq> C\<^bsup>j\<^esup>) \<longleftrightarrow> i \<le> j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (C\<^bsup>i\<^esup> \<sqsubseteq> C\<^bsup>j\<^esup>) = (i \<le> j)
[PROOF STEP]
apply (induction i arbitrary: j)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>j. (C\<^bsup>0\<^esup> \<sqsubseteq> C\<^bsup>j\<^esup>) = (0 \<le> j)
 2. \<And>i j. (\<And>j. (C\<^bsup>i\<^esup> \<sqsubseteq> C\<^bsup>j\<^esup>) = (i \<le> j)) \<Longrightarrow> (C\<^bsup>Suc i\<^esup> \<sqsubseteq> C\<^bsup>j\<^esup>) = (Suc i \<le> j)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. (\<And>j. (C\<^bsup>i\<^esup> \<sqsubseteq> C\<^bsup>j\<^esup>) = (i \<le> j)) \<Longrightarrow> (C\<^bsup>Suc i\<^esup> \<sqsubseteq> C\<^bsup>j\<^esup>) = (Suc i \<le> j)
[PROOF STEP]
apply (case_tac j, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fps_right_inverse':
  fixes   f :: "'a::ring_1 fps"
  assumes "x * f$0 = 1" "f$0 * y = 1"
  \<comment> \<open>These assumptions imply x equals y, but no need to assume that.\<close>
  shows   "f * fps_left_inverse f x = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f * fps_left_inverse f x = 1
[PROOF STEP]
using   assms fps_left_inverse_eq_fps_right_inverse[of x f y] fps_right_inverse[of f y]
[PROOF STATE]
proof (prove)
using this:
x * f $ 0 = (1::'a)
f $ 0 * y = (1::'a)
\<lbrakk>x * f $ 0 = (1::'a); f $ 0 * y = (1::'a)\<rbrakk> \<Longrightarrow> fps_left_inverse f x = fps_right_inverse f y
f $ 0 * y = (1::'a) \<Longrightarrow> f * fps_right_inverse f y = 1

goal (1 subgoal):
 1. f * fps_left_inverse f x = 1
[PROOF STEP]
by      simp


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


[STATEMENT]
lemma mod_0_imp_mod_mult_right_0: "
  n mod m = (0::nat) \<Longrightarrow> n * k mod m = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n mod m = 0 \<Longrightarrow> n * k mod m = 0
[PROOF STEP]
by fastforce


[STATEMENT]
lemma has_integral_affinity_iff:
  fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: real_normed_vector"
  assumes "m > 0"
  shows   "((\<lambda>x. f (m *\<^sub>R x + c)) has_integral (I /\<^sub>R m ^ DIM('a)))
               (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m)) \<longleftrightarrow>
           (f has_integral I) (cbox a b)" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral I /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m)) = (f has_integral I) (cbox a b)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral I /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m)) \<Longrightarrow> (f has_integral I) (cbox a b)
 2. (f has_integral I) (cbox a b) \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral I /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (m *\<^sub>R x + c)) has_integral I /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))

goal (2 subgoals):
 1. ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral I /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m)) \<Longrightarrow> (f has_integral I) (cbox a b)
 2. (f has_integral I) (cbox a b) \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral I /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
from has_integral_affinity'[OF this, of "1 / m" "-c /\<^sub>R m"] and \<open>m > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < 1 / m \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R ((1 / m) *\<^sub>R x + - c /\<^sub>R m) + c)) has_integral I /\<^sub>R m ^ DIM('a) /\<^sub>R (1 / m) ^ DIM('a)) (cbox (((a - c) /\<^sub>R m - - c /\<^sub>R m) /\<^sub>R (1 / m)) (((b - c) /\<^sub>R m - - c /\<^sub>R m) /\<^sub>R (1 / m)))
0 < m
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
0 < 1 / m \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R ((1 / m) *\<^sub>R x + - c /\<^sub>R m) + c)) has_integral I /\<^sub>R m ^ DIM('a) /\<^sub>R (1 / m) ^ DIM('a)) (cbox (((a - c) /\<^sub>R m - - c /\<^sub>R m) /\<^sub>R (1 / m)) (((b - c) /\<^sub>R m - - c /\<^sub>R m) /\<^sub>R (1 / m)))
0 < m

goal (1 subgoal):
 1. (f has_integral I) (cbox a b)
[PROOF STEP]
by (simp add: vector_add_divide_simps) (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(f has_integral I) (cbox a b)

goal (1 subgoal):
 1. (f has_integral I) (cbox a b) \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral I /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f has_integral I) (cbox a b) \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral I /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
(f has_integral I) (cbox a b)

goal (1 subgoal):
 1. (f has_integral I) (cbox a b) \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral I /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
from has_integral_affinity'[OF this, of m c] and \<open>m > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < m \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral I /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
0 < m
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
0 < m \<Longrightarrow> ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral I /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
0 < m

goal (1 subgoal):
 1. ((\<lambda>x. f (m *\<^sub>R x + c)) has_integral I /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (m *\<^sub>R x + c)) has_integral I /\<^sub>R m ^ DIM('a)) (cbox ((a - c) /\<^sub>R m) ((b - c) /\<^sub>R m))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma range_prefix_match_set_eq:
  "(\<lambda>(r1,r2). (wordinterval_to_set r1, wordinterval_to_set r2)) (range_prefix_match pfx rg) =
    ipset_prefix_match pfx (wordinterval_to_set rg)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case range_prefix_match pfx rg of (r1, r2) \<Rightarrow> (wordinterval_to_set r1, wordinterval_to_set r2)) = ipset_prefix_match pfx (wordinterval_to_set rg)
[PROOF STEP]
unfolding range_prefix_match_def ipset_prefix_match_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case (wordinterval_intersection rg (prefix_to_wordinterval pfx), wordinterval_setminus rg (prefix_to_wordinterval pfx)) of (r1, r2) \<Rightarrow> (wordinterval_to_set r1, wordinterval_to_set r2)) = (wordinterval_to_set rg \<inter> prefix_to_wordset pfx, wordinterval_to_set rg - prefix_to_wordset pfx)
[PROOF STEP]
using wordinterval_intersection_set_eq wordinterval_setminus_set_eq prefix_to_wordinterval_set_eq
[PROOF STATE]
proof (prove)
using this:
wordinterval_to_set (wordinterval_intersection ?r1.0 ?r2.0) = wordinterval_to_set ?r1.0 \<inter> wordinterval_to_set ?r2.0
wordinterval_to_set (wordinterval_setminus ?r1.0 ?r2.0) = wordinterval_to_set ?r1.0 - wordinterval_to_set ?r2.0
wordinterval_to_set (prefix_to_wordinterval ?pfx) = prefix_to_wordset ?pfx

goal (1 subgoal):
 1. (case (wordinterval_intersection rg (prefix_to_wordinterval pfx), wordinterval_setminus rg (prefix_to_wordinterval pfx)) of (r1, r2) \<Rightarrow> (wordinterval_to_set r1, wordinterval_to_set r2)) = (wordinterval_to_set rg \<inter> prefix_to_wordset pfx, wordinterval_to_set rg - prefix_to_wordset pfx)
[PROOF STEP]
by auto