[STATEMENT]
lemma sorted_fst_hd_drop_less_drop:
  assumes "sorted_fst ps"
  shows "\<forall>p \<in> set (drop n ps). fst (hd (drop n ps)) \<le> fst p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p\<in>set (drop n ps). fst (hd (drop n ps)) \<le> fst p
[PROOF STEP]
using assms sorted_wrt_hd_drop_less_drop[of "\<lambda>p\<^sub>0 p\<^sub>1. fst p\<^sub>0 \<le> fst p\<^sub>1"] sorted_fst_def
[PROOF STATE]
proof (prove)
using this:
sorted_fst ps
\<lbrakk>sorted_wrt (\<lambda>p\<^sub>0 p\<^sub>1. fst p\<^sub>0 \<le> fst p\<^sub>1) ?xs; \<And>x. fst x \<le> fst x\<rbrakk> \<Longrightarrow> \<forall>x\<in>set (drop ?n ?xs). fst (hd (drop ?n ?xs)) \<le> fst x
sorted_fst ?ps = sorted_wrt (\<lambda>p\<^sub>0 p\<^sub>1. fst p\<^sub>0 \<le> fst p\<^sub>1) ?ps

goal (1 subgoal):
 1. \<forall>p\<in>set (drop n ps). fst (hd (drop n ps)) \<le> fst p
[PROOF STEP]
by fastforce


[STATEMENT]
lemma linear_system_homogenous_3_2:
  fixes a11 a12 a13 a21 a22 a23 x1 y1 z1 x2 y2 z2 :: "'a::field"
  assumes "f1 = (\<lambda> x y z. a11 * x + a12 * y + a13 * z)"
  assumes "f2 = (\<lambda> x y z. a21 * x + a22 * y + a23 * z)"
  assumes "f1 x1 y1 z1 = 0" and "f2 x1 y1 z1 = 0"
  assumes "f1 x2 y2 z2 = 0" and "f2 x2 y2 z2 = 0"
  assumes "x2 \<noteq> 0 \<or> y2 \<noteq> 0 \<or> z2 \<noteq> 0"
  assumes "det2 a11 a12 a21 a22 \<noteq> 0 \<or> det2 a11 a13 a21 a23 \<noteq> 0 \<or> det2 a12 a13 a22 a23 \<noteq> 0"
  shows "\<exists> k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
