[STATEMENT]
lemma proj_psi_le_one:
  "(proj_psi) \<le>\<^sub>L 1\<^sub>m N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj_psi \<le>\<^sub>L 1\<^sub>m N
[PROOF STEP]
unfolding proj_psi_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outer_prod \<psi> \<psi> \<le>\<^sub>L 1\<^sub>m N
[PROOF STEP]
using outer_prod_le_one norm_psi \<psi>_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; inner_prod ?v ?v \<le> 1\<rbrakk> \<Longrightarrow> outer_prod ?v ?v \<le>\<^sub>L 1\<^sub>m ?n
inner_prod \<psi> \<psi> = 1
\<psi> = Matrix.vec N (\<lambda>x. complex_of_real (1 / sqrt (real N)))

goal (1 subgoal):
 1. outer_prod \<psi> \<psi> \<le>\<^sub>L 1\<^sub>m N
[PROOF STEP]
by auto


[STATEMENT]
lemma measure_of_of_measure: "measure_of (space M) (sets M) (emeasure M) = M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_of (space M) (sets M) (emeasure M) = M
[PROOF STEP]
proof (intro measure_eqI emeasure_measure_of_sigma)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. sets (measure_of (space M) (sets M) (emeasure M)) = sets M
 2. \<And>A. A \<in> sets (measure_of (space M) (sets M) (emeasure M)) \<Longrightarrow> sigma_algebra (space M) (sets M)
 3. \<And>A. A \<in> sets (measure_of (space M) (sets M) (emeasure M)) \<Longrightarrow> positive (sets M) (emeasure M)
 4. \<And>A. A \<in> sets (measure_of (space M) (sets M) (emeasure M)) \<Longrightarrow> countably_additive (sets M) (emeasure M)
 5. \<And>A. A \<in> sets (measure_of (space M) (sets M) (emeasure M)) \<Longrightarrow> A \<in> sets M
[PROOF STEP]
show "sigma_algebra (space M) (sets M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_algebra (space M) (sets M)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
sigma_algebra (space M) (sets M)

goal (4 subgoals):
 1. sets (measure_of (space M) (sets M) (emeasure M)) = sets M
 2. \<And>A. A \<in> sets (measure_of (space M) (sets M) (emeasure M)) \<Longrightarrow> positive (sets M) (emeasure M)
 3. \<And>A. A \<in> sets (measure_of (space M) (sets M) (emeasure M)) \<Longrightarrow> countably_additive (sets M) (emeasure M)
 4. \<And>A. A \<in> sets (measure_of (space M) (sets M) (emeasure M)) \<Longrightarrow> A \<in> sets M
[PROOF STEP]
show "positive (sets M) (emeasure M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. positive (sets M) (emeasure M)
[PROOF STEP]
by (simp add: positive_def)
[PROOF STATE]
proof (state)
this:
positive (sets M) (emeasure M)

goal (3 subgoals):
 1. sets (measure_of (space M) (sets M) (emeasure M)) = sets M
 2. \<And>A. A \<in> sets (measure_of (space M) (sets M) (emeasure M)) \<Longrightarrow> countably_additive (sets M) (emeasure M)
 3. \<And>A. A \<in> sets (measure_of (space M) (sets M) (emeasure M)) \<Longrightarrow> A \<in> sets M
[PROOF STEP]
show "countably_additive (sets M) (emeasure M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countably_additive (sets M) (emeasure M)
[PROOF STEP]
by (simp add: emeasure_countably_additive)
[PROOF STATE]
proof (state)
this:
countably_additive (sets M) (emeasure M)

goal (2 subgoals):
 1. sets (measure_of (space M) (sets M) (emeasure M)) = sets M
 2. \<And>A. A \<in> sets (measure_of (space M) (sets M) (emeasure M)) \<Longrightarrow> A \<in> sets M
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma higher_differentiable_on_divide:
  "higher_differentiable_on S (\<lambda>x. f x / g x) n"
  if
    "higher_differentiable_on S f n"
    "higher_differentiable_on S g n"
    "\<And>x. x \<in> S \<Longrightarrow> g x \<noteq> 0"
    "open S"
  for f::"_\<Rightarrow>_::real_normed_field"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. higher_differentiable_on S (\<lambda>x. f x / g x) n
[PROOF STEP]
using higher_differentiable_on_mult[OF _ higher_differentiable_on_inverse, OF that(1,2) _ that(4,4)]
    that(3)
