[STATEMENT]
lemma same_size_R:
  fixes p:: "real poly"
  fixes qs :: "real poly list"
  fixes subsets :: "(nat list*nat list) list"
  fixes signs :: "rat list list"
  assumes invertible_mat: "invertible_mat (matrix_A_R signs subsets)"
  shows "length subsets = length signs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length subsets = length signs
[PROOF STEP]
using invertible_mat
[PROOF STATE]
proof (prove)
using this:
invertible_mat (M_mat_R signs subsets)

goal (1 subgoal):
 1. length subsets = length signs
[PROOF STEP]
unfolding invertible_mat_def
[PROOF STATE]
proof (prove)
using this:
square_mat (M_mat_R signs subsets) \<and> (\<exists>B. inverts_mat (M_mat_R signs subsets) B \<and> inverts_mat B (M_mat_R signs subsets))

goal (1 subgoal):
 1. length subsets = length signs
[PROOF STEP]
using size_of_mat_R[of signs subsets] size_of_lhs_R[of p qs signs] size_of_rhs_R[of p qs subsets]
[PROOF STATE]
proof (prove)
using this:
square_mat (M_mat_R signs subsets) \<and> (\<exists>B. inverts_mat (M_mat_R signs subsets) B \<and> inverts_mat B (M_mat_R signs subsets))
M_mat_R signs subsets \<in> carrier_mat (length subsets) (length signs)
dim_vec (w_vec_R p qs signs) = length signs
dim_vec (v_vec_R p qs subsets) = length subsets

goal (1 subgoal):
 1. length subsets = length signs
[PROOF STEP]
by simp


[STATEMENT]
lemma inext_eq: "
  \<lbrakk> inext a I = inext b I; \<exists>x\<in>I. a < x; \<exists>x\<in>I. b < x \<rbrakk> \<Longrightarrow> a = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inext a I = inext b I; \<exists>x\<in>I. a < x; \<exists>x\<in>I. b < x\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
by (metis iprev_inext not_le wellorder_Max_lemma)


[STATEMENT]
lemma A7_Acc:
"(Acc level0 sA7) = {sA8, sA9}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Acc level0 sA7 = {sA8, sA9}
[PROOF STEP]
by (metis A7_DAcc_level0 A8_DAcc_level0 A9_DAcc_level0 AccDef AccSigleLoop insert_commute)


[STATEMENT]
lemma cinner_sup_onorm:
  fixes A :: \<open>'a::{real_normed_vector,not_singleton} \<Rightarrow> 'b::complex_inner\<close>
  assumes \<open>bounded_linear A\<close>
  shows \<open>onorm A = (SUP (\<psi>,\<phi>). cmod (cinner \<psi> (A \<phi>)) / (norm \<psi> * norm \<phi>))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm A = (SUP (\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>))
[PROOF STEP]
proof (unfold onorm_def, rule cSup_eq_cSup)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. bdd_above (range (\<lambda>x. norm (A x) / norm x))
 2. \<And>a. a \<in> range (\<lambda>x. norm (A x) / norm x) \<Longrightarrow> \<exists>b\<in>range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)). a \<le> b
 3. \<And>b. b \<in> range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)) \<Longrightarrow> \<exists>a\<in>range (\<lambda>x. norm (A x) / norm x). b \<le> a
[PROOF STEP]
show \<open>bdd_above (range (\<lambda>x. norm (A x) / norm x))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_above (range (\<lambda>x. norm (A x) / norm x))
[PROOF STEP]
by (meson assms bdd_aboveI2 le_onorm)
[PROOF STATE]
proof (state)
this:
bdd_above (range (\<lambda>x. norm (A x) / norm x))

goal (2 subgoals):
 1. \<And>a. a \<in> range (\<lambda>x. norm (A x) / norm x) \<Longrightarrow> \<exists>b\<in>range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)). a \<le> b
 2. \<And>b. b \<in> range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)) \<Longrightarrow> \<exists>a\<in>range (\<lambda>x. norm (A x) / norm x). b \<le> a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. a \<in> range (\<lambda>x. norm (A x) / norm x) \<Longrightarrow> \<exists>b\<in>range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)). a \<le> b
 2. \<And>b. b \<in> range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)) \<Longrightarrow> \<exists>a\<in>range (\<lambda>x. norm (A x) / norm x). b \<le> a
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. a \<in> range (\<lambda>x. norm (A x) / norm x) \<Longrightarrow> \<exists>b\<in>range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)). a \<le> b
 2. \<And>b. b \<in> range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)) \<Longrightarrow> \<exists>a\<in>range (\<lambda>x. norm (A x) / norm x). b \<le> a
[PROOF STEP]
assume \<open>a \<in> range (\<lambda>\<phi>. norm (A \<phi>) / norm \<phi>)\<close>
[PROOF STATE]
proof (state)
this:
a \<in> range (\<lambda>\<phi>. norm (A \<phi>) / norm \<phi>)

goal (2 subgoals):
 1. \<And>a. a \<in> range (\<lambda>x. norm (A x) / norm x) \<Longrightarrow> \<exists>b\<in>range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)). a \<le> b
 2. \<And>b. b \<in> range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)) \<Longrightarrow> \<exists>a\<in>range (\<lambda>x. norm (A x) / norm x). b \<le> a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> range (\<lambda>\<phi>. norm (A \<phi>) / norm \<phi>)
[PROOF STEP]
obtain \<phi> where \<open>a = norm (A \<phi>) / norm \<phi>\<close>
[PROOF STATE]
proof (prove)
using this:
a \<in> range (\<lambda>\<phi>. norm (A \<phi>) / norm \<phi>)

goal (1 subgoal):
 1. (\<And>\<phi>. a = norm (A \<phi>) / norm \<phi> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a = norm (A \<phi>) / norm \<phi>

goal (2 subgoals):
 1. \<And>a. a \<in> range (\<lambda>x. norm (A x) / norm x) \<Longrightarrow> \<exists>b\<in>range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)). a \<le> b
 2. \<And>b. b \<in> range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)) \<Longrightarrow> \<exists>a\<in>range (\<lambda>x. norm (A x) / norm x). b \<le> a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = norm (A \<phi>) / norm \<phi>
[PROOF STEP]
have \<open>a \<le> cmod (cinner (A \<phi>) (A \<phi>)) / (norm (A \<phi>) * norm \<phi>)\<close>
[PROOF STATE]
proof (prove)
using this:
a = norm (A \<phi>) / norm \<phi>

goal (1 subgoal):
 1. a \<le> cmod (A \<phi> \<bullet>\<^sub>C A \<phi>) / (norm (A \<phi>) * norm \<phi>)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = norm (A \<phi>) / norm \<phi> \<Longrightarrow> norm (A \<phi>) / norm \<phi> \<le> cmod (A \<phi> \<bullet>\<^sub>C A \<phi>) / (norm (A \<phi>) * norm \<phi>)
[PROOF STEP]
by (smt (verit) divide_divide_eq_left norm_eq_sqrt_cinner norm_imp_pos_and_ge real_div_sqrt)
[PROOF STATE]
proof (state)
this:
a \<le> cmod (A \<phi> \<bullet>\<^sub>C A \<phi>) / (norm (A \<phi>) * norm \<phi>)

goal (2 subgoals):
 1. \<And>a. a \<in> range (\<lambda>x. norm (A x) / norm x) \<Longrightarrow> \<exists>b\<in>range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)). a \<le> b
 2. \<And>b. b \<in> range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)) \<Longrightarrow> \<exists>a\<in>range (\<lambda>x. norm (A x) / norm x). b \<le> a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<le> cmod (A \<phi> \<bullet>\<^sub>C A \<phi>) / (norm (A \<phi>) * norm \<phi>)
[PROOF STEP]
show \<open>\<exists>b\<in>range (\<lambda>(\<psi>, \<phi>). cmod (cinner \<psi> (A \<phi>)) / (norm \<psi> * norm \<phi>)). a \<le> b\<close>
[PROOF STATE]
proof (prove)
using this:
a \<le> cmod (A \<phi> \<bullet>\<^sub>C A \<phi>) / (norm (A \<phi>) * norm \<phi>)

goal (1 subgoal):
 1. \<exists>b\<in>range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)). a \<le> b
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>b\<in>range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)). a \<le> b

goal (1 subgoal):
 1. \<And>b. b \<in> range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)) \<Longrightarrow> \<exists>a\<in>range (\<lambda>x. norm (A x) / norm x). b \<le> a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b. b \<in> range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)) \<Longrightarrow> \<exists>a\<in>range (\<lambda>x. norm (A x) / norm x). b \<le> a
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b. b \<in> range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)) \<Longrightarrow> \<exists>a\<in>range (\<lambda>x. norm (A x) / norm x). b \<le> a
[PROOF STEP]
assume \<open>b \<in> range (\<lambda>(\<psi>, \<phi>). cmod (cinner \<psi> (A \<phi>)) / (norm \<psi> * norm \<phi>))\<close>
[PROOF STATE]
proof (state)
this:
b \<in> range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>))

goal (1 subgoal):
 1. \<And>b. b \<in> range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)) \<Longrightarrow> \<exists>a\<in>range (\<lambda>x. norm (A x) / norm x). b \<le> a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b \<in> range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>))
[PROOF STEP]
obtain \<psi> \<phi> where b: \<open>b = cmod (cinner \<psi> (A \<phi>)) / (norm \<psi> * norm \<phi>)\<close>
[PROOF STATE]
proof (prove)
using this:
b \<in> range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>))

goal (1 subgoal):
 1. (\<And>\<psi> \<phi>. b = cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b = cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)

goal (1 subgoal):
 1. \<And>b. b \<in> range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)) \<Longrightarrow> \<exists>a\<in>range (\<lambda>x. norm (A x) / norm x). b \<le> a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b = cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)
[PROOF STEP]
have \<open>b \<le> norm (A \<phi>) / norm \<phi>\<close>
[PROOF STATE]
proof (prove)
using this:
b = cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)

goal (1 subgoal):
 1. b \<le> norm (A \<phi>) / norm \<phi>
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b = cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>) \<Longrightarrow> cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>) \<le> norm (A \<phi>) / norm \<phi>
[PROOF STEP]
by (smt (verit, ccfv_threshold) complex_inner_class.Cauchy_Schwarz_ineq2 division_ring_divide_zero linordered_field_class.divide_right_mono mult_cancel_left1 nonzero_mult_divide_mult_cancel_left2 norm_imp_pos_and_ge ordered_field_class.sign_simps(33) zero_le_divide_iff)
[PROOF STATE]
proof (state)
this:
b \<le> norm (A \<phi>) / norm \<phi>

goal (1 subgoal):
 1. \<And>b. b \<in> range (\<lambda>(\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C A \<phi>) / (norm \<psi> * norm \<phi>)) \<Longrightarrow> \<exists>a\<in>range (\<lambda>x. norm (A x) / norm x). b \<le> a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b \<le> norm (A \<phi>) / norm \<phi>
[PROOF STEP]
show \<open>\<exists>a\<in>range (\<lambda>x. norm (A x) / norm x). b \<le> a\<close>
[PROOF STATE]
proof (prove)
using this:
b \<le> norm (A \<phi>) / norm \<phi>

goal (1 subgoal):
 1. \<exists>a\<in>range (\<lambda>x. norm (A x) / norm x). b \<le> a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>a\<in>range (\<lambda>x. norm (A x) / norm x). b \<le> a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma add_less_mono2: "i < (j::nat) \<Longrightarrow> k + i < k + j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < j \<Longrightarrow> k + i < k + j
[PROOF STEP]
by simp


[STATEMENT]
lemma DERIV_exp [simp]: "DERIV exp x :> exp x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (exp has_field_derivative exp x) (at x)
[PROOF STEP]
unfolding exp_def scaleR_conv_of_real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>n. of_real (inverse (fact n)) * x ^ n) has_field_derivative (\<Sum>n. of_real (inverse (fact n)) * x ^ n)) (at x)
[PROOF STEP]
proof (rule DERIV_cong)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ((\<lambda>x. \<Sum>n. of_real (inverse (fact n)) * x ^ n) has_field_derivative ?X) (at x)
 2. ?X = (\<Sum>n. of_real (inverse (fact n)) * x ^ n)
