[STATEMENT]
lemma crepresentation_from_representation:
  assumes a1: "cindependent B" and a2: "b \<in> B" and a3: "finite B"
  shows "crepresentation B \<psi> b = (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b)
                           + \<i> *\<^sub>C (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
proof (cases "\<psi> \<in> cspan B")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
define B' where "B' = B \<union> (*\<^sub>C) \<i> ` B"
[PROOF STATE]
proof (state)
this:
B' = B \<union> (*\<^sub>C) \<i> ` B

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
\<psi> \<in> cspan B

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
define r  where "r v = real_vector.representation B' \<psi> v" for v
[PROOF STATE]
proof (state)
this:
r ?v = representation B' \<psi> ?v

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
define r' where "r' v = real_vector.representation B' \<psi> (\<i> *\<^sub>C v)" for v
[PROOF STATE]
proof (state)
this:
r' ?v = representation B' \<psi> (\<i> *\<^sub>C ?v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
define f  where "f v = r v + \<i> *\<^sub>C r' v" for v
[PROOF STATE]
proof (state)
this:
f ?v = complex_of_real (r ?v) + \<i> *\<^sub>C complex_of_real (r' ?v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
define g  where "g v = crepresentation B \<psi> v" for v
[PROOF STATE]
proof (state)
this:
g ?v = crepresentation B \<psi> ?v

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have "(\<Sum>v | g v \<noteq> 0. g v *\<^sub>C v) = \<psi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v | g v \<noteq> 0. g v *\<^sub>C v) = \<psi>
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v | crepresentation B \<psi> v \<noteq> 0. crepresentation B \<psi> v *\<^sub>C v) = \<psi>
[PROOF STEP]
using Collect_cong Collect_mono_iff DiffD1 DiffD2 True a1
      complex_vector.finite_representation
      complex_vector.sum_nonzero_representation_eq sum.mono_neutral_cong_left
[PROOF STATE]
proof (prove)
using this:
(\<And>x. ?P x = ?Q x) \<Longrightarrow> {x. ?P x} = {x. ?Q x}
(Collect ?P \<subseteq> Collect ?Q) = (\<forall>x. ?P x \<longrightarrow> ?Q x)
?c \<in> ?A - ?B \<Longrightarrow> ?c \<in> ?A
\<lbrakk>?c \<in> ?A - ?B; ?c \<in> ?B\<rbrakk> \<Longrightarrow> ?P
\<psi> \<in> cspan B
cindependent B
finite {b. crepresentation ?basis ?v b \<noteq> 0}
\<lbrakk>cindependent ?basis; ?v \<in> cspan ?basis\<rbrakk> \<Longrightarrow> (\<Sum>b | crepresentation ?basis ?v b \<noteq> 0. crepresentation ?basis ?v b *\<^sub>C b) = ?v
\<lbrakk>finite ?T; ?S \<subseteq> ?T; \<forall>i\<in>?T - ?S. ?h i = (0::?'a); \<And>x. x \<in> ?S \<Longrightarrow> ?g x = ?h x\<rbrakk> \<Longrightarrow> sum ?g ?S = sum ?h ?T

goal (1 subgoal):
 1. (\<Sum>v | crepresentation B \<psi> v \<noteq> 0. crepresentation B \<psi> v *\<^sub>C v) = \<psi>
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<Sum>v | g v \<noteq> 0. g v *\<^sub>C v) = \<psi>

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>v | g v \<noteq> 0. g v *\<^sub>C v) = \<psi>

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have "finite {v. g v \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {v. g v \<noteq> 0}
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {v. crepresentation B \<psi> v \<noteq> 0}
[PROOF STEP]
by (simp add: complex_vector.finite_representation)
[PROOF STATE]
proof (state)
this:
finite {v. g v \<noteq> 0}

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite {v. g v \<noteq> 0}

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have "v \<in> B"
    if "g v \<noteq> 0" for v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> B
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
g v \<noteq> 0

goal (1 subgoal):
 1. v \<in> B
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
using this:
crepresentation B \<psi> v \<noteq> 0

goal (1 subgoal):
 1. v \<in> B
[PROOF STEP]
by (simp add: complex_vector.representation_ne_zero)
[PROOF STATE]
proof (state)
this:
g ?v \<noteq> 0 \<Longrightarrow> ?v \<in> B

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>v | g v \<noteq> 0. g v *\<^sub>C v) = \<psi>
finite {v. g v \<noteq> 0}
g ?v \<noteq> 0 \<Longrightarrow> ?v \<in> B
[PROOF STEP]
have rep1: "(\<Sum>v\<in>B. g v *\<^sub>C v) = \<psi>"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>v | g v \<noteq> 0. g v *\<^sub>C v) = \<psi>
finite {v. g v \<noteq> 0}
g ?v \<noteq> 0 \<Longrightarrow> ?v \<in> B

