[STATEMENT]
lemma closed_segment_as_isometric_image:
  "((\<lambda>t. x + (t/dist x y) *\<^sub>R (y - x))`{0..dist x y}) = closed_segment x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>t. x + (t / dist x y) *\<^sub>R (y - x)) ` {0..dist x y} = closed_segment x y
[PROOF STEP]
proof (auto simp add: closed_segment_def image_iff)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>t. \<lbrakk>0 \<le> t; t \<le> dist x y\<rbrakk> \<Longrightarrow> \<exists>u. x + (t / dist x y) *\<^sub>R (y - x) = (1 - u) *\<^sub>R x + u *\<^sub>R y \<and> 0 \<le> u \<and> u \<le> 1
 2. \<And>u. \<lbrakk>0 \<le> u; u \<le> 1\<rbrakk> \<Longrightarrow> \<exists>xa\<in>{0..dist x y}. (1 - u) *\<^sub>R x + u *\<^sub>R y = x + (xa / dist x y) *\<^sub>R (y - x)
[PROOF STEP]
fix t
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>t. \<lbrakk>0 \<le> t; t \<le> dist x y\<rbrakk> \<Longrightarrow> \<exists>u. x + (t / dist x y) *\<^sub>R (y - x) = (1 - u) *\<^sub>R x + u *\<^sub>R y \<and> 0 \<le> u \<and> u \<le> 1
 2. \<And>u. \<lbrakk>0 \<le> u; u \<le> 1\<rbrakk> \<Longrightarrow> \<exists>xa\<in>{0..dist x y}. (1 - u) *\<^sub>R x + u *\<^sub>R y = x + (xa / dist x y) *\<^sub>R (y - x)
[PROOF STEP]
assume H: "0 \<le> t" "t \<le> dist x y"
[PROOF STATE]
proof (state)
this:
0 \<le> t
t \<le> dist x y

goal (2 subgoals):
 1. \<And>t. \<lbrakk>0 \<le> t; t \<le> dist x y\<rbrakk> \<Longrightarrow> \<exists>u. x + (t / dist x y) *\<^sub>R (y - x) = (1 - u) *\<^sub>R x + u *\<^sub>R y \<and> 0 \<le> u \<and> u \<le> 1
 2. \<And>u. \<lbrakk>0 \<le> u; u \<le> 1\<rbrakk> \<Longrightarrow> \<exists>xa\<in>{0..dist x y}. (1 - u) *\<^sub>R x + u *\<^sub>R y = x + (xa / dist x y) *\<^sub>R (y - x)
