[STATEMENT]
lemma Bolzano_Weierstrass_complex_disc:
  assumes r: "\<forall>n. cmod (s n) \<le> r"
  shows "\<exists>f z. strict_mono (f :: nat \<Rightarrow> nat) \<and> (\<forall>e >0. \<exists>N. \<forall>n \<ge> N. cmod (s (f n) - z) < e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f z. strict_mono f \<and> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. cmod (s (f n) - z) < e)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>f z. strict_mono f \<and> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. cmod (s (f n) - z) < e)
[PROOF STEP]
from seq_monosub[of "Re \<circ> s"]
[PROOF STATE]
proof (chain)
picking this:
\<exists>f. strict_mono f \<and> monoseq (\<lambda>n. (Re \<circ> s) (f n))
[PROOF STEP]
obtain f where f: "strict_mono f" "monoseq (\<lambda>n. Re (s (f n)))"
[PROOF STATE]
proof (prove)
using this:
\<exists>f. strict_mono f \<and> monoseq (\<lambda>n. (Re \<circ> s) (f n))

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>strict_mono f; monoseq (\<lambda>n. Re (s (f n)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding o_def
[PROOF STATE]
proof (prove)
using this:
\<exists>f. strict_mono f \<and> monoseq (\<lambda>n. Re (s (f n)))

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>strict_mono f; monoseq (\<lambda>n. Re (s (f n)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
strict_mono f
monoseq (\<lambda>n. Re (s (f n)))

goal (1 subgoal):
 1. \<exists>f z. strict_mono f \<and> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. cmod (s (f n) - z) < e)
[PROOF STEP]
from seq_monosub[of "Im \<circ> s \<circ> f"]
[PROOF STATE]
proof (chain)
picking this:
\<exists>fa. strict_mono fa \<and> monoseq (\<lambda>n. (Im \<circ> s \<circ> f) (fa n))
[PROOF STEP]
obtain g where g: "strict_mono g" "monoseq (\<lambda>n. Im (s (f (g n))))"
[PROOF STATE]
proof (prove)
using this:
\<exists>fa. strict_mono fa \<and> monoseq (\<lambda>n. (Im \<circ> s \<circ> f) (fa n))

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>strict_mono g; monoseq (\<lambda>n. Im (s (f (g n))))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding o_def
[PROOF STATE]
proof (prove)
using this:
\<exists>fa. strict_mono fa \<and> monoseq (\<lambda>n. Im (s (f (fa n))))

goal (1 subgoal):
 1. (\<And>g. \<lbrakk>strict_mono g; monoseq (\<lambda>n. Im (s (f (g n))))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
strict_mono g
monoseq (\<lambda>n. Im (s (f (g n))))

goal (1 subgoal):
 1. \<exists>f z. strict_mono f \<and> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. cmod (s (f n) - z) < e)
[PROOF STEP]
let ?h = "f \<circ> g"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>f z. strict_mono f \<and> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. cmod (s (f n) - z) < e)
[PROOF STEP]
from r[rule_format, of 0]
[PROOF STATE]
proof (chain)
picking this:
cmod (s 0) \<le> r
[PROOF STEP]
have rp: "r \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
cmod (s 0) \<le> r

goal (1 subgoal):
 1. 0 \<le> r
[PROOF STEP]
using norm_ge_zero[of "s 0"]
[PROOF STATE]
proof (prove)
using this:
cmod (s 0) \<le> r
0 \<le> cmod (s 0)

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

goal (1 subgoal):
 1. \<exists>f z. strict_mono f \<and> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. cmod (s (f n) - z) < e)
[PROOF STEP]
have th: "\<forall>n. r + 1 \<ge> \<bar>Re (s n)\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. \<bar>Re (s n)\<bar> \<le> r + 1
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<bar>Re (s n)\<bar> \<le> r + 1
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<bar>Re (s n)\<bar> \<le> r + 1
[PROOF STEP]
from abs_Re_le_cmod[of "s n"] r[rule_format, of n]
[PROOF STATE]
proof (chain)
picking this:
\<bar>Re (s n)\<bar> \<le> cmod (s n)
cmod (s n) \<le> r
[PROOF STEP]
show "\<bar>Re (s n)\<bar> \<le> r + 1"
[PROOF STATE]
proof (prove)
using this:
\<bar>Re (s n)\<bar> \<le> cmod (s n)
cmod (s n) \<le> r

goal (1 subgoal):
 1. \<bar>Re (s n)\<bar> \<le> r + 1
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
\<bar>Re (s n)\<bar> \<le> r + 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>n. \<bar>Re (s n)\<bar> \<le> r + 1

goal (1 subgoal):
 1. \<exists>f z. strict_mono f \<and> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. cmod (s (f n) - z) < e)
[PROOF STEP]
have conv1: "convergent (\<lambda>n. Re (s (f n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent (\<lambda>n. Re (s (f n)))
[PROOF STEP]
apply (rule Bseq_monoseq_convergent)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. Bseq (\<lambda>n. Re (s (f n)))
 2. monoseq (\<lambda>n. Re (s (f n)))
[PROOF STEP]
apply (simp add: Bseq_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<exists>K>0. \<forall>n. \<bar>Re (s (f n))\<bar> \<le> K
 2. monoseq (\<lambda>n. Re (s (f n)))
[PROOF STEP]
apply (metis gt_ex le_less_linear less_trans order.trans th)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monoseq (\<lambda>n. Re (s (f n)))
[PROOF STEP]
apply (rule f(2))
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. Re (s (f n)))

goal (1 subgoal):
 1. \<exists>f z. strict_mono f \<and> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. cmod (s (f n) - z) < e)
[PROOF STEP]
have th: "\<forall>n. r + 1 \<ge> \<bar>Im (s n)\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. \<bar>Im (s n)\<bar> \<le> r + 1
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<bar>Im (s n)\<bar> \<le> r + 1
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<bar>Im (s n)\<bar> \<le> r + 1
[PROOF STEP]
from abs_Im_le_cmod[of "s n"] r[rule_format, of n]
[PROOF STATE]
proof (chain)
picking this:
\<bar>Im (s n)\<bar> \<le> cmod (s n)
cmod (s n) \<le> r
[PROOF STEP]
show "\<bar>Im (s n)\<bar> \<le> r + 1"
[PROOF STATE]
proof (prove)
using this:
\<bar>Im (s n)\<bar> \<le> cmod (s n)
cmod (s n) \<le> r

goal (1 subgoal):
 1. \<bar>Im (s n)\<bar> \<le> r + 1
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
\<bar>Im (s n)\<bar> \<le> r + 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>n. \<bar>Im (s n)\<bar> \<le> r + 1

goal (1 subgoal):
 1. \<exists>f z. strict_mono f \<and> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. cmod (s (f n) - z) < e)
[PROOF STEP]
have conv2: "convergent (\<lambda>n. Im (s (f (g n))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent (\<lambda>n. Im (s (f (g n))))
[PROOF STEP]
apply (rule Bseq_monoseq_convergent)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. Bseq (\<lambda>n. Im (s (f (g n))))
 2. monoseq (\<lambda>n. Im (s (f (g n))))
[PROOF STEP]
apply (simp add: Bseq_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<exists>K>0. \<forall>n. \<bar>Im (s (f (g n)))\<bar> \<le> K
 2. monoseq (\<lambda>n. Im (s (f (g n))))
[PROOF STEP]
apply (metis gt_ex le_less_linear less_trans order.trans th)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monoseq (\<lambda>n. Im (s (f (g n))))
[PROOF STEP]
apply (rule g(2))
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. Im (s (f (g n))))

goal (1 subgoal):
 1. \<exists>f z. strict_mono f \<and> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. cmod (s (f n) - z) < e)
[PROOF STEP]
from conv1[unfolded convergent_def]
[PROOF STATE]
proof (chain)
picking this:
\<exists>L. (\<lambda>n. Re (s (f n))) \<longlonglongrightarrow> L
[PROOF STEP]
obtain x where "LIMSEQ (\<lambda>n. Re (s (f n))) x"
[PROOF STATE]
proof (prove)
using this:
\<exists>L. (\<lambda>n. Re (s (f n))) \<longlonglongrightarrow> L

goal (1 subgoal):
 1. (\<And>x. (\<lambda>n. Re (s (f n))) \<longlonglongrightarrow> x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>n. Re (s (f n))) \<longlonglongrightarrow> x

goal (1 subgoal):
 1. \<exists>f z. strict_mono f \<and> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. cmod (s (f n) - z) < e)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. Re (s (f n))) \<longlonglongrightarrow> x
[PROOF STEP]
have x: "\<forall>r>0. \<exists>n0. \<forall>n\<ge>n0. \<bar>Re (s (f n)) - x\<bar> < r"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. Re (s (f n))) \<longlonglongrightarrow> x

goal (1 subgoal):
 1. \<forall>r>0. \<exists>n0. \<forall>n\<ge>n0. \<bar>Re (s (f n)) - x\<bar> < r
[PROOF STEP]
unfolding LIMSEQ_iff real_norm_def
[PROOF STATE]
proof (prove)
using this:
\<forall>r>0. \<exists>no. \<forall>n\<ge>no. \<bar>Re (s (f n)) - x\<bar> < r

goal (1 subgoal):
 1. \<forall>r>0. \<exists>n0. \<forall>n\<ge>n0. \<bar>Re (s (f n)) - x\<bar> < r
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<forall>r>0. \<exists>n0. \<forall>n\<ge>n0. \<bar>Re (s (f n)) - x\<bar> < r

goal (1 subgoal):
 1. \<exists>f z. strict_mono f \<and> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. cmod (s (f n) - z) < e)
[PROOF STEP]
from conv2[unfolded convergent_def]
[PROOF STATE]
proof (chain)
picking this:
\<exists>L. (\<lambda>n. Im (s (f (g n)))) \<longlonglongrightarrow> L
[PROOF STEP]
obtain y where "LIMSEQ (\<lambda>n. Im (s (f (g n)))) y"
[PROOF STATE]
proof (prove)
using this:
\<exists>L. (\<lambda>n. Im (s (f (g n)))) \<longlonglongrightarrow> L

goal (1 subgoal):
 1. (\<And>y. (\<lambda>n. Im (s (f (g n)))) \<longlonglongrightarrow> y \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>n. Im (s (f (g n)))) \<longlonglongrightarrow> y

goal (1 subgoal):
 1. \<exists>f z. strict_mono f \<and> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. cmod (s (f n) - z) < e)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. Im (s (f (g n)))) \<longlonglongrightarrow> y
[PROOF STEP]
have y: "\<forall>r>0. \<exists>n0. \<forall>n\<ge>n0. \<bar>Im (s (f (g n))) - y\<bar> < r"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. Im (s (f (g n)))) \<longlonglongrightarrow> y

goal (1 subgoal):
 1. \<forall>r>0. \<exists>n0. \<forall>n\<ge>n0. \<bar>Im (s (f (g n))) - y\<bar> < r
[PROOF STEP]
unfolding LIMSEQ_iff real_norm_def
[PROOF STATE]
proof (prove)
using this:
\<forall>r>0. \<exists>no. \<forall>n\<ge>no. \<bar>Im (s (f (g n))) - y\<bar> < r

goal (1 subgoal):
 1. \<forall>r>0. \<exists>n0. \<forall>n\<ge>n0. \<bar>Im (s (f (g n))) - y\<bar> < r
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<forall>r>0. \<exists>n0. \<forall>n\<ge>n0. \<bar>Im (s (f (g n))) - y\<bar> < r

goal (1 subgoal):
 1. \<exists>f z. strict_mono f \<and> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. cmod (s (f n) - z) < e)
[PROOF STEP]
let ?w = "Complex x y"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>f z. strict_mono f \<and> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. cmod (s (f n) - z) < e)
[PROOF STEP]
from f(1) g(1)
[PROOF STATE]
proof (chain)
picking this:
strict_mono f
strict_mono g
[PROOF STEP]
have hs: "strict_mono ?h"
[PROOF STATE]
proof (prove)
using this:
strict_mono f
strict_mono g

goal (1 subgoal):
 1. strict_mono (f \<circ> g)
[PROOF STEP]
unfolding strict_mono_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. x < y \<longrightarrow> f x < f y
\<forall>x y. x < y \<longrightarrow> g x < g y

goal (1 subgoal):
 1. \<forall>x y. x < y \<longrightarrow> (f \<circ> g) x < (f \<circ> g) y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
strict_mono (f \<circ> g)

goal (1 subgoal):
 1. \<exists>f z. strict_mono f \<and> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. cmod (s (f n) - z) < e)
