[STATEMENT]
theorem bij_betw_iff_has_inverse:
  "bij_betw \<alpha> S T \<longleftrightarrow> (\<exists>\<beta> \<in> T \<rightarrow>\<^sub>E S. compose S \<beta> \<alpha> = identity S \<and> compose T \<alpha> \<beta> = identity T)"
    (is "_ \<longleftrightarrow> (\<exists>\<beta> \<in> T \<rightarrow>\<^sub>E S. ?INV \<beta>)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw \<alpha> S T = (\<exists>\<beta>\<in>T \<rightarrow>\<^sub>E S. compose S \<beta> \<alpha> = identity S \<and> compose T \<alpha> \<beta> = identity T)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. bij_betw \<alpha> S T \<Longrightarrow> \<exists>\<beta>\<in>T \<rightarrow>\<^sub>E S. compose S \<beta> \<alpha> = identity S \<and> compose T \<alpha> \<beta> = identity T
 2. \<exists>\<beta>\<in>T \<rightarrow>\<^sub>E S. compose S \<beta> \<alpha> = identity S \<and> compose T \<alpha> \<beta> = identity T \<Longrightarrow> bij_betw \<alpha> S T
[PROOF STEP]
let ?inv = "restrict (inv_into S \<alpha>) T"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. bij_betw \<alpha> S T \<Longrightarrow> \<exists>\<beta>\<in>T \<rightarrow>\<^sub>E S. compose S \<beta> \<alpha> = identity S \<and> compose T \<alpha> \<beta> = identity T
 2. \<exists>\<beta>\<in>T \<rightarrow>\<^sub>E S. compose S \<beta> \<alpha> = identity S \<and> compose T \<alpha> \<beta> = identity T \<Longrightarrow> bij_betw \<alpha> S T
[PROOF STEP]
assume "bij_betw \<alpha> S T"
[PROOF STATE]
proof (state)
this:
bij_betw \<alpha> S T

goal (2 subgoals):
 1. bij_betw \<alpha> S T \<Longrightarrow> \<exists>\<beta>\<in>T \<rightarrow>\<^sub>E S. compose S \<beta> \<alpha> = identity S \<and> compose T \<alpha> \<beta> = identity T
 2. \<exists>\<beta>\<in>T \<rightarrow>\<^sub>E S. compose S \<beta> \<alpha> = identity S \<and> compose T \<alpha> \<beta> = identity T \<Longrightarrow> bij_betw \<alpha> S T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bij_betw \<alpha> S T
[PROOF STEP]
have "?INV ?inv" and "?inv \<in> T \<rightarrow>\<^sub>E S"
[PROOF STATE]
proof (prove)
using this:
bij_betw \<alpha> S T

goal (1 subgoal):
 1. compose S (restrict (inv_into S \<alpha>) T) \<alpha> = identity S \<and> compose T \<alpha> (restrict (inv_into S \<alpha>) T) = identity T &&& restrict (inv_into S \<alpha>) T \<in> T \<rightarrow>\<^sub>E S
[PROOF STEP]
by (simp_all add: compose_inv_into_id bij_betw_imp_surj_on compose_id_inv_into bij_betw_imp_funcset bij_betw_inv_into)
[PROOF STATE]
proof (state)
this:
compose S (restrict (inv_into S \<alpha>) T) \<alpha> = identity S \<and> compose T \<alpha> (restrict (inv_into S \<alpha>) T) = identity T
restrict (inv_into S \<alpha>) T \<in> T \<rightarrow>\<^sub>E S

goal (2 subgoals):
 1. bij_betw \<alpha> S T \<Longrightarrow> \<exists>\<beta>\<in>T \<rightarrow>\<^sub>E S. compose S \<beta> \<alpha> = identity S \<and> compose T \<alpha> \<beta> = identity T
 2. \<exists>\<beta>\<in>T \<rightarrow>\<^sub>E S. compose S \<beta> \<alpha> = identity S \<and> compose T \<alpha> \<beta> = identity T \<Longrightarrow> bij_betw \<alpha> S T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
compose S (restrict (inv_into S \<alpha>) T) \<alpha> = identity S \<and> compose T \<alpha> (restrict (inv_into S \<alpha>) T) = identity T
restrict (inv_into S \<alpha>) T \<in> T \<rightarrow>\<^sub>E S
[PROOF STEP]
show "\<exists>\<beta> \<in> T \<rightarrow>\<^sub>E S. ?INV \<beta>"
[PROOF STATE]
proof (prove)
using this:
compose S (restrict (inv_into S \<alpha>) T) \<alpha> = identity S \<and> compose T \<alpha> (restrict (inv_into S \<alpha>) T) = identity T
restrict (inv_into S \<alpha>) T \<in> T \<rightarrow>\<^sub>E S

goal (1 subgoal):
 1. \<exists>\<beta>\<in>T \<rightarrow>\<^sub>E S. compose S \<beta> \<alpha> = identity S \<and> compose T \<alpha> \<beta> = identity T
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>\<beta>\<in>T \<rightarrow>\<^sub>E S. compose S \<beta> \<alpha> = identity S \<and> compose T \<alpha> \<beta> = identity T

goal (1 subgoal):
 1. \<exists>\<beta>\<in>T \<rightarrow>\<^sub>E S. compose S \<beta> \<alpha> = identity S \<and> compose T \<alpha> \<beta> = identity T \<Longrightarrow> bij_betw \<alpha> S T
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>\<beta>\<in>T \<rightarrow>\<^sub>E S. compose S \<beta> \<alpha> = identity S \<and> compose T \<alpha> \<beta> = identity T \<Longrightarrow> bij_betw \<alpha> S T
[PROOF STEP]
assume "\<exists>\<beta> \<in> T \<rightarrow>\<^sub>E S. ?INV \<beta>"
[PROOF STATE]
proof (state)
this:
\<exists>\<beta>\<in>T \<rightarrow>\<^sub>E S. compose S \<beta> \<alpha> = identity S \<and> compose T \<alpha> \<beta> = identity T

goal (1 subgoal):
 1. \<exists>\<beta>\<in>T \<rightarrow>\<^sub>E S. compose S \<beta> \<alpha> = identity S \<and> compose T \<alpha> \<beta> = identity T \<Longrightarrow> bij_betw \<alpha> S T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>\<beta>\<in>T \<rightarrow>\<^sub>E S. compose S \<beta> \<alpha> = identity S \<and> compose T \<alpha> \<beta> = identity T
[PROOF STEP]
obtain \<beta> where "\<alpha> \<in> S \<rightarrow> T" "\<beta> \<in> T \<rightarrow> S" "\<And>x. x \<in> S \<Longrightarrow> \<beta> (\<alpha> x) = x" "\<And>y. y \<in> T \<Longrightarrow> \<alpha> (\<beta> y) = y"
[PROOF STATE]
proof (prove)
using this:
\<exists>\<beta>\<in>T \<rightarrow>\<^sub>E S. compose S \<beta> \<alpha> = identity S \<and> compose T \<alpha> \<beta> = identity T

goal (1 subgoal):
 1. (\<And>\<beta>. \<lbrakk>\<alpha> \<in> S \<rightarrow> T; \<beta> \<in> T \<rightarrow> S; \<And>x. x \<in> S \<Longrightarrow> \<beta> (\<alpha> x) = x; \<And>y. y \<in> T \<Longrightarrow> \<alpha> (\<beta> y) = y\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis PiE_restrict compose_eq graph restrict_PiE restrict_apply)
[PROOF STATE]
proof (state)
this:
\<alpha> \<in> S \<rightarrow> T
\<beta> \<in> T \<rightarrow> S
?x \<in> S \<Longrightarrow> \<beta> (\<alpha> ?x) = ?x
?y \<in> T \<Longrightarrow> \<alpha> (\<beta> ?y) = ?y

goal (1 subgoal):
 1. \<exists>\<beta>\<in>T \<rightarrow>\<^sub>E S. compose S \<beta> \<alpha> = identity S \<and> compose T \<alpha> \<beta> = identity T \<Longrightarrow> bij_betw \<alpha> S T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<alpha> \<in> S \<rightarrow> T
\<beta> \<in> T \<rightarrow> S
?x \<in> S \<Longrightarrow> \<beta> (\<alpha> ?x) = ?x
?y \<in> T \<Longrightarrow> \<alpha> (\<beta> ?y) = ?y
[PROOF STEP]
show "bij_betw \<alpha> S T"
[PROOF STATE]
proof (prove)
using this:
\<alpha> \<in> S \<rightarrow> T
\<beta> \<in> T \<rightarrow> S
?x \<in> S \<Longrightarrow> \<beta> (\<alpha> ?x) = ?x
?y \<in> T \<Longrightarrow> \<alpha> (\<beta> ?y) = ?y

goal (1 subgoal):
 1. bij_betw \<alpha> S T
[PROOF STEP]
by (rule bij_betwI)
[PROOF STATE]
proof (state)
this:
bij_betw \<alpha> S T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma LIMSEQ_offset: "(\<lambda>n. f (n + k)) \<longlonglongrightarrow> a \<Longrightarrow> f \<longlonglongrightarrow> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. f (n + k)) \<longlonglongrightarrow> a \<Longrightarrow> f \<longlonglongrightarrow> a
[PROOF STEP]
unfolding tendsto_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>S. open S \<longrightarrow> a \<in> S \<longrightarrow> (\<forall>\<^sub>F x in sequentially. f (x + k) \<in> S) \<Longrightarrow> \<forall>S. open S \<longrightarrow> a \<in> S \<longrightarrow> (\<forall>\<^sub>F x in sequentially. f x \<in> S)
[PROOF STEP]
by (subst (asm) eventually_sequentially_seg[where k=k])


[STATEMENT]
lemma mask_eqI:
  fixes x :: "'a :: len word"
  assumes m1: "x AND mask n = y AND mask n"
  and     m2: "x AND NOT (mask n) = y AND NOT (mask n)"
  shows "x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
have *: \<open>x = x AND mask n OR x AND NOT (mask n)\<close> for x :: \<open>'a word\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = x AND mask n OR x AND NOT (mask n)
[PROOF STEP]
by (rule bit_word_eqI) (auto simp add: bit_simps)
[PROOF STATE]
proof (state)
this:
?x = ?x AND mask n OR ?x AND NOT (mask n)

goal (1 subgoal):
 1. x = y
[PROOF STEP]
from assms * [of x] * [of y]
[PROOF STATE]
proof (chain)
picking this:
x AND mask n = y AND mask n
x AND NOT (mask n) = y AND NOT (mask n)
x = x AND mask n OR x AND NOT (mask n)
y = y AND mask n OR y AND NOT (mask n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x AND mask n = y AND mask n
x AND NOT (mask n) = y AND NOT (mask n)
x = x AND mask n OR x AND NOT (mask n)
y = y AND mask n OR y AND NOT (mask 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 Gromov_hyperbolic_subsetI2:
  fixes delta::real
  assumes "\<And>e x y z. e \<in> A \<Longrightarrow> x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> z \<in> A \<Longrightarrow> Gromov_product_at (e::'a::metric_space) x z \<ge> min (Gromov_product_at e x y) (Gromov_product_at e y z) - delta"
  shows "Gromov_hyperbolic_subset delta A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gromov_hyperbolic_subset delta A
[PROOF STEP]
proof (rule Gromov_hyperbolic_subsetI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y z t. \<lbrakk>x \<in> A; y \<in> A; z \<in> A; t \<in> A\<rbrakk> \<Longrightarrow> dist x y + dist z t \<le> max (dist x z + dist y t) (dist x t + dist y z) + 2 * delta
[PROOF STEP]
fix x y z t
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y z t. \<lbrakk>x \<in> A; y \<in> A; z \<in> A; t \<in> A\<rbrakk> \<Longrightarrow> dist x y + dist z t \<le> max (dist x z + dist y t) (dist x t + dist y z) + 2 * delta
[PROOF STEP]
assume H: "x \<in> A" "z \<in> A" "y \<in> A" "t \<in> A"
[PROOF STATE]
proof (state)
this:
x \<in> A
z \<in> A
y \<in> A
t \<in> A

goal (1 subgoal):
 1. \<And>x y z t. \<lbrakk>x \<in> A; y \<in> A; z \<in> A; t \<in> A\<rbrakk> \<Longrightarrow> dist x y + dist z t \<le> max (dist x z + dist y t) (dist x t + dist y z) + 2 * delta
[PROOF STEP]
show "dist x y + dist z t \<le> max (dist x z + dist y t) (dist x t + dist y z) + 2 * delta"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x y + dist z t \<le> max (dist x z + dist y t) (dist x t + dist y z) + 2 * delta
[PROOF STEP]
using assms[OF H]
[PROOF STATE]
proof (prove)
using this:
min (Gromov_product_at x z y) (Gromov_product_at x y t) - delta \<le> Gromov_product_at x z t

goal (1 subgoal):
 1. dist x y + dist z t \<le> max (dist x z + dist y t) (dist x t + dist y z) + 2 * delta
[PROOF STEP]
unfolding Gromov_product_at_def min_def max_def
[PROOF STATE]
proof (prove)
using this:
(if (dist x z + dist x y - dist z y) / 2 \<le> (dist x y + dist x t - dist y t) / 2 then (dist x z + dist x y - dist z y) / 2 else (dist x y + dist x t - dist y t) / 2) - delta \<le> (dist x z + dist x t - dist z t) / 2

goal (1 subgoal):
 1. dist x y + dist z t \<le> (if dist x z + dist y t \<le> dist x t + dist y z then dist x t + dist y z else dist x z + dist y t) + 2 * delta
[PROOF STEP]
by (auto simp add: divide_simps algebra_simps dist_commute)
[PROOF STATE]
proof (state)
this:
dist x y + dist z t \<le> max (dist x z + dist y t) (dist x t + dist y z) + 2 * delta

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in real_distribution) not_Dirac_0_imp_positive_mass_away_0:
  assumes "prob {0} < 1"
  shows "\<exists>a. a > 0 \<and> prob {x. abs(x) > a} > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a>0. 0 < prob {x. a < \<bar>x\<bar>}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>a>0. 0 < prob {x. a < \<bar>x\<bar>}
[PROOF STEP]
have "1 = prob UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 = prob UNIV
[PROOF STEP]
using prob_space
[PROOF STATE]
proof (prove)
using this:
prob (space M) = 1

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

goal (1 subgoal):
 1. \<exists>a>0. 0 < prob {x. a < \<bar>x\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 = prob UNIV

goal (1 subgoal):
 1. \<exists>a>0. 0 < prob {x. a < \<bar>x\<bar>}
[PROOF STEP]
have "... = prob {0} + prob (UNIV -{0})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob UNIV = prob {0} + prob (UNIV - {0})
[PROOF STEP]
by (subst finite_measure_Union[symmetric], auto)
[PROOF STATE]
proof (state)
this:
prob UNIV = prob {0} + prob (UNIV - {0})

goal (1 subgoal):
 1. \<exists>a>0. 0 < prob {x. a < \<bar>x\<bar>}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
1 = prob {0} + prob (UNIV - {0})
[PROOF STEP]
have "0 < prob (UNIV -{0})"
[PROOF STATE]
proof (prove)
using this:
1 = prob {0} + prob (UNIV - {0})

goal (1 subgoal):
 1. 0 < prob (UNIV - {0})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 = prob {0} + prob (UNIV - {0})
prob {0} < 1

goal (1 subgoal):
 1. 0 < prob (UNIV - {0})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < prob (UNIV - {0})

goal (1 subgoal):
 1. \<exists>a>0. 0 < prob {x. a < \<bar>x\<bar>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 < prob (UNIV - {0})

goal (1 subgoal):
 1. \<exists>a>0. 0 < prob {x. a < \<bar>x\<bar>}
[PROOF STEP]
have "... \<le> prob (\<Union>n::nat. {x. abs(x)>(1/2)^n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob (UNIV - {0}) \<le> prob (\<Union>n. {x. (1 / 2) ^ n < \<bar>x\<bar>})
[PROOF STEP]
apply (rule finite_measure_mono)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. UNIV - {0} \<subseteq> (\<Union>n. {x. (1 / 2) ^ n < \<bar>x\<bar>})
 2. (\<Union>n. {x. (1 / 2) ^ n < \<bar>x\<bar>}) \<in> events
[PROOF STEP]
by (auto, meson one_less_numeral_iff reals_power_lt_ex semiring_norm(76) zero_less_abs_iff)
[PROOF STATE]
proof (state)
this:
prob (UNIV - {0}) \<le> prob (\<Union>n. {x. (1 / 2) ^ n < \<bar>x\<bar>})

goal (1 subgoal):
 1. \<exists>a>0. 0 < prob {x. a < \<bar>x\<bar>}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 < prob (\<Union>n. {x. (1 / 2) ^ n < \<bar>x\<bar>})
[PROOF STEP]
have "prob (\<Union>n::nat. {x. abs(x)>(1/2)^n}) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < prob (\<Union>n. {x. (1 / 2) ^ n < \<bar>x\<bar>})

goal (1 subgoal):
 1. prob (\<Union>n. {x. (1 / 2) ^ n < \<bar>x\<bar>}) \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prob (\<Union>n. {x. (1 / 2) ^ n < \<bar>x\<bar>}) \<noteq> 0

goal (1 subgoal):
 1. \<exists>a>0. 0 < prob {x. a < \<bar>x\<bar>}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prob (\<Union>n. {x. (1 / 2) ^ n < \<bar>x\<bar>}) \<noteq> 0
[PROOF STEP]
have "\<exists>n. prob {x. abs(x)>(1/2)^n} \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
prob (\<Union>n. {x. (1 / 2) ^ n < \<bar>x\<bar>}) \<noteq> 0

goal (1 subgoal):
 1. \<exists>n. prob {x. (1 / 2) ^ n < \<bar>x\<bar>} \<noteq> 0
[PROOF STEP]
using measure_countably_zero[of "\<lambda>n. {x. abs(x)>(1/2)^n}"]
[PROOF STATE]
proof (prove)
using this:
prob (\<Union>n. {x. (1 / 2) ^ n < \<bar>x\<bar>}) \<noteq> 0
\<lbrakk>range (\<lambda>n. {x. (1 / 2) ^ n < \<bar>x\<bar>}) \<subseteq> events; \<And>i. prob {x. (1 / 2) ^ i < \<bar>x\<bar>} = 0\<rbrakk> \<Longrightarrow> prob (\<Union>i. {x. (1 / 2) ^ i < \<bar>x\<bar>}) = 0

goal (1 subgoal):
 1. \<exists>n. prob {x. (1 / 2) ^ n < \<bar>x\<bar>} \<noteq> 0
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>n. prob {x. (1 / 2) ^ n < \<bar>x\<bar>} \<noteq> 0

goal (1 subgoal):
 1. \<exists>a>0. 0 < prob {x. a < \<bar>x\<bar>}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>n. prob {x. (1 / 2) ^ n < \<bar>x\<bar>} \<noteq> 0
[PROOF STEP]
obtain N where N: "prob {x. abs(x) > (1/2)^N} \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
\<exists>n. prob {x. (1 / 2) ^ n < \<bar>x\<bar>} \<noteq> 0

goal (1 subgoal):
 1. (\<And>N. prob {x. (1 / 2) ^ N < \<bar>x\<bar>} \<noteq> 0 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
prob {x. (1 / 2) ^ N < \<bar>x\<bar>} \<noteq> 0

goal (1 subgoal):
 1. \<exists>a>0. 0 < prob {x. a < \<bar>x\<bar>}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a>0. 0 < prob {x. a < \<bar>x\<bar>}
[PROOF STEP]
apply (rule exI[of _ "(1/2)^N"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < (1 / 2) ^ N \<and> 0 < prob {x. (1 / 2) ^ N < \<bar>x\<bar>}
[PROOF STEP]
using N
[PROOF STATE]
proof (prove)
using this:
prob {x. (1 / 2) ^ N < \<bar>x\<bar>} \<noteq> 0

goal (1 subgoal):
 1. 0 < (1 / 2) ^ N \<and> 0 < prob {x. (1 / 2) ^ N < \<bar>x\<bar>}
[PROOF STEP]
by (auto simp add: zero_less_measure_iff)
[PROOF STATE]
proof (state)
this:
\<exists>a>0. 0 < prob {x. a < \<bar>x\<bar>}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma atLeastLessThan_injective:
assumes "{0 ..< m::nat} = {0 ..< n}"
shows "m = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m = n
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. m = n
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. m = n
[PROOF STEP]
assume "m < n"
[PROOF STATE]
proof (state)
this:
m < n

goal (1 subgoal):
 1. m = n
[PROOF STEP]
hence "m \<in> {0 ..< n}"
[PROOF STATE]
proof (prove)
using this:
m < n

goal (1 subgoal):
 1. m \<in> {0..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m \<in> {0..<n}

goal (1 subgoal):
 1. m = n
[PROOF STEP]
hence "{0 ..< m} < {0 ..< n}"
[PROOF STATE]
proof (prove)
using this:
m \<in> {0..<n}

goal (1 subgoal):
 1. {0..<m} \<subset> {0..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..<m} \<subset> {0..<n}

goal (1 subgoal):
 1. m = n
[PROOF STEP]
hence False
[PROOF STATE]
proof (prove)
using this:
{0..<m} \<subset> {0..<n}

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
{0..<m} \<subset> {0..<n}
{0..<m} = {0..<n}

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

goal (1 subgoal):
 1. m = n
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
m < n \<Longrightarrow> False

goal (1 subgoal):
 1. m = n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
m < n \<Longrightarrow> False

goal (1 subgoal):
 1. m = n
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
m < n \<Longrightarrow> False

goal (1 subgoal):
 1. m = n
[PROOF STEP]
assume "n < m"
[PROOF STATE]
proof (state)
this:
n < m

goal (1 subgoal):
 1. m = n
[PROOF STEP]
hence "n \<in> {0 ..< m}"
[PROOF STATE]
proof (prove)
using this:
n < m

goal (1 subgoal):
 1. n \<in> {0..<m}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n \<in> {0..<m}

goal (1 subgoal):
 1. m = n
[PROOF STEP]
hence "{0 ..< n} < {0 ..< m}"
[PROOF STATE]
proof (prove)
using this:
n \<in> {0..<m}

goal (1 subgoal):
 1. {0..<n} \<subset> {0..<m}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..<n} \<subset> {0..<m}

goal (1 subgoal):
 1. m = n
[PROOF STEP]
hence False
[PROOF STATE]
proof (prove)
using this:
{0..<n} \<subset> {0..<m}

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
{0..<n} \<subset> {0..<m}
{0..<m} = {0..<n}

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

goal (1 subgoal):
 1. m = n
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
n < m \<Longrightarrow> False

goal (1 subgoal):
 1. m = n
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
m < n \<Longrightarrow> False
n < m \<Longrightarrow> False
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m < n \<Longrightarrow> False
n < m \<Longrightarrow> False

goal (1 subgoal):
 1. m = n
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
m = n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fst_sublist_if_not_snd_sublist:
  "\<lbrakk>xs@ys=A@B; \<not> sublist B ys\<rbrakk> \<Longrightarrow> \<exists>as bs. as @ bs = xs \<and> bs @ ys = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>xs @ ys = A @ B; \<not> sublist B ys\<rbrakk> \<Longrightarrow> \<exists>as bs. as @ bs = xs \<and> bs @ ys = B
[PROOF STEP]
by (metis suffix_append suffix_def suffix_imp_sublist)


[STATEMENT]
lemma length_subsets_smash:
  shows
    "length (subsets_smash n subs1 subs2) = length subs1 * length subs2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (subsets_smash n subs1 subs2) = length subs1 * length subs2
[PROOF STEP]
unfolding subsets_smash_def length_concat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map length (map (\<lambda>l1. map (\<lambda>l2. l1 @ map ((+) n) l2) subs2) subs1)) = length subs1 * length subs2
[PROOF STEP]
by (auto simp add: o_def sum_list_triv)


[STATEMENT]
lemma in_orthogonal_complement_span[simp]:
  assumes [intro]:"S \<subseteq> carrier_vec n"
  shows "orthogonal_complement (span S) = orthogonal_complement S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal_complement (local.span S) = orthogonal_complement S
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. orthogonal_complement (local.span S) \<subseteq> orthogonal_complement S
 2. orthogonal_complement S \<subseteq> orthogonal_complement (local.span S)
[PROOF STEP]
show "orthogonal_complement (span S) \<subseteq> orthogonal_complement S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal_complement (local.span S) \<subseteq> orthogonal_complement S
[PROOF STEP]
by(fact orthogonal_complement_subset[OF in_own_span[OF assms]])
[PROOF STATE]
proof (state)
this:
orthogonal_complement (local.span S) \<subseteq> orthogonal_complement S

goal (1 subgoal):
 1. orthogonal_complement S \<subseteq> orthogonal_complement (local.span S)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
orthogonal_complement (local.span S) \<subseteq> orthogonal_complement S

goal (1 subgoal):
 1. orthogonal_complement S \<subseteq> orthogonal_complement (local.span S)
[PROOF STEP]
fix x :: "'a vec"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. orthogonal_complement S \<subseteq> orthogonal_complement (local.span S)
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. orthogonal_complement S \<subseteq> orthogonal_complement (local.span S)
[PROOF STEP]
fix A :: "'a vec set"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. orthogonal_complement S \<subseteq> orthogonal_complement (local.span S)
[PROOF STEP]
assume x [intro]:"x \<in> carrier_vec n" and f: "finite A" and S:"A \<subseteq> S"
[PROOF STATE]
proof (state)
this:
x \<in> carrier_vec n
finite A
A \<subseteq> S

goal (1 subgoal):
 1. orthogonal_complement S \<subseteq> orthogonal_complement (local.span S)
[PROOF STEP]
assume i0:"\<forall>y\<in>S. x \<bullet> y = 0"
[PROOF STATE]
proof (state)
this:
\<forall>y\<in>S. x \<bullet> y = (0::'a)

goal (1 subgoal):
 1. orthogonal_complement S \<subseteq> orthogonal_complement (local.span S)
[PROOF STEP]
have "x \<bullet> lincomb a A = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<bullet> lincomb a A = (0::'a)
[PROOF STEP]
unfolding comm_scalar_prod[OF x lincomb_closed[OF subset_trans[OF S assms]]]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb a A \<bullet> x = (0::'a)
[PROOF STEP]
proof(insert S,atomize(full),rule finite_induct[OF f],goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {} \<subseteq> S \<longrightarrow> lincomb a {} \<bullet> x = (0::'a)
 2. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; F \<subseteq> S \<longrightarrow> lincomb a F \<bullet> x = (0::'a)\<rbrakk> \<Longrightarrow> insert xa F \<subseteq> S \<longrightarrow> lincomb a (insert xa F) \<bullet> x = (0::'a)
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. {} \<subseteq> S \<longrightarrow> lincomb a {} \<bullet> x = (0::'a)
 2. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; F \<subseteq> S \<longrightarrow> lincomb a F \<bullet> x = (0::'a)\<rbrakk> \<Longrightarrow> insert xa F \<subseteq> S \<longrightarrow> lincomb a (insert xa F) \<bullet> x = (0::'a)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {} \<subseteq> S \<longrightarrow> lincomb a {} \<bullet> x = (0::'a)
[PROOF STEP]
using assms x
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> carrier_vec n
x \<in> carrier_vec n

goal (1 subgoal):
 1. {} \<subseteq> S \<longrightarrow> lincomb a {} \<bullet> x = (0::'a)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
{} \<subseteq> S \<longrightarrow> lincomb a {} \<bullet> x = (0::'a)

goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; F \<subseteq> S \<longrightarrow> lincomb a F \<bullet> x = (0::'a)\<rbrakk> \<Longrightarrow> insert xa F \<subseteq> S \<longrightarrow> lincomb a (insert xa F) \<bullet> x = (0::'a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; F \<subseteq> S \<longrightarrow> lincomb a F \<bullet> x = (0::'a)\<rbrakk> \<Longrightarrow> insert xa F \<subseteq> S \<longrightarrow> lincomb a (insert xa F) \<bullet> x = (0::'a)
[PROOF STEP]
case (2 f F)
[PROOF STATE]
proof (state)
this:
finite F
f \<notin> F
F \<subseteq> S \<longrightarrow> lincomb a F \<bullet> x = (0::'a)

goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; F \<subseteq> S \<longrightarrow> lincomb a F \<bullet> x = (0::'a)\<rbrakk> \<Longrightarrow> insert xa F \<subseteq> S \<longrightarrow> lincomb a (insert xa F) \<bullet> x = (0::'a)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
finite F
f \<notin> F
F \<subseteq> S \<longrightarrow> lincomb a F \<bullet> x = (0::'a)

goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; F \<subseteq> S \<longrightarrow> lincomb a F \<bullet> x = (0::'a)\<rbrakk> \<Longrightarrow> insert xa F \<subseteq> S \<longrightarrow> lincomb a (insert xa F) \<bullet> x = (0::'a)
[PROOF STEP]
assume i:"insert f F \<subseteq> S"
[PROOF STATE]
proof (state)
this:
insert f F \<subseteq> S

goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; F \<subseteq> S \<longrightarrow> lincomb a F \<bullet> x = (0::'a)\<rbrakk> \<Longrightarrow> insert xa F \<subseteq> S \<longrightarrow> lincomb a (insert xa F) \<bullet> x = (0::'a)
[PROOF STEP]
hence F:"F \<subseteq> S" and f: "f \<in> S"
[PROOF STATE]
proof (prove)
using this:
insert f F \<subseteq> S

goal (1 subgoal):
 1. F \<subseteq> S &&& f \<in> S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
F \<subseteq> S
f \<in> S

goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; F \<subseteq> S \<longrightarrow> lincomb a F \<bullet> x = (0::'a)\<rbrakk> \<Longrightarrow> insert xa F \<subseteq> S \<longrightarrow> lincomb a (insert xa F) \<bullet> x = (0::'a)
[PROOF STEP]
from F f assms
[PROOF STATE]
proof (chain)
picking this:
F \<subseteq> S
f \<in> S
S \<subseteq> carrier_vec n
[PROOF STEP]
have [intro]:"F \<subseteq> carrier_vec n"
          and fc[intro]:"f \<in> carrier_vec n"
          and [intro]:"x \<in> F \<Longrightarrow> x \<in> carrier_vec n" for x
[PROOF STATE]
proof (prove)
using this:
F \<subseteq> S
f \<in> S
S \<subseteq> carrier_vec n

goal (1 subgoal):
 1. F \<subseteq> carrier_vec n &&& f \<in> carrier_vec n &&& (x \<in> F \<Longrightarrow> x \<in> carrier_vec n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
F \<subseteq> carrier_vec n
f \<in> carrier_vec n
?x1 \<in> F \<Longrightarrow> ?x1 \<in> carrier_vec n

goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; F \<subseteq> S \<longrightarrow> lincomb a F \<bullet> x = (0::'a)\<rbrakk> \<Longrightarrow> insert xa F \<subseteq> S \<longrightarrow> lincomb a (insert xa F) \<bullet> x = (0::'a)
[PROOF STEP]
have laf:"lincomb a F \<bullet> x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb a F \<bullet> x = (0::'a)
[PROOF STEP]
using F 2
[PROOF STATE]
proof (prove)
using this:
F \<subseteq> S
finite F
f \<notin> F
F \<subseteq> S \<longrightarrow> lincomb a F \<bullet> x = (0::'a)

goal (1 subgoal):
 1. lincomb a F \<bullet> x = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lincomb a F \<bullet> x = (0::'a)

goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; F \<subseteq> S \<longrightarrow> lincomb a F \<bullet> x = (0::'a)\<rbrakk> \<Longrightarrow> insert xa F \<subseteq> S \<longrightarrow> lincomb a (insert xa F) \<bullet> x = (0::'a)
[PROOF STEP]
have [simp]:"(\<Sum>u\<in>F. (a u \<cdot>\<^sub>v u) \<bullet> x) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>u\<in>F. (a u \<cdot>\<^sub>v u) \<bullet> x) = (0::'a)
[PROOF STEP]
by(insert laf[unfolded lincomb_def],atomize(full),subst finsum_scalar_prod_sum) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>u\<in>F. (a u \<cdot>\<^sub>v u) \<bullet> x) = (0::'a)

goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; F \<subseteq> S \<longrightarrow> lincomb a F \<bullet> x = (0::'a)\<rbrakk> \<Longrightarrow> insert xa F \<subseteq> S \<longrightarrow> lincomb a (insert xa F) \<bullet> x = (0::'a)
[PROOF STEP]
from f i0
[PROOF STATE]
proof (chain)
picking this:
f \<in> S
\<forall>y\<in>S. x \<bullet> y = (0::'a)
[PROOF STEP]
have [simp]:"f \<bullet> x = 0"
[PROOF STATE]
proof (prove)
using this:
f \<in> S
\<forall>y\<in>S. x \<bullet> y = (0::'a)

goal (1 subgoal):
 1. f \<bullet> x = (0::'a)
[PROOF STEP]
by (subst comm_scalar_prod) auto
[PROOF STATE]
proof (state)
this:
f \<bullet> x = (0::'a)

goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; F \<subseteq> S \<longrightarrow> lincomb a F \<bullet> x = (0::'a)\<rbrakk> \<Longrightarrow> insert xa F \<subseteq> S \<longrightarrow> lincomb a (insert xa F) \<bullet> x = (0::'a)
[PROOF STEP]
from lincomb_closed[OF subset_trans[OF i assms]]
[PROOF STATE]
proof (chain)
picking this:
lincomb ?a (insert f F) \<in> carrier_vec n
[PROOF STEP]
have "lincomb a (insert f F) \<bullet> x = 0"
[PROOF STATE]
proof (prove)
using this:
lincomb ?a (insert f F) \<in> carrier_vec n

goal (1 subgoal):
 1. lincomb a (insert f F) \<bullet> x = (0::'a)
[PROOF STEP]
unfolding lincomb_def
[PROOF STATE]
proof (prove)
using this:
(\<Oplus>\<^bsub>V\<^esub>v\<in>insert f F. ?a v \<cdot>\<^sub>v v) \<in> carrier_vec n

goal (1 subgoal):
 1. (\<Oplus>\<^bsub>V\<^esub>v\<in>insert f F. a v \<cdot>\<^sub>v v) \<bullet> x = (0::'a)
[PROOF STEP]
apply(subst finsum_scalar_prod_sum,force,force)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. (\<Oplus>\<^bsub>V\<^esub>v\<in>insert f F. a v \<cdot>\<^sub>v v) \<in> carrier_vec n) \<Longrightarrow> (\<Sum>u\<in>insert f F. (a u \<cdot>\<^sub>v u) \<bullet> x) = (0::'a)
[PROOF STEP]
using 2(1,2) smult_scalar_prod_distrib[OF fc x]
[PROOF STATE]
proof (prove)
using this:
finite F
f \<notin> F
(?a \<cdot>\<^sub>v f) \<bullet> x = ?a * (f \<bullet> x)

goal (1 subgoal):
 1. (\<And>a. (\<Oplus>\<^bsub>V\<^esub>v\<in>insert f F. a v \<cdot>\<^sub>v v) \<in> carrier_vec n) \<Longrightarrow> (\<Sum>u\<in>insert f F. (a u \<cdot>\<^sub>v u) \<bullet> x) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lincomb a (insert f F) \<bullet> x = (0::'a)

goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; F \<subseteq> S \<longrightarrow> lincomb a F \<bullet> x = (0::'a)\<rbrakk> \<Longrightarrow> insert xa F \<subseteq> S \<longrightarrow> lincomb a (insert xa F) \<bullet> x = (0::'a)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
insert f F \<subseteq> S \<Longrightarrow> lincomb a (insert f F) \<bullet> x = (0::'a)

goal (1 subgoal):
 1. \<And>xa F. \<lbrakk>finite F; xa \<notin> F; F \<subseteq> S \<longrightarrow> lincomb a F \<bullet> x = (0::'a)\<rbrakk> \<Longrightarrow> insert xa F \<subseteq> S \<longrightarrow> lincomb a (insert xa F) \<bullet> x = (0::'a)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
insert f F \<subseteq> S \<Longrightarrow> lincomb a (insert f F) \<bullet> x = (0::'a)

goal (1 subgoal):
 1. insert f F \<subseteq> S \<longrightarrow> lincomb a (insert f F) \<bullet> x = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insert f F \<subseteq> S \<longrightarrow> lincomb a (insert f F) \<bullet> x = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x \<bullet> lincomb a A = (0::'a)

goal (1 subgoal):
 1. orthogonal_complement S \<subseteq> orthogonal_complement (local.span S)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x3 \<in> carrier_vec n; finite ?A3; ?A3 \<subseteq> S; \<forall>y\<in>S. ?x3 \<bullet> y = (0::'a)\<rbrakk> \<Longrightarrow> ?x3 \<bullet> lincomb ?a3 ?A3 = (0::'a)

goal (1 subgoal):
 1. orthogonal_complement S \<subseteq> orthogonal_complement (local.span S)
[PROOF STEP]
thus "orthogonal_complement S \<subseteq> orthogonal_complement (span S)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x3 \<in> carrier_vec n; finite ?A3; ?A3 \<subseteq> S; \<forall>y\<in>S. ?x3 \<bullet> y = (0::'a)\<rbrakk> \<Longrightarrow> ?x3 \<bullet> lincomb ?a3 ?A3 = (0::'a)

goal (1 subgoal):
 1. orthogonal_complement S \<subseteq> orthogonal_complement (local.span S)
[PROOF STEP]
unfolding orthogonal_complement_def span_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x3 \<in> carrier_vec n; finite ?A3; ?A3 \<subseteq> S; \<forall>y\<in>S. ?x3 \<bullet> y = (0::'a)\<rbrakk> \<Longrightarrow> ?x3 \<bullet> lincomb ?a3 ?A3 = (0::'a)

goal (1 subgoal):
 1. {x \<in> carrier_vec n. \<forall>y\<in>S. x \<bullet> y = (0::'a)} \<subseteq> {x \<in> carrier_vec n. \<forall>y\<in>{lincomb a A |a A. finite A \<and> A \<subseteq> S}. x \<bullet> y = (0::'a)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
orthogonal_complement S \<subseteq> orthogonal_complement (local.span S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma additive_principal_omega: "additive_principal \<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. additive_principal \<omega>
[PROOF STEP]
apply (rule additive_principal.intro)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 < \<omega>
 2. \<And>b. b < \<omega> \<Longrightarrow> b + \<omega> = \<omega>
[PROOF STEP]
apply (rule zero_less_omega)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. b < \<omega> \<Longrightarrow> b + \<omega> = \<omega>
[PROOF STEP]
apply (drule less_omegaD, clarify)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b n. ordinal_of_nat n + \<omega> = \<omega>
[PROOF STEP]
apply (rule ordinal_of_nat_plus_omega)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma tan_Arctan:
  assumes "z\<^sup>2 \<noteq> -1"
    shows [simp]:"tan(Arctan z) = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tan (Arctan z) = z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. tan (Arctan z) = z
[PROOF STEP]
have "1 + \<i>*z \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + \<i> * z \<noteq> 0
[PROOF STEP]
by (metis assms complex_i_mult_minus i_squared minus_unique power2_eq_square power2_minus)
[PROOF STATE]
proof (state)
this:
1 + \<i> * z \<noteq> 0

goal (1 subgoal):
 1. tan (Arctan z) = z
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
1 + \<i> * z \<noteq> 0

goal (1 subgoal):
 1. tan (Arctan z) = z
[PROOF STEP]
have "1 - \<i>*z \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - \<i> * z \<noteq> 0
[PROOF STEP]
by (metis assms complex_i_mult_minus i_squared power2_eq_square power2_minus right_minus_eq)
[PROOF STATE]
proof (state)
this:
1 - \<i> * z \<noteq> 0

goal (1 subgoal):
 1. tan (Arctan z) = z
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
1 + \<i> * z \<noteq> 0
1 - \<i> * z \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 + \<i> * z \<noteq> 0
1 - \<i> * z \<noteq> 0

goal (1 subgoal):
 1. tan (Arctan z) = z
[PROOF STEP]
by (simp add: Arctan_def tan_def sin_exp_eq cos_exp_eq exp_minus csqrt_exp_Ln [symmetric]
                  divide_simps power2_eq_square [symmetric])
[PROOF STATE]
proof (state)
this:
tan (Arctan z) = z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_poly_horner_expand:
  "(\<Sum>k<(numeral n::nat). f k * x^k) = f 0 + (\<Sum>k<pred_numeral n. f (k+1) * x^k) * x"
  "(\<Sum>k<Suc 0. f k * x^k) = (f 0 :: 'a :: semiring_1)"
  "(\<Sum>k<(0::nat). f k * x^k) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x &&& (\<Sum>k<Suc 0. f k * x ^ k) = f 0 &&& (\<Sum>k<0. f k * x ^ k) = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x
 2. (\<Sum>k<Suc 0. f k * x ^ k) = f 0
 3. (\<Sum>k<0. f k * x ^ k) = (0::'a)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x
 2. (\<Sum>k<Suc 0. f k * x ^ k) = f 0
 3. (\<Sum>k<0. f k * x ^ k) = (0::'a)
[PROOF STEP]
fix m :: nat
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x
 2. (\<Sum>k<Suc 0. f k * x ^ k) = f 0
 3. (\<Sum>k<0. f k * x ^ k) = (0::'a)
[PROOF STEP]
have "(\<Sum>k<Suc m. f k * x^k) = f 0 + (\<Sum>k=Suc 0..<Suc m. f k * x^k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<Suc m. f k * x ^ k) = f 0 + (\<Sum>k = Suc 0..<Suc m. f k * x ^ k)
[PROOF STEP]
by (subst atLeast0LessThan [symmetric], subst sum.atLeast_Suc_lessThan) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>k<Suc m. f k * x ^ k) = f 0 + (\<Sum>k = Suc 0..<Suc m. f k * x ^ k)

goal (3 subgoals):
 1. (\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x
 2. (\<Sum>k<Suc 0. f k * x ^ k) = f 0
 3. (\<Sum>k<0. f k * x ^ k) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k<Suc m. f k * x ^ k) = f 0 + (\<Sum>k = Suc 0..<Suc m. f k * x ^ k)

goal (3 subgoals):
 1. (\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x
 2. (\<Sum>k<Suc 0. f k * x ^ k) = f 0
 3. (\<Sum>k<0. f k * x ^ k) = (0::'a)
[PROOF STEP]
have "(\<Sum>k=Suc 0..<Suc m. f k * x^k) = (\<Sum>k<m. f (k+1) * x^k) * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..<Suc m. f k * x ^ k) = (\<Sum>k<m. f (k + 1) * x ^ k) * x
[PROOF STEP]
by (subst sum.shift_bounds_Suc_ivl)
         (simp add: sum_distrib_right algebra_simps atLeast0LessThan power_commutes)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..<Suc m. f k * x ^ k) = (\<Sum>k<m. f (k + 1) * x ^ k) * x

goal (3 subgoals):
 1. (\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x
 2. (\<Sum>k<Suc 0. f k * x ^ k) = f 0
 3. (\<Sum>k<0. f k * x ^ k) = (0::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k<Suc m. f k * x ^ k) = f 0 + (\<Sum>k<m. f (k + 1) * x ^ k) * x
[PROOF STEP]
have "(\<Sum>k<Suc m. f k * x ^ k) = f 0 + (\<Sum>k<m. f (k + 1) * x ^ k) * x"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k<Suc m. f k * x ^ k) = f 0 + (\<Sum>k<m. f (k + 1) * x ^ k) * x

goal (1 subgoal):
 1. (\<Sum>k<Suc m. f k * x ^ k) = f 0 + (\<Sum>k<m. f (k + 1) * x ^ k) * x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>k<Suc m. f k * x ^ k) = f 0 + (\<Sum>k<m. f (k + 1) * x ^ k) * x

goal (3 subgoals):
 1. (\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x
 2. (\<Sum>k<Suc 0. f k * x ^ k) = f 0
 3. (\<Sum>k<0. f k * x ^ k) = (0::'a)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(\<Sum>k<Suc ?m2. f k * x ^ k) = f 0 + (\<Sum>k<?m2. f (k + 1) * x ^ k) * x

goal (3 subgoals):
 1. (\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x
 2. (\<Sum>k<Suc 0. f k * x ^ k) = f 0
 3. (\<Sum>k<0. f k * x ^ k) = (0::'a)
[PROOF STEP]
from this[of "pred_numeral n"]
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k<Suc (pred_numeral n). f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x
[PROOF STEP]
show "(\<Sum>k<numeral n. f k * x^k) = f 0 + (\<Sum>k<pred_numeral n. f (k+1) * x^k) * x"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k<Suc (pred_numeral n). f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x

goal (1 subgoal):
 1. (\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x
[PROOF STEP]
by (simp add: numeral_eq_Suc)
[PROOF STATE]
proof (state)
this:
(\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x

goal (2 subgoals):
 1. (\<Sum>k<Suc 0. f k * x ^ k) = f 0
 2. (\<Sum>k<0. f k * x ^ k) = (0::'a)
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma degree_offset_poly: "degree (offset_poly p h) = degree p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (offset_poly p h) = degree p
[PROOF STEP]
apply (induct p)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. degree (offset_poly 0 h) = degree 0
 2. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; degree (offset_poly p h) = degree p\<rbrakk> \<Longrightarrow> degree (offset_poly (pCons a p) h) = degree (pCons a p)
[PROOF STEP]
apply (simp add: offset_poly_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; degree (offset_poly p h) = degree p\<rbrakk> \<Longrightarrow> degree (offset_poly (pCons a p) h) = degree (pCons a p)
[PROOF STEP]
apply (case_tac "p = 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; degree (offset_poly p h) = degree p; p = 0\<rbrakk> \<Longrightarrow> degree (offset_poly (pCons a p) h) = degree (pCons a p)
 2. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; degree (offset_poly p h) = degree p; p \<noteq> 0\<rbrakk> \<Longrightarrow> degree (offset_poly (pCons a p) h) = degree (pCons a p)
[PROOF STEP]
apply (simp add: offset_poly_0 offset_poly_pCons)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; degree (offset_poly p h) = degree p; p \<noteq> 0\<rbrakk> \<Longrightarrow> degree (offset_poly (pCons a p) h) = degree (pCons a p)
[PROOF STEP]
apply (simp add: offset_poly_pCons)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a p. \<lbrakk>degree (offset_poly p h) = degree p; p \<noteq> 0\<rbrakk> \<Longrightarrow> degree (smult h (offset_poly p h) + pCons a (offset_poly p h)) = Suc (degree p)
[PROOF STEP]
apply (subst degree_add_eq_right)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a p. \<lbrakk>degree (offset_poly p h) = degree p; p \<noteq> 0\<rbrakk> \<Longrightarrow> degree (smult h (offset_poly p h)) < degree (pCons a (offset_poly p h))
 2. \<And>a p. \<lbrakk>degree (offset_poly p h) = degree p; p \<noteq> 0\<rbrakk> \<Longrightarrow> degree (pCons a (offset_poly p h)) = Suc (degree p)
[PROOF STEP]
apply (rule le_less_trans [OF degree_smult_le])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a p. \<lbrakk>degree (offset_poly p h) = degree p; p \<noteq> 0\<rbrakk> \<Longrightarrow> degree (offset_poly p h) < degree (pCons a (offset_poly p h))
 2. \<And>a p. \<lbrakk>degree (offset_poly p h) = degree p; p \<noteq> 0\<rbrakk> \<Longrightarrow> degree (pCons a (offset_poly p h)) = Suc (degree p)
[PROOF STEP]
apply (simp add: offset_poly_eq_0_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a p. \<lbrakk>degree (offset_poly p h) = degree p; p \<noteq> 0\<rbrakk> \<Longrightarrow> degree (pCons a (offset_poly p h)) = Suc (degree p)
[PROOF STEP]
apply (simp add: offset_poly_eq_0_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma count_roots_between_aux:
  assumes "a \<le> b"
  assumes "\<forall>x::real. a < x \<and> x \<le> b \<longrightarrow> eventually (\<lambda>\<xi>. f \<xi> = (f x::nat)) (at x)"
  shows "\<forall>x. a < x \<and> x \<le> b \<longrightarrow> f x = f b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. a < x \<and> x \<le> b \<longrightarrow> f x = f b
[PROOF STEP]
proof (clarify)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < x; x \<le> b\<rbrakk> \<Longrightarrow> f x = f b
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < x; x \<le> b\<rbrakk> \<Longrightarrow> f x = f b
[PROOF STEP]
assume "x > a" "x \<le> b"
[PROOF STATE]
proof (state)
this:
a < x
x \<le> b

goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < x; x \<le> b\<rbrakk> \<Longrightarrow> f x = f b
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
a \<le> b
\<forall>x. a < x \<and> x \<le> b \<longrightarrow> (\<forall>\<^sub>F \<xi> in at x. f \<xi> = f x)
a < x
x \<le> b
[PROOF STEP]
have "\<forall>x'. x \<le> x' \<and> x' \<le> b \<longrightarrow>
                       eventually (\<lambda>\<xi>. f \<xi> = f x') (at x')"
[PROOF STATE]
proof (prove)
using this:
a \<le> b
\<forall>x. a < x \<and> x \<le> b \<longrightarrow> (\<forall>\<^sub>F \<xi> in at x. f \<xi> = f x)
a < x
x \<le> b

goal (1 subgoal):
 1. \<forall>x'. x \<le> x' \<and> x' \<le> b \<longrightarrow> (\<forall>\<^sub>F \<xi> in at x'. f \<xi> = f x')
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x'. x \<le> x' \<and> x' \<le> b \<longrightarrow> (\<forall>\<^sub>F \<xi> in at x'. f \<xi> = f x')

goal (1 subgoal):
 1. \<And>x. \<lbrakk>a < x; x \<le> b\<rbrakk> \<Longrightarrow> f x = f b
[PROOF STEP]
from fun_eq_in_ivl[OF \<open>x \<le> b\<close> this]
[PROOF STATE]
proof (chain)
picking this:
f x = f b
[PROOF STEP]
show "f x = f b"
[PROOF STATE]
proof (prove)
using this:
f x = f b

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_on_exp [continuous_intros]: "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. exp (f x))"
  for f :: "_ \<Rightarrow>'a::{real_normed_field,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. exp (f x))
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>s. (f \<longlongrightarrow> f x) (at x within s) \<Longrightarrow> \<forall>x\<in>s. ((\<lambda>x. exp (f x)) \<longlongrightarrow> exp (f x)) (at x within s)
[PROOF STEP]
by (auto intro: tendsto_exp)


[STATEMENT]
lemma cartesian_power_car_memI:
  assumes "length as = n"
  assumes "set as \<subseteq> carrier R"
  shows "as \<in> carrier (R\<^bsup>n\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. as \<in> carrier (R\<^bsup>n\<^esup>)
[PROOF STEP]
unfolding cartesian_power_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. as \<in> carrier (RDirProd_list (R_list n R))
[PROOF STEP]
apply(rule RDirProd_list_carrier_memI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. length as = length (R_list n R)
 2. \<And>i. i < length (R_list n R) \<Longrightarrow> as ! i \<in> carrier (R_list n R ! i)
[PROOF STEP]
using R_list_length assms(1)
[PROOF STATE]
proof (prove)
using this:
length (R_list ?n ?R) = ?n
length as = n

goal (2 subgoals):
 1. length as = length (R_list n R)
 2. \<And>i. i < length (R_list n R) \<Longrightarrow> as ! i \<in> carrier (R_list n R ! i)
[PROOF STEP]
apply auto[1]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < length (R_list n R) \<Longrightarrow> as ! i \<in> carrier (R_list n R ! i)
[PROOF STEP]
by (metis R_list_length R_list_nth assms(1) assms(2) nth_mem subsetD)


[STATEMENT]
lemma (in Corps) valuations_eqTr1:"\<lbrakk>valuation K v; valuation K v';
 Vr K v = Vr K v'; \<forall>x\<in>carrier (Vr K v). v x = v' x\<rbrakk> \<Longrightarrow> v = v'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valuation K v; valuation K v'; Vr K v = Vr K v'; \<forall>x\<in>carrier (Vr K v). v x = v' x\<rbrakk> \<Longrightarrow> v = v'
[PROOF STEP]
apply (rule funcset_eq [of _  "carrier K"],
       simp add:valuation_def, simp add:valuation_def,
       rule ballI,
       frule_tac x = x in frac_Vr_is_K[of v], assumption+,
        (erule bexE)+, simp, erule conjE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x s t. \<lbrakk>valuation K v; valuation K v'; Vr K v = Vr K v'; \<forall>x\<in>carrier (Vr K v'). v x = v' x; s \<cdot>\<^sub>r t\<^bsup>\<hyphen> K\<^esup> \<in> carrier K; s \<in> carrier (Vr K v'); x = s \<cdot>\<^sub>r t\<^bsup>\<hyphen> K\<^esup>; t \<in> carrier (Vr K v'); t \<noteq> \<zero>\<rbrakk> \<Longrightarrow> v (s \<cdot>\<^sub>r t\<^bsup>\<hyphen> K\<^esup>) = v' (s \<cdot>\<^sub>r t\<^bsup>\<hyphen> K\<^esup>)
[PROOF STEP]
apply (frule_tac x = t in Vr_mem_f_mem[of v'], assumption,
       cut_tac x = t in invf_closed1, simp, simp, erule conjE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x s t. \<lbrakk>valuation K v; valuation K v'; Vr K v = Vr K v'; \<forall>x\<in>carrier (Vr K v'). v x = v' x; s \<cdot>\<^sub>r t\<^bsup>\<hyphen> K\<^esup> \<in> carrier K; s \<in> carrier (Vr K v'); x = s \<cdot>\<^sub>r t\<^bsup>\<hyphen> K\<^esup>; t \<in> carrier (Vr K v'); t \<noteq> \<zero>; t \<in> carrier K; t\<^bsup>\<hyphen> K\<^esup> \<in> carrier K; t\<^bsup>\<hyphen> K\<^esup> \<noteq> \<zero>\<rbrakk> \<Longrightarrow> v (s \<cdot>\<^sub>r t\<^bsup>\<hyphen> K\<^esup>) = v' (s \<cdot>\<^sub>r t\<^bsup>\<hyphen> K\<^esup>)
[PROOF STEP]
apply (frule_tac x = s in Vr_mem_f_mem[of "v'"], assumption+,
       simp add:val_t2p, simp add:value_of_inv)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma mset_diff_cancel1elem[simp]: "~(a \<in># B) \<Longrightarrow> {#a#}-B = {#a#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<notin># B \<Longrightarrow> {#a#} - B = {#a#}
[PROOF STEP]
by (auto simp add: not_in_iff intro!: multiset_eqI)


[STATEMENT]
lemma splitting_permutation_case_3_exists:
  assumes "i \<le> l1"
  assumes "l2 + i \<le> y \<and> y < l1 + l2"
  shows "splitting_permutation l1 l2 i (y - l2) = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. splitting_permutation l1 l2 i (y - l2) = y
[PROOF STEP]
unfolding splitting_permutation_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if y - l2 < i then y - l2 else if i \<le> y - l2 \<and> y - l2 < l1 then l2 + (y - l2) else if y - l2 < l1 + l2 then y - l2 - l1 + i else y - l2) = y
[PROOF STEP]
by (metis Nat.le_diff_conv2 add.commute add_leD1 assms(2) leD le_add_diff_inverse less_diff_conv2)


[STATEMENT]
lemma squarefree_prime_elem [simp, intro]:
  fixes p :: "'a :: algebraic_semidom"
  assumes "prime_elem p"
  shows   "squarefree p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. squarefree p
[PROOF STEP]
proof (rule squarefreeI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x\<^sup>2 dvd p \<Longrightarrow> is_unit x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x\<^sup>2 dvd p \<Longrightarrow> is_unit x
[PROOF STEP]
assume "x\<^sup>2 dvd p"
[PROOF STATE]
proof (state)
this:
x\<^sup>2 dvd p

goal (1 subgoal):
 1. \<And>x. x\<^sup>2 dvd p \<Longrightarrow> is_unit x
[PROOF STEP]
show "is_unit x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_unit x
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> is_unit x \<Longrightarrow> False
[PROOF STEP]
assume "\<not>is_unit x"
[PROOF STATE]
proof (state)
this:
\<not> is_unit x

goal (1 subgoal):
 1. \<not> is_unit x \<Longrightarrow> False
[PROOF STEP]
hence "\<not>is_unit (x\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
\<not> is_unit x

goal (1 subgoal):
 1. \<not> is_unit (x\<^sup>2)
[PROOF STEP]
by (simp add: is_unit_power_iff)
[PROOF STATE]
proof (state)
this:
\<not> is_unit (x\<^sup>2)

goal (1 subgoal):
 1. \<not> is_unit x \<Longrightarrow> False
[PROOF STEP]
from assms and this and \<open>x\<^sup>2 dvd p\<close>
[PROOF STATE]
proof (chain)
picking this:
prime_elem p
\<not> is_unit (x\<^sup>2)
x\<^sup>2 dvd p
[PROOF STEP]
have "prime_elem (x\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
prime_elem p
\<not> is_unit (x\<^sup>2)
x\<^sup>2 dvd p

goal (1 subgoal):
 1. prime_elem (x\<^sup>2)
[PROOF STEP]
by (rule prime_elem_mono)
[PROOF STATE]
proof (state)
this:
prime_elem (x\<^sup>2)

goal (1 subgoal):
 1. \<not> is_unit x \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
prime_elem (x\<^sup>2)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
is_unit x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma row_index: assumes m: "mat nr nc m"
  and i: "i < nr"
  shows "row m i = map (\<lambda> j. m ! j ! i) [0 ..< nc]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row m i = map (\<lambda>j. m ! j ! i) [0..<nc]
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. row m i = map (\<lambda>j. m ! j ! i) [0..<nc]
[PROOF STEP]
note rc = row_col[OF m i]
[PROOF STATE]
proof (state)
this:
?j < nc \<Longrightarrow> row m i ! ?j = col m ?j ! i

goal (1 subgoal):
 1. row m i = map (\<lambda>j. m ! j ! i) [0..<nc]
[PROOF STEP]
from row[OF m i]
[PROOF STATE]
proof (chain)
picking this:
vec nc (row m i)
[PROOF STEP]
have id: "length (row m i) = nc"
[PROOF STATE]
proof (prove)
using this:
vec nc (row m i)

goal (1 subgoal):
 1. length (row m i) = nc
[PROOF STEP]
unfolding vec_def
[PROOF STATE]
proof (prove)
using this:
length (row m i) = nc

goal (1 subgoal):
 1. length (row m i) = nc
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (row m i) = nc

goal (1 subgoal):
 1. row m i = map (\<lambda>j. m ! j ! i) [0..<nc]
[PROOF STEP]
from map_nth[of "row m i"]
[PROOF STATE]
proof (chain)
picking this:
map ((!) (row m i)) [0..<length (row m i)] = row m i
[PROOF STEP]
have "row m i = map (\<lambda> j. row m i ! j) [0 ..< nc]"
[PROOF STATE]
proof (prove)
using this:
map ((!) (row m i)) [0..<length (row m i)] = row m i

goal (1 subgoal):
 1. row m i = map ((!) (row m i)) [0..<nc]
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
using this:
map ((!) (row m i)) [0..<nc] = row m i

goal (1 subgoal):
 1. row m i = map ((!) (row m i)) [0..<nc]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
row m i = map ((!) (row m i)) [0..<nc]

goal (1 subgoal):
 1. row m i = map (\<lambda>j. m ! j ! i) [0..<nc]
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
row m i = map ((!) (row m i)) [0..<nc]

goal (1 subgoal):
 1. row m i = map (\<lambda>j. m ! j ! i) [0..<nc]
[PROOF STEP]
have "... = map (\<lambda> j. m ! j ! i) [0 ..< nc]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map ((!) (row m i)) [0..<nc] = map (\<lambda>j. m ! j ! i) [0..<nc]
[PROOF STEP]
using rc[unfolded col_def]
[PROOF STATE]
proof (prove)
using this:
?j < nc \<Longrightarrow> row m i ! ?j = m ! ?j ! i

goal (1 subgoal):
 1. map ((!) (row m i)) [0..<nc] = map (\<lambda>j. m ! j ! i) [0..<nc]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
map ((!) (row m i)) [0..<nc] = map (\<lambda>j. m ! j ! i) [0..<nc]

goal (1 subgoal):
 1. row m i = map (\<lambda>j. m ! j ! i) [0..<nc]
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
row m i = map (\<lambda>j. m ! j ! i) [0..<nc]
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
row m i = map (\<lambda>j. m ! j ! i) [0..<nc]

goal (1 subgoal):
 1. row m i = map (\<lambda>j. m ! j ! i) [0..<nc]
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
row m i = map (\<lambda>j. m ! j ! i) [0..<nc]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma complex_nonpos_Reals_iff: "z \<in> \<real>\<^sub>\<le>\<^sub>0 \<longleftrightarrow> Re z \<le> 0 \<and> Im z = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (z \<in> \<real>\<^sub>\<le>\<^sub>0) = (Re z \<le> 0 \<and> Im z = 0)
[PROOF STEP]
using complex_is_Real_iff
[PROOF STATE]
proof (prove)
using this:
(?z \<in> \<real>) = (Im ?z = 0)

goal (1 subgoal):
 1. (z \<in> \<real>\<^sub>\<le>\<^sub>0) = (Re z \<le> 0 \<and> Im z = 0)
[PROOF STEP]
by (force simp add: nonpos_Reals_def)


[STATEMENT]
lemma RECT_refine[refine]:
  assumes M: "trimono body"
  assumes R0: "(x,x')\<in>R"
  assumes RS: "\<And>f f' x x'. \<lbrakk> \<And>x x'. (x,x')\<in>R \<Longrightarrow> f x \<le>\<Down>S (f' x'); (x,x')\<in>R \<rbrakk>
    \<Longrightarrow> body f x \<le>\<Down>S (body' f' x')"
  shows "RECT (\<lambda>f x. body f x) x \<le>\<Down>S (RECT (\<lambda>f' x'. body' f' x') x')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. REC\<^sub>T body x \<le> \<Down> S (REC\<^sub>T body' x')
[PROOF STEP]
unfolding RECT_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if trimono body then flatf_gfp body x else FAIL) \<le> \<Down> S (if trimono body' then flatf_gfp body' x' else FAIL)
[PROOF STEP]
apply (clarsimp simp add: M)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trimono body' \<Longrightarrow> flatf_gfp body x \<le> \<Down> S (flatf_gfp body' x')
[PROOF STEP]
apply (rule flatf_fixp_transfer[where
        fp'="flatf_gfp body"
    and B'=body
    and P="\<lambda>x x'. (x',x)\<in>R",
    OF _ _ flatf_ord.fixp_unfold[OF M[THEN trimonoD_flatf_ge]] R0])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x'. trimono body' \<Longrightarrow> x' \<le> \<Down> S FAIL
 2. trimono body' \<Longrightarrow> flatf_mono FAIL body'
 3. \<And>f f' x x'. \<lbrakk>trimono body'; \<And>x x'. (x', x) \<in> R \<Longrightarrow> f' x' \<le> \<Down> S (f x); (x', x) \<in> R; flatf_gfp body = f'\<rbrakk> \<Longrightarrow> body f' x' \<le> \<Down> S (body' f x)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. trimono body' \<Longrightarrow> flatf_mono FAIL body'
 2. \<And>f f' x x'. \<lbrakk>trimono body'; \<And>x x'. (x', x) \<in> R \<Longrightarrow> f' x' \<le> \<Down> S (f x); (x', x) \<in> R; flatf_gfp body = f'\<rbrakk> \<Longrightarrow> body f' x' \<le> \<Down> S (body' f x)
[PROOF STEP]
apply (simp add: trimonoD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f f' x x'. \<lbrakk>trimono body'; \<And>x x'. (x', x) \<in> R \<Longrightarrow> f' x' \<le> \<Down> S (f x); (x', x) \<in> R; flatf_gfp body = f'\<rbrakk> \<Longrightarrow> body f' x' \<le> \<Down> S (body' f x)
[PROOF STEP]
by (rule RS)


[STATEMENT]
lemma minus_in_interval:
  fixes x y :: "'a :: ordered_ab_group_add"
  shows "x \<in>\<^sub>i X \<Longrightarrow> y \<in>\<^sub>i Y \<Longrightarrow> x - y \<in>\<^sub>i X - Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in>\<^sub>i X; y \<in>\<^sub>i Y\<rbrakk> \<Longrightarrow> x - y \<in>\<^sub>i X - Y
[PROOF STEP]
by (cases X, cases Y, auto dest:diff_mono)


[STATEMENT]
lemma sum_list_inc_eq_sum_list_Suc:
  assumes "length u = length y" and "i < length y"
    and "\<exists>j\<ge>i. j < length y \<and> u ! j < y ! j"
  shows "sum_list (inc y i u) = Suc (sum_list u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (inc y i u) = Suc (sum_list u)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length u = length y
i < length y
\<exists>j\<ge>i. j < length y \<and> u ! j < y ! j

goal (1 subgoal):
 1. sum_list (inc y i u) = Suc (sum_list u)
[PROOF STEP]
by (induct y i u rule: inc.induct)
    (metis  inc.simps Suc_eq_plus1 Suc_leI antisym_conv2 leD sum_list_list_update_Suc)


[STATEMENT]
lemma content_ff_divides_ff: "x \<in> set (coeffs p) \<Longrightarrow> divides_ff (content_ff p) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> set (coeffs p) \<Longrightarrow> divides_ff (content_ff p) x
[PROOF STEP]
unfolding content_ff_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> set (coeffs p) \<Longrightarrow> divides_ff (some_gcd_ff_list (coeffs p)) x
[PROOF STEP]
by (rule some_gcd_ff_list_divides)


[STATEMENT]
theorem list_upd_lemma [simp]: \<open>list_all (\<lambda>p. n \<notin> params p) G \<Longrightarrow>
  list_all (eval e (f(n := x)) g) G = list_all (eval e f g) G\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all (\<lambda>p. n \<notin> params p) G \<Longrightarrow> list_all (eval e (f(n := x)) g) G = list_all (eval e f g) G
[PROOF STEP]
by (induct G) simp_all


[STATEMENT]
lemma matrix_point_not_in_block_iff: "i < \<v> \<Longrightarrow> j < \<b> \<Longrightarrow> N $$ (i, j) = 0 \<longleftrightarrow> \<V>s ! i \<notin> \<B>s ! j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < \<v>; j < \<b>\<rbrakk> \<Longrightarrow> (N $$ (i, j) = 0) = (\<V>s ! i \<notin> \<B>s ! j)
[PROOF STEP]
by (metis blocks_list_length points_list_length inc_matrix_point_not_in_block_iff)


[STATEMENT]
lemma sum'_nat_eq_0_iff:
  fixes f :: "'a \<Rightarrow> nat"
  assumes "finite {i \<in> A. f i \<noteq> 0}"
  assumes "sum' f A = 0"
  shows "\<And>i. i \<in> A \<Longrightarrow> f i = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> A \<Longrightarrow> f i = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> A \<Longrightarrow> f i = 0
[PROOF STEP]
let ?B = "{i \<in> A. f i \<noteq> 0}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> A \<Longrightarrow> f i = 0
[PROOF STEP]
have "sum f ?B = sum' f ?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {i \<in> A. f i \<noteq> 0} = sum' f {i \<in> A. f i \<noteq> 0}
[PROOF STEP]
by (intro sum.eq_sum[symmetric] assms(1))
[PROOF STATE]
proof (state)
this:
sum f {i \<in> A. f i \<noteq> 0} = sum' f {i \<in> A. f i \<noteq> 0}

goal (1 subgoal):
 1. \<And>i. i \<in> A \<Longrightarrow> f i = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum f {i \<in> A. f i \<noteq> 0} = sum' f {i \<in> A. f i \<noteq> 0}

goal (1 subgoal):
 1. \<And>i. i \<in> A \<Longrightarrow> f i = 0
[PROOF STEP]
have "... = sum' f A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum' f {i \<in> A. f i \<noteq> 0} = sum' f A
[PROOF STEP]
by (intro sum.non_neutral')
[PROOF STATE]
proof (state)
this:
sum' f {i \<in> A. f i \<noteq> 0} = sum' f A

goal (1 subgoal):
 1. \<And>i. i \<in> A \<Longrightarrow> f i = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum' f {i \<in> A. f i \<noteq> 0} = sum' f A

goal (1 subgoal):
 1. \<And>i. i \<in> A \<Longrightarrow> f i = 0
[PROOF STEP]
have "... = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum' f A = 0
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
sum' f A = 0

goal (1 subgoal):
 1. sum' f A = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum' f A = 0

goal (1 subgoal):
 1. \<And>i. i \<in> A \<Longrightarrow> f i = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum f {i \<in> A. f i \<noteq> 0} = 0
[PROOF STEP]
have a:"sum f ?B = 0"
[PROOF STATE]
proof (prove)
using this:
sum f {i \<in> A. f i \<noteq> 0} = 0

goal (1 subgoal):
 1. sum f {i \<in> A. f i \<noteq> 0} = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f {i \<in> A. f i \<noteq> 0} = 0

goal (1 subgoal):
 1. \<And>i. i \<in> A \<Longrightarrow> f i = 0
[PROOF STEP]
have "\<And>i. i \<in> ?B \<Longrightarrow> f i = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> {i \<in> A. f i \<noteq> 0} \<Longrightarrow> f i = 0
[PROOF STEP]
using sum_nonneg_0[OF assms(1) _ a]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>i. i \<in> {i \<in> A. f i \<noteq> 0} \<Longrightarrow> 0 \<le> f i; ?i \<in> {i \<in> A. f i \<noteq> 0}\<rbrakk> \<Longrightarrow> f ?i = 0

goal (1 subgoal):
 1. \<And>i. i \<in> {i \<in> A. f i \<noteq> 0} \<Longrightarrow> f i = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?i \<in> {i \<in> A. f i \<noteq> 0} \<Longrightarrow> f ?i = 0

goal (1 subgoal):
 1. \<And>i. i \<in> A \<Longrightarrow> f i = 0
[PROOF STEP]
thus "\<And>i. i \<in> A \<Longrightarrow> f i = 0"
[PROOF STATE]
proof (prove)
using this:
?i \<in> {i \<in> A. f i \<noteq> 0} \<Longrightarrow> f ?i = 0

goal (1 subgoal):
 1. \<And>i. i \<in> A \<Longrightarrow> f i = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?i \<in> A \<Longrightarrow> f ?i = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_map_closed:
  assumes "is_poly_tuple n fs"
  assumes "length fs = m"
  assumes "as \<in> carrier (R\<^bsup>n\<^esup>)"
  shows "poly_map n fs as \<in> carrier (R\<^bsup>m\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_map n fs as \<in> carrier (R\<^bsup>m\<^esup>)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_poly_tuple n fs
length fs = m
as \<in> carrier (R\<^bsup>n\<^esup>)

goal (1 subgoal):
 1. poly_map n fs as \<in> carrier (R\<^bsup>m\<^esup>)
[PROOF STEP]
by (meson poly_map_is_struct_map struct_maps_memE(1))


[STATEMENT]
lemma same_val_if_reduced:
  "reduced t X \<Longrightarrow> \<forall>x. x \<notin> X \<longrightarrow> s1 x = s2 x \<Longrightarrow> val_ifex t s1 = val_ifex t s2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>reduced t X; \<forall>x. x \<notin> X \<longrightarrow> s1 x = s2 x\<rbrakk> \<Longrightarrow> val_ifex t s1 = val_ifex t s2
[PROOF STEP]
by (induction t arbitrary: X) auto


[STATEMENT]
lemma harm_expansion_bigo:
  fixes N :: nat
  defines "T \<equiv> \<lambda>n. ln n + euler_mascheroni + 1 / (2*n) -
                     (\<Sum>i=1..N. bernoulli (2*i) / ((2*i) * n ^ (2*i)))"
  defines "S \<equiv> (\<lambda>n. bernoulli (2*(Suc N)) / ((2*Suc N) * real n ^ (2*Suc N)))"
  shows "(\<lambda>n. harm n - T n) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. harm n - T n) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. harm n - T n) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))
[PROOF STEP]
have "(\<lambda>n. harm n - T n) \<in> \<Theta>(\<lambda>n. -S n - harm_remainder (Suc N) n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. harm n - T n) \<in> \<Theta>(\<lambda>n. - S n - harm_remainder (Suc N) n)
[PROOF STEP]
by (intro bigthetaI_cong eventually_mono[OF eventually_gt_at_top[of "0::nat"]])
       (auto simp: T_def harm_expansion[of _ "Suc N"] S_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. harm n - T n) \<in> \<Theta>(\<lambda>n. - S n - harm_remainder (Suc N) n)

goal (1 subgoal):
 1. (\<lambda>n. harm n - T n) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. harm n - T n) \<in> \<Theta>(\<lambda>n. - S n - harm_remainder (Suc N) n)

goal (1 subgoal):
 1. (\<lambda>n. harm n - T n) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))
[PROOF STEP]
have "(\<lambda>n. -S n - harm_remainder (Suc N) n) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. - S n - harm_remainder (Suc N) n) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))
[PROOF STEP]
proof (intro sum_in_bigo)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>x. - S x) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))
 2. harm_remainder (Suc N) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))
[PROOF STEP]
show "(\<lambda>x. - S x) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. - S x) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))
[PROOF STEP]
unfolding S_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. - (bernoulli (2 * Suc N) / (real (2 * Suc N) * real x ^ (2 * Suc N)))) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))
[PROOF STEP]
by (rule landau_o.big.compose[OF _ filterlim_real_sequentially]) simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. - S x) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))

goal (1 subgoal):
 1. harm_remainder (Suc N) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))
[PROOF STEP]
have "harm_remainder (Suc N) \<in> O(\<lambda>n. 1 / real n ^ (2 * Suc N + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. harm_remainder (Suc N) \<in> O(\<lambda>n. 1 / real n ^ (2 * Suc N + 1))
[PROOF STEP]
by (rule harm_remainder_bigo) simp_all
[PROOF STATE]
proof (state)
this:
harm_remainder (Suc N) \<in> O(\<lambda>n. 1 / real n ^ (2 * Suc N + 1))

goal (1 subgoal):
 1. harm_remainder (Suc N) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
harm_remainder (Suc N) \<in> O(\<lambda>n. 1 / real n ^ (2 * Suc N + 1))

goal (1 subgoal):
 1. harm_remainder (Suc N) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))
[PROOF STEP]
have "(\<lambda>n. 1 / real n ^ (2 * Suc N + 1)) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 1 / real n ^ (2 * Suc N + 1)) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))
[PROOF STEP]
by (rule landau_o.big.compose[OF _ filterlim_real_sequentially]) simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 1 / real n ^ (2 * Suc N + 1)) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))

goal (1 subgoal):
 1. harm_remainder (Suc N) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
harm_remainder (Suc N) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))
[PROOF STEP]
show "harm_remainder (Suc N) \<in> \<dots>"
[PROOF STATE]
proof (prove)
using this:
harm_remainder (Suc N) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))

goal (1 subgoal):
 1. harm_remainder (Suc N) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
harm_remainder (Suc N) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - S n - harm_remainder (Suc N) n) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))

goal (1 subgoal):
 1. (\<lambda>n. harm n - T n) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. harm n - T n) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. harm n - T n) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))

goal (1 subgoal):
 1. (\<lambda>n. harm n - T n) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>n. harm n - T n) \<in> O(\<lambda>n. 1 / real n ^ (2 * N + 2))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma even_iff_word_of:
  \<open>2 dvd p \<longleftrightarrow> 2 dvd word_of p\<close> (is \<open>?P \<longleftrightarrow> ?Q\<close>)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((2::'a) dvd p) = even (word_of p)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (2::'a) dvd p \<Longrightarrow> even (word_of p)
 2. even (word_of p) \<Longrightarrow> (2::'a) dvd p
[PROOF STEP]
assume ?P
[PROOF STATE]
proof (state)
this:
(2::'a) dvd p

goal (2 subgoals):
 1. (2::'a) dvd p \<Longrightarrow> even (word_of p)
 2. even (word_of p) \<Longrightarrow> (2::'a) dvd p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(2::'a) dvd p
[PROOF STEP]
obtain q where \<open>p = 2 * q\<close>
[PROOF STATE]
proof (prove)
using this:
(2::'a) dvd p

goal (1 subgoal):
 1. (\<And>q. p = (2::'a) * q \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
p = (2::'a) * q

goal (2 subgoals):
 1. (2::'a) dvd p \<Longrightarrow> even (word_of p)
 2. even (word_of p) \<Longrightarrow> (2::'a) dvd p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p = (2::'a) * q
[PROOF STEP]
show ?Q
[PROOF STATE]
proof (prove)
using this:
p = (2::'a) * q

goal (1 subgoal):
 1. even (word_of p)
[PROOF STEP]
by (simp add: word_of_mult)
[PROOF STATE]
proof (state)
this:
even (word_of p)

goal (1 subgoal):
 1. even (word_of p) \<Longrightarrow> (2::'a) dvd p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. even (word_of p) \<Longrightarrow> (2::'a) dvd p
[PROOF STEP]
assume ?Q
[PROOF STATE]
proof (state)
this:
even (word_of p)

goal (1 subgoal):
 1. even (word_of p) \<Longrightarrow> (2::'a) dvd p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
even (word_of p)
[PROOF STEP]
obtain w where \<open>word_of p = 2 * w\<close>
[PROOF STATE]
proof (prove)
using this:
even (word_of p)

goal (1 subgoal):
 1. (\<And>w. word_of p = 2 * w \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
word_of p = 2 * w

goal (1 subgoal):
 1. even (word_of p) \<Longrightarrow> (2::'a) dvd p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
word_of p = 2 * w
[PROOF STEP]
have \<open>of_word (word_of p) = of_word (2 * w)\<close>
[PROOF STATE]
proof (prove)
using this:
word_of p = 2 * w

goal (1 subgoal):
 1. of_word (word_of p) = of_word (2 * w)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
of_word (word_of p) = of_word (2 * w)

goal (1 subgoal):
 1. even (word_of p) \<Longrightarrow> (2::'a) dvd p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
of_word (word_of p) = of_word (2 * w)
[PROOF STEP]
have \<open>p = 2 * of_word w\<close>
[PROOF STATE]
proof (prove)
using this:
of_word (word_of p) = of_word (2 * w)

goal (1 subgoal):
 1. p = (2::'a) * of_word w
[PROOF STEP]
by (simp add: eq_iff_word_of word_of_word word_of_mult)
[PROOF STATE]
proof (state)
this:
p = (2::'a) * of_word w

goal (1 subgoal):
 1. even (word_of p) \<Longrightarrow> (2::'a) dvd p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p = (2::'a) * of_word w
[PROOF STEP]
show ?P
[PROOF STATE]
proof (prove)
using this:
p = (2::'a) * of_word w

goal (1 subgoal):
 1. (2::'a) dvd p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(2::'a) dvd p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_poly_horner_expand:
  "(\<Sum>k<(numeral n::nat). f k * x^k) = f 0 + (\<Sum>k<pred_numeral n. f (k+1) * x^k) * x"
  "(\<Sum>k<Suc 0. f k * x^k) = (f 0 :: 'a :: semiring_1)"
  "(\<Sum>k<(0::nat). f k * x^k) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x &&& (\<Sum>k<Suc 0. f k * x ^ k) = f 0 &&& (\<Sum>k<0. f k * x ^ k) = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x
 2. (\<Sum>k<Suc 0. f k * x ^ k) = f 0
 3. (\<Sum>k<0. f k * x ^ k) = (0::'a)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x
 2. (\<Sum>k<Suc 0. f k * x ^ k) = f 0
 3. (\<Sum>k<0. f k * x ^ k) = (0::'a)
[PROOF STEP]
fix m :: nat
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x
 2. (\<Sum>k<Suc 0. f k * x ^ k) = f 0
 3. (\<Sum>k<0. f k * x ^ k) = (0::'a)
[PROOF STEP]
have "(\<Sum>k<Suc m. f k * x^k) = f 0 + (\<Sum>k=Suc 0..<Suc m. f k * x^k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<Suc m. f k * x ^ k) = f 0 + (\<Sum>k = Suc 0..<Suc m. f k * x ^ k)
[PROOF STEP]
by (subst atLeast0LessThan [symmetric], subst sum.atLeast_Suc_lessThan) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>k<Suc m. f k * x ^ k) = f 0 + (\<Sum>k = Suc 0..<Suc m. f k * x ^ k)

goal (3 subgoals):
 1. (\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x
 2. (\<Sum>k<Suc 0. f k * x ^ k) = f 0
 3. (\<Sum>k<0. f k * x ^ k) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k<Suc m. f k * x ^ k) = f 0 + (\<Sum>k = Suc 0..<Suc m. f k * x ^ k)

goal (3 subgoals):
 1. (\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x
 2. (\<Sum>k<Suc 0. f k * x ^ k) = f 0
 3. (\<Sum>k<0. f k * x ^ k) = (0::'a)
[PROOF STEP]
have "(\<Sum>k=Suc 0..<Suc m. f k * x^k) = (\<Sum>k<m. f (k+1) * x^k) * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = Suc 0..<Suc m. f k * x ^ k) = (\<Sum>k<m. f (k + 1) * x ^ k) * x
[PROOF STEP]
by (subst sum.shift_bounds_Suc_ivl)
         (simp add: sum_distrib_right algebra_simps atLeast0LessThan power_commutes)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = Suc 0..<Suc m. f k * x ^ k) = (\<Sum>k<m. f (k + 1) * x ^ k) * x

goal (3 subgoals):
 1. (\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x
 2. (\<Sum>k<Suc 0. f k * x ^ k) = f 0
 3. (\<Sum>k<0. f k * x ^ k) = (0::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k<Suc m. f k * x ^ k) = f 0 + (\<Sum>k<m. f (k + 1) * x ^ k) * x
[PROOF STEP]
have "(\<Sum>k<Suc m. f k * x ^ k) = f 0 + (\<Sum>k<m. f (k + 1) * x ^ k) * x"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k<Suc m. f k * x ^ k) = f 0 + (\<Sum>k<m. f (k + 1) * x ^ k) * x

goal (1 subgoal):
 1. (\<Sum>k<Suc m. f k * x ^ k) = f 0 + (\<Sum>k<m. f (k + 1) * x ^ k) * x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>k<Suc m. f k * x ^ k) = f 0 + (\<Sum>k<m. f (k + 1) * x ^ k) * x

goal (3 subgoals):
 1. (\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x
 2. (\<Sum>k<Suc 0. f k * x ^ k) = f 0
 3. (\<Sum>k<0. f k * x ^ k) = (0::'a)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(\<Sum>k<Suc ?m2. f k * x ^ k) = f 0 + (\<Sum>k<?m2. f (k + 1) * x ^ k) * x

goal (3 subgoals):
 1. (\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x
 2. (\<Sum>k<Suc 0. f k * x ^ k) = f 0
 3. (\<Sum>k<0. f k * x ^ k) = (0::'a)
[PROOF STEP]
from this[of "pred_numeral n"]
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k<Suc (pred_numeral n). f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x
[PROOF STEP]
show "(\<Sum>k<numeral n. f k * x^k) = f 0 + (\<Sum>k<pred_numeral n. f (k+1) * x^k) * x"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k<Suc (pred_numeral n). f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x

goal (1 subgoal):
 1. (\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x
[PROOF STEP]
by (simp add: numeral_eq_Suc)
[PROOF STATE]
proof (state)
this:
(\<Sum>k<numeral n. f k * x ^ k) = f 0 + (\<Sum>k<pred_numeral n. f (k + 1) * x ^ k) * x

goal (2 subgoals):
 1. (\<Sum>k<Suc 0. f k * x ^ k) = f 0
 2. (\<Sum>k<0. f k * x ^ k) = (0::'a)
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma Zero_Search_2:
"\<lbrakk>I1=\<guillemotleft> a\<le>\<acute>x \<and> (\<acute>found \<longrightarrow> (a<\<acute>x \<and> f(\<acute>x)=0) \<or> (\<acute>y\<le>a \<and> f(\<acute>y)=0))
    \<and> (\<not>\<acute>found \<and> a<\<acute>x \<longrightarrow> f(\<acute>x)\<noteq>0)\<guillemotright>;
 I2= \<guillemotleft>\<acute>y\<le>a+1 \<and> (\<acute>found \<longrightarrow> (a<\<acute>x \<and> f(\<acute>x)=0) \<or> (\<acute>y\<le>a \<and> f(\<acute>y)=0))
    \<and> (\<not>\<acute>found \<and> \<acute>y\<le>a \<longrightarrow> f(\<acute>y)\<noteq>0)\<guillemotright>\<rbrakk> \<Longrightarrow>
  \<parallel>- \<lbrace>\<exists>u. f(u)=0\<rbrace>
  \<acute>found:= False,,
  \<acute>x:=a,, \<acute>y:=a+1,,
  COBEGIN \<lbrace>\<acute>I1\<rbrace>
       WHILE \<not>\<acute>found
       INV \<lbrace>\<acute>I1\<rbrace>
       DO \<lbrace>a\<le>\<acute>x \<and> (\<acute>found \<longrightarrow> \<acute>y\<le>a \<and> f(\<acute>y)=0) \<and> (a<\<acute>x \<longrightarrow> f(\<acute>x)\<noteq>0)\<rbrace>
          \<langle> \<acute>x:=\<acute>x+1,,IF f(\<acute>x)=0 THEN  \<acute>found:=True ELSE  SKIP FI\<rangle>
       OD
       \<lbrace>\<acute>I1 \<and> \<acute>found\<rbrace>
  \<parallel>
      \<lbrace>\<acute>I2\<rbrace>
       WHILE \<not>\<acute>found
       INV \<lbrace>\<acute>I2\<rbrace>
       DO \<lbrace>\<acute>y\<le>a+1 \<and> (\<acute>found \<longrightarrow> a<\<acute>x \<and> f(\<acute>x)=0) \<and> (\<acute>y\<le>a \<longrightarrow> f(\<acute>y)\<noteq>0)\<rbrace>
          \<langle> \<acute>y:=(\<acute>y - 1),,IF f(\<acute>y)=0 THEN  \<acute>found:=True ELSE  SKIP FI\<rangle>
       OD
       \<lbrace>\<acute>I2 \<and> \<acute>found\<rbrace>
  COEND
  \<lbrace>f(\<acute>x)=0 \<or> f(\<acute>y)=0\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I1 = (\<lambda>s. a \<le> x s \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> a < x s \<longrightarrow> f (x s) \<noteq> (0::'b))); I2 = (\<lambda>s. y s \<le> a + 1 \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> y s \<le> a \<longrightarrow> f (y s) \<noteq> (0::'b)))\<rbrakk> \<Longrightarrow> \<parallel>- \<lbrace>\<exists>u. f u = (0::'b)\<rbrace>
\<acute>found := False,, \<acute>x := a,, \<acute>y := a + 1,, COBEGIN
\<lbrace>\<acute>I1\<rbrace>
WHILE \<not> \<acute>found INV \<lbrace>\<acute>I1\<rbrace>
DO \<lbrace>a \<le> \<acute>x \<and> (\<acute>found \<longrightarrow> \<acute>y \<le> a \<and> f \<acute>y = (0::'b)) \<and> (a < \<acute>x \<longrightarrow> f \<acute>x \<noteq> (0::'b))\<rbrace>
\<langle>\<acute>x := \<acute>x + 1,, IF f \<acute>x = (0::'b) THEN \<acute>found := True FI\<rangle>
OD
\<lbrace>\<acute>I1 \<and> \<acute>found\<rbrace>
\<parallel>
\<lbrace>\<acute>I2\<rbrace>
WHILE \<not> \<acute>found INV \<lbrace>\<acute>I2\<rbrace>
DO \<lbrace>\<acute>y \<le> a + 1 \<and> (\<acute>found \<longrightarrow> a < \<acute>x \<and> f \<acute>x = (0::'b)) \<and> (\<acute>y \<le> a \<longrightarrow> f \<acute>y \<noteq> (0::'b))\<rbrace>
\<langle>\<acute>y := \<acute>y - 1,, IF f \<acute>y = (0::'b) THEN \<acute>found := True FI\<rangle>
OD
\<lbrace>\<acute>I2 \<and> \<acute>found\<rbrace>
COEND
\<lbrace>f \<acute>x = (0::'b) \<or> f \<acute>y = (0::'b)\<rbrace>
[PROOF STEP]
apply oghoare
\<comment> \<open>20 vc\<close>
[PROOF STATE]
proof (prove)
goal (20 subgoals):
 1. \<lbrakk>I1 = (\<lambda>s. a \<le> x s \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> a < x s \<longrightarrow> f (x s) \<noteq> (0::'b))); I2 = (\<lambda>s. y s \<le> a + 1 \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> y s \<le> a \<longrightarrow> f (y s) \<noteq> (0::'b)))\<rbrakk> \<Longrightarrow> \<lbrace>\<exists>u. f u = (0::'b)\<rbrace> \<subseteq> \<lbrace>\<acute>(found_update (\<lambda>_. False)) \<in> \<lbrace>\<acute>(x_update (\<lambda>_. a)) \<in> \<lbrace>\<acute>(y_update (\<lambda>_. a + 1)) \<in> pre (the (OG_Hoare.com (Some (Collect I2
WHILE \<not> \<acute>found INV Collect I2
DO (\<lbrace>\<acute>y \<le> a + 1\<rbrace> \<inter> (\<lbrace>\<acute>found \<longrightarrow> a < \<acute>x \<and> f \<acute>x = (0::'b)\<rbrace> \<inter> \<lbrace>\<acute>y \<le> a \<longrightarrow> f \<acute>y \<noteq> (0::'b)\<rbrace>))
\<langle>\<acute>y := \<acute>y - 1,, IF f \<acute>y = (0::'b) THEN Basic (found_update (\<lambda>_. True)) FI\<rangle>
OD), Collect I2 \<inter> Collect found))) \<inter> (pre (the (OG_Hoare.com (Some (Collect I1
WHILE \<not> \<acute>found INV Collect I1
DO (\<lbrace>a \<le> \<acute>x\<rbrace> \<inter> (\<lbrace>\<acute>found \<longrightarrow> \<acute>y \<le> a \<and> f \<acute>y = (0::'b)\<rbrace> \<inter> \<lbrace>a < \<acute>x \<longrightarrow> f \<acute>x \<noteq> (0::'b)\<rbrace>))
\<langle>\<acute>x := \<acute>x + 1,, IF f \<acute>x = (0::'b) THEN Basic (found_update (\<lambda>_. True)) FI\<rangle>
OD), Collect I1 \<inter> Collect found))) \<inter> \<lbrace>\<forall>i. False \<longrightarrow> \<acute>(\<in>) (pre (the (OG_Hoare.com ((Collect I1
WHILE \<not> \<acute>found INV Collect I1
DO (\<lbrace>a \<le> \<acute>x\<rbrace> \<inter> (\<lbrace>\<acute>found \<longrightarrow> \<acute>y \<le> a \<and> f \<acute>y = (0::'b)\<rbrace> \<inter> \<lbrace>a < \<acute>x \<longrightarrow> f \<acute>x \<noteq> (0::'b)\<rbrace>))
\<langle>\<acute>x := \<acute>x + 1,, IF f \<acute>x = (0::'b) THEN Basic (found_update (\<lambda>_. True)) FI\<rangle>
OD
(Collect I1 \<inter> Collect found)
\<parallel>
Collect I2
WHILE \<not> \<acute>found INV Collect I2
DO (\<lbrace>\<acute>y \<le> a + 1\<rbrace> \<inter> (\<lbrace>\<acute>found \<longrightarrow> a < \<acute>x \<and> f \<acute>x = (0::'b)\<rbrace> \<inter> \<lbrace>\<acute>y \<le> a \<longrightarrow> f \<acute>y \<noteq> (0::'b)\<rbrace>))
\<langle>\<acute>y := \<acute>y - 1,, IF f \<acute>y = (0::'b) THEN Basic (found_update (\<lambda>_. True)) FI\<rangle>
OD
(Collect I2 \<inter> Collect found)) ! i))))\<rbrace>)\<rbrace>\<rbrace>\<rbrace>
 2. \<lbrakk>I1 = (\<lambda>s. a \<le> x s \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> a < x s \<longrightarrow> f (x s) \<noteq> (0::'b))); I2 = (\<lambda>s. y s \<le> a + 1 \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> y s \<le> a \<longrightarrow> f (y s) \<noteq> (0::'b)))\<rbrakk> \<Longrightarrow> \<lbrace>\<acute>I1\<rbrace> \<subseteq> \<lbrace>\<acute>I1\<rbrace>
 3. \<lbrakk>I1 = (\<lambda>s. a \<le> x s \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> a < x s \<longrightarrow> f (x s) \<noteq> (0::'b))); I2 = (\<lambda>s. y s \<le> a + 1 \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> y s \<le> a \<longrightarrow> f (y s) \<noteq> (0::'b)))\<rbrakk> \<Longrightarrow> \<lbrace>\<acute>I1\<rbrace> \<inter> \<lbrace>\<not> \<acute>found\<rbrace> \<subseteq> pre (\<lbrace>a \<le> \<acute>x \<and> (\<acute>found \<longrightarrow> \<acute>y \<le> a \<and> f \<acute>y = (0::'b)) \<and> (a < \<acute>x \<longrightarrow> f \<acute>x \<noteq> (0::'b))\<rbrace>
\<langle>\<acute>x := \<acute>x + 1,, IF f \<acute>x = (0::'b) THEN \<acute>found := True FI\<rangle>)
 4. \<lbrakk>I1 = (\<lambda>s. a \<le> x s \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> a < x s \<longrightarrow> f (x s) \<noteq> (0::'b))); I2 = (\<lambda>s. y s \<le> a + 1 \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> y s \<le> a \<longrightarrow> f (y s) \<noteq> (0::'b)))\<rbrakk> \<Longrightarrow> atom_com (\<acute>x := \<acute>x + 1,, IF f \<acute>x = (0::'b) THEN \<acute>found := True FI)
 5. \<lbrakk>I1 = (\<lambda>s. a \<le> x s \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> a < x s \<longrightarrow> f (x s) \<noteq> (0::'b))); I2 = (\<lambda>s. y s \<le> a + 1 \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> y s \<le> a \<longrightarrow> f (y s) \<noteq> (0::'b)))\<rbrakk> \<Longrightarrow> \<lbrace>a \<le> \<acute>x \<and> (\<acute>found \<longrightarrow> \<acute>y \<le> a \<and> f \<acute>y = (0::'b)) \<and> (a < \<acute>x \<longrightarrow> f \<acute>x \<noteq> (0::'b))\<rbrace> \<subseteq> \<lbrace>\<acute>(x_update (\<lambda>_. \<acute>x + 1)) \<in> \<lbrace>(\<acute>(\<in>) \<lbrace>f \<acute>x = (0::'b)\<rbrace> \<longrightarrow> \<acute>(\<in>) \<lbrace>\<acute>(found_update (\<lambda>_. True)) \<in> \<lbrace>\<acute>I1\<rbrace>\<rbrace>) \<and> (\<acute>(\<notin>) \<lbrace>f \<acute>x = (0::'b)\<rbrace> \<longrightarrow> \<acute>(\<in>) \<lbrace>\<acute>I1\<rbrace>)\<rbrace>\<rbrace>
 6. \<lbrakk>I1 = (\<lambda>s. a \<le> x s \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> a < x s \<longrightarrow> f (x s) \<noteq> (0::'b))); I2 = (\<lambda>s. y s \<le> a + 1 \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> y s \<le> a \<longrightarrow> f (y s) \<noteq> (0::'b)))\<rbrakk> \<Longrightarrow> \<lbrace>\<acute>I1\<rbrace> \<inter> - \<lbrace>\<not> \<acute>found\<rbrace> \<subseteq> \<lbrace>\<acute>I1 \<and> \<acute>found\<rbrace>
 7. \<lbrakk>I1 = (\<lambda>s. a \<le> x s \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> a < x s \<longrightarrow> f (x s) \<noteq> (0::'b))); I2 = (\<lambda>s. y s \<le> a + 1 \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> y s \<le> a \<longrightarrow> f (y s) \<noteq> (0::'b)))\<rbrakk> \<Longrightarrow> \<lbrace>\<acute>I2\<rbrace> \<subseteq> \<lbrace>\<acute>I2\<rbrace>
 8. \<lbrakk>I1 = (\<lambda>s. a \<le> x s \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> a < x s \<longrightarrow> f (x s) \<noteq> (0::'b))); I2 = (\<lambda>s. y s \<le> a + 1 \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> y s \<le> a \<longrightarrow> f (y s) \<noteq> (0::'b)))\<rbrakk> \<Longrightarrow> \<lbrace>\<acute>I2\<rbrace> \<inter> \<lbrace>\<not> \<acute>found\<rbrace> \<subseteq> pre (\<lbrace>\<acute>y \<le> a + 1 \<and> (\<acute>found \<longrightarrow> a < \<acute>x \<and> f \<acute>x = (0::'b)) \<and> (\<acute>y \<le> a \<longrightarrow> f \<acute>y \<noteq> (0::'b))\<rbrace>
\<langle>\<acute>y := \<acute>y - 1,, IF f \<acute>y = (0::'b) THEN \<acute>found := True FI\<rangle>)
 9. \<lbrakk>I1 = (\<lambda>s. a \<le> x s \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> a < x s \<longrightarrow> f (x s) \<noteq> (0::'b))); I2 = (\<lambda>s. y s \<le> a + 1 \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> y s \<le> a \<longrightarrow> f (y s) \<noteq> (0::'b)))\<rbrakk> \<Longrightarrow> atom_com (\<acute>y := \<acute>y - 1,, IF f \<acute>y = (0::'b) THEN \<acute>found := True FI)
 10. \<lbrakk>I1 = (\<lambda>s. a \<le> x s \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> a < x s \<longrightarrow> f (x s) \<noteq> (0::'b))); I2 = (\<lambda>s. y s \<le> a + 1 \<and> (found s \<longrightarrow> a < x s \<and> f (x s) = (0::'b) \<or> y s \<le> a \<and> f (y s) = (0::'b)) \<and> (\<not> found s \<and> y s \<le> a \<longrightarrow> f (y s) \<noteq> (0::'b)))\<rbrakk> \<Longrightarrow> \<lbrace>\<acute>y \<le> a + 1 \<and> (\<acute>found \<longrightarrow> a < \<acute>x \<and> f \<acute>x = (0::'b)) \<and> (\<acute>y \<le> a \<longrightarrow> f \<acute>y \<noteq> (0::'b))\<rbrace> \<subseteq> \<lbrace>\<acute>(y_update (\<lambda>_. \<acute>y - 1)) \<in> \<lbrace>(\<acute>(\<in>) \<lbrace>f \<acute>y = (0::'b)\<rbrace> \<longrightarrow> \<acute>(\<in>) \<lbrace>\<acute>(found_update (\<lambda>_. True)) \<in> \<lbrace>\<acute>I2\<rbrace>\<rbrace>) \<and> (\<acute>(\<notin>) \<lbrace>f \<acute>y = (0::'b)\<rbrace> \<longrightarrow> \<acute>(\<in>) \<lbrace>\<acute>I2\<rbrace>)\<rbrace>\<rbrace>
A total of 20 subgoals...
[PROOF STEP]
apply auto
\<comment> \<open>auto takes aprox. 2 minutes.\<close>
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma  det_upperdiagonal:
  fixes A :: "'a::comm_ring_1^'n::{finite,wellorder}^'n::{finite,wellorder}"
  assumes ld: "\<And>i j. i > j \<Longrightarrow> A$i$j = 0"
  shows "det A = prod (\<lambda>i. A$i$i) (UNIV:: 'n set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
let ?U = "UNIV:: 'n set"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
let ?PU = "{p. p permutes ?U}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
let ?pp = "(\<lambda>p. of_int (sign p) * prod (\<lambda>i. A$i$p i) (UNIV :: 'n set))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
have fU: "finite ?U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite UNIV
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite UNIV

goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
have id0: "{id} \<subseteq> ?PU"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {id} \<subseteq> {p. p permutes UNIV}
[PROOF STEP]
by (auto simp: permutes_id)
[PROOF STATE]
proof (state)
this:
{id} \<subseteq> {p. p permutes UNIV}

goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
have p0: "\<forall>p \<in> ?PU -{id}. ?pp p = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p\<in>{p. p permutes UNIV} - {id}. of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i) = (0::'a)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. p \<in> {p. p permutes UNIV} - {id} \<Longrightarrow> of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i) = (0::'a)
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. p \<in> {p. p permutes UNIV} - {id} \<Longrightarrow> of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i) = (0::'a)
[PROOF STEP]
assume p: "p \<in> ?PU - {id}"
[PROOF STATE]
proof (state)
this:
p \<in> {p. p permutes UNIV} - {id}

goal (1 subgoal):
 1. \<And>p. p \<in> {p. p permutes UNIV} - {id} \<Longrightarrow> of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i) = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<in> {p. p permutes UNIV} - {id}
[PROOF STEP]
obtain i where i: "p i < i"
[PROOF STATE]
proof (prove)
using this:
p \<in> {p. p permutes UNIV} - {id}

goal (1 subgoal):
 1. (\<And>i. p i < i \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by clarify (meson leI permutes_natset_ge)
[PROOF STATE]
proof (state)
this:
p i < i

goal (1 subgoal):
 1. \<And>p. p \<in> {p. p permutes UNIV} - {id} \<Longrightarrow> of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i) = (0::'a)
[PROOF STEP]
from ld[OF i]
[PROOF STATE]
proof (chain)
picking this:
A $ i $ p i = (0::'a)
[PROOF STEP]
have "\<exists>i \<in> ?U. A$i$p i = 0"
[PROOF STATE]
proof (prove)
using this:
A $ i $ p i = (0::'a)

goal (1 subgoal):
 1. \<exists>i\<in>UNIV. A $ i $ p i = (0::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>i\<in>UNIV. A $ i $ p i = (0::'a)

goal (1 subgoal):
 1. \<And>p. p \<in> {p. p permutes UNIV} - {id} \<Longrightarrow> of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i) = (0::'a)
[PROOF STEP]
with prod_zero[OF fU]
[PROOF STATE]
proof (chain)
picking this:
\<exists>a\<in>UNIV. ?f a = (0::?'a) \<Longrightarrow> prod ?f UNIV = (0::?'a)
\<exists>i\<in>UNIV. A $ i $ p i = (0::'a)
[PROOF STEP]
show "?pp p = 0"
[PROOF STATE]
proof (prove)
using this:
\<exists>a\<in>UNIV. ?f a = (0::?'a) \<Longrightarrow> prod ?f UNIV = (0::?'a)
\<exists>i\<in>UNIV. A $ i $ p i = (0::'a)

goal (1 subgoal):
 1. of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i) = (0::'a)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>p\<in>{p. p permutes UNIV} - {id}. of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i) = (0::'a)

goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
from sum.mono_neutral_cong_left[OF finite_permutations[OF fU] id0 p0]
[PROOF STATE]
proof (chain)
picking this:
(\<And>x. x \<in> {id} \<Longrightarrow> ?g x = of_int (sign x) * (\<Prod>i\<in>UNIV. A $ i $ x i)) \<Longrightarrow> sum ?g {id} = (\<Sum>p | p permutes UNIV. of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> {id} \<Longrightarrow> ?g x = of_int (sign x) * (\<Prod>i\<in>UNIV. A $ i $ x i)) \<Longrightarrow> sum ?g {id} = (\<Sum>p | p permutes UNIV. of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i))

goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
unfolding det_def
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> {id} \<Longrightarrow> ?g x = of_int (sign x) * (\<Prod>i\<in>UNIV. A $ i $ x i)) \<Longrightarrow> sum ?g {id} = (\<Sum>p | p permutes UNIV. of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i))

goal (1 subgoal):
 1. (\<Sum>p | p permutes UNIV. of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i)) = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
by (simp add: sign_id)
[PROOF STATE]
proof (state)
this:
det A = (\<Prod>i\<in>UNIV. A $ i $ i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma left_path_zip : "length p1 = length p2 \<Longrightarrow> left_path (zip_path p1 p2) = p1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length p1 = length p2 \<Longrightarrow> left_path (zip_path p1 p2) = p1
[PROOF STEP]
by (induction p1 p2 rule: list_induct2; simp)


[STATEMENT]
lemma lm017:
  "possible_allocations_rel G N \<supseteq>
   injectionsUniverse \<inter> {a. Domain a \<in> all_partitions G & Range a \<subseteq> N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. injectionsUniverse \<inter> {a. Domain a \<in> all_partitions G \<and> Range a \<subseteq> N} \<subseteq> possible_allocations_rel G N
[PROOF STEP]
using injections_def
[PROOF STATE]
proof (prove)
using this:
injections ?X ?Y = {R. Domain R = ?X \<and> Range R \<subseteq> ?Y \<and> runiq R \<and> runiq (R\<inverse>)}

goal (1 subgoal):
 1. injectionsUniverse \<inter> {a. Domain a \<in> all_partitions G \<and> Range a \<subseteq> N} \<subseteq> possible_allocations_rel G N
[PROOF STEP]
by auto