[STATEMENT]
lemma sign_changes_decompose:
  assumes "x \<noteq> (0 :: 'a :: linordered_idom)"
  shows   "sign_changes (xs @ x # ys) =
             sign_changes (xs @ [x]) + sign_changes (x # ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sign_changes (xs @ x # ys) = sign_changes (xs @ [x]) + sign_changes (x # ys)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sign_changes (xs @ x # ys) = sign_changes (xs @ [x]) + sign_changes (x # ys)
[PROOF STEP]
have "sign_changes (xs @ x # ys) =
            length (remdups_adj ([x\<leftarrow>map sgn xs . x \<noteq> 0] @
                      sgn x # [x\<leftarrow>map sgn ys . x \<noteq> 0])) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sign_changes (xs @ x # ys) = length (remdups_adj (filter (\<lambda>x. x \<noteq> (0::'a)) (map sgn xs) @ sgn x # filter (\<lambda>x. x \<noteq> (0::'a)) (map sgn ys))) - 1
[PROOF STEP]
by (simp add: sgn_0_0 assms sign_changes_def)
[PROOF STATE]
proof (state)
this:
sign_changes (xs @ x # ys) = length (remdups_adj (filter (\<lambda>x. x \<noteq> (0::'a)) (map sgn xs) @ sgn x # filter (\<lambda>x. x \<noteq> (0::'a)) (map sgn ys))) - 1

goal (1 subgoal):
 1. sign_changes (xs @ x # ys) = sign_changes (xs @ [x]) + sign_changes (x # ys)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sign_changes (xs @ x # ys) = length (remdups_adj (filter (\<lambda>x. x \<noteq> (0::'a)) (map sgn xs) @ sgn x # filter (\<lambda>x. x \<noteq> (0::'a)) (map sgn ys))) - 1

goal (1 subgoal):
 1. sign_changes (xs @ x # ys) = sign_changes (xs @ [x]) + sign_changes (x # ys)
[PROOF STEP]
have "\<dots> = sign_changes (xs @ [x]) + sign_changes (x # ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (remdups_adj (filter (\<lambda>x. x \<noteq> (0::'a)) (map sgn xs) @ sgn x # filter (\<lambda>x. x \<noteq> (0::'a)) (map sgn ys))) - 1 = sign_changes (xs @ [x]) + sign_changes (x # ys)
[PROOF STEP]
by (subst remdups_adj_append) (simp add: sign_changes_def assms sgn_0_0)
[PROOF STATE]
proof (state)
this:
length (remdups_adj (filter (\<lambda>x. x \<noteq> (0::'a)) (map sgn xs) @ sgn x # filter (\<lambda>x. x \<noteq> (0::'a)) (map sgn ys))) - 1 = sign_changes (xs @ [x]) + sign_changes (x # ys)

goal (1 subgoal):
 1. sign_changes (xs @ x # ys) = sign_changes (xs @ [x]) + sign_changes (x # ys)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sign_changes (xs @ x # ys) = sign_changes (xs @ [x]) + sign_changes (x # ys)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sign_changes (xs @ x # ys) = sign_changes (xs @ [x]) + sign_changes (x # ys)

goal (1 subgoal):
 1. sign_changes (xs @ x # ys) = sign_changes (xs @ [x]) + sign_changes (x # ys)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sign_changes (xs @ x # ys) = sign_changes (xs @ [x]) + sign_changes (x # ys)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sin_gt_zero_02:
  fixes x :: real
  assumes "0 < x" and "x < 2"
  shows "0 < sin x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < sin x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < sin x
[PROOF STEP]
let ?f = "\<lambda>n::nat. \<Sum>k = n*2..<n*2+2. (- 1) ^ k / (fact (2*k+1)) * x^(2*k+1)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < sin x
[PROOF STEP]
have pos: "\<forall>n. 0 < ?f n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. 0 < (\<Sum>k = n * 2..<n * 2 + 2. (- 1) ^ k / fact (2 * k + 1) * x ^ (2 * k + 1))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 0 < (\<Sum>k = n * 2..<n * 2 + 2. (- 1) ^ k / fact (2 * k + 1) * x ^ (2 * k + 1))
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 0 < (\<Sum>k = n * 2..<n * 2 + 2. (- 1) ^ k / fact (2 * k + 1) * x ^ (2 * k + 1))
[PROOF STEP]
let ?k2 = "real (Suc (Suc (4 * n)))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 0 < (\<Sum>k = n * 2..<n * 2 + 2. (- 1) ^ k / fact (2 * k + 1) * x ^ (2 * k + 1))
[PROOF STEP]
let ?k3 = "real (Suc (Suc (Suc (4 * n))))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 0 < (\<Sum>k = n * 2..<n * 2 + 2. (- 1) ^ k / fact (2 * k + 1) * x ^ (2 * k + 1))
[PROOF STEP]
have "x * x < ?k2 * ?k3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * x < real (Suc (Suc (4 * n))) * real (Suc (Suc (Suc (4 * n))))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x
x < 2

goal (1 subgoal):
 1. x * x < real (Suc (Suc (4 * n))) * real (Suc (Suc (Suc (4 * n))))
[PROOF STEP]
by (intro mult_strict_mono', simp_all)
[PROOF STATE]
proof (state)
this:
x * x < real (Suc (Suc (4 * n))) * real (Suc (Suc (Suc (4 * n))))

goal (1 subgoal):
 1. \<And>n. 0 < (\<Sum>k = n * 2..<n * 2 + 2. (- 1) ^ k / fact (2 * k + 1) * x ^ (2 * k + 1))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x * x < real (Suc (Suc (4 * n))) * real (Suc (Suc (Suc (4 * n))))
[PROOF STEP]
have "x * x * x * x ^ (n * 4) < ?k2 * ?k3 * x * x ^ (n * 4)"
[PROOF STATE]
proof (prove)
using this:
x * x < real (Suc (Suc (4 * n))) * real (Suc (Suc (Suc (4 * n))))

goal (1 subgoal):
 1. x * x * x * x ^ (n * 4) < real (Suc (Suc (4 * n))) * real (Suc (Suc (Suc (4 * n)))) * x * x ^ (n * 4)
[PROOF STEP]
by (intro mult_strict_right_mono zero_less_power \<open>0 < x\<close>)
[PROOF STATE]
proof (state)
this:
x * x * x * x ^ (n * 4) < real (Suc (Suc (4 * n))) * real (Suc (Suc (Suc (4 * n)))) * x * x ^ (n * 4)

goal (1 subgoal):
 1. \<And>n. 0 < (\<Sum>k = n * 2..<n * 2 + 2. (- 1) ^ k / fact (2 * k + 1) * x ^ (2 * k + 1))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x * x * x * x ^ (n * 4) < real (Suc (Suc (4 * n))) * real (Suc (Suc (Suc (4 * n)))) * x * x ^ (n * 4)
[PROOF STEP]
show "0 < ?f n"
[PROOF STATE]
proof (prove)
using this:
x * x * x * x ^ (n * 4) < real (Suc (Suc (4 * n))) * real (Suc (Suc (Suc (4 * n)))) * x * x ^ (n * 4)

goal (1 subgoal):
 1. 0 < (\<Sum>k = n * 2..<n * 2 + 2. (- 1) ^ k / fact (2 * k + 1) * x ^ (2 * k + 1))
[PROOF STEP]
by (simp add: ac_simps divide_less_eq)
[PROOF STATE]
proof (state)
this:
0 < (\<Sum>k = n * 2..<n * 2 + 2. (- 1) ^ k / fact (2 * k + 1) * x ^ (2 * k + 1))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>n. 0 < (\<Sum>k = n * 2..<n * 2 + 2. (- 1) ^ k / fact (2 * k + 1) * x ^ (2 * k + 1))

goal (1 subgoal):
 1. 0 < sin x
[PROOF STEP]
have sums: "?f sums sin x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k = n * 2..<n * 2 + 2. (- 1) ^ k / fact (2 * k + 1) * x ^ (2 * k + 1)) sums sin x
[PROOF STEP]
by (rule sin_paired [THEN sums_group]) simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>k = n * 2..<n * 2 + 2. (- 1) ^ k / fact (2 * k + 1) * x ^ (2 * k + 1)) sums sin x

goal (1 subgoal):
 1. 0 < sin x
[PROOF STEP]
show "0 < sin x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < sin x
[PROOF STEP]
unfolding sums_unique [OF sums]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < (\<Sum>n. \<Sum>k = n * 2..<n * 2 + 2. (- 1) ^ k / fact (2 * k + 1) * x ^ (2 * k + 1))
[PROOF STEP]
using sums_summable [OF sums] pos
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. \<Sum>k = n * 2..<n * 2 + 2. (- 1) ^ k / fact (2 * k + 1) * x ^ (2 * k + 1))
\<forall>n. 0 < (\<Sum>k = n * 2..<n * 2 + 2. (- 1) ^ k / fact (2 * k + 1) * x ^ (2 * k + 1))

goal (1 subgoal):
 1. 0 < (\<Sum>n. \<Sum>k = n * 2..<n * 2 + 2. (- 1) ^ k / fact (2 * k + 1) * x ^ (2 * k + 1))
[PROOF STEP]
by (simp add: suminf_pos)
[PROOF STATE]
proof (state)
this:
0 < sin x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Carmichael_number_561: "Carmichael_number 561" (is "Carmichael_number ?n")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Carmichael_number 561
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Carmichael_number 561
[PROOF STEP]
have [simp]: "prime_factorization (561 :: nat) = {#3, 11, 17#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factorization 561 = {#3, 11, 17#}
[PROOF STEP]
by (rule prime_factorization_eqI) auto
[PROOF STATE]
proof (state)
this:
prime_factorization 561 = {#3, 11, 17#}

goal (1 subgoal):
 1. Carmichael_number 561
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Carmichael_number 561
[PROOF STEP]
by (subst Carmichael_number_iff') auto
[PROOF STATE]
proof (state)
this:
Carmichael_number 561

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma circline_intersection_symetry:
  shows "circline_intersection H1 H2 = circline_intersection H2 H1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. circline_intersection H1 H2 = circline_intersection H2 H1
[PROOF STEP]
unfolding circline_intersection_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {z. on_circline H1 z \<and> on_circline H2 z} = {z. on_circline H2 z \<and> on_circline H1 z}
[PROOF STEP]
by auto


[STATEMENT]
lemma fincomp_comp:
  "\<lbrakk>f \<in> A \<rightarrow> M; g \<in> A \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) A = (fincomp f A \<cdot> fincomp g A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> M; g \<in> A \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) A = fincomp f A \<cdot> fincomp g A
[PROOF STEP]
proof (induct A rule: infinite_finite_induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>A. \<lbrakk>infinite A; f \<in> A \<rightarrow> M; g \<in> A \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) A = fincomp f A \<cdot> fincomp g A
 2. \<lbrakk>f \<in> {} \<rightarrow> M; g \<in> {} \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) {} = fincomp f {} \<cdot> fincomp g {}
 3. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>f \<in> F \<rightarrow> M; g \<in> F \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) F = fincomp f F \<cdot> fincomp g F; f \<in> insert x F \<rightarrow> M; g \<in> insert x F \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) (insert x F) = fincomp f (insert x F) \<cdot> fincomp g (insert x F)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
f \<in> {} \<rightarrow> M
g \<in> {} \<rightarrow> M

goal (3 subgoals):
 1. \<And>A. \<lbrakk>infinite A; f \<in> A \<rightarrow> M; g \<in> A \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) A = fincomp f A \<cdot> fincomp g A
 2. \<lbrakk>f \<in> {} \<rightarrow> M; g \<in> {} \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) {} = fincomp f {} \<cdot> fincomp g {}
 3. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>f \<in> F \<rightarrow> M; g \<in> F \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) F = fincomp f F \<cdot> fincomp g F; f \<in> insert x F \<rightarrow> M; g \<in> insert x F \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) (insert x F) = fincomp f (insert x F) \<cdot> fincomp g (insert x F)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fincomp (\<lambda>x. f x \<cdot> g x) {} = fincomp f {} \<cdot> fincomp g {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fincomp (\<lambda>x. f x \<cdot> g x) {} = fincomp f {} \<cdot> fincomp g {}

goal (2 subgoals):
 1. \<And>A. \<lbrakk>infinite A; f \<in> A \<rightarrow> M; g \<in> A \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) A = fincomp f A \<cdot> fincomp g A
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>f \<in> F \<rightarrow> M; g \<in> F \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) F = fincomp f F \<cdot> fincomp g F; f \<in> insert x F \<rightarrow> M; g \<in> insert x F \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) (insert x F) = fincomp f (insert x F) \<cdot> fincomp g (insert x F)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. \<lbrakk>infinite A; f \<in> A \<rightarrow> M; g \<in> A \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) A = fincomp f A \<cdot> fincomp g A
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>f \<in> F \<rightarrow> M; g \<in> F \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) F = fincomp f F \<cdot> fincomp g F; f \<in> insert x F \<rightarrow> M; g \<in> insert x F \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) (insert x F) = fincomp f (insert x F) \<cdot> fincomp g (insert x F)
[PROOF STEP]
case (insert a A)
[PROOF STATE]
proof (state)
this:
finite A
a \<notin> A
\<lbrakk>f \<in> A \<rightarrow> M; g \<in> A \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) A = fincomp f A \<cdot> fincomp g A
f \<in> insert a A \<rightarrow> M
g \<in> insert a A \<rightarrow> M

