[STATEMENT]
lemma atoms_nTimes: "atoms (nTimes r s) \<subseteq> atoms r \<union> atoms s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. atoms (nTimes r s) \<subseteq> atoms r \<union> atoms s
[PROOF STEP]
by (induction r s rule: nTimes.induct) auto


[STATEMENT]
lemma powhr_hlog_cancel [simp]: "\<And>a x. 0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> 0 < x \<Longrightarrow> a powhr (hlog a x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a x. \<lbrakk>0 < a; a \<noteq> 1; 0 < x\<rbrakk> \<Longrightarrow> a powhr hlog a x = x
[PROOF STEP]
by transfer simp


[STATEMENT]
lemma (in comm_monoid_add) sum_list_addf:
  "(\<Sum>x\<leftarrow>xs. f x + g x) = sum_list (map f xs) + sum_list (map g xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>xs. f x + g x) = sum_list (map f xs) + sum_list (map g xs)
[PROOF STEP]
by (induct xs) (simp_all add: algebra_simps)


[STATEMENT]
lemma integrable_on_insert_iff: "f integrable_on (insert x X) \<longleftrightarrow> f integrable_on X"
  for f::"_ \<Rightarrow> 'a::banach"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f integrable_on insert x X) = (f integrable_on X)
[PROOF STEP]
by (rule integrable_spike_set_eq) (auto simp: insert_Diff_if)


[STATEMENT]
lemma summable_mono_reindex:
  assumes subseq: "strict_mono g"
    and zero: "\<And>n. n \<notin> range g \<Longrightarrow> f n = 0"
  shows "summable (\<lambda>n. f (g n)) \<longleftrightarrow> summable f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. f (g n)) = summable f
[PROOF STEP]
using sums_mono_reindex[of g f, OF assms]
[PROOF STATE]
proof (prove)
using this:
(\<And>n. n \<notin> range g \<Longrightarrow> n \<notin> range g) \<Longrightarrow> (\<lambda>n. f (g n)) sums ?c = f sums ?c

goal (1 subgoal):
 1. summable (\<lambda>n. f (g n)) = summable f
[PROOF STEP]
by (simp add: summable_def)


[STATEMENT]
lemma diagonal_nonzero_ltN[simp]: "(a,b)\<in>mtx_nonzero (diagonalN k) \<Longrightarrow> a<N \<and> b<N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a, b) \<in> mtx_nonzero (diagonalN k) \<Longrightarrow> a < N \<and> b < N
[PROOF STEP]
by (auto simp: mtx_nonzero_def diagonalN_def split: if_split_asm)


[STATEMENT]
theorem product_associativity:
  "(\<exists>w. P w x \<and> P w y \<and> P w z) \<Longrightarrow> x \<otimes> (y \<otimes> z) = (x \<otimes> y) \<otimes> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>w. P w x \<and> P w y \<and> P w z \<Longrightarrow> x \<otimes> (y \<otimes> z) = (x \<otimes> y) \<otimes> z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>w. P w x \<and> P w y \<and> P w z \<Longrightarrow> x \<otimes> (y \<otimes> z) = (x \<otimes> y) \<otimes> z
[PROOF STEP]
assume ante:"(\<exists>w. P w x \<and> P w y \<and> P w z)"
[PROOF STATE]
proof (state)
this:
\<exists>w. P w x \<and> P w y \<and> P w z

goal (1 subgoal):
 1. \<exists>w. P w x \<and> P w y \<and> P w z \<Longrightarrow> x \<otimes> (y \<otimes> z) = (x \<otimes> y) \<otimes> z
[PROOF STEP]
hence "(\<forall>w. P w (x \<otimes> (y \<otimes> z)) \<longleftrightarrow> P w x \<and> (P w y \<and> P w z))"
[PROOF STATE]
proof (prove)
using this:
\<exists>w. P w x \<and> P w y \<and> P w z

goal (1 subgoal):
 1. \<forall>w. P w (x \<otimes> (y \<otimes> z)) = (P w x \<and> P w y \<and> P w z)
[PROOF STEP]
by (rule right_associated_product)
[PROOF STATE]
proof (state)
this:
\<forall>w. P w (x \<otimes> (y \<otimes> z)) = (P w x \<and> P w y \<and> P w z)

goal (1 subgoal):
 1. \<exists>w. P w x \<and> P w y \<and> P w z \<Longrightarrow> x \<otimes> (y \<otimes> z) = (x \<otimes> y) \<otimes> z
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>w. P w (x \<otimes> (y \<otimes> z)) = (P w x \<and> P w y \<and> P w z)

goal (1 subgoal):
 1. \<exists>w. P w x \<and> P w y \<and> P w z \<Longrightarrow> x \<otimes> (y \<otimes> z) = (x \<otimes> y) \<otimes> z
[PROOF STEP]
from ante
[PROOF STATE]
proof (chain)
picking this:
\<exists>w. P w x \<and> P w y \<and> P w z
[PROOF STEP]
have
    "(\<forall>w. P w ((x \<otimes> y) \<otimes> z) \<longleftrightarrow> (P w x \<and> P w y) \<and> P w z)"
[PROOF STATE]
proof (prove)
using this:
\<exists>w. P w x \<and> P w y \<and> P w z

goal (1 subgoal):
 1. \<forall>w. P w ((x \<otimes> y) \<otimes> z) = ((P w x \<and> P w y) \<and> P w z)
[PROOF STEP]
by (rule left_associated_product)
[PROOF STATE]
proof (state)
this:
\<forall>w. P w ((x \<otimes> y) \<otimes> z) = ((P w x \<and> P w y) \<and> P w z)

goal (1 subgoal):
 1. \<exists>w. P w x \<and> P w y \<and> P w z \<Longrightarrow> x \<otimes> (y \<otimes> z) = (x \<otimes> y) \<otimes> z
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>w. P w (x \<otimes> (y \<otimes> z)) = (P w x \<and> P w y \<and> P w z)
\<forall>w. P w ((x \<otimes> y) \<otimes> z) = ((P w x \<and> P w y) \<and> P w z)
[PROOF STEP]
have "\<forall>w. P w (x \<otimes> (y \<otimes> z)) \<longleftrightarrow> P w ((x \<otimes> y) \<otimes> z)"
[PROOF STATE]
proof (prove)
using this:
\<forall>w. P w (x \<otimes> (y \<otimes> z)) = (P w x \<and> P w y \<and> P w z)
\<forall>w. P w ((x \<otimes> y) \<otimes> z) = ((P w x \<and> P w y) \<and> P w z)

goal (1 subgoal):
 1. \<forall>w. P w (x \<otimes> (y \<otimes> z)) = P w ((x \<otimes> y) \<otimes> z)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>w. P w (x \<otimes> (y \<otimes> z)) = P w ((x \<otimes> y) \<otimes> z)

goal (1 subgoal):
 1. \<exists>w. P w x \<and> P w y \<and> P w z \<Longrightarrow> x \<otimes> (y \<otimes> z) = (x \<otimes> y) \<otimes> z
[PROOF STEP]
with part_extensionality
[PROOF STATE]
proof (chain)
picking this:
(?x = ?y) = (\<forall>z. P z ?x = P z ?y)
\<forall>w. P w (x \<otimes> (y \<otimes> z)) = P w ((x \<otimes> y) \<otimes> z)
[PROOF STEP]
show "x \<otimes> (y \<otimes> z) = (x \<otimes> y) \<otimes> z"
[PROOF STATE]
proof (prove)
using this:
(?x = ?y) = (\<forall>z. P z ?x = P z ?y)
\<forall>w. P w (x \<otimes> (y \<otimes> z)) = P w ((x \<otimes> y) \<otimes> z)

goal (1 subgoal):
 1. x \<otimes> (y \<otimes> z) = (x \<otimes> y) \<otimes> z
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
x \<otimes> (y \<otimes> z) = (x \<otimes> y) \<otimes> z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma index_pow_mod: "i < \<^bold>|r\<^sup>@k\<^bold>| \<Longrightarrow> (r\<^sup>@k)!i = r!(i mod \<^bold>|r\<^bold>|)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < \<^bold>|r \<^sup>@ k\<^bold>| \<Longrightarrow> (r \<^sup>@ k) ! i = r ! (i mod \<^bold>|r\<^bold>|)
[PROOF STEP]
proof(induction k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i < \<^bold>|r \<^sup>@ 0\<^bold>| \<Longrightarrow> (r \<^sup>@ 0) ! i = r ! (i mod \<^bold>|r\<^bold>|)
 2. \<And>k. \<lbrakk>i < \<^bold>|r \<^sup>@ k\<^bold>| \<Longrightarrow> (r \<^sup>@ k) ! i = r ! (i mod \<^bold>|r\<^bold>|); i < \<^bold>|r \<^sup>@ Suc k\<^bold>|\<rbrakk> \<Longrightarrow> (r \<^sup>@ Suc k) ! i = r ! (i mod \<^bold>|r\<^bold>|)
[PROOF STEP]
have aux:  "\<^bold>|r\<^sup>@(Suc l)\<^bold>| = \<^bold>|r\<^sup>@l\<^bold>| + \<^bold>|r\<^bold>|" for l
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<^bold>|r \<^sup>@ Suc l\<^bold>| = \<^bold>|r \<^sup>@ l\<^bold>| + \<^bold>|r\<^bold>|
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<^bold>|r \<^sup>@ Suc ?l\<^bold>| = \<^bold>|r \<^sup>@ ?l\<^bold>| + \<^bold>|r\<^bold>|

goal (2 subgoals):
 1. i < \<^bold>|r \<^sup>@ 0\<^bold>| \<Longrightarrow> (r \<^sup>@ 0) ! i = r ! (i mod \<^bold>|r\<^bold>|)
 2. \<And>k. \<lbrakk>i < \<^bold>|r \<^sup>@ k\<^bold>| \<Longrightarrow> (r \<^sup>@ k) ! i = r ! (i mod \<^bold>|r\<^bold>|); i < \<^bold>|r \<^sup>@ Suc k\<^bold>|\<rbrakk> \<Longrightarrow> (r \<^sup>@ Suc k) ! i = r ! (i mod \<^bold>|r\<^bold>|)
[PROOF STEP]
have aux1: "\<^bold>|(r\<^sup>@l)\<^bold>| \<le> i \<Longrightarrow> i < \<^bold>|r\<^sup>@l\<^bold>| + \<^bold>|r\<^bold>| \<Longrightarrow>  i mod \<^bold>|r\<^bold>| = i -  \<^bold>|r\<^sup>@l\<^bold>|" for l
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<^bold>|r \<^sup>@ l\<^bold>| \<le> i; i < \<^bold>|r \<^sup>@ l\<^bold>| + \<^bold>|r\<^bold>|\<rbrakk> \<Longrightarrow> i mod \<^bold>|r\<^bold>| = i - \<^bold>|r \<^sup>@ l\<^bold>|
[PROOF STEP]
unfolding pow_len[of r l]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>l * \<^bold>|r\<^bold>| \<le> i; i < l * \<^bold>|r\<^bold>| + \<^bold>|r\<^bold>|\<rbrakk> \<Longrightarrow> i mod \<^bold>|r\<^bold>| = i - l * \<^bold>|r\<^bold>|
[PROOF STEP]
using less_diff_conv2[of "l * \<^bold>|r\<^bold>|" i "\<^bold>|r\<^bold>|", unfolded add.commute[of "\<^bold>|r\<^bold>|"  "l * \<^bold>|r\<^bold>|"]]
      get_mod[of "i - l * \<^bold>|r\<^bold>|" "\<^bold>|r\<^bold>|" l] le_add_diff_inverse[of "l*\<^bold>|r\<^bold>|" i]
[PROOF STATE]
proof (prove)
using this:
l * \<^bold>|r\<^bold>| \<le> i \<Longrightarrow> (i - l * \<^bold>|r\<^bold>| < \<^bold>|r\<^bold>|) = (i < l * \<^bold>|r\<^bold>| + \<^bold>|r\<^bold>|)
i - l * \<^bold>|r\<^bold>| < \<^bold>|r\<^bold>| \<Longrightarrow> i - l * \<^bold>|r\<^bold>| = (l * \<^bold>|r\<^bold>| + (i - l * \<^bold>|r\<^bold>|)) mod \<^bold>|r\<^bold>|
l * \<^bold>|r\<^bold>| \<le> i \<Longrightarrow> l * \<^bold>|r\<^bold>| + (i - l * \<^bold>|r\<^bold>|) = i

goal (1 subgoal):
 1. \<lbrakk>l * \<^bold>|r\<^bold>| \<le> i; i < l * \<^bold>|r\<^bold>| + \<^bold>|r\<^bold>|\<rbrakk> \<Longrightarrow> i mod \<^bold>|r\<^bold>| = i - l * \<^bold>|r\<^bold>|
[PROOF STEP]
by argo
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<^bold>|r \<^sup>@ ?l\<^bold>| \<le> i; i < \<^bold>|r \<^sup>@ ?l\<^bold>| + \<^bold>|r\<^bold>|\<rbrakk> \<Longrightarrow> i mod \<^bold>|r\<^bold>| = i - \<^bold>|r \<^sup>@ ?l\<^bold>|

goal (2 subgoals):
 1. i < \<^bold>|r \<^sup>@ 0\<^bold>| \<Longrightarrow> (r \<^sup>@ 0) ! i = r ! (i mod \<^bold>|r\<^bold>|)
 2. \<And>k. \<lbrakk>i < \<^bold>|r \<^sup>@ k\<^bold>| \<Longrightarrow> (r \<^sup>@ k) ! i = r ! (i mod \<^bold>|r\<^bold>|); i < \<^bold>|r \<^sup>@ Suc k\<^bold>|\<rbrakk> \<Longrightarrow> (r \<^sup>@ Suc k) ! i = r ! (i mod \<^bold>|r\<^bold>|)
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
i < \<^bold>|r \<^sup>@ k\<^bold>| \<Longrightarrow> (r \<^sup>@ k) ! i = r ! (i mod \<^bold>|r\<^bold>|)
i < \<^bold>|r \<^sup>@ Suc k\<^bold>|

goal (2 subgoals):
 1. i < \<^bold>|r \<^sup>@ 0\<^bold>| \<Longrightarrow> (r \<^sup>@ 0) ! i = r ! (i mod \<^bold>|r\<^bold>|)
 2. \<And>k. \<lbrakk>i < \<^bold>|r \<^sup>@ k\<^bold>| \<Longrightarrow> (r \<^sup>@ k) ! i = r ! (i mod \<^bold>|r\<^bold>|); i < \<^bold>|r \<^sup>@ Suc k\<^bold>|\<rbrakk> \<Longrightarrow> (r \<^sup>@ Suc k) ! i = r ! (i mod \<^bold>|r\<^bold>|)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r \<^sup>@ Suc k) ! i = r ! (i mod \<^bold>|r\<^bold>|)
