[STATEMENT]
theorem queue_length_estimate_lower:
  "invar bq \<Longrightarrow> (size (queue_to_multiset bq)) \<ge> 2^(length bq - 1) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invar bq \<Longrightarrow> 2 ^ (length bq - 1) - 1 \<le> size (queue_to_multiset bq)
[PROOF STEP]
proof (induct bq rule: rev_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. invar [] \<Longrightarrow> 2 ^ (length [] - 1) - 1 \<le> size (queue_to_multiset [])
 2. \<And>x xs. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x])\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
invar []

goal (2 subgoals):
 1. invar [] \<Longrightarrow> 2 ^ (length [] - 1) - 1 \<le> size (queue_to_multiset [])
 2. \<And>x xs. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x])\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
invar []

goal (1 subgoal):
 1. 2 ^ (length [] - 1) - 1 \<le> size (queue_to_multiset [])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ (length [] - 1) - 1 \<le> size (queue_to_multiset [])

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x])\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x])\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
case (snoc x xs)
[PROOF STATE]
proof (state)
this:
invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs)
invar (xs @ [x])

goal (1 subgoal):
 1. \<And>x xs. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x])\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs)
invar (xs @ [x])

goal (1 subgoal):
 1. 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
proof (cases xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x]); xs = []\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
 2. \<And>a list. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x]); xs = a # list\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
xs = []

goal (2 subgoals):
 1. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x]); xs = []\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
 2. \<And>a list. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x]); xs = a # list\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
xs = []

goal (1 subgoal):
 1. 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x]); xs = a # list\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a list. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x]); xs = a # list\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
case [simp]: (Cons xx xxs)
[PROOF STATE]
proof (state)
this:
xs = xx # xxs

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x]); xs = a # list\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
from snoc.hyps[OF invar_butlast[OF snoc.prems]]
[PROOF STATE]
proof (chain)
picking this:
2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs)
[PROOF STEP]
have IH: "2 ^ (length xs - 1) \<le> Suc (size (queue_to_multiset xs))"
[PROOF STATE]
proof (prove)
using this:
2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs)

goal (1 subgoal):
 1. 2 ^ (length xs - 1) \<le> Suc (size (queue_to_multiset xs))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ (length xs - 1) \<le> Suc (size (queue_to_multiset xs))

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x]); xs = a # list\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
have size_q:
      "size (queue_to_multiset (xs @ [x])) =
      size (queue_to_multiset xs) + size (tree_to_multiset x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size (queue_to_multiset (xs @ [x])) = size (queue_to_multiset xs) + size (tree_to_multiset x)
[PROOF STEP]
by (simp add: size_queue_sum_list)
[PROOF STATE]
proof (state)
this:
size (queue_to_multiset (xs @ [x])) = size (queue_to_multiset xs) + size (tree_to_multiset x)

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x]); xs = a # list\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
size (queue_to_multiset (xs @ [x])) = size (queue_to_multiset xs) + size (tree_to_multiset x)

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x]); xs = a # list\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
from snoc.prems
[PROOF STATE]
proof (chain)
picking this:
invar (xs @ [x])
[PROOF STEP]
have inv_x: "tree_invar x"
[PROOF STATE]
proof (prove)
using this:
invar (xs @ [x])

goal (1 subgoal):
 1. tree_invar x
[PROOF STEP]
by (simp add: invar_def)
[PROOF STATE]
proof (state)
this:
tree_invar x

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x]); xs = a # list\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
from size_mset_tree_lower[OF this]
[PROOF STATE]
proof (chain)
picking this:
2 ^ rank x \<le> size (tree_to_multiset x)
[PROOF STEP]
have "2 ^ (rank x) \<le> size (tree_to_multiset x)"
[PROOF STATE]
proof (prove)
using this:
2 ^ rank x \<le> size (tree_to_multiset x)

goal (1 subgoal):
 1. 2 ^ rank x \<le> size (tree_to_multiset x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
2 ^ rank x \<le> size (tree_to_multiset x)

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x]); xs = a # list\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
size (queue_to_multiset (xs @ [x])) = size (queue_to_multiset xs) + size (tree_to_multiset x)
2 ^ rank x \<le> size (tree_to_multiset x)
[PROOF STEP]
have
      eq: "size (queue_to_multiset xs) + (2::nat)^(rank x) \<le>
      size (queue_to_multiset (xs @ [x]))"
[PROOF STATE]
proof (prove)
using this:
size (queue_to_multiset (xs @ [x])) = size (queue_to_multiset xs) + size (tree_to_multiset x)
2 ^ rank x \<le> size (tree_to_multiset x)

goal (1 subgoal):
 1. size (queue_to_multiset xs) + 2 ^ rank x \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
size (queue_to_multiset xs) + 2 ^ rank x \<le> size (queue_to_multiset (xs @ [x]))

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x]); xs = a # list\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
from invar_length[OF snoc.prems]
[PROOF STATE]
proof (chain)
picking this:
length (xs @ [x]) \<le> Suc (Suc (rank (last (xs @ [x]))))
[PROOF STEP]
have "length xs \<le> (rank x + 1)"
[PROOF STATE]
proof (prove)
using this:
length (xs @ [x]) \<le> Suc (Suc (rank (last (xs @ [x]))))

goal (1 subgoal):
 1. length xs \<le> rank x + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length xs \<le> rank x + 1

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x]); xs = a # list\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
hence snd: "(2::nat) ^ (length xs - 1) \<le> (2::nat) ^ ((rank x))"
[PROOF STATE]
proof (prove)
using this:
length xs \<le> rank x + 1

goal (1 subgoal):
 1. 2 ^ (length xs - 1) \<le> 2 ^ rank x
[PROOF STEP]
by (simp del: power.simps)
[PROOF STATE]
proof (state)
this:
2 ^ (length xs - 1) \<le> 2 ^ rank x

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x]); xs = a # list\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
have
      "(2::nat) ^ (length (xs @ [x]) - 1) =
      (2::nat) ^ (length xs - 1) + (2::nat) ^ (length xs - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ (length (xs @ [x]) - 1) = 2 ^ (length xs - 1) + 2 ^ (length xs - 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 ^ (length (xs @ [x]) - 1) = 2 ^ (length xs - 1) + 2 ^ (length xs - 1)

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x]); xs = a # list\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
with IH
[PROOF STATE]
proof (chain)
picking this:
2 ^ (length xs - 1) \<le> Suc (size (queue_to_multiset xs))
2 ^ (length (xs @ [x]) - 1) = 2 ^ (length xs - 1) + 2 ^ (length xs - 1)
[PROOF STEP]
have
      "2 ^ (length (xs @ [x]) - 1) \<le>
      Suc (size (queue_to_multiset xs)) + 2 ^ (length xs - 1)"
[PROOF STATE]
proof (prove)
using this:
2 ^ (length xs - 1) \<le> Suc (size (queue_to_multiset xs))
2 ^ (length (xs @ [x]) - 1) = 2 ^ (length xs - 1) + 2 ^ (length xs - 1)

goal (1 subgoal):
 1. 2 ^ (length (xs @ [x]) - 1) \<le> Suc (size (queue_to_multiset xs)) + 2 ^ (length xs - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ (length (xs @ [x]) - 1) \<le> Suc (size (queue_to_multiset xs)) + 2 ^ (length xs - 1)

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x]); xs = a # list\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
with snd
[PROOF STATE]
proof (chain)
picking this:
2 ^ (length xs - 1) \<le> 2 ^ rank x
2 ^ (length (xs @ [x]) - 1) \<le> Suc (size (queue_to_multiset xs)) + 2 ^ (length xs - 1)
[PROOF STEP]
have "2 ^ (length (xs @ [x]) - 1) \<le>
      Suc (size (queue_to_multiset xs)) + 2 ^ rank x"
[PROOF STATE]
proof (prove)
using this:
2 ^ (length xs - 1) \<le> 2 ^ rank x
2 ^ (length (xs @ [x]) - 1) \<le> Suc (size (queue_to_multiset xs)) + 2 ^ (length xs - 1)

goal (1 subgoal):
 1. 2 ^ (length (xs @ [x]) - 1) \<le> Suc (size (queue_to_multiset xs)) + 2 ^ rank x
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
2 ^ (length (xs @ [x]) - 1) \<le> Suc (size (queue_to_multiset xs)) + 2 ^ rank x

goal (1 subgoal):
 1. \<And>a list. \<lbrakk>invar xs \<Longrightarrow> 2 ^ (length xs - 1) - 1 \<le> size (queue_to_multiset xs); invar (xs @ [x]); xs = a # list\<rbrakk> \<Longrightarrow> 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
with eq
[PROOF STATE]
proof (chain)
picking this:
size (queue_to_multiset xs) + 2 ^ rank x \<le> size (queue_to_multiset (xs @ [x]))
2 ^ (length (xs @ [x]) - 1) \<le> Suc (size (queue_to_multiset xs)) + 2 ^ rank x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
size (queue_to_multiset xs) + 2 ^ rank x \<le> size (queue_to_multiset (xs @ [x]))
2 ^ (length (xs @ [x]) - 1) \<le> Suc (size (queue_to_multiset xs)) + 2 ^ rank x

goal (1 subgoal):
 1. 2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
2 ^ (length (xs @ [x]) - 1) - 1 \<le> size (queue_to_multiset (xs @ [x]))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ocircline_set_opposite_ocircline [simp]:
  shows "ocircline_set (opposite_ocircline H) = ocircline_set H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ocircline_set (opposite_ocircline H) = ocircline_set H
[PROOF STEP]
unfolding ocircline_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Collect (on_ocircline (opposite_ocircline H)) = Collect (on_ocircline H)
[PROOF STEP]
by auto


[STATEMENT]
lemma gfp_star_least:
  assumes "\<And>u. u \<le> Omega_fun f g u \<Longrightarrow> u \<le> A"
  shows "star_fun f \<circ> g \<le> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. star_fun f \<circ> g \<le> A
