[STATEMENT]
lemma
  fixes n :: nat
  assumes n: "n \<ge> 1"
  shows   \<pi>_bounds_aux: "ln (fact (2 * n)) - 2 * ln (fact n) =
                           prime_sum_upto (\<lambda>p. S n p * ln p) (2 * n)"
  and     \<pi>_lower_bound_ge_strong: "\<pi> (2 * n) \<ge> ln 2 / 2 * (2 * n) / ln (2 * n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (fact (2 * n)) - 2 * ln (fact n) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n)) &&& ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ln (fact (2 * n)) - 2 * ln (fact n) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n))
 2. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
define L :: "real \<Rightarrow> nat \<Rightarrow> nat" where "L = (\<lambda>x p. legendre_aux x p)"
[PROOF STATE]
proof (state)
this:
L = legendre_aux

goal (2 subgoals):
 1. ln (fact (2 * n)) - 2 * ln (fact n) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n))
 2. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
have "ln (fact (2 * n)) - 2 * ln (fact n) = sum_upto ln (2 * n) - 2 * sum_upto ln n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (fact (2 * n)) - 2 * ln (fact n) = sum_upto (\<lambda>x. ln (real x)) (real (2 * n)) - 2 * sum_upto (\<lambda>x. ln (real x)) (real n)
[PROOF STEP]
by (simp add: ln_fact_conv_sum_upto)
[PROOF STATE]
proof (state)
this:
ln (fact (2 * n)) - 2 * ln (fact n) = sum_upto (\<lambda>x. ln (real x)) (real (2 * n)) - 2 * sum_upto (\<lambda>x. ln (real x)) (real n)

goal (2 subgoals):
 1. ln (fact (2 * n)) - 2 * ln (fact n) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n))
 2. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (fact (2 * n)) - 2 * ln (fact n) = sum_upto (\<lambda>x. ln (real x)) (real (2 * n)) - 2 * sum_upto (\<lambda>x. ln (real x)) (real n)

goal (2 subgoals):
 1. ln (fact (2 * n)) - 2 * ln (fact n) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n))
 2. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
have "\<dots> = prime_sum_upto (\<lambda>p. L (2 * n) p * ln p) (2 * n) -
                    2 * prime_sum_upto (\<lambda>p. L n p * ln p) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>x. ln (real x)) (real (2 * n)) - 2 * sum_upto (\<lambda>x. ln (real x)) (real n) = prime_sum_upto (\<lambda>p. real (L (real (2 * n)) p) * ln (real p)) (real (2 * n)) - 2 * prime_sum_upto (\<lambda>p. real (L (real n) p) * ln (real p)) (real n)
[PROOF STEP]
by (subst (1 2) legendre_identity) (auto simp: L_def)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>x. ln (real x)) (real (2 * n)) - 2 * sum_upto (\<lambda>x. ln (real x)) (real n) = prime_sum_upto (\<lambda>p. real (L (real (2 * n)) p) * ln (real p)) (real (2 * n)) - 2 * prime_sum_upto (\<lambda>p. real (L (real n) p) * ln (real p)) (real n)

goal (2 subgoals):
 1. ln (fact (2 * n)) - 2 * ln (fact n) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n))
 2. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>x. ln (real x)) (real (2 * n)) - 2 * sum_upto (\<lambda>x. ln (real x)) (real n) = prime_sum_upto (\<lambda>p. real (L (real (2 * n)) p) * ln (real p)) (real (2 * n)) - 2 * prime_sum_upto (\<lambda>p. real (L (real n) p) * ln (real p)) (real n)

goal (2 subgoals):
 1. ln (fact (2 * n)) - 2 * ln (fact n) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n))
 2. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
have "prime_sum_upto (\<lambda>p. L n p * ln p) n = prime_sum_upto (\<lambda>p. L n p * ln p) (2 * n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_sum_upto (\<lambda>p. real (L (real n) p) * ln (real p)) (real n) = prime_sum_upto (\<lambda>p. real (L (real n) p) * ln (real p)) (real (2 * n))
[PROOF STEP]
unfolding prime_sum_upto_altdef2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p | prime p \<and> p \<le> nat \<lfloor>real n\<rfloor>. real (L (real n) p) * ln (real p)) = (\<Sum>p | prime p \<and> p \<le> nat \<lfloor>real (2 * n)\<rfloor>. real (L (real n) p) * ln (real p))
[PROOF STEP]
by (intro sum.mono_neutral_left[OF finite_subset[of _ "{..2*n}"]])
       (auto dest: prime_gt_0_nat legendre_aux_posD
             simp: legendre_aux_eq_0 L_def le_nat_iff le_floor_iff)
[PROOF STATE]
proof (state)
this:
prime_sum_upto (\<lambda>p. real (L (real n) p) * ln (real p)) (real n) = prime_sum_upto (\<lambda>p. real (L (real n) p) * ln (real p)) (real (2 * n))

goal (2 subgoals):
 1. ln (fact (2 * n)) - 2 * ln (fact n) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n))
 2. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_sum_upto (\<lambda>p. real (L (real n) p) * ln (real p)) (real n) = prime_sum_upto (\<lambda>p. real (L (real n) p) * ln (real p)) (real (2 * n))

goal (2 subgoals):
 1. ln (fact (2 * n)) - 2 * ln (fact n) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n))
 2. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
have "prime_sum_upto (\<lambda>p. L (2*n) p * ln p) (2*n) -
                 2 * prime_sum_upto (\<lambda>p. L n p * ln p) (2 * n) =
               prime_sum_upto (\<lambda>p. (real (L (2*n) p) - 2 * real (L n p)) * ln p) (2 * n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_sum_upto (\<lambda>p. real (L (real (2 * n)) p) * ln (real p)) (real (2 * n)) - 2 * prime_sum_upto (\<lambda>p. real (L (real n) p) * ln (real p)) (real (2 * n)) = prime_sum_upto (\<lambda>p. (real (L (real (2 * n)) p) - 2 * real (L (real n) p)) * ln (real p)) (real (2 * n))
[PROOF STEP]
by (simp add: ring_distribs sum_subtractf sum_distrib_left mult.assoc prime_sum_upto_def)
[PROOF STATE]
proof (state)
this:
prime_sum_upto (\<lambda>p. real (L (real (2 * n)) p) * ln (real p)) (real (2 * n)) - 2 * prime_sum_upto (\<lambda>p. real (L (real n) p) * ln (real p)) (real (2 * n)) = prime_sum_upto (\<lambda>p. (real (L (real (2 * n)) p) - 2 * real (L (real n) p)) * ln (real p)) (real (2 * n))

goal (2 subgoals):
 1. ln (fact (2 * n)) - 2 * ln (fact n) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n))
 2. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_sum_upto (\<lambda>p. real (L (real (2 * n)) p) * ln (real p)) (real (2 * n)) - 2 * prime_sum_upto (\<lambda>p. real (L (real n) p) * ln (real p)) (real (2 * n)) = prime_sum_upto (\<lambda>p. (real (L (real (2 * n)) p) - 2 * real (L (real n) p)) * ln (real p)) (real (2 * n))

goal (2 subgoals):
 1. ln (fact (2 * n)) - 2 * ln (fact n) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n))
 2. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
have "\<dots> = prime_sum_upto (\<lambda>p. of_int (S n p) * ln p) (2*n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_sum_upto (\<lambda>p. (real (L (real (2 * n)) p) - 2 * real (L (real n) p)) * ln (real p)) (real (2 * n)) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n))
[PROOF STEP]
unfolding prime_sum_upto_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p | prime p \<and> real p \<le> real (2 * n). (real (L (real (2 * n)) p) - 2 * real (L (real n) p)) * ln (real p)) = (\<Sum>p | prime p \<and> real p \<le> real (2 * n). real_of_int (S n p) * ln (real p))
[PROOF STEP]
proof (intro sum.cong refl, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {p. prime p \<and> real p \<le> real (2 * n)} \<Longrightarrow> (real (L (real (2 * n)) x) - 2 * real (L (real n) x)) * ln (real x) = real_of_int (S n x) * ln (real x)
[PROOF STEP]
case (1 p)
[PROOF STATE]
proof (state)
this:
p \<in> {p. prime p \<and> real p \<le> real (2 * n)}

goal (1 subgoal):
 1. \<And>x. x \<in> {p. prime p \<and> real p \<le> real (2 * n)} \<Longrightarrow> (real (L (real (2 * n)) x) - 2 * real (L (real n) x)) * ln (real x) = real_of_int (S n x) * ln (real x)
[PROOF STEP]
define ub where "ub = nat \<lfloor>log p (2*n)\<rfloor>"
[PROOF STATE]
proof (state)
this:
ub = nat \<lfloor>log (real p) (real (2 * n))\<rfloor>

goal (1 subgoal):
 1. \<And>x. x \<in> {p. prime p \<and> real p \<le> real (2 * n)} \<Longrightarrow> (real (L (real (2 * n)) x) - 2 * real (L (real n) x)) * ln (real x) = real_of_int (S n x) * ln (real x)
[PROOF STEP]
from 1
[PROOF STATE]
proof (chain)
picking this:
p \<in> {p. prime p \<and> real p \<le> real (2 * n)}
[PROOF STEP]
have p: "prime p" "p > 1" "p \<le> 2 * n"
[PROOF STATE]
proof (prove)
using this:
p \<in> {p. prime p \<and> real p \<le> real (2 * n)}

goal (1 subgoal):
 1. prime p &&& 1 < p &&& p \<le> 2 * n
[PROOF STEP]
using prime_gt_1_nat[of p]
[PROOF STATE]
proof (prove)
using this:
p \<in> {p. prime p \<and> real p \<le> real (2 * n)}
prime p \<Longrightarrow> 1 < p

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

goal (1 subgoal):
 1. \<And>x. x \<in> {p. prime p \<and> real p \<le> real (2 * n)} \<Longrightarrow> (real (L (real (2 * n)) x) - 2 * real (L (real n) x)) * ln (real x) = real_of_int (S n x) * ln (real x)
[PROOF STEP]
have "L (2 * n) p = (\<Sum>m\<in>{0<..ub}. nat \<lfloor>2*n/p^m\<rfloor>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L (real (2 * n)) p = (\<Sum>m\<in>{0<..ub}. nat \<lfloor>real (2 * n) / real (p ^ m)\<rfloor>)
[PROOF STEP]
unfolding L_def legendre_aux_altdef1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if prime p \<and> 1 \<le> real (2 * n) then \<Sum>m\<in>{0<..nat \<lfloor>log (real p) (real (2 * n))\<rfloor>}. nat \<lfloor>real (2 * n) / real (p ^ m)\<rfloor> else 0) = (\<Sum>m\<in>{0<..ub}. nat \<lfloor>real (2 * n) / real (p ^ m)\<rfloor>)
[PROOF STEP]
using p 1
[PROOF STATE]
proof (prove)
using this:
prime p
1 < p
p \<le> 2 * n
p \<in> {p. prime p \<and> real p \<le> real (2 * n)}