[PROOF STEP]
show "\<exists>u. x + (t / dist x y) *\<^sub>R (y - x) = (1 - u) *\<^sub>R x + u *\<^sub>R y \<and> 0 \<le> u \<and> u \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>u. x + (t / dist x y) *\<^sub>R (y - x) = (1 - u) *\<^sub>R x + u *\<^sub>R y \<and> 0 \<le> u \<and> u \<le> 1
[PROOF STEP]
apply (rule exI[of _ "t/dist x y"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + (t / dist x y) *\<^sub>R (y - x) = (1 - t / dist x y) *\<^sub>R x + (t / dist x y) *\<^sub>R y \<and> 0 \<le> t / dist x y \<and> t / dist x y \<le> 1
[PROOF STEP]
using H
[PROOF STATE]
proof (prove)
using this:
0 \<le> t
t \<le> dist x y

goal (1 subgoal):
 1. x + (t / dist x y) *\<^sub>R (y - x) = (1 - t / dist x y) *\<^sub>R x + (t / dist x y) *\<^sub>R y \<and> 0 \<le> t / dist x y \<and> t / dist x y \<le> 1
[PROOF STEP]
apply (auto simp add: algebra_simps divide_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> t; t \<le> dist x y; x \<noteq> y\<rbrakk> \<Longrightarrow> x = (t / dist x y) *\<^sub>R x + ((dist x y - t) / dist x y) *\<^sub>R x
[PROOF STEP]
apply (metis add_diff_cancel_left' add_diff_eq add_divide_distrib dist_eq_0_iff scaleR_add_left vector_fraction_eq_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<exists>u. x + (t / dist x y) *\<^sub>R (y - x) = (1 - u) *\<^sub>R x + u *\<^sub>R y \<and> 0 \<le> u \<and> u \<le> 1

goal (1 subgoal):
 1. \<And>u. \<lbrakk>0 \<le> u; u \<le> 1\<rbrakk> \<Longrightarrow> \<exists>xa\<in>{0..dist x y}. (1 - u) *\<^sub>R x + u *\<^sub>R y = x + (xa / dist x y) *\<^sub>R (y - x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>u. \<lbrakk>0 \<le> u; u \<le> 1\<rbrakk> \<Longrightarrow> \<exists>xa\<in>{0..dist x y}. (1 - u) *\<^sub>R x + u *\<^sub>R y = x + (xa / dist x y) *\<^sub>R (y - x)
[PROOF STEP]
fix u::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>u. \<lbrakk>0 \<le> u; u \<le> 1\<rbrakk> \<Longrightarrow> \<exists>xa\<in>{0..dist x y}. (1 - u) *\<^sub>R x + u *\<^sub>R y = x + (xa / dist x y) *\<^sub>R (y - x)
[PROOF STEP]
assume H: "0 \<le> u" "u \<le> 1"
[PROOF STATE]
proof (state)
this:
0 \<le> u
u \<le> 1

goal (1 subgoal):
 1. \<And>u. \<lbrakk>0 \<le> u; u \<le> 1\<rbrakk> \<Longrightarrow> \<exists>xa\<in>{0..dist x y}. (1 - u) *\<^sub>R x + u *\<^sub>R y = x + (xa / dist x y) *\<^sub>R (y - x)
[PROOF STEP]
show "\<exists>t\<in>{0..dist x y}. (1 - u) *\<^sub>R x + u *\<^sub>R y = x + (t / dist x y) *\<^sub>R (y - x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>t\<in>{0..dist x y}. (1 - u) *\<^sub>R x + u *\<^sub>R y = x + (t / dist x y) *\<^sub>R (y - x)
[PROOF STEP]
apply (rule bexI[of _ "u * dist x y"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (1 - u) *\<^sub>R x + u *\<^sub>R y = x + (u * dist x y / dist x y) *\<^sub>R (y - x)
 2. u * dist x y \<in> {0..dist x y}
[PROOF STEP]
using H
[PROOF STATE]
proof (prove)
using this:
0 \<le> u
u \<le> 1

goal (2 subgoals):
 1. (1 - u) *\<^sub>R x + u *\<^sub>R y = x + (u * dist x y / dist x y) *\<^sub>R (y - x)
 2. u * dist x y \<in> {0..dist x y}
[PROOF STEP]
by (auto simp add: algebra_simps mult_left_le_one_le)
[PROOF STATE]
proof (state)
this:
\<exists>t\<in>{0..dist x y}. (1 - u) *\<^sub>R x + u *\<^sub>R y = x + (t / dist x y) *\<^sub>R (y - x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem infsetsum_reindex:
  assumes "inj_on g A"
  shows   "infsetsum f (g ` A) = infsetsum (\<lambda>x. f (g x)) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infsetsum f (g ` A) = (\<Sum>\<^sub>ax\<in>A. f (g x))
[PROOF STEP]
by (intro infsetsum_reindex_bij_betw [symmetric] inj_on_imp_bij_betw assms)


[STATEMENT]
lemma strict_mono_Suc_iff: "strict_mono f \<longleftrightarrow> (\<forall>n. f n < f (Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. strict_mono f = (\<forall>n. f n < f (Suc n))
[PROOF STEP]
proof (intro iffI strict_monoI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. strict_mono f \<Longrightarrow> \<forall>n. f n < f (Suc n)
 2. \<And>x y. \<lbrakk>\<forall>n. f n < f (Suc n); x < y\<rbrakk> \<Longrightarrow> f x < f y
[PROOF STEP]
assume *: "\<forall>n. f n < f (Suc n)"
[PROOF STATE]
proof (state)
this:
\<forall>n. f n < f (Suc n)

goal (2 subgoals):
 1. strict_mono f \<Longrightarrow> \<forall>n. f n < f (Suc n)
 2. \<And>x y. \<lbrakk>\<forall>n. f n < f (Suc n); x < y\<rbrakk> \<Longrightarrow> f x < f y
[PROOF STEP]
fix m n :: nat
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. strict_mono f \<Longrightarrow> \<forall>n. f n < f (Suc n)
 2. \<And>x y. \<lbrakk>\<forall>n. f n < f (Suc n); x < y\<rbrakk> \<Longrightarrow> f x < f y
[PROOF STEP]
assume "m < n"
[PROOF STATE]
proof (state)
this:
m < n

goal (2 subgoals):
 1. strict_mono f \<Longrightarrow> \<forall>n. f n < f (Suc n)
 2. \<And>x y. \<lbrakk>\<forall>n. f n < f (Suc n); x < y\<rbrakk> \<Longrightarrow> f x < f y
[PROOF STEP]
thus "f m < f n"
[PROOF STATE]
proof (prove)
using this:
m < n

goal (1 subgoal):
 1. f m < f n
[PROOF STEP]
by (induction rule: less_Suc_induct) (use * in auto)
[PROOF STATE]
proof (state)
this:
f m < f n

goal (1 subgoal):
 1. strict_mono f \<Longrightarrow> \<forall>n. f n < f (Suc n)
[PROOF STEP]
qed (auto simp: strict_mono_def)


[STATEMENT]
lemma subdegree_add_ge':
  fixes   f g :: "'a::monoid_add fps"
  assumes "f + g \<noteq> 0"
  shows   "subdegree (f + g) \<ge> min (subdegree f) (subdegree g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (subdegree f) (subdegree g) \<le> subdegree (f + g)
[PROOF STEP]
using   assms
[PROOF STATE]
proof (prove)
using this:
f + g \<noteq> 0

goal (1 subgoal):
 1. min (subdegree f) (subdegree g) \<le> subdegree (f + g)
[PROOF STEP]
by      (force intro: subdegree_geI)


[STATEMENT]
lemma Cor_Plu_2_3_Pluennecke_ineq:
  assumes K: "card (sumset A B) \<le> K * real (card A)"
    and   A: "finite A" "A \<subseteq> G" "A \<noteq> {}"
    and   B: "finite B" "B \<subseteq> G"
  shows "real (card (sumset_iterated B r)) \<le> K ^ r * real (card A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (sumset_iterated B r)) \<le> K ^ r * real (card A)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (card (sumset_iterated B r)) \<le> K ^ r * real (card A)
[PROOF STEP]
obtain A' where *:"A' \<subseteq> A" "A' \<noteq> {}"
    "card (sumset A' (sumset_iterated B r)) \<le> K^r * real (card A')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; A' \<noteq> {}; real (card (sumset A' (sumset_iterated B r))) \<le> K ^ r * real (card A')\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms Cor_Plu_2_3
[PROOF STATE]
proof (prove)
using this:
real (card (sumset A B)) \<le> K * real (card A)
finite A
A \<subseteq> G
A \<noteq> {}
finite B
B \<subseteq> G
\<lbrakk>real (card (sumset ?A ?B)) \<le> ?K * real (card ?A); finite ?A; ?A \<subseteq> G; ?A \<noteq> {}; finite ?B; ?B \<subseteq> G; \<And>A'. \<lbrakk>A' \<subseteq> ?A; A' \<noteq> {}; \<And>r. real (card (sumset A' (sumset_iterated ?B r))) \<le> ?K ^ r * real (card A')\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>A'. \<lbrakk>A' \<subseteq> A; A' \<noteq> {}; real (card (sumset A' (sumset_iterated B r))) \<le> K ^ r * real (card A')\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
A' \<subseteq> A
A' \<noteq> {}
real (card (sumset A' (sumset_iterated B r))) \<le> K ^ r * real (card A')

goal (1 subgoal):
 1. real (card (sumset_iterated B r)) \<le> K ^ r * real (card A)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
real (card (sumset A B)) \<le> K * real (card A)
finite A
A \<subseteq> G
A \<noteq> {}
finite B
B \<subseteq> G
A' \<subseteq> A
A' \<noteq> {}
real (card (sumset A' (sumset_iterated B r))) \<le> K ^ r * real (card A')
[PROOF STEP]
have  **: "card (sumset_iterated B r) \<le> card (sumset A' (sumset_iterated B r))"
[PROOF STATE]
proof (prove)
using this:
real (card (sumset A B)) \<le> K * real (card A)
finite A
A \<subseteq> G
A \<noteq> {}
finite B
B \<subseteq> G
A' \<subseteq> A
A' \<noteq> {}
real (card (sumset A' (sumset_iterated B r))) \<le> K ^ r * real (card A')

goal (1 subgoal):
 1. card (sumset_iterated B r) \<le> card (sumset A' (sumset_iterated B r))
[PROOF STEP]
by (meson card_le_sumset finite_subset finite_sumset_iterated subset_empty subset_iff sumset_iterated_subset_carrier)
[PROOF STATE]
proof (state)
this:
card (sumset_iterated B r) \<le> card (sumset A' (sumset_iterated B r))

goal (1 subgoal):
 1. real (card (sumset_iterated B r)) \<le> K ^ r * real (card A)
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
A' \<subseteq> A
A' \<noteq> {}
real (card (sumset A' (sumset_iterated B r))) \<le> K ^ r * real (card A')
card (sumset_iterated B r) \<le> card (sumset A' (sumset_iterated B r))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A' \<subseteq> A
A' \<noteq> {}
real (card (sumset A' (sumset_iterated B r))) \<le> K ^ r * real (card A')
card (sumset_iterated B r) \<le> card (sumset A' (sumset_iterated B r))

goal (1 subgoal):
 1. real (card (sumset_iterated B r)) \<le> K ^ r * real (card A)
[PROOF STEP]
by (smt (verit, best) A(1) K card_mono mult_left_mono of_nat_0_le_iff of_nat_le_iff zero_le_mult_iff zero_le_power)
[PROOF STATE]
proof (state)
this:
real (card (sumset_iterated B r)) \<le> K ^ r * real (card A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma compact_convex_combinations:
  fixes S T :: "'a::real_normed_vector set"
  assumes "compact S" "compact T"
  shows "compact { (1 - u) *\<^sub>R x + u *\<^sub>R y | x y u. 0 \<le> u \<and> u \<le> 1 \<and> x \<in> S \<and> y \<in> T}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact {(1 - u) *\<^sub>R x + u *\<^sub>R y |x y u. 0 \<le> u \<and> u \<le> 1 \<and> x \<in> S \<and> y \<in> T}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. compact {(1 - u) *\<^sub>R x + u *\<^sub>R y |x y u. 0 \<le> u \<and> u \<le> 1 \<and> x \<in> S \<and> y \<in> T}
[PROOF STEP]
let ?X = "{0..1} \<times> S \<times> T"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. compact {(1 - u) *\<^sub>R x + u *\<^sub>R y |x y u. 0 \<le> u \<and> u \<le> 1 \<and> x \<in> S \<and> y \<in> T}
[PROOF STEP]
let ?h = "(\<lambda>z. (1 - fst z) *\<^sub>R fst (snd z) + fst z *\<^sub>R snd (snd z))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. compact {(1 - u) *\<^sub>R x + u *\<^sub>R y |x y u. 0 \<le> u \<and> u \<le> 1 \<and> x \<in> S \<and> y \<in> T}
[PROOF STEP]
have *: "{ (1 - u) *\<^sub>R x + u *\<^sub>R y | x y u. 0 \<le> u \<and> u \<le> 1 \<and> x \<in> S \<and> y \<in> T} = ?h ` ?X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(1 - u) *\<^sub>R x + u *\<^sub>R y |x y u. 0 \<le> u \<and> u \<le> 1 \<and> x \<in> S \<and> y \<in> T} = (\<lambda>z. (1 - fst z) *\<^sub>R fst (snd z) + fst z *\<^sub>R snd (snd z)) ` ({0..1} \<times> S \<times> T)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
{(1 - u) *\<^sub>R x + u *\<^sub>R y |x y u. 0 \<le> u \<and> u \<le> 1 \<and> x \<in> S \<and> y \<in> T} = (\<lambda>z. (1 - fst z) *\<^sub>R fst (snd z) + fst z *\<^sub>R snd (snd z)) ` ({0..1} \<times> S \<times> T)

goal (1 subgoal):
 1. compact {(1 - u) *\<^sub>R x + u *\<^sub>R y |x y u. 0 \<le> u \<and> u \<le> 1 \<and> x \<in> S \<and> y \<in> T}
[PROOF STEP]
have "continuous_on ?X (\<lambda>z. (1 - fst z) *\<^sub>R fst (snd z) + fst z *\<^sub>R snd (snd z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on ({0..1} \<times> S \<times> T) (\<lambda>z. (1 - fst z) *\<^sub>R fst (snd z) + fst z *\<^sub>R snd (snd z))
[PROOF STEP]
unfolding continuous_on
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{0..1} \<times> S \<times> T. ((\<lambda>z. (1 - fst z) *\<^sub>R fst (snd z) + fst z *\<^sub>R snd (snd z)) \<longlongrightarrow> (1 - fst x) *\<^sub>R fst (snd x) + fst x *\<^sub>R snd (snd x)) (at x within {0..1} \<times> S \<times> T)
[PROOF STEP]
by (rule ballI) (intro tendsto_intros)
[PROOF STATE]
proof (state)
this:
continuous_on ({0..1} \<times> S \<times> T) (\<lambda>z. (1 - fst z) *\<^sub>R fst (snd z) + fst z *\<^sub>R snd (snd z))

goal (1 subgoal):
 1. compact {(1 - u) *\<^sub>R x + u *\<^sub>R y |x y u. 0 \<le> u \<and> u \<le> 1 \<and> x \<in> S \<and> y \<in> T}
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
compact S
compact T
continuous_on ({0..1} \<times> S \<times> T) (\<lambda>z. (1 - fst z) *\<^sub>R fst (snd z) + fst z *\<^sub>R snd (snd z))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
compact S
compact T
continuous_on ({0..1} \<times> S \<times> T) (\<lambda>z. (1 - fst z) *\<^sub>R fst (snd z) + fst z *\<^sub>R snd (snd z))

goal (1 subgoal):
 1. compact {(1 - u) *\<^sub>R x + u *\<^sub>R y |x y u. 0 \<le> u \<and> u \<le> 1 \<and> x \<in> S \<and> y \<in> T}
[PROOF STEP]
by (simp add: * compact_Times compact_continuous_image)
[PROOF STATE]
proof (state)
this:
compact {(1 - u) *\<^sub>R x + u *\<^sub>R y |x y u. 0 \<le> u \<and> u \<le> 1 \<and> x \<in> S \<and> y \<in> T}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma leqv_trans:
assumes 12: "leqv L1 L2" and 23: "leqv L2 L3"
shows "leqv L1 L3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. leqv L1 L3
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
leqv L1 L2
leqv L2 L3

goal (1 subgoal):
 1. leqv L1 L3
[PROOF STEP]
unfolding leqv_def
[PROOF STATE]
proof (prove)
using this:
subs L1 L2 \<and> subs L2 L1
subs L2 L3 \<and> subs L3 L2

goal (1 subgoal):
 1. subs L1 L3 \<and> subs L3 L1
[PROOF STEP]
by (metis (lifting) subs_trans)


[STATEMENT]
lemma coeff_pochhammer_poly: "coeff (pochhammer_poly n) k = of_nat (stirling n k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (pochhammer_poly n) k = of_nat (stirling n k)
[PROOF STEP]
by (simp add: pochhammer_poly_def nth_default_def del: upt_Suc)


[STATEMENT]
lemma Gamma_conv_nn_integral_real:
  assumes "s > (0::real)"
  shows   "Gamma s = nn_integral lborel (\<lambda>t. ennreal (indicator {0..} t * t powr (s - 1) / exp t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (Gamma s) = \<integral>\<^sup>+ t. ennreal (indicat_real {0..} t * t powr (s - 1) / exp t) \<partial>lborel
[PROOF STEP]
using nn_integral_has_integral_lebesgue[OF _ Gamma_integral_real[OF assms]]
[PROOF STATE]
proof (prove)
using this:
(\<And>x. 0 \<le> x powr (s - 1) / exp x) \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (indicat_real {0..} x * (x powr (s - 1) / exp x)) \<partial>lborel = ennreal (Gamma s)

goal (1 subgoal):
 1. ennreal (Gamma s) = \<integral>\<^sup>+ t. ennreal (indicat_real {0..} t * t powr (s - 1) / exp t) \<partial>lborel
[PROOF STEP]
by simp


[STATEMENT]
lemma brnL_mono[simp]: "n1 \<le> n2 \<Longrightarrow> brnL cl n1 \<le> brnL cl n2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n1 \<le> n2 \<Longrightarrow> brnL cl n1 \<le> brnL cl n2
[PROOF STEP]
using le_take[of n1 n2 cl]
[PROOF STATE]
proof (prove)
using this:
n1 \<le> n2 \<Longrightarrow> take n1 cl \<le> take n2 cl

goal (1 subgoal):
 1. n1 \<le> n2 \<Longrightarrow> brnL cl n1 \<le> brnL cl n2
[PROOF STEP]
unfolding brnL_def
[PROOF STATE]
proof (prove)
using this:
n1 \<le> n2 \<Longrightarrow> take n1 cl \<le> take n2 cl

goal (1 subgoal):
 1. n1 \<le> n2 \<Longrightarrow> lsum brn (take n1 cl) \<le> lsum brn (take n2 cl)
[PROOF STEP]
by simp


[STATEMENT]
lemma dim_submatrix: "dim_row (submatrix A I J) = card {i. i<dim_row A \<and> i\<in>I}"
                     "dim_col (submatrix A I J) = card {j. j<dim_col A \<and> j\<in>J}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (submatrix A I J) = card {i. i < dim_row A \<and> i \<in> I} &&& dim_col (submatrix A I J) = card {j. j < dim_col A \<and> j \<in> J}
[PROOF STEP]
unfolding submatrix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mat (card {i. i < dim_row A \<and> i \<in> I}) (card {j. j < dim_col A \<and> j \<in> J}) (\<lambda>(i, j). A $$ (pick I i, pick J j))) = card {i. i < dim_row A \<and> i \<in> I} &&& dim_col (mat (card {i. i < dim_row A \<and> i \<in> I}) (card {j. j < dim_col A \<and> j \<in> J}) (\<lambda>(i, j). A $$ (pick I i, pick J j))) = card {j. j < dim_col A \<and> j \<in> J}
[PROOF STEP]
by simp_all


[STATEMENT]
theorem Motzkin's_transposition_theorem: fixes cs :: "rat le_constraint set"
  assumes fin: "finite cs"
  shows "(\<nexists> v. \<forall> c \<in> cs. v \<Turnstile>\<^sub>l\<^sub>e c) \<longleftrightarrow>
       (\<exists> C const rel. (\<forall> (r, c) \<in> set C. r > 0 \<and> c \<in> cs)
         \<and> (\<Sum> (r,c) \<leftarrow> C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c))
               = Le_Constraint rel 0 const
         \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0))"
    (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<nexists>v. \<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c) = (\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<nexists>v. \<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c) = (\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0))
[PROOF STEP]
let ?to_cs = "\<lambda> c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | _ \<Rightarrow> LT) (lec_poly c) (lec_const c)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<nexists>v. \<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c) = (\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0))
[PROOF STEP]
have to_cs: "v \<Turnstile>\<^sub>c ?to_cs c \<longleftrightarrow> v \<Turnstile>\<^sub>l\<^sub>e c" for v c
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<Turnstile>\<^sub>c (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c) = v \<Turnstile>\<^sub>l\<^sub>e c
[PROOF STEP]
by (cases c, cases "lec_rel c", auto)
[PROOF STATE]
proof (state)
this:
?v \<Turnstile>\<^sub>c (case lec_rel ?c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly ?c) (lec_const ?c) = ?v \<Turnstile>\<^sub>l\<^sub>e ?c

goal (1 subgoal):
 1. (\<nexists>v. \<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c) = (\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0))
[PROOF STEP]
let ?cs = "?to_cs ` cs"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<nexists>v. \<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c) = (\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0))
[PROOF STEP]
from fin
[PROOF STATE]
proof (chain)
picking this:
finite cs
[PROOF STEP]
have fin: "finite ?cs"
[PROOF STATE]
proof (prove)
using this:
finite cs

goal (1 subgoal):
 1. finite ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs)

goal (1 subgoal):
 1. (\<nexists>v. \<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c) = (\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0))
[PROOF STEP]
have "v \<Turnstile>\<^sub>c\<^sub>s ?cs \<longleftrightarrow> (\<forall> c \<in> cs. v \<Turnstile>\<^sub>l\<^sub>e c)" for v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<Turnstile>\<^sub>c\<^sub>s ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) = (\<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c)
[PROOF STEP]
using to_cs
[PROOF STATE]
proof (prove)
using this:
?v \<Turnstile>\<^sub>c (case lec_rel ?c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly ?c) (lec_const ?c) = ?v \<Turnstile>\<^sub>l\<^sub>e ?c

goal (1 subgoal):
 1. v \<Turnstile>\<^sub>c\<^sub>s ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) = (\<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?v \<Turnstile>\<^sub>c\<^sub>s ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) = (\<forall>c\<in>cs. ?v \<Turnstile>\<^sub>l\<^sub>e c)

goal (1 subgoal):
 1. (\<nexists>v. \<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c) = (\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0))
[PROOF STEP]
hence "?lhs = (\<nexists> v. v \<Turnstile>\<^sub>c\<^sub>s ?cs)"
[PROOF STATE]
proof (prove)
using this:
?v \<Turnstile>\<^sub>c\<^sub>s ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) = (\<forall>c\<in>cs. ?v \<Turnstile>\<^sub>l\<^sub>e c)

goal (1 subgoal):
 1. (\<nexists>v. \<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c) = (\<nexists>v. v \<Turnstile>\<^sub>c\<^sub>s ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<nexists>v. \<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c) = (\<nexists>v. v \<Turnstile>\<^sub>c\<^sub>s ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs))

goal (1 subgoal):
 1. (\<nexists>v. \<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c) = (\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<nexists>v. \<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c) = (\<nexists>v. v \<Turnstile>\<^sub>c\<^sub>s ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs))

goal (1 subgoal):
 1. (\<nexists>v. \<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c) = (\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0))
[PROOF STEP]
have "\<dots> = (\<exists>C. farkas_coefficients ?cs C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<nexists>v. v \<Turnstile>\<^sub>c\<^sub>s ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs)) = (\<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C)
[PROOF STEP]
unfolding farkas_coefficients[OF fin]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<nexists>v. v \<Turnstile>\<^sub>c\<^sub>s ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs)) = (\<nexists>v. v \<Turnstile>\<^sub>c\<^sub>s ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(\<nexists>v. v \<Turnstile>\<^sub>c\<^sub>s ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs)) = (\<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C)

goal (1 subgoal):
 1. (\<nexists>v. \<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c) = (\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<nexists>v. v \<Turnstile>\<^sub>c\<^sub>s ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs)) = (\<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C)

goal (1 subgoal):
 1. (\<nexists>v. \<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c) = (\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0))
[PROOF STEP]
have "\<dots> = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C) = (\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C \<Longrightarrow> \<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0)
 2. \<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0) \<Longrightarrow> \<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C
[PROOF STEP]
assume "\<exists> C. farkas_coefficients ?cs C"
[PROOF STATE]
proof (state)
this:
\<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C

goal (2 subgoals):
 1. \<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C \<Longrightarrow> \<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0)
 2. \<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0) \<Longrightarrow> \<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C
[PROOF STEP]
obtain C const rel where is_leq: "\<forall> (s, n) \<in> set C. n \<in> ?cs \<and> is_le (s *R n) \<and> s \<noteq> 0"
      and sum: "(\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n)) = Le_Constraint rel 0 const"
      and c0: "(rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0)"
[PROOF STATE]
proof (prove)
using this:
\<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C

goal (1 subgoal):
 1. (\<And>C rel const. \<lbrakk>\<forall>(s, n)\<in>set C. n \<in> (\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs \<and> is_le (s *R n) \<and> s \<noteq> 0; (\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n)) = Le_Constraint rel 0 const; rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding farkas_coefficients_def
[PROOF STATE]
proof (prove)
using this:
\<exists>C d rel. (\<forall>(r, c)\<in>set C. c \<in> (\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs \<and> is_le (r *R c) \<and> r \<noteq> 0) \<and> (\<Sum>(r, c)\<leftarrow>C. lec_of_constraint (r *R c)) = Le_Constraint rel 0 d \<and> (rel = Leq_Rel \<and> d < 0 \<or> rel = Lt_Rel \<and> d \<le> 0)

goal (1 subgoal):
 1. (\<And>C rel const. \<lbrakk>\<forall>(s, n)\<in>set C. n \<in> (\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs \<and> is_le (s *R n) \<and> s \<noteq> 0; (\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n)) = Le_Constraint rel 0 const; rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>(s, n)\<in>set C. n \<in> (\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs \<and> is_le (s *R n) \<and> s \<noteq> 0
(\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n)) = Le_Constraint rel 0 const
rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0

goal (2 subgoals):
 1. \<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C \<Longrightarrow> \<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0)
 2. \<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0) \<Longrightarrow> \<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C
[PROOF STEP]
let ?C = "map (\<lambda> (s,n). (s,lec_of_constraint n)) C"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C \<Longrightarrow> \<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0)
 2. \<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0) \<Longrightarrow> \<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0)
[PROOF STEP]
proof (intro exI[of _ ?C] exI[of _ const] exI[of _ rel] conjI c0, unfold map_map o_def set_map sum[symmetric],
        intro ballI, clarify)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b aa ba. (aa, ba) \<in> set C \<Longrightarrow> 0 < aa \<and> lec_of_constraint ba \<in> cs
 2. (\<Sum>x\<leftarrow>C. case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b aa ba. (aa, ba) \<in> set C \<Longrightarrow> 0 < aa \<and> lec_of_constraint ba \<in> cs
 2. (\<Sum>x\<leftarrow>C. case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n))
[PROOF STEP]
fix s n
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b aa ba. (aa, ba) \<in> set C \<Longrightarrow> 0 < aa \<and> lec_of_constraint ba \<in> cs
 2. (\<Sum>x\<leftarrow>C. case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n))
