[STATEMENT]
lemma butterfly_scaleC_right[simp]: "butterfly \<psi> (c *\<^sub>C \<phi>) = cnj c *\<^sub>C butterfly \<psi> \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. butterfly \<psi> (c *\<^sub>C \<phi>) = cnj c *\<^sub>C butterfly \<psi> \<phi>
[PROOF STEP]
unfolding butterfly_def vector_to_cblinfun_scaleC scaleC_adj
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector_to_cblinfun \<psi> o\<^sub>C\<^sub>L cnj c *\<^sub>C vector_to_cblinfun \<phi>* = cnj c *\<^sub>C (vector_to_cblinfun \<psi> o\<^sub>C\<^sub>L vector_to_cblinfun \<phi>*)
[PROOF STEP]
by (simp add: cnj_x_x)


[STATEMENT]
lemma mod_Suc': "
  0 < n \<Longrightarrow> Suc m mod n = (if m mod n < n - Suc 0 then Suc (m mod n) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> Suc m mod n = (if m mod n < n - Suc 0 then Suc (m mod n) else 0)
[PROOF STEP]
apply (simp add: mod_Suc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> (Suc (m mod n) = n \<longrightarrow> \<not> m mod n < n - Suc 0) \<and> (Suc (m mod n) \<noteq> n \<longrightarrow> m mod n < n - Suc 0)
[PROOF STEP]
apply (intro conjI impI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < n; Suc (m mod n) = n\<rbrakk> \<Longrightarrow> \<not> m mod n < n - Suc 0
 2. \<lbrakk>0 < n; Suc (m mod n) \<noteq> n\<rbrakk> \<Longrightarrow> m mod n < n - Suc 0
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; Suc (m mod n) \<noteq> n\<rbrakk> \<Longrightarrow> m mod n < n - Suc 0
[PROOF STEP]
apply (insert le_neq_trans[OF mod_less_divisor[THEN Suc_leI, of n m]], simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma equiv_eq1: "(((P::'\<alpha> predicate) \<longleftrightarrow> Q) = true) \<longleftrightarrow> (P = Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((P \<longleftrightarrow> Q) = true) = (P = Q)
[PROOF STEP]
by (auto simp add: fun_eq_iff utp_defs)


[STATEMENT]
lemma Suc_0_to_numeral: "Suc 0 = Numeral1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc 0 = Numeral1
[PROOF STEP]
by simp


[STATEMENT]
lemma fls_mult_assoc_base_factor:
  fixes a b c :: "'a::semiring_0 fls"
  shows
    "fls_base_factor a * fls_base_factor b * fls_base_factor c =
      fls_base_factor a * (fls_base_factor b * fls_base_factor c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_base_factor a * fls_base_factor b * fls_base_factor c = fls_base_factor a * (fls_base_factor b * fls_base_factor c)
[PROOF STEP]
by    (simp add: fls_mult_assoc_subdegree_ge_0 del: fls_base_factor_def)


[STATEMENT]
lemma inv_into_cube_props:
  assumes "s < t"
  shows "the_inv_into (cube 1 t) (\<lambda>f. f 0) s \<in> cube 1 t"
    and "the_inv_into (cube 1 t) (\<lambda>f. f 0) s 0 = s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. the_inv_into (cube 1 t) (\<lambda>f. f 0) s \<in> cube 1 t &&& the_inv_into (cube 1 t) (\<lambda>f. f 0) s 0 = s
[PROOF STEP]
using assms bij_unique_inv one_dim_cube_eq_nat_set f_the_inv_into_f_bij_betw
[PROOF STATE]
proof (prove)
using this:
s < t
\<lbrakk>bij_betw ?f ?A ?B; ?x \<in> ?B\<rbrakk> \<Longrightarrow> \<exists>!y. y \<in> ?A \<and> the_inv_into ?A ?f ?x = y
bij_betw (\<lambda>f. f 0) (cube 1 ?k) {..<?k}
\<lbrakk>bij_betw ?f ?A ?B; bij_betw ?f ?A ?B \<Longrightarrow> ?x \<in> ?B\<rbrakk> \<Longrightarrow> ?f (the_inv_into ?A ?f ?x) = ?x

goal (1 subgoal):
 1. the_inv_into (cube 1 t) (\<lambda>f. f 0) s \<in> cube 1 t &&& the_inv_into (cube 1 t) (\<lambda>f. f 0) s 0 = s
[PROOF STEP]
by fastforce+


[STATEMENT]
lemma adds_fun_iff': "f adds (g::'a \<Rightarrow> 'b) \<longleftrightarrow> (\<forall>x. \<exists>y. g x = f x + y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f adds g) = (\<forall>x. \<exists>y. g x = f x + y)
[PROOF STEP]
unfolding adds_fun_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. f x adds g x) = (\<forall>x. \<exists>y. g x = f x + y)
[PROOF STEP]
unfolding adds_def plus_fun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. \<exists>k. g x = f x + k) = (\<forall>x. \<exists>y. g x = f x + y)
[PROOF STEP]
..


[STATEMENT]
lemma Max_divisors_self_nat [simp]: "n \<noteq> 0 \<Longrightarrow> Max {d::nat. d dvd n} = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> Max {d. d dvd n} = n
[PROOF STEP]
by (fastforce intro: antisym Max_le_iff[THEN iffD2] simp: dvd_imp_le)


[STATEMENT]
lemma stepxy: assumes "q \<in> {x,y}" "A \<in> { [x,y], [y,x]}"
    shows "step A q a \<in> { [x,y], [y,x]}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. step A q a \<in> {[x, y], [y, x]}
[PROOF STEP]
unfolding step_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (let (k, sws) = a in mtf2 k q (swaps sws A)) \<in> {[x, y], [y, x]}
[PROOF STEP]
apply(simp only: split_def Let_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mtf2 (fst a) q (swaps (snd a) A) \<in> {[x, y], [y, x]}
[PROOF STEP]
apply(rule mtf2xy)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. swaps (snd a) A \<in> {[x, y], [y, x]}
 2. q \<in> {x, y}
[PROOF STEP]
apply(rule swapsxy)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. A \<in> {[x, y], [y, x]}
 2. q \<in> {x, y}
[PROOF STEP]
by fact+


[STATEMENT]
lemma finite_constraints_of_mat_vec: "finite (constraints_of_mat_vec A b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (constraints_of_mat_vec A b)
[PROOF STEP]
unfolding constraints_of_mat_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ((\<lambda>i. Le_Constraint Leq_Rel (poly_of_vec (row A i)) (b $ i)) ` {0..<dim_row A})
[PROOF STEP]
by auto


[STATEMENT]
lemma heap_node: "heap (node l a r) \<longleftrightarrow>
  heap l \<and> heap r \<and> (\<forall>x \<in> set_tree l \<union> set_tree r. a \<le> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Leftist_Heap.linorder_class.heap (node l a r) = (Leftist_Heap.linorder_class.heap l \<and> Leftist_Heap.linorder_class.heap r \<and> (\<forall>x\<in>Tree2.set_tree l \<union> Tree2.set_tree r. a \<le> x))
[PROOF STEP]
by(auto simp add: node_def)


[STATEMENT]
lemma formulaFalseIffContainsFalseClause:
  fixes formula :: Formula and valuation :: Valuation
  shows "formulaFalse formula valuation = (\<exists> clause. clause el formula \<and> clauseFalse clause valuation)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. formulaFalse formula valuation = (\<exists>clause. clause el formula \<and> clauseFalse clause valuation)
[PROOF STEP]
by (induct formula) auto


[STATEMENT]
lemma (in Ring) sum_mult_pOp_closedn:"\<lbrakk>A \<subseteq> carrier R; ideal R B\<rbrakk>  \<Longrightarrow>
               (\<forall>j \<le> n. f j \<in> set_mult R A B) \<longrightarrow> \<Sigma>\<^sub>e R f n \<in> sum_mult R A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> carrier R; ideal R B\<rbrakk> \<Longrightarrow> (\<forall>j\<le>n. f j \<in> set_mult R A B) \<longrightarrow> \<Sigma>\<^sub>e R f n \<in> sum_mult R A B
[PROOF STEP]
apply (induct_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>A \<subseteq> carrier R; ideal R B\<rbrakk> \<Longrightarrow> (\<forall>j\<le>0. f j \<in> set_mult R A B) \<longrightarrow> \<Sigma>\<^sub>e R f 0 \<in> sum_mult R A B
 2. \<And>n. \<lbrakk>A \<subseteq> carrier R; ideal R B; (\<forall>j\<le>n. f j \<in> set_mult R A B) \<longrightarrow> \<Sigma>\<^sub>e R f n \<in> sum_mult R A B\<rbrakk> \<Longrightarrow> (\<forall>j\<le>Suc n. f j \<in> set_mult R A B) \<longrightarrow> \<Sigma>\<^sub>e R f Suc n \<in> sum_mult R A B
[PROOF STEP]
apply (rule impI, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>A \<subseteq> carrier R; ideal R B; f 0 \<in> set_mult R A B\<rbrakk> \<Longrightarrow> f 0 \<in> sum_mult R A B
 2. \<And>n. \<lbrakk>A \<subseteq> carrier R; ideal R B; (\<forall>j\<le>n. f j \<in> set_mult R A B) \<longrightarrow> \<Sigma>\<^sub>e R f n \<in> sum_mult R A B\<rbrakk> \<Longrightarrow> (\<forall>j\<le>Suc n. f j \<in> set_mult R A B) \<longrightarrow> \<Sigma>\<^sub>e R f Suc n \<in> sum_mult R A B
[PROOF STEP]
apply (frule set_mult_sub_sum_mult[of A B], assumption+, simp add:subsetD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>A \<subseteq> carrier R; ideal R B; (\<forall>j\<le>n. f j \<in> set_mult R A B) \<longrightarrow> \<Sigma>\<^sub>e R f n \<in> sum_mult R A B\<rbrakk> \<Longrightarrow> (\<forall>j\<le>Suc n. f j \<in> set_mult R A B) \<longrightarrow> \<Sigma>\<^sub>e R f Suc n \<in> sum_mult R A B
[PROOF STEP]
apply (rule impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>A \<subseteq> carrier R; ideal R B; (\<forall>j\<le>n. f j \<in> set_mult R A B) \<longrightarrow> \<Sigma>\<^sub>e R f n \<in> sum_mult R A B; \<forall>j\<le>Suc n. f j \<in> set_mult R A B\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R f Suc n \<in> sum_mult R A B
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>A \<subseteq> carrier R; ideal R B; \<Sigma>\<^sub>e R f n \<in> sum_mult R A B; \<forall>j\<le>Suc n. f j \<in> set_mult R A B\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R f n \<plusminus> f (Suc n) \<in> sum_mult R A B
[PROOF STEP]
apply (frule_tac a = "Suc n" in forall_spec, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>A \<subseteq> carrier R; ideal R B; \<Sigma>\<^sub>e R f n \<in> sum_mult R A B; \<forall>j\<le>Suc n. f j \<in> set_mult R A B; f (Suc n) \<in> set_mult R A B\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R f n \<plusminus> f (Suc n) \<in> sum_mult R A B
[PROOF STEP]
apply (frule set_mult_sub_sum_mult[of A B], assumption+,
        frule_tac c= "f (Suc n)" in
                  subsetD[of "set_mult R A B" "sum_mult R A B"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>A \<subseteq> carrier R; ideal R B; \<Sigma>\<^sub>e R f n \<in> sum_mult R A B; \<forall>j\<le>Suc n. f j \<in> set_mult R A B; f (Suc n) \<in> set_mult R A B; set_mult R A B \<subseteq> sum_mult R A B; f (Suc n) \<in> sum_mult R A B\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e R f n \<plusminus> f (Suc n) \<in> sum_mult R A B
[PROOF STEP]
apply (rule sum_mult_pOp_closed, assumption,
        simp add:ideal_subset1, assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lborel_f_measurable_restrict:
assumes "m \<le> n"
shows "(\<lambda>f. restrict f {..<m}) \<in> measurable (lborel_f n) (lborel_f m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>f. restrict f {..<m}) \<in> lborel_f n \<rightarrow>\<^sub>M lborel_f m
[PROOF STEP]
using measurable_restrict_subset lborel_f_def assms
[PROOF STATE]
proof (prove)
using this:
?J \<subseteq> ?L \<Longrightarrow> (\<lambda>f. restrict f ?J) \<in> Pi\<^sub>M ?L ?M \<rightarrow>\<^sub>M Pi\<^sub>M ?J ?M
lborel_f ?n = Pi\<^sub>M {..<?n} (\<lambda>b. lborel)
m \<le> n

goal (1 subgoal):
 1. (\<lambda>f. restrict f {..<m}) \<in> lborel_f n \<rightarrow>\<^sub>M lborel_f m
[PROOF STEP]
by auto


[STATEMENT]
lemma roots_of_rat_poly_main_code[code]: "roots_of_rat_poly_main p = (let n = degree p in if n = 0 then [] else if n = 1 then [roots1 p]
  else if n = 2 then rat_roots2 p else
  case rational_root_test p of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:-x,1:]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. roots_of_rat_poly_main p = (let n = degree p in if n = 0 then [] else if n = 1 then [roots1 p] else if n = 2 then rat_roots2 p else case rational_root_test p of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:]))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. roots_of_rat_poly_main p = (let n = degree p in if n = 0 then [] else if n = 1 then [roots1 p] else if n = 2 then rat_roots2 p else case rational_root_test p of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:]))
[PROOF STEP]
note d = roots_of_rat_poly_main.simps[of p] Let_def
[PROOF STATE]
proof (state)
this:
roots_of_rat_poly_main p = (let n = degree p in if n = 0 then [] else if n = 1 then [roots1 p] else if n = 2 then rat_roots2 p else case rational_root_test p of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:]))
Let ?s ?f \<equiv> ?f ?s

goal (1 subgoal):
 1. roots_of_rat_poly_main p = (let n = degree p in if n = 0 then [] else if n = 1 then [roots1 p] else if n = 2 then rat_roots2 p else case rational_root_test p of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:]))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. roots_of_rat_poly_main p = (let n = degree p in if n = 0 then [] else if n = 1 then [roots1 p] else if n = 2 then rat_roots2 p else case rational_root_test p of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:]))
[PROOF STEP]
proof (cases "rational_root_test p")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rational_root_test p = None \<Longrightarrow> roots_of_rat_poly_main p = (let n = degree p in if n = 0 then [] else if n = 1 then [roots1 p] else if n = 2 then rat_roots2 p else case rational_root_test p of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:]))
 2. \<And>a. rational_root_test p = Some a \<Longrightarrow> roots_of_rat_poly_main p = (let n = degree p in if n = 0 then [] else if n = 1 then [roots1 p] else if n = 2 then rat_roots2 p else case rational_root_test p of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:]))
[PROOF STEP]
case (Some x)
[PROOF STATE]
proof (state)
this:
rational_root_test p = Some x

goal (2 subgoals):
 1. rational_root_test p = None \<Longrightarrow> roots_of_rat_poly_main p = (let n = degree p in if n = 0 then [] else if n = 1 then [roots1 p] else if n = 2 then rat_roots2 p else case rational_root_test p of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:]))
 2. \<And>a. rational_root_test p = Some a \<Longrightarrow> roots_of_rat_poly_main p = (let n = degree p in if n = 0 then [] else if n = 1 then [roots1 p] else if n = 2 then rat_roots2 p else case rational_root_test p of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:]))
[PROOF STEP]
let ?x = "[:-x,1:]"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rational_root_test p = None \<Longrightarrow> roots_of_rat_poly_main p = (let n = degree p in if n = 0 then [] else if n = 1 then [roots1 p] else if n = 2 then rat_roots2 p else case rational_root_test p of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:]))
 2. \<And>a. rational_root_test p = Some a \<Longrightarrow> roots_of_rat_poly_main p = (let n = degree p in if n = 0 then [] else if n = 1 then [roots1 p] else if n = 2 then rat_roots2 p else case rational_root_test p of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:]))
[PROOF STEP]
from rational_root_test(1)[OF Some]
[PROOF STATE]
proof (chain)
picking this:
poly p x = 0
[PROOF STEP]
have  "?x dvd p"
[PROOF STATE]
proof (prove)
using this:
poly p x = 0

goal (1 subgoal):
 1. [:- x, 1:] dvd p
[PROOF STEP]
by (simp add: poly_eq_0_iff_dvd)
[PROOF STATE]
proof (state)
this:
[:- x, 1:] dvd p

goal (2 subgoals):
 1. rational_root_test p = None \<Longrightarrow> roots_of_rat_poly_main p = (let n = degree p in if n = 0 then [] else if n = 1 then [roots1 p] else if n = 2 then rat_roots2 p else case rational_root_test p of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:]))
 2. \<And>a. rational_root_test p = Some a \<Longrightarrow> roots_of_rat_poly_main p = (let n = degree p in if n = 0 then [] else if n = 1 then [roots1 p] else if n = 2 then rat_roots2 p else case rational_root_test p of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:]))
[PROOF STEP]
from dvd_mult_div_cancel[OF this]
[PROOF STATE]
proof (chain)
picking this:
[:- x, 1:] * (p div [:- x, 1:]) = p
[PROOF STEP]
have pp: "p div ?x = ?x * (p div ?x) div ?x"
[PROOF STATE]
proof (prove)
using this:
[:- x, 1:] * (p div [:- x, 1:]) = p

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

goal (2 subgoals):
 1. rational_root_test p = None \<Longrightarrow> roots_of_rat_poly_main p = (let n = degree p in if n = 0 then [] else if n = 1 then [roots1 p] else if n = 2 then rat_roots2 p else case rational_root_test p of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:]))
 2. \<And>a. rational_root_test p = Some a \<Longrightarrow> roots_of_rat_poly_main p = (let n = degree p in if n = 0 then [] else if n = 1 then [roots1 p] else if n = 2 then rat_roots2 p else case rational_root_test p of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:]))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p div [:- x, 1:] = [:- x, 1:] * (p div [:- x, 1:]) div [:- x, 1:]
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p div [:- x, 1:] = [:- x, 1:] * (p div [:- x, 1:]) div [:- x, 1:]

goal (1 subgoal):
 1. roots_of_rat_poly_main p = (let n = degree p in if n = 0 then [] else if n = 1 then [roots1 p] else if n = 2 then rat_roots2 p else case rational_root_test p of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:]))
[PROOF STEP]
unfolding d Some
[PROOF STATE]
proof (prove)
using this:
p div [:- x, 1:] = [:- x, 1:] * (p div [:- x, 1:]) div [:- x, 1:]

goal (1 subgoal):
 1. (if degree p = 0 then [] else if degree p = 1 then [roots1 p] else if degree p = 2 then rat_roots2 p else case Some x of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:])) = (if degree p = 0 then [] else if degree p = 1 then [roots1 p] else if degree p = 2 then rat_roots2 p else case Some x of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:]))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
roots_of_rat_poly_main p = (let n = degree p in if n = 0 then [] else if n = 1 then [roots1 p] else if n = 2 then rat_roots2 p else case rational_root_test p of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:]))

goal (1 subgoal):
 1. rational_root_test p = None \<Longrightarrow> roots_of_rat_poly_main p = (let n = degree p in if n = 0 then [] else if n = 1 then [roots1 p] else if n = 2 then rat_roots2 p else case rational_root_test p of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:]))
[PROOF STEP]
qed (simp add: d)
[PROOF STATE]
proof (state)
this:
roots_of_rat_poly_main p = (let n = degree p in if n = 0 then [] else if n = 1 then [roots1 p] else if n = 2 then rat_roots2 p else case rational_root_test p of None \<Rightarrow> [] | Some x \<Rightarrow> x # roots_of_rat_poly_main (p div [:- x, 1:]))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Rep_Abs_0: "Rep (Abs 0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep (Abs 0) = 0
[PROOF STEP]
by (simp add: Abs_inverse size0)


[STATEMENT]
lemma measurable_inj_on_finite:
  assumes fin [measurable]: "finite I"
  assumes [measurable]: "\<And>i j. Measurable.pred (M i \<Otimes>\<^sub>M M j) (\<lambda>(x,y). x = y)"
  shows   "Measurable.pred (Pi\<^sub>M I M) (\<lambda>x. inj_on x I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Measurable.pred (Pi\<^sub>M I M) (\<lambda>x. inj_on x I)
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Measurable.pred (Pi\<^sub>M I M) (\<lambda>x. \<forall>xa\<in>I. \<forall>y\<in>I. x xa = x y \<longrightarrow> xa = y)
[PROOF STEP]
by measurable


[STATEMENT]
lemma extreme_points_of_convex_hull_eq:
  fixes S :: "'a::euclidean_space set"
  shows
   "\<lbrakk>compact S; \<And>T. T \<subset> S \<Longrightarrow> convex hull T \<noteq> convex hull S\<rbrakk>
        \<Longrightarrow> {x. x extreme_point_of (convex hull S)} = S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>compact S; \<And>T. T \<subset> S \<Longrightarrow> convex hull T \<noteq> convex hull S\<rbrakk> \<Longrightarrow> {x. x extreme_point_of convex hull S} = S
[PROOF STEP]
by (metis (full_types) Krein_Milman_Minkowski compact_convex_hull convex_convex_hull extreme_points_of_convex_hull psubsetI)


[STATEMENT]
lemma prefixes_in_set_prop :
  "list.set (prefixes_in_set xs yss) = list.set (prefixes xs) \<inter> fset yss"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list.set (prefixes_in_set xs yss) = list.set (prefixes xs) \<inter> fset yss
[PROOF STEP]
unfolding prefixes_in_set.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list.set (prefixes_in_list xs [] (sorted_list_of_fset yss) []) = list.set (prefixes xs) \<inter> fset yss
[PROOF STEP]
unfolding prefixes_in_list_prop
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list.set [] \<union> {[] @ ys |ys. ys \<in> list.set (prefixes xs) \<and> ys \<in> list.set (sorted_list_of_fset yss)} = list.set (prefixes xs) \<inter> fset yss
[PROOF STEP]
by auto


[STATEMENT]
lemma lm092:
  assumes "runiq f" "runiq (f^-1)"
  shows "Range(f outside X) \<subseteq> (Range f)-(f``X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Range (f outside X) \<subseteq> Range f - f `` X
[PROOF STEP]
using assms Diff_triv lm091 lm066 Diff_iff ImageE Range_iff subsetI
[PROOF STATE]
proof (prove)
using this:
runiq f
runiq (f\<inverse>)
?A \<inter> ?B = {} \<Longrightarrow> ?A - ?B = ?A
runiq (?P\<inverse>) \<Longrightarrow> ?P `` (Domain ?P - ?X) \<inter> ?P `` ?X = {}
Range (?R outside ?X) = ?R `` (Domain ?R - ?X)
(?c \<in> ?A - ?B) = (?c \<in> ?A \<and> ?c \<notin> ?B)
\<lbrakk>?b \<in> ?r `` ?A; \<And>x. \<lbrakk>(x, ?b) \<in> ?r; x \<in> ?A\<rbrakk> \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P
(?a \<in> Range ?r) = (\<exists>y. (y, ?a) \<in> ?r)
(\<And>x. x \<in> ?A \<Longrightarrow> x \<in> ?B) \<Longrightarrow> ?A \<subseteq> ?B

goal (1 subgoal):
 1. Range (f outside X) \<subseteq> Range f - f `` X
[PROOF STEP]
by metis


[STATEMENT]
lemma choose_approx: "n \<le> N \<Longrightarrow> n choose k \<le> N choose (N div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> N \<Longrightarrow> n choose k \<le> N choose N div 2
[PROOF STEP]
by (rule order.trans[OF binomial_mono_left binomial_maximum])


[STATEMENT]
lemma interval_integrable_abs_iff:
  fixes f :: "real \<Rightarrow> real"
  shows  "f \<in> borel_measurable lborel \<Longrightarrow>
    interval_lebesgue_integrable lborel a b (\<lambda>x. \<bar>f x\<bar>) = interval_lebesgue_integrable lborel a b f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> borel_measurable lborel \<Longrightarrow> interval_lebesgue_integrable lborel a b (\<lambda>x. \<bar>f x\<bar>) = interval_lebesgue_integrable lborel a b f
[PROOF STEP]
unfolding interval_lebesgue_integrable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> borel_measurable lborel \<Longrightarrow> (if a \<le> b then set_integrable lborel (einterval a b) (\<lambda>x. \<bar>f x\<bar>) else set_integrable lborel (einterval b a) (\<lambda>x. \<bar>f x\<bar>)) = (if a \<le> b then set_integrable lborel (einterval a b) f else set_integrable lborel (einterval b a) f)
[PROOF STEP]
by (subst (1 2) set_integrable_abs_iff') simp_all


[STATEMENT]
lemma sum_prime_factorization_conv_sum_primepow_factors:
  fixes n :: "'a :: factorial_semiring_multiplicative"
  assumes "n \<noteq> 0"
  shows "(\<Sum>q\<in>primepow_factors n. f (aprimedivisor q)) = (\<Sum>p\<in>#prime_factorization n. f p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>q\<in>primepow_factors n. f (aprimedivisor q)) = \<Sum>\<^sub># (image_mset f (prime_factorization n))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>q\<in>primepow_factors n. f (aprimedivisor q)) = \<Sum>\<^sub># (image_mset f (prime_factorization n))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
n \<noteq> (0::'a)
[PROOF STEP]
have "prime_factorization n = image_mset aprimedivisor (mset_set (primepow_factors n))"
[PROOF STATE]
proof (prove)
using this:
n \<noteq> (0::'a)

goal (1 subgoal):
 1. prime_factorization n = image_mset aprimedivisor (mset_set (primepow_factors n))
[PROOF STEP]
by (rule aprimedivisor_primepow_factors_conv_prime_factorization [symmetric])
[PROOF STATE]
proof (state)
this:
prime_factorization n = image_mset aprimedivisor (mset_set (primepow_factors n))

goal (1 subgoal):
 1. (\<Sum>q\<in>primepow_factors n. f (aprimedivisor q)) = \<Sum>\<^sub># (image_mset f (prime_factorization n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_factorization n = image_mset aprimedivisor (mset_set (primepow_factors n))

goal (1 subgoal):
 1. (\<Sum>q\<in>primepow_factors n. f (aprimedivisor q)) = \<Sum>\<^sub># (image_mset f (prime_factorization n))
[PROOF STEP]
have "(\<Sum>p\<in>#\<dots>. f p) = (\<Sum>q\<in>primepow_factors n. f (aprimedivisor q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum>\<^sub># (image_mset f (image_mset aprimedivisor (mset_set (primepow_factors n)))) = (\<Sum>q\<in>primepow_factors n. f (aprimedivisor q))
[PROOF STEP]
by (simp add: image_mset.compositionality sum_unfold_sum_mset o_def)
[PROOF STATE]
proof (state)
this:
\<Sum>\<^sub># (image_mset f (image_mset aprimedivisor (mset_set (primepow_factors n)))) = (\<Sum>q\<in>primepow_factors n. f (aprimedivisor q))

goal (1 subgoal):
 1. (\<Sum>q\<in>primepow_factors n. f (aprimedivisor q)) = \<Sum>\<^sub># (image_mset f (prime_factorization n))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Sum>\<^sub># (image_mset f (prime_factorization n)) = (\<Sum>q\<in>primepow_factors n. f (aprimedivisor q))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Sum>\<^sub># (image_mset f (prime_factorization n)) = (\<Sum>q\<in>primepow_factors n. f (aprimedivisor q))

goal (1 subgoal):
 1. (\<Sum>q\<in>primepow_factors n. f (aprimedivisor q)) = \<Sum>\<^sub># (image_mset f (prime_factorization n))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<Sum>q\<in>primepow_factors n. f (aprimedivisor q)) = \<Sum>\<^sub># (image_mset f (prime_factorization n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma soundness_diagonalize:
  assumes b: "is_bezout_ext bezout"
  and d: "diagonalize A bezout = (P,S,Q)"
shows "invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P**A**Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
define A' where "A' = Mod_Type_Connect.from_hma\<^sub>m A"
[PROOF STATE]
proof (state)
this:
A' = Mod_Type_Connect.from_hma\<^sub>m A

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
obtain P' S' Q' where d_JNF: "(P',S',Q') = diagonalize_JNF A' bezout"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>P' S' Q'. (P', S', Q') = diagonalize_JNF A' bezout \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis prod_cases3)
[PROOF STATE]
proof (state)
this:
(P', S', Q') = diagonalize_JNF A' bezout

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
define m and n where "m = dim_row A'" and "n = dim_col A'"
[PROOF STATE]
proof (state)
this:
m = dim_row A'
n = dim_col A'

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
hence A': "A' \<in> carrier_mat m n"
[PROOF STATE]
proof (prove)
using this:
m = dim_row A'
n = dim_col A'

goal (1 subgoal):
 1. A' \<in> carrier_mat m n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A' \<in> carrier_mat m n

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
have res_JNF: "P' \<in> carrier_mat m m \<and> Q' \<in> carrier_mat n n \<and> S' \<in> carrier_mat m n
      \<and> invertible_mat P' \<and> invertible_mat Q' \<and> isDiagonal_mat S' \<and> S' = P'*A'*Q'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P' \<in> carrier_mat m m \<and> Q' \<in> carrier_mat n n \<and> S' \<in> carrier_mat m n \<and> invertible_mat P' \<and> invertible_mat Q' \<and> isDiagonal_mat S' \<and> S' = P' * A' * Q'
[PROOF STEP]
by (rule soundness_diagonalize_JNF'[OF b A' d_JNF[symmetric]])
[PROOF STATE]
proof (state)
this:
P' \<in> carrier_mat m m \<and> Q' \<in> carrier_mat n n \<and> S' \<in> carrier_mat m n \<and> invertible_mat P' \<and> invertible_mat Q' \<and> isDiagonal_mat S' \<and> S' = P' * A' * Q'

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
have "Mod_Type_Connect.to_hma\<^sub>m P' = P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Mod_Type_Connect.to_hma\<^sub>m P' = P
[PROOF STEP]
using d
[PROOF STATE]
proof (prove)
using this:
local.diagonalize A bezout = (P, S, Q)

goal (1 subgoal):
 1. Mod_Type_Connect.to_hma\<^sub>m P' = P
[PROOF STEP]
unfolding diagonalize_def Let_def
[PROOF STATE]
proof (prove)
using this:
(case diagonalize_JNF (Mod_Type_Connect.from_hma\<^sub>m A) bezout of (P, S, Q) \<Rightarrow> (Mod_Type_Connect.to_hma\<^sub>m P, Mod_Type_Connect.to_hma\<^sub>m S, Mod_Type_Connect.to_hma\<^sub>m Q)) = (P, S, Q)

goal (1 subgoal):
 1. Mod_Type_Connect.to_hma\<^sub>m P' = P
[PROOF STEP]
by (metis A'_def d_JNF fst_conv old.prod.case)
[PROOF STATE]
proof (state)
this:
Mod_Type_Connect.to_hma\<^sub>m P' = P

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
hence "P' = Mod_Type_Connect.from_hma\<^sub>m P"
[PROOF STATE]
proof (prove)
using this:
Mod_Type_Connect.to_hma\<^sub>m P' = P

goal (1 subgoal):
 1. P' = Mod_Type_Connect.from_hma\<^sub>m P
[PROOF STEP]
using A'_def m_def res_JNF
[PROOF STATE]
proof (prove)
using this:
Mod_Type_Connect.to_hma\<^sub>m P' = P
A' = Mod_Type_Connect.from_hma\<^sub>m A
m = dim_row A'
P' \<in> carrier_mat m m \<and> Q' \<in> carrier_mat n n \<and> S' \<in> carrier_mat m n \<and> invertible_mat P' \<and> invertible_mat Q' \<and> isDiagonal_mat S' \<and> S' = P' * A' * Q'

goal (1 subgoal):
 1. P' = Mod_Type_Connect.from_hma\<^sub>m P
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P' = Mod_Type_Connect.from_hma\<^sub>m P

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
hence [transfer_rule]: "Mod_Type_Connect.HMA_M P' P"
[PROOF STATE]
proof (prove)
using this:
P' = Mod_Type_Connect.from_hma\<^sub>m P

goal (1 subgoal):
 1. Mod_Type_Connect.HMA_M P' P
[PROOF STEP]
unfolding Mod_Type_Connect.HMA_M_def
[PROOF STATE]
proof (prove)
using this:
P' = Mod_Type_Connect.from_hma\<^sub>m P

goal (1 subgoal):
 1. P' = Mod_Type_Connect.from_hma\<^sub>m P
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Mod_Type_Connect.HMA_M P' P

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
have "Mod_Type_Connect.to_hma\<^sub>m Q' = Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Mod_Type_Connect.to_hma\<^sub>m Q' = Q
[PROOF STEP]
using d
[PROOF STATE]
proof (prove)
using this:
local.diagonalize A bezout = (P, S, Q)

goal (1 subgoal):
 1. Mod_Type_Connect.to_hma\<^sub>m Q' = Q
[PROOF STEP]
unfolding diagonalize_def Let_def
[PROOF STATE]
proof (prove)
using this:
(case diagonalize_JNF (Mod_Type_Connect.from_hma\<^sub>m A) bezout of (P, S, Q) \<Rightarrow> (Mod_Type_Connect.to_hma\<^sub>m P, Mod_Type_Connect.to_hma\<^sub>m S, Mod_Type_Connect.to_hma\<^sub>m Q)) = (P, S, Q)

goal (1 subgoal):
 1. Mod_Type_Connect.to_hma\<^sub>m Q' = Q
[PROOF STEP]
by (metis A'_def d_JNF snd_conv old.prod.case)
[PROOF STATE]
proof (state)
this:
Mod_Type_Connect.to_hma\<^sub>m Q' = Q

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
hence "Q' = Mod_Type_Connect.from_hma\<^sub>m Q"
[PROOF STATE]
proof (prove)
using this:
Mod_Type_Connect.to_hma\<^sub>m Q' = Q

goal (1 subgoal):
 1. Q' = Mod_Type_Connect.from_hma\<^sub>m Q
[PROOF STEP]
using A'_def n_def res_JNF
[PROOF STATE]
proof (prove)
using this:
Mod_Type_Connect.to_hma\<^sub>m Q' = Q
A' = Mod_Type_Connect.from_hma\<^sub>m A
n = dim_col A'
P' \<in> carrier_mat m m \<and> Q' \<in> carrier_mat n n \<and> S' \<in> carrier_mat m n \<and> invertible_mat P' \<and> invertible_mat Q' \<and> isDiagonal_mat S' \<and> S' = P' * A' * Q'

goal (1 subgoal):
 1. Q' = Mod_Type_Connect.from_hma\<^sub>m Q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Q' = Mod_Type_Connect.from_hma\<^sub>m Q

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
hence [transfer_rule]: "Mod_Type_Connect.HMA_M Q' Q"
[PROOF STATE]
proof (prove)
using this:
Q' = Mod_Type_Connect.from_hma\<^sub>m Q

goal (1 subgoal):
 1. Mod_Type_Connect.HMA_M Q' Q
[PROOF STEP]
unfolding Mod_Type_Connect.HMA_M_def
[PROOF STATE]
proof (prove)
using this:
Q' = Mod_Type_Connect.from_hma\<^sub>m Q

goal (1 subgoal):
 1. Q' = Mod_Type_Connect.from_hma\<^sub>m Q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Mod_Type_Connect.HMA_M Q' Q

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
have "Mod_Type_Connect.to_hma\<^sub>m S' = S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Mod_Type_Connect.to_hma\<^sub>m S' = S
[PROOF STEP]
using d
[PROOF STATE]
proof (prove)
using this:
local.diagonalize A bezout = (P, S, Q)

goal (1 subgoal):
 1. Mod_Type_Connect.to_hma\<^sub>m S' = S
[PROOF STEP]
unfolding diagonalize_def Let_def
[PROOF STATE]
proof (prove)
using this:
(case diagonalize_JNF (Mod_Type_Connect.from_hma\<^sub>m A) bezout of (P, S, Q) \<Rightarrow> (Mod_Type_Connect.to_hma\<^sub>m P, Mod_Type_Connect.to_hma\<^sub>m S, Mod_Type_Connect.to_hma\<^sub>m Q)) = (P, S, Q)

goal (1 subgoal):
 1. Mod_Type_Connect.to_hma\<^sub>m S' = S
[PROOF STEP]
by (metis A'_def d_JNF snd_conv old.prod.case)
[PROOF STATE]
proof (state)
this:
Mod_Type_Connect.to_hma\<^sub>m S' = S

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
hence "S' = Mod_Type_Connect.from_hma\<^sub>m S"
[PROOF STATE]
proof (prove)
using this:
Mod_Type_Connect.to_hma\<^sub>m S' = S

goal (1 subgoal):
 1. S' = Mod_Type_Connect.from_hma\<^sub>m S
[PROOF STEP]
using A'_def m_def n_def res_JNF
[PROOF STATE]
proof (prove)
using this:
Mod_Type_Connect.to_hma\<^sub>m S' = S
A' = Mod_Type_Connect.from_hma\<^sub>m A
m = dim_row A'
n = dim_col A'
P' \<in> carrier_mat m m \<and> Q' \<in> carrier_mat n n \<and> S' \<in> carrier_mat m n \<and> invertible_mat P' \<and> invertible_mat Q' \<and> isDiagonal_mat S' \<and> S' = P' * A' * Q'

goal (1 subgoal):
 1. S' = Mod_Type_Connect.from_hma\<^sub>m S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S' = Mod_Type_Connect.from_hma\<^sub>m S

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
hence [transfer_rule]: "Mod_Type_Connect.HMA_M S' S"
[PROOF STATE]
proof (prove)
using this:
S' = Mod_Type_Connect.from_hma\<^sub>m S

goal (1 subgoal):
 1. Mod_Type_Connect.HMA_M S' S
[PROOF STEP]
unfolding Mod_Type_Connect.HMA_M_def
[PROOF STATE]
proof (prove)
using this:
S' = Mod_Type_Connect.from_hma\<^sub>m S

goal (1 subgoal):
 1. S' = Mod_Type_Connect.from_hma\<^sub>m S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Mod_Type_Connect.HMA_M S' S

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
have [transfer_rule]: "Mod_Type_Connect.HMA_M A' A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Mod_Type_Connect.HMA_M A' A
[PROOF STEP]
using A'_def
[PROOF STATE]
proof (prove)
using this:
A' = Mod_Type_Connect.from_hma\<^sub>m A

goal (1 subgoal):
 1. Mod_Type_Connect.HMA_M A' A
[PROOF STEP]
unfolding Mod_Type_Connect.HMA_M_def
[PROOF STATE]
proof (prove)
using this:
A' = Mod_Type_Connect.from_hma\<^sub>m A

goal (1 subgoal):
 1. A' = Mod_Type_Connect.from_hma\<^sub>m A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Mod_Type_Connect.HMA_M A' A

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
have "invertible P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible P
[PROOF STEP]
using res_JNF
[PROOF STATE]
proof (prove)
using this:
P' \<in> carrier_mat m m \<and> Q' \<in> carrier_mat n n \<and> S' \<in> carrier_mat m n \<and> invertible_mat P' \<and> invertible_mat Q' \<and> isDiagonal_mat S' \<and> S' = P' * A' * Q'

goal (1 subgoal):
 1. invertible P
[PROOF STEP]
by (transfer, simp)
[PROOF STATE]
proof (state)
this:
invertible P

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
invertible P

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
have "invertible Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible Q
[PROOF STEP]
using res_JNF
[PROOF STATE]
proof (prove)
using this:
P' \<in> carrier_mat m m \<and> Q' \<in> carrier_mat n n \<and> S' \<in> carrier_mat m n \<and> invertible_mat P' \<and> invertible_mat Q' \<and> isDiagonal_mat S' \<and> S' = P' * A' * Q'

goal (1 subgoal):
 1. invertible Q
[PROOF STEP]
by (transfer, simp)
[PROOF STATE]
proof (state)
this:
invertible Q

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
invertible Q

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
have "isDiagonal S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isDiagonal S
[PROOF STEP]
using res_JNF
[PROOF STATE]
proof (prove)
using this:
P' \<in> carrier_mat m m \<and> Q' \<in> carrier_mat n n \<and> S' \<in> carrier_mat m n \<and> invertible_mat P' \<and> invertible_mat Q' \<and> isDiagonal_mat S' \<and> S' = P' * A' * Q'

goal (1 subgoal):
 1. isDiagonal S
[PROOF STEP]
by (transfer, simp)
[PROOF STATE]
proof (state)
this:
isDiagonal S

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
isDiagonal S

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
have "S = P**A**Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S = P ** A ** Q
[PROOF STEP]
using res_JNF
[PROOF STATE]
proof (prove)
using this:
P' \<in> carrier_mat m m \<and> Q' \<in> carrier_mat n n \<and> S' \<in> carrier_mat m n \<and> invertible_mat P' \<and> invertible_mat Q' \<and> isDiagonal_mat S' \<and> S' = P' * A' * Q'

goal (1 subgoal):
 1. S = P ** A ** Q
[PROOF STEP]
by (transfer, simp)
[PROOF STATE]
proof (state)
this:
S = P ** A ** Q

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
invertible P
invertible Q
isDiagonal S
S = P ** A ** Q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
invertible P
invertible Q
isDiagonal S
S = P ** A ** Q

goal (1 subgoal):
 1. invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
invertible P \<and> invertible Q \<and> isDiagonal S \<and> S = P ** A ** Q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma snd_divmod_abs [simp]:
  "snd (divmod_abs k l) = \<bar>k\<bar> mod \<bar>l\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (divmod_abs k l) = \<bar>k\<bar> mod \<bar>l\<bar>
[PROOF STEP]
by (simp add: divmod_abs_def)


[STATEMENT]
lemma mat_of_cblinfun_sandwich:
  fixes a :: "(_::onb_enum, _::onb_enum) cblinfun"
  shows \<open>mat_of_cblinfun (sandwich a *\<^sub>V b) = (let a' = mat_of_cblinfun a in a' * mat_of_cblinfun b * mat_adjoint a')\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cblinfun (sandwich a *\<^sub>V b) = (let a' = mat_of_cblinfun a in a' * mat_of_cblinfun b * mat_adjoint a')
[PROOF STEP]
by (simp add: mat_of_cblinfun_compose sandwich_apply Let_def mat_of_cblinfun_adj)


[STATEMENT]
lemma map_index'_is_ConsD:
  "map_index' n f xs = y # ys \<Longrightarrow> \<exists>z zs. xs = z # zs \<and> f n z = y \<and> map_index' (n + 1) f zs = ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_index' n f xs = y # ys \<Longrightarrow> \<exists>z zs. xs = z # zs \<and> f n z = y \<and> map_index' (n + 1) f zs = ys
[PROOF STEP]
by (induct xs arbitrary: n) auto


[STATEMENT]
lemma dtree_from_list_1_leaf: "num_leaves (dtree_from_list r xs) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. num_leaves (dtree_from_list r xs) = 1
[PROOF STEP]
using num_leaves_1_if_mdeg_1 dtree_from_list_deg_le_1
[PROOF STATE]
proof (prove)
using this:
max_deg ?t \<le> 1 \<Longrightarrow> num_leaves ?t = 1
max_deg (dtree_from_list ?r ?xs) \<le> 1

goal (1 subgoal):
 1. num_leaves (dtree_from_list r xs) = 1
[PROOF STEP]
by fast


[STATEMENT]
lemma changes_rev: fixes xs:: "'a::linordered_idom list"
  shows "changes (rev xs) = changes xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes (rev xs) = changes xs
[PROOF STEP]
apply (induction xs rule: changes.induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. changes (rev []) = changes []
 2. \<And>uu_. changes (rev [uu_]) = changes [uu_]
 3. \<And>x1 x2 xs. \<lbrakk>x1 * x2 < (0::'a) \<Longrightarrow> changes (rev (x2 # xs)) = changes (x2 # xs); \<lbrakk>\<not> x1 * x2 < (0::'a); x2 = (0::'a)\<rbrakk> \<Longrightarrow> changes (rev (x1 # xs)) = changes (x1 # xs); \<lbrakk>\<not> x1 * x2 < (0::'a); x2 \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> changes (rev (x2 # xs)) = changes (x2 # xs)\<rbrakk> \<Longrightarrow> changes (rev (x1 # x2 # xs)) = changes (x1 # x2 # xs)
[PROOF STEP]
by (auto simp: changes_snoc)


[STATEMENT]
lemma arccos_cos_eq_abs_2pi:
  obtains k where "arccos (cos \<theta>) = \<bar>\<theta> - of_int k * (2 * pi)\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. arccos (cos \<theta>) = \<bar>\<theta> - real_of_int k * (2 * pi)\<bar> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>k. arccos (cos \<theta>) = \<bar>\<theta> - real_of_int k * (2 * pi)\<bar> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define k where "k \<equiv>  \<lfloor>(\<theta> + pi) / (2 * pi)\<rfloor>"
[PROOF STATE]
proof (state)
this:
k \<equiv> \<lfloor>(\<theta> + pi) / (2 * pi)\<rfloor>

goal (1 subgoal):
 1. (\<And>k. arccos (cos \<theta>) = \<bar>\<theta> - real_of_int k * (2 * pi)\<bar> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have lepi: "\<bar>\<theta> - of_int k * (2 * pi)\<bar> \<le> pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>\<theta> - real_of_int k * (2 * pi)\<bar> \<le> pi
[PROOF STEP]
using floor_divide_lower [of "2*pi" "\<theta> + pi"] floor_divide_upper [of "2*pi" "\<theta> + pi"]
[PROOF STATE]
proof (prove)
using this:
0 < 2 * pi \<Longrightarrow> real_of_int \<lfloor>(\<theta> + pi) / (2 * pi)\<rfloor> * (2 * pi) \<le> \<theta> + pi
0 < 2 * pi \<Longrightarrow> \<theta> + pi < (real_of_int \<lfloor>(\<theta> + pi) / (2 * pi)\<rfloor> + 1) * (2 * pi)

goal (1 subgoal):
 1. \<bar>\<theta> - real_of_int k * (2 * pi)\<bar> \<le> pi
[PROOF STEP]
by (auto simp: k_def abs_if algebra_simps)
[PROOF STATE]
proof (state)
this:
\<bar>\<theta> - real_of_int k * (2 * pi)\<bar> \<le> pi

goal (1 subgoal):
 1. (\<And>k. arccos (cos \<theta>) = \<bar>\<theta> - real_of_int k * (2 * pi)\<bar> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "arccos (cos \<theta>) = arccos (cos (\<theta> - of_int k * (2 * pi)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arccos (cos \<theta>) = arccos (cos (\<theta> - real_of_int k * (2 * pi)))
[PROOF STEP]
using cos_int_2pin sin_int_2pin
[PROOF STATE]
proof (prove)
using this:
cos (2 * pi * real_of_int ?n) = 1
sin (2 * pi * real_of_int ?n) = 0

goal (1 subgoal):
 1. arccos (cos \<theta>) = arccos (cos (\<theta> - real_of_int k * (2 * pi)))
[PROOF STEP]
by (simp add: cos_diff mult.commute)
[PROOF STATE]
proof (state)
this:
arccos (cos \<theta>) = arccos (cos (\<theta> - real_of_int k * (2 * pi)))

goal (1 subgoal):
 1. (\<And>k. arccos (cos \<theta>) = \<bar>\<theta> - real_of_int k * (2 * pi)\<bar> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
arccos (cos \<theta>) = arccos (cos (\<theta> - real_of_int k * (2 * pi)))

goal (1 subgoal):
 1. (\<And>k. arccos (cos \<theta>) = \<bar>\<theta> - real_of_int k * (2 * pi)\<bar> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "\<dots> = \<bar>\<theta> - of_int k * (2 * pi)\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arccos (cos (\<theta> - real_of_int k * (2 * pi))) = \<bar>\<theta> - real_of_int k * (2 * pi)\<bar>
[PROOF STEP]
using arccos_cos_eq_abs lepi
[PROOF STATE]
proof (prove)
using this:
\<bar>?\<theta>\<bar> \<le> pi \<Longrightarrow> arccos (cos ?\<theta>) = \<bar>?\<theta>\<bar>
\<bar>\<theta> - real_of_int k * (2 * pi)\<bar> \<le> pi

goal (1 subgoal):
 1. arccos (cos (\<theta> - real_of_int k * (2 * pi))) = \<bar>\<theta> - real_of_int k * (2 * pi)\<bar>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
arccos (cos (\<theta> - real_of_int k * (2 * pi))) = \<bar>\<theta> - real_of_int k * (2 * pi)\<bar>

goal (1 subgoal):
 1. (\<And>k. arccos (cos \<theta>) = \<bar>\<theta> - real_of_int k * (2 * pi)\<bar> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
arccos (cos \<theta>) = \<bar>\<theta> - real_of_int k * (2 * pi)\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
arccos (cos \<theta>) = \<bar>\<theta> - real_of_int k * (2 * pi)\<bar>

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
arccos (cos \<theta>) = \<bar>\<theta> - real_of_int k * (2 * pi)\<bar>
arccos (cos \<theta>) = \<bar>\<theta> - real_of_int ?k * (2 * pi)\<bar> \<Longrightarrow> thesis

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma word_lsb_1_0 [simp]: "lsb (1::'a::len word) \<and> \<not> lsb (0::'b::len word)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lsb 1 \<and> \<not> lsb 0
[PROOF STEP]
unfolding word_lsb_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. odd (uint 1) \<and> \<not> odd (uint 0)
[PROOF STEP]
by simp


[STATEMENT]
lemma emeasure_std_simplex_aux_step:
  assumes "b \<notin> A" "finite A"
  shows   "x(b := y) \<in> S (insert b A) t \<longleftrightarrow> y \<in> {0..t} \<and> x \<in> S A (t - y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x(b := y) \<in> S (insert b A) t) = (y \<in> {0..t} \<and> x \<in> S A (t - y))
[PROOF STEP]
using assms sum_nonneg[of A x]
[PROOF STATE]
proof (prove)
using this:
b \<notin> A
finite A
(\<And>xa. xa \<in> A \<Longrightarrow> 0 \<le> x xa) \<Longrightarrow> 0 \<le> sum x A

goal (1 subgoal):
 1. (x(b := y) \<in> S (insert b A) t) = (y \<in> {0..t} \<and> x \<in> S A (t - y))
[PROOF STEP]
unfolding S_def
[PROOF STATE]
proof (prove)
using this:
b \<notin> A
finite A
(\<And>xa. xa \<in> A \<Longrightarrow> 0 \<le> x xa) \<Longrightarrow> 0 \<le> sum x A

goal (1 subgoal):
 1. (x(b := y) \<in> {x. (\<forall>i\<in>insert b A. 0 \<le> x i) \<and> sum x (insert b A) \<le> t}) = (y \<in> {0..t} \<and> x \<in> {x. (\<forall>i\<in>A. 0 \<le> x i) \<and> sum x A \<le> t - y})
[PROOF STEP]
by (force simp: sum_delta_notmem algebra_simps)


[STATEMENT]
lemma Arg2pi_0 [simp]: "Arg2pi(0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg2pi 0 = 0
[PROOF STEP]
by (simp add: Arg2pi_def)


[STATEMENT]
lemma Greater_unbounded:
  assumes "finite X" "valid_region X k I r" "c \<in> X" "I c = Greater (k c)"
  shows "unbounded c (region X I r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unbounded c (Regions.region X I r)
[PROOF STEP]
using Greater_unbounded_aux[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<exists>u\<in>Regions.region X I r. ?t < u c

goal (1 subgoal):
 1. unbounded c (Regions.region X I r)
[PROOF STEP]
unfolding unbounded_def
[PROOF STATE]
proof (prove)
using this:
\<exists>u\<in>Regions.region X I r. ?t < u c

goal (1 subgoal):
 1. \<forall>t. \<exists>u\<in>Regions.region X I r. t < u c
[PROOF STEP]
by blast


[STATEMENT]
lemma div_half_nat:
  fixes x y :: nat
  assumes "y \<noteq> 0"
  shows "(x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
let ?q = "2 * (x div 2 div y)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
have q: "?q = x div y - x div y mod 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (x div 2 div y) = x div y - x div y mod 2
[PROOF STEP]
by(metis div_mult2_eq mult.commute minus_mod_eq_mult_div [symmetric])
[PROOF STATE]
proof (state)
this:
2 * (x div 2 div y) = x div y - x div y mod 2

goal (1 subgoal):
 1. (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
let ?r = "x - ?q * y"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
have r: "?r = x mod y + x div y mod 2 * y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - 2 * (x div 2 div y) * y = x mod y + x div y mod 2 * y
[PROOF STEP]
by(simp add: q diff_mult_distrib minus_mod_eq_div_mult [symmetric])(metis diff_diff_cancel mod_less_eq_dividend mod_mult2_eq add.commute mult.commute)
[PROOF STATE]
proof (state)
this:
x - 2 * (x div 2 div y) * y = x mod y + x div y mod 2 * y

goal (1 subgoal):
 1. (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
proof(cases "y \<le> x - ?q * y")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. y \<le> x - 2 * (x div 2 div y) * y \<Longrightarrow> (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
 2. \<not> y \<le> x - 2 * (x div 2 div y) * y \<Longrightarrow> (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
y \<le> x - 2 * (x div 2 div y) * y

goal (2 subgoals):
 1. y \<le> x - 2 * (x div 2 div y) * y \<Longrightarrow> (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
 2. \<not> y \<le> x - 2 * (x div 2 div y) * y \<Longrightarrow> (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
with assms q
[PROOF STATE]
proof (chain)
picking this:
y \<noteq> 0
2 * (x div 2 div y) = x div y - x div y mod 2
y \<le> x - 2 * (x div 2 div y) * y
[PROOF STEP]
have "x div y mod 2 \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
y \<noteq> 0
2 * (x div 2 div y) = x div y - x div y mod 2
y \<le> x - 2 * (x div 2 div y) * y

goal (1 subgoal):
 1. x div y mod 2 \<noteq> 0
[PROOF STEP]
unfolding r
[PROOF STATE]
proof (prove)
using this:
y \<noteq> 0
2 * (x div 2 div y) = x div y - x div y mod 2
y \<le> x mod y + x div y mod 2 * y

goal (1 subgoal):
 1. x div y mod 2 \<noteq> 0
[PROOF STEP]
by (metis Nat.add_0_right diff_0_eq_0 diff_Suc_1 le_div_geq mod2_gr_0 mod_div_trivial mult_0 neq0_conv numeral_1_eq_Suc_0 numerals(1))
[PROOF STATE]
proof (state)
this:
x div y mod 2 \<noteq> 0

goal (2 subgoals):
 1. y \<le> x - 2 * (x div 2 div y) * y \<Longrightarrow> (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
 2. \<not> y \<le> x - 2 * (x div 2 div y) * y \<Longrightarrow> (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
hence "x div y = ?q + 1"
[PROOF STATE]
proof (prove)
using this:
x div y mod 2 \<noteq> 0

goal (1 subgoal):
 1. x div y = 2 * (x div 2 div y) + 1
[PROOF STEP]
unfolding q
[PROOF STATE]
proof (prove)
using this:
x div y mod 2 \<noteq> 0

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

goal (2 subgoals):
 1. y \<le> x - 2 * (x div 2 div y) * y \<Longrightarrow> (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
 2. \<not> y \<le> x - 2 * (x div 2 div y) * y \<Longrightarrow> (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x div y = 2 * (x div 2 div y) + 1

goal (2 subgoals):
 1. y \<le> x - 2 * (x div 2 div y) * y \<Longrightarrow> (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
 2. \<not> y \<le> x - 2 * (x div 2 div y) * y \<Longrightarrow> (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
hence "x mod y = ?r - y"
[PROOF STATE]
proof (prove)
using this:
x div y = 2 * (x div 2 div y) + 1

goal (1 subgoal):
 1. x mod y = x - 2 * (x div 2 div y) * y - y
[PROOF STEP]
by simp(metis minus_div_mult_eq_mod [symmetric] diff_commute diff_diff_left mult_Suc)
[PROOF STATE]
proof (state)
this:
x mod y = x - 2 * (x div 2 div y) * y - y

goal (2 subgoals):
 1. y \<le> x - 2 * (x div 2 div y) * y \<Longrightarrow> (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
 2. \<not> y \<le> x - 2 * (x div 2 div y) * y \<Longrightarrow> (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x div y = 2 * (x div 2 div y) + 1
x mod y = x - 2 * (x div 2 div y) * y - y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x div y = 2 * (x div 2 div y) + 1
x mod y = x - 2 * (x div 2 div y) * y - y

goal (1 subgoal):
 1. (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
x div y = 2 * (x div 2 div y) + 1
x mod y = x - 2 * (x div 2 div y) * y - y
y \<le> x - 2 * (x div 2 div y) * y

goal (1 subgoal):
 1. (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
by(simp add: Let_def)
[PROOF STATE]
proof (state)
this:
(x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))

goal (1 subgoal):
 1. \<not> y \<le> x - 2 * (x div 2 div y) * y \<Longrightarrow> (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> y \<le> x - 2 * (x div 2 div y) * y \<Longrightarrow> (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> y \<le> x - 2 * (x div 2 div y) * y

goal (1 subgoal):
 1. \<not> y \<le> x - 2 * (x div 2 div y) * y \<Longrightarrow> (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
hence "x div y mod 2 = 0"
[PROOF STATE]
proof (prove)
using this:
\<not> y \<le> x - 2 * (x div 2 div y) * y

goal (1 subgoal):
 1. x div y mod 2 = 0
[PROOF STEP]
unfolding r
[PROOF STATE]
proof (prove)
using this:
\<not> y \<le> x mod y + x div y mod 2 * y

goal (1 subgoal):
 1. x div y mod 2 = 0
[PROOF STEP]
by(simp add: not_le)(metis Nat.add_0_right assms div_less div_mult_self2 mod_div_trivial mult.commute)
[PROOF STATE]
proof (state)
this:
x div y mod 2 = 0

goal (1 subgoal):
 1. \<not> y \<le> x - 2 * (x div 2 div y) * y \<Longrightarrow> (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
hence "x div y = ?q"
[PROOF STATE]
proof (prove)
using this:
x div y mod 2 = 0

goal (1 subgoal):
 1. x div y = 2 * (x div 2 div y)
[PROOF STEP]
unfolding q
[PROOF STATE]
proof (prove)
using this:
x div y mod 2 = 0

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

goal (1 subgoal):
 1. \<not> y \<le> x - 2 * (x div 2 div y) * y \<Longrightarrow> (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x div y = 2 * (x div 2 div y)

goal (1 subgoal):
 1. \<not> y \<le> x - 2 * (x div 2 div y) * y \<Longrightarrow> (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
hence "x mod y = ?r"
[PROOF STATE]
proof (prove)
using this:
x div y = 2 * (x div 2 div y)

goal (1 subgoal):
 1. x mod y = x - 2 * (x div 2 div y) * y
[PROOF STEP]
by (metis minus_div_mult_eq_mod [symmetric])
[PROOF STATE]
proof (state)
this:
x mod y = x - 2 * (x div 2 div y) * y

goal (1 subgoal):
 1. \<not> y \<le> x - 2 * (x div 2 div y) * y \<Longrightarrow> (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x div y = 2 * (x div 2 div y)
x mod y = x - 2 * (x div 2 div y) * y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x div y = 2 * (x div 2 div y)
x mod y = x - 2 * (x div 2 div y) * y

goal (1 subgoal):
 1. (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
x div y = 2 * (x div 2 div y)
x mod y = x - 2 * (x div 2 div y) * y
\<not> y \<le> x - 2 * (x div 2 div y) * y

goal (1 subgoal):
 1. (x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))
[PROOF STEP]
by(simp add: Let_def)
[PROOF STATE]
proof (state)
this:
(x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(x div y, x mod y) = (let q = 2 * (x div 2 div y); r = x - q * y in if y \<le> r then (q + 1, r - y) else (q, r))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fps_one_mult:
  fixes f :: "'a::{comm_monoid_add, mult_zero, monoid_mult} fps"
  shows "1 * f = f"
  and   "f * 1 = f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 * f = f &&& f * 1 = f
[PROOF STEP]
by    (simp_all add: fps_ext fps_mult_nth mult_delta_left mult_delta_right)


[STATEMENT]
lemma dom_override_on [simp]:
  "dom (override_on f g A) =
    (dom f  - {a. a \<in> A - dom g}) \<union> {a. a \<in> A \<inter> dom g}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dom (override_on f g A) = dom f - {a. a \<in> A - dom g} \<union> {a. a \<in> A \<inter> dom g}
[PROOF STEP]
by (auto simp: dom_def override_on_def)


[STATEMENT]
lemma cot_pfd_funeq_complex:
  fixes x :: complex
  assumes "x \<notin> \<int>"
  shows   "2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
define f :: "complex \<Rightarrow> nat \<Rightarrow> complex" where "f = (\<lambda>x n. 1 / (x + of_nat (Suc n)))"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>x n. 1 / (x + of_nat (Suc n)))

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
define g :: "complex \<Rightarrow> nat \<Rightarrow> complex" where "g = (\<lambda>x n. 1 / (x - of_nat (Suc n)))"
[PROOF STATE]
proof (state)
this:
g = (\<lambda>x n. 1 / (x - of_nat (Suc n)))

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
define h :: "complex \<Rightarrow> nat \<Rightarrow> complex" where "h = (\<lambda>x n. 2 * (f x (n + 1) + g x n))"
[PROOF STATE]
proof (state)
this:
h = (\<lambda>x n. 2 * (f x (n + 1) + g x n))

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
have sums: "(\<lambda>n. f x n + g x n) sums cot_pfd x" if "x \<notin> \<int>" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. f x n + g x n) sums cot_pfd x
[PROOF STEP]
unfolding f_def g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n))) sums cot_pfd x
[PROOF STEP]
by (intro sums_cot_pfd_complex' that)
[PROOF STATE]
proof (state)
this:
?x \<notin> \<int> \<Longrightarrow> (\<lambda>n. f ?x n + g ?x n) sums cot_pfd ?x

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
have "x / 2 \<notin> \<int>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x / 2 \<notin> \<int>
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x / 2 \<in> \<int> \<Longrightarrow> False
[PROOF STEP]
assume "x / 2 \<in> \<int>"
[PROOF STATE]
proof (state)
this:
x / 2 \<in> \<int>

goal (1 subgoal):
 1. x / 2 \<in> \<int> \<Longrightarrow> False
[PROOF STEP]
hence "2 * (x / 2) \<in> \<int>"
[PROOF STATE]
proof (prove)
using this:
x / 2 \<in> \<int>

goal (1 subgoal):
 1. 2 * (x / 2) \<in> \<int>
[PROOF STEP]
by (intro Ints_mult) auto
[PROOF STATE]
proof (state)
this:
2 * (x / 2) \<in> \<int>

goal (1 subgoal):
 1. x / 2 \<in> \<int> \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
2 * (x / 2) \<in> \<int>

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
2 * (x / 2) \<in> \<int>
x \<notin> \<int>

goal (1 subgoal):
 1. False
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x / 2 \<notin> \<int>

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x / 2 \<notin> \<int>

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
have "(x + 1) / 2 \<notin> \<int>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + 1) / 2 \<notin> \<int>
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x + 1) / 2 \<in> \<int> \<Longrightarrow> False
[PROOF STEP]
assume "(x + 1) / 2 \<in> \<int>"
[PROOF STATE]
proof (state)
this:
(x + 1) / 2 \<in> \<int>

goal (1 subgoal):
 1. (x + 1) / 2 \<in> \<int> \<Longrightarrow> False
[PROOF STEP]
hence "2 * ((x + 1) / 2) - 1 \<in> \<int>"
[PROOF STATE]
proof (prove)
using this:
(x + 1) / 2 \<in> \<int>

goal (1 subgoal):
 1. 2 * ((x + 1) / 2) - 1 \<in> \<int>
[PROOF STEP]
by (intro Ints_mult Ints_diff) auto
[PROOF STATE]
proof (state)
this:
2 * ((x + 1) / 2) - 1 \<in> \<int>

goal (1 subgoal):
 1. (x + 1) / 2 \<in> \<int> \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
2 * ((x + 1) / 2) - 1 \<in> \<int>

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
2 * ((x + 1) / 2) - 1 \<in> \<int>
x \<notin> \<int>

goal (1 subgoal):
 1. False
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(x + 1) / 2 \<notin> \<int>

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x / 2 \<notin> \<int>
(x + 1) / 2 \<notin> \<int>
[PROOF STEP]
have "(\<lambda>n. (f (x / 2) n + g (x / 2) n) + (f ((x+1) / 2) n + g ((x+1) / 2) n)) sums
                     (cot_pfd (x / 2) + cot_pfd ((x + 1) / 2))"
[PROOF STATE]
proof (prove)
using this:
x / 2 \<notin> \<int>
(x + 1) / 2 \<notin> \<int>

goal (1 subgoal):
 1. (\<lambda>n. f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n)) sums (cot_pfd (x / 2) + cot_pfd ((x + 1) / 2))
[PROOF STEP]
by (intro sums_add sums)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n)) sums (cot_pfd (x / 2) + cot_pfd ((x + 1) / 2))

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n)) sums (cot_pfd (x / 2) + cot_pfd ((x + 1) / 2))

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
have "(\<lambda>n. (f (x / 2) n + g (x / 2) n) + (f ((x+1) / 2) n + g ((x+1) / 2) n)) =
             (\<lambda>n. h x (2 * n) + h x (2 * n + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n)) = (\<lambda>n. h x (2 * n) + h x (2 * n + 1))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n) = h x (2 * n) + h x (2 * n + 1)
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n) = h x (2 * n) + h x (2 * n + 1)
[PROOF STEP]
have "(f (x / 2) n + g (x / 2) n) + (f ((x+1) / 2) n + g ((x+1) / 2) n) =
          (f (x / 2) n + f ((x+1) / 2) n) + (g (x / 2) n + g ((x+1) / 2) n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n) = f (x / 2) n + f ((x + 1) / 2) n + (g (x / 2) n + g ((x + 1) / 2) n)
[PROOF STEP]
by algebra
[PROOF STATE]
proof (state)
this:
f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n) = f (x / 2) n + f ((x + 1) / 2) n + (g (x / 2) n + g ((x + 1) / 2) n)

goal (1 subgoal):
 1. \<And>n. f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n) = h x (2 * n) + h x (2 * n + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n) = f (x / 2) n + f ((x + 1) / 2) n + (g (x / 2) n + g ((x + 1) / 2) n)

goal (1 subgoal):
 1. \<And>n. f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n) = h x (2 * n) + h x (2 * n + 1)
[PROOF STEP]
have "f (x / 2) n + f ((x+1) / 2) n = 2 * (f x (2 * n + 1) + f x (2 * n + 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (x / 2) n + f ((x + 1) / 2) n = 2 * (f x (2 * n + 1) + f x (2 * n + 2))
[PROOF STEP]
by (simp add: f_def field_simps)
[PROOF STATE]
proof (state)
this:
f (x / 2) n + f ((x + 1) / 2) n = 2 * (f x (2 * n + 1) + f x (2 * n + 2))

goal (1 subgoal):
 1. \<And>n. f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n) = h x (2 * n) + h x (2 * n + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f (x / 2) n + f ((x + 1) / 2) n = 2 * (f x (2 * n + 1) + f x (2 * n + 2))

goal (1 subgoal):
 1. \<And>n. f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n) = h x (2 * n) + h x (2 * n + 1)
[PROOF STEP]
have "g (x / 2) n + g ((x+1) / 2) n = 2 * (g x (2 * n) + g x (2 * n + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (x / 2) n + g ((x + 1) / 2) n = 2 * (g x (2 * n) + g x (2 * n + 1))
[PROOF STEP]
by (simp add: g_def field_simps)
[PROOF STATE]
proof (state)
this:
g (x / 2) n + g ((x + 1) / 2) n = 2 * (g x (2 * n) + g x (2 * n + 1))

goal (1 subgoal):
 1. \<And>n. f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n) = h x (2 * n) + h x (2 * n + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
g (x / 2) n + g ((x + 1) / 2) n = 2 * (g x (2 * n) + g x (2 * n + 1))

goal (1 subgoal):
 1. \<And>n. f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n) = h x (2 * n) + h x (2 * n + 1)
[PROOF STEP]
have "2 * (f x (2 * n + 1) + f x (2 * n + 2)) + \<dots> =
               h x (2 * n) + h x (2 * n + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (f x (2 * n + 1) + f x (2 * n + 2)) + 2 * (g x (2 * n) + g x (2 * n + 1)) = h x (2 * n) + h x (2 * n + 1)
[PROOF STEP]
unfolding h_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (f x (2 * n + 1) + f x (2 * n + 2)) + 2 * (g x (2 * n) + g x (2 * n + 1)) = 2 * (f x (2 * n + 1) + g x (2 * n)) + 2 * (f x (2 * n + 1 + 1) + g x (2 * n + 1))
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
2 * (f x (2 * n + 1) + f x (2 * n + 2)) + 2 * (g x (2 * n) + g x (2 * n + 1)) = h x (2 * n) + h x (2 * n + 1)

goal (1 subgoal):
 1. \<And>n. f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n) = h x (2 * n) + h x (2 * n + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n) = h x (2 * n) + h x (2 * n + 1)
[PROOF STEP]
show "(f (x / 2) n + g (x / 2) n) + (f ((x+1) / 2) n + g ((x+1) / 2) n) =
                  h x (2 * n) + h x (2 * n + 1)"
[PROOF STATE]
proof (prove)
using this:
f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n) = h x (2 * n) + h x (2 * n + 1)

goal (1 subgoal):
 1. f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n) = h x (2 * n) + h x (2 * n + 1)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n) = h x (2 * n) + h x (2 * n + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>n. f (x / 2) n + g (x / 2) n + (f ((x + 1) / 2) n + g ((x + 1) / 2) n)) = (\<lambda>n. h x (2 * n) + h x (2 * n + 1))

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. h x (2 * n) + h x (2 * n + 1)) sums (cot_pfd (x / 2) + cot_pfd ((x + 1) / 2))
[PROOF STEP]
have sum1:
    "(\<lambda>n. h x (2 * n) + h x (2 * n + 1)) sums (cot_pfd (x / 2) + cot_pfd ((x + 1) / 2))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. h x (2 * n) + h x (2 * n + 1)) sums (cot_pfd (x / 2) + cot_pfd ((x + 1) / 2))

goal (1 subgoal):
 1. (\<lambda>n. h x (2 * n) + h x (2 * n + 1)) sums (cot_pfd (x / 2) + cot_pfd ((x + 1) / 2))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>n. h x (2 * n) + h x (2 * n + 1)) sums (cot_pfd (x / 2) + cot_pfd ((x + 1) / 2))

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
have "f x \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x \<longlonglongrightarrow> 0
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 1 / (x + of_nat (Suc n))) \<longlonglongrightarrow> 0
[PROOF STEP]
by (intro tendsto_divide_0[OF tendsto_const]
              tendsto_add_filterlim_at_infinity[OF tendsto_const]
              filterlim_compose[OF tendsto_of_nat] filterlim_Suc)
[PROOF STATE]
proof (state)
this:
f x \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
hence "(\<lambda>n. 2 * (f x n + g x n) + 2 * (f x (Suc n) - f x n)) sums (2 * cot_pfd x + 2 * (0 - f x 0))"
[PROOF STATE]
proof (prove)
using this:
f x \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. 2 * (f x n + g x n) + 2 * (f x (Suc n) - f x n)) sums (2 * cot_pfd x + 2 * (0 - f x 0))
[PROOF STEP]
by (intro sums_add sums sums_mult telescope_sums assms)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 2 * (f x n + g x n) + 2 * (f x (Suc n) - f x n)) sums (2 * cot_pfd x + 2 * (0 - f x 0))

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 2 * (f x n + g x n) + 2 * (f x (Suc n) - f x n)) sums (2 * cot_pfd x + 2 * (0 - f x 0))

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
have "(\<lambda>n. 2 * (f x n + g x n) + 2 * (f x (Suc n) - f x n)) = h x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 2 * (f x n + g x n) + 2 * (f x (Suc n) - f x n)) = h x
[PROOF STEP]
by (simp add: h_def algebra_simps fun_eq_iff)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 2 * (f x n + g x n) + 2 * (f x (Suc n) - f x n)) = h x

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
h x sums (2 * cot_pfd x + 2 * (0 - f x 0))
[PROOF STEP]
have *: "h x sums (2 * cot_pfd x - 2 * f x 0)"
[PROOF STATE]
proof (prove)
using this:
h x sums (2 * cot_pfd x + 2 * (0 - f x 0))

goal (1 subgoal):
 1. h x sums (2 * cot_pfd x - 2 * f x 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
h x sums (2 * cot_pfd x - 2 * f x 0)

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
have "(\<lambda>n. sum (h x) {n * 2..<n * 2 + 2}) sums (2 * cot_pfd x - 2 * f x 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. sum (h x) {n * 2..<n * 2 + 2}) sums (2 * cot_pfd x - 2 * f x 0)
[PROOF STEP]
using sums_group[OF *, of 2]
[PROOF STATE]
proof (prove)
using this:
0 < 2 \<Longrightarrow> (\<lambda>n. sum (h x) {n * 2..<n * 2 + 2}) sums (2 * cot_pfd x - 2 * f x 0)

goal (1 subgoal):
 1. (\<lambda>n. sum (h x) {n * 2..<n * 2 + 2}) sums (2 * cot_pfd x - 2 * f x 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. sum (h x) {n * 2..<n * 2 + 2}) sums (2 * cot_pfd x - 2 * f x 0)

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. sum (h x) {n * 2..<n * 2 + 2}) sums (2 * cot_pfd x - 2 * f x 0)

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
have "(\<lambda>n. sum (h x) {n*2..<n*2+2}) = (\<lambda>n. h x (2 * n) + h x (2 * n + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. sum (h x) {n * 2..<n * 2 + 2}) = (\<lambda>n. h x (2 * n) + h x (2 * n + 1))
[PROOF STEP]
by (simp add: mult_ac)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. sum (h x) {n * 2..<n * 2 + 2}) = (\<lambda>n. h x (2 * n) + h x (2 * n + 1))

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. h x (2 * n) + h x (2 * n + 1)) sums (2 * cot_pfd x - 2 * f x 0)
[PROOF STEP]
have sum2: "(\<lambda>n. h x (2 * n) + h x (2 * n + 1)) sums (2 * cot_pfd x - 2 * f x 0)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. h x (2 * n) + h x (2 * n + 1)) sums (2 * cot_pfd x - 2 * f x 0)

goal (1 subgoal):
 1. (\<lambda>n. h x (2 * n) + h x (2 * n + 1)) sums (2 * cot_pfd x - 2 * f x 0)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>n. h x (2 * n) + h x (2 * n + 1)) sums (2 * cot_pfd x - 2 * f x 0)

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
have "cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) = 2 * cot_pfd x - 2 * f x 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) = 2 * cot_pfd x - 2 * f x 0
[PROOF STEP]
using sum1 sum2 sums_unique2
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. h x (2 * n) + h x (2 * n + 1)) sums (cot_pfd (x / 2) + cot_pfd ((x + 1) / 2))
(\<lambda>n. h x (2 * n) + h x (2 * n + 1)) sums (2 * cot_pfd x - 2 * f x 0)
\<lbrakk>?f sums ?a; ?f sums ?b\<rbrakk> \<Longrightarrow> ?a = ?b

goal (1 subgoal):
 1. cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) = 2 * cot_pfd x - 2 * f x 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) = 2 * cot_pfd x - 2 * f x 0

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) = 2 * cot_pfd x - 2 * f x 0

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
have "2 * f x 0 = 2 / (x + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * f x 0 = 2 / (x + 1)
[PROOF STEP]
by (simp add: f_def)
[PROOF STATE]
proof (state)
this:
2 * f x 0 = 2 / (x + 1)

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) = 2 * cot_pfd x - 2 / (x + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) = 2 * cot_pfd x - 2 / (x + 1)

goal (1 subgoal):
 1. 2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)
[PROOF STEP]
by algebra
[PROOF STATE]
proof (state)
this:
2 * cot_pfd x = cot_pfd (x / 2) + cot_pfd ((x + 1) / 2) + 2 / (x + 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hausdorff_distance_subset:
  assumes "A \<subseteq> B" "A \<noteq> {}" "bounded B"
  shows "hausdorff_distance A B = (SUP x\<in>B. infdist x A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hausdorff_distance A B = (SUP x\<in>B. infdist x A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. hausdorff_distance A B = (SUP x\<in>B. infdist x A)
[PROOF STEP]
have H: "B \<noteq> {}" "bounded A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<noteq> {} &&& bounded A
[PROOF STEP]
using assms bounded_subset
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> B
A \<noteq> {}
bounded B
\<lbrakk>bounded ?T; ?S \<subseteq> ?T\<rbrakk> \<Longrightarrow> bounded ?S

goal (1 subgoal):
 1. B \<noteq> {} &&& bounded A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B \<noteq> {}
bounded A

goal (1 subgoal):
 1. hausdorff_distance A B = (SUP x\<in>B. infdist x A)
[PROOF STEP]
have "(SUP x\<in>A. infdist x B) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP x\<in>A. infdist x B) = 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> B
A \<noteq> {}
bounded B

goal (1 subgoal):
 1. (SUP x\<in>A. infdist x B) = 0
[PROOF STEP]
by (simp add: subset_eq)
[PROOF STATE]
proof (state)
this:
(SUP x\<in>A. infdist x B) = 0

goal (1 subgoal):
 1. hausdorff_distance A B = (SUP x\<in>B. infdist x A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(SUP x\<in>A. infdist x B) = 0

goal (1 subgoal):
 1. hausdorff_distance A B = (SUP x\<in>B. infdist x A)
[PROOF STEP]
have "(SUP x\<in>B. infdist x A) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (SUP x\<in>B. infdist x A)
[PROOF STEP]
using bdd_above_infdist_aux[OF \<open>bounded B\<close> \<open>bounded A\<close>] infdist_nonneg[of _ A]
[PROOF STATE]
proof (prove)
using this:
bdd_above ((\<lambda>x. infdist x A) ` B)
0 \<le> infdist ?x A

goal (1 subgoal):
 1. 0 \<le> (SUP x\<in>B. infdist x A)
[PROOF STEP]
by (meson H(1) cSUP_upper2 ex_in_conv)
[PROOF STATE]
proof (state)
this:
0 \<le> (SUP x\<in>B. infdist x A)

goal (1 subgoal):
 1. hausdorff_distance A B = (SUP x\<in>B. infdist x A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(SUP x\<in>A. infdist x B) = 0
0 \<le> (SUP x\<in>B. infdist x A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(SUP x\<in>A. infdist x B) = 0
0 \<le> (SUP x\<in>B. infdist x A)

goal (1 subgoal):
 1. hausdorff_distance A B = (SUP x\<in>B. infdist x A)
[PROOF STEP]
unfolding hausdorff_distance_def
[PROOF STATE]
proof (prove)
using this:
(SUP x\<in>A. infdist x B) = 0
0 \<le> (SUP x\<in>B. infdist x A)

goal (1 subgoal):
 1. (if A = {} \<or> B = {} \<or> \<not> bounded A \<or> \<not> bounded B then 0 else max (SUP x\<in>A. infdist x B) (SUP x\<in>B. infdist x A)) = (SUP x\<in>B. infdist x A)
[PROOF STEP]
using assms H
[PROOF STATE]
proof (prove)
using this:
(SUP x\<in>A. infdist x B) = 0
0 \<le> (SUP x\<in>B. infdist x A)
A \<subseteq> B
A \<noteq> {}
bounded B
B \<noteq> {}
bounded A

goal (1 subgoal):
 1. (if A = {} \<or> B = {} \<or> \<not> bounded A \<or> \<not> bounded B then 0 else max (SUP x\<in>A. infdist x B) (SUP x\<in>B. infdist x A)) = (SUP x\<in>B. infdist x A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
hausdorff_distance A B = (SUP x\<in>B. infdist x A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eq_free_eq_subst_scheme_list:
  "(\<forall>n. n\<in>(free_tv A) \<longrightarrow> S1 n = S2 n) \<Longrightarrow> $S1 (A::type_scheme list) = $S2 A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. n \<in> free_tv A \<longrightarrow> S1 n = S2 n \<Longrightarrow> $ S1 A = $ S2 A
[PROOF STEP]
proof (induct A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>n. n \<in> free_tv [] \<longrightarrow> S1 n = S2 n \<Longrightarrow> $ S1 [] = $ S2 []
 2. \<And>a A. \<lbrakk>\<forall>n. n \<in> free_tv A \<longrightarrow> S1 n = S2 n \<Longrightarrow> $ S1 A = $ S2 A; \<forall>n. n \<in> free_tv (a # A) \<longrightarrow> S1 n = S2 n\<rbrakk> \<Longrightarrow> $ S1 (a # A) = $ S2 (a # A)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
\<forall>n. n \<in> free_tv [] \<longrightarrow> S1 n = S2 n

goal (2 subgoals):
 1. \<forall>n. n \<in> free_tv [] \<longrightarrow> S1 n = S2 n \<Longrightarrow> $ S1 [] = $ S2 []
 2. \<And>a A. \<lbrakk>\<forall>n. n \<in> free_tv A \<longrightarrow> S1 n = S2 n \<Longrightarrow> $ S1 A = $ S2 A; \<forall>n. n \<in> free_tv (a # A) \<longrightarrow> S1 n = S2 n\<rbrakk> \<Longrightarrow> $ S1 (a # A) = $ S2 (a # A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>n. n \<in> free_tv [] \<longrightarrow> S1 n = S2 n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>n. n \<in> free_tv [] \<longrightarrow> S1 n = S2 n

goal (1 subgoal):
 1. $ S1 [] = $ S2 []
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
$ S1 [] = $ S2 []

goal (1 subgoal):
 1. \<And>a A. \<lbrakk>\<forall>n. n \<in> free_tv A \<longrightarrow> S1 n = S2 n \<Longrightarrow> $ S1 A = $ S2 A; \<forall>n. n \<in> free_tv (a # A) \<longrightarrow> S1 n = S2 n\<rbrakk> \<Longrightarrow> $ S1 (a # A) = $ S2 (a # A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a A. \<lbrakk>\<forall>n. n \<in> free_tv A \<longrightarrow> S1 n = S2 n \<Longrightarrow> $ S1 A = $ S2 A; \<forall>n. n \<in> free_tv (a # A) \<longrightarrow> S1 n = S2 n\<rbrakk> \<Longrightarrow> $ S1 (a # A) = $ S2 (a # A)
[PROOF STEP]
case Cons
[PROOF STATE]
proof (state)
this:
\<forall>n. n \<in> free_tv A_ \<longrightarrow> S1 n = S2 n \<Longrightarrow> $ S1 A_ = $ S2 A_
\<forall>n. n \<in> free_tv (a_ # A_) \<longrightarrow> S1 n = S2 n

goal (1 subgoal):
 1. \<And>a A. \<lbrakk>\<forall>n. n \<in> free_tv A \<longrightarrow> S1 n = S2 n \<Longrightarrow> $ S1 A = $ S2 A; \<forall>n. n \<in> free_tv (a # A) \<longrightarrow> S1 n = S2 n\<rbrakk> \<Longrightarrow> $ S1 (a # A) = $ S2 (a # A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>n. n \<in> free_tv A_ \<longrightarrow> S1 n = S2 n \<Longrightarrow> $ S1 A_ = $ S2 A_
\<forall>n. n \<in> free_tv (a_ # A_) \<longrightarrow> S1 n = S2 n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>n. n \<in> free_tv A_ \<longrightarrow> S1 n = S2 n \<Longrightarrow> $ S1 A_ = $ S2 A_
\<forall>n. n \<in> free_tv (a_ # A_) \<longrightarrow> S1 n = S2 n

goal (1 subgoal):
 1. $ S1 (a_ # A_) = $ S2 (a_ # A_)
[PROOF STEP]
by (fastforce intro: eq_free_eq_subst_type_scheme)
[PROOF STATE]
proof (state)
this:
$ S1 (a_ # A_) = $ S2 (a_ # A_)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ln_float_interval: "ln ` set_of (real_interval x) \<subseteq> set_of (real_interval y)"
  if "ln_float_interval p x = Some y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln ` set_of (real_interval x) \<subseteq> set_of (real_interval y)
[PROOF STEP]
using that lb_ln[of "lower y" p "lower x"]
    ub_ln[of "lower y" p "lower x"]
[PROOF STATE]
proof (prove)
using this:
ln_float_interval p x = Some y
Some (lower y) = lb_ln p (lower x) \<Longrightarrow> real_of_float (lower y) \<le> ln (real_of_float (lower x))
Some (lower y) = lb_ln p (lower x) \<Longrightarrow> 0 < real_of_float (lower x)
Some (lower y) = ub_ln p (lower x) \<Longrightarrow> ln (real_of_float (lower x)) \<le> real_of_float (lower y)
Some (lower y) = ub_ln p (lower x) \<Longrightarrow> 0 < real_of_float (lower x)

goal (1 subgoal):
 1. ln ` set_of (real_interval x) \<subseteq> set_of (real_interval y)
[PROOF STEP]
apply (auto simp add: set_of_eq ln_float_interval_eq_Some_conv ln_le_cancel_iff)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. \<lbrakk>real_of_float (lower y) \<le> ln (real_of_float (lower x)); 0 < real_of_float (lower x); Some (lower y) = ub_ln p (lower x) \<Longrightarrow> ln (real_of_float (lower x)) = real_of_float (lower y); lb_ln p (lower x) = Some (lower y); ub_ln p (upper x) = Some (upper y); real_of_float (lower x) \<le> xa; xa \<le> real_of_float (upper x)\<rbrakk> \<Longrightarrow> real_of_float (lower y) \<le> ln xa
 2. \<And>xa. \<lbrakk>real_of_float (lower y) \<le> ln (real_of_float (lower x)); 0 < real_of_float (lower x); Some (lower y) = ub_ln p (lower x) \<Longrightarrow> ln (real_of_float (lower x)) = real_of_float (lower y); lb_ln p (lower x) = Some (lower y); ub_ln p (upper x) = Some (upper y); real_of_float (lower x) \<le> xa; xa \<le> real_of_float (upper x)\<rbrakk> \<Longrightarrow> ln xa \<le> real_of_float (upper y)
[PROOF STEP]
apply (meson less_le_trans ln_less_cancel_iff not_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>real_of_float (lower y) \<le> ln (real_of_float (lower x)); 0 < real_of_float (lower x); Some (lower y) = ub_ln p (lower x) \<Longrightarrow> ln (real_of_float (lower x)) = real_of_float (lower y); lb_ln p (lower x) = Some (lower y); ub_ln p (upper x) = Some (upper y); real_of_float (lower x) \<le> xa; xa \<le> real_of_float (upper x)\<rbrakk> \<Longrightarrow> ln xa \<le> real_of_float (upper y)
[PROOF STEP]
by (meson less_le_trans ln_less_cancel_iff not_le ub_lnD)


[STATEMENT]
lemma log_concave:
  fixes b :: real
  assumes "b > 1"
  shows "concave_on {0<..} (\<lambda> x. log b x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concave_on {0<..} (log b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < b

goal (1 subgoal):
 1. concave_on {0<..} (log b)
[PROOF STEP]
by (intro f''_le0_imp_concave derivative_eq_intros | simp)+


[STATEMENT]
lemma ln_ge_zero_iff [simp]: "0 < x \<Longrightarrow> 0 \<le> ln x \<longleftrightarrow> 1 \<le> x"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> (0 \<le> ln x) = (1 \<le> x)
[PROOF STEP]
using ln_le_cancel_iff [of 1 x]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < 1; 0 < x\<rbrakk> \<Longrightarrow> (ln 1 \<le> ln x) = (1 \<le> x)

goal (1 subgoal):
 1. 0 < x \<Longrightarrow> (0 \<le> ln x) = (1 \<le> x)
[PROOF STEP]
by simp


[STATEMENT]
lemma degree_Q' [simp]: "Polynomial.degree Q' = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.degree Q' = n
[PROOF STEP]
proof (rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Polynomial.degree Q' \<le> n
 2. n \<le> Polynomial.degree Q'
[PROOF STEP]
show "Polynomial.degree Q' \<ge> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> Polynomial.degree Q'
[PROOF STEP]
by (rule le_degree) (auto simp: coeff_Q')
[PROOF STATE]
proof (state)
this:
n \<le> Polynomial.degree Q'

goal (1 subgoal):
 1. Polynomial.degree Q' \<le> n
[PROOF STEP]
show "Polynomial.degree Q' \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.degree Q' \<le> n
[PROOF STEP]
by (rule degree_le) (auto simp: coeff_Q')
[PROOF STATE]
proof (state)
this:
Polynomial.degree Q' \<le> n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma abs_summable_on_nat_iff:
  "f abs_summable_on (A :: nat set) \<longleftrightarrow> summable (\<lambda>n. if n \<in> A then norm (f n) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f abs_summable_on A) = summable (\<lambda>n. if n \<in> A then norm (f n) else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f abs_summable_on A) = summable (\<lambda>n. if n \<in> A then norm (f n) else 0)
[PROOF STEP]
have "f abs_summable_on A \<longleftrightarrow> summable (\<lambda>x. norm (if x \<in> A then f x else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f abs_summable_on A) = summable (\<lambda>x. norm (if x \<in> A then f x else (0::'a)))
[PROOF STEP]
by (subst abs_summable_on_restrict'[of _ UNIV])
       (simp_all add: abs_summable_on_def integrable_count_space_nat_iff)
[PROOF STATE]
proof (state)
this:
(f abs_summable_on A) = summable (\<lambda>x. norm (if x \<in> A then f x else (0::'a)))

goal (1 subgoal):
 1. (f abs_summable_on A) = summable (\<lambda>n. if n \<in> A then norm (f n) else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(f abs_summable_on A) = summable (\<lambda>x. norm (if x \<in> A then f x else (0::'a)))

goal (1 subgoal):
 1. (f abs_summable_on A) = summable (\<lambda>n. if n \<in> A then norm (f n) else 0)
[PROOF STEP]
have "(\<lambda>x. norm (if x \<in> A then f x else 0)) = (\<lambda>x. if x \<in> A then norm (f x) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. norm (if x \<in> A then f x else (0::'a))) = (\<lambda>x. if x \<in> A then norm (f x) else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. norm (if x \<in> A then f x else (0::'a))) = (\<lambda>x. if x \<in> A then norm (f x) else 0)

goal (1 subgoal):
 1. (f abs_summable_on A) = summable (\<lambda>n. if n \<in> A then norm (f n) else 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(f abs_summable_on A) = summable (\<lambda>x. if x \<in> A then norm (f x) else 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(f abs_summable_on A) = summable (\<lambda>x. if x \<in> A then norm (f x) else 0)

goal (1 subgoal):
 1. (f abs_summable_on A) = summable (\<lambda>n. if n \<in> A then norm (f n) else 0)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(f abs_summable_on A) = summable (\<lambda>n. if n \<in> A then norm (f n) else 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Span_m_inv_simprule [simp]:
  assumes "set Us \<subseteq> carrier R"
  shows "\<lbrakk> k \<in> K - { \<zero> }; a \<in> carrier R \<rbrakk> \<Longrightarrow> k \<otimes> a \<in> Span K Us \<Longrightarrow> a \<in> Span K Us"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k \<in> K - {\<zero>}; a \<in> carrier R; k \<otimes> a \<in> Span K Us\<rbrakk> \<Longrightarrow> a \<in> Span K Us
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>k \<in> K - {\<zero>}; a \<in> carrier R; k \<otimes> a \<in> Span K Us\<rbrakk> \<Longrightarrow> a \<in> Span K Us
[PROOF STEP]
assume k: "k \<in> K - { \<zero> }" and a: "a \<in> carrier R" and ka: "k \<otimes> a \<in> Span K Us"
[PROOF STATE]
proof (state)
this:
k \<in> K - {\<zero>}
a \<in> carrier R
k \<otimes> a \<in> Span K Us

goal (1 subgoal):
 1. \<lbrakk>k \<in> K - {\<zero>}; a \<in> carrier R; k \<otimes> a \<in> Span K Us\<rbrakk> \<Longrightarrow> a \<in> Span K Us
[PROOF STEP]
have inv_k: "inv k \<in> K" "inv k \<otimes> k = \<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv k \<in> K &&& inv k \<otimes> k = \<one>
[PROOF STEP]
using subfield_m_inv[OF K k]
[PROOF STATE]
proof (prove)
using this:
inv k \<in> K - {\<zero>}
k \<otimes> inv k = \<one>
inv k \<otimes> k = \<one>

goal (1 subgoal):
 1. inv k \<in> K &&& inv k \<otimes> k = \<one>
[PROOF STEP]
by simp+
[PROOF STATE]
proof (state)
this:
inv k \<in> K
inv k \<otimes> k = \<one>

goal (1 subgoal):
 1. \<lbrakk>k \<in> K - {\<zero>}; a \<in> carrier R; k \<otimes> a \<in> Span K Us\<rbrakk> \<Longrightarrow> a \<in> Span K Us
[PROOF STEP]
hence "inv k \<otimes> (k \<otimes> a) \<in> Span K Us"
[PROOF STATE]
proof (prove)
using this:
inv k \<in> K
inv k \<otimes> k = \<one>

goal (1 subgoal):
 1. inv k \<otimes> (k \<otimes> a) \<in> Span K Us
[PROOF STEP]
using Span_smult_closed[OF assms _ ka]
[PROOF STATE]
proof (prove)
using this:
inv k \<in> K
inv k \<otimes> k = \<one>
?k \<in> K \<Longrightarrow> ?k \<otimes> (k \<otimes> a) \<in> Span K Us

goal (1 subgoal):
 1. inv k \<otimes> (k \<otimes> a) \<in> Span K Us
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inv k \<otimes> (k \<otimes> a) \<in> Span K Us

goal (1 subgoal):
 1. \<lbrakk>k \<in> K - {\<zero>}; a \<in> carrier R; k \<otimes> a \<in> Span K Us\<rbrakk> \<Longrightarrow> a \<in> Span K Us
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
inv k \<otimes> (k \<otimes> a) \<in> Span K Us

goal (1 subgoal):
 1. a \<in> Span K Us
[PROOF STEP]
using inv_k subring_props(1)a k
[PROOF STATE]
proof (prove)
using this:
inv k \<otimes> (k \<otimes> a) \<in> Span K Us
inv k \<in> K
inv k \<otimes> k = \<one>
K \<subseteq> carrier R
a \<in> carrier R
k \<in> K - {\<zero>}

goal (1 subgoal):
 1. a \<in> Span K Us
[PROOF STEP]
by (metis (no_types, lifting) DiffE l_one m_assoc subset_iff)
[PROOF STATE]
proof (state)
this:
a \<in> Span K Us

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma countable_imp_Lindelof_space:
  assumes "countable(topspace X)"
  shows "Lindelof_space X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lindelof_space X
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Lindelof_space X
[PROOF STEP]
have "Lindelof_space (subtopology X (\<Union>x \<in> topspace X. {x}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lindelof_space (subtopology X (\<Union>x\<in>topspace X. {x}))
[PROOF STEP]
proof (rule Lindelof_space_Union)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. countable ((\<lambda>x. {x}) ` topspace X)
 2. \<And>U. U \<in> (\<lambda>x. {x}) ` topspace X \<Longrightarrow> Lindelof_space (subtopology X U)
[PROOF STEP]
show "countable ((\<lambda>x. {x}) ` topspace X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable ((\<lambda>x. {x}) ` topspace X)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
countable (topspace X)

goal (1 subgoal):
 1. countable ((\<lambda>x. {x}) ` topspace X)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
countable ((\<lambda>x. {x}) ` topspace X)

goal (1 subgoal):
 1. \<And>U. U \<in> (\<lambda>x. {x}) ` topspace X \<Longrightarrow> Lindelof_space (subtopology X U)
[PROOF STEP]
show "Lindelof_space (subtopology X U)"
      if "U \<in> (\<lambda>x. {x}) ` topspace X" for U
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lindelof_space (subtopology X U)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Lindelof_space (subtopology X U)
[PROOF STEP]
have "compactin X U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compactin X U
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
U \<in> (\<lambda>x. {x}) ` topspace X

goal (1 subgoal):
 1. compactin X U
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
compactin X U

goal (1 subgoal):
 1. Lindelof_space (subtopology X U)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
compactin X U
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
compactin X U

goal (1 subgoal):
 1. Lindelof_space (subtopology X U)
[PROOF STEP]
by (meson compact_imp_Lindelof_space compact_space_subtopology)
[PROOF STATE]
proof (state)
this:
Lindelof_space (subtopology X U)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?U \<in> (\<lambda>x. {x}) ` topspace X \<Longrightarrow> Lindelof_space (subtopology X ?U)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Lindelof_space (subtopology X (\<Union>x\<in>topspace X. {x}))

goal (1 subgoal):
 1. Lindelof_space X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Lindelof_space (subtopology X (\<Union>x\<in>topspace X. {x}))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Lindelof_space (subtopology X (\<Union>x\<in>topspace X. {x}))

goal (1 subgoal):
 1. Lindelof_space X
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Lindelof_space X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Liminf_bounded:
  assumes le: "eventually (\<lambda>n. C \<le> X n) F"
  shows "C \<le> Liminf F X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C \<le> Liminf F X
[PROOF STEP]
using Liminf_mono[OF le] Liminf_const[of F C]
[PROOF STATE]
proof (prove)
using this:
Liminf F (\<lambda>n. C) \<le> Liminf F X
F \<noteq> bot \<Longrightarrow> Liminf F (\<lambda>x. C) = C

goal (1 subgoal):
 1. C \<le> Liminf F X
[PROOF STEP]
by (cases "F = bot") simp_all


[STATEMENT]
lemma ccw_sorted_scaleR: "ccw.sortedP 0 xs \<Longrightarrow> r > 0 \<Longrightarrow> ccw.sortedP 0 (map ((*\<^sub>R) r) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ccw.sortedP 0 xs; 0 < r\<rbrakk> \<Longrightarrow> ccw.sortedP 0 (map ((*\<^sub>R) r) xs)
[PROOF STEP]
by (induct xs)
    (auto intro!: ccw.sortedP.Cons ccw_scale23 elim!: ccw.sortedP_Cons simp del: scaleR_Pair)


[STATEMENT]
lemma card_of_Un1[simp]:
shows "|A| \<le>o |A \<union> B| "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |A| \<le>o |A \<union> B|
[PROOF STEP]
using inj_on_id[of A] card_of_ordLeq[of A _]
[PROOF STATE]
proof (prove)
using this:
inj_on id A
(\<exists>f. inj_on f A \<and> f ` A \<subseteq> ?B) = (|A| \<le>o |?B|)

goal (1 subgoal):
 1. |A| \<le>o |A \<union> B|
[PROOF STEP]
by fastforce