[STATEMENT]
theorem sum_of_2_squares_nat_iff:
  "sum_of_2_squares_nat n \<longleftrightarrow>
     n = 0 \<or> (\<forall>p\<in>prime_factors n. [p = 3] (mod 4) \<longrightarrow> even (multiplicity p n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_of_2_squares_nat n = (n = 0 \<or> (\<forall>p\<in>#prime_factorization n. [p = 3] (mod 4) \<longrightarrow> even (multiplicity p n)))
[PROOF STEP]
using sum_of_2_squares_nat_necessary[of n] sum_of_2_squares_nat_sufficient[of n]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>sum_of_2_squares_nat n; 0 < n; prime ?p; [?p = 3] (mod 4)\<rbrakk> \<Longrightarrow> even (multiplicity ?p n)
\<lbrakk>0 < n; \<And>p. \<lbrakk>p \<in># prime_factorization n; [p = 3] (mod 4)\<rbrakk> \<Longrightarrow> even (multiplicity p n)\<rbrakk> \<Longrightarrow> sum_of_2_squares_nat n

goal (1 subgoal):
 1. sum_of_2_squares_nat n = (n = 0 \<or> (\<forall>p\<in>#prime_factorization n. [p = 3] (mod 4) \<longrightarrow> even (multiplicity p n)))
[PROOF STEP]
by auto


[STATEMENT]
lemma eccentricity_Max_alt:
  assumes "v \<in> V"
  assumes "V \<noteq> {v}"
  shows "eccentricity v = Max ((\<lambda> u. shortest_path v u) ` (V - {v}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eccentricity v = Max (shortest_path v ` (V - {v}))
[PROOF STEP]
unfolding eccentricity_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (shortest_path v ` (V - {v})) = Max (shortest_path v ` (V - {v}))
[PROOF STEP]
using assms Sup_enat_def finV not_empty
[PROOF STATE]
proof (prove)
using this:
v \<in> V
V \<noteq> {v}
Sup ?A = (if ?A = {} then 0 else if finite ?A then Max ?A else \<infinity>)
finite V
V \<noteq> {}

goal (1 subgoal):
 1. Sup (shortest_path v ` (V - {v})) = Max (shortest_path v ` (V - {v}))
[PROOF STEP]
by auto


[STATEMENT]
lemma RPDs_Times: "RPDs (MTimes r s) \<subseteq> {MTimes r s} \<union> MTimesL r (RPDs s) \<union> RPDs r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. RPDs (MTimes r s) \<subseteq> {MTimes r s} \<union> MTimesL r (RPDs s) \<union> RPDs r
[PROOF STEP]
unfolding RPDs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>i. RPDi i (MTimes r s)) \<subseteq> {MTimes r s} \<union> MTimesL r (\<Union>i. RPDi i s) \<union> (\<Union>i. RPDi i r)
[PROOF STEP]
using RPDi_Times[of _ r s]
[PROOF STATE]
proof (prove)
using this:
RPDi ?i (MTimes r s) \<subseteq> {MTimes r s} \<union> MTimesL r (\<Union>j\<le>?i. RPDi j s) \<union> (\<Union>j\<le>?i. RPDi j r)

goal (1 subgoal):
 1. (\<Union>i. RPDi i (MTimes r s)) \<subseteq> {MTimes r s} \<union> MTimesL r (\<Union>i. RPDi i s) \<union> (\<Union>i. RPDi i r)
[PROOF STEP]
by (force simp: MTimesL_def)


[STATEMENT]
lemma "((\<lambda>x::real. (3 powr x + 5 powr x) powr (1/x)) \<longlongrightarrow> 5) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. (3 powr x + 5 powr x) powr (1 / x)) \<longlongrightarrow> 5) at_top
[PROOF STEP]
by real_asymp


[STATEMENT]
lemma (in strategic_space_2p) U\<^sub>A\<^sub>B_is_gate:
  shows "gate 2 (U\<^sub>A \<Otimes> U\<^sub>B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gate 2 (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] \<Otimes> Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gate 2 (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] \<Otimes> Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
[PROOF STEP]
have "gate (1+1) (U\<^sub>A \<Otimes> U\<^sub>B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gate (1 + 1) (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] \<Otimes> Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
[PROOF STEP]
using U\<^sub>A\<^sub>_is_gate U\<^sub>B_is_gate tensor_gate[of "1" "U\<^sub>A" "1" "U\<^sub>B"]
[PROOF STATE]
proof (prove)
using this:
gate 1 (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]])
gate 1 (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
\<lbrakk>gate 1 (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]]); gate 1 (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])\<rbrakk> \<Longrightarrow> gate (1 + 1) (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] \<Otimes> Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])

goal (1 subgoal):
 1. gate (1 + 1) (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] \<Otimes> Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
gate (1 + 1) (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] \<Otimes> Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])

goal (1 subgoal):
 1. gate 2 (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] \<Otimes> Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
gate (1 + 1) (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] \<Otimes> Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
gate (1 + 1) (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] \<Otimes> Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])

goal (1 subgoal):
 1. gate 2 (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] \<Otimes> Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])
[PROOF STEP]
by (auto simp add: numeral_2_eq_2)
[PROOF STATE]
proof (state)
this:
gate 2 (Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2)) # map complex_of_real [- sin (\<theta>\<^sub>A / 2)], [complex_of_real (sin (\<theta>\<^sub>A / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>A) * complex_of_real (cos (\<theta>\<^sub>A / 2))]] \<Otimes> Tensor.mat_of_cols_list 2 [exp (\<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2)) # map complex_of_real [- sin (\<theta>\<^sub>B / 2)], [complex_of_real (sin (\<theta>\<^sub>B / 2)), exp (- \<i> * complex_of_real \<phi>\<^sub>B) * complex_of_real (cos (\<theta>\<^sub>B / 2))]])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "((a::nat) - (b - (c - (d - e)))) = (a - (b - (c - (d - e))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a - (b - (c - (d - e))) = a - (b - (c - (d - e)))
[PROOF STEP]
by linarith


[STATEMENT]
lemma interval_lebesgue_integral_0_infty:
  "interval_lebesgue_integrable M 0 \<infinity> f \<longleftrightarrow> set_integrable M {0<..} f"
  "interval_lebesgue_integral M 0 \<infinity> f = (LINT x:{0<..}|M. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interval_lebesgue_integrable M 0 \<infinity> f = set_integrable M {0<..} f &&& interval_lebesgue_integral M 0 \<infinity> f = set_lebesgue_integral M {0<..} f
[PROOF STEP]
unfolding zero_ereal_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interval_lebesgue_integrable M (ereal 0) \<infinity> f = set_integrable M {0<..} f &&& interval_lebesgue_integral M (ereal 0) \<infinity> f = set_lebesgue_integral M {0<..} f
[PROOF STEP]
by (auto simp: interval_lebesgue_integral_le_eq interval_lebesgue_integrable_def)


[STATEMENT]
lemma dot_matrix_vector_mul:
  fixes A B :: "real ^'n ^'n" and x y :: "real ^'n"
  shows "(A *v x) \<bullet> (B *v y) =
      (((rowvector x :: real^'n^1) ** ((transpose A ** B) ** (columnvector y :: real ^1^'n)))$1)$1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A *v x) \<bullet> (B *v y) = (rowvector x ** (Finite_Cartesian_Product.transpose A ** B ** columnvector y)) $ 1 $ 1
[PROOF STEP]
unfolding dot_matrix_product transpose_columnvector[symmetric]
    dot_rowvector_columnvector matrix_transpose_mul matrix_mul_assoc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Finite_Cartesian_Product.transpose (columnvector x) ** Finite_Cartesian_Product.transpose A ** B ** columnvector y) $ 1 $ 1 = (Finite_Cartesian_Product.transpose (columnvector x) ** Finite_Cartesian_Product.transpose A ** B ** columnvector y) $ 1 $ 1
[PROOF STEP]
..


[STATEMENT]
lemma pow_combine_mono:
    fixes S :: "'a set set"
    and   X :: "'a set"
    and   Y :: "'a set"
    assumes a1: "\<forall> F \<in> S. F \<subseteq> X"
    shows "\<forall> F \<in> pow_combine Y S. F \<subseteq> Y \<union> X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>F\<in>pow_combine Y S. F \<subseteq> Y \<union> X
[PROOF STEP]
apply(simp add: pow_combine_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>F\<in>(\<Union>X\<in>Pow Y. \<Union>Y\<in>S. {X \<union> Y}) \<union> Pow Y. F \<subseteq> Y \<union> X
[PROOF STEP]
apply(rule)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>F. F \<in> (\<Union>X\<in>Pow Y. \<Union>Y\<in>S. {X \<union> Y}) \<union> Pow Y \<Longrightarrow> F \<subseteq> Y \<union> X
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>F. (\<exists>x\<in>Pow Y. \<exists>xa\<in>S. F = x \<union> xa) \<or> F \<subseteq> Y \<Longrightarrow> F \<subseteq> Y \<union> X
[PROOF STEP]
by (metis Pow_iff assms sup.coboundedI1 sup.orderE sup.orderI sup_assoc)


[STATEMENT]
lemma fine_Int: "(\<lambda>x. d1 x \<inter> d2 x) fine p \<longleftrightarrow> d1 fine p \<and> d2 fine p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. d1 x \<inter> d2 x) fine p) = (d1 fine p \<and> d2 fine p)
[PROOF STEP]
unfolding fine_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>(x, k)\<in>p. k \<subseteq> d1 x \<inter> d2 x) = ((\<forall>(x, k)\<in>p. k \<subseteq> d1 x) \<and> (\<forall>(x, k)\<in>p. k \<subseteq> d2 x))
[PROOF STEP]
by auto


