[STATEMENT]
lemma poly_f_roots_prop_1:
  fixes qs:: "real poly list"
  assumes non_const: "check_all_const_deg qs = False"
  shows "\<forall>x1. \<forall>x2. ((x1 < x2 \<and> (\<exists>q1 \<in> set (qs). q1 \<noteq> 0 \<and> (poly q1 x1) = 0) \<and> (\<exists>q2\<in> set(qs). q2 \<noteq> 0 \<and> (poly q2 x2) = 0)) \<longrightarrow> (\<exists>q. x1 < q \<and> q < x2 \<and> poly (poly_f qs) q = 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x1 x2. x1 < x2 \<and> (\<exists>q1\<in>set qs. q1 \<noteq> 0 \<and> poly q1 x1 = 0) \<and> (\<exists>q2\<in>set qs. q2 \<noteq> 0 \<and> poly q2 x2 = 0) \<longrightarrow> (\<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0)
[PROOF STEP]
proof clarsimp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x1 x2 q1 q2. \<lbrakk>x1 < x2; q1 \<in> set qs; q2 \<in> set qs; q1 \<noteq> 0; poly q1 x1 = 0; q2 \<noteq> 0; poly q2 x2 = 0\<rbrakk> \<Longrightarrow> \<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0
[PROOF STEP]
fix x1:: "real"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x1 x2 q1 q2. \<lbrakk>x1 < x2; q1 \<in> set qs; q2 \<in> set qs; q1 \<noteq> 0; poly q1 x1 = 0; q2 \<noteq> 0; poly q2 x2 = 0\<rbrakk> \<Longrightarrow> \<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0
[PROOF STEP]
fix x2:: "real"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x1 x2 q1 q2. \<lbrakk>x1 < x2; q1 \<in> set qs; q2 \<in> set qs; q1 \<noteq> 0; poly q1 x1 = 0; q2 \<noteq> 0; poly q2 x2 = 0\<rbrakk> \<Longrightarrow> \<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0
[PROOF STEP]
fix q1:: "real poly"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x1 x2 q1 q2. \<lbrakk>x1 < x2; q1 \<in> set qs; q2 \<in> set qs; q1 \<noteq> 0; poly q1 x1 = 0; q2 \<noteq> 0; poly q2 x2 = 0\<rbrakk> \<Longrightarrow> \<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0
[PROOF STEP]
fix q2:: "real poly"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x1 x2 q1 q2. \<lbrakk>x1 < x2; q1 \<in> set qs; q2 \<in> set qs; q1 \<noteq> 0; poly q1 x1 = 0; q2 \<noteq> 0; poly q2 x2 = 0\<rbrakk> \<Longrightarrow> \<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0
[PROOF STEP]
assume "x1 < x2"
[PROOF STATE]
proof (state)
this:
x1 < x2

goal (1 subgoal):
 1. \<And>x1 x2 q1 q2. \<lbrakk>x1 < x2; q1 \<in> set qs; q2 \<in> set qs; q1 \<noteq> 0; poly q1 x1 = 0; q2 \<noteq> 0; poly q2 x2 = 0\<rbrakk> \<Longrightarrow> \<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0
[PROOF STEP]
assume q1_in: "q1 \<in> set qs"
[PROOF STATE]
proof (state)
this:
q1 \<in> set qs

goal (1 subgoal):
 1. \<And>x1 x2 q1 q2. \<lbrakk>x1 < x2; q1 \<in> set qs; q2 \<in> set qs; q1 \<noteq> 0; poly q1 x1 = 0; q2 \<noteq> 0; poly q2 x2 = 0\<rbrakk> \<Longrightarrow> \<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0
[PROOF STEP]
assume q1_0: "poly q1 x1 = 0"
[PROOF STATE]
proof (state)
this:
poly q1 x1 = 0

goal (1 subgoal):
 1. \<And>x1 x2 q1 q2. \<lbrakk>x1 < x2; q1 \<in> set qs; q2 \<in> set qs; q1 \<noteq> 0; poly q1 x1 = 0; q2 \<noteq> 0; poly q2 x2 = 0\<rbrakk> \<Longrightarrow> \<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0
[PROOF STEP]
assume q1_nonz: "q1 \<noteq> 0"
[PROOF STATE]
proof (state)
this:
q1 \<noteq> 0

goal (1 subgoal):
 1. \<And>x1 x2 q1 q2. \<lbrakk>x1 < x2; q1 \<in> set qs; q2 \<in> set qs; q1 \<noteq> 0; poly q1 x1 = 0; q2 \<noteq> 0; poly q2 x2 = 0\<rbrakk> \<Longrightarrow> \<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0
[PROOF STEP]
assume q2_in: "q2 \<in> set qs"
[PROOF STATE]
proof (state)
this:
q2 \<in> set qs

goal (1 subgoal):
 1. \<And>x1 x2 q1 q2. \<lbrakk>x1 < x2; q1 \<in> set qs; q2 \<in> set qs; q1 \<noteq> 0; poly q1 x1 = 0; q2 \<noteq> 0; poly q2 x2 = 0\<rbrakk> \<Longrightarrow> \<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0
[PROOF STEP]
assume q2_0: "poly q2 x2 = 0"
[PROOF STATE]
proof (state)
this:
poly q2 x2 = 0

goal (1 subgoal):
 1. \<And>x1 x2 q1 q2. \<lbrakk>x1 < x2; q1 \<in> set qs; q2 \<in> set qs; q1 \<noteq> 0; poly q1 x1 = 0; q2 \<noteq> 0; poly q2 x2 = 0\<rbrakk> \<Longrightarrow> \<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0
[PROOF STEP]
assume q2_nonz: "q2 \<noteq> 0"
[PROOF STATE]
proof (state)
this:
q2 \<noteq> 0

goal (1 subgoal):
 1. \<And>x1 x2 q1 q2. \<lbrakk>x1 < x2; q1 \<in> set qs; q2 \<in> set qs; q1 \<noteq> 0; poly q1 x1 = 0; q2 \<noteq> 0; poly q2 x2 = 0\<rbrakk> \<Longrightarrow> \<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0
[PROOF STEP]
have prod_z_x1: "poly (prod_list_var qs) x1 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (prod_list_var qs) x1 = 0
[PROOF STEP]
using q1_in q1_0
[PROOF STATE]
proof (prove)
using this:
q1 \<in> set qs
poly q1 x1 = 0

goal (1 subgoal):
 1. poly (prod_list_var qs) x1 = 0
[PROOF STEP]
using q1_nonz q_dvd_prod_list_var_prop[of q1 qs]
[PROOF STATE]
proof (prove)
using this:
q1 \<in> set qs
poly q1 x1 = 0
q1 \<noteq> 0
\<lbrakk>q1 \<in> set qs; q1 \<noteq> 0\<rbrakk> \<Longrightarrow> q1 dvd prod_list_var qs

goal (1 subgoal):
 1. poly (prod_list_var qs) x1 = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly (prod_list_var qs) x1 = 0

goal (1 subgoal):
 1. \<And>x1 x2 q1 q2. \<lbrakk>x1 < x2; q1 \<in> set qs; q2 \<in> set qs; q1 \<noteq> 0; poly q1 x1 = 0; q2 \<noteq> 0; poly q2 x2 = 0\<rbrakk> \<Longrightarrow> \<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0
[PROOF STEP]
have prod_z_x2: "poly (prod_list_var qs) x2 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (prod_list_var qs) x2 = 0
[PROOF STEP]
using q2_in q2_0
[PROOF STATE]
proof (prove)
using this:
q2 \<in> set qs
poly q2 x2 = 0

goal (1 subgoal):
 1. poly (prod_list_var qs) x2 = 0
[PROOF STEP]
using q2_nonz q_dvd_prod_list_var_prop[of q2 qs]
[PROOF STATE]
proof (prove)
using this:
q2 \<in> set qs
poly q2 x2 = 0
q2 \<noteq> 0
\<lbrakk>q2 \<in> set qs; q2 \<noteq> 0\<rbrakk> \<Longrightarrow> q2 dvd prod_list_var qs

goal (1 subgoal):
 1. poly (prod_list_var qs) x2 = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly (prod_list_var qs) x2 = 0

goal (1 subgoal):
 1. \<And>x1 x2 q1 q2. \<lbrakk>x1 < x2; q1 \<in> set qs; q2 \<in> set qs; q1 \<noteq> 0; poly q1 x1 = 0; q2 \<noteq> 0; poly q2 x2 = 0\<rbrakk> \<Longrightarrow> \<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0
[PROOF STEP]
have "\<exists>w>x1. w < x2 \<and> poly (pderiv (prod_list_var qs)) w = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>w>x1. w < x2 \<and> poly (pderiv (prod_list_var qs)) w = 0
[PROOF STEP]
using Rolle_pderiv[where q = "prod_list_var qs"] prod_z_x1 prod_z_x2
[PROOF STATE]
proof (prove)
using this:
?x1.0 < ?x2.0 \<and> poly (prod_list_var qs) ?x1.0 = 0 \<and> poly (prod_list_var qs) ?x2.0 = 0 \<longrightarrow> (\<exists>w>?x1.0. w < ?x2.0 \<and> poly (pderiv (prod_list_var qs)) w = 0)
poly (prod_list_var qs) x1 = 0
poly (prod_list_var qs) x2 = 0

goal (1 subgoal):
 1. \<exists>w>x1. w < x2 \<and> poly (pderiv (prod_list_var qs)) w = 0
[PROOF STEP]
using \<open>x1 < x2\<close>
[PROOF STATE]
proof (prove)
using this:
?x1.0 < ?x2.0 \<and> poly (prod_list_var qs) ?x1.0 = 0 \<and> poly (prod_list_var qs) ?x2.0 = 0 \<longrightarrow> (\<exists>w>?x1.0. w < ?x2.0 \<and> poly (pderiv (prod_list_var qs)) w = 0)
poly (prod_list_var qs) x1 = 0
poly (prod_list_var qs) x2 = 0
x1 < x2

goal (1 subgoal):
 1. \<exists>w>x1. w < x2 \<and> poly (pderiv (prod_list_var qs)) w = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>w>x1. w < x2 \<and> poly (pderiv (prod_list_var qs)) w = 0

goal (1 subgoal):
 1. \<And>x1 x2 q1 q2. \<lbrakk>x1 < x2; q1 \<in> set qs; q2 \<in> set qs; q1 \<noteq> 0; poly q1 x1 = 0; q2 \<noteq> 0; poly q2 x2 = 0\<rbrakk> \<Longrightarrow> \<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>w>x1. w < x2 \<and> poly (pderiv (prod_list_var qs)) w = 0
[PROOF STEP]
obtain w where w_def: "w > x1 \<and>w < x2 \<and> poly (pderiv (prod_list_var qs)) w = 0"
[PROOF STATE]
proof (prove)
using this:
\<exists>w>x1. w < x2 \<and> poly (pderiv (prod_list_var qs)) w = 0

