[STATEMENT]
lemma disjoint_support:
  assumes "permutation p" shows "disjoint (range (\<lambda>a. set (support p a)))" (is "disjoint ?A")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. disjoint (range (\<lambda>a. set (support p a)))
[PROOF STEP]
proof (rule disjointI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> range (\<lambda>a. set (support p a)); b \<in> range (\<lambda>a. set (support p a)); a \<noteq> b\<rbrakk> \<Longrightarrow> a \<inter> b = {}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> range (\<lambda>a. set (support p a)); b \<in> range (\<lambda>a. set (support p a)); a \<noteq> b\<rbrakk> \<Longrightarrow> a \<inter> b = {}
[PROOF STEP]
fix i j a b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> range (\<lambda>a. set (support p a)); b \<in> range (\<lambda>a. set (support p a)); a \<noteq> b\<rbrakk> \<Longrightarrow> a \<inter> b = {}
[PROOF STEP]
assume "set (support p a) \<inter> set (support p b) \<noteq> {}"
[PROOF STATE]
proof (state)
this:
set (support p a) \<inter> set (support p b) \<noteq> {}

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> range (\<lambda>a. set (support p a)); b \<in> range (\<lambda>a. set (support p a)); a \<noteq> b\<rbrakk> \<Longrightarrow> a \<inter> b = {}
[PROOF STEP]
have "set (support p a) \<subseteq> set (support p b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (support p a) \<subseteq> set (support p b)
[PROOF STEP]
unfolding support_set[OF assms]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range (\<lambda>i. (p ^^ i) a) \<subseteq> range (\<lambda>i. (p ^^ i) b)
[PROOF STEP]
proof (auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. (p ^^ i) a \<in> range (\<lambda>i. (p ^^ i) b)
[PROOF STEP]
from \<open>set (support p a) \<inter> set (support p b) \<noteq> {}\<close>
[PROOF STATE]
proof (chain)
picking this:
set (support p a) \<inter> set (support p b) \<noteq> {}
[PROOF STEP]
obtain i j where ij: "(p ^^ i) a = (p ^^ j) b"
[PROOF STATE]
proof (prove)
using this:
set (support p a) \<inter> set (support p b) \<noteq> {}

goal (1 subgoal):
 1. (\<And>i j. (p ^^ i) a = (p ^^ j) b \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(p ^^ i) a = (p ^^ j) b

goal (1 subgoal):
 1. \<And>i. (p ^^ i) a \<in> range (\<lambda>i. (p ^^ i) b)
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. (p ^^ i) a \<in> range (\<lambda>i. (p ^^ i) b)
[PROOF STEP]
have "(p ^^ k) a = (p ^^ (k + (least_power p a) * l)) a" for l
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p ^^ k) a = (p ^^ (k + least_power p a * l)) a
[PROOF STEP]
using least_power_dvd[OF assms]
[PROOF STATE]
proof (prove)
using this:
(least_power p ?a dvd ?n) = ((p ^^ ?n) ?a = ?a)

goal (1 subgoal):
 1. (p ^^ k) a = (p ^^ (k + least_power p a * l)) a
[PROOF STEP]
by (induct l) (simp, metis dvd_triv_left funpow_add o_def)
[PROOF STATE]
proof (state)
this:
(p ^^ k) a = (p ^^ (k + least_power p a * ?l)) a

goal (1 subgoal):
 1. \<And>i. (p ^^ i) a \<in> range (\<lambda>i. (p ^^ i) b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(p ^^ k) a = (p ^^ (k + least_power p a * ?l)) a
[PROOF STEP]
obtain m where "m \<ge> i" and "(p ^^ m) a = (p ^^ k) a"
[PROOF STATE]
proof (prove)
using this:
(p ^^ k) a = (p ^^ (k + least_power p a * ?l)) a

goal (1 subgoal):
 1. (\<And>m. \<lbrakk>i \<le> m; (p ^^ m) a = (p ^^ k) a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using least_power_of_permutation(2)[OF assms]
[PROOF STATE]
proof (prove)
using this:
(p ^^ k) a = (p ^^ (k + least_power p a * ?l)) a
0 < least_power p ?a

goal (1 subgoal):
 1. (\<And>m. \<lbrakk>i \<le> m; (p ^^ m) a = (p ^^ k) a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis dividend_less_times_div le_eq_less_or_eq mult_Suc_right trans_less_add2)
[PROOF STATE]
proof (state)
this:
i \<le> m
(p ^^ m) a = (p ^^ k) a

goal (1 subgoal):
 1. \<And>i. (p ^^ i) a \<in> range (\<lambda>i. (p ^^ i) b)
[PROOF STEP]
hence "(p ^^ m) a = (p ^^ (m - i)) ((p ^^ i) a)"
[PROOF STATE]
proof (prove)
using this:
i \<le> m
(p ^^ m) a = (p ^^ k) a

goal (1 subgoal):
 1. (p ^^ m) a = (p ^^ (m - i)) ((p ^^ i) a)
[PROOF STEP]
by (metis Nat.le_imp_diff_is_add funpow_add o_apply)
[PROOF STATE]
proof (state)
this:
(p ^^ m) a = (p ^^ (m - i)) ((p ^^ i) a)

goal (1 subgoal):
 1. \<And>i. (p ^^ i) a \<in> range (\<lambda>i. (p ^^ i) b)
[PROOF STEP]
with \<open>(p ^^ m) a = (p ^^ k) a\<close>
[PROOF STATE]
proof (chain)
picking this:
(p ^^ m) a = (p ^^ k) a
(p ^^ m) a = (p ^^ (m - i)) ((p ^^ i) a)
[PROOF STEP]
have "(p ^^ k) a = (p ^^ ((m - i) + j)) b"
[PROOF STATE]
proof (prove)
using this:
(p ^^ m) a = (p ^^ k) a
(p ^^ m) a = (p ^^ (m - i)) ((p ^^ i) a)

goal (1 subgoal):
 1. (p ^^ k) a = (p ^^ (m - i + j)) b
[PROOF STEP]
unfolding ij
[PROOF STATE]
proof (prove)
using this:
(p ^^ m) a = (p ^^ k) a
(p ^^ m) a = (p ^^ (m - i)) ((p ^^ j) b)

goal (1 subgoal):
 1. (p ^^ k) a = (p ^^ (m - i + j)) b
[PROOF STEP]
by (simp add: funpow_add)
[PROOF STATE]
proof (state)
this:
(p ^^ k) a = (p ^^ (m - i + j)) b

goal (1 subgoal):
 1. \<And>i. (p ^^ i) a \<in> range (\<lambda>i. (p ^^ i) b)
[PROOF STEP]
thus "(p ^^ k) a \<in> range (\<lambda>i. (p ^^ i) b)"
[PROOF STATE]
proof (prove)
using this:
(p ^^ k) a = (p ^^ (m - i + j)) b

goal (1 subgoal):
 1. (p ^^ k) a \<in> range (\<lambda>i. (p ^^ i) b)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(p ^^ k) a \<in> range (\<lambda>i. (p ^^ i) b)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
set (support p a) \<subseteq> set (support p b)

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> range (\<lambda>a. set (support p a)); b \<in> range (\<lambda>a. set (support p a)); a \<noteq> b\<rbrakk> \<Longrightarrow> a \<inter> b = {}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
set (support p ?a2) \<inter> set (support p ?b2) \<noteq> {} \<Longrightarrow> set (support p ?a2) \<subseteq> set (support p ?b2)

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> range (\<lambda>a. set (support p a)); b \<in> range (\<lambda>a. set (support p a)); a \<noteq> b\<rbrakk> \<Longrightarrow> a \<inter> b = {}
[PROOF STEP]
note aux_lemma = this
[PROOF STATE]
proof (state)
this:
set (support p ?a2) \<inter> set (support p ?b2) \<noteq> {} \<Longrightarrow> set (support p ?a2) \<subseteq> set (support p ?b2)

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> range (\<lambda>a. set (support p a)); b \<in> range (\<lambda>a. set (support p a)); a \<noteq> b\<rbrakk> \<Longrightarrow> a \<inter> b = {}
[PROOF STEP]
fix supp_a supp_b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> range (\<lambda>a. set (support p a)); b \<in> range (\<lambda>a. set (support p a)); a \<noteq> b\<rbrakk> \<Longrightarrow> a \<inter> b = {}
[PROOF STEP]
assume "supp_a \<in> ?A" and "supp_b \<in> ?A"
[PROOF STATE]
proof (state)
this:
supp_a \<in> range (\<lambda>a. set (support p a))
supp_b \<in> range (\<lambda>a. set (support p a))

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> range (\<lambda>a. set (support p a)); b \<in> range (\<lambda>a. set (support p a)); a \<noteq> b\<rbrakk> \<Longrightarrow> a \<inter> b = {}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
supp_a \<in> range (\<lambda>a. set (support p a))
supp_b \<in> range (\<lambda>a. set (support p a))
[PROOF STEP]
obtain a b where a: "supp_a = set (support p a)" and b: "supp_b = set (support p b)"
[PROOF STATE]
proof (prove)
using this:
supp_a \<in> range (\<lambda>a. set (support p a))
supp_b \<in> range (\<lambda>a. set (support p a))

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>supp_a = set (support p a); supp_b = set (support p b)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
supp_a = set (support p a)
supp_b = set (support p b)

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> range (\<lambda>a. set (support p a)); b \<in> range (\<lambda>a. set (support p a)); a \<noteq> b\<rbrakk> \<Longrightarrow> a \<inter> b = {}
[PROOF STEP]
assume "supp_a \<noteq> supp_b"
[PROOF STATE]
proof (state)
this:
supp_a \<noteq> supp_b

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>a \<in> range (\<lambda>a. set (support p a)); b \<in> range (\<lambda>a. set (support p a)); a \<noteq> b\<rbrakk> \<Longrightarrow> a \<inter> b = {}
[PROOF STEP]
thus "supp_a \<inter> supp_b = {}"
[PROOF STATE]
proof (prove)
using this:
supp_a \<noteq> supp_b

goal (1 subgoal):
 1. supp_a \<inter> supp_b = {}
[PROOF STEP]
using aux_lemma
[PROOF STATE]
proof (prove)
using this:
supp_a \<noteq> supp_b
set (support p ?a2) \<inter> set (support p ?b2) \<noteq> {} \<Longrightarrow> set (support p ?a2) \<subseteq> set (support p ?b2)

goal (1 subgoal):
 1. supp_a \<inter> supp_b = {}
[PROOF STEP]
unfolding a b
[PROOF STATE]
proof (prove)
using this:
set (support p a) \<noteq> set (support p b)
set (support p ?a2) \<inter> set (support p ?b2) \<noteq> {} \<Longrightarrow> set (support p ?a2) \<subseteq> set (support p ?b2)

goal (1 subgoal):
 1. set (support p a) \<inter> set (support p b) = {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
supp_a \<inter> supp_b = {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fixp_above_Kleene_iter_ex:
  assumes "(\<forall>M \<in> Chains leq. finite M)"
  obtains k where "fixp_above a = (f ^^ k) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. fixp_above a = (f ^^ k) a \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>M\<in>Chains leq. finite M

goal (1 subgoal):
 1. (\<And>k. fixp_above a = (f ^^ k) a \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by atomize_elim (simp add: chfin_iterates_above_fun_pow fixp_iterates_above)


[STATEMENT]
lemma (in ring_of_sets) UNION_in_sets:
  fixes A:: "nat \<Rightarrow> 'a set"
  assumes A: "range A \<subseteq> M"
  shows  "(\<Union>i\<in>{0..<n}. A i) \<in> M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (A ` {0..<n}) \<in> M
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<Union> (A ` {0..<0}) \<in> M
 2. \<And>n. \<Union> (A ` {0..<n}) \<in> M \<Longrightarrow> \<Union> (A ` {0..<Suc n}) \<in> M
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<Union> (A ` {0..<0}) \<in> M
 2. \<And>n. \<Union> (A ` {0..<n}) \<in> M \<Longrightarrow> \<Union> (A ` {0..<Suc n}) \<in> M
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (A ` {0..<0}) \<in> M
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<Union> (A ` {0..<0}) \<in> M

goal (1 subgoal):
 1. \<And>n. \<Union> (A ` {0..<n}) \<in> M \<Longrightarrow> \<Union> (A ` {0..<Suc n}) \<in> M
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<Union> (A ` {0..<n}) \<in> M \<Longrightarrow> \<Union> (A ` {0..<Suc n}) \<in> M
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<Union> (A ` {0..<n}) \<in> M

goal (1 subgoal):
 1. \<And>n. \<Union> (A ` {0..<n}) \<in> M \<Longrightarrow> \<Union> (A ` {0..<Suc n}) \<in> M
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<Union> (A ` {0..<n}) \<in> M

goal (1 subgoal):
 1. \<Union> (A ` {0..<Suc n}) \<in> M
[PROOF STEP]
by (simp add: atLeastLessThanSuc) (metis A Un UNIV_I image_subset_iff)
[PROOF STATE]
proof (state)
this:
\<Union> (A ` {0..<Suc n}) \<in> M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma resultant_zero:
  fixes p q :: "'a :: comm_ring_1 poly"
  assumes deg: "degree p > 0 \<or> degree q > 0"
      and xp: "poly p x = 0" and xq: "poly q x = 0"
  shows "resultant p q = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
assume degp: "degree p > 0" and degq: "degree q > 0"
[PROOF STATE]
proof (state)
this:
0 < degree p
0 < degree q

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
obtain p' q' where "[: resultant p q :] = p' * p + q' * q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p' q'. [:resultant p q:] = p' * p + q' * q \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using resultant_as_poly[OF degp degq]
[PROOF STATE]
proof (prove)
using this:
\<exists>p' q'. degree p' < degree q \<and> degree q' < degree p \<and> [:resultant p q:] = p' * p + q' * q

goal (1 subgoal):
 1. (\<And>p' q'. [:resultant p q:] = p' * p + q' * q \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
[:resultant p q:] = p' * p + q' * q

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
hence "resultant p q = poly (p' * p + q' * q) x"
[PROOF STATE]
proof (prove)
using this:
[:resultant p q:] = p' * p + q' * q

goal (1 subgoal):
 1. resultant p q = poly (p' * p + q' * q) x
[PROOF STEP]
using mpoly_base_conv(2)[of "resultant p q"]
[PROOF STATE]
proof (prove)
using this:
[:resultant p q:] = p' * p + q' * q
resultant p q = poly [:resultant p q:] ?x

goal (1 subgoal):
 1. resultant p q = poly (p' * p + q' * q) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
resultant p q = poly (p' * p + q' * q) x

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
resultant p q = poly (p' * p + q' * q) x

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
have "... = poly p x * poly p' x + poly q x * poly q' x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (p' * p + q' * q) x = poly p x * poly p' x + poly q x * poly q' x
[PROOF STEP]
unfolding poly2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (p' * p + q' * q) x = poly p x * poly p' x + poly q x * poly q' x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly (p' * p + q' * q) x = poly p x * poly p' x + poly q x * poly q' x

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
resultant p q = poly p x * poly p' x + poly q x * poly q' x
[PROOF STEP]
have ?thesis
[PROOF STATE]
proof (prove)
using this:
resultant p q = poly p x * poly p' x + poly q x * poly q' x

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
using xp xq
[PROOF STATE]
proof (prove)
using this:
resultant p q = poly p x * poly p' x + poly q x * poly q' x
poly p x = (0::'a)
poly q x = (0::'a)

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

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < degree p; 0 < degree q\<rbrakk> \<Longrightarrow> resultant p q = (0::'a)

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < degree p; 0 < degree q\<rbrakk> \<Longrightarrow> resultant p q = (0::'a)

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < degree p; 0 < degree q\<rbrakk> \<Longrightarrow> resultant p q = (0::'a)

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
assume degp: "degree p = 0"
[PROOF STATE]
proof (state)
this:
degree p = 0

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
have p: "p = [:0:]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = [:0::'a:]
[PROOF STEP]
using xp degree_0_id[OF degp,symmetric]
[PROOF STATE]
proof (prove)
using this:
poly p x = (0::'a)
p = [:coeff p 0:]

goal (1 subgoal):
 1. p = [:0::'a:]
[PROOF STEP]
by (metis mpoly_base_conv(2))
[PROOF STATE]
proof (state)
this:
p = [:0::'a:]

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
have ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
unfolding p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. resultant [:0::'a:] q = (0::'a)
[PROOF STEP]
using degp deg
[PROOF STATE]
proof (prove)
using this:
degree p = 0
0 < degree p \<or> 0 < degree q

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

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
degree p = 0 \<Longrightarrow> resultant p q = (0::'a)

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
degree p = 0 \<Longrightarrow> resultant p q = (0::'a)

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
degree p = 0 \<Longrightarrow> resultant p q = (0::'a)

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
assume degq: "degree q = 0"
[PROOF STATE]
proof (state)
this:
degree q = 0

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
have q: "q = [:0:]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q = [:0::'a:]
[PROOF STEP]
using xq degree_0_id[OF degq,symmetric]
[PROOF STATE]
proof (prove)
using this:
poly q x = (0::'a)
q = [:coeff q 0:]

goal (1 subgoal):
 1. q = [:0::'a:]
[PROOF STEP]
by (metis mpoly_base_conv(2))
[PROOF STATE]
proof (state)
this:
q = [:0::'a:]

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
have ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
unfolding q
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. resultant p [:0::'a:] = (0::'a)
[PROOF STEP]
using degq deg
[PROOF STATE]
proof (prove)
using this:
degree q = 0
0 < degree p \<or> 0 < degree q

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

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
degree q = 0 \<Longrightarrow> resultant p q = (0::'a)

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 < degree p; 0 < degree q\<rbrakk> \<Longrightarrow> resultant p q = (0::'a)
degree p = 0 \<Longrightarrow> resultant p q = (0::'a)
degree q = 0 \<Longrightarrow> resultant p q = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < degree p; 0 < degree q\<rbrakk> \<Longrightarrow> resultant p q = (0::'a)
degree p = 0 \<Longrightarrow> resultant p q = (0::'a)
degree q = 0 \<Longrightarrow> resultant p q = (0::'a)

goal (1 subgoal):
 1. resultant p q = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
resultant p q = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma monom_mult_Sum_any_left:
  assumes "finite {c. f c \<noteq> 0}"
  shows "monom_mult (Sum_any f) t p = (\<Sum>c. monom_mult (f c) t p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom_mult (Sum_any f) t p = (\<Sum>c. monom_mult (f c) t p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. monom_mult (Sum_any f) t p = (\<Sum>c. monom_mult (f c) t p)
[PROOF STEP]
have "{c. monom_mult (f c) t p \<noteq> 0} \<subseteq> {c. f c \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {c. monom_mult (f c) t p \<noteq> 0} \<subseteq> {c. f c \<noteq> (0::'c)}
[PROOF STEP]
by (rule, auto)
[PROOF STATE]
proof (state)
this:
{c. monom_mult (f c) t p \<noteq> 0} \<subseteq> {c. f c \<noteq> (0::'c)}

goal (1 subgoal):
 1. monom_mult (Sum_any f) t p = (\<Sum>c. monom_mult (f c) t p)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite {c. f c \<noteq> (0::'c)}
{c. monom_mult (f c) t p \<noteq> 0} \<subseteq> {c. f c \<noteq> (0::'c)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite {c. f c \<noteq> (0::'c)}
{c. monom_mult (f c) t p \<noteq> 0} \<subseteq> {c. f c \<noteq> (0::'c)}

goal (1 subgoal):
 1. monom_mult (Sum_any f) t p = (\<Sum>c. monom_mult (f c) t p)
[PROOF STEP]
by (simp add: Groups_Big_Fun.comm_monoid_add_class.Sum_any.expand_superset monom_mult_sum_left)
[PROOF STATE]
proof (state)
this:
monom_mult (Sum_any f) t p = (\<Sum>c. monom_mult (f c) t p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_sqr :
  shows "nat(n\<^sup>2) = (nat(abs n))\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat (n\<^sup>2) = (nat \<bar>n\<bar>)\<^sup>2
[PROOF STEP]
by(rule int_int_eq[THEN iffD1], simp)


[STATEMENT]
lemma circ_mult_sub_sup:
  "(x * y)\<^sup>\<circ> \<le> (x \<squnion> y)\<^sup>\<circ>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x * y)\<^sup>\<circ> \<le> (x \<squnion> y)\<^sup>\<circ>
[PROOF STEP]
by (metis sup_ge1 sup_ge2 circ_isotone circ_square mult_isotone order_trans)


[STATEMENT]
lemma unitary_exproj_psi_minus_1:
  "unitary (2 \<cdot>\<^sub>m tensor_P proj_psi (1\<^sub>m K) - 1\<^sub>m d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unitary (2 \<cdot>\<^sub>m tensor_P proj_psi (1\<^sub>m K) - 1\<^sub>m d)
[PROOF STEP]
unfolding exproj_psi_minus_1_tensor
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unitary (tensor_P (2 \<cdot>\<^sub>m proj_psi - 1\<^sub>m N) (1\<^sub>m K))
[PROOF STEP]
unfolding ps2_P.ptensor_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unitary (ps_P.tensor_mat (2 \<cdot>\<^sub>m proj_psi - 1\<^sub>m N) (1\<^sub>m K))
[PROOF STEP]
apply (subst ps_P.tensor_mat_unitary)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. 2 \<cdot>\<^sub>m proj_psi - 1\<^sub>m N \<in> carrier_mat ps_P.d1 ps_P.d1
 2. 1\<^sub>m K \<in> carrier_mat ps_P.d2 ps_P.d2
 3. unitary (2 \<cdot>\<^sub>m proj_psi - 1\<^sub>m N)
 4. unitary (1\<^sub>m K)
 5. True
[PROOF STEP]
using ps_P_d1 ps_P_d2 unitary_proj_psi_minus_1 unitary_one
[PROOF STATE]
proof (prove)
using this:
ps_P.d1 = N
ps_P.d2 = K
unitary (2 \<cdot>\<^sub>m proj_psi - 1\<^sub>m N)
unitary (1\<^sub>m ?n)

goal (5 subgoals):
 1. 2 \<cdot>\<^sub>m proj_psi - 1\<^sub>m N \<in> carrier_mat ps_P.d1 ps_P.d1
 2. 1\<^sub>m K \<in> carrier_mat ps_P.d2 ps_P.d2
 3. unitary (2 \<cdot>\<^sub>m proj_psi - 1\<^sub>m N)
 4. unitary (1\<^sub>m K)
 5. True
[PROOF STEP]
by auto


[STATEMENT]
lemma holomorphic_convex_primitive:
  fixes f :: "complex \<Rightarrow> complex"
  assumes "convex S" "finite K" and contf: "continuous_on S f"
    and fd: "\<And>x. x \<in> interior S - K \<Longrightarrow> f field_differentiable at x"
  obtains g where "\<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative f x) (at x within S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. (\<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative f x) (at x within S)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof (rule contour_integral_convex_primitive [OF \<open>convex S\<close> contf Cauchy_theorem_triangle_cofinite])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>a b c. \<lbrakk>\<And>g. (\<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative f x) (at x within S)) \<Longrightarrow> thesis; a \<in> S; b \<in> S; c \<in> S\<rbrakk> \<Longrightarrow> continuous_on (convex hull {a, b, c}) f
 2. \<And>a b c. \<lbrakk>\<And>g. (\<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative f x) (at x within S)) \<Longrightarrow> thesis; a \<in> S; b \<in> S; c \<in> S\<rbrakk> \<Longrightarrow> finite (?S3 a b c)
 3. \<And>a b c x. \<lbrakk>\<And>g. (\<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative f x) (at x within S)) \<Longrightarrow> thesis; a \<in> S; b \<in> S; c \<in> S; x \<in> interior (convex hull {a, b, c}) - ?S3 a b c\<rbrakk> \<Longrightarrow> f field_differentiable at x
 4. \<And>g. \<lbrakk>\<And>g. (\<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative f x) (at x within S)) \<Longrightarrow> thesis; \<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative f x) (at x within S)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have *: "convex hull {a, b, c} \<subseteq> S" if "a \<in> S" "b \<in> S" "c \<in> S" for a b c
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex hull {a, b, c} \<subseteq> S
[PROOF STEP]
by (simp add: \<open>convex S\<close> hull_minimal that)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?a \<in> S; ?b \<in> S; ?c \<in> S\<rbrakk> \<Longrightarrow> convex hull {?a, ?b, ?c} \<subseteq> S

goal (4 subgoals):
 1. \<And>a b c. \<lbrakk>\<And>g. (\<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative f x) (at x within S)) \<Longrightarrow> thesis; a \<in> S; b \<in> S; c \<in> S\<rbrakk> \<Longrightarrow> continuous_on (convex hull {a, b, c}) f
 2. \<And>a b c. \<lbrakk>\<And>g. (\<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative f x) (at x within S)) \<Longrightarrow> thesis; a \<in> S; b \<in> S; c \<in> S\<rbrakk> \<Longrightarrow> finite (?S3 a b c)
 3. \<And>a b c x. \<lbrakk>\<And>g. (\<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative f x) (at x within S)) \<Longrightarrow> thesis; a \<in> S; b \<in> S; c \<in> S; x \<in> interior (convex hull {a, b, c}) - ?S3 a b c\<rbrakk> \<Longrightarrow> f field_differentiable at x
 4. \<And>g. \<lbrakk>\<And>g. (\<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative f x) (at x within S)) \<Longrightarrow> thesis; \<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative f x) (at x within S)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "continuous_on (convex hull {a, b, c}) f" if "a \<in> S" "b \<in> S" "c \<in> S" for a b c
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (convex hull {a, b, c}) f
[PROOF STEP]
by (meson "*" contf continuous_on_subset that)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?a \<in> S; ?b \<in> S; ?c \<in> S\<rbrakk> \<Longrightarrow> continuous_on (convex hull {?a, ?b, ?c}) f

goal (3 subgoals):
 1. \<And>a b c. \<lbrakk>\<And>g. (\<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative f x) (at x within S)) \<Longrightarrow> thesis; a \<in> S; b \<in> S; c \<in> S\<rbrakk> \<Longrightarrow> finite (?S3 a b c)
 2. \<And>a b c x. \<lbrakk>\<And>g. (\<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative f x) (at x within S)) \<Longrightarrow> thesis; a \<in> S; b \<in> S; c \<in> S; x \<in> interior (convex hull {a, b, c}) - ?S3 a b c\<rbrakk> \<Longrightarrow> f field_differentiable at x
 3. \<And>g. \<lbrakk>\<And>g. (\<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative f x) (at x within S)) \<Longrightarrow> thesis; \<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative f x) (at x within S)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show "f field_differentiable at x" if "a \<in> S" "b \<in> S" "c \<in> S" "x \<in> interior (convex hull {a, b, c}) - K" for a b c x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f field_differentiable at x
[PROOF STEP]
by (metis "*" DiffD1 DiffD2 DiffI fd interior_mono subsetCE that)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?a \<in> S; ?b \<in> S; ?c \<in> S; ?x \<in> interior (convex hull {?a, ?b, ?c}) - K\<rbrakk> \<Longrightarrow> f field_differentiable at ?x

goal (2 subgoals):
 1. \<And>a b c. \<lbrakk>\<And>g. (\<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative f x) (at x within S)) \<Longrightarrow> thesis; a \<in> S; b \<in> S; c \<in> S\<rbrakk> \<Longrightarrow> finite K
 2. \<And>g. \<lbrakk>\<And>g. (\<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative f x) (at x within S)) \<Longrightarrow> thesis; \<And>x. x \<in> S \<Longrightarrow> (g has_field_derivative f x) (at x within S)\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
qed (use assms in \<open>force+\<close>)


[STATEMENT]
lemma of_rat_divide: "(of_rat (a / b) :: 'a::field_char_0) = of_rat a / of_rat b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_rat (a / b) = of_rat a / of_rat b
[PROOF STEP]
by (cases "b = 0") (simp_all add: nonzero_of_rat_divide)


[STATEMENT]
lemma monom_sum: "monom (\<Sum>x\<in>A. a x) n = (\<Sum>x\<in>A. monom (a x) n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom (sum a A) n = (\<Sum>x\<in>A. monom (a x) n)
[PROOF STEP]
by (rule poly_eqI) (simp add: coeff_sum)


[STATEMENT]
lemma cat_prod_3_CId_vrange:
  "\<R>\<^sub>\<circ> ((\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>CId\<rparr>) \<subseteq>\<^sub>\<circ> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Arr\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> ((\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>CId\<rparr>) \<subseteq>\<^sub>\<circ> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Arr\<rparr>
[PROOF STEP]
proof(rule vsv.vsv_vrange_vsubset, unfold cat_cs_simps)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. vsv ((\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>CId\<rparr>)
 2. \<And>x. x \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Obj\<rparr> \<Longrightarrow> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>CId\<rparr>\<lparr>x\<rparr> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Arr\<rparr>
[PROOF STEP]
show "vsv ((\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>CId\<rparr>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vsv ((\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>CId\<rparr>)
[PROOF STEP]
by (rule cat_prod_3_CId_vsv)
[PROOF STATE]
proof (state)
this:
vsv ((\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>CId\<rparr>)

goal (1 subgoal):
 1. \<And>x. x \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Obj\<rparr> \<Longrightarrow> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>CId\<rparr>\<lparr>x\<rparr> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Arr\<rparr>
[PROOF STEP]
fix abc
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Obj\<rparr> \<Longrightarrow> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>CId\<rparr>\<lparr>x\<rparr> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Arr\<rparr>
[PROOF STEP]
assume "abc \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (state)
this:
abc \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. \<And>x. x \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Obj\<rparr> \<Longrightarrow> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>CId\<rparr>\<lparr>x\<rparr> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Arr\<rparr>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
abc \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Obj\<rparr>
[PROOF STEP]
obtain a b c where abc_def: "abc = [a, b, c]\<^sub>\<circ>"
    and a: "a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>"
    and b: "b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>"
    and c: "c \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
using this:
abc \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. (\<And>a b c. \<lbrakk>abc = [a, b, c]\<^sub>\<circ>; a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>; b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>; c \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (elim cat_prod_3_ObjE[OF \<AA> \<BB> \<CC>])
[PROOF STATE]
proof (state)
this:
abc = [a, b, c]\<^sub>\<circ>
a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>
c \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. \<And>x. x \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Obj\<rparr> \<Longrightarrow> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>CId\<rparr>\<lparr>x\<rparr> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Arr\<rparr>
[PROOF STEP]
from \<AA> \<BB> \<CC> a b c
[PROOF STATE]
proof (chain)
picking this:
category \<alpha> \<AA>
category \<alpha> \<BB>
category \<alpha> \<CC>
a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>
c \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
show "(\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>CId\<rparr>\<lparr>abc\<rparr> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Arr\<rparr>"
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<AA>
category \<alpha> \<BB>
category \<alpha> \<CC>
a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>
c \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>CId\<rparr>\<lparr>abc\<rparr> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Arr\<rparr>
[PROOF STEP]
unfolding abc_def
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<AA>
category \<alpha> \<BB>
category \<alpha> \<CC>
a \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>
c \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>CId\<rparr> \<lparr>a, b, c\<rparr>\<^sub>\<bullet> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Arr\<rparr>
[PROOF STEP]
by (cs_concl cs_intro: cat_cs_intros cat_prod_cs_intros)
[PROOF STATE]
proof (state)
this:
(\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>CId\<rparr>\<lparr>abc\<rparr> \<in>\<^sub>\<circ> (\<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>)\<lparr>Arr\<rparr>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fold_Cons_rev: "fold Cons xs = append (rev xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold (#) xs = (@) (rev xs)
[PROOF STEP]
by (induct xs) simp_all


[STATEMENT]
lemma convex_hull_Times:
  "convex hull (s \<times> t) = (convex hull s) \<times> (convex hull t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex hull s \<times> t = (convex hull s) \<times> (convex hull t)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. convex hull s \<times> t \<subseteq> (convex hull s) \<times> (convex hull t)
 2. (convex hull s) \<times> (convex hull t) \<subseteq> convex hull s \<times> t
[PROOF STEP]
show "convex hull (s \<times> t) \<subseteq> (convex hull s) \<times> (convex hull t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex hull s \<times> t \<subseteq> (convex hull s) \<times> (convex hull t)
[PROOF STEP]
by (intro hull_minimal Sigma_mono hull_subset convex_Times convex_convex_hull)
[PROOF STATE]
proof (state)
this:
convex hull s \<times> t \<subseteq> (convex hull s) \<times> (convex hull t)

goal (1 subgoal):
 1. (convex hull s) \<times> (convex hull t) \<subseteq> convex hull s \<times> t
[PROOF STEP]
have "(x, y) \<in> convex hull (s \<times> t)" if x: "x \<in> convex hull s" and y: "y \<in> convex hull t" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x, y) \<in> convex hull s \<times> t
[PROOF STEP]
proof (rule hull_induct [OF x], rule hull_induct [OF y])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x xa. \<lbrakk>x \<in> s; xa \<in> t\<rbrakk> \<Longrightarrow> (x, xa) \<in> convex hull s \<times> t
 2. \<And>x. x \<in> s \<Longrightarrow> convex {xa. (x, xa) \<in> convex hull s \<times> t}
 3. convex {x. (x, y) \<in> convex hull s \<times> t}
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x xa. \<lbrakk>x \<in> s; xa \<in> t\<rbrakk> \<Longrightarrow> (x, xa) \<in> convex hull s \<times> t
 2. \<And>x. x \<in> s \<Longrightarrow> convex {xa. (x, xa) \<in> convex hull s \<times> t}
 3. convex {x. (x, y__) \<in> convex hull s \<times> t}
[PROOF STEP]
assume "x \<in> s" and "y \<in> t"
[PROOF STATE]
proof (state)
this:
x \<in> s
y \<in> t

goal (3 subgoals):
 1. \<And>x xa. \<lbrakk>x \<in> s; xa \<in> t\<rbrakk> \<Longrightarrow> (x, xa) \<in> convex hull s \<times> t
 2. \<And>x. x \<in> s \<Longrightarrow> convex {xa. (x, xa) \<in> convex hull s \<times> t}
 3. convex {x. (x, y__) \<in> convex hull s \<times> t}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> s
y \<in> t
[PROOF STEP]
show "(x, y) \<in> convex hull (s \<times> t)"
[PROOF STATE]
proof (prove)
using this:
x \<in> s
y \<in> t

goal (1 subgoal):
 1. (x, y) \<in> convex hull s \<times> t
[PROOF STEP]
by (simp add: hull_inc)
[PROOF STATE]
proof (state)
this:
(x, y) \<in> convex hull s \<times> t

goal (2 subgoals):
 1. \<And>x. x \<in> s \<Longrightarrow> convex {xa. (x, xa) \<in> convex hull s \<times> t}
 2. convex {x. (x, y__) \<in> convex hull s \<times> t}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> s \<Longrightarrow> convex {xa. (x, xa) \<in> convex hull s \<times> t}
 2. convex {x. (x, y) \<in> convex hull s \<times> t}
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> s \<Longrightarrow> convex {xa. (x, xa) \<in> convex hull s \<times> t}
 2. convex {x. (x, y) \<in> convex hull s \<times> t}
[PROOF STEP]
let ?S = "((\<lambda>y. (0, y)) -` (\<lambda>p. (- x, 0) + p) ` (convex hull s \<times> t))"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> s \<Longrightarrow> convex {xa. (x, xa) \<in> convex hull s \<times> t}
 2. convex {x. (x, y) \<in> convex hull s \<times> t}
[PROOF STEP]
have "convex ?S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex (Pair (0::'a) -` (+) (- x, 0::'b) ` (convex hull s \<times> t))
[PROOF STEP]
by (intro convex_linear_vimage convex_translation convex_convex_hull,
        simp add: linear_iff)
[PROOF STATE]
proof (state)
this:
convex (Pair (0::'a) -` (+) (- x, 0::'b) ` (convex hull s \<times> t))

goal (2 subgoals):
 1. \<And>x. x \<in> s \<Longrightarrow> convex {xa. (x, xa) \<in> convex hull s \<times> t}
 2. convex {x. (x, y) \<in> convex hull s \<times> t}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
convex (Pair (0::'a) -` (+) (- x, 0::'b) ` (convex hull s \<times> t))

goal (2 subgoals):
 1. \<And>x. x \<in> s \<Longrightarrow> convex {xa. (x, xa) \<in> convex hull s \<times> t}
 2. convex {x. (x, y) \<in> convex hull s \<times> t}
[PROOF STEP]
have "?S = {y. (x, y) \<in> convex hull (s \<times> t)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Pair (0::'a) -` (+) (- x, 0::'b) ` (convex hull s \<times> t) = {y. (x, y) \<in> convex hull s \<times> t}
[PROOF STEP]
by (auto simp: image_def Bex_def)
[PROOF STATE]
proof (state)
this:
Pair (0::'a) -` (+) (- x, 0::'b) ` (convex hull s \<times> t) = {y. (x, y) \<in> convex hull s \<times> t}

goal (2 subgoals):
 1. \<And>x. x \<in> s \<Longrightarrow> convex {xa. (x, xa) \<in> convex hull s \<times> t}
 2. convex {x. (x, y) \<in> convex hull s \<times> t}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
convex {y. (x, y) \<in> convex hull s \<times> t}
[PROOF STEP]
show "convex {y. (x, y) \<in> convex hull (s \<times> t)}"
[PROOF STATE]
proof (prove)
using this:
convex {y. (x, y) \<in> convex hull s \<times> t}

goal (1 subgoal):
 1. convex {y. (x, y) \<in> convex hull s \<times> t}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
convex {y. (x, y) \<in> convex hull s \<times> t}

goal (1 subgoal):
 1. convex {x. (x, y) \<in> convex hull s \<times> t}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex {x. (x, y) \<in> convex hull s \<times> t}
[PROOF STEP]
show "convex {x. (x, y) \<in> convex hull s \<times> t}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex {x. (x, y) \<in> convex hull s \<times> t}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex {x. (x, y) \<in> convex hull s \<times> t}
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex {x. (x, y__) \<in> convex hull s \<times> t}
[PROOF STEP]
let ?S = "((\<lambda>x. (x, 0)) -` (\<lambda>p. (0, - y) + p) ` (convex hull s \<times> t))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex {x. (x, y__) \<in> convex hull s \<times> t}
[PROOF STEP]
have "convex ?S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex ((\<lambda>x. (x, 0::'b)) -` (+) (0::'a, - y) ` (convex hull s \<times> t))
[PROOF STEP]
by (intro convex_linear_vimage convex_translation convex_convex_hull,
        simp add: linear_iff)
[PROOF STATE]
proof (state)
this:
convex ((\<lambda>x. (x, 0::'b)) -` (+) (0::'a, - y) ` (convex hull s \<times> t))

goal (1 subgoal):
 1. convex {x. (x, y__) \<in> convex hull s \<times> t}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
convex ((\<lambda>x. (x, 0::'b)) -` (+) (0::'a, - y) ` (convex hull s \<times> t))

goal (1 subgoal):
 1. convex {x. (x, y__) \<in> convex hull s \<times> t}
[PROOF STEP]
have "?S = {x. (x, y) \<in> convex hull (s \<times> t)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (x, 0::'b)) -` (+) (0::'a, - y) ` (convex hull s \<times> t) = {x. (x, y) \<in> convex hull s \<times> t}
[PROOF STEP]
by (auto simp: image_def Bex_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. (x, 0::'b)) -` (+) (0::'a, - y) ` (convex hull s \<times> t) = {x. (x, y) \<in> convex hull s \<times> t}

goal (1 subgoal):
 1. convex {x. (x, y__) \<in> convex hull s \<times> t}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
convex {x. (x, y) \<in> convex hull s \<times> t}
[PROOF STEP]
show "convex {x. (x, y) \<in> convex hull (s \<times> t)}"
[PROOF STATE]
proof (prove)
using this:
convex {x. (x, y) \<in> convex hull s \<times> t}

goal (1 subgoal):
 1. convex {x. (x, y) \<in> convex hull s \<times> t}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
convex {x. (x, y) \<in> convex hull s \<times> t}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
convex {x. (x, y) \<in> convex hull s \<times> t}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> convex hull s; ?y \<in> convex hull t\<rbrakk> \<Longrightarrow> (?x, ?y) \<in> convex hull s \<times> t

goal (1 subgoal):
 1. (convex hull s) \<times> (convex hull t) \<subseteq> convex hull s \<times> t
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?x \<in> convex hull s; ?y \<in> convex hull t\<rbrakk> \<Longrightarrow> (?x, ?y) \<in> convex hull s \<times> t
[PROOF STEP]
show "(convex hull s) \<times> (convex hull t) \<subseteq> convex hull (s \<times> t)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> convex hull s; ?y \<in> convex hull t\<rbrakk> \<Longrightarrow> (?x, ?y) \<in> convex hull s \<times> t

goal (1 subgoal):
 1. (convex hull s) \<times> (convex hull t) \<subseteq> convex hull s \<times> t
[PROOF STEP]
unfolding subset_eq split_paired_Ball_Sigma
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> convex hull s; ?y \<in> convex hull t\<rbrakk> \<Longrightarrow> (?x, ?y) \<in> convex hull s \<times> t

goal (1 subgoal):
 1. \<forall>x\<in>convex hull s. \<forall>y\<in>convex hull t. (x, y) \<in> convex hull s \<times> t
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(convex hull s) \<times> (convex hull t) \<subseteq> convex hull s \<times> t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma i_Exec_Stream_Acc_Output_eq_last_message_hold: "0 < k \<Longrightarrow>
  i_Exec_Comp_Stream_Acc_Output k output_fun trans_fun input c =
  (output_fun \<circ> (i_Exec_Comp_Stream trans_fun (input \<odot>\<^sub>i k) c)) \<longmapsto>\<^sub>i k \<div>\<^bsub>il\<^esub> k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> i_Exec_Comp_Stream_Acc_Output k output_fun trans_fun input c = (output_fun \<circ> i_Exec_Comp_Stream trans_fun (input \<odot> k) c) \<longmapsto> k \<div>\<^sub>l k
[PROOF STEP]
by (simp add: i_Exec_Comp_Stream_Acc_Output_def i_shrink_eq_i_last_message_hold_shrink_last)


[STATEMENT]
lemma f_diff_card_eq:
  assumes "A \<subseteq> G"
  shows "\<forall> x \<in> differenceset A A. (f_diff x A)^2 =
    card {(a, b, c, d) | a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and>
    additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>differenceset A A. (f_diff x A)\<^sup>2 = card {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> differenceset A A \<Longrightarrow> (f_diff x A)\<^sup>2 = card {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> differenceset A A \<Longrightarrow> (f_diff x A)\<^sup>2 = card {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
[PROOF STEP]
assume "x \<in> differenceset A A"
[PROOF STATE]
proof (state)
this:
x \<in> differenceset A A

goal (1 subgoal):
 1. \<And>x. x \<in> differenceset A A \<Longrightarrow> (f_diff x A)\<^sup>2 = card {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
[PROOF STEP]
define C where hC: "C= {(a, b, c, d) | a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x }"
[PROOF STATE]
proof (state)
this:
C = {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}

goal (1 subgoal):
 1. \<And>x. x \<in> differenceset A A \<Longrightarrow> (f_diff x A)\<^sup>2 = card {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
[PROOF STEP]
define f:: "'a \<times> 'a \<times> 'a \<times> 'a \<Rightarrow> ('a \<times> 'a) \<times> ('a \<times> 'a)" where "f = (\<lambda> (a, b, c, d). ((a, c), (d, b)))"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>(a, b, c, d). ((a, c), d, b))

goal (1 subgoal):
 1. \<And>x. x \<in> differenceset A A \<Longrightarrow> (f_diff x A)\<^sup>2 = card {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
[PROOF STEP]
have hfinj: "inj_on f C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f C
[PROOF STEP]
using f_def
[PROOF STATE]
proof (prove)
using this:
f = (\<lambda>(a, b, c, d). ((a, c), d, b))

goal (1 subgoal):
 1. inj_on f C
[PROOF STEP]
by (intro inj_onI) (auto)
[PROOF STATE]
proof (state)
this:
inj_on f C

goal (1 subgoal):
 1. \<And>x. x \<in> differenceset A A \<Longrightarrow> (f_diff x A)\<^sup>2 = card {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
[PROOF STEP]
have "f ` C = {((a,c), (d,b)) | a b c d.
    a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` C = {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f ` C \<subseteq> {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
 2. {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x} \<subseteq> f ` C
[PROOF STEP]
show "f ` C \<subseteq> {((a, c), (d, b)) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` C \<subseteq> {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
[PROOF STEP]
unfolding f_def hC
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(a, b, c, d). ((a, c), d, b)) ` {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x} \<subseteq> {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f ` C \<subseteq> {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x}

goal (1 subgoal):
 1. {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x} \<subseteq> f ` C
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x} \<subseteq> f ` C
[PROOF STEP]
show "{((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x} \<subseteq> f ` C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x} \<subseteq> f ` C
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x} \<Longrightarrow> xa \<in> f ` C
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x} \<Longrightarrow> xa \<in> f ` C
[PROOF STEP]
assume "z \<in> {((a, c), (d, b)) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x}"
[PROOF STATE]
proof (state)
this:
z \<in> {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x}

goal (1 subgoal):
 1. \<And>xa. xa \<in> {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x} \<Longrightarrow> xa \<in> f ` C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
z \<in> {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
[PROOF STEP]
obtain a b c d where hz: "z = ((a, c), (d, b))" and ha: "a \<in> A" and hb: "b \<in> A" and hc: "c \<in> A" and hd: "d \<in> A"
        and hab: "a \<ominus> c = x" and hcd: "d \<ominus> b = x"
[PROOF STATE]
proof (prove)
using this:
z \<in> {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x}

goal (1 subgoal):
 1. (\<And>a c d b. \<lbrakk>z = ((a, c), d, b); a \<in> A; b \<in> A; c \<in> A; d \<in> A; a \<ominus> c = x; d \<ominus> b = x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
z = ((a, c), d, b)
a \<in> A
b \<in> A
c \<in> A
d \<in> A
a \<ominus> c = x
d \<ominus> b = x

goal (1 subgoal):
 1. \<And>xa. xa \<in> {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x} \<Longrightarrow> xa \<in> f ` C
[PROOF STEP]
have "additive_quadruple a b c d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. additive_quadruple a b c d
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> G

goal (1 subgoal):
 1. additive_quadruple a b c d
[PROOF STEP]
by (metis (no_types, lifting) ha hb hc hd additive_quadruple_def associative
        commutative composition_closed hab hcd inverse_closed invertible invertible_right_inverse2 subset_eq)
[PROOF STATE]
proof (state)
this:
additive_quadruple a b c d

goal (1 subgoal):
 1. \<And>xa. xa \<in> {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x} \<Longrightarrow> xa \<in> f ` C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
additive_quadruple a b c d
[PROOF STEP]
have habcd: "(a, b, c, d) \<in> C"
[PROOF STATE]
proof (prove)
using this:
additive_quadruple a b c d

goal (1 subgoal):
 1. (a, b, c, d) \<in> C
[PROOF STEP]
using hab hcd hC ha hb hc hd
[PROOF STATE]
proof (prove)
using this:
additive_quadruple a b c d
a \<ominus> c = x
d \<ominus> b = x
C = {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
a \<in> A
b \<in> A
c \<in> A
d \<in> A

goal (1 subgoal):
 1. (a, b, c, d) \<in> C
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(a, b, c, d) \<in> C

goal (1 subgoal):
 1. \<And>xa. xa \<in> {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x} \<Longrightarrow> xa \<in> f ` C
[PROOF STEP]
show "z \<in> f ` C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<in> f ` C
[PROOF STEP]
using hz f_def habcd image_iff
[PROOF STATE]
proof (prove)
using this:
z = ((a, c), d, b)
f = (\<lambda>(a, b, c, d). ((a, c), d, b))
(a, b, c, d) \<in> C
(?z \<in> ?f ` ?A) = (\<exists>x\<in>?A. ?z = ?f x)

goal (1 subgoal):
 1. z \<in> f ` C
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
z \<in> f ` C

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x} \<subseteq> f ` C

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f ` C = {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x}

goal (1 subgoal):
 1. \<And>x. x \<in> differenceset A A \<Longrightarrow> (f_diff x A)\<^sup>2 = card {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f ` C = {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x}

goal (1 subgoal):
 1. \<And>x. x \<in> differenceset A A \<Longrightarrow> (f_diff x A)\<^sup>2 = card {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
[PROOF STEP]
have "{((a, c), (d, b))|a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x} =
  {(a, c) | a c. a \<in> A \<and> c \<in> A \<and> a \<ominus> c = x} \<times> {(d, b) | d b. d \<in> A \<and> b \<in> A \<and> d \<ominus> b = x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x} = {(a, c) |a c. a \<in> A \<and> c \<in> A \<and> a \<ominus> c = x} \<times> {(d, b) |d b. d \<in> A \<and> b \<in> A \<and> d \<ominus> b = x}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x} = {(a, c) |a c. a \<in> A \<and> c \<in> A \<and> a \<ominus> c = x} \<times> {(d, b) |d b. d \<in> A \<and> b \<in> A \<and> d \<ominus> b = x}

goal (1 subgoal):
 1. \<And>x. x \<in> differenceset A A \<Longrightarrow> (f_diff x A)\<^sup>2 = card {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x} = {(a, c) |a c. a \<in> A \<and> c \<in> A \<and> a \<ominus> c = x} \<times> {(d, b) |d b. d \<in> A \<and> b \<in> A \<and> d \<ominus> b = x}

goal (1 subgoal):
 1. \<And>x. x \<in> differenceset A A \<Longrightarrow> (f_diff x A)\<^sup>2 = card {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
[PROOF STEP]
have "card C = card (f ` C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card C = card (f ` C)
[PROOF STEP]
using hfinj card_image[of "f"]
[PROOF STATE]
proof (prove)
using this:
inj_on f C
inj_on f ?A \<Longrightarrow> card (f ` ?A) = card ?A

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

goal (1 subgoal):
 1. \<And>x. x \<in> differenceset A A \<Longrightarrow> (f_diff x A)\<^sup>2 = card {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
f ` C = {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
{((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x} = {(a, c) |a c. a \<in> A \<and> c \<in> A \<and> a \<ominus> c = x} \<times> {(d, b) |d b. d \<in> A \<and> b \<in> A \<and> d \<ominus> b = x}
card C = card (f ` C)
[PROOF STEP]
have "card C =  card ({(a, c) | a c. a \<in> A \<and> c \<in> A \<and> a \<ominus> c = x}) ^ 2"
[PROOF STATE]
proof (prove)
using this:
f ` C = {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
{((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x} = {(a, c) |a c. a \<in> A \<and> c \<in> A \<and> a \<ominus> c = x} \<times> {(d, b) |d b. d \<in> A \<and> b \<in> A \<and> d \<ominus> b = x}
card C = card (f ` C)

goal (1 subgoal):
 1. card C = (card {(a, c) |a c. a \<in> A \<and> c \<in> A \<and> a \<ominus> c = x})\<^sup>2
[PROOF STEP]
using hfinj card_image[of "f"] card_cartesian_product Sigma_cong power2_eq_square
[PROOF STATE]
proof (prove)
using this:
f ` C = {((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
{((a, c), d, b) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> a \<ominus> c = x \<and> d \<ominus> b = x} = {(a, c) |a c. a \<in> A \<and> c \<in> A \<and> a \<ominus> c = x} \<times> {(d, b) |d b. d \<in> A \<and> b \<in> A \<and> d \<ominus> b = x}
card C = card (f ` C)
inj_on f C
inj_on f ?A \<Longrightarrow> card (f ` ?A) = card ?A
card (?A \<times> ?B) = card ?A * card ?B
\<lbrakk>?A = ?B; \<And>x. x \<in> ?B \<Longrightarrow> ?C x = ?D x\<rbrakk> \<Longrightarrow> Sigma ?A ?C = Sigma ?B ?D
?a\<^sup>2 = ?a * ?a

goal (1 subgoal):
 1. card C = (card {(a, c) |a c. a \<in> A \<and> c \<in> A \<and> a \<ominus> c = x})\<^sup>2
[PROOF STEP]
by (smt (verit, best))
[PROOF STATE]
proof (state)
this:
card C = (card {(a, c) |a c. a \<in> A \<and> c \<in> A \<and> a \<ominus> c = x})\<^sup>2

goal (1 subgoal):
 1. \<And>x. x \<in> differenceset A A \<Longrightarrow> (f_diff x A)\<^sup>2 = card {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
[PROOF STEP]
thus "(f_diff x A)\<^sup>2 = card  {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}"
[PROOF STATE]
proof (prove)
using this:
card C = (card {(a, c) |a c. a \<in> A \<and> c \<in> A \<and> a \<ominus> c = x})\<^sup>2

goal (1 subgoal):
 1. (f_diff x A)\<^sup>2 = card {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
[PROOF STEP]
using f_diff_def hC
[PROOF STATE]
proof (prove)
using this:
card C = (card {(a, c) |a c. a \<in> A \<and> c \<in> A \<and> a \<ominus> c = x})\<^sup>2
f_diff ?d ?A \<equiv> card {(a, b) |a b. a \<in> ?A \<and> b \<in> ?A \<and> a \<ominus> b = ?d}
C = {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}

goal (1 subgoal):
 1. (f_diff x A)\<^sup>2 = card {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(f_diff x A)\<^sup>2 = card {(a, b, c, d) |a b c d. a \<in> A \<and> b \<in> A \<and> c \<in> A \<and> d \<in> A \<and> additive_quadruple a b c d \<and> a \<ominus> c = x \<and> d \<ominus> b = x}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma [code]: "iarray_to_vec v + iarray_to_vec u = (Matrix_To_IArray.iarray_to_vec (Rep_iarray_type v + Rep_iarray_type u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Code_DP.iarray_to_vec v + Code_DP.iarray_to_vec u = Matrix_To_IArray.iarray_to_vec (Rep_iarray_type v + Rep_iarray_type u)
[PROOF STEP]
by (metis (no_types, lifting) Matrix_To_IArray.vec_to_iarray_def iarray_to_vec_vec_to_iarray vec_to_iarray.rep_eq vec_to_iarray_inv vec_to_iarray_plus)


[STATEMENT]
lemma Brouwer_degree2_id [simp]: "Brouwer_degree2 p id = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Brouwer_degree2 p id = 1
[PROOF STEP]
proof (rule Brouwer_degree2_unique)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. continuous_map (nsphere p) (nsphere p) id
 2. \<And>x. x \<in> carrier (reduced_homology_group (int p) (nsphere p)) \<Longrightarrow> hom_induced (int p) (nsphere p) {} (nsphere p) {} id x = x [^]\<^bsub>reduced_homology_group (int p) (nsphere p)\<^esub> 1
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. continuous_map (nsphere p) (nsphere p) id
 2. \<And>x. x \<in> carrier (reduced_homology_group (int p) (nsphere p)) \<Longrightarrow> hom_induced (int p) (nsphere p) {} (nsphere p) {} id x = x [^]\<^bsub>reduced_homology_group (int p) (nsphere p)\<^esub> 1
[PROOF STEP]
assume x: "x \<in> carrier (reduced_homology_group (int p) (nsphere p))"
[PROOF STATE]
proof (state)
this:
x \<in> carrier (reduced_homology_group (int p) (nsphere p))

goal (2 subgoals):
 1. continuous_map (nsphere p) (nsphere p) id
 2. \<And>x. x \<in> carrier (reduced_homology_group (int p) (nsphere p)) \<Longrightarrow> hom_induced (int p) (nsphere p) {} (nsphere p) {} id x = x [^]\<^bsub>reduced_homology_group (int p) (nsphere p)\<^esub> 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier (reduced_homology_group (int p) (nsphere p))
[PROOF STEP]
have "x \<in> carrier (homology_group (int p) (nsphere p))"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier (reduced_homology_group (int p) (nsphere p))

goal (1 subgoal):
 1. x \<in> carrier (homology_group (int p) (nsphere p))
[PROOF STEP]
using carrier_reduced_homology_group_subset
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier (reduced_homology_group (int p) (nsphere p))
carrier (reduced_homology_group ?p ?X) \<subseteq> carrier (homology_group ?p ?X)

goal (1 subgoal):
 1. x \<in> carrier (homology_group (int p) (nsphere p))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> carrier (homology_group (int p) (nsphere p))

goal (2 subgoals):
 1. continuous_map (nsphere p) (nsphere p) id
 2. \<And>x. x \<in> carrier (reduced_homology_group (int p) (nsphere p)) \<Longrightarrow> hom_induced (int p) (nsphere p) {} (nsphere p) {} id x = x [^]\<^bsub>reduced_homology_group (int p) (nsphere p)\<^esub> 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier (homology_group (int p) (nsphere p))
[PROOF STEP]
show "hom_induced (int p) (nsphere p) {} (nsphere p) {} id x =
        x [^]\<^bsub>reduced_homology_group (int p) (nsphere p)\<^esub> (1::int)"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier (homology_group (int p) (nsphere p))

goal (1 subgoal):
 1. hom_induced (int p) (nsphere p) {} (nsphere p) {} id x = x [^]\<^bsub>reduced_homology_group (int p) (nsphere p)\<^esub> 1
[PROOF STEP]
by (simp add: hom_induced_id group.int_pow_1 x)
[PROOF STATE]
proof (state)
this:
hom_induced (int p) (nsphere p) {} (nsphere p) {} id x = x [^]\<^bsub>reduced_homology_group (int p) (nsphere p)\<^esub> 1

goal (1 subgoal):
 1. continuous_map (nsphere p) (nsphere p) id
[PROOF STEP]
qed auto


[STATEMENT]
lemma not_empty_ex: "A \<noteq> {} \<Longrightarrow> ? x. x \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> \<exists>x. x \<in> A
[PROOF STEP]
by force


[STATEMENT]
lemma ACC_cf_SET[simp]:
  "ACC_cf (SET (Var x)) = {f \<in> \<F>. \<pi> x \<in> C f}"
  "ACC_cf (SET FALSE) = {}"
  "ACC_cf (SET (Disj \<phi> \<psi>)) = ACC_cf (SET \<phi>) \<union> ACC_cf (SET \<psi>)"
  "ACC_cf (SET (Conj \<phi> \<psi>)) = ACC_cf (SET \<phi>) \<inter> ACC_cf (SET \<psi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ACC_cf (SET (Var x)) = {f \<in> \<F>. \<pi> x \<in> C f} &&& ACC_cf (SET FALSE) = {}) &&& ACC_cf (SET (Disj \<phi> \<psi>)) = ACC_cf (SET \<phi>) \<union> ACC_cf (SET \<psi>) &&& ACC_cf (SET (Conj \<phi> \<psi>)) = ACC_cf (SET \<phi>) \<inter> ACC_cf (SET \<psi>)
[PROOF STEP]
using ACC_cf_odot
[PROOF STATE]
proof (prove)
using this:
ACC_cf (?X \<odot> ?Y) = ACC_cf ?X \<inter> ACC_cf ?Y

goal (1 subgoal):
 1. (ACC_cf (SET (Var x)) = {f \<in> \<F>. \<pi> x \<in> C f} &&& ACC_cf (SET FALSE) = {}) &&& ACC_cf (SET (Disj \<phi> \<psi>)) = ACC_cf (SET \<phi>) \<union> ACC_cf (SET \<psi>) &&& ACC_cf (SET (Conj \<phi> \<psi>)) = ACC_cf (SET \<phi>) \<inter> ACC_cf (SET \<psi>)
[PROOF STEP]
by (auto simp: ACC_cf_union ACC_cf_empty, auto simp: ACC_cf_def accepts_def)


[STATEMENT]
lemma ListSum_add:
  "(\<Sum>\<^bsub>x \<in> V\<^esub> f x) + (\<Sum>\<^bsub>x \<in> V\<^esub> g x) = (\<Sum>\<^bsub>x \<in> V\<^esub> (f x + (g x::nat)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ListSum V f + ListSum V g = (\<Sum>\<^bsub>x\<in>V\<^esub> f x + g x)
[PROOF STEP]
by (induct V) auto


[STATEMENT]
lemma valid_prefix_ipset_from_netmask_ipset_from_cidr:
    shows "ipset_from_netmask (pfxm_prefix pfx) (NOT (pfxm_mask pfx)) =
            ipset_from_cidr (pfxm_prefix pfx) (pfxm_length pfx)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ipset_from_netmask (pfxm_prefix pfx) (~~ pfxm_mask pfx) = ipset_from_cidr (pfxm_prefix pfx) (pfxm_length pfx)
[PROOF STEP]
apply(cases pfx)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x1 x2. pfx = PrefixMatch x1 x2 \<Longrightarrow> ipset_from_netmask (pfxm_prefix pfx) (~~ pfxm_mask pfx) = ipset_from_cidr (pfxm_prefix pfx) (pfxm_length pfx)
[PROOF STEP]
apply(simp add: ipset_from_cidr_alt2 pfxm_mask_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma amor_del_Some:
  "del x t = Some t' \<Longrightarrow>
  T_del x t + \<Phi> t' - \<Phi> t \<le> (6*e + 1) * height t + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. del x t = Some t' \<Longrightarrow> real (T_del x t) + \<Phi> t' - \<Phi> t \<le> (6 * e + 1) * real (height t) + 1
[PROOF STEP]
apply(drule Phi_diff_del_Some)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Phi> t' - \<Phi> t \<le> 6 * e * real (height t) \<Longrightarrow> real (T_del x t) + \<Phi> t' - \<Phi> t \<le> (6 * e + 1) * real (height t) + 1
[PROOF STEP]
using T_del_ub[of x t]
[PROOF STATE]
proof (prove)
using this:
T_del x t \<le> height t + 1

goal (1 subgoal):
 1. \<Phi> t' - \<Phi> t \<le> 6 * e * real (height t) \<Longrightarrow> real (T_del x t) + \<Phi> t' - \<Phi> t \<le> (6 * e + 1) * real (height t) + 1
[PROOF STEP]
by (simp add: ring_distribs)


[STATEMENT]
lemma "(\<not> ((a1 \<and> a2) \<or> b \<or> c)) = ((\<not>a1 \<and> \<not> b \<and> \<not> c) \<or> (\<not>a2 \<and> \<not> b \<and> \<not> c))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> (a1 \<and> a2 \<or> b \<or> c)) = (\<not> a1 \<and> \<not> b \<and> \<not> c \<or> \<not> a2 \<and> \<not> b \<and> \<not> c)
[PROOF STEP]
by blast


[STATEMENT]
lemma seq_comp:
  fixes \<sigma> :: "'a seq"
  fixes P :: "'b seq_pred"
  fixes f :: "'a \<Rightarrow> 'b"
  shows
    "(\<box>P) (f \<circ> \<sigma>) \<longleftrightarrow> (\<box>(\<lambda>\<sigma>. P (f \<circ> \<sigma>))) \<sigma>"
    "(\<diamond>P) (f \<circ> \<sigma>) \<longleftrightarrow> (\<diamond>(\<lambda>\<sigma>. P (f \<circ> \<sigma>))) \<sigma>"
    "(P \<U> Q) (f \<circ> \<sigma>) \<longleftrightarrow> ((\<lambda>\<sigma>. P (f \<circ> \<sigma>)) \<U> (\<lambda>\<sigma>. Q (f \<circ> \<sigma>))) \<sigma>"
    "(P \<W> Q) (f \<circ> \<sigma>) \<longleftrightarrow> ((\<lambda>\<sigma>. P (f \<circ> \<sigma>)) \<W> (\<lambda>\<sigma>. Q (f \<circ> \<sigma>))) \<sigma>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<box>P) (f \<circ> \<sigma>) = (\<box>(\<lambda>\<sigma>. P (f \<circ> \<sigma>))) \<sigma> &&& (\<diamond>P) (f \<circ> \<sigma>) = (\<diamond>(\<lambda>\<sigma>. P (f \<circ> \<sigma>))) \<sigma>) &&& (P \<U> Q) (f \<circ> \<sigma>) = ((\<lambda>\<sigma>. P (f \<circ> \<sigma>)) \<U> (\<lambda>\<sigma>. Q (f \<circ> \<sigma>))) \<sigma> &&& (P \<W> Q) (f \<circ> \<sigma>) = ((\<lambda>\<sigma>. P (f \<circ> \<sigma>)) \<W> (\<lambda>\<sigma>. Q (f \<circ> \<sigma>))) \<sigma>
[PROOF STEP]
unfolding defs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>i. P ((f \<circ> \<sigma>) |\<^sub>s i)) = (\<forall>i. P (f \<circ> \<sigma> |\<^sub>s i)) &&& (\<exists>i. P ((f \<circ> \<sigma>) |\<^sub>s i) \<and> (\<forall>k<i. True)) = (\<exists>i. P (f \<circ> \<sigma> |\<^sub>s i) \<and> (\<forall>k<i. True))) &&& (\<exists>i. Q ((f \<circ> \<sigma>) |\<^sub>s i) \<and> (\<forall>k<i. P ((f \<circ> \<sigma>) |\<^sub>s k))) = (\<exists>i. Q (f \<circ> \<sigma> |\<^sub>s i) \<and> (\<forall>k<i. P (f \<circ> \<sigma> |\<^sub>s k))) &&& ((\<exists>i. Q ((f \<circ> \<sigma>) |\<^sub>s i) \<and> (\<forall>k<i. P ((f \<circ> \<sigma>) |\<^sub>s k))) \<or> (\<forall>i. P ((f \<circ> \<sigma>) |\<^sub>s i))) = ((\<exists>i. Q (f \<circ> \<sigma> |\<^sub>s i) \<and> (\<forall>k<i. P (f \<circ> \<sigma> |\<^sub>s k))) \<or> (\<forall>i. P (f \<circ> \<sigma> |\<^sub>s i)))
[PROOF STEP]
by simp_all


[STATEMENT]
lemma semilattice_transfer[transfer_rule]:
  assumes [transfer_rule]: "bi_unique A" "right_total A"
  shows
    "((A ===> A ===> A) ===> (=))
      (\<lambda>f. semilattice_ow (Collect (Domainp A)) f) semilattice"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((A ===> A ===> A) ===> (=)) (semilattice_ow (Collect (Domainp A))) semilattice
[PROOF STEP]
unfolding
    semilattice_ow_def semilattice_def
    semilattice_ow_axioms_def semilattice_axioms_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((A ===> A ===> A) ===> (=)) (\<lambda>f. abel_semigroup_ow (Collect (Domainp A)) f \<and> (\<forall>x. x \<in> Collect (Domainp A) \<longrightarrow> f x x = x)) (\<lambda>f. abel_semigroup f \<and> (\<forall>a. f a a = a))
[PROOF STEP]
apply transfer_prover_start
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. Transfer.Rel (A ===> A ===> ?Rh11) ?ac11 (=)
 2. Transfer.Rel ((A ===> ?Rh11) ===> ?Rf11) ?ab11 All
 3. Transfer.Rel ((A ===> A ===> A) ===> ?Re11) ?aa11 abel_semigroup
 4. Transfer.Rel (?Re11 ===> ?Rf11 ===> (=)) ?a11 (\<and>)
 5. (\<lambda>f. abel_semigroup_ow (Collect (Domainp A)) f \<and> (\<forall>x. x \<in> Collect (Domainp A) \<longrightarrow> f x x = x)) = (\<lambda>f. ?a11 (?aa11 f) (?ab11 (\<lambda>a. ?ac11 (f a a) a)))
[PROOF STEP]
apply transfer_step+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>f. abel_semigroup_ow (Collect (Domainp A)) f \<and> (\<forall>x. x \<in> Collect (Domainp A) \<longrightarrow> f x x = x)) = (\<lambda>f. abel_semigroup_ow (Collect (Domainp A)) f \<and> (\<forall>a\<in>Collect (Domainp A). f a a = a))
[PROOF STEP]
by simp


[STATEMENT]
lemma sorted_wrt_mono_rel:
  "(\<And>x y. \<lbrakk> x \<in> set xs; y \<in> set xs; P x y \<rbrakk> \<Longrightarrow> Q x y) \<Longrightarrow> sorted_wrt P xs \<Longrightarrow> sorted_wrt Q xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x y. \<lbrakk>x \<in> set xs; y \<in> set xs; P x y\<rbrakk> \<Longrightarrow> Q x y; sorted_wrt P xs\<rbrakk> \<Longrightarrow> sorted_wrt Q xs
[PROOF STEP]
by(induction xs)(auto)


[STATEMENT]
lemma prefixElementsAreTrailElements:
  assumes
  "isPrefix p M"
  shows
  "set (elements p) \<subseteq> set (elements M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (elements p) \<subseteq> set (elements M)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
isPrefix p M

goal (1 subgoal):
 1. set (elements p) \<subseteq> set (elements M)
[PROOF STEP]
unfolding isPrefix_def
[PROOF STATE]
proof (prove)
using this:
\<exists>s. p @ s = M

goal (1 subgoal):
 1. set (elements p) \<subseteq> set (elements M)
[PROOF STEP]
by auto


[STATEMENT]
theorem T_list_fast_rec_ub:
  "T_list_fast_rec ts \<le> sum_list (map (\<lambda>t. 7*size t + 1) ts)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
proof (induction ts rule: measure_induct_rule[where f="sum_list o map size"])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (\<And>y. (sum_list \<circ> map size) y < (sum_list \<circ> map size) x \<Longrightarrow> T_list_fast_rec y \<le> (\<Sum>t\<leftarrow>y. 7 * size t + 1)) \<Longrightarrow> T_list_fast_rec x \<le> (\<Sum>t\<leftarrow>x. 7 * size t + 1)
[PROOF STEP]
case (less ts)
[PROOF STATE]
proof (state)
this:
(sum_list \<circ> map size) ?y < (sum_list \<circ> map size) ts \<Longrightarrow> T_list_fast_rec ?y \<le> (\<Sum>t\<leftarrow>?y. 7 * size t + 1)

goal (1 subgoal):
 1. \<And>x. (\<And>y. (sum_list \<circ> map size) y < (sum_list \<circ> map size) x \<Longrightarrow> T_list_fast_rec y \<le> (\<Sum>t\<leftarrow>y. 7 * size t + 1)) \<Longrightarrow> T_list_fast_rec x \<le> (\<Sum>t\<leftarrow>x. 7 * size t + 1)
[PROOF STEP]
let ?us = "filter (\<lambda>t. t \<noteq> Leaf) ts"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (\<And>y. (sum_list \<circ> map size) y < (sum_list \<circ> map size) x \<Longrightarrow> T_list_fast_rec y \<le> (\<Sum>t\<leftarrow>y. 7 * size t + 1)) \<Longrightarrow> T_list_fast_rec x \<le> (\<Sum>t\<leftarrow>x. 7 * size t + 1)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
 2. \<not> ?P \<Longrightarrow> T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
assume "?us = []"
[PROOF STATE]
proof (state)
this:
filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts = []

goal (2 subgoals):
 1. ?P \<Longrightarrow> T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
 2. \<not> ?P \<Longrightarrow> T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts = []

goal (1 subgoal):
 1. T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
using T_list_fast_rec.simps[of ts]
[PROOF STATE]
proof (prove)
using this:
filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts = []
T_list_fast_rec ts = (let us = filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts in length ts + (if us = [] then 0 else 5 * length us + T_list_fast_rec (map left us @ map right us)))

goal (1 subgoal):
 1. T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
by(simp add: sum_list_Suc)
[PROOF STATE]
proof (state)
this:
T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)

goal (1 subgoal):
 1. filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts \<noteq> [] \<Longrightarrow> T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts \<noteq> [] \<Longrightarrow> T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
assume "?us \<noteq> []"
[PROOF STATE]
proof (state)
this:
filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts \<noteq> []

goal (1 subgoal):
 1. filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts \<noteq> [] \<Longrightarrow> T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
let ?children = "map left ?us @ map right ?us"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts \<noteq> [] \<Longrightarrow> T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
have "T_list_fast_rec ts = T_list_fast_rec ?children + 5 * length ?us + length ts"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T_list_fast_rec ts = T_list_fast_rec (map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts)) + 5 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts
[PROOF STEP]
using \<open>?us \<noteq> []\<close> T_list_fast_rec.simps[of ts]
[PROOF STATE]
proof (prove)
using this:
filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts \<noteq> []
T_list_fast_rec ts = (let us = filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts in length ts + (if us = [] then 0 else 5 * length us + T_list_fast_rec (map left us @ map right us)))

goal (1 subgoal):
 1. T_list_fast_rec ts = T_list_fast_rec (map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts)) + 5 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts
[PROOF STEP]
by(simp)
[PROOF STATE]
proof (state)
this:
T_list_fast_rec ts = T_list_fast_rec (map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts)) + 5 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts

goal (1 subgoal):
 1. filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts \<noteq> [] \<Longrightarrow> T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
T_list_fast_rec ts = T_list_fast_rec (map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts)) + 5 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts

goal (1 subgoal):
 1. filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts \<noteq> [] \<Longrightarrow> T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
have "\<dots> \<le> (\<Sum>t\<leftarrow>?children. 7 * size t + 1) + 5 * length ?us + length ts"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T_list_fast_rec (map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts)) + 5 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts \<le> (\<Sum>t\<leftarrow>map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts). 7 * size t + 1) + 5 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts
[PROOF STEP]
using less[of "?children"] list_fast_rec_term[of "?us"] \<open>?us \<noteq> []\<close>
[PROOF STATE]
proof (prove)
using this:
(sum_list \<circ> map size) (map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts)) < (sum_list \<circ> map size) ts \<Longrightarrow> T_list_fast_rec (map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts)) \<le> (\<Sum>t\<leftarrow>map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts). 7 * size t + 1)
\<lbrakk>filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts \<noteq> []; filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts = filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ?ts\<rbrakk> \<Longrightarrow> sum_list (map (size \<circ> left) (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts)) + sum_list (map (size \<circ> right) (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts)) < sum_list (map size ?ts)
filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts \<noteq> []

goal (1 subgoal):
 1. T_list_fast_rec (map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts)) + 5 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts \<le> (\<Sum>t\<leftarrow>map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts). 7 * size t + 1) + 5 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
T_list_fast_rec (map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts)) + 5 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts \<le> (\<Sum>t\<leftarrow>map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts). 7 * size t + 1) + 5 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts

goal (1 subgoal):
 1. filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts \<noteq> [] \<Longrightarrow> T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
T_list_fast_rec (map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts)) + 5 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts \<le> (\<Sum>t\<leftarrow>map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts). 7 * size t + 1) + 5 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts

goal (1 subgoal):
 1. filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts \<noteq> [] \<Longrightarrow> T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
have "\<dots> = (\<Sum>t\<leftarrow>?children. 7*size t) + 7 * length ?us + length ts"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t\<leftarrow>map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts). 7 * size t + 1) + 5 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts = (\<Sum>t\<leftarrow>map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts). 7 * size t) + 7 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts
[PROOF STEP]
by(simp add: sum_list_Suc o_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>t\<leftarrow>map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts). 7 * size t + 1) + 5 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts = (\<Sum>t\<leftarrow>map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts). 7 * size t) + 7 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts

goal (1 subgoal):
 1. filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts \<noteq> [] \<Longrightarrow> T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>t\<leftarrow>map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts). 7 * size t + 1) + 5 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts = (\<Sum>t\<leftarrow>map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts). 7 * size t) + 7 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts

goal (1 subgoal):
 1. filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts \<noteq> [] \<Longrightarrow> T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
have "\<dots> = (\<Sum>t\<leftarrow>?us. 7*size t) + length ts"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t\<leftarrow>map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts). 7 * size t) + 7 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts = (\<Sum>t\<leftarrow>filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts. 7 * size t) + length ts
[PROOF STEP]
by(simp add: sum_tree_list_children)
[PROOF STATE]
proof (state)
this:
(\<Sum>t\<leftarrow>map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts). 7 * size t) + 7 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts = (\<Sum>t\<leftarrow>filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts. 7 * size t) + length ts

goal (1 subgoal):
 1. filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts \<noteq> [] \<Longrightarrow> T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>t\<leftarrow>map left (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) @ map right (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts). 7 * size t) + 7 * length (filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts) + length ts = (\<Sum>t\<leftarrow>filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts. 7 * size t) + length ts

goal (1 subgoal):
 1. filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts \<noteq> [] \<Longrightarrow> T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
have "\<dots> \<le> (\<Sum>t\<leftarrow>ts. 7*size t) + length ts"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t\<leftarrow>filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts. 7 * size t) + length ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t) + length ts
[PROOF STEP]
by(simp add: sum_list_filter_le_nat)
[PROOF STATE]
proof (state)
this:
(\<Sum>t\<leftarrow>filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts. 7 * size t) + length ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t) + length ts

goal (1 subgoal):
 1. filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts \<noteq> [] \<Longrightarrow> T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>t\<leftarrow>filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts. 7 * size t) + length ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t) + length ts

goal (1 subgoal):
 1. filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts \<noteq> [] \<Longrightarrow> T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
have "\<dots> = (\<Sum>t\<leftarrow>ts. 7 * size t + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t\<leftarrow>ts. 7 * size t) + length ts = (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
by(simp add: sum_list_Suc)
[PROOF STATE]
proof (state)
this:
(\<Sum>t\<leftarrow>ts. 7 * size t) + length ts = (\<Sum>t\<leftarrow>ts. 7 * size t + 1)

goal (1 subgoal):
 1. filter (\<lambda>t. t \<noteq> \<langle>\<rangle>) ts \<noteq> [] \<Longrightarrow> T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)

goal (1 subgoal):
 1. T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
T_list_fast_rec ts \<le> (\<Sum>t\<leftarrow>ts. 7 * size t + 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma X1_nonempty: "X1 \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X1 \<noteq> {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. X1 \<noteq> {}
[PROOF STEP]
define x where "x = ((\<chi> i. if i = undefined then 1 else 0) :: real ^ 'n)"
[PROOF STATE]
proof (state)
this:
x = (\<chi>i. if i = undefined then 1 else 0)

goal (1 subgoal):
 1. X1 \<noteq> {}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
x = (\<chi>i. if i = undefined then 1 else 0)

goal (1 subgoal):
 1. X1 \<noteq> {}
[PROOF STEP]
assume "x = 0"
[PROOF STATE]
proof (state)
this:
x = 0

goal (1 subgoal):
 1. X1 \<noteq> {}
[PROOF STEP]
from arg_cong[OF this, of "\<lambda> x. x $ undefined"]
[PROOF STATE]
proof (chain)
picking this:
x $h undefined = 0 $h undefined
[PROOF STEP]
have False
[PROOF STATE]
proof (prove)
using this:
x $h undefined = 0 $h undefined

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding x_def
[PROOF STATE]
proof (prove)
using this:
(\<chi>i. if i = undefined then 1 else 0) $h undefined = 0 $h undefined

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

goal (1 subgoal):
 1. X1 \<noteq> {}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
x = 0 \<Longrightarrow> False

goal (1 subgoal):
 1. X1 \<noteq> {}
[PROOF STEP]
hence x: "x \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
x = 0 \<Longrightarrow> False

goal (1 subgoal):
 1. x \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<noteq> 0

goal (1 subgoal):
 1. X1 \<noteq> {}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<noteq> 0

goal (1 subgoal):
 1. X1 \<noteq> {}
[PROOF STEP]
have "le_vec 0 x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. le_vec 0 x
[PROOF STEP]
unfolding x_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. le_vec 0 (\<chi>i. if i = undefined then 1 else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
le_vec 0 x

goal (1 subgoal):
 1. X1 \<noteq> {}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
le_vec 0 x

goal (1 subgoal):
 1. X1 \<noteq> {}
[PROOF STEP]
have "norm x = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm x = 1
[PROOF STEP]
unfolding norm_vec_def L2_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (\<Sum>i\<in>UNIV. (norm (x $h i))\<^sup>2) = 1
[PROOF STEP]
by (auto, subst sum.remove[of _ undefined], auto simp: x_def)
[PROOF STATE]
proof (state)
this:
norm x = 1

goal (1 subgoal):
 1. X1 \<noteq> {}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> 0
le_vec 0 x
norm x = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<noteq> 0
le_vec 0 x
norm x = 1

goal (1 subgoal):
 1. X1 \<noteq> {}
[PROOF STEP]
unfolding X1_def X_def
[PROOF STATE]
proof (prove)
using this:
x \<noteq> 0
le_vec 0 x
norm x = 1

goal (1 subgoal):
 1. {x. le_vec 0 x \<and> x \<noteq> 0} \<inter> {x. norm x = 1} \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
X1 \<noteq> {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Arg_rcis_cis[simp]: assumes "x > 0"
  shows "Arg (rcis x y) = Arg (cis y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg (rcis x y) = Arg (cis y)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. Arg (rcis x y) = Arg (cis y)
[PROOF STEP]
unfolding rcis_def
[PROOF STATE]
proof (prove)
using this:
0 < x

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


[STATEMENT]
lemma in_Sup_multiset_iff:
  assumes "subset_mset.bdd_above A"
  shows   "x \<in># Sup A \<longleftrightarrow> (\<exists>X\<in>A. x \<in># X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in># Sup A) = (\<exists>X\<in>A. x \<in># X)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x \<in># Sup A) = (\<exists>X\<in>A. x \<in># X)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
subset_mset.bdd_above A
[PROOF STEP]
have "set_mset (Sup A) = (\<Union>X\<in>A. set_mset X)"
[PROOF STATE]
proof (prove)
using this:
subset_mset.bdd_above A

goal (1 subgoal):
 1. set_mset (Sup A) = \<Union> (set_mset ` A)
[PROOF STEP]
by (rule set_mset_Sup)
[PROOF STATE]
proof (state)
this:
set_mset (Sup A) = \<Union> (set_mset ` A)

goal (1 subgoal):
 1. (x \<in># Sup A) = (\<exists>X\<in>A. x \<in># X)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set_mset (Sup A) = \<Union> (set_mset ` A)

goal (1 subgoal):
 1. (x \<in># Sup A) = (\<exists>X\<in>A. x \<in># X)
[PROOF STEP]
have "x \<in> \<dots> \<longleftrightarrow> (\<exists>X\<in>A. x \<in># X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> \<Union> (set_mset ` A)) = (\<exists>X\<in>A. x \<in># X)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(x \<in> \<Union> (set_mset ` A)) = (\<exists>X\<in>A. x \<in># X)

goal (1 subgoal):
 1. (x \<in># Sup A) = (\<exists>X\<in>A. x \<in># X)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(x \<in># Sup A) = (\<exists>X\<in>A. x \<in># X)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(x \<in># Sup A) = (\<exists>X\<in>A. x \<in># X)

goal (1 subgoal):
 1. (x \<in># Sup A) = (\<exists>X\<in>A. x \<in># X)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(x \<in># Sup A) = (\<exists>X\<in>A. x \<in># X)

goal:
No subgoals!
[PROOF STEP]
qed