[STATEMENT]
lemma [code abstract]: "vec_nth (a * b) =  (%i. a$i * b$i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) (a * b) = (\<lambda>i. a $ i * b $ i)
[PROOF STEP]
unfolding vector_mult_component
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. a $ i * b $ i) = (\<lambda>i. a $ i * b $ i)
[PROOF STEP]
by auto


[STATEMENT]
lemma set_neg_intro2: "a \<in> C \<Longrightarrow> - a \<in> (- 1) *o C"
  for a :: "'a::ring_1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> C \<Longrightarrow> - a \<in> - (1::'a) *o C
[PROOF STEP]
by (auto simp add: elt_set_times_def)


[STATEMENT]
lemma ennreal_add_left_cancel: "a + b = a + c \<longleftrightarrow> a = (\<infinity>::ennreal) \<or> b = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a + b = a + c) = (a = \<infinity> \<or> b = c)
[PROOF STEP]
unfolding infinity_ennreal_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a + b = a + c) = (a = top \<or> b = c)
[PROOF STEP]
by transfer (simp add: top_ereal_def ereal_add_cancel_left)


[STATEMENT]
lemma has_integral_const_real [intro]:
  fixes a b :: real
  shows "((\<lambda>x. c) has_integral (content {a..b} *\<^sub>R c)) {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. c) has_integral content {a..b} *\<^sub>R c) {a..b}
[PROOF STEP]
by (metis box_real(2) has_integral_const)


[STATEMENT]
lemma i_Exec_Stream_Pre_Post2: "
  \<lbrakk> c_n = (i_Exec_Comp_Stream trans_fun input c)\<^bsup>\<leftarrow> c\<^esup> n; x_n = input n \<rbrakk> \<Longrightarrow>
  (P c_n \<longrightarrow> Q (input n) (i_Exec_Comp_Stream trans_fun input c n)) =
  (P c_n \<longrightarrow> Q x_n (trans_fun x_n c_n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>c_n = (i_Exec_Comp_Stream trans_fun input c)\<^bsup>\<leftarrow> c\<^esup> n; x_n = input n\<rbrakk> \<Longrightarrow> (P c_n \<longrightarrow> Q (input n) (i_Exec_Comp_Stream trans_fun input c n)) = (P c_n \<longrightarrow> Q x_n (trans_fun x_n c_n))
[PROOF STEP]
by (simp add: i_Exec_Stream_nth_calc_Previous)


[STATEMENT]
lemma ennreal_le_iff[simp]: "0 \<le> y \<Longrightarrow> ennreal x \<le> ennreal y \<longleftrightarrow> x \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> y \<Longrightarrow> (ennreal x \<le> ennreal y) = (x \<le> y)
[PROOF STEP]
by (auto simp: ennreal_def zero_ereal_def less_eq_ennreal.abs_eq eq_onp_def split: split_max)


[STATEMENT]
lemma monomial_inj:
  "monomial c s = monomial (d::'b::zero_neq_one) t \<longleftrightarrow> (c = 0 \<and> d = 0) \<or> (c = d \<and> s = t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (monomial c s = monomial d t) = (c = (0::'b) \<and> d = (0::'b) \<or> c = d \<and> s = t)
[PROOF STEP]
by (fastforce simp add: monomial_inj Poly_Mapping.single_def
    poly_mapping.Abs_poly_mapping_inject when_def fun_eq_iff
    cong: if_cong
    split: if_splits)


[STATEMENT]
lemma (in Corps) value_ge_add:"\<lbrakk>valuation K v; \<forall>j \<le> n. f j \<in> carrier K;
                     \<forall>j \<le> n. z \<le> ((v \<circ> f) j)\<rbrakk>  \<Longrightarrow> z \<le> (v (\<Sigma>\<^sub>e K f n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valuation K v; \<forall>j\<le>n. f j \<in> carrier K; \<forall>j\<le>n. z \<le> (v \<circ> f) j\<rbrakk> \<Longrightarrow> z \<le> v (\<Sigma>\<^sub>e K f n)
[PROOF STEP]
apply (frule Amin_le_add[of v n f], assumption+,
       cut_tac Amin_ge[of n "v \<circ> f" z],
       rule ale_trans, assumption+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>valuation K v; \<forall>j\<le>n. f j \<in> carrier K; \<forall>j\<le>n. z \<le> (v \<circ> f) j; Amin n (v \<circ> f) \<le> v (\<Sigma>\<^sub>e K f n)\<rbrakk> \<Longrightarrow> \<forall>j\<le>n. (v \<circ> f) j \<in> Z\<^sub>\<infinity>
 2. \<lbrakk>valuation K v; \<forall>j\<le>n. f j \<in> carrier K; \<forall>j\<le>n. z \<le> (v \<circ> f) j; Amin n (v \<circ> f) \<le> v (\<Sigma>\<^sub>e K f n)\<rbrakk> \<Longrightarrow> \<forall>j\<le>n. z \<le> (v \<circ> f) j
[PROOF STEP]
apply (rule allI, rule impI,
       simp add:comp_def Zset_def,
       rule value_in_aug_inf[of v], assumption+, simp+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma consistent_prv_eql_pls_plus_rev:
assumes "consistent" "prv (eql (pls (Num m) (Num n)) (Num k))"
shows "k = m + n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k = m + n
[PROOF STEP]
by (metis Num assms consistent_def eql not_plus_prv_neg_eql_pls num pls prv_neg_fls subsetCE)


[STATEMENT]
lemma Arr_Subst:
    assumes "Arr v"
    shows "Arr t \<Longrightarrow> Arr (Subst n v t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arr t \<Longrightarrow> Arr (Subst n v t)
[PROOF STEP]
using assms Arr_Raise FV_Subst
[PROOF STATE]
proof (prove)
using this:
Arr v
Arr ?t = Arr (Raise ?d ?n ?t)
FV (Subst ?d ?v ?t) = FV ?t \<inter> {x. x < ?d} \<union> (\<lambda>x. x - 1) ` {x. ?d < x \<and> x \<in> FV ?t} \<union> (\<lambda>x. x + ?d) ` {x. ?d \<in> FV ?t \<and> x \<in> FV ?v}

goal (1 subgoal):
 1. Arr t \<Longrightarrow> Arr (Subst n v t)
[PROOF STEP]
by (induct t arbitrary: n) auto


[STATEMENT]
theorem supplement1_Jacobi:
  "odd p \<Longrightarrow> 1 < p \<Longrightarrow> Jacobi (-1) p = (-1) ^ (nat ((p - 1) div 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>odd p; 1 < p\<rbrakk> \<Longrightarrow> Jacobi (- 1) p = (- 1) ^ nat ((p - 1) div 2)
[PROOF STEP]
proof (induction p rule: prime_divisors_induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<lbrakk>odd 0; 1 < 0\<rbrakk> \<Longrightarrow> Jacobi (- 1) 0 = (- 1) ^ nat ((0 - 1) div 2)
 2. \<And>x. \<lbrakk>is_unit x; odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2)
 3. \<And>p x. \<lbrakk>prime p; \<lbrakk>odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2); odd (p * x); 1 < p * x\<rbrakk> \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
case (factor p x)
[PROOF STATE]
proof (state)
this:
prime p
\<lbrakk>odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2)
odd (p * x)
1 < p * x

goal (3 subgoals):
 1. \<lbrakk>odd 0; 1 < 0\<rbrakk> \<Longrightarrow> Jacobi (- 1) 0 = (- 1) ^ nat ((0 - 1) div 2)
 2. \<And>x. \<lbrakk>is_unit x; odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2)
 3. \<And>p x. \<lbrakk>prime p; \<lbrakk>odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2); odd (p * x); 1 < p * x\<rbrakk> \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prime p
\<lbrakk>odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2)
odd (p * x)
1 < p * x
[PROOF STEP]
have "odd x"
[PROOF STATE]
proof (prove)
using this:
prime p
\<lbrakk>odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2)
odd (p * x)
1 < p * x

goal (1 subgoal):
 1. odd x
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
odd x

goal (3 subgoals):
 1. \<lbrakk>odd 0; 1 < 0\<rbrakk> \<Longrightarrow> Jacobi (- 1) 0 = (- 1) ^ nat ((0 - 1) div 2)
 2. \<And>x. \<lbrakk>is_unit x; odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2)
 3. \<And>p x. \<lbrakk>prime p; \<lbrakk>odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2); odd (p * x); 1 < p * x\<rbrakk> \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
have "2 < p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 < p
[PROOF STEP]
using \<open>odd (p * x)\<close> prime_gt_1_int[OF \<open>prime p\<close>]
[PROOF STATE]
proof (prove)
using this:
odd (p * x)
1 < p

goal (1 subgoal):
 1. 2 < p
[PROOF STEP]
by (cases "p = 2") auto
[PROOF STATE]
proof (state)
this:
2 < p

goal (3 subgoals):
 1. \<lbrakk>odd 0; 1 < 0\<rbrakk> \<Longrightarrow> Jacobi (- 1) 0 = (- 1) ^ nat ((0 - 1) div 2)
 2. \<And>x. \<lbrakk>is_unit x; odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2)
 3. \<And>p x. \<lbrakk>prime p; \<lbrakk>odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2); odd (p * x); 1 < p * x\<rbrakk> \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
have "prime (nat p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime (nat p)
[PROOF STEP]
using \<open>prime p\<close> prime_int_nat_transfer
[PROOF STATE]
proof (prove)
using this:
prime p
prime ?k = (0 \<le> ?k \<and> prime (nat ?k))

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

goal (3 subgoals):
 1. \<lbrakk>odd 0; 1 < 0\<rbrakk> \<Longrightarrow> Jacobi (- 1) 0 = (- 1) ^ nat ((0 - 1) div 2)
 2. \<And>x. \<lbrakk>is_unit x; odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2)
 3. \<And>p x. \<lbrakk>prime p; \<lbrakk>odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2); odd (p * x); 1 < p * x\<rbrakk> \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
have "Jacobi (-1) p = Legendre (-1) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Jacobi (- 1) p = Legendre (- 1) p
[PROOF STEP]
using prime_p_Jacobi_eq_Legendre[OF \<open>prime p\<close>]
[PROOF STATE]
proof (prove)
using this:
Jacobi ?a p = Legendre ?a p

goal (1 subgoal):
 1. Jacobi (- 1) p = Legendre (- 1) p
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Jacobi (- 1) p = Legendre (- 1) p

goal (3 subgoals):
 1. \<lbrakk>odd 0; 1 < 0\<rbrakk> \<Longrightarrow> Jacobi (- 1) 0 = (- 1) ^ nat ((0 - 1) div 2)
 2. \<And>x. \<lbrakk>is_unit x; odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2)
 3. \<And>p x. \<lbrakk>prime p; \<lbrakk>odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2); odd (p * x); 1 < p * x\<rbrakk> \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Jacobi (- 1) p = Legendre (- 1) p

goal (3 subgoals):
 1. \<lbrakk>odd 0; 1 < 0\<rbrakk> \<Longrightarrow> Jacobi (- 1) 0 = (- 1) ^ nat ((0 - 1) div 2)
 2. \<And>x. \<lbrakk>is_unit x; odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2)
 3. \<And>p x. \<lbrakk>prime p; \<lbrakk>odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2); odd (p * x); 1 < p * x\<rbrakk> \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
have "... = (-1) ^ ((nat p - 1) div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Legendre (- 1) p = (- 1) ^ ((nat p - 1) div 2)
[PROOF STEP]
using \<open>prime p\<close> \<open>2 < p\<close> and supplement1_Legendre[of "nat p"]
[PROOF STATE]
proof (prove)
using this:
prime p
2 < p
\<lbrakk>prime (nat p); 2 < nat p\<rbrakk> \<Longrightarrow> Legendre (- 1) (int (nat p)) = (- 1) ^ ((nat p - 1) div 2)

goal (1 subgoal):
 1. Legendre (- 1) p = (- 1) ^ ((nat p - 1) div 2)
[PROOF STEP]
by (metis int_nat_eq nat_mono_iff nat_numeral_as_int prime_gt_0_int prime_int_nat_transfer)
[PROOF STATE]
proof (state)
this:
Legendre (- 1) p = (- 1) ^ ((nat p - 1) div 2)

goal (3 subgoals):
 1. \<lbrakk>odd 0; 1 < 0\<rbrakk> \<Longrightarrow> Jacobi (- 1) 0 = (- 1) ^ nat ((0 - 1) div 2)
 2. \<And>x. \<lbrakk>is_unit x; odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2)
 3. \<And>p x. \<lbrakk>prime p; \<lbrakk>odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2); odd (p * x); 1 < p * x\<rbrakk> \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Legendre (- 1) p = (- 1) ^ ((nat p - 1) div 2)

goal (3 subgoals):
 1. \<lbrakk>odd 0; 1 < 0\<rbrakk> \<Longrightarrow> Jacobi (- 1) 0 = (- 1) ^ nat ((0 - 1) div 2)
 2. \<And>x. \<lbrakk>is_unit x; odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2)
 3. \<And>p x. \<lbrakk>prime p; \<lbrakk>odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2); odd (p * x); 1 < p * x\<rbrakk> \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