let ?Dz = "det2 a11 a12 a21 a22"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
let ?Dy = "det2 a11 a13 a21 a23"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
let ?Dx = "det2 a12 a13 a22 a23"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
have "a21 * (f1 x1 y1 z1) - a11 * (f2 x1 y1 z1) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a21 * f1 x1 y1 z1 - a11 * f2 x1 y1 z1 = (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f1 = (\<lambda>x y z. a11 * x + a12 * y + a13 * z)
f2 = (\<lambda>x y z. a21 * x + a22 * y + a23 * z)
f1 x1 y1 z1 = (0::'a)
f2 x1 y1 z1 = (0::'a)
f1 x2 y2 z2 = (0::'a)
f2 x2 y2 z2 = (0::'a)
x2 \<noteq> (0::'a) \<or> y2 \<noteq> (0::'a) \<or> z2 \<noteq> (0::'a)
det2 a11 a12 a21 a22 \<noteq> (0::'a) \<or> det2 a11 a13 a21 a23 \<noteq> (0::'a) \<or> det2 a12 a13 a22 a23 \<noteq> (0::'a)

goal (1 subgoal):
 1. a21 * f1 x1 y1 z1 - a11 * f2 x1 y1 z1 = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a21 * f1 x1 y1 z1 - a11 * f2 x1 y1 z1 = (0::'a)

goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
hence yz1: "?Dz*y1 + ?Dy*z1 = 0"
[PROOF STATE]
proof (prove)
using this:
a21 * f1 x1 y1 z1 - a11 * f2 x1 y1 z1 = (0::'a)

goal (1 subgoal):
 1. det2 a11 a12 a21 a22 * y1 + det2 a11 a13 a21 a23 * z1 = (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a21 * f1 x1 y1 z1 - a11 * f2 x1 y1 z1 = (0::'a)
f1 = (\<lambda>x y z. a11 * x + a12 * y + a13 * z)
f2 = (\<lambda>x y z. a21 * x + a22 * y + a23 * z)
f1 x1 y1 z1 = (0::'a)
f2 x1 y1 z1 = (0::'a)
f1 x2 y2 z2 = (0::'a)
f2 x2 y2 z2 = (0::'a)
x2 \<noteq> (0::'a) \<or> y2 \<noteq> (0::'a) \<or> z2 \<noteq> (0::'a)
det2 a11 a12 a21 a22 \<noteq> (0::'a) \<or> det2 a11 a13 a21 a23 \<noteq> (0::'a) \<or> det2 a12 a13 a22 a23 \<noteq> (0::'a)

goal (1 subgoal):
 1. det2 a11 a12 a21 a22 * y1 + det2 a11 a13 a21 a23 * z1 = (0::'a)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
det2 a11 a12 a21 a22 * y1 + det2 a11 a13 a21 a23 * z1 = (0::'a)

goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
have "a21 * (f1 x2 y2 z2) - a11 * (f2 x2 y2 z2) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a21 * f1 x2 y2 z2 - a11 * f2 x2 y2 z2 = (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f1 = (\<lambda>x y z. a11 * x + a12 * y + a13 * z)
f2 = (\<lambda>x y z. a21 * x + a22 * y + a23 * z)
f1 x1 y1 z1 = (0::'a)
f2 x1 y1 z1 = (0::'a)
f1 x2 y2 z2 = (0::'a)
f2 x2 y2 z2 = (0::'a)
x2 \<noteq> (0::'a) \<or> y2 \<noteq> (0::'a) \<or> z2 \<noteq> (0::'a)
det2 a11 a12 a21 a22 \<noteq> (0::'a) \<or> det2 a11 a13 a21 a23 \<noteq> (0::'a) \<or> det2 a12 a13 a22 a23 \<noteq> (0::'a)

goal (1 subgoal):
 1. a21 * f1 x2 y2 z2 - a11 * f2 x2 y2 z2 = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a21 * f1 x2 y2 z2 - a11 * f2 x2 y2 z2 = (0::'a)

goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
hence yz2: "?Dz*y2 + ?Dy*z2 = 0"
[PROOF STATE]
proof (prove)
using this:
a21 * f1 x2 y2 z2 - a11 * f2 x2 y2 z2 = (0::'a)

goal (1 subgoal):
 1. det2 a11 a12 a21 a22 * y2 + det2 a11 a13 a21 a23 * z2 = (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a21 * f1 x2 y2 z2 - a11 * f2 x2 y2 z2 = (0::'a)
f1 = (\<lambda>x y z. a11 * x + a12 * y + a13 * z)
f2 = (\<lambda>x y z. a21 * x + a22 * y + a23 * z)
f1 x1 y1 z1 = (0::'a)
f2 x1 y1 z1 = (0::'a)
f1 x2 y2 z2 = (0::'a)
f2 x2 y2 z2 = (0::'a)
x2 \<noteq> (0::'a) \<or> y2 \<noteq> (0::'a) \<or> z2 \<noteq> (0::'a)
det2 a11 a12 a21 a22 \<noteq> (0::'a) \<or> det2 a11 a13 a21 a23 \<noteq> (0::'a) \<or> det2 a12 a13 a22 a23 \<noteq> (0::'a)

goal (1 subgoal):
 1. det2 a11 a12 a21 a22 * y2 + det2 a11 a13 a21 a23 * z2 = (0::'a)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
det2 a11 a12 a21 a22 * y2 + det2 a11 a13 a21 a23 * z2 = (0::'a)

goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
have "a22 * (f1 x1 y1 z1) - a12 * (f2 x1 y1 z1) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a22 * f1 x1 y1 z1 - a12 * f2 x1 y1 z1 = (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f1 = (\<lambda>x y z. a11 * x + a12 * y + a13 * z)
f2 = (\<lambda>x y z. a21 * x + a22 * y + a23 * z)
f1 x1 y1 z1 = (0::'a)
f2 x1 y1 z1 = (0::'a)
f1 x2 y2 z2 = (0::'a)
f2 x2 y2 z2 = (0::'a)
x2 \<noteq> (0::'a) \<or> y2 \<noteq> (0::'a) \<or> z2 \<noteq> (0::'a)
det2 a11 a12 a21 a22 \<noteq> (0::'a) \<or> det2 a11 a13 a21 a23 \<noteq> (0::'a) \<or> det2 a12 a13 a22 a23 \<noteq> (0::'a)

goal (1 subgoal):
 1. a22 * f1 x1 y1 z1 - a12 * f2 x1 y1 z1 = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a22 * f1 x1 y1 z1 - a12 * f2 x1 y1 z1 = (0::'a)

goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
hence xz1: "-?Dz*x1 + ?Dx*z1 = 0"
[PROOF STATE]
proof (prove)
using this:
a22 * f1 x1 y1 z1 - a12 * f2 x1 y1 z1 = (0::'a)

goal (1 subgoal):
 1. - det2 a11 a12 a21 a22 * x1 + det2 a12 a13 a22 a23 * z1 = (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a22 * f1 x1 y1 z1 - a12 * f2 x1 y1 z1 = (0::'a)
f1 = (\<lambda>x y z. a11 * x + a12 * y + a13 * z)
f2 = (\<lambda>x y z. a21 * x + a22 * y + a23 * z)
f1 x1 y1 z1 = (0::'a)
f2 x1 y1 z1 = (0::'a)
f1 x2 y2 z2 = (0::'a)
f2 x2 y2 z2 = (0::'a)
x2 \<noteq> (0::'a) \<or> y2 \<noteq> (0::'a) \<or> z2 \<noteq> (0::'a)
det2 a11 a12 a21 a22 \<noteq> (0::'a) \<or> det2 a11 a13 a21 a23 \<noteq> (0::'a) \<or> det2 a12 a13 a22 a23 \<noteq> (0::'a)

goal (1 subgoal):
 1. - det2 a11 a12 a21 a22 * x1 + det2 a12 a13 a22 a23 * z1 = (0::'a)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
- det2 a11 a12 a21 a22 * x1 + det2 a12 a13 a22 a23 * z1 = (0::'a)

goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
have "a22 * (f1 x2 y2 z2) - a12 * (f2 x2 y2 z2) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a22 * f1 x2 y2 z2 - a12 * f2 x2 y2 z2 = (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f1 = (\<lambda>x y z. a11 * x + a12 * y + a13 * z)
f2 = (\<lambda>x y z. a21 * x + a22 * y + a23 * z)
f1 x1 y1 z1 = (0::'a)
f2 x1 y1 z1 = (0::'a)
f1 x2 y2 z2 = (0::'a)
f2 x2 y2 z2 = (0::'a)
x2 \<noteq> (0::'a) \<or> y2 \<noteq> (0::'a) \<or> z2 \<noteq> (0::'a)
det2 a11 a12 a21 a22 \<noteq> (0::'a) \<or> det2 a11 a13 a21 a23 \<noteq> (0::'a) \<or> det2 a12 a13 a22 a23 \<noteq> (0::'a)

goal (1 subgoal):
 1. a22 * f1 x2 y2 z2 - a12 * f2 x2 y2 z2 = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a22 * f1 x2 y2 z2 - a12 * f2 x2 y2 z2 = (0::'a)

goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
hence xz2: "-?Dz*x2 + ?Dx*z2 = 0"
[PROOF STATE]
proof (prove)
using this:
a22 * f1 x2 y2 z2 - a12 * f2 x2 y2 z2 = (0::'a)

goal (1 subgoal):
 1. - det2 a11 a12 a21 a22 * x2 + det2 a12 a13 a22 a23 * z2 = (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a22 * f1 x2 y2 z2 - a12 * f2 x2 y2 z2 = (0::'a)
f1 = (\<lambda>x y z. a11 * x + a12 * y + a13 * z)
f2 = (\<lambda>x y z. a21 * x + a22 * y + a23 * z)
f1 x1 y1 z1 = (0::'a)
f2 x1 y1 z1 = (0::'a)
f1 x2 y2 z2 = (0::'a)
f2 x2 y2 z2 = (0::'a)
x2 \<noteq> (0::'a) \<or> y2 \<noteq> (0::'a) \<or> z2 \<noteq> (0::'a)
det2 a11 a12 a21 a22 \<noteq> (0::'a) \<or> det2 a11 a13 a21 a23 \<noteq> (0::'a) \<or> det2 a12 a13 a22 a23 \<noteq> (0::'a)

goal (1 subgoal):
 1. - det2 a11 a12 a21 a22 * x2 + det2 a12 a13 a22 a23 * z2 = (0::'a)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
- det2 a11 a12 a21 a22 * x2 + det2 a12 a13 a22 a23 * z2 = (0::'a)

goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
have "a23 * (f1 x1 y1 z1) - a13 * (f2 x1 y1 z1) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a23 * f1 x1 y1 z1 - a13 * f2 x1 y1 z1 = (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f1 = (\<lambda>x y z. a11 * x + a12 * y + a13 * z)
f2 = (\<lambda>x y z. a21 * x + a22 * y + a23 * z)
f1 x1 y1 z1 = (0::'a)
f2 x1 y1 z1 = (0::'a)
f1 x2 y2 z2 = (0::'a)
f2 x2 y2 z2 = (0::'a)
x2 \<noteq> (0::'a) \<or> y2 \<noteq> (0::'a) \<or> z2 \<noteq> (0::'a)
det2 a11 a12 a21 a22 \<noteq> (0::'a) \<or> det2 a11 a13 a21 a23 \<noteq> (0::'a) \<or> det2 a12 a13 a22 a23 \<noteq> (0::'a)

goal (1 subgoal):
 1. a23 * f1 x1 y1 z1 - a13 * f2 x1 y1 z1 = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a23 * f1 x1 y1 z1 - a13 * f2 x1 y1 z1 = (0::'a)

goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
hence xy1: "?Dy*x1 + ?Dx*y1 = 0"
[PROOF STATE]
proof (prove)
using this:
a23 * f1 x1 y1 z1 - a13 * f2 x1 y1 z1 = (0::'a)

goal (1 subgoal):
 1. det2 a11 a13 a21 a23 * x1 + det2 a12 a13 a22 a23 * y1 = (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a23 * f1 x1 y1 z1 - a13 * f2 x1 y1 z1 = (0::'a)
f1 = (\<lambda>x y z. a11 * x + a12 * y + a13 * z)
f2 = (\<lambda>x y z. a21 * x + a22 * y + a23 * z)
f1 x1 y1 z1 = (0::'a)
f2 x1 y1 z1 = (0::'a)
f1 x2 y2 z2 = (0::'a)
f2 x2 y2 z2 = (0::'a)
x2 \<noteq> (0::'a) \<or> y2 \<noteq> (0::'a) \<or> z2 \<noteq> (0::'a)
det2 a11 a12 a21 a22 \<noteq> (0::'a) \<or> det2 a11 a13 a21 a23 \<noteq> (0::'a) \<or> det2 a12 a13 a22 a23 \<noteq> (0::'a)

goal (1 subgoal):
 1. det2 a11 a13 a21 a23 * x1 + det2 a12 a13 a22 a23 * y1 = (0::'a)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
det2 a11 a13 a21 a23 * x1 + det2 a12 a13 a22 a23 * y1 = (0::'a)

goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
have "a23 * (f1 x2 y2 z2) - a13 * (f2 x2 y2 z2) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a23 * f1 x2 y2 z2 - a13 * f2 x2 y2 z2 = (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f1 = (\<lambda>x y z. a11 * x + a12 * y + a13 * z)
f2 = (\<lambda>x y z. a21 * x + a22 * y + a23 * z)
f1 x1 y1 z1 = (0::'a)
f2 x1 y1 z1 = (0::'a)
f1 x2 y2 z2 = (0::'a)
f2 x2 y2 z2 = (0::'a)
x2 \<noteq> (0::'a) \<or> y2 \<noteq> (0::'a) \<or> z2 \<noteq> (0::'a)
det2 a11 a12 a21 a22 \<noteq> (0::'a) \<or> det2 a11 a13 a21 a23 \<noteq> (0::'a) \<or> det2 a12 a13 a22 a23 \<noteq> (0::'a)

goal (1 subgoal):
 1. a23 * f1 x2 y2 z2 - a13 * f2 x2 y2 z2 = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a23 * f1 x2 y2 z2 - a13 * f2 x2 y2 z2 = (0::'a)

goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
hence xy2: "?Dy*x2 + ?Dx*y2 = 0"
[PROOF STATE]
proof (prove)
using this:
a23 * f1 x2 y2 z2 - a13 * f2 x2 y2 z2 = (0::'a)

goal (1 subgoal):
 1. det2 a11 a13 a21 a23 * x2 + det2 a12 a13 a22 a23 * y2 = (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a23 * f1 x2 y2 z2 - a13 * f2 x2 y2 z2 = (0::'a)
f1 = (\<lambda>x y z. a11 * x + a12 * y + a13 * z)
f2 = (\<lambda>x y z. a21 * x + a22 * y + a23 * z)
f1 x1 y1 z1 = (0::'a)
f2 x1 y1 z1 = (0::'a)
f1 x2 y2 z2 = (0::'a)
f2 x2 y2 z2 = (0::'a)
x2 \<noteq> (0::'a) \<or> y2 \<noteq> (0::'a) \<or> z2 \<noteq> (0::'a)
det2 a11 a12 a21 a22 \<noteq> (0::'a) \<or> det2 a11 a13 a21 a23 \<noteq> (0::'a) \<or> det2 a12 a13 a22 a23 \<noteq> (0::'a)

goal (1 subgoal):
 1. det2 a11 a13 a21 a23 * x2 + det2 a12 a13 a22 a23 * y2 = (0::'a)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
det2 a11 a13 a21 a23 * x2 + det2 a12 a13 a22 a23 * y2 = (0::'a)

goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
using \<open>?Dz \<noteq> 0 \<or> ?Dy \<noteq> 0 \<or> ?Dx \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
det2 a11 a12 a21 a22 \<noteq> (0::'a) \<or> det2 a11 a13 a21 a23 \<noteq> (0::'a) \<or> det2 a12 a13 a22 a23 \<noteq> (0::'a)

goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. det2 a11 a12 a21 a22 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
 2. det2 a11 a13 a21 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
 3. det2 a12 a13 a22 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
assume "?Dz \<noteq> 0"
[PROOF STATE]
proof (state)
this:
det2 a11 a12 a21 a22 \<noteq> (0::'a)

goal (3 subgoals):
 1. det2 a11 a12 a21 a22 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
 2. det2 a11 a13 a21 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
 3. det2 a12 a13 a22 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
hence *:
      "x2 = (?Dx / ?Dz) * z2" "y2 = - (?Dy / ?Dz) * z2"
      "x1 = (?Dx / ?Dz) * z1" "y1 = - (?Dy / ?Dz) * z1"
[PROOF STATE]
proof (prove)
using this:
det2 a11 a12 a21 a22 \<noteq> (0::'a)

goal (1 subgoal):
 1. (x2 = det2 a12 a13 a22 a23 / det2 a11 a12 a21 a22 * z2 &&& y2 = - (det2 a11 a13 a21 a23 / det2 a11 a12 a21 a22) * z2) &&& x1 = det2 a12 a13 a22 a23 / det2 a11 a12 a21 a22 * z1 &&& y1 = - (det2 a11 a13 a21 a23 / det2 a11 a12 a21 a22) * z1
[PROOF STEP]
using xy2 xz2 xy1 xz1 yz1 yz2
[PROOF STATE]
proof (prove)
using this:
det2 a11 a12 a21 a22 \<noteq> (0::'a)
det2 a11 a13 a21 a23 * x2 + det2 a12 a13 a22 a23 * y2 = (0::'a)
- det2 a11 a12 a21 a22 * x2 + det2 a12 a13 a22 a23 * z2 = (0::'a)
det2 a11 a13 a21 a23 * x1 + det2 a12 a13 a22 a23 * y1 = (0::'a)
- det2 a11 a12 a21 a22 * x1 + det2 a12 a13 a22 a23 * z1 = (0::'a)
det2 a11 a12 a21 a22 * y1 + det2 a11 a13 a21 a23 * z1 = (0::'a)
det2 a11 a12 a21 a22 * y2 + det2 a11 a13 a21 a23 * z2 = (0::'a)

goal (1 subgoal):
 1. (x2 = det2 a12 a13 a22 a23 / det2 a11 a12 a21 a22 * z2 &&& y2 = - (det2 a11 a13 a21 a23 / det2 a11 a12 a21 a22) * z2) &&& x1 = det2 a12 a13 a22 a23 / det2 a11 a12 a21 a22 * z1 &&& y1 = - (det2 a11 a13 a21 a23 / det2 a11 a12 a21 a22) * z1
[PROOF STEP]
by (simp_all add: field_simps)
[PROOF STATE]
proof (state)
this:
x2 = det2 a12 a13 a22 a23 / det2 a11 a12 a21 a22 * z2
y2 = - (det2 a11 a13 a21 a23 / det2 a11 a12 a21 a22) * z2
x1 = det2 a12 a13 a22 a23 / det2 a11 a12 a21 a22 * z1
y1 = - (det2 a11 a13 a21 a23 / det2 a11 a12 a21 a22) * z1

goal (3 subgoals):
 1. det2 a11 a12 a21 a22 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
 2. det2 a11 a13 a21 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
 3. det2 a12 a13 a22 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
hence "z2 \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
x2 = det2 a12 a13 a22 a23 / det2 a11 a12 a21 a22 * z2
y2 = - (det2 a11 a13 a21 a23 / det2 a11 a12 a21 a22) * z2
x1 = det2 a12 a13 a22 a23 / det2 a11 a12 a21 a22 * z1
y1 = - (det2 a11 a13 a21 a23 / det2 a11 a12 a21 a22) * z1

goal (1 subgoal):
 1. z2 \<noteq> (0::'a)
[PROOF STEP]
using \<open>x2 \<noteq> 0 \<or> y2 \<noteq> 0 \<or> z2 \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
x2 = det2 a12 a13 a22 a23 / det2 a11 a12 a21 a22 * z2
y2 = - (det2 a11 a13 a21 a23 / det2 a11 a12 a21 a22) * z2
x1 = det2 a12 a13 a22 a23 / det2 a11 a12 a21 a22 * z1
y1 = - (det2 a11 a13 a21 a23 / det2 a11 a12 a21 a22) * z1
x2 \<noteq> (0::'a) \<or> y2 \<noteq> (0::'a) \<or> z2 \<noteq> (0::'a)

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

goal (3 subgoals):
 1. det2 a11 a12 a21 a22 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
 2. det2 a11 a13 a21 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
 3. det2 a12 a13 a22 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
z2 \<noteq> (0::'a)

goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
using * \<open>?Dz \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
z2 \<noteq> (0::'a)
x2 = det2 a12 a13 a22 a23 / det2 a11 a12 a21 a22 * z2
y2 = - (det2 a11 a13 a21 a23 / det2 a11 a12 a21 a22) * z2
x1 = det2 a12 a13 a22 a23 / det2 a11 a12 a21 a22 * z1
y1 = - (det2 a11 a13 a21 a23 / det2 a11 a12 a21 a22) * z1
det2 a11 a12 a21 a22 \<noteq> (0::'a)

goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
by (rule_tac x="z1/z2" in exI) auto
[PROOF STATE]
proof (state)
this:
\<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2

goal (2 subgoals):
 1. det2 a11 a13 a21 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
 2. det2 a12 a13 a22 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. det2 a11 a13 a21 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
 2. det2 a12 a13 a22 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
assume "?Dy \<noteq> 0"
[PROOF STATE]
proof (state)
this:
det2 a11 a13 a21 a23 \<noteq> (0::'a)

goal (2 subgoals):
 1. det2 a11 a13 a21 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
 2. det2 a12 a13 a22 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
hence *:
      "x2 = - (?Dx / ?Dy) * y2" "z2 = - (?Dz / ?Dy) * y2"
      "x1 = - (?Dx / ?Dy) * y1" "z1 = - (?Dz / ?Dy) * y1"
[PROOF STATE]
proof (prove)
using this:
det2 a11 a13 a21 a23 \<noteq> (0::'a)

goal (1 subgoal):
 1. (x2 = - (det2 a12 a13 a22 a23 / det2 a11 a13 a21 a23) * y2 &&& z2 = - (det2 a11 a12 a21 a22 / det2 a11 a13 a21 a23) * y2) &&& x1 = - (det2 a12 a13 a22 a23 / det2 a11 a13 a21 a23) * y1 &&& z1 = - (det2 a11 a12 a21 a22 / det2 a11 a13 a21 a23) * y1
[PROOF STEP]
using xy2 xz2 xy1 xz1 yz1 yz2
[PROOF STATE]
proof (prove)
using this:
det2 a11 a13 a21 a23 \<noteq> (0::'a)
det2 a11 a13 a21 a23 * x2 + det2 a12 a13 a22 a23 * y2 = (0::'a)
- det2 a11 a12 a21 a22 * x2 + det2 a12 a13 a22 a23 * z2 = (0::'a)
det2 a11 a13 a21 a23 * x1 + det2 a12 a13 a22 a23 * y1 = (0::'a)
- det2 a11 a12 a21 a22 * x1 + det2 a12 a13 a22 a23 * z1 = (0::'a)
det2 a11 a12 a21 a22 * y1 + det2 a11 a13 a21 a23 * z1 = (0::'a)
det2 a11 a12 a21 a22 * y2 + det2 a11 a13 a21 a23 * z2 = (0::'a)

goal (1 subgoal):
 1. (x2 = - (det2 a12 a13 a22 a23 / det2 a11 a13 a21 a23) * y2 &&& z2 = - (det2 a11 a12 a21 a22 / det2 a11 a13 a21 a23) * y2) &&& x1 = - (det2 a12 a13 a22 a23 / det2 a11 a13 a21 a23) * y1 &&& z1 = - (det2 a11 a12 a21 a22 / det2 a11 a13 a21 a23) * y1
[PROOF STEP]
by (simp_all add: field_simps)
[PROOF STATE]
proof (state)
this:
x2 = - (det2 a12 a13 a22 a23 / det2 a11 a13 a21 a23) * y2
z2 = - (det2 a11 a12 a21 a22 / det2 a11 a13 a21 a23) * y2
x1 = - (det2 a12 a13 a22 a23 / det2 a11 a13 a21 a23) * y1
z1 = - (det2 a11 a12 a21 a22 / det2 a11 a13 a21 a23) * y1

goal (2 subgoals):
 1. det2 a11 a13 a21 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
 2. det2 a12 a13 a22 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
hence "y2 \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
x2 = - (det2 a12 a13 a22 a23 / det2 a11 a13 a21 a23) * y2
z2 = - (det2 a11 a12 a21 a22 / det2 a11 a13 a21 a23) * y2
x1 = - (det2 a12 a13 a22 a23 / det2 a11 a13 a21 a23) * y1
z1 = - (det2 a11 a12 a21 a22 / det2 a11 a13 a21 a23) * y1

goal (1 subgoal):
 1. y2 \<noteq> (0::'a)
[PROOF STEP]
using \<open>x2 \<noteq> 0 \<or> y2 \<noteq> 0 \<or> z2 \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
x2 = - (det2 a12 a13 a22 a23 / det2 a11 a13 a21 a23) * y2
z2 = - (det2 a11 a12 a21 a22 / det2 a11 a13 a21 a23) * y2
x1 = - (det2 a12 a13 a22 a23 / det2 a11 a13 a21 a23) * y1
z1 = - (det2 a11 a12 a21 a22 / det2 a11 a13 a21 a23) * y1
x2 \<noteq> (0::'a) \<or> y2 \<noteq> (0::'a) \<or> z2 \<noteq> (0::'a)

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

goal (2 subgoals):
 1. det2 a11 a13 a21 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
 2. det2 a12 a13 a22 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
y2 \<noteq> (0::'a)

goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
using * \<open>?Dy \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
y2 \<noteq> (0::'a)
x2 = - (det2 a12 a13 a22 a23 / det2 a11 a13 a21 a23) * y2
z2 = - (det2 a11 a12 a21 a22 / det2 a11 a13 a21 a23) * y2
x1 = - (det2 a12 a13 a22 a23 / det2 a11 a13 a21 a23) * y1
z1 = - (det2 a11 a12 a21 a22 / det2 a11 a13 a21 a23) * y1
det2 a11 a13 a21 a23 \<noteq> (0::'a)

goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
by (rule_tac x="y1/y2" in exI) auto
[PROOF STATE]
proof (state)
this:
\<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2

goal (1 subgoal):
 1. det2 a12 a13 a22 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det2 a12 a13 a22 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
assume "?Dx \<noteq> 0"
[PROOF STATE]
proof (state)
this:
det2 a12 a13 a22 a23 \<noteq> (0::'a)

goal (1 subgoal):
 1. det2 a12 a13 a22 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
hence *:
      "y2 = - (?Dy / ?Dx) * x2" "z2 = (?Dz / ?Dx) * x2"
      "y1 = - (?Dy / ?Dx) * x1" "z1 = (?Dz / ?Dx) * x1"
[PROOF STATE]
proof (prove)
using this:
det2 a12 a13 a22 a23 \<noteq> (0::'a)

goal (1 subgoal):
 1. (y2 = - (det2 a11 a13 a21 a23 / det2 a12 a13 a22 a23) * x2 &&& z2 = det2 a11 a12 a21 a22 / det2 a12 a13 a22 a23 * x2) &&& y1 = - (det2 a11 a13 a21 a23 / det2 a12 a13 a22 a23) * x1 &&& z1 = det2 a11 a12 a21 a22 / det2 a12 a13 a22 a23 * x1
[PROOF STEP]
using xy2 xz2 xy1 xz1 yz1 yz2
[PROOF STATE]
proof (prove)
using this:
det2 a12 a13 a22 a23 \<noteq> (0::'a)
det2 a11 a13 a21 a23 * x2 + det2 a12 a13 a22 a23 * y2 = (0::'a)
- det2 a11 a12 a21 a22 * x2 + det2 a12 a13 a22 a23 * z2 = (0::'a)
det2 a11 a13 a21 a23 * x1 + det2 a12 a13 a22 a23 * y1 = (0::'a)
- det2 a11 a12 a21 a22 * x1 + det2 a12 a13 a22 a23 * z1 = (0::'a)
det2 a11 a12 a21 a22 * y1 + det2 a11 a13 a21 a23 * z1 = (0::'a)
det2 a11 a12 a21 a22 * y2 + det2 a11 a13 a21 a23 * z2 = (0::'a)

goal (1 subgoal):
 1. (y2 = - (det2 a11 a13 a21 a23 / det2 a12 a13 a22 a23) * x2 &&& z2 = det2 a11 a12 a21 a22 / det2 a12 a13 a22 a23 * x2) &&& y1 = - (det2 a11 a13 a21 a23 / det2 a12 a13 a22 a23) * x1 &&& z1 = det2 a11 a12 a21 a22 / det2 a12 a13 a22 a23 * x1
[PROOF STEP]
by (simp_all add: field_simps)
[PROOF STATE]
proof (state)
this:
y2 = - (det2 a11 a13 a21 a23 / det2 a12 a13 a22 a23) * x2
z2 = det2 a11 a12 a21 a22 / det2 a12 a13 a22 a23 * x2
y1 = - (det2 a11 a13 a21 a23 / det2 a12 a13 a22 a23) * x1
z1 = det2 a11 a12 a21 a22 / det2 a12 a13 a22 a23 * x1

goal (1 subgoal):
 1. det2 a12 a13 a22 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
hence "x2 \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
y2 = - (det2 a11 a13 a21 a23 / det2 a12 a13 a22 a23) * x2
z2 = det2 a11 a12 a21 a22 / det2 a12 a13 a22 a23 * x2
y1 = - (det2 a11 a13 a21 a23 / det2 a12 a13 a22 a23) * x1
z1 = det2 a11 a12 a21 a22 / det2 a12 a13 a22 a23 * x1

goal (1 subgoal):
 1. x2 \<noteq> (0::'a)
[PROOF STEP]
using \<open>x2 \<noteq> 0 \<or> y2 \<noteq> 0 \<or> z2 \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
y2 = - (det2 a11 a13 a21 a23 / det2 a12 a13 a22 a23) * x2
z2 = det2 a11 a12 a21 a22 / det2 a12 a13 a22 a23 * x2
y1 = - (det2 a11 a13 a21 a23 / det2 a12 a13 a22 a23) * x1
z1 = det2 a11 a12 a21 a22 / det2 a12 a13 a22 a23 * x1
x2 \<noteq> (0::'a) \<or> y2 \<noteq> (0::'a) \<or> z2 \<noteq> (0::'a)

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

goal (1 subgoal):
 1. det2 a12 a13 a22 a23 \<noteq> (0::'a) \<Longrightarrow> \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x2 \<noteq> (0::'a)

goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
using * \<open>?Dx \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
x2 \<noteq> (0::'a)
y2 = - (det2 a11 a13 a21 a23 / det2 a12 a13 a22 a23) * x2
z2 = det2 a11 a12 a21 a22 / det2 a12 a13 a22 a23 * x2
y1 = - (det2 a11 a13 a21 a23 / det2 a12 a13 a22 a23) * x1
z1 = det2 a11 a12 a21 a22 / det2 a12 a13 a22 a23 * x1
det2 a12 a13 a22 a23 \<noteq> (0::'a)

goal (1 subgoal):
 1. \<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2
[PROOF STEP]
by (rule_tac x="x1/x2" in exI) auto
[PROOF STATE]
proof (state)
this:
\<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>k. x1 = k * x2 \<and> y1 = k * y2 \<and> z1 = k * z2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_minus [tendsto_intros]: "(f \<longlongrightarrow> a) F \<Longrightarrow> ((\<lambda>x. - f x) \<longlongrightarrow> - a) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> a) F \<Longrightarrow> ((\<lambda>x. - f x) \<longlongrightarrow> - a) F
[PROOF STEP]
by (rule filterlim_compose[OF tendsto_uminus_nhds])


[STATEMENT]
lemma dual_galois [simp]: " galois_connection \<lparr> orderA = inv_gorder B, orderB = inv_gorder A, lower = f, upper = g \<rparr>
                          = galois_connection \<lparr> orderA = A, orderB = B, lower = g, upper = f \<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. galois_connection \<lparr>orderA = inv_gorder B, orderB = inv_gorder A, lower = f, upper = g\<rparr> = galois_connection \<lparr>orderA = A, orderB = B, lower = g, upper = f\<rparr>
[PROOF STEP]
by (auto simp add: galois_connection_def galois_connection_axioms_def connection_def dual_order_iff)


[STATEMENT]
lemma continuous_max [continuous_intros]:
  fixes f :: "'a::t2_space \<Rightarrow> 'b::linorder_topology"
  shows "\<lbrakk>continuous F f; continuous F g\<rbrakk> \<Longrightarrow> continuous F (\<lambda>x. (max (f x) (g x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous F f; continuous F g\<rbrakk> \<Longrightarrow> continuous F (\<lambda>x. max (f x) (g x))
[PROOF STEP]
by (simp add: tendsto_max continuous_def)


[STATEMENT]
lemma sym_sum_inter_num_sq:
  assumes "b1 \<in># \<B>"
  shows "(\<Sum>bl \<in># (remove1_mset b1 \<B>). (b1 |\<inter>| bl)^2) = \<Lambda>^2 * ( \<v> - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
have dvd: "2 dvd (( \<v> - 1) * (\<Lambda> * (\<Lambda> - 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. even ((\<v> - 1) * (\<Lambda> * (\<Lambda> - 1)))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
even ((\<v> - 1) * (\<Lambda> * (\<Lambda> - 1)))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
have inner_dvd: "\<forall> bl \<in># (remove1_mset b1 \<B>). 2 dvd ((b1 |\<inter>| bl) *  ((b1 |\<inter>| bl) - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>bl\<in>#remove1_mset b1 \<B>. even (b1 |\<inter>| bl * (b1 |\<inter>| bl - 1))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<forall>bl\<in>#remove1_mset b1 \<B>. even (b1 |\<inter>| bl * (b1 |\<inter>| bl - 1))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
have diff_le: "\<And> bl . bl \<in># (remove1_mset b1 \<B>) \<Longrightarrow> (b1 |\<inter>| bl) \<le> (b1 |\<inter>| bl)^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>bl. bl \<in># remove1_mset b1 \<B> \<Longrightarrow> b1 |\<inter>| bl \<le> (b1 |\<inter>| bl)\<^sup>2
[PROOF STEP]
by (simp add: power2_nat_le_imp_le)
[PROOF STATE]
proof (state)
this:
?bl \<in># remove1_mset b1 \<B> \<Longrightarrow> b1 |\<inter>| ?bl \<le> (b1 |\<inter>| ?bl)\<^sup>2

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
have a: "(\<Sum>b2 \<in>#(\<B> - {#b1#}). ((b1 |\<inter>| b2) choose 2)) =
            (\<Sum>bl \<in># (remove1_mset b1 \<B>).  ((b1 |\<inter>| bl) *  ((b1 |\<inter>| bl) - 1)) div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>b2\<in>#remove1_mset b1 \<B>. b1 |\<inter>| b2 choose 2) = (\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1) div 2)
[PROOF STEP]
using choose_two
[PROOF STATE]
proof (prove)
using this:
?n choose 2 = ?n * (?n - 1) div 2

goal (1 subgoal):
 1. (\<Sum>b2\<in>#remove1_mset b1 \<B>. b1 |\<inter>| b2 choose 2) = (\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1) div 2)
[PROOF STEP]
by (simp add: intersection_num_non_neg)
[PROOF STATE]
proof (state)
this:
(\<Sum>b2\<in>#remove1_mset b1 \<B>. b1 |\<inter>| b2 choose 2) = (\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1) div 2)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
have b: "(\<Sum>b2 \<in>#(\<B> - {#b1#}). ((b1 |\<inter>| b2) choose 2)) =
              (\<Sum>b2 \<in>#(\<B> - {#b1#}). ((b1 |\<inter>| b2) choose 2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>b2\<in>#remove1_mset b1 \<B>. b1 |\<inter>| b2 choose 2) = (\<Sum>b2\<in>#remove1_mset b1 \<B>. b1 |\<inter>| b2 choose 2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>b2\<in>#remove1_mset b1 \<B>. b1 |\<inter>| b2 choose 2) = (\<Sum>b2\<in>#remove1_mset b1 \<B>. b1 |\<inter>| b2 choose 2)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
have gtsq: "(\<Sum>bl \<in># (remove1_mset b1 \<B>). (b1 |\<inter>| bl)^2) \<ge> (\<Sum>bl \<in># (remove1_mset b1 \<B>). (b1 |\<inter>| bl))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>)) \<le> (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2)
[PROOF STEP]
by (simp add: diff_le sum_mset_mono)
[PROOF STATE]
proof (state)
this:
\<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>)) \<le> (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
have "(\<Sum>b2 \<in>#(\<B> - {#b1#}). ((b1 |\<inter>| b2) choose 2)) = ((\<Lambda> * (\<Lambda> - 1)) div 2) * ( \<v> - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>b2\<in>#remove1_mset b1 \<B>. b1 |\<inter>| b2 choose 2) = \<Lambda> * (\<Lambda> - 1) div 2 * (\<v> - 1)
[PROOF STEP]
using sum_choose_two_inter_num assms
[PROOF STATE]
proof (prove)
using this:
?b1.0 \<in># \<B> \<Longrightarrow> (\<Sum>b2\<in>#remove1_mset ?b1.0 \<B>. ?b1.0 |\<inter>| b2 choose 2) = \<Lambda> * (\<Lambda> - 1) div 2 * (\<v> - 1)
b1 \<in># \<B>

goal (1 subgoal):
 1. (\<Sum>b2\<in>#remove1_mset b1 \<B>. b1 |\<inter>| b2 choose 2) = \<Lambda> * (\<Lambda> - 1) div 2 * (\<v> - 1)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>b2\<in>#remove1_mset b1 \<B>. b1 |\<inter>| b2 choose 2) = \<Lambda> * (\<Lambda> - 1) div 2 * (\<v> - 1)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>b2\<in>#remove1_mset b1 \<B>. b1 |\<inter>| b2 choose 2) = \<Lambda> * (\<Lambda> - 1) div 2 * (\<v> - 1)
[PROOF STEP]
have start: "(\<Sum>bl \<in># (remove1_mset b1 \<B>). ((b1 |\<inter>| bl) *  ((b1 |\<inter>| bl) - 1)) div 2)
                        = ((\<Lambda> * (\<Lambda> - 1)) div 2) * (\<v> - 1)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>b2\<in>#remove1_mset b1 \<B>. b1 |\<inter>| b2 choose 2) = \<Lambda> * (\<Lambda> - 1) div 2 * (\<v> - 1)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1) div 2) = \<Lambda> * (\<Lambda> - 1) div 2 * (\<v> - 1)
[PROOF STEP]
using a b
[PROOF STATE]
proof (prove)
using this:
(\<Sum>b2\<in>#remove1_mset b1 \<B>. b1 |\<inter>| b2 choose 2) = \<Lambda> * (\<Lambda> - 1) div 2 * (\<v> - 1)
(\<Sum>b2\<in>#remove1_mset b1 \<B>. b1 |\<inter>| b2 choose 2) = (\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1) div 2)
(\<Sum>b2\<in>#remove1_mset b1 \<B>. b1 |\<inter>| b2 choose 2) = (\<Sum>b2\<in>#remove1_mset b1 \<B>. b1 |\<inter>| b2 choose 2)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1) div 2) = \<Lambda> * (\<Lambda> - 1) div 2 * (\<v> - 1)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1) div 2) = \<Lambda> * (\<Lambda> - 1) div 2 * (\<v> - 1)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
have sum_dvd: "2 dvd (\<Sum>bl \<in># (remove1_mset b1 \<B>). (b1 |\<inter>| bl) *  ((b1 |\<inter>| bl) - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. even (\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1))
[PROOF STEP]
using sum_mset_dvd
[PROOF STATE]
proof (prove)
using this:
\<forall>m\<in>#?M. ?k dvd ?f m \<Longrightarrow> ?k dvd \<Sum>\<^sub># (image_mset ?f ?M)

goal (1 subgoal):
 1. even (\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1))
[PROOF STEP]
by (metis (no_types, lifting) dvd_mult dvd_mult2 dvd_refl odd_two_times_div_two_nat)
[PROOF STATE]
proof (state)
this:
even (\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
even (\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1))
[PROOF STEP]
have "(\<Sum>bl \<in># (remove1_mset b1 \<B>). (b1 |\<inter>| bl) * ((b1 |\<inter>| bl) - 1)) div 2
      =  ((\<Lambda> * (\<Lambda> - 1)) div 2) * (\<v> - 1)"
[PROOF STATE]
proof (prove)
using this:
even (\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1)) div 2 = \<Lambda> * (\<Lambda> - 1) div 2 * (\<v> - 1)
[PROOF STEP]
using start sum_mset_distrib_div_if_dvd inner_dvd
[PROOF STATE]
proof (prove)
using this:
even (\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1))
(\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1) div 2) = \<Lambda> * (\<Lambda> - 1) div 2 * (\<v> - 1)
\<forall>m\<in>#?M. ?k dvd ?f m \<Longrightarrow> \<Sum>\<^sub># (image_mset ?f ?M) div ?k = (\<Sum>m\<in>#?M. ?f m div ?k)
\<forall>bl\<in>#remove1_mset b1 \<B>. even (b1 |\<inter>| bl * (b1 |\<inter>| bl - 1))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1)) div 2 = \<Lambda> * (\<Lambda> - 1) div 2 * (\<v> - 1)
[PROOF STEP]
by (metis (mono_tags, lifting) image_mset_cong2)
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1)) div 2 = \<Lambda> * (\<Lambda> - 1) div 2 * (\<v> - 1)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1)) div 2 = \<Lambda> * (\<Lambda> - 1) div 2 * (\<v> - 1)
[PROOF STEP]
have "(\<Sum>bl \<in># (remove1_mset b1 \<B>). (b1 |\<inter>| bl) * ((b1 |\<inter>| bl) - 1)) div 2
      =  (\<v> - 1) * ((\<Lambda> * (\<Lambda> - 1)) div 2)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1)) div 2 = \<Lambda> * (\<Lambda> - 1) div 2 * (\<v> - 1)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1)) div 2 = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1) div 2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1)) div 2 = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1) div 2)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1)) div 2 = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1) div 2)
[PROOF STEP]
have "(\<Sum>bl \<in># (remove1_mset b1 \<B>). (b1 |\<inter>| bl) * ((b1 |\<inter>| bl) - 1))
      =  (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1)) div 2 = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1) div 2)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1)) = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))
[PROOF STEP]
by (metis (no_types, lifting) div_mult_swap dvdI dvd_div_eq_iff dvd_mult dvd_mult2 odd_two_times_div_two_nat sum_dvd)
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1)) = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1)) = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))
[PROOF STEP]
have "(\<Sum>bl \<in># (remove1_mset b1 \<B>). (b1 |\<inter>| bl)^2 - (b1 |\<inter>| bl))
      =  (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1)) = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2 - b1 |\<inter>| bl) = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))
[PROOF STEP]
using diff_mult_distrib2
[PROOF STATE]
proof (prove)
using this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. b1 |\<inter>| bl * (b1 |\<inter>| bl - 1)) = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))
?k * (?m - ?n) = ?k * ?m - ?k * ?n

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2 - b1 |\<inter>| bl) = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))
[PROOF STEP]
by (metis (no_types, lifting) multiset.map_cong0 nat_mult_1_right power2_eq_square)
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2 - b1 |\<inter>| bl) = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2 - b1 |\<inter>| bl) = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))
[PROOF STEP]
have "(\<Sum>bl \<in># (remove1_mset b1 \<B>). (b1 |\<inter>| bl)^2)
      - (\<Sum>bl \<in># (remove1_mset b1 \<B>). (b1 |\<inter>| bl)) = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2 - b1 |\<inter>| bl) = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) - \<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>)) = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))
[PROOF STEP]
using sum_mset_add_diff_nat[of "(remove1_mset b1 \<B>)" "\<lambda> bl . (b1 |\<inter>| bl)" "\<lambda> bl . (b1 |\<inter>| bl)^2"]
      diff_le
[PROOF STATE]
proof (prove)
using this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2 - b1 |\<inter>| bl) = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))
(\<And>x. x \<in># remove1_mset b1 \<B> \<Longrightarrow> b1 |\<inter>| x \<le> (b1 |\<inter>| x)\<^sup>2) \<Longrightarrow> (\<Sum>x\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| x)\<^sup>2 - b1 |\<inter>| x) = (\<Sum>x\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| x)\<^sup>2) - \<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>))
?bl \<in># remove1_mset b1 \<B> \<Longrightarrow> b1 |\<inter>| ?bl \<le> (b1 |\<inter>| ?bl)\<^sup>2

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) - \<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>)) = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) - \<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>)) = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) - \<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>)) = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))
[PROOF STEP]
have "(\<Sum>bl \<in># (remove1_mset b1 \<B>). (b1 |\<inter>| bl)^2)
      = (\<Sum>bl \<in># (remove1_mset b1 \<B>). (b1 |\<inter>| bl)) + (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) - \<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>)) = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>)) + (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))
[PROOF STEP]
using gtsq
[PROOF STATE]
proof (prove)
using this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) - \<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>)) = (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))
\<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>)) \<le> (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>)) + (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))
[PROOF STEP]
by (metis le_add_diff_inverse)
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>)) + (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>)) + (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))
[PROOF STEP]
have "(\<Sum>bl \<in># (remove1_mset b1 \<B>). (b1 |\<inter>| bl)^2) =  (\<Lambda> * (\<v> - 1)) + ((\<v> - 1) * (\<Lambda> * (\<Lambda> - 1)))"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>)) + (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda> * (\<v> - 1) + (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))
[PROOF STEP]
using sym_sum_inter_num assms rep_value_sym symmetric_condition_2
[PROOF STATE]
proof (prove)
using this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Sum>\<^sub># (image_mset ((|\<inter>|) b1) (remove1_mset b1 \<B>)) + (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))
?b1.0 \<in># \<B> \<Longrightarrow> \<Sum>\<^sub># (image_mset ((|\<inter>|) ?b1.0) (remove1_mset ?b1.0 \<B>)) = \<k> * (\<r> - 1)
b1 \<in># \<B>
\<r> = \<k>
\<Lambda> * (\<v> - 1) = \<k> * (\<k> - 1)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda> * (\<v> - 1) + (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda> * (\<v> - 1) + (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda> * (\<v> - 1) + (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))
[PROOF STEP]
have prev: "(\<Sum>bl \<in># (remove1_mset b1 \<B>). (b1 |\<inter>| bl)^2) = (\<Lambda> * (\<v> - 1)) * (\<Lambda> - 1) + (\<Lambda> * (\<v> - 1))"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda> * (\<v> - 1) + (\<v> - 1) * (\<Lambda> * (\<Lambda> - 1))

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda> * (\<v> - 1) * (\<Lambda> - 1) + \<Lambda> * (\<v> - 1)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda> * (\<v> - 1) * (\<Lambda> - 1) + \<Lambda> * (\<v> - 1)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda> * (\<v> - 1) * (\<Lambda> - 1) + \<Lambda> * (\<v> - 1)
[PROOF STEP]
have "(\<Sum>bl \<in># (remove1_mset b1 \<B>). (b1 |\<inter>| bl)^2) = (\<Lambda> * (\<v> - 1)) * (\<Lambda>)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda> * (\<v> - 1) * (\<Lambda> - 1) + \<Lambda> * (\<v> - 1)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda> * (\<v> - 1) * \<Lambda>
[PROOF STEP]
by (metis Nat.le_imp_diff_is_add add_mult_distrib2 index_not_zero nat_mult_1_right)
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda> * (\<v> - 1) * \<Lambda>

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda> * (\<v> - 1) * \<Lambda>
[PROOF STEP]
have "(\<Sum>bl \<in># (remove1_mset b1 \<B>). (b1 |\<inter>| bl)^2) = \<Lambda> * \<Lambda> * (\<v> - 1)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda> * (\<v> - 1) * \<Lambda>

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda> * \<Lambda> * (\<v> - 1)
[PROOF STEP]
using mult.commute
[PROOF STATE]
proof (prove)
using this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda> * (\<v> - 1) * \<Lambda>
?a * ?b = ?b * ?a

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda> * \<Lambda> * (\<v> - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda> * \<Lambda> * (\<v> - 1)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda> * \<Lambda> * (\<v> - 1)

goal (1 subgoal):
 1. (\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
(\<Sum>bl\<in>#remove1_mset b1 \<B>. (b1 |\<inter>| bl)\<^sup>2) = \<Lambda>\<^sup>2 * (\<v> - 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linear_imp_differentiable_on:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector"
  shows "linear f \<Longrightarrow> f differentiable_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear f \<Longrightarrow> f differentiable_on S
[PROOF STEP]
by (simp add: differentiable_on_def linear_imp_differentiable)


[STATEMENT]
lemma covariance_eq:
  fixes f :: "'a \<Rightarrow> real"
  assumes "f \<in> borel_measurable M" "g \<in> borel_measurable M"
  assumes "integrable M (\<lambda>\<omega>. f \<omega>^2)" "integrable M (\<lambda>\<omega>. g \<omega>^2)"
  shows "covariance f g = expectation (\<lambda>\<omega>. f \<omega> * g \<omega>) - expectation f * expectation g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. covariance f g = expectation (\<lambda>\<omega>. f \<omega> * g \<omega>) - expectation f * expectation g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. covariance f g = expectation (\<lambda>\<omega>. f \<omega> * g \<omega>) - expectation f * expectation g
[PROOF STEP]
have "integrable M f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M f
[PROOF STEP]
using square_integrable_imp_integrable assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>random_variable borel ?f; integrable M (\<lambda>x. (?f x)\<^sup>2)\<rbrakk> \<Longrightarrow> integrable M ?f
random_variable borel f
random_variable borel g
integrable M (\<lambda>\<omega>. (f \<omega>)\<^sup>2)
integrable M (\<lambda>\<omega>. (g \<omega>)\<^sup>2)

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

goal (1 subgoal):
 1. covariance f g = expectation (\<lambda>\<omega>. f \<omega> * g \<omega>) - expectation f * expectation g
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
integrable M f

goal (1 subgoal):
 1. covariance f g = expectation (\<lambda>\<omega>. f \<omega> * g \<omega>) - expectation f * expectation g
[PROOF STEP]
have "integrable M g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M g
[PROOF STEP]
using square_integrable_imp_integrable assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>random_variable borel ?f; integrable M (\<lambda>x. (?f x)\<^sup>2)\<rbrakk> \<Longrightarrow> integrable M ?f
random_variable borel f
random_variable borel g
integrable M (\<lambda>\<omega>. (f \<omega>)\<^sup>2)
integrable M (\<lambda>\<omega>. (g \<omega>)\<^sup>2)

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

goal (1 subgoal):
 1. covariance f g = expectation (\<lambda>\<omega>. f \<omega> * g \<omega>) - expectation f * expectation g
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
integrable M f
integrable M g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integrable M f
integrable M g

goal (1 subgoal):
 1. covariance f g = expectation (\<lambda>\<omega>. f \<omega> * g \<omega>) - expectation f * expectation g
[PROOF STEP]
using assms real_prod_integrable
[PROOF STATE]
proof (prove)
using this:
integrable M f
integrable M g
random_variable borel f
random_variable borel g
integrable M (\<lambda>\<omega>. (f \<omega>)\<^sup>2)
integrable M (\<lambda>\<omega>. (g \<omega>)\<^sup>2)
\<lbrakk>random_variable borel ?f; random_variable borel ?g; integrable M (\<lambda>\<omega>. (?f \<omega>)\<^sup>2); integrable M (\<lambda>\<omega>. (?g \<omega>)\<^sup>2)\<rbrakk> \<Longrightarrow> integrable M (\<lambda>\<omega>. ?f \<omega> * ?g \<omega>)

goal (1 subgoal):
 1. covariance f g = expectation (\<lambda>\<omega>. f \<omega> * g \<omega>) - expectation f * expectation g
[PROOF STEP]
by (simp add:covariance_def algebra_simps prob_space)
[PROOF STATE]
proof (state)
this:
covariance f g = expectation (\<lambda>\<omega>. f \<omega> * g \<omega>) - expectation f * expectation g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma keys_ins: "keys (ins k p t) = Set.insert k (keys t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. keys (ins k p t) = insert k (keys t)
[PROOF STEP]
proof (induction t rule: ins.induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>k p. keys (ins k p \<langle>\<rangle>) = insert k (keys \<langle>\<rangle>)
 2. \<And>k p l k1 p1 r. \<lbrakk>k < k1 \<Longrightarrow> keys (ins k p l) = insert k (keys l); \<lbrakk>\<not> k < k1; k1 < k\<rbrakk> \<Longrightarrow> keys (ins k p r) = insert k (keys r)\<rbrakk> \<Longrightarrow> keys (ins k p \<langle>l, (k1, p1), r\<rangle>) = insert k (keys \<langle>l, (k1, p1), r\<rangle>)
[PROOF STEP]
case 2
[PROOF STATE]
proof (state)
this:
k_ < k1_ \<Longrightarrow> keys (ins k_ p_ l_) = insert k_ (keys l_)
\<lbrakk>\<not> k_ < k1_; k1_ < k_\<rbrakk> \<Longrightarrow> keys (ins k_ p_ r_) = insert k_ (keys r_)

goal (2 subgoals):
 1. \<And>k p. keys (ins k p \<langle>\<rangle>) = insert k (keys \<langle>\<rangle>)
 2. \<And>k p l k1 p1 r. \<lbrakk>k < k1 \<Longrightarrow> keys (ins k p l) = insert k (keys l); \<lbrakk>\<not> k < k1; k1 < k\<rbrakk> \<Longrightarrow> keys (ins k p r) = insert k (keys r)\<rbrakk> \<Longrightarrow> keys (ins k p \<langle>l, (k1, p1), r\<rangle>) = insert k (keys \<langle>l, (k1, p1), r\<rangle>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k_ < k1_ \<Longrightarrow> keys (ins k_ p_ l_) = insert k_ (keys l_)
\<lbrakk>\<not> k_ < k1_; k1_ < k_\<rbrakk> \<Longrightarrow> keys (ins k_ p_ r_) = insert k_ (keys r_)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
k_ < k1_ \<Longrightarrow> keys (ins k_ p_ l_) = insert k_ (keys l_)
\<lbrakk>\<not> k_ < k1_; k1_ < k_\<rbrakk> \<Longrightarrow> keys (ins k_ p_ r_) = insert k_ (keys r_)

goal (1 subgoal):
 1. keys (ins k_ p_ \<langle>l_, (k1_, p1_), r_\<rangle>) = insert k_ (keys \<langle>l_, (k1_, p1_), r_\<rangle>)
[PROOF STEP]
by (simp add: ins_neq_Leaf split: tree.split prod.split) (safe; fastforce)
[PROOF STATE]
proof (state)
this:
keys (ins k_ p_ \<langle>l_, (k1_, p1_), r_\<rangle>) = insert k_ (keys \<langle>l_, (k1_, p1_), r_\<rangle>)

goal (1 subgoal):
 1. \<And>k p. keys (ins k p \<langle>\<rangle>) = insert k (keys \<langle>\<rangle>)
[PROOF STEP]
qed (simp)


[STATEMENT]
lemma mat_entry_explicit:
  fixes M :: "'a::field mat"
  assumes "M \<in> carrier_mat m n" and "i < m" and "j < n"
  shows   "vec_index (M *\<^sub>v unit_vec n j) i = M $$ (i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M *\<^sub>v unit_vec n j) $ i = M $$ (i, j)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
M \<in> carrier_mat m n
i < m
j < n

goal (1 subgoal):
 1. (M *\<^sub>v unit_vec n j) $ i = M $$ (i, j)
[PROOF STEP]
by auto


[STATEMENT]
lemma subspace_neg: "subspace S \<Longrightarrow> x \<in> S \<Longrightarrow> - x \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>subspace S; x \<in> S\<rbrakk> \<Longrightarrow> - x \<in> S
[PROOF STEP]
by (metis scale_minus_left scale_one subspace_scale)


[STATEMENT]
theorem sorted_sort_key [simp]: "sorted (map f (sort_key f xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (map f (sort_key f xs))
[PROOF STEP]
by (induct xs) (auto simp:sorted_insort_key)


[STATEMENT]
lemma eval_term_cong: "(\<And>n. n \<in> fv_term_set t \<Longrightarrow> \<sigma> n = \<sigma>' n) \<Longrightarrow>
  eval_term \<sigma> t = eval_term \<sigma>' t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. n \<in> fv_term_set t \<Longrightarrow> \<sigma> n = \<sigma>' n) \<Longrightarrow> \<sigma> \<cdot> t = \<sigma>' \<cdot> t
[PROOF STEP]
by (cases t) auto


[STATEMENT]
lemma nonempty_subseteq_mset_iff_singleton: "(M \<noteq> {#} \<and> M \<subseteq># {#x#} \<and> P) \<longleftrightarrow> M = {#x#} \<and> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M \<noteq> {#} \<and> M \<subseteq># {#x#} \<and> P) = (M = {#x#} \<and> P)
[PROOF STEP]
by (cases M) (auto dest: subset_mset.diff_add)


[STATEMENT]
lemma tendsto_zero_ennreal:
  assumes ev: "\<And>r. 0 < r \<Longrightarrow> \<forall>\<^sub>F x in F. f x < ennreal r"
  shows "(f \<longlongrightarrow> 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> 0) F
[PROOF STEP]
proof (rule order_tendstoI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. a < 0 \<Longrightarrow> \<forall>\<^sub>F x in F. a < f x
 2. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in F. f x < a
[PROOF STEP]
fix e::ennreal
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. a < 0 \<Longrightarrow> \<forall>\<^sub>F x in F. a < f x
 2. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in F. f x < a
[PROOF STEP]
assume "e > 0"
[PROOF STATE]
proof (state)
this:
0 < e

goal (2 subgoals):
 1. \<And>a. a < 0 \<Longrightarrow> \<forall>\<^sub>F x in F. a < f x
 2. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in F. f x < a
[PROOF STEP]
obtain e'::real where "e' > 0" "ennreal e' < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>e'. \<lbrakk>0 < e'; ennreal e' < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>0 < e\<close> dense[of 0 "if e = top then 1 else (enn2real e)"]
[PROOF STATE]
proof (prove)
using this:
0 < e
0 < (if e = top then 1 else enn2real e) \<Longrightarrow> \<exists>z>0. z < (if e = top then 1 else enn2real e)

goal (1 subgoal):
 1. (\<And>e'. \<lbrakk>0 < e'; ennreal e' < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases e) (auto simp: ennreal_less_iff)
[PROOF STATE]
proof (state)
this:
0 < e'
ennreal e' < e

goal (2 subgoals):
 1. \<And>a. a < 0 \<Longrightarrow> \<forall>\<^sub>F x in F. a < f x
 2. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in F. f x < a
[PROOF STEP]
from ev[OF \<open>e' > 0\<close>]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. f x < ennreal e'
[PROOF STEP]
show "\<forall>\<^sub>F x in F. f x < e"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. f x < ennreal e'

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f x < e
[PROOF STEP]
by eventually_elim (insert \<open>ennreal e' < e\<close>, auto)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. f x < e

goal (1 subgoal):
 1. \<And>a. a < 0 \<Longrightarrow> \<forall>\<^sub>F x in F. a < f x
[PROOF STEP]
qed simp


[STATEMENT]
lemma (in Module) monofun_eq_f:"\<lbrakk>R module N; h \<in> H; free_generator R M H;
       f \<in> H \<rightarrow> carrier N\<rbrakk>  \<Longrightarrow>  monofun R M N f H h h = f h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; h \<in> H; free_generator R M H; f \<in> H \<rightarrow> carrier N\<rbrakk> \<Longrightarrow> monofun R M N f H h h = f h
[PROOF STEP]
apply (cut_tac sc_Ring)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; h \<in> H; free_generator R M H; f \<in> H \<rightarrow> carrier N; Ring R\<rbrakk> \<Longrightarrow> monofun R M N f H h h = f h
[PROOF STEP]
apply (frule_tac N = N and h = h and f = f and a = "1\<^sub>r\<^bsub>R\<^esub>" in  monofun_mhomTr1,
        assumption+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>R module N; h \<in> H; free_generator R M H; f \<in> H \<rightarrow> carrier N; Ring R\<rbrakk> \<Longrightarrow> 1\<^sub>r\<^bsub>R\<^esub> \<in> carrier R
 2. \<lbrakk>R module N; h \<in> H; free_generator R M H; f \<in> H \<rightarrow> carrier N; Ring R; monofun R M N f H h (1\<^sub>r\<^bsub>R\<^esub> \<cdot>\<^sub>s h) = 1\<^sub>r\<^bsub>R\<^esub> \<cdot>\<^sub>s\<^bsub>N\<^esub> f h\<rbrakk> \<Longrightarrow> monofun R M N f H h h = f h
[PROOF STEP]
apply (simp add:Ring.ring_one)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; h \<in> H; free_generator R M H; f \<in> H \<rightarrow> carrier N; Ring R; monofun R M N f H h (1\<^sub>r\<^bsub>R\<^esub> \<cdot>\<^sub>s h) = 1\<^sub>r\<^bsub>R\<^esub> \<cdot>\<^sub>s\<^bsub>N\<^esub> f h\<rbrakk> \<Longrightarrow> monofun R M N f H h h = f h
[PROOF STEP]
apply (frule free_generator_sub, frule subsetD[of H "carrier M" h],
                           assumption+,
        frule funcset_mem[of f H "carrier N" h], assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module N; h \<in> H; free_generator R M H; f \<in> H \<rightarrow> carrier N; Ring R; monofun R M N f H h (1\<^sub>r\<^bsub>R\<^esub> \<cdot>\<^sub>s h) = 1\<^sub>r\<^bsub>R\<^esub> \<cdot>\<^sub>s\<^bsub>N\<^esub> f h; H \<subseteq> carrier M; h \<in> carrier M; f h \<in> carrier N\<rbrakk> \<Longrightarrow> monofun R M N f H h h = f h
[PROOF STEP]
apply (simp add:sprod_one, simp add:Module.sprod_one)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma bra_mat_on_vec:
  fixes v::"complex vec" and A::"complex mat"
  assumes "dim_col A = dim_vec v"
  shows "\<langle>A * v| = \<langle>v| * (A\<^sup>\<dagger>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>A * |v\<rangle>| = \<langle>|v\<rangle>| * A\<^sup>\<dagger>
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>); j < dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)\<rbrakk> \<Longrightarrow> \<langle>A * |v\<rangle>| $$ (i, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (i, j)
 2. dim_row \<langle>A * |v\<rangle>| = dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)
 3. dim_col \<langle>A * |v\<rangle>| = dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)
[PROOF STEP]
show "dim_row \<langle>A * v| = dim_row (\<langle>v| * (A\<^sup>\<dagger>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row \<langle>A * |v\<rangle>| = dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)
[PROOF STEP]
by (simp add: bra_def times_mat_def)
[PROOF STATE]
proof (state)
this:
dim_row \<langle>A * |v\<rangle>| = dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>); j < dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)\<rbrakk> \<Longrightarrow> \<langle>A * |v\<rangle>| $$ (i, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (i, j)
 2. dim_col \<langle>A * |v\<rangle>| = dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>); j < dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)\<rbrakk> \<Longrightarrow> \<langle>A * |v\<rangle>| $$ (i, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (i, j)
 2. dim_col \<langle>A * |v\<rangle>| = dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)
[PROOF STEP]
show "dim_col \<langle>A * v| = dim_col (\<langle>v| * (A\<^sup>\<dagger>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col \<langle>A * |v\<rangle>| = dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)
[PROOF STEP]
by (simp add: bra_def times_mat_def)
[PROOF STATE]
proof (state)
this:
dim_col \<langle>A * |v\<rangle>| = dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>); j < dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)\<rbrakk> \<Longrightarrow> \<langle>A * |v\<rangle>| $$ (i, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (i, j)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>); j < dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)\<rbrakk> \<Longrightarrow> \<langle>A * |v\<rangle>| $$ (i, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (i, j)
[PROOF STEP]
fix i j::nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>); j < dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)\<rbrakk> \<Longrightarrow> \<langle>A * |v\<rangle>| $$ (i, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (i, j)
[PROOF STEP]
assume a1:"i < dim_row (\<langle>v| * (A\<^sup>\<dagger>))" and a2:"j < dim_col (\<langle>v| * (A\<^sup>\<dagger>))"
[PROOF STATE]
proof (state)
this:
i < dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)
j < dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>); j < dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)\<rbrakk> \<Longrightarrow> \<langle>A * |v\<rangle>| $$ (i, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)
j < dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)
[PROOF STEP]
have "cnj((A * v) $$ (j,0)) = cnj (row A j \<bullet> v)"
[PROOF STATE]
proof (prove)
using this:
i < dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)
j < dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)

goal (1 subgoal):
 1. cnj ((A * |v\<rangle>) $$ (j, 0)) = cnj (row A j \<bullet> v)
[PROOF STEP]
using bra_def times_mat_def ket_vec_col ket_vec_def
[PROOF STATE]
proof (prove)
using this:
i < dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)
j < dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)
\<langle>?v| \<equiv> mat 1 (dim_row ?v) (\<lambda>(i, j). cnj (?v $$ (j, i)))
?A * ?B \<equiv> mat (dim_row ?A) (dim_col ?B) (\<lambda>(i, j). row ?A i \<bullet> col ?B j)
col |?v\<rangle> 0 = ?v
|?v\<rangle> \<equiv> mat (dim_vec ?v) 1 (\<lambda>(i, j). ?v $ i)

goal (1 subgoal):
 1. cnj ((A * |v\<rangle>) $$ (j, 0)) = cnj (row A j \<bullet> v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cnj ((A * |v\<rangle>) $$ (j, 0)) = cnj (row A j \<bullet> v)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>); j < dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)\<rbrakk> \<Longrightarrow> \<langle>A * |v\<rangle>| $$ (i, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cnj ((A * |v\<rangle>) $$ (j, 0)) = cnj (row A j \<bullet> v)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>); j < dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)\<rbrakk> \<Longrightarrow> \<langle>A * |v\<rangle>| $$ (i, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (i, j)
[PROOF STEP]
have f7:"\<dots>= (\<Sum>i\<in>{0 ..< dim_vec v}. cnj(v $ i) * cnj(A $$ (j,i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj (row A j \<bullet> v) = (\<Sum>i = 0..<dim_vec v. cnj (v $ i) * cnj (A $$ (j, i)))
[PROOF STEP]
using row_def scalar_prod_def cnj_sum complex_cnj_mult mult.commute
[PROOF STATE]
proof (prove)
using this:
row ?A ?i = vec (dim_col ?A) (\<lambda>j. ?A $$ (?i, j))
?v \<bullet> ?w \<equiv> \<Sum>i = 0..<dim_vec ?w. ?v $ i * ?w $ i
cnj (sum ?f ?s) = (\<Sum>x\<in>?s. cnj (?f x))
cnj (?x * ?y) = cnj ?x * cnj ?y
?a * ?b = ?b * ?a

goal (1 subgoal):
 1. cnj (row A j \<bullet> v) = (\<Sum>i = 0..<dim_vec v. cnj (v $ i) * cnj (A $$ (j, i)))
[PROOF STEP]
by (smt assms index_vec lessThan_atLeast0 lessThan_iff sum.cong)
[PROOF STATE]
proof (state)
this:
cnj (row A j \<bullet> v) = (\<Sum>i = 0..<dim_vec v. cnj (v $ i) * cnj (A $$ (j, i)))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>); j < dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)\<rbrakk> \<Longrightarrow> \<langle>A * |v\<rangle>| $$ (i, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (i, j)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
cnj (row A j \<bullet> v) = (\<Sum>i = 0..<dim_vec v. cnj (v $ i) * cnj (A $$ (j, i)))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>); j < dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)\<rbrakk> \<Longrightarrow> \<langle>A * |v\<rangle>| $$ (i, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (i, j)
[PROOF STEP]
have f8:"(row \<langle>v| 0) \<bullet> (col (A\<^sup>\<dagger>) j) =
    vec (dim_vec v) (\<lambda>i. cnj (v $ i)) \<bullet> vec (dim_col A) (\<lambda>i. cnj (A $$ (j,i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row \<langle>|v\<rangle>| 0 \<bullet> col A\<^sup>\<dagger> j = vec (dim_vec v) (\<lambda>i. cnj (v $ i)) \<bullet> vec (dim_col A) (\<lambda>i. cnj (A $$ (j, i)))
[PROOF STEP]
using a2
[PROOF STATE]
proof (prove)
using this:
j < dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)

goal (1 subgoal):
 1. row \<langle>|v\<rangle>| 0 \<bullet> col A\<^sup>\<dagger> j = vec (dim_vec v) (\<lambda>i. cnj (v $ i)) \<bullet> vec (dim_col A) (\<lambda>i. cnj (A $$ (j, i)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
row \<langle>|v\<rangle>| 0 \<bullet> col A\<^sup>\<dagger> j = vec (dim_vec v) (\<lambda>i. cnj (v $ i)) \<bullet> vec (dim_col A) (\<lambda>i. cnj (A $$ (j, i)))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>); j < dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)\<rbrakk> \<Longrightarrow> \<langle>A * |v\<rangle>| $$ (i, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (i, j)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
cnj ((A * |v\<rangle>) $$ (j, 0)) = cnj (row A j \<bullet> v)
cnj (row A j \<bullet> v) = (\<Sum>i = 0..<dim_vec v. cnj (v $ i) * cnj (A $$ (j, i)))
row \<langle>|v\<rangle>| 0 \<bullet> col A\<^sup>\<dagger> j = vec (dim_vec v) (\<lambda>i. cnj (v $ i)) \<bullet> vec (dim_col A) (\<lambda>i. cnj (A $$ (j, i)))
[PROOF STEP]
have "cnj((A * v) $$ (j,0)) = (row \<langle>v| 0) \<bullet> (col (A\<^sup>\<dagger>) j)"
[PROOF STATE]
proof (prove)
using this:
cnj ((A * |v\<rangle>) $$ (j, 0)) = cnj (row A j \<bullet> v)
cnj (row A j \<bullet> v) = (\<Sum>i = 0..<dim_vec v. cnj (v $ i) * cnj (A $$ (j, i)))
row \<langle>|v\<rangle>| 0 \<bullet> col A\<^sup>\<dagger> j = vec (dim_vec v) (\<lambda>i. cnj (v $ i)) \<bullet> vec (dim_col A) (\<lambda>i. cnj (A $$ (j, i)))

goal (1 subgoal):
 1. cnj ((A * |v\<rangle>) $$ (j, 0)) = row \<langle>|v\<rangle>| 0 \<bullet> col A\<^sup>\<dagger> j
[PROOF STEP]
using assms scalar_prod_def
[PROOF STATE]
proof (prove)
using this:
cnj ((A * |v\<rangle>) $$ (j, 0)) = cnj (row A j \<bullet> v)
cnj (row A j \<bullet> v) = (\<Sum>i = 0..<dim_vec v. cnj (v $ i) * cnj (A $$ (j, i)))
row \<langle>|v\<rangle>| 0 \<bullet> col A\<^sup>\<dagger> j = vec (dim_vec v) (\<lambda>i. cnj (v $ i)) \<bullet> vec (dim_col A) (\<lambda>i. cnj (A $$ (j, i)))
dim_col A = dim_vec v
?v \<bullet> ?w \<equiv> \<Sum>i = 0..<dim_vec ?w. ?v $ i * ?w $ i

goal (1 subgoal):
 1. cnj ((A * |v\<rangle>) $$ (j, 0)) = row \<langle>|v\<rangle>| 0 \<bullet> col A\<^sup>\<dagger> j
[PROOF STEP]
by (smt dim_vec index_vec lessThan_atLeast0 lessThan_iff sum.cong)
[PROOF STATE]
proof (state)
this:
cnj ((A * |v\<rangle>) $$ (j, 0)) = row \<langle>|v\<rangle>| 0 \<bullet> col A\<^sup>\<dagger> j

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>); j < dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)\<rbrakk> \<Longrightarrow> \<langle>A * |v\<rangle>| $$ (i, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cnj ((A * |v\<rangle>) $$ (j, 0)) = row \<langle>|v\<rangle>| 0 \<bullet> col A\<^sup>\<dagger> j
[PROOF STEP]
have "\<langle>A * v| $$ (0,j) = (\<langle>v| * (A\<^sup>\<dagger>)) $$ (0,j)"
[PROOF STATE]
proof (prove)
using this:
cnj ((A * |v\<rangle>) $$ (j, 0)) = row \<langle>|v\<rangle>| 0 \<bullet> col A\<^sup>\<dagger> j

goal (1 subgoal):
 1. \<langle>A * |v\<rangle>| $$ (0, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (0, j)
[PROOF STEP]
using bra_def times_mat_def a2
[PROOF STATE]
proof (prove)
using this:
cnj ((A * |v\<rangle>) $$ (j, 0)) = row \<langle>|v\<rangle>| 0 \<bullet> col A\<^sup>\<dagger> j
\<langle>?v| \<equiv> mat 1 (dim_row ?v) (\<lambda>(i, j). cnj (?v $$ (j, i)))
?A * ?B \<equiv> mat (dim_row ?A) (dim_col ?B) (\<lambda>(i, j). row ?A i \<bullet> col ?B j)
j < dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)

goal (1 subgoal):
 1. \<langle>A * |v\<rangle>| $$ (0, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (0, j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<langle>A * |v\<rangle>| $$ (0, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (0, j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>); j < dim_col (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)\<rbrakk> \<Longrightarrow> \<langle>A * |v\<rangle>| $$ (i, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (i, j)
[PROOF STEP]
thus "\<langle>A * |v\<rangle>| $$ (i, j) = (\<langle>v| * (A\<^sup>\<dagger>)) $$ (i, j)"
[PROOF STATE]
proof (prove)
using this:
\<langle>A * |v\<rangle>| $$ (0, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (0, j)

goal (1 subgoal):
 1. \<langle>A * |v\<rangle>| $$ (i, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (i, j)
[PROOF STEP]
using a1
[PROOF STATE]
proof (prove)
using this:
\<langle>A * |v\<rangle>| $$ (0, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (0, j)
i < dim_row (\<langle>|v\<rangle>| * A\<^sup>\<dagger>)

goal (1 subgoal):
 1. \<langle>A * |v\<rangle>| $$ (i, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (i, j)
[PROOF STEP]
by (simp add: times_mat_def bra_def)
[PROOF STATE]
proof (state)
this:
\<langle>A * |v\<rangle>| $$ (i, j) = (\<langle>|v\<rangle>| * A\<^sup>\<dagger>) $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma natLeq_on_ordLess_natLeq: "natLeq_on n <o natLeq"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. natLeq_on n <o natLeq
[PROOF STEP]
using Field_natLeq Field_natLeq_on[of n]
      finite_ordLess_infinite[of "natLeq_on n" natLeq]
      natLeq_Well_order natLeq_on_Well_order[of n]
[PROOF STATE]
proof (prove)
using this:
Field natLeq = UNIV
Field (natLeq_on n) = {x. x < n}
\<lbrakk>Well_order (natLeq_on n); Well_order natLeq; finite (Field (natLeq_on n)); infinite (Field natLeq)\<rbrakk> \<Longrightarrow> natLeq_on n <o natLeq
Well_order natLeq
Well_order (natLeq_on n)

goal (1 subgoal):
 1. natLeq_on n <o natLeq
[PROOF STEP]
by auto


[STATEMENT]
lemma L_split_contraction:
  assumes "d \<in> D\<^sub>D"
  shows "dist (L_split d v) (L_split d u) \<le> QR_disc * dist v u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (L_split d v) (L_split d u) \<le> QR_disc * dist v u
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dist (L_split d v) (L_split d u) \<le> QR_disc * dist v u
[PROOF STEP]
have aux: "L_split d v s - L_split d u s \<le> QR_disc * dist v u" if lea: "(L_split d u s) \<le> (L_split d v s)" for v s u
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. apply_bfun (L_split d v) s - apply_bfun (L_split d u) s \<le> QR_disc * dist v u
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. apply_bfun (L_split d v) s - apply_bfun (L_split d u) s \<le> QR_disc * dist v u
[PROOF STEP]
have "L_split d v s - L_split d u s = (inv\<^sub>L (Q d) o\<^sub>L (R d)) (v - u) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. apply_bfun (L_split d v) s - apply_bfun (L_split d u) s = apply_bfun (blinfun_apply (inv\<^sub>L (Q d) o\<^sub>L R d) (v - u)) s
[PROOF STEP]
by (auto simp: blinfun.bilinear_simps)
[PROOF STATE]
proof (state)
this:
apply_bfun (L_split d v) s - apply_bfun (L_split d u) s = apply_bfun (blinfun_apply (inv\<^sub>L (Q d) o\<^sub>L R d) (v - u)) s

goal (1 subgoal):
 1. apply_bfun (L_split d v) s - apply_bfun (L_split d u) s \<le> QR_disc * dist v u
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
apply_bfun (L_split d v) s - apply_bfun (L_split d u) s = apply_bfun (blinfun_apply (inv\<^sub>L (Q d) o\<^sub>L R d) (v - u)) s

goal (1 subgoal):
 1. apply_bfun (L_split d v) s - apply_bfun (L_split d u) s \<le> QR_disc * dist v u
[PROOF STEP]
have "\<dots> \<le> norm ((inv\<^sub>L (Q d) o\<^sub>L (R d)) (v - u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. apply_bfun (blinfun_apply (inv\<^sub>L (Q d) o\<^sub>L R d) (v - u)) s \<le> norm (blinfun_apply (inv\<^sub>L (Q d) o\<^sub>L R d) (v - u))
[PROOF STEP]
by (simp add: le_norm_bfun)
[PROOF STATE]
proof (state)
this:
apply_bfun (blinfun_apply (inv\<^sub>L (Q d) o\<^sub>L R d) (v - u)) s \<le> norm (blinfun_apply (inv\<^sub>L (Q d) o\<^sub>L R d) (v - u))

goal (1 subgoal):
 1. apply_bfun (L_split d v) s - apply_bfun (L_split d u) s \<le> QR_disc * dist v u
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
apply_bfun (blinfun_apply (inv\<^sub>L (Q d) o\<^sub>L R d) (v - u)) s \<le> norm (blinfun_apply (inv\<^sub>L (Q d) o\<^sub>L R d) (v - u))

goal (1 subgoal):
 1. apply_bfun (L_split d v) s - apply_bfun (L_split d u) s \<le> QR_disc * dist v u
[PROOF STEP]
have "\<dots> \<le> norm ((inv\<^sub>L (Q d) o\<^sub>L (R d))) * dist v u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (blinfun_apply (inv\<^sub>L (Q d) o\<^sub>L R d) (v - u)) \<le> norm (inv\<^sub>L (Q d) o\<^sub>L R d) * dist v u
[PROOF STEP]
by (auto simp only: dist_norm norm_blinfun)
[PROOF STATE]
proof (state)
this:
norm (blinfun_apply (inv\<^sub>L (Q d) o\<^sub>L R d) (v - u)) \<le> norm (inv\<^sub>L (Q d) o\<^sub>L R d) * dist v u

goal (1 subgoal):
 1. apply_bfun (L_split d v) s - apply_bfun (L_split d u) s \<le> QR_disc * dist v u
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (blinfun_apply (inv\<^sub>L (Q d) o\<^sub>L R d) (v - u)) \<le> norm (inv\<^sub>L (Q d) o\<^sub>L R d) * dist v u

goal (1 subgoal):
 1. apply_bfun (L_split d v) s - apply_bfun (L_split d u) s \<le> QR_disc * dist v u
[PROOF STEP]
have "\<dots> \<le> QR_disc * dist v u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (inv\<^sub>L (Q d) o\<^sub>L R d) * dist v u \<le> QR_disc * dist v u
[PROOF STEP]
using assms QR_le_QR_disc
[PROOF STATE]
proof (prove)
using this:
d \<in> D\<^sub>D
?d \<in> D\<^sub>D \<Longrightarrow> norm (inv\<^sub>L (Q ?d) o\<^sub>L R ?d) \<le> QR_disc

goal (1 subgoal):
 1. norm (inv\<^sub>L (Q d) o\<^sub>L R d) * dist v u \<le> QR_disc * dist v u
[PROOF STEP]
by (auto intro!: mult_right_mono)
[PROOF STATE]
proof (state)
this:
norm (inv\<^sub>L (Q d) o\<^sub>L R d) * dist v u \<le> QR_disc * dist v u

goal (1 subgoal):
 1. apply_bfun (L_split d v) s - apply_bfun (L_split d u) s \<le> QR_disc * dist v u
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
apply_bfun (L_split d v) s - apply_bfun (L_split d u) s \<le> QR_disc * dist v u
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
apply_bfun (L_split d v) s - apply_bfun (L_split d u) s \<le> QR_disc * dist v u

goal (1 subgoal):
 1. apply_bfun (L_split d v) s - apply_bfun (L_split d u) s \<le> QR_disc * dist v u
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
apply_bfun (L_split d v) s - apply_bfun (L_split d u) s \<le> QR_disc * dist v u

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
apply_bfun (L_split d ?u3) ?s3 \<le> apply_bfun (L_split d ?v3) ?s3 \<Longrightarrow> apply_bfun (L_split d ?v3) ?s3 - apply_bfun (L_split d ?u3) ?s3 \<le> QR_disc * dist ?v3 ?u3

goal (1 subgoal):
 1. dist (L_split d v) (L_split d u) \<le> QR_disc * dist v u
[PROOF STEP]
have "dist (L_split d v s) (L_split d u s) \<le> QR_disc * dist v u" for v s u
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (apply_bfun (L_split d v) s) (apply_bfun (L_split d u) s) \<le> QR_disc * dist v u
[PROOF STEP]
using aux aux[of v _ u]
[PROOF STATE]
proof (prove)
using this:
apply_bfun (L_split d ?u3) ?s3 \<le> apply_bfun (L_split d ?v3) ?s3 \<Longrightarrow> apply_bfun (L_split d ?v3) ?s3 - apply_bfun (L_split d ?u3) ?s3 \<le> QR_disc * dist ?v3 ?u3
apply_bfun (L_split d v) ?s3 \<le> apply_bfun (L_split d u) ?s3 \<Longrightarrow> apply_bfun (L_split d u) ?s3 - apply_bfun (L_split d v) ?s3 \<le> QR_disc * dist u v

goal (1 subgoal):
 1. dist (apply_bfun (L_split d v) s) (apply_bfun (L_split d u) s) \<le> QR_disc * dist v u
[PROOF STEP]
by (cases "L_split d v s \<ge> L_split d u s") (auto simp: dist_real_def dist_commute)
[PROOF STATE]
proof (state)
this:
dist (apply_bfun (L_split d ?v3) ?s3) (apply_bfun (L_split d ?u3) ?s3) \<le> QR_disc * dist ?v3 ?u3

goal (1 subgoal):
 1. dist (L_split d v) (L_split d u) \<le> QR_disc * dist v u
[PROOF STEP]
thus "dist (L_split d v) (L_split d u) \<le> QR_disc * dist v u"
[PROOF STATE]
proof (prove)
using this:
dist (apply_bfun (L_split d ?v3) ?s3) (apply_bfun (L_split d ?u3) ?s3) \<le> QR_disc * dist ?v3 ?u3

goal (1 subgoal):
 1. dist (L_split d v) (L_split d u) \<le> QR_disc * dist v u
[PROOF STEP]
by (simp add: dist_bound)
[PROOF STATE]
proof (state)
this:
dist (L_split d v) (L_split d u) \<le> QR_disc * dist v u

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma partition_by_concat2:
  "partition_by xs (concat ys) =
   concat (map (\<lambda>i . partition_by (partition_by xs (map sum_list ys) ! i) (ys ! i)) [0..<length ys])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partition_by xs (concat ys) = concat (map (\<lambda>i. partition_by (partition_by xs (map sum_list ys) ! i) (ys ! i)) [0..<length ys])
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. partition_by xs (concat ys) = concat (map (\<lambda>i. partition_by (partition_by xs (map sum_list ys) ! i) (ys ! i)) [0..<length ys])
[PROOF STEP]
have *: "map (\<lambda>i . partition_by (partition_by xs (map sum_list ys) ! i) (ys ! i)) [0..<length ys] =
    map (\<lambda>(x,y). partition_by x y) (zip (partition_by xs (map sum_list ys)) ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>i. partition_by (partition_by xs (map sum_list ys) ! i) (ys ! i)) [0..<length ys] = map2 partition_by (partition_by xs (map sum_list ys)) ys
[PROOF STEP]
using zip_nth_conv[of "partition_by xs (map sum_list ys)" ys]
[PROOF STATE]
proof (prove)
using this:
length (partition_by xs (map sum_list ys)) = length ys \<Longrightarrow> zip (partition_by xs (map sum_list ys)) ys = map (\<lambda>i. (partition_by xs (map sum_list ys) ! i, ys ! i)) [0..<length ys]

goal (1 subgoal):
 1. map (\<lambda>i. partition_by (partition_by xs (map sum_list ys) ! i) (ys ! i)) [0..<length ys] = map2 partition_by (partition_by xs (map sum_list ys)) ys
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
map (\<lambda>i. partition_by (partition_by xs (map sum_list ys) ! i) (ys ! i)) [0..<length ys] = map2 partition_by (partition_by xs (map sum_list ys)) ys

goal (1 subgoal):
 1. partition_by xs (concat ys) = concat (map (\<lambda>i. partition_by (partition_by xs (map sum_list ys) ! i) (ys ! i)) [0..<length ys])
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partition_by xs (concat ys) = concat (map (\<lambda>i. partition_by (partition_by xs (map sum_list ys) ! i) (ys ! i)) [0..<length ys])
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partition_by xs (concat ys) = concat (map2 partition_by (partition_by xs (map sum_list ys)) ys)
[PROOF STEP]
by (induct ys arbitrary: xs) (auto simp: partition_by_append2)
[PROOF STATE]
proof (state)
this:
partition_by xs (concat ys) = concat (map (\<lambda>i. partition_by (partition_by xs (map sum_list ys) ! i) (ys ! i)) [0..<length ys])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Collect_Max_ge: "\<lbrakk> finite {x. P x}; P k \<rbrakk> \<Longrightarrow> k \<le> Max {x. P x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite {x. P x}; P k\<rbrakk> \<Longrightarrow> k \<le> Max {x. P x}
[PROOF STEP]
by (rule Max_ge, assumption, rule CollectI)


[STATEMENT]
lemma lcm_neg1 [simp]: "lcm (-a) b = lcm a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lcm (- a) b = lcm a b
[PROOF STEP]
by (rule sym, rule lcmI) (simp_all add: lcm_least lcm_eq_0_iff)


[STATEMENT]
lemma set_Pi_pmf_subset: "finite A \<Longrightarrow> set_pmf (Pi_pmf A dflt p) \<subseteq> {f. \<forall>x. x \<notin> A \<longrightarrow> f x = dflt}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> set_pmf (Pi_pmf A dflt p) \<subseteq> {f. \<forall>x. x \<notin> A \<longrightarrow> f x = dflt}
[PROOF STEP]
by (auto simp: set_pmf_eq pmf_Pi)


[STATEMENT]
lemma height_node41:
  "height m > 0 \<Longrightarrow> height(node41 l a m b n c r) =
   max (height l) (max (height m) (max (height n) (height r))) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < height m \<Longrightarrow> height (node41 l a m b n c r) = max (height l) (max (height m) (max (height n) (height r))) + 1
[PROOF STEP]
by(induct l a m b n c r rule: node41.induct)(simp_all add: max_def)


[STATEMENT]
lemma tensor_state_jnf_dim[simp]: \<open>dim_vec (tensor_state_jnf \<psi> \<phi>) = dim_vec \<psi> * dim_vec \<phi>\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (tensor_state_jnf \<psi> \<phi>) = dim_vec \<psi> * dim_vec \<phi>
[PROOF STEP]
unfolding tensor_state_jnf_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (vec (dim_vec \<psi> * dim_vec \<phi>) (\<lambda>i. case tensor_unpack (dim_vec \<psi>) (dim_vec \<phi>) i of (i1, i2) \<Rightarrow> \<psi> $ i1 * \<phi> $ i2)) = dim_vec \<psi> * dim_vec \<phi>
[PROOF STEP]
by simp


[STATEMENT]
lemma map_project_set: "List.map_project f (set xs) = set (List.map_filter f xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. List.map_project f (set xs) = set (List.map_filter f xs)
[PROOF STEP]
by(auto simp add: List.map_project_def List.map_filter_def intro: rev_image_eqI)


[STATEMENT]
lemma kparts_insert_eq: "kparts (insert X H) = kparts {X} \<union> kparts H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kparts (insert X H) = kparts {X} \<union> kparts H
[PROOF STEP]
by (rule_tac A=H in insert_Un, rule kparts_Un)


[STATEMENT]
lemma infinite_nat_iff_unbounded: "infinite S \<longleftrightarrow> (\<forall>m. \<exists>n>m. n \<in> S)"
  for S :: "nat set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite S = (\<forall>m. \<exists>n>m. n \<in> S)
[PROOF STEP]
using frequently_cofinite[of "\<lambda>x. x \<in> S"]
[PROOF STATE]
proof (prove)
using this:
(\<exists>\<^sub>\<infinity>x. x \<in> S) = infinite {x. x \<in> S}

goal (1 subgoal):
 1. infinite S = (\<forall>m. \<exists>n>m. n \<in> S)
[PROOF STEP]
by (simp add: cofinite_eq_sequentially frequently_def eventually_at_top_dense)