[PROOF STEP]
unfolding aux sym[OF pow_Suc2[symmetric]] nth_append le_mod_geq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if i < \<^bold>|r \<^sup>@ k\<^bold>| then (r \<^sup>@ k) ! i else r ! (i - \<^bold>|r \<^sup>@ k\<^bold>|)) = r ! (i mod \<^bold>|r\<^bold>|)
[PROOF STEP]
using aux1[ OF _ Suc.prems[unfolded aux]]
      Suc.IH pow_Suc2[symmetric] Suc.prems[unfolded aux] leI[of i "\<^bold>|r \<^sup>@ k\<^bold>|"]
[PROOF STATE]
proof (prove)
using this:
\<^bold>|r \<^sup>@ k\<^bold>| \<le> i \<Longrightarrow> i mod \<^bold>|r\<^bold>| = i - \<^bold>|r \<^sup>@ k\<^bold>|
i < \<^bold>|r \<^sup>@ k\<^bold>| \<Longrightarrow> (r \<^sup>@ k) ! i = r ! (i mod \<^bold>|r\<^bold>|)
?a \<^sup>@ ?n \<cdot> ?a = ?a \<^sup>@ Suc ?n
i < \<^bold>|r \<^sup>@ k\<^bold>| + \<^bold>|r\<^bold>|
\<not> i < \<^bold>|r \<^sup>@ k\<^bold>| \<Longrightarrow> \<^bold>|r \<^sup>@ k\<^bold>| \<le> i

goal (1 subgoal):
 1. (if i < \<^bold>|r \<^sup>@ k\<^bold>| then (r \<^sup>@ k) ! i else r ! (i - \<^bold>|r \<^sup>@ k\<^bold>|)) = r ! (i mod \<^bold>|r\<^bold>|)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
(r \<^sup>@ Suc k) ! i = r ! (i mod \<^bold>|r\<^bold>|)

goal (1 subgoal):
 1. i < \<^bold>|r \<^sup>@ 0\<^bold>| \<Longrightarrow> (r \<^sup>@ 0) ! i = r ! (i mod \<^bold>|r\<^bold>|)
[PROOF STEP]
qed auto


[STATEMENT]
lemma power_pos:
  assumes a0: "0 < a" shows "0 < a ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < a ^ n
[PROOF STEP]
by (induct n, insert mult_strict_mono[OF a0] a0, auto)


[STATEMENT]
lemma isShortestPath_flip_edge:
  assumes "isShortestPath s p t" "(u,v)\<in>set p"
  assumes "isPath s p' t" "(v,u)\<in>set p'"
  shows "length p' \<ge> length p + 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length p + 2 \<le> length p'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
isShortestPath s p t
(u, v) \<in> set p
isPath s p' t
(v, u) \<in> set p'

goal (1 subgoal):
 1. length p + 2 \<le> length p'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>isShortestPath s p t; (u, v) \<in> set p; isPath s p' t; (v, u) \<in> set p'\<rbrakk> \<Longrightarrow> length p + 2 \<le> length p'
[PROOF STEP]
from \<open>isShortestPath s p t\<close>
[PROOF STATE]
proof (chain)
picking this:
isShortestPath s p t
[PROOF STEP]
have
    MIN: "min_dist s t = length p" and
      P: "isPath s p t" and
     DV: "distinct (pathVertices s p)"
[PROOF STATE]
proof (prove)
using this:
isShortestPath s p t

goal (1 subgoal):
 1. min_dist s t = length p &&& isPath s p t &&& distinct (pathVertices s p)
[PROOF STEP]
by (auto simp: isShortestPath_alt isSimplePath_def)
[PROOF STATE]
proof (state)
this:
min_dist s t = length p
isPath s p t
distinct (pathVertices s p)

goal (1 subgoal):
 1. \<lbrakk>isShortestPath s p t; (u, v) \<in> set p; isPath s p' t; (v, u) \<in> set p'\<rbrakk> \<Longrightarrow> length p + 2 \<le> length p'
[PROOF STEP]
from \<open>(u,v)\<in>set p\<close>
[PROOF STATE]
proof (chain)
picking this:
(u, v) \<in> set p
[PROOF STEP]
obtain p1 p2 where [simp]: "p=p1@(u,v)#p2"
[PROOF STATE]
proof (prove)
using this:
(u, v) \<in> set p