have "((nat p - 1) div 2) = nat ((p - 1) div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (nat p - 1) div 2 = nat ((p - 1) div 2)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(nat p - 1) div 2 = nat ((p - 1) div 2)

goal (3 subgoals):
 1. \<lbrakk>odd 0; 1 < 0\<rbrakk> \<Longrightarrow> Jacobi (- 1) 0 = (- 1) ^ nat ((0 - 1) div 2)
 2. \<And>x. \<lbrakk>is_unit x; odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2)
 3. \<And>p x. \<lbrakk>prime p; \<lbrakk>odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2); odd (p * x); 1 < p * x\<rbrakk> \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Jacobi (- 1) p = (- 1) ^ nat ((p - 1) div 2)
[PROOF STEP]
have base_case: "Jacobi (-1) p = (-1) ^ nat ((p - 1) div 2)"
[PROOF STATE]
proof (prove)
using this:
Jacobi (- 1) p = (- 1) ^ nat ((p - 1) div 2)

goal (1 subgoal):
 1. Jacobi (- 1) p = (- 1) ^ nat ((p - 1) div 2)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Jacobi (- 1) p = (- 1) ^ nat ((p - 1) div 2)

goal (3 subgoals):
 1. \<lbrakk>odd 0; 1 < 0\<rbrakk> \<Longrightarrow> Jacobi (- 1) 0 = (- 1) ^ nat ((0 - 1) div 2)
 2. \<And>x. \<lbrakk>is_unit x; odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2)
 3. \<And>p x. \<lbrakk>prime p; \<lbrakk>odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2); odd (p * x); 1 < p * x\<rbrakk> \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
proof (cases "x = 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = 1 \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
 2. x \<noteq> 1 \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = 1

goal (2 subgoals):
 1. x = 1 \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
 2. x \<noteq> 1 \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = 1

goal (1 subgoal):
 1. Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
using base_case
[PROOF STATE]
proof (prove)
using this:
x = 1
Jacobi (- 1) p = (- 1) ^ nat ((p - 1) div 2)

goal (1 subgoal):
 1. Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> 1

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
have "0 < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x
[PROOF STEP]
using \<open>1 < (p * x)\<close> prime_gt_0_int[OF \<open>prime p\<close>]
[PROOF STATE]
proof (prove)
using this:
1 < p * x
0 < p

goal (1 subgoal):
 1. 0 < x
[PROOF STEP]
by (meson int_one_le_iff_zero_less not_less not_less_iff_gr_or_eq zero_less_mult_iff)
[PROOF STATE]
proof (state)
this:
0 < x

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
have "odd p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. odd p
[PROOF STEP]
using \<open>prime p\<close> \<open>2 < p\<close>
[PROOF STATE]
proof (prove)
using this:
prime p
2 < p

goal (1 subgoal):
 1. odd p
[PROOF STEP]
by (simp add: prime_odd_int)
[PROOF STATE]
proof (state)
this:
odd p

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
have "Jacobi (-1) (p * x) = Jacobi (-1) p * Jacobi (-1) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Jacobi (- 1) (p * x) = Jacobi (- 1) p * Jacobi (- 1) x
[PROOF STEP]
using \<open>2 < p\<close> \<open>0 < x\<close>
[PROOF STATE]
proof (prove)
using this:
2 < p
0 < x

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

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Jacobi (- 1) (p * x) = Jacobi (- 1) p * Jacobi (- 1) x

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
note base_case
[PROOF STATE]
proof (state)
this:
Jacobi (- 1) p = (- 1) ^ nat ((p - 1) div 2)

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Jacobi (- 1) p = (- 1) ^ nat ((p - 1) div 2)

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
have "Jacobi (-1) x = (-1) ^ nat ((x - 1) div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2)
[PROOF STEP]
using \<open>0 < x\<close> False \<open>odd x\<close> factor.IH
[PROOF STATE]
proof (prove)
using this:
0 < x
x \<noteq> 1
odd x
\<lbrakk>odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2)

goal (1 subgoal):
 1. Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2)

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2)

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
have "(- 1) ^ nat ((p - 1) div 2) * (- 1) ^ nat ((x - 1) div 2) =
               (- 1 :: int) ^ nat ((p*x - 1) div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 1) ^ nat ((p - 1) div 2) * (- 1) ^ nat ((x - 1) div 2) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
unfolding minus_one_power_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if even (nat ((p - 1) div 2)) then 1 else - 1) * (if even (nat ((x - 1) div 2)) then 1 else - 1) = (if even (nat ((p * x - 1) div 2)) then 1 else - 1)
[PROOF STEP]
using \<open>2 < p\<close> \<open>0 < x\<close> and \<open>odd x\<close> \<open>odd p\<close>
[PROOF STATE]
proof (prove)
using this:
2 < p
0 < x
odd x
odd p

goal (1 subgoal):
 1. (if even (nat ((p - 1) div 2)) then 1 else - 1) * (if even (nat ((x - 1) div 2)) then 1 else - 1) = (if even (nat ((p * x - 1) div 2)) then 1 else - 1)
[PROOF STEP]
by (fastforce elim!: oddE simp: even_nat_iff algebra_simps)
[PROOF STATE]
proof (state)
this:
(- 1) ^ nat ((p - 1) div 2) * (- 1) ^ nat ((x - 1) div 2) = (- 1) ^ nat ((p * x - 1) div 2)

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)

goal (1 subgoal):
 1. Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Jacobi (- 1) (p * x) = (- 1) ^ nat ((p * x - 1) div 2)

goal (2 subgoals):
 1. \<lbrakk>odd 0; 1 < 0\<rbrakk> \<Longrightarrow> Jacobi (- 1) 0 = (- 1) ^ nat ((0 - 1) div 2)
 2. \<And>x. \<lbrakk>is_unit x; odd x; 1 < x\<rbrakk> \<Longrightarrow> Jacobi (- 1) x = (- 1) ^ nat ((x - 1) div 2)
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma chain_map_id_gen:
   "\<lbrakk>singular_chain p X c; \<And>x. x \<in> topspace X \<Longrightarrow> f x = x\<rbrakk>
    \<Longrightarrow>  chain_map p f c = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>singular_chain p X c; \<And>x. x \<in> topspace X \<Longrightarrow> f x = x\<rbrakk> \<Longrightarrow> chain_map p f c = c
[PROOF STEP]
unfolding singular_chain_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Poly_Mapping.keys c \<subseteq> singular_simplex_set p X; \<And>x. x \<in> topspace X \<Longrightarrow> f x = x\<rbrakk> \<Longrightarrow> chain_map p f c = c
[PROOF STEP]
by (erule frag_induction) (auto simp: chain_map_diff simplex_map_id_gen)


[STATEMENT]
lemma omega_simulation_2:
  "y * x \<le> x * y \<Longrightarrow> (x * y)\<^sup>\<omega> \<le> x\<^sup>\<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y * x \<le> x * y \<Longrightarrow> (x * y)\<^sup>\<omega> \<le> x\<^sup>\<omega>
[PROOF STEP]
by (metis mult_right_isotone sup.absorb2 omega_induct_mult omega_slide omega_sub_dist)


[STATEMENT]
lemma  left_diff_distrib: "(x - y) \<times> z = x \<times> z - y \<times> z" for x::"real^3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x - y) \<times> z = x \<times> z - y \<times> z
[PROOF STEP]
by (simp add: cross3_simps)


[STATEMENT]
lemma separating_hyperplane_set_point_inaff:
  fixes S :: "'a::euclidean_space set"
  assumes "convex S" "S \<noteq> {}" and zno: "z \<notin> S"
  obtains a b where "(z + a) \<in> affine hull (insert z S)"
                and "a \<noteq> 0" and "a \<bullet> z \<le> b"
                and "\<And>x. x \<in> S \<Longrightarrow> a \<bullet> x \<ge> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>z + a \<in> affine hull insert z S; a \<noteq> (0::'a); a \<bullet> z \<le> b; \<And>x. x \<in> S \<Longrightarrow> b \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>z + a \<in> affine hull insert z S; a \<noteq> (0::'a); a \<bullet> z \<le> b; \<And>x. x \<in> S \<Longrightarrow> b \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from separating_hyperplane_set_0_inspan [of "image (\<lambda>x. -z + x) S"]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>convex ((+) (- z) ` S); (+) (- z) ` S \<noteq> {}; (0::'a) \<notin> (+) (- z) ` S; \<And>a. \<lbrakk>a \<in> span ((+) (- z) ` S); a \<noteq> (0::'a); \<And>x. x \<in> (+) (- z) ` S \<Longrightarrow> 0 \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
[PROOF STEP]
have "convex ((+) (- z) ` S)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>convex ((+) (- z) ` S); (+) (- z) ` S \<noteq> {}; (0::'a) \<notin> (+) (- z) ` S; \<And>a. \<lbrakk>a \<in> span ((+) (- z) ` S); a \<noteq> (0::'a); \<And>x. x \<in> (+) (- z) ` S \<Longrightarrow> 0 \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. convex ((+) (- z) ` S)
[PROOF STEP]
using \<open>convex S\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>convex ((+) (- z) ` S); (+) (- z) ` S \<noteq> {}; (0::'a) \<notin> (+) (- z) ` S; \<And>a. \<lbrakk>a \<in> span ((+) (- z) ` S); a \<noteq> (0::'a); \<And>x. x \<in> (+) (- z) ` S \<Longrightarrow> 0 \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
convex S

goal (1 subgoal):
 1. convex ((+) (- z) ` S)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
