[STATEMENT]
lemma nn_integral_nat_function:
  fixes f :: "'a \<Rightarrow> nat"
  assumes "f \<in> measurable M (count_space UNIV)"
  shows "(\<integral>\<^sup>+x. of_nat (f x) \<partial>M) = (\<Sum>t. emeasure M {x\<in>space M. t < f x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. of_nat (f x) \<partial>M = (\<Sum>t. emeasure M {x \<in> space M. t < f x})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. of_nat (f x) \<partial>M = (\<Sum>t. emeasure M {x \<in> space M. t < f x})
[PROOF STEP]
define F where "F i = {x\<in>space M. i < f x}" for i
[PROOF STATE]
proof (state)
this:
F ?i = {x \<in> space M. ?i < f x}

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. of_nat (f x) \<partial>M = (\<Sum>t. emeasure M {x \<in> space M. t < f x})
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
f \<in> M \<rightarrow>\<^sub>M count_space UNIV
F ?i = {x \<in> space M. ?i < f x}
[PROOF STEP]
have [measurable]: "\<And>i. F i \<in> sets M"
[PROOF STATE]
proof (prove)
using this:
f \<in> M \<rightarrow>\<^sub>M count_space UNIV
F ?i = {x \<in> space M. ?i < f x}

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

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. of_nat (f x) \<partial>M = (\<Sum>t. emeasure M {x \<in> space M. t < f x})
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
F ?i \<in> sets M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. of_nat (f x) \<partial>M = (\<Sum>t. emeasure M {x \<in> space M. t < f x})
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. of_nat (f x) \<partial>M = (\<Sum>t. emeasure M {x \<in> space M. t < f x})
[PROOF STEP]
assume "x \<in> space M"
[PROOF STATE]
proof (state)
this:
x \<in> space M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. of_nat (f x) \<partial>M = (\<Sum>t. emeasure M {x \<in> space M. t < f x})
[PROOF STEP]
have "(\<lambda>i. if i < f x then 1 else 0) sums (of_nat (f x)::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. if i < f x then 1 else 0) sums real (f x)
[PROOF STEP]
using sums_If_finite[of "\<lambda>i. i < f x" "\<lambda>_. 1::real"]
[PROOF STATE]
proof (prove)
using this:
finite {r. r < f x} \<Longrightarrow> (\<lambda>r. if r < f x then 1 else 0) sums (\<Sum>r | r < f x. 1)

goal (1 subgoal):
 1. (\<lambda>i. if i < f x then 1 else 0) sums real (f x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>i. if i < f x then 1 else 0) sums real (f x)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. of_nat (f x) \<partial>M = (\<Sum>t. emeasure M {x \<in> space M. t < f x})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>i. if i < f x then 1 else 0) sums real (f x)
[PROOF STEP]
have "(\<lambda>i. ennreal (if i < f x then 1 else 0)) sums of_nat(f x)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. if i < f x then 1 else 0) sums real (f x)

goal (1 subgoal):
 1. (\<lambda>i. ennreal (if i < f x then 1 else 0)) sums of_nat (f x)
[PROOF STEP]
unfolding ennreal_of_nat_eq_real_of_nat
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. if i < f x then 1 else 0) sums real (f x)

goal (1 subgoal):
 1. (\<lambda>i. ennreal (if i < f x then 1 else 0)) sums ennreal (real (f x))
[PROOF STEP]
by (subst sums_ennreal) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>i. ennreal (if i < f x then 1 else 0)) sums of_nat (f x)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. of_nat (f x) \<partial>M = (\<Sum>t. emeasure M {x \<in> space M. t < f x})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>i. ennreal (if i < f x then 1 else 0)) sums of_nat (f x)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. of_nat (f x) \<partial>M = (\<Sum>t. emeasure M {x \<in> space M. t < f x})
[PROOF STEP]
have "\<And>i. ennreal (if i < f x then 1 else 0) = indicator (F i) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. ennreal (if i < f x then 1 else 0) = indicator (F i) x
[PROOF STEP]
using \<open>x \<in> space M\<close>
[PROOF STATE]
proof (prove)
using this:
x \<in> space M

goal (1 subgoal):
 1. \<And>i. ennreal (if i < f x then 1 else 0) = indicator (F i) x
[PROOF STEP]
by (simp add: one_ennreal_def F_def)
[PROOF STATE]
proof (state)
this:
ennreal (if ?i < f x then 1 else 0) = indicator (F ?i) x

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. of_nat (f x) \<partial>M = (\<Sum>t. emeasure M {x \<in> space M. t < f x})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>i. ennreal (if i < f x then 1 else 0)) sums of_nat (f x)
ennreal (if ?i < f x then 1 else 0) = indicator (F ?i) x
[PROOF STEP]
have "of_nat (f x) = (\<Sum>i. indicator (F i) x :: ennreal)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. ennreal (if i < f x then 1 else 0)) sums of_nat (f x)
ennreal (if ?i < f x then 1 else 0) = indicator (F ?i) x

goal (1 subgoal):
 1. of_nat (f x) = (\<Sum>i. indicator (F i) x)
[PROOF STEP]
by (simp add: sums_iff)
[PROOF STATE]
proof (state)
this:
of_nat (f x) = (\<Sum>i. indicator (F i) x)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. of_nat (f x) \<partial>M = (\<Sum>t. emeasure M {x \<in> space M. t < f x})
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?x2 \<in> space M \<Longrightarrow> of_nat (f ?x2) = (\<Sum>i. indicator (F i) ?x2)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. of_nat (f x) \<partial>M = (\<Sum>t. emeasure M {x \<in> space M. t < f x})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x2 \<in> space M \<Longrightarrow> of_nat (f ?x2) = (\<Sum>i. indicator (F i) ?x2)
[PROOF STEP]
have "(\<integral>\<^sup>+x. of_nat (f x) \<partial>M) = (\<integral>\<^sup>+x. (\<Sum>i. indicator (F i) x) \<partial>M)"
[PROOF STATE]
proof (prove)
using this:
?x2 \<in> space M \<Longrightarrow> of_nat (f ?x2) = (\<Sum>i. indicator (F i) ?x2)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. of_nat (f x) \<partial>M = \<integral>\<^sup>+ x. (\<Sum>i. indicator (F i) x) \<partial>M
[PROOF STEP]
by (simp cong: nn_integral_cong)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. of_nat (f x) \<partial>M = \<integral>\<^sup>+ x. (\<Sum>i. indicator (F i) x) \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. of_nat (f x) \<partial>M = (\<Sum>t. emeasure M {x \<in> space M. t < f x})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. of_nat (f x) \<partial>M = \<integral>\<^sup>+ x. (\<Sum>i. indicator (F i) x) \<partial>M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. of_nat (f x) \<partial>M = (\<Sum>t. emeasure M {x \<in> space M. t < f x})
[PROOF STEP]
have "\<dots> = (\<Sum>i. emeasure M (F i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (\<Sum>i. indicator (F i) x) \<partial>M = (\<Sum>i. emeasure M (F i))
[PROOF STEP]
by (simp add: nn_integral_suminf)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. (\<Sum>i. indicator (F i) x) \<partial>M = (\<Sum>i. emeasure M (F i))

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. of_nat (f x) \<partial>M = (\<Sum>t. emeasure M {x \<in> space M. t < f x})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. of_nat (f x) \<partial>M = (\<Sum>i. emeasure M (F i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. of_nat (f x) \<partial>M = (\<Sum>i. emeasure M (F i))

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. of_nat (f x) \<partial>M = (\<Sum>t. emeasure M {x \<in> space M. t < f x})
[PROOF STEP]
by (simp add: F_def)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. of_nat (f x) \<partial>M = (\<Sum>t. emeasure M {x \<in> space M. t < f x})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem while_if:
     "((IF e THEN c;;(WHILE e DO c) ELSE SKIP, s) -[eval]-> t)  =
      ((WHILE e DO c, s) -[eval]-> t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((IF e THEN c;;WHILE e DO c ELSE SKIP, s) -[eval]-> t) = ((WHILE e DO c, s) -[eval]-> t)
[PROOF STEP]
by (blast intro: while_if1 while_if2)


[STATEMENT]
lemma subset_imp_lepoll: "A \<subseteq> B \<Longrightarrow> A \<lesssim> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> A \<lesssim> B
[PROOF STEP]
by (force simp: lepoll_def)


[STATEMENT]
lemma C2O_cons:
  "C2O (C (n # ns)) =
    (if n = C [] then S (C2O (C ns)) else L (\<lambda>i. C2O (C (funC n i @ ns))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C2O (C (n # ns)) = (if n = C [] then S (C2O (C ns)) else L (\<lambda>i. C2O (C (funC n i @ ns))))
[PROOF STEP]
by (induct n arbitrary: ns rule: funC.induct)
    (simp_all add: \<omega>_def C2O_replicate C2O_app flip: exp\<omega>_addO)


[STATEMENT]
lemma param_all_interval_nat[param]:
  "(List.all_interval_nat, List.all_interval_nat)
  \<in> (nat_rel \<rightarrow> bool_rel) \<rightarrow> nat_rel \<rightarrow> nat_rel \<rightarrow> bool_rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (List.all_interval_nat, List.all_interval_nat) \<in> (nat_rel \<rightarrow> bool_rel) \<rightarrow> nat_rel \<rightarrow> nat_rel \<rightarrow> bool_rel
[PROOF STEP]
unfolding List.all_interval_nat_def[abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>P i j. Ball {i..<j} P, \<lambda>P i j. Ball {i..<j} P) \<in> (nat_rel \<rightarrow> bool_rel) \<rightarrow> nat_rel \<rightarrow> nat_rel \<rightarrow> bool_rel
[PROOF STEP]
apply parametricity
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a a' aa a'a ab a'b. \<lbrakk>(a, a') \<in> nat_rel \<rightarrow> bool_rel; (aa, a'a) \<in> nat_rel; (ab, a'b) \<in> nat_rel\<rbrakk> \<Longrightarrow> ({aa..<ab}, {a'a..<a'b}) \<in> \<langle>nat_rel\<rangle>set_rel
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma infsum_finite_approximation:
  fixes f :: "'a \<Rightarrow> 'b::{comm_monoid_add,metric_space}"
  assumes "f summable_on A" and "\<epsilon> > 0"
  shows "\<exists>F. finite F \<and> F \<subseteq> A \<and> dist (sum f F) (infsum f A) \<le> \<epsilon>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>F. finite F \<and> F \<subseteq> A \<and> dist (sum f F) (infsum f A) \<le> \<epsilon>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>F. finite F \<and> F \<subseteq> A \<and> dist (sum f F) (infsum f A) \<le> \<epsilon>
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
f summable_on A
0 < \<epsilon>
[PROOF STEP]
have "has_sum f A (infsum f A)"
[PROOF STATE]
proof (prove)
using this:
f summable_on A
0 < \<epsilon>

goal (1 subgoal):
 1. has_sum f A (infsum f A)
[PROOF STEP]
by (simp add: summable_iff_has_sum_infsum)
[PROOF STATE]
proof (state)
this:
has_sum f A (infsum f A)

goal (1 subgoal):
 1. \<exists>F. finite F \<and> F \<subseteq> A \<and> dist (sum f F) (infsum f A) \<le> \<epsilon>
[PROOF STEP]
from this and \<open>\<epsilon> > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
has_sum f A (infsum f A)
0 < \<epsilon>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
has_sum f A (infsum f A)
0 < \<epsilon>

goal (1 subgoal):
 1. \<exists>F. finite F \<and> F \<subseteq> A \<and> dist (sum f F) (infsum f A) \<le> \<epsilon>
[PROOF STEP]
by (rule has_sum_finite_approximation)
[PROOF STATE]
proof (state)
this:
\<exists>F. finite F \<and> F \<subseteq> A \<and> dist (sum f F) (infsum f A) \<le> \<epsilon>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Mapping_filter_keys: "(\<forall>k \<in> Mapping.keys m. P (Mapping.lookup m k)) \<Longrightarrow>
  (\<forall>k \<in> Mapping.keys (Mapping.filter f m). P (Mapping.lookup (Mapping.filter f m) k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>k\<in>Mapping.keys m. P (Mapping.lookup m k) \<Longrightarrow> \<forall>k\<in>Mapping.keys (Mapping.filter f m). P (Mapping.lookup (Mapping.filter f m) k)
[PROOF STEP]
using Mapping_lookup_filter_keys Mapping.keys_filter
[PROOF STATE]
proof (prove)
using this:
?k \<in> Mapping.keys (Mapping.filter ?f ?m) \<Longrightarrow> Mapping.lookup (Mapping.filter ?f ?m) ?k = Mapping.lookup ?m ?k
Mapping.keys (Mapping.filter ?P ?m) \<subseteq> Mapping.keys ?m

goal (1 subgoal):
 1. \<forall>k\<in>Mapping.keys m. P (Mapping.lookup m k) \<Longrightarrow> \<forall>k\<in>Mapping.keys (Mapping.filter f m). P (Mapping.lookup (Mapping.filter f m) k)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma ball_vimage_iff: "(\<forall>x\<in>f -` X. P x) \<longleftrightarrow> (\<forall>x. f x \<in> X \<longrightarrow> P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>f -` X. P x) = (\<forall>x. f x \<in> X \<longrightarrow> P x)
[PROOF STEP]
by auto


[STATEMENT]
lemma suminf_0_le:
  fixes f :: "nat \<Rightarrow> ereal"
  assumes "\<And>n. 0 \<le> f n"
  shows "0 \<le> (\<Sum>n. f n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (\<Sum>n. f n)
[PROOF STEP]
using suminf_upper[of f 0, OF assms]
[PROOF STATE]
proof (prove)
using this:
sum f {..<0} \<le> (\<Sum>n. f n)

goal (1 subgoal):
 1. 0 \<le> (\<Sum>n. f n)
[PROOF STEP]
by simp


[STATEMENT]
lemma reduction_signs_are_distinct_R:
  fixes p:: "real poly"
  fixes qs :: "real poly list"
  fixes subsets :: "(nat list*nat list) list"
  fixes signs :: "rat list list"
  assumes sat_eq: "satisfy_equation_R p qs subsets signs"
  assumes inv_mat: "invertible_mat (matrix_A_R signs subsets)"
  assumes distinct_init: "distinct signs"
  shows "distinct (reduction_signs_R p qs signs subsets (matrix_A_R signs subsets))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (reduction_signs_R p qs signs subsets (M_mat_R signs subsets))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. distinct (reduction_signs_R p qs signs subsets (M_mat_R signs subsets))
[PROOF STEP]
have solve_construct: "construct_lhs_vector_R p qs signs =
  solve_for_lhs_R p qs subsets (matrix_A_R signs subsets)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w_vec_R p qs signs = solve_for_lhs_R p qs subsets (M_mat_R signs subsets)
[PROOF STEP]
using construct_lhs_matches_solve_for_lhs_R assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>satisfy_equation_R ?p ?qs ?subsets ?signs; invertible_mat (M_mat_R ?signs ?subsets)\<rbrakk> \<Longrightarrow> w_vec_R ?p ?qs ?signs = solve_for_lhs_R ?p ?qs ?subsets (M_mat_R ?signs ?subsets)
satisfy_equation_R p qs subsets signs
invertible_mat (M_mat_R signs subsets)
distinct signs

goal (1 subgoal):
 1. w_vec_R p qs signs = solve_for_lhs_R p qs subsets (M_mat_R signs subsets)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
w_vec_R p qs signs = solve_for_lhs_R p qs subsets (M_mat_R signs subsets)

goal (1 subgoal):
 1. distinct (reduction_signs_R p qs signs subsets (M_mat_R signs subsets))
[PROOF STEP]
have h1: "distinct (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (matrix_A_R signs subsets)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets)))
[PROOF STEP]
unfolding find_nonzeros_from_input_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (filter (\<lambda>i. solve_for_lhs_R p qs subsets (M_mat_R signs subsets) $ i \<noteq> 0) [0..<dim_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets))])
[PROOF STEP]
using distinct_filter
[PROOF STATE]
proof (prove)
using this:
distinct ?xs \<Longrightarrow> distinct (filter ?P ?xs)

goal (1 subgoal):
 1. distinct (filter (\<lambda>i. solve_for_lhs_R p qs subsets (M_mat_R signs subsets) $ i \<noteq> 0) [0..<dim_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets))])
[PROOF STEP]
using distinct_upt
[PROOF STATE]
proof (prove)
using this:
distinct ?xs \<Longrightarrow> distinct (filter ?P ?xs)
distinct [?i..<?j]

goal (1 subgoal):
 1. distinct (filter (\<lambda>i. solve_for_lhs_R p qs subsets (M_mat_R signs subsets) $ i \<noteq> 0) [0..<dim_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets))])
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
distinct (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets)))

