[STATEMENT]
lemma basis_extension: assumes "lin_indpt_list xs"
  shows "set (basis_extension xs) \<subseteq> set (unit_vecs n)"
    "lin_indpt_list (xs @ basis_extension xs)"
    "length (xs @ basis_extension xs) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (basis_extension xs) \<subseteq> set (unit_vecs n) &&& lin_indpt_list (xs @ basis_extension xs) &&& length (xs @ basis_extension xs) = n
[PROOF STEP]
using someI_ex[OF expand_to_basis[OF assms], folded basis_extension_def]
[PROOF STATE]
proof (prove)
using this:
set (basis_extension xs) \<subseteq> set (unit_vecs n) \<and> lin_indpt_list (xs @ basis_extension xs) \<and> length (xs @ basis_extension xs) = n

goal (1 subgoal):
 1. set (basis_extension xs) \<subseteq> set (unit_vecs n) &&& lin_indpt_list (xs @ basis_extension xs) &&& length (xs @ basis_extension xs) = n
[PROOF STEP]
by auto


[STATEMENT]
lemma real_sqrt_power: "sqrt (x ^ k) = sqrt x ^ k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (x ^ k) = sqrt x ^ k
[PROOF STEP]
unfolding sqrt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root 2 (x ^ k) = root 2 x ^ k
[PROOF STEP]
by (rule real_root_power [OF pos2])


[STATEMENT]
lemma derivative_component_fun_component_at_within:
  assumes gamma_differentiable: "\<forall>x \<in> {0 .. 1}. \<gamma> differentiable at x"
  shows "\<forall>x \<in> {0..1}. vector_derivative (\<lambda>x. \<gamma> x) (at x within {0..1}) \<bullet> (i::'a:: euclidean_space)
                                       =  vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{0..1}. vector_derivative \<gamma> (at x within {0..1}) \<bullet> i = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>x\<in>{0..1}. vector_derivative \<gamma> (at x within {0..1}) \<bullet> i = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})
[PROOF STEP]
have gamma_i_component_smooth:
    "\<forall>x \<in> {0 .. 1}. (\<lambda>x. \<gamma> x \<bullet> i) differentiable at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{0..1}. (\<lambda>x. \<gamma> x \<bullet> i) differentiable at x
[PROOF STEP]
using gamma_differentiable
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>{0..1}. \<gamma> differentiable at x

goal (1 subgoal):
 1. \<forall>x\<in>{0..1}. (\<lambda>x. \<gamma> x \<bullet> i) differentiable at x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>{0..1}. (\<lambda>x. \<gamma> x \<bullet> i) differentiable at x

goal (1 subgoal):
 1. \<forall>x\<in>{0..1}. vector_derivative \<gamma> (at x within {0..1}) \<bullet> i = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})
[PROOF STEP]
show "\<forall>x \<in> {0..1}. vector_derivative (\<lambda>x. \<gamma> x) (at x within {0..1}) \<bullet> i
                                  =  vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{0..1}. vector_derivative \<gamma> (at x within {0..1}) \<bullet> i = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} \<Longrightarrow> vector_derivative \<gamma> (at x within {0..1}) \<bullet> i = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})
[PROOF STEP]
fix x::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} \<Longrightarrow> vector_derivative \<gamma> (at x within {0..1}) \<bullet> i = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})
[PROOF STEP]
assume x_within_bounds: "x \<in> {0..1}"
[PROOF STATE]
proof (state)
this:
x \<in> {0..1}

goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} \<Longrightarrow> vector_derivative \<gamma> (at x within {0..1}) \<bullet> i = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})
[PROOF STEP]
have gamma_deriv_at_within:
      "vector_derivative (\<lambda>x. \<gamma> x) (at x within {0..1}) =  vector_derivative (\<lambda>x. \<gamma> x) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector_derivative \<gamma> (at x within {0..1}) = vector_derivative \<gamma> (at x)
[PROOF STEP]
using gamma_deriv_at_within[of "0" "1"] x_within_bounds
        gamma_differentiable
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < 1; ?x \<in> {0..1}; \<forall>x\<in>{0..1}. ?\<gamma> differentiable at x\<rbrakk> \<Longrightarrow> vector_derivative ?\<gamma> (at ?x within {0..1}) = vector_derivative ?\<gamma> (at ?x)
x \<in> {0..1}
\<forall>x\<in>{0..1}. \<gamma> differentiable at x

goal (1 subgoal):
 1. vector_derivative \<gamma> (at x within {0..1}) = vector_derivative \<gamma> (at x)
[PROOF STEP]
by (auto simp add: vector_derivative_works)
[PROOF STATE]
proof (state)
this:
vector_derivative \<gamma> (at x within {0..1}) = vector_derivative \<gamma> (at x)

goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} \<Longrightarrow> vector_derivative \<gamma> (at x within {0..1}) \<bullet> i = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})
[PROOF STEP]
have gamma_component_deriv_at_within:
      "vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x) = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x) = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})
[PROOF STEP]
using Derivative.vector_derivative_at_within_ivl[of "(\<lambda>x. (\<gamma> x) \<bullet> i)" "vector_derivative (\<lambda>x. (\<gamma> x)  \<bullet> i) (at x)" "x" "0" "1"]
        has_vector_derivative_at_within[of "(\<lambda>x. \<gamma> x \<bullet> i)" "vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x)" "x" "{0..1}"]
        gamma_i_component_smooth x_within_bounds
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>((\<lambda>x. \<gamma> x \<bullet> i) has_vector_derivative vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x)) (at x); 0 \<le> x; x \<le> 1; 0 < 1\<rbrakk> \<Longrightarrow> vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1}) = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x)
((\<lambda>x. \<gamma> x \<bullet> i) has_vector_derivative vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x)) (at x) \<Longrightarrow> ((\<lambda>x. \<gamma> x \<bullet> i) has_vector_derivative vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x)) (at x within {0..1})
\<forall>x\<in>{0..1}. (\<lambda>x. \<gamma> x \<bullet> i) differentiable at x
x \<in> {0..1}

goal (1 subgoal):
 1. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x) = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})
[PROOF STEP]
by (simp add: vector_derivative_works)
[PROOF STATE]
proof (state)
this:
vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x) = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})

goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} \<Longrightarrow> vector_derivative \<gamma> (at x within {0..1}) \<bullet> i = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})
[PROOF STEP]
have gamma_component_deriv_eq_gamma_deriv_component:
      "vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x) = vector_derivative (\<lambda>x. \<gamma> x) (at x) \<bullet> i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x) = vector_derivative \<gamma> (at x) \<bullet> i
[PROOF STEP]
using derivative_component_fun_component[of "\<gamma>" "x" "i"] gamma_differentiable x_within_bounds
[PROOF STATE]
proof (prove)
using this:
\<gamma> differentiable at x \<Longrightarrow> vector_derivative \<gamma> (at x) \<bullet> i = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x)
\<forall>x\<in>{0..1}. \<gamma> differentiable at x
x \<in> {0..1}

goal (1 subgoal):
 1. vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x) = vector_derivative \<gamma> (at x) \<bullet> i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x) = vector_derivative \<gamma> (at x) \<bullet> i

goal (1 subgoal):
 1. \<And>x. x \<in> {0..1} \<Longrightarrow> vector_derivative \<gamma> (at x within {0..1}) \<bullet> i = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})
[PROOF STEP]
show "vector_derivative \<gamma> (at x within {0..1}) \<bullet> i = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector_derivative \<gamma> (at x within {0..1}) \<bullet> i = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})
[PROOF STEP]
using gamma_component_deriv_eq_gamma_deriv_component gamma_component_deriv_at_within gamma_deriv_at_within
[PROOF STATE]
proof (prove)
using this:
vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x) = vector_derivative \<gamma> (at x) \<bullet> i
vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x) = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})
vector_derivative \<gamma> (at x within {0..1}) = vector_derivative \<gamma> (at x)

goal (1 subgoal):
 1. vector_derivative \<gamma> (at x within {0..1}) \<bullet> i = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vector_derivative \<gamma> (at x within {0..1}) \<bullet> i = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>{0..1}. vector_derivative \<gamma> (at x within {0..1}) \<bullet> i = vector_derivative (\<lambda>x. \<gamma> x \<bullet> i) (at x within {0..1})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma one_outcome_card_lotteries_1:
  assumes "card outcomes = 1"
  shows "card (lotteries_on outcomes) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (lotteries_on outcomes) = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (lotteries_on outcomes) = 1
[PROOF STEP]
obtain x :: 'a where
    x: "outcomes = {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. outcomes = {x} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms card_1_singletonE
[PROOF STATE]
proof (prove)
using this:
card outcomes = 1
\<lbrakk>card ?A = 1; \<And>x. ?A = {x} \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>x. outcomes = {x} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
outcomes = {x}

goal (1 subgoal):
 1. card (lotteries_on outcomes) = 1
[PROOF STEP]
have exl: "\<exists>l \<in> lotteries_on outcomes. pmf l x = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>l\<in>lotteries_on outcomes. pmf l x = 1
[PROOF STEP]
by (metis x assms card.infinite empty_iff
        finite_nempty_ex_degernate_in_lotteries insert_iff zero_neq_one)
[PROOF STATE]
proof (state)
this:
\<exists>l\<in>lotteries_on outcomes. pmf l x = 1

goal (1 subgoal):
 1. card (lotteries_on outcomes) = 1
[PROOF STEP]
have pmfs: "\<forall>l \<in> lotteries_on outcomes. set_pmf l = {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>l\<in>lotteries_on outcomes. set_pmf l = {x}
[PROOF STEP]
by (simp add: lotteries_on_def set_pmf_subset_singleton x)
[PROOF STATE]
proof (state)
this:
\<forall>l\<in>lotteries_on outcomes. set_pmf l = {x}

goal (1 subgoal):
 1. card (lotteries_on outcomes) = 1
[PROOF STEP]
have "\<forall>l \<in> lotteries_on outcomes. pmf l x = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>l\<in>lotteries_on outcomes. pmf l x = 1
[PROOF STEP]
by (simp add: lotteries_on_def set_pmf_subset_singleton x)
[PROOF STATE]
proof (state)
this:
\<forall>l\<in>lotteries_on outcomes. pmf l x = 1

goal (1 subgoal):
 1. card (lotteries_on outcomes) = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>l\<in>lotteries_on outcomes. pmf l x = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>l\<in>lotteries_on outcomes. pmf l x = 1

goal (1 subgoal):
 1. card (lotteries_on outcomes) = 1
[PROOF STEP]
by (metis exl empty_iff is_singletonI' is_singleton_altdef
        order_refl pmfs set_pmf_subset_singleton)
[PROOF STATE]
proof (state)
this:
card (lotteries_on outcomes) = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem map_pmf_random_bst_eq_rqs_cost:
  assumes "finite A"
  shows   "map_pmf ipl (random_bst A) = rqs_cost (card A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
