[STATEMENT]
lemma partitions_eq_implies_permutes:
  assumes "f \<in> A \<rightarrow>\<^sub>E B" "f' \<in> A \<rightarrow>\<^sub>E B"
  assumes "finite B"
  assumes partitions_eq: "(\<lambda>b. {x \<in> A. f x = b}) ` B - {{}} = (\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}}"
  shows "\<exists>p. p permutes B \<and> (\<forall>x\<in>A. f x = p (f' x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>p. p permutes B \<and> (\<forall>x\<in>A. f x = p (f' x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>p. p permutes B \<and> (\<forall>x\<in>A. f x = p (f' x))
[PROOF STEP]
have card_eq: "card (f' ` A) = card (f ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (f' ` A) = card (f ` A)
[PROOF STEP]
using card_domain_partitions[OF \<open>f \<in> A \<rightarrow>\<^sub>E B\<close> \<open>finite B\<close>]
[PROOF STATE]
proof (prove)
using this:
card ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}) = card (f ` A)

goal (1 subgoal):
 1. card (f' ` A) = card (f ` A)
[PROOF STEP]
using card_domain_partitions[OF \<open>f' \<in> A \<rightarrow>\<^sub>E B\<close> \<open>finite B\<close>]
[PROOF STATE]
proof (prove)
using this:
card ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}) = card (f ` A)
card ((\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}}) = card (f' ` A)

goal (1 subgoal):
 1. card (f' ` A) = card (f ` A)
[PROOF STEP]
using partitions_eq
[PROOF STATE]
proof (prove)
using this:
card ((\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}) = card (f ` A)
card ((\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}}) = card (f' ` A)
(\<lambda>b. {x \<in> A. f x = b}) ` B - {{}} = (\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}}

goal (1 subgoal):
 1. card (f' ` A) = card (f ` A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (f' ` A) = card (f ` A)

goal (1 subgoal):
 1. \<exists>p. p permutes B \<and> (\<forall>x\<in>A. f x = p (f' x))
[PROOF STEP]
have "f' ` A \<subseteq> B" "f ` A \<subseteq> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f' ` A \<subseteq> B &&& f ` A \<subseteq> B
[PROOF STEP]
using \<open>f \<in> A \<rightarrow>\<^sub>E B\<close> \<open>f' \<in> A \<rightarrow>\<^sub>E B\<close>
[PROOF STATE]
proof (prove)
using this:
f \<in> A \<rightarrow>\<^sub>E B
f' \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. f' ` A \<subseteq> B &&& f ` A \<subseteq> B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f' ` A \<subseteq> B
f ` A \<subseteq> B

goal (1 subgoal):
 1. \<exists>p. p permutes B \<and> (\<forall>x\<in>A. f x = p (f' x))
[PROOF STEP]
from this card_eq
[PROOF STATE]
proof (chain)
picking this:
f' ` A \<subseteq> B
f ` A \<subseteq> B
card (f' ` A) = card (f ` A)
[PROOF STEP]
have "card (B - f' ` A) = card (B - f ` A)"
[PROOF STATE]
proof (prove)
using this:
f' ` A \<subseteq> B
f ` A \<subseteq> B
card (f' ` A) = card (f ` A)

goal (1 subgoal):
 1. card (B - f' ` A) = card (B - f ` A)
[PROOF STEP]
using \<open>finite B\<close>
[PROOF STATE]
proof (prove)
using this:
f' ` A \<subseteq> B
f ` A \<subseteq> B
card (f' ` A) = card (f ` A)
finite B

goal (1 subgoal):
 1. card (B - f' ` A) = card (B - f ` A)
[PROOF STEP]
by (auto simp add: card_Diff_subset finite_subset)
[PROOF STATE]
proof (state)
this:
card (B - f' ` A) = card (B - f ` A)

goal (1 subgoal):
 1. \<exists>p. p permutes B \<and> (\<forall>x\<in>A. f x = p (f' x))
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
card (B - f' ` A) = card (B - f ` A)
[PROOF STEP]
obtain p' where "bij_betw p' (B - f' ` A) (B - f ` A)"
[PROOF STATE]
proof (prove)
using this:
card (B - f' ` A) = card (B - f ` A)

goal (1 subgoal):
 1. (\<And>p'. bij_betw p' (B - f' ` A) (B - f ` A) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>finite B\<close>
[PROOF STATE]
proof (prove)
using this:
card (B - f' ` A) = card (B - f ` A)
finite B

goal (1 subgoal):
 1. (\<And>p'. bij_betw p' (B - f' ` A) (B - f ` A) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis finite_same_card_bij finite_Diff)
[PROOF STATE]
proof (state)
this:
bij_betw p' (B - f' ` A) (B - f ` A)

goal (1 subgoal):
 1. \<exists>p. p permutes B \<and> (\<forall>x\<in>A. f x = p (f' x))
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
bij_betw p' (B - f' ` A) (B - f ` A)
[PROOF STEP]
have "p' ` (B - f' ` A) = (B - f ` A)"
[PROOF STATE]
proof (prove)
using this:
bij_betw p' (B - f' ` A) (B - f ` A)

goal (1 subgoal):
 1. p' ` (B - f' ` A) = B - f ` A
[PROOF STEP]
by (simp add: bij_betw_imp_surj_on)
[PROOF STATE]
proof (state)
this:
p' ` (B - f' ` A) = B - f ` A

goal (1 subgoal):
 1. \<exists>p. p permutes B \<and> (\<forall>x\<in>A. f x = p (f' x))
[PROOF STEP]
define p where "\<And>b. p b = (if b \<in> B then
    (if b \<in> f' ` A then the_elem (f ` {x \<in> A. f' x = b}) else p' b) else b)"
[PROOF STATE]
proof (state)
this:
p ?b = (if ?b \<in> B then if ?b \<in> f' ` A then the_elem (f ` {x \<in> A. f' x = ?b}) else p' ?b else ?b)

goal (1 subgoal):
 1. \<exists>p. p permutes B \<and> (\<forall>x\<in>A. f x = p (f' x))
[PROOF STEP]
have "\<forall>x\<in>A. f x = p (f' x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>A. f x = p (f' x)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> f x = p (f' x)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> f x = p (f' x)
[PROOF STEP]
assume "x \<in> A"
[PROOF STATE]
proof (state)
this:
x \<in> A

goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> f x = p (f' x)
[PROOF STEP]
from this partitions_eq
[PROOF STATE]
proof (chain)
picking this:
x \<in> A
(\<lambda>b. {x \<in> A. f x = b}) ` B - {{}} = (\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}}
[PROOF STEP]
have "the_elem (f ` {xa \<in> A. f' xa = f' x}) = f x"
[PROOF STATE]
proof (prove)
using this:
x \<in> A
(\<lambda>b. {x \<in> A. f x = b}) ` B - {{}} = (\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}}

goal (1 subgoal):
 1. the_elem (f ` {xa \<in> A. f' xa = f' x}) = f x
[PROOF STEP]
using the_elem[OF \<open>f \<in> A \<rightarrow>\<^sub>E B\<close> \<open>f' \<in> A \<rightarrow>\<^sub>E B\<close>]
[PROOF STATE]
proof (prove)
using this:
x \<in> A
(\<lambda>b. {x \<in> A. f x = b}) ` B - {{}} = (\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}}
\<lbrakk>(\<lambda>b. {x \<in> A. f x = b}) ` B - {{}} = (\<lambda>b. {x \<in> A. f' x = b}) ` B - {{}}; ?x \<in> A\<rbrakk> \<Longrightarrow> the_elem (f ` {xa \<in> A. f' xa = f' ?x}) = f ?x

goal (1 subgoal):
 1. the_elem (f ` {xa \<in> A. f' xa = f' x}) = f x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
the_elem (f ` {xa \<in> A. f' xa = f' x}) = f x

goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> f x = p (f' x)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
the_elem (f ` {xa \<in> A. f' xa = f' x}) = f x
[PROOF STEP]
show "f x = p (f' x)"
[PROOF STATE]
proof (prove)
using this:
the_elem (f ` {xa \<in> A. f' xa = f' x}) = f x

goal (1 subgoal):
 1. f x = p (f' x)
[PROOF STEP]
using \<open>x \<in> A\<close> p_def \<open>f' \<in> A \<rightarrow>\<^sub>E B\<close>
[PROOF STATE]
proof (prove)
using this:
the_elem (f ` {xa \<in> A. f' xa = f' x}) = f x
x \<in> A
p ?b = (if ?b \<in> B then if ?b \<in> f' ` A then the_elem (f ` {x \<in> A. f' x = ?b}) else p' ?b else ?b)
f' \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. f x = p (f' x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f x = p (f' x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>A. f x = p (f' x)

goal (1 subgoal):
 1. \<exists>p. p permutes B \<and> (\<forall>x\<in>A. f x = p (f' x))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>A. f x = p (f' x)

goal (1 subgoal):
 1. \<exists>p. p permutes B \<and> (\<forall>x\<in>A. f x = p (f' x))
[PROOF STEP]
have "p permutes B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p permutes B
[PROOF STEP]
proof (rule bij_imp_permutes)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. bij_betw p B B
 2. \<And>x. x \<notin> B \<Longrightarrow> p x = x
[PROOF STEP]
let ?invp = "\<lambda>b. if b \<in> f ` A then the_elem (f' ` {x \<in> A. f x = b}) else b"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. bij_betw p B B
 2. \<And>x. x \<notin> B \<Longrightarrow> p x = x
[PROOF STEP]
note [simp] = the_elem[OF \<open>f \<in> A \<rightarrow>\<^sub>E B\<close> \<open>f' \<in> A \<rightarrow>\<^sub>E B\<close> partitions_eq]
[PROOF STATE]
proof (state)
this:
?x \<in> A \<Longrightarrow> the_elem (f ` {xa \<in> A. f' xa = f' ?x}) = f ?x

goal (2 subgoals):
 1. bij_betw p B B
 2. \<And>x. x \<notin> B \<Longrightarrow> p x = x
[PROOF STEP]
show "bij_betw p B B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw p B B
[PROOF STEP]
proof (rule bij_betw_imageI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj_on p B
 2. p ` B = B
[PROOF STEP]
show "p ` B = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ` B = B
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p ` B \<subseteq> B
 2. B \<subseteq> p ` B
[PROOF STEP]
have "(\<lambda>b. the_elem (f ` {x \<in> A. f' x = b})) ` (f' ` A) \<subseteq> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>b. the_elem (f ` {x \<in> A. f' x = b})) ` f' ` A \<subseteq> B
[PROOF STEP]
using \<open>f \<in> A \<rightarrow>\<^sub>E B\<close>
[PROOF STATE]
proof (prove)
using this:
f \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. (\<lambda>b. the_elem (f ` {x \<in> A. f' x = b})) ` f' ` A \<subseteq> B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>b. the_elem (f ` {x \<in> A. f' x = b})) ` f' ` A \<subseteq> B

goal (2 subgoals):
 1. p ` B \<subseteq> B
 2. B \<subseteq> p ` B
[PROOF STEP]
from \<open>p' ` (B - f' ` A) = (B - f ` A)\<close> this
[PROOF STATE]
proof (chain)
picking this:
p' ` (B - f' ` A) = B - f ` A
(\<lambda>b. the_elem (f ` {x \<in> A. f' x = b})) ` f' ` A \<subseteq> B
[PROOF STEP]
show "p ` B \<subseteq> B"
[PROOF STATE]
proof (prove)
using this:
p' ` (B - f' ` A) = B - f ` A
(\<lambda>b. the_elem (f ` {x \<in> A. f' x = b})) ` f' ` A \<subseteq> B

goal (1 subgoal):
 1. p ` B \<subseteq> B
[PROOF STEP]
unfolding p_def \<open>f \<in> A \<rightarrow>\<^sub>E B\<close>
[PROOF STATE]
proof (prove)
using this:
p' ` (B - f' ` A) = B - f ` A
(\<lambda>b. the_elem (f ` {x \<in> A. f' x = b})) ` f' ` A \<subseteq> B

goal (1 subgoal):
 1. (\<lambda>b. if b \<in> B then if b \<in> f' ` A then the_elem (f ` {x \<in> A. f' x = b}) else p' b else b) ` B \<subseteq> B
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
p ` B \<subseteq> B

goal (1 subgoal):
 1. B \<subseteq> p ` B
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. B \<subseteq> p ` B
[PROOF STEP]
show "B \<subseteq> p ` B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<subseteq> p ` B
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> B \<Longrightarrow> x \<in> p ` B
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> B \<Longrightarrow> x \<in> p ` B
[PROOF STEP]
assume "b \<in> B"
[PROOF STATE]
proof (state)
this:
b \<in> B

goal (1 subgoal):
 1. \<And>x. x \<in> B \<Longrightarrow> x \<in> p ` B
[PROOF STEP]
show "b \<in> p ` B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<in> p ` B
[PROOF STEP]
proof (cases "b \<in> f ` A")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. b \<in> f ` A \<Longrightarrow> b \<in> p ` B
 2. b \<notin> f ` A \<Longrightarrow> b \<in> p ` B
[PROOF STEP]
assume "b \<notin> f ` A"
[PROOF STATE]
proof (state)
this:
b \<notin> f ` A

goal (2 subgoals):
 1. b \<in> f ` A \<Longrightarrow> b \<in> p ` B
 2. b \<notin> f ` A \<Longrightarrow> b \<in> p ` B
[PROOF STEP]
note \<open>p' ` (B - f' ` A) = (B - f ` A)\<close>
[PROOF STATE]
proof (state)
this:
p' ` (B - f' ` A) = B - f ` A

goal (2 subgoals):
 1. b \<in> f ` A \<Longrightarrow> b \<in> p ` B
 2. b \<notin> f ` A \<Longrightarrow> b \<in> p ` B
[PROOF STEP]
from this \<open>b \<in> B\<close> \<open>b \<notin> f ` A\<close>
[PROOF STATE]
proof (chain)
picking this:
p' ` (B - f' ` A) = B - f ` A
b \<in> B
b \<notin> f ` A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p' ` (B - f' ` A) = B - f ` A
b \<in> B
b \<notin> f ` A

goal (1 subgoal):
 1. b \<in> p ` B
[PROOF STEP]
unfolding p_def
[PROOF STATE]
proof (prove)
using this:
p' ` (B - f' ` A) = B - f ` A
b \<in> B
b \<notin> f ` A

goal (1 subgoal):
 1. b \<in> (\<lambda>b. if b \<in> B then if b \<in> f' ` A then the_elem (f ` {x \<in> A. f' x = b}) else p' b else b) ` B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b \<in> p ` B

goal (1 subgoal):
 1. b \<in> f ` A \<Longrightarrow> b \<in> p ` B
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b \<in> f ` A \<Longrightarrow> b \<in> p ` B
[PROOF STEP]
assume "b \<in> f ` A"
[PROOF STATE]
proof (state)
this:
b \<in> f ` A

goal (1 subgoal):
 1. b \<in> f ` A \<Longrightarrow> b \<in> p ` B
[PROOF STEP]
from this \<open>\<forall>x\<in>A. f x = p (f' x)\<close> \<open>b \<in> B\<close>
[PROOF STATE]
proof (chain)
picking this:
b \<in> f ` A
\<forall>x\<in>A. f x = p (f' x)
b \<in> B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b \<in> f ` A
\<forall>x\<in>A. f x = p (f' x)
b \<in> B

goal (1 subgoal):
 1. b \<in> p ` B
[PROOF STEP]
using \<open>f' \<in> A \<rightarrow>\<^sub>E B\<close>
[PROOF STATE]
proof (prove)
using this:
b \<in> f ` A
\<forall>x\<in>A. f x = p (f' x)
b \<in> B
f' \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. b \<in> p ` B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b \<in> p ` B

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
b \<in> p ` B

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
B \<subseteq> p ` B

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
p ` B = B

goal (1 subgoal):
 1. inj_on p B
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inj_on p B
[PROOF STEP]
show "inj_on p B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on p B
[PROOF STEP]
proof (rule inj_onI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> B; y \<in> B; p x = p y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix b b'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> B; y \<in> B; p x = p y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume "b \<in> B" "b' \<in> B" "p b = p b'"
[PROOF STATE]
proof (state)
this:
b \<in> B
b' \<in> B
p b = p b'

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> B; y \<in> B; p x = p y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
have "b \<in> f' ` A \<longleftrightarrow> b' \<in> f' ` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b \<in> f' ` A) = (b' \<in> f' ` A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (b \<in> f' ` A) = (b' \<in> f' ` A)
[PROOF STEP]
have "b \<in> f' ` A \<longleftrightarrow> p b \<in> f ` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b \<in> f' ` A) = (p b \<in> f ` A)
[PROOF STEP]
unfolding p_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b \<in> f' ` A) = ((if b \<in> B then if b \<in> f' ` A then the_elem (f ` {x \<in> A. f' x = b}) else p' b else b) \<in> f ` A)
[PROOF STEP]
using \<open>b \<in> B\<close> \<open>p' ` (B - f' ` A) = B - f ` A\<close>
[PROOF STATE]
proof (prove)
using this:
b \<in> B
p' ` (B - f' ` A) = B - f ` A

goal (1 subgoal):
 1. (b \<in> f' ` A) = ((if b \<in> B then if b \<in> f' ` A then the_elem (f ` {x \<in> A. f' x = b}) else p' b else b) \<in> f ` A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(b \<in> f' ` A) = (p b \<in> f ` A)

goal (1 subgoal):
 1. (b \<in> f' ` A) = (b' \<in> f' ` A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b \<in> f' ` A) = (p b \<in> f ` A)

goal (1 subgoal):
 1. (b \<in> f' ` A) = (b' \<in> f' ` A)
[PROOF STEP]
have "p b \<in> f ` A \<longleftrightarrow> p b' \<in> f ` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p b \<in> f ` A) = (p b' \<in> f ` A)
[PROOF STEP]
using \<open>p b = p b'\<close>
[PROOF STATE]
proof (prove)
using this:
p b = p b'

goal (1 subgoal):
 1. (p b \<in> f ` A) = (p b' \<in> f ` A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(p b \<in> f ` A) = (p b' \<in> f ` A)

goal (1 subgoal):
 1. (b \<in> f' ` A) = (b' \<in> f' ` A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(p b \<in> f ` A) = (p b' \<in> f ` A)

goal (1 subgoal):
 1. (b \<in> f' ` A) = (b' \<in> f' ` A)
[PROOF STEP]
have "p b' \<in> f ` A \<longleftrightarrow> b' \<in> f' ` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p b' \<in> f ` A) = (b' \<in> f' ` A)
[PROOF STEP]
unfolding p_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((if b' \<in> B then if b' \<in> f' ` A then the_elem (f ` {x \<in> A. f' x = b'}) else p' b' else b') \<in> f ` A) = (b' \<in> f' ` A)
[PROOF STEP]
using \<open>b' \<in> B\<close> \<open>p' ` (B - f' ` A) = B - f ` A\<close>
[PROOF STATE]
proof (prove)
using this:
b' \<in> B
p' ` (B - f' ` A) = B - f ` A

goal (1 subgoal):
 1. ((if b' \<in> B then if b' \<in> f' ` A then the_elem (f ` {x \<in> A. f' x = b'}) else p' b' else b') \<in> f ` A) = (b' \<in> f' ` A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(p b' \<in> f ` A) = (b' \<in> f' ` A)

goal (1 subgoal):
 1. (b \<in> f' ` A) = (b' \<in> f' ` A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(b \<in> f' ` A) = (b' \<in> f' ` A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(b \<in> f' ` A) = (b' \<in> f' ` A)

goal (1 subgoal):
 1. (b \<in> f' ` A) = (b' \<in> f' ` A)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(b \<in> f' ` A) = (b' \<in> f' ` A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(b \<in> f' ` A) = (b' \<in> f' ` A)

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> B; y \<in> B; p x = p y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
(b \<in> f' ` A) = (b' \<in> f' ` A)
[PROOF STEP]
have "(b \<in> f' ` A \<and> b' \<in> f' ` A) \<or> (b \<notin> f' ` A \<and> b' \<notin> f' ` A)"
[PROOF STATE]
proof (prove)
using this:
(b \<in> f' ` A) = (b' \<in> f' ` A)

goal (1 subgoal):
 1. b \<in> f' ` A \<and> b' \<in> f' ` A \<or> b \<notin> f' ` A \<and> b' \<notin> f' ` A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b \<in> f' ` A \<and> b' \<in> f' ` A \<or> b \<notin> f' ` A \<and> b' \<notin> f' ` A

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> B; y \<in> B; p x = p y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
b \<in> f' ` A \<and> b' \<in> f' ` A \<or> b \<notin> f' ` A \<and> b' \<notin> f' ` A
[PROOF STEP]
show "b = b'"
[PROOF STATE]
proof (prove)
using this:
b \<in> f' ` A \<and> b' \<in> f' ` A \<or> b \<notin> f' ` A \<and> b' \<notin> f' ` A

goal (1 subgoal):
 1. b = b'
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. b \<in> f' ` A \<and> b' \<in> f' ` A \<Longrightarrow> b = b'
 2. b \<notin> f' ` A \<and> b' \<notin> f' ` A \<Longrightarrow> b = b'
[PROOF STEP]
assume "b \<in> f' ` A \<and> b' \<in> f' ` A"
[PROOF STATE]
proof (state)
this:
b \<in> f' ` A \<and> b' \<in> f' ` A

goal (2 subgoals):
 1. b \<in> f' ` A \<and> b' \<in> f' ` A \<Longrightarrow> b = b'
 2. b \<notin> f' ` A \<and> b' \<notin> f' ` A \<Longrightarrow> b = b'
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
b \<in> f' ` A \<and> b' \<in> f' ` A
[PROOF STEP]
obtain a a' where "a \<in> A" "b = f' a" and "a' \<in> A" "b' = f' a'"
[PROOF STATE]
proof (prove)
using this:
b \<in> f' ` A \<and> b' \<in> f' ` A

goal (1 subgoal):
 1. (\<And>a a'. \<lbrakk>a \<in> A; b = f' a; a' \<in> A; b' = f' a'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<in> A
b = f' a
a' \<in> A
b' = f' a'

goal (2 subgoals):
 1. b \<in> f' ` A \<and> b' \<in> f' ` A \<Longrightarrow> b = b'
 2. b \<notin> f' ` A \<and> b' \<notin> f' ` A \<Longrightarrow> b = b'
[PROOF STEP]
from this \<open>b \<in> B\<close> \<open>b' \<in> B\<close>
[PROOF STATE]
proof (chain)
picking this:
a \<in> A
b = f' a
a' \<in> A
b' = f' a'
b \<in> B
b' \<in> B
[PROOF STEP]
have "p b = f a" "p b' = f a'"
[PROOF STATE]
proof (prove)
using this:
a \<in> A
b = f' a
a' \<in> A
b' = f' a'
b \<in> B
b' \<in> B

goal (1 subgoal):
 1. p b = f a &&& p b' = f a'
[PROOF STEP]
unfolding p_def
[PROOF STATE]
proof (prove)
using this:
a \<in> A
b = f' a
a' \<in> A
b' = f' a'
b \<in> B
b' \<in> B

goal (1 subgoal):
 1. (if b \<in> B then if b \<in> f' ` A then the_elem (f ` {x \<in> A. f' x = b}) else p' b else b) = f a &&& (if b' \<in> B then if b' \<in> f' ` A then the_elem (f ` {x \<in> A. f' x = b'}) else p' b' else b') = f a'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p b = f a
p b' = f a'

goal (2 subgoals):
 1. b \<in> f' ` A \<and> b' \<in> f' ` A \<Longrightarrow> b = b'
 2. b \<notin> f' ` A \<and> b' \<notin> f' ` A \<Longrightarrow> b = b'
[PROOF STEP]
from this \<open>p b = p b'\<close>
[PROOF STATE]
proof (chain)
picking this:
p b = f a
p b' = f a'
p b = p b'
[PROOF STEP]
have "f a = f a'"
[PROOF STATE]
proof (prove)
using this:
p b = f a
p b' = f a'
p b = p b'

goal (1 subgoal):
 1. f a = f a'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f a = f a'

goal (2 subgoals):
 1. b \<in> f' ` A \<and> b' \<in> f' ` A \<Longrightarrow> b = b'
 2. b \<notin> f' ` A \<and> b' \<notin> f' ` A \<Longrightarrow> b = b'
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
f a = f a'
[PROOF STEP]
have "f' a = f' a'"
[PROOF STATE]
proof (prove)
using this:
f a = f a'

goal (1 subgoal):
 1. f' a = f' a'
[PROOF STEP]
using partitions_eq_implies[OF \<open>f \<in> A \<rightarrow>\<^sub>E B\<close> \<open>f' \<in> A \<rightarrow>\<^sub>E B\<close> partitions_eq]
[PROOF STATE]
proof (prove)
using this:
f a = f a'
\<lbrakk>?x \<in> A; ?x' \<in> A; f ?x = f ?x'\<rbrakk> \<Longrightarrow> f' ?x = f' ?x'

goal (1 subgoal):
 1. f' a = f' a'
[PROOF STEP]
using \<open>a \<in> A\<close> \<open>a' \<in> A\<close>
[PROOF STATE]
proof (prove)
using this:
f a = f a'
\<lbrakk>?x \<in> A; ?x' \<in> A; f ?x = f ?x'\<rbrakk> \<Longrightarrow> f' ?x = f' ?x'
a \<in> A
a' \<in> A

goal (1 subgoal):
 1. f' a = f' a'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f' a = f' a'

goal (2 subgoals):
 1. b \<in> f' ` A \<and> b' \<in> f' ` A \<Longrightarrow> b = b'
 2. b \<notin> f' ` A \<and> b' \<notin> f' ` A \<Longrightarrow> b = b'
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
f' a = f' a'
[PROOF STEP]
show "b = b'"
[PROOF STATE]
proof (prove)
using this:
f' a = f' a'

goal (1 subgoal):
 1. b = b'
[PROOF STEP]
using \<open>b' = f' a'\<close> \<open>b = f' a\<close>
[PROOF STATE]
proof (prove)
using this:
f' a = f' a'
b' = f' a'
b = f' a

goal (1 subgoal):
 1. b = b'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b = b'

goal (1 subgoal):
 1. b \<notin> f' ` A \<and> b' \<notin> f' ` A \<Longrightarrow> b = b'
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b \<notin> f' ` A \<and> b' \<notin> f' ` A \<Longrightarrow> b = b'
[PROOF STEP]
assume "b \<notin> f' ` A \<and> b' \<notin> f' ` A"
[PROOF STATE]
proof (state)
this:
b \<notin> f' ` A \<and> b' \<notin> f' ` A

goal (1 subgoal):
 1. b \<notin> f' ` A \<and> b' \<notin> f' ` A \<Longrightarrow> b = b'
[PROOF STEP]
from this \<open>b \<in> B\<close> \<open>b' \<in> B\<close>
[PROOF STATE]
proof (chain)
picking this:
b \<notin> f' ` A \<and> b' \<notin> f' ` A
b \<in> B
b' \<in> B
[PROOF STEP]
have "p b' = p' b'" "p b = p' b"
[PROOF STATE]
proof (prove)
using this:
b \<notin> f' ` A \<and> b' \<notin> f' ` A
b \<in> B
b' \<in> B

goal (1 subgoal):
 1. p b' = p' b' &&& p b = p' b
[PROOF STEP]
unfolding p_def
[PROOF STATE]
proof (prove)
using this:
b \<notin> f' ` A \<and> b' \<notin> f' ` A
b \<in> B
b' \<in> B

goal (1 subgoal):
 1. (if b' \<in> B then if b' \<in> f' ` A then the_elem (f ` {x \<in> A. f' x = b'}) else p' b' else b') = p' b' &&& (if b \<in> B then if b \<in> f' ` A then the_elem (f ` {x \<in> A. f' x = b}) else p' b else b) = p' b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p b' = p' b'
p b = p' b

goal (1 subgoal):
 1. b \<notin> f' ` A \<and> b' \<notin> f' ` A \<Longrightarrow> b = b'
[PROOF STEP]
from this \<open>p b = p b'\<close>
[PROOF STATE]
proof (chain)
picking this:
p b' = p' b'
p b = p' b
p b = p b'
[PROOF STEP]
have "p' b = p' b'"
[PROOF STATE]
proof (prove)
using this:
p b' = p' b'
p b = p' b
p b = p b'

goal (1 subgoal):
 1. p' b = p' b'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p' b = p' b'

goal (1 subgoal):
 1. b \<notin> f' ` A \<and> b' \<notin> f' ` A \<Longrightarrow> b = b'
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p' b = p' b'

goal (1 subgoal):
 1. b \<notin> f' ` A \<and> b' \<notin> f' ` A \<Longrightarrow> b = b'
[PROOF STEP]
have "b \<in> B - f' ` A" "b' \<in> B - f' ` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<in> B - f' ` A &&& b' \<in> B - f' ` A
[PROOF STEP]
using \<open>b \<in> B\<close> \<open>b' \<in> B\<close> \<open>b \<notin> f' ` A \<and> b' \<notin> f' ` A\<close>
[PROOF STATE]
proof (prove)
using this:
b \<in> B
b' \<in> B
b \<notin> f' ` A \<and> b' \<notin> f' ` A

goal (1 subgoal):
 1. b \<in> B - f' ` A &&& b' \<in> B - f' ` A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b \<in> B - f' ` A
b' \<in> B - f' ` A

goal (1 subgoal):
 1. b \<notin> f' ` A \<and> b' \<notin> f' ` A \<Longrightarrow> b = b'
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p' b = p' b'
b \<in> B - f' ` A
b' \<in> B - f' ` A
[PROOF STEP]
show "b = b'"
[PROOF STATE]
proof (prove)
using this:
p' b = p' b'
b \<in> B - f' ` A
b' \<in> B - f' ` A

goal (1 subgoal):
 1. b = b'
[PROOF STEP]
using \<open>bij_betw p' _ _\<close>
[PROOF STATE]
proof (prove)
using this:
p' b = p' b'
b \<in> B - f' ` A
b' \<in> B - f' ` A
bij_betw p' (B - f' ` A) (B - f ` A)

goal (1 subgoal):
 1. b = b'
[PROOF STEP]
by (metis bij_betw_inv_into_left)
[PROOF STATE]
proof (state)
this:
b = b'

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
b = b'

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inj_on p B

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
bij_betw p B B

goal (1 subgoal):
 1. \<And>x. x \<notin> B \<Longrightarrow> p x = x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<notin> B \<Longrightarrow> p x = x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<notin> B \<Longrightarrow> p x = x
[PROOF STEP]
assume "x \<notin> B"
[PROOF STATE]
proof (state)
this:
x \<notin> B

goal (1 subgoal):
 1. \<And>x. x \<notin> B \<Longrightarrow> p x = x
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
x \<notin> B
[PROOF STEP]
show "p x = x"
[PROOF STATE]
proof (prove)
using this:
x \<notin> B

goal (1 subgoal):
 1. p x = x
[PROOF STEP]
using \<open>f' \<in> A \<rightarrow>\<^sub>E B\<close> p_def
[PROOF STATE]
proof (prove)
using this:
x \<notin> B
f' \<in> A \<rightarrow>\<^sub>E B
p ?b = (if ?b \<in> B then if ?b \<in> f' ` A then the_elem (f ` {x \<in> A. f' x = ?b}) else p' ?b else ?b)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
p permutes B

goal (1 subgoal):
 1. \<exists>p. p permutes B \<and> (\<forall>x\<in>A. f x = p (f' x))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>A. f x = p (f' x)
p permutes B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>A. f x = p (f' x)
p permutes B

goal (1 subgoal):
 1. \<exists>p. p permutes B \<and> (\<forall>x\<in>A. f x = p (f' x))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>p. p permutes B \<and> (\<forall>x\<in>A. f x = p (f' x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eval_empty_close: "eval (close Q) I = {} \<longleftrightarrow> (\<forall>\<sigma>. \<not> sat Q I \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (eval (close Q) I = {}) = (\<forall>\<sigma>. \<not> sat Q I \<sigma>)
[PROOF STEP]
by (subst eval_empty_alt)
    (auto simp: sat_EXISTS fun_upds_map_self dest: spec2[of _ \<sigma> "map \<sigma>(sorted_list_of_set (fv Q))" for \<sigma>])


[STATEMENT]
lemma eq_0_on_span:
  assumes f0: "\<And>x. x \<in> b \<Longrightarrow> f x = 0" and x: "x \<in> m1.span b" shows "f x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x = (0::'c)
[PROOF STEP]
using m1.span_induct[OF x subspace_kernel] f0
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> b \<Longrightarrow> f x = (0::'c)) \<Longrightarrow> f x = (0::'c)
?x \<in> b \<Longrightarrow> f ?x = (0::'c)

goal (1 subgoal):
 1. f x = (0::'c)
[PROOF STEP]
by simp


[STATEMENT]
lemma irreducibleD:
  fixes G (structure)
  assumes irr: "irreducible G a"
    and pf: "properfactor G b a"
    and bcarr: "b \<in> carrier G"
  shows "b \<in> Units G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<in> Units G
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
irreducible G a
properfactor G b a
b \<in> carrier G

goal (1 subgoal):
 1. b \<in> Units G
[PROOF STEP]
by (fast elim: irreducibleE)


[STATEMENT]
lemma inner_prod_with_itself_real [simp]:
  "\<langle>u|u\<rangle> \<in> \<real>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>u|u\<rangle> \<in> \<real>
[PROOF STEP]
using inner_prod_with_itself_Im
[PROOF STATE]
proof (prove)
using this:
Im \<langle>?u|?u\<rangle> = 0

goal (1 subgoal):
 1. \<langle>u|u\<rangle> \<in> \<real>
[PROOF STEP]
by (simp add: complex_is_Real_iff)


[STATEMENT]
lemma l11_22:
  assumes "((B P TS A C \<and> B' P' TS A' C')\<or>(B P OS A C \<and> B' P' OS A' C'))" and
    "A B P CongA A' B' P'" and
    "P B C CongA P' B' C'"
  shows "A B C CongA A' B' C'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A B C CongA A' B' C'
[PROOF STEP]
by (meson assms(1) assms(2) assms(3) l11_22a l11_22b)


[STATEMENT]
lemma point_mult_add:
  "a \<in> carrier R \<Longrightarrow> b \<in> carrier R \<Longrightarrow> on_curve a b p \<Longrightarrow> nonsingular a b \<Longrightarrow>
   point_mult a (m + n) p = add a (point_mult a m p) (point_mult a n p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R; b \<in> carrier R; on_curve a b p; nonsingular a b\<rbrakk> \<Longrightarrow> point_mult a (m + n) p = local.add a (point_mult a m p) (point_mult a n p)
[PROOF STEP]
by (induct m) (simp_all add: add_assoc point_mult_closed add_0_l)


[STATEMENT]
lemma Z_I_hermitian:
  shows "hermitian Z_I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hermitian Z_I
[PROOF STEP]
unfolding Z_I_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hermitian (Z \<Otimes> 1\<^sub>m 2)
[PROOF STEP]
using tensor_mat_hermitian[of Z 2 "1\<^sub>m 2" 2]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Z \<in> carrier_mat 2 2; 1\<^sub>m 2 \<in> carrier_mat 2 2; 0 < 2; 0 < 2; hermitian Z; hermitian (1\<^sub>m 2)\<rbrakk> \<Longrightarrow> hermitian (Z \<Otimes> 1\<^sub>m 2)

goal (1 subgoal):
 1. hermitian (Z \<Otimes> 1\<^sub>m 2)
[PROOF STEP]
by (simp add: Z_carrier Z_hermitian hermitian_one)


[STATEMENT]
lemma shows f_nonneg: "0 \<le> f x y n" and f_le_1: "f x y n \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> f x y n &&& f x y n \<le> 1
[PROOF STEP]
by (simp_all add: f_def)


[STATEMENT]
lemma (in Order) conditional_min_upper_bound:" \<lbrakk>C \<in> carrier (fTo D);
      Chain (Iod (fTo D) {S \<in> carrier fTo D. C \<subseteq> S}) Ca\<rbrakk> \<Longrightarrow>
      \<exists>X. minimum_elem (Iod (fTo D) {S \<in> carrier (fTo D). C \<subseteq> S})
         (upper_bounds (Iod (fTo D) {S \<in> carrier (fTo D). C \<subseteq> S}) Ca) X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>C \<in> carrier fTo D; Chain (Iod fTo D {S \<in> carrier fTo D. C \<subseteq> S}) Ca\<rbrakk> \<Longrightarrow> \<exists>X. minimum_elem (Iod fTo D {S \<in> carrier fTo D. C \<subseteq> S}) (upper_bounds (Iod fTo D {S \<in> carrier fTo D. C \<subseteq> S}) Ca) X
[PROOF STEP]
apply (case_tac "Ca = {}",
        frule fTo_conditional_min2[of "C"], assumption+, blast,
        frule fTo_conditional_min1[of "C"], assumption+, blast)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in deutsch) deutsch_transform_coeff_is_zero [simp]:
  shows "U\<^sub>f $$ (0,2) = 0" and "U\<^sub>f $$ (0,3) = 0"
    and "U\<^sub>f $$ (1,2) = 0" and "U\<^sub>f $$(1,3) = 0"
    and "U\<^sub>f $$ (2,0) = 0" and "U\<^sub>f $$(2,1) = 0"
    and "U\<^sub>f $$ (3,0) = 0" and "U\<^sub>f $$ (3,1) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((U\<^sub>f $$ (0, 2) = 0 &&& U\<^sub>f $$ (0, 3) = 0) &&& U\<^sub>f $$ (1, 2) = 0 &&& U\<^sub>f $$ (1, 3) = 0) &&& (U\<^sub>f $$ (2, 0) = 0 &&& U\<^sub>f $$ (2, 1) = 0) &&& U\<^sub>f $$ (3, 0) = 0 &&& U\<^sub>f $$ (3, 1) = 0
[PROOF STEP]
using deutsch_transform_def
[PROOF STATE]
proof (prove)
using this:
U\<^sub>f \<equiv> Tensor.mat_of_cols_list 4 (map (map of_nat) [[1 - f 0, f 0, 0, 0], [f 0, 1 - f 0, 0, 0], [0, 0, 1 - f 1, f 1], [0, 0, f 1, 1 - f 1]])

goal (1 subgoal):
 1. ((U\<^sub>f $$ (0, 2) = 0 &&& U\<^sub>f $$ (0, 3) = 0) &&& U\<^sub>f $$ (1, 2) = 0 &&& U\<^sub>f $$ (1, 3) = 0) &&& (U\<^sub>f $$ (2, 0) = 0 &&& U\<^sub>f $$ (2, 1) = 0) &&& U\<^sub>f $$ (3, 0) = 0 &&& U\<^sub>f $$ (3, 1) = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma lsc_at_open_mem:
  fixes f :: "'a::first_countable_topology \<Rightarrow> 'b::{complete_linorder, linorder_topology}"
  assumes "lsc_at x0 f"
  assumes "open S \<and> f x0 : S"
  obtains T where "open T \<and> x0 \<in> T \<and> (\<forall>x'\<in>T. (f x' \<le> f x0 \<longrightarrow> f x' \<in> S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>T. open T \<and> x0 \<in> T \<and> (\<forall>x'\<in>T. f x' \<le> f x0 \<longrightarrow> f x' \<in> S) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms lsc_at_open[of x0 f]
[PROOF STATE]
proof (prove)
using this:
lsc_at x0 f
open S \<and> f x0 \<in> S
lsc_at x0 f = (\<forall>S. open S \<and> f x0 \<in> S \<longrightarrow> (\<exists>T. open T \<and> x0 \<in> T \<and> (\<forall>x'\<in>T. f x' \<le> f x0 \<longrightarrow> f x' \<in> S)))

goal (1 subgoal):
 1. (\<And>T. open T \<and> x0 \<in> T \<and> (\<forall>x'\<in>T. f x' \<le> f x0 \<longrightarrow> f x' \<in> S) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast


[STATEMENT]
lemma H_fcs_in_G_fcs:
    assumes "b \<in> arcs H - (G.face_cycle_set a \<union> G.face_cycle_set a')"
    shows "H.face_cycle_set b \<in> G.face_cycle_sets - {G.face_cycle_set a, G.face_cycle_set a'}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H.face_cycle_set b \<in> G.face_cycle_sets - {G.face_cycle_set a, G.face_cycle_set a'}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. H.face_cycle_set b \<in> G.face_cycle_sets - {G.face_cycle_set a, G.face_cycle_set a'}
[PROOF STEP]
have "H.face_cycle_set b = G.face_cycle_set b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H.face_cycle_set b = G.face_cycle_set b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
b \<in> arcs H - (G.face_cycle_set a \<union> G.face_cycle_set a')

goal (1 subgoal):
 1. H.face_cycle_set b = G.face_cycle_set b
[PROOF STEP]
by (intro face_cycle_set_other_da) (auto simp: arcs_H G.face_cycle_eq)
[PROOF STATE]
proof (state)
this:
H.face_cycle_set b = G.face_cycle_set b

goal (1 subgoal):
 1. H.face_cycle_set b \<in> G.face_cycle_sets - {G.face_cycle_set a, G.face_cycle_set a'}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
H.face_cycle_set b = G.face_cycle_set b

goal (1 subgoal):
 1. H.face_cycle_set b \<in> G.face_cycle_sets - {G.face_cycle_set a, G.face_cycle_set a'}
[PROOF STEP]
have "G.face_cycle_set b \<notin> {G.face_cycle_set a, G.face_cycle_set a'}" "b \<in> arcs G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G.face_cycle_set b \<notin> {G.face_cycle_set a, G.face_cycle_set a'} &&& b \<in> arcs G
[PROOF STEP]
using G.face_cycle_eq assms
[PROOF STATE]
proof (prove)
using this:
?b \<in> G.face_cycle_set ?a \<Longrightarrow> G.face_cycle_set ?b = G.face_cycle_set ?a
b \<in> arcs H - (G.face_cycle_set a \<union> G.face_cycle_set a')

goal (1 subgoal):
 1. G.face_cycle_set b \<notin> {G.face_cycle_set a, G.face_cycle_set a'} &&& b \<in> arcs G
[PROOF STEP]
by (auto simp: arcs_H)
[PROOF STATE]
proof (state)
this:
G.face_cycle_set b \<notin> {G.face_cycle_set a, G.face_cycle_set a'}
b \<in> arcs G

goal (1 subgoal):
 1. H.face_cycle_set b \<in> G.face_cycle_sets - {G.face_cycle_set a, G.face_cycle_set a'}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
H.face_cycle_set b = G.face_cycle_set b
G.face_cycle_set b \<notin> {G.face_cycle_set a, G.face_cycle_set a'}
b \<in> arcs G
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
H.face_cycle_set b = G.face_cycle_set b
G.face_cycle_set b \<notin> {G.face_cycle_set a, G.face_cycle_set a'}
b \<in> arcs G

goal (1 subgoal):
 1. H.face_cycle_set b \<in> G.face_cycle_sets - {G.face_cycle_set a, G.face_cycle_set a'}
[PROOF STEP]
by (auto simp: G.face_cycle_sets_def)
[PROOF STATE]
proof (state)
this:
H.face_cycle_set b \<in> G.face_cycle_sets - {G.face_cycle_set a, G.face_cycle_set a'}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma AL_Size_Suc: "\<forall> n . |L| = Suc n \<longrightarrow> (\<exists> a b . L\<down>a = Some b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. |L| = Suc n \<longrightarrow> (\<exists>a b. L\<down>a = Some b)
[PROOF STEP]
apply (induct L)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>n. |[]| = Suc n \<longrightarrow> (\<exists>a b. []\<down>a = Some b)
 2. \<And>a L. \<forall>n. |L| = Suc n \<longrightarrow> (\<exists>a b. L\<down>a = Some b) \<Longrightarrow> \<forall>n. |(a # L)| = Suc n \<longrightarrow> (\<exists>aa b. (a # L)\<down>aa = Some b)
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a L. \<forall>n. |L| = Suc n \<longrightarrow> (\<exists>a b. L\<down>a = Some b) \<Longrightarrow> \<forall>n. |(a # L)| = Suc n \<longrightarrow> (\<exists>aa b. (a # L)\<down>aa = Some b)
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a L. (\<exists>n. |L| = Suc n) \<longrightarrow> (\<exists>a b. L\<down>a = Some b) \<Longrightarrow> \<exists>aa. a \<noteq> aa \<longrightarrow> (\<exists>b. L\<down>aa = Some b)
[PROOF STEP]
apply (rule_tac x=a in exI, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma measurement_lowner_le_one1:
  assumes dim0: "M0 \<in> carrier_mat d d" and dim1: "M1 \<in> carrier_mat d d" and id: "adjoint M0 * M0 + adjoint M1 * M1 = 1\<^sub>m d"
  shows "adjoint M1 * M1 \<le>\<^sub>L 1\<^sub>m d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint M1 * M1 \<le>\<^sub>L 1\<^sub>m d
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. adjoint M1 * M1 \<le>\<^sub>L 1\<^sub>m d
[PROOF STEP]
have paM0: "positive (adjoint M0 * M0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. positive (adjoint M0 * M0)
[PROOF STEP]
apply (subgoal_tac "adjoint M0 * adjoint (adjoint M0) = adjoint M0 * M0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. adjoint M0 * adjoint (adjoint M0) = adjoint M0 * M0 \<Longrightarrow> positive (adjoint M0 * M0)
 2. adjoint M0 * adjoint (adjoint M0) = adjoint M0 * M0
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint M0 * adjoint (adjoint M0) = adjoint M0 * M0 \<Longrightarrow> positive (adjoint M0 * M0)
[PROOF STEP]
using positive_if_decomp[of "adjoint M0 * M0"] dim0 adjoint_dim[OF dim0]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>adjoint M0 * M0 \<in> carrier_mat ?n ?n; \<exists>M. M * adjoint M = adjoint M0 * M0\<rbrakk> \<Longrightarrow> positive (adjoint M0 * M0)
M0 \<in> carrier_mat d d
adjoint M0 \<in> carrier_mat d d

goal (1 subgoal):
 1. adjoint M0 * adjoint (adjoint M0) = adjoint M0 * M0 \<Longrightarrow> positive (adjoint M0 * M0)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint M0 * adjoint (adjoint M0) = adjoint M0 * M0
[PROOF STEP]
using adjoint_adjoint[of M0]
[PROOF STATE]
proof (prove)
using this:
adjoint (adjoint M0) = M0

goal (1 subgoal):
 1. adjoint M0 * adjoint (adjoint M0) = adjoint M0 * M0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
positive (adjoint M0 * M0)

goal (1 subgoal):
 1. adjoint M1 * M1 \<le>\<^sub>L 1\<^sub>m d
[PROOF STEP]
have le1: "adjoint M0 * M0 + adjoint M1 * M1 \<le>\<^sub>L 1\<^sub>m d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint M0 * M0 + adjoint M1 * M1 \<le>\<^sub>L 1\<^sub>m d
[PROOF STEP]
using id lowner_le_refl[of "1\<^sub>m d"]
[PROOF STATE]
proof (prove)
using this:
adjoint M0 * M0 + adjoint M1 * M1 = 1\<^sub>m d
1\<^sub>m d \<in> carrier_mat ?n ?n \<Longrightarrow> 1\<^sub>m d \<le>\<^sub>L 1\<^sub>m d

goal (1 subgoal):
 1. adjoint M0 * M0 + adjoint M1 * M1 \<le>\<^sub>L 1\<^sub>m d
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
adjoint M0 * M0 + adjoint M1 * M1 \<le>\<^sub>L 1\<^sub>m d

goal (1 subgoal):
 1. adjoint M1 * M1 \<le>\<^sub>L 1\<^sub>m d
[PROOF STEP]
show "adjoint M1 * M1 \<le>\<^sub>L 1\<^sub>m d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint M1 * M1 \<le>\<^sub>L 1\<^sub>m d
[PROOF STEP]
using add_positive_le_reduce2[OF _ _ _ paM0 le1] dim0 dim1
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>adjoint M1 * M1 \<in> carrier_mat ?n ?n; adjoint M0 * M0 \<in> carrier_mat ?n ?n; 1\<^sub>m d \<in> carrier_mat ?n ?n\<rbrakk> \<Longrightarrow> adjoint M1 * M1 \<le>\<^sub>L 1\<^sub>m d
M0 \<in> carrier_mat d d
M1 \<in> carrier_mat d d

goal (1 subgoal):
 1. adjoint M1 * M1 \<le>\<^sub>L 1\<^sub>m d
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
adjoint M1 * M1 \<le>\<^sub>L 1\<^sub>m d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Hom_DopxG_map_simp:
    assumes "DopxC.arr gf"
    shows "Hom_DopxG.map gf =
              S.mkArr (HomD.set (D.cod (fst gf), G (C.dom (snd gf))))
                      (HomD.set (D.dom (fst gf), G (C.cod (snd gf))))
                      (\<phi>D (D.dom (fst gf), G (C.cod (snd gf)))
                           o (\<lambda>h. G (snd gf) \<cdot>\<^sub>D h \<cdot>\<^sub>D fst gf)
                           o HomD.\<psi> (D.cod (fst gf), G (C.dom (snd gf))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hom_DopxG.map gf = S.mkArr (HomD.set (D.cod (fst gf), G (C.dom (snd gf)))) (HomD.set (D.dom (fst gf), G (C.cod (snd gf)))) (\<phi>D (D.dom (fst gf), G (C.cod (snd gf))) \<circ> (\<lambda>h. G (snd gf) \<cdot>\<^sub>D h \<cdot>\<^sub>D fst gf) \<circ> \<psi>D (D.cod (fst gf), G (C.dom (snd gf))))
[PROOF STEP]
using assms HomD.map_def
[PROOF STATE]
proof (prove)
using this:
DopxC.arr gf
HomD.map ?gf = (if DopxD.arr ?gf then S.mkArr (HomD.set (DopxD.dom ?gf)) (HomD.set (DopxD.cod ?gf)) (\<phi>D (DopxD.cod ?gf) \<circ> (\<lambda>h. snd ?gf \<cdot>\<^sub>D h \<cdot>\<^sub>D fst ?gf) \<circ> \<psi>D (DopxD.dom ?gf)) else S.null)

goal (1 subgoal):
 1. Hom_DopxG.map gf = S.mkArr (HomD.set (D.cod (fst gf), G (C.dom (snd gf)))) (HomD.set (D.dom (fst gf), G (C.cod (snd gf)))) (\<phi>D (D.dom (fst gf), G (C.cod (snd gf))) \<circ> (\<lambda>h. G (snd gf) \<cdot>\<^sub>D h \<cdot>\<^sub>D fst gf) \<circ> \<psi>D (D.cod (fst gf), G (C.dom (snd gf))))
[PROOF STEP]
by simp


[STATEMENT]
lemma therm_dyn_down_real_arith:
  assumes "a > 0" and Thyps: "0 < Tmin" "Tmin \<le> T" "T \<le> Tmax"
    and thyps: "0 \<le> (\<tau>::real)" "\<forall>\<tau>\<in>{0..\<tau>}. \<tau> \<le> - (ln (Tmin / T) / a) "
  shows "Tmin \<le> exp (-a * \<tau>) * T" and "exp (-a * \<tau>) * T \<le> Tmax"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Tmin \<le> exp (- a \<cdot> \<tau>) \<cdot> T &&& exp (- a \<cdot> \<tau>) \<cdot> T \<le> Tmax
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Tmin \<le> exp (- a \<cdot> \<tau>) \<cdot> T
 2. exp (- a \<cdot> \<tau>) \<cdot> T \<le> Tmax
[PROOF STEP]
have "0 \<le> \<tau> \<and> \<tau> \<le> - (ln (Tmin / T) / a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> \<tau> \<and> \<tau> \<le> - (ln (Tmin / T) / a)
[PROOF STEP]
using thyps
[PROOF STATE]
proof (prove)
using this:
0 \<le> \<tau>
\<forall>\<tau>\<in>{0..\<tau>}. \<tau> \<le> - (ln (Tmin / T) / a)

goal (1 subgoal):
 1. 0 \<le> \<tau> \<and> \<tau> \<le> - (ln (Tmin / T) / a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> \<tau> \<and> \<tau> \<le> - (ln (Tmin / T) / a)

goal (2 subgoals):
 1. Tmin \<le> exp (- a \<cdot> \<tau>) \<cdot> T
 2. exp (- a \<cdot> \<tau>) \<cdot> T \<le> Tmax
[PROOF STEP]
hence "ln (Tmin / T) \<le> - a * \<tau> \<and> - a * \<tau> \<le> 0"
[PROOF STATE]
proof (prove)
using this:
0 \<le> \<tau> \<and> \<tau> \<le> - (ln (Tmin / T) / a)

goal (1 subgoal):
 1. ln (Tmin / T) \<le> - a \<cdot> \<tau> \<and> - a \<cdot> \<tau> \<le> 0
[PROOF STEP]
using assms(1) divide_le_cancel
[PROOF STATE]
proof (prove)
using this:
0 \<le> \<tau> \<and> \<tau> \<le> - (ln (Tmin / T) / a)
0 < a
(?a / ?c \<le> ?b / ?c) = (((0::?'a) < ?c \<longrightarrow> ?a \<le> ?b) \<and> (?c < (0::?'a) \<longrightarrow> ?b \<le> ?a))

goal (1 subgoal):
 1. ln (Tmin / T) \<le> - a \<cdot> \<tau> \<and> - a \<cdot> \<tau> \<le> 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
ln (Tmin / T) \<le> - a \<cdot> \<tau> \<and> - a \<cdot> \<tau> \<le> 0

goal (2 subgoals):
 1. Tmin \<le> exp (- a \<cdot> \<tau>) \<cdot> T
 2. exp (- a \<cdot> \<tau>) \<cdot> T \<le> Tmax
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ln (Tmin / T) \<le> - a \<cdot> \<tau> \<and> - a \<cdot> \<tau> \<le> 0

goal (2 subgoals):
 1. Tmin \<le> exp (- a \<cdot> \<tau>) \<cdot> T
 2. exp (- a \<cdot> \<tau>) \<cdot> T \<le> Tmax
[PROOF STEP]
have "Tmin / T > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Tmin / T
[PROOF STEP]
using Thyps
[PROOF STATE]
proof (prove)
using this:
0 < Tmin
Tmin \<le> T
T \<le> Tmax

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

goal (2 subgoals):
 1. Tmin \<le> exp (- a \<cdot> \<tau>) \<cdot> T
 2. exp (- a \<cdot> \<tau>) \<cdot> T \<le> Tmax
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
ln (Tmin / T) \<le> - a \<cdot> \<tau> \<and> - a \<cdot> \<tau> \<le> 0
0 < Tmin / T
[PROOF STEP]
have obs: "Tmin / T \<le> exp (-a * \<tau>)" "exp (-a * \<tau>) \<le> 1"
[PROOF STATE]
proof (prove)
using this:
ln (Tmin / T) \<le> - a \<cdot> \<tau> \<and> - a \<cdot> \<tau> \<le> 0
0 < Tmin / T

goal (1 subgoal):
 1. Tmin / T \<le> exp (- a \<cdot> \<tau>) &&& exp (- a \<cdot> \<tau>) \<le> 1
[PROOF STEP]
using exp_ln exp_le_one_iff
[PROOF STATE]
proof (prove)
using this:
ln (Tmin / T) \<le> - a \<cdot> \<tau> \<and> - a \<cdot> \<tau> \<le> 0
0 < Tmin / T
0 < ?x \<Longrightarrow> exp (ln ?x) = ?x
(exp ?x \<le> 1) = (?x \<le> 0)

goal (1 subgoal):
 1. Tmin / T \<le> exp (- a \<cdot> \<tau>) &&& exp (- a \<cdot> \<tau>) \<le> 1
[PROOF STEP]
by (metis exp_less_cancel_iff not_less, simp)
[PROOF STATE]
proof (state)
this:
Tmin / T \<le> exp (- a \<cdot> \<tau>)
exp (- a \<cdot> \<tau>) \<le> 1

goal (2 subgoals):
 1. Tmin \<le> exp (- a \<cdot> \<tau>) \<cdot> T
 2. exp (- a \<cdot> \<tau>) \<cdot> T \<le> Tmax
[PROOF STEP]
thus "Tmin \<le> exp (-a * \<tau>) * T"
[PROOF STATE]
proof (prove)
using this:
Tmin / T \<le> exp (- a \<cdot> \<tau>)
exp (- a \<cdot> \<tau>) \<le> 1

goal (1 subgoal):
 1. Tmin \<le> exp (- a \<cdot> \<tau>) \<cdot> T
[PROOF STEP]
using Thyps
[PROOF STATE]
proof (prove)
using this:
Tmin / T \<le> exp (- a \<cdot> \<tau>)
exp (- a \<cdot> \<tau>) \<le> 1
0 < Tmin
Tmin \<le> T
T \<le> Tmax

goal (1 subgoal):
 1. Tmin \<le> exp (- a \<cdot> \<tau>) \<cdot> T
[PROOF STEP]
by (simp add: pos_divide_le_eq)
[PROOF STATE]
proof (state)
this:
Tmin \<le> exp (- a \<cdot> \<tau>) \<cdot> T

goal (1 subgoal):
 1. exp (- a \<cdot> \<tau>) \<cdot> T \<le> Tmax
[PROOF STEP]
show "exp (-a * \<tau>) * T \<le> Tmax"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (- a \<cdot> \<tau>) \<cdot> T \<le> Tmax
[PROOF STEP]
using Thyps mult_left_le_one_le[OF _ exp_ge_zero obs(2), of T]
      less_eq_real_def order_trans_rules(23)
[PROOF STATE]
proof (prove)
using this:
0 < Tmin
Tmin \<le> T
T \<le> Tmax
0 \<le> T \<Longrightarrow> exp (- a \<cdot> \<tau>) \<cdot> T \<le> T
(?x \<le> ?y) = (?x < ?y \<or> ?x = ?y)
\<lbrakk>?x \<le> ?y; ?y \<le> ?z\<rbrakk> \<Longrightarrow> ?x \<le> ?z

goal (1 subgoal):
 1. exp (- a \<cdot> \<tau>) \<cdot> T \<le> Tmax
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
exp (- a \<cdot> \<tau>) \<cdot> T \<le> Tmax

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma piecewise_differentiable_neg:
    "f piecewise_differentiable_on S \<Longrightarrow> (\<lambda>x. -(f x)) piecewise_differentiable_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f piecewise_differentiable_on S \<Longrightarrow> (\<lambda>x. - f x) piecewise_differentiable_on S
[PROOF STEP]
by (auto simp: piecewise_differentiable_on_def continuous_on_minus)


[STATEMENT]
lemma linear_strict_order_conv_closed:
  "linear_strict_order x \<Longrightarrow> linear_strict_order (x\<^sup>T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear_strict_order x \<Longrightarrow> linear_strict_order (x\<^sup>T)
[PROOF STEP]
by (simp add: irreflexive_conv_closed sup_monoid.add_commute transitive_conv_closed)


[STATEMENT]
lemma set_fst_sunion_with:
  "set (map fst (sunion_with f xs ys)) = set (map fst xs) \<union> set (map fst ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map fst (sunion_with f xs ys)) = set (map fst xs) \<union> set (map fst ys)
[PROOF STEP]
by(induct f xs ys rule: sunion_with.induct) auto


[STATEMENT]
lemma sum_uniformity:
  assumes plus_cont: \<open>uniformly_continuous_on UNIV (\<lambda>(x::'b::{uniform_space,comm_monoid_add},y). x+y)\<close>
  assumes \<open>eventually E uniformity\<close>
  obtains D where \<open>eventually D uniformity\<close>
    and \<open>\<And>M::'a set. \<And>f f' :: 'a \<Rightarrow> 'b. card M \<le> n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<Longrightarrow> E (sum f M, sum f' M)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>D. \<lbrakk>eventually D uniformity; \<And>M f f'. card M \<le> n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<Longrightarrow> E (sum f M, sum f' M)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof (atomize_elim, insert \<open>eventually E uniformity\<close>, induction n arbitrary: E rule:nat_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>E. eventually E uniformity \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> 0 \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M))
 2. \<And>n E. \<lbrakk>\<And>E. eventually E uniformity \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M)); eventually E uniformity\<rbrakk> \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> Suc n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
eventually E uniformity

goal (2 subgoals):
 1. \<And>E. eventually E uniformity \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> 0 \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M))
 2. \<And>n E. \<lbrakk>\<And>E. eventually E uniformity \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M)); eventually E uniformity\<rbrakk> \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> Suc n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eventually E uniformity
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
eventually E uniformity

goal (1 subgoal):
 1. \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> 0 \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M))
[PROOF STEP]
by (metis card_eq_0_iff equals0D le_zero_eq sum.infinite sum.not_neutral_contains_not_neutral uniformity_refl)
[PROOF STATE]
proof (state)
this:
\<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> 0 \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M))

goal (1 subgoal):
 1. \<And>n E. \<lbrakk>\<And>E. eventually E uniformity \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M)); eventually E uniformity\<rbrakk> \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> Suc n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n E. \<lbrakk>\<And>E. eventually E uniformity \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M)); eventually E uniformity\<rbrakk> \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> Suc n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M))
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
eventually ?E uniformity \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> ?E (sum f M, sum f' M))
eventually E uniformity

goal (1 subgoal):
 1. \<And>n E. \<lbrakk>\<And>E. eventually E uniformity \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M)); eventually E uniformity\<rbrakk> \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> Suc n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M))
[PROOF STEP]
from plus_cont[unfolded uniformly_continuous_on_uniformity filterlim_def le_filter_def, rule_format, OF Suc.prems]
[PROOF STATE]
proof (chain)
picking this:
eventually E (filtermap (\<lambda>(x, y). (case x of (x, xa) \<Rightarrow> x + xa, case y of (x, xa) \<Rightarrow> x + xa)) (uniformity_on UNIV))
[PROOF STEP]
obtain D1 D2 where \<open>eventually D1 uniformity\<close> and \<open>eventually D2 uniformity\<close>
    and D1D2E: \<open>D1 (x, y) \<Longrightarrow> D2 (x', y') \<Longrightarrow> E (x + x', y + y')\<close> for x y x' y'
[PROOF STATE]
proof (prove)
using this:
eventually E (filtermap (\<lambda>(x, y). (case x of (x, xa) \<Rightarrow> x + xa, case y of (x, xa) \<Rightarrow> x + xa)) (uniformity_on UNIV))

goal (1 subgoal):
 1. (\<And>D1 D2. \<lbrakk>eventually D1 uniformity; eventually D2 uniformity; \<And>x y x' y'. \<lbrakk>D1 (x, y); D2 (x', y')\<rbrakk> \<Longrightarrow> E (x + x', y + y')\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
apply atomize_elim
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually E (filtermap (\<lambda>a. case a of (x, y) \<Rightarrow> (case x of (a, b) \<Rightarrow> a + b, case y of (a, b) \<Rightarrow> a + b)) (uniformity_on UNIV)) \<Longrightarrow> \<exists>D1 D2. eventually D1 uniformity \<and> eventually D2 uniformity \<and> (\<forall>x y x' y'. D1 (x, y) \<longrightarrow> D2 (x', y') \<longrightarrow> E (x + x', y + y'))
[PROOF STEP]
by (auto simp: eventually_prod_filter case_prod_beta uniformity_prod_def eventually_filtermap)
[PROOF STATE]
proof (state)
this:
eventually D1 uniformity
eventually D2 uniformity
\<lbrakk>D1 (?x, ?y); D2 (?x', ?y')\<rbrakk> \<Longrightarrow> E (?x + ?x', ?y + ?y')

goal (1 subgoal):
 1. \<And>n E. \<lbrakk>\<And>E. eventually E uniformity \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M)); eventually E uniformity\<rbrakk> \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> Suc n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M))
[PROOF STEP]
from Suc.IH[OF \<open>eventually D2 uniformity\<close>]
[PROOF STATE]
proof (chain)
picking this:
\<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> D2 (sum f M, sum f' M))
[PROOF STEP]
obtain D3 where \<open>eventually D3 uniformity\<close> and D3: \<open>card M \<le> n \<Longrightarrow> (\<forall>m\<in>M. D3 (f m, f' m)) \<Longrightarrow> D2 (sum f M, sum f' M)\<close>
    for M :: \<open>'a set\<close> and f f'
[PROOF STATE]
proof (prove)
using this:
\<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> D2 (sum f M, sum f' M))

goal (1 subgoal):
 1. (\<And>D3. \<lbrakk>eventually D3 uniformity; \<And>M f f'. \<lbrakk>card M \<le> n; \<forall>m\<in>M. D3 (f m, f' m)\<rbrakk> \<Longrightarrow> D2 (sum f M, sum f' M)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
eventually D3 uniformity
\<lbrakk>card ?M \<le> n; \<forall>m\<in>?M. D3 (?f m, ?f' m)\<rbrakk> \<Longrightarrow> D2 (sum ?f ?M, sum ?f' ?M)

goal (1 subgoal):
 1. \<And>n E. \<lbrakk>\<And>E. eventually E uniformity \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M)); eventually E uniformity\<rbrakk> \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> Suc n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M))
[PROOF STEP]
define D where \<open>D x \<equiv> D1 x \<and> D3 x\<close> for x
[PROOF STATE]
proof (state)
this:
D ?x \<equiv> D1 ?x \<and> D3 ?x

goal (1 subgoal):
 1. \<And>n E. \<lbrakk>\<And>E. eventually E uniformity \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M)); eventually E uniformity\<rbrakk> \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> Suc n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M))
[PROOF STEP]
have \<open>eventually D uniformity\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually D uniformity
[PROOF STEP]
using D_def \<open>eventually D1 uniformity\<close> \<open>eventually D3 uniformity\<close> eventually_elim2
[PROOF STATE]
proof (prove)
using this:
D ?x \<equiv> D1 ?x \<and> D3 ?x
eventually D1 uniformity
eventually D3 uniformity
\<lbrakk>eventually ?P ?F; eventually ?Q ?F; \<And>i. \<lbrakk>?P i; ?Q i\<rbrakk> \<Longrightarrow> ?R i\<rbrakk> \<Longrightarrow> eventually ?R ?F

goal (1 subgoal):
 1. eventually D uniformity
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
eventually D uniformity

goal (1 subgoal):
 1. \<And>n E. \<lbrakk>\<And>E. eventually E uniformity \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M)); eventually E uniformity\<rbrakk> \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> Suc n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M))
[PROOF STEP]
have \<open>E (sum f M, sum f' M)\<close>
    if \<open>card M \<le> Suc n\<close> and DM: \<open>\<forall>m\<in>M. D (f m, f' m)\<close>
    for M :: \<open>'a set\<close> and f f'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. E (sum f M, sum f' M)
[PROOF STEP]
proof (cases \<open>card M = 0\<close>)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. card M = 0 \<Longrightarrow> E (sum f M, sum f' M)
 2. card M \<noteq> 0 \<Longrightarrow> E (sum f M, sum f' M)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
card M = 0

goal (2 subgoals):
 1. card M = 0 \<Longrightarrow> E (sum f M, sum f' M)
 2. card M \<noteq> 0 \<Longrightarrow> E (sum f M, sum f' M)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card M = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card M = 0

goal (1 subgoal):
 1. E (sum f M, sum f' M)
[PROOF STEP]
by (metis Suc.prems card_eq_0_iff sum.empty sum.infinite uniformity_refl)
[PROOF STATE]
proof (state)
this:
E (sum f M, sum f' M)

goal (1 subgoal):
 1. card M \<noteq> 0 \<Longrightarrow> E (sum f M, sum f' M)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card M \<noteq> 0 \<Longrightarrow> E (sum f M, sum f' M)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
card M \<noteq> 0

goal (1 subgoal):
 1. card M \<noteq> 0 \<Longrightarrow> E (sum f M, sum f' M)
[PROOF STEP]
with \<open>card M \<le> Suc n\<close>
[PROOF STATE]
proof (chain)
picking this:
card M \<le> Suc n
card M \<noteq> 0
[PROOF STEP]
obtain N x where \<open>card N \<le> n\<close> and \<open>x \<notin> N\<close> and \<open>M = insert x N\<close>
[PROOF STATE]
proof (prove)
using this:
card M \<le> Suc n
card M \<noteq> 0

goal (1 subgoal):
 1. (\<And>N x. \<lbrakk>card N \<le> n; x \<notin> N; M = insert x N\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis card_Suc_eq less_Suc_eq_0_disj less_Suc_eq_le)
[PROOF STATE]
proof (state)
this:
card N \<le> n
x \<notin> N
M = insert x N

goal (1 subgoal):
 1. card M \<noteq> 0 \<Longrightarrow> E (sum f M, sum f' M)
[PROOF STEP]
from DM
[PROOF STATE]
proof (chain)
picking this:
\<forall>m\<in>M. D (f m, f' m)
[PROOF STEP]
have \<open>\<And>m. m\<in>N \<Longrightarrow> D (f m, f' m)\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>m\<in>M. D (f m, f' m)

goal (1 subgoal):
 1. \<And>m. m \<in> N \<Longrightarrow> D (f m, f' m)
[PROOF STEP]
using \<open>M = insert x N\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>m\<in>M. D (f m, f' m)
M = insert x N

goal (1 subgoal):
 1. \<And>m. m \<in> N \<Longrightarrow> D (f m, f' m)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?m \<in> N \<Longrightarrow> D (f ?m, f' ?m)

goal (1 subgoal):
 1. card M \<noteq> 0 \<Longrightarrow> E (sum f M, sum f' M)
[PROOF STEP]
with D3[OF \<open>card N \<le> n\<close>]
[PROOF STATE]
proof (chain)
picking this:
\<forall>m\<in>N. D3 (?f m, ?f' m) \<Longrightarrow> D2 (sum ?f N, sum ?f' N)
?m \<in> N \<Longrightarrow> D (f ?m, f' ?m)
[PROOF STEP]
have D2_N: \<open>D2 (sum f N, sum f' N)\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>m\<in>N. D3 (?f m, ?f' m) \<Longrightarrow> D2 (sum ?f N, sum ?f' N)
?m \<in> N \<Longrightarrow> D (f ?m, f' ?m)

goal (1 subgoal):
 1. D2 (sum f N, sum f' N)
[PROOF STEP]
using D_def
[PROOF STATE]
proof (prove)
using this:
\<forall>m\<in>N. D3 (?f m, ?f' m) \<Longrightarrow> D2 (sum ?f N, sum ?f' N)
?m \<in> N \<Longrightarrow> D (f ?m, f' ?m)
D ?x \<equiv> D1 ?x \<and> D3 ?x

goal (1 subgoal):
 1. D2 (sum f N, sum f' N)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
D2 (sum f N, sum f' N)

goal (1 subgoal):
 1. card M \<noteq> 0 \<Longrightarrow> E (sum f M, sum f' M)
[PROOF STEP]
from DM
[PROOF STATE]
proof (chain)
picking this:
\<forall>m\<in>M. D (f m, f' m)
[PROOF STEP]
have \<open>D (f x, f' x)\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>m\<in>M. D (f m, f' m)

goal (1 subgoal):
 1. D (f x, f' x)
[PROOF STEP]
using \<open>M = insert x N\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>m\<in>M. D (f m, f' m)
M = insert x N

goal (1 subgoal):
 1. D (f x, f' x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
D (f x, f' x)

goal (1 subgoal):
 1. card M \<noteq> 0 \<Longrightarrow> E (sum f M, sum f' M)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
D (f x, f' x)
[PROOF STEP]
have \<open>D1 (f x, f' x)\<close>
[PROOF STATE]
proof (prove)
using this:
D (f x, f' x)

goal (1 subgoal):
 1. D1 (f x, f' x)
[PROOF STEP]
by (simp add: D_def)
[PROOF STATE]
proof (state)
this:
D1 (f x, f' x)

goal (1 subgoal):
 1. card M \<noteq> 0 \<Longrightarrow> E (sum f M, sum f' M)
[PROOF STEP]
with D2_N
[PROOF STATE]
proof (chain)
picking this:
D2 (sum f N, sum f' N)
D1 (f x, f' x)
[PROOF STEP]
have \<open>E (f x + sum f N, f' x + sum f' N)\<close>
[PROOF STATE]
proof (prove)
using this:
D2 (sum f N, sum f' N)
D1 (f x, f' x)

goal (1 subgoal):
 1. E (f x + sum f N, f' x + sum f' N)
[PROOF STEP]
using D1D2E
[PROOF STATE]
proof (prove)
using this:
D2 (sum f N, sum f' N)
D1 (f x, f' x)
\<lbrakk>D1 (?x, ?y); D2 (?x', ?y')\<rbrakk> \<Longrightarrow> E (?x + ?x', ?y + ?y')

goal (1 subgoal):
 1. E (f x + sum f N, f' x + sum f' N)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
E (f x + sum f N, f' x + sum f' N)

goal (1 subgoal):
 1. card M \<noteq> 0 \<Longrightarrow> E (sum f M, sum f' M)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
E (f x + sum f N, f' x + sum f' N)
[PROOF STEP]
show \<open>E (sum f M, sum f' M)\<close>
[PROOF STATE]
proof (prove)
using this:
E (f x + sum f N, f' x + sum f' N)

goal (1 subgoal):
 1. E (sum f M, sum f' M)
[PROOF STEP]
by (metis False \<open>M = insert x N\<close> \<open>x \<notin> N\<close> card.infinite finite_insert sum.insert)
[PROOF STATE]
proof (state)
this:
E (sum f M, sum f' M)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>card ?M \<le> Suc n; \<forall>m\<in>?M. D (?f m, ?f' m)\<rbrakk> \<Longrightarrow> E (sum ?f ?M, sum ?f' ?M)

goal (1 subgoal):
 1. \<And>n E. \<lbrakk>\<And>E. eventually E uniformity \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M)); eventually E uniformity\<rbrakk> \<Longrightarrow> \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> Suc n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M))
[PROOF STEP]
with \<open>eventually D uniformity\<close>
[PROOF STATE]
proof (chain)
picking this:
eventually D uniformity
\<lbrakk>card ?M \<le> Suc n; \<forall>m\<in>?M. D (?f m, ?f' m)\<rbrakk> \<Longrightarrow> E (sum ?f ?M, sum ?f' ?M)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
eventually D uniformity
\<lbrakk>card ?M \<le> Suc n; \<forall>m\<in>?M. D (?f m, ?f' m)\<rbrakk> \<Longrightarrow> E (sum ?f ?M, sum ?f' ?M)

goal (1 subgoal):
 1. \<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> Suc n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>D. eventually D uniformity \<and> (\<forall>M f f'. card M \<le> Suc n \<and> (\<forall>m\<in>M. D (f m, f' m)) \<longrightarrow> E (sum f M, sum f' M))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma right_total_rel_resource:
  "\<lbrakk> right_unique A; left_total A; right_total B \<rbrakk> \<Longrightarrow> right_total (rel_resource A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>right_unique A; left_total A; right_total B\<rbrakk> \<Longrightarrow> right_total (rel_resource A B)
[PROOF STEP]
unfolding right_unique_alt_def right_total_alt_def rel_resource_conversep[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A\<inverse>\<inverse> OO A \<le> (=); left_total A; (=) \<le> B\<inverse>\<inverse> OO B\<rbrakk> \<Longrightarrow> (=) \<le> rel_resource A\<inverse>\<inverse> B\<inverse>\<inverse> OO rel_resource A B
[PROOF STEP]
apply(subst rel_resource_eq[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A\<inverse>\<inverse> OO A \<le> (=); left_total A; (=) \<le> B\<inverse>\<inverse> OO B\<rbrakk> \<Longrightarrow> rel_resource (=) (=) \<le> rel_resource A\<inverse>\<inverse> B\<inverse>\<inverse> OO rel_resource A B
[PROOF STEP]
apply(rule order_trans[rotated])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>A\<inverse>\<inverse> OO A \<le> (=); left_total A; (=) \<le> B\<inverse>\<inverse> OO B\<rbrakk> \<Longrightarrow> ?y \<le> rel_resource A\<inverse>\<inverse> B\<inverse>\<inverse> OO rel_resource A B
 2. \<lbrakk>A\<inverse>\<inverse> OO A \<le> (=); left_total A; (=) \<le> B\<inverse>\<inverse> OO B\<rbrakk> \<Longrightarrow> rel_resource (=) (=) \<le> ?y
[PROOF STEP]
apply(rule rel_resource_neg_distr; simp add: right_unique_alt_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A\<inverse>\<inverse> OO A \<le> (=); left_total A; (=) \<le> B\<inverse>\<inverse> OO B\<rbrakk> \<Longrightarrow> rel_resource (=) (=) \<le> rel_resource (A\<inverse>\<inverse> OO A) (B\<inverse>\<inverse> OO B)
[PROOF STEP]
apply(rule rel_resource_mono; assumption)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ereal_Sup_uminus_image_eq: "Sup (uminus ` S::ereal set) = - Inf S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (uminus ` S) = - Inf S
[PROOF STEP]
by (auto intro!: SUP_eqI
           simp: Ball_def[symmetric] ereal_uminus_le_reorder le_Inf_iff
           intro!: complete_lattice_class.Inf_lower2)


[STATEMENT]
lemma f_shrink_last_last: "
  length xs mod k = 0 \<Longrightarrow> last (xs \<div>\<^bsub>fl\<^esub> k) = last xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs mod k = 0 \<Longrightarrow> last (xs \<div>\<^sub>l k) = last xs
[PROOF STEP]
apply (case_tac "k = 0", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs mod k = 0; k \<noteq> 0\<rbrakk> \<Longrightarrow> last (xs \<div>\<^sub>l k) = last xs
[PROOF STEP]
apply (case_tac "xs = []", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs mod k = 0; k \<noteq> 0; xs \<noteq> []\<rbrakk> \<Longrightarrow> last (xs \<div>\<^sub>l k) = last xs
[PROOF STEP]
apply (subgoal_tac "k \<le> length xs")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>length xs mod k = 0; k \<noteq> 0; xs \<noteq> []; k \<le> length xs\<rbrakk> \<Longrightarrow> last (xs \<div>\<^sub>l k) = last xs
 2. \<lbrakk>length xs mod k = 0; k \<noteq> 0; xs \<noteq> []\<rbrakk> \<Longrightarrow> k \<le> length xs
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>length xs mod k = 0; k \<noteq> 0; xs \<noteq> []\<rbrakk> \<Longrightarrow> k \<le> length xs
 2. \<lbrakk>length xs mod k = 0; k \<noteq> 0; xs \<noteq> []; k \<le> length xs\<rbrakk> \<Longrightarrow> last (xs \<div>\<^sub>l k) = last xs
[PROOF STEP]
apply (rule ccontr, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs mod k = 0; k \<noteq> 0; xs \<noteq> []; k \<le> length xs\<rbrakk> \<Longrightarrow> last (xs \<div>\<^sub>l k) = last xs
[PROOF STEP]
apply (rule subst[OF append_take_drop_id[of "length xs - k" xs]])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs mod k = 0; k \<noteq> 0; xs \<noteq> []; k \<le> length xs\<rbrakk> \<Longrightarrow> last ((xs \<down> (length xs - k) @ xs \<up> (length xs - k)) \<div>\<^sub>l k) = last (xs \<down> (length xs - k) @ xs \<up> (length xs - k))
[PROOF STEP]
apply (subst f_shrink_last_snoc)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>length xs mod k = 0; k \<noteq> 0; xs \<noteq> []; k \<le> length xs\<rbrakk> \<Longrightarrow> 0 < k
 2. \<lbrakk>length xs mod k = 0; k \<noteq> 0; xs \<noteq> []; k \<le> length xs\<rbrakk> \<Longrightarrow> length (xs \<up> (length xs - k)) = k
 3. \<lbrakk>length xs mod k = 0; k \<noteq> 0; xs \<noteq> []; k \<le> length xs\<rbrakk> \<Longrightarrow> length (xs \<down> (length xs - k)) mod k = 0
 4. \<lbrakk>length xs mod k = 0; k \<noteq> 0; xs \<noteq> []; k \<le> length xs\<rbrakk> \<Longrightarrow> last (xs \<down> (length xs - k) \<div>\<^sub>l k @ [last (xs \<up> (length xs - k))]) = last (xs \<down> (length xs - k) @ xs \<up> (length xs - k))
[PROOF STEP]
apply (simp add: min_eqR mod_diff_self2)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Ints_subset_Rats: "\<int> \<subseteq> \<rat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<int> \<subseteq> \<rat>
[PROOF STEP]
using Ints_cases Rats_of_int
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?q \<in> \<int>; \<And>z. ?q = of_int z \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
of_int ?z \<in> \<rat>

goal (1 subgoal):
 1. \<int> \<subseteq> \<rat>
[PROOF STEP]
by blast


[STATEMENT]
lemma (in Ring) mzero_im_sub_ker:"\<lbrakk>R module L; R module M; R module N;
       f \<in> mHom R L M; g \<in> mHom R M N; compos L g f = mzeromap L N\<rbrakk> \<Longrightarrow>
      f ` (carrier L) \<subseteq> ker\<^bsub>M,N\<^esub> g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; compos L g f = mzeromap L N\<rbrakk> \<Longrightarrow> f ` carrier L \<subseteq> ker\<^bsub>M,N\<^esub> g
[PROOF STEP]
apply (rule subsetI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; compos L g f = mzeromap L N; x \<in> f ` carrier L\<rbrakk> \<Longrightarrow> x \<in> ker\<^bsub>M,N\<^esub> g
[PROOF STEP]
apply (simp add:image_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; compos L g f = mzeromap L N; \<exists>xa\<in>carrier L. x = f xa\<rbrakk> \<Longrightarrow> x \<in> ker\<^bsub>M,N\<^esub> g
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; compos L g f = mzeromap L N; xa \<in> carrier L\<rbrakk> \<Longrightarrow> f xa \<in> ker\<^bsub>M,N\<^esub> g
[PROOF STEP]
apply (simp add:ker_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; compos L g f = mzeromap L N; xa \<in> carrier L\<rbrakk> \<Longrightarrow> f xa \<in> carrier M \<and> g (f xa) = \<zero>\<^bsub>N\<^esub>
[PROOF STEP]
apply (simp add:Module.mHom_mem)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; compos L g f = mzeromap L N; xa \<in> carrier L\<rbrakk> \<Longrightarrow> g (f xa) = \<zero>\<^bsub>N\<^esub>
[PROOF STEP]
apply (simp add:compos_def compose_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; (\<lambda>x\<in>carrier L. g (f x)) = mzeromap L N; xa \<in> carrier L\<rbrakk> \<Longrightarrow> g (f xa) = \<zero>\<^bsub>N\<^esub>
[PROOF STEP]
apply (subgoal_tac "(\<lambda>x\<in>carrier L. g (f x)) xa = mzeromap L N xa")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; (\<lambda>x\<in>carrier L. g (f x)) = mzeromap L N; xa \<in> carrier L; (\<lambda>x\<in>carrier L. g (f x)) xa = mzeromap L N xa\<rbrakk> \<Longrightarrow> g (f xa) = \<zero>\<^bsub>N\<^esub>
 2. \<And>xa. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; (\<lambda>x\<in>carrier L. g (f x)) = mzeromap L N; xa \<in> carrier L\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>carrier L. g (f x)) xa = mzeromap L N xa
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xa. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; (\<lambda>x\<in>carrier L. g (f x)) = mzeromap L N; xa \<in> carrier L\<rbrakk> \<Longrightarrow> (\<lambda>x\<in>carrier L. g (f x)) xa = mzeromap L N xa
 2. \<And>xa. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; (\<lambda>x\<in>carrier L. g (f x)) = mzeromap L N; xa \<in> carrier L; (\<lambda>x\<in>carrier L. g (f x)) xa = mzeromap L N xa\<rbrakk> \<Longrightarrow> g (f xa) = \<zero>\<^bsub>N\<^esub>
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; (\<lambda>x\<in>carrier L. g (f x)) = mzeromap L N; xa \<in> carrier L; (\<lambda>x\<in>carrier L. g (f x)) xa = mzeromap L N xa\<rbrakk> \<Longrightarrow> g (f xa) = \<zero>\<^bsub>N\<^esub>
[PROOF STEP]
apply (thin_tac "(\<lambda>x\<in>carrier L. g (f x)) = mzeromap L N")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; xa \<in> carrier L; (\<lambda>x\<in>carrier L. g (f x)) xa = mzeromap L N xa\<rbrakk> \<Longrightarrow> g (f xa) = \<zero>\<^bsub>N\<^esub>
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; xa \<in> carrier L; g (f xa) = mzeromap L N xa\<rbrakk> \<Longrightarrow> mzeromap L N xa = \<zero>\<^bsub>N\<^esub>
[PROOF STEP]
apply (simp add:mzeromap_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma wt_args_ge_length_times_\<epsilon>\<^sub>h:
  assumes legal: "legal_zpassign A"
  shows "wt_args i A \<zeta> ss \<ge> of_nat (length ss) * zhmset_of \<epsilon>\<^sub>h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (length ss) * zhmset_of \<epsilon>\<^sub>h \<le> wt_args i A \<zeta> ss
[PROOF STEP]
unfolding wt_args_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (length ss) * zhmset_of \<epsilon>\<^sub>h \<le> sum_list (map ((\<lambda>p. eval_tpoly A (map_tpoly (\<lambda>x. x) zhmset_of p)) \<circ> (\<lambda>(s, i). PMult [coef_hd \<zeta> i, wt s])) (zip ss [i..<i + length ss]))
[PROOF STEP]
by (rule sum_list_ge_length_times[unfolded wt_args_def,
      of "map (eval_ztpoly A \<circ> (\<lambda>(s, i). PMult [coef_hd \<zeta> i, wt s])) (zip ss [i..<i + length ss])",
      simplified],
    auto intro!: mult_le_mono_hmset[of 1, simplified] nonneg_le_mult_right_mono_zhmset coef_hd_gt_0
      simp: legal zero_less_iff_1_le_hmset[symmetric] coef_hd_gt_0 wt_ge_\<epsilon>\<^sub>h)