[STATEMENT]
lemma hurwitz_zeta_nat_conv_infsetsum:
  assumes "a > 0" and "Re s > 1"
  shows   "hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr -s)"
          "hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr -s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr - s) &&& hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)
 2. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
have "hurwitz_zeta (real a) s = (\<Sum>n. of_nat (n + a) powr -s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hurwitz_zeta (real a) s = (\<Sum>n. of_nat (n + a) powr - s)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < a
1 < Re s

goal (1 subgoal):
 1. hurwitz_zeta (real a) s = (\<Sum>n. of_nat (n + a) powr - s)
[PROOF STEP]
by (subst hurwitz_zeta_conv_suminf) auto
[PROOF STATE]
proof (state)
this:
hurwitz_zeta (real a) s = (\<Sum>n. of_nat (n + a) powr - s)

goal (2 subgoals):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)
 2. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
hurwitz_zeta (real a) s = (\<Sum>n. of_nat (n + a) powr - s)

goal (2 subgoals):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)
 2. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
have "\<dots> = (\<Sum>\<^sub>an. of_nat (n + a) powr -s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. of_nat (n + a) powr - s) = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)
[PROOF STEP]
using abs_summable_hurwitz_zeta[of s a 0] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 < Re s; 0 < real a + real 0\<rbrakk> \<Longrightarrow> (\<lambda>n. 1 / complex_of_real (real n + real a) powr s) abs_summable_on {0..}
0 < a
1 < Re s

goal (1 subgoal):
 1. (\<Sum>n. of_nat (n + a) powr - s) = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)
[PROOF STEP]
by (intro infsetsum_nat' [symmetric]) (auto simp: powr_minus field_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>n. of_nat (n + a) powr - s) = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)

goal (2 subgoals):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)
 2. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)
[PROOF STEP]
show "hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr -s)"
[PROOF STATE]
proof (prove)
using this:
hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)

goal (1 subgoal):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)

goal (1 subgoal):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
hurwitz_zeta (real a) s = (\<Sum>\<^sub>an. of_nat (n + a) powr - s)

goal (1 subgoal):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
have "\<dots> = (\<Sum>\<^sub>an\<in>range (\<lambda>n. n + a). of_nat n powr -s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>an. of_nat (n + a) powr - s) = (\<Sum>\<^sub>an\<in>range (\<lambda>n. n + a). of_nat n powr - s)
[PROOF STEP]
by (rule infsetsum_reindex [symmetric]) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sub>an. of_nat (n + a) powr - s) = (\<Sum>\<^sub>an\<in>range (\<lambda>n. n + a). of_nat n powr - s)

goal (1 subgoal):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sub>an. of_nat (n + a) powr - s) = (\<Sum>\<^sub>an\<in>range (\<lambda>n. n + a). of_nat n powr - s)

goal (1 subgoal):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
have "range (\<lambda>n. n + a) = {a..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range (\<lambda>n. n + a) = {a..}
[PROOF STEP]
by (rule range_add_nat)
[PROOF STATE]
proof (state)
this:
range (\<lambda>n. n + a) = {a..}

goal (1 subgoal):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
show "hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr -s)"
[PROOF STATE]
proof (prove)
using this:
hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)

goal (1 subgoal):
 1. hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
hurwitz_zeta (real a) s = (\<Sum>\<^sub>an\<in>{a..}. of_nat n powr - s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in topological_space) nhds_generated_topology:
  "open = generate_topology T \<Longrightarrow> nhds x = (INF S\<in>{S\<in>T. x \<in> S}. principal S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open = generate_topology T \<Longrightarrow> nhds x = Inf (principal ` {S \<in> T. x \<in> S})
[PROOF STEP]
unfolding nhds_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open = generate_topology T \<Longrightarrow> Inf (principal ` {S. open S \<and> x \<in> S}) = Inf (principal ` {S \<in> T. x \<in> S})
[PROOF STEP]
proof (safe intro!: antisym INF_greatest)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>S. \<lbrakk>open = generate_topology T; S \<in> T; x \<in> S\<rbrakk> \<Longrightarrow> Inf (principal ` {S. generate_topology T S \<and> x \<in> S}) \<le> principal S
 2. \<And>i. \<lbrakk>open = generate_topology T; generate_topology T i; x \<in> i\<rbrakk> \<Longrightarrow> Inf (principal ` {S \<in> T. x \<in> S}) \<le> principal i
[PROOF STEP]
fix S
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>S. \<lbrakk>open = generate_topology T; S \<in> T; x \<in> S\<rbrakk> \<Longrightarrow> Inf (principal ` {S. generate_topology T S \<and> x \<in> S}) \<le> principal S
 2. \<And>i. \<lbrakk>open = generate_topology T; generate_topology T i; x \<in> i\<rbrakk> \<Longrightarrow> Inf (principal ` {S \<in> T. x \<in> S}) \<le> principal i
[PROOF STEP]
assume "generate_topology T S" "x \<in> S"
[PROOF STATE]
proof (state)
this:
generate_topology T S
x \<in> S

goal (2 subgoals):
 1. \<And>S. \<lbrakk>open = generate_topology T; S \<in> T; x \<in> S\<rbrakk> \<Longrightarrow> Inf (principal ` {S. generate_topology T S \<and> x \<in> S}) \<le> principal S
 2. \<And>i. \<lbrakk>open = generate_topology T; generate_topology T i; x \<in> i\<rbrakk> \<Longrightarrow> Inf (principal ` {S \<in> T. x \<in> S}) \<le> principal i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
generate_topology T S
x \<in> S
[PROOF STEP]
show "(INF S\<in>{S \<in> T. x \<in> S}. principal S) \<le> principal S"
[PROOF STATE]
proof (prove)
using this:
generate_topology T S
x \<in> S

goal (1 subgoal):
 1. Inf (principal ` {S \<in> T. x \<in> S}) \<le> principal S
[PROOF STEP]
by induct
      (auto intro: INF_lower order_trans simp: inf_principal[symmetric] simp del: inf_principal)
[PROOF STATE]
proof (state)
this:
Inf (principal ` {S \<in> T. x \<in> S}) \<le> principal S

goal (1 subgoal):
 1. \<And>S. \<lbrakk>open = generate_topology T; S \<in> T; x \<in> S\<rbrakk> \<Longrightarrow> Inf (principal ` {S. generate_topology T S \<and> x \<in> S}) \<le> principal S
[PROOF STEP]
qed (auto intro!: INF_lower intro: generate_topology.intros)


[STATEMENT]
lemma ord_spmf_eqD_pmf_None:
  assumes "ord_spmf (=) x y"
  shows "pmf x None \<ge> pmf y None"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf y None \<le> pmf x None
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
ord_spmf (=) x y

goal (1 subgoal):
 1. pmf y None \<le> pmf x None
[PROOF STEP]
apply cases
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>pq. \<lbrakk>\<And>x y. (x, y) \<in> set_pmf pq \<Longrightarrow> ord_option (=) x y; map_pmf fst pq = x; map_pmf snd pq = y\<rbrakk> \<Longrightarrow> pmf y None \<le> pmf x None
[PROOF STEP]
apply(clarsimp simp only: ennreal_le_iff[symmetric, OF pmf_nonneg] ennreal_pmf_map)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>pq. \<lbrakk>\<And>x y. (x, y) \<in> set_pmf pq \<Longrightarrow> ord_option (=) x y; x = map_pmf fst pq; y = map_pmf snd pq\<rbrakk> \<Longrightarrow> integral\<^sup>N (measure_pmf pq) (indicator (snd -` {None})) \<le> integral\<^sup>N (measure_pmf pq) (indicator (fst -` {None}))
[PROOF STEP]
apply(fastforce simp add: AE_measure_pmf_iff intro!: nn_integral_mono_AE)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Im1_tendsto_upperbound:
   "\<lbrakk>(f \<longlongrightarrow> limit) net; \<forall>\<^sub>F x in net. Im1 (f x) \<le> b; net \<noteq> bot\<rbrakk> \<Longrightarrow> Im1 limit \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> limit) net; \<forall>\<^sub>F x in net. Im1 (f x) \<le> b; net \<noteq> bot\<rbrakk> \<Longrightarrow> Im1 limit \<le> b
[PROOF STEP]
by (blast intro: tendsto_upperbound [OF tendsto_Im1])


[STATEMENT]
theorem unfold :
      assumes                "cp E"
      and                    "(\<tau> \<Turnstile> \<delta> self) \<and> (\<tau> \<Turnstile> \<upsilon> a1) \<and>  (\<tau> \<Turnstile> \<upsilon> a2) \<and>  (\<tau> \<Turnstile> \<upsilon> a3)"
      and                    "\<tau> \<Turnstile> PRE self a1 a2 a3"
      and                    " \<exists>res. (\<tau> \<Turnstile> POST self a1 a2 a3 (\<lambda> _. res))"
      and                    "(\<And>res. \<tau> \<Turnstile> POST self a1 a2 a3 (\<lambda> _. res)  \<Longrightarrow> \<tau> \<Turnstile> E (\<lambda> _. res))"
      shows                  "\<tau> \<Turnstile> E(f self a1 a2 a3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<tau> \<Turnstile> E (f self a1 a2 a3)
[PROOF STEP]
apply(rule unfold'[of _ _ _ "(a1, a2, a3)", simplified])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. cp E
 2. \<tau> \<Turnstile> \<delta> self \<and> \<tau> \<Turnstile> \<upsilon> a1 \<and> \<tau> \<Turnstile> \<upsilon> a2 \<and> \<tau> \<Turnstile> \<upsilon> a3
 3. \<tau> \<Turnstile> PRE self a1 a2 a3
 4. \<exists>res. \<tau> \<Turnstile> POST self a1 a2 a3 (\<lambda>_. res)
 5. \<And>res. \<tau> \<Turnstile> POST self a1 a2 a3 (\<lambda>_. res) \<Longrightarrow> \<tau> \<Turnstile> E (\<lambda>a. res)
[PROOF STEP]
by((rule assms)+)


[STATEMENT]
lemma (in information_space) conditional_entropy_eq:
  assumes Y: "simple_distributed M Y Py"
  assumes XY: "simple_distributed M (\<lambda>x. (X x, Y x)) Pxy"
    shows "\<H>(X | Y) = - (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / Py y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<H>(X | Y) = - (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / Py y))
[PROOF STEP]
proof (subst conditional_entropy_generic_eq[OF _ _
  simple_distributed[OF Y] _ simple_distributed_joint[OF XY]])
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. sigma_finite_measure (count_space (X ` space M))
 2. sigma_finite_measure (count_space (Y ` space M))
 3. \<And>x. x \<in> space (count_space (Y ` space M)) \<Longrightarrow> 0 \<le> Py x
 4. \<And>x y. \<lbrakk>x \<in> space (count_space (X ` space M)); y \<in> space (count_space (Y ` space M))\<rbrakk> \<Longrightarrow> 0 \<le> (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0)
 5. - (LINT (x, y)|(count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)). (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) * log b ((if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) / Py y)) = - (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / Py y))
[PROOF STEP]
have "finite ((\<lambda>x. (X x, Y x))`space M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ((\<lambda>x. (X x, Y x)) ` space M)
[PROOF STEP]
using XY
[PROOF STATE]
proof (prove)
using this:
simple_distributed M (\<lambda>x. (X x, Y x)) Pxy

goal (1 subgoal):
 1. finite ((\<lambda>x. (X x, Y x)) ` space M)
[PROOF STEP]
unfolding simple_distributed_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>x. 0 \<le> Pxy x) \<and> distributed M (count_space ((\<lambda>x. (X x, Y x)) ` space M)) (\<lambda>x. (X x, Y x)) (\<lambda>x. ennreal (Pxy x)) \<and> finite ((\<lambda>x. (X x, Y x)) ` space M)

goal (1 subgoal):
 1. finite ((\<lambda>x. (X x, Y x)) ` space M)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite ((\<lambda>x. (X x, Y x)) ` space M)

goal (5 subgoals):
 1. sigma_finite_measure (count_space (X ` space M))
 2. sigma_finite_measure (count_space (Y ` space M))
 3. \<And>x. x \<in> space (count_space (Y ` space M)) \<Longrightarrow> 0 \<le> Py x
 4. \<And>x y. \<lbrakk>x \<in> space (count_space (X ` space M)); y \<in> space (count_space (Y ` space M))\<rbrakk> \<Longrightarrow> 0 \<le> (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0)
 5. - (LINT (x, y)|(count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)). (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) * log b ((if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) / Py y)) = - (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / Py y))