[PROOF STEP]
apply (unfold star_fun_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gfp (Omega_fun f id) \<circ> g \<le> A
[PROOF STEP]
apply (simp add: gfp_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> {u. u \<le> Omega_fun f id u} \<circ> g \<le> A
[PROOF STEP]
apply (unfold Sup_comp_fun)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>m\<in>{u. u \<le> Omega_fun f id u}. m \<circ> g) \<le> A
[PROOF STEP]
apply (rule SUP_least)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. m \<in> {u. u \<le> Omega_fun f id u} \<Longrightarrow> m \<circ> g \<le> A
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. m \<le> Omega_fun f id m \<Longrightarrow> m \<circ> g \<le> A
[PROOF STEP]
apply (rule assms)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. m \<le> Omega_fun f id m \<Longrightarrow> m \<circ> g \<le> Omega_fun f g (m \<circ> g)
[PROOF STEP]
apply (simp add: le_fun_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem VSGeneral_3_times : "\<forall>xs. eval (VSGeneral_3_times \<phi>) xs = eval \<phi> xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>xs. eval (VSGeneral_3_times \<phi>) xs = eval \<phi> xs
[PROOF STEP]
unfolding  VSGeneral_3_times_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>xs. eval ((VSGeneral \<circ> VSGeneral \<circ> VSGeneral) \<phi>) xs = eval \<phi> xs
[PROOF STEP]
using VSGeneral
[PROOF STATE]
proof (prove)
using this:
\<forall>xs. eval (VSGeneral ?\<phi>) xs = eval ?\<phi> xs

goal (1 subgoal):
 1. \<forall>xs. eval ((VSGeneral \<circ> VSGeneral \<circ> VSGeneral) \<phi>) xs = eval \<phi> xs
[PROOF STEP]
by auto


[STATEMENT]
lemma compos_invfun_l:"\<lbrakk>f \<in> A \<rightarrow> B; bij_to f A B; g \<in> C \<rightarrow> B; h \<in> C \<rightarrow> A;
       compose C (invfun A B f) g = h; g \<in> extensional C \<rbrakk> \<Longrightarrow>
                     g = compose C f h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B; bij_to f A B; g \<in> C \<rightarrow> B; h \<in> C \<rightarrow> A; compose C (f\<inverse>\<^bsub>B,A\<^esub>) g = h; g \<in> extensional C\<rbrakk> \<Longrightarrow> g = compose C f h
[PROOF STEP]
apply (rule funcset_eq[of g C "compose C f h"], assumption)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>f \<in> A \<rightarrow> B; bij_to f A B; g \<in> C \<rightarrow> B; h \<in> C \<rightarrow> A; compose C (f\<inverse>\<^bsub>B,A\<^esub>) g = h; g \<in> extensional C\<rbrakk> \<Longrightarrow> compose C f h \<in> extensional C
 2. \<lbrakk>f \<in> A \<rightarrow> B; bij_to f A B; g \<in> C \<rightarrow> B; h \<in> C \<rightarrow> A; compose C (f\<inverse>\<^bsub>B,A\<^esub>) g = h; g \<in> extensional C\<rbrakk> \<Longrightarrow> \<forall>x\<in>C. g x = compose C f h x
[PROOF STEP]
apply (simp add:compose_def extensional_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B; bij_to f A B; g \<in> C \<rightarrow> B; h \<in> C \<rightarrow> A; compose C (f\<inverse>\<^bsub>B,A\<^esub>) g = h; g \<in> extensional C\<rbrakk> \<Longrightarrow> \<forall>x\<in>C. g x = compose C f h x
[PROOF STEP]
apply (rule ballI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>f \<in> A \<rightarrow> B; bij_to f A B; g \<in> C \<rightarrow> B; h \<in> C \<rightarrow> A; compose C (f\<inverse>\<^bsub>B,A\<^esub>) g = h; g \<in> extensional C; x \<in> C\<rbrakk> \<Longrightarrow> g x = compose C f h x
[PROOF STEP]
apply (frule sym, thin_tac "compose C (invfun A B f) g = h",
       simp add:compose_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>f \<in> A \<rightarrow> B; bij_to f A B; g \<in> C \<rightarrow> B; (\<lambda>x\<in>C. (f\<inverse>\<^bsub>B,A\<^esub>) (g x)) \<in> C \<rightarrow> A; g \<in> extensional C; x \<in> C; h = (\<lambda>x\<in>C. (f\<inverse>\<^bsub>B,A\<^esub>) (g x))\<rbrakk> \<Longrightarrow> g x = f ((f\<inverse>\<^bsub>B,A\<^esub>) (g x))
[PROOF STEP]
apply (frule_tac x = x in funcset_mem[of g C B], assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>f \<in> A \<rightarrow> B; bij_to f A B; g \<in> C \<rightarrow> B; (\<lambda>x\<in>C. (f\<inverse>\<^bsub>B,A\<^esub>) (g x)) \<in> C \<rightarrow> A; g \<in> extensional C; x \<in> C; h = (\<lambda>x\<in>C. (f\<inverse>\<^bsub>B,A\<^esub>) (g x)); g x \<in> B\<rbrakk> \<Longrightarrow> g x = f ((f\<inverse>\<^bsub>B,A\<^esub>) (g x))
[PROOF STEP]
apply (simp add:invfun_r1)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma size_le_if_child_subset: "xs |\<subseteq>| ys \<Longrightarrow> size (Node r xs) \<le> size (Node v ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs |\<subseteq>| ys \<Longrightarrow> size (Node r xs) \<le> size (Node v ys)
[PROOF STEP]
unfolding dtree_size_alt
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs |\<subseteq>| ys \<Longrightarrow> (\<Sum>(x, y)\<in>fset xs. size x + 2) + 1 \<le> (\<Sum>(x, y)\<in>fset ys. size x + 2) + 1
[PROOF STEP]
by (simp add: dtree_size_alt less_eq_fset.rep_eq sum.subset_diff)


[STATEMENT]
lemma countable_image_inj_on: "countable (f ` A) \<Longrightarrow> inj_on f A \<Longrightarrow> countable A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>countable (f ` A); inj_on f A\<rbrakk> \<Longrightarrow> countable A
[PROOF STEP]
by (metis countable_image the_inv_into_onto)


[STATEMENT]
lemma powr_neg_numeral: "0 < x \<Longrightarrow> x powr - numeral n = 1 / x ^ numeral n"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> x powr - numeral n = 1 / x ^ numeral n
[PROOF STEP]
using powr_int [of x "- numeral n"]
[PROOF STATE]
proof (prove)
using this:
0 < x \<Longrightarrow> x powr real_of_int (- numeral n) = (if 0 \<le> - numeral n then x ^ nat (- numeral n) else 1 / x ^ nat (- (- numeral n)))

goal (1 subgoal):
 1. 0 < x \<Longrightarrow> x powr - numeral n = 1 / x ^ numeral n
[PROOF STEP]
by simp


[STATEMENT]
lemma leq_trans: "\<lbrakk> (x, y) \<in> leq; (y, z) \<in> leq \<rbrakk> \<Longrightarrow> (x, z) \<in> leq"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(x, y) \<in> leq; (y, z) \<in> leq\<rbrakk> \<Longrightarrow> (x, z) \<in> leq
[PROOF STEP]
by(rule partial_order_on_trans[OF po])


[STATEMENT]
lemma sqrt_one [simp]: "sqrt 1 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.sqrt 1 = 1
[PROOF STEP]
using sqrt_inverse_power2 [of 1]
[PROOF STATE]
proof (prove)
using this:
local.sqrt (1\<^sup>2) = 1

goal (1 subgoal):
 1. local.sqrt 1 = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma norm_column_le_norm: "\<parallel>A $$ i\<parallel> \<le> \<parallel>A\<parallel>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>A $$ i\<parallel> \<le> \<parallel>A\<parallel>
[PROOF STEP]
using norm_vec_mult_le[of "A\<^sup>\<dagger>" "\<e> i"]
[PROOF STATE]
proof (prove)
using this:
\<parallel>A\<^sup>\<dagger> *\<^sub>V \<e> i\<parallel> \<le> \<parallel>A\<^sup>\<dagger>\<parallel> * \<parallel>\<e> i\<parallel>

goal (1 subgoal):
 1. \<parallel>A $$ i\<parallel> \<le> \<parallel>A\<parallel>
[PROOF STEP]
by simp


[STATEMENT]
lemma List_explode_def:
    "List_explode xss = concat (map (\<lambda>xs. if xs = [] then [None] else map Some xs) xss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. List_explode xss = concat (map (\<lambda>xs. if xs = [] then [None] else map Some xs) xss)
[PROOF STEP]
by(induction xss rule: List_explode.induct) simp+


[STATEMENT]
lemma integral_std_normal_moment_even:
  "integral\<^sup>L lborel (\<lambda>x. std_normal_density x * x^(2*k)) = fact (2 * k) / (2^k * fact k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LBINT x. std_normal_density x * x ^ (2 * k) = fact (2 * k) / (2 ^ k * fact k)
[PROOF STEP]
using std_normal_moment_even
[PROOF STATE]
proof (prove)
using this:
has_bochner_integral lborel (\<lambda>x. std_normal_density x * x ^ (2 * k)) (fact (2 * k) / (2 ^ k * fact k))

goal (1 subgoal):
 1. LBINT x. std_normal_density x * x ^ (2 * k) = fact (2 * k) / (2 ^ k * fact k)
[PROOF STEP]
by (rule has_bochner_integral_integral_eq)


[STATEMENT]
theorem make_vert_block_map_blockmat:
 "blockmat (make_vert_block n) = (mat1 (2^n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. blockmat (make_vert_block n) = mat1 (2 ^ n)
[PROOF STEP]
by (metis blockmat_make_vert make_vert_equiv_mat)


[STATEMENT]
lemma tan_pi [simp]: "tan pi = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tan pi = 0
[PROOF STEP]
by (simp add: tan_def)


[STATEMENT]
lemma basis_wf_Cons:
  "basis_wf (f # basis) \<longleftrightarrow>
     filterlim f at_top at_top \<and> (\<forall>g\<in>set basis. (\<lambda>x. ln (g x)) \<in> o(\<lambda>x. ln (f x))) \<and> basis_wf basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. basis_wf (f # basis) = (filterlim f at_top at_top \<and> (\<forall>g\<in>set basis. (\<lambda>x. ln (g x)) \<in> o(\<lambda>x. ln (f x))) \<and> basis_wf basis)
[PROOF STEP]
unfolding basis_wf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>f\<in>set (f # basis). filterlim f at_top at_top) \<and> sorted_wrt (\<lambda>f g. (\<lambda>x. ln (g x)) \<in> o(\<lambda>x. ln (f x))) (f # basis)) = (filterlim f at_top at_top \<and> (\<forall>g\<in>set basis. (\<lambda>x. ln (g x)) \<in> o(\<lambda>x. ln (f x))) \<and> (\<forall>f\<in>set basis. filterlim f at_top at_top) \<and> sorted_wrt (\<lambda>f g. (\<lambda>x. ln (g x)) \<in> o(\<lambda>x. ln (f x))) basis)
[PROOF STEP]
by auto


[STATEMENT]
lemma rank_Gauss_Jordan:
  fixes A::"'a::{field}^'n::{mod_type}^'m::{mod_type}"
  shows "rank A = rank (Gauss_Jordan A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A = rank (Gauss_Jordan A)
[PROOF STEP]
by (metis Gauss_Jordan_def invertible_Gauss_Jordan_up_to_k
      row_rank_eq_col_rank rank_def crk_is_preserved)


[STATEMENT]
lemma homotopy_eqv_rel_frontier_punctured_affine_hull:
  fixes S :: "'a::euclidean_space set"
  assumes "convex S" "bounded S" "a \<in> rel_interior S"
    shows "(rel_frontier S) homotopy_eqv (affine hull S - {a})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_frontier S homotopy_eqv affine hull S - {a}
[PROOF STEP]
apply (rule homotopy_eqv_rel_frontier_punctured_convex)
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. convex S
 2. bounded S
 3. a \<in> rel_interior S
 4. convex (affine hull S)
 5. rel_frontier S \<subseteq> affine hull S
 6. affine hull S \<subseteq> affine hull S
[PROOF STEP]
using assms rel_frontier_affine_hull
[PROOF STATE]
proof (prove)
using this:
convex S
bounded S
a \<in> rel_interior S
rel_frontier ?S \<subseteq> affine hull ?S

goal (6 subgoals):
 1. convex S
 2. bounded S
 3. a \<in> rel_interior S
 4. convex (affine hull S)
 5. rel_frontier S \<subseteq> affine hull S
 6. affine hull S \<subseteq> affine hull S
[PROOF STEP]
by force+


[STATEMENT]
lemma eucl_of_list_map_mult_right[simp]:
  assumes [simp]: "length xs = DIM('a::executable_euclidean_space)"
  shows "(eucl_of_list (map (\<lambda>x. f x * r) xs)::'a) = r *\<^sub>R eucl_of_list (map f xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eucl_of_list (map (\<lambda>x. f x * r) xs) = r *\<^sub>R eucl_of_list (map f xs)
[PROOF STEP]
by (auto intro!: euclidean_eqI[where 'a='a] simp: algebra_simps eucl_of_list_inner)


[STATEMENT]
lemma (in monoid_add) interv_sum_list_conv_sum_set_int:
  "sum_list (map f [k..l]) = sum f (set [k..l])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map f [k..l]) = sum f (set [k..l])
[PROOF STEP]
by (simp add: sum_list_distinct_conv_sum_set)


[STATEMENT]
lemma resultant_0[simp]:
  fixes p :: "'a :: comm_ring_1 poly"
  assumes "degree p > 0"
  shows "resultant 0 p = 0" "resultant p 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. resultant 0 p = (0::'a) &&& resultant p 0 = (0::'a)
[PROOF STEP]
using resultant_const(1)[of 0 p] resultant_const(2)[of p 0]
[PROOF STATE]
proof (prove)
using this:
resultant [:0::'a:] p = (0::'a) ^ degree p
resultant p [:0::'a:] = (0::'a) ^ degree p

goal (1 subgoal):
 1. resultant 0 p = (0::'a) &&& resultant p 0 = (0::'a)
[PROOF STEP]
using zero_power assms
[PROOF STATE]
proof (prove)
using this:
resultant [:0::'a:] p = (0::'a) ^ degree p
resultant p [:0::'a:] = (0::'a) ^ degree p
0 < ?n \<Longrightarrow> (0::?'a) ^ ?n = (0::?'a)
0 < degree p

goal (1 subgoal):
 1. resultant 0 p = (0::'a) &&& resultant p 0 = (0::'a)
[PROOF STEP]
by auto


[STATEMENT]
lemma union_list_nodes_card:
    assumes "list_all (finite \<circ> DCA.nodes) AA"
    shows "card (DCA.nodes (union_list AA)) \<le> max 1 (length AA) * prod_list (map (card \<circ> DCA.nodes) AA)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (DCA.nodes (union_list AA)) \<le> max 1 (length AA) * prod_list (map (card \<circ> DCA.nodes) AA)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (DCA.nodes (union_list AA)) \<le> max 1 (length AA) * prod_list (map (card \<circ> DCA.nodes) AA)
[PROOF STEP]
have "card (DCA.nodes (union_list AA)) \<le>
      max 1 (length (dgca.rejecting (union_list' AA))) * card (DGCA.nodes (union_list' AA))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (DCA.nodes (union_list AA)) \<le> max 1 (length (dgca.rejecting (union_list' AA))) * card (DGCA.nodes (union_list' AA))
[PROOF STEP]
using degeneralize_nodes_card
[PROOF STATE]
proof (prove)
using this:
card (DCA.nodes (degeneralize ?A)) \<le> max 1 (length (dgca.rejecting ?A)) * card (DGCA.nodes ?A)

goal (1 subgoal):
 1. card (DCA.nodes (union_list AA)) \<le> max 1 (length (dgca.rejecting (union_list' AA))) * card (DGCA.nodes (union_list' AA))
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
card (DCA.nodes (union_list AA)) \<le> max 1 (length (dgca.rejecting (union_list' AA))) * card (DGCA.nodes (union_list' AA))

goal (1 subgoal):
 1. card (DCA.nodes (union_list AA)) \<le> max 1 (length AA) * prod_list (map (card \<circ> DCA.nodes) AA)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (DCA.nodes (union_list AA)) \<le> max 1 (length (dgca.rejecting (union_list' AA))) * card (DGCA.nodes (union_list' AA))

goal (1 subgoal):
 1. card (DCA.nodes (union_list AA)) \<le> max 1 (length AA) * prod_list (map (card \<circ> DCA.nodes) AA)
[PROOF STEP]
have "length (dgca.rejecting (union_list' AA)) = length AA"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (dgca.rejecting (union_list' AA)) = length AA
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (dgca.rejecting (union_list' AA)) = length AA

goal (1 subgoal):
 1. card (DCA.nodes (union_list AA)) \<le> max 1 (length AA) * prod_list (map (card \<circ> DCA.nodes) AA)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
length (dgca.rejecting (union_list' AA)) = length AA

goal (1 subgoal):
 1. card (DCA.nodes (union_list AA)) \<le> max 1 (length AA) * prod_list (map (card \<circ> DCA.nodes) AA)
[PROOF STEP]
have "card (DGCA.nodes (union_list' AA)) \<le> prod_list (map (card \<circ> DCA.nodes) AA)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (DGCA.nodes (union_list' AA)) \<le> prod_list (map (card \<circ> DCA.nodes) AA)
[PROOF STEP]
using union_list'_nodes_card assms
[PROOF STATE]
proof (prove)
using this:
list_all (finite \<circ> DCA.nodes) ?AA \<Longrightarrow> card (DGCA.nodes (union_list' ?AA)) \<le> prod_list (map (card \<circ> DCA.nodes) ?AA)
list_all (finite \<circ> DCA.nodes) AA

goal (1 subgoal):
 1. card (DGCA.nodes (union_list' AA)) \<le> prod_list (map (card \<circ> DCA.nodes) AA)
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
card (DGCA.nodes (union_list' AA)) \<le> prod_list (map (card \<circ> DCA.nodes) AA)

goal (1 subgoal):
 1. card (DCA.nodes (union_list AA)) \<le> max 1 (length AA) * prod_list (map (card \<circ> DCA.nodes) AA)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x \<le> y \<Longrightarrow> max 1 (length AA) * x \<le> max 1 (length AA) * y) \<Longrightarrow> card (DCA.nodes (union_list AA)) \<le> max 1 (length AA) * prod_list (map (card \<circ> DCA.nodes) AA)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> max 1 (length AA) * x \<le> max 1 (length AA) * y) \<Longrightarrow> card (DCA.nodes (union_list AA)) \<le> max 1 (length AA) * prod_list (map (card \<circ> DCA.nodes) AA)

goal (1 subgoal):
 1. card (DCA.nodes (union_list AA)) \<le> max 1 (length AA) * prod_list (map (card \<circ> DCA.nodes) AA)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (DCA.nodes (union_list AA)) \<le> max 1 (length AA) * prod_list (map (card \<circ> DCA.nodes) AA)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_monom: "monom a m * monom b n = monom (a * b) (m + n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom a m * monom b n = monom (a * b) (m + n)
[PROOF STEP]
by (induct m) (simp add: monom_0 smult_monom, simp add: monom_Suc)


[STATEMENT]
lemma add_edge_is_connected:
    "nodes_connected (add_edge a b c G) a c"
    "nodes_connected (add_edge a b c G) c a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nodes_connected (add_edge a b c G) a c &&& nodes_connected (add_edge a b c G) c a
[PROOF STEP]
using valid_graph.is_path_undir_simps(2)[OF
        add_edge_valid[OF valid_graph_axioms], of a b c a b c]
      valid_graph.is_path_undir_simps(2)[OF
        add_edge_valid[OF valid_graph_axioms], of a b c c b a]
[PROOF STATE]
proof (prove)
using this:
is_path_undir (add_edge a b c G) a [(a, b, c)] c = ((a, b, c) \<in> edges (add_edge a b c G) \<or> (c, b, a) \<in> edges (add_edge a b c G))
is_path_undir (add_edge a b c G) c [(c, b, a)] a = ((c, b, a) \<in> edges (add_edge a b c G) \<or> (a, b, c) \<in> edges (add_edge a b c G))

goal (1 subgoal):
 1. nodes_connected (add_edge a b c G) a c &&& nodes_connected (add_edge a b c G) c a
[PROOF STEP]
by fastforce+


[STATEMENT]
lemma set_integrable_bound:
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
    and g :: "'a \<Rightarrow> 'c::{banach, second_countable_topology}"
  assumes "set_integrable M A f" "set_borel_measurable M A g"
  assumes "AE x in M. x \<in> A \<longrightarrow> norm (g x) \<le> norm (f x)"
  shows   "set_integrable M A g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable M A g
[PROOF STEP]
unfolding set_integrable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (\<lambda>x. indicat_real A x *\<^sub>R g x)
[PROOF STEP]
proof (rule Bochner_Integration.integrable_bound)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. integrable M ?f
 2. (\<lambda>x. indicat_real A x *\<^sub>R g x) \<in> borel_measurable M
 3. AE x in M. norm (indicat_real A x *\<^sub>R g x) \<le> norm (?f x)
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
set_integrable M A f
[PROOF STEP]
show "integrable M (\<lambda>x. indicator A x *\<^sub>R f x)"
[PROOF STATE]
proof (prove)
using this:
set_integrable M A f

goal (1 subgoal):
 1. integrable M (\<lambda>x. indicat_real A x *\<^sub>R f x)
[PROOF STEP]
by (simp add: set_integrable_def)
[PROOF STATE]
proof (state)
this:
integrable M (\<lambda>x. indicat_real A x *\<^sub>R f x)

goal (2 subgoals):
 1. (\<lambda>x. indicat_real A x *\<^sub>R g x) \<in> borel_measurable M
 2. AE x in M. norm (indicat_real A x *\<^sub>R g x) \<le> norm (indicat_real A x *\<^sub>R f x)
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
set_borel_measurable M A g
[PROOF STEP]
show "(\<lambda>x. indicat_real A x *\<^sub>R g x) \<in> borel_measurable M"
[PROOF STATE]
proof (prove)
using this:
set_borel_measurable M A g

goal (1 subgoal):
 1. (\<lambda>x. indicat_real A x *\<^sub>R g x) \<in> borel_measurable M
[PROOF STEP]
by (simp add: set_borel_measurable_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. indicat_real A x *\<^sub>R g x) \<in> borel_measurable M

goal (1 subgoal):
 1. AE x in M. norm (indicat_real A x *\<^sub>R g x) \<le> norm (indicat_real A x *\<^sub>R f x)
[PROOF STEP]
from assms(3)
[PROOF STATE]
proof (chain)
picking this:
AE x\<in>A in M. norm (g x) \<le> norm (f x)
[PROOF STEP]
show "AE x in M. norm (indicat_real A x *\<^sub>R g x) \<le> norm (indicat_real A x *\<^sub>R f x)"
[PROOF STATE]
proof (prove)
using this:
AE x\<in>A in M. norm (g x) \<le> norm (f x)

goal (1 subgoal):
 1. AE x in M. norm (indicat_real A x *\<^sub>R g x) \<le> norm (indicat_real A x *\<^sub>R f x)
[PROOF STEP]
by eventually_elim (simp add: indicator_def)
[PROOF STATE]
proof (state)
this:
AE x in M. norm (indicat_real A x *\<^sub>R g x) \<le> norm (indicat_real A x *\<^sub>R f x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_split_bst1: "bst t \<Longrightarrow> set_tree (fst (split_bst x t)) = {y \<in> set_tree t. y < x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bst t \<Longrightarrow> set_tree (fst (split_bst x t)) = {y \<in> set_tree t. y < x}
[PROOF STEP]
by (induction t) (auto split: prod.splits)


[STATEMENT]
lemma path_connected_component: "path_connected S \<longleftrightarrow> (\<forall>x\<in>S. \<forall>y\<in>S. path_component S x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_connected S = (\<forall>x\<in>S. \<forall>y\<in>S. path_component S x y)
[PROOF STEP]
unfolding path_connected_def path_component_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>S. \<forall>y\<in>S. \<exists>g. path g \<and> path_image g \<subseteq> S \<and> pathstart g = x \<and> pathfinish g = y) = (\<forall>x\<in>S. \<forall>y\<in>S. \<exists>g. path g \<and> path_image g \<subseteq> S \<and> pathstart g = x \<and> pathfinish g = y)
[PROOF STEP]
by auto


[STATEMENT]
lemma subcocycle_avg_cmult:
  assumes "subcocycle u" "c \<ge> (0::real)" "subcocycle_avg_ereal u > - \<infinity>"
  shows "subcocycle_avg_ereal (\<lambda>n x. c * u n x) > - \<infinity>"
        "subcocycle_avg (\<lambda>n x. c * u n x) = c * subcocycle_avg u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - \<infinity> < subcocycle_avg_ereal (\<lambda>n x. c * u n x) &&& subcocycle_avg (\<lambda>n x. c * u n x) = c * subcocycle_avg u
[PROOF STEP]
using assms subcocycle_avg_finite
[PROOF STATE]
proof (prove)
using this:
subcocycle u
0 \<le> c
- \<infinity> < subcocycle_avg_ereal u
subcocycle_avg_ereal ?u < \<infinity>

goal (1 subgoal):
 1. - \<infinity> < subcocycle_avg_ereal (\<lambda>n x. c * u n x) &&& subcocycle_avg (\<lambda>n x. c * u n x) = c * subcocycle_avg u
[PROOF STEP]
unfolding subcocycle_avg_def subcocycle_avg_ereal_cmult[OF assms(1) assms(2)]
[PROOF STATE]
proof (prove)
using this:
subcocycle u
0 \<le> c
- \<infinity> < subcocycle_avg_ereal u
subcocycle_avg_ereal ?u < \<infinity>

goal (1 subgoal):
 1. - \<infinity> < ereal c * subcocycle_avg_ereal u &&& real_of_ereal (ereal c * subcocycle_avg_ereal u) = c * real_of_ereal (subcocycle_avg_ereal u)
[PROOF STEP]
by auto


[STATEMENT]
lemma [simp]: "dim_col (mat_adjoint m) = dim_row m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (mat_adjoint m) = dim_row m
[PROOF STEP]
unfolding mat_adjoint_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (mat_of_rows (dim_row m) (map conjugate (cols m))) = dim_row m
[PROOF STEP]
by simp


[STATEMENT]
lemma  (in Group) Nfunc_LeastTr2_4:"\<lbrakk>\<forall>l \<le> (n::nat). G \<guillemotright> f l; \<forall>l \<le> n. G \<guillemotright> g l;
      i \<le> n; f i \<noteq> g i\<rbrakk> \<Longrightarrow>(LEAST k. (f k \<noteq> g k)) \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>l\<le>n. G \<guillemotright> f l ; \<forall>l\<le>n. G \<guillemotright> g l ; i \<le> n; f i \<noteq> g i\<rbrakk> \<Longrightarrow> (LEAST k. f k \<noteq> g k) \<le> n
[PROOF STEP]
apply (frule_tac i = i in Nfunc_LeastTr2_2 [of  _ "n" "f" "g"],
                                      assumption+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>l\<le>n. G \<guillemotright> f l ; \<forall>l\<le>n. G \<guillemotright> g l ; i \<le> n; f i \<noteq> g i\<rbrakk> \<Longrightarrow> NfuncPair_neq_at f g i
 2. \<lbrakk>\<forall>l\<le>n. G \<guillemotright> f l ; \<forall>l\<le>n. G \<guillemotright> g l ; i \<le> n; f i \<noteq> g i; (LEAST k. NfuncPair_neq_at f g k) \<le> i\<rbrakk> \<Longrightarrow> (LEAST k. f k \<noteq> g k) \<le> n
[PROOF STEP]
apply (simp add:NfuncPair_neq_at_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>l\<le>n. G \<guillemotright> f l ; \<forall>l\<le>n. G \<guillemotright> g l ; i \<le> n; f i \<noteq> g i; (LEAST k. NfuncPair_neq_at f g k) \<le> i\<rbrakk> \<Longrightarrow> (LEAST k. f k \<noteq> g k) \<le> n
[PROOF STEP]
apply (frule le_trans [of "(LEAST k. NfuncPair_neq_at f g k)" "i" "n"],
                                  assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>l\<le>n. G \<guillemotright> f l ; \<forall>l\<le>n. G \<guillemotright> g l ; i \<le> n; f i \<noteq> g i; (LEAST k. NfuncPair_neq_at f g k) \<le> i; (LEAST k. NfuncPair_neq_at f g k) \<le> n\<rbrakk> \<Longrightarrow> (LEAST k. f k \<noteq> g k) \<le> n
[PROOF STEP]
apply (simp add:NfuncPair_neq_at_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma has_integral_cmult_real:
  fixes c :: real
  assumes "c \<noteq> 0 \<Longrightarrow> (f has_integral x) A"
  shows "((\<lambda>x. c * f x) has_integral c * x) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. c * f x) has_integral c * x) A
[PROOF STEP]
proof (cases "c = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. c * f x) has_integral c * x) A
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. c * f x) has_integral c * x) A
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
c = 0

goal (2 subgoals):
 1. c = 0 \<Longrightarrow> ((\<lambda>x. c * f x) has_integral c * x) A
 2. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. c * f x) has_integral c * x) A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c = 0

goal (1 subgoal):
 1. ((\<lambda>x. c * f x) has_integral c * x) A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>x. c * f x) has_integral c * x) A

goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. c * f x) has_integral c * x) A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. c * f x) has_integral c * x) A
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
c \<noteq> 0

goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> ((\<lambda>x. c * f x) has_integral c * x) A
[PROOF STEP]
from has_integral_cmul[OF assms[OF this], of c]
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. c *\<^sub>R f x) has_integral c *\<^sub>R x) A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. c *\<^sub>R f x) has_integral c *\<^sub>R x) A

goal (1 subgoal):
 1. ((\<lambda>x. c * f x) has_integral c * x) A
[PROOF STEP]
unfolding real_scaleR_def
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. c * f x) has_integral c * x) A

goal (1 subgoal):
 1. ((\<lambda>x. c * f x) has_integral c * x) A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((\<lambda>x. c * f x) has_integral c * x) A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma select_index_with_1:
  fixes n:: nat
  assumes "n \<ge> 1"
  shows "\<forall>k. k < 2^(n+1) \<longrightarrow> k \<ge> 2 \<longrightarrow> (\<exists>i<n. select_index (n+1) i k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>k<2 ^ (n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n + 1) i k)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> n

goal (1 subgoal):
 1. \<forall>k<2 ^ (n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n + 1) i k)
[PROOF STEP]
proof(rule nat_induct_at_least)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>k<2 ^ (1 + 1). 2 \<le> k \<longrightarrow> (\<exists>i<1. select_index (1 + 1) i k)
 2. \<And>n. \<lbrakk>1 \<le> n; \<forall>k<2 ^ (n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n + 1) i k)\<rbrakk> \<Longrightarrow> \<forall>k<2 ^ (Suc n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<Suc n. select_index (Suc n + 1) i k)
[PROOF STEP]
show "\<forall>k< 2^(1+1). 2 \<le> k \<longrightarrow> (\<exists>i<1. select_index (1+1) i k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>k<2 ^ (1 + 1). 2 \<le> k \<longrightarrow> (\<exists>i<1. select_index (1 + 1) i k)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>k<2 ^ (1 + 1). 2 \<le> k \<longrightarrow> (\<exists>i<1. select_index (1 + 1) i k)
[PROOF STEP]
have "select_index 2 0 2 = True"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. select_index 2 0 2 = True
[PROOF STEP]
using select_index_def
[PROOF STATE]
proof (prove)
using this:
select_index ?n ?i ?j \<equiv> ?i \<le> ?n - 1 \<and> ?j \<le> 2 ^ ?n - 1 \<and> 2 ^ (?n - 1 - ?i) \<le> ?j mod 2 ^ (?n - ?i)

goal (1 subgoal):
 1. select_index 2 0 2 = True
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
select_index 2 0 2 = True

goal (1 subgoal):
 1. \<forall>k<2 ^ (1 + 1). 2 \<le> k \<longrightarrow> (\<exists>i<1. select_index (1 + 1) i k)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
select_index 2 0 2 = True

goal (1 subgoal):
 1. \<forall>k<2 ^ (1 + 1). 2 \<le> k \<longrightarrow> (\<exists>i<1. select_index (1 + 1) i k)
[PROOF STEP]
have "select_index 2 0 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. select_index 2 0 3
[PROOF STEP]
using select_index_def
[PROOF STATE]
proof (prove)
using this:
select_index ?n ?i ?j \<equiv> ?i \<le> ?n - 1 \<and> ?j \<le> 2 ^ ?n - 1 \<and> 2 ^ (?n - 1 - ?i) \<le> ?j mod 2 ^ (?n - ?i)

goal (1 subgoal):
 1. select_index 2 0 3
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
select_index 2 0 3

goal (1 subgoal):
 1. \<forall>k<2 ^ (1 + 1). 2 \<le> k \<longrightarrow> (\<exists>i<1. select_index (1 + 1) i k)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
select_index 2 0 2 = True
select_index 2 0 3
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
select_index 2 0 2 = True
select_index 2 0 3

goal (1 subgoal):
 1. \<forall>k<2 ^ (1 + 1). 2 \<le> k \<longrightarrow> (\<exists>i<1. select_index (1 + 1) i k)
[PROOF STEP]
by (metis Suc_leI add_Suc_shift le_eq_less_or_eq mult_2 not_less one_add_one one_plus_numeral
plus_1_eq_Suc power.simps(2) power_one_right semiring_norm(3) zero_less_one_class.zero_less_one)
[PROOF STATE]
proof (state)
this:
\<forall>k<2 ^ (1 + 1). 2 \<le> k \<longrightarrow> (\<exists>i<1. select_index (1 + 1) i k)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>k<2 ^ (1 + 1). 2 \<le> k \<longrightarrow> (\<exists>i<1. select_index (1 + 1) i k)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; \<forall>k<2 ^ (n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n + 1) i k)\<rbrakk> \<Longrightarrow> \<forall>k<2 ^ (Suc n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<Suc n. select_index (Suc n + 1) i k)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; \<forall>k<2 ^ (n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n + 1) i k)\<rbrakk> \<Longrightarrow> \<forall>k<2 ^ (Suc n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<Suc n. select_index (Suc n + 1) i k)
[PROOF STEP]
show "\<And>n. 1 \<le> n \<Longrightarrow>
         \<forall>k < 2^(n+1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n+1) i k) \<Longrightarrow>
         \<forall>k < 2^(Suc n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<Suc n. select_index (Suc n +1) i k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; \<forall>k<2 ^ (n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n + 1) i k)\<rbrakk> \<Longrightarrow> \<forall>k<2 ^ (Suc n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<Suc n. select_index (Suc n + 1) i k)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; \<forall>k<2 ^ (n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n + 1) i k)\<rbrakk> \<Longrightarrow> \<forall>k<2 ^ (Suc n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<Suc n. select_index (Suc n + 1) i k)
[PROOF STEP]
fix n:: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; \<forall>k<2 ^ (n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n + 1) i k)\<rbrakk> \<Longrightarrow> \<forall>k<2 ^ (Suc n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<Suc n. select_index (Suc n + 1) i k)
[PROOF STEP]
assume asm:"n \<ge> 1" and IH:"\<forall>k < 2^(n+1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n+1) i k)"
[PROOF STATE]
proof (state)
this:
1 \<le> n
\<forall>k<2 ^ (n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n + 1) i k)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; \<forall>k<2 ^ (n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n + 1) i k)\<rbrakk> \<Longrightarrow> \<forall>k<2 ^ (Suc n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<Suc n. select_index (Suc n + 1) i k)
[PROOF STEP]
have "select_index (Suc n + 1) n 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. select_index (Suc n + 1) n 2
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. select_index (Suc n + 1) n 2
[PROOF STEP]
have "select_index (Suc n) n 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. select_index (Suc n) n 1
[PROOF STEP]
using select_index_def
[PROOF STATE]
proof (prove)
using this:
select_index ?n ?i ?j \<equiv> ?i \<le> ?n - 1 \<and> ?j \<le> 2 ^ ?n - 1 \<and> 2 ^ (?n - 1 - ?i) \<le> ?j mod 2 ^ (?n - ?i)

goal (1 subgoal):
 1. select_index (Suc n) n 1
[PROOF STEP]
by(smt Suc_1 Suc_diff_Suc Suc_lessI add_diff_cancel_right' diff_Suc_1
diff_commute diff_zero le_eq_less_or_eq less_Suc_eq_le nat.simps(3) nat_power_eq_Suc_0_iff
one_mod_two_eq_one plus_1_eq_Suc power_one_right zero_less_power)
[PROOF STATE]
proof (state)
this:
select_index (Suc n) n 1

goal (1 subgoal):
 1. select_index (Suc n + 1) n 2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
select_index (Suc n) n 1

goal (1 subgoal):
 1. select_index (Suc n + 1) n 2
[PROOF STEP]
using select_index_suc_even
[PROOF STATE]
proof (prove)
using this:
select_index (Suc n) n 1
\<lbrakk>?k < 2 ^ ?n; select_index ?n ?i ?k\<rbrakk> \<Longrightarrow> select_index (Suc ?n) ?i (2 * ?k)

goal (1 subgoal):
 1. select_index (Suc n + 1) n 2
[PROOF STEP]
by (metis Suc_eq_plus1 less_numeral_extra(4) mult_2 not_less_less_Suc_eq one_add_one one_less_power zero_less_Suc)
[PROOF STATE]
proof (state)
this:
select_index (Suc n + 1) n 2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
select_index (Suc n + 1) n 2

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; \<forall>k<2 ^ (n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n + 1) i k)\<rbrakk> \<Longrightarrow> \<forall>k<2 ^ (Suc n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<Suc n. select_index (Suc n + 1) i k)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
select_index (Suc n + 1) n 2

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; \<forall>k<2 ^ (n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n + 1) i k)\<rbrakk> \<Longrightarrow> \<forall>k<2 ^ (Suc n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<Suc n. select_index (Suc n + 1) i k)
[PROOF STEP]
have "select_index (Suc n + 1) n 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. select_index (Suc n + 1) n 3
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. select_index (Suc n + 1) n 3
[PROOF STEP]
have "select_index (Suc n) n 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. select_index (Suc n) n 1
[PROOF STEP]
using select_index_def
[PROOF STATE]
proof (prove)
using this:
select_index ?n ?i ?j \<equiv> ?i \<le> ?n - 1 \<and> ?j \<le> 2 ^ ?n - 1 \<and> 2 ^ (?n - 1 - ?i) \<le> ?j mod 2 ^ (?n - ?i)

goal (1 subgoal):
 1. select_index (Suc n) n 1
[PROOF STEP]
by(smt Suc_1 Suc_diff_Suc Suc_lessI add_diff_cancel_right' diff_Suc_1
diff_commute diff_zero le_eq_less_or_eq less_Suc_eq_le nat.simps(3) nat_power_eq_Suc_0_iff
one_mod_two_eq_one plus_1_eq_Suc power_one_right zero_less_power)
[PROOF STATE]
proof (state)
this:
select_index (Suc n) n 1

goal (1 subgoal):
 1. select_index (Suc n + 1) n 3
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
select_index (Suc n) n 1

goal (1 subgoal):
 1. select_index (Suc n + 1) n 3
[PROOF STEP]
using select_index_suc_odd
[PROOF STATE]
proof (prove)
using this:
select_index (Suc n) n 1
\<lbrakk>?k \<le> 2 ^ ?n - 1; select_index ?n ?i ?k\<rbrakk> \<Longrightarrow> select_index (Suc ?n) ?i (2 * ?k + 1)

goal (1 subgoal):
 1. select_index (Suc n + 1) n 3
[PROOF STEP]
by (metis One_nat_def Suc_eq_plus1 mult_2 numeral_3_eq_3 select_index_def)
[PROOF STATE]
proof (state)
this:
select_index (Suc n + 1) n 3

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
select_index (Suc n + 1) n 3

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; \<forall>k<2 ^ (n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n + 1) i k)\<rbrakk> \<Longrightarrow> \<forall>k<2 ^ (Suc n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<Suc n. select_index (Suc n + 1) i k)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
select_index (Suc n + 1) n 3

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; \<forall>k<2 ^ (n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n + 1) i k)\<rbrakk> \<Longrightarrow> \<forall>k<2 ^ (Suc n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<Suc n. select_index (Suc n + 1) i k)
[PROOF STEP]
have "\<exists>i<Suc n. select_index (Suc n +1) i (2*k)" if "k \<ge> 2" and "k \<le> 2^(n + 1)-1" for k:: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i<Suc n. select_index (Suc n + 1) i (2 * k)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>i<Suc n. select_index (Suc n + 1) i (2 * k)
[PROOF STEP]
obtain i where "i<n" and "select_index (n+1) i k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i < n; select_index (n + 1) i k\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using IH
[PROOF STATE]
proof (prove)
using this:
\<forall>k<2 ^ (n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n + 1) i k)

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i < n; select_index (n + 1) i k\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by(metis One_nat_def Suc_diff_Suc \<open>2 \<le> k\<close> \<open>k \<le> 2 ^ (n + 1) - 1\<close> diff_zero le_imp_less_Suc pos2 zero_less_power)
[PROOF STATE]
proof (state)
this:
i < n
select_index (n + 1) i k