goal (1 subgoal):
 1. (\<And>w. x1 < w \<and> w < x2 \<and> poly (pderiv (prod_list_var qs)) w = 0 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x1 < w \<and> w < x2 \<and> poly (pderiv (prod_list_var qs)) w = 0

goal (1 subgoal):
 1. \<And>x1 x2 q1 q2. \<lbrakk>x1 < x2; q1 \<in> set qs; q2 \<in> set qs; q1 \<noteq> 0; poly q1 x1 = 0; q2 \<noteq> 0; poly q2 x2 = 0\<rbrakk> \<Longrightarrow> \<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x1 < w \<and> w < x2 \<and> poly (pderiv (prod_list_var qs)) w = 0
[PROOF STEP]
have "poly (poly_f qs) w = 0"
[PROOF STATE]
proof (prove)
using this:
x1 < w \<and> w < x2 \<and> poly (pderiv (prod_list_var qs)) w = 0

goal (1 subgoal):
 1. poly (poly_f qs) w = 0
[PROOF STEP]
unfolding poly_f_def
[PROOF STATE]
proof (prove)
using this:
x1 < w \<and> w < x2 \<and> poly (pderiv (prod_list_var qs)) w = 0

goal (1 subgoal):
 1. poly (if check_all_const_deg qs = True then [:0, 1:] else pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:]) w = 0
[PROOF STEP]
using non_const
[PROOF STATE]
proof (prove)
using this:
x1 < w \<and> w < x2 \<and> poly (pderiv (prod_list_var qs)) w = 0
check_all_const_deg qs = False

goal (1 subgoal):
 1. poly (if check_all_const_deg qs = True then [:0, 1:] else pderiv (prod_list_var qs) * prod_list_var qs * [:real_of_int (- crb (prod_list_var qs)), 1:] * [:real_of_int (crb (prod_list_var qs)), 1:]) w = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly (poly_f qs) w = 0

goal (1 subgoal):
 1. \<And>x1 x2 q1 q2. \<lbrakk>x1 < x2; q1 \<in> set qs; q2 \<in> set qs; q1 \<noteq> 0; poly q1 x1 = 0; q2 \<noteq> 0; poly q2 x2 = 0\<rbrakk> \<Longrightarrow> \<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
poly (poly_f qs) w = 0
[PROOF STEP]
show "\<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0"
[PROOF STATE]
proof (prove)
using this:
poly (poly_f qs) w = 0

goal (1 subgoal):
 1. \<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0
[PROOF STEP]
using w_def
[PROOF STATE]
proof (prove)
using this:
poly (poly_f qs) w = 0
x1 < w \<and> w < x2 \<and> poly (pderiv (prod_list_var qs)) w = 0

goal (1 subgoal):
 1. \<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>q>x1. q < x2 \<and> poly (poly_f qs) q = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_to_fin_trs_conv:
  assumes "\<forall>i \<in> set is. case_ftrs id id i < length Rs"
  shows "is_to_trs (map fset Rs) is = fset (is_to_fin_trs Rs is)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_to_trs (map fset Rs) is = fset (is_to_fin_trs Rs is)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>set is. (case i of Fwd x \<Rightarrow> id x | Bwd x \<Rightarrow> id x) < length Rs

goal (1 subgoal):
 1. is_to_trs (map fset Rs) is = fset (is_to_fin_trs Rs is)
[PROOF STEP]
unfolding is_to_trs_def is_to_fin_trs_def
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>set is. (case i of Fwd x \<Rightarrow> id x | Bwd x \<Rightarrow> id x) < length Rs

goal (1 subgoal):
 1. \<Union> (set (map (case_ftrs ((!) (map fset Rs)) ((`) prod.swap \<circ> (!) (map fset Rs))) is)) = fset (|\<Union>| (fset_of_list (map (case_ftrs ((!) Rs) ((|`|) prod.swap \<circ> (!) Rs)) is)))
[PROOF STEP]
by (auto simp: ffUnion.rep_eq fset_of_list.rep_eq split: ftrs.splits)


[STATEMENT]
lemma apfst_fst_snd: "apfst f x = (f (fst x), snd x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. apfst f x = (f (fst x), snd x)
[PROOF STEP]
by (rule apfst_conv[of _ "fst x" "snd x" for x, unfolded prod.collapse])


[STATEMENT]
lemma L\<^sub>a_le_arg_max: "a \<in> A s \<Longrightarrow> L\<^sub>a a v s \<le> L\<^sub>a (arg_max_on (\<lambda>a. L\<^sub>a a v s) (A s)) v s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> A s \<Longrightarrow> L\<^sub>a a v s \<le> L\<^sub>a (arg_max_on (\<lambda>a. L\<^sub>a a v s) (A s)) v s
[PROOF STEP]
using Sup_att app_arg_max_ge[OF Sup_att[unfolded max_L_ex_def]]
[PROOF STATE]
proof (prove)
using this:
max_L_ex ?s ?v
?x \<in> A ?s1 \<Longrightarrow> L\<^sub>a ?x ?v1 ?s1 \<le> L\<^sub>a (arg_max_on (\<lambda>a. L\<^sub>a a ?v1 ?s1) (A ?s1)) ?v1 ?s1

goal (1 subgoal):
 1. a \<in> A s \<Longrightarrow> L\<^sub>a a v s \<le> L\<^sub>a (arg_max_on (\<lambda>a. L\<^sub>a a v s) (A s)) v s
[PROOF STEP]
by (simp add: arg_max_on_def)


[STATEMENT]
lemma part_not_discrete_card:
  assumes "part (X :: 'a::topological_space set)"
  assumes "\<not>discrete X"
  shows "card {f. CK_nf_pos (f::'a set \<Rightarrow> 'a set)} = 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {f. CK_nf_pos f} = 3
[PROOF STEP]
using part_eqs[OF \<open>part X\<close>] \<open>\<not>discrete X\<close> CK_nf_pos_lattice[where 'a='a]
[PROOF STATE]
proof (prove)
using this:
K \<circ> I = I
I \<circ> K = K
\<not> discrete X
I \<le> id
id \<le> K
I \<le> I \<circ> K \<circ> I
I \<circ> K \<circ> I \<le> I \<circ> K
I \<circ> K \<circ> I \<le> K \<circ> I
I \<circ> K \<le> K \<circ> I \<circ> K
K \<circ> I \<le> K \<circ> I \<circ> K
K \<circ> I \<circ> K \<le> K

goal (1 subgoal):
 1. card {f. CK_nf_pos f} = 3
[PROOF STEP]
unfolding discrete_def
[PROOF STATE]
proof (prove)
using this:
K \<circ> I = I
I \<circ> K = K
I \<noteq> id
I \<le> id
id \<le> K
I \<le> I \<circ> K \<circ> I
I \<circ> K \<circ> I \<le> I \<circ> K
I \<circ> K \<circ> I \<le> K \<circ> I
I \<circ> K \<le> K \<circ> I \<circ> K
K \<circ> I \<le> K \<circ> I \<circ> K
K \<circ> I \<circ> K \<le> K

goal (1 subgoal):
 1. card {f. CK_nf_pos f} = 3
[PROOF STEP]
by (simp add: CK_nf_pos_set card_insert_if C_C I_K K_K o_assoc; metis comp_id)


[STATEMENT]
lemma c_ball_in_Qp:
  "B\<^bsub>n\<^esub>[c] \<subseteq> carrier Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B\<^bsub>n\<^esub>[c] \<subseteq> carrier Q\<^sub>p
[PROOF STEP]
unfolding c_ball_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> carrier Q\<^sub>p. eint n \<le> val (x \<ominus> c)} \<subseteq> carrier Q\<^sub>p
[PROOF STEP]
by blast


[STATEMENT]
lemma cnj_compat_eqvR:
assumes "\<phi> \<in> fmla" and "\<chi>1 \<in> fmla" and "\<chi>2 \<in> fmla"
assumes "prv (eqv \<chi>1 \<chi>2)"
shows "prv (eqv (cnj \<phi> \<chi>1) (cnj \<phi> \<chi>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (eqv (cnj \<phi> \<chi>1) (cnj \<phi> \<chi>2))
[PROOF STEP]
using assms prv_imp_mp imp_cnj_compat_eqvR
[PROOF STATE]
proof (prove)
using this:
\<phi> \<in> fmla
\<chi>1 \<in> fmla
\<chi>2 \<in> fmla
prv (eqv \<chi>1 \<chi>2)
\<lbrakk>?\<phi> \<in> fmla; ?\<chi> \<in> fmla; prv (imp ?\<phi> ?\<chi>); prv ?\<phi>\<rbrakk> \<Longrightarrow> prv ?\<chi>
\<lbrakk>?\<phi> \<in> fmla; ?\<chi>1.0 \<in> fmla; ?\<chi>2.0 \<in> fmla\<rbrakk> \<Longrightarrow> prv (imp (eqv ?\<chi>1.0 ?\<chi>2.0) (eqv (cnj ?\<phi> ?\<chi>1.0) (cnj ?\<phi> ?\<chi>2.0)))

goal (1 subgoal):
 1. prv (eqv (cnj \<phi> \<chi>1) (cnj \<phi> \<chi>2))
[PROOF STEP]
by (meson eqv cnj)


[STATEMENT]
lemma ev_blockD: "\<And> n. ev_block n A \<Longrightarrow> i < n \<Longrightarrow> j < n \<Longrightarrow> A $$ (i,i) = A $$ (j,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>local.ev_block n A; i < n; j < n\<rbrakk> \<Longrightarrow> A $$ (i, i) = A $$ (j, j)
[PROOF STEP]
unfolding ev_block_def carrier_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<forall>i j. i < n \<longrightarrow> j < n \<longrightarrow> A $$ (i, i) = A $$ (j, j); i < n; j < n\<rbrakk> \<Longrightarrow> A $$ (i, i) = A $$ (j, j)
[PROOF STEP]
by blast


[STATEMENT]
lemma fps_XD'_sum: "fps_XD' a (sum f A) = sum (\<lambda>x. fps_XD' (a :: 'a :: comm_ring_1 fps) (f x)) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_XD' a (sum f A) = (\<Sum>x\<in>A. fps_XD' a (f x))
[PROOF STEP]
by (induction A rule: infinite_finite_induct) simp_all


