[STATEMENT]
lemma impl_sem [simp]: "(\<nu> \<in> fml_sem I (A \<rightarrow> B))
  = ((\<nu> \<in> fml_sem I A) \<longrightarrow> (\<nu> \<in> fml_sem I B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<nu> \<in> fml_sem I (A \<rightarrow> B)) = (\<nu> \<in> fml_sem I A \<longrightarrow> \<nu> \<in> fml_sem I B)
[PROOF STEP]
by (auto simp add: Implies_def)


[STATEMENT]
lemma non_empty_spectrum: fixes A :: "complex ^ 'n ^ 'n"
  shows "Collect (eigen_value A) \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Collect (eigen_value A) \<noteq> {}
[PROOF STEP]
by (transfer_hma rule: spectrum_non_empty[unfolded spectrum_def])


[STATEMENT]
lemma analz_subset_iff [simp]: "(analz G \<subseteq> analz H) = (G \<subseteq> analz H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (analz G \<subseteq> analz H) = (G \<subseteq> analz H)
[PROOF STEP]
by (metis analz_idem analz_increasing analz_mono subset_trans)


[STATEMENT]
lemma setv_not_in_count0_iff: "a \<notin> set\<^sub>v v \<longleftrightarrow> count_vec v a = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<notin> set\<^sub>v v) = (count_vec v a = 0)
[PROOF STEP]
using setv_vec_mset_not_in_iff
[PROOF STATE]
proof (prove)
using this:
(?a \<notin> set\<^sub>v ?v) = (?a \<notin># vec_mset ?v)

goal (1 subgoal):
 1. (a \<notin> set\<^sub>v v) = (count_vec v a = 0)
[PROOF STEP]
by (metis count_eq_zero_iff)


[STATEMENT]
lemma height_node22:
   "height l > 0 \<Longrightarrow> height(node22 l a r) = max (height l) (height r) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < height l \<Longrightarrow> height (node22 l a r) = max (height l) (height r) + 1
[PROOF STEP]
by(induct l a r rule: node22.induct)(simp_all add: max.assoc)


[STATEMENT]
lemma del_edge_undirected_degree_minus[simp]: "finite (edges g) \<Longrightarrow> (v,e,v') \<in> edges g
    \<Longrightarrow> (v',e,v) \<in> edges g \<Longrightarrow> degree v (del_unEdge v e v' g) =degree v g- (1::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite (edges g); (v, e, v') \<in> edges g; (v', e, v) \<in> edges g\<rbrakk> \<Longrightarrow> degree v (del_unEdge v e v' g) = degree v g - 1
[PROOF STEP]
using del_edge_undirected_degree_plus
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (edges ?g); (?v, ?e, ?v') \<in> edges ?g; (?v', ?e, ?v) \<in> edges ?g\<rbrakk> \<Longrightarrow> degree ?v (del_unEdge ?v ?e ?v' ?g) + 1 = degree ?v ?g

goal (1 subgoal):
 1. \<lbrakk>finite (edges g); (v, e, v') \<in> edges g; (v', e, v) \<in> edges g\<rbrakk> \<Longrightarrow> degree v (del_unEdge v e v' g) = degree v g - 1
[PROOF STEP]
by (metis add_diff_cancel_left' add.commute)


[STATEMENT]
lemma Gamma_times_zeta_has_integral:
  assumes "Re z > 1"
  shows   "((\<lambda>x. x powr (z - 1) / (of_real (exp x) - 1)) has_integral (Gamma z * zeta z)) {0<..}"
    (is "(?f has_integral _) _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. complex_of_real x powr (z - 1) / (complex_of_real (exp x) - 1)) has_integral Gamma z * zeta z) {0<..}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. complex_of_real x powr (z - 1) / (complex_of_real (exp x) - 1)) has_integral Gamma z * zeta z) {0<..}
[PROOF STEP]
have "(?f has_integral set_lebesgue_integral lebesgue {0<..} ?f) {0<..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. complex_of_real x powr (z - 1) / (complex_of_real (exp x) - 1)) has_integral CLINT x:{0<..}|lebesgue. complex_of_real x powr (z - 1) / (complex_of_real (exp x) - 1)) {0<..}
[PROOF STEP]
using Gamma_times_zeta_integrable[OF assms]
[PROOF STATE]
proof (prove)
using this:
complex_set_integrable lebesgue {0<..} (\<lambda>x. complex_of_real x powr (z - 1) / complex_of_real (exp x - 1))

goal (1 subgoal):
 1. ((\<lambda>x. complex_of_real x powr (z - 1) / (complex_of_real (exp x) - 1)) has_integral CLINT x:{0<..}|lebesgue. complex_of_real x powr (z - 1) / (complex_of_real (exp x) - 1)) {0<..}
[PROOF STEP]
by (intro has_integral_set_lebesgue) auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. complex_of_real x powr (z - 1) / (complex_of_real (exp x) - 1)) has_integral CLINT x:{0<..}|lebesgue. complex_of_real x powr (z - 1) / (complex_of_real (exp x) - 1)) {0<..}

goal (1 subgoal):
 1. ((\<lambda>x. complex_of_real x powr (z - 1) / (complex_of_real (exp x) - 1)) has_integral Gamma z * zeta z) {0<..}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. complex_of_real x powr (z - 1) / (complex_of_real (exp x) - 1)) has_integral CLINT x:{0<..}|lebesgue. complex_of_real x powr (z - 1) / (complex_of_real (exp x) - 1)) {0<..}

goal (1 subgoal):
 1. ((\<lambda>x. complex_of_real x powr (z - 1) / (complex_of_real (exp x) - 1)) has_integral Gamma z * zeta z) {0<..}
[PROOF STEP]
have "set_lebesgue_integral lebesgue {0<..} ?f = Gamma z * zeta z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CLINT x:{0<..}|lebesgue. complex_of_real x powr (z - 1) / (complex_of_real (exp x) - 1) = Gamma z * zeta z
[PROOF STEP]
using Gamma_times_zeta_integral[OF assms]
[PROOF STATE]
proof (prove)
using this:
Gamma z * zeta z = CLINT x:{0<..}|lebesgue. complex_of_real x powr (z - 1) / complex_of_real (exp x - 1)

goal (1 subgoal):
 1. CLINT x:{0<..}|lebesgue. complex_of_real x powr (z - 1) / (complex_of_real (exp x) - 1) = Gamma z * zeta z
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
CLINT x:{0<..}|lebesgue. complex_of_real x powr (z - 1) / (complex_of_real (exp x) - 1) = Gamma z * zeta z

goal (1 subgoal):
 1. ((\<lambda>x. complex_of_real x powr (z - 1) / (complex_of_real (exp x) - 1)) has_integral Gamma z * zeta z) {0<..}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. complex_of_real x powr (z - 1) / (complex_of_real (exp x) - 1)) has_integral Gamma z * zeta z) {0<..}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. complex_of_real x powr (z - 1) / (complex_of_real (exp x) - 1)) has_integral Gamma z * zeta z) {0<..}

goal (1 subgoal):
 1. ((\<lambda>x. complex_of_real x powr (z - 1) / (complex_of_real (exp x) - 1)) has_integral Gamma z * zeta z) {0<..}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((\<lambda>x. complex_of_real x powr (z - 1) / (complex_of_real (exp x) - 1)) has_integral Gamma z * zeta z) {0<..}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma all_intersection_of:
     "(\<forall>S. (P intersection_of Q) S \<longrightarrow> R S) \<longleftrightarrow> (\<forall>T. P T \<and> T \<subseteq> Collect Q \<longrightarrow> R(\<Inter>T))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>S. (P intersection_of Q) S \<longrightarrow> R S) = (\<forall>T. P T \<and> T \<subseteq> Collect Q \<longrightarrow> R (\<Inter> T))
[PROOF STEP]
by (auto simp: intersection_of_def)