goal (1 subgoal):
 1. (if prime p \<and> 1 \<le> real (2 * n) then \<Sum>m\<in>{0<..nat \<lfloor>log (real p) (real (2 * n))\<rfloor>}. nat \<lfloor>real (2 * n) / real (p ^ m)\<rfloor> else 0) = (\<Sum>m\<in>{0<..ub}. nat \<lfloor>real (2 * n) / real (p ^ m)\<rfloor>)
[PROOF STEP]
by (auto simp: ub_def)
[PROOF STATE]
proof (state)
this:
L (real (2 * n)) p = (\<Sum>m\<in>{0<..ub}. nat \<lfloor>real (2 * n) / real (p ^ m)\<rfloor>)

goal (1 subgoal):
 1. \<And>x. x \<in> {p. prime p \<and> real p \<le> real (2 * n)} \<Longrightarrow> (real (L (real (2 * n)) x) - 2 * real (L (real n) x)) * ln (real x) = real_of_int (S n x) * ln (real x)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
L (real (2 * n)) p = (\<Sum>m\<in>{0<..ub}. nat \<lfloor>real (2 * n) / real (p ^ m)\<rfloor>)

goal (1 subgoal):
 1. \<And>x. x \<in> {p. prime p \<and> real p \<le> real (2 * n)} \<Longrightarrow> (real (L (real (2 * n)) x) - 2 * real (L (real n) x)) * ln (real x) = real_of_int (S n x) * ln (real x)
[PROOF STEP]
have "L n p = (\<Sum>m\<in>{0<..ub}. nat \<lfloor>n/p^m\<rfloor>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L (real n) p = (\<Sum>m\<in>{0<..ub}. nat \<lfloor>real n / real (p ^ m)\<rfloor>)
[PROOF STEP]
unfolding L_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. legendre_aux (real n) p = (\<Sum>m\<in>{0<..ub}. nat \<lfloor>real n / real (p ^ m)\<rfloor>)
[PROOF STEP]
proof (intro legendre_aux_altdef2)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. 1 \<le> real n
 2. prime p
 3. real n < real p ^ Suc ub
[PROOF STEP]
have "real n = real p powr log p n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n = real p powr log (real p) (real n)
[PROOF STEP]
using n p
[PROOF STATE]
proof (prove)
using this:
1 \<le> n
prime p
1 < p
p \<le> 2 * n

goal (1 subgoal):
 1. real n = real p powr log (real p) (real n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real n = real p powr log (real p) (real n)

goal (3 subgoals):
 1. 1 \<le> real n
 2. prime p
 3. real n < real p ^ Suc ub
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real n = real p powr log (real p) (real n)

goal (3 subgoals):
 1. 1 \<le> real n
 2. prime p
 3. real n < real p ^ Suc ub
[PROOF STEP]
have "log (real p) 2 > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < log (real p) 2
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
prime p
1 < p
p \<le> 2 * n

goal (1 subgoal):
 1. 0 < log (real p) 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < log (real p) 2

goal (3 subgoals):
 1. 1 \<le> real n
 2. prime p
 3. real n < real p ^ Suc ub
[PROOF STEP]
hence "log p n < 1 + of_int \<lfloor>log p 2 + log p n\<rfloor>"
[PROOF STATE]
proof (prove)
using this:
0 < log (real p) 2

goal (1 subgoal):
 1. log (real p) (real n) < 1 + real_of_int \<lfloor>log (real p) 2 + log (real p) (real n)\<rfloor>
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
log (real p) (real n) < 1 + real_of_int \<lfloor>log (real p) 2 + log (real p) (real n)\<rfloor>

goal (3 subgoals):
 1. 1 \<le> real n
 2. prime p
 3. real n < real p ^ Suc ub
[PROOF STEP]
hence "real p powr log p n < real p powr Suc ub"
[PROOF STATE]
proof (prove)
using this:
log (real p) (real n) < 1 + real_of_int \<lfloor>log (real p) 2 + log (real p) (real n)\<rfloor>

goal (1 subgoal):
 1. real p powr log (real p) (real n) < real p powr real (Suc ub)
[PROOF STEP]
unfolding ub_def
[PROOF STATE]
proof (prove)
using this:
log (real p) (real n) < 1 + real_of_int \<lfloor>log (real p) 2 + log (real p) (real n)\<rfloor>

goal (1 subgoal):
 1. real p powr log (real p) (real n) < real p powr real (Suc (nat \<lfloor>log (real p) (real (2 * n))\<rfloor>))
[PROOF STEP]
using n p
[PROOF STATE]
proof (prove)
using this:
log (real p) (real n) < 1 + real_of_int \<lfloor>log (real p) 2 + log (real p) (real n)\<rfloor>
1 \<le> n
prime p
1 < p
p \<le> 2 * n

goal (1 subgoal):
 1. real p powr log (real p) (real n) < real p powr real (Suc (nat \<lfloor>log (real p) (real (2 * n))\<rfloor>))
[PROOF STEP]
by (intro powr_less_mono) (auto simp: log_mult)
[PROOF STATE]
proof (state)
this:
real p powr log (real p) (real n) < real p powr real (Suc ub)

goal (3 subgoals):
 1. 1 \<le> real n
 2. prime p
 3. real n < real p ^ Suc ub
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real p powr log (real p) (real n) < real p powr real (Suc ub)

goal (3 subgoals):
 1. 1 \<le> real n
 2. prime p
 3. real n < real p ^ Suc ub
[PROOF STEP]
have "\<dots> = p ^ Suc ub"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real p powr real (Suc ub) = real (p ^ Suc ub)
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
prime p
1 < p
p \<le> 2 * n

goal (1 subgoal):
 1. real p powr real (Suc ub) = real (p ^ Suc ub)
[PROOF STEP]
by (subst powr_realpow) auto
[PROOF STATE]
proof (state)
this:
real p powr real (Suc ub) = real (p ^ Suc ub)

goal (3 subgoals):
 1. 1 \<le> real n
 2. prime p
 3. real n < real p ^ Suc ub
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real n < real (p ^ Suc ub)
[PROOF STEP]
show "real n < real p ^ Suc ub"
[PROOF STATE]
proof (prove)
using this:
real n < real (p ^ Suc ub)

goal (1 subgoal):
 1. real n < real p ^ Suc ub
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real n < real p ^ Suc ub

goal (2 subgoals):
 1. 1 \<le> real n
 2. prime p
[PROOF STEP]
qed (use n p in auto)
[PROOF STATE]
proof (state)
this:
L (real n) p = (\<Sum>m\<in>{0<..ub}. nat \<lfloor>real n / real (p ^ m)\<rfloor>)

goal (1 subgoal):
 1. \<And>x. x \<in> {p. prime p \<and> real p \<le> real (2 * n)} \<Longrightarrow> (real (L (real (2 * n)) x) - 2 * real (L (real n) x)) * ln (real x) = real_of_int (S n x) * ln (real x)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
L (real (2 * n)) p = (\<Sum>m\<in>{0<..ub}. nat \<lfloor>real (2 * n) / real (p ^ m)\<rfloor>)
L (real n) p = (\<Sum>m\<in>{0<..ub}. nat \<lfloor>real n / real (p ^ m)\<rfloor>)
[PROOF STEP]
have "real (L (2 * n) p) - 2 * real (L n p) =
                       (\<Sum>m\<in>{0<..ub}. real (nat \<lfloor>2*n/p^m\<rfloor>) - 2 * real (nat \<lfloor>n/p^m\<rfloor>))"
[PROOF STATE]
proof (prove)
using this:
L (real (2 * n)) p = (\<Sum>m\<in>{0<..ub}. nat \<lfloor>real (2 * n) / real (p ^ m)\<rfloor>)
L (real n) p = (\<Sum>m\<in>{0<..ub}. nat \<lfloor>real n / real (p ^ m)\<rfloor>)

goal (1 subgoal):
 1. real (L (real (2 * n)) p) - 2 * real (L (real n) p) = (\<Sum>m\<in>{0<..ub}. real (nat \<lfloor>real (2 * n) / real (p ^ m)\<rfloor>) - 2 * real (nat \<lfloor>real n / real (p ^ m)\<rfloor>))
[PROOF STEP]
by (simp add: sum_subtractf sum_distrib_left)
[PROOF STATE]
proof (state)
this:
real (L (real (2 * n)) p) - 2 * real (L (real n) p) = (\<Sum>m\<in>{0<..ub}. real (nat \<lfloor>real (2 * n) / real (p ^ m)\<rfloor>) - 2 * real (nat \<lfloor>real n / real (p ^ m)\<rfloor>))

goal (1 subgoal):
 1. \<And>x. x \<in> {p. prime p \<and> real p \<le> real (2 * n)} \<Longrightarrow> (real (L (real (2 * n)) x) - 2 * real (L (real n) x)) * ln (real x) = real_of_int (S n x) * ln (real x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (L (real (2 * n)) p) - 2 * real (L (real n) p) = (\<Sum>m\<in>{0<..ub}. real (nat \<lfloor>real (2 * n) / real (p ^ m)\<rfloor>) - 2 * real (nat \<lfloor>real n / real (p ^ m)\<rfloor>))

goal (1 subgoal):
 1. \<And>x. x \<in> {p. prime p \<and> real p \<le> real (2 * n)} \<Longrightarrow> (real (L (real (2 * n)) x) - 2 * real (L (real n) x)) * ln (real x) = real_of_int (S n x) * ln (real x)
[PROOF STEP]
have "\<dots> = of_int (\<Sum>m\<in>{0<..ub}. \<lfloor>2*n/p^m\<rfloor> - 2 * \<lfloor>n/p^m\<rfloor>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m\<in>{0<..ub}. real (nat \<lfloor>real (2 * n) / real (p ^ m)\<rfloor>) - 2 * real (nat \<lfloor>real n / real (p ^ m)\<rfloor>)) = real_of_int (\<Sum>m\<in>{0<..ub}. \<lfloor>real (2 * n) / real (p ^ m)\<rfloor> - 2 * \<lfloor>real n / real (p ^ m)\<rfloor>)
[PROOF STEP]
unfolding of_int_sum
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m\<in>{0<..ub}. real (nat \<lfloor>real (2 * n) / real (p ^ m)\<rfloor>) - 2 * real (nat \<lfloor>real n / real (p ^ m)\<rfloor>)) = (\<Sum>x\<in>{0<..ub}. real_of_int (\<lfloor>real (2 * n) / real (p ^ x)\<rfloor> - 2 * \<lfloor>real n / real (p ^ x)\<rfloor>))
[PROOF STEP]
by (intro sum.cong) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>m\<in>{0<..ub}. real (nat \<lfloor>real (2 * n) / real (p ^ m)\<rfloor>) - 2 * real (nat \<lfloor>real n / real (p ^ m)\<rfloor>)) = real_of_int (\<Sum>m\<in>{0<..ub}. \<lfloor>real (2 * n) / real (p ^ m)\<rfloor> - 2 * \<lfloor>real n / real (p ^ m)\<rfloor>)