[STATEMENT]
lemma consistent_signs_at_roots_eq:
  assumes "p \<noteq> 0"
  shows "consistent_signs_at_roots p qs =
         set (characterize_consistent_signs_at_roots p qs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. consistent_signs_at_roots p qs = set (characterize_consistent_signs_at_roots p qs)
[PROOF STEP]
unfolding consistent_signs_at_roots_def characterize_consistent_signs_at_roots_def
    characterize_root_list_p_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn_vec qs ` roots p = set (remdups (map (signs_at qs) (sorted_list_of_set {x. poly p x = 0})))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. xa \<in> roots p \<Longrightarrow> sgn_vec qs xa \<in> signs_at qs ` set (sorted_list_of_set {x. poly p x = 0})
 2. \<And>xa. xa \<in> set (sorted_list_of_set {x. poly p x = 0}) \<Longrightarrow> signs_at qs xa \<in> sgn_vec qs ` roots p
[PROOF STEP]
apply (subst set_sorted_list_of_set)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>xa. xa \<in> roots p \<Longrightarrow> finite {x. poly p x = 0}
 2. \<And>xa. xa \<in> roots p \<Longrightarrow> sgn_vec qs xa \<in> signs_at qs ` {x. poly p x = 0}
 3. \<And>xa. xa \<in> set (sorted_list_of_set {x. poly p x = 0}) \<Longrightarrow> signs_at qs xa \<in> sgn_vec qs ` roots p
[PROOF STEP]
using assms poly_roots_finite
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
?p \<noteq> 0 \<Longrightarrow> finite {x. poly ?p x = (0::?'a)}

goal (3 subgoals):
 1. \<And>xa. xa \<in> roots p \<Longrightarrow> finite {x. poly p x = 0}
 2. \<And>xa. xa \<in> roots p \<Longrightarrow> sgn_vec qs xa \<in> signs_at qs ` {x. poly p x = 0}
 3. \<And>xa. xa \<in> set (sorted_list_of_set {x. poly p x = 0}) \<Longrightarrow> signs_at qs xa \<in> sgn_vec qs ` roots p
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. xa \<in> roots p \<Longrightarrow> sgn_vec qs xa \<in> signs_at qs ` {x. poly p x = 0}
 2. \<And>xa. xa \<in> set (sorted_list_of_set {x. poly p x = 0}) \<Longrightarrow> signs_at qs xa \<in> sgn_vec qs ` roots p
[PROOF STEP]
unfolding sgn_vec_def sgn_def signs_at_def squash_def o_def
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. xa \<in> roots p \<Longrightarrow> map (\<lambda>x. if 0 < poly x xa then 1 else if poly x xa < 0 then - 1 else 0) qs \<in> (\<lambda>x. map (\<lambda>xa. if 0 < poly xa x then 1 else if poly xa x < 0 then - 1 else 0) qs) ` {x. poly p x = 0}
 2. \<And>xa. xa \<in> set (sorted_list_of_set {x. poly p x = 0}) \<Longrightarrow> map (\<lambda>x. if 0 < poly x xa then 1 else if poly x xa < 0 then - 1 else 0) qs \<in> (\<lambda>x. map (\<lambda>xa. if 0 < poly xa x then 1 else if poly xa x < 0 then - 1 else 0) qs) ` roots p
[PROOF STEP]
using roots_def
[PROOF STATE]
proof (prove)
using this:
roots ?p = {x. poly ?p x = 0}

goal (2 subgoals):
 1. \<And>xa. xa \<in> roots p \<Longrightarrow> map (\<lambda>x. if 0 < poly x xa then 1 else if poly x xa < 0 then - 1 else 0) qs \<in> (\<lambda>x. map (\<lambda>xa. if 0 < poly xa x then 1 else if poly xa x < 0 then - 1 else 0) qs) ` {x. poly p x = 0}
 2. \<And>xa. xa \<in> set (sorted_list_of_set {x. poly p x = 0}) \<Longrightarrow> map (\<lambda>x. if 0 < poly x xa then 1 else if poly x xa < 0 then - 1 else 0) qs \<in> (\<lambda>x. map (\<lambda>xa. if 0 < poly xa x then 1 else if poly xa x < 0 then - 1 else 0) qs) ` roots p
[PROOF STEP]
apply auto[1]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. xa \<in> set (sorted_list_of_set {x. poly p x = 0}) \<Longrightarrow> map (\<lambda>x. if 0 < poly x xa then 1 else if poly x xa < 0 then - 1 else 0) qs \<in> (\<lambda>x. map (\<lambda>xa. if 0 < poly xa x then 1 else if poly xa x < 0 then - 1 else 0) qs) ` roots p
[PROOF STEP]
by (smt Collect_cong assms image_iff poly_roots_finite roots_def sorted_list_of_set(1))


[STATEMENT]
lemma continuous_on_extension_sequentially':
  fixes f :: "'a::{first_countable_topology, t2_space} \<Rightarrow> 'b::t3_space"
  assumes "\<And>u b. (\<forall>n. u n \<in> S) \<Longrightarrow> b \<in> T \<Longrightarrow> u \<longlonglongrightarrow> b \<Longrightarrow> convergent (\<lambda>n. f (u n))"
          "\<And>b. b \<in> T \<Longrightarrow> \<exists>u. (\<forall>n. u n \<in> S) \<and> u \<longlonglongrightarrow> b \<and> ((\<lambda>n. f (u n)) \<longlonglongrightarrow> f b)"
  shows "continuous_on T f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on T f
[PROOF STEP]
unfolding continuous_on_eq_continuous_within
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>T. continuous (at x within T) f
[PROOF STEP]
apply (auto intro!: continuous_within_subset[of _ "S \<union> T" f T])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> T \<Longrightarrow> continuous (at x within S \<union> T) f
[PROOF STEP]
by (intro continuous_at_extension_sequentially'[OF _ assms], auto)


[STATEMENT]
lemma well_founded_iff_ex_extremal:
  "well_founded A (\<sqsubset>) \<longleftrightarrow> (\<forall>X \<subseteq> A. X \<noteq> {} \<longrightarrow> (\<exists>x \<in> X. \<forall>z \<in> X. \<not> z \<sqsubset> x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. well_founded A (\<sqsubset>) = (\<forall>X\<subseteq>A. X \<noteq> {} \<longrightarrow> (\<exists>x\<in>X. \<forall>z\<in>X. \<not> z \<sqsubset> x))
[PROOF STEP]
using well_founded.nonempty_imp_ex_extremal well_foundedI_extremal
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>well_founded ?A ?less; ?Q \<subseteq> ?A; ?Q \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>z\<in>?Q. \<forall>y\<in>?Q. \<not> ?less y z
(\<And>X. \<lbrakk>X \<subseteq> A; X \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>x\<in>X. \<forall>y\<in>X. \<not> y \<sqsubset> x) \<Longrightarrow> well_founded A (\<sqsubset>)

goal (1 subgoal):
 1. well_founded A (\<sqsubset>) = (\<forall>X\<subseteq>A. X \<noteq> {} \<longrightarrow> (\<exists>x\<in>X. \<forall>z\<in>X. \<not> z \<sqsubset> x))
[PROOF STEP]
by blast


[STATEMENT]
lemma frontier_of_closures:
     "X frontier_of S = X closure_of S \<inter> X closure_of (topspace X - S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X frontier_of S = X closure_of S \<inter> X closure_of (topspace X - S)
[PROOF STEP]
by (metis Diff_Diff_Int closure_of_complement closure_of_subset_topspace double_diff frontier_of_def interior_of_subset_closure_of)


[STATEMENT]
lemma (in ordered_ab_semigroup_add) add_left_mono_trans:
  "\<lbrakk> x \<le> a + b; b \<le> c \<rbrakk> \<Longrightarrow> x \<le> a + c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> a + b; b \<le> c\<rbrakk> \<Longrightarrow> x \<le> a + c
[PROOF STEP]
by(erule order_trans)(rule add_left_mono)


[STATEMENT]
lemma orthogonal_clauses:
  "orthogonal a 0"
  "orthogonal a x \<Longrightarrow> orthogonal a (scale c x)"
  "orthogonal a x \<Longrightarrow> orthogonal a (- x)"
  "orthogonal a x \<Longrightarrow> orthogonal a y \<Longrightarrow> orthogonal a (x + y)"
  "orthogonal a x \<Longrightarrow> orthogonal a y \<Longrightarrow> orthogonal a (x - y)"
  "orthogonal 0 a"
  "orthogonal x a \<Longrightarrow> orthogonal (scale c x) a"
  "orthogonal x a \<Longrightarrow> orthogonal (- x) a"
  "orthogonal x a \<Longrightarrow> orthogonal y a \<Longrightarrow> orthogonal (x + y) a"
  "orthogonal x a \<Longrightarrow> orthogonal y a \<Longrightarrow> orthogonal (x - y) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((orthogonal a (0::'b) &&& (orthogonal a x \<Longrightarrow> orthogonal a (scale c x))) &&& (orthogonal a x \<Longrightarrow> orthogonal a (- x)) &&& (\<lbrakk>orthogonal a x; orthogonal a y\<rbrakk> \<Longrightarrow> orthogonal a (x + y)) &&& (\<lbrakk>orthogonal a x; orthogonal a y\<rbrakk> \<Longrightarrow> orthogonal a (x - y))) &&& (orthogonal (0::'b) a &&& (orthogonal x a \<Longrightarrow> orthogonal (scale c x) a)) &&& (orthogonal x a \<Longrightarrow> orthogonal (- x) a) &&& (\<lbrakk>orthogonal x a; orthogonal y a\<rbrakk> \<Longrightarrow> orthogonal (x + y) a) &&& (\<lbrakk>orthogonal x a; orthogonal y a\<rbrakk> \<Longrightarrow> orthogonal (x - y) a)
[PROOF STEP]
unfolding orthogonal_def inner_add inner_diff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((inner a (0::'b) = (0::'a) &&& (inner a x = (0::'a) \<Longrightarrow> inner a (scale c x) = (0::'a))) &&& (inner a x = (0::'a) \<Longrightarrow> inner a (- x) = (0::'a)) &&& (\<lbrakk>inner a x = (0::'a); inner a y = (0::'a)\<rbrakk> \<Longrightarrow> inner a x + inner a y = (0::'a)) &&& (\<lbrakk>inner a x = (0::'a); inner a y = (0::'a)\<rbrakk> \<Longrightarrow> inner a x - inner a y = (0::'a))) &&& (inner (0::'b) a = (0::'a) &&& (inner x a = (0::'a) \<Longrightarrow> inner (scale c x) a = (0::'a))) &&& (inner x a = (0::'a) \<Longrightarrow> inner (- x) a = (0::'a)) &&& (\<lbrakk>inner x a = (0::'a); inner y a = (0::'a)\<rbrakk> \<Longrightarrow> inner x a + inner y a = (0::'a)) &&& (\<lbrakk>inner x a = (0::'a); inner y a = (0::'a)\<rbrakk> \<Longrightarrow> inner x a - inner y a = (0::'a))
[PROOF STEP]
by auto


[STATEMENT]
lemma prod_mset_Bag[code]: "prod_mset (Bag ms) = DAList_Multiset.fold (\<lambda>a n. (((*) a) ^^ n)) 1 ms"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Prod>\<^sub># (Bag ms) = DAList_Multiset.fold (\<lambda>a. (^^) ((*) a)) (1::'a) ms
[PROOF STEP]
unfolding prod_mset.eq_fold
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold_mset (*) (1::'a) (Bag ms) = DAList_Multiset.fold (\<lambda>a. (^^) ((*) a)) (1::'a) ms
[PROOF STEP]
apply (rule comp_fun_commute.DAList_Multiset_fold)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. comp_fun_commute (*)
 2. \<And>a n x. ((*) a ^^ n) x = ((*) a ^^ n) x
[PROOF STEP]
apply unfold_locales
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>y x. (*) y \<circ> (*) x = (*) x \<circ> (*) y
 2. \<And>a n x. ((*) a ^^ n) x = ((*) a ^^ n) x
[PROOF STEP]
apply (auto simp: ac_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma approximation1:
  "(real (k - 1)) ^ (m - l) * prod (\<lambda> i. real (k - 1 - i)) {0..<l}
   > (real (k - 1)) ^ m / 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (k - 1) ^ m / 3 < real (k - 1) ^ (m - l) * (\<Prod>i = 0..<l. real (k - 1 - i))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (k - 1) ^ m / 3 < real (k - 1) ^ (m - l) * (\<Prod>i = 0..<l. real (k - 1 - i))
[PROOF STEP]
have "real (k - 1) ^ (m - l) * (\<Prod>i = 0..<l. real (k - 1 - i)) =
    real (k - 1) ^ m *
    (inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (k - 1) ^ (m - l) * (\<Prod>i = 0..<l. real (k - 1 - i)) = real (k - 1) ^ m * (inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i)))
[PROOF STEP]
by (subst power_diff_conv_inverse, insert k2 lm, auto)
[PROOF STATE]
proof (state)
this:
real (k - 1) ^ (m - l) * (\<Prod>i = 0..<l. real (k - 1 - i)) = real (k - 1) ^ m * (inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i)))