convex ((+) (- z) ` S)

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>z + a \<in> affine hull insert z S; a \<noteq> (0::'a); a \<bullet> z \<le> b; \<And>x. x \<in> S \<Longrightarrow> b \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
convex ((+) (- z) ` S)

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>z + a \<in> affine hull insert z S; a \<noteq> (0::'a); a \<bullet> z \<le> b; \<And>x. x \<in> S \<Longrightarrow> b \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "(+) (- z) ` S \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (+) (- z) ` S \<noteq> {}
[PROOF STEP]
by (simp add: \<open>S \<noteq> {}\<close>)
[PROOF STATE]
proof (state)
this:
(+) (- z) ` S \<noteq> {}

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>z + a \<in> affine hull insert z S; a \<noteq> (0::'a); a \<bullet> z \<le> b; \<And>x. x \<in> S \<Longrightarrow> b \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(+) (- z) ` S \<noteq> {}

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>z + a \<in> affine hull insert z S; a \<noteq> (0::'a); a \<bullet> z \<le> b; \<And>x. x \<in> S \<Longrightarrow> b \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "0 \<notin> (+) (- z) ` S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<notin> (+) (- z) ` S
[PROOF STEP]
using zno
[PROOF STATE]
proof (prove)
using this:
z \<notin> S

goal (1 subgoal):
 1. (0::'a) \<notin> (+) (- z) ` S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(0::'a) \<notin> (+) (- z) ` S

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>z + a \<in> affine hull insert z S; a \<noteq> (0::'a); a \<bullet> z \<le> b; \<And>x. x \<in> S \<Longrightarrow> b \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
convex ((+) (- z) ` S)
(+) (- z) ` S \<noteq> {}
(0::'a) \<notin> (+) (- z) ` S
[PROOF STEP]
obtain a where "a \<in> span ((+) (- z) ` S)" "a \<noteq> 0"
                  and a:  "\<And>x. x \<in> ((+) (- z) ` S) \<Longrightarrow> 0 \<le> a \<bullet> x"
[PROOF STATE]
proof (prove)
using this:
convex ((+) (- z) ` S)
(+) (- z) ` S \<noteq> {}
(0::'a) \<notin> (+) (- z) ` S

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> span ((+) (- z) ` S); a \<noteq> (0::'a); \<And>x. x \<in> (+) (- z) ` S \<Longrightarrow> 0 \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using separating_hyperplane_set_0_inspan [of "image (\<lambda>x. -z + x) S"]
[PROOF STATE]
proof (prove)
using this:
convex ((+) (- z) ` S)
(+) (- z) ` S \<noteq> {}
(0::'a) \<notin> (+) (- z) ` S
\<lbrakk>convex ((+) (- z) ` S); (+) (- z) ` S \<noteq> {}; (0::'a) \<notin> (+) (- z) ` S; \<And>a. \<lbrakk>a \<in> span ((+) (- z) ` S); a \<noteq> (0::'a); \<And>x. x \<in> (+) (- z) ` S \<Longrightarrow> 0 \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> span ((+) (- z) ` S); a \<noteq> (0::'a); \<And>x. x \<in> (+) (- z) ` S \<Longrightarrow> 0 \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a \<in> span ((+) (- z) ` S)
a \<noteq> (0::'a)
?x \<in> (+) (- z) ` S \<Longrightarrow> 0 \<le> a \<bullet> ?x

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>z + a \<in> affine hull insert z S; a \<noteq> (0::'a); a \<bullet> z \<le> b; \<And>x. x \<in> S \<Longrightarrow> b \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> span ((+) (- z) ` S)
a \<noteq> (0::'a)
?x \<in> (+) (- z) ` S \<Longrightarrow> 0 \<le> a \<bullet> ?x
[PROOF STEP]
have szx: "\<And>x. x \<in> S \<Longrightarrow> a \<bullet> z \<le> a \<bullet> x"
[PROOF STATE]
proof (prove)
using this:
a \<in> span ((+) (- z) ` S)
a \<noteq> (0::'a)
?x \<in> (+) (- z) ` S \<Longrightarrow> 0 \<le> a \<bullet> ?x

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> a \<bullet> z \<le> a \<bullet> x
[PROOF STEP]
by (metis (no_types, lifting) imageI inner_minus_right inner_right_distrib minus_add neg_le_0_iff_le neg_le_iff_le real_add_le_0_iff)
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> a \<bullet> z \<le> a \<bullet> ?x

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>z + a \<in> affine hull insert z S; a \<noteq> (0::'a); a \<bullet> z \<le> b; \<And>x. x \<in> S \<Longrightarrow> b \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> a \<bullet> z \<le> a \<bullet> ?x

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>z + a \<in> affine hull insert z S; a \<noteq> (0::'a); a \<bullet> z \<le> b; \<And>x. x \<in> S \<Longrightarrow> b \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "z + a \<in> affine hull insert z S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z + a \<in> affine hull insert z S
[PROOF STEP]
using \<open>a \<in> span ((+) (- z) ` S)\<close> affine_hull_insert_span_gen
[PROOF STATE]
proof (prove)
using this:
a \<in> span ((+) (- z) ` S)
affine hull insert ?a ?s = (+) ?a ` span ((+) (- ?a) ` ?s)

goal (1 subgoal):
 1. z + a \<in> affine hull insert z S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
z + a \<in> affine hull insert z S

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>z + a \<in> affine hull insert z S; a \<noteq> (0::'a); a \<bullet> z \<le> b; \<And>x. x \<in> S \<Longrightarrow> b \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?x \<in> S \<Longrightarrow> a \<bullet> z \<le> a \<bullet> ?x
z + a \<in> affine hull insert z S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> a \<bullet> z \<le> a \<bullet> ?x
z + a \<in> affine hull insert z S

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using \<open>a \<noteq> 0\<close> szx that
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> a \<bullet> z \<le> a \<bullet> ?x
z + a \<in> affine hull insert z S
a \<noteq> (0::'a)
?x \<in> S \<Longrightarrow> a \<bullet> z \<le> a \<bullet> ?x
\<lbrakk>z + ?a \<in> affine hull insert z S; ?a \<noteq> (0::'a); ?a \<bullet> z \<le> ?b; \<And>x. x \<in> S \<Longrightarrow> ?b \<le> ?a \<bullet> x\<rbrakk> \<Longrightarrow> thesis

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma primitive_part_dvd: "primitive_part a dvd a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primitive_part a dvd a
[PROOF STEP]
by (metis content_times_primitive_part dvd_def dvd_refl mult_smult_right)


[STATEMENT]
lemma set_bset_to_set_bset: "|A| <o natLeq +c |UNIV :: 'k set| \<Longrightarrow>
  set_bset (the_inv set_bset A :: 'a set['k]) = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |A| <o natLeq +c |UNIV| \<Longrightarrow> set_bset (the_inv set_bset A) = A
[PROOF STEP]
apply (rule f_the_inv_into_f[unfolded inj_on_def])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. |A| <o natLeq +c |UNIV| \<Longrightarrow> \<forall>x\<in>UNIV. \<forall>y\<in>UNIV. set_bset x = set_bset y \<longrightarrow> x = y
 2. |A| <o natLeq +c |UNIV| \<Longrightarrow> A \<in> range set_bset
[PROOF STEP]
apply (simp add: set_bset_inject range_eqI Abs_bset_inverse[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |A| <o natLeq +c |UNIV| \<Longrightarrow> A \<in> range set_bset
[PROOF STEP]
apply (rule range_eqI Abs_bset_inverse[symmetric] CollectI)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |A| <o natLeq +c |UNIV| \<Longrightarrow> |A| <o natLeq +c |UNIV|
[PROOF STEP]
.


[STATEMENT]
lemma map_ds_prop:
  fixes f :: "'a::complete_lattice \<Rightarrow> 'b::complete_lattice"
  shows "map_ds f \<circ> ds = ds \<circ> f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_ds f \<circ> ds = ds \<circ> f
[PROOF STEP]
unfolding map_ds_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ds \<circ> f \<circ> SSup \<circ> ds = ds \<circ> f
[PROOF STEP]
by (simp add: SSup_ds_inv comp_assoc)


[STATEMENT]
lemma sum_leaves: "\<lbrakk> inorder t = [i..j];  i \<le> j+1 \<rbrakk> \<Longrightarrow>
  (\<Sum>x\<in>leaves i t. (f(fst x) :: nat)) = sum f {i..j+1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inorder t = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t. f (fst x)) = sum f {i..j + 1}
[PROOF STEP]
proof(induction t arbitrary: i j)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i j. \<lbrakk>inorder \<langle>\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i \<langle>\<rangle>. f (fst x)) = sum f {i..j + 1}
 2. \<And>t1 x2 t2 i j. \<lbrakk>\<And>i j. \<lbrakk>inorder t1 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t1. f (fst x)) = sum f {i..j + 1}; \<And>i j. \<lbrakk>inorder t2 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t2. f (fst x)) = sum f {i..j + 1}; inorder \<langle>t1, x2, t2\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i \<langle>t1, x2, t2\<rangle>. f (fst x)) = sum f {i..j + 1}
[PROOF STEP]
case Leaf
[PROOF STATE]
proof (state)
this:
inorder \<langle>\<rangle> = [i..j]
i \<le> j + 1

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>inorder \<langle>\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i \<langle>\<rangle>. f (fst x)) = sum f {i..j + 1}
 2. \<And>t1 x2 t2 i j. \<lbrakk>\<And>i j. \<lbrakk>inorder t1 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t1. f (fst x)) = sum f {i..j + 1}; \<And>i j. \<lbrakk>inorder t2 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t2. f (fst x)) = sum f {i..j + 1}; inorder \<langle>t1, x2, t2\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i \<langle>t1, x2, t2\<rangle>. f (fst x)) = sum f {i..j + 1}
[PROOF STEP]
hence "i = j+1"
[PROOF STATE]
proof (prove)
using this:
inorder \<langle>\<rangle> = [i..j]
i \<le> j + 1

goal (1 subgoal):
 1. i = j + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i = j + 1

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>inorder \<langle>\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i \<langle>\<rangle>. f (fst x)) = sum f {i..j + 1}
 2. \<And>t1 x2 t2 i j. \<lbrakk>\<And>i j. \<lbrakk>inorder t1 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t1. f (fst x)) = sum f {i..j + 1}; \<And>i j. \<lbrakk>inorder t2 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t2. f (fst x)) = sum f {i..j + 1}; inorder \<langle>t1, x2, t2\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i \<langle>t1, x2, t2\<rangle>. f (fst x)) = sum f {i..j + 1}
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
i = j + 1

goal (1 subgoal):
 1. (\<Sum>x\<in>leaves i \<langle>\<rangle>. f (fst x)) = sum f {i..j + 1}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>leaves i \<langle>\<rangle>. f (fst x)) = sum f {i..j + 1}

goal (1 subgoal):
 1. \<And>t1 x2 t2 i j. \<lbrakk>\<And>i j. \<lbrakk>inorder t1 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t1. f (fst x)) = sum f {i..j + 1}; \<And>i j. \<lbrakk>inorder t2 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t2. f (fst x)) = sum f {i..j + 1}; inorder \<langle>t1, x2, t2\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i \<langle>t1, x2, t2\<rangle>. f (fst x)) = sum f {i..j + 1}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t1 x2 t2 i j. \<lbrakk>\<And>i j. \<lbrakk>inorder t1 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t1. f (fst x)) = sum f {i..j + 1}; \<And>i j. \<lbrakk>inorder t2 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t2. f (fst x)) = sum f {i..j + 1}; inorder \<langle>t1, x2, t2\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i \<langle>t1, x2, t2\<rangle>. f (fst x)) = sum f {i..j + 1}
[PROOF STEP]
case (Node l k r)
[PROOF STATE]
proof (state)
this:
\<lbrakk>inorder l = [?i..?j]; ?i \<le> ?j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves ?i l. f (fst x)) = sum f {?i..?j + 1}
\<lbrakk>inorder r = [?i..?j]; ?i \<le> ?j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves ?i r. f (fst x)) = sum f {?i..?j + 1}
inorder \<langle>l, k, r\<rangle> = [i..j]
i \<le> j + 1

goal (1 subgoal):
 1. \<And>t1 x2 t2 i j. \<lbrakk>\<And>i j. \<lbrakk>inorder t1 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t1. f (fst x)) = sum f {i..j + 1}; \<And>i j. \<lbrakk>inorder t2 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t2. f (fst x)) = sum f {i..j + 1}; inorder \<langle>t1, x2, t2\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i \<langle>t1, x2, t2\<rangle>. f (fst x)) = sum f {i..j + 1}
[PROOF STEP]
note inorder = inorder_upto_split[OF Node.prems(1)]
[PROOF STATE]
proof (state)
this:
inorder l = [i..k - 1]
inorder r = [k + 1..j]
i \<le> k
k \<le> j

goal (1 subgoal):
 1. \<And>t1 x2 t2 i j. \<lbrakk>\<And>i j. \<lbrakk>inorder t1 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t1. f (fst x)) = sum f {i..j + 1}; \<And>i j. \<lbrakk>inorder t2 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t2. f (fst x)) = sum f {i..j + 1}; inorder \<langle>t1, x2, t2\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i \<langle>t1, x2, t2\<rangle>. f (fst x)) = sum f {i..j + 1}
[PROOF STEP]
let ?Ll = "leaves i l"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t1 x2 t2 i j. \<lbrakk>\<And>i j. \<lbrakk>inorder t1 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t1. f (fst x)) = sum f {i..j + 1}; \<And>i j. \<lbrakk>inorder t2 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t2. f (fst x)) = sum f {i..j + 1}; inorder \<langle>t1, x2, t2\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i \<langle>t1, x2, t2\<rangle>. f (fst x)) = sum f {i..j + 1}
[PROOF STEP]
let ?Lr = "leaves (k+1) r"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t1 x2 t2 i j. \<lbrakk>\<And>i j. \<lbrakk>inorder t1 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t1. f (fst x)) = sum f {i..j + 1}; \<And>i j. \<lbrakk>inorder t2 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t2. f (fst x)) = sum f {i..j + 1}; inorder \<langle>t1, x2, t2\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i \<langle>t1, x2, t2\<rangle>. f (fst x)) = sum f {i..j + 1}
[PROOF STEP]
let ?L = "?Ll \<union> ?Lr"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t1 x2 t2 i j. \<lbrakk>\<And>i j. \<lbrakk>inorder t1 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t1. f (fst x)) = sum f {i..j + 1}; \<And>i j. \<lbrakk>inorder t2 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t2. f (fst x)) = sum f {i..j + 1}; inorder \<langle>t1, x2, t2\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i \<langle>t1, x2, t2\<rangle>. f (fst x)) = sum f {i..j + 1}
[PROOF STEP]
have "fst ` ?Ll \<inter> fst ` ?Lr = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst ` leaves i l \<inter> fst ` leaves (k + 1) r = {}
[PROOF STEP]
using inorder
[PROOF STATE]
proof (prove)
using this:
inorder l = [i..k - 1]
inorder r = [k + 1..j]
i \<le> k
k \<le> j

goal (1 subgoal):
 1. fst ` leaves i l \<inter> fst ` leaves (k + 1) r = {}
[PROOF STEP]
by(simp add: fst_leaves del: set_inorder add: set_inorder[symmetric])
[PROOF STATE]
proof (state)
this:
fst ` leaves i l \<inter> fst ` leaves (k + 1) r = {}

goal (1 subgoal):
 1. \<And>t1 x2 t2 i j. \<lbrakk>\<And>i j. \<lbrakk>inorder t1 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t1. f (fst x)) = sum f {i..j + 1}; \<And>i j. \<lbrakk>inorder t2 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t2. f (fst x)) = sum f {i..j + 1}; inorder \<langle>t1, x2, t2\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i \<langle>t1, x2, t2\<rangle>. f (fst x)) = sum f {i..j + 1}
[PROOF STEP]
hence l0: "?Ll \<inter> ?Lr = {}"
[PROOF STATE]
proof (prove)
using this:
fst ` leaves i l \<inter> fst ` leaves (k + 1) r = {}

goal (1 subgoal):
 1. leaves i l \<inter> leaves (k + 1) r = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
leaves i l \<inter> leaves (k + 1) r = {}

goal (1 subgoal):
 1. \<And>t1 x2 t2 i j. \<lbrakk>\<And>i j. \<lbrakk>inorder t1 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t1. f (fst x)) = sum f {i..j + 1}; \<And>i j. \<lbrakk>inorder t2 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t2. f (fst x)) = sum f {i..j + 1}; inorder \<langle>t1, x2, t2\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i \<langle>t1, x2, t2\<rangle>. f (fst x)) = sum f {i..j + 1}
[PROOF STEP]
have "{i..j+1} = {i..k} \<union> {k+1..j+1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i..j + 1} = {i..k} \<union> {k + 1..j + 1}
[PROOF STEP]
using inorder(3,4)
[PROOF STATE]
proof (prove)
using this:
i \<le> k
k \<le> j

goal (1 subgoal):
 1. {i..j + 1} = {i..k} \<union> {k + 1..j + 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{i..j + 1} = {i..k} \<union> {k + 1..j + 1}

goal (1 subgoal):
 1. \<And>t1 x2 t2 i j. \<lbrakk>\<And>i j. \<lbrakk>inorder t1 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t1. f (fst x)) = sum f {i..j + 1}; \<And>i j. \<lbrakk>inorder t2 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i t2. f (fst x)) = sum f {i..j + 1}; inorder \<langle>t1, x2, t2\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> (\<Sum>x\<in>leaves i \<langle>t1, x2, t2\<rangle>. f (fst x)) = sum f {i..j + 1}
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
{i..j + 1} = {i..k} \<union> {k + 1..j + 1}

goal (1 subgoal):
 1. (\<Sum>x\<in>leaves i \<langle>l, k, r\<rangle>. f (fst x)) = sum f {i..j + 1}
[PROOF STEP]
using Node.IH(1)[OF inorder(1)] Node.IH(2)[OF inorder(2)] inorder(3,4) Node.prems(2)
[PROOF STATE]
proof (prove)
using this:
{i..j + 1} = {i..k} \<union> {k + 1..j + 1}
i \<le> k - 1 + 1 \<Longrightarrow> (\<Sum>x\<in>leaves i l. f (fst x)) = sum f {i..k - 1 + 1}
k + 1 \<le> j + 1 \<Longrightarrow> (\<Sum>x\<in>leaves (k + 1) r. f (fst x)) = sum f {k + 1..j + 1}
i \<le> k
k \<le> j
i \<le> j + 1

goal (1 subgoal):
 1. (\<Sum>x\<in>leaves i \<langle>l, k, r\<rangle>. f (fst x)) = sum f {i..j + 1}
[PROOF STEP]
by(simp add: sum_incr2 sum_Un_nat finite_leaves l0)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>leaves i \<langle>l, k, r\<rangle>. f (fst x)) = sum f {i..j + 1}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma smult_minus_right [simp]: "smult a (- p) = - smult a p"
  for a :: "'a::comm_ring"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult a (- p) = - smult a p
[PROOF STEP]
by (rule poly_eqI) simp


[STATEMENT]
lemma eval_member:
  "member xq = eval (pred_of_seq xq)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. member xq = eval (pred_of_seq xq)
[PROOF STEP]
proof (induct xq)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. member Empty = eval (pred_of_seq Empty)
 2. \<And>x1 x2. member (Insert x1 x2) = eval (pred_of_seq (Insert x1 x2))
 3. \<And>x1 xq. member xq = eval (pred_of_seq xq) \<Longrightarrow> member (Join x1 xq) = eval (pred_of_seq (Join x1 xq))
[PROOF STEP]
case Empty
[PROOF STATE]
proof (state)
this:

goal (3 subgoals):
 1. member Empty = eval (pred_of_seq Empty)
 2. \<And>x1 x2. member (Insert x1 x2) = eval (pred_of_seq (Insert x1 x2))
 3. \<And>x1 xq. member xq = eval (pred_of_seq xq) \<Longrightarrow> member (Join x1 xq) = eval (pred_of_seq (Join x1 xq))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. member Empty = eval (pred_of_seq Empty)
[PROOF STEP]
by (auto simp add: fun_eq_iff elim: botE)
[PROOF STATE]
proof (state)
this:
member Empty = eval (pred_of_seq Empty)

goal (2 subgoals):
 1. \<And>x1 x2. member (Insert x1 x2) = eval (pred_of_seq (Insert x1 x2))
 2. \<And>x1 xq. member xq = eval (pred_of_seq xq) \<Longrightarrow> member (Join x1 xq) = eval (pred_of_seq (Join x1 xq))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x1 x2. member (Insert x1 x2) = eval (pred_of_seq (Insert x1 x2))
 2. \<And>x1 xq. member xq = eval (pred_of_seq xq) \<Longrightarrow> member (Join x1 xq) = eval (pred_of_seq (Join x1 xq))
[PROOF STEP]
case Insert
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>x1 x2. member (Insert x1 x2) = eval (pred_of_seq (Insert x1 x2))
 2. \<And>x1 xq. member xq = eval (pred_of_seq xq) \<Longrightarrow> member (Join x1 xq) = eval (pred_of_seq (Join x1 xq))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. member (Insert x1_ x2_) = eval (pred_of_seq (Insert x1_ x2_))
[PROOF STEP]
by (auto simp add: fun_eq_iff elim: supE singleE intro: supI1 supI2 singleI)
[PROOF STATE]
proof (state)
this:
member (Insert x1_ x2_) = eval (pred_of_seq (Insert x1_ x2_))

goal (1 subgoal):
 1. \<And>x1 xq. member xq = eval (pred_of_seq xq) \<Longrightarrow> member (Join x1 xq) = eval (pred_of_seq (Join x1 xq))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x1 xq. member xq = eval (pred_of_seq xq) \<Longrightarrow> member (Join x1 xq) = eval (pred_of_seq (Join x1 xq))
[PROOF STEP]
case Join
[PROOF STATE]
proof (state)
this:
member xq_ = eval (pred_of_seq xq_)

goal (1 subgoal):
 1. \<And>x1 xq. member xq = eval (pred_of_seq xq) \<Longrightarrow> member (Join x1 xq) = eval (pred_of_seq (Join x1 xq))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
member xq_ = eval (pred_of_seq xq_)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
member xq_ = eval (pred_of_seq xq_)

goal (1 subgoal):
 1. member (Join x1_ xq_) = eval (pred_of_seq (Join x1_ xq_))
[PROOF STEP]
by (auto simp add: fun_eq_iff elim: supE intro: supI1 supI2)
[PROOF STATE]
proof (state)
this:
member (Join x1_ xq_) = eval (pred_of_seq (Join x1_ xq_))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nrows_Diagonal_to_Smith_row_i[simp]: "nrows (Diagonal_to_Smith_row_i A i bezout) = nrows A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nrows (Diagonal_to_Smith_row_i A i bezout) = nrows A
[PROOF STEP]
unfolding Diagonal_to_Smith_row_i_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nrows (diagonal_to_Smith_i [i + 1..<min (nrows A) (ncols A)] A i bezout) = nrows A
[PROOF STEP]
by auto


[STATEMENT]
lemma incseq_rat_le_real:
      "\<lbrakk> incseq s;  (\<lambda>n. of_rat (s n)) \<longlonglongrightarrow> x \<rbrakk> \<Longrightarrow> of_rat (s n) \<le> (x::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>incseq s; (\<lambda>n. real_of_rat (s n)) \<longlonglongrightarrow> x\<rbrakk> \<Longrightarrow> real_of_rat (s n) \<le> x
[PROOF STEP]
by (auto intro: incseq_le incseq_of_rat)


[STATEMENT]
lemma (in term_powerprod) monomial_1_in_pmdlI:
  assumes "(f::_ \<Rightarrow>\<^sub>0 'b::field) \<in> pmdl F" and "keys f = {t}"
  shows "monomial 1 t \<in> pmdl F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monomial (1::'b) t \<in> pmdl F
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. monomial (1::'b) t \<in> pmdl F
[PROOF STEP]
define c where "c \<equiv> lookup f t"
[PROOF STATE]
proof (state)
this:
c \<equiv> lookup f t

goal (1 subgoal):
 1. monomial (1::'b) t \<in> pmdl F
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
keys f = {t}
[PROOF STEP]
have f_eq: "f = monomial c t"
[PROOF STATE]
proof (prove)
using this:
keys f = {t}

goal (1 subgoal):
 1. f = monomial c t
[PROOF STEP]
unfolding c_def
[PROOF STATE]
proof (prove)
using this:
keys f = {t}

goal (1 subgoal):
 1. f = monomial (lookup f t) t
[PROOF STEP]
by (metis (mono_tags, lifting) Diff_insert_absorb cancel_comm_monoid_add_class.add_cancel_right_right
        plus_except insert_absorb insert_not_empty keys_eq_empty keys_except)
[PROOF STATE]
proof (state)
this:
f = monomial c t

goal (1 subgoal):
 1. monomial (1::'b) t \<in> pmdl F
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
keys f = {t}
[PROOF STEP]
have "c \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
keys f = {t}

goal (1 subgoal):
 1. c \<noteq> (0::'b)
[PROOF STEP]
unfolding c_def
[PROOF STATE]
proof (prove)
using this:
keys f = {t}

goal (1 subgoal):
 1. lookup f t \<noteq> (0::'b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c \<noteq> (0::'b)

goal (1 subgoal):
 1. monomial (1::'b) t \<in> pmdl F
[PROOF STEP]
hence "monomial 1 t = monom_mult (1 / c) 0 f"
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'b)

goal (1 subgoal):
 1. monomial (1::'b) t = monom_mult ((1::'b) / c) (0::'a) f
[PROOF STEP]
by (simp add: f_eq monom_mult_monomial term_simps)
[PROOF STATE]
proof (state)
this:
monomial (1::'b) t = monom_mult ((1::'b) / c) (0::'a) f

goal (1 subgoal):
 1. monomial (1::'b) t \<in> pmdl F
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
monomial (1::'b) t = monom_mult ((1::'b) / c) (0::'a) f

goal (1 subgoal):
 1. monomial (1::'b) t \<in> pmdl F
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
f \<in> pmdl F
[PROOF STEP]
have "... \<in> pmdl F"
[PROOF STATE]
proof (prove)
using this:
f \<in> pmdl F

goal (1 subgoal):
 1. monom_mult ((1::'b) / c) (0::'a) f \<in> pmdl F
[PROOF STEP]
by (rule pmdl_closed_monom_mult)
[PROOF STATE]
proof (state)
this:
monom_mult ((1::'b) / c) (0::'a) f \<in> pmdl F

goal (1 subgoal):
 1. monomial (1::'b) t \<in> pmdl F
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
monomial (1::'b) t \<in> pmdl F
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
monomial (1::'b) t \<in> pmdl F

goal (1 subgoal):
 1. monomial (1::'b) t \<in> pmdl F
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
monomial (1::'b) t \<in> pmdl F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma canon_ang_sum:
  shows "\<downharpoonright>\<alpha> + \<beta>\<downharpoonleft> = \<downharpoonright>\<downharpoonright>\<alpha>\<downharpoonleft> + \<downharpoonright>\<beta>\<downharpoonleft>\<downharpoonleft>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<downharpoonright>\<alpha> + \<beta>\<downharpoonleft> = \<downharpoonright>\<downharpoonright>\<alpha>\<downharpoonleft> + \<downharpoonright>\<beta>\<downharpoonleft>\<downharpoonleft>
[PROOF STEP]
proof (rule canon_ang_eq)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x. \<alpha> + \<beta> - (\<downharpoonright>\<alpha>\<downharpoonleft> + \<downharpoonright>\<beta>\<downharpoonleft>) = 2 * real_of_int x * pi
[PROOF STEP]
show "\<exists>x::int. \<alpha> + \<beta> - (\<downharpoonright>\<alpha>\<downharpoonleft> + \<downharpoonright>\<beta>\<downharpoonleft>) = 2 * x * pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. \<alpha> + \<beta> - (\<downharpoonright>\<alpha>\<downharpoonleft> + \<downharpoonright>\<beta>\<downharpoonleft>) = 2 * real_of_int x * pi
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x. \<alpha> + \<beta> - (\<downharpoonright>\<alpha>\<downharpoonleft> + \<downharpoonright>\<beta>\<downharpoonleft>) = 2 * real_of_int x * pi
[PROOF STEP]
obtain k1::int where "\<alpha> - \<downharpoonright>\<alpha>\<downharpoonleft> = 2*k1*pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k1. \<alpha> - \<downharpoonright>\<alpha>\<downharpoonleft> = real_of_int (2 * k1) * pi \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using canon_ang(3)
[PROOF STATE]
proof (prove)
using this:
\<exists>x. ?\<alpha> - \<downharpoonright>?\<alpha>\<downharpoonleft> = 2 * real_of_int x * pi

goal (1 subgoal):
 1. (\<And>k1. \<alpha> - \<downharpoonright>\<alpha>\<downharpoonleft> = real_of_int (2 * k1) * pi \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<alpha> - \<downharpoonright>\<alpha>\<downharpoonleft> = real_of_int (2 * k1) * pi

goal (1 subgoal):
 1. \<exists>x. \<alpha> + \<beta> - (\<downharpoonright>\<alpha>\<downharpoonleft> + \<downharpoonright>\<beta>\<downharpoonleft>) = 2 * real_of_int x * pi
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<alpha> - \<downharpoonright>\<alpha>\<downharpoonleft> = real_of_int (2 * k1) * pi

goal (1 subgoal):
 1. \<exists>x. \<alpha> + \<beta> - (\<downharpoonright>\<alpha>\<downharpoonleft> + \<downharpoonright>\<beta>\<downharpoonleft>) = 2 * real_of_int x * pi
[PROOF STEP]
obtain k2::int where "\<beta> - \<downharpoonright>\<beta>\<downharpoonleft> = 2*k2*pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k2. \<beta> - \<downharpoonright>\<beta>\<downharpoonleft> = real_of_int (2 * k2) * pi \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using canon_ang(3)
[PROOF STATE]
proof (prove)
using this:
\<exists>x. ?\<alpha> - \<downharpoonright>?\<alpha>\<downharpoonleft> = 2 * real_of_int x * pi

goal (1 subgoal):
 1. (\<And>k2. \<beta> - \<downharpoonright>\<beta>\<downharpoonleft> = real_of_int (2 * k2) * pi \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<beta> - \<downharpoonright>\<beta>\<downharpoonleft> = real_of_int (2 * k2) * pi

goal (1 subgoal):
 1. \<exists>x. \<alpha> + \<beta> - (\<downharpoonright>\<alpha>\<downharpoonleft> + \<downharpoonright>\<beta>\<downharpoonleft>) = 2 * real_of_int x * pi
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<alpha> - \<downharpoonright>\<alpha>\<downharpoonleft> = real_of_int (2 * k1) * pi
\<beta> - \<downharpoonright>\<beta>\<downharpoonleft> = real_of_int (2 * k2) * pi
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<alpha> - \<downharpoonright>\<alpha>\<downharpoonleft> = real_of_int (2 * k1) * pi
\<beta> - \<downharpoonright>\<beta>\<downharpoonleft> = real_of_int (2 * k2) * pi

goal (1 subgoal):
 1. \<exists>x. \<alpha> + \<beta> - (\<downharpoonright>\<alpha>\<downharpoonleft> + \<downharpoonright>\<beta>\<downharpoonleft>) = 2 * real_of_int x * pi
[PROOF STEP]
by (rule_tac x="k1 + k2" in exI) (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
\<exists>x. \<alpha> + \<beta> - (\<downharpoonright>\<alpha>\<downharpoonleft> + \<downharpoonright>\<beta>\<downharpoonleft>) = 2 * real_of_int x * pi

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>x. \<alpha> + \<beta> - (\<downharpoonright>\<alpha>\<downharpoonleft> + \<downharpoonright>\<beta>\<downharpoonleft>) = 2 * real_of_int x * pi

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Utrans_P_is_tensor_P1:
  "Utrans_P vars1 A = Utrans (tensor_P A (1\<^sub>m K))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Utrans_P vars1 A = Utrans (tensor_P A (1\<^sub>m K))
[PROOF STEP]
unfolding Utrans_P_def ps2_P.ptensor_mat_def partial_state.mat_extension_def
    partial_state.d2_def partial_state.dims2_def ps2_P.nths_vars2'[simplified ps2_P_dims0 ps2_P_vars1']
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Utrans (tensor_mat dims vars1 A (1\<^sub>m (prod_list ps2_P.dims2))) = Utrans (ps_P.tensor_mat A (1\<^sub>m K))
[PROOF STEP]
using ps2_P_d2
[PROOF STATE]
proof (prove)
using this:
ps2_P.d2 = K

goal (1 subgoal):
 1. Utrans (tensor_mat dims vars1 A (1\<^sub>m (prod_list ps2_P.dims2))) = Utrans (ps_P.tensor_mat A (1\<^sub>m K))
[PROOF STEP]
unfolding ps2_P.d2_def
[PROOF STATE]
proof (prove)
using this:
prod_list ps2_P.dims2 = K

goal (1 subgoal):
 1. Utrans (tensor_mat dims vars1 A (1\<^sub>m (prod_list ps2_P.dims2))) = Utrans (ps_P.tensor_mat A (1\<^sub>m K))
[PROOF STEP]
using ps2_P_dims0 ps2_P_vars1'
[PROOF STATE]
proof (prove)
using this:
prod_list ps2_P.dims2 = K
ps2_P.dims0 = dims
ps2_P.vars1' = vars1

goal (1 subgoal):
 1. Utrans (tensor_mat dims vars1 A (1\<^sub>m (prod_list ps2_P.dims2))) = Utrans (ps_P.tensor_mat A (1\<^sub>m K))
[PROOF STEP]
by auto


[STATEMENT]
lemma connected_iff_reachable:
  "connected G \<longleftrightarrow> ((\<forall>x\<in>verts G. \<forall>y\<in>verts G. x \<rightarrow>\<^sup>* y) \<and> verts G \<noteq> {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Digraph_Component.connected G = ((\<forall>x\<in>verts G. \<forall>y\<in>verts G. x \<rightarrow>\<^sup>* y) \<and> verts G \<noteq> {})
[PROOF STEP]
using symmetric_connected_imp_strongly_connected strongly_connected_def verts_reachable_connected
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>symmetric G; Digraph_Component.connected G\<rbrakk> \<Longrightarrow> strongly_connected G
strongly_connected ?G \<equiv> verts ?G \<noteq> {} \<and> (\<forall>u\<in>verts ?G. \<forall>v\<in>verts ?G. u \<rightarrow>\<^sup>*\<^bsub>?G\<^esub> v)
\<lbrakk>verts G \<noteq> {}; \<forall>x\<in>verts G. \<forall>y\<in>verts G. x \<rightarrow>\<^sup>* y\<rbrakk> \<Longrightarrow> Digraph_Component.connected G

goal (1 subgoal):
 1. Digraph_Component.connected G = ((\<forall>x\<in>verts G. \<forall>y\<in>verts G. x \<rightarrow>\<^sup>* y) \<and> verts G \<noteq> {})
[PROOF STEP]
by(blast)


[STATEMENT]
lemma ipoly_complex_interval_tendsto:
  assumes "C \<longlonglongrightarrow>\<^sub>c c"
  shows "(\<lambda>i. ipoly_complex_interval p (C i)) \<longlonglongrightarrow>\<^sub>c ipoly p c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. ipoly_complex_interval p (C i)) \<longlonglongrightarrow>\<^sub>c ipoly p c
[PROOF STEP]
proof(induct p)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>i. ipoly_complex_interval 0 (C i)) \<longlonglongrightarrow>\<^sub>c ipoly 0 c
 2. \<And>a p. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; (\<lambda>i. ipoly_complex_interval p (C i)) \<longlonglongrightarrow>\<^sub>c ipoly p c\<rbrakk> \<Longrightarrow> (\<lambda>i. ipoly_complex_interval (pCons a p) (C i)) \<longlonglongrightarrow>\<^sub>c ipoly (pCons a p) c
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (\<lambda>i. ipoly_complex_interval 0 (C i)) \<longlonglongrightarrow>\<^sub>c ipoly 0 c
 2. \<And>a p. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; (\<lambda>i. ipoly_complex_interval p (C i)) \<longlonglongrightarrow>\<^sub>c ipoly p c\<rbrakk> \<Longrightarrow> (\<lambda>i. ipoly_complex_interval (pCons a p) (C i)) \<longlonglongrightarrow>\<^sub>c ipoly (pCons a p) c
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. ipoly_complex_interval 0 (C i)) \<longlonglongrightarrow>\<^sub>c ipoly 0 c
[PROOF STEP]
by (auto simp: o_def zero_complex_interval_def zero_interval_def complex_interval_tendsto_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>i. ipoly_complex_interval 0 (C i)) \<longlonglongrightarrow>\<^sub>c ipoly 0 c

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; (\<lambda>i. ipoly_complex_interval p (C i)) \<longlonglongrightarrow>\<^sub>c ipoly p c\<rbrakk> \<Longrightarrow> (\<lambda>i. ipoly_complex_interval (pCons a p) (C i)) \<longlonglongrightarrow>\<^sub>c ipoly (pCons a p) c
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; (\<lambda>i. ipoly_complex_interval p (C i)) \<longlonglongrightarrow>\<^sub>c ipoly p c\<rbrakk> \<Longrightarrow> (\<lambda>i. ipoly_complex_interval (pCons a p) (C i)) \<longlonglongrightarrow>\<^sub>c ipoly (pCons a p) c
[PROOF STEP]
case (pCons a p)
[PROOF STATE]
proof (state)
this:
a \<noteq> 0 \<or> p \<noteq> 0
(\<lambda>i. ipoly_complex_interval p (C i)) \<longlonglongrightarrow>\<^sub>c ipoly p c

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; (\<lambda>i. ipoly_complex_interval p (C i)) \<longlonglongrightarrow>\<^sub>c ipoly p c\<rbrakk> \<Longrightarrow> (\<lambda>i. ipoly_complex_interval (pCons a p) (C i)) \<longlonglongrightarrow>\<^sub>c ipoly (pCons a p) c
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. ipoly_complex_interval (pCons a p) (C i)) \<longlonglongrightarrow>\<^sub>c ipoly (pCons a p) c
[PROOF STEP]
apply (unfold ipoly_complex_interval_pCons of_int_hom.map_poly_pCons_hom poly_pCons)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. of_int_complex_interval a + C i * ipoly_complex_interval p (C i)) \<longlonglongrightarrow>\<^sub>c of_int a + c * ipoly p c
[PROOF STEP]
apply (intro plus_complex_interval_tendsto times_complex_interval_tendsto assms pCons of_int_complex_interval_tendsto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(\<lambda>i. ipoly_complex_interval (pCons a p) (C i)) \<longlonglongrightarrow>\<^sub>c ipoly (pCons a p) c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma holomorphic_on_compose:
  "f holomorphic_on s \<Longrightarrow> g holomorphic_on (f ` s) \<Longrightarrow> (g o f) holomorphic_on s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f holomorphic_on s; g holomorphic_on f ` s\<rbrakk> \<Longrightarrow> g \<circ> f holomorphic_on s
[PROOF STEP]
using field_differentiable_compose_within[of f _ s g]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>f field_differentiable at ?a within s; g field_differentiable at (f ?a) within f ` s\<rbrakk> \<Longrightarrow> g \<circ> f field_differentiable at ?a within s

goal (1 subgoal):
 1. \<lbrakk>f holomorphic_on s; g holomorphic_on f ` s\<rbrakk> \<Longrightarrow> g \<circ> f holomorphic_on s
[PROOF STEP]
by (auto simp: holomorphic_on_def)


[STATEMENT]
lemma positively_invariant_left_inter:
  assumes "positively_invariant C"
  assumes "\<forall>x \<in> C \<inter> D. trapped_forward x D"
  shows "positively_invariant (C \<inter> D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. positively_invariant (C \<inter> D)
[PROOF STEP]
using assms positively_invariant_def trapped_forward_def
[PROOF STATE]
proof (prove)
using this:
positively_invariant C
\<forall>x\<in>C \<inter> D. trapped_forward x D
positively_invariant ?M = (\<forall>x\<in>?M. trapped_forward x ?M)
trapped_forward ?x ?K = (flow0 ?x ` (existence_ivl0 ?x \<inter> {0..}) \<subseteq> ?K)

goal (1 subgoal):
 1. positively_invariant (C \<inter> D)
[PROOF STEP]
by auto


[STATEMENT]
lemma nxt_wait_least:
assumes ev: "ev \<phi> xs" and nxt: "(nxt ^^ n) \<phi> xs"  shows "wait \<phi> xs \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wait \<phi> xs \<le> n
[PROOF STEP]
unfolding wait_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST n. (nxt ^^ n) \<phi> xs) \<le> n
[PROOF STEP]
using ev_ex_nxt[OF ev]
[PROOF STATE]
proof (prove)
using this:
\<exists>n. (nxt ^^ n) \<phi> xs

goal (1 subgoal):
 1. (LEAST n. (nxt ^^ n) \<phi> xs) \<le> n
[PROOF STEP]
by (metis Least_le nxt)


[STATEMENT]
lemma LL_UR_pos:
  "0 < snd (mediant m) \<Longrightarrow> 0 < snd (mediant (m \<otimes> LL))"
  "0 < snd (mediant m) \<Longrightarrow> 0 < snd (mediant (m \<otimes> UR))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < snd (mediant m) \<Longrightarrow> 0 < snd (mediant (m \<otimes> LL))) &&& (0 < snd (mediant m) \<Longrightarrow> 0 < snd (mediant (m \<otimes> UR)))
[PROOF STEP]
by (cases m) (simp_all add: LL_def UR_def times_matrix_def split_def field_simps mediant_def)


[STATEMENT]
lemma is_map_fst_inj: "is_map S \<Longrightarrow> inj_on fst S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_map S \<Longrightarrow> inj_on fst S
[PROOF STEP]
by (fastforce intro: inj_onI dest: is_mapD)


[STATEMENT]
lemma all2_neq_Inr_ex_eq_Inl[dest]: "(\<forall>a b. x \<noteq> Inr (a, b)) \<Longrightarrow> (\<exists>l. x = Inl l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a b. x \<noteq> Inr (a, b) \<Longrightarrow> \<exists>l. x = Inl l
[PROOF STEP]
by (cases x) auto


[STATEMENT]
lemma iT_Minus_Plus_empty: "k < n \<Longrightarrow> k \<ominus> (I \<oplus> n) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < n \<Longrightarrow> k \<ominus> (I \<oplus> n) = {}
[PROOF STEP]
apply (case_tac "I = {}")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>k < n; I = {}\<rbrakk> \<Longrightarrow> k \<ominus> (I \<oplus> n) = {}
 2. \<lbrakk>k < n; I \<noteq> {}\<rbrakk> \<Longrightarrow> k \<ominus> (I \<oplus> n) = {}
[PROOF STEP]
apply (simp add: iT_Plus_empty iT_Minus_empty)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k < n; I \<noteq> {}\<rbrakk> \<Longrightarrow> k \<ominus> (I \<oplus> n) = {}
[PROOF STEP]
apply (simp add: iT_Minus_empty_iff iT_Plus_empty_iff iT_Plus_Min)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Gcd_remove0_nat: "finite M \<Longrightarrow> Gcd M = Gcd (M - {0})"
  for M :: "nat set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite M \<Longrightarrow> Gcd M = Gcd (M - {0})
[PROOF STEP]
proof (induct pred: finite)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Gcd {} = Gcd ({} - {0})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; Gcd F = Gcd (F - {0})\<rbrakk> \<Longrightarrow> Gcd (insert x F) = Gcd (insert x F - {0})
[PROOF STEP]
case (insert x M)
[PROOF STATE]
proof (state)
this:
finite M
x \<notin> M
Gcd M = Gcd (M - {0})

goal (2 subgoals):
 1. Gcd {} = Gcd ({} - {0})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; Gcd F = Gcd (F - {0})\<rbrakk> \<Longrightarrow> Gcd (insert x F) = Gcd (insert x F - {0})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite M
x \<notin> M
Gcd M = Gcd (M - {0})
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite M
x \<notin> M
Gcd M = Gcd (M - {0})

goal (1 subgoal):
 1. Gcd (insert x M) = Gcd (insert x M - {0})
[PROOF STEP]
by (simp add: insert_Diff_if)
[PROOF STATE]
proof (state)
this:
Gcd (insert x M) = Gcd (insert x M - {0})

goal (1 subgoal):
 1. Gcd {} = Gcd ({} - {0})
[PROOF STEP]
qed auto


[STATEMENT]
lemma (in lgroup) less_eq_inf_2: "(x \<le> y) = (inf y x = x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<le> y) = (y \<sqinter> x = x)
[PROOF STEP]
by (simp add: le_iff_inf inf_commute)


[STATEMENT]
lemma Im_stereographic:
  shows "Im (2 * z / (1 + z * cnj z)) = 2 * Im z / (1 + (cmod z)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (2 * z / (1 + z * cnj z)) = 2 * Im z / (1 + (cmod z)\<^sup>2)
[PROOF STEP]
using one_plus_square_neq_zero
[PROOF STATE]
proof (prove)
using this:
1 + (cor ?x)\<^sup>2 \<noteq> 0

goal (1 subgoal):
 1. Im (2 * z / (1 + z * cnj z)) = 2 * Im z / (1 + (cmod z)\<^sup>2)
[PROOF STEP]
by (subst complex_mult_cnj_cmod, subst Im_divide_real) (auto simp add: power2_eq_square)


[STATEMENT]
lemma subset_fimage_iff: "(B |\<subseteq>| f|`|A) = (\<exists> AA. AA |\<subseteq>| A \<and> B = f|`|AA)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (B |\<subseteq>| f |`| A) = (\<exists>AA. AA |\<subseteq>| A \<and> B = f |`| AA)
[PROOF STEP]
by transfer (metis mem_Collect_eq rev_finite_subset subset_image_iff)


[STATEMENT]
lemma foldr_scene_union_add_tail:
  "\<lbrakk> pairwise (##\<^sub>S) (set xs); \<forall> x\<in>set xs. x ##\<^sub>S b \<rbrakk> \<Longrightarrow> \<Squnion>\<^sub>S xs \<squnion>\<^sub>S b = foldr (\<squnion>\<^sub>S) xs b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pairwise (##\<^sub>S) (set xs); \<forall>x\<in>set xs. x ##\<^sub>S b\<rbrakk> \<Longrightarrow> \<Squnion>\<^sub>S xs \<squnion>\<^sub>S b = foldr (\<squnion>\<^sub>S) xs b
[PROOF STEP]
apply (induct xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>pairwise (##\<^sub>S) (set []); \<forall>x\<in>set []. x ##\<^sub>S b\<rbrakk> \<Longrightarrow> \<Squnion>\<^sub>S [] \<squnion>\<^sub>S b = foldr (\<squnion>\<^sub>S) [] b
 2. \<And>a xs. \<lbrakk>\<lbrakk>pairwise (##\<^sub>S) (set xs); \<forall>x\<in>set xs. x ##\<^sub>S b\<rbrakk> \<Longrightarrow> \<Squnion>\<^sub>S xs \<squnion>\<^sub>S b = foldr (\<squnion>\<^sub>S) xs b; pairwise (##\<^sub>S) (set (a # xs)); \<forall>x\<in>set (a # xs). x ##\<^sub>S b\<rbrakk> \<Longrightarrow> \<Squnion>\<^sub>S (a # xs) \<squnion>\<^sub>S b = foldr (\<squnion>\<^sub>S) (a # xs) b
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>pairwise (##\<^sub>S) (set xs); \<forall>x\<in>set xs. x ##\<^sub>S b\<rbrakk> \<Longrightarrow> \<Squnion>\<^sub>S xs \<squnion>\<^sub>S b = foldr (\<squnion>\<^sub>S) xs b; pairwise (##\<^sub>S) (set (a # xs)); \<forall>x\<in>set (a # xs). x ##\<^sub>S b\<rbrakk> \<Longrightarrow> \<Squnion>\<^sub>S (a # xs) \<squnion>\<^sub>S b = foldr (\<squnion>\<^sub>S) (a # xs) b
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>pairwise (##\<^sub>S) (set xs) \<Longrightarrow> \<Squnion>\<^sub>S xs \<squnion>\<^sub>S b = foldr (\<squnion>\<^sub>S) xs b; pairwise (##\<^sub>S) (insert a (set xs)); a ##\<^sub>S b \<and> (\<forall>x\<in>set xs. x ##\<^sub>S b)\<rbrakk> \<Longrightarrow> a \<squnion>\<^sub>S \<Squnion>\<^sub>S xs \<squnion>\<^sub>S b = a \<squnion>\<^sub>S foldr (\<squnion>\<^sub>S) xs b
[PROOF STEP]
apply (subst scene_union_assoc[THEN sym])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>a xs. \<lbrakk>pairwise (##\<^sub>S) (set xs) \<Longrightarrow> \<Squnion>\<^sub>S xs \<squnion>\<^sub>S b = foldr (\<squnion>\<^sub>S) xs b; pairwise (##\<^sub>S) (insert a (set xs)); a ##\<^sub>S b \<and> (\<forall>x\<in>set xs. x ##\<^sub>S b)\<rbrakk> \<Longrightarrow> a ##\<^sub>S \<Squnion>\<^sub>S xs
 2. \<And>a xs. \<lbrakk>pairwise (##\<^sub>S) (set xs) \<Longrightarrow> \<Squnion>\<^sub>S xs \<squnion>\<^sub>S b = foldr (\<squnion>\<^sub>S) xs b; pairwise (##\<^sub>S) (insert a (set xs)); a ##\<^sub>S b \<and> (\<forall>x\<in>set xs. x ##\<^sub>S b)\<rbrakk> \<Longrightarrow> a ##\<^sub>S b
 3. \<And>a xs. \<lbrakk>pairwise (##\<^sub>S) (set xs) \<Longrightarrow> \<Squnion>\<^sub>S xs \<squnion>\<^sub>S b = foldr (\<squnion>\<^sub>S) xs b; pairwise (##\<^sub>S) (insert a (set xs)); a ##\<^sub>S b \<and> (\<forall>x\<in>set xs. x ##\<^sub>S b)\<rbrakk> \<Longrightarrow> \<Squnion>\<^sub>S xs ##\<^sub>S b
 4. \<And>a xs. \<lbrakk>pairwise (##\<^sub>S) (set xs) \<Longrightarrow> \<Squnion>\<^sub>S xs \<squnion>\<^sub>S b = foldr (\<squnion>\<^sub>S) xs b; pairwise (##\<^sub>S) (insert a (set xs)); a ##\<^sub>S b \<and> (\<forall>x\<in>set xs. x ##\<^sub>S b)\<rbrakk> \<Longrightarrow> a \<squnion>\<^sub>S (\<Squnion>\<^sub>S xs \<squnion>\<^sub>S b) = a \<squnion>\<^sub>S foldr (\<squnion>\<^sub>S) xs b
[PROOF STEP]
apply (auto simp add: pairwise_insert)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs. \<lbrakk>\<Squnion>\<^sub>S xs \<squnion>\<^sub>S b = foldr (\<squnion>\<^sub>S) xs b; \<forall>y. y \<in> set xs \<and> y \<noteq> a \<longrightarrow> a ##\<^sub>S y \<and> y ##\<^sub>S a; pairwise (##\<^sub>S) (set xs); a ##\<^sub>S b; \<forall>x\<in>set xs. x ##\<^sub>S b\<rbrakk> \<Longrightarrow> a ##\<^sub>S \<Squnion>\<^sub>S xs
 2. \<And>a xs. \<lbrakk>\<Squnion>\<^sub>S xs \<squnion>\<^sub>S b = foldr (\<squnion>\<^sub>S) xs b; \<forall>y. y \<in> set xs \<and> y \<noteq> a \<longrightarrow> a ##\<^sub>S y \<and> y ##\<^sub>S a; pairwise (##\<^sub>S) (set xs); a ##\<^sub>S b; \<forall>x\<in>set xs. x ##\<^sub>S b\<rbrakk> \<Longrightarrow> \<Squnion>\<^sub>S xs ##\<^sub>S b
[PROOF STEP]
using pairwise_compat_foldr scene_compat_refl
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>pairwise (##\<^sub>S) (set ?as); \<forall>b\<in>set ?as. ?a ##\<^sub>S b\<rbrakk> \<Longrightarrow> ?a ##\<^sub>S \<Squnion>\<^sub>S ?as
?X ##\<^sub>S ?X

goal (2 subgoals):
 1. \<And>a xs. \<lbrakk>\<Squnion>\<^sub>S xs \<squnion>\<^sub>S b = foldr (\<squnion>\<^sub>S) xs b; \<forall>y. y \<in> set xs \<and> y \<noteq> a \<longrightarrow> a ##\<^sub>S y \<and> y ##\<^sub>S a; pairwise (##\<^sub>S) (set xs); a ##\<^sub>S b; \<forall>x\<in>set xs. x ##\<^sub>S b\<rbrakk> \<Longrightarrow> a ##\<^sub>S \<Squnion>\<^sub>S xs
 2. \<And>a xs. \<lbrakk>\<Squnion>\<^sub>S xs \<squnion>\<^sub>S b = foldr (\<squnion>\<^sub>S) xs b; \<forall>y. y \<in> set xs \<and> y \<noteq> a \<longrightarrow> a ##\<^sub>S y \<and> y ##\<^sub>S a; pairwise (##\<^sub>S) (set xs); a ##\<^sub>S b; \<forall>x\<in>set xs. x ##\<^sub>S b\<rbrakk> \<Longrightarrow> \<Squnion>\<^sub>S xs ##\<^sub>S b
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<Squnion>\<^sub>S xs \<squnion>\<^sub>S b = foldr (\<squnion>\<^sub>S) xs b; \<forall>y. y \<in> set xs \<and> y \<noteq> a \<longrightarrow> a ##\<^sub>S y \<and> y ##\<^sub>S a; pairwise (##\<^sub>S) (set xs); a ##\<^sub>S b; \<forall>x\<in>set xs. x ##\<^sub>S b\<rbrakk> \<Longrightarrow> \<Squnion>\<^sub>S xs ##\<^sub>S b
[PROOF STEP]
apply (meson pairwise_compat_foldr scene_compat_sym)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma zmult_neg_neg:"\<lbrakk>i < (0::int); j < 0 \<rbrakk> \<Longrightarrow> 0 < i * j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < 0; j < 0\<rbrakk> \<Longrightarrow> 0 < i * j
[PROOF STEP]
apply (frule zmult_zless_mono_neg[of "i" "0" "j"], assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < 0; j < 0; 0 * j < i * j\<rbrakk> \<Longrightarrow> 0 < i * j
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma foldl_rule_aux_P:
  fixes I :: "'\<sigma> \<Rightarrow> 'a list \<Rightarrow> bool"
  assumes initial: "I \<sigma>0 l0"
  assumes step: "!!l1 l2 x \<sigma>. \<lbrakk> l0=l1@x#l2; I \<sigma> (x#l2) \<rbrakk> \<Longrightarrow> I (f \<sigma> x) l2"
  assumes final: "!!\<sigma>. I \<sigma> [] \<Longrightarrow> P \<sigma>"
  shows "P (foldl f \<sigma>0 l0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (foldl f \<sigma>0 l0)
[PROOF STEP]
using foldl_rule_aux[of I \<sigma>0 l0, OF initial, OF step] final
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>l1 l2 x \<sigma>. \<lbrakk>l0 = l1 @ x # l2; I \<sigma> (x # l2)\<rbrakk> \<Longrightarrow> l0 = ?l1.1 l1 l2 x \<sigma> @ ?x3 x \<sigma> # l2; \<And>l1 l2 x \<sigma>. \<lbrakk>l0 = l1 @ x # l2; I \<sigma> (x # l2)\<rbrakk> \<Longrightarrow> I (?\<sigma>2 x \<sigma>) (?x3 x \<sigma> # l2)\<rbrakk> \<Longrightarrow> I (foldl (\<lambda>\<sigma> x. f (?\<sigma>2 x \<sigma>) (?x3 x \<sigma>)) \<sigma>0 l0) []
I ?\<sigma> [] \<Longrightarrow> P ?\<sigma>

goal (1 subgoal):
 1. P (foldl f \<sigma>0 l0)
[PROOF STEP]
by simp


[STATEMENT]
lemma fst_mono: "x \<le> y \<Longrightarrow> fst x \<le> fst y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> fst x \<le> fst y
[PROOF STEP]
unfolding less_eq_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst x \<le> fst y \<and> snd x \<le> snd y \<Longrightarrow> fst x \<le> fst y
[PROOF STEP]
by simp


[STATEMENT]
lemma gt_minus_one_absI: "abs k < 1 \<Longrightarrow> - 1 < k" for k::real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>k\<bar> < 1 \<Longrightarrow> - 1 < k
[PROOF STEP]
by auto


[STATEMENT]
lemma cat_bintr [simp]: "(\<lambda>k n l. concat_bit n l k) a n ((take_bit :: nat \<Rightarrow> int \<Rightarrow> int) n b) = (\<lambda>k n l. concat_bit n l k) a n b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat_bit n (take_bit n b) a = concat_bit n b a
[PROOF STEP]
by (simp add: bin_cat_eq_push_bit_add_take_bit)


[STATEMENT]
lemma Exists_iff_app: "Seq s d \<Longrightarrow> x \<^bold>\<in> d \<Longrightarrow> (\<exists>y. \<langle>x, y\<rangle> \<^bold>\<in> s \<and> P y) = P (app s x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Seq s d; x \<^bold>\<in> d\<rbrakk> \<Longrightarrow> (\<exists>y. \<langle>x, y\<rangle> \<^bold>\<in> s \<and> P y) = P (app s x)
[PROOF STEP]
by (metis Seq_iff_app)


[STATEMENT]
lemma sqr_ci: "in_carrier ls \<Longrightarrow> Ipol ls (sqr P) = Ipol ls P \<otimes> Ipol ls P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. in_carrier ls \<Longrightarrow> Ipol ls (sqr P) = Ipol ls P \<otimes> Ipol ls P
[PROOF STEP]
by (induct P arbitrary: ls)
    (simp_all add: add_ci mkPinj_ci mkPX_ci mul_ci l_distr r_distr
       a_ac m_ac nat_pow_mult [symmetric] of_int_2)


[STATEMENT]
lemma measurable_Least[measurable]:
  assumes [measurable]: "(\<And>i::nat. (\<lambda>x. P i x) \<in> measurable M (count_space UNIV))"
  shows "(\<lambda>x. LEAST i. P i x) \<in> measurable M (count_space UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. LEAST i. P i x) \<in> M \<rightarrow>\<^sub>M count_space UNIV
[PROOF STEP]
unfolding measurable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. LEAST i. P i x) \<in> {f \<in> space M \<rightarrow> space (count_space UNIV). \<forall>y\<in>sets (count_space UNIV). f -` y \<inter> space M \<in> sets M}
[PROOF STEP]
by (safe intro!: sets_Least) simp_all


[STATEMENT]
lemma vlrestriction_vintersection: "(r \<inter>\<^sub>\<circ> s) \<restriction>\<^sup>l\<^sub>\<circ> A = r \<restriction>\<^sup>l\<^sub>\<circ> A \<inter>\<^sub>\<circ> s \<restriction>\<^sup>l\<^sub>\<circ> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r \<inter>\<^sub>\<circ> s) \<restriction>\<^sup>l\<^sub>\<circ> A = r \<restriction>\<^sup>l\<^sub>\<circ> A \<inter>\<^sub>\<circ> s \<restriction>\<^sup>l\<^sub>\<circ> A
[PROOF STEP]
by auto


[STATEMENT]
lemma eval_member:
  "member xq = eval (pred_of_seq xq)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. member xq = eval (pred_of_seq xq)
[PROOF STEP]
proof (induct xq)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. member Empty = eval (pred_of_seq Empty)
 2. \<And>x1 x2. member (Insert x1 x2) = eval (pred_of_seq (Insert x1 x2))
 3. \<And>x1 xq. member xq = eval (pred_of_seq xq) \<Longrightarrow> member (Join x1 xq) = eval (pred_of_seq (Join x1 xq))
[PROOF STEP]
case Empty
[PROOF STATE]
proof (state)
this:

goal (3 subgoals):
 1. member Empty = eval (pred_of_seq Empty)
 2. \<And>x1 x2. member (Insert x1 x2) = eval (pred_of_seq (Insert x1 x2))
 3. \<And>x1 xq. member xq = eval (pred_of_seq xq) \<Longrightarrow> member (Join x1 xq) = eval (pred_of_seq (Join x1 xq))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. member Empty = eval (pred_of_seq Empty)
[PROOF STEP]
by (auto simp add: fun_eq_iff elim: botE)
[PROOF STATE]
proof (state)
this:
member Empty = eval (pred_of_seq Empty)

goal (2 subgoals):
 1. \<And>x1 x2. member (Insert x1 x2) = eval (pred_of_seq (Insert x1 x2))
 2. \<And>x1 xq. member xq = eval (pred_of_seq xq) \<Longrightarrow> member (Join x1 xq) = eval (pred_of_seq (Join x1 xq))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x1 x2. member (Insert x1 x2) = eval (pred_of_seq (Insert x1 x2))
 2. \<And>x1 xq. member xq = eval (pred_of_seq xq) \<Longrightarrow> member (Join x1 xq) = eval (pred_of_seq (Join x1 xq))
[PROOF STEP]
case Insert
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>x1 x2. member (Insert x1 x2) = eval (pred_of_seq (Insert x1 x2))
 2. \<And>x1 xq. member xq = eval (pred_of_seq xq) \<Longrightarrow> member (Join x1 xq) = eval (pred_of_seq (Join x1 xq))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. member (Insert x1_ x2_) = eval (pred_of_seq (Insert x1_ x2_))
[PROOF STEP]
by (auto simp add: fun_eq_iff elim: supE singleE intro: supI1 supI2 singleI)
[PROOF STATE]
proof (state)
this:
member (Insert x1_ x2_) = eval (pred_of_seq (Insert x1_ x2_))

goal (1 subgoal):
 1. \<And>x1 xq. member xq = eval (pred_of_seq xq) \<Longrightarrow> member (Join x1 xq) = eval (pred_of_seq (Join x1 xq))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x1 xq. member xq = eval (pred_of_seq xq) \<Longrightarrow> member (Join x1 xq) = eval (pred_of_seq (Join x1 xq))
[PROOF STEP]
case Join
[PROOF STATE]
proof (state)
this:
member xq_ = eval (pred_of_seq xq_)

goal (1 subgoal):
 1. \<And>x1 xq. member xq = eval (pred_of_seq xq) \<Longrightarrow> member (Join x1 xq) = eval (pred_of_seq (Join x1 xq))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
member xq_ = eval (pred_of_seq xq_)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
member xq_ = eval (pred_of_seq xq_)

goal (1 subgoal):
 1. member (Join x1_ xq_) = eval (pred_of_seq (Join x1_ xq_))
[PROOF STEP]
by (auto simp add: fun_eq_iff elim: supE intro: supI1 supI2)
[PROOF STATE]
proof (state)
this:
member (Join x1_ xq_) = eval (pred_of_seq (Join x1_ xq_))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem wei_approx_min_degree_heuristic:
"VARS (S :: 'a set) (X :: 'a set) (x :: 'a) (r :: nat)
  { True }
  S := {};
  X := {};
  r := 0;
  WHILE X \<noteq> V
  INV { inv_approx S X r }
  DO x := (SOME x. x \<in> V - X \<and> vertex_heuristic X x);
     S := insert x S;
     r := max (card (neighbors x \<union> {x} - X)) r;
     X := X \<union> neighbors x \<union> {x}
  OD
  { approximation_miv r S }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {True}
S := {}; X := {}; r := 0; WHILE X \<noteq> V INV {inv_approx S X r}  VAR {0}
DO x := (SOME x. x \<in> V - X \<and> vertex_heuristic X x); S := insert x S; r := max (card (neighbors x \<union> {x} - X)) r; X := X \<union> neighbors x \<union> {x} OD
{approximation_miv r S}
[PROOF STEP]
proof (vcg, goal_cases)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>S X x r. True \<Longrightarrow> inv_approx {} {} 0
 2. \<And>S X x r. inv_approx S X r \<and> X \<noteq> V \<Longrightarrow> inv_approx (insert (SOME x. x \<in> V - X \<and> vertex_heuristic X x) S) (X \<union> neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x}) (max (card (neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x} - X)) r)
 3. \<And>S X x r. inv_approx S X r \<and> \<not> X \<noteq> V \<Longrightarrow> approximation_miv r S
[PROOF STEP]
case (1 S X x r)
[PROOF STATE]
proof (state)
this:
True

goal (3 subgoals):
 1. \<And>S X x r. True \<Longrightarrow> inv_approx {} {} 0
 2. \<And>S X x r. inv_approx S X r \<and> X \<noteq> V \<Longrightarrow> inv_approx (insert (SOME x. x \<in> V - X \<and> vertex_heuristic X x) S) (X \<union> neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x}) (max (card (neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x} - X)) r)
 3. \<And>S X x r. inv_approx S X r \<and> \<not> X \<noteq> V \<Longrightarrow> approximation_miv r S
[PROOF STEP]
(* invariant initially true *)
[PROOF STATE]
proof (state)
this:
True

goal (3 subgoals):
 1. \<And>S X x r. True \<Longrightarrow> inv_approx {} {} 0
 2. \<And>S X x r. inv_approx S X r \<and> X \<noteq> V \<Longrightarrow> inv_approx (insert (SOME x. x \<in> V - X \<and> vertex_heuristic X x) S) (X \<union> neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x}) (max (card (neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x} - X)) r)
 3. \<And>S X x r. inv_approx S X r \<and> \<not> X \<noteq> V \<Longrightarrow> approximation_miv r S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
True
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
True

goal (1 subgoal):
 1. inv_approx {} {} 0
[PROOF STEP]
unfolding inv_approx_def inv_iv_def independent_vertices_def
[PROOF STATE]
proof (prove)
using this:
True

goal (1 subgoal):
 1. (({} \<subseteq> \<Union> E \<and> (\<forall>v1 v2. v1 \<in> {} \<and> v2 \<in> {} \<longrightarrow> {v1, v2} \<notin> E)) \<and> {} \<subseteq> V \<and> (\<forall>v1\<in>V - {}. \<forall>v2\<in>{}. {v1, v2} \<notin> E) \<and> {} \<subseteq> {}) \<and> card {} \<le> card {} * 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inv_approx {} {} 0

goal (2 subgoals):
 1. \<And>S X x r. inv_approx S X r \<and> X \<noteq> V \<Longrightarrow> inv_approx (insert (SOME x. x \<in> V - X \<and> vertex_heuristic X x) S) (X \<union> neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x}) (max (card (neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x} - X)) r)
 2. \<And>S X x r. inv_approx S X r \<and> \<not> X \<noteq> V \<Longrightarrow> approximation_miv r S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>S X x r. inv_approx S X r \<and> X \<noteq> V \<Longrightarrow> inv_approx (insert (SOME x. x \<in> V - X \<and> vertex_heuristic X x) S) (X \<union> neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x}) (max (card (neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x} - X)) r)
 2. \<And>S X x r. inv_approx S X r \<and> \<not> X \<noteq> V \<Longrightarrow> approximation_miv r S
[PROOF STEP]
case (2 S X x r)
[PROOF STATE]
proof (state)
this:
inv_approx S X r \<and> X \<noteq> V

goal (2 subgoals):
 1. \<And>S X x r. inv_approx S X r \<and> X \<noteq> V \<Longrightarrow> inv_approx (insert (SOME x. x \<in> V - X \<and> vertex_heuristic X x) S) (X \<union> neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x}) (max (card (neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x} - X)) r)
 2. \<And>S X x r. inv_approx S X r \<and> \<not> X \<noteq> V \<Longrightarrow> approximation_miv r S
[PROOF STEP]
(* invariant preserved by loop *)
  (* definedness of assignment *)
[PROOF STATE]
proof (state)
this:
inv_approx S X r \<and> X \<noteq> V

goal (2 subgoals):
 1. \<And>S X x r. inv_approx S X r \<and> X \<noteq> V \<Longrightarrow> inv_approx (insert (SOME x. x \<in> V - X \<and> vertex_heuristic X x) S) (X \<union> neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x}) (max (card (neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x} - X)) r)
 2. \<And>S X x r. inv_approx S X r \<and> \<not> X \<noteq> V \<Longrightarrow> approximation_miv r S
[PROOF STEP]
let ?x = "(SOME x. x \<in> V - X \<and> vertex_heuristic X x)"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>S X x r. inv_approx S X r \<and> X \<noteq> V \<Longrightarrow> inv_approx (insert (SOME x. x \<in> V - X \<and> vertex_heuristic X x) S) (X \<union> neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x}) (max (card (neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x} - X)) r)
 2. \<And>S X x r. inv_approx S X r \<and> \<not> X \<noteq> V \<Longrightarrow> approximation_miv r S
[PROOF STEP]
have "V - X \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V - X \<noteq> {}
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
inv_approx S X r \<and> X \<noteq> V

goal (1 subgoal):
 1. V - X \<noteq> {}
[PROOF STEP]
unfolding inv_approx_def inv_iv_def
[PROOF STATE]
proof (prove)
using this:
((independent_vertices E S \<and> X \<subseteq> V \<and> (\<forall>v1\<in>V - X. \<forall>v2\<in>S. {v1, v2} \<notin> E) \<and> S \<subseteq> X) \<and> card X \<le> card S * r) \<and> X \<noteq> V

goal (1 subgoal):
 1. V - X \<noteq> {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
V - X \<noteq> {}

goal (2 subgoals):
 1. \<And>S X x r. inv_approx S X r \<and> X \<noteq> V \<Longrightarrow> inv_approx (insert (SOME x. x \<in> V - X \<and> vertex_heuristic X x) S) (X \<union> neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x}) (max (card (neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x} - X)) r)
 2. \<And>S X x r. inv_approx S X r \<and> \<not> X \<noteq> V \<Longrightarrow> approximation_miv r S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
V - X \<noteq> {}

goal (2 subgoals):
 1. \<And>S X x r. inv_approx S X r \<and> X \<noteq> V \<Longrightarrow> inv_approx (insert (SOME x. x \<in> V - X \<and> vertex_heuristic X x) S) (X \<union> neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x}) (max (card (neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x} - X)) r)
 2. \<And>S X x r. inv_approx S X r \<and> \<not> X \<noteq> V \<Longrightarrow> approximation_miv r S
[PROOF STEP]
have "finite (V - X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (V - X)
[PROOF STEP]
using 2 and finite_V
[PROOF STATE]
proof (prove)
using this:
inv_approx S X r \<and> X \<noteq> V
finite V

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

goal (2 subgoals):
 1. \<And>S X x r. inv_approx S X r \<and> X \<noteq> V \<Longrightarrow> inv_approx (insert (SOME x. x \<in> V - X \<and> vertex_heuristic X x) S) (X \<union> neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x}) (max (card (neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x} - X)) r)
 2. \<And>S X x r. inv_approx S X r \<and> \<not> X \<noteq> V \<Longrightarrow> approximation_miv r S
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
V - X \<noteq> {}
finite (V - X)
[PROOF STEP]
have "\<exists>x. x \<in> V - X \<and> vertex_heuristic X x"
[PROOF STATE]
proof (prove)
using this:
V - X \<noteq> {}
finite (V - X)

goal (1 subgoal):
 1. \<exists>x. x \<in> V - X \<and> vertex_heuristic X x
[PROOF STEP]
using ex_min_finite_set [where ?f = "\<lambda>x. card (neighbors x - X)"]
[PROOF STATE]
proof (prove)
using this:
V - X \<noteq> {}
finite (V - X)
\<lbrakk>finite ?S; ?S \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>x. x \<in> ?S \<and> (\<forall>y\<in>?S. card (neighbors x - X) \<le> card (neighbors y - X))

goal (1 subgoal):
 1. \<exists>x. x \<in> V - X \<and> vertex_heuristic X x
[PROOF STEP]
unfolding vertex_heuristic_def
[PROOF STATE]
proof (prove)
using this:
V - X \<noteq> {}
finite (V - X)
\<lbrakk>finite ?S; ?S \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>x. x \<in> ?S \<and> (\<forall>y\<in>?S. card (neighbors x - X) \<le> card (neighbors y - X))

goal (1 subgoal):
 1. \<exists>x. x \<in> V - X \<and> (\<forall>u\<in>V - X. card (neighbors x - X) \<le> card (neighbors u - X))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>x. x \<in> V - X \<and> vertex_heuristic X x

goal (2 subgoals):
 1. \<And>S X x r. inv_approx S X r \<and> X \<noteq> V \<Longrightarrow> inv_approx (insert (SOME x. x \<in> V - X \<and> vertex_heuristic X x) S) (X \<union> neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x}) (max (card (neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x} - X)) r)
 2. \<And>S X x r. inv_approx S X r \<and> \<not> X \<noteq> V \<Longrightarrow> approximation_miv r S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>x. x \<in> V - X \<and> vertex_heuristic X x
[PROOF STEP]
have x_def: "?x \<in> V - X \<and> vertex_heuristic X ?x"
[PROOF STATE]
proof (prove)
using this:
\<exists>x. x \<in> V - X \<and> vertex_heuristic X x

goal (1 subgoal):
 1. (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<in> V - X \<and> vertex_heuristic X (SOME x. x \<in> V - X \<and> vertex_heuristic X x)
[PROOF STEP]
using someI_ex [where ?P = "\<lambda>x. x \<in> V - X \<and> vertex_heuristic X x"]
[PROOF STATE]
proof (prove)
using this:
\<exists>x. x \<in> V - X \<and> vertex_heuristic X x
\<exists>x. x \<in> V - X \<and> vertex_heuristic X x \<Longrightarrow> (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<in> V - X \<and> vertex_heuristic X (SOME x. x \<in> V - X \<and> vertex_heuristic X x)

goal (1 subgoal):
 1. (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<in> V - X \<and> vertex_heuristic X (SOME x. x \<in> V - X \<and> vertex_heuristic X x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<in> V - X \<and> vertex_heuristic X (SOME x. x \<in> V - X \<and> vertex_heuristic X x)

goal (2 subgoals):
 1. \<And>S X x r. inv_approx S X r \<and> X \<noteq> V \<Longrightarrow> inv_approx (insert (SOME x. x \<in> V - X \<and> vertex_heuristic X x) S) (X \<union> neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x}) (max (card (neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x} - X)) r)
 2. \<And>S X x r. inv_approx S X r \<and> \<not> X \<noteq> V \<Longrightarrow> approximation_miv r S
[PROOF STEP]
with 2
[PROOF STATE]
proof (chain)
picking this:
inv_approx S X r \<and> X \<noteq> V
(SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<in> V - X \<and> vertex_heuristic X (SOME x. x \<in> V - X \<and> vertex_heuristic X x)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
inv_approx S X r \<and> X \<noteq> V
(SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<in> V - X \<and> vertex_heuristic X (SOME x. x \<in> V - X \<and> vertex_heuristic X x)

goal (1 subgoal):
 1. inv_approx (insert (SOME x. x \<in> V - X \<and> vertex_heuristic X x) S) (X \<union> neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x}) (max (card (neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x} - X)) r)
[PROOF STEP]
using inv_approx_preserv2
[PROOF STATE]
proof (prove)
using this:
inv_approx S X r \<and> X \<noteq> V
(SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<in> V - X \<and> vertex_heuristic X (SOME x. x \<in> V - X \<and> vertex_heuristic X x)
\<lbrakk>inv_approx ?S ?X ?s; ?x \<in> V - ?X\<rbrakk> \<Longrightarrow> inv_approx (insert ?x ?S) (?X \<union> neighbors ?x \<union> {?x}) (max (card (neighbors ?x \<union> {?x} - ?X)) ?s)

goal (1 subgoal):
 1. inv_approx (insert (SOME x. x \<in> V - X \<and> vertex_heuristic X x) S) (X \<union> neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x}) (max (card (neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x} - X)) r)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inv_approx (insert (SOME x. x \<in> V - X \<and> vertex_heuristic X x) S) (X \<union> neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x}) (max (card (neighbors (SOME x. x \<in> V - X \<and> vertex_heuristic X x) \<union> {SOME x. x \<in> V - X \<and> vertex_heuristic X x} - X)) r)

goal (1 subgoal):
 1. \<And>S X x r. inv_approx S X r \<and> \<not> X \<noteq> V \<Longrightarrow> approximation_miv r S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>S X x r. inv_approx S X r \<and> \<not> X \<noteq> V \<Longrightarrow> approximation_miv r S
[PROOF STEP]
case (3 S X x r)
[PROOF STATE]
proof (state)
this:
inv_approx S X r \<and> \<not> X \<noteq> V

goal (1 subgoal):
 1. \<And>S X x r. inv_approx S X r \<and> \<not> X \<noteq> V \<Longrightarrow> approximation_miv r S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inv_approx S X r \<and> \<not> X \<noteq> V
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
inv_approx S X r \<and> \<not> X \<noteq> V

goal (1 subgoal):
 1. approximation_miv r S
[PROOF STEP]
using inv_approx
[PROOF STATE]
proof (prove)
using this:
inv_approx S X r \<and> \<not> X \<noteq> V
\<lbrakk>independent_vertices E ?S; card V \<le> card ?S * ?r\<rbrakk> \<Longrightarrow> approximation_miv ?r ?S

goal (1 subgoal):
 1. approximation_miv r S
[PROOF STEP]
unfolding inv_approx_def inv_iv_def
[PROOF STATE]
proof (prove)
using this:
((independent_vertices E S \<and> X \<subseteq> V \<and> (\<forall>v1\<in>V - X. \<forall>v2\<in>S. {v1, v2} \<notin> E) \<and> S \<subseteq> X) \<and> card X \<le> card S * r) \<and> \<not> X \<noteq> V
\<lbrakk>independent_vertices E ?S; card V \<le> card ?S * ?r\<rbrakk> \<Longrightarrow> approximation_miv ?r ?S

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma conj_galois_1:
  assumes "is_conjugation f g"
  shows "f x \<le> y \<longleftrightarrow> x \<le> -g (-y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f x \<le> y) = (x \<le> - g (- y))
[PROOF STEP]
by (metis assms is_conjugation_def double_compl galois_aux)


[STATEMENT]
lemma finite_varposs: "finite (varposs s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (varposs s)
[PROOF STEP]
by (intro finite_subset[of "varposs s" "poss s"]) (auto simp: varposs_def finite_poss)


[STATEMENT]
lemma islimpt_UNIV_iff: "x islimpt UNIV \<longleftrightarrow> \<not> open {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x islimpt UNIV = (\<not> open {x})
[PROOF STEP]
unfolding islimpt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>T. x \<in> T \<longrightarrow> open T \<longrightarrow> (\<exists>y\<in>UNIV. y \<in> T \<and> y \<noteq> x)) = (\<not> open {x})
[PROOF STEP]
by (safe, fast, case_tac "T = {x}", fast, fast)


[STATEMENT]
lemma idiv_0: "0 div (a::enat) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 div a = 0
[PROOF STEP]
unfolding div_enat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case 0 of enat x \<Rightarrow> case a of enat y \<Rightarrow> enat (x div y) | \<infinity> \<Rightarrow> 0 | \<infinity> \<Rightarrow> case a of enat 0 \<Rightarrow> 0 | enat (Suc n) \<Rightarrow> \<infinity> | \<infinity> \<Rightarrow> \<infinity>) = 0
[PROOF STEP]
by (case_tac a, simp_all)


[STATEMENT]
lemma normalize_field:
  "normalize (x :: 'a :: {normalization_semidom,field}) = (if x = 0 then 0 else 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize x = (if x = (0::'a) then 0::'a else (1::'a))
[PROOF STEP]
by (auto simp: normalize_1_iff dvd_field_iff)