[STATEMENT]
lemma coclop_alt: "(coclop f) = (\<forall>x y. f x \<le> y \<longleftrightarrow> f x \<le> f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coclop f = (\<forall>x y. (f x \<le> y) = (f x \<le> f y))
[PROOF STEP]
unfolding coclop_def mono_def le_fun_def comp_def id_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>x. f x \<le> x) \<and> (\<forall>x y. x \<le> y \<longrightarrow> f x \<le> f y) \<and> (\<forall>x. f x \<le> f (f x))) = (\<forall>x y. (f x \<le> y) = (f x \<le> f y))
[PROOF STEP]
by (meson dual_order.refl order_trans)


[STATEMENT]
lemma sums_mult_iff:
  fixes f :: "nat \<Rightarrow> 'a::{real_normed_algebra,field}"
  assumes "c \<noteq> 0"
  shows "(\<lambda>n. c * f n) sums (c * d) \<longleftrightarrow> f sums d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. c * f n) sums (c * d) = f sums d
[PROOF STEP]
using sums_mult[of f d c] sums_mult[of "\<lambda>n. c * f n" "c * d" "inverse c"]
[PROOF STATE]
proof (prove)
using this:
f sums d \<Longrightarrow> (\<lambda>n. c * f n) sums (c * d)
(\<lambda>n. c * f n) sums (c * d) \<Longrightarrow> (\<lambda>n. inverse c * (c * f n)) sums (inverse c * (c * d))

goal (1 subgoal):
 1. (\<lambda>n. c * f n) sums (c * d) = f sums d
[PROOF STEP]
by (force simp: field_simps assms)


[STATEMENT]
lemma "y + (-x + (- y + x)) = (0::int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y + (- x + (- y + x)) = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma tan_cot: "tan(pi/2 - x) = inverse(tan x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tan (pi / 2 - x) = inverse (tan x)
[PROOF STEP]
by (simp add: tan_def sin_diff cos_diff)


[STATEMENT]
lemma sums_If_finite_set':
  fixes f g :: "nat \<Rightarrow> 'a::{t2_space,topological_ab_group_add}"
  assumes "g sums S" and "finite A" and "S' = S + (\<Sum>n\<in>A. f n - g n)"
  shows   "(\<lambda>n. if n \<in> A then f n else g n) sums S'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. if n \<in> A then f n else g n) sums S'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. if n \<in> A then f n else g n) sums S'
[PROOF STEP]
have "(\<lambda>n. g n + (if n \<in> A then f n - g n else 0)) sums (S + (\<Sum>n\<in>A. f n - g n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. g n + (if n \<in> A then f n - g n else (0::'a))) sums (S + (\<Sum>n\<in>A. f n - g n))
[PROOF STEP]
by (intro sums_add assms sums_If_finite_set)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. g n + (if n \<in> A then f n - g n else (0::'a))) sums (S + (\<Sum>n\<in>A. f n - g n))

goal (1 subgoal):
 1. (\<lambda>n. if n \<in> A then f n else g n) sums S'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. g n + (if n \<in> A then f n - g n else (0::'a))) sums (S + (\<Sum>n\<in>A. f n - g n))

goal (1 subgoal):
 1. (\<lambda>n. if n \<in> A then f n else g n) sums S'
[PROOF STEP]
have "(\<lambda>n. g n + (if n \<in> A then f n - g n else 0)) = (\<lambda>n. if n \<in> A then f n else g n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. g n + (if n \<in> A then f n - g n else (0::'a))) = (\<lambda>n. if n \<in> A then f n else g n)
[PROOF STEP]
by (simp add: fun_eq_iff)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. g n + (if n \<in> A then f n - g n else (0::'a))) = (\<lambda>n. if n \<in> A then f n else g n)

goal (1 subgoal):
 1. (\<lambda>n. if n \<in> A then f n else g n) sums S'
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. if n \<in> A then f n else g n) sums (S + (\<Sum>n\<in>A. f n - g n))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. if n \<in> A then f n else g n) sums (S + (\<Sum>n\<in>A. f n - g n))

goal (1 subgoal):
 1. (\<lambda>n. if n \<in> A then f n else g n) sums S'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. if n \<in> A then f n else g n) sums (S + (\<Sum>n\<in>A. f n - g n))
g sums S
finite A
S' = S + (\<Sum>n\<in>A. f n - g n)

goal (1 subgoal):
 1. (\<lambda>n. if n \<in> A then f n else g n) sums S'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. if n \<in> A then f n else g n) sums S'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_right_leq:
  fixes A :: "('a::{comm_semiring_1,ordered_semiring}) mat"
  assumes "dim_vec y = dim_vec b"
    and "\<forall>i < dim_vec y. y$i \<ge> 0"
    and "[A *\<^sub>v x]\<le> b"
  shows "(A *\<^sub>v x) \<bullet> y \<le> b \<bullet> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y \<le> b \<bullet> y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y \<le> b \<bullet> y
[PROOF STEP]
have "(\<Sum>n<dim_vec b. (A *\<^sub>v x) $ n * y $ n) \<le> (\<Sum>n<dim_vec b. b $ n * y $ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n<dim_vec b. (A *\<^sub>v x) $ n * y $ n) \<le> (\<Sum>n<dim_vec b. b $ n * y $ n)
[PROOF STEP]
by (metis (no_types, lifting) assms(1) assms(2) assms(3) lessThan_iff
        mat_times_vec_leq_def mult_right_mono sum_mono)
[PROOF STATE]
proof (state)
this:
(\<Sum>n<dim_vec b. (A *\<^sub>v x) $ n * y $ n) \<le> (\<Sum>n<dim_vec b. b $ n * y $ n)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y \<le> b \<bullet> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>n<dim_vec b. (A *\<^sub>v x) $ n * y $ n) \<le> (\<Sum>n<dim_vec b. b $ n * y $ n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n<dim_vec b. (A *\<^sub>v x) $ n * y $ n) \<le> (\<Sum>n<dim_vec b. b $ n * y $ n)

goal (1 subgoal):
 1. (A *\<^sub>v x) \<bullet> y \<le> b \<bullet> y
[PROOF STEP]
by (metis (no_types) assms(1) atLeast0LessThan scalar_prod_def)
[PROOF STATE]
proof (state)
this:
(A *\<^sub>v x) \<bullet> y \<le> b \<bullet> y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma retract_fixpoint_property:
  fixes f :: "'a::topological_space \<Rightarrow> 'b::topological_space"
    and S :: "'a set"
  assumes "T retract_of S"
    and FP: "\<And>f. \<lbrakk>continuous_on S f; f ` S \<subseteq> S\<rbrakk> \<Longrightarrow> \<exists>x\<in>S. f x = x"
    and contg: "continuous_on T g"
    and "g ` T \<subseteq> T"
  obtains y where "y \<in> T" and "g y = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>y. \<lbrakk>y \<in> T; g y = y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>y. \<lbrakk>y \<in> T; g y = y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain h where "retraction S T h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>h. retraction S T h \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
T retract_of S