goal (1 subgoal):
 1. real (k - 1) ^ m / 3 < real (k - 1) ^ (m - l) * (\<Prod>i = 0..<l. real (k - 1 - i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (k - 1) ^ (m - l) * (\<Prod>i = 0..<l. real (k - 1 - i)) = real (k - 1) ^ m * (inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i)))

goal (1 subgoal):
 1. real (k - 1) ^ m / 3 < real (k - 1) ^ (m - l) * (\<Prod>i = 0..<l. real (k - 1 - i))
[PROOF STEP]
have "\<dots> > (real (k - 1)) ^ m * (1/3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (k - 1) ^ m * (1 / 3) < real (k - 1) ^ m * (inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i)))
[PROOF STEP]
proof (rule mult_strict_left_mono)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
define f where "f l = (1  + (-1) / real l) ^ l" for l
[PROOF STATE]
proof (state)
this:
f ?l = (1 + - 1 / real ?l) ^ ?l

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
define e1 :: real where "e1 = exp (- 1)"
[PROOF STATE]
proof (state)
this:
e1 = exp (- 1)

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
define lim :: real where "lim = 1 / 3"
[PROOF STATE]
proof (state)
this:
lim = 1 / 3

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
from tendsto_exp_limit_sequentially[of "-1", folded f_def]
[PROOF STATE]
proof (chain)
picking this:
f \<longlonglongrightarrow> exp (- 1)
[PROOF STEP]
have f: "f \<longlonglongrightarrow> e1"
[PROOF STATE]
proof (prove)
using this:
f \<longlonglongrightarrow> exp (- 1)

goal (1 subgoal):
 1. f \<longlonglongrightarrow> e1
[PROOF STEP]
by (simp add: e1_def)
[PROOF STATE]
proof (state)
this:
f \<longlonglongrightarrow> e1

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
have "lim < (1 - 1 / real 6) ^ 6"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lim < (1 - 1 / real 6) ^ 6
[PROOF STEP]
unfolding lim_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / 3 < (1 - 1 / real 6) ^ 6
[PROOF STEP]
by code_simp
[PROOF STATE]
proof (state)
this:
lim < (1 - 1 / real 6) ^ 6

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lim < (1 - 1 / real 6) ^ 6

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
have " \<dots> \<le> exp (- 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - 1 / real 6) ^ 6 \<le> exp (- 1)
[PROOF STEP]
by (rule exp_ge_one_minus_x_over_n_power_n, auto)
[PROOF STATE]
proof (state)
this:
(1 - 1 / real 6) ^ 6 \<le> exp (- 1)

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
lim < exp (- 1)
[PROOF STEP]
have "lim < e1"
[PROOF STATE]
proof (prove)
using this:
lim < exp (- 1)

goal (1 subgoal):
 1. lim < e1
[PROOF STEP]
unfolding e1_def
[PROOF STATE]
proof (prove)
using this:
lim < exp (- 1)

goal (1 subgoal):
 1. lim < exp (- 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lim < e1

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
with f
[PROOF STATE]
proof (chain)
picking this:
f \<longlonglongrightarrow> e1
lim < e1
[PROOF STEP]
have "\<exists> l0. \<forall> l. l \<ge> l0 \<longrightarrow> f l > lim"
[PROOF STATE]
proof (prove)
using this:
f \<longlonglongrightarrow> e1
lim < e1

goal (1 subgoal):
 1. \<exists>l0. \<forall>l\<ge>l0. lim < f l
[PROOF STEP]
by (metis eventually_sequentially order_tendstoD(1))
[PROOF STATE]
proof (state)
this:
\<exists>l0. \<forall>l\<ge>l0. lim < f l

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
from someI_ex[OF this[unfolded f_def lim_def], folded L0_def] L0
[PROOF STATE]
proof (chain)
picking this:
\<forall>l\<ge>L0. 1 / 3 < (1 + - 1 / real l) ^ l
L0 \<le> l
[PROOF STEP]
have fl: "f l > 1/3"
[PROOF STATE]
proof (prove)
using this:
\<forall>l\<ge>L0. 1 / 3 < (1 + - 1 / real l) ^ l
L0 \<le> l

goal (1 subgoal):
 1. 1 / 3 < f l
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
using this:
\<forall>l\<ge>L0. 1 / 3 < (1 + - 1 / real l) ^ l
L0 \<le> l

goal (1 subgoal):
 1. 1 / 3 < (1 + - 1 / real l) ^ l
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 / 3 < f l

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
define start where "start = inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))"
[PROOF STATE]
proof (state)
this:
start = inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
have "uminus start
      = uminus (prod (\<lambda> _. inverse (real (k - 1))) {0..<l} * prod (\<lambda> i. real (k - 1 - i)) {0 ..< l})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - start = - ((\<Prod>_ = 0..<l. inverse (real (k - 1))) * (\<Prod>i = 0..<l. real (k - 1 - i)))
[PROOF STEP]
by (simp add: start_def)
[PROOF STATE]
proof (state)
this:
- start = - ((\<Prod>_ = 0..<l. inverse (real (k - 1))) * (\<Prod>i = 0..<l. real (k - 1 - i)))

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- start = - ((\<Prod>_ = 0..<l. inverse (real (k - 1))) * (\<Prod>i = 0..<l. real (k - 1 - i)))

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
have "\<dots> = uminus (prod (\<lambda> i. inverse (real (k - 1)) * real (k - 1 - i)) {0..<l})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - ((\<Prod>_ = 0..<l. inverse (real (k - 1))) * (\<Prod>i = 0..<l. real (k - 1 - i))) = - (\<Prod>i = 0..<l. inverse (real (k - 1)) * real (k - 1 - i))
[PROOF STEP]
by (subst prod.distrib, simp)
[PROOF STATE]
proof (state)
this:
- ((\<Prod>_ = 0..<l. inverse (real (k - 1))) * (\<Prod>i = 0..<l. real (k - 1 - i))) = - (\<Prod>i = 0..<l. inverse (real (k - 1)) * real (k - 1 - i))

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- ((\<Prod>_ = 0..<l. inverse (real (k - 1))) * (\<Prod>i = 0..<l. real (k - 1 - i))) = - (\<Prod>i = 0..<l. inverse (real (k - 1)) * real (k - 1 - i))

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
have "\<dots> \<le> uminus (prod (\<lambda> i. inverse (real (k - 1)) * real (k - 1 - (l - 1))) {0..<l})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (\<Prod>i = 0..<l. inverse (real (k - 1)) * real (k - 1 - i)) \<le> - (\<Prod>i = 0..<l. inverse (real (k - 1)) * real (k - 1 - (l - 1)))
[PROOF STEP]
unfolding neg_le_iff_le
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..<l. inverse (real (k - 1)) * real (k - 1 - (l - 1))) \<le> (\<Prod>i = 0..<l. inverse (real (k - 1)) * real (k - 1 - i))
[PROOF STEP]
by (intro prod_mono conjI mult_left_mono, insert k2 l2, auto intro!: diff_le_mono2)
[PROOF STATE]
proof (state)
this:
- (\<Prod>i = 0..<l. inverse (real (k - 1)) * real (k - 1 - i)) \<le> - (\<Prod>i = 0..<l. inverse (real (k - 1)) * real (k - 1 - (l - 1)))

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- (\<Prod>i = 0..<l. inverse (real (k - 1)) * real (k - 1 - i)) \<le> - (\<Prod>i = 0..<l. inverse (real (k - 1)) * real (k - 1 - (l - 1)))

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
have "\<dots> = uminus ((inverse (real (k - 1)) * real (k - l)) ^ l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (\<Prod>i = 0..<l. inverse (real (k - 1)) * real (k - 1 - (l - 1))) = - ((inverse (real (k - 1)) * real (k - l)) ^ l)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- (\<Prod>i = 0..<l. inverse (real (k - 1)) * real (k - 1 - (l - 1))) = - ((inverse (real (k - 1)) * real (k - l)) ^ l)

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- (\<Prod>i = 0..<l. inverse (real (k - 1)) * real (k - 1 - (l - 1))) = - ((inverse (real (k - 1)) * real (k - l)) ^ l)

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
have "inverse (real (k - 1)) * real (k - l) = inverse (real (k - 1)) * ((real (k - 1)) - (real l - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (real (k - 1)) * real (k - l) = inverse (real (k - 1)) * (real (k - 1) - (real l - 1))
[PROOF STEP]
using l2 k2 k
[PROOF STATE]
proof (prove)
using this:
2 < l
2 < k
l < k

