[STATEMENT]
lemma unstream_fix_gen: "unstream (fix_gen g) (a, s) = unstream (g a) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unstream (fix_gen g) (a, s) = unstream (g a) s
[PROOF STEP]
proof(induction s taking: "g a" rule: unstream.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>s. \<lbrakk>\<And>x2. generator (g a) s = Skip x2 \<Longrightarrow> unstream (fix_gen g) (a, x2) = unstream (g a) x2; \<And>x31 x32. generator (g a) s = Yield x31 x32 \<Longrightarrow> unstream (fix_gen g) (a, x32) = unstream (g a) x32\<rbrakk> \<Longrightarrow> unstream (fix_gen g) (a, s) = unstream (g a) s
[PROOF STEP]
case (1 s)
[PROOF STATE]
proof (state)
this:
generator (g a) s = Skip ?x2.0 \<Longrightarrow> unstream (fix_gen g) (a, ?x2.0) = unstream (g a) ?x2.0
generator (g a) s = Yield ?x31.0 ?x32.0 \<Longrightarrow> unstream (fix_gen g) (a, ?x32.0) = unstream (g a) ?x32.0

goal (1 subgoal):
 1. \<And>s. \<lbrakk>\<And>x2. generator (g a) s = Skip x2 \<Longrightarrow> unstream (fix_gen g) (a, x2) = unstream (g a) x2; \<And>x31 x32. generator (g a) s = Yield x31 x32 \<Longrightarrow> unstream (fix_gen g) (a, x32) = unstream (g a) x32\<rbrakk> \<Longrightarrow> unstream (fix_gen g) (a, s) = unstream (g a) s
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
generator (g a) s = Skip ?x2.0 \<Longrightarrow> unstream (fix_gen g) (a, ?x2.0) = unstream (g a) ?x2.0
generator (g a) s = Yield ?x31.0 ?x32.0 \<Longrightarrow> unstream (fix_gen g) (a, ?x32.0) = unstream (g a) ?x32.0

goal (1 subgoal):
 1. unstream (fix_gen g) (a, s) = unstream (g a) s
[PROOF STEP]
by(cases "generator (g a) s")(simp_all add: fix_gen.rep_eq)
[PROOF STATE]
proof (state)
this:
unstream (fix_gen g) (a, s) = unstream (g a) s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma norm_has_sum_bound:
  fixes f :: "'b \<Rightarrow> 'a::real_normed_vector"
    and A :: "'b set"
  assumes "has_sum (\<lambda>x. norm (f x)) A n"
  assumes "has_sum f A a"
  shows "norm a \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm a \<le> n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm a \<le> n
[PROOF STEP]
have "norm a \<le> n + \<epsilon>" if "\<epsilon>>0" for \<epsilon>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm a \<le> n + \<epsilon>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm a \<le> n + \<epsilon>
[PROOF STEP]
have "\<exists>F. norm (a - sum f F) \<le> \<epsilon> \<and> finite F \<and> F \<subseteq> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>F. norm (a - sum f F) \<le> \<epsilon> \<and> finite F \<and> F \<subseteq> A
[PROOF STEP]
using has_sum_finite_approximation[where A=A and f=f and \<epsilon>="\<epsilon>"] assms \<open>0 < \<epsilon>\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>has_sum f A ?x; 0 < \<epsilon>\<rbrakk> \<Longrightarrow> \<exists>F. finite F \<and> F \<subseteq> A \<and> dist (sum f F) ?x \<le> \<epsilon>
has_sum (\<lambda>x. norm (f x)) A n
has_sum f A a
0 < \<epsilon>

goal (1 subgoal):
 1. \<exists>F. norm (a - sum f F) \<le> \<epsilon> \<and> finite F \<and> F \<subseteq> A
[PROOF STEP]
by (metis dist_commute dist_norm)
[PROOF STATE]
proof (state)
this:
\<exists>F. norm (a - sum f F) \<le> \<epsilon> \<and> finite F \<and> F \<subseteq> A

goal (1 subgoal):
 1. norm a \<le> n + \<epsilon>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>F. norm (a - sum f F) \<le> \<epsilon> \<and> finite F \<and> F \<subseteq> A
[PROOF STEP]
obtain F where "norm (a - sum f F) \<le> \<epsilon>"
      and "finite F" and "F \<subseteq> A"
[PROOF STATE]
proof (prove)
using this:
\<exists>F. norm (a - sum f F) \<le> \<epsilon> \<and> finite F \<and> F \<subseteq> A

goal (1 subgoal):
 1. (\<And>F. \<lbrakk>norm (a - sum f F) \<le> \<epsilon>; finite F; F \<subseteq> A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (simp add: atomize_elim)
[PROOF STATE]
proof (state)
this:
norm (a - sum f F) \<le> \<epsilon>
finite F
F \<subseteq> A

goal (1 subgoal):
 1. norm a \<le> n + \<epsilon>
[PROOF STEP]
hence "norm a \<le> norm (sum f F) + \<epsilon>"
[PROOF STATE]
proof (prove)
using this:
norm (a - sum f F) \<le> \<epsilon>
finite F
F \<subseteq> A

goal (1 subgoal):
 1. norm a \<le> norm (sum f F) + \<epsilon>
[PROOF STEP]
by (metis add.commute diff_add_cancel dual_order.refl norm_triangle_mono)
[PROOF STATE]
proof (state)
this:
norm a \<le> norm (sum f F) + \<epsilon>

goal (1 subgoal):
 1. norm a \<le> n + \<epsilon>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm a \<le> norm (sum f F) + \<epsilon>

goal (1 subgoal):
 1. norm a \<le> n + \<epsilon>
[PROOF STEP]
have "\<dots> \<le> sum (\<lambda>x. norm (f x)) F + \<epsilon>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (sum f F) + \<epsilon> \<le> (\<Sum>x\<in>F. norm (f x)) + \<epsilon>
[PROOF STEP]
using norm_sum
[PROOF STATE]
proof (prove)
using this:
norm (sum ?f ?A) \<le> (\<Sum>i\<in>?A. norm (?f i))

goal (1 subgoal):
 1. norm (sum f F) + \<epsilon> \<le> (\<Sum>x\<in>F. norm (f x)) + \<epsilon>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
norm (sum f F) + \<epsilon> \<le> (\<Sum>x\<in>F. norm (f x)) + \<epsilon>

goal (1 subgoal):
 1. norm a \<le> n + \<epsilon>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (sum f F) + \<epsilon> \<le> (\<Sum>x\<in>F. norm (f x)) + \<epsilon>

goal (1 subgoal):
 1. norm a \<le> n + \<epsilon>
[PROOF STEP]
have "\<dots> \<le> n + \<epsilon>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>F. norm (f x)) + \<epsilon> \<le> n + \<epsilon>
[PROOF STEP]
apply (rule add_right_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>F. norm (f x)) \<le> n
[PROOF STEP]
apply (rule has_sum_mono_neutral[where A=F and B=A and f=\<open>\<lambda>x. norm (f x)\<close> and g=\<open>\<lambda>x. norm (f x)\<close>])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. has_sum (\<lambda>x. norm (f x)) F (\<Sum>x\<in>F. norm (f x))
 2. has_sum (\<lambda>x. norm (f x)) A n
 3. \<And>x. x \<in> F \<inter> A \<Longrightarrow> norm (f x) \<le> norm (f x)
 4. \<And>x. x \<in> F - A \<Longrightarrow> norm (f x) \<le> 0
 5. \<And>x. x \<in> A - F \<Longrightarrow> 0 \<le> norm (f x)
[PROOF STEP]
using \<open>finite F\<close> \<open>F \<subseteq> A\<close> assms
[PROOF STATE]
proof (prove)
using this:
finite F
F \<subseteq> A
has_sum (\<lambda>x. norm (f x)) A n
has_sum f A a

goal (5 subgoals):
 1. has_sum (\<lambda>x. norm (f x)) F (\<Sum>x\<in>F. norm (f x))
 2. has_sum (\<lambda>x. norm (f x)) A n
 3. \<And>x. x \<in> F \<inter> A \<Longrightarrow> norm (f x) \<le> norm (f x)
 4. \<And>x. x \<in> F - A \<Longrightarrow> norm (f x) \<le> 0
 5. \<And>x. x \<in> A - F \<Longrightarrow> 0 \<le> norm (f x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>F. norm (f x)) + \<epsilon> \<le> n + \<epsilon>

goal (1 subgoal):
 1. norm a \<le> n + \<epsilon>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm a \<le> n + \<epsilon>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm a \<le> n + \<epsilon>

goal (1 subgoal):
 1. norm a \<le> n + \<epsilon>
[PROOF STEP]
by assumption
[PROOF STATE]
proof (state)
this:
norm a \<le> n + \<epsilon>

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

goal (1 subgoal):
 1. norm a \<le> n
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < ?\<epsilon> \<Longrightarrow> norm a \<le> n + ?\<epsilon>

goal (1 subgoal):
 1. norm a \<le> n
[PROOF STEP]
using linordered_field_class.field_le_epsilon
[PROOF STATE]
proof (prove)
using this:
0 < ?\<epsilon> \<Longrightarrow> norm a \<le> n + ?\<epsilon>
(\<And>e. (0::?'a) < e \<Longrightarrow> ?x \<le> ?y + e) \<Longrightarrow> ?x \<le> ?y

goal (1 subgoal):
 1. norm a \<le> n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
norm a \<le> n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tllist_all2_ttlI:
  "\<lbrakk> tllist_all2 P Q xs ys; \<not> is_TNil xs \<or> \<not> is_TNil ys \<rbrakk> \<Longrightarrow> tllist_all2 P Q (ttl xs) (ttl ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>tllist_all2 P Q xs ys; \<not> is_TNil xs \<or> \<not> is_TNil ys\<rbrakk> \<Longrightarrow> tllist_all2 P Q (ttl xs) (ttl ys)
[PROOF STEP]
by(cases xs)(auto simp add: tllist_all2_TNil1 tllist_all2_TCons1)


[STATEMENT]
lemma vars_example_1 :
  fixes e::"('v,integer) aexp"
  assumes "e = (\<lambda> \<sigma>. \<sigma> x - \<sigma> y)"
  assumes "x \<noteq> y"
  shows   "vars e = {x,y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vars e = {x, y}
[PROOF STEP]
unfolding set_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>xa. (xa \<in> vars e) = (xa \<in> {x, y})
[PROOF STEP]
proof (intro allI iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. xa \<in> vars e \<Longrightarrow> xa \<in> {x, y}
 2. \<And>xa. xa \<in> {x, y} \<Longrightarrow> xa \<in> vars e
[PROOF STEP]
fix v
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. xa \<in> vars e \<Longrightarrow> xa \<in> {x, y}
 2. \<And>xa. xa \<in> {x, y} \<Longrightarrow> xa \<in> vars e
[PROOF STEP]
assume "v \<in> vars e"
[PROOF STATE]
proof (state)
this:
v \<in> vars e

goal (2 subgoals):
 1. \<And>xa. xa \<in> vars e \<Longrightarrow> xa \<in> {x, y}
 2. \<And>xa. xa \<in> {x, y} \<Longrightarrow> xa \<in> vars e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
v \<in> vars e
[PROOF STEP]
obtain \<sigma> val
  where "e (\<sigma>(v := val)) \<noteq> e \<sigma>"
[PROOF STATE]
proof (prove)
using this:
v \<in> vars e

goal (1 subgoal):
 1. (\<And>\<sigma> val. e (\<sigma>(v := val)) \<noteq> e \<sigma> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding vars_def
[PROOF STATE]
proof (prove)
using this:
v \<in> {v. \<exists>\<sigma> val. e (\<sigma>(v := val)) \<noteq> e \<sigma>}

goal (1 subgoal):
 1. (\<And>\<sigma> val. e (\<sigma>(v := val)) \<noteq> e \<sigma> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
e (\<sigma>(v := val)) \<noteq> e \<sigma>

goal (2 subgoals):
 1. \<And>xa. xa \<in> vars e \<Longrightarrow> xa \<in> {x, y}
 2. \<And>xa. xa \<in> {x, y} \<Longrightarrow> xa \<in> vars e
[PROOF STEP]
thus "v \<in> {x, y}"
[PROOF STATE]
proof (prove)
using this:
e (\<sigma>(v := val)) \<noteq> e \<sigma>

goal (1 subgoal):
 1. v \<in> {x, y}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
e (\<sigma>(v := val)) \<noteq> e \<sigma>
e = (\<lambda>\<sigma>. \<sigma> x - \<sigma> y)
x \<noteq> y

goal (1 subgoal):
 1. v \<in> {x, y}
[PROOF STEP]
by (case_tac "v = x", simp, (case_tac "v = y", simp+))
[PROOF STATE]
proof (state)
this:
v \<in> {x, y}

goal (1 subgoal):
 1. \<And>xa. xa \<in> {x, y} \<Longrightarrow> xa \<in> vars e
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {x, y} \<Longrightarrow> xa \<in> vars e
[PROOF STEP]
fix v
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {x, y} \<Longrightarrow> xa \<in> vars e
[PROOF STEP]
assume "v \<in> {x,y}"
[PROOF STATE]
proof (state)
this:
v \<in> {x, y}

goal (1 subgoal):
 1. \<And>xa. xa \<in> {x, y} \<Longrightarrow> xa \<in> vars e
[PROOF STEP]
thus "v \<in> vars e"
[PROOF STATE]
proof (prove)
using this:
v \<in> {x, y}

goal (1 subgoal):
 1. v \<in> vars e
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
v \<in> {x, y}
e = (\<lambda>\<sigma>. \<sigma> x - \<sigma> y)
x \<noteq> y

goal (1 subgoal):
 1. v \<in> vars e
[PROOF STEP]
by (auto simp add : vars_def)
     (rule_tac ?x="\<lambda> v. 0" in exI, rule_tac ?x="1" in exI, simp)+
[PROOF STATE]
proof (state)
this:
v \<in> vars e

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma two_power_fact_le_fact:
  assumes "n \<ge> 1"
  shows   "2^k * fact n \<le> (fact (n + k) :: 'a :: {semiring_char_0,linordered_semidom})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2::'a) ^ k * fact n \<le> fact (n + k)
[PROOF STEP]
proof (induction k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (2::'a) ^ 0 * fact n \<le> fact (n + 0)
 2. \<And>k. (2::'a) ^ k * fact n \<le> fact (n + k) \<Longrightarrow> (2::'a) ^ Suc k * fact n \<le> fact (n + Suc k)
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
(2::'a) ^ k * fact n \<le> fact (n + k)

goal (2 subgoals):
 1. (2::'a) ^ 0 * fact n \<le> fact (n + 0)
 2. \<And>k. (2::'a) ^ k * fact n \<le> fact (n + k) \<Longrightarrow> (2::'a) ^ Suc k * fact n \<le> fact (n + Suc k)
[PROOF STEP]
have "2 ^ Suc k * fact n = 2 * (2 ^ k * fact n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2::'b) ^ Suc k * fact n = (2::'b) * ((2::'b) ^ k * fact n)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(2::?'b1) ^ Suc k * fact n = (2::?'b1) * ((2::?'b1) ^ k * fact n)

goal (2 subgoals):
 1. (2::'a) ^ 0 * fact n \<le> fact (n + 0)
 2. \<And>k. (2::'a) ^ k * fact n \<le> fact (n + k) \<Longrightarrow> (2::'a) ^ Suc k * fact n \<le> fact (n + Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(2::?'b1) ^ Suc k * fact n = (2::?'b1) * ((2::?'b1) ^ k * fact n)

goal (2 subgoals):
 1. (2::'a) ^ 0 * fact n \<le> fact (n + 0)
 2. \<And>k. (2::'a) ^ k * fact n \<le> fact (n + k) \<Longrightarrow> (2::'a) ^ Suc k * fact n \<le> fact (n + Suc k)
[PROOF STEP]
note Suc.IH
[PROOF STATE]
proof (state)
this:
(2::'a) ^ k * fact n \<le> fact (n + k)

goal (2 subgoals):
 1. (2::'a) ^ 0 * fact n \<le> fact (n + 0)
 2. \<And>k. (2::'a) ^ k * fact n \<le> fact (n + k) \<Longrightarrow> (2::'a) ^ Suc k * fact n \<le> fact (n + Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(2::'a) ^ k * fact n \<le> fact (n + k)

goal (2 subgoals):
 1. (2::'a) ^ 0 * fact n \<le> fact (n + 0)
 2. \<And>k. (2::'a) ^ k * fact n \<le> fact (n + k) \<Longrightarrow> (2::'a) ^ Suc k * fact n \<le> fact (n + Suc k)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
1 \<le> n
[PROOF STEP]
have "of_nat 1 + of_nat 1 \<le> of_nat n + (of_nat (Suc k) :: 'a)"
[PROOF STATE]
proof (prove)
using this:
1 \<le> n

goal (1 subgoal):
 1. of_nat 1 + of_nat 1 \<le> of_nat n + of_nat (Suc k)
[PROOF STEP]
by (intro add_mono) (unfold of_nat_le_iff, simp_all)
[PROOF STATE]
proof (state)
this:
of_nat 1 + of_nat 1 \<le> of_nat n + of_nat (Suc k)

goal (2 subgoals):
 1. (2::'a) ^ 0 * fact n \<le> fact (n + 0)
 2. \<And>k. (2::'a) ^ k * fact n \<le> fact (n + k) \<Longrightarrow> (2::'a) ^ Suc k * fact n \<le> fact (n + Suc k)
[PROOF STEP]
hence "2 * (fact (n + k) :: 'a) \<le> of_nat (n + Suc k) * fact (n + k)"
[PROOF STATE]
proof (prove)
using this:
of_nat 1 + of_nat 1 \<le> of_nat n + of_nat (Suc k)

goal (1 subgoal):
 1. (2::'a) * fact (n + k) \<le> of_nat (n + Suc k) * fact (n + k)
[PROOF STEP]
by (intro mult_right_mono) (simp_all add: add_ac)
[PROOF STATE]
proof (state)
this:
(2::'a) * fact (n + k) \<le> of_nat (n + Suc k) * fact (n + k)

goal (2 subgoals):
 1. (2::'a) ^ 0 * fact n \<le> fact (n + 0)
 2. \<And>k. (2::'a) ^ k * fact n \<le> fact (n + k) \<Longrightarrow> (2::'a) ^ Suc k * fact n \<le> fact (n + Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(2::'a) * fact (n + k) \<le> of_nat (n + Suc k) * fact (n + k)

goal (2 subgoals):
 1. (2::'a) ^ 0 * fact n \<le> fact (n + 0)
 2. \<And>k. (2::'a) ^ k * fact n \<le> fact (n + k) \<Longrightarrow> (2::'a) ^ Suc k * fact n \<le> fact (n + Suc k)
[PROOF STEP]
have "\<dots> = fact (n + Suc k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (n + Suc k) * fact (n + k) = fact (n + Suc k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
of_nat (n + Suc k) * fact (n + k) = fact (n + Suc k)

goal (2 subgoals):
 1. (2::'a) ^ 0 * fact n \<le> fact (n + 0)
 2. \<And>k. (2::'a) ^ k * fact n \<le> fact (n + k) \<Longrightarrow> (2::'a) ^ Suc k * fact n \<le> fact (n + Suc k)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x \<le> y \<Longrightarrow> (2::'a) * x \<le> (2::'a) * y) \<Longrightarrow> (2::'a) ^ Suc k * fact n \<le> fact (n + Suc k)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> (2::'a) * x \<le> (2::'a) * y) \<Longrightarrow> (2::'a) ^ Suc k * fact n \<le> fact (n + Suc k)

goal (1 subgoal):
 1. (2::'a) ^ Suc k * fact n \<le> fact (n + Suc k)
[PROOF STEP]
by - (simp add: mult_left_mono)
[PROOF STATE]
proof (state)
this:
(2::'a) ^ Suc k * fact n \<le> fact (n + Suc k)

goal (1 subgoal):
 1. (2::'a) ^ 0 * fact n \<le> fact (n + 0)
[PROOF STEP]
qed simp_all


[STATEMENT]
theorem global_separability_condition:
  "(\<forall>n>0. separable n) \<longleftrightarrow> (\<forall>k>0. \<not>coprime k n \<longrightarrow> gauss_sum k = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>n>0. separable n) = (\<forall>k>0. \<not> coprime k n \<longrightarrow> gauss_sum k = 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<forall>n>0. separable n) = (\<forall>k>0. \<not> coprime k n \<longrightarrow> gauss_sum k = 0)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<forall>n>0. separable n) = (\<forall>k>0. \<not> coprime k n \<longrightarrow> gauss_sum k = 0)
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<forall>n>0. separable n) = (\<forall>k>0. \<not> coprime k n \<longrightarrow> gauss_sum k = 0)
[PROOF STEP]
assume "\<not> coprime k n"
[PROOF STATE]
proof (state)
this:
\<not> coprime k n

goal (1 subgoal):
 1. (\<forall>n>0. separable n) = (\<forall>k>0. \<not> coprime k n \<longrightarrow> gauss_sum k = 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> coprime k n
[PROOF STEP]
have "\<chi>(k) = 0"
[PROOF STATE]
proof (prove)
using this:
\<not> coprime k n

goal (1 subgoal):
 1. \<chi> k = 0
[PROOF STEP]
by (simp add: eq_zero)
[PROOF STATE]
proof (state)
this:
\<chi> k = 0

goal (1 subgoal):
 1. (\<forall>n>0. separable n) = (\<forall>k>0. \<not> coprime k n \<longrightarrow> gauss_sum k = 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<chi> k = 0
[PROOF STEP]
have "cnj (\<chi> k) = 0"
[PROOF STATE]
proof (prove)
using this:
\<chi> k = 0

goal (1 subgoal):
 1. cnj (\<chi> k) = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
cnj (\<chi> k) = 0

goal (1 subgoal):
 1. (\<forall>n>0. separable n) = (\<forall>k>0. \<not> coprime k n \<longrightarrow> gauss_sum k = 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cnj (\<chi> k) = 0
[PROOF STEP]
have "separable k \<longleftrightarrow> gauss_sum k = 0"
[PROOF STATE]
proof (prove)
using this:
cnj (\<chi> k) = 0

goal (1 subgoal):
 1. separable k = (gauss_sum k = 0)
[PROOF STEP]
unfolding separable_def
[PROOF STATE]
proof (prove)
using this:
cnj (\<chi> k) = 0

goal (1 subgoal):
 1. (gauss_sum k = cnj (\<chi> k) * gauss_sum 1) = (gauss_sum k = 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
separable k = (gauss_sum k = 0)

goal (1 subgoal):
 1. (\<forall>n>0. separable n) = (\<forall>k>0. \<not> coprime k n \<longrightarrow> gauss_sum k = 0)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<not> coprime ?k3 n \<Longrightarrow> separable ?k3 = (gauss_sum ?k3 = 0)

goal (1 subgoal):
 1. (\<forall>n>0. separable n) = (\<forall>k>0. \<not> coprime k n \<longrightarrow> gauss_sum k = 0)
[PROOF STEP]
note not_case = this
[PROOF STATE]
proof (state)
this:
\<not> coprime ?k3 n \<Longrightarrow> separable ?k3 = (gauss_sum ?k3 = 0)

goal (1 subgoal):
 1. (\<forall>n>0. separable n) = (\<forall>k>0. \<not> coprime k n \<longrightarrow> gauss_sum k = 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>n>0. separable n) = (\<forall>k>0. \<not> coprime k n \<longrightarrow> gauss_sum k = 0)
[PROOF STEP]
using gauss_coprime_separable not_case separable_def
[PROOF STATE]
proof (prove)
using this:
coprime ?k n \<Longrightarrow> separable ?k
\<not> coprime ?k3 n \<Longrightarrow> separable ?k3 = (gauss_sum ?k3 = 0)
separable ?k = (gauss_sum ?k = cnj (\<chi> ?k) * gauss_sum 1)

goal (1 subgoal):
 1. (\<forall>n>0. separable n) = (\<forall>k>0. \<not> coprime k n \<longrightarrow> gauss_sum k = 0)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<forall>n>0. separable n) = (\<forall>k>0. \<not> coprime k n \<longrightarrow> gauss_sum k = 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_lift2_0_iff[simp]: "poly_lift2 p = 0 \<longleftrightarrow> p = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly_lift2 p = 0) = (p = 0)
[PROOF STEP]
unfolding poly_lift2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (map_poly (\<lambda>a. [:[:a:]:]) p = 0) = (p = 0)
[PROOF STEP]
by(induct p;simp)


[STATEMENT]
lemma le_\<omega>_imp_ex_hmset_of_enat:
  assumes M_le_\<omega>: "M \<le> \<omega>"
  shows "\<exists>n. M = hmset_of_enat n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n. M = hmset_of_enat n
[PROOF STEP]
proof (cases "M = \<omega>")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. M = \<omega> \<Longrightarrow> \<exists>n. M = hmset_of_enat n
 2. M \<noteq> \<omega> \<Longrightarrow> \<exists>n. M = hmset_of_enat n
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
M = \<omega>

goal (2 subgoals):
 1. M = \<omega> \<Longrightarrow> \<exists>n. M = hmset_of_enat n
 2. M \<noteq> \<omega> \<Longrightarrow> \<exists>n. M = hmset_of_enat n
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
M = \<omega>

goal (1 subgoal):
 1. \<exists>n. M = hmset_of_enat n
[PROOF STEP]
by (metis hmset_of_enat.simps(2))
[PROOF STATE]
proof (state)
this:
\<exists>n. M = hmset_of_enat n

goal (1 subgoal):
 1. M \<noteq> \<omega> \<Longrightarrow> \<exists>n. M = hmset_of_enat n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. M \<noteq> \<omega> \<Longrightarrow> \<exists>n. M = hmset_of_enat n
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
M \<noteq> \<omega>

goal (1 subgoal):
 1. M \<noteq> \<omega> \<Longrightarrow> \<exists>n. M = hmset_of_enat n
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
M \<noteq> \<omega>

goal (1 subgoal):
 1. \<exists>n. M = hmset_of_enat n
[PROOF STEP]
using M_le_\<omega> lt_\<omega>_imp_ex_of_nat
[PROOF STATE]
proof (prove)
using this:
M \<noteq> \<omega>
M \<le> \<omega>
?M < \<omega> \<Longrightarrow> \<exists>n. ?M = of_nat n

goal (1 subgoal):
 1. \<exists>n. M = hmset_of_enat n
[PROOF STEP]
by (metis hmset_of_enat.simps(1) le_less)
[PROOF STATE]
proof (state)
this:
\<exists>n. M = hmset_of_enat n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_vec_vCons: "sum_vec (vCons a v) = a + sum_vec v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_vec (vCons a v) = a + sum_vec v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum_vec (vCons a v) = a + sum_vec v
[PROOF STEP]
have 0: "a = (vCons a v) $ 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = vCons a v $ 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a = vCons a v $ 0

goal (1 subgoal):
 1. sum_vec (vCons a v) = a + sum_vec v
[PROOF STEP]
have "sum_vec v = sum (\<lambda> i . v $ i) {0..<dim_vec v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_vec v = sum (($) v) {0..<dim_vec v}
[PROOF STEP]
by (simp add: sum_vec_def)
[PROOF STATE]
proof (state)
this:
sum_vec v = sum (($) v) {0..<dim_vec v}

goal (1 subgoal):
 1. sum_vec (vCons a v) = a + sum_vec v
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_vec v = sum (($) v) {0..<dim_vec v}

goal (1 subgoal):
 1. sum_vec (vCons a v) = a + sum_vec v
[PROOF STEP]
have "... = sum (\<lambda> i . (vCons a v) $ Suc i) {0..< dim_vec v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (($) v) {0..<dim_vec v} = (\<Sum>i = 0..<dim_vec v. vCons a v $ Suc i)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
sum (($) v) {0..<dim_vec v} = (\<Sum>i = 0..<dim_vec v. vCons a v $ Suc i)

goal (1 subgoal):
 1. sum_vec (vCons a v) = a + sum_vec v
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum (($) v) {0..<dim_vec v} = (\<Sum>i = 0..<dim_vec v. vCons a v $ Suc i)

goal (1 subgoal):
 1. sum_vec (vCons a v) = a + sum_vec v
[PROOF STEP]
have "... = sum (\<lambda> i . (vCons a v) $ i) {Suc 0..< (Suc (dim_vec v))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec v. vCons a v $ Suc i) = sum (($) (vCons a v)) {Suc 0..<Suc (dim_vec v)}
[PROOF STEP]
by (metis sum.shift_bounds_Suc_ivl)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<dim_vec v. vCons a v $ Suc i) = sum (($) (vCons a v)) {Suc 0..<Suc (dim_vec v)}

goal (1 subgoal):
 1. sum_vec (vCons a v) = a + sum_vec v
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum_vec v = sum (($) (vCons a v)) {Suc 0..<Suc (dim_vec v)}
[PROOF STEP]
have sum: "sum_vec v = sum (\<lambda> i . (vCons a v) $ i) {Suc 0..< dim_vec (vCons a v)}"
[PROOF STATE]
proof (prove)
using this:
sum_vec v = sum (($) (vCons a v)) {Suc 0..<Suc (dim_vec v)}

goal (1 subgoal):
 1. sum_vec v = sum (($) (vCons a v)) {Suc 0..<dim_vec (vCons a v)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_vec v = sum (($) (vCons a v)) {Suc 0..<dim_vec (vCons a v)}

goal (1 subgoal):
 1. sum_vec (vCons a v) = a + sum_vec v
[PROOF STEP]
have "sum_vec (vCons a v) = sum (\<lambda> i . (vCons a v) $ i){0..< dim_vec (vCons a v)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_vec (vCons a v) = sum (($) (vCons a v)) {0..<dim_vec (vCons a v)}
[PROOF STEP]
by (simp add: sum_vec_def)
[PROOF STATE]
proof (state)
this:
sum_vec (vCons a v) = sum (($) (vCons a v)) {0..<dim_vec (vCons a v)}

goal (1 subgoal):
 1. sum_vec (vCons a v) = a + sum_vec v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sum_vec (vCons a v) = sum (($) (vCons a v)) {0..<dim_vec (vCons a v)}
[PROOF STEP]
have "sum_vec (vCons a v) = (vCons a v) $ 0 + sum (\<lambda> i . (vCons a v) $ i){Suc 0..< dim_vec (vCons a v)}"
[PROOF STATE]
proof (prove)
using this:
sum_vec (vCons a v) = sum (($) (vCons a v)) {0..<dim_vec (vCons a v)}

goal (1 subgoal):
 1. sum_vec (vCons a v) = vCons a v $ 0 + sum (($) (vCons a v)) {Suc 0..<dim_vec (vCons a v)}
[PROOF STEP]
by (metis dim_vec_vCons sum.atLeast_Suc_lessThan zero_less_Suc)
[PROOF STATE]
proof (state)
this:
sum_vec (vCons a v) = vCons a v $ 0 + sum (($) (vCons a v)) {Suc 0..<dim_vec (vCons a v)}

goal (1 subgoal):
 1. sum_vec (vCons a v) = a + sum_vec v
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
sum_vec (vCons a v) = vCons a v $ 0 + sum (($) (vCons a v)) {Suc 0..<dim_vec (vCons a v)}

goal (1 subgoal):
 1. sum_vec (vCons a v) = a + sum_vec v
[PROOF STEP]
using sum 0
[PROOF STATE]
proof (prove)
using this:
sum_vec (vCons a v) = vCons a v $ 0 + sum (($) (vCons a v)) {Suc 0..<dim_vec (vCons a v)}
sum_vec v = sum (($) (vCons a v)) {Suc 0..<dim_vec (vCons a v)}
a = vCons a v $ 0

goal (1 subgoal):
 1. sum_vec (vCons a v) = a + sum_vec v
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_vec (vCons a v) = a + sum_vec v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma p2r_conj_hom [simp]: "p2r P \<inter> p2r Q = p2r (P \<sqinter> Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p2r P \<inter> p2r Q = p2r (P \<sqinter> Q)
[PROOF STEP]
by (simp add: p2s2r p2s_conj_hom s2r_inter_hom)


[STATEMENT]
lemma set_integrable_cong:
  assumes "M = M'" "A = A'" "\<And>x. x \<in> A \<Longrightarrow> f x = f' x"
  shows   "set_integrable M A f = set_integrable M' A' f'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable M A f = set_integrable M' A' f'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set_integrable M A f = set_integrable M' A' f'
[PROOF STEP]
have "(\<lambda>x. indicator A x *\<^sub>R f x) = (\<lambda>x. indicator A' x *\<^sub>R f' x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. indicat_real A x *\<^sub>R f x) = (\<lambda>x. indicat_real A' x *\<^sub>R f' x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
M = M'
A = A'
?x \<in> A \<Longrightarrow> f ?x = f' ?x

goal (1 subgoal):
 1. (\<lambda>x. indicat_real A x *\<^sub>R f x) = (\<lambda>x. indicat_real A' x *\<^sub>R f' x)
[PROOF STEP]
by (auto simp: indicator_def of_bool_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. indicat_real A x *\<^sub>R f x) = (\<lambda>x. indicat_real A' x *\<^sub>R f' x)

goal (1 subgoal):
 1. set_integrable M A f = set_integrable M' A' f'
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. indicat_real A x *\<^sub>R f x) = (\<lambda>x. indicat_real A' x *\<^sub>R f' x)

goal (1 subgoal):
 1. set_integrable M A f = set_integrable M' A' f'
[PROOF STEP]
by (simp add: set_integrable_def assms)
[PROOF STATE]
proof (state)
this:
set_integrable M A f = set_integrable M' A' f'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in ring) indexed_padd_in_carrier:
  assumes "carrier_coeff P" and "carrier_coeff Q" shows "carrier_coeff (indexed_padd P Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier_coeff (P \<Oplus> Q)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
carrier_coeff P
carrier_coeff Q

goal (1 subgoal):
 1. carrier_coeff (P \<Oplus> Q)
[PROOF STEP]
unfolding carrier_coeff_def indexed_padd_def
[PROOF STATE]
proof (prove)
using this:
\<forall>m. P m \<in> carrier R
\<forall>m. Q m \<in> carrier R

goal (1 subgoal):
 1. \<forall>m. P m \<oplus> Q m \<in> carrier R
[PROOF STEP]
by simp


[STATEMENT]
theorem reduce_pres_denot: fixes e::exp assumes r: "e \<longrightarrow> e'" shows "E e = E e'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. E e = E e'
[PROOF STEP]
apply (rule ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. E e x = E e' x
[PROOF STEP]
apply (rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. E e x \<subseteq> E e' x
 2. \<And>x. E e' x \<subseteq> E e x
[PROOF STEP]
apply (rule subsetI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x xa. xa \<in> E e x \<Longrightarrow> xa \<in> E e' x
 2. \<And>x. E e' x \<subseteq> E e x
[PROOF STEP]
apply (rule subject_reduction)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x xa. xa \<in> E e x \<Longrightarrow> xa \<in> E (?e7 x xa) x
 2. \<And>x xa. xa \<in> E e x \<Longrightarrow> ?e7 x xa \<longrightarrow> e'
 3. \<And>x. E e' x \<subseteq> E e x
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x xa. xa \<in> E e x \<Longrightarrow> e \<longrightarrow> e'
 2. \<And>x. E e' x \<subseteq> E e x
[PROOF STEP]
using r
[PROOF STATE]
proof (prove)
using this:
e \<longrightarrow> e'

goal (2 subgoals):
 1. \<And>x xa. xa \<in> E e x \<Longrightarrow> e \<longrightarrow> e'
 2. \<And>x. E e' x \<subseteq> E e x
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. E e' x \<subseteq> E e x
[PROOF STEP]
apply (rule subsetI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. xa \<in> E e' x \<Longrightarrow> xa \<in> E e x
[PROOF STEP]
using r
[PROOF STATE]
proof (prove)
using this:
e \<longrightarrow> e'

goal (1 subgoal):
 1. \<And>x xa. xa \<in> E e' x \<Longrightarrow> xa \<in> E e x
[PROOF STEP]
apply (rule reverse_step_pres_denot)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. xa \<in> E e' x \<Longrightarrow> xa \<in> E e' x
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma iprev_nth_lessThan: "a < n \<Longrightarrow> {..<n} \<leftarrow> a = n - Suc a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a < n \<Longrightarrow> {..<n} \<leftarrow> a = n - Suc a
[PROOF STEP]
apply (case_tac n, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>nat. \<lbrakk>a < n; n = Suc nat\<rbrakk> \<Longrightarrow> {..<n} \<leftarrow> a = n - Suc a
[PROOF STEP]
apply (simp add: lessThan_Suc_atMost iprev_nth_atMost)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem gt_compat_fun_strong:
  assumes t'_gt_t: "t' >\<^sub>t t"
  shows "apps s (t' # us) >\<^sub>t apps s (t # us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. apps s (t' # us) >\<^sub>t apps s (t # us)
[PROOF STEP]
proof (induct us rule: rev_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. apps s [t'] >\<^sub>t apps s [t]
 2. \<And>x xs. apps s (t' # xs) >\<^sub>t apps s (t # xs) \<Longrightarrow> apps s (t' # xs @ [x]) >\<^sub>t apps s (t # xs @ [x])
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. apps s [t'] >\<^sub>t apps s [t]
 2. \<And>x xs. apps s (t' # xs) >\<^sub>t apps s (t # xs) \<Longrightarrow> apps s (t' # xs @ [x]) >\<^sub>t apps s (t # xs @ [x])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. apps s [t'] >\<^sub>t apps s [t]
[PROOF STEP]
by (simp add: gt_compat_fun t'_gt_t)
[PROOF STATE]
proof (state)
this:
apps s [t'] >\<^sub>t apps s [t]

goal (1 subgoal):
 1. \<And>x xs. apps s (t' # xs) >\<^sub>t apps s (t # xs) \<Longrightarrow> apps s (t' # xs @ [x]) >\<^sub>t apps s (t # xs @ [x])
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs. apps s (t' # xs) >\<^sub>t apps s (t # xs) \<Longrightarrow> apps s (t' # xs @ [x]) >\<^sub>t apps s (t # xs @ [x])
[PROOF STEP]
case (snoc x xs)
[PROOF STATE]
proof (state)
this:
apps s (t' # xs) >\<^sub>t apps s (t # xs)

goal (1 subgoal):
 1. \<And>x xs. apps s (t' # xs) >\<^sub>t apps s (t # xs) \<Longrightarrow> apps s (t' # xs @ [x]) >\<^sub>t apps s (t # xs @ [x])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
apps s (t' # xs) >\<^sub>t apps s (t # xs)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
apps s (t' # xs) >\<^sub>t apps s (t # xs)

goal (1 subgoal):
 1. apps s (t' # xs @ [x]) >\<^sub>t apps s (t # xs @ [x])
[PROOF STEP]
unfolding App_apps[symmetric] append_Cons[symmetric]
[PROOF STATE]
proof (prove)
using this:
apps s (t' # xs) >\<^sub>t apps s (t # xs)

goal (1 subgoal):
 1. App (apps s (t' # xs)) x >\<^sub>t App (apps s (t # xs)) x
[PROOF STEP]
using gt_compat_arg
[PROOF STATE]
proof (prove)
using this:
apps s (t' # xs) >\<^sub>t apps s (t # xs)
\<lbrakk>?s' >\<^sub>t ?s; ?t' \<ge>\<^sub>t ?t\<rbrakk> \<Longrightarrow> App ?s' ?t' >\<^sub>t App ?s ?t

goal (1 subgoal):
 1. App (apps s (t' # xs)) x >\<^sub>t App (apps s (t # xs)) x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
apps s (t' # xs @ [x]) >\<^sub>t apps s (t # xs @ [x])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_div_minus_left [simp]: "(- x) div y = - (x div y)"
  for x y :: "'a::field poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - x div y = - (x div y)
[PROOF STEP]
using div_smult_left [of "- 1::'a"]
[PROOF STATE]
proof (prove)
using this:
smult (- (1::'a)) ?x div ?y = smult (- (1::'a)) (?x div ?y)

goal (1 subgoal):
 1. - x div y = - (x div y)
[PROOF STEP]
by simp


[STATEMENT]
lemma general_theorem:
  fixes P f and l :: nat
  assumes "(\<forall>p. P p \<and> f p > l \<longrightarrow> (\<exists>p'. P p' \<and> f p' < f p))"
  shows "(\<forall>p. P p \<longrightarrow> (\<exists>p'. P p' \<and> f p' \<le> l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p. P p \<longrightarrow> (\<exists>p'. P p' \<and> f p' \<le> l)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>p. P p \<longrightarrow> (\<exists>p'. P p' \<and> f p' \<le> l)
[PROOF STEP]
have "\<forall>p. (n = f p) \<and> P p \<longrightarrow> (\<exists>p'. P p' \<and> f p' \<le> l)" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p. n = f p \<and> P p \<longrightarrow> (\<exists>p'. P p' \<and> f p' \<le> l)
[PROOF STEP]
apply(rule Nat.nat_less_induct[where ?P = "%n. \<forall>p. (n = f p) \<and> P p \<longrightarrow> (\<exists>p'. P p' \<and> f p' \<le> l)"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<forall>m<n. \<forall>p. m = f p \<and> P p \<longrightarrow> (\<exists>p'. P p' \<and> f p' \<le> l) \<Longrightarrow> \<forall>p. n = f p \<and> P p \<longrightarrow> (\<exists>p'. P p' \<and> f p' \<le> l)
[PROOF STEP]
by (metis assms not_less)
[PROOF STATE]
proof (state)
this:
\<forall>p. ?n = f p \<and> P p \<longrightarrow> (\<exists>p'. P p' \<and> f p' \<le> l)

goal (1 subgoal):
 1. \<forall>p. P p \<longrightarrow> (\<exists>p'. P p' \<and> f p' \<le> l)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>p. ?n = f p \<and> P p \<longrightarrow> (\<exists>p'. P p' \<and> f p' \<le> l)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>p. ?n = f p \<and> P p \<longrightarrow> (\<exists>p'. P p' \<and> f p' \<le> l)

goal (1 subgoal):
 1. \<forall>p. P p \<longrightarrow> (\<exists>p'. P p' \<and> f p' \<le> l)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>p. P p \<longrightarrow> (\<exists>p'. P p' \<and> f p' \<le> l)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma contour_integral_part_circlepath_h:
  assumes r: "r > 0"
  shows   "contour_integral (part_circlepath 0 r 0 pi) (f s) = integral {0..pi} (h r s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (part_circlepath 0 r 0 pi) (f s) = integral {0..pi} (h r s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. contour_integral (part_circlepath 0 r 0 pi) (f s) = integral {0..pi} (h r s)
[PROOF STEP]
have "contour_integral (part_circlepath 0 r 0 pi) (f s) =
          integral {0..pi} (\<lambda>t. f s (r * cis t) * r * \<i> * cis t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (part_circlepath 0 r 0 pi) (f s) = integral {0..pi} (\<lambda>t. f s (complex_of_real r * cis t) * complex_of_real r * \<i> * cis t)
[PROOF STEP]
by (simp add: contour_integral_part_circlepath_eq)
[PROOF STATE]
proof (state)
this:
contour_integral (part_circlepath 0 r 0 pi) (f s) = integral {0..pi} (\<lambda>t. f s (complex_of_real r * cis t) * complex_of_real r * \<i> * cis t)

goal (1 subgoal):
 1. contour_integral (part_circlepath 0 r 0 pi) (f s) = integral {0..pi} (h r s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
contour_integral (part_circlepath 0 r 0 pi) (f s) = integral {0..pi} (\<lambda>t. f s (complex_of_real r * cis t) * complex_of_real r * \<i> * cis t)

goal (1 subgoal):
 1. contour_integral (part_circlepath 0 r 0 pi) (f s) = integral {0..pi} (h r s)
[PROOF STEP]
have "integral {0..pi} (\<lambda>t. f s (r * cis t) * r * \<i> * cis t) = integral {0..pi} (h r s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {0..pi} (\<lambda>t. f s (complex_of_real r * cis t) * complex_of_real r * \<i> * cis t) = integral {0..pi} (h r s)
[PROOF STEP]
proof (intro integral_cong)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..pi} \<Longrightarrow> f s (complex_of_real r * cis x) * complex_of_real r * \<i> * cis x = h r s x
[PROOF STEP]
fix t
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..pi} \<Longrightarrow> f s (complex_of_real r * cis x) * complex_of_real r * \<i> * cis x = h r s x
[PROOF STEP]
assume t: "t \<in> {0..pi}"
[PROOF STATE]
proof (state)
this:
t \<in> {0..pi}

goal (1 subgoal):
 1. \<And>x. x \<in> {0..pi} \<Longrightarrow> f s (complex_of_real r * cis x) * complex_of_real r * \<i> * cis x = h r s x
[PROOF STEP]
have "-(pi / 2) < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (pi / 2) < 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- (pi / 2) < 0

goal (1 subgoal):
 1. \<And>x. x \<in> {0..pi} \<Longrightarrow> f s (complex_of_real r * cis x) * complex_of_real r * \<i> * cis x = h r s x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- (pi / 2) < 0

goal (1 subgoal):
 1. \<And>x. x \<in> {0..pi} \<Longrightarrow> f s (complex_of_real r * cis x) * complex_of_real r * \<i> * cis x = h r s x
[PROOF STEP]
have "0 \<le> t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> t
[PROOF STEP]
using t
[PROOF STATE]
proof (prove)
using this:
t \<in> {0..pi}

goal (1 subgoal):
 1. 0 \<le> t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> t

goal (1 subgoal):
 1. \<And>x. x \<in> {0..pi} \<Longrightarrow> f s (complex_of_real r * cis x) * complex_of_real r * \<i> * cis x = h r s x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
- (pi / 2) < t
[PROOF STEP]
have "t \<in> {-(pi/2)<..3/2*pi}"
[PROOF STATE]
proof (prove)
using this:
- (pi / 2) < t

goal (1 subgoal):
 1. t \<in> {- (pi / 2)<..3 / 2 * pi}
[PROOF STEP]
using t
[PROOF STATE]
proof (prove)
using this:
- (pi / 2) < t
t \<in> {0..pi}

goal (1 subgoal):
 1. t \<in> {- (pi / 2)<..3 / 2 * pi}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t \<in> {- (pi / 2)<..3 / 2 * pi}

goal (1 subgoal):
 1. \<And>x. x \<in> {0..pi} \<Longrightarrow> f s (complex_of_real r * cis x) * complex_of_real r * \<i> * cis x = h r s x
[PROOF STEP]
thus "f s (r * cis t) * r * \<i> * cis t = h r s t"
[PROOF STATE]
proof (prove)
using this:
t \<in> {- (pi / 2)<..3 / 2 * pi}

goal (1 subgoal):
 1. f s (complex_of_real r * cis t) * complex_of_real r * \<i> * cis t = h r s t
[PROOF STEP]
using r
[PROOF STATE]
proof (prove)
using this:
t \<in> {- (pi / 2)<..3 / 2 * pi}
0 < r

goal (1 subgoal):
 1. f s (complex_of_real r * cis t) * complex_of_real r * \<i> * cis t = h r s t
[PROOF STEP]
by (simp add: f_def Ln'_times_of_real Ln'_cis h_def Ln_Reals_eq)
[PROOF STATE]
proof (state)
this:
f s (complex_of_real r * cis t) * complex_of_real r * \<i> * cis t = h r s t

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
integral {0..pi} (\<lambda>t. f s (complex_of_real r * cis t) * complex_of_real r * \<i> * cis t) = integral {0..pi} (h r s)

goal (1 subgoal):
 1. contour_integral (part_circlepath 0 r 0 pi) (f s) = integral {0..pi} (h r s)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
contour_integral (part_circlepath 0 r 0 pi) (f s) = integral {0..pi} (h r s)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
contour_integral (part_circlepath 0 r 0 pi) (f s) = integral {0..pi} (h r s)

goal (1 subgoal):
 1. contour_integral (part_circlepath 0 r 0 pi) (f s) = integral {0..pi} (h r s)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
contour_integral (part_circlepath 0 r 0 pi) (f s) = integral {0..pi} (h r s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in idom_char_0) linear_mul_degree:
  assumes p: "poly p \<noteq> poly []"
  shows "degree ([a, 1] *** p) = degree p + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree ([a, 1::'a] *** p) = degree p + 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. degree ([a, 1::'a] *** p) = degree p + 1
[PROOF STEP]
from p
[PROOF STATE]
proof (chain)
picking this:
poly p \<noteq> poly []
[PROOF STEP]
have pnz: "pnormalize p \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
poly p \<noteq> poly []

goal (1 subgoal):
 1. pnormalize p \<noteq> []
[PROOF STEP]
unfolding poly_zero lemma_degree_zero
[PROOF STATE]
proof (prove)
using this:
pnormalize p \<noteq> []

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

goal (1 subgoal):
 1. degree ([a, 1::'a] *** p) = degree p + 1
[PROOF STEP]
from last_linear_mul[OF pnz, of a] last_pnormalize[OF pnz]
[PROOF STATE]
proof (chain)
picking this:
last ([a, 1::'a] *** pnormalize p) = last (pnormalize p)
last (pnormalize p) \<noteq> (0::'a)
[PROOF STEP]
have l0: "last ([a, 1] *** pnormalize p) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
last ([a, 1::'a] *** pnormalize p) = last (pnormalize p)
last (pnormalize p) \<noteq> (0::'a)

goal (1 subgoal):
 1. last ([a, 1::'a] *** pnormalize p) \<noteq> (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
last ([a, 1::'a] *** pnormalize p) \<noteq> (0::'a)

goal (1 subgoal):
 1. degree ([a, 1::'a] *** p) = degree p + 1
[PROOF STEP]
from last_pnormalize[OF pnz] last_linear_mul[OF pnz, of a]
    pnormal_degree[OF l0] pnormal_degree[OF last_pnormalize[OF pnz]] pnz
[PROOF STATE]
proof (chain)
picking this:
last (pnormalize p) \<noteq> (0::'a)
last ([a, 1::'a] *** pnormalize p) = last (pnormalize p)
degree ([a, 1::'a] *** pnormalize p) = length ([a, 1::'a] *** pnormalize p) - 1
degree (pnormalize p) = length (pnormalize p) - 1
pnormalize p \<noteq> []
[PROOF STEP]
have th: "degree ([a,1] *** pnormalize p) = degree (pnormalize p) + 1"
[PROOF STATE]
proof (prove)
using this:
last (pnormalize p) \<noteq> (0::'a)
last ([a, 1::'a] *** pnormalize p) = last (pnormalize p)
degree ([a, 1::'a] *** pnormalize p) = length ([a, 1::'a] *** pnormalize p) - 1
degree (pnormalize p) = length (pnormalize p) - 1
pnormalize p \<noteq> []

goal (1 subgoal):
 1. degree ([a, 1::'a] *** pnormalize p) = degree (pnormalize p) + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree ([a, 1::'a] *** pnormalize p) = degree (pnormalize p) + 1

goal (1 subgoal):
 1. degree ([a, 1::'a] *** p) = degree p + 1
[PROOF STEP]
have eqs: "poly ([a,1] *** pnormalize p) = poly ([a,1] *** p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly ([a, 1::'a] *** pnormalize p) = poly ([a, 1::'a] *** p)
[PROOF STEP]
by (rule ext) (simp add: poly_mult poly_add poly_cmult)
[PROOF STATE]
proof (state)
this:
poly ([a, 1::'a] *** pnormalize p) = poly ([a, 1::'a] *** p)

goal (1 subgoal):
 1. degree ([a, 1::'a] *** p) = degree p + 1
[PROOF STEP]
from degree_unique[OF eqs] th
[PROOF STATE]
proof (chain)
picking this:
degree ([a, 1::'a] *** pnormalize p) = degree ([a, 1::'a] *** p)
degree ([a, 1::'a] *** pnormalize p) = degree (pnormalize p) + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
degree ([a, 1::'a] *** pnormalize p) = degree ([a, 1::'a] *** p)
degree ([a, 1::'a] *** pnormalize p) = degree (pnormalize p) + 1

goal (1 subgoal):
 1. degree ([a, 1::'a] *** p) = degree p + 1
[PROOF STEP]
by (simp add: degree_unique[OF poly_normalize])
[PROOF STATE]
proof (state)
this:
degree ([a, 1::'a] *** p) = degree p + 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma frac_cancel:
  assumes "s1\<in>S" and "(r, s) \<in> R \<times> S"
  shows "frac (s1\<cdot>r) (s1\<cdot>s) = frac r s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (s1 \<cdot> r) / (s1 \<cdot> s) = r / s
[PROOF STEP]
apply (rule frac_eqI[of \<one>])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<one> \<in> S
 2. (s1 \<cdot> r, s1 \<cdot> s) \<in> R \<times> S
 3. (r, s) \<in> R \<times> S
 4. \<one> \<cdot> s \<cdot> (s1 \<cdot> r) = \<one> \<cdot> (s1 \<cdot> s) \<cdot> r
[PROOF STEP]
using assms comm_ring_simps
[PROOF STATE]
proof (prove)
using this:
s1 \<in> S
(r, s) \<in> R \<times> S
\<lbrakk>?a \<in> R; ?b \<in> R; ?c \<in> R\<rbrakk> \<Longrightarrow> ?a \<cdot> ?b \<cdot> ?c = ?a \<cdot> (?b \<cdot> ?c)
\<lbrakk>?a \<in> R; ?b \<in> R; ?c \<in> R\<rbrakk> \<Longrightarrow> ?a + ?b + ?c = ?a + (?b + ?c)
\<lbrakk>?a \<in> R; ?b \<in> R\<rbrakk> \<Longrightarrow> ?a \<cdot> ?b = ?b \<cdot> ?a
\<lbrakk>?x \<in> R; ?y \<in> R\<rbrakk> \<Longrightarrow> ?x + ?y = ?y + ?x
plus ?a (- ?a) = (0::?'a)

goal (4 subgoals):
 1. \<one> \<in> S
 2. (s1 \<cdot> r, s1 \<cdot> s) \<in> R \<times> S
 3. (r, s) \<in> R \<times> S
 4. \<one> \<cdot> s \<cdot> (s1 \<cdot> r) = \<one> \<cdot> (s1 \<cdot> s) \<cdot> r
[PROOF STEP]
by auto