goal (1 subgoal):
 1. \<And>x. x \<in> {p. prime p \<and> real p \<le> real (2 * n)} \<Longrightarrow> (real (L (real (2 * n)) x) - 2 * real (L (real n) x)) * ln (real x) = real_of_int (S n x) * ln (real x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (L (real (2 * n)) p) - 2 * real (L (real n) p) = real_of_int (\<Sum>m\<in>{0<..ub}. \<lfloor>real (2 * n) / real (p ^ m)\<rfloor> - 2 * \<lfloor>real n / real (p ^ m)\<rfloor>)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
real (L (real (2 * n)) p) - 2 * real (L (real n) p) = real_of_int (\<Sum>m\<in>{0<..ub}. \<lfloor>real (2 * n) / real (p ^ m)\<rfloor> - 2 * \<lfloor>real n / real (p ^ m)\<rfloor>)

goal (1 subgoal):
 1. (real (L (real (2 * n)) p) - 2 * real (L (real n) p)) * ln (real p) = real_of_int (S n p) * ln (real p)
[PROOF STEP]
by (simp add: ub_def S_def)
[PROOF STATE]
proof (state)
this:
(real (L (real (2 * n)) p) - 2 * real (L (real n) p)) * ln (real p) = real_of_int (S n p) * ln (real p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
prime_sum_upto (\<lambda>p. (real (L (real (2 * n)) p) - 2 * real (L (real n) p)) * ln (real p)) (real (2 * n)) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n))

goal (2 subgoals):
 1. ln (fact (2 * n)) - 2 * ln (fact n) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n))
 2. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ln (fact (2 * n)) - 2 * ln (fact n) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n))
[PROOF STEP]
show eq: "ln (fact (2 * n)) - 2 * ln (fact n) =
                      prime_sum_upto (\<lambda>p. S n p * ln p) (2 * n)"
[PROOF STATE]
proof (prove)
using this:
ln (fact (2 * n)) - 2 * ln (fact n) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n))

goal (1 subgoal):
 1. ln (fact (2 * n)) - 2 * ln (fact n) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ln (fact (2 * n)) - 2 * ln (fact n) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n))

goal (1 subgoal):
 1. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
have S_nonneg: "S n p \<ge> 0" for p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> S n p
[PROOF STEP]
unfolding S_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (\<Sum>m\<in>{0<..nat \<lfloor>log (real p) (2 * real n)\<rfloor>}. \<lfloor>2 * real n / real p ^ m\<rfloor> - 2 * \<lfloor>real n / real p ^ m\<rfloor>)
[PROOF STEP]
by (intro sum_nonneg) linarith
[PROOF STATE]
proof (state)
this:
0 \<le> S n ?p

goal (1 subgoal):
 1. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
have S_le: "S n p \<le> \<lfloor>log p (2*n)\<rfloor>" if "prime p" for p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S n p \<le> \<lfloor>log (real p) (real (2 * n))\<rfloor>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S n p \<le> \<lfloor>log (real p) (real (2 * n))\<rfloor>
[PROOF STEP]
have "S n p \<le> (\<Sum>m\<in>{0<..nat \<lfloor>log p (2*n)\<rfloor>}. 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S n p \<le> (\<Sum>m\<in>{0<..nat \<lfloor>log (real p) (real (2 * n))\<rfloor>}. 1)
[PROOF STEP]
unfolding S_def of_nat_mult of_nat_numeral
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m\<in>{0<..nat \<lfloor>log (real p) (2 * real n)\<rfloor>}. \<lfloor>2 * real n / real p ^ m\<rfloor> - 2 * \<lfloor>real n / real p ^ m\<rfloor>) \<le> (\<Sum>m\<in>{0<..nat \<lfloor>log (real p) (2 * real n)\<rfloor>}. 1)
[PROOF STEP]
by (intro sum_mono) linarith
[PROOF STATE]
proof (state)
this:
S n p \<le> (\<Sum>m\<in>{0<..nat \<lfloor>log (real p) (real (2 * n))\<rfloor>}. 1)

goal (1 subgoal):
 1. S n p \<le> \<lfloor>log (real p) (real (2 * n))\<rfloor>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
S n p \<le> (\<Sum>m\<in>{0<..nat \<lfloor>log (real p) (real (2 * n))\<rfloor>}. 1)

goal (1 subgoal):
 1. S n p \<le> \<lfloor>log (real p) (real (2 * n))\<rfloor>
[PROOF STEP]
using prime_gt_1_nat[of p] that n
[PROOF STATE]
proof (prove)
using this:
S n p \<le> (\<Sum>m\<in>{0<..nat \<lfloor>log (real p) (real (2 * n))\<rfloor>}. 1)
prime p \<Longrightarrow> 1 < p
prime p
1 \<le> n

goal (1 subgoal):
 1. S n p \<le> \<lfloor>log (real p) (real (2 * n))\<rfloor>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S n p \<le> \<lfloor>log (real p) (real (2 * n))\<rfloor>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
prime ?p \<Longrightarrow> S n ?p \<le> \<lfloor>log (real ?p) (real (2 * n))\<rfloor>

goal (1 subgoal):
 1. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
have "n * ln 2 = ln (real (2 ^ n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n * ln 2 = ln (real (2 ^ n))
[PROOF STEP]
by (simp add: ln_realpow)
[PROOF STATE]
proof (state)
this:
real n * ln 2 = ln (real (2 ^ n))

goal (1 subgoal):
 1. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real n * ln 2 = ln (real (2 ^ n))

goal (1 subgoal):
 1. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
have "\<dots> \<le> ln (real ((2*n) choose n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (real (2 ^ n)) \<le> ln (real (2 * n choose n))
[PROOF STEP]
using twopow_le_central_binomial[of n]
[PROOF STATE]
proof (prove)
using this:
2 ^ n \<le> 2 * n choose n