goal (1 subgoal):
 1. \<exists>i<Suc n. select_index (Suc n + 1) i (2 * k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < n
select_index (n + 1) i k
[PROOF STEP]
have "select_index (Suc n +1) i (2*k)"
[PROOF STATE]
proof (prove)
using this:
i < n
select_index (n + 1) i k

goal (1 subgoal):
 1. select_index (Suc n + 1) i (2 * k)
[PROOF STEP]
using select_index_suc_even
[PROOF STATE]
proof (prove)
using this:
i < n
select_index (n + 1) i k
\<lbrakk>?k < 2 ^ ?n; select_index ?n ?i ?k\<rbrakk> \<Longrightarrow> select_index (Suc ?n) ?i (2 * ?k)

goal (1 subgoal):
 1. select_index (Suc n + 1) i (2 * k)
[PROOF STEP]
by (metis One_nat_def Suc_diff_Suc add.commute diff_zero le_imp_less_Suc plus_1_eq_Suc pos2 that(2) zero_less_power)
[PROOF STATE]
proof (state)
this:
select_index (Suc n + 1) i (2 * k)

goal (1 subgoal):
 1. \<exists>i<Suc n. select_index (Suc n + 1) i (2 * k)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
select_index (Suc n + 1) i (2 * k)

goal (1 subgoal):
 1. \<exists>i<Suc n. select_index (Suc n + 1) i (2 * k)
[PROOF STEP]
using \<open>i < n\<close> less_SucI
[PROOF STATE]
proof (prove)
using this:
select_index (Suc n + 1) i (2 * k)
i < n
?m < ?n \<Longrightarrow> ?m < Suc ?n

goal (1 subgoal):
 1. \<exists>i<Suc n. select_index (Suc n + 1) i (2 * k)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>i<Suc n. select_index (Suc n + 1) i (2 * k)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>2 \<le> ?k; ?k \<le> 2 ^ (n + 1) - 1\<rbrakk> \<Longrightarrow> \<exists>i<Suc n. select_index (Suc n + 1) i (2 * ?k)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; \<forall>k<2 ^ (n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n + 1) i k)\<rbrakk> \<Longrightarrow> \<forall>k<2 ^ (Suc n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<Suc n. select_index (Suc n + 1) i k)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<lbrakk>2 \<le> ?k; ?k \<le> 2 ^ (n + 1) - 1\<rbrakk> \<Longrightarrow> \<exists>i<Suc n. select_index (Suc n + 1) i (2 * ?k)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; \<forall>k<2 ^ (n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n + 1) i k)\<rbrakk> \<Longrightarrow> \<forall>k<2 ^ (Suc n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<Suc n. select_index (Suc n + 1) i k)
