[STATEMENT]
lemma (in vectorspace) lincomb_isolate:
  fixes A v
  assumes h1: "finite A" and h2: "A\<subseteq>carrier V"  and h3: "a\<in>A\<rightarrow>carrier K" and h4: "v\<in>A"
    and h5: "a v \<noteq> \<zero>\<^bsub>K\<^esub>" and h6: "lincomb a A=\<zero>\<^bsub>V\<^esub>"
  shows "v=lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub>(inv\<^bsub>K\<^esub> (a v)) \<otimes>\<^bsub>K\<^esub> a w) (A-{v})" and "v\<in> span (A-{v})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v}) &&& v \<in> span (A - {v})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v})
 2. v \<in> span (A - {v})
[PROOF STEP]
from h1 h2 h3 h4
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<subseteq> carrier V
a \<in> A \<rightarrow> carrier K
v \<in> A
[PROOF STEP]
have 1: "lincomb a A = ((a v) \<odot>\<^bsub>V\<^esub> v) \<oplus>\<^bsub>V\<^esub> lincomb a (A-{v})"
[PROOF STATE]
proof (prove)
using this:
finite A
A \<subseteq> carrier V
a \<in> A \<rightarrow> carrier K
v \<in> A

goal (1 subgoal):
 1. lincomb a A = a v \<odot>\<^bsub>V\<^esub> v \<oplus>\<^bsub>V\<^esub> lincomb a (A - {v})
[PROOF STEP]
by (rule lincomb_del2)
[PROOF STATE]
proof (state)
this:
lincomb a A = a v \<odot>\<^bsub>V\<^esub> v \<oplus>\<^bsub>V\<^esub> lincomb a (A - {v})

goal (2 subgoals):
 1. v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v})
 2. v \<in> span (A - {v})
[PROOF STEP]
from 1
[PROOF STATE]
proof (chain)
picking this:
lincomb a A = a v \<odot>\<^bsub>V\<^esub> v \<oplus>\<^bsub>V\<^esub> lincomb a (A - {v})
[PROOF STEP]
have 2: "\<zero>\<^bsub>V\<^esub>= ((a v) \<odot>\<^bsub>V\<^esub> v) \<oplus>\<^bsub>V\<^esub> lincomb a (A-{v})"
[PROOF STATE]
proof (prove)
using this:
lincomb a A = a v \<odot>\<^bsub>V\<^esub> v \<oplus>\<^bsub>V\<^esub> lincomb a (A - {v})

goal (1 subgoal):
 1. \<zero>\<^bsub>V\<^esub> = a v \<odot>\<^bsub>V\<^esub> v \<oplus>\<^bsub>V\<^esub> lincomb a (A - {v})
[PROOF STEP]
by (simp add: h6)
[PROOF STATE]
proof (state)
this:
\<zero>\<^bsub>V\<^esub> = a v \<odot>\<^bsub>V\<^esub> v \<oplus>\<^bsub>V\<^esub> lincomb a (A - {v})

goal (2 subgoals):
 1. v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v})
 2. v \<in> span (A - {v})
[PROOF STEP]
from h1 h2 h3
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<subseteq> carrier V
a \<in> A \<rightarrow> carrier K
[PROOF STEP]
have 5: "lincomb a (A-{v}) \<in>carrier V"
[PROOF STATE]
proof (prove)
using this:
finite A
A \<subseteq> carrier V
a \<in> A \<rightarrow> carrier K

goal (1 subgoal):
 1. lincomb a (A - {v}) \<in> carrier V
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lincomb a (A - {v}) \<in> carrier V

goal (2 subgoals):
 1. v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v})
 2. v \<in> span (A - {v})
[PROOF STEP]
(*intro lincomb_closed*)
[PROOF STATE]
proof (state)
this:
lincomb a (A - {v}) \<in> carrier V

goal (2 subgoals):
 1. v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v})
 2. v \<in> span (A - {v})
[PROOF STEP]
from 2 h1 h2 h3 h4
[PROOF STATE]
proof (chain)
picking this:
\<zero>\<^bsub>V\<^esub> = a v \<odot>\<^bsub>V\<^esub> v \<oplus>\<^bsub>V\<^esub> lincomb a (A - {v})
finite A
A \<subseteq> carrier V
a \<in> A \<rightarrow> carrier K
v \<in> A
[PROOF STEP]
have 3: " \<ominus>\<^bsub>V\<^esub> lincomb a (A-{v}) = ((a v) \<odot>\<^bsub>V\<^esub> v)"
[PROOF STATE]
proof (prove)
using this:
\<zero>\<^bsub>V\<^esub> = a v \<odot>\<^bsub>V\<^esub> v \<oplus>\<^bsub>V\<^esub> lincomb a (A - {v})
finite A
A \<subseteq> carrier V
a \<in> A \<rightarrow> carrier K
v \<in> A

goal (1 subgoal):
 1. \<ominus>\<^bsub>V\<^esub> lincomb a (A - {v}) = a v \<odot>\<^bsub>V\<^esub> v
[PROOF STEP]
by (auto intro!: M.minus_equality)
[PROOF STATE]
proof (state)
this:
\<ominus>\<^bsub>V\<^esub> lincomb a (A - {v}) = a v \<odot>\<^bsub>V\<^esub> v

goal (2 subgoals):
 1. v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v})
 2. v \<in> span (A - {v})
[PROOF STEP]
have 6: "v = (\<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> (a v))) \<odot>\<^bsub>V\<^esub> lincomb a (A-{v})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v = \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<odot>\<^bsub>V\<^esub> lincomb a (A - {v})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. v = \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<odot>\<^bsub>V\<^esub> lincomb a (A - {v})
[PROOF STEP]
from h2 h3 h4 h5 3
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> carrier V
a \<in> A \<rightarrow> carrier K
v \<in> A
a v \<noteq> \<zero>\<^bsub>K\<^esub>
\<ominus>\<^bsub>V\<^esub> lincomb a (A - {v}) = a v \<odot>\<^bsub>V\<^esub> v
[PROOF STEP]
have 7: "v = inv\<^bsub>K\<^esub> (a v) \<odot>\<^bsub>V\<^esub> (\<ominus>\<^bsub>V\<^esub> lincomb a (A-{v}))"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> carrier V
a \<in> A \<rightarrow> carrier K
v \<in> A
a v \<noteq> \<zero>\<^bsub>K\<^esub>
\<ominus>\<^bsub>V\<^esub> lincomb a (A - {v}) = a v \<odot>\<^bsub>V\<^esub> v

goal (1 subgoal):
 1. v = inv\<^bsub>K\<^esub> a v \<odot>\<^bsub>V\<^esub> \<ominus>\<^bsub>V\<^esub> lincomb a (A - {v})
[PROOF STEP]
by (intro mult_inverse, auto)
[PROOF STATE]
proof (state)
this:
v = inv\<^bsub>K\<^esub> a v \<odot>\<^bsub>V\<^esub> \<ominus>\<^bsub>V\<^esub> lincomb a (A - {v})

goal (1 subgoal):
 1. v = \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<odot>\<^bsub>V\<^esub> lincomb a (A - {v})
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<subseteq> carrier V
a \<in> A \<rightarrow> carrier K
v \<in> A
a v \<noteq> \<zero>\<^bsub>K\<^esub>
lincomb a A = \<zero>\<^bsub>V\<^esub>
[PROOF STEP]
have 8: "inv\<^bsub>K\<^esub> (a v)\<in>carrier K"
[PROOF STATE]
proof (prove)
using this:
finite A
A \<subseteq> carrier V
a \<in> A \<rightarrow> carrier K
v \<in> A
a v \<noteq> \<zero>\<^bsub>K\<^esub>
lincomb a A = \<zero>\<^bsub>V\<^esub>

goal (1 subgoal):
 1. inv\<^bsub>K\<^esub> a v \<in> carrier K
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inv\<^bsub>K\<^esub> a v \<in> carrier K

goal (1 subgoal):
 1. v = \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<odot>\<^bsub>V\<^esub> lincomb a (A - {v})
[PROOF STEP]
from assms 5 8
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<subseteq> carrier V
a \<in> A \<rightarrow> carrier K
v \<in> A
a v \<noteq> \<zero>\<^bsub>K\<^esub>
lincomb a A = \<zero>\<^bsub>V\<^esub>
lincomb a (A - {v}) \<in> carrier V
inv\<^bsub>K\<^esub> a v \<in> carrier K
[PROOF STEP]
have 9: "inv\<^bsub>K\<^esub> (a v) \<odot>\<^bsub>V\<^esub> (\<ominus>\<^bsub>V\<^esub> lincomb a (A-{v}))
      = (\<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> (a v))) \<odot>\<^bsub>V\<^esub> lincomb a (A-{v})"
[PROOF STATE]
proof (prove)
using this:
finite A
A \<subseteq> carrier V
a \<in> A \<rightarrow> carrier K
v \<in> A
a v \<noteq> \<zero>\<^bsub>K\<^esub>
lincomb a A = \<zero>\<^bsub>V\<^esub>
lincomb a (A - {v}) \<in> carrier V
inv\<^bsub>K\<^esub> a v \<in> carrier K

goal (1 subgoal):
 1. inv\<^bsub>K\<^esub> a v \<odot>\<^bsub>V\<^esub> \<ominus>\<^bsub>V\<^esub> lincomb a (A - {v}) = \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<odot>\<^bsub>V\<^esub> lincomb a (A - {v})
[PROOF STEP]
by (simp add: smult_assoc_simp smult_minus_1_back r_minus)
[PROOF STATE]
proof (state)
this:
inv\<^bsub>K\<^esub> a v \<odot>\<^bsub>V\<^esub> \<ominus>\<^bsub>V\<^esub> lincomb a (A - {v}) = \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<odot>\<^bsub>V\<^esub> lincomb a (A - {v})

goal (1 subgoal):
 1. v = \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<odot>\<^bsub>V\<^esub> lincomb a (A - {v})
[PROOF STEP]
from 7 9
[PROOF STATE]
proof (chain)
picking this:
v = inv\<^bsub>K\<^esub> a v \<odot>\<^bsub>V\<^esub> \<ominus>\<^bsub>V\<^esub> lincomb a (A - {v})
inv\<^bsub>K\<^esub> a v \<odot>\<^bsub>V\<^esub> \<ominus>\<^bsub>V\<^esub> lincomb a (A - {v}) = \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<odot>\<^bsub>V\<^esub> lincomb a (A - {v})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
v = inv\<^bsub>K\<^esub> a v \<odot>\<^bsub>V\<^esub> \<ominus>\<^bsub>V\<^esub> lincomb a (A - {v})
inv\<^bsub>K\<^esub> a v \<odot>\<^bsub>V\<^esub> \<ominus>\<^bsub>V\<^esub> lincomb a (A - {v}) = \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<odot>\<^bsub>V\<^esub> lincomb a (A - {v})

goal (1 subgoal):
 1. v = \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<odot>\<^bsub>V\<^esub> lincomb a (A - {v})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v = \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<odot>\<^bsub>V\<^esub> lincomb a (A - {v})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
v = \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<odot>\<^bsub>V\<^esub> lincomb a (A - {v})

goal (2 subgoals):
 1. v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v})
 2. v \<in> span (A - {v})
[PROOF STEP]
from h1
[PROOF STATE]
proof (chain)
picking this:
finite A
[PROOF STEP]
have 10: "finite (A-{v})"
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. finite (A - {v})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (A - {v})

goal (2 subgoals):
 1. v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v})
 2. v \<in> span (A - {v})
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<subseteq> carrier V
a \<in> A \<rightarrow> carrier K
v \<in> A
a v \<noteq> \<zero>\<^bsub>K\<^esub>
lincomb a A = \<zero>\<^bsub>V\<^esub>
[PROOF STEP]
have 11 : "(\<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> (a v)))\<in> carrier K"
[PROOF STATE]
proof (prove)
using this:
finite A
A \<subseteq> carrier V
a \<in> A \<rightarrow> carrier K
v \<in> A
a v \<noteq> \<zero>\<^bsub>K\<^esub>
lincomb a A = \<zero>\<^bsub>V\<^esub>

goal (1 subgoal):
 1. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<in> carrier K
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<in> carrier K

goal (2 subgoals):
 1. v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v})
 2. v \<in> span (A - {v})
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<subseteq> carrier V
a \<in> A \<rightarrow> carrier K
v \<in> A
a v \<noteq> \<zero>\<^bsub>K\<^esub>
lincomb a A = \<zero>\<^bsub>V\<^esub>
[PROOF STEP]
have 12: "lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub>(inv\<^bsub>K\<^esub> (a v)) \<otimes>\<^bsub>K\<^esub> a w) (A-{v}) =
    (\<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> (a v))) \<odot>\<^bsub>V\<^esub> lincomb a (A-{v})"
[PROOF STATE]
proof (prove)
using this:
finite A
A \<subseteq> carrier V
a \<in> A \<rightarrow> carrier K
v \<in> A
a v \<noteq> \<zero>\<^bsub>K\<^esub>
lincomb a A = \<zero>\<^bsub>V\<^esub>

goal (1 subgoal):
 1. lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v}) = \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<odot>\<^bsub>V\<^esub> lincomb a (A - {v})
[PROOF STEP]
by (intro lincomb_smult, auto)
[PROOF STATE]
proof (state)
this:
lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v}) = \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<odot>\<^bsub>V\<^esub> lincomb a (A - {v})

goal (2 subgoals):
 1. v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v})
 2. v \<in> span (A - {v})
[PROOF STEP]
from 6 12
[PROOF STATE]
proof (chain)
picking this:
v = \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<odot>\<^bsub>V\<^esub> lincomb a (A - {v})
lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v}) = \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<odot>\<^bsub>V\<^esub> lincomb a (A - {v})
[PROOF STEP]
show "v=lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub>(inv\<^bsub>K\<^esub> (a v)) \<otimes>\<^bsub>K\<^esub> a w) (A-{v})"
[PROOF STATE]
proof (prove)
using this:
v = \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<odot>\<^bsub>V\<^esub> lincomb a (A - {v})
lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v}) = \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<odot>\<^bsub>V\<^esub> lincomb a (A - {v})