proof (induction A rule: finite_psubset_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A. \<lbrakk>finite A; \<And>B. B \<subset> A \<Longrightarrow> map_pmf ipl (random_bst B) = rqs_cost (card B)\<rbrakk> \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
case (psubset A)
[PROOF STATE]
proof (state)
this:
finite A
?B \<subset> A \<Longrightarrow> map_pmf ipl (random_bst ?B) = rqs_cost (card ?B)

goal (1 subgoal):
 1. \<And>A. \<lbrakk>finite A; \<And>B. B \<subset> A \<Longrightarrow> map_pmf ipl (random_bst B) = rqs_cost (card B)\<rbrakk> \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
proof (cases "A = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A = {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
 2. A \<noteq> {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
A \<noteq> {}

goal (2 subgoals):
 1. A = {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
 2. A \<noteq> {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
note A = \<open>finite A\<close> \<open>A \<noteq> {}\<close>
[PROOF STATE]
proof (state)
this:
finite A
A \<noteq> {}

goal (2 subgoals):
 1. A = {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
 2. A \<noteq> {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
define n where "n = card A - 1"
[PROOF STATE]
proof (state)
this:
n = card A - 1

goal (2 subgoals):
 1. A = {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
 2. A \<noteq> {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
define rank :: "'a \<Rightarrow> nat" where "rank = linorder_rank {(x,y). x \<le> y} A"
[PROOF STATE]
proof (state)
this:
rank = linorder_rank {(x, y). x \<le> y} A

goal (2 subgoals):
 1. A = {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
 2. A \<noteq> {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<noteq> {}
[PROOF STEP]
have card: "card A = Suc n"
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}

goal (1 subgoal):
 1. card A = Suc n
[PROOF STEP]
by (cases "card A") (auto simp: n_def)
[PROOF STATE]
proof (state)
this:
card A = Suc n

goal (2 subgoals):
 1. A = {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
 2. A \<noteq> {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<noteq> {}
[PROOF STEP]
have "map_pmf ipl (random_bst A) =
                   do {
                     x \<leftarrow> pmf_of_set A;
                     (l,r) \<leftarrow> pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. y > x});
                     return_pmf (ipl (Node l x r))
                   }"
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}

goal (1 subgoal):
 1. map_pmf ipl (random_bst A) = pmf_of_set A \<bind> (\<lambda>x. pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}) \<bind> (\<lambda>(l, r). return_pmf (ipl \<langle>l, x, r\<rangle>)))
[PROOF STEP]
by (subst random_bst.simps)
         (simp_all add: pair_pmf_def card map_pmf_def bind_assoc_pmf bind_return_pmf)
[PROOF STATE]
proof (state)
this:
map_pmf ipl (random_bst A) = pmf_of_set A \<bind> (\<lambda>x. pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}) \<bind> (\<lambda>(l, r). return_pmf (ipl \<langle>l, x, r\<rangle>)))

goal (2 subgoals):
 1. A = {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
 2. A \<noteq> {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map_pmf ipl (random_bst A) = pmf_of_set A \<bind> (\<lambda>x. pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}) \<bind> (\<lambda>(l, r). return_pmf (ipl \<langle>l, x, r\<rangle>)))

goal (2 subgoals):
 1. A = {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
 2. A \<noteq> {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
have "\<dots> = do {
                      x \<leftarrow> pmf_of_set A;
                      (l,r) \<leftarrow> pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. y > x});
                      return_pmf (n + ipl l + ipl r)
                    }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf_of_set A \<bind> (\<lambda>x. pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}) \<bind> (\<lambda>(l, r). return_pmf (ipl \<langle>l, x, r\<rangle>))) = pmf_of_set A \<bind> (\<lambda>x. pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}) \<bind> (\<lambda>(l, r). return_pmf (n + ipl l + ipl r)))
[PROOF STEP]
proof (intro bind_pmf_cong refl, clarify, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x a b. \<lbrakk>x \<in> set_pmf (pmf_of_set A); (a, b) \<in> set_pmf (pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}))\<rbrakk> \<Longrightarrow> return_pmf (ipl \<langle>a, x, b\<rangle>) = return_pmf (n + ipl a + ipl b)
[PROOF STEP]
case (1 x l r)
[PROOF STATE]
proof (state)
this:
x \<in> set_pmf (pmf_of_set A)
(l, r) \<in> set_pmf (pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}))

goal (1 subgoal):
 1. \<And>x a b. \<lbrakk>x \<in> set_pmf (pmf_of_set A); (a, b) \<in> set_pmf (pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}))\<rbrakk> \<Longrightarrow> return_pmf (ipl \<langle>a, x, b\<rangle>) = return_pmf (n + ipl a + ipl b)
[PROOF STEP]
from 1 and A
[PROOF STATE]
proof (chain)
picking this:
x \<in> set_pmf (pmf_of_set A)
(l, r) \<in> set_pmf (pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}))
finite A
A \<noteq> {}
[PROOF STEP]
have "n = card (A - {x})"
[PROOF STATE]
proof (prove)
using this:
x \<in> set_pmf (pmf_of_set A)
(l, r) \<in> set_pmf (pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}))
finite A
A \<noteq> {}

goal (1 subgoal):
 1. n = card (A - {x})
[PROOF STEP]
by (simp add: n_def)
[PROOF STATE]
proof (state)
this:
n = card (A - {x})

goal (1 subgoal):
 1. \<And>x a b. \<lbrakk>x \<in> set_pmf (pmf_of_set A); (a, b) \<in> set_pmf (pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}))\<rbrakk> \<Longrightarrow> return_pmf (ipl \<langle>a, x, b\<rangle>) = return_pmf (n + ipl a + ipl b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n = card (A - {x})

goal (1 subgoal):
 1. \<And>x a b. \<lbrakk>x \<in> set_pmf (pmf_of_set A); (a, b) \<in> set_pmf (pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}))\<rbrakk> \<Longrightarrow> return_pmf (ipl \<langle>a, x, b\<rangle>) = return_pmf (n + ipl a + ipl b)
[PROOF STEP]
have "A - {x} = {y\<in>A. y < x} \<union> {y\<in>A. y > x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A - {x} = {y \<in> A. y < x} \<union> {y \<in> A. x < y}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A - {x} = {y \<in> A. y < x} \<union> {y \<in> A. x < y}

goal (1 subgoal):
 1. \<And>x a b. \<lbrakk>x \<in> set_pmf (pmf_of_set A); (a, b) \<in> set_pmf (pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}))\<rbrakk> \<Longrightarrow> return_pmf (ipl \<langle>a, x, b\<rangle>) = return_pmf (n + ipl a + ipl b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A - {x} = {y \<in> A. y < x} \<union> {y \<in> A. x < y}

goal (1 subgoal):
 1. \<And>x a b. \<lbrakk>x \<in> set_pmf (pmf_of_set A); (a, b) \<in> set_pmf (pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}))\<rbrakk> \<Longrightarrow> return_pmf (ipl \<langle>a, x, b\<rangle>) = return_pmf (n + ipl a + ipl b)
[PROOF STEP]
have "card \<dots> = card {y\<in>A. y < x} + card {y\<in>A. y > x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ({y \<in> A. y < x} \<union> {y \<in> A. x < y}) = card {y \<in> A. y < x} + card {y \<in> A. x < y}
[PROOF STEP]
using \<open>finite A\<close>
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. card ({y \<in> A. y < x} \<union> {y \<in> A. x < y}) = card {y \<in> A. y < x} + card {y \<in> A. x < y}
[PROOF STEP]
by (intro card_Un_disjoint) auto
[PROOF STATE]
proof (state)
this:
card ({y \<in> A. y < x} \<union> {y \<in> A. x < y}) = card {y \<in> A. y < x} + card {y \<in> A. x < y}

goal (1 subgoal):
 1. \<And>x a b. \<lbrakk>x \<in> set_pmf (pmf_of_set A); (a, b) \<in> set_pmf (pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}))\<rbrakk> \<Longrightarrow> return_pmf (ipl \<langle>a, x, b\<rangle>) = return_pmf (n + ipl a + ipl b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ({y \<in> A. y < x} \<union> {y \<in> A. x < y}) = card {y \<in> A. y < x} + card {y \<in> A. x < y}

goal (1 subgoal):
 1. \<And>x a b. \<lbrakk>x \<in> set_pmf (pmf_of_set A); (a, b) \<in> set_pmf (pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}))\<rbrakk> \<Longrightarrow> return_pmf (ipl \<langle>a, x, b\<rangle>) = return_pmf (n + ipl a + ipl b)
[PROOF STEP]
from 1 and A
[PROOF STATE]
proof (chain)
picking this:
x \<in> set_pmf (pmf_of_set A)
(l, r) \<in> set_pmf (pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}))
finite A
A \<noteq> {}
[PROOF STEP]
have "card {y\<in>A. y < x} = size l"
[PROOF STATE]
proof (prove)
using this:
x \<in> set_pmf (pmf_of_set A)
(l, r) \<in> set_pmf (pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}))
finite A
A \<noteq> {}

goal (1 subgoal):
 1. card {y \<in> A. y < x} = size l
[PROOF STEP]
by (auto dest: size_random_bst)
[PROOF STATE]
proof (state)
this:
card {y \<in> A. y < x} = size l

goal (1 subgoal):
 1. \<And>x a b. \<lbrakk>x \<in> set_pmf (pmf_of_set A); (a, b) \<in> set_pmf (pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}))\<rbrakk> \<Longrightarrow> return_pmf (ipl \<langle>a, x, b\<rangle>) = return_pmf (n + ipl a + ipl b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {y \<in> A. y < x} = size l

goal (1 subgoal):
 1. \<And>x a b. \<lbrakk>x \<in> set_pmf (pmf_of_set A); (a, b) \<in> set_pmf (pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}))\<rbrakk> \<Longrightarrow> return_pmf (ipl \<langle>a, x, b\<rangle>) = return_pmf (n + ipl a + ipl b)
[PROOF STEP]
from 1 and A
[PROOF STATE]
proof (chain)
picking this:
x \<in> set_pmf (pmf_of_set A)
(l, r) \<in> set_pmf (pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}))
finite A
A \<noteq> {}
[PROOF STEP]
have "card {y\<in>A. y > x} = size r"
[PROOF STATE]
proof (prove)
using this:
x \<in> set_pmf (pmf_of_set A)
(l, r) \<in> set_pmf (pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}))
finite A
A \<noteq> {}

goal (1 subgoal):
 1. card {y \<in> A. x < y} = size r
[PROOF STEP]
by (auto dest: size_random_bst)
[PROOF STATE]
proof (state)
this:
card {y \<in> A. x < y} = size r

goal (1 subgoal):
 1. \<And>x a b. \<lbrakk>x \<in> set_pmf (pmf_of_set A); (a, b) \<in> set_pmf (pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}))\<rbrakk> \<Longrightarrow> return_pmf (ipl \<langle>a, x, b\<rangle>) = return_pmf (n + ipl a + ipl b)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
n = size l + size r
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
n = size l + size r

goal (1 subgoal):
 1. return_pmf (ipl \<langle>l, x, r\<rangle>) = return_pmf (n + ipl l + ipl r)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
return_pmf (ipl \<langle>l, x, r\<rangle>) = return_pmf (n + ipl l + ipl r)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
pmf_of_set A \<bind> (\<lambda>x. pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}) \<bind> (\<lambda>(l, r). return_pmf (ipl \<langle>l, x, r\<rangle>))) = pmf_of_set A \<bind> (\<lambda>x. pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}) \<bind> (\<lambda>(l, r). return_pmf (n + ipl l + ipl r)))