goal (1 subgoal):
 1. (\<Sum>v\<in>B. g v *\<^sub>C v) = \<psi>
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
using this:
(\<Sum>v | crepresentation B \<psi> v \<noteq> 0. crepresentation B \<psi> v *\<^sub>C v) = \<psi>
finite {v. crepresentation B \<psi> v \<noteq> 0}
crepresentation B \<psi> ?v \<noteq> 0 \<Longrightarrow> ?v \<in> B

goal (1 subgoal):
 1. (\<Sum>v\<in>B. crepresentation B \<psi> v *\<^sub>C v) = \<psi>
[PROOF STEP]
using a3 True a1 complex_vector.sum_representation_eq
[PROOF STATE]
proof (prove)
using this:
(\<Sum>v | crepresentation B \<psi> v \<noteq> 0. crepresentation B \<psi> v *\<^sub>C v) = \<psi>
finite {v. crepresentation B \<psi> v \<noteq> 0}
crepresentation B \<psi> ?v \<noteq> 0 \<Longrightarrow> ?v \<in> B
finite B
\<psi> \<in> cspan B
cindependent B
\<lbrakk>cindependent ?basis; ?v \<in> cspan ?basis; finite ?B; ?basis \<subseteq> ?B\<rbrakk> \<Longrightarrow> (\<Sum>b\<in>?B. crepresentation ?basis ?v b *\<^sub>C b) = ?v