goal (1 subgoal):
 1. v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v})

goal (1 subgoal):
 1. v \<in> span (A - {v})
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<subseteq> carrier V
a \<in> A \<rightarrow> carrier K
v \<in> A
a v \<noteq> \<zero>\<^bsub>K\<^esub>
lincomb a A = \<zero>\<^bsub>V\<^esub>
v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v})
[PROOF STEP]
show "v\<in> span (A-{v})"
[PROOF STATE]
proof (prove)
using this:
finite A
A \<subseteq> carrier V
a \<in> A \<rightarrow> carrier K
v \<in> A
a v \<noteq> \<zero>\<^bsub>K\<^esub>
lincomb a A = \<zero>\<^bsub>V\<^esub>
v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v})

goal (1 subgoal):
 1. v \<in> span (A - {v})
[PROOF STEP]
unfolding span_def
[PROOF STATE]
proof (prove)
using this:
finite A
A \<subseteq> carrier V
a \<in> A \<rightarrow> carrier K
v \<in> A
a v \<noteq> \<zero>\<^bsub>K\<^esub>
lincomb a A = \<zero>\<^bsub>V\<^esub>
v = lincomb (\<lambda>w. \<ominus>\<^bsub>K\<^esub> (inv\<^bsub>K\<^esub> a v) \<otimes>\<^bsub>K\<^esub> a w) (A - {v})

goal (1 subgoal):
 1. v \<in> {lincomb a Aa |a Aa. finite Aa \<and> Aa \<subseteq> A - {v} \<and> a \<in> Aa \<rightarrow> carrier K}
[PROOF STEP]
by (force simp add: 11 ring_subset_carrier)
[PROOF STATE]
proof (state)
this:
v \<in> span (A - {v})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vector_sub_rdistrib: "((a::'a::ring) - b) *s x = a *s x - b *s x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a - b) *s x = a *s x - b *s x
[PROOF STEP]
by (vector field_simps)