[PROOF STEP]
have sinv: "summable (\<lambda>n. of_real (inverse (fact n)) * x ^ n)" for x::'a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. of_real (inverse (fact n)) * x ^ n)
[PROOF STEP]
by (rule exp_converges [THEN sums_summable, unfolded scaleR_conv_of_real])
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. of_real (inverse (fact n)) * ?x ^ n)

goal (2 subgoals):
 1. ((\<lambda>x. \<Sum>n. of_real (inverse (fact n)) * x ^ n) has_field_derivative ?X) (at x)
 2. ?X = (\<Sum>n. of_real (inverse (fact n)) * x ^ n)
[PROOF STEP]
note xx = exp_converges [THEN sums_summable, unfolded scaleR_conv_of_real]
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. of_real (inverse (fact n)) * ?x1 ^ n)

goal (2 subgoals):
 1. ((\<lambda>x. \<Sum>n. of_real (inverse (fact n)) * x ^ n) has_field_derivative ?X) (at x)
 2. ?X = (\<Sum>n. of_real (inverse (fact n)) * x ^ n)
[PROOF STEP]
show "((\<lambda>x. \<Sum>n. of_real (inverse (fact n)) * x ^ n) has_field_derivative
        (\<Sum>n. diffs (\<lambda>n. of_real (inverse (fact n))) n * x ^ n))  (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>n. of_real (inverse (fact n)) * x ^ n) has_field_derivative (\<Sum>n. diffs (\<lambda>n. of_real (inverse (fact n))) n * x ^ n)) (at x)
[PROOF STEP]
by (rule termdiffs [where K="of_real (1 + norm x)"]) (simp_all only: diffs_of_real exp_fdiffs sinv norm_of_real)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<Sum>n. of_real (inverse (fact n)) * x ^ n) has_field_derivative (\<Sum>n. diffs (\<lambda>n. of_real (inverse (fact n))) n * x ^ n)) (at x)

goal (1 subgoal):
 1. (\<Sum>n. diffs (\<lambda>n. of_real (inverse (fact n))) n * x ^ n) = (\<Sum>n. of_real (inverse (fact n)) * x ^ n)
