[STATEMENT]
lemma card_interleavings:
  assumes "set xs \<inter> set ys = {}"
  shows "card {zs. interleavings xs ys zs} = (length xs + length ys choose (length xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {zs. interleavings xs ys zs} = length xs + length ys choose length xs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set xs \<inter> set ys = {}

goal (1 subgoal):
 1. card {zs. interleavings xs ys zs} = length xs + length ys choose length xs
[PROOF STEP]
proof (induct xs ys rule: two_mutual_lists_induction)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings [] ys)) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (Collect (interleavings xs [])) = length xs + length [] choose length xs
 3. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
case (1 ys)
[PROOF STATE]
proof (state)
this:
set [] \<inter> set ys = {}

goal (3 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings [] ys)) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (Collect (interleavings xs [])) = length xs + length [] choose length xs
 3. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
have "card {zs. interleavings [] ys zs} = card {ys}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {zs. interleavings [] ys zs} = card {ys}
[PROOF STEP]
by (simp add: interleaving_Nil_iff1)
[PROOF STATE]
proof (state)
this:
card {zs. interleavings [] ys zs} = card {ys}

goal (3 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings [] ys)) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (Collect (interleavings xs [])) = length xs + length [] choose length xs
 3. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {zs. interleavings [] ys zs} = card {ys}

goal (3 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings [] ys)) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (Collect (interleavings xs [])) = length xs + length [] choose length xs
 3. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
have "\<dots> = (length [] + length ys choose (length []))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {ys} = length [] + length ys choose length []
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {ys} = length [] + length ys choose length []

goal (3 subgoals):
 1. \<And>ys. set [] \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings [] ys)) = length [] + length ys choose length []
 2. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (Collect (interleavings xs [])) = length xs + length [] choose length xs
 3. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {zs. interleavings [] ys zs} = length [] + length ys choose length []
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card {zs. interleavings [] ys zs} = length [] + length ys choose length []

goal (1 subgoal):
 1. card {a. interleavings [] ys a} = length [] + length ys choose length []
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card {a. interleavings [] ys a} = length [] + length ys choose length []

goal (2 subgoals):
 1. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (Collect (interleavings xs [])) = length xs + length [] choose length xs
 2. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (Collect (interleavings xs [])) = length xs + length [] choose length xs
 2. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
case (2 xs)
[PROOF STATE]
proof (state)
this:
set xs \<inter> set [] = {}

goal (2 subgoals):
 1. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (Collect (interleavings xs [])) = length xs + length [] choose length xs
 2. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
have "card {zs. interleavings xs [] zs} = card {xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {zs. interleavings xs [] zs} = card {xs}
[PROOF STEP]
by (simp add: interleaving_Nil_iff2)
[PROOF STATE]
proof (state)
this:
card {zs. interleavings xs [] zs} = card {xs}

goal (2 subgoals):
 1. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (Collect (interleavings xs [])) = length xs + length [] choose length xs
 2. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {zs. interleavings xs [] zs} = card {xs}

goal (2 subgoals):
 1. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (Collect (interleavings xs [])) = length xs + length [] choose length xs
 2. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
have "\<dots> = (length xs + length [] choose (length xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {xs} = length xs + length [] choose length xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {xs} = length xs + length [] choose length xs

goal (2 subgoals):
 1. \<And>xs. set xs \<inter> set [] = {} \<Longrightarrow> card (Collect (interleavings xs [])) = length xs + length [] choose length xs
 2. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {zs. interleavings xs [] zs} = length xs + length [] choose length xs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card {zs. interleavings xs [] zs} = length xs + length [] choose length xs