[PROOF STATE]
proof (prove)
using this:
(0::'d) \<notin> g ` S \<Longrightarrow> higher_differentiable_on S (\<lambda>x. f x * inverse (g x)) n
?x \<in> S \<Longrightarrow> g ?x \<noteq> (0::'d)

goal (1 subgoal):
 1. higher_differentiable_on S (\<lambda>x. f x / g x) n
[PROOF STEP]
by (auto simp: divide_inverse image_iff)


[STATEMENT]
lemma fps_inv_fps_exp_compose:
  assumes a: "a \<noteq> 0"
  shows "fps_inv (fps_exp a - 1) oo (fps_exp a - 1) = fps_X"
    and "(fps_exp a - 1) oo fps_inv (fps_exp a - 1) = fps_X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_inv (fps_exp a - 1) oo fps_exp a - 1 = fps_X &&& fps_exp a - 1 oo fps_inv (fps_exp a - 1) = fps_X
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. fps_inv (fps_exp a - 1) oo fps_exp a - 1 = fps_X
 2. fps_exp a - 1 oo fps_inv (fps_exp a - 1) = fps_X
[PROOF STEP]
let ?b = "fps_exp a - 1"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. fps_inv (fps_exp a - 1) oo fps_exp a - 1 = fps_X
 2. fps_exp a - 1 oo fps_inv (fps_exp a - 1) = fps_X
[PROOF STEP]
have b0: "?b $ 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fps_exp a - 1) $ 0 = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(fps_exp a - 1) $ 0 = (0::'a)

goal (2 subgoals):
 1. fps_inv (fps_exp a - 1) oo fps_exp a - 1 = fps_X
 2. fps_exp a - 1 oo fps_inv (fps_exp a - 1) = fps_X
[PROOF STEP]
have b1: "?b $ 1 \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fps_exp a - 1) $ 1 \<noteq> (0::'a)
[PROOF STEP]
by (simp add: a)
[PROOF STATE]
proof (state)
this:
(fps_exp a - 1) $ 1 \<noteq> (0::'a)

goal (2 subgoals):
 1. fps_inv (fps_exp a - 1) oo fps_exp a - 1 = fps_X
 2. fps_exp a - 1 oo fps_inv (fps_exp a - 1) = fps_X
[PROOF STEP]
from fps_inv[OF b0 b1]
[PROOF STATE]
proof (chain)
picking this:
fps_inv (fps_exp a - 1) oo fps_exp a - 1 = fps_X
[PROOF STEP]
show "fps_inv (fps_exp a - 1) oo (fps_exp a - 1) = fps_X"
[PROOF STATE]
proof (prove)
using this:
fps_inv (fps_exp a - 1) oo fps_exp a - 1 = fps_X

goal (1 subgoal):
 1. fps_inv (fps_exp a - 1) oo fps_exp a - 1 = fps_X
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
fps_inv (fps_exp a - 1) oo fps_exp a - 1 = fps_X

goal (1 subgoal):
 1. fps_exp a - 1 oo fps_inv (fps_exp a - 1) = fps_X
[PROOF STEP]
from fps_inv_right[OF b0 b1]
[PROOF STATE]
proof (chain)
picking this:
fps_exp a - 1 oo fps_inv (fps_exp a - 1) = fps_X
[PROOF STEP]
show "(fps_exp a - 1) oo fps_inv (fps_exp a - 1) = fps_X"
[PROOF STATE]
proof (prove)
using this:
fps_exp a - 1 oo fps_inv (fps_exp a - 1) = fps_X

goal (1 subgoal):
 1. fps_exp a - 1 oo fps_inv (fps_exp a - 1) = fps_X
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
fps_exp a - 1 oo fps_inv (fps_exp a - 1) = fps_X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rref_condition4:
  assumes r: "reduced_row_echelon_form A"
  shows " (\<forall>i. \<not> (is_zero_row i A) \<longrightarrow> (\<forall>j. i \<noteq> j \<longrightarrow> A $ j $ (LEAST n. A $ i $ n \<noteq> 0) = 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. \<not> is_zero_row i A \<longrightarrow> (\<forall>j. i \<noteq> j \<longrightarrow> A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a))
[PROOF STEP]
using r
[PROOF STATE]
proof (prove)
using this:
reduced_row_echelon_form A

goal (1 subgoal):
 1. \<forall>i. \<not> is_zero_row i A \<longrightarrow> (\<forall>j. i \<noteq> j \<longrightarrow> A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a))
[PROOF STEP]
unfolding reduced_row_echelon_form_def'
[PROOF STATE]
proof (prove)
using this:
(\<forall>i. is_zero_row i A \<longrightarrow> \<not> (\<exists>j>i. \<not> is_zero_row j A)) \<and> (\<forall>i. \<not> is_zero_row i A \<longrightarrow> A $ i $ (LEAST k. A $ i $ k \<noteq> (0::'a)) = (1::'a)) \<and> (\<forall>i. i < i + (1::'c) \<and> \<not> is_zero_row i A \<and> \<not> is_zero_row (i + (1::'c)) A \<longrightarrow> (LEAST k. A $ i $ k \<noteq> (0::'a)) < (LEAST k. A $ (i + (1::'c)) $ k \<noteq> (0::'a))) \<and> (\<forall>i. \<not> is_zero_row i A \<longrightarrow> (\<forall>j. i \<noteq> j \<longrightarrow> A $ j $ (LEAST k. A $ i $ k \<noteq> (0::'a)) = (0::'a)))

goal (1 subgoal):
 1. \<forall>i. \<not> is_zero_row i A \<longrightarrow> (\<forall>j. i \<noteq> j \<longrightarrow> A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a))
[PROOF STEP]
by simp


[STATEMENT]
lemma real_is_int_n1: "real_is_int (-1::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_is_int (- 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real_is_int (- 1)
[PROOF STEP]
have "real_is_int (-1::real) = real_is_int(real_of_int (-1::int))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_is_int (- 1) = real_is_int (real_of_int (- 1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real_is_int (- 1) = real_is_int (real_of_int (- 1))

goal (1 subgoal):
 1. real_is_int (- 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_is_int (- 1) = real_is_int (real_of_int (- 1))

goal (1 subgoal):
 1. real_is_int (- 1)
[PROOF STEP]
have "\<dots> = True"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_is_int (real_of_int (- 1)) = True
[PROOF STEP]
by (simp only: real_is_int_real)
[PROOF STATE]
proof (state)
this:
real_is_int (real_of_int (- 1)) = True

goal (1 subgoal):
 1. real_is_int (- 1)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
real_is_int (- 1) = real_is_int (real_of_int (- 1))
real_is_int (real_of_int (- 1)) = True
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real_is_int (- 1) = real_is_int (real_of_int (- 1))
real_is_int (real_of_int (- 1)) = True

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma moebius_translation_inv_translation [simp]:
  shows "moebius_pt (moebius_translation v) (moebius_pt (moebius_translation (-v)) z) = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_pt (moebius_translation v) (moebius_pt (moebius_translation (- v)) z) = z
[PROOF STEP]
using moebius_translation_inv[symmetric, of v]
[PROOF STATE]
proof (prove)
using this:
moebius_translation (- v) = moebius_inv (moebius_translation v)

goal (1 subgoal):
 1. moebius_pt (moebius_translation v) (moebius_pt (moebius_translation (- v)) z) = z
[PROOF STEP]
by (simp del: moebius_translation_inv)


[STATEMENT]
lemma pmf_of_set_lottery:
  "A \<noteq> {} \<Longrightarrow> finite A \<Longrightarrow> A \<subseteq> B \<Longrightarrow> pmf_of_set A \<in> lotteries_on B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; finite A; A \<subseteq> B\<rbrakk> \<Longrightarrow> pmf_of_set A \<in> lotteries_on B
[PROOF STEP]
unfolding lotteries_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; finite A; A \<subseteq> B\<rbrakk> \<Longrightarrow> pmf_of_set A \<in> {p. set_pmf p \<subseteq> B}
[PROOF STEP]
by auto


[STATEMENT]
lemma ln_upper_13_pos:
  assumes "1 \<le> x" shows "ln(x) \<le> ln_upper_13 x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln x \<le> ln_upper_13 x
[PROOF STEP]
apply (rule gen_upper_bound_increasing [OF assms d_delta_ln_upper_13])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>y. \<lbrakk>1 \<le> y; y \<le> x\<rbrakk> \<Longrightarrow> 0 < y
 2. \<And>y. \<lbrakk>1 \<le> y; y \<le> x\<rbrakk> \<Longrightarrow> 0 \<le> diff_delta_ln_upper_13 y
 3. ln_upper_13 1 = ln 1
[PROOF STEP]
apply (auto simp: diff_delta_ln_upper_13_def ln_upper_13_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma continuous_map_nsphere_reflection:
  "continuous_map (nsphere n) (nsphere n) (\<lambda>x i. if i = k then -x i else x i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map (nsphere n) (nsphere n) (\<lambda>x i. if i = k then - x i else x i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. continuous_map (nsphere n) (nsphere n) (\<lambda>x i. if i = k then - x i else x i)
[PROOF STEP]
have cm: "continuous_map (powertop_real UNIV) euclideanreal (\<lambda>x. if j = k then - x j else x j)" for j
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map (powertop_real UNIV) euclideanreal (\<lambda>x. if j = k then - x j else x j)
[PROOF STEP]
proof (cases "j=k")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. j = k \<Longrightarrow> continuous_map (powertop_real UNIV) euclideanreal (\<lambda>x. if j = k then - x j else x j)
 2. j \<noteq> k \<Longrightarrow> continuous_map (powertop_real UNIV) euclideanreal (\<lambda>x. if j = k then - x j else x j)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
j = k

goal (2 subgoals):
 1. j = k \<Longrightarrow> continuous_map (powertop_real UNIV) euclideanreal (\<lambda>x. if j = k then - x j else x j)
 2. j \<noteq> k \<Longrightarrow> continuous_map (powertop_real UNIV) euclideanreal (\<lambda>x. if j = k then - x j else x j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j = k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
j = k

goal (1 subgoal):
 1. continuous_map (powertop_real UNIV) euclideanreal (\<lambda>x. if j = k then - x j else x j)
[PROOF STEP]
by simp (metis UNIV_I continuous_map_product_projection)
[PROOF STATE]
proof (state)
this:
continuous_map (powertop_real UNIV) euclideanreal (\<lambda>x. if j = k then - x j else x j)

goal (1 subgoal):
 1. j \<noteq> k \<Longrightarrow> continuous_map (powertop_real UNIV) euclideanreal (\<lambda>x. if j = k then - x j else x j)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. j \<noteq> k \<Longrightarrow> continuous_map (powertop_real UNIV) euclideanreal (\<lambda>x. if j = k then - x j else x j)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
j \<noteq> k

goal (1 subgoal):
 1. j \<noteq> k \<Longrightarrow> continuous_map (powertop_real UNIV) euclideanreal (\<lambda>x. if j = k then - x j else x j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j \<noteq> k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
j \<noteq> k

goal (1 subgoal):
 1. continuous_map (powertop_real UNIV) euclideanreal (\<lambda>x. if j = k then - x j else x j)
[PROOF STEP]
by (auto intro: continuous_map_product_projection)
[PROOF STATE]
proof (state)
this:
continuous_map (powertop_real UNIV) euclideanreal (\<lambda>x. if j = k then - x j else x j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
continuous_map (powertop_real UNIV) euclideanreal (\<lambda>x. if ?j = k then - x ?j else x ?j)

goal (1 subgoal):
 1. continuous_map (nsphere n) (nsphere n) (\<lambda>x i. if i = k then - x i else x i)
[PROOF STEP]
have eq: "(if i = k then x k * x k else x i * x i) = x i * x i" for i and x :: "nat \<Rightarrow> real"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if i = k then x k * x k else x i * x i) = x i * x i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(if ?i = k then ?x k * ?x k else ?x ?i * ?x ?i) = ?x ?i * ?x ?i

goal (1 subgoal):
 1. continuous_map (nsphere n) (nsphere n) (\<lambda>x i. if i = k then - x i else x i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map (nsphere n) (nsphere n) (\<lambda>x i. if i = k then - x i else x i)
[PROOF STEP]
apply (simp add: nsphere continuous_map_in_subtopology continuous_map_componentwise_UNIV
                     continuous_map_from_subtopology cm)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>ka. (ka = k \<longrightarrow> continuous_map (subtopology (powertop_real UNIV) {x. (\<Sum>i\<le>n. (x i)\<^sup>2) = 1 \<and> (\<forall>i>n. x i = 0)}) euclideanreal (\<lambda>x. x k)) \<and> (ka \<noteq> k \<longrightarrow> continuous_map (subtopology (powertop_real UNIV) {x. (\<Sum>i\<le>n. (x i)\<^sup>2) = 1 \<and> (\<forall>i>n. x i = 0)}) euclideanreal (\<lambda>x. x ka))) \<and> (\<lambda>x i. if i = k then - x i else x i) ` {x. (\<Sum>i\<le>n. (x i)\<^sup>2) = 1 \<and> (\<forall>i>n. x i = 0)} \<subseteq> {x. (\<Sum>i\<le>n. (x i)\<^sup>2) = 1 \<and> (\<forall>i>n. x i = 0)}
[PROOF STEP]
apply (intro conjI allI impI continuous_intros continuous_map_from_subtopology continuous_map_product_projection)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>ka. ka = k \<Longrightarrow> k \<in> UNIV
 2. \<And>ka. ka \<noteq> k \<Longrightarrow> ka \<in> UNIV
 3. (\<lambda>x i. if i = k then - x i else x i) ` {x. (\<Sum>i\<le>n. (x i)\<^sup>2) = 1 \<and> (\<forall>i>n. x i = 0)} \<subseteq> {x. (\<Sum>i\<le>n. (x i)\<^sup>2) = 1 \<and> (\<forall>i>n. x i = 0)}
[PROOF STEP]
apply (auto simp: power2_eq_square if_distrib [where f = "\<lambda>x. x * _"] eq cong: if_cong)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
continuous_map (nsphere n) (nsphere n) (\<lambda>x i. if i = k then - x i else x i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma orthonormal_basis_expand:
  assumes B: "pairwise orthogonal B"
      and 1: "\<And>i. i \<in> B \<Longrightarrow> norm i = 1"
      and "x \<in> span B"
      and "finite B"
    shows "(\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = x
[PROOF STEP]
proof (rule vector_eq_dot_span [OF _ \<open>x \<in> span B\<close>])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) \<in> span B
 2. \<And>i. i \<in> B \<Longrightarrow> i \<bullet> (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = i \<bullet> x
[PROOF STEP]
show "(\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) \<in> span B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) \<in> span B
[PROOF STEP]
by (simp add: span_clauses span_sum)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) \<in> span B

goal (1 subgoal):
 1. \<And>i. i \<in> B \<Longrightarrow> i \<bullet> (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = i \<bullet> x
[PROOF STEP]
show "i \<bullet> (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = i \<bullet> x" if "i \<in> B" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<bullet> (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = i \<bullet> x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i \<bullet> (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = i \<bullet> x
[PROOF STEP]
have [simp]: "i \<bullet> j = (if j = i then 1 else 0)" if "j \<in> B" for j
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<bullet> j = (if j = i then 1 else 0)
[PROOF STEP]
using B 1 that \<open>i \<in> B\<close>
[PROOF STATE]
proof (prove)
using this:
pairwise orthogonal B
?i \<in> B \<Longrightarrow> norm ?i = 1
j \<in> B
i \<in> B

goal (1 subgoal):
 1. i \<bullet> j = (if j = i then 1 else 0)
[PROOF STEP]
by (force simp: norm_eq_1 orthogonal_def pairwise_def)
[PROOF STATE]
proof (state)
this:
?j \<in> B \<Longrightarrow> i \<bullet> ?j = (if ?j = i then 1 else 0)

goal (1 subgoal):
 1. i \<bullet> (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = i \<bullet> x
[PROOF STEP]
have "i \<bullet> (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = (\<Sum>j\<in>B. x \<bullet> j * (i \<bullet> j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<bullet> (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = (\<Sum>j\<in>B. x \<bullet> j * (i \<bullet> j))
[PROOF STEP]
by (simp add: inner_sum_right)
[PROOF STATE]
proof (state)
this:
i \<bullet> (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = (\<Sum>j\<in>B. x \<bullet> j * (i \<bullet> j))

goal (1 subgoal):
 1. i \<bullet> (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = i \<bullet> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
i \<bullet> (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = (\<Sum>j\<in>B. x \<bullet> j * (i \<bullet> j))

goal (1 subgoal):
 1. i \<bullet> (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = i \<bullet> x
[PROOF STEP]
have "... = (\<Sum>j\<in>B. if j = i then x \<bullet> i else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<in>B. x \<bullet> j * (i \<bullet> j)) = (\<Sum>j\<in>B. if j = i then x \<bullet> i else 0)
[PROOF STEP]
by (rule sum.cong; simp)
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>B. x \<bullet> j * (i \<bullet> j)) = (\<Sum>j\<in>B. if j = i then x \<bullet> i else 0)

goal (1 subgoal):
 1. i \<bullet> (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = i \<bullet> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>B. x \<bullet> j * (i \<bullet> j)) = (\<Sum>j\<in>B. if j = i then x \<bullet> i else 0)

goal (1 subgoal):
 1. i \<bullet> (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = i \<bullet> x
[PROOF STEP]
have "... = i \<bullet> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<in>B. if j = i then x \<bullet> i else 0) = i \<bullet> x
[PROOF STEP]
by (simp add: \<open>finite B\<close> that inner_commute)
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>B. if j = i then x \<bullet> i else 0) = i \<bullet> x

goal (1 subgoal):
 1. i \<bullet> (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = i \<bullet> x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
i \<bullet> (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = i \<bullet> x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
i \<bullet> (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = i \<bullet> x

goal (1 subgoal):
 1. i \<bullet> (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = i \<bullet> x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
i \<bullet> (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = i \<bullet> x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?i \<in> B \<Longrightarrow> ?i \<bullet> (\<Sum>i\<in>B. (x \<bullet> i) *\<^sub>R i) = ?i \<bullet> x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hom_diff [simp]: "hom f (x - y) = hom f x - hom f y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom f (x - y) = hom f x - hom f y
[PROOF STEP]
unfolding diff_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom f (x \<sqinter> - y) = hom f x \<sqinter> - hom f y
[PROOF STEP]
by (simp only: hom_compl hom_inf)


[STATEMENT]
lemma map2_val_compat'D1:
  assumes "map2_val_compat' f" and "oalist_inv zs"
  shows "oalist_inv (f zs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. oalist_inv (f zs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
map2_val_compat' f
oalist_inv zs

goal (1 subgoal):
 1. oalist_inv (f zs)
[PROOF STEP]
unfolding map2_val_compat'_def
[PROOF STATE]
proof (prove)
using this:
\<forall>zs. oalist_inv zs \<longrightarrow> oalist_inv (f zs) \<and> snd (f zs) = snd zs \<and> fst ` set (fst (f zs)) \<subseteq> fst ` set (fst zs)
oalist_inv zs

goal (1 subgoal):
 1. oalist_inv (f zs)
[PROOF STEP]
by blast


[STATEMENT]
lemma to_fract_quot_of_fract:
  assumes "snd (quot_of_fract x) = 1"
  shows   "to_fract (fst (quot_of_fract x)) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_fract (fst (quot_of_fract x)) = x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. to_fract (fst (quot_of_fract x)) = x
[PROOF STEP]
have "x = Fract (fst (quot_of_fract x)) (snd (quot_of_fract x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = Fraction_Field.Fract (fst (quot_of_fract x)) (snd (quot_of_fract x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x = Fraction_Field.Fract (fst (quot_of_fract x)) (snd (quot_of_fract x))

goal (1 subgoal):
 1. to_fract (fst (quot_of_fract x)) = x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x = Fraction_Field.Fract (fst (quot_of_fract x)) (snd (quot_of_fract x))

goal (1 subgoal):
 1. to_fract (fst (quot_of_fract x)) = x
[PROOF STEP]
note assms
[PROOF STATE]
proof (state)
this:
snd (quot_of_fract x) = (1::'a)

goal (1 subgoal):
 1. to_fract (fst (quot_of_fract x)) = x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x = Fraction_Field.Fract (fst (quot_of_fract x)) (1::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = Fraction_Field.Fract (fst (quot_of_fract x)) (1::'a)

goal (1 subgoal):
 1. to_fract (fst (quot_of_fract x)) = x
[PROOF STEP]
by (simp add: to_fract_def)
[PROOF STATE]
proof (state)
this:
to_fract (fst (quot_of_fract x)) = x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem periodic_arithmetic_remove_homothecy:
  assumes "coprime a k" "periodic_arithmetic f k" "k > 0"
  shows "(\<Sum>l=1..k. f l) = (\<Sum>l=1..k. f (l*a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {1..k} = (\<Sum>l = 1..k. f (l * a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum f {1..k} = (\<Sum>l = 1..k. f (l * a))
[PROOF STEP]
obtain i where inv: "[a*i = 1] (mod k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. [a * i = 1] (mod k) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(1) coprime_iff_invertible_nat[of a k]
[PROOF STATE]
proof (prove)
using this:
coprime a k
coprime a k = (\<exists>x. [a * x = Suc 0] (mod k))

goal (1 subgoal):
 1. (\<And>i. [a * i = 1] (mod k) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[a * i = 1] (mod k)

goal (1 subgoal):
 1. sum f {1..k} = (\<Sum>l = 1..k. f (l * a))
[PROOF STEP]
from this self_bij_0_k assms
[PROOF STATE]
proof (chain)
picking this:
[a * i = 1] (mod k)
\<lbrakk>coprime ?a ?k; [?a * ?i = 1] (mod ?k); 0 < ?k\<rbrakk> \<Longrightarrow> bij_betw (\<lambda>r. r * ?a mod ?k) {0..?k - 1} {0..?k - 1}
coprime a k
periodic_arithmetic f k
0 < k
[PROOF STEP]
have bij: "bij_betw (\<lambda>r. r * a mod k) {0..k - 1} {0..k - 1}"
[PROOF STATE]
proof (prove)
using this:
[a * i = 1] (mod k)
\<lbrakk>coprime ?a ?k; [?a * ?i = 1] (mod ?k); 0 < ?k\<rbrakk> \<Longrightarrow> bij_betw (\<lambda>r. r * ?a mod ?k) {0..?k - 1} {0..?k - 1}
coprime a k
periodic_arithmetic f k
0 < k

goal (1 subgoal):
 1. bij_betw (\<lambda>r. r * a mod k) {0..k - 1} {0..k - 1}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
bij_betw (\<lambda>r. r * a mod k) {0..k - 1} {0..k - 1}

goal (1 subgoal):
 1. sum f {1..k} = (\<Sum>l = 1..k. f (l * a))
[PROOF STEP]
have "(\<Sum>l = 1..k. f(l)) = (\<Sum>l = 0..k-1. f(l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {1..k} = sum f {0..k - 1}
[PROOF STEP]
using periodic_arithmetic_sum_periodic_arithmetic_shift[of f k 1] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>periodic_arithmetic f k; 0 < k; 0 < 1\<rbrakk> \<Longrightarrow> sum f {0..k - 1} = sum f {1..1 + k - 1}
coprime a k
periodic_arithmetic f k
0 < k

goal (1 subgoal):
 1. sum f {1..k} = sum f {0..k - 1}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f {1..k} = sum f {0..k - 1}

goal (1 subgoal):
 1. sum f {1..k} = (\<Sum>l = 1..k. f (l * a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum f {1..k} = sum f {0..k - 1}

goal (1 subgoal):
 1. sum f {1..k} = (\<Sum>l = 1..k. f (l * a))
[PROOF STEP]
have "\<dots> = (\<Sum>l = 0..k-1. f(l*a mod k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {0..k - 1} = (\<Sum>l = 0..k - 1. f (l * a mod k))
[PROOF STEP]
using sum.reindex_bij_betw[OF bij,symmetric]
[PROOF STATE]
proof (prove)
using this:
sum ?g {0..k - 1} = (\<Sum>x = 0..k - 1. ?g (x * a mod k))

goal (1 subgoal):
 1. sum f {0..k - 1} = (\<Sum>l = 0..k - 1. f (l * a mod k))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
sum f {0..k - 1} = (\<Sum>l = 0..k - 1. f (l * a mod k))

goal (1 subgoal):
 1. sum f {1..k} = (\<Sum>l = 1..k. f (l * a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum f {0..k - 1} = (\<Sum>l = 0..k - 1. f (l * a mod k))

goal (1 subgoal):
 1. sum f {1..k} = (\<Sum>l = 1..k. f (l * a))
[PROOF STEP]
have "\<dots> = (\<Sum>l = 0..k-1. f(l*a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>l = 0..k - 1. f (l * a mod k)) = (\<Sum>l = 0..k - 1. f (l * a))
[PROOF STEP]
by (intro sum.cong refl) (use mod_periodic_arithmetic[OF assms(2)] mod_mod_trivial in blast)
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..k - 1. f (l * a mod k)) = (\<Sum>l = 0..k - 1. f (l * a))

goal (1 subgoal):
 1. sum f {1..k} = (\<Sum>l = 1..k. f (l * a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..k - 1. f (l * a mod k)) = (\<Sum>l = 0..k - 1. f (l * a))

goal (1 subgoal):
 1. sum f {1..k} = (\<Sum>l = 1..k. f (l * a))
[PROOF STEP]
have "\<dots> = (\<Sum>l = 1..k. f(l*a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>l = 0..k - 1. f (l * a)) = (\<Sum>l = 1..k. f (l * a))
[PROOF STEP]
using periodic_arithmetic_sum_periodic_arithmetic_shift[of "(\<lambda>l. f(l*a))" k 1]
          periodic_arithmetic_homothecy[OF assms(2)] assms(3)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>periodic_arithmetic (\<lambda>l. f (l * a)) k; 0 < k; 0 < 1\<rbrakk> \<Longrightarrow> (\<Sum>l = 0..k - 1. f (l * a)) = (\<Sum>l = 1..1 + k - 1. f (l * a))
periodic_arithmetic (\<lambda>l. f (l * ?a)) k
0 < k

goal (1 subgoal):
 1. (\<Sum>l = 0..k - 1. f (l * a)) = (\<Sum>l = 1..k. f (l * a))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..k - 1. f (l * a)) = (\<Sum>l = 1..k. f (l * a))

goal (1 subgoal):
 1. sum f {1..k} = (\<Sum>l = 1..k. f (l * a))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum f {1..k} = (\<Sum>l = 1..k. f (l * a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum f {1..k} = (\<Sum>l = 1..k. f (l * a))

goal (1 subgoal):
 1. sum f {1..k} = (\<Sum>l = 1..k. f (l * a))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
sum f {1..k} = (\<Sum>l = 1..k. f (l * a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma p2r_disj_hom [simp]: "p2r P \<union> p2r Q = p2r (P \<squnion> Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p2r P \<union> p2r Q = p2r (P \<squnion> Q)
[PROOF STEP]
by (simp add: p2s2r p2s_disj_hom s2r_union_hom)


[STATEMENT]
lemma proj2_Col_coeff:
  assumes "proj2_Col a r t" and "a \<noteq> r" and "t \<noteq> a"
  shows "t = proj2_abs ((proj2_Col_coeff a r t) *\<^sub>R proj2_rep a + proj2_rep r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t = proj2_abs (proj2_Col_coeff a r t *\<^sub>R proj2_rep a + proj2_rep r)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. t = proj2_abs (proj2_Col_coeff a r t *\<^sub>R proj2_rep a + proj2_rep r)
[PROOF STEP]
from \<open>a \<noteq> r\<close> and \<open>proj2_Col a r t\<close> and \<open>t \<noteq> a\<close> and proj2_Col_iff
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> r
proj2_Col a r t
t \<noteq> a
?a \<noteq> ?r \<Longrightarrow> proj2_Col ?a ?r ?t = (?t = ?a \<or> (\<exists>i. ?t = proj2_abs (i *\<^sub>R proj2_rep ?a + proj2_rep ?r)))
[PROOF STEP]
have "\<exists> i. t = proj2_abs (i *\<^sub>R proj2_rep a + proj2_rep r)"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> r
proj2_Col a r t
t \<noteq> a
?a \<noteq> ?r \<Longrightarrow> proj2_Col ?a ?r ?t = (?t = ?a \<or> (\<exists>i. ?t = proj2_abs (i *\<^sub>R proj2_rep ?a + proj2_rep ?r)))

goal (1 subgoal):
 1. \<exists>i. t = proj2_abs (i *\<^sub>R proj2_rep a + proj2_rep r)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<exists>i. t = proj2_abs (i *\<^sub>R proj2_rep a + proj2_rep r)

goal (1 subgoal):
 1. t = proj2_abs (proj2_Col_coeff a r t *\<^sub>R proj2_rep a + proj2_rep r)
[PROOF STEP]
thus "t = proj2_abs ((proj2_Col_coeff a r t) *\<^sub>R proj2_rep a + proj2_rep r)"
[PROOF STATE]
proof (prove)
using this:
\<exists>i. t = proj2_abs (i *\<^sub>R proj2_rep a + proj2_rep r)

goal (1 subgoal):
 1. t = proj2_abs (proj2_Col_coeff a r t *\<^sub>R proj2_rep a + proj2_rep r)
[PROOF STEP]
by (unfold proj2_Col_coeff_def) (rule someI_ex)
[PROOF STATE]
proof (state)
this:
t = proj2_abs (proj2_Col_coeff a r t *\<^sub>R proj2_rep a + proj2_rep r)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma span_eq: "(span S = span T) = (S \<subseteq> span T \<and> T \<subseteq> span S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (local.span S = local.span T) = (S \<subseteq> local.span T \<and> T \<subseteq> local.span S)
[PROOF STEP]
using span_superset[unfolded subset_eq]
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>?S. x \<in> local.span ?S

goal (1 subgoal):
 1. (local.span S = local.span T) = (S \<subseteq> local.span T \<and> T \<subseteq> local.span S)
[PROOF STEP]
using span_mono[of T "span S"] span_mono[of S "span T"]
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>?S. x \<in> local.span ?S
T \<subseteq> local.span S \<Longrightarrow> local.span T \<subseteq> local.span (local.span S)
S \<subseteq> local.span T \<Longrightarrow> local.span S \<subseteq> local.span (local.span T)

goal (1 subgoal):
 1. (local.span S = local.span T) = (S \<subseteq> local.span T \<and> T \<subseteq> local.span S)
[PROOF STEP]
by (auto simp add: span_span)


[STATEMENT]
lemma topological_basis_imp_subbasis:
  assumes B: "topological_basis B"
  shows "open = generate_topology B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open = generate_topology B
[PROOF STEP]
proof (intro ext iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. open x \<Longrightarrow> generate_topology B x
 2. \<And>x. generate_topology B x \<Longrightarrow> open x
[PROOF STEP]
fix S :: "'a set"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. open x \<Longrightarrow> generate_topology B x
 2. \<And>x. generate_topology B x \<Longrightarrow> open x
[PROOF STEP]
assume "open S"
[PROOF STATE]
proof (state)
this:
open S

goal (2 subgoals):
 1. \<And>x. open x \<Longrightarrow> generate_topology B x
 2. \<And>x. generate_topology B x \<Longrightarrow> open x
[PROOF STEP]
with B
[PROOF STATE]
proof (chain)
picking this:
topological_basis B
open S
[PROOF STEP]
obtain B' where "B' \<subseteq> B" "S = \<Union>B'"
[PROOF STATE]
proof (prove)
using this:
topological_basis B
open S

goal (1 subgoal):
 1. (\<And>B'. \<lbrakk>B' \<subseteq> B; S = \<Union> B'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding topological_basis_def
[PROOF STATE]
proof (prove)
using this:
Ball B open \<and> (\<forall>x. open x \<longrightarrow> (\<exists>B'\<subseteq>B. \<Union> B' = x))
open S

goal (1 subgoal):
 1. (\<And>B'. \<lbrakk>B' \<subseteq> B; S = \<Union> B'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
B' \<subseteq> B
S = \<Union> B'

goal (2 subgoals):
 1. \<And>x. open x \<Longrightarrow> generate_topology B x
 2. \<And>x. generate_topology B x \<Longrightarrow> open x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
B' \<subseteq> B
S = \<Union> B'
[PROOF STEP]
show "generate_topology B S"
[PROOF STATE]
proof (prove)
using this:
B' \<subseteq> B
S = \<Union> B'

goal (1 subgoal):
 1. generate_topology B S
[PROOF STEP]
by (auto intro: generate_topology.intros dest: topological_basis_open)
[PROOF STATE]
proof (state)
this:
generate_topology B S

goal (1 subgoal):
 1. \<And>x. generate_topology B x \<Longrightarrow> open x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. generate_topology B x \<Longrightarrow> open x
[PROOF STEP]
fix S :: "'a set"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. generate_topology B x \<Longrightarrow> open x
[PROOF STEP]
assume "generate_topology B S"
[PROOF STATE]
proof (state)
this:
generate_topology B S

goal (1 subgoal):
 1. \<And>x. generate_topology B x \<Longrightarrow> open x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
generate_topology B S
[PROOF STEP]
show "open S"
[PROOF STATE]
proof (prove)
using this:
generate_topology B S

goal (1 subgoal):
 1. open S
[PROOF STEP]
by induct (auto dest: topological_basis_open[OF B])
[PROOF STATE]
proof (state)
this:
open S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Rats_eq_int_div_int: "\<rat> = {real_of_int i / real_of_int j | i j. j \<noteq> 0}"  (is "_ = ?S")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<rat> = {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<rat> \<subseteq> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
 2. {real_of_int i / real_of_int j |i j. j \<noteq> 0} \<subseteq> \<rat>
[PROOF STEP]
show "\<rat> \<subseteq> ?S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<rat> \<subseteq> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> \<rat> \<Longrightarrow> x \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
fix x :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> \<rat> \<Longrightarrow> x \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
assume "x \<in> \<rat>"
[PROOF STATE]
proof (state)
this:
x \<in> \<rat>

goal (1 subgoal):
 1. \<And>x. x \<in> \<rat> \<Longrightarrow> x \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> \<rat>
[PROOF STEP]
obtain r where "x = of_rat r"
[PROOF STATE]
proof (prove)
using this:
x \<in> \<rat>

goal (1 subgoal):
 1. (\<And>r. x = real_of_rat r \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding Rats_def
[PROOF STATE]
proof (prove)
using this:
x \<in> range real_of_rat

goal (1 subgoal):
 1. (\<And>r. x = real_of_rat r \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
x = real_of_rat r

goal (1 subgoal):
 1. \<And>x. x \<in> \<rat> \<Longrightarrow> x \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
have "of_rat r \<in> ?S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_rat r \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
by (cases r) (auto simp add: of_rat_rat)
[PROOF STATE]
proof (state)
this:
real_of_rat r \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}

goal (1 subgoal):
 1. \<And>x. x \<in> \<rat> \<Longrightarrow> x \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real_of_rat r \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
show "x \<in> ?S"
[PROOF STATE]
proof (prove)
using this:
real_of_rat r \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}

goal (1 subgoal):
 1. x \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
using \<open>x = of_rat r\<close>
[PROOF STATE]
proof (prove)
using this:
real_of_rat r \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
x = real_of_rat r

goal (1 subgoal):
 1. x \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<in> {real_of_int i / real_of_int j |i j. j \<noteq> 0}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<rat> \<subseteq> {real_of_int i / real_of_int j |i j. j \<noteq> 0}

goal (1 subgoal):
 1. {real_of_int i / real_of_int j |i j. j \<noteq> 0} \<subseteq> \<rat>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {real_of_int i / real_of_int j |i j. j \<noteq> 0} \<subseteq> \<rat>
[PROOF STEP]
show "?S \<subseteq> \<rat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {real_of_int i / real_of_int j |i j. j \<noteq> 0} \<subseteq> \<rat>
[PROOF STEP]
proof (auto simp: Rats_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. j \<noteq> 0 \<Longrightarrow> real_of_int i / real_of_int j \<in> range real_of_rat
[PROOF STEP]
fix i j :: int
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. j \<noteq> 0 \<Longrightarrow> real_of_int i / real_of_int j \<in> range real_of_rat
[PROOF STEP]
assume "j \<noteq> 0"
[PROOF STATE]
proof (state)
this:
j \<noteq> 0

goal (1 subgoal):
 1. \<And>i j. j \<noteq> 0 \<Longrightarrow> real_of_int i / real_of_int j \<in> range real_of_rat
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j \<noteq> 0
[PROOF STEP]
have "real_of_int i / real_of_int j = of_rat (Fract i j)"
[PROOF STATE]
proof (prove)
using this:
j \<noteq> 0

goal (1 subgoal):
 1. real_of_int i / real_of_int j = real_of_rat (Fract i j)
[PROOF STEP]
by (simp add: of_rat_rat)
[PROOF STATE]
proof (state)
this:
real_of_int i / real_of_int j = real_of_rat (Fract i j)

goal (1 subgoal):
 1. \<And>i j. j \<noteq> 0 \<Longrightarrow> real_of_int i / real_of_int j \<in> range real_of_rat
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real_of_int i / real_of_int j = real_of_rat (Fract i j)
[PROOF STEP]
show "real_of_int i / real_of_int j \<in> range of_rat"
[PROOF STATE]
proof (prove)
using this:
real_of_int i / real_of_int j = real_of_rat (Fract i j)

goal (1 subgoal):
 1. real_of_int i / real_of_int j \<in> range real_of_rat
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
real_of_int i / real_of_int j \<in> range real_of_rat

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{real_of_int i / real_of_int j |i j. j \<noteq> 0} \<subseteq> \<rat>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma remove_rev_alt_def :
  "remove_rev x xs = (filter (\<lambda>y. y \<noteq> x) (rev xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. remove_rev x xs = filter (\<lambda>y. y \<noteq> x) (rev xs)
[PROOF STEP]
unfolding remove_rev_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter_rev ((Not \<circ>\<circ> (=)) x) xs = filter (\<lambda>y. y \<noteq> x) (rev xs)
[PROOF STEP]
apply (simp add: filter_rev_alt comp_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter ((\<noteq>) x) (rev xs) = filter (\<lambda>y. y \<noteq> x) (rev xs)
[PROOF STEP]
by metis


[STATEMENT]
lemma tendsto_log [tendsto_intros]:
  "(f \<longlongrightarrow> a) F \<Longrightarrow> (g \<longlongrightarrow> b) F \<Longrightarrow> 0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> 0 < b \<Longrightarrow>
    ((\<lambda>x. log (f x) (g x)) \<longlongrightarrow> log a b) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> a) F; (g \<longlongrightarrow> b) F; 0 < a; a \<noteq> 1; 0 < b\<rbrakk> \<Longrightarrow> ((\<lambda>x. log (f x) (g x)) \<longlongrightarrow> log a b) F
[PROOF STEP]
unfolding log_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> a) F; (g \<longlongrightarrow> b) F; 0 < a; a \<noteq> 1; 0 < b\<rbrakk> \<Longrightarrow> ((\<lambda>x. ln (g x) / ln (f x)) \<longlongrightarrow> ln b / ln a) F
[PROOF STEP]
by (intro tendsto_intros) auto


[STATEMENT]
lemma open_superdiagonal:
  "open {(x,y) | x y. x > (y::'a::{linorder_topology})}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open {(x, y) |x y. y < x}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. open {(x, y) |x y. y < x}
[PROOF STEP]
have "open {(x, y). x > (y::'a)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open {(x, y). y < x}
[PROOF STEP]
unfolding split_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open {p. snd p < fst p}
[PROOF STEP]
by (intro open_Collect_less continuous_intros)
[PROOF STATE]
proof (state)
this:
open {(x, y). y < x}

goal (1 subgoal):
 1. open {(x, y) |x y. y < x}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
open {(x, y). y < x}

goal (1 subgoal):
 1. open {(x, y) |x y. y < x}
[PROOF STEP]
have "{(x, y). x > (y::'a)} = {(x, y) |x y. x > (y::'a)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(x, y). y < x} = {(x, y) |x y. y < x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{(x, y). y < x} = {(x, y) |x y. y < x}

goal (1 subgoal):
 1. open {(x, y) |x y. y < x}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
open {(x, y) |x y. y < x}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
open {(x, y) |x y. y < x}

goal (1 subgoal):
 1. open {(x, y) |x y. y < x}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
open {(x, y) |x y. y < x}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rref_upt_condition2:
  assumes r: "reduced_row_echelon_form_upt_k A k"
  shows "(\<forall>i. \<not> (is_zero_row_upt_k i k A) \<longrightarrow> A $ i $ (LEAST k. A $ i $ k \<noteq> 0) = 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. \<not> is_zero_row_upt_k i k A \<longrightarrow> A $ i $ (LEAST k. A $ i $ k \<noteq> (0::'a)) = (1::'a)
[PROOF STEP]
using r
[PROOF STATE]
proof (prove)
using this:
reduced_row_echelon_form_upt_k A k

goal (1 subgoal):
 1. \<forall>i. \<not> is_zero_row_upt_k i k A \<longrightarrow> A $ i $ (LEAST k. A $ i $ k \<noteq> (0::'a)) = (1::'a)
[PROOF STEP]
unfolding reduced_row_echelon_form_upt_k_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>i. is_zero_row_upt_k i k A \<longrightarrow> \<not> (\<exists>j>i. \<not> is_zero_row_upt_k j k A)) \<and> (\<forall>i. \<not> is_zero_row_upt_k i k A \<longrightarrow> A $ i $ (LEAST k. A $ i $ k \<noteq> (0::'a)) = (1::'a)) \<and> (\<forall>i. i < i + (1::'c) \<and> \<not> is_zero_row_upt_k i k A \<and> \<not> is_zero_row_upt_k (i + (1::'c)) k A \<longrightarrow> (LEAST n. A $ i $ n \<noteq> (0::'a)) < (LEAST n. A $ (i + (1::'c)) $ n \<noteq> (0::'a))) \<and> (\<forall>i. \<not> is_zero_row_upt_k i k A \<longrightarrow> (\<forall>j. i \<noteq> j \<longrightarrow> A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a)))

goal (1 subgoal):
 1. \<forall>i. \<not> is_zero_row_upt_k i k A \<longrightarrow> A $ i $ (LEAST k. A $ i $ k \<noteq> (0::'a)) = (1::'a)
[PROOF STEP]
by simp


[STATEMENT]
lemma le_err_trans [rule_format]:
  "order r \<Longrightarrow> e1 \<sqsubseteq>\<^bsub>le r\<^esub> e2 \<longrightarrow> e2 \<sqsubseteq>\<^bsub>le r\<^esub> e3 \<longrightarrow> e1 \<sqsubseteq>\<^bsub>le r\<^esub> e3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order r \<Longrightarrow> e1 \<sqsubseteq>\<^bsub>le r\<^esub> e2 \<longrightarrow> e2 \<sqsubseteq>\<^bsub>le r\<^esub> e3 \<longrightarrow> e1 \<sqsubseteq>\<^bsub>le r\<^esub> e3
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order r \<Longrightarrow> e1 \<sqsubseteq>\<^bsub>le r\<^esub> e2 \<longrightarrow> e2 \<sqsubseteq>\<^bsub>le r\<^esub> e3 \<longrightarrow> e1 \<sqsubseteq>\<^bsub>le r\<^esub> e3
[PROOF STEP]
apply (unfold unfold_lesub_err le_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order r \<Longrightarrow> (case e2 of Err \<Rightarrow> True | OK y \<Rightarrow> case e1 of Err \<Rightarrow> False | OK x \<Rightarrow> x \<sqsubseteq>\<^bsub>r\<^esub> y) \<longrightarrow> (case e3 of Err \<Rightarrow> True | OK y \<Rightarrow> case e2 of Err \<Rightarrow> False | OK x \<Rightarrow> x \<sqsubseteq>\<^bsub>r\<^esub> y) \<longrightarrow> (case e3 of Err \<Rightarrow> True | OK y \<Rightarrow> case e1 of Err \<Rightarrow> False | OK x \<Rightarrow> x \<sqsubseteq>\<^bsub>r\<^esub> y)
[PROOF STEP]
apply (simp split: err.split)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order r \<Longrightarrow> \<forall>x2 x2a. e1 = OK x2a \<longrightarrow> e3 = OK x2 \<longrightarrow> (\<forall>x2b. e2 = OK x2b \<longrightarrow> x2a \<sqsubseteq>\<^bsub>r\<^esub> x2b \<longrightarrow> x2b \<sqsubseteq>\<^bsub>r\<^esub> x2 \<longrightarrow> x2a \<sqsubseteq>\<^bsub>r\<^esub> x2)
[PROOF STEP]
apply (blast intro: order_trans)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma filter_sup_principal_rep:
  assumes "filter F"
      and "filter G"
      and "filter_sup F G = \<up>z"
    shows "\<exists>x\<in>F . \<exists>y\<in>G . z = x \<sqinter> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<in>F. \<exists>y\<in>G. z = x \<sqinter> y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x\<in>F. \<exists>y\<in>G. z = x \<sqinter> y
[PROOF STEP]
from assms(3)
[PROOF STATE]
proof (chain)
picking this:
filter_sup F G = \<up>z
[PROOF STEP]
obtain x y where 1: "x\<in>F \<and> y\<in>G \<and> x \<sqinter> y \<le> z"
[PROOF STATE]
proof (prove)
using this:
filter_sup F G = \<up>z

goal (1 subgoal):
 1. (\<And>x y. x \<in> F \<and> y \<in> G \<and> x \<sqinter> y \<le> z \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding filter_sup_def
[PROOF STATE]
proof (prove)
using this:
{z. \<exists>x\<in>F. \<exists>y\<in>G. x \<sqinter> y \<le> z} = \<up>z

goal (1 subgoal):
 1. (\<And>x y. x \<in> F \<and> y \<in> G \<and> x \<sqinter> y \<le> z \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using order_refl
[PROOF STATE]
proof (prove)
using this:
{z. \<exists>x\<in>F. \<exists>y\<in>G. x \<sqinter> y \<le> z} = \<up>z
?x \<le> ?x

goal (1 subgoal):
 1. (\<And>x y. x \<in> F \<and> y \<in> G \<and> x \<sqinter> y \<le> z \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> F \<and> y \<in> G \<and> x \<sqinter> y \<le> z

goal (1 subgoal):
 1. \<exists>x\<in>F. \<exists>y\<in>G. z = x \<sqinter> y
[PROOF STEP]
hence 2: "x \<squnion> z \<in> F \<and> y \<squnion> z \<in> G"
[PROOF STATE]
proof (prove)
using this:
x \<in> F \<and> y \<in> G \<and> x \<sqinter> y \<le> z

goal (1 subgoal):
 1. x \<squnion> z \<in> F \<and> y \<squnion> z \<in> G
[PROOF STEP]
by (meson assms(1-2) sup_ge1 filter_def)
[PROOF STATE]
proof (state)
this:
x \<squnion> z \<in> F \<and> y \<squnion> z \<in> G

goal (1 subgoal):
 1. \<exists>x\<in>F. \<exists>y\<in>G. z = x \<sqinter> y
[PROOF STEP]
have "(x \<squnion> z) \<sqinter> (y \<squnion> z) = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<squnion> z) \<sqinter> (y \<squnion> z) = z
[PROOF STEP]
using 1 sup_absorb2 sup_inf_distrib2
[PROOF STATE]
proof (prove)
using this:
x \<in> F \<and> y \<in> G \<and> x \<sqinter> y \<le> z
?x \<le> ?y \<Longrightarrow> ?x \<squnion> ?y = ?y
?y \<sqinter> ?z \<squnion> ?x = (?y \<squnion> ?x) \<sqinter> (?z \<squnion> ?x)

goal (1 subgoal):
 1. (x \<squnion> z) \<sqinter> (y \<squnion> z) = z
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(x \<squnion> z) \<sqinter> (y \<squnion> z) = z

goal (1 subgoal):
 1. \<exists>x\<in>F. \<exists>y\<in>G. z = x \<sqinter> y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(x \<squnion> z) \<sqinter> (y \<squnion> z) = z

goal (1 subgoal):
 1. \<exists>x\<in>F. \<exists>y\<in>G. z = x \<sqinter> y
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
(x \<squnion> z) \<sqinter> (y \<squnion> z) = z
x \<squnion> z \<in> F \<and> y \<squnion> z \<in> G

goal (1 subgoal):
 1. \<exists>x\<in>F. \<exists>y\<in>G. z = x \<sqinter> y
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>F. \<exists>y\<in>G. z = x \<sqinter> y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mersenne_mod2_nonneg [simp]: "k \<ge> 0 \<Longrightarrow> mersenne_mod2 k n \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> k \<Longrightarrow> 0 \<le> mersenne_mod2 k n
[PROOF STEP]
unfolding mersenne_mod2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> k \<Longrightarrow> 0 \<le> mersenne_mod (mersenne_mod k n) n
[PROOF STEP]
by simp


[STATEMENT]
lemma univ_eq_linorder[intro?]:
  shows "eq_linorder univ_cmp"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eq_linorder univ_cmp
[PROOF STEP]
apply (rule eq_linorder_on.intro)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. linorder univ_cmp
 2. eq_linorder_on_axioms UNIV univ_cmp
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eq_linorder_on_axioms UNIV univ_cmp
[PROOF STEP]
apply unfold_locales
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; univ_cmp x y = EQUAL\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
unfolding univ_cmp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; (if x = y then EQUAL else if (x, y) \<in> univ_order_rel then LESS else GREATER) = EQUAL\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
apply (auto split: if_split_asm)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma dim_cball:
  assumes "e > 0"
  shows "dim (cball (0 :: 'n::euclidean_space) e) = DIM('n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim (cball (0::'n) e) = DIM('n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dim (cball (0::'n) e) = DIM('n)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dim (cball (0::'n) e) = DIM('n)
[PROOF STEP]
fix x :: "'n::euclidean_space"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dim (cball (0::'n) e) = DIM('n)
[PROOF STEP]
define y where "y = (e / norm x) *\<^sub>R x"
[PROOF STATE]
proof (state)
this:
y = (e / norm x) *\<^sub>R x

goal (1 subgoal):
 1. dim (cball (0::'n) e) = DIM('n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y = (e / norm x) *\<^sub>R x
[PROOF STEP]
have "y \<in> cball 0 e"
[PROOF STATE]
proof (prove)
using this:
y = (e / norm x) *\<^sub>R x

goal (1 subgoal):
 1. y \<in> cball (0::'n) e
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
y = (e / norm x) *\<^sub>R x
0 < e

goal (1 subgoal):
 1. y \<in> cball (0::'n) e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> cball (0::'n) e

goal (1 subgoal):
 1. dim (cball (0::'n) e) = DIM('n)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
y \<in> cball (0::'n) e

goal (1 subgoal):
 1. dim (cball (0::'n) e) = DIM('n)
[PROOF STEP]
have *: "x = (norm x / e) *\<^sub>R y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = (norm x / e) *\<^sub>R y
[PROOF STEP]
using y_def assms
[PROOF STATE]
proof (prove)
using this:
y = (e / norm x) *\<^sub>R x
0 < e

goal (1 subgoal):
 1. x = (norm x / e) *\<^sub>R y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x = (norm x / e) *\<^sub>R y

goal (1 subgoal):
 1. dim (cball (0::'n) e) = DIM('n)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x = (norm x / e) *\<^sub>R y

goal (1 subgoal):
 1. dim (cball (0::'n) e) = DIM('n)
[PROOF STEP]
from *
[PROOF STATE]
proof (chain)
picking this:
x = (norm x / e) *\<^sub>R y
[PROOF STEP]
have "x = (norm x/e) *\<^sub>R y"
[PROOF STATE]
proof (prove)
using this:
x = (norm x / e) *\<^sub>R y

goal (1 subgoal):
 1. x = (norm x / e) *\<^sub>R y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = (norm x / e) *\<^sub>R y

goal (1 subgoal):
 1. dim (cball (0::'n) e) = DIM('n)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
y \<in> cball (0::'n) e
x = (norm x / e) *\<^sub>R y
x = (norm x / e) *\<^sub>R y
[PROOF STEP]
have "x \<in> span (cball 0 e)"
[PROOF STATE]
proof (prove)
using this:
y \<in> cball (0::'n) e
x = (norm x / e) *\<^sub>R y
x = (norm x / e) *\<^sub>R y

goal (1 subgoal):
 1. x \<in> span (cball (0::'n) e)
[PROOF STEP]
using span_scale[of y "cball 0 e" "norm x/e"]
        span_superset[of "cball 0 e"]
[PROOF STATE]
proof (prove)
using this:
y \<in> cball (0::'n) e
x = (norm x / e) *\<^sub>R y
x = (norm x / e) *\<^sub>R y
y \<in> span (cball (0::'n) e) \<Longrightarrow> (norm x / e) *\<^sub>R y \<in> span (cball (0::'n) e)
cball (0::?'a1) e \<subseteq> span (cball (0::?'a1) e)

goal (1 subgoal):
 1. x \<in> span (cball (0::'n) e)
[PROOF STEP]
by (simp add: span_base)
[PROOF STATE]
proof (state)
this:
x \<in> span (cball (0::'n) e)

goal (1 subgoal):
 1. dim (cball (0::'n) e) = DIM('n)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?x2 \<in> span (cball (0::'n) e)

goal (1 subgoal):
 1. dim (cball (0::'n) e) = DIM('n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x2 \<in> span (cball (0::'n) e)
[PROOF STEP]
have "span (cball 0 e) = (UNIV :: 'n::euclidean_space set)"
[PROOF STATE]
proof (prove)
using this:
?x2 \<in> span (cball (0::'n) e)

goal (1 subgoal):
 1. span (cball (0::'n) e) = UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
span (cball (0::'n) e) = UNIV

goal (1 subgoal):
 1. dim (cball (0::'n) e) = DIM('n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
span (cball (0::'n) e) = UNIV
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
span (cball (0::'n) e) = UNIV

goal (1 subgoal):
 1. dim (cball (0::'n) e) = DIM('n)
[PROOF STEP]
using dim_span[of "cball (0 :: 'n::euclidean_space) e"]
[PROOF STATE]
proof (prove)
using this:
span (cball (0::'n) e) = UNIV
dim (span (cball (0::'n) e)) = dim (cball (0::'n) e)

goal (1 subgoal):
 1. dim (cball (0::'n) e) = DIM('n)
[PROOF STEP]
by (auto)
[PROOF STATE]
proof (state)
this:
dim (cball (0::'n) e) = DIM('n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma permutes_domain_partition_eq:
  assumes "f \<in> A \<rightarrow> B"
  assumes "p\<^sub>A permutes A"
  assumes "b \<in> B"
  shows "p\<^sub>A ` {x \<in> A. f x = b} = {x \<in> A. f (inv p\<^sub>A x) = b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p\<^sub>A ` {x \<in> A. f x = b} = {x \<in> A. f (inv p\<^sub>A x) = b}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p\<^sub>A ` {x \<in> A. f x = b} \<subseteq> {x \<in> A. f (inv p\<^sub>A x) = b}
 2. {x \<in> A. f (inv p\<^sub>A x) = b} \<subseteq> p\<^sub>A ` {x \<in> A. f x = b}
[PROOF STEP]
show "p\<^sub>A ` {x \<in> A. f x = b} \<subseteq> {x \<in> A. f (inv p\<^sub>A x) = b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p\<^sub>A ` {x \<in> A. f x = b} \<subseteq> {x \<in> A. f (inv p\<^sub>A x) = b}
[PROOF STEP]
using \<open>p\<^sub>A permutes A\<close> permutes_in_image permutes_inverses(2)
[PROOF STATE]
proof (prove)
using this:
p\<^sub>A permutes A
?p permutes ?S \<Longrightarrow> (?p ?x \<in> ?S) = (?x \<in> ?S)
?p permutes ?S \<Longrightarrow> inv ?p (?p ?x) = ?x

goal (1 subgoal):
 1. p\<^sub>A ` {x \<in> A. f x = b} \<subseteq> {x \<in> A. f (inv p\<^sub>A x) = b}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
p\<^sub>A ` {x \<in> A. f x = b} \<subseteq> {x \<in> A. f (inv p\<^sub>A x) = b}

goal (1 subgoal):
 1. {x \<in> A. f (inv p\<^sub>A x) = b} \<subseteq> p\<^sub>A ` {x \<in> A. f x = b}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {x \<in> A. f (inv p\<^sub>A x) = b} \<subseteq> p\<^sub>A ` {x \<in> A. f x = b}
[PROOF STEP]
show "{x \<in> A. f (inv p\<^sub>A x) = b} \<subseteq> p\<^sub>A ` {x \<in> A. f x = b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> A. f (inv p\<^sub>A x) = b} \<subseteq> p\<^sub>A ` {x \<in> A. f x = b}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {x \<in> A. f (inv p\<^sub>A x) = b} \<Longrightarrow> x \<in> p\<^sub>A ` {x \<in> A. f x = b}
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {x \<in> A. f (inv p\<^sub>A x) = b} \<Longrightarrow> x \<in> p\<^sub>A ` {x \<in> A. f x = b}
[PROOF STEP]
assume "x \<in> {x \<in> A. f (inv p\<^sub>A x) = b}"
[PROOF STATE]
proof (state)
this:
x \<in> {x \<in> A. f (inv p\<^sub>A x) = b}

goal (1 subgoal):
 1. \<And>x. x \<in> {x \<in> A. f (inv p\<^sub>A x) = b} \<Longrightarrow> x \<in> p\<^sub>A ` {x \<in> A. f x = b}
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
x \<in> {x \<in> A. f (inv p\<^sub>A x) = b}
[PROOF STEP]
have "x \<in> A" "f (inv p\<^sub>A x) = b"
[PROOF STATE]
proof (prove)
using this:
x \<in> {x \<in> A. f (inv p\<^sub>A x) = b}

goal (1 subgoal):
 1. x \<in> A &&& f (inv p\<^sub>A x) = b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> A
f (inv p\<^sub>A x) = b

goal (1 subgoal):
 1. \<And>x. x \<in> {x \<in> A. f (inv p\<^sub>A x) = b} \<Longrightarrow> x \<in> p\<^sub>A ` {x \<in> A. f x = b}
[PROOF STEP]
from \<open>x \<in> A\<close>
[PROOF STATE]
proof (chain)
picking this:
x \<in> A
[PROOF STEP]
have "x = p\<^sub>A (inv p\<^sub>A x)"
[PROOF STATE]
proof (prove)
using this:
x \<in> A

goal (1 subgoal):
 1. x = p\<^sub>A (inv p\<^sub>A x)
[PROOF STEP]
using \<open>p\<^sub>A permutes A\<close> permutes_inverses(1)
[PROOF STATE]
proof (prove)
using this:
x \<in> A
p\<^sub>A permutes A
?p permutes ?S \<Longrightarrow> ?p (inv ?p ?x) = ?x

goal (1 subgoal):
 1. x = p\<^sub>A (inv p\<^sub>A x)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x = p\<^sub>A (inv p\<^sub>A x)

goal (1 subgoal):
 1. \<And>x. x \<in> {x \<in> A. f (inv p\<^sub>A x) = b} \<Longrightarrow> x \<in> p\<^sub>A ` {x \<in> A. f x = b}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x = p\<^sub>A (inv p\<^sub>A x)

goal (1 subgoal):
 1. \<And>x. x \<in> {x \<in> A. f (inv p\<^sub>A x) = b} \<Longrightarrow> x \<in> p\<^sub>A ` {x \<in> A. f x = b}
[PROOF STEP]
from \<open>f (inv p\<^sub>A x) = b\<close> \<open>x \<in> A\<close>
[PROOF STATE]
proof (chain)
picking this:
f (inv p\<^sub>A x) = b
x \<in> A
[PROOF STEP]
have "inv p\<^sub>A x \<in> {x \<in> A. f x = b}"
[PROOF STATE]
proof (prove)
using this:
f (inv p\<^sub>A x) = b
x \<in> A

goal (1 subgoal):
 1. inv p\<^sub>A x \<in> {x \<in> A. f x = b}
[PROOF STEP]
by (simp add: \<open>p\<^sub>A permutes A\<close> permutes_in_image permutes_inv)
[PROOF STATE]
proof (state)
this:
inv p\<^sub>A x \<in> {x \<in> A. f x = b}

goal (1 subgoal):
 1. \<And>x. x \<in> {x \<in> A. f (inv p\<^sub>A x) = b} \<Longrightarrow> x \<in> p\<^sub>A ` {x \<in> A. f x = b}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x = p\<^sub>A (inv p\<^sub>A x)
inv p\<^sub>A x \<in> {x \<in> A. f x = b}
[PROOF STEP]
show "x \<in> p\<^sub>A ` {x \<in> A. f x = b}"
[PROOF STATE]
proof (prove)
using this:
x = p\<^sub>A (inv p\<^sub>A x)
inv p\<^sub>A x \<in> {x \<in> A. f x = b}

goal (1 subgoal):
 1. x \<in> p\<^sub>A ` {x \<in> A. f x = b}
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
x \<in> p\<^sub>A ` {x \<in> A. f x = b}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{x \<in> A. f (inv p\<^sub>A x) = b} \<subseteq> p\<^sub>A ` {x \<in> A. f x = b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma offset_poly_eq_0_iff: "offset_poly p h = 0 \<longleftrightarrow> p = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (offset_poly p h = 0) = (p = 0)
[PROOF STEP]
apply (safe intro!: offset_poly_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. offset_poly p h = 0 \<Longrightarrow> p = 0
[PROOF STEP]
apply (induct p)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. offset_poly 0 h = 0 \<Longrightarrow> 0 = 0
 2. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; offset_poly p h = 0 \<Longrightarrow> p = 0; offset_poly (pCons a p) h = 0\<rbrakk> \<Longrightarrow> pCons a p = 0
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; offset_poly p h = 0 \<Longrightarrow> p = 0; offset_poly (pCons a p) h = 0\<rbrakk> \<Longrightarrow> pCons a p = 0
[PROOF STEP]
apply (simp add: offset_poly_pCons)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a = (0::'a) \<longrightarrow> p \<noteq> 0; offset_poly p h = 0 \<Longrightarrow> p = 0; smult h (offset_poly p h) + pCons a (offset_poly p h) = 0\<rbrakk> \<Longrightarrow> a = (0::'a) \<and> p = 0
[PROOF STEP]
apply (frule offset_poly_eq_0_lemma, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma treezise_delete:
  assumes "internal p T"
  shows "treesize (delete p T) < treesize T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. treesize (delete p T) < treesize T
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
internal p T

goal (1 subgoal):
 1. treesize (delete p T) < treesize T
[PROOF STEP]
proof (induction p arbitrary: T)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>T. internal [] T \<Longrightarrow> treesize (delete [] T) < treesize T
 2. \<And>a p T. \<lbrakk>\<And>T. internal p T \<Longrightarrow> treesize (delete p T) < treesize T; internal (a # p) T\<rbrakk> \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
case (Nil)
[PROOF STATE]
proof (state)
this:
internal [] T

goal (2 subgoals):
 1. \<And>T. internal [] T \<Longrightarrow> treesize (delete [] T) < treesize T
 2. \<And>a p T. \<lbrakk>\<And>T. internal p T \<Longrightarrow> treesize (delete p T) < treesize T; internal (a # p) T\<rbrakk> \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
internal [] T
[PROOF STEP]
have "\<exists>T1 T2. T = Branching T1 T2"
[PROOF STATE]
proof (prove)
using this:
internal [] T

goal (1 subgoal):
 1. \<exists>T1 T2. T = Branching T1 T2
[PROOF STEP]
by (cases T) auto
[PROOF STATE]
proof (state)
this:
\<exists>T1 T2. T = Branching T1 T2

goal (2 subgoals):
 1. \<And>T. internal [] T \<Longrightarrow> treesize (delete [] T) < treesize T
 2. \<And>a p T. \<lbrakk>\<And>T. internal p T \<Longrightarrow> treesize (delete p T) < treesize T; internal (a # p) T\<rbrakk> \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>T1 T2. T = Branching T1 T2
[PROOF STEP]
obtain T1 T2 where T1T2_p: "T = Branching T1 T2"
[PROOF STATE]
proof (prove)
using this:
\<exists>T1 T2. T = Branching T1 T2

goal (1 subgoal):
 1. (\<And>T1 T2. T = Branching T1 T2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
T = Branching T1 T2

goal (2 subgoals):
 1. \<And>T. internal [] T \<Longrightarrow> treesize (delete [] T) < treesize T
 2. \<And>a p T. \<lbrakk>\<And>T. internal p T \<Longrightarrow> treesize (delete p T) < treesize T; internal (a # p) T\<rbrakk> \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
T = Branching T1 T2
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
T = Branching T1 T2

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

goal (1 subgoal):
 1. \<And>a p T. \<lbrakk>\<And>T. internal p T \<Longrightarrow> treesize (delete p T) < treesize T; internal (a # p) T\<rbrakk> \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a p T. \<lbrakk>\<And>T. internal p T \<Longrightarrow> treesize (delete p T) < treesize T; internal (a # p) T\<rbrakk> \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
case (Cons a p)
[PROOF STATE]
proof (state)
this:
internal p ?T \<Longrightarrow> treesize (delete p ?T) < treesize ?T
internal (a # p) T

goal (1 subgoal):
 1. \<And>a p T. \<lbrakk>\<And>T. internal p T \<Longrightarrow> treesize (delete p T) < treesize T; internal (a # p) T\<rbrakk> \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
internal p ?T \<Longrightarrow> treesize (delete p ?T) < treesize ?T
internal (a # p) T
[PROOF STEP]
have "\<exists>T1 T2. T = Branching T1 T2"
[PROOF STATE]
proof (prove)
using this:
internal p ?T \<Longrightarrow> treesize (delete p ?T) < treesize ?T
internal (a # p) T

goal (1 subgoal):
 1. \<exists>T1 T2. T = Branching T1 T2
[PROOF STEP]
using path_inv_Cons internal_is_path
[PROOF STATE]
proof (prove)
using this:
internal p ?T \<Longrightarrow> treesize (delete p ?T) < treesize ?T
internal (a # p) T
path (?a # ?ds) ?T \<longrightarrow> (\<exists>l r. ?T = Branching l r)
internal ?ds ?T \<Longrightarrow> path ?ds ?T

goal (1 subgoal):
 1. \<exists>T1 T2. T = Branching T1 T2
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>T1 T2. T = Branching T1 T2

goal (1 subgoal):
 1. \<And>a p T. \<lbrakk>\<And>T. internal p T \<Longrightarrow> treesize (delete p T) < treesize T; internal (a # p) T\<rbrakk> \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>T1 T2. T = Branching T1 T2
[PROOF STEP]
obtain T1 T2 where T1T2_p: "T = Branching T1 T2"
[PROOF STATE]
proof (prove)
using this:
\<exists>T1 T2. T = Branching T1 T2

goal (1 subgoal):
 1. (\<And>T1 T2. T = Branching T1 T2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
T = Branching T1 T2

goal (1 subgoal):
 1. \<And>a p T. \<lbrakk>\<And>T. internal p T \<Longrightarrow> treesize (delete p T) < treesize T; internal (a # p) T\<rbrakk> \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. treesize (delete (a # p) T) < treesize T
[PROOF STEP]
proof (cases a)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a \<Longrightarrow> treesize (delete (a # p) T) < treesize T
 2. \<not> a \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
assume a_p: a
[PROOF STATE]
proof (state)
this:
a

goal (2 subgoals):
 1. a \<Longrightarrow> treesize (delete (a # p) T) < treesize T
 2. \<not> a \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
from a_p
[PROOF STATE]
proof (chain)
picking this:
a
[PROOF STEP]
have "delete (a#p) T = (Branching (delete p T1) T2)"
[PROOF STATE]
proof (prove)
using this:
a

goal (1 subgoal):
 1. delete (a # p) T = Branching (delete p T1) T2
[PROOF STEP]
using T1T2_p
[PROOF STATE]
proof (prove)
using this:
a
T = Branching T1 T2

goal (1 subgoal):
 1. delete (a # p) T = Branching (delete p T1) T2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
delete (a # p) T = Branching (delete p T1) T2

goal (2 subgoals):
 1. a \<Longrightarrow> treesize (delete (a # p) T) < treesize T
 2. \<not> a \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
delete (a # p) T = Branching (delete p T1) T2

goal (2 subgoals):
 1. a \<Longrightarrow> treesize (delete (a # p) T) < treesize T
 2. \<not> a \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
from a_p
[PROOF STATE]
proof (chain)
picking this:
a
[PROOF STEP]
have "internal p T1"
[PROOF STATE]
proof (prove)
using this:
a

goal (1 subgoal):
 1. internal p T1
[PROOF STEP]
using T1T2_p Cons
[PROOF STATE]
proof (prove)
using this:
a
T = Branching T1 T2
internal p ?T \<Longrightarrow> treesize (delete p ?T) < treesize ?T
internal (a # p) T

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

goal (2 subgoals):
 1. a \<Longrightarrow> treesize (delete (a # p) T) < treesize T
 2. \<not> a \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
internal p T1
[PROOF STEP]
have "treesize (delete p T1) < treesize T1"
[PROOF STATE]
proof (prove)
using this:
internal p T1

goal (1 subgoal):
 1. treesize (delete p T1) < treesize T1
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
internal p T1
internal p ?T \<Longrightarrow> treesize (delete p ?T) < treesize ?T
internal (a # p) T

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

goal (2 subgoals):
 1. a \<Longrightarrow> treesize (delete (a # p) T) < treesize T
 2. \<not> a \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
delete (a # p) T = Branching (delete p T1) T2
treesize (delete p T1) < treesize T1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
delete (a # p) T = Branching (delete p T1) T2
treesize (delete p T1) < treesize T1

goal (1 subgoal):
 1. treesize (delete (a # p) T) < treesize T
[PROOF STEP]
using T1T2_p
[PROOF STATE]
proof (prove)
using this:
delete (a # p) T = Branching (delete p T1) T2
treesize (delete p T1) < treesize T1
T = Branching T1 T2

goal (1 subgoal):
 1. treesize (delete (a # p) T) < treesize T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
treesize (delete (a # p) T) < treesize T

goal (1 subgoal):
 1. \<not> a \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> a \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
assume a_p: "\<not>a"
[PROOF STATE]
proof (state)
this:
\<not> a

goal (1 subgoal):
 1. \<not> a \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
from a_p
[PROOF STATE]
proof (chain)
picking this:
\<not> a
[PROOF STEP]
have "delete (a#p) T = (Branching T1 (delete p T2))"
[PROOF STATE]
proof (prove)
using this:
\<not> a

goal (1 subgoal):
 1. delete (a # p) T = Branching T1 (delete p T2)
[PROOF STEP]
using T1T2_p
[PROOF STATE]
proof (prove)
using this:
\<not> a
T = Branching T1 T2

goal (1 subgoal):
 1. delete (a # p) T = Branching T1 (delete p T2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
delete (a # p) T = Branching T1 (delete p T2)

goal (1 subgoal):
 1. \<not> a \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
delete (a # p) T = Branching T1 (delete p T2)

goal (1 subgoal):
 1. \<not> a \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
from a_p
[PROOF STATE]
proof (chain)
picking this:
\<not> a
[PROOF STEP]
have "internal p T2"
[PROOF STATE]
proof (prove)
using this:
\<not> a

goal (1 subgoal):
 1. internal p T2
[PROOF STEP]
using T1T2_p Cons
[PROOF STATE]
proof (prove)
using this:
\<not> a
T = Branching T1 T2
internal p ?T \<Longrightarrow> treesize (delete p ?T) < treesize ?T
internal (a # p) T

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

goal (1 subgoal):
 1. \<not> a \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
internal p T2
[PROOF STEP]
have "treesize (delete p T2) < treesize T2"
[PROOF STATE]
proof (prove)
using this:
internal p T2

goal (1 subgoal):
 1. treesize (delete p T2) < treesize T2
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
internal p T2
internal p ?T \<Longrightarrow> treesize (delete p ?T) < treesize ?T
internal (a # p) T

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

goal (1 subgoal):
 1. \<not> a \<Longrightarrow> treesize (delete (a # p) T) < treesize T
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
delete (a # p) T = Branching T1 (delete p T2)
treesize (delete p T2) < treesize T2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
delete (a # p) T = Branching T1 (delete p T2)
treesize (delete p T2) < treesize T2

goal (1 subgoal):
 1. treesize (delete (a # p) T) < treesize T
[PROOF STEP]
using T1T2_p
[PROOF STATE]
proof (prove)
using this:
delete (a # p) T = Branching T1 (delete p T2)
treesize (delete p T2) < treesize T2
T = Branching T1 T2

goal (1 subgoal):
 1. treesize (delete (a # p) T) < treesize T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
treesize (delete (a # p) T) < treesize T

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
treesize (delete (a # p) T) < treesize T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "(Q\<longrightarrow>R) \<and> (R\<longrightarrow>P\<and>Q) \<and> (P\<longrightarrow>Q\<or>R) \<longrightarrow> (P=Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Q \<longrightarrow> R) \<and> (R \<longrightarrow> P \<and> Q) \<and> (P \<longrightarrow> Q \<or> R) \<longrightarrow> P = Q
[PROOF STEP]
by blast


[STATEMENT]
lemma mapmeasure_PiF:
  assumes s1: "space M = space (Pi\<^sub>M J (\<lambda>_. N))"
  assumes s2: "sets M = sets (Pi\<^sub>M J (\<lambda>_. N))"
  assumes "space N = UNIV"
  assumes "X \<in> sets (PiF (Collect finite) (\<lambda>_. N))"
  shows "emeasure (mapmeasure M (\<lambda>_. N)) X = emeasure M ((fm -` X \<inter> extensional J))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (mapmeasure M (\<lambda>_. N)) X = emeasure M (fm -` X \<inter> extensional J)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
space M = space (Pi\<^sub>M J (\<lambda>_. N))
sets M = sets (Pi\<^sub>M J (\<lambda>_. N))
space N = UNIV
X \<in> sets (Pi\<^sub>F (Collect finite) (\<lambda>_. N))

goal (1 subgoal):
 1. emeasure (mapmeasure M (\<lambda>_. N)) X = emeasure M (fm -` X \<inter> extensional J)
[PROOF STEP]
by (auto simp: measurable_cong_sets[OF s2 refl] mapmeasure_def emeasure_distr
    fm_measurable space_PiM PiE_def)


[STATEMENT]
lemma one_eq_neg_one: "\<one> = \<ominus> \<one> \<Longrightarrow> m = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<one> = \<ominus> \<one> \<Longrightarrow> m = 2
[PROOF STEP]
apply (simp add: res_one_eq res_neg_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 1 mod m = 1 \<Longrightarrow> m = 2
[PROOF STEP]
apply (metis add.commute add_diff_cancel mod_mod_trivial one_add_one uminus_add_conv_diff
    zero_neq_one zmod_zminus1_eq_if)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma foldl_set: "foldl (\<union>) {} l = \<Union>{x. x\<in>set l}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl (\<union>) {} l = \<Union> {x. x \<in> set l}
[PROOF STEP]
apply (induct l)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. foldl (\<union>) {} [] = \<Union> {x. x \<in> set []}
 2. \<And>a l. foldl (\<union>) {} l = \<Union> {x. x \<in> set l} \<Longrightarrow> foldl (\<union>) {} (a # l) = \<Union> {x. x \<in> set (a # l)}
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l. foldl (\<union>) {} l = \<Union> (set l) \<Longrightarrow> foldl (\<union>) a l = \<Union> {x. x = a \<or> x \<in> set l}
[PROOF STEP]
apply (subst foldl_un_empty_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l. foldl (\<union>) {} l = \<Union> (set l) \<Longrightarrow> a \<union> foldl (\<union>) {} l = \<Union> {x. x = a \<or> x \<in> set l}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma type_to_set1:
  shows "class.nontriv TYPE('b)" (is ?a) and "m=CARD('b)" (is ?b)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.nontriv TYPE('b) &&& m = CARD('b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. class.nontriv TYPE('b)
 2. m = CARD('b)
[PROOF STEP]
from local_typedef1
[PROOF STATE]
proof (chain)
picking this:
\<exists>Rep Abs. type_definition Rep Abs {0..<int m}
[PROOF STEP]
obtain Rep::"('b \<Rightarrow> int)" and Abs
    where t: "type_definition Rep Abs {0..<m :: int}"
[PROOF STATE]
proof (prove)
using this:
\<exists>Rep Abs. type_definition Rep Abs {0..<int m}

goal (1 subgoal):
 1. (\<And>Rep Abs. type_definition Rep Abs {0..<int m} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
type_definition Rep Abs {0..<int m}

goal (2 subgoals):
 1. class.nontriv TYPE('b)
 2. m = CARD('b)
[PROOF STEP]
have "card (UNIV :: 'b set) = card {0..<m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('b) = card {0..<m}
[PROOF STEP]
using t type_definition.card
[PROOF STATE]
proof (prove)
using this:
type_definition Rep Abs {0..<int m}
type_definition ?Rep ?Abs ?A \<Longrightarrow> CARD(?'b) = card ?A

goal (1 subgoal):
 1. CARD('b) = card {0..<m}
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
CARD('b) = card {0..<m}

goal (2 subgoals):
 1. class.nontriv TYPE('b)
 2. m = CARD('b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
CARD('b) = card {0..<m}

goal (2 subgoals):
 1. class.nontriv TYPE('b)
 2. m = CARD('b)
[PROOF STEP]
have "... = m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {0..<m} = m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {0..<m} = m

goal (2 subgoals):
 1. class.nontriv TYPE('b)
 2. m = CARD('b)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
CARD('b) = m
[PROOF STEP]
show ?b
[PROOF STATE]
proof (prove)
using this:
CARD('b) = m

goal (1 subgoal):
 1. m = CARD('b)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
m = CARD('b)

goal (1 subgoal):
 1. class.nontriv TYPE('b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m = CARD('b)
[PROOF STEP]
show ?a
[PROOF STATE]
proof (prove)
using this:
m = CARD('b)

goal (1 subgoal):
 1. class.nontriv TYPE('b)
[PROOF STEP]
unfolding class.nontriv_def
[PROOF STATE]
proof (prove)
using this:
m = CARD('b)

goal (1 subgoal):
 1. 1 < CARD('b)
[PROOF STEP]
using m
[PROOF STATE]
proof (prove)
using this:
m = CARD('b)
1 < m

goal (1 subgoal):
 1. 1 < CARD('b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
class.nontriv TYPE('b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_zero_left : "Const 0 * P = Const 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Const (0::'a) * P = Const (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Const (0::'a) * P = Const (0::'a)
[PROOF STEP]
have h:"0*P = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 * P = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 * P = 0

goal (1 subgoal):
 1. Const (0::'a) * P = Const (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Const (0::'a) * P = Const (0::'a)
[PROOF STEP]
unfolding Const_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_fun id MPoly Const\<^sub>0 (0::'a) * P = map_fun id MPoly Const\<^sub>0 (0::'a)
[PROOF STEP]
using h
[PROOF STATE]
proof (prove)
using this:
0 * P = 0

goal (1 subgoal):
 1. map_fun id MPoly Const\<^sub>0 (0::'a) * P = map_fun id MPoly Const\<^sub>0 (0::'a)
[PROOF STEP]
by (simp add: Const\<^sub>0_zero zero_mpoly_def)
[PROOF STATE]
proof (state)
this:
Const (0::'a) * P = Const (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma measure_preserving_prob_space:
  assumes "f \<in> measure_preserving M N"
  shows "prob_space M \<longleftrightarrow> prob_space N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob_space M = prob_space N
[PROOF STEP]
using measure_preserving_total_measure[OF assms]
[PROOF STATE]
proof (prove)
using this:
emeasure M (space M) = emeasure N (space N)

goal (1 subgoal):
 1. prob_space M = prob_space N
[PROOF STEP]
by (metis prob_space.emeasure_space_1 prob_spaceI)


[STATEMENT]
theorem join_meet_absorb: "x \<squnion> (x \<sqinter> y) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<squnion> x \<sqinter> y = x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<squnion> x \<sqinter> y = x
[PROOF STEP]
have "dual x \<sqinter> (dual x \<squnion> dual y) = dual x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dual x \<sqinter> (dual x \<squnion> dual y) = dual x
[PROOF STEP]
by (rule meet_join_absorb)
[PROOF STATE]
proof (state)
this:
dual x \<sqinter> (dual x \<squnion> dual y) = dual x

goal (1 subgoal):
 1. x \<squnion> x \<sqinter> y = x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dual x \<sqinter> (dual x \<squnion> dual y) = dual x
[PROOF STEP]
have "dual (x \<squnion> (x \<sqinter> y)) = dual x"
[PROOF STATE]
proof (prove)
using this:
dual x \<sqinter> (dual x \<squnion> dual y) = dual x

goal (1 subgoal):
 1. dual (x \<squnion> x \<sqinter> y) = dual x
[PROOF STEP]
by (simp only: dual_meet dual_join)
[PROOF STATE]
proof (state)
this:
dual (x \<squnion> x \<sqinter> y) = dual x

goal (1 subgoal):
 1. x \<squnion> x \<sqinter> y = x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dual (x \<squnion> x \<sqinter> y) = dual x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dual (x \<squnion> x \<sqinter> y) = dual x

goal (1 subgoal):
 1. x \<squnion> x \<sqinter> y = x
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
x \<squnion> x \<sqinter> y = x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma symmetric_mpoly_symmetric_sum:
  assumes "g permutes X"
  assumes "\<And>x \<pi>. x \<in> X \<Longrightarrow> \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (f x) = f (g x)"
  shows "symmetric_mpoly A (\<Sum>x\<in>X. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. symmetric_mpoly A (sum f X)
[PROOF STEP]
unfolding symmetric_mpoly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<pi>. \<pi> permutes A \<longrightarrow> mpoly_map_vars \<pi> (sum f X) = sum f X
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (sum f X) = sum f X
[PROOF STEP]
fix \<pi>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (sum f X) = sum f X
[PROOF STEP]
assume \<pi>: "\<pi> permutes A"
[PROOF STATE]
proof (state)
this:
\<pi> permutes A

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (sum f X) = sum f X
[PROOF STEP]
have "mpoly_map_vars \<pi> (sum f X) = (\<Sum>x\<in>X. mpoly_map_vars \<pi> (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mpoly_map_vars \<pi> (sum f X) = (\<Sum>x\<in>X. mpoly_map_vars \<pi> (f x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mpoly_map_vars \<pi> (sum f X) = (\<Sum>x\<in>X. mpoly_map_vars \<pi> (f x))

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (sum f X) = sum f X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mpoly_map_vars \<pi> (sum f X) = (\<Sum>x\<in>X. mpoly_map_vars \<pi> (f x))

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (sum f X) = sum f X
[PROOF STEP]
have "\<dots> = (\<Sum>x\<in>X. f (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>X. mpoly_map_vars \<pi> (f x)) = (\<Sum>x\<in>X. f (g x))
[PROOF STEP]
by (intro sum.cong assms \<pi> refl)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>X. mpoly_map_vars \<pi> (f x)) = (\<Sum>x\<in>X. f (g x))

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (sum f X) = sum f X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>X. mpoly_map_vars \<pi> (f x)) = (\<Sum>x\<in>X. f (g x))

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (sum f X) = sum f X
[PROOF STEP]
have "\<dots> = (\<Sum>x\<in>g`X. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>X. f (g x)) = sum f (g ` X)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
g permutes X
\<lbrakk>?x \<in> X; ?\<pi> permutes A\<rbrakk> \<Longrightarrow> mpoly_map_vars ?\<pi> (f ?x) = f (g ?x)

goal (1 subgoal):
 1. (\<Sum>x\<in>X. f (g x)) = sum f (g ` X)
[PROOF STEP]
by (subst sum.reindex) (auto simp: permutes_inj_on)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>X. f (g x)) = sum f (g ` X)

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (sum f X) = sum f X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>X. f (g x)) = sum f (g ` X)

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (sum f X) = sum f X
[PROOF STEP]
have "g ` X = X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g ` X = X
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
g permutes X
\<lbrakk>?x \<in> X; ?\<pi> permutes A\<rbrakk> \<Longrightarrow> mpoly_map_vars ?\<pi> (f ?x) = f (g ?x)

goal (1 subgoal):
 1. g ` X = X
[PROOF STEP]
by (simp add: permutes_image)
[PROOF STATE]
proof (state)
this:
g ` X = X

goal (1 subgoal):
 1. \<And>\<pi>. \<pi> permutes A \<Longrightarrow> mpoly_map_vars \<pi> (sum f X) = sum f X
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mpoly_map_vars \<pi> (sum f X) = sum f X
[PROOF STEP]
show "mpoly_map_vars \<pi> (sum f X) = sum f X"
[PROOF STATE]
proof (prove)
using this:
mpoly_map_vars \<pi> (sum f X) = sum f X

goal (1 subgoal):
 1. mpoly_map_vars \<pi> (sum f X) = sum f X
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
mpoly_map_vars \<pi> (sum f X) = sum f X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma transitive:
  fixes P :: pi
  and   Q :: pi
  and   R :: pi

  assumes "P \<approx>\<^sup>s Q"
  and     "Q \<approx>\<^sup>s R"

  shows "P \<approx>\<^sup>s R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<approx>\<^sup>s R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
P \<approx>\<^sup>s Q
Q \<approx>\<^sup>s R

goal (1 subgoal):
 1. P \<approx>\<^sup>s R
[PROOF STEP]
by(force simp add: substClosed_def intro: Weak_Early_Bisim.transitive)


[STATEMENT]
lemma ent_conjI: "\<lbrakk> A\<Longrightarrow>\<^sub>AB; A\<Longrightarrow>\<^sub>AC \<rbrakk> \<Longrightarrow> A \<Longrightarrow>\<^sub>A B \<and>\<^sub>A C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<Longrightarrow>\<^sub>A B; A \<Longrightarrow>\<^sub>A C\<rbrakk> \<Longrightarrow> A \<Longrightarrow>\<^sub>A B \<and>\<^sub>A C
[PROOF STEP]
unfolding entails_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>h. h \<Turnstile> A \<longrightarrow> h \<Turnstile> B; \<forall>h. h \<Turnstile> A \<longrightarrow> h \<Turnstile> C\<rbrakk> \<Longrightarrow> \<forall>h. h \<Turnstile> A \<longrightarrow> h \<Turnstile> B \<and>\<^sub>A C
[PROOF STEP]
by (auto simp: mod_and_dist)


[STATEMENT]
lemma totalize_JN: "(\<Squnion>i \<in> I. totalize (F i)) = totalize(\<Squnion>i \<in> I. F i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>i\<in>I. totalize (F i)) = totalize (JOIN I F)
[PROOF STEP]
by (simp add: program_equalityI totalize_def JOIN_def image_UN)


[STATEMENT]
lemma sub_sup_left_isotone:
  assumes "-x \<le> -y"
    shows "-x \<squnion> -z \<le> -y \<squnion> -z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - x \<squnion> - z \<le> - y \<squnion> - z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. - x \<squnion> - z \<le> - y \<squnion> - z
[PROOF STEP]
have "-x \<squnion> -y = -y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - x \<squnion> - y = - y
[PROOF STEP]
by (meson assms sub_less_eq_def)
[PROOF STATE]
proof (state)
this:
- x \<squnion> - y = - y

goal (1 subgoal):
 1. - x \<squnion> - z \<le> - y \<squnion> - z
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
- x \<squnion> - y = - y

goal (1 subgoal):
 1. - x \<squnion> - z \<le> - y \<squnion> - z
[PROOF STEP]
by (metis (full_types) sub_associative sub_commutative sub_sup_closed upper_bound_left)
[PROOF STATE]
proof (state)
this:
- x \<squnion> - z \<le> - y \<squnion> - z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma [simp]: "\<lfloor>A\<rfloor> \<squnion> \<lfloor>B\<rfloor> = \<lfloor>A \<union> B\<rfloor> \<and> \<lfloor>A\<rfloor> \<ominus> a = \<lfloor>A - {a}\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>A\<rfloor> \<squnion> \<lfloor>B\<rfloor> = \<lfloor>A \<union> B\<rfloor> \<and> \<lfloor>A\<rfloor> \<ominus> a = \<lfloor>A - {a}\<rfloor>
[PROOF STEP]
by(simp add:hyperset_defs)


[STATEMENT]
lemma ffact_fact:
  "ffact n (of_nat n) = (of_nat (fact n) :: 'a :: comm_ring_1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ffact n (of_nat n) = of_nat (fact n)
[PROOF STEP]
by (induct n) (simp_all add: algebra_simps ffact_Suc)


[STATEMENT]
lemma predE: assumes "k \<noteq> 0" obtains pred where "k = Suc pred"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>pred. k = Suc pred \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms not0_implies_Suc
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 0
?n \<noteq> 0 \<Longrightarrow> \<exists>m. ?n = Suc m

goal (1 subgoal):
 1. (\<And>pred. k = Suc pred \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto


[STATEMENT]
lemma (in PolynRg) polyn_zero_minus_zero:"\<lbrakk>pol_coeff S c; k \<le> (fst c)\<rbrakk> \<Longrightarrow>
       (polyn_expr R X k c = \<zero>) = (polyn_expr R X k (m_cf S c) = \<zero>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S c; k \<le> fst c\<rbrakk> \<Longrightarrow> (polyn_expr R X k c = \<zero>) = (polyn_expr R X k (m_cf S c) = \<zero>)
[PROOF STEP]
apply (cut_tac ring_is_ag)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S c; k \<le> fst c; aGroup R\<rbrakk> \<Longrightarrow> (polyn_expr R X k c = \<zero>) = (polyn_expr R X k (m_cf S c) = \<zero>)
[PROOF STEP]
apply (simp add:polyn_minus_m_cf[THEN sym])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S c; k \<le> fst c; aGroup R\<rbrakk> \<Longrightarrow> (polyn_expr R X k c = \<zero>) = (-\<^sub>a polyn_expr R X k c = \<zero>)
[PROOF STEP]
apply (rule iffI, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>pol_coeff S c; k \<le> fst c; aGroup R; polyn_expr R X k c = \<zero>\<rbrakk> \<Longrightarrow> -\<^sub>a \<zero> = \<zero>
 2. \<lbrakk>pol_coeff S c; k \<le> fst c; aGroup R; -\<^sub>a polyn_expr R X k c = \<zero>\<rbrakk> \<Longrightarrow> polyn_expr R X k c = \<zero>
[PROOF STEP]
apply (simp add:aGroup.ag_inv_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S c; k \<le> fst c; aGroup R; -\<^sub>a polyn_expr R X k c = \<zero>\<rbrakk> \<Longrightarrow> polyn_expr R X k c = \<zero>
[PROOF STEP]
apply (frule polyn_mem[of c k], assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S c; k \<le> fst c; aGroup R; -\<^sub>a polyn_expr R X k c = \<zero>; polyn_expr R X k c \<in> carrier R\<rbrakk> \<Longrightarrow> polyn_expr R X k c = \<zero>
[PROOF STEP]
apply (frule aGroup.ag_inv_inv[of "R" "polyn_expr R X k c"], assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S c; k \<le> fst c; aGroup R; -\<^sub>a polyn_expr R X k c = \<zero>; polyn_expr R X k c \<in> carrier R; -\<^sub>a (-\<^sub>a polyn_expr R X k c) = polyn_expr R X k c\<rbrakk> \<Longrightarrow> polyn_expr R X k c = \<zero>
[PROOF STEP]
apply (simp add:aGroup.ag_inv_zero)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma topr: "-(x \<cdot> \<top>) \<cdot> \<top> = -(x \<cdot> \<top>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (x \<cdot> \<top>) \<cdot> \<top> = - (x \<cdot> \<top>)
[PROOF STEP]
proof (rule order.antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. - (x \<cdot> \<top>) \<cdot> \<top> \<le> - (x \<cdot> \<top>)
 2. - (x \<cdot> \<top>) \<le> - (x \<cdot> \<top>) \<cdot> \<top>
[PROOF STEP]
show "-(x \<cdot> \<top>) \<le> -(x \<cdot> \<top>) \<cdot> \<top>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (x \<cdot> \<top>) \<le> - (x \<cdot> \<top>) \<cdot> \<top>
[PROOF STEP]
by (metis mult_isol_var mult_oner order_refl top_greatest)
[PROOF STATE]
proof (state)
this:
- (x \<cdot> \<top>) \<le> - (x \<cdot> \<top>) \<cdot> \<top>

goal (1 subgoal):
 1. - (x \<cdot> \<top>) \<cdot> \<top> \<le> - (x \<cdot> \<top>)
[PROOF STEP]
have "-(x \<cdot> \<top>) \<sqinter> (x \<cdot> \<top>) = \<bottom>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (x \<cdot> \<top>) \<sqinter> x \<cdot> \<top> = \<bottom>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- (x \<cdot> \<top>) \<sqinter> x \<cdot> \<top> = \<bottom>

goal (1 subgoal):
 1. - (x \<cdot> \<top>) \<cdot> \<top> \<le> - (x \<cdot> \<top>)
[PROOF STEP]
hence "(-(x \<cdot> \<top>) \<sqinter> (x \<cdot> \<top>)) \<cdot> \<top>  = \<bottom>"
[PROOF STATE]
proof (prove)
using this:
- (x \<cdot> \<top>) \<sqinter> x \<cdot> \<top> = \<bottom>

goal (1 subgoal):
 1. (- (x \<cdot> \<top>) \<sqinter> x \<cdot> \<top>) \<cdot> \<top> = \<bottom>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(- (x \<cdot> \<top>) \<sqinter> x \<cdot> \<top>) \<cdot> \<top> = \<bottom>

goal (1 subgoal):
 1. - (x \<cdot> \<top>) \<cdot> \<top> \<le> - (x \<cdot> \<top>)
[PROOF STEP]
hence "-(x \<cdot> \<top>) \<cdot> \<top> \<sqinter> (x \<cdot> \<top>)  = \<bottom>"
[PROOF STATE]
proof (prove)
using this:
(- (x \<cdot> \<top>) \<sqinter> x \<cdot> \<top>) \<cdot> \<top> = \<bottom>

goal (1 subgoal):
 1. - (x \<cdot> \<top>) \<cdot> \<top> \<sqinter> x \<cdot> \<top> = \<bottom>
[PROOF STEP]
by (metis rdv')
[PROOF STATE]
proof (state)
this:
- (x \<cdot> \<top>) \<cdot> \<top> \<sqinter> x \<cdot> \<top> = \<bottom>

goal (1 subgoal):
 1. - (x \<cdot> \<top>) \<cdot> \<top> \<le> - (x \<cdot> \<top>)
[PROOF STEP]
thus "-(x \<cdot> \<top>) \<cdot> \<top> \<le> -(x \<cdot> \<top>)"
[PROOF STATE]
proof (prove)
using this:
- (x \<cdot> \<top>) \<cdot> \<top> \<sqinter> x \<cdot> \<top> = \<bottom>

goal (1 subgoal):
 1. - (x \<cdot> \<top>) \<cdot> \<top> \<le> - (x \<cdot> \<top>)
[PROOF STEP]
by (simp add: inf_bot_iff_le)
[PROOF STATE]
proof (state)
this:
- (x \<cdot> \<top>) \<cdot> \<top> \<le> - (x \<cdot> \<top>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma msb_push_bit_iff:
  \<open>msb (push_bit n w) \<longleftrightarrow> n < word_length TYPE('a) \<and> bit w (word_length TYPE('a) - Suc n)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. word_class.msb (push_bit n w) = (n < word_length TYPE('a) \<and> bit w (word_length TYPE('a) - Suc n))
[PROOF STEP]
by (simp add: msb_def bit_simps le_diff_conv2 Suc_le_eq possible_bit_iff_less_word_length)


[STATEMENT]
lemma D_base_finite'':
  "finite {len m i j xs |xs. set xs \<subseteq> {0..k} \<and> i \<notin> set xs \<and> j \<notin> set xs \<and> distinct xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {len m i j xs |xs. set xs \<subseteq> {0..k} \<and> i \<notin> set xs \<and> j \<notin> set xs \<and> distinct xs}
[PROOF STEP]
using D_base_finite[of m i j k]
[PROOF STATE]
proof (prove)
using this:
finite {len m i j xs |xs. set xs \<subseteq> {0..k} \<and> distinct xs}

goal (1 subgoal):
 1. finite {len m i j xs |xs. set xs \<subseteq> {0..k} \<and> i \<notin> set xs \<and> j \<notin> set xs \<and> distinct xs}
[PROOF STEP]
by - (rule finite_subset, auto)


[STATEMENT]
lemma exists_algorithm_is_SNF_imp_admits_diagonal_reduction:
  assumes "A \<in> carrier_mat m n"
  and "\<exists>algorithm. is_SNF A (algorithm A)"
  shows "admits_diagonal_reduction A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. admits_diagonal_reduction A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat m n
\<exists>algorithm. is_SNF A (algorithm A)

goal (1 subgoal):
 1. admits_diagonal_reduction A
[PROOF STEP]
unfolding is_SNF_def admits_diagonal_reduction_def
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat m n
\<exists>algorithm. case algorithm A of (P, S, Q) \<Rightarrow> P \<in> carrier_mat (dim_row A) (dim_row A) \<and> Q \<in> carrier_mat (dim_col A) (dim_col A) \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat S \<and> S = P * A * Q

goal (1 subgoal):
 1. \<exists>P Q. P \<in> carrier_mat (dim_row A) (dim_row A) \<and> Q \<in> carrier_mat (dim_col A) (dim_col A) \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q)
[PROOF STEP]
by auto