[PROOF STEP]
have "\<exists>i<Suc n. select_index (Suc n +1) i (2*k +1)" if "k \<ge> 2" and "k \<le> 2^(n + 1)-1" for k:: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i<Suc n. select_index (Suc n + 1) i (2 * k + 1)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>i<Suc n. select_index (Suc n + 1) i (2 * k + 1)
[PROOF STEP]
obtain i where "i<n" and "select_index (n+1) i k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i < n; select_index (n + 1) i k\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using IH
[PROOF STATE]
proof (prove)
using this:
\<forall>k<2 ^ (n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n + 1) i k)

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i < n; select_index (n + 1) i k\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by(metis One_nat_def Suc_diff_Suc \<open>2 \<le> k\<close> \<open>k \<le> 2 ^ (n + 1) - 1\<close> diff_zero le_imp_less_Suc pos2 zero_less_power)
[PROOF STATE]
proof (state)
this:
i < n
select_index (n + 1) i k

goal (1 subgoal):
 1. \<exists>i<Suc n. select_index (Suc n + 1) i (2 * k + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < n
select_index (n + 1) i k
[PROOF STEP]
have "select_index (Suc n +1) i (2*k+1)"
[PROOF STATE]
proof (prove)
using this:
i < n
select_index (n + 1) i k

goal (1 subgoal):
 1. select_index (Suc n + 1) i (2 * k + 1)
[PROOF STEP]
using select_index_suc_odd that(2)
[PROOF STATE]
proof (prove)
using this:
i < n
select_index (n + 1) i k
\<lbrakk>?k \<le> 2 ^ ?n - 1; select_index ?n ?i ?k\<rbrakk> \<Longrightarrow> select_index (Suc ?n) ?i (2 * ?k + 1)
k \<le> 2 ^ (n + 1) - 1

goal (1 subgoal):
 1. select_index (Suc n + 1) i (2 * k + 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
select_index (Suc n + 1) i (2 * k + 1)

goal (1 subgoal):
 1. \<exists>i<Suc n. select_index (Suc n + 1) i (2 * k + 1)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
select_index (Suc n + 1) i (2 * k + 1)

goal (1 subgoal):
 1. \<exists>i<Suc n. select_index (Suc n + 1) i (2 * k + 1)
[PROOF STEP]
using \<open>i < n\<close> less_SucI
[PROOF STATE]
proof (prove)
using this:
select_index (Suc n + 1) i (2 * k + 1)
i < n
?m < ?n \<Longrightarrow> ?m < Suc ?n

goal (1 subgoal):
 1. \<exists>i<Suc n. select_index (Suc n + 1) i (2 * k + 1)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>i<Suc n. select_index (Suc n + 1) i (2 * k + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>2 \<le> ?k; ?k \<le> 2 ^ (n + 1) - 1\<rbrakk> \<Longrightarrow> \<exists>i<Suc n. select_index (Suc n + 1) i (2 * ?k + 1)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; \<forall>k<2 ^ (n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<n. select_index (n + 1) i k)\<rbrakk> \<Longrightarrow> \<forall>k<2 ^ (Suc n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<Suc n. select_index (Suc n + 1) i k)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
select_index (Suc n + 1) n 2
select_index (Suc n + 1) n 3
\<lbrakk>2 \<le> ?k; ?k \<le> 2 ^ (n + 1) - 1\<rbrakk> \<Longrightarrow> \<exists>i<Suc n. select_index (Suc n + 1) i (2 * ?k)
\<lbrakk>2 \<le> ?k; ?k \<le> 2 ^ (n + 1) - 1\<rbrakk> \<Longrightarrow> \<exists>i<Suc n. select_index (Suc n + 1) i (2 * ?k + 1)
[PROOF STEP]
show "\<forall>k< 2^(Suc n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<Suc n. select_index (Suc n +1) i k)"
[PROOF STATE]
proof (prove)
using this:
select_index (Suc n + 1) n 2
select_index (Suc n + 1) n 3
\<lbrakk>2 \<le> ?k; ?k \<le> 2 ^ (n + 1) - 1\<rbrakk> \<Longrightarrow> \<exists>i<Suc n. select_index (Suc n + 1) i (2 * ?k)
\<lbrakk>2 \<le> ?k; ?k \<le> 2 ^ (n + 1) - 1\<rbrakk> \<Longrightarrow> \<exists>i<Suc n. select_index (Suc n + 1) i (2 * ?k + 1)

goal (1 subgoal):
 1. \<forall>k<2 ^ (Suc n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<Suc n. select_index (Suc n + 1) i k)
[PROOF STEP]
using aux_range
[PROOF STATE]
proof (prove)
using this:
select_index (Suc n + 1) n 2
select_index (Suc n + 1) n 3
\<lbrakk>2 \<le> ?k; ?k \<le> 2 ^ (n + 1) - 1\<rbrakk> \<Longrightarrow> \<exists>i<Suc n. select_index (Suc n + 1) i (2 * ?k)
\<lbrakk>2 \<le> ?k; ?k \<le> 2 ^ (n + 1) - 1\<rbrakk> \<Longrightarrow> \<exists>i<Suc n. select_index (Suc n + 1) i (2 * ?k + 1)
\<lbrakk>?k < 2 ^ (Suc ?n + 1); 2 \<le> ?k\<rbrakk> \<Longrightarrow> ?k = 2 \<or> ?k = 3 \<or> (\<exists>l\<ge>2. l \<le> 2 ^ (?n + 1) - 1 \<and> (?k = 2 * l \<or> ?k = 2 * l + 1))

goal (1 subgoal):
 1. \<forall>k<2 ^ (Suc n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<Suc n. select_index (Suc n + 1) i k)
[PROOF STEP]
by (metis lessI)
[PROOF STATE]
proof (state)
this:
\<forall>k<2 ^ (Suc n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<Suc n. select_index (Suc n + 1) i k)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>1 \<le> ?n; \<forall>k<2 ^ (?n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<?n. select_index (?n + 1) i k)\<rbrakk> \<Longrightarrow> \<forall>k<2 ^ (Suc ?n + 1). 2 \<le> k \<longrightarrow> (\<exists>i<Suc ?n. select_index (Suc ?n + 1) i k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ivt_increasing_component_on_1:
  fixes f :: "real \<Rightarrow> 'a::euclidean_space"
  assumes "a \<le> b"
    and "continuous_on {a..b} f"
    and "(f a)\<bullet>k \<le> y" "y \<le> (f b)\<bullet>k"
  shows "\<exists>x\<in>{a..b}. (f x)\<bullet>k = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<in>{a..b}. f x \<bullet> k = y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x\<in>{a..b}. f x \<bullet> k = y
[PROOF STEP]
have "f a \<in> f ` cbox a b" "f b \<in> f ` cbox a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f a \<in> f ` cbox a b &&& f b \<in> f ` cbox a b
[PROOF STEP]
using \<open>a \<le> b\<close>
[PROOF STATE]
proof (prove)
using this:
a \<le> b

goal (1 subgoal):
 1. f a \<in> f ` cbox a b &&& f b \<in> f ` cbox a b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f a \<in> f ` cbox a b
f b \<in> f ` cbox a b

goal (1 subgoal):
 1. \<exists>x\<in>{a..b}. f x \<bullet> k = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f a \<in> f ` cbox a b
f b \<in> f ` cbox a b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f a \<in> f ` cbox a b
f b \<in> f ` cbox a b

goal (1 subgoal):
 1. \<exists>x\<in>{a..b}. f x \<bullet> k = y
[PROOF STEP]
using connected_ivt_component[of "f ` cbox a b" "f a" "f b" k y]
[PROOF STATE]
proof (prove)
using this:
f a \<in> f ` cbox a b
f b \<in> f ` cbox a b
\<lbrakk>connected (f ` cbox a b); f a \<in> f ` cbox a b; f b \<in> f ` cbox a b; f a \<bullet> k \<le> y; y \<le> f b \<bullet> k\<rbrakk> \<Longrightarrow> \<exists>z\<in>f ` cbox a b. z \<bullet> k = y

goal (1 subgoal):
 1. \<exists>x\<in>{a..b}. f x \<bullet> k = y
[PROOF STEP]
by (simp add: connected_continuous_image assms)
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>{a..b}. f x \<bullet> k = y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dvd_gdiv_mult_left[simp]: assumes "b > 0" "b dvd a" shows "b * (a gdiv b) = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b * (a gdiv b) = a
[PROOF STEP]
using dvd_gdiv_mult_right[OF assms]
[PROOF STATE]
proof (prove)
using this:
a gdiv b * b = a

goal (1 subgoal):
 1. b * (a gdiv b) = a
[PROOF STEP]
by (auto simp: ac_simps)


[STATEMENT]
lemma finite_set_of_vector[intro,simp]: "finite (set_of_vector X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (set_of_vector X)
[PROOF STEP]
unfolding set_of_vector_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {X $ i |i. i \<in> UNIV}
[PROOF STEP]
using finite_Atleast_Atmost_nat[of "\<lambda>i. X $ i"]
[PROOF STATE]
proof (prove)
using this:
finite {X $ x |x. x \<in> UNIV}

goal (1 subgoal):
 1. finite {X $ i |i. i \<in> UNIV}
[PROOF STEP]
.


[STATEMENT]
lemma row_space_is_preserved:
  fixes A::"'a::{field}^'cols^'rows::{finite, wellorder}"
    and P::"'a::{field}^'rows::{finite, wellorder}^'rows::{finite, wellorder}"
  assumes P: "invertible P"
  shows "row_space (P**A) = row_space A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_space (P ** A) = row_space A
[PROOF STEP]
proof (auto)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> row_space (P ** A) \<Longrightarrow> x \<in> row_space A
 2. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
fix w
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> row_space (P ** A) \<Longrightarrow> x \<in> row_space A
 2. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
assume w: "w \<in> row_space (P**A)"
[PROOF STATE]
proof (state)
this:
w \<in> row_space (P ** A)

goal (2 subgoals):
 1. \<And>x. x \<in> row_space (P ** A) \<Longrightarrow> x \<in> row_space A
 2. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
w \<in> row_space (P ** A)
[PROOF STEP]
obtain y where w_By: "w=(transpose (P**A)) *v y"
[PROOF STATE]
proof (prove)
using this:
w \<in> row_space (P ** A)

goal (1 subgoal):
 1. (\<And>y. w = Finite_Cartesian_Product.transpose (P ** A) *v y \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding row_space_eq[of "P ** A" ]
[PROOF STATE]
proof (prove)
using this:
w \<in> {w. \<exists>y. Finite_Cartesian_Product.transpose (P ** A) *v y = w}

goal (1 subgoal):
 1. (\<And>y. w = Finite_Cartesian_Product.transpose (P ** A) *v y \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
w = Finite_Cartesian_Product.transpose (P ** A) *v y

goal (2 subgoals):
 1. \<And>x. x \<in> row_space (P ** A) \<Longrightarrow> x \<in> row_space A
 2. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
have "w = (transpose (P**A)) *v y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w = Finite_Cartesian_Product.transpose (P ** A) *v y
[PROOF STEP]
using w_By
[PROOF STATE]
proof (prove)
using this:
w = Finite_Cartesian_Product.transpose (P ** A) *v y

goal (1 subgoal):
 1. w = Finite_Cartesian_Product.transpose (P ** A) *v y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
w = Finite_Cartesian_Product.transpose (P ** A) *v y

goal (2 subgoals):
 1. \<And>x. x \<in> row_space (P ** A) \<Longrightarrow> x \<in> row_space A
 2. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
w = Finite_Cartesian_Product.transpose (P ** A) *v y

goal (2 subgoals):
 1. \<And>x. x \<in> row_space (P ** A) \<Longrightarrow> x \<in> row_space A
 2. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
have "... = ((transpose A) ** (transpose P)) *v y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Cartesian_Product.transpose (P ** A) *v y = Finite_Cartesian_Product.transpose A ** Finite_Cartesian_Product.transpose P *v y
[PROOF STEP]
unfolding matrix_transpose_mul
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Cartesian_Product.transpose A ** Finite_Cartesian_Product.transpose P *v y = Finite_Cartesian_Product.transpose A ** Finite_Cartesian_Product.transpose P *v y
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
Finite_Cartesian_Product.transpose (P ** A) *v y = Finite_Cartesian_Product.transpose A ** Finite_Cartesian_Product.transpose P *v y

goal (2 subgoals):
 1. \<And>x. x \<in> row_space (P ** A) \<Longrightarrow> x \<in> row_space A
 2. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Finite_Cartesian_Product.transpose (P ** A) *v y = Finite_Cartesian_Product.transpose A ** Finite_Cartesian_Product.transpose P *v y

goal (2 subgoals):
 1. \<And>x. x \<in> row_space (P ** A) \<Longrightarrow> x \<in> row_space A
 2. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
have "... = (transpose A) *v ((transpose P) *v y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Cartesian_Product.transpose A ** Finite_Cartesian_Product.transpose P *v y = Finite_Cartesian_Product.transpose A *v (Finite_Cartesian_Product.transpose P *v y)
[PROOF STEP]
unfolding matrix_vector_mul_assoc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Cartesian_Product.transpose A ** Finite_Cartesian_Product.transpose P *v y = Finite_Cartesian_Product.transpose A ** Finite_Cartesian_Product.transpose P *v y
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
Finite_Cartesian_Product.transpose A ** Finite_Cartesian_Product.transpose P *v y = Finite_Cartesian_Product.transpose A *v (Finite_Cartesian_Product.transpose P *v y)

goal (2 subgoals):
 1. \<And>x. x \<in> row_space (P ** A) \<Longrightarrow> x \<in> row_space A
 2. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
w = Finite_Cartesian_Product.transpose A *v (Finite_Cartesian_Product.transpose P *v y)
[PROOF STEP]
show "w \<in> row_space A"
[PROOF STATE]
proof (prove)
using this:
w = Finite_Cartesian_Product.transpose A *v (Finite_Cartesian_Product.transpose P *v y)

goal (1 subgoal):
 1. w \<in> row_space A
[PROOF STEP]
unfolding row_space_eq
[PROOF STATE]
proof (prove)
using this:
w = Finite_Cartesian_Product.transpose A *v (Finite_Cartesian_Product.transpose P *v y)

goal (1 subgoal):
 1. w \<in> {w. \<exists>y. Finite_Cartesian_Product.transpose A *v y = w}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
w \<in> row_space A

goal (1 subgoal):
 1. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
fix w
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
assume w: "w \<in> row_space A"
[PROOF STATE]
proof (state)
this:
w \<in> row_space A

goal (1 subgoal):
 1. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
w \<in> row_space A
[PROOF STEP]
obtain y where w_Ay: "w=(transpose A) *v y"
[PROOF STATE]
proof (prove)
using this:
w \<in> row_space A

goal (1 subgoal):
 1. (\<And>y. w = Finite_Cartesian_Product.transpose A *v y \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding row_space_eq
[PROOF STATE]
proof (prove)
using this:
w \<in> {w. \<exists>y. Finite_Cartesian_Product.transpose A *v y = w}

goal (1 subgoal):
 1. (\<And>y. w = Finite_Cartesian_Product.transpose A *v y \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
w = Finite_Cartesian_Product.transpose A *v y

goal (1 subgoal):
 1. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
have "w = (transpose A) *v y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w = Finite_Cartesian_Product.transpose A *v y
[PROOF STEP]
using w_Ay
[PROOF STATE]
proof (prove)
using this:
w = Finite_Cartesian_Product.transpose A *v y

goal (1 subgoal):
 1. w = Finite_Cartesian_Product.transpose A *v y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
w = Finite_Cartesian_Product.transpose A *v y

goal (1 subgoal):
 1. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
w = Finite_Cartesian_Product.transpose A *v y

goal (1 subgoal):
 1. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
have "... = (transpose ((matrix_inv P) ** (P**A))) *v y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Cartesian_Product.transpose A *v y = Finite_Cartesian_Product.transpose (matrix_inv P ** (P ** A)) *v y
[PROOF STEP]
by (metis P matrix_inv_left matrix_mul_assoc matrix_mul_lid)
[PROOF STATE]
proof (state)
this:
Finite_Cartesian_Product.transpose A *v y = Finite_Cartesian_Product.transpose (matrix_inv P ** (P ** A)) *v y

goal (1 subgoal):
 1. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Finite_Cartesian_Product.transpose A *v y = Finite_Cartesian_Product.transpose (matrix_inv P ** (P ** A)) *v y

goal (1 subgoal):
 1. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
have "... = (transpose (P**A) ** (transpose (matrix_inv P))) *v y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Cartesian_Product.transpose (matrix_inv P ** (P ** A)) *v y = Finite_Cartesian_Product.transpose (P ** A) ** Finite_Cartesian_Product.transpose (matrix_inv P) *v y
[PROOF STEP]
unfolding matrix_transpose_mul
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Cartesian_Product.transpose A ** Finite_Cartesian_Product.transpose P ** Finite_Cartesian_Product.transpose (matrix_inv P) *v y = Finite_Cartesian_Product.transpose A ** Finite_Cartesian_Product.transpose P ** Finite_Cartesian_Product.transpose (matrix_inv P) *v y
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
Finite_Cartesian_Product.transpose (matrix_inv P ** (P ** A)) *v y = Finite_Cartesian_Product.transpose (P ** A) ** Finite_Cartesian_Product.transpose (matrix_inv P) *v y

goal (1 subgoal):
 1. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Finite_Cartesian_Product.transpose (matrix_inv P ** (P ** A)) *v y = Finite_Cartesian_Product.transpose (P ** A) ** Finite_Cartesian_Product.transpose (matrix_inv P) *v y

goal (1 subgoal):
 1. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
have "... = transpose (P**A) *v (transpose (matrix_inv P) *v y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Cartesian_Product.transpose (P ** A) ** Finite_Cartesian_Product.transpose (matrix_inv P) *v y = Finite_Cartesian_Product.transpose (P ** A) *v (Finite_Cartesian_Product.transpose (matrix_inv P) *v y)
[PROOF STEP]
unfolding matrix_vector_mul_assoc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Finite_Cartesian_Product.transpose (P ** A) ** Finite_Cartesian_Product.transpose (matrix_inv P) *v y = Finite_Cartesian_Product.transpose (P ** A) ** Finite_Cartesian_Product.transpose (matrix_inv P) *v y
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
Finite_Cartesian_Product.transpose (P ** A) ** Finite_Cartesian_Product.transpose (matrix_inv P) *v y = Finite_Cartesian_Product.transpose (P ** A) *v (Finite_Cartesian_Product.transpose (matrix_inv P) *v y)

goal (1 subgoal):
 1. \<And>x. x \<in> row_space A \<Longrightarrow> x \<in> row_space (P ** A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
w = Finite_Cartesian_Product.transpose (P ** A) *v (Finite_Cartesian_Product.transpose (matrix_inv P) *v y)
[PROOF STEP]
show "w \<in> row_space (P**A)"
[PROOF STATE]
proof (prove)
using this:
w = Finite_Cartesian_Product.transpose (P ** A) *v (Finite_Cartesian_Product.transpose (matrix_inv P) *v y)

goal (1 subgoal):
 1. w \<in> row_space (P ** A)
[PROOF STEP]
unfolding row_space_eq
[PROOF STATE]
proof (prove)
using this:
w = Finite_Cartesian_Product.transpose (P ** A) *v (Finite_Cartesian_Product.transpose (matrix_inv P) *v y)

goal (1 subgoal):
 1. w \<in> {w. \<exists>y. Finite_Cartesian_Product.transpose (P ** A) *v y = w}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
w \<in> row_space (P ** A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sums_cot_pfd_complex':
  fixes x :: complex
  assumes "x \<notin> \<int>"
  shows   "(\<lambda>n. 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n))) sums cot_pfd x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n))) sums cot_pfd x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n))) sums cot_pfd x
[PROOF STEP]
have "(\<lambda>n. 2 * x / (x ^ 2 - of_nat (Suc n) ^ 2)) sums cot_pfd x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2)) sums cot_pfd x
[PROOF STEP]
by (rule sums_cot_pfd_complex)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2)) sums cot_pfd x

goal (1 subgoal):
 1. (\<lambda>n. 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n))) sums cot_pfd x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2)) sums cot_pfd x

goal (1 subgoal):
 1. (\<lambda>n. 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n))) sums cot_pfd x
[PROOF STEP]
have "(\<lambda>n. 2 * x / (x ^ 2 - of_nat (Suc n) ^ 2)) =
             (\<lambda>n. 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n)))" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2)) = (\<lambda>n. 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n)))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2) = 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n))
[PROOF STEP]
fix n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2) = 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n))
[PROOF STEP]
have neq1: "x + of_nat (Suc n) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + of_nat (Suc n) \<noteq> 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<notin> \<int>

