[STATEMENT]
lemma has_integral_combine_division_topdown:
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
  assumes f: "f integrable_on S"
    and \<D>: "\<D> division_of K"
    and "K \<subseteq> S"
  shows "(f has_integral (sum (\<lambda>i. integral i f) \<D>)) K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_integral (\<Sum>i\<in>\<D>. integral i f)) K
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f has_integral (\<Sum>i\<in>\<D>. integral i f)) K
[PROOF STEP]
have "f integrable_on L" if "L \<in> \<D>" for L
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f integrable_on L
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f integrable_on L
[PROOF STEP]
have "L \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L \<subseteq> S
[PROOF STEP]
using \<open>K \<subseteq> S\<close> \<D> that
[PROOF STATE]
proof (prove)
using this:
K \<subseteq> S
\<D> division_of K
L \<in> \<D>

goal (1 subgoal):
 1. L \<subseteq> S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
L \<subseteq> S

goal (1 subgoal):
 1. f integrable_on L
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
L \<subseteq> S
[PROOF STEP]
show "f integrable_on L"
[PROOF STATE]
proof (prove)
using this:
L \<subseteq> S

goal (1 subgoal):
 1. f integrable_on L
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
L \<subseteq> S
L \<in> \<D>

goal (1 subgoal):
 1. f integrable_on L
[PROOF STEP]
by (metis (no_types) f \<D> division_ofD(4) integrable_on_subcbox)
[PROOF STATE]
proof (state)
this:
f integrable_on L

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?L \<in> \<D> \<Longrightarrow> f integrable_on ?L

goal (1 subgoal):
 1. (f has_integral (\<Sum>i\<in>\<D>. integral i f)) K
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?L \<in> \<D> \<Longrightarrow> f integrable_on ?L
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?L \<in> \<D> \<Longrightarrow> f integrable_on ?L

goal (1 subgoal):
 1. (f has_integral (\<Sum>i\<in>\<D>. integral i f)) K
[PROOF STEP]
by (meson \<D> has_integral_combine_division has_integral_integrable_integral)
[PROOF STATE]
proof (state)
this:
(f has_integral (\<Sum>i\<in>\<D>. integral i f)) K

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma order_0_multiple_of_one:
assumes "order A = 0"
obtains a where "A = a \<cdot> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. A = a \<cdot> 1 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>a. A = a \<cdot> 1 \<Longrightarrow> thesis) \<Longrightarrow> A = ?a2 \<cdot> 1
[PROOF STEP]
assume "(\<And>a. A = a \<cdot> 1 \<Longrightarrow> thesis)"
[PROOF STATE]
proof (state)
this:
A = ?a \<cdot> 1 \<Longrightarrow> thesis

goal (1 subgoal):
 1. (\<And>a. A = a \<cdot> 1 \<Longrightarrow> thesis) \<Longrightarrow> A = ?a2 \<cdot> 1
[PROOF STEP]
have "length (vec A) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (vec A) = 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
order A = 0

goal (1 subgoal):
 1. length (vec A) = 1
[PROOF STEP]
by (simp add:length_vec)
[PROOF STATE]
proof (state)
this:
length (vec A) = 1

goal (1 subgoal):
 1. (\<And>a. A = a \<cdot> 1 \<Longrightarrow> thesis) \<Longrightarrow> A = ?a2 \<cdot> 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (vec A) = 1
[PROOF STEP]
obtain a where "vec A = [a]"
[PROOF STATE]
proof (prove)
using this:
length (vec A) = 1

goal (1 subgoal):
 1. (\<And>a. vec A = [a] \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis One_nat_def Suc_length_conv length_0_conv)
[PROOF STATE]
proof (state)
this:
vec A = [a]

goal (1 subgoal):
 1. (\<And>a. A = a \<cdot> 1 \<Longrightarrow> thesis) \<Longrightarrow> A = ?a2 \<cdot> 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
vec A = [a]

goal (1 subgoal):
 1. (\<And>a. A = a \<cdot> 1 \<Longrightarrow> thesis) \<Longrightarrow> A = ?a2 \<cdot> 1
[PROOF STEP]
have "vec (a \<cdot> 1) = [a]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec (a \<cdot> 1) = [a]
[PROOF STEP]
unfolding smult_def tensor_one_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec (tensor_from_vec (dims (tensor_from_vec [] [1::'a])) (vec_smult a (vec (tensor_from_vec [] [1::'a])))) = [a]
[PROOF STEP]
by (simp add: vec_smult_def)
[PROOF STATE]
proof (state)
this:
vec (a \<cdot> 1) = [a]

goal (1 subgoal):
 1. (\<And>a. A = a \<cdot> 1 \<Longrightarrow> thesis) \<Longrightarrow> A = ?a2 \<cdot> 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
vec A = [a]
vec (a \<cdot> 1) = [a]
[PROOF STEP]
have "A = a \<cdot> 1"
[PROOF STATE]
proof (prove)
using this:
vec A = [a]
vec (a \<cdot> 1) = [a]

goal (1 subgoal):
 1. A = a \<cdot> 1
[PROOF STEP]
using tensor_eqI
[PROOF STATE]
proof (prove)
using this:
vec A = [a]
vec (a \<cdot> 1) = [a]
\<lbrakk>dims ?A = dims ?B; vec ?A = vec ?B\<rbrakk> \<Longrightarrow> ?A = ?B

goal (1 subgoal):
 1. A = a \<cdot> 1
[PROOF STEP]
by (metis assms dims_smult length_0_conv order_tensor_one)
[PROOF STATE]
proof (state)
this:
A = a \<cdot> 1

goal (1 subgoal):
 1. (\<And>a. A = a \<cdot> 1 \<Longrightarrow> thesis) \<Longrightarrow> A = ?a2 \<cdot> 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A = a \<cdot> 1
[PROOF STEP]
show "A = hd (vec A) \<cdot> 1"
[PROOF STATE]
proof (prove)
using this:
A = a \<cdot> 1

goal (1 subgoal):
 1. A = hd (vec A) \<cdot> 1
[PROOF STEP]
using \<open>vec A = [a]\<close>
[PROOF STATE]
proof (prove)
using this:
A = a \<cdot> 1
vec A = [a]

goal (1 subgoal):
 1. A = hd (vec A) \<cdot> 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A = hd (vec A) \<cdot> 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma same_length_is_parallel:
  assumes len: "\<forall>y \<in> set as. length y = x"
  shows  "\<forall>x \<in> set as. \<forall>y \<in> set as - {x}. x \<parallel> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set as. \<forall>y\<in>set as - {x}. x \<parallel> y
[PROOF STEP]
proof (rule, rule)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set as; y \<in> set as - {x}\<rbrakk> \<Longrightarrow> x \<parallel> y
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set as; y \<in> set as - {x}\<rbrakk> \<Longrightarrow> x \<parallel> y
[PROOF STEP]
assume xi: "x \<in> set as" and yi: "y \<in> set as - {x}"
[PROOF STATE]
proof (state)
this:
x \<in> set as
y \<in> set as - {x}

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set as; y \<in> set as - {x}\<rbrakk> \<Longrightarrow> x \<parallel> y
[PROOF STEP]
from len
[PROOF STATE]
proof (chain)
picking this:
\<forall>y\<in>set as. length y = x
[PROOF STEP]
obtain q where len': "\<forall>y \<in> set as. length y = q"
[PROOF STATE]
proof (prove)
using this:
\<forall>y\<in>set as. length y = x

goal (1 subgoal):
 1. (\<And>q. \<forall>y\<in>set as. length y = q \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<forall>y\<in>set as. length y = q

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> set as; y \<in> set as - {x}\<rbrakk> \<Longrightarrow> x \<parallel> y
[PROOF STEP]
show "x \<parallel> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<parallel> y
[PROOF STEP]
proof (rule not_equal_is_parallel)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<noteq> y
 2. length x = length y
[PROOF STEP]
from xi yi
[PROOF STATE]
proof (chain)
picking this:
x \<in> set as
y \<in> set as - {x}
[PROOF STEP]
show "x \<noteq> y"
[PROOF STATE]
proof (prove)
using this:
x \<in> set as
y \<in> set as - {x}

goal (1 subgoal):
 1. x \<noteq> y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<noteq> y

goal (1 subgoal):
 1. length x = length y
[PROOF STEP]
from xi yi len'
[PROOF STATE]
proof (chain)
picking this:
x \<in> set as
y \<in> set as - {x}
\<forall>y\<in>set as. length y = q
[PROOF STEP]
show "length x = length y"
[PROOF STATE]
proof (prove)
using this:
x \<in> set as
y \<in> set as - {x}
\<forall>y\<in>set as. length y = q

goal (1 subgoal):
 1. length x = length y
[PROOF STEP]
by (auto dest: bspec)
[PROOF STATE]
proof (state)
this:
length x = length y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x \<parallel> y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma open_existence_ivl':
  assumes x : "x \<in> X"
  obtains a where "a > 0"  "{-a..a} \<subseteq> existence_ivl0 x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. \<lbrakk>0 < a; {- a..a} \<subseteq> existence_ivl0 x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>a. \<lbrakk>0 < a; {- a..a} \<subseteq> existence_ivl0 x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from open_existence_ivl0[OF assms(1)]
[PROOF STATE]
proof (chain)
picking this:
\<exists>a b. a < 0 \<and> 0 < b \<and> {a..b} \<subseteq> existence_ivl0 x
[PROOF STEP]
obtain a b where ab: "a < 0" "0 < b" "{a..b} \<subseteq> existence_ivl0 x"
[PROOF STATE]
proof (prove)
using this:
\<exists>a b. a < 0 \<and> 0 < b \<and> {a..b} \<subseteq> existence_ivl0 x

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>a < 0; 0 < b; {a..b} \<subseteq> existence_ivl0 x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a < 0
0 < b
{a..b} \<subseteq> existence_ivl0 x

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>0 < a; {- a..a} \<subseteq> existence_ivl0 x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a < 0
0 < b
{a..b} \<subseteq> existence_ivl0 x
[PROOF STEP]
have "min (-a) b > 0"
[PROOF STATE]
proof (prove)
using this:
a < 0
0 < b
{a..b} \<subseteq> existence_ivl0 x

goal (1 subgoal):
 1. 0 < min (- a) b
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
0 < min (- a) b

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>0 < a; {- a..a} \<subseteq> existence_ivl0 x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "{-min (-a) b .. min(-a) b} \<subseteq> {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {- min (- a) b..min (- a) b} \<subseteq> {a..b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{- min (- a) b..min (- a) b} \<subseteq> {a..b}

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>0 < a; {- a..a} \<subseteq> existence_ivl0 x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
{- min (- a) b..min (- a) b} \<subseteq> {a..b}

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using ab(3) that[OF \<open>min (-a) b > 0\<close>]
[PROOF STATE]
proof (prove)
using this:
{- min (- a) b..min (- a) b} \<subseteq> {a..b}
{a..b} \<subseteq> existence_ivl0 x
{- min (- a) b..min (- a) b} \<subseteq> existence_ivl0 x \<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 vdisjnt_vinsert_right: "vdisjnt Y (vinsert a X) \<longleftrightarrow> a \<notin>\<^sub>\<circ> Y \<and> vdisjnt Y X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vdisjnt Y (vinsert a X) = (a \<notin>\<^sub>\<circ> Y \<and> vdisjnt Y X)
[PROOF STEP]
using vdisjnt_sym vdisjnt_vinsert_left
[PROOF STATE]
proof (prove)
using this:
vdisjnt ?A ?B \<Longrightarrow> vdisjnt ?B ?A
vdisjnt (vinsert ?a ?X) ?Y = (?a \<notin>\<^sub>\<circ> ?Y \<and> vdisjnt ?X ?Y)

goal (1 subgoal):
 1. vdisjnt Y (vinsert a X) = (a \<notin>\<^sub>\<circ> Y \<and> vdisjnt Y X)
[PROOF STEP]
by meson


[STATEMENT]
lemma C14_dual:
  fixes x::"'a::C_algebra"
  shows "x\<^sup>\<star> = x\<^bsub>0\<^esub>\<^bsup>n\<^esup> \<cdot> (x\<^bsup>n+1\<^esup>)\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>\<star> = x\<^bsub>0\<^esub>\<^bsup>n\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x\<^sup>\<star> = x\<^bsub>0\<^esub>\<^bsup>n\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>
[PROOF STEP]
have "x\<^sup>\<star> =  (x\<^bsup>n+1\<^esup>)\<^sup>\<star> \<cdot> x\<^bsub>0\<^esub>\<^bsup>n\<^esup>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>\<star> = (x\<^bsup>n + 1\<^esup>)\<^sup>\<star> \<cdot> x\<^bsub>0\<^esub>\<^bsup>n\<^esup>
[PROOF STEP]
by (rule C14)
[PROOF STATE]
proof (state)
this:
x\<^sup>\<star> = (x\<^bsup>n + 1\<^esup>)\<^sup>\<star> \<cdot> x\<^bsub>0\<^esub>\<^bsup>n\<^esup>

goal (1 subgoal):
 1. x\<^sup>\<star> = x\<^bsub>0\<^esub>\<^bsup>n\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x\<^sup>\<star> = (x\<^bsup>n + 1\<^esup>)\<^sup>\<star> \<cdot> x\<^bsub>0\<^esub>\<^bsup>n\<^esup>

goal (1 subgoal):
 1. x\<^sup>\<star> = x\<^bsub>0\<^esub>\<^bsup>n\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>
[PROOF STEP]
have "... = (x\<^bsup>n+1\<^esup>)\<^sup>\<star> \<cdot> (\<Sum>i=0..n. x^i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x\<^bsup>n + 1\<^esup>)\<^sup>\<star> \<cdot> x\<^bsub>0\<^esub>\<^bsup>n\<^esup> = (x\<^bsup>n + 1\<^esup>)\<^sup>\<star> \<cdot> sum ((^) x) {0..n}
[PROOF STEP]
by (subst powsum_def, auto)
[PROOF STATE]
proof (state)
this:
(x\<^bsup>n + 1\<^esup>)\<^sup>\<star> \<cdot> x\<^bsub>0\<^esub>\<^bsup>n\<^esup> = (x\<^bsup>n + 1\<^esup>)\<^sup>\<star> \<cdot> sum ((^) x) {0..n}

goal (1 subgoal):
 1. x\<^sup>\<star> = x\<^bsub>0\<^esub>\<^bsup>n\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x\<^bsup>n + 1\<^esup>)\<^sup>\<star> \<cdot> x\<^bsub>0\<^esub>\<^bsup>n\<^esup> = (x\<^bsup>n + 1\<^esup>)\<^sup>\<star> \<cdot> sum ((^) x) {0..n}