goal (1 subgoal):
 1. card {a. interleavings xs [] a} = length xs + length [] choose length xs
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card {a. interleavings xs [] a} = length xs + length [] choose length xs

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
case (3 x xs y ys)
[PROOF STATE]
proof (state)
this:
set xs \<inter> set (y # ys) = {} \<Longrightarrow> card {a. interleavings xs (y # ys) a} = length xs + length (y # ys) choose length xs
set (x # xs) \<inter> set ys = {} \<Longrightarrow> card {a. interleavings (x # xs) ys a} = length (x # xs) + length ys choose length (x # xs)
set (x # xs) \<inter> set (y # ys) = {}

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
have "card {zs. interleavings (x # xs) (y # ys) zs} =
    card ({x#zs|zs. interleavings xs (y#ys) zs} \<union> {y#zs|zs. interleavings (x#xs) ys zs})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {zs. interleavings (x # xs) (y # ys) zs} = card ({x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs})
[PROOF STEP]
by (simp add: interleavings_Cons)
[PROOF STATE]
proof (state)
this:
card {zs. interleavings (x # xs) (y # ys) zs} = card ({x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs})

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {zs. interleavings (x # xs) (y # ys) zs} = card ({x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs})

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
have "\<dots> = card {x#zs|zs. interleavings xs (y#ys) zs} + card {y#zs|zs. interleavings (x#xs) ys zs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs}) = card {x # zs |zs. interleavings xs (y # ys) zs} + card {y # zs |zs. interleavings (x # xs) ys zs}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card ({x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs}) = card {x # zs |zs. interleavings xs (y # ys) zs} + card {y # zs |zs. interleavings (x # xs) ys zs}
[PROOF STEP]
have "finite {x # zs |zs. interleavings xs (y # ys) zs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {x # zs |zs. interleavings xs (y # ys) zs}
[PROOF STEP]
by (simp add: finite_interleavings)
[PROOF STATE]
proof (state)
this:
finite {x # zs |zs. interleavings xs (y # ys) zs}

goal (1 subgoal):
 1. card ({x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs}) = card {x # zs |zs. interleavings xs (y # ys) zs} + card {y # zs |zs. interleavings (x # xs) ys zs}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite {x # zs |zs. interleavings xs (y # ys) zs}

goal (1 subgoal):
 1. card ({x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs}) = card {x # zs |zs. interleavings xs (y # ys) zs} + card {y # zs |zs. interleavings (x # xs) ys zs}
[PROOF STEP]
have "finite {y # zs |zs. interleavings (x # xs) ys zs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {y # zs |zs. interleavings (x # xs) ys zs}
[PROOF STEP]
by (simp add: finite_interleavings)
[PROOF STATE]
proof (state)
this:
finite {y # zs |zs. interleavings (x # xs) ys zs}

goal (1 subgoal):
 1. card ({x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs}) = card {x # zs |zs. interleavings xs (y # ys) zs} + card {y # zs |zs. interleavings (x # xs) ys zs}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite {y # zs |zs. interleavings (x # xs) ys zs}

goal (1 subgoal):
 1. card ({x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs}) = card {x # zs |zs. interleavings xs (y # ys) zs} + card {y # zs |zs. interleavings (x # xs) ys zs}
[PROOF STEP]
have "{x # zs |zs. interleavings xs (y # ys) zs} \<inter> {y # zs |zs. interleavings (x # xs) ys zs} = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x # zs |zs. interleavings xs (y # ys) zs} \<inter> {y # zs |zs. interleavings (x # xs) ys zs} = {}
[PROOF STEP]
using \<open>set (x # xs) \<inter> set (y # ys) = {}\<close>
[PROOF STATE]
proof (prove)
using this:
set (x # xs) \<inter> set (y # ys) = {}

goal (1 subgoal):
 1. {x # zs |zs. interleavings xs (y # ys) zs} \<inter> {y # zs |zs. interleavings (x # xs) ys zs} = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x # zs |zs. interleavings xs (y # ys) zs} \<inter> {y # zs |zs. interleavings (x # xs) ys zs} = {}

goal (1 subgoal):
 1. card ({x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs}) = card {x # zs |zs. interleavings xs (y # ys) zs} + card {y # zs |zs. interleavings (x # xs) ys zs}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite {x # zs |zs. interleavings xs (y # ys) zs}
finite {y # zs |zs. interleavings (x # xs) ys zs}
{x # zs |zs. interleavings xs (y # ys) zs} \<inter> {y # zs |zs. interleavings (x # xs) ys zs} = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite {x # zs |zs. interleavings xs (y # ys) zs}
finite {y # zs |zs. interleavings (x # xs) ys zs}
{x # zs |zs. interleavings xs (y # ys) zs} \<inter> {y # zs |zs. interleavings (x # xs) ys zs} = {}

goal (1 subgoal):
 1. card ({x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs}) = card {x # zs |zs. interleavings xs (y # ys) zs} + card {y # zs |zs. interleavings (x # xs) ys zs}
[PROOF STEP]
by (simp add: card_Un_disjoint)
[PROOF STATE]
proof (state)
this:
card ({x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs}) = card {x # zs |zs. interleavings xs (y # ys) zs} + card {y # zs |zs. interleavings (x # xs) ys zs}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card ({x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs}) = card {x # zs |zs. interleavings xs (y # ys) zs} + card {y # zs |zs. interleavings (x # xs) ys zs}

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ({x # zs |zs. interleavings xs (y # ys) zs} \<union> {y # zs |zs. interleavings (x # xs) ys zs}) = card {x # zs |zs. interleavings xs (y # ys) zs} + card {y # zs |zs. interleavings (x # xs) ys zs}

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
have "\<dots> = card ((\<lambda>zs. x # zs) ` {zs. interleavings xs (y # ys) zs}) +
    card ((\<lambda>zs. y # zs) ` {zs. interleavings (x#xs) ys zs})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {x # zs |zs. interleavings xs (y # ys) zs} + card {y # zs |zs. interleavings (x # xs) ys zs} = card ((#) x ` {zs. interleavings xs (y # ys) zs}) + card ((#) y ` {zs. interleavings (x # xs) ys zs})
[PROOF STEP]
by (simp add: setcompr_eq_image)
[PROOF STATE]
proof (state)
this:
card {x # zs |zs. interleavings xs (y # ys) zs} + card {y # zs |zs. interleavings (x # xs) ys zs} = card ((#) x ` {zs. interleavings xs (y # ys) zs}) + card ((#) y ` {zs. interleavings (x # xs) ys zs})

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {x # zs |zs. interleavings xs (y # ys) zs} + card {y # zs |zs. interleavings (x # xs) ys zs} = card ((#) x ` {zs. interleavings xs (y # ys) zs}) + card ((#) y ` {zs. interleavings (x # xs) ys zs})

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
have "\<dots> = card {zs. interleavings xs (y # ys) zs} + card {zs. interleavings (x#xs) ys zs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((#) x ` {zs. interleavings xs (y # ys) zs}) + card ((#) y ` {zs. interleavings (x # xs) ys zs}) = card {zs. interleavings xs (y # ys) zs} + card {zs. interleavings (x # xs) ys zs}
[PROOF STEP]
by (simp add: card_image)
[PROOF STATE]
proof (state)
this:
card ((#) x ` {zs. interleavings xs (y # ys) zs}) + card ((#) y ` {zs. interleavings (x # xs) ys zs}) = card {zs. interleavings xs (y # ys) zs} + card {zs. interleavings (x # xs) ys zs}

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ((#) x ` {zs. interleavings xs (y # ys) zs}) + card ((#) y ` {zs. interleavings (x # xs) ys zs}) = card {zs. interleavings xs (y # ys) zs} + card {zs. interleavings (x # xs) ys zs}

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
have "\<dots> = (length xs + length (y # ys) choose length xs) + (length (x # xs) + length ys choose length (x # xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {zs. interleavings xs (y # ys) zs} + card {zs. interleavings (x # xs) ys zs} = length xs + length (y # ys) choose length xs + (length (x # xs) + length ys choose length (x # xs))
[PROOF STEP]
using 3
[PROOF STATE]
proof (prove)
using this:
set xs \<inter> set (y # ys) = {} \<Longrightarrow> card {a. interleavings xs (y # ys) a} = length xs + length (y # ys) choose length xs
set (x # xs) \<inter> set ys = {} \<Longrightarrow> card {a. interleavings (x # xs) ys a} = length (x # xs) + length ys choose length (x # xs)
set (x # xs) \<inter> set (y # ys) = {}

goal (1 subgoal):
 1. card {zs. interleavings xs (y # ys) zs} + card {zs. interleavings (x # xs) ys zs} = length xs + length (y # ys) choose length xs + (length (x # xs) + length ys choose length (x # xs))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {zs. interleavings xs (y # ys) zs} + card {zs. interleavings (x # xs) ys zs} = length xs + length (y # ys) choose length xs + (length (x # xs) + length ys choose length (x # xs))

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {zs. interleavings xs (y # ys) zs} + card {zs. interleavings (x # xs) ys zs} = length xs + length (y # ys) choose length xs + (length (x # xs) + length ys choose length (x # xs))

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
have "\<dots> = length (x # xs) + length (y # ys) choose length (x # xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs + length (y # ys) choose length xs + (length (x # xs) + length ys choose length (x # xs)) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length xs + length (y # ys) choose length xs + (length (x # xs) + length ys choose length (x # xs)) = length (x # xs) + length (y # ys) choose length (x # xs)

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>set xs \<inter> set (y # ys) = {} \<Longrightarrow> card (Collect (interleavings xs (y # ys))) = length xs + length (y # ys) choose length xs; set (x # xs) \<inter> set ys = {} \<Longrightarrow> card (Collect (interleavings (x # xs) ys)) = length (x # xs) + length ys choose length (x # xs); set (x # xs) \<inter> set (y # ys) = {}\<rbrakk> \<Longrightarrow> card (Collect (interleavings (x # xs) (y # ys))) = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {zs. interleavings (x # xs) (y # ys) zs} = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card {zs. interleavings (x # xs) (y # ys) zs} = length (x # xs) + length (y # ys) choose length (x # xs)

goal (1 subgoal):
 1. card {a. interleavings (x # xs) (y # ys) a} = length (x # xs) + length (y # ys) choose length (x # xs)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card {a. interleavings (x # xs) (y # ys) a} = length (x # xs) + length (y # ys) choose length (x # xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma matrix_to_iarray_dependent_and_consistent[code]:
shows "dependent_and_consistent A b = dependent_and_consistent_iarrays (matrix_to_iarray A) (vec_to_iarray b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dependent_and_consistent A b = dependent_and_consistent_iarrays (matrix_to_iarray A) (vec_to_iarray b)
[PROOF STEP]
unfolding dependent_and_consistent_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (consistent A b \<and> 0 < vec.dim (solution_set A 0)) = dependent_and_consistent_iarrays (matrix_to_iarray A) (vec_to_iarray b)
[PROOF STEP]
unfolding dependent_and_consistent_iarrays_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (consistent A b \<and> 0 < vec.dim (solution_set A 0)) = (let GJ = Gauss_Jordan_iarrays_PA (matrix_to_iarray A); rank_A = length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd GJ))); P_mult_b = fst GJ *iv vec_to_iarray b; consistent_A = (if \<not> is_zero_iarray P_mult_b then greatest_not_zero P_mult_b + 1 else 0) \<le> rank_A; dim_solution_set = ncols_iarray (matrix_to_iarray A) - rank_A in consistent_A \<and> 0 < dim_solution_set)
[PROOF STEP]
unfolding dim_solution_set_homogeneous_eq_dim_null_space
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (consistent A b \<and> 0 < vec.dim (null_space A)) = (let GJ = Gauss_Jordan_iarrays_PA (matrix_to_iarray A); rank_A = length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd GJ))); P_mult_b = fst GJ *iv vec_to_iarray b; consistent_A = (if \<not> is_zero_iarray P_mult_b then greatest_not_zero P_mult_b + 1 else 0) \<le> rank_A; dim_solution_set = ncols_iarray (matrix_to_iarray A) - rank_A in consistent_A \<and> 0 < dim_solution_set)
[PROOF STEP]
unfolding matrix_to_iarray_consistent
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (consistent_iarrays (matrix_to_iarray A) (vec_to_iarray b) \<and> 0 < vec.dim (null_space A)) = (let GJ = Gauss_Jordan_iarrays_PA (matrix_to_iarray A); rank_A = length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd GJ))); P_mult_b = fst GJ *iv vec_to_iarray b; consistent_A = (if \<not> is_zero_iarray P_mult_b then greatest_not_zero P_mult_b + 1 else 0) \<le> rank_A; dim_solution_set = ncols_iarray (matrix_to_iarray A) - rank_A in consistent_A \<and> 0 < dim_solution_set)
[PROOF STEP]
unfolding consistent_iarrays_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((let GJ = Gauss_Jordan_iarrays_PA (matrix_to_iarray A); rank_A = length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd GJ))); P_mult_b = fst GJ *iv vec_to_iarray b in (if \<not> is_zero_iarray P_mult_b then greatest_not_zero P_mult_b + 1 else 0) \<le> rank_A) \<and> 0 < vec.dim (null_space A)) = (let GJ = Gauss_Jordan_iarrays_PA (matrix_to_iarray A); rank_A = length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd GJ))); P_mult_b = fst GJ *iv vec_to_iarray b; consistent_A = (if \<not> is_zero_iarray P_mult_b then greatest_not_zero P_mult_b + 1 else 0) \<le> rank_A; dim_solution_set = ncols_iarray (matrix_to_iarray A) - rank_A in consistent_A \<and> 0 < dim_solution_set)
[PROOF STEP]
unfolding dim_null_space_iarray
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((let GJ = Gauss_Jordan_iarrays_PA (matrix_to_iarray A); rank_A = length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd GJ))); P_mult_b = fst GJ *iv vec_to_iarray b in (if \<not> is_zero_iarray P_mult_b then greatest_not_zero P_mult_b + 1 else 0) \<le> rank_A) \<and> 0 < ncols_iarray (matrix_to_iarray A) - rank_iarray (matrix_to_iarray A)) = (let GJ = Gauss_Jordan_iarrays_PA (matrix_to_iarray A); rank_A = length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd GJ))); P_mult_b = fst GJ *iv vec_to_iarray b; consistent_A = (if \<not> is_zero_iarray P_mult_b then greatest_not_zero P_mult_b + 1 else 0) \<le> rank_A; dim_solution_set = ncols_iarray (matrix_to_iarray A) - rank_A in consistent_A \<and> 0 < dim_solution_set)
[PROOF STEP]
unfolding rank_iarrays_code
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((let GJ = Gauss_Jordan_iarrays_PA (matrix_to_iarray A); rank_A = length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd GJ))); P_mult_b = fst GJ *iv vec_to_iarray b in (if \<not> is_zero_iarray P_mult_b then greatest_not_zero P_mult_b + 1 else 0) \<le> rank_A) \<and> 0 < ncols_iarray (matrix_to_iarray A) - length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (Gauss_Jordan_iarrays (matrix_to_iarray A))))) = (let GJ = Gauss_Jordan_iarrays_PA (matrix_to_iarray A); rank_A = length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd GJ))); P_mult_b = fst GJ *iv vec_to_iarray b; consistent_A = (if \<not> is_zero_iarray P_mult_b then greatest_not_zero P_mult_b + 1 else 0) \<le> rank_A; dim_solution_set = ncols_iarray (matrix_to_iarray A) - rank_A in consistent_A \<and> 0 < dim_solution_set)
[PROOF STEP]
unfolding snd_Gauss_Jordan_iarrays_PA_eq[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((let GJ = Gauss_Jordan_iarrays_PA (matrix_to_iarray A); rank_A = length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd GJ))); P_mult_b = fst GJ *iv vec_to_iarray b in (if \<not> is_zero_iarray P_mult_b then greatest_not_zero P_mult_b + 1 else 0) \<le> rank_A) \<and> 0 < ncols_iarray (matrix_to_iarray A) - length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)))))) = (let GJ = Gauss_Jordan_iarrays_PA (matrix_to_iarray A); rank_A = length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd GJ))); P_mult_b = fst GJ *iv vec_to_iarray b; consistent_A = (if \<not> is_zero_iarray P_mult_b then greatest_not_zero P_mult_b + 1 else 0) \<le> rank_A; dim_solution_set = ncols_iarray (matrix_to_iarray A) - rank_A in consistent_A \<and> 0 < dim_solution_set)
[PROOF STEP]
unfolding Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((if \<not> is_zero_iarray (fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) *iv vec_to_iarray b) then greatest_not_zero (fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) *iv vec_to_iarray b) + 1 else 0) \<le> length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd (Gauss_Jordan_iarrays_PA (matrix_to_iarray A))))) \<and> 0 < ncols_iarray (matrix_to_iarray A) - length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)))))) = ((if \<not> is_zero_iarray (fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) *iv vec_to_iarray b) then greatest_not_zero (fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray A)) *iv vec_to_iarray b) + 1 else 0) \<le> length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd (Gauss_Jordan_iarrays_PA (matrix_to_iarray A))))) \<and> 0 < ncols_iarray (matrix_to_iarray A) - length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd (Gauss_Jordan_iarrays_PA (matrix_to_iarray A))))))
[PROOF STEP]
..


[STATEMENT]
lemma sum_upto_ln_conv_ln_fact: "sum_upto ln x = ln (fact (nat \<lfloor>x\<rfloor>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>x. ln (real x)) x = ln (fact (nat \<lfloor>x\<rfloor>))
[PROOF STEP]
by (simp add: ln_fact_conv_sum_upto sum_upto_altdef)


[STATEMENT]
lemma step_4_push_small_size_ok_4_aux: "\<lbrakk>
  4 \<le> remaining_steps (States dir big small);
  size_new big + remaining_steps (States dir big small) + 2 \<le> 3 * size_new small