goal (1 subgoal):
 1. x + of_nat (Suc n) \<noteq> 0
[PROOF STEP]
by (metis Ints_0 Ints_add_iff2 Ints_of_nat)
[PROOF STATE]
proof (state)
this:
x + of_nat (Suc n) \<noteq> 0

goal (1 subgoal):
 1. \<And>n. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2) = 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n))
[PROOF STEP]
have neq2: "x - of_nat (Suc n) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - of_nat (Suc n) \<noteq> 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<notin> \<int>

goal (1 subgoal):
 1. x - of_nat (Suc n) \<noteq> 0
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
x - of_nat (Suc n) \<noteq> 0

goal (1 subgoal):
 1. \<And>n. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2) = 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n))
[PROOF STEP]
have neq3: "x ^ 2 - of_nat (Suc n) ^ 2 \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>2 - (of_nat (Suc n))\<^sup>2 \<noteq> 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<notin> \<int>

goal (1 subgoal):
 1. x\<^sup>2 - (of_nat (Suc n))\<^sup>2 \<noteq> 0
[PROOF STEP]
by (metis Ints_of_nat eq_iff_diff_eq_0 minus_in_Ints_iff power2_eq_iff)
[PROOF STATE]
proof (state)
this:
x\<^sup>2 - (of_nat (Suc n))\<^sup>2 \<noteq> 0