[PROOF STEP]
assume sn: "(s, n) \<in> set C"
[PROOF STATE]
proof (state)
this:
(s, n) \<in> set C

goal (2 subgoals):
 1. \<And>a b aa ba. (aa, ba) \<in> set C \<Longrightarrow> 0 < aa \<and> lec_of_constraint ba \<in> cs
 2. (\<Sum>x\<leftarrow>C. case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n))
[PROOF STEP]
with is_leq
[PROOF STATE]
proof (chain)
picking this:
\<forall>(s, n)\<in>set C. n \<in> (\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs \<and> is_le (s *R n) \<and> s \<noteq> 0
(s, n) \<in> set C
[PROOF STEP]
have n_ns: "n \<in> ?cs" and is_leq: "is_le (s *R n)" and s0: "s \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>(s, n)\<in>set C. n \<in> (\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs \<and> is_le (s *R n) \<and> s \<noteq> 0
(s, n) \<in> set C

goal (1 subgoal):
 1. n \<in> (\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs &&& is_le (s *R n) &&& s \<noteq> 0
[PROOF STEP]
by force+
[PROOF STATE]
proof (state)
this:
n \<in> (\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs
is_le (s *R n)
s \<noteq> 0

goal (2 subgoals):
 1. \<And>a b aa ba. (aa, ba) \<in> set C \<Longrightarrow> 0 < aa \<and> lec_of_constraint ba \<in> cs
 2. (\<Sum>x\<leftarrow>C. case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n))
[PROOF STEP]
from n_ns
[PROOF STATE]
proof (chain)
picking this:
n \<in> (\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs
[PROOF STEP]
obtain c where c: "c \<in> cs" and n: "n = ?to_cs c"
[PROOF STATE]
proof (prove)
using this:
n \<in> (\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>c \<in> cs; n = (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c \<in> cs
n = (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)

goal (2 subgoals):
 1. \<And>a b aa ba. (aa, ba) \<in> set C \<Longrightarrow> 0 < aa \<and> lec_of_constraint ba \<in> cs
 2. (\<Sum>x\<leftarrow>C. case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n))
[PROOF STEP]
from is_leq[unfolded n]
[PROOF STATE]
proof (chain)
picking this:
is_le (s *R (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c))
[PROOF STEP]
have "s \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
is_le (s *R (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c))

goal (1 subgoal):
 1. 0 \<le> s
[PROOF STEP]
by (cases "lec_rel c", auto split: if_splits)
[PROOF STATE]
proof (state)
this:
0 \<le> s

goal (2 subgoals):
 1. \<And>a b aa ba. (aa, ba) \<in> set C \<Longrightarrow> 0 < aa \<and> lec_of_constraint ba \<in> cs
 2. (\<Sum>x\<leftarrow>C. case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n))
[PROOF STEP]
with s0
[PROOF STATE]
proof (chain)
picking this:
s \<noteq> 0
0 \<le> s
[PROOF STEP]
have s0: "s > 0"
[PROOF STATE]
proof (prove)
using this:
s \<noteq> 0
0 \<le> s

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

goal (2 subgoals):
 1. \<And>a b aa ba. (aa, ba) \<in> set C \<Longrightarrow> 0 < aa \<and> lec_of_constraint ba \<in> cs
 2. (\<Sum>x\<leftarrow>C. case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n))
[PROOF STEP]
let ?c = "lec_of_constraint n"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b aa ba. (aa, ba) \<in> set C \<Longrightarrow> 0 < aa \<and> lec_of_constraint ba \<in> cs
 2. (\<Sum>x\<leftarrow>C. case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n))
[PROOF STEP]
from c n
[PROOF STATE]
proof (chain)
picking this:
c \<in> cs
n = (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)
[PROOF STEP]
have mem: "?c \<in> cs"
[PROOF STATE]
proof (prove)
using this:
c \<in> cs
n = (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)

goal (1 subgoal):
 1. lec_of_constraint n \<in> cs
[PROOF STEP]
by (cases c, cases "lec_rel c", auto)
[PROOF STATE]
proof (state)
this:
lec_of_constraint n \<in> cs

goal (2 subgoals):
 1. \<And>a b aa ba. (aa, ba) \<in> set C \<Longrightarrow> 0 < aa \<and> lec_of_constraint ba \<in> cs
 2. (\<Sum>x\<leftarrow>C. case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n))
