[STATEMENT]
lemma hanoi_correct: "hanoi n = repeat (2 ^ n - 1) (tick (return ()))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.hanoi n = repeat (2 ^ n - 1) (tick (return ()))
[PROOF STEP]
proof(induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. local.hanoi 0 = repeat (2 ^ 0 - 1) (tick (return ()))
 2. \<And>n. local.hanoi n = repeat (2 ^ n - 1) (tick (return ())) \<Longrightarrow> local.hanoi (Suc n) = repeat (2 ^ Suc n - 1) (tick (return ()))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. local.hanoi 0 = repeat (2 ^ 0 - 1) (tick (return ()))
 2. \<And>n. local.hanoi n = repeat (2 ^ n - 1) (tick (return ())) \<Longrightarrow> local.hanoi (Suc n) = repeat (2 ^ Suc n - 1) (tick (return ()))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.hanoi 0 = repeat (2 ^ 0 - 1) (tick (return ()))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.hanoi 0 = repeat (2 ^ 0 - 1) (tick (return ()))

goal (1 subgoal):
 1. \<And>n. local.hanoi n = repeat (2 ^ n - 1) (tick (return ())) \<Longrightarrow> local.hanoi (Suc n) = repeat (2 ^ Suc n - 1) (tick (return ()))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. local.hanoi n = repeat (2 ^ n - 1) (tick (return ())) \<Longrightarrow> local.hanoi (Suc n) = repeat (2 ^ Suc n - 1) (tick (return ()))
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
local.hanoi n = repeat (2 ^ n - 1) (tick (return ()))

goal (1 subgoal):
 1. \<And>n. local.hanoi n = repeat (2 ^ n - 1) (tick (return ())) \<Longrightarrow> local.hanoi (Suc n) = repeat (2 ^ Suc n - 1) (tick (return ()))
[PROOF STEP]
have "hanoi (Suc n) = repeat ((2 ^ n - 1) + 1 + (2 ^ n - 1)) (tick (return ()))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.hanoi (Suc n) = repeat (2 ^ n - 1 + 1 + (2 ^ n - 1)) (tick (return ()))
[PROOF STEP]
by(simp only: hanoi.simps repeat_add repeat_1 Suc.IH bind_assoc bind_tick return_bind)
[PROOF STATE]
proof (state)
this:
local.hanoi (Suc n) = repeat (2 ^ n - 1 + 1 + (2 ^ n - 1)) (tick (return ()))

goal (1 subgoal):
 1. \<And>n. local.hanoi n = repeat (2 ^ n - 1) (tick (return ())) \<Longrightarrow> local.hanoi (Suc n) = repeat (2 ^ Suc n - 1) (tick (return ()))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
local.hanoi (Suc n) = repeat (2 ^ n - 1 + 1 + (2 ^ n - 1)) (tick (return ()))

goal (1 subgoal):
 1. \<And>n. local.hanoi n = repeat (2 ^ n - 1) (tick (return ())) \<Longrightarrow> local.hanoi (Suc n) = repeat (2 ^ Suc n - 1) (tick (return ()))
[PROOF STEP]
have "(2 ^ n - 1) + 1 + (2 ^ n - 1) = (2 ^ Suc n - 1 :: nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ n - 1 + 1 + (2 ^ n - 1) = 2 ^ Suc n - 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ n - 1 + 1 + (2 ^ n - 1) = 2 ^ Suc n - 1

goal (1 subgoal):
 1. \<And>n. local.hanoi n = repeat (2 ^ n - 1) (tick (return ())) \<Longrightarrow> local.hanoi (Suc n) = repeat (2 ^ Suc n - 1) (tick (return ()))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
local.hanoi (Suc n) = repeat (2 ^ Suc n - 1) (tick (return ()))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
local.hanoi (Suc n) = repeat (2 ^ Suc n - 1) (tick (return ()))

goal (1 subgoal):
 1. local.hanoi (Suc n) = repeat (2 ^ Suc n - 1) (tick (return ()))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
local.hanoi (Suc n) = repeat (2 ^ Suc n - 1) (tick (return ()))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inv_subsetI:
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<in> B \<Longrightarrow> x \<in> C"
  shows "f -` B \<inter> A \<subseteq> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f -` B \<inter> A \<subseteq> C
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> A; f ?x \<in> B\<rbrakk> \<Longrightarrow> ?x \<in> C

goal (1 subgoal):
 1. f -` B \<inter> A \<subseteq> C
[PROOF STEP]
by force


[STATEMENT]
lemma index_MM_Rel_explicit:
  assumes "MM_Rel N N'"
  assumes "i < dim_row N" "j < dim_col N"
  shows "(N $$ (i, j)) mod m = to_int_mod_ring (N' $$ (i, j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. N $$ (i, j) mod m = to_int_mod_ring (N' $$ (i, j))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. N $$ (i, j) mod m = to_int_mod_ring (N' $$ (i, j))
[PROOF STEP]
have eq: "(to_int_mat N') $$ (i, j) = to_int_mod_ring (N' $$ (i, j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_int_mat N' $$ (i, j) = to_int_mod_ring (N' $$ (i, j))
[PROOF STEP]
by (metis MM_Rel_def assms(1) assms(2) assms(3) index_map_mat mat_mod.mat_mod_dim mat_mod_axioms)
[PROOF STATE]
proof (state)
this:
to_int_mat N' $$ (i, j) = to_int_mod_ring (N' $$ (i, j))

goal (1 subgoal):
 1. N $$ (i, j) mod m = to_int_mod_ring (N' $$ (i, j))
[PROOF STEP]
have "mat_mod N = to_int_mat N'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.mat_mod N = to_int_mat N'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
MM_Rel N N'
i < dim_row N
j < dim_col N

goal (1 subgoal):
 1. local.mat_mod N = to_int_mat N'
[PROOF STEP]
by (simp add: MM_Rel_def)
[PROOF STATE]
proof (state)
this:
local.mat_mod N = to_int_mat N'

goal (1 subgoal):
 1. N $$ (i, j) mod m = to_int_mod_ring (N' $$ (i, j))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
local.mat_mod N = to_int_mat N'
[PROOF STEP]
have "(mat_mod N) $$ (i, j) = (to_int_mat N') $$ (i, j)"
[PROOF STATE]
proof (prove)
using this:
local.mat_mod N = to_int_mat N'

goal (1 subgoal):
 1. local.mat_mod N $$ (i, j) = to_int_mat N' $$ (i, j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.mat_mod N $$ (i, j) = to_int_mat N' $$ (i, j)

goal (1 subgoal):
 1. N $$ (i, j) mod m = to_int_mod_ring (N' $$ (i, j))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
local.mat_mod N $$ (i, j) = to_int_mat N' $$ (i, j)

goal (1 subgoal):
 1. N $$ (i, j) mod m = to_int_mod_ring (N' $$ (i, j))
[PROOF STEP]
using mat_mod_index eq
[PROOF STATE]
proof (prove)
using this:
local.mat_mod N $$ (i, j) = to_int_mat N' $$ (i, j)
\<lbrakk>?i < dim_row ?M; ?j < dim_col ?M\<rbrakk> \<Longrightarrow> local.mat_mod ?M $$ (?i, ?j) = ?M $$ (?i, ?j) mod m
to_int_mat N' $$ (i, j) = to_int_mod_ring (N' $$ (i, j))

goal (1 subgoal):
 1. N $$ (i, j) mod m = to_int_mod_ring (N' $$ (i, j))
[PROOF STEP]
using assms(2) assms(3)
[PROOF STATE]
proof (prove)
using this:
local.mat_mod N $$ (i, j) = to_int_mat N' $$ (i, j)
\<lbrakk>?i < dim_row ?M; ?j < dim_col ?M\<rbrakk> \<Longrightarrow> local.mat_mod ?M $$ (?i, ?j) = ?M $$ (?i, ?j) mod m
to_int_mat N' $$ (i, j) = to_int_mod_ring (N' $$ (i, j))
i < dim_row N
j < dim_col N

goal (1 subgoal):
 1. N $$ (i, j) mod m = to_int_mod_ring (N' $$ (i, j))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
N $$ (i, j) mod m = to_int_mod_ring (N' $$ (i, j))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ord0_order_refl[simp]: "(x::ord0) \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> x
[PROOF STEP]
by (unfold ord0_le_def, rule ord0_leq_refl)


[STATEMENT]
lemma add_diff_cancel_right[simp]: "(a \<oplus>\<^sub>a c) \<ominus>\<^sub>a (b \<oplus>\<^sub>a c) = a \<ominus>\<^sub>a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<oplus>\<^sub>a c \<ominus>\<^sub>a (b \<oplus>\<^sub>a c) = a \<ominus>\<^sub>a b
[PROOF STEP]
using add_diff_cancel_left[symmetric]
[PROOF STATE]
proof (prove)
using this:
?a \<ominus>\<^sub>a ?b = ?c \<oplus>\<^sub>a ?a \<ominus>\<^sub>a (?c \<oplus>\<^sub>a ?b)

goal (1 subgoal):
 1. a \<oplus>\<^sub>a c \<ominus>\<^sub>a (b \<oplus>\<^sub>a c) = a \<ominus>\<^sub>a b
[PROOF STEP]
by (simp add: tts_ac_simps)


[STATEMENT]
theorem wls_vsubstAbs_trans:
assumes "wlsAbs (us,s) A" and "freshAbs ys y1 A"
shows "((A $[y1 // y]_ys) $[y2 // y1]_ys) = (A $[y2 // y]_ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $[y1 // y]_ys $[y2 // y1]_ys = A $[y2 // y]_ys
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wlsAbs (us, s) A
freshAbs ys y1 A

goal (1 subgoal):
 1. A $[y1 // y]_ys $[y2 // y1]_ys = A $[y2 // y]_ys
[PROOF STEP]
by(simp add: vsubstAbs_trans)


[STATEMENT]
lemma (in Group) rcs_eq2:"\<lbrakk>G \<guillemotright> H; a \<in> carrier G;  b \<in> carrier G;
                           (H \<bullet> a) \<inter> (H \<bullet> b) \<noteq> {}\<rbrakk> \<Longrightarrow> (H \<bullet> a) = (H \<bullet> b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>G \<guillemotright> H ; a \<in> carrier G; b \<in> carrier G; H \<bullet> a \<inter> (H \<bullet> b) \<noteq> {}\<rbrakk> \<Longrightarrow> H \<bullet> a = H \<bullet> b
[PROOF STEP]
apply (frule nonempty_int [of "H \<bullet> a" "H \<bullet> b"], erule exE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>G \<guillemotright> H ; a \<in> carrier G; b \<in> carrier G; H \<bullet> a \<inter> (H \<bullet> b) \<noteq> {}; x \<in> H \<bullet> a \<inter> (H \<bullet> b)\<rbrakk> \<Longrightarrow> H \<bullet> a = H \<bullet> b
[PROOF STEP]
apply (simp, erule conjE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>G \<guillemotright> H ; a \<in> carrier G; b \<in> carrier G; H \<bullet> a \<inter> (H \<bullet> b) \<noteq> {}; x \<in> H \<bullet> a; x \<in> H \<bullet> b\<rbrakk> \<Longrightarrow> H \<bullet> a = H \<bullet> b
[PROOF STEP]
apply (frule_tac x = x in rcs_eq1[of "H" "a"], assumption+,
       frule_tac x = x in rcs_eq1[of "H" "b"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>G \<guillemotright> H ; a \<in> carrier G; b \<in> carrier G; H \<bullet> a \<inter> (H \<bullet> b) \<noteq> {}; x \<in> H \<bullet> a; x \<in> H \<bullet> b; H \<bullet> a = H \<bullet> x; H \<bullet> b = H \<bullet> x\<rbrakk> \<Longrightarrow> H \<bullet> a = H \<bullet> b
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma norm_cos_plus1_le:
  fixes z::complex
  shows "norm(1 + cos z) \<le> 2 * exp(norm z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (1 + cos z) \<le> 2 * exp (cmod z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cmod (1 + cos z) \<le> 2 * exp (cmod z)
[PROOF STEP]
have mono: "\<And>u w z::real. (1 \<le> w | 1 \<le> z) \<Longrightarrow> (w \<le> u & z \<le> u) \<Longrightarrow> 2 + w + z \<le> 4 * u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u w z. \<lbrakk>1 \<le> w \<or> 1 \<le> z; w \<le> u \<and> z \<le> u\<rbrakk> \<Longrightarrow> 2 + w + z \<le> 4 * u
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
\<lbrakk>1 \<le> ?w \<or> 1 \<le> ?z; ?w \<le> ?u \<and> ?z \<le> ?u\<rbrakk> \<Longrightarrow> 2 + ?w + ?z \<le> 4 * ?u

goal (1 subgoal):
 1. cmod (1 + cos z) \<le> 2 * exp (cmod z)
[PROOF STEP]
have *: "Im z \<le> cmod z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im z \<le> cmod z
[PROOF STEP]
using abs_Im_le_cmod abs_le_D1
[PROOF STATE]
proof (prove)
using this:
\<bar>Im ?x\<bar> \<le> cmod ?x
\<bar>?a\<bar> \<le> ?b \<Longrightarrow> ?a \<le> ?b

goal (1 subgoal):
 1. Im z \<le> cmod z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Im z \<le> cmod z

goal (1 subgoal):
 1. cmod (1 + cos z) \<le> 2 * exp (cmod z)
[PROOF STEP]
have triangle3: "\<And>x y z. norm(x + y + z) \<le> norm(x) + norm(y) + norm(z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y z. norm (x + y + z) \<le> norm x + norm y + norm z
[PROOF STEP]
by (simp add: norm_add_rule_thm)
[PROOF STATE]
proof (state)
this:
norm (?x + ?y + ?z) \<le> norm ?x + norm ?y + norm ?z

goal (1 subgoal):
 1. cmod (1 + cos z) \<le> 2 * exp (cmod z)
[PROOF STEP]
have "norm(1 + cos z) = cmod (1 + (exp (\<i> * z) + exp (- (\<i> * z))) / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (1 + cos z) = cmod (1 + (exp (\<i> * z) + exp (- (\<i> * z))) / 2)
[PROOF STEP]
by (simp add: cos_exp_eq)
[PROOF STATE]
proof (state)
this:
cmod (1 + cos z) = cmod (1 + (exp (\<i> * z) + exp (- (\<i> * z))) / 2)

goal (1 subgoal):
 1. cmod (1 + cos z) \<le> 2 * exp (cmod z)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (1 + cos z) = cmod (1 + (exp (\<i> * z) + exp (- (\<i> * z))) / 2)

goal (1 subgoal):
 1. cmod (1 + cos z) \<le> 2 * exp (cmod z)
[PROOF STEP]
have "\<dots> = cmod ((2 + exp (\<i> * z) + exp (- (\<i> * z))) / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (1 + (exp (\<i> * z) + exp (- (\<i> * z))) / 2) = cmod ((2 + exp (\<i> * z) + exp (- (\<i> * z))) / 2)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
cmod (1 + (exp (\<i> * z) + exp (- (\<i> * z))) / 2) = cmod ((2 + exp (\<i> * z) + exp (- (\<i> * z))) / 2)

goal (1 subgoal):
 1. cmod (1 + cos z) \<le> 2 * exp (cmod z)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cmod (1 + (exp (\<i> * z) + exp (- (\<i> * z))) / 2) = cmod ((2 + exp (\<i> * z) + exp (- (\<i> * z))) / 2)

goal (1 subgoal):
 1. cmod (1 + cos z) \<le> 2 * exp (cmod z)
[PROOF STEP]
have "\<dots> = cmod (2 + exp (\<i> * z) + exp (- (\<i> * z))) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod ((2 + exp (\<i> * z) + exp (- (\<i> * z))) / 2) = cmod (2 + exp (\<i> * z) + exp (- (\<i> * z))) / 2
[PROOF STEP]
by (simp add: norm_divide)
[PROOF STATE]
proof (state)
this:
cmod ((2 + exp (\<i> * z) + exp (- (\<i> * z))) / 2) = cmod (2 + exp (\<i> * z) + exp (- (\<i> * z))) / 2

goal (1 subgoal):
 1. cmod (1 + cos z) \<le> 2 * exp (cmod z)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cmod (1 + cos z) = cmod (2 + exp (\<i> * z) + exp (- (\<i> * z))) / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cmod (1 + cos z) = cmod (2 + exp (\<i> * z) + exp (- (\<i> * z))) / 2

goal (1 subgoal):
 1. cmod (1 + cos z) \<le> 2 * exp (cmod z)
[PROOF STEP]
by (metis exp_eq_one_iff exp_le_cancel_iff mult_2 norm_cos_le norm_ge_zero norm_one norm_triangle_mono)
[PROOF STATE]
proof (state)
this:
cmod (1 + cos z) \<le> 2 * exp (cmod z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Un_closed_segment:
  fixes a :: "'a::euclidean_space"
  assumes "b \<in> closed_segment a c"
    shows "closed_segment a b \<union> closed_segment b c = closed_segment a c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_segment a b \<union> closed_segment b c = closed_segment a c
[PROOF STEP]
proof (cases "c = a")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. c = a \<Longrightarrow> closed_segment a b \<union> closed_segment b c = closed_segment a c
 2. c \<noteq> a \<Longrightarrow> closed_segment a b \<union> closed_segment b c = closed_segment a c
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
c = a

goal (2 subgoals):
 1. c = a \<Longrightarrow> closed_segment a b \<union> closed_segment b c = closed_segment a c
 2. c \<noteq> a \<Longrightarrow> closed_segment a b \<union> closed_segment b c = closed_segment a c
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
b \<in> closed_segment a c
c = a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b \<in> closed_segment a c
c = a

goal (1 subgoal):
 1. closed_segment a b \<union> closed_segment b c = closed_segment a c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
closed_segment a b \<union> closed_segment b c = closed_segment a c

goal (1 subgoal):
 1. c \<noteq> a \<Longrightarrow> closed_segment a b \<union> closed_segment b c = closed_segment a c
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c \<noteq> a \<Longrightarrow> closed_segment a b \<union> closed_segment b c = closed_segment a c
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
c \<noteq> a

goal (1 subgoal):
 1. c \<noteq> a \<Longrightarrow> closed_segment a b \<union> closed_segment b c = closed_segment a c
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
b \<in> closed_segment a c
c \<noteq> a
[PROOF STEP]
have "convex hull {a, b} \<union> convex hull {b, c} = (\<Union>ba\<in>{a, c}. convex hull insert b ({a, c} - {ba}))"
[PROOF STATE]
proof (prove)
using this:
b \<in> closed_segment a c
c \<noteq> a

goal (1 subgoal):
 1. convex hull {a, b} \<union> convex hull {b, c} = (\<Union>ba\<in>{a, c}. convex hull insert b ({a, c} - {ba}))
[PROOF STEP]
by (auto simp: insert_Diff_if insert_commute)
[PROOF STATE]
proof (state)
this:
convex hull {a, b} \<union> convex hull {b, c} = (\<Union>ba\<in>{a, c}. convex hull insert b ({a, c} - {ba}))

goal (1 subgoal):
 1. c \<noteq> a \<Longrightarrow> closed_segment a b \<union> closed_segment b c = closed_segment a c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
convex hull {a, b} \<union> convex hull {b, c} = (\<Union>ba\<in>{a, c}. convex hull insert b ({a, c} - {ba}))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
convex hull {a, b} \<union> convex hull {b, c} = (\<Union>ba\<in>{a, c}. convex hull insert b ({a, c} - {ba}))

goal (1 subgoal):
 1. closed_segment a b \<union> closed_segment b c = closed_segment a c
[PROOF STEP]
using convex_hull_exchange_Union
[PROOF STATE]
proof (prove)
using this:
convex hull {a, b} \<union> convex hull {b, c} = (\<Union>ba\<in>{a, c}. convex hull insert b ({a, c} - {ba}))
?a \<in> convex hull ?S \<Longrightarrow> convex hull ?S = (\<Union>b\<in>?S. convex hull insert ?a (?S - {b}))

goal (1 subgoal):
 1. closed_segment a b \<union> closed_segment b c = closed_segment a c
[PROOF STEP]
by (metis assms segment_convex_hull)
[PROOF STATE]
proof (state)
this:
closed_segment a b \<union> closed_segment b c = closed_segment a c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_root_power_cancel: "0 < n \<Longrightarrow> 0 \<le> x \<Longrightarrow> root n (x ^ n) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; 0 \<le> x\<rbrakk> \<Longrightarrow> root n (x ^ n) = x
[PROOF STEP]
using root_sgn_power[of n x]
[PROOF STATE]
proof (prove)
using this:
0 < n \<Longrightarrow> root n (sgn x * \<bar>x\<bar> ^ n) = x

goal (1 subgoal):
 1. \<lbrakk>0 < n; 0 \<le> x\<rbrakk> \<Longrightarrow> root n (x ^ n) = x
[PROOF STEP]
by (auto simp add: le_less power_0_left)


[STATEMENT]
lemma lt_of_comp_of_ords: "lt_of_comp (comp_of_ords le lt) = lt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lt_of_comp (comp_of_ords le lt) = lt
[PROOF STEP]
by (intro ext, auto simp: comp_of_ords_def le_of_comp_def lt_of_comp_def split: order.split)


[STATEMENT]
theorem normal_form:
  assumes "recfn n f"
  obtains i where "\<forall>x. e_length x = n \<longrightarrow> eval r_normal_form [i, x] = eval f (list_decode x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. \<forall>x. e_length x = n \<longrightarrow> eval r_normal_form [i, x] = eval f (Partial_Recursive.list_decode x) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>i. \<forall>x. e_length x = n \<longrightarrow> eval r_normal_form [i, x] = eval f (Partial_Recursive.list_decode x) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "eval r_normal_form [encode f, x] = eval f (list_decode x)" if "e_length x = n" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval r_normal_form [encode f, x] = eval f (Partial_Recursive.list_decode x)
[PROOF STEP]
using r_univ_exteq_r_normal_form assms that exteq_def r_univ'
[PROOF STATE]
proof (prove)
using this:
r_univ \<simeq> r_normal_form
recfn n f
e_length x = n
?f \<simeq> ?g \<equiv> arity ?f = arity ?g \<and> (\<forall>xs. length xs = arity ?f \<longrightarrow> eval ?f xs = eval ?g xs)
recfn (e_length ?x) ?f \<Longrightarrow> eval r_univ [encode ?f, ?x] = eval ?f (Partial_Recursive.list_decode ?x)

goal (1 subgoal):
 1. eval r_normal_form [encode f, x] = eval f (Partial_Recursive.list_decode x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
e_length ?x = n \<Longrightarrow> eval r_normal_form [encode f, ?x] = eval f (Partial_Recursive.list_decode ?x)

goal (1 subgoal):
 1. (\<And>i. \<forall>x. e_length x = n \<longrightarrow> eval r_normal_form [i, x] = eval f (Partial_Recursive.list_decode x) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
e_length ?x = n \<Longrightarrow> eval r_normal_form [encode f, ?x] = eval f (Partial_Recursive.list_decode ?x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
e_length ?x = n \<Longrightarrow> eval r_normal_form [encode f, ?x] = eval f (Partial_Recursive.list_decode ?x)

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
e_length ?x = n \<Longrightarrow> eval r_normal_form [encode f, ?x] = eval f (Partial_Recursive.list_decode ?x)
\<forall>x. e_length x = n \<longrightarrow> eval r_normal_form [?i, x] = eval f (Partial_Recursive.list_decode x) \<Longrightarrow> thesis

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma irreflp_on_map:
  assumes "irreflp_on Q B"
    and "h ` A \<subseteq> B"
  shows "irreflp_on (\<lambda>x y. Q (h x) (h y)) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. irreflp_on (\<lambda>x y. Q (h x) (h y)) A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
irreflp_on Q B
h ` A \<subseteq> B

goal (1 subgoal):
 1. irreflp_on (\<lambda>x y. Q (h x) (h y)) A
[PROOF STEP]
unfolding irreflp_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>a\<in>B. \<not> Q a a
h ` A \<subseteq> B

goal (1 subgoal):
 1. \<forall>a\<in>A. \<not> Q (h a) (h a)
[PROOF STEP]
by auto


[STATEMENT]
lemma swapcols_is_transp_swap_rows: assumes A: "A \<in> carrier_mat n m" "k < m" "l < m"
  shows "swapcols k l A = transpose_mat (swaprows k l (transpose_mat A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. swapcols k l A = (swaprows k l A\<^sup>T)\<^sup>T
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n m
k < m
l < m

goal (1 subgoal):
 1. swapcols k l A = (swaprows k l A\<^sup>T)\<^sup>T
[PROOF STEP]
by (intro eq_matI, auto)


[STATEMENT]
lemma rel_spmf_reflI: "(\<And>x. x \<in> set_spmf p \<Longrightarrow> P x x) \<Longrightarrow> rel_spmf P p p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> set_spmf p \<Longrightarrow> P x x) \<Longrightarrow> rel_spmf P p p
[PROOF STEP]
by(rule rel_pmf_reflI)(auto simp add: set_spmf_def intro: rel_option_reflI)


[STATEMENT]
lemma summable_norm_cancel: "summable (\<lambda>n. norm (f n)) \<Longrightarrow> summable f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. norm (f n)) \<Longrightarrow> summable f
[PROOF STEP]
unfolding summable_Cauchy
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>e>0. \<exists>N. \<forall>m\<ge>N. \<forall>n. norm (\<Sum>n = m..<n. norm (f n)) < e \<Longrightarrow> \<forall>e>0. \<exists>N. \<forall>m\<ge>N. \<forall>n. norm (sum f {m..<n}) < e
[PROOF STEP]
apply (erule all_forward imp_forward ex_forward | assumption)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e N m n. norm (\<Sum>n = m..<n. norm (f n)) < e \<Longrightarrow> norm (sum f {m..<n}) < e
[PROOF STEP]
apply (fastforce simp add: order_le_less_trans [OF norm_sum] order_le_less_trans [OF abs_ge_self])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma exp_eq_1: "exp z = 1 \<longleftrightarrow> Re(z) = 0 \<and> (\<exists>n::int. Im(z) = of_int (2 * n) * pi)"
                 (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (exp z = 1) = (Re z = 0 \<and> (\<exists>n. Im z = real_of_int (2 * n) * pi))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. exp z = 1 \<Longrightarrow> Re z = 0 \<and> (\<exists>n. Im z = real_of_int (2 * n) * pi)
 2. Re z = 0 \<and> (\<exists>n. Im z = real_of_int (2 * n) * pi) \<Longrightarrow> exp z = 1
[PROOF STEP]
assume "exp z = 1"
[PROOF STATE]
proof (state)
this:
exp z = 1

goal (2 subgoals):
 1. exp z = 1 \<Longrightarrow> Re z = 0 \<and> (\<exists>n. Im z = real_of_int (2 * n) * pi)
 2. Re z = 0 \<and> (\<exists>n. Im z = real_of_int (2 * n) * pi) \<Longrightarrow> exp z = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
exp z = 1
[PROOF STEP]
have "Re z = 0"
[PROOF STATE]
proof (prove)
using this:
exp z = 1

goal (1 subgoal):
 1. Re z = 0
[PROOF STEP]
by (metis exp_eq_one_iff norm_exp_eq_Re norm_one)
[PROOF STATE]
proof (state)
this:
Re z = 0

goal (2 subgoals):
 1. exp z = 1 \<Longrightarrow> Re z = 0 \<and> (\<exists>n. Im z = real_of_int (2 * n) * pi)
 2. Re z = 0 \<and> (\<exists>n. Im z = real_of_int (2 * n) * pi) \<Longrightarrow> exp z = 1
[PROOF STEP]
with \<open>?lhs\<close>
[PROOF STATE]
proof (chain)
picking this:
exp z = 1
Re z = 0
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
exp z = 1
Re z = 0

goal (1 subgoal):
 1. Re z = 0 \<and> (\<exists>n. Im z = real_of_int (2 * n) * pi)
[PROOF STEP]
by (metis Re_exp complex_Re_of_int cos_one_2pi_int exp_zero mult.commute mult_numeral_1 numeral_One of_int_mult of_int_numeral)
[PROOF STATE]
proof (state)
this:
Re z = 0 \<and> (\<exists>n. Im z = real_of_int (2 * n) * pi)

goal (1 subgoal):
 1. Re z = 0 \<and> (\<exists>n. Im z = real_of_int (2 * n) * pi) \<Longrightarrow> exp z = 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Re z = 0 \<and> (\<exists>n. Im z = real_of_int (2 * n) * pi) \<Longrightarrow> exp z = 1
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
Re z = 0 \<and> (\<exists>n. Im z = real_of_int (2 * n) * pi)

goal (1 subgoal):
 1. Re z = 0 \<and> (\<exists>n. Im z = real_of_int (2 * n) * pi) \<Longrightarrow> exp z = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Re z = 0 \<and> (\<exists>n. Im z = real_of_int (2 * n) * pi)
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
Re z = 0 \<and> (\<exists>n. Im z = real_of_int (2 * n) * pi)

goal (1 subgoal):
 1. exp z = 1
[PROOF STEP]
using Im_exp Re_exp complex_eq_iff
[PROOF STATE]
proof (prove)
using this:
Re z = 0 \<and> (\<exists>n. Im z = real_of_int (2 * n) * pi)
Im (exp ?z) = exp (Re ?z) * sin (Im ?z)
Re (exp ?z) = exp (Re ?z) * cos (Im ?z)
(?x = ?y) = (Re ?x = Re ?y \<and> Im ?x = Im ?y)

goal (1 subgoal):
 1. exp z = 1
[PROOF STEP]
by (simp add: cos_one_2pi_int cos_one_sin_zero mult.commute)
[PROOF STATE]
proof (state)
this:
exp z = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma size_mset_remove1_mset_le_iff: "size (remove1_mset x M) < size M \<longleftrightarrow> x \<in># M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (size (remove1_mset x M) < size M) = (x \<in># M)
[PROOF STEP]
using less_irrefl
[PROOF STATE]
proof (prove)
using this:
\<not> ?x < ?x

goal (1 subgoal):
 1. (size (remove1_mset x M) < size M) = (x \<in># M)
[PROOF STEP]
by (fastforce intro!: mset_subset_size elim: in_countE simp: subset_mset_def multiset_eq_iff)


[STATEMENT]
lemma Cauchy_Schwarz_strict_ineq:
  "(inner x y)\<^sup>2 < inner x x * inner y y" if "y \<noteq> 0" "\<And>k. x \<noteq> k *\<^sub>R y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<bullet> y)\<^sup>2 < x \<bullet> x * (y \<bullet> y)
[PROOF STEP]
apply (rule neq_le_trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (x \<bullet> y)\<^sup>2 \<noteq> x \<bullet> x * (y \<bullet> y)
 2. (x \<bullet> y)\<^sup>2 \<le> x \<bullet> x * (y \<bullet> y)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<bullet> y)\<^sup>2 \<noteq> x \<bullet> x * (y \<bullet> y)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
y \<noteq> (0::'a)
x \<noteq> ?k *\<^sub>R y

goal (1 subgoal):
 1. (x \<bullet> y)\<^sup>2 \<noteq> x \<bullet> x * (y \<bullet> y)
[PROOF STEP]
unfolding Cauchy_Schwarz_eq_iff
[PROOF STATE]
proof (prove)
using this:
y \<noteq> (0::'a)
x \<noteq> ?k *\<^sub>R y

goal (1 subgoal):
 1. \<not> ((\<exists>k. x = k *\<^sub>R y) \<or> y = (0::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<bullet> y)\<^sup>2 \<le> x \<bullet> x * (y \<bullet> y)
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<bullet> y)\<^sup>2 \<le> x \<bullet> x * (y \<bullet> y)
[PROOF STEP]
by (rule Cauchy_Schwarz_ineq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma filterlim_at_top_strict_mono:
  fixes s :: "_ \<Rightarrow> 'a::linorder"
  fixes r :: "nat \<Rightarrow> _"
  assumes "strict_mono s"
  assumes "strict_mono r"
  assumes "filterlim s at_top F"
  shows "filterlim (s \<circ> r) at_top F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim (s \<circ> r) at_top F
[PROOF STEP]
apply (rule filterlim_at_top_mono[OF assms(3)])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. s x \<le> (s \<circ> r) x
[PROOF STEP]
by (simp add: assms(1) assms(2) seq_suble strict_mono_leD)


[STATEMENT]
lemma eventually_weak_subseq:
  fixes u::"nat \<Rightarrow> nat"
  assumes "(\<lambda>n. real(u n)) \<longlonglongrightarrow> \<infinity>" "eventually P sequentially"
  shows "eventually (\<lambda>n. P (u n)) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. P (u n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. P (u n)
[PROOF STEP]
obtain N where *: "\<forall>n\<ge>N. P n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>N. \<forall>n\<ge>N. P n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
eventually P sequentially

goal (1 subgoal):
 1. (\<And>N. \<forall>n\<ge>N. P n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding eventually_sequentially
[PROOF STATE]
proof (prove)
using this:
\<exists>N. \<forall>n\<ge>N. P n

goal (1 subgoal):
 1. (\<And>N. \<forall>n\<ge>N. P n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>n\<ge>N. P n

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. P (u n)
[PROOF STEP]
obtain M where "\<forall>m\<ge>M. ereal(u m) \<ge> N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>M. \<forall>m\<ge>M. ereal (real N) \<le> ereal (real (u m)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. ereal (real (u x))) \<longlonglongrightarrow> \<infinity>

goal (1 subgoal):
 1. (\<And>M. \<forall>m\<ge>M. ereal (real N) \<le> ereal (real (u m)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson Lim_PInfty)
[PROOF STATE]
proof (state)
this:
\<forall>m\<ge>M. ereal (real N) \<le> ereal (real (u m))

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

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

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. P (u n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
M \<le> ?m \<Longrightarrow> N \<le> u ?m
[PROOF STEP]
have "\<And>m. m \<ge> M \<Longrightarrow> P(u m)"
[PROOF STATE]
proof (prove)
using this:
M \<le> ?m \<Longrightarrow> N \<le> u ?m

goal (1 subgoal):
 1. \<And>m. M \<le> m \<Longrightarrow> P (u m)
[PROOF STEP]
using \<open>\<forall>n\<ge>N. P n\<close>
[PROOF STATE]
proof (prove)
using this:
M \<le> ?m \<Longrightarrow> N \<le> u ?m
\<forall>n\<ge>N. P n

goal (1 subgoal):
 1. \<And>m. M \<le> m \<Longrightarrow> P (u m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
M \<le> ?m \<Longrightarrow> P (u ?m)

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. P (u n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
M \<le> ?m \<Longrightarrow> P (u ?m)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
M \<le> ?m \<Longrightarrow> P (u ?m)

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. P (u n)
[PROOF STEP]
unfolding eventually_sequentially
[PROOF STATE]
proof (prove)
using this:
M \<le> ?m \<Longrightarrow> P (u ?m)

goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. P (u n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. P (u n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_power [tendsto_intros]: "(f \<longlongrightarrow> a) F \<Longrightarrow> ((\<lambda>x. f x ^ n) \<longlongrightarrow> a ^ n) F"
  for f :: "'a \<Rightarrow> 'b::{power,real_normed_algebra}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> a) F \<Longrightarrow> ((\<lambda>x. f x ^ n) \<longlongrightarrow> a ^ n) F
[PROOF STEP]
by (induct n) (simp_all add: tendsto_mult)


[STATEMENT]
lemma cindex_poly_rec:
  fixes p q::"real poly"
  assumes "a < b" "poly (p * q) a \<noteq>0" "poly (p * q) b \<noteq>0"
  shows "cindex_poly a b q p  = cross (p * q) a b  +  cindex_poly a b (- (p mod q)) q" (is "?L=?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_poly a b q p = cross (p * q) a b + cindex_poly a b (- (p mod q)) q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cindex_poly a b q p = cross (p * q) a b + cindex_poly a b (- (p mod q)) q
[PROOF STEP]
have "q\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q \<noteq> 0
[PROOF STEP]
using \<open>poly (p * q) a \<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
poly (p * q) a \<noteq> 0

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

goal (1 subgoal):
 1. cindex_poly a b q p = cross (p * q) a b + cindex_poly a b (- (p mod q)) q
[PROOF STEP]
note cindex_poly_inverse_add_cross[OF assms]
[PROOF STATE]
proof (state)
this:
cindex_poly a b q p + cindex_poly a b p q = cross (p * q) a b

goal (1 subgoal):
 1. cindex_poly a b q p = cross (p * q) a b + cindex_poly a b (- (p mod q)) q
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
cindex_poly a b q p + cindex_poly a b p q = cross (p * q) a b

goal (1 subgoal):
 1. cindex_poly a b q p = cross (p * q) a b + cindex_poly a b (- (p mod q)) q
[PROOF STEP]
have "- cindex_poly a b p q = cindex_poly a b (- (p mod q)) q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - cindex_poly a b p q = cindex_poly a b (- (p mod q)) q
[PROOF STEP]
using cindex_poly_mod cindex_poly_smult_1[of a b "-1"]
[PROOF STATE]
proof (prove)
using this:
cindex_poly ?a ?b ?q ?p = cindex_poly ?a ?b (?q mod ?p) ?p
cindex_poly a b (smult (- 1) ?q) ?p = sign (- 1) * cindex_poly a b ?q ?p

goal (1 subgoal):
 1. - cindex_poly a b p q = cindex_poly a b (- (p mod q)) q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- cindex_poly a b p q = cindex_poly a b (- (p mod q)) q

goal (1 subgoal):
 1. cindex_poly a b q p = cross (p * q) a b + cindex_poly a b (- (p mod q)) q
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
cindex_poly a b q p + cindex_poly a b p q = cross (p * q) a b
- cindex_poly a b p q = cindex_poly a b (- (p mod q)) q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cindex_poly a b q p + cindex_poly a b p q = cross (p * q) a b
- cindex_poly a b p q = cindex_poly a b (- (p mod q)) q

goal (1 subgoal):
 1. cindex_poly a b q p = cross (p * q) a b + cindex_poly a b (- (p mod q)) q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cindex_poly a b q p = cross (p * q) a b + cindex_poly a b (- (p mod q)) q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma relevant_atoms_same_semantics: "\<forall>k \<in> atoms F. \<A>\<^sub>1 k = \<A>\<^sub>2 k \<Longrightarrow> \<A>\<^sub>1 \<Turnstile> F \<longleftrightarrow> \<A>\<^sub>2 \<Turnstile> F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>k\<in>atoms F. \<A>\<^sub>1 k = \<A>\<^sub>2 k \<Longrightarrow> \<A>\<^sub>1 \<Turnstile> F = \<A>\<^sub>2 \<Turnstile> F
[PROOF STEP]
by(induction F; simp)


[STATEMENT]
lemma ceiling_le_neg_numeral [simp]: "\<lceil>x\<rceil> \<le> - numeral v \<longleftrightarrow> x \<le> - numeral v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lceil>x\<rceil> \<le> - numeral v) = (x \<le> - numeral v)
[PROOF STEP]
by (simp add: ceiling_le_iff)


[STATEMENT]
theorem real_mon_conv_times:
  assumes xy: "x\<up>(y::real)" and nn: "0\<le>z"
  shows "(\<lambda>m. z*x m)\<up>(z*y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>m. z * x m)\<up>z * y
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>m. z * x m)\<up>z * y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>m. z * x m)\<up>z * y
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
x\<up>y
0 \<le> z
[PROOF STEP]
have "\<And>n. z*x n \<le> z*x (Suc n)"
[PROOF STATE]
proof (prove)
using this:
x\<up>y
0 \<le> z

goal (1 subgoal):
 1. \<And>n. z * x n \<le> z * x (Suc n)
[PROOF STEP]
by (simp add: mon_conv_real_def mult_left_mono)
[PROOF STATE]
proof (state)
this:
z * x ?n \<le> z * x (Suc ?n)

goal (1 subgoal):
 1. (\<lambda>m. z * x m)\<up>z * y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
z * x ?n \<le> z * x (Suc ?n)

goal (1 subgoal):
 1. (\<lambda>m. z * x m)\<up>z * y
[PROOF STEP]
from xy
[PROOF STATE]
proof (chain)
picking this:
x\<up>y
[PROOF STEP]
have "(\<lambda>m. z*x m)\<longlonglongrightarrow>(z*y)"
[PROOF STATE]
proof (prove)
using this:
x\<up>y

goal (1 subgoal):
 1. (\<lambda>m. z * x m) \<longlonglongrightarrow> z * y
[PROOF STEP]
by (simp add: mon_conv_real_def tendsto_const tendsto_mult)
[PROOF STATE]
proof (state)
this:
(\<lambda>m. z * x m) \<longlonglongrightarrow> z * y

goal (1 subgoal):
 1. (\<lambda>m. z * x m)\<up>z * y
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
z * x ?n \<le> z * x (Suc ?n)
(\<lambda>m. z * x m) \<longlonglongrightarrow> z * y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
z * x ?n \<le> z * x (Suc ?n)
(\<lambda>m. z * x m) \<longlonglongrightarrow> z * y

goal (1 subgoal):
 1. (\<lambda>m. z * x m)\<up>z * y
[PROOF STEP]
by (simp add: mon_conv_real_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>m. z * x m)\<up>z * y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma delete_edges_delete_edge_commute:
    "delete_edges (delete_edge a1 a2 G) as = delete_edge a1 a2 (delete_edges G as)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FiniteListGraph.delete_edges (FiniteListGraph.delete_edge a1 a2 G) as = FiniteListGraph.delete_edge a1 a2 (FiniteListGraph.delete_edges G as)
[PROOF STEP]
proof (induction as arbitrary: G a1 a2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>G a1 a2. FiniteListGraph.delete_edges (FiniteListGraph.delete_edge a1 a2 G) [] = FiniteListGraph.delete_edge a1 a2 (FiniteListGraph.delete_edges G [])
 2. \<And>a as G a1 a2. (\<And>G a1 a2. FiniteListGraph.delete_edges (FiniteListGraph.delete_edge a1 a2 G) as = FiniteListGraph.delete_edge a1 a2 (FiniteListGraph.delete_edges G as)) \<Longrightarrow> FiniteListGraph.delete_edges (FiniteListGraph.delete_edge a1 a2 G) (a # as) = FiniteListGraph.delete_edge a1 a2 (FiniteListGraph.delete_edges G (a # as))
[PROOF STEP]
case (Cons f fs)
[PROOF STATE]
proof (state)
this:
FiniteListGraph.delete_edges (FiniteListGraph.delete_edge ?a1.0 ?a2.0 ?G) fs = FiniteListGraph.delete_edge ?a1.0 ?a2.0 (FiniteListGraph.delete_edges ?G fs)

goal (2 subgoals):
 1. \<And>G a1 a2. FiniteListGraph.delete_edges (FiniteListGraph.delete_edge a1 a2 G) [] = FiniteListGraph.delete_edge a1 a2 (FiniteListGraph.delete_edges G [])
 2. \<And>a as G a1 a2. (\<And>G a1 a2. FiniteListGraph.delete_edges (FiniteListGraph.delete_edge a1 a2 G) as = FiniteListGraph.delete_edge a1 a2 (FiniteListGraph.delete_edges G as)) \<Longrightarrow> FiniteListGraph.delete_edges (FiniteListGraph.delete_edge a1 a2 G) (a # as) = FiniteListGraph.delete_edge a1 a2 (FiniteListGraph.delete_edges G (a # as))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
FiniteListGraph.delete_edges (FiniteListGraph.delete_edge ?a1.0 ?a2.0 ?G) fs = FiniteListGraph.delete_edge ?a1.0 ?a2.0 (FiniteListGraph.delete_edges ?G fs)

goal (1 subgoal):
 1. FiniteListGraph.delete_edges (FiniteListGraph.delete_edge a1 a2 G) (f # fs) = FiniteListGraph.delete_edge a1 a2 (FiniteListGraph.delete_edges G (f # fs))
[PROOF STEP]
by (cases f) (simp add: delete_edge_commute)
[PROOF STATE]
proof (state)
this:
FiniteListGraph.delete_edges (FiniteListGraph.delete_edge a1 a2 G) (f # fs) = FiniteListGraph.delete_edge a1 a2 (FiniteListGraph.delete_edges G (f # fs))

goal (1 subgoal):
 1. \<And>G a1 a2. FiniteListGraph.delete_edges (FiniteListGraph.delete_edge a1 a2 G) [] = FiniteListGraph.delete_edge a1 a2 (FiniteListGraph.delete_edges G [])
[PROOF STEP]
qed simp


[STATEMENT]
lemma dim_vec_of_basis_enum'[simp]:
  \<open>dim_vec (vec_of_basis_enum (v::'a)) = length (canonical_basis::'a::basis_enum list)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (vec_of_basis_enum v) = length canonical_basis
[PROOF STEP]
unfolding vec_of_basis_enum_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (vec_of_list (map (crepresentation (set canonical_basis) v) canonical_basis)) = length canonical_basis
[PROOF STEP]
by simp


[STATEMENT]
lemma face_of_Int_supporting_hyperplane_le:
    "\<lbrakk>convex S; \<And>x. x \<in> S \<Longrightarrow> a \<bullet> x \<le> b\<rbrakk> \<Longrightarrow> (S \<inter> {x. a \<bullet> x = b}) face_of S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>convex S; \<And>x. x \<in> S \<Longrightarrow> a \<bullet> x \<le> b\<rbrakk> \<Longrightarrow> S \<inter> {x. a \<bullet> x = b} face_of S
[PROOF STEP]
by (simp add: convex_Int convex_hyperplane face_of_Int_supporting_hyperplane_le_strong)


[STATEMENT]
lemma zero_set_nonzero_set_covers:
"carrier (Q\<^sub>p\<^bsup>n\<^esup>) = SA_zero_set n f \<union> SA_nonzero_set n f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (Q\<^sub>p\<^bsup>n\<^esup>) = SA_zero_set n f \<union> SA_nonzero_set n f
[PROOF STEP]
unfolding SA_zero_set_def SA_nonzero_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (Q\<^sub>p\<^bsup>n\<^esup>) = {x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x = \<zero>} \<union> {x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x \<noteq> \<zero>}
[PROOF STEP]
apply(rule equalityI')
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> x \<in> {x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x = \<zero>} \<union> {x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x \<noteq> \<zero>}
 2. \<And>x. x \<in> {x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x = \<zero>} \<union> {x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x \<noteq> \<zero>} \<Longrightarrow> x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
[PROOF STEP]
unfolding mem_Collect_eq
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> x \<in> {x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x = \<zero>} \<union> {x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x \<noteq> \<zero>}
 2. \<And>x. x \<in> {x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x = \<zero>} \<union> {x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x \<noteq> \<zero>} \<Longrightarrow> x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x = \<zero>} \<union> {x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x \<noteq> \<zero>} \<Longrightarrow> x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
[PROOF STEP]
by blast


[STATEMENT]
lemma independent_basis_left_null_space:
fixes A::"'a::{field}^'cols::{mod_type}^'rows::{mod_type}"
shows "vec.independent (basis_left_null_space A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.independent (basis_left_null_space A)
[PROOF STEP]
proof (unfold basis_left_null_space_def, rule vec.independent_mono)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. vec.independent ?A
 2. {row i (P_Gauss_Jordan A) |i. rank A \<le> mod_type_class.to_nat i} \<subseteq> ?A
[PROOF STEP]
show "vec.independent (rows (P_Gauss_Jordan A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.independent (rows (P_Gauss_Jordan A))
[PROOF STEP]
by (metis P_Gauss_Jordan_def det_dependent_rows invertible_det_nz invertible_fst_Gauss_Jordan_PA)
[PROOF STATE]
proof (state)
this:
vec.independent (rows (P_Gauss_Jordan A))

goal (1 subgoal):
 1. {row i (P_Gauss_Jordan A) |i. rank A \<le> mod_type_class.to_nat i} \<subseteq> rows (P_Gauss_Jordan A)
[PROOF STEP]
show "{row i (P_Gauss_Jordan A) |i. rank A \<le> to_nat i} \<subseteq> (rows (P_Gauss_Jordan A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {row i (P_Gauss_Jordan A) |i. rank A \<le> mod_type_class.to_nat i} \<subseteq> rows (P_Gauss_Jordan A)
[PROOF STEP]
unfolding rows_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {row i (P_Gauss_Jordan A) |i. rank A \<le> mod_type_class.to_nat i} \<subseteq> {row i (P_Gauss_Jordan A) |i. i \<in> UNIV}
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
{row i (P_Gauss_Jordan A) |i. rank A \<le> mod_type_class.to_nat i} \<subseteq> rows (P_Gauss_Jordan A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Image_empty_rtrancl_Image_id:
  "R `` {v} = {} \<Longrightarrow> R\<^sup>* `` {v} = {v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R `` {v} = {} \<Longrightarrow> R\<^sup>* `` {v} = {v}
[PROOF STEP]
unfolding Image_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y. \<exists>x\<in>{v}. (x, y) \<in> R} = {} \<Longrightarrow> {y. \<exists>x\<in>{v}. (x, y) \<in> R\<^sup>*} = {v}
[PROOF STEP]
by (auto elim: converse_rtranclE)


[STATEMENT]
lemma "(10000::nat) mod 9 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 10000 mod 9 = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma beukers_integral1_integrable:
  "set_integrable lborel ({0<..<1}\<times>{0<..<1})
     (\<lambda>(x,y). (-ln (x*y) / (1 - x*y) * x^r * y^s :: real))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable lborel ({0<..<1} \<times> {0<..<1}) (\<lambda>(x, y). - ln (x * y) / (1 - x * y) * x ^ r * y ^ s)
[PROOF STEP]
proof (intro set_integrableI_nonneg AE_I2; clarify?)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. set_borel_measurable lborel ({0<..<1} \<times> {0<..<1}) (\<lambda>(x, y). - ln (x * y) / (1 - x * y) * x ^ r * y ^ s)
 2. \<And>a b. \<lbrakk>(a, b) \<in> space lborel; a \<in> {0<..<1}; b \<in> {0<..<1}\<rbrakk> \<Longrightarrow> 0 \<le> - ln (a * b) / (1 - a * b) * a ^ r * b ^ s
 3. \<integral>\<^sup>+x\<in>{0<..<1} \<times> {0<..<1}. ennreal (case x of (x, y) \<Rightarrow> - ln (x * y) / (1 - x * y) * x ^ r * y ^ s)\<partial>lborel < \<infinity>
[PROOF STEP]
fix x y :: real
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. set_borel_measurable lborel ({0<..<1} \<times> {0<..<1}) (\<lambda>(x, y). - ln (x * y) / (1 - x * y) * x ^ r * y ^ s)
 2. \<And>a b. \<lbrakk>(a, b) \<in> space lborel; a \<in> {0<..<1}; b \<in> {0<..<1}\<rbrakk> \<Longrightarrow> 0 \<le> - ln (a * b) / (1 - a * b) * a ^ r * b ^ s
 3. \<integral>\<^sup>+x\<in>{0<..<1} \<times> {0<..<1}. ennreal (case x of (x, y) \<Rightarrow> - ln (x * y) / (1 - x * y) * x ^ r * y ^ s)\<partial>lborel < \<infinity>
[PROOF STEP]
assume xy: "x \<in> {0<..<1}" "y \<in> {0<..<1}"
[PROOF STATE]
proof (state)
this:
x \<in> {0<..<1}
y \<in> {0<..<1}

goal (3 subgoals):
 1. set_borel_measurable lborel ({0<..<1} \<times> {0<..<1}) (\<lambda>(x, y). - ln (x * y) / (1 - x * y) * x ^ r * y ^ s)
 2. \<And>a b. \<lbrakk>(a, b) \<in> space lborel; a \<in> {0<..<1}; b \<in> {0<..<1}\<rbrakk> \<Longrightarrow> 0 \<le> - ln (a * b) / (1 - a * b) * a ^ r * b ^ s
 3. \<integral>\<^sup>+x\<in>{0<..<1} \<times> {0<..<1}. ennreal (case x of (x, y) \<Rightarrow> - ln (x * y) / (1 - x * y) * x ^ r * y ^ s)\<partial>lborel < \<infinity>
[PROOF STEP]
have "0 \<ge> ln (x * y) / (1 - x * y) * x ^ r * y ^ s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (x * y) / (1 - x * y) * x ^ r * y ^ s \<le> 0
[PROOF STEP]
using mult_strict_mono[of x 1 y 1]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x < 1; y < 1; 0 < 1; 0 \<le> y\<rbrakk> \<Longrightarrow> x * y < 1 * 1

goal (1 subgoal):
 1. ln (x * y) / (1 - x * y) * x ^ r * y ^ s \<le> 0
[PROOF STEP]
by (intro mult_nonpos_nonneg divide_nonpos_nonneg) (use xy in auto)
[PROOF STATE]
proof (state)
this:
ln (x * y) / (1 - x * y) * x ^ r * y ^ s \<le> 0

goal (3 subgoals):
 1. set_borel_measurable lborel ({0<..<1} \<times> {0<..<1}) (\<lambda>(x, y). - ln (x * y) / (1 - x * y) * x ^ r * y ^ s)
 2. \<And>a b. \<lbrakk>(a, b) \<in> space lborel; a \<in> {0<..<1}; b \<in> {0<..<1}\<rbrakk> \<Longrightarrow> 0 \<le> - ln (a * b) / (1 - a * b) * a ^ r * b ^ s
 3. \<integral>\<^sup>+x\<in>{0<..<1} \<times> {0<..<1}. ennreal (case x of (x, y) \<Rightarrow> - ln (x * y) / (1 - x * y) * x ^ r * y ^ s)\<partial>lborel < \<infinity>
[PROOF STEP]
thus "0 \<le> - ln (x * y) / (1 - x * y) * x ^ r * y ^ s"
[PROOF STATE]
proof (prove)
using this:
ln (x * y) / (1 - x * y) * x ^ r * y ^ s \<le> 0

goal (1 subgoal):
 1. 0 \<le> - ln (x * y) / (1 - x * y) * x ^ r * y ^ s
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> - ln (x * y) / (1 - x * y) * x ^ r * y ^ s

goal (2 subgoals):
 1. set_borel_measurable lborel ({0<..<1} \<times> {0<..<1}) (\<lambda>(x, y). - ln (x * y) / (1 - x * y) * x ^ r * y ^ s)
 2. \<integral>\<^sup>+x\<in>{0<..<1} \<times> {0<..<1}. ennreal (case x of (x, y) \<Rightarrow> - ln (x * y) / (1 - x * y) * x ^ r * y ^ s)\<partial>lborel < \<infinity>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set_borel_measurable lborel ({0<..<1} \<times> {0<..<1}) (\<lambda>(x, y). - ln (x * y) / (1 - x * y) * x ^ r * y ^ s)
 2. \<integral>\<^sup>+x\<in>{0<..<1} \<times> {0<..<1}. ennreal (case x of (x, y) \<Rightarrow> - ln (x * y) / (1 - x * y) * x ^ r * y ^ s)\<partial>lborel < \<infinity>
[PROOF STEP]
show "\<integral>\<^sup>+x\<in>{0<..<1}\<times>{0<..<1}. ennreal (case x of (x, y) \<Rightarrow>
           - ln (x * y) / (1 - x * y) * x ^ r * y ^ s) \<partial>lborel < \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0<..<1} \<times> {0<..<1}. ennreal (case x of (x, y) \<Rightarrow> - ln (x * y) / (1 - x * y) * x ^ r * y ^ s)\<partial>lborel < \<infinity>
[PROOF STEP]
using beukers_nn_integral1_finite
[PROOF STATE]
proof (prove)
using this:
beukers_nn_integral1 ?r ?s < \<infinity>

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0<..<1} \<times> {0<..<1}. ennreal (case x of (x, y) \<Rightarrow> - ln (x * y) / (1 - x * y) * x ^ r * y ^ s)\<partial>lborel < \<infinity>
[PROOF STEP]
by (simp add: beukers_nn_integral1_def case_prod_unfold)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0<..<1} \<times> {0<..<1}. ennreal (case x of (x, y) \<Rightarrow> - ln (x * y) / (1 - x * y) * x ^ r * y ^ s)\<partial>lborel < \<infinity>

goal (1 subgoal):
 1. set_borel_measurable lborel ({0<..<1} \<times> {0<..<1}) (\<lambda>(x, y). - ln (x * y) / (1 - x * y) * x ^ r * y ^ s)
[PROOF STEP]
qed (simp_all flip: lborel_prod add: set_borel_measurable_def)


[STATEMENT]
lemma gf_F_eq_F: "gf_F x y 1 = F x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gf_F x y 1 = F x y
[PROOF STEP]
using f_sums_F[THEN sums_unique]
[PROOF STATE]
proof (prove)
using this:
F ?x1 ?y1 = suminf (f ?x1 ?y1)

goal (1 subgoal):
 1. gf_F x y 1 = F x y
[PROOF STEP]
by (simp add: gf_F_def F_def)


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


[STATEMENT]
lemma finite_ball_include:
  fixes a :: "'a::metric_space"
  assumes "finite S"
  shows "\<exists>e>0. S \<subseteq> ball a e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>e>0. S \<subseteq> ball a e
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S

goal (1 subgoal):
 1. \<exists>e>0. S \<subseteq> ball a e
[PROOF STEP]
proof induction
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>e>0. {} \<subseteq> ball a e
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<exists>e>0. F \<subseteq> ball a e\<rbrakk> \<Longrightarrow> \<exists>e>0. insert x F \<subseteq> ball a e
[PROOF STEP]
case (insert x S)
[PROOF STATE]
proof (state)
this:
finite S
x \<notin> S
\<exists>e>0. S \<subseteq> ball a e

goal (2 subgoals):
 1. \<exists>e>0. {} \<subseteq> ball a e
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<exists>e>0. F \<subseteq> ball a e\<rbrakk> \<Longrightarrow> \<exists>e>0. insert x F \<subseteq> ball a e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite S
x \<notin> S
\<exists>e>0. S \<subseteq> ball a e
[PROOF STEP]
obtain e0 where "e0>0" and e0:"S \<subseteq> ball a e0"
[PROOF STATE]
proof (prove)
using this:
finite S
x \<notin> S
\<exists>e>0. S \<subseteq> ball a e

goal (1 subgoal):
 1. (\<And>e0. \<lbrakk>0 < e0; S \<subseteq> ball a e0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < e0
S \<subseteq> ball a e0

goal (2 subgoals):
 1. \<exists>e>0. {} \<subseteq> ball a e
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<exists>e>0. F \<subseteq> ball a e\<rbrakk> \<Longrightarrow> \<exists>e>0. insert x F \<subseteq> ball a e
[PROOF STEP]
define e where "e = max e0 (2 * dist a x)"
[PROOF STATE]
proof (state)
this:
e = max e0 (2 * dist a x)

goal (2 subgoals):
 1. \<exists>e>0. {} \<subseteq> ball a e
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<exists>e>0. F \<subseteq> ball a e\<rbrakk> \<Longrightarrow> \<exists>e>0. insert x F \<subseteq> ball a e
[PROOF STEP]
have "e>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < e
[PROOF STEP]
unfolding e_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < max e0 (2 * dist a x)
[PROOF STEP]
using \<open>e0>0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < e0

goal (1 subgoal):
 1. 0 < max e0 (2 * dist a x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < e

goal (2 subgoals):
 1. \<exists>e>0. {} \<subseteq> ball a e
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<exists>e>0. F \<subseteq> ball a e\<rbrakk> \<Longrightarrow> \<exists>e>0. insert x F \<subseteq> ball a e
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < e

goal (2 subgoals):
 1. \<exists>e>0. {} \<subseteq> ball a e
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<exists>e>0. F \<subseteq> ball a e\<rbrakk> \<Longrightarrow> \<exists>e>0. insert x F \<subseteq> ball a e
[PROOF STEP]
have "insert x S \<subseteq> ball a e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert x S \<subseteq> ball a e
[PROOF STEP]
using e0 \<open>e>0\<close>
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> ball a e0
0 < e

goal (1 subgoal):
 1. insert x S \<subseteq> ball a e
[PROOF STEP]
unfolding e_def
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> ball a e0
0 < max e0 (2 * dist a x)

goal (1 subgoal):
 1. insert x S \<subseteq> ball a (max e0 (2 * dist a x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insert x S \<subseteq> ball a e

goal (2 subgoals):
 1. \<exists>e>0. {} \<subseteq> ball a e
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<exists>e>0. F \<subseteq> ball a e\<rbrakk> \<Longrightarrow> \<exists>e>0. insert x F \<subseteq> ball a e
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 < e
insert x S \<subseteq> ball a e
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 < e
insert x S \<subseteq> ball a e

goal (1 subgoal):
 1. \<exists>e>0. insert x S \<subseteq> ball a e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>e>0. insert x S \<subseteq> ball a e

goal (1 subgoal):
 1. \<exists>e>0. {} \<subseteq> ball a e
[PROOF STEP]
qed (auto intro: zero_less_one)


[STATEMENT]
lemma LIMSEQ_norm_0:
  assumes  "\<And>n::nat. norm (f n) < 1 / real (Suc n)"
  shows "f \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
proof (rule metric_LIMSEQ_I)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. dist (f n) (0::'a) < r
[PROOF STEP]
fix \<epsilon> :: "real"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. dist (f n) (0::'a) < r
[PROOF STEP]
assume "\<epsilon> > 0"
[PROOF STATE]
proof (state)
this:
0 < \<epsilon>

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. dist (f n) (0::'a) < r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < \<epsilon>
[PROOF STEP]
obtain N::nat where "\<epsilon> > inverse N" "N > 0"
[PROOF STATE]
proof (prove)
using this:
0 < \<epsilon>

goal (1 subgoal):
 1. (\<And>N. \<lbrakk>inverse (real N) < \<epsilon>; 0 < N\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis neq0_conv real_arch_inverse)
[PROOF STATE]
proof (state)
this:
inverse (real N) < \<epsilon>
0 < N

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. dist (f n) (0::'a) < r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inverse (real N) < \<epsilon>
0 < N
[PROOF STEP]
have "norm (f n) < \<epsilon>" if "n \<ge> N" for n
[PROOF STATE]
proof (prove)
using this:
inverse (real N) < \<epsilon>
0 < N

goal (1 subgoal):
 1. norm (f n) < \<epsilon>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>inverse (real N) < \<epsilon>; 0 < N\<rbrakk> \<Longrightarrow> norm (f n) < \<epsilon>
[PROOF STEP]
have "1 / (Suc n) \<le> 1 / N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / real (Suc n) \<le> 1 / real N
[PROOF STEP]
using \<open>0 < N\<close> inverse_of_nat_le le_SucI that
[PROOF STATE]
proof (prove)
using this:
0 < N
\<lbrakk>?n \<le> ?m; ?n \<noteq> 0\<rbrakk> \<Longrightarrow> (1::?'a) / of_nat ?m \<le> (1::?'a) / of_nat ?n
?m \<le> ?n \<Longrightarrow> ?m \<le> Suc ?n
N \<le> n

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

goal (1 subgoal):
 1. \<lbrakk>inverse (real N) < \<epsilon>; 0 < N\<rbrakk> \<Longrightarrow> norm (f n) < \<epsilon>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 / real (Suc n) \<le> 1 / real N

goal (1 subgoal):
 1. \<lbrakk>inverse (real N) < \<epsilon>; 0 < N\<rbrakk> \<Longrightarrow> norm (f n) < \<epsilon>
[PROOF STEP]
have "\<dots> < \<epsilon>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / real N < \<epsilon>
[PROOF STEP]
by (metis (no_types) \<open>inverse (real N) < \<epsilon>\<close> inverse_eq_divide)
[PROOF STATE]
proof (state)
this:
1 / real N < \<epsilon>

goal (1 subgoal):
 1. \<lbrakk>inverse (real N) < \<epsilon>; 0 < N\<rbrakk> \<Longrightarrow> norm (f n) < \<epsilon>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
1 / real (Suc n) < \<epsilon>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 / real (Suc n) < \<epsilon>

goal (1 subgoal):
 1. norm (f n) < \<epsilon>
[PROOF STEP]
by (meson assms less_eq_real_def not_le order_trans)
[PROOF STATE]
proof (state)
this:
norm (f n) < \<epsilon>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
N \<le> ?n \<Longrightarrow> norm (f ?n) < \<epsilon>

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. dist (f n) (0::'a) < r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
N \<le> ?n \<Longrightarrow> norm (f ?n) < \<epsilon>
[PROOF STEP]
show "\<exists>no. \<forall>n\<ge>no. dist (f n) 0 < \<epsilon>"
[PROOF STATE]
proof (prove)
using this:
N \<le> ?n \<Longrightarrow> norm (f ?n) < \<epsilon>

goal (1 subgoal):
 1. \<exists>no. \<forall>n\<ge>no. dist (f n) (0::'a) < \<epsilon>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>no. \<forall>n\<ge>no. dist (f n) (0::'a) < \<epsilon>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_rabs_zero: "(f \<longlongrightarrow> (0::real)) F \<Longrightarrow> ((\<lambda>x. \<bar>f x\<bar>) \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> 0) F \<Longrightarrow> ((\<lambda>x. \<bar>f x\<bar>) \<longlongrightarrow> 0) F
[PROOF STEP]
by (fold real_norm_def) (rule tendsto_norm_zero)


[STATEMENT]
lemma mset_sift_down:
  "braun(Node l a r) \<Longrightarrow> mset_tree(sift_down l a r) = {#a#} + (mset_tree l + mset_tree r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. braun \<langle>l, a, r\<rangle> \<Longrightarrow> mset_tree (sift_down l a r) = {#a#} + (mset_tree l + mset_tree r)
[PROOF STEP]
by(induction l a r rule: sift_down.induct) (auto simp: ac_simps Let_def)


[STATEMENT]
lemma is_interval_closed_segment_1[intro, simp]: "is_interval (closed_segment a b)" for a b::real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_interval (closed_segment a b)
[PROOF STEP]
unfolding closed_segment_eq_real_ivl
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_interval (if a \<le> b then {a..b} else {b..a})
[PROOF STEP]
by (auto simp: is_interval_def)


[STATEMENT]
lemma exp_i_ne_1:
  assumes "0 < x" "x < 2*pi"
  shows "exp(\<i> * of_real x) \<noteq> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (\<i> * complex_of_real x) \<noteq> 1
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. exp (\<i> * complex_of_real x) = 1 \<Longrightarrow> False
[PROOF STEP]
assume "exp (\<i> * of_real x) = 1"
[PROOF STATE]
proof (state)
this:
exp (\<i> * complex_of_real x) = 1

goal (1 subgoal):
 1. exp (\<i> * complex_of_real x) = 1 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
exp (\<i> * complex_of_real x) = 1
[PROOF STEP]
have "exp (\<i> * of_real x) = exp 0"
[PROOF STATE]
proof (prove)
using this:
exp (\<i> * complex_of_real x) = 1

goal (1 subgoal):
 1. exp (\<i> * complex_of_real x) = exp 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
exp (\<i> * complex_of_real x) = exp 0

goal (1 subgoal):
 1. exp (\<i> * complex_of_real x) = 1 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
exp (\<i> * complex_of_real x) = exp 0
[PROOF STEP]
obtain n where "\<i> * of_real x = (of_int (2 * n) * pi) * \<i>"
[PROOF STATE]
proof (prove)
using this:
exp (\<i> * complex_of_real x) = exp 0

goal (1 subgoal):
 1. (\<And>n. \<i> * complex_of_real x = complex_of_real (real_of_int (2 * n) * pi) * \<i> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (simp only: Ints_def exp_eq) auto
[PROOF STATE]
proof (state)
this:
\<i> * complex_of_real x = complex_of_real (real_of_int (2 * n) * pi) * \<i>

goal (1 subgoal):
 1. exp (\<i> * complex_of_real x) = 1 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<i> * complex_of_real x = complex_of_real (real_of_int (2 * n) * pi) * \<i>
[PROOF STEP]
have "of_real x = (of_int (2 * n) * pi)"
[PROOF STATE]
proof (prove)
using this:
\<i> * complex_of_real x = complex_of_real (real_of_int (2 * n) * pi) * \<i>

goal (1 subgoal):
 1. of_real x = real_of_int (2 * n) * pi
[PROOF STEP]
by (metis complex_i_not_zero mult.commute mult_cancel_left of_real_eq_iff real_scaleR_def scaleR_conv_of_real)
[PROOF STATE]
proof (state)
this:
of_real x = real_of_int (2 * n) * pi

goal (1 subgoal):
 1. exp (\<i> * complex_of_real x) = 1 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
of_real x = real_of_int (2 * n) * pi
[PROOF STEP]
have "x = (of_int (2 * n) * pi)"
[PROOF STATE]
proof (prove)
using this:
of_real x = real_of_int (2 * n) * pi

goal (1 subgoal):
 1. x = real_of_int (2 * n) * pi
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x = real_of_int (2 * n) * pi

goal (1 subgoal):
 1. exp (\<i> * complex_of_real x) = 1 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = real_of_int (2 * n) * pi
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
x = real_of_int (2 * n) * pi

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x = real_of_int (2 * n) * pi
0 < x
x < 2 * pi

goal (1 subgoal):
 1. False
[PROOF STEP]
by (cases n) (auto simp: zero_less_mult_iff mult_less_0_iff)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma n_bool_lists2_correct: "set (n_bool_lists n x) = n_bool_lists2 n x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (n_bool_lists n x) = n_bool_lists2 n x
[PROOF STEP]
proof(standard)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set (n_bool_lists n x) \<subseteq> n_bool_lists2 n x
 2. n_bool_lists2 n x \<subseteq> set (n_bool_lists n x)
[PROOF STEP]
have "\<lbrakk>\<not> length ys < count_list ys True; x = length ys; n = count_list ys True\<rbrakk>
          \<Longrightarrow> ys \<in> permutations_of_multiset
                     (mset (replicate (count_list ys True) True) + mset (replicate (length ys - count_list ys True) False))"
          for ys
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> length ys < count_list ys True; x = length ys; n = count_list ys True\<rbrakk> \<Longrightarrow> ys \<in> permutations_of_multiset (mset (replicate (count_list ys True) True) + mset (replicate (length ys - count_list ys True) False))
[PROOF STEP]
using count_mset_replicate_aux2 permutations_of_multisetI
[PROOF STATE]
proof (prove)
using this:
\<not> length ?xs < count_list ?xs True \<Longrightarrow> mset ?xs = mset (replicate (count_list ?xs True) True) + mset (replicate (length ?xs - count_list ?xs True) False)
mset ?xs = ?A \<Longrightarrow> ?xs \<in> permutations_of_multiset ?A

goal (1 subgoal):
 1. \<lbrakk>\<not> length ys < count_list ys True; x = length ys; n = count_list ys True\<rbrakk> \<Longrightarrow> ys \<in> permutations_of_multiset (mset (replicate (count_list ys True) True) + mset (replicate (length ys - count_list ys True) False))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<not> length ?ys < count_list ?ys True; x = length ?ys; n = count_list ?ys True\<rbrakk> \<Longrightarrow> ?ys \<in> permutations_of_multiset (mset (replicate (count_list ?ys True) True) + mset (replicate (length ?ys - count_list ?ys True) False))

goal (2 subgoals):
 1. set (n_bool_lists n x) \<subseteq> n_bool_lists2 n x
 2. n_bool_lists2 n x \<subseteq> set (n_bool_lists n x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<not> length ?ys < count_list ?ys True; x = length ?ys; n = count_list ?ys True\<rbrakk> \<Longrightarrow> ?ys \<in> permutations_of_multiset (mset (replicate (count_list ?ys True) True) + mset (replicate (length ?ys - count_list ?ys True) False))
[PROOF STEP]
show "set (n_bool_lists n x) \<subseteq> n_bool_lists2 n x"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<not> length ?ys < count_list ?ys True; x = length ?ys; n = count_list ?ys True\<rbrakk> \<Longrightarrow> ?ys \<in> permutations_of_multiset (mset (replicate (count_list ?ys True) True) + mset (replicate (length ?ys - count_list ?ys True) False))

goal (1 subgoal):
 1. set (n_bool_lists n x) \<subseteq> n_bool_lists2 n x
[PROOF STEP]
unfolding n_bool_lists_correct
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<not> length ?ys < count_list ?ys True; x = length ?ys; n = count_list ?ys True\<rbrakk> \<Longrightarrow> ?ys \<in> permutations_of_multiset (mset (replicate (count_list ?ys True) True) + mset (replicate (length ?ys - count_list ?ys True) False))

goal (1 subgoal):
 1. {xs. length xs = x \<and> count_list xs True = n} \<subseteq> n_bool_lists2 n x
[PROOF STEP]
by (auto simp: count_le_length leD)
[PROOF STATE]
proof (state)
this:
set (n_bool_lists n x) \<subseteq> n_bool_lists2 n x

goal (1 subgoal):
 1. n_bool_lists2 n x \<subseteq> set (n_bool_lists n x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n_bool_lists2 n x \<subseteq> set (n_bool_lists n x)
[PROOF STEP]
have "\<lbrakk>\<not> x < n; ys \<in> permutations_of_multiset (mset (replicate n True) + mset (replicate (x - n) False))\<rbrakk>
          \<Longrightarrow> count (mset ys) True = n " for ys
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> x < n; ys \<in> permutations_of_multiset (mset (replicate n True) + mset (replicate (x - n) False))\<rbrakk> \<Longrightarrow> count (mset ys) True = n
[PROOF STEP]
using count_mset_replicate_aux1 permutations_of_multisetD
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<not> ?x < ?n; mset ?ys = mset (replicate ?n True) + mset (replicate (?x - ?n) False)\<rbrakk> \<Longrightarrow> count (mset ?ys) True = ?n
?xs \<in> permutations_of_multiset ?A \<Longrightarrow> mset ?xs = ?A

goal (1 subgoal):
 1. \<lbrakk>\<not> x < n; ys \<in> permutations_of_multiset (mset (replicate n True) + mset (replicate (x - n) False))\<rbrakk> \<Longrightarrow> count (mset ys) True = n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<not> x < n; ?ys \<in> permutations_of_multiset (mset (replicate n True) + mset (replicate (x - n) False))\<rbrakk> \<Longrightarrow> count (mset ?ys) True = n

goal (1 subgoal):
 1. n_bool_lists2 n x \<subseteq> set (n_bool_lists n x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<not> x < n; ?ys \<in> permutations_of_multiset (mset (replicate n True) + mset (replicate (x - n) False))\<rbrakk> \<Longrightarrow> count (mset ?ys) True = n
[PROOF STEP]
have "\<lbrakk>\<not> x < n; ys \<in> permutations_of_multiset (mset (replicate n True) + mset (replicate (x - n) False))\<rbrakk>
          \<Longrightarrow>  count_list ys True = n " for ys
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<not> x < n; ?ys \<in> permutations_of_multiset (mset (replicate n True) + mset (replicate (x - n) False))\<rbrakk> \<Longrightarrow> count (mset ?ys) True = n

goal (1 subgoal):
 1. \<lbrakk>\<not> x < n; ys \<in> permutations_of_multiset (mset (replicate n True) + mset (replicate (x - n) False))\<rbrakk> \<Longrightarrow> count_list ys True = n
[PROOF STEP]
by (simp add: count_list_count_mset)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<not> x < n; ?ys \<in> permutations_of_multiset (mset (replicate n True) + mset (replicate (x - n) False))\<rbrakk> \<Longrightarrow> count_list ?ys True = n

goal (1 subgoal):
 1. n_bool_lists2 n x \<subseteq> set (n_bool_lists n x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<not> x < n; ?ys \<in> permutations_of_multiset (mset (replicate n True) + mset (replicate (x - n) False))\<rbrakk> \<Longrightarrow> count_list ?ys True = n
[PROOF STEP]
show "n_bool_lists2 n x \<subseteq> set (n_bool_lists n x)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<not> x < n; ?ys \<in> permutations_of_multiset (mset (replicate n True) + mset (replicate (x - n) False))\<rbrakk> \<Longrightarrow> count_list ?ys True = n

goal (1 subgoal):
 1. n_bool_lists2 n x \<subseteq> set (n_bool_lists n x)
[PROOF STEP]
unfolding n_bool_lists_correct
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<not> x < n; ?ys \<in> permutations_of_multiset (mset (replicate n True) + mset (replicate (x - n) False))\<rbrakk> \<Longrightarrow> count_list ?ys True = n

goal (1 subgoal):
 1. n_bool_lists2 n x \<subseteq> {xs. length xs = x \<and> count_list xs True = n}
[PROOF STEP]
by (auto simp: length_finite_permutations_of_multiset)
[PROOF STATE]
proof (state)
this:
n_bool_lists2 n x \<subseteq> set (n_bool_lists n x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma emeasure_uniform_measure_1:
  "emeasure M S \<noteq> 0 \<Longrightarrow> emeasure M S \<noteq> \<infinity> \<Longrightarrow> emeasure (uniform_measure M S) S = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>emeasure M S \<noteq> 0; emeasure M S \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> emeasure (uniform_measure M S) S = 1
[PROOF STEP]
by (subst emeasure_uniform_measure)
     (simp_all add: emeasure_neq_0_sets emeasure_eq_ennreal_measure divide_ennreal
                    zero_less_iff_neq_zero[symmetric])


[STATEMENT]
lemma sumr_diff_mult_const2: "sum f {..<n} - of_nat n * r = (\<Sum>i<n. f i - r)"
  for r :: "'a::ring_1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..<n} - of_nat n * r = (\<Sum>i<n. f i - r)
[PROOF STEP]
by (simp add: sum_subtractf)


[STATEMENT]
lemma star_simulation_left:
  assumes "x * z \<le> z * y"
    shows "x\<^sup>\<star> * z \<le> z * y\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>\<star> * z \<le> z * y\<^sup>\<star>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x\<^sup>\<star> * z \<le> z * y\<^sup>\<star>
[PROOF STEP]
have "x * z * y\<^sup>\<star> \<le> z * y * y\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * z * y\<^sup>\<star> \<le> z * y * y\<^sup>\<star>
[PROOF STEP]
by (simp add: assms mult_left_isotone)
[PROOF STATE]
proof (state)
this:
x * z * y\<^sup>\<star> \<le> z * y * y\<^sup>\<star>

goal (1 subgoal):
 1. x\<^sup>\<star> * z \<le> z * y\<^sup>\<star>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * z * y\<^sup>\<star> \<le> z * y * y\<^sup>\<star>

goal (1 subgoal):
 1. x\<^sup>\<star> * z \<le> z * y\<^sup>\<star>
[PROOF STEP]
have "... \<le> z * y\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z * y * y\<^sup>\<star> \<le> z * y\<^sup>\<star>
[PROOF STEP]
by (simp add: mult_right_isotone star.left_plus_below_circ mult_assoc)
[PROOF STATE]
proof (state)
this:
z * y * y\<^sup>\<star> \<le> z * y\<^sup>\<star>

goal (1 subgoal):
 1. x\<^sup>\<star> * z \<le> z * y\<^sup>\<star>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x * z * y\<^sup>\<star> \<le> z * y\<^sup>\<star>
[PROOF STEP]
have "z \<squnion> x * z * y\<^sup>\<star> \<le> z * y\<^sup>\<star>"
[PROOF STATE]
proof (prove)
using this:
x * z * y\<^sup>\<star> \<le> z * y\<^sup>\<star>

goal (1 subgoal):
 1. z \<squnion> x * z * y\<^sup>\<star> \<le> z * y\<^sup>\<star>
[PROOF STEP]
using star.circ_back_loop_prefixpoint
[PROOF STATE]
proof (prove)
using this:
x * z * y\<^sup>\<star> \<le> z * y\<^sup>\<star>
?z * ?y\<^sup>\<star> * ?y \<squnion> ?z \<le> ?z * ?y\<^sup>\<star>

goal (1 subgoal):
 1. z \<squnion> x * z * y\<^sup>\<star> \<le> z * y\<^sup>\<star>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z \<squnion> x * z * y\<^sup>\<star> \<le> z * y\<^sup>\<star>

goal (1 subgoal):
 1. x\<^sup>\<star> * z \<le> z * y\<^sup>\<star>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
z \<squnion> x * z * y\<^sup>\<star> \<le> z * y\<^sup>\<star>

goal (1 subgoal):
 1. x\<^sup>\<star> * z \<le> z * y\<^sup>\<star>
[PROOF STEP]
by (simp add: star_left_induct mult_assoc)
[PROOF STATE]
proof (state)
this:
x\<^sup>\<star> * z \<le> z * y\<^sup>\<star>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ennreal_mult_le_self2I: "\<lbrakk> y > 0 \<Longrightarrow> x \<le> 1 \<rbrakk> \<Longrightarrow> x * y \<le> y" for x y :: ennreal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < y \<Longrightarrow> x \<le> 1) \<Longrightarrow> x * y \<le> y
[PROOF STEP]
apply(cases x; cases y)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>r ra. \<lbrakk>0 < y \<Longrightarrow> x \<le> 1; 0 \<le> r; x = ennreal r; 0 \<le> ra; y = ennreal ra\<rbrakk> \<Longrightarrow> x * y \<le> y
 2. \<And>r. \<lbrakk>0 < y \<Longrightarrow> x \<le> 1; 0 \<le> r; x = ennreal r; y = \<top>\<rbrakk> \<Longrightarrow> x * y \<le> y
 3. \<And>r. \<lbrakk>0 < y \<Longrightarrow> x \<le> 1; x = \<top>; 0 \<le> r; y = ennreal r\<rbrakk> \<Longrightarrow> x * y \<le> y
 4. \<lbrakk>0 < y \<Longrightarrow> x \<le> 1; x = \<top>; y = \<top>\<rbrakk> \<Longrightarrow> x * y \<le> y
[PROOF STEP]
apply(auto simp add: top_unique ennreal_top_mult ennreal_mult[symmetric] intro: ccontr)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r ra. \<lbrakk>0 < ra \<Longrightarrow> r \<le> 1; 0 \<le> r; x = ennreal r; 0 \<le> ra; y = ennreal ra\<rbrakk> \<Longrightarrow> r * ra \<le> ra
[PROOF STEP]
using mult_left_le_one_le
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(0::?'a) \<le> ?x; (0::?'a) \<le> ?y; ?y \<le> (1::?'a)\<rbrakk> \<Longrightarrow> ?y * ?x \<le> ?x

goal (1 subgoal):
 1. \<And>r ra. \<lbrakk>0 < ra \<Longrightarrow> r \<le> 1; 0 \<le> r; x = ennreal r; 0 \<le> ra; y = ennreal ra\<rbrakk> \<Longrightarrow> r * ra \<le> ra
[PROOF STEP]
by force


[STATEMENT]
lemma fpxs_root_order_pos [simp]: "fpxs_root_order f > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < fpxs_root_order f
[PROOF STEP]
proof transfer
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f. is_fpxs f \<Longrightarrow> 0 < nat (LCM r\<in>supp f. snd (quotient_of r))
[PROOF STEP]
fix f :: "rat \<Rightarrow> 'a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f. is_fpxs f \<Longrightarrow> 0 < nat (LCM r\<in>supp f. snd (quotient_of r))
[PROOF STEP]
assume f: "is_fpxs f"
[PROOF STATE]
proof (state)
this:
is_fpxs f

goal (1 subgoal):
 1. \<And>f. is_fpxs f \<Longrightarrow> 0 < nat (LCM r\<in>supp f. snd (quotient_of r))
[PROOF STEP]
hence "(LCM r\<in>supp f. snd (quotient_of r)) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
is_fpxs f

goal (1 subgoal):
 1. (LCM r\<in>supp f. snd (quotient_of r)) \<noteq> 0
[PROOF STEP]
by (auto simp: is_fpxs_def)
[PROOF STATE]
proof (state)
this:
(LCM r\<in>supp f. snd (quotient_of r)) \<noteq> 0

goal (1 subgoal):
 1. \<And>f. is_fpxs f \<Longrightarrow> 0 < nat (LCM r\<in>supp f. snd (quotient_of r))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(LCM r\<in>supp f. snd (quotient_of r)) \<noteq> 0

goal (1 subgoal):
 1. \<And>f. is_fpxs f \<Longrightarrow> 0 < nat (LCM r\<in>supp f. snd (quotient_of r))
[PROOF STEP]
have "(LCM r\<in>supp f. snd (quotient_of r)) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (LCM r\<in>supp f. snd (quotient_of r))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> (LCM r\<in>supp f. snd (quotient_of r))

goal (1 subgoal):
 1. \<And>f. is_fpxs f \<Longrightarrow> 0 < nat (LCM r\<in>supp f. snd (quotient_of r))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(LCM r\<in>supp f. snd (quotient_of r)) \<noteq> 0
0 \<le> (LCM r\<in>supp f. snd (quotient_of r))
[PROOF STEP]
show "nat (LCM r\<in>supp f. snd (quotient_of r)) > 0"
[PROOF STATE]
proof (prove)
using this:
(LCM r\<in>supp f. snd (quotient_of r)) \<noteq> 0
0 \<le> (LCM r\<in>supp f. snd (quotient_of r))

goal (1 subgoal):
 1. 0 < nat (LCM r\<in>supp f. snd (quotient_of r))
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
0 < nat (LCM r\<in>supp f. snd (quotient_of r))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma content_ball_conv_unit_ball:
  fixes c :: "'a :: euclidean_space"
  assumes "r \<ge> 0"
  shows "content (ball c r) = r ^ DIM('a) * content (ball (0 :: 'a) 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content (ball c r) = r ^ DIM('a) * content (ball (0::'a) 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. content (ball c r) = r ^ DIM('a) * content (ball (0::'a) 1)
[PROOF STEP]
have "ennreal (content (ball c r)) = emeasure lebesgue (ball c r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (content (ball c r)) = emeasure lebesgue (ball c r)
[PROOF STEP]
using emeasure_lborel_ball_finite[of c r]
[PROOF STATE]
proof (prove)
using this:
emeasure lborel (ball c r) < \<infinity>

goal (1 subgoal):
 1. ennreal (content (ball c r)) = emeasure lebesgue (ball c r)
[PROOF STEP]
by (subst emeasure_eq_ennreal_measure) auto
[PROOF STATE]
proof (state)
this:
ennreal (content (ball c r)) = emeasure lebesgue (ball c r)

goal (1 subgoal):
 1. content (ball c r) = r ^ DIM('a) * content (ball (0::'a) 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (content (ball c r)) = emeasure lebesgue (ball c r)

goal (1 subgoal):
 1. content (ball c r) = r ^ DIM('a) * content (ball (0::'a) 1)
[PROOF STEP]
have "\<dots> = ennreal (r ^ DIM('a)) * emeasure lebesgue (ball (0 :: 'a) 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure lebesgue (ball c r) = ennreal (r ^ DIM('a)) * emeasure lebesgue (ball (0::'a) 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> r

goal (1 subgoal):
 1. emeasure lebesgue (ball c r) = ennreal (r ^ DIM('a)) * emeasure lebesgue (ball (0::'a) 1)
[PROOF STEP]
by (intro emeasure_lebesgue_ball_conv_unit_ball) auto
[PROOF STATE]
proof (state)
this:
emeasure lebesgue (ball c r) = ennreal (r ^ DIM('a)) * emeasure lebesgue (ball (0::'a) 1)

goal (1 subgoal):
 1. content (ball c r) = r ^ DIM('a) * content (ball (0::'a) 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure lebesgue (ball c r) = ennreal (r ^ DIM('a)) * emeasure lebesgue (ball (0::'a) 1)

goal (1 subgoal):
 1. content (ball c r) = r ^ DIM('a) * content (ball (0::'a) 1)
[PROOF STEP]
have "\<dots> = ennreal (r ^ DIM('a) * content (ball (0::'a) 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (r ^ DIM('a)) * emeasure lebesgue (ball (0::'a) 1) = ennreal (r ^ DIM('a) * content (ball (0::'a) 1))
[PROOF STEP]
using emeasure_lborel_ball_finite[of "0::'a" 1] assms
[PROOF STATE]
proof (prove)
using this:
emeasure lborel (ball (0::'a) 1) < \<infinity>
0 \<le> r

goal (1 subgoal):
 1. ennreal (r ^ DIM('a)) * emeasure lebesgue (ball (0::'a) 1) = ennreal (r ^ DIM('a) * content (ball (0::'a) 1))
[PROOF STEP]
by (subst emeasure_eq_ennreal_measure) (auto simp: ennreal_mult')
[PROOF STATE]
proof (state)
this:
ennreal (r ^ DIM('a)) * emeasure lebesgue (ball (0::'a) 1) = ennreal (r ^ DIM('a) * content (ball (0::'a) 1))

goal (1 subgoal):
 1. content (ball c r) = r ^ DIM('a) * content (ball (0::'a) 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ennreal (content (ball c r)) = ennreal (r ^ DIM('a) * content (ball (0::'a) 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ennreal (content (ball c r)) = ennreal (r ^ DIM('a) * content (ball (0::'a) 1))

goal (1 subgoal):
 1. content (ball c r) = r ^ DIM('a) * content (ball (0::'a) 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
ennreal (content (ball c r)) = ennreal (r ^ DIM('a) * content (ball (0::'a) 1))
0 \<le> r

goal (1 subgoal):
 1. content (ball c r) = r ^ DIM('a) * content (ball (0::'a) 1)
[PROOF STEP]
by (subst (asm) ennreal_inj) auto
[PROOF STATE]
proof (state)
this:
content (ball c r) = r ^ DIM('a) * content (ball (0::'a) 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cofactorM_eq: "cofactorM = to_vec \<circ> Square_Matrix.cofactor \<circ> from_vec"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cofactorM = to_vec \<circ> Square_Matrix.cofactor \<circ> from_vec
[PROOF STEP]
unfolding cofactorM_def cofactor_def[abs_def] det_sq_matrix_eq[symmetric] minorM_eq fun_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. (\<chi>i j. Square_Matrix.det (from_vec (to_vec (minor (from_vec x) i j)))) = (to_vec \<circ> Square_Matrix.cofactor \<circ> from_vec) x
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (\<chi>i j. Square_Matrix.det (from_vec (to_vec (minor (from_vec x) i j)))) = (to_vec \<circ> Square_Matrix.cofactor \<circ> from_vec) x
[PROOF STEP]
apply transfer'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (\<chi>i j. \<Sum>p | p permutes UNIV. of_int (sign p) * (\<Prod>ia\<in>UNIV. (\<chi>ia ja. if ia = i \<and> ja = j then 1::'a else if ia = i \<or> ja = j then 0::'a else x $ ia $ ja) $ ia $ p ia)) = ((\<lambda>M. \<chi>i. vec_lambda (M i)) \<circ> (\<lambda>A i j. Square_Matrix.det (minor A i j)) \<circ> from_vec) x
[PROOF STEP]
apply (simp add: fun_eq_iff vec_eq_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<forall>i ia. (\<Sum>p | p permutes UNIV. of_int (sign p) * (\<Prod>ib\<in>UNIV. if ib = i \<and> p ib = ia then 1::'a else if ib = i \<or> p ib = ia then 0::'a else x $ ib $ p ib)) = Square_Matrix.det (minor (from_vec x) i ia)
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<forall>i ia. (\<Sum>p | p permutes UNIV. of_int (sign p) * (\<Prod>ib\<in>UNIV. if ib = i \<and> p ib = ia then 1::'a else if ib = i \<or> p ib = ia then 0::'a else x $ ib $ p ib)) = (\<Sum>p | p permutes UNIV. of_int (sign p) * (\<Prod>ib\<in>UNIV. if ib = i \<and> p ib = ia then 1::'a else if ib = i \<or> p ib = ia then 0::'a else x $ ib $ p ib))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma difference_eqvt_tvar[eqvt]:
  fixes pi::"tvar prm"
  and   Xs Ys::"tvar list"
  shows "pi\<bullet>(Xs - Ys) = (pi\<bullet>Xs) - (pi\<bullet>Ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pi \<bullet> (Xs - Ys) = pi \<bullet> Xs - pi \<bullet> Ys
[PROOF STEP]
by (induct Xs) (simp_all add: eqvts)


[STATEMENT]
lemma cong_square_alt_int:
  "prime p \<Longrightarrow> [a * a = 1] (mod p) \<Longrightarrow> [a = 1] (mod p) \<or> [a = p - 1] (mod p)"
  for a p :: "'a :: {normalization_semidom, linordered_idom, unique_euclidean_ring}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; [a * a = 1::'a] (mod p)\<rbrakk> \<Longrightarrow> [a = 1::'a] (mod p) \<or> [a = p - (1::'a)] (mod p)
[PROOF STEP]
using dvd_add_triv_right_iff[of p "a - (p - 1)"]
[PROOF STATE]
proof (prove)
using this:
(p dvd a - (p - (1::'a)) + p) = (p dvd a - (p - (1::'a)))

goal (1 subgoal):
 1. \<lbrakk>prime p; [a * a = 1::'a] (mod p)\<rbrakk> \<Longrightarrow> [a = 1::'a] (mod p) \<or> [a = p - (1::'a)] (mod p)
[PROOF STEP]
by (auto simp add: cong_iff_dvd_diff square_diff_one_factored dest!: prime_dvd_multD)


[STATEMENT]
lemma descending_chain_k:
  "descending_chain f \<Longrightarrow> f (m + k) \<le> f m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. descending_chain f \<Longrightarrow> f (m + k) \<le> f m
[PROOF STEP]
apply (induct k)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. descending_chain f \<Longrightarrow> f (m + 0) \<le> f m
 2. \<And>k. \<lbrakk>descending_chain f \<Longrightarrow> f (m + k) \<le> f m; descending_chain f\<rbrakk> \<Longrightarrow> f (m + Suc k) \<le> f m
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>descending_chain f \<Longrightarrow> f (m + k) \<le> f m; descending_chain f\<rbrakk> \<Longrightarrow> f (m + Suc k) \<le> f m
[PROOF STEP]
using le_add1 lift_Suc_antimono_le ord.descending_chain_def
[PROOF STATE]
proof (prove)
using this:
?n \<le> ?n + ?m
\<lbrakk>\<And>n. ?f (Suc n) \<le> ?f n; ?n \<le> ?n'\<rbrakk> \<Longrightarrow> ?f ?n' \<le> ?f ?n
ord.descending_chain ?less_eq ?f \<equiv> \<forall>n. ?less_eq (?f (Suc n)) (?f n)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>descending_chain f \<Longrightarrow> f (m + k) \<le> f m; descending_chain f\<rbrakk> \<Longrightarrow> f (m + Suc k) \<le> f m
[PROOF STEP]
by blast


[STATEMENT]
lemma vector_star_1:
  assumes "vector x"
    shows "x\<^sup>T * (x * x\<^sup>T)\<^sup>\<star> \<le> x\<^sup>T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>T * (x * x\<^sup>T)\<^sup>\<star> \<le> x\<^sup>T
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x\<^sup>T * (x * x\<^sup>T)\<^sup>\<star> \<le> x\<^sup>T
[PROOF STEP]
have "x\<^sup>T * (x * x\<^sup>T)\<^sup>\<star> = (x\<^sup>T * x)\<^sup>\<star> * x\<^sup>T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>T * (x * x\<^sup>T)\<^sup>\<star> = (x\<^sup>T * x)\<^sup>\<star> * x\<^sup>T
[PROOF STEP]
by (simp add: star_slide)
[PROOF STATE]
proof (state)
this:
x\<^sup>T * (x * x\<^sup>T)\<^sup>\<star> = (x\<^sup>T * x)\<^sup>\<star> * x\<^sup>T

goal (1 subgoal):
 1. x\<^sup>T * (x * x\<^sup>T)\<^sup>\<star> \<le> x\<^sup>T
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x\<^sup>T * (x * x\<^sup>T)\<^sup>\<star> = (x\<^sup>T * x)\<^sup>\<star> * x\<^sup>T

goal (1 subgoal):
 1. x\<^sup>T * (x * x\<^sup>T)\<^sup>\<star> \<le> x\<^sup>T
[PROOF STEP]
have "... \<le> top * x\<^sup>T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x\<^sup>T * x)\<^sup>\<star> * x\<^sup>T \<le> top * x\<^sup>T
[PROOF STEP]
by (simp add: mult_left_isotone)
[PROOF STATE]
proof (state)
this:
(x\<^sup>T * x)\<^sup>\<star> * x\<^sup>T \<le> top * x\<^sup>T

goal (1 subgoal):
 1. x\<^sup>T * (x * x\<^sup>T)\<^sup>\<star> \<le> x\<^sup>T
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x\<^sup>T * x)\<^sup>\<star> * x\<^sup>T \<le> top * x\<^sup>T

goal (1 subgoal):
 1. x\<^sup>T * (x * x\<^sup>T)\<^sup>\<star> \<le> x\<^sup>T
[PROOF STEP]
have "... = x\<^sup>T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. covector (x\<^sup>T)
[PROOF STEP]
using assms vector_conv_covector
[PROOF STATE]
proof (prove)
using this:
vector x
vector ?v = covector (?v\<^sup>T)

goal (1 subgoal):
 1. covector (x\<^sup>T)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
covector (x\<^sup>T)

goal (1 subgoal):
 1. x\<^sup>T * (x * x\<^sup>T)\<^sup>\<star> \<le> x\<^sup>T
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x\<^sup>T * (x * x\<^sup>T)\<^sup>\<star> \<le> x\<^sup>T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x\<^sup>T * (x * x\<^sup>T)\<^sup>\<star> \<le> x\<^sup>T

goal (1 subgoal):
 1. x\<^sup>T * (x * x\<^sup>T)\<^sup>\<star> \<le> x\<^sup>T
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x\<^sup>T * (x * x\<^sup>T)\<^sup>\<star> \<le> x\<^sup>T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma parent_two_children:
  "(c = l_child l p \<or> c = r_child l p) \<longleftrightarrow> parent l c = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c = l_child l p \<or> c = r_child l p) = (parent l c = p)
[PROOF STEP]
unfolding parent_def l_child_def r_child_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c = 2 * p - l + 1 \<or> c = 2 * p - l + 2) = (l + (c - l - 1) div 2 = p)
[PROOF STEP]
by linarith


[STATEMENT]
lemma dropWhile_map: "dropWhile P (map f xs) = map f (dropWhile (P \<circ> f) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dropWhile P (map f xs) = map f (dropWhile (P \<circ> f) xs)
[PROOF STEP]
by (induct xs) auto


[STATEMENT]
lemma biQuots_lQuots_rQuots: "biQuots x y A = lQuots x (rQuots y A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. biQuots x y A = lQuots x (rQuots y A)
[PROOF STEP]
unfolding biQuots_def rQuots_def lQuots_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {zs. x @ zs @ rev y \<in> A} = {ys. x @ ys \<in> {ys. ys @ rev y \<in> A}}
[PROOF STEP]
by auto


[STATEMENT]
lemma SINK_plus_current: "SINK (plus_current f g) = SINK f \<inter> SINK g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SINK (plus_current f g) = SINK f \<inter> SINK g
[PROOF STEP]
by(auto simp add: SINK.simps set_eq_iff d_OUT_def nn_integral_0_iff emeasure_count_space_eq_0 add_eq_0_iff_both_eq_0)


[STATEMENT]
lemma T_inorder2: "T_inorder2 t xs = 2*size t + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T_inorder2 t xs = 2 * size t + 1
[PROOF STEP]
by(induction t arbitrary: xs)(auto simp: T_inorder2_Leaf T_inorder2_Node)


[STATEMENT]
lemma two_pow_div_gt_le:
  "v < 2 ^ n div (2 ^ m :: nat) \<Longrightarrow> m \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v < 2 ^ n div 2 ^ m \<Longrightarrow> m \<le> n
[PROOF STEP]
by (clarsimp dest!: less_two_pow_divD)


[STATEMENT]
lemma subsequent_half_segments_ccw:
  fixes X
  assumes "Suc i < length (half_segments_of_aform X)"
  shows "ccw' (fst (half_segments_of_aform X ! i)) (snd (half_segments_of_aform X ! i))
    (snd (half_segments_of_aform X ! Suc i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ccw' (fst (half_segments_of_aform X ! i)) (snd (half_segments_of_aform X ! i)) (snd (half_segments_of_aform X ! Suc i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Suc i < length (half_segments_of_aform X)

goal (1 subgoal):
 1. ccw' (fst (half_segments_of_aform X ! i)) (snd (half_segments_of_aform X ! i)) (snd (half_segments_of_aform X ! Suc i))
[PROOF STEP]
by (intro ccw'_sortedP_subsequent )
    (auto simp: subsequent_half_segments half_segments_of_aform_def
      sorted_inl polychain_of_subsequent_eq intro!: ccw_sorted_implies_ccw'_sortedP[OF inl_ncoll]
      ccw'_sorted_scaleR)


[STATEMENT]
lemma maybe_negate_true: "(\<not>? x = true) = (x = false)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not>? x = true) = (x = false)
[PROOF STEP]
by (cases x, auto)