[STATEMENT]
lemma ordinal_utility_scale_transl:
  assumes "(c::real) > 0"
  shows "ordinal_utility carrier relation (\<lambda>x. c * (u x) + d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ordinal_utility carrier relation (\<lambda>x. c * u x + d)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ordinal_utility carrier relation (\<lambda>x. c * u x + d)
[PROOF STEP]
have "monotone (>) (>) (\<lambda>x. c * x + d)" (is "monotone (>) (>) ?fn" )
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monotone (\<lambda>x y. y < x) (\<lambda>x y. y < x) (\<lambda>x. c * x + d)
[PROOF STEP]
by (simp add: assms monotone_def)
[PROOF STATE]
proof (state)
this:
monotone (\<lambda>x y. y < x) (\<lambda>x y. y < x) (\<lambda>x. c * x + d)

goal (1 subgoal):
 1. ordinal_utility carrier relation (\<lambda>x. c * u x + d)
[PROOF STEP]
with monotone_comp_is_utility
[PROOF STATE]
proof (chain)
picking this:
monotone (\<lambda>x y. y < x) (\<lambda>x y. y < x) ?f \<Longrightarrow> ordinal_utility carrier relation (?f \<circ> u)
monotone (\<lambda>x y. y < x) (\<lambda>x y. y < x) (\<lambda>x. c * x + d)
[PROOF STEP]
have "ordinal_utility carrier relation (?fn \<circ> u)"
[PROOF STATE]
proof (prove)
using this:
monotone (\<lambda>x y. y < x) (\<lambda>x y. y < x) ?f \<Longrightarrow> ordinal_utility carrier relation (?f \<circ> u)
monotone (\<lambda>x y. y < x) (\<lambda>x y. y < x) (\<lambda>x. c * x + d)

goal (1 subgoal):
 1. ordinal_utility carrier relation ((\<lambda>x. c * x + d) \<circ> u)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
ordinal_utility carrier relation ((\<lambda>x. c * x + d) \<circ> u)

goal (1 subgoal):
 1. ordinal_utility carrier relation (\<lambda>x. c * u x + d)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
ordinal_utility carrier relation ((\<lambda>x. c * x + d) \<circ> u)

goal (1 subgoal):
 1. ordinal_utility carrier relation (\<lambda>x. c * u x + d)
[PROOF STEP]
have "?fn \<circ> u =  (\<lambda>x. c * (u x) + d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. c * x + d) \<circ> u = (\<lambda>x. c * u x + d)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. c * x + d) \<circ> u = (\<lambda>x. c * u x + d)

goal (1 subgoal):
 1. ordinal_utility carrier relation (\<lambda>x. c * u x + d)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ordinal_utility carrier relation (\<lambda>a. c * u a + d)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ordinal_utility carrier relation (\<lambda>a. c * u a + d)

goal (1 subgoal):
 1. ordinal_utility carrier relation (\<lambda>x. c * u x + d)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ordinal_utility carrier relation (\<lambda>x. c * u x + d)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma primroot_shortest_root: assumes "u \<noteq> \<epsilon>" shows "\<^bold>|\<rho> u\<^bold>| = (LEAST d. (\<exists> r. (u \<in> r*) \<and> \<^bold>|r\<^bold>| = d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<^bold>|\<rho> u\<^bold>| = (LEAST d. \<exists>r. u \<in> r* \<and> \<^bold>|r\<^bold>| = d)