[PROOF STEP]
show "0 < s \<and> ?c \<in> cs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < s \<and> lec_of_constraint n \<in> cs
[PROOF STEP]
using s0 mem
[PROOF STATE]
proof (prove)
using this:
0 < s
lec_of_constraint n \<in> cs

goal (1 subgoal):
 1. 0 < s \<and> lec_of_constraint n \<in> cs
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
0 < s \<and> lec_of_constraint n \<in> cs

goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>C. case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n))
[PROOF STEP]
have "lec_of_constraint (s *R n) = Le_Constraint (lec_rel ?c) (s *R lec_poly ?c) (s *R lec_const ?c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lec_of_constraint (s *R n) = Le_Constraint (lec_rel (lec_of_constraint n)) (s *R lec_poly (lec_of_constraint n)) (s *R lec_const (lec_of_constraint n))
[PROOF STEP]
unfolding n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lec_of_constraint (s *R (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) = Le_Constraint (lec_rel (lec_of_constraint ((case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)))) (s *R lec_poly (lec_of_constraint ((case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)))) (s *R lec_const (lec_of_constraint ((case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c))))
[PROOF STEP]
using s0
[PROOF STATE]
proof (prove)
using this:
0 < s

goal (1 subgoal):
 1. lec_of_constraint (s *R (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) = Le_Constraint (lec_rel (lec_of_constraint ((case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)))) (s *R lec_poly (lec_of_constraint ((case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)))) (s *R lec_const (lec_of_constraint ((case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c))))
[PROOF STEP]
by (cases c, cases "lec_rel c", auto)
[PROOF STATE]
proof (state)
this:
lec_of_constraint (s *R n) = Le_Constraint (lec_rel (lec_of_constraint n)) (s *R lec_poly (lec_of_constraint n)) (s *R lec_const (lec_of_constraint n))

goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>C. case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(?s2, ?n2) \<in> set C \<Longrightarrow> lec_of_constraint (?s2 *R ?n2) = Le_Constraint (lec_rel (lec_of_constraint ?n2)) (?s2 *R lec_poly (lec_of_constraint ?n2)) (?s2 *R lec_const (lec_of_constraint ?n2))

goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>C. case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n))
[PROOF STEP]
note id = this
[PROOF STATE]
proof (state)
this:
(?s2, ?n2) \<in> set C \<Longrightarrow> lec_of_constraint (?s2 *R ?n2) = Le_Constraint (lec_rel (lec_of_constraint ?n2)) (?s2 *R lec_poly (lec_of_constraint ?n2)) (?s2 *R lec_const (lec_of_constraint ?n2))

goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>C. case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n))
[PROOF STEP]
show "(\<Sum>x\<leftarrow>C. case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of
             (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) =
            (\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n))"
        (is "sum_list (map ?f C) = sum_list (map ?g C)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>C. case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n))
[PROOF STEP]
proof (rule arg_cong[of _ _ sum_list], rule map_cong[OF refl])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> set C \<Longrightarrow> (case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (case x of (s, n) \<Rightarrow> lec_of_constraint (s *R n))
[PROOF STEP]
fix pair
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> set C \<Longrightarrow> (case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (case x of (s, n) \<Rightarrow> lec_of_constraint (s *R n))
[PROOF STEP]
assume mem: "pair \<in> set C"
[PROOF STATE]
proof (state)
this:
pair \<in> set C

goal (1 subgoal):
 1. \<And>x. x \<in> set C \<Longrightarrow> (case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (case x of (s, n) \<Rightarrow> lec_of_constraint (s *R n))
[PROOF STEP]
obtain r c where pair: "pair = (r,c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>r c. pair = (r, c) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
pair = (r, c)

goal (1 subgoal):
 1. \<And>x. x \<in> set C \<Longrightarrow> (case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (case x of (s, n) \<Rightarrow> lec_of_constraint (s *R n))
[PROOF STEP]
show "?f pair = ?g pair"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case case pair of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (case pair of (s, n) \<Rightarrow> lec_of_constraint (s *R n))
[PROOF STEP]
unfolding pair split id[OF mem[unfolded pair]]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Le_Constraint (lec_rel (lec_of_constraint c)) (r *R lec_poly (lec_of_constraint c)) (r *R lec_const (lec_of_constraint c)) = Le_Constraint (lec_rel (lec_of_constraint c)) (r *R lec_poly (lec_of_constraint c)) (r *R lec_const (lec_of_constraint c))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(case case pair of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (case pair of (s, n) \<Rightarrow> lec_of_constraint (s *R n))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<leftarrow>C. case case x of (s, n) \<Rightarrow> (s, lec_of_constraint n) of (r, c) \<Rightarrow> Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = (\<Sum>(s, n)\<leftarrow>C. lec_of_constraint (s *R n))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0)

goal (1 subgoal):
 1. \<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0) \<Longrightarrow> \<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0) \<Longrightarrow> \<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0)

goal (1 subgoal):
 1. \<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0) \<Longrightarrow> \<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0)