goal (1 subgoal):
 1. \<And>n. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2) = 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n))
[PROOF STEP]
show "?lhs n = ?rhs n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2) = 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n))
[PROOF STEP]
using neq1 neq2 neq3
[PROOF STATE]
proof (prove)
using this:
x + of_nat (Suc n) \<noteq> 0
x - of_nat (Suc n) \<noteq> 0
x\<^sup>2 - (of_nat (Suc n))\<^sup>2 \<noteq> 0

goal (1 subgoal):
 1. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2) = 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n))
[PROOF STEP]
by (simp add: divide_simps del: of_nat_Suc) (auto simp: power2_eq_square algebra_simps)
[PROOF STATE]
proof (state)
this:
2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2) = 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 2 * x / (x\<^sup>2 - (of_nat (Suc n))\<^sup>2)) = (\<lambda>n. 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n)))

goal (1 subgoal):
 1. (\<lambda>n. 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n))) sums cot_pfd x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n))) sums cot_pfd x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n))) sums cot_pfd x

goal (1 subgoal):
 1. (\<lambda>n. 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n))) sums cot_pfd x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 1 / (x + of_nat (Suc n)) + 1 / (x - of_nat (Suc n))) sums cot_pfd x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tan_total_pi4:
  assumes "\<bar>x\<bar> < 1"
  shows "\<exists>z. - (pi / 4) < z \<and> z < pi / 4 \<and> tan z = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z>- (pi / 4). z < pi / 4 \<and> tan z = x
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. - (pi / 4) < ?z \<and> ?z < pi / 4 \<and> tan ?z = x
[PROOF STEP]
show "- (pi / 4) < arctan x \<and> arctan x < pi / 4 \<and> tan (arctan x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (pi / 4) < arctan x \<and> arctan x < pi / 4 \<and> tan (arctan x) = x
[PROOF STEP]
unfolding arctan_one [symmetric] arctan_minus [symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan (- 1) < arctan x \<and> arctan x < arctan 1 \<and> tan (arctan x) = x
[PROOF STEP]
unfolding arctan_less_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 1 < x \<and> x < 1 \<and> tan (arctan x) = x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<bar>x\<bar> < 1

goal (1 subgoal):
 1. - 1 < x \<and> x < 1 \<and> tan (arctan x) = x
[PROOF STEP]
by (auto simp: arctan)
[PROOF STATE]
proof (state)
this:
- (pi / 4) < arctan x \<and> arctan x < pi / 4 \<and> tan (arctan x) = x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma filterlim_inverse_at_top_right: "LIM x at_right (0::real). inverse x :> at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim inverse at_top (at_right 0)
[PROOF STEP]
unfolding filterlim_at_top_gt[where c=0] eventually_at_filter
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>Z>0. \<forall>\<^sub>F x in nhds 0. x \<noteq> 0 \<longrightarrow> x \<in> {0<..} \<longrightarrow> Z \<le> inverse x
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>Z. 0 < Z \<Longrightarrow> \<forall>\<^sub>F x in nhds 0. x \<noteq> 0 \<longrightarrow> x \<in> {0<..} \<longrightarrow> Z \<le> inverse x
[PROOF STEP]
fix Z :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>Z. 0 < Z \<Longrightarrow> \<forall>\<^sub>F x in nhds 0. x \<noteq> 0 \<longrightarrow> x \<in> {0<..} \<longrightarrow> Z \<le> inverse x
[PROOF STEP]
assume [arith]: "0 < Z"
[PROOF STATE]
proof (state)
this:
0 < Z

goal (1 subgoal):
 1. \<And>Z. 0 < Z \<Longrightarrow> \<forall>\<^sub>F x in nhds 0. x \<noteq> 0 \<longrightarrow> x \<in> {0<..} \<longrightarrow> Z \<le> inverse x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < Z
[PROOF STEP]
have "eventually (\<lambda>x. x < inverse Z) (nhds 0)"
[PROOF STATE]
proof (prove)
using this:
0 < Z

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds 0. x < inverse Z
[PROOF STEP]
by (auto simp: eventually_nhds_metric dist_real_def intro!: exI[of _ "\<bar>inverse Z\<bar>"])
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in nhds 0. x < inverse Z

goal (1 subgoal):
 1. \<And>Z. 0 < Z \<Longrightarrow> \<forall>\<^sub>F x in nhds 0. x \<noteq> 0 \<longrightarrow> x \<in> {0<..} \<longrightarrow> Z \<le> inverse x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in nhds 0. x < inverse Z
[PROOF STEP]
show "eventually (\<lambda>x. x \<noteq> 0 \<longrightarrow> x \<in> {0<..} \<longrightarrow> Z \<le> inverse x) (nhds 0)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in nhds 0. x < inverse Z

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds 0. x \<noteq> 0 \<longrightarrow> x \<in> {0<..} \<longrightarrow> Z \<le> inverse x
[PROOF STEP]
by (auto elim!: eventually_mono simp: inverse_eq_divide field_simps)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in nhds 0. x \<noteq> 0 \<longrightarrow> x \<in> {0<..} \<longrightarrow> Z \<le> inverse x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ceiling_add_one [simp]: "\<lceil>x + 1\<rceil> = \<lceil>x\<rceil> + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lceil>x + (1::'a)\<rceil> = \<lceil>x\<rceil> + 1
[PROOF STEP]
using ceiling_add_of_int [of x 1]
[PROOF STATE]
proof (prove)
using this:
\<lceil>x + of_int 1\<rceil> = \<lceil>x\<rceil> + 1

goal (1 subgoal):
 1. \<lceil>x + (1::'a)\<rceil> = \<lceil>x\<rceil> + 1
[PROOF STEP]
by simp


[STATEMENT]
lemma nn_integral_conv_infsetsum:
  assumes "f abs_summable_on A" "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> 0"
  shows   "nn_integral (count_space A) f = ennreal (infsetsum f A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space A = ennreal (infsetsum f A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f abs_summable_on A
?x \<in> A \<Longrightarrow> 0 \<le> f ?x

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space A = ennreal (infsetsum f A)
[PROOF STEP]
unfolding infsetsum_def abs_summable_on_def
[PROOF STATE]
proof (prove)
using this:
integrable (count_space A) f
?x \<in> A \<Longrightarrow> 0 \<le> f ?x

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>count_space A = ennreal (integral\<^sup>L (count_space A) f)
[PROOF STEP]
by (subst nn_integral_eq_integral) auto


[STATEMENT]
lemma distinct_map_fstD: "\<lbrakk> distinct (map fst xs); (x, y) \<in> set xs; (x, z) \<in> set xs \<rbrakk> \<Longrightarrow> y = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct (map fst xs); (x, y) \<in> set xs; (x, z) \<in> set xs\<rbrakk> \<Longrightarrow> y = z
[PROOF STEP]
by(induct xs)(fastforce elim: notE rev_image_eqI)+


[STATEMENT]
lemma insort_wrt_insort_key:
   "a \<in> A \<Longrightarrow>
   set xs \<subseteq> A \<Longrightarrow>
   insert_wrt (linorder_from_keys A f) a xs = insort_key f a xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> A; set xs \<subseteq> A\<rbrakk> \<Longrightarrow> insert_wrt (linorder_from_keys A f) a xs = insort_key f a xs
[PROOF STEP]
unfolding linorder_from_keys_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> A; set xs \<subseteq> A\<rbrakk> \<Longrightarrow> insert_wrt {(x, y). (x, y) \<in> A \<times> A \<and> f x \<le> f y} a xs = insort_key f a xs
[PROOF STEP]
by (induction xs) (auto)


[STATEMENT]
lemma arctan_eq_zero_iff [simp]: "arctan x = 0 \<longleftrightarrow> x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (arctan x = 0) = (x = 0)
[PROOF STEP]
using arctan_eq_iff [of x 0]
[PROOF STATE]
proof (prove)
using this:
(arctan x = arctan 0) = (x = 0)

goal (1 subgoal):
 1. (arctan x = 0) = (x = 0)
[PROOF STEP]
by simp


[STATEMENT]
lemma card_UNION_nonneg:
  assumes "finite A"
    and "\<forall>k \<in> A. finite k"
  shows "(\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter>I))) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
using int_card_UNION [OF assms]
[PROOF STATE]
proof (prove)
using this:
int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))