[PROOF STEP]
from finite_imageI[OF this, of fst]
[PROOF STATE]
proof (chain)
picking this:
finite (fst ` (\<lambda>x. (X x, Y x)) ` space M)
[PROOF STEP]
have [simp]: "finite (X`space M)"
[PROOF STATE]
proof (prove)
using this:
finite (fst ` (\<lambda>x. (X x, Y x)) ` space M)

goal (1 subgoal):
 1. finite (X ` space M)
[PROOF STEP]
by (simp add: image_comp comp_def)
[PROOF STATE]
proof (state)
this:
finite (X ` space M)

goal (5 subgoals):
 1. sigma_finite_measure (count_space (X ` space M))
 2. sigma_finite_measure (count_space (Y ` space M))
 3. \<And>x. x \<in> space (count_space (Y ` space M)) \<Longrightarrow> 0 \<le> Py x
 4. \<And>x y. \<lbrakk>x \<in> space (count_space (X ` space M)); y \<in> space (count_space (Y ` space M))\<rbrakk> \<Longrightarrow> 0 \<le> (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0)
 5. - (LINT (x, y)|(count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)). (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) * log b ((if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) / Py y)) = - (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / Py y))
[PROOF STEP]
note Y[THEN simple_distributed_finite, simp]
[PROOF STATE]
proof (state)
this:
finite (Y ` space M)

goal (5 subgoals):
 1. sigma_finite_measure (count_space (X ` space M))
 2. sigma_finite_measure (count_space (Y ` space M))
 3. \<And>x. x \<in> space (count_space (Y ` space M)) \<Longrightarrow> 0 \<le> Py x
 4. \<And>x y. \<lbrakk>x \<in> space (count_space (X ` space M)); y \<in> space (count_space (Y ` space M))\<rbrakk> \<Longrightarrow> 0 \<le> (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0)
 5. - (LINT (x, y)|(count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)). (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) * log b ((if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) / Py y)) = - (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / Py y))
[PROOF STEP]
show "sigma_finite_measure (count_space (X ` space M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_finite_measure (count_space (X ` space M))
[PROOF STEP]
by (simp add: sigma_finite_measure_count_space_finite)
[PROOF STATE]
proof (state)
this:
sigma_finite_measure (count_space (X ` space M))

goal (4 subgoals):
 1. sigma_finite_measure (count_space (Y ` space M))
 2. \<And>x. x \<in> space (count_space (Y ` space M)) \<Longrightarrow> 0 \<le> Py x
 3. \<And>x y. \<lbrakk>x \<in> space (count_space (X ` space M)); y \<in> space (count_space (Y ` space M))\<rbrakk> \<Longrightarrow> 0 \<le> (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0)
 4. - (LINT (x, y)|(count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)). (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) * log b ((if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) / Py y)) = - (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / Py y))
[PROOF STEP]
show "sigma_finite_measure (count_space (Y ` space M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_finite_measure (count_space (Y ` space M))
[PROOF STEP]
by (simp add: sigma_finite_measure_count_space_finite)
[PROOF STATE]
proof (state)
this:
sigma_finite_measure (count_space (Y ` space M))

goal (3 subgoals):
 1. \<And>x. x \<in> space (count_space (Y ` space M)) \<Longrightarrow> 0 \<le> Py x
 2. \<And>x y. \<lbrakk>x \<in> space (count_space (X ` space M)); y \<in> space (count_space (Y ` space M))\<rbrakk> \<Longrightarrow> 0 \<le> (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0)
 3. - (LINT (x, y)|(count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)). (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) * log b ((if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) / Py y)) = - (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / Py y))
[PROOF STEP]
let ?f = "(\<lambda>x. if x \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy x else 0)"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. x \<in> space (count_space (Y ` space M)) \<Longrightarrow> 0 \<le> Py x
 2. \<And>x y. \<lbrakk>x \<in> space (count_space (X ` space M)); y \<in> space (count_space (Y ` space M))\<rbrakk> \<Longrightarrow> 0 \<le> (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0)
 3. - (LINT (x, y)|(count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)). (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) * log b ((if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) / Py y)) = - (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / Py y))
[PROOF STEP]
have "count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M) = count_space (X`space M \<times> Y`space M)"
    (is "?P = ?C")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M) = count_space (X ` space M \<times> Y ` space M)
[PROOF STEP]
using Y
[PROOF STATE]
proof (prove)
using this:
simple_distributed M Y Py

goal (1 subgoal):
 1. count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M) = count_space (X ` space M \<times> Y ` space M)
[PROOF STEP]
by (simp add: simple_distributed_finite pair_measure_count_space)
[PROOF STATE]
proof (state)
this:
count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M) = count_space (X ` space M \<times> Y ` space M)

goal (3 subgoals):
 1. \<And>x. x \<in> space (count_space (Y ` space M)) \<Longrightarrow> 0 \<le> Py x
 2. \<And>x y. \<lbrakk>x \<in> space (count_space (X ` space M)); y \<in> space (count_space (Y ` space M))\<rbrakk> \<Longrightarrow> 0 \<le> (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0)
 3. - (LINT (x, y)|(count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)). (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) * log b ((if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) / Py y)) = - (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / Py y))
[PROOF STEP]
have eq: "(\<lambda>(x, y). ?f (x, y) * log b (?f (x, y) / Py y)) =
    (\<lambda>x. if x \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy x * log b (Pxy x / Py (snd x)) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) * log b ((if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) / Py y)) = (\<lambda>x. if x \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy x * log b (Pxy x / Py (snd x)) else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>(x, y). (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) * log b ((if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) / Py y)) = (\<lambda>x. if x \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy x * log b (Pxy x / Py (snd x)) else 0)