[PROOF STEP]
show "(\<Sum>n. diffs (\<lambda>n. of_real (inverse (fact n))) n * x ^ n) = (\<Sum>n. of_real (inverse (fact n)) * x ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. diffs (\<lambda>n. of_real (inverse (fact n))) n * x ^ n) = (\<Sum>n. of_real (inverse (fact n)) * x ^ n)
[PROOF STEP]
by (simp add: diffs_of_real exp_fdiffs)
[PROOF STATE]
proof (state)
this:
(\<Sum>n. diffs (\<lambda>n. of_real (inverse (fact n))) n * x ^ n) = (\<Sum>n. of_real (inverse (fact n)) * x ^ n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pCons2:" (pCons 0 1) \<noteq> (1::int poly)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pCons 0 1 \<noteq> 1
[PROOF STEP]
using eval_pCons poly_1 zero_neq_one
[PROOF STATE]
proof (prove)
using this:
poly (pCons (0::?'a) 1) ?x = ?x
poly 1 ?x = (1::?'a)
(0::?'a) \<noteq> (1::?'a)

goal (1 subgoal):
 1. pCons 0 1 \<noteq> 1
[PROOF STEP]
by metis


[STATEMENT]
lemma P_inf_eq_E_inf:
  assumes [measurable]: "Measurable.pred St P"
  shows "P_inf s P = E_inf s (indicator {x\<in>space St. P x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P_inf s P = E_inf s (indicator {x \<in> space St. P x})
[PROOF STEP]
by (auto simp add: P_inf_def E_inf_def intro!: SUP_cong nn_integral_cong)


[STATEMENT]
lemma (in aGroup) agsum_add2m:"\<lbrakk>a \<in> carrier A; n < 0\<rbrakk> \<Longrightarrow>
                                    \<zero> = n\<triangleright>a\<^bsub>A\<^esub> \<plusminus> ((-n)\<triangleright>a\<^bsub>A\<^esub>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; n < 0\<rbrakk> \<Longrightarrow> \<zero> = n\<triangleright>a\<^bsub>A\<^esub> \<plusminus> (- n)\<triangleright>a\<^bsub>A\<^esub>
[PROOF STEP]
apply (simp add:sprod_n_a_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; n < 0\<rbrakk> \<Longrightarrow> \<zero> = aSum A (nat (- n)) (-\<^sub>a a) \<plusminus> aSum A (nat (- n)) a
[PROOF STEP]
apply (subst ag_pOp_commute)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>a \<in> carrier A; n < 0\<rbrakk> \<Longrightarrow> aSum A (nat (- n)) (-\<^sub>a a) \<in> carrier A
 2. \<lbrakk>a \<in> carrier A; n < 0\<rbrakk> \<Longrightarrow> aSum A (nat (- n)) a \<in> carrier A
 3. \<lbrakk>a \<in> carrier A; n < 0\<rbrakk> \<Longrightarrow> \<zero> = aSum A (nat (- n)) a \<plusminus> aSum A (nat (- n)) (-\<^sub>a a)
[PROOF STEP]
apply (rule asum_mem)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>a \<in> carrier A; n < 0\<rbrakk> \<Longrightarrow> -\<^sub>a a \<in> carrier A
 2. \<lbrakk>a \<in> carrier A; n < 0\<rbrakk> \<Longrightarrow> aSum A (nat (- n)) a \<in> carrier A
 3. \<lbrakk>a \<in> carrier A; n < 0\<rbrakk> \<Longrightarrow> \<zero> = aSum A (nat (- n)) a \<plusminus> aSum A (nat (- n)) (-\<^sub>a a)
[PROOF STEP]
apply (simp add:ag_mOp_closed)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>a \<in> carrier A; n < 0\<rbrakk> \<Longrightarrow> aSum A (nat (- n)) a \<in> carrier A
 2. \<lbrakk>a \<in> carrier A; n < 0\<rbrakk> \<Longrightarrow> \<zero> = aSum A (nat (- n)) a \<plusminus> aSum A (nat (- n)) (-\<^sub>a a)
[PROOF STEP]
apply (rule asum_mem, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; n < 0\<rbrakk> \<Longrightarrow> \<zero> = aSum A (nat (- n)) a \<plusminus> aSum A (nat (- n)) (-\<^sub>a a)
[PROOF STEP]
apply (simp add:agsum_add2Tr)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma multiplicity_prime_cong_3_mod_4:
  assumes "prime (of_nat q :: gauss_int)"
  shows   "multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
[PROOF STEP]
proof (cases "z = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z = 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
 2. z \<noteq> 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
[PROOF STEP]
case [simp]: False
[PROOF STATE]
proof (state)
this:
z \<noteq> 0

goal (2 subgoals):
 1. z = 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
 2. z \<noteq> 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
[PROOF STEP]
have "multiplicity q (gauss_int_norm z) =
          multiplicity (of_nat q) (of_nat (gauss_int_norm z) :: gauss_int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity q (gauss_int_norm z) = multiplicity (of_nat q) (of_nat (gauss_int_norm z))
[PROOF STEP]
by (simp add: multiplicity_gauss_int_of_nat)
[PROOF STATE]
proof (state)
this:
multiplicity q (gauss_int_norm z) = multiplicity (of_nat q) (of_nat (gauss_int_norm z))

goal (2 subgoals):
 1. z = 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
 2. z \<noteq> 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multiplicity q (gauss_int_norm z) = multiplicity (of_nat q) (of_nat (gauss_int_norm z))

goal (2 subgoals):
 1. z = 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
 2. z \<noteq> 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
[PROOF STEP]
have "\<dots> = multiplicity (of_nat q) (z * gauss_cnj z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity (of_nat q) (of_nat (gauss_int_norm z)) = multiplicity (of_nat q) (z * gauss_cnj z)
[PROOF STEP]
by (simp add: self_mult_gauss_cnj)
[PROOF STATE]
proof (state)
this:
multiplicity (of_nat q) (of_nat (gauss_int_norm z)) = multiplicity (of_nat q) (z * gauss_cnj z)

goal (2 subgoals):
 1. z = 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
 2. z \<noteq> 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multiplicity (of_nat q) (of_nat (gauss_int_norm z)) = multiplicity (of_nat q) (z * gauss_cnj z)

goal (2 subgoals):
 1. z = 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
 2. z \<noteq> 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
[PROOF STEP]
have "\<dots> = multiplicity (of_nat q) z + multiplicity (gauss_cnj (of_nat q)) (gauss_cnj z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity (of_nat q) (z * gauss_cnj z) = multiplicity (of_nat q) z + multiplicity (gauss_cnj (of_nat q)) (gauss_cnj z)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime (of_nat q)

goal (1 subgoal):
 1. multiplicity (of_nat q) (z * gauss_cnj z) = multiplicity (of_nat q) z + multiplicity (gauss_cnj (of_nat q)) (gauss_cnj z)
[PROOF STEP]
by (subst prime_elem_multiplicity_mult_distrib) auto
[PROOF STATE]
proof (state)
this:
multiplicity (of_nat q) (z * gauss_cnj z) = multiplicity (of_nat q) z + multiplicity (gauss_cnj (of_nat q)) (gauss_cnj z)

goal (2 subgoals):
 1. z = 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
 2. z \<noteq> 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multiplicity (of_nat q) (z * gauss_cnj z) = multiplicity (of_nat q) z + multiplicity (gauss_cnj (of_nat q)) (gauss_cnj z)

goal (2 subgoals):
 1. z = 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
 2. z \<noteq> 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
[PROOF STEP]
have "multiplicity (gauss_cnj (of_nat q)) (gauss_cnj z) = multiplicity (of_nat q) z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity (gauss_cnj (of_nat q)) (gauss_cnj z) = multiplicity (of_nat q) z
[PROOF STEP]
by (subst multiplicity_gauss_cnj) auto
[PROOF STATE]
proof (state)
this:
multiplicity (gauss_cnj (of_nat q)) (gauss_cnj z) = multiplicity (of_nat q) z

goal (2 subgoals):
 1. z = 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
 2. z \<noteq> 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multiplicity (gauss_cnj (of_nat q)) (gauss_cnj z) = multiplicity (of_nat q) z

goal (2 subgoals):
 1. z = 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
 2. z \<noteq> 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
[PROOF STEP]
have "\<dots> + \<dots> = 2 * \<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity (of_nat q) z + multiplicity (of_nat q) z = 2 * multiplicity (of_nat q) z
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
multiplicity (of_nat q) z + multiplicity (of_nat q) z = 2 * multiplicity (of_nat q) z

goal (2 subgoals):
 1. z = 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
 2. z \<noteq> 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z

goal (1 subgoal):
 1. multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z

goal (1 subgoal):
 1. z = 0 \<Longrightarrow> multiplicity q (gauss_int_norm z) = 2 * multiplicity (of_nat q) z
[PROOF STEP]
qed auto


[STATEMENT]
lemma deg_pm_plus: "deg_pm (s + t) = deg_pm s + deg_pm (t::'a \<Rightarrow>\<^sub>0 'b::comm_monoid_add)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deg_pm (s + t) = deg_pm s + deg_pm t
[PROOF STEP]
by (simp only: deg_pm.rep_eq lookup_plus_fun, rule deg_fun_plus, simp_all add: keys_eq_supp[symmetric])


[STATEMENT]
lemma lat_ideals: "X \<in> ideals = (X \<noteq> {} \<and> X \<in> downsets \<and> (\<forall>x \<in> X. \<forall> y \<in> X. x \<squnion> y \<in> X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. idealp X = (X \<noteq> {} \<and> X \<in> downsets \<and> (\<forall>x\<in>X. \<forall>y\<in>X. x \<squnion> y \<in> X))
[PROOF STEP]
unfolding ideals_def directed_alt downsets_def Fix_def downset_set_def downclosed_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X \<in> {X. X \<noteq> {} \<and> X \<in> {x. {y. Bex x ((\<le>) y)} = x} \<and> X \<noteq> {} \<and> (\<forall>x\<in>X. \<forall>y\<in>X. \<exists>z\<in>X. x \<le> z \<and> y \<le> z)}) = (X \<noteq> {} \<and> X \<in> {x. {y. Bex x ((\<le>) y)} = x} \<and> (\<forall>x\<in>X. \<forall>y\<in>X. x \<squnion> y \<in> X))
[PROOF STEP]
by (clarsimp, smt sup.cobounded1 sup.orderE sup.orderI sup_absorb2 sup_left_commute mem_Collect_eq)


[STATEMENT]
lemma measure_Pi_pmf_Pi:
  fixes t::nat
  assumes [simp]: "finite A"
  shows   "measure_pmf.prob (Pi_pmf A dflt p) (Pi A B) =
             (\<Prod>x\<in>A. measure_pmf.prob (p x) (B x))" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob (Pi_pmf.Pi_pmf A dflt p) (Pi A B) = (\<Prod>x\<in>A. measure_pmf.prob (p x) (B x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. measure_pmf.prob (Pi_pmf.Pi_pmf A dflt p) (Pi A B) = (\<Prod>x\<in>A. measure_pmf.prob (p x) (B x))
[PROOF STEP]
have "?lhs = measure_pmf.prob (Pi_pmf A dflt p) (PiE_dflt A dflt B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob (Pi_pmf.Pi_pmf A dflt p) (Pi A B) = measure_pmf.prob (Pi_pmf.Pi_pmf A dflt p) (Pi_pmf.PiE_dflt A dflt B)
[PROOF STEP]
by (intro measure_prob_cong_0)
       (auto simp: PiE_dflt_def PiE_def intro!: pmf_Pi_outside)+
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (Pi_pmf.Pi_pmf A dflt p) (Pi A B) = measure_pmf.prob (Pi_pmf.Pi_pmf A dflt p) (Pi_pmf.PiE_dflt A dflt B)

goal (1 subgoal):
 1. measure_pmf.prob (Pi_pmf.Pi_pmf A dflt p) (Pi A B) = (\<Prod>x\<in>A. measure_pmf.prob (p x) (B x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (Pi_pmf.Pi_pmf A dflt p) (Pi A B) = measure_pmf.prob (Pi_pmf.Pi_pmf A dflt p) (Pi_pmf.PiE_dflt A dflt B)

goal (1 subgoal):
 1. measure_pmf.prob (Pi_pmf.Pi_pmf A dflt p) (Pi A B) = (\<Prod>x\<in>A. measure_pmf.prob (p x) (B x))
[PROOF STEP]
have "\<dots> = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob (Pi_pmf.Pi_pmf A dflt p) (Pi_pmf.PiE_dflt A dflt B) = (\<Prod>x\<in>A. measure_pmf.prob (p x) (B x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. measure_pmf.prob (Pi_pmf.Pi_pmf A dflt p) (Pi_pmf.PiE_dflt A dflt B) = (\<Prod>x\<in>A. measure_pmf.prob (p x) (B x))
[PROOF STEP]
by (simp add: measure_Pi_pmf_PiE_dflt)
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (Pi_pmf.Pi_pmf A dflt p) (Pi_pmf.PiE_dflt A dflt B) = (\<Prod>x\<in>A. measure_pmf.prob (p x) (B x))

goal (1 subgoal):
 1. measure_pmf.prob (Pi_pmf.Pi_pmf A dflt p) (Pi A B) = (\<Prod>x\<in>A. measure_pmf.prob (p x) (B x))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
measure_pmf.prob (Pi_pmf.Pi_pmf A dflt p) (Pi A B) = (\<Prod>x\<in>A. measure_pmf.prob (p x) (B x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
measure_pmf.prob (Pi_pmf.Pi_pmf A dflt p) (Pi A B) = (\<Prod>x\<in>A. measure_pmf.prob (p x) (B x))

goal (1 subgoal):
 1. measure_pmf.prob (Pi_pmf.Pi_pmf A dflt p) (Pi A B) = (\<Prod>x\<in>A. measure_pmf.prob (p x) (B x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
measure_pmf.prob (Pi_pmf.Pi_pmf A dflt p) (Pi A B) = (\<Prod>x\<in>A. measure_pmf.prob (p x) (B x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_filter_snd_zip:
  "length ys = length xs \<Longrightarrow> length (filter (p \<circ> snd) (zip ys xs)) = length (filter p xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length ys = length xs \<Longrightarrow> length (filter (p \<circ> snd) (zip ys xs)) = length (filter p xs)
[PROOF STEP]
by (induct ys xs rule: list_induct2) (auto )


[STATEMENT]
lemma iT_Mult_Un: "(A \<union> B) \<otimes> k = (A \<otimes> k) \<union> (B \<otimes> k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<union> B \<otimes> k = (A \<otimes> k) \<union> (B \<otimes> k)
[PROOF STEP]
by (simp add: iT_Mult_def image_Un)


[STATEMENT]
lemma Nsetn_sub_mem1:"\<forall>j. j \<in> {j. j \<le> n} \<longrightarrow> j \<in> {j. j \<le> (Suc n)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>j. j \<in> {j. j \<le> n} \<longrightarrow> j \<in> {j. j \<le> Suc n}
[PROOF STEP]
by (simp add:Nsetn_sub_mem)


[STATEMENT]
theorem hoare_fixpoint:
  "mono_mono F \<Longrightarrow>
   (!! w f . mono f \<and> \<Turnstile> Sup_less p w {| f |} y \<Longrightarrow> \<Turnstile> p w {| F f |} y) \<Longrightarrow> \<Turnstile> (Sup (range p)) {| lfp F |} y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>mono_mono F; \<And>w f. mono f \<and> \<Turnstile> Sup_less p w{| f |}y \<Longrightarrow> \<Turnstile> p w{| F f |}y\<rbrakk> \<Longrightarrow> \<Turnstile> \<Squnion>range p{| lfp F |}y
[PROOF STEP]
apply (simp add: mono_mono_def hoare_refinement_post assert_Sup_range Sup_range_comp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>mono F \<and> (\<forall>f. mono f \<longrightarrow> mono (F f)); \<And>w f. mono f \<and> \<Turnstile> Sup_less p w{| f |}y \<Longrightarrow> {. p w .} \<circ> post_fun y \<sqsubseteq> F f\<rbrakk> \<Longrightarrow> (SUP x. {. p x .} \<circ> post_fun y) \<sqsubseteq> lfp F
[PROOF STEP]
apply (rule lfp_wf_induction)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>mono F \<and> (\<forall>f. mono f \<longrightarrow> mono (F f)); \<And>w f. mono f \<and> \<Turnstile> Sup_less p w{| f |}y \<Longrightarrow> {. p w .} \<circ> post_fun y \<sqsubseteq> F f\<rbrakk> \<Longrightarrow> mono F
 2. \<lbrakk>mono F \<and> (\<forall>f. mono f \<longrightarrow> mono (F f)); \<And>w f. mono f \<and> \<Turnstile> Sup_less p w{| f |}y \<Longrightarrow> {. p w .} \<circ> post_fun y \<sqsubseteq> F f\<rbrakk> \<Longrightarrow> \<forall>w. {. p w .} \<circ> post_fun y \<sqsubseteq> F (Sup_less (\<lambda>x. {. p x .} \<circ> post_fun y) w)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>w. \<lbrakk>\<And>w f. mono f \<and> \<Turnstile> Sup_less p w{| f |}y \<Longrightarrow> {. p w .} \<circ> post_fun y \<sqsubseteq> F f; mono F; \<forall>f. mono f \<longrightarrow> mono (F f)\<rbrakk> \<Longrightarrow> {. p w .} \<circ> post_fun y \<sqsubseteq> F (Sup_less (\<lambda>x. {. p x .} \<circ> post_fun y) w)
[PROOF STEP]
apply (simp add: Sup_less_comp [THEN sym])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>w. \<lbrakk>\<And>w f. mono f \<and> \<Turnstile> Sup_less p w{| f |}y \<Longrightarrow> {. p w .} \<circ> post_fun y \<sqsubseteq> F f; mono F; \<forall>f. mono f \<longrightarrow> mono (F f)\<rbrakk> \<Longrightarrow> {. p w .} \<circ> post_fun y \<sqsubseteq> F (Sup_less (\<lambda>x. {. p x .}) w \<circ> post_fun y)
[PROOF STEP]
apply (simp add: Sup_less_assert)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>w. \<lbrakk>\<And>w f. mono f \<and> \<Turnstile> Sup_less p w{| f |}y \<Longrightarrow> {. p w .} \<circ> post_fun y \<sqsubseteq> F f; mono F; \<forall>f. mono f \<longrightarrow> mono (F f)\<rbrakk> \<Longrightarrow> {. p w .} \<circ> post_fun y \<sqsubseteq> F ({. Sup_less p w .} \<circ> post_fun y)
[PROOF STEP]
apply (drule_tac x = "{. Sup_less p w .} \<circ> post_fun y" in spec, safe)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>w. \<lbrakk>\<And>w f. mono f \<and> \<Turnstile> Sup_less p w{| f |}y \<Longrightarrow> {. p w .} \<circ> post_fun y \<sqsubseteq> F f; mono F; \<not> mono ({. Sup_less p w .} \<circ> post_fun y)\<rbrakk> \<Longrightarrow> {. p w .} \<circ> post_fun y \<sqsubseteq> F ({. Sup_less p w .} \<circ> post_fun y)
 2. \<And>w. \<lbrakk>\<And>w f. mono f \<and> \<Turnstile> Sup_less p w{| f |}y \<Longrightarrow> {. p w .} \<circ> post_fun y \<sqsubseteq> F f; mono F; mono (F ({. Sup_less p w .} \<circ> post_fun y))\<rbrakk> \<Longrightarrow> {. p w .} \<circ> post_fun y \<sqsubseteq> F ({. Sup_less p w .} \<circ> post_fun y)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>w. \<lbrakk>\<And>w f. mono f \<and> \<Turnstile> Sup_less p w{| f |}y \<Longrightarrow> {. p w .} \<circ> post_fun y \<sqsubseteq> F f; mono F; mono (F ({. Sup_less p w .} \<circ> post_fun y))\<rbrakk> \<Longrightarrow> {. p w .} \<circ> post_fun y \<sqsubseteq> F ({. Sup_less p w .} \<circ> post_fun y)
[PROOF STEP]
by (simp add: hoare_refinement_post)


[STATEMENT]
lemma inverse_eq_infinity_iff_eq_zero [simp]:
  "1/(x::ereal) = \<infinity> \<longleftrightarrow> x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 / x = \<infinity>) = (x = 0)
[PROOF STEP]
by (simp add: divide_ereal_def)


[STATEMENT]
lemma prts: "a = pprt a + nprt a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = pprt a + nprt a
[PROOF STEP]
by (simp add: pprt_def nprt_def flip: add_eq_inf_sup)


[STATEMENT]
lemma Fix_lsl_lsu: "Fix (\<nu>::'a::unital_quantale \<Rightarrow> 'a) = Fix \<nu>\<^sup>\<natural>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fix \<nu> = Fix \<nu>\<^sup>\<natural>
[PROOF STEP]
unfolding Fix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. \<nu> x = x} = {x. \<nu>\<^sup>\<natural> x = x}
[PROOF STEP]
by (simp add: lsided_def3)


[STATEMENT]
lemma Quo0:
  shows "Quo 0 y = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Quo 0 y = 0
[PROOF STEP]
by (induct y) (auto)


[STATEMENT]
lemma coclop_coclosure_prop_var: "coclop (\<lambda>x::'a::complete_lattice. \<Squnion>{y. y \<le> x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coclop (\<lambda>x. \<Squnion> {y. y \<le> x})
[PROOF STEP]
by (metis (mono_tags, lifting) Sup_atMost atMost_def coclop_def comp_apply eq_id_iff eq_refl mono_def)


[STATEMENT]
lemma le_fin_lproject_visible:
      assumes "u \<preceq>\<^sub>F v"
      shows "lproject visible (llist_of u) \<le> lproject visible (llist_of v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lproject visible (llist_of u) \<le> lproject visible (llist_of v)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lproject visible (llist_of u) \<le> lproject visible (llist_of v)
[PROOF STEP]
obtain w where 1: "u @ w =\<^sub>F v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>w. u @ w =\<^sub>F v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
u \<preceq>\<^sub>F v

goal (1 subgoal):
 1. (\<And>w. u @ w =\<^sub>F v \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by rule
[PROOF STATE]
proof (state)
this:
u @ w =\<^sub>F v

goal (1 subgoal):
 1. lproject visible (llist_of u) \<le> lproject visible (llist_of v)
[PROOF STEP]
have "lproject visible (llist_of u) \<le>
        lproject visible (llist_of u) $ lproject visible (llist_of w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lproject visible (llist_of u) \<le> lproject visible (llist_of u) $ lproject visible (llist_of w)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lproject visible (llist_of u) \<le> lproject visible (llist_of u) $ lproject visible (llist_of w)

goal (1 subgoal):
 1. lproject visible (llist_of u) \<le> lproject visible (llist_of v)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lproject visible (llist_of u) \<le> lproject visible (llist_of u) $ lproject visible (llist_of w)

goal (1 subgoal):
 1. lproject visible (llist_of u) \<le> lproject visible (llist_of v)
[PROOF STEP]
have "\<dots> = lproject visible (llist_of (u @ w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lproject visible (llist_of u) $ lproject visible (llist_of w) = lproject visible (llist_of (u @ w))
[PROOF STEP]
using lappend_llist_of_llist_of
[PROOF STATE]
proof (prove)
using this:
llist_of ?xs $ llist_of ?ys = llist_of (?xs @ ?ys)

goal (1 subgoal):
 1. lproject visible (llist_of u) $ lproject visible (llist_of w) = lproject visible (llist_of (u @ w))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lproject visible (llist_of u) $ lproject visible (llist_of w) = lproject visible (llist_of (u @ w))

goal (1 subgoal):
 1. lproject visible (llist_of u) \<le> lproject visible (llist_of v)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lproject visible (llist_of u) $ lproject visible (llist_of w) = lproject visible (llist_of (u @ w))

goal (1 subgoal):
 1. lproject visible (llist_of u) \<le> lproject visible (llist_of v)
[PROOF STEP]
have "\<dots> = lproject visible (llist_of v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lproject visible (llist_of (u @ w)) = lproject visible (llist_of v)
[PROOF STEP]
using eq_fin_lproject_visible 1
[PROOF STATE]
proof (prove)
using this:
?u =\<^sub>F ?v \<Longrightarrow> lproject visible (llist_of ?u) = lproject visible (llist_of ?v)
u @ w =\<^sub>F v

goal (1 subgoal):
 1. lproject visible (llist_of (u @ w)) = lproject visible (llist_of v)
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
lproject visible (llist_of (u @ w)) = lproject visible (llist_of v)

goal (1 subgoal):
 1. lproject visible (llist_of u) \<le> lproject visible (llist_of v)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
lproject visible (llist_of u) \<le> lproject visible (llist_of v)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
lproject visible (llist_of u) \<le> lproject visible (llist_of v)

goal (1 subgoal):
 1. lproject visible (llist_of u) \<le> lproject visible (llist_of v)
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
lproject visible (llist_of u) \<le> lproject visible (llist_of v)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma carr_prodag_mem_eq:"\<lbrakk>\<forall>k\<in>I. aGroup (A k); X \<in> carr_prodag I A;
Y \<in> carr_prodag I A; \<forall>l\<in>I. (X l) = (Y l) \<rbrakk> \<Longrightarrow> X = Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>k\<in>I. aGroup (A k); X \<in> carr_prodag I A; Y \<in> carr_prodag I A; \<forall>l\<in>I. X l = Y l\<rbrakk> \<Longrightarrow> X = Y
[PROOF STEP]
apply (simp add:carr_prodag_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>k\<in>I. aGroup (A k); X \<in> extensional I \<and> X \<in> I \<rightarrow> Un_carrier I A \<and> (\<forall>i\<in>I. Y i \<in> carrier (A i)); Y \<in> extensional I \<and> Y \<in> I \<rightarrow> Un_carrier I A; \<forall>l\<in>I. X l = Y l\<rbrakk> \<Longrightarrow> X = Y
[PROOF STEP]
apply (erule conjE)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>k\<in>I. aGroup (A k); \<forall>l\<in>I. X l = Y l; X \<in> extensional I; Y \<in> extensional I; Y \<in> I \<rightarrow> Un_carrier I A; X \<in> I \<rightarrow> Un_carrier I A; \<forall>i\<in>I. Y i \<in> carrier (A i)\<rbrakk> \<Longrightarrow> X = Y
[PROOF STEP]
apply (simp add:funcset_eq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in domain) pdivides_iff_shell:
  assumes "subfield K R" and "p \<in> carrier (K[X])" "q \<in> carrier (K[X])"
  shows "p pdivides q \<longleftrightarrow> p divides\<^bsub>K[X]\<^esub> q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p pdivides q = p divides\<^bsub>K [X]\<^esub> q
[PROOF STEP]
using pdivides_iff assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>subfield ?K R; polynomial ?K ?p; polynomial ?K ?q\<rbrakk> \<Longrightarrow> ?p pdivides ?q = ?p divides\<^bsub>?K [X]\<^esub> ?q
subfield K R
p \<in> carrier (K [X])
q \<in> carrier (K [X])

goal (1 subgoal):
 1. p pdivides q = p divides\<^bsub>K [X]\<^esub> q
[PROOF STEP]
by (simp add: univ_poly_carrier)


[STATEMENT]
lemma poly_sgnx_values:
  assumes "p\<noteq>0"
  shows "sgnx (poly p) (at_left a) = 1 \<or> sgnx (poly p) (at_left a) = -1"
        "sgnx (poly p) (at_right a) = 1 \<or> sgnx (poly p) (at_right a) = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgnx (poly p) (at_left a) = 1 \<or> sgnx (poly p) (at_left a) = - 1 &&& sgnx (poly p) (at_right a) = 1 \<or> sgnx (poly p) (at_right a) = - 1
[PROOF STEP]
using poly_has_sgnx_values[OF \<open>p\<noteq>0\<close>] has_sgnx_imp_sgnx trivial_limit_at_left_real
    trivial_limit_at_right_real
[PROOF STATE]
proof (prove)
using this:
(poly p has_sgnx 1) (at_left ?a) \<or> (poly p has_sgnx - 1) (at_left ?a)
(poly p has_sgnx 1) (at_right ?a) \<or> (poly p has_sgnx - 1) (at_right ?a)
(poly p has_sgnx 1) at_top \<or> (poly p has_sgnx - 1) at_top
(poly p has_sgnx 1) at_bot \<or> (poly p has_sgnx - 1) at_bot
\<lbrakk>(?f has_sgnx ?c) ?F; ?F \<noteq> bot\<rbrakk> \<Longrightarrow> sgnx ?f ?F = ?c
at_left ?x \<noteq> bot
at_right ?x \<noteq> bot

goal (1 subgoal):
 1. sgnx (poly p) (at_left a) = 1 \<or> sgnx (poly p) (at_left a) = - 1 &&& sgnx (poly p) (at_right a) = 1 \<or> sgnx (poly p) (at_right a) = - 1
[PROOF STEP]
by blast+


[STATEMENT]
lemma (in euclidean_space) inner_same_Basis[simp]: "u \<in> Basis \<Longrightarrow> inner u u = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<in> Basis \<Longrightarrow> inner u u = 1
[PROOF STEP]
by (simp add: inner_Basis)


[STATEMENT]
lemma all_nodes_list_I: "P (list_graph_to_graph G) = Pl G \<Longrightarrow>
    (\<forall>n \<in> (nodes (list_graph_to_graph G)). P (list_graph_to_graph G) n) = (\<forall> n \<in>set (nodesL G). Pl G n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (list_graph_to_graph G) = Pl G \<Longrightarrow> (\<forall>n\<in>nodes (list_graph_to_graph G). P (list_graph_to_graph G) n) = (\<forall>n\<in>set (nodesL G). Pl G n)
[PROOF STEP]
unfolding list_graph_to_graph_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<lparr>nodes = set (nodesL G), edges = set (edgesL G)\<rparr> = Pl G \<Longrightarrow> (\<forall>n\<in>nodes \<lparr>nodes = set (nodesL G), edges = set (edgesL G)\<rparr>. P \<lparr>nodes = set (nodesL G), edges = set (edgesL G)\<rparr> n) = (\<forall>n\<in>set (nodesL G). Pl G n)
[PROOF STEP]
by simp


[STATEMENT]
lemma mult_one_time_pad':
  assumes coprime: "coprime x q"
  shows "map_spmf (\<lambda> b. x*b mod q) (sample_uniform_units q) = sample_uniform_units q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_spmf (\<lambda>b. x * b mod q) (sample_uniform_units q) = sample_uniform_units q
[PROOF STEP]
using inj_on_mult' surj_on_mult' one_time_pad' coprime
[PROOF STATE]
proof (prove)
using this:
coprime ?x ?q \<Longrightarrow> inj_on (\<lambda>b. ?x * b mod ?q) ({..<?q} - {0})
\<lbrakk>coprime ?x ?q; inj_on (\<lambda>b. ?x * b mod ?q) ({..<?q} - {0})\<rbrakk> \<Longrightarrow> (\<lambda>b. ?x * b mod ?q) ` ({..<?q} - {0}) = {..<?q} - {0}
\<lbrakk>inj_on ?f ({..<?q} - {0}); ?f ` ({..<?q} - {0}) = {..<?q} - {0}\<rbrakk> \<Longrightarrow> map_spmf ?f (sample_uniform_units ?q) = sample_uniform_units ?q
coprime x q

goal (1 subgoal):
 1. map_spmf (\<lambda>b. x * b mod q) (sample_uniform_units q) = sample_uniform_units q
[PROOF STEP]
by simp


[STATEMENT]
lemma zero_left: "prod 0 b = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) ** b = (0::'c)
[PROOF STEP]
by (rule additive.zero [OF additive_left])


[STATEMENT]
lemma of_nat_ceiling: "of_nat (nat \<lceil>r\<rceil>) \<ge> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<le> of_nat (nat \<lceil>r\<rceil>)
[PROOF STEP]
by (cases "r\<ge>0") auto


[STATEMENT]
lemma "(\<exists>x. P(x)\<longrightarrow>Q)  \<longrightarrow>  (\<forall>x. P(x)) \<longrightarrow> Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. P x \<longrightarrow> Q) \<longrightarrow> (\<forall>x. P x) \<longrightarrow> Q
[PROOF STEP]
by iprover


[STATEMENT]
lemma strict_subtuple_trans'':
  "acyclicP_on (fmran' zm) R \<Longrightarrow>
   strict_subtuple R xm ym \<Longrightarrow>
   strict_subtuple R\<^sup>*\<^sup>* ym zm \<Longrightarrow>
   strict_subtuple R\<^sup>*\<^sup>* xm zm"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>acyclicP_on (fmran' zm) R; strict_subtuple R xm ym; strict_subtuple R\<^sup>*\<^sup>* ym zm\<rbrakk> \<Longrightarrow> strict_subtuple R\<^sup>*\<^sup>* xm zm
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>acyclicP_on (fmran' zm) R; subtuple R xm ym; xm \<noteq> ym; subtuple R\<^sup>*\<^sup>* ym zm; ym \<noteq> zm\<rbrakk> \<Longrightarrow> subtuple R\<^sup>*\<^sup>* xm zm
 2. \<lbrakk>acyclicP_on (fmran' zm) R; subtuple R zm ym; subtuple R\<^sup>*\<^sup>* ym zm; ym \<noteq> zm; xm = zm\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (rule fmrel_on_fset_trans, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>acyclicP_on (fmran' zm) R; subtuple R zm ym; subtuple R\<^sup>*\<^sup>* ym zm; ym \<noteq> zm; xm = zm\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (drule_tac ?xm="ym" in subtuple_acyclic''; auto)


[STATEMENT]
lemma induced_modulusI [intro?]:
  "d dvd n \<Longrightarrow> (\<And>a. coprime a n \<Longrightarrow> [a = 1] (mod d) \<Longrightarrow> \<chi> a = 1) \<Longrightarrow> induced_modulus d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>d dvd n; \<And>a. \<lbrakk>coprime a n; [a = 1] (mod d)\<rbrakk> \<Longrightarrow> \<chi> a = 1\<rbrakk> \<Longrightarrow> induced_modulus d
[PROOF STEP]
unfolding induced_modulus_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>d dvd n; \<And>a. \<lbrakk>coprime a n; [a = 1] (mod d)\<rbrakk> \<Longrightarrow> \<chi> a = 1\<rbrakk> \<Longrightarrow> d dvd n \<and> (\<forall>a. coprime a n \<and> [a = 1] (mod d) \<longrightarrow> \<chi> a = 1)
[PROOF STEP]
by auto


[STATEMENT]
lemma "2.3 *\<^sub>Q (centi *\<^sub>Q metre)\<^sup>\<three> = 2.3 \<cdot> 1/10^6 *\<^sub>Q metre\<^sup>\<three>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (23::'a) / (10::'a) *\<^sub>Q (centi *\<^sub>Q metre)\<^sup>\<three> = (23::'a) / (10::'a) \<cdot> (1::'a) / (10::'a) ^ 6 *\<^sub>Q metre\<^sup>\<three>
[PROOF STEP]
by (si_simp)


[STATEMENT]
lemma "(\<forall>x y. R(x,y) \<or> R(y,x)) \<and>
       (\<forall>x y. S(x,y) \<and> S(y,x) \<longrightarrow> x=y) \<and>
       (\<forall>x y. R(x,y) \<longrightarrow> S(x,y))    \<longrightarrow>   (\<forall>x y. S(x,y) \<longrightarrow> R(x,y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x y. R (x, y) \<or> R (y, x)) \<and> (\<forall>x y. S (x, y) \<and> S (y, x) \<longrightarrow> x = y) \<and> (\<forall>x y. R (x, y) \<longrightarrow> S (x, y)) \<longrightarrow> (\<forall>x y. S (x, y) \<longrightarrow> R (x, y))
[PROOF STEP]
by blast


[STATEMENT]
lemma Riemann_localization:
  assumes f: "f absolutely_integrable_on {-pi..pi}" and g: "g absolutely_integrable_on {-pi..pi}"
    and perf: "\<And>x. f(x + 2*pi) = f x"
    and perg: "\<And>x. g(x + 2*pi) = g x"
    and "d > 0" and d: "\<And>x. \<bar>x-t\<bar> < d \<Longrightarrow> f x = g x"
  shows "(\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> c
     \<longleftrightarrow> (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient g k * trigonometric_set k t) \<longlonglongrightarrow> c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> c = (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient g k * trigonometric_set k t) \<longlonglongrightarrow> c
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> c = (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient g k * trigonometric_set k t) \<longlonglongrightarrow> c
[PROOF STEP]
have "(\<lambda>n. LINT x|lebesgue_on {-pi..pi}. Dirichlet_kernel n x * f(x + t)) \<longlonglongrightarrow> pi * c
    \<longleftrightarrow> (\<lambda>n. LINT x|lebesgue_on {-pi..pi}. Dirichlet_kernel n x * g (x + t)) \<longlonglongrightarrow> pi * c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) \<longlonglongrightarrow> pi * c = (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * g (x + t)) \<longlonglongrightarrow> pi * c
[PROOF STEP]
proof (intro Lim_transform_eq Riemann_localization_integral)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. (\<lambda>x. f (x + t)) absolutely_integrable_on {- pi..pi}
 2. (\<lambda>x. g (x + t)) absolutely_integrable_on {- pi..pi}
 3. 0 < ?d1
 4. \<And>x. \<bar>x\<bar> < ?d1 \<Longrightarrow> f (x + t) = g (x + t)
[PROOF STEP]
show "(\<lambda>x. f(x + t)) absolutely_integrable_on {-pi..pi}" "(\<lambda>x. g (x + t)) absolutely_integrable_on {-pi..pi}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f (x + t)) absolutely_integrable_on {- pi..pi} &&& (\<lambda>x. g (x + t)) absolutely_integrable_on {- pi..pi}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f absolutely_integrable_on {- pi..pi}
g absolutely_integrable_on {- pi..pi}
f (?x + 2 * pi) = f ?x
g (?x + 2 * pi) = g ?x
0 < d
\<bar>?x - t\<bar> < d \<Longrightarrow> f ?x = g ?x

goal (1 subgoal):
 1. (\<lambda>x. f (x + t)) absolutely_integrable_on {- pi..pi} &&& (\<lambda>x. g (x + t)) absolutely_integrable_on {- pi..pi}
[PROOF STEP]
by (auto intro: absolutely_integrable_periodic_offset)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. f (x + t)) absolutely_integrable_on {- pi..pi}
(\<lambda>x. g (x + t)) absolutely_integrable_on {- pi..pi}

goal (2 subgoals):
 1. 0 < ?d1
 2. \<And>x. \<bar>x\<bar> < ?d1 \<Longrightarrow> f (x + t) = g (x + t)
[PROOF STEP]
qed (use assms in auto)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) \<longlonglongrightarrow> pi * c = (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * g (x + t)) \<longlonglongrightarrow> pi * c

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> c = (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient g k * trigonometric_set k t) \<longlonglongrightarrow> c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) \<longlonglongrightarrow> pi * c = (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * g (x + t)) \<longlonglongrightarrow> pi * c
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * f (x + t)) \<longlonglongrightarrow> pi * c = (\<lambda>n. LINT x|lebesgue_on {- pi..pi}. Dirichlet_kernel n x * g (x + t)) \<longlonglongrightarrow> pi * c

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> c = (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient g k * trigonometric_set k t) \<longlonglongrightarrow> c
[PROOF STEP]
by (simp add: Fourier_sum_limit_Dirichlet_kernel assms)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient f k * trigonometric_set k t) \<longlonglongrightarrow> c = (\<lambda>n. \<Sum>k\<le>n. Fourier_coefficient g k * trigonometric_set k t) \<longlonglongrightarrow> c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inf_par_distrib2: "d \<parallel> (c\<^sub>0 \<sqinter> c\<^sub>1) = (d \<parallel> c\<^sub>0) \<sqinter> (d \<parallel> c\<^sub>1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d \<parallel> (c\<^sub>0 \<sqinter> c\<^sub>1) = d \<parallel> c\<^sub>0 \<sqinter> d \<parallel> c\<^sub>1
variables:
c\<^sub>0, c\<^sub>1, d :: 'a
(\<parallel>) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
using inf_par_distrib par_commute
[PROOF STATE]
proof (prove)
using this:
((?c\<^sub>0::'a::refinement_lattice) \<sqinter> (?c\<^sub>1::'a::refinement_lattice)) \<parallel> (?d::'a::refinement_lattice) = ?c\<^sub>0 \<parallel> ?d \<sqinter> ?c\<^sub>1 \<parallel> ?d
(?a::'a::refinement_lattice) \<parallel> (?b::'a::refinement_lattice) = ?b \<parallel> ?a

goal (1 subgoal):
 1. d \<parallel> (c\<^sub>0 \<sqinter> c\<^sub>1) = d \<parallel> c\<^sub>0 \<sqinter> d \<parallel> c\<^sub>1
variables:
c\<^sub>0, c\<^sub>1, d :: 'a
(\<parallel>) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
by auto


[STATEMENT]
lemma nat_of_ord_succ [simp]: "Ord x \<Longrightarrow> nat_of_ord (succ x) = Suc (nat_of_ord x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ord x \<Longrightarrow> nat_of_ord (succ x) = Suc (nat_of_ord x)
[PROOF STEP]
by (metis nat_of_ord_ord_of ord_of.simps(2) ord_of_nat_of_ord)


[STATEMENT]
lemma zero_lt_\<omega>[simp]: "0 < \<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < \<omega>
[PROOF STEP]
by (metis of_nat_lt_\<omega> of_nat_0)


[STATEMENT]
lemma mod_0_imp_mod_factor_0_left: "
  n mod (m * m') = (0::nat) \<Longrightarrow> n mod m = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n mod (m * m') = 0 \<Longrightarrow> n mod m = 0
[PROOF STEP]
by fastforce


[STATEMENT]
lemma while_unfold_sum:
  "(x \<squnion> y) \<star> z = (x \<star> z) \<squnion> (x \<star> (y * ((x \<squnion> y) \<star> z)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<squnion> y \<star> z = (x \<star> z) \<squnion> (x \<star> y * (x \<squnion> y \<star> z))
[PROOF STEP]
apply (rule order.antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x \<squnion> y \<star> z \<le> (x \<star> z) \<squnion> (x \<star> y * (x \<squnion> y \<star> z))
 2. (x \<star> z) \<squnion> (x \<star> y * (x \<squnion> y \<star> z)) \<le> x \<squnion> y \<star> z
[PROOF STEP]
apply (metis semiring.add_left_mono while_sub_associative while_sumstar while_left_unfold)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<star> z) \<squnion> (x \<star> y * (x \<squnion> y \<star> z)) \<le> x \<squnion> y \<star> z
[PROOF STEP]
by (metis le_supI while_decompose_7 while_mult_increasing while_right_isotone while_sub_dist)


[STATEMENT]
lemma "12 ^ 7 = (35831808::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 12 ^ 7 = 35831808
[PROOF STEP]
by simp


[STATEMENT]
lemma step_n_pop_size_big [simp]: "\<lbrakk>
  invar (States dir big small);
  0 < size big; Big.pop big = (x, bigP);
  (step ^^ n) (States dir bigP small) = States dir' big' small'
\<rbrakk> \<Longrightarrow> Suc (size big') = size big"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>invar (States dir big small); 0 < size big; Big.pop big = (x, bigP); (step ^^ n) (States dir bigP small) = States dir' big' small'\<rbrakk> \<Longrightarrow> Suc (size big') = size big
[PROOF STEP]
using invar_pop_big Big_Proof.size_pop step_n_size_big
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>invar (States ?dir ?big ?small); 0 < size ?big; Big.pop ?big = (?x, ?big')\<rbrakk> \<Longrightarrow> invar (States ?dir ?big' ?small)
\<lbrakk>invar ?big; 0 < size ?big; Big.pop ?big = (?x, ?big')\<rbrakk> \<Longrightarrow> Suc (size ?big') = size ?big
\<lbrakk>invar (States ?dir ?big ?small); (step ^^ ?n) (States ?dir ?big ?small) = States ?dir' ?big' ?small'\<rbrakk> \<Longrightarrow> size ?big' = size ?big

goal (1 subgoal):
 1. \<lbrakk>invar (States dir big small); 0 < size big; Big.pop big = (x, bigP); (step ^^ n) (States dir bigP small) = States dir' big' small'\<rbrakk> \<Longrightarrow> Suc (size big') = size big
[PROOF STEP]
by fastforce


[STATEMENT]
lemma cong_cong_prod_coprime:
  "[x = y] (mod (\<Prod>i\<in>A. m i))" if
    "(\<forall>i\<in>A. [x = y] (mod m i))"
    "(\<forall>i\<in>A. (\<forall>j\<in>A. i \<noteq> j \<longrightarrow> coprime (m i) (m j)))"
  for x y :: "'a :: {unique_euclidean_ring, semiring_gcd}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [x = y] (mod prod m A)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>A. [x = y] (mod m i)
\<forall>i\<in>A. \<forall>j\<in>A. i \<noteq> j \<longrightarrow> coprime (m i) (m j)

goal (1 subgoal):
 1. [x = y] (mod prod m A)
[PROOF STEP]
by (induct A rule: infinite_finite_induct)
    (auto intro!: coprime_cong_mult prod_coprime_right)


[STATEMENT]
lemma of_nat_times_\<omega>_exp: "of_nat n * \<omega>^m = HMSet (replicate_mset n m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat n * \<omega>^ m = HMSet (replicate_mset n m)
[PROOF STEP]
by (induct n) (simp_all add: hmsetmset_plus one_hmultiset_def)


[STATEMENT]
lemma lm052:
  "{(fst pair, {y})| y pair. y \<in> snd pair & pair \<in> a} =
   {(x, {y})| x y. y \<in> \<Union> (a``{x}) & x \<in> Domain a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(fst pair, {y}) |y pair. y \<in> snd pair \<and> pair \<in> a} = {(x, {y}) |x y. y \<in> a ,,, x \<and> x \<in> Domain a}
[PROOF STEP]
by auto


[STATEMENT]
lemma add_node_set_edges: "set (edgesL (add_node v G)) = set (edgesL G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (edgesL (FiniteListGraph.add_node v G)) = set (edgesL G)
[PROOF STEP]
unfolding add_node_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (edgesL \<lparr>nodesL = if v \<in> set (nodesL G) then nodesL G else v # nodesL G, edgesL = edgesL G\<rparr>) = set (edgesL G)
[PROOF STEP]
by auto


[STATEMENT]
theorem turan :
  fixes p n :: nat
  assumes "finite (uverts G)"
    and "uwellformed G" and "\<forall>C p'. uclique C G p' \<longrightarrow> p' < p" and "p \<ge> 2" and "card(uverts G) = n"
  shows "card (uedges G) \<le> (1 - 1 / (p-1)) * n^2 / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite (uverts G)
uwellformed G
\<forall>C p'. uclique C G p' \<longrightarrow> p' < p
2 \<le> p
card (uverts G) = n

goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
proof (induction n arbitrary: G rule: less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x G. \<lbrakk>\<And>y G. \<lbrakk>y < x; finite (uverts G); uwellformed G; \<forall>C p'. uclique C G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts G) = y\<rbrakk> \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (y\<^sup>2) / 2; finite (uverts G); uwellformed G; \<forall>C p'. uclique C G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts G) = x\<rbrakk> \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (x\<^sup>2) / 2
[PROOF STEP]
case (less n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?y < n; finite (uverts ?G); uwellformed ?G; \<forall>C p'. uclique C ?G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts ?G) = ?y\<rbrakk> \<Longrightarrow> real (card (uedges ?G)) \<le> (1 - 1 / real (p - 1)) * real (?y\<^sup>2) / 2
finite (uverts G)
uwellformed G
\<forall>C p'. uclique C G p' \<longrightarrow> p' < p
2 \<le> p
card (uverts G) = n

goal (1 subgoal):
 1. \<And>x G. \<lbrakk>\<And>y G. \<lbrakk>y < x; finite (uverts G); uwellformed G; \<forall>C p'. uclique C G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts G) = y\<rbrakk> \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (y\<^sup>2) / 2; finite (uverts G); uwellformed G; \<forall>C p'. uclique C G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts G) = x\<rbrakk> \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (x\<^sup>2) / 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?y < n; finite (uverts ?G); uwellformed ?G; \<forall>C p'. uclique C ?G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts ?G) = ?y\<rbrakk> \<Longrightarrow> real (card (uedges ?G)) \<le> (1 - 1 / real (p - 1)) * real (?y\<^sup>2) / 2
finite (uverts G)
uwellformed G
\<forall>C p'. uclique C G p' \<longrightarrow> p' < p
2 \<le> p
card (uverts G) = n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?y < n; finite (uverts ?G); uwellformed ?G; \<forall>C p'. uclique C ?G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts ?G) = ?y\<rbrakk> \<Longrightarrow> real (card (uedges ?G)) \<le> (1 - 1 / real (p - 1)) * real (?y\<^sup>2) / 2
finite (uverts G)
uwellformed G
\<forall>C p'. uclique C G p' \<longrightarrow> p' < p
2 \<le> p
card (uverts G) = n

goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
proof (cases "n < p")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<And>y G. \<lbrakk>y < n; finite (uverts G); uwellformed G; \<forall>C p'. uclique C G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts G) = y\<rbrakk> \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (y\<^sup>2) / 2; finite (uverts G); uwellformed G; \<forall>C p'. uclique C G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts G) = n; n < p\<rbrakk> \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
 2. \<lbrakk>\<And>y G. \<lbrakk>y < n; finite (uverts G); uwellformed G; \<forall>C p'. uclique C G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts G) = y\<rbrakk> \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (y\<^sup>2) / 2; finite (uverts G); uwellformed G; \<forall>C p'. uclique C G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts G) = n; \<not> n < p\<rbrakk> \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n < p

goal (2 subgoals):
 1. \<lbrakk>\<And>y G. \<lbrakk>y < n; finite (uverts G); uwellformed G; \<forall>C p'. uclique C G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts G) = y\<rbrakk> \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (y\<^sup>2) / 2; finite (uverts G); uwellformed G; \<forall>C p'. uclique C G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts G) = n; n < p\<rbrakk> \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
 2. \<lbrakk>\<And>y G. \<lbrakk>y < n; finite (uverts G); uwellformed G; \<forall>C p'. uclique C G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts G) = y\<rbrakk> \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (y\<^sup>2) / 2; finite (uverts G); uwellformed G; \<forall>C p'. uclique C G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts G) = n; \<not> n < p\<rbrakk> \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
proof (cases "n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
 2. \<And>nat. n = Suc nat \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
n = 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
 2. \<And>nat. n = Suc nat \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
with less True
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?y < n; finite (uverts ?G); uwellformed ?G; \<forall>C p'. uclique C ?G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts ?G) = ?y\<rbrakk> \<Longrightarrow> real (card (uedges ?G)) \<le> (1 - 1 / real (p - 1)) * real (?y\<^sup>2) / 2
finite (uverts G)
uwellformed G
\<forall>C p'. uclique C G p' \<longrightarrow> p' < p
2 \<le> p
card (uverts G) = n
n < p
n = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?y < n; finite (uverts ?G); uwellformed ?G; \<forall>C p'. uclique C ?G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts ?G) = ?y\<rbrakk> \<Longrightarrow> real (card (uedges ?G)) \<le> (1 - 1 / real (p - 1)) * real (?y\<^sup>2) / 2
finite (uverts G)
uwellformed G
\<forall>C p'. uclique C G p' \<longrightarrow> p' < p
2 \<le> p
card (uverts G) = n
n < p
n = 0

goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
by (auto simp add: wellformed_uverts_0)
[PROOF STATE]
proof (state)
this:
real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
case (Suc n')
[PROOF STATE]
proof (state)
this:
n = Suc n'

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
with True
[PROOF STATE]
proof (chain)
picking this:
n < p
n = Suc n'
[PROOF STEP]
have "(1 - 1 / real n) \<le> (1 - 1 / real (p - 1))"
[PROOF STATE]
proof (prove)
using this:
n < p
n = Suc n'

goal (1 subgoal):
 1. 1 - 1 / real n \<le> 1 - 1 / real (p - 1)
[PROOF STEP]
by (metis diff_Suc_1 diff_left_mono inverse_of_nat_le less_Suc_eq_le linorder_not_less list_decode.cases not_add_less1 plus_1_eq_Suc)
[PROOF STATE]
proof (state)
this:
1 - 1 / real n \<le> 1 - 1 / real (p - 1)

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
1 - 1 / real n \<le> 1 - 1 / real (p - 1)

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
have "real (card (uedges G)) \<le> (1 - 1 / real n) * real (n\<^sup>2) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real n) * real (n\<^sup>2) / 2
[PROOF STEP]
using ugraph_max_edges [OF less(3,6,2)]
[PROOF STATE]
proof (prove)
using this:
real (card (uedges G)) \<le> real n * (real n - 1) / 2

goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real n) * real (n\<^sup>2) / 2
[PROOF STEP]
by (smt (verit, ccfv_SIG) left_diff_distrib mult.right_neutral mult_of_nat_commute nonzero_mult_div_cancel_left of_nat_1 of_nat_mult power2_eq_square times_divide_eq_left)
[PROOF STATE]
proof (state)
this:
real (card (uedges G)) \<le> (1 - 1 / real n) * real (n\<^sup>2) / 2

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
1 - 1 / real n \<le> 1 - 1 / real (p - 1)
real (card (uedges G)) \<le> (1 - 1 / real n) * real (n\<^sup>2) / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 - 1 / real n \<le> 1 - 1 / real (p - 1)
real (card (uedges G)) \<le> (1 - 1 / real n) * real (n\<^sup>2) / 2

goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
using Rings.ordered_semiring_class.mult_right_mono divide_less_eq_numeral1(1) le_less_trans linorder_not_less of_nat_0_le_iff
[PROOF STATE]
proof (prove)
using this:
1 - 1 / real n \<le> 1 - 1 / real (p - 1)
real (card (uedges G)) \<le> (1 - 1 / real n) * real (n\<^sup>2) / 2
\<lbrakk>?a \<le> ?b; (0::?'a) \<le> ?c\<rbrakk> \<Longrightarrow> ?a * ?c \<le> ?b * ?c
(?b / numeral ?w < ?a) = (?b < ?a * numeral ?w)
\<lbrakk>?x \<le> ?y; ?y < ?z\<rbrakk> \<Longrightarrow> ?x < ?z
(\<not> ?x < ?y) = (?y \<le> ?x)
(0::?'a) \<le> of_nat ?n

goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
by (smt (verit, ccfv_threshold) divide_nonneg_nonneg times_divide_eq_right)
[PROOF STATE]
proof (state)
this:
real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2

goal (1 subgoal):
 1. \<lbrakk>\<And>y G. \<lbrakk>y < n; finite (uverts G); uwellformed G; \<forall>C p'. uclique C G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts G) = y\<rbrakk> \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (y\<^sup>2) / 2; finite (uverts G); uwellformed G; \<forall>C p'. uclique C G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts G) = n; \<not> n < p\<rbrakk> \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>y G. \<lbrakk>y < n; finite (uverts G); uwellformed G; \<forall>C p'. uclique C G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts G) = y\<rbrakk> \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (y\<^sup>2) / 2; finite (uverts G); uwellformed G; \<forall>C p'. uclique C G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts G) = n; \<not> n < p\<rbrakk> \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> n < p

goal (1 subgoal):
 1. \<lbrakk>\<And>y G. \<lbrakk>y < n; finite (uverts G); uwellformed G; \<forall>C p'. uclique C G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts G) = y\<rbrakk> \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (y\<^sup>2) / 2; finite (uverts G); uwellformed G; \<forall>C p'. uclique C G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts G) = n; \<not> n < p\<rbrakk> \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
obtain C q where C: "uclique C G q"
        and C_max: "(\<forall>C q'. uclique C G q' \<longrightarrow> q' \<le> q)"
        and q: "q < card (uverts G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>C q. \<lbrakk>uclique C G q; \<forall>C q'. uclique C G q' \<longrightarrow> q' \<le> q; q < card (uverts G)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using clique_exists_gt0 [OF \<open>finite (uverts G)\<close>] False \<open>p \<ge> 2\<close> less.prems(1,3,5)
[PROOF STATE]
proof (prove)
using this:
0 < card (uverts G) \<Longrightarrow> \<exists>C p. uclique C G p \<and> p \<le> card (uverts G) \<and> (\<forall>C q. uclique C G q \<longrightarrow> q \<le> p)
\<not> n < p
2 \<le> p
finite (uverts G)
\<forall>C p'. uclique C G p' \<longrightarrow> p' < p
card (uverts G) = n

goal (1 subgoal):
 1. (\<And>C q. \<lbrakk>uclique C G q; \<forall>C q'. uclique C G q' \<longrightarrow> q' \<le> q; q < card (uverts G)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis card.empty card_gt_0_iff le_eq_less_or_eq order_less_le_trans pos2)
[PROOF STATE]
proof (state)
this:
uclique C G q
\<forall>C q'. uclique C G q' \<longrightarrow> q' \<le> q
q < card (uverts G)

goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
obtain E C' where E: "uwellformed (uverts G, uedges G \<union> E)"
        and C': "(uclique C' (uverts G, uedges G \<union> E) (p-1))"
        and C'_max: "(\<forall>C q'. uclique C (uverts G, uedges G \<union> E) q' \<longrightarrow> q' \<le> p-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>E C'. \<lbrakk>uwellformed (uverts G, uedges G \<union> E); uclique C' (uverts G, uedges G \<union> E) (p - 1); \<forall>C q'. uclique C (uverts G, uedges G \<union> E) q' \<longrightarrow> q' \<le> p - 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using clique_add_edges_max [OF \<open>finite (uverts G)\<close> \<open>uwellformed G\<close> q _ C_max, of "p-1"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<exists>C. uclique C G q; p - 1 \<le> card (uverts G); q \<le> p - 1\<rbrakk> \<Longrightarrow> \<exists>E. uwellformed (uverts G, uedges G \<union> E) \<and> (\<exists>C. uclique C (uverts G, uedges G \<union> E) (p - 1)) \<and> (\<forall>C q'. uclique C (uverts G, uedges G \<union> E) q' \<longrightarrow> q' \<le> p - 1)

goal (1 subgoal):
 1. (\<And>E C'. \<lbrakk>uwellformed (uverts G, uedges G \<union> E); uclique C' (uverts G, uedges G \<union> E) (p - 1); \<forall>C q'. uclique C (uverts G, uedges G \<union> E) q' \<longrightarrow> q' \<le> p - 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using C less(4) less(5) False \<open>card (uverts G) = n\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<exists>C. uclique C G q; p - 1 \<le> card (uverts G); q \<le> p - 1\<rbrakk> \<Longrightarrow> \<exists>E. uwellformed (uverts G, uedges G \<union> E) \<and> (\<exists>C. uclique C (uverts G, uedges G \<union> E) (p - 1)) \<and> (\<forall>C q'. uclique C (uverts G, uedges G \<union> E) q' \<longrightarrow> q' \<le> p - 1)
uclique C G q
\<forall>C p'. uclique C G p' \<longrightarrow> p' < p
2 \<le> p
\<not> n < p
card (uverts G) = n

goal (1 subgoal):
 1. (\<And>E C'. \<lbrakk>uwellformed (uverts G, uedges G \<union> E); uclique C' (uverts G, uedges G \<union> E) (p - 1); \<forall>C q'. uclique C (uverts G, uedges G \<union> E) q' \<longrightarrow> q' \<le> p - 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (smt (verit) One_nat_def Suc_leD Suc_pred less_Suc_eq_le linorder_not_less order_less_le_trans pos2)
[PROOF STATE]
proof (state)
this:
uwellformed (uverts G, uedges G \<union> E)
uclique C' (uverts G, uedges G \<union> E) (p - 1)
\<forall>C q'. uclique C (uverts G, uedges G \<union> E) q' \<longrightarrow> q' \<le> p - 1

goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
have "card {e \<in> uedges G \<union> E. e \<subseteq> uverts C'} = (p-1) * (p-2) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card {e \<in> uedges G \<union> E. e \<subseteq> uverts C'}) = real ((p - 1) * (p - 2)) / 2
[PROOF STEP]
using clique_edges_inside [OF E _ _ _ C'] False less(2) less.prems(4) C'
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (uverts (uverts G, uedges G \<union> E)); p - 1 \<le> card (uverts (uverts G, uedges G \<union> E)); ?n = card (uverts (uverts G, uedges G \<union> E))\<rbrakk> \<Longrightarrow> real (card {e \<in> uedges (uverts G, uedges G \<union> E). e \<subseteq> uverts C'}) = real (p - 1) * (real (p - 1) - 1) / 2
\<not> n < p
finite (uverts G)
2 \<le> p
uclique C' (uverts G, uedges G \<union> E) (p - 1)

goal (1 subgoal):
 1. real (card {e \<in> uedges G \<union> E. e \<subseteq> uverts C'}) = real ((p - 1) * (p - 2)) / 2
[PROOF STEP]
by (smt (verit, del_insts) Collect_cong Suc_1 add_leD1 clique_max_size fst_conv of_nat_1 of_nat_add of_nat_diff of_nat_mult plus_1_eq_Suc snd_conv)
[PROOF STATE]
proof (state)
this:
real (card {e \<in> uedges G \<union> E. e \<subseteq> uverts C'}) = real ((p - 1) * (p - 2)) / 2

goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
real (card {e \<in> uedges G \<union> E. e \<subseteq> uverts C'}) = real ((p - 1) * (p - 2)) / 2

goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
have "card {e \<in> uedges G \<union> E. e \<subseteq> uverts G - uverts C'} \<le> (1 - 1 / (p-1)) * (n - p + 1) ^ 2 / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card {e \<in> uedges G \<union> E. e \<subseteq> uverts G - uverts C'}) \<le> (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (card {e \<in> uedges G \<union> E. e \<subseteq> uverts G - uverts C'}) \<le> (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2
[PROOF STEP]
have "real(card{e \<in> uedges (uverts G, uedges G \<union> E). e \<subseteq> uverts (uverts G, uedges G \<union> E) - uverts C'})
              \<le> (1 - 1 / (real p - 1)) * (real n - real p + 1)\<^sup>2 / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card {e \<in> uedges (uverts G, uedges G \<union> E). e \<subseteq> uverts (uverts G, uedges G \<union> E) - uverts C'}) \<le> (1 - 1 / (real p - 1)) * (real n - real p + 1)\<^sup>2 / 2
[PROOF STEP]
using clique_edges_outside [OF E _ less(5) _ _ C' C'_max, of n] linorder_class.leI [OF False] less(1,2,6)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (uverts (uverts G, uedges G \<union> E)); p \<le> card (uverts (uverts G, uedges G \<union> E)); n = card (uverts (uverts G, uedges G \<union> E)); \<And>G y. \<lbrakk>y < n; finite (uverts G); uwellformed G; \<forall>C p'. uclique C G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts G) = y\<rbrakk> \<Longrightarrow> real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (y\<^sup>2) / 2\<rbrakk> \<Longrightarrow> real (card {e \<in> uedges (uverts G, uedges G \<union> E). e \<subseteq> uverts (uverts G, uedges G \<union> E) - uverts C'}) \<le> (1 - 1 / (real p - 1)) * (real n - real p + 1)\<^sup>2 / 2
p \<le> n
\<lbrakk>?y < n; finite (uverts ?G); uwellformed ?G; \<forall>C p'. uclique C ?G p' \<longrightarrow> p' < p; 2 \<le> p; card (uverts ?G) = ?y\<rbrakk> \<Longrightarrow> real (card (uedges ?G)) \<le> (1 - 1 / real (p - 1)) * real (?y\<^sup>2) / 2
finite (uverts G)
card (uverts G) = n

goal (1 subgoal):
 1. real (card {e \<in> uedges (uverts G, uedges G \<union> E). e \<subseteq> uverts (uverts G, uedges G \<union> E) - uverts C'}) \<le> (1 - 1 / (real p - 1)) * (real n - real p + 1)\<^sup>2 / 2
[PROOF STEP]
by (metis (no_types, lifting) fst_conv)
[PROOF STATE]
proof (state)
this:
real (card {e \<in> uedges (uverts G, uedges G \<union> E). e \<subseteq> uverts (uverts G, uedges G \<union> E) - uverts C'}) \<le> (1 - 1 / (real p - 1)) * (real n - real p + 1)\<^sup>2 / 2

goal (1 subgoal):
 1. real (card {e \<in> uedges G \<union> E. e \<subseteq> uverts G - uverts C'}) \<le> (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real (card {e \<in> uedges (uverts G, uedges G \<union> E). e \<subseteq> uverts (uverts G, uedges G \<union> E) - uverts C'}) \<le> (1 - 1 / (real p - 1)) * (real n - real p + 1)\<^sup>2 / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (card {e \<in> uedges (uverts G, uedges G \<union> E). e \<subseteq> uverts (uverts G, uedges G \<union> E) - uverts C'}) \<le> (1 - 1 / (real p - 1)) * (real n - real p + 1)\<^sup>2 / 2

goal (1 subgoal):
 1. real (card {e \<in> uedges G \<union> E. e \<subseteq> uverts G - uverts C'}) \<le> (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2
[PROOF STEP]
by (simp, smt (verit, best) False One_nat_def Suc_1 Suc_leD add.commute leI less.prems(4) of_nat_1 of_nat_diff)
[PROOF STATE]
proof (state)
this:
real (card {e \<in> uedges G \<union> E. e \<subseteq> uverts G - uverts C'}) \<le> (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
real (card {e \<in> uedges G \<union> E. e \<subseteq> uverts G - uverts C'}) \<le> (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2

goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
real (card {e \<in> uedges G \<union> E. e \<subseteq> uverts G - uverts C'}) \<le> (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2

goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
have "card {e \<in> uedges G \<union> E. e \<inter> uverts C' \<noteq> {} \<and> e \<inter> (uverts G - uverts C') \<noteq> {}} \<le> (p - 2) * (n - p + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {e \<in> uedges G \<union> E. e \<inter> uverts C' \<noteq> {} \<and> e \<inter> (uverts G - uverts C') \<noteq> {}} \<le> (p - 2) * (n - p + 1)
[PROOF STEP]
using clique_edges_inside_to_outside [OF E _ _ _ _ C' C'_max, of  n] less(2,5,6)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (uverts (uverts G, uedges G \<union> E)); 0 < p - 1; p - 1 \<le> card (uverts (uverts G, uedges G \<union> E)); card (uverts (uverts G, uedges G \<union> E)) = n\<rbrakk> \<Longrightarrow> card {e \<in> uedges (uverts G, uedges G \<union> E). e \<inter> uverts C' \<noteq> {} \<and> e \<inter> (uverts (uverts G, uedges G \<union> E) - uverts C') \<noteq> {}} \<le> (p - 1 - 1) * (n - (p - 1))
finite (uverts G)
2 \<le> p
card (uverts G) = n

goal (1 subgoal):
 1. card {e \<in> uedges G \<union> E. e \<inter> uverts C' \<noteq> {} \<and> e \<inter> (uverts G - uverts C') \<noteq> {}} \<le> (p - 2) * (n - p + 1)
[PROOF STEP]
by (simp, metis (no_types, lifting) C' False Nat.add_diff_assoc Nat.add_diff_assoc2 One_nat_def Suc_1 clique_max_size fst_conv leI mult_Suc_right plus_1_eq_Suc)
[PROOF STATE]
proof (state)
this:
card {e \<in> uedges G \<union> E. e \<inter> uverts C' \<noteq> {} \<and> e \<inter> (uverts G - uverts C') \<noteq> {}} \<le> (p - 2) * (n - p + 1)

goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
real (card {e \<in> uedges G \<union> E. e \<subseteq> uverts C'}) = real ((p - 1) * (p - 2)) / 2
real (card {e \<in> uedges G \<union> E. e \<subseteq> uverts G - uverts C'}) \<le> (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2
card {e \<in> uedges G \<union> E. e \<inter> uverts C' \<noteq> {} \<and> e \<inter> (uverts G - uverts C') \<noteq> {}} \<le> (p - 2) * (n - p + 1)
[PROOF STEP]
have "real (card (uedges G \<union> E)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2"
[PROOF STATE]
proof (prove)
using this:
real (card {e \<in> uedges G \<union> E. e \<subseteq> uverts C'}) = real ((p - 1) * (p - 2)) / 2
real (card {e \<in> uedges G \<union> E. e \<subseteq> uverts G - uverts C'}) \<le> (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2
card {e \<in> uedges G \<union> E. e \<inter> uverts C' \<noteq> {} \<and> e \<inter> (uverts G - uverts C') \<noteq> {}} \<le> (p - 2) * (n - p + 1)

goal (1 subgoal):
 1. real (card (uedges G \<union> E)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
using graph_partition_edges_card [OF _ E, of "uverts C'"]
[PROOF STATE]
proof (prove)
using this:
real (card {e \<in> uedges G \<union> E. e \<subseteq> uverts C'}) = real ((p - 1) * (p - 2)) / 2
real (card {e \<in> uedges G \<union> E. e \<subseteq> uverts G - uverts C'}) \<le> (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2
card {e \<in> uedges G \<union> E. e \<inter> uverts C' \<noteq> {} \<and> e \<inter> (uverts G - uverts C') \<noteq> {}} \<le> (p - 2) * (n - p + 1)
\<lbrakk>finite (uverts (uverts G, uedges G \<union> E)); uverts C' \<subseteq> uverts (uverts G, uedges G \<union> E)\<rbrakk> \<Longrightarrow> card (uedges (uverts G, uedges G \<union> E)) = card {e \<in> uedges (uverts G, uedges G \<union> E). e \<subseteq> uverts C'} + card {e \<in> uedges (uverts G, uedges G \<union> E). e \<subseteq> uverts (uverts G, uedges G \<union> E) - uverts C'} + card {e \<in> uedges (uverts G, uedges G \<union> E). e \<inter> uverts C' \<noteq> {} \<and> e \<inter> (uverts (uverts G, uedges G \<union> E) - uverts C') \<noteq> {}}

goal (1 subgoal):
 1. real (card (uedges G \<union> E)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
using less(2) turan_sum_eq [OF \<open>2 \<le> p\<close>, of n] False C' uclique_def subgraph_def
[PROOF STATE]
proof (prove)
using this:
real (card {e \<in> uedges G \<union> E. e \<subseteq> uverts C'}) = real ((p - 1) * (p - 2)) / 2
real (card {e \<in> uedges G \<union> E. e \<subseteq> uverts G - uverts C'}) \<le> (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2
card {e \<in> uedges G \<union> E. e \<inter> uverts C' \<noteq> {} \<and> e \<inter> (uverts G - uverts C') \<noteq> {}} \<le> (p - 2) * (n - p + 1)
\<lbrakk>finite (uverts (uverts G, uedges G \<union> E)); uverts C' \<subseteq> uverts (uverts G, uedges G \<union> E)\<rbrakk> \<Longrightarrow> card (uedges (uverts G, uedges G \<union> E)) = card {e \<in> uedges (uverts G, uedges G \<union> E). e \<subseteq> uverts C'} + card {e \<in> uedges (uverts G, uedges G \<union> E). e \<subseteq> uverts (uverts G, uedges G \<union> E) - uverts C'} + card {e \<in> uedges (uverts G, uedges G \<union> E). e \<inter> uverts C' \<noteq> {} \<and> e \<inter> (uverts (uverts G, uedges G \<union> E) - uverts C') \<noteq> {}}
finite (uverts G)
p \<le> n \<Longrightarrow> real ((p - 1) * (p - 2)) / 2 + (1 - 1 / real (p - 1)) * real ((n - p + 1)\<^sup>2) / 2 + real ((p - 2) * (n - p + 1)) = (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
\<not> n < p
uclique C' (uverts G, uedges G \<union> E) (p - 1)
uclique ?C ?G ?p \<equiv> ?p = card (uverts ?C) \<and> subgraph ?C ?G \<and> ?C = Ugraph_Lemmas.complete (uverts ?C)
subgraph ?G' ?G \<equiv> uverts ?G' \<subseteq> uverts ?G \<and> uedges ?G' \<subseteq> uedges ?G

goal (1 subgoal):
 1. real (card (uedges G \<union> E)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
by (smt (verit) Collect_cong fst_eqD linorder_not_le of_nat_add of_nat_mono snd_eqD)
[PROOF STATE]
proof (state)
this:
real (card (uedges G \<union> E)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2

goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real (card (uedges G \<union> E)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (card (uedges G \<union> E)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2

goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
using less(2) E finite_verts_edges Finite_Set.card_mono [OF _ Set.Un_upper1 [of "uedges G" E]]
[PROOF STATE]
proof (prove)
using this:
real (card (uedges G \<union> E)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
finite (uverts G)
uwellformed (uverts G, uedges G \<union> E)
\<lbrakk>uwellformed ?G; finite (uverts ?G)\<rbrakk> \<Longrightarrow> finite (uedges ?G)
finite (uedges G \<union> E) \<Longrightarrow> card (uedges G) \<le> card (uedges G \<union> E)

goal (1 subgoal):
 1. real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
real (card (uedges G)) \<le> (1 - 1 / real (p - 1)) * real (n\<^sup>2) / 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subcocycle_int_tendsto_avg:
  assumes "subcocycle u" "subcocycle_avg_ereal u > - \<infinity>"
  shows "(\<lambda>n. (\<integral>x. u n x / n \<partial>M)) \<longlonglongrightarrow> subcocycle_avg u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. LINT x|M. u n x / real n) \<longlonglongrightarrow> subcocycle_avg u
[PROOF STEP]
using subcocycle_avg_real_ereal[OF assms(2)] subcocycle_int_tendsto_avg_ereal[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
subcocycle_avg_ereal u = ereal (subcocycle_avg u)
(\<lambda>x. ereal (LINT xa|M. u x xa / real x)) \<longlonglongrightarrow> subcocycle_avg_ereal u

goal (1 subgoal):
 1. (\<lambda>n. LINT x|M. u n x / real n) \<longlonglongrightarrow> subcocycle_avg u
[PROOF STEP]
by auto


[STATEMENT]
lemma dist_nonneg_bounded:
  fixes l u x y :: real
  assumes "l \<le> x" "x \<le> u" "l \<le> y" "y \<le> u"
  shows "dist x y \<le> u - l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x y \<le> u - l
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
l \<le> x
x \<le> u
l \<le> y
y \<le> u

goal (1 subgoal):
 1. dist x y \<le> u - l
[PROOF STEP]
unfolding dist_real_def
[PROOF STATE]
proof (prove)
using this:
l \<le> x
x \<le> u
l \<le> y
y \<le> u

goal (1 subgoal):
 1. \<bar>x - y\<bar> \<le> u - l
[PROOF STEP]
by arith


[STATEMENT]
lemma augment_flow_presv_con:
  shows "(\<Sum>e \<in> outgoing u. augment f' e) = (\<Sum>e \<in> incoming u. augment f' e)"
    (is "?LHS = ?RHS")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
text \<open>We define shortcuts for the successor and predecessor nodes of @{term u}
    in the network:\<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
let ?Vo = "E``{u}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
let ?Vi = "E\<inverse>``{u}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
text \<open>Using the auxiliary lemma for the effective residual flow,
    the proof is straightforward:\<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
have "?LHS = (\<Sum>v\<in>?Vo. augment f' (u,v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (augment f') (outgoing u) = (\<Sum>v\<in>E `` {u}. augment f' (u, v))
[PROOF STEP]
by (auto simp: sum_outgoing_pointwise)
[PROOF STATE]
proof (state)
this:
sum (augment f') (outgoing u) = (\<Sum>v\<in>E `` {u}. augment f' (u, v))

goal (1 subgoal):
 1. sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum (augment f') (outgoing u) = (\<Sum>v\<in>E `` {u}. augment f' (u, v))

goal (1 subgoal):
 1. sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
have "\<dots>
    = (\<Sum>v\<in>?Vo. f (u,v) + f'(u,v) - f'(v,u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>E `` {u}. augment f' (u, v)) = (\<Sum>v\<in>E `` {u}. f (u, v) + f' (u, v) - f' (v, u))
[PROOF STEP]
by (auto simp: augment_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>E `` {u}. augment f' (u, v)) = (\<Sum>v\<in>E `` {u}. f (u, v) + f' (u, v) - f' (v, u))

goal (1 subgoal):
 1. sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>E `` {u}. augment f' (u, v)) = (\<Sum>v\<in>E `` {u}. f (u, v) + f' (u, v) - f' (v, u))

goal (1 subgoal):
 1. sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
have "\<dots>
    = (\<Sum>v\<in>?Vo. f (u,v)) + (\<Sum>v\<in>?Vo. f' (u,v)) - (\<Sum>v\<in>?Vo. f' (v,u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>E `` {u}. f (u, v) + f' (u, v) - f' (v, u)) = (\<Sum>v\<in>E `` {u}. f (u, v)) + (\<Sum>v\<in>E `` {u}. f' (u, v)) - (\<Sum>v\<in>E `` {u}. f' (v, u))
[PROOF STEP]
by (auto simp: sum_subtractf sum.distrib)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>E `` {u}. f (u, v) + f' (u, v) - f' (v, u)) = (\<Sum>v\<in>E `` {u}. f (u, v)) + (\<Sum>v\<in>E `` {u}. f' (u, v)) - (\<Sum>v\<in>E `` {u}. f' (v, u))

goal (1 subgoal):
 1. sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>E `` {u}. f (u, v) + f' (u, v) - f' (v, u)) = (\<Sum>v\<in>E `` {u}. f (u, v)) + (\<Sum>v\<in>E `` {u}. f' (u, v)) - (\<Sum>v\<in>E `` {u}. f' (v, u))

goal (1 subgoal):
 1. sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
have "\<dots>
    = (\<Sum>v\<in>?Vi. f (v,u)) + (\<Sum>v\<in>?Vi. f' (v,u)) - (\<Sum>v\<in>?Vi. f' (u,v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>E `` {u}. f (u, v)) + (\<Sum>v\<in>E `` {u}. f' (u, v)) - (\<Sum>v\<in>E `` {u}. f' (v, u)) = (\<Sum>v\<in>E\<inverse> `` {u}. f (v, u)) + (\<Sum>v\<in>E\<inverse> `` {u}. f' (v, u)) - (\<Sum>v\<in>E\<inverse> `` {u}. f' (u, v))
[PROOF STEP]
by (auto simp: conservation_const_pointwise[OF U_ASM] flow_summation_aux)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>E `` {u}. f (u, v)) + (\<Sum>v\<in>E `` {u}. f' (u, v)) - (\<Sum>v\<in>E `` {u}. f' (v, u)) = (\<Sum>v\<in>E\<inverse> `` {u}. f (v, u)) + (\<Sum>v\<in>E\<inverse> `` {u}. f' (v, u)) - (\<Sum>v\<in>E\<inverse> `` {u}. f' (u, v))

goal (1 subgoal):
 1. sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>E `` {u}. f (u, v)) + (\<Sum>v\<in>E `` {u}. f' (u, v)) - (\<Sum>v\<in>E `` {u}. f' (v, u)) = (\<Sum>v\<in>E\<inverse> `` {u}. f (v, u)) + (\<Sum>v\<in>E\<inverse> `` {u}. f' (v, u)) - (\<Sum>v\<in>E\<inverse> `` {u}. f' (u, v))

goal (1 subgoal):
 1. sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
have "\<dots>
    = (\<Sum>v\<in>?Vi. f (v,u) + f' (v,u) - f' (u,v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>E\<inverse> `` {u}. f (v, u)) + (\<Sum>v\<in>E\<inverse> `` {u}. f' (v, u)) - (\<Sum>v\<in>E\<inverse> `` {u}. f' (u, v)) = (\<Sum>v\<in>E\<inverse> `` {u}. f (v, u) + f' (v, u) - f' (u, v))
[PROOF STEP]
by (auto simp: sum_subtractf sum.distrib)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>E\<inverse> `` {u}. f (v, u)) + (\<Sum>v\<in>E\<inverse> `` {u}. f' (v, u)) - (\<Sum>v\<in>E\<inverse> `` {u}. f' (u, v)) = (\<Sum>v\<in>E\<inverse> `` {u}. f (v, u) + f' (v, u) - f' (u, v))

goal (1 subgoal):
 1. sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>E\<inverse> `` {u}. f (v, u)) + (\<Sum>v\<in>E\<inverse> `` {u}. f' (v, u)) - (\<Sum>v\<in>E\<inverse> `` {u}. f' (u, v)) = (\<Sum>v\<in>E\<inverse> `` {u}. f (v, u) + f' (v, u) - f' (u, v))

goal (1 subgoal):
 1. sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
have "\<dots>
    = (\<Sum>v\<in>?Vi. augment f' (v,u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>E\<inverse> `` {u}. f (v, u) + f' (v, u) - f' (u, v)) = (\<Sum>v\<in>E\<inverse> `` {u}. augment f' (v, u))
[PROOF STEP]
by (auto simp: augment_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>E\<inverse> `` {u}. f (v, u) + f' (v, u) - f' (u, v)) = (\<Sum>v\<in>E\<inverse> `` {u}. augment f' (v, u))

goal (1 subgoal):
 1. sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>E\<inverse> `` {u}. f (v, u) + f' (v, u) - f' (u, v)) = (\<Sum>v\<in>E\<inverse> `` {u}. augment f' (v, u))

goal (1 subgoal):
 1. sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
have "\<dots>
    = ?RHS"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>E\<inverse> `` {u}. augment f' (v, u)) = sum (augment f') (incoming u)
[PROOF STEP]
by (auto simp: sum_incoming_pointwise)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>E\<inverse> `` {u}. augment f' (v, u)) = sum (augment f') (incoming u)

goal (1 subgoal):
 1. sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
show "?LHS = ?RHS"
[PROOF STATE]
proof (prove)
using this:
sum (augment f') (outgoing u) = sum (augment f') (incoming u)

goal (1 subgoal):
 1. sum (augment f') (outgoing u) = sum (augment f') (incoming u)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sum (augment f') (outgoing u) = sum (augment f') (incoming u)

goal:
No subgoals!
[PROOF STEP]
qed