[STATEMENT]
lemma analytic_iff_power_series:
     "f analytic_on ball z r \<longleftrightarrow>
      (\<forall>w \<in> ball z r. (\<lambda>n. (deriv ^^ n) f z / (fact n) * (w - z)^n) sums f w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f analytic_on ball z r) = (\<forall>w\<in>ball z r. (\<lambda>n. (deriv ^^ n) f z / fact n * (w - z) ^ n) sums f w)
[PROOF STEP]
by (simp add: analytic_on_open holomorphic_iff_power_series)


[STATEMENT]
lemma continuous_divide:
  fixes f g :: "'a::t2_space \<Rightarrow> 'b::real_normed_field"
  assumes "continuous F f"
    and "continuous F g"
    and "g (Lim F (\<lambda>x. x)) \<noteq> 0"
  shows "continuous F (\<lambda>x. (f x) / (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous F (\<lambda>x. f x / g x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous F f
continuous F g
g (Lim F (\<lambda>x. x)) \<noteq> (0::'b)

goal (1 subgoal):
 1. continuous F (\<lambda>x. f x / g x)
[PROOF STEP]
unfolding continuous_def
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> f (Lim F (\<lambda>x. x))) F
(g \<longlongrightarrow> g (Lim F (\<lambda>x. x))) F
g (Lim F (\<lambda>x. x)) \<noteq> (0::'b)

goal (1 subgoal):
 1. ((\<lambda>x. f x / g x) \<longlongrightarrow> f (Lim F (\<lambda>x. x)) / g (Lim F (\<lambda>x. x))) F
[PROOF STEP]
by (rule tendsto_divide)


[STATEMENT]
lemma supp_of_finite_union:
  fixes S T::"('a::fs) set"
  assumes fin1: "finite S"
  and     fin2: "finite T"
  shows "supp (S \<union> T) = supp S \<union> supp T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. supp (S \<union> T) = supp S \<union> supp T
[PROOF STEP]
using fin1 fin2
[PROOF STATE]
proof (prove)
using this:
finite S
finite T

goal (1 subgoal):
 1. supp (S \<union> T) = supp S \<union> supp T
[PROOF STEP]
by (simp add: supp_of_finite_sets)


[STATEMENT]
lemma interval_size_3_tendsto_0: "(\<lambda>i. (upper_3 x i - lower_3 x i)) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. upper_3 x i - lower_3 x i) \<longlonglongrightarrow> 0
[PROOF STEP]
by (subst interval_size_3, auto intro: LIMSEQ_divide_realpow_zero)


[STATEMENT]
lemma last_append[rule_format]:
  "\<forall>xs. ys\<noteq>[] \<longrightarrow> ((xs@ys)!(length (xs@ys) - (Suc 0)))=(ys!(length ys - (Suc 0)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>xs. ys \<noteq> [] \<longrightarrow> (xs @ ys) ! (length (xs @ ys) - Suc 0) = ys ! (length ys - Suc 0)
[PROOF STEP]
apply(induct ys)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>xs. [] \<noteq> [] \<longrightarrow> (xs @ []) ! (length (xs @ []) - Suc 0) = [] ! (length [] - Suc 0)
 2. \<And>a ys. \<forall>xs. ys \<noteq> [] \<longrightarrow> (xs @ ys) ! (length (xs @ ys) - Suc 0) = ys ! (length ys - Suc 0) \<Longrightarrow> \<forall>xs. a # ys \<noteq> [] \<longrightarrow> (xs @ a # ys) ! (length (xs @ a # ys) - Suc 0) = (a # ys) ! (length (a # ys) - Suc 0)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a ys. \<forall>xs. ys \<noteq> [] \<longrightarrow> (xs @ ys) ! (length (xs @ ys) - Suc 0) = ys ! (length ys - Suc 0) \<Longrightarrow> \<forall>xs. a # ys \<noteq> [] \<longrightarrow> (xs @ a # ys) ! (length (xs @ a # ys) - Suc 0) = (a # ys) ! (length (a # ys) - Suc 0)
[PROOF STEP]
apply clarify
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a ys xs. \<lbrakk>\<forall>xs. ys \<noteq> [] \<longrightarrow> (xs @ ys) ! (length (xs @ ys) - Suc 0) = ys ! (length ys - Suc 0); a # ys \<noteq> []\<rbrakk> \<Longrightarrow> (xs @ a # ys) ! (length (xs @ a # ys) - Suc 0) = (a # ys) ! (length (a # ys) - Suc 0)
[PROOF STEP]
apply (simp add:nth_append)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma open_winding_number_levelsets:
  assumes \<gamma>: "path \<gamma>" and loop: "pathfinish \<gamma> = pathstart \<gamma>"
  shows "open {z. z \<notin> path_image \<gamma> \<and> winding_number \<gamma> z = k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open {z. z \<notin> path_image \<gamma> \<and> winding_number \<gamma> z = k}
[PROOF STEP]
proof (clarsimp simp: open_dist)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<notin> path_image \<gamma>; k = winding_number \<gamma> x\<rbrakk> \<Longrightarrow> \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<notin> path_image \<gamma> \<and> winding_number \<gamma> y = winding_number \<gamma> x
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<notin> path_image \<gamma>; k = winding_number \<gamma> x\<rbrakk> \<Longrightarrow> \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<notin> path_image \<gamma> \<and> winding_number \<gamma> y = winding_number \<gamma> x
[PROOF STEP]
assume z: "z \<notin> path_image \<gamma>" and k: "k = winding_number \<gamma> z"
[PROOF STATE]
proof (state)
this:
z \<notin> path_image \<gamma>
k = winding_number \<gamma> z

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<notin> path_image \<gamma>; k = winding_number \<gamma> x\<rbrakk> \<Longrightarrow> \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<notin> path_image \<gamma> \<and> winding_number \<gamma> y = winding_number \<gamma> x
[PROOF STEP]
have "open (- path_image \<gamma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open (- path_image \<gamma>)
[PROOF STEP]
by (simp add: closed_path_image \<gamma> open_Compl)
[PROOF STATE]
proof (state)
this:
open (- path_image \<gamma>)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<notin> path_image \<gamma>; k = winding_number \<gamma> x\<rbrakk> \<Longrightarrow> \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<notin> path_image \<gamma> \<and> winding_number \<gamma> y = winding_number \<gamma> x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
open (- path_image \<gamma>)
[PROOF STEP]
obtain e where "e>0" "ball z e \<subseteq> - path_image \<gamma>"
[PROOF STATE]
proof (prove)
using this:
open (- path_image \<gamma>)

goal (1 subgoal):
 1. (\<And>e. \<lbrakk>0 < e; ball z e \<subseteq> - path_image \<gamma>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using open_contains_ball [of "- path_image \<gamma>"] z
[PROOF STATE]
proof (prove)
using this:
open (- path_image \<gamma>)
open (- path_image \<gamma>) = (\<forall>x\<in>- path_image \<gamma>. \<exists>e>0. ball x e \<subseteq> - path_image \<gamma>)
z \<notin> path_image \<gamma>

goal (1 subgoal):
 1. (\<And>e. \<lbrakk>0 < e; ball z e \<subseteq> - path_image \<gamma>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
0 < e
ball z e \<subseteq> - path_image \<gamma>

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<notin> path_image \<gamma>; k = winding_number \<gamma> x\<rbrakk> \<Longrightarrow> \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<notin> path_image \<gamma> \<and> winding_number \<gamma> y = winding_number \<gamma> x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < e
ball z e \<subseteq> - path_image \<gamma>
[PROOF STEP]
show "\<exists>e>0. \<forall>y. dist y z < e \<longrightarrow> y \<notin> path_image \<gamma> \<and> winding_number \<gamma> y = winding_number \<gamma> z"
[PROOF STATE]
proof (prove)
using this:
0 < e
ball z e \<subseteq> - path_image \<gamma>

goal (1 subgoal):
 1. \<exists>e>0. \<forall>y. dist y z < e \<longrightarrow> y \<notin> path_image \<gamma> \<and> winding_number \<gamma> y = winding_number \<gamma> z
[PROOF STEP]
using \<open>e>0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < e
ball z e \<subseteq> - path_image \<gamma>
0 < e

goal (1 subgoal):
 1. \<exists>e>0. \<forall>y. dist y z < e \<longrightarrow> y \<notin> path_image \<gamma> \<and> winding_number \<gamma> y = winding_number \<gamma> z
[PROOF STEP]
by (force simp: norm_minus_commute dist_norm intro: winding_number_eq [OF assms, where S = "ball z e"])
[PROOF STATE]
proof (state)
this:
\<exists>e>0. \<forall>y. dist y z < e \<longrightarrow> y \<notin> path_image \<gamma> \<and> winding_number \<gamma> y = winding_number \<gamma> z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_to_sch_at_2: "nat_to_sch 2 = Base_suc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_sch 2 = Base_suc
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nat_to_sch 2 = Base_suc
[PROOF STEP]
have S1: "c_pair 1 0 = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_pair 1 0 = 2
[PROOF STEP]
by (simp add: c_pair_def sf_def)
[PROOF STATE]
proof (state)
this:
c_pair 1 0 = 2

goal (1 subgoal):
 1. nat_to_sch 2 = Base_suc
[PROOF STEP]
have S2: "nat_to_sch (c_pair 1 0) = Base_suc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_sch (c_pair 1 0) = Base_suc
[PROOF STEP]
by (rule loc_srj_0)
[PROOF STATE]
proof (state)
this:
nat_to_sch (c_pair 1 0) = Base_suc

goal (1 subgoal):
 1. nat_to_sch 2 = Base_suc
[PROOF STEP]
from S1 S2
[PROOF STATE]
proof (chain)
picking this:
c_pair 1 0 = 2
nat_to_sch (c_pair 1 0) = Base_suc
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c_pair 1 0 = 2
nat_to_sch (c_pair 1 0) = Base_suc

goal (1 subgoal):
 1. nat_to_sch 2 = Base_suc
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nat_to_sch 2 = Base_suc

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem sorted_wrt_quicksort:
  assumes "trans R" and "total_on (set xs) R" and "\<And>x. x \<in> set xs \<Longrightarrow> (x, x) \<in> R"
  shows   "sorted_wrt R (quicksort R xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Linorder_Relations.sorted_wrt R (quicksort R xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
trans R
total_on (set xs) R
?x \<in> set xs \<Longrightarrow> (?x, ?x) \<in> R

goal (1 subgoal):
 1. Linorder_Relations.sorted_wrt R (quicksort R xs)
[PROOF STEP]
proof (induction R xs rule: quicksort.induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>uu_. \<lbrakk>trans uu_; total_on (set []) uu_; \<And>x. x \<in> set [] \<Longrightarrow> (x, x) \<in> uu_\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt uu_ (quicksort uu_ [])
 2. \<And>R x xs. \<lbrakk>\<lbrakk>trans R; total_on (set (filter (\<lambda>y. (y, x) \<in> R) xs)) R; \<And>xa. xa \<in> set (filter (\<lambda>y. (y, x) \<in> R) xs) \<Longrightarrow> (xa, xa) \<in> R\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt R (quicksort R (filter (\<lambda>y. (y, x) \<in> R) xs)); \<lbrakk>trans R; total_on (set (filter (\<lambda>y. (y, x) \<notin> R) xs)) R; \<And>xa. xa \<in> set (filter (\<lambda>y. (y, x) \<notin> R) xs) \<Longrightarrow> (xa, xa) \<in> R\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt R (quicksort R (filter (\<lambda>y. (y, x) \<notin> R) xs)); trans R; total_on (set (x # xs)) R; \<And>xa. xa \<in> set (x # xs) \<Longrightarrow> (xa, xa) \<in> R\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt R (quicksort R (x # xs))
[PROOF STEP]
case (2 R x xs)
[PROOF STATE]
proof (state)
this:
\<lbrakk>trans R; total_on (set (filter (\<lambda>y. (y, x) \<in> R) xs)) R; \<And>xa. xa \<in> set (filter (\<lambda>y. (y, x) \<in> R) xs) \<Longrightarrow> (xa, xa) \<in> R\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt R (quicksort R (filter (\<lambda>y. (y, x) \<in> R) xs))
\<lbrakk>trans R; total_on (set (filter (\<lambda>y. (y, x) \<notin> R) xs)) R; \<And>xa. xa \<in> set (filter (\<lambda>y. (y, x) \<notin> R) xs) \<Longrightarrow> (xa, xa) \<in> R\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt R (quicksort R (filter (\<lambda>y. (y, x) \<notin> R) xs))
trans R
total_on (set (x # xs)) R
?x \<in> set (x # xs) \<Longrightarrow> (?x, ?x) \<in> R

goal (2 subgoals):
 1. \<And>uu_. \<lbrakk>trans uu_; total_on (set []) uu_; \<And>x. x \<in> set [] \<Longrightarrow> (x, x) \<in> uu_\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt uu_ (quicksort uu_ [])
 2. \<And>R x xs. \<lbrakk>\<lbrakk>trans R; total_on (set (filter (\<lambda>y. (y, x) \<in> R) xs)) R; \<And>xa. xa \<in> set (filter (\<lambda>y. (y, x) \<in> R) xs) \<Longrightarrow> (xa, xa) \<in> R\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt R (quicksort R (filter (\<lambda>y. (y, x) \<in> R) xs)); \<lbrakk>trans R; total_on (set (filter (\<lambda>y. (y, x) \<notin> R) xs)) R; \<And>xa. xa \<in> set (filter (\<lambda>y. (y, x) \<notin> R) xs) \<Longrightarrow> (xa, xa) \<in> R\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt R (quicksort R (filter (\<lambda>y. (y, x) \<notin> R) xs)); trans R; total_on (set (x # xs)) R; \<And>xa. xa \<in> set (x # xs) \<Longrightarrow> (xa, xa) \<in> R\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt R (quicksort R (x # xs))
[PROOF STEP]
have total: "(a, b) \<in> R" if "(b, a) \<notin> R" "a \<in> set (x#xs)" "b \<in> set (x#xs)" for a b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a, b) \<in> R
[PROOF STEP]
using "2.prems" that
[PROOF STATE]
proof (prove)
using this:
trans R
total_on (set (x # xs)) R
?x \<in> set (x # xs) \<Longrightarrow> (?x, ?x) \<in> R
(b, a) \<notin> R
a \<in> set (x # xs)
b \<in> set (x # xs)

goal (1 subgoal):
 1. (a, b) \<in> R
[PROOF STEP]
unfolding total_on_def
[PROOF STATE]
proof (prove)
using this:
trans R
\<forall>xa\<in>set (x # xs). \<forall>y\<in>set (x # xs). xa \<noteq> y \<longrightarrow> (xa, y) \<in> R \<or> (y, xa) \<in> R
?x \<in> set (x # xs) \<Longrightarrow> (?x, ?x) \<in> R
(b, a) \<notin> R
a \<in> set (x # xs)
b \<in> set (x # xs)

goal (1 subgoal):
 1. (a, b) \<in> R
[PROOF STEP]
by (cases "a = b") auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>(?b, ?a) \<notin> R; ?a \<in> set (x # xs); ?b \<in> set (x # xs)\<rbrakk> \<Longrightarrow> (?a, ?b) \<in> R

goal (2 subgoals):
 1. \<And>uu_. \<lbrakk>trans uu_; total_on (set []) uu_; \<And>x. x \<in> set [] \<Longrightarrow> (x, x) \<in> uu_\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt uu_ (quicksort uu_ [])
 2. \<And>R x xs. \<lbrakk>\<lbrakk>trans R; total_on (set (filter (\<lambda>y. (y, x) \<in> R) xs)) R; \<And>xa. xa \<in> set (filter (\<lambda>y. (y, x) \<in> R) xs) \<Longrightarrow> (xa, xa) \<in> R\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt R (quicksort R (filter (\<lambda>y. (y, x) \<in> R) xs)); \<lbrakk>trans R; total_on (set (filter (\<lambda>y. (y, x) \<notin> R) xs)) R; \<And>xa. xa \<in> set (filter (\<lambda>y. (y, x) \<notin> R) xs) \<Longrightarrow> (xa, xa) \<in> R\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt R (quicksort R (filter (\<lambda>y. (y, x) \<notin> R) xs)); trans R; total_on (set (x # xs)) R; \<And>xa. xa \<in> set (x # xs) \<Longrightarrow> (xa, xa) \<in> R\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt R (quicksort R (x # xs))
[PROOF STEP]
have *: "sorted_wrt R (quicksort R (filter (\<lambda>y. (y,x) \<in> R) xs))"
          "sorted_wrt R (quicksort R (filter (\<lambda>y. (y,x) \<notin> R) xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Linorder_Relations.sorted_wrt R (quicksort R (filter (\<lambda>y. (y, x) \<in> R) xs)) &&& Linorder_Relations.sorted_wrt R (quicksort R (filter (\<lambda>y. (y, x) \<notin> R) xs))
[PROOF STEP]
by ((rule 2 total_on_subset[OF \<open>total_on (set (x#xs)) R\<close>]) | force)+
[PROOF STATE]
proof (state)
this:
Linorder_Relations.sorted_wrt R (quicksort R (filter (\<lambda>y. (y, x) \<in> R) xs))
Linorder_Relations.sorted_wrt R (quicksort R (filter (\<lambda>y. (y, x) \<notin> R) xs))

goal (2 subgoals):
 1. \<And>uu_. \<lbrakk>trans uu_; total_on (set []) uu_; \<And>x. x \<in> set [] \<Longrightarrow> (x, x) \<in> uu_\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt uu_ (quicksort uu_ [])
 2. \<And>R x xs. \<lbrakk>\<lbrakk>trans R; total_on (set (filter (\<lambda>y. (y, x) \<in> R) xs)) R; \<And>xa. xa \<in> set (filter (\<lambda>y. (y, x) \<in> R) xs) \<Longrightarrow> (xa, xa) \<in> R\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt R (quicksort R (filter (\<lambda>y. (y, x) \<in> R) xs)); \<lbrakk>trans R; total_on (set (filter (\<lambda>y. (y, x) \<notin> R) xs)) R; \<And>xa. xa \<in> set (filter (\<lambda>y. (y, x) \<notin> R) xs) \<Longrightarrow> (xa, xa) \<in> R\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt R (quicksort R (filter (\<lambda>y. (y, x) \<notin> R) xs)); trans R; total_on (set (x # xs)) R; \<And>xa. xa \<in> set (x # xs) \<Longrightarrow> (xa, xa) \<in> R\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt R (quicksort R (x # xs))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Linorder_Relations.sorted_wrt R (quicksort R (x # xs))
[PROOF STEP]
by (auto intro!: sorted_wrt_append sorted_wrt.intros \<open>trans R\<close> *
             intro: transD[OF \<open>trans R\<close>] dest!: total simp: total_on_def)
[PROOF STATE]
proof (state)
this:
Linorder_Relations.sorted_wrt R (quicksort R (x # xs))

goal (1 subgoal):
 1. \<And>uu_. \<lbrakk>trans uu_; total_on (set []) uu_; \<And>x. x \<in> set [] \<Longrightarrow> (x, x) \<in> uu_\<rbrakk> \<Longrightarrow> Linorder_Relations.sorted_wrt uu_ (quicksort uu_ [])
[PROOF STEP]
qed auto


[STATEMENT]
lemma is_aligned_add_not_aligned:
  "\<lbrakk>is_aligned (p::'a::len word) n; \<not> is_aligned (q::'a::len word) n\<rbrakk> \<Longrightarrow> \<not> is_aligned (p + q) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_aligned p n; \<not> is_aligned q n\<rbrakk> \<Longrightarrow> \<not> is_aligned (p + q) n
[PROOF STEP]
by (metis is_aligned_addD1)


[STATEMENT]
lemma inversions_code:
  "inversions xs =
     Sigma {..<length xs} (\<lambda>i. Set.filter (\<lambda>j. less (xs ! j) (xs ! i)) {i<..<length xs})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inversions xs = (SIGMA i:{..<length xs}. Set.filter (\<lambda>j. xs ! j < xs ! i) {i<..<length xs})
[PROOF STEP]
by (auto simp: inversions_altdef)


[STATEMENT]
lemma Infinitesimal_pi_divide_HNatInfinite:
     "N \<in> HNatInfinite
      \<Longrightarrow> hypreal_of_real pi/(hypreal_of_hypnat N) \<in> Infinitesimal"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. N \<in> HNatInfinite \<Longrightarrow> hypreal_of_real pi / hypreal_of_hypnat N \<in> Infinitesimal
[PROOF STEP]
by (simp add: Infinitesimal_HFinite_mult2 field_class.field_divide_inverse)


[STATEMENT]
lemma union_inclusion:
 "\<lbrakk> A \<subseteq> A'; B\<subseteq> B' \<rbrakk> \<Longrightarrow> A\<union>B \<subseteq> A'\<union>B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> A'; B \<subseteq> B'\<rbrakk> \<Longrightarrow> A \<union> B \<subseteq> A' \<union> B'
[PROOF STEP]
by blast


[STATEMENT]
lemma minus_scalar_prod_distrib: fixes v\<^sub>1 :: "'a :: ring vec"
  assumes v: "v\<^sub>1 \<in> carrier_vec n" "v\<^sub>2 \<in> carrier_vec n" "v\<^sub>3 \<in> carrier_vec n"
  shows "(v\<^sub>1 - v\<^sub>2) \<bullet> v\<^sub>3 = v\<^sub>1 \<bullet> v\<^sub>3 - v\<^sub>2 \<bullet> v\<^sub>3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (v\<^sub>1 - v\<^sub>2) \<bullet> v\<^sub>3 = v\<^sub>1 \<bullet> v\<^sub>3 - v\<^sub>2 \<bullet> v\<^sub>3
[PROOF STEP]
unfolding minus_add_uminus_vec[OF v(1-2)]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (v\<^sub>1 + - v\<^sub>2) \<bullet> v\<^sub>3 = v\<^sub>1 \<bullet> v\<^sub>3 - v\<^sub>2 \<bullet> v\<^sub>3
[PROOF STEP]
by (subst add_scalar_prod_distrib[OF v(1)], insert v, auto)


[STATEMENT]
lemma nn_set_integral_set_mono:
  "A \<subseteq> B \<Longrightarrow> (\<integral>\<^sup>+ x \<in> A. f x \<partial>M) \<le> (\<integral>\<^sup>+ x \<in> B. f x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> set_nn_integral M A f \<le> set_nn_integral M B f
[PROOF STEP]
by (auto intro!: nn_integral_mono split: split_indicator)


[STATEMENT]
lemma all_in_set_subarray_conv: "(\<forall>j. j \<in> set (subarray l r a h) \<longrightarrow> P j) = (\<forall>k. l \<le> k \<and> k < r \<and> k < Array.length h a \<longrightarrow> P (Array.get h a ! k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j. j \<in> set (subarray l r a h) \<longrightarrow> P j) = (\<forall>k. l \<le> k \<and> k < r \<and> k < Array.length h a \<longrightarrow> P (Array.get h a ! k))
[PROOF STEP]
unfolding subarray_def Array.length_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j. j \<in> set (nths' l r (Array.get h a)) \<longrightarrow> P j) = (\<forall>k. l \<le> k \<and> k < r \<and> k < length (Array.get h a) \<longrightarrow> P (Array.get h a ! k))
[PROOF STEP]
by (rule all_in_set_nths'_conv)


[STATEMENT]
lemma eucl_of_list_map_mult_left[simp]:
  assumes [simp]: "length xs = DIM('a::executable_euclidean_space)"
  shows "(eucl_of_list (map (\<lambda>x. r * f x) xs)::'a) = r *\<^sub>R eucl_of_list (map f xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eucl_of_list (map (\<lambda>x. r * f x) xs) = r *\<^sub>R eucl_of_list (map f xs)
[PROOF STEP]
by (auto intro!: euclidean_eqI[where 'a='a] simp: algebra_simps eucl_of_list_inner)


[STATEMENT]
lemma exp_Complex: "exp(Complex r t) = of_real(exp r) * Complex (cos t) (sin t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (Complex r t) = complex_of_real (exp r) * Complex (cos t) (sin t)
[PROOF STEP]
by (simp add: Complex_eq exp_add exp_Euler exp_of_real sin_of_real cos_of_real)


[STATEMENT]
lemma "real_of_dec (m, e) = int_of_integer m * 10 powr (int_of_integer e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_dec (m, e) = real_of_int (int_of_integer m) * 10 powr real_of_int (int_of_integer e)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real_of_dec (m, e) = real_of_int (int_of_integer m) * 10 powr real_of_int (int_of_integer e)
[PROOF STEP]
have 1: "e \<ge> 0 \<Longrightarrow> real (nat_of_integer e) = real_of_int (int_of_integer e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> e \<Longrightarrow> real (nat_of_integer e) = real_of_int (int_of_integer e)
[PROOF STEP]
using less_eq_integer.rep_eq nat_of_integer.rep_eq
[PROOF STATE]
proof (prove)
using this:
(?x \<le> ?xa) = (int_of_integer ?x \<le> int_of_integer ?xa)
nat_of_integer ?x = nat (int_of_integer ?x)

goal (1 subgoal):
 1. 0 \<le> e \<Longrightarrow> real (nat_of_integer e) = real_of_int (int_of_integer e)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> e \<Longrightarrow> real (nat_of_integer e) = real_of_int (int_of_integer e)

goal (1 subgoal):
 1. real_of_dec (m, e) = real_of_int (int_of_integer m) * 10 powr real_of_int (int_of_integer e)
[PROOF STEP]
have 2: "e \<le> 0 \<Longrightarrow> real_of_int (int_of_integer e) = - real (nat (- int_of_integer e))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e \<le> 0 \<Longrightarrow> real_of_int (int_of_integer e) = - real (nat (- int_of_integer e))
[PROOF STEP]
using less_eq_integer.rep_eq
[PROOF STATE]
proof (prove)
using this:
(?x \<le> ?xa) = (int_of_integer ?x \<le> int_of_integer ?xa)

goal (1 subgoal):
 1. e \<le> 0 \<Longrightarrow> real_of_int (int_of_integer e) = - real (nat (- int_of_integer e))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
e \<le> 0 \<Longrightarrow> real_of_int (int_of_integer e) = - real (nat (- int_of_integer e))

goal (1 subgoal):
 1. real_of_dec (m, e) = real_of_int (int_of_integer m) * 10 powr real_of_int (int_of_integer e)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_dec (m, e) = real_of_int (int_of_integer m) * 10 powr real_of_int (int_of_integer e)
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
0 \<le> e \<Longrightarrow> real (nat_of_integer e) = real_of_int (int_of_integer e)

goal (1 subgoal):
 1. real_of_dec (m, e) = real_of_int (int_of_integer m) * 10 powr real_of_int (int_of_integer e)
[PROOF STEP]
apply (auto simp: powr_realpow[symmetric] divide_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> 0 \<le> e; 10 powr real_of_int (int_of_integer e) * 10 powr real (nat (- int_of_integer e)) \<noteq> 1\<rbrakk> \<Longrightarrow> int_of_integer m = 0
[PROOF STEP]
apply (subst (asm) 2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<not> 0 \<le> e \<Longrightarrow> e \<le> 0
 2. \<lbrakk>\<not> 0 \<le> e; 10 powr - real (nat (- int_of_integer e)) * 10 powr real (nat (- int_of_integer e)) \<noteq> 1\<rbrakk> \<Longrightarrow> int_of_integer m = 0
[PROOF STEP]
apply (auto simp: powr_add[symmetric])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
real_of_dec (m, e) = real_of_int (int_of_integer m) * 10 powr real_of_int (int_of_integer e)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma T_BIT_absch: assumes nqs: "n \<le> length qs"
  shows "T_BIT n \<le> (7 / 4) * T_A' n - 3/4*n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T_BIT n \<le> 7 / 4 * real_of_int (T_A' n) - 3 / 4 * real n
[PROOF STEP]
using nqs T_BIT_absch_le[of n] T_A_A'_leq[of n]
[PROOF STATE]
proof (prove)
using this:
n \<le> length qs
n \<le> length qs \<Longrightarrow> T_BIT n \<le> 7 / 4 * real_of_int (T_A n) - 3 / 4 * real n
n \<le> length paid_A' \<Longrightarrow> T_A n \<le> T_A' n

goal (1 subgoal):
 1. T_BIT n \<le> 7 / 4 * real_of_int (T_A' n) - 3 / 4 * real n
[PROOF STEP]
by auto


[STATEMENT]
lemma trans_congruent_rel: "trans (congruent_rel b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trans (congruent_rel b)
[PROOF STEP]
unfolding trans_def congruent_rel_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y z. (x, y) \<in> {(a, c). cong a c b} \<longrightarrow> (y, z) \<in> {(a, c). cong a c b} \<longrightarrow> (x, z) \<in> {(a, c). cong a c b}
[PROOF STEP]
unfolding cong_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y z. (x, y) \<in> {(a, c). \<exists>k. a - c = b * k} \<longrightarrow> (y, z) \<in> {(a, c). \<exists>k. a - c = b * k} \<longrightarrow> (x, z) \<in> {(a, c). \<exists>k. a - c = b * k}
[PROOF STEP]
by (auto, metis add_assoc diff_add_cancel
    diff_conv_add_uminus distrib_left)


[STATEMENT]
lemma infinite_iff_card_of_countable: "\<lbrakk>countable B; infinite B\<rbrakk> \<Longrightarrow> infinite A \<longleftrightarrow> ( |B| \<le>o |A| )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>countable B; infinite B\<rbrakk> \<Longrightarrow> infinite A = (|B| \<le>o |A|)
[PROOF STEP]
unfolding infinite_iff_countable_subset card_of_ordLeq countable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>f. inj_on f B; |UNIV| \<le>o |B|\<rbrakk> \<Longrightarrow> (|UNIV| \<le>o |A|) = (|B| \<le>o |A|)
[PROOF STEP]
by (force intro: card_of_ordLeqI ordLeq_transitive)


[STATEMENT]
lemma lm049:
  assumes "runiq R"
  shows "card (R `` {a}) = 1 \<longleftrightarrow> a \<in> Domain R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (card (R `` {a}) = 1) = (a \<in> Domain R)
[PROOF STEP]
using assms card_Suc_eq One_nat_def
[PROOF STATE]
proof (prove)
using this:
runiq R
(card ?A = Suc ?k) = (\<exists>b B. ?A = insert b B \<and> b \<notin> B \<and> card B = ?k \<and> (?k = 0 \<longrightarrow> B = {}))
1 = Suc 0

goal (1 subgoal):
 1. (card (R `` {a}) = 1) = (a \<in> Domain R)
[PROOF STEP]
by (metis Image_within_domain' Suc_neq_Zero assms rightUniqueSetCardinality)


[STATEMENT]
lemma representation_add:
  "independent basis \<Longrightarrow> v \<in> span basis \<Longrightarrow> u \<in> span basis \<Longrightarrow>
    representation basis (u + v) = (\<lambda>b. representation basis u b + representation basis v b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>independent basis; v \<in> span basis; u \<in> span basis\<rbrakk> \<Longrightarrow> representation basis (u + v) = (\<lambda>b. representation basis u b + representation basis v b)
[PROOF STEP]
using representation_diff[of basis "-v" u]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>independent basis; - v \<in> span basis; u \<in> span basis\<rbrakk> \<Longrightarrow> representation basis (u - - v) = (\<lambda>b. representation basis u b - representation basis (- v) b)

goal (1 subgoal):
 1. \<lbrakk>independent basis; v \<in> span basis; u \<in> span basis\<rbrakk> \<Longrightarrow> representation basis (u + v) = (\<lambda>b. representation basis u b + representation basis v b)
[PROOF STEP]
by (simp add: representation_neg representation_diff span_neg)


[STATEMENT]
lemma finite_Union: "\<lbrakk> finite A; \<forall>x \<in> A. finite (a x) \<rbrakk> \<Longrightarrow> finite (\<Union>{a x|x. x \<in> A})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; \<forall>x\<in>A. finite (a x)\<rbrakk> \<Longrightarrow> finite (\<Union> {a x |x. x \<in> A})
[PROOF STEP]
by (induction A rule: finite_induct) (auto)


[STATEMENT]
lemma snd_least_max_arg_max_list:
  "snd (least_max_arg_max_list f (n, f n) xs) = (MAX x \<in> insert n (set xs). f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (least_max_arg_max_list f (n, f n) xs) = Max (f ` insert n (set xs))
[PROOF STEP]
unfolding least_max_arg_max_list_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (foldl (\<lambda>(am, m) x. if m < f x then (x, f x) else (am, m)) (n, f n) xs) = Max (f ` insert n (set xs))
[PROOF STEP]
proof (induction xs arbitrary: n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n. snd (foldl (\<lambda>(am, m) x. if m < f x then (x, f x) else (am, m)) (n, f n) []) = Max (f ` insert n (set []))
 2. \<And>a xs n. (\<And>n. snd (foldl (\<lambda>(am, m) x. if m < f x then (x, f x) else (am, m)) (n, f n) xs) = Max (f ` insert n (set xs))) \<Longrightarrow> snd (foldl (\<lambda>(am, m) x. if m < f x then (x, f x) else (am, m)) (n, f n) (a # xs)) = Max (f ` insert n (set (a # xs)))
[PROOF STEP]
case (Cons a xs)
[PROOF STATE]
proof (state)
this:
snd (foldl (\<lambda>a. case a of (am, m) \<Rightarrow> \<lambda>x. if m < f x then (x, f x) else (am, m)) (?n, f ?n) xs) = Max (f ` insert ?n (set xs))

goal (2 subgoals):
 1. \<And>n. snd (foldl (\<lambda>(am, m) x. if m < f x then (x, f x) else (am, m)) (n, f n) []) = Max (f ` insert n (set []))
 2. \<And>a xs n. (\<And>n. snd (foldl (\<lambda>(am, m) x. if m < f x then (x, f x) else (am, m)) (n, f n) xs) = Max (f ` insert n (set xs))) \<Longrightarrow> snd (foldl (\<lambda>(am, m) x. if m < f x then (x, f x) else (am, m)) (n, f n) (a # xs)) = Max (f ` insert n (set (a # xs)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
snd (foldl (\<lambda>a. case a of (am, m) \<Rightarrow> \<lambda>x. if m < f x then (x, f x) else (am, m)) (?n, f ?n) xs) = Max (f ` insert ?n (set xs))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
snd (foldl (\<lambda>a. case a of (am, m) \<Rightarrow> \<lambda>x. if m < f x then (x, f x) else (am, m)) (?n, f ?n) xs) = Max (f ` insert ?n (set xs))

goal (1 subgoal):
 1. snd (foldl (\<lambda>a. case a of (am, m) \<Rightarrow> \<lambda>x. if m < f x then (x, f x) else (am, m)) (n, f n) (a # xs)) = Max (f ` insert n (set (a # xs)))
[PROOF STEP]
by (cases "xs = []") (fastforce simp: max.assoc[symmetric])+
[PROOF STATE]
proof (state)
this:
snd (foldl (\<lambda>a. case a of (am, m) \<Rightarrow> \<lambda>x. if m < f x then (x, f x) else (am, m)) (n, f n) (a # xs)) = Max (f ` insert n (set (a # xs)))

goal (1 subgoal):
 1. \<And>n. snd (foldl (\<lambda>(am, m) x. if m < f x then (x, f x) else (am, m)) (n, f n) []) = Max (f ` insert n (set []))
[PROOF STEP]
qed auto


[STATEMENT]
lemma powrat_inverse_of_nat_ge_one [simp]:
      "a \<ge> 1 \<Longrightarrow> a pow\<^sub>\<rat> (inverse (of_nat n)) \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> a \<Longrightarrow> 1 \<le> a pow\<^sub>\<rat> inverse (rat_of_nat n)
[PROOF STEP]
by (simp add: powrat_ge_one)


[STATEMENT]
lemma DERIV_cdivide:
  "(f has_field_derivative D) (at x within s) \<Longrightarrow>
    ((\<lambda>x. f x / c) has_field_derivative D / c) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_field_derivative D) (at x within s) \<Longrightarrow> ((\<lambda>x. f x / c) has_field_derivative D / c) (at x within s)
[PROOF STEP]
using DERIV_cmult_right[of f D x s "1 / c"]
[PROOF STATE]
proof (prove)
using this:
(f has_field_derivative D) (at x within s) \<Longrightarrow> ((\<lambda>x. f x * ((1::'a) / c)) has_field_derivative D * ((1::'a) / c)) (at x within s)

goal (1 subgoal):
 1. (f has_field_derivative D) (at x within s) \<Longrightarrow> ((\<lambda>x. f x / c) has_field_derivative D / c) (at x within s)
[PROOF STEP]
by simp


[STATEMENT]
lemma ipt_iprange_negation_type_to_br_intersect: "wordinterval_to_set (ipt_iprange_negation_type_to_br_intersect l) =
      (\<Inter> ip \<in> set (getPos l). ipt_iprange_to_set ip) - (\<Union> ip \<in> set (getNeg l). ipt_iprange_to_set ip)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set (ipt_iprange_negation_type_to_br_intersect l) = \<Inter> (ipt_iprange_to_set ` set (getPos l)) - \<Union> (ipt_iprange_to_set ` set (getNeg l))
[PROOF STEP]
apply(simp add: ipt_iprange_negation_type_to_br_intersect_def l2wi_negation_type_intersect NegPos_map_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>a\<in>set (getPos l). case ipt_iprange_to_interval a of (x, xa) \<Rightarrow> {x..xa}) - (\<Union>a\<in>set (getNeg l). case ipt_iprange_to_interval a of (x, xa) \<Rightarrow> {x..xa}) = \<Inter> (ipt_iprange_to_set ` set (getPos l)) - \<Union> (ipt_iprange_to_set ` set (getNeg l))
[PROOF STEP]
using ipt_iprange_to_interval
[PROOF STATE]
proof (prove)
using this:
ipt_iprange_to_interval ?ip = (?s, ?e) \<Longrightarrow> {?s..?e} = ipt_iprange_to_set ?ip

goal (1 subgoal):
 1. (\<Inter>a\<in>set (getPos l). case ipt_iprange_to_interval a of (x, xa) \<Rightarrow> {x..xa}) - (\<Union>a\<in>set (getNeg l). case ipt_iprange_to_interval a of (x, xa) \<Rightarrow> {x..xa}) = \<Inter> (ipt_iprange_to_set ` set (getPos l)) - \<Union> (ipt_iprange_to_set ` set (getNeg l))
[PROOF STEP]
by blast


[STATEMENT]
lemma ceiling_le_iff: "\<lceil>x\<rceil> \<le> z \<longleftrightarrow> x \<le> of_int z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lceil>x\<rceil> \<le> z) = (x \<le> of_int z)
[PROOF STEP]
unfolding ceiling_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- \<lfloor>- x\<rfloor> \<le> z) = (x \<le> of_int z)
[PROOF STEP]
using le_floor_iff [of "- z" "- x"]
[PROOF STATE]
proof (prove)
using this:
(- z \<le> \<lfloor>- x\<rfloor>) = (of_int (- z) \<le> - x)

goal (1 subgoal):
 1. (- \<lfloor>- x\<rfloor> \<le> z) = (x \<le> of_int z)
[PROOF STEP]
by auto


[STATEMENT]
lemma ln_nth_prime_asymp_equiv [asymp_equiv_intros]:
  "(\<lambda>n. ln (nth_prime n)) \<sim>[at_top] ln"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. ln (real (nth_prime n))) \<sim>[sequentially] (\<lambda>x. ln (real x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. ln (real (nth_prime n))) \<sim>[sequentially] (\<lambda>x. ln (real x))
[PROOF STEP]
have "(\<lambda>n. ln (nth_prime n) - (ln n + ln (ln n))) \<in> o(ln)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. ln (real (nth_prime n)) - (ln (real n) + ln (ln (real n)))) \<in> o(\<lambda>x. ln (real x))
[PROOF STEP]
using ln_nth_prime_asymptotics
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ln (real (nth_prime n)) - (ln (real n) + ln (ln (real n)))) \<in> o(\<lambda>_. 1)

goal (1 subgoal):
 1. (\<lambda>n. ln (real (nth_prime n)) - (ln (real n) + ln (ln (real n)))) \<in> o(\<lambda>x. ln (real x))
[PROOF STEP]
by (rule landau_o.small.trans) real_asymp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ln (real (nth_prime n)) - (ln (real n) + ln (ln (real n)))) \<in> o(\<lambda>x. ln (real x))

goal (1 subgoal):
 1. (\<lambda>n. ln (real (nth_prime n))) \<sim>[sequentially] (\<lambda>x. ln (real x))
[PROOF STEP]
hence "(\<lambda>n. ln (nth_prime n) - (ln n + ln (ln n)) + ln (ln n)) \<in> o(ln)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ln (real (nth_prime n)) - (ln (real n) + ln (ln (real n)))) \<in> o(\<lambda>x. ln (real x))

goal (1 subgoal):
 1. (\<lambda>n. ln (real (nth_prime n)) - (ln (real n) + ln (ln (real n))) + ln (ln (real n))) \<in> o(\<lambda>x. ln (real x))
[PROOF STEP]
by (rule sum_in_smallo) real_asymp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ln (real (nth_prime n)) - (ln (real n) + ln (ln (real n))) + ln (ln (real n))) \<in> o(\<lambda>x. ln (real x))

goal (1 subgoal):
 1. (\<lambda>n. ln (real (nth_prime n))) \<sim>[sequentially] (\<lambda>x. ln (real x))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ln (real (nth_prime n)) - (ln (real n) + ln (ln (real n))) + ln (ln (real n))) \<in> o(\<lambda>x. ln (real x))

goal (1 subgoal):
 1. (\<lambda>n. ln (real (nth_prime n))) \<sim>[sequentially] (\<lambda>x. ln (real x))
[PROOF STEP]
by (intro smallo_imp_asymp_equiv) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ln (real (nth_prime n))) \<sim>[sequentially] (\<lambda>x. ln (real x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma PNT2_imp_PNT3:
  assumes "(\<lambda>x. \<pi> x * ln (\<pi> x)) \<sim>[at_top] (\<lambda>x. x)"
  shows   "nth_prime \<sim>[at_top] (\<lambda>n. n * ln n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. real (nth_prime x)) \<sim>[sequentially] (\<lambda>x. real x * ln (real x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. real (nth_prime x)) \<sim>[sequentially] (\<lambda>x. real x * ln (real x))
[PROOF STEP]
have "(\<lambda>n. nth_prime n) \<sim>[at_top] (\<lambda>n. \<pi> (nth_prime n) * ln (\<pi> (nth_prime n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. real (nth_prime x)) \<sim>[sequentially] (\<lambda>n. \<pi> (real (nth_prime n)) * ln (\<pi> (real (nth_prime n))))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. \<pi> x * ln (\<pi> x)) \<sim>[at_top] (\<lambda>x. x)

goal (1 subgoal):
 1. (\<lambda>x. real (nth_prime x)) \<sim>[sequentially] (\<lambda>n. \<pi> (real (nth_prime n)) * ln (\<pi> (real (nth_prime n))))
[PROOF STEP]
by (rule asymp_equiv_symI [OF asymp_equiv_compose'])
       (auto intro!: filterlim_compose[OF filterlim_real_sequentially nth_prime_at_top])
[PROOF STATE]
proof (state)
this:
(\<lambda>x. real (nth_prime x)) \<sim>[sequentially] (\<lambda>n. \<pi> (real (nth_prime n)) * ln (\<pi> (real (nth_prime n))))

goal (1 subgoal):
 1. (\<lambda>x. real (nth_prime x)) \<sim>[sequentially] (\<lambda>x. real x * ln (real x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. real (nth_prime x)) \<sim>[sequentially] (\<lambda>n. \<pi> (real (nth_prime n)) * ln (\<pi> (real (nth_prime n))))

goal (1 subgoal):
 1. (\<lambda>x. real (nth_prime x)) \<sim>[sequentially] (\<lambda>x. real x * ln (real x))
[PROOF STEP]
have "\<dots> = (\<lambda>n. real (Suc n) * ln (real (Suc n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<pi> (real (nth_prime n)) * ln (\<pi> (real (nth_prime n)))) = (\<lambda>n. real (Suc n) * ln (real (Suc n)))
[PROOF STEP]
by (simp add: add_ac)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<pi> (real (nth_prime n)) * ln (\<pi> (real (nth_prime n)))) = (\<lambda>n. real (Suc n) * ln (real (Suc n)))

goal (1 subgoal):
 1. (\<lambda>x. real (nth_prime x)) \<sim>[sequentially] (\<lambda>x. real x * ln (real x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<pi> (real (nth_prime n)) * ln (\<pi> (real (nth_prime n)))) = (\<lambda>n. real (Suc n) * ln (real (Suc n)))

goal (1 subgoal):
 1. (\<lambda>x. real (nth_prime x)) \<sim>[sequentially] (\<lambda>x. real x * ln (real x))
[PROOF STEP]
have "\<dots> \<sim>[at_top] (\<lambda>n. real n * ln (real n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. real (Suc n) * ln (real (Suc n))) \<sim>[sequentially] (\<lambda>n. real n * ln (real n))
[PROOF STEP]
by real_asymp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. real (Suc n) * ln (real (Suc n))) \<sim>[sequentially] (\<lambda>n. real n * ln (real n))

goal (1 subgoal):
 1. (\<lambda>x. real (nth_prime x)) \<sim>[sequentially] (\<lambda>x. real x * ln (real x))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>c d. c \<sim>[sequentially] d \<Longrightarrow> c \<sim>[sequentially] d) \<Longrightarrow> (\<lambda>x. real (nth_prime x)) \<sim>[sequentially] (\<lambda>a. real a * ln (real a))
[PROOF STEP]
show "nth_prime \<sim>[at_top] (\<lambda>n. n * ln n)"
[PROOF STATE]
proof (prove)
using this:
(\<And>c d. c \<sim>[sequentially] d \<Longrightarrow> c \<sim>[sequentially] d) \<Longrightarrow> (\<lambda>x. real (nth_prime x)) \<sim>[sequentially] (\<lambda>a. real a * ln (real a))

goal (1 subgoal):
 1. (\<lambda>x. real (nth_prime x)) \<sim>[sequentially] (\<lambda>x. real x * ln (real x))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>x. real (nth_prime x)) \<sim>[sequentially] (\<lambda>x. real x * ln (real x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma primes_upto_sieve [code]:
  "primes_upto n = map fst (filter snd (enumerate 2 (sieve 1 (replicate (n - 1) True))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primes_upto n = map fst (filter snd (enumerate 2 (sieve 1 (replicate (n - 1) True))))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. primes_upto n = map fst (filter snd (enumerate 2 (sieve 1 (replicate (n - 1) True))))
[PROOF STEP]
have "primes_upto n = sorted_list_of_set (numbers_of_marks 2 (sieve 1 (replicate (n - 1) True)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primes_upto n = sorted_list_of_set (numbers_of_marks 2 (sieve 1 (replicate (n - 1) True)))
[PROOF STEP]
apply (rule sorted_distinct_set_unique)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. sorted (primes_upto n)
 2. distinct (primes_upto n)
 3. sorted (sorted_list_of_set (numbers_of_marks 2 (sieve 1 (replicate (n - 1) True))))
 4. distinct (sorted_list_of_set (numbers_of_marks 2 (sieve 1 (replicate (n - 1) True))))
 5. set (primes_upto n) = set (sorted_list_of_set (numbers_of_marks 2 (sieve 1 (replicate (n - 1) True))))
[PROOF STEP]
apply (simp_all only: set_primes_upto_sieve numbers_of_marks_def)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. sorted (primes_upto n)
 2. distinct (primes_upto n)
 3. sorted (sorted_list_of_set (fst ` {x \<in> set (enumerate 2 (sieve 1 (replicate (n - 1) True))). snd x}))
 4. distinct (sorted_list_of_set (fst ` {x \<in> set (enumerate 2 (sieve 1 (replicate (n - 1) True))). snd x}))
 5. fst ` {x \<in> set (enumerate 2 (sieve 1 (replicate (n - 1) True))). snd x} = set (sorted_list_of_set (fst ` {x \<in> set (enumerate 2 (sieve 1 (replicate (n - 1) True))). snd x}))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
primes_upto n = sorted_list_of_set (numbers_of_marks 2 (sieve 1 (replicate (n - 1) True)))

goal (1 subgoal):
 1. primes_upto n = map fst (filter snd (enumerate 2 (sieve 1 (replicate (n - 1) True))))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
primes_upto n = sorted_list_of_set (numbers_of_marks 2 (sieve 1 (replicate (n - 1) True)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
primes_upto n = sorted_list_of_set (numbers_of_marks 2 (sieve 1 (replicate (n - 1) True)))

goal (1 subgoal):
 1. primes_upto n = map fst (filter snd (enumerate 2 (sieve 1 (replicate (n - 1) True))))
[PROOF STEP]
by (simp add: sorted_list_of_set_numbers_of_marks)
[PROOF STATE]
proof (state)
this:
primes_upto n = map fst (filter snd (enumerate 2 (sieve 1 (replicate (n - 1) True))))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group) ord_inv [simp]:
   "x \<in> carrier G
        \<Longrightarrow> ord (m_inv G x) = ord x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier G \<Longrightarrow> ord (inv x) = ord x
[PROOF STEP]
by (simp add: ord_unique pow_eq_id nat_pow_inv)


[STATEMENT]
lemma finite_gen_paths: "finite (gen_paths)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite gen_paths
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite gen_paths
[PROOF STEP]
have "finite ({[v] | v . v \<in> V})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {[v] |v. v \<in> V}
[PROOF STEP]
using finV
[PROOF STATE]
proof (prove)
using this:
finite V

goal (1 subgoal):
 1. finite {[v] |v. v \<in> V}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {[v] |v. v \<in> V}

goal (1 subgoal):
 1. finite gen_paths
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
finite {[v] |v. v \<in> V}

goal (1 subgoal):
 1. finite gen_paths
[PROOF STEP]
using gen_paths_ss finite_cycles finite_paths finite_subset
[PROOF STATE]
proof (prove)
using this:
finite {[v] |v. v \<in> V}
gen_paths \<subseteq> cycles \<union> paths \<union> {[v] |v. v \<in> V}
finite cycles
finite paths
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iIN_plus: "\<lbrakk> x \<in> [n\<dots>,d]; k \<le> n + d - x \<rbrakk> \<Longrightarrow> x + k \<in> [n\<dots>,d]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> [n\<dots>,d]; k \<le> n + d - x\<rbrakk> \<Longrightarrow> x + k \<in> [n\<dots>,d]
[PROOF STEP]
by (fastforce simp: iIN_iff)


[STATEMENT]
lemma call_zero_iff [simp]: "(\<forall>u. cinner x u = 0) \<longleftrightarrow> (x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>u. cinner x u = 0) = (x = (0::'a))
[PROOF STEP]
by auto (use cinner_eq_zero_iff in blast)


[STATEMENT]
lemma least_power_of_permutation:
  assumes "permutation p" shows "(p ^^ (least_power p a)) a = a" and "least_power p a > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p ^^ least_power p a) a = a &&& 0 < least_power p a
[PROOF STEP]
using permutation_is_nilpotent[OF assms] least_powerI
[PROOF STATE]
proof (prove)
using this:
(\<And>n. \<lbrakk>p ^^ n = id; 0 < n\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
\<lbrakk>(?f ^^ ?n) ?x = ?x; 0 < ?n\<rbrakk> \<Longrightarrow> (?f ^^ least_power ?f ?x) ?x = ?x
\<lbrakk>(?f ^^ ?n) ?x = ?x; 0 < ?n\<rbrakk> \<Longrightarrow> 0 < least_power ?f ?x

goal (1 subgoal):
 1. (p ^^ least_power p a) a = a &&& 0 < least_power p a
[PROOF STEP]
by (metis id_apply)+


[STATEMENT]
lemma lemma_3_5_i_4: "(d4 a b = 1) = (a = b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (d4 a b = (1::'a)) = (a = b)
[PROOF STEP]
apply (simp add: d4_def lemma_3_5_i_2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b = a) = (a = b)
[PROOF STEP]
by auto


[STATEMENT]
lemma fact_binomial:
  assumes "k \<le> n"
  shows "fact k * of_nat (n choose k) = (fact n / fact (n - k) :: 'a::field_char_0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact k * of_nat (n choose k) = fact n / fact (n - k)
[PROOF STEP]
unfolding binomial_fact [OF assms]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact k * (fact n / (fact k * fact (n - k))) = fact n / fact (n - k)
[PROOF STEP]
by (simp add: field_simps)


[STATEMENT]
lemma (in aGroup) asum_multTr_pm:"\<lbrakk>a \<in> carrier A; 0 \<le> m; n < 0\<rbrakk> \<Longrightarrow>
       aSum A (nat m) (aSum A (nat (- n)) (-\<^sub>a a)) =
                                    aSum A (nat (m * (- n))) (-\<^sub>a a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; 0 \<le> m; n < 0\<rbrakk> \<Longrightarrow> aSum A (nat m) (aSum A (nat (- n)) (-\<^sub>a a)) = aSum A (nat (m * - n)) (-\<^sub>a a)
[PROOF STEP]
apply (frule ag_mOp_closed [of  a])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; 0 \<le> m; n < 0; -\<^sub>a a \<in> carrier A\<rbrakk> \<Longrightarrow> aSum A (nat m) (aSum A (nat (- n)) (-\<^sub>a a)) = aSum A (nat (m * - n)) (-\<^sub>a a)
[PROOF STEP]
apply (simp add:asum_multTr_pp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; 0 \<le> m; n < 0; -\<^sub>a a \<in> carrier A\<rbrakk> \<Longrightarrow> aSum A (nat m * nat (- n)) (-\<^sub>a a) = aSum A (nat (- (m * n))) (-\<^sub>a a)
[PROOF STEP]
apply (subgoal_tac "nat m * nat (- n) = nat (- (m * n))", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; 0 \<le> m; n < 0; -\<^sub>a a \<in> carrier A\<rbrakk> \<Longrightarrow> nat m * nat (- n) = nat (- (m * n))
[PROOF STEP]
apply (subgoal_tac "(nat m) * (nat (- n)) = nat (m * (- n))", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; 0 \<le> m; n < 0; -\<^sub>a a \<in> carrier A\<rbrakk> \<Longrightarrow> nat m * nat (- n) = nat (m * - n)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; 0 \<le> m; n < 0; -\<^sub>a a \<in> carrier A\<rbrakk> \<Longrightarrow> nat m * nat (- n) = nat (- (m * n))
[PROOF STEP]
apply (subst zmult_zminus_right[THEN sym, of "m" "n"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; 0 \<le> m; n < 0; -\<^sub>a a \<in> carrier A\<rbrakk> \<Longrightarrow> nat m * nat (- n) = nat (m * - n)
[PROOF STEP]
apply (rule nat_mult_distrib [THEN sym, of "m"], assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma convex_hull_subset_affine_hull: "(convex hull s) \<subseteq> (affine hull s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex hull s \<subseteq> affine hull s
[PROOF STEP]
by (metis affine_affine_hull affine_imp_convex hull_minimal hull_subset)


[STATEMENT]
lemma limit_along_weak_subseq:
  fixes u::"nat \<Rightarrow> nat" and v::"nat \<Rightarrow> _"
  assumes "(\<lambda>n. real(u n)) \<longlonglongrightarrow> \<infinity>" "v \<longlonglongrightarrow> l"
  shows "(\<lambda> n. v(u n)) \<longlonglongrightarrow> l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. v (u n)) \<longlonglongrightarrow> l
[PROOF STEP]
using filterlim_compose[of v, OF _ filterlim_weak_subseq] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>filterlim v ?F3.0 sequentially; (\<lambda>x. ereal (real (?f x))) \<longlonglongrightarrow> \<infinity>\<rbrakk> \<Longrightarrow> LIM x sequentially. v (?f x) :> ?F3.0
(\<lambda>x. ereal (real (u x))) \<longlonglongrightarrow> \<infinity>
v \<longlonglongrightarrow> l

goal (1 subgoal):
 1. (\<lambda>n. v (u n)) \<longlonglongrightarrow> l
[PROOF STEP]
by auto


[STATEMENT]
lemma continuous_on_cot [continuous_intros]:
  fixes f :: "'a \<Rightarrow> 'a::{real_normed_field,banach}"
  shows "continuous_on s f \<Longrightarrow> (\<forall>x\<in>s. sin (f x) \<noteq> 0) \<Longrightarrow> continuous_on s (\<lambda>x. cot (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_on s f; \<forall>x\<in>s. sin (f x) \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> continuous_on s (\<lambda>x. cot (f x))
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>s. (f \<longlongrightarrow> f x) (at x within s); \<forall>x\<in>s. sin (f x) \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> \<forall>x\<in>s. ((\<lambda>x. cot (f x)) \<longlongrightarrow> cot (f x)) (at x within s)
[PROOF STEP]
by (auto intro: tendsto_cot)


[STATEMENT]
lemma UN_subset_iff: "((\<Union>i\<in>I. f i) \<subseteq> B) = (\<forall>i\<in>I. f i \<subseteq> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union> (f ` I) \<subseteq> B) = (\<forall>i\<in>I. f i \<subseteq> B)
[PROOF STEP]
by blast


[STATEMENT]
lemma fps_tan_fps_exp_ii:
  "fps_tan c = (fps_exp (\<i> * c) - fps_exp (- \<i> * c)) /
      (fps_const \<i> * (fps_exp (\<i> * c) + fps_exp (- \<i> * c)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_tan c = (fps_exp (\<i> * c) - fps_exp (- \<i> * c)) / (fps_const \<i> * (fps_exp (\<i> * c) + fps_exp (- \<i> * c)))
[PROOF STEP]
unfolding fps_tan_def fps_sin_fps_exp_ii fps_cos_fps_exp_ii
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fps_exp (\<i> * c) - fps_exp (- \<i> * c)) / fps_const (2 * \<i>) / ((fps_exp (\<i> * c) + fps_exp (- \<i> * c)) / fps_const 2) = (fps_exp (\<i> * c) - fps_exp (- \<i> * c)) / (fps_const \<i> * (fps_exp (\<i> * c) + fps_exp (- \<i> * c)))
[PROOF STEP]
by (simp add: fps_divide_unit fps_inverse_mult fps_const_inverse)


[STATEMENT]
lemma inorder_node32: "height r > 0 \<Longrightarrow>
  inorder (tree\<^sub>d (node32 l a m' b r)) = inorder l @ a # inorder (tree\<^sub>d m') @ b # inorder r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < height r \<Longrightarrow> inorder (tree\<^sub>d (node32 l a m' b r)) = inorder l @ a # inorder (tree\<^sub>d m') @ b # inorder r
[PROOF STEP]
by(induct l a m' b r rule: node32.induct) auto


[STATEMENT]
lemma set_less_eq_antisym: "\<lbrakk> A \<sqsubseteq> B; B \<sqsubseteq> A \<rbrakk> \<Longrightarrow> A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<sqsubseteq> B; B \<sqsubseteq> A\<rbrakk> \<Longrightarrow> A = B
[PROOF STEP]
by(auto simp add: set_less_eq_def2 set_less_eq_aux''_finite not_in_complement_partition not_in_complement_partition_False del: equalityI split: if_split_asm dest: set_less_eq_aux_antisym set_less_eq_aux''_antisym)


[STATEMENT]
lemma vangle_eq_piD:
  assumes "vangle u v = pi"
  shows   "norm u *\<^sub>R v + norm v *\<^sub>R u = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm u *\<^sub>R v + norm v *\<^sub>R u = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm u *\<^sub>R v + norm v *\<^sub>R u = (0::'a)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
vangle u v = pi
[PROOF STEP]
have "(-u) \<bullet> v = norm (-u) * norm v"
[PROOF STATE]
proof (prove)
using this:
vangle u v = pi

goal (1 subgoal):
 1. - u \<bullet> v = norm (- u) * norm v
[PROOF STEP]
using arccos_eq_iff[of "(u \<bullet> v) / (norm u * norm v)" "-1"] Cauchy_Schwarz_ineq2[of u v]
[PROOF STATE]
proof (prove)
using this:
vangle u v = pi
\<bar>u \<bullet> v / (norm u * norm v)\<bar> \<le> 1 \<and> \<bar>- 1\<bar> \<le> 1 \<Longrightarrow> (arccos (u \<bullet> v / (norm u * norm v)) = arccos (- 1)) = (u \<bullet> v / (norm u * norm v) = - 1)
\<bar>u \<bullet> v\<bar> \<le> norm u * norm v

goal (1 subgoal):
 1. - u \<bullet> v = norm (- u) * norm v
[PROOF STEP]
by (simp add: field_simps vangle_def split: if_split_asm)
[PROOF STATE]
proof (state)
this:
- u \<bullet> v = norm (- u) * norm v

goal (1 subgoal):
 1. norm u *\<^sub>R v + norm v *\<^sub>R u = (0::'a)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
- u \<bullet> v = norm (- u) * norm v

goal (1 subgoal):
 1. norm u *\<^sub>R v + norm v *\<^sub>R u = (0::'a)
[PROOF STEP]
by (subst (asm) norm_cauchy_schwarz_eq) simp_all
[PROOF STATE]
proof (state)
this:
norm u *\<^sub>R v + norm v *\<^sub>R u = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma r01_binary_expansion_lr_r_ur:
  assumes "0 < r" "r < 1"
  shows "(snd (snd (r01_binary_expansion'' r n))) \<le> r \<and>
         r < (fst (snd (r01_binary_expansion'' r n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (snd (r01_binary_expansion'' r n)) \<le> r \<and> r < fst (snd (r01_binary_expansion'' r n))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < r
r < 1

goal (1 subgoal):
 1. snd (snd (r01_binary_expansion'' r n)) \<le> r \<and> r < fst (snd (r01_binary_expansion'' r n))
[PROOF STEP]
by (induction n) (simp_all add:split_beta' Let_def)


[STATEMENT]
lemma of_rat_diff: "of_rat (a - b) = of_rat a - of_rat b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_rat (a - b) = of_rat a - of_rat b
[PROOF STEP]
using of_rat_add [of a "- b"]
[PROOF STATE]
proof (prove)
using this:
of_rat (a + - b) = of_rat a + of_rat (- b)

goal (1 subgoal):
 1. of_rat (a - b) = of_rat a - of_rat b
[PROOF STEP]
by (simp add: of_rat_minus)


[STATEMENT]
lemma Fishb_strict_iff:
  "A \<succ>[Fishb(R)] B \<longleftrightarrow>
     ((\<forall>a\<in>A. \<forall>b\<in>B - A. R b a) \<and> (\<forall>a\<in>A - B. \<forall>b\<in>B. R b a)) \<and>
     \<not> ((\<forall>a\<in>B. \<forall>b\<in>A - B. R b a) \<and> (\<forall>a\<in>B - A. \<forall>b\<in>A. R b a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<prec>[Fishb R] A = (((\<forall>a\<in>A. \<forall>b\<in>B - A. R b a) \<and> (\<forall>a\<in>A - B. \<forall>b\<in>B. R b a)) \<and> \<not> ((\<forall>a\<in>B. \<forall>b\<in>A - B. R b a) \<and> (\<forall>a\<in>B - A. \<forall>b\<in>A. R b a)))
[PROOF STEP]
unfolding strongly_preferred_def Fishb_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (((\<forall>a\<in>A. \<forall>b\<in>B - A. R b a) \<and> (\<forall>a\<in>A - B. \<forall>b\<in>B. R b a)) \<and> \<not> ((\<forall>a\<in>B. \<forall>b\<in>A - B. R b a) \<and> (\<forall>a\<in>B - A. \<forall>b\<in>A. R b a))) = (((\<forall>a\<in>A. \<forall>b\<in>B - A. R b a) \<and> (\<forall>a\<in>A - B. \<forall>b\<in>B. R b a)) \<and> \<not> ((\<forall>a\<in>B. \<forall>b\<in>A - B. R b a) \<and> (\<forall>a\<in>B - A. \<forall>b\<in>A. R b a)))
[PROOF STEP]
..


[STATEMENT]
lemma uncountable_closed_segment:
  fixes a :: "'a::real_normed_vector"
  assumes "a \<noteq> b" shows "uncountable (closed_segment a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uncountable (closed_segment a b)
[PROOF STEP]
unfolding path_image_linepath [symmetric] path_image_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uncountable (linepath a b ` {0..1})
[PROOF STEP]
using inj_on_linepath [OF assms] uncountable_closed_interval [of 0 1]
        countable_image_inj_on
[PROOF STATE]
proof (prove)
using this:
inj_on (linepath a b) {0..1}
uncountable {0..1} = (0 < 1)
\<lbrakk>countable (?f ` ?A); inj_on ?f ?A\<rbrakk> \<Longrightarrow> countable ?A

goal (1 subgoal):
 1. uncountable (linepath a b ` {0..1})
[PROOF STEP]
by auto


[STATEMENT]
lemma Frct_equals: "Frct (a, numeral b) = Frct (c, numeral d) \<longleftrightarrow> a * numeral d = c * numeral b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Frct (a, numeral b) = Frct (c, numeral d)) = (a * numeral d = c * numeral b)
[PROOF STEP]
apply (intro iffI antisym)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. Frct (a, numeral b) = Frct (c, numeral d) \<Longrightarrow> a * numeral d \<le> c * numeral b
 2. Frct (a, numeral b) = Frct (c, numeral d) \<Longrightarrow> c * numeral b \<le> a * numeral d
 3. a * numeral d = c * numeral b \<Longrightarrow> Frct (a, numeral b) \<le> Frct (c, numeral d)
 4. a * numeral d = c * numeral b \<Longrightarrow> Frct (c, numeral d) \<le> Frct (a, numeral b)
[PROOF STEP]
apply (subst Frct_le[symmetric], simp)+
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a * numeral d = c * numeral b \<Longrightarrow> Frct (a, numeral b) \<le> Frct (c, numeral d)
 2. a * numeral d = c * numeral b \<Longrightarrow> Frct (c, numeral d) \<le> Frct (a, numeral b)
[PROOF STEP]
apply (subst Frct_le, simp)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma leq_pos_imp_abs_leq: "\<lbrakk> 0 \<le> (a::'a::ordered_ab_group_add_abs); a \<le> b \<rbrakk> \<Longrightarrow> \<bar>a\<bar> \<le> \<bar>b\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(0::'a) \<le> a; a \<le> b\<rbrakk> \<Longrightarrow> \<bar>a\<bar> \<le> \<bar>b\<bar>
[PROOF STEP]
by simp


[STATEMENT]
lemma some_gcd_ff_list_greatest: "(\<forall>x \<in> set xs. divides_ff d x) \<Longrightarrow> divides_ff d (some_gcd_ff_list xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set xs. divides_ff d x \<Longrightarrow> divides_ff d (some_gcd_ff_list xs)
[PROOF STEP]
using some_gcd_ff_list[of xs]
[PROOF STATE]
proof (prove)
using this:
gcd_ff_list xs (some_gcd_ff_list xs)

goal (1 subgoal):
 1. \<forall>x\<in>set xs. divides_ff d x \<Longrightarrow> divides_ff d (some_gcd_ff_list xs)
[PROOF STEP]
unfolding gcd_ff_list_def
[PROOF STATE]
proof (prove)
using this:
Ball (set xs) (divides_ff (some_gcd_ff_list xs)) \<and> (\<forall>d. Ball (set xs) (divides_ff d) \<longrightarrow> divides_ff d (some_gcd_ff_list xs))

goal (1 subgoal):
 1. \<forall>x\<in>set xs. divides_ff d x \<Longrightarrow> divides_ff d (some_gcd_ff_list xs)
[PROOF STEP]
by auto


[STATEMENT]
lemma eval_list_conj_Uni_append : "evalUni (list_conj_Uni (A @ B)) x = (evalUni (list_conj_Uni (A)) x \<and> evalUni (list_conj_Uni (B)) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. evalUni (list_conj_Uni (A @ B)) x = (evalUni (list_conj_Uni A) x \<and> evalUni (list_conj_Uni B) x)
[PROOF STEP]
apply(induction A)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. evalUni (list_conj_Uni ([] @ B)) x = (evalUni (list_conj_Uni []) x \<and> evalUni (list_conj_Uni B) x)
 2. \<And>a A. evalUni (list_conj_Uni (A @ B)) x = (evalUni (list_conj_Uni A) x \<and> evalUni (list_conj_Uni B) x) \<Longrightarrow> evalUni (list_conj_Uni ((a # A) @ B)) x = (evalUni (list_conj_Uni (a # A)) x \<and> evalUni (list_conj_Uni B) x)
[PROOF STEP]
by auto


[STATEMENT]
lemma sinh_zero_iff: "sinh x = 0 \<longleftrightarrow> exp x \<in> {1, -1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sinh x = (0::'a)) = (exp x \<in> {1::'a, - (1::'a)})
[PROOF STEP]
by (auto simp: sinh_def field_simps exp_minus power2_eq_square square_eq_1_iff)


[STATEMENT]
lemma adj_sur_inv:
  fixes f :: "'a::preorder \<Rightarrow> 'b::order"
  shows "f \<stileturn> g \<Longrightarrow> ((surj f) = (f \<circ> g = id))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<stileturn> g \<Longrightarrow> top_pres ((`) f) = (f \<circ> g = id)
[PROOF STEP]
unfolding adj_def surj_def comp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. (f x \<le> y) = (x \<le> g y) \<Longrightarrow> (\<forall>y. \<exists>x. y = f x) = ((\<lambda>x. f (g x)) = id)
[PROOF STEP]
by (metis eq_id_iff eq_iff order_refl order_trans)


[STATEMENT]
lemma mersenne_mod2_less:
  assumes "n > 2" and "k \<le> 2 ^ (2 * n + 2)"
  shows   "mersenne_mod2 k n < 2 ^ n + 5"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mersenne_mod2 k n < 2 ^ n + 5
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mersenne_mod2 k n < 2 ^ n + 5
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
2 < n
k \<le> 2 ^ (2 * n + 2)
[PROOF STEP]
have "2 ^ 3 \<le> (2 ^ n :: int)"
[PROOF STATE]
proof (prove)
using this:
2 < n
k \<le> 2 ^ (2 * n + 2)

goal (1 subgoal):
 1. 2 ^ 3 \<le> 2 ^ n
[PROOF STEP]
by (intro power_increasing) auto
[PROOF STATE]
proof (state)
this:
2 ^ 3 \<le> 2 ^ n

goal (1 subgoal):
 1. mersenne_mod2 k n < 2 ^ n + 5
[PROOF STEP]
hence "2 ^ n \<ge> (8 :: int)"
[PROOF STATE]
proof (prove)
using this:
2 ^ 3 \<le> 2 ^ n

goal (1 subgoal):
 1. 8 \<le> 2 ^ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
8 \<le> 2 ^ n

goal (1 subgoal):
 1. mersenne_mod2 k n < 2 ^ n + 5
[PROOF STEP]
have "mersenne_mod k n < 2 ^ n + 2 ^ (2 * n + 2 - n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mersenne_mod k n < 2 ^ n + 2 ^ (2 * n + 2 - n)
[PROOF STEP]
by (rule mersenne_mod_less) (use assms in auto)
[PROOF STATE]
proof (state)
this:
mersenne_mod k n < 2 ^ n + 2 ^ (2 * n + 2 - n)

goal (1 subgoal):
 1. mersenne_mod2 k n < 2 ^ n + 5
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
mersenne_mod k n < 2 ^ n + 2 ^ (2 * n + 2 - n)

goal (1 subgoal):
 1. mersenne_mod2 k n < 2 ^ n + 5
[PROOF STEP]
have "\<dots> \<le> 5 * 2 ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ n + 2 ^ (2 * n + 2 - n) \<le> 5 * 2 ^ n
[PROOF STEP]
by (simp add: power_add)
[PROOF STATE]
proof (state)
this:
2 ^ n + 2 ^ (2 * n + 2 - n) \<le> 5 * 2 ^ n

goal (1 subgoal):
 1. mersenne_mod2 k n < 2 ^ n + 5
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mersenne_mod k n < 5 * 2 ^ n
[PROOF STEP]
have "mersenne_mod (mersenne_mod k n) n < 2 ^ n + 5"
[PROOF STATE]
proof (prove)
using this:
mersenne_mod k n < 5 * 2 ^ n

goal (1 subgoal):
 1. mersenne_mod (mersenne_mod k n) n < 2 ^ n + 5
[PROOF STEP]
by (intro mersenne_mod_less') auto
[PROOF STATE]
proof (state)
this:
mersenne_mod (mersenne_mod k n) n < 2 ^ n + 5

goal (1 subgoal):
 1. mersenne_mod2 k n < 2 ^ n + 5
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
mersenne_mod (mersenne_mod k n) n < 2 ^ n + 5

goal (1 subgoal):
 1. mersenne_mod2 k n < 2 ^ n + 5
[PROOF STEP]
by (simp add: mersenne_mod2_def)
[PROOF STATE]
proof (state)
this:
mersenne_mod2 k n < 2 ^ n + 5

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma complex_Im_of_nat [simp]: "Im (of_nat n) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (of_nat n) = 0
[PROOF STEP]
by (induct n) simp_all


[STATEMENT]
theorem DataRefinement_mono:
  "T \<le> S \<Longrightarrow> mono R \<Longrightarrow> DataRefinement S R R' S' \<Longrightarrow> DataRefinement T R R' S' "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>T \<sqsubseteq> S; mono R; DataRefinement S R R' S'\<rbrakk> \<Longrightarrow> DataRefinement T R R' S'
[PROOF STEP]
apply (simp add: DataRefinement_def mono_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>T \<sqsubseteq> S; \<forall>x y. x \<sqsubseteq> y \<longrightarrow> R x \<sqsubseteq> R y; R \<circ> S \<sqsubseteq> S' \<circ> R'\<rbrakk> \<Longrightarrow> R \<circ> T \<sqsubseteq> S' \<circ> R'
[PROOF STEP]
apply (subst le_fun_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>T \<sqsubseteq> S; \<forall>x y. x \<sqsubseteq> y \<longrightarrow> R x \<sqsubseteq> R y; R \<circ> S \<sqsubseteq> S' \<circ> R'\<rbrakk> \<Longrightarrow> \<forall>x. (R \<circ> T) x \<sqsubseteq> (S' \<circ> R') x
[PROOF STEP]
apply (simp add: le_fun_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x. T x \<sqsubseteq> S x; \<forall>x y. x \<sqsubseteq> y \<longrightarrow> R x \<sqsubseteq> R y; \<forall>x. R (S x) \<sqsubseteq> S' (R' x)\<rbrakk> \<Longrightarrow> \<forall>x. R (T x) \<sqsubseteq> S' (R' x)
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>x. T x \<sqsubseteq> S x; \<forall>x y. x \<sqsubseteq> y \<longrightarrow> R x \<sqsubseteq> R y; \<forall>x. R (S x) \<sqsubseteq> S' (R' x)\<rbrakk> \<Longrightarrow> R (T x) \<sqsubseteq> S' (R' x)
[PROOF STEP]
apply (rule_tac y = "R (S x)" in order_trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>\<forall>x. T x \<sqsubseteq> S x; \<forall>x y. x \<sqsubseteq> y \<longrightarrow> R x \<sqsubseteq> R y; \<forall>x. R (S x) \<sqsubseteq> S' (R' x)\<rbrakk> \<Longrightarrow> R (T x) \<sqsubseteq> R (S x)
 2. \<And>x. \<lbrakk>\<forall>x. T x \<sqsubseteq> S x; \<forall>x y. x \<sqsubseteq> y \<longrightarrow> R x \<sqsubseteq> R y; \<forall>x. R (S x) \<sqsubseteq> S' (R' x)\<rbrakk> \<Longrightarrow> R (S x) \<sqsubseteq> S' (R' x)
[PROOF STEP]
by simp_all


[STATEMENT]
lemma ordinal_plus_monoL [rule_format]:
"\<forall>x x'. x \<le> x' \<longrightarrow> x + y \<le> x' + (y::ordinal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x x'. x \<le> x' \<longrightarrow> x + y \<le> x' + y
[PROOF STEP]
apply (rule_tac a=y in oLimit_induct, simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n x x'. x \<le> x' \<longrightarrow> x + f n \<le> x' + f n\<rbrakk> \<Longrightarrow> \<forall>x x'. x \<le> x' \<longrightarrow> oLimit (\<lambda>n. x + f n) \<le> oLimit (\<lambda>n. x' + f n)
[PROOF STEP]
apply clarify
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f x x'. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n x x'. x \<le> x' \<longrightarrow> x + f n \<le> x' + f n; x \<le> x'\<rbrakk> \<Longrightarrow> oLimit (\<lambda>n. x + f n) \<le> oLimit (\<lambda>n. x' + f n)
[PROOF STEP]
apply (rule oLimit_leI, clarify)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f x x' n. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n x x'. x \<le> x' \<longrightarrow> x + f n \<le> x' + f n; x \<le> x'\<rbrakk> \<Longrightarrow> x + f n \<le> oLimit (\<lambda>n. x' + f n)
[PROOF STEP]
apply (rule_tac n=n in le_oLimitI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f x x' n. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n x x'. x \<le> x' \<longrightarrow> x + f n \<le> x' + f n; x \<le> x'\<rbrakk> \<Longrightarrow> x + f n \<le> x' + f n
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem s1_1_th1: "\<forall> n x y. ((nat_to_pr n) (c_pair x y)) = (nat_to_pr (s1_1 n x)) y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n x y. nat_to_pr n (c_pair x y) = nat_to_pr (s1_1 n x) y
[PROOF STEP]
proof (rule allI, rule allI, rule allI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n x y. nat_to_pr n (c_pair x y) = nat_to_pr (s1_1 n x) y
[PROOF STEP]
fix n x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n x y. nat_to_pr n (c_pair x y) = nat_to_pr (s1_1 n x) y
[PROOF STEP]
show "nat_to_pr n (c_pair x y) = nat_to_pr (s1_1 n x) y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_pr n (c_pair x y) = nat_to_pr (s1_1 n x) y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nat_to_pr n (c_pair x y) = nat_to_pr (s1_1 n x) y
[PROOF STEP]
have "(\<lambda> y. (nat_to_pr n) (c_pair x y)) = nat_to_pr (s1_1 n x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>y. nat_to_pr n (c_pair x y)) = nat_to_pr (s1_1 n x)
[PROOF STEP]
by (rule s1_1_th)
[PROOF STATE]
proof (state)
this:
(\<lambda>y. nat_to_pr n (c_pair x y)) = nat_to_pr (s1_1 n x)

goal (1 subgoal):
 1. nat_to_pr n (c_pair x y) = nat_to_pr (s1_1 n x) y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>y. nat_to_pr n (c_pair x y)) = nat_to_pr (s1_1 n x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>y. nat_to_pr n (c_pair x y)) = nat_to_pr (s1_1 n x)

goal (1 subgoal):
 1. nat_to_pr n (c_pair x y) = nat_to_pr (s1_1 n x) y
[PROOF STEP]
by (simp add: fun_eq_iff)
[PROOF STATE]
proof (state)
this:
nat_to_pr n (c_pair x y) = nat_to_pr (s1_1 n x) y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
nat_to_pr n (c_pair x y) = nat_to_pr (s1_1 n x) y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mlex_bound:
  fixes a b :: nat
  assumes "a<A"
  assumes "b<N"
  shows "a*N + b < A*N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * N + b < A * N
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a < A
b < N

goal (1 subgoal):
 1. a * N + b < A * N
[PROOF STEP]
using mlex_fst_decrI
[PROOF STATE]
proof (prove)
using this:
a < A
b < N
\<lbrakk>?a < ?a'; ?b < ?N; ?b' < ?N\<rbrakk> \<Longrightarrow> ?a * ?N + ?b < ?a' * ?N + ?b'

goal (1 subgoal):
 1. a * N + b < A * N
[PROOF STEP]
by fastforce


[STATEMENT]
lemma compactE: (*related to COMPACT_IMP_HEINE_BOREL in HOL Light*)
  assumes "compact S" "S \<subseteq> \<Union>\<T>" "\<And>B. B \<in> \<T> \<Longrightarrow> open B"
  obtains \<T>' where "\<T>' \<subseteq> \<T>" "finite \<T>'" "S \<subseteq> \<Union>\<T>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<T>'. \<lbrakk>\<T>' \<subseteq> \<T>; finite \<T>'; S \<subseteq> \<Union> \<T>'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson assms compact_eq_Heine_Borel)


[STATEMENT]
lemma choose_odd_sum:
  assumes "n > 0"
  shows "2 * (\<Sum>i\<le>n. if odd i then of_nat (n choose i) else 0) = (2 ^ n :: 'a::comm_ring_1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2::'a) * (\<Sum>i\<le>n. if odd i then of_nat (n choose i) else (0::'a)) = (2::'a) ^ n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (2::'a) * (\<Sum>i\<le>n. if odd i then of_nat (n choose i) else (0::'a)) = (2::'a) ^ n
[PROOF STEP]
have "2 ^ n = (\<Sum>i\<le>n. of_nat (n choose i)) - (\<Sum>i\<le>n. (-1) ^ i * of_nat (n choose i) :: 'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2::'a) ^ n = (\<Sum>i\<le>n. of_nat (n choose i)) - (\<Sum>i\<le>n. (- (1::'a)) ^ i * of_nat (n choose i))
[PROOF STEP]
using choose_row_sum[of n]
[PROOF STATE]
proof (prove)
using this:
sum ((choose) n) {..n} = 2 ^ n

goal (1 subgoal):
 1. (2::'a) ^ n = (\<Sum>i\<le>n. of_nat (n choose i)) - (\<Sum>i\<le>n. (- (1::'a)) ^ i * of_nat (n choose i))
[PROOF STEP]
by (simp add: choose_alternating_sum assms atLeast0AtMost of_nat_sum[symmetric])
[PROOF STATE]
proof (state)
this:
(2::'a) ^ n = (\<Sum>i\<le>n. of_nat (n choose i)) - (\<Sum>i\<le>n. (- (1::'a)) ^ i * of_nat (n choose i))

goal (1 subgoal):
 1. (2::'a) * (\<Sum>i\<le>n. if odd i then of_nat (n choose i) else (0::'a)) = (2::'a) ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(2::'a) ^ n = (\<Sum>i\<le>n. of_nat (n choose i)) - (\<Sum>i\<le>n. (- (1::'a)) ^ i * of_nat (n choose i))

goal (1 subgoal):
 1. (2::'a) * (\<Sum>i\<le>n. if odd i then of_nat (n choose i) else (0::'a)) = (2::'a) ^ n
[PROOF STEP]
have "\<dots> = (\<Sum>i\<le>n. of_nat (n choose i) - (-1) ^ i * of_nat (n choose i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. of_nat (n choose i)) - (\<Sum>i\<le>n. (- (1::'a)) ^ i * of_nat (n choose i)) = (\<Sum>i\<le>n. of_nat (n choose i) - (- (1::'a)) ^ i * of_nat (n choose i))
[PROOF STEP]
by (simp add: sum_subtractf)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. of_nat (n choose i)) - (\<Sum>i\<le>n. (- (1::'a)) ^ i * of_nat (n choose i)) = (\<Sum>i\<le>n. of_nat (n choose i) - (- (1::'a)) ^ i * of_nat (n choose i))

goal (1 subgoal):
 1. (2::'a) * (\<Sum>i\<le>n. if odd i then of_nat (n choose i) else (0::'a)) = (2::'a) ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. of_nat (n choose i)) - (\<Sum>i\<le>n. (- (1::'a)) ^ i * of_nat (n choose i)) = (\<Sum>i\<le>n. of_nat (n choose i) - (- (1::'a)) ^ i * of_nat (n choose i))

goal (1 subgoal):
 1. (2::'a) * (\<Sum>i\<le>n. if odd i then of_nat (n choose i) else (0::'a)) = (2::'a) ^ n
[PROOF STEP]
have "\<dots> = 2 * (\<Sum>i\<le>n. if odd i then of_nat (n choose i) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. of_nat (n choose i) - (- (1::'a)) ^ i * of_nat (n choose i)) = (2::'a) * (\<Sum>i\<le>n. if odd i then of_nat (n choose i) else (0::'a))
[PROOF STEP]
by (subst sum_distrib_left, intro sum.cong) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. of_nat (n choose i) - (- (1::'a)) ^ i * of_nat (n choose i)) = (2::'a) * (\<Sum>i\<le>n. if odd i then of_nat (n choose i) else (0::'a))

goal (1 subgoal):
 1. (2::'a) * (\<Sum>i\<le>n. if odd i then of_nat (n choose i) else (0::'a)) = (2::'a) ^ n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(2::'a) ^ n = (2::'a) * (\<Sum>i\<le>n. if odd i then of_nat (n choose i) else (0::'a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(2::'a) ^ n = (2::'a) * (\<Sum>i\<le>n. if odd i then of_nat (n choose i) else (0::'a))

goal (1 subgoal):
 1. (2::'a) * (\<Sum>i\<le>n. if odd i then of_nat (n choose i) else (0::'a)) = (2::'a) ^ n
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(2::'a) * (\<Sum>i\<le>n. if odd i then of_nat (n choose i) else (0::'a)) = (2::'a) ^ n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma norm2_norm1_main_equality: fixes f :: "nat \<Rightarrow> 'a :: linordered_idom"
  shows "(\<Sum>i = 0..<n. \<bar>f i\<bar>)\<^sup>2 = (\<Sum>i = 0..<n. f i * f i)
      + (\<Sum>i = 0..<n. \<Sum>j = 0..<n. if i = j then 0 else \<bar>f i\<bar> * \<bar>f j\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. \<bar>f i\<bar>)\<^sup>2 = (\<Sum>i = 0..<n. f i * f i) + (\<Sum>i = 0..<n. \<Sum>j = 0..<n. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>)
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Sum>i = 0..<0. \<bar>f i\<bar>)\<^sup>2 = (\<Sum>i = 0..<0. f i * f i) + (\<Sum>i = 0..<0. \<Sum>j = 0..<0. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>)
 2. \<And>n. (\<Sum>i = 0..<n. \<bar>f i\<bar>)\<^sup>2 = (\<Sum>i = 0..<n. f i * f i) + (\<Sum>i = 0..<n. \<Sum>j = 0..<n. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>) \<Longrightarrow> (\<Sum>i = 0..<Suc n. \<bar>f i\<bar>)\<^sup>2 = (\<Sum>i = 0..<Suc n. f i * f i) + (\<Sum>i = 0..<Suc n. \<Sum>j = 0..<Suc n. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. \<bar>f i\<bar>)\<^sup>2 = (\<Sum>i = 0..<n. f i * f i) + (\<Sum>i = 0..<n. \<Sum>j = 0..<n. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>)

goal (2 subgoals):
 1. (\<Sum>i = 0..<0. \<bar>f i\<bar>)\<^sup>2 = (\<Sum>i = 0..<0. f i * f i) + (\<Sum>i = 0..<0. \<Sum>j = 0..<0. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>)
 2. \<And>n. (\<Sum>i = 0..<n. \<bar>f i\<bar>)\<^sup>2 = (\<Sum>i = 0..<n. f i * f i) + (\<Sum>i = 0..<n. \<Sum>j = 0..<n. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>) \<Longrightarrow> (\<Sum>i = 0..<Suc n. \<bar>f i\<bar>)\<^sup>2 = (\<Sum>i = 0..<Suc n. f i * f i) + (\<Sum>i = 0..<Suc n. \<Sum>j = 0..<Suc n. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>)
[PROOF STEP]
have id: "{0 ..< Suc n} = insert n {0 ..< n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<Suc n} = insert n {0..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..<Suc n} = insert n {0..<n}

goal (2 subgoals):
 1. (\<Sum>i = 0..<0. \<bar>f i\<bar>)\<^sup>2 = (\<Sum>i = 0..<0. f i * f i) + (\<Sum>i = 0..<0. \<Sum>j = 0..<0. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>)
 2. \<And>n. (\<Sum>i = 0..<n. \<bar>f i\<bar>)\<^sup>2 = (\<Sum>i = 0..<n. f i * f i) + (\<Sum>i = 0..<n. \<Sum>j = 0..<n. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>) \<Longrightarrow> (\<Sum>i = 0..<Suc n. \<bar>f i\<bar>)\<^sup>2 = (\<Sum>i = 0..<Suc n. f i * f i) + (\<Sum>i = 0..<Suc n. \<Sum>j = 0..<Suc n. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>)
[PROOF STEP]
have id: "sum f {0 ..< Suc n} = f n + sum f {0 ..< n}" for f :: "nat \<Rightarrow> 'a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {0..<Suc n} = f n + sum f {0..<n}
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f (insert n {0..<n}) = f n + sum f {0..<n}
[PROOF STEP]
by (rule sum.insert, auto)
[PROOF STATE]
proof (state)
this:
sum ?f {0..<Suc n} = ?f n + sum ?f {0..<n}

goal (2 subgoals):
 1. (\<Sum>i = 0..<0. \<bar>f i\<bar>)\<^sup>2 = (\<Sum>i = 0..<0. f i * f i) + (\<Sum>i = 0..<0. \<Sum>j = 0..<0. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>)
 2. \<And>n. (\<Sum>i = 0..<n. \<bar>f i\<bar>)\<^sup>2 = (\<Sum>i = 0..<n. f i * f i) + (\<Sum>i = 0..<n. \<Sum>j = 0..<n. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>) \<Longrightarrow> (\<Sum>i = 0..<Suc n. \<bar>f i\<bar>)\<^sup>2 = (\<Sum>i = 0..<Suc n. f i * f i) + (\<Sum>i = 0..<Suc n. \<Sum>j = 0..<Suc n. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<Suc n. \<bar>f i\<bar>)\<^sup>2 = (\<Sum>i = 0..<Suc n. f i * f i) + (\<Sum>i = 0..<Suc n. \<Sum>j = 0..<Suc n. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>)
[PROOF STEP]
unfolding id power2_sum
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>f n\<bar>\<^sup>2 + (\<Sum>i = 0..<n. \<bar>f i\<bar>)\<^sup>2 + (2::'a) * \<bar>f n\<bar> * (\<Sum>i = 0..<n. \<bar>f i\<bar>) = f n * f n + (\<Sum>i = 0..<n. f i * f i) + ((if n = n then 0::'a else \<bar>f n\<bar> * \<bar>f n\<bar>) + (\<Sum>j = 0..<n. if n = j then 0::'a else \<bar>f n\<bar> * \<bar>f j\<bar>) + (\<Sum>i = 0..<n. (if i = n then 0::'a else \<bar>f i\<bar> * \<bar>f n\<bar>) + (\<Sum>j = 0..<n. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>)))
[PROOF STEP]
unfolding Suc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>f n\<bar>\<^sup>2 + ((\<Sum>i = 0..<n. f i * f i) + (\<Sum>i = 0..<n. \<Sum>j = 0..<n. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>)) + (2::'a) * \<bar>f n\<bar> * (\<Sum>i = 0..<n. \<bar>f i\<bar>) = f n * f n + (\<Sum>i = 0..<n. f i * f i) + ((if n = n then 0::'a else \<bar>f n\<bar> * \<bar>f n\<bar>) + (\<Sum>j = 0..<n. if n = j then 0::'a else \<bar>f n\<bar> * \<bar>f j\<bar>) + (\<Sum>i = 0..<n. (if i = n then 0::'a else \<bar>f i\<bar> * \<bar>f n\<bar>) + (\<Sum>j = 0..<n. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>)))
[PROOF STEP]
by (auto simp: power2_eq_square sum_distrib_left sum.distrib ac_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<Suc n. \<bar>f i\<bar>)\<^sup>2 = (\<Sum>i = 0..<Suc n. f i * f i) + (\<Sum>i = 0..<Suc n. \<Sum>j = 0..<Suc n. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>)

goal (1 subgoal):
 1. (\<Sum>i = 0..<0. \<bar>f i\<bar>)\<^sup>2 = (\<Sum>i = 0..<0. f i * f i) + (\<Sum>i = 0..<0. \<Sum>j = 0..<0. if i = j then 0::'a else \<bar>f i\<bar> * \<bar>f j\<bar>)
[PROOF STEP]
qed auto


[STATEMENT]
lemma span_card_ge_dim:
  "B \<subseteq> V \<Longrightarrow> V \<subseteq> span B \<Longrightarrow> finite B \<Longrightarrow> dim V \<le> card B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>B \<subseteq> V; V \<subseteq> span B; finite B\<rbrakk> \<Longrightarrow> dim V \<le> card B
[PROOF STEP]
by (simp add: dim_le_card)


[STATEMENT]
lemma fps_of_poly_divide_numeral:
  "fps_of_poly (smult (inverse (numeral c :: 'a :: field)) p) = fps_of_poly p / numeral c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_of_poly (smult (inverse (numeral c)) p) = fps_of_poly p / numeral c
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_of_poly (smult (inverse (numeral c)) p) = fps_of_poly p / numeral c
[PROOF STEP]
have "smult (inverse (numeral c)) p = [:inverse (numeral c):] * p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult (inverse (numeral c)) p = [:inverse (numeral c):] * p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
smult (inverse (numeral c)) p = [:inverse (numeral c):] * p

goal (1 subgoal):
 1. fps_of_poly (smult (inverse (numeral c)) p) = fps_of_poly p / numeral c
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
smult (inverse (numeral c)) p = [:inverse (numeral c):] * p

goal (1 subgoal):
 1. fps_of_poly (smult (inverse (numeral c)) p) = fps_of_poly p / numeral c
[PROOF STEP]
have "fps_of_poly \<dots> = fps_of_poly p / numeral c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_of_poly ([:inverse (numeral c):] * p) = fps_of_poly p / numeral c
[PROOF STEP]
by (subst fps_of_poly_mult) (simp add: numeral_fps_const fps_of_poly_pCons)
[PROOF STATE]
proof (state)
this:
fps_of_poly ([:inverse (numeral c):] * p) = fps_of_poly p / numeral c

goal (1 subgoal):
 1. fps_of_poly (smult (inverse (numeral c)) p) = fps_of_poly p / numeral c
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fps_of_poly (smult (inverse (numeral c)) p) = fps_of_poly p / numeral c
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fps_of_poly (smult (inverse (numeral c)) p) = fps_of_poly p / numeral c

goal (1 subgoal):
 1. fps_of_poly (smult (inverse (numeral c)) p) = fps_of_poly p / numeral c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_of_poly (smult (inverse (numeral c)) p) = fps_of_poly p / numeral c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem assumes f: "f \<in> rv M" and g: "g \<in> rv M"
  shows rv_times_rv: "(\<lambda>w. f w * g w) \<in> rv M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>w. f w * g w) \<in> rv M
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>w. f w * g w) \<in> rv M
[PROOF STEP]
have "(\<lambda>w. f w * g w) = (\<lambda>w. (f w + g w)\<^sup>2/4 - (f w - g w)\<^sup>2/4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>w. f w * g w) = (\<lambda>w. (f w + g w)\<^sup>2 / 4 - (f w - g w)\<^sup>2 / 4)
[PROOF STEP]
by (simp only: times_iff_sum_squares)
[PROOF STATE]
proof (state)
this:
(\<lambda>w. f w * g w) = (\<lambda>w. (f w + g w)\<^sup>2 / 4 - (f w - g w)\<^sup>2 / 4)

goal (1 subgoal):
 1. (\<lambda>w. f w * g w) \<in> rv M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>w. f w * g w) = (\<lambda>w. (f w + g w)\<^sup>2 / 4 - (f w - g w)\<^sup>2 / 4)

goal (1 subgoal):
 1. (\<lambda>w. f w * g w) \<in> rv M
[PROOF STEP]
have "\<dots> = (\<lambda>w. (f w + g w)\<^sup>2*inverse 4 - (f w + - g w)\<^sup>2*inverse 4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>w. (f w + g w)\<^sup>2 / 4 - (f w - g w)\<^sup>2 / 4) = (\<lambda>w. (f w + g w)\<^sup>2 * inverse 4 - (f w + - g w)\<^sup>2 * inverse 4)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>w. (f w + g w)\<^sup>2 / 4 - (f w - g w)\<^sup>2 / 4) = (\<lambda>w. (f w + g w)\<^sup>2 * inverse 4 - (f w + - g w)\<^sup>2 * inverse 4)

goal (1 subgoal):
 1. (\<lambda>w. f w * g w) \<in> rv M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>w. (f w + g w)\<^sup>2 / 4 - (f w - g w)\<^sup>2 / 4) = (\<lambda>w. (f w + g w)\<^sup>2 * inverse 4 - (f w + - g w)\<^sup>2 * inverse 4)

goal (1 subgoal):
 1. (\<lambda>w. f w * g w) \<in> rv M
[PROOF STEP]
from f g
[PROOF STATE]
proof (chain)
picking this:
f \<in> rv M
g \<in> rv M
[PROOF STEP]
have "\<dots> \<in> rv M"
[PROOF STATE]
proof (prove)
using this:
f \<in> rv M
g \<in> rv M

goal (1 subgoal):
 1. (\<lambda>w. (f w + g w)\<^sup>2 * inverse 4 - (f w + - g w)\<^sup>2 * inverse 4) \<in> rv M
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>f \<in> rv M; g \<in> rv M\<rbrakk> \<Longrightarrow> (\<lambda>w. (f w + g w)\<^sup>2 * inverse 4 - (f w + - g w)\<^sup>2 * inverse 4) \<in> rv M
[PROOF STEP]
from f g
[PROOF STATE]
proof (chain)
picking this:
f \<in> rv M
g \<in> rv M
[PROOF STEP]
have "(\<lambda>w. (f w + g w)\<^sup>2)  \<in> rv M"
[PROOF STATE]
proof (prove)
using this:
f \<in> rv M
g \<in> rv M

goal (1 subgoal):
 1. (\<lambda>w. (f w + g w)\<^sup>2) \<in> rv M
[PROOF STEP]
by (simp add: rv_plus_rv rv_square)
[PROOF STATE]
proof (state)
this:
(\<lambda>w. (f w + g w)\<^sup>2) \<in> rv M

goal (1 subgoal):
 1. \<lbrakk>f \<in> rv M; g \<in> rv M\<rbrakk> \<Longrightarrow> (\<lambda>w. (f w + g w)\<^sup>2 * inverse 4 - (f w + - g w)\<^sup>2 * inverse 4) \<in> rv M
[PROOF STEP]
hence "(\<lambda>w. 0+(f w + g w)\<^sup>2*inverse 4) \<in> rv M"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>w. (f w + g w)\<^sup>2) \<in> rv M

goal (1 subgoal):
 1. (\<lambda>w. 0 + (f w + g w)\<^sup>2 * inverse 4) \<in> rv M
[PROOF STEP]
by (rule affine_rv)
[PROOF STATE]
proof (state)
this:
(\<lambda>w. 0 + (f w + g w)\<^sup>2 * inverse 4) \<in> rv M

goal (1 subgoal):
 1. \<lbrakk>f \<in> rv M; g \<in> rv M\<rbrakk> \<Longrightarrow> (\<lambda>w. (f w + g w)\<^sup>2 * inverse 4 - (f w + - g w)\<^sup>2 * inverse 4) \<in> rv M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>w. 0 + (f w + g w)\<^sup>2 * inverse 4) \<in> rv M

goal (1 subgoal):
 1. \<lbrakk>f \<in> rv M; g \<in> rv M\<rbrakk> \<Longrightarrow> (\<lambda>w. (f w + g w)\<^sup>2 * inverse 4 - (f w + - g w)\<^sup>2 * inverse 4) \<in> rv M
[PROOF STEP]
from g
[PROOF STATE]
proof (chain)
picking this:
g \<in> rv M
[PROOF STEP]
have "(\<lambda>w. 0 + (g w)*-1 ) \<in> rv M"
[PROOF STATE]
proof (prove)
using this:
g \<in> rv M

goal (1 subgoal):
 1. (\<lambda>w. 0 + g w * - 1) \<in> rv M
[PROOF STEP]
by (rule affine_rv)
[PROOF STATE]
proof (state)
this:
(\<lambda>w. 0 + g w * - 1) \<in> rv M

goal (1 subgoal):
 1. \<lbrakk>f \<in> rv M; g \<in> rv M\<rbrakk> \<Longrightarrow> (\<lambda>w. (f w + g w)\<^sup>2 * inverse 4 - (f w + - g w)\<^sup>2 * inverse 4) \<in> rv M
[PROOF STEP]
with f
[PROOF STATE]
proof (chain)
picking this:
f \<in> rv M
(\<lambda>w. 0 + g w * - 1) \<in> rv M
[PROOF STEP]
have "(\<lambda>w. (f w - g w)\<^sup>2)  \<in> rv M"
[PROOF STATE]
proof (prove)
using this:
f \<in> rv M
(\<lambda>w. 0 + g w * - 1) \<in> rv M

goal (1 subgoal):
 1. (\<lambda>w. (f w - g w)\<^sup>2) \<in> rv M
[PROOF STEP]
by (simp add: rv_plus_rv rv_square diff_conv_add_uminus del: add_uminus_conv_diff)
[PROOF STATE]
proof (state)
this:
(\<lambda>w. (f w - g w)\<^sup>2) \<in> rv M

goal (1 subgoal):
 1. \<lbrakk>f \<in> rv M; g \<in> rv M\<rbrakk> \<Longrightarrow> (\<lambda>w. (f w + g w)\<^sup>2 * inverse 4 - (f w + - g w)\<^sup>2 * inverse 4) \<in> rv M
[PROOF STEP]
hence "(\<lambda>w. 0+(f w - g w)\<^sup>2*-inverse 4) \<in> rv M"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>w. (f w - g w)\<^sup>2) \<in> rv M

goal (1 subgoal):
 1. (\<lambda>w. 0 + (f w - g w)\<^sup>2 * - inverse 4) \<in> rv M
[PROOF STEP]
by (rule affine_rv)
[PROOF STATE]
proof (state)
this:
(\<lambda>w. 0 + (f w - g w)\<^sup>2 * - inverse 4) \<in> rv M

goal (1 subgoal):
 1. \<lbrakk>f \<in> rv M; g \<in> rv M\<rbrakk> \<Longrightarrow> (\<lambda>w. (f w + g w)\<^sup>2 * inverse 4 - (f w + - g w)\<^sup>2 * inverse 4) \<in> rv M
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>w. 0 + (f w + g w)\<^sup>2 * inverse 4) \<in> rv M
(\<lambda>w. 0 + (f w - g w)\<^sup>2 * - inverse 4) \<in> rv M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>w. 0 + (f w + g w)\<^sup>2 * inverse 4) \<in> rv M
(\<lambda>w. 0 + (f w - g w)\<^sup>2 * - inverse 4) \<in> rv M

goal (1 subgoal):
 1. (\<lambda>w. (f w + g w)\<^sup>2 * inverse 4 - (f w + - g w)\<^sup>2 * inverse 4) \<in> rv M
[PROOF STEP]
by (simp add: rv_plus_rv diff_conv_add_uminus del: add_uminus_conv_diff)
[PROOF STATE]
proof (state)
this:
(\<lambda>w. (f w + g w)\<^sup>2 * inverse 4 - (f w + - g w)\<^sup>2 * inverse 4) \<in> rv M

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>w. (f w + g w)\<^sup>2 * inverse 4 - (f w + - g w)\<^sup>2 * inverse 4) \<in> rv M

goal (1 subgoal):
 1. (\<lambda>w. f w * g w) \<in> rv M
[PROOF STEP]
txt\<open>\nopagebreak\<close>
[PROOF STATE]
proof (state)
this:
(\<lambda>w. (f w + g w)\<^sup>2 * inverse 4 - (f w + - g w)\<^sup>2 * inverse 4) \<in> rv M

goal (1 subgoal):
 1. (\<lambda>w. f w * g w) \<in> rv M
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>w. f w * g w) = (\<lambda>w. (f w + g w)\<^sup>2 * inverse 4 - (f w + - g w)\<^sup>2 * inverse 4)
(\<lambda>w. (f w + g w)\<^sup>2 * inverse 4 - (f w + - g w)\<^sup>2 * inverse 4) \<in> rv M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>w. f w * g w) = (\<lambda>w. (f w + g w)\<^sup>2 * inverse 4 - (f w + - g w)\<^sup>2 * inverse 4)
(\<lambda>w. (f w + g w)\<^sup>2 * inverse 4 - (f w + - g w)\<^sup>2 * inverse 4) \<in> rv M

goal (1 subgoal):
 1. (\<lambda>w. f w * g w) \<in> rv M
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>w. f w * g w) \<in> rv M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma drlex_pp_alt: "drlex_pp s t \<longleftrightarrow> (deg_pp s < deg_pp t \<or> (deg_pp s = deg_pp t \<and> lex_pp t s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drlex_pp s t = (deg_pp s < deg_pp t \<or> deg_pp s = deg_pp t \<and> lex_pp t s)
[PROOF STEP]
by transfer (simp only: drlex_pm_def dord_pm_alt)


[STATEMENT]
lemma fin_support_closed_under_addition:
  fixes f g :: "'a \<Rightarrow> real"
  assumes "f \<in> fin_support 0 A"
  and "g \<in> fin_support 0 A"
  shows "(\<lambda> x . f x + g x) \<in> fin_support 0 A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f x + g x) \<in> fin_support 0 A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> fin_support 0 A
g \<in> fin_support 0 A

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) \<in> fin_support 0 A
[PROOF STEP]
unfolding fin_support_def support_def
[PROOF STATE]
proof (prove)
using this:
f \<in> {f. finite {x \<in> A. f x \<noteq> 0}}
g \<in> {f. finite {x \<in> A. f x \<noteq> 0}}

goal (1 subgoal):
 1. (\<lambda>x. f x + g x) \<in> {f. finite {x \<in> A. f x \<noteq> 0}}
[PROOF STEP]
by (metis (mono_tags) mem_Collect_eq sum.finite_Collect_op)


[STATEMENT]
lemma msubset_mset_set_iff[simp]:
  assumes "finite A" "finite B"
  shows "mset_set A \<subseteq># mset_set B \<longleftrightarrow> A \<subseteq> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mset_set A \<subseteq># mset_set B) = (A \<subseteq> B)
[PROOF STEP]
using assms set_mset_mono subset_imp_msubset_mset_set
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
?A \<subseteq># ?B \<Longrightarrow> set_mset ?A \<subseteq> set_mset ?B
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> mset_set ?A \<subseteq># mset_set ?B

goal (1 subgoal):
 1. (mset_set A \<subseteq># mset_set B) = (A \<subseteq> B)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma to_vec_matrix_matrix_mult: "to_vec (A * B) = to_vec A ** to_vec B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_vec (A * B) = to_vec A ** to_vec B
[PROOF STEP]
by transfer (simp add: matrix_matrix_mult_def)


[STATEMENT]
lemma continuous_on_tan [continuous_intros]:
  fixes f :: "'a \<Rightarrow> 'a::{real_normed_field,banach}"
  shows "continuous_on s f \<Longrightarrow> (\<forall>x\<in>s. cos (f x) \<noteq> 0) \<Longrightarrow> continuous_on s (\<lambda>x. tan (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_on s f; \<forall>x\<in>s. cos (f x) \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> continuous_on s (\<lambda>x. tan (f x))
[PROOF STEP]
unfolding continuous_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>s. (f \<longlongrightarrow> f x) (at x within s); \<forall>x\<in>s. cos (f x) \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> \<forall>x\<in>s. ((\<lambda>x. tan (f x)) \<longlongrightarrow> tan (f x)) (at x within s)
[PROOF STEP]
by (auto intro: tendsto_tan)


[STATEMENT]
lemma "100094 div 144 = (695::int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 100094 div 144 = 695
[PROOF STEP]
by simp