goal (2 subgoals):
 1. \<And>A. \<lbrakk>infinite A; f \<in> A \<rightarrow> M; g \<in> A \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) A = fincomp f A \<cdot> fincomp g A
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>f \<in> F \<rightarrow> M; g \<in> F \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) F = fincomp f F \<cdot> fincomp g F; f \<in> insert x F \<rightarrow> M; g \<in> insert x F \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) (insert x F) = fincomp f (insert x F) \<cdot> fincomp g (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite A
a \<notin> A
\<lbrakk>f \<in> A \<rightarrow> M; g \<in> A \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) A = fincomp f A \<cdot> fincomp g A
f \<in> insert a A \<rightarrow> M
g \<in> insert a A \<rightarrow> M
[PROOF STEP]
have "f a \<in> M" "g \<in> A \<rightarrow> M" "g a \<in> M" "f \<in> A \<rightarrow> M" "(\<lambda>x. f x \<cdot> g x) \<in> A \<rightarrow> M"
[PROOF STATE]
proof (prove)
using this:
finite A
a \<notin> A
\<lbrakk>f \<in> A \<rightarrow> M; g \<in> A \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) A = fincomp f A \<cdot> fincomp g A
f \<in> insert a A \<rightarrow> M
g \<in> insert a A \<rightarrow> M

goal (1 subgoal):
 1. (f a \<in> M &&& g \<in> A \<rightarrow> M) &&& g a \<in> M &&& f \<in> A \<rightarrow> M &&& (\<lambda>x. f x \<cdot> g x) \<in> A \<rightarrow> M
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
f a \<in> M
g \<in> A \<rightarrow> M
g a \<in> M
f \<in> A \<rightarrow> M
(\<lambda>x. f x \<cdot> g x) \<in> A \<rightarrow> M

goal (2 subgoals):
 1. \<And>A. \<lbrakk>infinite A; f \<in> A \<rightarrow> M; g \<in> A \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) A = fincomp f A \<cdot> fincomp g A
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>f \<in> F \<rightarrow> M; g \<in> F \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) F = fincomp f F \<cdot> fincomp g F; f \<in> insert x F \<rightarrow> M; g \<in> insert x F \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) (insert x F) = fincomp f (insert x F) \<cdot> fincomp g (insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f a \<in> M
g \<in> A \<rightarrow> M
g a \<in> M
f \<in> A \<rightarrow> M
(\<lambda>x. f x \<cdot> g x) \<in> A \<rightarrow> M
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
f a \<in> M
g \<in> A \<rightarrow> M
g a \<in> M
f \<in> A \<rightarrow> M
(\<lambda>x. f x \<cdot> g x) \<in> A \<rightarrow> M

goal (1 subgoal):
 1. fincomp (\<lambda>x. f x \<cdot> g x) (insert a A) = fincomp f (insert a A) \<cdot> fincomp g (insert a A)
[PROOF STEP]
by (simp add: insert associative left_commute)
[PROOF STATE]
proof (state)
this:
fincomp (\<lambda>x. f x \<cdot> g x) (insert a A) = fincomp f (insert a A) \<cdot> fincomp g (insert a A)

goal (1 subgoal):
 1. \<And>A. \<lbrakk>infinite A; f \<in> A \<rightarrow> M; g \<in> A \<rightarrow> M\<rbrakk> \<Longrightarrow> fincomp (\<lambda>x. f x \<cdot> g x) A = fincomp f A \<cdot> fincomp g A
[PROOF STEP]
qed simp


[STATEMENT]
lemma int_pow_sum_val:
  assumes "a \<in> nonzero Q\<^sub>p"
  shows "val (a[^]((i::int) + j)) =  (val (a[^]i)) + val (a[^]j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val (a [^] (i + j)) = val (a [^] i) + val (a [^] j)
[PROOF STEP]
using assms Qp.int_pow_add Qp_int_pow_nonzero Units_eq_nonzero val_mult0
[PROOF STATE]
proof (prove)
using this:
a \<in> nonzero Q\<^sub>p
?a \<in> Units Q\<^sub>p \<Longrightarrow> ?a [^] (?n + ?m) = ?a [^] ?n \<otimes> ?a [^] ?m
?x \<in> nonzero Q\<^sub>p \<Longrightarrow> ?x [^] ?n \<in> nonzero Q\<^sub>p
Units Q\<^sub>p = nonzero Q\<^sub>p
\<lbrakk>?x \<in> nonzero Q\<^sub>p; ?y \<in> nonzero Q\<^sub>p\<rbrakk> \<Longrightarrow> val (?x \<otimes> ?y) = val ?x + val ?y

goal (1 subgoal):
 1. val (a [^] (i + j)) = val (a [^] i) + val (a [^] j)
[PROOF STEP]
by presburger


[STATEMENT]
lemma power2_norm_eq_inner: "(norm x)\<^sup>2 = real_of (inner x x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm x)\<^sup>2 = real_of (inner x x)
[PROOF STEP]
by (simp add: norm_def)


[STATEMENT]
lemma fps_deriv_lr_inverse_comm:
  fixes   x :: "'a::comm_ring_1"
  assumes "x * f$0 = 1"
  shows   "fps_deriv (fps_left_inverse f x) = - fps_deriv f * (fps_left_inverse f x)\<^sup>2"
  and     "fps_deriv (fps_right_inverse f x) = - fps_deriv f * (fps_right_inverse f x)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_deriv (fps_left_inverse f x) = - fps_deriv f * (fps_left_inverse f x)\<^sup>2 &&& fps_deriv (fps_right_inverse f x) = - fps_deriv f * (fps_right_inverse f x)\<^sup>2
[PROOF STEP]
using   assms fps_deriv_lr_inverse[of x f x]
[PROOF STATE]
proof (prove)
using this:
x * f $ 0 = (1::'a)
\<lbrakk>x * f $ 0 = (1::'a); f $ 0 * x = (1::'a)\<rbrakk> \<Longrightarrow> fps_deriv (fps_left_inverse f x) = - fps_left_inverse f x * fps_deriv f * fps_left_inverse f x
\<lbrakk>x * f $ 0 = (1::'a); f $ 0 * x = (1::'a)\<rbrakk> \<Longrightarrow> fps_deriv (fps_right_inverse f x) = - fps_right_inverse f x * fps_deriv f * fps_right_inverse f x

goal (1 subgoal):
 1. fps_deriv (fps_left_inverse f x) = - fps_deriv f * (fps_left_inverse f x)\<^sup>2 &&& fps_deriv (fps_right_inverse f x) = - fps_deriv f * (fps_right_inverse f x)\<^sup>2
[PROOF STEP]
by      (simp_all add: mult.commute power2_eq_square)


[STATEMENT]
lemma arctan_tan: "-(pi/2) < x \<Longrightarrow> x < pi/2 \<Longrightarrow> arctan (tan x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- (pi / 2) < x; x < pi / 2\<rbrakk> \<Longrightarrow> arctan (tan x) = x
[PROOF STEP]
by (rule arctan_unique) simp_all


[STATEMENT]
lemma onorm_pos_lt:
  assumes f: "bounded_linear f"
  shows "0 < onorm f \<longleftrightarrow> \<not> (\<forall>x. f x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < onorm f) = (\<not> (\<forall>x. f x = (0::'b)))
[PROOF STEP]
by (simp add: less_le onorm_pos_le [OF f] onorm_eq_0 [OF f])


[STATEMENT]
lemma (in design) n_inter_num_choose_design: "b1 \<in># \<B> \<Longrightarrow> b2 \<in># \<B>
    \<Longrightarrow> b1 |\<inter>|\<^sub>n b2 = (card (b1 \<inter> b2) choose n) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>b1 \<in># \<B>; b2 \<in># \<B>\<rbrakk> \<Longrightarrow> (b1 |\<inter>|\<^sub>n b2) = card (b1 \<inter> b2) choose n
[PROOF STEP]
using finite_blocks
[PROOF STATE]
proof (prove)
using this:
?b \<in># \<B> \<Longrightarrow> finite ?b

goal (1 subgoal):
 1. \<lbrakk>b1 \<in># \<B>; b2 \<in># \<B>\<rbrakk> \<Longrightarrow> (b1 |\<inter>|\<^sub>n b2) = card (b1 \<inter> b2) choose n
[PROOF STEP]
by (simp add: n_inter_num_choose)


[STATEMENT]
lemma ord_of_nat_oexp: "ord_of_nat (m^n) = ord_of_nat m\<up>ord_of_nat n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord_of_nat (m ^ n) = ord_of_nat m \<up> ord_of_nat n
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ord_of_nat (m ^ 0) = ord_of_nat m \<up> ord_of_nat 0
 2. \<And>n. ord_of_nat (m ^ n) = ord_of_nat m \<up> ord_of_nat n \<Longrightarrow> ord_of_nat (m ^ Suc n) = ord_of_nat m \<up> ord_of_nat (Suc n)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
ord_of_nat (m ^ n) = ord_of_nat m \<up> ord_of_nat n

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

goal (1 subgoal):
 1. ord_of_nat (m ^ Suc n) = ord_of_nat m \<up> ord_of_nat (Suc n)
[PROOF STEP]
by (simp add: mult.commute [of m]) (simp add: ord_of_nat_mult)
[PROOF STATE]
proof (state)
this:
ord_of_nat (m ^ Suc n) = ord_of_nat m \<up> ord_of_nat (Suc n)

goal (1 subgoal):
 1. ord_of_nat (m ^ 0) = ord_of_nat m \<up> ord_of_nat 0
[PROOF STEP]
qed auto


[STATEMENT]
lemma abs_prod_mset: "\<bar>prod_mset (A :: 'a :: idom_abs_sgn multiset)\<bar> = prod_mset (image_mset abs A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>\<Prod>\<^sub># A\<bar> = \<Prod>\<^sub># (image_mset abs A)
[PROOF STEP]
by (induction A) (auto simp: abs_mult)


[STATEMENT]
lemma prime_elem_dvd_mult_iff:
  "prime_elem p \<Longrightarrow> p dvd (a * b) \<longleftrightarrow> p dvd a \<or> p dvd b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_elem p \<Longrightarrow> (p dvd a * b) = (p dvd a \<or> p dvd b)
[PROOF STEP]
by (auto simp: prime_elem_def)


[STATEMENT]
lemma closure_linear_image_subset:
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::real_normed_vector"
  assumes "linear f"
  shows "f ` (closure S) \<subseteq> closure (f ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` closure S \<subseteq> closure (f ` S)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
linear f

goal (1 subgoal):
 1. f ` closure S \<subseteq> closure (f ` S)
[PROOF STEP]
unfolding linear_conv_bounded_linear
[PROOF STATE]
proof (prove)
using this:
bounded_linear f

goal (1 subgoal):
 1. f ` closure S \<subseteq> closure (f ` S)
[PROOF STEP]
by (rule closure_bounded_linear_image_subset)


[STATEMENT]
lemma char_poly_matrix: assumes A: "(A :: 'a :: field mat) \<in> carrier_mat n n"
  shows "poly (char_poly A) k = det (- (char_matrix A k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (char_poly A) k = det (- char_matrix A k)
[PROOF STEP]
unfolding char_poly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (det (char_poly_matrix A)) k = det (- char_matrix A k)
[PROOF STEP]
by (rule poly_det_cong[of _ n], insert A, auto simp: char_poly_matrix_def char_matrix_def)


[STATEMENT]
lemma one_eSuc: "1 = eSuc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 = eSuc 0
[PROOF STEP]
by (simp add: zero_enat_def one_enat_def eSuc_def)


[STATEMENT]
lemma integral_less_real:
  fixes f :: "real \<Rightarrow> real"
  assumes "continuous_on {a..b} f" "continuous_on {a..b} g" and "{a<..<b} \<noteq> {}"
    and "\<And>x. x \<in> {a<..<b} \<Longrightarrow> f x < g x"
  shows "integral {a..b} f < integral {a..b} g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {a..b} f < integral {a..b} g
[PROOF STEP]
by (metis assms box_real integral_less)


[STATEMENT]
lemma coeff_higher_pderiv:
  "coeff ((pderiv ^^ m) f) n = pochhammer (of_nat (Suc n)) m * coeff f (n + m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly.coeff ((pderiv ^^ m) f) n = pochhammer (of_nat (Suc n)) m * poly.coeff f (n + m)
[PROOF STEP]
by (induction m arbitrary: n) (simp_all add: coeff_pderiv pochhammer_rec algebra_simps)


[STATEMENT]
lemma val_ultrametric:
  assumes "x \<in> carrier Q\<^sub>p"
  assumes "y \<in> carrier Q\<^sub>p"
  shows " min (val x) (val y) \<le> val (x \<oplus> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (val x) (val y) \<le> val (x \<oplus> y)