goal (3 subgoals):
 1. \<And>x. x \<in> space (count_space (Y ` space M)) \<Longrightarrow> 0 \<le> Py x
 2. \<And>x y. \<lbrakk>x \<in> space (count_space (X ` space M)); y \<in> space (count_space (Y ` space M))\<rbrakk> \<Longrightarrow> 0 \<le> (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0)
 3. - (LINT (x, y)|(count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)). (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) * log b ((if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) / Py y)) = - (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / Py y))
[PROOF STEP]
from Y
[PROOF STATE]
proof (chain)
picking this:
simple_distributed M Y Py
[PROOF STEP]
show "- (\<integral> (x, y). ?f (x, y) * log b (?f (x, y) / Py y) \<partial>?P) =
    - (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / Py y))"
[PROOF STATE]
proof (prove)
using this:
simple_distributed M Y Py

goal (1 subgoal):
 1. - (LINT (x, y)|(count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)). (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) * log b ((if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) / Py y)) = - (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / Py y))
[PROOF STEP]
by (auto intro!: sum.cong simp add: \<open>?P = ?C\<close> lebesgue_integral_count_space_finite simple_distributed_finite eq sum.If_cases split_beta')
[PROOF STATE]
proof (state)
this:
- (LINT (x, y)|(count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)). (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) * log b ((if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0) / Py y)) = - (\<Sum>(x, y)\<in>(\<lambda>x. (X x, Y x)) ` space M. Pxy (x, y) * log b (Pxy (x, y) / Py y))

goal (2 subgoals):
 1. \<And>x. x \<in> space (count_space (Y ` space M)) \<Longrightarrow> 0 \<le> Py x
 2. \<And>x y. \<lbrakk>x \<in> space (count_space (X ` space M)); y \<in> space (count_space (Y ` space M))\<rbrakk> \<Longrightarrow> 0 \<le> (if (x, y) \<in> (\<lambda>x. (X x, Y x)) ` space M then Pxy (x, y) else 0)
[PROOF STEP]
qed (insert Y XY, auto)


[STATEMENT]
lemma hermitean_mk_circline' [simp]:
  assumes "is_real A" and "is_real D"
  shows "hermitean (A, B, cnj B, D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hermitean (A, B, cnj B, D)
[PROOF STEP]
using assms eq_cnj_iff_real
[PROOF STATE]
proof (prove)
using this:
is_real A
is_real D
(cnj ?z = ?z) = is_real ?z

goal (1 subgoal):
 1. hermitean (A, B, cnj B, D)
[PROOF STEP]
unfolding hermitean_def mat_adj_def mat_cnj_def
[PROOF STATE]
proof (prove)
using this:
is_real A
is_real D
(cnj ?z = ?z) = is_real ?z

goal (1 subgoal):
 1. mat_map cnj (mat_transpose (A, B, cnj B, D)) = (A, B, cnj B, D)
[PROOF STEP]
by force


[STATEMENT]
lemma top_add:
  fixes x :: "'a::{order_top, ordered_comm_monoid_add}"
  shows "0 \<le> x \<Longrightarrow> top + x = top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> x \<Longrightarrow> top + x = top
[PROOF STEP]
by (intro top_le add_increasing2 order_refl)


[STATEMENT]
lemma sim_A_J: "similar_mat cA J"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. similar_mat (of_real_hom.mat_hom A) J
[PROOF STEP]
using jnf[unfolded jordan_nf_def]
[PROOF STATE]
proof (prove)
using this:
0 \<notin> fst ` set n_as \<and> similar_mat (of_real_hom.mat_hom A) J

goal (1 subgoal):
 1. similar_mat (of_real_hom.mat_hom A) J
[PROOF STEP]
..


[STATEMENT]
lemma tendsto_Lambert_W'_1:
  assumes "(f \<longlongrightarrow> L) F" "eventually (\<lambda>x. f x \<ge> -exp (-1)) F" "L < 0"
  shows   "((\<lambda>x. Lambert_W' (f x)) \<longlongrightarrow> Lambert_W' L) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. Lambert_W' (f x)) \<longlongrightarrow> Lambert_W' L) F
[PROOF STEP]
proof (cases "F = bot")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. F = bot \<Longrightarrow> ((\<lambda>x. Lambert_W' (f x)) \<longlongrightarrow> Lambert_W' L) F
 2. F \<noteq> bot \<Longrightarrow> ((\<lambda>x. Lambert_W' (f x)) \<longlongrightarrow> Lambert_W' L) F
[PROOF STEP]
case [simp]: False
[PROOF STATE]
proof (state)
this:
F \<noteq> bot

goal (2 subgoals):
 1. F = bot \<Longrightarrow> ((\<lambda>x. Lambert_W' (f x)) \<longlongrightarrow> Lambert_W' L) F
 2. F \<noteq> bot \<Longrightarrow> ((\<lambda>x. Lambert_W' (f x)) \<longlongrightarrow> Lambert_W' L) F
[PROOF STEP]
from tendsto_lowerbound[OF assms(1,2)]
[PROOF STATE]
proof (chain)
picking this:
F \<noteq> bot \<Longrightarrow> - exp (- 1) \<le> L
[PROOF STEP]
have L_ge: "L \<ge> -exp (-1)"
[PROOF STATE]
proof (prove)
using this:
F \<noteq> bot \<Longrightarrow> - exp (- 1) \<le> L

goal (1 subgoal):
 1. - exp (- 1) \<le> L
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- exp (- 1) \<le> L

goal (2 subgoals):
 1. F = bot \<Longrightarrow> ((\<lambda>x. Lambert_W' (f x)) \<longlongrightarrow> Lambert_W' L) F
 2. F \<noteq> bot \<Longrightarrow> ((\<lambda>x. Lambert_W' (f x)) \<longlongrightarrow> Lambert_W' L) F
[PROOF STEP]
from order_tendstoD(2)[OF assms(1,3)]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. f x < 0
[PROOF STEP]
have ev: "eventually (\<lambda>x. f x < 0) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. f x < 0

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

goal (2 subgoals):
 1. F = bot \<Longrightarrow> ((\<lambda>x. Lambert_W' (f x)) \<longlongrightarrow> Lambert_W' L) F
 2. F \<noteq> bot \<Longrightarrow> ((\<lambda>x. Lambert_W' (f x)) \<longlongrightarrow> Lambert_W' L) F
[PROOF STEP]
with assms(2)
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. - exp (- 1) \<le> f x
\<forall>\<^sub>F x in F. f x < 0
[PROOF STEP]
have "eventually (\<lambda>x. f x \<in> {-exp (-1)..<0}) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. - exp (- 1) \<le> f x
\<forall>\<^sub>F x in F. f x < 0

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f x \<in> {- exp (- 1)..<0}
[PROOF STEP]
by eventually_elim auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. f x \<in> {- exp (- 1)..<0}

goal (2 subgoals):
 1. F = bot \<Longrightarrow> ((\<lambda>x. Lambert_W' (f x)) \<longlongrightarrow> Lambert_W' L) F
 2. F \<noteq> bot \<Longrightarrow> ((\<lambda>x. Lambert_W' (f x)) \<longlongrightarrow> Lambert_W' L) F
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. f x \<in> {- exp (- 1)..<0}

goal (1 subgoal):
 1. ((\<lambda>x. Lambert_W' (f x)) \<longlongrightarrow> Lambert_W' L) F
[PROOF STEP]
using L_ge assms(3)
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. f x \<in> {- exp (- 1)..<0}
- exp (- 1) \<le> L
L < 0

goal (1 subgoal):
 1. ((\<lambda>x. Lambert_W' (f x)) \<longlongrightarrow> Lambert_W' L) F
[PROOF STEP]
by (intro continuous_on_tendsto_compose[OF continuous_on_Lambert_W' assms(1)]) auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. Lambert_W' (f x)) \<longlongrightarrow> Lambert_W' L) F

goal (1 subgoal):
 1. F = bot \<Longrightarrow> ((\<lambda>x. Lambert_W' (f x)) \<longlongrightarrow> Lambert_W' L) F
[PROOF STEP]
qed auto


[STATEMENT]
lemma (in is_functor) cat_cf_obj_comma_Dom_vrange:
  assumes "b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>"
  shows "\<R>\<^sub>\<circ> (\<FF> \<^sub>C\<^sub>F\<down> b\<lparr>Dom\<rparr>) \<subseteq>\<^sub>\<circ> \<FF> \<^sub>C\<^sub>F\<down> b\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (\<FF> \<^sub>C\<^sub>F\<down> b\<lparr>Dom\<rparr>) \<subseteq>\<^sub>\<circ> \<FF> \<^sub>C\<^sub>F\<down> b\<lparr>Obj\<rparr>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (\<FF> \<^sub>C\<^sub>F\<down> b\<lparr>Dom\<rparr>) \<subseteq>\<^sub>\<circ> \<FF> \<^sub>C\<^sub>F\<down> b\<lparr>Obj\<rparr>
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>
[PROOF STEP]
have const: "cf_const (cat_1 0 0) \<BB> b : cat_1 0 0 \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>"
[PROOF STATE]
proof (prove)
using this:
b \<in>\<^sub>\<circ> \<BB>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. dghm_const (cat_1 []\<^sub>\<circ> []\<^sub>\<circ>) \<BB> b (\<BB>\<lparr>CId\<rparr>\<lparr>b\<rparr>) : cat_1 []\<^sub>\<circ> []\<^sub>\<circ> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
by (cs_concl cs_intro: vempty_is_zet cat_cs_intros)
[PROOF STATE]
proof (state)
this:
dghm_const (cat_1 []\<^sub>\<circ> []\<^sub>\<circ>) \<BB> b (\<BB>\<lparr>CId\<rparr>\<lparr>b\<rparr>) : cat_1 []\<^sub>\<circ> []\<^sub>\<circ> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>

goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (\<FF> \<^sub>C\<^sub>F\<down> b\<lparr>Dom\<rparr>) \<subseteq>\<^sub>\<circ> \<FF> \<^sub>C\<^sub>F\<down> b\<lparr>Obj\<rparr>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (\<FF> \<^sub>C\<^sub>F\<down> b\<lparr>Dom\<rparr>) \<subseteq>\<^sub>\<circ> \<FF> \<^sub>C\<^sub>F\<down> b\<lparr>Obj\<rparr>
[PROOF STEP]
by
      (
        rule cat_comma_Dom_vrange[
          OF is_functor_axioms const, folded cat_cf_obj_comma_def
          ]
      )
[PROOF STATE]
proof (state)
this:
\<R>\<^sub>\<circ> (\<FF> \<^sub>C\<^sub>F\<down> b\<lparr>Dom\<rparr>) \<subseteq>\<^sub>\<circ> \<FF> \<^sub>C\<^sub>F\<down> b\<lparr>Obj\<rparr>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma my_U_is_defined:
  assumes "p \<in> \
"
  shows "my_U p \<in> {0..1}" "p \<approx>[\<R>] mix_pmf (my_U p) some_best some_worst"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. my_U p \<in> {0..1} &&& p \<approx>[\<R>] mix_pmf (my_U p) some_best some_worst
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. my_U p \<in> {0..1}
 2. p \<approx>[\<R>] mix_pmf (my_U p) some_best some_worst
[PROOF STEP]
have "some_best \<in> best"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. some_best \<in> best
[PROOF STEP]
by (simp add: some_best_in_best)
[PROOF STATE]
proof (state)
this:
some_best \<in> best

goal (2 subgoals):
 1. my_U p \<in> {0..1}
 2. p \<approx>[\<R>] mix_pmf (my_U p) some_best some_worst
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
some_best \<in> best

goal (2 subgoals):
 1. my_U p \<in> {0..1}
 2. p \<approx>[\<R>] mix_pmf (my_U p) some_best some_worst
[PROOF STEP]
have "some_worst \<in> worst"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. some_worst \<in> worst
[PROOF STEP]
by (simp add: some_worst_in_worst)
[PROOF STATE]
proof (state)
this:
some_worst \<in> worst

goal (2 subgoals):
 1. my_U p \<in> {0..1}
 2. p \<approx>[\<R>] mix_pmf (my_U p) some_best some_worst
[PROOF STEP]
with exists_element_bw_mix_is_approx[of p "some_best" "some_worst"] calculation assms
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>p \<in> local.\
; some_best \<in> best; some_worst \<in> worst\<rbrakk> \<Longrightarrow> \<exists>\<alpha>\<in>{0..1}. p \<approx>[\<R>] mix_pmf \<alpha> some_best some_worst
some_best \<in> best
p \<in> local.\

some_worst \<in> worst
[PROOF STEP]
have e: "\<exists>\<alpha>\<in>{0..1}. p \<approx>[\<R>] mix_pmf \<alpha> some_best some_worst"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>p \<in> local.\
; some_best \<in> best; some_worst \<in> worst\<rbrakk> \<Longrightarrow> \<exists>\<alpha>\<in>{0..1}. p \<approx>[\<R>] mix_pmf \<alpha> some_best some_worst
some_best \<in> best
p \<in> local.\

some_worst \<in> worst

goal (1 subgoal):
 1. \<exists>\<alpha>\<in>{0..1}. p \<approx>[\<R>] mix_pmf \<alpha> some_best some_worst
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>\<alpha>\<in>{0..1}. p \<approx>[\<R>] mix_pmf \<alpha> some_best some_worst

goal (2 subgoals):
 1. my_U p \<in> {0..1}
 2. p \<approx>[\<R>] mix_pmf (my_U p) some_best some_worst
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>\<alpha>\<in>{0..1}. p \<approx>[\<R>] mix_pmf \<alpha> some_best some_worst
[PROOF STEP]
show "my_U p \<in> {0..1}"
[PROOF STATE]
proof (prove)
using this:
\<exists>\<alpha>\<in>{0..1}. p \<approx>[\<R>] mix_pmf \<alpha> some_best some_worst

goal (1 subgoal):
 1. my_U p \<in> {0..1}
[PROOF STEP]
by (metis (mono_tags, lifting) my_U_def someI_ex)
[PROOF STATE]
proof (state)
this:
my_U p \<in> {0..1}

goal (1 subgoal):
 1. p \<approx>[\<R>] mix_pmf (my_U p) some_best some_worst
[PROOF STEP]
show "p \<approx>[\<R>] mix_pmf (my_U p) some_best some_worst"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<approx>[\<R>] mix_pmf (my_U p) some_best some_worst
[PROOF STEP]
by (metis (mono_tags, lifting) e my_U_def someI_ex)
[PROOF STATE]
proof (state)
this:
p \<approx>[\<R>] mix_pmf (my_U p) some_best some_worst

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_ord_all_conv: "
  (list_ord ord xs) = (\<forall>n < length xs - 1. ord (xs ! n) (xs ! Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_ord ord xs = (\<forall>n<length xs - 1. ord (xs ! n) (xs ! Suc n))
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. list_ord ord xs \<Longrightarrow> \<forall>n<length xs - 1. ord (xs ! n) (xs ! Suc n)
 2. \<forall>n<length xs - 1. ord (xs ! n) (xs ! Suc n) \<Longrightarrow> list_ord ord xs
[PROOF STEP]
apply (induct xs, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs. \<lbrakk>list_ord ord xs \<Longrightarrow> \<forall>n<length xs - 1. ord (xs ! n) (xs ! Suc n); list_ord ord (a # xs)\<rbrakk> \<Longrightarrow> \<forall>n<length (a # xs) - 1. ord ((a # xs) ! n) ((a # xs) ! Suc n)
 2. \<forall>n<length xs - 1. ord (xs ! n) (xs ! Suc n) \<Longrightarrow> list_ord ord xs
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs n. \<lbrakk>list_ord ord xs \<Longrightarrow> \<forall>n<length xs - Suc 0. ord (xs ! n) (xs ! Suc n); list_ord ord (a # xs); n < length xs\<rbrakk> \<Longrightarrow> ord ((a # xs) ! n) (xs ! n)
 2. \<forall>n<length xs - 1. ord (xs ! n) (xs ! Suc n) \<Longrightarrow> list_ord ord xs
[PROOF STEP]
apply (simp add: list_ord_Cons)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs n. \<lbrakk>list_ord ord xs \<Longrightarrow> \<forall>n<length xs - Suc 0. ord (xs ! n) (xs ! Suc n); xs = [] \<or> ord a (hd xs) \<and> list_ord ord xs; n < length xs\<rbrakk> \<Longrightarrow> ord ((a # xs) ! n) (xs ! n)
 2. \<forall>n<length xs - 1. ord (xs ! n) (xs ! Suc n) \<Longrightarrow> list_ord ord xs
[PROOF STEP]
apply (erule disjE, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs n. \<lbrakk>list_ord ord xs \<Longrightarrow> \<forall>n<length xs - Suc 0. ord (xs ! n) (xs ! Suc n); n < length xs; ord a (hd xs) \<and> list_ord ord xs\<rbrakk> \<Longrightarrow> ord ((a # xs) ! n) (xs ! n)
 2. \<forall>n<length xs - 1. ord (xs ! n) (xs ! Suc n) \<Longrightarrow> list_ord ord xs
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs n. \<lbrakk>\<forall>n<length xs - Suc 0. ord (xs ! n) (xs ! Suc n); n < length xs; ord a (hd xs); list_ord ord xs\<rbrakk> \<Longrightarrow> ord ((a # xs) ! n) (xs ! n)
 2. \<forall>n<length xs - 1. ord (xs ! n) (xs ! Suc n) \<Longrightarrow> list_ord ord xs
[PROOF STEP]
apply (case_tac n)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>a xs n. \<lbrakk>\<forall>n<length xs - Suc 0. ord (xs ! n) (xs ! Suc n); n < length xs; ord a (hd xs); list_ord ord xs; n = 0\<rbrakk> \<Longrightarrow> ord ((a # xs) ! n) (xs ! n)
 2. \<And>a xs n nat. \<lbrakk>\<forall>n<length xs - Suc 0. ord (xs ! n) (xs ! Suc n); n < length xs; ord a (hd xs); list_ord ord xs; n = Suc nat\<rbrakk> \<Longrightarrow> ord ((a # xs) ! n) (xs ! n)
 3. \<forall>n<length xs - 1. ord (xs ! n) (xs ! Suc n) \<Longrightarrow> list_ord ord xs
[PROOF STEP]
apply (simp add: hd_conv_nth)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs n nat. \<lbrakk>\<forall>n<length xs - Suc 0. ord (xs ! n) (xs ! Suc n); n < length xs; ord a (hd xs); list_ord ord xs; n = Suc nat\<rbrakk> \<Longrightarrow> ord ((a # xs) ! n) (xs ! n)
 2. \<forall>n<length xs - 1. ord (xs ! n) (xs ! Suc n) \<Longrightarrow> list_ord ord xs
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n<length xs - 1. ord (xs ! n) (xs ! Suc n) \<Longrightarrow> list_ord ord xs
[PROOF STEP]
apply (induct xs, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<forall>n<length xs - 1. ord (xs ! n) (xs ! Suc n) \<Longrightarrow> list_ord ord xs; \<forall>n<length (a # xs) - 1. ord ((a # xs) ! n) ((a # xs) ! Suc n)\<rbrakk> \<Longrightarrow> list_ord ord (a # xs)
[PROOF STEP]
apply (simp add: list_ord_Cons)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<forall>n<length xs - Suc 0. ord (xs ! n) (xs ! Suc n) \<Longrightarrow> list_ord ord xs; \<forall>n<length xs. ord ((a # xs) ! n) (xs ! n)\<rbrakk> \<Longrightarrow> xs = [] \<or> ord a (hd xs) \<and> list_ord ord xs
[PROOF STEP]
apply (case_tac "xs = []", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<forall>n<length xs - Suc 0. ord (xs ! n) (xs ! Suc n) \<Longrightarrow> list_ord ord xs; \<forall>n<length xs. ord ((a # xs) ! n) (xs ! n); xs \<noteq> []\<rbrakk> \<Longrightarrow> xs = [] \<or> ord a (hd xs) \<and> list_ord ord xs
[PROOF STEP]
apply (drule meta_mp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs. \<lbrakk>\<forall>n<length xs. ord ((a # xs) ! n) (xs ! n); xs \<noteq> []\<rbrakk> \<Longrightarrow> \<forall>n<length xs - Suc 0. ord (xs ! n) (xs ! Suc n)
 2. \<And>a xs. \<lbrakk>\<forall>n<length xs. ord ((a # xs) ! n) (xs ! n); xs \<noteq> []; list_ord ord xs\<rbrakk> \<Longrightarrow> xs = [] \<or> ord a (hd xs) \<and> list_ord ord xs
[PROOF STEP]
apply (intro allI impI, rename_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xs n. \<lbrakk>\<forall>n<length xs. ord ((a # xs) ! n) (xs ! n); xs \<noteq> []; n < length xs - Suc 0\<rbrakk> \<Longrightarrow> ord (xs ! n) (xs ! Suc n)
 2. \<And>a xs. \<lbrakk>\<forall>n<length xs. ord ((a # xs) ! n) (xs ! n); xs \<noteq> []; list_ord ord xs\<rbrakk> \<Longrightarrow> xs = [] \<or> ord a (hd xs) \<and> list_ord ord xs
[PROOF STEP]
apply (drule_tac x="Suc n" in spec, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<forall>n<length xs. ord ((a # xs) ! n) (xs ! n); xs \<noteq> []; list_ord ord xs\<rbrakk> \<Longrightarrow> xs = [] \<or> ord a (hd xs) \<and> list_ord ord xs
[PROOF STEP]
apply (drule_tac x=0 in spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>xs \<noteq> []; list_ord ord xs; 0 < length xs \<longrightarrow> ord ((a # xs) ! 0) (xs ! 0)\<rbrakk> \<Longrightarrow> xs = [] \<or> ord a (hd xs) \<and> list_ord ord xs
[PROOF STEP]
apply (simp add: hd_conv_nth)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in Ring) nonunit_contained_maxid:"\<lbrakk>\<not>(zeroring R); a \<in> carrier R;
                \<not> Unit R a \<rbrakk>  \<Longrightarrow>  \<exists>mx. maximal_ideal R mx \<and> a \<in>  mx"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> zeroring R; a \<in> carrier R; \<not> Unit R a\<rbrakk> \<Longrightarrow> \<exists>mx. maximal_ideal R mx \<and> a \<in> mx
[PROOF STEP]
apply (frule principal_ideal[of "a"],
       frule ideal_contained_maxid[of "R \<diamondsuit>\<^sub>p a"], assumption)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<not> zeroring R; a \<in> carrier R; \<not> Unit R a; ideal R (R \<diamondsuit>\<^sub>p a)\<rbrakk> \<Longrightarrow> 1\<^sub>r \<notin> R \<diamondsuit>\<^sub>p a
 2. \<lbrakk>\<not> zeroring R; a \<in> carrier R; \<not> Unit R a; ideal R (R \<diamondsuit>\<^sub>p a); \<exists>mx. maximal_ideal R mx \<and> R \<diamondsuit>\<^sub>p a \<subseteq> mx\<rbrakk> \<Longrightarrow> \<exists>mx. maximal_ideal R mx \<and> a \<in> mx
[PROOF STEP]
apply (rule contrapos_pp, simp+,
        frule ideal_inc_one[of "R \<diamondsuit>\<^sub>p a"], assumption,
        simp add:nonunit_principal_id)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> zeroring R; a \<in> carrier R; \<not> Unit R a; ideal R (R \<diamondsuit>\<^sub>p a); \<exists>mx. maximal_ideal R mx \<and> R \<diamondsuit>\<^sub>p a \<subseteq> mx\<rbrakk> \<Longrightarrow> \<exists>mx. maximal_ideal R mx \<and> a \<in> mx
[PROOF STEP]
apply (erule exE, erule conjE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>mx. \<lbrakk>\<not> zeroring R; a \<in> carrier R; \<not> Unit R a; ideal R (R \<diamondsuit>\<^sub>p a); maximal_ideal R mx; R \<diamondsuit>\<^sub>p a \<subseteq> mx\<rbrakk> \<Longrightarrow> \<exists>mx. maximal_ideal R mx \<and> a \<in> mx
[PROOF STEP]
apply (frule a_in_principal[of "a"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>mx. \<lbrakk>\<not> zeroring R; a \<in> carrier R; \<not> Unit R a; ideal R (R \<diamondsuit>\<^sub>p a); maximal_ideal R mx; R \<diamondsuit>\<^sub>p a \<subseteq> mx; a \<in> R \<diamondsuit>\<^sub>p a\<rbrakk> \<Longrightarrow> \<exists>mx. maximal_ideal R mx \<and> a \<in> mx
[PROOF STEP]
apply (frule_tac B = mx in subsetD[of "R \<diamondsuit>\<^sub>p a" _ "a"], assumption, blast)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Lim_transform_within_set_eq:
  fixes a :: "'a::metric_space" and l :: "'b::metric_space"
  shows "eventually (\<lambda>x. x \<in> S \<longleftrightarrow> x \<in> T) (at a)
         \<Longrightarrow> ((f \<longlongrightarrow> l) (at a within S) \<longleftrightarrow> (f \<longlongrightarrow> l) (at a within T))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at a. (x \<in> S) = (x \<in> T) \<Longrightarrow> (f \<longlongrightarrow> l) (at a within S) = (f \<longlongrightarrow> l) (at a within T)
[PROOF STEP]
by (force intro: Lim_transform_within_set elim: eventually_mono)


[STATEMENT]
lemma last_vec_two_block_non_inter_is_last_vec:
  assumes "dim_col A + dim_col B = dim_vec v"
  assumes "dim_row B = n"
  shows "vec_last ((two_block_non_interfering A B) *\<^sub>v v) n = B *\<^sub>v (vec_last v (dim_col B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_last (two_block_non_interfering A B *\<^sub>v v) n = B *\<^sub>v vec_last v (dim_col B)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i < dim_vec (B *\<^sub>v vec_last v (dim_col B)) \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
 2. dim_vec (vec_last (two_block_non_interfering A B *\<^sub>v v) n) = dim_vec (B *\<^sub>v vec_last v (dim_col B))
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i < dim_vec (B *\<^sub>v vec_last v (dim_col B)) \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
 2. dim_vec (vec_last (two_block_non_interfering A B *\<^sub>v v) n) = dim_vec (B *\<^sub>v vec_last v (dim_col B))
[PROOF STEP]
assume a: "i < dim_vec (B *\<^sub>v vec_last v (dim_col B))"
[PROOF STATE]
proof (state)
this:
i < dim_vec (B *\<^sub>v vec_last v (dim_col B))

goal (2 subgoals):
 1. \<And>i. i < dim_vec (B *\<^sub>v vec_last v (dim_col B)) \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
 2. dim_vec (vec_last (two_block_non_interfering A B *\<^sub>v v) n) = dim_vec (B *\<^sub>v vec_last v (dim_col B))
[PROOF STEP]
let ?tb = "two_block_non_interfering A B"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i < dim_vec (B *\<^sub>v vec_last v (dim_col B)) \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
 2. dim_vec (vec_last (two_block_non_interfering A B *\<^sub>v v) n) = dim_vec (B *\<^sub>v vec_last v (dim_col B))
[PROOF STEP]
let ?vl = "(vec (dim_row ?tb) (\<lambda> i. row ?tb i \<bullet> v))"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i < dim_vec (B *\<^sub>v vec_last v (dim_col B)) \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
 2. dim_vec (vec_last (two_block_non_interfering A B *\<^sub>v v) n) = dim_vec (B *\<^sub>v vec_last v (dim_col B))
[PROOF STEP]
have i_n: "i < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < n
[PROOF STEP]
using  assms(2)
[PROOF STATE]
proof (prove)
using this:
dim_row B = n

goal (1 subgoal):
 1. i < n
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
dim_row B = n
i < dim_vec (B *\<^sub>v vec_last v (dim_col B))

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

goal (2 subgoals):
 1. \<And>i. i < dim_vec (B *\<^sub>v vec_last v (dim_col B)) \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
 2. dim_vec (vec_last (two_block_non_interfering A B *\<^sub>v v) n) = dim_vec (B *\<^sub>v vec_last v (dim_col B))
[PROOF STEP]
have in3: "(dim_row ?tb) - n + i \<ge> dim_row A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row A \<le> dim_row (two_block_non_interfering A B) - n + i
[PROOF STEP]
by (simp add: assms(2))
[PROOF STATE]
proof (state)
this:
dim_row A \<le> dim_row (two_block_non_interfering A B) - n + i

goal (2 subgoals):
 1. \<And>i. i < dim_vec (B *\<^sub>v vec_last v (dim_col B)) \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
 2. dim_vec (vec_last (two_block_non_interfering A B *\<^sub>v v) n) = dim_vec (B *\<^sub>v vec_last v (dim_col B))
[PROOF STEP]
have in3': "(dim_row ?tb) - n + i < dim_row ?tb"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (two_block_non_interfering A B) - n + i < dim_row (two_block_non_interfering A B)
[PROOF STEP]
by (simp add: assms(2) i_n two_block_non_interfering_dims(1))
[PROOF STATE]
proof (state)
this:
dim_row (two_block_non_interfering A B) - n + i < dim_row (two_block_non_interfering A B)

goal (2 subgoals):
 1. \<And>i. i < dim_vec (B *\<^sub>v vec_last v (dim_col B)) \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
 2. dim_vec (vec_last (two_block_non_interfering A B *\<^sub>v v) n) = dim_vec (B *\<^sub>v vec_last v (dim_col B))
[PROOF STEP]
have "dim_row A + n = dim_row (two_block_non_interfering A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row A + n = dim_row (two_block_non_interfering A B)
[PROOF STEP]
by (simp add: assms(2) two_block_non_interfering_dims(1))
[PROOF STATE]
proof (state)
this:
dim_row A + n = dim_row (two_block_non_interfering A B)

goal (2 subgoals):
 1. \<And>i. i < dim_vec (B *\<^sub>v vec_last v (dim_col B)) \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
 2. dim_vec (vec_last (two_block_non_interfering A B *\<^sub>v v) n) = dim_vec (B *\<^sub>v vec_last v (dim_col B))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dim_row A + n = dim_row (two_block_non_interfering A B)
[PROOF STEP]
have dim_a: "dim_row A = dim_row (two_block_non_interfering A B) - n"
[PROOF STATE]
proof (prove)
using this:
dim_row A + n = dim_row (two_block_non_interfering A B)

goal (1 subgoal):
 1. dim_row A = dim_row (two_block_non_interfering A B) - n
[PROOF STEP]
by (metis (no_types) diff_add_inverse2)
[PROOF STATE]
proof (state)
this:
dim_row A = dim_row (two_block_non_interfering A B) - n

goal (2 subgoals):
 1. \<And>i. i < dim_vec (B *\<^sub>v vec_last v (dim_col B)) \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
 2. dim_vec (vec_last (two_block_non_interfering A B *\<^sub>v v) n) = dim_vec (B *\<^sub>v vec_last v (dim_col B))
[PROOF STEP]
have "vec_last (?tb *\<^sub>v v) n $ i = vec_last (vec (dim_row ?tb) (\<lambda> i. row ?tb i \<bullet> v)) n $ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = vec_last (vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v)) n $ i
[PROOF STEP]
unfolding mult_mat_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_last (vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v)) n $ i = vec_last (vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v)) n $ i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = vec_last (vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v)) n $ i

goal (2 subgoals):
 1. \<And>i. i < dim_vec (B *\<^sub>v vec_last v (dim_col B)) \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
 2. dim_vec (vec_last (two_block_non_interfering A B *\<^sub>v v) n) = dim_vec (B *\<^sub>v vec_last v (dim_col B))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = vec_last (vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v)) n $ i

goal (2 subgoals):
 1. \<And>i. i < dim_vec (B *\<^sub>v vec_last v (dim_col B)) \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
 2. dim_vec (vec_last (two_block_non_interfering A B *\<^sub>v v) n) = dim_vec (B *\<^sub>v vec_last v (dim_col B))
[PROOF STEP]
have "... = ?vl $ (dim_vec ?vl - n + i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_last (vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v)) n $ i = vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v) $ (dim_vec (vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v)) - n + i)
[PROOF STEP]
unfolding vec_last_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec n (\<lambda>i. vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v) $ (dim_vec (vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v)) - n + i)) $ i = vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v) $ (dim_vec (vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v)) - n + i)
[PROOF STEP]
using i_n index_vec
[PROOF STATE]
proof (prove)
using this:
i < n
?i < ?n \<Longrightarrow> vec ?n ?f $ ?i = ?f ?i

goal (1 subgoal):
 1. vec n (\<lambda>i. vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v) $ (dim_vec (vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v)) - n + i)) $ i = vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v) $ (dim_vec (vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v)) - n + i)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
vec_last (vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v)) n $ i = vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v) $ (dim_vec (vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v)) - n + i)

goal (2 subgoals):
 1. \<And>i. i < dim_vec (B *\<^sub>v vec_last v (dim_col B)) \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
 2. dim_vec (vec_last (two_block_non_interfering A B *\<^sub>v v) n) = dim_vec (B *\<^sub>v vec_last v (dim_col B))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vec_last (vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v)) n $ i = vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v) $ (dim_vec (vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v)) - n + i)

goal (2 subgoals):
 1. \<And>i. i < dim_vec (B *\<^sub>v vec_last v (dim_col B)) \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
 2. dim_vec (vec_last (two_block_non_interfering A B *\<^sub>v v) n) = dim_vec (B *\<^sub>v vec_last v (dim_col B))
[PROOF STEP]
have "... = row ?tb ((dim_row ?tb) - n + i) \<bullet> v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v) $ (dim_vec (vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v)) - n + i) = row (two_block_non_interfering A B) (dim_row (two_block_non_interfering A B) - n + i) \<bullet> v
[PROOF STEP]
unfolding index_vec
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v) $ (dim_vec (vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v)) - n + i) = row (two_block_non_interfering A B) (dim_row (two_block_non_interfering A B) - n + i) \<bullet> v
[PROOF STEP]
by (simp add: assms(2) i_n two_block_non_interfering_dims(1))
[PROOF STATE]
proof (state)
this:
vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v) $ (dim_vec (vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v)) - n + i) = row (two_block_non_interfering A B) (dim_row (two_block_non_interfering A B) - n + i) \<bullet> v

goal (2 subgoals):
 1. \<And>i. i < dim_vec (B *\<^sub>v vec_last v (dim_col B)) \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
 2. dim_vec (vec_last (two_block_non_interfering A B *\<^sub>v v) n) = dim_vec (B *\<^sub>v vec_last v (dim_col B))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v) $ (dim_vec (vec (dim_row (two_block_non_interfering A B)) (\<lambda>i. row (two_block_non_interfering A B) i \<bullet> v)) - n + i) = row (two_block_non_interfering A B) (dim_row (two_block_non_interfering A B) - n + i) \<bullet> v

goal (2 subgoals):
 1. \<And>i. i < dim_vec (B *\<^sub>v vec_last v (dim_col B)) \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
 2. dim_vec (vec_last (two_block_non_interfering A B *\<^sub>v v) n) = dim_vec (B *\<^sub>v vec_last v (dim_col B))
[PROOF STEP]
have "... = row B i \<bullet> vec_last v (dim_vec (row B i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (two_block_non_interfering A B) (dim_row (two_block_non_interfering A B) - n + i) \<bullet> v = row B i \<bullet> vec_last v (dim_vec (row B i))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. row (two_block_non_interfering A B) (dim_row (two_block_non_interfering A B) - n + i) \<bullet> v = row B i \<bullet> vec_last v (dim_vec (row B i))
[PROOF STEP]
have "dim_vec (0\<^sub>v (dim_col A) @\<^sub>v row B i) = dim_vec v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (0\<^sub>v (dim_col A) @\<^sub>v row B i) = dim_vec v
[PROOF STEP]
by (simp add: \<open>dim_col A + dim_col B = dim_vec v\<close>)
[PROOF STATE]
proof (state)
this:
dim_vec (0\<^sub>v (dim_col A) @\<^sub>v row B i) = dim_vec v

goal (1 subgoal):
 1. row (two_block_non_interfering A B) (dim_row (two_block_non_interfering A B) - n + i) \<bullet> v = row B i \<bullet> vec_last v (dim_vec (row B i))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dim_vec (0\<^sub>v (dim_col A) @\<^sub>v row B i) = dim_vec v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dim_vec (0\<^sub>v (dim_col A) @\<^sub>v row B i) = dim_vec v

goal (1 subgoal):
 1. row (two_block_non_interfering A B) (dim_row (two_block_non_interfering A B) - n + i) \<bullet> v = row B i \<bullet> vec_last v (dim_vec (row B i))
[PROOF STEP]
using dim_a assms(1) in3' two_block_non_interfering_row_comp2
        append_split_vec_distrib_scalar_prod[of "0\<^sub>v (dim_col A)" "row B i" v]
[PROOF STATE]
proof (prove)
using this:
dim_vec (0\<^sub>v (dim_col A) @\<^sub>v row B i) = dim_vec v
dim_row A = dim_row (two_block_non_interfering A B) - n
dim_col A + dim_col B = dim_vec v
dim_row (two_block_non_interfering A B) - n + i < dim_row (two_block_non_interfering A B)
\<lbrakk>?i < dim_row (two_block_non_interfering ?A ?B); dim_row ?A \<le> ?i\<rbrakk> \<Longrightarrow> row (two_block_non_interfering ?A ?B) ?i = 0\<^sub>v (dim_col ?A) @\<^sub>v row ?B (?i - dim_row ?A)
dim_vec (0\<^sub>v (dim_col A) @\<^sub>v row B i) = dim_vec v \<Longrightarrow> (0\<^sub>v (dim_col A) @\<^sub>v row B i) \<bullet> v = 0\<^sub>v (dim_col A) \<bullet> vec_first v (dim_vec (0\<^sub>v (dim_col A))) + row B i \<bullet> vec_last v (dim_vec (row B i))

goal (1 subgoal):
 1. row (two_block_non_interfering A B) (dim_row (two_block_non_interfering A B) - n + i) \<bullet> v = row B i \<bullet> vec_last v (dim_vec (row B i))
[PROOF STEP]
by (metis add.commute add.right_neutral diff_add_inverse
          in3 index_zero_vec(2) scalar_prod_left_zero  vec_first_carrier)
[PROOF STATE]
proof (state)
this:
row (two_block_non_interfering A B) (dim_row (two_block_non_interfering A B) - n + i) \<bullet> v = row B i \<bullet> vec_last v (dim_vec (row B i))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
row (two_block_non_interfering A B) (dim_row (two_block_non_interfering A B) - n + i) \<bullet> v = row B i \<bullet> vec_last v (dim_vec (row B i))

goal (2 subgoals):
 1. \<And>i. i < dim_vec (B *\<^sub>v vec_last v (dim_col B)) \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
 2. dim_vec (vec_last (two_block_non_interfering A B *\<^sub>v v) n) = dim_vec (B *\<^sub>v vec_last v (dim_col B))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
row (two_block_non_interfering A B) (dim_row (two_block_non_interfering A B) - n + i) \<bullet> v = row B i \<bullet> vec_last v (dim_vec (row B i))

goal (2 subgoals):
 1. \<And>i. i < dim_vec (B *\<^sub>v vec_last v (dim_col B)) \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
 2. dim_vec (vec_last (two_block_non_interfering A B *\<^sub>v v) n) = dim_vec (B *\<^sub>v vec_last v (dim_col B))
[PROOF STEP]
have "... = row B i \<bullet> vec_last v (dim_col B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row B i \<bullet> vec_last v (dim_vec (row B i)) = row B i \<bullet> vec_last v (dim_col B)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
row B i \<bullet> vec_last v (dim_vec (row B i)) = row B i \<bullet> vec_last v (dim_col B)

goal (2 subgoals):
 1. \<And>i. i < dim_vec (B *\<^sub>v vec_last v (dim_col B)) \<Longrightarrow> vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
 2. dim_vec (vec_last (two_block_non_interfering A B *\<^sub>v v) n) = dim_vec (B *\<^sub>v vec_last v (dim_col B))
[PROOF STEP]
thus "vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i"
[PROOF STATE]
proof (prove)
using this:
row B i \<bullet> vec_last v (dim_vec (row B i)) = row B i \<bullet> vec_last v (dim_col B)

goal (1 subgoal):
 1. vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
[PROOF STEP]
using assms(2) calculation i_n
[PROOF STATE]
proof (prove)
using this:
row B i \<bullet> vec_last v (dim_vec (row B i)) = row B i \<bullet> vec_last v (dim_col B)
dim_row B = n
vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = row B i \<bullet> vec_last v (dim_vec (row B i))
i < n

goal (1 subgoal):
 1. vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vec_last (two_block_non_interfering A B *\<^sub>v v) n $ i = (B *\<^sub>v vec_last v (dim_col B)) $ i

goal (1 subgoal):
 1. dim_vec (vec_last (two_block_non_interfering A B *\<^sub>v v) n) = dim_vec (B *\<^sub>v vec_last v (dim_col B))
[PROOF STEP]
qed (simp add: assms(2))


[STATEMENT]
lemma filterlim_inverse_at_iff:
  fixes g :: "'a \<Rightarrow> 'b::{real_normed_div_algebra, division_ring}"
  shows "(LIM x F. inverse (g x) :> at 0) \<longleftrightarrow> (LIM x F. g x :> at_infinity)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LIM x F. inverse (g x) :> at (0::'b)) = filterlim g at_infinity F
[PROOF STEP]
unfolding filterlim_def filtermap_filtermap[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (filtermap inverse (filtermap g F) \<le> at (0::'b)) = (filtermap g F \<le> at_infinity)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. filtermap inverse (filtermap g F) \<le> at (0::'b) \<Longrightarrow> filtermap g F \<le> at_infinity
 2. filtermap g F \<le> at_infinity \<Longrightarrow> filtermap inverse (filtermap g F) \<le> at (0::'b)
[PROOF STEP]
assume "filtermap g F \<le> at_infinity"
[PROOF STATE]
proof (state)
this:
filtermap g F \<le> at_infinity

goal (2 subgoals):
 1. filtermap inverse (filtermap g F) \<le> at (0::'b) \<Longrightarrow> filtermap g F \<le> at_infinity
 2. filtermap g F \<le> at_infinity \<Longrightarrow> filtermap inverse (filtermap g F) \<le> at (0::'b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
filtermap g F \<le> at_infinity
[PROOF STEP]
have "filtermap inverse (filtermap g F) \<le> filtermap inverse at_infinity"
[PROOF STATE]
proof (prove)
using this:
filtermap g F \<le> at_infinity

goal (1 subgoal):
 1. filtermap inverse (filtermap g F) \<le> filtermap inverse at_infinity
[PROOF STEP]
by (rule filtermap_mono)
[PROOF STATE]
proof (state)
this:
filtermap inverse (filtermap g F) \<le> filtermap inverse at_infinity

goal (2 subgoals):
 1. filtermap inverse (filtermap g F) \<le> at (0::'b) \<Longrightarrow> filtermap g F \<le> at_infinity
 2. filtermap g F \<le> at_infinity \<Longrightarrow> filtermap inverse (filtermap g F) \<le> at (0::'b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
filtermap inverse (filtermap g F) \<le> filtermap inverse at_infinity

goal (2 subgoals):
 1. filtermap inverse (filtermap g F) \<le> at (0::'b) \<Longrightarrow> filtermap g F \<le> at_infinity
 2. filtermap g F \<le> at_infinity \<Longrightarrow> filtermap inverse (filtermap g F) \<le> at (0::'b)
[PROOF STEP]
have "\<dots> \<le> at 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtermap inverse at_infinity \<le> at (0::'b)
[PROOF STEP]
using tendsto_inverse_0[where 'a='b]
[PROOF STATE]
proof (prove)
using this:
(inverse \<longlongrightarrow> (0::'b)) at_infinity

goal (1 subgoal):
 1. filtermap inverse at_infinity \<le> at (0::'b)
[PROOF STEP]
by (auto intro!: exI[of _ 1]
        simp: le_principal eventually_filtermap filterlim_def at_within_def eventually_at_infinity)
[PROOF STATE]
proof (state)
this:
filtermap inverse at_infinity \<le> at (0::'b)

goal (2 subgoals):
 1. filtermap inverse (filtermap g F) \<le> at (0::'b) \<Longrightarrow> filtermap g F \<le> at_infinity
 2. filtermap g F \<le> at_infinity \<Longrightarrow> filtermap inverse (filtermap g F) \<le> at (0::'b)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
filtermap inverse (filtermap g F) \<le> at (0::'b)
[PROOF STEP]
show "filtermap inverse (filtermap g F) \<le> at 0"
[PROOF STATE]
proof (prove)
using this:
filtermap inverse (filtermap g F) \<le> at (0::'b)

goal (1 subgoal):
 1. filtermap inverse (filtermap g F) \<le> at (0::'b)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
filtermap inverse (filtermap g F) \<le> at (0::'b)

goal (1 subgoal):
 1. filtermap inverse (filtermap g F) \<le> at (0::'b) \<Longrightarrow> filtermap g F \<le> at_infinity
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. filtermap inverse (filtermap g F) \<le> at (0::'b) \<Longrightarrow> filtermap g F \<le> at_infinity
[PROOF STEP]
assume "filtermap inverse (filtermap g F) \<le> at 0"
[PROOF STATE]
proof (state)
this:
filtermap inverse (filtermap g F) \<le> at (0::'b)

goal (1 subgoal):
 1. filtermap inverse (filtermap g F) \<le> at (0::'b) \<Longrightarrow> filtermap g F \<le> at_infinity
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
filtermap inverse (filtermap g F) \<le> at (0::'b)
[PROOF STEP]
have "filtermap inverse (filtermap inverse (filtermap g F)) \<le> filtermap inverse (at 0)"
[PROOF STATE]
proof (prove)
using this:
filtermap inverse (filtermap g F) \<le> at (0::'b)

goal (1 subgoal):
 1. filtermap inverse (filtermap inverse (filtermap g F)) \<le> filtermap inverse (at (0::'b))
[PROOF STEP]
by (rule filtermap_mono)
[PROOF STATE]
proof (state)
this:
filtermap inverse (filtermap inverse (filtermap g F)) \<le> filtermap inverse (at (0::'b))

goal (1 subgoal):
 1. filtermap inverse (filtermap g F) \<le> at (0::'b) \<Longrightarrow> filtermap g F \<le> at_infinity
[PROOF STEP]
with filterlim_inverse_at_infinity
[PROOF STATE]
proof (chain)
picking this:
filterlim inverse at_infinity (at (0::?'a))
filtermap inverse (filtermap inverse (filtermap g F)) \<le> filtermap inverse (at (0::'b))
[PROOF STEP]
show "filtermap g F \<le> at_infinity"
[PROOF STATE]
proof (prove)
using this:
filterlim inverse at_infinity (at (0::?'a))
filtermap inverse (filtermap inverse (filtermap g F)) \<le> filtermap inverse (at (0::'b))

goal (1 subgoal):
 1. filtermap g F \<le> at_infinity
[PROOF STEP]
by (auto intro: order_trans simp: filterlim_def filtermap_filtermap)
[PROOF STATE]
proof (state)
this:
filtermap g F \<le> at_infinity

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Rep_perm_0: "Rep_perm 0 = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_perm 0 = id
[PROOF STEP]
unfolding zero_perm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_perm (Abs_perm id) = id
[PROOF STEP]
by (simp add: Abs_perm_inverse perm_id)


[STATEMENT]
lemma restriction_card_mon_trans:
  "(v=v1--v2) \<and> (v2=v3--v4) \<and> |restrict v3 f c| = 1 \<longrightarrow> |restrict v f c|\<ge>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v=v1--v2 \<and> v2=v3--v4 \<and> |restrict v3 f c| = 1 \<longrightarrow> 1 \<le> |restrict v f c|
[PROOF STEP]
by (metis One_nat_def Suc_leI neq0_conv not_less_eq_eq
      restriction_card_mon1 restriction_card_mon2)


[STATEMENT]
lemma Length_SNOCs: "Length ((SNOC x ^^ i) \<AA>) = Length \<AA> + i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Length ((SNOC x ^^ i) \<AA>) = Length \<AA> + i
[PROOF STEP]
by (induct i arbitrary: \<AA>) (auto simp: Length_SNOC)


[STATEMENT]
lemma sum_union:
  assumes "finite (A :: 'a::join_semilattice_zero set)"
  and "finite (B :: 'a::join_semilattice_zero set)"
  shows "\<Sum>(A \<union> B) = \<Sum>A + \<Sum>B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> (A \<union> B) = \<Sum> A + \<Sum> B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Sum> (A \<union> B) = \<Sum> A + \<Sum> B
[PROOF STEP]
have "\<forall>z. \<Sum>(A \<union> B) \<le> z \<longleftrightarrow> (\<Sum>A + \<Sum>B \<le> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>z. (\<Sum> (A \<union> B) \<le> z) = (\<Sum> A + \<Sum> B \<le> z)
[PROOF STEP]
by (auto simp add: assms sum_sup)
[PROOF STATE]
proof (state)
this:
\<forall>z. (\<Sum> (A \<union> B) \<le> z) = (\<Sum> A + \<Sum> B \<le> z)

goal (1 subgoal):
 1. \<Sum> (A \<union> B) = \<Sum> A + \<Sum> B
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>z. (\<Sum> (A \<union> B) \<le> z) = (\<Sum> A + \<Sum> B \<le> z)

goal (1 subgoal):
 1. \<Sum> (A \<union> B) = \<Sum> A + \<Sum> B
[PROOF STEP]
by (simp add: eq_iff)
[PROOF STATE]
proof (state)
this:
\<Sum> (A \<union> B) = \<Sum> A + \<Sum> B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma min_max_for_sol:
  assumes "create_optimal_solutions A b c = Sat X"
  assumes "(x, y) = split_n_m_x (dim_vec c) (dim_vec b) X"
  shows "c \<bullet> x = b \<bullet> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<bullet> x = b \<bullet> y
[PROOF STEP]
using create_opt_sol_in_LP(3)[of X x y, OF assms] cx_leq_bx_in_creating_opt[OF assms]
    comm_scalar_prod[of c "dim_vec c" x] comm_scalar_prod[of b "dim_vec b" y]
[PROOF STATE]
proof (prove)
using this:
y \<bullet> b \<le> x \<bullet> c
c \<bullet> x \<le> b \<bullet> y
\<lbrakk>c \<in> carrier_vec (dim_vec c); x \<in> carrier_vec (dim_vec c)\<rbrakk> \<Longrightarrow> c \<bullet> x = x \<bullet> c
\<lbrakk>b \<in> carrier_vec (dim_vec b); y \<in> carrier_vec (dim_vec b)\<rbrakk> \<Longrightarrow> b \<bullet> y = y \<bullet> b

goal (1 subgoal):
 1. c \<bullet> x = b \<bullet> y
[PROOF STEP]
by (metis add_diff_cancel_left' antisym assms(2) carrier_vec_dim_vec split_vec_dims(1) split_vec_dims(2))


[STATEMENT]
lemma squarefree_imp_coprime_pderiv:
  fixes p :: "'a :: {factorial_ring_gcd,semiring_gcd_mult_normalize,semiring_char_0} poly"
  assumes "squarefree p" and "content p = 1"
  shows   "Rings.coprime p (pderiv p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. algebraic_semidom_class.coprime p (pderiv p)
[PROOF STEP]
proof (rule coprimeI_primes)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p \<noteq> 0 \<or> pderiv p \<noteq> 0
 2. \<And>pa. \<lbrakk>prime pa; pa dvd p; pa dvd pderiv p\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
fix d
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p \<noteq> 0 \<or> pderiv p \<noteq> 0
 2. \<And>pa. \<lbrakk>prime pa; pa dvd p; pa dvd pderiv p\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume d: "prime d" "d dvd p" "d dvd pderiv p"
[PROOF STATE]
proof (state)
this:
prime d
d dvd p
d dvd pderiv p

goal (2 subgoals):
 1. p \<noteq> 0 \<or> pderiv p \<noteq> 0
 2. \<And>pa. \<lbrakk>prime pa; pa dvd p; pa dvd pderiv p\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
proof (cases "Polynomial.degree d = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Polynomial.degree d = 0 \<Longrightarrow> False
 2. Polynomial.degree d \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
case deg: False
[PROOF STATE]
proof (state)
this:
Polynomial.degree d \<noteq> 0

goal (2 subgoals):
 1. Polynomial.degree d = 0 \<Longrightarrow> False
 2. Polynomial.degree d \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
obtain q where dq: "p = d * q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>q. p = d * q \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using d
[PROOF STATE]
proof (prove)
using this:
prime d
d dvd p
d dvd pderiv p

goal (1 subgoal):
 1. (\<And>q. p = d * q \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (elim dvdE)
[PROOF STATE]
proof (state)
this:
p = d * q

goal (2 subgoals):
 1. Polynomial.degree d = 0 \<Longrightarrow> False
 2. Polynomial.degree d \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
have \<open>d dvd q * pderiv d\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d dvd q * pderiv d
[PROOF STEP]
using d
[PROOF STATE]
proof (prove)
using this:
prime d
d dvd p
d dvd pderiv p

goal (1 subgoal):
 1. d dvd q * pderiv d
[PROOF STEP]
by (simp add: dq pderiv_mult dvd_add_right_iff)
[PROOF STATE]
proof (state)
this:
d dvd q * pderiv d

goal (2 subgoals):
 1. Polynomial.degree d = 0 \<Longrightarrow> False
 2. Polynomial.degree d \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
d dvd q * pderiv d

goal (2 subgoals):
 1. Polynomial.degree d = 0 \<Longrightarrow> False
 2. Polynomial.degree d \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
have "\<not>d dvd pderiv d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> d dvd pderiv d
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. d dvd pderiv d \<Longrightarrow> False
[PROOF STEP]
assume "d dvd pderiv d"
[PROOF STATE]
proof (state)
this:
d dvd pderiv d

goal (1 subgoal):
 1. d dvd pderiv d \<Longrightarrow> False
[PROOF STEP]
hence "Polynomial.degree d \<le> Polynomial.degree (pderiv d)"
[PROOF STATE]
proof (prove)
using this:
d dvd pderiv d

goal (1 subgoal):
 1. Polynomial.degree d \<le> Polynomial.degree (pderiv d)
[PROOF STEP]
using d deg
[PROOF STATE]
proof (prove)
using this:
d dvd pderiv d
prime d
d dvd p
d dvd pderiv p
Polynomial.degree d \<noteq> 0

goal (1 subgoal):
 1. Polynomial.degree d \<le> Polynomial.degree (pderiv d)
[PROOF STEP]
by (intro dvd_imp_degree_le) (auto simp: pderiv_eq_0_iff)
[PROOF STATE]
proof (state)
this:
Polynomial.degree d \<le> Polynomial.degree (pderiv d)

goal (1 subgoal):
 1. d dvd pderiv d \<Longrightarrow> False
[PROOF STEP]
hence "Polynomial.degree d = 0"
[PROOF STATE]
proof (prove)
using this:
Polynomial.degree d \<le> Polynomial.degree (pderiv d)

goal (1 subgoal):
 1. Polynomial.degree d = 0
[PROOF STEP]
by (subst (asm) degree_pderiv) auto
[PROOF STATE]
proof (state)
this:
Polynomial.degree d = 0

goal (1 subgoal):
 1. d dvd pderiv d \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
Polynomial.degree d = 0

goal (1 subgoal):
 1. False
[PROOF STEP]
using deg
[PROOF STATE]
proof (prove)
using this:
Polynomial.degree d = 0
Polynomial.degree d \<noteq> 0

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<not> d dvd pderiv d

goal (2 subgoals):
 1. Polynomial.degree d = 0 \<Longrightarrow> False
 2. Polynomial.degree d \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
d dvd q * pderiv d
\<not> d dvd pderiv d
[PROOF STEP]
have "d dvd q"
[PROOF STATE]
proof (prove)
using this:
d dvd q * pderiv d
\<not> d dvd pderiv d

goal (1 subgoal):
 1. d dvd q
[PROOF STEP]
using d(1)
[PROOF STATE]
proof (prove)
using this:
d dvd q * pderiv d
\<not> d dvd pderiv d
prime d

goal (1 subgoal):
 1. d dvd q
[PROOF STEP]
by (simp add: prime_dvd_mult_iff)
[PROOF STATE]
proof (state)
this:
d dvd q

goal (2 subgoals):
 1. Polynomial.degree d = 0 \<Longrightarrow> False
 2. Polynomial.degree d \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
hence "d ^ 2 dvd p"
[PROOF STATE]
proof (prove)
using this:
d dvd q

goal (1 subgoal):
 1. d\<^sup>2 dvd p
[PROOF STEP]
by (auto simp: dq power2_eq_square)
[PROOF STATE]
proof (state)
this:
d\<^sup>2 dvd p

goal (2 subgoals):
 1. Polynomial.degree d = 0 \<Longrightarrow> False
 2. Polynomial.degree d \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
from assms(1) and this
[PROOF STATE]
proof (chain)
picking this:
squarefree p
d\<^sup>2 dvd p
[PROOF STEP]
have "is_unit d"
[PROOF STATE]
proof (prove)
using this:
squarefree p
d\<^sup>2 dvd p

goal (1 subgoal):
 1. is_unit d
[PROOF STEP]
by (rule squarefreeD)
[PROOF STATE]
proof (state)
this:
is_unit d

goal (2 subgoals):
 1. Polynomial.degree d = 0 \<Longrightarrow> False
 2. Polynomial.degree d \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
is_unit d

goal (1 subgoal):
 1. False
[PROOF STEP]
using \<open>prime d\<close>
[PROOF STATE]
proof (prove)
using this:
is_unit d
prime d

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

goal (1 subgoal):
 1. Polynomial.degree d = 0 \<Longrightarrow> False
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Polynomial.degree d = 0 \<Longrightarrow> False
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
Polynomial.degree d = 0

goal (1 subgoal):
 1. Polynomial.degree d = 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Polynomial.degree d = 0
[PROOF STEP]
obtain d' where [simp]: "d = [:d':]"
[PROOF STATE]
proof (prove)
using this:
Polynomial.degree d = 0

goal (1 subgoal):
 1. (\<And>d'. d = [:d':] \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (elim degree_eq_zeroE)
[PROOF STATE]
proof (state)
this:
d = [:d':]

goal (1 subgoal):
 1. Polynomial.degree d = 0 \<Longrightarrow> False
[PROOF STEP]
from d
[PROOF STATE]
proof (chain)
picking this:
prime d
d dvd p
d dvd pderiv p
[PROOF STEP]
have "d' dvd content p"
[PROOF STATE]
proof (prove)
using this:
prime d
d dvd p
d dvd pderiv p

goal (1 subgoal):
 1. d' dvd content p
[PROOF STEP]
by (simp add: const_poly_dvd_iff_dvd_content)
[PROOF STATE]
proof (state)
this:
d' dvd content p

goal (1 subgoal):
 1. Polynomial.degree d = 0 \<Longrightarrow> False
[PROOF STEP]
with assms and prime_imp_prime_elem[OF \<open>prime d\<close>]
[PROOF STATE]
proof (chain)
picking this:
squarefree p
content p = (1::'a)
prime_elem d
d' dvd content p
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
squarefree p
content p = (1::'a)
prime_elem d
d' dvd content p

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

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

goal (1 subgoal):
 1. p \<noteq> 0 \<or> pderiv p \<noteq> 0
[PROOF STEP]
qed (use assms in auto)


[STATEMENT]
lemma comp_red_basis_aux_pmdl:
  assumes "is_minimal_basis (set (xs @ ys))" and "distinct (xs @ ys)"
  shows "pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_minimal_basis (set (xs @ ys))
distinct (xs @ ys)

goal (1 subgoal):
 1. pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys))
[PROOF STEP]
proof (induct xs arbitrary: ys)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ys. \<lbrakk>is_minimal_basis (set ([] @ ys)); distinct ([] @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux [] ys)) \<subseteq> pmdl (set ([] @ ys))
 2. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>is_minimal_basis (set (xs @ ys)); distinct (xs @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys)); is_minimal_basis (set ((a # xs) @ ys)); distinct ((a # xs) @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux (a # xs) ys)) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
is_minimal_basis (set ([] @ ys))
distinct ([] @ ys)

goal (2 subgoals):
 1. \<And>ys. \<lbrakk>is_minimal_basis (set ([] @ ys)); distinct ([] @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux [] ys)) \<subseteq> pmdl (set ([] @ ys))
 2. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>is_minimal_basis (set (xs @ ys)); distinct (xs @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys)); is_minimal_basis (set ((a # xs) @ ys)); distinct ((a # xs) @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux (a # xs) ys)) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmdl (set (comp_red_basis_aux [] ys)) \<subseteq> pmdl (set ([] @ ys))
[PROOF STEP]
unfolding comp_red_basis_aux_base
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmdl (set ys) \<subseteq> pmdl (set ([] @ ys))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pmdl (set (comp_red_basis_aux [] ys)) \<subseteq> pmdl (set ([] @ ys))

goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>is_minimal_basis (set (xs @ ys)); distinct (xs @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys)); is_minimal_basis (set ((a # xs) @ ys)); distinct ((a # xs) @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux (a # xs) ys)) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>is_minimal_basis (set (xs @ ys)); distinct (xs @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys)); is_minimal_basis (set ((a # xs) @ ys)); distinct ((a # xs) @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux (a # xs) ys)) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
case (Cons a xs)
[PROOF STATE]
proof (state)
this:
\<lbrakk>is_minimal_basis (set (xs @ ?ys36)); distinct (xs @ ?ys36)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux xs ?ys36)) \<subseteq> pmdl (set (xs @ ?ys36))
is_minimal_basis (set ((a # xs) @ ys))
distinct ((a # xs) @ ys)

goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>is_minimal_basis (set (xs @ ys)); distinct (xs @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys)); is_minimal_basis (set ((a # xs) @ ys)); distinct ((a # xs) @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux (a # xs) ys)) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
have eq: "(a # xs) @ ys = a # (xs @ ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a # xs) @ ys = a # xs @ ys
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(a # xs) @ ys = a # xs @ ys

goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>is_minimal_basis (set (xs @ ys)); distinct (xs @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys)); is_minimal_basis (set ((a # xs) @ ys)); distinct ((a # xs) @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux (a # xs) ys)) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
from Cons(3)
[PROOF STATE]
proof (chain)
picking this:
distinct ((a # xs) @ ys)
[PROOF STEP]
have a: "a \<notin> set (xs @ ys)"
[PROOF STATE]
proof (prove)
using this:
distinct ((a # xs) @ ys)

goal (1 subgoal):
 1. a \<notin> set (xs @ ys)
[PROOF STEP]
unfolding eq
[PROOF STATE]
proof (prove)
using this:
distinct (a # xs @ ys)

goal (1 subgoal):
 1. a \<notin> set (xs @ ys)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a \<notin> set (xs @ ys)

goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>is_minimal_basis (set (xs @ ys)); distinct (xs @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys)); is_minimal_basis (set ((a # xs) @ ys)); distinct ((a # xs) @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux (a # xs) ys)) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
let ?b = "trd (xs @ ys) a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>is_minimal_basis (set (xs @ ys)); distinct (xs @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys)); is_minimal_basis (set ((a # xs) @ ys)); distinct ((a # xs) @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux (a # xs) ys)) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
let ?ys = "?b # ys"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>is_minimal_basis (set (xs @ ys)); distinct (xs @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys)); is_minimal_basis (set ((a # xs) @ ys)); distinct ((a # xs) @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux (a # xs) ys)) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
have "pmdl (set (comp_red_basis_aux xs ?ys)) \<subseteq> pmdl (set (xs @ ?ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmdl (set (comp_red_basis_aux xs (trd (xs @ ys) a # ys))) \<subseteq> pmdl (set (xs @ trd (xs @ ys) a # ys))
[PROOF STEP]
proof (rule Cons.hyps)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. is_minimal_basis (set (xs @ trd (xs @ ys) a # ys))
 2. distinct (xs @ trd (xs @ ys) a # ys)
[PROOF STEP]
from Cons(3)
[PROOF STATE]
proof (chain)
picking this:
distinct ((a # xs) @ ys)
[PROOF STEP]
have "a \<notin> set (xs @ ys)"
[PROOF STATE]
proof (prove)
using this:
distinct ((a # xs) @ ys)

goal (1 subgoal):
 1. a \<notin> set (xs @ ys)
[PROOF STEP]
unfolding eq
[PROOF STATE]
proof (prove)
using this:
distinct (a # xs @ ys)

goal (1 subgoal):
 1. a \<notin> set (xs @ ys)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a \<notin> set (xs @ ys)

goal (2 subgoals):
 1. is_minimal_basis (set (xs @ trd (xs @ ys) a # ys))
 2. distinct (xs @ trd (xs @ ys) a # ys)
[PROOF STEP]
with Cons(2)
[PROOF STATE]
proof (chain)
picking this:
is_minimal_basis (set ((a # xs) @ ys))
a \<notin> set (xs @ ys)
[PROOF STEP]
show "is_minimal_basis (set (xs @ ?ys))"
[PROOF STATE]
proof (prove)
using this:
is_minimal_basis (set ((a # xs) @ ys))
a \<notin> set (xs @ ys)

goal (1 subgoal):
 1. is_minimal_basis (set (xs @ trd (xs @ ys) a # ys))
[PROOF STEP]
unfolding set_reorder eq
[PROOF STATE]
proof (prove)
using this:
is_minimal_basis (set (a # xs @ ys))
a \<notin> set (xs @ ys)

goal (1 subgoal):
 1. is_minimal_basis (set (trd (xs @ ys) a # xs @ ys))
[PROOF STEP]
by (rule is_minimal_basis_trd_is_minimal_basis)
[PROOF STATE]
proof (state)
this:
is_minimal_basis (set (xs @ trd (xs @ ys) a # ys))

goal (1 subgoal):
 1. distinct (xs @ trd (xs @ ys) a # ys)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. distinct (xs @ trd (xs @ ys) a # ys)
[PROOF STEP]
from Cons(2) Cons(3)
[PROOF STATE]
proof (chain)
picking this:
is_minimal_basis (set ((a # xs) @ ys))
distinct ((a # xs) @ ys)
[PROOF STEP]
show "distinct (xs @ ?ys)"
[PROOF STATE]
proof (prove)
using this:
is_minimal_basis (set ((a # xs) @ ys))
distinct ((a # xs) @ ys)

goal (1 subgoal):
 1. distinct (xs @ trd (xs @ ys) a # ys)
[PROOF STEP]
unfolding distinct_reorder eq
[PROOF STATE]
proof (prove)
using this:
is_minimal_basis (set (a # xs @ ys))
distinct (a # xs @ ys)

goal (1 subgoal):
 1. distinct (trd (xs @ ys) a # xs @ ys)
[PROOF STEP]
by (rule is_minimal_basis_trd_distinct)
[PROOF STATE]
proof (state)
this:
distinct (xs @ trd (xs @ ys) a # ys)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
pmdl (set (comp_red_basis_aux xs (trd (xs @ ys) a # ys))) \<subseteq> pmdl (set (xs @ trd (xs @ ys) a # ys))

goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>is_minimal_basis (set (xs @ ys)); distinct (xs @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys)); is_minimal_basis (set ((a # xs) @ ys)); distinct ((a # xs) @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux (a # xs) ys)) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pmdl (set (comp_red_basis_aux xs (trd (xs @ ys) a # ys))) \<subseteq> pmdl (set (xs @ trd (xs @ ys) a # ys))

goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>is_minimal_basis (set (xs @ ys)); distinct (xs @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys)); is_minimal_basis (set ((a # xs) @ ys)); distinct ((a # xs) @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux (a # xs) ys)) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
have "... = pmdl (set (?b # xs @ ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmdl (set (xs @ trd (xs @ ys) a # ys)) = pmdl (set (trd (xs @ ys) a # xs @ ys))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pmdl (set (xs @ trd (xs @ ys) a # ys)) = pmdl (set (trd (xs @ ys) a # xs @ ys))

goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>is_minimal_basis (set (xs @ ys)); distinct (xs @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys)); is_minimal_basis (set ((a # xs) @ ys)); distinct ((a # xs) @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux (a # xs) ys)) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pmdl (set (xs @ trd (xs @ ys) a # ys)) = pmdl (set (trd (xs @ ys) a # xs @ ys))

goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>is_minimal_basis (set (xs @ ys)); distinct (xs @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys)); is_minimal_basis (set ((a # xs) @ ys)); distinct ((a # xs) @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux (a # xs) ys)) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
from a
[PROOF STATE]
proof (chain)
picking this:
a \<notin> set (xs @ ys)
[PROOF STEP]
have "... = pmdl (insert ?b (set (a # xs @ ys) - {a}))"
[PROOF STATE]
proof (prove)
using this:
a \<notin> set (xs @ ys)

goal (1 subgoal):
 1. pmdl (set (trd (xs @ ys) a # xs @ ys)) = pmdl (insert (trd (xs @ ys) a) (set (a # xs @ ys) - {a}))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
pmdl (set (trd (xs @ ys) a # xs @ ys)) = pmdl (insert (trd (xs @ ys) a) (set (a # xs @ ys) - {a}))

goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>is_minimal_basis (set (xs @ ys)); distinct (xs @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys)); is_minimal_basis (set ((a # xs) @ ys)); distinct ((a # xs) @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux (a # xs) ys)) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pmdl (set (trd (xs @ ys) a # xs @ ys)) = pmdl (insert (trd (xs @ ys) a) (set (a # xs @ ys) - {a}))

goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>is_minimal_basis (set (xs @ ys)); distinct (xs @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys)); is_minimal_basis (set ((a # xs) @ ys)); distinct ((a # xs) @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux (a # xs) ys)) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
have "... \<subseteq> pmdl (set (a # xs @ ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmdl (insert (trd (xs @ ys) a) (set (a # xs @ ys) - {a})) \<subseteq> pmdl (set (a # xs @ ys))
[PROOF STEP]
proof (rule pmdl.replace_span)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. trd (xs @ ys) a \<in> pmdl (set (a # xs @ ys))
[PROOF STEP]
have "a - (trd (xs @ ys) a) \<in> pmdl (set (xs @ ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a - trd (xs @ ys) a \<in> pmdl (set (xs @ ys))
[PROOF STEP]
by (rule trd_in_pmdl)
[PROOF STATE]
proof (state)
this:
a - trd (xs @ ys) a \<in> pmdl (set (xs @ ys))

goal (1 subgoal):
 1. trd (xs @ ys) a \<in> pmdl (set (a # xs @ ys))
[PROOF STEP]
have "a - (trd (xs @ ys) a) \<in> pmdl (set (a # xs @ ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a - trd (xs @ ys) a \<in> pmdl (set (a # xs @ ys))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a - trd (xs @ ys) a \<in> ?A
 2. ?A \<subseteq> pmdl (set (a # xs @ ys))
[PROOF STEP]
show "pmdl (set (xs @ ys)) \<subseteq> pmdl (set (a # xs @ ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmdl (set (xs @ ys)) \<subseteq> pmdl (set (a # xs @ ys))
[PROOF STEP]
by (rule pmdl.span_mono) auto
[PROOF STATE]
proof (state)
this:
pmdl (set (xs @ ys)) \<subseteq> pmdl (set (a # xs @ ys))

goal (1 subgoal):
 1. a - trd (xs @ ys) a \<in> pmdl (set (xs @ ys))
[PROOF STEP]
qed fact
[PROOF STATE]
proof (state)
this:
a - trd (xs @ ys) a \<in> pmdl (set (a # xs @ ys))

goal (1 subgoal):
 1. trd (xs @ ys) a \<in> pmdl (set (a # xs @ ys))
[PROOF STEP]
hence "- (a - (trd (xs @ ys) a)) \<in> pmdl (set (a # xs @ ys))"
[PROOF STATE]
proof (prove)
using this:
a - trd (xs @ ys) a \<in> pmdl (set (a # xs @ ys))

goal (1 subgoal):
 1. - (a - trd (xs @ ys) a) \<in> pmdl (set (a # xs @ ys))
[PROOF STEP]
by (rule pmdl.span_neg)
[PROOF STATE]
proof (state)
this:
- (a - trd (xs @ ys) a) \<in> pmdl (set (a # xs @ ys))

goal (1 subgoal):
 1. trd (xs @ ys) a \<in> pmdl (set (a # xs @ ys))
[PROOF STEP]
hence "(trd (xs @ ys) a) - a \<in> pmdl (set (a # xs @ ys))"
[PROOF STATE]
proof (prove)
using this:
- (a - trd (xs @ ys) a) \<in> pmdl (set (a # xs @ ys))

goal (1 subgoal):
 1. trd (xs @ ys) a - a \<in> pmdl (set (a # xs @ ys))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
trd (xs @ ys) a - a \<in> pmdl (set (a # xs @ ys))

goal (1 subgoal):
 1. trd (xs @ ys) a \<in> pmdl (set (a # xs @ ys))
[PROOF STEP]
hence "((trd (xs @ ys) a) - a) + a \<in> pmdl (set (a # xs @ ys))"
[PROOF STATE]
proof (prove)
using this:
trd (xs @ ys) a - a \<in> pmdl (set (a # xs @ ys))

goal (1 subgoal):
 1. trd (xs @ ys) a - a + a \<in> pmdl (set (a # xs @ ys))
[PROOF STEP]
proof (rule pmdl.span_add)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<in> pmdl (set (a # xs @ ys))
[PROOF STEP]
show "a \<in> pmdl (set (a # xs @ ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> pmdl (set (a # xs @ ys))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a \<in> ?A
 2. ?A \<subseteq> pmdl (set (a # xs @ ys))
[PROOF STEP]
show "a \<in> set (a # xs @ ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> set (a # xs @ ys)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a \<in> set (a # xs @ ys)

goal (1 subgoal):
 1. set (a # xs @ ys) \<subseteq> pmdl (set (a # xs @ ys))
[PROOF STEP]
qed (rule pmdl.span_superset)
[PROOF STATE]
proof (state)
this:
a \<in> pmdl (set (a # xs @ ys))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
trd (xs @ ys) a - a + a \<in> pmdl (set (a # xs @ ys))

goal (1 subgoal):
 1. trd (xs @ ys) a \<in> pmdl (set (a # xs @ ys))
[PROOF STEP]
thus "trd (xs @ ys) a \<in> pmdl (set (a # xs @ ys))"
[PROOF STATE]
proof (prove)
using this:
trd (xs @ ys) a - a + a \<in> pmdl (set (a # xs @ ys))

goal (1 subgoal):
 1. trd (xs @ ys) a \<in> pmdl (set (a # xs @ ys))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
trd (xs @ ys) a \<in> pmdl (set (a # xs @ ys))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
pmdl (insert (trd (xs @ ys) a) (set (a # xs @ ys) - {a})) \<subseteq> pmdl (set (a # xs @ ys))

goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>is_minimal_basis (set (xs @ ys)); distinct (xs @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys)); is_minimal_basis (set ((a # xs) @ ys)); distinct ((a # xs) @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux (a # xs) ys)) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pmdl (insert (trd (xs @ ys) a) (set (a # xs @ ys) - {a})) \<subseteq> pmdl (set (a # xs @ ys))

goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>is_minimal_basis (set (xs @ ys)); distinct (xs @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys)); is_minimal_basis (set ((a # xs) @ ys)); distinct ((a # xs) @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux (a # xs) ys)) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
have "... = pmdl (set ((a # xs) @ ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmdl (set (a # xs @ ys)) = pmdl (set ((a # xs) @ ys))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pmdl (set (a # xs @ ys)) = pmdl (set ((a # xs) @ ys))

goal (1 subgoal):
 1. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>is_minimal_basis (set (xs @ ys)); distinct (xs @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux xs ys)) \<subseteq> pmdl (set (xs @ ys)); is_minimal_basis (set ((a # xs) @ ys)); distinct ((a # xs) @ ys)\<rbrakk> \<Longrightarrow> pmdl (set (comp_red_basis_aux (a # xs) ys)) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
pmdl (set (comp_red_basis_aux xs (trd (xs @ ys) a # ys))) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
pmdl (set (comp_red_basis_aux xs (trd (xs @ ys) a # ys))) \<subseteq> pmdl (set ((a # xs) @ ys))

goal (1 subgoal):
 1. pmdl (set (comp_red_basis_aux (a # xs) ys)) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
unfolding comp_red_basis_aux_rec
[PROOF STATE]
proof (prove)
using this:
pmdl (set (comp_red_basis_aux xs (trd (xs @ ys) a # ys))) \<subseteq> pmdl (set ((a # xs) @ ys))

goal (1 subgoal):
 1. pmdl (set (comp_red_basis_aux xs (trd (xs @ ys) a # ys))) \<subseteq> pmdl (set ((a # xs) @ ys))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
pmdl (set (comp_red_basis_aux (a # xs) ys)) \<subseteq> pmdl (set ((a # xs) @ ys))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma replicate_iff:
  "(\<forall>i<length l. l ! i = R) \<longleftrightarrow> (\<exists> n. l = replicate n R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i<length l. l ! i = R) = (\<exists>n. l = replicate n R)
[PROOF STEP]
by auto (metis (full_types) in_set_conv_nth replicate_eqI)


[STATEMENT]
lemma length_gt_zero_last_concat:
  assumes "length t > 0"
  shows "last (s @ t) = last t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last (s @ t) = last t
[PROOF STEP]
by (metis assms last_append length_greater_0_conv)


[STATEMENT]
lemma cnj_prod [simp]: "cnj (prod f s) = (\<Prod>x\<in>s. cnj (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj (prod f s) = (\<Prod>x\<in>s. cnj (f x))
[PROOF STEP]
by (induct s rule: infinite_finite_induct) auto


[STATEMENT]
lemma lift_streams_Cons[applicative_unfold]:
  "lift_streams (x # xs) = smap2 Cons x (lift_streams xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lift_streams (x # xs) = smap2 (#) x (lift_streams xs)
[PROOF STEP]
unfolding lift_streams_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (smap2 (#)) (x # xs) (pure []) = smap2 (#) x (foldr (smap2 (#)) xs (pure []))
[PROOF STEP]
by applicative_unfold