goal (1 subgoal):
 1. ln (real (2 ^ n)) \<le> ln (real (2 * n choose n))
[PROOF STEP]
by (subst ln_le_cancel_iff; (unfold of_nat_le_iff)?) auto
[PROOF STATE]
proof (state)
this:
ln (real (2 ^ n)) \<le> ln (real (2 * n choose n))

goal (1 subgoal):
 1. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (real (2 ^ n)) \<le> ln (real (2 * n choose n))

goal (1 subgoal):
 1. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
have "\<dots> = ln (fact (2 * n)) - 2 * ln (fact n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (real (2 * n choose n)) = ln (fact (2 * n)) - 2 * ln (fact n)
[PROOF STEP]
by (simp add: binomial_fact ln_div ln_mult)
[PROOF STATE]
proof (state)
this:
ln (real (2 * n choose n)) = ln (fact (2 * n)) - 2 * ln (fact n)

goal (1 subgoal):
 1. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (real (2 * n choose n)) = ln (fact (2 * n)) - 2 * ln (fact n)

goal (1 subgoal):
 1. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
have "\<dots> = prime_sum_upto (\<lambda>p. S n p * ln p) (2 * n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (fact (2 * n)) - 2 * ln (fact n) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n))
[PROOF STEP]
by (fact eq)
[PROOF STATE]
proof (state)
this:
ln (fact (2 * n)) - 2 * ln (fact n) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n))

goal (1 subgoal):
 1. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (fact (2 * n)) - 2 * ln (fact n) = prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n))

goal (1 subgoal):
 1. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
have "\<dots> \<le> prime_sum_upto (\<lambda>p. \<lfloor>log p (2*n)\<rfloor> * ln p) (2 * n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n)) \<le> prime_sum_upto (\<lambda>p. real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p)) (real (2 * n))
[PROOF STEP]
unfolding prime_sum_upto_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p | prime p \<and> real p \<le> real (2 * n). real_of_int (S n p) * ln (real p)) \<le> (\<Sum>p | prime p \<and> real p \<le> real (2 * n). real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p))
[PROOF STEP]
using S_le
[PROOF STATE]
proof (prove)
using this:
prime ?p \<Longrightarrow> S n ?p \<le> \<lfloor>log (real ?p) (real (2 * n))\<rfloor>

goal (1 subgoal):
 1. (\<Sum>p | prime p \<and> real p \<le> real (2 * n). real_of_int (S n p) * ln (real p)) \<le> (\<Sum>p | prime p \<and> real p \<le> real (2 * n). real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p))
[PROOF STEP]
by (intro sum_mono mult_right_mono) (auto dest: prime_gt_0_nat)
[PROOF STATE]
proof (state)
this:
prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n)) \<le> prime_sum_upto (\<lambda>p. real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p)) (real (2 * n))

goal (1 subgoal):
 1. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_sum_upto (\<lambda>p. real_of_int (S n p) * ln (real p)) (real (2 * n)) \<le> prime_sum_upto (\<lambda>p. real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p)) (real (2 * n))

goal (1 subgoal):
 1. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
have "\<dots> \<le> prime_sum_upto (\<lambda>p. ln (2 * n)) (2 * n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_sum_upto (\<lambda>p. real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p)) (real (2 * n)) \<le> prime_sum_upto (\<lambda>p. ln (real (2 * n))) (real (2 * n))
[PROOF STEP]
unfolding prime_sum_upto_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p | prime p \<and> real p \<le> real (2 * n). real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p)) \<le> (\<Sum>p | prime p \<and> real p \<le> real (2 * n). ln (real (2 * n)))
[PROOF STEP]
proof (intro sum_mono)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. p \<in> {p. prime p \<and> real p \<le> real (2 * n)} \<Longrightarrow> real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p) \<le> ln (real (2 * n))
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. p \<in> {p. prime p \<and> real p \<le> real (2 * n)} \<Longrightarrow> real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p) \<le> ln (real (2 * n))
[PROOF STEP]
assume "p \<in> {p. prime p \<and> real p \<le> real (2 * n)}"
[PROOF STATE]
proof (state)
this:
p \<in> {p. prime p \<and> real p \<le> real (2 * n)}

goal (1 subgoal):
 1. \<And>p. p \<in> {p. prime p \<and> real p \<le> real (2 * n)} \<Longrightarrow> real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p) \<le> ln (real (2 * n))
[PROOF STEP]
hence p: "p > 1"
[PROOF STATE]
proof (prove)
using this:
p \<in> {p. prime p \<and> real p \<le> real (2 * n)}

goal (1 subgoal):
 1. 1 < p
[PROOF STEP]
using prime_gt_1_nat[of p]
[PROOF STATE]
proof (prove)
using this:
p \<in> {p. prime p \<and> real p \<le> real (2 * n)}
prime p \<Longrightarrow> 1 < p

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

goal (1 subgoal):
 1. \<And>p. p \<in> {p. prime p \<and> real p \<le> real (2 * n)} \<Longrightarrow> real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p) \<le> ln (real (2 * n))
[PROOF STEP]
have "real_of_int \<lfloor>log p (2 * n)\<rfloor> = real_of_int \<lfloor>ln (2 * n) / ln p\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> = real_of_int \<lfloor>ln (real (2 * n)) / ln (real p)\<rfloor>
[PROOF STEP]
using p n
[PROOF STATE]
proof (prove)
using this:
1 < p
1 \<le> n

goal (1 subgoal):
 1. real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> = real_of_int \<lfloor>ln (real (2 * n)) / ln (real p)\<rfloor>
[PROOF STEP]
by (simp add: log_def ln_mult)
[PROOF STATE]
proof (state)
this:
real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> = real_of_int \<lfloor>ln (real (2 * n)) / ln (real p)\<rfloor>

goal (1 subgoal):
 1. \<And>p. p \<in> {p. prime p \<and> real p \<le> real (2 * n)} \<Longrightarrow> real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p) \<le> ln (real (2 * n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> = real_of_int \<lfloor>ln (real (2 * n)) / ln (real p)\<rfloor>

goal (1 subgoal):
 1. \<And>p. p \<in> {p. prime p \<and> real p \<le> real (2 * n)} \<Longrightarrow> real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p) \<le> ln (real (2 * n))
[PROOF STEP]
have "\<dots> \<le> ln (2 * n) / ln p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int \<lfloor>ln (real (2 * n)) / ln (real p)\<rfloor> \<le> ln (real (2 * n)) / ln (real p)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
real_of_int \<lfloor>ln (real (2 * n)) / ln (real p)\<rfloor> \<le> ln (real (2 * n)) / ln (real p)

goal (1 subgoal):
 1. \<And>p. p \<in> {p. prime p \<and> real p \<le> real (2 * n)} \<Longrightarrow> real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p) \<le> ln (real (2 * n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int \<lfloor>ln (real (2 * n)) / ln (real p)\<rfloor> \<le> ln (real (2 * n)) / ln (real p)

goal (1 subgoal):
 1. \<And>p. p \<in> {p. prime p \<and> real p \<le> real (2 * n)} \<Longrightarrow> real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p) \<le> ln (real (2 * n))
[PROOF STEP]
have "\<dots> * ln p = ln (2 * n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (real (2 * n)) / ln (real p) * ln (real p) = ln (real (2 * n))
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
1 < p

goal (1 subgoal):
 1. ln (real (2 * n)) / ln (real p) * ln (real p) = ln (real (2 * n))
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
ln (real (2 * n)) / ln (real p) * ln (real p) = ln (real (2 * n))

goal (1 subgoal):
 1. \<And>p. p \<in> {p. prime p \<and> real p \<le> real (2 * n)} \<Longrightarrow> real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p) \<le> ln (real (2 * n))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x \<le> y \<Longrightarrow> x * ln (real p) \<le> y * ln (real p)) \<Longrightarrow> real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p) \<le> ln (real (2 * n))
[PROOF STEP]
show "real_of_int \<lfloor>log p (2 * n)\<rfloor> * ln p \<le> ln (2 * n)"
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> x * ln (real p) \<le> y * ln (real p)) \<Longrightarrow> real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p) \<le> ln (real (2 * n))

goal (1 subgoal):
 1. real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p) \<le> ln (real (2 * n))
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> x * ln (real p) \<le> y * ln (real p)) \<Longrightarrow> real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p) \<le> ln (real (2 * n))
1 < p

goal (1 subgoal):
 1. real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p) \<le> ln (real (2 * n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p) \<le> ln (real (2 * n))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
prime_sum_upto (\<lambda>p. real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p)) (real (2 * n)) \<le> prime_sum_upto (\<lambda>p. ln (real (2 * n))) (real (2 * n))

goal (1 subgoal):
 1. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_sum_upto (\<lambda>p. real_of_int \<lfloor>log (real p) (real (2 * n))\<rfloor> * ln (real p)) (real (2 * n)) \<le> prime_sum_upto (\<lambda>p. ln (real (2 * n))) (real (2 * n))

goal (1 subgoal):
 1. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
have "\<dots> = ln (2 * n) * \<pi> (2 * n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_sum_upto (\<lambda>p. ln (real (2 * n))) (real (2 * n)) = ln (real (2 * n)) * \<pi> (real (2 * n))
[PROOF STEP]
by (simp add: \<pi>_def prime_sum_upto_def)
[PROOF STATE]
proof (state)
this:
prime_sum_upto (\<lambda>p. ln (real (2 * n))) (real (2 * n)) = ln (real (2 * n)) * \<pi> (real (2 * n))

