[STATEMENT]
lemma generator_exists:
  assumes "prime (p::nat)" "p > 2"
  shows "\<exists> g. [g \<noteq> 1] (mod p) \<and> (\<forall> x. (0<x \<and> x < p )\<longrightarrow> (\<exists> i. [g^i = x] (mod p)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>g. [g \<noteq> 1] (mod p) \<and> (\<forall>x. 0 < x \<and> x < p \<longrightarrow> (\<exists>i. [g ^ i = x] (mod p)))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>g. [g \<noteq> 1] (mod p) \<and> (\<forall>x. 0 < x \<and> x < p \<longrightarrow> (\<exists>i. [g ^ i = x] (mod p)))
[PROOF STEP]
obtain g where g_prim_root:"residue_primroot p g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. residue_primroot p g \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms prime_gt_1_nat prime_primitive_root_exists
[PROOF STATE]
proof (prove)
using this:
prime p
2 < p
prime ?p \<Longrightarrow> 1 < ?p
\<lbrakk>1 < ?n; prime ?n\<rbrakk> \<Longrightarrow> \<exists>x. residue_primroot ?n x

goal (1 subgoal):
 1. (\<And>g. residue_primroot p g \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis One_nat_def)
[PROOF STATE]
proof (state)
this:
residue_primroot p g

goal (1 subgoal):
 1. \<exists>g. [g \<noteq> 1] (mod p) \<and> (\<forall>x. 0 < x \<and> x < p \<longrightarrow> (\<exists>i. [g ^ i = x] (mod p)))
[PROOF STEP]
have g_not_1: "[g \<noteq> 1] (mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [g \<noteq> 1] (mod p)
[PROOF STEP]
using residue_primroot_not_cong_1 assms g_prim_root
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>residue_primroot ?n ?g; 2 < ?n\<rbrakk> \<Longrightarrow> [?g \<noteq> 1] (mod ?n)
prime p
2 < p
residue_primroot p g

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

goal (1 subgoal):
 1. \<exists>g. [g \<noteq> 1] (mod p) \<and> (\<forall>x. 0 < x \<and> x < p \<longrightarrow> (\<exists>i. [g ^ i = x] (mod p)))