goal (1 subgoal):
 1. (\<Sum>v\<in>B. crepresentation B \<psi> v *\<^sub>C v) = \<psi>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B. g v *\<^sub>C v) = \<psi>

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have l0': "inj ((*\<^sub>C) \<i>::'a \<Rightarrow>'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj ((*\<^sub>C) \<i>)
[PROOF STEP]
unfolding inj_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. \<i> *\<^sub>C x = \<i> *\<^sub>C y \<longrightarrow> x = y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inj ((*\<^sub>C) \<i>)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have l0: "inj ((*\<^sub>C) (- \<i>)::'a \<Rightarrow>'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj ((*\<^sub>C) (- \<i>))
[PROOF STEP]
unfolding inj_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. - \<i> *\<^sub>C x = - \<i> *\<^sub>C y \<longrightarrow> x = y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inj ((*\<^sub>C) (- \<i>))

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have l1: "(*\<^sub>C) (- \<i>) ` B \<inter> B = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*\<^sub>C) (- \<i>) ` B \<inter> B = {}
[PROOF STEP]
using cindependent_inter_scaleC_cindependent[where B=B and c = "- \<i>"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>cindependent B; - \<i> \<noteq> 1\<rbrakk> \<Longrightarrow> B \<inter> (*\<^sub>C) (- \<i>) ` B = {}

goal (1 subgoal):
 1. (*\<^sub>C) (- \<i>) ` B \<inter> B = {}
[PROOF STEP]
by (metis Int_commute a1 add.inverse_inverse complex_i_not_one i_squared mult_cancel_left1
        neg_equal_0_iff_equal)
[PROOF STATE]
proof (state)
this:
(*\<^sub>C) (- \<i>) ` B \<inter> B = {}

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have l2: "B \<inter> (*\<^sub>C) \<i> ` B = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<inter> (*\<^sub>C) \<i> ` B = {}
[PROOF STEP]
by (simp add: a1 cindependent_inter_scaleC_cindependent)
[PROOF STATE]
proof (state)
this:
B \<inter> (*\<^sub>C) \<i> ` B = {}

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have rr1: "r (\<i> *\<^sub>C v) = r' v" for v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r (\<i> *\<^sub>C v) = r' v
[PROOF STEP]
unfolding r_def r'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. representation B' \<psi> (\<i> *\<^sub>C v) = representation B' \<psi> (\<i> *\<^sub>C v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
r (\<i> *\<^sub>C ?v) = r' ?v

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have k1: "independent B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. independent B'
[PROOF STEP]
unfolding B'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. independent (B \<union> (*\<^sub>C) \<i> ` B)
[PROOF STEP]
using a1 real_independent_from_complex_independent
[PROOF STATE]
proof (prove)
using this:
cindependent B
cindependent ?B \<Longrightarrow> independent (?B \<union> (*\<^sub>C) \<i> ` ?B)

goal (1 subgoal):
 1. independent (B \<union> (*\<^sub>C) \<i> ` B)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
independent B'

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have "\<psi> \<in> span B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<psi> \<in> span B'
[PROOF STEP]
using B'_def True cspan_as_span
[PROOF STATE]
proof (prove)
using this:
B' = B \<union> (*\<^sub>C) \<i> ` B
\<psi> \<in> cspan B
cspan ?B = span (?B \<union> (*\<^sub>C) \<i> ` ?B)

goal (1 subgoal):
 1. \<psi> \<in> span B'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<psi> \<in> span B'

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have "v \<in> B'"
    if "r v \<noteq> 0"
    for v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> B'
[PROOF STEP]
unfolding r_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> B'
[PROOF STEP]
using r_def real_vector.representation_ne_zero that
[PROOF STATE]
proof (prove)
using this:
r ?v = representation B' \<psi> ?v
representation ?basis ?v ?b \<noteq> 0 \<Longrightarrow> ?b \<in> ?basis
r v \<noteq> 0

goal (1 subgoal):
 1. v \<in> B'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
r ?v \<noteq> 0 \<Longrightarrow> ?v \<in> B'

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have "finite B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite B'
[PROOF STEP]
unfolding B'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (B \<union> (*\<^sub>C) \<i> ` B)
[PROOF STEP]
using a3
[PROOF STATE]
proof (prove)
using this:
finite B

goal (1 subgoal):
 1. finite (B \<union> (*\<^sub>C) \<i> ` B)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite B'

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have "(\<Sum>v\<in>B'. r v *\<^sub>R v) = \<psi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>B'. r v *\<^sub>R v) = \<psi>
[PROOF STEP]
unfolding r_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>B'. representation B' \<psi> v *\<^sub>R v) = \<psi>
[PROOF STEP]
using True  Real_Vector_Spaces.real_vector.sum_representation_eq[where B = B' and basis = B'
        and v = \<psi>]
[PROOF STATE]
proof (prove)
using this:
\<psi> \<in> cspan B
\<lbrakk>independent B'; \<psi> \<in> span B'; finite B'; B' \<subseteq> B'\<rbrakk> \<Longrightarrow> (\<Sum>b\<in>B'. representation B' \<psi> b *\<^sub>R b) = \<psi>

goal (1 subgoal):
 1. (\<Sum>v\<in>B'. representation B' \<psi> v *\<^sub>R v) = \<psi>
[PROOF STEP]
by (smt Real_Vector_Spaces.dependent_raw_def \<open>\<psi> \<in> Real_Vector_Spaces.span B'\<close> \<open>finite B'\<close>
        equalityD2 k1)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B'. r v *\<^sub>R v) = \<psi>

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have d1: "(\<Sum>v\<in>B. r (\<i> *\<^sub>C v) *\<^sub>R (\<i> *\<^sub>C v)) = (\<Sum>v\<in>(*\<^sub>C) \<i> ` B. r v *\<^sub>R v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>B. r (\<i> *\<^sub>C v) *\<^sub>R \<i> *\<^sub>C v) = (\<Sum>v\<in>(*\<^sub>C) \<i> ` B. r v *\<^sub>R v)
[PROOF STEP]
using l0'
[PROOF STATE]
proof (prove)
using this:
inj ((*\<^sub>C) \<i>)

goal (1 subgoal):
 1. (\<Sum>v\<in>B. r (\<i> *\<^sub>C v) *\<^sub>R \<i> *\<^sub>C v) = (\<Sum>v\<in>(*\<^sub>C) \<i> ` B. r v *\<^sub>R v)
[PROOF STEP]
by (metis (mono_tags, lifting) inj_eq inj_on_def sum.reindex_cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B. r (\<i> *\<^sub>C v) *\<^sub>R \<i> *\<^sub>C v) = (\<Sum>v\<in>(*\<^sub>C) \<i> ` B. r v *\<^sub>R v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have "(\<Sum>v\<in>B. (r v + \<i> * (r' v)) *\<^sub>C v) = (\<Sum>v\<in>B. r v *\<^sub>C v + (\<i> * r' v) *\<^sub>C v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>B. (complex_of_real (r v) + \<i> * complex_of_real (r' v)) *\<^sub>C v) = (\<Sum>v\<in>B. complex_of_real (r v) *\<^sub>C v + (\<i> * complex_of_real (r' v)) *\<^sub>C v)
[PROOF STEP]
by (meson scaleC_left.add)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B. (complex_of_real (r v) + \<i> * complex_of_real (r' v)) *\<^sub>C v) = (\<Sum>v\<in>B. complex_of_real (r v) *\<^sub>C v + (\<i> * complex_of_real (r' v)) *\<^sub>C v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B. (complex_of_real (r v) + \<i> * complex_of_real (r' v)) *\<^sub>C v) = (\<Sum>v\<in>B. complex_of_real (r v) *\<^sub>C v + (\<i> * complex_of_real (r' v)) *\<^sub>C v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have "\<dots> = (\<Sum>v\<in>B. r v *\<^sub>C v) + (\<Sum>v\<in>B. (\<i> * r' v) *\<^sub>C v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>B. complex_of_real (r v) *\<^sub>C v + (\<i> * complex_of_real (r' v)) *\<^sub>C v) = (\<Sum>v\<in>B. complex_of_real (r v) *\<^sub>C v) + (\<Sum>v\<in>B. (\<i> * complex_of_real (r' v)) *\<^sub>C v)
[PROOF STEP]
using sum.distrib
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>?A. ?g x + ?h x) = sum ?g ?A + sum ?h ?A

goal (1 subgoal):
 1. (\<Sum>v\<in>B. complex_of_real (r v) *\<^sub>C v + (\<i> * complex_of_real (r' v)) *\<^sub>C v) = (\<Sum>v\<in>B. complex_of_real (r v) *\<^sub>C v) + (\<Sum>v\<in>B. (\<i> * complex_of_real (r' v)) *\<^sub>C v)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B. complex_of_real (r v) *\<^sub>C v + (\<i> * complex_of_real (r' v)) *\<^sub>C v) = (\<Sum>v\<in>B. complex_of_real (r v) *\<^sub>C v) + (\<Sum>v\<in>B. (\<i> * complex_of_real (r' v)) *\<^sub>C v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B. complex_of_real (r v) *\<^sub>C v + (\<i> * complex_of_real (r' v)) *\<^sub>C v) = (\<Sum>v\<in>B. complex_of_real (r v) *\<^sub>C v) + (\<Sum>v\<in>B. (\<i> * complex_of_real (r' v)) *\<^sub>C v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have "\<dots> = (\<Sum>v\<in>B. r v *\<^sub>C v) + (\<Sum>v\<in>B. \<i> *\<^sub>C (r' v *\<^sub>C v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>B. complex_of_real (r v) *\<^sub>C v) + (\<Sum>v\<in>B. (\<i> * complex_of_real (r' v)) *\<^sub>C v) = (\<Sum>v\<in>B. complex_of_real (r v) *\<^sub>C v) + (\<Sum>v\<in>B. \<i> *\<^sub>C complex_of_real (r' v) *\<^sub>C v)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B. complex_of_real (r v) *\<^sub>C v) + (\<Sum>v\<in>B. (\<i> * complex_of_real (r' v)) *\<^sub>C v) = (\<Sum>v\<in>B. complex_of_real (r v) *\<^sub>C v) + (\<Sum>v\<in>B. \<i> *\<^sub>C complex_of_real (r' v) *\<^sub>C v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B. complex_of_real (r v) *\<^sub>C v) + (\<Sum>v\<in>B. (\<i> * complex_of_real (r' v)) *\<^sub>C v) = (\<Sum>v\<in>B. complex_of_real (r v) *\<^sub>C v) + (\<Sum>v\<in>B. \<i> *\<^sub>C complex_of_real (r' v) *\<^sub>C v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have "\<dots> = (\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>B. \<i> *\<^sub>C (r (\<i> *\<^sub>C v) *\<^sub>R v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>B. complex_of_real (r v) *\<^sub>C v) + (\<Sum>v\<in>B. \<i> *\<^sub>C complex_of_real (r' v) *\<^sub>C v) = (\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>B. \<i> *\<^sub>C r (\<i> *\<^sub>C v) *\<^sub>R v)
[PROOF STEP]
unfolding r'_def r_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>B. complex_of_real (representation B' \<psi> v) *\<^sub>C v) + (\<Sum>v\<in>B. \<i> *\<^sub>C complex_of_real (representation B' \<psi> (\<i> *\<^sub>C v)) *\<^sub>C v) = (\<Sum>v\<in>B. representation B' \<psi> v *\<^sub>R v) + (\<Sum>v\<in>B. \<i> *\<^sub>C representation B' \<psi> (\<i> *\<^sub>C v) *\<^sub>R v)
[PROOF STEP]
by (metis (mono_tags, lifting) scaleR_scaleC sum.cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B. complex_of_real (r v) *\<^sub>C v) + (\<Sum>v\<in>B. \<i> *\<^sub>C complex_of_real (r' v) *\<^sub>C v) = (\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>B. \<i> *\<^sub>C r (\<i> *\<^sub>C v) *\<^sub>R v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B. complex_of_real (r v) *\<^sub>C v) + (\<Sum>v\<in>B. \<i> *\<^sub>C complex_of_real (r' v) *\<^sub>C v) = (\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>B. \<i> *\<^sub>C r (\<i> *\<^sub>C v) *\<^sub>R v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have "\<dots> = (\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>B. r (\<i> *\<^sub>C v) *\<^sub>R (\<i> *\<^sub>C v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>B. \<i> *\<^sub>C r (\<i> *\<^sub>C v) *\<^sub>R v) = (\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>B. r (\<i> *\<^sub>C v) *\<^sub>R \<i> *\<^sub>C v)
[PROOF STEP]
by (metis (no_types, lifting) complex_vector.scale_left_commute scaleR_scaleC)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>B. \<i> *\<^sub>C r (\<i> *\<^sub>C v) *\<^sub>R v) = (\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>B. r (\<i> *\<^sub>C v) *\<^sub>R \<i> *\<^sub>C v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>B. \<i> *\<^sub>C r (\<i> *\<^sub>C v) *\<^sub>R v) = (\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>B. r (\<i> *\<^sub>C v) *\<^sub>R \<i> *\<^sub>C v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have "\<dots> = (\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>(*\<^sub>C) \<i> ` B. r v *\<^sub>R v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>B. r (\<i> *\<^sub>C v) *\<^sub>R \<i> *\<^sub>C v) = (\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>(*\<^sub>C) \<i> ` B. r v *\<^sub>R v)
[PROOF STEP]
using d1
[PROOF STATE]
proof (prove)
using this:
(\<Sum>v\<in>B. r (\<i> *\<^sub>C v) *\<^sub>R \<i> *\<^sub>C v) = (\<Sum>v\<in>(*\<^sub>C) \<i> ` B. r v *\<^sub>R v)

goal (1 subgoal):
 1. (\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>B. r (\<i> *\<^sub>C v) *\<^sub>R \<i> *\<^sub>C v) = (\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>(*\<^sub>C) \<i> ` B. r v *\<^sub>R v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>B. r (\<i> *\<^sub>C v) *\<^sub>R \<i> *\<^sub>C v) = (\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>(*\<^sub>C) \<i> ` B. r v *\<^sub>R v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>B. r (\<i> *\<^sub>C v) *\<^sub>R \<i> *\<^sub>C v) = (\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>(*\<^sub>C) \<i> ` B. r v *\<^sub>R v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have "\<dots> = \<psi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>(*\<^sub>C) \<i> ` B. r v *\<^sub>R v) = \<psi>
[PROOF STEP]
using l2 \<open>(\<Sum>v\<in>B'. r v *\<^sub>R v) = \<psi>\<close>
[PROOF STATE]
proof (prove)
using this:
B \<inter> (*\<^sub>C) \<i> ` B = {}
(\<Sum>v\<in>B'. r v *\<^sub>R v) = \<psi>

goal (1 subgoal):
 1. (\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>(*\<^sub>C) \<i> ` B. r v *\<^sub>R v) = \<psi>
[PROOF STEP]
unfolding B'_def
[PROOF STATE]
proof (prove)
using this:
B \<inter> (*\<^sub>C) \<i> ` B = {}
(\<Sum>v\<in>B \<union> (*\<^sub>C) \<i> ` B. r v *\<^sub>R v) = \<psi>