goal (2 subgoals):
 1. A = {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
 2. A \<noteq> {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pmf_of_set A \<bind> (\<lambda>x. pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}) \<bind> (\<lambda>(l, r). return_pmf (ipl \<langle>l, x, r\<rangle>))) = pmf_of_set A \<bind> (\<lambda>x. pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}) \<bind> (\<lambda>(l, r). return_pmf (n + ipl l + ipl r)))

goal (2 subgoals):
 1. A = {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
 2. A \<noteq> {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
have "\<dots> = do {
                      x \<leftarrow> pmf_of_set A;
                      (l,r) \<leftarrow> pair_pmf (map_pmf ipl (random_bst {y \<in> A. y < x}))
                                        (map_pmf ipl (random_bst {y \<in> A. y > x}));
                      return_pmf (n + l + r)
                    }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf_of_set A \<bind> (\<lambda>x. pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}) \<bind> (\<lambda>(l, r). return_pmf (n + ipl l + ipl r))) = pmf_of_set A \<bind> (\<lambda>x. pair_pmf (map_pmf ipl (random_bst {y \<in> A. y < x})) (map_pmf ipl (random_bst {y \<in> A. x < y})) \<bind> (\<lambda>(l, r). return_pmf (n + l + r)))
[PROOF STEP]
by (simp add: map_pair [symmetric] case_prod_unfold bind_map_pmf)
[PROOF STATE]
proof (state)
this:
pmf_of_set A \<bind> (\<lambda>x. pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}) \<bind> (\<lambda>(l, r). return_pmf (n + ipl l + ipl r))) = pmf_of_set A \<bind> (\<lambda>x. pair_pmf (map_pmf ipl (random_bst {y \<in> A. y < x})) (map_pmf ipl (random_bst {y \<in> A. x < y})) \<bind> (\<lambda>(l, r). return_pmf (n + l + r)))

goal (2 subgoals):
 1. A = {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
 2. A \<noteq> {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pmf_of_set A \<bind> (\<lambda>x. pair_pmf (random_bst {y \<in> A. y < x}) (random_bst {y \<in> A. x < y}) \<bind> (\<lambda>(l, r). return_pmf (n + ipl l + ipl r))) = pmf_of_set A \<bind> (\<lambda>x. pair_pmf (map_pmf ipl (random_bst {y \<in> A. y < x})) (map_pmf ipl (random_bst {y \<in> A. x < y})) \<bind> (\<lambda>(l, r). return_pmf (n + l + r)))

goal (2 subgoals):
 1. A = {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
 2. A \<noteq> {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
have "\<dots> = do {
                      i \<leftarrow> map_pmf rank (pmf_of_set A);
                      (l,r) \<leftarrow> pair_pmf (rqs_cost i) (rqs_cost (n - i));
                      return_pmf (n + l + r)
                    }" (is "_ = bind_pmf _ ?f")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf_of_set A \<bind> (\<lambda>x. pair_pmf (map_pmf ipl (random_bst {y \<in> A. y < x})) (map_pmf ipl (random_bst {y \<in> A. x < y})) \<bind> (\<lambda>(l, r). return_pmf (n + l + r))) = map_pmf rank (pmf_of_set A) \<bind> (\<lambda>i. pair_pmf (rqs_cost i) (rqs_cost (n - i)) \<bind> (\<lambda>(l, r). return_pmf (n + l + r)))
[PROOF STEP]
unfolding bind_map_pmf
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf_of_set A \<bind> (\<lambda>x. pair_pmf (map_pmf ipl (random_bst {y \<in> A. y < x})) (map_pmf ipl (random_bst {y \<in> A. x < y})) \<bind> (\<lambda>(l, r). return_pmf (n + l + r))) = pmf_of_set A \<bind> (\<lambda>x. pair_pmf (rqs_cost (rank x)) (rqs_cost (n - rank x)) \<bind> (\<lambda>(l, r). return_pmf (n + l + r)))
[PROOF STEP]
proof (intro bind_pmf_cong refl pair_pmf_cong, goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. y < x}) = rqs_cost (rank x)
 2. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (n - rank x)
[PROOF STEP]
case (1 x)
[PROOF STATE]
proof (state)
this:
x \<in> set_pmf (pmf_of_set A)

goal (2 subgoals):
 1. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. y < x}) = rqs_cost (rank x)
 2. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (n - rank x)
[PROOF STEP]
have "map_pmf ipl (random_bst {y \<in> A. y < x}) = rqs_cost (card {y \<in> A. y < x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_pmf ipl (random_bst {y \<in> A. y < x}) = rqs_cost (card {y \<in> A. y < x})
[PROOF STEP]
using 1 and A
[PROOF STATE]
proof (prove)
using this:
x \<in> set_pmf (pmf_of_set A)
finite A
A \<noteq> {}

goal (1 subgoal):
 1. map_pmf ipl (random_bst {y \<in> A. y < x}) = rqs_cost (card {y \<in> A. y < x})
[PROOF STEP]
by (intro psubset.IH) auto
[PROOF STATE]
proof (state)
this:
map_pmf ipl (random_bst {y \<in> A. y < x}) = rqs_cost (card {y \<in> A. y < x})

goal (2 subgoals):
 1. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. y < x}) = rqs_cost (rank x)
 2. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (n - rank x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map_pmf ipl (random_bst {y \<in> A. y < x}) = rqs_cost (card {y \<in> A. y < x})

goal (2 subgoals):
 1. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. y < x}) = rqs_cost (rank x)
 2. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (n - rank x)
[PROOF STEP]
have "{y \<in> A. y < x} = {y \<in> A - {x}. y \<le> x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y \<in> A. y < x} = {y \<in> A - {x}. y \<le> x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{y \<in> A. y < x} = {y \<in> A - {x}. y \<le> x}

goal (2 subgoals):
 1. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. y < x}) = rqs_cost (rank x)
 2. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (n - rank x)
[PROOF STEP]
hence "card {y \<in> A. y < x} = rank x"
[PROOF STATE]
proof (prove)
using this:
{y \<in> A. y < x} = {y \<in> A - {x}. y \<le> x}

goal (1 subgoal):
 1. card {y \<in> A. y < x} = rank x
[PROOF STEP]
by (simp add: rank_def linorder_rank_def)
[PROOF STATE]
proof (state)
this:
card {y \<in> A. y < x} = rank x

