[STATEMENT]
lemma euclid_diff2:
   "PRE (\<lambda>s::nat store. s ''x'' = x \<and> s ''y'' = y \<and> x > 0 \<and> y > 0)
    (WHILE (\<lambda>s. s ''x''\<noteq> s ''y'') INV (\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y)
     DO
        (IF (\<lambda>s. s ''x'' >  s ''y'')
         THEN (''x'' ::= (\<lambda>s. s ''x'' - s ''y''))
         ELSE (''y'' ::= (\<lambda>s. s ''y'' - s ''x''))
         FI)
    OD)
    POST (\<lambda>s. s ''x'' = gcd x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rdom \<lceil>\<lambda>s. s ''x'' = x \<and> s ''y'' = y \<and> 0 < x \<and> 0 < y\<rceil> \<subseteq> wp (WHILE (\<lambda>s. s ''x'' \<noteq> s ''y'') INV (\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y) DO (IF (\<lambda>s. s ''y'' < s ''x'') THEN (''x'' ::= (\<lambda>s. s ''x'' - s ''y'')) ELSE (''y'' ::= (\<lambda>s. s ''y'' - s ''x'')) FI) OD) \<lceil>\<lambda>s. s ''x'' = gcd x y\<rceil>
[PROOF STEP]
apply (hoare, simp_all)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>s. gcd (s ''x'') (s ''y'') = gcd x y \<and> s ''x'' = s ''y'' \<longrightarrow> s ''y'' = gcd x y
 2. \<forall>s. gcd (s ''x'') (s ''y'') = gcd x y \<and> s ''x'' \<noteq> s ''y'' \<longrightarrow> (s ''y'' < s ''x'' \<longrightarrow> gcd (s ''x'' - s ''y'') (s ''y'') = gcd x y) \<and> (s ''y'' < s ''x'' \<or> gcd (s ''x'') (s ''y'' - s ''x'') = gcd x y)
[PROOF STEP]
apply auto[1]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>s. gcd (s ''x'') (s ''y'') = gcd x y \<and> s ''x'' \<noteq> s ''y'' \<longrightarrow> (s ''y'' < s ''x'' \<longrightarrow> gcd (s ''x'' - s ''y'') (s ''y'') = gcd x y) \<and> (s ''y'' < s ''x'' \<or> gcd (s ''x'') (s ''y'' - s ''x'') = gcd x y)
[PROOF STEP]
by (metis gcd.commute gcd_diff1_nat le_cases nat_less_le)


[STATEMENT]
lemma contour_integral_subpath_combine_less:
  assumes "f contour_integrable_on g" "valid_path g" "u \<in> {0..1}" "v \<in> {0..1}" "w \<in> {0..1}"
          "u<v" "v<w"
    shows "contour_integral (subpath u v g) f + contour_integral (subpath v w g) f =
           contour_integral (subpath u w g) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f
[PROOF STEP]
have "(\<lambda>x. f (g x) * vector_derivative g (at x)) integrable_on {u..w}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f (g x) * vector_derivative g (at x)) integrable_on {u..w}
[PROOF STEP]
using integrable_on_subcbox [where a=u and b=w and S = "{0..1}"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f integrable_on {0..1}; cbox u w \<subseteq> {0..1}\<rbrakk> \<Longrightarrow> ?f integrable_on cbox u w
f contour_integrable_on g
valid_path g
u \<in> {0..1}
v \<in> {0..1}
w \<in> {0..1}
u < v
v < w

goal (1 subgoal):
 1. (\<lambda>x. f (g x) * vector_derivative g (at x)) integrable_on {u..w}
[PROOF STEP]
by (auto simp: contour_integrable_on)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f (g x) * vector_derivative g (at x)) integrable_on {u..w}

goal (1 subgoal):
 1. contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
f contour_integrable_on g
valid_path g
u \<in> {0..1}
v \<in> {0..1}
w \<in> {0..1}
u < v
v < w
(\<lambda>x. f (g x) * vector_derivative g (at x)) integrable_on {u..w}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f contour_integrable_on g
valid_path g
u \<in> {0..1}
v \<in> {0..1}
w \<in> {0..1}
u < v
v < w
(\<lambda>x. f (g x) * vector_derivative g (at x)) integrable_on {u..w}

goal (1 subgoal):
 1. contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f
[PROOF STEP]
by (auto simp: contour_integral_subcontour_integral Henstock_Kurzweil_Integration.integral_combine)
[PROOF STATE]
proof (state)
this:
contour_integral (subpath u v g) f + contour_integral (subpath v w g) f = contour_integral (subpath u w g) f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vector_derivative_part_circlepath01:
    "\<lbrakk>0 \<le> x; x \<le> 1\<rbrakk>
     \<Longrightarrow> vector_derivative (part_circlepath z r s t) (at x within {0..1}) =
          \<i> * r * (of_real t - of_real s) * exp(\<i> * linepath s t x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> vector_derivative (part_circlepath z r s t) (at x within {0..1}) = \<i> * complex_of_real r * (complex_of_real t - complex_of_real s) * exp (\<i> * complex_of_real (linepath s t x))
[PROOF STEP]
using has_vector_derivative_part_circlepath
[PROOF STATE]
proof (prove)
using this:
(part_circlepath ?z ?r ?s ?t has_vector_derivative \<i> * complex_of_real ?r * (complex_of_real ?t - complex_of_real ?s) * exp (\<i> * complex_of_real (linepath ?s ?t ?x))) (at ?x within ?X)

goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> vector_derivative (part_circlepath z r s t) (at x within {0..1}) = \<i> * complex_of_real r * (complex_of_real t - complex_of_real s) * exp (\<i> * complex_of_real (linepath s t x))
[PROOF STEP]
by (auto simp: vector_derivative_at_within_ivl)


[STATEMENT]
lemma sqrt_two_squared_cpx: "complex_of_real (sqrt 2) * complex_of_real (sqrt 2) = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (sqrt 2) * complex_of_real (sqrt 2) = 2
[PROOF STEP]
by (metis mult_2_right numeral_Bit0 of_real_mult of_real_numeral real_sqrt_four real_sqrt_mult)


[STATEMENT]
lemma mtx_idx_unique_conv[simp]:
    fixes M :: nat
    assumes "j<M" "j'<M"
    shows "(i * M + j = i' * M + j') \<longleftrightarrow> (i=i' \<and> j=j')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i * M + j = i' * M + j') = (i = i' \<and> j = j')
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
j < M
j' < M

goal (1 subgoal):
 1. (i * M + j = i' * M + j') = (i = i' \<and> j = j')
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>j < M; j' < M; i * M + j = i' * M + j'\<rbrakk> \<Longrightarrow> i = i'
 2. \<lbrakk>j < M; j' < M; i * M + j = i' * M + j'\<rbrakk> \<Longrightarrow> j = j'
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j < M; j' < M; i * M + j = i' * M + j'\<rbrakk> \<Longrightarrow> i = i'
[PROOF STEP]
by (metis add_right_cancel div_if div_mult_self3 linorder_neqE_nat not_less0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j < M; j' < M; i * M + j = i' * M + j'\<rbrakk> \<Longrightarrow> j = j'
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j < M; j' < M; i * M + j = i' * M + j'\<rbrakk> \<Longrightarrow> j = j'
[PROOF STEP]
using \<open>\<lbrakk>j < M; j' < M; i * M + j = i' * M + j'\<rbrakk> \<Longrightarrow> i = i'\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>j < M; j' < M; i * M + j = i' * M + j'\<rbrakk> \<Longrightarrow> i = i'

goal (1 subgoal):
 1. \<lbrakk>j < M; j' < M; i * M + j = i' * M + j'\<rbrakk> \<Longrightarrow> j = j'
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem pr_index_enumerator_inj1: "pr_index_enumerator n1 m = pr_index_enumerator n2 m \<Longrightarrow> n1 = n2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pr_index_enumerator n1 m = pr_index_enumerator n2 m \<Longrightarrow> n1 = n2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pr_index_enumerator n1 m = pr_index_enumerator n2 m \<Longrightarrow> n1 = n2
[PROOF STEP]
assume A: "pr_index_enumerator n1 m = pr_index_enumerator n2 m"
[PROOF STATE]
proof (state)
this:
pr_index_enumerator n1 m = pr_index_enumerator n2 m

goal (1 subgoal):
 1. pr_index_enumerator n1 m = pr_index_enumerator n2 m \<Longrightarrow> n1 = n2
[PROOF STEP]
define f where "f x = pr_index_enumerator x m" for x
[PROOF STATE]
proof (state)
this:
f ?x = pr_index_enumerator ?x m

goal (1 subgoal):
 1. pr_index_enumerator n1 m = pr_index_enumerator n2 m \<Longrightarrow> n1 = n2
[PROOF STEP]
have f_mono: "\<forall> x y. (x < y \<longrightarrow> f x < f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. x < y \<longrightarrow> f x < f y
[PROOF STEP]
proof (rule allI, rule allI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. x < y \<longrightarrow> f x < f y
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. x < y \<longrightarrow> f x < f y
[PROOF STEP]
show "x < y \<longrightarrow> f x < f y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < y \<longrightarrow> f x < f y
[PROOF STEP]
by (unfold f_def, simp add: pr_index_enumerator_mono1)
[PROOF STATE]
proof (state)
this:
x < y \<longrightarrow> f x < f y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x y. x < y \<longrightarrow> f x < f y

goal (1 subgoal):
 1. pr_index_enumerator n1 m = pr_index_enumerator n2 m \<Longrightarrow> n1 = n2
[PROOF STEP]
from f_mono
[PROOF STATE]
proof (chain)
picking this:
\<forall>x y. x < y \<longrightarrow> f x < f y
[PROOF STEP]
have "\<forall> x y. (f x = f y \<longrightarrow> x = y)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. x < y \<longrightarrow> f x < f y

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

goal (1 subgoal):
 1. pr_index_enumerator n1 m = pr_index_enumerator n2 m \<Longrightarrow> n1 = n2
[PROOF STEP]
with A f_def
[PROOF STATE]
proof (chain)
picking this:
pr_index_enumerator n1 m = pr_index_enumerator n2 m
f ?x = pr_index_enumerator ?x m
\<forall>x y. f x = f y \<longrightarrow> x = y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
pr_index_enumerator n1 m = pr_index_enumerator n2 m
f ?x = pr_index_enumerator ?x m
\<forall>x y. f x = f y \<longrightarrow> x = y

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eventually_mono_sequentially:
  assumes "eventually P sequentially"
  assumes "\<And>x. P (x+k) \<Longrightarrow> Q (x+k)"
  shows "eventually Q sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually Q sequentially
[PROOF STEP]
using sequentially_offset[OF assms(1),of k]
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F i in sequentially. P (i + k)

goal (1 subgoal):
 1. eventually Q sequentially
[PROOF STEP]
apply (subst eventually_sequentially_seg[symmetric,of _ k])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F i in sequentially. P (i + k) \<Longrightarrow> \<forall>\<^sub>F n in sequentially. Q (n + k)
[PROOF STEP]
apply (elim eventually_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. P (x + k) \<Longrightarrow> Q (x + k)
[PROOF STEP]
by fact


[STATEMENT]
lemma decseq_harm_diff_ln: "decseq (\<lambda>n. harm (Suc n) - ln (Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. decseq (\<lambda>n. harm (Suc n) - ln (real (Suc n)))
[PROOF STEP]
proof (rule decseq_SucI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. harm (Suc (Suc n)) - ln (real (Suc (Suc n))) \<le> harm (Suc n) - ln (real (Suc n))
[PROOF STEP]
fix m :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. harm (Suc (Suc n)) - ln (real (Suc (Suc n))) \<le> harm (Suc n) - ln (real (Suc n))
[PROOF STEP]
define n where "n = Suc m"
[PROOF STATE]
proof (state)
this:
n = Suc m

goal (1 subgoal):
 1. \<And>n. harm (Suc (Suc n)) - ln (real (Suc (Suc n))) \<le> harm (Suc n) - ln (real (Suc n))
[PROOF STEP]
have "n > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n
[PROOF STEP]
by (simp add: n_def)
[PROOF STATE]
proof (state)
this:
0 < n

goal (1 subgoal):
 1. \<And>n. harm (Suc (Suc n)) - ln (real (Suc (Suc n))) \<le> harm (Suc n) - ln (real (Suc n))
[PROOF STEP]
have "convex_on {0<..} (\<lambda>x :: real. -ln x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_on {0<..} (\<lambda>x. - ln x)
[PROOF STEP]
by (rule convex_on_realI[where f' = "\<lambda>x. -1/x"])
       (auto intro!: derivative_eq_intros simp: field_simps)
[PROOF STATE]
proof (state)
this:
convex_on {0<..} (\<lambda>x. - ln x)

goal (1 subgoal):
 1. \<And>n. harm (Suc (Suc n)) - ln (real (Suc (Suc n))) \<le> harm (Suc n) - ln (real (Suc n))
[PROOF STEP]
hence "(-1 / (n + 1)) * (real n - real (n + 1)) \<le> (- ln (real n)) - (-ln (real (n + 1)))"
[PROOF STATE]
proof (prove)
using this:
convex_on {0<..} (\<lambda>x. - ln x)

goal (1 subgoal):
 1. - 1 / real (n + 1) * (real n - real (n + 1)) \<le> - ln (real n) - - ln (real (n + 1))
[PROOF STEP]
using \<open>n > 0\<close>
[PROOF STATE]
proof (prove)
using this:
convex_on {0<..} (\<lambda>x. - ln x)
0 < n

goal (1 subgoal):
 1. - 1 / real (n + 1) * (real n - real (n + 1)) \<le> - ln (real n) - - ln (real (n + 1))
[PROOF STEP]
by (intro convex_on_imp_above_tangent[where A = "{0<..}"])
                     (auto intro!: derivative_eq_intros simp: interior_open)
[PROOF STATE]
proof (state)
this:
- 1 / real (n + 1) * (real n - real (n + 1)) \<le> - ln (real n) - - ln (real (n + 1))

goal (1 subgoal):
 1. \<And>n. harm (Suc (Suc n)) - ln (real (Suc (Suc n))) \<le> harm (Suc n) - ln (real (Suc n))
[PROOF STEP]
thus "harm (Suc n) - ln (Suc n) \<le> harm n - ln n"
[PROOF STATE]
proof (prove)
using this:
- 1 / real (n + 1) * (real n - real (n + 1)) \<le> - ln (real n) - - ln (real (n + 1))

goal (1 subgoal):
 1. harm (Suc n) - ln (real (Suc n)) \<le> harm n - ln (real n)
[PROOF STEP]
by (auto simp: harm_Suc field_simps)
[PROOF STATE]
proof (state)
this:
harm (Suc n) - ln (real (Suc n)) \<le> harm n - ln (real n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma minus_q_mult_cancel:
  assumes "[a = e + b - q * c - d] (mod q)"
    and "e + b - d > 0"
    and "e + b - q * c - d > 0"
  shows  "[a = e + b  - d] (mod q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a = e + b - d] (mod q)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [a = e + b - d] (mod q)
[PROOF STEP]
have "a mod q = (e + b - q * c - d) mod q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a mod q = (e + b - q * c - d) mod q
[PROOF STEP]
using assms(1) cong_def
[PROOF STATE]
proof (prove)
using this:
[a = e + b - q * c - d] (mod q)
[?b = ?c] (mod ?a) = (?b mod ?a = ?c mod ?a)

goal (1 subgoal):
 1. a mod q = (e + b - q * c - d) mod q
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a mod q = (e + b - q * c - d) mod q

goal (1 subgoal):
 1. [a = e + b - d] (mod q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a mod q = (e + b - q * c - d) mod q
[PROOF STEP]
have "a mod q = (e + b - d) mod q"
[PROOF STATE]
proof (prove)
using this:
a mod q = (e + b - q * c - d) mod q

goal (1 subgoal):
 1. a mod q = (e + b - d) mod q
[PROOF STEP]
by (metis (no_types) add_cancel_left_left assms(3) diff_commute diff_is_0_eq' linordered_semidom_class.add_diff_inverse mod_add_left_eq mod_mult_self1_is_0 nat_less_le)
[PROOF STATE]
proof (state)
this:
a mod q = (e + b - d) mod q

goal (1 subgoal):
 1. [a = e + b - d] (mod q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a mod q = (e + b - d) mod q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a mod q = (e + b - d) mod q

goal (1 subgoal):
 1. [a = e + b - d] (mod q)
[PROOF STEP]
using cong_def
[PROOF STATE]
proof (prove)
using this:
a mod q = (e + b - d) mod q
[?b = ?c] (mod ?a) = (?b mod ?a = ?c mod ?a)

goal (1 subgoal):
 1. [a = e + b - d] (mod q)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[a = e + b - d] (mod q)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma power_diff_inverse:
  assumes nz: "(a::'a::field) ~= 0"
  shows "m <= n ==> (inverse a) ^ (n-m) = (a^m) / (a^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> n \<Longrightarrow> inverse a ^ (n - m) = a ^ m / a ^ n
[PROOF STEP]
apply (induct n m rule: diff_induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. 0 \<le> x \<Longrightarrow> inverse a ^ (x - 0) = a ^ 0 / a ^ x
 2. \<And>y. Suc y \<le> 0 \<Longrightarrow> inverse a ^ (0 - Suc y) = a ^ Suc y / a ^ 0
 3. \<And>x y. \<lbrakk>y \<le> x \<Longrightarrow> inverse a ^ (x - y) = a ^ y / a ^ x; Suc y \<le> Suc x\<rbrakk> \<Longrightarrow> inverse a ^ (Suc x - Suc y) = a ^ Suc y / a ^ Suc x
[PROOF STEP]
apply (simp add: power_inverse
      nonzero_inverse_eq_divide [THEN sym] nz)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>y. Suc y \<le> 0 \<Longrightarrow> inverse a ^ (0 - Suc y) = a ^ Suc y / a ^ 0
 2. \<And>x y. \<lbrakk>y \<le> x \<Longrightarrow> inverse a ^ (x - y) = a ^ y / a ^ x; Suc y \<le> Suc x\<rbrakk> \<Longrightarrow> inverse a ^ (Suc x - Suc y) = a ^ Suc y / a ^ Suc x
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>y \<le> x \<Longrightarrow> inverse a ^ (x - y) = a ^ y / a ^ x; Suc y \<le> Suc x\<rbrakk> \<Longrightarrow> inverse a ^ (Suc x - Suc y) = a ^ Suc y / a ^ Suc x
[PROOF STEP]
apply (simp add: nz)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma linepath_of_real: "(linepath (of_real a) (of_real b) x) = of_real ((1 - x)*a + x*b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linepath (of_real a) (of_real b) x = of_real ((1 - x) * a + x * b)
[PROOF STEP]
by (simp add: scaleR_conv_of_real linepath_def)


[STATEMENT]
lemma real_sqrt_zero [simp]: "sqrt 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt 0 = 0
[PROOF STEP]
unfolding sqrt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root 2 0 = 0
[PROOF STEP]
by (rule real_root_zero)


[STATEMENT]
lemma dvd_power_minus_1_conv2:
  fixes x::nat
  assumes x: "x > 1"
    and a: "a > 0"
    and a_dvd_b: "a dvd b"
    and b0: "b > 0"
  shows "x ^ a - 1 dvd x^b - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ a - 1 dvd x ^ b - 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x ^ a - 1 dvd x ^ b - 1
[PROOF STEP]
define q where q[simp]: "q = b div a"
[PROOF STATE]
proof (state)
this:
q = b div a

goal (1 subgoal):
 1. x ^ a - 1 dvd x ^ b - 1
[PROOF STEP]
have b: "b = a * q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b = a * q
[PROOF STEP]
using a_dvd_b
[PROOF STATE]
proof (prove)
using this:
a dvd b

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

goal (1 subgoal):
 1. x ^ a - 1 dvd x ^ b - 1
[PROOF STEP]
have "x^b - 1 = ((x ^ a) - 1) * sum ((^) (x ^ a)) {..<q}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ b - 1 = (x ^ a - 1) * sum ((^) (x ^ a)) {..<q}
[PROOF STEP]
unfolding b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ (a * q) - 1 = (x ^ a - 1) * sum ((^) (x ^ a)) {..<q}
[PROOF STEP]
by (rule x_power_aq_minus_1_rw[OF x a b0])
[PROOF STATE]
proof (state)
this:
x ^ b - 1 = (x ^ a - 1) * sum ((^) (x ^ a)) {..<q}

goal (1 subgoal):
 1. x ^ a - 1 dvd x ^ b - 1
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x ^ b - 1 = (x ^ a - 1) * sum ((^) (x ^ a)) {..<q}

goal (1 subgoal):
 1. x ^ a - 1 dvd x ^ b - 1
[PROOF STEP]
unfolding dvd_def
[PROOF STATE]
proof (prove)
using this:
x ^ b - 1 = (x ^ a - 1) * sum ((^) (x ^ a)) {..<q}

goal (1 subgoal):
 1. \<exists>k. x ^ b - 1 = (x ^ a - 1) * k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x ^ a - 1 dvd x ^ b - 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem (in group) group_inverse_equality:
  assumes eq: "x' * x = 1"
  shows "inverse x = x'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse x = x'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inverse x = x'
[PROOF STEP]
have "inverse x = 1 * inverse x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse x = (1::'a) * inverse x
[PROOF STEP]
by (simp only: group_left_one)
[PROOF STATE]
proof (state)
this:
inverse x = (1::'a) * inverse x

goal (1 subgoal):
 1. inverse x = x'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
inverse x = (1::'a) * inverse x

goal (1 subgoal):
 1. inverse x = x'
[PROOF STEP]
have "\<dots> = (x' * x) * inverse x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) * inverse x = x' * x * inverse x
[PROOF STEP]
by (simp only: eq)
[PROOF STATE]
proof (state)
this:
(1::'a) * inverse x = x' * x * inverse x

goal (1 subgoal):
 1. inverse x = x'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1::'a) * inverse x = x' * x * inverse x

goal (1 subgoal):
 1. inverse x = x'
[PROOF STEP]
have "\<dots> = x' * (x * inverse x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x' * x * inverse x = x' * (x * inverse x)
[PROOF STEP]
by (simp only: group_assoc)
[PROOF STATE]
proof (state)
this:
x' * x * inverse x = x' * (x * inverse x)

goal (1 subgoal):
 1. inverse x = x'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x' * x * inverse x = x' * (x * inverse x)

goal (1 subgoal):
 1. inverse x = x'
[PROOF STEP]
have "\<dots> = x' * 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x' * (x * inverse x) = x' * (1::'a)
[PROOF STEP]
by (simp only: group_right_inverse)
[PROOF STATE]
proof (state)
this:
x' * (x * inverse x) = x' * (1::'a)

goal (1 subgoal):
 1. inverse x = x'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x' * (x * inverse x) = x' * (1::'a)

goal (1 subgoal):
 1. inverse x = x'
[PROOF STEP]
have "\<dots> = x'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x' * (1::'a) = x'
[PROOF STEP]
by (simp only: group_right_one)
[PROOF STATE]
proof (state)
this:
x' * (1::'a) = x'

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

goal (1 subgoal):
 1. inverse x = x'
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
inverse x = x'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sin_exp_eq: "sin z = (exp(\<i> * z) - exp(-(\<i> * z))) / (2*\<i>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin z = (exp (\<i> * z) - exp (- (\<i> * z))) / (2 * \<i>)
[PROOF STEP]
by (simp add: exp_Euler exp_minus_Euler)


[STATEMENT]
lemma prime_gr4 :
  assumes "is_prime p"
      and "p mod 4 = 1"
    shows "p > 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 < p
[PROOF STEP]
proof(rule ccontr, drule leI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<le> 4 \<Longrightarrow> False
[PROOF STEP]
assume "p \<le> 4"
[PROOF STATE]
proof (state)
this:
p \<le> 4

goal (1 subgoal):
 1. p \<le> 4 \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
p \<le> 4

goal (1 subgoal):
 1. False
[PROOF STEP]
by (metis assms dvd_imp_mod_0 dvd_triv_left is_prime_def mod_less mult.right_neutral
        order_less_le zero_neq_one)
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma m_s_anti_mono_rep: assumes "\<forall>x. S1 x \<le> S2 x"
shows "(\<Sum>x\<in>X. m (S2 x)) \<le> (\<Sum>x\<in>X. m (S1 x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>X. m (S2 x)) \<le> (\<Sum>x\<in>X. m (S1 x))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>x\<in>X. m (S2 x)) \<le> (\<Sum>x\<in>X. m (S1 x))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. S1 x \<le> S2 x
[PROOF STEP]
have "\<forall>x. m(S1 x) \<ge> m(S2 x)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. S1 x \<le> S2 x

goal (1 subgoal):
 1. \<forall>x. m (S2 x) \<le> m (S1 x)
[PROOF STEP]
by (metis m_anti_mono)
[PROOF STATE]
proof (state)
this:
\<forall>x. m (S2 x) \<le> m (S1 x)

goal (1 subgoal):
 1. (\<Sum>x\<in>X. m (S2 x)) \<le> (\<Sum>x\<in>X. m (S1 x))
[PROOF STEP]
thus "(\<Sum>x\<in>X. m (S2 x)) \<le> (\<Sum>x\<in>X. m (S1 x))"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. m (S2 x) \<le> m (S1 x)

goal (1 subgoal):
 1. (\<Sum>x\<in>X. m (S2 x)) \<le> (\<Sum>x\<in>X. m (S1 x))
[PROOF STEP]
by (metis sum_mono)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>X. m (S2 x)) \<le> (\<Sum>x\<in>X. m (S1 x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma equal_card_inter_fin_eq_sets: "finite A \<Longrightarrow> finite B \<Longrightarrow> card A = card B \<Longrightarrow>
  card (A \<inter> B) = card A \<Longrightarrow> A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite B; card A = card B; card (A \<inter> B) = card A\<rbrakk> \<Longrightarrow> A = B
[PROOF STEP]
by (metis Int_lower1 Int_lower2 card_subset_eq)


[STATEMENT]
lemma sin_cos_squared_add2 [simp]: "(cos x)\<^sup>2 + (sin x)\<^sup>2 = 1"
  for x :: "'a::{real_normed_field,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cos x)\<^sup>2 + (sin x)\<^sup>2 = (1::'a)
[PROOF STEP]
by (subst add.commute, rule sin_cos_squared_add)


[STATEMENT]
lemma \<Sigma>_incr_upper:
  "\<Sigma> f j (l + 1) = \<Sigma> f j l + f (of_int l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sigma> f j (l + 1) = \<Sigma> f j l + f (of_int l)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Sigma> f j (l + 1) = \<Sigma> f j l + f (of_int l)
[PROOF STEP]
have "{l..<l+1} = {l}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {l..<l + 1} = {l}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{l..<l + 1} = {l}

goal (1 subgoal):
 1. \<Sigma> f j (l + 1) = \<Sigma> f j l + f (of_int l)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{l..<l + 1} = {l}
[PROOF STEP]
have "\<Sigma> f l (l + 1) = f (of_int l)"
[PROOF STATE]
proof (prove)
using this:
{l..<l + 1} = {l}

goal (1 subgoal):
 1. \<Sigma> f l (l + 1) = f (of_int l)
[PROOF STEP]
by (simp add: \<Sigma>_def)
[PROOF STATE]
proof (state)
this:
\<Sigma> f l (l + 1) = f (of_int l)

goal (1 subgoal):
 1. \<Sigma> f j (l + 1) = \<Sigma> f j l + f (of_int l)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<Sigma> f l (l + 1) = f (of_int l)

goal (1 subgoal):
 1. \<Sigma> f j (l + 1) = \<Sigma> f j l + f (of_int l)
[PROOF STEP]
have "\<Sigma> f j (l + 1) = \<Sigma> f j l + \<Sigma> f l (l + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sigma> f j (l + 1) = \<Sigma> f j l + \<Sigma> f l (l + 1)
[PROOF STEP]
by (simp add: \<Sigma>_concat)
[PROOF STATE]
proof (state)
this:
\<Sigma> f j (l + 1) = \<Sigma> f j l + \<Sigma> f l (l + 1)

goal (1 subgoal):
 1. \<Sigma> f j (l + 1) = \<Sigma> f j l + f (of_int l)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<Sigma> f l (l + 1) = f (of_int l)
\<Sigma> f j (l + 1) = \<Sigma> f j l + \<Sigma> f l (l + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Sigma> f l (l + 1) = f (of_int l)
\<Sigma> f j (l + 1) = \<Sigma> f j l + \<Sigma> f l (l + 1)

goal (1 subgoal):
 1. \<Sigma> f j (l + 1) = \<Sigma> f j l + f (of_int l)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<Sigma> f j (l + 1) = \<Sigma> f j l + f (of_int l)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rank_nullity_theorem_matrices:
  fixes A::"'a::{field}^'cols::{finite, wellorder}^'rows"
  shows "ncols A = vec.dim (null_space A) + vec.dim (col_space A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ncols A = vec.dim (null_space A) + vec.dim (col_space A)
[PROOF STEP]
using vec.rank_nullity_theorem[OF matrix_vector_mul_linear_gen, of A]
[PROOF STATE]
proof (prove)
using this:
finite_dimensional_vector_space.dimension cart_basis = vec.dim {x. A *v x = 0} + vec.dim (range ((*v) A))

goal (1 subgoal):
 1. ncols A = vec.dim (null_space A) + vec.dim (col_space A)
[PROOF STEP]
apply (subst (2 3) matrix_of_matrix_vector_mul [of A, symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_dimensional_vector_space.dimension cart_basis = vec.dim {x. A *v x = 0} + vec.dim (range ((*v) A)) \<Longrightarrow> ncols A = vec.dim (null_space (matrix ((*v) A))) + vec.dim (col_space (matrix ((*v) A)))
[PROOF STEP]
unfolding null_space_eq_ker[OF matrix_vector_mul_linear_gen]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_dimensional_vector_space.dimension cart_basis = vec.dim {x. A *v x = 0} + vec.dim (range ((*v) A)) \<Longrightarrow> ncols A = vec.dim {x. A *v x = 0} + vec.dim (col_space (matrix ((*v) A)))
[PROOF STEP]
unfolding col_space_eq_range [OF matrix_vector_mul_linear_gen]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_dimensional_vector_space.dimension cart_basis = vec.dim {x. A *v x = 0} + vec.dim (range ((*v) A)) \<Longrightarrow> ncols A = vec.dim {x. A *v x = 0} + vec.dim (range ((*v) A))
[PROOF STEP]
unfolding vec.dimension_def ncols_def card_cart_basis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('cols) = vec.dim {x. A *v x = 0} + vec.dim (range ((*v) A)) \<Longrightarrow> CARD('cols) = vec.dim {x. A *v x = 0} + vec.dim (range ((*v) A))
[PROOF STEP]
by simp


[STATEMENT]
lemma real_sqrt_diff_squares_triangle_ineq:
  fixes a b c d :: real
  shows "sqrt ((a - c)^2 + (b - d)^2) \<le> sqrt (a^2 + b^2) + sqrt (c^2 + d^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt ((a - c)\<^sup>2 + (b - d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sqrt ((a - c)\<^sup>2 + (b - d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2)
[PROOF STEP]
have "sqrt ((a - c)^2 + (b - d)^2) \<le> sqrt (a^2 + b^2) + sqrt ((-c)^2 + (-d)^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt ((a - c)\<^sup>2 + (b - d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt ((- c)\<^sup>2 + (- d)\<^sup>2)
[PROOF STEP]
by (metis diff_conv_add_uminus real_sqrt_sum_squares_triangle_ineq)
[PROOF STATE]
proof (state)
this:
sqrt ((a - c)\<^sup>2 + (b - d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt ((- c)\<^sup>2 + (- d)\<^sup>2)

goal (1 subgoal):
 1. sqrt ((a - c)\<^sup>2 + (b - d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sqrt ((a - c)\<^sup>2 + (b - d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt ((- c)\<^sup>2 + (- d)\<^sup>2)

goal (1 subgoal):
 1. sqrt ((a - c)\<^sup>2 + (b - d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2)
[PROOF STEP]
have "... = sqrt (a^2 + b^2) + sqrt (c^2 + d^2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (a\<^sup>2 + b\<^sup>2) + sqrt ((- c)\<^sup>2 + (- d)\<^sup>2) = sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sqrt (a\<^sup>2 + b\<^sup>2) + sqrt ((- c)\<^sup>2 + (- d)\<^sup>2) = sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2)

goal (1 subgoal):
 1. sqrt ((a - c)\<^sup>2 + (b - d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sqrt ((a - c)\<^sup>2 + (b - d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sqrt ((a - c)\<^sup>2 + (b - d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2)

goal (1 subgoal):
 1. sqrt ((a - c)\<^sup>2 + (b - d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sqrt ((a - c)\<^sup>2 + (b - d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma abs_power_eq_0 [simp]: "\<bar>a\<bar>^n = 0 \<longleftrightarrow> a = 0 \<and> n \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<bar>a\<bar> ^ n = (0::'a)) = (a = (0::'a) \<and> n \<noteq> 0)
[PROOF STEP]
apply (induct n, force)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. (\<bar>a\<bar> ^ n = (0::'a)) = (a = (0::'a) \<and> n \<noteq> 0) \<Longrightarrow> (\<bar>a\<bar> ^ Suc n = (0::'a)) = (a = (0::'a) \<and> Suc n \<noteq> 0)
[PROOF STEP]
apply (unfold power_Suc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. (\<bar>a\<bar> ^ n = (0::'a)) = (a = (0::'a) \<and> n \<noteq> 0) \<Longrightarrow> (\<bar>a\<bar> * \<bar>a\<bar> ^ n = (0::'a)) = (a = (0::'a) \<and> Suc n \<noteq> 0)
[PROOF STEP]
apply (subst real_mult_eq_0_iff, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
.


[STATEMENT]
lemma equivalentFormulaeSymmetry:
  fixes formula1 :: Formula and formula2 :: Formula
  shows "equivalentFormulae formula1 formula2 = equivalentFormulae formula2 formula1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. equivalentFormulae formula1 formula2 = equivalentFormulae formula2 formula1
[PROOF STEP]
unfolding equivalentFormulae_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>valuation. model valuation formula1 = model valuation formula2) = (\<forall>valuation. model valuation formula2 = model valuation formula1)
[PROOF STEP]
by auto


[STATEMENT]
theorem singleton_intersection:
  assumes A:"card A = 1"
  assumes B:"card B = 1"
  assumes noteq:"A \<noteq> B"
  shows "A \<inter> B = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter> B = {}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
card A = 1
card B = 1
A \<noteq> B

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


[STATEMENT]
lemma perzeta_conv_hurwitz_zeta_multiplication':
  fixes k :: nat and a :: int and s :: complex
  assumes "k > 0" "s \<noteq> 1"
  shows   "perzeta (a / k) s = k powr -s *
             (\<Sum>n=1..k. exp (2 * pi * n * a / k * \<i>) * hurwitz_zeta (n / k) s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. perzeta (real_of_int a / real k) s = of_nat k powr - s * (\<Sum>n = 1..k. exp (complex_of_real (2 * pi * real n * real_of_int a / real k) * \<i>) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
using perzeta_conv_hurwitz_zeta_multiplication[of k s a] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < k; s \<noteq> 1\<rbrakk> \<Longrightarrow> of_nat k powr s * perzeta (real_of_int a / real k) s = (\<Sum>n = 1..k. exp (complex_of_real (2 * pi * real n * real_of_int a / real k) * \<i>) * hurwitz_zeta (real n / real k) s)
0 < k
s \<noteq> 1

goal (1 subgoal):
 1. perzeta (real_of_int a / real k) s = of_nat k powr - s * (\<Sum>n = 1..k. exp (complex_of_real (2 * pi * real n * real_of_int a / real k) * \<i>) * hurwitz_zeta (real n / real k) s)
[PROOF STEP]
by (simp add: powr_minus field_simps)


[STATEMENT]
lemma euclid2:
  "PRE (\<lambda>s::nat store. s ''x'' = x \<and> s ''y'' = y)
   (WHILE (\<lambda>s. s ''y'' \<noteq> 0) INV (\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y)
    DO
     (''z'' ::= (\<lambda>s. s ''y''));
     (''y'' ::= (\<lambda>s. s ''x'' mod s ''y''));
     (''x'' ::= (\<lambda>s. s ''z''))
    OD)
   POST (\<lambda>s. s ''x'' = gcd x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rdom \<lceil>\<lambda>s. s ''x'' = x \<and> s ''y'' = y\<rceil> \<subseteq> wp (WHILE (\<lambda>s. s ''y'' \<noteq> 0) INV (\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y) DO (''z'' ::= (\<lambda>s. s ''y'')) ; (''y'' ::= (\<lambda>s. s ''x'' mod s ''y'')) ; (''x'' ::= (\<lambda>s. s ''z'')) OD) \<lceil>\<lambda>s. s ''x'' = gcd x y\<rceil>
[PROOF STEP]
apply hoare
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. rdom \<lceil>\<lambda>s. s ''x'' = x \<and> s ''y'' = y\<rceil> \<subseteq> rdom \<lceil>\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y\<rceil>
 2. rdom \<lceil>\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y\<rceil> ; rel_ad \<lceil>\<lambda>s. s ''y'' \<noteq> 0\<rceil> \<subseteq> rdom \<lceil>\<lambda>s. s ''x'' = gcd x y\<rceil>
 3. rdom \<lceil>\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y\<rceil> ; rdom \<lceil>\<lambda>s. s ''y'' \<noteq> 0\<rceil> \<subseteq> wp (''z'' ::= (\<lambda>s. s ''y'')) (wp (''y'' ::= (\<lambda>s. s ''x'' mod s ''y'')) (wp (''x'' ::= (\<lambda>s. s ''z'')) \<lceil>\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y\<rceil>))
[PROOF STEP]
using gcd_red_nat
[PROOF STATE]
proof (prove)
using this:
gcd ?x ?y = gcd ?y (?x mod ?y)

goal (3 subgoals):
 1. rdom \<lceil>\<lambda>s. s ''x'' = x \<and> s ''y'' = y\<rceil> \<subseteq> rdom \<lceil>\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y\<rceil>
 2. rdom \<lceil>\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y\<rceil> ; rel_ad \<lceil>\<lambda>s. s ''y'' \<noteq> 0\<rceil> \<subseteq> rdom \<lceil>\<lambda>s. s ''x'' = gcd x y\<rceil>
 3. rdom \<lceil>\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y\<rceil> ; rdom \<lceil>\<lambda>s. s ''y'' \<noteq> 0\<rceil> \<subseteq> wp (''z'' ::= (\<lambda>s. s ''y'')) (wp (''y'' ::= (\<lambda>s. s ''x'' mod s ''y'')) (wp (''x'' ::= (\<lambda>s. s ''z'')) \<lceil>\<lambda>s. gcd (s ''x'') (s ''y'') = gcd x y\<rceil>))
[PROOF STEP]
by auto


[STATEMENT]
lemma cos_double: "cos(2*x) = (cos x)\<^sup>2 - (sin x)\<^sup>2"
  for x :: "'a::{real_normed_field,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos ((2::'a) * x) = (cos x)\<^sup>2 - (sin x)\<^sup>2
[PROOF STEP]
using cos_add [where x=x and y=x]
[PROOF STATE]
proof (prove)
using this:
cos (x + x) = cos x * cos x - sin x * sin x

goal (1 subgoal):
 1. cos ((2::'a) * x) = (cos x)\<^sup>2 - (sin x)\<^sup>2
[PROOF STEP]
by (simp add: power2_eq_square)


[STATEMENT]
lemma cis_mult: "cis a * cis b = cis (a + b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cis a * cis b = cis (a + b)
[PROOF STEP]
by (simp add: complex_eq_iff cos_add sin_add)


[STATEMENT]
lemma dist_midpoint:
  fixes a b :: "'a::real_normed_vector" shows
  "dist a (midpoint a b) = (dist a b) / 2" (is ?t1)
  "dist b (midpoint a b) = (dist a b) / 2" (is ?t2)
  "dist (midpoint a b) a = (dist a b) / 2" (is ?t3)
  "dist (midpoint a b) b = (dist a b) / 2" (is ?t4)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dist a (midpoint a b) = dist a b / 2 &&& dist b (midpoint a b) = dist a b / 2) &&& dist (midpoint a b) a = dist a b / 2 &&& dist (midpoint a b) b = dist a b / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. dist a (midpoint a b) = dist a b / 2
 2. dist b (midpoint a b) = dist a b / 2
 3. dist (midpoint a b) a = dist a b / 2
 4. dist (midpoint a b) b = dist a b / 2
[PROOF STEP]
have *: "\<And>x y::'a. 2 *\<^sub>R x = - y \<Longrightarrow> norm x = (norm y) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. 2 *\<^sub>R x = - y \<Longrightarrow> norm x = norm y / 2
[PROOF STEP]
unfolding equation_minus_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. y = - (2 *\<^sub>R x) \<Longrightarrow> norm x = norm y / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 *\<^sub>R ?x = - ?y \<Longrightarrow> norm ?x = norm ?y / 2

goal (4 subgoals):
 1. dist a (midpoint a b) = dist a b / 2
 2. dist b (midpoint a b) = dist a b / 2
 3. dist (midpoint a b) a = dist a b / 2
 4. dist (midpoint a b) b = dist a b / 2
[PROOF STEP]
have **: "\<And>x y::'a. 2 *\<^sub>R x =   y \<Longrightarrow> norm x = (norm y) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. 2 *\<^sub>R x = y \<Longrightarrow> norm x = norm y / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 *\<^sub>R ?x = ?y \<Longrightarrow> norm ?x = norm ?y / 2

goal (4 subgoals):
 1. dist a (midpoint a b) = dist a b / 2
 2. dist b (midpoint a b) = dist a b / 2
 3. dist (midpoint a b) a = dist a b / 2
 4. dist (midpoint a b) b = dist a b / 2
[PROOF STEP]
note scaleR_right_distrib [simp]
[PROOF STATE]
proof (state)
this:
?a *\<^sub>R (?x + ?y) = ?a *\<^sub>R ?x + ?a *\<^sub>R ?y

goal (4 subgoals):
 1. dist a (midpoint a b) = dist a b / 2
 2. dist b (midpoint a b) = dist a b / 2
 3. dist (midpoint a b) a = dist a b / 2
 4. dist (midpoint a b) b = dist a b / 2
[PROOF STEP]
show ?t1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist a (midpoint a b) = dist a b / 2
[PROOF STEP]
unfolding midpoint_def dist_norm
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (a - (a + b) /\<^sub>R 2) = norm (a - b) / 2
[PROOF STEP]
apply (rule **)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 *\<^sub>R (a - (a + b) /\<^sub>R 2) = a - b
[PROOF STEP]
apply (simp add: scaleR_right_diff_distrib)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 *\<^sub>R a - a = a
[PROOF STEP]
apply (simp add: scaleR_2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
dist a (midpoint a b) = dist a b / 2

goal (3 subgoals):
 1. dist b (midpoint a b) = dist a b / 2
 2. dist (midpoint a b) a = dist a b / 2
 3. dist (midpoint a b) b = dist a b / 2
[PROOF STEP]
show ?t2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist b (midpoint a b) = dist a b / 2
[PROOF STEP]
unfolding midpoint_def dist_norm
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (b - (a + b) /\<^sub>R 2) = norm (a - b) / 2
[PROOF STEP]
apply (rule *)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 *\<^sub>R (b - (a + b) /\<^sub>R 2) = - (a - b)
[PROOF STEP]
apply (simp add: scaleR_right_diff_distrib)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 *\<^sub>R b - b = b
[PROOF STEP]
apply (simp add: scaleR_2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
dist b (midpoint a b) = dist a b / 2

goal (2 subgoals):
 1. dist (midpoint a b) a = dist a b / 2
 2. dist (midpoint a b) b = dist a b / 2
[PROOF STEP]
show ?t3
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (midpoint a b) a = dist a b / 2
[PROOF STEP]
unfolding midpoint_def dist_norm
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((a + b) /\<^sub>R 2 - a) = norm (a - b) / 2
[PROOF STEP]
apply (rule *)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 *\<^sub>R ((a + b) /\<^sub>R 2 - a) = - (a - b)
[PROOF STEP]
apply (simp add: scaleR_right_diff_distrib)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a - 2 *\<^sub>R a = - a
[PROOF STEP]
apply (simp add: scaleR_2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
dist (midpoint a b) a = dist a b / 2

goal (1 subgoal):
 1. dist (midpoint a b) b = dist a b / 2
[PROOF STEP]
show ?t4
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (midpoint a b) b = dist a b / 2
[PROOF STEP]
unfolding midpoint_def dist_norm
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm ((a + b) /\<^sub>R 2 - b) = norm (a - b) / 2
[PROOF STEP]
apply (rule **)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 *\<^sub>R ((a + b) /\<^sub>R 2 - b) = a - b
[PROOF STEP]
apply (simp add: scaleR_right_diff_distrib)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b - 2 *\<^sub>R b = - b
[PROOF STEP]
apply (simp add: scaleR_2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
dist (midpoint a b) b = dist a b / 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in encoding) indRelR_iff_exists_source_target_relation:
  fixes Pred :: "(('procS, 'procT) Proc \<times> ('procS, 'procT) Proc) \<Rightarrow> bool"
  shows "(\<forall>(P, Q) \<in> indRelR. Pred (P, Q))
         = (\<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel) \<and> (\<forall>(P, Q) \<in> Rel. Pred (P, Q)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>(P, Q)\<in>indRelR. Pred (P, Q)) = (\<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel) \<and> (\<forall>(P, Q)\<in>Rel. Pred (P, Q)))
[PROOF STEP]
using indRelR_impl_exists_source_target_relation(2)[where PredB="Pred"]
            source_target_relation_impl_indRelR[where Pred="Pred"]
[PROOF STATE]
proof (prove)
using this:
\<forall>(P, Q)\<in>indRelR. Pred (P, Q) \<Longrightarrow> \<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel) \<and> (\<forall>(P, Q)\<in>Rel. Pred (P, Q))
(\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> ?Rel) \<and> (\<forall>(P, Q)\<in>?Rel. Pred (P, Q)) \<Longrightarrow> \<forall>(P, Q)\<in>indRelR. Pred (P, Q)

goal (1 subgoal):
 1. (\<forall>(P, Q)\<in>indRelR. Pred (P, Q)) = (\<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel) \<and> (\<forall>(P, Q)\<in>Rel. Pred (P, Q)))
[PROOF STEP]
by blast


[STATEMENT]
lemma transpose_matrix_diff: "transpose_matrix ((A::('a::group_add) matrix)-B) = transpose_matrix A - transpose_matrix B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transpose_matrix (A - B) = transpose_matrix A - transpose_matrix B
[PROOF STEP]
by (simp add: diff_matrix_def transpose_combine_matrix)


[STATEMENT]
lemma matrix_vector_mult_zero_eq:
  assumes P: "invertible P"
  shows "((P**A)*v x = 0) = (A *v x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P ** A *v x = 0) = (A *v x = 0)
[PROOF STEP]
proof (rule iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. P ** A *v x = 0 \<Longrightarrow> A *v x = 0
 2. A *v x = 0 \<Longrightarrow> P ** A *v x = 0
[PROOF STEP]
assume "P ** A *v x = 0"
[PROOF STATE]
proof (state)
this:
P ** A *v x = 0

goal (2 subgoals):
 1. P ** A *v x = 0 \<Longrightarrow> A *v x = 0
 2. A *v x = 0 \<Longrightarrow> P ** A *v x = 0
[PROOF STEP]
hence "matrix_inv P *v (P ** A *v x) = matrix_inv P *v 0"
[PROOF STATE]
proof (prove)
using this:
P ** A *v x = 0

goal (1 subgoal):
 1. matrix_inv P *v (P ** A *v x) = matrix_inv P *v 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
matrix_inv P *v (P ** A *v x) = matrix_inv P *v 0

goal (2 subgoals):
 1. P ** A *v x = 0 \<Longrightarrow> A *v x = 0
 2. A *v x = 0 \<Longrightarrow> P ** A *v x = 0
[PROOF STEP]
hence "matrix_inv P *v (P ** A *v x) =  0"
[PROOF STATE]
proof (prove)
using this:
matrix_inv P *v (P ** A *v x) = matrix_inv P *v 0

goal (1 subgoal):
 1. matrix_inv P *v (P ** A *v x) = 0
[PROOF STEP]
by (metis matrix_vector_mult_0_right)
[PROOF STATE]
proof (state)
this:
matrix_inv P *v (P ** A *v x) = 0

goal (2 subgoals):
 1. P ** A *v x = 0 \<Longrightarrow> A *v x = 0
 2. A *v x = 0 \<Longrightarrow> P ** A *v x = 0
[PROOF STEP]
hence "(matrix_inv P ** P ** A) *v x =  0"
[PROOF STATE]
proof (prove)
using this:
matrix_inv P *v (P ** A *v x) = 0

goal (1 subgoal):
 1. matrix_inv P ** P ** A *v x = 0
[PROOF STEP]
by (metis matrix_vector_mul_assoc)
[PROOF STATE]
proof (state)
this:
matrix_inv P ** P ** A *v x = 0

goal (2 subgoals):
 1. P ** A *v x = 0 \<Longrightarrow> A *v x = 0
 2. A *v x = 0 \<Longrightarrow> P ** A *v x = 0
[PROOF STEP]
thus "A *v x =  0"
[PROOF STATE]
proof (prove)
using this:
matrix_inv P ** P ** A *v x = 0

goal (1 subgoal):
 1. A *v x = 0
[PROOF STEP]
by (metis assms matrix_inv_left matrix_mul_lid)
[PROOF STATE]
proof (state)
this:
A *v x = 0

goal (1 subgoal):
 1. A *v x = 0 \<Longrightarrow> P ** A *v x = 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A *v x = 0 \<Longrightarrow> P ** A *v x = 0
[PROOF STEP]
assume "A *v x = 0"
[PROOF STATE]
proof (state)
this:
A *v x = 0

goal (1 subgoal):
 1. A *v x = 0 \<Longrightarrow> P ** A *v x = 0
[PROOF STEP]
thus "P ** A *v x = 0"
[PROOF STATE]
proof (prove)
using this:
A *v x = 0

goal (1 subgoal):
 1. P ** A *v x = 0
[PROOF STEP]
by (metis matrix_vector_mul_assoc matrix_vector_mult_0_right)
[PROOF STATE]
proof (state)
this:
P ** A *v x = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma convolution_of_aezfun_is_aezfun :
  fixes     f g :: "'a::group_add \<Rightarrow> 'b::{comm_monoid_add,times}"
  shows     "f \<in> aezfun_set \<Longrightarrow> g \<in> aezfun_set \<Longrightarrow> convolution f g \<in> aezfun_set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> aezfun_set; g \<in> aezfun_set\<rbrakk> \<Longrightarrow> convolution f g \<in> aezfun_set
[PROOF STEP]
using     supp_convolution_subset_sum_supp[of f g]
            finite_set_plus[of "supp f" "supp g"] finite_subset
[PROOF STATE]
proof (prove)
using this:
supp (convolution f g) \<subseteq> supp f + supp g
\<lbrakk>finite (supp f); finite (supp g)\<rbrakk> \<Longrightarrow> finite (supp f + supp g)
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. \<lbrakk>f \<in> aezfun_set; g \<in> aezfun_set\<rbrakk> \<Longrightarrow> convolution f g \<in> aezfun_set
[PROOF STEP]
unfolding aezfun_set_def
[PROOF STATE]
proof (prove)
using this:
supp (convolution f g) \<subseteq> supp f + supp g
\<lbrakk>finite (supp f); finite (supp g)\<rbrakk> \<Longrightarrow> finite (supp f + supp g)
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. \<lbrakk>f \<in> {f. finite (supp f)}; g \<in> {f. finite (supp f)}\<rbrakk> \<Longrightarrow> convolution f g \<in> {f. finite (supp f)}
[PROOF STEP]
by        fastforce


[STATEMENT]
lemma Bseq_mult:
  fixes f g :: "nat \<Rightarrow> 'a::real_normed_field"
  assumes "Bseq f" and "Bseq g"
  shows "Bseq (\<lambda>x. f x * g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bseq (\<lambda>x. f x * g x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Bseq (\<lambda>x. f x * g x)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
Bseq f
Bseq g
[PROOF STEP]
obtain K1 K2 where K: "norm (f x) \<le> K1" "K1 > 0" "norm (g x) \<le> K2" "K2 > 0"
    for x
[PROOF STATE]
proof (prove)
using this:
Bseq f
Bseq g

goal (1 subgoal):
 1. (\<And>K1 K2. \<lbrakk>\<And>x. norm (f x) \<le> K1; 0 < K1; \<And>x. norm (g x) \<le> K2; 0 < K2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding Bseq_def
[PROOF STATE]
proof (prove)
using this:
\<exists>K>0. \<forall>n. norm (f n) \<le> K
\<exists>K>0. \<forall>n. norm (g n) \<le> K

goal (1 subgoal):
 1. (\<And>K1 K2. \<lbrakk>\<And>x. norm (f x) \<le> K1; 0 < K1; \<And>x. norm (g x) \<le> K2; 0 < K2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
norm (f ?x) \<le> K1
0 < K1
norm (g ?x) \<le> K2
0 < K2

goal (1 subgoal):
 1. Bseq (\<lambda>x. f x * g x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
norm (f ?x) \<le> K1
0 < K1
norm (g ?x) \<le> K2
0 < K2
[PROOF STEP]
have "norm (f x * g x) \<le> K1 * K2" for x
[PROOF STATE]
proof (prove)
using this:
norm (f ?x) \<le> K1
0 < K1
norm (g ?x) \<le> K2
0 < K2

goal (1 subgoal):
 1. norm (f x * g x) \<le> K1 * K2
[PROOF STEP]
by (auto simp: norm_mult intro!: mult_mono)
[PROOF STATE]
proof (state)
this:
norm (f ?x * g ?x) \<le> K1 * K2

goal (1 subgoal):
 1. Bseq (\<lambda>x. f x * g x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
norm (f ?x * g ?x) \<le> K1 * K2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm (f ?x * g ?x) \<le> K1 * K2

goal (1 subgoal):
 1. Bseq (\<lambda>x. f x * g x)
[PROOF STEP]
by (rule BseqI')
[PROOF STATE]
proof (state)
this:
Bseq (\<lambda>x. f x * g x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma L2_set_mono2:
  assumes a1: "finite L" and a2: "K \<le> L"
  shows "L2_set f K \<le> L2_set f L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L2_set f K \<le> L2_set f L
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. L2_set f K \<le> L2_set f L
[PROOF STEP]
have "(\<Sum>i\<in>K. (f i)\<^sup>2) \<le> (\<Sum>i\<in>L. (f i)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>K. (f i)\<^sup>2) \<le> (\<Sum>i\<in>L. (f i)\<^sup>2)
[PROOF STEP]
apply (rule sum_mono2)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite L
 2. K \<subseteq> L
 3. \<And>b. b \<in> L - K \<Longrightarrow> 0 \<le> (f b)\<^sup>2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite L
K \<subseteq> L

goal (3 subgoals):
 1. finite L
 2. K \<subseteq> L
 3. \<And>b. b \<in> L - K \<Longrightarrow> 0 \<le> (f b)\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>K. (f i)\<^sup>2) \<le> (\<Sum>i\<in>L. (f i)\<^sup>2)

goal (1 subgoal):
 1. L2_set f K \<le> L2_set f L
[PROOF STEP]
hence "sqrt (\<Sum>i\<in>K. (f i)\<^sup>2) \<le> sqrt (\<Sum>i\<in>L. (f i)\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<in>K. (f i)\<^sup>2) \<le> (\<Sum>i\<in>L. (f i)\<^sup>2)

goal (1 subgoal):
 1. sqrt (\<Sum>i\<in>K. (f i)\<^sup>2) \<le> sqrt (\<Sum>i\<in>L. (f i)\<^sup>2)
[PROOF STEP]
by (rule real_sqrt_le_mono)
[PROOF STATE]
proof (state)
this:
sqrt (\<Sum>i\<in>K. (f i)\<^sup>2) \<le> sqrt (\<Sum>i\<in>L. (f i)\<^sup>2)

goal (1 subgoal):
 1. L2_set f K \<le> L2_set f L
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
sqrt (\<Sum>i\<in>K. (f i)\<^sup>2) \<le> sqrt (\<Sum>i\<in>L. (f i)\<^sup>2)

goal (1 subgoal):
 1. L2_set f K \<le> L2_set f L
[PROOF STEP]
unfolding L2_set_def
[PROOF STATE]
proof (prove)
using this:
sqrt (\<Sum>i\<in>K. (f i)\<^sup>2) \<le> sqrt (\<Sum>i\<in>L. (f i)\<^sup>2)

goal (1 subgoal):
 1. sqrt (\<Sum>i\<in>K. (f i)\<^sup>2) \<le> sqrt (\<Sum>i\<in>L. (f i)\<^sup>2)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
L2_set f K \<le> L2_set f L

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma p_LIMSEQ:
  assumes x: "x > 0"
  shows   "(\<lambda>n. p n x) \<longlonglongrightarrow> P x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. p n x) \<longlonglongrightarrow> P x
[PROOF STEP]
proof (rule Lim_transform_eventually)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?f \<longlonglongrightarrow> P x
 2. \<forall>\<^sub>F xa in sequentially. ?f xa = p xa x
[PROOF STEP]
from D_summable[OF x]
[PROOF STATE]
proof (chain)
picking this:
summable (\<lambda>n. D (real n + x))
[PROOF STEP]
have "(\<lambda>n. D (real n + x)) sums P x"
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. D (real n + x))

goal (1 subgoal):
 1. (\<lambda>n. D (real n + x)) sums P x
[PROOF STEP]
unfolding P_def
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. D (real n + x))

goal (1 subgoal):
 1. (\<lambda>n. D (real n + x)) sums (\<Sum>n. D (real n + x))
[PROOF STEP]
by (simp add: sums_iff)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. D (real n + x)) sums P x

goal (2 subgoals):
 1. ?f \<longlonglongrightarrow> P x
 2. \<forall>\<^sub>F xa in sequentially. ?f xa = p xa x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. D (real n + x)) sums P x
[PROOF STEP]
show "(\<lambda>n. \<Sum>r<n. D (real r + x)) \<longlonglongrightarrow> P x"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. D (real n + x)) sums P x

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>r<n. D (real r + x)) \<longlonglongrightarrow> P x
[PROOF STEP]
by (simp add: sums_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>r<n. D (real r + x)) \<longlonglongrightarrow> P x

goal (1 subgoal):
 1. \<forall>\<^sub>F xa in sequentially. (\<Sum>r<xa. D (real r + x)) = p xa x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>r<n. D (real r + x)) \<longlonglongrightarrow> P x

goal (1 subgoal):
 1. \<forall>\<^sub>F xa in sequentially. (\<Sum>r<xa. D (real r + x)) = p xa x
[PROOF STEP]
from eventually_gt_at_top[of 1]
[PROOF STATE]
proof (chain)
picking this:
eventually ((<) (1::?'a1)) at_top
[PROOF STEP]
show "eventually (\<lambda>n. (\<Sum>r<n. D (real r + x)) = p n x) at_top"
[PROOF STATE]
proof (prove)
using this:
eventually ((<) (1::?'a1)) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. (\<Sum>r<n. D (real r + x)) = p n x
[PROOF STEP]
by eventually_elim (auto simp: p_def)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. (\<Sum>r<n. D (real r + x)) = p n x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma strict_alt_def:
  assumes "p \<in> lotteries_on outcomes"
    and "q \<in> lotteries_on outcomes"
  shows "p \<succ>[relation] q \<longleftrightarrow>
            (\<Sum>z\<in>outcomes. (pmf p z) * (u z)) > (\<Sum>z\<in>outcomes. (pmf q z) * (u z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p \<succeq> q \<and> (q, p) \<notin> relation) = ((\<Sum>z\<in>outcomes. pmf q z * u z) < (\<Sum>z\<in>outcomes. pmf p z * u z))
[PROOF STEP]
using sum_equals_pmf_expectation[of p, OF assms(1)] assms(1) assms(2)
    sum_equals_pmf_expectation[of q, OF assms(2)] strict_prefernce_iff_strict_utility
[PROOF STATE]
proof (prove)
using this:
(\<Sum>z\<in>outcomes. pmf p z * u z) = measure_pmf.expectation p u
p \<in> \<P> outcomes
q \<in> \<P> outcomes
(\<Sum>z\<in>outcomes. pmf q z * u z) = measure_pmf.expectation q u
\<lbrakk>?x \<in> \<P> outcomes; ?y \<in> \<P> outcomes\<rbrakk> \<Longrightarrow> (?x \<succeq> ?y \<and> (?y, ?x) \<notin> relation) = (measure_pmf.expectation ?y u < measure_pmf.expectation ?x u)

goal (1 subgoal):
 1. (p \<succeq> q \<and> (q, p) \<notin> relation) = ((\<Sum>z\<in>outcomes. pmf q z * u z) < (\<Sum>z\<in>outcomes. pmf p z * u z))
[PROOF STEP]
by presburger


[STATEMENT]
lemma prob_long_aux:
  shows "2 / pi * ((l / d) - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)) \<ge> 0"
  and   "Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} =
           ennreal (2 / pi * ((l / d) - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> 2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)) &&& emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)))
[PROOF STEP]
using emeasure_buffon_set'_long(1)
[PROOF STATE]
proof (prove)
using this:
0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d

goal (1 subgoal):
 1. 0 \<le> 2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)) &&& emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d \<Longrightarrow> 0 \<le> 2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l))
 2. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d \<Longrightarrow> emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)))
[PROOF STEP]
have *: "l * sqrt ((l\<^sup>2 - d\<^sup>2) / l\<^sup>2) + 0 \<le> l + d * arccos (d / l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l * sqrt ((l\<^sup>2 - d\<^sup>2) / l\<^sup>2) + 0 \<le> l + d * arccos (d / l)
[PROOF STEP]
using d l_ge_d
[PROOF STATE]
proof (prove)
using this:
0 < d
d \<le> l

goal (1 subgoal):
 1. l * sqrt ((l\<^sup>2 - d\<^sup>2) / l\<^sup>2) + 0 \<le> l + d * arccos (d / l)
[PROOF STEP]
by (intro add_mono mult_nonneg_nonneg arccos_lbound) (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
l * sqrt ((l\<^sup>2 - d\<^sup>2) / l\<^sup>2) + 0 \<le> l + d * arccos (d / l)

goal (2 subgoals):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d \<Longrightarrow> 0 \<le> 2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l))
 2. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d \<Longrightarrow> emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)))
[PROOF STEP]
have "l / d \<ge> sqrt ((l / d)\<^sup>2 - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt ((l / d)\<^sup>2 - 1) \<le> l / d
[PROOF STEP]
using l d l_ge_d
[PROOF STATE]
proof (prove)
using this:
0 < l
0 < d
d \<le> l

goal (1 subgoal):
 1. sqrt ((l / d)\<^sup>2 - 1) \<le> l / d
[PROOF STEP]
by (intro real_le_lsqrt) (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
sqrt ((l / d)\<^sup>2 - 1) \<le> l / d

goal (2 subgoals):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d \<Longrightarrow> 0 \<le> 2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l))
 2. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d \<Longrightarrow> emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)))
[PROOF STEP]
thus "2 / pi * ((l / d) - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)) \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
sqrt ((l / d)\<^sup>2 - 1) \<le> l / d

goal (1 subgoal):
 1. 0 \<le> 2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l))
[PROOF STEP]
using d l l_ge_d
[PROOF STATE]
proof (prove)
using this:
sqrt ((l / d)\<^sup>2 - 1) \<le> l / d
0 < d
0 < l
d \<le> l

goal (1 subgoal):
 1. 0 \<le> 2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l))
[PROOF STEP]
by (intro mult_nonneg_nonneg add_nonneg_nonneg arccos_lbound) (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
0 \<le> 2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l))

goal (1 subgoal):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d \<Longrightarrow> emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)))
[PROOF STEP]
have "emeasure Buffon {(x,\<phi>). needle l x \<phi> \<inter> {-d/2, d/2} \<noteq> {}} =
          ennreal (4 * (l - l * sqrt (1 - (d / l)\<^sup>2) + arccos (d / l) * d)) / ennreal (2 * d * pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (4 * (l - l * sqrt (1 - (d / l)\<^sup>2) + arccos (d / l) * d)) / ennreal (2 * d * pi)
[PROOF STEP]
using d l l_ge_d *
[PROOF STATE]
proof (prove)
using this:
0 < d
0 < l
d \<le> l
l * sqrt ((l\<^sup>2 - d\<^sup>2) / l\<^sup>2) + 0 \<le> l + d * arccos (d / l)

goal (1 subgoal):
 1. emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (4 * (l - l * sqrt (1 - (d / l)\<^sup>2) + arccos (d / l) * d)) / ennreal (2 * d * pi)
[PROOF STEP]
unfolding buffon_prob_aux emeasure_set_long ennreal_numeral [symmetric]
[PROOF STATE]
proof (prove)
using this:
0 < d
0 < l
d \<le> l
l * sqrt ((l\<^sup>2 - d\<^sup>2) / l\<^sup>2) + 0 \<le> l + d * arccos (d / l)

goal (1 subgoal):
 1. ennreal 4 * ennreal (l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d) / ennreal (2 * d * pi) = ennreal (4 * (l - l * sqrt (1 - (d / l)\<^sup>2) + arccos (d / l) * d)) / ennreal (2 * d * pi)
[PROOF STEP]
by (subst ennreal_mult [symmetric])
       (auto intro!: add_nonneg_nonneg mult_nonneg_nonneg simp: field_simps)
[PROOF STATE]
proof (state)
this:
emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (4 * (l - l * sqrt (1 - (d / l)\<^sup>2) + arccos (d / l) * d)) / ennreal (2 * d * pi)

goal (1 subgoal):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d \<Longrightarrow> emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (4 * (l - l * sqrt (1 - (d / l)\<^sup>2) + arccos (d / l) * d)) / ennreal (2 * d * pi)

goal (1 subgoal):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d \<Longrightarrow> emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)))
[PROOF STEP]
have "\<dots> = ennreal ((4 * (l - l * sqrt (1 - (d / l)\<^sup>2) + arccos (d / l) * d)) / (2 * d * pi))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (4 * (l - l * sqrt (1 - (d / l)\<^sup>2) + arccos (d / l) * d)) / ennreal (2 * d * pi) = ennreal (4 * (l - l * sqrt (1 - (d / l)\<^sup>2) + arccos (d / l) * d) / (2 * d * pi))
[PROOF STEP]
using d l *
[PROOF STATE]
proof (prove)
using this:
0 < d
0 < l
l * sqrt ((l\<^sup>2 - d\<^sup>2) / l\<^sup>2) + 0 \<le> l + d * arccos (d / l)

goal (1 subgoal):
 1. ennreal (4 * (l - l * sqrt (1 - (d / l)\<^sup>2) + arccos (d / l) * d)) / ennreal (2 * d * pi) = ennreal (4 * (l - l * sqrt (1 - (d / l)\<^sup>2) + arccos (d / l) * d) / (2 * d * pi))
[PROOF STEP]
by (subst divide_ennreal) (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
ennreal (4 * (l - l * sqrt (1 - (d / l)\<^sup>2) + arccos (d / l) * d)) / ennreal (2 * d * pi) = ennreal (4 * (l - l * sqrt (1 - (d / l)\<^sup>2) + arccos (d / l) * d) / (2 * d * pi))

goal (1 subgoal):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d \<Longrightarrow> emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (4 * (l - l * sqrt (1 - (d / l)\<^sup>2) + arccos (d / l) * d)) / ennreal (2 * d * pi) = ennreal (4 * (l - l * sqrt (1 - (d / l)\<^sup>2) + arccos (d / l) * d) / (2 * d * pi))

goal (1 subgoal):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d \<Longrightarrow> emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)))
[PROOF STEP]
have "(4 * (l - l * sqrt (1 - (d / l)\<^sup>2) + arccos (d / l) * d)) / (2 * d * pi) =
               2 / pi * (l / d - l / d * sqrt ((d / l)^2 * ((l / d)^2 - 1)) + arccos (d / l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 * (l - l * sqrt (1 - (d / l)\<^sup>2) + arccos (d / l) * d) / (2 * d * pi) = 2 / pi * (l / d - l / d * sqrt ((d / l)\<^sup>2 * ((l / d)\<^sup>2 - 1)) + arccos (d / l))
[PROOF STEP]
using d l
[PROOF STATE]
proof (prove)
using this:
0 < d
0 < l

goal (1 subgoal):
 1. 4 * (l - l * sqrt (1 - (d / l)\<^sup>2) + arccos (d / l) * d) / (2 * d * pi) = 2 / pi * (l / d - l / d * sqrt ((d / l)\<^sup>2 * ((l / d)\<^sup>2 - 1)) + arccos (d / l))
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
4 * (l - l * sqrt (1 - (d / l)\<^sup>2) + arccos (d / l) * d) / (2 * d * pi) = 2 / pi * (l / d - l / d * sqrt ((d / l)\<^sup>2 * ((l / d)\<^sup>2 - 1)) + arccos (d / l))

goal (1 subgoal):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d \<Longrightarrow> emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
4 * (l - l * sqrt (1 - (d / l)\<^sup>2) + arccos (d / l) * d) / (2 * d * pi) = 2 / pi * (l / d - l / d * sqrt ((d / l)\<^sup>2 * ((l / d)\<^sup>2 - 1)) + arccos (d / l))

goal (1 subgoal):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d \<Longrightarrow> emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)))
[PROOF STEP]
have "l / d * sqrt ((d / l)^2 * ((l / d)^2 - 1)) = sqrt ((l / d) ^ 2 - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l / d * sqrt ((d / l)\<^sup>2 * ((l / d)\<^sup>2 - 1)) = sqrt ((l / d)\<^sup>2 - 1)
[PROOF STEP]
using d l l_ge_d
[PROOF STATE]
proof (prove)
using this:
0 < d
0 < l
d \<le> l

goal (1 subgoal):
 1. l / d * sqrt ((d / l)\<^sup>2 * ((l / d)\<^sup>2 - 1)) = sqrt ((l / d)\<^sup>2 - 1)
[PROOF STEP]
unfolding real_sqrt_mult real_sqrt_abs
[PROOF STATE]
proof (prove)
using this:
0 < d
0 < l
d \<le> l

goal (1 subgoal):
 1. l / d * (\<bar>d / l\<bar> * sqrt ((l / d)\<^sup>2 - 1)) = sqrt ((l / d)\<^sup>2 - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
l / d * sqrt ((d / l)\<^sup>2 * ((l / d)\<^sup>2 - 1)) = sqrt ((l / d)\<^sup>2 - 1)

goal (1 subgoal):
 1. 0 \<le> l * (1 - sqrt (1 - (d / l)\<^sup>2)) + arccos (d / l) * d \<Longrightarrow> emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
emeasure local.Buffon {a. case a of (x, \<phi>) \<Rightarrow> needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)))
[PROOF STEP]
show "emeasure Buffon {(x,\<phi>). needle l x \<phi> \<inter> {-d/2, d/2} \<noteq> {}} =
                  ennreal (2 / pi * ((l / d) - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)))"
[PROOF STATE]
proof (prove)
using this:
emeasure local.Buffon {a. case a of (x, \<phi>) \<Rightarrow> needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)))

goal (1 subgoal):
 1. emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
emeasure local.Buffon {(x, \<phi>). needle l x \<phi> \<inter> {- d / 2, d / 2} \<noteq> {}} = ennreal (2 / pi * (l / d - sqrt ((l / d)\<^sup>2 - 1) + arccos (d / l)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma padic_add_comm0:
assumes "prime p"
shows  "(padic_add p x y)= (padic_add p y x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_add p x y = padic_add p y x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. padic_add p x y = padic_add p y x
[PROOF STEP]
unfolding padic_add_def
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. (\<lambda>n. x n \<oplus>\<^bsub>residue_ring (p ^ n)\<^esub> y n) = (\<lambda>n. y n \<oplus>\<^bsub>residue_ring (p ^ n)\<^esub> x n)
[PROOF STEP]
using padic_integers.residue_add_comm[of p]
[PROOF STATE]
proof (prove)
using this:
prime p
padic_integers p \<Longrightarrow> ?x \<oplus>\<^bsub>residue_ring (p ^ ?k)\<^esub> ?y = ?y \<oplus>\<^bsub>residue_ring (p ^ ?k)\<^esub> ?x

goal (1 subgoal):
 1. (\<lambda>n. x n \<oplus>\<^bsub>residue_ring (p ^ n)\<^esub> y n) = (\<lambda>n. y n \<oplus>\<^bsub>residue_ring (p ^ n)\<^esub> x n)
[PROOF STEP]
by (simp add: padic_integers_def)


[STATEMENT]
lemma constraints_of_mat_vec_solution:
  assumes A: "A \<in> carrier_mat nr nc"
    and b: "b \<in> carrier_vec nr"
  shows "(\<exists> x \<in> carrier_vec nc. A *\<^sub>v x \<le> b) =
    (\<exists> v. \<forall> c \<in> constraints_of_mat_vec A b. v \<Turnstile>\<^sub>l\<^sub>e c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x\<in>carrier_vec nc. A *\<^sub>v x \<le> b) = (\<exists>v. \<forall>c\<in>constraints_of_mat_vec A b. v \<Turnstile>\<^sub>l\<^sub>e c)
[PROOF STEP]
using constraints_of_mat_vec_solution_1[OF assms] constraints_of_mat_vec_solution_2[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>carrier_vec nc. A *\<^sub>v x \<le> b \<Longrightarrow> \<exists>v. \<forall>c\<in>constraints_of_mat_vec A b. v \<Turnstile>\<^sub>l\<^sub>e c
\<exists>v. \<forall>c\<in>constraints_of_mat_vec A b. v \<Turnstile>\<^sub>l\<^sub>e c \<Longrightarrow> \<exists>x\<in>carrier_vec nc. A *\<^sub>v x \<le> b

goal (1 subgoal):
 1. (\<exists>x\<in>carrier_vec nc. A *\<^sub>v x \<le> b) = (\<exists>v. \<forall>c\<in>constraints_of_mat_vec A b. v \<Turnstile>\<^sub>l\<^sub>e c)
[PROOF STEP]
by blast


[STATEMENT]
lemma integral_le:
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
  assumes "f integrable_on S"
    and "g integrable_on S"
    and "\<And>x. x \<in> S \<Longrightarrow> f x \<le> g x"
  shows "integral S f \<le> integral S g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral S f \<le> integral S g
[PROOF STEP]
by (rule has_integral_le[OF assms(1,2)[unfolded has_integral_integral] assms(3)])


[STATEMENT]
lemma pochhammer_times_pochhammer_half:
  fixes z :: "'a::field_char_0"
  shows "pochhammer z (Suc n) * pochhammer (z + 1/2) (Suc n) = (\<Prod>k=0..2*n+1. z + of_nat k / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pochhammer z (Suc n) * pochhammer (z + (1::'a) / (2::'a)) (Suc n) = (\<Prod>k = 0..2 * n + 1. z + of_nat k / (2::'a))
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. pochhammer z (Suc 0) * pochhammer (z + (1::'a) / (2::'a)) (Suc 0) = (\<Prod>k = 0..2 * 0 + 1. z + of_nat k / (2::'a))
 2. \<And>n. pochhammer z (Suc n) * pochhammer (z + (1::'a) / (2::'a)) (Suc n) = (\<Prod>k = 0..2 * n + 1. z + of_nat k / (2::'a)) \<Longrightarrow> pochhammer z (Suc (Suc n)) * pochhammer (z + (1::'a) / (2::'a)) (Suc (Suc n)) = (\<Prod>k = 0..2 * Suc n + 1. z + of_nat k / (2::'a))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. pochhammer z (Suc 0) * pochhammer (z + (1::'a) / (2::'a)) (Suc 0) = (\<Prod>k = 0..2 * 0 + 1. z + of_nat k / (2::'a))
 2. \<And>n. pochhammer z (Suc n) * pochhammer (z + (1::'a) / (2::'a)) (Suc n) = (\<Prod>k = 0..2 * n + 1. z + of_nat k / (2::'a)) \<Longrightarrow> pochhammer z (Suc (Suc n)) * pochhammer (z + (1::'a) / (2::'a)) (Suc (Suc n)) = (\<Prod>k = 0..2 * Suc n + 1. z + of_nat k / (2::'a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pochhammer z (Suc 0) * pochhammer (z + (1::'a) / (2::'a)) (Suc 0) = (\<Prod>k = 0..2 * 0 + 1. z + of_nat k / (2::'a))
[PROOF STEP]
by (simp add: atLeast0_atMost_Suc)
[PROOF STATE]
proof (state)
this:
pochhammer z (Suc 0) * pochhammer (z + (1::'a) / (2::'a)) (Suc 0) = (\<Prod>k = 0..2 * 0 + 1. z + of_nat k / (2::'a))

goal (1 subgoal):
 1. \<And>n. pochhammer z (Suc n) * pochhammer (z + (1::'a) / (2::'a)) (Suc n) = (\<Prod>k = 0..2 * n + 1. z + of_nat k / (2::'a)) \<Longrightarrow> pochhammer z (Suc (Suc n)) * pochhammer (z + (1::'a) / (2::'a)) (Suc (Suc n)) = (\<Prod>k = 0..2 * Suc n + 1. z + of_nat k / (2::'a))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. pochhammer z (Suc n) * pochhammer (z + (1::'a) / (2::'a)) (Suc n) = (\<Prod>k = 0..2 * n + 1. z + of_nat k / (2::'a)) \<Longrightarrow> pochhammer z (Suc (Suc n)) * pochhammer (z + (1::'a) / (2::'a)) (Suc (Suc n)) = (\<Prod>k = 0..2 * Suc n + 1. z + of_nat k / (2::'a))
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
pochhammer z (Suc n) * pochhammer (z + (1::'a) / (2::'a)) (Suc n) = (\<Prod>k = 0..2 * n + 1. z + of_nat k / (2::'a))

goal (1 subgoal):
 1. \<And>n. pochhammer z (Suc n) * pochhammer (z + (1::'a) / (2::'a)) (Suc n) = (\<Prod>k = 0..2 * n + 1. z + of_nat k / (2::'a)) \<Longrightarrow> pochhammer z (Suc (Suc n)) * pochhammer (z + (1::'a) / (2::'a)) (Suc (Suc n)) = (\<Prod>k = 0..2 * Suc n + 1. z + of_nat k / (2::'a))
[PROOF STEP]
define n' where "n' = Suc n"
[PROOF STATE]
proof (state)
this:
n' = Suc n

goal (1 subgoal):
 1. \<And>n. pochhammer z (Suc n) * pochhammer (z + (1::'a) / (2::'a)) (Suc n) = (\<Prod>k = 0..2 * n + 1. z + of_nat k / (2::'a)) \<Longrightarrow> pochhammer z (Suc (Suc n)) * pochhammer (z + (1::'a) / (2::'a)) (Suc (Suc n)) = (\<Prod>k = 0..2 * Suc n + 1. z + of_nat k / (2::'a))
[PROOF STEP]
have "pochhammer z (Suc n') * pochhammer (z + 1 / 2) (Suc n') =
      (pochhammer z n' * pochhammer (z + 1 / 2) n') * ((z + of_nat n') * (z + 1/2 + of_nat n'))"
    (is "_ = _ * ?A")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pochhammer z (Suc n') * pochhammer (z + (1::'a) / (2::'a)) (Suc n') = pochhammer z n' * pochhammer (z + (1::'a) / (2::'a)) n' * ((z + of_nat n') * (z + (1::'a) / (2::'a) + of_nat n'))
[PROOF STEP]
by (simp_all add: pochhammer_rec' mult_ac)
[PROOF STATE]
proof (state)
this:
pochhammer z (Suc n') * pochhammer (z + (1::'a) / (2::'a)) (Suc n') = pochhammer z n' * pochhammer (z + (1::'a) / (2::'a)) n' * ((z + of_nat n') * (z + (1::'a) / (2::'a) + of_nat n'))

goal (1 subgoal):
 1. \<And>n. pochhammer z (Suc n) * pochhammer (z + (1::'a) / (2::'a)) (Suc n) = (\<Prod>k = 0..2 * n + 1. z + of_nat k / (2::'a)) \<Longrightarrow> pochhammer z (Suc (Suc n)) * pochhammer (z + (1::'a) / (2::'a)) (Suc (Suc n)) = (\<Prod>k = 0..2 * Suc n + 1. z + of_nat k / (2::'a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pochhammer z (Suc n') * pochhammer (z + (1::'a) / (2::'a)) (Suc n') = pochhammer z n' * pochhammer (z + (1::'a) / (2::'a)) n' * ((z + of_nat n') * (z + (1::'a) / (2::'a) + of_nat n'))

goal (1 subgoal):
 1. \<And>n. pochhammer z (Suc n) * pochhammer (z + (1::'a) / (2::'a)) (Suc n) = (\<Prod>k = 0..2 * n + 1. z + of_nat k / (2::'a)) \<Longrightarrow> pochhammer z (Suc (Suc n)) * pochhammer (z + (1::'a) / (2::'a)) (Suc (Suc n)) = (\<Prod>k = 0..2 * Suc n + 1. z + of_nat k / (2::'a))
[PROOF STEP]
have "?A = (z + of_nat (Suc (2 * n + 1)) / 2) * (z + of_nat (Suc (Suc (2 * n + 1))) / 2)"
    (is "_ = ?B")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (z + of_nat n') * (z + (1::'a) / (2::'a) + of_nat n') = (z + of_nat (Suc (2 * n + 1)) / (2::'a)) * (z + of_nat (Suc (Suc (2 * n + 1))) / (2::'a))
[PROOF STEP]
by (simp add: field_simps n'_def)
[PROOF STATE]
proof (state)
this:
(z + of_nat n') * (z + (1::'a) / (2::'a) + of_nat n') = (z + of_nat (Suc (2 * n + 1)) / (2::'a)) * (z + of_nat (Suc (Suc (2 * n + 1))) / (2::'a))

goal (1 subgoal):
 1. \<And>n. pochhammer z (Suc n) * pochhammer (z + (1::'a) / (2::'a)) (Suc n) = (\<Prod>k = 0..2 * n + 1. z + of_nat k / (2::'a)) \<Longrightarrow> pochhammer z (Suc (Suc n)) * pochhammer (z + (1::'a) / (2::'a)) (Suc (Suc n)) = (\<Prod>k = 0..2 * Suc n + 1. z + of_nat k / (2::'a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(z + of_nat n') * (z + (1::'a) / (2::'a) + of_nat n') = (z + of_nat (Suc (2 * n + 1)) / (2::'a)) * (z + of_nat (Suc (Suc (2 * n + 1))) / (2::'a))

goal (1 subgoal):
 1. \<And>n. pochhammer z (Suc n) * pochhammer (z + (1::'a) / (2::'a)) (Suc n) = (\<Prod>k = 0..2 * n + 1. z + of_nat k / (2::'a)) \<Longrightarrow> pochhammer z (Suc (Suc n)) * pochhammer (z + (1::'a) / (2::'a)) (Suc (Suc n)) = (\<Prod>k = 0..2 * Suc n + 1. z + of_nat k / (2::'a))
[PROOF STEP]
note Suc[folded n'_def]
[PROOF STATE]
proof (state)
this:
pochhammer z n' * pochhammer (z + (1::'a) / (2::'a)) n' = (\<Prod>k = 0..2 * n + 1. z + of_nat k / (2::'a))

goal (1 subgoal):
 1. \<And>n. pochhammer z (Suc n) * pochhammer (z + (1::'a) / (2::'a)) (Suc n) = (\<Prod>k = 0..2 * n + 1. z + of_nat k / (2::'a)) \<Longrightarrow> pochhammer z (Suc (Suc n)) * pochhammer (z + (1::'a) / (2::'a)) (Suc (Suc n)) = (\<Prod>k = 0..2 * Suc n + 1. z + of_nat k / (2::'a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pochhammer z n' * pochhammer (z + (1::'a) / (2::'a)) n' = (\<Prod>k = 0..2 * n + 1. z + of_nat k / (2::'a))

goal (1 subgoal):
 1. \<And>n. pochhammer z (Suc n) * pochhammer (z + (1::'a) / (2::'a)) (Suc n) = (\<Prod>k = 0..2 * n + 1. z + of_nat k / (2::'a)) \<Longrightarrow> pochhammer z (Suc (Suc n)) * pochhammer (z + (1::'a) / (2::'a)) (Suc (Suc n)) = (\<Prod>k = 0..2 * Suc n + 1. z + of_nat k / (2::'a))
[PROOF STEP]
have "(\<Prod>k=0..2 * n + 1. z + of_nat k / 2) * ?B = (\<Prod>k=0..2 * Suc n + 1. z + of_nat k / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>k = 0..2 * n + 1. z + of_nat k / (2::'a)) * ((z + of_nat (Suc (2 * n + 1)) / (2::'a)) * (z + of_nat (Suc (Suc (2 * n + 1))) / (2::'a))) = (\<Prod>k = 0..2 * Suc n + 1. z + of_nat k / (2::'a))
[PROOF STEP]
by (simp add: atLeast0_atMost_Suc)
[PROOF STATE]
proof (state)
this:
(\<Prod>k = 0..2 * n + 1. z + of_nat k / (2::'a)) * ((z + of_nat (Suc (2 * n + 1)) / (2::'a)) * (z + of_nat (Suc (Suc (2 * n + 1))) / (2::'a))) = (\<Prod>k = 0..2 * Suc n + 1. z + of_nat k / (2::'a))

goal (1 subgoal):
 1. \<And>n. pochhammer z (Suc n) * pochhammer (z + (1::'a) / (2::'a)) (Suc n) = (\<Prod>k = 0..2 * n + 1. z + of_nat k / (2::'a)) \<Longrightarrow> pochhammer z (Suc (Suc n)) * pochhammer (z + (1::'a) / (2::'a)) (Suc (Suc n)) = (\<Prod>k = 0..2 * Suc n + 1. z + of_nat k / (2::'a))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
pochhammer z (Suc n') * pochhammer (z + (1::'a) / (2::'a)) (Suc n') = (\<Prod>k = 0..2 * Suc n + 1. z + of_nat k / (2::'a))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
pochhammer z (Suc n') * pochhammer (z + (1::'a) / (2::'a)) (Suc n') = (\<Prod>k = 0..2 * Suc n + 1. z + of_nat k / (2::'a))

goal (1 subgoal):
 1. pochhammer z (Suc (Suc n)) * pochhammer (z + (1::'a) / (2::'a)) (Suc (Suc n)) = (\<Prod>k = 0..2 * Suc n + 1. z + of_nat k / (2::'a))
[PROOF STEP]
by (simp add: n'_def)
[PROOF STATE]
proof (state)
this:
pochhammer z (Suc (Suc n)) * pochhammer (z + (1::'a) / (2::'a)) (Suc (Suc n)) = (\<Prod>k = 0..2 * Suc n + 1. z + of_nat k / (2::'a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cos_arcsin_nonzero: "- 1 < x \<Longrightarrow> x < 1 \<Longrightarrow> cos (arcsin x) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- 1 < x; x < 1\<rbrakk> \<Longrightarrow> cos (arcsin x) \<noteq> 0
[PROOF STEP]
using arcsin_lt_bounded cos_gt_zero_pi
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>- 1 < ?y; ?y < 1\<rbrakk> \<Longrightarrow> - (pi / 2) < arcsin ?y \<and> arcsin ?y < pi / 2
\<lbrakk>- (pi / 2) < ?x; ?x < pi / 2\<rbrakk> \<Longrightarrow> 0 < cos ?x

goal (1 subgoal):
 1. \<lbrakk>- 1 < x; x < 1\<rbrakk> \<Longrightarrow> cos (arcsin x) \<noteq> 0
[PROOF STEP]
by force


[STATEMENT]
lemma card2 :
  shows "card{a, b} \<ge> Suc 0 \<and> card{a, b} \<le> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc 0 \<le> card {a, b} \<and> card {a, b} \<le> 2
[PROOF STEP]
by (simp add: card_insert_if)


[STATEMENT]
lemma gbinomial_trinomial_revision:
  assumes "k \<le> m"
  shows "(a gchoose m) * (of_nat m gchoose k) = (a gchoose k) * (a - of_nat k gchoose (m - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a gchoose m) * (of_nat m gchoose k) = (a gchoose k) * (a - of_nat k gchoose (m - k))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (a gchoose m) * (of_nat m gchoose k) = (a gchoose k) * (a - of_nat k gchoose (m - k))
[PROOF STEP]
have "(a gchoose m) * (of_nat m gchoose k) = (a gchoose m) * fact m / (fact k * fact (m - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a gchoose m) * (of_nat m gchoose k) = (a gchoose m) * fact m / (fact k * fact (m - k))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k \<le> m

goal (1 subgoal):
 1. (a gchoose m) * (of_nat m gchoose k) = (a gchoose m) * fact m / (fact k * fact (m - k))
[PROOF STEP]
by (simp add: binomial_gbinomial [symmetric] binomial_fact)
[PROOF STATE]
proof (state)
this:
(a gchoose m) * (of_nat m gchoose k) = (a gchoose m) * fact m / (fact k * fact (m - k))

goal (1 subgoal):
 1. (a gchoose m) * (of_nat m gchoose k) = (a gchoose k) * (a - of_nat k gchoose (m - k))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(a gchoose m) * (of_nat m gchoose k) = (a gchoose m) * fact m / (fact k * fact (m - k))

goal (1 subgoal):
 1. (a gchoose m) * (of_nat m gchoose k) = (a gchoose k) * (a - of_nat k gchoose (m - k))
[PROOF STEP]
have "\<dots> = (a gchoose k) * (a - of_nat k gchoose (m - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a gchoose m) * fact m / (fact k * fact (m - k)) = (a gchoose k) * (a - of_nat k gchoose (m - k))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k \<le> m

goal (1 subgoal):
 1. (a gchoose m) * fact m / (fact k * fact (m - k)) = (a gchoose k) * (a - of_nat k gchoose (m - k))
[PROOF STEP]
by (simp add: gbinomial_pochhammer power_diff pochhammer_product)
[PROOF STATE]
proof (state)
this:
(a gchoose m) * fact m / (fact k * fact (m - k)) = (a gchoose k) * (a - of_nat k gchoose (m - k))

goal (1 subgoal):
 1. (a gchoose m) * (of_nat m gchoose k) = (a gchoose k) * (a - of_nat k gchoose (m - k))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(a gchoose m) * (of_nat m gchoose k) = (a gchoose k) * (a - of_nat k gchoose (m - k))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(a gchoose m) * (of_nat m gchoose k) = (a gchoose k) * (a - of_nat k gchoose (m - k))

goal (1 subgoal):
 1. (a gchoose m) * (of_nat m gchoose k) = (a gchoose k) * (a - of_nat k gchoose (m - k))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(a gchoose m) * (of_nat m gchoose k) = (a gchoose k) * (a - of_nat k gchoose (m - k))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma  orthogonal_matrix_orthonormal_rows:
  fixes A :: "real^'n^'n"
  shows "orthogonal_matrix A \<longleftrightarrow>
          (\<forall>i. norm(row i A) = 1) \<and>
          (\<forall>i j. i \<noteq> j \<longrightarrow> orthogonal (row i A) (row j A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal_matrix A = ((\<forall>i. norm (row i A) = 1) \<and> (\<forall>i j. i \<noteq> j \<longrightarrow> orthogonal (row i A) (row j A)))
[PROOF STEP]
using orthogonal_matrix_orthonormal_columns [of "transpose A"]
[PROOF STATE]
proof (prove)
using this:
orthogonal_matrix (Finite_Cartesian_Product.transpose A) = ((\<forall>i. norm (column i (Finite_Cartesian_Product.transpose A)) = 1) \<and> (\<forall>i j. i \<noteq> j \<longrightarrow> orthogonal (column i (Finite_Cartesian_Product.transpose A)) (column j (Finite_Cartesian_Product.transpose A))))

goal (1 subgoal):
 1. orthogonal_matrix A = ((\<forall>i. norm (row i A) = 1) \<and> (\<forall>i j. i \<noteq> j \<longrightarrow> orthogonal (row i A) (row j A)))
[PROOF STEP]
by simp


[STATEMENT]
lemma sum_lessThan_conv_atMost_nat:
  fixes f :: "nat \<Rightarrow> 'b :: ab_group_add"
  shows "sum f {..<n} = sum f {..n} - f n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..<n} = sum f {..n} - f n
[PROOF STEP]
by (metis Groups.add_ac(2) add_diff_cancel_left' lessThan_Suc_atMost sum.lessThan_Suc)


[STATEMENT]
lemma consistent_eq_rank_ge_code[code]:
fixes A::"'a::{field}^'cols::{mod_type}^'rows::{mod_type}"
shows "consistent A b = (let GJ_P=Gauss_Jordan_PA A;
                              P_mult_b = (fst(GJ_P) *v b);
                              rank_A = (if A = 0 then 0 else to_nat (GREATEST a. row a (snd GJ_P) \<noteq> 0) + 1) in (rank_A \<ge> (if (\<exists>a. P_mult_b $ a \<noteq> 0)
                                            then (to_nat (GREATEST a. P_mult_b $ a \<noteq> 0) + 1) else 0)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. consistent A b = (let GJ_P = Gauss_Jordan_PA A; P_mult_b = fst GJ_P *v b in Let (if A = 0 then 0 else mod_type_class.to_nat (GREATEST a. row a (snd GJ_P) \<noteq> 0) + 1) ((\<le>) (if \<exists>a. P_mult_b $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. P_mult_b $ a \<noteq> (0::'a)) + 1 else 0)))
[PROOF STEP]
unfolding consistent_eq_rank_ge Let_def rank_Gauss_Jordan_code
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0) \<le> (if A = 0 then 0 else mod_type_class.to_nat (GREATEST a. row a (Gauss_Jordan A) \<noteq> 0) + 1)) = ((if \<exists>a. (fst (Gauss_Jordan_PA A) *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (fst (Gauss_Jordan_PA A) *v b) $ a \<noteq> (0::'a)) + 1 else 0) \<le> (if A = 0 then 0 else mod_type_class.to_nat (GREATEST a. row a (snd (Gauss_Jordan_PA A)) \<noteq> 0) + 1))
[PROOF STEP]
unfolding Gauss_Jordan_PA_eq P_Gauss_Jordan_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((if \<exists>a. (fst (Gauss_Jordan_PA A) *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (fst (Gauss_Jordan_PA A) *v b) $ a \<noteq> (0::'a)) + 1 else 0) \<le> (if A = 0 then 0 else mod_type_class.to_nat (GREATEST a. row a (Gauss_Jordan A) \<noteq> 0) + 1)) = ((if \<exists>a. (fst (Gauss_Jordan_PA A) *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (fst (Gauss_Jordan_PA A) *v b) $ a \<noteq> (0::'a)) + 1 else 0) \<le> (if A = 0 then 0 else mod_type_class.to_nat (GREATEST a. row a (Gauss_Jordan A) \<noteq> 0) + 1))
[PROOF STEP]
..


[STATEMENT]
lemma cosh_real_strict_mono:
  assumes "0 \<le> x" and "x < (y::real)"
  shows   "cosh x < cosh y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cosh x < cosh y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cosh x < cosh y
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 \<le> x
x < y
[PROOF STEP]
have "\<exists>z>x. z < y \<and> cosh y - cosh x = (y - x) * sinh z"
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
x < y

goal (1 subgoal):
 1. \<exists>z>x. z < y \<and> cosh y - cosh x = (y - x) * sinh z
[PROOF STEP]
by (intro MVT2) (auto dest: connectedD_interval intro!: derivative_eq_intros)
[PROOF STATE]
proof (state)
this:
\<exists>z>x. z < y \<and> cosh y - cosh x = (y - x) * sinh z

goal (1 subgoal):
 1. cosh x < cosh y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>z>x. z < y \<and> cosh y - cosh x = (y - x) * sinh z
[PROOF STEP]
obtain z where z: "z > x" "z < y" "cosh y - cosh x = (y - x) * sinh z"
[PROOF STATE]
proof (prove)
using this:
\<exists>z>x. z < y \<and> cosh y - cosh x = (y - x) * sinh z

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>x < z; z < y; cosh y - cosh x = (y - x) * sinh z\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x < z
z < y
cosh y - cosh x = (y - x) * sinh z

goal (1 subgoal):
 1. cosh x < cosh y
[PROOF STEP]
note \<open>cosh y - cosh x = (y - x) * sinh z\<close>
[PROOF STATE]
proof (state)
this:
cosh y - cosh x = (y - x) * sinh z

goal (1 subgoal):
 1. cosh x < cosh y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cosh y - cosh x = (y - x) * sinh z

goal (1 subgoal):
 1. cosh x < cosh y
[PROOF STEP]
from \<open>z > x\<close> and assms
[PROOF STATE]
proof (chain)
picking this:
x < z
0 \<le> x
x < y
[PROOF STEP]
have "(y - x) * sinh z > 0"
[PROOF STATE]
proof (prove)
using this:
x < z
0 \<le> x
x < y

goal (1 subgoal):
 1. 0 < (y - x) * sinh z
[PROOF STEP]
by (intro mult_pos_pos) auto
[PROOF STATE]
proof (state)
this:
0 < (y - x) * sinh z

goal (1 subgoal):
 1. cosh x < cosh y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 < cosh y - cosh x
[PROOF STEP]
show "cosh x < cosh y"
[PROOF STATE]
proof (prove)
using this:
0 < cosh y - cosh x

goal (1 subgoal):
 1. cosh x < cosh y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cosh x < cosh y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma phi'_nonzero:
  assumes "m > 0"
  shows "phi' m > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < phi' m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < phi' m
[PROOF STEP]
have "1 \<in> {x. 1 \<le> x \<and> x \<le> m \<and> coprime x m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<in> {x. 1 \<le> x \<and> x \<le> m \<and> coprime x m}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < m

goal (1 subgoal):
 1. 1 \<in> {x. 1 \<le> x \<and> x \<le> m \<and> coprime x m}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 \<in> {x. 1 \<le> x \<and> x \<le> m \<and> coprime x m}

goal (1 subgoal):
 1. 0 < phi' m
[PROOF STEP]
hence "card {x. 1 \<le> x \<and> x \<le> m \<and> coprime x m} > 0"
[PROOF STATE]
proof (prove)
using this:
1 \<in> {x. 1 \<le> x \<and> x \<le> m \<and> coprime x m}

goal (1 subgoal):
 1. 0 < card {x. 1 \<le> x \<and> x \<le> m \<and> coprime x m}
[PROOF STEP]
by (auto simp: card_gt_0_iff)
[PROOF STATE]
proof (state)
this:
0 < card {x. 1 \<le> x \<and> x \<le> m \<and> coprime x m}

goal (1 subgoal):
 1. 0 < phi' m
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < card {x. 1 \<le> x \<and> x \<le> m \<and> coprime x m}

goal (1 subgoal):
 1. 0 < phi' m
[PROOF STEP]
unfolding phi'_def
[PROOF STATE]
proof (prove)
using this:
0 < card {x. 1 \<le> x \<and> x \<le> m \<and> coprime x m}

goal (1 subgoal):
 1. 0 < card {x. 1 \<le> x \<and> x \<le> m \<and> coprime x m}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < phi' m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma distinct_set_subseqs:
  assumes "distinct xs"
  shows "distinct (map set (subseqs xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (map set (subseqs xs))
[PROOF STEP]
proof (rule card_distinct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (set (map set (subseqs xs))) = length (map set (subseqs xs))
[PROOF STEP]
have "finite (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (set xs)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
finite (set xs)

goal (1 subgoal):
 1. card (set (map set (subseqs xs))) = length (map set (subseqs xs))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (set xs)
[PROOF STEP]
have "card (Pow (set xs)) = 2 ^ card (set xs)"
[PROOF STATE]
proof (prove)
using this:
finite (set xs)

goal (1 subgoal):
 1. card (Pow (set xs)) = 2 ^ card (set xs)
[PROOF STEP]
by (rule card_Pow)
[PROOF STATE]
proof (state)
this:
card (Pow (set xs)) = 2 ^ card (set xs)

goal (1 subgoal):
 1. card (set (map set (subseqs xs))) = length (map set (subseqs xs))
[PROOF STEP]
with assms distinct_card [of xs]
[PROOF STATE]
proof (chain)
picking this:
distinct xs
distinct xs \<Longrightarrow> card (set xs) = length xs
card (Pow (set xs)) = 2 ^ card (set xs)
[PROOF STEP]
have "card (Pow (set xs)) = 2 ^ length xs"
[PROOF STATE]
proof (prove)
using this:
distinct xs
distinct xs \<Longrightarrow> card (set xs) = length xs
card (Pow (set xs)) = 2 ^ card (set xs)

goal (1 subgoal):
 1. card (Pow (set xs)) = 2 ^ length xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (Pow (set xs)) = 2 ^ length xs

goal (1 subgoal):
 1. card (set (map set (subseqs xs))) = length (map set (subseqs xs))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (Pow (set xs)) = 2 ^ length xs
[PROOF STEP]
show "card (set (map set (subseqs xs))) = length (map set (subseqs xs))"
[PROOF STATE]
proof (prove)
using this:
card (Pow (set xs)) = 2 ^ length xs

goal (1 subgoal):
 1. card (set (map set (subseqs xs))) = length (map set (subseqs xs))
[PROOF STEP]
by (simp add: subseqs_powset length_subseqs)
[PROOF STATE]
proof (state)
this:
card (set (map set (subseqs xs))) = length (map set (subseqs xs))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma representation:
  fixes k m :: nat
  assumes "k > 0" "n = m mod k" "l = (m-n)div k"
  shows "m = n+k*l \<and> 0\<le>n \<and> n\<le>k-1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m = n + k * l \<and> 0 \<le> n \<and> n \<le> k - 1
[PROOF STEP]
by (metis Suc_pred' assms le_add2 le_add_same_cancel2
      less_Suc_eq_le minus_mod_eq_div_mult minus_mod_eq_mult_div mod_div_mult_eq
      mod_less_divisor neq0_conv nonzero_mult_div_cancel_left)


[STATEMENT]
lemma continuous_map_prod_top:
   "continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x,y). (f x, g y)) \<longleftrightarrow>
    topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)
[PROOF STEP]
proof (cases "topspace (prod_topology X Y) = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. topspace (prod_topology X Y) = {} \<Longrightarrow> continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)
 2. topspace (prod_topology X Y) \<noteq> {} \<Longrightarrow> continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
topspace (prod_topology X Y) = {}

goal (2 subgoals):
 1. topspace (prod_topology X Y) = {} \<Longrightarrow> continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)
 2. topspace (prod_topology X Y) \<noteq> {} \<Longrightarrow> continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
topspace (prod_topology X Y) = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
topspace (prod_topology X Y) = {}

goal (1 subgoal):
 1. continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)
[PROOF STEP]
by (simp add: continuous_map_on_empty)
[PROOF STATE]
proof (state)
this:
continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)

goal (1 subgoal):
 1. topspace (prod_topology X Y) \<noteq> {} \<Longrightarrow> continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. topspace (prod_topology X Y) \<noteq> {} \<Longrightarrow> continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
topspace (prod_topology X Y) \<noteq> {}

goal (1 subgoal):
 1. topspace (prod_topology X Y) \<noteq> {} \<Longrightarrow> continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
topspace (prod_topology X Y) \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
topspace (prod_topology X Y) \<noteq> {}

goal (1 subgoal):
 1. continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)
[PROOF STEP]
by (simp add: continuous_map_paired case_prod_unfold continuous_map_of_fst [unfolded o_def] continuous_map_of_snd [unfolded o_def])
[PROOF STATE]
proof (state)
this:
continuous_map (prod_topology X Y) (prod_topology X' Y') (\<lambda>(x, y). (f x, g y)) = (topspace (prod_topology X Y) = {} \<or> continuous_map X X' f \<and> continuous_map Y Y' g)

goal:
No subgoals!
[PROOF STEP]
qed