goal (1 subgoal):
 1. (\<And>h. retraction S T h \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding retract_of_def
[PROOF STATE]
proof (prove)
using this:
Ex (retraction S T)

goal (1 subgoal):
 1. (\<And>h. retraction S T h \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
retraction S T h

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>y \<in> T; g y = y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
retraction S T h
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
retraction S T h

goal (1 subgoal):
 1. thesis
[PROOF STEP]
unfolding retraction_def
[PROOF STATE]
proof (prove)
using this:
T \<subseteq> S \<and> continuous_on S h \<and> h ` S \<subseteq> T \<and> (\<forall>x\<in>T. h x = x)

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using invertible_fixpoint_property[OF continuous_on_id _ _ _ _ FP]
[PROOF STATE]
proof (prove)
using this:
T \<subseteq> S \<and> continuous_on S h \<and> h ` S \<subseteq> T \<and> (\<forall>x\<in>T. h x = x)
\<lbrakk>(\<lambda>x. x) ` ?T \<subseteq> S; continuous_on S ?r; ?r ` S \<subseteq> ?T; \<And>y. y \<in> ?T \<Longrightarrow> ?r y = y; \<And>f. \<lbrakk>continuous_on S f; f ` S \<subseteq> S\<rbrakk> \<Longrightarrow> continuous_on S f; \<And>f. \<lbrakk>continuous_on S f; f ` S \<subseteq> S\<rbrakk> \<Longrightarrow> f ` S \<subseteq> S; continuous_on ?T ?g; ?g ` ?T \<subseteq> ?T; \<And>y. \<lbrakk>y \<in> ?T; ?g y = y\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by (metis assms(4) contg image_ident that)
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma completely_multiplicative_function_inverse:
  fixes f :: "nat \<Rightarrow> 'a :: field"
  assumes "completely_multiplicative_function f"
  shows   "completely_multiplicative_function (\<lambda>n. inverse (f n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. completely_multiplicative_function (\<lambda>n. inverse (f n))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. inverse (f 0) = (0::'a)
 2. inverse (f (Suc 0)) = (1::'a)
 3. \<And>a b. \<lbrakk>1 < a; 1 < b\<rbrakk> \<Longrightarrow> inverse (f (a * b)) = inverse (f a) * inverse (f b)
[PROOF STEP]
interpret f: completely_multiplicative_function f
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. completely_multiplicative_function f
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. inverse (f 0) = (0::'a)
 2. inverse (f (Suc 0)) = (1::'a)
 3. \<And>a b. \<lbrakk>1 < a; 1 < b\<rbrakk> \<Longrightarrow> inverse (f (a * b)) = inverse (f a) * inverse (f b)
[PROOF STEP]
show "inverse (f 0) = 0" "inverse (f (Suc 0)) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (f 0) = (0::'a) &&& inverse (f (Suc 0)) = (1::'a)
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
inverse (f 0) = (0::'a)
inverse (f (Suc 0)) = (1::'a)

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>1 < a; 1 < b\<rbrakk> \<Longrightarrow> inverse (f (a * b)) = inverse (f a) * inverse (f b)
[PROOF STEP]
fix a b :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>1 < a; 1 < b\<rbrakk> \<Longrightarrow> inverse (f (a * b)) = inverse (f a) * inverse (f b)
[PROOF STEP]
assume "a > 1" "b > 1"
[PROOF STATE]
proof (state)
this:
1 < a
1 < b

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>1 < a; 1 < b\<rbrakk> \<Longrightarrow> inverse (f (a * b)) = inverse (f a) * inverse (f b)
[PROOF STEP]
thus "inverse (f (a * b)) = inverse (f a) * inverse (f b)"
[PROOF STATE]
proof (prove)
using this:
1 < a
1 < b

goal (1 subgoal):
 1. inverse (f (a * b)) = inverse (f a) * inverse (f b)
[PROOF STEP]
by (simp_all add: f.mult field_simps)
[PROOF STATE]
proof (state)
this:
inverse (f (a * b)) = inverse (f a) * inverse (f b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma setdist_closed_compact:
  fixes S :: "'a::heine_borel set"
  assumes S: "closed S" and T: "compact T"
      and "S \<noteq> {}" "T \<noteq> {}"
    shows "\<exists>x \<in> S. \<exists>y \<in> T. dist x y = setdist S T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<in>S. \<exists>y\<in>T. dist x y = setdist S T
[PROOF STEP]
using setdist_compact_closed [OF T S \<open>T \<noteq> {}\<close> \<open>S \<noteq> {}\<close>]
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>T. \<exists>y\<in>S. dist x y = setdist T S

goal (1 subgoal):
 1. \<exists>x\<in>S. \<exists>y\<in>T. dist x y = setdist S T
[PROOF STEP]
by (metis dist_commute setdist_sym)


[STATEMENT]
theorem pr_rec_last_scheme: "\<lbrakk> g \<in> PrimRec1; h \<in> PrimRec3; \<forall> x. f x 0 = g x; \<forall> x y. f x (Suc y) = h x (f x y) y \<rbrakk> \<Longrightarrow> f \<in> PrimRec2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f x 0 = g x; \<forall>x y. f x (Suc y) = h x (f x y) y\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f x 0 = g x; \<forall>x y. f x (Suc y) = h x (f x y) y\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
assume g_is_pr: "g \<in> PrimRec1"
[PROOF STATE]
proof (state)
this:
g \<in> PrimRec1

goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f x 0 = g x; \<forall>x y. f x (Suc y) = h x (f x y) y\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
assume h_is_pr: "h \<in> PrimRec3"
[PROOF STATE]
proof (state)
this:
h \<in> PrimRec3

goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f x 0 = g x; \<forall>x y. f x (Suc y) = h x (f x y) y\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
assume f_at_0: "\<forall> x. f x 0 = g x"
[PROOF STATE]
proof (state)
this:
\<forall>x. f x 0 = g x

goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f x 0 = g x; \<forall>x y. f x (Suc y) = h x (f x y) y\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
assume f_at_Suc: "\<forall> x y. f x (Suc y) = h x (f x y) y"
[PROOF STATE]
proof (state)
this:
\<forall>x y. f x (Suc y) = h x (f x y) y

goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f x 0 = g x; \<forall>x y. f x (Suc y) = h x (f x y) y\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
from f_at_0 f_at_Suc
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. f x 0 = g x
\<forall>x y. f x (Suc y) = h x (f x y) y
[PROOF STEP]
have "\<And> x y. f x y = PrimRecOp_last g h x y"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. f x 0 = g x
\<forall>x y. f x (Suc y) = h x (f x y) y

goal (1 subgoal):
 1. \<And>x y. f x y = PrimRecOp_last g h x y
[PROOF STEP]
by (induct_tac y, simp_all)
[PROOF STATE]
proof (state)
this:
f ?x ?y = PrimRecOp_last g h ?x ?y

goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f x 0 = g x; \<forall>x y. f x (Suc y) = h x (f x y) y\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f ?x ?y = PrimRecOp_last g h ?x ?y
[PROOF STEP]
have "f = PrimRecOp_last g h"
[PROOF STATE]
proof (prove)
using this:
f ?x ?y = PrimRecOp_last g h ?x ?y

goal (1 subgoal):
 1. f = PrimRecOp_last g h
[PROOF STEP]
by (simp add: ext)
[PROOF STATE]
proof (state)
this:
f = PrimRecOp_last g h

goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f x 0 = g x; \<forall>x y. f x (Suc y) = h x (f x y) y\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
with g_is_pr h_is_pr
[PROOF STATE]
proof (chain)
picking this:
g \<in> PrimRec1
h \<in> PrimRec3
f = PrimRecOp_last g h
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
g \<in> PrimRec1
h \<in> PrimRec3
f = PrimRecOp_last g h

goal (1 subgoal):
 1. f \<in> PrimRec2
[PROOF STEP]
by (simp add: pr_rec_last)
[PROOF STATE]
proof (state)
this:
f \<in> PrimRec2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma floor_one [simp]: "\<lfloor>1\<rfloor> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>1::'a\<rfloor> = 1
[PROOF STEP]
using floor_of_int [of 1]
[PROOF STATE]
proof (prove)
using this:
\<lfloor>of_int 1\<rfloor> = 1

goal (1 subgoal):
 1. \<lfloor>1::'a\<rfloor> = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma Fract_coprime: "Fract (a div gcd a b) (b div gcd a b) = Fract a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fract (a div gcd a b) (b div gcd a b) = Fract a b
[PROOF STEP]
proof (cases "b = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. b = 0 \<Longrightarrow> Fract (a div gcd a b) (b div gcd a b) = Fract a b
 2. b \<noteq> 0 \<Longrightarrow> Fract (a div gcd a b) (b div gcd a b) = Fract a b
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
b = 0

goal (2 subgoals):
 1. b = 0 \<Longrightarrow> Fract (a div gcd a b) (b div gcd a b) = Fract a b
 2. b \<noteq> 0 \<Longrightarrow> Fract (a div gcd a b) (b div gcd a b) = Fract a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b = 0

goal (1 subgoal):
 1. Fract (a div gcd a b) (b div gcd a b) = Fract a b
[PROOF STEP]
by (simp add: eq_rat)
[PROOF STATE]
proof (state)
this:
Fract (a div gcd a b) (b div gcd a b) = Fract a b

goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> Fract (a div gcd a b) (b div gcd a b) = Fract a b
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> Fract (a div gcd a b) (b div gcd a b) = Fract a b
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
b \<noteq> 0

goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> Fract (a div gcd a b) (b div gcd a b) = Fract a b
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
b \<noteq> 0

goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> Fract (a div gcd a b) (b div gcd a b) = Fract a b
[PROOF STEP]
have "b div gcd a b * gcd a b = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b div gcd a b * gcd a b = b
[PROOF STEP]
by (rule dvd_div_mult_self) simp
[PROOF STATE]
proof (state)
this:
b div gcd a b * gcd a b = b

goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> Fract (a div gcd a b) (b div gcd a b) = Fract a b
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
b \<noteq> 0
b div gcd a b * gcd a b = b
[PROOF STEP]
have "b div gcd a b * gcd a b \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
b \<noteq> 0
b div gcd a b * gcd a b = b

goal (1 subgoal):
 1. b div gcd a b * gcd a b \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b div gcd a b * gcd a b \<noteq> 0

goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> Fract (a div gcd a b) (b div gcd a b) = Fract a b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b div gcd a b * gcd a b \<noteq> 0
[PROOF STEP]
have "b div gcd a b \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
b div gcd a b * gcd a b \<noteq> 0

goal (1 subgoal):
 1. b div gcd a b \<noteq> 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
b div gcd a b \<noteq> 0

goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> Fract (a div gcd a b) (b div gcd a b) = Fract a b
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
b \<noteq> 0
b div gcd a b \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b \<noteq> 0
b div gcd a b \<noteq> 0

goal (1 subgoal):
 1. Fract (a div gcd a b) (b div gcd a b) = Fract a b
[PROOF STEP]
by (simp add: eq_rat dvd_div_mult mult.commute [of a])
[PROOF STATE]
proof (state)
this:
Fract (a div gcd a b) (b div gcd a b) = Fract a b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bezout_prime:
  assumes p: "prime p" and pa: "\<not> p dvd a"
  shows "\<exists>x y. a*x = Suc (p*y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x y. a * x = Suc (p * y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x y. a * x = Suc (p * y)
[PROOF STEP]
have ap: "coprime a p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime a p
[PROOF STEP]
using coprime_commute p pa prime_imp_coprime
[PROOF STATE]
proof (prove)
using this:
coprime ?b ?a = coprime ?a ?b
prime p
\<not> p dvd a
\<lbrakk>prime ?p; \<not> ?p dvd ?n\<rbrakk> \<Longrightarrow> coprime ?p ?n

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

goal (1 subgoal):
 1. \<exists>x y. a * x = Suc (p * y)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
coprime a p

goal (1 subgoal):
 1. \<exists>x y. a * x = Suc (p * y)
[PROOF STEP]
from p
[PROOF STATE]
proof (chain)
picking this:
prime p
[PROOF STEP]
have "p \<noteq> 1"
[PROOF STATE]
proof (prove)
using this:
prime p

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

goal (1 subgoal):
 1. \<exists>x y. a * x = Suc (p * y)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
coprime a p
p \<noteq> 1
[PROOF STEP]
have "\<exists>x y. a * x = p * y + 1"
[PROOF STATE]
proof (prove)
using this:
coprime a p
p \<noteq> 1

goal (1 subgoal):
 1. \<exists>x y. a * x = p * y + 1
[PROOF STEP]
by (rule coprime_bezout_strong)
[PROOF STATE]
proof (state)
this:
\<exists>x y. a * x = p * y + 1

goal (1 subgoal):
 1. \<exists>x y. a * x = Suc (p * y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>x y. a * x = p * y + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>x y. a * x = p * y + 1

goal (1 subgoal):
 1. \<exists>x y. a * x = Suc (p * y)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<exists>x y. a * x = Suc (p * y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma less_omega_exp: "x < \<epsilon>\<^sub>0 \<Longrightarrow> x < \<omega> ** x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < \<epsilon>\<^sub>0 \<Longrightarrow> x < \<omega> ** x
[PROOF STEP]
apply (unfold epsilon0_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < oFix ((**) \<omega>) 0 \<Longrightarrow> x < \<omega> ** x
[PROOF STEP]
apply (erule less_oFix_0D)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono ((**) \<omega>)
[PROOF STEP]
apply (rule continuous.mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous ((**) \<omega>)
[PROOF STEP]
apply (rule continuous_exp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < \<omega>
[PROOF STEP]
apply (rule zero_less_omega)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma normal_density_times':
  assumes "\<sigma> > 0" "\<sigma>' > 0"
  shows "a * normal_density \<mu> \<sigma> x * normal_density \<mu>' \<sigma>' x = a * (1 / sqrt (2 * pi * (\<sigma>\<^sup>2 + \<sigma>'\<^sup>2))) * exp (- (\<mu> - \<mu>')\<^sup>2 / (2 * (\<sigma>\<^sup>2 + \<sigma>'\<^sup>2))) * normal_density ((\<mu>*\<sigma>'\<^sup>2 + \<mu>'*\<sigma>\<^sup>2)/(\<sigma>\<^sup>2 + \<sigma>'\<^sup>2)) (\<sigma> * \<sigma>' / sqrt (\<sigma>\<^sup>2 + \<sigma>'\<^sup>2)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * normal_density \<mu> \<sigma> x * normal_density \<mu>' \<sigma>' x = a * (1 / sqrt (2 * pi * (\<sigma>\<^sup>2 + \<sigma>'\<^sup>2))) * exp (- (\<mu> - \<mu>')\<^sup>2 / (2 * (\<sigma>\<^sup>2 + \<sigma>'\<^sup>2))) * normal_density ((\<mu> * \<sigma>'\<^sup>2 + \<mu>' * \<sigma>\<^sup>2) / (\<sigma>\<^sup>2 + \<sigma>'\<^sup>2)) (\<sigma> * \<sigma>' / sqrt (\<sigma>\<^sup>2 + \<sigma>'\<^sup>2)) x
[PROOF STEP]
using normal_density_times[OF assms,of \<mu> x \<mu>']
[PROOF STATE]
proof (prove)
using this:
normal_density \<mu> \<sigma> x * normal_density \<mu>' \<sigma>' x = 1 / sqrt (2 * pi * (\<sigma>\<^sup>2 + \<sigma>'\<^sup>2)) * exp (- (\<mu> - \<mu>')\<^sup>2 / (2 * (\<sigma>\<^sup>2 + \<sigma>'\<^sup>2))) * normal_density ((\<mu> * \<sigma>'\<^sup>2 + \<mu>' * \<sigma>\<^sup>2) / (\<sigma>\<^sup>2 + \<sigma>'\<^sup>2)) (\<sigma> * \<sigma>' / sqrt (\<sigma>\<^sup>2 + \<sigma>'\<^sup>2)) x

goal (1 subgoal):
 1. a * normal_density \<mu> \<sigma> x * normal_density \<mu>' \<sigma>' x = a * (1 / sqrt (2 * pi * (\<sigma>\<^sup>2 + \<sigma>'\<^sup>2))) * exp (- (\<mu> - \<mu>')\<^sup>2 / (2 * (\<sigma>\<^sup>2 + \<sigma>'\<^sup>2))) * normal_density ((\<mu> * \<sigma>'\<^sup>2 + \<mu>' * \<sigma>\<^sup>2) / (\<sigma>\<^sup>2 + \<sigma>'\<^sup>2)) (\<sigma> * \<sigma>' / sqrt (\<sigma>\<^sup>2 + \<sigma>'\<^sup>2)) x
[PROOF STEP]
by (simp add: mult.assoc)


[STATEMENT]
lemma ordLeq_countable_subsets:
"|A| \<le>o |{X. X \<subseteq> A \<and> countable X}|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |A| \<le>o |{X. X \<subseteq> A \<and> countable X}|
[PROOF STEP]
apply (rule card_of_ordLeqI[of "\<lambda> a. {a}"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. inj_on (\<lambda>a. {a}) A
 2. \<And>a. a \<in> A \<Longrightarrow> {a} \<in> {X. X \<subseteq> A \<and> countable X}
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>x\<in>A. \<forall>y\<in>A. {x} = {y} \<longrightarrow> x = y
 2. \<And>a. a \<in> A \<Longrightarrow> {a} \<in> {X. X \<subseteq> A \<and> countable X}
[PROOF STEP]
by auto


[STATEMENT]
lemma (in cpx_sq_mat) weighted_sum_rank_1_proj_unitary:
  assumes "A \<in> fc_mats"
and "B \<in> fc_mats"
and "diagonal_mat B"
and "Complex_Matrix.unitary A"
shows "(sum_mat (\<lambda>i. (diag_mat B)!i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..< dimR}) =
  (A * B * (Complex_Matrix.adjoint A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} = A * B * Complex_Matrix.adjoint A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (A * B * Complex_Matrix.adjoint A); j < dim_col (A * B * Complex_Matrix.adjoint A)\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (i, j) = (A * B * Complex_Matrix.adjoint A) $$ (i, j)
 2. dim_row (local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR}) = dim_row (A * B * Complex_Matrix.adjoint A)
 3. dim_col (local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR}) = dim_col (A * B * Complex_Matrix.adjoint A)
[PROOF STEP]
show "dim_row (sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR}) =
    dim_row (A * B * Complex_Matrix.adjoint A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR}) = dim_row (A * B * Complex_Matrix.adjoint A)
[PROOF STEP]
using assms fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
A \<in> fc_mats
B \<in> fc_mats
diagonal_mat B
Complex_Matrix.unitary A
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. dim_row (local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR}) = dim_row (A * B * Complex_Matrix.adjoint A)
[PROOF STEP]
by (metis (no_types, lifting) carrier_matD(1) cpx_sq_mat_smult dim_col index_mult_mat(2)
        rank_1_proj_carrier sum_mat_carrier)
[PROOF STATE]
proof (state)
this:
dim_row (local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR}) = dim_row (A * B * Complex_Matrix.adjoint A)

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (A * B * Complex_Matrix.adjoint A); j < dim_col (A * B * Complex_Matrix.adjoint A)\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (i, j) = (A * B * Complex_Matrix.adjoint A) $$ (i, j)
 2. dim_col (local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR}) = dim_col (A * B * Complex_Matrix.adjoint A)
[PROOF STEP]
show "dim_col (local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR}) =
    dim_col (A * B * Complex_Matrix.adjoint A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR}) = dim_col (A * B * Complex_Matrix.adjoint A)
[PROOF STEP]
using assms fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
A \<in> fc_mats
B \<in> fc_mats
diagonal_mat B
Complex_Matrix.unitary A
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. dim_col (local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR}) = dim_col (A * B * Complex_Matrix.adjoint A)
[PROOF STEP]
by (metis (mono_tags, lifting) adjoint_dim_col carrier_matD(1) carrier_matI dim_col
        index_mult_mat(3) index_smult_mat(2) index_smult_mat(3) rank_1_proj_dim
        rank_1_proj_square_mat square_mat.elims(2) square_mats sum_mat_carrier)
[PROOF STATE]
proof (state)
this:
dim_col (local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR}) = dim_col (A * B * Complex_Matrix.adjoint A)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A * B * Complex_Matrix.adjoint A); j < dim_col (A * B * Complex_Matrix.adjoint A)\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (i, j) = (A * B * Complex_Matrix.adjoint A) $$ (i, j)
[PROOF STEP]
show "\<And>i j. i < dim_row (A * B * Complex_Matrix.adjoint A) \<Longrightarrow>
           j < dim_col (A * B * Complex_Matrix.adjoint A) \<Longrightarrow>
           local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (i, j) =
           (A * B * Complex_Matrix.adjoint A) $$ (i, j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A * B * Complex_Matrix.adjoint A); j < dim_col (A * B * Complex_Matrix.adjoint A)\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (i, j) = (A * B * Complex_Matrix.adjoint A) $$ (i, j)
[PROOF STEP]
using weighted_sum_rank_1_proj_unitary_index[of A B] dim_eq fc_mats_carrier
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>A \<in> fc_mats; B \<in> fc_mats; diagonal_mat B; Complex_Matrix.unitary A; ?j < dimR; ?k < dimR\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (?j, ?k) = (A * B * Complex_Matrix.adjoint A) $$ (?j, ?k)
dimR = dimC
fc_mats = carrier_mat dimR dimC

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A * B * Complex_Matrix.adjoint A); j < dim_col (A * B * Complex_Matrix.adjoint A)\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (i, j) = (A * B * Complex_Matrix.adjoint A) $$ (i, j)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>A \<in> fc_mats; B \<in> fc_mats; diagonal_mat B; Complex_Matrix.unitary A; ?j < dimR; ?k < dimR\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (?j, ?k) = (A * B * Complex_Matrix.adjoint A) $$ (?j, ?k)
dimR = dimC
fc_mats = carrier_mat dimR dimC
A \<in> fc_mats
B \<in> fc_mats
diagonal_mat B
Complex_Matrix.unitary A

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (A * B * Complex_Matrix.adjoint A); j < dim_col (A * B * Complex_Matrix.adjoint A)\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (i, j) = (A * B * Complex_Matrix.adjoint A) $$ (i, j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i2 < dim_row (A * B * Complex_Matrix.adjoint A); ?j2 < dim_col (A * B * Complex_Matrix.adjoint A)\<rbrakk> \<Longrightarrow> local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (?i2, ?j2) = (A * B * Complex_Matrix.adjoint A) $$ (?i2, ?j2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma matrix_vector_column:
  "(A::'a::comm_semiring_1^'n^_) *v x = sum (\<lambda>i. (x$i) *s ((transpose A)$i)) (UNIV:: 'n set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *v x = (\<Sum>i\<in>UNIV. x $ i *s Finite_Cartesian_Product.transpose A $ i)
[PROOF STEP]
by (simp add: matrix_vector_mult_def transpose_def vec_eq_iff mult.commute)


[STATEMENT]
lemma sum_upto_dirichlet_prod:
  "sum_upto (dirichlet_prod f g) x = sum_upto (\<lambda>d. f d * sum_upto g (x / real d)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (dirichlet_prod f g) x = sum_upto (\<lambda>d. f d * sum_upto g (x / real d)) x
[PROOF STEP]
unfolding dirichlet_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. \<Sum>d | d dvd n. f d * g (n div d)) x = sum_upto (\<lambda>d. f d * sum_upto g (x / real d)) x
[PROOF STEP]
by (subst sum_upto_sum_divisors) (simp add: sum_upto_def sum_distrib_left)


[STATEMENT]
lemma coprime_cong_prod_poly:
    "(\<forall>i\<in>A. (\<forall>j\<in>A. i \<noteq> j \<longrightarrow> coprime (m i) (m j))) \<Longrightarrow>
      (\<forall>i\<in>A. [(x::'b::{field_gcd} poly) = y] (mod m i)) \<Longrightarrow>
         [x = y] (mod (\<Prod>i\<in>A. m i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>i\<in>A. \<forall>j\<in>A. i \<noteq> j \<longrightarrow> coprime (m i) (m j); \<forall>i\<in>A. [x = y] (mod m i)\<rbrakk> \<Longrightarrow> [x = y] (mod prod m A)
[PROOF STEP]
apply (induct A rule: infinite_finite_induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>A. \<lbrakk>infinite A; \<forall>i\<in>A. \<forall>j\<in>A. i \<noteq> j \<longrightarrow> coprime (m i) (m j); \<forall>i\<in>A. [x = y] (mod m i)\<rbrakk> \<Longrightarrow> [x = y] (mod prod m A)
 2. \<lbrakk>\<forall>i\<in>{}. \<forall>j\<in>{}. i \<noteq> j \<longrightarrow> coprime (m i) (m j); \<forall>i\<in>{}. [x = y] (mod m i)\<rbrakk> \<Longrightarrow> [x = y] (mod prod m {})
 3. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; \<lbrakk>\<forall>i\<in>F. \<forall>j\<in>F. i \<noteq> j \<longrightarrow> coprime (m i) (m j); \<forall>i\<in>F. [x = y] (mod m i)\<rbrakk> \<Longrightarrow> [x = y] (mod prod m F); \<forall>i\<in>insert xa F. \<forall>j\<in>insert xa F. i \<noteq> j \<longrightarrow> coprime (m i) (m j); \<forall>i\<in>insert xa F. [x = y] (mod m i)\<rbrakk> \<Longrightarrow> [x = y] (mod prod m (insert xa F))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; [x = y] (mod prod m F); \<forall>j\<in>F. xa \<noteq> j \<longrightarrow> coprime (m xa) (m j); \<forall>i\<in>F. (i \<noteq> xa \<longrightarrow> coprime (m i) (m xa)) \<and> (\<forall>j\<in>F. i \<noteq> j \<longrightarrow> coprime (m i) (m j)); [x = y] (mod m xa); \<forall>i\<in>F. [x = y] (mod m i)\<rbrakk> \<Longrightarrow> [x = y] (mod m xa * prod m F)
[PROOF STEP]
apply (metis coprime_cong_mult_poly prod_coprime_right)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma integer_singleton_least :
  assumes "{x . P x} = {a::integer}"
  shows "a = (LEAST x . P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = (LEAST x. P x)
[PROOF STEP]
by (metis Collect_empty_eq Least_equality assms insert_not_empty mem_Collect_eq order_refl singletonD)


[STATEMENT]
lemma map_snd_zip_take:
  "map snd (zip xs ys) = take (min (length xs) (length ys)) ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map snd (zip xs ys) = take (min (length xs) (length ys)) ys
[PROOF STEP]
by (induct xs ys rule: list_induct2') simp_all


[STATEMENT]
lemma invertible_transpose:
  fixes A::"'a::{field}^'n^'n"
  assumes "invertible A"
  shows "invertible (transpose A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible (Finite_Cartesian_Product.transpose A)
[PROOF STEP]
by (metis invertible_det_nz assms det_transpose)


[STATEMENT]
lemma ex_x_axis_poincare_distance_negative:
  assumes "d \<ge> 0"
  shows "\<exists> z. is_real z \<and> Re z \<le> 0 \<and> Re z > -1 \<and>
              of_complex z \<in> unit_disc \<and> of_complex z \<in> circline_set x_axis \<and>
              poincare_distance 0\<^sub>h (of_complex z) = d" (is "\<exists> z. ?P z")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z. is_real z \<and> Re z \<le> 0 \<and> - 1 < Re z \<and> of_complex z \<in> unit_disc \<and> of_complex z \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex z) = d
[PROOF STEP]
using ex_x_axis_poincare_distance_negative'[OF assms]
[PROOF STATE]
proof (prove)
using this:
let x = (1 - exp d) / (1 + exp d) in is_real (cor x) \<and> Re (cor x) \<le> 0 \<and> - 1 < Re (cor x) \<and> of_complex (cor x) \<in> unit_disc \<and> of_complex (cor x) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor x)) = d

goal (1 subgoal):
 1. \<exists>z. is_real z \<and> Re z \<le> 0 \<and> - 1 < Re z \<and> of_complex z \<in> unit_disc \<and> of_complex z \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex z) = d
[PROOF STEP]
unfolding Let_def
[PROOF STATE]
proof (prove)
using this:
is_real (cor ((1 - exp d) / (1 + exp d))) \<and> Re (cor ((1 - exp d) / (1 + exp d))) \<le> 0 \<and> - 1 < Re (cor ((1 - exp d) / (1 + exp d))) \<and> of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> unit_disc \<and> of_complex (cor ((1 - exp d) / (1 + exp d))) \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex (cor ((1 - exp d) / (1 + exp d)))) = d

goal (1 subgoal):
 1. \<exists>z. is_real z \<and> Re z \<le> 0 \<and> - 1 < Re z \<and> of_complex z \<in> unit_disc \<and> of_complex z \<in> circline_set x_axis \<and> poincare_distance 0\<^sub>h (of_complex z) = d
[PROOF STEP]
by blast


[STATEMENT]
lemma cos_arctan: "cos (arctan x) = 1 / sqrt (1 + x\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (arctan x) = 1 / sqrt (1 + x\<^sup>2)
[PROOF STEP]
proof (rule power2_eq_imp_eq)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (cos (arctan x))\<^sup>2 = (1 / sqrt (1 + x\<^sup>2))\<^sup>2
 2. 0 \<le> cos (arctan x)
 3. 0 \<le> 1 / sqrt (1 + x\<^sup>2)
[PROOF STEP]
have "0 < 1 + x\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1 + x\<^sup>2
[PROOF STEP]
by (simp add: add_pos_nonneg)
[PROOF STATE]
proof (state)
this:
0 < 1 + x\<^sup>2

goal (3 subgoals):
 1. (cos (arctan x))\<^sup>2 = (1 / sqrt (1 + x\<^sup>2))\<^sup>2
 2. 0 \<le> cos (arctan x)
 3. 0 \<le> 1 / sqrt (1 + x\<^sup>2)
[PROOF STEP]
show "0 \<le> 1 / sqrt (1 + x\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> 1 / sqrt (1 + x\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> 1 / sqrt (1 + x\<^sup>2)

goal (2 subgoals):
 1. (cos (arctan x))\<^sup>2 = (1 / sqrt (1 + x\<^sup>2))\<^sup>2
 2. 0 \<le> cos (arctan x)
[PROOF STEP]
show "0 \<le> cos (arctan x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> cos (arctan x)
[PROOF STEP]
by (intro less_imp_le cos_gt_zero_pi arctan_lbound arctan_ubound)
[PROOF STATE]
proof (state)
this:
0 \<le> cos (arctan x)

goal (1 subgoal):
 1. (cos (arctan x))\<^sup>2 = (1 / sqrt (1 + x\<^sup>2))\<^sup>2
[PROOF STEP]
have "(cos (arctan x))\<^sup>2 * (1 + (tan (arctan x))\<^sup>2) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cos (arctan x))\<^sup>2 * (1 + (tan (arctan x))\<^sup>2) = 1
[PROOF STEP]
unfolding tan_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cos (arctan x))\<^sup>2 * (1 + (sin (arctan x) / cos (arctan x))\<^sup>2) = 1
[PROOF STEP]
by (simp add: distrib_left power_divide)
[PROOF STATE]
proof (state)
this:
(cos (arctan x))\<^sup>2 * (1 + (tan (arctan x))\<^sup>2) = 1

goal (1 subgoal):
 1. (cos (arctan x))\<^sup>2 = (1 / sqrt (1 + x\<^sup>2))\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(cos (arctan x))\<^sup>2 * (1 + (tan (arctan x))\<^sup>2) = 1
[PROOF STEP]
show "(cos (arctan x))\<^sup>2 = (1 / sqrt (1 + x\<^sup>2))\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
(cos (arctan x))\<^sup>2 * (1 + (tan (arctan x))\<^sup>2) = 1

goal (1 subgoal):
 1. (cos (arctan x))\<^sup>2 = (1 / sqrt (1 + x\<^sup>2))\<^sup>2
[PROOF STEP]
using \<open>0 < 1 + x\<^sup>2\<close>
[PROOF STATE]
proof (prove)
using this:
(cos (arctan x))\<^sup>2 * (1 + (tan (arctan x))\<^sup>2) = 1
0 < 1 + x\<^sup>2

goal (1 subgoal):
 1. (cos (arctan x))\<^sup>2 = (1 / sqrt (1 + x\<^sup>2))\<^sup>2
[PROOF STEP]
by (simp add: arctan power_divide eq_divide_eq)
[PROOF STATE]
proof (state)
this:
(cos (arctan x))\<^sup>2 = (1 / sqrt (1 + x\<^sup>2))\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bezout_gcd_nat:
  fixes a::nat shows "\<exists>x y. a * x - b * y = gcd a b \<or> b * x - a * y = gcd a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x y. a * x - b * y = gcd a b \<or> b * x - a * y = gcd a b
[PROOF STEP]
using bezout_nat[of a b]
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0 \<Longrightarrow> \<exists>x y. a * x = b * y + gcd a b

goal (1 subgoal):
 1. \<exists>x y. a * x - b * y = gcd a b \<or> b * x - a * y = gcd a b
[PROOF STEP]
by (metis bezout_nat diff_add_inverse gcd_add_mult gcd.commute
  gcd_nat.right_neutral mult_0)


[STATEMENT]
lemma Gauss_Jordan:
  fixes A::"'a::{field}^'n::{mod_type}^'m::{mod_type}"
  shows "\<exists>P. invertible P \<and> (Gauss_Jordan A) = P**A \<and> reduced_row_echelon_form (Gauss_Jordan A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>P. invertible P \<and> Gauss_Jordan A = P ** A \<and> reduced_row_echelon_form (Gauss_Jordan A)
[PROOF STEP]
by (simp add: invertible_Gauss_Jordan rref_Gauss_Jordan)


[STATEMENT]
lemma ccSup_le_iff: "countable A \<Longrightarrow> Sup A \<le> b \<longleftrightarrow> (\<forall>a\<in>A. a \<le> b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable A \<Longrightarrow> (Sup A \<le> b) = (\<forall>a\<in>A. a \<le> b)
[PROOF STEP]
by (auto intro: ccSup_least dest: ccSup_upper)


[STATEMENT]
lemma Hausdorff_space_euclidean [simp]: "Hausdorff_space (euclidean :: 'a::metric_space topology)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hausdorff_space euclidean
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Hausdorff_space euclidean
[PROOF STEP]
have "\<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> disjnt U V"
    if "x \<noteq> y"
    for x y :: 'a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> disjnt U V
[PROOF STEP]
proof (intro exI conjI)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. open ?U
 2. open ?V1
 3. x \<in> ?U
 4. y \<in> ?V1
 5. disjnt ?U ?V1
[PROOF STEP]
let ?r = "dist x y / 2"
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. open ?U
 2. open ?V1
 3. x \<in> ?U
 4. y \<in> ?V1
 5. disjnt ?U ?V1
[PROOF STEP]
have [simp]: "?r > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < dist x y / 2
[PROOF STEP]
by (simp add: that)
[PROOF STATE]
proof (state)
this:
0 < dist x y / 2

goal (5 subgoals):
 1. open ?U
 2. open ?V1
 3. x \<in> ?U
 4. y \<in> ?V1
 5. disjnt ?U ?V1
[PROOF STEP]
show "open (ball x ?r)" "open (ball y ?r)" "x \<in> (ball x ?r)" "y \<in> (ball y ?r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (open (ball x (dist x y / 2)) &&& open (ball y (dist x y / 2))) &&& x \<in> ball x (dist x y / 2) &&& y \<in> ball y (dist x y / 2)
[PROOF STEP]
by (auto simp add: that)
[PROOF STATE]
proof (state)
this:
open (ball x (dist x y / 2))
open (ball y (dist x y / 2))
x \<in> ball x (dist x y / 2)
y \<in> ball y (dist x y / 2)

goal (1 subgoal):
 1. disjnt (ball x (dist x y / 2)) (ball y (dist x y / 2))
[PROOF STEP]
show "disjnt (ball x ?r) (ball y ?r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. disjnt (ball x (dist x y / 2)) (ball y (dist x y / 2))
[PROOF STEP]
unfolding disjnt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ball x (dist x y / 2) \<inter> ball y (dist x y / 2) = {}
[PROOF STEP]
by (simp add: disjoint_ballI)
[PROOF STATE]
proof (state)
this:
disjnt (ball x (dist x y / 2)) (ball y (dist x y / 2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<noteq> ?y \<Longrightarrow> \<exists>U V. open U \<and> open V \<and> ?x \<in> U \<and> ?y \<in> V \<and> disjnt U V

goal (1 subgoal):
 1. Hausdorff_space euclidean
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x \<noteq> ?y \<Longrightarrow> \<exists>U V. open U \<and> open V \<and> ?x \<in> U \<and> ?y \<in> V \<and> disjnt U V
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?x \<noteq> ?y \<Longrightarrow> \<exists>U V. open U \<and> open V \<and> ?x \<in> U \<and> ?y \<in> V \<and> disjnt U V

goal (1 subgoal):
 1. Hausdorff_space euclidean
[PROOF STEP]
by (simp add: Hausdorff_space_def)
[PROOF STATE]
proof (state)
this:
Hausdorff_space euclidean

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma path_image_rectpath_cbox_minus_box:
  assumes "Re a \<le> Re b" "Im a \<le> Im b"
  shows   "path_image (rectpath a b) = cbox a b - box a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image (rectpath a b) = cbox a b - box a b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Re a \<le> Re b
Im a \<le> Im b

goal (1 subgoal):
 1. path_image (rectpath a b) = cbox a b - box a b
[PROOF STEP]
by (auto simp: path_image_rectpath in_cbox_complex_iff
                             in_box_complex_iff)


[STATEMENT]
lemma (in monoid) pow_mult_distrib:
  assumes eq: "x \<otimes> y = y \<otimes> x" and xy: "x \<in> carrier G" "y \<in> carrier G"
  shows "(x \<otimes> y) [^] (n::nat) = x [^] n \<otimes> y [^] n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<otimes> y) [^] n = x [^] n \<otimes> y [^] n
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (x \<otimes> y) [^] 0 = x [^] 0 \<otimes> y [^] 0
 2. \<And>n. (x \<otimes> y) [^] n = x [^] n \<otimes> y [^] n \<Longrightarrow> (x \<otimes> y) [^] Suc n = x [^] Suc n \<otimes> y [^] Suc n
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
(x \<otimes> y) [^] n = x [^] n \<otimes> y [^] n

goal (2 subgoals):
 1. (x \<otimes> y) [^] 0 = x [^] 0 \<otimes> y [^] 0
 2. \<And>n. (x \<otimes> y) [^] n = x [^] n \<otimes> y [^] n \<Longrightarrow> (x \<otimes> y) [^] Suc n = x [^] Suc n \<otimes> y [^] Suc n
[PROOF STEP]
have "x \<otimes> (y [^] n \<otimes> y) = y [^] n \<otimes> x \<otimes> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<otimes> (y [^] n \<otimes> y) = y [^] n \<otimes> x \<otimes> y
[PROOF STEP]
by (simp add: eq group_commutes_pow m_assoc xy)
[PROOF STATE]
proof (state)
this:
x \<otimes> (y [^] n \<otimes> y) = y [^] n \<otimes> x \<otimes> y

goal (2 subgoals):
 1. (x \<otimes> y) [^] 0 = x [^] 0 \<otimes> y [^] 0
 2. \<And>n. (x \<otimes> y) [^] n = x [^] n \<otimes> y [^] n \<Longrightarrow> (x \<otimes> y) [^] Suc n = x [^] Suc n \<otimes> y [^] Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<otimes> (y [^] n \<otimes> y) = y [^] n \<otimes> x \<otimes> y
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
x \<otimes> (y [^] n \<otimes> y) = y [^] n \<otimes> x \<otimes> y

goal (1 subgoal):
 1. (x \<otimes> y) [^] Suc n = x [^] Suc n \<otimes> y [^] Suc n
[PROOF STEP]
using assms Suc.hyps m_assoc
[PROOF STATE]
proof (prove)
using this:
x \<otimes> (y [^] n \<otimes> y) = y [^] n \<otimes> x \<otimes> y
x \<otimes> y = y \<otimes> x
x \<in> carrier G
y \<in> carrier G
(x \<otimes> y) [^] n = x [^] n \<otimes> y [^] n
\<lbrakk>?x \<in> carrier G; ?y \<in> carrier G; ?z \<in> carrier G\<rbrakk> \<Longrightarrow> ?x \<otimes> ?y \<otimes> ?z = ?x \<otimes> (?y \<otimes> ?z)

goal (1 subgoal):
 1. (x \<otimes> y) [^] Suc n = x [^] Suc n \<otimes> y [^] Suc n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x \<otimes> y) [^] Suc n = x [^] Suc n \<otimes> y [^] Suc n

goal (1 subgoal):
 1. (x \<otimes> y) [^] 0 = x [^] 0 \<otimes> y [^] 0
[PROOF STEP]
qed auto


[STATEMENT]
lemma mat_incr_mult_adjoint_mat_incr:
  shows "mat_incr n * (adjoint (mat_incr n)) = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_incr n * adjoint (mat_incr n) = 1\<^sub>m n
[PROOF STEP]
apply (rule eq_matI, simp)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> (i = j \<longrightarrow> (mat_incr n * adjoint (mat_incr n)) $$ (j, j) = 1) \<and> (i \<noteq> j \<longrightarrow> (mat_incr n * adjoint (mat_incr n)) $$ (i, j) = 0)
 2. dim_row (mat_incr n * adjoint (mat_incr n)) = dim_row (1\<^sub>m n)
 3. dim_col (mat_incr n * adjoint (mat_incr n)) = dim_col (1\<^sub>m n)
[PROOF STEP]
apply (auto simp add: carrier_matD[OF mat_incr_dim] scalar_prod_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>j. j < n \<Longrightarrow> (\<Sum>i = 0..<n. mat_incr n $$ (j, i) * adjoint (mat_incr n) $$ (i, j)) = 1
 2. \<And>i j. \<lbrakk>i < n; j < n; i \<noteq> j\<rbrakk> \<Longrightarrow> (\<Sum>ia = 0..<n. mat_incr n $$ (i, ia) * adjoint (mat_incr n) $$ (ia, j)) = 0
[PROOF STEP]
unfolding adjoint_mat_incr
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>j. j < n \<Longrightarrow> (\<Sum>i = 0..<n. mat_incr n $$ (j, i) * mat n n (\<lambda>(i, j). if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0) $$ (i, j)) = 1
 2. \<And>i j. \<lbrakk>i < n; j < n; i \<noteq> j\<rbrakk> \<Longrightarrow> (\<Sum>ia = 0..<n. mat_incr n $$ (i, ia) * mat n n (\<lambda>(i, j). if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0) $$ (ia, j)) = 0
[PROOF STEP]
unfolding mat_incr_def
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>j. j < n \<Longrightarrow> (\<Sum>i = 0..<n. mat n n (\<lambda>(i, j). if i = 0 then if j = n - 1 then 1 else 0 else if i = j + 1 then 1 else 0) $$ (j, i) * mat n n (\<lambda>(i, j). if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0) $$ (i, j)) = 1
 2. \<And>i j. \<lbrakk>i < n; j < n; i \<noteq> j\<rbrakk> \<Longrightarrow> (\<Sum>ia = 0..<n. mat n n (\<lambda>(i, j). if i = 0 then if j = n - 1 then 1 else 0 else if i = j + 1 then 1 else 0) $$ (i, ia) * mat n n (\<lambda>(i, j). if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0) $$ (ia, j)) = 0
[PROOF STEP]
apply (simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. j < n \<Longrightarrow> (\<Sum>i = 0..<n. (if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0) * (if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0)) = 1
[PROOF STEP]
apply (case_tac "j = 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>j. \<lbrakk>j < n; j = 0\<rbrakk> \<Longrightarrow> (\<Sum>i = 0..<n. (if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0) * (if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0)) = 1
 2. \<And>j. \<lbrakk>j < n; j \<noteq> 0\<rbrakk> \<Longrightarrow> (\<Sum>i = 0..<n. (if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0) * (if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0)) = 1
[PROOF STEP]
subgoal for j
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j < n; j = 0\<rbrakk> \<Longrightarrow> (\<Sum>i = 0..<n. (if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0) * (if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0)) = 1
[PROOF STEP]
by (simp add: sum_only_one_neq_0[of _ "n - Suc 0"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. \<lbrakk>j < n; j \<noteq> 0\<rbrakk> \<Longrightarrow> (\<Sum>i = 0..<n. (if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0) * (if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0)) = 1
[PROOF STEP]
subgoal for j
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j < n; j \<noteq> 0\<rbrakk> \<Longrightarrow> (\<Sum>i = 0..<n. (if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0) * (if j = 0 then if i = n - 1 then 1 else 0 else if j = i + 1 then 1 else 0)) = 1
[PROOF STEP]
by (simp add: sum_only_one_neq_0[of _ "j - 1"])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma pair_by_index_main: "nat_to_pr (pair_by_index n1 n2) = c_f_pair (nat_to_pr n1) (nat_to_pr n2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_pr (pair_by_index n1 n2) = c_f_pair (nat_to_pr n1) (nat_to_pr n2)
[PROOF STEP]
by (unfold pair_by_index_def, unfold nat_to_pr_def, simp add: loc_srj_4_1)


[STATEMENT]
lemma simple_distributed_joint_finite:
  assumes X: "simple_distributed M (\<lambda>x. (X x, Y x)) Px"
  shows "finite (X ` space M)" "finite (Y ` space M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (X ` space M) &&& finite (Y ` space M)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite (X ` space M)
 2. finite (Y ` space M)
[PROOF STEP]
have "finite ((\<lambda>x. (X x, Y x)) ` space M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ((\<lambda>x. (X x, Y x)) ` space M)
[PROOF STEP]
using X
[PROOF STATE]
proof (prove)
using this:
simple_distributed M (\<lambda>x. (X x, Y x)) Px

goal (1 subgoal):
 1. finite ((\<lambda>x. (X x, Y x)) ` space M)
[PROOF STEP]
by (auto simp: simple_distributed_def simple_functionD)
[PROOF STATE]
proof (state)
this:
finite ((\<lambda>x. (X x, Y x)) ` space M)

goal (2 subgoals):
 1. finite (X ` space M)
 2. finite (Y ` space M)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite ((\<lambda>x. (X x, Y x)) ` space M)
[PROOF STEP]
have "finite (fst ` (\<lambda>x. (X x, Y x)) ` space M)" "finite (snd ` (\<lambda>x. (X x, Y x)) ` space M)"
[PROOF STATE]
proof (prove)
using this:
finite ((\<lambda>x. (X x, Y x)) ` space M)

goal (1 subgoal):
 1. finite (fst ` (\<lambda>x. (X x, Y x)) ` space M) &&& finite (snd ` (\<lambda>x. (X x, Y x)) ` space M)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (fst ` (\<lambda>x. (X x, Y x)) ` space M)
finite (snd ` (\<lambda>x. (X x, Y x)) ` space M)

goal (2 subgoals):
 1. finite (X ` space M)
 2. finite (Y ` space M)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (fst ` (\<lambda>x. (X x, Y x)) ` space M)
finite (snd ` (\<lambda>x. (X x, Y x)) ` space M)
[PROOF STEP]
show fin: "finite (X ` space M)" "finite (Y ` space M)"
[PROOF STATE]
proof (prove)
using this:
finite (fst ` (\<lambda>x. (X x, Y x)) ` space M)
finite (snd ` (\<lambda>x. (X x, Y x)) ` space M)

goal (1 subgoal):
 1. finite (X ` space M) &&& finite (Y ` space M)
[PROOF STEP]
by (auto simp: image_image)
[PROOF STATE]
proof (state)
this:
finite (X ` space M)
finite (Y ` space M)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma delete_ran_inj_on:
  assumes j: "j \<in> {0..<Suc n}" (is "_ \<in> ?N")
  assumes img: "f ` {0..<n} =  ?N - {j}"
  shows "inj_on (delete_ran f j) {0..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (delete_ran f j) {0..<n}
[PROOF STEP]
apply (rule eq_card_imp_inj_on)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite {0..<n}
 2. card (delete_ran f j ` {0..<n}) = card {0..<n}
[PROOF STEP]
unfolding delete_ran_image[OF j img]
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite {0..<n}
 2. card {0..<n} = card {0..<n}
[PROOF STEP]
by simp+


[STATEMENT]
lemma mono_cSup_bij:
  fixes f :: "'a::conditionally_complete_linorder \<Rightarrow> 'b::conditionally_complete_linorder"
  assumes "bdd_above A" "A \<noteq> {}" "mono f" "bij f"
  shows "Sup (f`A) = f(Sup A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (f ` A) = f (Sup A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sup (f ` A) = f (Sup A)
[PROOF STEP]
have "Sup ((inv f)`(f`A)) \<le> (inv f) (Sup (f`A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (inv f ` f ` A) \<le> inv f (Sup (f ` A))
[PROOF STEP]
apply (rule mono_cSup)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. bdd_above (f ` A)
 2. f ` A \<noteq> {}
 3. mono (inv f)
[PROOF STEP]
using mono_inv[OF assms(3) assms(4)] assms(2) bdd_above_image_mono[OF assms(3) assms(1)]
[PROOF STATE]
proof (prove)
using this:
mono (inv f)
A \<noteq> {}
bdd_above (f ` A)

goal (3 subgoals):
 1. bdd_above (f ` A)
 2. f ` A \<noteq> {}
 3. mono (inv f)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Sup (inv f ` f ` A) \<le> inv f (Sup (f ` A))

goal (1 subgoal):
 1. Sup (f ` A) = f (Sup A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Sup (inv f ` f ` A) \<le> inv f (Sup (f ` A))
[PROOF STEP]
have "f (Sup ((inv f)`(f`A))) \<le> Sup (f`A)"
[PROOF STATE]
proof (prove)
using this:
Sup (inv f ` f ` A) \<le> inv f (Sup (f ` A))

goal (1 subgoal):
 1. f (Sup (inv f ` f ` A)) \<le> Sup (f ` A)
[PROOF STEP]
using assms mono_def
[PROOF STATE]
proof (prove)
using this:
Sup (inv f ` f ` A) \<le> inv f (Sup (f ` A))
bdd_above A
A \<noteq> {}
mono f
bij f
mono ?f = (\<forall>x y. x \<le> y \<longrightarrow> ?f x \<le> ?f y)

goal (1 subgoal):
 1. f (Sup (inv f ` f ` A)) \<le> Sup (f ` A)
[PROOF STEP]
by (metis (no_types, opaque_lifting) bij_betw_imp_surj_on surj_f_inv_f)
[PROOF STATE]
proof (state)
this:
f (Sup (inv f ` f ` A)) \<le> Sup (f ` A)

goal (1 subgoal):
 1. Sup (f ` A) = f (Sup A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f (Sup (inv f ` f ` A)) \<le> Sup (f ` A)

goal (1 subgoal):
 1. Sup (f ` A) = f (Sup A)
[PROOF STEP]
have "f (Sup ((inv f)`(f`A))) = f(Sup A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (Sup (inv f ` f ` A)) = f (Sup A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bdd_above A
A \<noteq> {}
mono f
bij f

goal (1 subgoal):
 1. f (Sup (inv f ` f ` A)) = f (Sup A)
[PROOF STEP]
by (simp add: bij_is_inj)
[PROOF STATE]
proof (state)
this:
f (Sup (inv f ` f ` A)) = f (Sup A)

goal (1 subgoal):
 1. Sup (f ` A) = f (Sup A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
f (Sup (inv f ` f ` A)) \<le> Sup (f ` A)
f (Sup (inv f ` f ` A)) = f (Sup A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f (Sup (inv f ` f ` A)) \<le> Sup (f ` A)
f (Sup (inv f ` f ` A)) = f (Sup A)

goal (1 subgoal):
 1. Sup (f ` A) = f (Sup A)
[PROOF STEP]
using mono_cSup[OF assms(1) assms(2) assms(3)]
[PROOF STATE]
proof (prove)
using this:
f (Sup (inv f ` f ` A)) \<le> Sup (f ` A)
f (Sup (inv f ` f ` A)) = f (Sup A)
Sup (f ` A) \<le> f (Sup A)

goal (1 subgoal):
 1. Sup (f ` A) = f (Sup A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Sup (f ` A) = f (Sup A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma at_infinity_eq_at_top_bot: "(at_infinity :: real filter) = sup at_top at_bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. at_infinity = sup at_top at_bot
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. at_infinity = sup at_top at_bot
[PROOF STEP]
have 1: "\<lbrakk>\<forall>n\<ge>u. A n; \<forall>n\<le>v. A n\<rbrakk>
       \<Longrightarrow> \<exists>b. \<forall>x. b \<le> \<bar>x\<bar> \<longrightarrow> A x" for A and u v::real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>n\<ge>u. A n; \<forall>n\<le>v. A n\<rbrakk> \<Longrightarrow> \<exists>b. \<forall>x. b \<le> \<bar>x\<bar> \<longrightarrow> A x
[PROOF STEP]
by (rule_tac x="max (- v) u" in exI) (auto simp: abs_real_def)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<forall>n\<ge>?u. ?A n; \<forall>n\<le>?v. ?A n\<rbrakk> \<Longrightarrow> \<exists>b. \<forall>x. b \<le> \<bar>x\<bar> \<longrightarrow> ?A x

goal (1 subgoal):
 1. at_infinity = sup at_top at_bot
[PROOF STEP]
have 2: "\<forall>x. u \<le> \<bar>x\<bar> \<longrightarrow> A x \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. A n" for A and u::real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. u \<le> \<bar>x\<bar> \<longrightarrow> A x \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. A n
[PROOF STEP]
by (meson abs_less_iff le_cases less_le_not_le)
[PROOF STATE]
proof (state)
this:
\<forall>x. ?u \<le> \<bar>x\<bar> \<longrightarrow> ?A x \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. ?A n

goal (1 subgoal):
 1. at_infinity = sup at_top at_bot
[PROOF STEP]
have 3: "\<forall>x. u \<le> \<bar>x\<bar> \<longrightarrow> A x \<Longrightarrow> \<exists>N. \<forall>n\<le>N. A n" for A and u::real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. u \<le> \<bar>x\<bar> \<longrightarrow> A x \<Longrightarrow> \<exists>N. \<forall>n\<le>N. A n
[PROOF STEP]
by (metis (full_types) abs_ge_self abs_minus_cancel le_minus_iff order_trans)
[PROOF STATE]
proof (state)
this:
\<forall>x. ?u \<le> \<bar>x\<bar> \<longrightarrow> ?A x \<Longrightarrow> \<exists>N. \<forall>n\<le>N. ?A n

goal (1 subgoal):
 1. at_infinity = sup at_top at_bot
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. at_infinity = sup at_top at_bot
[PROOF STEP]
by (auto simp: filter_eq_iff eventually_sup eventually_at_infinity
      eventually_at_top_linorder eventually_at_bot_linorder intro: 1 2 3)
[PROOF STATE]
proof (state)
this:
at_infinity = sup at_top at_bot

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Sigma_mset_Int_distrib2: "(SIGMAMSET i\<in>#I. A i \<inter># B i) = Sigma_mset I A \<inter># Sigma_mset I B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SIGMAMSET i\<in>#I. A i \<inter># B i) = Sigma_mset I A \<inter># Sigma_mset I B
[PROOF STEP]
by (auto simp: multiset_eq_iff count_sum_mset count_image_mset_Pair sum_mset_if_eq_constant
    Sigma_mset_def iterate_op_plus min_def not_in_iff)


[STATEMENT]
lemma polytope_Times: "\<lbrakk>polytope S; polytope T\<rbrakk> \<Longrightarrow> polytope(S \<times> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>polytope S; polytope T\<rbrakk> \<Longrightarrow> polytope (S \<times> T)
[PROOF STEP]
unfolding polytope_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>v. finite v \<and> S = convex hull v; \<exists>v. finite v \<and> T = convex hull v\<rbrakk> \<Longrightarrow> \<exists>v. finite v \<and> S \<times> T = convex hull v
[PROOF STEP]
by (metis finite_cartesian_product convex_hull_Times)


[STATEMENT]
lemma power_Suc_le_self: "0 \<le> a \<Longrightarrow> a \<le> 1 \<Longrightarrow> a ^ Suc n \<le> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(0::'a) \<le> a; a \<le> (1::'a)\<rbrakk> \<Longrightarrow> a ^ Suc n \<le> a
[PROOF STEP]
using power_decreasing [of 1 "Suc n" a]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 \<le> Suc n; (0::'a) \<le> a; a \<le> (1::'a)\<rbrakk> \<Longrightarrow> a ^ Suc n \<le> a ^ 1

goal (1 subgoal):
 1. \<lbrakk>(0::'a) \<le> a; a \<le> (1::'a)\<rbrakk> \<Longrightarrow> a ^ Suc n \<le> a
[PROOF STEP]
by simp


[STATEMENT]
lemma eucl_eq_iff: "x = y \<longleftrightarrow> (\<forall>i<DIM('a). nth_eucl x i = nth_eucl y i)"
  for x y::"'a::executable_euclidean_space"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x = y) = (\<forall>i<DIM('a). nth_eucl x i = nth_eucl y i)
[PROOF STEP]
apply (auto simp: nth_eucl_def euclidean_eq_iff[where 'a='a])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. \<lbrakk>\<forall>i<DIM('a). x \<bullet> Basis_list ! i = y \<bullet> Basis_list ! i; b \<in> Basis\<rbrakk> \<Longrightarrow> x \<bullet> b = y \<bullet> b
[PROOF STEP]
by (metis eucl_of_list_list_of_eucl list_of_eucl_eq_iff)


[STATEMENT]
theorem height_double_log_univ_size:
  assumes "u = 2^deg" and "invar_vebt t deg "
  shows "height t \<le> 1 + lb (lb u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (height t) \<le> 1 + log 2 (log 2 u)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (height t) \<le> 1 + log 2 (log 2 u)
[PROOF STEP]
have "(height t) = \<lceil>lb deg\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (height t) = \<lceil>log 2 (real deg)\<rceil>
[PROOF STEP]
by (simp add: assms(2) heigt_uplog_rel)
[PROOF STATE]
proof (state)
this:
int (height t) = \<lceil>log 2 (real deg)\<rceil>

goal (1 subgoal):
 1. real (height t) \<le> 1 + log 2 (log 2 u)
[PROOF STEP]
have "2^(height t) \<le> 2 *  deg"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ height t \<le> 2 * deg
[PROOF STEP]
using assms(2)  two_powr_height_bound_deg[of t deg]
[PROOF STATE]
proof (prove)
using this:
invar_vebt t deg
invar_vebt t deg \<Longrightarrow> 2 ^ height t \<le> 2 * deg

goal (1 subgoal):
 1. 2 ^ height t \<le> 2 * deg
[PROOF STEP]
by (meson dual_order.eq_iff dual_order.trans self_le_ge2_pow)
[PROOF STATE]
proof (state)
this:
2 ^ height t \<le> 2 * deg

goal (1 subgoal):
 1. real (height t) \<le> 1 + log 2 (log 2 u)
[PROOF STEP]
hence "height t \<le> 1 + lb deg"
[PROOF STATE]
proof (prove)
using this:
2 ^ height t \<le> 2 * deg

goal (1 subgoal):
 1. real (height t) \<le> 1 + log 2 (real deg)
[PROOF STEP]
using \<open>int (height t) = \<lceil>lb (real deg)\<rceil>\<close>
[PROOF STATE]
proof (prove)
using this:
2 ^ height t \<le> 2 * deg
int (height t) = \<lceil>log 2 (real deg)\<rceil>

goal (1 subgoal):
 1. real (height t) \<le> 1 + log 2 (real deg)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
real (height t) \<le> 1 + log 2 (real deg)

goal (1 subgoal):
 1. real (height t) \<le> 1 + log 2 (log 2 u)
[PROOF STEP]
hence "height t \<le> 1 + lb (lb u)"
[PROOF STATE]
proof (prove)
using this:
real (height t) \<le> 1 + log 2 (real deg)

goal (1 subgoal):
 1. real (height t) \<le> 1 + log 2 (log 2 u)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
real (height t) \<le> 1 + log 2 (real deg)
u = 2 ^ deg
invar_vebt t deg

goal (1 subgoal):
 1. real (height t) \<le> 1 + log 2 (log 2 u)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (height t) \<le> 1 + log 2 (log 2 u)

goal (1 subgoal):
 1. real (height t) \<le> 1 + log 2 (log 2 u)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
real (height t) \<le> 1 + log 2 (log 2 u)

goal (1 subgoal):
 1. real (height t) \<le> 1 + log 2 (log 2 u)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (height t) \<le> 1 + log 2 (log 2 u)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma abs_power_less [simp]: "\<bar>a\<bar>^n < \<bar>b\<bar>^n \<longleftrightarrow> n > 0 \<and> \<bar>a\<bar> < \<bar>b\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<bar>a\<bar> ^ n < \<bar>b\<bar> ^ n) = (0 < n \<and> \<bar>a\<bar> < \<bar>b\<bar>)
[PROOF STEP]
by (subst nonneg_power_less, auto)


[STATEMENT]
theorem mult_cancellation_lemma:
  assumes "a*x + r = a*y + s" "r \<sqsubset> a" "s \<sqsubset> a"
  shows "x=y \<and> r=s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y \<and> r = s
[PROOF STEP]
by (metis assms leD less_V_def mult_cancellation_half odiff_add_cancel order_refl)


[STATEMENT]
lemma powr_divide: "\<lbrakk>0 \<le> x; 0 \<le> y\<rbrakk> \<Longrightarrow> (x / y) powr a = (x powr a) / (y powr a)"
  for a b x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; 0 \<le> y\<rbrakk> \<Longrightarrow> (x / y) powr a = x powr a / y powr a
[PROOF STEP]
by (simp add: divide_inverse powr_mult inverse_powr)


[STATEMENT]
lemma invertible_matrices_rank':
  fixes A::"'a::{field}^'n::{mod_type}^'m::{mod_type}"
  and P::"'a^'m::{mod_type}^'m::{mod_type}" and Q::"'a^'n::{mod_type}^'n::{mod_type}"
  assumes invertible_P: "invertible P" and invertible_Q: "invertible Q" and B_eq_PA: "B = P**A**Q"
  shows "rank B = rank A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank B = rank A
[PROOF STEP]
by (metis B_eq_PA invertible_P invertible_Q invertible_matrices_mult_rank)


[STATEMENT]
lemma dim_component_mult:
"dim_vec (component_mult v w) = min (dim_vec v) (dim_vec w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (component_mult v w) = min (dim_vec v) (dim_vec w)
[PROOF STEP]
unfolding component_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (vec (min (dim_vec v) (dim_vec w)) (\<lambda>i. v $ i * w $ i)) = min (dim_vec v) (dim_vec w)
[PROOF STEP]
using index_vec
[PROOF STATE]
proof (prove)
using this:
?i < ?n \<Longrightarrow> vec ?n ?f $ ?i = ?f ?i

goal (1 subgoal):
 1. dim_vec (vec (min (dim_vec v) (dim_vec w)) (\<lambda>i. v $ i * w $ i)) = min (dim_vec v) (dim_vec w)
[PROOF STEP]
by auto


[STATEMENT]
lemma totient_code2: "totient n = (if n = 0 then 0 else totient_aux2 (prime_factorization_nat' n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. totient n = (if n = 0 then 0 else totient_aux2 (prime_factorization_nat' n))
[PROOF STEP]
by (simp_all add: set_prime_factorization_nat' totient_conv_totient_aux2 split: if_splits)


[STATEMENT]
theorem abs_fract [simp]: "\<bar>Fract a b\<bar> = Fract \<bar>a\<bar> \<bar>b\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>Fract a b\<bar> = Fract \<bar>a\<bar> \<bar>b\<bar>
[PROOF STEP]
unfolding abs_fract_def2 not_le [symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if \<not> 0 \<le> Fract a b then - Fract a b else Fract a b) = Fract \<bar>a\<bar> \<bar>b\<bar>
[PROOF STEP]
by transfer (auto simp add: zero_less_mult_iff le_less)


[STATEMENT]
lemma ipoly_poly_uminus_abs_zero[simp]: "ipoly (poly_uminus_abs p) (x :: 'a :: idom) = 0 \<longleftrightarrow> ipoly p (-x) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ipoly (poly_uminus_abs p) x = (0::'a)) = (ipoly p (- x) = (0::'a))
[PROOF STEP]
unfolding poly_uminus_abs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ipoly (abs_int_poly (poly_uminus p)) x = (0::'a)) = (ipoly p (- x) = (0::'a))
[PROOF STEP]
by simp


[STATEMENT]
lemma delete_node_correct:
    assumes "wf_list_graph G"
    shows "FiniteGraph.delete_node v (list_graph_to_graph G) = list_graph_to_graph (delete_node v G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FiniteGraph.delete_node v (list_graph_to_graph G) = list_graph_to_graph (FiniteListGraph.delete_node v G)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wf_list_graph G

goal (1 subgoal):
 1. FiniteGraph.delete_node v (list_graph_to_graph G) = list_graph_to_graph (FiniteListGraph.delete_node v G)
[PROOF STEP]
unfolding FiniteGraph.delete_node_def delete_node_def list_graph_to_graph_def wf_list_graph_def
[PROOF STATE]
proof (prove)
using this:
distinct (nodesL G) \<and> distinct (edgesL G) \<and> wf_list_graph_axioms G

goal (1 subgoal):
 1. \<lparr>nodes = nodes \<lparr>nodes = set (nodesL G), edges = set (edgesL G)\<rparr> - {v}, edges = {(e1, e2). (e1, e2) \<in> edges \<lparr>nodes = set (nodesL G), edges = set (edgesL G)\<rparr> \<and> e1 \<noteq> v \<and> e2 \<noteq> v}\<rparr> = \<lparr>nodes = set (nodesL \<lparr>nodesL = remove1 v (nodesL G), edgesL = filter (\<lambda>(e1, e2). e1 \<noteq> v \<and> e2 \<noteq> v) (edgesL G)\<rparr>), edges = set (edgesL \<lparr>nodesL = remove1 v (nodesL G), edgesL = filter (\<lambda>(e1, e2). e1 \<noteq> v \<and> e2 \<noteq> v) (edgesL G)\<rparr>)\<rparr>
[PROOF STEP]
by auto

  \<comment> \<open>delete edge\<close>


[STATEMENT]
lemma emeasure_pos_unionE:
  assumes "\<And> (N::nat). A N \<in> sets M"
          "emeasure M (\<Union>N. A N) > 0"
  shows "\<exists>N. emeasure M (A N) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>N. 0 < emeasure M (A N)
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<nexists>N. 0 < emeasure M (A N) \<Longrightarrow> False
[PROOF STEP]
assume "\<not>(\<exists>N. emeasure M (A N) > 0)"
[PROOF STATE]
proof (state)
this:
\<nexists>N. 0 < emeasure M (A N)

goal (1 subgoal):
 1. \<nexists>N. 0 < emeasure M (A N) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<nexists>N. 0 < emeasure M (A N)
[PROOF STEP]
have "\<And>N. A N \<in> null_sets M"
[PROOF STATE]
proof (prove)
using this:
\<nexists>N. 0 < emeasure M (A N)

goal (1 subgoal):
 1. \<And>N. A N \<in> null_sets M
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
\<nexists>N. 0 < emeasure M (A N)
A ?N \<in> sets M

goal (1 subgoal):
 1. \<And>N. A N \<in> null_sets M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A ?N \<in> null_sets M

goal (1 subgoal):
 1. \<nexists>N. 0 < emeasure M (A N) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A ?N \<in> null_sets M
[PROOF STEP]
have "(\<Union>N. A N) \<in> null_sets M"
[PROOF STATE]
proof (prove)
using this:
A ?N \<in> null_sets M

goal (1 subgoal):
 1. \<Union> (range A) \<in> null_sets M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Union> (range A) \<in> null_sets M

goal (1 subgoal):
 1. \<nexists>N. 0 < emeasure M (A N) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<Union> (range A) \<in> null_sets M
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<Union> (range A) \<in> null_sets M

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
\<Union> (range A) \<in> null_sets M
0 < emeasure M (\<Union> (range A))

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma odd_imp_coprime_nat:
  assumes "odd (n::nat)"
  shows   "coprime n 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime n 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coprime n 2
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
odd n
[PROOF STEP]
obtain k where n: "n = Suc (2 * k)"
[PROOF STATE]
proof (prove)
using this:
odd n

goal (1 subgoal):
 1. (\<And>k. n = Suc (2 * k) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto elim!: oddE)
[PROOF STATE]
proof (state)
this:
n = Suc (2 * k)

goal (1 subgoal):
 1. coprime n 2
[PROOF STEP]
have "coprime (Suc (2 * k)) (2 * k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime (Suc (2 * k)) (2 * k)
[PROOF STEP]
by (fact coprime_Suc_left_nat)
[PROOF STATE]
proof (state)
this:
coprime (Suc (2 * k)) (2 * k)

goal (1 subgoal):
 1. coprime n 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
coprime (Suc (2 * k)) (2 * k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
coprime (Suc (2 * k)) (2 * k)

goal (1 subgoal):
 1. coprime n 2
[PROOF STEP]
using n
[PROOF STATE]
proof (prove)
using this:
coprime (Suc (2 * k)) (2 * k)
n = Suc (2 * k)

goal (1 subgoal):
 1. coprime n 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
coprime n 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma  det_nz_iff_inj_gen:
  fixes f :: "'a::field^'n \<Rightarrow> 'a::field^'n"
  assumes "Vector_Spaces.linear (*s) (*s) f"
  shows "det (matrix f) \<noteq> 0 \<longleftrightarrow> inj f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (det (matrix f) \<noteq> (0::'a)) = inj f
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. det (matrix f) \<noteq> (0::'a) \<Longrightarrow> inj f
 2. inj f \<Longrightarrow> det (matrix f) \<noteq> (0::'a)
[PROOF STEP]
assume "det (matrix f) \<noteq> 0"
[PROOF STATE]
proof (state)
this:
det (matrix f) \<noteq> (0::'a)

goal (2 subgoals):
 1. det (matrix f) \<noteq> (0::'a) \<Longrightarrow> inj f
 2. inj f \<Longrightarrow> det (matrix f) \<noteq> (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
det (matrix f) \<noteq> (0::'a)
[PROOF STEP]
show "inj f"
[PROOF STATE]
proof (prove)
using this:
det (matrix f) \<noteq> (0::'a)

goal (1 subgoal):
 1. inj f
[PROOF STEP]
using assms invertible_det_nz inj_matrix_vector_mult
[PROOF STATE]
proof (prove)
using this:
det (matrix f) \<noteq> (0::'a)
Vector_Spaces.linear (*s) (*s) f
invertible ?A = (det ?A \<noteq> (0::?'a))
invertible ?A \<Longrightarrow> inj ((*v) ?A)

goal (1 subgoal):
 1. inj f
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
inj f

goal (1 subgoal):
 1. inj f \<Longrightarrow> det (matrix f) \<noteq> (0::'a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inj f \<Longrightarrow> det (matrix f) \<noteq> (0::'a)
[PROOF STEP]
assume "inj f"
[PROOF STATE]
proof (state)
this:
inj f

goal (1 subgoal):
 1. inj f \<Longrightarrow> det (matrix f) \<noteq> (0::'a)
[PROOF STEP]
show "det (matrix f) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (matrix f) \<noteq> (0::'a)
[PROOF STEP]
using vec.linear_injective_left_inverse [OF assms \<open>inj f\<close>]
[PROOF STATE]
proof (prove)
using this:
\<exists>g. Vector_Spaces.linear (*s) (*s) g \<and> g \<circ> f = id

goal (1 subgoal):
 1. det (matrix f) \<noteq> (0::'a)
[PROOF STEP]
by (metis assms invertible_det_nz invertible_left_inverse matrix_compose_gen matrix_id_mat_1)
[PROOF STATE]
proof (state)
this:
det (matrix f) \<noteq> (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma scalar_prod_right_zero[simp]: "v \<in> carrier_vec n \<Longrightarrow> v \<bullet> 0\<^sub>v n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> carrier_vec n \<Longrightarrow> v \<bullet> 0\<^sub>v n = (0::'a)
[PROOF STEP]
unfolding scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> carrier_vec n \<Longrightarrow> (\<Sum>i = 0..<dim_vec (0\<^sub>v n). v $ i * 0\<^sub>v n $ i) = (0::'a)
[PROOF STEP]
by (rule sum.neutral, auto)


[STATEMENT]
lemma tensor_op_right_add: \<open>b \<otimes>\<^sub>o (x + y) = b \<otimes>\<^sub>o x + b \<otimes>\<^sub>o y\<close>
  for x y :: \<open>'a::finite ell2 \<Rightarrow>\<^sub>C\<^sub>L 'c::finite ell2\<close> and b :: \<open>'b::finite ell2 \<Rightarrow>\<^sub>C\<^sub>L 'd::finite ell2\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<otimes>\<^sub>o (x + y) = b \<otimes>\<^sub>o x + b \<otimes>\<^sub>o y
[PROOF STEP]
apply (auto intro!: equal_ket simp: tensor_op_ket)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a ba. (b *\<^sub>V ket a) \<otimes>\<^sub>s (x + y) *\<^sub>V ket ba = (b \<otimes>\<^sub>o x + b \<otimes>\<^sub>o y) *\<^sub>V ket (a, ba)
[PROOF STEP]
by (simp add: plus_cblinfun.rep_eq tensor_ell2_add2 tensor_op_ket)


[STATEMENT]
lemma of_nat_n_less_equal_power_2:
  "n < LENGTH('a::len) \<Longrightarrow> ((of_nat n)::'a word) < 2 ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < LENGTH('a) \<Longrightarrow> word_of_nat n < 2 ^ n
[PROOF STEP]
apply (induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 < LENGTH('a) \<Longrightarrow> word_of_nat 0 < 2 ^ 0
 2. \<And>n. \<lbrakk>n < LENGTH('a) \<Longrightarrow> word_of_nat n < 2 ^ n; Suc n < LENGTH('a)\<rbrakk> \<Longrightarrow> word_of_nat (Suc n) < 2 ^ Suc n
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>n < LENGTH('a) \<Longrightarrow> word_of_nat n < 2 ^ n; Suc n < LENGTH('a)\<rbrakk> \<Longrightarrow> word_of_nat (Suc n) < 2 ^ Suc n
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>word_of_nat n < 2 ^ n; Suc n < LENGTH('a)\<rbrakk> \<Longrightarrow> 1 + word_of_nat n < 2 * 2 ^ n
[PROOF STEP]
apply (metis of_nat_power n_less_equal_power_2 of_nat_Suc power_Suc)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma arctan: "- (pi/2) < arctan y \<and> arctan y < pi/2 \<and> tan (arctan y) = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (pi / 2) < arctan y \<and> arctan y < pi / 2 \<and> tan (arctan y) = y
[PROOF STEP]
unfolding arctan_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (pi / 2) < (THE x. - (pi / 2) < x \<and> x < pi / 2 \<and> tan x = y) \<and> (THE x. - (pi / 2) < x \<and> x < pi / 2 \<and> tan x = y) < pi / 2 \<and> tan (THE x. - (pi / 2) < x \<and> x < pi / 2 \<and> tan x = y) = y
[PROOF STEP]
by (rule theI' [OF tan_total])


[STATEMENT]
lemma card_bijections_domain_permutation_eq_0:
  assumes "card A \<noteq> card B"
  shows "card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_permutation A B) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_permutation A B) = 0
[PROOF STEP]
using bij_betw_quotient_domain_permutation_eq_empty[OF assms]
[PROOF STATE]
proof (prove)
using this:
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_permutation A B = {}

goal (1 subgoal):
 1. card ({f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_permutation A B) = 0
[PROOF STEP]
by (simp only: card.empty)


[STATEMENT]
lemma conjugate_preserve_poincare_collinear [simp]:
  assumes "poincare_collinear A"
  shows "poincare_collinear (conjugate ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poincare_collinear (conjugate ` A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
poincare_collinear A

goal (1 subgoal):
 1. poincare_collinear (conjugate ` A)
[PROOF STEP]
unfolding poincare_collinear_def
[PROOF STATE]
proof (prove)
using this:
\<exists>p. is_poincare_line p \<and> A \<subseteq> circline_set p

goal (1 subgoal):
 1. \<exists>p. is_poincare_line p \<and> conjugate ` A \<subseteq> circline_set p
[PROOF STEP]
by auto (rule_tac x="conjugate_circline p" in exI, auto)


[STATEMENT]
lemma cis_zero [simp]: "cis 0 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cis 0 = 1
[PROOF STEP]
by (simp add: complex_eq_iff)


[STATEMENT]
lemma filter_filter_mset_ss_member: "filter_mset (\<lambda> a . {x, y} \<subseteq> a) A =
  filter_mset (\<lambda> a . {x, y} \<subseteq> a) (filter_mset (\<lambda> a . x \<in> a) A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter_mset ((\<subseteq>) {x, y}) A = filter_mset ((\<subseteq>) {x, y}) (filter_mset ((\<in>) x) A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. filter_mset ((\<subseteq>) {x, y}) A = filter_mset ((\<subseteq>) {x, y}) (filter_mset ((\<in>) x) A)
[PROOF STEP]
have filter: "filter_mset (\<lambda> a . {x, y} \<subseteq> a) (filter_mset (\<lambda> a . x \<in> a) A) =
    filter_mset (\<lambda> a . x \<in> a \<and> {x, y} \<subseteq> a) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter_mset ((\<subseteq>) {x, y}) (filter_mset ((\<in>) x) A) = {#a \<in># A. x \<in> a \<and> {x, y} \<subseteq> a#}
[PROOF STEP]
by (simp add: filter_filter_mset)
[PROOF STATE]
proof (state)
this:
filter_mset ((\<subseteq>) {x, y}) (filter_mset ((\<in>) x) A) = {#a \<in># A. x \<in> a \<and> {x, y} \<subseteq> a#}

goal (1 subgoal):
 1. filter_mset ((\<subseteq>) {x, y}) A = filter_mset ((\<subseteq>) {x, y}) (filter_mset ((\<in>) x) A)
[PROOF STEP]
have "\<And> a. {x, y} \<subseteq> a \<Longrightarrow> x \<in> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. {x, y} \<subseteq> a \<Longrightarrow> x \<in> a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
{x, y} \<subseteq> ?a \<Longrightarrow> x \<in> ?a

goal (1 subgoal):
 1. filter_mset ((\<subseteq>) {x, y}) A = filter_mset ((\<subseteq>) {x, y}) (filter_mset ((\<in>) x) A)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
{x, y} \<subseteq> ?a \<Longrightarrow> x \<in> ?a

goal (1 subgoal):
 1. filter_mset ((\<subseteq>) {x, y}) A = filter_mset ((\<subseteq>) {x, y}) (filter_mset ((\<in>) x) A)
[PROOF STEP]
using filter
[PROOF STATE]
proof (prove)
using this:
{x, y} \<subseteq> ?a \<Longrightarrow> x \<in> ?a
filter_mset ((\<subseteq>) {x, y}) (filter_mset ((\<in>) x) A) = {#a \<in># A. x \<in> a \<and> {x, y} \<subseteq> a#}

goal (1 subgoal):
 1. filter_mset ((\<subseteq>) {x, y}) A = filter_mset ((\<subseteq>) {x, y}) (filter_mset ((\<in>) x) A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
filter_mset ((\<subseteq>) {x, y}) A = filter_mset ((\<subseteq>) {x, y}) (filter_mset ((\<in>) x) A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma filterlim_pow_at_top:
  fixes f :: "'a \<Rightarrow> real"
  assumes "0 < n"
    and f: "LIM x F. f x :> at_top"
  shows "LIM x F. (f x)^n :: real :> at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x F. f x ^ n :> at_top
[PROOF STEP]
using \<open>0 < n\<close>
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. LIM x F. f x ^ n :> at_top
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < 0 \<Longrightarrow> LIM x F. f x ^ 0 :> at_top
 2. \<And>n. \<lbrakk>0 < n \<Longrightarrow> LIM x F. f x ^ n :> at_top; 0 < Suc n\<rbrakk> \<Longrightarrow> LIM x F. f x ^ Suc n :> at_top
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 < 0

goal (2 subgoals):
 1. 0 < 0 \<Longrightarrow> LIM x F. f x ^ 0 :> at_top
 2. \<And>n. \<lbrakk>0 < n \<Longrightarrow> LIM x F. f x ^ n :> at_top; 0 < Suc n\<rbrakk> \<Longrightarrow> LIM x F. f x ^ Suc n :> at_top
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 < 0

goal (1 subgoal):
 1. LIM x F. f x ^ 0 :> at_top
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
LIM x F. f x ^ 0 :> at_top

goal (1 subgoal):
 1. \<And>n. \<lbrakk>0 < n \<Longrightarrow> LIM x F. f x ^ n :> at_top; 0 < Suc n\<rbrakk> \<Longrightarrow> LIM x F. f x ^ Suc n :> at_top
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>0 < n \<Longrightarrow> LIM x F. f x ^ n :> at_top; 0 < Suc n\<rbrakk> \<Longrightarrow> LIM x F. f x ^ Suc n :> at_top
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
0 < n \<Longrightarrow> LIM x F. f x ^ n :> at_top
0 < Suc n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>0 < n \<Longrightarrow> LIM x F. f x ^ n :> at_top; 0 < Suc n\<rbrakk> \<Longrightarrow> LIM x F. f x ^ Suc n :> at_top
[PROOF STEP]
with f
[PROOF STATE]
proof (chain)
picking this:
filterlim f at_top F
0 < n \<Longrightarrow> LIM x F. f x ^ n :> at_top
0 < Suc n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
filterlim f at_top F
0 < n \<Longrightarrow> LIM x F. f x ^ n :> at_top
0 < Suc n

goal (1 subgoal):
 1. LIM x F. f x ^ Suc n :> at_top
[PROOF STEP]
by (cases "n = 0") (auto intro!: filterlim_at_top_mult_at_top)
[PROOF STATE]
proof (state)
this:
LIM x F. f x ^ Suc n :> at_top

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma monotone_rel_prod_iff:
  "monotone (rel_prod orda ordb) ordc f \<longleftrightarrow>
   (\<forall>a. monotone ordb ordc (\<lambda>b. f (a, b))) \<and>
   (\<forall>b. monotone orda ordc (\<lambda>a. f (a, b)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monotone (rel_prod orda ordb) ordc f = ((\<forall>a. monotone ordb ordc (\<lambda>b. f (a, b))) \<and> (\<forall>b. monotone orda ordc (\<lambda>a. f (a, b))))
[PROOF STEP]
using a b c
[PROOF STATE]
proof (prove)
using this:
class.preorder orda (mk_less orda)
class.preorder ordb (mk_less ordb)
class.preorder ordc (mk_less ordc)

goal (1 subgoal):
 1. monotone (rel_prod orda ordb) ordc f = ((\<forall>a. monotone ordb ordc (\<lambda>b. f (a, b))) \<and> (\<forall>b. monotone orda ordc (\<lambda>a. f (a, b))))
[PROOF STEP]
by(blast intro: monotone_rel_prodI dest: monotone_rel_prodD1 monotone_rel_prodD2)


[STATEMENT]
lemma complex_mat_decomposition_to_hermitian:
  fixes A :: "complex mat"
  assumes dim: "A \<in> carrier_mat n n"
  shows "\<exists>B C. hermitian B \<and> hermitian C \<and> A = B + \<i> \<cdot>\<^sub>m C \<and> B \<in> carrier_mat n n \<and> C \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B C. hermitian B \<and> hermitian C \<and> A = B + \<i> \<cdot>\<^sub>m C \<and> B \<in> carrier_mat n n \<and> C \<in> carrier_mat n n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>B C. hermitian B \<and> hermitian C \<and> A = B + \<i> \<cdot>\<^sub>m C \<and> B \<in> carrier_mat n n \<and> C \<in> carrier_mat n n
[PROOF STEP]
obtain B C where B: "B = (1 / 2) \<cdot>\<^sub>m (A + adjoint A)"
    and C: "C = (-\<i> / 2) \<cdot>\<^sub>m (A - adjoint A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B C. \<lbrakk>B = 1 / 2 \<cdot>\<^sub>m (A + adjoint A); C = - \<i> / 2 \<cdot>\<^sub>m (A - adjoint A)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B = 1 / 2 \<cdot>\<^sub>m (A + adjoint A)
C = - \<i> / 2 \<cdot>\<^sub>m (A - adjoint A)

goal (1 subgoal):
 1. \<exists>B C. hermitian B \<and> hermitian C \<and> A = B + \<i> \<cdot>\<^sub>m C \<and> B \<in> carrier_mat n n \<and> C \<in> carrier_mat n n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
B = 1 / 2 \<cdot>\<^sub>m (A + adjoint A)
C = - \<i> / 2 \<cdot>\<^sub>m (A - adjoint A)
[PROOF STEP]
have dimB: "B \<in> carrier_mat n n" and dimC: "C \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
using this:
B = 1 / 2 \<cdot>\<^sub>m (A + adjoint A)
C = - \<i> / 2 \<cdot>\<^sub>m (A - adjoint A)

goal (1 subgoal):
 1. B \<in> carrier_mat n n &&& C \<in> carrier_mat n n
[PROOF STEP]
using dim
[PROOF STATE]
proof (prove)
using this:
B = 1 / 2 \<cdot>\<^sub>m (A + adjoint A)
C = - \<i> / 2 \<cdot>\<^sub>m (A - adjoint A)
A \<in> carrier_mat n n

goal (1 subgoal):
 1. B \<in> carrier_mat n n &&& C \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B \<in> carrier_mat n n
C \<in> carrier_mat n n

goal (1 subgoal):
 1. \<exists>B C. hermitian B \<and> hermitian C \<and> A = B + \<i> \<cdot>\<^sub>m C \<and> B \<in> carrier_mat n n \<and> C \<in> carrier_mat n n
[PROOF STEP]
have "hermitian B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hermitian B
[PROOF STEP]
unfolding B hermitian_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint (1 / 2 \<cdot>\<^sub>m (A + adjoint A)) = 1 / 2 \<cdot>\<^sub>m (A + adjoint A)
[PROOF STEP]
using dim
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n

goal (1 subgoal):
 1. adjoint (1 / 2 \<cdot>\<^sub>m (A + adjoint A)) = 1 / 2 \<cdot>\<^sub>m (A + adjoint A)
[PROOF STEP]
by (auto simp add: adjoint_eval)
[PROOF STATE]
proof (state)
this:
hermitian B

goal (1 subgoal):
 1. \<exists>B C. hermitian B \<and> hermitian C \<and> A = B + \<i> \<cdot>\<^sub>m C \<and> B \<in> carrier_mat n n \<and> C \<in> carrier_mat n n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
hermitian B

goal (1 subgoal):
 1. \<exists>B C. hermitian B \<and> hermitian C \<and> A = B + \<i> \<cdot>\<^sub>m C \<and> B \<in> carrier_mat n n \<and> C \<in> carrier_mat n n
[PROOF STEP]
have "hermitian C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hermitian C
[PROOF STEP]
unfolding C hermitian_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint (- \<i> / 2 \<cdot>\<^sub>m (A - adjoint A)) = - \<i> / 2 \<cdot>\<^sub>m (A - adjoint A)
[PROOF STEP]
using dim
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n

goal (1 subgoal):
 1. adjoint (- \<i> / 2 \<cdot>\<^sub>m (A - adjoint A)) = - \<i> / 2 \<cdot>\<^sub>m (A - adjoint A)
[PROOF STEP]
apply (subst eq_matI)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>i j. \<lbrakk>A \<in> carrier_mat n n; i < dim_row ?y1; j < dim_col ?y1\<rbrakk> \<Longrightarrow> adjoint (- \<i> / 2 \<cdot>\<^sub>m (A - adjoint A)) $$ (i, j) = ?y1 $$ (i, j)
 2. A \<in> carrier_mat n n \<Longrightarrow> dim_row (adjoint (- \<i> / 2 \<cdot>\<^sub>m (A - adjoint A))) = dim_row ?y1
 3. A \<in> carrier_mat n n \<Longrightarrow> dim_col (adjoint (- \<i> / 2 \<cdot>\<^sub>m (A - adjoint A))) = dim_col ?y1
 4. A \<in> carrier_mat n n \<Longrightarrow> ?y1 = - \<i> / 2 \<cdot>\<^sub>m (A - adjoint A)
[PROOF STEP]
apply (auto simp add: adjoint_eval algebra_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
hermitian C

goal (1 subgoal):
 1. \<exists>B C. hermitian B \<and> hermitian C \<and> A = B + \<i> \<cdot>\<^sub>m C \<and> B \<in> carrier_mat n n \<and> C \<in> carrier_mat n n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
hermitian C

goal (1 subgoal):
 1. \<exists>B C. hermitian B \<and> hermitian C \<and> A = B + \<i> \<cdot>\<^sub>m C \<and> B \<in> carrier_mat n n \<and> C \<in> carrier_mat n n
[PROOF STEP]
have "A = B + \<i> \<cdot>\<^sub>m C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = B + \<i> \<cdot>\<^sub>m C
[PROOF STEP]
using dim B C
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B = 1 / 2 \<cdot>\<^sub>m (A + adjoint A)
C = - \<i> / 2 \<cdot>\<^sub>m (A - adjoint A)

goal (1 subgoal):
 1. A = B + \<i> \<cdot>\<^sub>m C
[PROOF STEP]
apply (subst eq_matI)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>i j. \<lbrakk>A \<in> carrier_mat n n; B = 1 / 2 \<cdot>\<^sub>m (A + adjoint A); C = - \<i> / 2 \<cdot>\<^sub>m (A - adjoint A); i < dim_row ?y3; j < dim_col ?y3\<rbrakk> \<Longrightarrow> A $$ (i, j) = ?y3 $$ (i, j)
 2. \<lbrakk>A \<in> carrier_mat n n; B = 1 / 2 \<cdot>\<^sub>m (A + adjoint A); C = - \<i> / 2 \<cdot>\<^sub>m (A - adjoint A)\<rbrakk> \<Longrightarrow> dim_row A = dim_row ?y3
 3. \<lbrakk>A \<in> carrier_mat n n; B = 1 / 2 \<cdot>\<^sub>m (A + adjoint A); C = - \<i> / 2 \<cdot>\<^sub>m (A - adjoint A)\<rbrakk> \<Longrightarrow> dim_col A = dim_col ?y3
 4. \<lbrakk>A \<in> carrier_mat n n; B = 1 / 2 \<cdot>\<^sub>m (A + adjoint A); C = - \<i> / 2 \<cdot>\<^sub>m (A - adjoint A)\<rbrakk> \<Longrightarrow> ?y3 = B + \<i> \<cdot>\<^sub>m C
[PROOF STEP]
apply (auto simp add: adjoint_eval algebra_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
A = B + \<i> \<cdot>\<^sub>m C

goal (1 subgoal):
 1. \<exists>B C. hermitian B \<and> hermitian C \<and> A = B + \<i> \<cdot>\<^sub>m C \<and> B \<in> carrier_mat n n \<and> C \<in> carrier_mat n n
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
hermitian B
hermitian C
A = B + \<i> \<cdot>\<^sub>m C
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
hermitian B
hermitian C
A = B + \<i> \<cdot>\<^sub>m C

goal (1 subgoal):
 1. \<exists>B C. hermitian B \<and> hermitian C \<and> A = B + \<i> \<cdot>\<^sub>m C \<and> B \<in> carrier_mat n n \<and> C \<in> carrier_mat n n
[PROOF STEP]
using dimB dimC
[PROOF STATE]
proof (prove)
using this:
hermitian B
hermitian C
A = B + \<i> \<cdot>\<^sub>m C
B \<in> carrier_mat n n
C \<in> carrier_mat n n

goal (1 subgoal):
 1. \<exists>B C. hermitian B \<and> hermitian C \<and> A = B + \<i> \<cdot>\<^sub>m C \<and> B \<in> carrier_mat n n \<and> C \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>B C. hermitian B \<and> hermitian C \<and> A = B + \<i> \<cdot>\<^sub>m C \<and> B \<in> carrier_mat n n \<and> C \<in> carrier_mat n n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cauchy_in\<^sub>N_I:
  assumes "\<And>e. e > 0 \<Longrightarrow> (\<exists>M. \<forall>n\<ge>M. \<forall>m\<ge>M. Norm N (u n - u m) < e)"
  shows "cauchy_in\<^sub>N N u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cauchy_in\<^sub>N N u
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < ?e \<Longrightarrow> \<exists>M. \<forall>n\<ge>M. \<forall>m\<ge>M. Norm N (u n - u m) < ?e

goal (1 subgoal):
 1. cauchy_in\<^sub>N N u
[PROOF STEP]
unfolding cauchy_in\<^sub>N_def
[PROOF STATE]
proof (prove)
using this:
0 < ?e \<Longrightarrow> \<exists>M. \<forall>n\<ge>M. \<forall>m\<ge>M. Norm N (u n - u m) < ?e

goal (1 subgoal):
 1. \<forall>e>0. \<exists>M. \<forall>n\<ge>M. \<forall>m\<ge>M. Norm N (u n - u m) < e
[PROOF STEP]
by auto


[STATEMENT]
lemma expectation_neg_binomial_pmf:
  assumes p: "p \<in> {0<..1}"
  shows "measure_pmf.expectation (neg_binomial_pmf n p) real = n * (1 - p) / p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.expectation (neg_binomial_pmf n p) real = real n * (1 - p) / p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. measure_pmf.expectation (neg_binomial_pmf n p) real = real n * (1 - p) / p
[PROOF STEP]
have "nn_integral (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (n * (1 - p) / p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p)
[PROOF STEP]
by (intro nn_integral_neg_binomial_pmf_real p)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p)

goal (1 subgoal):
 1. measure_pmf.expectation (neg_binomial_pmf n p) real = real n * (1 - p) / p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (measure_pmf (neg_binomial_pmf n p)) of_nat = ennreal (real n * (1 - p) / p)

goal (1 subgoal):
 1. measure_pmf.expectation (neg_binomial_pmf n p) real = real n * (1 - p) / p
[PROOF STEP]
have "of_nat = (\<lambda>x. ennreal (real x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat = (\<lambda>x. ennreal (real x))
[PROOF STEP]
by (simp add: ennreal_of_nat_eq_real_of_nat fun_eq_iff)
[PROOF STATE]
proof (state)
this:
of_nat = (\<lambda>x. ennreal (real x))

goal (1 subgoal):
 1. measure_pmf.expectation (neg_binomial_pmf n p) real = real n * (1 - p) / p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ a. ennreal (real a) \<partial>measure_pmf (neg_binomial_pmf n p) = ennreal (real n * (1 - p) / p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ a. ennreal (real a) \<partial>measure_pmf (neg_binomial_pmf n p) = ennreal (real n * (1 - p) / p)

goal (1 subgoal):
 1. measure_pmf.expectation (neg_binomial_pmf n p) real = real n * (1 - p) / p
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ a. ennreal (real a) \<partial>measure_pmf (neg_binomial_pmf n p) = ennreal (real n * (1 - p) / p)
p \<in> {0<..1}

goal (1 subgoal):
 1. measure_pmf.expectation (neg_binomial_pmf n p) real = real n * (1 - p) / p
[PROOF STEP]
by (subst (asm) nn_integral_eq_integrable) auto
[PROOF STATE]
proof (state)
this:
measure_pmf.expectation (neg_binomial_pmf n p) real = real n * (1 - p) / p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eventually_at_right_field:
  "eventually P (at_right x) \<longleftrightarrow> (\<exists>b>x. \<forall>y>x. y < b \<longrightarrow> P y)"
  for x :: "'a::{linordered_field, linorder_topology}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (at_right x) = (\<exists>b>x. \<forall>y>x. y < b \<longrightarrow> P y)
[PROOF STEP]
using linordered_field_no_ub[rule_format, of x]
[PROOF STATE]
proof (prove)
using this:
Ex ((<) x)

goal (1 subgoal):
 1. eventually P (at_right x) = (\<exists>b>x. \<forall>y>x. y < b \<longrightarrow> P y)
[PROOF STEP]
by (auto simp: eventually_at_right)


[STATEMENT]
lemma is_increasingE:
  assumes "is_increasing f"
  assumes " n> m"
  shows "f n > f m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f m < f n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_increasing f
m < n

goal (1 subgoal):
 1. f m < f n
[PROOF STEP]
unfolding is_increasing_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n m. m < n \<longrightarrow> f m < f n
m < n

goal (1 subgoal):
 1. f m < f n
[PROOF STEP]
by blast