goal (1 subgoal):
 1. inverse (real (k - 1)) * real (k - l) = inverse (real (k - 1)) * (real (k - 1) - (real l - 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inverse (real (k - 1)) * real (k - l) = inverse (real (k - 1)) * (real (k - 1) - (real l - 1))

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
inverse (real (k - 1)) * real (k - l) = inverse (real (k - 1)) * (real (k - 1) - (real l - 1))

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
have "\<dots> = 1 - (real l - 1) / (real (k - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (real (k - 1)) * (real (k - 1) - (real l - 1)) = 1 - (real l - 1) / real (k - 1)
[PROOF STEP]
using l2 k2 k
[PROOF STATE]
proof (prove)
using this:
2 < l
2 < k
l < k

goal (1 subgoal):
 1. inverse (real (k - 1)) * (real (k - 1) - (real l - 1)) = 1 - (real l - 1) / real (k - 1)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
inverse (real (k - 1)) * (real (k - 1) - (real l - 1)) = 1 - (real l - 1) / real (k - 1)

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
inverse (real (k - 1)) * (real (k - 1) - (real l - 1)) = 1 - (real l - 1) / real (k - 1)

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
have "real (k - 1) = real k - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (k - 1) = real k - 1
[PROOF STEP]
using k2
[PROOF STATE]
proof (prove)
using this:
2 < k

goal (1 subgoal):
 1. real (k - 1) = real k - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (k - 1) = real k - 1

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (k - 1) = real k - 1

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
have "\<dots> = (real l - 1) * (real l + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real k - 1 = (real l - 1) * (real l + 1)
[PROOF STEP]
unfolding kl2 of_nat_power
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real l)\<^sup>2 - 1 = (real l - 1) * (real l + 1)
[PROOF STEP]
by (simp add: field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
real k - 1 = (real l - 1) * (real l + 1)

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real k - 1 = (real l - 1) * (real l + 1)

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
have "(real l - 1) / \<dots> = inverse (real l + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (real l - 1) / ((real l - 1) * (real l + 1)) = inverse (real l + 1)
[PROOF STEP]
using l2
[PROOF STATE]
proof (prove)
using this:
2 < l

goal (1 subgoal):
 1. (real l - 1) / ((real l - 1) * (real l + 1)) = inverse (real l + 1)
[PROOF STEP]
by (smt (verit, best) divide_divide_eq_left' divide_inverse nat_1_add_1 nat_less_real_le nonzero_mult_div_cancel_left of_nat_1 of_nat_add)
[PROOF STATE]
proof (state)
this:
(real l - 1) / ((real l - 1) * (real l + 1)) = inverse (real l + 1)

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(real l - 1) / ((real l - 1) * (real l + 1)) = inverse (real l + 1)

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
have "- ((1 - inverse (real l + 1)) ^ l) \<le> - ((1 - inverse (real l)) ^ l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - ((1 - inverse (real l + 1)) ^ l) \<le> - ((1 - inverse (real l)) ^ l)
[PROOF STEP]
unfolding neg_le_iff_le
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - inverse (real l)) ^ l \<le> (1 - inverse (real l + 1)) ^ l
[PROOF STEP]
by (intro power_mono, insert l2, auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
- ((1 - inverse (real l + 1)) ^ l) \<le> - ((1 - inverse (real l)) ^ l)

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- ((1 - inverse (real l + 1)) ^ l) \<le> - ((1 - inverse (real l)) ^ l)

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
have "\<dots> < - (1/3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - ((1 - inverse (real l)) ^ l) < - (1 / 3)
[PROOF STEP]
using fl
[PROOF STATE]
proof (prove)
using this:
1 / 3 < f l

goal (1 subgoal):
 1. - ((1 - inverse (real l)) ^ l) < - (1 / 3)
[PROOF STEP]
unfolding f_def
[PROOF STATE]
proof (prove)
using this:
1 / 3 < (1 + - 1 / real l) ^ l

goal (1 subgoal):
 1. - ((1 - inverse (real l)) ^ l) < - (1 / 3)
[PROOF STEP]
by (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
- ((1 - inverse (real l)) ^ l) < - (1 / 3)

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
- start < - (1 / 3)
[PROOF STEP]
have start: "start > 1 / 3"
[PROOF STATE]
proof (prove)
using this:
- start < - (1 / 3)

goal (1 subgoal):
 1. 1 / 3 < start
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 / 3 < start

goal (2 subgoals):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
 2. 0 < real (k - 1) ^ m
[PROOF STEP]
thus "inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i)) > 1/3"
[PROOF STATE]
proof (prove)
using this:
1 / 3 < start

goal (1 subgoal):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
[PROOF STEP]
unfolding start_def
[PROOF STATE]
proof (prove)
using this:
1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))

goal (1 subgoal):
 1. 1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 / 3 < inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i))

goal (1 subgoal):
 1. 0 < real (k - 1) ^ m
[PROOF STEP]
qed (insert k2, auto)
[PROOF STATE]
proof (state)
this:
real (k - 1) ^ m * (1 / 3) < real (k - 1) ^ m * (inverse (real (k - 1)) ^ l * (\<Prod>i = 0..<l. real (k - 1 - i)))