[STATEMENT]
lemma card_le_length: "Finite_Set.card (relations t) \<le> length (inorder t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Set.card (relations t) \<le> length (inorder t)
[PROOF STEP]
apply(induction t)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. Finite_Set.card (relations (Relation x)) \<le> length (inorder (Relation x))
 2. \<And>t1 t2. \<lbrakk>Finite_Set.card (relations t1) \<le> length (inorder t1); Finite_Set.card (relations t2) \<le> length (inorder t2)\<rbrakk> \<Longrightarrow> Finite_Set.card (relations (Join t1 t2)) \<le> length (inorder (Join t1 t2))
[PROOF STEP]
apply(auto)[2]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>Finite_Set.card (relations t1) \<le> length (inorder t1); Finite_Set.card (relations t2) \<le> length (inorder t2)\<rbrakk> \<Longrightarrow> Finite_Set.card (relations t1 \<union> relations t2) \<le> length (inorder t1) + length (inorder t2)
[PROOF STEP]
by (meson add_mono card_Un_le le_trans)


[STATEMENT]
lemma iso_hom_induced_inclusion_contractible:
  assumes "contractible_space X" "contractible_space(subtopology X S)" "T \<subseteq> S" "topspace X \<inter> S \<noteq> {}"
  shows "(hom_induced p (subtopology X S) T X T id)
         \<in> iso (relative_homology_group p (subtopology X S) T) (relative_homology_group p X T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom_induced p (subtopology X S) T X T id \<in> Group.iso (relative_homology_group p (subtopology X S) T) (relative_homology_group p X T)
[PROOF STEP]
proof (rule very_short_exact_sequence)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. exact_seq ([?D, relative_homology_group p X T, relative_homology_group p (subtopology X S) T, ?A], [?h, hom_induced p (subtopology X S) T X T id, ?f])
 2. trivial_group ?A
 3. trivial_group ?D
[PROOF STEP]
show "exact_seq
         ([relative_homology_group p X S, relative_homology_group p X T,
           relative_homology_group p (subtopology X S) T, relative_homology_group (p+1) X S],
          [hom_induced p X T X S id, hom_induced p (subtopology X S) T X T id, hom_relboundary (p+1) X S T])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exact_seq ([relative_homology_group p X S, relative_homology_group p X T, relative_homology_group p (subtopology X S) T, relative_homology_group (p + 1) X S], [hom_induced p X T X S id, hom_induced p (subtopology X S) T X T id, hom_relboundary (p + 1) X S T])
[PROOF STEP]
using homology_exactness_triple_2 [OF \<open>T \<subseteq> S\<close>] homology_exactness_triple_3 [OF \<open>T \<subseteq> S\<close>]
[PROOF STATE]
proof (prove)
using this:
exact_seq ([relative_homology_group (?p - 1) ?X T, relative_homology_group (?p - 1) (subtopology ?X S) T, relative_homology_group ?p ?X S], [hom_induced (?p - 1) (subtopology ?X S) T ?X T id, hom_relboundary ?p ?X S T])
exact_seq ([relative_homology_group ?p ?X S, relative_homology_group ?p ?X T, relative_homology_group ?p (subtopology ?X S) T], [hom_induced ?p ?X T ?X S id, hom_induced ?p (subtopology ?X S) T ?X T id])

goal (1 subgoal):
 1. exact_seq ([relative_homology_group p X S, relative_homology_group p X T, relative_homology_group p (subtopology X S) T, relative_homology_group (p + 1) X S], [hom_induced p X T X S id, hom_induced p (subtopology X S) T X T id, hom_relboundary (p + 1) X S T])
[PROOF STEP]
by (metis add_diff_cancel_left' diff_add_cancel exact_seq_cons_iff)
[PROOF STATE]
proof (state)
this:
exact_seq ([relative_homology_group p X S, relative_homology_group p X T, relative_homology_group p (subtopology X S) T, relative_homology_group (p + 1) X S], [hom_induced p X T X S id, hom_induced p (subtopology X S) T X T id, hom_relboundary (p + 1) X S T])

goal (2 subgoals):
 1. trivial_group (relative_homology_group (p + 1) X S)
 2. trivial_group (relative_homology_group p X S)
[PROOF STEP]
show "trivial_group (relative_homology_group (p+1) X S)" "trivial_group (relative_homology_group p X S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trivial_group (relative_homology_group (p + 1) X S) &&& trivial_group (relative_homology_group p X S)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
contractible_space X
contractible_space (subtopology X S)
T \<subseteq> S
topspace X \<inter> S \<noteq> {}

goal (1 subgoal):
 1. trivial_group (relative_homology_group (p + 1) X S) &&& trivial_group (relative_homology_group p X S)
[PROOF STEP]
by (auto simp: subtopology_subtopology topspace_subtopology intro!: trivial_relative_homology_group_contractible_spaces)
[PROOF STATE]
proof (state)
this:
trivial_group (relative_homology_group (p + 1) X S)
trivial_group (relative_homology_group p X S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma minus1_div2: "(n - Suc 0) div 2 = (if odd n then n div 2 else n div 2 - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n - Suc 0) div 2 = (if odd n then n div 2 else n div 2 - 1)
[PROOF STEP]
by auto arith


[STATEMENT]
lemma ldistinct_lmerge:
  "\<lbrakk> lsorted xs; lsorted ys; ldistinct xs; ldistinct ys \<rbrakk>
  \<Longrightarrow> ldistinct (lmerge xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>lsorted xs; lsorted ys; ldistinct xs; ldistinct ys\<rbrakk> \<Longrightarrow> ldistinct (lmerge xs ys)
[PROOF STEP]
by(coinduction arbitrary: xs ys)(auto 4 3 simp add: lhd_lmerge ltl_lmerge not_lnull_conv lsorted_LCons not_less dest!: in_lset_lmergeD dest: order.antisym)


[STATEMENT]
lemma geod_dist3:
  assumes "a \<le> 2^n" "b \<le> 2^p"
  shows "dist (geod n a) (geod p b) = abs(b/2^p - a/2^n) * dist x0 y0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (geod n a) (geod p b) = \<bar>real b / 2 ^ p - real a / 2 ^ n\<bar> * dist x0 y0
[PROOF STEP]
apply (cases "a /2^n \<le> b/2^p", auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. real a / 2 ^ n \<le> real b / 2 ^ p \<Longrightarrow> dist (geod n a) (geod p b) = (real b / 2 ^ p - real a / 2 ^ n) * dist x0 y0
 2. \<not> real a / 2 ^ n \<le> real b / 2 ^ p \<Longrightarrow> dist (geod n a) (geod p b) = (real a / 2 ^ n - real b / 2 ^ p) * dist x0 y0
[PROOF STEP]
apply (rule geod_dist2[OF assms], auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> real a / 2 ^ n \<le> real b / 2 ^ p \<Longrightarrow> dist (geod n a) (geod p b) = (real a / 2 ^ n - real b / 2 ^ p) * dist x0 y0
[PROOF STEP]
apply (subst dist_commute, rule geod_dist2[OF assms(2) assms(1)], auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma "count_true (vec (1::nat) (\<lambda>i. True)) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_true (vec 1 (\<lambda>i. True)) = 1
[PROOF STEP]
unfolding count_true_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec (vec 1 (\<lambda>i. True)). if vec 1 (\<lambda>i. True) $ i then 1 else 0) = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma frag_len_filter_le:
  fixes P l' l
  assumes "sublist l' l"
  shows "length (filter P l') \<le> length (filter P l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (filter P l') \<le> length (filter P l)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length (filter P l') \<le> length (filter P l)
[PROOF STEP]
obtain ps ss where "l = ps @ l' @ ss"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>ps ss. l = ps @ l' @ ss \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms sublist_def
[PROOF STATE]
proof (prove)
using this:
sublist l' l
sublist ?xs ?ys = (\<exists>ps ss. ?ys = ps @ ?xs @ ss)

goal (1 subgoal):
 1. (\<And>ps ss. l = ps @ l' @ ss \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
l = ps @ l' @ ss

goal (1 subgoal):
 1. length (filter P l') \<le> length (filter P l)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
l = ps @ l' @ ss
[PROOF STEP]
have 1:
    "length (filter P l) = length (filter P ps) + length (filter P l') + length (filter P ss)"
[PROOF STATE]
proof (prove)
using this:
l = ps @ l' @ ss

goal (1 subgoal):
 1. length (filter P l) = length (filter P ps) + length (filter P l') + length (filter P ss)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
length (filter P l) = length (filter P ps) + length (filter P l') + length (filter P ss)

goal (1 subgoal):
 1. length (filter P l') \<le> length (filter P l)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (filter P l) = length (filter P ps) + length (filter P l') + length (filter P ss)
[PROOF STEP]
have "length (filter P ps) \<ge> 0" "length (filter P ss) \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
length (filter P l) = length (filter P ps) + length (filter P l') + length (filter P ss)

goal (1 subgoal):
 1. 0 \<le> length (filter P ps) &&& 0 \<le> length (filter P ss)
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
0 \<le> length (filter P ps)
0 \<le> length (filter P ss)

goal (1 subgoal):
 1. length (filter P l') \<le> length (filter P l)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> length (filter P ps)
0 \<le> length (filter P ss)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> length (filter P ps)
0 \<le> length (filter P ss)

goal (1 subgoal):
 1. length (filter P l') \<le> length (filter P l)
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
0 \<le> length (filter P ps)
0 \<le> length (filter P ss)
length (filter P l) = length (filter P ps) + length (filter P l') + length (filter P ss)

goal (1 subgoal):
 1. length (filter P l') \<le> length (filter P l)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
length (filter P l') \<le> length (filter P l)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Lcm_Un: "Lcm (A \<union> B) = lcm (Lcm A) (Lcm B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lcm (A \<union> B) = lcm (Lcm A) (Lcm B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Lcm (A \<union> B) = lcm (Lcm A) (Lcm B)
[PROOF STEP]
have "\<And>d. \<lbrakk>Lcm A dvd d; Lcm B dvd d\<rbrakk> \<Longrightarrow> Lcm (A \<union> B) dvd d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>d. \<lbrakk>Lcm A dvd d; Lcm B dvd d\<rbrakk> \<Longrightarrow> Lcm (A \<union> B) dvd d
[PROOF STEP]
by (meson UnE Lcm_least dvd_Lcm dvd_trans)
[PROOF STATE]
proof (state)
this:
\<lbrakk>Lcm A dvd ?d1; Lcm B dvd ?d1\<rbrakk> \<Longrightarrow> Lcm (A \<union> B) dvd ?d1

goal (1 subgoal):
 1. Lcm (A \<union> B) = lcm (Lcm A) (Lcm B)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>Lcm A dvd ?d1; Lcm B dvd ?d1\<rbrakk> \<Longrightarrow> Lcm (A \<union> B) dvd ?d1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Lcm A dvd ?d1; Lcm B dvd ?d1\<rbrakk> \<Longrightarrow> Lcm (A \<union> B) dvd ?d1

goal (1 subgoal):
 1. Lcm (A \<union> B) = lcm (Lcm A) (Lcm B)
[PROOF STEP]
by (meson Lcm_subset lcm_unique normalize_Lcm sup.cobounded1 sup.cobounded2)
[PROOF STATE]
proof (state)
this:
Lcm (A \<union> B) = lcm (Lcm A) (Lcm B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Gromov_product_geodesic_segment:
  assumes "geodesic_segment_between G x y" "t \<in> {0..dist x y}"
  shows "Gromov_product_at x y (geodesic_segment_param G x t) = t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gromov_product_at x y (geodesic_segment_param G x t) = t
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Gromov_product_at x y (geodesic_segment_param G x t) = t
[PROOF STEP]
have "dist x (geodesic_segment_param G x t) = t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x (geodesic_segment_param G x t) = t
[PROOF STEP]
using assms(1) assms(2) geodesic_segment_param(6)
[PROOF STATE]
proof (prove)
using this:
geodesic_segment_between G x y
t \<in> {0..dist x y}
\<lbrakk>geodesic_segment_between ?G ?x ?y; ?t \<in> {0..dist ?x ?y}\<rbrakk> \<Longrightarrow> dist ?x (geodesic_segment_param ?G ?x ?t) = ?t

goal (1 subgoal):
 1. dist x (geodesic_segment_param G x t) = t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dist x (geodesic_segment_param G x t) = t

goal (1 subgoal):
 1. Gromov_product_at x y (geodesic_segment_param G x t) = t
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
dist x (geodesic_segment_param G x t) = t

goal (1 subgoal):
 1. Gromov_product_at x y (geodesic_segment_param G x t) = t
[PROOF STEP]
have "dist y (geodesic_segment_param G x t) = dist x y - t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist y (geodesic_segment_param G x t) = dist x y - t
[PROOF STEP]
by (metis \<open>dist x (geodesic_segment_param G x t) = t\<close> add_diff_cancel_left' assms(1) assms(2) dist_commute geodesic_segment_dist geodesic_segment_param(3))
[PROOF STATE]
proof (state)
this:
dist y (geodesic_segment_param G x t) = dist x y - t

goal (1 subgoal):
 1. Gromov_product_at x y (geodesic_segment_param G x t) = t
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
dist x (geodesic_segment_param G x t) = t
dist y (geodesic_segment_param G x t) = dist x y - t
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dist x (geodesic_segment_param G x t) = t
dist y (geodesic_segment_param G x t) = dist x y - t

goal (1 subgoal):
 1. Gromov_product_at x y (geodesic_segment_param G x t) = t
[PROOF STEP]
unfolding Gromov_product_at_def
[PROOF STATE]
proof (prove)
using this:
dist x (geodesic_segment_param G x t) = t
dist y (geodesic_segment_param G x t) = dist x y - t

goal (1 subgoal):
 1. (dist x y + dist x (geodesic_segment_param G x t) - dist y (geodesic_segment_param G x t)) / 2 = t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Gromov_product_at x y (geodesic_segment_param G x t) = t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closed_negations:
  fixes S :: "'a::real_normed_vector set"
  assumes "closed S"
  shows "closed ((\<lambda>x. -x) ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed (uminus ` S)
[PROOF STEP]
using closed_scaling[OF assms, of "- 1"]
[PROOF STATE]
proof (prove)
using this:
closed ((*\<^sub>R) (- 1) ` S)

goal (1 subgoal):
 1. closed (uminus ` S)
[PROOF STEP]
by simp


[STATEMENT]
lemma tan_less_zero:
  assumes "- pi/2 < x" and "x < 0"
  shows "tan x < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tan x < 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. tan x < 0
[PROOF STEP]
have "0 < tan (- x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < tan (- x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
- pi / 2 < x
x < 0

goal (1 subgoal):
 1. 0 < tan (- x)
[PROOF STEP]
by (simp only: tan_gt_zero)
[PROOF STATE]
proof (state)
this:
0 < tan (- x)

goal (1 subgoal):
 1. tan x < 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < tan (- x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < tan (- x)

goal (1 subgoal):
 1. tan x < 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
tan x < 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lim_null_mult_right_bounded:
  fixes f :: "'a \<Rightarrow> 'b::real_normed_div_algebra"
  assumes f: "(f \<longlongrightarrow> 0) F" and g: "eventually (\<lambda>x. norm(g x) \<le> B) F"
    shows "((\<lambda>z. f z * g z) \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>z. f z * g z) \<longlongrightarrow> (0::'b)) F
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>z. f z * g z) \<longlongrightarrow> (0::'b)) F
[PROOF STEP]
have "((\<lambda>x. norm (f x) * norm (g x)) \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. norm (f x) * norm (g x)) \<longlongrightarrow> 0) F
[PROOF STEP]
proof (rule Lim_null_comparison)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>\<^sub>F x in F. norm (norm (f x) * norm (g x)) \<le> ?g x
 2. (?g \<longlongrightarrow> 0) F
[PROOF STEP]
show "\<forall>\<^sub>F x in F. norm (norm (f x) * norm (g x)) \<le> norm (f x) * B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. norm (norm (f x) * norm (g x)) \<le> norm (f x) * B
[PROOF STEP]
by (simp add: eventually_mono [OF g] mult_left_mono)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. norm (norm (f x) * norm (g x)) \<le> norm (f x) * B

goal (1 subgoal):
 1. ((\<lambda>x. norm (f x) * B) \<longlongrightarrow> 0) F
[PROOF STEP]
show "((\<lambda>x. norm (f x) * B) \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. norm (f x) * B) \<longlongrightarrow> 0) F
[PROOF STEP]
by (simp add: f tendsto_mult_left_zero tendsto_norm_zero)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. norm (f x) * B) \<longlongrightarrow> 0) F

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
((\<lambda>x. norm (f x) * norm (g x)) \<longlongrightarrow> 0) F

goal (1 subgoal):
 1. ((\<lambda>z. f z * g z) \<longlongrightarrow> (0::'b)) F
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. norm (f x) * norm (g x)) \<longlongrightarrow> 0) F
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. norm (f x) * norm (g x)) \<longlongrightarrow> 0) F

goal (1 subgoal):
 1. ((\<lambda>z. f z * g z) \<longlongrightarrow> (0::'b)) F
[PROOF STEP]
by (subst tendsto_norm_zero_iff [symmetric]) (simp add: norm_mult)
[PROOF STATE]
proof (state)
this:
((\<lambda>z. f z * g z) \<longlongrightarrow> (0::'b)) F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem pr_rec_scheme: "\<lbrakk> g \<in> PrimRec1; h \<in> PrimRec3; \<forall> x. f 0 x = g x; \<forall> x y. f (Suc y) x = h y (f y x) x \<rbrakk> \<Longrightarrow> f \<in> PrimRec2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
assume g_is_pr: "g \<in> PrimRec1"
[PROOF STATE]
proof (state)
this:
g \<in> PrimRec1

goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
assume h_is_pr: "h \<in> PrimRec3"
[PROOF STATE]
proof (state)
this:
h \<in> PrimRec3

goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
assume f_at_0: "\<forall> x. f 0 x = g x"
[PROOF STATE]
proof (state)
this:
\<forall>x. f 0 x = g x

goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
assume f_at_Suc: "\<forall> x y. f (Suc y) x = h y (f y x) x"
[PROOF STATE]
proof (state)
this:
\<forall>x y. f (Suc y) x = h y (f y x) x

goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
from f_at_0 f_at_Suc
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. f 0 x = g x
\<forall>x y. f (Suc y) x = h y (f y x) x
[PROOF STEP]
have "\<And> x y. f y x  = PrimRecOp g h y x"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. f 0 x = g x
\<forall>x y. f (Suc y) x = h y (f y x) x

goal (1 subgoal):
 1. \<And>x y. f y x = PrimRecOp g h y x
[PROOF STEP]
by (induct_tac y, simp_all)
[PROOF STATE]
proof (state)
this:
f ?y ?x = PrimRecOp g h ?y ?x

goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f ?y ?x = PrimRecOp g h ?y ?x
[PROOF STEP]
have "f = PrimRecOp g h"
[PROOF STATE]
proof (prove)
using this:
f ?y ?x = PrimRecOp g h ?y ?x

goal (1 subgoal):
 1. f = PrimRecOp g h
[PROOF STEP]
by (simp add: ext)
[PROOF STATE]
proof (state)
this:
f = PrimRecOp g h

goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
with g_is_pr h_is_pr
[PROOF STATE]
proof (chain)
picking this:
g \<in> PrimRec1
h \<in> PrimRec3
f = PrimRecOp g h
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
g \<in> PrimRec1
h \<in> PrimRec3
f = PrimRecOp g h

goal (1 subgoal):
 1. f \<in> PrimRec2
[PROOF STEP]
by (simp add: pr_rec)
[PROOF STATE]
proof (state)
this:
f \<in> PrimRec2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma split_int_eq_real': "(real_of_int (a::int) + b = 0) = ( a - \<lfloor>- b\<rfloor> = 0 \<and> real_of_int \<lfloor>- b\<rfloor> + b = 0)" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real_of_int a + b = 0) = (a - \<lfloor>- b\<rfloor> = 0 \<and> real_of_int \<lfloor>- b\<rfloor> + b = 0)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (real_of_int a + b = 0) = (a - \<lfloor>- b\<rfloor> = 0 \<and> real_of_int \<lfloor>- b\<rfloor> + b = 0)
[PROOF STEP]
have "?l = (real_of_int a = -b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real_of_int a + b = 0) = (real_of_int a = - b)
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
(real_of_int a + b = 0) = (real_of_int a = - b)

goal (1 subgoal):
 1. (real_of_int a + b = 0) = (a - \<lfloor>- b\<rfloor> = 0 \<and> real_of_int \<lfloor>- b\<rfloor> + b = 0)
[PROOF STEP]
with split_int_eq_real[where a="a" and b="-b"]
[PROOF STATE]
proof (chain)
picking this:
(real_of_int a = - b) = (a = \<lfloor>- b\<rfloor> \<and> - b = real_of_int \<lfloor>- b\<rfloor>)
(real_of_int a + b = 0) = (real_of_int a = - b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(real_of_int a = - b) = (a = \<lfloor>- b\<rfloor> \<and> - b = real_of_int \<lfloor>- b\<rfloor>)
(real_of_int a + b = 0) = (real_of_int a = - b)

goal (1 subgoal):
 1. (real_of_int a + b = 0) = (a - \<lfloor>- b\<rfloor> = 0 \<and> real_of_int \<lfloor>- b\<rfloor> + b = 0)
[PROOF STEP]
by simp arith
[PROOF STATE]
proof (state)
this:
(real_of_int a + b = 0) = (a - \<lfloor>- b\<rfloor> = 0 \<and> real_of_int \<lfloor>- b\<rfloor> + b = 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_union_inter_fset:
  shows "card_fset xs + card_fset ys = card_fset (xs |\<union>| ys) + card_fset (xs |\<inter>| ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card_fset xs + card_fset ys = card_fset (xs |\<union>| ys) + card_fset (xs |\<inter>| ys)
[PROOF STEP]
unfolding card_fset union_fset inter_fset
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (fset xs) + card (fset ys) = card (fset xs \<union> fset ys) + card (fset xs \<inter> fset ys)
[PROOF STEP]
by (rule card_Un_Int[OF finite_fset finite_fset])


[STATEMENT]
lemma Fourier_coefficient_add:
  assumes "f absolutely_integrable_on {-pi..pi}" "g absolutely_integrable_on {-pi..pi}"
  shows "Fourier_coefficient (\<lambda>x. f x + g x) i =
                Fourier_coefficient f i + Fourier_coefficient g i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fourier_coefficient (\<lambda>x. f x + g x) i = Fourier_coefficient f i + Fourier_coefficient g i
[PROOF STEP]
using assms trigonometric_set_mul_integrable
[PROOF STATE]
proof (prove)
using this:
f absolutely_integrable_on {- pi..pi}
g absolutely_integrable_on {- pi..pi}
?f absolutely_integrable_on {- pi..pi} \<Longrightarrow> integrable (lebesgue_on {- pi..pi}) (\<lambda>x. trigonometric_set ?n x * ?f x)

goal (1 subgoal):
 1. Fourier_coefficient (\<lambda>x. f x + g x) i = Fourier_coefficient f i + Fourier_coefficient g i
[PROOF STEP]
by (simp add: Fourier_coefficient_def orthonormal_coeff_def l2product_def distrib_left)


[STATEMENT]
lemma ordIso_Pow_cong[simp]:
assumes "r =o r'"
shows "|Pow(Field r)| =o |Pow(Field r')|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |Pow (Field r)| =o |Pow (Field r')|
[PROOF STEP]
using assms card_of_cong card_of_Pow_cong
[PROOF STATE]
proof (prove)
using this:
r =o r'
?r =o ?r' \<Longrightarrow> |Field ?r| =o |Field ?r'|
|?A| =o |?B| \<Longrightarrow> |Pow ?A| =o |Pow ?B|

goal (1 subgoal):
 1. |Pow (Field r)| =o |Pow (Field r')|
[PROOF STEP]
by blast


[STATEMENT]
lemma lemma_3_5_i_2: "(d2 a b = 1) = (a = b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (d2 a b = (1::'a)) = (a = b)
[PROOF STEP]
apply (simp add: d2_def right_lesseq [THEN sym])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<le> b \<and> b \<le> a) = (a = b)
[PROOF STEP]
by auto


[STATEMENT]
lemma convex_onI [intro?]:
  assumes "\<And>t x y. t > 0 \<Longrightarrow> t < 1 \<Longrightarrow> x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow>
    f ((1 - t) *\<^sub>R x + t *\<^sub>R y) \<le> (1 - t) * f x + t * f y"
  shows "convex_on A f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_on A f
[PROOF STEP]
unfolding convex_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>A. \<forall>y\<in>A. \<forall>u\<ge>0. \<forall>v\<ge>0. u + v = 1 \<longrightarrow> f (u *\<^sub>R x + v *\<^sub>R y) \<le> u * f x + v * f y
[PROOF STEP]
proof clarify
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> A; y \<in> A; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> f (u *\<^sub>R x + v *\<^sub>R y) \<le> u * f x + v * f y
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> A; y \<in> A; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> f (u *\<^sub>R x + v *\<^sub>R y) \<le> u * f x + v * f y
[PROOF STEP]
fix u v :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> A; y \<in> A; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> f (u *\<^sub>R x + v *\<^sub>R y) \<le> u * f x + v * f y
[PROOF STEP]
assume A: "x \<in> A" "y \<in> A" "u \<ge> 0" "v \<ge> 0" "u + v = 1"
[PROOF STATE]
proof (state)
this:
x \<in> A
y \<in> A
0 \<le> u
0 \<le> v
u + v = 1

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> A; y \<in> A; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> f (u *\<^sub>R x + v *\<^sub>R y) \<le> u * f x + v * f y
[PROOF STEP]
from A(5)
[PROOF STATE]
proof (chain)
picking this:
u + v = 1
[PROOF STEP]
have [simp]: "v = 1 - u"
[PROOF STATE]
proof (prove)
using this:
u + v = 1

goal (1 subgoal):
 1. v = 1 - u
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
v = 1 - u

goal (1 subgoal):
 1. \<And>x y u v. \<lbrakk>x \<in> A; y \<in> A; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> f (u *\<^sub>R x + v *\<^sub>R y) \<le> u * f x + v * f y
[PROOF STEP]
from A(1-4)
[PROOF STATE]
proof (chain)
picking this:
x \<in> A
y \<in> A
0 \<le> u
0 \<le> v
[PROOF STEP]
show "f (u *\<^sub>R x + v *\<^sub>R y) \<le> u * f x + v * f y"
[PROOF STATE]
proof (prove)
using this:
x \<in> A
y \<in> A
0 \<le> u
0 \<le> v

goal (1 subgoal):
 1. f (u *\<^sub>R x + v *\<^sub>R y) \<le> u * f x + v * f y
[PROOF STEP]
using assms[of u y x]
[PROOF STATE]
proof (prove)
using this:
x \<in> A
y \<in> A
0 \<le> u
0 \<le> v
\<lbrakk>0 < u; u < 1; y \<in> A; x \<in> A\<rbrakk> \<Longrightarrow> f ((1 - u) *\<^sub>R y + u *\<^sub>R x) \<le> (1 - u) * f y + u * f x

goal (1 subgoal):
 1. f (u *\<^sub>R x + v *\<^sub>R y) \<le> u * f x + v * f y
[PROOF STEP]
by (cases "u = 0 \<or> u = 1") (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
f (u *\<^sub>R x + v *\<^sub>R y) \<le> u * f x + v * f y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_poly_minus:
  assumes "f 0 = 0" and "\<And>a b. f (a - b) = f a - f b"
  shows "map_poly f (p - q) = map_poly f p - map_poly f q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly f (p - q) = map_poly f p - map_poly f q
[PROOF STEP]
by (rule Polynomial.poly_eqI) (simp add: coeff_map_poly assms)


[STATEMENT]
lemma less_1_prodinf:
  fixes f :: "nat \<Rightarrow> real"
  shows "\<lbrakk>convergent_prod f; \<And>n. 1 < f n\<rbrakk> \<Longrightarrow> 1 < prodinf f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>convergent_prod f; \<And>n. 1 < f n\<rbrakk> \<Longrightarrow> 1 < prodinf f
[PROOF STEP]
by (intro less_1_prodinf2[where i=1]) (auto intro: less_imp_le)


[STATEMENT]
lemma sum_mono_subseteq:
  "(\<And>i. i\<in>K \<Longrightarrow> f i \<subseteq>#\<^sub>z g i) \<Longrightarrow> (\<Sum>i\<in>K. f i) \<subseteq>#\<^sub>z (\<Sum>i\<in>K. g i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> K \<Longrightarrow> f i \<subseteq>#\<^sub>z g i) \<Longrightarrow> sum f K \<subseteq>#\<^sub>z sum g K
[PROOF STEP]
by (simp add: subseteq_zmset_def sum_mono zcount_sum)


[STATEMENT]
lemma Nset_nset:"{i. i \<le> (Suc (n + m))} = {i. i \<le> n} \<union>
                                            nset (Suc n) (Suc (n + m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i. i \<le> Suc (n + m)} = {i. i \<le> n} \<union> nset (Suc n) (Suc (n + m))
[PROOF STEP]
apply (rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {i. i \<le> Suc (n + m)} \<subseteq> {i. i \<le> n} \<union> nset (Suc n) (Suc (n + m))
 2. {i. i \<le> n} \<union> nset (Suc n) (Suc (n + m)) \<subseteq> {i. i \<le> Suc (n + m)}
[PROOF STEP]
apply (rule subsetI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> {i. i \<le> Suc (n + m)} \<Longrightarrow> x \<in> {i. i \<le> n} \<union> nset (Suc n) (Suc (n + m))
 2. {i. i \<le> n} \<union> nset (Suc n) (Suc (n + m)) \<subseteq> {i. i \<le> Suc (n + m)}
[PROOF STEP]
apply (simp add:nset_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<le> Suc (n + m) \<Longrightarrow> x \<le> n \<or> Suc n \<le> x
 2. {i. i \<le> n} \<union> nset (Suc n) (Suc (n + m)) \<subseteq> {i. i \<le> Suc (n + m)}
[PROOF STEP]
apply (auto simp add: nset_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma divide_nat_diff_div_nat_less_one:
  "real x / real b - real (x div b) < 1" for x b :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real x / real b - real (x div b) < 1
[PROOF STEP]
proof (cases "b = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. b = 0 \<Longrightarrow> real x / real b - real (x div b) < 1
 2. b \<noteq> 0 \<Longrightarrow> real x / real b - real (x div b) < 1
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
b = 0

goal (2 subgoals):
 1. b = 0 \<Longrightarrow> real x / real b - real (x div b) < 1
 2. b \<noteq> 0 \<Longrightarrow> real x / real b - real (x div b) < 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b = 0

goal (1 subgoal):
 1. real x / real b - real (x div b) < 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real x / real b - real (x div b) < 1

goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> real x / real b - real (x div b) < 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> real x / real b - real (x div b) < 1
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
b \<noteq> 0

goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> real x / real b - real (x div b) < 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b \<noteq> 0
[PROOF STEP]
have "real (x div b) + real (x mod b) / real b - real (x div b) < 1"
[PROOF STATE]
proof (prove)
using this:
b \<noteq> 0

goal (1 subgoal):
 1. real (x div b) + real (x mod b) / real b - real (x div b) < 1
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
real (x div b) + real (x mod b) / real b - real (x div b) < 1

goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> real x / real b - real (x div b) < 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real (x div b) + real (x mod b) / real b - real (x div b) < 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (x div b) + real (x mod b) / real b - real (x div b) < 1

goal (1 subgoal):
 1. real x / real b - real (x div b) < 1
[PROOF STEP]
by (simp add: real_of_nat_div_aux [symmetric])
[PROOF STATE]
proof (state)
this:
real x / real b - real (x div b) < 1

goal:
No subgoals!
[PROOF STEP]
qed


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


[STATEMENT]
lemma valuate_poly_of_vec: assumes "w \<in> carrier_vec n"
  and "v \<in> carrier_vec n"
shows "valuate (poly_of_vec v) (val_of_vec w) = v \<bullet> w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_of_vec v \<lbrace> val_of_vec w \<rbrace> = v \<bullet> w
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
w \<in> carrier_vec n
v \<in> carrier_vec n

goal (1 subgoal):
 1. poly_of_vec v \<lbrace> val_of_vec w \<rbrace> = v \<bullet> w
[PROOF STEP]
by (transfer, auto simp: val_of_vec_def scalar_prod_def intro: sum.mono_neutral_left)


[STATEMENT]
lemma (in prob_space) indep_sets2_eq:
  "indep_set A B \<longleftrightarrow> A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_set A B = (A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b))
[PROOF STEP]
unfolding indep_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_sets (case_bool A B) UNIV = (A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b))
[PROOF STEP]
proof (intro iffI ballI conjI)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. indep_sets (case_bool A B) UNIV \<Longrightarrow> A \<subseteq> events
 2. indep_sets (case_bool A B) UNIV \<Longrightarrow> B \<subseteq> events
 3. \<And>a b. \<lbrakk>indep_sets (case_bool A B) UNIV; a \<in> A; b \<in> B\<rbrakk> \<Longrightarrow> prob (a \<inter> b) = prob a * prob b
 4. A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b) \<Longrightarrow> indep_sets (case_bool A B) UNIV
[PROOF STEP]
assume indep: "indep_sets (case_bool A B) UNIV"
[PROOF STATE]
proof (state)
this:
indep_sets (case_bool A B) UNIV

goal (4 subgoals):
 1. indep_sets (case_bool A B) UNIV \<Longrightarrow> A \<subseteq> events
 2. indep_sets (case_bool A B) UNIV \<Longrightarrow> B \<subseteq> events
 3. \<And>a b. \<lbrakk>indep_sets (case_bool A B) UNIV; a \<in> A; b \<in> B\<rbrakk> \<Longrightarrow> prob (a \<inter> b) = prob a * prob b
 4. A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b) \<Longrightarrow> indep_sets (case_bool A B) UNIV
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
indep_sets (case_bool A B) UNIV

goal (4 subgoals):
 1. indep_sets (case_bool A B) UNIV \<Longrightarrow> A \<subseteq> events
 2. indep_sets (case_bool A B) UNIV \<Longrightarrow> B \<subseteq> events
 3. \<And>a b. \<lbrakk>indep_sets (case_bool A B) UNIV; a \<in> A; b \<in> B\<rbrakk> \<Longrightarrow> prob (a \<inter> b) = prob a * prob b
 4. A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b) \<Longrightarrow> indep_sets (case_bool A B) UNIV
[PROOF STEP]
fix a b
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. indep_sets (case_bool A B) UNIV \<Longrightarrow> A \<subseteq> events
 2. indep_sets (case_bool A B) UNIV \<Longrightarrow> B \<subseteq> events
 3. \<And>a b. \<lbrakk>indep_sets (case_bool A B) UNIV; a \<in> A; b \<in> B\<rbrakk> \<Longrightarrow> prob (a \<inter> b) = prob a * prob b
 4. A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b) \<Longrightarrow> indep_sets (case_bool A B) UNIV
[PROOF STEP]
assume "a \<in> A" "b \<in> B"
[PROOF STATE]
proof (state)
this:
a \<in> A
b \<in> B

goal (4 subgoals):
 1. indep_sets (case_bool A B) UNIV \<Longrightarrow> A \<subseteq> events
 2. indep_sets (case_bool A B) UNIV \<Longrightarrow> B \<subseteq> events
 3. \<And>a b. \<lbrakk>indep_sets (case_bool A B) UNIV; a \<in> A; b \<in> B\<rbrakk> \<Longrightarrow> prob (a \<inter> b) = prob a * prob b
 4. A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b) \<Longrightarrow> indep_sets (case_bool A B) UNIV
[PROOF STEP]
with indep_setsD[OF indep, of UNIV "case_bool a b"]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>UNIV \<subseteq> UNIV; UNIV \<noteq> {}; finite UNIV; \<forall>j\<in>UNIV. (case j of True \<Rightarrow> a | False \<Rightarrow> b) \<in> (case j of True \<Rightarrow> A | False \<Rightarrow> B)\<rbrakk> \<Longrightarrow> prob (\<Inter>j. case j of True \<Rightarrow> a | False \<Rightarrow> b) = (\<Prod>j\<in>UNIV. prob (case j of True \<Rightarrow> a | False \<Rightarrow> b))
a \<in> A
b \<in> B
[PROOF STEP]
show "prob (a \<inter> b) = prob a * prob b"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>UNIV \<subseteq> UNIV; UNIV \<noteq> {}; finite UNIV; \<forall>j\<in>UNIV. (case j of True \<Rightarrow> a | False \<Rightarrow> b) \<in> (case j of True \<Rightarrow> A | False \<Rightarrow> B)\<rbrakk> \<Longrightarrow> prob (\<Inter>j. case j of True \<Rightarrow> a | False \<Rightarrow> b) = (\<Prod>j\<in>UNIV. prob (case j of True \<Rightarrow> a | False \<Rightarrow> b))
a \<in> A
b \<in> B

goal (1 subgoal):
 1. prob (a \<inter> b) = prob a * prob b
[PROOF STEP]
unfolding UNIV_bool
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>{False, True} \<subseteq> {False, True}; {False, True} \<noteq> {}; finite {False, True}; \<forall>j\<in>{False, True}. (case j of True \<Rightarrow> a | False \<Rightarrow> b) \<in> (case j of True \<Rightarrow> A | False \<Rightarrow> B)\<rbrakk> \<Longrightarrow> prob (\<Inter>j\<in>{False, True}. case j of True \<Rightarrow> a | False \<Rightarrow> b) = (\<Prod>j\<in>{False, True}. prob (case j of True \<Rightarrow> a | False \<Rightarrow> b))
a \<in> A
b \<in> B

goal (1 subgoal):
 1. prob (a \<inter> b) = prob a * prob b
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
prob (a \<inter> b) = prob a * prob b

goal (3 subgoals):
 1. indep_sets (case_bool A B) UNIV \<Longrightarrow> A \<subseteq> events
 2. indep_sets (case_bool A B) UNIV \<Longrightarrow> B \<subseteq> events
 3. A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b) \<Longrightarrow> indep_sets (case_bool A B) UNIV
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?a9 \<in> A; ?b9 \<in> B\<rbrakk> \<Longrightarrow> prob (?a9 \<inter> ?b9) = prob ?a9 * prob ?b9

goal (3 subgoals):
 1. indep_sets (case_bool A B) UNIV \<Longrightarrow> A \<subseteq> events
 2. indep_sets (case_bool A B) UNIV \<Longrightarrow> B \<subseteq> events
 3. A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b) \<Longrightarrow> indep_sets (case_bool A B) UNIV
[PROOF STEP]
from indep
[PROOF STATE]
proof (chain)
picking this:
indep_sets (case_bool A B) UNIV
[PROOF STEP]
show "A \<subseteq> events" "B \<subseteq> events"
[PROOF STATE]
proof (prove)
using this:
indep_sets (case_bool A B) UNIV

goal (1 subgoal):
 1. A \<subseteq> events &&& B \<subseteq> events
[PROOF STEP]
unfolding indep_sets_def UNIV_bool
[PROOF STATE]
proof (prove)
using this:
(\<forall>i\<in>{False, True}. (case i of True \<Rightarrow> A | False \<Rightarrow> B) \<subseteq> events) \<and> (\<forall>J\<subseteq>{False, True}. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> (\<forall>A\<in>Pi J (case_bool A B). prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))))

goal (1 subgoal):
 1. A \<subseteq> events &&& B \<subseteq> events
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<subseteq> events
B \<subseteq> events

goal (1 subgoal):
 1. A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b) \<Longrightarrow> indep_sets (case_bool A B) UNIV
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b) \<Longrightarrow> indep_sets (case_bool A B) UNIV
[PROOF STEP]
assume *: "A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b)"
[PROOF STATE]
proof (state)
this:
A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b)

goal (1 subgoal):
 1. A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b) \<Longrightarrow> indep_sets (case_bool A B) UNIV
[PROOF STEP]
show "indep_sets (case_bool A B) UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_sets (case_bool A B) UNIV
[PROOF STEP]
proof (rule indep_setsI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> (case i of True \<Rightarrow> A | False \<Rightarrow> B) \<subseteq> events
 2. \<And>Aa J. \<lbrakk>J \<noteq> {}; J \<subseteq> UNIV; finite J; \<forall>j\<in>J. Aa j \<in> (case j of True \<Rightarrow> A | False \<Rightarrow> B)\<rbrakk> \<Longrightarrow> prob (\<Inter> (Aa ` J)) = (\<Prod>j\<in>J. prob (Aa j))
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i \<in> UNIV \<Longrightarrow> (case i of True \<Rightarrow> A | False \<Rightarrow> B) \<subseteq> events
 2. \<And>Aa J. \<lbrakk>J \<noteq> {}; J \<subseteq> UNIV; finite J; \<forall>j\<in>J. Aa j \<in> (case j of True \<Rightarrow> A | False \<Rightarrow> B)\<rbrakk> \<Longrightarrow> prob (\<Inter> (Aa ` J)) = (\<Prod>j\<in>J. prob (Aa j))
[PROOF STEP]
show "(case i of True \<Rightarrow> A | False \<Rightarrow> B) \<subseteq> events"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case i of True \<Rightarrow> A | False \<Rightarrow> B) \<subseteq> events
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b)

goal (1 subgoal):
 1. (case i of True \<Rightarrow> A | False \<Rightarrow> B) \<subseteq> events
[PROOF STEP]
by (auto split: bool.split)
[PROOF STATE]
proof (state)
this:
(case i of True \<Rightarrow> A | False \<Rightarrow> B) \<subseteq> events

goal (1 subgoal):
 1. \<And>Aa J. \<lbrakk>J \<noteq> {}; J \<subseteq> UNIV; finite J; \<forall>j\<in>J. Aa j \<in> (case j of True \<Rightarrow> A | False \<Rightarrow> B)\<rbrakk> \<Longrightarrow> prob (\<Inter> (Aa ` J)) = (\<Prod>j\<in>J. prob (Aa j))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>Aa J. \<lbrakk>J \<noteq> {}; J \<subseteq> UNIV; finite J; \<forall>j\<in>J. Aa j \<in> (case j of True \<Rightarrow> A | False \<Rightarrow> B)\<rbrakk> \<Longrightarrow> prob (\<Inter> (Aa ` J)) = (\<Prod>j\<in>J. prob (Aa j))
[PROOF STEP]
fix J X
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>Aa J. \<lbrakk>J \<noteq> {}; J \<subseteq> UNIV; finite J; \<forall>j\<in>J. Aa j \<in> (case j of True \<Rightarrow> A | False \<Rightarrow> B)\<rbrakk> \<Longrightarrow> prob (\<Inter> (Aa ` J)) = (\<Prod>j\<in>J. prob (Aa j))
[PROOF STEP]
assume "J \<noteq> {}" "J \<subseteq> UNIV" and X: "\<forall>j\<in>J. X j \<in> (case j of True \<Rightarrow> A | False \<Rightarrow> B)"
[PROOF STATE]
proof (state)
this:
J \<noteq> {}
J \<subseteq> UNIV
\<forall>j\<in>J. X j \<in> (case j of True \<Rightarrow> A | False \<Rightarrow> B)

goal (1 subgoal):
 1. \<And>Aa J. \<lbrakk>J \<noteq> {}; J \<subseteq> UNIV; finite J; \<forall>j\<in>J. Aa j \<in> (case j of True \<Rightarrow> A | False \<Rightarrow> B)\<rbrakk> \<Longrightarrow> prob (\<Inter> (Aa ` J)) = (\<Prod>j\<in>J. prob (Aa j))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
J \<noteq> {}
J \<subseteq> UNIV
\<forall>j\<in>J. X j \<in> (case j of True \<Rightarrow> A | False \<Rightarrow> B)
[PROOF STEP]
have "J = {True} \<or> J = {False} \<or> J = {True,False}"
[PROOF STATE]
proof (prove)
using this:
J \<noteq> {}
J \<subseteq> UNIV
\<forall>j\<in>J. X j \<in> (case j of True \<Rightarrow> A | False \<Rightarrow> B)

goal (1 subgoal):
 1. J = {True} \<or> J = {False} \<or> J = {True, False}
[PROOF STEP]
by (auto simp: UNIV_bool)
[PROOF STATE]
proof (state)
this:
J = {True} \<or> J = {False} \<or> J = {True, False}

goal (1 subgoal):
 1. \<And>Aa J. \<lbrakk>J \<noteq> {}; J \<subseteq> UNIV; finite J; \<forall>j\<in>J. Aa j \<in> (case j of True \<Rightarrow> A | False \<Rightarrow> B)\<rbrakk> \<Longrightarrow> prob (\<Inter> (Aa ` J)) = (\<Prod>j\<in>J. prob (Aa j))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
J = {True} \<or> J = {False} \<or> J = {True, False}
[PROOF STEP]
show "prob (\<Inter>j\<in>J. X j) = (\<Prod>j\<in>J. prob (X j))"
[PROOF STATE]
proof (prove)
using this:
J = {True} \<or> J = {False} \<or> J = {True, False}

goal (1 subgoal):
 1. prob (\<Inter> (X ` J)) = (\<Prod>j\<in>J. prob (X j))
[PROOF STEP]
using X *
[PROOF STATE]
proof (prove)
using this:
J = {True} \<or> J = {False} \<or> J = {True, False}
\<forall>j\<in>J. X j \<in> (case j of True \<Rightarrow> A | False \<Rightarrow> B)
A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b)

goal (1 subgoal):
 1. prob (\<Inter> (X ` J)) = (\<Prod>j\<in>J. prob (X j))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prob (\<Inter> (X ` J)) = (\<Prod>j\<in>J. prob (X j))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
indep_sets (case_bool A B) UNIV

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma foldseq_foldseq:
assumes
  "associative f"
  "associative g"
  "\<forall>a b c d. g(f a b) (f c d) = f (g a c) (g b d)"
shows
  "foldseq g (% j. foldseq f (A j) n) m = foldseq f (% j. foldseq g ((transpose_infmatrix A) j) m) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldseq g (\<lambda>j. foldseq f (A j) n) m = foldseq f (\<lambda>j. foldseq g (transpose_infmatrix A j) m) n
[PROOF STEP]
apply (insert foldmatrix_transpose[of g f A m n])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>a b c d. g (f a b) (f c d) = f (g a c) (g b d) \<Longrightarrow> foldmatrix f g A m n = foldmatrix_transposed g f (transpose_infmatrix A) n m) \<Longrightarrow> foldseq g (\<lambda>j. foldseq f (A j) n) m = foldseq f (\<lambda>j. foldseq g (transpose_infmatrix A j) m) n
[PROOF STEP]
by (simp add: foldmatrix_def foldmatrix_transposed_def foldseq_assoc[THEN sym] assms)


[STATEMENT]
lemma encode2_replicate_2:
  assumes "i < 2 ^ Suc k"
  shows "partial_state.encode2 (replicate (Suc k) 2) {0..<k} i = i div (2 ^ k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partial_state.encode2 (replicate (Suc k) 2) {0..<k} i = i div 2 ^ k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. partial_state.encode2 (replicate (Suc k) 2) {0..<k} i = i div 2 ^ k
[PROOF STEP]
have drop_Suc: "drop k (replicate (Suc k) 2) = [2]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop k (replicate (Suc k) (2::'a)) = [2::'a]
[PROOF STEP]
apply (subst drop_replicate)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. replicate (Suc k - k) (2::'a) = [2::'a]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
drop k (replicate (Suc k) (2::?'a3)) = [2::?'a3]

goal (1 subgoal):
 1. partial_state.encode2 (replicate (Suc k) 2) {0..<k} i = i div 2 ^ k
[PROOF STEP]
have drop_encode: "drop k (digit_encode (replicate (Suc k) 2) i) = digit_encode [2] (i div (2 ^ k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop k (digit_encode (replicate (Suc k) 2) i) = digit_encode [2] (i div 2 ^ k)
[PROOF STEP]
unfolding digit_encode_drop drop_Suc take_replicate prod_list_replicate
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. digit_encode [2] (i div 2 ^ min k (Suc k)) = digit_encode [2] (i div 2 ^ k)
[PROOF STEP]
by (metis lessI min.strict_order_iff)
[PROOF STATE]
proof (state)
this:
drop k (digit_encode (replicate (Suc k) 2) i) = digit_encode [2] (i div 2 ^ k)

goal (1 subgoal):
 1. partial_state.encode2 (replicate (Suc k) 2) {0..<k} i = i div 2 ^ k
[PROOF STEP]
have le2: "i div 2 ^ k < 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i div 2 ^ k < 2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < 2 ^ Suc k

goal (1 subgoal):
 1. i div 2 ^ k < 2
[PROOF STEP]
by (auto simp add: less_mult_imp_div_less)
[PROOF STATE]
proof (state)
this:
i div 2 ^ k < 2

goal (1 subgoal):
 1. partial_state.encode2 (replicate (Suc k) 2) {0..<k} i = i div 2 ^ k
[PROOF STEP]
have prod_list_2: "prod_list [2] = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list [2::'a] = (2::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prod_list [2::?'a4] = (2::?'a4)

goal (1 subgoal):
 1. partial_state.encode2 (replicate (Suc k) 2) {0..<k} i = i div 2 ^ k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partial_state.encode2 (replicate (Suc k) 2) {0..<k} i = i div 2 ^ k
[PROOF STEP]
unfolding partial_state.encode2_def partial_state.dims2_def
      nths_minus_upt_eq_drop[simplified lessThan_atLeast0] drop_Suc drop_encode
      digit_decode_encode prod_list_2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i div 2 ^ k mod 2 = i div 2 ^ k
[PROOF STEP]
using le2
[PROOF STATE]
proof (prove)
using this:
i div 2 ^ k < 2

goal (1 subgoal):
 1. i div 2 ^ k mod 2 = i div 2 ^ k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
partial_state.encode2 (replicate (Suc k) 2) {0..<k} i = i div 2 ^ k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pell_mul_assoc: "pell_mul z1 (pell_mul z2 z3) = pell_mul (pell_mul z1 z2) z3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pell_mul z1 (pell_mul z2 z3) = pell_mul (pell_mul z1 z2) z3
[PROOF STEP]
by (auto simp: pell_mul_def algebra_simps case_prod_unfold)


[STATEMENT]
theorem IF2map_cong:
  "(\<And>a. a \<in> IF2set x \<Longrightarrow> f a = g a) \<Longrightarrow> IF2map f x = IF2map g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. a \<in> IF2set x \<Longrightarrow> f a = g a) \<Longrightarrow> IF2map f x = IF2map g x
[PROOF STEP]
apply (rule mp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<And>a. a \<in> IF2set x \<Longrightarrow> f a = g a) \<Longrightarrow> ?P \<longrightarrow> IF2map f x = IF2map g x
 2. (\<And>a. a \<in> IF2set x \<Longrightarrow> f a = g a) \<Longrightarrow> ?P
[PROOF STEP]
apply (rule conjunct2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<And>a. a \<in> IF2set x \<Longrightarrow> f a = g a) \<Longrightarrow> ?P3 \<and> (?P \<longrightarrow> IF2map f x = IF2map g x)
 2. (\<And>a. a \<in> IF2set x \<Longrightarrow> f a = g a) \<Longrightarrow> ?P
[PROOF STEP]
apply (rule IFmap_cong)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. a \<in> IF2set x \<Longrightarrow> f a = g a) \<Longrightarrow> \<forall>a\<in>IF2set x. f a = g a
[PROOF STEP]
apply (rule ballI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>\<And>a. a \<in> IF2set x \<Longrightarrow> f a = g a; a \<in> IF2set x\<rbrakk> \<Longrightarrow> f a = g a
[PROOF STEP]
apply (tactic \<open>Goal.assume_rule_tac @{context} 1\<close>)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma prefix_append_iff:
     "(xs <= ys@zs) = (xs <= ys | (\<exists>us. xs = ys@us & us <= zs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xs \<le> ys @ zs) = (xs \<le> ys \<or> (\<exists>us. xs = ys @ us \<and> us \<le> zs))
[PROOF STEP]
apply (rule_tac xs = zs in rev_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (xs \<le> ys @ []) = (xs \<le> ys \<or> (\<exists>us. xs = ys @ us \<and> us \<le> []))
 2. \<And>x xsa. (xs \<le> ys @ xsa) = (xs \<le> ys \<or> (\<exists>us. xs = ys @ us \<and> us \<le> xsa)) \<Longrightarrow> (xs \<le> ys @ xsa @ [x]) = (xs \<le> ys \<or> (\<exists>us. xs = ys @ us \<and> us \<le> xsa @ [x]))
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xsa. (xs \<le> ys @ xsa) = (xs \<le> ys \<or> (\<exists>us. xs = ys @ us \<and> us \<le> xsa)) \<Longrightarrow> (xs \<le> ys @ xsa @ [x]) = (xs \<le> ys \<or> (\<exists>us. xs = ys @ us \<and> us \<le> xsa @ [x]))
[PROOF STEP]
apply (simp del: append_assoc add: append_assoc [symmetric], force)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma csin_ccos_squared_add:
  "ccos (a::real) * ccos a + csin a * csin a = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (cos a) * complex_of_real (cos a) + complex_of_real (sin a) * complex_of_real (sin a) = 1
[PROOF STEP]
by (smt cos_diff cos_zero of_real_add of_real_hom.hom_one of_real_mult)


[STATEMENT]
lemma Span_subgroup_props [simp]:
  assumes "set Us \<subseteq> carrier R"
  shows "Span K Us \<subseteq> carrier R"
    and "\<zero> \<in> Span K Us"
    and "\<And>v1 v2. \<lbrakk> v1 \<in> Span K Us; v2 \<in> Span K Us \<rbrakk> \<Longrightarrow> (v1 \<oplus> v2) \<in> Span K Us"
    and "\<And>v. v \<in> Span K Us \<Longrightarrow> (\<ominus> v) \<in> Span K Us"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Span K Us \<subseteq> carrier R &&& \<zero> \<in> Span K Us) &&& (\<And>v1 v2. \<lbrakk>v1 \<in> Span K Us; v2 \<in> Span K Us\<rbrakk> \<Longrightarrow> v1 \<oplus> v2 \<in> Span K Us) &&& (\<And>v. v \<in> Span K Us \<Longrightarrow> \<ominus> v \<in> Span K Us)
[PROOF STEP]
using add.subgroupE subgroup.one_closed[of _ "add_monoid R"]
        Span_is_add_subgroup[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
subgroup ?H (add_monoid R) \<Longrightarrow> ?H \<subseteq> carrier R
subgroup ?H (add_monoid R) \<Longrightarrow> ?H \<noteq> {}
\<lbrakk>subgroup ?H (add_monoid R); ?a \<in> ?H\<rbrakk> \<Longrightarrow> \<ominus> ?a \<in> ?H
\<lbrakk>subgroup ?H (add_monoid R); ?a \<in> ?H; ?b \<in> ?H\<rbrakk> \<Longrightarrow> ?a \<oplus> ?b \<in> ?H
subgroup ?H (add_monoid R) \<Longrightarrow> \<one>\<^bsub>add_monoid R\<^esub> \<in> ?H
subgroup (Span K Us) (add_monoid R)

goal (1 subgoal):
 1. (Span K Us \<subseteq> carrier R &&& \<zero> \<in> Span K Us) &&& (\<And>v1 v2. \<lbrakk>v1 \<in> Span K Us; v2 \<in> Span K Us\<rbrakk> \<Longrightarrow> v1 \<oplus> v2 \<in> Span K Us) &&& (\<And>v. v \<in> Span K Us \<Longrightarrow> \<ominus> v \<in> Span K Us)
[PROOF STEP]
by auto


[STATEMENT]
lemma sum_triv_ereal:
  fixes a :: ereal
  assumes "finite S"
  shows "(\<Sum>_ \<in> S. a) = card S * a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
[PROOF STEP]
proof (cases a)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>r. a = ereal r \<Longrightarrow> (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
 2. a = \<infinity> \<Longrightarrow> (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
 3. a = - \<infinity> \<Longrightarrow> (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
[PROOF STEP]
case (real r)
[PROOF STATE]
proof (state)
this:
a = ereal r

goal (3 subgoals):
 1. \<And>r. a = ereal r \<Longrightarrow> (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
 2. a = \<infinity> \<Longrightarrow> (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
 3. a = - \<infinity> \<Longrightarrow> (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = ereal r
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a = ereal r

goal (1 subgoal):
 1. (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>_\<in>S. a) = ereal (real (card S)) * a

goal (2 subgoals):
 1. a = \<infinity> \<Longrightarrow> (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
 2. a = - \<infinity> \<Longrightarrow> (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = \<infinity> \<Longrightarrow> (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
 2. a = - \<infinity> \<Longrightarrow> (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
[PROOF STEP]
case PInf
[PROOF STATE]
proof (state)
this:
a = \<infinity>

goal (2 subgoals):
 1. a = \<infinity> \<Longrightarrow> (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
 2. a = - \<infinity> \<Longrightarrow> (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
[PROOF STEP]
using assms PInf
[PROOF STATE]
proof (prove)
using this:
finite S
a = \<infinity>

goal (1 subgoal):
 1. (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
[PROOF STEP]
by (induction S rule:finite_induct, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>_\<in>S. a) = ereal (real (card S)) * a

goal (1 subgoal):
 1. a = - \<infinity> \<Longrightarrow> (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a = - \<infinity> \<Longrightarrow> (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
[PROOF STEP]
case MInf
[PROOF STATE]
proof (state)
this:
a = - \<infinity>

goal (1 subgoal):
 1. a = - \<infinity> \<Longrightarrow> (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
[PROOF STEP]
using assms MInf
[PROOF STATE]
proof (prove)
using this:
finite S
a = - \<infinity>

goal (1 subgoal):
 1. (\<Sum>_\<in>S. a) = ereal (real (card S)) * a
[PROOF STEP]
by (induction S rule:finite_induct, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>_\<in>S. a) = ereal (real (card S)) * a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma uniform_lim_divide:
  fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c::real_normed_field"
  assumes f: "uniform_limit S f l F"
      and g: "uniform_limit S g m F"
      and l: "bounded (l ` S)"
      and b: "\<And>x. x \<in> S \<Longrightarrow> b \<le> norm(m x)"
      and "b > 0"
    shows "uniform_limit S (\<lambda>a b. f a b / g a b) (\<lambda>a. l a / m a) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uniform_limit S (\<lambda>a b. f a b / g a b) (\<lambda>a. l a / m a) F
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. uniform_limit S (\<lambda>a b. f a b / g a b) (\<lambda>a. l a / m a) F
[PROOF STEP]
have m: "bounded ((inverse \<circ> m) ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded ((inverse \<circ> m) ` S)
[PROOF STEP]
using b \<open>b > 0\<close>
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> b \<le> norm (m ?x)
0 < b

goal (1 subgoal):
 1. bounded ((inverse \<circ> m) ` S)
[PROOF STEP]
apply (simp add: bounded_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x. x \<in> S \<Longrightarrow> b \<le> norm (m x); 0 < b\<rbrakk> \<Longrightarrow> \<exists>a. \<forall>x\<in>S. norm (inverse (m x)) \<le> a
[PROOF STEP]
by (metis le_imp_inverse_le norm_inverse)
[PROOF STATE]
proof (state)
this:
bounded ((inverse \<circ> m) ` S)

goal (1 subgoal):
 1. uniform_limit S (\<lambda>a b. f a b / g a b) (\<lambda>a. l a / m a) F
[PROOF STEP]
have "uniform_limit S (\<lambda>a b. f a b * inverse (g a b))
         (\<lambda>a. l a * (inverse \<circ> m) a) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uniform_limit S (\<lambda>a b. f a b * inverse (g a b)) (\<lambda>a. l a * (inverse \<circ> m) a) F
[PROOF STEP]
by (rule uniform_lim_mult [OF f uniform_lim_inverse [OF g b \<open>b > 0\<close>] l m])
[PROOF STATE]
proof (state)
this:
uniform_limit S (\<lambda>a b. f a b * inverse (g a b)) (\<lambda>a. l a * (inverse \<circ> m) a) F

goal (1 subgoal):
 1. uniform_limit S (\<lambda>a b. f a b / g a b) (\<lambda>a. l a / m a) F
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
uniform_limit S (\<lambda>a b. f a b * inverse (g a b)) (\<lambda>a. l a * (inverse \<circ> m) a) F
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
uniform_limit S (\<lambda>a b. f a b * inverse (g a b)) (\<lambda>a. l a * (inverse \<circ> m) a) F

goal (1 subgoal):
 1. uniform_limit S (\<lambda>a b. f a b / g a b) (\<lambda>a. l a / m a) F
[PROOF STEP]
by (simp add: field_class.field_divide_inverse)
[PROOF STATE]
proof (state)
this:
uniform_limit S (\<lambda>a b. f a b / g a b) (\<lambda>a. l a / m a) F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ipoly_poly_inverse[simp]: assumes "coeff p 0 \<noteq> 0"
  shows "ipoly (poly_inverse p) (x :: 'a :: field_char_0) = 0 \<longleftrightarrow> ipoly p (inverse x) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ipoly (poly_inverse p) x = (0::'a)) = (ipoly p (inverse x) = (0::'a))
[PROOF STEP]
unfolding poly_inverse_def ipoly_abs_int_poly_eq_zero_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ipoly (reflect_poly p) x = (0::'a)) = (ipoly p (inverse x) = (0::'a))
[PROOF STEP]
proof (cases "x = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = (0::'a) \<Longrightarrow> (ipoly (reflect_poly p) x = (0::'a)) = (ipoly p (inverse x) = (0::'a))
 2. x \<noteq> (0::'a) \<Longrightarrow> (ipoly (reflect_poly p) x = (0::'a)) = (ipoly p (inverse x) = (0::'a))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> (0::'a)

goal (2 subgoals):
 1. x = (0::'a) \<Longrightarrow> (ipoly (reflect_poly p) x = (0::'a)) = (ipoly p (inverse x) = (0::'a))
 2. x \<noteq> (0::'a) \<Longrightarrow> (ipoly (reflect_poly p) x = (0::'a)) = (ipoly p (inverse x) = (0::'a))
[PROOF STEP]
thus "(ipoly (reflect_poly p) x = 0) = (ipoly p (inverse x) = 0)"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> (0::'a)

goal (1 subgoal):
 1. (ipoly (reflect_poly p) x = (0::'a)) = (ipoly p (inverse x) = (0::'a))
[PROOF STEP]
by (subst ipoly_reflect_poly, auto)
[PROOF STATE]
proof (state)
this:
(ipoly (reflect_poly p) x = (0::'a)) = (ipoly p (inverse x) = (0::'a))

goal (1 subgoal):
 1. x = (0::'a) \<Longrightarrow> (ipoly (reflect_poly p) x = (0::'a)) = (ipoly p (inverse x) = (0::'a))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = (0::'a) \<Longrightarrow> (ipoly (reflect_poly p) x = (0::'a)) = (ipoly p (inverse x) = (0::'a))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = (0::'a)

goal (1 subgoal):
 1. x = (0::'a) \<Longrightarrow> (ipoly (reflect_poly p) x = (0::'a)) = (ipoly p (inverse x) = (0::'a))
[PROOF STEP]
show "(ipoly (reflect_poly p) x = 0) = (ipoly p (inverse x) = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ipoly (reflect_poly p) x = (0::'a)) = (ipoly p (inverse x) = (0::'a))
[PROOF STEP]
unfolding True
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ipoly (reflect_poly p) (0::'a) = (0::'a)) = (ipoly p (inverse (0::'a)) = (0::'a))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
coeff p 0 \<noteq> 0

goal (1 subgoal):
 1. (ipoly (reflect_poly p) (0::'a) = (0::'a)) = (ipoly p (inverse (0::'a)) = (0::'a))
[PROOF STEP]
by (auto simp: poly_0_coeff_0)
[PROOF STATE]
proof (state)
this:
(ipoly (reflect_poly p) x = (0::'a)) = (ipoly p (inverse x) = (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unitary_simps [simp]:
  "A \<in> carrier_mat n n \<Longrightarrow> unitary A \<Longrightarrow> adjoint A * A = 1\<^sub>m n"
  "A \<in> carrier_mat n n \<Longrightarrow> unitary A \<Longrightarrow> A * adjoint A = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>A \<in> carrier_mat n n; unitary A\<rbrakk> \<Longrightarrow> adjoint A * A = 1\<^sub>m n) &&& (\<lbrakk>A \<in> carrier_mat n n; unitary A\<rbrakk> \<Longrightarrow> A * adjoint A = 1\<^sub>m n)
[PROOF STEP]
apply (metis adjoint_dim_row carrier_matD(2) inverts_mat_def unitaryD2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> carrier_mat n n; unitary A\<rbrakk> \<Longrightarrow> A * adjoint A = 1\<^sub>m n
[PROOF STEP]
by (simp add: inverts_mat_def unitary_def)


[STATEMENT]
lemma bst_iff_sorted_wrt_less: "bst t \<longleftrightarrow> sorted_wrt (<) (inorder t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bst t = sorted_wrt (<) (inorder t)
[PROOF STEP]
apply (induction t)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. bst \<langle>\<rangle> = sorted_wrt (<) (inorder \<langle>\<rangle>)
 2. \<And>t1 x2 t2. \<lbrakk>bst t1 = sorted_wrt (<) (inorder t1); bst t2 = sorted_wrt (<) (inorder t2)\<rbrakk> \<Longrightarrow> bst \<langle>t1, x2, t2\<rangle> = sorted_wrt (<) (inorder \<langle>t1, x2, t2\<rangle>)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t1 x2 t2. \<lbrakk>bst t1 = sorted_wrt (<) (inorder t1); bst t2 = sorted_wrt (<) (inorder t2)\<rbrakk> \<Longrightarrow> bst \<langle>t1, x2, t2\<rangle> = sorted_wrt (<) (inorder \<langle>t1, x2, t2\<rangle>)
[PROOF STEP]
apply (fastforce simp: sorted_wrt_append)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma falling_fact_pochhammer': "prod (\<lambda>i. a - int i) {0..<k} = pochhammer (a - int k + 1) k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..<k. a - int i) = pochhammer (a - int k + 1) k
[PROOF STEP]
by (simp add: falling_fact_pochhammer pochhammer_minus')


[STATEMENT]
lemma remove_iMin_eq: "\<lbrakk> I \<noteq> {}; n \<noteq> iMin I \<rbrakk> \<Longrightarrow> iMin (I - {n}) = iMin I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I \<noteq> {}; n \<noteq> iMin I\<rbrakk> \<Longrightarrow> iMin (I - {n}) = iMin I
[PROOF STEP]
by (rule iMin_equality, simp_all add: iMinI_ex2 iMin_le)


[STATEMENT]
lemma "(0::nat) + 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 + 0 = 0
[PROOF STEP]
by (metis_exhaust add_0_left)


[STATEMENT]
lemma ratfps_Gcd_altdef: "Gcd (A :: 'a :: field_gcd ratfps set) =
  (if A \<subseteq> {0} then 0 else ratfps_of_poly (monom 1 (INF f\<in>A-{0}. ratfps_subdegree f)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gcd A = (if A \<subseteq> {0} then 0 else ratfps_of_poly (monom (1::'a) (Inf (ratfps_subdegree ` (A - {0})))))
[PROOF STEP]
using ratfps_Gcd
[PROOF STATE]
proof (prove)
using this:
?A - {0} \<noteq> {} \<Longrightarrow> Gcd ?A = ratfps_of_poly (monom (1::?'a) (Inf (ratfps_subdegree ` (?A - {0}))))

goal (1 subgoal):
 1. Gcd A = (if A \<subseteq> {0} then 0 else ratfps_of_poly (monom (1::'a) (Inf (ratfps_subdegree ` (A - {0})))))
[PROOF STEP]
by auto