goal (2 subgoals):
 1. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. y < x}) = rqs_cost (rank x)
 2. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (n - rank x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
map_pmf ipl (random_bst {y \<in> A. y < x}) = rqs_cost (rank x)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
map_pmf ipl (random_bst {y \<in> A. y < x}) = rqs_cost (rank x)

goal (1 subgoal):
 1. map_pmf ipl (random_bst {y \<in> A. y < x}) = rqs_cost (rank x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
map_pmf ipl (random_bst {y \<in> A. y < x}) = rqs_cost (rank x)

goal (1 subgoal):
 1. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (n - rank x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (n - rank x)
[PROOF STEP]
case (2 x)
[PROOF STATE]
proof (state)
this:
x \<in> set_pmf (pmf_of_set A)

goal (1 subgoal):
 1. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (n - rank x)
[PROOF STEP]
have "map_pmf ipl (random_bst {y \<in> A. y > x}) = rqs_cost (card {y \<in> A. y > x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (card {y \<in> A. x < y})
[PROOF STEP]
using 2 and A
[PROOF STATE]
proof (prove)
using this:
x \<in> set_pmf (pmf_of_set A)
finite A
A \<noteq> {}

goal (1 subgoal):
 1. map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (card {y \<in> A. x < y})
[PROOF STEP]
by (intro psubset.IH) auto
[PROOF STATE]
proof (state)
this:
map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (card {y \<in> A. x < y})

goal (1 subgoal):
 1. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (n - rank x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (card {y \<in> A. x < y})

goal (1 subgoal):
 1. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (n - rank x)
[PROOF STEP]
have "{y \<in> A. y > x} = A - {x} - {y \<in> A - {x}. y \<le> x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y \<in> A. x < y} = A - {x} - {y \<in> A - {x}. y \<le> x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{y \<in> A. x < y} = A - {x} - {y \<in> A - {x}. y \<le> x}

goal (1 subgoal):
 1. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (n - rank x)
[PROOF STEP]
hence "card {y \<in> A. y > x} = card \<dots>"
[PROOF STATE]
proof (prove)
using this:
{y \<in> A. x < y} = A - {x} - {y \<in> A - {x}. y \<le> x}

goal (1 subgoal):
 1. card {y \<in> A. x < y} = card (A - {x} - {y \<in> A - {x}. y \<le> x})
[PROOF STEP]
by (simp only:)
[PROOF STATE]
proof (state)
this:
card {y \<in> A. x < y} = card (A - {x} - {y \<in> A - {x}. y \<le> x})

goal (1 subgoal):
 1. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (n - rank x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {y \<in> A. x < y} = card (A - {x} - {y \<in> A - {x}. y \<le> x})

goal (1 subgoal):
 1. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (n - rank x)
[PROOF STEP]
from 2 and A
[PROOF STATE]
proof (chain)
picking this:
x \<in> set_pmf (pmf_of_set A)
finite A
A \<noteq> {}
[PROOF STEP]
have "\<dots> = n - rank x"
[PROOF STATE]
proof (prove)
using this:
x \<in> set_pmf (pmf_of_set A)
finite A
A \<noteq> {}

goal (1 subgoal):
 1. card (A - {x} - {y \<in> A - {x}. y \<le> x}) = n - rank x
[PROOF STEP]
by (subst card_Diff_subset) (auto simp: rank_def linorder_rank_def n_def)
[PROOF STATE]
proof (state)
this:
card (A - {x} - {y \<in> A - {x}. y \<le> x}) = n - rank x

goal (1 subgoal):
 1. \<And>x. x \<in> set_pmf (pmf_of_set A) \<Longrightarrow> map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (n - rank x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (n - rank x)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (n - rank x)

goal (1 subgoal):
 1. map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (n - rank x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
map_pmf ipl (random_bst {y \<in> A. x < y}) = rqs_cost (n - rank x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
pmf_of_set A \<bind> (\<lambda>x. pair_pmf (map_pmf ipl (random_bst {y \<in> A. y < x})) (map_pmf ipl (random_bst {y \<in> A. x < y})) \<bind> (\<lambda>(l, r). return_pmf (n + l + r))) = map_pmf rank (pmf_of_set A) \<bind> (\<lambda>i. pair_pmf (rqs_cost i) (rqs_cost (n - i)) \<bind> (\<lambda>(l, r). return_pmf (n + l + r)))

goal (2 subgoals):
 1. A = {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
 2. A \<noteq> {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pmf_of_set A \<bind> (\<lambda>x. pair_pmf (map_pmf ipl (random_bst {y \<in> A. y < x})) (map_pmf ipl (random_bst {y \<in> A. x < y})) \<bind> (\<lambda>(l, r). return_pmf (n + l + r))) = map_pmf rank (pmf_of_set A) \<bind> (\<lambda>i. pair_pmf (rqs_cost i) (rqs_cost (n - i)) \<bind> (\<lambda>(l, r). return_pmf (n + l + r)))

goal (2 subgoals):
 1. A = {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
 2. A \<noteq> {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<noteq> {}
[PROOF STEP]
have "map_pmf rank (pmf_of_set A) = pmf_of_set {..<card A}"
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}

goal (1 subgoal):
 1. map_pmf rank (pmf_of_set A) = pmf_of_set {..<card A}
[PROOF STEP]
unfolding rank_def
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}

goal (1 subgoal):
 1. map_pmf (linorder_rank {(x, y). x \<le> y} A) (pmf_of_set A) = pmf_of_set {..<card A}
[PROOF STEP]
by (intro map_pmf_of_set_bij_betw bij_betw_linorder_rank[of UNIV]) auto
[PROOF STATE]
proof (state)
this:
map_pmf rank (pmf_of_set A) = pmf_of_set {..<card A}

goal (2 subgoals):
 1. A = {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
 2. A \<noteq> {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map_pmf rank (pmf_of_set A) = pmf_of_set {..<card A}

goal (2 subgoals):
 1. A = {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
 2. A \<noteq> {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
have "{..<card A} = {..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {..<card A} = {..n}
[PROOF STEP]
by (auto simp: card)
[PROOF STATE]
proof (state)
this:
{..<card A} = {..n}

goal (2 subgoals):
 1. A = {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
 2. A \<noteq> {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{..<card A} = {..n}

goal (2 subgoals):
 1. A = {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
 2. A \<noteq> {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
have "pmf_of_set \<dots> \<bind> ?f = rqs_cost (card A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmf_of_set {..n} \<bind> (\<lambda>i. pair_pmf (rqs_cost i) (rqs_cost (n - i)) \<bind> (\<lambda>(l, r). return_pmf (n + l + r))) = rqs_cost (card A)
[PROOF STEP]
by (simp add: pair_pmf_def bind_assoc_pmf bind_return_pmf card)
[PROOF STATE]
proof (state)
this:
pmf_of_set {..n} \<bind> (\<lambda>i. pair_pmf (rqs_cost i) (rqs_cost (n - i)) \<bind> (\<lambda>(l, r). return_pmf (n + l + r))) = rqs_cost (card A)

goal (2 subgoals):
 1. A = {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
 2. A \<noteq> {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
map_pmf ipl (random_bst A) = rqs_cost (card A)

goal (1 subgoal):
 1. map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
map_pmf ipl (random_bst A) = rqs_cost (card A)

goal (1 subgoal):
 1. A = {} \<Longrightarrow> map_pmf ipl (random_bst A) = rqs_cost (card A)
[PROOF STEP]
qed simp_all
[PROOF STATE]
proof (state)
this:
map_pmf ipl (random_bst A) = rqs_cost (card A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_sgnx_split:
  "(f has_sgnx c) (at x) \<longleftrightarrow> (f has_sgnx c) (at_left x) \<and> (f has_sgnx c) (at_right x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_sgnx c) (at x) = ((f has_sgnx c) (at_left x) \<and> (f has_sgnx c) (at_right x))
[PROOF STEP]
unfolding has_sgnx_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>\<^sub>F x in at x. sgn (f x) = c) = ((\<forall>\<^sub>F x in at_left x. sgn (f x) = c) \<and> (\<forall>\<^sub>F x in at_right x. sgn (f x) = c))
[PROOF STEP]
using eventually_at_split
[PROOF STATE]
proof (prove)
using this:
eventually ?P (at ?x) = (eventually ?P (at_left ?x) \<and> eventually ?P (at_right ?x))

goal (1 subgoal):
 1. (\<forall>\<^sub>F x in at x. sgn (f x) = c) = ((\<forall>\<^sub>F x in at_left x. sgn (f x) = c) \<and> (\<forall>\<^sub>F x in at_right x. sgn (f x) = c))
[PROOF STEP]
by auto


[STATEMENT]
lemma span_basis_det_zero_iff:
assumes "length G = n" "set G \<subseteq> carrier_vec n"
shows "carrier_vec n \<subseteq> span (set G) \<longleftrightarrow> det (mat_of_rows n G) \<noteq> 0" (is ?q1)
      "carrier_vec n \<subseteq> span (set G) \<longleftrightarrow> basis (set G)" (is ?q2)
      "det (mat_of_rows n G) \<noteq> 0 \<longleftrightarrow> basis (set G)" (is ?q3)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (carrier_vec n \<subseteq> local.span (set G)) = (det (mat_of_rows n G) \<noteq> (0::'a)) &&& (carrier_vec n \<subseteq> local.span (set G)) = basis (set G) &&& (det (mat_of_rows n G) \<noteq> (0::'a)) = basis (set G)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (carrier_vec n \<subseteq> local.span (set G)) = (det (mat_of_rows n G) \<noteq> (0::'a))
 2. (carrier_vec n \<subseteq> local.span (set G)) = basis (set G)
 3. (det (mat_of_rows n G) \<noteq> (0::'a)) = basis (set G)
[PROOF STEP]
have dc:"det (mat_of_rows n G) \<noteq> 0 \<Longrightarrow> carrier_vec n \<subseteq> span (set G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mat_of_rows n G) \<noteq> (0::'a) \<Longrightarrow> carrier_vec n \<subseteq> local.span (set G)
[PROOF STEP]
using assms non_span_det_zero
[PROOF STATE]
proof (prove)
using this:
length G = n
set G \<subseteq> carrier_vec n
\<lbrakk>length ?G = n; \<not> carrier_vec n \<subseteq> local.span (set ?G); set ?G \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> det (mat_of_rows n ?G) = (0::'a)

goal (1 subgoal):
 1. det (mat_of_rows n G) \<noteq> (0::'a) \<Longrightarrow> carrier_vec n \<subseteq> local.span (set G)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
det (mat_of_rows n G) \<noteq> (0::'a) \<Longrightarrow> carrier_vec n \<subseteq> local.span (set G)

goal (3 subgoals):
 1. (carrier_vec n \<subseteq> local.span (set G)) = (det (mat_of_rows n G) \<noteq> (0::'a))
 2. (carrier_vec n \<subseteq> local.span (set G)) = basis (set G)
 3. (det (mat_of_rows n G) \<noteq> (0::'a)) = basis (set G)
[PROOF STEP]
have cb:"carrier_vec n \<subseteq> span (set G) \<Longrightarrow> basis (set G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier_vec n \<subseteq> local.span (set G) \<Longrightarrow> basis (set G)
[PROOF STEP]
using assms basis_list_basis
[PROOF STATE]
proof (prove)
using this:
length G = n
set G \<subseteq> carrier_vec n
basis_list ?fs \<Longrightarrow> distinct ?fs
basis_list ?fs \<Longrightarrow> lin_indpt (set ?fs)
basis_list ?fs \<Longrightarrow> basis (set ?fs)

goal (1 subgoal):
 1. carrier_vec n \<subseteq> local.span (set G) \<Longrightarrow> basis (set G)
[PROOF STEP]
by (auto simp: basis_list_def)
[PROOF STATE]
proof (state)
this:
carrier_vec n \<subseteq> local.span (set G) \<Longrightarrow> basis (set G)

goal (3 subgoals):
 1. (carrier_vec n \<subseteq> local.span (set G)) = (det (mat_of_rows n G) \<noteq> (0::'a))
 2. (carrier_vec n \<subseteq> local.span (set G)) = basis (set G)
 3. (det (mat_of_rows n G) \<noteq> (0::'a)) = basis (set G)
[PROOF STEP]
have bd:"basis (set G) \<Longrightarrow> det (mat_of_rows n G) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. basis (set G) \<Longrightarrow> det (mat_of_rows n G) \<noteq> (0::'a)
[PROOF STEP]
using assms basis_det_nonzero
[PROOF STATE]
proof (prove)
using this:
length G = n
set G \<subseteq> carrier_vec n
\<lbrakk>basis (set ?G); length ?G = n\<rbrakk> \<Longrightarrow> det (mat_of_rows n ?G) \<noteq> (0::'a)

goal (1 subgoal):
 1. basis (set G) \<Longrightarrow> det (mat_of_rows n G) \<noteq> (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
basis (set G) \<Longrightarrow> det (mat_of_rows n G) \<noteq> (0::'a)

goal (3 subgoals):
 1. (carrier_vec n \<subseteq> local.span (set G)) = (det (mat_of_rows n G) \<noteq> (0::'a))
 2. (carrier_vec n \<subseteq> local.span (set G)) = basis (set G)
 3. (det (mat_of_rows n G) \<noteq> (0::'a)) = basis (set G)
[PROOF STEP]
show ?q1 ?q2 ?q3
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (carrier_vec n \<subseteq> local.span (set G)) = (det (mat_of_rows n G) \<noteq> (0::'a)) &&& (carrier_vec n \<subseteq> local.span (set G)) = basis (set G) &&& (det (mat_of_rows n G) \<noteq> (0::'a)) = basis (set G)
[PROOF STEP]
using dc cb bd
[PROOF STATE]
proof (prove)
using this:
det (mat_of_rows n G) \<noteq> (0::'a) \<Longrightarrow> carrier_vec n \<subseteq> local.span (set G)
carrier_vec n \<subseteq> local.span (set G) \<Longrightarrow> basis (set G)
basis (set G) \<Longrightarrow> det (mat_of_rows n G) \<noteq> (0::'a)

goal (1 subgoal):
 1. (carrier_vec n \<subseteq> local.span (set G)) = (det (mat_of_rows n G) \<noteq> (0::'a)) &&& (carrier_vec n \<subseteq> local.span (set G)) = basis (set G) &&& (det (mat_of_rows n G) \<noteq> (0::'a)) = basis (set G)
[PROOF STEP]
by metis+
[PROOF STATE]
proof (state)
this:
(carrier_vec n \<subseteq> local.span (set G)) = (det (mat_of_rows n G) \<noteq> (0::'a))
(carrier_vec n \<subseteq> local.span (set G)) = basis (set G)
(det (mat_of_rows n G) \<noteq> (0::'a)) = basis (set G)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powsum_shift1: "x \<cdot> x\<^bsub>m\<^esub>\<^bsup>n\<^esup> = x\<^bsub>m+1\<^esub>\<^bsup>n\<^esup>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<cdot> x\<^bsub>m\<^esub>\<^bsup>n\<^esup> = x\<^bsub>m + 1\<^esub>\<^bsup>n\<^esup>
[PROOF STEP]
apply (induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x \<cdot> x\<^bsub>m\<^esub>\<^bsup>0\<^esup> = x\<^bsub>m + 1\<^esub>\<^bsup>0\<^esup>
 2. \<And>n. x \<cdot> x\<^bsub>m\<^esub>\<^bsup>n\<^esup> = x\<^bsub>m + 1\<^esub>\<^bsup>n\<^esup> \<Longrightarrow> x \<cdot> x\<^bsub>m\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>m + 1\<^esub>\<^bsup>Suc n\<^esup>
[PROOF STEP]
apply (simp_all add: powsum_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. x \<cdot> sum ((^) x) {m..n + m} = x \<cdot> x\<^bsup>n + m\<^esup> + sum ((^) x) {Suc m..n + m} \<Longrightarrow> x \<cdot> (x \<cdot> x\<^bsup>n + m\<^esup> + sum ((^) x) {m..n + m}) = x \<cdot> (x \<cdot> x\<^bsup>n + m\<^esup>) + (x \<cdot> x\<^bsup>n + m\<^esup> + sum ((^) x) {Suc m..n + m})
[PROOF STEP]
apply (metis local.add_left_comm local.distrib_left powsum_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fps_of_poly_shift [simp]: "fps_of_poly (poly_shift n p) = fps_shift n (fps_of_poly p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_of_poly (poly_shift n p) = fps_shift n (fps_of_poly p)
[PROOF STEP]
by (simp add: fps_eq_iff coeff_poly_shift)


[STATEMENT]
lemma fps_lr_inverse_one_one:
  "fps_left_inverse 1 1 = (1::'a::{ab_group_add,mult_zero,one} fps)"
  "fps_right_inverse 1 1 = (1::'b::{comm_monoid_add,mult_zero,uminus,one} fps)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_left_inverse 1 (1::'a) = 1 &&& fps_right_inverse 1 (1::'b) = 1
[PROOF STEP]
by (simp_all add: fps_lr_inverse_one)


[STATEMENT]
lemma fps_of_poly_pderiv: "fps_of_poly (pderiv p) = fps_deriv (fps_of_poly p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_of_poly (pderiv p) = fps_deriv (fps_of_poly p)
[PROOF STEP]
by (intro fps_ext) (simp add: fps_of_poly_nth coeff_pderiv)


[STATEMENT]
lemma (in prob_space) indep_sets_mono_index:
  "J \<subseteq> I \<Longrightarrow> indep_sets F I \<Longrightarrow> indep_sets F J"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>J \<subseteq> I; indep_sets F I\<rbrakk> \<Longrightarrow> indep_sets F J
[PROOF STEP]
unfolding indep_sets_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>J \<subseteq> I; (\<forall>i\<in>I. F i \<subseteq> events) \<and> (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> (\<forall>A\<in>Pi J F. prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))))\<rbrakk> \<Longrightarrow> (\<forall>i\<in>J. F i \<subseteq> events) \<and> (\<forall>Ja\<subseteq>J. Ja \<noteq> {} \<longrightarrow> finite Ja \<longrightarrow> (\<forall>A\<in>Pi Ja F. prob (\<Inter> (A ` Ja)) = (\<Prod>j\<in>Ja. prob (A j))))
[PROOF STEP]
by auto


[STATEMENT]
lemma to_poly_minus:
  assumes "a \<in> carrier R"
  assumes "b \<in> carrier R"
  shows "to_poly (a \<ominus> b) = to_poly a \<ominus>\<^bsub>P\<^esub> to_poly b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_polynomial R (a \<ominus> b) = to_polynomial R a \<ominus>\<^bsub>P\<^esub> to_polynomial R b
[PROOF STEP]
by (metis P.minus_eq P_def R.add.inv_closed R.ring_axioms UP_ring.monom_add
      UP_ring_axioms assms(1) assms(2) monom_a_inv ring.ring_simprules(14) to_polynomial_def)


[STATEMENT]
lemma replicate_mset_eq_iff:
  "replicate_mset m a = replicate_mset n b \<longleftrightarrow> m = 0 \<and> n = 0 \<or> m = n \<and> a = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (replicate_mset m a = replicate_mset n b) = (m = 0 \<and> n = 0 \<or> m = n \<and> a = b)
[PROOF STEP]
by (auto simp add: multiset_eq_iff)


[STATEMENT]
lemma insert_uconnectedV_per_eq:
  assumes    inV: "x\<in>verts"   and subE: "F\<subseteq>E"
  shows "uconnectedV (insert (Upair x x) F) = per_union (uconnectedV F) x x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Restr (uconnected (insert (Upair x x) F)) verts = per_union (Restr (uconnected F) verts) x x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> verts
F \<subseteq> E

goal (1 subgoal):
 1. Restr (uconnected (insert (Upair x x) F)) verts = per_union (Restr (uconnected F) verts) x x
[PROOF STEP]
by(simp add: uconnectedV_insert_selfloop equiv_selfloop_per_union_id[OF equiv_vert_uconnected])


[STATEMENT]
lemma matrix_vector_right_distrib [algebra_simps]:
  "A *v (x + y) = A *v x + A *v y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *v (x + y) = A *v x + A *v y
[PROOF STEP]
by (vector matrix_vector_mult_def sum.distrib distrib_left)


[STATEMENT]
lemma fourtimes_tm_even[simp]: "2 * (length fourtimes_tm div 2) = length fourtimes_tm"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * (length fourtimes_tm div 2) = length fourtimes_tm
[PROOF STEP]
using even_fourtimes_len
[PROOF STATE]
proof (prove)
using this:
is_even (length fourtimes_tm)

goal (1 subgoal):
 1. 2 * (length fourtimes_tm div 2) = length fourtimes_tm
[PROOF STEP]
by arith


[STATEMENT]
lemma arith_geo_mean_sqrt:
  fixes x :: real
  assumes "x \<ge> 0" "y \<ge> 0"
  shows "sqrt (x * y) \<le> (x + y)/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (x * y) \<le> (x + y) / 2
[PROOF STEP]
apply (rule arith_geo_mean)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (sqrt (x * y))\<^sup>2 = x * y
 2. 0 \<le> x
 3. 0 \<le> y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
0 \<le> y

goal (3 subgoals):
 1. (sqrt (x * y))\<^sup>2 = x * y
 2. 0 \<le> x
 3. 0 \<le> y
[PROOF STEP]
apply (auto simp: zero_le_mult_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma rel_list_all2_trans:
  "\<lbrakk> \<And>a b c. \<lbrakk>(a,b) \<in> R; (b,c) \<in> S\<rbrakk> \<Longrightarrow> (a,c) \<in> T;
    list_all2 (fun_of R) as bs; list_all2 (fun_of S) bs cs\<rbrakk>
  \<Longrightarrow> list_all2 (fun_of T) as cs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>a b c. \<lbrakk>(a, b) \<in> R; (b, c) \<in> S\<rbrakk> \<Longrightarrow> (a, c) \<in> T; list_all2 (fun_of R) as bs; list_all2 (fun_of S) bs cs\<rbrakk> \<Longrightarrow> list_all2 (fun_of T) as cs
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>a b c. \<lbrakk>(a, b) \<in> R; (b, c) \<in> S\<rbrakk> \<Longrightarrow> (a, c) \<in> T; list_all2 (fun_of R) as bs; list_all2 (fun_of S) bs cs\<rbrakk> \<Longrightarrow> list_all2 (fun_of T) as cs
[PROOF STEP]
by (rule list_all2_trans) auto


[STATEMENT]
lemma is_inverse\<^sub>L_unique: "is_inverse\<^sub>L f g \<Longrightarrow> is_inverse\<^sub>L f h \<Longrightarrow> g = h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_inverse\<^sub>L f g; is_inverse\<^sub>L f h\<rbrakk> \<Longrightarrow> g = h
[PROOF STEP]
unfolding is_inverse\<^sub>L_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f o\<^sub>L g = id_blinfun \<and> g o\<^sub>L f = id_blinfun; f o\<^sub>L h = id_blinfun \<and> h o\<^sub>L f = id_blinfun\<rbrakk> \<Longrightarrow> g = h
[PROOF STEP]
using blinfun_compose_assoc  blinfun_compose_id(1)
[PROOF STATE]
proof (prove)
using this:
?F o\<^sub>L ?G o\<^sub>L ?H = ?F o\<^sub>L (?G o\<^sub>L ?H)
id_blinfun o\<^sub>L ?f = ?f

goal (1 subgoal):
 1. \<lbrakk>f o\<^sub>L g = id_blinfun \<and> g o\<^sub>L f = id_blinfun; f o\<^sub>L h = id_blinfun \<and> h o\<^sub>L f = id_blinfun\<rbrakk> \<Longrightarrow> g = h
[PROOF STEP]
by metis


[STATEMENT]
lemma LIMSEQ_abs_realpow_zero: "\<bar>c\<bar> < 1 \<Longrightarrow> (\<lambda>n. \<bar>c\<bar> ^ n :: real) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>c\<bar> < 1 \<Longrightarrow> (^) \<bar>c\<bar> \<longlonglongrightarrow> 0
[PROOF STEP]
by (rule LIMSEQ_realpow_zero [OF abs_ge_zero])


[STATEMENT]
lemma Ker_Im_iff : "(Ker = G) = (ImG = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Ker = G) = (ImG = 0)
[PROOF STEP]
using nonempty ker_im_iff[of G T]
[PROOF STATE]
proof (prove)
using this:
G \<noteq> {}
(G \<noteq> {} \<and> G \<subseteq> ker T) = (ImG = 0)

goal (1 subgoal):
 1. (Ker = G) = (ImG = 0)
[PROOF STEP]
by fast


[STATEMENT]
lemma poly_eval_alt: "poly_eval a p = (\<Sum>t\<in>keys p. lookup p t * (\<Prod>x\<in>keys t. a x ^ lookup t x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_eval a p = (\<Sum>t\<in>keys p. lookup p t * (\<Prod>x\<in>keys t. a x ^ lookup t x))
[PROOF STEP]
by (simp add: poly_eval_def poly_subst_def lookup_sum lookup_times_zero subst_pp_def
          lookup_prod_zero lookup_power_zero flip: times_monomial_left)


[STATEMENT]
theorem "~ (\<forall>(i::int). 4 \<le> i --> (\<exists>x y. 0 \<le> x & 0 \<le> y & 3 * x + 5 * y = i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (\<forall>i\<ge>4. \<exists>x y. 0 \<le> x \<and> 0 \<le> y \<and> 3 * x + 5 * y = i)
[PROOF STEP]
by presburger


[STATEMENT]
theorem (in group) snd_iso_thme:
  assumes "subgroup H G"
    and "subgroup N G"
    and "subgroup H (G\<lparr>carrier:= (normalizer G N)\<rparr>)"
  shows "(G\<lparr>carrier:= N<#>H\<rparr> Mod N)  \<cong> (G\<lparr>carrier:= H\<rparr> Mod (H\<inter>N))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := H\<rparr> Mod H \<inter> N
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := H\<rparr> Mod H \<inter> N
[PROOF STEP]
have "G\<lparr>carrier := normalizer G N, carrier := H\<rparr>
       = G\<lparr>carrier := H\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G\<lparr>carrier := normalizer G N, carrier := H\<rparr> = G\<lparr>carrier := H\<rparr>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
G\<lparr>carrier := normalizer G N, carrier := H\<rparr> = G\<lparr>carrier := H\<rparr>

goal (1 subgoal):
 1. G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := H\<rparr> Mod H \<inter> N
[PROOF STEP]
hence "G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H =
         G\<lparr>carrier := H\<rparr> Mod N \<inter> H"
[PROOF STATE]
proof (prove)
using this:
G\<lparr>carrier := normalizer G N, carrier := H\<rparr> = G\<lparr>carrier := H\<rparr>

goal (1 subgoal):
 1. G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H = G\<lparr>carrier := H\<rparr> Mod N \<inter> H
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H = G\<lparr>carrier := H\<rparr> Mod N \<inter> H

goal (1 subgoal):
 1. G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := H\<rparr> Mod H \<inter> N
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H = G\<lparr>carrier := H\<rparr> Mod N \<inter> H

goal (1 subgoal):
 1. G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := H\<rparr> Mod H \<inter> N
[PROOF STEP]
have "G\<lparr>carrier := normalizer G N,
                    carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> =
                G\<lparr>carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> = G\<lparr>carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> = G\<lparr>carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr>

goal (1 subgoal):
 1. G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := H\<rparr> Mod H \<inter> N
[PROOF STEP]
hence "G\<lparr>carrier := normalizer G N,
          carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N =
          G\<lparr>carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N"
[PROOF STATE]
proof (prove)
using this:
G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> = G\<lparr>carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr>

goal (1 subgoal):
 1. G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N = G\<lparr>carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N = G\<lparr>carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N

goal (1 subgoal):
 1. G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := H\<rparr> Mod H \<inter> N
[PROOF STEP]
hence "G\<lparr>carrier := normalizer G N,
          carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N  \<cong>
         G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H =
          (G\<lparr>carrier:= N<#>H\<rparr> Mod N)  \<cong>
         G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H"
[PROOF STATE]
proof (prove)
using this:
G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N = G\<lparr>carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N

goal (1 subgoal):
 1. G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H = G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H
[PROOF STEP]
using subgroup.subset[OF assms(3)]
          subgroup.subset[OF normal_imp_subgroup[OF subgroup_in_normalizer[OF assms(2)]]]
[PROOF STATE]
proof (prove)
using this:
G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N = G\<lparr>carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N
H \<subseteq> carrier (G\<lparr>carrier := normalizer G N\<rparr>)
N \<subseteq> carrier (G\<lparr>carrier := normalizer G N\<rparr>)

goal (1 subgoal):
 1. G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H = G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H = G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H

goal (1 subgoal):
 1. G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := H\<rparr> Mod H \<inter> N
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H = G\<lparr>carrier := H\<rparr> Mod N \<inter> H
G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H = G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H
[PROOF STEP]
have "G\<lparr>carrier := normalizer G N,
                    carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N  \<cong>
                  G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H =
                 (G\<lparr>carrier:= N<#>H\<rparr> Mod N)  \<cong>  G\<lparr>carrier := H\<rparr> Mod N \<inter> H"
[PROOF STATE]
proof (prove)
using this:
G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H = G\<lparr>carrier := H\<rparr> Mod N \<inter> H
G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H = G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H

goal (1 subgoal):
 1. G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H = G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := H\<rparr> Mod N \<inter> H
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H = G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := H\<rparr> Mod N \<inter> H

goal (1 subgoal):
 1. G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := H\<rparr> Mod H \<inter> N
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H = G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := H\<rparr> Mod N \<inter> H

goal (1 subgoal):
 1. G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := H\<rparr> Mod H \<inter> N
[PROOF STEP]
have "G\<lparr>carrier := normalizer G N,
                    carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N  \<cong>
                  G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H
[PROOF STEP]
using group.weak_snd_iso_thme[OF subgroup_imp_group[OF normalizer_imp_subgroup[OF
          subgroup.subset[OF assms(2)]]] assms(3) subgroup_in_normalizer[OF assms(2)]]
[PROOF STATE]
proof (prove)
using this:
G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H

goal (1 subgoal):
 1. G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H

goal (1 subgoal):
 1. G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := H\<rparr> Mod H \<inter> N
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H

goal (1 subgoal):
 1. G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := H\<rparr> Mod H \<inter> N
[PROOF STEP]
have "H\<inter>N = N\<inter>H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H \<inter> N = N \<inter> H
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
subgroup H G
subgroup N G
subgroup H (G\<lparr>carrier := normalizer G N\<rparr>)

goal (1 subgoal):
 1. H \<inter> N = N \<inter> H
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
H \<inter> N = N \<inter> H

goal (1 subgoal):
 1. G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := H\<rparr> Mod H \<inter> N
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H = G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := H\<rparr> Mod N \<inter> H
G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H
H \<inter> N = N \<inter> H
[PROOF STEP]
show "(G\<lparr>carrier:= N<#>H\<rparr> Mod N)  \<cong>  G\<lparr>carrier := H\<rparr> Mod H \<inter> N"
[PROOF STATE]
proof (prove)
using this:
G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H = G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := H\<rparr> Mod N \<inter> H
G\<lparr>carrier := normalizer G N, carrier := N <#>\<^bsub>G\<lparr>carrier := normalizer G N\<rparr>\<^esub> H\<rparr> Mod N \<cong> G\<lparr>carrier := normalizer G N, carrier := H\<rparr> Mod N \<inter> H
H \<inter> N = N \<inter> H

goal (1 subgoal):
 1. G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := H\<rparr> Mod H \<inter> N
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
G\<lparr>carrier := N <#> H\<rparr> Mod N \<cong> G\<lparr>carrier := H\<rparr> Mod H \<inter> N

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma add_replicate:
 "foldl (+) k (replicate m n) = k + m * n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl (+) k (replicate m n) = k + m * n
[PROOF STEP]
by (induction m arbitrary: k, simp_all)


[STATEMENT]
lemma mset_map_tree: "mset_tree (map_tree f t) = image_mset f (mset_tree t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset_tree (map_tree f t) = image_mset f (mset_tree t)
[PROOF STEP]
by (induction t) auto


[STATEMENT]
lemma append_dot_product_split:
  assumes "dim_vec (u @\<^sub>v w) = dim_vec x"
  shows "(u @\<^sub>v w) \<bullet> x = (\<Sum>i\<in>{0..< dim_vec u}. u$i * x$i) + (\<Sum>i\<in>{0..< dim_vec w}. w$i * x$(i + dim_vec u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = (\<Sum>i = 0..<dim_vec u. u $ i * x $ i) + (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = (\<Sum>i = 0..<dim_vec u. u $ i * x $ i) + (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))
[PROOF STEP]
define ix where "ix = vec_first x (dim_vec u)"
[PROOF STATE]
proof (state)
this:
ix = vec_first x (dim_vec u)

goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = (\<Sum>i = 0..<dim_vec u. u $ i * x $ i) + (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))
[PROOF STEP]
define lx where lx: "lx = vec_last x (dim_vec w)"
[PROOF STATE]
proof (state)
this:
lx = vec_last x (dim_vec w)

goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = (\<Sum>i = 0..<dim_vec u. u $ i * x $ i) + (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))
[PROOF STEP]
have *: "(u @\<^sub>v w) \<bullet> x = u \<bullet> ix + w \<bullet> lx"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = u \<bullet> ix + w \<bullet> lx
[PROOF STEP]
using append_split_vec_distrib_scalar_prod ix_def lx assms
[PROOF STATE]
proof (prove)
using this:
dim_vec (?u @\<^sub>v ?w) = dim_vec ?x \<Longrightarrow> (?u @\<^sub>v ?w) \<bullet> ?x = ?u \<bullet> vec_first ?x (dim_vec ?u) + ?w \<bullet> vec_last ?x (dim_vec ?w)
ix = vec_first x (dim_vec u)
lx = vec_last x (dim_vec w)
dim_vec (u @\<^sub>v w) = dim_vec x

goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = u \<bullet> ix + w \<bullet> lx
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(u @\<^sub>v w) \<bullet> x = u \<bullet> ix + w \<bullet> lx

goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = (\<Sum>i = 0..<dim_vec u. u $ i * x $ i) + (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))
[PROOF STEP]
have "(u @\<^sub>v w) \<bullet> x = (\<Sum> i \<in> {0 ..< dim_vec x}. (u @\<^sub>v w) $ i * x $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = (\<Sum>i = 0..<dim_vec x. (u @\<^sub>v w) $ i * x $ i)
[PROOF STEP]
using scalar_prod_def[of "(u @\<^sub>v w)" x]
[PROOF STATE]
proof (prove)
using this:
(u @\<^sub>v w) \<bullet> x \<equiv> \<Sum>i = 0..<dim_vec x. (u @\<^sub>v w) $ i * x $ i

goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = (\<Sum>i = 0..<dim_vec x. (u @\<^sub>v w) $ i * x $ i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(u @\<^sub>v w) \<bullet> x = (\<Sum>i = 0..<dim_vec x. (u @\<^sub>v w) $ i * x $ i)

goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = (\<Sum>i = 0..<dim_vec u. u $ i * x $ i) + (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(u @\<^sub>v w) \<bullet> x = (\<Sum>i = 0..<dim_vec x. (u @\<^sub>v w) $ i * x $ i)

goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = (\<Sum>i = 0..<dim_vec u. u $ i * x $ i) + (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))
[PROOF STEP]
have "... = (\<Sum> i \<in> {0 ..< dim_vec u}. (u @\<^sub>v w) $ i * x $ i) +
                   (\<Sum> i \<in> {dim_vec u ..< dim_vec (u @\<^sub>v w)}. (u @\<^sub>v w) $ i * x $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec x. (u @\<^sub>v w) $ i * x $ i) = (\<Sum>i = 0..<dim_vec u. (u @\<^sub>v w) $ i * x $ i) + (\<Sum>i = dim_vec u..<dim_vec (u @\<^sub>v w). (u @\<^sub>v w) $ i * x $ i)
[PROOF STEP]
using assms sum.atLeastLessThan_concat[of "0" "dim_vec u" "dim_vec (u @\<^sub>v w)"
        "(\<lambda>i. (u @\<^sub>v w) $ i * x $ i)", OF le0[of "dim_vec u"]]
      le_add1[of  "dim_vec u" "dim_vec w"] index_append_vec(2)[of u w]
[PROOF STATE]
proof (prove)
using this:
dim_vec (u @\<^sub>v w) = dim_vec x
dim_vec u \<le> dim_vec (u @\<^sub>v w) \<Longrightarrow> (\<Sum>i = 0..<dim_vec u. (u @\<^sub>v w) $ i * x $ i) + (\<Sum>i = dim_vec u..<dim_vec (u @\<^sub>v w). (u @\<^sub>v w) $ i * x $ i) = (\<Sum>i = 0..<dim_vec (u @\<^sub>v w). (u @\<^sub>v w) $ i * x $ i)
dim_vec u \<le> dim_vec u + dim_vec w
dim_vec (u @\<^sub>v w) = dim_vec u + dim_vec w

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec x. (u @\<^sub>v w) $ i * x $ i) = (\<Sum>i = 0..<dim_vec u. (u @\<^sub>v w) $ i * x $ i) + (\<Sum>i = dim_vec u..<dim_vec (u @\<^sub>v w). (u @\<^sub>v w) $ i * x $ i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<dim_vec x. (u @\<^sub>v w) $ i * x $ i) = (\<Sum>i = 0..<dim_vec u. (u @\<^sub>v w) $ i * x $ i) + (\<Sum>i = dim_vec u..<dim_vec (u @\<^sub>v w). (u @\<^sub>v w) $ i * x $ i)

goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = (\<Sum>i = 0..<dim_vec u. u $ i * x $ i) + (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<dim_vec x. (u @\<^sub>v w) $ i * x $ i) = (\<Sum>i = 0..<dim_vec u. (u @\<^sub>v w) $ i * x $ i) + (\<Sum>i = dim_vec u..<dim_vec (u @\<^sub>v w). (u @\<^sub>v w) $ i * x $ i)

goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = (\<Sum>i = 0..<dim_vec u. u $ i * x $ i) + (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))
[PROOF STEP]
have *: "... =(\<Sum>i\<in>{0..<dim_vec u}. u$i * x$i) + w \<bullet> lx"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec u. (u @\<^sub>v w) $ i * x $ i) + (\<Sum>i = dim_vec u..<dim_vec (u @\<^sub>v w). (u @\<^sub>v w) $ i * x $ i) = (\<Sum>i = 0..<dim_vec u. u $ i * x $ i) + w \<bullet> lx
[PROOF STEP]
using * calculation
[PROOF STATE]
proof (prove)
using this:
(u @\<^sub>v w) \<bullet> x = u \<bullet> ix + w \<bullet> lx
(u @\<^sub>v w) \<bullet> x = (\<Sum>i = 0..<dim_vec u. (u @\<^sub>v w) $ i * x $ i) + (\<Sum>i = dim_vec u..<dim_vec (u @\<^sub>v w). (u @\<^sub>v w) $ i * x $ i)

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec u. (u @\<^sub>v w) $ i * x $ i) + (\<Sum>i = dim_vec u..<dim_vec (u @\<^sub>v w). (u @\<^sub>v w) $ i * x $ i) = (\<Sum>i = 0..<dim_vec u. u $ i * x $ i) + w \<bullet> lx
[PROOF STEP]
by (auto simp: ix_def scalar_prod_def vec_first_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<dim_vec u. (u @\<^sub>v w) $ i * x $ i) + (\<Sum>i = dim_vec u..<dim_vec (u @\<^sub>v w). (u @\<^sub>v w) $ i * x $ i) = (\<Sum>i = 0..<dim_vec u. u $ i * x $ i) + w \<bullet> lx

goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = (\<Sum>i = 0..<dim_vec u. u $ i * x $ i) + (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))
[PROOF STEP]
have "w \<bullet> lx = (\<Sum>i\<in>{0..< dim_vec w}. w$i * x$(i + dim_vec u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<bullet> lx = (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))
[PROOF STEP]
unfolding lx vec_last_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<bullet> vec (dim_vec w) (\<lambda>i. x $ (dim_vec x - dim_vec w + i)) = (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))
[PROOF STEP]
unfolding scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec (vec (dim_vec w) (\<lambda>i. x $ (dim_vec x - dim_vec w + i))). w $ i * vec (dim_vec w) (\<lambda>i. x $ (dim_vec x - dim_vec w + i)) $ i) = (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))
[PROOF STEP]
using add_diff_cancel_right' index_append_vec(2)[of u w]
[PROOF STATE]
proof (prove)
using this:
?a + ?b - ?b = ?a
dim_vec (u @\<^sub>v w) = dim_vec u + dim_vec w

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec (vec (dim_vec w) (\<lambda>i. x $ (dim_vec x - dim_vec w + i))). w $ i * vec (dim_vec w) (\<lambda>i. x $ (dim_vec x - dim_vec w + i)) $ i) = (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))
[PROOF STEP]
by (auto)
      (metis \<open>dim_vec (u @\<^sub>v w) = dim_vec u + dim_vec w\<close> add.commute add_diff_cancel_right' assms)
[PROOF STATE]
proof (state)
this:
w \<bullet> lx = (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))

goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = (\<Sum>i = 0..<dim_vec u. u $ i * x $ i) + (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
w \<bullet> lx = (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
w \<bullet> lx = (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))

goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = (\<Sum>i = 0..<dim_vec u. u $ i * x $ i) + (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))
[PROOF STEP]
using * calculation
[PROOF STATE]
proof (prove)
using this:
w \<bullet> lx = (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))
(\<Sum>i = 0..<dim_vec u. (u @\<^sub>v w) $ i * x $ i) + (\<Sum>i = dim_vec u..<dim_vec (u @\<^sub>v w). (u @\<^sub>v w) $ i * x $ i) = (\<Sum>i = 0..<dim_vec u. u $ i * x $ i) + w \<bullet> lx
(u @\<^sub>v w) \<bullet> x = (\<Sum>i = 0..<dim_vec u. (u @\<^sub>v w) $ i * x $ i) + (\<Sum>i = dim_vec u..<dim_vec (u @\<^sub>v w). (u @\<^sub>v w) $ i * x $ i)

goal (1 subgoal):
 1. (u @\<^sub>v w) \<bullet> x = (\<Sum>i = 0..<dim_vec u. u $ i * x $ i) + (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(u @\<^sub>v w) \<bullet> x = (\<Sum>i = 0..<dim_vec u. u $ i * x $ i) + (\<Sum>i = 0..<dim_vec w. w $ i * x $ (i + dim_vec u))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma jordan_points_inside_outside:
  fixes p :: "real \<Rightarrow> 'a"
  assumes "0 < e"
  assumes jordan: "simple_path p" "pathfinish p = pathstart p"
  assumes x: "x \<in> path_image p"
  obtains y z where "y \<in> inside (path_image p)" "y \<in> ball x e"
    "z \<in> outside (path_image p)" "z \<in> ball x e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>y z. \<lbrakk>y \<in> inside (path_image p); y \<in> ball x e; z \<in> outside (path_image p); z \<in> ball x e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>y z. \<lbrakk>y \<in> inside (path_image p); y \<in> ball x e; z \<in> outside (path_image p); z \<in> ball x e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from Jordan_inside_outside_R2[OF jordan]
[PROOF STATE]
proof (chain)
picking this:
inside (path_image p) \<noteq> {} \<and> open (inside (path_image p)) \<and> connected (inside (path_image p)) \<and> outside (path_image p) \<noteq> {} \<and> open (outside (path_image p)) \<and> connected (outside (path_image p)) \<and> bounded (inside (path_image p)) \<and> \<not> bounded (outside (path_image p)) \<and> inside (path_image p) \<inter> outside (path_image p) = {} \<and> inside (path_image p) \<union> outside (path_image p) = - path_image p \<and> frontier (inside (path_image p)) = path_image p \<and> frontier (outside (path_image p)) = path_image p
[PROOF STEP]
have xi: "x \<in> frontier(inside (path_image p))" and
    xo: "x \<in> frontier(outside (path_image p))"
[PROOF STATE]
proof (prove)
using this:
inside (path_image p) \<noteq> {} \<and> open (inside (path_image p)) \<and> connected (inside (path_image p)) \<and> outside (path_image p) \<noteq> {} \<and> open (outside (path_image p)) \<and> connected (outside (path_image p)) \<and> bounded (inside (path_image p)) \<and> \<not> bounded (outside (path_image p)) \<and> inside (path_image p) \<inter> outside (path_image p) = {} \<and> inside (path_image p) \<union> outside (path_image p) = - path_image p \<and> frontier (inside (path_image p)) = path_image p \<and> frontier (outside (path_image p)) = path_image p

goal (1 subgoal):
 1. x \<in> frontier (inside (path_image p)) &&& x \<in> frontier (outside (path_image p))
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
inside (path_image p) \<noteq> {} \<and> open (inside (path_image p)) \<and> connected (inside (path_image p)) \<and> outside (path_image p) \<noteq> {} \<and> open (outside (path_image p)) \<and> connected (outside (path_image p)) \<and> bounded (inside (path_image p)) \<and> \<not> bounded (outside (path_image p)) \<and> inside (path_image p) \<inter> outside (path_image p) = {} \<and> inside (path_image p) \<union> outside (path_image p) = - path_image p \<and> frontier (inside (path_image p)) = path_image p \<and> frontier (outside (path_image p)) = path_image p
x \<in> path_image p

goal (1 subgoal):
 1. x \<in> frontier (inside (path_image p)) &&& x \<in> frontier (outside (path_image p))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> frontier (inside (path_image p))
x \<in> frontier (outside (path_image p))

goal (1 subgoal):
 1. (\<And>y z. \<lbrakk>y \<in> inside (path_image p); y \<in> ball x e; z \<in> outside (path_image p); z \<in> ball x e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain y where y:"y \<in> inside (path_image p)" "y \<in> ball x e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>y. \<lbrakk>y \<in> inside (path_image p); y \<in> ball x e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>0 < e\<close> xi
[PROOF STATE]
proof (prove)
using this:
0 < e
x \<in> frontier (inside (path_image p))

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>y \<in> inside (path_image p); y \<in> ball x e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding frontier_straddle
[PROOF STATE]
proof (prove)
using this:
0 < e
\<forall>e>0. (\<exists>xa\<in>inside (path_image p). dist x xa < e) \<and> (\<exists>xa. xa \<notin> inside (path_image p) \<and> dist x xa < e)

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>y \<in> inside (path_image p); y \<in> ball x e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> inside (path_image p)
y \<in> ball x e

goal (1 subgoal):
 1. (\<And>y z. \<lbrakk>y \<in> inside (path_image p); y \<in> ball x e; z \<in> outside (path_image p); z \<in> ball x e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain z where z:"z \<in> outside (path_image p)" "z \<in> ball x e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z \<in> outside (path_image p); z \<in> ball x e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>0 < e\<close> xo
[PROOF STATE]
proof (prove)
using this:
0 < e
x \<in> frontier (outside (path_image p))

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z \<in> outside (path_image p); z \<in> ball x e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding frontier_straddle
[PROOF STATE]
proof (prove)
using this:
0 < e
\<forall>e>0. (\<exists>xa\<in>outside (path_image p). dist x xa < e) \<and> (\<exists>xa. xa \<notin> outside (path_image p) \<and> dist x xa < e)

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z \<in> outside (path_image p); z \<in> ball x e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z \<in> outside (path_image p)
z \<in> ball x e

goal (1 subgoal):
 1. (\<And>y z. \<lbrakk>y \<in> inside (path_image p); y \<in> ball x e; z \<in> outside (path_image p); z \<in> ball x e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. thesis
[PROOF STEP]
using y z that
[PROOF STATE]
proof (prove)
using this:
y \<in> inside (path_image p)
y \<in> ball x e
z \<in> outside (path_image p)
z \<in> ball x e
\<lbrakk>?y2 \<in> inside (path_image p); ?y2 \<in> ball x e; ?z2 \<in> outside (path_image p); ?z2 \<in> ball x e\<rbrakk> \<Longrightarrow> thesis

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eval_fps_const [simp]:
  fixes c :: "'a :: {banach, real_normed_div_algebra}"
  shows "eval_fps (fps_const c) z = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fps (fps_const c) z = c
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eval_fps (fps_const c) z = c
[PROOF STEP]
have "(\<lambda>n::nat. if n \<in> {0} then c else 0) sums (\<Sum>n\<in>{0::nat}. c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. if n \<in> {0} then c else (0::'a)) sums (\<Sum>n\<in>{0}. c)
[PROOF STEP]
by (rule sums_If_finite_set) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. if n \<in> {0} then c else (0::'a)) sums (\<Sum>n\<in>{0}. c)

goal (1 subgoal):
 1. eval_fps (fps_const c) z = c
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. if n \<in> {0} then c else (0::'a)) sums (\<Sum>n\<in>{0}. c)

goal (1 subgoal):
 1. eval_fps (fps_const c) z = c
[PROOF STEP]
have "?this \<longleftrightarrow> (\<lambda>n::nat. fps_nth (fps_const c) n * z ^ n) sums (\<Sum>n\<in>{0::nat}. c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. if n \<in> {0} then c else (0::'a)) sums (\<Sum>n\<in>{0}. c) = (\<lambda>n. fps_nth (fps_const c) n * z ^ n) sums (\<Sum>n\<in>{0}. c)
[PROOF STEP]
by (intro sums_cong) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. if n \<in> {0} then c else (0::'a)) sums (\<Sum>n\<in>{0}. c) = (\<lambda>n. fps_nth (fps_const c) n * z ^ n) sums (\<Sum>n\<in>{0}. c)

goal (1 subgoal):
 1. eval_fps (fps_const c) z = c
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. if n \<in> {0} then c else (0::'a)) sums (\<Sum>n\<in>{0}. c) = (\<lambda>n. fps_nth (fps_const c) n * z ^ n) sums (\<Sum>n\<in>{0}. c)

goal (1 subgoal):
 1. eval_fps (fps_const c) z = c
[PROOF STEP]
have "(\<Sum>n\<in>{0::nat}. c) = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n\<in>{0}. c) = c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>n\<in>{0}. c) = c

goal (1 subgoal):
 1. eval_fps (fps_const c) z = c
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. fps_nth (fps_const c) n * z ^ n) sums c
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. fps_nth (fps_const c) n * z ^ n) sums c

goal (1 subgoal):
 1. eval_fps (fps_const c) z = c
[PROOF STEP]
by (simp add: eval_fps_def sums_iff)
[PROOF STATE]
proof (state)
this:
eval_fps (fps_const c) z = c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_basis_columns_Gram_Schmidt_matrix:
  fixes A::"real^'n::{mod_type}^'m::{mod_type}"
  assumes b: "is_basis (columns A)"
  and c: "card (columns A) = ncols A"
  shows "is_basis (columns (Gram_Schmidt_matrix A))
  \<and> card (columns (Gram_Schmidt_matrix A)) = ncols A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_basis (columns (Gram_Schmidt_matrix A)) \<and> card (columns (Gram_Schmidt_matrix A)) = ncols A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. is_basis (columns (Gram_Schmidt_matrix A)) \<and> card (columns (Gram_Schmidt_matrix A)) = ncols A
[PROOF STEP]
have span_UNIV: "vec.span (columns (Gram_Schmidt_matrix A)) = (UNIV::(real^'m::{mod_type}) set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.span (columns (Gram_Schmidt_matrix A)) = UNIV
[PROOF STEP]
using span_Gram_Schmidt_matrix b
[PROOF STATE]
proof (prove)
using this:
span (columns ?A) = span (columns (Gram_Schmidt_matrix ?A))
is_basis (columns A)

goal (1 subgoal):
 1. vec.span (columns (Gram_Schmidt_matrix A)) = UNIV
[PROOF STEP]
unfolding is_basis_def
[PROOF STATE]
proof (prove)
using this:
span (columns ?A) = span (columns (Gram_Schmidt_matrix ?A))
vec.independent (columns A) \<and> vec.span (columns A) = UNIV

goal (1 subgoal):
 1. vec.span (columns (Gram_Schmidt_matrix A)) = UNIV
[PROOF STEP]
by (metis span_vec_eq)
[PROOF STATE]
proof (state)
this:
vec.span (columns (Gram_Schmidt_matrix A)) = UNIV

goal (1 subgoal):
 1. is_basis (columns (Gram_Schmidt_matrix A)) \<and> card (columns (Gram_Schmidt_matrix A)) = ncols A
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
vec.span (columns (Gram_Schmidt_matrix A)) = UNIV

goal (1 subgoal):
 1. is_basis (columns (Gram_Schmidt_matrix A)) \<and> card (columns (Gram_Schmidt_matrix A)) = ncols A
[PROOF STEP]
have c_eq: "card (columns (Gram_Schmidt_matrix A)) = ncols A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (columns (Gram_Schmidt_matrix A)) = ncols A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (columns (Gram_Schmidt_matrix A)) = ncols A
[PROOF STEP]
have "card (columns A) \<le> card (columns (Gram_Schmidt_matrix A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (columns A) \<le> card (columns (Gram_Schmidt_matrix A))
[PROOF STEP]
by (metis b is_basis_def finite_columns vec.independent_span_bound span_UNIV top_greatest)
[PROOF STATE]
proof (state)
this:
card (columns A) \<le> card (columns (Gram_Schmidt_matrix A))

goal (1 subgoal):
 1. card (columns (Gram_Schmidt_matrix A)) = ncols A
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
card (columns A) \<le> card (columns (Gram_Schmidt_matrix A))

goal (1 subgoal):
 1. card (columns (Gram_Schmidt_matrix A)) = ncols A
[PROOF STEP]
using c
[PROOF STATE]
proof (prove)
using this:
card (columns A) \<le> card (columns (Gram_Schmidt_matrix A))
card (columns A) = ncols A

goal (1 subgoal):
 1. card (columns (Gram_Schmidt_matrix A)) = ncols A
[PROOF STEP]
using card_columns_le_ncols
[PROOF STATE]
proof (prove)
using this:
card (columns A) \<le> card (columns (Gram_Schmidt_matrix A))
card (columns A) = ncols A
card (columns ?A) \<le> ncols ?A

goal (1 subgoal):
 1. card (columns (Gram_Schmidt_matrix A)) = ncols A
[PROOF STEP]
by (metis le_antisym ncols_def)
[PROOF STATE]
proof (state)
this:
card (columns (Gram_Schmidt_matrix A)) = ncols A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card (columns (Gram_Schmidt_matrix A)) = ncols A

goal (1 subgoal):
 1. is_basis (columns (Gram_Schmidt_matrix A)) \<and> card (columns (Gram_Schmidt_matrix A)) = ncols A
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (columns (Gram_Schmidt_matrix A)) = ncols A

goal (1 subgoal):
 1. is_basis (columns (Gram_Schmidt_matrix A)) \<and> card (columns (Gram_Schmidt_matrix A)) = ncols A
[PROOF STEP]
have "vec.independent (columns (Gram_Schmidt_matrix A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.independent (columns (Gram_Schmidt_matrix A))
[PROOF STEP]
proof (rule vec.card_le_dim_spanning[of _ "UNIV::(real^'m::{mod_type}) set"])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. columns (Gram_Schmidt_matrix A) \<subseteq> UNIV
 2. UNIV \<subseteq> vec.span (columns (Gram_Schmidt_matrix A))
 3. finite (columns (Gram_Schmidt_matrix A))
 4. card (columns (Gram_Schmidt_matrix A)) \<le> vec.dim UNIV
[PROOF STEP]
show "columns (Gram_Schmidt_matrix A) \<subseteq> UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. columns (Gram_Schmidt_matrix A) \<subseteq> UNIV
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
columns (Gram_Schmidt_matrix A) \<subseteq> UNIV

goal (3 subgoals):
 1. UNIV \<subseteq> vec.span (columns (Gram_Schmidt_matrix A))
 2. finite (columns (Gram_Schmidt_matrix A))
 3. card (columns (Gram_Schmidt_matrix A)) \<le> vec.dim UNIV
[PROOF STEP]
show "UNIV \<subseteq> vec.span (columns (Gram_Schmidt_matrix A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UNIV \<subseteq> vec.span (columns (Gram_Schmidt_matrix A))
[PROOF STEP]
using span_UNIV
[PROOF STATE]
proof (prove)
using this:
vec.span (columns (Gram_Schmidt_matrix A)) = UNIV

goal (1 subgoal):
 1. UNIV \<subseteq> vec.span (columns (Gram_Schmidt_matrix A))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
UNIV \<subseteq> vec.span (columns (Gram_Schmidt_matrix A))

goal (2 subgoals):
 1. finite (columns (Gram_Schmidt_matrix A))
 2. card (columns (Gram_Schmidt_matrix A)) \<le> vec.dim UNIV
[PROOF STEP]
show "finite (columns (Gram_Schmidt_matrix A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (columns (Gram_Schmidt_matrix A))
[PROOF STEP]
using finite_columns
[PROOF STATE]
proof (prove)
using this:
finite (columns ?A)

goal (1 subgoal):
 1. finite (columns (Gram_Schmidt_matrix A))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
finite (columns (Gram_Schmidt_matrix A))

goal (1 subgoal):
 1. card (columns (Gram_Schmidt_matrix A)) \<le> vec.dim UNIV
[PROOF STEP]
show "card (columns (Gram_Schmidt_matrix A)) \<le> vec.dim (UNIV::(real^'m::{mod_type}) set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (columns (Gram_Schmidt_matrix A)) \<le> vec.dim UNIV
[PROOF STEP]
by (metis b c c_eq eq_iff is_basis_def vec.dim_span_eq_card_independent)
[PROOF STATE]
proof (state)
this:
card (columns (Gram_Schmidt_matrix A)) \<le> vec.dim UNIV

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
vec.independent (columns (Gram_Schmidt_matrix A))

goal (1 subgoal):
 1. is_basis (columns (Gram_Schmidt_matrix A)) \<and> card (columns (Gram_Schmidt_matrix A)) = ncols A
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
vec.span (columns (Gram_Schmidt_matrix A)) = UNIV
card (columns (Gram_Schmidt_matrix A)) = ncols A
vec.independent (columns (Gram_Schmidt_matrix A))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
vec.span (columns (Gram_Schmidt_matrix A)) = UNIV
card (columns (Gram_Schmidt_matrix A)) = ncols A
vec.independent (columns (Gram_Schmidt_matrix A))

goal (1 subgoal):
 1. is_basis (columns (Gram_Schmidt_matrix A)) \<and> card (columns (Gram_Schmidt_matrix A)) = ncols A
[PROOF STEP]
unfolding is_basis_def
[PROOF STATE]
proof (prove)
using this:
vec.span (columns (Gram_Schmidt_matrix A)) = UNIV
card (columns (Gram_Schmidt_matrix A)) = ncols A
vec.independent (columns (Gram_Schmidt_matrix A))

goal (1 subgoal):
 1. (vec.independent (columns (Gram_Schmidt_matrix A)) \<and> vec.span (columns (Gram_Schmidt_matrix A)) = UNIV) \<and> card (columns (Gram_Schmidt_matrix A)) = ncols A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
is_basis (columns (Gram_Schmidt_matrix A)) \<and> card (columns (Gram_Schmidt_matrix A)) = ncols A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma  norm_and_cross_eq_0:
   "x \<bullet> y = 0 \<and> x \<times> y = 0 \<longleftrightarrow> x = 0 \<or> y = 0" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<bullet> y = 0 \<and> x \<times> y = 0) = (x = 0 \<or> y = 0)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<bullet> y = 0 \<and> x \<times> y = 0 \<Longrightarrow> x = 0 \<or> y = 0
 2. x = 0 \<or> y = 0 \<Longrightarrow> x \<bullet> y = 0 \<and> x \<times> y = 0
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
x \<bullet> y = 0 \<and> x \<times> y = 0

goal (2 subgoals):
 1. x \<bullet> y = 0 \<and> x \<times> y = 0 \<Longrightarrow> x = 0 \<or> y = 0
 2. x = 0 \<or> y = 0 \<Longrightarrow> x \<bullet> y = 0 \<and> x \<times> y = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<bullet> y = 0 \<and> x \<times> y = 0
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
x \<bullet> y = 0 \<and> x \<times> y = 0

goal (1 subgoal):
 1. x = 0 \<or> y = 0
[PROOF STEP]
by (metis cross_dot_cancel cross_zero_right inner_zero_right)
[PROOF STATE]
proof (state)
this:
x = 0 \<or> y = 0

goal (1 subgoal):
 1. x = 0 \<or> y = 0 \<Longrightarrow> x \<bullet> y = 0 \<and> x \<times> y = 0
[PROOF STEP]
qed auto