[STATEMENT]
lemma EM_remainder'_Suc_0: "EM_remainder' (Suc 0) f' a b = S - I - (f b - f a) /\<^sub>R 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. EM_remainder' (Suc 0) f' (real_of_int a) (real_of_int b) = S - I - (f (real_of_int b) - f (real_of_int a)) /\<^sub>R 2
[PROOF STEP]
using diff_sum_integral_has_integral_int'
[PROOF STATE]
proof (prove)
using this:
((\<lambda>t. pbernpoly 1 t *\<^sub>R f' t) has_integral S - I - (f (real_of_int b) - f (real_of_int a)) /\<^sub>R 2) {real_of_int a..real_of_int b}

goal (1 subgoal):
 1. EM_remainder' (Suc 0) f' (real_of_int a) (real_of_int b) = S - I - (f (real_of_int b) - f (real_of_int a)) /\<^sub>R 2
[PROOF STEP]
by (simp add: has_integral_iff EM_remainder'_def)


[STATEMENT]
lemma aux_arith1_Gateway7:
  assumes "t2 - t \<le> (2::nat) * d + (t + ((4::nat) + k))"
         and "t2 < t + (3::nat) + k + d"
         and "\<not> t2 - d < (0::nat)"
  shows "t2 - d < t + (3::nat) + k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t2 - d < t + 3 + k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
t2 - t \<le> 2 * d + (t + (4 + k))
t2 < t + 3 + k + d
\<not> t2 - d < 0

goal (1 subgoal):
 1. t2 - d < t + 3 + k
[PROOF STEP]
by arith


[STATEMENT]
lemma decompose_Max:
  assumes A: "A \<subseteq> carrier"
  defines "M \<equiv> Max_wrt_among le A"
  shows   "restrict_relation A le = (\<lambda>x y. x \<in> A \<and> y \<in> M \<or> (y \<notin> M \<and> restrict_relation (A - M) le x y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. restrict_relation A le = (\<lambda>x y. x \<in> A \<and> y \<in> M \<or> y \<notin> M \<and> restrict_relation (A - M) le x y)
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> carrier

goal (1 subgoal):
 1. restrict_relation A le = (\<lambda>x y. x \<in> A \<and> y \<in> M \<or> y \<notin> M \<and> restrict_relation (A - M) le x y)
[PROOF STEP]
by (intro ext) (auto simp: M_def Max_wrt_among_total_preorder
                            restrict_relation_def Int_absorb1 intro: trans)


[STATEMENT]
lemma arith_sum_t2k:
"t + 2 + k = (Suc t) + (Suc k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t + 2 + k = Suc t + Suc k
[PROOF STEP]
by arith


[STATEMENT]
lemma d_IN_lift_source [simp]: "d_IN (lift f) (Inner (source \<Delta>)) = value_flow \<Delta> f + d_IN f (source \<Delta>)" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d_IN (lift f) (Inner (source \<Delta>)) = value_flow \<Delta> f + d_IN f (source \<Delta>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. d_IN (lift f) (Inner (source \<Delta>)) = value_flow \<Delta> f + d_IN f (source \<Delta>)
[PROOF STEP]
have "?lhs = (\<Sum>\<^sup>+ y. lift f (y, Inner (source \<Delta>)) * indicator {SOURCE} y) + (\<Sum>\<^sup>+ y\<in>range Inner. lift f (y, Inner (source \<Delta>)))"
    (is "_ = ?SOURCE + ?rest")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d_IN (lift f) (Inner (source \<Delta>)) = (\<integral>\<^sup>+y\<in>{SOURCE}. lift f (y, Inner (source \<Delta>))\<partial>count_space UNIV) + (\<Sum>\<^sup>+ y\<in>range Inner. lift f (y, Inner (source \<Delta>)))
[PROOF STEP]
unfolding d_IN_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sup>+ x. lift f (x, Inner (source \<Delta>))) = (\<integral>\<^sup>+y\<in>{SOURCE}. lift f (y, Inner (source \<Delta>))\<partial>count_space UNIV) + (\<Sum>\<^sup>+ y\<in>range Inner. lift f (y, Inner (source \<Delta>)))
[PROOF STEP]
apply(subst nn_integral_count_space_indicator, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sup>+ x. lift f (x, Inner (source \<Delta>))) = (\<integral>\<^sup>+y\<in>{SOURCE}. lift f (y, Inner (source \<Delta>))\<partial>count_space UNIV) + (\<integral>\<^sup>+x\<in>range Inner. lift f (x, Inner (source \<Delta>))\<partial>count_space UNIV)
[PROOF STEP]
apply(subst nn_integral_add[symmetric])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (\<lambda>y. lift f (y, Inner (source \<Delta>)) * indicator {SOURCE} y) \<in> borel_measurable (count_space UNIV)
 2. (\<lambda>x. lift f (x, Inner (source \<Delta>)) * indicator (range Inner) x) \<in> borel_measurable (count_space UNIV)
 3. (\<Sum>\<^sup>+ x. lift f (x, Inner (source \<Delta>))) = (\<Sum>\<^sup>+ x. lift f (x, Inner (source \<Delta>)) * indicator {SOURCE} x + lift f (x, Inner (source \<Delta>)) * indicator (range Inner) x)
[PROOF STEP]
apply(auto simp add: AE_count_space max_def not_Inner_conv split: split_indicator intro!: nn_integral_cong)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
d_IN (lift f) (Inner (source \<Delta>)) = (\<integral>\<^sup>+y\<in>{SOURCE}. lift f (y, Inner (source \<Delta>))\<partial>count_space UNIV) + (\<Sum>\<^sup>+ y\<in>range Inner. lift f (y, Inner (source \<Delta>)))

goal (1 subgoal):
 1. d_IN (lift f) (Inner (source \<Delta>)) = value_flow \<Delta> f + d_IN f (source \<Delta>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
d_IN (lift f) (Inner (source \<Delta>)) = (\<integral>\<^sup>+y\<in>{SOURCE}. lift f (y, Inner (source \<Delta>))\<partial>count_space UNIV) + (\<Sum>\<^sup>+ y\<in>range Inner. lift f (y, Inner (source \<Delta>)))

goal (1 subgoal):
 1. d_IN (lift f) (Inner (source \<Delta>)) = value_flow \<Delta> f + d_IN f (source \<Delta>)
[PROOF STEP]
have "?rest = d_IN f (source \<Delta>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sup>+ y\<in>range Inner. lift f (y, Inner (source \<Delta>))) = d_IN f (source \<Delta>)
[PROOF STEP]
by(simp add: nn_integral_count_space_reindex d_IN_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sup>+ y\<in>range Inner. lift f (y, Inner (source \<Delta>))) = d_IN f (source \<Delta>)

goal (1 subgoal):
 1. d_IN (lift f) (Inner (source \<Delta>)) = value_flow \<Delta> f + d_IN f (source \<Delta>)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^sup>+ y\<in>range Inner. lift f (y, Inner (source \<Delta>))) = d_IN f (source \<Delta>)

goal (1 subgoal):
 1. d_IN (lift f) (Inner (source \<Delta>)) = value_flow \<Delta> f + d_IN f (source \<Delta>)
[PROOF STEP]
have "?SOURCE = value_flow \<Delta> f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+y\<in>{SOURCE}. lift f (y, Inner (source \<Delta>))\<partial>count_space UNIV = value_flow \<Delta> f
[PROOF STEP]
by(simp add: max_def one_ennreal_def[symmetric] )
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+y\<in>{SOURCE}. lift f (y, Inner (source \<Delta>))\<partial>count_space UNIV = value_flow \<Delta> f

goal (1 subgoal):
 1. d_IN (lift f) (Inner (source \<Delta>)) = value_flow \<Delta> f + d_IN f (source \<Delta>)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
d_IN (lift f) (Inner (source \<Delta>)) = value_flow \<Delta> f + d_IN f (source \<Delta>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
d_IN (lift f) (Inner (source \<Delta>)) = value_flow \<Delta> f + d_IN f (source \<Delta>)

goal (1 subgoal):
 1. d_IN (lift f) (Inner (source \<Delta>)) = value_flow \<Delta> f + d_IN f (source \<Delta>)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
d_IN (lift f) (Inner (source \<Delta>)) = value_flow \<Delta> f + d_IN f (source \<Delta>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Infinitesimal_hypreal_of_nat_iff:
  "Infinitesimal = {x. \<forall>n. hnorm x < inverse (hypreal_of_nat (Suc n))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Infinitesimal = {x. \<forall>n. hnorm x < inverse (hypreal_of_nat (Suc n))}
[PROOF STEP]
using Infinitesimal_def lemma_Infinitesimal2
[PROOF STATE]
proof (prove)
using this:
Infinitesimal = {x. \<forall>r\<in>\<real>. 0 < r \<longrightarrow> hnorm x < r}
(\<forall>r\<in>\<real>. 0 < r \<longrightarrow> ?x < r) = (\<forall>n. ?x < inverse (hypreal_of_nat (Suc n)))

goal (1 subgoal):
 1. Infinitesimal = {x. \<forall>n. hnorm x < inverse (hypreal_of_nat (Suc n))}
[PROOF STEP]
by auto


[STATEMENT]
lemma after_summary_Diff: "after_summary (M - N) S = after_summary M S - after_summary N S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. after_summary (M - N) S = after_summary M S - after_summary N S
[PROOF STEP]
by (simp add: sum_subtractf after_summary_def)


[STATEMENT]
lemma tensor_ell2_inner_prod[simp]: \<open>tensor_ell2 a b \<bullet>\<^sub>C tensor_ell2 c d = (a \<bullet>\<^sub>C c) * (b \<bullet>\<^sub>C d)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<otimes>\<^sub>s b) \<bullet>\<^sub>C (c \<otimes>\<^sub>s d) = a \<bullet>\<^sub>C c * (b \<bullet>\<^sub>C d)
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b c d. \<lbrakk>has_ell2_norm a; has_ell2_norm b; has_ell2_norm c; has_ell2_norm d\<rbrakk> \<Longrightarrow> (\<Sum>\<^sub>\<infinity>i. cnj (case i of (i, j) \<Rightarrow> a i * b j) * (case i of (i, j) \<Rightarrow> c i * d j)) = (\<Sum>\<^sub>\<infinity>i. cnj (a i) * c i) * (\<Sum>\<^sub>\<infinity>i. cnj (b i) * d i)
[PROOF STEP]
by (auto simp: case_prod_beta sum_product sum.cartesian_product mult.assoc mult.left_commute)


[STATEMENT]
lemma coprod_qbs_correct: "Rep_quasi_borel (coprod_qbs I X) = (SIGMA i:I. qbs_space (X i), coprod_qbs_Mx I X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_quasi_borel (coprod_qbs I X) = (SIGMA i:I. qbs_space (X i), coprod_qbs_Mx I X)
[PROOF STEP]
unfolding coprod_qbs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_quasi_borel (Abs_quasi_borel (SIGMA i:I. qbs_space (X i), coprod_qbs_Mx I X)) = (SIGMA i:I. qbs_space (X i), coprod_qbs_Mx I X)
[PROOF STEP]
using is_quasi_borel_intro[OF coprod_qbs_f coprod_qbs_closed1 coprod_qbs_closed2 coprod_qbs_closed3]
[PROOF STATE]
proof (prove)
using this:
is_quasi_borel (SIGMA i:?I1. qbs_space (?X1 i)) (coprod_qbs_Mx ?I1 ?X1)

goal (1 subgoal):
 1. Rep_quasi_borel (Abs_quasi_borel (SIGMA i:I. qbs_space (X i), coprod_qbs_Mx I X)) = (SIGMA i:I. qbs_space (X i), coprod_qbs_Mx I X)
[PROOF STEP]
by(fastforce intro!: Abs_quasi_borel_inverse)


[STATEMENT]
lemma pderiv_var_pow:
  assumes "n > (0::nat)"
  assumes "subring K R"
  shows "pderiv (X [^]\<^bsub>K[X]\<^esub> n) =
    int_embed (K[X]) n \<otimes>\<^bsub>K[X]\<^esub> X [^]\<^bsub>K[X]\<^esub> (n-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pderiv (X [^]\<^bsub>K [X]\<^esub> n) = int_embed (K [X]) (int n) \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> (n - 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pderiv (X [^]\<^bsub>K [X]\<^esub> n) = int_embed (K [X]) (int n) \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> (n - 1)
[PROOF STEP]
interpret p: cring "(K[X])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cring (K [X])
[PROOF STEP]
using univ_poly_is_cring[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
cring (K [X])

goal (1 subgoal):
 1. cring (K [X])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pderiv (X [^]\<^bsub>K [X]\<^esub> n) = int_embed (K [X]) (int n) \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> (n - 1)
[PROOF STEP]
have [simp]: "int_embed (K[X]) i \<in> carrier (K[X])" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int_embed (K [X]) i \<in> carrier (K [X])
[PROOF STEP]
using p.int_embed_range[OF p.carrier_is_subring]
[PROOF STATE]
proof (prove)
using this:
int_embed (K [X]) ?k \<in> carrier (K [X])

goal (1 subgoal):
 1. int_embed (K [X]) i \<in> carrier (K [X])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int_embed (K [X]) ?i \<in> carrier (K [X])

goal (1 subgoal):
 1. pderiv (X [^]\<^bsub>K [X]\<^esub> n) = int_embed (K [X]) (int n) \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> (n - 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pderiv (X [^]\<^bsub>K [X]\<^esub> n) = int_embed (K [X]) (int n) \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> (n - 1)
[PROOF STEP]
using var_closed[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
X \<in> carrier (K [X])
polynomial K X

goal (1 subgoal):
 1. pderiv (X [^]\<^bsub>K [X]\<^esub> n) = int_embed (K [X]) (int n) \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> (n - 1)
[PROOF STEP]
using pderiv_var[where K="K"] pderiv_carr[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
X \<in> carrier (K [X])
polynomial K X
pderiv X = \<one>\<^bsub>K [X]\<^esub>
?f \<in> carrier (K [X]) \<Longrightarrow> pderiv ?f \<in> carrier (K [X])

goal (1 subgoal):
 1. pderiv (X [^]\<^bsub>K [X]\<^esub> n) = int_embed (K [X]) (int n) \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> (n - 1)
[PROOF STEP]
by (subst pderiv_pow[OF assms(1,2)], simp_all)
[PROOF STATE]
proof (state)
this:
pderiv (X [^]\<^bsub>K [X]\<^esub> n) = int_embed (K [X]) (int n) \<otimes>\<^bsub>K [X]\<^esub> X [^]\<^bsub>K [X]\<^esub> (n - 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nth_rest_power_bin: "(bit :: int \<Rightarrow> nat \<Rightarrow> bool) (((\<lambda>k::int. k div 2) ^^ k) w) n = (bit :: int \<Rightarrow> nat \<Rightarrow> bool) w (n + k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit (((\<lambda>k. k div 2) ^^ k) w) n = bit w (n + k)
[PROOF STEP]
apply (induct k arbitrary: n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. bit (((\<lambda>k. k div 2) ^^ 0) w) n = bit w (n + 0)
 2. \<And>k n. (\<And>n. bit (((\<lambda>k. k div 2) ^^ k) w) n = bit w (n + k)) \<Longrightarrow> bit (((\<lambda>k. k div 2) ^^ Suc k) w) n = bit w (n + Suc k)
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k n. (\<And>n. bit (((\<lambda>k. k div 2) ^^ k) w) n = bit w (n + k)) \<Longrightarrow> bit (((\<lambda>k. k div 2) ^^ Suc k) w) n = bit w (n + Suc k)
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k n. (\<And>n. bit (((\<lambda>k. k div 2) ^^ k) w) n = bit w (n + k)) \<Longrightarrow> bit (((\<lambda>k. k div 2) ^^ k) w div 2) n = bit w (Suc (n + k))
[PROOF STEP]
apply (simp only: bit_Suc [symmetric] add_Suc)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem adjugate_mult_det: "adjugate A * A = diag (det A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjugate A * A = diag (Square_Matrix.det A)
[PROOF STEP]
proof (intro to_fun_inject[THEN iffD1] fun_eq_iff[THEN iffD2] allI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xa. to_fun (adjugate A * A) x xa = to_fun (diag (Square_Matrix.det A)) x xa
[PROOF STEP]
fix i k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xa. to_fun (adjugate A * A) x xa = to_fun (diag (Square_Matrix.det A)) x xa
[PROOF STEP]
have "to_fun (adjugate A * A) i k = (\<Sum>j\<in>UNIV. to_fun A j k * det (minor A j i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_fun (adjugate A * A) i k = (\<Sum>j\<in>UNIV. to_fun A j k * Square_Matrix.det (minor A j i))
[PROOF STEP]
by (simp add: adjugate_def times_sq_matrix.rep_eq transpose.rep_eq cofactor_def mult.commute of_fun_inverse)
[PROOF STATE]
proof (state)
this:
to_fun (adjugate A * A) i k = (\<Sum>j\<in>UNIV. to_fun A j k * Square_Matrix.det (minor A j i))

goal (1 subgoal):
 1. \<And>x xa. to_fun (adjugate A * A) x xa = to_fun (diag (Square_Matrix.det A)) x xa
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
to_fun (adjugate A * A) i k = (\<Sum>j\<in>UNIV. to_fun A j k * Square_Matrix.det (minor A j i))

goal (1 subgoal):
 1. \<And>x xa. to_fun (adjugate A * A) x xa = to_fun (diag (Square_Matrix.det A)) x xa
[PROOF STEP]
have "\<dots> = det (upd_col A i (\<Sum>j\<in>UNIV. to_fun A j k *s axis j 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<in>UNIV. to_fun A j k * Square_Matrix.det (minor A j i)) = Square_Matrix.det (upd_col A i (\<Sum>j\<in>UNIV. to_fun A j k *s axis j (1::'a)))
[PROOF STEP]
by (simp add: det_minor_col det_col_mul det_col_sum)
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>UNIV. to_fun A j k * Square_Matrix.det (minor A j i)) = Square_Matrix.det (upd_col A i (\<Sum>j\<in>UNIV. to_fun A j k *s axis j (1::'a)))

goal (1 subgoal):
 1. \<And>x xa. to_fun (adjugate A * A) x xa = to_fun (diag (Square_Matrix.det A)) x xa
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>UNIV. to_fun A j k * Square_Matrix.det (minor A j i)) = Square_Matrix.det (upd_col A i (\<Sum>j\<in>UNIV. to_fun A j k *s axis j (1::'a)))

goal (1 subgoal):
 1. \<And>x xa. to_fun (adjugate A * A) x xa = to_fun (diag (Square_Matrix.det A)) x xa
[PROOF STEP]
have "(\<Sum>j\<in>UNIV. to_fun A j k *s axis j 1) = col A k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<in>UNIV. to_fun A j k *s axis j (1::'a)) = col A k
[PROOF STEP]
by transfer (simp add: smult_axis vec_eq_iff, simp add: axis_def sum.If_cases)
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>UNIV. to_fun A j k *s axis j (1::'a)) = col A k

goal (1 subgoal):
 1. \<And>x xa. to_fun (adjugate A * A) x xa = to_fun (diag (Square_Matrix.det A)) x xa
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>UNIV. to_fun A j k *s axis j (1::'a)) = col A k

goal (1 subgoal):
 1. \<And>x xa. to_fun (adjugate A * A) x xa = to_fun (diag (Square_Matrix.det A)) x xa
[PROOF STEP]
have "det (upd_col A i (col A k)) = (if i = k then det A else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Square_Matrix.det (upd_col A i (col A k)) = (if i = k then Square_Matrix.det A else (0::'a))
[PROOF STEP]
by (auto simp: col_upd_col_If det_identical_cols[of i k])
[PROOF STATE]
proof (state)
this:
Square_Matrix.det (upd_col A i (col A k)) = (if i = k then Square_Matrix.det A else (0::'a))

goal (1 subgoal):
 1. \<And>x xa. to_fun (adjugate A * A) x xa = to_fun (diag (Square_Matrix.det A)) x xa
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Square_Matrix.det (upd_col A i (col A k)) = (if i = k then Square_Matrix.det A else (0::'a))

goal (1 subgoal):
 1. \<And>x xa. to_fun (adjugate A * A) x xa = to_fun (diag (Square_Matrix.det A)) x xa
[PROOF STEP]
have "\<dots> = to_fun (diag (det A)) i k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if i = k then Square_Matrix.det A else (0::'a)) = to_fun (diag (Square_Matrix.det A)) i k
[PROOF STEP]
by (simp add: diag.rep_eq)
[PROOF STATE]
proof (state)
this:
(if i = k then Square_Matrix.det A else (0::'a)) = to_fun (diag (Square_Matrix.det A)) i k

goal (1 subgoal):
 1. \<And>x xa. to_fun (adjugate A * A) x xa = to_fun (diag (Square_Matrix.det A)) x xa
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
to_fun (adjugate A * A) i k = to_fun (diag (Square_Matrix.det A)) i k
[PROOF STEP]
show "to_fun (adjugate A * A) i k = to_fun (diag (det A)) i k"
[PROOF STATE]
proof (prove)
using this:
to_fun (adjugate A * A) i k = to_fun (diag (Square_Matrix.det A)) i k

goal (1 subgoal):
 1. to_fun (adjugate A * A) i k = to_fun (diag (Square_Matrix.det A)) i k
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
to_fun (adjugate A * A) i k = to_fun (diag (Square_Matrix.det A)) i k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma [code_unfold]: "dist (f::'a::finite \<Rightarrow>\<^sub>b 'b::metric_space) g = (MAX a. dist (apply_bfun f a) (g a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist f g = (MAX a. dist (apply_bfun f a) (apply_bfun g a))
[PROOF STEP]
by (auto simp: dist_bfun_def cSup_eq_Max)


[STATEMENT]
lemma "(\<forall>x y z. R(x,y) \<and> R(y,z) \<longrightarrow> R(x,z)) \<and>
       (\<forall>x. \<exists>y. R(x,y)) \<longrightarrow>
       \<not> (\<forall>x. P x = (\<forall>y. R(x,y) \<longrightarrow> \<not> P y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x y z. R (x, y) \<and> R (y, z) \<longrightarrow> R (x, z)) \<and> (\<forall>x. \<exists>y. R (x, y)) \<longrightarrow> \<not> (\<forall>x. P x = (\<forall>y. R (x, y) \<longrightarrow> \<not> P y))
[PROOF STEP]
by (tactic\<open>Meson.safe_best_meson_tac \<^context> 1\<close>)
    \<comment> \<open>In contrast, \<open>meson\<close> is SLOW: 7.6s on griffon\<close>


[STATEMENT]
lemma poly_mult_l_distr':
  assumes "set p1 \<subseteq> carrier R" "set p2 \<subseteq> carrier R" "set p3 \<subseteq> carrier R"
  shows "poly_mult (poly_add p1 p2) p3 = poly_add (poly_mult p1 p3) (poly_mult p2 p3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mult (poly_add p1 p2) p3 = poly_add (poly_mult p1 p3) (poly_mult p2 p3)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_mult (poly_add p1 p2) p3 = poly_add (poly_mult p1 p3) (poly_mult p2 p3)
[PROOF STEP]
let ?c1 = "coeff p1" and ?c2 = "coeff p2" and ?c3 = "coeff p3"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_mult (poly_add p1 p2) p3 = poly_add (poly_mult p1 p3) (poly_mult p2 p3)
[PROOF STEP]
have in_carrier:
    "\<And>i. ?c1 i \<in> carrier R" "\<And>i. ?c2 i \<in> carrier R" "\<And>i. ?c3 i \<in> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. local.coeff p1 i \<in> carrier R) &&& (\<And>i. local.coeff p2 i \<in> carrier R) &&& (\<And>i. local.coeff p3 i \<in> carrier R)
[PROOF STEP]
using assms coeff_in_carrier
[PROOF STATE]
proof (prove)
using this:
set p1 \<subseteq> carrier R
set p2 \<subseteq> carrier R
set p3 \<subseteq> carrier R
set ?p \<subseteq> carrier R \<Longrightarrow> local.coeff ?p ?i \<in> carrier R

goal (1 subgoal):
 1. (\<And>i. local.coeff p1 i \<in> carrier R) &&& (\<And>i. local.coeff p2 i \<in> carrier R) &&& (\<And>i. local.coeff p3 i \<in> carrier R)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.coeff p1 ?i \<in> carrier R
local.coeff p2 ?i \<in> carrier R
local.coeff p3 ?i \<in> carrier R

goal (1 subgoal):
 1. poly_mult (poly_add p1 p2) p3 = poly_add (poly_mult p1 p3) (poly_mult p2 p3)
[PROOF STEP]
have "coeff (poly_mult (poly_add p1 p2) p3) = (\<lambda>n. \<Oplus>i \<in> {..n}. (?c1 i \<oplus> ?c2 i) \<otimes> ?c3 (n - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.coeff (poly_mult (poly_add p1 p2) p3) = (\<lambda>n. \<Oplus>i\<in>{..n}. (local.coeff p1 i \<oplus> local.coeff p2 i) \<otimes> local.coeff p3 (n - i))
[PROOF STEP]
using poly_mult_coeff[of "poly_add p1 p2" p3]  poly_add_coeff[OF assms(1-2)]
          poly_add_in_carrier[OF assms(1-2)] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set (poly_add p1 p2) \<subseteq> carrier R; set p3 \<subseteq> carrier R\<rbrakk> \<Longrightarrow> local.coeff (poly_mult (poly_add p1 p2) p3) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff (poly_add p1 p2) k \<otimes> local.coeff p3 (i - k))
local.coeff (poly_add p1 p2) = (\<lambda>i. local.coeff p1 i \<oplus> local.coeff p2 i)
set (poly_add p1 p2) \<subseteq> carrier R
set p1 \<subseteq> carrier R
set p2 \<subseteq> carrier R
set p3 \<subseteq> carrier R

goal (1 subgoal):
 1. local.coeff (poly_mult (poly_add p1 p2) p3) = (\<lambda>n. \<Oplus>i\<in>{..n}. (local.coeff p1 i \<oplus> local.coeff p2 i) \<otimes> local.coeff p3 (n - i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.coeff (poly_mult (poly_add p1 p2) p3) = (\<lambda>n. \<Oplus>i\<in>{..n}. (local.coeff p1 i \<oplus> local.coeff p2 i) \<otimes> local.coeff p3 (n - i))

goal (1 subgoal):
 1. poly_mult (poly_add p1 p2) p3 = poly_add (poly_mult p1 p3) (poly_mult p2 p3)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
local.coeff (poly_mult (poly_add p1 p2) p3) = (\<lambda>n. \<Oplus>i\<in>{..n}. (local.coeff p1 i \<oplus> local.coeff p2 i) \<otimes> local.coeff p3 (n - i))

goal (1 subgoal):
 1. poly_mult (poly_add p1 p2) p3 = poly_add (poly_mult p1 p3) (poly_mult p2 p3)
[PROOF STEP]
have " ... = (\<lambda>n. \<Oplus>i \<in> {..n}. (?c1 i \<otimes> ?c3 (n - i)) \<oplus> (?c2 i \<otimes> ?c3 (n - i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Oplus>i\<in>{..n}. (local.coeff p1 i \<oplus> local.coeff p2 i) \<otimes> local.coeff p3 (n - i)) = (\<lambda>n. \<Oplus>i\<in>{..n}. local.coeff p1 i \<otimes> local.coeff p3 (n - i) \<oplus> local.coeff p2 i \<otimes> local.coeff p3 (n - i))
[PROOF STEP]
using in_carrier l_distr
[PROOF STATE]
proof (prove)
using this:
local.coeff p1 ?i \<in> carrier R
local.coeff p2 ?i \<in> carrier R
local.coeff p3 ?i \<in> carrier R
\<lbrakk>?x \<in> carrier R; ?y \<in> carrier R; ?z \<in> carrier R\<rbrakk> \<Longrightarrow> (?x \<oplus> ?y) \<otimes> ?z = ?x \<otimes> ?z \<oplus> ?y \<otimes> ?z

goal (1 subgoal):
 1. (\<lambda>n. \<Oplus>i\<in>{..n}. (local.coeff p1 i \<oplus> local.coeff p2 i) \<otimes> local.coeff p3 (n - i)) = (\<lambda>n. \<Oplus>i\<in>{..n}. local.coeff p1 i \<otimes> local.coeff p3 (n - i) \<oplus> local.coeff p2 i \<otimes> local.coeff p3 (n - i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Oplus>i\<in>{..n}. (local.coeff p1 i \<oplus> local.coeff p2 i) \<otimes> local.coeff p3 (n - i)) = (\<lambda>n. \<Oplus>i\<in>{..n}. local.coeff p1 i \<otimes> local.coeff p3 (n - i) \<oplus> local.coeff p2 i \<otimes> local.coeff p3 (n - i))

goal (1 subgoal):
 1. poly_mult (poly_add p1 p2) p3 = poly_add (poly_mult p1 p3) (poly_mult p2 p3)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Oplus>i\<in>{..n}. (local.coeff p1 i \<oplus> local.coeff p2 i) \<otimes> local.coeff p3 (n - i)) = (\<lambda>n. \<Oplus>i\<in>{..n}. local.coeff p1 i \<otimes> local.coeff p3 (n - i) \<oplus> local.coeff p2 i \<otimes> local.coeff p3 (n - i))

goal (1 subgoal):
 1. poly_mult (poly_add p1 p2) p3 = poly_add (poly_mult p1 p3) (poly_mult p2 p3)
[PROOF STEP]
have " ... = (\<lambda>n. (\<Oplus>i \<in> {..n}. (?c1 i \<otimes> ?c3 (n - i))) \<oplus> (\<Oplus>i \<in> {..n}. (?c2 i \<otimes> ?c3 (n - i))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Oplus>i\<in>{..n}. local.coeff p1 i \<otimes> local.coeff p3 (n - i) \<oplus> local.coeff p2 i \<otimes> local.coeff p3 (n - i)) = (\<lambda>n. (\<Oplus>i\<in>{..n}. local.coeff p1 i \<otimes> local.coeff p3 (n - i)) \<oplus> (\<Oplus>i\<in>{..n}. local.coeff p2 i \<otimes> local.coeff p3 (n - i)))
[PROOF STEP]
using add.finprod_multf in_carrier
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f \<in> ?A \<rightarrow> carrier R; ?g \<in> ?A \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> (\<Oplus>x\<in>?A. ?f x \<oplus> ?g x) = finsum R ?f ?A \<oplus> finsum R ?g ?A
local.coeff p1 ?i \<in> carrier R
local.coeff p2 ?i \<in> carrier R
local.coeff p3 ?i \<in> carrier R

goal (1 subgoal):
 1. (\<lambda>n. \<Oplus>i\<in>{..n}. local.coeff p1 i \<otimes> local.coeff p3 (n - i) \<oplus> local.coeff p2 i \<otimes> local.coeff p3 (n - i)) = (\<lambda>n. (\<Oplus>i\<in>{..n}. local.coeff p1 i \<otimes> local.coeff p3 (n - i)) \<oplus> (\<Oplus>i\<in>{..n}. local.coeff p2 i \<otimes> local.coeff p3 (n - i)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Oplus>i\<in>{..n}. local.coeff p1 i \<otimes> local.coeff p3 (n - i) \<oplus> local.coeff p2 i \<otimes> local.coeff p3 (n - i)) = (\<lambda>n. (\<Oplus>i\<in>{..n}. local.coeff p1 i \<otimes> local.coeff p3 (n - i)) \<oplus> (\<Oplus>i\<in>{..n}. local.coeff p2 i \<otimes> local.coeff p3 (n - i)))

goal (1 subgoal):
 1. poly_mult (poly_add p1 p2) p3 = poly_add (poly_mult p1 p3) (poly_mult p2 p3)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Oplus>i\<in>{..n}. local.coeff p1 i \<otimes> local.coeff p3 (n - i) \<oplus> local.coeff p2 i \<otimes> local.coeff p3 (n - i)) = (\<lambda>n. (\<Oplus>i\<in>{..n}. local.coeff p1 i \<otimes> local.coeff p3 (n - i)) \<oplus> (\<Oplus>i\<in>{..n}. local.coeff p2 i \<otimes> local.coeff p3 (n - i)))

goal (1 subgoal):
 1. poly_mult (poly_add p1 p2) p3 = poly_add (poly_mult p1 p3) (poly_mult p2 p3)
[PROOF STEP]
have " ... = coeff (poly_add (poly_mult p1 p3) (poly_mult p2 p3))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (\<Oplus>i\<in>{..n}. local.coeff p1 i \<otimes> local.coeff p3 (n - i)) \<oplus> (\<Oplus>i\<in>{..n}. local.coeff p2 i \<otimes> local.coeff p3 (n - i))) = local.coeff (poly_add (poly_mult p1 p3) (poly_mult p2 p3))
[PROOF STEP]
using poly_mult_coeff[OF assms(1) assms(3)] poly_mult_coeff[OF assms(2-3)]
          poly_add_coeff[OF poly_mult_in_carrier[OF assms(1) assms(3)]]
                            poly_mult_in_carrier[OF assms(2-3)]
[PROOF STATE]
proof (prove)
using this:
local.coeff (poly_mult p1 p3) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p1 k \<otimes> local.coeff p3 (i - k))
local.coeff (poly_mult p2 p3) = (\<lambda>i. \<Oplus>k\<in>{..i}. local.coeff p2 k \<otimes> local.coeff p3 (i - k))
set ?p2.0 \<subseteq> carrier R \<Longrightarrow> local.coeff (poly_add (poly_mult p1 p3) ?p2.0) = (\<lambda>i. local.coeff (poly_mult p1 p3) i \<oplus> local.coeff ?p2.0 i)
set (poly_mult p2 p3) \<subseteq> carrier R

goal (1 subgoal):
 1. (\<lambda>n. (\<Oplus>i\<in>{..n}. local.coeff p1 i \<otimes> local.coeff p3 (n - i)) \<oplus> (\<Oplus>i\<in>{..n}. local.coeff p2 i \<otimes> local.coeff p3 (n - i))) = local.coeff (poly_add (poly_mult p1 p3) (poly_mult p2 p3))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (\<Oplus>i\<in>{..n}. local.coeff p1 i \<otimes> local.coeff p3 (n - i)) \<oplus> (\<Oplus>i\<in>{..n}. local.coeff p2 i \<otimes> local.coeff p3 (n - i))) = local.coeff (poly_add (poly_mult p1 p3) (poly_mult p2 p3))

goal (1 subgoal):
 1. poly_mult (poly_add p1 p2) p3 = poly_add (poly_mult p1 p3) (poly_mult p2 p3)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
local.coeff (poly_mult (poly_add p1 p2) p3) = local.coeff (poly_add (poly_mult p1 p3) (poly_mult p2 p3))
[PROOF STEP]
have "coeff (poly_mult (poly_add p1 p2) p3) =
                coeff (poly_add (poly_mult p1 p3) (poly_mult p2 p3))"
[PROOF STATE]
proof (prove)
using this:
local.coeff (poly_mult (poly_add p1 p2) p3) = local.coeff (poly_add (poly_mult p1 p3) (poly_mult p2 p3))

goal (1 subgoal):
 1. local.coeff (poly_mult (poly_add p1 p2) p3) = local.coeff (poly_add (poly_mult p1 p3) (poly_mult p2 p3))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
local.coeff (poly_mult (poly_add p1 p2) p3) = local.coeff (poly_add (poly_mult p1 p3) (poly_mult p2 p3))

goal (1 subgoal):
 1. poly_mult (poly_add p1 p2) p3 = poly_add (poly_mult p1 p3) (poly_mult p2 p3)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
local.coeff (poly_mult (poly_add p1 p2) p3) = local.coeff (poly_add (poly_mult p1 p3) (poly_mult p2 p3))

goal (1 subgoal):
 1. poly_mult (poly_add p1 p2) p3 = poly_add (poly_mult p1 p3) (poly_mult p2 p3)
[PROOF STEP]
have "polynomial (carrier R) (poly_mult (poly_add p1 p2) p3)"
            and "polynomial (carrier R) (poly_add (poly_mult p1 p3) (poly_mult p2 p3))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. polynomial (carrier R) (poly_mult (poly_add p1 p2) p3) &&& polynomial (carrier R) (poly_add (poly_mult p1 p3) (poly_mult p2 p3))
[PROOF STEP]
using assms poly_add_is_polynomial poly_mult_is_polynomial polynomial_in_carrier
          carrier_is_subring
[PROOF STATE]
proof (prove)
using this:
set p1 \<subseteq> carrier R
set p2 \<subseteq> carrier R
set p3 \<subseteq> carrier R
\<lbrakk>subring ?K R; set ?p1.0 \<subseteq> ?K; set ?p2.0 \<subseteq> ?K\<rbrakk> \<Longrightarrow> polynomial ?K (poly_add ?p1.0 ?p2.0)
\<lbrakk>subring ?K R; set ?p1.0 \<subseteq> ?K; set ?p2.0 \<subseteq> ?K\<rbrakk> \<Longrightarrow> polynomial ?K (poly_mult ?p1.0 ?p2.0)
\<lbrakk>subring ?K R; polynomial ?K ?p\<rbrakk> \<Longrightarrow> set ?p \<subseteq> carrier R
subring (carrier R) R

goal (1 subgoal):
 1. polynomial (carrier R) (poly_mult (poly_add p1 p2) p3) &&& polynomial (carrier R) (poly_add (poly_mult p1 p3) (poly_mult p2 p3))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
polynomial (carrier R) (poly_mult (poly_add p1 p2) p3)
polynomial (carrier R) (poly_add (poly_mult p1 p3) (poly_mult p2 p3))

goal (1 subgoal):
 1. poly_mult (poly_add p1 p2) p3 = poly_add (poly_mult p1 p3) (poly_mult p2 p3)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
local.coeff (poly_mult (poly_add p1 p2) p3) = local.coeff (poly_add (poly_mult p1 p3) (poly_mult p2 p3))
polynomial (carrier R) (poly_mult (poly_add p1 p2) p3)
polynomial (carrier R) (poly_add (poly_mult p1 p3) (poly_mult p2 p3))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
local.coeff (poly_mult (poly_add p1 p2) p3) = local.coeff (poly_add (poly_mult p1 p3) (poly_mult p2 p3))
polynomial (carrier R) (poly_mult (poly_add p1 p2) p3)
polynomial (carrier R) (poly_add (poly_mult p1 p3) (poly_mult p2 p3))

goal (1 subgoal):
 1. poly_mult (poly_add p1 p2) p3 = poly_add (poly_mult p1 p3) (poly_mult p2 p3)
[PROOF STEP]
using coeff_iff_polynomial_cond
[PROOF STATE]
proof (prove)
using this:
local.coeff (poly_mult (poly_add p1 p2) p3) = local.coeff (poly_add (poly_mult p1 p3) (poly_mult p2 p3))
polynomial (carrier R) (poly_mult (poly_add p1 p2) p3)
polynomial (carrier R) (poly_add (poly_mult p1 p3) (poly_mult p2 p3))
\<lbrakk>polynomial ?K ?p1.0; polynomial ?K ?p2.0\<rbrakk> \<Longrightarrow> (?p1.0 = ?p2.0) = (local.coeff ?p1.0 = local.coeff ?p2.0)

goal (1 subgoal):
 1. poly_mult (poly_add p1 p2) p3 = poly_add (poly_mult p1 p3) (poly_mult p2 p3)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly_mult (poly_add p1 p2) p3 = poly_add (poly_mult p1 p3) (poly_mult p2 p3)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma evaluate_net_Conv_id:
assumes "valid_net' m"
and "input_sizes m = map dim_vec input"
and "j<nr"
shows "evaluate_net (Conv (id_matrix nr (output_size' m)) m) input $ j
 = (if j<output_size' m then evaluate_net m input $ j else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. evaluate_net (Conv (id_matrix nr (output_size' m)) m) input $ j = (if j < output_size' m then evaluate_net m input $ j else 0)
[PROOF STEP]
unfolding evaluate_net.simps output_size_correct[OF assms(1) assms(2)[symmetric]]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (id_matrix nr (dim_vec (evaluate_net m input)) *\<^sub>v evaluate_net m input) $ j = (if j < dim_vec (evaluate_net m input) then evaluate_net m input $ j else 0)
[PROOF STEP]
using mult_id_matrix[OF \<open>j<nr\<close>, of "evaluate_net m input", unfolded dim_vec_of_list]
[PROOF STATE]
proof (prove)
using this:
(id_matrix nr (dim_vec (evaluate_net m input)) *\<^sub>v evaluate_net m input) $ j = (if j < dim_vec (evaluate_net m input) then evaluate_net m input $ j else 0)

goal (1 subgoal):
 1. (id_matrix nr (dim_vec (evaluate_net m input)) *\<^sub>v evaluate_net m input) $ j = (if j < dim_vec (evaluate_net m input) then evaluate_net m input $ j else 0)
[PROOF STEP]
by metis


[STATEMENT]
lemma ennreal_half[simp]: "ennreal (1/2) = inverse 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (1 / 2) = inverse 2
[PROOF STEP]
by transfer (simp add: max.absorb2)


[STATEMENT]
lemma (in CRR_market_viable) disc_asian_option_lgeom:
  shows "(discounted_value r (\<lambda>m. (asian_option T)) T w) =
    (det_discount r T) * (\<Sum> i\<in> {1.. T}. lgeom_proc u d init (take i (stake T w)))/ T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. discounted_value r (\<lambda>m. asian_option T) T w = det_discount r T * (\<Sum>i = 1..T. lgeom_proc u d init (take i (stake T w))) / real T
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. discounted_value r (\<lambda>m. asian_option T) T w = det_discount r T * (\<Sum>i = 1..T. lgeom_proc u d init (take i (stake T w))) / real T
[PROOF STEP]
have "\<forall> i\<in> {1..T}. lgeom_proc u d init (stake i w) = lgeom_proc u d init (take i (stake T w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>{1..T}. lgeom_proc u d init (stake i w) = lgeom_proc u d init (take i (stake T w))
[PROOF STEP]
using lgeom_proc_take
[PROOF STATE]
proof (prove)
using this:
?i \<le> ?n \<Longrightarrow> lgeom_proc ?u ?d ?init (stake ?i ?w) = lgeom_proc ?u ?d ?init (take ?i (stake ?n ?w))

goal (1 subgoal):
 1. \<forall>i\<in>{1..T}. lgeom_proc u d init (stake i w) = lgeom_proc u d init (take i (stake T w))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>{1..T}. lgeom_proc u d init (stake i w) = lgeom_proc u d init (take i (stake T w))

goal (1 subgoal):
 1. discounted_value r (\<lambda>m. asian_option T) T w = det_discount r T * (\<Sum>i = 1..T. lgeom_proc u d init (take i (stake T w))) / real T
[PROOF STEP]
hence "(\<Sum> i\<in> {1.. T}. lgeom_proc u d init (stake i w)) =
    (\<Sum> i\<in> {1.. T}. lgeom_proc u d init (take i (stake T w)))"
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>{1..T}. lgeom_proc u d init (stake i w) = lgeom_proc u d init (take i (stake T w))

goal (1 subgoal):
 1. (\<Sum>i = 1..T. lgeom_proc u d init (stake i w)) = (\<Sum>i = 1..T. lgeom_proc u d init (take i (stake T w)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 1..T. lgeom_proc u d init (stake i w)) = (\<Sum>i = 1..T. lgeom_proc u d init (take i (stake T w)))

goal (1 subgoal):
 1. discounted_value r (\<lambda>m. asian_option T) T w = det_discount r T * (\<Sum>i = 1..T. lgeom_proc u d init (take i (stake T w))) / real T
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 1..T. lgeom_proc u d init (stake i w)) = (\<Sum>i = 1..T. lgeom_proc u d init (take i (stake T w)))

goal (1 subgoal):
 1. discounted_value r (\<lambda>m. asian_option T) T w = det_discount r T * (\<Sum>i = 1..T. lgeom_proc u d init (take i (stake T w))) / real T
[PROOF STEP]
using det_discounted[of r "\<lambda>m. asian_option T" T w] asian_option_lgeom[of T w]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 1..T. lgeom_proc u d init (stake i w)) = (\<Sum>i = 1..T. lgeom_proc u d init (take i (stake T w)))
discounted_value r (\<lambda>m. asian_option T) T w = det_discount r T * asian_option T w
asian_option T w = (\<Sum>i = 1..T. lgeom_proc u d init (stake i w)) / real T

goal (1 subgoal):
 1. discounted_value r (\<lambda>m. asian_option T) T w = det_discount r T * (\<Sum>i = 1..T. lgeom_proc u d init (take i (stake T w))) / real T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
discounted_value r (\<lambda>m. asian_option T) T w = det_discount r T * (\<Sum>i = 1..T. lgeom_proc u d init (take i (stake T w))) / real T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prod_mset_Un:
  "prod_mset (A + B) = prod_mset A * prod_mset B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_mset (A + B) = prod_mset A * prod_mset B
[PROOF STEP]
by (fact prod_mset.union)


[STATEMENT]
lemma gcd_unique_nat: "d dvd a \<and> d dvd b \<and> (\<forall>e. e dvd a \<and> e dvd b \<longrightarrow> e dvd d) \<longleftrightarrow> d = gcd a b"
  for d a :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (d dvd a \<and> d dvd b \<and> (\<forall>e. e dvd a \<and> e dvd b \<longrightarrow> e dvd d)) = (d = gcd a b)
[PROOF STEP]
using gcd_unique
[PROOF STATE]
proof (prove)
using this:
(?d dvd ?a \<and> ?d dvd ?b \<and> normalize ?d = ?d \<and> (\<forall>e. e dvd ?a \<and> e dvd ?b \<longrightarrow> e dvd ?d)) = (?d = gcd ?a ?b)

goal (1 subgoal):
 1. (d dvd a \<and> d dvd b \<and> (\<forall>e. e dvd a \<and> e dvd b \<longrightarrow> e dvd d)) = (d = gcd a b)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma is_lub_some_lub:
  "\<lbrakk> single_valued r; acyclic r; (x,u)\<in>r^*; (y,u)\<in>r^* \<rbrakk>
  \<Longrightarrow> is_lub (r^* ) x y (some_lub (r^* ) x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>single_valued r; acyclic r; (x, u) \<in> r\<^sup>*; (y, u) \<in> r\<^sup>*\<rbrakk> \<Longrightarrow> is_lub (r\<^sup>*) x y (some_lub (r\<^sup>*) x y)
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>single_valued r; acyclic r; (x, u) \<in> r\<^sup>*; (y, u) \<in> r\<^sup>*\<rbrakk> \<Longrightarrow> is_lub (r\<^sup>*) x y (some_lub (r\<^sup>*) x y)
[PROOF STEP]
by (fastforce dest: single_valued_has_lubs simp add: some_lub_conv)


[STATEMENT]
lemma basis_null_space_iarrays_eq:
fixes A::"'a::{field}^'cols::{mod_type}^'rows::{mod_type}"
shows "basis_null_space_iarrays (matrix_to_iarray A)
  = set (map (\<lambda>i. row_iarray i (fst (Gauss_Jordan_iarrays_PA (transpose_iarray (matrix_to_iarray A))))) [(rank_iarray (matrix_to_iarray A))..<(ncols_iarray (matrix_to_iarray A))])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. basis_null_space_iarrays (matrix_to_iarray A) = set (map (\<lambda>i. row_iarray i (fst (Gauss_Jordan_iarrays_PA (transpose_iarray (matrix_to_iarray A))))) [rank_iarray (matrix_to_iarray A)..<ncols_iarray (matrix_to_iarray A)])
[PROOF STEP]
unfolding basis_null_space_iarrays_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map (\<lambda>i. row_iarray i (fst (Gauss_Jordan_iarrays_PA (transpose_iarray (matrix_to_iarray A))))) [length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd (Gauss_Jordan_iarrays_PA (transpose_iarray (matrix_to_iarray A))))))..<ncols_iarray (matrix_to_iarray A)]) = set (map (\<lambda>i. row_iarray i (fst (Gauss_Jordan_iarrays_PA (transpose_iarray (matrix_to_iarray A))))) [rank_iarray (matrix_to_iarray A)..<ncols_iarray (matrix_to_iarray A)])
[PROOF STEP]
unfolding matrix_to_iarray_rank[symmetric, of A]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map (\<lambda>i. row_iarray i (fst (Gauss_Jordan_iarrays_PA (transpose_iarray (matrix_to_iarray A))))) [length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd (Gauss_Jordan_iarrays_PA (transpose_iarray (matrix_to_iarray A))))))..<ncols_iarray (matrix_to_iarray A)]) = set (map (\<lambda>i. row_iarray i (fst (Gauss_Jordan_iarrays_PA (transpose_iarray (matrix_to_iarray A))))) [rank A..<ncols_iarray (matrix_to_iarray A)])
[PROOF STEP]
unfolding rank_transpose[symmetric, of A]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map (\<lambda>i. row_iarray i (fst (Gauss_Jordan_iarrays_PA (transpose_iarray (matrix_to_iarray A))))) [length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd (Gauss_Jordan_iarrays_PA (transpose_iarray (matrix_to_iarray A))))))..<ncols_iarray (matrix_to_iarray A)]) = set (map (\<lambda>i. row_iarray i (fst (Gauss_Jordan_iarrays_PA (transpose_iarray (matrix_to_iarray A))))) [rank (Finite_Cartesian_Product.transpose A)..<ncols_iarray (matrix_to_iarray A)])
[PROOF STEP]
unfolding matrix_to_iarray_rank
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map (\<lambda>i. row_iarray i (fst (Gauss_Jordan_iarrays_PA (transpose_iarray (matrix_to_iarray A))))) [length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd (Gauss_Jordan_iarrays_PA (transpose_iarray (matrix_to_iarray A))))))..<ncols_iarray (matrix_to_iarray A)]) = set (map (\<lambda>i. row_iarray i (fst (Gauss_Jordan_iarrays_PA (transpose_iarray (matrix_to_iarray A))))) [rank_iarray (matrix_to_iarray (Finite_Cartesian_Product.transpose A))..<ncols_iarray (matrix_to_iarray A)])
[PROOF STEP]
unfolding rank_iarrays_code
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map (\<lambda>i. row_iarray i (fst (Gauss_Jordan_iarrays_PA (transpose_iarray (matrix_to_iarray A))))) [length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd (Gauss_Jordan_iarrays_PA (transpose_iarray (matrix_to_iarray A))))))..<ncols_iarray (matrix_to_iarray A)]) = set (map (\<lambda>i. row_iarray i (fst (Gauss_Jordan_iarrays_PA (transpose_iarray (matrix_to_iarray A))))) [length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (Gauss_Jordan_iarrays (matrix_to_iarray (Finite_Cartesian_Product.transpose A)))))..<ncols_iarray (matrix_to_iarray A)])
[PROOF STEP]
unfolding matrix_to_iarray_transpose[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map (\<lambda>i. row_iarray i (fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray (Finite_Cartesian_Product.transpose A))))) [length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (snd (Gauss_Jordan_iarrays_PA (matrix_to_iarray (Finite_Cartesian_Product.transpose A))))))..<ncols_iarray (matrix_to_iarray A)]) = set (map (\<lambda>i. row_iarray i (fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray (Finite_Cartesian_Product.transpose A))))) [length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (Gauss_Jordan_iarrays (matrix_to_iarray (Finite_Cartesian_Product.transpose A)))))..<ncols_iarray (matrix_to_iarray A)])
[PROOF STEP]
unfolding snd_Gauss_Jordan_iarrays_PA_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map (\<lambda>i. row_iarray i (fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray (Finite_Cartesian_Product.transpose A))))) [length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (Gauss_Jordan_iarrays (matrix_to_iarray (Finite_Cartesian_Product.transpose A)))))..<ncols_iarray (matrix_to_iarray A)]) = set (map (\<lambda>i. row_iarray i (fst (Gauss_Jordan_iarrays_PA (matrix_to_iarray (Finite_Cartesian_Product.transpose A))))) [length (filter (\<lambda>x. \<not> is_zero_iarray x) (IArray.list_of (Gauss_Jordan_iarrays (matrix_to_iarray (Finite_Cartesian_Product.transpose A)))))..<ncols_iarray (matrix_to_iarray A)])
[PROOF STEP]
..