goal (1 subgoal):
 1. distinct (reduction_signs_R p qs signs subsets (M_mat_R signs subsets))
[PROOF STEP]
have h2: "(\<And>j. j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (matrix_A_R signs subsets))) \<Longrightarrow>
          j < length signs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets))) \<Longrightarrow> j < length signs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets))) \<Longrightarrow> j < length signs
[PROOF STEP]
fix j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets))) \<Longrightarrow> j < length signs
[PROOF STEP]
assume "j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (matrix_A_R signs subsets)))"
[PROOF STATE]
proof (state)
this:
j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets)))

goal (1 subgoal):
 1. \<And>j. j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets))) \<Longrightarrow> j < length signs
[PROOF STEP]
show "j < length signs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j < length signs
[PROOF STEP]
using solve_construct size_of_lhs_R
[PROOF STATE]
proof (prove)
using this:
w_vec_R p qs signs = solve_for_lhs_R p qs subsets (M_mat_R signs subsets)
dim_vec (w_vec_R ?p ?qs ?signs) = length ?signs

goal (1 subgoal):
 1. j < length signs
[PROOF STEP]
by (metis \<open>j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (matrix_A_R signs subsets)))\<close> atLeastLessThan_iff filter_is_subset find_nonzeros_from_input_vec_def set_upt subset_iff)
[PROOF STATE]
proof (state)
this:
j < length signs

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets))) \<Longrightarrow> ?j < length signs

goal (1 subgoal):
 1. distinct (reduction_signs_R p qs signs subsets (M_mat_R signs subsets))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets))) \<Longrightarrow> ?j < length signs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets))) \<Longrightarrow> ?j < length signs

goal (1 subgoal):
 1. distinct (reduction_signs_R p qs signs subsets (M_mat_R signs subsets))
[PROOF STEP]
unfolding reduction_signs_R_def
[PROOF STATE]
proof (prove)
using this:
?j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets))) \<Longrightarrow> ?j < length signs

goal (1 subgoal):
 1. distinct (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets))))
[PROOF STEP]
unfolding take_indices_def
[PROOF STATE]
proof (prove)
using this:
?j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets))) \<Longrightarrow> ?j < length signs

goal (1 subgoal):
 1. distinct (map ((!) signs) (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets))))
[PROOF STEP]
using distinct_init h1 h2 conjugatable_vec_space.distinct_map_nth[where ls = "signs", where inds = "(find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (matrix_A_R signs subsets)))"]
[PROOF STATE]
proof (prove)
using this:
?j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets))) \<Longrightarrow> ?j < length signs
distinct signs
distinct (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets)))
?j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets))) \<Longrightarrow> ?j < length signs
\<lbrakk>distinct signs; distinct (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets))); \<And>j. j \<in> set (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets))) \<Longrightarrow> j < length signs\<rbrakk> \<Longrightarrow> distinct (map ((!) signs) (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets))))

goal (1 subgoal):
 1. distinct (map ((!) signs) (find_nonzeros_from_input_vec (solve_for_lhs_R p qs subsets (M_mat_R signs subsets))))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
distinct (reduction_signs_R p qs signs subsets (M_mat_R signs subsets))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inf_prefix_length_append[simp]: "
  inf_prefix_length (zs @ xs) (zs @ ys) =
  length zs + inf_prefix_length xs ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inf_prefix_length (zs @ xs) (zs @ ys) = length zs + inf_prefix_length xs ys