goal (1 subgoal):
 1. 0 \<le> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
by presburger


[STATEMENT]
lemma integral_add: "f integrable_on S \<Longrightarrow> g integrable_on S \<Longrightarrow>
    integral S (\<lambda>x. f x + g x) = integral S f + integral S g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f integrable_on S; g integrable_on S\<rbrakk> \<Longrightarrow> integral S (\<lambda>x. f x + g x) = integral S f + integral S g
[PROOF STEP]
by (rule integral_unique) (metis integrable_integral has_integral_add)


[STATEMENT]
lemma uncurry_curry_id: "uncurry \<circ> curry = id" "curry \<circ> uncurry = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uncurry \<circ> curry = id &&& curry \<circ> uncurry = id
[PROOF STEP]
by(simp_all add: fun_eq_iff)


[STATEMENT]
lemma sin_periodic_nat [simp]:
  fixes n :: nat
  shows "sin (x + n * (2 * pi)) = sin x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin (x + real n * (2 * pi)) = sin x
[PROOF STEP]
by (metis (no_types, opaque_lifting) add.commute add.left_neutral cos_2npi cos_one_2pi_int mult.assoc mult.commute mult.left_neutral mult_zero_left sin_add sin_int_2pin)


[STATEMENT]
lemma degree_smult_not_zero_divisor_right[simp]:
  assumes "\<not> zero_divisor (lead_coeff p)"
  shows "degree (smult c p) = (if c = 0 then 0 else degree p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (smult c p) = (if c = (0::'a) then 0 else degree p)