[PROOF STEP]
apply(cases "x = \<zero> \<or> y = \<zero>")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x = \<zero> \<or> y = \<zero> \<Longrightarrow> min (val x) (val y) \<le> val (x \<oplus> y)
 2. \<not> (x = \<zero> \<or> y = \<zero>) \<Longrightarrow> min (val x) (val y) \<le> val (x \<oplus> y)
[PROOF STEP]
using assms(1) assms(2)
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier Q\<^sub>p
y \<in> carrier Q\<^sub>p

goal (2 subgoals):
 1. x = \<zero> \<or> y = \<zero> \<Longrightarrow> min (val x) (val y) \<le> val (x \<oplus> y)
 2. \<not> (x = \<zero> \<or> y = \<zero>) \<Longrightarrow> min (val x) (val y) \<le> val (x \<oplus> y)
[PROOF STEP]
apply auto[1]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (x = \<zero> \<or> y = \<zero>) \<Longrightarrow> min (val x) (val y) \<le> val (x \<oplus> y)
[PROOF STEP]
by (metis Qp.add.m_closed assms(1) assms(2) eint_ord_code(3) local.val_zero not_nonzero_Qp val_ultrametric0)


[STATEMENT]
lemma \<psi>_conv_\<theta>_sum: "x > 0 \<Longrightarrow> \<psi> x = sum_upto (\<lambda>m. \<theta> (root m x)) (log 2 x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> \<psi> x = sum_upto (\<lambda>m. \<theta> (root m x)) (log 2 x)
[PROOF STEP]
by (simp add: \<psi>_altdef \<theta>_def)


[STATEMENT]
lemma tendsto_inverse_real [tendsto_intros]:
  fixes u::"_ \<Rightarrow> real"
  shows "(u \<longlongrightarrow> l) F \<Longrightarrow> l \<noteq> 0 \<Longrightarrow> ((\<lambda>x. 1/ u x) \<longlongrightarrow> 1/l) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(u \<longlongrightarrow> l) F; l \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>x. 1 / u x) \<longlongrightarrow> 1 / l) F
[PROOF STEP]
using tendsto_inverse
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?f \<longlongrightarrow> ?a) ?F; ?a \<noteq> (0::?'a)\<rbrakk> \<Longrightarrow> ((\<lambda>x. inverse (?f x)) \<longlongrightarrow> inverse ?a) ?F

goal (1 subgoal):
 1. \<lbrakk>(u \<longlongrightarrow> l) F; l \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>x. 1 / u x) \<longlongrightarrow> 1 / l) F