goal (1 subgoal):
 1. (\<And>p1 p2. p = p1 @ (u, v) # p2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: in_set_conv_decomp)
[PROOF STATE]
proof (state)
this:
p = p1 @ (u, v) # p2

goal (1 subgoal):
 1. \<lbrakk>isShortestPath s p t; (u, v) \<in> set p; isPath s p' t; (v, u) \<in> set p'\<rbrakk> \<Longrightarrow> length p + 2 \<le> length p'
[PROOF STEP]
from P DV
[PROOF STATE]
proof (chain)
picking this:
isPath s p t
distinct (pathVertices s p)
[PROOF STEP]
have [simp]: "u\<noteq>v"
[PROOF STATE]
proof (prove)
using this:
isPath s p t
distinct (pathVertices s p)

goal (1 subgoal):
 1. u \<noteq> v
[PROOF STEP]
by (cases p2) (auto simp add: isPath_append pathVertices_append)
[PROOF STATE]
proof (state)
this:
u \<noteq> v

goal (1 subgoal):
 1. \<lbrakk>isShortestPath s p t; (u, v) \<in> set p; isPath s p' t; (v, u) \<in> set p'\<rbrakk> \<Longrightarrow> length p + 2 \<le> length p'
[PROOF STEP]
from P
[PROOF STATE]
proof (chain)
picking this:
isPath s p t
[PROOF STEP]
have DISTS: "dist s (length p1) u" "dist u 1 v" "dist v (length p2) t"
[PROOF STATE]
proof (prove)
using this:
isPath s p t

goal (1 subgoal):
 1. dist s (length p1) u &&& dist u 1 v &&& dist v (length p2) t
[PROOF STEP]
by (auto simp: isPath_append dist_def intro: exI[where x="[(u,v)]"])
[PROOF STATE]
proof (state)
this:
dist s (length p1) u
dist u 1 v
dist v (length p2) t

goal (1 subgoal):
 1. \<lbrakk>isShortestPath s p t; (u, v) \<in> set p; isPath s p' t; (v, u) \<in> set p'\<rbrakk> \<Longrightarrow> length p + 2 \<le> length p'
[PROOF STEP]
from MIN
[PROOF STATE]
proof (chain)
picking this:
min_dist s t = length p
[PROOF STEP]
have MIN': "min_dist s t = length p1 + 1 + length p2"
[PROOF STATE]
proof (prove)
using this:
min_dist s t = length p

goal (1 subgoal):
 1. min_dist s t = length p1 + 1 + length p2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
min_dist s t = length p1 + 1 + length p2

goal (1 subgoal):
 1. \<lbrakk>isShortestPath s p t; (u, v) \<in> set p; isPath s p' t; (v, u) \<in> set p'\<rbrakk> \<Longrightarrow> length p + 2 \<le> length p'
[PROOF STEP]
from min_dist_split[OF dist_trans[OF DISTS(1,2)] DISTS(3) MIN']
[PROOF STATE]
proof (chain)
picking this:
min_dist s v = length p1 + 1
min_dist v t = length p2
[PROOF STEP]
have
    MDSV: "min_dist s v = length p1 + 1"
[PROOF STATE]
proof (prove)
using this:
min_dist s v = length p1 + 1
min_dist v t = length p2

goal (1 subgoal):
 1. min_dist s v = length p1 + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
min_dist s v = length p1 + 1

goal (1 subgoal):
 1. \<lbrakk>isShortestPath s p t; (u, v) \<in> set p; isPath s p' t; (v, u) \<in> set p'\<rbrakk> \<Longrightarrow> length p + 2 \<le> length p'
[PROOF STEP]
from min_dist_split[OF DISTS(1) dist_trans[OF DISTS(2,3)]] MIN'
[PROOF STATE]
proof (chain)
picking this:
min_dist s t = length p1 + (1 + length p2) \<Longrightarrow> min_dist s u = length p1
min_dist s t = length p1 + (1 + length p2) \<Longrightarrow> min_dist u t = 1 + length p2
min_dist s t = length p1 + 1 + length p2
[PROOF STEP]
have
    MDUT: "min_dist u t = 1 + length p2"
[PROOF STATE]
proof (prove)
using this:
min_dist s t = length p1 + (1 + length p2) \<Longrightarrow> min_dist s u = length p1
min_dist s t = length p1 + (1 + length p2) \<Longrightarrow> min_dist u t = 1 + length p2
min_dist s t = length p1 + 1 + length p2

goal (1 subgoal):
 1. min_dist u t = 1 + length p2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
min_dist u t = 1 + length p2

goal (1 subgoal):
 1. \<lbrakk>isShortestPath s p t; (u, v) \<in> set p; isPath s p' t; (v, u) \<in> set p'\<rbrakk> \<Longrightarrow> length p + 2 \<le> length p'
[PROOF STEP]
from \<open>(v,u)\<in>set p'\<close>
[PROOF STATE]
proof (chain)
picking this:
(v, u) \<in> set p'
[PROOF STEP]
obtain p1' p2' where [simp]: "p'=p1'@(v,u)#p2'"
[PROOF STATE]
proof (prove)
using this:
(v, u) \<in> set p'

goal (1 subgoal):
 1. (\<And>p1' p2'. p' = p1' @ (v, u) # p2' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: in_set_conv_decomp)
[PROOF STATE]
proof (state)
this:
p' = p1' @ (v, u) # p2'

goal (1 subgoal):
 1. \<lbrakk>isShortestPath s p t; (u, v) \<in> set p; isPath s p' t; (v, u) \<in> set p'\<rbrakk> \<Longrightarrow> length p + 2 \<le> length p'
[PROOF STEP]
from \<open>isPath s p' t\<close>
[PROOF STATE]
proof (chain)
picking this:
isPath s p' t
[PROOF STEP]
have
    DISTS': "dist s (length p1') v" "dist u (length p2') t"
[PROOF STATE]
proof (prove)
using this:
isPath s p' t

goal (1 subgoal):
 1. dist s (length p1') v &&& dist u (length p2') t
[PROOF STEP]
by (auto simp: isPath_append dist_def)
[PROOF STATE]
proof (state)
this:
dist s (length p1') v
dist u (length p2') t

goal (1 subgoal):
 1. \<lbrakk>isShortestPath s p t; (u, v) \<in> set p; isPath s p' t; (v, u) \<in> set p'\<rbrakk> \<Longrightarrow> length p + 2 \<le> length p'
[PROOF STEP]
from DISTS'[THEN min_dist_minD, unfolded MDSV MDUT]
[PROOF STATE]
proof (chain)
picking this:
length p1 + 1 \<le> length p1'
1 + length p2 \<le> length p2'
[PROOF STEP]
show
    "length p + 2 \<le> length p'"
[PROOF STATE]
proof (prove)
using this:
length p1 + 1 \<le> length p1'
1 + length p2 \<le> length p2'

goal (1 subgoal):
 1. length p + 2 \<le> length p'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length p + 2 \<le> length p'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma [code]: "sorted_list_of_set (set l) = nativeSort (remdups l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_list_of_set (set l) = nativeSort (remdups l)
[PROOF STEP]
by (simp add: nativeSort_def sorted_list_of_set_sort_remdups)


[STATEMENT]
lemma ds_bij: "bij (ds::'a::order \<Rightarrow> 'a downset)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij ds
[PROOF STEP]
by (simp add: bijI ds_inj ds_surj)


[STATEMENT]
lemma (in CL) glb_in_lattice: "S \<subseteq> A ==> glb S cl \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> A \<Longrightarrow> glb S cl \<in> A
[PROOF STEP]
apply (subst glb_dual_lub)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> A \<Longrightarrow> lub S (dual cl) \<in> A
[PROOF STEP]
apply (simp add: A_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> pset cl \<Longrightarrow> lub S (dual cl) \<in> pset cl
[PROOF STEP]
apply (rule dualA_iff [THEN subst])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> pset cl \<Longrightarrow> lub S (dual cl) \<in> pset (dual cl)
[PROOF STEP]
apply (rule CL.lub_in_lattice)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. S \<subseteq> pset cl \<Longrightarrow> CL (dual cl)
 2. S \<subseteq> pset cl \<Longrightarrow> S \<subseteq> pset (dual cl)
[PROOF STEP]
apply (rule CL.intro)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. S \<subseteq> pset cl \<Longrightarrow> PO (dual cl)
 2. S \<subseteq> pset cl \<Longrightarrow> CL_axioms (dual cl)
 3. S \<subseteq> pset cl \<Longrightarrow> S \<subseteq> pset (dual cl)
[PROOF STEP]
apply (rule PO.intro)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. S \<subseteq> pset cl \<Longrightarrow> dual cl \<in> PartialOrder
 2. S \<subseteq> pset cl \<Longrightarrow> CL_axioms (dual cl)
 3. S \<subseteq> pset cl \<Longrightarrow> S \<subseteq> pset (dual cl)
[PROOF STEP]
apply (rule dualPO)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. S \<subseteq> pset cl \<Longrightarrow> CL_axioms (dual cl)
 2. S \<subseteq> pset cl \<Longrightarrow> S \<subseteq> pset (dual cl)
[PROOF STEP]
apply (rule CL_axioms.intro)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. S \<subseteq> pset cl \<Longrightarrow> dual cl \<in> CompleteLattice
 2. S \<subseteq> pset cl \<Longrightarrow> S \<subseteq> pset (dual cl)
[PROOF STEP]
apply (rule CL_dualCL)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> pset cl \<Longrightarrow> S \<subseteq> pset (dual cl)
[PROOF STEP]
apply (simp add: dualA_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma trapped_iff_on_existence_ivl0:
  "trapped x K \<longleftrightarrow> (flow0 x ` (existence_ivl0 x) \<subseteq> K)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trapped x K = (flow0 x ` existence_ivl0 x \<subseteq> K)
[PROOF STEP]
unfolding trapped_def trapped_forward_def trapped_backward_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (flow0 x ` (existence_ivl0 x \<inter> {0..}) \<subseteq> K \<and> flow0 x ` (existence_ivl0 x \<inter> {..0}) \<subseteq> K) = (flow0 x ` existence_ivl0 x \<subseteq> K)
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>xa \<in> existence_ivl0 x; flow0 x ` (existence_ivl0 x \<inter> {0..}) \<subseteq> K; flow0 x ` (existence_ivl0 x \<inter> {..0}) \<subseteq> K\<rbrakk> \<Longrightarrow> flow0 x xa \<in> K
[PROOF STEP]
by (metis IntI atLeast_iff atMost_iff image_subset_iff less_eq_real_def linorder_not_less)


[STATEMENT]
lemma outside_bounded_nonempty:
  fixes S :: "'a :: {real_normed_vector, perfect_space} set"
    assumes "bounded S" shows "outside S \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outside S \<noteq> {}
[PROOF STEP]
by (metis (no_types, lifting) Collect_empty_eq Collect_mem_eq Compl_eq_Diff_UNIV Diff_cancel
                   Diff_disjoint UNIV_I assms ball_eq_empty bounded_diff cobounded_outside convex_ball
                   double_complement order_refl outside_convex outside_def)


[STATEMENT]
lemma (in Network) isMaxFlow_alt:
  "isMaxFlow f \<longleftrightarrow> NFlow c s t f \<and>
    (\<forall>f'. NFlow c s t f' \<longrightarrow> Flow.val c s f' \<le> Flow.val c s f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isMaxFlow f = (NFlow c s t f \<and> (\<forall>f'. NFlow c s t f' \<longrightarrow> Flow.val c s f' \<le> Flow.val c s f))
[PROOF STEP]
unfolding isMaxFlow_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Flow c s t f \<and> (\<forall>f'. Flow c s t f' \<longrightarrow> Flow.val c s f' \<le> Flow.val c s f)) = (NFlow c s t f \<and> (\<forall>f'. NFlow c s t f' \<longrightarrow> Flow.val c s f' \<le> Flow.val c s f))
[PROOF STEP]
by (auto simp: NFlow_def Flow_def NPreflow_def) intro_locales


[STATEMENT]
lemma pointwise_less_iff2: "x \<lhd> y \<longleftrightarrow> x \<unlhd> y \<and> (\<exists>k < length x. x!k <y ! k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<lhd> y) = (x \<unlhd> y \<and> (\<exists>k<length x. x ! k < y ! k))
[PROOF STEP]
unfolding pointwise_less_def pointwise_le_iff_nth
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((length x = length y \<and> (\<forall>i<length x. x ! i \<le> y ! i)) \<and> x \<noteq> y) = ((length x = length y \<and> (\<forall>i<length x. x ! i \<le> y ! i)) \<and> (\<exists>k<length x. x ! k < y ! k))
[PROOF STEP]
by (fastforce intro!: nth_equalityI)


[STATEMENT]
lemma Suffixes_UNION [simp]: "Suffixes (\<Union>(f ` A)) = \<Union>((\<lambda>x. Suffixes (f x)) ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suffixes (\<Union> (f ` A)) = (\<Union>x\<in>A. Suffixes (f x))
[PROOF STEP]
by (auto simp: Suffixes_def)


[STATEMENT]
lemma iprev_neq_imp_iMin: "iprev n I \<noteq> n \<Longrightarrow> iMin I < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. iprev n I \<noteq> n \<Longrightarrow> iMin I < n
[PROOF STEP]
by (rule ccontr, clarsimp simp: iprev_le_iMin)


[STATEMENT]
lemma if_pull2: "(if b then f x x' else f y y') = f (if b then x else y) (if b then x' else y')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if b then f x x' else f y y') = f (if b then x else y) (if b then x' else y')
[PROOF STEP]
by simp


[STATEMENT]
lemma borel_eq_sigmaI5:
  fixes F :: "'i \<Rightarrow> 'j \<Rightarrow> 'a::topological_space set" and G :: "'l \<Rightarrow> 'a::topological_space set"
  assumes borel_eq: "borel = sigma UNIV (range G)"
  assumes X: "\<And>i. G i \<in> sets (sigma UNIV (range (\<lambda>(i, j). F i j)))"
  assumes F: "\<And>i j. F i j \<in> sets borel"
  shows "borel = sigma UNIV (range (\<lambda>(i, j). F i j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. borel = sigma UNIV (range (\<lambda>(i, j). F i j))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
borel = sigma UNIV (range G)
G ?i \<in> sets (sigma UNIV (range (\<lambda>(i, j). F i j)))
F ?i ?j \<in> sets borel

goal (1 subgoal):
 1. borel = sigma UNIV (range (\<lambda>(i, j). F i j))
[PROOF STEP]
by (intro borel_eq_sigmaI1[where X="range G" and F="(\<lambda>(i, j). F i j)"]) auto


[STATEMENT]
lemma derives_drop_prefixword_helper:
  "derives a b \<Longrightarrow> is_word w \<Longrightarrow> is_prefix w a \<Longrightarrow> derives (drop (length w) a) (drop (length w) b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>derives a b; is_word w; is_prefix w a\<rbrakk> \<Longrightarrow> derives (drop (length w) a) (drop (length w) b)
[PROOF STEP]
proof (induct rule: derives_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>is_word w; is_prefix w a\<rbrakk> \<Longrightarrow> derives (drop (length w) a) (drop (length w) a)
 2. \<And>y z. \<lbrakk>derives a y; derives1 y z; \<lbrakk>is_word w; is_prefix w a\<rbrakk> \<Longrightarrow> derives (drop (length w) a) (drop (length w) y); is_word w; is_prefix w a\<rbrakk> \<Longrightarrow> derives (drop (length w) a) (drop (length w) z)
[PROOF STEP]
case Base
[PROOF STATE]
proof (state)
this:
is_word w
is_prefix w a

goal (2 subgoals):
 1. \<lbrakk>is_word w; is_prefix w a\<rbrakk> \<Longrightarrow> derives (drop (length w) a) (drop (length w) a)
 2. \<And>y z. \<lbrakk>derives a y; derives1 y z; \<lbrakk>is_word w; is_prefix w a\<rbrakk> \<Longrightarrow> derives (drop (length w) a) (drop (length w) y); is_word w; is_prefix w a\<rbrakk> \<Longrightarrow> derives (drop (length w) a) (drop (length w) z)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
is_word w
is_prefix w a

goal (1 subgoal):
 1. derives (drop (length w) a) (drop (length w) a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
derives (drop (length w) a) (drop (length w) a)

goal (1 subgoal):
 1. \<And>y z. \<lbrakk>derives a y; derives1 y z; \<lbrakk>is_word w; is_prefix w a\<rbrakk> \<Longrightarrow> derives (drop (length w) a) (drop (length w) y); is_word w; is_prefix w a\<rbrakk> \<Longrightarrow> derives (drop (length w) a) (drop (length w) z)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y z. \<lbrakk>derives a y; derives1 y z; \<lbrakk>is_word w; is_prefix w a\<rbrakk> \<Longrightarrow> derives (drop (length w) a) (drop (length w) y); is_word w; is_prefix w a\<rbrakk> \<Longrightarrow> derives (drop (length w) a) (drop (length w) z)
[PROOF STEP]
case (Step y z)
[PROOF STATE]
proof (state)
this:
derives a y
derives1 y z
\<lbrakk>is_word w; is_prefix w a\<rbrakk> \<Longrightarrow> derives (drop (length w) a) (drop (length w) y)
is_word w
is_prefix w a

goal (1 subgoal):
 1. \<And>y z. \<lbrakk>derives a y; derives1 y z; \<lbrakk>is_word w; is_prefix w a\<rbrakk> \<Longrightarrow> derives (drop (length w) a) (drop (length w) y); is_word w; is_prefix w a\<rbrakk> \<Longrightarrow> derives (drop (length w) a) (drop (length w) z)
[PROOF STEP]
have is_prefix_w_y: "is_prefix w y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_prefix w y
[PROOF STEP]
by (metis Step.hyps(1) Step.prems(1) Step.prems(2) derives_word_is_prefix is_prefix_def)
[PROOF STATE]
proof (state)
this:
is_prefix w y

goal (1 subgoal):
 1. \<And>y z. \<lbrakk>derives a y; derives1 y z; \<lbrakk>is_word w; is_prefix w a\<rbrakk> \<Longrightarrow> derives (drop (length w) a) (drop (length w) y); is_word w; is_prefix w a\<rbrakk> \<Longrightarrow> derives (drop (length w) a) (drop (length w) z)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
is_prefix w y

goal (1 subgoal):
 1. derives (drop (length w) a) (drop (length w) z)
[PROOF STEP]
by (metis Step.hyps(2) Step.hyps(3) Step.prems(1) Step.prems(2) derives1_implies_derives
        derives1_is_word_is_prefix_drop derives_trans)
[PROOF STATE]
proof (state)
this:
derives (drop (length w) a) (drop (length w) z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult2: "x \<in> carrier R \<Longrightarrow> x \<oplus> x = \<guillemotleft>2\<guillemotright> \<otimes> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier R \<Longrightarrow> x \<oplus> x = \<guillemotleft>2\<guillemotright> \<otimes> x
[PROOF STEP]
by (simp add: of_int_2 l_distr)


[STATEMENT]
lemma strings_of_length_n: "set (List.n_lists n all_chars) = {s::string. length s = n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (List.n_lists n all_chars) = {s. length s = n}
[PROOF STEP]
apply(induction n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. set (List.n_lists 0 all_chars) = {s. length s = 0}
 2. \<And>n. set (List.n_lists n all_chars) = {s. length s = n} \<Longrightarrow> set (List.n_lists (Suc n) all_chars) = {s. length s = Suc n}
[PROOF STEP]
apply(simp; fail)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. set (List.n_lists n all_chars) = {s. length s = n} \<Longrightarrow> set (List.n_lists (Suc n) all_chars) = {s. length s = Suc n}
[PROOF STEP]
apply(simp add: all_chars)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. set (List.n_lists n all_chars) = {s. length s = n} \<Longrightarrow> (\<Union>x\<in>{s. length s = n}. range (\<lambda>xa. xa # x)) = {s. length s = Suc n}
[PROOF STEP]
apply(safe)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n x xa xb. \<lbrakk>set (List.n_lists (length xa) all_chars) = {s. length s = length xa}; xb \<in> UNIV\<rbrakk> \<Longrightarrow> length (xb # xa) = Suc (length xa)
 2. \<And>n x. \<lbrakk>set (List.n_lists n all_chars) = {s. length s = n}; length x = Suc n\<rbrakk> \<Longrightarrow> x \<in> (\<Union>x\<in>{s. length s = n}. range (\<lambda>xa. xa # x))
[PROOF STEP]
apply(simp; fail)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n x. \<lbrakk>set (List.n_lists n all_chars) = {s. length s = n}; length x = Suc n\<rbrakk> \<Longrightarrow> x \<in> (\<Union>x\<in>{s. length s = n}. range (\<lambda>xa. xa # x))
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n x. \<lbrakk>set (List.n_lists n all_chars) = {s. length s = n}; length x = Suc n\<rbrakk> \<Longrightarrow> \<exists>xa. length xa = n \<and> x \<in> range (\<lambda>x. x # xa)
[PROOF STEP]
apply(rename_tac n x)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n x. \<lbrakk>set (List.n_lists n all_chars) = {s. length s = n}; length x = Suc n\<rbrakk> \<Longrightarrow> \<exists>xa. length xa = n \<and> x \<in> range (\<lambda>x. x # xa)
[PROOF STEP]
apply(rule_tac x="drop 1 x" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n x. \<lbrakk>set (List.n_lists n all_chars) = {s. length s = n}; length x = Suc n\<rbrakk> \<Longrightarrow> length (drop 1 x) = n \<and> x \<in> range (\<lambda>xa. xa # drop 1 x)
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n x. \<lbrakk>set (List.n_lists n all_chars) = {s. length s = n}; length x = Suc n\<rbrakk> \<Longrightarrow> x \<in> range (\<lambda>xa. xa # drop (Suc 0) x)
[PROOF STEP]
apply(case_tac x)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n x. \<lbrakk>set (List.n_lists n all_chars) = {s. length s = n}; length x = Suc n; x = []\<rbrakk> \<Longrightarrow> x \<in> range (\<lambda>xa. xa # drop (Suc 0) x)
 2. \<And>n x a list. \<lbrakk>set (List.n_lists n all_chars) = {s. length s = n}; length x = Suc n; x = a # list\<rbrakk> \<Longrightarrow> x \<in> range (\<lambda>xa. xa # drop (Suc 0) x)
[PROOF STEP]
apply(simp_all)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fbox_antitone_var: "x \<le> y \<Longrightarrow> |y] z \<le> |x] z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow>  |y] z \<le>  |x] z
[PROOF STEP]
by (simp add: fbox_def a_antitone mult_isor)


[STATEMENT]
lemma nodes_add_node[simp]: "nodes (add_node v g) = insert v (nodes g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nodes (add_node v g) = insert v (nodes g)
[PROOF STEP]
by (simp add: add_node_def)


[STATEMENT]
lemma cont2cont_times [simp, cont2cont]:
  assumes "cont (\<lambda>x. f x)" and "cont (\<lambda>x. g x)"
  shows "cont (\<lambda>x. f x * g x :: 'a::times_cpo)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cont (\<lambda>x. f x * g x)
[PROOF STEP]
apply (rule cont_apply [OF assms(1) cont_times1])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. cont (\<lambda>x. y * g x)
[PROOF STEP]
apply (rule cont_apply [OF assms(2) cont_times2])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y ya. cont (\<lambda>x. y * ya)
[PROOF STEP]
apply (rule cont_const)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma dg_Par_Hom_vsubset_dg_Rel_Hom:
  assumes "a \<in>\<^sub>\<circ> dg_Par \<alpha>\<lparr>Obj\<rparr>" "b \<in>\<^sub>\<circ> dg_Par \<alpha>\<lparr>Obj\<rparr>"
  shows "Hom (dg_Par \<alpha>) a b \<subseteq>\<^sub>\<circ> Hom (dg_Rel \<alpha>) a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hom (dg_Par \<alpha>) a b \<subseteq>\<^sub>\<circ> Hom (dg_Rel \<alpha>) a b
[PROOF STEP]
by (rule vsubsetI) (simp add: dg_Par_is_arr_dg_Rel_is_arr)


[STATEMENT]
lemma mat_res_pointwise:
  fixes i j :: "'a::finite"
    and x :: "('a, 'a, bool) matrix"
  shows "(x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
have "\<Sum>{(x\<^sup>\<dagger>) i k \<and> ((x \<otimes> y)\<^sup>c) k j |k. k \<in> UNIV} \<le> (y\<^sup>c) i j \<longleftrightarrow> (\<forall>k. ((x\<^sup>\<dagger>) i k \<and> ((x \<otimes> y)\<^sup>c) k j) \<le> (y\<^sup>c) i j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum> {(x\<^sup>\<dagger>) i k \<and> ((x \<otimes> y)\<^sup>c) k j |k. k \<in> UNIV} \<le> (y\<^sup>c) i j) = (\<forall>k. ((x\<^sup>\<dagger>) i k \<and> ((x \<otimes> y)\<^sup>c) k j) \<le> (y\<^sup>c) i j)
[PROOF STEP]
by (subst sum_sup) auto
[PROOF STATE]
proof (state)
this:
(\<Sum> {(x\<^sup>\<dagger>) i k \<and> ((x \<otimes> y)\<^sup>c) k j |k. k \<in> UNIV} \<le> (y\<^sup>c) i j) = (\<forall>k. ((x\<^sup>\<dagger>) i k \<and> ((x \<otimes> y)\<^sup>c) k j) \<le> (y\<^sup>c) i j)

goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum> {(x\<^sup>\<dagger>) i k \<and> ((x \<otimes> y)\<^sup>c) k j |k. k \<in> UNIV} \<le> (y\<^sup>c) i j) = (\<forall>k. ((x\<^sup>\<dagger>) i k \<and> ((x \<otimes> y)\<^sup>c) k j) \<le> (y\<^sup>c) i j)

goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<forall>k. ((x\<^sup>\<dagger>) i k \<and> - (x \<otimes> y) k j) \<le> (y\<^sup>c) i j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>k. ((x\<^sup>\<dagger>) i k \<and> ((x \<otimes> y)\<^sup>c) k j) \<le> (y\<^sup>c) i j) = (\<forall>k. ((x\<^sup>\<dagger>) i k \<and> - (x \<otimes> y) k j) \<le> (y\<^sup>c) i j)
[PROOF STEP]
by (simp only: mat_complement_def)
[PROOF STATE]
proof (state)
this:
(\<forall>k. ((x\<^sup>\<dagger>) i k \<and> ((x \<otimes> y)\<^sup>c) k j) \<le> (y\<^sup>c) i j) = (\<forall>k. ((x\<^sup>\<dagger>) i k \<and> - (x \<otimes> y) k j) \<le> (y\<^sup>c) i j)

goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<forall>k. ((x\<^sup>\<dagger>) i k \<and> ((x \<otimes> y)\<^sup>c) k j) \<le> (y\<^sup>c) i j) = (\<forall>k. ((x\<^sup>\<dagger>) i k \<and> - (x \<otimes> y) k j) \<le> (y\<^sup>c) i j)

goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<forall>k. (x\<^sup>\<dagger>) i k \<le> ((y\<^sup>c) i j \<or> (x \<otimes> y) k j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>k. ((x\<^sup>\<dagger>) i k \<and> - (x \<otimes> y) k j) \<le> (y\<^sup>c) i j) = (\<forall>k. (x\<^sup>\<dagger>) i k \<le> ((y\<^sup>c) i j \<or> (x \<otimes> y) k j))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<forall>k. ((x\<^sup>\<dagger>) i k \<and> - (x \<otimes> y) k j) \<le> (y\<^sup>c) i j) = (\<forall>k. (x\<^sup>\<dagger>) i k \<le> ((y\<^sup>c) i j \<or> (x \<otimes> y) k j))

goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<forall>k. ((x\<^sup>\<dagger>) i k \<and> - (x \<otimes> y) k j) \<le> (y\<^sup>c) i j) = (\<forall>k. (x\<^sup>\<dagger>) i k \<le> ((y\<^sup>c) i j \<or> (x \<otimes> y) k j))

goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<forall>k. (x\<^sup>\<dagger>) i k \<le> (- y i j \<or> (x \<otimes> y) k j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>k. (x\<^sup>\<dagger>) i k \<le> ((y\<^sup>c) i j \<or> (x \<otimes> y) k j)) = (\<forall>k. (x\<^sup>\<dagger>) i k \<le> (- y i j \<or> (x \<otimes> y) k j))
[PROOF STEP]
by (simp only: mat_complement_def)
[PROOF STATE]
proof (state)
this:
(\<forall>k. (x\<^sup>\<dagger>) i k \<le> ((y\<^sup>c) i j \<or> (x \<otimes> y) k j)) = (\<forall>k. (x\<^sup>\<dagger>) i k \<le> (- y i j \<or> (x \<otimes> y) k j))

goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<forall>k. (x\<^sup>\<dagger>) i k \<le> ((y\<^sup>c) i j \<or> (x \<otimes> y) k j)) = (\<forall>k. (x\<^sup>\<dagger>) i k \<le> (- y i j \<or> (x \<otimes> y) k j))

goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<forall>k. ((x\<^sup>\<dagger>) i k \<and> y i j) \<le> (x \<otimes> y) k j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>k. (x\<^sup>\<dagger>) i k \<le> (- y i j \<or> (x \<otimes> y) k j)) = (\<forall>k. ((x\<^sup>\<dagger>) i k \<and> y i j) \<le> (x \<otimes> y) k j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<forall>k. (x\<^sup>\<dagger>) i k \<le> (- y i j \<or> (x \<otimes> y) k j)) = (\<forall>k. ((x\<^sup>\<dagger>) i k \<and> y i j) \<le> (x \<otimes> y) k j)

goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<forall>k. (x\<^sup>\<dagger>) i k \<le> (- y i j \<or> (x \<otimes> y) k j)) = (\<forall>k. ((x\<^sup>\<dagger>) i k \<and> y i j) \<le> (x \<otimes> y) k j)

goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<forall>k. (x k i \<and> y i j) \<le> (x \<otimes> y) k j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>k. ((x\<^sup>\<dagger>) i k \<and> y i j) \<le> (x \<otimes> y) k j) = (\<forall>k. (x k i \<and> y i j) \<le> (x \<otimes> y) k j)
[PROOF STEP]
by (simp add: mat_transpose_def)
[PROOF STATE]
proof (state)
this:
(\<forall>k. ((x\<^sup>\<dagger>) i k \<and> y i j) \<le> (x \<otimes> y) k j) = (\<forall>k. (x k i \<and> y i j) \<le> (x \<otimes> y) k j)

goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<forall>k. ((x\<^sup>\<dagger>) i k \<and> y i j) \<le> (x \<otimes> y) k j) = (\<forall>k. (x k i \<and> y i j) \<le> (x \<otimes> y) k j)

goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<forall>k. (x k i \<and> y i j) \<le> \<Sum>{x k l \<and> y l j |l. l \<in> UNIV})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>k. (x k i \<and> y i j) \<le> (x \<otimes> y) k j) = (\<forall>k. (x k i \<and> y i j) \<le> \<Sum> {x k l \<and> y l j |l. l \<in> UNIV})
[PROOF STEP]
by (simp add: mat_mult_def times_bool_def)
[PROOF STATE]
proof (state)
this:
(\<forall>k. (x k i \<and> y i j) \<le> (x \<otimes> y) k j) = (\<forall>k. (x k i \<and> y i j) \<le> \<Sum> {x k l \<and> y l j |l. l \<in> UNIV})

goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<forall>k. (x k i \<and> y i j) \<le> (x \<otimes> y) k j) = (\<forall>k. (x k i \<and> y i j) \<le> \<Sum> {x k l \<and> y l j |l. l \<in> UNIV})

goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<forall>k. \<Sum>{x k i \<and> y i j} \<le> \<Sum>{x k l \<and> y l j |l. l \<in> UNIV})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>k. (x k i \<and> y i j) \<le> \<Sum> {x k l \<and> y l j |l. l \<in> UNIV}) = (\<forall>k. \<Sum> {x k i \<and> y i j} \<le> \<Sum> {x k l \<and> y l j |l. l \<in> UNIV})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<forall>k. (x k i \<and> y i j) \<le> \<Sum> {x k l \<and> y l j |l. l \<in> UNIV}) = (\<forall>k. \<Sum> {x k i \<and> y i j} \<le> \<Sum> {x k l \<and> y l j |l. l \<in> UNIV})

goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<forall>k. (x k i \<and> y i j) \<le> \<Sum> {x k l \<and> y l j |l. l \<in> UNIV}) = (\<forall>k. \<Sum> {x k i \<and> y i j} \<le> \<Sum> {x k l \<and> y l j |l. l \<in> UNIV})

goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
have "\<dots> \<longleftrightarrow> True"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>k. \<Sum> {x k i \<and> y i j} \<le> \<Sum> {x k l \<and> y l j |l. l \<in> UNIV}) = True
[PROOF STEP]
by (intro iffI TrueI allI sum_intro[rule_format]) auto
[PROOF STATE]
proof (state)
this:
(\<forall>k. \<Sum> {x k i \<and> y i j} \<le> \<Sum> {x k l \<and> y l j |l. l \<in> UNIV}) = True

goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<forall>k. \<Sum> {x k i \<and> y i j} \<le> \<Sum> {x k l \<and> y l j |l. l \<in> UNIV}) = True

goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
have "(x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j = \<Sum>{(x\<^sup>\<dagger>) i k \<and> ((x \<otimes> y)\<^sup>c) k j |k. k \<in> UNIV}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j = \<Sum> {(x\<^sup>\<dagger>) i k \<and> ((x \<otimes> y)\<^sup>c) k j |k. k \<in> UNIV}
[PROOF STEP]
by (subst mat_mult_def) (simp add: times_bool_def)
[PROOF STATE]
proof (state)
this:
(x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j = \<Sum> {(x\<^sup>\<dagger>) i k \<and> ((x \<otimes> y)\<^sup>c) k j |k. k \<in> UNIV}

goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum> {(x\<^sup>\<dagger>) i k \<and> ((x \<otimes> y)\<^sup>c) k j |k. k \<in> UNIV} \<le> (y\<^sup>c) i j) = (\<forall>k. \<Sum> {x k i \<and> y i j} \<le> \<Sum> {x k l \<and> y l j |l. l \<in> UNIV})
(\<forall>k. \<Sum> {x k i \<and> y i j} \<le> \<Sum> {x k l \<and> y l j |l. l \<in> UNIV}) = True
(x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j = \<Sum> {(x\<^sup>\<dagger>) i k \<and> ((x \<otimes> y)\<^sup>c) k j |k. k \<in> UNIV}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum> {(x\<^sup>\<dagger>) i k \<and> ((x \<otimes> y)\<^sup>c) k j |k. k \<in> UNIV} \<le> (y\<^sup>c) i j) = (\<forall>k. \<Sum> {x k i \<and> y i j} \<le> \<Sum> {x k l \<and> y l j |l. l \<in> UNIV})
(\<forall>k. \<Sum> {x k i \<and> y i j} \<le> \<Sum> {x k l \<and> y l j |l. l \<in> UNIV}) = True
(x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j = \<Sum> {(x\<^sup>\<dagger>) i k \<and> ((x \<otimes> y)\<^sup>c) k j |k. k \<in> UNIV}

goal (1 subgoal):
 1. (x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x\<^sup>\<dagger> \<otimes> (x \<otimes> y)\<^sup>c) i j \<le> (y\<^sup>c) i j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma CONJ_empty[simp]: "CONJ (Q, {}) = Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CONJ (Q, {}) = Q
[PROOF STEP]
by (auto simp: CONJ_def)


[STATEMENT]
lemma State_IdleI: "
  \<lbrakk> \<And>c. localState c = state \<Longrightarrow>
    localState (trans_fun \<NoMsg> c) = state \<and>
    output_fun (trans_fun \<NoMsg> c) = \<NoMsg> \<rbrakk> \<Longrightarrow>
  State_Idle localState output_fun trans_fun state"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c. localState c = state \<Longrightarrow> localState (trans_fun NoMsg c) = state \<and> output_fun (trans_fun NoMsg c) = NoMsg) \<Longrightarrow> State_Idle localState output_fun trans_fun state
[PROOF STEP]
by (unfold State_Idle_def, blast)


[STATEMENT]
lemma proj_poly_syz_monom_mult:
  "proj_poly_syz n (monom_mult c t p) = monom_mult c t (proj_poly_syz n p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj_poly_syz n (monom_mult c t p) = monom_mult c t (proj_poly_syz n p)
[PROOF STEP]
by (rule poly_mapping_eqI,
      simp add: lookup_proj_poly_syz lookup_monom_mult term_simps adds_pp_def sminus_def)


[STATEMENT]
lemma length_mirror1_aux: "length ps = length (mirror1_aux n ps)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length ps = length (mirror1_aux n ps)
[PROOF STEP]
by (induction ps) auto


[STATEMENT]
lemma FIXME_fiddle1: "\<lbrakk> x \<in> Y; X \<subseteq> Y; refl_on Y r \<rbrakk> \<Longrightarrow> insert x (X \<inter> r `` {x}) = (insert x X) \<inter> r `` {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> Y; X \<subseteq> Y; refl_on Y r\<rbrakk> \<Longrightarrow> insert x (X \<inter> r `` {x}) = insert x X \<inter> r `` {x}
[PROOF STEP]
by (auto dest: refl_onD)


[STATEMENT]
lemma summable_mono_reindex:
  assumes subseq: "strict_mono g"
    and zero: "\<And>n. n \<notin> range g \<Longrightarrow> f n = 0"
  shows "summable (\<lambda>n. f (g n)) \<longleftrightarrow> summable f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. f (g n)) = summable f
[PROOF STEP]
using sums_mono_reindex[of g f, OF assms]
[PROOF STATE]
proof (prove)
using this:
(\<And>n. n \<notin> range g \<Longrightarrow> n \<notin> range g) \<Longrightarrow> (\<lambda>n. f (g n)) sums ?c = f sums ?c

goal (1 subgoal):
 1. summable (\<lambda>n. f (g n)) = summable f
[PROOF STEP]
by (simp add: summable_def)


[STATEMENT]
lemma directed_downset_ideals: "directed (\<Down>X) = (\<Down>X \<in> ideals)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. directed (\<Down> X) = idealp (\<Down> X)
[PROOF STEP]
by (metis (mono_tags, lifting) Fix_def comp_apply directed_alt downset_set_idem downsets_def ideals_def mem_Collect_eq)


[STATEMENT]
lemma elements_matI2: "i < dim_row A \<Longrightarrow> j < dim_col A \<Longrightarrow> A $$ (i, j) \<in> elements_mat A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < dim_row A; j < dim_col A\<rbrakk> \<Longrightarrow> A $$ (i, j) \<in> elements_mat A
[PROOF STEP]
by auto


[STATEMENT]
lemma uMult_assoc: "(x *\<^sub># y) *\<^sub># z = x *\<^sub># (y *\<^sub># z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x *\<^sub># y *\<^sub># z = x *\<^sub># (y *\<^sub># z)
[PROOF STEP]
unfolding uMult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Lambda> x y. Discr (undiscr x * undiscr y))\<cdot>((\<Lambda> x y. Discr (undiscr x * undiscr y))\<cdot>x\<cdot>y)\<cdot>z = (\<Lambda> x y. Discr (undiscr x * undiscr y))\<cdot>x\<cdot>((\<Lambda> x y. Discr (undiscr x * undiscr y))\<cdot>y\<cdot>z)
[PROOF STEP]
by simp


[STATEMENT]
lemma rank1_compose_left: \<open>rank1 (a o\<^sub>C\<^sub>L b)\<close> if \<open>rank1 b\<close> and \<open>a o\<^sub>C\<^sub>L b \<noteq> 0\<close>
  for b :: \<open>'a::chilbert_space \<Rightarrow>\<^sub>C\<^sub>L 'b::chilbert_space\<close> and a :: \<open>'b \<Rightarrow>\<^sub>C\<^sub>L 'c::chilbert_space\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank1 (a o\<^sub>C\<^sub>L b)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
rank1 b
a o\<^sub>C\<^sub>L b \<noteq> 0

goal (1 subgoal):
 1. rank1 (a o\<^sub>C\<^sub>L b)
[PROOF STEP]
apply (auto simp: rank1_iff_butterfly cblinfun_comp_butterfly)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>\<psi> \<phi>. \<lbrakk>butterfly (a *\<^sub>V \<psi>) \<phi> \<noteq> 0; butterfly \<psi> \<phi> \<noteq> 0; b = butterfly \<psi> \<phi>\<rbrakk> \<Longrightarrow> \<exists>\<psi>' \<phi>'. butterfly (a *\<^sub>V \<psi>) \<phi> = butterfly \<psi>' \<phi>'
[PROOF STEP]
by blast


[STATEMENT]
lemma Zero_fract_def: "0 = Fract 0 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 = Fract (0::'a) (1::'a)
[PROOF STEP]
by transfer simp


[STATEMENT]
lemma filternew_flows_state_alt: "filternew_flows_state \<T>  = flows_state \<T> - (backflows (flows_fix \<T>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filternew_flows_state \<T> = flows_state \<T> - backflows (flows_fix \<T>)
[PROOF STEP]
apply(simp add: backflows_def filternew_flows_state_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(s, r). (s, r) \<in> flows_state \<T> \<and> (r, s) \<notin> flows_fix \<T>} = flows_state \<T> - {(r, s). (s, r) \<in> flows_fix \<T>}
[PROOF STEP]
apply(rule)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {(s, r). (s, r) \<in> flows_state \<T> \<and> (r, s) \<notin> flows_fix \<T>} \<subseteq> flows_state \<T> - {(r, s). (s, r) \<in> flows_fix \<T>}
 2. flows_state \<T> - {(r, s). (s, r) \<in> flows_fix \<T>} \<subseteq> {(s, r). (s, r) \<in> flows_state \<T> \<and> (r, s) \<notin> flows_fix \<T>}
[PROOF STEP]
apply blast+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma an_shunting_an:
  "an(z) * an(x) \<le> an(y) \<longleftrightarrow> an(x) \<le> n(z) \<squnion> an(y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (an z * an x \<le> an y) = (an x \<le> n z \<squnion> an y)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. an z * an x \<le> an y \<Longrightarrow> an x \<le> n z \<squnion> an y
 2. an x \<le> n z \<squnion> an y \<Longrightarrow> an z * an x \<le> an y
[PROOF STEP]
apply (smt sup_ge1 sup_ge2 an_case_split_left n_an_mult_left_lower_bound order_trans)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. an x \<le> n z \<squnion> an y \<Longrightarrow> an z * an x \<le> an y
[PROOF STEP]
by (metis sup_bot_left sup_ge2 an_case_split_left an_complement_bot mult_left_dist_sup mult_right_isotone order_trans)


[STATEMENT]
lemma qbs_prob_integral_add:
  assumes "qbs_integrable (s::'a qbs_prob_space) f"
      and "qbs_integrable s g"
    shows "qbs_prob_integral s (\<lambda>x. f x + g x) = qbs_prob_integral s f + qbs_prob_integral s g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sub>Q x. f x + g x \<partial>s = qbs_prob_integral s f + qbs_prob_integral s g
[PROOF STEP]
using Bochner_Integration.integral_add[OF integrable_if_qbs_integrable[OF assms(1)] integrable_if_qbs_integrable[OF assms(2)]]
[PROOF STATE]
proof (prove)
using this:
qbs_prob_measure_prob_space.expectation s (\<lambda>x. f x + g x) = qbs_prob_measure_prob_space.expectation s f + qbs_prob_measure_prob_space.expectation s g

goal (1 subgoal):
 1. \<integral>\<^sub>Q x. f x + g x \<partial>s = qbs_prob_integral s f + qbs_prob_integral s g
[PROOF STEP]
by(simp add: qbs_prob_integral_def2)


[STATEMENT]
lemma P_accD:
  assumes "((x1, x2), (y1, y2)) \<in> acc"shows "(x1, y1) \<in> K1.acc" "(x2, y2) \<in> K2.acc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x1, y1) \<in> K1.acc &&& (x2, y2) \<in> K2.acc
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
((x1, x2), y1, y2) \<in> (SIGMA x:UNIV. set_pmf (Kp x))\<^sup>*

goal (1 subgoal):
 1. (x1, y1) \<in> K1.acc &&& (x2, y2) \<in> K2.acc
[PROOF STEP]
by (auto simp: acc_iff K1.acc_iff K2.acc_iff p_eq_p1_p2 zero_less_mult_iff not_le[of 0, symmetric]
                       cong: conj_cong)


[STATEMENT]
lemma E_inf_lower2:
  "cfg \<in> cfg_on s \<Longrightarrow> (\<integral>\<^sup>+x. f x \<partial>T cfg) \<le> x \<Longrightarrow> E_inf s f \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cfg \<in> cfg_on s; integral\<^sup>N (T cfg) f \<le> x\<rbrakk> \<Longrightarrow> E_inf s f \<le> x
[PROOF STEP]
unfolding E_inf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cfg \<in> cfg_on s; integral\<^sup>N (T cfg) f \<le> x\<rbrakk> \<Longrightarrow> (\<Sqinter>cfg\<in>cfg_on s. integral\<^sup>N (T cfg) f) \<le> x
[PROOF STEP]
by (rule INF_lower2)


[STATEMENT]
lemma word32_bounds:
  "- (2 ^ (size (x :: word32) - 1)) = (-2147483648 :: int)"
  "((2 ^ (size (x :: word32) - 1)) - 1) = (2147483647 :: int)"
  "- (2 ^ (size (y :: 32 signed word) - 1)) = (-2147483648 :: int)"
  "((2 ^ (size (y :: 32 signed word) - 1)) - 1) = (2147483647 :: int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- (2 ^ (size x - 1)) = - 2147483648 &&& 2 ^ (size x - 1) - 1 = 2147483647) &&& - (2 ^ (size y - 1)) = - 2147483648 &&& 2 ^ (size y - 1) - 1 = 2147483647
[PROOF STEP]
by (simp_all add: word_size)


[STATEMENT]
lemma "\<exists>z. \<forall>(x::'a::linordered_field) < \<bar>z\<bar>. \<exists>y w. x < y \<and> x < z \<and> x > w \<and> 3 * x < w + y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z. \<forall>x<\<bar>z\<bar>. \<exists>y w. x < y \<and> x < z \<and> w < x \<and> (3::'a) * x < w + y
[PROOF STEP]
by ferrack


[STATEMENT]
lemma NOT_SUC: "\<forall>n. Suc n \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. Suc n \<noteq> 0
[PROOF STEP]
by simp


[STATEMENT]
lemma construct_cong: "(\<And>b. b \<in> B \<Longrightarrow> f b = g b) \<Longrightarrow> construct B f = construct B g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>b. b \<in> B \<Longrightarrow> f b = g b) \<Longrightarrow> construct B f = construct B g
[PROOF STEP]
unfolding construct_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>b. b \<in> B \<Longrightarrow> f b = g b) \<Longrightarrow> (\<lambda>v. \<Sum>b | vs1.representation (vs1.extend_basis B) v b \<noteq> (0::'a). vs1.representation (vs1.extend_basis B) v b *b (if b \<in> B then f b else (0::'c))) = (\<lambda>v. \<Sum>b | vs1.representation (vs1.extend_basis B) v b \<noteq> (0::'a). vs1.representation (vs1.extend_basis B) v b *b (if b \<in> B then g b else (0::'c)))
[PROOF STEP]
by (rule ext, auto intro!: sum.cong)


[STATEMENT]
theorem Zp_is_compact:
  assumes "s \<in> closed_seqs Zp"
  shows "\<exists>s'. is_subseq_of s s' \<and> (Zp_converges_to s' (acc_point s))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>s'. is_subseq_of s s' \<and> Zp_converges_to s' (acc_point s)
[PROOF STEP]
using assms convergent_subseq_is_subseq convergent_subsequence_is_convergent
[PROOF STATE]
proof (prove)
using this:
s \<in> carrier Zp\<^bsup>\<omega>\<^esup>
?s \<in> carrier Zp\<^bsup>\<omega>\<^esup> \<Longrightarrow> is_subseq_of ?s (convergent_subseq ?s)
\<lbrakk>?s \<in> carrier Zp\<^bsup>\<omega>\<^esup>; ?a = acc_point ?s\<rbrakk> \<Longrightarrow> Zp_converges_to (convergent_subseq ?s) (acc_point ?s)

goal (1 subgoal):
 1. \<exists>s'. is_subseq_of s s' \<and> Zp_converges_to s' (acc_point s)
[PROOF STEP]
by blast


[STATEMENT]
lemma sat_inter_names_cong: "(\<And>e. e \<in> names \<phi> \<Longrightarrow> {xs. (e, xs) \<in> E} = {xs. (e, xs) \<in> F}) \<Longrightarrow>
  MFOTL.sat (map_\<Gamma> (\<lambda>D. D \<inter> E) \<sigma>) v i \<phi> \<longleftrightarrow> MFOTL.sat (map_\<Gamma> (\<lambda>D. D \<inter> F) \<sigma>) v i \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>e. e \<in> names \<phi> \<Longrightarrow> {xs. (e, xs) \<in> E} = {xs. (e, xs) \<in> F}) \<Longrightarrow> MFOTL.sat (map_\<Gamma> (\<lambda>D. D \<inter> E) \<sigma>) v i \<phi> = MFOTL.sat (map_\<Gamma> (\<lambda>D. D \<inter> F) \<sigma>) v i \<phi>
[PROOF STEP]
by (induction \<phi> arbitrary: v i) (auto split: nat.splits)


[STATEMENT]
lemma is_semialg_functionE:
  assumes "is_semialg_function m f"
  assumes "is_semialgebraic (1 + k) S"
  shows " is_semialgebraic (m + k) (partial_pullback m f k S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_semialgebraic (m + k) (partial_pullback m f k S)
[PROOF STEP]
using is_semialg_function_def assms
[PROOF STATE]
proof (prove)
using this:
is_semialg_function ?m ?f = (?f \<in> carrier (Q\<^sub>p\<^bsup>?m\<^esup>) \<rightarrow> carrier Q\<^sub>p \<and> (\<forall>l\<ge>0. \<forall>S\<in>semialg_sets (1 + l). is_semialgebraic (?m + l) (partial_pullback ?m ?f l S)))
is_semialg_function m f
is_semialgebraic (1 + k) S

goal (1 subgoal):
 1. is_semialgebraic (m + k) (partial_pullback m f k S)
[PROOF STEP]
by (meson is_semialgebraicE le0)


[STATEMENT]
lemma "[| (i::int) ~= j; (a::nat) ~= b; a < 2; b < 2 |] ==>
  a + b <= nat (max \<bar>i\<bar> \<bar>j\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i \<noteq> j; a \<noteq> b; a < 2; b < 2\<rbrakk> \<Longrightarrow> a + b \<le> nat (max \<bar>i\<bar> \<bar>j\<bar>)
[PROOF STEP]
by linarith


[STATEMENT]
lemma box_cut_iteration_an:
  "|x\<^sup>\<omega> \<squnion> x\<^sup>\<star>]an(y) = |(an(y) * x)\<^sup>\<omega> \<squnion> (an(y) * x)\<^sup>\<star>]an(y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. | x\<^sup>\<omega> \<squnion> x\<^sup>\<star> ] an y = | (an y * x)\<^sup>\<omega> \<squnion> (an y * x)\<^sup>\<star> ] an y
[PROOF STEP]
apply (rule order.antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. | x\<^sup>\<omega> \<squnion> x\<^sup>\<star> ] an y \<le> | (an y * x)\<^sup>\<omega> \<squnion> (an y * x)\<^sup>\<star> ] an y
 2. | (an y * x)\<^sup>\<omega> \<squnion> (an y * x)\<^sup>\<star> ] an y \<le> | x\<^sup>\<omega> \<squnion> x\<^sup>\<star> ] an y
[PROOF STEP]
apply (meson semiring.add_mono an_case_split_left box_left_antitone omega_isotone order_refl star.circ_isotone)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. | (an y * x)\<^sup>\<omega> \<squnion> (an y * x)\<^sup>\<star> ] an y \<le> | x\<^sup>\<omega> \<squnion> x\<^sup>\<star> ] an y
[PROOF STEP]
by (smt (z3) an_box_omega_induct_an an_mult_commutative box_omega_unfold_an nbox_def order_refl)


[STATEMENT]
lemma (in is_cat_obj_prod_2) cat_obj_prod_2_unique:
  assumes "\<pi>' : P' <\<^sub>C\<^sub>F\<^sub>.\<^sub>\<times> {a,b} : 2\<^sub>C \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>"
  shows "\<exists>!f'. f' : P' \<mapsto>\<^bsub>\<CC>\<^esub> P \<and> \<pi>' = \<pi> \<bullet>\<^sub>N\<^sub>T\<^sub>C\<^sub>F ntcf_const (:\<^sub>C (2\<^sub>\<nat>)) \<CC> f'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!f'. f' : P' \<mapsto>\<^bsub>\<CC>\<^esub> P \<and> \<pi>' = \<pi> \<bullet>\<^sub>N\<^sub>T\<^sub>S\<^sub>M\<^sub>C\<^sub>F ntcf_const (:\<^sub>C (2\<^sub>\<nat>)) \<CC> f'
[PROOF STEP]
by (rule cat_obj_prod_unique[OF is_cat_obj_prod_2D[OF assms]])


[STATEMENT]
lemma interchange:
    assumes "seq h g" and "seq h' g'"
    shows "(h \<otimes> h') \<cdot> (g \<otimes> g') = h \<cdot> g \<otimes> h' \<cdot> g'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (h \<otimes> h') \<cdot> (g \<otimes> g') = h \<cdot> g \<otimes> h' \<cdot> g'
[PROOF STEP]
using assms T.preserves_comp [of "(h, h')" "(g, g')"]
[PROOF STATE]
proof (prove)
using this:
seq h g
seq h' g'
CC.seq (h, h') (g, g') \<Longrightarrow> T (CC.comp (h, h') (g, g')) = (h \<otimes> h') \<cdot> (g \<otimes> g')

goal (1 subgoal):
 1. (h \<otimes> h') \<cdot> (g \<otimes> g') = h \<cdot> g \<otimes> h' \<cdot> g'
[PROOF STEP]
by simp


[STATEMENT]
lemma lottery_conditions:
  assumes "is_pref_profile R"
  shows   "pmf (sds R) a \<ge> 0" "pmf (sds R) b \<ge> 0" "pmf (sds R) c \<ge> 0" "pmf (sds R) d \<ge> 0"
          "pmf (sds R) a + pmf (sds R) b + pmf (sds R) c + pmf (sds R) d = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<le> pmf (sds R) a &&& 0 \<le> pmf (sds R) b) &&& 0 \<le> pmf (sds R) c &&& 0 \<le> pmf (sds R) d &&& pmf (sds R) a + pmf (sds R) b + pmf (sds R) c + pmf (sds R) d = 1
[PROOF STEP]
using lottery_prob_alts[OF sds_wf[OF assms]]
[PROOF STATE]
proof (prove)
using this:
lottery_prob (sds R) alts = 1

goal (1 subgoal):
 1. (0 \<le> pmf (sds R) a &&& 0 \<le> pmf (sds R) b) &&& 0 \<le> pmf (sds R) c &&& 0 \<le> pmf (sds R) d &&& pmf (sds R) a + pmf (sds R) b + pmf (sds R) c + pmf (sds R) d = 1
[PROOF STEP]
by (simp_all add: alts pmf_nonneg measure_measure_pmf_finite)


[STATEMENT]
theorem finite_ordLess_var:
"( |S| <o |UNIV :: 'var set| \<or> finite S) = ( |S| <o |UNIV :: 'var set| )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (|S| <o |UNIV| \<or> finite S) = (|S| <o |UNIV|)
[PROOF STEP]
by (auto simp add: var_infinite_INNER finite_ordLess_infinite2)


[STATEMENT]
lemma frontier_convex_hull_explicit:
  fixes S :: "'a::euclidean_space set"
  assumes "\<not> affine_dependent S"
  shows "frontier(convex hull S) =
         {y. \<exists>u. (\<forall>x \<in> S. 0 \<le> u x) \<and> (DIM ('a) < card S \<longrightarrow> (\<exists>x \<in> S. u x = 0)) \<and>
             sum u S = 1 \<and> sum (\<lambda>x. u x *\<^sub>R x) S = y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frontier (convex hull S) = {y. \<exists>u. (\<forall>x\<in>S. 0 \<le> u x) \<and> (DIM('a) < card S \<longrightarrow> (\<exists>x\<in>S. u x = 0)) \<and> sum u S = 1 \<and> (\<Sum>x\<in>S. u x *\<^sub>R x) = y}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. frontier (convex hull S) = {y. \<exists>u. (\<forall>x\<in>S. 0 \<le> u x) \<and> (DIM('a) < card S \<longrightarrow> (\<exists>x\<in>S. u x = 0)) \<and> sum u S = 1 \<and> (\<Sum>x\<in>S. u x *\<^sub>R x) = y}
[PROOF STEP]
have fs: "finite S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<not> affine_dependent S

goal (1 subgoal):
 1. finite S
[PROOF STEP]
by (simp add: aff_independent_finite)
[PROOF STATE]
proof (state)
this:
finite S

goal (1 subgoal):
 1. frontier (convex hull S) = {y. \<exists>u. (\<forall>x\<in>S. 0 \<le> u x) \<and> (DIM('a) < card S \<longrightarrow> (\<exists>x\<in>S. u x = 0)) \<and> sum u S = 1 \<and> (\<Sum>x\<in>S. u x *\<^sub>R x) = y}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frontier (convex hull S) = {y. \<exists>u. (\<forall>x\<in>S. 0 \<le> u x) \<and> (DIM('a) < card S \<longrightarrow> (\<exists>x\<in>S. u x = 0)) \<and> sum u S = 1 \<and> (\<Sum>x\<in>S. u x *\<^sub>R x) = y}
[PROOF STEP]
proof (cases "DIM ('a) < card S")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. DIM('a) < card S \<Longrightarrow> frontier (convex hull S) = {y. \<exists>u. (\<forall>x\<in>S. 0 \<le> u x) \<and> (DIM('a) < card S \<longrightarrow> (\<exists>x\<in>S. u x = 0)) \<and> sum u S = 1 \<and> (\<Sum>x\<in>S. u x *\<^sub>R x) = y}
 2. \<not> DIM('a) < card S \<Longrightarrow> frontier (convex hull S) = {y. \<exists>u. (\<forall>x\<in>S. 0 \<le> u x) \<and> (DIM('a) < card S \<longrightarrow> (\<exists>x\<in>S. u x = 0)) \<and> sum u S = 1 \<and> (\<Sum>x\<in>S. u x *\<^sub>R x) = y}
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
DIM('a) < card S

goal (2 subgoals):
 1. DIM('a) < card S \<Longrightarrow> frontier (convex hull S) = {y. \<exists>u. (\<forall>x\<in>S. 0 \<le> u x) \<and> (DIM('a) < card S \<longrightarrow> (\<exists>x\<in>S. u x = 0)) \<and> sum u S = 1 \<and> (\<Sum>x\<in>S. u x *\<^sub>R x) = y}
 2. \<not> DIM('a) < card S \<Longrightarrow> frontier (convex hull S) = {y. \<exists>u. (\<forall>x\<in>S. 0 \<le> u x) \<and> (DIM('a) < card S \<longrightarrow> (\<exists>x\<in>S. u x = 0)) \<and> sum u S = 1 \<and> (\<Sum>x\<in>S. u x *\<^sub>R x) = y}
[PROOF STEP]
with assms fs
[PROOF STATE]
proof (chain)
picking this:
\<not> affine_dependent S
finite S
DIM('a) < card S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> affine_dependent S
finite S
DIM('a) < card S

goal (1 subgoal):
 1. frontier (convex hull S) = {y. \<exists>u. (\<forall>x\<in>S. 0 \<le> u x) \<and> (DIM('a) < card S \<longrightarrow> (\<exists>x\<in>S. u x = 0)) \<and> sum u S = 1 \<and> (\<Sum>x\<in>S. u x *\<^sub>R x) = y}
[PROOF STEP]
by (simp add: rel_frontier_def frontier_def rel_frontier_convex_hull_explicit [symmetric]
                    interior_convex_hull_explicit_minimal rel_interior_convex_hull_explicit)
[PROOF STATE]
proof (state)
this:
frontier (convex hull S) = {y. \<exists>u. (\<forall>x\<in>S. 0 \<le> u x) \<and> (DIM('a) < card S \<longrightarrow> (\<exists>x\<in>S. u x = 0)) \<and> sum u S = 1 \<and> (\<Sum>x\<in>S. u x *\<^sub>R x) = y}

goal (1 subgoal):
 1. \<not> DIM('a) < card S \<Longrightarrow> frontier (convex hull S) = {y. \<exists>u. (\<forall>x\<in>S. 0 \<le> u x) \<and> (DIM('a) < card S \<longrightarrow> (\<exists>x\<in>S. u x = 0)) \<and> sum u S = 1 \<and> (\<Sum>x\<in>S. u x *\<^sub>R x) = y}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> DIM('a) < card S \<Longrightarrow> frontier (convex hull S) = {y. \<exists>u. (\<forall>x\<in>S. 0 \<le> u x) \<and> (DIM('a) < card S \<longrightarrow> (\<exists>x\<in>S. u x = 0)) \<and> sum u S = 1 \<and> (\<Sum>x\<in>S. u x *\<^sub>R x) = y}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> DIM('a) < card S

goal (1 subgoal):
 1. \<not> DIM('a) < card S \<Longrightarrow> frontier (convex hull S) = {y. \<exists>u. (\<forall>x\<in>S. 0 \<le> u x) \<and> (DIM('a) < card S \<longrightarrow> (\<exists>x\<in>S. u x = 0)) \<and> sum u S = 1 \<and> (\<Sum>x\<in>S. u x *\<^sub>R x) = y}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> DIM('a) < card S
[PROOF STEP]
have "card S \<le> DIM ('a)"
[PROOF STATE]
proof (prove)
using this:
\<not> DIM('a) < card S

goal (1 subgoal):
 1. card S \<le> DIM('a)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
card S \<le> DIM('a)

goal (1 subgoal):
 1. \<not> DIM('a) < card S \<Longrightarrow> frontier (convex hull S) = {y. \<exists>u. (\<forall>x\<in>S. 0 \<le> u x) \<and> (DIM('a) < card S \<longrightarrow> (\<exists>x\<in>S. u x = 0)) \<and> sum u S = 1 \<and> (\<Sum>x\<in>S. u x *\<^sub>R x) = y}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card S \<le> DIM('a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card S \<le> DIM('a)

goal (1 subgoal):
 1. frontier (convex hull S) = {y. \<exists>u. (\<forall>x\<in>S. 0 \<le> u x) \<and> (DIM('a) < card S \<longrightarrow> (\<exists>x\<in>S. u x = 0)) \<and> sum u S = 1 \<and> (\<Sum>x\<in>S. u x *\<^sub>R x) = y}
[PROOF STEP]
using assms fs
[PROOF STATE]
proof (prove)
using this:
card S \<le> DIM('a)
\<not> affine_dependent S
finite S

goal (1 subgoal):
 1. frontier (convex hull S) = {y. \<exists>u. (\<forall>x\<in>S. 0 \<le> u x) \<and> (DIM('a) < card S \<longrightarrow> (\<exists>x\<in>S. u x = 0)) \<and> sum u S = 1 \<and> (\<Sum>x\<in>S. u x *\<^sub>R x) = y}
[PROOF STEP]
apply (simp add: frontier_def interior_convex_hull_explicit finite_imp_compact)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>card S \<le> DIM('a); \<not> affine_dependent S; finite S\<rbrakk> \<Longrightarrow> convex hull S = {y. \<exists>u. (\<forall>x\<in>S. 0 \<le> u x) \<and> sum u S = 1 \<and> (\<Sum>x\<in>S. u x *\<^sub>R x) = y}
[PROOF STEP]
apply (simp add: convex_hull_finite)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
frontier (convex hull S) = {y. \<exists>u. (\<forall>x\<in>S. 0 \<le> u x) \<and> (DIM('a) < card S \<longrightarrow> (\<exists>x\<in>S. u x = 0)) \<and> sum u S = 1 \<and> (\<Sum>x\<in>S. u x *\<^sub>R x) = y}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
frontier (convex hull S) = {y. \<exists>u. (\<forall>x\<in>S. 0 \<le> u x) \<and> (DIM('a) < card S \<longrightarrow> (\<exists>x\<in>S. u x = 0)) \<and> sum u S = 1 \<and> (\<Sum>x\<in>S. u x *\<^sub>R x) = y}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma isom_gch_cmp:"\<lbrakk>Gchain n g; Gchain n h; f1 \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> n};
           f2 \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> n}; isom_Gchains n (cmp f2 f1) g h\<rbrakk> \<Longrightarrow>
             isom_Gchains n f1 g (cmp h f2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Gchain n g; Gchain n h; f1 \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> n}; f2 \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> n}; isom_Gchains n (cmp f2 f1) g h\<rbrakk> \<Longrightarrow> isom_Gchains n f1 g (cmp h f2)
[PROOF STEP]
apply (simp add:isom_Gchains_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Gchain n g; Gchain n h; f1 \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> n}; f2 \<in> {i. i \<le> n} \<rightarrow> {i. i \<le> n}; \<forall>i\<le>n. g i \<cong> h (cmp f2 f1 i)\<rbrakk> \<Longrightarrow> \<forall>i\<le>n. g i \<cong> cmp h f2 (f1 i)
[PROOF STEP]
apply (simp add:cmp_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma is_projection_on_is_cadjoint:
  fixes M :: \<open>'a::complex_inner set\<close>
  assumes a1: \<open>is_projection_on \<pi> M\<close> and a2: \<open>closed_csubspace M\<close>
  shows \<open>is_cadjoint \<pi> \<pi>\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_cadjoint \<pi> \<pi>
[PROOF STEP]
by (smt (verit, ccfv_threshold) a1 a2 cinner_diff_left cinner_eq_flip is_cadjoint_def is_projection_on_iff_orthog orthogonal_complement_orthoI right_minus_eq)


[STATEMENT]
lemma HMA_transpose_matrix [transfer_rule]:
  "(HMA_M ===> HMA_M) transpose_mat transpose"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (HMA_M ===> HMA_M) transpose_mat Finite_Cartesian_Product.transpose
[PROOF STEP]
unfolding transpose_mat_def transpose_def HMA_M_def from_hma\<^sub>m_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>a b. a = Matrix.mat CARD('c) CARD('b) (\<lambda>(i, j). b $h Bij_Nat.from_nat i $h Bij_Nat.from_nat j)) ===> (\<lambda>a b. a = Matrix.mat CARD('b) CARD('c) (\<lambda>(i, j). b $h Bij_Nat.from_nat i $h Bij_Nat.from_nat j))) (\<lambda>A. Matrix.mat (dim_col A) (dim_row A) (\<lambda>(i, j). A $$ (j, i))) (\<lambda>A. \<chi>i j. A $h j $h i)
[PROOF STEP]
by auto


[STATEMENT]
lemma singleton_ball: "(\<forall>x\<in>{a}. P x) = P a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>{a}. P x) = P a
[PROOF STEP]
by blast


[STATEMENT]
lemma lvl_Suc_iff: "lvl t = Suc n \<longleftrightarrow> (\<exists> l a r. t = Node l (a,Suc n) r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lvl t = Suc n) = (\<exists>l a r. t = \<langle>l, (a, Suc n), r\<rangle>)
[PROOF STEP]
by(cases t) auto


[STATEMENT]
lemma add_mono_le_Fin:
  "\<lbrakk>x1 \<le> Fin y1; x2 \<le> Fin y2\<rbrakk> \<Longrightarrow> x1 + x2 \<le> Fin (y1 + (y2::'a::ordered_ab_group_add))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x1 \<le> Fin y1; x2 \<le> Fin y2\<rbrakk> \<Longrightarrow> x1 + x2 \<le> Fin (y1 + y2)
[PROOF STEP]
by(drule (1) add_mono) simp


[STATEMENT]
lemma list_all2_fusion_code [code]:
  "list_all2_fusion P g1 g2 s1 s2 =
  (if list.has_next g1 s1 then
     list.has_next g2 s2 \<and>
     (let (x, s1') = list.next g1 s1;
          (y, s2') = list.next g2 s2
      in P x y \<and> list_all2_fusion P g1 g2 s1' s2')
   else \<not> list.has_next g2 s2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2_fusion P g1 g2 s1 s2 = (if list.has_next g1 s1 then list.has_next g2 s2 \<and> (let (x, s1') = list.next g1 s1; (y, s2') = list.next g2 s2 in P x y \<and> list_all2_fusion P g1 g2 s1' s2') else \<not> list.has_next g2 s2)
[PROOF STEP]
unfolding list_all2_fusion_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 P (list.unfoldr g1 s1) (list.unfoldr g2 s2) = (if list.has_next g1 s1 then list.has_next g2 s2 \<and> (let (x, s1') = list.next g1 s1; (y, s2') = list.next g2 s2 in P x y \<and> list_all2 P (list.unfoldr g1 s1') (list.unfoldr g2 s2')) else \<not> list.has_next g2 s2)
[PROOF STEP]
by(subst (1 2) list.unfoldr.simps)(simp add: split_beta)


[STATEMENT]
lemma FINITE_ALL_DISTINCT_LISTS:
  fixes P
  assumes "finite P"
  shows "finite {p. distinct p \<and> set p \<subseteq> P}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite P

goal (1 subgoal):
 1. finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
proof (induction "card P" arbitrary: P)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>P. \<lbrakk>0 = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
 2. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 = card P
finite P

goal (2 subgoals):
 1. \<And>P. \<lbrakk>0 = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
 2. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 = card P
finite P
[PROOF STEP]
have "P = {}"
[PROOF STATE]
proof (prove)
using this:
0 = card P
finite P

goal (1 subgoal):
 1. P = {}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
P = {}

goal (2 subgoals):
 1. \<And>P. \<lbrakk>0 = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
 2. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P = {}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
P = {}

goal (1 subgoal):
 1. finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
using this:
P = {}
0 = card P
finite P

goal (1 subgoal):
 1. finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {p. distinct p \<and> set p \<subseteq> P}

goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
case (Suc x)
[PROOF STATE]
proof (state)
this:
\<lbrakk>x = card ?P; finite ?P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> ?P}
Suc x = card P
finite P

goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>x = card ?P; finite ?P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> ?P}
Suc x = card P
finite P

goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
text \<open> Proof the finiteness of the union by proving both sets of the union are finite. The
      singleton set `{[]}` is trivially finite. \<close>
[PROOF STATE]
proof (state)
this:
\<lbrakk>x = card ?P; finite ?P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> ?P}
Suc x = card P
finite P

goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>x = card ?P; finite ?P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> ?P}
Suc x = card P
finite P

goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>x = card ?P; finite ?P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> ?P}
Suc x = card P
finite P

goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
fix e
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
assume P: "e \<in> P"
[PROOF STATE]
proof (state)
this:
e \<in> P

goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
have "
          {e # p0 | p0. distinct p0 \<and> set p0 \<subseteq> P - {e}}
          = (\<lambda>p. e # p) ` { p. distinct p \<and> set p \<subseteq> P - {e}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}} = (#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}} = (#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}}

goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}} = (#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}}

goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
{e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}} = (#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}}

goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
let ?P'="P - {e}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
from Suc.prems
[PROOF STATE]
proof (chain)
picking this:
finite P
[PROOF STEP]
have "finite ?P'"
[PROOF STATE]
proof (prove)
using this:
finite P

goal (1 subgoal):
 1. finite (P - {e})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite (P - {e})

goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
text \<open> The finiteness can now be shown using the induction hypothesis. However `e` might
            already be contained in `?P`, so we have to split cases first. \<close>
[PROOF STATE]
proof (state)
this:
finite (P - {e})

goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
have "finite ((\<lambda>p. e # p) ` {p. distinct p \<and> set p \<subseteq> ?P'})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
[PROOF STEP]
proof (cases "e \<in> P")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. e \<in> P \<Longrightarrow> finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
 2. e \<notin> P \<Longrightarrow> finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
e \<in> P

goal (2 subgoals):
 1. e \<in> P \<Longrightarrow> finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
 2. e \<notin> P \<Longrightarrow> finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
e \<in> P
[PROOF STEP]
have "x = card ?P'"
[PROOF STATE]
proof (prove)
using this:
e \<in> P

goal (1 subgoal):
 1. x = card (P - {e})
[PROOF STEP]
using Suc.prems Suc(2)
[PROOF STATE]
proof (prove)
using this:
e \<in> P
finite P
Suc x = card P

goal (1 subgoal):
 1. x = card (P - {e})
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x = card (P - {e})

goal (2 subgoals):
 1. e \<in> P \<Longrightarrow> finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
 2. e \<notin> P \<Longrightarrow> finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x = card (P - {e})

goal (2 subgoals):
 1. e \<in> P \<Longrightarrow> finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
 2. e \<notin> P \<Longrightarrow> finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
[PROOF STEP]
from Suc.prems
[PROOF STATE]
proof (chain)
picking this:
finite P
[PROOF STEP]
have "finite ?P'"
[PROOF STATE]
proof (prove)
using this:
finite P

goal (1 subgoal):
 1. finite (P - {e})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite (P - {e})

goal (2 subgoals):
 1. e \<in> P \<Longrightarrow> finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
 2. e \<notin> P \<Longrightarrow> finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x = card (P - {e})
finite (P - {e})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = card (P - {e})
finite (P - {e})

goal (1 subgoal):
 1. finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
[PROOF STEP]
using Suc(1)
[PROOF STATE]
proof (prove)
using this:
x = card (P - {e})
finite (P - {e})
\<lbrakk>x = card ?P; finite ?P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> ?P}

goal (1 subgoal):
 1. finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})

goal (1 subgoal):
 1. e \<notin> P \<Longrightarrow> finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. e \<notin> P \<Longrightarrow> finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
e \<notin> P

goal (1 subgoal):
 1. e \<notin> P \<Longrightarrow> finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
e \<notin> P
[PROOF STEP]
have "?P' = P"
[PROOF STATE]
proof (prove)
using this:
e \<notin> P

goal (1 subgoal):
 1. P - {e} = P
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
P - {e} = P

goal (1 subgoal):
 1. e \<notin> P \<Longrightarrow> finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P - {e} = P
[PROOF STEP]
have "finite {p. distinct p \<and> set p \<subseteq> ?P'}"
[PROOF STATE]
proof (prove)
using this:
P - {e} = P

goal (1 subgoal):
 1. finite {p. distinct p \<and> set p \<subseteq> P - {e}}
[PROOF STEP]
using False P
[PROOF STATE]
proof (prove)
using this:
P - {e} = P
e \<notin> P
e \<in> P

goal (1 subgoal):
 1. finite {p. distinct p \<and> set p \<subseteq> P - {e}}
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
finite {p. distinct p \<and> set p \<subseteq> P - {e}}

goal (1 subgoal):
 1. e \<notin> P \<Longrightarrow> finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite {p. distinct p \<and> set p \<subseteq> P - {e}}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite {p. distinct p \<and> set p \<subseteq> P - {e}}

goal (1 subgoal):
 1. finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
[PROOF STEP]
using finite_imageI
[PROOF STATE]
proof (prove)
using this:
finite {p. distinct p \<and> set p \<subseteq> P - {e}}
finite ?F \<Longrightarrow> finite (?h ` ?F)

goal (1 subgoal):
 1. finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})

goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})

goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}} = (#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}}
finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})
[PROOF STEP]
have "finite {e # p0 | p0. distinct p0 \<and> set p0 \<subseteq> (P - {e})}"
[PROOF STATE]
proof (prove)
using this:
{e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}} = (#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}}
finite ((#) e ` {p. distinct p \<and> set p \<subseteq> P - {e}})

goal (1 subgoal):
 1. finite {e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}}
[PROOF STEP]
by argo
[PROOF STATE]
proof (state)
this:
finite {e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}}

goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?e2 \<in> P \<Longrightarrow> finite {?e2 # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {?e2}}

goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?e2 \<in> P \<Longrightarrow> finite {?e2 # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {?e2}}
[PROOF STEP]
have "finite (\<Union> ((\<lambda>e. {e # p0 | p0. distinct p0 \<and> set p0 \<subseteq> (P - {e})}) ` P))"
[PROOF STATE]
proof (prove)
using this:
?e2 \<in> P \<Longrightarrow> finite {?e2 # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {?e2}}

goal (1 subgoal):
 1. finite (\<Union>e\<in>P. {e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}})
[PROOF STEP]
using Suc.prems
[PROOF STATE]
proof (prove)
using this:
?e2 \<in> P \<Longrightarrow> finite {?e2 # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {?e2}}
finite P

goal (1 subgoal):
 1. finite (\<Union>e\<in>P. {e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite (\<Union>e\<in>P. {e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}})

goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
finite (\<Union>e\<in>P. {e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}})

goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (\<Union>e\<in>P. {e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}})
[PROOF STEP]
have
      "finite ({[]} \<union> (\<Union> ((\<lambda>e. {e # p0 | p0. distinct p0 \<and> set p0 \<subseteq> (P - {e})}) ` P)))"
[PROOF STATE]
proof (prove)
using this:
finite (\<Union>e\<in>P. {e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}})

goal (1 subgoal):
 1. finite ({[]} \<union> (\<Union>e\<in>P. {e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}}))
[PROOF STEP]
using finite_Un
[PROOF STATE]
proof (prove)
using this:
finite (\<Union>e\<in>P. {e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}})
finite (?F \<union> ?G) = (finite ?F \<and> finite ?G)

goal (1 subgoal):
 1. finite ({[]} \<union> (\<Union>e\<in>P. {e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}}))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite ({[]} \<union> (\<Union>e\<in>P. {e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}}))

goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
finite ({[]} \<union> (\<Union>e\<in>P. {e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}}))

goal (1 subgoal):
 1. \<And>x P. \<lbrakk>\<And>P. \<lbrakk>x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}; Suc x = card P; finite P\<rbrakk> \<Longrightarrow> finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite ({[]} \<union> (\<Union>e\<in>P. {e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}}))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite ({[]} \<union> (\<Union>e\<in>P. {e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}}))

goal (1 subgoal):
 1. finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
using FINITE_ALL_DISTINCT_LISTS_i[OF Suc.prems]
[PROOF STATE]
proof (prove)
using this:
finite ({[]} \<union> (\<Union>e\<in>P. {e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}}))
{p. distinct p \<and> set p \<subseteq> P} = {[]} \<union> (\<Union>e\<in>P. {e # p0 |p0. distinct p0 \<and> set p0 \<subseteq> P - {e}})

goal (1 subgoal):
 1. finite {p. distinct p \<and> set p \<subseteq> P}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
finite {p. distinct p \<and> set p \<subseteq> P}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma divsor_ex:
  "\<lbrakk>\<not> Prime x; x > Suc 0\<rbrakk> \<Longrightarrow> (\<exists> u > Suc 0. (\<exists> v > Suc 0. u * v = x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> Prime x; Suc 0 < x\<rbrakk> \<Longrightarrow> \<exists>u>Suc 0. \<exists>v>Suc 0. u * v = x
[PROOF STEP]
by(auto simp: Prime.simps)


[STATEMENT]
lemma mod_ring_mod64: "(mod_ring_rel64 ===> mod_ring_rel64 ===> mod_ring_rel64) (\<lambda>x y. if y = 0 then x else 0) (mod)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mod_ring_rel64 ===> mod_ring_rel64 ===> mod_ring_rel64) (\<lambda>x y. if y = 0 then x else 0) (mod)
[PROOF STEP]
using urel64_mod[OF *] mod_ring_mod
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>urel64 ?x ?x'; urel64 ?y ?y'\<rbrakk> \<Longrightarrow> urel64 (if ?y = 0 then ?x else 0) (if ?y' = 0 then ?x' else 0)
(mod_ring_rel ===> mod_ring_rel ===> mod_ring_rel) (\<lambda>x y. if y = 0 then x else 0) (mod)

goal (1 subgoal):
 1. (mod_ring_rel64 ===> mod_ring_rel64 ===> mod_ring_rel64) (\<lambda>x y. if y = 0 then x else 0) (mod)
[PROOF STEP]
unfolding mod_ring_rel64_def[OF *] rel_fun_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>urel64 ?x ?x'; urel64 ?y ?y'\<rbrakk> \<Longrightarrow> urel64 (if ?y = 0 then ?x else 0) (if ?y' = 0 then ?x' else 0)
\<forall>x y. mod_ring_rel x y \<longrightarrow> (\<forall>xa ya. mod_ring_rel xa ya \<longrightarrow> mod_ring_rel (if xa = 0 then x else 0) (y mod ya))

goal (1 subgoal):
 1. \<forall>x y. (\<exists>z. urel64 x z \<and> mod_ring_rel z y) \<longrightarrow> (\<forall>xa ya. (\<exists>z. urel64 xa z \<and> mod_ring_rel z ya) \<longrightarrow> (\<exists>z. urel64 (if xa = 0 then x else 0) z \<and> mod_ring_rel z (y mod ya)))
[PROOF STEP]
by blast


[STATEMENT]
lemma sat_CONJ_disjoint: "finite Qeq \<Longrightarrow> sat (CONJ_disjoint (Q, Qeq)) I \<sigma> \<longleftrightarrow> sat Q I \<sigma> \<and> (\<forall>(x, y) \<in> Qeq. sat (x \<approx> y) I \<sigma>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite Qeq \<Longrightarrow> sat (CONJ_disjoint (Q, Qeq)) I \<sigma> = (sat Q I \<sigma> \<and> (\<forall>(x, y)\<in>Qeq. sat (x \<approx> y) I \<sigma>))
[PROOF STEP]
unfolding CONJ_disjoint_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite Qeq \<Longrightarrow> sat (case (Q, Qeq) of (Q, Qeq) \<Rightarrow> Conjs_disjoint Q (sorted_list_of_set Qeq)) I \<sigma> = (sat Q I \<sigma> \<and> (\<forall>(x, y)\<in>Qeq. sat (x \<approx> y) I \<sigma>))
[PROOF STEP]
by (auto simp: sat_Conjs_disjoint)


[STATEMENT]
lemma "(\<forall>x. f x \<and> (\<forall>y. f y \<and> h y x \<longrightarrow> g y) \<longrightarrow> g x) \<and>
       ((\<exists>x. f x \<and> \<not>g x) \<longrightarrow>
       (\<exists>x. f x \<and> \<not>g x \<and> (\<forall>y. f y \<and> \<not>g y \<longrightarrow> j x y))) \<and>
       (\<forall>x y. f x \<and> f y \<and> h x y \<longrightarrow> \<not>j y x)
       \<longrightarrow> (\<forall>x. f x \<longrightarrow> g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. f x \<and> (\<forall>y. f y \<and> h y x \<longrightarrow> g y) \<longrightarrow> g x) \<and> ((\<exists>x. f x \<and> \<not> g x) \<longrightarrow> (\<exists>x. f x \<and> \<not> g x \<and> (\<forall>y. f y \<and> \<not> g y \<longrightarrow> j x y))) \<and> (\<forall>x y. f x \<and> f y \<and> h x y \<longrightarrow> \<not> j y x) \<longrightarrow> (\<forall>x. f x \<longrightarrow> g x)
[PROOF STEP]
by blast


[STATEMENT]
lemma xor_int_rec:
  \<open>k XOR l = of_bool (odd k \<noteq> odd l) + 2 * ((k div 2) XOR (l div 2))\<close>
  for k l :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k XOR l = of_bool (odd k \<noteq> odd l) + 2 * (k div 2 XOR l div 2)
[PROOF STEP]
by (simp add: xor_int_def or_int_rec [of \<open>k AND NOT l\<close> \<open>NOT k AND l\<close>] even_and_iff_int even_not_iff_int)
    (simp add: and_int_rec [of \<open>NOT k\<close> \<open>l\<close>] and_int_rec [of \<open>k\<close> \<open>NOT l\<close>] not_int_div_2)