[PROOF STEP]
proof(cases "c = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. c = (0::'a) \<Longrightarrow> degree (smult c p) = (if c = (0::'a) then 0 else degree p)
 2. c \<noteq> (0::'a) \<Longrightarrow> degree (smult c p) = (if c = (0::'a) then 0 else degree p)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
c \<noteq> (0::'a)

goal (2 subgoals):
 1. c = (0::'a) \<Longrightarrow> degree (smult c p) = (if c = (0::'a) then 0 else degree p)
 2. c \<noteq> (0::'a) \<Longrightarrow> degree (smult c p) = (if c = (0::'a) then 0 else degree p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> (0::'a)
[PROOF STEP]
have "coeff (smult c p) (degree p) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a)

goal (1 subgoal):
 1. coeff (smult c p) (degree p) \<noteq> (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a)
\<not> zero_divisor (lead_coeff p)

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

goal (2 subgoals):
 1. c = (0::'a) \<Longrightarrow> degree (smult c p) = (if c = (0::'a) then 0 else degree p)
 2. c \<noteq> (0::'a) \<Longrightarrow> degree (smult c p) = (if c = (0::'a) then 0 else degree p)
[PROOF STEP]
from le_degree[OF this] degree_smult_le[of c p]
[PROOF STATE]
proof (chain)
picking this:
degree p \<le> degree (smult c p)
degree (smult c p) \<le> degree p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
degree p \<le> degree (smult c p)
degree (smult c p) \<le> degree p

goal (1 subgoal):
 1. degree (smult c p) = (if c = (0::'a) then 0 else degree p)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree (smult c p) = (if c = (0::'a) then 0 else degree p)

goal (1 subgoal):
 1. c = (0::'a) \<Longrightarrow> degree (smult c p) = (if c = (0::'a) then 0 else degree p)
[PROOF STEP]
qed auto


[STATEMENT]
lemma lossless_sample_uniform_units:
  assumes "(p::nat) > 1"
  shows "lossless_spmf (sample_uniform_units p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lossless_spmf (sample_uniform_units p)
[PROOF STEP]
unfolding sample_uniform_units_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lossless_spmf (spmf_of_set ({..<p} - {0}))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < p

goal (1 subgoal):
 1. lossless_spmf (spmf_of_set ({..<p} - {0}))
[PROOF STEP]
by auto


[STATEMENT]
lemma height_node21:
   "height r > 0 \<Longrightarrow> height(node21 l a r) = max (height l) (height r) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < height r \<Longrightarrow> height (node21 l a r) = max (height l) (height r) + 1
[PROOF STEP]
by(induct l a r rule: node21.induct)(simp_all add: max.assoc)


[STATEMENT]
lemma finprod_one_eqI: "(\<And>x. x \<in> A \<Longrightarrow> f x = \<one>) \<Longrightarrow> finprod G f A = \<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> f x = \<one>) \<Longrightarrow> finprod G f A = \<one>
[PROOF STEP]
proof (induct A rule: infinite_finite_induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>A. \<lbrakk>infinite A; \<And>x. x \<in> A \<Longrightarrow> f x = \<one>\<rbrakk> \<Longrightarrow> finprod G f A = \<one>
 2. (\<And>x. x \<in> {} \<Longrightarrow> f x = \<one>) \<Longrightarrow> finprod G f {} = \<one>
 3. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>x. x \<in> F \<Longrightarrow> f x = \<one>) \<Longrightarrow> finprod G f F = \<one>; \<And>xa. xa \<in> insert x F \<Longrightarrow> f xa = \<one>\<rbrakk> \<Longrightarrow> finprod G f (insert x F) = \<one>
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
?x \<in> {} \<Longrightarrow> f ?x = \<one>

goal (3 subgoals):
 1. \<And>A. \<lbrakk>infinite A; \<And>x. x \<in> A \<Longrightarrow> f x = \<one>\<rbrakk> \<Longrightarrow> finprod G f A = \<one>
 2. (\<And>x. x \<in> {} \<Longrightarrow> f x = \<one>) \<Longrightarrow> finprod G f {} = \<one>
 3. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>x. x \<in> F \<Longrightarrow> f x = \<one>) \<Longrightarrow> finprod G f F = \<one>; \<And>xa. xa \<in> insert x F \<Longrightarrow> f xa = \<one>\<rbrakk> \<Longrightarrow> finprod G f (insert x F) = \<one>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finprod G f {} = \<one>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finprod G f {} = \<one>

goal (2 subgoals):
 1. \<And>A. \<lbrakk>infinite A; \<And>x. x \<in> A \<Longrightarrow> f x = \<one>\<rbrakk> \<Longrightarrow> finprod G f A = \<one>
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>x. x \<in> F \<Longrightarrow> f x = \<one>) \<Longrightarrow> finprod G f F = \<one>; \<And>xa. xa \<in> insert x F \<Longrightarrow> f xa = \<one>\<rbrakk> \<Longrightarrow> finprod G f (insert x F) = \<one>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. \<lbrakk>infinite A; \<And>x. x \<in> A \<Longrightarrow> f x = \<one>\<rbrakk> \<Longrightarrow> finprod G f A = \<one>
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>x. x \<in> F \<Longrightarrow> f x = \<one>) \<Longrightarrow> finprod G f F = \<one>; \<And>xa. xa \<in> insert x F \<Longrightarrow> f xa = \<one>\<rbrakk> \<Longrightarrow> finprod G f (insert x F) = \<one>
[PROOF STEP]
case (insert a A)
[PROOF STATE]
proof (state)
this:
finite A
a \<notin> A
(\<And>x. x \<in> A \<Longrightarrow> f x = \<one>) \<Longrightarrow> finprod G f A = \<one>
?x \<in> insert a A \<Longrightarrow> f ?x = \<one>

goal (2 subgoals):
 1. \<And>A. \<lbrakk>infinite A; \<And>x. x \<in> A \<Longrightarrow> f x = \<one>\<rbrakk> \<Longrightarrow> finprod G f A = \<one>
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>x. x \<in> F \<Longrightarrow> f x = \<one>) \<Longrightarrow> finprod G f F = \<one>; \<And>xa. xa \<in> insert x F \<Longrightarrow> f xa = \<one>\<rbrakk> \<Longrightarrow> finprod G f (insert x F) = \<one>
[PROOF STEP]
have "(\<lambda>i. \<one>) \<in> A \<rightarrow> carrier G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. \<one>) \<in> A \<rightarrow> carrier G
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>i. \<one>) \<in> A \<rightarrow> carrier G

goal (2 subgoals):
 1. \<And>A. \<lbrakk>infinite A; \<And>x. x \<in> A \<Longrightarrow> f x = \<one>\<rbrakk> \<Longrightarrow> finprod G f A = \<one>
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>x. x \<in> F \<Longrightarrow> f x = \<one>) \<Longrightarrow> finprod G f F = \<one>; \<And>xa. xa \<in> insert x F \<Longrightarrow> f xa = \<one>\<rbrakk> \<Longrightarrow> finprod G f (insert x F) = \<one>
[PROOF STEP]
with insert
[PROOF STATE]
proof (chain)
picking this:
finite A
a \<notin> A
(\<And>x. x \<in> A \<Longrightarrow> f x = \<one>) \<Longrightarrow> finprod G f A = \<one>
?x \<in> insert a A \<Longrightarrow> f ?x = \<one>
(\<lambda>i. \<one>) \<in> A \<rightarrow> carrier G
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite A
a \<notin> A
(\<And>x. x \<in> A \<Longrightarrow> f x = \<one>) \<Longrightarrow> finprod G f A = \<one>
?x \<in> insert a A \<Longrightarrow> f ?x = \<one>
(\<lambda>i. \<one>) \<in> A \<rightarrow> carrier G

goal (1 subgoal):
 1. finprod G f (insert a A) = \<one>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finprod G f (insert a A) = \<one>

goal (1 subgoal):
 1. \<And>A. \<lbrakk>infinite A; \<And>x. x \<in> A \<Longrightarrow> f x = \<one>\<rbrakk> \<Longrightarrow> finprod G f A = \<one>
[PROOF STEP]
qed simp


[STATEMENT]
lemma mod_add_mod_if: "
  (a mod m + b mod m) mod (m::nat)= (
  if a mod m + b mod m < m
  then a mod m + b mod m
  else a mod m + b mod m - m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a mod m + b mod m) mod m = (if a mod m + b mod m < m then a mod m + b mod m else a mod m + b mod m - m)
[PROOF STEP]
apply (case_tac "m = 0", simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < m \<Longrightarrow> \<not> a mod m + b mod m < m \<longrightarrow> (a mod m + b mod m) mod m = a mod m + b mod m - m
[PROOF STEP]
apply (clarsimp simp: linorder_not_less)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; m \<le> a mod m + b mod m\<rbrakk> \<Longrightarrow> (a mod m + b mod m) mod m = a mod m + b mod m - m
[PROOF STEP]
apply (simp add: mod_if[of "a mod m + b mod m"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; m \<le> a mod m + b mod m\<rbrakk> \<Longrightarrow> (a mod m + b mod m - m) mod m = a mod m + b mod m - m
[PROOF STEP]
apply (rule mod_less)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; m \<le> a mod m + b mod m\<rbrakk> \<Longrightarrow> a mod m + b mod m - m < m
[PROOF STEP]
apply (rule diff_less_conv[THEN iffD2], assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; m \<le> a mod m + b mod m\<rbrakk> \<Longrightarrow> a mod m + b mod m < m + m
[PROOF STEP]
apply (simp add: add_less_mono)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma interior_of_subtopology_mono:
   "\<lbrakk>S \<subseteq> T; T \<subseteq> U\<rbrakk> \<Longrightarrow> (subtopology X U) interior_of S \<subseteq> (subtopology X T) interior_of S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<subseteq> T; T \<subseteq> U\<rbrakk> \<Longrightarrow> subtopology X U interior_of S \<subseteq> subtopology X T interior_of S
[PROOF STEP]
by (metis dual_order.trans inf.orderE inf_commute interior_of_subset interior_of_subtopology_subsets)