[PROOF STEP]
have "\<exists>i. [g ^ i = x] (mod p)" if x_bounds: "x > 0" "x < p" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i. [g ^ i = x] (mod p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>i. [g ^ i = x] (mod p)
[PROOF STEP]
have 1:"coprime p x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime p x
[PROOF STEP]
using assms prime_nat_iff'' x_bounds
[PROOF STATE]
proof (prove)
using this:
prime p
2 < p
prime ?p = (?p \<noteq> 0 \<and> ?p \<noteq> 1 \<and> (\<forall>m. 0 < m \<and> m < ?p \<longrightarrow> coprime ?p m))
0 < x
x < p

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

goal (1 subgoal):
 1. \<exists>i. [g ^ i = x] (mod p)
[PROOF STEP]
have 2:"ord p g = p-1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord p g = p - 1
[PROOF STEP]
by (metis assms(1) g_prim_root residue_primroot_def totient_prime)
[PROOF STATE]
proof (state)
this:
ord p g = p - 1

goal (1 subgoal):
 1. \<exists>i. [g ^ i = x] (mod p)
[PROOF STEP]
hence bij: "bij_betw (\<lambda>i. g ^ i mod p) {..<totient p} (totatives p)"
[PROOF STATE]
proof (prove)
using this:
ord p g = p - 1

goal (1 subgoal):
 1. bij_betw (\<lambda>i. g ^ i mod p) {..<totient p} (totatives p)
[PROOF STEP]
using residue_primroot_is_generator[of p g] totatives_def[of p]
          1 totient_def[of p] assms g_prim_root prime_gt_1_nat
[PROOF STATE]
proof (prove)
using this:
ord p g = p - 1
\<lbrakk>1 < p; residue_primroot p g\<rbrakk> \<Longrightarrow> bij_betw (\<lambda>i. g ^ i mod p) {..<totient p} (totatives p)
totatives p = {k \<in> {0<..p}. coprime k p}
coprime p x
totient p = card (totatives p)
prime p
2 < p
residue_primroot p g
prime ?p \<Longrightarrow> 1 < ?p

goal (1 subgoal):
 1. bij_betw (\<lambda>i. g ^ i mod p) {..<totient p} (totatives p)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
bij_betw (\<lambda>i. g ^ i mod p) {..<totient p} (totatives p)

goal (1 subgoal):
 1. \<exists>i. [g ^ i = x] (mod p)
[PROOF STEP]
have 3:"x mod p \<in> totatives p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x mod p \<in> totatives p
[PROOF STEP]
by (simp add: "1" coprime_commute in_totatives_iff order_le_less x_bounds)
[PROOF STATE]
proof (state)
this:
x mod p \<in> totatives p

goal (1 subgoal):
 1. \<exists>i. [g ^ i = x] (mod p)
[PROOF STEP]
have " {..<totient p} \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {..<totient p} \<noteq> {}
[PROOF STEP]
by (metis assms(1) lessThan_empty_iff prime_nat_iff'' totient_0_iff)
[PROOF STATE]
proof (state)
this:
{..<totient p} \<noteq> {}

goal (1 subgoal):
 1. \<exists>i. [g ^ i = x] (mod p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{..<totient p} \<noteq> {}
[PROOF STEP]
obtain i where "g^i mod p = x mod p"
[PROOF STATE]
proof (prove)
using this:
{..<totient p} \<noteq> {}

goal (1 subgoal):
 1. (\<And>i. g ^ i mod p = x mod p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using bij_betw_inv[of "(\<lambda>i. g ^ i mod p)" "{..<totient p}" "(totatives p)"]
      3 bij
[PROOF STATE]
proof (prove)
using this:
{..<totient p} \<noteq> {}
bij_betw (\<lambda>i. g ^ i mod p) {..<totient p} (totatives p) \<Longrightarrow> \<exists>g. bij_betw g (totatives p) {..<totient p}
x mod p \<in> totatives p
bij_betw (\<lambda>i. g ^ i mod p) {..<totient p} (totatives p)

goal (1 subgoal):
 1. (\<And>i. g ^ i mod p = x mod p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis (no_types, lifting) bij_betw_iff_bijections)
[PROOF STATE]
proof (state)
this:
g ^ i mod p = x mod p

goal (1 subgoal):
 1. \<exists>i. [g ^ i = x] (mod p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g ^ i mod p = x mod p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
g ^ i mod p = x mod p

goal (1 subgoal):
 1. \<exists>i. [g ^ i = x] (mod p)
[PROOF STEP]
using cong_def
[PROOF STATE]
proof (prove)
using this:
g ^ i mod p = x mod p
[?b = ?c] (mod ?a) = (?b mod ?a = ?c mod ?a)

goal (1 subgoal):
 1. \<exists>i. [g ^ i = x] (mod p)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>i. [g ^ i = x] (mod p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < ?x; ?x < p\<rbrakk> \<Longrightarrow> \<exists>i. [g ^ i = ?x] (mod p)

goal (1 subgoal):
 1. \<exists>g. [g \<noteq> 1] (mod p) \<and> (\<forall>x. 0 < x \<and> x < p \<longrightarrow> (\<exists>i. [g ^ i = x] (mod p)))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?x; ?x < p\<rbrakk> \<Longrightarrow> \<exists>i. [g ^ i = ?x] (mod p)

goal (1 subgoal):
 1. \<exists>g. [g \<noteq> 1] (mod p) \<and> (\<forall>x. 0 < x \<and> x < p \<longrightarrow> (\<exists>i. [g ^ i = x] (mod p)))
[PROOF STEP]
using g_prim_root g_not_1
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?x; ?x < p\<rbrakk> \<Longrightarrow> \<exists>i. [g ^ i = ?x] (mod p)
residue_primroot p g
[g \<noteq> 1] (mod p)

goal (1 subgoal):
 1. \<exists>g. [g \<noteq> 1] (mod p) \<and> (\<forall>x. 0 < x \<and> x < p \<longrightarrow> (\<exists>i. [g ^ i = x] (mod p)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>g. [g \<noteq> 1] (mod p) \<and> (\<forall>x. 0 < x \<and> x < p \<longrightarrow> (\<exists>i. [g ^ i = x] (mod p)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma l2product_ladd:
   "\<lbrakk>f square_integrable S; g square_integrable S; h square_integrable S\<rbrakk>
    \<Longrightarrow> l2product S (\<lambda>x. f x + g x) h = l2product S f h + l2product S g h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f square_integrable S; g square_integrable S; h square_integrable S\<rbrakk> \<Longrightarrow> l2product S (\<lambda>x. f x + g x) h = l2product S f h + l2product S g h
[PROOF STEP]
by (simp add: l2product_def algebra_simps square_integrable_imp_integrable_product)


[STATEMENT]
lemma contour_integral_part_circlepath_reverse:
  "contour_integral (part_circlepath c r a b) f = -contour_integral (part_circlepath c r b a) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (part_circlepath c r a b) f = - contour_integral (part_circlepath c r b a) f
[PROOF STEP]
by (subst reversepath_part_circlepath [symmetric], subst contour_integral_reversepath) simp_all


[STATEMENT]
lemma imult_iless_mono1: "\<lbrakk> (i::enat) < j; 0 < k; k \<noteq> \<infinity> \<rbrakk> \<Longrightarrow> i * k \<le> j * k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < j; 0 < k; k \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> i * k \<le> j * k
[PROOF STEP]
by (case_tac i, case_tac j, case_tac k, simp_all)


[STATEMENT]
lemma construct_NofI_prop:
  fixes p:: "real poly"
  fixes I:: "real poly list"
  assumes nonzero: "p\<noteq>0"
  shows "construct_NofI p I =
    rat_of_int (int (card {x. poly p x = 0 \<and> poly (prod_list I) x > 0}) -
    int (card {x. poly p x = 0 \<and> poly (prod_list I) x < 0}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. construct_NofI p I = rat_of_int (int (card {x. poly p x = 0 \<and> 0 < poly (prod_list I) x}) - int (card {x. poly p x = 0 \<and> poly (prod_list I) x < 0}))
[PROOF STEP]
unfolding construct_NofI_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_of_int (changes_R_smods p (pderiv p * prod_list I)) = rat_of_int (int (card {x. poly p x = 0 \<and> 0 < poly (prod_list I) x}) - int (card {x. poly p x = 0 \<and> poly (prod_list I) x < 0}))
[PROOF STEP]
using assms restate_tarski2 nonzero rsquarefree_def
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
?p \<noteq> 0 \<Longrightarrow> changes_R_smods ?p (pderiv ?p * ?q) = int (card {x. poly ?p x = 0 \<and> 0 < poly ?q x}) - int (card {x. poly ?p x = 0 \<and> poly ?q x < 0})
p \<noteq> 0
rsquarefree ?p = (?p \<noteq> 0 \<and> (\<forall>a. Polynomial.order a ?p = 0 \<or> Polynomial.order a ?p = 1))

goal (1 subgoal):
 1. rat_of_int (changes_R_smods p (pderiv p * prod_list I)) = rat_of_int (int (card {x. poly p x = 0 \<and> 0 < poly (prod_list I) x}) - int (card {x. poly p x = 0 \<and> poly (prod_list I) x < 0}))
[PROOF STEP]
by (simp add: rsquarefree_def)


[STATEMENT]
lemma four:  "4 \<times> x = x \<squnion> x \<squnion> x \<squnion> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 \<times> x = x \<squnion> x \<squnion> x \<squnion> x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 4 \<times> x = x \<squnion> x \<squnion> x \<squnion> x
[PROOF STEP]
have       "4 = Suc(Suc(Suc(Suc(0))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 = Suc (Suc (Suc (Suc 0)))
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
4 = Suc (Suc (Suc (Suc 0)))

goal (1 subgoal):
 1. 4 \<times> x = x \<squnion> x \<squnion> x \<squnion> x
[PROOF STEP]
hence      "4 \<times> x = Suc(Suc(Suc(Suc(0)))) \<times> x"
[PROOF STATE]
proof (prove)
using this:
4 = Suc (Suc (Suc (Suc 0)))

goal (1 subgoal):
 1. 4 \<times> x = Suc (Suc (Suc (Suc 0))) \<times> x
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
4 \<times> x = Suc (Suc (Suc (Suc 0))) \<times> x

goal (1 subgoal):
 1. 4 \<times> x = x \<squnion> x \<squnion> x \<squnion> x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
4 \<times> x = Suc (Suc (Suc (Suc 0))) \<times> x

goal (1 subgoal):
 1. 4 \<times> x = x \<squnion> x \<squnion> x \<squnion> x
[PROOF STEP]
have  "\<dots> = x \<squnion> x \<squnion> x \<squnion> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (Suc (Suc (Suc 0))) \<times> x = x \<squnion> x \<squnion> x \<squnion> x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Suc (Suc (Suc (Suc 0))) \<times> x = x \<squnion> x \<squnion> x \<squnion> x

goal (1 subgoal):
 1. 4 \<times> x = x \<squnion> x \<squnion> x \<squnion> x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
4 \<times> x = x \<squnion> x \<squnion> x \<squnion> x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
4 \<times> x = x \<squnion> x \<squnion> x \<squnion> x

goal (1 subgoal):
 1. 4 \<times> x = x \<squnion> x \<squnion> x \<squnion> x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
4 \<times> x = x \<squnion> x \<squnion> x \<squnion> x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma simply_connected_inside_simple_path:
  fixes p :: "real \<Rightarrow> complex"
  shows "simple_path p \<Longrightarrow> simply_connected(inside(path_image p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simple_path p \<Longrightarrow> simply_connected (inside (path_image p))
[PROOF STEP]
using Jordan_inside_outside connected_simple_path_image inside_simple_curve_imp_closed simply_connected_eq_frontier_properties
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>simple_path ?c; pathfinish ?c = pathstart ?c\<rbrakk> \<Longrightarrow> inside (path_image ?c) \<noteq> {} \<and> open (inside (path_image ?c)) \<and> connected (inside (path_image ?c)) \<and> outside (path_image ?c) \<noteq> {} \<and> open (outside (path_image ?c)) \<and> connected (outside (path_image ?c)) \<and> bounded (inside (path_image ?c)) \<and> \<not> bounded (outside (path_image ?c)) \<and> inside (path_image ?c) \<inter> outside (path_image ?c) = {} \<and> inside (path_image ?c) \<union> outside (path_image ?c) = - path_image ?c \<and> frontier (inside (path_image ?c)) = path_image ?c \<and> frontier (outside (path_image ?c)) = path_image ?c
simple_path ?g \<Longrightarrow> connected (path_image ?g)
\<lbrakk>simple_path ?\<gamma>; ?x \<in> inside (path_image ?\<gamma>)\<rbrakk> \<Longrightarrow> pathfinish ?\<gamma> = pathstart ?\<gamma>
open ?S \<Longrightarrow> simply_connected ?S = (connected ?S \<and> (if bounded ?S then connected (frontier ?S) else \<forall>C\<in>components (frontier ?S). \<not> bounded C))

goal (1 subgoal):
 1. simple_path p \<Longrightarrow> simply_connected (inside (path_image p))
[PROOF STEP]
by fastforce


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


[STATEMENT]
lemma zero_spaceN_diff:
  assumes "x \<in> zero_space\<^sub>N N" "y \<in> zero_space\<^sub>N N"
  shows "x - y \<in> zero_space\<^sub>N N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - y \<in> zero_space\<^sub>N N
[PROOF STEP]
using zero_spaceN_add[OF assms(1) zero_spaceN_cmult[OF assms(2), of "-1"]]
[PROOF STATE]
proof (prove)
using this:
x + - 1 *\<^sub>R y \<in> zero_space\<^sub>N N

goal (1 subgoal):
 1. x - y \<in> zero_space\<^sub>N N
[PROOF STEP]
by auto


[STATEMENT]
theorem nth_solution_inj: "inj nth_solution"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj nth_solution
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; nth_solution x = nth_solution y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix m n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; nth_solution x = nth_solution y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume "nth_solution m = nth_solution n"
[PROOF STATE]
proof (state)
this:
nth_solution m = nth_solution n

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; nth_solution x = nth_solution y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
hence "pell_valuation (nth_solution m) = pell_valuation (nth_solution n)"
[PROOF STATE]
proof (prove)
using this:
nth_solution m = nth_solution n

goal (1 subgoal):
 1. pell_valuation (case nth_solution m of (x, y) \<Rightarrow> (int x, int y)) = pell_valuation (case nth_solution n of (x, y) \<Rightarrow> (int x, int y))
[PROOF STEP]
by (simp only: )
[PROOF STATE]
proof (state)
this:
pell_valuation (case nth_solution m of (x, y) \<Rightarrow> (int x, int y)) = pell_valuation (case nth_solution n of (x, y) \<Rightarrow> (int x, int y))

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; nth_solution x = nth_solution y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pell_valuation (case nth_solution m of (x, y) \<Rightarrow> (int x, int y)) = pell_valuation (case nth_solution n of (x, y) \<Rightarrow> (int x, int y))

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; nth_solution x = nth_solution y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have "pell_valuation (nth_solution m) = pell_valuation fund_sol ^ m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pell_valuation (case nth_solution m of (x, y) \<Rightarrow> (int x, int y)) = pell_valuation (case fund_sol of (x, y) \<Rightarrow> (int x, int y)) ^ m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pell_valuation (case nth_solution m of (x, y) \<Rightarrow> (int x, int y)) = pell_valuation (case fund_sol of (x, y) \<Rightarrow> (int x, int y)) ^ m

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; nth_solution x = nth_solution y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pell_valuation (case nth_solution m of (x, y) \<Rightarrow> (int x, int y)) = pell_valuation (case fund_sol of (x, y) \<Rightarrow> (int x, int y)) ^ m

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; nth_solution x = nth_solution y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have "pell_valuation (nth_solution n) = pell_valuation fund_sol ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pell_valuation (case nth_solution n of (x, y) \<Rightarrow> (int x, int y)) = pell_valuation (case fund_sol of (x, y) \<Rightarrow> (int x, int y)) ^ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pell_valuation (case nth_solution n of (x, y) \<Rightarrow> (int x, int y)) = pell_valuation (case fund_sol of (x, y) \<Rightarrow> (int x, int y)) ^ n

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; nth_solution x = nth_solution y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
pell_valuation (case fund_sol of (x, y) \<Rightarrow> (int x, int y)) ^ m = pell_valuation (case fund_sol of (x, y) \<Rightarrow> (int x, int y)) ^ n
[PROOF STEP]
show "m = n"
[PROOF STATE]
proof (prove)
using this:
pell_valuation (case fund_sol of (x, y) \<Rightarrow> (int x, int y)) ^ m = pell_valuation (case fund_sol of (x, y) \<Rightarrow> (int x, int y)) ^ n

goal (1 subgoal):
 1. m = n
[PROOF STEP]
using pell_valuation_fund_sol_ge_2
[PROOF STATE]
proof (prove)
using this:
pell_valuation (case fund_sol of (x, y) \<Rightarrow> (int x, int y)) ^ m = pell_valuation (case fund_sol of (x, y) \<Rightarrow> (int x, int y)) ^ n
2 \<le> pell_valuation (case fund_sol of (x, y) \<Rightarrow> (int x, int y))

goal (1 subgoal):
 1. m = n
[PROOF STEP]
by (subst (asm) power_inject_exp) auto
[PROOF STATE]
proof (state)
this:
m = n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prod_topology_discrete_topology:
     "discrete_topology (S \<times> T) = prod_topology (discrete_topology S) (discrete_topology T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. discrete_topology (S \<times> T) = prod_topology (discrete_topology S) (discrete_topology T)
[PROOF STEP]
by (auto simp: discrete_topology_unique openin_prod_topology intro: arbitrary_union_of_inc)


[STATEMENT]
lemma not_finite_univ: "~ finite (UNIV::nat set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite UNIV
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite UNIV \<Longrightarrow> False
[PROOF STEP]
apply(drule_tac natset_finite_max)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (Max UNIV) \<notin> UNIV \<Longrightarrow> False
[PROOF STEP]
by force

  \<comment> \<open>FIXME should be in main lib\<close>


[STATEMENT]
lemma ldrop_ltake: "ldrop n (ltake m xs) = ltake (m - n) (ldrop n xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ldrop n (ltake m xs) = ltake (m - n) (ldrop n xs)
[PROOF STEP]
by(induct xs arbitrary: n m)(simp_all add: ltake_LCons ldrop_LCons split: co.enat.split)


[STATEMENT]
lemma multiplicity_eq_nat:
  fixes x and y::nat
  assumes "x > 0" "y > 0" "\<And>p. prime p \<Longrightarrow> multiplicity p x = multiplicity p y"
  shows "x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
using multiplicity_eq_imp_eq[of x y] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x \<noteq> 0; y \<noteq> 0; \<And>p. prime p \<Longrightarrow> multiplicity p x = multiplicity p y\<rbrakk> \<Longrightarrow> normalize x = normalize y
0 < x
0 < y
prime ?p \<Longrightarrow> multiplicity ?p x = multiplicity ?p y

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


[STATEMENT]
lemma NSLIMSEQ_diff: "X \<longlonglongrightarrow>\<^sub>N\<^sub>S a \<Longrightarrow> Y \<longlonglongrightarrow>\<^sub>N\<^sub>S b \<Longrightarrow> (\<lambda>n. X n - Y n) \<longlonglongrightarrow>\<^sub>N\<^sub>S a - b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X \<longlonglongrightarrow>\<^sub>N\<^sub>S a; Y \<longlonglongrightarrow>\<^sub>N\<^sub>S b\<rbrakk> \<Longrightarrow> (\<lambda>n. X n - Y n) \<longlonglongrightarrow>\<^sub>N\<^sub>S a - b
[PROOF STEP]
using NSLIMSEQ_add [of X a "- Y" "- b"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>X \<longlonglongrightarrow>\<^sub>N\<^sub>S a; - Y \<longlonglongrightarrow>\<^sub>N\<^sub>S - b\<rbrakk> \<Longrightarrow> (\<lambda>n. X n + (- Y) n) \<longlonglongrightarrow>\<^sub>N\<^sub>S a + - b

goal (1 subgoal):
 1. \<lbrakk>X \<longlonglongrightarrow>\<^sub>N\<^sub>S a; Y \<longlonglongrightarrow>\<^sub>N\<^sub>S b\<rbrakk> \<Longrightarrow> (\<lambda>n. X n - Y n) \<longlonglongrightarrow>\<^sub>N\<^sub>S a - b
[PROOF STEP]
by (simp add: NSLIMSEQ_minus fun_Compl_def)


[STATEMENT]
lemma lm075:
  "\<Union> (finestpart ` XX) \<supseteq> finestpart (\<Union> XX)"
  (is "?L \<supseteq> ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finestpart (\<Union> XX) \<subseteq> \<Union> (finestpart ` XX)
[PROOF STEP]
unfolding finestpart_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. {x}) ` \<Union> XX \<subseteq> \<Union> ((`) (\<lambda>x. {x}) ` XX)
[PROOF STEP]
using finestpart_def
[PROOF STATE]
proof (prove)
using this:
finestpart ?X = (\<lambda>x. {x}) ` ?X

goal (1 subgoal):
 1. (\<lambda>x. {x}) ` \<Union> XX \<subseteq> \<Union> ((`) (\<lambda>x. {x}) ` XX)
[PROOF STEP]
by auto


[STATEMENT]
lemma realpow_pos_nth_unique: "0 < n \<Longrightarrow> 0 < a \<Longrightarrow> \<exists>!r. 0 < r \<and> r ^ n = a" for a :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; 0 < a\<rbrakk> \<Longrightarrow> \<exists>!r. 0 < r \<and> r ^ n = a
[PROOF STEP]
by (auto intro!: realpow_pos_nth simp: power_eq_iff_eq_base)


[STATEMENT]
theorem "order tetrahedral_group = 12"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order tetrahedral_group = 12
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. order tetrahedral_group = 12
[PROOF STEP]
have "card (tetrahedral.orbit A) * card (tetrahedral.stabiliser A) = 12"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (tetrahedral.orbit A) * card (tetrahedral.stabiliser A) = 12
[PROOF STEP]
using card_stabiliser card_orbit
[PROOF STATE]
proof (prove)
using this:
card (tetrahedral.stabiliser A) = 3
card (tetrahedral.orbit A) = 4

goal (1 subgoal):
 1. card (tetrahedral.orbit A) * card (tetrahedral.stabiliser A) = 12
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (tetrahedral.orbit A) * card (tetrahedral.stabiliser A) = 12

goal (1 subgoal):
 1. order tetrahedral_group = 12
[PROOF STEP]
with tetrahedral.orbit_stabiliser[OF finite_carrier]
[PROOF STATE]
proof (chain)
picking this:
order tetrahedral_group = card (tetrahedral.orbit ?x) * card (tetrahedral.stabiliser ?x)
card (tetrahedral.orbit A) * card (tetrahedral.stabiliser A) = 12
[PROOF STEP]
show "order tetrahedral_group = 12"
[PROOF STATE]
proof (prove)
using this:
order tetrahedral_group = card (tetrahedral.orbit ?x) * card (tetrahedral.stabiliser ?x)
card (tetrahedral.orbit A) * card (tetrahedral.stabiliser A) = 12

goal (1 subgoal):
 1. order tetrahedral_group = 12
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
order tetrahedral_group = 12

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fInf_subdistl:
  fixes f :: "'a::complete_lattice \<Rightarrow> 'b::complete_lattice"
  shows  "mono f \<Longrightarrow> (\<circ>) f \<circ> Inf \<le> Inf \<circ> (`) ((\<circ>) f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono f \<Longrightarrow> (\<circ>) f \<circ> Inf \<le> Inf \<circ> (`) ((\<circ>) f)
[PROOF STEP]
by (simp add: INF_greatest Inf_lower le_fun_def monoD image_comp)


[STATEMENT]
lemma card_product_dependent:
  assumes "finite S"
  assumes "\<forall>x \<in> S. finite (T x)"
  shows "card {(x, y). x \<in> S \<and> y \<in> T x} = (\<Sum>x \<in> S. card (T x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {(x, y). x \<in> S \<and> y \<in> T x} = (\<Sum>x\<in>S. card (T x))
[PROOF STEP]
using card_SigmaI[OF assms, symmetric]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>a\<in>S. card (T a)) = card (Sigma S T)

goal (1 subgoal):
 1. card {(x, y). x \<in> S \<and> y \<in> T x} = (\<Sum>x\<in>S. card (T x))
[PROOF STEP]
by (auto intro!: arg_cong[where f=card] simp add: Sigma_def)


[STATEMENT]
lemma galois_connectionI:
  assumes
    "partial_order A" "partial_order B"
    "L \<in> carrier A \<rightarrow> carrier B" "R \<in> carrier B \<rightarrow> carrier A"
    "isotone A B L" "isotone B A R"
    "\<And> x y. \<lbrakk> x \<in> carrier A; y \<in> carrier B \<rbrakk> \<Longrightarrow> L x \<sqsubseteq>\<^bsub>B\<^esub> y \<longleftrightarrow> x \<sqsubseteq>\<^bsub>A\<^esub> R y"
  shows "galois_connection \<lparr> orderA = A, orderB = B, lower = L, upper = R \<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. galois_connection \<lparr>orderA = A, orderB = B, lower = L, upper = R\<rparr>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
partial_order A
partial_order B
L \<in> carrier A \<rightarrow> carrier B
R \<in> carrier B \<rightarrow> carrier A
isotone A B L
isotone B A R
\<lbrakk>?x \<in> carrier A; ?y \<in> carrier B\<rbrakk> \<Longrightarrow> (L ?x \<sqsubseteq>\<^bsub>B\<^esub> ?y) = (?x \<sqsubseteq>\<^bsub>A\<^esub> R ?y)

goal (1 subgoal):
 1. galois_connection \<lparr>orderA = A, orderB = B, lower = L, upper = R\<rparr>
[PROOF STEP]
by (simp add: galois_connection_def connection_def galois_connection_axioms_def)


[STATEMENT]
lemma neg_less_divideC_eq [field_simps]:
  "a < b /\<^sub>C c \<longleftrightarrow> b < c *\<^sub>C a" if "c < 0"
    for a b :: "'a :: ordered_complex_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a < b /\<^sub>C c) = (b < c *\<^sub>C a)
[PROOF STEP]
using that neg_le_divideC_eq [of c a b]
[PROOF STATE]
proof (prove)
using this:
c < 0
c < 0 \<Longrightarrow> (a \<le> b /\<^sub>C c) = (b \<le> c *\<^sub>C a)

goal (1 subgoal):
 1. (a < b /\<^sub>C c) = (b < c *\<^sub>C a)
[PROOF STEP]
by (smt (verit, ccfv_SIG) neg_le_divideC_eq antisym_conv2 complex_vector.scale_minus_right dual_order.strict_implies_order le_less_trans neg_le_iff_le scaleC_scaleC)


[STATEMENT]
lemma odlist_all_iff:
  "odlist_all P xs \<longleftrightarrow> (\<forall>x \<in> toSet xs. P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. odlist_all P xs = (\<forall>x\<in>toSet xs. P x)
[PROOF STEP]
unfolding odlist_all_def toSet_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all P (toList xs) = (\<forall>x\<in>set (toList xs). P x)
[PROOF STEP]
by (simp only: list_all_iff)


[STATEMENT]
lemma dist_minus:
  fixes x y :: "'a::real_normed_vector"
  shows "dist (- x) (- y) = dist x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (- x) (- y) = dist x y
[PROOF STEP]
unfolding dist_norm minus_diff_minus norm_minus_cancel
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (x - y) = norm (x - y)
[PROOF STEP]
..


[STATEMENT]
lemma Polygamma_approx_0:
  "Polygamma_approx 0 m x = (x - 1/2) * ln x - x + of_real (ln (2*pi)) / 2 + stirling_sum 0 m x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polygamma_approx 0 m x = (x - (1::'a) / (2::'a)) * ln x - x + of_real (ln (2 * pi)) / (2::'a) + stirling_sum 0 m x
[PROOF STEP]
by (simp add: Polygamma_approx_def)


[STATEMENT]
lemma is_scc_pointwise:
  "is_scc E U \<longleftrightarrow>
    U\<noteq>{}
  \<and> (\<forall>u\<in>U. \<forall>v\<in>U. (u,v)\<in>(E\<inter>U\<times>U)\<^sup>*)
  \<and> (\<forall>u\<in>U. \<forall>v. (v\<notin>U \<and> (u,v)\<in>E\<^sup>*) \<longrightarrow> (\<forall>u'\<in>U. (v,u')\<notin>E\<^sup>*))"
  \<comment> \<open>Alternative, pointwise characterization\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_scc E U = (U \<noteq> {} \<and> (\<forall>u\<in>U. \<forall>v\<in>U. (u, v) \<in> (Restr E U)\<^sup>*) \<and> (\<forall>u\<in>U. \<forall>v. v \<notin> U \<and> (u, v) \<in> E\<^sup>* \<longrightarrow> (\<forall>u'\<in>U. (v, u') \<notin> E\<^sup>*)))
[PROOF STEP]
unfolding is_scc_alt_restrict_path
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (U \<noteq> {} \<and> U \<times> U \<subseteq> (Restr E U)\<^sup>* \<and> E\<^sup>* `` (E\<^sup>* `` U - U) \<inter> U = {}) = (U \<noteq> {} \<and> (\<forall>u\<in>U. \<forall>v\<in>U. (u, v) \<in> (Restr E U)\<^sup>*) \<and> (\<forall>u\<in>U. \<forall>v. v \<notin> U \<and> (u, v) \<in> E\<^sup>* \<longrightarrow> (\<forall>u'\<in>U. (v, u') \<notin> E\<^sup>*)))
[PROOF STEP]
by blast


[STATEMENT]
lemma Sup_eq_MInfty:
  fixes S :: "ereal set"
  shows "Sup S = -\<infinity> \<longleftrightarrow> S = {} \<or> S = {-\<infinity>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Sup S = - \<infinity>) = (S = {} \<or> S = {- \<infinity>})
[PROOF STEP]
unfolding bot_ereal_def[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Sup S = bot) = (S = {} \<or> S = {bot})
[PROOF STEP]
by auto


[STATEMENT]
lemma Abel_lemma:
  fixes a :: "nat \<Rightarrow> 'a::real_normed_vector"
  assumes r: "0 \<le> r"
    and r0: "r < r0"
    and M: "\<And>n. norm (a n) * r0^n \<le> M"
  shows "summable (\<lambda>n. norm (a n) * r^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. norm (a n) * r ^ n)
[PROOF STEP]
proof (rule summable_comparison_test')
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. summable ?g
 2. \<And>n. ?N \<le> n \<Longrightarrow> norm (norm (a n) * r ^ n) \<le> ?g n
[PROOF STEP]
show "summable (\<lambda>n. M * (r / r0) ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. M * (r / r0) ^ n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> r
r < r0
norm (a ?n) * r0 ^ ?n \<le> M

goal (1 subgoal):
 1. summable (\<lambda>n. M * (r / r0) ^ n)
[PROOF STEP]
by (auto simp add: summable_mult summable_geometric)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. M * (r / r0) ^ n)

goal (1 subgoal):
 1. \<And>n. ?N \<le> n \<Longrightarrow> norm (norm (a n) * r ^ n) \<le> M * (r / r0) ^ n
[PROOF STEP]
show "norm (norm (a n) * r ^ n) \<le> M * (r / r0) ^ n" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (norm (a n) * r ^ n) \<le> M * (r / r0) ^ n
[PROOF STEP]
using r r0 M [of n] dual_order.order_iff_strict
[PROOF STATE]
proof (prove)
using this:
0 \<le> r
r < r0
norm (a n) * r0 ^ n \<le> M
(?b \<le> ?a) = (?b < ?a \<or> ?a = ?b)

goal (1 subgoal):
 1. norm (norm (a n) * r ^ n) \<le> M * (r / r0) ^ n
[PROOF STEP]
by (fastforce simp add: abs_mult field_simps)
[PROOF STATE]
proof (state)
this:
norm (norm (a ?n) * r ^ ?n) \<le> M * (r / r0) ^ ?n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma conjugate_square_ge_0_vec[intro!]:
  fixes v :: "'a :: conjugatable_ordered_ring vec"
  shows "v \<bullet>c v \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> v \<bullet>c v
[PROOF STEP]
proof (induct v)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (0::'a) \<le> vNil \<bullet>c vNil
 2. \<And>a v. (0::'a) \<le> v \<bullet>c v \<Longrightarrow> (0::'a) \<le> vCons a v \<bullet>c vCons a v
[PROOF STEP]
case vNil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (0::'a) \<le> vNil \<bullet>c vNil
 2. \<And>a v. (0::'a) \<le> v \<bullet>c v \<Longrightarrow> (0::'a) \<le> vCons a v \<bullet>c vCons a v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> vNil \<bullet>c vNil
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> vNil \<bullet>c vNil

goal (1 subgoal):
 1. \<And>a v. (0::'a) \<le> v \<bullet>c v \<Longrightarrow> (0::'a) \<le> vCons a v \<bullet>c vCons a v
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a v. (0::'a) \<le> v \<bullet>c v \<Longrightarrow> (0::'a) \<le> vCons a v \<bullet>c vCons a v
[PROOF STEP]
case (vCons a v)
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> v \<bullet>c v

goal (1 subgoal):
 1. \<And>a v. (0::'a) \<le> v \<bullet>c v \<Longrightarrow> (0::'a) \<le> vCons a v \<bullet>c vCons a v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(0::'a) \<le> v \<bullet>c v
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> v \<bullet>c v

goal (1 subgoal):
 1. (0::'a) \<le> vCons a v \<bullet>c vCons a v
[PROOF STEP]
using conjugate_square_positive[of a]
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> v \<bullet>c v
(0::'a) \<le> a * conjugate a

goal (1 subgoal):
 1. (0::'a) \<le> vCons a v \<bullet>c vCons a v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> vCons a v \<bullet>c vCons a v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prime_gt_0_int: "prime p \<Longrightarrow> p > (0::int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p \<Longrightarrow> 0 < p
[PROOF STEP]
using prime_ge_2_int [of p]
[PROOF STATE]
proof (prove)
using this:
prime p \<Longrightarrow> 2 \<le> p

goal (1 subgoal):
 1. prime p \<Longrightarrow> 0 < p
[PROOF STEP]
by simp


[STATEMENT]
lemma sqrt_ge_absD: "\<bar>x\<bar> \<le> sqrt y \<Longrightarrow> x\<^sup>2 \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>x\<bar> \<le> sqrt y \<Longrightarrow> x\<^sup>2 \<le> y
[PROOF STEP]
using real_sqrt_le_iff[of "x\<^sup>2"]
[PROOF STATE]
proof (prove)
using this:
(sqrt (x\<^sup>2) \<le> sqrt ?y) = (x\<^sup>2 \<le> ?y)

goal (1 subgoal):
 1. \<bar>x\<bar> \<le> sqrt y \<Longrightarrow> x\<^sup>2 \<le> y
[PROOF STEP]
by simp


[STATEMENT]
lemma Diag_finfun: "(\<lambda>x. (f x, g x)) \<in> finfun \<longleftrightarrow> f \<in> finfun \<and> g \<in> finfun"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. (f x, g x)) \<in> finfun) = (f \<in> finfun \<and> g \<in> finfun)
[PROOF STEP]
by(auto intro: finite_subset simp add: Collect_neg_eq Collect_imp_eq Collect_conj_eq finfun_def)


[STATEMENT]
lemma OPT_rec2:
  "OPT (i + 1) (j + 1) = max (OPT i (j + 1)) (OPT (i + 1) j)" (is "?l = ?r")
  if "A!i \<noteq> B!j" "i < length A" "j < length B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.OPT (i + 1) (j + 1) = max (local.OPT i (j + 1)) (local.OPT (i + 1) j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.OPT (i + 1) (j + 1) = max (local.OPT i (j + 1)) (local.OPT (i + 1) j)
[PROOF STEP]
have "{length xs |xs. subseq xs (take (i + 1) A) \<and> subseq xs (take (j + 1) B)}
    = {length xs |xs. subseq xs (take i A) \<and> subseq xs (take (j + 1) B)}
    \<union> {length xs |xs. subseq xs (take (i + 1) A) \<and> subseq xs (take j B)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {length xs |xs. subseq xs (take (i + 1) A) \<and> subseq xs (take (j + 1) B)} = {length xs |xs. subseq xs (take i A) \<and> subseq xs (take (j + 1) B)} \<union> {length xs |xs. subseq xs (take (i + 1) A) \<and> subseq xs (take j B)}
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
A ! i \<noteq> B ! j
i < length A
j < length B

goal (1 subgoal):
 1. {length xs |xs. subseq xs (take (i + 1) A) \<and> subseq xs (take (j + 1) B)} = {length xs |xs. subseq xs (take i A) \<and> subseq xs (take (j + 1) B)} \<union> {length xs |xs. subseq xs (take (i + 1) A) \<and> subseq xs (take j B)}
[PROOF STEP]
by (auto simp: subseq_append_single_right take_Suc_conv_app_nth)
[PROOF STATE]
proof (state)
this:
{length xs |xs. subseq xs (take (i + 1) A) \<and> subseq xs (take (j + 1) B)} = {length xs |xs. subseq xs (take i A) \<and> subseq xs (take (j + 1) B)} \<union> {length xs |xs. subseq xs (take (i + 1) A) \<and> subseq xs (take j B)}

goal (1 subgoal):
 1. local.OPT (i + 1) (j + 1) = max (local.OPT i (j + 1)) (local.OPT (i + 1) j)
[PROOF STEP]
with finite_OPT non_empty_OPT
[PROOF STATE]
proof (chain)
picking this:
finite {xs. subseq xs (take ?i A) \<and> subseq xs (take ?j B)}
{xs. subseq xs (take ?i A) \<and> subseq xs (take ?j B)} \<noteq> {}
{length xs |xs. subseq xs (take (i + 1) A) \<and> subseq xs (take (j + 1) B)} = {length xs |xs. subseq xs (take i A) \<and> subseq xs (take (j + 1) B)} \<union> {length xs |xs. subseq xs (take (i + 1) A) \<and> subseq xs (take j B)}
[PROOF STEP]
show "?l = ?r"
[PROOF STATE]
proof (prove)
using this:
finite {xs. subseq xs (take ?i A) \<and> subseq xs (take ?j B)}
{xs. subseq xs (take ?i A) \<and> subseq xs (take ?j B)} \<noteq> {}
{length xs |xs. subseq xs (take (i + 1) A) \<and> subseq xs (take (j + 1) B)} = {length xs |xs. subseq xs (take i A) \<and> subseq xs (take (j + 1) B)} \<union> {length xs |xs. subseq xs (take (i + 1) A) \<and> subseq xs (take j B)}

goal (1 subgoal):
 1. local.OPT (i + 1) (j + 1) = max (local.OPT i (j + 1)) (local.OPT (i + 1) j)
[PROOF STEP]
unfolding OPT_def
[PROOF STATE]
proof (prove)
using this:
finite {xs. subseq xs (take ?i A) \<and> subseq xs (take ?j B)}
{xs. subseq xs (take ?i A) \<and> subseq xs (take ?j B)} \<noteq> {}
{length xs |xs. subseq xs (take (i + 1) A) \<and> subseq xs (take (j + 1) B)} = {length xs |xs. subseq xs (take i A) \<and> subseq xs (take (j + 1) B)} \<union> {length xs |xs. subseq xs (take (i + 1) A) \<and> subseq xs (take j B)}

goal (1 subgoal):
 1. Max {length xs |xs. subseq xs (take (i + 1) A) \<and> subseq xs (take (j + 1) B)} = max (Max {length xs |xs. subseq xs (take i A) \<and> subseq xs (take (j + 1) B)}) (Max {length xs |xs. subseq xs (take (i + 1) A) \<and> subseq xs (take j B)})
[PROOF STEP]
by (simp) (rule Max_Un, auto)
[PROOF STATE]
proof (state)
this:
local.OPT (i + 1) (j + 1) = max (local.OPT i (j + 1)) (local.OPT (i + 1) j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma size_multiset_set_mset_const_count:
  assumes "card (set_mset A) = ca"
  assumes "\<And>p. p \<in># A \<Longrightarrow> count A p = ca2"
  shows "size A =  (ca * ca2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size A = ca * ca2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. size A = ca * ca2
[PROOF STEP]
have "size A = (\<Sum> p \<in> (set_mset A) . count A p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size A = sum (count A) (set_mset A)
[PROOF STEP]
using size_multiset_overloaded_eq
[PROOF STATE]
proof (prove)
using this:
size ?x = sum (count ?x) (set_mset ?x)

goal (1 subgoal):
 1. size A = sum (count A) (set_mset A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
size A = sum (count A) (set_mset A)

goal (1 subgoal):
 1. size A = ca * ca2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
size A = sum (count A) (set_mset A)
[PROOF STEP]
have "size A = (\<Sum> p \<in> (set_mset A) . ca2)"
[PROOF STATE]
proof (prove)
using this:
size A = sum (count A) (set_mset A)

goal (1 subgoal):
 1. size A = (\<Sum>p\<in>set_mset A. ca2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
size A = sum (count A) (set_mset A)
card (set_mset A) = ca
?p \<in># A \<Longrightarrow> count A ?p = ca2

goal (1 subgoal):
 1. size A = (\<Sum>p\<in>set_mset A. ca2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
size A = (\<Sum>p\<in>set_mset A. ca2)

goal (1 subgoal):
 1. size A = ca * ca2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
size A = (\<Sum>p\<in>set_mset A. ca2)

goal (1 subgoal):
 1. size A = ca * ca2
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
size A = (\<Sum>p\<in>set_mset A. ca2)
card (set_mset A) = ca

goal (1 subgoal):
 1. size A = ca * ca2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
size A = ca * ca2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infsetsum_mono_neutral:
  fixes f g :: "'a \<Rightarrow> real"
  assumes "f abs_summable_on A" and "g abs_summable_on B"
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<le> g x"
  assumes "\<And>x. x \<in> A - B \<Longrightarrow> f x \<le> 0"
  assumes "\<And>x. x \<in> B - A \<Longrightarrow> g x \<ge> 0"
  shows   "infsetsum f A \<le> infsetsum g B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infsetsum f A \<le> infsetsum g B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f abs_summable_on A
g abs_summable_on B
?x \<in> A \<Longrightarrow> f ?x \<le> g ?x
?x \<in> A - B \<Longrightarrow> f ?x \<le> 0
?x \<in> B - A \<Longrightarrow> 0 \<le> g ?x

goal (1 subgoal):
 1. infsetsum f A \<le> infsetsum g B
[PROOF STEP]
unfolding infsetsum_altdef set_lebesgue_integral_def abs_summable_on_altdef set_integrable_def
[PROOF STATE]
proof (prove)
using this:
integrable (count_space UNIV) (\<lambda>x. indicat_real A x *\<^sub>R f x)
integrable (count_space UNIV) (\<lambda>x. indicat_real B x *\<^sub>R g x)
?x \<in> A \<Longrightarrow> f ?x \<le> g ?x
?x \<in> A - B \<Longrightarrow> f ?x \<le> 0
?x \<in> B - A \<Longrightarrow> 0 \<le> g ?x

goal (1 subgoal):
 1. LINT x|count_space UNIV. indicat_real A x *\<^sub>R f x \<le> LINT x|count_space UNIV. indicat_real B x *\<^sub>R g x
[PROOF STEP]
by (intro Bochner_Integration.integral_mono) (auto simp: indicator_def)


[STATEMENT]
lemma row_multrow:  "k \<noteq> i \<Longrightarrow> i < n \<Longrightarrow> row (multrow_mat n k a) i = unit_vec n i"
  "k < n \<Longrightarrow> row (multrow_mat n k a) k = a \<cdot>\<^sub>v unit_vec n k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>k \<noteq> i; i < n\<rbrakk> \<Longrightarrow> row (multrow_mat n k a) i = unit_vec n i) &&& (k < n \<Longrightarrow> row (multrow_mat n k a) k = a \<cdot>\<^sub>v unit_vec n k)
[PROOF STEP]
by (rule eq_vecI, auto)


[STATEMENT]
lemma bounded_vderiv_on_imp_lipschitz:
  assumes "(f has_vderiv_on f') X"
  assumes convex: "convex X"
  assumes "\<And>x. x \<in> X \<Longrightarrow> norm (f' x) \<le> C" "0 \<le> C"
  shows "C-lipschitz_on X f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C-lipschitz_on X f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(f has_vderiv_on f') X
convex X
?x \<in> X \<Longrightarrow> norm (f' ?x) \<le> C
0 \<le> C

goal (1 subgoal):
 1. C-lipschitz_on X f
[PROOF STEP]
by (auto simp: has_vderiv_on_def has_vector_derivative_def onorm_scaleR_left onorm_id
    intro!: bounded_derivative_imp_lipschitz[where f' = "\<lambda>x d. d *\<^sub>R f' x"])


[STATEMENT]
lemma orthogonal_extension_aux:
  fixes S :: "'a::euclidean_space set"
  assumes "finite T" "finite S" "pairwise orthogonal S"
    shows "\<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> T)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite T
finite S
pairwise orthogonal S

goal (1 subgoal):
 1. \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> T)
[PROOF STEP]
proof (induction arbitrary: S)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>S. \<lbrakk>finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> {})
 2. \<And>x F S. \<lbrakk>finite F; x \<notin> F; \<And>S. \<lbrakk>finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> F); finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> insert x F)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
finite S
pairwise orthogonal S

goal (2 subgoals):
 1. \<And>S. \<lbrakk>finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> {})
 2. \<And>x F S. \<lbrakk>finite F; x \<notin> F; \<And>S. \<lbrakk>finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> F); finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> insert x F)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite S
pairwise orthogonal S
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite S
pairwise orthogonal S

goal (1 subgoal):
 1. \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> {})
[PROOF STEP]
by simp (metis sup_bot_right)
[PROOF STATE]
proof (state)
this:
\<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> {})

goal (1 subgoal):
 1. \<And>x F S. \<lbrakk>finite F; x \<notin> F; \<And>S. \<lbrakk>finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> F); finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> insert x F)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F S. \<lbrakk>finite F; x \<notin> F; \<And>S. \<lbrakk>finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> F); finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> insert x F)
[PROOF STEP]
case (insert a T)
[PROOF STATE]
proof (state)
this:
finite T
a \<notin> T
\<lbrakk>finite ?S; pairwise orthogonal ?S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (?S \<union> U) \<and> span (?S \<union> U) = span (?S \<union> T)
finite S
pairwise orthogonal S

goal (1 subgoal):
 1. \<And>x F S. \<lbrakk>finite F; x \<notin> F; \<And>S. \<lbrakk>finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> F); finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> insert x F)
[PROOF STEP]
have 0: "\<And>x y. \<lbrakk>x \<noteq> y; x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> x \<bullet> y = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<noteq> y; x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> x \<bullet> y = 0
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
finite T
a \<notin> T
\<lbrakk>finite ?S; pairwise orthogonal ?S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (?S \<union> U) \<and> span (?S \<union> U) = span (?S \<union> T)
finite S
pairwise orthogonal S

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<noteq> y; x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> x \<bullet> y = 0
[PROOF STEP]
by (simp add: pairwise_def orthogonal_def)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<noteq> ?y; ?x \<in> S; ?y \<in> S\<rbrakk> \<Longrightarrow> ?x \<bullet> ?y = 0

goal (1 subgoal):
 1. \<And>x F S. \<lbrakk>finite F; x \<notin> F; \<And>S. \<lbrakk>finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> F); finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> insert x F)
[PROOF STEP]
define a' where "a' = a - (\<Sum>b\<in>S. (b \<bullet> a / (b \<bullet> b)) *\<^sub>R b)"
[PROOF STATE]
proof (state)
this:
a' = a - (\<Sum>b\<in>S. (b \<bullet> a / (b \<bullet> b)) *\<^sub>R b)

goal (1 subgoal):
 1. \<And>x F S. \<lbrakk>finite F; x \<notin> F; \<And>S. \<lbrakk>finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> F); finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> insert x F)
[PROOF STEP]
obtain U where orthU: "pairwise orthogonal (S \<union> insert a' U)"
             and spanU: "span (insert a' S \<union> U) = span (insert a' S \<union> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>U. \<lbrakk>pairwise orthogonal (S \<union> insert a' U); span (insert a' S \<union> U) = span (insert a' S \<union> T)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule exE [OF insert.IH [of "insert a' S"]])
      (auto simp: Gram_Schmidt_step a'_def insert.prems orthogonal_commute
        pairwise_orthogonal_insert span_clauses)
[PROOF STATE]
proof (state)
this:
pairwise orthogonal (S \<union> insert a' U)
span (insert a' S \<union> U) = span (insert a' S \<union> T)

goal (1 subgoal):
 1. \<And>x F S. \<lbrakk>finite F; x \<notin> F; \<And>S. \<lbrakk>finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> F); finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> insert x F)
[PROOF STEP]
have orthS: "\<And>x. x \<in> S \<Longrightarrow> a' \<bullet> x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> a' \<bullet> x = 0
[PROOF STEP]
apply (simp add: a'_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> (a - (\<Sum>b\<in>S. (b \<bullet> a / (b \<bullet> b)) *\<^sub>R b)) \<bullet> x = 0
[PROOF STEP]
using Gram_Schmidt_step [OF \<open>pairwise orthogonal S\<close>]
[PROOF STATE]
proof (prove)
using this:
?x \<in> span S \<Longrightarrow> orthogonal ?x (?a - (\<Sum>b\<in>S. (b \<bullet> ?a / (b \<bullet> b)) *\<^sub>R b))

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> (a - (\<Sum>b\<in>S. (b \<bullet> a / (b \<bullet> b)) *\<^sub>R b)) \<bullet> x = 0
[PROOF STEP]
apply (force simp: orthogonal_def inner_commute span_superset [THEN subsetD])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> a' \<bullet> ?x = 0

goal (1 subgoal):
 1. \<And>x F S. \<lbrakk>finite F; x \<notin> F; \<And>S. \<lbrakk>finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> F); finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> insert x F)
[PROOF STEP]
have "span (S \<union> insert a' U) = span (insert a' (S \<union> T))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span (S \<union> insert a' U) = span (insert a' (S \<union> T))
[PROOF STEP]
using spanU
[PROOF STATE]
proof (prove)
using this:
span (insert a' S \<union> U) = span (insert a' S \<union> T)

goal (1 subgoal):
 1. span (S \<union> insert a' U) = span (insert a' (S \<union> T))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
span (S \<union> insert a' U) = span (insert a' (S \<union> T))

goal (1 subgoal):
 1. \<And>x F S. \<lbrakk>finite F; x \<notin> F; \<And>S. \<lbrakk>finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> F); finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> insert x F)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
span (S \<union> insert a' U) = span (insert a' (S \<union> T))

goal (1 subgoal):
 1. \<And>x F S. \<lbrakk>finite F; x \<notin> F; \<And>S. \<lbrakk>finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> F); finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> insert x F)
[PROOF STEP]
have "... = span (insert a (S \<union> T))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span (insert a' (S \<union> T)) = span (insert a (S \<union> T))
[PROOF STEP]
apply (rule eq_span_insert_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a' - a \<in> span (S \<union> T)
[PROOF STEP]
apply (simp add: a'_def span_neg span_sum span_base span_mul)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
span (insert a' (S \<union> T)) = span (insert a (S \<union> T))

goal (1 subgoal):
 1. \<And>x F S. \<lbrakk>finite F; x \<notin> F; \<And>S. \<lbrakk>finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> F); finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> insert x F)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
span (insert a' (S \<union> T)) = span (insert a (S \<union> T))

goal (1 subgoal):
 1. \<And>x F S. \<lbrakk>finite F; x \<notin> F; \<And>S. \<lbrakk>finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> F); finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> insert x F)
[PROOF STEP]
have "... = span (S \<union> insert a T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span (insert a (S \<union> T)) = span (S \<union> insert a T)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
span (insert a (S \<union> T)) = span (S \<union> insert a T)

goal (1 subgoal):
 1. \<And>x F S. \<lbrakk>finite F; x \<notin> F; \<And>S. \<lbrakk>finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> F); finite S; pairwise orthogonal S\<rbrakk> \<Longrightarrow> \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> insert x F)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
span (S \<union> insert a' U) = span (S \<union> insert a T)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
span (S \<union> insert a' U) = span (S \<union> insert a T)

goal (1 subgoal):
 1. \<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> insert a T)
[PROOF STEP]
by (rule_tac x="insert a' U" in exI) (use orthU in auto)
[PROOF STATE]
proof (state)
this:
\<exists>U. pairwise orthogonal (S \<union> U) \<and> span (S \<union> U) = span (S \<union> insert a T)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma kripke_rels_worlds[dest]:
  assumes "(w, w') \<in> relations M a"
  assumes M: "kripke M"
  shows "w \<in> worlds M \<and> w' \<in> worlds M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<in> worlds M \<and> w' \<in> worlds M
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(w, w') \<in> relations M a
kripke M

goal (1 subgoal):
 1. w \<in> worlds M \<and> w' \<in> worlds M
[PROOF STEP]
unfolding kripke_def
[PROOF STATE]
proof (prove)
using this:
(w, w') \<in> relations M a
\<forall>a. relations M a \<subseteq> worlds M \<times> worlds M

goal (1 subgoal):
 1. w \<in> worlds M \<and> w' \<in> worlds M
[PROOF STEP]
by auto


[STATEMENT]
theorem prefix_match_semantics_wordset:
    assumes "valid_prefix pfx"
    shows "prefix_match_semantics pfx a \<longleftrightarrow> a \<in> prefix_to_wordset pfx"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prefix_match_semantics pfx a = (a \<in> prefix_to_wordset pfx)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
valid_prefix pfx

goal (1 subgoal):
 1. prefix_match_semantics pfx a = (a \<in> prefix_to_wordset pfx)
[PROOF STEP]
unfolding valid_prefix_def pfxm_mask_def prefix_match_semantics_def prefix_to_wordset_def
[PROOF STATE]
proof (prove)
using this:
mask (LENGTH('a) - pfxm_length pfx) && pfxm_prefix pfx = 0

goal (1 subgoal):
 1. (pfxm_prefix pfx = ~~ mask (LENGTH('a) - pfxm_length pfx) && a) = (a \<in> {pfxm_prefix pfx..pfxm_prefix pfx || mask (LENGTH('a) - pfxm_length pfx)})
[PROOF STEP]
apply(cases pfx, rename_tac base len)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>base len. \<lbrakk>mask (LENGTH('a) - pfxm_length pfx) && pfxm_prefix pfx = 0; pfx = PrefixMatch base len; mask (LENGTH('a) - pfxm_length pfx) && pfxm_prefix pfx = 0\<rbrakk> \<Longrightarrow> (pfxm_prefix pfx = ~~ mask (LENGTH('a) - pfxm_length pfx) && a) = (a \<in> {pfxm_prefix pfx..pfxm_prefix pfx || mask (LENGTH('a) - pfxm_length pfx)})
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>base len. \<lbrakk>mask (LENGTH('a) - len) && base = 0; pfx = PrefixMatch base len\<rbrakk> \<Longrightarrow> (base = ~~ mask (LENGTH('a) - len) && a) = (base \<le> a \<and> a \<le> base || mask (LENGTH('a) - len))
[PROOF STEP]
apply(drule_tac base=base and len=len and a=a in zero_base_lsb_imp_set_eq_as_bit_operation)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>base len. \<lbrakk>pfx = PrefixMatch base len; (base = ~~ mask (LENGTH('a) - len) && a) = (a \<in> {base..base || mask (LENGTH('a) - len)})\<rbrakk> \<Longrightarrow> (base = ~~ mask (LENGTH('a) - len) && a) = (base \<le> a \<and> a \<le> base || mask (LENGTH('a) - len))
[PROOF STEP]
by (simp)


[STATEMENT]
lemma bounded_imp_summable:
  fixes a :: "nat \<Rightarrow> 'a::{conditionally_complete_linorder,linorder_topology,linordered_comm_semiring_strict}"
  assumes 0: "\<And>n. a n \<ge> 0" and bounded: "\<And>n. (\<Sum>k\<le>n. a k) \<le> B"
  shows "summable a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. summable a
[PROOF STEP]
have "bdd_above (range(\<lambda>n. \<Sum>k\<le>n. a k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_above (range (\<lambda>n. sum a {..n}))
[PROOF STEP]
by (meson bdd_aboveI2 bounded)
[PROOF STATE]
proof (state)
this:
bdd_above (range (\<lambda>n. sum a {..n}))

goal (1 subgoal):
 1. summable a
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
bdd_above (range (\<lambda>n. sum a {..n}))

goal (1 subgoal):
 1. summable a
[PROOF STEP]
have "incseq (\<lambda>n. \<Sum>k\<le>n. a k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. incseq (\<lambda>n. sum a {..n})
[PROOF STEP]
by (simp add: mono_def "0" sum_mono2)
[PROOF STATE]
proof (state)
this:
incseq (\<lambda>n. sum a {..n})

goal (1 subgoal):
 1. summable a
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
bdd_above (range (\<lambda>n. sum a {..n}))
incseq (\<lambda>n. sum a {..n})
[PROOF STEP]
obtain s where "(\<lambda>n. \<Sum>k\<le>n. a k) \<longlonglongrightarrow> s"
[PROOF STATE]
proof (prove)
using this:
bdd_above (range (\<lambda>n. sum a {..n}))
incseq (\<lambda>n. sum a {..n})

goal (1 subgoal):
 1. (\<And>s. (\<lambda>n. sum a {..n}) \<longlonglongrightarrow> s \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using LIMSEQ_incseq_SUP
[PROOF STATE]
proof (prove)
using this:
bdd_above (range (\<lambda>n. sum a {..n}))
incseq (\<lambda>n. sum a {..n})
\<lbrakk>bdd_above (range ?X); incseq ?X\<rbrakk> \<Longrightarrow> ?X \<longlonglongrightarrow> Sup (range ?X)

goal (1 subgoal):
 1. (\<And>s. (\<lambda>n. sum a {..n}) \<longlonglongrightarrow> s \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>n. sum a {..n}) \<longlonglongrightarrow> s

goal (1 subgoal):
 1. summable a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. sum a {..n}) \<longlonglongrightarrow> s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. sum a {..n}) \<longlonglongrightarrow> s

goal (1 subgoal):
 1. summable a
[PROOF STEP]
by (auto simp: sums_def_le summable_def)
[PROOF STATE]
proof (state)
this:
summable a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iso_homology_contractible_space_subtopology1:
  assumes "contractible_space X" "S \<subseteq> topspace X" "S \<noteq> {}"
  shows  "homology_group  0 (subtopology X S) \<cong> DirProd integer_group (relative_homology_group(1) X S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homology_group 0 (subtopology X S) \<cong> integer_group \<times>\<times> relative_homology_group 1 X S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. homology_group 0 (subtopology X S) \<cong> integer_group \<times>\<times> relative_homology_group 1 X S
[PROOF STEP]
obtain f where  "homotopic_with (\<lambda>x. True) X X id f" and "f ` (topspace X) \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>homotopic_with (\<lambda>x. True) X X id f; f ` topspace X \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms contractible_space_alt
[PROOF STATE]
proof (prove)
using this:
contractible_space X
S \<subseteq> topspace X
S \<noteq> {}
contractible_space ?X = (\<forall>a\<in>topspace ?X. homotopic_with (\<lambda>x. True) ?X ?X id (\<lambda>x. a))

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>homotopic_with (\<lambda>x. True) X X id f; f ` topspace X \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
homotopic_with (\<lambda>x. True) X X id f
f ` topspace X \<subseteq> S

goal (1 subgoal):
 1. homology_group 0 (subtopology X S) \<cong> integer_group \<times>\<times> relative_homology_group 1 X S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
homotopic_with (\<lambda>x. True) X X id f
f ` topspace X \<subseteq> S
[PROOF STEP]
have "homology_group 0 (subtopology X S) \<cong> homology_group 0 X \<times>\<times> relative_homology_group 1 X S"
[PROOF STATE]
proof (prove)
using this:
homotopic_with (\<lambda>x. True) X X id f
f ` topspace X \<subseteq> S

goal (1 subgoal):
 1. homology_group 0 (subtopology X S) \<cong> homology_group 0 X \<times>\<times> relative_homology_group 1 X S
[PROOF STEP]
using iso_homology_group_prod_deformation [of X _ S 0]
[PROOF STATE]
proof (prove)
using this:
homotopic_with (\<lambda>x. True) X X id f
f ` topspace X \<subseteq> S
\<lbrakk>homotopic_with (\<lambda>x. True) X X id ?f; ?f ` topspace X \<subseteq> S\<rbrakk> \<Longrightarrow> homology_group 0 (subtopology X S) \<cong> homology_group 0 X \<times>\<times> relative_homology_group (0 + 1) X S

goal (1 subgoal):
 1. homology_group 0 (subtopology X S) \<cong> homology_group 0 X \<times>\<times> relative_homology_group 1 X S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
homology_group 0 (subtopology X S) \<cong> homology_group 0 X \<times>\<times> relative_homology_group 1 X S

goal (1 subgoal):
 1. homology_group 0 (subtopology X S) \<cong> integer_group \<times>\<times> relative_homology_group 1 X S
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
homology_group 0 (subtopology X S) \<cong> homology_group 0 X \<times>\<times> relative_homology_group 1 X S

goal (1 subgoal):
 1. homology_group 0 (subtopology X S) \<cong> integer_group \<times>\<times> relative_homology_group 1 X S
[PROOF STEP]
have "\<dots> \<cong> integer_group \<times>\<times> relative_homology_group 1 X S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homology_group 0 X \<times>\<times> relative_homology_group 1 X S \<cong> integer_group \<times>\<times> relative_homology_group 1 X S
[PROOF STEP]
using assms contractible_imp_path_connected_space group.DirProd_iso_trans group_relative_homology_group iso_refl isomorphic_integer_zeroth_homology_group
[PROOF STATE]
proof (prove)
using this:
contractible_space X
S \<subseteq> topspace X
S \<noteq> {}
contractible_space ?X \<Longrightarrow> path_connected_space ?X
\<lbrakk>Group.group ?G; ?G \<cong> ?G2.0; ?H \<cong> ?I\<rbrakk> \<Longrightarrow> ?G \<times>\<times> ?H \<cong> ?G2.0 \<times>\<times> ?I
Group.group (relative_homology_group ?p ?X ?S)
?G \<cong> ?G
\<lbrakk>path_connected_space ?X; topspace ?X \<noteq> {}\<rbrakk> \<Longrightarrow> homology_group 0 ?X \<cong> integer_group

goal (1 subgoal):
 1. homology_group 0 X \<times>\<times> relative_homology_group 1 X S \<cong> integer_group \<times>\<times> relative_homology_group 1 X S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
homology_group 0 X \<times>\<times> relative_homology_group 1 X S \<cong> integer_group \<times>\<times> relative_homology_group 1 X S

goal (1 subgoal):
 1. homology_group 0 (subtopology X S) \<cong> integer_group \<times>\<times> relative_homology_group 1 X S
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
homology_group 0 (subtopology X S) \<cong> integer_group \<times>\<times> relative_homology_group 1 X S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
homology_group 0 (subtopology X S) \<cong> integer_group \<times>\<times> relative_homology_group 1 X S

goal (1 subgoal):
 1. homology_group 0 (subtopology X S) \<cong> integer_group \<times>\<times> relative_homology_group 1 X S
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
homology_group 0 (subtopology X S) \<cong> integer_group \<times>\<times> relative_homology_group 1 X S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_drop_Suc [rule_format]: "\<forall>xs. set (drop (Suc n) xs) \<subseteq> set (drop n xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>xs. set (drop (Suc n) xs) \<subseteq> set (drop n xs)
[PROOF STEP]
apply (induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>xs. set (drop (Suc 0) xs) \<subseteq> set (drop 0 xs)
 2. \<And>n. \<forall>xs. set (drop (Suc n) xs) \<subseteq> set (drop n xs) \<Longrightarrow> \<forall>xs. set (drop (Suc (Suc n)) xs) \<subseteq> set (drop (Suc n) xs)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>xs. set (drop (Suc 0) xs) \<subseteq> set xs
 2. \<And>n. \<forall>xs. set (drop (Suc n) xs) \<subseteq> set (drop n xs) \<Longrightarrow> \<forall>xs. set (drop (Suc (Suc n)) xs) \<subseteq> set (drop (Suc n) xs)
[PROOF STEP]
apply (intro strip)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xs. set (drop (Suc 0) xs) \<subseteq> set xs
 2. \<And>n. \<forall>xs. set (drop (Suc n) xs) \<subseteq> set (drop n xs) \<Longrightarrow> \<forall>xs. set (drop (Suc (Suc n)) xs) \<subseteq> set (drop (Suc n) xs)
[PROOF STEP]
apply (rule list.induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>xs. set (drop (Suc 0) []) \<subseteq> set []
 2. \<And>xs x1 x2. set (drop (Suc 0) x2) \<subseteq> set x2 \<Longrightarrow> set (drop (Suc 0) (x1 # x2)) \<subseteq> set (x1 # x2)
 3. \<And>n. \<forall>xs. set (drop (Suc n) xs) \<subseteq> set (drop n xs) \<Longrightarrow> \<forall>xs. set (drop (Suc (Suc n)) xs) \<subseteq> set (drop (Suc n) xs)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xs x1 x2. set (drop (Suc 0) x2) \<subseteq> set x2 \<Longrightarrow> set (drop (Suc 0) (x1 # x2)) \<subseteq> set (x1 # x2)
 2. \<And>n. \<forall>xs. set (drop (Suc n) xs) \<subseteq> set (drop n xs) \<Longrightarrow> \<forall>xs. set (drop (Suc (Suc n)) xs) \<subseteq> set (drop (Suc n) xs)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x1 x2. set (drop (Suc 0) x2) \<subseteq> set x2 \<Longrightarrow> set x2 \<subseteq> insert x1 (set x2)
 2. \<And>n. \<forall>xs. set (drop (Suc n) xs) \<subseteq> set (drop n xs) \<Longrightarrow> \<forall>xs. set (drop (Suc (Suc n)) xs) \<subseteq> set (drop (Suc n) xs)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<forall>xs. set (drop (Suc n) xs) \<subseteq> set (drop n xs) \<Longrightarrow> \<forall>xs. set (drop (Suc (Suc n)) xs) \<subseteq> set (drop (Suc n) xs)
[PROOF STEP]
apply (intro strip)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n xs. \<forall>xs. set (drop (Suc n) xs) \<subseteq> set (drop n xs) \<Longrightarrow> set (drop (Suc (Suc n)) xs) \<subseteq> set (drop (Suc n) xs)
[PROOF STEP]
apply (rule_tac P="\<lambda> xs. set (drop (Suc (Suc n)) xs) \<subseteq> set (drop (Suc n) xs)" in list.induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n xs. \<forall>xs. set (drop (Suc n) xs) \<subseteq> set (drop n xs) \<Longrightarrow> set (drop (Suc (Suc n)) []) \<subseteq> set (drop (Suc n) [])
 2. \<And>n xs x1 x2. \<lbrakk>\<forall>xs. set (drop (Suc n) xs) \<subseteq> set (drop n xs); set (drop (Suc (Suc n)) x2) \<subseteq> set (drop (Suc n) x2)\<rbrakk> \<Longrightarrow> set (drop (Suc (Suc n)) (x1 # x2)) \<subseteq> set (drop (Suc n) (x1 # x2))
[PROOF STEP]
apply simp+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma min_int_poly_0 [simp]: "min_int_poly (0 :: 'a :: {field_char_0, field_gcd}) = [:0, 1:]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min_int_poly (0::'a) = [:0, 1:]
[PROOF STEP]
using min_int_poly_of_int[of 0]
[PROOF STATE]
proof (prove)
using this:
min_int_poly (of_int 0) = [:- of_int 0, 1:]

goal (1 subgoal):
 1. min_int_poly (0::'a) = [:0, 1:]
[PROOF STEP]
unfolding of_int_0
[PROOF STATE]
proof (prove)
using this:
min_int_poly (0::?'a) = [:- 0, 1:]

goal (1 subgoal):
 1. min_int_poly (0::'a) = [:0, 1:]
[PROOF STEP]
by simp


[STATEMENT]
lemma surj_on_Un_left: "
  surj_on f (A1 \<union> A2) B =
  (\<exists>B1. \<exists>B2. B \<subseteq> B1 \<union> B2 \<and> surj_on f A1 B1 \<and> surj_on f A2 B2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. surj_on f (A1 \<union> A2) B = (\<exists>B1 B2. B \<subseteq> B1 \<union> B2 \<and> surj_on f A1 B1 \<and> surj_on f A2 B2)
[PROOF STEP]
unfolding surj_on_image_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (B \<subseteq> f ` (A1 \<union> A2)) = (\<exists>B1 B2. B \<subseteq> B1 \<union> B2 \<and> B1 \<subseteq> f ` A1 \<and> B2 \<subseteq> f ` A2)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. B \<subseteq> f ` (A1 \<union> A2) \<Longrightarrow> \<exists>B1 B2. B \<subseteq> B1 \<union> B2 \<and> B1 \<subseteq> f ` A1 \<and> B2 \<subseteq> f ` A2
 2. \<exists>B1 B2. B \<subseteq> B1 \<union> B2 \<and> B1 \<subseteq> f ` A1 \<and> B2 \<subseteq> f ` A2 \<Longrightarrow> B \<subseteq> f ` (A1 \<union> A2)
[PROOF STEP]
apply (rule_tac x="f ` A1" in exI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. B \<subseteq> f ` (A1 \<union> A2) \<Longrightarrow> \<exists>B2. B \<subseteq> f ` A1 \<union> B2 \<and> f ` A1 \<subseteq> f ` A1 \<and> B2 \<subseteq> f ` A2
 2. \<exists>B1 B2. B \<subseteq> B1 \<union> B2 \<and> B1 \<subseteq> f ` A1 \<and> B2 \<subseteq> f ` A2 \<Longrightarrow> B \<subseteq> f ` (A1 \<union> A2)
[PROOF STEP]
apply (rule_tac x="f ` A2" in exI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. B \<subseteq> f ` (A1 \<union> A2) \<Longrightarrow> B \<subseteq> f ` A1 \<union> f ` A2 \<and> f ` A1 \<subseteq> f ` A1 \<and> f ` A2 \<subseteq> f ` A2
 2. \<exists>B1 B2. B \<subseteq> B1 \<union> B2 \<and> B1 \<subseteq> f ` A1 \<and> B2 \<subseteq> f ` A2 \<Longrightarrow> B \<subseteq> f ` (A1 \<union> A2)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B1 B2. B \<subseteq> B1 \<union> B2 \<and> B1 \<subseteq> f ` A1 \<and> B2 \<subseteq> f ` A2 \<Longrightarrow> B \<subseteq> f ` (A1 \<union> A2)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma measure_translation_subtract:
  "measure lebesgue ((\<lambda>x. x - a) ` S) = measure lebesgue S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue ((\<lambda>x. x - a) ` S) = Sigma_Algebra.measure lebesgue S
[PROOF STEP]
using measure_translation [of "- a"]
[PROOF STATE]
proof (prove)
using this:
Sigma_Algebra.measure lebesgue ((+) (- a) ` ?S) = Sigma_Algebra.measure lebesgue ?S

goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue ((\<lambda>x. x - a) ` S) = Sigma_Algebra.measure lebesgue S
[PROOF STEP]
by (simp cong: image_cong_simp)


[STATEMENT]
lemma take_bit_numeral_minus_bit0:
  \<open>take_bit (numeral l) (- numeral (Num.Bit0 k)) = take_bit (pred_numeral l) (- numeral k) * (2 :: int)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit (numeral l) (- numeral (num.Bit0 k)) = take_bit (pred_numeral l) (- numeral k) * 2
[PROOF STEP]
by (simp add: numeral_eq_Suc numeral_Bit0_div_2 take_bit_Suc_minus_bit0)


[STATEMENT]
lemma rtranclp_all_imp_rel: "r\<^sup>*\<^sup>* x y \<Longrightarrow> \<forall>a b. r a b \<longrightarrow> r' a b \<Longrightarrow> r'\<^sup>*\<^sup>* x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r\<^sup>*\<^sup>* x y; \<forall>a b. r a b \<longrightarrow> r' a b\<rbrakk> \<Longrightarrow> r'\<^sup>*\<^sup>* x y
[PROOF STEP]
by (metis mono_rtranclp)


[STATEMENT]
lemma euclidean_size_lcm_le2:
  "a \<noteq> 0 \<Longrightarrow> b \<noteq> 0 \<Longrightarrow> euclidean_size b \<le> euclidean_size (lcm a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<noteq> (0::'a); b \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> euclidean_size b \<le> euclidean_size (lcm a b)
[PROOF STEP]
using euclidean_size_lcm_le1 [of b a]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>b \<noteq> (0::'a); a \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> euclidean_size b \<le> euclidean_size (lcm b a)

goal (1 subgoal):
 1. \<lbrakk>a \<noteq> (0::'a); b \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> euclidean_size b \<le> euclidean_size (lcm a b)
[PROOF STEP]
by (simp add: ac_simps)


[STATEMENT]
lemma map_idx_append: "map_idx f (xs @ ys) n = (map_idx f xs n) @ (map_idx f ys (n + length xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_idx f (xs @ ys) n = map_idx f xs n @ map_idx f ys (n + length xs)
[PROOF STEP]
by (simp add: map_idx_eq_map2 ab_semigroup_add_class.add_ac(1) zip_append1)


[STATEMENT]
lemma DERIV_neg_dec_left:
  fixes f :: "real \<Rightarrow> real"
  assumes der: "DERIV f x :> l"
    and l: "l < 0"
  shows "\<exists>d > 0. \<forall>h > 0. h < d \<longrightarrow> f x < f (x - h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>d>0. \<forall>h>0. h < d \<longrightarrow> f x < f (x - h)
[PROOF STEP]
using has_real_derivative_neg_dec_left[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<exists>d>0. \<forall>h>0. x - h \<in> UNIV \<longrightarrow> h < d \<longrightarrow> f x < f (x - h)

goal (1 subgoal):
 1. \<exists>d>0. \<forall>h>0. h < d \<longrightarrow> f x < f (x - h)
[PROOF STEP]
by auto


[STATEMENT]
lemma Jacobi_mult_right [simp]: "Jacobi a (n * m) = Jacobi a n * Jacobi a m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Jacobi a (n * m) = Jacobi a n * Jacobi a m
[PROOF STEP]
by (cases "m = 0"; cases "n = 0")
     (auto simp: Jacobi_def prime_factorization_mult)


[STATEMENT]
lemma cscalar_prod_vec_of_basis_enum: "cscalar_prod (vec_of_basis_enum \<phi>) (vec_of_basis_enum \<psi>) = cinner \<psi> \<phi>"
  for \<psi> :: "'a::onb_enum"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_basis_enum \<phi> \<bullet>c vec_of_basis_enum \<psi> = \<psi> \<bullet>\<^sub>C \<phi>
[PROOF STEP]
apply (subst cinner_basis_enum_of_vec[symmetric, where 'a='a])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. dim_vec (vec_of_basis_enum \<psi>) = length canonical_basis
 2. dim_vec (vec_of_basis_enum \<phi>) = length canonical_basis
 3. basis_enum_of_vec (vec_of_basis_enum \<psi>) \<bullet>\<^sub>C basis_enum_of_vec (vec_of_basis_enum \<phi>) = \<psi> \<bullet>\<^sub>C \<phi>
[PROOF STEP]
by simp_all


[STATEMENT]
lemma Inf_UNIV_nat: "(Inf UNIV :: nat) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter> UNIV = 0
[PROOF STEP]
by (simp add: cInf_eq_minimum)


[STATEMENT]
lemma real_of_nat_less_inverse_iff: "0 < u \<Longrightarrow> u < inverse (real(Suc n)) \<longleftrightarrow> real(Suc n) < inverse u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < u \<Longrightarrow> (u < inverse (real (Suc n))) = (real (Suc n) < inverse u)
[PROOF STEP]
using less_imp_inverse_less
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a < ?b; (0::?'a) < ?a\<rbrakk> \<Longrightarrow> inverse ?b < inverse ?a

goal (1 subgoal):
 1. 0 < u \<Longrightarrow> (u < inverse (real (Suc n))) = (real (Suc n) < inverse u)
[PROOF STEP]
by force