goal (1 subgoal):
 1. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real n * ln 2 \<le> ln (real (2 * n)) * \<pi> (real (2 * n))
[PROOF STEP]
show "\<pi> (2 * n) \<ge> (ln 2 / 2) * (2 * n) / ln (2 * n)"
[PROOF STATE]
proof (prove)
using this:
real n * ln 2 \<le> ln (real (2 * n)) * \<pi> (real (2 * n))

goal (1 subgoal):
 1. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
real n * ln 2 \<le> ln (real (2 * n)) * \<pi> (real (2 * n))
1 \<le> n

goal (1 subgoal):
 1. ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
ln 2 / 2 * real (2 * n) / ln (real (2 * n)) \<le> \<pi> (real (2 * n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma E_inf_greatest:
  "(\<And>cfg. cfg \<in> cfg_on s \<Longrightarrow> x \<le> (\<integral>\<^sup>+x. f x \<partial>T cfg)) \<Longrightarrow> x \<le> E_inf s f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>cfg. cfg \<in> cfg_on s \<Longrightarrow> x \<le> integral\<^sup>N (T cfg) f) \<Longrightarrow> x \<le> E_inf s f
[PROOF STEP]
unfolding E_inf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>cfg. cfg \<in> cfg_on s \<Longrightarrow> x \<le> integral\<^sup>N (T cfg) f) \<Longrightarrow> x \<le> (\<Sqinter>cfg\<in>cfg_on s. integral\<^sup>N (T cfg) f)
[PROOF STEP]
by (rule INF_greatest)


[STATEMENT]
lemma analz_Un: "analz(G) \<union> analz(H) \<subseteq> analz(G \<union> H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. analz G \<union> analz H \<subseteq> analz (G \<union> H)
[PROOF STEP]
by (intro Un_least analz_mono Un_upper1 Un_upper2)


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


[STATEMENT]
lemma measure_notin_sets: "A \<notin> sets M \<Longrightarrow> measure M A = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<notin> sets M \<Longrightarrow> Sigma_Algebra.measure M A = 0
[PROOF STEP]
by (simp add: measure_def emeasure_notin_sets zero_ennreal.rep_eq)


[STATEMENT]
lemma mat_kernel_dim_mult_eq_right: assumes A: "A \<in> carrier_mat nr nc"
  and B: "B \<in> carrier_mat nc nc"
  and C: "C \<in> carrier_mat nc nc"
  and BC: "B * C = 1\<^sub>m nc"
  shows "kernel.dim nc (A * B) = kernel.dim nc A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel (A * B)\<rparr>) = vectorspace.dim class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel (A * B)\<rparr>) = vectorspace.dim class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>)
[PROOF STEP]
let ?AB = "A * B"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel (A * B)\<rparr>) = vectorspace.dim class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>)
[PROOF STEP]
from A B
[PROOF STATE]
proof (chain)
picking this:
A \<in> carrier_mat nr nc
B \<in> carrier_mat nc nc
[PROOF STEP]
have AB: "?AB \<in> carrier_mat nr nc"
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr nc
B \<in> carrier_mat nc nc

goal (1 subgoal):
 1. A * B \<in> carrier_mat nr nc
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A * B \<in> carrier_mat nr nc

goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel (A * B)\<rparr>) = vectorspace.dim class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>)
[PROOF STEP]
interpret AB: kernel nr nc ?AB
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix_Kernel.kernel nr nc (A * B)
[PROOF STEP]
by (unfold_locales, rule AB)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AB.dim = vectorspace.dim class_ring (AB.NC.vs (mat_kernel A))
[PROOF STEP]
interpret A: kernel nr nc A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix_Kernel.kernel nr nc A
[PROOF STEP]
by (unfold_locales, rule A)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AB.dim = A.dim
[PROOF STEP]
from kernel_basis_exists[OF AB]
[PROOF STATE]
proof (chain)
picking this:
\<exists>B. finite B \<and> AB.basis B
[PROOF STEP]
obtain bas where finb: "finite bas" and bas: "AB.basis bas"
[PROOF STATE]
proof (prove)
using this:
\<exists>B. finite B \<and> AB.basis B