\<rbrakk> \<Longrightarrow> size_new big + (remaining_steps (States dir big small) - 4) + 2 \<le> 3 * Suc (size_new small)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>4 \<le> remaining_steps (States dir big small); size_new big + remaining_steps (States dir big small) + 2 \<le> 3 * size_new small\<rbrakk> \<Longrightarrow> size_new big + (remaining_steps (States dir big small) - 4) + 2 \<le> 3 * Suc (size_new small)
[PROOF STEP]
using distrib_left dual_order.trans le_add_diff_inverse2
[PROOF STATE]
proof (prove)
using this:
?a * (?b + ?c) = ?a * ?b + ?a * ?c
\<lbrakk>?b \<le> ?a; ?c \<le> ?b\<rbrakk> \<Longrightarrow> ?c \<le> ?a
?b \<le> ?a \<Longrightarrow> ?a - ?b + ?b = ?a

goal (1 subgoal):
 1. \<lbrakk>4 \<le> remaining_steps (States dir big small); size_new big + remaining_steps (States dir big small) + 2 \<le> 3 * size_new small\<rbrakk> \<Longrightarrow> size_new big + (remaining_steps (States dir big small) - 4) + 2 \<le> 3 * Suc (size_new small)
[PROOF STEP]
by force


[STATEMENT]
lemma dual_SUP: "(\<Squnion>(f ` A)) ^ o = (INF a \<in> A . (f a) ^ o)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> (f ` A) ^ o = (\<Sqinter>a\<in>A. f a ^ o)
[PROOF STEP]
unfolding dual_Sup
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter> (dual ` f ` A) = (\<Sqinter>a\<in>A. f a ^ o)
[PROOF STEP]
apply (subgoal_tac "(dual ` f ` A) = ((\<lambda>a::'b. f a ^ o) ` A)")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. dual ` f ` A = (\<lambda>a. f a ^ o) ` A \<Longrightarrow> \<Sqinter> (dual ` f ` A) = (\<Sqinter>a\<in>A. f a ^ o)
 2. dual ` f ` A = (\<lambda>a. f a ^ o) ` A
[PROOF STEP]
by auto


[STATEMENT]
lemma cos_ang_circ_simp:
  assumes "E \<noteq> \<mu>1" and "E \<noteq> \<mu>2"
  shows "cos (ang_circ E \<mu>1 \<mu>2 p1 p2) =
         sgn_bool (p1 = p2) * cos (Arg (E - \<mu>2) - Arg (E - \<mu>1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (ang_circ E \<mu>1 \<mu>2 p1 p2) = sgn_bool (p1 = p2) * cos (Arg (E - \<mu>2) - Arg (E - \<mu>1))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
E \<noteq> \<mu>1
E \<noteq> \<mu>2

goal (1 subgoal):
 1. cos (ang_circ E \<mu>1 \<mu>2 p1 p2) = sgn_bool (p1 = p2) * cos (Arg (E - \<mu>2) - Arg (E - \<mu>1))
[PROOF STEP]
using cos_periodic_pi2[of "Arg (E - \<mu>2) - Arg (E - \<mu>1)"]
[PROOF STATE]
proof (prove)
using this:
E \<noteq> \<mu>1
E \<noteq> \<mu>2
cos (pi + (Arg (E - \<mu>2) - Arg (E - \<mu>1))) = - cos (Arg (E - \<mu>2) - Arg (E - \<mu>1))

goal (1 subgoal):
 1. cos (ang_circ E \<mu>1 \<mu>2 p1 p2) = sgn_bool (p1 = p2) * cos (Arg (E - \<mu>2) - Arg (E - \<mu>1))
[PROOF STEP]
using cos_minus_pi[of "Arg (E - \<mu>2) - Arg (E - \<mu>1)"]
[PROOF STATE]
proof (prove)
using this:
E \<noteq> \<mu>1
E \<noteq> \<mu>2
cos (pi + (Arg (E - \<mu>2) - Arg (E - \<mu>1))) = - cos (Arg (E - \<mu>2) - Arg (E - \<mu>1))
cos (Arg (E - \<mu>2) - Arg (E - \<mu>1) - pi) = - cos (Arg (E - \<mu>2) - Arg (E - \<mu>1))

goal (1 subgoal):
 1. cos (ang_circ E \<mu>1 \<mu>2 p1 p2) = sgn_bool (p1 = p2) * cos (Arg (E - \<mu>2) - Arg (E - \<mu>1))
[PROOF STEP]
using ang_circ_simp[OF assms, of p1 p2]
[PROOF STATE]
proof (prove)
using this:
E \<noteq> \<mu>1
E \<noteq> \<mu>2
cos (pi + (Arg (E - \<mu>2) - Arg (E - \<mu>1))) = - cos (Arg (E - \<mu>2) - Arg (E - \<mu>1))
cos (Arg (E - \<mu>2) - Arg (E - \<mu>1) - pi) = - cos (Arg (E - \<mu>2) - Arg (E - \<mu>1))
ang_circ E \<mu>1 \<mu>2 p1 p2 = \<downharpoonright>Arg (E - \<mu>2) - Arg (E - \<mu>1) + sgn_bool p1 * pi / 2 - sgn_bool p2 * pi / 2\<downharpoonleft>

goal (1 subgoal):
 1. cos (ang_circ E \<mu>1 \<mu>2 p1 p2) = sgn_bool (p1 = p2) * cos (Arg (E - \<mu>2) - Arg (E - \<mu>1))
[PROOF STEP]
by auto


[STATEMENT]
lemma integral_mono:
  fixes f :: "'a \<Rightarrow> real"
  shows "integrable M f \<Longrightarrow> integrable M g \<Longrightarrow> (\<And>x. x \<in> space M \<Longrightarrow> f x \<le> g x) \<Longrightarrow>
    integral\<^sup>L M f \<le> integral\<^sup>L M g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>integrable M f; integrable M g; \<And>x. x \<in> space M \<Longrightarrow> f x \<le> g x\<rbrakk> \<Longrightarrow> integral\<^sup>L M f \<le> integral\<^sup>L M g
[PROOF STEP]
by (intro integral_mono_AE) auto


[STATEMENT]
lemma sorted_descending_split: "sorted_descending (map f l) \<Longrightarrow>
  	\<exists>m n. l = m @ n \<and> (\<forall>e \<in> set m. f (hd l) = f e) \<and> (\<forall>e \<in> set n. f e < f (hd l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_descending (map f l) \<Longrightarrow> \<exists>m n. l = m @ n \<and> (\<forall>e\<in>set m. f (hd l) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd l))
[PROOF STEP]
proof(induction l)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sorted_descending (map f []) \<Longrightarrow> \<exists>m n. [] = m @ n \<and> (\<forall>e\<in>set m. f (hd []) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd []))
 2. \<And>a l. \<lbrakk>sorted_descending (map f l) \<Longrightarrow> \<exists>m n. l = m @ n \<and> (\<forall>e\<in>set m. f (hd l) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd l)); sorted_descending (map f (a # l))\<rbrakk> \<Longrightarrow> \<exists>m n. a # l = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # l)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # l)))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
sorted_descending (map f [])

goal (2 subgoals):
 1. sorted_descending (map f []) \<Longrightarrow> \<exists>m n. [] = m @ n \<and> (\<forall>e\<in>set m. f (hd []) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd []))
 2. \<And>a l. \<lbrakk>sorted_descending (map f l) \<Longrightarrow> \<exists>m n. l = m @ n \<and> (\<forall>e\<in>set m. f (hd l) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd l)); sorted_descending (map f (a # l))\<rbrakk> \<Longrightarrow> \<exists>m n. a # l = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # l)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # l)))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
sorted_descending (map f [])

goal (1 subgoal):
 1. \<exists>m n. [] = m @ n \<and> (\<forall>e\<in>set m. f (hd []) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd []))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<exists>m n. [] = m @ n \<and> (\<forall>e\<in>set m. f (hd []) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd []))

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>sorted_descending (map f l) \<Longrightarrow> \<exists>m n. l = m @ n \<and> (\<forall>e\<in>set m. f (hd l) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd l)); sorted_descending (map f (a # l))\<rbrakk> \<Longrightarrow> \<exists>m n. a # l = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # l)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # l)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a l. \<lbrakk>sorted_descending (map f l) \<Longrightarrow> \<exists>m n. l = m @ n \<and> (\<forall>e\<in>set m. f (hd l) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd l)); sorted_descending (map f (a # l))\<rbrakk> \<Longrightarrow> \<exists>m n. a # l = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # l)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # l)))
[PROOF STEP]
case (Cons a as)
[PROOF STATE]
proof (state)
this:
sorted_descending (map f as) \<Longrightarrow> \<exists>m n. as = m @ n \<and> (\<forall>e\<in>set m. f (hd as) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd as))
sorted_descending (map f (a # as))

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>sorted_descending (map f l) \<Longrightarrow> \<exists>m n. l = m @ n \<and> (\<forall>e\<in>set m. f (hd l) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd l)); sorted_descending (map f (a # l))\<rbrakk> \<Longrightarrow> \<exists>m n. a # l = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # l)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # l)))
[PROOF STEP]
from Cons(2)
[PROOF STATE]
proof (chain)
picking this:
sorted_descending (map f (a # as))
[PROOF STEP]
have IHm: "sorted_descending (map f as)"
[PROOF STATE]
proof (prove)
using this:
sorted_descending (map f (a # as))

goal (1 subgoal):
 1. sorted_descending (map f as)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sorted_descending (map f as)

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>sorted_descending (map f l) \<Longrightarrow> \<exists>m n. l = m @ n \<and> (\<forall>e\<in>set m. f (hd l) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd l)); sorted_descending (map f (a # l))\<rbrakk> \<Longrightarrow> \<exists>m n. a # l = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # l)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # l)))
[PROOF STEP]
note mIH = Cons(1)[OF this]
[PROOF STATE]
proof (state)
this:
\<exists>m n. as = m @ n \<and> (\<forall>e\<in>set m. f (hd as) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd as))

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>sorted_descending (map f l) \<Longrightarrow> \<exists>m n. l = m @ n \<and> (\<forall>e\<in>set m. f (hd l) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd l)); sorted_descending (map f (a # l))\<rbrakk> \<Longrightarrow> \<exists>m n. a # l = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # l)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # l)))
[PROOF STEP]
thus ?case (is ?kees)
[PROOF STATE]
proof (prove)
using this:
\<exists>m n. as = m @ n \<and> (\<forall>e\<in>set m. f (hd as) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd as))

goal (1 subgoal):
 1. \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
proof(cases as)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<exists>m n. as = m @ n \<and> (\<forall>e\<in>set m. f (hd as) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd as)); as = []\<rbrakk> \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
 2. \<And>aa list. \<lbrakk>\<exists>m n. as = m @ n \<and> (\<forall>e\<in>set m. f (hd as) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd as)); as = aa # list\<rbrakk> \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
as = []

goal (2 subgoals):
 1. \<lbrakk>\<exists>m n. as = m @ n \<and> (\<forall>e\<in>set m. f (hd as) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd as)); as = []\<rbrakk> \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
 2. \<And>aa list. \<lbrakk>\<exists>m n. as = m @ n \<and> (\<forall>e\<in>set m. f (hd as) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd as)); as = aa # list\<rbrakk> \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
show ?kees
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
unfolding Nil
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>m n. [a] = m @ n \<and> (\<forall>e\<in>set m. f (hd [a]) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd [a]))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))

goal (1 subgoal):
 1. \<And>aa list. \<lbrakk>\<exists>m n. as = m @ n \<and> (\<forall>e\<in>set m. f (hd as) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd as)); as = aa # list\<rbrakk> \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa list. \<lbrakk>\<exists>m n. as = m @ n \<and> (\<forall>e\<in>set m. f (hd as) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd as)); as = aa # list\<rbrakk> \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