goal (1 subgoal):
 1. real (k - 1) ^ m / 3 < real (k - 1) ^ (m - l) * (\<Prod>i = 0..<l. real (k - 1 - i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (k - 1) ^ m * (1 / 3) < real (k - 1) ^ (m - l) * (\<Prod>i = 0..<l. real (k - 1 - i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (k - 1) ^ m * (1 / 3) < real (k - 1) ^ (m - l) * (\<Prod>i = 0..<l. real (k - 1 - i))

goal (1 subgoal):
 1. real (k - 1) ^ m / 3 < real (k - 1) ^ (m - l) * (\<Prod>i = 0..<l. real (k - 1 - i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (k - 1) ^ m / 3 < real (k - 1) ^ (m - l) * (\<Prod>i = 0..<l. real (k - 1 - i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hypreal_sqrt_pow2_iff: "(( *f* sqrt)(x) ^ 2 = x) = (0 \<le> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (((*f* sqrt) x)\<^sup>2 = x) = (0 \<le> x)
[PROOF STEP]
proof (cases x)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>X. x = star_n X \<Longrightarrow> (((*f* sqrt) x)\<^sup>2 = x) = (0 \<le> x)
[PROOF STEP]
case (star_n X)
[PROOF STATE]
proof (state)
this:
x = star_n X

goal (1 subgoal):
 1. \<And>X. x = star_n X \<Longrightarrow> (((*f* sqrt) x)\<^sup>2 = x) = (0 \<le> x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = star_n X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = star_n X

goal (1 subgoal):
 1. (((*f* sqrt) x)\<^sup>2 = x) = (0 \<le> x)
[PROOF STEP]
by (simp add: star_n_le star_n_zero_num starfun hrealpow star_n_eq_iff del: hpowr_Suc power_Suc)
[PROOF STATE]
proof (state)
this:
(((*f* sqrt) x)\<^sup>2 = x) = (0 \<le> x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hom_inf [simp]: "hom f (x \<sqinter> y) = hom f x \<sqinter> hom f y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom f (x \<sqinter> y) = hom f x \<sqinter> hom f y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. hom f (x \<sqinter> y) = hom f x \<sqinter> hom f y
[PROOF STEP]
obtain S where S: "hom_graph f S x (hom f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>S. hom_graph f S x (hom f x) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using hom_graph_hom
[PROOF STATE]
proof (prove)
using this:
\<exists>S. hom_graph ?f S ?x (hom ?f ?x)

goal (1 subgoal):
 1. (\<And>S. hom_graph f S x (hom f x) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
hom_graph f S x (hom f x)

goal (1 subgoal):
 1. hom f (x \<sqinter> y) = hom f x \<sqinter> hom f y
[PROOF STEP]
obtain T where T: "hom_graph f T y (hom f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>T. hom_graph f T y (hom f y) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using hom_graph_hom
[PROOF STATE]
proof (prove)
using this:
\<exists>S. hom_graph ?f S ?x (hom ?f ?x)

goal (1 subgoal):
 1. (\<And>T. hom_graph f T y (hom f y) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
hom_graph f T y (hom f y)

goal (1 subgoal):
 1. hom f (x \<sqinter> y) = hom f x \<sqinter> hom f y
[PROOF STEP]
have "hom_graph f (S \<union> T) (x \<sqinter> y) (hom f x \<sqinter> hom f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom_graph f (S \<union> T) (x \<sqinter> y) (hom f x \<sqinter> hom f y)
[PROOF STEP]
using S T
[PROOF STATE]
proof (prove)
using this:
hom_graph f S x (hom f x)
hom_graph f T y (hom f y)

goal (1 subgoal):
 1. hom_graph f (S \<union> T) (x \<sqinter> y) (hom f x \<sqinter> hom f y)
[PROOF STEP]
by (rule hom_graph_union_inf)
[PROOF STATE]
proof (state)
this:
hom_graph f (S \<union> T) (x \<sqinter> y) (hom f x \<sqinter> hom f y)

goal (1 subgoal):
 1. hom f (x \<sqinter> y) = hom f x \<sqinter> hom f y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
hom_graph f (S \<union> T) (x \<sqinter> y) (hom f x \<sqinter> hom f y)

goal (1 subgoal):
 1. hom f (x \<sqinter> y) = hom f x \<sqinter> hom f y
[PROOF STEP]
by (rule hom_equality)
[PROOF STATE]
proof (state)
this:
hom f (x \<sqinter> y) = hom f x \<sqinter> hom f y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma modular_1:
  assumes "is_conjugation f g"
  shows "f x \<cdot> y = f (x \<cdot> g y) \<cdot> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x \<cdot> y = f (x \<cdot> g y) \<cdot> y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f x \<cdot> y = f (x \<cdot> g y) \<cdot> y
[PROOF STEP]
have "f x \<cdot> y = f (x \<cdot> g y + x \<cdot> -g y) \<cdot> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x \<cdot> y = f (x \<cdot> g y + x \<cdot> - g y) \<cdot> y
[PROOF STEP]
by (metis aux4)
[PROOF STATE]
proof (state)
this:
f x \<cdot> y = f (x \<cdot> g y + x \<cdot> - g y) \<cdot> y

goal (1 subgoal):
 1. f x \<cdot> y = f (x \<cdot> g y) \<cdot> y
[PROOF STEP]
hence "f x \<cdot> y = (f (x \<cdot> g y) + f (x \<cdot> -g y)) \<cdot> y"
[PROOF STATE]
proof (prove)
using this:
f x \<cdot> y = f (x \<cdot> g y + x \<cdot> - g y) \<cdot> y

goal (1 subgoal):
 1. f x \<cdot> y = (f (x \<cdot> g y) + f (x \<cdot> - g y)) \<cdot> y
[PROOF STEP]
by (metis assms f_additive)
[PROOF STATE]
proof (state)
this:
f x \<cdot> y = (f (x \<cdot> g y) + f (x \<cdot> - g y)) \<cdot> y

goal (1 subgoal):
 1. f x \<cdot> y = f (x \<cdot> g y) \<cdot> y
[PROOF STEP]
hence "f x \<cdot> y = f (x \<cdot> g y) \<cdot> y + f (x \<cdot> -g y) \<cdot> y"
[PROOF STATE]
proof (prove)
using this:
f x \<cdot> y = (f (x \<cdot> g y) + f (x \<cdot> - g y)) \<cdot> y

goal (1 subgoal):
 1. f x \<cdot> y = f (x \<cdot> g y) \<cdot> y + f (x \<cdot> - g y) \<cdot> y
[PROOF STEP]
by (metis inf.commute inf_sup_distrib1)
[PROOF STATE]
proof (state)
this:
f x \<cdot> y = f (x \<cdot> g y) \<cdot> y + f (x \<cdot> - g y) \<cdot> y

goal (1 subgoal):
 1. f x \<cdot> y = f (x \<cdot> g y) \<cdot> y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
f x \<cdot> y = f (x \<cdot> g y) \<cdot> y + f (x \<cdot> - g y) \<cdot> y

goal (1 subgoal):
 1. f x \<cdot> y = f (x \<cdot> g y) \<cdot> y
[PROOF STEP]
by (metis assms modular_1_aux sup_bot_right)
[PROOF STATE]
proof (state)
this:
f x \<cdot> y = f (x \<cdot> g y) \<cdot> y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_mset_0_iff [simp]:
  "sum_mset M = 0  \<longleftrightarrow> (\<forall>x \<in> set_mset M. x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub># M = (0::'a)) = (\<forall>x\<in>#M. x = (0::'a))
[PROOF STEP]
by (induction M) auto


[STATEMENT]
lemma Join_preserves [iff]:
     "(F\<squnion>G \<in> preserves v) = (F \<in> preserves v & G \<in> preserves v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F \<squnion> G \<in> preserves v) = (F \<in> preserves v \<and> G \<in> preserves v)
[PROOF STEP]
by (unfold preserves_def, auto)


[STATEMENT]
lemma bigo_sum4: "f =o g +o O(h) \<Longrightarrow>
    (\<lambda>x. \<Sum>y \<in> A x. l x y * f (k x y)) =o
      (\<lambda>x. \<Sum>y \<in> A x. l x y * g (k x y)) +o
        O(\<lambda>x. \<Sum>y \<in> A x. \<bar>l x y * h (k x y)\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> g +o O(h) \<Longrightarrow> (\<lambda>x. \<Sum>y\<in>A x. l x y * f (k x y)) \<in> (\<lambda>x. \<Sum>y\<in>A x. l x y * g (k x y)) +o O(\<lambda>x. \<Sum>y\<in>A x. \<bar>l x y * h (k x y)\<bar>)
[PROOF STEP]
apply (rule set_minus_imp_plus)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> g +o O(h) \<Longrightarrow> (\<lambda>x. \<Sum>y\<in>A x. l x y * f (k x y)) - (\<lambda>x. \<Sum>y\<in>A x. l x y * g (k x y)) \<in> O(\<lambda>x. \<Sum>y\<in>A x. \<bar>l x y * h (k x y)\<bar>)
[PROOF STEP]
apply (subst fun_diff_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> g +o O(h) \<Longrightarrow> (\<lambda>x. (\<Sum>y\<in>A x. l x y * f (k x y)) - (\<Sum>y\<in>A x. l x y * g (k x y))) \<in> O(\<lambda>x. \<Sum>y\<in>A x. \<bar>l x y * h (k x y)\<bar>)
[PROOF STEP]
apply (subst sum_subtractf [symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> g +o O(h) \<Longrightarrow> (\<lambda>x. \<Sum>xa\<in>A x. l x xa * f (k x xa) - l x xa * g (k x xa)) \<in> O(\<lambda>x. \<Sum>y\<in>A x. \<bar>l x y * h (k x y)\<bar>)
[PROOF STEP]
apply (subst right_diff_distrib [symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> g +o O(h) \<Longrightarrow> (\<lambda>x. \<Sum>xa\<in>A x. l x xa * (f (k x xa) - g (k x xa))) \<in> O(\<lambda>x. \<Sum>y\<in>A x. \<bar>l x y * h (k x y)\<bar>)
[PROOF STEP]
apply (rule bigo_sum3)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> g +o O(h) \<Longrightarrow> (\<lambda>a. f a - g a) \<in> O(h)
[PROOF STEP]
apply (subst fun_diff_def [symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> g +o O(h) \<Longrightarrow> f - g \<in> O(h)
[PROOF STEP]
apply (erule set_plus_imp_minus)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma distrib_comp_sum_left :
  "range S \<subseteq> G \<Longrightarrow> range S' \<subseteq> G \<Longrightarrow> T \<circ> (S + S') = (T \<circ> S) + (T \<circ> S')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>range S \<subseteq> G; range S' \<subseteq> G\<rbrakk> \<Longrightarrow> T \<circ> S + S' = (T \<circ> S) + (T \<circ> S')
[PROOF STEP]
using hom
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?g \<in> G; ?g' \<in> G\<rbrakk> \<Longrightarrow> T (?g + ?g') = T ?g + T ?g'

goal (1 subgoal):
 1. \<lbrakk>range S \<subseteq> G; range S' \<subseteq> G\<rbrakk> \<Longrightarrow> T \<circ> S + S' = (T \<circ> S) + (T \<circ> S')
[PROOF STEP]
by (auto simp add: fun_eq_iff)


[STATEMENT]
lemma bigtheta_powr_nonneg [landau_simp]:
  "eventually (\<lambda>x. (f x :: real) \<ge> 0) F \<Longrightarrow> (\<lambda>x. if f x \<ge> 0 then g x else h x) \<in> \<Theta>[F](g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. 0 \<le> f x \<Longrightarrow> (\<lambda>x. if 0 \<le> f x then g x else h x) \<in> \<Theta>[F](g)
[PROOF STEP]
by (intro bigthetaI_cong) (auto elim!: eventually_mono)


[STATEMENT]
lemma disjointI[intro 0]:
    assumes "\<And> x. x \<in> A \<Longrightarrow> x \<in> B \<Longrightarrow> False"
    shows "A \<inter> B = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter> B = {}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> A; ?x \<in> B\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. A \<inter> B = {}
[PROOF STEP]
by auto


[STATEMENT]
lemma max_input_Minus:
  "max_input (Minus a1 a2) = max (max_input a1) (max_input a2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max_input (Minus a1 a2) = max (max_input a1) (max_input a2)
[PROOF STEP]
apply (simp add: max_input_def Let_def max.commute max_absorb2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enumerate_aexp_inputs a1 \<noteq> {} \<longrightarrow> enumerate_aexp_inputs a2 \<noteq> {} \<longrightarrow> Some (Max (enumerate_aexp_inputs a1 \<union> enumerate_aexp_inputs a2)) = max (Some (Max (enumerate_aexp_inputs a1))) (Some (Max (enumerate_aexp_inputs a2)))
[PROOF STEP]
by (metis List.finite_set Max.union enumerate_aexp_inputs_list sup_Some sup_max)


[STATEMENT]
lemma classical_operator_ket:
  assumes "classical_operator_exists \<pi>"
  shows "(classical_operator \<pi>) *\<^sub>V (ket x) = (case \<pi> x of Some i \<Rightarrow> ket i | None \<Rightarrow> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. classical_operator \<pi> *\<^sub>V ket x = (case \<pi> x of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i)
[PROOF STEP]
unfolding classical_operator_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Let (\<lambda>t. case \<pi> (inv ket t) of None \<Rightarrow> 0 | Some x \<Rightarrow> ket x) (cblinfun_extension (range ket)) *\<^sub>V ket x = (case \<pi> x of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i)
[PROOF STEP]
using f_inv_into_f ket_injective rangeI
[PROOF STATE]
proof (prove)
using this:
?y \<in> ?f ` ?A \<Longrightarrow> ?f (inv_into ?A ?f ?y) = ?y
(ket ?i = ket ?j) = (?i = ?j)
?f ?x \<in> range ?f

goal (1 subgoal):
 1. Let (\<lambda>t. case \<pi> (inv ket t) of None \<Rightarrow> 0 | Some x \<Rightarrow> ket x) (cblinfun_extension (range ket)) *\<^sub>V ket x = (case \<pi> x of None \<Rightarrow> 0 | Some i \<Rightarrow> ket i)
[PROOF STEP]
by (metis assms cblinfun_extension_apply classical_operator_exists_def)


[STATEMENT]
lemma has_fps_expansion_cos' [fps_expansion_intros]:
  "(\<lambda>x::'a :: {banach, real_normed_field}. cos x) has_fps_expansion fps_cos 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos has_fps_expansion fps_cos (1::'a)
[PROOF STEP]
using has_fps_expansion_cos[of 1]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. cos ((1::?'b1) * x)) has_fps_expansion fps_cos (1::?'b1)

goal (1 subgoal):
 1. cos has_fps_expansion fps_cos (1::'a)
[PROOF STEP]
by simp


[STATEMENT]
lemma is_prefix_of_append:
  assumes "is_prefix p (a@b)"
  shows "is_prefix p a \<or> (\<exists> b'. b' \<noteq> [] \<and> is_prefix b' b \<and> p = a@b')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_prefix p a \<or> (\<exists>b'. b' \<noteq> [] \<and> is_prefix b' b \<and> p = a @ b')
[PROOF STEP]
apply (auto simp add: is_prefix_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>b'. b' = [] \<or> (\<forall>w. b' @ w \<noteq> b) \<or> p \<noteq> a @ b' \<Longrightarrow> \<exists>w. p @ w = a
[PROOF STEP]
by (metis append_Nil2 append_eq_append_conv2 assms is_prefix_cancel is_prefix_def)


[STATEMENT]
lemma bounded_check_eqv_sound:
  "\<lbrakk>#\<^sub>V \<AA> = idx; bounded_check_eqv idx \<phi> \<psi>\<rbrakk> \<Longrightarrow> (WS1S_Alt.sat\<^sub>b \<AA> \<phi> \<longleftrightarrow> WS1S_Alt.sat\<^sub>b \<AA> \<psi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>#\<^sub>V \<AA> = idx; bounded_check_eqv idx \<phi> \<psi>\<rbrakk> \<Longrightarrow> WS1S_Alt.sat\<^sub>b \<AA> \<phi> = WS1S_Alt.sat\<^sub>b \<AA> \<psi>
[PROOF STEP]
unfolding bounded_check_eqv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>#\<^sub>V \<AA> = idx; WS1S_Alt.bounded.check_eqv idx \<phi> \<psi>\<rbrakk> \<Longrightarrow> WS1S_Alt.sat\<^sub>b \<AA> \<phi> = WS1S_Alt.sat\<^sub>b \<AA> \<psi>
[PROOF STEP]
by (rule WS1S_Alt.bounded_check_eqv_soundness)


[STATEMENT]
lemma length_nth_chop:
  assumes "i < length (chop n xs)"
  shows   "length (chop n xs ! i) =
             (if i = length (chop n xs) - 1 \<and> \<not>n dvd length xs then length xs mod n else n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
proof (cases "n = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
 2. n \<noteq> 0 \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
 2. n \<noteq> 0 \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0
i < length (chop n xs)

goal (1 subgoal):
 1. length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
proof (induction n xs arbitrary: i rule: chop.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>n i. \<lbrakk>n \<noteq> 0; i < length (chop n [])\<rbrakk> \<Longrightarrow> length (chop n [] ! i) = (if i = length (chop n []) - 1 \<and> \<not> n dvd length [] then length [] mod n else n)
 2. \<And>xs i. \<lbrakk>0 \<noteq> 0; i < length (chop 0 xs)\<rbrakk> \<Longrightarrow> length (chop 0 xs ! i) = (if i = length (chop 0 xs) - 1 \<and> \<not> 0 dvd length xs then length xs mod 0 else 0)
 3. \<And>n xs i. \<lbrakk>0 < n; xs \<noteq> []; \<And>i. \<lbrakk>n \<noteq> 0; i < length (chop n (drop n xs))\<rbrakk> \<Longrightarrow> length (chop n (drop n xs) ! i) = (if i = length (chop n (drop n xs)) - 1 \<and> \<not> n dvd length (drop n xs) then length (drop n xs) mod n else n); n \<noteq> 0; i < length (chop n xs)\<rbrakk> \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
case (3 n xs i)
[PROOF STATE]
proof (state)
this:
0 < n
xs \<noteq> []
\<lbrakk>n \<noteq> 0; ?i < length (chop n (drop n xs))\<rbrakk> \<Longrightarrow> length (chop n (drop n xs) ! ?i) = (if ?i = length (chop n (drop n xs)) - 1 \<and> \<not> n dvd length (drop n xs) then length (drop n xs) mod n else n)
n \<noteq> 0
i < length (chop n xs)

goal (3 subgoals):
 1. \<And>n i. \<lbrakk>n \<noteq> 0; i < length (chop n [])\<rbrakk> \<Longrightarrow> length (chop n [] ! i) = (if i = length (chop n []) - 1 \<and> \<not> n dvd length [] then length [] mod n else n)
 2. \<And>xs i. \<lbrakk>0 \<noteq> 0; i < length (chop 0 xs)\<rbrakk> \<Longrightarrow> length (chop 0 xs ! i) = (if i = length (chop 0 xs) - 1 \<and> \<not> 0 dvd length xs then length xs mod 0 else 0)
 3. \<And>n xs i. \<lbrakk>0 < n; xs \<noteq> []; \<And>i. \<lbrakk>n \<noteq> 0; i < length (chop n (drop n xs))\<rbrakk> \<Longrightarrow> length (chop n (drop n xs) ! i) = (if i = length (chop n (drop n xs)) - 1 \<and> \<not> n dvd length (drop n xs) then length (drop n xs) mod n else n); n \<noteq> 0; i < length (chop n xs)\<rbrakk> \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
proof (cases i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i = 0 \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
 2. \<And>nat. i = Suc nat \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
i = 0

goal (2 subgoals):
 1. i = 0 \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
 2. \<And>nat. i = Suc nat \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
i = 0

goal (1 subgoal):
 1. length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
using "3.prems"
[PROOF STATE]
proof (prove)
using this:
i = 0
n \<noteq> 0
i < length (chop n xs)

goal (1 subgoal):
 1. length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
by (cases "length xs < n") (auto simp: le_Suc_eq dest: dvd_imp_le)
[PROOF STATE]
proof (state)
this:
length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
case [simp]: (Suc i')
[PROOF STATE]
proof (state)
this:
i = Suc i'

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
with "3.prems"
[PROOF STATE]
proof (chain)
picking this:
n \<noteq> 0
i < length (chop n xs)
i = Suc i'
[PROOF STEP]
have [simp]: "xs \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0
i < length (chop n xs)
i = Suc i'

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

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
with "3.prems"
[PROOF STATE]
proof (chain)
picking this:
n \<noteq> 0
i < length (chop n xs)
xs \<noteq> []
[PROOF STEP]
have *: "length xs > n"
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0
i < length (chop n xs)
xs \<noteq> []

goal (1 subgoal):
 1. n < length xs
[PROOF STEP]
by (cases "length xs \<le> n") simp_all
[PROOF STATE]
proof (state)
this:
n < length xs

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
with "3.prems"
[PROOF STATE]
proof (chain)
picking this:
n \<noteq> 0
i < length (chop n xs)
n < length xs
[PROOF STEP]
have "chop n xs ! i = chop n (drop n xs) ! i'"
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0
i < length (chop n xs)
n < length xs

goal (1 subgoal):
 1. chop n xs ! i = chop n (drop n xs) ! i'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
chop n xs ! i = chop n (drop n xs) ! i'

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
chop n xs ! i = chop n (drop n xs) ! i'

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
have "length \<dots> = (if i = length (chop n xs) - 1 \<and> \<not> n dvd (length xs - n)
                                then (length xs - n) mod n else n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (chop n (drop n xs) ! i') = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs - n then (length xs - n) mod n else n)
[PROOF STEP]
by (subst "3.IH") (use Suc "3.prems" in auto)
[PROOF STATE]
proof (state)
this:
length (chop n (drop n xs) ! i') = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs - n then (length xs - n) mod n else n)

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
length (chop n (drop n xs) ! i') = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs - n then (length xs - n) mod n else n)

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
have "n dvd (length xs - n) \<longleftrightarrow> n dvd length xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n dvd length xs - n) = (n dvd length xs)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
n < length xs

goal (1 subgoal):
 1. (n dvd length xs - n) = (n dvd length xs)
[PROOF STEP]
by (subst dvd_minus_self) auto
[PROOF STATE]
proof (state)
this:
(n dvd length xs - n) = (n dvd length xs)

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(n dvd length xs - n) = (n dvd length xs)

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
have "(length xs - n) mod n = length xs mod n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (length xs - n) mod n = length xs mod n
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
n < length xs

goal (1 subgoal):
 1. (length xs - n) mod n = length xs mod n
[PROOF STEP]
by (subst le_mod_geq [symmetric]) auto
[PROOF STATE]
proof (state)
this:
(length xs - n) mod n = length xs mod n

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)

goal (1 subgoal):
 1. length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)

goal (2 subgoals):
 1. \<And>n i. \<lbrakk>n \<noteq> 0; i < length (chop n [])\<rbrakk> \<Longrightarrow> length (chop n [] ! i) = (if i = length (chop n []) - 1 \<and> \<not> n dvd length [] then length [] mod n else n)
 2. \<And>xs i. \<lbrakk>0 \<noteq> 0; i < length (chop 0 xs)\<rbrakk> \<Longrightarrow> length (chop 0 xs ! i) = (if i = length (chop 0 xs) - 1 \<and> \<not> 0 dvd length xs then length xs mod 0 else 0)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> length (chop n xs ! i) = (if i = length (chop n xs) - 1 \<and> \<not> n dvd length xs then length xs mod n else n)
[PROOF STEP]
qed (insert assms, auto)


[STATEMENT]
lemma irrefl_trans_imp_antisym: "irrefl r \<Longrightarrow> trans r \<Longrightarrow> antisym r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>irrefl r; trans r\<rbrakk> \<Longrightarrow> antisym r
[PROOF STEP]
unfolding irrefl_def trans_def antisym_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>a. (a, a) \<notin> r; \<forall>x y z. (x, y) \<in> r \<longrightarrow> (y, z) \<in> r \<longrightarrow> (x, z) \<in> r\<rbrakk> \<Longrightarrow> \<forall>x y. (x, y) \<in> r \<longrightarrow> (y, x) \<in> r \<longrightarrow> x = y
[PROOF STEP]
by fast


[STATEMENT]
lemma sorted_fst_take_less_hd_drop:
  assumes "sorted_fst ps" "n < length ps"
  shows "\<forall>p \<in> set (take n ps). fst p \<le> fst (hd (drop n ps))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p\<in>set (take n ps). fst p \<le> fst (hd (drop n ps))
[PROOF STEP]
using assms sorted_wrt_take_less_hd_drop[of "\<lambda>p\<^sub>0 p\<^sub>1. fst p\<^sub>0 \<le> fst p\<^sub>1"] sorted_fst_def
[PROOF STATE]
proof (prove)
using this:
sorted_fst ps
n < length ps
\<lbrakk>sorted_wrt (\<lambda>p\<^sub>0 p\<^sub>1. fst p\<^sub>0 \<le> fst p\<^sub>1) ?xs; ?n < length ?xs\<rbrakk> \<Longrightarrow> \<forall>x\<in>set (take ?n ?xs). fst x \<le> fst (hd (drop ?n ?xs))
sorted_fst ?ps = sorted_wrt (\<lambda>p\<^sub>0 p\<^sub>1. fst p\<^sub>0 \<le> fst p\<^sub>1) ?ps

goal (1 subgoal):
 1. \<forall>p\<in>set (take n ps). fst p \<le> fst (hd (drop n ps))
[PROOF STEP]
by fastforce


[STATEMENT]
lemma term_variants_pred_inv:
  assumes "term_variants_pred P (Fun f T) (Fun h S)"
  shows "length T = length S"
    and "\<And>i. i < length T \<Longrightarrow> term_variants_pred P (T ! i) (S ! i)"
    and "f \<noteq> h \<Longrightarrow> h \<in> set (P f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length T = length S &&& (\<And>i. i < length T \<Longrightarrow> term_variants_pred P (T ! i) (S ! i)) &&& (f \<noteq> h \<Longrightarrow> h \<in> set (P f))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
term_variants_pred P (Fun f T) (Fun h S)

goal (1 subgoal):
 1. length T = length S &&& (\<And>i. i < length T \<Longrightarrow> term_variants_pred P (T ! i) (S ! i)) &&& (f \<noteq> h \<Longrightarrow> h \<in> set (P f))
[PROOF STEP]
by (auto elim: term_variants_pred.cases)


[STATEMENT]
lemma iT_Plus_Un: "(A \<union> B) \<oplus> k = (A \<oplus> k) \<union> (B \<oplus> k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<union> B \<oplus> k = (A \<oplus> k) \<union> (B \<oplus> k)
[PROOF STEP]
by (simp add: iT_Plus_def image_Un)


[STATEMENT]
lemma set_stake_snth: "x \<in> set (stake n xs) \<longleftrightarrow> (\<exists> i < n. xs !! i = x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> set (stake n xs)) = (\<exists>i<n. xs !! i = x)
[PROOF STEP]
unfolding in_set_conv_nth
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>i<length (stake n xs). stake n xs ! i = x) = (\<exists>i<n. xs !! i = x)
[PROOF STEP]
by auto


[STATEMENT]
lemma poincare_distance_x_axis_x_axis:
  assumes "x \<in> unit_disc" and "y \<in> unit_disc" and "x \<in> circline_set x_axis" and "y \<in> circline_set x_axis"
  shows "poincare_distance x y =
            (let x' = to_complex x; y' = to_complex y
              in abs (ln (Re (((1 + x') * (1 - y')) / ((1 - x') * (1 + y'))))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
obtain x' y' where *: "x = of_complex x'" "y = of_complex y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x' y'. \<lbrakk>x = of_complex x'; y = of_complex y'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using inf_or_of_complex[of x] inf_or_of_complex[of y] \<open>x \<in> unit_disc\<close> \<open>y \<in> unit_disc\<close>
[PROOF STATE]
proof (prove)
using this:
x = \<infinity>\<^sub>h \<or> (\<exists>xa. x = of_complex xa)
y = \<infinity>\<^sub>h \<or> (\<exists>x. y = of_complex x)
x \<in> unit_disc
y \<in> unit_disc

goal (1 subgoal):
 1. (\<And>x' y'. \<lbrakk>x = of_complex x'; y = of_complex y'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = of_complex x'
y = of_complex y'

goal (1 subgoal):
 1. poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
have "cmod x' < 1" "cmod y' < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod x' < 1 &&& cmod y' < 1
[PROOF STEP]
using \<open>x \<in> unit_disc\<close> \<open>y \<in> unit_disc\<close> *
[PROOF STATE]
proof (prove)
using this:
x \<in> unit_disc
y \<in> unit_disc
x = of_complex x'
y = of_complex y'

goal (1 subgoal):
 1. cmod x' < 1 &&& cmod y' < 1
[PROOF STEP]
by (metis unit_disc_iff_cmod_lt_1)+
[PROOF STATE]
proof (state)
this:
cmod x' < 1
cmod y' < 1

goal (1 subgoal):
 1. poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
hence **: "x' \<noteq> 1" "x' \<noteq> 1" "y' \<noteq> -1" "y' \<noteq> 1"
[PROOF STATE]
proof (prove)
using this:
cmod x' < 1
cmod y' < 1

goal (1 subgoal):
 1. (x' \<noteq> 1 &&& x' \<noteq> 1) &&& y' \<noteq> - 1 &&& y' \<noteq> 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x' \<noteq> 1
x' \<noteq> 1
y' \<noteq> - 1
y' \<noteq> 1

goal (1 subgoal):
 1. poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
have "1 + y' \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + y' \<noteq> 0
[PROOF STEP]
using **
[PROOF STATE]
proof (prove)
using this:
x' \<noteq> 1
x' \<noteq> 1
y' \<noteq> - 1
y' \<noteq> 1

goal (1 subgoal):
 1. 1 + y' \<noteq> 0
[PROOF STEP]
by (metis add.left_cancel add_neg_numeral_special(7))
[PROOF STATE]
proof (state)
this:
1 + y' \<noteq> 0

goal (1 subgoal):
 1. poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
proof (cases "x = y")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = y \<Longrightarrow> poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
 2. x \<noteq> y \<Longrightarrow> poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = y

goal (2 subgoals):
 1. x = y \<Longrightarrow> poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
 2. x \<noteq> y \<Longrightarrow> poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x = y

goal (1 subgoal):
 1. poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
using assms(1-2)
[PROOF STATE]
proof (prove)
using this:
x = y
x \<in> unit_disc
y \<in> unit_disc

goal (1 subgoal):
 1. poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
using unit_disc_iff_cmod_lt_1[of "to_complex x"] * ** \<open>1 + y' \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
x = y
x \<in> unit_disc
y \<in> unit_disc
(of_complex (to_complex x) \<in> unit_disc) = (cmod (to_complex x) < 1)
x = of_complex x'
y = of_complex y'
x' \<noteq> 1
x' \<noteq> 1
y' \<noteq> - 1
y' \<noteq> 1
1 + y' \<noteq> 0

goal (1 subgoal):
 1. poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> y

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
hence "poincare_line x y = x_axis"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y

goal (1 subgoal):
 1. poincare_line x y = x_axis
[PROOF STEP]
using poincare_line_x_axis[OF assms]
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y
x \<noteq> y \<Longrightarrow> poincare_line x y = x_axis

goal (1 subgoal):
 1. poincare_line x y = x_axis
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poincare_line x y = x_axis

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
hence "ideal_points (poincare_line x y) = {of_complex (-1), of_complex 1}"
[PROOF STATE]
proof (prove)
using this:
poincare_line x y = x_axis

goal (1 subgoal):
 1. ideal_points (poincare_line x y) = {of_complex (- 1), of_complex 1}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ideal_points (poincare_line x y) = {of_complex (- 1), of_complex 1}

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
hence "poincare_distance x y = calc_poincare_distance x (of_complex (-1)) y (of_complex 1)"
[PROOF STATE]
proof (prove)
using this:
ideal_points (poincare_line x y) = {of_complex (- 1), of_complex 1}

goal (1 subgoal):
 1. poincare_distance x y = calc_poincare_distance x (of_complex (- 1)) y (of_complex 1)
[PROOF STEP]
using poincare_distance_I assms \<open>x \<noteq> y\<close>
[PROOF STATE]
proof (prove)
using this:
ideal_points (poincare_line x y) = {of_complex (- 1), of_complex 1}
\<lbrakk>?u \<in> unit_disc; ?v \<in> unit_disc; ?u \<noteq> ?v; ideal_points (poincare_line ?u ?v) = {?i1.0, ?i2.0}\<rbrakk> \<Longrightarrow> poincare_distance ?u ?v = calc_poincare_distance ?u ?i1.0 ?v ?i2.0
x \<in> unit_disc
y \<in> unit_disc
x \<in> circline_set x_axis
y \<in> circline_set x_axis
x \<noteq> y

goal (1 subgoal):
 1. poincare_distance x y = calc_poincare_distance x (of_complex (- 1)) y (of_complex 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poincare_distance x y = calc_poincare_distance x (of_complex (- 1)) y (of_complex 1)

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poincare_distance x y = calc_poincare_distance x (of_complex (- 1)) y (of_complex 1)

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
have "... = abs (ln (Re (((x' + 1) * (y' - 1)) / ((x' - 1) * (y' + 1)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. calc_poincare_distance x (of_complex (- 1)) y (of_complex 1) = \<bar>ln (Re ((x' + 1) * (y' - 1) / ((x' - 1) * (y' + 1))))\<bar>
[PROOF STEP]
using * \<open>cmod x' < 1\<close> \<open>cmod y' < 1\<close>
[PROOF STATE]
proof (prove)
using this:
x = of_complex x'
y = of_complex y'
cmod x' < 1
cmod y' < 1

goal (1 subgoal):
 1. calc_poincare_distance x (of_complex (- 1)) y (of_complex 1) = \<bar>ln (Re ((x' + 1) * (y' - 1) / ((x' - 1) * (y' + 1))))\<bar>
[PROOF STEP]
by (simp, transfer, transfer, auto)
[PROOF STATE]
proof (state)
this:
calc_poincare_distance x (of_complex (- 1)) y (of_complex 1) = \<bar>ln (Re ((x' + 1) * (y' - 1) / ((x' - 1) * (y' + 1))))\<bar>

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
poincare_distance x y = \<bar>ln (Re ((x' + 1) * (y' - 1) / ((x' - 1) * (y' + 1))))\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
poincare_distance x y = \<bar>ln (Re ((x' + 1) * (y' - 1) / ((x' - 1) * (y' + 1))))\<bar>

goal (1 subgoal):
 1. poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
poincare_distance x y = \<bar>ln (Re ((x' + 1) * (y' - 1) / ((x' - 1) * (y' + 1))))\<bar>
x = of_complex x'
y = of_complex y'

goal (1 subgoal):
 1. poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)
[PROOF STEP]
by (metis (no_types, lifting) add.commute minus_diff_eq minus_divide_divide mult_minus_left mult_minus_right to_complex_of_complex)
[PROOF STATE]
proof (state)
this:
poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
poincare_distance x y = (let x' = to_complex x; y' = to_complex y in \<bar>ln (Re ((1 + x') * (1 - y') / ((1 - x') * (1 + y'))))\<bar>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma compact_simple_path_image: "simple_path g \<Longrightarrow> compact(path_image g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simple_path g \<Longrightarrow> compact (path_image g)
[PROOF STEP]
by (metis compact_path_image simple_path_imp_path)


[STATEMENT]
lemma mkuexpr_times [mkuexpr]: "mk\<^sub>e (\<lambda> s. f s * g s) = mk\<^sub>e f * mk\<^sub>e g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mk\<^sub>e (\<lambda>s. f s * g s) = mk\<^sub>e f * mk\<^sub>e g
[PROOF STEP]
by (simp add: times_uexpr_def, transfer, simp)


[STATEMENT]
lemma p_not_div_choose_lemma:
  fixes p :: nat
  assumes eeq: "\<And>i. Suc i < K \<Longrightarrow> multiplicity p (Suc i) = multiplicity p (Suc (j + i))"
      and "k < K" and p: "prime p"
    shows "multiplicity p (j + k choose k) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p (j + k choose k) = 0
[PROOF STEP]
using \<open>k < K\<close>
[PROOF STATE]
proof (prove)
using this:
k < K

goal (1 subgoal):
 1. multiplicity p (j + k choose k) = 0
[PROOF STEP]
proof (induction k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < K \<Longrightarrow> multiplicity p (j + 0 choose 0) = 0
 2. \<And>k. \<lbrakk>k < K \<Longrightarrow> multiplicity p (j + k choose k) = 0; Suc k < K\<rbrakk> \<Longrightarrow> multiplicity p (j + Suc k choose Suc k) = 0
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 < K

goal (2 subgoals):
 1. 0 < K \<Longrightarrow> multiplicity p (j + 0 choose 0) = 0
 2. \<And>k. \<lbrakk>k < K \<Longrightarrow> multiplicity p (j + k choose k) = 0; Suc k < K\<rbrakk> \<Longrightarrow> multiplicity p (j + Suc k choose Suc k) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < K
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 < K

goal (1 subgoal):
 1. multiplicity p (j + 0 choose 0) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
multiplicity p (j + 0 choose 0) = 0

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < K \<Longrightarrow> multiplicity p (j + k choose k) = 0; Suc k < K\<rbrakk> \<Longrightarrow> multiplicity p (j + Suc k choose Suc k) = 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < K \<Longrightarrow> multiplicity p (j + k choose k) = 0; Suc k < K\<rbrakk> \<Longrightarrow> multiplicity p (j + Suc k choose Suc k) = 0
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
k < K \<Longrightarrow> multiplicity p (j + k choose k) = 0
Suc k < K

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < K \<Longrightarrow> multiplicity p (j + k choose k) = 0; Suc k < K\<rbrakk> \<Longrightarrow> multiplicity p (j + Suc k choose Suc k) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k < K \<Longrightarrow> multiplicity p (j + k choose k) = 0
Suc k < K
[PROOF STEP]
have *: "(Suc (j+k) choose Suc k) > 0"
[PROOF STATE]
proof (prove)
using this:
k < K \<Longrightarrow> multiplicity p (j + k choose k) = 0
Suc k < K

goal (1 subgoal):
 1. 0 < Suc (j + k) choose Suc k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < Suc (j + k) choose Suc k

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < K \<Longrightarrow> multiplicity p (j + k choose k) = 0; Suc k < K\<rbrakk> \<Longrightarrow> multiplicity p (j + Suc k choose Suc k) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < Suc (j + k) choose Suc k
[PROOF STEP]
have "multiplicity p ((Suc (j+k) choose Suc k) * Suc k) = multiplicity p (Suc k)"
[PROOF STATE]
proof (prove)
using this:
0 < Suc (j + k) choose Suc k

goal (1 subgoal):
 1. multiplicity p ((Suc (j + k) choose Suc k) * Suc k) = multiplicity p (Suc k)
[PROOF STEP]
by (subst Suc_times_binomial_eq [symmetric], subst prime_elem_multiplicity_mult_distrib)
       (insert p Suc.prems, simp_all add: eeq [symmetric] Suc.IH)
[PROOF STATE]
proof (state)
this:
multiplicity p ((Suc (j + k) choose Suc k) * Suc k) = multiplicity p (Suc k)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < K \<Longrightarrow> multiplicity p (j + k choose k) = 0; Suc k < K\<rbrakk> \<Longrightarrow> multiplicity p (j + Suc k choose Suc k) = 0
[PROOF STEP]
with p *
[PROOF STATE]
proof (chain)
picking this:
prime p
0 < Suc (j + k) choose Suc k
multiplicity p ((Suc (j + k) choose Suc k) * Suc k) = multiplicity p (Suc k)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
prime p
0 < Suc (j + k) choose Suc k
multiplicity p ((Suc (j + k) choose Suc k) * Suc k) = multiplicity p (Suc k)

goal (1 subgoal):
 1. multiplicity p (j + Suc k choose Suc k) = 0
[PROOF STEP]
by (subst (asm) prime_elem_multiplicity_mult_distrib) simp_all
[PROOF STATE]
proof (state)
this:
multiplicity p (j + Suc k choose Suc k) = 0

goal:
No subgoals!
[PROOF STEP]
qed