[PROOF STEP]
obtain C const rel
      where C: "\<And> r c. (r,c) \<in> set C \<Longrightarrow> 0 < r \<and> c \<in> cs"
        and sum: "(\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c))
           = Le_Constraint rel 0 const"
        and const: "rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0"
[PROOF STATE]
proof (prove)
using this:
\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0)

goal (1 subgoal):
 1. (\<And>C rel const. \<lbrakk>\<And>r c. (r, c) \<in> set C \<Longrightarrow> 0 < r \<and> c \<in> cs; (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const; rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(?r, ?c) \<in> set C \<Longrightarrow> 0 < ?r \<and> ?c \<in> cs
(\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const
rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0

goal (1 subgoal):
 1. \<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0) \<Longrightarrow> \<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C
[PROOF STEP]
let ?C = "map (\<lambda> (r,c). (r, ?to_cs c)) C"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0) \<Longrightarrow> \<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C
[PROOF STEP]
show "\<exists> C. farkas_coefficients ?cs C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C
[PROOF STEP]
unfolding farkas_coefficients_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>C d rel. (\<forall>(r, c)\<in>set C. c \<in> (\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs \<and> is_le (r *R c) \<and> r \<noteq> 0) \<and> (\<Sum>(r, c)\<leftarrow>C. lec_of_constraint (r *R c)) = Le_Constraint rel 0 d \<and> (rel = Leq_Rel \<and> d < 0 \<or> rel = Lt_Rel \<and> d \<le> 0)
[PROOF STEP]
proof (intro exI[of _ ?C] exI[of _ const] exI[of _ rel] conjI const, unfold sum[symmetric])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>(r, c)\<in>set (map (\<lambda>(r, c). (r, (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c))) C). c \<in> (\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs \<and> is_le (r *R c) \<and> r \<noteq> 0
 2. (\<Sum>(r, c)\<leftarrow>map (\<lambda>(r, c). (r, (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c))) C. lec_of_constraint (r *R c)) = (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c))
[PROOF STEP]
show "\<forall>(s, n)\<in>set ?C. n \<in> ?cs \<and> is_le (s *R n) \<and> s \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>(s, n)\<in>set (map (\<lambda>(r, c). (r, (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c))) C). n \<in> (\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs \<and> is_le (s *R n) \<and> s \<noteq> 0
[PROOF STEP]
using C
[PROOF STATE]
proof (prove)
using this:
(?r, ?c) \<in> set C \<Longrightarrow> 0 < ?r \<and> ?c \<in> cs

goal (1 subgoal):
 1. \<forall>(s, n)\<in>set (map (\<lambda>(r, c). (r, (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c))) C). n \<in> (\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs \<and> is_le (s *R n) \<and> s \<noteq> 0
[PROOF STEP]
by (fastforce split: le_rel.splits)
[PROOF STATE]
proof (state)
this:
\<forall>(s, n)\<in>set (map (\<lambda>(r, c). (r, (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c))) C). n \<in> (\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs \<and> is_le (s *R n) \<and> s \<noteq> 0

goal (1 subgoal):
 1. (\<Sum>(r, c)\<leftarrow>map (\<lambda>(r, c). (r, (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c))) C. lec_of_constraint (r *R c)) = (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c))
[PROOF STEP]
show "(\<Sum>(s, n)\<leftarrow>?C. lec_of_constraint (s *R n))
        = (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(s, n)\<leftarrow>map (\<lambda>(r, c). (r, (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c))) C. lec_of_constraint (s *R n)) = (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c))
[PROOF STEP]
unfolding map_map o_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>C. case case x of (r, c) \<Rightarrow> (r, (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) of (s, n) \<Rightarrow> lec_of_constraint (s *R n)) = (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c))
[PROOF STEP]
by (rule arg_cong[of _ _ sum_list], rule map_cong[OF refl], insert C, fastforce split: le_rel.splits)
[PROOF STATE]
proof (state)
this:
(\<Sum>(s, n)\<leftarrow>map (\<lambda>(r, c). (r, (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c))) C. lec_of_constraint (s *R n)) = (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<exists>C. farkas_coefficients ((\<lambda>c. (case lec_rel c of Leq_Rel \<Rightarrow> LEQ | Lt_Rel \<Rightarrow> LT) (lec_poly c) (lec_const c)) ` cs) C) = (\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0))

goal (1 subgoal):
 1. (\<nexists>v. \<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c) = (\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<nexists>v. \<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c) = (\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<nexists>v. \<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c) = (\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0))

goal (1 subgoal):
 1. (\<nexists>v. \<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c) = (\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<nexists>v. \<forall>c\<in>cs. v \<Turnstile>\<^sub>l\<^sub>e c) = (\<exists>C const rel. (\<forall>(r, c)\<in>set C. 0 < r \<and> c \<in> cs) \<and> (\<Sum>(r, c)\<leftarrow>C. Le_Constraint (lec_rel c) (r *R lec_poly c) (r *R lec_const c)) = Le_Constraint rel 0 const \<and> (rel = Leq_Rel \<and> const < 0 \<or> rel = Lt_Rel \<and> const \<le> 0))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma f_make_mono_less:
"\<forall>n. f n < oLimit f \<Longrightarrow> f (make_mono f n) < f (make_mono f (Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. f n < oLimit f \<Longrightarrow> f (make_mono f n) < f (make_mono f (Suc n))
[PROOF STEP]
apply (drule_tac x="make_mono f n" in spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (make_mono f n) < oLimit f \<Longrightarrow> f (make_mono f n) < f (make_mono f (Suc n))
[PROOF STEP]
apply (drule less_oLimitD, clarsimp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. f (make_mono f n) < f na \<Longrightarrow> f (make_mono f n) < f (LEAST x. f (make_mono f n) < f x)
[PROOF STEP]
apply (erule LeastI)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma eulerian_poly':
  "Abs_fps (\<lambda>n. of_nat (n+1) ^ k) =
     fps_of_poly (eulerian_poly k :: 'a :: field poly) / (1 - fps_X) ^ (k + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs_fps (\<lambda>n. of_nat (n + 1) ^ k) = fps_of_poly (eulerian_poly k) / (1 - fps_X) ^ (k + 1)
[PROOF STEP]
by (subst eulerian_poly) simp


[STATEMENT]
lemma spaceN_iff:
  "x \<in> space\<^sub>N N \<longleftrightarrow> eNorm N x < \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> space\<^sub>N N) = (eNorm N x < \<infinity>)
[PROOF STEP]
unfolding space\<^sub>N_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> {f. eNorm N f < \<infinity>}) = (eNorm N x < \<infinity>)
[PROOF STEP]
by simp


[STATEMENT]
lemma transpose_columnvector: "transpose(columnvector v) = rowvector v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Cartesian_Product.transpose (columnvector v) = rowvector v
[PROOF STEP]
by (simp add: transpose_def rowvector_def columnvector_def vec_eq_iff)


[STATEMENT]
lemma upper_triangular_inverse:
  fixes A::"(('a::{euclidean_semiring,comm_ring_1},'n::{wellorder, finite}) vec, 'n) vec"
  assumes A: "upper_triangular A"
  and inv_A: "invertible A"
  shows "upper_triangular (matrix_inv A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_triangular (matrix_inv A)
[PROOF STEP]
using upper_triangular_adjugate[OF A]
[PROOF STATE]
proof (prove)
using this:
upper_triangular (adjugate A)

goal (1 subgoal):
 1. upper_triangular (matrix_inv A)
[PROOF STEP]
unfolding invertible_imp_matrix_inv[OF inv_A]
[PROOF STATE]
proof (prove)
using this:
upper_triangular (adjugate A)

goal (1 subgoal):
 1. upper_triangular ((1::'a) div det A *k adjugate A)
[PROOF STEP]
unfolding matrix_scalar_mult_def upper_triangular_def
[PROOF STATE]
proof (prove)
using this:
\<forall>i j. j < i \<longrightarrow> adjugate A $ i $ j = (0::'a)

goal (1 subgoal):
 1. \<forall>i j. j < i \<longrightarrow> (\<chi>i j. (1::'a) div det A * adjugate A $ i $ j) $ i $ j = (0::'a)
[PROOF STEP]
by auto


[STATEMENT]
lemma integral_on_1_eq:
  fixes f :: "'a::euclidean_space \<Rightarrow> real^1"
  shows "integral S f = vec (integral S (\<lambda>x. f x $ 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral S f = vec (integral S (\<lambda>x. f x $ 1))
[PROOF STEP]
by (cases "f integrable_on S") (simp_all add: integrable_on_1_iff vec_eq_iff not_integrable_integral)


[STATEMENT]
lemma perpendicular_intersects:
  assumes "is_poincare_line H1" "is_poincare_line H2"
  assumes "perpendicular H1 H2"
  shows "\<exists> z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2" (is "?P' H1 H2")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2
[PROOF STEP]
have "\<forall> H2. is_poincare_line H2 \<and> perpendicular H1 H2 \<longrightarrow> ?P' H1 H2" (is "?P H1")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>H2. is_poincare_line H2 \<and> perpendicular H1 H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2)
[PROOF STEP]
proof (rule wlog_line_x_axis)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. is_poincare_line H1
 2. \<forall>H2. is_poincare_line H2 \<and> perpendicular x_axis H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set x_axis \<inter> circline_set H2)
 3. \<And>M. \<lbrakk>unit_disc_fix M; \<forall>H2. is_poincare_line H2 \<and> perpendicular (moebius_circline M H1) H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set (moebius_circline M H1) \<inter> circline_set H2)\<rbrakk> \<Longrightarrow> \<forall>H2. is_poincare_line H2 \<and> perpendicular H1 H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2)
[PROOF STEP]
show "?P x_axis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>H2. is_poincare_line H2 \<and> perpendicular x_axis H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set x_axis \<inter> circline_set H2)
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>H2. \<lbrakk>is_poincare_line H2; perpendicular x_axis H2\<rbrakk> \<Longrightarrow> \<exists>z. z \<in> unit_disc \<and> z \<in> circline_set x_axis \<inter> circline_set H2
[PROOF STEP]
fix H2
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>H2. \<lbrakk>is_poincare_line H2; perpendicular x_axis H2\<rbrakk> \<Longrightarrow> \<exists>z. z \<in> unit_disc \<and> z \<in> circline_set x_axis \<inter> circline_set H2
[PROOF STEP]
assume "is_poincare_line H2" "perpendicular x_axis H2"
[PROOF STATE]
proof (state)
this:
is_poincare_line H2
perpendicular x_axis H2

goal (1 subgoal):
 1. \<And>H2. \<lbrakk>is_poincare_line H2; perpendicular x_axis H2\<rbrakk> \<Longrightarrow> \<exists>z. z \<in> unit_disc \<and> z \<in> circline_set x_axis \<inter> circline_set H2
[PROOF STEP]
thus "\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set x_axis \<inter> circline_set H2"
[PROOF STATE]
proof (prove)
using this:
is_poincare_line H2
perpendicular x_axis H2

goal (1 subgoal):
 1. \<exists>z. z \<in> unit_disc \<and> z \<in> circline_set x_axis \<inter> circline_set H2
[PROOF STEP]
using perpendicular_to_x_axis[of H2]
[PROOF STATE]
proof (prove)
using this:
is_poincare_line H2
perpendicular x_axis H2
is_poincare_line H2 \<Longrightarrow> perpendicular_to_x_axis H2 = perpendicular x_axis H2

goal (1 subgoal):
 1. \<exists>z. z \<in> unit_disc \<and> z \<in> circline_set x_axis \<inter> circline_set H2
[PROOF STEP]
using perpendicular_to_x_axis_intersects_x_axis[of H2]
[PROOF STATE]
proof (prove)
using this:
is_poincare_line H2
perpendicular x_axis H2
is_poincare_line H2 \<Longrightarrow> perpendicular_to_x_axis H2 = perpendicular x_axis H2
\<lbrakk>is_poincare_line H2; perpendicular_to_x_axis H2\<rbrakk> \<Longrightarrow> intersects_x_axis H2

goal (1 subgoal):
 1. \<exists>z. z \<in> unit_disc \<and> z \<in> circline_set x_axis \<inter> circline_set H2
[PROOF STEP]
using intersects_x_axis_iff[of H2]
[PROOF STATE]
proof (prove)
using this:
is_poincare_line H2
perpendicular x_axis H2
is_poincare_line H2 \<Longrightarrow> perpendicular_to_x_axis H2 = perpendicular x_axis H2
\<lbrakk>is_poincare_line H2; perpendicular_to_x_axis H2\<rbrakk> \<Longrightarrow> intersects_x_axis H2
is_poincare_line H2 \<Longrightarrow> (\<exists>x\<in>unit_disc. x \<in> circline_set H2 \<inter> circline_set x_axis) = intersects_x_axis H2

goal (1 subgoal):
 1. \<exists>z. z \<in> unit_disc \<and> z \<in> circline_set x_axis \<inter> circline_set H2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set x_axis \<inter> circline_set H2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>H2. is_poincare_line H2 \<and> perpendicular x_axis H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set x_axis \<inter> circline_set H2)

goal (2 subgoals):
 1. is_poincare_line H1
 2. \<And>M. \<lbrakk>unit_disc_fix M; \<forall>H2. is_poincare_line H2 \<and> perpendicular (moebius_circline M H1) H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set (moebius_circline M H1) \<inter> circline_set H2)\<rbrakk> \<Longrightarrow> \<forall>H2. is_poincare_line H2 \<and> perpendicular H1 H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. is_poincare_line H1
 2. \<And>M. \<lbrakk>unit_disc_fix M; \<forall>H2. is_poincare_line H2 \<and> perpendicular (moebius_circline M H1) H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set (moebius_circline M H1) \<inter> circline_set H2)\<rbrakk> \<Longrightarrow> \<forall>H2. is_poincare_line H2 \<and> perpendicular H1 H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2)
[PROOF STEP]
fix M
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. is_poincare_line H1
 2. \<And>M. \<lbrakk>unit_disc_fix M; \<forall>H2. is_poincare_line H2 \<and> perpendicular (moebius_circline M H1) H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set (moebius_circline M H1) \<inter> circline_set H2)\<rbrakk> \<Longrightarrow> \<forall>H2. is_poincare_line H2 \<and> perpendicular H1 H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2)
[PROOF STEP]
assume "unit_disc_fix M"
[PROOF STATE]
proof (state)
this:
unit_disc_fix M

goal (2 subgoals):
 1. is_poincare_line H1
 2. \<And>M. \<lbrakk>unit_disc_fix M; \<forall>H2. is_poincare_line H2 \<and> perpendicular (moebius_circline M H1) H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set (moebius_circline M H1) \<inter> circline_set H2)\<rbrakk> \<Longrightarrow> \<forall>H2. is_poincare_line H2 \<and> perpendicular H1 H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2)
[PROOF STEP]
assume *: "?P (moebius_circline M H1)"
[PROOF STATE]
proof (state)
this:
\<forall>H2. is_poincare_line H2 \<and> perpendicular (moebius_circline M H1) H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set (moebius_circline M H1) \<inter> circline_set H2)

goal (2 subgoals):
 1. is_poincare_line H1
 2. \<And>M. \<lbrakk>unit_disc_fix M; \<forall>H2. is_poincare_line H2 \<and> perpendicular (moebius_circline M H1) H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set (moebius_circline M H1) \<inter> circline_set H2)\<rbrakk> \<Longrightarrow> \<forall>H2. is_poincare_line H2 \<and> perpendicular H1 H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2)
[PROOF STEP]
show "?P H1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>H2. is_poincare_line H2 \<and> perpendicular H1 H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2)
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>H2. \<lbrakk>is_poincare_line H2; perpendicular H1 H2\<rbrakk> \<Longrightarrow> \<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2
[PROOF STEP]
fix H2
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>H2. \<lbrakk>is_poincare_line H2; perpendicular H1 H2\<rbrakk> \<Longrightarrow> \<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2
[PROOF STEP]
assume "is_poincare_line H2" "perpendicular H1 H2"
[PROOF STATE]
proof (state)
this:
is_poincare_line H2
perpendicular H1 H2

goal (1 subgoal):
 1. \<And>H2. \<lbrakk>is_poincare_line H2; perpendicular H1 H2\<rbrakk> \<Longrightarrow> \<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is_poincare_line H2
perpendicular H1 H2
[PROOF STEP]
obtain z where "z \<in> unit_disc" "z \<in> circline_set (moebius_circline M H1) \<and> z \<in> circline_set (moebius_circline M H2)"
[PROOF STATE]
proof (prove)
using this:
is_poincare_line H2
perpendicular H1 H2

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z \<in> unit_disc; z \<in> circline_set (moebius_circline M H1) \<and> z \<in> circline_set (moebius_circline M H2)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using *[rule_format, of "moebius_circline M H2"] \<open>unit_disc_fix M\<close>
[PROOF STATE]
proof (prove)
using this:
is_poincare_line H2
perpendicular H1 H2
is_poincare_line (moebius_circline M H2) \<and> perpendicular (moebius_circline M H1) (moebius_circline M H2) \<Longrightarrow> \<exists>z. z \<in> unit_disc \<and> z \<in> circline_set (moebius_circline M H1) \<inter> circline_set (moebius_circline M H2)
unit_disc_fix M

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z \<in> unit_disc; z \<in> circline_set (moebius_circline M H1) \<and> z \<in> circline_set (moebius_circline M H2)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z \<in> unit_disc
z \<in> circline_set (moebius_circline M H1) \<and> z \<in> circline_set (moebius_circline M H2)

goal (1 subgoal):
 1. \<And>H2. \<lbrakk>is_poincare_line H2; perpendicular H1 H2\<rbrakk> \<Longrightarrow> \<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2
[PROOF STEP]
thus "\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2"
[PROOF STATE]
proof (prove)
using this:
z \<in> unit_disc
z \<in> circline_set (moebius_circline M H1) \<and> z \<in> circline_set (moebius_circline M H2)

goal (1 subgoal):
 1. \<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2
[PROOF STEP]
using \<open>unit_disc_fix M\<close>
[PROOF STATE]
proof (prove)
using this:
z \<in> unit_disc
z \<in> circline_set (moebius_circline M H1) \<and> z \<in> circline_set (moebius_circline M H2)
unit_disc_fix M

goal (1 subgoal):
 1. \<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2
[PROOF STEP]
by (rule_tac x="moebius_pt (-M) z" in exI)
           (metis IntI add.inverse_inverse circline_set_moebius_circline_iff moebius_pt_comp_inv_left uminus_moebius_def unit_disc_fix_discI unit_disc_fix_moebius_uminus)
[PROOF STATE]
proof (state)
this:
\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>H2. is_poincare_line H2 \<and> perpendicular H1 H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2)

goal (1 subgoal):
 1. is_poincare_line H1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. is_poincare_line H1
[PROOF STEP]
show "is_poincare_line H1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_poincare_line H1
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
is_poincare_line H1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>H2. is_poincare_line H2 \<and> perpendicular H1 H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2)

goal (1 subgoal):
 1. \<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>H2. is_poincare_line H2 \<and> perpendicular H1 H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2)

goal (1 subgoal):
 1. \<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>H2. is_poincare_line H2 \<and> perpendicular H1 H2 \<longrightarrow> (\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2)
is_poincare_line H1
is_poincare_line H2
perpendicular H1 H2

goal (1 subgoal):
 1. \<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>z. z \<in> unit_disc \<and> z \<in> circline_set H1 \<inter> circline_set H2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma binomial_le_pow2: "n choose k \<le> 2^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n choose k \<le> 2 ^ n
[PROOF STEP]
proof (induction n arbitrary: k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>k. 0 choose k \<le> 2 ^ 0
 2. \<And>n k. (\<And>k. n choose k \<le> 2 ^ n) \<Longrightarrow> Suc n choose k \<le> 2 ^ Suc n
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>k. 0 choose k \<le> 2 ^ 0
 2. \<And>n k. (\<And>k. n choose k \<le> 2 ^ n) \<Longrightarrow> Suc n choose k \<le> 2 ^ Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 choose k \<le> 2 ^ 0
[PROOF STEP]
using le_less less_le_trans
[PROOF STATE]
proof (prove)
using this:
(?x \<le> ?y) = (?x < ?y \<or> ?x = ?y)
\<lbrakk>?x < ?y; ?y \<le> ?z\<rbrakk> \<Longrightarrow> ?x < ?z

goal (1 subgoal):
 1. 0 choose k \<le> 2 ^ 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
0 choose k \<le> 2 ^ 0

goal (1 subgoal):
 1. \<And>n k. (\<And>k. n choose k \<le> 2 ^ n) \<Longrightarrow> Suc n choose k \<le> 2 ^ Suc n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n k. (\<And>k. n choose k \<le> 2 ^ n) \<Longrightarrow> Suc n choose k \<le> 2 ^ Suc n
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
n choose ?k \<le> 2 ^ n

goal (1 subgoal):
 1. \<And>n k. (\<And>k. n choose k \<le> 2 ^ n) \<Longrightarrow> Suc n choose k \<le> 2 ^ Suc n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc n choose k \<le> 2 ^ Suc n
[PROOF STEP]
proof (cases k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k = 0 \<Longrightarrow> Suc n choose k \<le> 2 ^ Suc n
 2. \<And>nat. k = Suc nat \<Longrightarrow> Suc n choose k \<le> 2 ^ Suc n
[PROOF STEP]
case (Suc k')
[PROOF STATE]
proof (state)
this:
k = Suc k'

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> Suc n choose k \<le> 2 ^ Suc n
 2. \<And>nat. k = Suc nat \<Longrightarrow> Suc n choose k \<le> 2 ^ Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k = Suc k'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
k = Suc k'

goal (1 subgoal):
 1. Suc n choose k \<le> 2 ^ Suc n
[PROOF STEP]
using Suc.IH
[PROOF STATE]
proof (prove)
using this:
k = Suc k'
n choose ?k \<le> 2 ^ n

goal (1 subgoal):
 1. Suc n choose k \<le> 2 ^ Suc n
[PROOF STEP]
by (simp add: add_le_mono mult_2)
[PROOF STATE]
proof (state)
this:
Suc n choose k \<le> 2 ^ Suc n

goal (1 subgoal):
 1. k = 0 \<Longrightarrow> Suc n choose k \<le> 2 ^ Suc n
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
Suc n choose k \<le> 2 ^ Suc n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powr_mono3:
  fixes x::real
  assumes "0 < x" "x < 1" "b \<le> a"
  shows "x powr a \<le> x powr b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x powr a \<le> x powr b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x powr a \<le> x powr b
[PROOF STEP]
have "x powr a = 1 / x powr -a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x powr a = 1 / x powr - a
[PROOF STEP]
by (simp add: powr_minus_divide)
[PROOF STATE]
proof (state)
this:
x powr a = 1 / x powr - a

goal (1 subgoal):
 1. x powr a \<le> x powr b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x powr a = 1 / x powr - a

goal (1 subgoal):
 1. x powr a \<le> x powr b
[PROOF STEP]
have "\<dots> = (1 / x) powr -a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / x powr - a = (1 / x) powr - a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x
x < 1
b \<le> a

goal (1 subgoal):
 1. 1 / x powr - a = (1 / x) powr - a
[PROOF STEP]
by (simp add: powr_divide)
[PROOF STATE]
proof (state)
this:
1 / x powr - a = (1 / x) powr - a

goal (1 subgoal):
 1. x powr a \<le> x powr b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
1 / x powr - a = (1 / x) powr - a

goal (1 subgoal):
 1. x powr a \<le> x powr b
[PROOF STEP]
have "\<dots> \<le> (1 / x) powr -b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 / x) powr - a \<le> (1 / x) powr - b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x
x < 1
b \<le> a

goal (1 subgoal):
 1. (1 / x) powr - a \<le> (1 / x) powr - b
[PROOF STEP]
by (simp add: powr_mono)
[PROOF STATE]
proof (state)
this:
(1 / x) powr - a \<le> (1 / x) powr - b

goal (1 subgoal):
 1. x powr a \<le> x powr b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 / x) powr - a \<le> (1 / x) powr - b

goal (1 subgoal):
 1. x powr a \<le> x powr b
[PROOF STEP]
have "\<dots> = 1 / x powr -b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 / x) powr - b = 1 / x powr - b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x
x < 1
b \<le> a

goal (1 subgoal):
 1. (1 / x) powr - b = 1 / x powr - b
[PROOF STEP]
by (simp add: powr_divide)
[PROOF STATE]
proof (state)
this:
(1 / x) powr - b = 1 / x powr - b

goal (1 subgoal):
 1. x powr a \<le> x powr b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 / x) powr - b = 1 / x powr - b

goal (1 subgoal):
 1. x powr a \<le> x powr b
[PROOF STEP]
have "\<dots> = x powr b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / x powr - b = x powr b
[PROOF STEP]
by (simp add: powr_minus_divide)
[PROOF STATE]
proof (state)
this:
1 / x powr - b = x powr b

goal (1 subgoal):
 1. x powr a \<le> x powr b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x powr a \<le> x powr b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x powr a \<le> x powr b

goal (1 subgoal):
 1. x powr a \<le> x powr b
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x powr a \<le> x powr b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma l_idmap_comp: "\<lbrakk>f \<in> extensional A; f \<in> A \<rightarrow> B\<rbrakk> \<Longrightarrow>
                   compose A (idmap B) f = f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> extensional A; f \<in> A \<rightarrow> B\<rbrakk> \<Longrightarrow> compose A (idmap B) f = f
[PROOF STEP]
apply (rule funcset_eq[of _ "A"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>f \<in> extensional A; f \<in> A \<rightarrow> B\<rbrakk> \<Longrightarrow> compose A (idmap B) f \<in> extensional A
 2. \<lbrakk>f \<in> extensional A; f \<in> A \<rightarrow> B\<rbrakk> \<Longrightarrow> f \<in> extensional A
 3. \<lbrakk>f \<in> extensional A; f \<in> A \<rightarrow> B\<rbrakk> \<Longrightarrow> \<forall>x\<in>A. compose A (idmap B) f x = f x
[PROOF STEP]
apply (simp add:compose_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>f \<in> extensional A; f \<in> A \<rightarrow> B\<rbrakk> \<Longrightarrow> f \<in> extensional A
 2. \<lbrakk>f \<in> extensional A; f \<in> A \<rightarrow> B\<rbrakk> \<Longrightarrow> \<forall>x\<in>A. compose A (idmap B) f x = f x
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> extensional A; f \<in> A \<rightarrow> B\<rbrakk> \<Longrightarrow> \<forall>x\<in>A. compose A (idmap B) f x = f x
[PROOF STEP]
apply (rule ballI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>f \<in> extensional A; f \<in> A \<rightarrow> B; x \<in> A\<rbrakk> \<Longrightarrow> compose A (idmap B) f x = f x
[PROOF STEP]
apply (simp add:funcset_mem[of "f" "A" "B"] compose_def idmap_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma tendsto_neg_powr_complex_of_real:
  assumes "filterlim f at_top F" and "Re s < 0"
  shows   "((\<lambda>x. complex_of_real (f x) powr s) \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. complex_of_real (f x) powr s) \<longlongrightarrow> 0) F
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. complex_of_real (f x) powr s) \<longlongrightarrow> 0) F
[PROOF STEP]
have "((\<lambda>x. norm (complex_of_real (f x) powr s)) \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. cmod (complex_of_real (f x) powr s)) \<longlongrightarrow> 0) F
[PROOF STEP]
proof (rule Lim_transform_eventually)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (?f \<longlongrightarrow> 0) F
 2. \<forall>\<^sub>F x in F. ?f x = cmod (complex_of_real (f x) powr s)
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
filterlim f at_top F
[PROOF STEP]
have "eventually (\<lambda>x. f x \<ge> 0) F"
[PROOF STATE]
proof (prove)
using this:
filterlim f at_top F

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. 0 \<le> f x
[PROOF STEP]
by (auto simp: filterlim_at_top)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. 0 \<le> f x

goal (2 subgoals):
 1. (?f \<longlongrightarrow> 0) F
 2. \<forall>\<^sub>F x in F. ?f x = cmod (complex_of_real (f x) powr s)
[PROOF STEP]
thus "eventually (\<lambda>x. f x powr Re s = norm (of_real (f x) powr s)) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. 0 \<le> f x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f x powr Re s = cmod (complex_of_real (f x) powr s)
[PROOF STEP]
by eventually_elim (simp add: norm_powr_real_powr)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. f x powr Re s = cmod (complex_of_real (f x) powr s)

goal (1 subgoal):
 1. ((\<lambda>x. f x powr Re s) \<longlongrightarrow> 0) F
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
filterlim f at_top F
Re s < 0
[PROOF STEP]
show "((\<lambda>x. f x powr Re s) \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
using this:
filterlim f at_top F
Re s < 0

goal (1 subgoal):
 1. ((\<lambda>x. f x powr Re s) \<longlongrightarrow> 0) F
[PROOF STEP]
by (intro tendsto_neg_powr)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. f x powr Re s) \<longlongrightarrow> 0) F

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
((\<lambda>x. cmod (complex_of_real (f x) powr s)) \<longlongrightarrow> 0) F

goal (1 subgoal):
 1. ((\<lambda>x. complex_of_real (f x) powr s) \<longlongrightarrow> 0) F
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. cmod (complex_of_real (f x) powr s)) \<longlongrightarrow> 0) F

goal (1 subgoal):
 1. ((\<lambda>x. complex_of_real (f x) powr s) \<longlongrightarrow> 0) F
[PROOF STEP]
by (simp add: tendsto_norm_zero_iff)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. complex_of_real (f x) powr s) \<longlongrightarrow> 0) F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma val_Zp_dist_sym:
  assumes "a \<in> carrier Zp"
  assumes "b \<in> carrier Zp"
  shows "val_Zp_dist a b = val_Zp_dist b a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val_Zp_dist a b = val_Zp_dist b a
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. val_Zp_dist a b = val_Zp_dist b a
[PROOF STEP]
have 1: "a \<ominus> b = \<ominus> (b \<ominus> a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<ominus> b = \<ominus> (b \<ominus> a)
[PROOF STEP]
using assms(1) assms(2)
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier Zp
b \<in> carrier Zp

goal (1 subgoal):
 1. a \<ominus> b = \<ominus> (b \<ominus> a)
[PROOF STEP]
using minus_a_inv
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier Zp
b \<in> carrier Zp
\<lbrakk>?a \<in> carrier Zp; ?b \<in> carrier Zp\<rbrakk> \<Longrightarrow> ?a \<ominus> ?b = \<ominus> (?b \<ominus> ?a)

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

goal (1 subgoal):
 1. val_Zp_dist a b = val_Zp_dist b a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<ominus> b = \<ominus> (b \<ominus> a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<ominus> b = \<ominus> (b \<ominus> a)

goal (1 subgoal):
 1. val_Zp_dist a b = val_Zp_dist b a
[PROOF STEP]
using R.minus_closed Zp_def assms(1) assms(2) padic_integers.val_Zp_of_minus
      padic_integers_axioms val_Zp_dist_def
[PROOF STATE]
proof (prove)
using this:
a \<ominus> b = \<ominus> (b \<ominus> a)
\<lbrakk>?x \<in> carrier Zp; ?y \<in> carrier Zp\<rbrakk> \<Longrightarrow> ?x \<ominus> ?y \<in> carrier Zp
Zp \<equiv> padic_int p
a \<in> carrier Zp
b \<in> carrier Zp
\<lbrakk>padic_integers ?p; ?a \<in> carrier (padic_int ?p)\<rbrakk> \<Longrightarrow> padic_integers.val_Zp ?p ?a = padic_integers.val_Zp ?p (\<ominus>\<^bsub>padic_int ?p\<^esub> ?a)
padic_integers p
val_Zp_dist ?a ?b \<equiv> val_Zp (?a \<ominus> ?b)

goal (1 subgoal):
 1. val_Zp_dist a b = val_Zp_dist b a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
val_Zp_dist a b = val_Zp_dist b a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma regular_Derivs_finite:
  fixes r :: "'a :: finite rexp"
  shows "finite (range (\<lambda>w. Derivs w (lang r)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (range (\<lambda>w. Derivs w (lang r)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (range (\<lambda>w. Derivs w (lang r)))
[PROOF STEP]
have "?thesis \<longleftrightarrow> finite (UNIV // \<approx>lang r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (range (\<lambda>w. Derivs w (lang r))) = finite (UNIV // \<approx>lang r)
[PROOF STEP]
unfolding str_eq_conv_Derivs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (range (\<lambda>w. Derivs w (lang r))) = finite (UNIV // {(u, v). Derivs u (lang r) = Derivs v (lang r)})
[PROOF STEP]
by (rule bij_betw_finite bij_betw_image_quotient)+
[PROOF STATE]
proof (state)
this:
finite (range (\<lambda>w. Derivs w (lang r))) = finite (UNIV // \<approx>lang r)

goal (1 subgoal):
 1. finite (range (\<lambda>w. Derivs w (lang r)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
finite (range (\<lambda>w. Derivs w (lang r))) = finite (UNIV // \<approx>lang r)

goal (1 subgoal):
 1. finite (range (\<lambda>w. Derivs w (lang r)))
[PROOF STEP]
have "\<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (UNIV // \<approx>lang r)
[PROOF STEP]
by (subst Myhill_Nerode [symmetric]) auto
[PROOF STATE]
proof (state)
this:
finite (UNIV // \<approx>lang r)

goal (1 subgoal):
 1. finite (range (\<lambda>w. Derivs w (lang r)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
finite (range (\<lambda>w. Derivs w (lang r)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite (range (\<lambda>w. Derivs w (lang r)))

goal (1 subgoal):
 1. finite (range (\<lambda>w. Derivs w (lang r)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
finite (range (\<lambda>w. Derivs w (lang r)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem Meet_subset_antimono: "A \<subseteq> B \<Longrightarrow> \<Sqinter>B \<sqsubseteq> \<Sqinter>A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> \<Sqinter>B \<sqsubseteq> \<Sqinter>A
[PROOF STEP]
proof (rule Meet_greatest)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>A \<subseteq> B; a \<in> A\<rbrakk> \<Longrightarrow> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>A \<subseteq> B; a \<in> A\<rbrakk> \<Longrightarrow> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
assume "a \<in> A"
[PROOF STATE]
proof (state)
this:
a \<in> A

goal (1 subgoal):
 1. \<And>a. \<lbrakk>A \<subseteq> B; a \<in> A\<rbrakk> \<Longrightarrow> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a \<in> A

goal (1 subgoal):
 1. \<And>a. \<lbrakk>A \<subseteq> B; a \<in> A\<rbrakk> \<Longrightarrow> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
assume "A \<subseteq> B"
[PROOF STATE]
proof (state)
this:
A \<subseteq> B

goal (1 subgoal):
 1. \<And>a. \<lbrakk>A \<subseteq> B; a \<in> A\<rbrakk> \<Longrightarrow> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
a \<in> B
[PROOF STEP]
have "a \<in> B"
[PROOF STATE]
proof (prove)
using this:
a \<in> B

goal (1 subgoal):
 1. a \<in> B
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
a \<in> B

goal (1 subgoal):
 1. \<And>a. \<lbrakk>A \<subseteq> B; a \<in> A\<rbrakk> \<Longrightarrow> \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> B
[PROOF STEP]
show "\<Sqinter>B \<sqsubseteq> a"
[PROOF STATE]
proof (prove)
using this:
a \<in> B

goal (1 subgoal):
 1. \<Sqinter>B \<sqsubseteq> a
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<Sqinter>B \<sqsubseteq> a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma partition_tailrec: "partition_tailrec f as =  (filter f as,  filter (\<lambda>x. \<not>f x) as)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partition_tailrec f as = (filter f as, filter (\<lambda>x. \<not> f x) as)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. partition_tailrec f as = (filter f as, filter (\<lambda>x. \<not> f x) as)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. partition_tailrec f as = (filter f as, filter (\<lambda>x. \<not> f x) as)
[PROOF STEP]
fix ts_accu fs_accu
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. partition_tailrec f as = (filter f as, filter (\<lambda>x. \<not> f x) as)
[PROOF STEP]
have "foldr (select_p_tuple f) as (ts_accu, fs_accu) =
              (filter f as @ ts_accu,  filter (\<lambda>x. \<not>f x) as @ fs_accu)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (select_p_tuple f) as (ts_accu, fs_accu) = (filter f as @ ts_accu, filter (\<lambda>x. \<not> f x) as @ fs_accu)
[PROOF STEP]
by(induction as arbitrary: ts_accu fs_accu) simp_all
[PROOF STATE]
proof (state)
this:
foldr (select_p_tuple f) as (ts_accu, fs_accu) = (filter f as @ ts_accu, filter (\<lambda>x. \<not> f x) as @ fs_accu)

goal (1 subgoal):
 1. partition_tailrec f as = (filter f as, filter (\<lambda>x. \<not> f x) as)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
foldr (select_p_tuple f) as (?ts_accu2, ?fs_accu2) = (filter f as @ ?ts_accu2, filter (\<lambda>x. \<not> f x) as @ ?fs_accu2)

goal (1 subgoal):
 1. partition_tailrec f as = (filter f as, filter (\<lambda>x. \<not> f x) as)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
foldr (select_p_tuple f) as (?ts_accu2, ?fs_accu2) = (filter f as @ ?ts_accu2, filter (\<lambda>x. \<not> f x) as @ ?fs_accu2)

goal (1 subgoal):
 1. partition_tailrec f as = (filter f as, filter (\<lambda>x. \<not> f x) as)
[PROOF STEP]
unfolding partition_tailrec_def
[PROOF STATE]
proof (prove)
using this:
foldr (select_p_tuple f) as (?ts_accu2, ?fs_accu2) = (filter f as @ ?ts_accu2, filter (\<lambda>x. \<not> f x) as @ ?fs_accu2)

goal (1 subgoal):
 1. foldr (select_p_tuple f) as ([], []) = (filter f as, filter (\<lambda>x. \<not> f x) as)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
partition_tailrec f as = (filter f as, filter (\<lambda>x. \<not> f x) as)

goal:
No subgoals!
[PROOF STEP]
qed