[PROOF STEP]
apply (induct zs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. inf_prefix_length ([] @ xs) ([] @ ys) = length [] + inf_prefix_length xs ys
 2. \<And>a zs. inf_prefix_length (zs @ xs) (zs @ ys) = length zs + inf_prefix_length xs ys \<Longrightarrow> inf_prefix_length ((a # zs) @ xs) ((a # zs) @ ys) = length (a # zs) + inf_prefix_length xs ys
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a zs. inf_prefix_length (zs @ xs) (zs @ ys) = length zs + inf_prefix_length xs ys \<Longrightarrow> inf_prefix_length ((a # zs) @ xs) ((a # zs) @ ys) = length (a # zs) + inf_prefix_length xs ys
[PROOF STEP]
apply (simp add: inf_prefix_length_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem mann: "2\<times>x = -(- 3\<times>x \<squnion> x) \<squnion> 2\<times>x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<times> x = - (- 3 \<times> x \<squnion> x) \<squnion> 2 \<times> x
[PROOF STEP]
using mann10[where x=x and y="2\<times>x"]
      mann8[where x=x]
      two[where x=x] three[where x=x] sup_comm
[PROOF STATE]
proof (prove)
using this:
2 \<times> x = - (- (- (- 3 \<times> x \<squnion> x) \<squnion> - 3 \<times> x \<squnion> 2 \<times> x) \<squnion> - (x \<squnion> 2 \<times> x))
- (- 3 \<times> x \<squnion> x) \<squnion> 2 \<times> x = - (- (- (- 3 \<times> x \<squnion> x) \<squnion> - 3 \<times> x \<squnion> 2 \<times> x) \<squnion> - 3 \<times> x)
2 \<times> x = x \<squnion> x
3 \<times> x = x \<squnion> x \<squnion> x
?x \<squnion> ?y = ?y \<squnion> ?x

goal (1 subgoal):
 1. 2 \<times> x = - (- 3 \<times> x \<squnion> x) \<squnion> 2 \<times> x
[PROOF STEP]
by metis


[STATEMENT]
lemma Re_Arcsin: "Re(Arcsin z) = Im (Ln (\<i> * z + csqrt(1 - z\<^sup>2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (Arcsin z) = Im (Ln (\<i> * z + csqrt (1 - z\<^sup>2)))
[PROOF STEP]
by (simp add: Arcsin_def)


[STATEMENT]
lemma "eq (Odd_Succ (Even_Succ (Odd_Succ Even_Zero))) (Odd_Succ (Even_Succ (Odd_Succ (Even_Succ (Odd_Succ Even_Zero)))))
    \<longleftrightarrow> False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eq (Odd_Succ (Even_Succ (Odd_Succ Even_Zero))) (Odd_Succ (Even_Succ (Odd_Succ (Even_Succ (Odd_Succ Even_Zero))))) = False
[PROOF STEP]
by eval


[STATEMENT]
theorem from_dtree_fin_list_dir: "fin_list_directed_tree (root t) (from_dtree dt dh t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fin_list_directed_tree (dtree.root t) (from_dtree dt dh t)
[PROOF STEP]
unfolding fin_list_directed_tree_def fin_list_directed_tree_axioms_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_directed_tree (from_dtree dt dh t) (dtree.root t) \<and> (\<forall>u v. u \<in> verts (from_dtree dt dh t) \<longrightarrow> v \<in> verts (from_dtree dt dh t) \<longrightarrow> u \<noteq> v \<longrightarrow> set u \<inter> set v = {}) \<and> (\<forall>v. v \<in> verts (from_dtree dt dh t) \<longrightarrow> v \<noteq> [])
[PROOF STEP]
by (auto simp: from_dtree_fin_directed empty_notin_wf_dlverts[OF wf_lverts]
      intro: wf_lverts dverts_same_if_set_wf)


[STATEMENT]
lemma bounded_unique_outside:
  fixes S :: "'a :: euclidean_space set"
  assumes "bounded S" "DIM('a) \<ge> 2"
  shows "(c \<in> components (- S) \<and> \<not> bounded c \<longleftrightarrow> c = outside S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c \<in> components (- S) \<and> \<not> bounded c) = (c = outside S)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bounded S
2 \<le> DIM('a)

goal (1 subgoal):
 1. (c \<in> components (- S) \<and> \<not> bounded c) = (c = outside S)
[PROOF STEP]
by (metis cobounded_unique_unbounded_components connected_outside double_compl outside_bounded_nonempty outside_in_components unbounded_outside)


[STATEMENT]
lemma octo_norm_conj: "octo_of_real ( inner x y) = (1/2) *\<^sub>R (x * (cnj y) + y * (cnj x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. octo_of_real (x \<bullet> y) = (1 / 2) *\<^sub>R (x * Octonions.cnj y + y * Octonions.cnj x)
[PROOF STEP]
by (simp add: octo_eq_iff octo_mult_components inner_octo_def)


[STATEMENT]
theorem TBtheorem5b_notPQ:
assumes "subcomponents PQ = {P,Q}"
       and "correctCompositionOut PQ"
       and "out_exprChannelSet P ChSetP E"
       and "out_exprChannelSet Q ChSetQ E"
       and "M = ChSetP \<union> ChSetQ"
       and "\<forall> (x ::chanID). ((x \<in> ChSetP) \<longrightarrow> (x \<in> (loc PQ)))"
       and "\<forall> (x ::chanID). ((x \<in> ChSetQ) \<longrightarrow> (x \<in> (loc PQ)))"
shows    "\<not> eoutM PQ M E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> eoutM PQ M E
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
subcomponents PQ = {P, Q}
correctCompositionOut PQ
out_exprChannelSet P ChSetP E
out_exprChannelSet Q ChSetQ E
M = ChSetP \<union> ChSetQ
\<forall>x. x \<in> ChSetP \<longrightarrow> x \<in> loc PQ
\<forall>x. x \<in> ChSetQ \<longrightarrow> x \<in> loc PQ

goal (1 subgoal):
 1. \<not> eoutM PQ M E
[PROOF STEP]
by (simp add: eoutM_def correctCompositionOut_def
                     out_exprChannelSet_def, auto)


[STATEMENT]
lemma hyperpow_two_gt_one: "\<And>r::'a::linordered_semidom star. 1 < r \<Longrightarrow> 1 < r pow 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r. 1 < r \<Longrightarrow> 1 < r pow 2
[PROOF STEP]
by transfer simp


[STATEMENT]
lemma DeMoivre: "(cis a) ^ n = cis (real n * a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cis a ^ n = cis (real n * a)
[PROOF STEP]
by (induct n) (simp_all add: algebra_simps cis_mult)


[STATEMENT]
lemma inequality_1:
  "y > 0 \<Longrightarrow> y + 3 \<le> (2 :: nat) ^ (y + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < y \<Longrightarrow> y + 3 \<le> 2 ^ (y + 1)
[PROOF STEP]
by (induction y) (simp, fastforce)


[STATEMENT]
lemma mono_Increasing_o:
     "mono g ==> Increasing f \<subseteq> Increasing (g o f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono g \<Longrightarrow> Increasing f \<subseteq> Increasing (g \<circ> f)
[PROOF STEP]
apply (simp add: Increasing_def Stable_def Constrains_def stable_def
                 constrains_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono g \<Longrightarrow> (\<Inter>x. {F. \<forall>act\<in>Acts F. act `` (reachable F \<inter> {s. x \<le> f s}) \<subseteq> {s. x \<le> f s}}) \<subseteq> (\<Inter>x. {F. \<forall>act\<in>Acts F. act `` (reachable F \<inter> {s. x \<le> g (f s)}) \<subseteq> {s. x \<le> g (f s)}})
[PROOF STEP]
apply (blast intro: monoD order_trans)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma diamond_x_n:
  "|x>n(y) = n(x * y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. | x > n y = n (x * y)
[PROOF STEP]
by (simp add: n_mult ndiamond_def)


[STATEMENT]
lemma pairwise_disjnt_quadruple_sum:
  "pairwise disjnt ((\<lambda> x. {(a, b, c, d) | a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` (sumset A A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise disjnt ((\<lambda>x. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` sumset A A)
[PROOF STEP]
unfolding disjnt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pairwise (\<lambda>A B. A \<inter> B = {}) ((\<lambda>x. {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<oplus> b = x \<and> c \<oplus> d = x}) ` sumset A A)
[PROOF STEP]
by (intro pairwiseI) (auto)


[STATEMENT]
lemma less_two_power: "n < 2 ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < 2 ^ n
[PROOF STEP]
by (fact less_exp)


[STATEMENT]
lemma (in idom_char_0) order_decomp:
  "poly p \<noteq> poly [] \<Longrightarrow> \<exists>q. poly p = poly (([-a, 1] %^ order a p) *** q) \<and> \<not> [-a, 1] divides q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p \<noteq> poly [] \<Longrightarrow> \<exists>q. poly p = poly ([- a, 1::'a] %^ order a p *** q) \<and> \<not> [- a, 1::'a] divides q
[PROOF STEP]
unfolding divides_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p \<noteq> poly [] \<Longrightarrow> \<exists>q. poly p = poly ([- a, 1::'a] %^ order a p *** q) \<and> (\<nexists>qa. poly q = poly ([- a, 1::'a] *** qa))
[PROOF STEP]
apply (drule order2 [where a = a])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [- a, 1::'a] %^ order a p divides p \<and> \<not> [- a, 1::'a] %^ Suc (order a p) divides p \<Longrightarrow> \<exists>q. poly p = poly ([- a, 1::'a] %^ order a p *** q) \<and> (\<nexists>qa. poly q = poly ([- a, 1::'a] *** qa))
[PROOF STEP]
apply (simp add: divides_def del: pexp_Suc pmult_Cons)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>q. poly p = poly ([- a, 1::'a] %^ order a p *** q)) \<and> (\<forall>q. poly p \<noteq> poly ([- a, 1::'a] %^ Suc (order a p) *** q)) \<Longrightarrow> \<exists>q. poly p = poly ([- a, 1::'a] %^ order a p *** q) \<and> (\<forall>qa. poly q \<noteq> poly ([- a, 1::'a] *** qa))
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>q. \<lbrakk>\<forall>q. poly p \<noteq> poly ([- a, 1::'a] %^ Suc (order a p) *** q); poly p = poly ([- a, 1::'a] %^ order a p *** q)\<rbrakk> \<Longrightarrow> \<exists>q. poly p = poly ([- a, 1::'a] %^ order a p *** q) \<and> (\<forall>qa. poly q \<noteq> poly ([- a, 1::'a] *** qa))
[PROOF STEP]
apply (rule_tac x = q in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>q. \<lbrakk>\<forall>q. poly p \<noteq> poly ([- a, 1::'a] %^ Suc (order a p) *** q); poly p = poly ([- a, 1::'a] %^ order a p *** q)\<rbrakk> \<Longrightarrow> poly p = poly ([- a, 1::'a] %^ order a p *** q) \<and> (\<forall>qa. poly q \<noteq> poly ([- a, 1::'a] *** qa))
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>q qa. \<lbrakk>\<forall>q. poly p \<noteq> poly ([- a, 1::'a] %^ Suc (order a p) *** q); poly p = poly ([- a, 1::'a] %^ order a p *** q); poly q = poly ([- a, 1::'a] *** qa)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (drule_tac x = qa in spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>q qa. \<lbrakk>poly p = poly ([- a, 1::'a] %^ order a p *** q); poly q = poly ([- a, 1::'a] *** qa); poly p \<noteq> poly ([- a, 1::'a] %^ Suc (order a p) *** qa)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (auto simp add: poly_mult fun_eq_iff poly_exp ac_simps simp del: pmult_Cons)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Next_not_member_subset: "finite S' \<Longrightarrow> S \<subseteq> S' \<Longrightarrow> Next S' \<notin> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite S'; S \<subseteq> S'\<rbrakk> \<Longrightarrow> Next S' \<notin> S
[PROOF STEP]
unfolding Next_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite S'; S \<subseteq> S'\<rbrakk> \<Longrightarrow> (if S' = {} then arb else next (Max S')) \<notin> S
[PROOF STEP]
using next_ge
[PROOF STATE]
proof (prove)
using this:
?x < next ?x

goal (1 subgoal):
 1. \<lbrakk>finite S'; S \<subseteq> S'\<rbrakk> \<Longrightarrow> (if S' = {} then arb else next (Max S')) \<notin> S
[PROOF STEP]
by (metis Max_ge Max_mono empty_iff finite_subset leD less_le_trans subset_empty)


[STATEMENT]
lemma subst_typ_comp:
  "subst_typ inst1 (subst_typ inst2 T) = subst_typ (map (apsnd (subst_typ inst1)) inst2 @ inst1) T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subst_typ inst1 (subst_typ inst2 T) = subst_typ (map (apsnd (subst_typ inst1)) inst2 @ inst1) T
[PROOF STEP]
proof (induction inst2 T arbitrary: inst1 rule: subst_typ.induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>insts a Ts inst1. (\<And>x inst1. x \<in> set Ts \<Longrightarrow> subst_typ inst1 (subst_typ insts x) = subst_typ (map (apsnd (subst_typ inst1)) insts @ inst1) x) \<Longrightarrow> subst_typ inst1 (subst_typ insts (Ty a Ts)) = subst_typ (map (apsnd (subst_typ inst1)) insts @ inst1) (Ty a Ts)
 2. \<And>insts idn S inst1. subst_typ inst1 (subst_typ insts (Tv idn S)) = subst_typ (map (apsnd (subst_typ inst1)) insts @ inst1) (Tv idn S)
[PROOF STEP]
case (1 insts a Ts)
[PROOF STATE]
proof (state)
this:
?x \<in> set Ts \<Longrightarrow> subst_typ ?inst1.0 (subst_typ insts ?x) = subst_typ (map (apsnd (subst_typ ?inst1.0)) insts @ ?inst1.0) ?x

goal (2 subgoals):
 1. \<And>insts a Ts inst1. (\<And>x inst1. x \<in> set Ts \<Longrightarrow> subst_typ inst1 (subst_typ insts x) = subst_typ (map (apsnd (subst_typ inst1)) insts @ inst1) x) \<Longrightarrow> subst_typ inst1 (subst_typ insts (Ty a Ts)) = subst_typ (map (apsnd (subst_typ inst1)) insts @ inst1) (Ty a Ts)
 2. \<And>insts idn S inst1. subst_typ inst1 (subst_typ insts (Tv idn S)) = subst_typ (map (apsnd (subst_typ inst1)) insts @ inst1) (Tv idn S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x \<in> set Ts \<Longrightarrow> subst_typ ?inst1.0 (subst_typ insts ?x) = subst_typ (map (apsnd (subst_typ ?inst1.0)) insts @ ?inst1.0) ?x
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
?x \<in> set Ts \<Longrightarrow> subst_typ ?inst1.0 (subst_typ insts ?x) = subst_typ (map (apsnd (subst_typ ?inst1.0)) insts @ ?inst1.0) ?x

goal (1 subgoal):
 1. subst_typ inst1 (subst_typ insts (Ty a Ts)) = subst_typ (map (apsnd (subst_typ inst1)) insts @ inst1) (Ty a Ts)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
subst_typ inst1 (subst_typ insts (Ty a Ts)) = subst_typ (map (apsnd (subst_typ inst1)) insts @ inst1) (Ty a Ts)

goal (1 subgoal):
 1. \<And>insts idn S inst1. subst_typ inst1 (subst_typ insts (Tv idn S)) = subst_typ (map (apsnd (subst_typ inst1)) insts @ inst1) (Tv idn S)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>insts idn S inst1. subst_typ inst1 (subst_typ insts (Tv idn S)) = subst_typ (map (apsnd (subst_typ inst1)) insts @ inst1) (Tv idn S)
[PROOF STEP]
case (2 insts idn S)
[PROOF STATE]
proof (state)
this:

goal (1 subgoal):
 1. \<And>insts idn S inst1. subst_typ inst1 (subst_typ insts (Tv idn S)) = subst_typ (map (apsnd (subst_typ inst1)) insts @ inst1) (Tv idn S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subst_typ inst1 (subst_typ insts (Tv idn S)) = subst_typ (map (apsnd (subst_typ inst1)) insts @ inst1) (Tv idn S)
[PROOF STEP]
by (induction insts) auto
[PROOF STATE]
proof (state)
this:
subst_typ inst1 (subst_typ insts (Tv idn S)) = subst_typ (map (apsnd (subst_typ inst1)) insts @ inst1) (Tv idn S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma max_ex_gr: "\<exists>x \<in> X. k < x \<Longrightarrow> finite X \<Longrightarrow> X \<noteq> {} \<Longrightarrow> k < Max X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>x\<in>X. k < x; finite X; X \<noteq> {}\<rbrakk> \<Longrightarrow> k < Max X
[PROOF STEP]
by (simp add: Max_gr_iff)


[STATEMENT]
lemma mult_scalar_minus_mult_left [simp]: "(- p) \<odot> q = - (p \<odot> q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - p \<odot> q = - (p \<odot> q)
[PROOF STEP]
by (rule sym, rule minus_unique, simp add: mult_scalar_distrib_right[symmetric])


[STATEMENT]
lemma degree_mod_less': "b \<noteq> 0 \<Longrightarrow> a mod b \<noteq> 0 \<Longrightarrow> degree (a mod b) < degree b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>b \<noteq> 0; a mod b \<noteq> 0\<rbrakk> \<Longrightarrow> degree (a mod b) < degree b
[PROOF STEP]
by (rule degree_mod_less_degree) auto


[STATEMENT]
lemma enat_le_minus_1_imp_lt: "m \<le> n - 1 \<Longrightarrow> n \<noteq> \<infinity> \<Longrightarrow> n \<noteq> 0 \<Longrightarrow> m < n" for m n :: enat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m \<le> n - 1; n \<noteq> \<infinity>; n \<noteq> 0\<rbrakk> \<Longrightarrow> m < n
[PROOF STEP]
by (cases m; cases n; simp add: zero_enat_def one_enat_def)


[STATEMENT]
lemma interval_lemma1: "\<lbrakk>S \<subseteq> interval r a b; x \<in> S\<rbrakk> \<Longrightarrow> (a, x) \<in> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<subseteq> interval r a b; x \<in> S\<rbrakk> \<Longrightarrow> (a, x) \<in> r
[PROOF STEP]
unfolding interval_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<subseteq> {x. (a, x) \<in> r \<and> (x, b) \<in> r}; x \<in> S\<rbrakk> \<Longrightarrow> (a, x) \<in> r
[PROOF STEP]
by fast


[STATEMENT]
lemma pred_mset_iff: \<comment> \<open>TODO: alias for \<^const>\<open>Multiset.Ball\<close>\<close>
  \<open>pred_mset P M \<longleftrightarrow> Multiset.Ball M P\<close>  (is \<open>?P \<longleftrightarrow> ?Q\<close>)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pred_mset P M = Multiset.Ball M P
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. pred_mset P M \<Longrightarrow> Multiset.Ball M P
 2. Multiset.Ball M P \<Longrightarrow> pred_mset P M
[PROOF STEP]
assume ?P
[PROOF STATE]
proof (state)
this:
pred_mset P M

goal (2 subgoals):
 1. pred_mset P M \<Longrightarrow> Multiset.Ball M P
 2. Multiset.Ball M P \<Longrightarrow> pred_mset P M
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pred_mset P M
[PROOF STEP]
show ?Q
[PROOF STATE]
proof (prove)
using this:
pred_mset P M

goal (1 subgoal):
 1. Multiset.Ball M P
[PROOF STEP]
by induction simp_all
[PROOF STATE]
proof (state)
this:
Multiset.Ball M P

goal (1 subgoal):
 1. Multiset.Ball M P \<Longrightarrow> pred_mset P M
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Multiset.Ball M P \<Longrightarrow> pred_mset P M
[PROOF STEP]
assume ?Q
[PROOF STATE]
proof (state)
this:
Multiset.Ball M P

goal (1 subgoal):
 1. Multiset.Ball M P \<Longrightarrow> pred_mset P M
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Multiset.Ball M P
[PROOF STEP]
show ?P
[PROOF STATE]
proof (prove)
using this:
Multiset.Ball M P

goal (1 subgoal):
 1. pred_mset P M
[PROOF STEP]
by (induction M) (auto intro: pred_mset.intros)
[PROOF STATE]
proof (state)
this:
pred_mset P M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma empty_set_less_aux_finite_iff:
  "finite A \<Longrightarrow> {} \<sqsubset>' A \<longleftrightarrow> A \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> ({} \<sqsubset>' A) = (A \<noteq> {})
[PROOF STEP]
by(auto intro: psubset_finite_imp_set_less_aux)


[STATEMENT]
lemma (in filtrated_prob_space) adapt_stoch_proc_borel_measurable:
  assumes "adapt_stoch_proc F X N"
  shows "\<forall>n. (X n) \<in> measurable M N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. random_variable N (X n)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. random_variable N (X n)
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. random_variable N (X n)
[PROOF STEP]
have "X n \<in> measurable (F n) N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X n \<in> F n \<rightarrow>\<^sub>M N
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
adapt_stoch_proc F X N

goal (1 subgoal):
 1. X n \<in> F n \<rightarrow>\<^sub>M N
[PROOF STEP]
unfolding  adapt_stoch_proc_def
[PROOF STATE]
proof (prove)
using this:
\<forall>t. X t \<in> F t \<rightarrow>\<^sub>M N

goal (1 subgoal):
 1. X n \<in> F n \<rightarrow>\<^sub>M N
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
X n \<in> F n \<rightarrow>\<^sub>M N

goal (1 subgoal):
 1. \<And>n. random_variable N (X n)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
X n \<in> F n \<rightarrow>\<^sub>M N

goal (1 subgoal):
 1. \<And>n. random_variable N (X n)
[PROOF STEP]
have "subalgebra M (F n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subalgebra M (F n)
[PROOF STEP]
using filtration
[PROOF STATE]
proof (prove)
using this:
Filtration.filtration M F

goal (1 subgoal):
 1. subalgebra M (F n)
[PROOF STEP]
unfolding filtration_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>t. subalgebra M (F t)) \<and> (\<forall>s t. s \<le> t \<longrightarrow> subalgebra (F t) (F s))

goal (1 subgoal):
 1. subalgebra M (F n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
subalgebra M (F n)

goal (1 subgoal):
 1. \<And>n. random_variable N (X n)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
X n \<in> F n \<rightarrow>\<^sub>M N
subalgebra M (F n)
[PROOF STEP]
show "X n \<in> measurable M N"
[PROOF STATE]
proof (prove)
using this:
X n \<in> F n \<rightarrow>\<^sub>M N
subalgebra M (F n)

goal (1 subgoal):
 1. random_variable N (X n)
[PROOF STEP]
by (simp add:measurable_from_subalg)
[PROOF STATE]
proof (state)
this:
random_variable N (X n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma PiE_eq_empty_iff: "Pi\<^sub>E I F = {} \<longleftrightarrow> (\<exists>i\<in>I. F i = {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Pi\<^sub>E I F = {}) = (\<exists>i\<in>I. F i = {})
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Pi\<^sub>E I F = {} \<Longrightarrow> \<exists>i\<in>I. F i = {}
 2. \<exists>i\<in>I. F i = {} \<Longrightarrow> Pi\<^sub>E I F = {}
[PROOF STEP]
assume "Pi\<^sub>E I F = {}"
[PROOF STATE]
proof (state)
this:
Pi\<^sub>E I F = {}

goal (2 subgoals):
 1. Pi\<^sub>E I F = {} \<Longrightarrow> \<exists>i\<in>I. F i = {}
 2. \<exists>i\<in>I. F i = {} \<Longrightarrow> Pi\<^sub>E I F = {}
[PROOF STEP]
show "\<exists>i\<in>I. F i = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i\<in>I. F i = {}
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (\<exists>i\<in>I. F i = {}) \<Longrightarrow> False
[PROOF STEP]
assume "\<not> ?thesis"
[PROOF STATE]
proof (state)
this:
\<not> (\<exists>i\<in>I. F i = {})

goal (1 subgoal):
 1. \<not> (\<exists>i\<in>I. F i = {}) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (\<exists>i\<in>I. F i = {})
[PROOF STEP]
have "\<forall>i. \<exists>y. (i \<in> I \<longrightarrow> y \<in> F i) \<and> (i \<notin> I \<longrightarrow> y = undefined)"
[PROOF STATE]
proof (prove)
using this:
\<not> (\<exists>i\<in>I. F i = {})

goal (1 subgoal):
 1. \<forall>i. \<exists>y. (i \<in> I \<longrightarrow> y \<in> F i) \<and> (i \<notin> I \<longrightarrow> y = undefined)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i. \<exists>y. (i \<in> I \<longrightarrow> y \<in> F i) \<and> (i \<notin> I \<longrightarrow> y = undefined)

goal (1 subgoal):
 1. \<not> (\<exists>i\<in>I. F i = {}) \<Longrightarrow> False
[PROOF STEP]
from choice[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<exists>f. \<forall>x. (x \<in> I \<longrightarrow> f x \<in> F x) \<and> (x \<notin> I \<longrightarrow> f x = undefined)
[PROOF STEP]
obtain f where " \<forall>x. (x \<in> I \<longrightarrow> f x \<in> F x) \<and> (x \<notin> I \<longrightarrow> f x = undefined)"
[PROOF STATE]
proof (prove)
using this:
\<exists>f. \<forall>x. (x \<in> I \<longrightarrow> f x \<in> F x) \<and> (x \<notin> I \<longrightarrow> f x = undefined)

goal (1 subgoal):
 1. (\<And>f. \<forall>x. (x \<in> I \<longrightarrow> f x \<in> F x) \<and> (x \<notin> I \<longrightarrow> f x = undefined) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<forall>x. (x \<in> I \<longrightarrow> f x \<in> F x) \<and> (x \<notin> I \<longrightarrow> f x = undefined)

goal (1 subgoal):
 1. \<not> (\<exists>i\<in>I. F i = {}) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. (x \<in> I \<longrightarrow> f x \<in> F x) \<and> (x \<notin> I \<longrightarrow> f x = undefined)
[PROOF STEP]
have "f \<in> Pi\<^sub>E I F"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. (x \<in> I \<longrightarrow> f x \<in> F x) \<and> (x \<notin> I \<longrightarrow> f x = undefined)

goal (1 subgoal):
 1. f \<in> Pi\<^sub>E I F
[PROOF STEP]
by (auto simp: extensional_def PiE_def)
[PROOF STATE]
proof (state)
this:
f \<in> Pi\<^sub>E I F

goal (1 subgoal):
 1. \<not> (\<exists>i\<in>I. F i = {}) \<Longrightarrow> False
[PROOF STEP]
with \<open>Pi\<^sub>E I F = {}\<close>
[PROOF STATE]
proof (chain)
picking this:
Pi\<^sub>E I F = {}
f \<in> Pi\<^sub>E I F
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
Pi\<^sub>E I F = {}
f \<in> Pi\<^sub>E I F

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>i\<in>I. F i = {}

goal (1 subgoal):
 1. \<exists>i\<in>I. F i = {} \<Longrightarrow> Pi\<^sub>E I F = {}
[PROOF STEP]
qed (auto simp: PiE_def)


[STATEMENT]
lemma truncate_down_eq_zero_iff[simp]: "truncate_down prec x = 0 \<longleftrightarrow> x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (truncate_down prec x = 0) = (x = 0)
[PROOF STEP]
by (metis not_less_iff_gr_or_eq truncate_down_less_zero_iff truncate_down_pos truncate_down_zero)


[STATEMENT]
lemma insert_eqpoll_cong:
     "\<lbrakk>A \<approx> B; a \<notin> A; b \<notin> B\<rbrakk> \<Longrightarrow> insert a A \<approx> insert b B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<approx> B; a \<notin> A; b \<notin> B\<rbrakk> \<Longrightarrow> insert a A \<approx> insert b B
[PROOF STEP]
apply (rule lepoll_antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>A \<approx> B; a \<notin> A; b \<notin> B\<rbrakk> \<Longrightarrow> insert a A \<lesssim> insert b B
 2. \<lbrakk>A \<approx> B; a \<notin> A; b \<notin> B\<rbrakk> \<Longrightarrow> insert b B \<lesssim> insert a A
[PROOF STEP]
apply (simp add: eqpoll_imp_lepoll insert_lepoll_cong)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<approx> B; a \<notin> A; b \<notin> B\<rbrakk> \<Longrightarrow> insert b B \<lesssim> insert a A
[PROOF STEP]
by (meson eqpoll_imp_lepoll eqpoll_sym insert_lepoll_cong)


[STATEMENT]
theorem Translations_transformation_group:
  "transformation_group (translation ` G) G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transformation_group (translation ` G) G
[PROOF STEP]
proof unfold_locales
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. translation ` G \<subseteq> transformation.Sym
 2. \<And>a b. \<lbrakk>a \<in> translation ` G; b \<in> translation ` G\<rbrakk> \<Longrightarrow> compose G a b \<in> translation ` G
 3. identity G \<in> translation ` G
 4. \<And>u. u \<in> translation ` G \<Longrightarrow> transformation.sub.invertible u
[PROOF STEP]
show "(translation ` G) \<subseteq> transformation.Sym"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. translation ` G \<subseteq> transformation.Sym
[PROOF STEP]
unfolding transformation.Units_bijective
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. translation ` G \<subseteq> {\<alpha> \<in> G \<rightarrow>\<^sub>E G. bij_betw \<alpha> G G}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
translation ` G \<subseteq> transformation.Sym

goal (3 subgoals):
 1. \<And>a b. \<lbrakk>a \<in> translation ` G; b \<in> translation ` G\<rbrakk> \<Longrightarrow> compose G a b \<in> translation ` G
 2. identity G \<in> translation ` G
 3. \<And>u. u \<in> translation ` G \<Longrightarrow> transformation.sub.invertible u
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>a b. \<lbrakk>a \<in> translation ` G; b \<in> translation ` G\<rbrakk> \<Longrightarrow> compose G a b \<in> translation ` G
 2. identity G \<in> translation ` G
 3. \<And>u. u \<in> translation ` G \<Longrightarrow> transformation.sub.invertible u
[PROOF STEP]
fix \<alpha>
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>a b. \<lbrakk>a \<in> translation ` G; b \<in> translation ` G\<rbrakk> \<Longrightarrow> compose G a b \<in> translation ` G
 2. identity G \<in> translation ` G
 3. \<And>u. u \<in> translation ` G \<Longrightarrow> transformation.sub.invertible u
[PROOF STEP]
assume \<alpha>: "\<alpha> \<in> translation ` G"
[PROOF STATE]
proof (state)
this:
\<alpha> \<in> translation ` G

goal (3 subgoals):
 1. \<And>a b. \<lbrakk>a \<in> translation ` G; b \<in> translation ` G\<rbrakk> \<Longrightarrow> compose G a b \<in> translation ` G
 2. identity G \<in> translation ` G
 3. \<And>u. u \<in> translation ` G \<Longrightarrow> transformation.sub.invertible u
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<alpha> \<in> translation ` G
[PROOF STEP]
obtain a where a: "a \<in> G" and eq: "\<alpha> = (a)\<^sub>L"
[PROOF STATE]
proof (prove)
using this:
\<alpha> \<in> translation ` G

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> G; \<alpha> = (a)\<^sub>L\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
a \<in> G
\<alpha> = (a)\<^sub>L

goal (3 subgoals):
 1. \<And>a b. \<lbrakk>a \<in> translation ` G; b \<in> translation ` G\<rbrakk> \<Longrightarrow> compose G a b \<in> translation ` G
 2. identity G \<in> translation ` G
 3. \<And>u. u \<in> translation ` G \<Longrightarrow> transformation.sub.invertible u
[PROOF STEP]
with translation_invertible
[PROOF STATE]
proof (chain)
picking this:
?a \<in> G \<Longrightarrow> transformation.sub.invertible (?a)\<^sub>L
a \<in> G
\<alpha> = (a)\<^sub>L
[PROOF STEP]
show "transformation.sub.invertible \<alpha>"
[PROOF STATE]
proof (prove)
using this:
?a \<in> G \<Longrightarrow> transformation.sub.invertible (?a)\<^sub>L
a \<in> G
\<alpha> = (a)\<^sub>L

goal (1 subgoal):
 1. transformation.sub.invertible \<alpha>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
transformation.sub.invertible \<alpha>

goal (2 subgoals):
 1. \<And>a b. \<lbrakk>a \<in> translation ` G; b \<in> translation ` G\<rbrakk> \<Longrightarrow> compose G a b \<in> translation ` G
 2. identity G \<in> translation ` G
[PROOF STEP]
qed auto


[STATEMENT]
lemma has_contour_integral_linepath_Reals_iff:
  fixes a b :: complex and f :: "complex \<Rightarrow> complex"
  assumes "a \<in> Reals" "b \<in> Reals" "Re a < Re b"
  shows   "(f has_contour_integral I) (linepath a b) \<longleftrightarrow>
             ((\<lambda>x. f (of_real x)) has_integral I) {Re a..Re b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_contour_integral I) (linepath a b) = ((\<lambda>x. f (complex_of_real x)) has_integral I) {Re a..Re b}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f has_contour_integral I) (linepath a b) = ((\<lambda>x. f (complex_of_real x)) has_integral I) {Re a..Re b}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
a \<in> \<real>
b \<in> \<real>
Re a < Re b
[PROOF STEP]
have [simp]: "of_real (Re a) = a" "of_real (Re b) = b"
[PROOF STATE]
proof (prove)
using this:
a \<in> \<real>
b \<in> \<real>
Re a < Re b

goal (1 subgoal):
 1. complex_of_real (Re a) = a &&& complex_of_real (Re b) = b
[PROOF STEP]
by (simp_all add: complex_eq_iff)
[PROOF STATE]
proof (state)
this:
complex_of_real (Re a) = a
complex_of_real (Re b) = b

goal (1 subgoal):
 1. (f has_contour_integral I) (linepath a b) = ((\<lambda>x. f (complex_of_real x)) has_integral I) {Re a..Re b}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
a \<in> \<real>
b \<in> \<real>
Re a < Re b
[PROOF STEP]
have "a \<noteq> b"
[PROOF STATE]
proof (prove)
using this:
a \<in> \<real>
b \<in> \<real>
Re a < Re b

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

goal (1 subgoal):
 1. (f has_contour_integral I) (linepath a b) = ((\<lambda>x. f (complex_of_real x)) has_integral I) {Re a..Re b}
[PROOF STEP]
have "((\<lambda>x. f (of_real x)) has_integral I) (cbox (Re a) (Re b)) \<longleftrightarrow>
          ((\<lambda>x. f (a + b * of_real x - a * of_real x)) has_integral I /\<^sub>R (Re b - Re a)) {0..1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (complex_of_real x)) has_integral I) (cbox (Re a) (Re b)) = ((\<lambda>x. f (a + b * complex_of_real x - a * complex_of_real x)) has_integral I /\<^sub>R (Re b - Re a)) {0..1}
[PROOF STEP]
by (subst has_integral_affinity_iff [of "Re b - Re a" _ "Re a", symmetric])
       (insert assms, simp_all add: field_simps scaleR_conv_of_real)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (complex_of_real x)) has_integral I) (cbox (Re a) (Re b)) = ((\<lambda>x. f (a + b * complex_of_real x - a * complex_of_real x)) has_integral I /\<^sub>R (Re b - Re a)) {0..1}

goal (1 subgoal):
 1. (f has_contour_integral I) (linepath a b) = ((\<lambda>x. f (complex_of_real x)) has_integral I) {Re a..Re b}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (complex_of_real x)) has_integral I) (cbox (Re a) (Re b)) = ((\<lambda>x. f (a + b * complex_of_real x - a * complex_of_real x)) has_integral I /\<^sub>R (Re b - Re a)) {0..1}

goal (1 subgoal):
 1. (f has_contour_integral I) (linepath a b) = ((\<lambda>x. f (complex_of_real x)) has_integral I) {Re a..Re b}
[PROOF STEP]
have "(\<lambda>x. f (a + b * of_real x - a * of_real x)) =
               (\<lambda>x. (f (a + b * of_real x - a * of_real x) * (b - a)) /\<^sub>R (Re b - Re a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f (a + b * complex_of_real x - a * complex_of_real x)) = (\<lambda>x. f (a + b * complex_of_real x - a * complex_of_real x) * (b - a) /\<^sub>R (Re b - Re a))
[PROOF STEP]
using \<open>a \<noteq> b\<close>
[PROOF STATE]
proof (prove)
using this:
a \<noteq> b

goal (1 subgoal):
 1. (\<lambda>x. f (a + b * complex_of_real x - a * complex_of_real x)) = (\<lambda>x. f (a + b * complex_of_real x - a * complex_of_real x) * (b - a) /\<^sub>R (Re b - Re a))
[PROOF STEP]
by (auto simp: field_simps fun_eq_iff scaleR_conv_of_real)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f (a + b * complex_of_real x - a * complex_of_real x)) = (\<lambda>x. f (a + b * complex_of_real x - a * complex_of_real x) * (b - a) /\<^sub>R (Re b - Re a))

goal (1 subgoal):
 1. (f has_contour_integral I) (linepath a b) = ((\<lambda>x. f (complex_of_real x)) has_integral I) {Re a..Re b}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f (a + b * complex_of_real x - a * complex_of_real x)) = (\<lambda>x. f (a + b * complex_of_real x - a * complex_of_real x) * (b - a) /\<^sub>R (Re b - Re a))

goal (1 subgoal):
 1. (f has_contour_integral I) (linepath a b) = ((\<lambda>x. f (complex_of_real x)) has_integral I) {Re a..Re b}
[PROOF STEP]
have "(\<dots> has_integral I /\<^sub>R (Re b - Re a)) {0..1} \<longleftrightarrow>
               ((\<lambda>x. f (linepath a b x) * (b - a)) has_integral I) {0..1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (a + b * complex_of_real x - a * complex_of_real x) * (b - a) /\<^sub>R (Re b - Re a)) has_integral I /\<^sub>R (Re b - Re a)) {0..1} = ((\<lambda>x. f (linepath a b x) * (b - a)) has_integral I) {0..1}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> \<real>
b \<in> \<real>
Re a < Re b

goal (1 subgoal):
 1. ((\<lambda>x. f (a + b * complex_of_real x - a * complex_of_real x) * (b - a) /\<^sub>R (Re b - Re a)) has_integral I /\<^sub>R (Re b - Re a)) {0..1} = ((\<lambda>x. f (linepath a b x) * (b - a)) has_integral I) {0..1}
[PROOF STEP]
by (subst has_integral_cmul_iff) (auto simp: linepath_def scaleR_conv_of_real algebra_simps)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (a + b * complex_of_real x - a * complex_of_real x) * (b - a) /\<^sub>R (Re b - Re a)) has_integral I /\<^sub>R (Re b - Re a)) {0..1} = ((\<lambda>x. f (linepath a b x) * (b - a)) has_integral I) {0..1}

goal (1 subgoal):
 1. (f has_contour_integral I) (linepath a b) = ((\<lambda>x. f (complex_of_real x)) has_integral I) {Re a..Re b}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (a + b * complex_of_real x - a * complex_of_real x) * (b - a) /\<^sub>R (Re b - Re a)) has_integral I /\<^sub>R (Re b - Re a)) {0..1} = ((\<lambda>x. f (linepath a b x) * (b - a)) has_integral I) {0..1}

goal (1 subgoal):
 1. (f has_contour_integral I) (linepath a b) = ((\<lambda>x. f (complex_of_real x)) has_integral I) {Re a..Re b}
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (f has_contour_integral I) (linepath a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (linepath a b x) * (b - a)) has_integral I) {0..1} = (f has_contour_integral I) (linepath a b)
[PROOF STEP]
unfolding has_contour_integral_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. f (linepath a b x) * (b - a)) has_integral I) {0..1} = ((\<lambda>x. f (linepath a b x) * vector_derivative (linepath a b) (at x within {0..1})) has_integral I) {0..1}
[PROOF STEP]
by (intro has_integral_cong) (simp add: vector_derivative_linepath_within)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f (linepath a b x) * (b - a)) has_integral I) {0..1} = (f has_contour_integral I) (linepath a b)

goal (1 subgoal):
 1. (f has_contour_integral I) (linepath a b) = ((\<lambda>x. f (complex_of_real x)) has_integral I) {Re a..Re b}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. f (complex_of_real x)) has_integral I) (cbox (Re a) (Re b)) = (f has_contour_integral I) (linepath a b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. f (complex_of_real x)) has_integral I) (cbox (Re a) (Re b)) = (f has_contour_integral I) (linepath a b)

goal (1 subgoal):
 1. (f has_contour_integral I) (linepath a b) = ((\<lambda>x. f (complex_of_real x)) has_integral I) {Re a..Re b}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(f has_contour_integral I) (linepath a b) = ((\<lambda>x. f (complex_of_real x)) has_integral I) {Re a..Re b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fps_power_first:
  fixes a :: "'a::comm_semiring_1 fps"
  shows "(a^n) $ 1 = of_nat n * (a$0)^(n-1) * a$1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a ^ n $ 1 = of_nat n * (a $ 0) ^ (n - 1) * a $ 1
[PROOF STEP]
proof (cases n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> a ^ n $ 1 = of_nat n * (a $ 0) ^ (n - 1) * a $ 1
 2. \<And>nat. n = Suc nat \<Longrightarrow> a ^ n $ 1 = of_nat n * (a $ 0) ^ (n - 1) * a $ 1
[PROOF STEP]
case (Suc m)
[PROOF STATE]
proof (state)
this:
n = Suc m

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> a ^ n $ 1 = of_nat n * (a $ 0) ^ (n - 1) * a $ 1
 2. \<And>nat. n = Suc nat \<Longrightarrow> a ^ n $ 1 = of_nat n * (a $ 0) ^ (n - 1) * a $ 1
[PROOF STEP]
have "(a ^ Suc m) $ 1 = of_nat (Suc m) * (a$0)^(Suc m - 1) * a$1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a ^ Suc m $ 1 = of_nat (Suc m) * (a $ 0) ^ (Suc m - 1) * a $ 1
[PROOF STEP]
proof (induct m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a ^ Suc 0 $ 1 = of_nat (Suc 0) * (a $ 0) ^ (Suc 0 - 1) * a $ 1
 2. \<And>m. a ^ Suc m $ 1 = of_nat (Suc m) * (a $ 0) ^ (Suc m - 1) * a $ 1 \<Longrightarrow> a ^ Suc (Suc m) $ 1 = of_nat (Suc (Suc m)) * (a $ 0) ^ (Suc (Suc m) - 1) * a $ 1
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
a ^ Suc k $ 1 = of_nat (Suc k) * (a $ 0) ^ (Suc k - 1) * a $ 1

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

goal (1 subgoal):
 1. a ^ Suc (Suc k) $ 1 = a $ 0 * of_nat (Suc k) * (a $ 0) ^ k * a $ 1 + a $ 1 * (a $ 0) ^ Suc k
[PROOF STEP]
using fps_mult_nth_1[of a]
[PROOF STATE]
proof (prove)
using this:
a ^ Suc k $ 1 = of_nat (Suc k) * (a $ 0) ^ (Suc k - 1) * a $ 1
(a * ?g) $ 1 = a $ 0 * ?g $ 1 + a $ 1 * ?g $ 0

goal (1 subgoal):
 1. a ^ Suc (Suc k) $ 1 = a $ 0 * of_nat (Suc k) * (a $ 0) ^ k * a $ 1 + a $ 1 * (a $ 0) ^ Suc k
[PROOF STEP]
by (simp add: fps_power_zeroth[symmetric] mult.assoc)
[PROOF STATE]
proof (state)
this:
a ^ Suc (Suc k) $ 1 = a $ 0 * of_nat (Suc k) * (a $ 0) ^ k * a $ 1 + a $ 1 * (a $ 0) ^ Suc k

goal (2 subgoals):
 1. a ^ Suc 0 $ 1 = of_nat (Suc 0) * (a $ 0) ^ (Suc 0 - 1) * a $ 1
 2. \<And>m. a ^ Suc m $ 1 = of_nat (Suc m) * (a $ 0) ^ (Suc m - 1) * a $ 1 \<Longrightarrow> a ^ Suc (Suc m) $ 1 = of_nat (Suc (Suc m)) * (a $ 0) ^ (Suc (Suc m) - 1) * a $ 1
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
a ^ Suc (Suc k) $ 1 = a $ 0 * of_nat (Suc k) * (a $ 0) ^ k * a $ 1 + a $ 1 * (a $ 0) ^ Suc k

goal (1 subgoal):
 1. a ^ Suc (Suc k) $ 1 = of_nat (Suc (Suc k)) * (a $ 0) ^ (Suc (Suc k) - 1) * a $ 1
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
a ^ Suc (Suc k) $ 1 = of_nat (Suc (Suc k)) * (a $ 0) ^ (Suc (Suc k) - 1) * a $ 1

goal (1 subgoal):
 1. a ^ Suc 0 $ 1 = of_nat (Suc 0) * (a $ 0) ^ (Suc 0 - 1) * a $ 1
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
a ^ Suc m $ 1 = of_nat (Suc m) * (a $ 0) ^ (Suc m - 1) * a $ 1

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> a ^ n $ 1 = of_nat n * (a $ 0) ^ (n - 1) * a $ 1
 2. \<And>nat. n = Suc nat \<Longrightarrow> a ^ n $ 1 = of_nat n * (a $ 0) ^ (n - 1) * a $ 1
[PROOF STEP]
with Suc
[PROOF STATE]
proof (chain)
picking this:
n = Suc m
a ^ Suc m $ 1 = of_nat (Suc m) * (a $ 0) ^ (Suc m - 1) * a $ 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n = Suc m
a ^ Suc m $ 1 = of_nat (Suc m) * (a $ 0) ^ (Suc m - 1) * a $ 1

goal (1 subgoal):
 1. a ^ n $ 1 = of_nat n * (a $ 0) ^ (n - 1) * a $ 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a ^ n $ 1 = of_nat n * (a $ 0) ^ (n - 1) * a $ 1

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> a ^ n $ 1 = of_nat n * (a $ 0) ^ (n - 1) * a $ 1
[PROOF STEP]
qed simp


[STATEMENT]
lemma reducible_polyI:
  fixes p :: "'a :: field poly"
  assumes "p = q * r" "degree q > 0" "degree r > 0"
  shows   "\<not>irreducible p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> irreducible p
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p = q * r
0 < degree q
0 < degree r

goal (1 subgoal):
 1. \<not> irreducible p
[PROOF STEP]
by (auto simp: irreducible_def)


[STATEMENT]
lemma lrange_split_req:
  assumes "sorted_less xs"
  shows "lrange_split l xs = lrange_filter l xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lrange_split l xs = lrange_filter l xs
[PROOF STEP]
unfolding lrange_split_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case split_list xs l of (ls, rs) \<Rightarrow> rs) = lrange_filter l xs
[PROOF STEP]
using lrange_filter_split[of xs l] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>sorted_less xs; split_list xs l = (?ls, ?rs)\<rbrakk> \<Longrightarrow> lrange_list l xs = ?rs
sorted_less xs

goal (1 subgoal):
 1. (case split_list xs l of (ls, rs) \<Rightarrow> rs) = lrange_filter l xs
[PROOF STEP]
using sorted_less_lrange
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>sorted_less xs; split_list xs l = (?ls, ?rs)\<rbrakk> \<Longrightarrow> lrange_list l xs = ?rs
sorted_less xs
sorted_less ?xs \<Longrightarrow> lrange_list ?l ?xs = lrange_filter ?l ?xs

goal (1 subgoal):
 1. (case split_list xs l of (ls, rs) \<Rightarrow> rs) = lrange_filter l xs
[PROOF STEP]
by (simp split!: prod.splits)


[STATEMENT]
lemma open_Times: "open S \<Longrightarrow> open T \<Longrightarrow> open (S \<times> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>open S; open T\<rbrakk> \<Longrightarrow> open (S \<times> T)
[PROOF STEP]
unfolding open_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>open S; open T\<rbrakk> \<Longrightarrow> \<forall>x\<in>S \<times> T. \<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S \<times> T
[PROOF STEP]
by auto


[STATEMENT]
lemma non_empty_set_has_least:
  "S \<subseteq> T \<Longrightarrow> S \<noteq> {} \<Longrightarrow> least S \<in> S \<and> (\<forall> y \<in> S. least S \<noteq> y \<longrightarrow> \<not> y \<prec> least S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<subseteq> T; S \<noteq> {}\<rbrakk> \<Longrightarrow> least S \<in> S \<and> (\<forall>y\<in>S. least S \<noteq> y \<longrightarrow> \<not> y \<prec> least S)
[PROOF STEP]
proof goal_cases
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>S \<subseteq> T; S \<noteq> {}\<rbrakk> \<Longrightarrow> least S \<in> S \<and> (\<forall>y\<in>S. least S \<noteq> y \<longrightarrow> \<not> y \<prec> least S)
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
S \<subseteq> T
S \<noteq> {}

goal (1 subgoal):
 1. \<lbrakk>S \<subseteq> T; S \<noteq> {}\<rbrakk> \<Longrightarrow> least S \<in> S \<and> (\<forall>y\<in>S. least S \<noteq> y \<longrightarrow> \<not> y \<prec> least S)
[PROOF STEP]
note A = this
[PROOF STATE]
proof (state)
this:
S \<subseteq> T
S \<noteq> {}

goal (1 subgoal):
 1. \<lbrakk>S \<subseteq> T; S \<noteq> {}\<rbrakk> \<Longrightarrow> least S \<in> S \<and> (\<forall>y\<in>S. least S \<noteq> y \<longrightarrow> \<not> y \<prec> least S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. least S \<in> S \<and> (\<forall>y\<in>S. least S \<noteq> y \<longrightarrow> \<not> y \<prec> least S)
[PROOF STEP]
proof (rule theI', goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>!y. y \<in> S \<and> (\<forall>ya\<in>S. y \<noteq> ya \<longrightarrow> \<not> ya \<prec> y)
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:

goal (1 subgoal):
 1. \<exists>!y. y \<in> S \<and> (\<forall>ya\<in>S. y \<noteq> ya \<longrightarrow> \<not> ya \<prec> y)
[PROOF STEP]
from non_empty_set_has_least''[OF A]
[PROOF STATE]
proof (chain)
picking this:
\<exists>!x. x \<in> S \<and> (\<forall>y\<in>S. x \<noteq> y \<longrightarrow> \<not> y \<prec> x)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<exists>!x. x \<in> S \<and> (\<forall>y\<in>S. x \<noteq> y \<longrightarrow> \<not> y \<prec> x)

goal (1 subgoal):
 1. \<exists>!y. y \<in> S \<and> (\<forall>ya\<in>S. y \<noteq> ya \<longrightarrow> \<not> ya \<prec> y)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<exists>!y. y \<in> S \<and> (\<forall>ya\<in>S. y \<noteq> ya \<longrightarrow> \<not> ya \<prec> y)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
least S \<in> S \<and> (\<forall>y\<in>S. least S \<noteq> y \<longrightarrow> \<not> y \<prec> least S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma not_CONS_self: "N \<in> list(A) \<Longrightarrow> \<forall>M. N \<noteq> CONS M N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. N \<in> list A \<Longrightarrow> \<forall>M. N \<noteq> CONS M N
[PROOF STEP]
apply (erule list.induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>M. NIL \<noteq> CONS M NIL
 2. \<And>a M. \<lbrakk>a \<in> A; M \<in> list A; \<forall>Ma. M \<noteq> CONS Ma M\<rbrakk> \<Longrightarrow> \<forall>Ma. CONS a M \<noteq> CONS Ma (CONS a M)
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma len_nonFinals_makeFaceFinal:
 "\<lbrakk> \<not> final f; f \<in> \<F> g\<rbrakk>
  \<Longrightarrow> |nonFinals (makeFaceFinal f g)| = |nonFinals g| - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> final f; f \<in> \<F> g\<rbrakk> \<Longrightarrow> |nonFinals (makeFaceFinal f g)| = |nonFinals g| - 1
[PROOF STEP]
by(simp add:makeFaceFinal_def nonFinals_def makeFaceFinalFaceList_def
            length_filter_replace2)


[STATEMENT]
lemma numsub_nb: "numbound0 t \<Longrightarrow> numbound0 s \<Longrightarrow> numbound0 (numsub t s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>numbound0 t; numbound0 s\<rbrakk> \<Longrightarrow> numbound0 (numsub t s)
[PROOF STEP]
using numsub_def numadd_nb numneg_nb
[PROOF STATE]
proof (prove)
using this:
numsub ?s ?t = (if ?s = ?t then C 0 else numadd ?s (numneg ?t))
\<lbrakk>numbound0 ?t; numbound0 ?s\<rbrakk> \<Longrightarrow> numbound0 (numadd ?t ?s)
numbound0 ?t \<Longrightarrow> numbound0 (numneg ?t)

goal (1 subgoal):
 1. \<lbrakk>numbound0 t; numbound0 s\<rbrakk> \<Longrightarrow> numbound0 (numsub t s)
[PROOF STEP]
by simp


[STATEMENT]
lemma sum_upto_inverse_bound:
  "sum_upto (\<lambda>i. 1 / real i) x \<ge> 0"
  "eventually (\<lambda>x. sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> sum_upto (\<lambda>i. 1 / real i) x &&& \<forall>\<^sub>F x in at_top. sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> sum_upto (\<lambda>i. 1 / real i) x
 2. \<forall>\<^sub>F x in at_top. sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22
[PROOF STEP]
show "sum_upto (\<lambda>i. 1 / real i) x \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> sum_upto (\<lambda>i. 1 / real i) x
[PROOF STEP]
by (simp add: sum_upto_def sum_nonneg)
[PROOF STATE]
proof (state)
this:
0 \<le> sum_upto (\<lambda>i. 1 / real i) x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22
[PROOF STEP]
from order_tendstoD(2)[OF euler_mascheroni_LIMSEQ euler_mascheroni_less_13_over_22]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in sequentially. harm x - ln (real x) < 13 / 22
[PROOF STEP]
obtain N where N: "\<And>n. n \<ge> N \<Longrightarrow> harm n - ln (real n) < 13 / 22"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in sequentially. harm x - ln (real x) < 13 / 22

goal (1 subgoal):
 1. (\<And>N. (\<And>n. N \<le> n \<Longrightarrow> harm n - ln (real n) < 13 / 22) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding eventually_at_top_linorder
[PROOF STATE]
proof (prove)
using this:
\<exists>N. \<forall>n\<ge>N. harm n - ln (real n) < 13 / 22

goal (1 subgoal):
 1. (\<And>N. (\<And>n. N \<le> n \<Longrightarrow> harm n - ln (real n) < 13 / 22) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
N \<le> ?n \<Longrightarrow> harm ?n - ln (real ?n) < 13 / 22

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22
[PROOF STEP]
show "eventually (\<lambda>x. sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22
[PROOF STEP]
using eventually_ge_at_top[of "max (real N) 1"]
[PROOF STATE]
proof (prove)
using this:
eventually ((\<le>) (max (real N) 1)) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. max (real N) 1 \<le> x \<Longrightarrow> sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22
[PROOF STEP]
case (elim x)
[PROOF STATE]
proof (state)
this:
max (real N) 1 \<le> x

goal (1 subgoal):
 1. \<And>x. max (real N) 1 \<le> x \<Longrightarrow> sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22
[PROOF STEP]
have "sum_upto (\<lambda>i. 1 / real i) x = (\<Sum>i\<in>{0<..nat \<lfloor>x\<rfloor>}. 1 / real i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>i. 1 / real i) x = (\<Sum>i\<in>{0<..nat \<lfloor>x\<rfloor>}. 1 / real i)
[PROOF STEP]
by (simp add: sum_upto_altdef)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>i. 1 / real i) x = (\<Sum>i\<in>{0<..nat \<lfloor>x\<rfloor>}. 1 / real i)

goal (1 subgoal):
 1. \<And>x. max (real N) 1 \<le> x \<Longrightarrow> sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>i. 1 / real i) x = (\<Sum>i\<in>{0<..nat \<lfloor>x\<rfloor>}. 1 / real i)

goal (1 subgoal):
 1. \<And>x. max (real N) 1 \<le> x \<Longrightarrow> sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22
[PROOF STEP]
have "\<dots> = harm (nat \<lfloor>x\<rfloor>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{0<..nat \<lfloor>x\<rfloor>}. 1 / real i) = harm (nat \<lfloor>x\<rfloor>)
[PROOF STEP]
unfolding harm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{0<..nat \<lfloor>x\<rfloor>}. 1 / real i) = (\<Sum>k = 1..nat \<lfloor>x\<rfloor>. inverse (real k))
[PROOF STEP]
by (intro sum.cong refl) (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{0<..nat \<lfloor>x\<rfloor>}. 1 / real i) = harm (nat \<lfloor>x\<rfloor>)

goal (1 subgoal):
 1. \<And>x. max (real N) 1 \<le> x \<Longrightarrow> sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{0<..nat \<lfloor>x\<rfloor>}. 1 / real i) = harm (nat \<lfloor>x\<rfloor>)

goal (1 subgoal):
 1. \<And>x. max (real N) 1 \<le> x \<Longrightarrow> sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22
[PROOF STEP]
have "\<dots> \<le> ln (real (nat \<lfloor>x\<rfloor>)) + 13 / 22"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. harm (nat \<lfloor>x\<rfloor>) \<le> ln (real (nat \<lfloor>x\<rfloor>)) + 13 / 22
[PROOF STEP]
using N[of "nat \<lfloor>x\<rfloor>"] elim
[PROOF STATE]
proof (prove)
using this:
N \<le> nat \<lfloor>x\<rfloor> \<Longrightarrow> harm (nat \<lfloor>x\<rfloor>) - ln (real (nat \<lfloor>x\<rfloor>)) < 13 / 22
max (real N) 1 \<le> x

goal (1 subgoal):
 1. harm (nat \<lfloor>x\<rfloor>) \<le> ln (real (nat \<lfloor>x\<rfloor>)) + 13 / 22
[PROOF STEP]
by (auto simp: le_nat_iff le_floor_iff)
[PROOF STATE]
proof (state)
this:
harm (nat \<lfloor>x\<rfloor>) \<le> ln (real (nat \<lfloor>x\<rfloor>)) + 13 / 22

goal (1 subgoal):
 1. \<And>x. max (real N) 1 \<le> x \<Longrightarrow> sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
harm (nat \<lfloor>x\<rfloor>) \<le> ln (real (nat \<lfloor>x\<rfloor>)) + 13 / 22

goal (1 subgoal):
 1. \<And>x. max (real N) 1 \<le> x \<Longrightarrow> sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22
[PROOF STEP]
have "ln (real (nat \<lfloor>x\<rfloor>)) \<le> ln x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (real (nat \<lfloor>x\<rfloor>)) \<le> ln x
[PROOF STEP]
using elim
[PROOF STATE]
proof (prove)
using this:
max (real N) 1 \<le> x

goal (1 subgoal):
 1. ln (real (nat \<lfloor>x\<rfloor>)) \<le> ln x
[PROOF STEP]
by (subst ln_le_cancel_iff) auto
[PROOF STATE]
proof (state)
this:
ln (real (nat \<lfloor>x\<rfloor>)) \<le> ln x

goal (1 subgoal):
 1. \<And>x. max (real N) 1 \<le> x \<Longrightarrow> sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x \<le> y \<Longrightarrow> x + 13 / 22 \<le> y + 13 / 22) \<Longrightarrow> sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> x + 13 / 22 \<le> y + 13 / 22) \<Longrightarrow> sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22

goal (1 subgoal):
 1. sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22
[PROOF STEP]
by - simp
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. sum_upto (\<lambda>i. 1 / real i) x \<le> ln x + 13 / 22

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma qfN_square_prime:
  assumes ass:
  "prime (p^2+N*q^2::int) \<and> N>1 \<and> (p^2+N*q^2)^2 = r^2+N*s^2 \<and> coprime r s"
  shows "\<bar>r\<bar> = \<bar>p^2-N*q^2\<bar> \<and> \<bar>s\<bar> = \<bar>2*p*q\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
let ?P = "p^2 + N*q^2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
let ?A = "r^2 + N*s^2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
from ass
[PROOF STATE]
proof (chain)
picking this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2)\<^sup>2 = r\<^sup>2 + N * s\<^sup>2 \<and> coprime r s
[PROOF STEP]
have P1: "?P > 1"
[PROOF STATE]
proof (prove)
using this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2)\<^sup>2 = r\<^sup>2 + N * s\<^sup>2 \<and> coprime r s

goal (1 subgoal):
 1. 1 < p\<^sup>2 + N * q\<^sup>2
[PROOF STEP]
by (simp add: prime_int_iff)
[PROOF STATE]
proof (state)
this:
1 < p\<^sup>2 + N * q\<^sup>2

goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
from ass
[PROOF STATE]
proof (chain)
picking this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2)\<^sup>2 = r\<^sup>2 + N * s\<^sup>2 \<and> coprime r s
[PROOF STEP]
have APP: "?A = ?P*?P"
[PROOF STATE]
proof (prove)
using this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2)\<^sup>2 = r\<^sup>2 + N * s\<^sup>2 \<and> coprime r s

goal (1 subgoal):
 1. r\<^sup>2 + N * s\<^sup>2 = (p\<^sup>2 + N * q\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2)
[PROOF STEP]
by (simp only: power2_eq_square)
[PROOF STATE]
proof (state)
this:
r\<^sup>2 + N * s\<^sup>2 = (p\<^sup>2 + N * q\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2)

goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
with ass
[PROOF STATE]
proof (chain)
picking this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2)\<^sup>2 = r\<^sup>2 + N * s\<^sup>2 \<and> coprime r s
r\<^sup>2 + N * s\<^sup>2 = (p\<^sup>2 + N * q\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2)
[PROOF STEP]
have "prime ?P \<and> ?P dvd ?A"
[PROOF STATE]
proof (prove)
using this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2)\<^sup>2 = r\<^sup>2 + N * s\<^sup>2 \<and> coprime r s
r\<^sup>2 + N * s\<^sup>2 = (p\<^sup>2 + N * q\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2)

goal (1 subgoal):
 1. prime (p\<^sup>2 + N * q\<^sup>2) \<and> p\<^sup>2 + N * q\<^sup>2 dvd r\<^sup>2 + N * s\<^sup>2
[PROOF STEP]
by (simp add: dvdI)
[PROOF STATE]
proof (state)
this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> p\<^sup>2 + N * q\<^sup>2 dvd r\<^sup>2 + N * s\<^sup>2

goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> p\<^sup>2 + N * q\<^sup>2 dvd r\<^sup>2 + N * s\<^sup>2
[PROOF STEP]
obtain u v e where uve:
    "?A = (u^2+N*v^2)*?P \<and> r = p*u+e*N*q*v \<and> s = p*v - e*q*u \<and> \<bar>e\<bar>=1"
[PROOF STATE]
proof (prove)
using this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> p\<^sup>2 + N * q\<^sup>2 dvd r\<^sup>2 + N * s\<^sup>2

goal (1 subgoal):
 1. (\<And>u v e. r\<^sup>2 + N * s\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> r = p * u + e * N * q * v \<and> s = p * v - e * q * u \<and> \<bar>e\<bar> = 1 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (frule_tac p="p" in qfN_div_prime, auto)
[PROOF STATE]
proof (state)
this:
r\<^sup>2 + N * s\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> r = p * u + e * N * q * v \<and> s = p * v - e * q * u \<and> \<bar>e\<bar> = 1

goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
with APP P1 ass
[PROOF STATE]
proof (chain)
picking this:
r\<^sup>2 + N * s\<^sup>2 = (p\<^sup>2 + N * q\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2)
1 < p\<^sup>2 + N * q\<^sup>2
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2)\<^sup>2 = r\<^sup>2 + N * s\<^sup>2 \<and> coprime r s
r\<^sup>2 + N * s\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> r = p * u + e * N * q * v \<and> s = p * v - e * q * u \<and> \<bar>e\<bar> = 1
[PROOF STEP]
have "prime (u^2+N*v^2) \<and> N>1 \<and> u^2 + N*v^2 = ?P"
[PROOF STATE]
proof (prove)
using this:
r\<^sup>2 + N * s\<^sup>2 = (p\<^sup>2 + N * q\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2)
1 < p\<^sup>2 + N * q\<^sup>2
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2)\<^sup>2 = r\<^sup>2 + N * s\<^sup>2 \<and> coprime r s
r\<^sup>2 + N * s\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> r = p * u + e * N * q * v \<and> s = p * v - e * q * u \<and> \<bar>e\<bar> = 1

goal (1 subgoal):
 1. prime (u\<^sup>2 + N * v\<^sup>2) \<and> 1 < N \<and> u\<^sup>2 + N * v\<^sup>2 = p\<^sup>2 + N * q\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prime (u\<^sup>2 + N * v\<^sup>2) \<and> 1 < N \<and> u\<^sup>2 + N * v\<^sup>2 = p\<^sup>2 + N * q\<^sup>2

goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
hence "\<bar>u\<bar> = \<bar>p\<bar> \<and> \<bar>v\<bar> = \<bar>q\<bar>"
[PROOF STATE]
proof (prove)
using this:
prime (u\<^sup>2 + N * v\<^sup>2) \<and> 1 < N \<and> u\<^sup>2 + N * v\<^sup>2 = p\<^sup>2 + N * q\<^sup>2

goal (1 subgoal):
 1. \<bar>u\<bar> = \<bar>p\<bar> \<and> \<bar>v\<bar> = \<bar>q\<bar>
[PROOF STEP]
by (auto dest: qfN_prime_unique)
[PROOF STATE]
proof (state)
this:
\<bar>u\<bar> = \<bar>p\<bar> \<and> \<bar>v\<bar> = \<bar>q\<bar>

goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<bar>u\<bar> = \<bar>p\<bar> \<and> \<bar>v\<bar> = \<bar>q\<bar>
[PROOF STEP]
obtain f g where f: "u = f*p \<and> \<bar>f\<bar> = 1" and g: "v = g*q \<and> \<bar>g\<bar> = 1"
[PROOF STATE]
proof (prove)
using this:
\<bar>u\<bar> = \<bar>p\<bar> \<and> \<bar>v\<bar> = \<bar>q\<bar>

goal (1 subgoal):
 1. (\<And>f g. \<lbrakk>u = f * p \<and> \<bar>f\<bar> = 1; v = g * q \<and> \<bar>g\<bar> = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (blast dest: abs_eq_impl_unitfactor)
[PROOF STATE]
proof (state)
this:
u = f * p \<and> \<bar>f\<bar> = 1
v = g * q \<and> \<bar>g\<bar> = 1

goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
with uve
[PROOF STATE]
proof (chain)
picking this:
r\<^sup>2 + N * s\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> r = p * u + e * N * q * v \<and> s = p * v - e * q * u \<and> \<bar>e\<bar> = 1
u = f * p \<and> \<bar>f\<bar> = 1
v = g * q \<and> \<bar>g\<bar> = 1
[PROOF STEP]
have "r = f*p*p + (e*g)*N*q*q \<and> s = g*p*q - (e*f)*p*q"
[PROOF STATE]
proof (prove)
using this:
r\<^sup>2 + N * s\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> r = p * u + e * N * q * v \<and> s = p * v - e * q * u \<and> \<bar>e\<bar> = 1
u = f * p \<and> \<bar>f\<bar> = 1
v = g * q \<and> \<bar>g\<bar> = 1

goal (1 subgoal):
 1. r = f * p * p + e * g * N * q * q \<and> s = g * p * q - e * f * p * q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
r = f * p * p + e * g * N * q * q \<and> s = g * p * q - e * f * p * q

goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
hence rs: "r = f*p^2 + (e*g)*N*q^2 \<and> s = (g - e*f)*p*q"
[PROOF STATE]
proof (prove)
using this:
r = f * p * p + e * g * N * q * q \<and> s = g * p * q - e * f * p * q

goal (1 subgoal):
 1. r = f * p\<^sup>2 + e * g * N * q\<^sup>2 \<and> s = (g - e * f) * p * q
[PROOF STEP]
by (auto simp only: power2_eq_square left_diff_distrib)
[PROOF STATE]
proof (state)
this:
r = f * p\<^sup>2 + e * g * N * q\<^sup>2 \<and> s = (g - e * f) * p * q

goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
r = f * p\<^sup>2 + e * g * N * q\<^sup>2 \<and> s = (g - e * f) * p * q

goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
have "s \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s \<noteq> 0
[PROOF STEP]
proof (rule ccontr, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. s = 0 \<Longrightarrow> False
[PROOF STEP]
assume s0: "s=0"
[PROOF STATE]
proof (state)
this:
s = 0

goal (1 subgoal):
 1. s = 0 \<Longrightarrow> False
[PROOF STEP]
hence "gcd r s = \<bar>r\<bar>"
[PROOF STATE]
proof (prove)
using this:
s = 0

goal (1 subgoal):
 1. gcd r s = \<bar>r\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
gcd r s = \<bar>r\<bar>

goal (1 subgoal):
 1. s = 0 \<Longrightarrow> False
[PROOF STEP]
with ass
[PROOF STATE]
proof (chain)
picking this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2)\<^sup>2 = r\<^sup>2 + N * s\<^sup>2 \<and> coprime r s
gcd r s = \<bar>r\<bar>
[PROOF STEP]
have "\<bar>r\<bar> = 1"
[PROOF STATE]
proof (prove)
using this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2)\<^sup>2 = r\<^sup>2 + N * s\<^sup>2 \<and> coprime r s
gcd r s = \<bar>r\<bar>

goal (1 subgoal):
 1. \<bar>r\<bar> = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>r\<bar> = 1

goal (1 subgoal):
 1. s = 0 \<Longrightarrow> False
[PROOF STEP]
hence "r^2 = 1"
[PROOF STATE]
proof (prove)
using this:
\<bar>r\<bar> = 1

goal (1 subgoal):
 1. r\<^sup>2 = 1
[PROOF STEP]
by (auto simp add: power2_eq_1_iff)
[PROOF STATE]
proof (state)
this:
r\<^sup>2 = 1

goal (1 subgoal):
 1. s = 0 \<Longrightarrow> False
[PROOF STEP]
with s0
[PROOF STATE]
proof (chain)
picking this:
s = 0
r\<^sup>2 = 1
[PROOF STEP]
have "?A = 1"
[PROOF STATE]
proof (prove)
using this:
s = 0
r\<^sup>2 = 1

goal (1 subgoal):
 1. r\<^sup>2 + N * s\<^sup>2 = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
r\<^sup>2 + N * s\<^sup>2 = 1

goal (1 subgoal):
 1. s = 0 \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
r\<^sup>2 + N * s\<^sup>2 = 1

goal (1 subgoal):
 1. s = 0 \<Longrightarrow> False
[PROOF STEP]
have "?P^2 > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < (p\<^sup>2 + N * q\<^sup>2)\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 < (p\<^sup>2 + N * q\<^sup>2)\<^sup>2
[PROOF STEP]
from P1
[PROOF STATE]
proof (chain)
picking this:
1 < p\<^sup>2 + N * q\<^sup>2
[PROOF STEP]
have "1 < ?P \<and> (0::int) \<le>  1 \<and> (0::nat) < 2"
[PROOF STATE]
proof (prove)
using this:
1 < p\<^sup>2 + N * q\<^sup>2

goal (1 subgoal):
 1. 1 < p\<^sup>2 + N * q\<^sup>2 \<and> 0 \<le> 1 \<and> 0 < 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 < p\<^sup>2 + N * q\<^sup>2 \<and> 0 \<le> 1 \<and> 0 < 2

goal (1 subgoal):
 1. 1 < (p\<^sup>2 + N * q\<^sup>2)\<^sup>2
[PROOF STEP]
hence "?P^2 > 1^2"
[PROOF STATE]
proof (prove)
using this:
1 < p\<^sup>2 + N * q\<^sup>2 \<and> 0 \<le> 1 \<and> 0 < 2

goal (1 subgoal):
 1. 1\<^sup>2 < (p\<^sup>2 + N * q\<^sup>2)\<^sup>2
[PROOF STEP]
by (simp only: power_strict_mono)
[PROOF STATE]
proof (state)
this:
1\<^sup>2 < (p\<^sup>2 + N * q\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. 1 < (p\<^sup>2 + N * q\<^sup>2)\<^sup>2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
1\<^sup>2 < (p\<^sup>2 + N * q\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. 1 < (p\<^sup>2 + N * q\<^sup>2)\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 < (p\<^sup>2 + N * q\<^sup>2)\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
1 < (p\<^sup>2 + N * q\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. s = 0 \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
1 < (p\<^sup>2 + N * q\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. s = 0 \<Longrightarrow> False
[PROOF STEP]
from ass
[PROOF STATE]
proof (chain)
picking this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2)\<^sup>2 = r\<^sup>2 + N * s\<^sup>2 \<and> coprime r s
[PROOF STEP]
have "?A = ?P^2"
[PROOF STATE]
proof (prove)
using this:
prime (p\<^sup>2 + N * q\<^sup>2) \<and> 1 < N \<and> (p\<^sup>2 + N * q\<^sup>2)\<^sup>2 = r\<^sup>2 + N * s\<^sup>2 \<and> coprime r s

goal (1 subgoal):
 1. r\<^sup>2 + N * s\<^sup>2 = (p\<^sup>2 + N * q\<^sup>2)\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
r\<^sup>2 + N * s\<^sup>2 = (p\<^sup>2 + N * q\<^sup>2)\<^sup>2

goal (1 subgoal):
 1. s = 0 \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
r\<^sup>2 + N * s\<^sup>2 = 1
1 < (p\<^sup>2 + N * q\<^sup>2)\<^sup>2
r\<^sup>2 + N * s\<^sup>2 = (p\<^sup>2 + N * q\<^sup>2)\<^sup>2
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
r\<^sup>2 + N * s\<^sup>2 = 1
1 < (p\<^sup>2 + N * q\<^sup>2)\<^sup>2
r\<^sup>2 + N * s\<^sup>2 = (p\<^sup>2 + N * q\<^sup>2)\<^sup>2

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
s \<noteq> 0

goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
r = f * p\<^sup>2 + e * g * N * q\<^sup>2 \<and> s = (g - e * f) * p * q
s \<noteq> 0
[PROOF STEP]
have "g \<noteq> e*f"
[PROOF STATE]
proof (prove)
using this:
r = f * p\<^sup>2 + e * g * N * q\<^sup>2 \<and> s = (g - e * f) * p * q
s \<noteq> 0

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

goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
g \<noteq> e * f

goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
from f g uve
[PROOF STATE]
proof (chain)
picking this:
u = f * p \<and> \<bar>f\<bar> = 1
v = g * q \<and> \<bar>g\<bar> = 1
r\<^sup>2 + N * s\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> r = p * u + e * N * q * v \<and> s = p * v - e * q * u \<and> \<bar>e\<bar> = 1
[PROOF STEP]
have "\<bar>g\<bar> = \<bar>e*f\<bar>"
[PROOF STATE]
proof (prove)
using this:
u = f * p \<and> \<bar>f\<bar> = 1
v = g * q \<and> \<bar>g\<bar> = 1
r\<^sup>2 + N * s\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> r = p * u + e * N * q * v \<and> s = p * v - e * q * u \<and> \<bar>e\<bar> = 1

goal (1 subgoal):
 1. \<bar>g\<bar> = \<bar>e * f\<bar>
[PROOF STEP]
unfolding abs_mult
[PROOF STATE]
proof (prove)
using this:
u = f * p \<and> \<bar>f\<bar> = 1
v = g * q \<and> \<bar>g\<bar> = 1
r\<^sup>2 + N * s\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> r = p * u + e * N * q * v \<and> s = p * v - e * q * u \<and> \<bar>e\<bar> = 1

goal (1 subgoal):
 1. \<bar>g\<bar> = \<bar>e\<bar> * \<bar>f\<bar>
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
\<bar>g\<bar> = \<bar>e * f\<bar>

goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
g \<noteq> e * f
\<bar>g\<bar> = \<bar>e * f\<bar>
[PROOF STEP]
have gef: "g = -(e*f)"
[PROOF STATE]
proof (prove)
using this:
g \<noteq> e * f
\<bar>g\<bar> = \<bar>e * f\<bar>

goal (1 subgoal):
 1. g = - (e * f)
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
g = - (e * f)

goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
from uve
[PROOF STATE]
proof (chain)
picking this:
r\<^sup>2 + N * s\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> r = p * u + e * N * q * v \<and> s = p * v - e * q * u \<and> \<bar>e\<bar> = 1
[PROOF STEP]
have "e * - (e * f) = - f"
[PROOF STATE]
proof (prove)
using this:
r\<^sup>2 + N * s\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> r = p * u + e * N * q * v \<and> s = p * v - e * q * u \<and> \<bar>e\<bar> = 1

goal (1 subgoal):
 1. e * - (e * f) = - f
[PROOF STEP]
using abs_mult_self_eq [of e]
[PROOF STATE]
proof (prove)
using this:
r\<^sup>2 + N * s\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> r = p * u + e * N * q * v \<and> s = p * v - e * q * u \<and> \<bar>e\<bar> = 1
\<bar>e\<bar> * \<bar>e\<bar> = e * e

goal (1 subgoal):
 1. e * - (e * f) = - f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
e * - (e * f) = - f

goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
hence "r = f*(p^2 - N*q^2) \<and> s = (-e*f)*2*p*q"
[PROOF STATE]
proof (prove)
using this:
e * - (e * f) = - f

goal (1 subgoal):
 1. r = f * (p\<^sup>2 - N * q\<^sup>2) \<and> s = - e * f * 2 * p * q
[PROOF STEP]
using rs gef
[PROOF STATE]
proof (prove)
using this:
e * - (e * f) = - f
r = f * p\<^sup>2 + e * g * N * q\<^sup>2 \<and> s = (g - e * f) * p * q
g = - (e * f)

goal (1 subgoal):
 1. r = f * (p\<^sup>2 - N * q\<^sup>2) \<and> s = - e * f * 2 * p * q
[PROOF STEP]
unfolding right_diff_distrib
[PROOF STATE]
proof (prove)
using this:
e * - (e * f) = - f
r = f * p\<^sup>2 + e * g * N * q\<^sup>2 \<and> s = (g - e * f) * p * q
g = - (e * f)

goal (1 subgoal):
 1. r = f * p\<^sup>2 - f * (N * q\<^sup>2) \<and> s = - e * f * 2 * p * q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
r = f * (p\<^sup>2 - N * q\<^sup>2) \<and> s = - e * f * 2 * p * q

goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
hence "\<bar>r\<bar> = \<bar>f\<bar> * \<bar>p^2-N*q^2\<bar>
    \<and> \<bar>s\<bar> = \<bar>e\<bar>*\<bar>f\<bar>*\<bar>2*p*q\<bar>"
[PROOF STATE]
proof (prove)
using this:
r = f * (p\<^sup>2 - N * q\<^sup>2) \<and> s = - e * f * 2 * p * q

goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>f\<bar> * \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>e\<bar> * \<bar>f\<bar> * \<bar>2 * p * q\<bar>
[PROOF STEP]
by (auto simp add: abs_mult)
[PROOF STATE]
proof (state)
this:
\<bar>r\<bar> = \<bar>f\<bar> * \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>e\<bar> * \<bar>f\<bar> * \<bar>2 * p * q\<bar>

goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
with uve f g
[PROOF STATE]
proof (chain)
picking this:
r\<^sup>2 + N * s\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> r = p * u + e * N * q * v \<and> s = p * v - e * q * u \<and> \<bar>e\<bar> = 1
u = f * p \<and> \<bar>f\<bar> = 1
v = g * q \<and> \<bar>g\<bar> = 1
\<bar>r\<bar> = \<bar>f\<bar> * \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>e\<bar> * \<bar>f\<bar> * \<bar>2 * p * q\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
r\<^sup>2 + N * s\<^sup>2 = (u\<^sup>2 + N * v\<^sup>2) * (p\<^sup>2 + N * q\<^sup>2) \<and> r = p * u + e * N * q * v \<and> s = p * v - e * q * u \<and> \<bar>e\<bar> = 1
u = f * p \<and> \<bar>f\<bar> = 1
v = g * q \<and> \<bar>g\<bar> = 1
\<bar>r\<bar> = \<bar>f\<bar> * \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>e\<bar> * \<bar>f\<bar> * \<bar>2 * p * q\<bar>

goal (1 subgoal):
 1. \<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>
[PROOF STEP]
by (auto simp only: mult_1_left)
[PROOF STATE]
proof (state)
this:
\<bar>r\<bar> = \<bar>p\<^sup>2 - N * q\<^sup>2\<bar> \<and> \<bar>s\<bar> = \<bar>2 * p * q\<bar>

goal:
No subgoals!
[PROOF STEP]
qed