goal (1 subgoal):
 1. x\<^sup>\<star> = x\<^bsub>0\<^esub>\<^bsup>n\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>
[PROOF STEP]
have "... = (\<Sum>i=0..n. (x\<^bsup>n+1\<^esup>)\<^sup>\<star> \<cdot> x^i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x\<^bsup>n + 1\<^esup>)\<^sup>\<star> \<cdot> sum ((^) x) {0..n} = (\<Sum>i = 0..n. (x\<^bsup>n + 1\<^esup>)\<^sup>\<star> \<cdot> x\<^bsup>i\<^esup>)
[PROOF STEP]
by (metis le0 sum_interval_distl)
[PROOF STATE]
proof (state)
this:
(x\<^bsup>n + 1\<^esup>)\<^sup>\<star> \<cdot> sum ((^) x) {0..n} = (\<Sum>i = 0..n. (x\<^bsup>n + 1\<^esup>)\<^sup>\<star> \<cdot> x\<^bsup>i\<^esup>)

goal (1 subgoal):
 1. x\<^sup>\<star> = x\<^bsub>0\<^esub>\<^bsup>n\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x\<^bsup>n + 1\<^esup>)\<^sup>\<star> \<cdot> sum ((^) x) {0..n} = (\<Sum>i = 0..n. (x\<^bsup>n + 1\<^esup>)\<^sup>\<star> \<cdot> x\<^bsup>i\<^esup>)

goal (1 subgoal):
 1. x\<^sup>\<star> = x\<^bsub>0\<^esub>\<^bsup>n\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>
[PROOF STEP]
have "... = (\<Sum>i=0..n. x^i \<cdot> (x\<^bsup>n+1\<^esup>)\<^sup>\<star>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..n. (x\<^bsup>n + 1\<^esup>)\<^sup>\<star> \<cdot> x\<^bsup>i\<^esup>) = (\<Sum>i = 0..n. x\<^bsup>i\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>)
[PROOF STEP]
by (auto intro: sum_interval_cong simp only:C14_aux)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. (x\<^bsup>n + 1\<^esup>)\<^sup>\<star> \<cdot> x\<^bsup>i\<^esup>) = (\<Sum>i = 0..n. x\<^bsup>i\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>)

goal (1 subgoal):
 1. x\<^sup>\<star> = x\<^bsub>0\<^esub>\<^bsup>n\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. (x\<^bsup>n + 1\<^esup>)\<^sup>\<star> \<cdot> x\<^bsup>i\<^esup>) = (\<Sum>i = 0..n. x\<^bsup>i\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>)

goal (1 subgoal):
 1. x\<^sup>\<star> = x\<^bsub>0\<^esub>\<^bsup>n\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>
[PROOF STEP]
have "... = x\<^bsub>0\<^esub>\<^bsup>n\<^esup> \<cdot> (x\<^bsup>n+1\<^esup>)\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..n. x\<^bsup>i\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>) = x\<^bsub>0\<^esub>\<^bsup>n\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>
[PROOF STEP]
by (simp only: sum_interval_distr[THEN sym] powsum_def Nat.add_0_right)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..n. x\<^bsup>i\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>) = x\<^bsub>0\<^esub>\<^bsup>n\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>

goal (1 subgoal):
 1. x\<^sup>\<star> = x\<^bsub>0\<^esub>\<^bsup>n\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x\<^sup>\<star> = x\<^bsub>0\<^esub>\<^bsup>n\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x\<^sup>\<star> = x\<^bsub>0\<^esub>\<^bsup>n\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>

goal (1 subgoal):
 1. x\<^sup>\<star> = x\<^bsub>0\<^esub>\<^bsup>n\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x\<^sup>\<star> = x\<^bsub>0\<^esub>\<^bsup>n\<^esup> \<cdot> (x\<^bsup>n + 1\<^esup>)\<^sup>\<star>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma glb_common:
fixes s1 s2 s rs1 rs2
assumes "s1 = s \<star> rs1" and "s2 = s \<star> rs2"
shows "\<exists> rs . s1 \<sqinter> s2 = s \<star> rs \<and> set rs \<subseteq> set rs1 \<union> set rs2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>rs. s1 \<sqinter> s2 = s \<star> rs \<and> set rs \<subseteq> set rs1 \<union> set rs2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>rs. s1 \<sqinter> s2 = s \<star> rs \<and> set rs \<subseteq> set rs1 \<union> set rs2
[PROOF STEP]
have 1:"s \<preceq> s1" and 2:"s \<preceq> s2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s \<preceq> s1 &&& s \<preceq> s2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
s1 = s \<star> rs1
s2 = s \<star> rs2

goal (1 subgoal):
 1. s \<preceq> s1 &&& s \<preceq> s2
[PROOF STEP]
by (auto simp add:less_eq_def)
[PROOF STATE]
proof (state)
this:
s \<preceq> s1
s \<preceq> s2

goal (1 subgoal):
 1. \<exists>rs. s1 \<sqinter> s2 = s \<star> rs \<and> set rs \<subseteq> set rs1 \<union> set rs2
[PROOF STEP]
hence 3:"s \<preceq> s1 \<sqinter> s2"
[PROOF STATE]
proof (prove)
using this:
s \<preceq> s1
s \<preceq> s2

goal (1 subgoal):
 1. s \<preceq> s1 \<sqinter> s2
[PROOF STEP]
by (metis inf_glb is_lb_def pre_RDR.is_glb_def)
[PROOF STATE]
proof (state)
this:
s \<preceq> s1 \<sqinter> s2

goal (1 subgoal):
 1. \<exists>rs. s1 \<sqinter> s2 = s \<star> rs \<and> set rs \<subseteq> set rs1 \<union> set rs2
[PROOF STEP]
have 4:"s1 \<sqinter> s2 \<preceq> s1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s1 \<sqinter> s2 \<preceq> s1
[PROOF STEP]
by (metis cobounded1)
[PROOF STATE]
proof (state)
this:
s1 \<sqinter> s2 \<preceq> s1

goal (1 subgoal):
 1. \<exists>rs. s1 \<sqinter> s2 = s \<star> rs \<and> set rs \<subseteq> set rs1 \<union> set rs2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>rs. s1 \<sqinter> s2 = s \<star> rs \<and> set rs \<subseteq> set rs1 \<union> set rs2
[PROOF STEP]
using 3 4 assms(1) and consistency
[PROOF STATE]
proof (prove)
using this:
s \<preceq> s1 \<sqinter> s2
s1 \<sqinter> s2 \<preceq> s1
s1 = s \<star> rs1
\<lbrakk>?s1.0 \<preceq> ?s2.0; ?s2.0 \<preceq> ?s3.0; ?s3.0 = ?s1.0 \<star> ?rs\<rbrakk> \<Longrightarrow> \<exists>rs' rs''. ?s2.0 = ?s1.0 \<star> rs' \<and> ?s3.0 = ?s2.0 \<star> rs'' \<and> set rs' \<subseteq> set ?rs \<and> set rs'' \<subseteq> set ?rs

goal (1 subgoal):
 1. \<exists>rs. s1 \<sqinter> s2 = s \<star> rs \<and> set rs \<subseteq> set rs1 \<union> set rs2
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>rs. s1 \<sqinter> s2 = s \<star> rs \<and> set rs \<subseteq> set rs1 \<union> set rs2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma algebraic_inverse_iff [simp]: "algebraic (inverse y) \<longleftrightarrow> algebraic y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. algebraic (inverse y) = algebraic y
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. algebraic (inverse y) \<Longrightarrow> algebraic y
 2. algebraic y \<Longrightarrow> algebraic (inverse y)
[PROOF STEP]
assume "algebraic (inverse y)"
[PROOF STATE]
proof (state)
this:
algebraic (inverse y)

goal (2 subgoals):
 1. algebraic (inverse y) \<Longrightarrow> algebraic y
 2. algebraic y \<Longrightarrow> algebraic (inverse y)
[PROOF STEP]
hence "algebraic (inverse (inverse y))"
[PROOF STATE]
proof (prove)
using this:
algebraic (inverse y)

goal (1 subgoal):
 1. algebraic (inverse (inverse y))
[PROOF STEP]
by (rule algebraic_inverse)
[PROOF STATE]
proof (state)
this:
algebraic (inverse (inverse y))

goal (2 subgoals):
 1. algebraic (inverse y) \<Longrightarrow> algebraic y
 2. algebraic y \<Longrightarrow> algebraic (inverse y)
[PROOF STEP]
thus "algebraic y"
[PROOF STATE]
proof (prove)
using this:
algebraic (inverse (inverse y))

goal (1 subgoal):
 1. algebraic y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
algebraic y

goal (1 subgoal):
 1. algebraic y \<Longrightarrow> algebraic (inverse y)
[PROOF STEP]
qed (auto intro: algebraic_inverse)


[STATEMENT]
lemma cartesian_product_margin2:
assumes "b\<in>B"
shows "{p\<in>A\<times>B. snd p = b} = A\<times>{b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {p \<in> A \<times> B. snd p = b} = A \<times> {b}
[PROOF STEP]
using SigmaI assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> ?A; ?b \<in> ?B ?a\<rbrakk> \<Longrightarrow> (?a, ?b) \<in> Sigma ?A ?B
b \<in> B

goal (1 subgoal):
 1. {p \<in> A \<times> B. snd p = b} = A \<times> {b}
[PROOF STEP]
by auto


[STATEMENT]
lemma lt_mult_scalar:
  assumes "p \<noteq> 0" and "q \<noteq> (0::'t \<Rightarrow>\<^sub>0 'b::semiring_no_zero_divisors)"
  shows "lt (p \<odot> q) = punit.lt p \<oplus> lt q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lt (p \<odot> q) = punit.lt p \<oplus> lt q