case (Cons aa ass)
[PROOF STATE]
proof (state)
this:
as = aa # ass

goal (1 subgoal):
 1. \<And>aa list. \<lbrakk>\<exists>m n. as = m @ n \<and> (\<forall>e\<in>set m. f (hd as) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd as)); as = aa # list\<rbrakk> \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
show ?kees
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
proof(cases "f a = f aa")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f a = f aa \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
 2. f a \<noteq> f aa \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
f a = f aa

goal (2 subgoals):
 1. f a = f aa \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
 2. f a \<noteq> f aa \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
from mIH
[PROOF STATE]
proof (chain)
picking this:
\<exists>m n. as = m @ n \<and> (\<forall>e\<in>set m. f (hd as) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd as))
[PROOF STEP]
obtain m n where mn: "as = m @ n" "(\<forall>e\<in>set m. f a = f e)" "(\<forall>e\<in>set n. f e < f a)"
[PROOF STATE]
proof (prove)
using this:
\<exists>m n. as = m @ n \<and> (\<forall>e\<in>set m. f (hd as) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd as))

goal (1 subgoal):
 1. (\<And>m n. \<lbrakk>as = m @ n; \<forall>e\<in>set m. f a = f e; \<forall>e\<in>set n. f e < f a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using True local.Cons
[PROOF STATE]
proof (prove)
using this:
\<exists>m n. as = m @ n \<and> (\<forall>e\<in>set m. f (hd as) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd as))
f a = f aa
as = aa # ass