goal (1 subgoal):
 1. (\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>(*\<^sub>C) \<i> ` B. r v *\<^sub>R v) = \<psi>
[PROOF STEP]
by (simp add: a3 sum.union_disjoint)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B. r v *\<^sub>R v) + (\<Sum>v\<in>(*\<^sub>C) \<i> ` B. r v *\<^sub>R v) = \<psi>

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>v\<in>B. (complex_of_real (r v) + \<i> * complex_of_real (r' v)) *\<^sub>C v) = \<psi>
[PROOF STEP]
have "(\<Sum>v\<in>B. f v *\<^sub>C v) = \<psi>"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>v\<in>B. (complex_of_real (r v) + \<i> * complex_of_real (r' v)) *\<^sub>C v) = \<psi>

goal (1 subgoal):
 1. (\<Sum>v\<in>B. f v *\<^sub>C v) = \<psi>
[PROOF STEP]
unfolding r'_def r_def f_def
[PROOF STATE]
proof (prove)
using this:
(\<Sum>v\<in>B. (complex_of_real (representation B' \<psi> v) + \<i> * complex_of_real (representation B' \<psi> (\<i> *\<^sub>C v))) *\<^sub>C v) = \<psi>

goal (1 subgoal):
 1. (\<Sum>v\<in>B. (complex_of_real (representation B' \<psi> v) + \<i> *\<^sub>C complex_of_real (representation B' \<psi> (\<i> *\<^sub>C v))) *\<^sub>C v) = \<psi>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B. f v *\<^sub>C v) = \<psi>

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
hence "0 = (\<Sum>v\<in>B. f v *\<^sub>C v) - (\<Sum>v\<in>B. crepresentation B \<psi> v *\<^sub>C v)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>v\<in>B. f v *\<^sub>C v) = \<psi>

goal (1 subgoal):
 1. (0::'a) = (\<Sum>v\<in>B. f v *\<^sub>C v) - (\<Sum>v\<in>B. crepresentation B \<psi> v *\<^sub>C v)
[PROOF STEP]
using rep1
[PROOF STATE]
proof (prove)
using this:
(\<Sum>v\<in>B. f v *\<^sub>C v) = \<psi>
(\<Sum>v\<in>B. g v *\<^sub>C v) = \<psi>

goal (1 subgoal):
 1. (0::'a) = (\<Sum>v\<in>B. f v *\<^sub>C v) - (\<Sum>v\<in>B. crepresentation B \<psi> v *\<^sub>C v)
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
using this:
(\<Sum>v\<in>B. f v *\<^sub>C v) = \<psi>
(\<Sum>v\<in>B. crepresentation B \<psi> v *\<^sub>C v) = \<psi>

goal (1 subgoal):
 1. (0::'a) = (\<Sum>v\<in>B. f v *\<^sub>C v) - (\<Sum>v\<in>B. crepresentation B \<psi> v *\<^sub>C v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(0::'a) = (\<Sum>v\<in>B. f v *\<^sub>C v) - (\<Sum>v\<in>B. crepresentation B \<psi> v *\<^sub>C v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(0::'a) = (\<Sum>v\<in>B. f v *\<^sub>C v) - (\<Sum>v\<in>B. crepresentation B \<psi> v *\<^sub>C v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have "\<dots> = (\<Sum>v\<in>B. f v *\<^sub>C v - crepresentation B \<psi> v *\<^sub>C v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>B. f v *\<^sub>C v) - (\<Sum>v\<in>B. crepresentation B \<psi> v *\<^sub>C v) = (\<Sum>v\<in>B. f v *\<^sub>C v - crepresentation B \<psi> v *\<^sub>C v)
[PROOF STEP]
by (simp add: sum_subtractf)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B. f v *\<^sub>C v) - (\<Sum>v\<in>B. crepresentation B \<psi> v *\<^sub>C v) = (\<Sum>v\<in>B. f v *\<^sub>C v - crepresentation B \<psi> v *\<^sub>C v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B. f v *\<^sub>C v) - (\<Sum>v\<in>B. crepresentation B \<psi> v *\<^sub>C v) = (\<Sum>v\<in>B. f v *\<^sub>C v - crepresentation B \<psi> v *\<^sub>C v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have "\<dots> = (\<Sum>v\<in>B. (f v - crepresentation B \<psi> v) *\<^sub>C v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>B. f v *\<^sub>C v - crepresentation B \<psi> v *\<^sub>C v) = (\<Sum>v\<in>B. (f v - crepresentation B \<psi> v) *\<^sub>C v)
[PROOF STEP]
by (metis scaleC_left.diff)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B. f v *\<^sub>C v - crepresentation B \<psi> v *\<^sub>C v) = (\<Sum>v\<in>B. (f v - crepresentation B \<psi> v) *\<^sub>C v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(0::'a) = (\<Sum>v\<in>B. (f v - crepresentation B \<psi> v) *\<^sub>C v)
[PROOF STEP]
have "0 = (\<Sum>v\<in>B. (f v - crepresentation B \<psi> v) *\<^sub>C v)"
[PROOF STATE]
proof (prove)
using this:
(0::'a) = (\<Sum>v\<in>B. (f v - crepresentation B \<psi> v) *\<^sub>C v)

goal (1 subgoal):
 1. (0::'a) = (\<Sum>v\<in>B. (f v - crepresentation B \<psi> v) *\<^sub>C v)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(0::'a) = (\<Sum>v\<in>B. (f v - crepresentation B \<psi> v) *\<^sub>C v)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
hence "(\<Sum>v\<in>B. (f v - crepresentation B \<psi> v) *\<^sub>C v) = 0"
[PROOF STATE]
proof (prove)
using this:
(0::'a) = (\<Sum>v\<in>B. (f v - crepresentation B \<psi> v) *\<^sub>C v)

goal (1 subgoal):
 1. (\<Sum>v\<in>B. (f v - crepresentation B \<psi> v) *\<^sub>C v) = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>B. (f v - crepresentation B \<psi> v) *\<^sub>C v) = (0::'a)

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
hence "f b - crepresentation B \<psi> b = 0"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>v\<in>B. (f v - crepresentation B \<psi> v) *\<^sub>C v) = (0::'a)

goal (1 subgoal):
 1. f b - crepresentation B \<psi> b = 0
[PROOF STEP]
using a1 a2 a3 complex_vector.independentD[where s = B and t = B
        and u = "\<lambda>v. f v - crepresentation B \<psi> v" and v = b]
      order_refl
[PROOF STATE]
proof (prove)
using this:
(\<Sum>v\<in>B. (f v - crepresentation B \<psi> v) *\<^sub>C v) = (0::'a)
cindependent B
b \<in> B
finite B
\<lbrakk>cindependent B; finite B; B \<subseteq> B; (\<Sum>v\<in>B. (f v - crepresentation B \<psi> v) *\<^sub>C v) = (0::'a); b \<in> B\<rbrakk> \<Longrightarrow> f b - crepresentation B \<psi> b = 0
?x \<le> ?x

goal (1 subgoal):
 1. f b - crepresentation B \<psi> b = 0
[PROOF STEP]
by smt
[PROOF STATE]
proof (state)
this:
f b - crepresentation B \<psi> b = 0

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
hence "crepresentation B \<psi> b = f b"
[PROOF STATE]
proof (prove)
using this:
f b - crepresentation B \<psi> b = 0

goal (1 subgoal):
 1. crepresentation B \<psi> b = f b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
crepresentation B \<psi> b = f b

goal (2 subgoals):
 1. \<psi> \<in> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
 2. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
crepresentation B \<psi> b = f b

goal (1 subgoal):
 1. crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
unfolding f_def r_def r'_def B'_def
[PROOF STATE]
proof (prove)
using this:
crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))

goal (1 subgoal):
 1. crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))

goal (1 subgoal):
 1. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
define B' where "B' = B \<union> (*\<^sub>C) \<i> ` B"
[PROOF STATE]
proof (state)
this:
B' = B \<union> (*\<^sub>C) \<i> ` B

goal (1 subgoal):
 1. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<psi> \<notin> cspan B

goal (1 subgoal):
 1. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have b2: "\<psi> \<notin> real_vector.span B'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<psi> \<notin> span B'
[PROOF STEP]
unfolding B'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<psi> \<notin> span (B \<union> (*\<^sub>C) \<i> ` B)
[PROOF STEP]
using False cspan_as_span
[PROOF STATE]
proof (prove)
using this:
\<psi> \<notin> cspan B
cspan ?B = span (?B \<union> (*\<^sub>C) \<i> ` ?B)

goal (1 subgoal):
 1. \<psi> \<notin> span (B \<union> (*\<^sub>C) \<i> ` B)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<psi> \<notin> span B'

goal (1 subgoal):
 1. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have "\<psi> \<notin> complex_vector.span B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<psi> \<notin> cspan B
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<psi> \<notin> cspan B

goal (1 subgoal):
 1. \<psi> \<notin> cspan B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<psi> \<notin> cspan B

goal (1 subgoal):
 1. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have "crepresentation B \<psi> b = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. crepresentation B \<psi> b = 0
[PROOF STEP]
unfolding complex_vector.representation_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if cindependent B \<and> \<psi> \<in> cspan B then SOME f. (\<forall>v. f v \<noteq> 0 \<longrightarrow> v \<in> B) \<and> finite {v. f v \<noteq> 0} \<and> (\<Sum>v | f v \<noteq> 0. f v *\<^sub>C v) = \<psi> else (\<lambda>b. 0)) b = 0
[PROOF STEP]
by (simp add: False)
[PROOF STATE]
proof (state)
this:
crepresentation B \<psi> b = 0

goal (1 subgoal):
 1. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
crepresentation B \<psi> b = 0

goal (1 subgoal):
 1. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have "real_vector.representation B' \<psi> b = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. representation B' \<psi> b = 0
[PROOF STEP]
unfolding real_vector.representation_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if independent B' \<and> \<psi> \<in> span B' then SOME f. (\<forall>v. f v \<noteq> 0 \<longrightarrow> v \<in> B') \<and> finite {v. f v \<noteq> 0} \<and> (\<Sum>v | f v \<noteq> 0. f v *\<^sub>R v) = \<psi> else (\<lambda>b. 0)) b = 0
[PROOF STEP]
by (simp add: b2)
[PROOF STATE]
proof (state)
this:
representation B' \<psi> b = 0

goal (1 subgoal):
 1. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
representation B' \<psi> b = 0

goal (1 subgoal):
 1. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
have "real_vector.representation B' \<psi> ((*\<^sub>C) \<i> b) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. representation B' \<psi> (\<i> *\<^sub>C b) = 0
[PROOF STEP]
unfolding real_vector.representation_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if independent B' \<and> \<psi> \<in> span B' then SOME f. (\<forall>v. f v \<noteq> 0 \<longrightarrow> v \<in> B') \<and> finite {v. f v \<noteq> 0} \<and> (\<Sum>v | f v \<noteq> 0. f v *\<^sub>R v) = \<psi> else (\<lambda>b. 0)) (\<i> *\<^sub>C b) = 0
[PROOF STEP]
by (simp add: b2)
[PROOF STATE]
proof (state)
this:
representation B' \<psi> (\<i> *\<^sub>C b) = 0

goal (1 subgoal):
 1. \<psi> \<notin> cspan B \<Longrightarrow> crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
crepresentation B \<psi> b = 0
representation B' \<psi> b = 0
representation B' \<psi> (\<i> *\<^sub>C b) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
crepresentation B \<psi> b = 0
representation B' \<psi> b = 0
representation B' \<psi> (\<i> *\<^sub>C b) = 0

goal (1 subgoal):
 1. crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
unfolding B'_def
[PROOF STATE]
proof (prove)
using this:
crepresentation B \<psi> b = 0
representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b = 0
representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b) = 0

goal (1 subgoal):
 1. crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
crepresentation B \<psi> b = complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> b) + \<i> *\<^sub>C complex_of_real (representation (B \<union> (*\<^sub>C) \<i> ` B) \<psi> (\<i> *\<^sub>C b))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem instant_computation_termination:
  \<open>wfP (\<lambda>(\<S>\<^sub>1::'a::linordered_field config) \<S>\<^sub>2. (\<S>\<^sub>1  \<hookrightarrow>\<^sub>e\<^sup>\<leftarrow>  \<S>\<^sub>2))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wfP operational_semantics_elim_inv
[PROOF STEP]
proof (simp add: wfP_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. wf {(x, y). x \<hookrightarrow>\<^sub>e\<^sup>\<leftarrow> y}
[PROOF STEP]
show \<open>wf {((\<S>\<^sub>1::'a::linordered_field config), \<S>\<^sub>2). \<S>\<^sub>1 \<hookrightarrow>\<^sub>e\<^sup>\<leftarrow> \<S>\<^sub>2}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf {(\<S>\<^sub>1, \<S>\<^sub>2). \<S>\<^sub>1 \<hookrightarrow>\<^sub>e\<^sup>\<leftarrow> \<S>\<^sub>2}
[PROOF STEP]
proof (rule wf_subset)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. wf ?r
 2. {(\<S>\<^sub>1, \<S>\<^sub>2). \<S>\<^sub>1 \<hookrightarrow>\<^sub>e\<^sup>\<leftarrow> \<S>\<^sub>2} \<subseteq> ?r
[PROOF STEP]
have \<open>measure \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g = {(\<S>\<^sub>2, (\<S>\<^sub>1::'a::linordered_field config)).
                               \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g \<S>\<^sub>2 < \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g \<S>\<^sub>1}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g = {(\<S>\<^sub>2, \<S>\<^sub>1). \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g \<S>\<^sub>2 < \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g \<S>\<^sub>1}
[PROOF STEP]
by (simp add: inv_image_def less_eq measure_def)
[PROOF STATE]
proof (state)
this:
measure \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g = {(\<S>\<^sub>2, \<S>\<^sub>1). \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g \<S>\<^sub>2 < \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g \<S>\<^sub>1}

goal (2 subgoals):
 1. wf ?r
 2. {(\<S>\<^sub>1, \<S>\<^sub>2). \<S>\<^sub>1 \<hookrightarrow>\<^sub>e\<^sup>\<leftarrow> \<S>\<^sub>2} \<subseteq> ?r
[PROOF STEP]
thus \<open>{((\<S>\<^sub>1::'a::linordered_field config), \<S>\<^sub>2). \<S>\<^sub>1 \<hookrightarrow>\<^sub>e\<^sup>\<leftarrow> \<S>\<^sub>2} \<subseteq> (measure \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g)\<close>
[PROOF STATE]
proof (prove)
using this:
measure \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g = {(\<S>\<^sub>2, \<S>\<^sub>1). \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g \<S>\<^sub>2 < \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g \<S>\<^sub>1}

goal (1 subgoal):
 1. {(\<S>\<^sub>1, \<S>\<^sub>2). \<S>\<^sub>1 \<hookrightarrow>\<^sub>e\<^sup>\<leftarrow> \<S>\<^sub>2} \<subseteq> measure \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g
[PROOF STEP]
using elimation_rules_strictly_decreasing_meas'
            operational_semantics_elim_inv_def
[PROOF STATE]
proof (prove)
using this:
measure \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g = {(\<S>\<^sub>2, \<S>\<^sub>1). \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g \<S>\<^sub>2 < \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g \<S>\<^sub>1}
?\<S>\<^sub>1 \<hookrightarrow>\<^sub>e ?\<S>\<^sub>2 \<Longrightarrow> (?\<S>\<^sub>2, ?\<S>\<^sub>1) \<in> measure \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g
?\<C>\<^sub>1 \<hookrightarrow>\<^sub>e\<^sup>\<leftarrow> ?\<C>\<^sub>2 \<equiv> ?\<C>\<^sub>2 \<hookrightarrow>\<^sub>e ?\<C>\<^sub>1

goal (1 subgoal):
 1. {(\<S>\<^sub>1, \<S>\<^sub>2). \<S>\<^sub>1 \<hookrightarrow>\<^sub>e\<^sup>\<leftarrow> \<S>\<^sub>2} \<subseteq> measure \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{(\<S>\<^sub>1, \<S>\<^sub>2). \<S>\<^sub>1 \<hookrightarrow>\<^sub>e\<^sup>\<leftarrow> \<S>\<^sub>2} \<subseteq> measure \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g

goal (1 subgoal):
 1. wf (measure \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. wf (measure \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g)
[PROOF STEP]
show \<open>wf (measure measure_interpretation_config)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf (measure \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
wf (measure \<mu>\<^sub>c\<^sub>o\<^sub>n\<^sub>f\<^sub>i\<^sub>g)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
wf {(\<S>\<^sub>1, \<S>\<^sub>2). \<S>\<^sub>1 \<hookrightarrow>\<^sub>e\<^sup>\<leftarrow> \<S>\<^sub>2}

goal:
No subgoals!
[PROOF STEP]
qed