[PROOF STEP]
have "\<exists>N. \<forall>n\<ge>N. cmod (s (?h n) - ?w) < e" if "e > 0" for e
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. cmod (s ((f \<circ> g) n) - Complex x y) < e
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. cmod (s ((f \<circ> g) n) - Complex x y) < e
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
0 < e
[PROOF STEP]
have e2: "e/2 > 0"
[PROOF STATE]
proof (prove)
using this:
0 < e

goal (1 subgoal):
 1. 0 < e / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < e / 2

goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. cmod (s ((f \<circ> g) n) - Complex x y) < e
[PROOF STEP]
from x[rule_format, OF e2] y[rule_format, OF e2]
[PROOF STATE]
proof (chain)
picking this:
\<exists>n0. \<forall>n\<ge>n0. \<bar>Re (s (f n)) - x\<bar> < e / 2
\<exists>n0. \<forall>n\<ge>n0. \<bar>Im (s (f (g n))) - y\<bar> < e / 2
[PROOF STEP]
obtain N1 N2 where N1: "\<forall>n\<ge>N1. \<bar>Re (s (f n)) - x\<bar> < e / 2"
      and N2: "\<forall>n\<ge>N2. \<bar>Im (s (f (g n))) - y\<bar> < e / 2"
[PROOF STATE]
proof (prove)
using this:
\<exists>n0. \<forall>n\<ge>n0. \<bar>Re (s (f n)) - x\<bar> < e / 2
\<exists>n0. \<forall>n\<ge>n0. \<bar>Im (s (f (g n))) - y\<bar> < e / 2

goal (1 subgoal):
 1. (\<And>N1 N2. \<lbrakk>\<forall>n\<ge>N1. \<bar>Re (s (f n)) - x\<bar> < e / 2; \<forall>n\<ge>N2. \<bar>Im (s (f (g n))) - y\<bar> < e / 2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>n\<ge>N1. \<bar>Re (s (f n)) - x\<bar> < e / 2
\<forall>n\<ge>N2. \<bar>Im (s (f (g n))) - y\<bar> < e / 2

goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. cmod (s ((f \<circ> g) n) - Complex x y) < e
[PROOF STEP]
have "cmod (s (?h n) - ?w) < e" if "n \<ge> N1 + N2" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (s ((f \<circ> g) n) - Complex x y) < e
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cmod (s ((f \<circ> g) n) - Complex x y) < e
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
N1 + N2 \<le> n
[PROOF STEP]
have nN1: "g n \<ge> N1" and nN2: "n \<ge> N2"
[PROOF STATE]
proof (prove)
using this:
N1 + N2 \<le> n

goal (1 subgoal):
 1. N1 \<le> g n &&& N2 \<le> n
[PROOF STEP]
using seq_suble[OF g(1), of n]
[PROOF STATE]
proof (prove)
using this:
N1 + N2 \<le> n
n \<le> g n

goal (1 subgoal):
 1. N1 \<le> g n &&& N2 \<le> n
[PROOF STEP]
by arith+
[PROOF STATE]
proof (state)
this:
N1 \<le> g n
N2 \<le> n

goal (1 subgoal):
 1. cmod (s ((f \<circ> g) n) - Complex x y) < e
[PROOF STEP]
from add_strict_mono[OF N1[rule_format, OF nN1] N2[rule_format, OF nN2]]
[PROOF STATE]
proof (chain)
picking this:
\<bar>Re (s (f (g n))) - x\<bar> + \<bar>Im (s (f (g n))) - y\<bar> < e / 2 + e / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>Re (s (f (g n))) - x\<bar> + \<bar>Im (s (f (g n))) - y\<bar> < e / 2 + e / 2

goal (1 subgoal):
 1. cmod (s ((f \<circ> g) n) - Complex x y) < e
[PROOF STEP]
using metric_bound_lemma[of "s (f (g n))" ?w]
[PROOF STATE]
proof (prove)
using this:
\<bar>Re (s (f (g n))) - x\<bar> + \<bar>Im (s (f (g n))) - y\<bar> < e / 2 + e / 2
cmod (s (f (g n)) - Complex x y) \<le> \<bar>Re (s (f (g n))) - Re (Complex x y)\<bar> + \<bar>Im (s (f (g n))) - Im (Complex x y)\<bar>

goal (1 subgoal):
 1. cmod (s ((f \<circ> g) n) - Complex x y) < e
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cmod (s ((f \<circ> g) n) - Complex x y) < e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
N1 + N2 \<le> ?n \<Longrightarrow> cmod (s ((f \<circ> g) ?n) - Complex x y) < e

goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. cmod (s ((f \<circ> g) n) - Complex x y) < e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
N1 + N2 \<le> ?n \<Longrightarrow> cmod (s ((f \<circ> g) ?n) - Complex x y) < e
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
N1 + N2 \<le> ?n \<Longrightarrow> cmod (s ((f \<circ> g) ?n) - Complex x y) < e

goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. cmod (s ((f \<circ> g) n) - Complex x y) < e
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>N. \<forall>n\<ge>N. cmod (s ((f \<circ> g) n) - Complex x y) < e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < ?e \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. cmod (s ((f \<circ> g) n) - Complex x y) < ?e

goal (1 subgoal):
 1. \<exists>f z. strict_mono f \<and> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. cmod (s (f n) - z) < e)
[PROOF STEP]
with hs
[PROOF STATE]
proof (chain)
picking this:
strict_mono (f \<circ> g)
0 < ?e \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. cmod (s ((f \<circ> g) n) - Complex x y) < ?e
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
strict_mono (f \<circ> g)
0 < ?e \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. cmod (s ((f \<circ> g) n) - Complex x y) < ?e

goal (1 subgoal):
 1. \<exists>f z. strict_mono f \<and> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. cmod (s (f n) - z) < e)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>f z. strict_mono f \<and> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. cmod (s (f n) - z) < e)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homeomorphic_map_eq:
   "\<lbrakk>homeomorphic_map X Y f; \<And>x. x \<in> topspace X \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> homeomorphic_map X Y g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>homeomorphic_map X Y f; \<And>x. x \<in> topspace X \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> homeomorphic_map X Y g
[PROOF STEP]
by (meson homeomorphic_map_def inj_on_cong quotient_map_eq)


[STATEMENT]
lemma maddux1a: "a\<cdot>(x \<sqinter> -(a \<rhd> y)) \<le> a\<cdot>x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<cdot> (x \<sqinter> - (a \<rhd> y)) \<le> a \<cdot> x
[PROOF STEP]
by (insert maddux1 [of "\<lambda>x. a\<cdot>x"]) simp


[STATEMENT]
lemma norm_blinfun_id_le:
  "norm (id_blinfun::'a::real_normed_vector \<Rightarrow>\<^sub>L 'a) \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm id_blinfun \<le> 1
[PROOF STEP]
by transfer (auto simp: onorm_id_le)


[STATEMENT]
lemma monomial_mp: "monomial c (pp::'a\<Rightarrow>\<^sub>0nat) = Const\<^sub>0 c * monomial1 pp"
  for c::"'b::comm_semiring_1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monomial c pp = Const\<^sub>0 c * monomial1 pp
[PROOF STEP]
by (auto intro!: poly_mapping_eqI simp: monomial1_def Const\<^sub>0_def mult_single)


[STATEMENT]
lemma map_cons: "map f (Cons x xs) = Cons (f x) (map f xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map f (x # xs) = f x # map f xs
[PROOF STEP]
by (rule List.list.map)