goal (1 subgoal):
 1. (\<And>m n. \<lbrakk>as = m @ n; \<forall>e\<in>set m. f a = f e; \<forall>e\<in>set n. f e < f a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
as = m @ n
\<forall>e\<in>set m. f a = f e
\<forall>e\<in>set n. f e < f a

goal (2 subgoals):
 1. f a = f aa \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
 2. f a \<noteq> f aa \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
have "a # as = a # m @ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a # as = a # m @ n
[PROOF STEP]
using mn(1)
[PROOF STATE]
proof (prove)
using this:
as = m @ n

goal (1 subgoal):
 1. a # as = a # m @ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a # as = a # m @ n

goal (2 subgoals):
 1. f a = f aa \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
 2. f a \<noteq> f aa \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a # as = a # m @ n

goal (2 subgoals):
 1. f a = f aa \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
 2. f a \<noteq> f aa \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
have "\<forall>e\<in>set (a # m). f (hd (a # m)) = f e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>e\<in>set (a # m). f (hd (a # m)) = f e
[PROOF STEP]
unfolding list.sel(1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>e\<in>set (a # m). f a = f e
[PROOF STEP]
using True mn(2)
[PROOF STATE]
proof (prove)
using this:
f a = f aa
\<forall>e\<in>set m. f a = f e

goal (1 subgoal):
 1. \<forall>e\<in>set (a # m). f a = f e
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
f a = f aa
\<forall>e\<in>set m. f a = f e
as = aa # ass

goal (1 subgoal):
 1. \<forall>e\<in>set (a # m). f a = f e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>e\<in>set (a # m). f (hd (a # m)) = f e

goal (2 subgoals):
 1. f a = f aa \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
 2. f a \<noteq> f aa \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a # as = a # m @ n
\<forall>e\<in>set (a # m). f (hd (a # m)) = f e
[PROOF STEP]
show "\<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and>
  				(\<forall>e\<in>set n. f e < f (hd (a # as)))"
[PROOF STATE]
proof (prove)
using this:
a # as = a # m @ n
\<forall>e\<in>set (a # m). f (hd (a # m)) = f e

goal (1 subgoal):
 1. \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
using mn(3)
[PROOF STATE]
proof (prove)
using this:
a # as = a # m @ n
\<forall>e\<in>set (a # m). f (hd (a # m)) = f e
\<forall>e\<in>set n. f e < f a

goal (1 subgoal):
 1. \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
by (metis append.simps(2) list.sel(1))
[PROOF STATE]
proof (state)
this:
\<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))

goal (1 subgoal):
 1. f a \<noteq> f aa \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f a \<noteq> f aa \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
f a \<noteq> f aa

goal (1 subgoal):
 1. f a \<noteq> f aa \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
from Cons.prems
[PROOF STATE]
proof (chain)
picking this:
sorted_descending (map f (a # as))
[PROOF STEP]
have "\<forall>y\<in>set (map f as). y < f a"
[PROOF STATE]
proof (prove)
using this:
sorted_descending (map f (a # as))

goal (1 subgoal):
 1. \<forall>y\<in>set (map f as). y < f a
[PROOF STEP]
unfolding list.map(2)
[PROOF STATE]
proof (prove)
using this:
sorted_descending (f a # map f as)

goal (1 subgoal):
 1. \<forall>y\<in>set (map f as). y < f a
[PROOF STEP]
unfolding sorted_descending_Cons
[PROOF STATE]
proof (prove)
using this:
sorted_descending (map f as) \<and> (\<forall>y\<in>set (map f as). y \<le> f a)

goal (1 subgoal):
 1. \<forall>y\<in>set (map f as). y < f a
[PROOF STEP]
unfolding set_map
[PROOF STATE]
proof (prove)
using this:
sorted_descending (map f as) \<and> (\<forall>y\<in>f ` set as. y \<le> f a)

goal (1 subgoal):
 1. \<forall>y\<in>f ` set as. y < f a
[PROOF STEP]
unfolding local.Cons
[PROOF STATE]
proof (prove)
using this:
sorted_descending (map f (aa # ass)) \<and> (\<forall>y\<in>f ` set (aa # ass). y \<le> f a)

goal (1 subgoal):
 1. \<forall>y\<in>f ` set (aa # ass). y < f a
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
sorted_descending (map f (aa # ass)) \<and> (\<forall>y\<in>f ` set (aa # ass). y \<le> f a)
f a \<noteq> f aa

goal (1 subgoal):
 1. \<forall>y\<in>f ` set (aa # ass). y < f a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>y\<in>set (map f as). y < f a

goal (1 subgoal):
 1. f a \<noteq> f aa \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>y\<in>set (map f as). y < f a
[PROOF STEP]
have "\<forall>e\<in>set as. f e < f a"
[PROOF STATE]
proof (prove)
using this:
\<forall>y\<in>set (map f as). y < f a

goal (1 subgoal):
 1. \<forall>e\<in>set as. f e < f a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>e\<in>set as. f e < f a

goal (1 subgoal):
 1. f a \<noteq> f aa \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>e\<in>set as. f e < f a

goal (1 subgoal):
 1. f a \<noteq> f aa \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
have "a # as = [a] @ as \<and> (\<forall>e\<in>set [a]. f (hd [a]) = f e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a # as = [a] @ as \<and> (\<forall>e\<in>set [a]. f (hd [a]) = f e)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a # as = [a] @ as \<and> (\<forall>e\<in>set [a]. f (hd [a]) = f e)

goal (1 subgoal):
 1. f a \<noteq> f aa \<Longrightarrow> \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>e\<in>set as. f e < f a
a # as = [a] @ as \<and> (\<forall>e\<in>set [a]. f (hd [a]) = f e)
[PROOF STEP]
show ?kees
[PROOF STATE]
proof (prove)
using this:
\<forall>e\<in>set as. f e < f a
a # as = [a] @ as \<and> (\<forall>e\<in>set [a]. f (hd [a]) = f e)

goal (1 subgoal):
 1. \<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))
[PROOF STEP]
by (metis list.sel(1))
[PROOF STATE]
proof (state)
this:
\<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>m n. a # as = m @ n \<and> (\<forall>e\<in>set m. f (hd (a # as)) = f e) \<and> (\<forall>e\<in>set n. f e < f (hd (a # as)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rtrancl_unfold': "(x, z) \<in> rtrancl R \<Longrightarrow>
  x = z \<or> (\<exists>y. (x, y) \<in> rtrancl R \<and> y \<noteq> z \<and> (y, z) \<in> R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x, z) \<in> R\<^sup>* \<Longrightarrow> x = z \<or> (\<exists>y. (x, y) \<in> R\<^sup>* \<and> y \<noteq> z \<and> (y, z) \<in> R)
[PROOF STEP]
by (induction x z rule: rtrancl.induct) auto


[STATEMENT]
lemma linear_surj_right_inverse:
  assumes lf: "linear s1 s2 f"
  assumes sf: "vs2.span T \<subseteq> f`vs1.span S"
  shows "\<exists>g. range g \<subseteq> vs1.span S \<and> linear s2 s1 g \<and> (\<forall>x\<in>vs2.span T. f (g x) = x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>g. range g \<subseteq> vs1.span S \<and> linear (*b) (*a) g \<and> (\<forall>x\<in>vs2.span T. f (g x) = x)
[PROOF STEP]
using linear_exists_right_inverse_on[OF lf vs1.subspace_span, of S] sf
[PROOF STATE]
proof (prove)
using this:
\<exists>g. range g \<subseteq> vs1.span S \<and> linear (*b) (*a) g \<and> (\<forall>v\<in>f ` vs1.span S. f (g v) = v)
vs2.span T \<subseteq> f ` vs1.span S

goal (1 subgoal):
 1. \<exists>g. range g \<subseteq> vs1.span S \<and> linear (*b) (*a) g \<and> (\<forall>x\<in>vs2.span T. f (g x) = x)
[PROOF STEP]
by (force simp: linear_iff_module_hom)


[STATEMENT]
lemma card_UNIV_fset: "CARD('a fset) = (if CARD('a) = 0 then 0 else 2 ^ CARD('a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('a fset) = (if CARD('a) = 0 then 0 else 2 ^ CARD('a))
[PROOF STEP]
apply (simp add: card_eq_0_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (finite UNIV \<longrightarrow> CARD('a fset) = 2 ^ CARD('a)) \<and> (infinite UNIV \<longrightarrow> infinite UNIV)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite UNIV \<longrightarrow> CARD('a fset) = 2 ^ CARD('a)
 2. infinite UNIV \<longrightarrow> infinite UNIV
[PROOF STEP]
have "inj fset"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj fset
[PROOF STEP]
by (meson fset_inject injI)
[PROOF STATE]
proof (state)
this:
inj fset

goal (2 subgoals):
 1. finite UNIV \<longrightarrow> CARD('a fset) = 2 ^ CARD('a)
 2. infinite UNIV \<longrightarrow> infinite UNIV
[PROOF STEP]
have "card (UNIV :: 'a fset set) = card (fset ` (UNIV :: 'a fset set))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('a fset) = card (range fset)
[PROOF STEP]
by (simp add: \<open>inj fset\<close> card_image)
[PROOF STATE]
proof (state)
this:
CARD('a fset) = card (range fset)

goal (2 subgoals):
 1. finite UNIV \<longrightarrow> CARD('a fset) = 2 ^ CARD('a)
 2. infinite UNIV \<longrightarrow> infinite UNIV
[PROOF STEP]
show "finite (UNIV :: 'a set) \<longrightarrow> CARD('a fset) = 2 ^ CARD('a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite UNIV \<longrightarrow> CARD('a fset) = 2 ^ CARD('a)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite UNIV \<Longrightarrow> CARD('a fset) = 2 ^ CARD('a)
[PROOF STEP]
assume "finite (UNIV :: 'a set)"
[PROOF STATE]
proof (state)
this:
finite UNIV

goal (1 subgoal):
 1. finite UNIV \<Longrightarrow> CARD('a fset) = 2 ^ CARD('a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite UNIV
[PROOF STEP]
have "CARD('a set) = 2 ^ CARD('a)"
[PROOF STATE]
proof (prove)
using this:
finite UNIV

goal (1 subgoal):
 1. CARD('a set) = 2 ^ CARD('a)
[PROOF STEP]
by (metis Pow_UNIV card_Pow)
[PROOF STATE]
proof (state)
this:
CARD('a set) = 2 ^ CARD('a)

goal (1 subgoal):
 1. finite UNIV \<Longrightarrow> CARD('a fset) = 2 ^ CARD('a)
[PROOF STEP]
have "finite (UNIV :: 'a set set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite UNIV
[PROOF STEP]
using \<open>finite (UNIV :: 'a set)\<close>
[PROOF STATE]
proof (prove)
using this:
finite UNIV

goal (1 subgoal):
 1. finite UNIV
[PROOF STEP]
by (simp add: Finite_Set.finite_set)
[PROOF STATE]
proof (state)
this:
finite UNIV

goal (1 subgoal):
 1. finite UNIV \<Longrightarrow> CARD('a fset) = 2 ^ CARD('a)
[PROOF STEP]
have "finite (UNIV :: 'a fset set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite UNIV
[PROOF STEP]
using \<open>finite (UNIV :: 'a set)\<close> finiteness_fset_UNIV
[PROOF STATE]
proof (prove)
using this:
finite UNIV
finite UNIV = finite UNIV

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

goal (1 subgoal):
 1. finite UNIV \<Longrightarrow> CARD('a fset) = 2 ^ CARD('a)
[PROOF STEP]
have "\<And> xs :: 'a set . finite xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs. finite xs
[PROOF STEP]
using finite_sets_finite_univ[OF \<open>finite (UNIV :: 'a set)\<close>]
[PROOF STATE]
proof (prove)
using this:
finite ?xs

goal (1 subgoal):
 1. \<And>xs. finite xs
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
finite ?xs1

goal (1 subgoal):
 1. finite UNIV \<Longrightarrow> CARD('a fset) = 2 ^ CARD('a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite ?xs1
[PROOF STEP]
have "(UNIV :: 'a set set) = fset ` (UNIV :: 'a fset set)"
[PROOF STATE]
proof (prove)
using this:
finite ?xs1

goal (1 subgoal):
 1. UNIV = range fset
[PROOF STEP]
by (metis UNIV_I UNIV_eq_I fset_to_fset image_iff)
[PROOF STATE]
proof (state)
this:
UNIV = range fset

goal (1 subgoal):
 1. finite UNIV \<Longrightarrow> CARD('a fset) = 2 ^ CARD('a)
[PROOF STEP]
have "CARD('a fset) \<le> CARD('a set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('a fset) \<le> CARD('a set)
[PROOF STEP]
unfolding \<open>card (UNIV :: 'a fset set) = card (fset ` (UNIV :: 'a fset set))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (range fset) \<le> CARD('a set)
[PROOF STEP]
by (metis \<open>finite (UNIV :: 'a set set)\<close> card_mono subset_UNIV)
[PROOF STATE]
proof (state)
this:
CARD('a fset) \<le> CARD('a set)

goal (1 subgoal):
 1. finite UNIV \<Longrightarrow> CARD('a fset) = 2 ^ CARD('a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
CARD('a fset) \<le> CARD('a set)

goal (1 subgoal):
 1. finite UNIV \<Longrightarrow> CARD('a fset) = 2 ^ CARD('a)
[PROOF STEP]
have "CARD('a fset) \<ge> CARD('a set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('a set) \<le> CARD('a fset)
[PROOF STEP]
unfolding \<open>(UNIV :: 'a set set) = fset ` (UNIV :: 'a fset set)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (range fset) \<le> CARD('a fset)
[PROOF STEP]
using \<open>CARD('a::type fset) = card (range fset)\<close>
[PROOF STATE]
proof (prove)
using this:
CARD('a fset) = card (range fset)

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

goal (1 subgoal):
 1. finite UNIV \<Longrightarrow> CARD('a fset) = 2 ^ CARD('a)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
CARD('a fset) \<le> CARD('a set)
CARD('a set) \<le> CARD('a fset)
[PROOF STEP]
have "CARD('a fset) = CARD('a set)"
[PROOF STATE]
proof (prove)
using this:
CARD('a fset) \<le> CARD('a set)
CARD('a set) \<le> CARD('a fset)

goal (1 subgoal):
 1. CARD('a fset) = CARD('a set)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
CARD('a fset) = CARD('a set)

goal (1 subgoal):
 1. finite UNIV \<Longrightarrow> CARD('a fset) = 2 ^ CARD('a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
CARD('a fset) = CARD('a set)
[PROOF STEP]
show "CARD('a fset) = (2::nat) ^ CARD('a)"
[PROOF STATE]
proof (prove)
using this:
CARD('a fset) = CARD('a set)

goal (1 subgoal):
 1. CARD('a fset) = 2 ^ CARD('a)
[PROOF STEP]
by (simp add: \<open>CARD('a::type set) = (2::nat) ^ CARD('a::type)\<close>)
[PROOF STATE]
proof (state)
this:
CARD('a fset) = 2 ^ CARD('a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
finite UNIV \<longrightarrow> CARD('a fset) = 2 ^ CARD('a)

goal (1 subgoal):
 1. infinite UNIV \<longrightarrow> infinite UNIV
[PROOF STEP]
show "infinite (UNIV :: 'a set) \<longrightarrow> infinite (UNIV :: 'a fset set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite UNIV \<longrightarrow> infinite UNIV
[PROOF STEP]
by (simp add: finiteness_fset_UNIV)
[PROOF STATE]
proof (state)
this:
infinite UNIV \<longrightarrow> infinite UNIV

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Integral_def2:
  "Integral = (%(a,b) f k. \<forall>e>0. (\<exists>\<delta>. gauge {a..b} \<delta> &
                               (\<forall>D. fine \<delta> (a,b) D -->
                                         \<bar>rsum D f - k\<bar> \<le> e)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Integral = (\<lambda>(a, b) f k. \<forall>e>0. \<exists>\<delta>. gauge {a..b} \<delta> \<and> (\<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> \<le> e))
[PROOF STEP]
unfolding Integral_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(a, b) f k. \<forall>e>0. \<exists>\<delta>. gauge {a..b} \<delta> \<and> (\<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> < e)) = (\<lambda>(a, b) f k. \<forall>e>0. \<exists>\<delta>. gauge {a..b} \<delta> \<and> (\<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> \<le> e))
[PROOF STEP]
apply (safe intro!: ext)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a b f k e. \<lbrakk>\<forall>e>0. \<exists>\<delta>. gauge {a..b} \<delta> \<and> (\<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> < e); 0 < e\<rbrakk> \<Longrightarrow> \<exists>\<delta>. gauge {a..b} \<delta> \<and> (\<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> \<le> e)
 2. \<And>a b f k e. \<lbrakk>\<forall>e>0. \<exists>\<delta>. gauge {a..b} \<delta> \<and> (\<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> \<le> e); 0 < e\<rbrakk> \<Longrightarrow> \<exists>\<delta>. gauge {a..b} \<delta> \<and> (\<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> < e)
[PROOF STEP]
apply (fast intro: less_imp_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b f k e. \<lbrakk>\<forall>e>0. \<exists>\<delta>. gauge {a..b} \<delta> \<and> (\<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> \<le> e); 0 < e\<rbrakk> \<Longrightarrow> \<exists>\<delta>. gauge {a..b} \<delta> \<and> (\<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> < e)
[PROOF STEP]
apply (drule_tac x="e/2" in spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b f k e. \<lbrakk>0 < e; 0 < e / 2 \<longrightarrow> (\<exists>\<delta>. gauge {a..b} \<delta> \<and> (\<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> \<le> e / 2))\<rbrakk> \<Longrightarrow> \<exists>\<delta>. gauge {a..b} \<delta> \<and> (\<forall>D. fine \<delta> (a, b) D \<longrightarrow> \<bar>rsum D f - k\<bar> < e)
[PROOF STEP]
apply force
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lm084:
  assumes "finite X" "finite Y" "card(X\<inter>Y) = card X"
  shows "X \<subseteq> Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<subseteq> Y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite X
finite Y
card (X \<inter> Y) = card X

goal (1 subgoal):
 1. X \<subseteq> Y
[PROOF STEP]
by (metis Int_lower1 Int_lower2 card_seteq order_refl)


[STATEMENT]
lemma finite_NTimes_empty:
  assumes "\<And>s. finite (LV r s)"
  shows "finite (LV (NTimes r n) [])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (LV (NTimes r n) [])
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite (LV r ?s)

goal (1 subgoal):
 1. finite (LV (NTimes r n) [])
[PROOF STEP]
apply(induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<And>s. finite (LV r s)) \<Longrightarrow> finite (LV (NTimes r 0) [])
 2. \<And>n. \<lbrakk>(\<And>s. finite (LV r s)) \<Longrightarrow> finite (LV (NTimes r n) []); \<And>s. finite (LV r s)\<rbrakk> \<Longrightarrow> finite (LV (NTimes r (Suc n)) [])
[PROOF STEP]
apply(auto simp add: LV_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>finite (LV (NTimes r n) []); \<And>s. finite (LV r s)\<rbrakk> \<Longrightarrow> finite (LV (NTimes r (Suc n)) [])
[PROOF STEP]
apply(subst LV_NTIMES_3)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>finite (LV (NTimes r n) []); \<And>s. finite (LV r s)\<rbrakk> \<Longrightarrow> finite ((\<lambda>(v, vs). Stars (v # vs)) ` (LV r [] \<times> Stars -` LV (NTimes r n) []))
[PROOF STEP]
apply(rule finite_imageI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>finite (LV (NTimes r n) []); \<And>s. finite (LV r s)\<rbrakk> \<Longrightarrow> finite (LV r [] \<times> Stars -` LV (NTimes r n) [])
[PROOF STEP]
apply(rule finite_cartesian_product)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>finite (LV (NTimes r n) []); \<And>s. finite (LV r s)\<rbrakk> \<Longrightarrow> finite (LV r [])
 2. \<And>n. \<lbrakk>finite (LV (NTimes r n) []); \<And>s. finite (LV r s)\<rbrakk> \<Longrightarrow> finite (Stars -` LV (NTimes r n) [])
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite (LV r ?s)

goal (2 subgoals):
 1. \<And>n. \<lbrakk>finite (LV (NTimes r n) []); \<And>s. finite (LV r s)\<rbrakk> \<Longrightarrow> finite (LV r [])
 2. \<And>n. \<lbrakk>finite (LV (NTimes r n) []); \<And>s. finite (LV r s)\<rbrakk> \<Longrightarrow> finite (Stars -` LV (NTimes r n) [])
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>finite (LV (NTimes r n) []); \<And>s. finite (LV r s)\<rbrakk> \<Longrightarrow> finite (Stars -` LV (NTimes r n) [])
[PROOF STEP]
apply(rule finite_vimageI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>finite (LV (NTimes r n) []); \<And>s. finite (LV r s)\<rbrakk> \<Longrightarrow> finite (LV (NTimes r n) [])
 2. \<And>n. \<lbrakk>finite (LV (NTimes r n) []); \<And>s. finite (LV r s)\<rbrakk> \<Longrightarrow> inj Stars
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>finite (LV (NTimes r n) []); \<And>s. finite (LV r s)\<rbrakk> \<Longrightarrow> inj Stars
[PROOF STEP]
apply(simp add: inj_on_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Legendre_eq_0_iff [simp]: "prime p \<Longrightarrow> Legendre a p = 0 \<longleftrightarrow> \<not>coprime a p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p \<Longrightarrow> (Legendre a p = 0) = (\<not> coprime a p)
[PROOF STEP]
unfolding Legendre_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p \<Longrightarrow> ((if [a = 0] (mod p) then 0 else if QuadRes p a then 1 else - 1) = 0) = (\<not> coprime a p)
[PROOF STEP]
by (auto simp: prime_cong_eq_0_iff)


[STATEMENT]
lemma log2_of_power_eq: "m = 2 ^ n \<Longrightarrow> n = log 2 m" for m n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m = 2 ^ n \<Longrightarrow> real n = log 2 (real m)
[PROOF STEP]
using log_of_power_eq[of _ 2]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>real ?m = 2 ^ ?n; 1 < 2\<rbrakk> \<Longrightarrow> real ?n = log 2 (real ?m)

goal (1 subgoal):
 1. m = 2 ^ n \<Longrightarrow> real n = log 2 (real m)
[PROOF STEP]
by simp


[STATEMENT]
lemma inverse_le_iff_le [simp]:
  "0 < a \<Longrightarrow> 0 < b \<Longrightarrow> inverse a \<le> inverse b \<longleftrightarrow> b \<le> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(0::'a) < a; (0::'a) < b\<rbrakk> \<Longrightarrow> (inverse a \<le> inverse b) = (b \<le> a)
[PROOF STEP]
by (blast intro: le_imp_inverse_le dest: inverse_le_imp_le)


[STATEMENT]
lemma degree_sum_less:
  "0 < n \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> degree (f x) < n) \<Longrightarrow> degree (\<Sum>x\<in>A. f x) < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; \<And>x. x \<in> A \<Longrightarrow> degree (f x) < n\<rbrakk> \<Longrightarrow> degree (sum f A) < n
[PROOF STEP]
by (induct rule: infinite_finite_induct) (simp_all add: degree_add_less)


[STATEMENT]
lemma Transset_SUP: "(\<And>x. x \<in> A \<Longrightarrow> Transset (B x)) \<Longrightarrow> Transset (\<Squnion> (B ` A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> Transset (B x)) \<Longrightarrow> Transset (\<Squnion> (B ` A))
[PROOF STEP]
by (metis Transset_Sup imageE)


[STATEMENT]
lemma max_times_sum_list_gt_dotprod:
  assumes "length b = length ys"
  shows "Max (set b) * sum_list ys \<ge> b \<bullet> ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<bullet> ys \<le> Max (set b) * sum_list ys
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b \<bullet> ys \<le> Max (set b) * sum_list ys
[PROOF STEP]
have "\<forall> e \<in> set b . Max (set b) \<ge> e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>e\<in>set b. e \<le> Max (set b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>e\<in>set b. e \<le> Max (set b)

goal (1 subgoal):
 1. b \<bullet> ys \<le> Max (set b) * sum_list ys
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>e\<in>set b. e \<le> Max (set b)
[PROOF STEP]
have "replicate (length ys) (Max (set b)) \<bullet> ys \<ge> b \<bullet> ys" (is "?rep \<ge> _")
[PROOF STATE]
proof (prove)
using this:
\<forall>e\<in>set b. e \<le> Max (set b)

goal (1 subgoal):
 1. b \<bullet> ys \<le> replicate (length ys) (Max (set b)) \<bullet> ys
[PROOF STEP]
by (metis assms dotprod_pointwise_le_right dotprod_commute
        length_replicate nth_mem nth_replicate)
[PROOF STATE]
proof (state)
this:
b \<bullet> ys \<le> replicate (length ys) (Max (set b)) \<bullet> ys

goal (1 subgoal):
 1. b \<bullet> ys \<le> Max (set b) * sum_list ys
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
b \<bullet> ys \<le> replicate (length ys) (Max (set b)) \<bullet> ys

goal (1 subgoal):
 1. b \<bullet> ys \<le> Max (set b) * sum_list ys
[PROOF STEP]
have "Max (set b) * sum_list ys = ?rep"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (set b) * sum_list ys = replicate (length ys) (Max (set b)) \<bullet> ys
[PROOF STEP]
using replicate_dotprod [of ys _ "Max (set b)"]
[PROOF STATE]
proof (prove)
using this:
length ys = ?n \<Longrightarrow> replicate ?n (Max (set b)) \<bullet> ys = Max (set b) * sum_list ys

goal (1 subgoal):
 1. Max (set b) * sum_list ys = replicate (length ys) (Max (set b)) \<bullet> ys
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Max (set b) * sum_list ys = replicate (length ys) (Max (set b)) \<bullet> ys

goal (1 subgoal):
 1. b \<bullet> ys \<le> Max (set b) * sum_list ys
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
b \<bullet> ys \<le> replicate (length ys) (Max (set b)) \<bullet> ys
Max (set b) * sum_list ys = replicate (length ys) (Max (set b)) \<bullet> ys
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b \<bullet> ys \<le> replicate (length ys) (Max (set b)) \<bullet> ys
Max (set b) * sum_list ys = replicate (length ys) (Max (set b)) \<bullet> ys

goal (1 subgoal):
 1. b \<bullet> ys \<le> Max (set b) * sum_list ys
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
b \<bullet> ys \<le> Max (set b) * sum_list ys

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cosh_real_pos [simp]: "cosh (x :: real) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < cosh x
[PROOF STEP]
using cosh_real_ge_1[of x]
[PROOF STATE]
proof (prove)
using this:
1 \<le> cosh x

goal (1 subgoal):
 1. 0 < cosh x
[PROOF STEP]
by simp


[STATEMENT]
lemma Im_eq_0: "\<bar>Re z\<bar> = cmod z \<Longrightarrow> Im z = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>Re z\<bar> = cmod z \<Longrightarrow> Im z = 0
[PROOF STEP]
by (subst (asm) power_eq_iff_eq_base[symmetric, where n=2]) (auto simp add: norm_complex_def)


[STATEMENT]
lemma forall_3: "(\<forall>i::3. P i) \<longleftrightarrow> P 1 \<and> P 2 \<and> P 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i. P i) = (P 1 \<and> P 2 \<and> P 3)
[PROOF STEP]
by (metis exhaust_3)


[STATEMENT]
lemma distinct_seteq_eq_set_union:
  "Finite_Set.card xs = Suc n
    \<Longrightarrow> {ys. set ys = xs \<and> distinct ys}
      = {y # ys |y ys. y \<in> xs \<and> ys \<in> {as. set as = (xs - {y}) \<and> distinct as}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Set.card xs = Suc n \<Longrightarrow> {ys. set ys = xs \<and> distinct ys} = {y # ys |y ys. y \<in> xs \<and> ys \<in> {as. set as = xs - {y} \<and> distinct as}}
[PROOF STEP]
using distinct_seteq_set_Cons_in_set'
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Finite_Set.card ?xs = Suc ?n; ?x \<in> {ys. set ys = ?xs \<and> distinct ys}\<rbrakk> \<Longrightarrow> \<exists>y ys. ?x = y # ys \<and> y \<in> ?xs \<and> ys \<in> {ys. set ys = ?xs - {y} \<and> distinct ys}

goal (1 subgoal):
 1. Finite_Set.card xs = Suc n \<Longrightarrow> {ys. set ys = xs \<and> distinct ys} = {y # ys |y ys. y \<in> xs \<and> ys \<in> {as. set as = xs - {y} \<and> distinct as}}
[PROOF STEP]
by force


[STATEMENT]
theorem wls_freshAbs_substAbs:
assumes "wlsAbs (us,s) A" and "wls (asSort ys) Y"
shows "freshAbs zs z (A $[Y / y]_ys) =
       (((zs = ys \<and> z = y) \<or> freshAbs zs z A) \<and> (freshAbs ys y A \<or> fresh zs z Y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. freshAbs zs z (A $[Y / y]_ys) = ((zs = ys \<and> z = y \<or> freshAbs zs z A) \<and> (freshAbs ys y A \<or> fresh zs z Y))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wlsAbs (us, s) A
wls (asSort ys) Y

goal (1 subgoal):
 1. freshAbs zs z (A $[Y / y]_ys) = ((zs = ys \<and> z = y \<or> freshAbs zs z A) \<and> (freshAbs ys y A \<or> fresh zs z Y))
[PROOF STEP]
by(simp add: freshAbs_substAbs)


[STATEMENT]
lemma finite_chain_with_card_2:
  assumes f_def: "[f\<leadsto>Q|a..b]"
    and card_Q: "card Q = 2"
  shows "finite Q" "f 0 = a" "f (card Q - 1) = b" "Q = {f 0, f 1}" "\<exists>Q. path Q (f 0) (f 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (finite Q &&& f 0 = a) &&& f (card Q - 1) = b &&& Q = {f 0, f 1} &&& \<exists>Q. path Q (f 0) (f 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
[f\<leadsto>Q|a .. b]
card Q = 2

goal (1 subgoal):
 1. (finite Q &&& f 0 = a) &&& f (card Q - 1) = b &&& Q = {f 0, f 1} &&& \<exists>Q. path Q (f 0) (f 1)
[PROOF STEP]
unfolding chain_defs
[PROOF STATE]
proof (prove)
using this:
(finite Q \<and> (Q = {f 0, f 1} \<and> (\<exists>Q. path Q (f 0) (f 1)) \<or> (infinite Q \<or> 3 \<le> card Q) \<and> local_ordering f betw Q)) \<and> f 0 = a \<and> f (card Q - 1) = b
card Q = 2

goal (1 subgoal):
 1. (finite Q &&& f 0 = a) &&& f (card Q - 1) = b &&& Q = {f 0, f 1} &&& \<exists>Q. path Q (f 0) (f 1)
[PROOF STEP]
by auto


[STATEMENT]
lemma sum_diff: "((\<Sum>i\<le>n::nat. f (i + 1) - f i)::'a::field) = f (n + 1) - f 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. f (i + 1) - f i) = f (n + 1) - f 0
[PROOF STEP]
by (induct n) (auto simp add: field_simps)


[STATEMENT]
lemma NSDERIVD4:
  "\<lbrakk>NSDERIV f x :> D; h \<in> Infinitesimal\<rbrakk>
    \<Longrightarrow> ( *f* f)(hypreal_of_real x + h) - hypreal_of_real (f x) \<approx> hypreal_of_real D * h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>NSDERIV f x :> D; h \<in> Infinitesimal\<rbrakk> \<Longrightarrow> (*f* f) (hypreal_of_real x + h) - hypreal_of_real (f x) \<approx> hypreal_of_real D * h
[PROOF STEP]
apply (clarsimp simp add: nsderiv_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>h\<in>Infinitesimal - {0}. ((*f* f) (hypreal_of_real x + h) - hypreal_of_real (f x)) / h \<approx> hypreal_of_real D; h \<in> Infinitesimal\<rbrakk> \<Longrightarrow> (*f* f) (hypreal_of_real x + h) - hypreal_of_real (f x) \<approx> hypreal_of_real D * h
[PROOF STEP]
apply (case_tac "h = 0", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>h\<in>Infinitesimal - {0}. ((*f* f) (hypreal_of_real x + h) - hypreal_of_real (f x)) / h \<approx> hypreal_of_real D; h \<in> Infinitesimal; h \<noteq> 0\<rbrakk> \<Longrightarrow> (*f* f) (hypreal_of_real x + h) - hypreal_of_real (f x) \<approx> hypreal_of_real D * h
[PROOF STEP]
by (meson DiffI Infinitesimal_approx Infinitesimal_ratio Infinitesimal_star_of_mult2 approx_star_of_HFinite singletonD)


[STATEMENT]
lemma change_eval_neq:
  fixes x y:: "real"
  assumes "((aEvalUni (NeqUni (a,b,c)) x \<noteq> aEvalUni (NeqUni (a,b,c)) y) \<and> x < y)"
  shows "(\<exists>w. x \<le> w \<and> w \<le> y \<and> a*w^2 + b*w + c = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>w\<ge>x. w \<le> y \<and> a * w\<^sup>2 + b * w + c = 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
aEvalUni (NeqUni (a, b, c)) x \<noteq> aEvalUni (NeqUni (a, b, c)) y \<and> x < y

goal (1 subgoal):
 1. \<exists>w\<ge>x. w \<le> y \<and> a * w\<^sup>2 + b * w + c = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma add_mset_lt_lt_lt:
  assumes a_lt_b: "a < b" and A_le_B: "A < B"
  shows "add_mset a A < add_mset b B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. add_mset a A < add_mset b B
[PROOF STEP]
by (rule less_trans[OF add_mset_lt_left_lt[OF a_lt_b] add_mset_lt_right_lt[OF A_le_B]])


[STATEMENT]
lemma subset_finite_imp_finite: "\<lbrakk> finite A; B \<subseteq> A \<rbrakk> \<Longrightarrow> finite B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; B \<subseteq> A\<rbrakk> \<Longrightarrow> finite B
[PROOF STEP]
by (rule finite_subset)


[STATEMENT]
lemma sum_neg_in: "- (\<Sum>j = 0..<l. (f j)::('a mod_ring)) =  (\<Sum>j = 0..<l. - f j) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - sum f {0::'b..<l} = (\<Sum>j = 0::'b..<l. - f j)
[PROOF STEP]
by (simp add: sum_negf)


[STATEMENT]
lemma abs_arctan: "\<bar>arctan x\<bar> = arctan \<bar>x\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>arctan x\<bar> = arctan \<bar>x\<bar>
[PROOF STEP]
by (simp add: abs_if arctan_minus)


[STATEMENT]
lemma Limsup_at:
  fixes f :: "'a::metric_space \<Rightarrow> 'b::complete_lattice"
  shows "Limsup (at x) f = (INF e\<in>{0<..}. SUP y\<in>(ball x e - {x}). f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Limsup (at x) f = (INF e\<in>{0<..}. Sup (f ` (ball x e - {x})))
[PROOF STEP]
using Limsup_within[of x UNIV f]
[PROOF STATE]
proof (prove)
using this:
Limsup (at x) f = (INF e\<in>{0<..}. Sup (f ` (UNIV \<inter> ball x e - {x})))

goal (1 subgoal):
 1. Limsup (at x) f = (INF e\<in>{0<..}. Sup (f ` (ball x e - {x})))
[PROOF STEP]
by simp


[STATEMENT]
lemma nth_prime_partition:
  assumes "x \<ge> 2"
  shows   "\<exists>k. x \<in> {nth_prime k..<nth_prime (Suc k)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k. x \<in> {nth_prime k..<nth_prime (Suc k)}
[PROOF STEP]
using strict_mono_sequence_partition[OF strict_mono_nth_prime, of x] assms nth_prime_at_top
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>nth_prime 0 \<le> x; filterlim nth_prime sequentially sequentially\<rbrakk> \<Longrightarrow> \<exists>k. x \<in> {nth_prime k..<nth_prime (Suc k)}
2 \<le> x
filterlim nth_prime sequentially sequentially

goal (1 subgoal):
 1. \<exists>k. x \<in> {nth_prime k..<nth_prime (Suc k)}
[PROOF STEP]
by simp


[STATEMENT]
theorem meet_prod: "p \<sqinter> q = (fst p \<sqinter> fst q, snd p \<sqinter> snd q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<sqinter> q = (fst p \<sqinter> fst q, snd p \<sqinter> snd q)
[PROOF STEP]
by (rule meet_equality) (rule is_inf_prod)


[STATEMENT]
lemma div_less: "a \<le> b \<and> c > 0 \<Longrightarrow> a/c \<le> b/c" for a b c :: "'a::linordered_field"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b \<and> (0::'a) < c \<Longrightarrow> a / c \<le> b / c
[PROOF STEP]
by (metis divide_le_cancel less_asym)


[STATEMENT]
lemma (in ring) telescopic_base_dim:
  assumes "subfield K R" "subfield F R" and "finite_dimension K F" and "finite_dimension F E"
  shows "finite_dimension K E" and "(dim over K) E = ((dim over K) F) * ((dim over F) E)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_dimension K E &&& (local.dim over K) E = (local.dim over K) F * (local.dim over F) E
[PROOF STEP]
using telescopic_base[OF assms(1-2)
        finite_dimensionE[OF assms(1,3)]
        finite_dimensionE[OF assms(2,4)]]
        dimI[OF assms(1)] finite_dimensionI
[PROOF STATE]
proof (prove)
using this:
dimension ((local.dim over K) F * (local.dim over F) E) K E
dimension ?n K ?E \<Longrightarrow> (local.dim over K) ?E = ?n
dimension ?n ?K ?E \<Longrightarrow> finite_dimension ?K ?E

goal (1 subgoal):
 1. finite_dimension K E &&& (local.dim over K) E = (local.dim over K) F * (local.dim over F) E
[PROOF STEP]
by auto


[STATEMENT]
lemma nth_map_zip2:
assumes "i < length (map f (zip xs ys))"
shows "map f (zip xs ys) ! i = f (xs ! i, ys ! i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map f (zip xs ys) ! i = f (xs ! i, ys ! i)
[PROOF STEP]
using nth_zip nth_map length_zip assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i < length ?xs; ?i < length ?ys\<rbrakk> \<Longrightarrow> zip ?xs ?ys ! ?i = (?xs ! ?i, ?ys ! ?i)
?n < length ?xs \<Longrightarrow> map ?f ?xs ! ?n = ?f (?xs ! ?n)
length (zip ?xs ?ys) = min (length ?xs) (length ?ys)
i < length (map f (zip xs ys))

goal (1 subgoal):
 1. map f (zip xs ys) ! i = f (xs ! i, ys ! i)
[PROOF STEP]
by simp


[STATEMENT]
lemma mat_conj_adjoint:
  shows "mat_conj (Complex_Matrix.adjoint U) V =
  Complex_Matrix.adjoint U * V * U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_conj (Complex_Matrix.adjoint U) V = Complex_Matrix.adjoint U * V * U
[PROOF STEP]
unfolding mat_conj_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.adjoint U * V * Complex_Matrix.adjoint (Complex_Matrix.adjoint U) = Complex_Matrix.adjoint U * V * U
[PROOF STEP]
by (simp add: Complex_Matrix.adjoint_adjoint)


[STATEMENT]
lemma sum_list_map_times: "sum_list (map ((*) x) xs) = (x::'a::semiring_0) * sum_list xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map ((*) x) xs) = x * sum_list xs
[PROOF STEP]
by (induct xs) (simp_all add: algebra_simps)


[STATEMENT]
lemma mod_div_equality_int: "(n :: int) div x * x = n - n mod x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n div x * x = n - n mod x
[PROOF STEP]
using div_mult_mod_eq[of n x]
[PROOF STATE]
proof (prove)
using this:
n div x * x + n mod x = n

goal (1 subgoal):
 1. n div x * x = n - n mod x
[PROOF STEP]
by arith


[STATEMENT]
lemma projection_insert_finite:
  fixes S :: \<open>'a::chilbert_space set\<close>
  assumes a1: "\<And>s. s \<in> S \<Longrightarrow> is_orthogonal a s" and a2: "finite S"
  shows "projection (cspan (insert a S)) u
        = projection (cspan {a}) u + projection (cspan S) u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. projection (cspan (insert a S)) u = projection (cspan {a}) u + projection (cspan S) u
[PROOF STEP]
using projection_insert
[PROOF STATE]
proof (prove)
using this:
(\<And>s. s \<in> ?S \<Longrightarrow> is_orthogonal ?a s) \<Longrightarrow> projection (closure (cspan (insert ?a ?S))) ?u = projection (cspan {?a}) ?u + projection (closure (cspan ?S)) ?u

goal (1 subgoal):
 1. projection (cspan (insert a S)) u = projection (cspan {a}) u + projection (cspan S) u
[PROOF STEP]
by (metis a1 a2 closure_finite_cspan finite.insertI)


[STATEMENT]
lemma MOST_imp_iff: "MOST x. P x \<Longrightarrow> (MOST x. P x \<longrightarrow> Q x) \<longleftrightarrow> (MOST x. Q x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>\<infinity>x. P x \<Longrightarrow> (\<forall>\<^sub>\<infinity>x. P x \<longrightarrow> Q x) = (\<forall>\<^sub>\<infinity>x. Q x)
[PROOF STEP]
by (auto intro: eventually_rev_mp eventually_mono)


[STATEMENT]
lemma eventually_nonneg_diff2 [eventually_nonzero_simps]:
  assumes "eventually_nonneg F (\<lambda>x. - g x)" "f \<in> o[F](g)"
  shows   "eventually_nonneg F (\<lambda>x. f x - g x :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually_nonneg F (\<lambda>x. f x - g x)
[PROOF STEP]
using  landau_o.smallD[OF assms(2) zero_less_one] assms(1)
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. norm (f x) \<le> 1 * norm (g x)
eventually_nonneg F (\<lambda>x. - g x)

goal (1 subgoal):
 1. eventually_nonneg F (\<lambda>x. f x - g x)
[PROOF STEP]
unfolding eventually_nonneg_def
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. norm (f x) \<le> 1 * norm (g x)
\<forall>\<^sub>F x in F. 0 \<le> - g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. 0 \<le> f x - g x
[PROOF STEP]
by eventually_elim simp_all


[STATEMENT]
lemma IS_LEFT_UNIQUED: "\<lbrakk>IS_LEFT_UNIQUE r; (y, x) \<in> r; (z, x) \<in> r\<rbrakk> \<Longrightarrow> y = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>IS_LEFT_UNIQUE r; (y, x) \<in> r; (z, x) \<in> r\<rbrakk> \<Longrightarrow> y = z
[PROOF STEP]
by (auto simp: IS_LEFT_UNIQUE_def dest: single_valuedD)


[STATEMENT]
lemma Sigma_max_point: "\<lbrakk>\<forall> k < ma. f (xs @ [k]) = 1;
        \<forall> k \<ge> ma. f (xs @ [k]) = 0; ma \<le> w\<rbrakk>
    \<Longrightarrow> Sigma f (xs @ [w]) = ma"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>k<ma. f (xs @ [k]) = 1; \<forall>k\<ge>ma. f (xs @ [k]) = 0; ma \<le> w\<rbrakk> \<Longrightarrow> UF.Sigma f (xs @ [w]) = ma
[PROOF STEP]
apply(induct w, auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>k. f (xs @ [k]) = 0; ma = 0\<rbrakk> \<Longrightarrow> UF.Sigma f (xs @ [0]) = 0
 2. \<And>w. \<lbrakk>ma \<le> w \<Longrightarrow> UF.Sigma f (xs @ [w]) = ma; \<forall>k<ma. f (xs @ [k]) = Suc 0; \<forall>k\<ge>ma. f (xs @ [k]) = 0; ma \<le> Suc w\<rbrakk> \<Longrightarrow> UF.Sigma f (xs @ [Suc w]) = ma
[PROOF STEP]
apply(rule_tac Sigma_0, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>w. \<lbrakk>ma \<le> w \<Longrightarrow> UF.Sigma f (xs @ [w]) = ma; \<forall>k<ma. f (xs @ [k]) = Suc 0; \<forall>k\<ge>ma. f (xs @ [k]) = 0; ma \<le> Suc w\<rbrakk> \<Longrightarrow> UF.Sigma f (xs @ [Suc w]) = ma
[PROOF STEP]
apply(simp add: Sigma_Suc_simp_rewrite)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>w. \<lbrakk>ma \<le> w \<Longrightarrow> UF.Sigma f (xs @ [w]) = ma; \<forall>k<ma. f (xs @ [k]) = Suc 0; \<forall>k\<ge>ma. f (xs @ [k]) = 0; ma \<le> Suc w\<rbrakk> \<Longrightarrow> UF.Sigma f (xs @ [w]) = ma
[PROOF STEP]
using Sigma_Suc
[PROOF STATE]
proof (prove)
using this:
\<forall>k<Suc ?w. ?f (?xs @ [k]) = Suc 0 \<Longrightarrow> UF.Sigma ?f (?xs @ [?w]) = Suc ?w

goal (1 subgoal):
 1. \<And>w. \<lbrakk>ma \<le> w \<Longrightarrow> UF.Sigma f (xs @ [w]) = ma; \<forall>k<ma. f (xs @ [k]) = Suc 0; \<forall>k\<ge>ma. f (xs @ [k]) = 0; ma \<le> Suc w\<rbrakk> \<Longrightarrow> UF.Sigma f (xs @ [w]) = ma
[PROOF STEP]
by fastforce


[STATEMENT]
lemma Lambert_W_less_ln:
  assumes "x > exp 1"
  shows   "Lambert_W x < ln x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lambert_W x < ln x
[PROOF STEP]
proof (rule Lambert_W_lessI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. x < ln x * exp (ln x)
 2. - 1 \<le> ln x
 3. - exp (- 1) \<le> x
[PROOF STEP]
have "x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x
[PROOF STEP]
by (rule less_trans[OF _ assms]) auto
[PROOF STATE]
proof (state)
this:
0 < x

goal (3 subgoals):
 1. x < ln x * exp (ln x)
 2. - 1 \<le> ln x
 3. - exp (- 1) \<le> x
[PROOF STEP]
have "ln x > ln (exp 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ln (exp 1) < ln x
[PROOF STEP]
by (subst ln_less_cancel_iff) (use \<open>x > 0\<close> assms in auto)
[PROOF STATE]
proof (state)
this:
ln (exp 1) < ln x

goal (3 subgoals):
 1. x < ln x * exp (ln x)
 2. - 1 \<le> ln x
 3. - exp (- 1) \<le> x
[PROOF STEP]
thus "x < ln x * exp (ln x)"
[PROOF STATE]
proof (prove)
using this:
ln (exp 1) < ln x

goal (1 subgoal):
 1. x < ln x * exp (ln x)
[PROOF STEP]
using \<open>x > 0\<close>
[PROOF STATE]
proof (prove)
using this:
ln (exp 1) < ln x
0 < x

goal (1 subgoal):
 1. x < ln x * exp (ln x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x < ln x * exp (ln x)

goal (2 subgoals):
 1. - 1 \<le> ln x
 2. - exp (- 1) \<le> x
[PROOF STEP]
show "ln x \<ge> -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 1 \<le> ln x
[PROOF STEP]
by (rule less_imp_le[OF le_less_trans[OF _ \<open>ln x > _\<close>]]) auto
[PROOF STATE]
proof (state)
this:
- 1 \<le> ln x

goal (1 subgoal):
 1. - exp (- 1) \<le> x
[PROOF STEP]
show "x \<ge> -exp (-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - exp (- 1) \<le> x
[PROOF STEP]
by (rule less_imp_le[OF le_less_trans[OF _ \<open>x > 0\<close>]]) auto
[PROOF STATE]
proof (state)
this:
- exp (- 1) \<le> x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powrat_mult_neg:
  assumes "0 < x" "r < 0" and "s < 0"
  shows "x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
have " x pow\<^sub>\<rat> (- r * - s) = (x pow\<^sub>\<rat> - r) pow\<^sub>\<rat> - s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x pow\<^sub>\<rat> (- r * - s) = (x pow\<^sub>\<rat> - r) pow\<^sub>\<rat> - s
[PROOF STEP]
using powrat_mult_pos assms neg_0_less_iff_less
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?x; 0 < ?r; 0 < ?s\<rbrakk> \<Longrightarrow> ?x pow\<^sub>\<rat> (?r * ?s) = (?x pow\<^sub>\<rat> ?r) pow\<^sub>\<rat> ?s
0 < x
r < 0
s < 0
((0::?'a) < - ?a) = (?a < (0::?'a))

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (- r * - s) = (x pow\<^sub>\<rat> - r) pow\<^sub>\<rat> - s
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> (- r * - s) = (x pow\<^sub>\<rat> - r) pow\<^sub>\<rat> - s

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x pow\<^sub>\<rat> (- r * - s) = (x pow\<^sub>\<rat> - r) pow\<^sub>\<rat> - s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x pow\<^sub>\<rat> (- r * - s) = (x pow\<^sub>\<rat> - r) pow\<^sub>\<rat> - s

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s
[PROOF STEP]
by (simp add: powrat_inverse powrat_minus)
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> (r * s) = (x pow\<^sub>\<rat> r) pow\<^sub>\<rat> s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pi_half_gt_zero [simp]: "0 < pi/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < pi / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < pi / 2
[PROOF STEP]
have "0 \<le> pi/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> pi / 2
[PROOF STEP]
by (simp add: pi_half cos_is_zero [THEN theI'])
[PROOF STATE]
proof (state)
this:
0 \<le> pi / 2

goal (1 subgoal):
 1. 0 < pi / 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> pi / 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> pi / 2

goal (1 subgoal):
 1. 0 < pi / 2
[PROOF STEP]
by (metis cos_pi_half cos_zero less_eq_real_def one_neq_zero)
[PROOF STATE]
proof (state)
this:
0 < pi / 2

goal:
No subgoals!
[PROOF STEP]
qed