[PROOF STEP]
proof (rule lt_eqI_keys, simp only: in_keys_iff lookup_mult_scalar_lt_lt)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. punit.lc p * lc q \<noteq> (0::'b)
 2. \<And>u. u \<in> keys (p \<odot> q) \<Longrightarrow> u \<preceq>\<^sub>t punit.lt p \<oplus> lt q
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 0
[PROOF STEP]
have "punit.lc p \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. punit.lc p \<noteq> (0::'b)
[PROOF STEP]
by (rule punit.lc_not_0)
[PROOF STATE]
proof (state)
this:
punit.lc p \<noteq> (0::'b)

goal (2 subgoals):
 1. punit.lc p * lc q \<noteq> (0::'b)
 2. \<And>u. u \<in> keys (p \<odot> q) \<Longrightarrow> u \<preceq>\<^sub>t punit.lt p \<oplus> lt q
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
punit.lc p \<noteq> (0::'b)

goal (2 subgoals):
 1. punit.lc p * lc q \<noteq> (0::'b)
 2. \<And>u. u \<in> keys (p \<odot> q) \<Longrightarrow> u \<preceq>\<^sub>t punit.lt p \<oplus> lt q
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
q \<noteq> 0
[PROOF STEP]
have "lc q \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
q \<noteq> 0

goal (1 subgoal):
 1. lc q \<noteq> (0::'b)
[PROOF STEP]
by (rule lc_not_0)
[PROOF STATE]
proof (state)
this:
lc q \<noteq> (0::'b)

goal (2 subgoals):
 1. punit.lc p * lc q \<noteq> (0::'b)
 2. \<And>u. u \<in> keys (p \<odot> q) \<Longrightarrow> u \<preceq>\<^sub>t punit.lt p \<oplus> lt q
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
punit.lc p \<noteq> (0::'b)
lc q \<noteq> (0::'b)
[PROOF STEP]
show "punit.lc p * lc q \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
punit.lc p \<noteq> (0::'b)
lc q \<noteq> (0::'b)

goal (1 subgoal):
 1. punit.lc p * lc q \<noteq> (0::'b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
punit.lc p * lc q \<noteq> (0::'b)

goal (1 subgoal):
 1. \<And>u. u \<in> keys (p \<odot> q) \<Longrightarrow> u \<preceq>\<^sub>t punit.lt p \<oplus> lt q
[PROOF STEP]
qed (rule in_keys_mult_scalar_le)


[STATEMENT]
lemma Union_regular_division:
  assumes "a \<le> b"
  shows "\<Union>(regular_division a b n) = (if n=0 then {} else {a..b})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (regular_division a b n) = (if n = 0 then {} else {a..b})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<le> b

goal (1 subgoal):
 1. \<Union> (regular_division a b n) = (if n = 0 then {} else {a..b})
[PROOF STEP]
by (auto simp: regular_division_def Union_segments translate_scale_01 simp flip: image_Union)


[STATEMENT]
lemma permutations_of_multiset_image:
  "permutations_of_multiset (image_mset f A) = map f ` permutations_of_multiset A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutations_of_multiset (image_mset f A) = map f ` permutations_of_multiset A
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> permutations_of_multiset (image_mset f A) \<Longrightarrow> x \<in> map f ` permutations_of_multiset A
 2. \<And>x xa. xa \<in> permutations_of_multiset A \<Longrightarrow> map f xa \<in> permutations_of_multiset (image_mset f A)
[PROOF STEP]
fix xs
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> permutations_of_multiset (image_mset f A) \<Longrightarrow> x \<in> map f ` permutations_of_multiset A
 2. \<And>x xa. xa \<in> permutations_of_multiset A \<Longrightarrow> map f xa \<in> permutations_of_multiset (image_mset f A)
[PROOF STEP]
assume A: "xs \<in> permutations_of_multiset (image_mset f A)"
[PROOF STATE]
proof (state)
this:
xs \<in> permutations_of_multiset (image_mset f A)

goal (2 subgoals):
 1. \<And>x. x \<in> permutations_of_multiset (image_mset f A) \<Longrightarrow> x \<in> map f ` permutations_of_multiset A
 2. \<And>x xa. xa \<in> permutations_of_multiset A \<Longrightarrow> map f xa \<in> permutations_of_multiset (image_mset f A)
[PROOF STEP]
from ex_mset[of A]
[PROOF STATE]
proof (chain)
picking this:
\<exists>xs. mset xs = A
[PROOF STEP]
obtain ys where ys: "mset ys = A"
[PROOF STATE]
proof (prove)
using this:
\<exists>xs. mset xs = A

goal (1 subgoal):
 1. (\<And>ys. mset ys = A \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
mset ys = A

goal (2 subgoals):
 1. \<And>x. x \<in> permutations_of_multiset (image_mset f A) \<Longrightarrow> x \<in> map f ` permutations_of_multiset A
 2. \<And>x xa. xa \<in> permutations_of_multiset A \<Longrightarrow> map f xa \<in> permutations_of_multiset (image_mset f A)
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
xs \<in> permutations_of_multiset (image_mset f A)
mset ys = A
[PROOF STEP]
have "mset xs = mset (map f ys)"
[PROOF STATE]
proof (prove)
using this:
xs \<in> permutations_of_multiset (image_mset f A)
mset ys = A

goal (1 subgoal):
 1. mset xs = mset (map f ys)
[PROOF STEP]
by (simp add: permutations_of_multiset_def)
[PROOF STATE]
proof (state)
this:
mset xs = mset (map f ys)

goal (2 subgoals):
 1. \<And>x. x \<in> permutations_of_multiset (image_mset f A) \<Longrightarrow> x \<in> map f ` permutations_of_multiset A
 2. \<And>x xa. xa \<in> permutations_of_multiset A \<Longrightarrow> map f xa \<in> permutations_of_multiset (image_mset f A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mset xs = mset (map f ys)
[PROOF STEP]
obtain \<sigma> where \<sigma>: "\<sigma> permutes {..<length (map f ys)}" "permute_list \<sigma> (map f ys) = xs"
[PROOF STATE]
proof (prove)
using this:
mset xs = mset (map f ys)

goal (1 subgoal):
 1. (\<And>\<sigma>. \<lbrakk>\<sigma> permutes {..<length (map f ys)}; permute_list \<sigma> (map f ys) = xs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule mset_eq_permutation)
[PROOF STATE]
proof (state)
this:
\<sigma> permutes {..<length (map f ys)}
permute_list \<sigma> (map f ys) = xs

goal (2 subgoals):
 1. \<And>x. x \<in> permutations_of_multiset (image_mset f A) \<Longrightarrow> x \<in> map f ` permutations_of_multiset A
 2. \<And>x xa. xa \<in> permutations_of_multiset A \<Longrightarrow> map f xa \<in> permutations_of_multiset (image_mset f A)
[PROOF STEP]
with ys
[PROOF STATE]
proof (chain)
picking this:
mset ys = A
\<sigma> permutes {..<length (map f ys)}
permute_list \<sigma> (map f ys) = xs
[PROOF STEP]
have "xs = map f (permute_list \<sigma> ys)"
[PROOF STATE]
proof (prove)
using this:
mset ys = A
\<sigma> permutes {..<length (map f ys)}
permute_list \<sigma> (map f ys) = xs

goal (1 subgoal):
 1. xs = map f (permute_list \<sigma> ys)
[PROOF STEP]
by (simp add: permute_list_map)
[PROOF STATE]
proof (state)
this:
xs = map f (permute_list \<sigma> ys)

goal (2 subgoals):
 1. \<And>x. x \<in> permutations_of_multiset (image_mset f A) \<Longrightarrow> x \<in> map f ` permutations_of_multiset A
 2. \<And>x xa. xa \<in> permutations_of_multiset A \<Longrightarrow> map f xa \<in> permutations_of_multiset (image_mset f A)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
xs = map f (permute_list \<sigma> ys)

goal (2 subgoals):
 1. \<And>x. x \<in> permutations_of_multiset (image_mset f A) \<Longrightarrow> x \<in> map f ` permutations_of_multiset A
 2. \<And>x xa. xa \<in> permutations_of_multiset A \<Longrightarrow> map f xa \<in> permutations_of_multiset (image_mset f A)
[PROOF STEP]
from \<sigma> ys
[PROOF STATE]
proof (chain)
picking this:
\<sigma> permutes {..<length (map f ys)}
permute_list \<sigma> (map f ys) = xs
mset ys = A
[PROOF STEP]
have "permute_list \<sigma> ys \<in> permutations_of_multiset A"
[PROOF STATE]
proof (prove)
using this:
\<sigma> permutes {..<length (map f ys)}
permute_list \<sigma> (map f ys) = xs
mset ys = A

goal (1 subgoal):
 1. permute_list \<sigma> ys \<in> permutations_of_multiset A
[PROOF STEP]
by (simp add: permutations_of_multiset_def)
[PROOF STATE]
proof (state)
this:
permute_list \<sigma> ys \<in> permutations_of_multiset A

goal (2 subgoals):
 1. \<And>x. x \<in> permutations_of_multiset (image_mset f A) \<Longrightarrow> x \<in> map f ` permutations_of_multiset A
 2. \<And>x xa. xa \<in> permutations_of_multiset A \<Longrightarrow> map f xa \<in> permutations_of_multiset (image_mset f A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
xs = map f (permute_list \<sigma> ys)
permute_list \<sigma> ys \<in> permutations_of_multiset A
[PROOF STEP]
show "xs \<in> map f ` permutations_of_multiset A"
[PROOF STATE]
proof (prove)
using this:
xs = map f (permute_list \<sigma> ys)
permute_list \<sigma> ys \<in> permutations_of_multiset A

goal (1 subgoal):
 1. xs \<in> map f ` permutations_of_multiset A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
xs \<in> map f ` permutations_of_multiset A

goal (1 subgoal):
 1. \<And>x xa. xa \<in> permutations_of_multiset A \<Longrightarrow> map f xa \<in> permutations_of_multiset (image_mset f A)
[PROOF STEP]
qed (auto simp: permutations_of_multiset_def)


[STATEMENT]
lemma indexed_const_P_multE:
  assumes "P \<in> indexed_pset I (carrier R)"
  assumes "c \<in> carrier R"
  shows "(P \<Otimes>\<^sub>p (indexed_const c)) m =  (P m) \<otimes> c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P \<Otimes>\<^sub>p indexed_const c) m = P m \<otimes> c
[PROOF STEP]
unfolding P_ring_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. P x \<otimes> indexed_const c (m - x)) = P m \<otimes> c
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. P x \<otimes> indexed_const c (m - x)) = P m \<otimes> c
[PROOF STEP]
have 3: "m \<notin> mset_factors m - {m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<notin> mset_factors m - {m}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m \<notin> mset_factors m - {m}

goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. P x \<otimes> indexed_const c (m - x)) = P m \<otimes> c
[PROOF STEP]
have 4: "finite ((mset_factors m) - {m})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (mset_factors m - {m})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (mset_factors m - {m})

goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. P x \<otimes> indexed_const c (m - x)) = P m \<otimes> c
[PROOF STEP]
have 5: "P m \<otimes> indexed_const c (m - m) \<in> carrier R "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P m \<otimes> indexed_const c (m - m) \<in> carrier R
[PROOF STEP]
by (metis assms(1) assms(2) cancel_comm_monoid_add_class.diff_cancel
      carrier_coeffE indexed_const_def indexed_pset_in_carrier local.ring_axioms
      ring.ring_simprules(5) subsetI)
[PROOF STATE]
proof (state)
this:
P m \<otimes> indexed_const c (m - m) \<in> carrier R

goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. P x \<otimes> indexed_const c (m - x)) = P m \<otimes> c
[PROOF STEP]
have 0: "(\<lambda>x. P x \<otimes> indexed_const c (m - x)) \<in> mset_factors m - {m} \<rightarrow> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. P x \<otimes> indexed_const c (m - x)) \<in> mset_factors m - {m} \<rightarrow> carrier R
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> mset_factors m - {m} \<Longrightarrow> P x \<otimes> indexed_const c (m - x) \<in> carrier R
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> mset_factors m - {m} \<Longrightarrow> P x \<otimes> indexed_const c (m - x) \<in> carrier R
[PROOF STEP]
assume "x \<in> mset_factors m - {m}"
[PROOF STATE]
proof (state)
this:
x \<in> mset_factors m - {m}

goal (1 subgoal):
 1. \<And>x. x \<in> mset_factors m - {m} \<Longrightarrow> P x \<otimes> indexed_const c (m - x) \<in> carrier R
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> mset_factors m - {m}
[PROOF STEP]
show "P x \<otimes> indexed_const c (m - x) \<in> carrier R "
[PROOF STATE]
proof (prove)
using this:
x \<in> mset_factors m - {m}

goal (1 subgoal):
 1. P x \<otimes> indexed_const c (m - x) \<in> carrier R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> mset_factors m - {m}
P \<in> carrier R [\<X>\<^bsub>I\<^esub>]
c \<in> carrier R

goal (1 subgoal):
 1. P x \<otimes> indexed_const c (m - x) \<in> carrier R
[PROOF STEP]
by (meson carrier_coeffE indexed_const_in_carrier indexed_pset_in_carrier m_closed subsetI)
[PROOF STATE]
proof (state)
this:
P x \<otimes> indexed_const c (m - x) \<in> carrier R

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>x. P x \<otimes> indexed_const c (m - x)) \<in> mset_factors m - {m} \<rightarrow> carrier R

goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. P x \<otimes> indexed_const c (m - x)) = P m \<otimes> c
[PROOF STEP]
have 1: "P m \<otimes> indexed_const c ( m - m) =  (P m \<otimes> c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P m \<otimes> indexed_const c (m - m) = P m \<otimes> c
[PROOF STEP]
by (simp add: indexed_const_def)
[PROOF STATE]
proof (state)
this:
P m \<otimes> indexed_const c (m - m) = P m \<otimes> c

goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. P x \<otimes> indexed_const c (m - x)) = P m \<otimes> c
[PROOF STEP]
have 2: "\<And>x. x \<in> mset_factors m \<Longrightarrow>  P x \<otimes> indexed_const c (m - x)  = (if x = m then (P m \<otimes> c) else \<zero>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> mset_factors m \<Longrightarrow> P x \<otimes> indexed_const c (m - x) = (if x = m then P m \<otimes> c else \<zero>)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> mset_factors m \<Longrightarrow> P x \<otimes> indexed_const c (m - x) = (if x = m then P m \<otimes> c else \<zero>)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> mset_factors m \<Longrightarrow> P x \<otimes> indexed_const c (m - x) = (if x = m then P m \<otimes> c else \<zero>)
[PROOF STEP]
assume "x \<in> mset_factors m "
[PROOF STATE]
proof (state)
this:
x \<in> mset_factors m

goal (1 subgoal):
 1. \<And>x. x \<in> mset_factors m \<Longrightarrow> P x \<otimes> indexed_const c (m - x) = (if x = m then P m \<otimes> c else \<zero>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> mset_factors m
[PROOF STEP]
have "indexed_const c (m - x) = (if x = m then c else \<zero>)"
[PROOF STATE]
proof (prove)
using this:
x \<in> mset_factors m

goal (1 subgoal):
 1. indexed_const c (m - x) = (if x = m then c else \<zero>)
[PROOF STEP]
unfolding indexed_const_def
[PROOF STATE]
proof (prove)
using this:
x \<in> mset_factors m

goal (1 subgoal):
 1. (if m - x = {#} then c else \<zero>) = (if x = m then c else \<zero>)
[PROOF STEP]
by (metis cancel_comm_monoid_add_class.diff_cancel
          diff_zero monom_comp' monom_divides_factors)
[PROOF STATE]
proof (state)
this:
indexed_const c (m - x) = (if x = m then c else \<zero>)

goal (1 subgoal):
 1. \<And>x. x \<in> mset_factors m \<Longrightarrow> P x \<otimes> indexed_const c (m - x) = (if x = m then P m \<otimes> c else \<zero>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
indexed_const c (m - x) = (if x = m then c else \<zero>)
[PROOF STEP]
show  "P x \<otimes> indexed_const c (m - x)  = (if x = m then (P m \<otimes> c) else \<zero>)"
[PROOF STATE]
proof (prove)
using this:
indexed_const c (m - x) = (if x = m then c else \<zero>)

goal (1 subgoal):
 1. P x \<otimes> indexed_const c (m - x) = (if x = m then P m \<otimes> c else \<zero>)
[PROOF STEP]
by (metis assms(1) carrier_coeffE indexed_pset_in_carrier
            local.semiring_axioms semiring.r_null set_eq_subset)
[PROOF STATE]
proof (state)
this:
P x \<otimes> indexed_const c (m - x) = (if x = m then P m \<otimes> c else \<zero>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x22 \<in> mset_factors m \<Longrightarrow> P ?x22 \<otimes> indexed_const c (m - ?x22) = (if ?x22 = m then P m \<otimes> c else \<zero>)

goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. P x \<otimes> indexed_const c (m - x)) = P m \<otimes> c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x22 \<in> mset_factors m \<Longrightarrow> P ?x22 \<otimes> indexed_const c (m - ?x22) = (if ?x22 = m then P m \<otimes> c else \<zero>)
[PROOF STEP]
have "(\<Oplus>x\<in>(mset_factors m) - {m}. P x \<otimes> indexed_const c (m - x)) = \<zero>"
[PROOF STATE]
proof (prove)
using this:
?x22 \<in> mset_factors m \<Longrightarrow> P ?x22 \<otimes> indexed_const c (m - ?x22) = (if ?x22 = m then P m \<otimes> c else \<zero>)

goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m - {m}. P x \<otimes> indexed_const c (m - x)) = \<zero>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x22 \<in> mset_factors m \<Longrightarrow> P ?x22 \<otimes> indexed_const c (m - ?x22) = (if ?x22 = m then P m \<otimes> c else \<zero>)
P \<in> carrier R [\<X>\<^bsub>I\<^esub>]
c \<in> carrier R

goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m - {m}. P x \<otimes> indexed_const c (m - x)) = \<zero>
[PROOF STEP]
by (metis (no_types, lifting) DiffD1 DiffD2 add.finprod_one_eqI singletonI)
[PROOF STATE]
proof (state)
this:
(\<Oplus>x\<in>mset_factors m - {m}. P x \<otimes> indexed_const c (m - x)) = \<zero>

goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. P x \<otimes> indexed_const c (m - x)) = P m \<otimes> c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Oplus>x\<in>mset_factors m - {m}. P x \<otimes> indexed_const c (m - x)) = \<zero>
[PROOF STEP]
show "(\<Oplus>x\<in>(mset_factors m). P x \<otimes> indexed_const c (m - x)) = P m \<otimes> c"
[PROOF STATE]
proof (prove)
using this:
(\<Oplus>x\<in>mset_factors m - {m}. P x \<otimes> indexed_const c (m - x)) = \<zero>

goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. P x \<otimes> indexed_const c (m - x)) = P m \<otimes> c
[PROOF STEP]
using assms 0 1 3 4 5 finsum_insert[of "(mset_factors m) - {m}"
                                    m "\<lambda>x. P x \<otimes> indexed_const c (m - x) "]
[PROOF STATE]
proof (prove)
using this:
(\<Oplus>x\<in>mset_factors m - {m}. P x \<otimes> indexed_const c (m - x)) = \<zero>
P \<in> carrier R [\<X>\<^bsub>I\<^esub>]
c \<in> carrier R
(\<lambda>x. P x \<otimes> indexed_const c (m - x)) \<in> mset_factors m - {m} \<rightarrow> carrier R
P m \<otimes> indexed_const c (m - m) = P m \<otimes> c
m \<notin> mset_factors m - {m}
finite (mset_factors m - {m})
P m \<otimes> indexed_const c (m - m) \<in> carrier R
\<lbrakk>finite (mset_factors m - {m}); m \<notin> mset_factors m - {m}; (\<lambda>x. P x \<otimes> indexed_const c (m - x)) \<in> mset_factors m - {m} \<rightarrow> carrier R; P m \<otimes> indexed_const c (m - m) \<in> carrier R\<rbrakk> \<Longrightarrow> (\<Oplus>x\<in>insert m (mset_factors m - {m}). P x \<otimes> indexed_const c (m - x)) = P m \<otimes> indexed_const c (m - m) \<oplus> (\<Oplus>x\<in>mset_factors m - {m}. P x \<otimes> indexed_const c (m - x))

goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. P x \<otimes> indexed_const c (m - x)) = P m \<otimes> c
[PROOF STEP]
by (metis (no_types, lifting) m_factor add.l_cancel_one
              insert_Diff_single insert_absorb zero_closed)
[PROOF STATE]
proof (state)
this:
(\<Oplus>x\<in>mset_factors m. P x \<otimes> indexed_const c (m - x)) = P m \<otimes> c

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma merge_updates: "merge qs ps = updates (rev (map fst ps)) (rev (map snd ps)) qs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. merge qs ps = updates (rev (map fst ps)) (rev (map snd ps)) qs
[PROOF STEP]
by (simp add: merge_def updates_def foldr_conv_fold zip_rev zip_map_fst_snd)


[STATEMENT]
lemma semisimple :
  assumes "Subspace U"
  shows   "\<exists>W. Subspace W \<and> (V = W \<oplus> U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>W. Subspace W \<and> V = W \<oplus> U
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>W. Subspace W \<and> V = W \<oplus> U
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
Subspace U
[PROOF STEP]
obtain us where us: "basis_for U us"
[PROOF STATE]
proof (prove)
using this:
Subspace U

goal (1 subgoal):
 1. (\<And>us. set us \<subseteq> U \<and> U = RSpan us \<and> R_lin_independent us \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using SubspaceD1 Subspace_is_findim VectorSpace.FinDimVectorSpaceI
          FinDimVectorSpace.basis_ex[of _ U]
[PROOF STATE]
proof (prove)
using this:
Subspace U
Subspace ?U \<Longrightarrow> VectorSpace (\<cdot>) ?U
Subspace ?U \<Longrightarrow> \<exists>ms. set ms \<subseteq> ?U \<and> RSpan ms = ?U
\<lbrakk>VectorSpace ?smult ?V; \<exists>ms. set ms \<subseteq> ?V \<and> R_scalar_mult.RSpan UNIV ?smult ms = ?V\<rbrakk> \<Longrightarrow> FinDimVectorSpace ?smult ?V
FinDimVectorSpace ?smult U \<Longrightarrow> \<exists>vs. set vs \<subseteq> U \<and> U = R_scalar_mult.RSpan UNIV ?smult vs \<and> R_scalar_mult.R_lin_independent UNIV ?smult vs

goal (1 subgoal):
 1. (\<And>us. set us \<subseteq> U \<and> U = RSpan us \<and> R_lin_independent us \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by    fastforce
[PROOF STATE]
proof (state)
this:
set us \<subseteq> U \<and> U = RSpan us \<and> R_lin_independent us

goal (1 subgoal):
 1. \<exists>W. Subspace W \<and> V = W \<oplus> U
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
Subspace U
set us \<subseteq> U \<and> U = RSpan us \<and> R_lin_independent us
[PROOF STEP]
obtain ws where basis: "basis_for V (ws@us)"
[PROOF STATE]
proof (prove)
using this:
Subspace U
set us \<subseteq> U \<and> U = RSpan us \<and> R_lin_independent us

goal (1 subgoal):
 1. (\<And>ws. set (ws @ us) \<subseteq> V \<and> V = RSpan (ws @ us) \<and> R_lin_independent (ws @ us) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using extend_Subspace_basis
[PROOF STATE]
proof (prove)
using this:
Subspace U
set us \<subseteq> U \<and> U = RSpan us \<and> R_lin_independent us
\<lbrakk>?U \<subseteq> V; set ?us \<subseteq> ?U \<and> ?U = RSpan ?us \<and> R_lin_independent ?us\<rbrakk> \<Longrightarrow> \<exists>vs. set (vs @ ?us) \<subseteq> V \<and> V = RSpan (vs @ ?us) \<and> R_lin_independent (vs @ ?us)

goal (1 subgoal):
 1. (\<And>ws. set (ws @ us) \<subseteq> V \<and> V = RSpan (ws @ us) \<and> R_lin_independent (ws @ us) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
set (ws @ us) \<subseteq> V \<and> V = RSpan (ws @ us) \<and> R_lin_independent (ws @ us)

goal (1 subgoal):
 1. \<exists>W. Subspace W \<and> V = W \<oplus> U
[PROOF STEP]
hence ws_V: "set ws \<subseteq> V" and ind_ws_us: "lin_independent (ws@us)"
    and V_eq: "V = Span (ws@us)"
[PROOF STATE]
proof (prove)
using this:
set (ws @ us) \<subseteq> V \<and> V = RSpan (ws @ us) \<and> R_lin_independent (ws @ us)

goal (1 subgoal):
 1. set ws \<subseteq> V &&& R_lin_independent (ws @ us) &&& V = RSpan (ws @ us)
[PROOF STEP]
by  auto
[PROOF STATE]
proof (state)
this:
set ws \<subseteq> V
R_lin_independent (ws @ us)
V = RSpan (ws @ us)

goal (1 subgoal):
 1. \<exists>W. Subspace W \<and> V = W \<oplus> U
[PROOF STEP]
have "V = Span ws \<oplus> Span us"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V = RSpan ws \<oplus> RSpan us
[PROOF STEP]
proof (rule inner_dirsum_doubleI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. V = RSpan ws + RSpan us
 2. add_independentS [RSpan ws, RSpan us]
[PROOF STEP]
from V_eq
[PROOF STATE]
proof (chain)
picking this:
V = RSpan (ws @ us)
[PROOF STEP]
show "V = Span ws + Span us"
[PROOF STATE]
proof (prove)
using this:
V = RSpan (ws @ us)

goal (1 subgoal):
 1. V = RSpan ws + RSpan us
[PROOF STEP]
using Span_append
[PROOF STATE]
proof (prove)
using this:
V = RSpan (ws @ us)
RSpan (?ms @ ?ns) = RSpan ?ms + RSpan ?ns

goal (1 subgoal):
 1. V = RSpan ws + RSpan us
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
V = RSpan ws + RSpan us

goal (1 subgoal):
 1. add_independentS [RSpan ws, RSpan us]
[PROOF STEP]
from ws_V ind_ws_us
[PROOF STATE]
proof (chain)
picking this:
set ws \<subseteq> V
R_lin_independent (ws @ us)
[PROOF STEP]
show "add_independentS [Span ws, Span us]"
[PROOF STATE]
proof (prove)
using this:
set ws \<subseteq> V
R_lin_independent (ws @ us)

goal (1 subgoal):
 1. add_independentS [RSpan ws, RSpan us]
[PROOF STEP]
using lin_independent_append_imp_independent_Spans
[PROOF STATE]
proof (prove)
using this:
set ws \<subseteq> V
R_lin_independent (ws @ us)
\<lbrakk>set ?ms \<subseteq> V; R_lin_independent (?ms @ ?ns)\<rbrakk> \<Longrightarrow> add_independentS [RSpan ?ms, RSpan ?ns]

goal (1 subgoal):
 1. add_independentS [RSpan ws, RSpan us]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
add_independentS [RSpan ws, RSpan us]

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
V = RSpan ws \<oplus> RSpan us

goal (1 subgoal):
 1. \<exists>W. Subspace W \<and> V = W \<oplus> U
[PROOF STEP]
with us ws_V
[PROOF STATE]
proof (chain)
picking this:
set us \<subseteq> U \<and> U = RSpan us \<and> R_lin_independent us
set ws \<subseteq> V
V = RSpan ws \<oplus> RSpan us
[PROOF STEP]
have "Subspace (Span ws) \<and> V = (Span ws) \<oplus> U"
[PROOF STATE]
proof (prove)
using this:
set us \<subseteq> U \<and> U = RSpan us \<and> R_lin_independent us
set ws \<subseteq> V
V = RSpan ws \<oplus> RSpan us

goal (1 subgoal):
 1. Subspace (RSpan ws) \<and> V = RSpan ws \<oplus> U
[PROOF STEP]
using Subspace_Span
[PROOF STATE]
proof (prove)
using this:
set us \<subseteq> U \<and> U = RSpan us \<and> R_lin_independent us
set ws \<subseteq> V
V = RSpan ws \<oplus> RSpan us
set ?ms \<subseteq> V \<Longrightarrow> Subspace (RSpan ?ms)

goal (1 subgoal):
 1. Subspace (RSpan ws) \<and> V = RSpan ws \<oplus> U
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Subspace (RSpan ws) \<and> V = RSpan ws \<oplus> U

goal (1 subgoal):
 1. \<exists>W. Subspace W \<and> V = W \<oplus> U
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Subspace (RSpan ws) \<and> V = RSpan ws \<oplus> U

goal (1 subgoal):
 1. \<exists>W. Subspace W \<and> V = W \<oplus> U
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
\<exists>W. Subspace W \<and> V = W \<oplus> U

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dropWhile_replicate_append:
  "dropWhile ((=) a) (replicate n a @ ys) = dropWhile ((=) a) ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dropWhile ((=) a) (replicate n a @ ys) = dropWhile ((=) a) ys
[PROOF STEP]
by (induct n) simp_all


[STATEMENT]
lemma fi_scalar_prod_gso:
  assumes i: "i < m" and j: "j < m"
  shows "fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
let ?mu = "\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
from i
[PROOF STATE]
proof (chain)
picking this:
i < length fs
[PROOF STEP]
have list1: "[0..< m] = [0..< Suc i] @ [Suc i ..< m]"
[PROOF STATE]
proof (prove)
using this:
i < length fs

goal (1 subgoal):
 1. [0..<length fs] = [0..<Suc i] @ [Suc i..<length fs]
[PROOF STEP]
by (intro nth_equalityI, auto simp: nth_append, rename_tac j, case_tac "j - i", auto)
[PROOF STATE]
proof (state)
this:
[0..<length fs] = [0..<Suc i] @ [Suc i..<length fs]

goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
from j
[PROOF STATE]
proof (chain)
picking this:
j < length fs
[PROOF STEP]
have list2: "[0..< m] = [0..< j] @ [j] @ [Suc j ..< m]"
[PROOF STATE]
proof (prove)
using this:
j < length fs

goal (1 subgoal):
 1. [0..<length fs] = [0..<j] @ [j] @ [Suc j..<length fs]
[PROOF STEP]
by (intro nth_equalityI, auto simp: nth_append, rename_tac k, case_tac "k - j", auto)
[PROOF STATE]
proof (state)
this:
[0..<length fs] = [0..<j] @ [j] @ [Suc j..<length fs]

goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
have "fs ! i \<bullet> gso j = sumlist (map ?mu [0..<Suc i]) \<bullet> gso j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fs ! i \<bullet> gso j = M.sumlist (map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]) \<bullet> gso j
[PROOF STEP]
unfolding fi_is_sum_of_mu_gso[OF i]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M.sumlist (map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]) \<bullet> gso j = M.sumlist (map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]) \<bullet> gso j
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fs ! i \<bullet> gso j = M.sumlist (map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]) \<bullet> gso j

goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fs ! i \<bullet> gso j = M.sumlist (map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]) \<bullet> gso j

goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
have "\<dots> = (\<Sum>v\<leftarrow>map ?mu [0..<Suc i]. v \<bullet> gso j) + 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M.sumlist (map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]) \<bullet> gso j = (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]. v \<bullet> gso j) + (0::'a)
[PROOF STEP]
by (subst scalar_prod_left_sum_distrib, insert gso_carrier assms, auto)
[PROOF STATE]
proof (state)
this:
M.sumlist (map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]) \<bullet> gso j = (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]. v \<bullet> gso j) + (0::'a)

goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
M.sumlist (map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]) \<bullet> gso j = (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]. v \<bullet> gso j) + (0::'a)

goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
have "\<dots> = (\<Sum>v\<leftarrow>map ?mu [0..<Suc i]. v \<bullet> gso j) + (\<Sum>v\<leftarrow>map ?mu [Suc i..<m]. v \<bullet> gso j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]. v \<bullet> gso j) + (0::'a) = (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]. v \<bullet> gso j) + (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [Suc i..<length fs]. v \<bullet> gso j)
[PROOF STEP]
by (subst (3) sum_list_neutral, insert assms gso_carrier, auto intro!: orthogonal simp: \<mu>.simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]. v \<bullet> gso j) + (0::'a) = (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]. v \<bullet> gso j) + (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [Suc i..<length fs]. v \<bullet> gso j)

goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]. v \<bullet> gso j) + (0::'a) = (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]. v \<bullet> gso j) + (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [Suc i..<length fs]. v \<bullet> gso j)

goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
have "\<dots> = (\<Sum>v\<leftarrow>map ?mu [0..< m]. v \<bullet> gso j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]. v \<bullet> gso j) + (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [Suc i..<length fs]. v \<bullet> gso j) = (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<length fs]. v \<bullet> gso j)
[PROOF STEP]
unfolding list1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]. v \<bullet> gso j) + (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [Suc i..<length fs]. v \<bullet> gso j) = (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) ([0..<Suc i] @ [Suc i..<length fs]). v \<bullet> gso j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]. v \<bullet> gso j) + (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [Suc i..<length fs]. v \<bullet> gso j) = (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<length fs]. v \<bullet> gso j)

goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<Suc i]. v \<bullet> gso j) + (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [Suc i..<length fs]. v \<bullet> gso j) = (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<length fs]. v \<bullet> gso j)

goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
have "\<dots> = (\<Sum>v\<leftarrow>map ?mu [0..< j]. v \<bullet> gso j) + ?mu j \<bullet> gso j + (\<Sum>v\<leftarrow>map ?mu [Suc j..< m]. v \<bullet> gso j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<length fs]. v \<bullet> gso j) = (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<j]. v \<bullet> gso j) + (\<mu> i j \<cdot>\<^sub>v gso j) \<bullet> gso j + (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [Suc j..<length fs]. v \<bullet> gso j)
[PROOF STEP]
unfolding list2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) ([0..<j] @ [j] @ [Suc j..<length fs]). v \<bullet> gso j) = (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<j]. v \<bullet> gso j) + (\<mu> i j \<cdot>\<^sub>v gso j) \<bullet> gso j + (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [Suc j..<length fs]. v \<bullet> gso j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<length fs]. v \<bullet> gso j) = (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<j]. v \<bullet> gso j) + (\<mu> i j \<cdot>\<^sub>v gso j) \<bullet> gso j + (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [Suc j..<length fs]. v \<bullet> gso j)

goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<length fs]. v \<bullet> gso j) = (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<j]. v \<bullet> gso j) + (\<mu> i j \<cdot>\<^sub>v gso j) \<bullet> gso j + (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [Suc j..<length fs]. v \<bullet> gso j)

goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
have "(\<Sum>v\<leftarrow>map ?mu [0..< j]. v \<bullet> gso j) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<j]. v \<bullet> gso j) = (0::'a)
[PROOF STEP]
by (rule sum_list_neutral, insert assms gso_carrier, auto intro!: orthogonal)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<j]. v \<bullet> gso j) = (0::'a)

goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [0..<j]. v \<bullet> gso j) = (0::'a)

goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
have "(\<Sum>v\<leftarrow>map ?mu [Suc j..< m]. v \<bullet> gso j) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [Suc j..<length fs]. v \<bullet> gso j) = (0::'a)
[PROOF STEP]
by (rule sum_list_neutral, insert assms gso_carrier, auto intro!: orthogonal)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [Suc j..<length fs]. v \<bullet> gso j) = (0::'a)

goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<leftarrow>map (\<lambda>j. \<mu> i j \<cdot>\<^sub>v gso j) [Suc j..<length fs]. v \<bullet> gso j) = (0::'a)

goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
have "?mu j \<bullet> gso j = \<mu> i j * sq_norm (gso j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<mu> i j \<cdot>\<^sub>v gso j) \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
using gso_carrier[OF j]
[PROOF STATE]
proof (prove)
using this:
gso j \<in> carrier_vec n

goal (1 subgoal):
 1. (\<mu> i j \<cdot>\<^sub>v gso j) \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
by (simp add: sq_norm_vec_as_cscalar_prod)
[PROOF STATE]
proof (state)
this:
(\<mu> i j \<cdot>\<^sub>v gso j) \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2

goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fs ! i \<bullet> gso j = (0::'a) + \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2 + (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fs ! i \<bullet> gso j = (0::'a) + \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2 + (0::'a)

goal (1 subgoal):
 1. fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fs ! i \<bullet> gso j = \<mu> i j * \<parallel>gso j\<parallel>\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in weak_upper_semilattice) join_cong_r:
  assumes carr: "x \<in> carrier L" "y \<in> carrier L" "y' \<in> carrier L"
    and yy': "y .= y'"
  shows "x \<squnion> y .= x \<squnion> y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<squnion> y .= x \<squnion> y'
[PROOF STEP]
proof (rule joinI, rule joinI)
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. \<And>l la. \<lbrakk>is_lub L l {x, y'}; is_lub L la {x, y}\<rbrakk> \<Longrightarrow> la .= l
 2. \<And>l. is_lub L l {x, y'} \<Longrightarrow> x \<in> carrier L
 3. \<And>l. is_lub L l {x, y'} \<Longrightarrow> y \<in> carrier L
 4. x \<in> carrier L
 5. y' \<in> carrier L
[PROOF STEP]
fix a b
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. \<And>l la. \<lbrakk>is_lub L l {x, y'}; is_lub L la {x, y}\<rbrakk> \<Longrightarrow> la .= l
 2. \<And>l. is_lub L l {x, y'} \<Longrightarrow> x \<in> carrier L
 3. \<And>l. is_lub L l {x, y'} \<Longrightarrow> y \<in> carrier L
 4. x \<in> carrier L
 5. y' \<in> carrier L
[PROOF STEP]
have "{x, y} = {y, x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x, y} = {y, x}
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
{x, y} = {y, x}

goal (5 subgoals):
 1. \<And>l la. \<lbrakk>is_lub L l {x, y'}; is_lub L la {x, y}\<rbrakk> \<Longrightarrow> la .= l
 2. \<And>l. is_lub L l {x, y'} \<Longrightarrow> x \<in> carrier L
 3. \<And>l. is_lub L l {x, y'} \<Longrightarrow> y \<in> carrier L
 4. x \<in> carrier L
 5. y' \<in> carrier L
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{x, y} = {y, x}

goal (5 subgoals):
 1. \<And>l la. \<lbrakk>is_lub L l {x, y'}; is_lub L la {x, y}\<rbrakk> \<Longrightarrow> la .= l
 2. \<And>l. is_lub L l {x, y'} \<Longrightarrow> x \<in> carrier L
 3. \<And>l. is_lub L l {x, y'} \<Longrightarrow> y \<in> carrier L
 4. x \<in> carrier L
 5. y' \<in> carrier L
[PROOF STEP]
from carr yy'
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier L
y \<in> carrier L
y' \<in> carrier L
y .= y'
[PROOF STEP]
have "{y, x} {.=} {y', x}"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier L
y \<in> carrier L
y' \<in> carrier L
y .= y'

goal (1 subgoal):
 1. {y, x} {.=} {y', x}
[PROOF STEP]
by (intro set_eq_pairI)
[PROOF STATE]
proof (state)
this:
{y, x} {.=} {y', x}

goal (5 subgoals):
 1. \<And>l la. \<lbrakk>is_lub L l {x, y'}; is_lub L la {x, y}\<rbrakk> \<Longrightarrow> la .= l
 2. \<And>l. is_lub L l {x, y'} \<Longrightarrow> x \<in> carrier L
 3. \<And>l. is_lub L l {x, y'} \<Longrightarrow> y \<in> carrier L
 4. x \<in> carrier L
 5. y' \<in> carrier L
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{y, x} {.=} {y', x}

goal (5 subgoals):
 1. \<And>l la. \<lbrakk>is_lub L l {x, y'}; is_lub L la {x, y}\<rbrakk> \<Longrightarrow> la .= l
 2. \<And>l. is_lub L l {x, y'} \<Longrightarrow> x \<in> carrier L
 3. \<And>l. is_lub L l {x, y'} \<Longrightarrow> y \<in> carrier L
 4. x \<in> carrier L
 5. y' \<in> carrier L
[PROOF STEP]
have "{y', x} = {x, y'}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y', x} = {x, y'}
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
{y', x} = {x, y'}

goal (5 subgoals):
 1. \<And>l la. \<lbrakk>is_lub L l {x, y'}; is_lub L la {x, y}\<rbrakk> \<Longrightarrow> la .= l
 2. \<And>l. is_lub L l {x, y'} \<Longrightarrow> x \<in> carrier L
 3. \<And>l. is_lub L l {x, y'} \<Longrightarrow> y \<in> carrier L
 4. x \<in> carrier L
 5. y' \<in> carrier L
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
{x, y} {.=} {x, y'}
[PROOF STEP]
have seq: "{x, y} {.=} {x, y'}"
[PROOF STATE]
proof (prove)
using this:
{x, y} {.=} {x, y'}

goal (1 subgoal):
 1. {x, y} {.=} {x, y'}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
{x, y} {.=} {x, y'}

goal (5 subgoals):
 1. \<And>l la. \<lbrakk>is_lub L l {x, y'}; is_lub L la {x, y}\<rbrakk> \<Longrightarrow> la .= l
 2. \<And>l. is_lub L l {x, y'} \<Longrightarrow> x \<in> carrier L
 3. \<And>l. is_lub L l {x, y'} \<Longrightarrow> y \<in> carrier L
 4. x \<in> carrier L
 5. y' \<in> carrier L
[PROOF STEP]
assume leasta: "least L a (Upper L {x, y})"
[PROOF STATE]
proof (state)
this:
is_lub L a {x, y}

goal (5 subgoals):
 1. \<And>l la. \<lbrakk>is_lub L l {x, y'}; is_lub L la {x, y}\<rbrakk> \<Longrightarrow> la .= l
 2. \<And>l. is_lub L l {x, y'} \<Longrightarrow> x \<in> carrier L
 3. \<And>l. is_lub L l {x, y'} \<Longrightarrow> y \<in> carrier L
 4. x \<in> carrier L
 5. y' \<in> carrier L
[PROOF STEP]
assume "least L b (Upper L {x, y'})"
[PROOF STATE]
proof (state)
this:
is_lub L b {x, y'}

goal (5 subgoals):
 1. \<And>l la. \<lbrakk>is_lub L l {x, y'}; is_lub L la {x, y}\<rbrakk> \<Longrightarrow> la .= l
 2. \<And>l. is_lub L l {x, y'} \<Longrightarrow> x \<in> carrier L
 3. \<And>l. is_lub L l {x, y'} \<Longrightarrow> y \<in> carrier L
 4. x \<in> carrier L
 5. y' \<in> carrier L
[PROOF STEP]
with carr
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier L
y \<in> carrier L
y' \<in> carrier L
is_lub L b {x, y'}
[PROOF STEP]
have leastb: "least L b (Upper L {x, y})"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier L
y \<in> carrier L
y' \<in> carrier L
is_lub L b {x, y'}

goal (1 subgoal):
 1. is_lub L b {x, y}
[PROOF STEP]
by (simp add: least_Upper_cong_r[OF _ _ seq])
[PROOF STATE]
proof (state)
this:
is_lub L b {x, y}

goal (5 subgoals):
 1. \<And>l la. \<lbrakk>is_lub L l {x, y'}; is_lub L la {x, y}\<rbrakk> \<Longrightarrow> la .= l
 2. \<And>l. is_lub L l {x, y'} \<Longrightarrow> x \<in> carrier L
 3. \<And>l. is_lub L l {x, y'} \<Longrightarrow> y \<in> carrier L
 4. x \<in> carrier L
 5. y' \<in> carrier L
[PROOF STEP]
from leasta leastb
[PROOF STATE]
proof (chain)
picking this:
is_lub L a {x, y}
is_lub L b {x, y}
[PROOF STEP]
show "a .= b"
[PROOF STATE]
proof (prove)
using this:
is_lub L a {x, y}
is_lub L b {x, y}

goal (1 subgoal):
 1. a .= b
[PROOF STEP]
by (rule weak_least_unique)
[PROOF STATE]
proof (state)
this:
a .= b

goal (4 subgoals):
 1. \<And>l. is_lub L l {x, y'} \<Longrightarrow> x \<in> carrier L
 2. \<And>l. is_lub L l {x, y'} \<Longrightarrow> y \<in> carrier L
 3. x \<in> carrier L
 4. y' \<in> carrier L
[PROOF STEP]
qed (rule carr)+


[STATEMENT]
lemma row_prop_cond: "(\<And> i. i < dim_row M \<Longrightarrow> P (row M i)) \<Longrightarrow> r \<in> set (rows M) \<Longrightarrow> P r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>i. i < dim_row M \<Longrightarrow> P (row M i); r \<in> set (rows M)\<rbrakk> \<Longrightarrow> P r
[PROOF STEP]
using obtain_row_index
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?r \<in> set (rows ?M); \<And>i. \<lbrakk>row ?M i = ?r; i < dim_row ?M\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. \<lbrakk>\<And>i. i < dim_row M \<Longrightarrow> P (row M i); r \<in> set (rows M)\<rbrakk> \<Longrightarrow> P r
[PROOF STEP]
by metis


[STATEMENT]
lemma larger_in_consump_set:
  "x \<in> consumption_set \<and> y \<ge> x \<Longrightarrow> y \<in> consumption_set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> consumption_set \<and> x \<le> y \<Longrightarrow> y \<in> consumption_set
[PROOF STEP]
using arrow_debreu_consum_set_axioms arrow_debreu_consum_set_def
    dual_order.order_iff_strict
[PROOF STATE]
proof (prove)
using this:
arrow_debreu_consum_set consumption_set
arrow_debreu_consum_set ?consumption_set \<equiv> (?consumption_set \<subseteq> {x. (0::?'a) \<le> x} \<and> closed ?consumption_set) \<and> convex ?consumption_set \<and> ?consumption_set \<noteq> {} \<and> (\<forall>M\<in>?consumption_set. \<forall>x>M. x \<in> ?consumption_set)
(?b \<le> ?a) = (?b < ?a \<or> ?a = ?b)

goal (1 subgoal):
 1. x \<in> consumption_set \<and> x \<le> y \<Longrightarrow> y \<in> consumption_set
[PROOF STEP]
by fastforce


[STATEMENT]
theorem no_augmenting_path: "\<not>isAugmentingPath p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> isAugmentingPath p
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. isAugmentingPath p \<Longrightarrow> False
[PROOF STEP]
assume "isAugmentingPath p"
[PROOF STATE]
proof (state)
this:
isAugmentingPath p

goal (1 subgoal):
 1. isAugmentingPath p \<Longrightarrow> False
[PROOF STEP]
hence SP: "cf.isSimplePath s p t"
[PROOF STATE]
proof (prove)
using this:
isAugmentingPath p

goal (1 subgoal):
 1. cf.isSimplePath s p t
[PROOF STEP]
unfolding isAugmentingPath_def
[PROOF STATE]
proof (prove)
using this:
cf.isSimplePath s p t

goal (1 subgoal):
 1. cf.isSimplePath s p t
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cf.isSimplePath s p t

goal (1 subgoal):
 1. isAugmentingPath p \<Longrightarrow> False
[PROOF STEP]
hence "cf.isPath s p t"
[PROOF STATE]
proof (prove)
using this:
cf.isSimplePath s p t

goal (1 subgoal):
 1. cf.isPath s p t
[PROOF STEP]
unfolding cf.isSimplePath_def
[PROOF STATE]
proof (prove)
using this:
cf.isPath s p t \<and> distinct (cf.pathVertices s p)

goal (1 subgoal):
 1. cf.isPath s p t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cf.isPath s p t

goal (1 subgoal):
 1. isAugmentingPath p \<Longrightarrow> False
[PROOF STEP]
from gen_valid[OF this]
[PROOF STATE]
proof (chain)
picking this:
l s \<le> l t + length p
[PROOF STEP]
have "length p \<ge> card V"
[PROOF STATE]
proof (prove)
using this:
l s \<le> l t + length p

goal (1 subgoal):
 1. card V \<le> length p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card V \<le> length p

goal (1 subgoal):
 1. isAugmentingPath p \<Longrightarrow> False
[PROOF STEP]
with cf.simplePath_length_less_V[OF _ SP]
[PROOF STATE]
proof (chain)
picking this:
s \<in> cf.V \<Longrightarrow> length p < card cf.V
card V \<le> length p
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
s \<in> cf.V \<Longrightarrow> length p < card cf.V
card V \<le> length p

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zero_le_power_ereal[simp]:
  fixes a :: ereal
  assumes "0 \<le> a"
  shows "0 \<le> a ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> a ^ n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> a

goal (1 subgoal):
 1. 0 \<le> a ^ n
[PROOF STEP]
by (induct n) (auto simp: ereal_zero_le_0_iff)


[STATEMENT]
lemma in_set_sublists [simp]: "xs \<in> set (sublists ys) \<longleftrightarrow> sublist xs ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xs \<in> set (sublists ys)) = sublist xs ys
[PROOF STEP]
by (induction ys arbitrary: xs) (auto simp: sublist_Cons_right prefix_Cons)


[STATEMENT]
lemma (in domain) univ_poly_a_inv_consistent:
  assumes "subring K R" "p \<in> carrier (K[X])"
  shows "\<ominus>\<^bsub>K[X]\<^esub> p = \<ominus>\<^bsub>(carrier R)[X]\<^esub> p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<ominus>\<^bsub>K [X]\<^esub> p = \<ominus>\<^bsub>carrier R [X]\<^esub> p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<ominus>\<^bsub>K [X]\<^esub> p = \<ominus>\<^bsub>carrier R [X]\<^esub> p
[PROOF STEP]
have in_carrier: "p \<in> carrier ((carrier R)[X])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<in> carrier (carrier R [X])
[PROOF STEP]
using assms carrier_polynomial
[PROOF STATE]
proof (prove)
using this:
subring K R
p \<in> carrier (K [X])
\<lbrakk>subring ?K R; polynomial ?K ?p\<rbrakk> \<Longrightarrow> polynomial (carrier R) ?p

goal (1 subgoal):
 1. p \<in> carrier (carrier R [X])
[PROOF STEP]
by (auto simp add: univ_poly_def)
[PROOF STATE]
proof (state)
this:
p \<in> carrier (carrier R [X])

goal (1 subgoal):
 1. \<ominus>\<^bsub>K [X]\<^esub> p = \<ominus>\<^bsub>carrier R [X]\<^esub> p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<ominus>\<^bsub>K [X]\<^esub> p = \<ominus>\<^bsub>carrier R [X]\<^esub> p
[PROOF STEP]
using univ_poly_a_inv_def'[OF assms]
          univ_poly_a_inv_def'[OF carrier_is_subring in_carrier]
[PROOF STATE]
proof (prove)
using this:
\<ominus>\<^bsub>K [X]\<^esub> p = map (a_inv R) p
\<ominus>\<^bsub>carrier R [X]\<^esub> p = map (a_inv R) p

goal (1 subgoal):
 1. \<ominus>\<^bsub>K [X]\<^esub> p = \<ominus>\<^bsub>carrier R [X]\<^esub> p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<ominus>\<^bsub>K [X]\<^esub> p = \<ominus>\<^bsub>carrier R [X]\<^esub> p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hom_iMin_commute: "\<lbrakk> \<And>x y. h (min x y) = min (h x) (h y); I \<noteq> {} \<rbrakk> \<Longrightarrow> iMin (h ` I) = h (iMin I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x y. h (min x y) = min (h x) (h y); I \<noteq> {}\<rbrakk> \<Longrightarrow> iMin (h ` I) = h (iMin I)
[PROOF STEP]
apply (rule iMin_equality)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<And>x y. h (min x y) = min (h x) (h y); I \<noteq> {}\<rbrakk> \<Longrightarrow> h (iMin I) \<in> h ` I
 2. \<And>x. \<lbrakk>\<And>x y. h (min x y) = min (h x) (h y); I \<noteq> {}; x \<in> h ` I\<rbrakk> \<Longrightarrow> h (iMin I) \<le> x
[PROOF STEP]
apply (blast intro: iMinI_ex2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>x y. h (min x y) = min (h x) (h y); I \<noteq> {}; x \<in> h ` I\<rbrakk> \<Longrightarrow> h (iMin I) \<le> x
[PROOF STEP]
apply (rename_tac y)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. \<lbrakk>\<And>x y. h (min x y) = min (h x) (h y); I \<noteq> {}; y \<in> h ` I\<rbrakk> \<Longrightarrow> h (iMin I) \<le> y
[PROOF STEP]
apply (drule_tac x="iMin I" in meta_spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. \<lbrakk>I \<noteq> {}; y \<in> h ` I; \<And>y. h (min (iMin I) y) = min (h (iMin I)) (h y)\<rbrakk> \<Longrightarrow> h (iMin I) \<le> y
[PROOF STEP]
apply (clarsimp simp: image_iff, rename_tac x)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>I \<noteq> {}; \<And>y. h (min (iMin I) y) = min (h (iMin I)) (h y); x \<in> I\<rbrakk> \<Longrightarrow> h (iMin I) \<le> h x
[PROOF STEP]
apply (drule_tac x=x in meta_spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>I \<noteq> {}; x \<in> I; h (min (iMin I) x) = min (h (iMin I)) (h x)\<rbrakk> \<Longrightarrow> h (iMin I) \<le> h x
[PROOF STEP]
apply (rule_tac t="h (iMin I)" and s="min (h (iMin I)) (h x)" in subst)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>I \<noteq> {}; x \<in> I; h (min (iMin I) x) = min (h (iMin I)) (h x)\<rbrakk> \<Longrightarrow> min (h (iMin I)) (h x) = h (iMin I)
 2. \<And>x. \<lbrakk>I \<noteq> {}; x \<in> I; h (min (iMin I) x) = min (h (iMin I)) (h x)\<rbrakk> \<Longrightarrow> min (h (iMin I)) (h x) \<le> h x
[PROOF STEP]
apply (simp add: min_eqL[OF iMin_le])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>I \<noteq> {}; x \<in> I; h (min (iMin I) x) = min (h (iMin I)) (h x)\<rbrakk> \<Longrightarrow> min (h (iMin I)) (h x) \<le> h x
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma order_root: "poly p a = 0 \<longleftrightarrow> p = 0 \<or> order a p \<noteq> 0" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly p a = (0::'a)) = (p = 0 \<or> order a p \<noteq> 0)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. poly p a = (0::'a) \<Longrightarrow> p = 0 \<or> order a p \<noteq> 0
 2. p = 0 \<or> order a p \<noteq> 0 \<Longrightarrow> poly p a = (0::'a)
[PROOF STEP]
show "?lhs \<Longrightarrow> ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p a = (0::'a) \<Longrightarrow> p = 0 \<or> order a p \<noteq> 0
[PROOF STEP]
by (metis One_nat_def order_2 poly_eq_0_iff_dvd power_one_right)
[PROOF STATE]
proof (state)
this:
poly p a = (0::'a) \<Longrightarrow> p = 0 \<or> order a p \<noteq> 0

goal (1 subgoal):
 1. p = 0 \<or> order a p \<noteq> 0 \<Longrightarrow> poly p a = (0::'a)
[PROOF STEP]
show "?rhs \<Longrightarrow> ?lhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = 0 \<or> order a p \<noteq> 0 \<Longrightarrow> poly p a = (0::'a)
[PROOF STEP]
by (meson dvd_power dvd_trans neq0_conv order_1 poly_0 poly_eq_0_iff_dvd)
[PROOF STATE]
proof (state)
this:
p = 0 \<or> order a p \<noteq> 0 \<Longrightarrow> poly p a = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bst_joinL:
  "\<lbrakk>bst (Node l (a, n) r); bheight l \<le> bheight r\<rbrakk>
  \<Longrightarrow> bst (joinL l a r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Tree2.bst \<langle>l, (a, n), r\<rangle>; bheight l \<le> bheight r\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l a r)
[PROOF STEP]
proof(induction l a r rule: joinL.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>l x r. \<lbrakk>\<And>x21 x22 x23 xa y. \<lbrakk>\<not> bheight r \<le> bheight l; r = \<langle>x21, x22, x23\<rangle>; (xa, y) = x22; y = Red; Tree2.bst \<langle>l, (x, n), x21\<rangle>; bheight l \<le> bheight x21\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l x x21); \<And>x21 x22 x23 xa y. \<lbrakk>\<not> bheight r \<le> bheight l; r = \<langle>x21, x22, x23\<rangle>; (xa, y) = x22; y = Black; Tree2.bst \<langle>l, (x, n), x21\<rangle>; bheight l \<le> bheight x21\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l x x21); Tree2.bst \<langle>l, (x, n), r\<rangle>; bheight l \<le> bheight r\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l x r)
[PROOF STEP]
case (1 l a r)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<not> bheight r \<le> bheight l; r = \<langle>?x21.0, ?x22.0, ?x23.0\<rangle>; (?xa, ?y) = ?x22.0; ?y = Red; Tree2.bst \<langle>l, (a, n), ?x21.0\<rangle>; bheight l \<le> bheight ?x21.0\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l a ?x21.0)
\<lbrakk>\<not> bheight r \<le> bheight l; r = \<langle>?x21.0, ?x22.0, ?x23.0\<rangle>; (?xa, ?y) = ?x22.0; ?y = Black; Tree2.bst \<langle>l, (a, n), ?x21.0\<rangle>; bheight l \<le> bheight ?x21.0\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l a ?x21.0)
Tree2.bst \<langle>l, (a, n), r\<rangle>
bheight l \<le> bheight r

goal (1 subgoal):
 1. \<And>l x r. \<lbrakk>\<And>x21 x22 x23 xa y. \<lbrakk>\<not> bheight r \<le> bheight l; r = \<langle>x21, x22, x23\<rangle>; (xa, y) = x22; y = Red; Tree2.bst \<langle>l, (x, n), x21\<rangle>; bheight l \<le> bheight x21\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l x x21); \<And>x21 x22 x23 xa y. \<lbrakk>\<not> bheight r \<le> bheight l; r = \<langle>x21, x22, x23\<rangle>; (xa, y) = x22; y = Black; Tree2.bst \<langle>l, (x, n), x21\<rangle>; bheight l \<le> bheight x21\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l x x21); Tree2.bst \<langle>l, (x, n), r\<rangle>; bheight l \<le> bheight r\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l x r)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<not> bheight r \<le> bheight l; r = \<langle>?x21.0, ?x22.0, ?x23.0\<rangle>; (?xa, ?y) = ?x22.0; ?y = Red; Tree2.bst \<langle>l, (a, n), ?x21.0\<rangle>; bheight l \<le> bheight ?x21.0\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l a ?x21.0)
\<lbrakk>\<not> bheight r \<le> bheight l; r = \<langle>?x21.0, ?x22.0, ?x23.0\<rangle>; (?xa, ?y) = ?x22.0; ?y = Black; Tree2.bst \<langle>l, (a, n), ?x21.0\<rangle>; bheight l \<le> bheight ?x21.0\<rbrakk> \<Longrightarrow> Tree2.bst (joinL l a ?x21.0)
Tree2.bst \<langle>l, (a, n), r\<rangle>
bheight l \<le> bheight r

goal (1 subgoal):
 1. Tree2.bst (joinL l a r)
[PROOF STEP]
by(auto simp: set_baliL joinL.simps[of l a r] set_joinL ball_Un intro!: bst_baliL
        split!: tree.splits color.splits)
[PROOF STATE]
proof (state)
this:
Tree2.bst (joinL l a r)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Longest_common_prefix_image_Cons: "L \<noteq> {} \<Longrightarrow>
  Longest_common_prefix ((#) x ` L) = x # Longest_common_prefix L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L \<noteq> {} \<Longrightarrow> Longest_common_prefix ((#) x ` L) = x # Longest_common_prefix L
[PROOF STEP]
apply(rule Longest_common_prefix_eq)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. L \<noteq> {} \<Longrightarrow> (#) x ` L \<noteq> {}
 2. L \<noteq> {} \<Longrightarrow> \<forall>xs\<in>(#) x ` L. prefix (x # Longest_common_prefix L) xs
 3. L \<noteq> {} \<Longrightarrow> \<forall>qs. (\<forall>xs\<in>(#) x ` L. prefix qs xs) \<longrightarrow> length qs \<le> length (x # Longest_common_prefix L)
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. L \<noteq> {} \<Longrightarrow> \<forall>xs\<in>(#) x ` L. prefix (x # Longest_common_prefix L) xs
 2. L \<noteq> {} \<Longrightarrow> \<forall>qs. (\<forall>xs\<in>(#) x ` L. prefix qs xs) \<longrightarrow> length qs \<le> length (x # Longest_common_prefix L)
[PROOF STEP]
apply (simp add: Longest_common_prefix_prefix)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L \<noteq> {} \<Longrightarrow> \<forall>qs. (\<forall>xs\<in>(#) x ` L. prefix qs xs) \<longrightarrow> length qs \<le> length (x # Longest_common_prefix L)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L \<noteq> {} \<Longrightarrow> \<forall>qs. (\<forall>xa\<in>L. prefix qs (x # xa)) \<longrightarrow> length qs \<le> Suc (length (Longest_common_prefix L))
[PROOF STEP]
by(metis Longest_common_prefix_longest[of L] Cons_prefix_Cons Nitpick.size_list_simp(2)
     Suc_le_mono hd_Cons_tl order.strict_implies_order zero_less_Suc)


[STATEMENT]
lemma takeWhile_eq_Nil_dropWhile_eq_Nil_imp_Nil:
  "\<lbrakk> takeWhile P xs = []; dropWhile P xs = [] \<rbrakk> \<Longrightarrow> xs = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>takeWhile P xs = []; dropWhile P xs = []\<rbrakk> \<Longrightarrow> xs = []
[PROOF STEP]
by (metis dropWhile_eq_drop drop_0 list.size(3))


[STATEMENT]
lemma HBL1_iff_prv: "\<phi> \<in> fmla \<Longrightarrow> Fvars \<phi> = {} \<Longrightarrow> prv (PP \<langle>\<phi>\<rangle>) \<longleftrightarrow> prv \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<phi> \<in> fmla; Fvars \<phi> = {}\<rbrakk> \<Longrightarrow> prv (PP \<langle>\<phi>\<rangle>) = prv \<phi>
[PROOF STEP]
by (intro iffI bprv_prv[OF _ _ HBL1_PP], elim HBL1_rev_prv[rotated -1]) auto


[STATEMENT]
lemma ring_finite_field_ops_integer: "ring_ops (finite_field_ops_integer pp) mod_ring_rel_integer"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_ops (finite_field_ops_integer pp) mod_ring_rel_integer
[PROOF STEP]
by (unfold_locales, auto simp:
  finite_field_ops_integer_def
  bi_unique_mod_ring_rel_integer
  right_total_mod_ring_rel_integer
  mod_ring_plus_integer
  mod_ring_minus_integer
  mod_ring_uminus_integer
  mod_ring_mult_integer
  mod_ring_eq_integer
  mod_ring_0__integer
  mod_ring_1__integer
  Domainp_mod_ring_rel_integer)


[STATEMENT]
lemma size_primrec: "size = rec_tree 0 (\<lambda>_ _ _ a b. 1 + a + b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size = rec_tree 0 (\<lambda>_ _ _ a. (+) (1 + a))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. size x = rec_tree 0 (\<lambda>_ _ _ a. (+) (1 + a)) x
[PROOF STEP]
fix t :: "'a tree"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. size x = rec_tree 0 (\<lambda>_ _ _ a. (+) (1 + a)) x
[PROOF STEP]
show "size t = rec_tree 0 (\<lambda>_ _ _ a b. 1 + a + b) t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size t = rec_tree 0 (\<lambda>_ _ _ a. (+) (1 + a)) t
[PROOF STEP]
by (induction t) auto
[PROOF STATE]
proof (state)
this:
size t = rec_tree 0 (\<lambda>_ _ _ a. (+) (1 + a)) t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eq_almost_full_on_finite_set:
  assumes "finite A"
  shows "almost_full_on (=) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. almost_full_on (=) A
[PROOF STEP]
using finite_almost_full_on [OF assms, of "(=)"]
[PROOF STATE]
proof (prove)
using this:
Restricted_Predicates.reflp_on (=) A \<Longrightarrow> almost_full_on (=) A

goal (1 subgoal):
 1. almost_full_on (=) A
[PROOF STEP]
by (auto simp: reflp_on_def)


[STATEMENT]
lemma standard_liouville_sums:
  assumes "q > 1" "range p \<subseteq> {0..<q}"
  shows   "(\<lambda>k. p k / of_int q ^ fact (Suc k)) sums standard_liouville p q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>k. real_of_int (p k) / real_of_int q ^ fact (Suc k)) sums standard_liouville p q
[PROOF STEP]
using standard_liouville_summable[OF assms]
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>k. real_of_int (p k) / real_of_int q ^ fact (Suc k))

goal (1 subgoal):
 1. (\<lambda>k. real_of_int (p k) / real_of_int q ^ fact (Suc k)) sums standard_liouville p q
[PROOF STEP]
unfolding standard_liouville_def
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>k. real_of_int (p k) / real_of_int q ^ fact (Suc k))

goal (1 subgoal):
 1. (\<lambda>k. real_of_int (p k) / real_of_int q ^ fact (Suc k)) sums (\<Sum>k. real_of_int (p k) / real_of_int q ^ fact (Suc k))
[PROOF STEP]
by (simp add: summable_sums)


[STATEMENT]
lemma less_half_sum: "a < b \<Longrightarrow> a < (a+b) / (1+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a < b \<Longrightarrow> a < (a + b) / ((1::'a) + (1::'a))
[PROOF STEP]
by (metis local.add_pos_pos local.add_strict_left_mono local.mult_imp_less_div_pos local.semiring_normalization_rules(4) local.zero_less_one mult_commute)


[STATEMENT]
lemma nn_integral_\<T>:
  fixes f :: "('s \<times> 'a) stream \<Rightarrow> real"
  assumes f[measurable]: "f \<in> borel_measurable S"
  shows "(\<integral>\<^sup>+t. f t \<partial>\<T> p s)
    = \<integral>\<^sup>+a. \<integral>\<^sup>+s'. \<integral>\<^sup>+t'. f ((s,a)##t') \<partial>\<T> (\<pi>_Suc p (s,a)) s' \<partial>K (s,a) \<partial>p [] s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> p s = \<integral>\<^sup>+ a. \<integral>\<^sup>+ s'. \<integral>\<^sup>+ x. ennreal (f ((s, a) ## x)) \<partial>\<T> (\<pi>_Suc p (s, a)) s' \<partial>measure_pmf (K (s, a)) \<partial>measure_pmf (p [] s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> p s = \<integral>\<^sup>+ a. \<integral>\<^sup>+ s'. \<integral>\<^sup>+ x. ennreal (f ((s, a) ## x)) \<partial>\<T> (\<pi>_Suc p (s, a)) s' \<partial>measure_pmf (K (s, a)) \<partial>measure_pmf (p [] s)
[PROOF STEP]
have "(\<integral>\<^sup>+t. f t \<partial>\<T> p s) =
  \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. (f y) \<partial>measure_pmf (K (s, x)) \<bind> (\<lambda>s'. \<T> (\<pi>_Suc p (s, x)) s' \<bind> (\<lambda>w. return S ((s, x) ## w))) \<partial>(p [] s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> p s = \<integral>\<^sup>+ x. \<integral>\<^sup>+ x. ennreal (f x) \<partial>measure_pmf (K (s, x)) \<bind> (\<lambda>s'. \<T> (\<pi>_Suc p (s, x)) s' \<bind> (\<lambda>w. return (stream_space (count_space UNIV)) ((s, x) ## w))) \<partial>measure_pmf (p [] s)
[PROOF STEP]
unfolding \<T>_eq[of p]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>measure_pmf (p [] s) \<bind> (\<lambda>a. measure_pmf (K (s, a)) \<bind> (\<lambda>s'. \<T> (\<pi>_Suc p (s, a)) s' \<bind> (\<lambda>w. return (stream_space (count_space UNIV)) ((s, a) ## w)))) = \<integral>\<^sup>+ x. \<integral>\<^sup>+ x. ennreal (f x) \<partial>measure_pmf (K (s, x)) \<bind> (\<lambda>s'. \<T> (\<pi>_Suc p (s, x)) s' \<bind> (\<lambda>w. return (stream_space (count_space UNIV)) ((s, x) ## w))) \<partial>measure_pmf (p [] s)
[PROOF STEP]
by (subst nn_integral_bind[of _ S])
      (auto intro!: measure_pmf.bind_in_space subprob_space.bind_in_space simp: \<T>_prob_space prob_space_imp_subprob_space)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> p s = \<integral>\<^sup>+ x. \<integral>\<^sup>+ x. ennreal (f x) \<partial>measure_pmf (K (s, x)) \<bind> (\<lambda>s'. \<T> (\<pi>_Suc p (s, x)) s' \<bind> (\<lambda>w. return (stream_space (count_space UNIV)) ((s, x) ## w))) \<partial>measure_pmf (p [] s)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> p s = \<integral>\<^sup>+ a. \<integral>\<^sup>+ s'. \<integral>\<^sup>+ x. ennreal (f ((s, a) ## x)) \<partial>\<T> (\<pi>_Suc p (s, a)) s' \<partial>measure_pmf (K (s, a)) \<partial>measure_pmf (p [] s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> p s = \<integral>\<^sup>+ x. \<integral>\<^sup>+ x. ennreal (f x) \<partial>measure_pmf (K (s, x)) \<bind> (\<lambda>s'. \<T> (\<pi>_Suc p (s, x)) s' \<bind> (\<lambda>w. return (stream_space (count_space UNIV)) ((s, x) ## w))) \<partial>measure_pmf (p [] s)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> p s = \<integral>\<^sup>+ a. \<integral>\<^sup>+ s'. \<integral>\<^sup>+ x. ennreal (f ((s, a) ## x)) \<partial>\<T> (\<pi>_Suc p (s, a)) s' \<partial>measure_pmf (K (s, a)) \<partial>measure_pmf (p [] s)
[PROOF STEP]
have "\<dots> = \<integral>\<^sup>+ x. \<integral>\<^sup>+ xa. \<integral>\<^sup>+ y. (f y) \<partial>\<T> (\<pi>_Suc p (s, x)) xa \<bind> (\<lambda>w. return S ((s, x) ## w))
              \<partial>measure_pmf (K (s, x)) \<partial>(p [] s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. \<integral>\<^sup>+ x. ennreal (f x) \<partial>measure_pmf (K (s, x)) \<bind> (\<lambda>s'. \<T> (\<pi>_Suc p (s, x)) s' \<bind> (\<lambda>w. return (stream_space (count_space UNIV)) ((s, x) ## w))) \<partial>measure_pmf (p [] s) = \<integral>\<^sup>+ x. \<integral>\<^sup>+ xa. \<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> (\<pi>_Suc p (s, x)) xa \<bind> (\<lambda>w. return (stream_space (count_space UNIV)) ((s, x) ## w)) \<partial>measure_pmf (K (s, x)) \<partial>measure_pmf (p [] s)
[PROOF STEP]
by (subst nn_integral_bind[of _ S])
      (auto intro!: subprob_space.bind_in_space simp: \<T>_prob_space prob_space_imp_subprob_space)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. \<integral>\<^sup>+ x. ennreal (f x) \<partial>measure_pmf (K (s, x)) \<bind> (\<lambda>s'. \<T> (\<pi>_Suc p (s, x)) s' \<bind> (\<lambda>w. return (stream_space (count_space UNIV)) ((s, x) ## w))) \<partial>measure_pmf (p [] s) = \<integral>\<^sup>+ x. \<integral>\<^sup>+ xa. \<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> (\<pi>_Suc p (s, x)) xa \<bind> (\<lambda>w. return (stream_space (count_space UNIV)) ((s, x) ## w)) \<partial>measure_pmf (K (s, x)) \<partial>measure_pmf (p [] s)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> p s = \<integral>\<^sup>+ a. \<integral>\<^sup>+ s'. \<integral>\<^sup>+ x. ennreal (f ((s, a) ## x)) \<partial>\<T> (\<pi>_Suc p (s, a)) s' \<partial>measure_pmf (K (s, a)) \<partial>measure_pmf (p [] s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. \<integral>\<^sup>+ x. ennreal (f x) \<partial>measure_pmf (K (s, x)) \<bind> (\<lambda>s'. \<T> (\<pi>_Suc p (s, x)) s' \<bind> (\<lambda>w. return (stream_space (count_space UNIV)) ((s, x) ## w))) \<partial>measure_pmf (p [] s) = \<integral>\<^sup>+ x. \<integral>\<^sup>+ xa. \<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> (\<pi>_Suc p (s, x)) xa \<bind> (\<lambda>w. return (stream_space (count_space UNIV)) ((s, x) ## w)) \<partial>measure_pmf (K (s, x)) \<partial>measure_pmf (p [] s)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> p s = \<integral>\<^sup>+ a. \<integral>\<^sup>+ s'. \<integral>\<^sup>+ x. ennreal (f ((s, a) ## x)) \<partial>\<T> (\<pi>_Suc p (s, a)) s' \<partial>measure_pmf (K (s, a)) \<partial>measure_pmf (p [] s)
[PROOF STEP]
have "\<dots> = \<integral>\<^sup>+ x. \<integral>\<^sup>+ xa. \<integral>\<^sup>+ y. (f y) \<partial>distr (\<T> (\<pi>_Suc p (s, x)) xa) S ((##) (s, x)) \<partial>measure_pmf (K (s, x)) \<partial>(p [] s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. \<integral>\<^sup>+ xa. \<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> (\<pi>_Suc p (s, x)) xa \<bind> (\<lambda>w. return (stream_space (count_space UNIV)) ((s, x) ## w)) \<partial>measure_pmf (K (s, x)) \<partial>measure_pmf (p [] s) = \<integral>\<^sup>+ x. \<integral>\<^sup>+ xa. \<integral>\<^sup>+ x. ennreal (f x) \<partial>distr (\<T> (\<pi>_Suc p (s, x)) xa) (stream_space (count_space UNIV)) ((##) (s, x)) \<partial>measure_pmf (K (s, x)) \<partial>measure_pmf (p [] s)
[PROOF STEP]
by (auto simp add: bind_return_distr' \<T>_prob_space prob_space.not_empty)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. \<integral>\<^sup>+ xa. \<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> (\<pi>_Suc p (s, x)) xa \<bind> (\<lambda>w. return (stream_space (count_space UNIV)) ((s, x) ## w)) \<partial>measure_pmf (K (s, x)) \<partial>measure_pmf (p [] s) = \<integral>\<^sup>+ x. \<integral>\<^sup>+ xa. \<integral>\<^sup>+ x. ennreal (f x) \<partial>distr (\<T> (\<pi>_Suc p (s, x)) xa) (stream_space (count_space UNIV)) ((##) (s, x)) \<partial>measure_pmf (K (s, x)) \<partial>measure_pmf (p [] s)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> p s = \<integral>\<^sup>+ a. \<integral>\<^sup>+ s'. \<integral>\<^sup>+ x. ennreal (f ((s, a) ## x)) \<partial>\<T> (\<pi>_Suc p (s, a)) s' \<partial>measure_pmf (K (s, a)) \<partial>measure_pmf (p [] s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. \<integral>\<^sup>+ xa. \<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> (\<pi>_Suc p (s, x)) xa \<bind> (\<lambda>w. return (stream_space (count_space UNIV)) ((s, x) ## w)) \<partial>measure_pmf (K (s, x)) \<partial>measure_pmf (p [] s) = \<integral>\<^sup>+ x. \<integral>\<^sup>+ xa. \<integral>\<^sup>+ x. ennreal (f x) \<partial>distr (\<T> (\<pi>_Suc p (s, x)) xa) (stream_space (count_space UNIV)) ((##) (s, x)) \<partial>measure_pmf (K (s, x)) \<partial>measure_pmf (p [] s)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> p s = \<integral>\<^sup>+ a. \<integral>\<^sup>+ s'. \<integral>\<^sup>+ x. ennreal (f ((s, a) ## x)) \<partial>\<T> (\<pi>_Suc p (s, a)) s' \<partial>measure_pmf (K (s, a)) \<partial>measure_pmf (p [] s)
[PROOF STEP]
have "\<dots> = \<integral>\<^sup>+ x. \<integral>\<^sup>+ xa. \<integral>\<^sup>+ xa. (f ((s, x) ## xa)) \<partial>\<T> (\<pi>_Suc p (s, x)) xa \<partial>measure_pmf (K (s, x)) \<partial>(p [] s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. \<integral>\<^sup>+ xa. \<integral>\<^sup>+ x. ennreal (f x) \<partial>distr (\<T> (\<pi>_Suc p (s, x)) xa) (stream_space (count_space UNIV)) ((##) (s, x)) \<partial>measure_pmf (K (s, x)) \<partial>measure_pmf (p [] s) = \<integral>\<^sup>+ x. \<integral>\<^sup>+ xa. \<integral>\<^sup>+ xa. ennreal (f ((s, x) ## xa)) \<partial>\<T> (\<pi>_Suc p (s, x)) xa \<partial>measure_pmf (K (s, x)) \<partial>measure_pmf (p [] s)
[PROOF STEP]
by (auto simp: nn_integral_distr)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. \<integral>\<^sup>+ xa. \<integral>\<^sup>+ x. ennreal (f x) \<partial>distr (\<T> (\<pi>_Suc p (s, x)) xa) (stream_space (count_space UNIV)) ((##) (s, x)) \<partial>measure_pmf (K (s, x)) \<partial>measure_pmf (p [] s) = \<integral>\<^sup>+ x. \<integral>\<^sup>+ xa. \<integral>\<^sup>+ xa. ennreal (f ((s, x) ## xa)) \<partial>\<T> (\<pi>_Suc p (s, x)) xa \<partial>measure_pmf (K (s, x)) \<partial>measure_pmf (p [] s)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> p s = \<integral>\<^sup>+ a. \<integral>\<^sup>+ s'. \<integral>\<^sup>+ x. ennreal (f ((s, a) ## x)) \<partial>\<T> (\<pi>_Suc p (s, a)) s' \<partial>measure_pmf (K (s, a)) \<partial>measure_pmf (p [] s)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> p s = \<integral>\<^sup>+ x. \<integral>\<^sup>+ xa. \<integral>\<^sup>+ xa. ennreal (f ((s, x) ## xa)) \<partial>\<T> (\<pi>_Suc p (s, x)) xa \<partial>measure_pmf (K (s, x)) \<partial>measure_pmf (p [] s)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> p s = \<integral>\<^sup>+ x. \<integral>\<^sup>+ xa. \<integral>\<^sup>+ xa. ennreal (f ((s, x) ## xa)) \<partial>\<T> (\<pi>_Suc p (s, x)) xa \<partial>measure_pmf (K (s, x)) \<partial>measure_pmf (p [] s)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> p s = \<integral>\<^sup>+ a. \<integral>\<^sup>+ s'. \<integral>\<^sup>+ x. ennreal (f ((s, a) ## x)) \<partial>\<T> (\<pi>_Suc p (s, a)) s' \<partial>measure_pmf (K (s, a)) \<partial>measure_pmf (p [] s)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (f x) \<partial>\<T> p s = \<integral>\<^sup>+ a. \<integral>\<^sup>+ s'. \<integral>\<^sup>+ x. ennreal (f ((s, a) ## x)) \<partial>\<T> (\<pi>_Suc p (s, a)) s' \<partial>measure_pmf (K (s, a)) \<partial>measure_pmf (p [] s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mat_leqb_eqc_split_simplex_correct2:
  assumes "dim_vec c = dim_row A\<^sup>T"
  assumes "dim_vec b = dim_col A\<^sup>T"
  assumes "simplex (mat_leqb_eqc A b c) = Sat X"
  assumes "(x, y) = split_n_m_x (dim_row A\<^sup>T) (dim_col A\<^sup>T) X"
  shows "[y \<^sub>v* A]=c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [y\<^sub>v*A]=c
[PROOF STEP]
using assms(1) assms(2) assms(3) assms(4) mat_leqb_eqc_split_correct2 simplex(3)
[PROOF STATE]
proof (prove)
using this:
dim_vec c = dim_row A\<^sup>T
dim_vec b = dim_col A\<^sup>T
simplex (mat_leqb_eqc A b c) = Inr X
(x, y) = split_n_m_x (dim_row A\<^sup>T) (dim_col A\<^sup>T) X
\<lbrakk>dim_vec ?c = dim_row ?A\<^sup>T; dim_vec ?b = dim_col ?A\<^sup>T; \<langle>?X\<rangle> \<Turnstile>\<^sub>c\<^sub>s set (mat_leqb_eqc ?A ?b ?c); (?x, ?y) = split_n_m_x (dim_row ?A\<^sup>T) (dim_col ?A\<^sup>T) ?X\<rbrakk> \<Longrightarrow> [?y\<^sub>v*?A]=?c
simplex ?cs = Inr ?v \<Longrightarrow> \<langle>?v\<rangle> \<Turnstile>\<^sub>c\<^sub>s set ?cs

goal (1 subgoal):
 1. [y\<^sub>v*A]=c
[PROOF STEP]
by blast