[STATEMENT]
lemma bag_of_nths:
     "bag_of (nths l A) =
      (\<Sum>i\<in> A Int lessThan (length l). {# l!i #})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (nths l A) = (\<Sum>i\<in>A \<inter> {..<length l}. {#l ! i#})
[PROOF STEP]
by (rule_tac xs = l in rev_induct)
     (simp_all add: nths_append Int_insert_right lessThan_Suc nth_append
                    bag_of_nths_lemma ac_simps)


[STATEMENT]
lemma hcard_union_inter: "hcard (x \<squnion> y) + hcard (x \<sqinter> y) = hcard x + hcard y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hcard (x \<squnion> y) + hcard (x \<sqinter> y) = hcard x + hcard y
[PROOF STEP]
apply (induct x arbitrary: y rule: hf_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>y. hcard (0 \<squnion> y) + hcard (0 \<sqinter> y) = hcard 0 + hcard y
 2. \<And>x y ya. \<lbrakk>\<And>y. hcard (x \<squnion> y) + hcard (x \<sqinter> y) = hcard x + hcard y; \<And>ya. hcard (y \<squnion> ya) + hcard (y \<sqinter> ya) = hcard y + hcard ya; x \<^bold>\<notin> y\<rbrakk> \<Longrightarrow> hcard ((y \<triangleleft> x) \<squnion> ya) + hcard ((y \<triangleleft> x) \<sqinter> ya) = hcard (y \<triangleleft> x) + hcard ya
[PROOF STEP]
apply (auto simp: hcard_hinsert_if hunion_hinsert_left hinter_hinsert_left)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma homeomorphism_on_UNIV_extension_sequentially:
  fixes f::"'a::{first_countable_topology, t3_space} \<Rightarrow> 'b::{first_countable_topology, t3_space}"
  assumes "\<And>u b. (\<forall>n. u n \<in> S) \<Longrightarrow> u \<longlonglongrightarrow> b \<longleftrightarrow> (\<lambda>n. f (u n)) \<longlonglongrightarrow> f b"
          "closure S = UNIV"
  shows "homeomorphism_on UNIV f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homeomorphism_on UNIV f
[PROOF STEP]
apply (rule homeomorphism_on_extension_sequentially[of S])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>u b. \<forall>n. u n \<in> S \<Longrightarrow> u \<longlonglongrightarrow> b = (\<lambda>n. f (u n)) \<longlonglongrightarrow> f b
 2. UNIV \<subseteq> closure S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>n. ?u n \<in> S \<Longrightarrow> ?u \<longlonglongrightarrow> ?b = (\<lambda>n. f (?u n)) \<longlonglongrightarrow> f ?b
closure S = UNIV

goal (2 subgoals):
 1. \<And>u b. \<forall>n. u n \<in> S \<Longrightarrow> u \<longlonglongrightarrow> b = (\<lambda>n. f (u n)) \<longlonglongrightarrow> f b
 2. UNIV \<subseteq> closure S
[PROOF STEP]
by auto


[STATEMENT]
lemma divide_real_alg: "(real_of x) / (real_of y) = real_of (x / y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of x / real_of y = real_of (x / y)
[PROOF STEP]
unfolding divide_real_alg_def times_real_alg[symmetric] divide_real_def inverse_real_alg
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of x * real_of (inverse y) = real_of x * real_of (inverse y)
[PROOF STEP]
..


[STATEMENT]
lemma "(- 3) ^ 7 = (-2187::int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 3) ^ 7 = - 2187
[PROOF STEP]
by simp


[STATEMENT]
lemma pmf_neg_binomial':
  assumes p: "p \<in> {0<..1}"
  shows   "pmf (neg_binomial_pmf n p) k = (-1) ^ k * ((-real n) gchoose k) * p ^ n * (1 - p) ^ k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf (neg_binomial_pmf n p) k = (- 1) ^ k * (- real n gchoose k) * p ^ n * (1 - p) ^ k
[PROOF STEP]
proof (cases "n > 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < n \<Longrightarrow> pmf (neg_binomial_pmf n p) k = (- 1) ^ k * (- real n gchoose k) * p ^ n * (1 - p) ^ k
 2. \<not> 0 < n \<Longrightarrow> pmf (neg_binomial_pmf n p) k = (- 1) ^ k * (- real n gchoose k) * p ^ n * (1 - p) ^ k
[PROOF STEP]
case n: True
[PROOF STATE]
proof (state)
this:
0 < n

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> pmf (neg_binomial_pmf n p) k = (- 1) ^ k * (- real n gchoose k) * p ^ n * (1 - p) ^ k
 2. \<not> 0 < n \<Longrightarrow> pmf (neg_binomial_pmf n p) k = (- 1) ^ k * (- real n gchoose k) * p ^ n * (1 - p) ^ k
[PROOF STEP]
have "pmf (neg_binomial_pmf n p) k = real ((k + n - 1) choose k) * p ^ n * (1 - p) ^ k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf (neg_binomial_pmf n p) k = real (k + n - 1 choose k) * p ^ n * (1 - p) ^ k
[PROOF STEP]
by (rule pmf_neg_binomial) fact+
[PROOF STATE]
proof (state)
this:
pmf (neg_binomial_pmf n p) k = real (k + n - 1 choose k) * p ^ n * (1 - p) ^ k

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> pmf (neg_binomial_pmf n p) k = (- 1) ^ k * (- real n gchoose k) * p ^ n * (1 - p) ^ k
 2. \<not> 0 < n \<Longrightarrow> pmf (neg_binomial_pmf n p) k = (- 1) ^ k * (- real n gchoose k) * p ^ n * (1 - p) ^ k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pmf (neg_binomial_pmf n p) k = real (k + n - 1 choose k) * p ^ n * (1 - p) ^ k

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> pmf (neg_binomial_pmf n p) k = (- 1) ^ k * (- real n gchoose k) * p ^ n * (1 - p) ^ k
 2. \<not> 0 < n \<Longrightarrow> pmf (neg_binomial_pmf n p) k = (- 1) ^ k * (- real n gchoose k) * p ^ n * (1 - p) ^ k
[PROOF STEP]
have "real ((k + n - 1) choose k) = ((real k + real n - 1) gchoose k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (k + n - 1 choose k) = real k + real n - 1 gchoose k
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. real (k + n - 1 choose k) = real k + real n - 1 gchoose k
[PROOF STEP]
by (subst binomial_gbinomial) (auto simp: of_nat_diff)
[PROOF STATE]
proof (state)
this:
real (k + n - 1 choose k) = real k + real n - 1 gchoose k

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> pmf (neg_binomial_pmf n p) k = (- 1) ^ k * (- real n gchoose k) * p ^ n * (1 - p) ^ k
 2. \<not> 0 < n \<Longrightarrow> pmf (neg_binomial_pmf n p) k = (- 1) ^ k * (- real n gchoose k) * p ^ n * (1 - p) ^ k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (k + n - 1 choose k) = real k + real n - 1 gchoose k

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> pmf (neg_binomial_pmf n p) k = (- 1) ^ k * (- real n gchoose k) * p ^ n * (1 - p) ^ k
 2. \<not> 0 < n \<Longrightarrow> pmf (neg_binomial_pmf n p) k = (- 1) ^ k * (- real n gchoose k) * p ^ n * (1 - p) ^ k
[PROOF STEP]
have "\<dots> = (-1) ^ k * ((-real n) gchoose k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real k + real n - 1 gchoose k = (- 1) ^ k * (- real n gchoose k)
[PROOF STEP]
by (subst gbinomial_negated_upper) auto
[PROOF STATE]
proof (state)
this:
real k + real n - 1 gchoose k = (- 1) ^ k * (- real n gchoose k)

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> pmf (neg_binomial_pmf n p) k = (- 1) ^ k * (- real n gchoose k) * p ^ n * (1 - p) ^ k
 2. \<not> 0 < n \<Longrightarrow> pmf (neg_binomial_pmf n p) k = (- 1) ^ k * (- real n gchoose k) * p ^ n * (1 - p) ^ k
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
pmf (neg_binomial_pmf n p) k = (- 1) ^ k * (- real n gchoose k) * p ^ n * (1 - p) ^ k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
pmf (neg_binomial_pmf n p) k = (- 1) ^ k * (- real n gchoose k) * p ^ n * (1 - p) ^ k

goal (1 subgoal):
 1. pmf (neg_binomial_pmf n p) k = (- 1) ^ k * (- real n gchoose k) * p ^ n * (1 - p) ^ k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pmf (neg_binomial_pmf n p) k = (- 1) ^ k * (- real n gchoose k) * p ^ n * (1 - p) ^ k

goal (1 subgoal):
 1. \<not> 0 < n \<Longrightarrow> pmf (neg_binomial_pmf n p) k = (- 1) ^ k * (- real n gchoose k) * p ^ n * (1 - p) ^ k
[PROOF STEP]
qed (auto simp: indicator_def gbinomial_0_left)


[STATEMENT]
lemma alt_effective_matrix_tensor_elements:
 " (((i<((row_length M2)*(row_length M3)))
 \<and>(j < (length M2)*(length M3)))
 \<and>(mat (row_length M2) (length M2) M2)
 \<and>(mat (row_length M3) (length M3) M3)
 \<Longrightarrow> ((M2 \<otimes> M3)!j!i) = f (M2!(j div (length M3))!(i div (row_length M3)))
(M3!(j mod length M3)!(i mod (row_length M3))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i < row_length M2 * row_length M3 \<and> j < length M2 * length M3) \<and> mat (row_length M2) (length M2) M2 \<and> mat (row_length M3) (length M3) M3 \<Longrightarrow> (M2 \<otimes> M3) ! j ! i = M2 ! (j div length M3) ! (i div row_length M3) * M3 ! (j mod length M3) ! (i mod row_length M3)
[PROOF STEP]
using matrix_Tensor_elements
[PROOF STATE]
proof (prove)
using this:
\<forall>i j. (i < row_length ?M1.0 * row_length ?M2.0 \<and> j < length ?M1.0 * length ?M2.0) \<and> mat (row_length ?M1.0) (length ?M1.0) ?M1.0 \<and> mat (row_length ?M2.0) (length ?M2.0) ?M2.0 \<longrightarrow> (?M1.0 \<otimes> ?M2.0) ! j ! i = ?M1.0 ! (j div length ?M2.0) ! (i div row_length ?M2.0) * ?M2.0 ! (j mod length ?M2.0) ! (i mod row_length ?M2.0)

goal (1 subgoal):
 1. (i < row_length M2 * row_length M3 \<and> j < length M2 * length M3) \<and> mat (row_length M2) (length M2) M2 \<and> mat (row_length M3) (length M3) M3 \<Longrightarrow> (M2 \<otimes> M3) ! j ! i = M2 ! (j div length M3) ! (i div row_length M3) * M3 ! (j mod length M3) ! (i mod row_length M3)
[PROOF STEP]
by auto


[STATEMENT]
lemma adjoint_clauses:
  fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space"
  assumes lf: "linear f"
  shows "x \<bullet> adjoint f y = f x \<bullet> y"
    and "adjoint f y \<bullet> x = y \<bullet> f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<bullet> adjoint f y = f x \<bullet> y &&& adjoint f y \<bullet> x = y \<bullet> f x
[PROOF STEP]
by (simp_all add: adjoint_works[OF lf] inner_commute)


[STATEMENT]
lemma mem_rel_interior: "x \<in> rel_interior S \<longleftrightarrow> (\<exists>T. open T \<and> x \<in> T \<inter> S \<and> T \<inter> affine hull S \<subseteq> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> rel_interior S) = (\<exists>T. open T \<and> x \<in> T \<inter> S \<and> T \<inter> affine hull S \<subseteq> S)
[PROOF STEP]
by (auto simp: rel_interior)


[STATEMENT]
lemma set_restriction_fun_all_conv: "
  ((set_restriction_fun P) A = A) = (\<forall>x\<in>A. P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (set_restriction_fun P A = A) = (\<forall>x\<in>A. P x)
[PROOF STEP]
unfolding set_restriction_fun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({x \<in> A. P x} = A) = (\<forall>x\<in>A. P x)
[PROOF STEP]
by blast


[STATEMENT]
lemma ceiling_divide_lower:
  fixes q :: "'a::floor_ceiling"
  shows "q > 0 \<Longrightarrow> (of_int \<lceil>p / q\<rceil> - 1) * q < p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < q \<Longrightarrow> (of_int \<lceil>p / q\<rceil> - (1::'a)) * q < p
[PROOF STEP]
by (meson ceiling_eq_iff pos_less_divide_eq)


[STATEMENT]
lemma basis_card_eq_dim: "B \<subseteq> V \<Longrightarrow> V \<subseteq> span B \<Longrightarrow> independent B \<Longrightarrow> card B = dim V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>B \<subseteq> V; V \<subseteq> span B; independent B\<rbrakk> \<Longrightarrow> card B = dim V
[PROOF STEP]
using dim_eq_card[of B V] span_mono[of B V] span_minimal[OF _ subspace_span, of V B]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>span B = span V; independent B\<rbrakk> \<Longrightarrow> dim V = card B
B \<subseteq> V \<Longrightarrow> span B \<subseteq> span V
V \<subseteq> span B \<Longrightarrow> span V \<subseteq> span B

goal (1 subgoal):
 1. \<lbrakk>B \<subseteq> V; V \<subseteq> span B; independent B\<rbrakk> \<Longrightarrow> card B = dim V
[PROOF STEP]
by auto


[STATEMENT]
lemma has_derivative_within_alt2:
  "(f has_derivative f') (at x within s) \<longleftrightarrow> bounded_linear f' \<and>
    (\<forall>e>0. eventually (\<lambda>y. norm (f y - f x - f' (y - x)) \<le> e * norm (y - x)) (at x within s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_derivative f') (at x within s) = (bounded_linear f' \<and> (\<forall>e>0. \<forall>\<^sub>F y in at x within s. norm (f y - f x - f' (y - x)) \<le> e * norm (y - x)))
[PROOF STEP]
unfolding has_derivative_within filterlim_def le_nhds_metric_le eventually_filtermap
    eventually_at dist_norm diff_diff_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (bounded_linear f' \<and> (\<forall>e>0. \<exists>d>0. \<forall>xa\<in>s. xa \<noteq> x \<and> norm (xa - x) < d \<longrightarrow> norm ((1 / norm (xa - x)) *\<^sub>R (f xa - (f x + f' (xa - x))) - (0::'b)) \<le> e)) = (bounded_linear f' \<and> (\<forall>e>0. \<exists>d>0. \<forall>xa\<in>s. xa \<noteq> x \<and> norm (xa - x) < d \<longrightarrow> norm (f xa - (f x + f' (xa - x))) \<le> e * norm (xa - x)))
[PROOF STEP]
by (force simp add: linear_0 bounded_linear.linear pos_divide_le_eq)


[STATEMENT]
lemma rel_list_all2_trans:
  "\<lbrakk> \<And>a b c. \<lbrakk>(a,b) \<in> R; (b,c) \<in> S\<rbrakk> \<Longrightarrow> (a,c) \<in> T;
    list_all2 (fun_of R) as bs; list_all2 (fun_of S) bs cs\<rbrakk>
  \<Longrightarrow> list_all2 (fun_of T) as cs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>a b c. \<lbrakk>(a, b) \<in> R; (b, c) \<in> S\<rbrakk> \<Longrightarrow> (a, c) \<in> T; list_all2 (fun_of R) as bs; list_all2 (fun_of S) bs cs\<rbrakk> \<Longrightarrow> list_all2 (fun_of T) as cs
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>a b c. \<lbrakk>(a, b) \<in> R; (b, c) \<in> S\<rbrakk> \<Longrightarrow> (a, c) \<in> T; list_all2 (fun_of R) as bs; list_all2 (fun_of S) bs cs\<rbrakk> \<Longrightarrow> list_all2 (fun_of T) as cs
[PROOF STEP]
by (rule list_all2_trans) auto


[STATEMENT]
lemma test_mult_glb: "test p \<Longrightarrow> test q \<Longrightarrow> test r \<Longrightarrow> p \<le> q \<and> p \<le> r \<longleftrightarrow> p \<le> q \<cdot> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>test p; test q; test r\<rbrakk> \<Longrightarrow> (p \<le> q \<and> p \<le> r) = (p \<le> q \<cdot> r)
[PROOF STEP]
using local.n_mult_glb'
[PROOF STATE]
proof (prove)
using this:
(!?z \<le> !?x \<and> !?z \<le> !?y) = (!?z \<le> !?x \<cdot> !?y)

goal (1 subgoal):
 1. \<lbrakk>test p; test q; test r\<rbrakk> \<Longrightarrow> (p \<le> q \<and> p \<le> r) = (p \<le> q \<cdot> r)
[PROOF STEP]
by force


[STATEMENT]
theorem blocking_safe: \<comment> \<open>A set that blocks an intact node contains an intact node.
If this were not the case, quorum availability would trivially be violated.\<close>
  fixes S n
  assumes "n\<in>I" and "\<forall> Sl\<in> slices n .Sl\<inter>S \<noteq> {}"
  shows "S \<inter> I \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<inter> I \<noteq> {}
[PROOF STEP]
using assms q_avail intact_wb
[PROOF STATE]
proof (prove)
using this:
n \<in> I
\<forall>Sl\<in>slices n. Sl \<inter> S \<noteq> {}
orig.quorum I
I \<subseteq> W

goal (1 subgoal):
 1. S \<inter> I \<noteq> {}
[PROOF STEP]
unfolding orig.quorum_def
[PROOF STATE]
proof (prove)
using this:
n \<in> I
\<forall>Sl\<in>slices n. Sl \<inter> S \<noteq> {}
\<forall>p\<in>I \<inter> W. \<exists>Sl\<in>slices p. Sl \<subseteq> I
I \<subseteq> W

goal (1 subgoal):
 1. S \<inter> I \<noteq> {}
[PROOF STEP]
by auto (metis inf.absorb_iff2 inf_assoc inf_bot_right inf_sup_aci(1))


[STATEMENT]
lemma prime_factorization_2_gauss_int:
  "prime_factorization (2 :: gauss_int) = {#1 + \<i>\<^sub>\<int>, 1 + \<i>\<^sub>\<int>#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factorization 2 = {#1 + \<i>\<^sub>\<int>, 1 + \<i>\<^sub>\<int>#}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prime_factorization 2 = {#1 + \<i>\<^sub>\<int>, 1 + \<i>\<^sub>\<int>#}
[PROOF STEP]
have "prime_factorization (2 :: gauss_int) =
        (prime_factorization (prod_mset {#1 + gauss_i, 1 + gauss_i#}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factorization 2 = prime_factorization (\<Prod>\<^sub># {#1 + \<i>\<^sub>\<int>, 1 + \<i>\<^sub>\<int>#})
[PROOF STEP]
by (subst prime_factorization_unique) (auto simp: gauss_int_eq_iff normalize_gauss_int_def)
[PROOF STATE]
proof (state)
this:
prime_factorization 2 = prime_factorization (\<Prod>\<^sub># {#1 + \<i>\<^sub>\<int>, 1 + \<i>\<^sub>\<int>#})

goal (1 subgoal):
 1. prime_factorization 2 = {#1 + \<i>\<^sub>\<int>, 1 + \<i>\<^sub>\<int>#}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_factorization 2 = prime_factorization (\<Prod>\<^sub># {#1 + \<i>\<^sub>\<int>, 1 + \<i>\<^sub>\<int>#})

goal (1 subgoal):
 1. prime_factorization 2 = {#1 + \<i>\<^sub>\<int>, 1 + \<i>\<^sub>\<int>#}
[PROOF STEP]
have "prime_factorization (prod_mset {#1 + gauss_i, 1 + gauss_i#}) =
               {#1 + gauss_i, 1 + gauss_i#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factorization (\<Prod>\<^sub># {#1 + \<i>\<^sub>\<int>, 1 + \<i>\<^sub>\<int>#}) = {#1 + \<i>\<^sub>\<int>, 1 + \<i>\<^sub>\<int>#}
[PROOF STEP]
using prime_one_plus_i_gauss_int
[PROOF STATE]
proof (prove)
using this:
prime (1 + \<i>\<^sub>\<int>)

goal (1 subgoal):
 1. prime_factorization (\<Prod>\<^sub># {#1 + \<i>\<^sub>\<int>, 1 + \<i>\<^sub>\<int>#}) = {#1 + \<i>\<^sub>\<int>, 1 + \<i>\<^sub>\<int>#}
[PROOF STEP]
by (subst prime_factorization_prod_mset_primes) auto
[PROOF STATE]
proof (state)
this:
prime_factorization (\<Prod>\<^sub># {#1 + \<i>\<^sub>\<int>, 1 + \<i>\<^sub>\<int>#}) = {#1 + \<i>\<^sub>\<int>, 1 + \<i>\<^sub>\<int>#}

goal (1 subgoal):
 1. prime_factorization 2 = {#1 + \<i>\<^sub>\<int>, 1 + \<i>\<^sub>\<int>#}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prime_factorization 2 = {#1 + \<i>\<^sub>\<int>, 1 + \<i>\<^sub>\<int>#}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prime_factorization 2 = {#1 + \<i>\<^sub>\<int>, 1 + \<i>\<^sub>\<int>#}

goal (1 subgoal):
 1. prime_factorization 2 = {#1 + \<i>\<^sub>\<int>, 1 + \<i>\<^sub>\<int>#}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
prime_factorization 2 = {#1 + \<i>\<^sub>\<int>, 1 + \<i>\<^sub>\<int>#}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bit_numeral_Bit1_Suc_iff [simp]:
  \<open>bit (numeral (Num.Bit1 m)) (Suc n) \<longleftrightarrow> bit (numeral m) n\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit (numeral (num.Bit1 m)) (Suc n) = bit (numeral m) n
[PROOF STEP]
by (simp add: bit_Suc numeral_Bit1_div_2)


[STATEMENT]
lemma set_borel_integral_eq_integral:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes "set_integrable lborel S f"
  shows "f integrable_on S" "LINT x : S | lborel. f x = integral S f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f integrable_on S &&& set_lebesgue_integral lborel S f = integral S f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f integrable_on S
 2. set_lebesgue_integral lborel S f = integral S f
[PROOF STEP]
let ?f = "\<lambda>x. indicator S x *\<^sub>R f x"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f integrable_on S
 2. set_lebesgue_integral lborel S f = integral S f
[PROOF STEP]
have "(?f has_integral LINT x : S | lborel. f x) UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. indicat_real S x *\<^sub>R f x) has_integral set_lebesgue_integral lborel S f) UNIV
[PROOF STEP]
using assms has_integral_integral_lborel
[PROOF STATE]
proof (prove)
using this:
set_integrable lborel S f
integrable lborel ?f \<Longrightarrow> (?f has_integral integral\<^sup>L lborel ?f) UNIV

goal (1 subgoal):
 1. ((\<lambda>x. indicat_real S x *\<^sub>R f x) has_integral set_lebesgue_integral lborel S f) UNIV
[PROOF STEP]
unfolding set_integrable_def set_lebesgue_integral_def
[PROOF STATE]
proof (prove)
using this:
integrable lborel (\<lambda>x. indicat_real S x *\<^sub>R f x)
integrable lborel ?f \<Longrightarrow> (?f has_integral integral\<^sup>L lborel ?f) UNIV

goal (1 subgoal):
 1. ((\<lambda>x. indicat_real S x *\<^sub>R f x) has_integral LBINT x. indicat_real S x *\<^sub>R f x) UNIV
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
((\<lambda>x. indicat_real S x *\<^sub>R f x) has_integral set_lebesgue_integral lborel S f) UNIV

goal (2 subgoals):
 1. f integrable_on S
 2. set_lebesgue_integral lborel S f = integral S f
[PROOF STEP]
hence 1: "(f has_integral (set_lebesgue_integral lborel S f)) S"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. indicat_real S x *\<^sub>R f x) has_integral set_lebesgue_integral lborel S f) UNIV

goal (1 subgoal):
 1. (f has_integral set_lebesgue_integral lborel S f) S
[PROOF STEP]
by (simp add: indicator_scaleR_eq_if)
[PROOF STATE]
proof (state)
this:
(f has_integral set_lebesgue_integral lborel S f) S

goal (2 subgoals):
 1. f integrable_on S
 2. set_lebesgue_integral lborel S f = integral S f
[PROOF STEP]
thus "f integrable_on S"
[PROOF STATE]
proof (prove)
using this:
(f has_integral set_lebesgue_integral lborel S f) S

goal (1 subgoal):
 1. f integrable_on S
[PROOF STEP]
by (auto simp add: integrable_on_def)
[PROOF STATE]
proof (state)
this:
f integrable_on S

goal (1 subgoal):
 1. set_lebesgue_integral lborel S f = integral S f
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
(f has_integral set_lebesgue_integral lborel S f) S
f integrable_on S
[PROOF STEP]
have "(f has_integral (integral S f)) S"
[PROOF STATE]
proof (prove)
using this:
(f has_integral set_lebesgue_integral lborel S f) S
f integrable_on S

goal (1 subgoal):
 1. (f has_integral integral S f) S
[PROOF STEP]
by (intro integrable_integral, auto simp add: integrable_on_def)
[PROOF STATE]
proof (state)
this:
(f has_integral integral S f) S

goal (1 subgoal):
 1. set_lebesgue_integral lborel S f = integral S f
[PROOF STEP]
thus "LINT x : S | lborel. f x = integral S f"
[PROOF STATE]
proof (prove)
using this:
(f has_integral integral S f) S

goal (1 subgoal):
 1. set_lebesgue_integral lborel S f = integral S f
[PROOF STEP]
by (intro has_integral_unique [OF 1])
[PROOF STATE]
proof (state)
this:
set_lebesgue_integral lborel S f = integral S f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vifunion_vsubset_iff: "((\<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. f i) \<subseteq>\<^sub>\<circ> B) = (\<forall>i\<in>\<^sub>\<circ>I. f i \<subseteq>\<^sub>\<circ> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>\<^sub>\<circ> (VLambda I f `\<^sub>\<circ> I) \<subseteq>\<^sub>\<circ> B) = (\<forall>i\<in>elts I. f i \<subseteq>\<^sub>\<circ> B)
[PROOF STEP]
by force


[STATEMENT]
lemma DERIV_chain3: (*HAS_COMPLEX_DERIVATIVE_CHAIN_UNIV*)
  assumes "(\<And>x. DERIV g x :> g'(x))"
    and "DERIV f x :> f'"
  shows "DERIV (\<lambda>x. g(f x)) x :> f' * g'(f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. g (f x)) has_field_derivative f' * g' (f x)) (at x)
[PROOF STEP]
by (metis UNIV_I DERIV_chain_s [of UNIV] assms)


[STATEMENT]
lemma energy_graph_partition_half:
  assumes P: "finite_graph_partition U P n"
  shows "card U * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. card R * (edge_density R W G)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
proof (cases "finite U")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
 2. infinite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
finite U

goal (2 subgoals):
 1. finite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
 2. infinite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
have \<section>: "(\<Sum>R\<in>P. card R * edge_density R W G)\<^sup>2
         \<le> (sum card P) * (\<Sum>R\<in>P. card R * (edge_density R W G)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>R\<in>P. real (card R) * edge_density R W G)\<^sup>2 \<le> real (sum card P) * (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
by (simp add: sum_products_le)
[PROOF STATE]
proof (state)
this:
(\<Sum>R\<in>P. real (card R) * edge_density R W G)\<^sup>2 \<le> real (sum card P) * (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)

goal (2 subgoals):
 1. finite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
 2. infinite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
have "card U * (edge_density U W G)\<^sup>2 = (\<Sum>R\<in>P. card R * (edge_density U W G)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card U) * (edge_density U W G)\<^sup>2 = (\<Sum>R\<in>P. real (card R) * (edge_density U W G)\<^sup>2)
[PROOF STEP]
by (metis \<open>finite U\<close> P sum_distrib_right card_finite_graph_partition of_nat_sum)
[PROOF STATE]
proof (state)
this:
real (card U) * (edge_density U W G)\<^sup>2 = (\<Sum>R\<in>P. real (card R) * (edge_density U W G)\<^sup>2)

goal (2 subgoals):
 1. finite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
 2. infinite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (card U) * (edge_density U W G)\<^sup>2 = (\<Sum>R\<in>P. real (card R) * (edge_density U W G)\<^sup>2)

goal (2 subgoals):
 1. finite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
 2. infinite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
have "\<dots> = edge_density U W G * (\<Sum>R\<in>P. edge_density U W G * card R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>R\<in>P. real (card R) * (edge_density U W G)\<^sup>2) = edge_density U W G * (\<Sum>R\<in>P. edge_density U W G * real (card R))
[PROOF STEP]
by (simp add: sum_distrib_left power2_eq_square mult_ac)
[PROOF STATE]
proof (state)
this:
(\<Sum>R\<in>P. real (card R) * (edge_density U W G)\<^sup>2) = edge_density U W G * (\<Sum>R\<in>P. edge_density U W G * real (card R))

goal (2 subgoals):
 1. finite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
 2. infinite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>R\<in>P. real (card R) * (edge_density U W G)\<^sup>2) = edge_density U W G * (\<Sum>R\<in>P. edge_density U W G * real (card R))

goal (2 subgoals):
 1. finite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
 2. infinite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
have "\<dots> = (\<Sum>R\<in>P. edge_density R W G * real (card R)) * edge_density U W G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. edge_density U W G * (\<Sum>R\<in>P. edge_density U W G * real (card R)) = (\<Sum>R\<in>P. edge_density R W G * real (card R)) * edge_density U W G
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. edge_density U W G * (\<Sum>R\<in>P. edge_density U W G * real (card R)) = (\<Sum>R\<in>P. edge_density R W G * real (card R)) * edge_density U W G
[PROOF STEP]
have "edge_density U W G * (\<Sum>R\<in>P. edge_density R W G * card R)
        = edge_density U W G * (edge_density U W G * (\<Sum>R\<in>P. card R))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. edge_density U W G * (\<Sum>R\<in>P. edge_density R W G * real (card R)) = edge_density U W G * (edge_density U W G * real (sum card P))
[PROOF STEP]
using \<open>finite U\<close> assms card_finite_graph_partition
[PROOF STATE]
proof (prove)
using this:
finite U
finite_graph_partition U P n
\<lbrakk>finite_graph_partition ?V ?P ?k; finite ?V\<rbrakk> \<Longrightarrow> sum card ?P = card ?V

goal (1 subgoal):
 1. edge_density U W G * (\<Sum>R\<in>P. edge_density R W G * real (card R)) = edge_density U W G * (edge_density U W G * real (sum card P))
[PROOF STEP]
by (auto simp: edge_density_partition [OF P])
[PROOF STATE]
proof (state)
this:
edge_density U W G * (\<Sum>R\<in>P. edge_density R W G * real (card R)) = edge_density U W G * (edge_density U W G * real (sum card P))

goal (1 subgoal):
 1. edge_density U W G * (\<Sum>R\<in>P. edge_density U W G * real (card R)) = (\<Sum>R\<in>P. edge_density R W G * real (card R)) * edge_density U W G
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
edge_density U W G * (\<Sum>R\<in>P. edge_density R W G * real (card R)) = edge_density U W G * (edge_density U W G * real (sum card P))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
edge_density U W G * (\<Sum>R\<in>P. edge_density R W G * real (card R)) = edge_density U W G * (edge_density U W G * real (sum card P))

goal (1 subgoal):
 1. edge_density U W G * (\<Sum>R\<in>P. edge_density U W G * real (card R)) = (\<Sum>R\<in>P. edge_density R W G * real (card R)) * edge_density U W G
[PROOF STEP]
by (simp add: mult.commute sum_distrib_left)
[PROOF STATE]
proof (state)
this:
edge_density U W G * (\<Sum>R\<in>P. edge_density U W G * real (card R)) = (\<Sum>R\<in>P. edge_density R W G * real (card R)) * edge_density U W G

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
edge_density U W G * (\<Sum>R\<in>P. edge_density U W G * real (card R)) = (\<Sum>R\<in>P. edge_density R W G * real (card R)) * edge_density U W G

goal (2 subgoals):
 1. finite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
 2. infinite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
edge_density U W G * (\<Sum>R\<in>P. edge_density U W G * real (card R)) = (\<Sum>R\<in>P. edge_density R W G * real (card R)) * edge_density U W G

goal (2 subgoals):
 1. finite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
 2. infinite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
have "\<dots> = (\<Sum>R\<in>P. card R * edge_density R W G) * edge_density U W G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>R\<in>P. edge_density R W G * real (card R)) * edge_density U W G = (\<Sum>R\<in>P. real (card R) * edge_density R W G) * edge_density U W G
[PROOF STEP]
by (simp add: sum_distrib_left mult_ac)
[PROOF STATE]
proof (state)
this:
(\<Sum>R\<in>P. edge_density R W G * real (card R)) * edge_density U W G = (\<Sum>R\<in>P. real (card R) * edge_density R W G) * edge_density U W G

goal (2 subgoals):
 1. finite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
 2. infinite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>R\<in>P. edge_density R W G * real (card R)) * edge_density U W G = (\<Sum>R\<in>P. real (card R) * edge_density R W G) * edge_density U W G

goal (2 subgoals):
 1. finite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
 2. infinite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
have "\<dots> = (\<Sum>R\<in>P. card R * edge_density R W G)\<^sup>2 / card U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>R\<in>P. real (card R) * edge_density R W G) * edge_density U W G = (\<Sum>R\<in>P. real (card R) * edge_density R W G)\<^sup>2 / real (card U)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite_graph_partition U P n

goal (1 subgoal):
 1. (\<Sum>R\<in>P. real (card R) * edge_density R W G) * edge_density U W G = (\<Sum>R\<in>P. real (card R) * edge_density R W G)\<^sup>2 / real (card U)
[PROOF STEP]
by (simp add: edge_density_partition [OF P] mult_ac flip: power2_eq_square)
[PROOF STATE]
proof (state)
this:
(\<Sum>R\<in>P. real (card R) * edge_density R W G) * edge_density U W G = (\<Sum>R\<in>P. real (card R) * edge_density R W G)\<^sup>2 / real (card U)

goal (2 subgoals):
 1. finite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
 2. infinite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>R\<in>P. real (card R) * edge_density R W G) * edge_density U W G = (\<Sum>R\<in>P. real (card R) * edge_density R W G)\<^sup>2 / real (card U)

goal (2 subgoals):
 1. finite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
 2. infinite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
have "\<dots> \<le> (\<Sum>R\<in>P. card R * (edge_density R W G)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>R\<in>P. real (card R) * edge_density R W G)\<^sup>2 / real (card U) \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
using \<section> P card_finite_graph_partition \<open>finite U\<close>
[PROOF STATE]
proof (prove)
using this:
(\<Sum>R\<in>P. real (card R) * edge_density R W G)\<^sup>2 \<le> real (sum card P) * (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
finite_graph_partition U P n
\<lbrakk>finite_graph_partition ?V ?P ?k; finite ?V\<rbrakk> \<Longrightarrow> sum card ?P = card ?V
finite U

goal (1 subgoal):
 1. (\<Sum>R\<in>P. real (card R) * edge_density R W G)\<^sup>2 / real (card U) \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
by (force simp add: mult_ac divide_simps simp flip: of_nat_sum)
[PROOF STATE]
proof (state)
this:
(\<Sum>R\<in>P. real (card R) * edge_density R W G)\<^sup>2 / real (card U) \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)

goal (2 subgoals):
 1. finite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
 2. infinite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)

goal (1 subgoal):
 1. real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)

goal (1 subgoal):
 1. infinite U \<Longrightarrow> real (card U) * (edge_density U W G)\<^sup>2 \<le> (\<Sum>R\<in>P. real (card R) * (edge_density R W G)\<^sup>2)
[PROOF STEP]
qed (simp add: sum_nonneg)


[STATEMENT]
lemma qfN_mult2: "((a::int)^2 + N*b^2)*(c^2 + N*d^2)
  = (a*c-N*b*d)^2 + N*(a*d+b*c)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a\<^sup>2 + N * b\<^sup>2) * (c\<^sup>2 + N * d\<^sup>2) = (a * c - N * b * d)\<^sup>2 + N * (a * d + b * c)\<^sup>2
[PROOF STEP]
by (simp add: eval_nat_numeral field_simps)


[STATEMENT]
lemma multiset_prod_fact_remove:
  "x \<in># A \<Longrightarrow> (\<Prod>y\<in>set_mset A. fact (count A y)) =
                   count A x * (\<Prod>y\<in>set_mset (A-{#x#}). fact (count (A-{#x#}) y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in># A \<Longrightarrow> (\<Prod>y\<in>set_mset A. fact (count A y)) = count A x * (\<Prod>y\<in>set_mset (A - {#x#}). fact (count (A - {#x#}) y))
[PROOF STEP]
using multiset_prod_fact_insert[of "A - {#x#}" x]
[PROOF STATE]
proof (prove)
using this:
(\<Prod>y\<in>set_mset (A - {#x#} + {#x#}). fact (count (A - {#x#} + {#x#}) y)) = (count (A - {#x#}) x + 1) * (\<Prod>y\<in>set_mset (A - {#x#}). fact (count (A - {#x#}) y))

goal (1 subgoal):
 1. x \<in># A \<Longrightarrow> (\<Prod>y\<in>set_mset A. fact (count A y)) = count A x * (\<Prod>y\<in>set_mset (A - {#x#}). fact (count (A - {#x#}) y))
[PROOF STEP]
by simp


[STATEMENT]
theorem quotient_multiplication [simp]:
  "\<lbrakk> a \<in> R; b \<in> R \<rbrakk> \<Longrightarrow> (a +| I) [\<cdot>] (b +| I) = a \<cdot> b +| I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> R; b \<in> R\<rbrakk> \<Longrightarrow> (a +| I) [\<cdot>] (b +| I) = a \<cdot> b +| I
[PROOF STEP]
using multiplicative.Class_commutes_with_composition additive.Class_is_Left_Coset
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> R; ?b \<in> R\<rbrakk> \<Longrightarrow> additive.Class ?a [\<cdot>] additive.Class ?b = additive.Class (?a \<cdot> ?b)
?g \<in> R \<Longrightarrow> additive.Class ?g = ?g +| I

goal (1 subgoal):
 1. \<lbrakk>a \<in> R; b \<in> R\<rbrakk> \<Longrightarrow> (a +| I) [\<cdot>] (b +| I) = a \<cdot> b +| I
[PROOF STEP]
by auto


[STATEMENT]
lemma supp_prod:
  fixes x :: "'a"
  and   y :: "'b"
  shows "(supp (x,y)) = (supp x)\<union>(supp y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. supp (x, y) = supp x \<union> supp y
[PROOF STEP]
by  (force simp add: supp_def Collect_imp_eq Collect_neg_eq)


[STATEMENT]
lemma pochhammer_poly_code [code abstract]:
  "coeffs (pochhammer_poly n) = map of_nat (stirling_row n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeffs (pochhammer_poly n) = map of_nat (stirling_row n)
[PROOF STEP]
by (simp add: pochhammer_poly_def stirling_row_def Let_def)


[STATEMENT]
theorem strong_int_gr_induct:
  assumes
    "k < (i::int)"
    "(\<And>i. k < i \<Longrightarrow> (\<And>j. k < j \<Longrightarrow> j < i \<Longrightarrow> P j) \<Longrightarrow> P i)"
  shows "P i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P i
[PROOF STEP]
using assms less_induct strong_int_gr_induct_helper
[PROOF STATE]
proof (prove)
using this:
k < i
\<lbrakk>k < ?i; \<And>j. \<lbrakk>k < j; j < ?i\<rbrakk> \<Longrightarrow> P j\<rbrakk> \<Longrightarrow> P ?i
(\<And>x. (\<And>y. y < x \<Longrightarrow> ?P y) \<Longrightarrow> ?P x) \<Longrightarrow> ?P ?a
\<lbrakk>?k < ?i; \<And>i. \<lbrakk>?k < i; \<And>j. \<lbrakk>?k < j; j < i\<rbrakk> \<Longrightarrow> ?P j\<rbrakk> \<Longrightarrow> ?P i; ?k < ?j; ?j < ?i\<rbrakk> \<Longrightarrow> ?P ?j

goal (1 subgoal):
 1. P i
[PROOF STEP]
by blast


[STATEMENT]
lemma closed_subspace_closed_sum:
  fixes A B::"('a::complex_normed_vector) set"
  assumes a1: \<open>csubspace A\<close> and a2: \<open>csubspace B\<close>
  shows \<open>closed_csubspace (A +\<^sub>M B)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_csubspace (A +\<^sub>M B)
[PROOF STEP]
using a1 a2 closed_sum_def
[PROOF STATE]
proof (prove)
using this:
csubspace A
csubspace B
?A +\<^sub>M ?B = closure (?A + ?B)

goal (1 subgoal):
 1. closed_csubspace (A +\<^sub>M B)
[PROOF STEP]
by (metis closure_is_closed_csubspace csubspace_set_plus)


[STATEMENT]
lemma dim_row_tensor_mat [simp]:
  "dim_row (A \<Otimes> B) = dim_row A * dim_row B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (A \<Otimes> B) = dim_row A * dim_row B
[PROOF STEP]
by (simp add: mat_of_cols_list_def tensor_mat_def)


[STATEMENT]
theorem "finite A \<Longrightarrow> card (n_permutations A n) = ffact n (card A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> card (n_permutations A n) = ffact n (card A)
[PROOF STEP]
unfolding n_permutations_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> card {xs. set xs \<subseteq> A \<and> distinct xs \<and> length xs = n} = ffact n (card A)
[PROOF STEP]
using card_lists_distinct_length_eq
[PROOF STATE]
proof (prove)
using this:
finite ?A \<Longrightarrow> card {xs. length xs = ?n \<and> distinct xs \<and> set xs \<subseteq> ?A} = ffact ?n (card ?A)

goal (1 subgoal):
 1. finite A \<Longrightarrow> card {xs. set xs \<subseteq> A \<and> distinct xs \<and> length xs = n} = ffact n (card A)
[PROOF STEP]
by (metis (no_types, lifting) Collect_cong)


[STATEMENT]
lemma even_prime_nat: "prime p \<Longrightarrow> even p \<Longrightarrow> p = (2::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; even p\<rbrakk> \<Longrightarrow> p = 2
[PROOF STEP]
using prime_odd_nat[of p] prime_gt_1_nat[of p]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>prime p; 2 < p\<rbrakk> \<Longrightarrow> odd p
prime p \<Longrightarrow> 1 < p

goal (1 subgoal):
 1. \<lbrakk>prime p; even p\<rbrakk> \<Longrightarrow> p = 2
[PROOF STEP]
by (cases "p = 2") auto


[STATEMENT]
lemma sqrt_int_ceiling_code[code]: "sqrt_int_ceiling x = (if x \<ge> 0 then sqrt_int_ceiling_pos x else - sqrt_int_floor_pos (- x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt_int_ceiling x = (if 0 \<le> x then sqrt_int_ceiling_pos x else - sqrt_int_floor_pos (- x))
[PROOF STEP]
unfolding sqrt_int_ceiling_def root_int_ceiling_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if 0 \<le> x then root_int_ceiling_pos 2 x else - root_int_floor_pos 2 (- x)) = (if 0 \<le> x then sqrt_int_ceiling_pos x else - sqrt_int_floor_pos (- x))
[PROOF STEP]
by simp


[STATEMENT]
lemma finite_lattice_complete_Sup_least:
  "\<forall>x::'a::finite_lattice_complete \<in> A. z \<ge> x \<Longrightarrow> z \<ge> Sup A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>A. x \<le> z \<Longrightarrow> Sup A \<le> z
[PROOF STEP]
using finite [of A]
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. \<forall>x\<in>A. x \<le> z \<Longrightarrow> Sup A \<le> z
[PROOF STEP]
by (induct A) (auto simp add: finite_lattice_complete_Sup_empty finite_lattice_complete_Sup_insert)


[STATEMENT]
lemma finite_conj :
  assumes "finite E"
  assumes "\<forall> e \<in> E. finite (vars e)"
  shows   "finite (vars (conjunct E))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (Bexp.vars (conjunct E))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite E
\<forall>e\<in>E. finite (Bexp.vars e)

goal (1 subgoal):
 1. finite (Bexp.vars (conjunct E))
[PROOF STEP]
proof (induct rule : finite_induct, goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>e\<in>{}. finite (Bexp.vars e) \<Longrightarrow> finite (Bexp.vars (conjunct {}))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<forall>e\<in>F. finite (Bexp.vars e) \<Longrightarrow> finite (Bexp.vars (conjunct F)); \<forall>e\<in>insert x F. finite (Bexp.vars e)\<rbrakk> \<Longrightarrow> finite (Bexp.vars (conjunct (insert x F)))
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
\<forall>e\<in>{}. finite (Bexp.vars e)

goal (2 subgoals):
 1. \<forall>e\<in>{}. finite (Bexp.vars e) \<Longrightarrow> finite (Bexp.vars (conjunct {}))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<forall>e\<in>F. finite (Bexp.vars e) \<Longrightarrow> finite (Bexp.vars (conjunct F)); \<forall>e\<in>insert x F. finite (Bexp.vars e)\<rbrakk> \<Longrightarrow> finite (Bexp.vars (conjunct (insert x F)))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>e\<in>{}. finite (Bexp.vars e)

goal (1 subgoal):
 1. finite (Bexp.vars (conjunct {}))
[PROOF STEP]
by (simp add : vars_def conjunct_def)
[PROOF STATE]
proof (state)
this:
finite (Bexp.vars (conjunct {}))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<forall>e\<in>F. finite (Bexp.vars e) \<Longrightarrow> finite (Bexp.vars (conjunct F)); \<forall>e\<in>insert x F. finite (Bexp.vars e)\<rbrakk> \<Longrightarrow> finite (Bexp.vars (conjunct (insert x F)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<forall>e\<in>F. finite (Bexp.vars e) \<Longrightarrow> finite (Bexp.vars (conjunct F)); \<forall>e\<in>insert x F. finite (Bexp.vars e)\<rbrakk> \<Longrightarrow> finite (Bexp.vars (conjunct (insert x F)))
[PROOF STEP]
case (2 e E)
[PROOF STATE]
proof (state)
this:
finite E
e \<notin> E
\<forall>e\<in>E. finite (Bexp.vars e) \<Longrightarrow> finite (Bexp.vars (conjunct E))
\<forall>e\<in>insert e E. finite (Bexp.vars e)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<forall>e\<in>F. finite (Bexp.vars e) \<Longrightarrow> finite (Bexp.vars (conjunct F)); \<forall>e\<in>insert x F. finite (Bexp.vars e)\<rbrakk> \<Longrightarrow> finite (Bexp.vars (conjunct (insert x F)))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
finite E
e \<notin> E
\<forall>e\<in>E. finite (Bexp.vars e) \<Longrightarrow> finite (Bexp.vars (conjunct E))
\<forall>e\<in>insert e E. finite (Bexp.vars e)

goal (1 subgoal):
 1. finite (Bexp.vars (conjunct (insert e E)))
[PROOF STEP]
using vars_of_conj[of e "conjunct E"]
[PROOF STATE]
proof (prove)
using this:
finite E
e \<notin> E
\<forall>e\<in>E. finite (Bexp.vars e) \<Longrightarrow> finite (Bexp.vars (conjunct E))
\<forall>e\<in>insert e E. finite (Bexp.vars e)
Bexp.vars (\<lambda>\<sigma>. e \<sigma> \<and> conjunct E \<sigma>) \<subseteq> Bexp.vars e \<union> Bexp.vars (conjunct E)

goal (1 subgoal):
 1. finite (Bexp.vars (conjunct (insert e E)))
[PROOF STEP]
by (rule_tac rev_finite_subset, auto simp add : conjunct_def)
[PROOF STATE]
proof (state)
this:
finite (Bexp.vars (conjunct (insert e E)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma  det_row_operation:
  fixes A :: "'a::{comm_ring_1}^'n^'n"
  assumes ij: "i \<noteq> j"
  shows "det (\<chi> k. if k = i then row i A + c *s row j A else row k A) = det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (\<chi>k. if k = i then row i A + c *s row j A else row k A) = det A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (\<chi>k. if k = i then row i A + c *s row j A else row k A) = det A
[PROOF STEP]
let ?Z = "(\<chi> k. if k = i then row j A else row k A) :: 'a ^'n^'n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (\<chi>k. if k = i then row i A + c *s row j A else row k A) = det A
[PROOF STEP]
have th: "row i ?Z = row j ?Z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row i (\<chi>k. if k = i then row j A else row k A) = row j (\<chi>k. if k = i then row j A else row k A)
[PROOF STEP]
by (vector row_def)
[PROOF STATE]
proof (state)
this:
row i (\<chi>k. if k = i then row j A else row k A) = row j (\<chi>k. if k = i then row j A else row k A)

goal (1 subgoal):
 1. det (\<chi>k. if k = i then row i A + c *s row j A else row k A) = det A
[PROOF STEP]
have th2: "((\<chi> k. if k = i then row i A else row k A) :: 'a^'n^'n) = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>k. if k = i then row i A else row k A) = A
[PROOF STEP]
by (vector row_def)
[PROOF STATE]
proof (state)
this:
(\<chi>k. if k = i then row i A else row k A) = A

goal (1 subgoal):
 1. det (\<chi>k. if k = i then row i A + c *s row j A else row k A) = det A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (\<chi>k. if k = i then row i A + c *s row j A else row k A) = det A
[PROOF STEP]
unfolding det_row_add [of i] det_row_mul[of i] det_identical_rows[OF ij th] th2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A + c * (0::'a) = det A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det (\<chi>k. if k = i then row i A + c *s row j A else row k A) = det A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma emeasure_insert:
  assumes sets: "{x} \<in> sets M" "A \<in> sets M" and "x \<notin> A"
  shows "emeasure M (insert x A) = emeasure M {x} + emeasure M A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (insert x A) = emeasure M {x} + emeasure M A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure M (insert x A) = emeasure M {x} + emeasure M A
[PROOF STEP]
have "{x} \<inter> A = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x} \<inter> A = {}
[PROOF STEP]
using \<open>x \<notin> A\<close>
[PROOF STATE]
proof (prove)
using this:
x \<notin> A

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

goal (1 subgoal):
 1. emeasure M (insert x A) = emeasure M {x} + emeasure M A
[PROOF STEP]
from plus_emeasure[OF sets this]
[PROOF STATE]
proof (chain)
picking this:
emeasure M {x} + emeasure M A = emeasure M ({x} \<union> A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
emeasure M {x} + emeasure M A = emeasure M ({x} \<union> A)

goal (1 subgoal):
 1. emeasure M (insert x A) = emeasure M {x} + emeasure M A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
emeasure M (insert x A) = emeasure M {x} + emeasure M A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iprev_nth_surj_on: "finite I \<Longrightarrow> surj_on (\<lambda>n. I \<leftarrow> n) UNIV I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite I \<Longrightarrow> surj_on (iprev_nth I) UNIV I
[PROOF STEP]
apply (simp add: surj_on_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite I \<Longrightarrow> \<forall>b\<in>I. \<exists>a. b = I \<leftarrow> a
[PROOF STEP]
by (insert iprev_nth_surj_aux1[of I], blast)


[STATEMENT]
lemma [pred_set_conv]:
  "((\<lambda>x x' y. ((x, x'), y) \<in> R) <= (\<lambda>x x' y. ((x, x'), y) \<in> S)) = (R <= S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x x' y. ((x, x'), y) \<in> R) \<le> (\<lambda>x x' y. ((x, x'), y) \<in> S)) = (R \<subseteq> S)
[PROOF STEP]
unfolding subset_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x x' y. ((x, x'), y) \<in> R) \<le> (\<lambda>x x' y. ((x, x'), y) \<in> S)) = (\<forall>x\<in>R. x \<in> S)
[PROOF STEP]
by (auto simp add: le_fun_def)


[STATEMENT]
lemma pi_half_less_two [simp]: "pi/2 < 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pi / 2 < 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pi / 2 < 2
[PROOF STEP]
have "pi/2 \<le> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pi / 2 \<le> 2
[PROOF STEP]
by (simp add: pi_half cos_is_zero [THEN theI'])
[PROOF STATE]
proof (state)
this:
pi / 2 \<le> 2

goal (1 subgoal):
 1. pi / 2 < 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pi / 2 \<le> 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
pi / 2 \<le> 2

goal (1 subgoal):
 1. pi / 2 < 2
[PROOF STEP]
by (metis cos_pi_half cos_two_neq_zero le_less)
[PROOF STATE]
proof (state)
this:
pi / 2 < 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma truncate_aform_error_aform_cancel:
  "aform_val e (truncate_aform p z) = aform_val e z + aform_val e (truncate_error_aform p z) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aform_val e (truncate_aform p z) = aform_val e z + aform_val e (truncate_error_aform p z)
[PROOF STEP]
by (simp add: truncate_aform_def aform_val_def truncate_error_aform_def pdevs_val_trunc_pdevs)


[STATEMENT]
lemma pochhammer_rGamma: "rGamma z = pochhammer z n * rGamma (z + of_nat n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rGamma z = pochhammer z n * rGamma (z + of_nat n)
[PROOF STEP]
proof (induction n arbitrary: z)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>z. rGamma z = pochhammer z 0 * rGamma (z + of_nat 0)
 2. \<And>n z. (\<And>z. rGamma z = pochhammer z n * rGamma (z + of_nat n)) \<Longrightarrow> rGamma z = pochhammer z (Suc n) * rGamma (z + of_nat (Suc n))
[PROOF STEP]
case (Suc n z)
[PROOF STATE]
proof (state)
this:
rGamma ?z = pochhammer ?z n * rGamma (?z + of_nat n)

goal (2 subgoals):
 1. \<And>z. rGamma z = pochhammer z 0 * rGamma (z + of_nat 0)
 2. \<And>n z. (\<And>z. rGamma z = pochhammer z n * rGamma (z + of_nat n)) \<Longrightarrow> rGamma z = pochhammer z (Suc n) * rGamma (z + of_nat (Suc n))
[PROOF STEP]
have "rGamma z = pochhammer z n * rGamma (z + of_nat n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rGamma z = pochhammer z n * rGamma (z + of_nat n)
[PROOF STEP]
by (rule Suc.IH)
[PROOF STATE]
proof (state)
this:
rGamma z = pochhammer z n * rGamma (z + of_nat n)

goal (2 subgoals):
 1. \<And>z. rGamma z = pochhammer z 0 * rGamma (z + of_nat 0)
 2. \<And>n z. (\<And>z. rGamma z = pochhammer z n * rGamma (z + of_nat n)) \<Longrightarrow> rGamma z = pochhammer z (Suc n) * rGamma (z + of_nat (Suc n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
rGamma z = pochhammer z n * rGamma (z + of_nat n)

goal (2 subgoals):
 1. \<And>z. rGamma z = pochhammer z 0 * rGamma (z + of_nat 0)
 2. \<And>n z. (\<And>z. rGamma z = pochhammer z n * rGamma (z + of_nat n)) \<Longrightarrow> rGamma z = pochhammer z (Suc n) * rGamma (z + of_nat (Suc n))
[PROOF STEP]
note rGamma_plus1 [symmetric]
[PROOF STATE]
proof (state)
this:
rGamma ?z = ?z * rGamma (?z + (1::?'a))

goal (2 subgoals):
 1. \<And>z. rGamma z = pochhammer z 0 * rGamma (z + of_nat 0)
 2. \<And>n z. (\<And>z. rGamma z = pochhammer z n * rGamma (z + of_nat n)) \<Longrightarrow> rGamma z = pochhammer z (Suc n) * rGamma (z + of_nat (Suc n))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
rGamma z = pochhammer z n * ((z + of_nat n) * rGamma (z + of_nat n + (1::'a)))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
rGamma z = pochhammer z n * ((z + of_nat n) * rGamma (z + of_nat n + (1::'a)))

goal (1 subgoal):
 1. rGamma z = pochhammer z (Suc n) * rGamma (z + of_nat (Suc n))
[PROOF STEP]
by (simp add: add_ac pochhammer_rec')
[PROOF STATE]
proof (state)
this:
rGamma z = pochhammer z (Suc n) * rGamma (z + of_nat (Suc n))

goal (1 subgoal):
 1. \<And>z. rGamma z = pochhammer z 0 * rGamma (z + of_nat 0)
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma heron_step_div_eq_floored:
  "(t::nat) > 0 \<Longrightarrow> (t + (n::nat) div t) div 2 = nat \<lfloor>(t + n/t) / 2\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < t \<Longrightarrow> (t + n div t) div 2 = nat \<lfloor>(real t + real n / real t) / 2\<rfloor>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < t \<Longrightarrow> (t + n div t) div 2 = nat \<lfloor>(real t + real n / real t) / 2\<rfloor>
[PROOF STEP]
assume "t > 0"
[PROOF STATE]
proof (state)
this:
0 < t

goal (1 subgoal):
 1. 0 < t \<Longrightarrow> (t + n div t) div 2 = nat \<lfloor>(real t + real n / real t) / 2\<rfloor>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < t
[PROOF STEP]
have "\<lfloor>(t + n/t) / 2\<rfloor> = \<lfloor>(t*t + n) / (2*t)\<rfloor>"
[PROOF STATE]
proof (prove)
using this:
0 < t

goal (1 subgoal):
 1. \<lfloor>(real t + real n / real t) / 2\<rfloor> = \<lfloor>real (t * t + n) / real (2 * t)\<rfloor>
[PROOF STEP]
by (simp add: mult_divide_mult_cancel_right[of t "t + n/t" 2, symmetric]
        algebra_simps)
[PROOF STATE]
proof (state)
this:
\<lfloor>(real t + real n / real t) / 2\<rfloor> = \<lfloor>real (t * t + n) / real (2 * t)\<rfloor>

goal (1 subgoal):
 1. 0 < t \<Longrightarrow> (t + n div t) div 2 = nat \<lfloor>(real t + real n / real t) / 2\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<lfloor>(real t + real n / real t) / 2\<rfloor> = \<lfloor>real (t * t + n) / real (2 * t)\<rfloor>

goal (1 subgoal):
 1. 0 < t \<Longrightarrow> (t + n div t) div 2 = nat \<lfloor>(real t + real n / real t) / 2\<rfloor>
[PROOF STEP]
have "\<dots> = (t*t + n) div (2*t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>real (t * t + n) / real (2 * t)\<rfloor> = int ((t * t + n) div (2 * t))
[PROOF STEP]
using floor_divide_of_nat_eq
[PROOF STATE]
proof (prove)
using this:
\<lfloor>of_nat ?m / of_nat ?n\<rfloor> = int (?m div ?n)

goal (1 subgoal):
 1. \<lfloor>real (t * t + n) / real (2 * t)\<rfloor> = int ((t * t + n) div (2 * t))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<lfloor>real (t * t + n) / real (2 * t)\<rfloor> = int ((t * t + n) div (2 * t))

goal (1 subgoal):
 1. 0 < t \<Longrightarrow> (t + n div t) div 2 = nat \<lfloor>(real t + real n / real t) / 2\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<lfloor>real (t * t + n) / real (2 * t)\<rfloor> = int ((t * t + n) div (2 * t))

goal (1 subgoal):
 1. 0 < t \<Longrightarrow> (t + n div t) div 2 = nat \<lfloor>(real t + real n / real t) / 2\<rfloor>
[PROOF STEP]
have "\<dots> = (t*t + n) div t div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int ((t * t + n) div (2 * t)) = int ((t * t + n) div t div 2)
[PROOF STEP]
by (simp add: Divides.div_mult2_eq mult.commute)
[PROOF STATE]
proof (state)
this:
int ((t * t + n) div (2 * t)) = int ((t * t + n) div t div 2)

goal (1 subgoal):
 1. 0 < t \<Longrightarrow> (t + n div t) div 2 = nat \<lfloor>(real t + real n / real t) / 2\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
int ((t * t + n) div (2 * t)) = int ((t * t + n) div t div 2)

goal (1 subgoal):
 1. 0 < t \<Longrightarrow> (t + n div t) div 2 = nat \<lfloor>(real t + real n / real t) / 2\<rfloor>
[PROOF STEP]
have "\<dots> = (t + n div t) div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int ((t * t + n) div t div 2) = int ((t + n div t) div 2)
[PROOF STEP]
by (simp add: \<open>0 < t\<close> power2_eq_square)
[PROOF STATE]
proof (state)
this:
int ((t * t + n) div t div 2) = int ((t + n div t) div 2)

goal (1 subgoal):
 1. 0 < t \<Longrightarrow> (t + n div t) div 2 = nat \<lfloor>(real t + real n / real t) / 2\<rfloor>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<lfloor>(real t + real n / real t) / 2\<rfloor> = int ((t + n div t) div 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lfloor>(real t + real n / real t) / 2\<rfloor> = int ((t + n div t) div 2)

goal (1 subgoal):
 1. (t + n div t) div 2 = nat \<lfloor>(real t + real n / real t) / 2\<rfloor>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(t + n div t) div 2 = nat \<lfloor>(real t + real n / real t) / 2\<rfloor>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inter_eqvt [eqvt]:
  shows "p \<bullet> (A \<inter> B) = (p \<bullet> A) \<inter> (p \<bullet> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<bullet> (A \<inter> B) = p \<bullet> A \<inter> p \<bullet> B
[PROOF STEP]
unfolding Int_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<bullet> {x \<in> A. x \<in> B} = {x \<in> p \<bullet> A. x \<in> p \<bullet> B}
[PROOF STEP]
by simp


[STATEMENT]
lemma bound_main_lemma_2: "\<And>(s :: nat set) k. (s \<noteq> {}) \<and> (\<forall>x. x \<in> s \<longrightarrow> x \<le> k) \<Longrightarrow> Sup s \<le> k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s k. s \<noteq> {} \<and> (\<forall>x. x \<in> s \<longrightarrow> x \<le> k) \<Longrightarrow> Sup s \<le> k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>s k. s \<noteq> {} \<and> (\<forall>x. x \<in> s \<longrightarrow> x \<le> k) \<Longrightarrow> Sup s \<le> k
[PROOF STEP]
fix s :: "nat set" and k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>s k. s \<noteq> {} \<and> (\<forall>x. x \<in> s \<longrightarrow> x \<le> k) \<Longrightarrow> Sup s \<le> k
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>s k. s \<noteq> {} \<and> (\<forall>x. x \<in> s \<longrightarrow> x \<le> k) \<Longrightarrow> Sup s \<le> k
[PROOF STEP]
assume P1: "s \<noteq> {}"
[PROOF STATE]
proof (state)
this:
s \<noteq> {}

goal (1 subgoal):
 1. \<And>s k. s \<noteq> {} \<and> (\<forall>x. x \<in> s \<longrightarrow> x \<le> k) \<Longrightarrow> Sup s \<le> k
[PROOF STEP]
assume P2: "(\<forall>x. x \<in> s \<longrightarrow> x \<le> k)"
[PROOF STATE]
proof (state)
this:
\<forall>x. x \<in> s \<longrightarrow> x \<le> k

goal (1 subgoal):
 1. \<And>s k. s \<noteq> {} \<and> (\<forall>x. x \<in> s \<longrightarrow> x \<le> k) \<Longrightarrow> Sup s \<le> k
[PROOF STEP]
have "finite s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite s
[PROOF STEP]
using P2 mems_le_finite
[PROOF STATE]
proof (prove)
using this:
\<forall>x. x \<in> s \<longrightarrow> x \<le> k
\<forall>x. x \<in> ?s \<longrightarrow> x \<le> ?k \<Longrightarrow> finite ?s

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

goal (1 subgoal):
 1. \<And>s k. s \<noteq> {} \<and> (\<forall>x. x \<in> s \<longrightarrow> x \<le> k) \<Longrightarrow> Sup s \<le> k
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite s

goal (1 subgoal):
 1. \<And>s k. s \<noteq> {} \<and> (\<forall>x. x \<in> s \<longrightarrow> x \<le> k) \<Longrightarrow> Sup s \<le> k
[PROOF STEP]
have "Max s \<in> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max s \<in> s
[PROOF STEP]
using P1 calculation Max_in
[PROOF STATE]
proof (prove)
using this:
s \<noteq> {}
finite s
\<lbrakk>finite ?A; ?A \<noteq> {}\<rbrakk> \<Longrightarrow> Max ?A \<in> ?A

goal (1 subgoal):
 1. Max s \<in> s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Max s \<in> s

goal (1 subgoal):
 1. \<And>s k. s \<noteq> {} \<and> (\<forall>x. x \<in> s \<longrightarrow> x \<le> k) \<Longrightarrow> Sup s \<le> k
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Max s \<in> s

goal (1 subgoal):
 1. \<And>s k. s \<noteq> {} \<and> (\<forall>x. x \<in> s \<longrightarrow> x \<le> k) \<Longrightarrow> Sup s \<le> k
[PROOF STEP]
have "Max s \<le> k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max s \<le> k
[PROOF STEP]
using P2 calculation
[PROOF STATE]
proof (prove)
using this:
\<forall>x. x \<in> s \<longrightarrow> x \<le> k
finite s
Max s \<in> s

goal (1 subgoal):
 1. Max s \<le> k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Max s \<le> k

goal (1 subgoal):
 1. \<And>s k. s \<noteq> {} \<and> (\<forall>x. x \<in> s \<longrightarrow> x \<le> k) \<Longrightarrow> Sup s \<le> k
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>s \<noteq> {}; \<forall>x. x \<in> s \<longrightarrow> x \<le> k\<rbrakk> \<Longrightarrow> Max s \<le> k

goal (1 subgoal):
 1. \<And>s k. s \<noteq> {} \<and> (\<forall>x. x \<in> s \<longrightarrow> x \<le> k) \<Longrightarrow> Sup s \<le> k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>s \<noteq> {}; \<forall>x. x \<in> s \<longrightarrow> x \<le> k\<rbrakk> \<Longrightarrow> Max s \<le> k
[PROOF STEP]
show "(s \<noteq> {}) \<and> (\<forall>x. x \<in> s \<longrightarrow> x \<le> k) \<Longrightarrow> Sup s \<le> k"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>s \<noteq> {}; \<forall>x. x \<in> s \<longrightarrow> x \<le> k\<rbrakk> \<Longrightarrow> Max s \<le> k

goal (1 subgoal):
 1. s \<noteq> {} \<and> (\<forall>x. x \<in> s \<longrightarrow> x \<le> k) \<Longrightarrow> Sup s \<le> k
[PROOF STEP]
by (simp add: Sup_nat_def)
[PROOF STATE]
proof (state)
this:
s \<noteq> {} \<and> (\<forall>x. x \<in> s \<longrightarrow> x \<le> k) \<Longrightarrow> Sup s \<le> k

goal:
No subgoals!
[PROOF STEP]
qed

\<comment> \<open>NOTE type of 'k' fixed to nat to be able to use 'bound\_child\_parent\_neq\_mems\_state\_set\_neq\_len'.\<close>


[STATEMENT]
lemma sum_Un_eq_sum_sum:
  assumes "bp P"
  shows "(\<Sum>u \<in> U. w u) = (\<Sum>B \<in> P. W B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. W U = sum W P
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. W U = sum W P
[PROOF STEP]
have FINITE: "\<forall>B \<in> P. finite B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>B\<in>P. finite B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bp P

goal (1 subgoal):
 1. \<forall>B\<in>P. finite B
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>B\<in>P. finite B

goal (1 subgoal):
 1. W U = sum W P
[PROOF STEP]
have DISJNT: "\<forall>A \<in> P. \<forall>B \<in> P. A \<noteq> B \<longrightarrow> A \<inter> B = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>A\<in>P. \<forall>B\<in>P. A \<noteq> B \<longrightarrow> A \<inter> B = {}
[PROOF STEP]
using bpE(1)[OF assms]
[PROOF STATE]
proof (prove)
using this:
disjoint P

goal (1 subgoal):
 1. \<forall>A\<in>P. \<forall>B\<in>P. A \<noteq> B \<longrightarrow> A \<inter> B = {}
[PROOF STEP]
unfolding pairwise_def disjnt_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>P. \<forall>y\<in>P. x \<noteq> y \<longrightarrow> x \<inter> y = {}

goal (1 subgoal):
 1. \<forall>A\<in>P. \<forall>B\<in>P. A \<noteq> B \<longrightarrow> A \<inter> B = {}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<forall>A\<in>P. \<forall>B\<in>P. A \<noteq> B \<longrightarrow> A \<inter> B = {}

goal (1 subgoal):
 1. W U = sum W P
[PROOF STEP]
have "(\<Sum>u \<in> (\<Union>P). w u) = (\<Sum>B \<in> P. W B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. W (\<Union> P) = sum W P
[PROOF STEP]
using sum.Union_disjoint[OF FINITE DISJNT]
[PROOF STATE]
proof (prove)
using this:
sum ?g (\<Union> P) = (sum \<circ> sum) ?g P

goal (1 subgoal):
 1. W (\<Union> P) = sum W P
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
W (\<Union> P) = sum W P

goal (1 subgoal):
 1. W U = sum W P
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
W (\<Union> P) = sum W P
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
W (\<Union> P) = sum W P

goal (1 subgoal):
 1. W U = sum W P
[PROOF STEP]
unfolding bpE(3)[OF assms]
[PROOF STATE]
proof (prove)
using this:
W U = sum W P

goal (1 subgoal):
 1. W U = sum W P
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
W U = sum W P

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vwalk_join_vwalk_length[simp]:
  assumes "joinable p q"
  shows "vwalk_length (p \<oplus> q) = vwalk_length p + vwalk_length q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vwalk_length (p \<oplus> q) = vwalk_length p + vwalk_length q
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
joinable p q

goal (1 subgoal):
 1. vwalk_length (p \<oplus> q) = vwalk_length p + vwalk_length q
[PROOF STEP]
unfolding vwalk_join_def
[PROOF STATE]
proof (prove)
using this:
joinable p q

goal (1 subgoal):
 1. vwalk_length (p @ tl q) = vwalk_length p + vwalk_length q
[PROOF STEP]
by (simp add: less_eq_Suc_le[symmetric] joinable_non_Nil)


[STATEMENT]
lemma mod_eq_imp_eq:
    "\<lbrakk>b \<le> x; x < b + N; b \<le> y; y < b + N; x mod N = y mod N \<rbrakk> \<Longrightarrow> x=y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>b \<le> x; x < b + N; b \<le> y; y < b + N; x mod N = y mod N\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>b \<le> x; x < b + N; b \<le> y; y < b + N; x mod N = y mod N\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume a1: "b \<le> y"
[PROOF STATE]
proof (state)
this:
b \<le> y

goal (1 subgoal):
 1. \<lbrakk>b \<le> x; x < b + N; b \<le> y; y < b + N; x mod N = y mod N\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume a2: "y < b + N"
[PROOF STATE]
proof (state)
this:
y < b + N

goal (1 subgoal):
 1. \<lbrakk>b \<le> x; x < b + N; b \<le> y; y < b + N; x mod N = y mod N\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume a3: "b \<le> x"
[PROOF STATE]
proof (state)
this:
b \<le> x

goal (1 subgoal):
 1. \<lbrakk>b \<le> x; x < b + N; b \<le> y; y < b + N; x mod N = y mod N\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume a4: "x < b + N"
[PROOF STATE]
proof (state)
this:
x < b + N

goal (1 subgoal):
 1. \<lbrakk>b \<le> x; x < b + N; b \<le> y; y < b + N; x mod N = y mod N\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume a5: "x mod N = y mod N"
[PROOF STATE]
proof (state)
this:
x mod N = y mod N

goal (1 subgoal):
 1. \<lbrakk>b \<le> x; x < b + N; b \<le> y; y < b + N; x mod N = y mod N\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have f6: "x < y + N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < y + N
[PROOF STEP]
using a4 a1
[PROOF STATE]
proof (prove)
using this:
x < b + N
b \<le> y

goal (1 subgoal):
 1. x < y + N
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
x < y + N

goal (1 subgoal):
 1. \<lbrakk>b \<le> x; x < b + N; b \<le> y; y < b + N; x mod N = y mod N\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have "y < x + N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y < x + N
[PROOF STEP]
using a3 a2
[PROOF STATE]
proof (prove)
using this:
b \<le> x
y < b + N

goal (1 subgoal):
 1. y < x + N
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
y < x + N

goal (1 subgoal):
 1. \<lbrakk>b \<le> x; x < b + N; b \<le> y; y < b + N; x mod N = y mod N\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y < x + N
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
y < x + N

goal (1 subgoal):
 1. x = y
[PROOF STEP]
using f6 a5
[PROOF STATE]
proof (prove)
using this:
y < x + N
x < y + N
x mod N = y mod N

goal (1 subgoal):
 1. x = y
[PROOF STEP]
by (metis (no_types) mod_eq_imp_eq_aux nat_le_linear)
[PROOF STATE]
proof (state)
this:
x = y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in semiring_0) poly_add: "poly (p1 +++ p2) x = poly p1 x + poly p2 x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (p1 +++ p2) x = poly p1 x + poly p2 x
[PROOF STEP]
proof (induct p1 arbitrary: p2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>p2. poly ([] +++ p2) x = poly [] x + poly p2 x
 2. \<And>a p1 p2. (\<And>p2. poly (p1 +++ p2) x = poly p1 x + poly p2 x) \<Longrightarrow> poly (a # p1 +++ p2) x = poly (a # p1) x + poly p2 x
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>p2. poly ([] +++ p2) x = poly [] x + poly p2 x
 2. \<And>a p1 p2. (\<And>p2. poly (p1 +++ p2) x = poly p1 x + poly p2 x) \<Longrightarrow> poly (a # p1 +++ p2) x = poly (a # p1) x + poly p2 x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly ([] +++ p2) x = poly [] x + poly p2 x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly ([] +++ p2) x = poly [] x + poly p2 x

goal (1 subgoal):
 1. \<And>a p1 p2. (\<And>p2. poly (p1 +++ p2) x = poly p1 x + poly p2 x) \<Longrightarrow> poly (a # p1 +++ p2) x = poly (a # p1) x + poly p2 x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a p1 p2. (\<And>p2. poly (p1 +++ p2) x = poly p1 x + poly p2 x) \<Longrightarrow> poly (a # p1 +++ p2) x = poly (a # p1) x + poly p2 x
[PROOF STEP]
case (Cons a as p2)
[PROOF STATE]
proof (state)
this:
poly (as +++ ?p2.1) x = poly as x + poly ?p2.1 x

goal (1 subgoal):
 1. \<And>a p1 p2. (\<And>p2. poly (p1 +++ p2) x = poly p1 x + poly p2 x) \<Longrightarrow> poly (a # p1 +++ p2) x = poly (a # p1) x + poly p2 x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
poly (as +++ ?p2.1) x = poly as x + poly ?p2.1 x
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
poly (as +++ ?p2.1) x = poly as x + poly ?p2.1 x

goal (1 subgoal):
 1. poly (a # as +++ p2) x = poly (a # as) x + poly p2 x
[PROOF STEP]
by (cases p2) (simp_all add: ac_simps distrib_left)
[PROOF STATE]
proof (state)
this:
poly (a # as +++ p2) x = poly (a # as) x + poly p2 x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem "(\<exists>m::nat. n = 2 * m) \<longrightarrow> (n + 1) div 2 = n div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>m. n = 2 * m) \<longrightarrow> (n + 1) div 2 = n div 2
[PROOF STEP]
by cooper


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


[STATEMENT]
lemma length_subseqs: "length (subseqs xs) = 2 ^ length xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (subseqs xs) = 2 ^ length xs
[PROOF STEP]
by (induct xs) (simp_all add: Let_def)