goal (1 subgoal):
 1. (\<And>bas. \<lbrakk>finite bas; AB.basis bas\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite bas
AB.basis bas

goal (1 subgoal):
 1. AB.dim = A.dim
[PROOF STEP]
let ?bas = "((*\<^sub>v) B) ` bas"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AB.dim = A.dim
[PROOF STEP]
from mat_kernel_mult_right_basis[OF A B C BC finb bas] finb
[PROOF STATE]
proof (chain)
picking this:
A.basis ((*\<^sub>v) B ` bas)
card ((*\<^sub>v) B ` bas) = card bas
finite bas
[PROOF STEP]
have bas': "A.basis ?bas" and finb': "finite ?bas" and card: "card ?bas = card bas"
[PROOF STATE]
proof (prove)
using this:
A.basis ((*\<^sub>v) B ` bas)
card ((*\<^sub>v) B ` bas) = card bas
finite bas

goal (1 subgoal):
 1. A.basis ((*\<^sub>v) B ` bas) &&& finite ((*\<^sub>v) B ` bas) &&& card ((*\<^sub>v) B ` bas) = card bas
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A.basis ((*\<^sub>v) B ` bas)
finite ((*\<^sub>v) B ` bas)
card ((*\<^sub>v) B ` bas) = card bas

goal (1 subgoal):
 1. AB.dim = A.dim
[PROOF STEP]
show "AB.dim = A.dim"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AB.dim = A.dim
[PROOF STEP]
unfolding A.Ker.dim_basis[OF finb' bas'] AB.Ker.dim_basis[OF finb bas] card
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card bas = card bas
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
AB.dim = A.dim

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma complex_half [simp]:
  shows "(Complex a b) / 2 = Complex (a/2) (b/2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex a b / 2 = Complex (a / 2) (b / 2)
[PROOF STEP]
by (subst complex_eq_iff) auto


[STATEMENT]
lemma open_cballE:
  assumes "open S" "x\<in>S"
  obtains e where "e>0" "cball x e \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>e. \<lbrakk>0 < e; cball x e \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
open S
x \<in> S

goal (1 subgoal):
 1. (\<And>e. \<lbrakk>0 < e; cball x e \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding open_contains_cball
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. \<exists>e>0. cball x e \<subseteq> S
x \<in> S

goal (1 subgoal):
 1. (\<And>e. \<lbrakk>0 < e; cball x e \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto


[STATEMENT]
lemma distinct_sorted_mono_iff:
  assumes "distinct l" "sorted l"
  assumes "i<length l" "j<length l"
  shows "l!i\<le>l!j \<longleftrightarrow> i\<le>j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (l ! i \<le> l ! j) = (i \<le> j)
[PROOF STEP]
by (metis assms distinct_sorted_strict_mono_iff leD le_less_linear)


[STATEMENT]
lemma poly_eval_monomial: "poly_eval a (monomial c t) = c * (\<Prod>x\<in>keys t. a x ^ lookup t x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_eval a (monomial c t) = c * (\<Prod>x\<in>keys t. a x ^ lookup t x)
[PROOF STEP]
by (simp add: poly_eval_def poly_subst_monomial subst_pp_def punit.lookup_monom_mult
      lookup_prod_zero lookup_power_zero)


[STATEMENT]
lemma lemma_4_5_b: "a \<le> c \<Longrightarrow> b \<le> c \<Longrightarrow> a \<squnion>2 b \<le> c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<le> c; b \<le> c\<rbrakk> \<Longrightarrow> a \<squnion>2 b \<le> c
[PROOF STEP]
apply (subst right_lesseq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<le> c; b \<le> c\<rbrakk> \<Longrightarrow> a \<squnion>2 b r\<rightarrow> c = (1::'a)
[PROOF STEP]
apply (subst lemma_4_5_vi)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<le> c; b \<le> c\<rbrakk> \<Longrightarrow> (a r\<rightarrow> c) \<sqinter> (b r\<rightarrow> c) = (1::'a)
[PROOF STEP]
by simp


[STATEMENT]
lemma square_less_square: "\<And> x y. 0 \<le> (x :: 'a :: linordered_field) \<Longrightarrow> 0 \<le> y \<Longrightarrow> (x * x < y * y) = (x < y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>(0::'a) \<le> x; (0::'a) \<le> y\<rbrakk> \<Longrightarrow> (x * x < y * y) = (x < y)
[PROOF STEP]
by (metis mult_mono mult_strict_mono' not_less)


[STATEMENT]
theorem dnf_eval :
  "(\<exists>(al,fl)\<in>set (dnf \<phi>).
     (\<forall>a\<in>set al. aEval a xs)
   \<and> (\<forall>f\<in>set fl. eval f xs))
   = eval \<phi> xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>(al, fl)\<in>set (dnf \<phi>). (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs
[PROOF STEP]
proof(induction \<phi>)
[PROOF STATE]
proof (state)
goal (10 subgoals):
 1. (\<exists>a\<in>set (dnf TrueF). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval TrueF xs
 2. (\<exists>a\<in>set (dnf FalseF). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval FalseF xs
 3. \<And>x. (\<exists>a\<in>set (dnf (fm.Atom x)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (fm.Atom x) xs
 4. \<And>\<phi>1 \<phi>2. \<lbrakk>(\<exists>a\<in>set (dnf \<phi>1). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>1 xs; (\<exists>a\<in>set (dnf \<phi>2). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>2 xs\<rbrakk> \<Longrightarrow> (\<exists>a\<in>set (dnf (And \<phi>1 \<phi>2)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (And \<phi>1 \<phi>2) xs
 5. \<And>\<phi>1 \<phi>2. \<lbrakk>(\<exists>a\<in>set (dnf \<phi>1). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>1 xs; (\<exists>a\<in>set (dnf \<phi>2). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>2 xs\<rbrakk> \<Longrightarrow> (\<exists>a\<in>set (dnf (Or \<phi>1 \<phi>2)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (Or \<phi>1 \<phi>2) xs
 6. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (Neg \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (Neg \<phi>) xs
 7. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (ExQ \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (ExQ \<phi>) xs
 8. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (AllQ \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (AllQ \<phi>) xs
 9. \<And>x1 \<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (ExN x1 \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (ExN x1 \<phi>) xs
 10. \<And>x1 \<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (AllN x1 \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (AllN x1 \<phi>) xs
[PROOF STEP]
case (And \<phi>1 \<phi>2)
[PROOF STATE]
proof (state)
this:
(\<exists>a\<in>set (dnf \<phi>1). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>1 xs
(\<exists>a\<in>set (dnf \<phi>2). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>2 xs

goal (10 subgoals):
 1. (\<exists>a\<in>set (dnf TrueF). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval TrueF xs
 2. (\<exists>a\<in>set (dnf FalseF). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval FalseF xs
 3. \<And>x. (\<exists>a\<in>set (dnf (fm.Atom x)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (fm.Atom x) xs
 4. \<And>\<phi>1 \<phi>2. \<lbrakk>(\<exists>a\<in>set (dnf \<phi>1). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>1 xs; (\<exists>a\<in>set (dnf \<phi>2). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>2 xs\<rbrakk> \<Longrightarrow> (\<exists>a\<in>set (dnf (And \<phi>1 \<phi>2)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (And \<phi>1 \<phi>2) xs
 5. \<And>\<phi>1 \<phi>2. \<lbrakk>(\<exists>a\<in>set (dnf \<phi>1). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>1 xs; (\<exists>a\<in>set (dnf \<phi>2). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>2 xs\<rbrakk> \<Longrightarrow> (\<exists>a\<in>set (dnf (Or \<phi>1 \<phi>2)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (Or \<phi>1 \<phi>2) xs
 6. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (Neg \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (Neg \<phi>) xs
 7. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (ExQ \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (ExQ \<phi>) xs
 8. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (AllQ \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (AllQ \<phi>) xs
 9. \<And>x1 \<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (ExN x1 \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (ExN x1 \<phi>) xs
 10. \<And>x1 \<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (AllN x1 \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (AllN x1 \<phi>) xs
[PROOF STEP]
define f where "f = (\<lambda>a. case a of
        (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs))"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>a. case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs))

goal (10 subgoals):
 1. (\<exists>a\<in>set (dnf TrueF). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval TrueF xs
 2. (\<exists>a\<in>set (dnf FalseF). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval FalseF xs
 3. \<And>x. (\<exists>a\<in>set (dnf (fm.Atom x)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (fm.Atom x) xs
 4. \<And>\<phi>1 \<phi>2. \<lbrakk>(\<exists>a\<in>set (dnf \<phi>1). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>1 xs; (\<exists>a\<in>set (dnf \<phi>2). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>2 xs\<rbrakk> \<Longrightarrow> (\<exists>a\<in>set (dnf (And \<phi>1 \<phi>2)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (And \<phi>1 \<phi>2) xs
 5. \<And>\<phi>1 \<phi>2. \<lbrakk>(\<exists>a\<in>set (dnf \<phi>1). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>1 xs; (\<exists>a\<in>set (dnf \<phi>2). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>2 xs\<rbrakk> \<Longrightarrow> (\<exists>a\<in>set (dnf (Or \<phi>1 \<phi>2)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (Or \<phi>1 \<phi>2) xs
 6. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (Neg \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (Neg \<phi>) xs
 7. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (ExQ \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (ExQ \<phi>) xs
 8. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (AllQ \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (AllQ \<phi>) xs
 9. \<And>x1 \<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (ExN x1 \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (ExN x1 \<phi>) xs
 10. \<And>x1 \<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (AllN x1 \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (AllN x1 \<phi>) xs
[PROOF STEP]
have h1:"(\<exists>a\<in>set (dnf (And \<phi>1 \<phi>2)). f a) = (\<exists>a\<in>set (dnf \<phi>1). \<exists>a'\<in>set(dnf \<phi>2). f a \<and> f a')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>a\<in>set (dnf (And \<phi>1 \<phi>2)). f a) = (\<exists>a\<in>set (dnf \<phi>1). \<exists>a'\<in>set (dnf \<phi>2). f a \<and> f a')
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>y\<in>set (dnf \<phi>1). \<exists>a b. (\<exists>uu_ uua_. (uua_, uu_) = y \<and> (a, b) \<in> (\<lambda>x. case x of (B, B') \<Rightarrow> (uua_ @ B, uu_ @ B')) ` set (dnf \<phi>2)) \<and> f (a, b)) = ((\<exists>a\<in>set (dnf \<phi>1). f a) \<and> (\<exists>x\<in>set (dnf \<phi>2). f x))
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>y\<in>set (dnf \<phi>1). \<exists>a b. (\<exists>uu_ uua_. (uua_, uu_) = y \<and> (a, b) \<in> (\<lambda>x. case x of (B, B') \<Rightarrow> (uua_ @ B, uu_ @ B')) ` set (dnf \<phi>2)) \<and> (case (a, b) of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs))) = ((\<exists>a\<in>set (dnf \<phi>1). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) \<and> (\<exists>x\<in>set (dnf \<phi>2). case x of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>a b ab bb. \<lbrakk>(a, b) \<in> set (dnf \<phi>1); \<forall>a\<in>set a \<union> set ab. aEval a xs; \<forall>f\<in>set b \<union> set bb. eval f xs; (ab, bb) \<in> set (dnf \<phi>2)\<rbrakk> \<Longrightarrow> \<exists>x\<in>set (dnf \<phi>1). case x of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)
 2. \<And>a b ab bb. \<lbrakk>(a, b) \<in> set (dnf \<phi>1); \<forall>a\<in>set a \<union> set ab. aEval a xs; \<forall>f\<in>set b \<union> set bb. eval f xs; (ab, bb) \<in> set (dnf \<phi>2)\<rbrakk> \<Longrightarrow> \<exists>x\<in>set (dnf \<phi>2). case x of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)
 3. \<And>a b aa ba. \<lbrakk>(a, b) \<in> set (dnf \<phi>1); (aa, ba) \<in> set (dnf \<phi>2); \<forall>a\<in>set a. aEval a xs; \<forall>f\<in>set b. eval f xs; \<forall>a\<in>set aa. aEval a xs; \<forall>f\<in>set ba. eval f xs\<rbrakk> \<Longrightarrow> \<exists>y\<in>set (dnf \<phi>1). \<exists>a b. (\<exists>uu_ uua_. (uua_, uu_) = y \<and> (a, b) \<in> (\<lambda>x. case x of (B, B') \<Rightarrow> (uua_ @ B, uu_ @ B')) ` set (dnf \<phi>2)) \<and> (\<forall>a\<in>set a. aEval a xs) \<and> (\<forall>f\<in>set b. eval f xs)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a b ab bb. \<lbrakk>(a, b) \<in> set (dnf \<phi>1); \<forall>a\<in>set a \<union> set ab. aEval a xs; \<forall>f\<in>set b \<union> set bb. eval f xs; (ab, bb) \<in> set (dnf \<phi>2)\<rbrakk> \<Longrightarrow> \<exists>x\<in>set (dnf \<phi>2). case x of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)
 2. \<And>a b aa ba. \<lbrakk>(a, b) \<in> set (dnf \<phi>1); (aa, ba) \<in> set (dnf \<phi>2); \<forall>a\<in>set a. aEval a xs; \<forall>f\<in>set b. eval f xs; \<forall>a\<in>set aa. aEval a xs; \<forall>f\<in>set ba. eval f xs\<rbrakk> \<Longrightarrow> \<exists>y\<in>set (dnf \<phi>1). \<exists>a b. (\<exists>uu_ uua_. (uua_, uu_) = y \<and> (a, b) \<in> (\<lambda>x. case x of (B, B') \<Rightarrow> (uua_ @ B, uu_ @ B')) ` set (dnf \<phi>2)) \<and> (\<forall>a\<in>set a. aEval a xs) \<and> (\<forall>f\<in>set b. eval f xs)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b aa ba. \<lbrakk>(a, b) \<in> set (dnf \<phi>1); (aa, ba) \<in> set (dnf \<phi>2); \<forall>a\<in>set a. aEval a xs; \<forall>f\<in>set b. eval f xs; \<forall>a\<in>set aa. aEval a xs; \<forall>f\<in>set ba. eval f xs\<rbrakk> \<Longrightarrow> \<exists>y\<in>set (dnf \<phi>1). \<exists>a b. (\<exists>uu_ uua_. (uua_, uu_) = y \<and> (a, b) \<in> (\<lambda>x. case x of (B, B') \<Rightarrow> (uua_ @ B, uu_ @ B')) ` set (dnf \<phi>2)) \<and> (\<forall>a\<in>set a. aEval a xs) \<and> (\<forall>f\<in>set b. eval f xs)
[PROOF STEP]
subgoal for a b c d
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(a, b) \<in> set (dnf \<phi>1); (c, d) \<in> set (dnf \<phi>2); \<forall>a\<in>set a. aEval a xs; \<forall>f\<in>set b. eval f xs; \<forall>a\<in>set c. aEval a xs; \<forall>f\<in>set d. eval f xs\<rbrakk> \<Longrightarrow> \<exists>y\<in>set (dnf \<phi>1). \<exists>a b. (\<exists>uu_ uua_. (uua_, uu_) = y \<and> (a, b) \<in> (\<lambda>x. case x of (B, B') \<Rightarrow> (uua_ @ B, uu_ @ B')) ` set (dnf \<phi>2)) \<and> (\<forall>a\<in>set a. aEval a xs) \<and> (\<forall>f\<in>set b. eval f xs)
[PROOF STEP]
apply(rule bexI[where x="(a,b)"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(a, b) \<in> set (dnf \<phi>1); (c, d) \<in> set (dnf \<phi>2); \<forall>a\<in>set a. aEval a xs; \<forall>f\<in>set b. eval f xs; \<forall>a\<in>set c. aEval a xs; \<forall>f\<in>set d. eval f xs\<rbrakk> \<Longrightarrow> \<exists>aa ba. (\<exists>uu_ uua_. (uua_, uu_) = (a, b) \<and> (aa, ba) \<in> (\<lambda>x. case x of (B, B') \<Rightarrow> (uua_ @ B, uu_ @ B')) ` set (dnf \<phi>2)) \<and> (\<forall>a\<in>set aa. aEval a xs) \<and> (\<forall>f\<in>set ba. eval f xs)
 2. \<lbrakk>(a, b) \<in> set (dnf \<phi>1); (c, d) \<in> set (dnf \<phi>2); \<forall>a\<in>set a. aEval a xs; \<forall>f\<in>set b. eval f xs; \<forall>a\<in>set c. aEval a xs; \<forall>f\<in>set d. eval f xs\<rbrakk> \<Longrightarrow> (a, b) \<in> set (dnf \<phi>1)
[PROOF STEP]
apply(rule exI[where x="a@c"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(a, b) \<in> set (dnf \<phi>1); (c, d) \<in> set (dnf \<phi>2); \<forall>a\<in>set a. aEval a xs; \<forall>f\<in>set b. eval f xs; \<forall>a\<in>set c. aEval a xs; \<forall>f\<in>set d. eval f xs\<rbrakk> \<Longrightarrow> \<exists>ba. (\<exists>uu_ uua_. (uua_, uu_) = (a, b) \<and> (a @ c, ba) \<in> (\<lambda>x. case x of (B, B') \<Rightarrow> (uua_ @ B, uu_ @ B')) ` set (dnf \<phi>2)) \<and> (\<forall>a\<in>set (a @ c). aEval a xs) \<and> (\<forall>f\<in>set ba. eval f xs)
 2. \<lbrakk>(a, b) \<in> set (dnf \<phi>1); (c, d) \<in> set (dnf \<phi>2); \<forall>a\<in>set a. aEval a xs; \<forall>f\<in>set b. eval f xs; \<forall>a\<in>set c. aEval a xs; \<forall>f\<in>set d. eval f xs\<rbrakk> \<Longrightarrow> (a, b) \<in> set (dnf \<phi>1)
[PROOF STEP]
apply(rule exI[where x="b@d"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>(a, b) \<in> set (dnf \<phi>1); (c, d) \<in> set (dnf \<phi>2); \<forall>a\<in>set a. aEval a xs; \<forall>f\<in>set b. eval f xs; \<forall>a\<in>set c. aEval a xs; \<forall>f\<in>set d. eval f xs\<rbrakk> \<Longrightarrow> (\<exists>uu_ uua_. (uua_, uu_) = (a, b) \<and> (a @ c, b @ d) \<in> (\<lambda>x. case x of (B, B') \<Rightarrow> (uua_ @ B, uu_ @ B')) ` set (dnf \<phi>2)) \<and> (\<forall>a\<in>set (a @ c). aEval a xs) \<and> (\<forall>f\<in>set (b @ d). eval f xs)
 2. \<lbrakk>(a, b) \<in> set (dnf \<phi>1); (c, d) \<in> set (dnf \<phi>2); \<forall>a\<in>set a. aEval a xs; \<forall>f\<in>set b. eval f xs; \<forall>a\<in>set c. aEval a xs; \<forall>f\<in>set d. eval f xs\<rbrakk> \<Longrightarrow> (a, b) \<in> set (dnf \<phi>1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(\<exists>a\<in>set (dnf (And \<phi>1 \<phi>2)). f a) = (\<exists>a\<in>set (dnf \<phi>1). \<exists>a'\<in>set (dnf \<phi>2). f a \<and> f a')

goal (10 subgoals):
 1. (\<exists>a\<in>set (dnf TrueF). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval TrueF xs
 2. (\<exists>a\<in>set (dnf FalseF). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval FalseF xs
 3. \<And>x. (\<exists>a\<in>set (dnf (fm.Atom x)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (fm.Atom x) xs
 4. \<And>\<phi>1 \<phi>2. \<lbrakk>(\<exists>a\<in>set (dnf \<phi>1). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>1 xs; (\<exists>a\<in>set (dnf \<phi>2). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>2 xs\<rbrakk> \<Longrightarrow> (\<exists>a\<in>set (dnf (And \<phi>1 \<phi>2)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (And \<phi>1 \<phi>2) xs
 5. \<And>\<phi>1 \<phi>2. \<lbrakk>(\<exists>a\<in>set (dnf \<phi>1). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>1 xs; (\<exists>a\<in>set (dnf \<phi>2). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>2 xs\<rbrakk> \<Longrightarrow> (\<exists>a\<in>set (dnf (Or \<phi>1 \<phi>2)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (Or \<phi>1 \<phi>2) xs
 6. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (Neg \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (Neg \<phi>) xs
 7. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (ExQ \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (ExQ \<phi>) xs
 8. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (AllQ \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (AllQ \<phi>) xs
 9. \<And>x1 \<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (ExN x1 \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (ExN x1 \<phi>) xs
 10. \<And>x1 \<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (AllN x1 \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (AllN x1 \<phi>) xs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<exists>a\<in>set (dnf (And \<phi>1 \<phi>2)). f a) = (\<exists>a\<in>set (dnf \<phi>1). \<exists>a'\<in>set (dnf \<phi>2). f a \<and> f a')

goal (10 subgoals):
 1. (\<exists>a\<in>set (dnf TrueF). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval TrueF xs
 2. (\<exists>a\<in>set (dnf FalseF). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval FalseF xs
 3. \<And>x. (\<exists>a\<in>set (dnf (fm.Atom x)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (fm.Atom x) xs
 4. \<And>\<phi>1 \<phi>2. \<lbrakk>(\<exists>a\<in>set (dnf \<phi>1). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>1 xs; (\<exists>a\<in>set (dnf \<phi>2). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>2 xs\<rbrakk> \<Longrightarrow> (\<exists>a\<in>set (dnf (And \<phi>1 \<phi>2)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (And \<phi>1 \<phi>2) xs
 5. \<And>\<phi>1 \<phi>2. \<lbrakk>(\<exists>a\<in>set (dnf \<phi>1). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>1 xs; (\<exists>a\<in>set (dnf \<phi>2). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>2 xs\<rbrakk> \<Longrightarrow> (\<exists>a\<in>set (dnf (Or \<phi>1 \<phi>2)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (Or \<phi>1 \<phi>2) xs
 6. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (Neg \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (Neg \<phi>) xs
 7. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (ExQ \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (ExQ \<phi>) xs
 8. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (AllQ \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (AllQ \<phi>) xs
 9. \<And>x1 \<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (ExN x1 \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (ExN x1 \<phi>) xs
 10. \<And>x1 \<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (AllN x1 \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (AllN x1 \<phi>) xs
[PROOF STEP]
have h2 : "... = ((\<exists>a\<in>set (dnf \<phi>1). f a)\<and>(\<exists>a\<in>set(dnf \<phi>2). f a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>a\<in>set (dnf \<phi>1). \<exists>a'\<in>set (dnf \<phi>2). f a \<and> f a') = ((\<exists>a\<in>set (dnf \<phi>1). f a) \<and> (\<exists>a\<in>set (dnf \<phi>2). f a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<exists>a\<in>set (dnf \<phi>1). \<exists>a'\<in>set (dnf \<phi>2). f a \<and> f a') = ((\<exists>a\<in>set (dnf \<phi>1). f a) \<and> (\<exists>a\<in>set (dnf \<phi>2). f a))

goal (10 subgoals):
 1. (\<exists>a\<in>set (dnf TrueF). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval TrueF xs
 2. (\<exists>a\<in>set (dnf FalseF). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval FalseF xs
 3. \<And>x. (\<exists>a\<in>set (dnf (fm.Atom x)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (fm.Atom x) xs
 4. \<And>\<phi>1 \<phi>2. \<lbrakk>(\<exists>a\<in>set (dnf \<phi>1). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>1 xs; (\<exists>a\<in>set (dnf \<phi>2). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>2 xs\<rbrakk> \<Longrightarrow> (\<exists>a\<in>set (dnf (And \<phi>1 \<phi>2)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (And \<phi>1 \<phi>2) xs
 5. \<And>\<phi>1 \<phi>2. \<lbrakk>(\<exists>a\<in>set (dnf \<phi>1). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>1 xs; (\<exists>a\<in>set (dnf \<phi>2). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>2 xs\<rbrakk> \<Longrightarrow> (\<exists>a\<in>set (dnf (Or \<phi>1 \<phi>2)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (Or \<phi>1 \<phi>2) xs
 6. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (Neg \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (Neg \<phi>) xs
 7. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (ExQ \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (ExQ \<phi>) xs
 8. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (AllQ \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (AllQ \<phi>) xs
 9. \<And>x1 \<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (ExN x1 \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (ExN x1 \<phi>) xs
 10. \<And>x1 \<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (AllN x1 \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (AllN x1 \<phi>) xs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>a\<in>set (dnf (And \<phi>1 \<phi>2)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (And \<phi>1 \<phi>2) xs
[PROOF STEP]
unfolding f_def[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>a\<in>set (dnf (And \<phi>1 \<phi>2)). f a) = eval (And \<phi>1 \<phi>2) xs
[PROOF STEP]
unfolding h1 h2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Bex (set (dnf \<phi>1)) f \<and> Bex (set (dnf \<phi>2)) f) = eval (And \<phi>1 \<phi>2) xs
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<exists>(al, fl)\<in>set (dnf \<phi>1). (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) \<and> (\<exists>(al, fl)\<in>set (dnf \<phi>2). (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs))) = eval (And \<phi>1 \<phi>2) xs
[PROOF STEP]
using And
[PROOF STATE]
proof (prove)
using this:
(\<exists>a\<in>set (dnf \<phi>1). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>1 xs
(\<exists>a\<in>set (dnf \<phi>2). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>2 xs

goal (1 subgoal):
 1. ((\<exists>(al, fl)\<in>set (dnf \<phi>1). (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) \<and> (\<exists>(al, fl)\<in>set (dnf \<phi>2). (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs))) = eval (And \<phi>1 \<phi>2) xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<exists>a\<in>set (dnf (And \<phi>1 \<phi>2)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (And \<phi>1 \<phi>2) xs

goal (9 subgoals):
 1. (\<exists>a\<in>set (dnf TrueF). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval TrueF xs
 2. (\<exists>a\<in>set (dnf FalseF). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval FalseF xs
 3. \<And>x. (\<exists>a\<in>set (dnf (fm.Atom x)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (fm.Atom x) xs
 4. \<And>\<phi>1 \<phi>2. \<lbrakk>(\<exists>a\<in>set (dnf \<phi>1). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>1 xs; (\<exists>a\<in>set (dnf \<phi>2). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi>2 xs\<rbrakk> \<Longrightarrow> (\<exists>a\<in>set (dnf (Or \<phi>1 \<phi>2)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (Or \<phi>1 \<phi>2) xs
 5. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (Neg \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (Neg \<phi>) xs
 6. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (ExQ \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (ExQ \<phi>) xs
 7. \<And>\<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (AllQ \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (AllQ \<phi>) xs
 8. \<And>x1 \<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (ExN x1 \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (ExN x1 \<phi>) xs
 9. \<And>x1 \<phi>. (\<exists>a\<in>set (dnf \<phi>). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval \<phi> xs \<Longrightarrow> (\<exists>a\<in>set (dnf (AllN x1 \<phi>)). case a of (al, fl) \<Rightarrow> (\<forall>a\<in>set al. aEval a xs) \<and> (\<forall>f\<in>set fl. eval f xs)) = eval (AllN x1 \<phi>) xs
[PROOF STEP]
qed auto


[STATEMENT]
lemma continuous_on_open_Union:
  "(\<And>s. s \<in> S \<Longrightarrow> open s) \<Longrightarrow> (\<And>s. s \<in> S \<Longrightarrow> continuous_on s f) \<Longrightarrow> continuous_on (\<Union>S) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>s. s \<in> S \<Longrightarrow> open s; \<And>s. s \<in> S \<Longrightarrow> continuous_on s f\<rbrakk> \<Longrightarrow> continuous_on (\<Union> S) f
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>s. s \<in> S \<Longrightarrow> open s; \<And>s. s \<in> S \<Longrightarrow> \<forall>x\<in>s. (f \<longlongrightarrow> f x) (at x within s)\<rbrakk> \<Longrightarrow> \<forall>x\<in>\<Union> S. (f \<longlongrightarrow> f x) (at x within \<Union> S)
[PROOF STEP]
by safe (metis open_Union at_within_open UnionI)


[STATEMENT]
lemma divideC_field_splits_simps_1 [field_split_simps]: (* In Real_Vector_Spaces, these lemmas are unnamed *)
  "a = b /\<^sub>C c \<longleftrightarrow> (if c = 0 then a = 0 else c *\<^sub>C a = b)"
  "b /\<^sub>C c = a \<longleftrightarrow> (if c = 0 then a = 0 else b = c *\<^sub>C a)"
  "a + b /\<^sub>C c = (if c = 0 then a else (c *\<^sub>C a + b) /\<^sub>C c)"
  "a /\<^sub>C c + b = (if c = 0 then b else (a + c *\<^sub>C b) /\<^sub>C c)"
  "a - b /\<^sub>C c = (if c = 0 then a else (c *\<^sub>C a - b) /\<^sub>C c)"
  "a /\<^sub>C c - b = (if c = 0 then - b else (a - c *\<^sub>C b) /\<^sub>C c)"
  "- (a /\<^sub>C c) + b = (if c = 0 then b else (- a + c *\<^sub>C b) /\<^sub>C c)"
  "- (a /\<^sub>C c) - b = (if c = 0 then - b else (- a - c *\<^sub>C b) /\<^sub>C c)"
  for a b :: "'a :: complex_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (((a = b /\<^sub>C c) = (if c = 0 then a = (0::'a) else c *\<^sub>C a = b) &&& (b /\<^sub>C c = a) = (if c = 0 then a = (0::'a) else b = c *\<^sub>C a)) &&& a + b /\<^sub>C c = (if c = 0 then a else (c *\<^sub>C a + b) /\<^sub>C c) &&& a /\<^sub>C c + b = (if c = 0 then b else (a + c *\<^sub>C b) /\<^sub>C c)) &&& (a - b /\<^sub>C c = (if c = 0 then a else (c *\<^sub>C a - b) /\<^sub>C c) &&& a /\<^sub>C c - b = (if c = 0 then - b else (a - c *\<^sub>C b) /\<^sub>C c)) &&& - (a /\<^sub>C c) + b = (if c = 0 then b else (- a + c *\<^sub>C b) /\<^sub>C c) &&& - (a /\<^sub>C c) - b = (if c = 0 then - b else (- a - c *\<^sub>C b) /\<^sub>C c)
[PROOF STEP]
by (auto simp add: field_simps)


[STATEMENT]
lemma adjoint_row:
  assumes "i < dim_col A"
  shows "row (adjoint A) i = conjugate (col A i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (adjoint A) i = conjugate (col A i)
[PROOF STEP]
apply (rule eq_vecI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>ia. ia < dim_vec (conjugate (col A i)) \<Longrightarrow> row (adjoint A) i $ ia = conjugate (col A i) $ ia
 2. dim_vec (row (adjoint A) i) = dim_vec (conjugate (col A i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < dim_col A

goal (2 subgoals):
 1. \<And>ia. ia < dim_vec (conjugate (col A i)) \<Longrightarrow> row (adjoint A) i $ ia = conjugate (col A i) $ ia
 2. dim_vec (row (adjoint A) i) = dim_vec (conjugate (col A i))
[PROOF STEP]
by (auto simp add: adjoint_eval)


[STATEMENT]
lemma max_front_sum: "Max (front_sums (x#xs)) = max 0 (x + Max (front_sums xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (front_sums (x # xs)) = max (0::'a) (x + Max (front_sums xs))
[PROOF STEP]
using finite_front_sums front_sums_not_empty
[PROOF STATE]
proof (prove)
using this:
finite (front_sums ?xs)
front_sums ?xs \<noteq> {}

goal (1 subgoal):
 1. Max (front_sums (x # xs)) = max (0::'a) (x + Max (front_sums xs))
[PROOF STEP]
by (auto simp add: front_sums_cons hom_Max_commute max_add_distrib_right)


[STATEMENT]
lemma Bseq_eq_bounded:
  fixes f :: "nat \<Rightarrow> 'a::real_normed_vector"
  shows "Bseq f \<longleftrightarrow> bounded (range f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bseq f = bounded (range f)
[PROOF STEP]
unfolding Bseq_def bounded_pos
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>K>0. \<forall>n. norm (f n) \<le> K) = (\<exists>b>0. \<forall>x\<in>range f. norm x \<le> b)
[PROOF STEP]
by auto