[STATEMENT]
lemma Crypt_Spy_analz_bad:
  "\<lbrakk> Crypt (pin A) X \<in> analz (knows Spy evs);  A\<in>bad \<rbrakk>
      \<Longrightarrow> X \<in> analz (knows Spy evs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Crypt (pin A) X \<in> analz (knows Spy evs); A \<in> bad\<rbrakk> \<Longrightarrow> X \<in> analz (knows Spy evs)
[PROOF STEP]
apply (force dest!: analz.Decrypt)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma append_cols_carrier[simp,intro]:
  "A \<in> carrier_mat n a \<Longrightarrow> B \<in> carrier_mat n b \<Longrightarrow> (A @\<^sub>c B) \<in> carrier_mat n (a+b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> carrier_mat n a; B \<in> carrier_mat n b\<rbrakk> \<Longrightarrow> A @\<^sub>c B \<in> carrier_mat n (a + b)
[PROOF STEP]
unfolding append_cols_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<in> carrier_mat n a; B \<in> carrier_mat n b\<rbrakk> \<Longrightarrow> four_block_mat A B (0\<^sub>m 0 (dim_col A)) (0\<^sub>m 0 (dim_col B)) \<in> carrier_mat n (a + b)
[PROOF STEP]
by auto


[STATEMENT]
lemma prod_as_plus: "X \<times>\<^sub>L Y = X ;\<^sub>L fst\<^sub>L +\<^sub>L Y ;\<^sub>L snd\<^sub>L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<times>\<^sub>L Y = X ;\<^sub>L fst\<^sub>L +\<^sub>L Y ;\<^sub>L snd\<^sub>L
[PROOF STEP]
by (auto simp add: lens_prod_def fst_lens_def snd_lens_def lens_comp_def lens_plus_def)


[STATEMENT]
lemma limsup_finite_then_bounded:
  fixes u::"nat \<Rightarrow> real"
  assumes "limsup u < \<infinity>"
  shows "\<exists>C. \<forall>n. u n \<le> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>C. \<forall>n. u n \<le> C
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>C. \<forall>n. u n \<le> C
[PROOF STEP]
obtain C where C: "limsup u < C" "C < \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>C. \<lbrakk>limsup (\<lambda>x. ereal (u x)) < C; C < \<infinity>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms ereal_dense2
[PROOF STATE]
proof (prove)
using this:
limsup (\<lambda>x. ereal (u x)) < \<infinity>
?x < ?y \<Longrightarrow> \<exists>z. ?x < ereal z \<and> ereal z < ?y

goal (1 subgoal):
 1. (\<And>C. \<lbrakk>limsup (\<lambda>x. ereal (u x)) < C; C < \<infinity>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
limsup (\<lambda>x. ereal (u x)) < C
C < \<infinity>

goal (1 subgoal):
 1. \<exists>C. \<forall>n. u n \<le> C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
limsup (\<lambda>x. ereal (u x)) < C
C < \<infinity>
[PROOF STEP]
have "C = ereal(real_of_ereal C)"
[PROOF STATE]
proof (prove)
using this:
limsup (\<lambda>x. ereal (u x)) < C
C < \<infinity>

goal (1 subgoal):
 1. C = ereal (real_of_ereal C)
[PROOF STEP]
using ereal_real
[PROOF STATE]
proof (prove)
using this:
limsup (\<lambda>x. ereal (u x)) < C
C < \<infinity>
ereal (real_of_ereal ?x) = (if \<bar>?x\<bar> = \<infinity> then 0 else ?x)

goal (1 subgoal):
 1. C = ereal (real_of_ereal C)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
C = ereal (real_of_ereal C)

goal (1 subgoal):
 1. \<exists>C. \<forall>n. u n \<le> C
[PROOF STEP]
have "eventually (\<lambda>n. u n < C) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. ereal (u n) < C
[PROOF STEP]
using C(1)
[PROOF STATE]
proof (prove)
using this:
limsup (\<lambda>x. ereal (u x)) < C

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. ereal (u n) < C
[PROOF STEP]
unfolding Limsup_def
[PROOF STATE]
proof (prove)
using this:
(INF P\<in>{P. eventually P sequentially}. SUP x\<in>Collect P. ereal (u x)) < C

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. ereal (u n) < C
[PROOF STEP]
apply (auto simp add: INF_less_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>eventually x sequentially; (SUP x\<in>Collect x. ereal (u x)) < C\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F n in sequentially. ereal (u n) < C
[PROOF STEP]
using SUP_lessD eventually_mono
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Sup (?f ` ?A) < ?y; ?i \<in> ?A\<rbrakk> \<Longrightarrow> ?f ?i < ?y
\<lbrakk>eventually ?P ?F; \<And>x. ?P x \<Longrightarrow> ?Q x\<rbrakk> \<Longrightarrow> eventually ?Q ?F

goal (1 subgoal):
 1. \<And>x. \<lbrakk>eventually x sequentially; (SUP x\<in>Collect x. ereal (u x)) < C\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F n in sequentially. ereal (u n) < C
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. ereal (u n) < C

goal (1 subgoal):
 1. \<exists>C. \<forall>n. u n \<le> C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in sequentially. ereal (u n) < C
[PROOF STEP]
obtain N where N: "\<And>n. n \<ge> N \<Longrightarrow> u n < C"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. ereal (u n) < C

goal (1 subgoal):
 1. (\<And>N. (\<And>n. N \<le> n \<Longrightarrow> ereal (u n) < C) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using eventually_sequentially
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. ereal (u n) < C
eventually ?P sequentially = (\<exists>N. \<forall>n\<ge>N. ?P n)

goal (1 subgoal):
 1. (\<And>N. (\<And>n. N \<le> n \<Longrightarrow> ereal (u n) < C) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
N \<le> ?n \<Longrightarrow> ereal (u ?n) < C

goal (1 subgoal):
 1. \<exists>C. \<forall>n. u n \<le> C
[PROOF STEP]
define D where "D = max (real_of_ereal C) (Max {u n |n. n \<le> N})"
[PROOF STATE]
proof (state)
this:
D = max (real_of_ereal C) (Max {u n |n. n \<le> N})

goal (1 subgoal):
 1. \<exists>C. \<forall>n. u n \<le> C
[PROOF STEP]
have "\<And>n. u n \<le> D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. u n \<le> D
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. u n \<le> D
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. u n \<le> D
[PROOF STEP]
show "u n \<le> D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u n \<le> D
[PROOF STEP]
proof (cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> u n \<le> D
 2. \<not> ?P \<Longrightarrow> u n \<le> D
[PROOF STEP]
assume *: "n \<le> N"
[PROOF STATE]
proof (state)
this:
n \<le> N

goal (2 subgoals):
 1. ?P \<Longrightarrow> u n \<le> D
 2. \<not> ?P \<Longrightarrow> u n \<le> D
[PROOF STEP]
have "u n \<le> Max {u n |n. n \<le> N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u n \<le> Max {u n |n. n \<le> N}
[PROOF STEP]
by (rule Max_ge, auto simp add: *)
[PROOF STATE]
proof (state)
this:
u n \<le> Max {u n |n. n \<le> N}

goal (2 subgoals):
 1. ?P \<Longrightarrow> u n \<le> D
 2. \<not> ?P \<Longrightarrow> u n \<le> D
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u n \<le> Max {u n |n. n \<le> N}
[PROOF STEP]
show "u n \<le> D"
[PROOF STATE]
proof (prove)
using this:
u n \<le> Max {u n |n. n \<le> N}

goal (1 subgoal):
 1. u n \<le> D
[PROOF STEP]
unfolding D_def
[PROOF STATE]
proof (prove)
using this:
u n \<le> Max {u n |n. n \<le> N}

goal (1 subgoal):
 1. u n \<le> max (real_of_ereal C) (Max {u n |n. n \<le> N})
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
u n \<le> D

goal (1 subgoal):
 1. \<not> n \<le> N \<Longrightarrow> u n \<le> D
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> n \<le> N \<Longrightarrow> u n \<le> D
[PROOF STEP]
assume "\<not>(n \<le> N)"
[PROOF STATE]
proof (state)
this:
\<not> n \<le> N

goal (1 subgoal):
 1. \<not> n \<le> N \<Longrightarrow> u n \<le> D
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> n \<le> N
[PROOF STEP]
have "n \<ge> N"
[PROOF STATE]
proof (prove)
using this:
\<not> n \<le> N

goal (1 subgoal):
 1. N \<le> n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
N \<le> n

goal (1 subgoal):
 1. \<not> n \<le> N \<Longrightarrow> u n \<le> D
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
N \<le> n
[PROOF STEP]
have "u n < C"
[PROOF STATE]
proof (prove)
using this:
N \<le> n

goal (1 subgoal):
 1. ereal (u n) < C
[PROOF STEP]
using N
[PROOF STATE]
proof (prove)
using this:
N \<le> n
N \<le> ?n \<Longrightarrow> ereal (u ?n) < C

goal (1 subgoal):
 1. ereal (u n) < C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ereal (u n) < C

goal (1 subgoal):
 1. \<not> n \<le> N \<Longrightarrow> u n \<le> D
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ereal (u n) < C
[PROOF STEP]
have "u n < real_of_ereal C"
[PROOF STATE]
proof (prove)
using this:
ereal (u n) < C

goal (1 subgoal):
 1. u n < real_of_ereal C
[PROOF STEP]
using \<open>C = ereal(real_of_ereal C)\<close> less_ereal.simps(1)
[PROOF STATE]
proof (prove)
using this:
ereal (u n) < C
C = ereal (real_of_ereal C)
(ereal ?x < ereal ?y) = (?x < ?y)

goal (1 subgoal):
 1. u n < real_of_ereal C
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
u n < real_of_ereal C

goal (1 subgoal):
 1. \<not> n \<le> N \<Longrightarrow> u n \<le> D
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u n < real_of_ereal C
[PROOF STEP]
show "u n \<le> D"
[PROOF STATE]
proof (prove)
using this:
u n < real_of_ereal C

goal (1 subgoal):
 1. u n \<le> D
[PROOF STEP]
unfolding D_def
[PROOF STATE]
proof (prove)
using this:
u n < real_of_ereal C

goal (1 subgoal):
 1. u n \<le> max (real_of_ereal C) (Max {u n |n. n \<le> N})
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
u n \<le> D

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
u n \<le> D

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
u ?n \<le> D

goal (1 subgoal):
 1. \<exists>C. \<forall>n. u n \<le> C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u ?n \<le> D
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
u ?n \<le> D

goal (1 subgoal):
 1. \<exists>C. \<forall>n. u n \<le> C
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>C. \<forall>n. u n \<le> C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma P5_a: "x l\<rightarrow> y = 1 \<Longrightarrow> y l\<rightarrow> z = 1 \<Longrightarrow> x l\<rightarrow> z = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x l\<rightarrow> y = (1::'a); y l\<rightarrow> z = (1::'a)\<rbrakk> \<Longrightarrow> x l\<rightarrow> z = (1::'a)
[PROOF STEP]
apply (cut_tac a = x and b = y and c = z in W3a)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x l\<rightarrow> y = (1::'a); y l\<rightarrow> z = (1::'a); (x l\<rightarrow> y) l\<rightarrow> (y l\<rightarrow> z) r\<rightarrow> x l\<rightarrow> z = (1::'a)\<rbrakk> \<Longrightarrow> x l\<rightarrow> z = (1::'a)
[PROOF STEP]
by simp


[STATEMENT]
lemma dg_prod_2_ObjI'[dg_prod_cs_intros]:
  assumes "ab = [a, b]\<^sub>\<circ>" and "a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>" and "b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>"
  shows "ab \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ab \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Obj\<rparr>
[PROOF STEP]
using assms(2,3)
[PROOF STATE]
proof (prove)
using this:
a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. ab \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Obj\<rparr>
[PROOF STEP]
unfolding assms(1)
[PROOF STATE]
proof (prove)
using this:
a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. [a, b]\<^sub>\<circ> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>D\<^sub>G \<BB>)\<lparr>Obj\<rparr>
[PROOF STEP]
by (rule dg_prod_2_ObjI)


[STATEMENT]
lemma takeWhile_take_has_property_nth:
  "\<lbrakk> n < length (takeWhile P xs) \<rbrakk> \<Longrightarrow> P (xs ! n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < length (takeWhile P xs) \<Longrightarrow> P (xs ! n)
[PROOF STEP]
by (induct xs arbitrary: n; simp split: if_split_asm) (case_tac n, simp_all)


[STATEMENT]
lemma darcs_snds_count_ge2:
  "\<lbrakk>(t1,e1) \<in> fset xs; (t2,e2) \<in> fset xs; (t1,e1) \<noteq> (t2,e2); e1 = e2\<rbrakk>
    \<Longrightarrow> count (darcs_mset (Node r xs)) e2 \<ge> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(t1, e1) \<in> fset xs; (t2, e2) \<in> fset xs; (t1, e1) \<noteq> (t2, e2); e1 = e2\<rbrakk> \<Longrightarrow> 2 \<le> count (darcs_mset (Node r xs)) e2
[PROOF STEP]
using darcs_snds_count_ge2_aux
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?t1.0, ?e1.0) \<in> fset ?xs; (?t2.0, ?e2.0) \<in> fset ?xs; (?t1.0, ?e1.0) \<noteq> (?t2.0, ?e2.0); ?e1.0 = ?e2.0\<rbrakk> \<Longrightarrow> 2 \<le> count (\<Sum>(t, e)\<in>fset ?xs. {#e#}) ?e2.0

goal (1 subgoal):
 1. \<lbrakk>(t1, e1) \<in> fset xs; (t2, e2) \<in> fset xs; (t1, e1) \<noteq> (t2, e2); e1 = e2\<rbrakk> \<Longrightarrow> 2 \<le> count (darcs_mset (Node r xs)) e2
[PROOF STEP]
unfolding darcs_mset_alt
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?t1.0, ?e1.0) \<in> fset ?xs; (?t2.0, ?e2.0) \<in> fset ?xs; (?t1.0, ?e1.0) \<noteq> (?t2.0, ?e2.0); ?e1.0 = ?e2.0\<rbrakk> \<Longrightarrow> 2 \<le> count (\<Sum>(t, e)\<in>fset ?xs. {#e#}) ?e2.0

goal (1 subgoal):
 1. \<lbrakk>(t1, e1) \<in> fset xs; (t2, e2) \<in> fset xs; (t1, e1) \<noteq> (t2, e2); e1 = e2\<rbrakk> \<Longrightarrow> 2 \<le> count ((\<Sum>(t, e)\<in>fset xs. {#e#}) + (\<Sum>(t, e)\<in>fset xs. darcs_mset t)) e2
[PROOF STEP]
by fastforce


[STATEMENT]
lemma (in domain) ring_primeE:
  assumes "p \<in> carrier R" "ring_prime p"
  shows "p \<noteq> \<zero>" "prime (mult_of R) p" "prime R p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<noteq> \<zero> &&& prime (Ring_Divisibility.mult_of R) p &&& prime R p
[PROOF STEP]
using assms prime_eq_prime_mult
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier R
ring_prime p
?p \<in> carrier R \<Longrightarrow> prime R ?p = prime (Ring_Divisibility.mult_of R) ?p

goal (1 subgoal):
 1. p \<noteq> \<zero> &&& prime (Ring_Divisibility.mult_of R) p &&& prime R p
[PROOF STEP]
unfolding ring_prime_def
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier R
p \<noteq> \<zero> \<and> prime R p
?p \<in> carrier R \<Longrightarrow> prime R ?p = prime (Ring_Divisibility.mult_of R) ?p

goal (1 subgoal):
 1. p \<noteq> \<zero> &&& prime (Ring_Divisibility.mult_of R) p &&& prime R p
[PROOF STEP]
by auto


[STATEMENT]
lemma splitting_eq: "d \<in> D\<^sub>D \<Longrightarrow> Q d - R d = (id_blinfun - l *\<^sub>R \<P>\<^sub>1 (mk_dec_det d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d \<in> D\<^sub>D \<Longrightarrow> Q d - R d = id_blinfun - l *\<^sub>R \<P>\<^sub>1 (mk_dec_det d)
[PROOF STEP]
using is_splitting
[PROOF STATE]
proof (prove)
using this:
?d \<in> D\<^sub>D \<Longrightarrow> is_splitting_blin (id_blinfun - l *\<^sub>R \<P>\<^sub>1 (mk_dec_det ?d)) (Q ?d) (R ?d)

goal (1 subgoal):
 1. d \<in> D\<^sub>D \<Longrightarrow> Q d - R d = id_blinfun - l *\<^sub>R \<P>\<^sub>1 (mk_dec_det d)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma extend_inv: "bij h
      ==> extend (%(x,u::'c). inv h x) = project (%(x,u::'c). h x) UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij h \<Longrightarrow> extend (\<lambda>(x, u). inv h x) = project (\<lambda>(x, u). h x) UNIV
[PROOF STEP]
apply (frule bij_imp_bij_inv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bij h; bij (inv h)\<rbrakk> \<Longrightarrow> extend (\<lambda>(x, u). inv h x) = project (\<lambda>(x, u). h x) UNIV
[PROOF STEP]
apply (rule ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>bij h; bij (inv h)\<rbrakk> \<Longrightarrow> extend (\<lambda>(x, u). inv h x) x = project (\<lambda>(x, u). h x) UNIV x
[PROOF STEP]
apply (rule program_equalityI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>bij h; bij (inv h)\<rbrakk> \<Longrightarrow> Init (extend (\<lambda>(x, u). inv h x) x) = Init (project (\<lambda>(x, u). h x) UNIV x)
 2. \<And>x. \<lbrakk>bij h; bij (inv h)\<rbrakk> \<Longrightarrow> Acts (extend (\<lambda>(x, u). inv h x) x) = Acts (project (\<lambda>(x, u). h x) UNIV x)
 3. \<And>x. \<lbrakk>bij h; bij (inv h)\<rbrakk> \<Longrightarrow> AllowedActs (extend (\<lambda>(x, u). inv h x) x) = AllowedActs (project (\<lambda>(x, u). h x) UNIV x)
[PROOF STEP]
apply (simp (no_asm_simp) add: extend_set_inv)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>bij h; bij (inv h)\<rbrakk> \<Longrightarrow> Acts (extend (\<lambda>(x, u). inv h x) x) = Acts (project (\<lambda>(x, u). h x) UNIV x)
 2. \<And>x. \<lbrakk>bij h; bij (inv h)\<rbrakk> \<Longrightarrow> AllowedActs (extend (\<lambda>(x, u). inv h x) x) = AllowedActs (project (\<lambda>(x, u). h x) UNIV x)
[PROOF STEP]
apply (simp add: Extend.project_act_Id Extend.Acts_extend
          insert_Id_image_Acts bij_extend_act_eq_project_act inv_inv_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>bij h; bij (inv h)\<rbrakk> \<Longrightarrow> AllowedActs (extend (\<lambda>(x, u). inv h x) x) = AllowedActs (project (\<lambda>(x, u). h x) UNIV x)
[PROOF STEP]
apply (simp add: Extend.AllowedActs_extend Extend.AllowedActs_project
             bij_project_act bij_vimage_eq_inv_image bij_inv_project_act_eq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma remdups_wrt_append:
  "remdups_wrt f (xs @ ys) = (filter (\<lambda>a. f a \<notin> f ` set ys) (remdups_wrt f xs)) @ (remdups_wrt f ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. remdups_wrt f (xs @ ys) = filter (\<lambda>a. f a \<notin> f ` set ys) (remdups_wrt f xs) @ remdups_wrt f ys
[PROOF STEP]
by (induct xs, auto)


[STATEMENT]
lemma ideal_mult_right_in2:
  \<open>a \<in> ideal A \<Longrightarrow> b * a \<in> More_Modules.ideal A\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> More_Modules.ideal A \<Longrightarrow> b * a \<in> More_Modules.ideal A
[PROOF STEP]
by (metis ideal.span_scale)


[STATEMENT]
lemma subset_mset_zmsetE:
  assumes "M \<subset>#\<^sub>z N"
  obtains A B C where
    "M = zmset_of A + C" and "N = zmset_of B + C" and "A \<subset># B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A C B. \<lbrakk>M = zmset_of A + C; N = zmset_of B + C; A \<subset># B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis assms decompose_zmset_of2 subset_zmset.add_less_cancel_right zmset_of_subset_iff)


[STATEMENT]
lemma eval_wp_SetDC:
  "wp (SetDC p S) R s = Inf ((\<lambda>a. wp (p a) R s) ` S s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wp (SetDC p S) R s = (INF a\<in>S s. wp (p a) R s)
[PROOF STEP]
unfolding wp_def SetDC_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (INF a\<in>S s. p a True R s) = (INF a\<in>S s. p a True R s)
[PROOF STEP]
by(simp)


[STATEMENT]
lemma quat_trad: "Quat x y z w = of_real x + \<i> * of_real y + \<j> * of_real z + \<k> * of_real w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Quat x y z w = quat_of_real x + \<i> * quat_of_real y + \<j> * quat_of_real z + \<k> * quat_of_real w
[PROOF STEP]
by (simp add: quat_eq_iff)


[STATEMENT]
lemma bin_to_bl_aux_bintr:
  "bin_to_bl_aux n (take_bit m bin) bl =
    replicate (n - m) False @ bin_to_bl_aux (min n m) bin bl"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bin_to_bl_aux n (take_bit m bin) bl = replicate (n - m) False @ bin_to_bl_aux (min n m) bin bl
[PROOF STEP]
apply (induct n arbitrary: m bin bl)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>m bin bl. bin_to_bl_aux 0 (take_bit m bin) bl = replicate (0 - m) False @ bin_to_bl_aux (min 0 m) bin bl
 2. \<And>n m bin bl. (\<And>m bin bl. bin_to_bl_aux n (take_bit m bin) bl = replicate (n - m) False @ bin_to_bl_aux (min n m) bin bl) \<Longrightarrow> bin_to_bl_aux (Suc n) (take_bit m bin) bl = replicate (Suc n - m) False @ bin_to_bl_aux (min (Suc n) m) bin bl
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n m bin bl. (\<And>m bin bl. bin_to_bl_aux n (take_bit m bin) bl = replicate (n - m) False @ bin_to_bl_aux (min n m) bin bl) \<Longrightarrow> bin_to_bl_aux (Suc n) (take_bit m bin) bl = replicate (Suc n - m) False @ bin_to_bl_aux (min (Suc n) m) bin bl
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n m bin bl. (\<And>m bin bl. bin_to_bl_aux n (take_bit m bin) bl = replicate (n - m) False @ bin_to_bl_aux (min n m) bin bl) \<Longrightarrow> bin_to_bl_aux n (take_bit m bin div 2) ((0 < m \<and> odd bin) # bl) = replicate (Suc n - m) False @ bin_to_bl_aux (min (Suc n) m) bin bl
[PROOF STEP]
apply (case_tac "m")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n m bin bl. \<lbrakk>\<And>m bin bl. bin_to_bl_aux n (take_bit m bin) bl = replicate (n - m) False @ bin_to_bl_aux (min n m) bin bl; m = 0\<rbrakk> \<Longrightarrow> bin_to_bl_aux n (take_bit m bin div 2) ((0 < m \<and> odd bin) # bl) = replicate (Suc n - m) False @ bin_to_bl_aux (min (Suc n) m) bin bl
 2. \<And>n m bin bl nat. \<lbrakk>\<And>m bin bl. bin_to_bl_aux n (take_bit m bin) bl = replicate (n - m) False @ bin_to_bl_aux (min n m) bin bl; m = Suc nat\<rbrakk> \<Longrightarrow> bin_to_bl_aux n (take_bit m bin div 2) ((0 < m \<and> odd bin) # bl) = replicate (Suc n - m) False @ bin_to_bl_aux (min (Suc n) m) bin bl
[PROOF STEP]
apply (clarsimp simp: bin_to_bl_zero_aux)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. (\<And>m bin bl. bin_to_bl_aux n (take_bit m bin) bl = replicate (n - m) False @ bin_to_bl_aux (min n m) bin bl) \<Longrightarrow> replicate n False @ [False] = False # replicate n False
 2. \<And>n m bin bl nat. \<lbrakk>\<And>m bin bl. bin_to_bl_aux n (take_bit m bin) bl = replicate (n - m) False @ bin_to_bl_aux (min n m) bin bl; m = Suc nat\<rbrakk> \<Longrightarrow> bin_to_bl_aux n (take_bit m bin div 2) ((0 < m \<and> odd bin) # bl) = replicate (Suc n - m) False @ bin_to_bl_aux (min (Suc n) m) bin bl
[PROOF STEP]
apply (erule thin_rl)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. replicate n False @ [False] = False # replicate n False
 2. \<And>n m bin bl nat. \<lbrakk>\<And>m bin bl. bin_to_bl_aux n (take_bit m bin) bl = replicate (n - m) False @ bin_to_bl_aux (min n m) bin bl; m = Suc nat\<rbrakk> \<Longrightarrow> bin_to_bl_aux n (take_bit m bin div 2) ((0 < m \<and> odd bin) # bl) = replicate (Suc n - m) False @ bin_to_bl_aux (min (Suc n) m) bin bl
[PROOF STEP]
apply (induct_tac n)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>n. replicate 0 False @ [False] = False # replicate 0 False
 2. \<And>n na. replicate na False @ [False] = False # replicate na False \<Longrightarrow> replicate (Suc na) False @ [False] = False # replicate (Suc na) False
 3. \<And>n m bin bl nat. \<lbrakk>\<And>m bin bl. bin_to_bl_aux n (take_bit m bin) bl = replicate (n - m) False @ bin_to_bl_aux (min n m) bin bl; m = Suc nat\<rbrakk> \<Longrightarrow> bin_to_bl_aux n (take_bit m bin div 2) ((0 < m \<and> odd bin) # bl) = replicate (Suc n - m) False @ bin_to_bl_aux (min (Suc n) m) bin bl
[PROOF STEP]
apply (auto simp add: take_bit_Suc)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma closest_point_refl: "closed S \<Longrightarrow> S \<noteq> {} \<Longrightarrow> closest_point S x = x \<longleftrightarrow> x \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>closed S; S \<noteq> {}\<rbrakk> \<Longrightarrow> (closest_point S x = x) = (x \<in> S)
[PROOF STEP]
using closest_point_in_set[of S x] closest_point_self[of x S]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>closed S; S \<noteq> {}\<rbrakk> \<Longrightarrow> closest_point S x \<in> S
x \<in> S \<Longrightarrow> closest_point S x = x

goal (1 subgoal):
 1. \<lbrakk>closed S; S \<noteq> {}\<rbrakk> \<Longrightarrow> (closest_point S x = x) = (x \<in> S)
[PROOF STEP]
by auto


[STATEMENT]
lemma Always_tokens_giv_le_allocGiv: "System \<in> Always (INT i: lessThan Nclients.
                          {s. (tokens o giv o sub i o client) s
                           \<le> (tokens o sub i o allocGiv) s})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. System \<in> Always (\<Inter>i<Nclients. {s. (sum_list \<circ> giv \<circ> sub i \<circ> client) s \<le> (sum_list \<circ> sub i \<circ> allocGiv) s})
[PROOF STEP]
apply (rule Always_giv_le_allocGiv [THEN Always_weaken])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>i<Nclients. {s. (giv \<circ> sub i \<circ> client) s \<le> (sub i \<circ> allocGiv) s}) \<subseteq> (\<Inter>i<Nclients. {s. (sum_list \<circ> giv \<circ> sub i \<circ> client) s \<le> (sum_list \<circ> sub i \<circ> allocGiv) s})
[PROOF STEP]
apply (auto intro: tokens_mono_prefix simp add: o_apply)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma mult_vec_distrib_right: "(p + q) ** r = p ** r + q ** r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p + q) ** r = p ** r + q ** r
[PROOF STEP]
by (rule poly_mapping_eqI_proj, simp add: algebra_simps proj_plus term_simps)


[STATEMENT]
lemma ordinal_oLogI2:
"\<lbrakk>oSuc 0 < b; x = b ** y * q + r; 0 < q; q < b; r < b ** y\<rbrakk> \<Longrightarrow> oLog b x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>oSuc 0 < b; x = b ** y * q + r; 0 < q; q < b; r < b ** y\<rbrakk> \<Longrightarrow> oLog b x = y
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>oSuc 0 < b; x = b ** y * q + r; 0 < q; q < b; r < b ** y\<rbrakk> \<Longrightarrow> oLog b (b ** y * q + r) = y
[PROOF STEP]
apply (rule ordinal_oLogI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>oSuc 0 < b; x = b ** y * q + r; 0 < q; q < b; r < b ** y\<rbrakk> \<Longrightarrow> b ** y \<le> b ** y * q + r
 2. \<lbrakk>oSuc 0 < b; x = b ** y * q + r; 0 < q; q < b; r < b ** y\<rbrakk> \<Longrightarrow> b ** y * q + r < b ** y * b
[PROOF STEP]
apply (rule_tac y="b ** y * q" in order_trans, simp, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>oSuc 0 < b; x = b ** y * q + r; 0 < q; q < b; r < b ** y\<rbrakk> \<Longrightarrow> b ** y * q + r < b ** y * b
[PROOF STEP]
apply (rule order_less_le_trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>oSuc 0 < b; x = b ** y * q + r; 0 < q; q < b; r < b ** y\<rbrakk> \<Longrightarrow> b ** y * q + r < ?y5
 2. \<lbrakk>oSuc 0 < b; x = b ** y * q + r; 0 < q; q < b; r < b ** y\<rbrakk> \<Longrightarrow> ?y5 \<le> b ** y * b
[PROOF STEP]
apply (erule ordinal_plus_strict_monoR)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>oSuc 0 < b; x = b ** y * q + r; 0 < q; q < b; r < b ** y\<rbrakk> \<Longrightarrow> b ** y * q + b ** y \<le> b ** y * b
[PROOF STEP]
apply (subst ordinal_times_oSuc[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>oSuc 0 < b; x = b ** y * q + r; 0 < q; q < b; r < b ** y\<rbrakk> \<Longrightarrow> b ** y * oSuc q \<le> b ** y * b
[PROOF STEP]
apply (rule ordinal_times_monoR)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>oSuc 0 < b; x = b ** y * q + r; 0 < q; q < b; r < b ** y\<rbrakk> \<Longrightarrow> oSuc q \<le> b
[PROOF STEP]
apply (erule oSuc_leI)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma swap_UNIV: "{a,1-a} = binUNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a, 1 - a} = binUNIV
[PROOF STEP]
unfolding bin_UNIV_iff[of "{a,1-a}" a]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> {a, 1 - a} \<and> 1 - a \<in> {a, 1 - a}
[PROOF STEP]
by fast


[STATEMENT]
lemma strict_mono_setsD:
  assumes "strict_mono_sets A f" "x < y" "x \<in> A" "y \<in> A"
  shows "less_sets (f x) (f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x \<lless> f y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
strict_mono_sets A f
x < y
x \<in> A
y \<in> A

goal (1 subgoal):
 1. f x \<lless> f y
[PROOF STEP]
by (auto simp: strict_mono_sets_def)


[STATEMENT]
lemma ntcf_const_is_ntcf'[cat_cs_intros]:
  assumes "category \<alpha> \<JJ>"
    and "category \<alpha> \<CC>"
    and "f : a \<mapsto>\<^bsub>\<CC>\<^esub> b"
    and "\<AA> = cf_const \<JJ> \<CC> a"
    and "\<BB> = cf_const \<JJ> \<CC> b"
    and "\<JJ>' = \<JJ>"
    and "\<CC>' = \<CC>"
  shows "ntcf_const \<JJ> \<CC> f : \<AA> \<mapsto>\<^sub>C\<^sub>F \<BB> : \<JJ>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ntcf_const \<JJ> \<CC> f : \<AA> \<mapsto>\<^sub>C\<^sub>F \<BB> : \<JJ>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>'
[PROOF STEP]
using assms(1-3)
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<JJ>
category \<alpha> \<CC>
f : a \<mapsto>\<^bsub>\<CC>\<^esub> b

goal (1 subgoal):
 1. ntcf_const \<JJ> \<CC> f : \<AA> \<mapsto>\<^sub>C\<^sub>F \<BB> : \<JJ>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>'
[PROOF STEP]
unfolding assms(4-7)
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<JJ>
category \<alpha> \<CC>
f : a \<mapsto>\<^bsub>\<CC>\<^esub> b

goal (1 subgoal):
 1. ntcf_const \<JJ> \<CC> f : dghm_const \<JJ> \<CC> a (\<CC>\<lparr>CId\<rparr>\<lparr>a\<rparr>) \<mapsto>\<^sub>C\<^sub>F dghm_const \<JJ> \<CC> b (\<CC>\<lparr>CId\<rparr>\<lparr>b\<rparr>) : \<JJ> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
[PROOF STEP]
by (rule ntcf_const_is_ntcf)


[STATEMENT]
lemma iEx_cong: "\<box> t I. f t = g t \<Longrightarrow> (\<diamond> t I. P (f t) t) = (\<diamond> t I. P (g t) t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<box> t I. f t = g t \<Longrightarrow> (\<diamond> t I. P (f t) t) = (\<diamond> t I. P (g t) t)
[PROOF STEP]
unfolding iTL_defs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>t\<in>I. f t = g t \<Longrightarrow> (\<exists>t\<in>I. P (f t) t) = (\<exists>t\<in>I. P (g t) t)
[PROOF STEP]
by simp


[STATEMENT]
lemma ln2_ge_two_thirds: "2/3 \<le> ln (2::real)"
  and ln2_le_25_over_36: "ln (2::real) \<le> 25/36"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 / 3 \<le> ln 2 &&& ln 2 \<le> 25 / 36
[PROOF STEP]
using ln_approx_bounds[of 2 1, simplified, simplified eval_nat_numeral, simplified]
[PROOF STATE]
proof (prove)
using this:
2 \<le> ln 2 * 3 \<and> ln 2 * 36 \<le> 25

goal (1 subgoal):
 1. 2 / 3 \<le> ln 2 &&& ln 2 \<le> 25 / 36
[PROOF STEP]
by simp_all


[STATEMENT]
lemma poly_card_roots_less_less:
  "card {x. a < x \<and> x < b \<and> poly p x = 0} =
      ( count_roots_between p a b -
              (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
proof (cases "poly p b = 0 \<and> a < b \<and> p \<noteq> 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. poly p b = 0 \<and> a < b \<and> p \<noteq> 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
 2. \<not> (poly p b = 0 \<and> a < b \<and> p \<noteq> 0) \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (poly p b = 0 \<and> a < b \<and> p \<noteq> 0)

goal (2 subgoals):
 1. poly p b = 0 \<and> a < b \<and> p \<noteq> 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
 2. \<not> (poly p b = 0 \<and> a < b \<and> p \<noteq> 0) \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
note False' = this
[PROOF STATE]
proof (state)
this:
\<not> (poly p b = 0 \<and> a < b \<and> p \<noteq> 0)

goal (2 subgoals):
 1. poly p b = 0 \<and> a < b \<and> p \<noteq> 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
 2. \<not> (poly p b = 0 \<and> a < b \<and> p \<noteq> 0) \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
proof (cases "p = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
 2. p \<noteq> 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p = 0

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
 2. p \<noteq> 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
have [simp]: "{x. a < x \<and> x < b} = {a<..<b}"
                     "{x. a < x \<and> x \<le> b} = {a<..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. a < x \<and> x < b} = {a<..<b} &&& {x. a < x \<and> x \<le> b} = {a<..b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x. a < x \<and> x < b} = {a<..<b}
{x. a < x \<and> x \<le> b} = {a<..b}

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
 2. p \<noteq> 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
with True False
[PROOF STATE]
proof (chain)
picking this:
p = 0
\<not> (poly p b = 0 \<and> a < b \<and> p \<noteq> 0)
{x. a < x \<and> x < b} = {a<..<b}
{x. a < x \<and> x \<le> b} = {a<..b}
[PROOF STEP]
have "card {x. a < x \<and> x \<le> b} = 0" "card {x. a < x \<and> x < b} = 0"
[PROOF STATE]
proof (prove)
using this:
p = 0
\<not> (poly p b = 0 \<and> a < b \<and> p \<noteq> 0)
{x. a < x \<and> x < b} = {a<..<b}
{x. a < x \<and> x \<le> b} = {a<..b}

goal (1 subgoal):
 1. card {x. a < x \<and> x \<le> b} = 0 &&& card {x. a < x \<and> x < b} = 0
[PROOF STEP]
by (auto simp add: card_eq_0_iff infinite_Ioo infinite_Ioc)
[PROOF STATE]
proof (state)
this:
card {x. a < x \<and> x \<le> b} = 0
card {x. a < x \<and> x < b} = 0

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
 2. p \<noteq> 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
with True False'
[PROOF STATE]
proof (chain)
picking this:
p = 0
\<not> (poly p b = 0 \<and> a < b \<and> p \<noteq> 0)
card {x. a < x \<and> x \<le> b} = 0
card {x. a < x \<and> x < b} = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p = 0
\<not> (poly p b = 0 \<and> a < b \<and> p \<noteq> 0)
card {x. a < x \<and> x \<le> b} = 0
card {x. a < x \<and> x < b} = 0

goal (1 subgoal):
 1. card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
by (auto simp: count_roots_between_correct)
[PROOF STATE]
proof (state)
this:
card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
with False'
[PROOF STATE]
proof (chain)
picking this:
\<not> (poly p b = 0 \<and> a < b \<and> p \<noteq> 0)
p \<noteq> 0
[PROOF STEP]
have "{x. a < x \<and> x < b \<and> poly p x = 0} =
                          {x. a < x \<and> x \<le> b \<and> poly p x = 0}"
[PROOF STATE]
proof (prove)
using this:
\<not> (poly p b = 0 \<and> a < b \<and> p \<noteq> 0)
p \<noteq> 0

goal (1 subgoal):
 1. {x. a < x \<and> x < b \<and> poly p x = 0} = {x. a < x \<and> x \<le> b \<and> poly p x = 0}
[PROOF STEP]
by (auto simp: less_eq_real_def)
[PROOF STATE]
proof (state)
this:
{x. a < x \<and> x < b \<and> poly p x = 0} = {x. a < x \<and> x \<le> b \<and> poly p x = 0}

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
{x. a < x \<and> x < b \<and> poly p x = 0} = {x. a < x \<and> x \<le> b \<and> poly p x = 0}

goal (1 subgoal):
 1. card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
using poly_card_roots_less_leq False
[PROOF STATE]
proof (prove)
using this:
{x. a < x \<and> x < b \<and> poly p x = 0} = {x. a < x \<and> x \<le> b \<and> poly p x = 0}
card {x. ?a < x \<and> x \<le> ?b \<and> poly ?p x = 0} = count_roots_between ?p ?a ?b
p \<noteq> 0

goal (1 subgoal):
 1. card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)

goal (1 subgoal):
 1. poly p b = 0 \<and> a < b \<and> p \<noteq> 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly p b = 0 \<and> a < b \<and> p \<noteq> 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
poly p b = 0 \<and> a < b \<and> p \<noteq> 0

goal (1 subgoal):
 1. poly p b = 0 \<and> a < b \<and> p \<noteq> 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
with poly_roots_finite
[PROOF STATE]
proof (chain)
picking this:
?p \<noteq> 0 \<Longrightarrow> finite {x. poly ?p x = (0::?'a)}
poly p b = 0 \<and> a < b \<and> p \<noteq> 0
[PROOF STEP]
have fin: "finite {x. a < x \<and> x < b \<and> poly p x = 0}"
[PROOF STATE]
proof (prove)
using this:
?p \<noteq> 0 \<Longrightarrow> finite {x. poly ?p x = (0::?'a)}
poly p b = 0 \<and> a < b \<and> p \<noteq> 0

goal (1 subgoal):
 1. finite {x. a < x \<and> x < b \<and> poly p x = 0}
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
finite {x. a < x \<and> x < b \<and> poly p x = 0}

goal (1 subgoal):
 1. poly p b = 0 \<and> a < b \<and> p \<noteq> 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
from True
[PROOF STATE]
proof (chain)
picking this:
poly p b = 0 \<and> a < b \<and> p \<noteq> 0
[PROOF STEP]
have "{x. a < x \<and> x \<le> b \<and> poly p x = 0} =
        insert b {x. a < x \<and> x < b \<and> poly p x = 0}"
[PROOF STATE]
proof (prove)
using this:
poly p b = 0 \<and> a < b \<and> p \<noteq> 0

goal (1 subgoal):
 1. {x. a < x \<and> x \<le> b \<and> poly p x = 0} = insert b {x. a < x \<and> x < b \<and> poly p x = 0}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x. a < x \<and> x \<le> b \<and> poly p x = 0} = insert b {x. a < x \<and> x < b \<and> poly p x = 0}

goal (1 subgoal):
 1. poly p b = 0 \<and> a < b \<and> p \<noteq> 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
hence "Suc (card {x. a < x \<and> x < b \<and> poly p x = 0}) =
           card {x. a < x \<and> x \<le> b \<and> poly p x = 0}"
[PROOF STATE]
proof (prove)
using this:
{x. a < x \<and> x \<le> b \<and> poly p x = 0} = insert b {x. a < x \<and> x < b \<and> poly p x = 0}

goal (1 subgoal):
 1. Suc (card {x. a < x \<and> x < b \<and> poly p x = 0}) = card {x. a < x \<and> x \<le> b \<and> poly p x = 0}
[PROOF STEP]
using fin
[PROOF STATE]
proof (prove)
using this:
{x. a < x \<and> x \<le> b \<and> poly p x = 0} = insert b {x. a < x \<and> x < b \<and> poly p x = 0}
finite {x. a < x \<and> x < b \<and> poly p x = 0}

goal (1 subgoal):
 1. Suc (card {x. a < x \<and> x < b \<and> poly p x = 0}) = card {x. a < x \<and> x \<le> b \<and> poly p x = 0}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
Suc (card {x. a < x \<and> x < b \<and> poly p x = 0}) = card {x. a < x \<and> x \<le> b \<and> poly p x = 0}

goal (1 subgoal):
 1. poly p b = 0 \<and> a < b \<and> p \<noteq> 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Suc (card {x. a < x \<and> x < b \<and> poly p x = 0}) = card {x. a < x \<and> x \<le> b \<and> poly p x = 0}

goal (1 subgoal):
 1. poly p b = 0 \<and> a < b \<and> p \<noteq> 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
note count_roots_between_correct[symmetric]
[PROOF STATE]
proof (state)
this:
card {x. ?a < x \<and> x \<le> ?b \<and> poly ?p x = 0} = count_roots_between ?p ?a ?b

goal (1 subgoal):
 1. poly p b = 0 \<and> a < b \<and> p \<noteq> 0 \<Longrightarrow> card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Suc (card {x. a < x \<and> x < b \<and> poly p x = 0}) = count_roots_between p a b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Suc (card {x. a < x \<and> x < b \<and> poly p x = 0}) = count_roots_between p a b

goal (1 subgoal):
 1. card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
Suc (card {x. a < x \<and> x < b \<and> poly p x = 0}) = count_roots_between p a b
poly p b = 0 \<and> a < b \<and> p \<noteq> 0

goal (1 subgoal):
 1. card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {x. a < x \<and> x < b \<and> poly p x = 0} = count_roots_between p a b - (if poly p b = 0 \<and> a < b \<and> p \<noteq> 0 then 1 else 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma in_proj_in_GSMP: "t \<in> GSMP (trms_proj\<^sub>l\<^sub>s\<^sub>t n A) \<Longrightarrow> t \<in> GSMP (trms\<^sub>l\<^sub>s\<^sub>t A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> GSMP (trms\<^sub>l\<^sub>s\<^sub>t (proj n A)) \<Longrightarrow> t \<in> GSMP (trms\<^sub>l\<^sub>s\<^sub>t A)
[PROOF STEP]
using GSMP_Union[of A]
[PROOF STATE]
proof (prove)
using this:
GSMP (trms\<^sub>l\<^sub>s\<^sub>t A) = (\<Union>l. GSMP (trms\<^sub>l\<^sub>s\<^sub>t (proj l A)))

goal (1 subgoal):
 1. t \<in> GSMP (trms\<^sub>l\<^sub>s\<^sub>t (proj n A)) \<Longrightarrow> t \<in> GSMP (trms\<^sub>l\<^sub>s\<^sub>t A)
[PROOF STEP]
by blast


[STATEMENT]
lemma gbinomial_0_left: "0 gchoose k = (if k = 0 then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) gchoose k = (if k = 0 then 1::'a else (0::'a))
[PROOF STEP]
by (cases k) simp_all


[STATEMENT]
lemma gcd_ge_0_int [simp]: "gcd (x::int) y >= 0"
  for x y :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> gcd x y
[PROOF STEP]
by (simp add: gcd_int_def)


[STATEMENT]
theorem JF1map_id: "JF1map id = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. JF1map id = id
[PROOF STEP]
apply (rule trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. JF1map id = ?s
 2. ?s = id
[PROOF STEP]
apply (rule conjunct1)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. JF1map id = ?s \<and> ?Q3
 2. ?s = id
[PROOF STEP]
apply (rule unfold_unique)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. F1map id (JF1map id) ?f2.5 \<circ> ?s1.5 = dtor1 \<circ> JF1map id
 2. F2map id (JF1map id) ?f2.5 \<circ> ?s2.5 = dtor2 \<circ> ?f2.5
 3. unfold1 ?s1.5 ?s2.5 = id
[PROOF STEP]
apply (rule sym[OF JF1map])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. F2map id (JF1map id) (JF2map id) \<circ> ?s2.5 = dtor2 \<circ> JF2map id
 2. unfold1 dtor1 ?s2.5 = id
[PROOF STEP]
apply (rule sym[OF JF2map])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unfold1 dtor1 dtor2 = id
[PROOF STEP]
apply (rule unfold1_dtor)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma leadsTo_Union_distrib:
     "F \<in> (\<Union>S) leadsTo B  =  (\<forall>A \<in> S. F \<in> A leadsTo B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F \<in> \<Union> S \<longmapsto> B) = (\<forall>A\<in>S. F \<in> A \<longmapsto> B)
[PROOF STEP]
by (blast intro: leadsTo_Union leadsTo_weaken_L)


[STATEMENT]
lemma classes_changed_cons_eq:
 "classes_changed (t # P) P' = (classes_changed P P' - {fst t})
                     \<union> (if class_changed [t] P' (fst t) then {fst t} else {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. classes_changed (t # P) P' = classes_changed P P' - {fst t} \<union> (if class_changed [t] P' (fst t) then {fst t} else {})
[PROOF STEP]
by (auto simp: classes_changed_def class_changed_def class_def)


[STATEMENT]
lemma diff_invariant_nleq_rule:
  fixes \<mu>::"'a::banach \<Rightarrow> real"
  shows "diff_invariant (\<lambda>s. \<not> \<nu> s \<le> \<mu> s) f U S t\<^sub>0 G \<longleftrightarrow> diff_invariant (\<lambda>s. \<nu> s > \<mu> s) f U S t\<^sub>0 G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diff_invariant (\<lambda>s. \<not> \<nu> s \<le> \<mu> s) f U S t\<^sub>0 G = diff_invariant (\<lambda>s. \<mu> s < \<nu> s) f U S t\<^sub>0 G
[PROOF STEP]
unfolding diff_invariant_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>s. \<not> \<nu> s \<le> \<mu> s \<longrightarrow> (\<forall>X\<in>Sols f U S t\<^sub>0 s. \<forall>t\<in>U s. (\<forall>\<tau>\<in>down (U s) t. G (X \<tau>)) \<longrightarrow> \<not> \<nu> (X t) \<le> \<mu> (X t))) = (\<forall>s. \<mu> s < \<nu> s \<longrightarrow> (\<forall>X\<in>Sols f U S t\<^sub>0 s. \<forall>t\<in>U s. (\<forall>\<tau>\<in>down (U s) t. G (X \<tau>)) \<longrightarrow> \<mu> (X t) < \<nu> (X t)))
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>s X t. \<lbrakk>\<forall>s. \<not> \<nu> s \<le> \<mu> s \<longrightarrow> (\<forall>X\<in>Sols f U S t\<^sub>0 s. \<forall>t\<in>U s. (\<forall>\<tau>\<in>down (U s) t. G (X \<tau>)) \<longrightarrow> \<not> \<nu> (X t) \<le> \<mu> (X t)); \<mu> s < \<nu> s; X \<in> Sols f U S t\<^sub>0 s; t \<in> U s; \<forall>\<tau>\<in>down (U s) t. G (X \<tau>)\<rbrakk> \<Longrightarrow> \<mu> (X t) < \<nu> (X t)
 2. \<And>s X t. \<lbrakk>\<forall>s. \<mu> s < \<nu> s \<longrightarrow> (\<forall>X\<in>Sols f U S t\<^sub>0 s. \<forall>t\<in>U s. (\<forall>\<tau>\<in>down (U s) t. G (X \<tau>)) \<longrightarrow> \<mu> (X t) < \<nu> (X t)); \<not> \<nu> s \<le> \<mu> s; X \<in> Sols f U S t\<^sub>0 s; t \<in> U s; \<forall>\<tau>\<in>down (U s) t. G (X \<tau>); \<nu> (X t) \<le> \<mu> (X t)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (clarsimp, erule_tac x=s in allE, simp, erule_tac x=X in ballE, force, force)+


[STATEMENT]
lemma N_pos[simp]: "N > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < N
[PROOF STEP]
using N_g1 neq0_conv
[PROOF STATE]
proof (prove)
using this:
1 < N
(?n \<noteq> 0) = (0 < ?n)

goal (1 subgoal):
 1. 0 < N
[PROOF STEP]
by blast


[STATEMENT]
lemma face_of_polytope_insert:
     "\<lbrakk>polytope S; a \<notin> affine hull S; F face_of S\<rbrakk> \<Longrightarrow> F face_of convex hull (insert a S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>polytope S; a \<notin> affine hull S; F face_of S\<rbrakk> \<Longrightarrow> F face_of convex hull insert a S
[PROOF STEP]
by (metis (no_types, lifting) affine_hull_convex_hull face_of_convex_hull_insert hull_insert polytope_def)


[STATEMENT]
lemma ordinal_plus_strict_monoR: "y < y' \<Longrightarrow> x + y < x + (y'::ordinal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y < y' \<Longrightarrow> x + y < x + y'
[PROOF STEP]
by (rule normal.strict_monoD[OF normal_plus])


[STATEMENT]
lemma Some_add2:
  "(Some x ++ y = Some z) = (\<exists>y'. y = Some y' \<and> x \<oplus> y' = Some z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Some x ++ y = Some z) = (\<exists>y'. y = Some y' \<and> x \<oplus> y' = Some z)
[PROOF STEP]
by (simp add: lift2_def split: option.splits)


[STATEMENT]
lemma fv_regex_alt: "safe_regex m g r \<Longrightarrow> Formula.fv_regex r = (\<Union>\<phi> \<in> atms r. Formula.fv \<phi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. safe_regex m g r \<Longrightarrow> fv_regex r = \<Union> (fv ` atms r)
[PROOF STEP]
unfolding fv_regex_alt atms_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. safe_regex m g r \<Longrightarrow> \<Union> (fv ` regex.atms r) = \<Union> (fv ` (\<Union>\<phi>\<in>regex.atms r. if safe_formula \<phi> then {\<phi>} else case \<phi> of formula.Neg \<phi>' \<Rightarrow> {\<phi>'} | _ \<Rightarrow> {}))
[PROOF STEP]
by (auto 0 3 dest: safe_regex_safe_formula)


[STATEMENT]
lemma expands_to_ln_aux_1:
  assumes e: "e = 1"
  assumes basis: "basis_wf (b # basis)"
  assumes L1: "((\<lambda>x. ln (g x)) expands_to L1) basis"
  assumes L2: "((\<lambda>x. ln (b x)) expands_to L2) basis"
  shows "((\<lambda>x. ln (g x) + e * ln (b x)) expands_to L1 + L2) basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. ln (g x) + e * ln (b x)) expands_to L1 + L2) basis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
e = 1
basis_wf (b # basis)
((\<lambda>x. ln (g x)) expands_to L1) basis
((\<lambda>x. ln (b x)) expands_to L2) basis

goal (1 subgoal):
 1. ((\<lambda>x. ln (g x) + e * ln (b x)) expands_to L1 + L2) basis
[PROOF STEP]
by (intro expands_to_add) (simp_all add: basis_wf_Cons)


[STATEMENT]
lemma of_rat_add: "of_rat (a + b) = of_rat a + of_rat b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_rat (a + b) = of_rat a + of_rat b
[PROOF STEP]
by transfer (simp add: add_frac_eq)


[STATEMENT]
lemma lm057:
  assumes "a \<in> allocationsUniverse" "Domain a \<subseteq> N" "\<Union>(Range a) = G"
  shows   "a \<in> allAllocations N G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> allAllocations N G
[PROOF STEP]
using assms posssibleAllocationsRelCharacterization lm040
[PROOF STATE]
proof (prove)
using this:
a \<in> allocationsUniverse
Domain a \<subseteq> N
\<Union> (Range a) = G
(?a \<in> allAllocations ?N ?G) = (?a \<in> injectionsUniverse \<and> Domain ?a \<subseteq> ?N \<and> Range ?a \<in> all_partitions ?G)
?a \<in> allocationsUniverse \<Longrightarrow> ?a \<in> allAllocations (Domain ?a) (\<Union> (Range ?a))

goal (1 subgoal):
 1. a \<in> allAllocations N G
[PROOF STEP]
by (metis (mono_tags, lifting))


[STATEMENT]
lemma trms_of_deg_leq_id:
  assumes "f \<in> carrier P"
  shows "f \<ominus>\<^bsub>P\<^esub> (trms_of_deg_leq k f) = shift (Suc k) f \<otimes>\<^bsub>P\<^esub> monom P \<one> (Suc k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<ominus>\<^bsub>P\<^esub> trms_of_deg_leq k f = shift (Suc k) f \<otimes>\<^bsub>P\<^esub> monom P \<one> (Suc k)
[PROOF STEP]
unfolding trms_of_deg_leq_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<ominus>\<^bsub>P\<^esub> (f \<ominus>\<^bsub>UP R\<^esub> shift (Suc k) f \<otimes>\<^bsub>UP R\<^esub> monom P \<one> (Suc k)) = shift (Suc k) f \<otimes>\<^bsub>P\<^esub> monom P \<one> (Suc k)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier P

goal (1 subgoal):
 1. f \<ominus>\<^bsub>P\<^esub> (f \<ominus>\<^bsub>UP R\<^esub> shift (Suc k) f \<otimes>\<^bsub>UP R\<^esub> monom P \<one> (Suc k)) = shift (Suc k) f \<otimes>\<^bsub>P\<^esub> monom P \<one> (Suc k)
[PROOF STEP]
by (smt P.add.inv_closed P.l_zero P.m_closed P.minus_add P.minus_minus P.r_neg
      P_def R.one_closed UP_a_assoc a_minus_def monom_closed shift_closed)


[STATEMENT]
lemma mod_ring_mult64: "(mod_ring_rel64 ===> mod_ring_rel64 ===> mod_ring_rel64) (mult_p64 pp) ((*))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mod_ring_rel64 ===> mod_ring_rel64 ===> mod_ring_rel64) (mult_p64 pp) (*)
[PROOF STEP]
using urel64_mult mod_ring_mult
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>urel64 ?x ?y; urel64 ?x' ?y'\<rbrakk> \<Longrightarrow> urel64 (mult_p64 pp ?x ?x') (mult_p p ?y ?y')
(mod_ring_rel ===> mod_ring_rel ===> mod_ring_rel) (mult_p p) (*)

goal (1 subgoal):
 1. (mod_ring_rel64 ===> mod_ring_rel64 ===> mod_ring_rel64) (mult_p64 pp) (*)
[PROOF STEP]
unfolding mod_ring_rel64_def rel_fun_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>urel64 ?x ?y; urel64 ?x' ?y'\<rbrakk> \<Longrightarrow> urel64 (mult_p64 pp ?x ?x') (mult_p p ?y ?y')
\<forall>x y. mod_ring_rel x y \<longrightarrow> (\<forall>xa ya. mod_ring_rel xa ya \<longrightarrow> mod_ring_rel (mult_p p x xa) (y * ya))

goal (1 subgoal):
 1. \<forall>x y. (\<exists>z. urel64 x z \<and> mod_ring_rel z y) \<longrightarrow> (\<forall>xa ya. (\<exists>z. urel64 xa z \<and> mod_ring_rel z ya) \<longrightarrow> (\<exists>z. urel64 (mult_p64 pp x xa) z \<and> mod_ring_rel z (y * ya)))
[PROOF STEP]
by blast


[STATEMENT]
lemma ts_ord_add_isor: "n x \<sqsubseteq> n y \<Longrightarrow> n x \<oplus> n z \<sqsubseteq> n y \<oplus> n z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n x \<sqsubseteq> n y \<Longrightarrow> n x \<oplus> n z \<sqsubseteq> n y \<oplus> n z
[PROOF STEP]
using n_add_op_def n_comm ts_ord_add_isol
[PROOF STATE]
proof (prove)
using this:
?x \<oplus> ?y \<equiv> n (n ?x \<cdot> n ?y)
n ?x \<cdot> n ?y = n ?y \<cdot> n ?x
n ?x \<sqsubseteq> n ?y \<Longrightarrow> n ?z \<oplus> n ?x \<sqsubseteq> n ?z \<oplus> n ?y

goal (1 subgoal):
 1. n x \<sqsubseteq> n y \<Longrightarrow> n x \<oplus> n z \<sqsubseteq> n y \<oplus> n z
[PROOF STEP]
by presburger


[STATEMENT]
theorem complete:
  assumes finite_cs: "finite Cs" "\<forall>C\<in>Cs. finite C"
  assumes unsat: "\<forall>(F::hterm fun_denot) (G::hterm pred_denot) . \<not>eval\<^sub>c\<^sub>s F G Cs"
  shows "\<exists>Cs'. resolution_deriv Cs Cs' \<and> {} \<in> Cs'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>Cs'. resolution_deriv Cs Cs' \<and> {} \<in> Cs'
[PROOF STEP]
using assms completeness
[PROOF STATE]
proof (prove)
using this:
finite Cs
\<forall>C\<in>Cs. finite C
\<forall>F G. \<not> eval\<^sub>c\<^sub>s F G Cs
\<lbrakk>finite ?Cs; \<forall>C\<in>?Cs. finite C; \<forall>F G. \<not> eval\<^sub>c\<^sub>s F G ?Cs\<rbrakk> \<Longrightarrow> \<exists>Cs'. resolution_deriv ?Cs Cs' \<and> {} \<in> Cs'

goal (1 subgoal):
 1. \<exists>Cs'. resolution_deriv Cs Cs' \<and> {} \<in> Cs'
[PROOF STEP]
by -


[STATEMENT]
lemma ahm_map_rel_def: "\<langle>Rk,Rv\<rangle> ahm_map_rel \<equiv>
{(HashMap a n, HashMap a' n)| a a' n n'.
         (a,a') \<in> \<langle>\<langle>\<langle>Rk,Rv\<rangle>prod_rel\<rangle>list_rel\<rangle>array_rel \<and> (n,n') \<in> Id}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>Rk, Rv\<rangle>ahm_map_rel \<equiv> {uu_. \<exists>a a' n n'. uu_ = (HashMap a n, HashMap a' n) \<and> (a, a') \<in> \<langle>\<langle>Rk \<times>\<^sub>r Rv\<rangle>list_rel\<rangle>array_rel \<and> (n, n') \<in> nat_rel}
[PROOF STEP]
unfolding relAPP_def ahm_map_rel_def_internal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {uu_. \<exists>a a' n n'. uu_ = (HashMap a n, HashMap a' n) \<and> (a, a') \<in> array_rel (list_rel (prod_rel Rk Rv)) \<and> (n, n') \<in> nat_rel} \<equiv> {uu_. \<exists>a a' n n'. uu_ = (HashMap a n, HashMap a' n) \<and> (a, a') \<in> array_rel (list_rel (prod_rel Rk Rv)) \<and> (n, n') \<in> nat_rel}
[PROOF STEP]
.


[STATEMENT]
lemma kernel_upper_triangular: assumes A: "A \<in> carrier_mat n n"
  and ut: "upper_triangular A" and 0: "0 \<notin> set (diag_mat A)"
  shows "kernel.dim n A = 0" "kernel.basis n A {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0 &&& vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
define ma where "ma = diag_mat A"
[PROOF STATE]
proof (state)
this:
ma = diag_mat A

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
from det_upper_triangular[OF ut A]
[PROOF STATE]
proof (chain)
picking this:
det A = prod_list (diag_mat A)
[PROOF STEP]
have "det A = prod_list (diag_mat A)"
[PROOF STATE]
proof (prove)
using this:
det A = prod_list (diag_mat A)

goal (1 subgoal):
 1. det A = prod_list (diag_mat A)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
det A = prod_list (diag_mat A)

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det A = prod_list (diag_mat A)

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
have "\<dots> \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (diag_mat A) \<noteq> (0::'a)
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<notin> set (diag_mat A)

goal (1 subgoal):
 1. prod_list (diag_mat A) \<noteq> (0::'a)
[PROOF STEP]
unfolding ma_def[symmetric]
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<notin> set ma

goal (1 subgoal):
 1. prod_list ma \<noteq> (0::'a)
[PROOF STEP]
by (induct ma, auto)
[PROOF STATE]
proof (state)
this:
prod_list (diag_mat A) \<noteq> (0::'a)

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det A \<noteq> (0::'a)
[PROOF STEP]
have "det A \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
det A \<noteq> (0::'a)

goal (1 subgoal):
 1. det A \<noteq> (0::'a)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
det A \<noteq> (0::'a)

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
from det_non_zero_imp_unit[OF A this, unfolded Units_def, of "()"]
[PROOF STATE]
proof (chain)
picking this:
A \<in> {y \<in> carrier (ring_mat TYPE('a) n ()). \<exists>x\<in>carrier (ring_mat TYPE('a) n ()). x \<otimes>\<^bsub>ring_mat TYPE('a) n ()\<^esub> y = \<one>\<^bsub>ring_mat TYPE('a) n ()\<^esub> \<and> y \<otimes>\<^bsub>ring_mat TYPE('a) n ()\<^esub> x = \<one>\<^bsub>ring_mat TYPE('a) n ()\<^esub>}
[PROOF STEP]
obtain B where B: "B \<in> carrier_mat n n" and BA: "B * A = 1\<^sub>m n" and AB: "A * B = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
using this:
A \<in> {y \<in> carrier (ring_mat TYPE('a) n ()). \<exists>x\<in>carrier (ring_mat TYPE('a) n ()). x \<otimes>\<^bsub>ring_mat TYPE('a) n ()\<^esub> y = \<one>\<^bsub>ring_mat TYPE('a) n ()\<^esub> \<and> y \<otimes>\<^bsub>ring_mat TYPE('a) n ()\<^esub> x = \<one>\<^bsub>ring_mat TYPE('a) n ()\<^esub>}

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>B \<in> carrier_mat n n; B * A = 1\<^sub>m n; A * B = 1\<^sub>m n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: ring_mat_def)
[PROOF STATE]
proof (state)
this:
B \<in> carrier_mat n n
B * A = 1\<^sub>m n
A * B = 1\<^sub>m n

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
from mat_kernel_mult_eq[OF A B A AB, unfolded BA]
[PROOF STATE]
proof (chain)
picking this:
mat_kernel (1\<^sub>m n) = mat_kernel A
[PROOF STEP]
have id: "mat_kernel A = mat_kernel (1\<^sub>m n)"
[PROOF STATE]
proof (prove)
using this:
mat_kernel (1\<^sub>m n) = mat_kernel A

goal (1 subgoal):
 1. mat_kernel A = mat_kernel (1\<^sub>m n)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
mat_kernel A = mat_kernel (1\<^sub>m n)

goal (2 subgoals):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
 2. vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
show "kernel.dim n A = 0" "kernel.basis n A {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0 &&& vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (1\<^sub>m n)\<rparr>) = 0 &&& vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel (1\<^sub>m n)\<rparr>) {}
[PROOF STEP]
by (rule kernel_one_mat)+
[PROOF STATE]
proof (state)
this:
vectorspace.dim class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) = 0
vectorspace.basis class_ring (module_vec TYPE('a) n\<lparr>carrier := mat_kernel A\<rparr>) {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fpxs_const_mult [simp]:
  fixes x y :: "'a::{comm_semiring_1}"
  shows "fpxs_const (x * y) = fpxs_const x * fpxs_const y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fpxs_const (x * y) = fpxs_const x * fpxs_const y
[PROOF STEP]
unfolding fpxs_const_altdef fls_const_mult_const[symmetric] fpxs_of_fls_mult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fpxs_of_fls (fls_const x) * fpxs_of_fls (fls_const y) = fpxs_of_fls (fls_const x) * fpxs_of_fls (fls_const y)
[PROOF STEP]
..


[STATEMENT]
lemma qinverse_qtimes: "(x \<^bold>\<cdot> y)\<^sup>-\<^sup>\<one> \<cong>\<^sub>Q x\<^sup>-\<^sup>\<one> \<^bold>\<cdot> y\<^sup>-\<^sup>\<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<^bold>\<cdot> y)\<^sup>-\<^sup>\<one> \<cong>\<^sub>Q x\<^sup>-\<^sup>\<one> \<^bold>\<cdot> y\<^sup>-\<^sup>\<one>
[PROOF STEP]
by (si_simp add: inverse_distrib)


[STATEMENT]
lemma integrable_indicator_iff:
  "integrable M (indicator A::_ \<Rightarrow> real) \<longleftrightarrow> A \<inter> space M \<in> sets M \<and> emeasure M (A \<inter> space M) < \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (indicat_real A) = (A \<inter> space M \<in> sets M \<and> emeasure M (A \<inter> space M) < \<infinity>)
[PROOF STEP]
by (simp add: integrable_iff_bounded borel_measurable_indicator_iff ennreal_indicator nn_integral_indicator'
           cong: conj_cong)


[STATEMENT]
lemma reconstruct_with_type_conversion:
  "smult (lead_coeff (map_poly of_int f)) (prod_list (map (\<lambda> a. [:- a, 1:]) (complex_roots_int f)))
   = map_poly of_int f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.smult (lead_coeff (of_int_poly f)) (\<Prod>a\<leftarrow>complex_roots_int f. [:- a, 1:]) = of_int_poly f
[PROOF STEP]
unfolding complex_roots_int_def complex_roots(1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_poly f = of_int_poly f
[PROOF STEP]
by simp


[STATEMENT]
lemma word64_bounds:
  "- (2 ^ (size (x :: word64) - 1)) = (-9223372036854775808 :: int)"
  "((2 ^ (size (x :: word64) - 1)) - 1) = (9223372036854775807 :: int)"
  "- (2 ^ (size (y :: 64 signed word) - 1)) = (-9223372036854775808 :: int)"
  "((2 ^ (size (y :: 64 signed word) - 1)) - 1) = (9223372036854775807 :: int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- (2 ^ (size x - 1)) = - 9223372036854775808 &&& 2 ^ (size x - 1) - 1 = 9223372036854775807) &&& - (2 ^ (size y - 1)) = - 9223372036854775808 &&& 2 ^ (size y - 1) - 1 = 9223372036854775807
[PROOF STEP]
by (simp_all add: word_size)


[STATEMENT]
lemma anonymous_profile_agent_permutation:
  assumes eq:  "anonymous_profile R1 = anonymous_profile R2"
  assumes wf:  "pref_profile_wf agents alts R1" "pref_profile_wf agents alts R2"
  assumes fin: "finite agents"
  obtains \<pi> where "\<pi> permutes agents" "R2 \<circ> \<pi> = R1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; R2 \<circ> \<pi> = R1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; R2 \<circ> \<pi> = R1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
interpret R1: pref_profile_wf agents alts R1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pref_profile_wf agents alts R1
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; R2 \<circ> \<pi> = R1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
interpret R2: pref_profile_wf agents alts R2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pref_profile_wf agents alts R2
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; R2 \<circ> \<pi> = R1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from eq
[PROOF STATE]
proof (chain)
picking this:
anonymous_profile R1 = anonymous_profile R2
[PROOF STEP]
have "{#weak_ranking (R1 x). x \<in># mset_set agents#} =
                  {#weak_ranking (R2 x). x \<in># mset_set agents#}"
[PROOF STATE]
proof (prove)
using this:
anonymous_profile R1 = anonymous_profile R2

goal (1 subgoal):
 1. {#weak_ranking (R1 x). x \<in># mset_set agents#} = {#weak_ranking (R2 x). x \<in># mset_set agents#}
[PROOF STEP]
by (simp add: R1.anonymous_profile_def R2.anonymous_profile_def o_def)
[PROOF STATE]
proof (state)
this:
{#weak_ranking (R1 x). x \<in># mset_set agents#} = {#weak_ranking (R2 x). x \<in># mset_set agents#}

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; R2 \<circ> \<pi> = R1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from image_mset_eq_permutation[OF this fin]
[PROOF STATE]
proof (chain)
picking this:
(\<And>\<pi>. \<lbrakk>\<pi> permutes agents; \<And>x. x \<in> agents \<Longrightarrow> weak_ranking (R2 (\<pi> x)) = weak_ranking (R1 x)\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
obtain \<pi>
    where \<pi>: "\<pi> permutes agents"
      "\<And>x. x \<in> agents \<Longrightarrow> weak_ranking (R2 (\<pi> x)) = weak_ranking (R1 x)"
[PROOF STATE]
proof (prove)
using this:
(\<And>\<pi>. \<lbrakk>\<pi> permutes agents; \<And>x. x \<in> agents \<Longrightarrow> weak_ranking (R2 (\<pi> x)) = weak_ranking (R1 x)\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; \<And>x. x \<in> agents \<Longrightarrow> weak_ranking (R2 (\<pi> x)) = weak_ranking (R1 x)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<pi> permutes agents
?x \<in> agents \<Longrightarrow> weak_ranking (R2 (\<pi> ?x)) = weak_ranking (R1 ?x)

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; R2 \<circ> \<pi> = R1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from \<pi>
[PROOF STATE]
proof (chain)
picking this:
\<pi> permutes agents
?x \<in> agents \<Longrightarrow> weak_ranking (R2 (\<pi> ?x)) = weak_ranking (R1 ?x)
[PROOF STEP]
have wf': "pref_profile_wf agents alts (R2 \<circ> \<pi>)"
[PROOF STATE]
proof (prove)
using this:
\<pi> permutes agents
?x \<in> agents \<Longrightarrow> weak_ranking (R2 (\<pi> ?x)) = weak_ranking (R1 ?x)

goal (1 subgoal):
 1. pref_profile_wf agents alts (R2 \<circ> \<pi>)
[PROOF STEP]
by (intro R2.wf_permute_agents)
[PROOF STATE]
proof (state)
this:
pref_profile_wf agents alts (R2 \<circ> \<pi>)

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; R2 \<circ> \<pi> = R1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pref_profile_wf agents alts (R2 \<circ> \<pi>)
[PROOF STEP]
interpret R2': pref_profile_wf agents alts "R2 \<circ> \<pi>"
[PROOF STATE]
proof (prove)
using this:
pref_profile_wf agents alts (R2 \<circ> \<pi>)

goal (1 subgoal):
 1. pref_profile_wf agents alts (R2 \<circ> \<pi>)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; R2 \<circ> \<pi> = R1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "R2 \<circ> \<pi> = R1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R2 \<circ> \<pi> = R1
[PROOF STEP]
proof (intro pref_profile_eqI[OF wf' wf(1)])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> agents \<Longrightarrow> (R2 \<circ> \<pi>) x = R1 x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> agents \<Longrightarrow> (R2 \<circ> \<pi>) x = R1 x
[PROOF STEP]
assume x: "x \<in> agents"
[PROOF STATE]
proof (state)
this:
x \<in> agents

goal (1 subgoal):
 1. \<And>x. x \<in> agents \<Longrightarrow> (R2 \<circ> \<pi>) x = R1 x
[PROOF STEP]
with \<pi>
[PROOF STATE]
proof (chain)
picking this:
\<pi> permutes agents
?x \<in> agents \<Longrightarrow> weak_ranking (R2 (\<pi> ?x)) = weak_ranking (R1 ?x)
x \<in> agents
[PROOF STEP]
have "weak_ranking ((R2 o \<pi>) x) = weak_ranking (R1 x)"
[PROOF STATE]
proof (prove)
using this:
\<pi> permutes agents
?x \<in> agents \<Longrightarrow> weak_ranking (R2 (\<pi> ?x)) = weak_ranking (R1 ?x)
x \<in> agents

goal (1 subgoal):
 1. weak_ranking ((R2 \<circ> \<pi>) x) = weak_ranking (R1 x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
weak_ranking ((R2 \<circ> \<pi>) x) = weak_ranking (R1 x)

goal (1 subgoal):
 1. \<And>x. x \<in> agents \<Longrightarrow> (R2 \<circ> \<pi>) x = R1 x
[PROOF STEP]
with wf' wf(1) x
[PROOF STATE]
proof (chain)
picking this:
pref_profile_wf agents alts (R2 \<circ> \<pi>)
pref_profile_wf agents alts R1
x \<in> agents
weak_ranking ((R2 \<circ> \<pi>) x) = weak_ranking (R1 x)
[PROOF STEP]
show "(R2 \<circ> \<pi>) x = R1 x"
[PROOF STATE]
proof (prove)
using this:
pref_profile_wf agents alts (R2 \<circ> \<pi>)
pref_profile_wf agents alts R1
x \<in> agents
weak_ranking ((R2 \<circ> \<pi>) x) = weak_ranking (R1 x)

goal (1 subgoal):
 1. (R2 \<circ> \<pi>) x = R1 x
[PROOF STEP]
by (intro weak_ranking_eqD[of alts] R2'.prefs_wf) simp_all
[PROOF STATE]
proof (state)
this:
(R2 \<circ> \<pi>) x = R1 x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
R2 \<circ> \<pi> = R1

goal (1 subgoal):
 1. (\<And>\<pi>. \<lbrakk>\<pi> permutes agents; R2 \<circ> \<pi> = R1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from \<pi>(1) and this
[PROOF STATE]
proof (chain)
picking this:
\<pi> permutes agents
R2 \<circ> \<pi> = R1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<pi> permutes agents
R2 \<circ> \<pi> = R1

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma HZH_is_X [simp]:
  shows "H * Z * H = X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H * Z * H = X
[PROOF STEP]
apply(simp add: X_def Z_def H_def times_mat_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat 2 2 (\<lambda>(i, j). row (mat 2 2 (\<lambda>(i, j). row (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>m mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 1 else if i = 0 then 1 else - 1)) i \<bullet> col (mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 0 else if i = 0 then 1 else - 1)) j)) i \<bullet> col (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>m mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 1 else if i = 0 then 1 else - 1)) j) = mat 2 2 (\<lambda>(i, j). if i = j then 0 else 1)
[PROOF STEP]
apply(rule cong_mat)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. 2 = 2
 2. 2 = 2
 3. \<And>i j. \<lbrakk>i < 2; j < 2\<rbrakk> \<Longrightarrow> (case (i, j) of (i, j) \<Rightarrow> row (mat 2 2 (\<lambda>(i, j). row (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>m mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 1 else if i = 0 then 1 else - 1)) i \<bullet> col (mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 0 else if i = 0 then 1 else - 1)) j)) i \<bullet> col (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>m mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 1 else if i = 0 then 1 else - 1)) j) = (case (i, j) of (i, j) \<Rightarrow> if i = j then 0 else 1)
[PROOF STEP]
by(auto simp add: scalar_prod_def complex_eqI)


[STATEMENT]
lemma closed_segment_in_Reals:
   "\<lbrakk>x \<in> closed_segment a b; a \<in> Reals; b \<in> Reals\<rbrakk> \<Longrightarrow> x \<in> Reals"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> closed_segment a b; a \<in> \<real>; b \<in> \<real>\<rbrakk> \<Longrightarrow> x \<in> \<real>
[PROOF STEP]
by (meson subsetD convex_Reals convex_contains_segment)


[STATEMENT]
lemma hensel_binary:
  assumes cop: "coprime_m D H" and eq: "eq_m C (D * H)"
  and normalized_input: "Mp D = D" "Mp H = H"
  and monic_input: "monic D"
  and hensel_result: "hensel_binary C D H = (D',H')"
  shows "poly_mod.eq_m (p^n) C (D' * H') \<comment> \<open>the main result: equivalence mod \<open>p^n\<close>\<close>
    \<and> monic D' \<comment> \<open>monic output\<close>
    \<and> eq_m D D' \<and> eq_m H H' \<comment> \<open>apply \<open>`mod p`\<close> on \<open>D'\<close> and \<open>H'\<close> yields \<open>D\<close> and \<open>H\<close> again\<close>
    \<and> poly_mod.Mp (p^n) D' = D' \<and> poly_mod.Mp (p^n) H' = H' \<comment> \<open>output is normalized\<close>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
from m1
[PROOF STATE]
proof (chain)
picking this:
1 < p
[PROOF STEP]
have p: "p > 1"
[PROOF STATE]
proof (prove)
using this:
1 < p

goal (1 subgoal):
 1. 1 < p
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
1 < p

goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
obtain S T where ext: "euclid_ext_poly_dynamic p D H = (S,T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>S T. euclid_ext_poly_dynamic p D H = (S, T) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
euclid_ext_poly_dynamic p D H = (S, T)

goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
obtain D1 H1 where main: "quadratic_hensel_main C p S T D H n = (D1,H1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>D1 H1. quadratic_hensel_main C p S T D H n = (D1, H1) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
quadratic_hensel_main C p S T D H n = (D1, H1)

goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
note hen = hensel_result[unfolded quadratic_hensel_binary_def ext split Let_def main]
[PROOF STATE]
proof (state)
this:
(D1, H1) = (D', H')

goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
n \<noteq> 0
[PROOF STEP]
have n: "n \<ge> 1"
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

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

goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
note eucl = euclid_ext_poly_dynamic[OF cop normalized_input ext]
[PROOF STATE]
proof (state)
this:
D * S + H * T =m 1
Mp S = S
Mp T = T

goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
note main = quadratic_hensel_main[OF eucl(1) eq monic_input p normalized_input eucl(2-) n main]
[PROOF STATE]
proof (state)
this:
poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D1 * H1)
monic D1
D =m D1
H =m H1
poly_mod.Mp (p ^ n) D1 = D1
poly_mod.Mp (p ^ n) H1 = H1

goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
using hen main
[PROOF STATE]
proof (prove)
using this:
(D1, H1) = (D', H')
poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D1 * H1)
monic D1
D =m D1
H =m H1
poly_mod.Mp (p ^ n) D1 = D1
poly_mod.Mp (p ^ n) H1 = H1

goal (1 subgoal):
 1. poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly_mod.Mp (p ^ n) C = poly_mod.Mp (p ^ n) (D' * H') \<and> monic D' \<and> D =m D' \<and> H =m H' \<and> poly_mod.Mp (p ^ n) D' = D' \<and> poly_mod.Mp (p ^ n) H' = H'

goal:
No subgoals!
[PROOF STEP]
qed