[STATEMENT]
lemma full_rank_implies_invertible:
fixes A::"'a::{field}^'n::{mod_type}^'n::{mod_type}"
assumes rank_n: "rank A = nrows A"
shows "invertible A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible A
[PROOF STEP]
proof (unfold invertible_left_inverse[of A] matrix_left_invertible_ker, clarify)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. A *v x = 0 \<Longrightarrow> x = 0
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. A *v x = 0 \<Longrightarrow> x = 0
[PROOF STEP]
assume Ax: "A *v x = 0"
[PROOF STATE]
proof (state)
this:
A *v x = 0

goal (1 subgoal):
 1. \<And>x. A *v x = 0 \<Longrightarrow> x = 0
[PROOF STEP]
have rank_eq_card_n: "rank A = CARD('n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A = CARD('n)
[PROOF STEP]
using rank_n
[PROOF STATE]
proof (prove)
using this:
rank A = nrows A

goal (1 subgoal):
 1. rank A = CARD('n)
[PROOF STEP]
unfolding nrows_def
[PROOF STATE]
proof (prove)
using this:
rank A = CARD('n)

goal (1 subgoal):
 1. rank A = CARD('n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
rank A = CARD('n)

goal (1 subgoal):
 1. \<And>x. A *v x = 0 \<Longrightarrow> x = 0
[PROOF STEP]
have "vec.dim (null_space A)=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.dim (null_space A) = 0
[PROOF STEP]
unfolding dim_null_space
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_dimensional_vector_space.dimension cart_basis - rank A = 0
[PROOF STEP]
unfolding rank_eq_card_n dimension_vector
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('n) - CARD('n) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
vec.dim (null_space A) = 0

goal (1 subgoal):
 1. \<And>x. A *v x = 0 \<Longrightarrow> x = 0
[PROOF STEP]
hence "null_space A = {0}"
[PROOF STATE]
proof (prove)
using this:
vec.dim (null_space A) = 0

goal (1 subgoal):
 1. null_space A = {0}
[PROOF STEP]
using vec.dim_zero_eq
[PROOF STATE]
proof (prove)
using this:
vec.dim (null_space A) = 0
vec.dim ?A = 0 \<Longrightarrow> ?A = {} \<or> ?A = {0}

goal (1 subgoal):
 1. null_space A = {0}
[PROOF STEP]
using Ax null_space_def
[PROOF STATE]
proof (prove)
using this:
vec.dim (null_space A) = 0
vec.dim ?A = 0 \<Longrightarrow> ?A = {} \<or> ?A = {0}
A *v x = 0
null_space ?A = {x. ?A *v x = 0}

goal (1 subgoal):
 1. null_space A = {0}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
null_space A = {0}

goal (1 subgoal):
 1. \<And>x. A *v x = 0 \<Longrightarrow> x = 0
[PROOF STEP]
thus "x = 0"
[PROOF STATE]
proof (prove)
using this:
null_space A = {0}

goal (1 subgoal):
 1. x = 0
[PROOF STEP]
unfolding null_space_def
[PROOF STATE]
proof (prove)
using this:
{x. A *v x = 0} = {0}

goal (1 subgoal):
 1. x = 0
[PROOF STEP]
using Ax
[PROOF STATE]
proof (prove)
using this:
{x. A *v x = 0} = {0}
A *v x = 0

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_nat_to_bv_lower_limit:
  assumes nk: "2 ^ k \<le> n"
  shows       "k < length (nat_to_bv n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < length (nat_to_bv n)
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> k < length (nat_to_bv n) \<Longrightarrow> False
[PROOF STEP]
assume "~ k < length (nat_to_bv n)"
[PROOF STATE]
proof (state)
this:
\<not> k < length (nat_to_bv n)

goal (1 subgoal):
 1. \<not> k < length (nat_to_bv n) \<Longrightarrow> False
[PROOF STEP]
hence lnk: "length (nat_to_bv n) \<le> k"
[PROOF STATE]
proof (prove)
using this:
\<not> k < length (nat_to_bv n)

goal (1 subgoal):
 1. length (nat_to_bv n) \<le> k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (nat_to_bv n) \<le> k

goal (1 subgoal):
 1. \<not> k < length (nat_to_bv n) \<Longrightarrow> False
[PROOF STEP]
have "n = bv_to_nat (nat_to_bv n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n = bv_to_nat (nat_to_bv n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n = bv_to_nat (nat_to_bv n)

goal (1 subgoal):
 1. \<not> k < length (nat_to_bv n) \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n = bv_to_nat (nat_to_bv n)

goal (1 subgoal):
 1. \<not> k < length (nat_to_bv n) \<Longrightarrow> False
[PROOF STEP]
have "... < 2 ^ length (nat_to_bv n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bv_to_nat (nat_to_bv n) < 2 ^ length (nat_to_bv n)
[PROOF STEP]
by (rule bv_to_nat_upper_range)
[PROOF STATE]
proof (state)
this:
bv_to_nat (nat_to_bv n) < 2 ^ length (nat_to_bv n)

goal (1 subgoal):
 1. \<not> k < length (nat_to_bv n) \<Longrightarrow> False
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
bv_to_nat (nat_to_bv n) < 2 ^ length (nat_to_bv n)

goal (1 subgoal):
 1. \<not> k < length (nat_to_bv n) \<Longrightarrow> False
[PROOF STEP]
from lnk
[PROOF STATE]
proof (chain)
picking this:
length (nat_to_bv n) \<le> k
[PROOF STEP]
have "... \<le> 2 ^ k"
[PROOF STATE]
proof (prove)
using this:
length (nat_to_bv n) \<le> k

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

goal (1 subgoal):
 1. \<not> k < length (nat_to_bv n) \<Longrightarrow> False
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
n < 2 ^ k
[PROOF STEP]
have "n < 2 ^ k"
[PROOF STATE]
proof (prove)
using this:
n < 2 ^ k

goal (1 subgoal):
 1. n < 2 ^ k
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
n < 2 ^ k

goal (1 subgoal):
 1. \<not> k < length (nat_to_bv n) \<Longrightarrow> False
[PROOF STEP]
with nk
[PROOF STATE]
proof (chain)
picking this:
2 ^ k \<le> n
n < 2 ^ k
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
2 ^ k \<le> n
n < 2 ^ k

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma aprimedivisor_not_Suc_0_nat [simp]: "d > Suc 0 \<Longrightarrow> aprimedivisor d \<noteq> Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc 0 < d \<Longrightarrow> aprimedivisor d \<noteq> Suc 0
[PROOF STEP]
using aprimedivisor_gt_Suc_0[of d]
[PROOF STATE]
proof (prove)
using this:
d \<noteq> Suc 0 \<Longrightarrow> Suc 0 < aprimedivisor d

goal (1 subgoal):
 1. Suc 0 < d \<Longrightarrow> aprimedivisor d \<noteq> Suc 0
[PROOF STEP]
by (intro notI) auto


[STATEMENT]
lemma dim_span_insert: assumes W: "W \<subseteq> carrier_vec n"
  and v: "v \<in> carrier_vec n" and vs: "v \<notin> span W"
shows "dim_span (insert v W) = Suc (dim_span W)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_span (insert v W) = Suc (dim_span W)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dim_span (insert v W) = Suc (dim_span W)
[PROOF STEP]
from ex_basis_span[OF W]
[PROOF STATE]
proof (chain)
picking this:
\<exists>Wa\<subseteq>carrier_vec n. lin_indpt Wa \<and> local.span W = local.span Wa \<and> dim_span W = card Wa
[PROOF STEP]
obtain V where
    V: "V \<subseteq> carrier_vec n"
    and lin: "lin_indpt V"
    and span: "span W = span V"
    and dim: "dim_span W = card V"
[PROOF STATE]
proof (prove)
using this:
\<exists>Wa\<subseteq>carrier_vec n. lin_indpt Wa \<and> local.span W = local.span Wa \<and> dim_span W = card Wa

goal (1 subgoal):
 1. (\<And>V. \<lbrakk>V \<subseteq> carrier_vec n; lin_indpt V; local.span W = local.span V; dim_span W = card V\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
V \<subseteq> carrier_vec n
lin_indpt V
local.span W = local.span V
dim_span W = card V

goal (1 subgoal):
 1. dim_span (insert v W) = Suc (dim_span W)
[PROOF STEP]
from V vs[unfolded span]
[PROOF STATE]
proof (chain)
picking this:
V \<subseteq> carrier_vec n
v \<notin> local.span V
[PROOF STEP]
have vV: "v \<notin> V"
[PROOF STATE]
proof (prove)
using this:
V \<subseteq> carrier_vec n
v \<notin> local.span V

goal (1 subgoal):
 1. v \<notin> V
[PROOF STEP]
using span_mem[OF V]
[PROOF STATE]
proof (prove)
using this:
V \<subseteq> carrier_vec n
v \<notin> local.span V
?u \<in> V \<Longrightarrow> ?u \<in> local.span V

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

goal (1 subgoal):
 1. dim_span (insert v W) = Suc (dim_span W)
[PROOF STEP]
from lin_dep_iff_in_span[OF V lin v vV] vs span
[PROOF STATE]
proof (chain)
picking this:
(v \<in> local.span V) = lin_dep (V \<union> {v})
v \<notin> local.span W
local.span W = local.span V
[PROOF STEP]
have lin': "lin_indpt (insert v V)"
[PROOF STATE]
proof (prove)
using this:
(v \<in> local.span V) = lin_dep (V \<union> {v})
v \<notin> local.span W
local.span W = local.span V

goal (1 subgoal):
 1. lin_indpt (insert v V)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lin_indpt (insert v V)

goal (1 subgoal):
 1. dim_span (insert v W) = Suc (dim_span W)
[PROOF STEP]
have finV: "finite V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite V
[PROOF STEP]
using lin V
[PROOF STATE]
proof (prove)
using this:
lin_indpt V
V \<subseteq> carrier_vec n

goal (1 subgoal):
 1. finite V
[PROOF STEP]
using fin_dim fin_dim_li_fin
[PROOF STATE]
proof (prove)
using this:
lin_indpt V
V \<subseteq> carrier_vec n
fin_dim
\<lbrakk>fin_dim; lin_indpt ?A; ?A \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> finite ?A

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

goal (1 subgoal):
 1. dim_span (insert v W) = Suc (dim_span W)
[PROOF STEP]
have "card (insert v V) = Suc (card V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (insert v V) = Suc (card V)
[PROOF STEP]
using finV vV
[PROOF STATE]
proof (prove)
using this:
finite V
v \<notin> V

goal (1 subgoal):
 1. card (insert v V) = Suc (card V)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (insert v V) = Suc (card V)

goal (1 subgoal):
 1. dim_span (insert v W) = Suc (dim_span W)
[PROOF STEP]
hence cvV: "card (insert v V) = Suc (dim_span W)"
[PROOF STATE]
proof (prove)
using this:
card (insert v V) = Suc (card V)

goal (1 subgoal):
 1. card (insert v V) = Suc (dim_span W)
[PROOF STEP]
using dim
[PROOF STATE]
proof (prove)
using this:
card (insert v V) = Suc (card V)
dim_span W = card V

goal (1 subgoal):
 1. card (insert v V) = Suc (dim_span W)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (insert v V) = Suc (dim_span W)

goal (1 subgoal):
 1. dim_span (insert v W) = Suc (dim_span W)
[PROOF STEP]
have "span (insert v V) = span (insert v W)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.span (insert v V) = local.span (insert v W)
[PROOF STEP]
using span V W v
[PROOF STATE]
proof (prove)
using this:
local.span W = local.span V
V \<subseteq> carrier_vec n
W \<subseteq> carrier_vec n
v \<in> carrier_vec n

goal (1 subgoal):
 1. local.span (insert v V) = local.span (insert v W)
[PROOF STEP]
by (metis bot_least insert_subset insert_union span_union_is_sum)
[PROOF STATE]
proof (state)
this:
local.span (insert v V) = local.span (insert v W)

goal (1 subgoal):
 1. dim_span (insert v W) = Suc (dim_span W)
[PROOF STEP]
from same_span_imp_card_eq_dim_span[OF _ _ this lin'] cvV v V W
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>insert v V \<subseteq> carrier_vec n; insert v W \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> card (insert v V) = dim_span (insert v W)
card (insert v V) = Suc (dim_span W)
v \<in> carrier_vec n
V \<subseteq> carrier_vec n
W \<subseteq> carrier_vec n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>insert v V \<subseteq> carrier_vec n; insert v W \<subseteq> carrier_vec n\<rbrakk> \<Longrightarrow> card (insert v V) = dim_span (insert v W)
card (insert v V) = Suc (dim_span W)
v \<in> carrier_vec n
V \<subseteq> carrier_vec n
W \<subseteq> carrier_vec n

goal (1 subgoal):
 1. dim_span (insert v W) = Suc (dim_span W)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_span (insert v W) = Suc (dim_span W)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma max_norm_def: "\<parallel>A\<parallel>\<^sub>m\<^sub>a\<^sub>x = Max {\<bar>A $ i $ j\<bar>|i j. i\<in>UNIV \<and> j\<in>UNIV}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>A\<parallel>\<^sub>m\<^sub>a\<^sub>x = Max {\<bar>A $ i $ j\<bar> |i j. i \<in> UNIV \<and> j \<in> UNIV}
[PROOF STEP]
by (simp add: image_def, rule arg_cong[of _ _ Max], blast)


[STATEMENT]
lemma digit_of_nat_nat_of_digit_id:
    \<open>c \<in> {CHR ''0'', CHR ''1'', CHR ''2'', CHR ''3'', CHR ''4'',
          CHR ''5'', CHR ''6'', CHR ''7'', CHR ''8'', CHR ''9''}
      \<Longrightarrow> digit_of_nat (nat_of_digit c) = c\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<in> {CHR ''0'', CHR ''1'', CHR ''2'', CHR ''3'', CHR ''4'', CHR ''5'', CHR ''6'', CHR ''7'', CHR ''8'', CHR ''9''} \<Longrightarrow> digit_of_nat (nat_of_digit c) = c
[PROOF STEP]
by(code_simp, auto)


[STATEMENT]
lemma topology_eq: "T1 = T2 \<longleftrightarrow> (\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (T1 = T2) = (\<forall>S. openin T1 S = openin T2 S)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. T1 = T2 \<Longrightarrow> \<forall>S. openin T1 S = openin T2 S
 2. \<forall>S. openin T1 S = openin T2 S \<Longrightarrow> T1 = T2
[PROOF STEP]
assume "T1 = T2"
[PROOF STATE]
proof (state)
this:
T1 = T2

goal (2 subgoals):
 1. T1 = T2 \<Longrightarrow> \<forall>S. openin T1 S = openin T2 S
 2. \<forall>S. openin T1 S = openin T2 S \<Longrightarrow> T1 = T2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
T1 = T2
[PROOF STEP]
show "\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S"
[PROOF STATE]
proof (prove)
using this:
T1 = T2

goal (1 subgoal):
 1. \<forall>S. openin T1 S = openin T2 S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>S. openin T1 S = openin T2 S

goal (1 subgoal):
 1. \<forall>S. openin T1 S = openin T2 S \<Longrightarrow> T1 = T2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>S. openin T1 S = openin T2 S \<Longrightarrow> T1 = T2
[PROOF STEP]
assume H: "\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S"
[PROOF STATE]
proof (state)
this:
\<forall>S. openin T1 S = openin T2 S

goal (1 subgoal):
 1. \<forall>S. openin T1 S = openin T2 S \<Longrightarrow> T1 = T2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>S. openin T1 S = openin T2 S
[PROOF STEP]
have "openin T1 = openin T2"
[PROOF STATE]
proof (prove)
using this:
\<forall>S. openin T1 S = openin T2 S

goal (1 subgoal):
 1. openin T1 = openin T2
[PROOF STEP]
by (simp add: fun_eq_iff)
[PROOF STATE]
proof (state)
this:
openin T1 = openin T2

goal (1 subgoal):
 1. \<forall>S. openin T1 S = openin T2 S \<Longrightarrow> T1 = T2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
openin T1 = openin T2
[PROOF STEP]
have "topology (openin T1) = topology (openin T2)"
[PROOF STATE]
proof (prove)
using this:
openin T1 = openin T2

goal (1 subgoal):
 1. topology (openin T1) = topology (openin T2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
topology (openin T1) = topology (openin T2)

goal (1 subgoal):
 1. \<forall>S. openin T1 S = openin T2 S \<Longrightarrow> T1 = T2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
topology (openin T1) = topology (openin T2)
[PROOF STEP]
show "T1 = T2"
[PROOF STATE]
proof (prove)
using this:
topology (openin T1) = topology (openin T2)

goal (1 subgoal):
 1. T1 = T2
[PROOF STEP]
unfolding openin_inverse
[PROOF STATE]
proof (prove)
using this:
T1 = T2

goal (1 subgoal):
 1. T1 = T2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
T1 = T2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lgeom_proc_take:
  assumes "i \<le> n"
  shows "lgeom_proc u d init (stake i w) = lgeom_proc u d init (take i (stake n w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lgeom_proc u d init (stake i w) = lgeom_proc u d init (take i (stake n w))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lgeom_proc u d init (stake i w) = lgeom_proc u d init (take i (stake n w))
[PROOF STEP]
have "stake i w = take i (stake n w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stake i w = take i (stake n w)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i \<le> n

goal (1 subgoal):
 1. stake i w = take i (stake n w)
[PROOF STEP]
by (simp add: min.absorb1 take_stake)
[PROOF STATE]
proof (state)
this:
stake i w = take i (stake n w)

goal (1 subgoal):
 1. lgeom_proc u d init (stake i w) = lgeom_proc u d init (take i (stake n w))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
stake i w = take i (stake n w)

goal (1 subgoal):
 1. lgeom_proc u d init (stake i w) = lgeom_proc u d init (take i (stake n w))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
lgeom_proc u d init (stake i w) = lgeom_proc u d init (take i (stake n w))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma from_digits_altdef: "from_digits n d = (\<Sum>i<n. d i * base ^ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. from_digits n d = (\<Sum>i<n. d i * base ^ i)
[PROOF STEP]
by (induction n d rule: from_digits.induct)
     (auto simp add: sum.lessThan_Suc_shift o_def sum_distrib_left
       sum_distrib_right mult_ac simp del: sum.lessThan_Suc)


[STATEMENT]
lemma homo_rel_restrict_mono:
  "R \<subseteq> B \<times> B \<Longrightarrow> rel_restrict R A \<subseteq> (B - A) \<times> (B - A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R \<subseteq> B \<times> B \<Longrightarrow> rel_restrict R A \<subseteq> (B - A) \<times> (B - A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. R \<subseteq> B \<times> B \<Longrightarrow> rel_restrict R A \<subseteq> (B - A) \<times> (B - A)
[PROOF STEP]
assume A: "R \<subseteq> B \<times> B"
[PROOF STATE]
proof (state)
this:
R \<subseteq> B \<times> B

goal (1 subgoal):
 1. R \<subseteq> B \<times> B \<Longrightarrow> rel_restrict R A \<subseteq> (B - A) \<times> (B - A)
[PROOF STEP]
hence "Field R \<subseteq> B"
[PROOF STATE]
proof (prove)
using this:
R \<subseteq> B \<times> B

goal (1 subgoal):
 1. Field R \<subseteq> B
[PROOF STEP]
unfolding Field_def
[PROOF STATE]
proof (prove)
using this:
R \<subseteq> B \<times> B

goal (1 subgoal):
 1. Domain R \<union> Range R \<subseteq> B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Field R \<subseteq> B

goal (1 subgoal):
 1. R \<subseteq> B \<times> B \<Longrightarrow> rel_restrict R A \<subseteq> (B - A) \<times> (B - A)
[PROOF STEP]
with Field_rel_restrict
[PROOF STATE]
proof (chain)
picking this:
Field (rel_restrict ?R ?A) \<subseteq> Field ?R - ?A
Field R \<subseteq> B
[PROOF STEP]
have "Field (rel_restrict R A) \<subseteq> B - A"
[PROOF STATE]
proof (prove)
using this:
Field (rel_restrict ?R ?A) \<subseteq> Field ?R - ?A
Field R \<subseteq> B

goal (1 subgoal):
 1. Field (rel_restrict R A) \<subseteq> B - A
[PROOF STEP]
by (metis Diff_mono order_refl order_trans)
[PROOF STATE]
proof (state)
this:
Field (rel_restrict R A) \<subseteq> B - A

goal (1 subgoal):
 1. R \<subseteq> B \<times> B \<Longrightarrow> rel_restrict R A \<subseteq> (B - A) \<times> (B - A)
[PROOF STEP]
with R_subset_Field
[PROOF STATE]
proof (chain)
picking this:
?R \<subseteq> Field ?R \<times> Field ?R
Field (rel_restrict R A) \<subseteq> B - A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?R \<subseteq> Field ?R \<times> Field ?R
Field (rel_restrict R A) \<subseteq> B - A

goal (1 subgoal):
 1. rel_restrict R A \<subseteq> (B - A) \<times> (B - A)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
rel_restrict R A \<subseteq> (B - A) \<times> (B - A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_sqrt_mult_self[simp]: "sqrt a * sqrt a = \<bar>a\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt a * sqrt a = \<bar>a\<bar>
[PROOF STEP]
using real_sqrt_abs[of a]
[PROOF STATE]
proof (prove)
using this:
sqrt (a\<^sup>2) = \<bar>a\<bar>

goal (1 subgoal):
 1. sqrt a * sqrt a = \<bar>a\<bar>
[PROOF STEP]
unfolding power2_eq_square real_sqrt_mult
[PROOF STATE]
proof (prove)
using this:
sqrt a * sqrt a = \<bar>a\<bar>

goal (1 subgoal):
 1. sqrt a * sqrt a = \<bar>a\<bar>
[PROOF STEP]
.


[STATEMENT]
lemma ivp_sols_collapse:
  assumes "T = UNIV" and "s \<in> S"
  shows "Sols (\<lambda>t. f) (\<lambda>s. T) S 0 s = {(\<lambda>t. \<phi> t s)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sols (\<lambda>t. f) (\<lambda>s. T) S 0 s = {\<lambda>t. \<phi> t s}
[PROOF STEP]
apply (safe, simp_all add: fun_eq_iff, clarsimp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x xa. x \<in> Sols (\<lambda>t. f) (\<lambda>s. T) S 0 s \<Longrightarrow> x xa = \<phi> xa s
 2. (\<lambda>t. \<phi> t s) \<in> Sols (\<lambda>t. f) (\<lambda>s. T) S 0 s
[PROOF STEP]
apply(rule eq_solution[of _ "\<lambda>s. T"]; simp add: assms)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>t. \<phi> t s) \<in> Sols (\<lambda>t. f) (\<lambda>s. T) S 0 s
[PROOF STEP]
by (rule in_ivp_sols; simp add: assms)


[STATEMENT]
lemma index_zero_vec[simp]: "i < n \<Longrightarrow> 0\<^sub>v n $ i = 0" "dim_vec (0\<^sub>v n) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i < n \<Longrightarrow> 0\<^sub>v n $ i = (0::'a)) &&& dim_vec (0\<^sub>v n) = n
[PROOF STEP]
unfolding zero_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i < n \<Longrightarrow> vec n (\<lambda>i. 0::'a) $ i = (0::'a)) &&& dim_vec (vec n (\<lambda>i. 0::'b)) = n
[PROOF STEP]
by auto


[STATEMENT]
lemma  rfn_tool12:"\<lbrakk>0 < (s::nat); (i::nat) mod s = s - 1 \<rbrakk> \<Longrightarrow>
                     Suc (i div s) = (Suc i) div s "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < s; i mod s = s - 1\<rbrakk> \<Longrightarrow> Suc (i div s) = Suc i div s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>0 < s; i mod s = s - 1\<rbrakk> \<Longrightarrow> Suc (i div s) = Suc i div s
[PROOF STEP]
assume p1:"0 < s" and p2:"i mod s = s - 1"
[PROOF STATE]
proof (state)
this:
0 < s
i mod s = s - 1

goal (1 subgoal):
 1. \<lbrakk>0 < s; i mod s = s - 1\<rbrakk> \<Longrightarrow> Suc (i div s) = Suc i div s
[PROOF STEP]
have q1:"i div s * s + i mod s = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i div s * s + i mod s = i
[PROOF STEP]
apply (insert div_mult_mod_eq [of "i" "s"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i div s * s + i mod s = i \<Longrightarrow> i div s * s + i mod s = i
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
i div s * s + i mod s = i

goal (1 subgoal):
 1. \<lbrakk>0 < s; i mod s = s - 1\<rbrakk> \<Longrightarrow> Suc (i div s) = Suc i div s
[PROOF STEP]
have q2:"Suc (i div s * s + i mod s) = i div s * s + Suc (i mod s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (i div s * s + i mod s) = i div s * s + Suc (i mod s)
[PROOF STEP]
apply (insert add_Suc_right [THEN sym, of "i div s * s" "i mod s"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (i div s * s + i mod s) = i div s * s + Suc (i mod s) \<Longrightarrow> Suc (i div s * s + i mod s) = i div s * s + Suc (i mod s)
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
Suc (i div s * s + i mod s) = i div s * s + Suc (i mod s)

goal (1 subgoal):
 1. \<lbrakk>0 < s; i mod s = s - 1\<rbrakk> \<Longrightarrow> Suc (i div s) = Suc i div s
[PROOF STEP]
from p1 and p2 and q2
[PROOF STATE]
proof (chain)
picking this:
0 < s
i mod s = s - 1
Suc (i div s * s + i mod s) = i div s * s + Suc (i mod s)
[PROOF STEP]
have q3:"Suc (i div s * s + i mod s) = i div s * s + s"
[PROOF STATE]
proof (prove)
using this:
0 < s
i mod s = s - 1
Suc (i div s * s + i mod s) = i div s * s + Suc (i mod s)

goal (1 subgoal):
 1. Suc (i div s * s + i mod s) = i div s * s + s
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
Suc (i div s * s + i mod s) = i div s * s + s

goal (1 subgoal):
 1. \<lbrakk>0 < s; i mod s = s - 1\<rbrakk> \<Longrightarrow> Suc (i div s) = Suc i div s
[PROOF STEP]
from q3
[PROOF STATE]
proof (chain)
picking this:
Suc (i div s * s + i mod s) = i div s * s + s
[PROOF STEP]
have q4:"Suc (i div s * s + i mod s) = Suc (i div s) * s "
[PROOF STATE]
proof (prove)
using this:
Suc (i div s * s + i mod s) = i div s * s + s

goal (1 subgoal):
 1. Suc (i div s * s + i mod s) = Suc (i div s) * s
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
Suc (i div s * s + i mod s) = Suc (i div s) * s

goal (1 subgoal):
 1. \<lbrakk>0 < s; i mod s = s - 1\<rbrakk> \<Longrightarrow> Suc (i div s) = Suc i div s
[PROOF STEP]
from p1 and q1 and q4
[PROOF STATE]
proof (chain)
picking this:
0 < s
i div s * s + i mod s = i
Suc (i div s * s + i mod s) = Suc (i div s) * s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < s
i div s * s + i mod s = i
Suc (i div s * s + i mod s) = Suc (i div s) * s

goal (1 subgoal):
 1. Suc (i div s) = Suc i div s
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
Suc (i div s) = Suc i div s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hom_Sum_any: assumes fin: "finite {x. f x \<noteq> 0}"
  shows "hom (Sum_any f) = Sum_any (\<lambda> x. hom (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom (Sum_any f) = (\<Sum>x. hom (f x))
[PROOF STEP]
unfolding Sum_any.expand_set hom_sum
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>{a. f a \<noteq> (0::'a)}. hom (f x)) = (\<Sum>x\<in>{a. hom (f a) \<noteq> (0::'b)}. hom (f x))
[PROOF STEP]
by (rule sum.mono_neutral_right[OF fin], auto)


[STATEMENT]
lemma onorm_neg:
  shows "onorm (\<lambda>x. - f x) = onorm f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm (\<lambda>x. - f x) = onorm f
[PROOF STEP]
unfolding onorm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP x. norm (- f x) / norm x) = (SUP x. norm (f x) / norm x)
[PROOF STEP]
by simp


[STATEMENT]
lemma valid_wgraph_repr_presentation: "valid_wgraph_repr l \<longleftrightarrow>
  (\<forall>((u,v),d)\<in>set l. u\<noteq>v) \<and> distinct [ {u,v}. ((u,v),d)\<leftarrow>l ]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_wgraph_repr l = ((\<forall>((u, v), d)\<in>set l. u \<noteq> v) \<and> distinct (map (\<lambda>((u, v), d). {u, v}) l))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. valid_wgraph_repr l = ((\<forall>((u, v), d)\<in>set l. u \<noteq> v) \<and> distinct (map (\<lambda>((u, v), d). {u, v}) l))
[PROOF STEP]
have [simp]: "uedge \<circ> fst = (\<lambda>((u, v), w). {u, v})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uedge \<circ> fst = (\<lambda>((u, v), w). {u, v})
[PROOF STEP]
unfolding uedge_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(a, b). {a, b}) \<circ> fst = (\<lambda>((u, v), w). {u, v})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
uedge \<circ> fst = (\<lambda>((u, v), w). {u, v})

goal (1 subgoal):
 1. valid_wgraph_repr l = ((\<forall>((u, v), d)\<in>set l. u \<noteq> v) \<and> distinct (map (\<lambda>((u, v), d). {u, v}) l))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_wgraph_repr l = ((\<forall>((u, v), d)\<in>set l. u \<noteq> v) \<and> distinct (map (\<lambda>((u, v), d). {u, v}) l))
[PROOF STEP]
unfolding valid_wgraph_repr_def valid_graph_repr_def valid_weight_repr_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>(u, v)\<in>set (map fst l). u \<noteq> v) \<and> distinct (map (uedge \<circ> fst) l)) = ((\<forall>((u, v), d)\<in>set l. u \<noteq> v) \<and> distinct (map (\<lambda>((u, v), d). {u, v}) l))
[PROOF STEP]
by (auto split: prod.splits)
[PROOF STATE]
proof (state)
this:
valid_wgraph_repr l = ((\<forall>((u, v), d)\<in>set l. u \<noteq> v) \<and> distinct (map (\<lambda>((u, v), d). {u, v}) l))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lenlex_irreflexive: "(\<And>x. (x,x) \<notin> r) \<Longrightarrow> (xs,xs) \<notin> lenlex r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. (x, x) \<notin> r) \<Longrightarrow> (xs, xs) \<notin> lenlex r
[PROOF STEP]
by (induction xs) (auto simp add: Cons_lenlex_iff)


[STATEMENT]
lemma proj_sum: "proj_poly k (sum f A) = (\<Sum>a\<in>A. proj_poly k (f a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. proj_poly k (sum f A) = (\<Sum>a\<in>A. proj_poly k (f a))
[PROOF STEP]
using proj_zero proj_plus
[PROOF STATE]
proof (prove)
using this:
proj_poly ?k 0 = 0
proj_poly ?k (?p + ?q) = proj_poly ?k ?p + proj_poly ?k ?q

goal (1 subgoal):
 1. proj_poly k (sum f A) = (\<Sum>a\<in>A. proj_poly k (f a))
[PROOF STEP]
by (rule fun_sum_commute)


[STATEMENT]
lemma INFM_nat: "(\<exists>\<^sub>\<infinity>n. P n) \<longleftrightarrow> (\<forall>m. \<exists>n>m. P n)"
  for P :: "nat \<Rightarrow> bool"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>\<^sub>\<infinity>n. P n) = (\<forall>m. \<exists>n>m. P n)
[PROOF STEP]
by (simp add: frequently_cofinite infinite_nat_iff_unbounded)


[STATEMENT]
lemma min_set_product_set:
  "\<Otimes>\<^sub>m A = min_set (\<Otimes> A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Otimes>\<^sub>m A = min_set (\<Otimes> A)
[PROOF STEP]
by (cases "finite A", induction A rule: finite_induct) (simp_all add: min_product_set_def product_set_def, metis min_product_def)


[STATEMENT]
lemma sqr_of_sqrt_2 [simp]:
  fixes z:: "complex"
  shows "z * 2 / (complex_of_real (sqrt 2) * complex_of_real (sqrt 2)) = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z * 2 / (complex_of_real (sqrt 2) * complex_of_real (sqrt 2)) = z
[PROOF STEP]
by(metis nonzero_mult_div_cancel_right norm_numeral of_real_numeral of_real_power power2_eq_square
real_norm_def real_sqrt_abs real_sqrt_power zero_neq_numeral)


[STATEMENT]
lemma Union_segments: "\<Union> (segments n) = (if n=0 then {} else {0..1})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (segments n) = (if n = 0 then {} else {0..1})
[PROOF STEP]
by (simp add: segments_def Union_segment_image)


[STATEMENT]
lemma (in finite_product_prob_space) finite_measure_PiM_emb:
  "(\<And>i. i \<in> I \<Longrightarrow> A i \<in> sets (M i)) \<Longrightarrow> measure (PiM I M) (Pi\<^sub>E I A) = (\<Prod>i\<in>I. measure (M i) (A i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> A i \<in> M.events i) \<Longrightarrow> P.prob (Pi\<^sub>E I A) = (\<Prod>i\<in>I. M.prob i (A i))
[PROOF STEP]
using measure_PiM_emb[of I A] finite_index prod_emb_PiE_same_index[OF sets.sets_into_space, of I A M]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>I \<subseteq> I; finite I; \<And>i. i \<in> I \<Longrightarrow> A i \<in> M.events i\<rbrakk> \<Longrightarrow> P.prob (emb I I (Pi\<^sub>E I A)) = (\<Prod>i\<in>I. M.prob i (A i))
finite I
(\<And>i. i \<in> I \<Longrightarrow> A i \<in> M.events i) \<Longrightarrow> emb I I (Pi\<^sub>E I A) = Pi\<^sub>E I A

goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> A i \<in> M.events i) \<Longrightarrow> P.prob (Pi\<^sub>E I A) = (\<Prod>i\<in>I. M.prob i (A i))
[PROOF STEP]
by auto


[STATEMENT]
lemma enn2ereal_strict_mono [mono_intros]:
  assumes "x < y"
  shows "enn2ereal x < enn2ereal y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enn2ereal x < enn2ereal y
[PROOF STEP]
using assms less_ennreal.rep_eq
[PROOF STATE]
proof (prove)
using this:
x < y
(?x < ?xa) = (enn2ereal ?x < enn2ereal ?xa)

goal (1 subgoal):
 1. enn2ereal x < enn2ereal y
[PROOF STEP]
by auto


[STATEMENT]
lemma fglb_rep_eq:
  "\<langle>fglb A t\<rangle>\<^sub>f = (if (A = {}) then \<langle>t\<rangle>\<^sub>f else (\<Inter>x\<in>A. \<langle>x\<rangle>\<^sub>f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>fglb A t\<rangle>\<^sub>f = (if A = {} then \<langle>t\<rangle>\<^sub>f else \<Inter> (fset ` A))
[PROOF STEP]
apply (subgoal_tac "(if (A = {}) then \<langle>t\<rangle>\<^sub>f else (\<Inter>x\<in>A. \<langle>x\<rangle>\<^sub>f)) \<in> {x. finite x}")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (if A = {} then \<langle>t\<rangle>\<^sub>f else \<Inter> (fset ` A)) \<in> {x. finite x} \<Longrightarrow> \<langle>fglb A t\<rangle>\<^sub>f = (if A = {} then \<langle>t\<rangle>\<^sub>f else \<Inter> (fset ` A))
 2. (if A = {} then \<langle>t\<rangle>\<^sub>f else \<Inter> (fset ` A)) \<in> {x. finite x}
[PROOF STEP]
apply (metis Abs_fset_inverse fglb_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if A = {} then \<langle>t\<rangle>\<^sub>f else \<Inter> (fset ` A)) \<in> {x. finite x}
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>infinite (\<Inter> (fset ` A)); x \<in> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (metis finite_INT finite_fset)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma one_cong: "\<one> = 1 mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<one> = 1 mod m
[PROOF STEP]
using m_gt_one
[PROOF STATE]
proof (prove)
using this:
1 < m

goal (1 subgoal):
 1. \<one> = 1 mod m
[PROOF STEP]
by (auto simp: R_m_def residue_ring_def)


[STATEMENT]
lemma akra_bazzi_term_imp_less':
  assumes "akra_bazzi_term x\<^sub>0 (Suc x\<^sub>1) b t" "x > x\<^sub>1"
  shows   "t x < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t x < x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
akra_bazzi_term x\<^sub>0 (Suc x\<^sub>1) b t
x\<^sub>1 < x

goal (1 subgoal):
 1. t x < x
[PROOF STEP]
unfolding akra_bazzi_term_def
[PROOF STATE]
proof (prove)
using this:
\<exists>e h. 0 < e \<and> h \<in> O(\<lambda>x. real x / ln (real x) powr (1 + e)) \<and> (\<forall>x\<ge>Suc x\<^sub>1. x\<^sub>0 \<le> t x \<and> t x < x \<and> b * real x + h x = real (t x))
x\<^sub>1 < x

goal (1 subgoal):
 1. t x < x
[PROOF STEP]
by force


[STATEMENT]
lemma [smt_arith_multiplication]:
  fixes A B :: real and p n :: real
  assumes "A < B" "0 < n" "p > 0"
  shows "(A / n) * p < (B / n) * p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A / n * p < B / n * p
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A < B
0 < n
0 < p

goal (1 subgoal):
 1. A / n * p < B / n * p
[PROOF STEP]
by (auto simp: field_simps)


[STATEMENT]
lemma exists_or:
  "(\<exists> x . p x \<or> q x) = ((\<exists> x . p x) \<or> (\<exists> x . q x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. p x \<or> q x) = ((\<exists>x. p x) \<or> (\<exists>x. q x))
[PROOF STEP]
by auto


[STATEMENT]
lemma Suc_Max_notin_set: "finite X \<Longrightarrow> Suc (v + Max (insert 0 X)) \<notin> X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite X \<Longrightarrow> Suc (v + Max (insert 0 X)) \<notin> X
[PROOF STEP]
by (metis Max.boundedE Suc_n_not_le_n empty_iff finite.insertI le_add2 vimageE vimageI
      vimage_Suc_insert_0)


[STATEMENT]
lemma conjugation_multr: "x\<cdot>y \<sqinter> z = \<bottom> \<longleftrightarrow> y \<sqinter> (x \<rhd> z) = \<bottom>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<cdot> y \<sqinter> z = \<bottom>) = (y \<sqinter> (x \<rhd> z) = \<bottom>)
[PROOF STEP]
by (metis conjugate_r_def inf_bot_iff_le le_iff_inf_bot resr_galois)


[STATEMENT]
lemma union_diff_assoc: "C-B={#} \<Longrightarrow> (A+B)-C = A + (B-C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C - B = {#} \<Longrightarrow> A + B - C = A + (B - C)
[PROOF STEP]
by (simp add: multiset_eq_iff)


[STATEMENT]
lemma arcsin_pi: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> - (pi/2) \<le> arcsin y \<and> arcsin y \<le> pi \<and> sin (arcsin y) = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>- 1 \<le> y; y \<le> 1\<rbrakk> \<Longrightarrow> - (pi / 2) \<le> arcsin y \<and> arcsin y \<le> pi \<and> sin (arcsin y) = y
[PROOF STEP]
by (drule (1) arcsin) (force intro: order_trans)


[STATEMENT]
lemma partition_on_mset_distinct_disjoint:
  assumes "partition_on_mset A P"
  assumes "distinct_mset A"
  assumes "p1 \<in># P"
  assumes "p2 \<in># P - {#p1#}"
  shows "p1 \<inter># p2 = {#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p1 \<inter># p2 = {#}
[PROOF STEP]
using Diff_eq_empty_iff_mset assms diff_add_zero distinct_mset_add multiset_inter_assoc sum_mset.remove
[PROOF STATE]
proof (prove)
using this:
(?A - ?B = {#}) = (?A \<subseteq># ?B)
partition_on_mset A P
distinct_mset A
p1 \<in># P
p2 \<in># remove1_mset p1 P
?a - (?a + ?b) = (0::?'a)
distinct_mset (?L + ?L') = (distinct_mset ?L \<and> distinct_mset ?L' \<and> ?L \<inter># ?L' = {#})
?A \<inter># (?B \<inter># ?C) = ?A \<inter># ?B \<inter># ?C
?x \<in># ?A \<Longrightarrow> \<Sum>\<^sub># ?A = ?x + \<Sum>\<^sub># (remove1_mset ?x ?A)

goal (1 subgoal):
 1. p1 \<inter># p2 = {#}
[PROOF STEP]
by (smt partition_on_msetD1 subset_mset.inf.absorb_iff2 subset_mset.le_add_same_cancel1 subset_mset.le_iff_inf)


[STATEMENT]
lemma compact_sequence_with_limit:
  fixes f :: "nat \<Rightarrow> 'a::heine_borel"
  shows "(f \<longlongrightarrow> l) sequentially \<Longrightarrow> compact (insert l (range f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<longlonglongrightarrow> l \<Longrightarrow> compact (insert l (range f))
[PROOF STEP]
apply (simp add: compact_eq_bounded_closed, auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. f \<longlonglongrightarrow> l \<Longrightarrow> bounded (range f)
 2. f \<longlonglongrightarrow> l \<Longrightarrow> closed (insert l (range f))
[PROOF STEP]
apply (simp add: convergent_imp_bounded)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<longlonglongrightarrow> l \<Longrightarrow> closed (insert l (range f))
[PROOF STEP]
by (simp add: closed_limpt islimpt_insert sequence_unique_limpt)