[PROOF STEP]
unfolding inverse_eq_divide
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?f \<longlongrightarrow> ?a) ?F; ?a \<noteq> (0::?'a)\<rbrakk> \<Longrightarrow> ((\<lambda>x. (1::?'a) / ?f x) \<longlongrightarrow> (1::?'a) / ?a) ?F

goal (1 subgoal):
 1. \<lbrakk>(u \<longlongrightarrow> l) F; l \<noteq> 0\<rbrakk> \<Longrightarrow> ((\<lambda>x. 1 / u x) \<longlongrightarrow> 1 / l) F
[PROOF STEP]
.


[STATEMENT]
lemma floor_divide_lower:
  fixes q :: "'a::floor_ceiling"
  shows "q > 0 \<Longrightarrow> of_int \<lfloor>p / q\<rfloor> * q \<le> p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < q \<Longrightarrow> of_int \<lfloor>p / q\<rfloor> * q \<le> p
[PROOF STEP]
using of_int_floor_le pos_le_divide_eq
[PROOF STATE]
proof (prove)
using this:
of_int \<lfloor>?x\<rfloor> \<le> ?x
(0::?'a) < ?c \<Longrightarrow> (?a \<le> ?b / ?c) = (?a * ?c \<le> ?b)

goal (1 subgoal):
 1. (0::'a) < q \<Longrightarrow> of_int \<lfloor>p / q\<rfloor> * q \<le> p
[PROOF STEP]
by blast


[STATEMENT]
lemma variation_mult_neg_1:
  assumes "c<0"
  shows "variation (c*x) y =variation x y + (if y=0 then 0 else sign x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. variation (c * x) y = variation x y + (if y = 0 then 0 else sign x)
[PROOF STEP]
apply (cases x  rule:linorder_cases[of 0] )
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. 0 < x \<Longrightarrow> variation (c * x) y = variation x y + (if y = 0 then 0 else sign x)
 2. 0 = x \<Longrightarrow> variation (c * x) y = variation x y + (if y = 0 then 0 else sign x)
 3. x < 0 \<Longrightarrow> variation (c * x) y = variation x y + (if y = 0 then 0 else sign x)
[PROOF STEP]
apply (cases y  rule:linorder_cases[of 0], auto simp add:
    variation_cases mult_neg_pos[OF \<open>c<0\<close>,of x]  mult_neg_neg[OF \<open>c<0\<close>,of x])+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma map2_append1_take_drop: "
  length xs1 \<le> length ys \<Longrightarrow>
  map2 f (xs1 @ xs2) ys =
  map2 f xs1 (ys \<down> length xs1) @
  map2 f xs2 (ys \<up> length xs1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs1 \<le> length ys \<Longrightarrow> List2.map2 f (xs1 @ xs2) ys = List2.map2 f xs1 (ys \<down> length xs1) @ List2.map2 f xs2 (ys \<up> length xs1)
[PROOF STEP]
apply (rule_tac
  t = "map2 f (xs1 @ xs2) ys" and
  s = "map2 f (xs1 @ xs2) (ys \<down> length xs1 @ ys \<up> length xs1)"
  in subst)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. length xs1 \<le> length ys \<Longrightarrow> List2.map2 f (xs1 @ xs2) (ys \<down> length xs1 @ ys \<up> length xs1) = List2.map2 f (xs1 @ xs2) ys
 2. length xs1 \<le> length ys \<Longrightarrow> List2.map2 f (xs1 @ xs2) (ys \<down> length xs1 @ ys \<up> length xs1) = List2.map2 f xs1 (ys \<down> length xs1) @ List2.map2 f xs2 (ys \<up> length xs1)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs1 \<le> length ys \<Longrightarrow> List2.map2 f (xs1 @ xs2) (ys \<down> length xs1 @ ys \<up> length xs1) = List2.map2 f xs1 (ys \<down> length xs1) @ List2.map2 f xs2 (ys \<up> length xs1)
[PROOF STEP]
apply (simp add: map2_append_append del: append_take_drop_id)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem th2_3: "\<lbrakk>a b \<congruent> c d; c d \<congruent> e f\<rbrakk> \<Longrightarrow> a b \<congruent> e f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a b \<equiv> c d; c d \<equiv> e f\<rbrakk> \<Longrightarrow> a b \<equiv> e f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>a b \<equiv> c d; c d \<equiv> e f\<rbrakk> \<Longrightarrow> a b \<equiv> e f
[PROOF STEP]
assume "a b \<congruent> c d"
[PROOF STATE]
proof (state)
this:
a b \<equiv> c d

goal (1 subgoal):
 1. \<lbrakk>a b \<equiv> c d; c d \<equiv> e f\<rbrakk> \<Longrightarrow> a b \<equiv> e f
[PROOF STEP]
with th2_2 [of a b c d]
[PROOF STATE]
proof (chain)
picking this:
a b \<equiv> c d \<Longrightarrow> c d \<equiv> a b
a b \<equiv> c d
[PROOF STEP]
have "c d \<congruent> a b"
[PROOF STATE]
proof (prove)
using this:
a b \<equiv> c d \<Longrightarrow> c d \<equiv> a b
a b \<equiv> c d

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

goal (1 subgoal):
 1. \<lbrakk>a b \<equiv> c d; c d \<equiv> e f\<rbrakk> \<Longrightarrow> a b \<equiv> e f
[PROOF STEP]
assume "c d \<congruent> e f"
[PROOF STATE]
proof (state)
this:
c d \<equiv> e f

goal (1 subgoal):
 1. \<lbrakk>a b \<equiv> c d; c d \<equiv> e f\<rbrakk> \<Longrightarrow> a b \<equiv> e f
[PROOF STEP]
with A2' [of c d a b e f] and \<open>c d \<congruent> a b\<close>
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>c d \<equiv> a b; c d \<equiv> e f\<rbrakk> \<Longrightarrow> a b \<equiv> e f
c d \<equiv> a b
c d \<equiv> e f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>c d \<equiv> a b; c d \<equiv> e f\<rbrakk> \<Longrightarrow> a b \<equiv> e f
c d \<equiv> a b
c d \<equiv> e f

goal (1 subgoal):
 1. a b \<equiv> e f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a b \<equiv> e f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Pi_power_coprime: "i \<noteq> j \<Longrightarrow> coprime ((Pi i)^m) ((Pi j)^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<noteq> j \<Longrightarrow> coprime (Pi i ^ m) (Pi j ^ n)
[PROOF STEP]
unfolding coprime_power_right_iff coprime_power_left_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<noteq> j \<Longrightarrow> (coprime (Pi i) (Pi j) \<or> m = 0) \<or> n = 0
[PROOF STEP]
using Pi_coprime
[PROOF STATE]
proof (prove)
using this:
?i \<noteq> ?j \<Longrightarrow> coprime (Pi ?i) (Pi ?j)

goal (1 subgoal):
 1. i \<noteq> j \<Longrightarrow> (coprime (Pi i) (Pi j) \<or> m = 0) \<or> n = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma coeff_drop_deg:
assumes "i<n"
shows "poly.coeff (drop_deg n f) i = poly.coeff (f::'a mod_ring poly) (i+n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly.coeff (drop_deg n f) i = poly.coeff f (i + n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < n

goal (1 subgoal):
 1. poly.coeff (drop_deg n f) i = poly.coeff f (i + n)
[PROOF STEP]
unfolding drop_deg_def
[PROOF STATE]
proof (prove)
using this:
i < n

goal (1 subgoal):
 1. poly.coeff (Poly (drop n (coeffs f))) i = poly.coeff f (i + n)
[PROOF STEP]
by (simp add: nth_default_coeffs_eq nth_default_drop)


[STATEMENT]
lemma monad_hrabs_less: "y \<in> monad x \<Longrightarrow> 0 < hypreal_of_real e \<Longrightarrow> \<bar>y - x\<bar> < hypreal_of_real e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y \<in> monad x; 0 < hypreal_of_real e\<rbrakk> \<Longrightarrow> \<bar>y - x\<bar> < hypreal_of_real e
[PROOF STEP]
by (simp add: Infinitesimal_approx_minus approx_sym less_Infinitesimal_less mem_monad_approx)


[STATEMENT]
lemma arc_linorder_matrix_1:
  fixes f :: "('a::finite,'b::non_trivial_linorder_stone_relation_algebra_expansion) square"
  assumes "matrix_stone_relation_algebra.arc f"
    shows "\<exists>e . f e = top \<and> (\<forall>d . e \<noteq> d \<longrightarrow> f d = bot)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>e. f e = top \<and> (\<forall>d. e \<noteq> d \<longrightarrow> f d = bot)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>e. f e = top \<and> (\<forall>d. e \<noteq> d \<longrightarrow> f d = bot)
[PROOF STEP]
have "matrix_stone_relation_algebra.point (f \<odot> mtop)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_stone_relation_algebra.point (f \<odot> mtop)
[PROOF STEP]
by (simp add: assms matrix_bounded_idempotent_semiring.vector_mult_closed)
[PROOF STATE]
proof (state)
this:
matrix_stone_relation_algebra.point (f \<odot> mtop)

goal (1 subgoal):
 1. \<exists>e. f e = top \<and> (\<forall>d. e \<noteq> d \<longrightarrow> f d = bot)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
matrix_stone_relation_algebra.point (f \<odot> mtop)
[PROOF STEP]
obtain i where 1: "\<forall>j . (f \<odot> mtop) (i,j) = top \<and> (\<forall>k . i \<noteq> k \<longrightarrow> (f \<odot> mtop) (k,j) = bot)"
[PROOF STATE]
proof (prove)
using this:
matrix_stone_relation_algebra.point (f \<odot> mtop)

goal (1 subgoal):
 1. (\<And>i. \<forall>j. (f \<odot> mtop) (i, j) = top \<and> (\<forall>k. i \<noteq> k \<longrightarrow> (f \<odot> mtop) (k, j) = bot) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using point_linorder_matrix
[PROOF STATE]
proof (prove)
using this:
matrix_stone_relation_algebra.point (f \<odot> mtop)
matrix_stone_relation_algebra.point ?f = (\<exists>i. \<forall>j. ?f (i, j) = top \<and> (\<forall>k. i \<noteq> k \<longrightarrow> ?f (k, j) = bot))

goal (1 subgoal):
 1. (\<And>i. \<forall>j. (f \<odot> mtop) (i, j) = top \<and> (\<forall>k. i \<noteq> k \<longrightarrow> (f \<odot> mtop) (k, j) = bot) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>j. (f \<odot> mtop) (i, j) = top \<and> (\<forall>k. i \<noteq> k \<longrightarrow> (f \<odot> mtop) (k, j) = bot)

goal (1 subgoal):
 1. \<exists>e. f e = top \<and> (\<forall>d. e \<noteq> d \<longrightarrow> f d = bot)
[PROOF STEP]
have "matrix_stone_relation_algebra.point (f\<^sup>t \<odot> mtop)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_stone_relation_algebra.point (f\<^sup>t \<odot> mtop)
[PROOF STEP]
by (simp add: assms matrix_bounded_idempotent_semiring.vector_mult_closed)
[PROOF STATE]
proof (state)
this:
matrix_stone_relation_algebra.point (f\<^sup>t \<odot> mtop)

goal (1 subgoal):
 1. \<exists>e. f e = top \<and> (\<forall>d. e \<noteq> d \<longrightarrow> f d = bot)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
matrix_stone_relation_algebra.point (f\<^sup>t \<odot> mtop)
[PROOF STEP]
obtain j where "\<forall>i . (f\<^sup>t \<odot> mtop) (j,i) = top \<and> (\<forall>k . j \<noteq> k \<longrightarrow> (f\<^sup>t \<odot> mtop) (k,i) = bot)"
[PROOF STATE]
proof (prove)
using this:
matrix_stone_relation_algebra.point (f\<^sup>t \<odot> mtop)

goal (1 subgoal):
 1. (\<And>j. \<forall>i. (f\<^sup>t \<odot> mtop) (j, i) = top \<and> (\<forall>k. j \<noteq> k \<longrightarrow> (f\<^sup>t \<odot> mtop) (k, i) = bot) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using point_linorder_matrix
[PROOF STATE]
proof (prove)
using this:
matrix_stone_relation_algebra.point (f\<^sup>t \<odot> mtop)
matrix_stone_relation_algebra.point ?f = (\<exists>i. \<forall>j. ?f (i, j) = top \<and> (\<forall>k. i \<noteq> k \<longrightarrow> ?f (k, j) = bot))

goal (1 subgoal):
 1. (\<And>j. \<forall>i. (f\<^sup>t \<odot> mtop) (j, i) = top \<and> (\<forall>k. j \<noteq> k \<longrightarrow> (f\<^sup>t \<odot> mtop) (k, i) = bot) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>i. (f\<^sup>t \<odot> mtop) (j, i) = top \<and> (\<forall>k. j \<noteq> k \<longrightarrow> (f\<^sup>t \<odot> mtop) (k, i) = bot)

goal (1 subgoal):
 1. \<exists>e. f e = top \<and> (\<forall>d. e \<noteq> d \<longrightarrow> f d = bot)
[PROOF STEP]
hence 2: "\<forall>i . (mtop \<odot> f) (i,j) = top \<and> (\<forall>k . j \<noteq> k \<longrightarrow> (mtop \<odot> f) (i,k) = bot)"
[PROOF STATE]
proof (prove)
using this:
\<forall>i. (f\<^sup>t \<odot> mtop) (j, i) = top \<and> (\<forall>k. j \<noteq> k \<longrightarrow> (f\<^sup>t \<odot> mtop) (k, i) = bot)

goal (1 subgoal):
 1. \<forall>i. (mtop \<odot> f) (i, j) = top \<and> (\<forall>k. j \<noteq> k \<longrightarrow> (mtop \<odot> f) (i, k) = bot)
[PROOF STEP]
by (metis (no_types) old.prod.case conv_matrix_def conv_def matrix_stone_relation_algebra.conv_dist_comp matrix_stone_relation_algebra.conv_top)
[PROOF STATE]
proof (state)
this:
\<forall>i. (mtop \<odot> f) (i, j) = top \<and> (\<forall>k. j \<noteq> k \<longrightarrow> (mtop \<odot> f) (i, k) = bot)

goal (1 subgoal):
 1. \<exists>e. f e = top \<and> (\<forall>d. e \<noteq> d \<longrightarrow> f d = bot)
[PROOF STEP]
have 3: "\<forall>i k . j \<noteq> k \<longrightarrow> f (i,k) = bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i k. j \<noteq> k \<longrightarrow> f (i, k) = bot
[PROOF STEP]
proof (intro allI, rule impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i k. j \<noteq> k \<Longrightarrow> f (i, k) = bot
[PROOF STEP]
fix i k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i k. j \<noteq> k \<Longrightarrow> f (i, k) = bot
[PROOF STEP]
assume "j \<noteq> k"
[PROOF STATE]
proof (state)
this:
j \<noteq> k

goal (1 subgoal):
 1. \<And>i k. j \<noteq> k \<Longrightarrow> f (i, k) = bot
[PROOF STEP]
hence "(\<Squnion>\<^sub>l f (l,k)) = bot"
[PROOF STATE]
proof (prove)
using this:
j \<noteq> k

goal (1 subgoal):
 1. sup_monoid.sum (\<lambda>l. f (l, k)) {l. True} = bot
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
j \<noteq> k
\<forall>i. (mtop \<odot> f) (i, j) = top \<and> (\<forall>k. j \<noteq> k \<longrightarrow> (mtop \<odot> f) (i, k) = bot)

goal (1 subgoal):
 1. sup_monoid.sum (\<lambda>l. f (l, k)) {l. True} = bot
[PROOF STEP]
by (simp add: top_comp_linorder_matrix)
[PROOF STATE]
proof (state)
this:
sup_monoid.sum (\<lambda>l. f (l, k)) {l. True} = bot

goal (1 subgoal):
 1. \<And>i k. j \<noteq> k \<Longrightarrow> f (i, k) = bot
[PROOF STEP]
thus "f (i,k) = bot"
[PROOF STATE]
proof (prove)
using this:
sup_monoid.sum (\<lambda>l. f (l, k)) {l. True} = bot

goal (1 subgoal):
 1. f (i, k) = bot
[PROOF STEP]
by (metis bot.extremum_uniqueI comp_inf.ub_sum)
[PROOF STATE]
proof (state)
this:
f (i, k) = bot

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>i k. j \<noteq> k \<longrightarrow> f (i, k) = bot

goal (1 subgoal):
 1. \<exists>e. f e = top \<and> (\<forall>d. e \<noteq> d \<longrightarrow> f d = bot)
[PROOF STEP]
have "(\<Squnion>\<^sub>k f (i,k)) = top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sup_monoid.sum (\<lambda>k. f (i, k)) {k. True} = top
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
\<forall>j. (f \<odot> mtop) (i, j) = top \<and> (\<forall>k. i \<noteq> k \<longrightarrow> (f \<odot> mtop) (k, j) = bot)

goal (1 subgoal):
 1. sup_monoid.sum (\<lambda>k. f (i, k)) {k. True} = top
[PROOF STEP]
by (simp add: comp_top_linorder_matrix)
[PROOF STATE]
proof (state)
this:
sup_monoid.sum (\<lambda>k. f (i, k)) {k. True} = top

goal (1 subgoal):
 1. \<exists>e. f e = top \<and> (\<forall>d. e \<noteq> d \<longrightarrow> f d = bot)
[PROOF STEP]
hence 4: "f (i,j) = top"
[PROOF STATE]
proof (prove)
using this:
sup_monoid.sum (\<lambda>k. f (i, k)) {k. True} = top

goal (1 subgoal):
 1. f (i, j) = top
[PROOF STEP]
using 3
[PROOF STATE]
proof (prove)
using this:
sup_monoid.sum (\<lambda>k. f (i, k)) {k. True} = top
\<forall>i k. j \<noteq> k \<longrightarrow> f (i, k) = bot

goal (1 subgoal):
 1. f (i, j) = top
[PROOF STEP]
by (metis bot_not_top linorder_finite_sup_selective)
[PROOF STATE]
proof (state)
this:
f (i, j) = top

goal (1 subgoal):
 1. \<exists>e. f e = top \<and> (\<forall>d. e \<noteq> d \<longrightarrow> f d = bot)
[PROOF STEP]
have "\<forall>k l . k \<noteq> i \<or> l \<noteq> j \<longrightarrow> f (k,l) = bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>k l. k \<noteq> i \<or> l \<noteq> j \<longrightarrow> f (k, l) = bot
[PROOF STEP]
proof (intro allI, unfold imp_disjL, rule conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>k l. k \<noteq> i \<longrightarrow> f (k, l) = bot
 2. \<And>k l. l \<noteq> j \<longrightarrow> f (k, l) = bot
[PROOF STEP]
fix k l
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>k l. k \<noteq> i \<longrightarrow> f (k, l) = bot
 2. \<And>k l. l \<noteq> j \<longrightarrow> f (k, l) = bot
[PROOF STEP]
show "k \<noteq> i \<longrightarrow> f (k,l) = bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<noteq> i \<longrightarrow> f (k, l) = bot
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. k \<noteq> i \<Longrightarrow> f (k, l) = bot
[PROOF STEP]
assume "k \<noteq> i"
[PROOF STATE]
proof (state)
this:
k \<noteq> i

goal (1 subgoal):
 1. k \<noteq> i \<Longrightarrow> f (k, l) = bot
[PROOF STEP]
hence "(\<Squnion>\<^sub>m f (k,m)) = bot"
[PROOF STATE]
proof (prove)
using this:
k \<noteq> i

goal (1 subgoal):
 1. sup_monoid.sum (\<lambda>m. f (k, m)) {m. True} = bot
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
k \<noteq> i
\<forall>j. (f \<odot> mtop) (i, j) = top \<and> (\<forall>k. i \<noteq> k \<longrightarrow> (f \<odot> mtop) (k, j) = bot)

goal (1 subgoal):
 1. sup_monoid.sum (\<lambda>m. f (k, m)) {m. True} = bot
[PROOF STEP]
by (simp add: comp_top_linorder_matrix)
[PROOF STATE]
proof (state)
this:
sup_monoid.sum (\<lambda>m. f (k, m)) {m. True} = bot

goal (1 subgoal):
 1. k \<noteq> i \<Longrightarrow> f (k, l) = bot
[PROOF STEP]
thus "f (k,l) = bot"
[PROOF STATE]
proof (prove)
using this:
sup_monoid.sum (\<lambda>m. f (k, m)) {m. True} = bot

goal (1 subgoal):
 1. f (k, l) = bot
[PROOF STEP]
by (metis bot.extremum_uniqueI comp_inf.ub_sum)
[PROOF STATE]
proof (state)
this:
f (k, l) = bot

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
k \<noteq> i \<longrightarrow> f (k, l) = bot

goal (1 subgoal):
 1. \<And>k l. l \<noteq> j \<longrightarrow> f (k, l) = bot
[PROOF STEP]
show "l \<noteq> j \<longrightarrow> f (k,l) = bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l \<noteq> j \<longrightarrow> f (k, l) = bot
[PROOF STEP]
using 3
[PROOF STATE]
proof (prove)
using this:
\<forall>i k. j \<noteq> k \<longrightarrow> f (i, k) = bot

goal (1 subgoal):
 1. l \<noteq> j \<longrightarrow> f (k, l) = bot
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
l \<noteq> j \<longrightarrow> f (k, l) = bot

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>k l. k \<noteq> i \<or> l \<noteq> j \<longrightarrow> f (k, l) = bot

goal (1 subgoal):
 1. \<exists>e. f e = top \<and> (\<forall>d. e \<noteq> d \<longrightarrow> f d = bot)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>k l. k \<noteq> i \<or> l \<noteq> j \<longrightarrow> f (k, l) = bot

goal (1 subgoal):
 1. \<exists>e. f e = top \<and> (\<forall>d. e \<noteq> d \<longrightarrow> f d = bot)
[PROOF STEP]
using 4
[PROOF STATE]
proof (prove)
using this:
\<forall>k l. k \<noteq> i \<or> l \<noteq> j \<longrightarrow> f (k, l) = bot
f (i, j) = top

goal (1 subgoal):
 1. \<exists>e. f e = top \<and> (\<forall>d. e \<noteq> d \<longrightarrow> f d = bot)
[PROOF STEP]
by (metis old.prod.exhaust)
[PROOF STATE]
proof (state)
this:
\<exists>e. f e = top \<and> (\<forall>d. e \<noteq> d \<longrightarrow> f d = bot)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma stc_inverse:
  "\<lbrakk>x \<in> HFinite; stc x \<noteq> 0\<rbrakk>  \<Longrightarrow> stc(inverse x) = inverse (stc x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> HFinite; stc x \<noteq> 0\<rbrakk> \<Longrightarrow> stc (inverse x) = inverse (stc x)
[PROOF STEP]
by (simp add: stc_unique stc_SComplex stc_approx_self approx_inverse stc_not_Infinitesimal)


[STATEMENT]
lemma monotone_Pair:
  "\<lbrakk> monotone ord orda f; monotone ord ordb g \<rbrakk>
  \<Longrightarrow> monotone ord (rel_prod orda ordb) (\<lambda>x. (f x, g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>monotone ord orda f; monotone ord ordb g\<rbrakk> \<Longrightarrow> monotone ord (rel_prod orda ordb) (\<lambda>x. (f x, g x))
[PROOF STEP]
by(simp add: monotone_def)


[STATEMENT]
lemma size_diff_se: "\<lbrakk>t \<in># S\<rbrakk> \<Longrightarrow> size S = size (S - {#t#}) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> size S = size (S - {#t#}) + 1
[PROOF STEP]
proof (unfold size_multiset_overloaded_eq)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
let ?SIZE = "sum (count S) (set_mset S)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
assume A: "t \<in># S"
[PROOF STATE]
proof (state)
this:
t \<in># S

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
t \<in># S
[PROOF STEP]
have SPLITPRE: "finite (set_mset S) & {t}\<subseteq>(set_mset S)"
[PROOF STATE]
proof (prove)
using this:
t \<in># S

goal (1 subgoal):
 1. finite (set_mset S) \<and> {t} \<subseteq> set_mset S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (set_mset S) \<and> {t} \<subseteq> set_mset S

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
hence "?SIZE = sum (count S) (set_mset S - {t}) + sum (count S) {t}"
[PROOF STATE]
proof (prove)
using this:
finite (set_mset S) \<and> {t} \<subseteq> set_mset S

goal (1 subgoal):
 1. sum (count S) (set_mset S) = sum (count S) (set_mset S - {t}) + sum (count S) {t}
[PROOF STEP]
by (blast dest: sum.subset_diff)
[PROOF STATE]
proof (state)
this:
sum (count S) (set_mset S) = sum (count S) (set_mset S - {t}) + sum (count S) {t}

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
hence "?SIZE = sum (count S) (set_mset S - {t}) + count (S) t"
[PROOF STATE]
proof (prove)
using this:
sum (count S) (set_mset S) = sum (count S) (set_mset S - {t}) + sum (count S) {t}

goal (1 subgoal):
 1. sum (count S) (set_mset S) = sum (count S) (set_mset S - {t}) + count S t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum (count S) (set_mset S) = sum (count S) (set_mset S - {t}) + count S t

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sum (count S) (set_mset S) = sum (count S) (set_mset S - {t}) + count S t

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
t \<in># S
sum (count S) (set_mset S) = sum (count S) (set_mset S - {t}) + count S t
[PROOF STEP]
have "count S t = count (S-{#t#}) t + 1"
[PROOF STATE]
proof (prove)
using this:
t \<in># S
sum (count S) (set_mset S) = sum (count S) (set_mset S - {t}) + count S t

goal (1 subgoal):
 1. count S t = count (S - {#t#}) t + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
count S t = count (S - {#t#}) t + 1

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
sum (count S) (set_mset S) = sum (count S) (set_mset S - {t}) + count S t
count S t = count (S - {#t#}) t + 1
[PROOF STEP]
have D: "?SIZE = sum (count S) (set_mset S - {t}) + count (S-{#t#}) t + 1"
[PROOF STATE]
proof (prove)
using this:
sum (count S) (set_mset S) = sum (count S) (set_mset S - {t}) + count S t
count S t = count (S - {#t#}) t + 1

goal (1 subgoal):
 1. sum (count S) (set_mset S) = sum (count S) (set_mset S - {t}) + count (S - {#t#}) t + 1
[PROOF STEP]
by (arith)
[PROOF STATE]
proof (state)
this:
sum (count S) (set_mset S) = sum (count S) (set_mset S - {t}) + count (S - {#t#}) t + 1

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sum (count S) (set_mset S) = sum (count S) (set_mset S - {t}) + count (S - {#t#}) t + 1

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
have "sum (count S) (set_mset S - {t}) = sum (count (S-{#t#})) (set_mset S - {t})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (count S) (set_mset S - {t}) = sum (count (S - {#t#})) (set_mset S - {t})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum (count S) (set_mset S - {t}) = sum (count (S - {#t#})) (set_mset S - {t})
[PROOF STEP]
have "ALL x:(set_mset S - {t}) . count S x = count (S-{#t#}) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set_mset S - {t}. count S x = count (S - {#t#}) x
[PROOF STEP]
by (auto iff add: count_ne_remove)
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set_mset S - {t}. count S x = count (S - {#t#}) x

goal (1 subgoal):
 1. sum (count S) (set_mset S - {t}) = sum (count (S - {#t#})) (set_mset S - {t})
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set_mset S - {t}. count S x = count (S - {#t#}) x

goal (1 subgoal):
 1. sum (count S) (set_mset S - {t}) = sum (count (S - {#t#})) (set_mset S - {t})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum (count S) (set_mset S - {t}) = sum (count (S - {#t#})) (set_mset S - {t})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sum (count S) (set_mset S - {t}) = sum (count (S - {#t#})) (set_mset S - {t})

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
sum (count S) (set_mset S) = sum (count S) (set_mset S - {t}) + count (S - {#t#}) t + 1
sum (count S) (set_mset S - {t}) = sum (count (S - {#t#})) (set_mset S - {t})
[PROOF STEP]
have D: "?SIZE = sum (count (S-{#t#})) (set_mset S - {t}) + count (S-{#t#}) t + 1"
[PROOF STATE]
proof (prove)
using this:
sum (count S) (set_mset S) = sum (count S) (set_mset S - {t}) + count (S - {#t#}) t + 1
sum (count S) (set_mset S - {t}) = sum (count (S - {#t#})) (set_mset S - {t})

goal (1 subgoal):
 1. sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset S - {t}) + count (S - {#t#}) t + 1
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset S - {t}) + count (S - {#t#}) t + 1

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset S - {t}) + count (S - {#t#}) t + 1

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset S - {t}) + count (S - {#t#}) t + 1

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
assume CASE: "t \<notin># S - {#t#}"
[PROOF STATE]
proof (state)
this:
t \<notin># S - {#t#}

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
from CASE
[PROOF STATE]
proof (chain)
picking this:
t \<notin># S - {#t#}
[PROOF STEP]
have "set_mset S - {t} = set_mset (S - {#t#})"
[PROOF STATE]
proof (prove)
using this:
t \<notin># S - {#t#}

goal (1 subgoal):
 1. set_mset S - {t} = set_mset (S - {#t#})
[PROOF STEP]
by (simp add: at_most_one_mset_mset_diff)
[PROOF STATE]
proof (state)
this:
set_mset S - {t} = set_mset (S - {#t#})

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
with CASE D
[PROOF STATE]
proof (chain)
picking this:
t \<notin># S - {#t#}
sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset S - {t}) + count (S - {#t#}) t + 1
set_mset S - {t} = set_mset (S - {#t#})
[PROOF STEP]
have "?SIZE = sum (count (S-{#t#})) (set_mset (S - {#t#})) + 1"
[PROOF STATE]
proof (prove)
using this:
t \<notin># S - {#t#}
sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset S - {t}) + count (S - {#t#}) t + 1
set_mset S - {t} = set_mset (S - {#t#})

goal (1 subgoal):
 1. sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
by (simp add: not_in_iff)
[PROOF STATE]
proof (state)
this:
sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
t \<notin># S - {#t#} \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
t \<notin># S - {#t#} \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
t \<notin># S - {#t#} \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
assume CASE: "t \<in># S - {#t#}"
[PROOF STATE]
proof (state)
this:
t \<in># S - {#t#}

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
from CASE
[PROOF STATE]
proof (chain)
picking this:
t \<in># S - {#t#}
[PROOF STEP]
have 1: "set_mset S = set_mset (S-{#t#})"
[PROOF STATE]
proof (prove)
using this:
t \<in># S - {#t#}

goal (1 subgoal):
 1. set_mset S = set_mset (S - {#t#})
[PROOF STEP]
by (rule more_than_one_mset_mset_diff [symmetric])
[PROOF STATE]
proof (state)
this:
set_mset S = set_mset (S - {#t#})

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set_mset S = set_mset (S - {#t#})

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
from D
[PROOF STATE]
proof (chain)
picking this:
sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset S - {t}) + count (S - {#t#}) t + 1
[PROOF STEP]
have "?SIZE = sum (count (S-{#t#})) (set_mset S - {t}) + sum (count (S-{#t#})) {t} + 1"
[PROOF STATE]
proof (prove)
using this:
sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset S - {t}) + count (S - {#t#}) t + 1

goal (1 subgoal):
 1. sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset S - {t}) + sum (count (S - {#t#})) {t} + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset S - {t}) + sum (count (S - {#t#})) {t} + 1

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset S - {t}) + sum (count (S - {#t#})) {t} + 1

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
from SPLITPRE sum.subset_diff
[PROOF STATE]
proof (chain)
picking this:
finite (set_mset S) \<and> {t} \<subseteq> set_mset S
\<lbrakk>?B \<subseteq> ?A; finite ?A\<rbrakk> \<Longrightarrow> sum ?g ?A = sum ?g (?A - ?B) + sum ?g ?B
[PROOF STEP]
have "sum (count (S-{#t#})) (set_mset S) = sum (count (S-{#t#})) (set_mset S - {t}) + sum (count (S-{#t#})) {t}"
[PROOF STATE]
proof (prove)
using this:
finite (set_mset S) \<and> {t} \<subseteq> set_mset S
\<lbrakk>?B \<subseteq> ?A; finite ?A\<rbrakk> \<Longrightarrow> sum ?g ?A = sum ?g (?A - ?B) + sum ?g ?B

goal (1 subgoal):
 1. sum (count (S - {#t#})) (set_mset S) = sum (count (S - {#t#})) (set_mset S - {t}) + sum (count (S - {#t#})) {t}
[PROOF STEP]
by (blast)
[PROOF STATE]
proof (state)
this:
sum (count (S - {#t#})) (set_mset S) = sum (count (S - {#t#})) (set_mset S - {t}) + sum (count (S - {#t#})) {t}

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set_mset S = set_mset (S - {#t#})
sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset S - {t}) + sum (count (S - {#t#})) {t} + 1
sum (count (S - {#t#})) (set_mset S) = sum (count (S - {#t#})) (set_mset S - {t}) + sum (count (S - {#t#})) {t}
[PROOF STEP]
have "?SIZE = sum (count (S-{#t#})) (set_mset (S-{#t#})) + 1"
[PROOF STATE]
proof (prove)
using this:
set_mset S = set_mset (S - {#t#})
sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset S - {t}) + sum (count (S - {#t#})) {t} + 1
sum (count (S - {#t#})) (set_mset S) = sum (count (S - {#t#})) (set_mset S - {t}) + sum (count (S - {#t#})) {t}

goal (1 subgoal):
 1. sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
t \<in># S - {#t#} \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1

goal (1 subgoal):
 1. t \<in># S \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset S - {t}) + count (S - {#t#}) t + 1
t \<notin># S - {#t#} \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
t \<in># S - {#t#} \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
show "?SIZE = sum (count (S-{#t#})) (set_mset (S - {#t#})) + 1"
[PROOF STATE]
proof (prove)
using this:
sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset S - {t}) + count (S - {#t#}) t + 1
t \<notin># S - {#t#} \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
t \<in># S - {#t#} \<Longrightarrow> sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1

goal (1 subgoal):
 1. sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
sum (count S) (set_mset S) = sum (count (S - {#t#})) (set_mset (S - {#t#})) + 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma low_inv: assumes "x< 2^n " shows "low (y*2^n + x) n = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. low (y * 2 ^ n + x) n = x
[PROOF STEP]
unfolding low_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y * 2 ^ n + x) mod 2 ^ n = x
[PROOF STEP]
by (simp add: assms)


[STATEMENT]
lemma deriv_chain:
  "f field_differentiable at x \<Longrightarrow> g field_differentiable at (f x)
    \<Longrightarrow> deriv (g o f) x = deriv g (f x) * deriv f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f field_differentiable at x; g field_differentiable at (f x)\<rbrakk> \<Longrightarrow> deriv (g \<circ> f) x = deriv g (f x) * deriv f x
[PROOF STEP]
by (metis DERIV_deriv_iff_field_differentiable DERIV_chain DERIV_imp_deriv)


[STATEMENT]
lemma project_at_indices_consecutive_indices:
  assumes "(i::nat) < j"
  assumes "j \<le> n"
  assumes "length a = n"
  assumes "k < j - i"
  shows "(project_at_indices {i..<j} a) ! k = a! (i + k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nths a {i..<j} ! k = a ! (i + k)
[PROOF STEP]
using assms nth_elem_consecutive_indices[of i j k]
[PROOF STATE]
proof (prove)
using this:
i < j
j \<le> n
length a = n
k < j - i
\<lbrakk>i < j; k < j - i\<rbrakk> \<Longrightarrow> nth_elem {i..<j} k = i + k

goal (1 subgoal):
 1. nths a {i..<j} ! k = a ! (i + k)
[PROOF STEP]
by (metis atLeast0LessThan card_atLeastLessThan indices_of_def ivl_subset linorder_le_less_linear not_less0 project_at_indices_nth)


[STATEMENT]
lemma face_of_subset_rel_frontier:
    fixes S :: "'a::real_normed_vector set"
    assumes "T face_of S" "T \<noteq> S"
      shows "T \<subseteq> rel_frontier S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T \<subseteq> rel_frontier S
[PROOF STEP]
using assms closure_subset face_of_disjoint_rel_interior face_of_imp_subset rel_frontier_def
[PROOF STATE]
proof (prove)
using this:
T face_of S
T \<noteq> S
?S \<subseteq> closure ?S
\<lbrakk>?T face_of ?S; ?T \<noteq> ?S\<rbrakk> \<Longrightarrow> ?T \<inter> rel_interior ?S = {}
?T face_of ?S \<Longrightarrow> ?T \<subseteq> ?S
rel_frontier ?S = closure ?S - rel_interior ?S

goal (1 subgoal):
 1. T \<subseteq> rel_frontier S
[PROOF STEP]
by fastforce


[STATEMENT]
lemma summable_complex_iff: "summable f \<longleftrightarrow> summable (\<lambda>x. Re (f x)) \<and>  summable (\<lambda>x. Im (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f = (summable (\<lambda>x. Re (f x)) \<and> summable (\<lambda>x. Im (f x)))
[PROOF STEP]
unfolding summable_def sums_complex_iff[abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. (\<lambda>x. Re (f x)) sums Re x \<and> (\<lambda>x. Im (f x)) sums Im x) = (Ex ((sums) (\<lambda>x. Re (f x))) \<and> Ex ((sums) (\<lambda>x. Im (f x))))
[PROOF STEP]
by (metis complex.sel)


[STATEMENT]
theorem strictly_solvent_still_strictly_solvent_after_valid_transfer:
  assumes "valid_transfer (\<L> a) \<tau>"
  and "strictly_solvent (\<L> b)"
  shows
    "strictly_solvent ((transfer \<L> \<tau> a b) a)"
    "strictly_solvent ((transfer \<L> \<tau> a b) b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. strictly_solvent (transfer \<L> \<tau> a b a) &&& strictly_solvent (transfer \<L> \<tau> a b b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
valid_transfer (\<L> a) \<tau>
strictly_solvent (\<L> b)

goal (1 subgoal):
 1. strictly_solvent (transfer \<L> \<tau> a b a) &&& strictly_solvent (transfer \<L> \<tau> a b b)
[PROOF STEP]
unfolding
    strictly_solvent_alt_def
    valid_transfer_alt_def
    transfer_def
[PROOF STATE]
proof (prove)
using this:
0 \<le> \<tau> \<and> \<tau> \<le> \<L> a
0 \<le> \<L> b

goal (1 subgoal):
 1. 0 \<le> (if a = b then \<L> a else if a = a then \<L> a - \<tau> else if a = b then \<L> b + \<tau> else \<L> a) &&& 0 \<le> (if a = b then \<L> b else if b = a then \<L> a - \<tau> else if b = b then \<L> b + \<tau> else \<L> b)
[PROOF STEP]
by (cases "a = b", auto)


[STATEMENT]
lemma LBINT_I0i_exp_mscale: "0 < (u::real) \<Longrightarrow> LBINT x=0..\<infinity>. exp (-(x * u)) = 1 / u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < u \<Longrightarrow> LBINT x=0..\<infinity>. exp (- (x * u)) = 1 / u
[PROOF STEP]
using lborel_integral_real_affine[of u "\<lambda>x. indicator {0<..} x *\<^sub>R exp (- x)" 0]
        has_bochner_integral_I0i_power_exp_m[of 0]
[PROOF STATE]
proof (prove)
using this:
u \<noteq> 0 \<Longrightarrow> LBINT x. indicat_real {0<..} x *\<^sub>R exp (- x) = \<bar>u\<bar> *\<^sub>R (LBINT x. indicat_real {0<..} (0 + u * x) *\<^sub>R exp (- (0 + u * x)))
has_bochner_integral lborel (\<lambda>x. x ^ 0 * exp (- x) * indicat_real {0<..} x) (fact 0)

goal (1 subgoal):
 1. 0 < u \<Longrightarrow> LBINT x=0..\<infinity>. exp (- (x * u)) = 1 / u
[PROOF STEP]
by (auto simp: indicator_def zero_less_mult_iff interval_lebesgue_integral_0_infty set_lebesgue_integral_def field_simps
           dest!: has_bochner_integral_integral_eq)


[STATEMENT]
lemma cauchy_minus [simp]:
  assumes X: "cauchy X"
  shows "cauchy (\<lambda>n. - X n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cauchy (\<lambda>n. - X n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
cauchy X

goal (1 subgoal):
 1. cauchy (\<lambda>n. - X n)
[PROOF STEP]
unfolding cauchy_def
[PROOF STATE]
proof (prove)
using this:
\<forall>r>0. \<exists>k. \<forall>m\<ge>k. \<forall>n\<ge>k. \<bar>X m - X n\<bar> < r

goal (1 subgoal):
 1. \<forall>r>0. \<exists>k. \<forall>m\<ge>k. \<forall>n\<ge>k. \<bar>- X m - - X n\<bar> < r
[PROOF STEP]
unfolding minus_diff_minus abs_minus_cancel
[PROOF STATE]
proof (prove)
using this:
\<forall>r>0. \<exists>k. \<forall>m\<ge>k. \<forall>n\<ge>k. \<bar>X m - X n\<bar> < r

goal (1 subgoal):
 1. \<forall>r>0. \<exists>k. \<forall>m\<ge>k. \<forall>n\<ge>k. \<bar>X m - X n\<bar> < r
[PROOF STEP]
.


[STATEMENT]
lemma sorted_list_len_lt: "x \<subset> y \<Longrightarrow> finite y \<Longrightarrow> length (sorted_list_of_set x) < length (sorted_list_of_set y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<subset> y; finite y\<rbrakk> \<Longrightarrow> length (sorted_list_of_set x) < length (sorted_list_of_set y)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>x \<subset> y; finite y\<rbrakk> \<Longrightarrow> length (sorted_list_of_set x) < length (sorted_list_of_set y)
[PROOF STEP]
let ?x = "sorted_list_of_set x"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>x \<subset> y; finite y\<rbrakk> \<Longrightarrow> length (sorted_list_of_set x) < length (sorted_list_of_set y)
[PROOF STEP]
let ?y = "sorted_list_of_set y"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>x \<subset> y; finite y\<rbrakk> \<Longrightarrow> length (sorted_list_of_set x) < length (sorted_list_of_set y)
[PROOF STEP]
assume x_y: "x \<subset> y" and fin_y: "finite y"
[PROOF STATE]
proof (state)
this:
x \<subset> y
finite y

goal (1 subgoal):
 1. \<lbrakk>x \<subset> y; finite y\<rbrakk> \<Longrightarrow> length (sorted_list_of_set x) < length (sorted_list_of_set y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<subset> y
finite y
[PROOF STEP]
have card_x_y: "card x < card y" and fin_x: "finite x"
[PROOF STATE]
proof (prove)
using this:
x \<subset> y
finite y

goal (1 subgoal):
 1. card x < card y &&& finite x
[PROOF STEP]
by (auto simp add:psubset_card_mono finite_subset)
[PROOF STATE]
proof (state)
this:
card x < card y
finite x

goal (1 subgoal):
 1. \<lbrakk>x \<subset> y; finite y\<rbrakk> \<Longrightarrow> length (sorted_list_of_set x) < length (sorted_list_of_set y)
[PROOF STEP]
with fin_y
[PROOF STATE]
proof (chain)
picking this:
finite y
card x < card y
finite x
[PROOF STEP]
have "length ?x = card x" and "length ?y = card y"
[PROOF STATE]
proof (prove)
using this:
finite y
card x < card y
finite x

goal (1 subgoal):
 1. length (sorted_list_of_set x) = card x &&& length (sorted_list_of_set y) = card y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (sorted_list_of_set x) = card x
length (sorted_list_of_set y) = card y

goal (1 subgoal):
 1. \<lbrakk>x \<subset> y; finite y\<rbrakk> \<Longrightarrow> length (sorted_list_of_set x) < length (sorted_list_of_set y)
[PROOF STEP]
with card_x_y
[PROOF STATE]
proof (chain)
picking this:
card x < card y
length (sorted_list_of_set x) = card x
length (sorted_list_of_set y) = card y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card x < card y
length (sorted_list_of_set x) = card x
length (sorted_list_of_set y) = card y

goal (1 subgoal):
 1. length (sorted_list_of_set x) < length (sorted_list_of_set y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (sorted_list_of_set x) < length (sorted_list_of_set y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_scene_space: "finite scene_space"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite scene_space
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite scene_space
[PROOF STEP]
have "scene_space = {\<Squnion>\<^sub>S xs | xs. distinct xs \<and> set xs \<subseteq> set Vars}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. scene_space = {\<Squnion>\<^sub>S xs |xs. distinct xs \<and> set xs \<subseteq> set Vars}
[PROOF STEP]
by (simp add: scene_space_as_lists)
[PROOF STATE]
proof (state)
this:
scene_space = {\<Squnion>\<^sub>S xs |xs. distinct xs \<and> set xs \<subseteq> set Vars}

goal (1 subgoal):
 1. finite scene_space
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
scene_space = {\<Squnion>\<^sub>S xs |xs. distinct xs \<and> set xs \<subseteq> set Vars}

goal (1 subgoal):
 1. finite scene_space
[PROOF STEP]
have "... = \<Squnion>\<^sub>S ` {xs. distinct xs \<and> set xs \<subseteq> set Vars}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {\<Squnion>\<^sub>S xs |xs. distinct xs \<and> set xs \<subseteq> set Vars} = \<Squnion>\<^sub>S ` {xs. distinct xs \<and> set xs \<subseteq> set Vars}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{\<Squnion>\<^sub>S xs |xs. distinct xs \<and> set xs \<subseteq> set Vars} = \<Squnion>\<^sub>S ` {xs. distinct xs \<and> set xs \<subseteq> set Vars}

goal (1 subgoal):
 1. finite scene_space
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{\<Squnion>\<^sub>S xs |xs. distinct xs \<and> set xs \<subseteq> set Vars} = \<Squnion>\<^sub>S ` {xs. distinct xs \<and> set xs \<subseteq> set Vars}

goal (1 subgoal):
 1. finite scene_space
[PROOF STEP]
have "finite ..."
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (\<Squnion>\<^sub>S ` {xs. distinct xs \<and> set xs \<subseteq> set Vars})
[PROOF STEP]
by (rule finite_imageI, simp add: finite_distinct_lists_subset)
[PROOF STATE]
proof (state)
this:
finite (\<Squnion>\<^sub>S ` {xs. distinct xs \<and> set xs \<subseteq> set Vars})

goal (1 subgoal):
 1. finite scene_space
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
finite scene_space
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite scene_space

goal (1 subgoal):
 1. finite scene_space
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
finite scene_space

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma imperative_reverse_time: "VARS y x t
 {x=X & t=0}
 y:=[]; t := t+1;
 WHILE x ~= []
 INV {rev(x)@y = rev(X) & t = 2*(length y) + 1}
 DO y := (hd x # y); t := t+1; x := tl x; t := t+1 OD
 {y=rev(X) & t = 2*length X + 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x = X \<and> t = 0}
y := []; t := t + 1; WHILE x \<noteq> [] INV {rev x @ y = rev X \<and> t = 2 * length y + 1}  VAR {0}
DO y := hd x # y; t := t + 1; x := tl x; t := t + 1 OD
{y = rev X \<and> t = 2 * length X + 1}
[PROOF STEP]
apply vcg_simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y x. rev x @ y = rev X \<and> x \<noteq> [] \<Longrightarrow> rev (tl x) @ hd x # y = rev X
[PROOF STEP]
apply(simp add: neq_Nil_conv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y x. rev x @ y = rev X \<and> (\<exists>y ys. x = y # ys) \<Longrightarrow> rev (tl x) @ hd x # y = rev X
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma partition_code [code]:
  "partition cmp pivot [] = ([], [], [])"
  "partition cmp pivot (x # xs) =
    (let (lts, eqs, gts) = partition cmp pivot xs
     in case compare cmp x pivot of
       Less \<Rightarrow> (x # lts, eqs, gts)
     | Equiv \<Rightarrow> (lts, x # eqs, gts)
     | Greater \<Rightarrow> (lts, eqs, x # gts))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.partition cmp pivot [] = ([], [], []) &&& local.partition cmp pivot (x # xs) = (let (lts, eqs, gts) = local.partition cmp pivot xs in case compare cmp x pivot of Less \<Rightarrow> (x # lts, eqs, gts) | Equiv \<Rightarrow> (lts, x # eqs, gts) | Greater \<Rightarrow> (lts, eqs, x # gts))
[PROOF STEP]
using comp.exhaust
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?y = Less \<Longrightarrow> ?P; ?y = Equiv \<Longrightarrow> ?P; ?y = Greater \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P

goal (1 subgoal):
 1. local.partition cmp pivot [] = ([], [], []) &&& local.partition cmp pivot (x # xs) = (let (lts, eqs, gts) = local.partition cmp pivot xs in case compare cmp x pivot of Less \<Rightarrow> (x # lts, eqs, gts) | Equiv \<Rightarrow> (lts, x # eqs, gts) | Greater \<Rightarrow> (lts, eqs, x # gts))
[PROOF STEP]
by (auto simp add: partition_def Let_def compare.sym [of _ pivot])


[STATEMENT]
lemma dim_mono: assumes "V \<subseteq> span W" shows "dim V \<le> dim W"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim V \<le> dim W
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dim V \<le> dim W
[PROOF STEP]
obtain B where "independent B" "B \<subseteq> W" "W \<subseteq> span B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B. \<lbrakk>independent B; B \<subseteq> W; W \<subseteq> span B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using maximal_independent_subset[of W]
[PROOF STATE]
proof (prove)
using this:
(\<And>B. \<lbrakk>B \<subseteq> W; independent B; W \<subseteq> span B\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>independent B; B \<subseteq> W; W \<subseteq> span B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
independent B
B \<subseteq> W
W \<subseteq> span B

goal (1 subgoal):
 1. dim V \<le> dim W
[PROOF STEP]
with dim_le_card[of V B] assms independent_span_bound[of Basis B] basis_card_eq_dim[of B W]
    span_mono[of B W] span_minimal[OF _ subspace_span, of W B]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>V \<subseteq> span B; finite B\<rbrakk> \<Longrightarrow> dim V \<le> card B
V \<subseteq> span W
\<lbrakk>finite Basis; independent B; B \<subseteq> span Basis\<rbrakk> \<Longrightarrow> finite B \<and> card B \<le> card Basis
\<lbrakk>B \<subseteq> W; W \<subseteq> span B; independent B\<rbrakk> \<Longrightarrow> card B = dim W
B \<subseteq> W \<Longrightarrow> span B \<subseteq> span W
W \<subseteq> span B \<Longrightarrow> span W \<subseteq> span B
independent B
B \<subseteq> W
W \<subseteq> span B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>V \<subseteq> span B; finite B\<rbrakk> \<Longrightarrow> dim V \<le> card B
V \<subseteq> span W
\<lbrakk>finite Basis; independent B; B \<subseteq> span Basis\<rbrakk> \<Longrightarrow> finite B \<and> card B \<le> card Basis
\<lbrakk>B \<subseteq> W; W \<subseteq> span B; independent B\<rbrakk> \<Longrightarrow> card B = dim W
B \<subseteq> W \<Longrightarrow> span B \<subseteq> span W
W \<subseteq> span B \<Longrightarrow> span W \<subseteq> span B
independent B
B \<subseteq> W
W \<subseteq> span B

goal (1 subgoal):
 1. dim V \<le> dim W
[PROOF STEP]
by (auto simp: finite_Basis span_Basis)
[PROOF STATE]
proof (state)
this:
dim V \<le> dim W

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cos_eq_periodic_intro:
  assumes "x - y=2*(of_int k)*pi \<or> x + y = 2*(of_int k)*pi"
  shows "cos x = cos y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos x = cos y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x - y = 2 * real_of_int k * pi \<or> x + y = 2 * real_of_int k * pi

goal (1 subgoal):
 1. cos x = cos y
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x - y = 2 * real_of_int k * pi \<Longrightarrow> cos x = cos y
 2. x + y = 2 * real_of_int k * pi \<Longrightarrow> cos x = cos y
[PROOF STEP]
assume "x - y = 2 * (of_int k) * pi "
[PROOF STATE]
proof (state)
this:
x - y = 2 * real_of_int k * pi

goal (2 subgoals):
 1. x - y = 2 * real_of_int k * pi \<Longrightarrow> cos x = cos y
 2. x + y = 2 * real_of_int k * pi \<Longrightarrow> cos x = cos y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x - y = 2 * real_of_int k * pi
[PROOF STEP]
have "cos x = cos (y + (of_int k)*(2*pi))"
[PROOF STATE]
proof (prove)
using this:
x - y = 2 * real_of_int k * pi

goal (1 subgoal):
 1. cos x = cos (y + real_of_int k * (2 * pi))
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
cos x = cos (y + real_of_int k * (2 * pi))

goal (2 subgoals):
 1. x - y = 2 * real_of_int k * pi \<Longrightarrow> cos x = cos y
 2. x + y = 2 * real_of_int k * pi \<Longrightarrow> cos x = cos y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cos x = cos (y + real_of_int k * (2 * pi))

goal (2 subgoals):
 1. x - y = 2 * real_of_int k * pi \<Longrightarrow> cos x = cos y
 2. x + y = 2 * real_of_int k * pi \<Longrightarrow> cos x = cos y
[PROOF STEP]
have "... = cos y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (y + real_of_int k * (2 * pi)) = cos y
[PROOF STEP]
using cos.periodic_simps[of "y"]
[PROOF STATE]
proof (prove)
using this:
cos (y + real ?na * (2 * of_real pi)) = cos y
cos (y - real ?na * (2 * of_real pi)) = cos y
cos (y + real_of_int ?n * (2 * of_real pi)) = cos y
cos (y - real_of_int ?n * (2 * of_real pi)) = cos y
cos (y + numeral ?nb * (2 * of_real pi)) = cos y
cos (y - numeral ?nb * (2 * of_real pi)) = cos y
cos (y + 2 * of_real pi) = cos y
cos (y - 2 * of_real pi) = cos y

goal (1 subgoal):
 1. cos (y + real_of_int k * (2 * pi)) = cos y
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
cos (y + real_of_int k * (2 * pi)) = cos y

goal (2 subgoals):
 1. x - y = 2 * real_of_int k * pi \<Longrightarrow> cos x = cos y
 2. x + y = 2 * real_of_int k * pi \<Longrightarrow> cos x = cos y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cos x = cos y
[PROOF STEP]
show "cos x = cos y"
[PROOF STATE]
proof (prove)
using this:
cos x = cos y

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

goal (1 subgoal):
 1. x + y = 2 * real_of_int k * pi \<Longrightarrow> cos x = cos y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x + y = 2 * real_of_int k * pi \<Longrightarrow> cos x = cos y
[PROOF STEP]
assume "x + y = 2 * of_int k * pi"
[PROOF STATE]
proof (state)
this:
x + y = 2 * real_of_int k * pi

goal (1 subgoal):
 1. x + y = 2 * real_of_int k * pi \<Longrightarrow> cos x = cos y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x + y = 2 * real_of_int k * pi
[PROOF STEP]
have "cos x = cos (- y + (of_int k)*(2*pi))"
[PROOF STATE]
proof (prove)
using this:
x + y = 2 * real_of_int k * pi

goal (1 subgoal):
 1. cos x = cos (- y + real_of_int k * (2 * pi))
[PROOF STEP]
apply (intro arg_cong[where f=cos])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + y = 2 * real_of_int k * pi \<Longrightarrow> x = - y + real_of_int k * (2 * pi)
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
cos x = cos (- y + real_of_int k * (2 * pi))

goal (1 subgoal):
 1. x + y = 2 * real_of_int k * pi \<Longrightarrow> cos x = cos y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cos x = cos (- y + real_of_int k * (2 * pi))

goal (1 subgoal):
 1. x + y = 2 * real_of_int k * pi \<Longrightarrow> cos x = cos y
[PROOF STEP]
have "... = cos (- y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (- y + real_of_int k * (2 * pi)) = cos (- y)
[PROOF STEP]
using cos.periodic_simps[of "-y"]
[PROOF STATE]
proof (prove)
using this:
cos (- y + real ?na * (2 * of_real pi)) = cos (- y)
cos (- y - real ?na * (2 * of_real pi)) = cos (- y)
cos (- y + real_of_int ?n * (2 * of_real pi)) = cos (- y)
cos (- y - real_of_int ?n * (2 * of_real pi)) = cos (- y)
cos (- y + numeral ?nb * (2 * of_real pi)) = cos (- y)
cos (- y - numeral ?nb * (2 * of_real pi)) = cos (- y)
cos (- y + 2 * of_real pi) = cos (- y)
cos (- y - 2 * of_real pi) = cos (- y)

goal (1 subgoal):
 1. cos (- y + real_of_int k * (2 * pi)) = cos (- y)
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
cos (- y + real_of_int k * (2 * pi)) = cos (- y)

goal (1 subgoal):
 1. x + y = 2 * real_of_int k * pi \<Longrightarrow> cos x = cos y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cos (- y + real_of_int k * (2 * pi)) = cos (- y)

goal (1 subgoal):
 1. x + y = 2 * real_of_int k * pi \<Longrightarrow> cos x = cos y
[PROOF STEP]
have "... = cos y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (- y) = cos y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cos (- y) = cos y

goal (1 subgoal):
 1. x + y = 2 * real_of_int k * pi \<Longrightarrow> cos x = cos y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cos x = cos y
[PROOF STEP]
show "cos x = cos y"
[PROOF STATE]
proof (prove)
using this:
cos x = cos y

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zfact_iso_inj:
  "inj_on (zfact_iso n) {..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (zfact_iso n) {..<n}
[PROOF STEP]
proof (rule inj_onI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {..<n}; y \<in> {..<n}; zfact_iso n x = zfact_iso n y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {..<n}; y \<in> {..<n}; zfact_iso n x = zfact_iso n y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume a:"x \<in> {..<n}" "y \<in> {..<n}"
[PROOF STATE]
proof (state)
this:
x \<in> {..<n}
y \<in> {..<n}

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {..<n}; y \<in> {..<n}; zfact_iso n x = zfact_iso n y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume "zfact_iso n x = zfact_iso n y"
[PROOF STATE]
proof (state)
this:
zfact_iso n x = zfact_iso n y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {..<n}; y \<in> {..<n}; zfact_iso n x = zfact_iso n y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
hence "I +>\<^bsub>\<Z>\<^esub> (int x) = I +>\<^bsub>\<Z>\<^esub> (int y)"
[PROOF STATE]
proof (prove)
using this:
zfact_iso n x = zfact_iso n y

goal (1 subgoal):
 1. I +>\<^bsub>\<Z>\<^esub> int x = I +>\<^bsub>\<Z>\<^esub> int y
[PROOF STEP]
by (simp add:zfact_iso_def)
[PROOF STATE]
proof (state)
this:
I +>\<^bsub>\<Z>\<^esub> int x = I +>\<^bsub>\<Z>\<^esub> int y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {..<n}; y \<in> {..<n}; zfact_iso n x = zfact_iso n y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
hence "int x - int y \<in> I"
[PROOF STATE]
proof (prove)
using this:
I +>\<^bsub>\<Z>\<^esub> int x = I +>\<^bsub>\<Z>\<^esub> int y

goal (1 subgoal):
 1. int x - int y \<in> I
[PROOF STEP]
by (subst int.quotient_eq_iff_same_a_r_cos[OF ideal_I], auto)
[PROOF STATE]
proof (state)
this:
int x - int y \<in> I

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {..<n}; y \<in> {..<n}; zfact_iso n x = zfact_iso n y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
hence "int x mod int n = int y mod int n"
[PROOF STATE]
proof (prove)
using this:
int x - int y \<in> I

goal (1 subgoal):
 1. int x mod int n = int y mod int n
[PROOF STEP]
by (meson Idl_subset_eq_dvd int_Idl_subset_ideal mod_eq_dvd_iff)
[PROOF STATE]
proof (state)
this:
int x mod int n = int y mod int n

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> {..<n}; y \<in> {..<n}; zfact_iso n x = zfact_iso n y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
thus "x = y"
[PROOF STATE]
proof (prove)
using this:
int x mod int n = int y mod int n

goal (1 subgoal):
 1. x = y
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
int x mod int n = int y mod int n
x \<in> {..<n}
y \<in> {..<n}

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma permutation_fix:
  assumes i: "i < Suc n" and j: "j < Suc n"
  shows "{ p. p permutes {0..<Suc n} \<and> p i = j } =
         permutation_insert i j ` { q. q permutes {0..<n} }"
    (is "?L = ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {p. p permutes {0..<Suc n} \<and> p i = j} = permutation_insert i j ` {q. q permutes {0..<n}}
[PROOF STEP]
unfolding set_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. (x \<in> {p. p permutes {0..<Suc n} \<and> p i = j}) = (x \<in> permutation_insert i j ` {q. q permutes {0..<n}})
[PROOF STEP]
proof(intro allI iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> {p. p permutes {0..<Suc n} \<and> p i = j} \<Longrightarrow> x \<in> permutation_insert i j ` {q. q permutes {0..<n}}
 2. \<And>x. x \<in> permutation_insert i j ` {q. q permutes {0..<n}} \<Longrightarrow> x \<in> {p. p permutes {0..<Suc n} \<and> p i = j}
[PROOF STEP]
let ?N = "{0..<Suc n}"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> {p. p permutes {0..<Suc n} \<and> p i = j} \<Longrightarrow> x \<in> permutation_insert i j ` {q. q permutes {0..<n}}
 2. \<And>x. x \<in> permutation_insert i j ` {q. q permutes {0..<n}} \<Longrightarrow> x \<in> {p. p permutes {0..<Suc n} \<and> p i = j}
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> {p. p permutes {0..<Suc n} \<and> p i = j} \<Longrightarrow> x \<in> permutation_insert i j ` {q. q permutes {0..<n}}
 2. \<And>x. x \<in> permutation_insert i j ` {q. q permutes {0..<n}} \<Longrightarrow> x \<in> {p. p permutes {0..<Suc n} \<and> p i = j}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> {p. p permutes {0..<Suc n} \<and> p i = j} \<Longrightarrow> x \<in> permutation_insert i j ` {q. q permutes {0..<n}}
 2. \<And>x. x \<in> permutation_insert i j ` {q. q permutes {0..<n}} \<Longrightarrow> x \<in> {p. p permutes {0..<Suc n} \<and> p i = j}
[PROOF STEP]
assume "p \<in> ?L"
[PROOF STATE]
proof (state)
this:
p \<in> {p. p permutes {0..<Suc n} \<and> p i = j}

goal (2 subgoals):
 1. \<And>x. x \<in> {p. p permutes {0..<Suc n} \<and> p i = j} \<Longrightarrow> x \<in> permutation_insert i j ` {q. q permutes {0..<n}}
 2. \<And>x. x \<in> permutation_insert i j ` {q. q permutes {0..<n}} \<Longrightarrow> x \<in> {p. p permutes {0..<Suc n} \<and> p i = j}
[PROOF STEP]
hence p: "p permutes ?N" and pij: "p i = j"
[PROOF STATE]
proof (prove)
using this:
p \<in> {p. p permutes {0..<Suc n} \<and> p i = j}

goal (1 subgoal):
 1. p permutes {0..<Suc n} &&& p i = j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p permutes {0..<Suc n}
p i = j

goal (2 subgoals):
 1. \<And>x. x \<in> {p. p permutes {0..<Suc n} \<and> p i = j} \<Longrightarrow> x \<in> permutation_insert i j ` {q. q permutes {0..<n}}
 2. \<And>x. x \<in> permutation_insert i j ` {q. q permutes {0..<n}} \<Longrightarrow> x \<in> {p. p permutes {0..<Suc n} \<and> p i = j}
[PROOF STEP]
show "p \<in> ?R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<in> permutation_insert i j ` {q. q permutes {0..<n}}
[PROOF STEP]
unfolding mem_Collect_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<in> permutation_insert i j ` {q. q permutes {0..<n}}
[PROOF STEP]
using permutation_delete_permutes[OF p i]
[PROOF STATE]
proof (prove)
using this:
permutation_delete p i permutes {0..<n}

goal (1 subgoal):
 1. p \<in> permutation_insert i j ` {q. q permutes {0..<n}}
[PROOF STEP]
using permutation_insert_delete[OF p i,symmetric]
[PROOF STATE]
proof (prove)
using this:
permutation_delete p i permutes {0..<n}
p = permutation_insert i (p i) (permutation_delete p i)

goal (1 subgoal):
 1. p \<in> permutation_insert i j ` {q. q permutes {0..<n}}
[PROOF STEP]
unfolding pij
[PROOF STATE]
proof (prove)
using this:
permutation_delete p i permutes {0..<n}
p = permutation_insert i j (permutation_delete p i)

goal (1 subgoal):
 1. p \<in> permutation_insert i j ` {q. q permutes {0..<n}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<in> permutation_insert i j ` {q. q permutes {0..<n}}

goal (1 subgoal):
 1. \<And>x. x \<in> permutation_insert i j ` {q. q permutes {0..<n}} \<Longrightarrow> x \<in> {p. p permutes {0..<Suc n} \<and> p i = j}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
p \<in> {p. p permutes {0..<Suc n} \<and> p i = j} \<Longrightarrow> p \<in> permutation_insert i j ` {q. q permutes {0..<n}}

goal (1 subgoal):
 1. \<And>x. x \<in> permutation_insert i j ` {q. q permutes {0..<n}} \<Longrightarrow> x \<in> {p. p permutes {0..<Suc n} \<and> p i = j}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
p \<in> {p. p permutes {0..<Suc n} \<and> p i = j} \<Longrightarrow> p \<in> permutation_insert i j ` {q. q permutes {0..<n}}

goal (1 subgoal):
 1. \<And>x. x \<in> permutation_insert i j ` {q. q permutes {0..<n}} \<Longrightarrow> x \<in> {p. p permutes {0..<Suc n} \<and> p i = j}
[PROOF STEP]
assume "p \<in> ?R"
[PROOF STATE]
proof (state)
this:
p \<in> permutation_insert i j ` {q. q permutes {0..<n}}

goal (1 subgoal):
 1. \<And>x. x \<in> permutation_insert i j ` {q. q permutes {0..<n}} \<Longrightarrow> x \<in> {p. p permutes {0..<Suc n} \<and> p i = j}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<in> permutation_insert i j ` {q. q permutes {0..<n}}
[PROOF STEP]
obtain q where pq: "p = permutation_insert i j q" and q: "q permutes {0..<n}"
[PROOF STATE]
proof (prove)
using this:
p \<in> permutation_insert i j ` {q. q permutes {0..<n}}

goal (1 subgoal):
 1. (\<And>q. \<lbrakk>p = permutation_insert i j q; q permutes {0..<n}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = permutation_insert i j q
q permutes {0..<n}

goal (1 subgoal):
 1. \<And>x. x \<in> permutation_insert i j ` {q. q permutes {0..<n}} \<Longrightarrow> x \<in> {p. p permutes {0..<Suc n} \<and> p i = j}
[PROOF STEP]
hence "p i = j"
[PROOF STATE]
proof (prove)
using this:
p = permutation_insert i j q
q permutes {0..<n}

goal (1 subgoal):
 1. p i = j
[PROOF STEP]
unfolding permutation_insert_expand
[PROOF STATE]
proof (prove)
using this:
p = (\<lambda>i'. if i' < i then if q i' < j then q i' else Suc (q i') else if i' = i then j else if q (i' - 1) < j then q (i' - 1) else Suc (q (i' - 1)))
q permutes {0..<n}

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

goal (1 subgoal):
 1. \<And>x. x \<in> permutation_insert i j ` {q. q permutes {0..<n}} \<Longrightarrow> x \<in> {p. p permutes {0..<Suc n} \<and> p i = j}
[PROOF STEP]
thus "p \<in> ?L"
[PROOF STATE]
proof (prove)
using this:
p i = j

goal (1 subgoal):
 1. p \<in> {p. p permutes {0..<Suc n} \<and> p i = j}
[PROOF STEP]
using pq permutation_insert_permutes[OF q i j]
[PROOF STATE]
proof (prove)
using this:
p i = j
p = permutation_insert i j q
permutation_insert i j q permutes {0..<Suc n}

goal (1 subgoal):
 1. p \<in> {p. p permutes {0..<Suc n} \<and> p i = j}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<in> {p. p permutes {0..<Suc n} \<and> p i = j}

goal:
No subgoals!
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
p \<in> permutation_insert i j ` {q. q permutes {0..<n}} \<Longrightarrow> p \<in> {p. p permutes {0..<Suc n} \<and> p i = j}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma collinear_sym1:
  shows "collinear z1 z2 z3 \<longleftrightarrow> collinear z1 z3 z2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. collinear z1 z2 z3 = collinear z1 z3 z2
[PROOF STEP]
unfolding collinear_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (z1 = z2 \<or> is_real ((z3 - z1) / (z2 - z1))) = (z1 = z3 \<or> is_real ((z2 - z1) / (z3 - z1)))
[PROOF STEP]
using div_reals[of "1" "(z3 - z1)/(z2 - z1)"]  div_reals[of "1" "(z2 - z1)/(z3 - z1)"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>is_real 1; is_real ((z3 - z1) / (z2 - z1))\<rbrakk> \<Longrightarrow> is_real (1 / ((z3 - z1) / (z2 - z1)))
\<lbrakk>is_real 1; is_real ((z2 - z1) / (z3 - z1))\<rbrakk> \<Longrightarrow> is_real (1 / ((z2 - z1) / (z3 - z1)))

goal (1 subgoal):
 1. (z1 = z2 \<or> is_real ((z3 - z1) / (z2 - z1))) = (z1 = z3 \<or> is_real ((z2 - z1) / (z3 - z1)))
[PROOF STEP]
by auto


[STATEMENT]
lemma len_bv_n: "\<forall>xs \<in> set_pmf (bv n). length xs = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>xs\<in>set_pmf (bv n). length xs = n
[PROOF STEP]
apply(induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>xs\<in>set_pmf (bv 0). length xs = 0
 2. \<And>n. \<forall>xs\<in>set_pmf (bv n). length xs = n \<Longrightarrow> \<forall>xs\<in>set_pmf (bv (Suc n)). length xs = Suc n
[PROOF STEP]
by auto


[STATEMENT]
lemma gfinprod_mono_neutral_cong:
  assumes [simp]: "finite B" "finite A"
    and *: "\<And>i. i \<in> B - A \<Longrightarrow> h i = \<one>" "\<And>i. i \<in> A - B \<Longrightarrow> g i = \<one>"
    and gh: "\<And>x. x \<in> A \<inter> B \<Longrightarrow> g x = h x"
    and g: "g \<in> A \<rightarrow> carrier G"
    and h: "h \<in> B \<rightarrow> carrier G"
 shows "gfinprod G g A = gfinprod G h B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gfinprod G g A = gfinprod G h B
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gfinprod G g A = gfinprod G h B
[PROOF STEP]
have "gfinprod G g A = gfinprod G g (A \<inter> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gfinprod G g A = gfinprod G g (A \<inter> B)
[PROOF STEP]
by (rule gfinprod_mono_neutral_cong_right) (use assms in auto)
[PROOF STATE]
proof (state)
this:
gfinprod G g A = gfinprod G g (A \<inter> B)

goal (1 subgoal):
 1. gfinprod G g A = gfinprod G h B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
gfinprod G g A = gfinprod G g (A \<inter> B)

goal (1 subgoal):
 1. gfinprod G g A = gfinprod G h B
[PROOF STEP]
have "\<dots> = gfinprod G h (A \<inter> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gfinprod G g (A \<inter> B) = gfinprod G h (A \<inter> B)
[PROOF STEP]
by (rule gfinprod_cong) (use assms in auto)
[PROOF STATE]
proof (state)
this:
gfinprod G g (A \<inter> B) = gfinprod G h (A \<inter> B)

goal (1 subgoal):
 1. gfinprod G g A = gfinprod G h B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
gfinprod G g (A \<inter> B) = gfinprod G h (A \<inter> B)

goal (1 subgoal):
 1. gfinprod G g A = gfinprod G h B
[PROOF STEP]
have "\<dots> = gfinprod G h B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gfinprod G h (A \<inter> B) = gfinprod G h B
[PROOF STEP]
by (rule gfinprod_mono_neutral_cong_left) (use assms in auto)
[PROOF STATE]
proof (state)
this:
gfinprod G h (A \<inter> B) = gfinprod G h B

goal (1 subgoal):
 1. gfinprod G g A = gfinprod G h B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
gfinprod G g A = gfinprod G h B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
gfinprod G g A = gfinprod G h B

goal (1 subgoal):
 1. gfinprod G g A = gfinprod G h B
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
gfinprod G g A = gfinprod G h B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lim_ln_over_power:
  fixes s :: real
  assumes "0 < s"
  shows "((\<lambda>n. ln n / (n powr s)) \<longlongrightarrow> 0) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. ln (real n) / real n powr s) \<longlonglongrightarrow> 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. ln (real n) / real n powr s) \<longlonglongrightarrow> 0
[PROOF STEP]
have "(\<lambda>n. ln (Suc n) / (Suc n) powr s) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. ln (real (Suc n)) / real (Suc n) powr s) \<longlonglongrightarrow> 0
[PROOF STEP]
using lim_Ln_over_power [of "of_real s", THEN filterlim_sequentially_Suc [THEN iffD2]] assms
[PROOF STATE]
proof (prove)
using this:
0 < Re (complex_of_real s) \<Longrightarrow> (\<lambda>x. Ln (of_nat (Suc x)) / of_nat (Suc x) powr complex_of_real s) \<longlonglongrightarrow> 0
0 < s

goal (1 subgoal):
 1. (\<lambda>n. ln (real (Suc n)) / real (Suc n) powr s) \<longlonglongrightarrow> 0
[PROOF STEP]
by (simp add: lim_sequentially dist_norm Ln_Reals_eq norm_powr_real_powr norm_divide)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ln (real (Suc n)) / real (Suc n) powr s) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. ln (real n) / real n powr s) \<longlonglongrightarrow> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. ln (real (Suc n)) / real (Suc n) powr s) \<longlonglongrightarrow> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ln (real (Suc n)) / real (Suc n) powr s) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. (\<lambda>n. ln (real n) / real n powr s) \<longlonglongrightarrow> 0
[PROOF STEP]
using filterlim_sequentially_Suc[of "\<lambda>n::nat. ln n / n powr s"]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ln (real (Suc n)) / real (Suc n) powr s) \<longlonglongrightarrow> 0
(LIM x sequentially. ln (real (Suc x)) / real (Suc x) powr s :> ?F) = (LIM x sequentially. ln (real x) / real x powr s :> ?F)

goal (1 subgoal):
 1. (\<lambda>n. ln (real n) / real n powr s) \<longlonglongrightarrow> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ln (real n) / real n powr s) \<longlonglongrightarrow> 0

goal:
No subgoals!
[PROOF STEP]
qed