[PROOF STEP]
using  Least_equality[of "\<lambda> k. (\<exists> r. (u \<in> r*) \<and> \<^bold>|r\<^bold>| = k)" "\<^bold>|\<rho> u\<^bold>|"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<exists>r. u \<in> r* \<and> \<^bold>|r\<^bold>| = \<^bold>|\<rho> u\<^bold>|; \<And>y. \<exists>r. u \<in> r* \<and> \<^bold>|r\<^bold>| = y \<Longrightarrow> \<^bold>|\<rho> u\<^bold>| \<le> y\<rbrakk> \<Longrightarrow> (LEAST k. \<exists>r. u \<in> r* \<and> \<^bold>|r\<^bold>| = k) = \<^bold>|\<rho> u\<^bold>|

goal (1 subgoal):
 1. \<^bold>|\<rho> u\<^bold>| = (LEAST d. \<exists>r. u \<in> r* \<and> \<^bold>|r\<^bold>| = d)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>r. u \<in> r* \<and> \<^bold>|r\<^bold>| = \<^bold>|\<rho> u\<^bold>|
 2. \<And>y. \<exists>r. u \<in> r* \<and> \<^bold>|r\<^bold>| = y \<Longrightarrow> \<^bold>|\<rho> u\<^bold>| \<le> y
[PROOF STEP]
show "\<exists>r. u \<in> r* \<and> \<^bold>|r\<^bold>| = \<^bold>|\<rho> u\<^bold>|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>r. u \<in> r* \<and> \<^bold>|r\<^bold>| = \<^bold>|\<rho> u\<^bold>|
[PROOF STEP]
using assms primitive_rootP_def primroot_is_primroot
[PROOF STATE]
proof (prove)
using this:
u \<noteq> \<epsilon>
?x \<in>\<^sub>p ?r * = (?x \<noteq> \<epsilon> \<and> ?x \<in> ?r* \<and> primitive ?r)
?x \<noteq> \<epsilon> \<Longrightarrow> ?x \<in>\<^sub>p \<rho> ?x *

goal (1 subgoal):
 1. \<exists>r. u \<in> r* \<and> \<^bold>|r\<^bold>| = \<^bold>|\<rho> u\<^bold>|
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>r. u \<in> r* \<and> \<^bold>|r\<^bold>| = \<^bold>|\<rho> u\<^bold>|

goal (1 subgoal):
 1. \<And>y. \<exists>r. u \<in> r* \<and> \<^bold>|r\<^bold>| = y \<Longrightarrow> \<^bold>|\<rho> u\<^bold>| \<le> y
[PROOF STEP]
show "\<And>y. \<exists>r. u \<in> r* \<and> \<^bold>|r\<^bold>| = y \<Longrightarrow> \<^bold>|\<rho> u\<^bold>| \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. \<exists>r. u \<in> r* \<and> \<^bold>|r\<^bold>| = y \<Longrightarrow> \<^bold>|\<rho> u\<^bold>| \<le> y
[PROOF STEP]
using assms primroot_shorter_root
[PROOF STATE]
proof (prove)
using this:
u \<noteq> \<epsilon>
\<lbrakk>?u \<noteq> \<epsilon>; ?u \<in> ?q*\<rbrakk> \<Longrightarrow> \<^bold>|\<rho> ?u\<^bold>| \<le> \<^bold>|?q\<^bold>|

goal (1 subgoal):
 1. \<And>y. \<exists>r. u \<in> r* \<and> \<^bold>|r\<^bold>| = y \<Longrightarrow> \<^bold>|\<rho> u\<^bold>| \<le> y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>r. u \<in> r* \<and> \<^bold>|r\<^bold>| = ?y \<Longrightarrow> \<^bold>|\<rho> u\<^bold>| \<le> ?y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma LIMSEQ_binaryset:
  assumes f: "f {} = 0"
  shows  "(\<lambda>n. \<Sum>i<n. f (binaryset A B i)) \<longlonglongrightarrow> f A + f B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i<n. f (binaryset A B i)) \<longlonglongrightarrow> f A + f B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i<n. f (binaryset A B i)) \<longlonglongrightarrow> f A + f B
[PROOF STEP]
have "(\<lambda>n. \<Sum>i < Suc (Suc n). f (binaryset A B i)) = (\<lambda>n. f A + f B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i<Suc (Suc n). f (binaryset A B i)) = (\<lambda>n. f A + f B)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (\<Sum>i<Suc (Suc n). f (binaryset A B i)) = f A + f B
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (\<Sum>i<Suc (Suc n). f (binaryset A B i)) = f A + f B
[PROOF STEP]
show "(\<Sum>i < Suc (Suc n). f (binaryset A B i)) = f A + f B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<Suc (Suc n). f (binaryset A B i)) = f A + f B
[PROOF STEP]
by (induct n)  (auto simp add: binaryset_def f)
[PROOF STATE]
proof (state)
this:
(\<Sum>i<Suc (Suc n). f (binaryset A B i)) = f A + f B

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>i<Suc (Suc n). f (binaryset A B i)) = (\<lambda>n. f A + f B)

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i<n. f (binaryset A B i)) \<longlonglongrightarrow> f A + f B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>i<Suc (Suc n). f (binaryset A B i)) = (\<lambda>n. f A + f B)

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i<n. f (binaryset A B i)) \<longlonglongrightarrow> f A + f B
[PROOF STEP]
have "... \<longlonglongrightarrow> f A + f B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. f A + f B) \<longlonglongrightarrow> f A + f B
[PROOF STEP]
by (rule tendsto_const)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. f A + f B) \<longlonglongrightarrow> f A + f B

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i<n. f (binaryset A B i)) \<longlonglongrightarrow> f A + f B
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. \<Sum>i<Suc (Suc n). f (binaryset A B i)) = (\<lambda>n. f A + f B)
(\<lambda>n. f A + f B) \<longlonglongrightarrow> f A + f B
[PROOF STEP]
have "(\<lambda>n. \<Sum>i< Suc (Suc n). f (binaryset A B i)) \<longlonglongrightarrow> f A + f B"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>i<Suc (Suc n). f (binaryset A B i)) = (\<lambda>n. f A + f B)
(\<lambda>n. f A + f B) \<longlonglongrightarrow> f A + f B

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i<Suc (Suc n). f (binaryset A B i)) \<longlonglongrightarrow> f A + f B
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>i<Suc (Suc n). f (binaryset A B i)) \<longlonglongrightarrow> f A + f B

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i<n. f (binaryset A B i)) \<longlonglongrightarrow> f A + f B
[PROOF STEP]
hence "(\<lambda>n. \<Sum>i< n+2. f (binaryset A B i)) \<longlonglongrightarrow> f A + f B"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>i<Suc (Suc n). f (binaryset A B i)) \<longlonglongrightarrow> f A + f B

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i<n + 2. f (binaryset A B i)) \<longlonglongrightarrow> f A + f B
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>i<n + 2. f (binaryset A B i)) \<longlonglongrightarrow> f A + f B

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i<n. f (binaryset A B i)) \<longlonglongrightarrow> f A + f B
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>i<n + 2. f (binaryset A B i)) \<longlonglongrightarrow> f A + f B

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i<n. f (binaryset A B i)) \<longlonglongrightarrow> f A + f B
[PROOF STEP]
by (rule LIMSEQ_offset [where k=2])
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>i<n. f (binaryset A B i)) \<longlonglongrightarrow> f A + f B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma transpose_matrix_zero[simp]: "transpose_matrix 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transpose_matrix 0 = 0
[PROOF STEP]
apply (simp add: transpose_matrix_def zero_matrix_def RepAbs_matrix)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs_matrix (transpose_infmatrix (\<lambda>j i. 0::'a)) = Abs_matrix (\<lambda>j i. 0::'a)
[PROOF STEP]
apply (subst Rep_matrix_inject[symmetric], (rule ext)+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. Rep_matrix (Abs_matrix (transpose_infmatrix (\<lambda>j i. 0::'a))) x xa = Rep_matrix (Abs_matrix (\<lambda>j i. 0::'a)) x xa
[PROOF STEP]
apply (simp add: RepAbs_matrix)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma minus_left_distributivity:
      "rat_poly_times p (q - r)
                  = (rat_poly_times p q) - (rat_poly_times p r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly_times p (q - r) = rat_poly_times p q - rat_poly_times p r
[PROOF STEP]
using minus_mult_right right_diff_distrib
[PROOF STATE]
proof (prove)
using this:
- (?a * ?b) = ?a * - ?b
?a * (?b - ?c) = ?a * ?b - ?a * ?c

goal (1 subgoal):
 1. rat_poly_times p (q - r) = rat_poly_times p q - rat_poly_times p r
[PROOF STEP]
by blast


[STATEMENT]
lemma distincts_grouped_by_fst:
  assumes "distinct xs" shows "distincts (grouped_by_fst xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distincts (grouped_by_fst xs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. distincts (grouped_by_fst xs)
[PROOF STEP]
have list_eq_setD: "\<And>xs ys. xs = ys \<Longrightarrow> set xs = set ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs ys. xs = ys \<Longrightarrow> set xs = set ys
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?xs = ?ys \<Longrightarrow> set ?xs = set ?ys

goal (1 subgoal):
 1. distincts (grouped_by_fst xs)
[PROOF STEP]
have inj: "inj_on (\<lambda>u. filter (\<lambda>x. fst x = u) xs) (fst ` set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>u. filter (\<lambda>x. fst x = u) xs) (fst ` set xs)
[PROOF STEP]
by (rule inj_onI) (drule list_eq_setD, auto)
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>u. filter (\<lambda>x. fst x = u) xs) (fst ` set xs)

goal (1 subgoal):
 1. distincts (grouped_by_fst xs)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
distinct xs
inj_on (\<lambda>u. filter (\<lambda>x. fst x = u) xs) (fst ` set xs)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
distinct xs
inj_on (\<lambda>u. filter (\<lambda>x. fst x = u) xs) (fst ` set xs)

goal (1 subgoal):
 1. distincts (grouped_by_fst xs)
[PROOF STEP]
by (auto simp: grouped_by_fst_def distincts_def distinct_map filter_empty_conv)
[PROOF STATE]
proof (state)
this:
distincts (grouped_by_fst xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma  Range_nodes_connected: "Range {(x, y) |x y. nodes_connected G x y} = V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Range {(x, y) |x y. nodes_connected G x y} = V
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> V \<Longrightarrow> \<exists>xa. nodes_connected G xa x
[PROOF STEP]
subgoal for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> V \<Longrightarrow> \<exists>xa. nodes_connected G xa x
[PROOF STEP]
apply(rule exI[where x=x])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> V \<Longrightarrow> nodes_connected G x x
[PROOF STEP]
apply(rule exI[where x="[]"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> V \<Longrightarrow> is_path_undir G x [] x
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done

\<comment> \<open>adaptation of a proof by Julian Biendarra\<close>


[STATEMENT]
lemma rGamma_1 [simp]: "rGamma 1 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rGamma (1::'a) = (1::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rGamma (1::'a) = (1::'a)
[PROOF STEP]
have A: "eventually (\<lambda>n. rGamma_series 1 n = of_nat (Suc n) / of_nat n) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. rGamma_series (1::'b) n = of_nat (Suc n) / of_nat n
[PROOF STEP]
using eventually_gt_at_top[of "0::nat"]
[PROOF STATE]
proof (prove)
using this:
eventually ((<) 0) sequentially

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. rGamma_series (1::'b) n = of_nat (Suc n) / of_nat n
[PROOF STEP]
by (force elim!: eventually_mono simp: rGamma_series_def exp_of_real pochhammer_fact
                    field_split_simps pochhammer_rec' dest!: pochhammer_eq_0_imp_nonpos_Int)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. rGamma_series (1::?'b1) n = of_nat (Suc n) / of_nat n

goal (1 subgoal):
 1. rGamma (1::'a) = (1::'a)
[PROOF STEP]
have "rGamma_series 1 \<longlonglongrightarrow> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rGamma_series (1::'b) \<longlonglongrightarrow> (1::'b)
[PROOF STEP]
by (subst tendsto_cong[OF A]) (rule LIMSEQ_Suc_n_over_n)
[PROOF STATE]
proof (state)
this:
rGamma_series (1::?'b2) \<longlonglongrightarrow> (1::?'b2)

goal (1 subgoal):
 1. rGamma (1::'a) = (1::'a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
rGamma_series (1::?'b2) \<longlonglongrightarrow> (1::?'b2)

goal (1 subgoal):
 1. rGamma (1::'a) = (1::'a)
[PROOF STEP]
have "rGamma_series 1 \<longlonglongrightarrow> rGamma 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rGamma_series (1::'b) \<longlonglongrightarrow> rGamma (1::'b)
[PROOF STEP]
by (rule tendsto_intros)
[PROOF STATE]
proof (state)
this:
rGamma_series (1::?'b3) \<longlonglongrightarrow> rGamma (1::?'b3)

goal (1 subgoal):
 1. rGamma (1::'a) = (1::'a)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
rGamma_series (1::?'b2) \<longlonglongrightarrow> (1::?'b2)
rGamma_series (1::?'b3) \<longlonglongrightarrow> rGamma (1::?'b3)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rGamma_series (1::?'b2) \<longlonglongrightarrow> (1::?'b2)
rGamma_series (1::?'b3) \<longlonglongrightarrow> rGamma (1::?'b3)

goal (1 subgoal):
 1. rGamma (1::'a) = (1::'a)
[PROOF STEP]
by (intro LIMSEQ_unique)
[PROOF STATE]
proof (state)
this:
rGamma (1::'a) = (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fact_asymp_equiv_aux:
  "fact \<sim>[at_top] (\<lambda>x. exp c * sqrt (real x) * (real x / exp 1) powr real x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact \<sim>[sequentially] (\<lambda>x. exp c * sqrt (real x) * (real x / exp 1) powr real x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fact \<sim>[sequentially] (\<lambda>x. exp c * sqrt (real x) * (real x / exp 1) powr real x)
[PROOF STEP]
include asymp_equiv_notation
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fact \<sim>[sequentially] (\<lambda>x. exp c * sqrt (real x) * (real x / exp 1) powr real x)
[PROOF STEP]
have "fact \<sim> (\<lambda>n. Gamma (real (Suc n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact \<sim>[sequentially] (\<lambda>n. Gamma (real (Suc n)))
[PROOF STEP]
by (simp add: Gamma_fact)
[PROOF STATE]
proof (state)
this:
fact \<sim>[sequentially] (\<lambda>n. Gamma (real (Suc n)))

goal (1 subgoal):
 1. fact \<sim>[sequentially] (\<lambda>x. exp c * sqrt (real x) * (real x / exp 1) powr real x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fact \<sim>[sequentially] (\<lambda>n. Gamma (real (Suc n)))

goal (1 subgoal):
 1. fact \<sim>[sequentially] (\<lambda>x. exp c * sqrt (real x) * (real x / exp 1) powr real x)
[PROOF STEP]
have "eventually (\<lambda>n. Gamma (real (Suc n)) = real n * Gamma (real n)) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. Gamma (real (Suc n)) = real n * Gamma (real n)
[PROOF STEP]
using eventually_gt_at_top[of "0::nat"]
[PROOF STATE]
proof (prove)
using this:
eventually ((<) 0) sequentially

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. Gamma (real (Suc n)) = real n * Gamma (real n)
[PROOF STEP]
by eventually_elim (insert Gamma_plus1[of "real n" for n],
                        auto simp: add_ac of_nat_in_nonpos_Ints_iff)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. Gamma (real (Suc n)) = real n * Gamma (real n)

goal (1 subgoal):
 1. fact \<sim>[sequentially] (\<lambda>x. exp c * sqrt (real x) * (real x / exp 1) powr real x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. Gamma (real (Suc n)) = real n * Gamma (real n)

goal (1 subgoal):
 1. fact \<sim>[sequentially] (\<lambda>x. exp c * sqrt (real x) * (real x / exp 1) powr real x)
[PROOF STEP]
have "(\<lambda>n. Gamma (real n)) \<sim> (\<lambda>n. exp c * real n powr (real n - 1/2) / exp (real n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. Gamma (real n)) \<sim>[sequentially] (\<lambda>n. exp c * real n powr (real n - 1 / 2) / exp (real n))
[PROOF STEP]
by (rule asymp_equiv_compose'[OF Gamma_asymp_equiv_aux] filterlim_real_sequentially)+
[PROOF STATE]
proof (state)
this:
(\<lambda>n. Gamma (real n)) \<sim>[sequentially] (\<lambda>n. exp c * real n powr (real n - 1 / 2) / exp (real n))

goal (1 subgoal):
 1. fact \<sim>[sequentially] (\<lambda>x. exp c * sqrt (real x) * (real x / exp 1) powr real x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. Gamma (real n)) \<sim>[sequentially] (\<lambda>n. exp c * real n powr (real n - 1 / 2) / exp (real n))

goal (1 subgoal):
 1. fact \<sim>[sequentially] (\<lambda>x. exp c * sqrt (real x) * (real x / exp 1) powr real x)
[PROOF STEP]
have "eventually (\<lambda>n. real n * (exp c * real n powr (real n - 1 / 2) / exp (real n)) =
               exp c * sqrt (real n) * (real n / exp 1) powr real n) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. real n * (exp c * real n powr (real n - 1 / 2) / exp (real n)) = exp c * sqrt (real n) * (real n / exp 1) powr real n
[PROOF STEP]
using eventually_gt_at_top[of "0::nat"]
[PROOF STATE]
proof (prove)
using this:
eventually ((<) 0) sequentially

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. real n * (exp c * real n powr (real n - 1 / 2) / exp (real n)) = exp c * sqrt (real n) * (real n / exp 1) powr real n
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> real n * (exp c * real n powr (real n - 1 / 2) / exp (real n)) = exp c * sqrt (real n) * (real n / exp 1) powr real n
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> real n * (exp c * real n powr (real n - 1 / 2) / exp (real n)) = exp c * sqrt (real n) * (real n / exp 1) powr real n
[PROOF STEP]
assume n: "n > 0"
[PROOF STATE]
proof (state)
this:
0 < n

goal (1 subgoal):
 1. \<And>n. 0 < n \<Longrightarrow> real n * (exp c * real n powr (real n - 1 / 2) / exp (real n)) = exp c * sqrt (real n) * (real n / exp 1) powr real n
[PROOF STEP]
thus "real n * (exp c * real n powr (real n - 1 / 2) / exp (real n)) =
            exp c * sqrt (real n) * (real n / exp 1) powr real n"
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. real n * (exp c * real n powr (real n - 1 / 2) / exp (real n)) = exp c * sqrt (real n) * (real n / exp 1) powr real n
[PROOF STEP]
by (subst powr_diff) (simp_all add: powr_divide powr_half_sqrt field_simps)
[PROOF STATE]
proof (state)
this:
real n * (exp c * real n powr (real n - 1 / 2) / exp (real n)) = exp c * sqrt (real n) * (real n / exp 1) powr real n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. real n * (exp c * real n powr (real n - 1 / 2) / exp (real n)) = exp c * sqrt (real n) * (real n / exp 1) powr real n

goal (1 subgoal):
 1. fact \<sim>[sequentially] (\<lambda>x. exp c * sqrt (real x) * (real x / exp 1) powr real x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>c d. c \<sim>[sequentially] d \<Longrightarrow> (\<lambda>a. real a * c a) \<sim>[sequentially] (\<lambda>a. real a * d a)) \<Longrightarrow> fact \<sim>[sequentially] (\<lambda>x. exp c * sqrt (real x) * (real x / exp 1) powr real x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<And>c d. c \<sim>[sequentially] d \<Longrightarrow> (\<lambda>a. real a * c a) \<sim>[sequentially] (\<lambda>a. real a * d a)) \<Longrightarrow> fact \<sim>[sequentially] (\<lambda>x. exp c * sqrt (real x) * (real x / exp 1) powr real x)

goal (1 subgoal):
 1. fact \<sim>[sequentially] (\<lambda>x. exp c * sqrt (real x) * (real x / exp 1) powr real x)
[PROOF STEP]
by - (simp_all add: asymp_equiv_mult)
[PROOF STATE]
proof (state)
this:
fact \<sim>[sequentially] (\<lambda>x. exp c * sqrt (real x) * (real x / exp 1) powr real x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma v_sameprod[simp]: assumes "card X \<ge> 2"
  shows "v (X^\<two>) = X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v X^\<two> = X
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. v X^\<two> = X
[PROOF STEP]
from obtain_subset_with_card_n[OF assms]
[PROOF STATE]
proof (chain)
picking this:
(\<And>T. \<lbrakk>T \<subseteq> X; card T = 2; finite T\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
obtain Y where "Y \<subseteq> X"
    and Y: "card Y = 2"
[PROOF STATE]
proof (prove)
using this:
(\<And>T. \<lbrakk>T \<subseteq> X; card T = 2; finite T\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>Y. \<lbrakk>Y \<subseteq> X; card Y = 2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Y \<subseteq> X
card Y = 2

goal (1 subgoal):
 1. v X^\<two> = X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Y \<subseteq> X
card Y = 2
[PROOF STEP]
obtain x y where "x \<in> X" "y \<in> X" and "x \<noteq> y"
[PROOF STATE]
proof (prove)
using this:
Y \<subseteq> X
card Y = 2

goal (1 subgoal):
 1. (\<And>x y. \<lbrakk>x \<in> X; y \<in> X; x \<noteq> y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: card_2_iff)
[PROOF STATE]
proof (state)
this:
x \<in> X
y \<in> X
x \<noteq> y

goal (1 subgoal):
 1. v X^\<two> = X
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<in> X
y \<in> X
x \<noteq> y

goal (1 subgoal):
 1. v X^\<two> = X
[PROOF STEP]
unfolding sameprod_altdef v_def
[PROOF STATE]
proof (prove)
using this:
x \<in> X
y \<in> X
x \<noteq> y

goal (1 subgoal):
 1. {x. \<exists>y. {x, y} \<in> {Y. Y \<subseteq> X \<and> card Y = 2}} = X
[PROOF STEP]
by (auto simp: card_2_iff doubleton_eq_iff) blast
[PROOF STATE]
proof (state)
this:
v X^\<two> = X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma intersect_nodes_finite[intro]:
    assumes "finite (NBA.nodes A)" "finite (NBA.nodes B)"
    shows "finite (NBA.nodes (intersect A B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (NBA.nodes (intersect A B))
[PROOF STEP]
using intersect'_nodes_finite assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (NBA.nodes ?A); finite (NBA.nodes ?B)\<rbrakk> \<Longrightarrow> finite (NGBA.nodes (intersect' ?A ?B))
finite (NBA.nodes A)
finite (NBA.nodes B)

goal (1 subgoal):
 1. finite (NBA.nodes (intersect A B))
[PROOF STEP]
by simp


[STATEMENT]
lemma ghom_inv_inv:"\<lbrakk>Group F; Group G; f \<in> gHom F G ; x \<in> carrier F\<rbrakk> \<Longrightarrow>
   f (\<rho>\<^bsub>F\<^esub> x) = \<rho>\<^bsub>G\<^esub> (f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G; x \<in> carrier F\<rbrakk> \<Longrightarrow> f (\<rho>\<^bsub>F\<^esub> x) = \<rho>\<^bsub>G\<^esub> f x
[PROOF STEP]
apply (frule Group.i_closed[of "F" "x"], assumption+,
       frule gHom [of "F" "G" "f" "\<rho>\<^bsub>F\<^esub> x" "x"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G; x \<in> carrier F; \<rho>\<^bsub>F\<^esub> x \<in> carrier F; f (\<rho>\<^bsub>F\<^esub> x \<cdot>\<^bsub>F\<^esub> x) = f (\<rho>\<^bsub>F\<^esub> x) \<cdot>\<^bsub>G\<^esub> f x\<rbrakk> \<Longrightarrow> f (\<rho>\<^bsub>F\<^esub> x) = \<rho>\<^bsub>G\<^esub> f x
[PROOF STEP]
apply (simp add:Group.l_i, simp add:ghom_unit_unit)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G; x \<in> carrier F; \<rho>\<^bsub>F\<^esub> x \<in> carrier F; \<one>\<^bsub>G\<^esub> = f (\<rho>\<^bsub>F\<^esub> x) \<cdot>\<^bsub>G\<^esub> f x\<rbrakk> \<Longrightarrow> f (\<rho>\<^bsub>F\<^esub> x) = \<rho>\<^bsub>G\<^esub> f x
[PROOF STEP]
apply (frule sym,
       frule gHom_mem[of "F" "G" "f" "x"], assumption+ ,
       frule gHom_mem[of "F" "G" "f" "\<rho>\<^bsub>F\<^esub> x"], assumption+,
       rule Group.l_i_unique[THEN sym, of "G" "f x" "f (\<rho>\<^bsub>F\<^esub> x)"], assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma hom_deg_set_alt_homogeneous_set:
  assumes "homogeneous_set A"
  shows "hom_deg_set z A = {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)}" (is "?A = ?B")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom_deg_set z A = {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. hom_deg_set z A \<subseteq> {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)}
 2. {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)} \<subseteq> hom_deg_set z A
[PROOF STEP]
show "?A \<subseteq> ?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom_deg_set z A \<subseteq> {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> hom_deg_set z A \<Longrightarrow> x \<in> {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)}
[PROOF STEP]
fix h
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> hom_deg_set z A \<Longrightarrow> x \<in> {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)}
[PROOF STEP]
assume "h \<in> ?A"
[PROOF STATE]
proof (state)
this:
h \<in> hom_deg_set z A

goal (1 subgoal):
 1. \<And>x. x \<in> hom_deg_set z A \<Longrightarrow> x \<in> {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
h \<in> hom_deg_set z A

goal (1 subgoal):
 1. \<And>x. x \<in> hom_deg_set z A \<Longrightarrow> x \<in> {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
homogeneous_set A
[PROOF STEP]
have "\<dots> \<subseteq> A"
[PROOF STATE]
proof (prove)
using this:
homogeneous_set A

goal (1 subgoal):
 1. hom_deg_set z A \<subseteq> A
[PROOF STEP]
by (rule hom_deg_set_subset)
[PROOF STATE]
proof (state)
this:
hom_deg_set z A \<subseteq> A

goal (1 subgoal):
 1. \<And>x. x \<in> hom_deg_set z A \<Longrightarrow> x \<in> {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
h \<in> A
[PROOF STEP]
show "h \<in> ?B"
[PROOF STATE]
proof (prove)
using this:
h \<in> A

goal (1 subgoal):
 1. h \<in> {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)}
[PROOF STEP]
using \<open>h \<in> ?A\<close>
[PROOF STATE]
proof (prove)
using this:
h \<in> A
h \<in> hom_deg_set z A

goal (1 subgoal):
 1. h \<in> {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)}
[PROOF STEP]
by (auto dest: hom_deg_setD)
[PROOF STATE]
proof (state)
this:
h \<in> {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
hom_deg_set z A \<subseteq> {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)}

goal (1 subgoal):
 1. {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)} \<subseteq> hom_deg_set z A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)} \<subseteq> hom_deg_set z A
[PROOF STEP]
show "?B \<subseteq> ?A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)} \<subseteq> hom_deg_set z A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)} \<Longrightarrow> x \<in> hom_deg_set z A
[PROOF STEP]
fix h
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)} \<Longrightarrow> x \<in> hom_deg_set z A
[PROOF STEP]
assume "h \<in> ?B"
[PROOF STATE]
proof (state)
this:
h \<in> {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)}

goal (1 subgoal):
 1. \<And>x. x \<in> {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)} \<Longrightarrow> x \<in> hom_deg_set z A
[PROOF STEP]
hence "h \<in> A" and "homogeneous h" and "h = 0 \<or> poly_deg h = z"
[PROOF STATE]
proof (prove)
using this:
h \<in> {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)}

goal (1 subgoal):
 1. h \<in> A &&& homogeneous h &&& h = 0 \<or> poly_deg h = z
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
h \<in> A
homogeneous h
h = 0 \<or> poly_deg h = z

goal (1 subgoal):
 1. \<And>x. x \<in> {p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)} \<Longrightarrow> x \<in> hom_deg_set z A
[PROOF STEP]
from this(3)
[PROOF STATE]
proof (chain)
picking this:
h = 0 \<or> poly_deg h = z
[PROOF STEP]
show "h \<in> ?A"
[PROOF STATE]
proof (prove)
using this:
h = 0 \<or> poly_deg h = z

goal (1 subgoal):
 1. h \<in> hom_deg_set z A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. h = 0 \<Longrightarrow> h \<in> hom_deg_set z A
 2. poly_deg h = z \<Longrightarrow> h \<in> hom_deg_set z A
[PROOF STEP]
assume "h = 0"
[PROOF STATE]
proof (state)
this:
h = 0

goal (2 subgoals):
 1. h = 0 \<Longrightarrow> h \<in> hom_deg_set z A
 2. poly_deg h = z \<Longrightarrow> h \<in> hom_deg_set z A
[PROOF STEP]
with \<open>h \<in> A\<close>
[PROOF STATE]
proof (chain)
picking this:
h \<in> A
h = 0
[PROOF STEP]
have "0 \<in> A"
[PROOF STATE]
proof (prove)
using this:
h \<in> A
h = 0

goal (1 subgoal):
 1. 0 \<in> A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<in> A

goal (2 subgoals):
 1. h = 0 \<Longrightarrow> h \<in> hom_deg_set z A
 2. poly_deg h = z \<Longrightarrow> h \<in> hom_deg_set z A
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<in> A

goal (1 subgoal):
 1. h \<in> hom_deg_set z A
[PROOF STEP]
unfolding \<open>h = 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 \<in> A

goal (1 subgoal):
 1. 0 \<in> hom_deg_set z A
[PROOF STEP]
by (rule zero_in_hom_deg_set)
[PROOF STATE]
proof (state)
this:
h \<in> hom_deg_set z A

goal (1 subgoal):
 1. poly_deg h = z \<Longrightarrow> h \<in> hom_deg_set z A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_deg h = z \<Longrightarrow> h \<in> hom_deg_set z A
[PROOF STEP]
assume "poly_deg h = z"
[PROOF STATE]
proof (state)
this:
poly_deg h = z

goal (1 subgoal):
 1. poly_deg h = z \<Longrightarrow> h \<in> hom_deg_set z A
[PROOF STEP]
with \<open>homogeneous h\<close>
[PROOF STATE]
proof (chain)
picking this:
homogeneous h
poly_deg h = z
[PROOF STEP]
have "h = hom_component h z"
[PROOF STATE]
proof (prove)
using this:
homogeneous h
poly_deg h = z

goal (1 subgoal):
 1. h = hom_component h z
[PROOF STEP]
by (simp add: hom_component_of_homogeneous)
[PROOF STATE]
proof (state)
this:
h = hom_component h z

goal (1 subgoal):
 1. poly_deg h = z \<Longrightarrow> h \<in> hom_deg_set z A
[PROOF STEP]
with \<open>h \<in> A\<close>
[PROOF STATE]
proof (chain)
picking this:
h \<in> A
h = hom_component h z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
h \<in> A
h = hom_component h z

goal (1 subgoal):
 1. h \<in> hom_deg_set z A
[PROOF STEP]
unfolding hom_deg_set_def
[PROOF STATE]
proof (prove)
using this:
h \<in> A
h = hom_component h z

goal (1 subgoal):
 1. h \<in> (\<lambda>a. hom_component a z) ` A
[PROOF STEP]
by (rule rev_image_eqI)
[PROOF STATE]
proof (state)
this:
h \<in> hom_deg_set z A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
h \<in> hom_deg_set z A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{p \<in> A. homogeneous p \<and> (p = 0 \<or> poly_deg p = z)} \<subseteq> hom_deg_set z A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma int_option_enumeration_inj:
"inj int_option_enumeration"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj int_option_enumeration
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; int_option_enumeration x = int_option_enumeration y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have pos_even: "\<And>n::int. n \<ge> 0 \<Longrightarrow> even (int_option_enumeration (Some n)) \<and> (int_option_enumeration (Some n))> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. 0 \<le> n \<Longrightarrow> even (int_option_enumeration (Some n)) \<and> 0 < int_option_enumeration (Some n)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 0 \<le> n \<Longrightarrow> even (int_option_enumeration (Some n)) \<and> 0 < int_option_enumeration (Some n)
[PROOF STEP]
fix n::int
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 0 \<le> n \<Longrightarrow> even (int_option_enumeration (Some n)) \<and> 0 < int_option_enumeration (Some n)
[PROOF STEP]
assume "n \<ge>0"
[PROOF STATE]
proof (state)
this:
0 \<le> n

goal (1 subgoal):
 1. \<And>n. 0 \<le> n \<Longrightarrow> even (int_option_enumeration (Some n)) \<and> 0 < int_option_enumeration (Some n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> n
[PROOF STEP]
have "(int_option_enumeration (Some n)) = nat (2*(n + 1))"
[PROOF STATE]
proof (prove)
using this:
0 \<le> n

goal (1 subgoal):
 1. int_option_enumeration (Some n) = nat (2 * (n + 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int_option_enumeration (Some n) = nat (2 * (n + 1))

goal (1 subgoal):
 1. \<And>n. 0 \<le> n \<Longrightarrow> even (int_option_enumeration (Some n)) \<and> 0 < int_option_enumeration (Some n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
int_option_enumeration (Some n) = nat (2 * (n + 1))
[PROOF STEP]
show "even (int_option_enumeration (Some n)) \<and> 0 < int_option_enumeration (Some n)"
[PROOF STATE]
proof (prove)
using this:
int_option_enumeration (Some n) = nat (2 * (n + 1))

goal (1 subgoal):
 1. even (int_option_enumeration (Some n)) \<and> 0 < int_option_enumeration (Some n)
[PROOF STEP]
by (smt \<open>0 \<le> n\<close> even_of_nat int_nat_eq oddE zero_less_nat_eq)
[PROOF STATE]
proof (state)
this:
even (int_option_enumeration (Some n)) \<and> 0 < int_option_enumeration (Some n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 \<le> ?n \<Longrightarrow> even (int_option_enumeration (Some ?n)) \<and> 0 < int_option_enumeration (Some ?n)

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; int_option_enumeration x = int_option_enumeration y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have neg_odd: "\<And>n::int. n < 0 \<Longrightarrow> odd (int_option_enumeration (Some n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. n < 0 \<Longrightarrow> odd (int_option_enumeration (Some n))
[PROOF STEP]
by (smt evenE even_of_nat int_nat_eq int_option_enumeration.simps(1))
[PROOF STATE]
proof (state)
this:
?n < 0 \<Longrightarrow> odd (int_option_enumeration (Some ?n))

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; int_option_enumeration x = int_option_enumeration y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; int_option_enumeration x = int_option_enumeration y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume A: "x \<in> UNIV" "y \<in> UNIV" "int_option_enumeration x = int_option_enumeration y"
[PROOF STATE]
proof (state)
this:
x \<in> UNIV
y \<in> UNIV
int_option_enumeration x = int_option_enumeration y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; int_option_enumeration x = int_option_enumeration y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
show "x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
apply(cases "x = None")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x = None \<Longrightarrow> x = y
 2. x \<noteq> None \<Longrightarrow> x = y
[PROOF STEP]
using A pos_even neg_odd
[PROOF STATE]
proof (prove)
using this:
x \<in> UNIV
y \<in> UNIV
int_option_enumeration x = int_option_enumeration y
0 \<le> ?n \<Longrightarrow> even (int_option_enumeration (Some ?n)) \<and> 0 < int_option_enumeration (Some ?n)
?n < 0 \<Longrightarrow> odd (int_option_enumeration (Some ?n))

goal (2 subgoals):
 1. x = None \<Longrightarrow> x = y
 2. x \<noteq> None \<Longrightarrow> x = y
[PROOF STEP]
apply (metis dvd_0_right int_option_enumeration.elims int_option_enumeration.simps(2) not_gr0 not_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> None \<Longrightarrow> x = y
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<noteq> None \<Longrightarrow> x = y
[PROOF STEP]
assume "x \<noteq>None"
[PROOF STATE]
proof (state)
this:
x \<noteq> None

goal (1 subgoal):
 1. x \<noteq> None \<Longrightarrow> x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> None
[PROOF STEP]
obtain n where n_def: "x = Some n"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> None

goal (1 subgoal):
 1. (\<And>n. x = Some n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = Some n

goal (1 subgoal):
 1. x \<noteq> None \<Longrightarrow> x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = Some n
[PROOF STEP]
have y_not_None: "y \<noteq> None"
[PROOF STATE]
proof (prove)
using this:
x = Some n

goal (1 subgoal):
 1. y \<noteq> None
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
x = Some n
x \<in> UNIV
y \<in> UNIV
int_option_enumeration x = int_option_enumeration y

goal (1 subgoal):
 1. y \<noteq> None
[PROOF STEP]
by (metis \<open>\<And>thesis. (\<And>n. x = Some n \<Longrightarrow> thesis) \<Longrightarrow> thesis\<close>
              add_cancel_right_right even_add int_option_enumeration.simps(2)
              linorder_not_less neg_odd neq0_conv pos_even)
[PROOF STATE]
proof (state)
this:
y \<noteq> None

goal (1 subgoal):
 1. x \<noteq> None \<Longrightarrow> x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<noteq> None
[PROOF STEP]
obtain m where m_def: "y = Some m"
[PROOF STATE]
proof (prove)
using this:
y \<noteq> None

goal (1 subgoal):
 1. (\<And>m. y = Some m \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
y = Some m

goal (1 subgoal):
 1. x \<noteq> None \<Longrightarrow> x = y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
proof(cases "n \<ge>0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> n \<Longrightarrow> x = y
 2. \<not> 0 \<le> n \<Longrightarrow> x = y
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
0 \<le> n

goal (2 subgoals):
 1. 0 \<le> n \<Longrightarrow> x = y
 2. \<not> 0 \<le> n \<Longrightarrow> x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> n

goal (1 subgoal):
 1. x = y
[PROOF STEP]
using n_def A neg_odd pos_even m_def int_option_enumeration.simps(1)
[PROOF STATE]
proof (prove)
using this:
0 \<le> n
x = Some n
x \<in> UNIV
y \<in> UNIV
int_option_enumeration x = int_option_enumeration y
?n < 0 \<Longrightarrow> odd (int_option_enumeration (Some ?n))
0 \<le> ?n \<Longrightarrow> even (int_option_enumeration (Some ?n)) \<and> 0 < int_option_enumeration (Some ?n)
y = Some m
int_option_enumeration (Some ?n) = (if 0 \<le> ?n then nat (2 * (?n + 1)) else nat (2 * - ?n + 1))

goal (1 subgoal):
 1. x = y
[PROOF STEP]
by (smt int_nat_eq)
[PROOF STATE]
proof (state)
this:
x = y

goal (1 subgoal):
 1. \<not> 0 \<le> n \<Longrightarrow> x = y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> 0 \<le> n \<Longrightarrow> x = y
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> 0 \<le> n

goal (1 subgoal):
 1. \<not> 0 \<le> n \<Longrightarrow> x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> 0 \<le> n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> 0 \<le> n

goal (1 subgoal):
 1. x = y
[PROOF STEP]
using n_def A neg_odd pos_even m_def int_option_enumeration.simps(1)
[PROOF STATE]
proof (prove)
using this:
\<not> 0 \<le> n
x = Some n
x \<in> UNIV
y \<in> UNIV
int_option_enumeration x = int_option_enumeration y
?n < 0 \<Longrightarrow> odd (int_option_enumeration (Some ?n))
0 \<le> ?n \<Longrightarrow> even (int_option_enumeration (Some ?n)) \<and> 0 < int_option_enumeration (Some ?n)
y = Some m
int_option_enumeration (Some ?n) = (if 0 \<le> ?n then nat (2 * (?n + 1)) else nat (2 * - ?n + 1))

goal (1 subgoal):
 1. x = y
[PROOF STEP]
by (smt int_nat_eq)
[PROOF STATE]
proof (state)
this:
x = y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x = y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x = y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma swap_multiset[simp]: "\<lbrakk> i < length l; j<length l \<rbrakk> \<Longrightarrow> mset (swap l i j) = mset l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < length l; j < length l\<rbrakk> \<Longrightarrow> mset (swap l i j) = mset l
[PROOF STEP]
unfolding swap_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < length l; j < length l\<rbrakk> \<Longrightarrow> mset (l[i := l ! j, j := l ! i]) = mset l
[PROOF STEP]
by (auto simp: mset_swap)


[STATEMENT]
lemma wi2l: "(\<Union>(i,j)\<in>set (wi2l r). {i .. j}) = wordinterval_to_set r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>(i, j)\<in>set (wi2l r). {i..j}) = wordinterval_to_set r
[PROOF STEP]
by(induction r rule: wi2l.induct, simp_all)


[STATEMENT]
lemma last_t_fusion [simp]: "last x = first y \<Longrightarrow> last (t_fusion x y) = last y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Dioid_Models_New.last x = first y \<Longrightarrow> Dioid_Models_New.last (t_fusion x y) = Dioid_Models_New.last y
[PROOF STEP]
by (simp add: first_def t_fusion_def)


[STATEMENT]
lemma length_rremdups: "length (rremdups xs) = card (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (rremdups xs) = card (set xs)
[PROOF STEP]
using distinct_card[OF distinct_rremdups]
[PROOF STATE]
proof (prove)
using this:
card (set (rremdups ?xs1)) = length (rremdups ?xs1)

goal (1 subgoal):
 1. length (rremdups xs) = card (set xs)
[PROOF STEP]
by (subst eq_commute) (auto simp: rremdups_set)


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

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


[STATEMENT]
lemma smult_sum: fixes a :: "'a::ring_1" shows "(\<Sum>i\<in>I. a *\<^sub>S f i) = a *\<^sub>S (sum f I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>I. a *\<^sub>S f i) = a *\<^sub>S sum f I
[PROOF STEP]
by (induction I rule: infinite_finite_induct)
     (simp_all add: smult_right_add vec_eq_iff)


[STATEMENT]
lemma apply_cltn2_line_compose:
  "apply_cltn2_line (apply_cltn2_line l A) B
  = apply_cltn2_line l (cltn2_compose A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. apply_cltn2_line (apply_cltn2_line l A) B = apply_cltn2_line l (cltn2_compose A B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. apply_cltn2_line (apply_cltn2_line l A) B = apply_cltn2_line l (cltn2_compose A B)
[PROOF STEP]
have "cltn2_compose
    (cltn2_transpose (cltn2_inverse A)) (cltn2_transpose (cltn2_inverse B))
    = cltn2_transpose (cltn2_inverse (cltn2_compose A B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cltn2_compose (cltn2_transpose (cltn2_inverse A)) (cltn2_transpose (cltn2_inverse B)) = cltn2_transpose (cltn2_inverse (cltn2_compose A B))
[PROOF STEP]
by (simp add: cltn2_transpose_compose cltn2_inverse_compose)
[PROOF STATE]
proof (state)
this:
cltn2_compose (cltn2_transpose (cltn2_inverse A)) (cltn2_transpose (cltn2_inverse B)) = cltn2_transpose (cltn2_inverse (cltn2_compose A B))

goal (1 subgoal):
 1. apply_cltn2_line (apply_cltn2_line l A) B = apply_cltn2_line l (cltn2_compose A B)
[PROOF STEP]
thus "apply_cltn2_line (apply_cltn2_line l A) B
    = apply_cltn2_line l (cltn2_compose A B)"
[PROOF STATE]
proof (prove)
using this:
cltn2_compose (cltn2_transpose (cltn2_inverse A)) (cltn2_transpose (cltn2_inverse B)) = cltn2_transpose (cltn2_inverse (cltn2_compose A B))

goal (1 subgoal):
 1. apply_cltn2_line (apply_cltn2_line l A) B = apply_cltn2_line l (cltn2_compose A B)
[PROOF STEP]
unfolding apply_cltn2_line_def
[PROOF STATE]
proof (prove)
using this:
cltn2_compose (cltn2_transpose (cltn2_inverse A)) (cltn2_transpose (cltn2_inverse B)) = cltn2_transpose (cltn2_inverse (cltn2_compose A B))

goal (1 subgoal):
 1. P2L (apply_cltn2 (L2P (P2L (apply_cltn2 (L2P l) (cltn2_transpose (cltn2_inverse A))))) (cltn2_transpose (cltn2_inverse B))) = P2L (apply_cltn2 (L2P l) (cltn2_transpose (cltn2_inverse (cltn2_compose A B))))
[PROOF STEP]
by (simp add: apply_cltn2_compose)
[PROOF STATE]
proof (state)
this:
apply_cltn2_line (apply_cltn2_line l A) B = apply_cltn2_line l (cltn2_compose A B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma not_col_permutation_2:
  assumes "~ Col A B C"
  shows  "~ Col C A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> Col C A B
[PROOF STEP]
using assms col_permutation_1
[PROOF STATE]
proof (prove)
using this:
\<not> Col A B C
Col ?A ?B ?C \<Longrightarrow> Col ?B ?C ?A

goal (1 subgoal):
 1. \<not> Col C A B
[PROOF STEP]
by blast


[STATEMENT]
lemma stern_brocot_iterate: "stern_brocot = stern_brocot_iterate"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stern_brocot = stern_brocot_iterate
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. stern_brocot = stern_brocot_iterate
[PROOF STEP]
have "stern_brocot = stern_brocot_Hinze_iterate"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stern_brocot = stern_brocot_Hinze_iterate
[PROOF STEP]
unfolding stern_brocot_def stern_brocot_Hinze_iterate_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unfold_tree (\<lambda>(lb, ub). mediant (lb, ub)) (\<lambda>(lb, ub). (lb, mediant (lb, ub))) (\<lambda>(lb, ub). (mediant (lb, ub), ub)) ((0, 1), 1, 0) = map_tree mediant (tree_iterate (\<lambda>s. s \<otimes> UR) (\<lambda>s. s \<otimes> LL) F)
[PROOF STEP]
by(subst unfold_tree_tree_iterate)(simp add: F_def times_matrix_def mediant_def UR_def LL_def split_def)
[PROOF STATE]
proof (state)
this:
stern_brocot = stern_brocot_Hinze_iterate

goal (1 subgoal):
 1. stern_brocot = stern_brocot_iterate
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
stern_brocot = stern_brocot_Hinze_iterate

goal (1 subgoal):
 1. stern_brocot = stern_brocot_iterate
[PROOF STEP]
have "\<dots> = map_tree mediant (map_tree (\<lambda>s. s \<otimes> F) (tree_iterate (\<lambda>s. s \<otimes> LL) (\<lambda>s. s \<otimes> UR) I))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stern_brocot_Hinze_iterate = map_tree mediant (map_tree (\<lambda>s. s \<otimes> F) (tree_iterate (\<lambda>s. s \<otimes> LL) (\<lambda>s. s \<otimes> UR) I))
[PROOF STEP]
unfolding stern_brocot_Hinze_iterate_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_tree mediant (tree_iterate (\<lambda>s. s \<otimes> UR) (\<lambda>s. s \<otimes> LL) F) = map_tree mediant (map_tree (\<lambda>s. s \<otimes> F) (tree_iterate (\<lambda>s. s \<otimes> LL) (\<lambda>s. s \<otimes> UR) I))
[PROOF STEP]
by(subst tree_iterate_fusion[where l'="\<lambda>s. s \<otimes> UR" and r'="\<lambda>s. s \<otimes> LL"])
      (simp_all add: fun_eq_iff times_matrix_def UR_def LL_def F_def I_def)
[PROOF STATE]
proof (state)
this:
stern_brocot_Hinze_iterate = map_tree mediant (map_tree (\<lambda>s. s \<otimes> F) (tree_iterate (\<lambda>s. s \<otimes> LL) (\<lambda>s. s \<otimes> UR) I))

goal (1 subgoal):
 1. stern_brocot = stern_brocot_iterate
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
stern_brocot_Hinze_iterate = map_tree mediant (map_tree (\<lambda>s. s \<otimes> F) (tree_iterate (\<lambda>s. s \<otimes> LL) (\<lambda>s. s \<otimes> UR) I))

goal (1 subgoal):
 1. stern_brocot = stern_brocot_iterate
[PROOF STEP]
have "\<dots> = stern_brocot_iterate"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_tree mediant (map_tree (\<lambda>s. s \<otimes> F) (tree_iterate (\<lambda>s. s \<otimes> LL) (\<lambda>s. s \<otimes> UR) I)) = stern_brocot_iterate
[PROOF STEP]
by(simp only: tree.map_comp mediant_times_F stern_brocot_iterate_def stern_brocot_iterate_aux_def)
[PROOF STATE]
proof (state)
this:
map_tree mediant (map_tree (\<lambda>s. s \<otimes> F) (tree_iterate (\<lambda>s. s \<otimes> LL) (\<lambda>s. s \<otimes> UR) I)) = stern_brocot_iterate

goal (1 subgoal):
 1. stern_brocot = stern_brocot_iterate
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
stern_brocot = stern_brocot_iterate
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
stern_brocot = stern_brocot_iterate

goal (1 subgoal):
 1. stern_brocot = stern_brocot_iterate
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
stern_brocot = stern_brocot_iterate

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma R_one_zero: "R 1 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R (1::'a) (0::'a) = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. R (1::'a) (0::'a) = (0::'a)
[PROOF STEP]
have "H 1 (R 1 0) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H (1::'a) (R (1::'a) (0::'a)) (0::'a)
[PROOF STEP]
by (simp add: R1)
[PROOF STATE]
proof (state)
this:
H (1::'a) (R (1::'a) (0::'a)) (0::'a)

goal (1 subgoal):
 1. R (1::'a) (0::'a) = (0::'a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
H (1::'a) (R (1::'a) (0::'a)) (0::'a)

goal (1 subgoal):
 1. R (1::'a) (0::'a) = (0::'a)
[PROOF STEP]
by (simp add: H_def join.le_bot)
[PROOF STATE]
proof (state)
this:
R (1::'a) (0::'a) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inverse_power_summable:
  assumes s: "s \<ge> 2"
  shows "summable (\<lambda>n. inverse (of_nat n ^ s :: 'a :: {real_normed_div_algebra,banach}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. inverse (of_nat n ^ s))
[PROOF STEP]
proof (rule summable_norm_cancel, subst summable_cong)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>\<^sub>F x in sequentially. norm (inverse (of_nat x ^ s)) = ?g2 x
 2. summable ?g2
[PROOF STEP]
from eventually_gt_at_top[of "0::nat"]
[PROOF STATE]
proof (chain)
picking this:
eventually ((<) 0) sequentially
[PROOF STEP]
show "eventually (\<lambda>n. norm (inverse (of_nat n ^ s:: 'a)) = real_of_nat n powr (-real s)) at_top"
[PROOF STATE]
proof (prove)
using this:
eventually ((<) 0) sequentially

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. norm (inverse (of_nat n ^ s)) = real n powr - real s
[PROOF STEP]
by eventually_elim (simp add: norm_inverse norm_power powr_minus powr_realpow)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. norm (inverse (of_nat n ^ s)) = real n powr - real s

goal (1 subgoal):
 1. summable (\<lambda>n. real n powr - real s)
[PROOF STEP]
qed (insert s summable_real_powr_iff[of "-s"], simp_all)


[STATEMENT]
lemma ennreal_add_eq_top[simp]:
  fixes a b :: ennreal
  shows "a + b = top \<longleftrightarrow> a = top \<or> b = top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a + b = top) = (a = top \<or> b = top)
[PROOF STEP]
by transfer (auto simp: top_ereal_def)


[STATEMENT]
lemma tensor_vec_eval:
  assumes "i < d"
  shows "tensor_vec v1 v2 $ i = v1 $ encode1 i * v2 $ encode2 i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tensor_vec v1 v2 $ i = v1 $ encode1 i * v2 $ encode2 i
[PROOF STEP]
unfolding tensor_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.vec d (\<lambda>i. v1 $ encode1 i * v2 $ encode2 i) $ i = v1 $ encode1 i * v2 $ encode2 i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < d

goal (1 subgoal):
 1. Matrix.vec d (\<lambda>i. v1 $ encode1 i * v2 $ encode2 i) $ i = v1 $ encode1 i * v2 $ encode2 i
[PROOF STEP]
by simp


[STATEMENT]
lemma filterlim_at_right_to_0:
  "filterlim f F (at_right a) \<longleftrightarrow> filterlim (\<lambda>x. f (x + a)) F (at_right 0)"
  for a :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim f F (at_right a) = (LIM x at_right 0. f (x + a) :> F)
[PROOF STEP]
unfolding filterlim_def filtermap_filtermap at_right_to_0[of a]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (filtermap (\<lambda>x. f (x + a)) (at_right 0) \<le> F) = (filtermap (\<lambda>x. f (x + a)) (at_right 0) \<le> F)
[PROOF STEP]
..


[STATEMENT]
lemma bij_betw_mod_nat_atLeastLessThan:
  fixes k d :: nat
  assumes "k > 0"
  defines "g \<equiv> (\<lambda>i. nat ((int i - int d) mod int k) + d)"
  shows   "bij_betw (\<lambda>i. i mod k) {d..<d+k} {..<k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (\<lambda>i. i mod k) {d..<d + k} {..<k}
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>i. i mod k) {d..<d + k} \<and> (\<lambda>i. i mod k) ` {d..<d + k} = {..<k}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj_on (\<lambda>i. i mod k) {d..<d + k}
 2. (\<lambda>i. i mod k) ` {d..<d + k} = {..<k}
[PROOF STEP]
show inj: "inj_on (\<lambda>i. i mod k) {d..<d + k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>i. i mod k) {d..<d + k}
[PROOF STEP]
by (rule inj_on_mod_nat) fact+
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>i. i mod k) {d..<d + k}

goal (1 subgoal):
 1. (\<lambda>i. i mod k) ` {d..<d + k} = {..<k}
[PROOF STEP]
have "(\<lambda>i. i mod k) ` {d..<d + k} \<subseteq> {..<k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. i mod k) ` {d..<d + k} \<subseteq> {..<k}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>i. i mod k) ` {d..<d + k} \<subseteq> {..<k}

goal (1 subgoal):
 1. (\<lambda>i. i mod k) ` {d..<d + k} = {..<k}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>i. i mod k) ` {d..<d + k} \<subseteq> {..<k}

goal (1 subgoal):
 1. (\<lambda>i. i mod k) ` {d..<d + k} = {..<k}
[PROOF STEP]
have "card ((\<lambda>i. i mod k) ` {d..<d + k}) = card {..<k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((\<lambda>i. i mod k) ` {d..<d + k}) = card {..<k}
[PROOF STEP]
using inj
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>i. i mod k) {d..<d + k}

goal (1 subgoal):
 1. card ((\<lambda>i. i mod k) ` {d..<d + k}) = card {..<k}
[PROOF STEP]
by (subst card_image) auto
[PROOF STATE]
proof (state)
this:
card ((\<lambda>i. i mod k) ` {d..<d + k}) = card {..<k}

goal (1 subgoal):
 1. (\<lambda>i. i mod k) ` {d..<d + k} = {..<k}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>i. i mod k) ` {d..<d + k} \<subseteq> {..<k}
card ((\<lambda>i. i mod k) ` {d..<d + k}) = card {..<k}
[PROOF STEP]
show "(\<lambda>i. i mod k) ` {d..<d + k} = {..<k}"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. i mod k) ` {d..<d + k} \<subseteq> {..<k}
card ((\<lambda>i. i mod k) ` {d..<d + k}) = card {..<k}

goal (1 subgoal):
 1. (\<lambda>i. i mod k) ` {d..<d + k} = {..<k}
[PROOF STEP]
by (intro card_subset_eq) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>i. i mod k) ` {d..<d + k} = {..<k}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma preal_add_commute: "(x::preal) + y = y + x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + y = y + x
[PROOF STEP]
unfolding preal_add_def add_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs_preal {w. \<exists>x\<in>Rep_preal x. \<exists>y\<in>Rep_preal y. w = x + y} = Abs_preal {w. \<exists>xa\<in>Rep_preal y. \<exists>y\<in>Rep_preal x. w = xa + y}
[PROOF STEP]
by (metis (no_types, opaque_lifting) add.commute)


[STATEMENT]
lemma list_all2_conv_all_nth:
  "list_all2 P xs ys =
  (length xs = length ys \<and> (\<forall>i < length xs. P (xs!i) (ys!i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 P xs ys = (length xs = length ys \<and> (\<forall>i<length xs. P (xs ! i) (ys ! i)))
[PROOF STEP]
by (force simp add: list_all2_iff set_zip)


[STATEMENT]
lemma single_point_line:
  assumes "N > 0"
  shows "is_line (\<lambda>s\<in>{..<1}. \<lambda>a\<in>{..<N}. 0) N 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_line (\<lambda>s\<in>{..<1}. \<lambda>a\<in>{..<N}. 0) N 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < N

goal (1 subgoal):
 1. is_line (\<lambda>s\<in>{..<1}. \<lambda>a\<in>{..<N}. 0) N 1
[PROOF STEP]
unfolding is_line_def cube_def
[PROOF STATE]
proof (prove)
using this:
0 < N

goal (1 subgoal):
 1. (\<lambda>s\<in>{..<1}. \<lambda>a\<in>{..<N}. 0) \<in> {..<1} \<rightarrow>\<^sub>E {..<N} \<rightarrow>\<^sub>E {..<1} \<and> (\<forall>j<N. (\<forall>x<1. \<forall>y<1. (\<lambda>s\<in>{..<1}. \<lambda>a\<in>{..<N}. 0) x j = (\<lambda>s\<in>{..<1}. \<lambda>a\<in>{..<N}. 0) y j) \<or> (\<forall>s<1. (\<lambda>s\<in>{..<1}. \<lambda>a\<in>{..<N}. 0) s j = s)) \<and> (\<exists>j<N. \<forall>s<1. (\<lambda>s\<in>{..<1}. \<lambda>a\<in>{..<N}. 0) s j = s)
[PROOF STEP]
by auto


[STATEMENT]
lemma Maclaurin_sin_expansion:
  "\<exists>t. sin x = (\<Sum>m<n. sin_coeff m * x ^ m) + (sin (t + 1/2 * real n * pi) / fact n) * x ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>t. sin x = (\<Sum>m<n. sin_coeff m * x ^ m) + sin (t + 1 / 2 * real n * pi) / fact n * x ^ n
[PROOF STEP]
using Maclaurin_sin_expansion2 [of x n]
[PROOF STATE]
proof (prove)
using this:
\<exists>t. \<bar>t\<bar> \<le> \<bar>x\<bar> \<and> sin x = (\<Sum>m<n. sin_coeff m * x ^ m) + sin (t + 1 / 2 * real n * pi) / fact n * x ^ n

goal (1 subgoal):
 1. \<exists>t. sin x = (\<Sum>m<n. sin_coeff m * x ^ m) + sin (t + 1 / 2 * real n * pi) / fact n * x ^ n
[PROOF STEP]
by blast


[STATEMENT]
lemma indicator_eq_0_iff: "indicator A x = (0::'a::zero_neq_one) \<longleftrightarrow> x \<notin> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (indicator A x = (0::'a)) = (x \<notin> A)
[PROOF STEP]
by (auto simp: indicator_def)


[STATEMENT]
lemma Inf_pres_upper_adj_eq:
  fixes g :: "'b::complete_lattice \<Rightarrow> 'a::complete_lattice"
  shows "(Inf_pres g) = (\<exists>f. f \<stileturn> g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf_pres g = (\<exists>f. f \<stileturn> g)
[PROOF STEP]
using radj_Inf_pres Inf_pres_radj
[PROOF STATE]
proof (prove)
using this:
\<exists>f. f \<stileturn> ?g \<Longrightarrow> Inf_pres ?g
Inf_pres ?g \<Longrightarrow> \<exists>f. f \<stileturn> ?g

goal (1 subgoal):
 1. Inf_pres g = (\<exists>f. f \<stileturn> g)
[PROOF STEP]
by blast


[STATEMENT]
lemma zmultiset_eq_iff: "M = N \<longleftrightarrow> (\<forall>a. zcount M a = zcount N a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M = N) = (\<forall>a. zcount M a = zcount N a)
[PROOF STEP]
by (simp only: zcount_inject[symmetric] fun_eq_iff)


[STATEMENT]
lemma retraction_map_compose:
   "\<lbrakk>retraction_map X Y f; retraction_map Y Z g\<rbrakk> \<Longrightarrow> retraction_map X Z (g \<circ> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>retraction_map X Y f; retraction_map Y Z g\<rbrakk> \<Longrightarrow> retraction_map X Z (g \<circ> f)
[PROOF STEP]
by (meson retraction_map_def retraction_maps_compose)


[STATEMENT]
lemma mod_minus_cong:
  fixes b b' :: int
  assumes "b = b'"
    and "x mod b' = x' mod b'"
    and "y mod b' = y' mod b'"
    and "x' - y' = z'"
  shows "(x - y) mod b = z' mod b'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x - y) mod b = z' mod b'
[PROOF STEP]
using assms [symmetric]
[PROOF STATE]
proof (prove)
using this:
b' = b
x' mod b' = x mod b'
y' mod b' = y mod b'
z' = x' - y'

goal (1 subgoal):
 1. (x - y) mod b = z' mod b'
[PROOF STEP]
by (auto intro: mod_diff_cong)


[STATEMENT]
lemma in_abs_intervalI2:
  "min (\<bar>lx\<bar>) \<bar>ux\<bar> \<le> xa \<Longrightarrow> xa \<le> max \<bar>lx\<bar> \<bar>ux\<bar> \<Longrightarrow> lx \<le> ux \<Longrightarrow> 0 \<le> lx \<or> ux \<le> 0 \<Longrightarrow>
    xa \<in> abs ` {lx..ux}"
  for xa::"'a::linordered_idom"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>min \<bar>lx\<bar> \<bar>ux\<bar> \<le> xa; xa \<le> max \<bar>lx\<bar> \<bar>ux\<bar>; lx \<le> ux; (0::'a) \<le> lx \<or> ux \<le> (0::'a)\<rbrakk> \<Longrightarrow> xa \<in> abs ` {lx..ux}
[PROOF STEP]
by (force intro: image_eqI[where x="-xa"] image_eqI[where x="xa"])


[STATEMENT]
lemma rfloor_bound:
    "eventually (\<lambda>x. l x \<le> f x) at_top \<Longrightarrow> eventually (\<lambda>x. l x - 1 \<le> rfloor (f x)) at_top"
    "eventually (\<lambda>x. f x \<le> u x) at_top \<Longrightarrow> eventually (\<lambda>x. rfloor (f x) \<le> u x) at_top"
  and rceil_bound:
    "eventually (\<lambda>x. l x \<le> f x) at_top \<Longrightarrow> eventually (\<lambda>x. l x \<le> rceil (f x)) at_top"
    "eventually (\<lambda>x. f x \<le> u x) at_top \<Longrightarrow> eventually (\<lambda>x. rceil (f x) \<le> u x + 1) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>\<^sub>F x in at_top. l x \<le> f x \<Longrightarrow> \<forall>\<^sub>F x in at_top. l x - 1 \<le> rfloor (f x)) &&& (\<forall>\<^sub>F x in at_top. f x \<le> u x \<Longrightarrow> \<forall>\<^sub>F x in at_top. rfloor (f x) \<le> u x)) &&& (\<forall>\<^sub>F x in at_top. l x \<le> f x \<Longrightarrow> \<forall>\<^sub>F x in at_top. l x \<le> rceil (f x)) &&& (\<forall>\<^sub>F x in at_top. f x \<le> u x \<Longrightarrow> \<forall>\<^sub>F x in at_top. rceil (f x) \<le> u x + 1)
[PROOF STEP]
unfolding rfloor_def rceil_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>\<^sub>F x in at_top. l x \<le> f x \<Longrightarrow> \<forall>\<^sub>F x in at_top. l x - 1 \<le> real_of_int \<lfloor>f x\<rfloor>) &&& (\<forall>\<^sub>F x in at_top. f x \<le> u x \<Longrightarrow> \<forall>\<^sub>F x in at_top. real_of_int \<lfloor>f x\<rfloor> \<le> u x)) &&& (\<forall>\<^sub>F x in at_top. l x \<le> f x \<Longrightarrow> \<forall>\<^sub>F x in at_top. l x \<le> real_of_int \<lceil>f x\<rceil>) &&& (\<forall>\<^sub>F x in at_top. f x \<le> u x \<Longrightarrow> \<forall>\<^sub>F x in at_top. real_of_int \<lceil>f x\<rceil> \<le> u x + 1)
[PROOF STEP]
by (erule eventually_mono, linarith)+


[STATEMENT]
lemma map_col_to_block_elem_not: "c \<in> set (cols M) \<Longrightarrow> i < dim_vec c \<Longrightarrow> i \<notin> map_col_to_block c \<longleftrightarrow> c $ i = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>c \<in> set (cols M); i < dim_vec c\<rbrakk> \<Longrightarrow> (i \<notin> map_col_to_block c) = (c $ i = (0::'b))
[PROOF STEP]
apply (auto simp add: map_col_to_block_alt)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>c \<in> set (cols M); i < dim_vec c; c $ i \<noteq> (1::'b)\<rbrakk> \<Longrightarrow> c $ i = (0::'b)
[PROOF STEP]
using elems01
[PROOF STATE]
proof (prove)
using this:
elements_mat M \<subseteq> {0::'b, 1::'b}

goal (1 subgoal):
 1. \<lbrakk>c \<in> set (cols M); i < dim_vec c; c $ i \<noteq> (1::'b)\<rbrakk> \<Longrightarrow> c $ i = (0::'b)
[PROOF STEP]
by (metis col_nth_0_or_1_iff dim_col obtain_col_index)


[STATEMENT]
lemma card_state_set:
  fixes as s
  shows "(Suc (length as)) = card (state_set (state_list s as))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (length as) = card (state_set (state_list s as))
[PROOF STEP]
by (simp add: state_list_length_lemma_2 state_set_card)


[STATEMENT]
lemma row_mat_of_cols:
  assumes "i < nr"
  shows "row (mat_of_cols nr ls) i = vec (length ls) (\<lambda>j. (ls ! j) $i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (mat_of_cols nr ls) i = vec (length ls) (\<lambda>j. ls ! j $ i)
[PROOF STEP]
by (smt assms dim_vec eq_vecI index_row(1) index_row(2) index_vec mat_of_cols_carrier(2) mat_of_cols_carrier(3) mat_of_cols_index)


[STATEMENT]
lemma fps_inv_deriv:
  assumes a0: "a$0 = (0::'a::field)"
    and a1: "a$1 \<noteq> 0"
  shows "fps_deriv (fps_inv a) = inverse (fps_deriv a oo fps_inv a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_deriv (fps_inv a) = inverse (fps_deriv a oo fps_inv a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_deriv (fps_inv a) = inverse (fps_deriv a oo fps_inv a)
[PROOF STEP]
let ?ia = "fps_inv a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_deriv (fps_inv a) = inverse (fps_deriv a oo fps_inv a)
[PROOF STEP]
let ?d = "fps_deriv a oo ?ia"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_deriv (fps_inv a) = inverse (fps_deriv a oo fps_inv a)
[PROOF STEP]
let ?dia = "fps_deriv ?ia"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_deriv (fps_inv a) = inverse (fps_deriv a oo fps_inv a)
[PROOF STEP]
have ia0: "?ia$0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_inv a $ 0 = (0::'a)
[PROOF STEP]
by (simp add: fps_inv_def)
[PROOF STATE]
proof (state)
this:
fps_inv a $ 0 = (0::'a)

goal (1 subgoal):
 1. fps_deriv (fps_inv a) = inverse (fps_deriv a oo fps_inv a)
[PROOF STEP]
have th0: "?d$0 \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fps_deriv a oo fps_inv a) $ 0 \<noteq> (0::'a)
[PROOF STEP]
using a1
[PROOF STATE]
proof (prove)
using this:
a $ 1 \<noteq> (0::'a)

goal (1 subgoal):
 1. (fps_deriv a oo fps_inv a) $ 0 \<noteq> (0::'a)
[PROOF STEP]
by (simp add: fps_compose_nth)
[PROOF STATE]
proof (state)
this:
(fps_deriv a oo fps_inv a) $ 0 \<noteq> (0::'a)

goal (1 subgoal):
 1. fps_deriv (fps_inv a) = inverse (fps_deriv a oo fps_inv a)
[PROOF STEP]
from fps_inv_right[OF a0 a1]
[PROOF STATE]
proof (chain)
picking this:
a oo fps_inv a = fps_X
[PROOF STEP]
have "?d * ?dia = 1"
[PROOF STATE]
proof (prove)
using this:
a oo fps_inv a = fps_X

goal (1 subgoal):
 1. (fps_deriv a oo fps_inv a) * fps_deriv (fps_inv a) = 1
[PROOF STEP]
by (simp add: fps_compose_deriv[OF ia0, of a, symmetric] )
[PROOF STATE]
proof (state)
this:
(fps_deriv a oo fps_inv a) * fps_deriv (fps_inv a) = 1

goal (1 subgoal):
 1. fps_deriv (fps_inv a) = inverse (fps_deriv a oo fps_inv a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(fps_deriv a oo fps_inv a) * fps_deriv (fps_inv a) = 1
[PROOF STEP]
have "inverse ?d * ?d * ?dia = inverse ?d * 1"
[PROOF STATE]
proof (prove)
using this:
(fps_deriv a oo fps_inv a) * fps_deriv (fps_inv a) = 1

goal (1 subgoal):
 1. inverse (fps_deriv a oo fps_inv a) * (fps_deriv a oo fps_inv a) * fps_deriv (fps_inv a) = inverse (fps_deriv a oo fps_inv a) * 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inverse (fps_deriv a oo fps_inv a) * (fps_deriv a oo fps_inv a) * fps_deriv (fps_inv a) = inverse (fps_deriv a oo fps_inv a) * 1

goal (1 subgoal):
 1. fps_deriv (fps_inv a) = inverse (fps_deriv a oo fps_inv a)
[PROOF STEP]
with inverse_mult_eq_1 [OF th0]
[PROOF STATE]
proof (chain)
picking this:
inverse (fps_deriv a oo fps_inv a) * (fps_deriv a oo fps_inv a) = 1
inverse (fps_deriv a oo fps_inv a) * (fps_deriv a oo fps_inv a) * fps_deriv (fps_inv a) = inverse (fps_deriv a oo fps_inv a) * 1
[PROOF STEP]
show "?dia = inverse ?d"
[PROOF STATE]
proof (prove)
using this:
inverse (fps_deriv a oo fps_inv a) * (fps_deriv a oo fps_inv a) = 1
inverse (fps_deriv a oo fps_inv a) * (fps_deriv a oo fps_inv a) * fps_deriv (fps_inv a) = inverse (fps_deriv a oo fps_inv a) * 1

goal (1 subgoal):
 1. fps_deriv (fps_inv a) = inverse (fps_deriv a oo fps_inv a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_deriv (fps_inv a) = inverse (fps_deriv a oo fps_inv a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eventually_not_equal_at_infinity:
  "eventually (\<lambda>x. x \<noteq> (a :: 'a :: {real_normed_vector})) at_infinity"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_infinity. x \<noteq> a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_infinity. x \<noteq> a
[PROOF STEP]
from filterlim_norm_at_top[where 'a = 'a]
[PROOF STATE]
proof (chain)
picking this:
filterlim norm at_top at_infinity
[PROOF STEP]
have "\<forall>\<^sub>F x in at_infinity. norm a < norm (x::'a)"
[PROOF STATE]
proof (prove)
using this:
filterlim norm at_top at_infinity

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_infinity. norm a < norm x
[PROOF STEP]
by (auto simp: filterlim_at_top_dense)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_infinity. norm a < norm x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_infinity. x \<noteq> a
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_infinity. norm a < norm x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_infinity. x \<noteq> a
[PROOF STEP]
by eventually_elim auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_infinity. x \<noteq> a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fls_left_inverse':
  fixes   f :: "'a::ring_1 fls"
  assumes "x * f $$ fls_subdegree f = 1" "f $$ fls_subdegree f * y = 1"
  \<comment> \<open>These assumptions imply x equals y, but no need to assume that.\<close>
  shows   "fls_right_inverse f y * f = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_right_inverse f y * f = 1
[PROOF STEP]
using   assms fls_left_inverse_eq_fls_right_inverse[of x f y] fls_left_inverse[of x f]
[PROOF STATE]
proof (prove)
using this:
x * f $$ fls_subdegree f = (1::'a)
f $$ fls_subdegree f * y = (1::'a)
\<lbrakk>x * f $$ fls_subdegree f = (1::'a); f $$ fls_subdegree f * y = (1::'a)\<rbrakk> \<Longrightarrow> fls_left_inverse f x = fls_right_inverse f y
x * f $$ fls_subdegree f = (1::'a) \<Longrightarrow> fls_left_inverse f x * f = 1

goal (1 subgoal):
 1. fls_right_inverse f y * f = 1
[PROOF STEP]
by      simp


[STATEMENT]
lemma closedin_Hausdorff_singleton:
   "\<lbrakk>Hausdorff_space X; x \<in> topspace X\<rbrakk> \<Longrightarrow> closedin X {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Hausdorff_space X; x \<in> topspace X\<rbrakk> \<Longrightarrow> closedin X {x}
[PROOF STEP]
by (simp add: Hausdorff_imp_t1_space closedin_t1_singleton)


[STATEMENT]
lemma Univ_abs_label:
  "(UNIV :: (Label set)) = Abs_Label ` {n :: nat. n \<le> max_label}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV = Abs_Label ` {n. n \<le> max_label}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. UNIV = Abs_Label ` {n. n \<le> max_label}
[PROOF STEP]
have "\<forall>x :: Label. x : Abs_Label ` {n :: nat. n \<le> max_label}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. x \<in> Abs_Label ` {n. n \<le> max_label}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> Abs_Label ` {n. n \<le> max_label}
[PROOF STEP]
fix x :: Label
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> Abs_Label ` {n. n \<le> max_label}
[PROOF STEP]
have "Rep_Label x \<in> {n. n \<le> max_label}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_Label x \<in> {n. n \<le> max_label}
[PROOF STEP]
by (fold Label_def, rule Rep_Label)
[PROOF STATE]
proof (state)
this:
Rep_Label x \<in> {n. n \<le> max_label}

goal (1 subgoal):
 1. \<And>x. x \<in> Abs_Label ` {n. n \<le> max_label}
[PROOF STEP]
hence "Abs_Label (Rep_Label x) \<in> Abs_Label ` {n. n \<le> max_label}"
[PROOF STATE]
proof (prove)
using this:
Rep_Label x \<in> {n. n \<le> max_label}

goal (1 subgoal):
 1. Abs_Label (Rep_Label x) \<in> Abs_Label ` {n. n \<le> max_label}
[PROOF STEP]
by (rule imageI)
[PROOF STATE]
proof (state)
this:
Abs_Label (Rep_Label x) \<in> Abs_Label ` {n. n \<le> max_label}

goal (1 subgoal):
 1. \<And>x. x \<in> Abs_Label ` {n. n \<le> max_label}
[PROOF STEP]
thus "x \<in> Abs_Label ` {n. n \<le> max_label}"
[PROOF STATE]
proof (prove)
using this:
Abs_Label (Rep_Label x) \<in> Abs_Label ` {n. n \<le> max_label}

goal (1 subgoal):
 1. x \<in> Abs_Label ` {n. n \<le> max_label}
[PROOF STEP]
by (simp add: Rep_Label_inverse)
[PROOF STATE]
proof (state)
this:
x \<in> Abs_Label ` {n. n \<le> max_label}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x. x \<in> Abs_Label ` {n. n \<le> max_label}

goal (1 subgoal):
 1. UNIV = Abs_Label ` {n. n \<le> max_label}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>x. x \<in> Abs_Label ` {n. n \<le> max_label}

goal (1 subgoal):
 1. UNIV = Abs_Label ` {n. n \<le> max_label}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
UNIV = Abs_Label ` {n. n \<le> max_label}

goal:
No subgoals!
[PROOF STEP]
qed


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


[STATEMENT]
lemma nth_least_lift[simp]:
    "nth_least (lift A) 0 = 0"
    "enat n < esize A \<Longrightarrow> nth_least (lift A) (Suc n) = Suc (nth_least A n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_least (lift A) 0 = 0 &&& (enat n < esize A \<Longrightarrow> nth_least (lift A) (Suc n) = Suc (nth_least A n))
[PROOF STEP]
unfolding lift_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_least (insert 0 (Suc ` A)) 0 = 0 &&& (enat n < esize A \<Longrightarrow> nth_least (insert 0 (Suc ` A)) (Suc n) = Suc (nth_least A n))
[PROOF STEP]
by simp+


[STATEMENT]
lemma x_empty_set[simp]: "\<forall>x\<le>w. \<not> Rr (xs @ [x]) \<Longrightarrow>
                           {x. x \<le> w \<and> Rr (xs @ [x])} = {} "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<le>w. \<not> Rr (xs @ [x]) \<Longrightarrow> {x. x \<le> w \<and> Rr (xs @ [x])} = {}
[PROOF STEP]
by auto


[STATEMENT]
lemma order_power: "p \<noteq> 0 \<Longrightarrow> order x (p ^ n) = n * order x p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> order x (p ^ n) = n * order x p
[PROOF STEP]
by (induction n) (auto simp: order_mult)


[STATEMENT]
lemma cSup_mult:
  fixes c::real
  assumes ne: "S \<noteq> {}"
      and bS: "\<And>x. x\<in>S \<Longrightarrow> x \<le> b"
      and nnc: "0 \<le> c"
  shows "c * Sup S = Sup {c * x |x. x \<in> S}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * Sup S = Sup {c * x |x. x \<in> S}
[PROOF STEP]
proof(cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> c * Sup S = Sup {c * x |x. x \<in> S}
 2. \<not> ?P \<Longrightarrow> c * Sup S = Sup {c * x |x. x \<in> S}
[PROOF STEP]
assume "c = 0"
[PROOF STATE]
proof (state)
this:
c = 0

goal (2 subgoals):
 1. ?P \<Longrightarrow> c * Sup S = Sup {c * x |x. x \<in> S}
 2. \<not> ?P \<Longrightarrow> c * Sup S = Sup {c * x |x. x \<in> S}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
c = 0

goal (2 subgoals):
 1. ?P \<Longrightarrow> c * Sup S = Sup {c * x |x. x \<in> S}
 2. \<not> ?P \<Longrightarrow> c * Sup S = Sup {c * x |x. x \<in> S}
[PROOF STEP]
from ne
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
[PROOF STEP]
have "\<exists>x. x \<in> S"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}

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

goal (2 subgoals):
 1. ?P \<Longrightarrow> c * Sup S = Sup {c * x |x. x \<in> S}
 2. \<not> ?P \<Longrightarrow> c * Sup S = Sup {c * x |x. x \<in> S}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
c = 0
\<exists>x. x \<in> S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c = 0
\<exists>x. x \<in> S

goal (1 subgoal):
 1. c * Sup S = Sup {c * x |x. x \<in> S}
[PROOF STEP]
by(simp)
[PROOF STATE]
proof (state)
this:
c * Sup S = Sup {c * x |x. x \<in> S}

goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> c * Sup S = Sup {c * x |x. x \<in> S}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> c * Sup S = Sup {c * x |x. x \<in> S}
[PROOF STEP]
assume cnz: "c \<noteq> 0"
[PROOF STATE]
proof (state)
this:
c \<noteq> 0

goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> c * Sup S = Sup {c * x |x. x \<in> S}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * Sup S = Sup {c * x |x. x \<in> S}
[PROOF STEP]
proof(rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. c * Sup S \<le> Sup {c * x |x. x \<in> S}
 2. Sup {c * x |x. x \<in> S} \<le> c * Sup S
[PROOF STEP]
from bS
[PROOF STATE]
proof (chain)
picking this:
?x \<in> S \<Longrightarrow> ?x \<le> b
[PROOF STEP]
have baS: "bdd_above S"
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> ?x \<le> b

goal (1 subgoal):
 1. bdd_above S
[PROOF STEP]
by(intro bdd_aboveI, auto)
[PROOF STATE]
proof (state)
this:
bdd_above S

goal (2 subgoals):
 1. c * Sup S \<le> Sup {c * x |x. x \<in> S}
 2. Sup {c * x |x. x \<in> S} \<le> c * Sup S
[PROOF STEP]
with ne nnc
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
0 \<le> c
bdd_above S
[PROOF STEP]
show "Sup {c * x |x. x \<in> S} \<le> c * Sup S"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}
0 \<le> c
bdd_above S

goal (1 subgoal):
 1. Sup {c * x |x. x \<in> S} \<le> c * Sup S
[PROOF STEP]
by(blast intro!:cSup_least mult_left_mono[OF cSup_upper])
[PROOF STATE]
proof (state)
this:
Sup {c * x |x. x \<in> S} \<le> c * Sup S

goal (1 subgoal):
 1. c * Sup S \<le> Sup {c * x |x. x \<in> S}
[PROOF STEP]
have "Sup S \<le> inverse c * Sup {c * x |x. x \<in> S}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup S \<le> inverse c * Sup {c * x |x. x \<in> S}
[PROOF STEP]
proof(intro cSup_least ne)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> x \<le> inverse c * Sup {c * x |x. x \<in> S}
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> x \<le> inverse c * Sup {c * x |x. x \<in> S}
[PROOF STEP]
assume xin: "x\<in>S"
[PROOF STATE]
proof (state)
this:
x \<in> S

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> x \<le> inverse c * Sup {c * x |x. x \<in> S}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<in> S

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> x \<le> inverse c * Sup {c * x |x. x \<in> S}
[PROOF STEP]
from bS nnc
[PROOF STATE]
proof (chain)
picking this:
?x \<in> S \<Longrightarrow> ?x \<le> b
0 \<le> c
[PROOF STEP]
have "\<And>x. x\<in>S \<Longrightarrow> c * x \<le> c * b"
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> ?x \<le> b
0 \<le> c

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> c * x \<le> c * b
[PROOF STEP]
by(auto intro:mult_left_mono)
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> c * ?x \<le> c * b

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> x \<le> inverse c * Sup {c * x |x. x \<in> S}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<in> S
?x \<in> S \<Longrightarrow> c * ?x \<le> c * b
[PROOF STEP]
have "c * x \<le> Sup {c * x |x. x \<in> S}"
[PROOF STATE]
proof (prove)
using this:
x \<in> S
?x \<in> S \<Longrightarrow> c * ?x \<le> c * b

goal (1 subgoal):
 1. c * x \<le> Sup {c * x |x. x \<in> S}
[PROOF STEP]
by(auto intro!:cSup_upper bdd_aboveI)
[PROOF STATE]
proof (state)
this:
c * x \<le> Sup {c * x |x. x \<in> S}

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> x \<le> inverse c * Sup {c * x |x. x \<in> S}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
c * x \<le> Sup {c * x |x. x \<in> S}

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> x \<le> inverse c * Sup {c * x |x. x \<in> S}
[PROOF STEP]
from nnc
[PROOF STATE]
proof (chain)
picking this:
0 \<le> c
[PROOF STEP]
have "0 \<le> inverse c"
[PROOF STATE]
proof (prove)
using this:
0 \<le> c

goal (1 subgoal):
 1. 0 \<le> inverse c
[PROOF STEP]
by(auto)
[PROOF STATE]
proof (state)
this:
0 \<le> inverse c

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> x \<le> inverse c * Sup {c * x |x. x \<in> S}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
c * x \<le> Sup {c * x |x. x \<in> S}
0 \<le> inverse c
[PROOF STEP]
have "inverse c * (c * x) \<le> inverse c * Sup {c * x |x. x \<in> S}"
[PROOF STATE]
proof (prove)
using this:
c * x \<le> Sup {c * x |x. x \<in> S}
0 \<le> inverse c

goal (1 subgoal):
 1. inverse c * (c * x) \<le> inverse c * Sup {c * x |x. x \<in> S}
[PROOF STEP]
by(auto intro:mult_left_mono)
[PROOF STATE]
proof (state)
this:
inverse c * (c * x) \<le> inverse c * Sup {c * x |x. x \<in> S}

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> x \<le> inverse c * Sup {c * x |x. x \<in> S}
[PROOF STEP]
with cnz
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> 0
inverse c * (c * x) \<le> inverse c * Sup {c * x |x. x \<in> S}
[PROOF STEP]
show "x \<le> inverse c * Sup {c * x |x. x \<in> S}"
[PROOF STATE]
proof (prove)
using this:
c \<noteq> 0
inverse c * (c * x) \<le> inverse c * Sup {c * x |x. x \<in> S}

goal (1 subgoal):
 1. x \<le> inverse c * Sup {c * x |x. x \<in> S}
[PROOF STEP]
by(simp add:mult.assoc[symmetric])
[PROOF STATE]
proof (state)
this:
x \<le> inverse c * Sup {c * x |x. x \<in> S}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Sup S \<le> inverse c * Sup {c * x |x. x \<in> S}

goal (1 subgoal):
 1. c * Sup S \<le> Sup {c * x |x. x \<in> S}
[PROOF STEP]
with nnc
[PROOF STATE]
proof (chain)
picking this:
0 \<le> c
Sup S \<le> inverse c * Sup {c * x |x. x \<in> S}
[PROOF STEP]
have "c * Sup S \<le> c * (inverse c * Sup {c * x |x. x \<in> S})"
[PROOF STATE]
proof (prove)
using this:
0 \<le> c
Sup S \<le> inverse c * Sup {c * x |x. x \<in> S}

goal (1 subgoal):
 1. c * Sup S \<le> c * (inverse c * Sup {c * x |x. x \<in> S})
[PROOF STEP]
by(auto intro:mult_left_mono)
[PROOF STATE]
proof (state)
this:
c * Sup S \<le> c * (inverse c * Sup {c * x |x. x \<in> S})

goal (1 subgoal):
 1. c * Sup S \<le> Sup {c * x |x. x \<in> S}
[PROOF STEP]
with cnz
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> 0
c * Sup S \<le> c * (inverse c * Sup {c * x |x. x \<in> S})
[PROOF STEP]
show "c * Sup S \<le> Sup {c * x |x. x \<in> S}"
[PROOF STATE]
proof (prove)
using this:
c \<noteq> 0
c * Sup S \<le> c * (inverse c * Sup {c * x |x. x \<in> S})

goal (1 subgoal):
 1. c * Sup S \<le> Sup {c * x |x. x \<in> S}
[PROOF STEP]
by(simp add:mult.assoc[symmetric])
[PROOF STATE]
proof (state)
this:
c * Sup S \<le> Sup {c * x |x. x \<in> S}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
c * Sup S = Sup {c * x |x. x \<in> S}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma e_recurrence:
  assumes k: "k > 0"
  shows   "e k = -(\<Sum>i=1..k. (- 1) ^ i * e (k - i) * p i) / of_nat k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e k = - (\<Sum>i = 1..k. (- 1) ^ i * e (k - i) * p i) / of_nat k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < k

goal (1 subgoal):
 1. e k = - (\<Sum>i = 1..k. (- 1) ^ i * e (k - i) * p i) / of_nat k
[PROOF STEP]
unfolding e_altdef p_altdef
[PROOF STATE]
proof (prove)
using this:
0 < k

goal (1 subgoal):
 1. insertion x (sym_mpoly {..<n} k) = - (\<Sum>i = 1..k. (- 1) ^ i * insertion x (sym_mpoly {..<n} (k - i)) * insertion x (powsum_mpoly {..<n} i)) / of_nat k
[PROOF STEP]
by (subst sym_mpoly_recurrence)
     (auto simp: insertion_sum insertion_add insertion_mult insertion_power insertion_sym_mpoly)


[STATEMENT]
lemma integral_ineq_eq_0_then_AE:
  fixes f::"_ \<Rightarrow> real"
  assumes "AE x in M. f x \<le> g x" "integrable M f" "integrable M g"
          "(\<integral>x. f x \<partial>M) = (\<integral>x. g x \<partial>M)"
  shows "AE x in M. f x = g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. f x = g x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. f x = g x
[PROOF STEP]
define h where "h = (\<lambda>x. g x - f x)"
[PROOF STATE]
proof (state)
this:
h = (\<lambda>x. g x - f x)

goal (1 subgoal):
 1. AE x in M. f x = g x
[PROOF STEP]
have "AE x in M. h x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. h x = 0
[PROOF STEP]
apply (subst integral_nonneg_eq_0_iff_AE[symmetric])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. integrable M h
 2. AE x in M. 0 \<le> h x
 3. integral\<^sup>L M h = 0
[PROOF STEP]
unfolding h_def
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. integrable M (\<lambda>x. g x - f x)
 2. AE x in M. 0 \<le> g x - f x
 3. LINT x|M. g x - f x = 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
AE x in M. f x \<le> g x
integrable M f
integrable M g
integral\<^sup>L M f = integral\<^sup>L M g

goal (3 subgoals):
 1. integrable M (\<lambda>x. g x - f x)
 2. AE x in M. 0 \<le> g x - f x
 3. LINT x|M. g x - f x = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
AE x in M. h x = 0

goal (1 subgoal):
 1. AE x in M. f x = g x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
AE x in M. h x = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
AE x in M. h x = 0

goal (1 subgoal):
 1. AE x in M. f x = g x
[PROOF STEP]
unfolding h_def
[PROOF STATE]
proof (prove)
using this:
AE x in M. g x - f x = 0

goal (1 subgoal):
 1. AE x in M. f x = g x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
AE x in M. f x = g x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dim_col_take_rows[simp]:
  shows "dim_col (take_rows A inds) = dim_col A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (take_rows A inds) = dim_col A
[PROOF STEP]
unfolding take_rows_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (mat_of_rows (dim_col A) (map ((!) (rows A)) (filter (\<lambda>y. y < dim_row A) inds))) = dim_col A
[PROOF STEP]
by auto


[STATEMENT]
lemma in_basis_finmapI:
  assumes "finite I" assumes "\<And>i. i \<in> I \<Longrightarrow> S i \<in> basis_proj"
  shows "Pi' I S \<in> basis_finmap"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Pi' I S \<in> local.basis_finmap
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite I
?i \<in> I \<Longrightarrow> S ?i \<in> local.basis_proj

goal (1 subgoal):
 1. Pi' I S \<in> local.basis_finmap
[PROOF STEP]
unfolding basis_finmap_def
[PROOF STATE]
proof (prove)
using this:
finite I
?i \<in> I \<Longrightarrow> S ?i \<in> local.basis_proj

goal (1 subgoal):
 1. Pi' I S \<in> {Pi' I S |I S. finite I \<and> (\<forall>i\<in>I. S i \<in> local.basis_proj)}
[PROOF STEP]
by auto


[STATEMENT]
lemma gmap_eq_imp_glength_eq: "
  gmap f a = gmap f b \<Longrightarrow> glength a = glength b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gmap f a = gmap f b \<Longrightarrow> glength a = glength b
[PROOF STEP]
by (drule arg_cong[where f=glength], simp)


[STATEMENT]
lemma count_list_inj_map:
  "\<lbrakk> inj_on f (set xs); x \<in> set xs \<rbrakk> \<Longrightarrow> count_list (map f xs) (f x) = count_list xs x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inj_on f (set xs); x \<in> set xs\<rbrakk> \<Longrightarrow> count_list (map f xs) (f x) = count_list xs x
[PROOF STEP]
by (induction xs) (simp, fastforce)


[STATEMENT]
lemma has_vderiv_on_If:
  assumes "U = S \<union> T"
  assumes "(f has_vderiv_on f') (S \<union> (closure T \<inter> closure S))"
  assumes "(g has_vderiv_on g') (T \<union> (closure T \<inter> closure S))"
  assumes "\<And>x. x \<in> closure T \<Longrightarrow> x \<in> closure S \<Longrightarrow> f x = g x"
  assumes "\<And>x. x \<in> closure T \<Longrightarrow> x \<in> closure S \<Longrightarrow> f' x = g' x"
  shows "((\<lambda>t. if t \<in> S then f t else g t) has_vderiv_on (\<lambda>t. if t \<in> S then f' t else g' t)) U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. if t \<in> S then f t else g t) has_vderiv_on (\<lambda>t. if t \<in> S then f' t else g' t)) U
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
U = S \<union> T
(f has_vderiv_on f') (S \<union> closure T \<inter> closure S)
(g has_vderiv_on g') (T \<union> closure T \<inter> closure S)
\<lbrakk>?x \<in> closure T; ?x \<in> closure S\<rbrakk> \<Longrightarrow> f ?x = g ?x
\<lbrakk>?x \<in> closure T; ?x \<in> closure S\<rbrakk> \<Longrightarrow> f' ?x = g' ?x

goal (1 subgoal):
 1. ((\<lambda>t. if t \<in> S then f t else g t) has_vderiv_on (\<lambda>t. if t \<in> S then f' t else g' t)) U
[PROOF STEP]
by (auto simp: has_vderiv_on_def ac_simps
      intro!: has_vector_derivative_If_within_closures
      split del: if_split)


[STATEMENT]
lemma random_bst_image:
  assumes "finite A" "strict_mono_on A f"
  shows   "random_bst (f ` A) = map_pmf (map_tree f) (random_bst A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. random_bst (f ` A) = map_pmf (map_tree f) (random_bst A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. random_bst (f ` A) = map_pmf (map_tree f) (random_bst A)
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
strict_mono_on A f
[PROOF STEP]
have inj: "inj_on f A"
[PROOF STATE]
proof (prove)
using this:
strict_mono_on A f

goal (1 subgoal):
 1. inj_on f A
[PROOF STEP]
by (rule strict_mono_on_imp_inj_on)
[PROOF STATE]
proof (state)
this:
inj_on f A

goal (1 subgoal):
 1. random_bst (f ` A) = map_pmf (map_tree f) (random_bst A)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite A
strict_mono_on A f
inj_on f A
[PROOF STEP]
have "inj_on (map f) (permutations_of_set A)"
[PROOF STATE]
proof (prove)
using this:
finite A
strict_mono_on A f
inj_on f A

goal (1 subgoal):
 1. inj_on (map f) (permutations_of_set A)
[PROOF STEP]
by (intro inj_on_mapI) auto
[PROOF STATE]
proof (state)
this:
inj_on (map f) (permutations_of_set A)

goal (1 subgoal):
 1. random_bst (f ` A) = map_pmf (map_tree f) (random_bst A)
[PROOF STEP]
with assms inj
[PROOF STATE]
proof (chain)
picking this:
finite A
strict_mono_on A f
inj_on f A
inj_on (map f) (permutations_of_set A)
[PROOF STEP]
have "random_bst (f ` A) =
                         map_pmf (\<lambda>x. bst_of_list (map f x)) (pmf_of_set (permutations_of_set A))"
[PROOF STATE]
proof (prove)
using this:
finite A
strict_mono_on A f
inj_on f A
inj_on (map f) (permutations_of_set A)

goal (1 subgoal):
 1. random_bst (f ` A) = map_pmf (\<lambda>x. bst_of_list (map f x)) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
by (simp add: random_bst_altdef permutations_of_set_image_inj map_pmf_of_set_inj [symmetric]
                  pmf.map_comp o_def)
[PROOF STATE]
proof (state)
this:
random_bst (f ` A) = map_pmf (\<lambda>x. bst_of_list (map f x)) (pmf_of_set (permutations_of_set A))

goal (1 subgoal):
 1. random_bst (f ` A) = map_pmf (map_tree f) (random_bst A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
random_bst (f ` A) = map_pmf (\<lambda>x. bst_of_list (map f x)) (pmf_of_set (permutations_of_set A))

goal (1 subgoal):
 1. random_bst (f ` A) = map_pmf (map_tree f) (random_bst A)
[PROOF STEP]
have "\<dots> = map_pmf (map_tree f) (random_bst A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_pmf (\<lambda>x. bst_of_list (map f x)) (pmf_of_set (permutations_of_set A)) = map_pmf (map_tree f) (random_bst A)
[PROOF STEP]
unfolding random_bst_altdef[OF \<open>finite A\<close>] pmf.map_comp o_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_pmf (\<lambda>x. bst_of_list (map f x)) (pmf_of_set (permutations_of_set A)) = map_pmf (\<lambda>x. map_tree f (bst_of_list x)) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
strict_mono_on A f

goal (1 subgoal):
 1. map_pmf (\<lambda>x. bst_of_list (map f x)) (pmf_of_set (permutations_of_set A)) = map_pmf (\<lambda>x. map_tree f (bst_of_list x)) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
by (intro map_pmf_cong refl bst_of_list_map[of A f]) (auto dest: permutations_of_setD)
[PROOF STATE]
proof (state)
this:
map_pmf (\<lambda>x. bst_of_list (map f x)) (pmf_of_set (permutations_of_set A)) = map_pmf (map_tree f) (random_bst A)

goal (1 subgoal):
 1. random_bst (f ` A) = map_pmf (map_tree f) (random_bst A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
random_bst (f ` A) = map_pmf (map_tree f) (random_bst A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
random_bst (f ` A) = map_pmf (map_tree f) (random_bst A)

goal (1 subgoal):
 1. random_bst (f ` A) = map_pmf (map_tree f) (random_bst A)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
random_bst (f ` A) = map_pmf (map_tree f) (random_bst A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma graph_map_comp[simp]: "graph (m1 \<circ>\<^sub>m m2) = graph m2 O graph m1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. graph (m1 \<circ>\<^sub>m m2) = graph m2 O graph m1
[PROOF STEP]
unfolding graph_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(a, b) |a b. (m1 \<circ>\<^sub>m m2) a = Some b} = {(a, b) |a b. m2 a = Some b} O {(a, b) |a b. m1 a = Some b}
[PROOF STEP]
by (auto simp: map_comp_Some_iff relcomp_unfold)


[STATEMENT]
lemma p_intpow_inv'':
  fixes n::int
  shows "(\<pp> [^] -n) = inv\<^bsub>Q\<^sub>p\<^esub> (\<pp> [^] n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pp> [^] - n = inv (\<pp> [^] n)
[PROOF STEP]
by (simp add: Qp.int_pow_inv' Units_eq_nonzero p_nonzero)


[STATEMENT]
lemma card_of_Un_singl_ordLess_infinite1:
assumes "\<not>finite B" and "|A| <o |B|"
shows "|{a} Un A| <o |B|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |{a} \<union> A| <o |B|
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. |{a} \<union> A| <o |B|
[PROOF STEP]
have "|{a}| <o |B|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |{a}| <o |B|
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
infinite B
|A| <o |B|

goal (1 subgoal):
 1. |{a}| <o |B|
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
|{a}| <o |B|

goal (1 subgoal):
 1. |{a} \<union> A| <o |B|
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
|{a}| <o |B|

goal (1 subgoal):
 1. |{a} \<union> A| <o |B|
[PROOF STEP]
using assms card_of_Un_ordLess_infinite[of B]
[PROOF STATE]
proof (prove)
using this:
|{a}| <o |B|
infinite B
|A| <o |B|
\<lbrakk>infinite B; |?A| <o |B|; |?B| <o |B|\<rbrakk> \<Longrightarrow> |?A \<union> ?B| <o |B|

goal (1 subgoal):
 1. |{a} \<union> A| <o |B|
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
|{a} \<union> A| <o |B|

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lfinite_lmergeD: "lfinite (lmerge xs ys) \<Longrightarrow> lfinite xs \<or> lfinite ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lfinite (lmerge xs ys) \<Longrightarrow> lfinite xs \<or> lfinite ys
[PROOF STEP]
by(induct zs\<equiv>"lmerge xs ys" arbitrary: xs ys rule: lfinite_induct)(fastforce simp add: ltl_lmerge if_pull2 split: if_split_asm)+


[STATEMENT]
lemma transfer_fun_eq [transfer_intro]:
  "(\<And>X. f (star_n X) = g (star_n X) \<equiv> eventually (\<lambda>n. F n (X n) = G n (X n)) \<U>) \<Longrightarrow>
    f = g \<equiv> eventually (\<lambda>n. F n = G n) \<U>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>X. f (star_n X) = g (star_n X) \<equiv> \<forall>\<^sub>F n in \<U>. F n (X n) = G n (X n)) \<Longrightarrow> f = g \<equiv> \<forall>\<^sub>F n in \<U>. F n = G n
[PROOF STEP]
by (simp only: fun_eq_iff transfer_all)